From e4eb2b0fc5a9d25a43209c2dd38bcc5619ae2bf1 Mon Sep 17 00:00:00 2001 From: Anthony Sottile Date: Thu, 16 Feb 2017 10:46:23 -0800 Subject: [PATCH] __defaults__ is available in py27 --- pre_commit/envcontext.py | 4 +--- pre_commit/five.py | 4 ---- 2 files changed, 1 insertion(+), 7 deletions(-) diff --git a/pre_commit/envcontext.py b/pre_commit/envcontext.py index 2013c723..8066da3b 100644 --- a/pre_commit/envcontext.py +++ b/pre_commit/envcontext.py @@ -5,14 +5,12 @@ import collections import contextlib import os -from pre_commit import five - UNSET = collections.namedtuple('UNSET', ())() Var = collections.namedtuple('Var', ('name', 'default')) -setattr(Var.__new__, five.defaults_attr, ('',)) +setattr(Var.__new__, '__defaults__', ('',)) def format_env(parts, env): diff --git a/pre_commit/five.py b/pre_commit/five.py index 5b3732d9..b7741460 100644 --- a/pre_commit/five.py +++ b/pre_commit/five.py @@ -11,8 +11,6 @@ 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 @@ -22,8 +20,6 @@ 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')