Skip to content
This repository has been archived by the owner on May 30, 2022. It is now read-only.

Support python3.7 #19

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .idea/vcs.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 8 additions & 4 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
language: python

dist: xenial

python:
- "3.6"
- "3.6"
- "3.7"

install:
- pip3 install pipenv
- pipenv install -d --system --three

- pip3 install pipenv nose
- python3 setup.py install

script:
- nosetests
Expand All @@ -14,4 +17,5 @@ notifications:
email:
recipients:
- asoli@fb.com
- cmarchent@fb.com
on_failure: change # default: always
13 changes: 11 additions & 2 deletions nubia/internal/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,11 @@
import signal
import string
import subprocess
import sys

from collections import namedtuple
from typing import _Union, Any, Iterable # noqa T484
from typing import Any, Union, Iterable # noqa T484



def add_command_arguments(parser, options):
Expand Down Expand Up @@ -168,6 +170,7 @@ def issubclass_(obj, class_):
def is_union(t: Any) -> bool:
"""Check whether type is a Union.


@param t: type to check
@type: Any
@returns: `True` if type is a Union, `False` otherwise
Expand All @@ -177,7 +180,13 @@ def is_union(t: Any) -> bool:
https://github.com/ilevkivskyi/typing_inspect for the rationale behind the
implementation.
"""
return type(t) is _Union
if sys.version_info[:3] >= (3, 7, 0): # PEP 560
from typing import _GenericAlias
return (t is Union or
isinstance(t, _GenericAlias) and t.__origin__ is Union)
else:
from typing import _Union
return type(t) is _Union


def is_optional(t: Any) -> bool:
Expand Down