mirror of
https://github.com/pre-commit/pre-commit.git
synced 2026-02-17 08:14:42 +04:00
Add envcontext helper
This commit is contained in:
parent
495e21b24d
commit
00a3a9a09b
3 changed files with 167 additions and 0 deletions
|
|
@ -12,6 +12,8 @@ if PY2: # pragma: no cover (PY2 only)
|
|||
return s
|
||||
else:
|
||||
return s.encode('UTF-8')
|
||||
|
||||
defaults_attr = 'func_defaults'
|
||||
else: # pragma: no cover (PY3 only)
|
||||
text = str
|
||||
|
||||
|
|
@ -21,6 +23,8 @@ else: # pragma: no cover (PY3 only)
|
|||
else:
|
||||
return s.decode('UTF-8')
|
||||
|
||||
defaults_attr = '__defaults__'
|
||||
|
||||
|
||||
def to_text(s):
|
||||
return s if isinstance(s, text) else s.decode('UTF-8')
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue