├── tests ├── __init__.py └── test_bin_checker.py ├── src └── bin_checker │ ├── __init__.py │ └── bin_checker.py ├── .travis.yml ├── .flake8 ├── .isort.cfg ├── pyproject.toml ├── requirements-lint.txt ├── .bumpversion.cfg ├── LICENCE ├── Rakefile ├── setup.py ├── .gitignore ├── CODE_OF_CONDUCT.md ├── README.md └── .pylintrc /tests/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /src/bin_checker/__init__.py: -------------------------------------------------------------------------------- 1 | __version__ = '0.1.0' 2 | 3 | from .bin_checker import get_bin # noqa: F401 4 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | language: python 2 | python: 3 | - "3.7" 4 | - "3.8" 5 | install: 6 | - pip install -e .[development] 7 | script: 8 | - python tests/test_bin_checker.py 9 | -------------------------------------------------------------------------------- /.flake8: -------------------------------------------------------------------------------- 1 | [flake8] 2 | max-line-length = 119 3 | ignore = W503 4 | exclude = 5 | .git, 6 | __pycache__, 7 | docs/source/conf.py, 8 | old, 9 | build, 10 | dist, 11 | migrations 12 | -------------------------------------------------------------------------------- /.isort.cfg: -------------------------------------------------------------------------------- 1 | [settings] 2 | line_length = 60 3 | multi_line_output = 3 4 | use_parentheses = true 5 | include_trailing_comma = true 6 | quiet = true 7 | force_grid_wrap = 0 8 | sections = FUTURE,STDLIB,THIRDPARTY,FIRSTPARTY,LOCALFOLDER 9 | -------------------------------------------------------------------------------- /pyproject.toml: -------------------------------------------------------------------------------- 1 | [tool.black] 2 | line-length = 88 3 | py36 = true 4 | skip-string-normalization = true 5 | quiet = true 6 | exclude=''' 7 | /( 8 | \.git 9 | | \.hg 10 | | \.tox 11 | | \.venv 12 | | _build 13 | | buck-out 14 | | build 15 | | dist 16 | )/ 17 | ''' 18 | -------------------------------------------------------------------------------- /requirements-lint.txt: -------------------------------------------------------------------------------- 1 | flake8==3.8.3 2 | flake8-bandit==2.1.2 3 | flake8-blind-except==0.1.1 4 | flake8-bugbear==20.1.4 5 | flake8-builtins==1.5.3 6 | flake8-polyfill==1.0.2 7 | flake8-print==3.1.4 8 | flake8-quotes==3.2.0 9 | flake8-string-format==0.3.0 10 | isort==4.3.21 11 | pylint==2.4.2 12 | black==20.8b1 -------------------------------------------------------------------------------- /.bumpversion.cfg: -------------------------------------------------------------------------------- 1 | [bumpversion] 2 | current_version = 0.1.0 3 | commit = True 4 | tag = True 5 | 6 | [bumpversion:file:README.md] 7 | search = version-{current_version}-orange.svg 8 | replace = version-{new_version}-orange.svg 9 | 10 | [bumpversion:file:setup.py] 11 | 12 | [bumpversion:file:src/bin_checker/__init__.py] 13 | -------------------------------------------------------------------------------- /LICENCE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2020 Prompt API 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. -------------------------------------------------------------------------------- /Rakefile: -------------------------------------------------------------------------------- 1 | desc "Default task => :install" 2 | task :default => [:install] 3 | 4 | desc "Remove/Delete build..." 5 | task :clean do 6 | rm_rf %w(build dist) 7 | rm_rf Dir.glob("*.egg-info") 8 | puts "Build files are removed..." 9 | end 10 | 11 | desc "Install package for local development purpose" 12 | task :install => [:build] do 13 | system "pip install -e .[development]" 14 | end 15 | 16 | desc "Build package" 17 | task :build => [:clean] do 18 | system "python setup.py sdist bdist_wheel" 19 | end 20 | 21 | namespace :upload do 22 | desc "Upload package to main distro (release)" 23 | task :main => [:build] do 24 | puts "Uploading package to MAIN distro..." 25 | system "twine upload --repository pypi-promptapi dist/*" 26 | end 27 | 28 | desc "Upload package to test distro" 29 | task :test => [:build] do 30 | puts "Uploading package to TEST distro..." 31 | system "twine upload --repository testpypi-promptapi dist/*" 32 | end 33 | end 34 | 35 | AVAILABLE_REVISIONS = ["major", "minor", "patch"] 36 | desc "Bump version" 37 | task :bump, [:revision] do |t, args| 38 | args.with_defaults(revision: "patch") 39 | abort "Please provide valid revision: #{AVAILABLE_REVISIONS.join(',')}" unless AVAILABLE_REVISIONS.include?(args.revision) 40 | system "bumpversion #{args.revision}" 41 | end 42 | 43 | desc "Run test" 44 | task :test do 45 | system "python tests/test_bin_checker.py" 46 | end 47 | -------------------------------------------------------------------------------- /tests/test_bin_checker.py: -------------------------------------------------------------------------------- 1 | # pylint: disable=R0201,E1101 2 | 3 | import os 4 | import sys 5 | import unittest 6 | from collections import namedtuple 7 | 8 | from bin_checker import get_bin 9 | 10 | EXISTING_PROMPTAPI_TOKEN = os.environ.get('PROMPTAPI_TOKEN', None) 11 | 12 | 13 | class TestSimple(unittest.TestCase): 14 | def test_api_token(self): 15 | os.environ['PROMPTAPI_TOKEN'] = '' # noqa: S105 16 | 17 | bin_information = get_bin('302596') 18 | 19 | self.assertTrue(bin_information.get('error', False)) 20 | self.assertEqual( 21 | 'You need to set PROMPTAPI_TOKEN environment variable', 22 | bin_information.get('error', None), 23 | ) 24 | 25 | def test_real_request(self): 26 | os.environ['PROMPTAPI_TOKEN'] = EXISTING_PROMPTAPI_TOKEN 27 | 28 | bin_information = get_bin('302596') 29 | 30 | if bin_information.get('error', False): 31 | sys.stdout.write(bin_information.get('error')) 32 | else: 33 | result = namedtuple('result', bin_information.keys())(**bin_information) 34 | 35 | self.assertEqual(result.bank_name, 'Diners Club International') 36 | self.assertEqual(result.country, 'United States Of America') 37 | self.assertEqual(result.url, 'www.dinersclub.com') 38 | self.assertEqual(result.type, 'Credit') 39 | self.assertEqual(result.scheme, 'Discover') 40 | self.assertEqual(result.bin, '302596') 41 | 42 | 43 | if __name__ == '__main__': 44 | unittest.main() 45 | -------------------------------------------------------------------------------- /src/bin_checker/bin_checker.py: -------------------------------------------------------------------------------- 1 | __all__ = ['get_bin'] 2 | 3 | import json 4 | import os 5 | from http import HTTPStatus 6 | 7 | import requests 8 | 9 | 10 | def get_bin(bin_number, timeout=5): 11 | """ 12 | default timeout is set to 5 seconds by default 13 | """ 14 | 15 | promptapi_endpoint = f'https://api.promptapi.com/bincheck/{bin_number}' 16 | apikey = os.environ.get('PROMPTAPI_TOKEN', None) 17 | if not apikey: 18 | return dict(error='You need to set PROMPTAPI_TOKEN environment variable') 19 | 20 | result = dict() 21 | headers = dict(apikey=apikey) 22 | http_error = None 23 | 24 | try: 25 | response = requests.request( 26 | 'GET', promptapi_endpoint, timeout=timeout, headers=headers 27 | ) 28 | response.raise_for_status() 29 | except requests.exceptions.Timeout: 30 | return dict(error='Connection timeout error') 31 | except requests.exceptions.TooManyRedirects: 32 | return dict(error='Too many redirects error') 33 | except requests.exceptions.ConnectionError: 34 | return dict(error='Connection error') 35 | except requests.exceptions.HTTPError as err: 36 | http_error = str(err) 37 | try: 38 | result = response.json() 39 | except json.decoder.JSONDecodeError as err: 40 | return dict(error=f'JSON decoding error: {str(err)}') 41 | 42 | if http_error: 43 | return dict(error=result.get('message', http_error)) 44 | 45 | if response.status_code != HTTPStatus.OK.value: 46 | return dict( 47 | error=result.get('message', response.reason), status=response.status_code 48 | ) 49 | return result 50 | -------------------------------------------------------------------------------- /setup.py: -------------------------------------------------------------------------------- 1 | import pathlib 2 | 3 | from setuptools import find_packages, setup 4 | 5 | CURRENT_WORKING_DIRECTORY = pathlib.Path(__file__).parent.resolve() 6 | LONG_DESCRIPTION = (CURRENT_WORKING_DIRECTORY / 'README.md').read_text(encoding='utf-8') 7 | 8 | setup( 9 | name='pa-bin-checker', 10 | version='0.1.0', 11 | description="Python wrapper for Prompt API's BIN Checker API", 12 | long_description=LONG_DESCRIPTION, 13 | long_description_content_type='text/markdown', 14 | url='https://github.com/promptapi/bin-checker-py', 15 | author='Prompt API', 16 | author_email='hello@promptapi.com', 17 | license='MIT', 18 | python_requires='>=3.7', 19 | package_dir={'': 'src'}, 20 | packages=find_packages(where='src', exclude=['tests']), 21 | extras_require={ 22 | 'development': ['vb-console'], 23 | }, 24 | classifiers=[ 25 | 'Development Status :: 5 - Production/Stable', 26 | 'License :: OSI Approved :: MIT License', 27 | 'Operating System :: OS Independent', 28 | 'Programming Language :: Python :: 3', 29 | 'Programming Language :: Python :: 3.7', 30 | 'Programming Language :: Python :: 3 :: Only', 31 | 'Intended Audience :: Developers', 32 | 'Intended Audience :: Financial and Insurance Industry', 33 | 'Topic :: Software Development :: Libraries :: Python Modules', 34 | ], 35 | keywords='promptapi, bin, checker', 36 | install_requires=['requests'], 37 | project_urls={ 38 | 'Prompt API': 'https://promptapi.com', 39 | 'BIN Checker API': 'https://promptapi.com/marketplace/description/bincheck-api', 40 | 'Source': 'https://github.com/promptapi/bin-checker-py', 41 | }, 42 | ) 43 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Created by https://www.toptal.com/developers/gitignore/api/python 2 | # Edit at https://www.toptal.com/developers/gitignore?templates=python 3 | 4 | ### Python ### 5 | # Byte-compiled / optimized / DLL files 6 | __pycache__/ 7 | *.py[cod] 8 | *$py.class 9 | 10 | # C extensions 11 | *.so 12 | 13 | # Distribution / packaging 14 | .Python 15 | build/ 16 | develop-eggs/ 17 | dist/ 18 | downloads/ 19 | eggs/ 20 | .eggs/ 21 | lib/ 22 | lib64/ 23 | parts/ 24 | sdist/ 25 | var/ 26 | wheels/ 27 | pip-wheel-metadata/ 28 | share/python-wheels/ 29 | *.egg-info/ 30 | .installed.cfg 31 | *.egg 32 | MANIFEST 33 | 34 | # PyInstaller 35 | # Usually these files are written by a python script from a template 36 | # before PyInstaller builds the exe, so as to inject date/other infos into it. 37 | *.manifest 38 | *.spec 39 | 40 | # Installer logs 41 | pip-log.txt 42 | pip-delete-this-directory.txt 43 | 44 | # Unit test / coverage reports 45 | htmlcov/ 46 | .tox/ 47 | .nox/ 48 | .coverage 49 | .coverage.* 50 | .cache 51 | nosetests.xml 52 | coverage.xml 53 | *.cover 54 | *.py,cover 55 | .hypothesis/ 56 | .pytest_cache/ 57 | pytestdebug.log 58 | 59 | # Translations 60 | *.mo 61 | *.pot 62 | 63 | # Django stuff: 64 | *.log 65 | local_settings.py 66 | db.sqlite3 67 | db.sqlite3-journal 68 | 69 | # Flask stuff: 70 | instance/ 71 | .webassets-cache 72 | 73 | # Scrapy stuff: 74 | .scrapy 75 | 76 | # Sphinx documentation 77 | docs/_build/ 78 | doc/_build/ 79 | 80 | # PyBuilder 81 | target/ 82 | 83 | # Jupyter Notebook 84 | .ipynb_checkpoints 85 | 86 | # IPython 87 | profile_default/ 88 | ipython_config.py 89 | 90 | # pyenv 91 | .python-version 92 | 93 | # pipenv 94 | # According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control. 95 | # However, in case of collaboration, if having platform-specific dependencies or dependencies 96 | # having no cross-platform support, pipenv may install dependencies that don't work, or not 97 | # install all needed dependencies. 98 | #Pipfile.lock 99 | 100 | # PEP 582; used by e.g. github.com/David-OConnor/pyflow 101 | __pypackages__/ 102 | 103 | # Celery stuff 104 | celerybeat-schedule 105 | celerybeat.pid 106 | 107 | # SageMath parsed files 108 | *.sage.py 109 | 110 | # Environments 111 | .env 112 | .venv 113 | env/ 114 | venv/ 115 | ENV/ 116 | env.bak/ 117 | venv.bak/ 118 | 119 | # Spyder project settings 120 | .spyderproject 121 | .spyproject 122 | 123 | # Rope project settings 124 | .ropeproject 125 | 126 | # mkdocs documentation 127 | /site 128 | 129 | # mypy 130 | .mypy_cache/ 131 | .dmypy.json 132 | dmypy.json 133 | 134 | # Pyre type checker 135 | .pyre/ 136 | 137 | # pytype static type analyzer 138 | .pytype/ 139 | 140 | # End of https://www.toptal.com/developers/gitignore/api/python -------------------------------------------------------------------------------- /CODE_OF_CONDUCT.md: -------------------------------------------------------------------------------- 1 | # Contributor Covenant Code of Conduct 2 | 3 | ## Our Pledge 4 | 5 | In the interest of fostering an open and welcoming environment, we as 6 | contributors and maintainers pledge to making participation in our project and 7 | our community a harassment-free experience for everyone, regardless of age, body 8 | size, disability, ethnicity, gender identity and expression, level of experience, 9 | nationality, personal appearance, race, religion, or sexual identity and 10 | orientation. 11 | 12 | ## Our Standards 13 | 14 | Examples of behavior that contributes to creating a positive environment 15 | include: 16 | 17 | * Using welcoming and inclusive language 18 | * Being respectful of differing viewpoints and experiences 19 | * Gracefully accepting constructive criticism 20 | * Focusing on what is best for the community 21 | * Showing empathy towards other community members 22 | 23 | Examples of unacceptable behavior by participants include: 24 | 25 | * The use of sexualized language or imagery and unwelcome sexual attention or 26 | advances 27 | * Trolling, insulting/derogatory comments, and personal or political attacks 28 | * Public or private harassment 29 | * Publishing others' private information, such as a physical or electronic 30 | address, without explicit permission 31 | * Other conduct which could reasonably be considered inappropriate in a 32 | professional setting 33 | 34 | ## Our Responsibilities 35 | 36 | Project maintainers are responsible for clarifying the standards of acceptable 37 | behavior and are expected to take appropriate and fair corrective action in 38 | response to any instances of unacceptable behavior. 39 | 40 | Project maintainers have the right and responsibility to remove, edit, or 41 | reject comments, commits, code, wiki edits, issues, and other contributions 42 | that are not aligned to this Code of Conduct, or to ban temporarily or 43 | permanently any contributor for other behaviors that they deem inappropriate, 44 | threatening, offensive, or harmful. 45 | 46 | ## Scope 47 | 48 | This Code of Conduct applies both within project spaces and in public spaces 49 | when an individual is representing the project or its community. Examples of 50 | representing a project or community include using an official project e-mail 51 | address, posting via an official social media account, or acting as an appointed 52 | representative at an online or offline event. Representation of a project may be 53 | further defined and clarified by project maintainers. 54 | 55 | ## Enforcement 56 | 57 | Instances of abusive, harassing, or otherwise unacceptable behavior may be 58 | reported by contacting the project team at hello@promptapi.com. All 59 | complaints will be reviewed and investigated and will result in a response that 60 | is deemed necessary and appropriate to the circumstances. The project team is 61 | obligated to maintain confidentiality with regard to the reporter of an incident. 62 | Further details of specific enforcement policies may be posted separately. 63 | 64 | Project maintainers who do not follow or enforce the Code of Conduct in good 65 | faith may face temporary or permanent repercussions as determined by other 66 | members of the project's leadership. 67 | 68 | ## Attribution 69 | 70 | This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, 71 | available at [https://contributor-covenant.org/version/1/4][version] 72 | 73 | [homepage]: https://contributor-covenant.org 74 | [version]: https://contributor-covenant.org/version/1/4/ 75 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | ![Python](https://img.shields.io/badge/python-3.7.4-green.svg) 2 | ![Version](https://img.shields.io/badge/version-0.1.0-orange.svg) 3 | [![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black) 4 | [![Build Status](https://travis-ci.org/promptapi/bin-checker-py.svg?branch=main)](https://travis-ci.org/promptapi/bin-checker-py) 5 | 6 | # Prompt API - BIN Checker - Python Package 7 | 8 | `pa-bin-checker` is a simple python wrapper for [bincheck-api][bincheck-api]. 9 | 10 | ## Requirements 11 | 12 | 1. You need to signup for [Prompt API][promptapi-signup] 13 | 1. You need to subscribe [bincheck-api][bincheck-api], test drive is **free!!!** 14 | 1. You need to set `PROMPTAPI_TOKEN` environment variable after subscription. 15 | 16 | then; 17 | 18 | ```bash 19 | $ pip install pa-bin-checker 20 | ``` 21 | 22 | --- 23 | 24 | ## Example Usage 25 | 26 | ```python 27 | from bin_checker import get_bin 28 | 29 | bin_information = get_bin('302596') # example BIN 30 | if bin_information.get('error', False): 31 | print(bin_information['bank_name']) # you have a dict! 32 | ``` 33 | 34 | You’ll have a dict of data: 35 | 36 | ```python 37 | { 38 | 'bank_name': 'Diners Club International', 39 | 'country': 'United States Of America', 40 | 'url': 'www.dinersclub.com', 41 | 'type': 'Credit', 42 | 'scheme': 'Discover', 43 | 'bin': '302596', 44 | } 45 | ``` 46 | 47 | If you receive an error, payload will contain `error` key. Example error 48 | response: 49 | 50 | ```python 51 | { 52 | 'error': 'You need to set PROMPTAPI_TOKEN environment variable', 53 | } 54 | ``` 55 | 56 | --- 57 | 58 | ## Development 59 | 60 | Create your virtual environment, then use `rake` tasks: 61 | 62 | ```bash 63 | $ rake -T 64 | 65 | rake build # Build package 66 | rake bump[revision] # Bump version 67 | rake clean # Remove/Delete build.. 68 | rake default # Default task => :install 69 | rake install # Install package for local development purpose 70 | rake test # Run test 71 | rake upload:main # Upload package to main distro (release) 72 | rake upload:test # Upload package to test distro 73 | ``` 74 | 75 | You need `ruby` to run rake tasks. Rake tasks are just helper functions for 76 | automation. You don’t need to install anything to proceed. If you are on 77 | macOS, you’ll already have ruby installed. 78 | 79 | If you are on Ubuntu: 80 | 81 | ```bash 82 | # install ruby on Ubuntu 83 | $ sudo apt-get update -y 84 | $ sudo apt-get install -y ruby-full 85 | ``` 86 | 87 | You need `bumpversion` to manage package versioning. If you are on 88 | macOS: 89 | 90 | ```bash 91 | $ brew install bumpversion 92 | ``` 93 | 94 | If you are on Ubuntu: 95 | 96 | ```bash 97 | # install bumpversion on Ubuntu 98 | $ sudo apt-get update -y 99 | $ sudo apt-get -y bumpversion 100 | ``` 101 | 102 | To install and test package locally, just call `rake` or `rake install`. 103 | Tests are available under `tests/` folder. Run `rake test` to run tests. 104 | 105 | To continue without `ruby` or `rake`: 106 | 107 | - Install package locally: `pip install -e .[development]` 108 | - Build package: `python setup.py sdist bdist_wheel` 109 | - Install `bumpversion`: `pip install bumpversion` 110 | 111 | For uploading package to **pypi** registry you need to install: 112 | 113 | ```bash 114 | $ pip install -U wheel setuptools 115 | ``` 116 | 117 | You need to put pypi credentials to `~/.pypirc`: 118 | 119 | [distutils] 120 | index-servers= 121 | pypi-promptapi 122 | testpypi-promptapi 123 | 124 | [pypi-promptapi] 125 | repository = https://upload.pypi.org/legacy/ 126 | username: __token__ 127 | password: TOKEN 128 | 129 | [testpypi-promptapi] 130 | repository: https://test.pypi.org/legacy/ 131 | username: __token__ 132 | password: TOKEN 133 | 134 | - Upload to main registry: `twine upload --repository pypi-promptapi dist/*` 135 | - Upload to test repository: `twine upload --repository testpypi-promptapi dist/*` 136 | 137 | --- 138 | 139 | ## License 140 | 141 | This project is licensed under MIT 142 | 143 | --- 144 | 145 | ## Contributer(s) 146 | 147 | * [Prompt API](https://github.com/promptapi) - Creator, maintainer 148 | 149 | --- 150 | 151 | ## Contribute 152 | 153 | All PR’s are welcome! 154 | 155 | 1. `fork` (https://github.com/promptapi/bin-checker-py/fork) 156 | 1. Create your `branch` (`git checkout -b my-feature`) 157 | 1. `commit` yours (`git commit -am 'Add awesome features...'`) 158 | 1. `push` your `branch` (`git push origin my-feature`) 159 | 1. Than create a new **Pull Request**! 160 | 161 | This project is intended to be a safe, 162 | welcoming space for collaboration, and contributors are expected to adhere to 163 | the [code of conduct][coc]. 164 | 165 | 166 | --- 167 | 168 | [bincheck-api]: https://promptapi.com/marketplace/description/bincheck-api 169 | [promptapi-signup]: https://promptapi.com/#signup-form 170 | [coc]: https://github.com/promptapi/bin-checker-py/blob/main/CODE_OF_CONDUCT.md -------------------------------------------------------------------------------- /.pylintrc: -------------------------------------------------------------------------------- 1 | [MASTER] 2 | 3 | # A comma-separated list of package or module names from where C extensions may 4 | # be loaded. Extensions are loading into the active Python interpreter and may 5 | # run arbitrary code. 6 | extension-pkg-whitelist= 7 | 8 | # Add files or directories to the blacklist. They should be base names, not 9 | # paths. 10 | ignore=CVS 11 | 12 | # Add files or directories matching the regex patterns to the blacklist. The 13 | # regex matches against base names, not paths. 14 | ignore-patterns= 15 | 16 | # Python code to execute, usually for sys.path manipulation such as 17 | # pygtk.require(). 18 | #init-hook= 19 | 20 | # Use multiple processes to speed up Pylint. Specifying 0 will auto-detect the 21 | # number of processors available to use. 22 | jobs=0 23 | 24 | # Control the amount of potential inferred values when inferring a single 25 | # object. This can help the performance when dealing with large functions or 26 | # complex, nested conditions. 27 | limit-inference-results=100 28 | 29 | # List of plugins (as comma separated values of python modules names) to load, 30 | # usually to register additional checkers. 31 | load-plugins= 32 | 33 | # Pickle collected data for later comparisons. 34 | persistent=yes 35 | 36 | # Specify a configuration file. 37 | #rcfile= 38 | 39 | # When enabled, pylint would attempt to guess common misconfiguration and emit 40 | # user-friendly hints instead of false-positive error messages. 41 | suggestion-mode=yes 42 | 43 | # Allow loading of arbitrary C extensions. Extensions are imported into the 44 | # active Python interpreter and may run arbitrary code. 45 | unsafe-load-any-extension=no 46 | 47 | 48 | [MESSAGES CONTROL] 49 | 50 | # Only show warnings with the listed confidence levels. Leave empty to show 51 | # all. Valid levels: HIGH, INFERENCE, INFERENCE_FAILURE, UNDEFINED. 52 | confidence= 53 | 54 | # Disable the message, report, category or checker with the given id(s). You 55 | # can either give multiple identifiers separated by comma (,) or put this 56 | # option multiple times (only on the command line, not in the configuration 57 | # file where it should appear only once). You can also use "--disable=all" to 58 | # disable everything first and then reenable specific checks. For example, if 59 | # you want to run only the similarities checker, you can use "--disable=all 60 | # --enable=similarities". If you want to run only the classes checker, but have 61 | # no Warning level messages displayed, use "--disable=all --enable=classes 62 | # --disable=W". 63 | disable=print-statement, 64 | parameter-unpacking, 65 | unpacking-in-except, 66 | old-raise-syntax, 67 | backtick, 68 | long-suffix, 69 | old-ne-operator, 70 | old-octal-literal, 71 | import-star-module-level, 72 | non-ascii-bytes-literal, 73 | raw-checker-failed, 74 | bad-inline-option, 75 | locally-disabled, 76 | locally-enabled, 77 | file-ignored, 78 | suppressed-message, 79 | useless-suppression, 80 | deprecated-pragma, 81 | use-symbolic-message-instead, 82 | apply-builtin, 83 | basestring-builtin, 84 | buffer-builtin, 85 | cmp-builtin, 86 | coerce-builtin, 87 | execfile-builtin, 88 | file-builtin, 89 | long-builtin, 90 | raw_input-builtin, 91 | reduce-builtin, 92 | standarderror-builtin, 93 | unicode-builtin, 94 | xrange-builtin, 95 | coerce-method, 96 | delslice-method, 97 | getslice-method, 98 | setslice-method, 99 | no-absolute-import, 100 | old-division, 101 | dict-iter-method, 102 | dict-view-method, 103 | next-method-called, 104 | metaclass-assignment, 105 | indexing-exception, 106 | raising-string, 107 | reload-builtin, 108 | oct-method, 109 | hex-method, 110 | nonzero-method, 111 | cmp-method, 112 | input-builtin, 113 | round-builtin, 114 | intern-builtin, 115 | unichr-builtin, 116 | map-builtin-not-iterating, 117 | zip-builtin-not-iterating, 118 | range-builtin-not-iterating, 119 | filter-builtin-not-iterating, 120 | using-cmp-argument, 121 | eq-without-hash, 122 | div-method, 123 | idiv-method, 124 | rdiv-method, 125 | exception-message-attribute, 126 | invalid-str-codec, 127 | sys-max-int, 128 | bad-python3-import, 129 | deprecated-string-function, 130 | deprecated-str-translate-call, 131 | deprecated-itertools-function, 132 | deprecated-types-field, 133 | next-method-defined, 134 | dict-items-not-iterating, 135 | dict-keys-not-iterating, 136 | dict-values-not-iterating, 137 | deprecated-operator-function, 138 | deprecated-urllib-function, 139 | xreadlines-attribute, 140 | deprecated-sys-function, 141 | exception-escape, 142 | comprehension-escape, 143 | missing-docstring, # C0111 144 | bad-continuation, # C0330 145 | protected-access # W0212 146 | 147 | # Enable the message, report, category or checker with the given id(s). You can 148 | # either give multiple identifier separated by comma (,) or put this option 149 | # multiple time (only on the command line, not in the configuration file where 150 | # it should appear only once). See also the "--disable" option for examples. 151 | enable=c-extension-no-member 152 | 153 | 154 | [REPORTS] 155 | 156 | # Python expression which should return a note less than 10 (10 is the highest 157 | # note). You have access to the variables errors warning, statement which 158 | # respectively contain the number of errors / warnings messages and the total 159 | # number of statements analyzed. This is used by the global evaluation report 160 | # (RP0004). 161 | evaluation=10.0 - ((float(5 * error + warning + refactor + convention) / statement) * 10) 162 | 163 | # Template used to display messages. This is a python new-style format string 164 | # used to format the message information. See doc for all details. 165 | #msg-template= 166 | 167 | # Set the output format. Available formats are text, parseable, colorized, json 168 | # and msvs (visual studio). You can also give a reporter class, e.g. 169 | # mypackage.mymodule.MyReporterClass. 170 | output-format=text 171 | 172 | # Tells whether to display a full report or only the messages. 173 | reports=no 174 | 175 | # Activate the evaluation score. 176 | score=yes 177 | 178 | 179 | [REFACTORING] 180 | 181 | # Maximum number of nested blocks for function / method body 182 | max-nested-blocks=10 183 | 184 | # Complete name of functions that never returns. When checking for 185 | # inconsistent-return-statements if a never returning function is called then 186 | # it will be considered as an explicit return statement and no message will be 187 | # printed. 188 | never-returning-functions=sys.exit 189 | 190 | 191 | [LOGGING] 192 | 193 | # Logging modules to check that the string format arguments are in logging 194 | # function parameter format. 195 | logging-modules=logging 196 | 197 | 198 | [SPELLING] 199 | 200 | # Limits count of emitted suggestions for spelling mistakes. 201 | max-spelling-suggestions=4 202 | 203 | # Spelling dictionary name. Available dictionaries: none. To make it working 204 | # install python-enchant package.. 205 | spelling-dict= 206 | 207 | # List of comma separated words that should not be checked. 208 | spelling-ignore-words= 209 | 210 | # A path to a file that contains private dictionary; one word per line. 211 | spelling-private-dict-file= 212 | 213 | # Tells whether to store unknown words to indicated private dictionary in 214 | # --spelling-private-dict-file option instead of raising a message. 215 | spelling-store-unknown-words=no 216 | 217 | 218 | [MISCELLANEOUS] 219 | 220 | # List of note tags to take in consideration, separated by a comma. 221 | notes=FIXME, 222 | XXX, 223 | TODO 224 | 225 | 226 | [TYPECHECK] 227 | 228 | # List of decorators that produce context managers, such as 229 | # contextlib.contextmanager. Add to this list to register other decorators that 230 | # produce valid context managers. 231 | contextmanager-decorators=contextlib.contextmanager 232 | 233 | # List of members which are set dynamically and missed by pylint inference 234 | # system, and so shouldn't trigger E1101 when accessed. Python regular 235 | # expressions are accepted. 236 | generated-members=_meta 237 | 238 | # Tells whether missing members accessed in mixin class should be ignored. A 239 | # mixin class is detected if its name ends with "mixin" (case insensitive). 240 | ignore-mixin-members=yes 241 | 242 | # Tells whether to warn about missing members when the owner of the attribute 243 | # is inferred to be None. 244 | ignore-none=yes 245 | 246 | # This flag controls whether pylint should warn about no-member and similar 247 | # checks whenever an opaque object is returned when inferring. The inference 248 | # can return multiple potential results while evaluating a Python object, but 249 | # some branches might not be evaluated, which results in partial inference. In 250 | # that case, it might be useful to still emit no-member and other checks for 251 | # the rest of the inferred objects. 252 | ignore-on-opaque-inference=yes 253 | 254 | # List of class names for which member attributes should not be checked (useful 255 | # for classes with dynamically set attributes). This supports the use of 256 | # qualified names. 257 | ignored-classes=optparse.Values,thread._local,_thread._local,__proxy__,Style,BaseModelWithSoftDelete,BasicPost 258 | 259 | # List of module names for which member attributes should not be checked 260 | # (useful for modules/projects where namespaces are manipulated during runtime 261 | # and thus existing member attributes cannot be deduced by static analysis. It 262 | # supports qualified module names, as well as Unix pattern matching. 263 | ignored-modules= 264 | 265 | # Show a hint with possible names when a member name was not found. The aspect 266 | # of finding the hint is based on edit distance. 267 | missing-member-hint=yes 268 | 269 | # The minimum edit distance a name should have in order to be considered a 270 | # similar match for a missing member name. 271 | missing-member-hint-distance=1 272 | 273 | # The total number of similar names that should be taken in consideration when 274 | # showing a hint for a missing member. 275 | missing-member-max-choices=1 276 | 277 | 278 | [VARIABLES] 279 | 280 | # List of additional names supposed to be defined in builtins. Remember that 281 | # you should avoid to define new builtins when possible. 282 | additional-builtins= 283 | 284 | # Tells whether unused global variables should be treated as a violation. 285 | allow-global-unused-variables=yes 286 | 287 | # List of strings which can identify a callback function by name. A callback 288 | # name must start or end with one of those strings. 289 | callbacks=cb_, 290 | _cb 291 | 292 | # A regular expression matching the name of dummy variables (i.e. expected to 293 | # not be used). 294 | dummy-variables-rgx=_+$|(_[a-zA-Z0-9_]*[a-zA-Z0-9]+?$)|dummy|^ignored_|^unused_ 295 | 296 | # Argument names that match this expression will be ignored. Default to name 297 | # with leading underscore. 298 | ignored-argument-names=_.*|^ignored_|^unused_ 299 | 300 | # Tells whether we should check for unused import in __init__ files. 301 | init-import=no 302 | 303 | # List of qualified module names which can have objects that can redefine 304 | # builtins. 305 | redefining-builtins-modules=six.moves,past.builtins,future.builtins,builtins,io 306 | 307 | 308 | [FORMAT] 309 | 310 | # Expected format of line ending, e.g. empty (any line ending), LF or CRLF. 311 | expected-line-ending-format= 312 | 313 | # Regexp for a line that is allowed to be longer than the limit. 314 | ignore-long-lines=^\s*(# )??$ 315 | 316 | # Number of spaces of indent required inside a hanging or continued line. 317 | indent-after-paren=4 318 | 319 | # String used as indentation unit. This is usually " " (4 spaces) or "\t" (1 320 | # tab). 321 | indent-string=' ' 322 | 323 | # Maximum number of characters on a single line. 324 | max-line-length=119 325 | 326 | # Maximum number of lines in a module. 327 | max-module-lines=1000 328 | 329 | # List of optional constructs for which whitespace checking is disabled. `dict- 330 | # separator` is used to allow tabulation in dicts, etc.: {1 : 1,\n222: 2}. 331 | # `trailing-comma` allows a space between comma and closing bracket: (a, ). 332 | # `empty-line` allows space-only lines. 333 | no-space-check=trailing-comma, 334 | dict-separator 335 | 336 | # Allow the body of a class to be on the same line as the declaration if body 337 | # contains single statement. 338 | single-line-class-stmt=no 339 | 340 | # Allow the body of an if to be on the same line as the test if there is no 341 | # else. 342 | single-line-if-stmt=no 343 | 344 | 345 | [SIMILARITIES] 346 | 347 | # Ignore comments when computing similarities. 348 | ignore-comments=yes 349 | 350 | # Ignore docstrings when computing similarities. 351 | ignore-docstrings=yes 352 | 353 | # Ignore imports when computing similarities. 354 | ignore-imports=no 355 | 356 | # Minimum lines number of a similarity. 357 | min-similarity-lines=4 358 | 359 | 360 | [BASIC] 361 | 362 | # Naming style matching correct argument names. 363 | argument-naming-style=snake_case 364 | 365 | # Regular expression matching correct argument names. Overrides argument- 366 | # naming-style. 367 | #argument-rgx= 368 | 369 | # Naming style matching correct attribute names. 370 | attr-naming-style=snake_case 371 | 372 | # Regular expression matching correct attribute names. Overrides attr-naming- 373 | # style. 374 | #attr-rgx= 375 | 376 | # Bad variable names which should always be refused, separated by a comma. 377 | bad-names=foo, 378 | bar, 379 | baz, 380 | toto, 381 | tutu, 382 | tata 383 | 384 | # Naming style matching correct class attribute names. 385 | class-attribute-naming-style=any 386 | 387 | # Regular expression matching correct class attribute names. Overrides class- 388 | # attribute-naming-style. 389 | #class-attribute-rgx= 390 | 391 | # Naming style matching correct class names. 392 | class-naming-style=PascalCase 393 | 394 | # Regular expression matching correct class names. Overrides class-naming- 395 | # style. 396 | #class-rgx= 397 | 398 | # Naming style matching correct constant names. 399 | const-naming-style=UPPER_CASE 400 | 401 | # Regular expression matching correct constant names. Overrides const-naming- 402 | # style. 403 | #const-rgx= 404 | 405 | # Minimum line length for functions/classes that require docstrings, shorter 406 | # ones are exempt. 407 | docstring-min-length=-1 408 | 409 | # Naming style matching correct function names. 410 | function-naming-style=snake_case 411 | 412 | # Regular expression matching correct function names. Overrides function- 413 | # naming-style. 414 | #function-rgx= 415 | 416 | # Good variable names which should always be accepted, separated by a comma. 417 | good-names=i, 418 | j, 419 | k, 420 | ex, 421 | Run, 422 | app_name, 423 | urlpatterns, 424 | console, 425 | logger, 426 | User, 427 | Group, 428 | Permission, 429 | register, 430 | pp, 431 | application, 432 | _, 433 | qs, 434 | fp, 435 | f, 436 | e 437 | 438 | # Include a hint for the correct naming format with invalid-name. 439 | include-naming-hint=no 440 | 441 | # Naming style matching correct inline iteration names. 442 | inlinevar-naming-style=any 443 | 444 | # Regular expression matching correct inline iteration names. Overrides 445 | # inlinevar-naming-style. 446 | #inlinevar-rgx= 447 | 448 | # Naming style matching correct method names. 449 | method-naming-style=snake_case 450 | 451 | # Regular expression matching correct method names. Overrides method-naming- 452 | # style. 453 | #method-rgx= 454 | 455 | # Naming style matching correct module names. 456 | module-naming-style=snake_case 457 | 458 | # Regular expression matching correct module names. Overrides module-naming- 459 | # style. 460 | #module-rgx= 461 | 462 | # Colon-delimited sets of names that determine each other's naming style when 463 | # the name regexes allow several styles. 464 | name-group= 465 | 466 | # Regular expression which should only match function or class names that do 467 | # not require a docstring. 468 | no-docstring-rgx=^_ 469 | 470 | # List of decorators that produce properties, such as abc.abstractproperty. Add 471 | # to this list to register other decorators that produce valid properties. 472 | # These decorators are taken in consideration only for invalid-name. 473 | property-classes=abc.abstractproperty 474 | 475 | # Naming style matching correct variable names. 476 | variable-naming-style=snake_case 477 | 478 | # Regular expression matching correct variable names. Overrides variable- 479 | # naming-style. 480 | #variable-rgx= 481 | 482 | 483 | [IMPORTS] 484 | 485 | # Allow wildcard imports from modules that define __all__. 486 | allow-wildcard-with-all=no 487 | 488 | # Analyse import fallback blocks. This can be used to support both Python 2 and 489 | # 3 compatible code, which means that the block might have code that exists 490 | # only in one or another interpreter, leading to false positives when analysed. 491 | analyse-fallback-blocks=no 492 | 493 | # Deprecated modules which should not be used, separated by a comma. 494 | deprecated-modules=optparse,tkinter.tix 495 | 496 | # Create a graph of external dependencies in the given file (report RP0402 must 497 | # not be disabled). 498 | ext-import-graph= 499 | 500 | # Create a graph of every (i.e. internal and external) dependencies in the 501 | # given file (report RP0402 must not be disabled). 502 | import-graph= 503 | 504 | # Create a graph of internal dependencies in the given file (report RP0402 must 505 | # not be disabled). 506 | int-import-graph= 507 | 508 | # Force import order to recognize a module as part of the standard 509 | # compatibility libraries. 510 | known-standard-library= 511 | 512 | # Force import order to recognize a module as part of a third party library. 513 | known-third-party=enchant 514 | 515 | 516 | [CLASSES] 517 | 518 | # List of method names used to declare (i.e. assign) instance attributes. 519 | defining-attr-methods=__init__, 520 | __new__, 521 | setUp 522 | 523 | # List of member names, which should be excluded from the protected access 524 | # warning. 525 | exclude-protected=_asdict, 526 | _fields, 527 | _replace, 528 | _source, 529 | _make 530 | 531 | # List of valid names for the first argument in a class method. 532 | valid-classmethod-first-arg=cls 533 | 534 | # List of valid names for the first argument in a metaclass class method. 535 | valid-metaclass-classmethod-first-arg=cls 536 | 537 | 538 | [DESIGN] 539 | 540 | # Maximum number of arguments for function / method. 541 | max-args=10 542 | 543 | # Maximum number of attributes for a class (see R0902). 544 | max-attributes=7 545 | 546 | # Maximum number of boolean expressions in an if statement. 547 | max-bool-expr=5 548 | 549 | # Maximum number of branch for function / method body. 550 | max-branches=40 551 | 552 | # Maximum number of locals for function / method body. 553 | max-locals=30 554 | 555 | # Maximum number of parents for a class (see R0901). 556 | max-parents=7 557 | 558 | # Maximum number of public methods for a class (see R0904). 559 | max-public-methods=30 560 | 561 | # Maximum number of return / yield for function / method body. 562 | max-returns=12 563 | 564 | # Maximum number of statements in function / method body. 565 | max-statements=100 566 | 567 | # Minimum number of public methods for a class (see R0903). 568 | min-public-methods=0 569 | 570 | 571 | [EXCEPTIONS] 572 | 573 | # Exceptions that will emit a warning when being caught. Defaults to 574 | # "Exception". 575 | overgeneral-exceptions=Exception 576 | --------------------------------------------------------------------------------