-
Notifications
You must be signed in to change notification settings - Fork 36
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
Add typing to signac.core.json. #313
Changes from 15 commits
7ab5570
b7d77a5
d594818
a168649
af94a5c
936c636
5b275d3
f35944d
6fa5657
fdc5d29
9797582
8a0417a
ba49a25
43a6387
48aa8be
5f406e2
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,7 +8,7 @@ orbs: | |
win: circleci/[email protected] # Enables Windows executors | ||
|
||
jobs: | ||
style-check: | ||
pre-checks: | ||
docker: | ||
- image: circleci/python:3.8 | ||
|
||
|
@@ -19,18 +19,23 @@ jobs: | |
- run: | ||
name: install-dependencies | ||
command: | | ||
pip install --progress-bar off --user -U flake8==3.7.1 pydocstyle==5.0.2 | ||
pip install --progress-bar off --user -U flake8==3.7.1 pydocstyle==5.0.2 mypy==0.770 | ||
|
||
- run: | ||
name: style-check-code | ||
name: check-style | ||
command: | | ||
python -m flake8 --show-source . | ||
|
||
- run: | ||
name: style-check-doc-strings | ||
name: check-docstyle | ||
command: | | ||
pydocstyle | ||
|
||
- run: | ||
name: check-type-hints | ||
command: | | ||
mypy . | ||
|
||
linux-python-38: &linux-template | ||
docker: | ||
- image: circleci/python:3.8 | ||
|
@@ -180,25 +185,25 @@ workflows: | |
version: 2 | ||
test: | ||
jobs: | ||
- style-check | ||
- pre-checks | ||
- linux-python-38: | ||
requires: | ||
- style-check | ||
- pre-checks | ||
- linux-python-37: | ||
requires: | ||
- style-check | ||
- pre-checks | ||
- linux-python-36: | ||
requires: | ||
- style-check | ||
- pre-checks | ||
- linux-python-35: | ||
requires: | ||
- style-check | ||
- pre-checks | ||
- linux-pypy-3: | ||
requires: | ||
- linux-python-36 | ||
- windows-python-38: | ||
requires: | ||
- style-check | ||
- pre-checks | ||
- check-metadata: | ||
filters: | ||
branches: | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -22,9 +22,5 @@ class ExportError(Error, RuntimeError): | |
pass | ||
|
||
|
||
class FileNotFoundError(Error, FileNotFoundError): | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This seemed like an unused compatibility layer for Python 2 (which did not have |
||
pass | ||
|
||
|
||
class FetchError(FileNotFoundError): | ||
pass |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -17,7 +17,7 @@ | |
|
||
|
||
SESSION_PASSWORD_HASH_CACHE = SimpleKeyring() | ||
SESSION_USERNAME_CACHE = dict() | ||
SESSION_USERNAME_CACHE = dict() # type: ignore | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Explanation: This requests a type annotation for the |
||
|
||
""" | ||
THIS MODULE IS DEPRECATED! | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -56,7 +56,7 @@ def _cast(x): | |
"Attempt to interpret x with the correct type." | ||
try: | ||
if x in CAST_MAPPING_WARNING: | ||
print("Did you mean {}?".format(CAST_MAPPING_WARNING[x], file=sys.stderr)) | ||
print("Did you mean {}?".format(CAST_MAPPING_WARNING[x]), file=sys.stderr) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
return CAST_MAPPING[x] | ||
except KeyError: | ||
try: | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -159,7 +159,7 @@ class RegexFileCrawler(BaseCrawler): | |
MyCrawler.define('.*\/a_(?P<a>\d+)\.txt', 'TextFile') | ||
""" | ||
"Mapping of compiled regex objects and associated formats." | ||
definitions = dict() | ||
definitions = dict() # type: ignore | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Explanation: This requests a type annotation for the |
||
|
||
@classmethod | ||
@deprecated(deprecated_in="1.3", removed_in="2.0", current_version=__version__, | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -507,8 +507,8 @@ class H5StoreManager(DictManager): | |
:param prefix: | ||
The directory prefix shared by all stores managed by this class. | ||
""" | ||
cls = H5Store | ||
suffix = '.h5' | ||
cls = H5Store # type: ignore | ||
suffix = '.h5' # type: ignore | ||
Comment on lines
+510
to
+511
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Explanation for the ignore: These are overriding a default of |
||
|
||
@staticmethod | ||
def _validate_key(key): | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,14 +11,14 @@ | |
|
||
logger = logging.getLogger('sync') | ||
logging.addLevelName(LEVEL_MORE, 'MORE') | ||
logging.MORE = LEVEL_MORE | ||
logging.MORE = LEVEL_MORE # type: ignore | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Explanation for the ignore: Assigning signac/syncutil.py:14: error: Module has no attribute "MORE"
signac/syncutil.py:21: error: "Logger" has no attribute "more" |
||
|
||
|
||
def log_more(msg, *args, **kwargs): | ||
logger.log(LEVEL_MORE, msg, *args, **kwargs) | ||
|
||
|
||
logger.more = log_more | ||
logger.more = log_more # type: ignore | ||
|
||
|
||
def copytree(src, dst, copy_function=shutil.copy2, symlinks=False): | ||
|
@@ -48,13 +48,13 @@ def copytree(src, dst, copy_function=shutil.copy2, symlinks=False): | |
|
||
|
||
class dircmp_deep(dircmp): | ||
|
||
def phase3(self): # Find out differences between common files | ||
xx = filecmp.cmpfiles(self.left, self.right, self.common_files, shallow=False) | ||
self.same_files, self.diff_files, self.funny_files = xx | ||
|
||
methodmap = dict(dircmp.methodmap) | ||
methodmap['samefiles'] = methodmap['diff_files'] = phase3 | ||
# The type check for the following line must be ignored: https://github.com/python/mypy/issues/708 | ||
bdice marked this conversation as resolved.
Show resolved
Hide resolved
|
||
methodmap['same_files'] = methodmap['diff_files'] = phase3 # type: ignore | ||
|
||
|
||
class _DocProxy(object): | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ignore_missing_imports
is enabled so thatmypy
doesn't get mad about missing type annotations in dependencies likedeprecation
ornumpy
.