Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Python27 support #36

Merged
merged 11 commits into from
Oct 22, 2016
Merged

Python27 support #36

merged 11 commits into from
Oct 22, 2016

Conversation

kanghyojun
Copy link
Member

@kanghyojun kanghyojun commented Sep 18, 2016

#22

@dahlia
Copy link
Member

dahlia commented Sep 18, 2016

이 정도면 그냥 six 의존성 걸어서 쓰는 게 좋지 않을까 싶기도 합니다.

@kanghyojun
Copy link
Member Author

@dahlia 아예 http://pythonhosted.org/six/#module-six.moves 이런게있더군요.. 이걸로 해두겠습니다.

@kanghyojun kanghyojun force-pushed the py27-support branch 2 times, most recently from f5c5294 to a0c0ddc Compare October 13, 2016 15:09
@kanghyojun kanghyojun changed the title [WIP] py27 Python27 support Oct 21, 2016
@kanghyojun
Copy link
Member Author

@dahlia @Kroisse 리뷰부탁드려요

if PY3:
return cls_.__qualname__
else:
return cls_.__name__
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

이거 그냥 return getattr(cls, '__qualname__', cls.__name__)으로 하는 게 낫겠네요.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

그런데 오류 메세지 등에서 쓰려는 거면 typing._type_repr() 함수 그대로 가져다 쓰면 될 것 같습니다.

>>> typing._type_repr(int)
'int'
>>> typing._type_repr(typing.Mapping[str, int])
'typing.Mapping[str, int]'

try:
full_url = req.full_url
except AttributeError:
full_url = req.get_full_url()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

.full_url은 Python 3에서 생겼지만 .get_full_url() 메서드는 예나 지금이나 있으니까 그냥 후자로만 쓰면 될 것 같습니다.

[testenv]
deps = -e.[tests]
commands=
py.test -v tests
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

.travis.yml에도 해당 변경 반영해야 할 것 같습니다.

@@ -0,0 +1,7 @@
[tox]
envlist = py27,py35
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

.travis.yml에서는 3.4도 테스트하게 돼있는데 여기는 py34가 없네요?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

네 그리고 방금 CI에서 터지는걸발견했는데 typing <3.5.2에서

class A:
    pass

typing.Optional[A]

가 터지는걸 체크해서 고쳤습니다

@kanghyojun kanghyojun merged commit 2cbbc7d into nirum-lang:master Oct 22, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants