Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
beat.backend.python
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
beat
beat.backend.python
Commits
1504b287
There was a problem fetching the pipeline summary.
Commit
1504b287
authored
7 years ago
by
Samuel GAIST
Browse files
Options
Downloads
Plain Diff
Merge branch 'py2_py3_fixes' into '1.5.x'
Py2/Py3 fixes See merge request
!11
parents
463849b0
a8df29d5
Branches
Branches containing commit
Tags
v2.1.3
Tags containing commit
2 merge requests
!17
Merge development branch 1.5.x
,
!11
Py2/Py3 fixes
Pipeline
#
Changes
2
Pipelines
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
beat/backend/python/hash.py
+6
-6
6 additions, 6 deletions
beat/backend/python/hash.py
beat/backend/python/utils.py
+9
-0
9 additions, 0 deletions
beat/backend/python/utils.py
with
15 additions
and
6 deletions
beat/backend/python/hash.py
+
6
−
6
View file @
1504b287
...
@@ -44,12 +44,12 @@ def _sha256(s):
...
@@ -44,12 +44,12 @@ def _sha256(s):
"""
A python2/3 shortcut for :py:func:`haslib.sha256.hexdigest` to will
"""
A python2/3 shortcut for :py:func:`haslib.sha256.hexdigest` to will
ensure that the given string is unicode before going further.
ensure that the given string is unicode before going further.
"""
"""
try
:
if
isinstance
(
s
,
six
.
string_types
)
:
if
isinstance
(
s
,
six
.
string_types
)
:
try
:
s
=
six
.
u
(
s
)
s
=
six
.
u
(
s
)
.
encode
(
'
utf-8
'
)
except
:
except
:
pass
s
=
s
.
encode
(
'
utf-8
'
)
return
hashlib
.
sha256
(
s
.
encode
(
'
utf-8
'
)
).
hexdigest
()
return
hashlib
.
sha256
(
s
).
hexdigest
()
#----------------------------------------------------------
#----------------------------------------------------------
...
...
This diff is collapsed.
Click to expand it.
beat/backend/python/utils.py
+
9
−
0
View file @
1504b287
...
@@ -190,6 +190,15 @@ class File(object):
...
@@ -190,6 +190,15 @@ class File(object):
self
.
backup
()
self
.
backup
()
mode
=
'
wb
'
if
self
.
binary
else
'
wt
'
mode
=
'
wb
'
if
self
.
binary
else
'
wt
'
if
self
.
binary
:
mode
=
'
wb
'
if
isinstance
(
contents
,
six
.
string_types
):
contents
=
contents
.
encode
(
'
utf-8
'
)
else
:
mode
=
'
wt
'
if
not
isinstance
(
contents
,
six
.
string_types
):
contents
=
contents
.
decode
(
'
utf-8
'
)
with
open
(
self
.
path
,
mode
)
as
f
:
with
open
(
self
.
path
,
mode
)
as
f
:
f
.
write
(
contents
)
f
.
write
(
contents
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment