Skip to content

Commit

Permalink
[Add] use flake8
Browse files Browse the repository at this point in the history
[Mod] use black instead of yapf
  • Loading branch information
nanoric committed Jan 24, 2019
1 parent 4c16a6f commit ed1758a
Show file tree
Hide file tree
Showing 51 changed files with 1,398 additions and 1,452 deletions.
8 changes: 8 additions & 0 deletions .flake8
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
[flake8]
exclude = .git,__pycache__,clang,build,dist,generated_files,templates,__init__.py,
ignore =
E501 line too long, fixed by black
W503 line break before binary operator

W293 blank line contains whitespace
W291 trailing whitespace
3 changes: 1 addition & 2 deletions .pylintrc
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# A comma-separated list of package or module names from where C extensions may
# be loaded. Extensions are loading into the active Python interpreter and may
# run arbitrary code.
extension-pkg-whitelist=PyQt5
extension-pkg-whitelist=PyQt5, vnctp

# Add files or directories to the blacklist. They should be base names, not
# paths.
Expand Down Expand Up @@ -66,7 +66,6 @@ disable=
missing-docstring,
unused-argument,
no-self-use,
bare-except,


# Enable the message, report, category or checker with the given id(s). You can
Expand Down
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,6 @@ install:
- pip install -r requirements-dev.txt
# command to run tests
script:
- python tools/ci/format_check.py
- python tools/ci/check_format.py
- pylint --rcfile=.pylintrc vnpy
- python tests/test_all.py
13 changes: 8 additions & 5 deletions binding/generator/adaptor/ctpadaptor.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,18 +14,21 @@ def clear_dir(path: str):


class CtpAdaptor:

def __init__(self, td_header, md_header):
self.td_header = td_header
self.md_header = md_header

def parse(self) -> GeneratorOptions:
r0: CXXParseResult = CXXParser([self.md_header, self.td_header]).parse()
r0: CXXParseResult = CXXParser(
[self.md_header, self.td_header]
).parse()
r1: PreProcessorResult = PreProcessor(r0).process()

constants = r0.variables
constants.update(r1.const_macros)
constants = {k: v for k, v in constants.items() if not k.startswith('_')}
constants = {
k: v for k, v in constants.items() if not k.startswith("_")
}

functions = r0.functions
classes = r1.classes
Expand All @@ -39,7 +42,7 @@ def parse(self) -> GeneratorOptions:
if m.is_virtual:
m.is_pure_virtual = False
m.is_final = True
elif type == 'Spi':
elif type == "Spi":
for ms in c.functions.values():
for m in ms:
m.is_virtual = True
Expand All @@ -54,5 +57,5 @@ def parse(self) -> GeneratorOptions:
dict_classes=r1.dict_classes,
enums=r0.enums,
)
options.includes = ['custom_wrappers/spi.hpp']
options.includes = ["custom_wrappers/spi.hpp"]
return options
Loading

0 comments on commit ed1758a

Please sign in to comment.