Compare commits

...

2 commits

Author SHA1 Message Date
Jeff Epler
344d29f5c5 Add pull request template 2022-02-15 09:59:16 -06:00
Jeff Epler
b391f2b8de Update pre-commit, blacken 2022-02-15 09:59:16 -06:00
3 changed files with 42 additions and 16 deletions

View file

@ -0,0 +1,13 @@
# SPDX-FileCopyrightText: 2021 Adafruit Industries
#
# SPDX-License-Identifier: MIT
Thank you for contributing! Before you submit a pull request, please read the following.
Make sure any changes you're submitting are in line with the CircuitPython Design Guide, available here: https://docs.circuitpython.org/en/latest/docs/design_guide.html
If your changes are to documentation, please verify that the documentation builds locally by following the steps found here: https://adafru.it/build-docs
Before submitting the pull request, make sure you've run Pylint and Black locally on your code. You can do this manually or using pre-commit. Instructions are available here: https://adafru.it/check-your-code
Please remove all of this text before submitting. Include an explanation or list of changes included in your PR, as well as, if applicable, a link to any related issues.

View file

@ -4,7 +4,7 @@
repos: repos:
- repo: https://github.com/python/black - repo: https://github.com/python/black
rev: 19.10b0 rev: 20.8b1
hooks: hooks:
- id: black - id: black
- repo: https://github.com/fsfe/reuse-tool - repo: https://github.com/fsfe/reuse-tool
@ -18,15 +18,23 @@ repos:
- id: end-of-file-fixer - id: end-of-file-fixer
- id: trailing-whitespace - id: trailing-whitespace
- repo: https://github.com/pycqa/pylint - repo: https://github.com/pycqa/pylint
rev: pylint-2.6.0 rev: pylint-2.7.1
hooks: hooks:
- id: pylint - id: pylint
name: lint (examples) name: pylint (library code)
types: [python] types: [python]
files: ^examples/ exclude: "^(docs/|examples/|tests/|setup.py$)"
args: - repo: local
- --disable=missing-docstring,invalid-name,bad-whitespace hooks:
- id: pylint - id: pylint_examples
name: lint (code) name: pylint (examples code)
types: [python] description: Run pylint rules on "examples/*.py" files
exclude: "^(docs/|examples/|setup.py$)" entry: /usr/bin/env bash -c
args: ['([[ ! -d "examples" ]] || for example in $(find . -path "./examples/*.py"); do pylint --disable=missing-docstring,invalid-name,consider-using-f-string $example; done)']
language: system
- id: pylint_tests
name: pylint (tests code)
description: Run pylint rules on "tests/*.py" files
entry: /usr/bin/env bash -c
args: ['([[ ! -d "tests" ]] || for test in $(find . -path "./tests/*.py"); do pylint --disable=missing-docstring $test; done)']
language: system

View file

@ -3112,7 +3112,7 @@ class Decimal(object):
return ans return ans
def logb(self, context=None): def logb(self, context=None):
""" Returns the exponent of the magnitude of self's MSD. """Returns the exponent of the magnitude of self's MSD.
The result is the integer which is the exponent of the magnitude The result is the integer which is the exponent of the magnitude
of the most significant digit of self (as though it were truncated of the most significant digit of self (as though it were truncated
@ -3324,8 +3324,8 @@ def _dec_from_triple(sign, coefficient, exponent, special=False):
class _ContextManager(object): class _ContextManager(object):
"""Context manager class to support localcontext(). """Context manager class to support localcontext().
Sets a copy of the supplied context in __enter__() and restores Sets a copy of the supplied context in __enter__() and restores
the previous decimal context in __exit__() the previous decimal context in __exit__()
""" """
def __init__(self, new_context): def __init__(self, new_context):
@ -4202,7 +4202,7 @@ class Context(object):
return a.log10(context=self) return a.log10(context=self)
def logb(self, a): def logb(self, a):
""" Returns the exponent of the magnitude of the operand's MSD. """Returns the exponent of the magnitude of the operand's MSD.
The result is the integer which is the exponent of the magnitude The result is the integer which is the exponent of the magnitude
of the most significant digit of the operand (as though the of the most significant digit of the operand (as though the
@ -4902,7 +4902,7 @@ _nbits = int.bit_length
def _decimal_lshift_exact(n, e): def _decimal_lshift_exact(n, e):
""" Given integers n and e, return n * 10**e if it's an integer, else None. """Given integers n and e, return n * 10**e if it's an integer, else None.
The computation is designed to avoid computing large powers of 10 The computation is designed to avoid computing large powers of 10
unnecessarily. unnecessarily.
@ -5348,7 +5348,12 @@ BasicContext = Context(
flags=[], flags=[],
) )
ExtendedContext = Context(prec=9, rounding=ROUND_HALF_EVEN, traps=[], flags=[],) ExtendedContext = Context(
prec=9,
rounding=ROUND_HALF_EVEN,
traps=[],
flags=[],
)
##### crud for parsing strings ############################################# ##### crud for parsing strings #############################################