Skip to content

Commit

Permalink
updating pylint and cleaning up errors from newer version
Browse files Browse the repository at this point in the history
  • Loading branch information
benboger committed Sep 22, 2023
1 parent f0adb8e commit 8f7184c
Show file tree
Hide file tree
Showing 8 changed files with 11 additions and 84 deletions.
2 changes: 1 addition & 1 deletion .pylint-license-header
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
"""
Copyright 2023 Adobe
Copyright 202\d Adobe
All Rights Reserved.

NOTICE: Adobe permits you to use, modify, and distribute this file in accordance
Expand Down
77 changes: 3 additions & 74 deletions .pylintrc
Original file line number Diff line number Diff line change
Expand Up @@ -64,85 +64,14 @@ confidence=
# --enable=similarities". If you want to run only the classes checker, but have
# no Warning level messages displayed, use "--disable=all --enable=classes
# --disable=W".
disable=print-statement,
parameter-unpacking,
unpacking-in-except,
old-raise-syntax,
backtick,
long-suffix,
old-ne-operator,
old-octal-literal,
import-star-module-level,
non-ascii-bytes-literal,
raw-checker-failed,
disable=raw-checker-failed,
bad-inline-option,
locally-disabled,
file-ignored,
suppressed-message,
useless-suppression,
deprecated-pragma,
use-symbolic-message-instead,
apply-builtin,
basestring-builtin,
buffer-builtin,
cmp-builtin,
coerce-builtin,
execfile-builtin,
file-builtin,
long-builtin,
raw_input-builtin,
reduce-builtin,
standarderror-builtin,
unicode-builtin,
xrange-builtin,
coerce-method,
delslice-method,
getslice-method,
setslice-method,
no-absolute-import,
old-division,
dict-iter-method,
dict-view-method,
next-method-called,
metaclass-assignment,
indexing-exception,
raising-string,
reload-builtin,
oct-method,
hex-method,
nonzero-method,
cmp-method,
input-builtin,
round-builtin,
intern-builtin,
unichr-builtin,
map-builtin-not-iterating,
zip-builtin-not-iterating,
range-builtin-not-iterating,
filter-builtin-not-iterating,
using-cmp-argument,
eq-without-hash,
div-method,
idiv-method,
rdiv-method,
exception-message-attribute,
invalid-str-codec,
sys-max-int,
bad-python3-import,
deprecated-string-function,
deprecated-str-translate-call,
deprecated-itertools-function,
deprecated-types-field,
next-method-defined,
dict-items-not-iterating,
dict-keys-not-iterating,
dict-values-not-iterating,
deprecated-operator-function,
deprecated-urllib-function,
xreadlines-attribute,
deprecated-sys-function,
exception-escape,
comprehension-escape,
logging-fstring-interpolation,
missing-module-docstring,
missing-class-docstring,
Expand Down Expand Up @@ -593,5 +522,5 @@ min-public-methods=2

# Exceptions that will emit a warning when being caught. Defaults to
# "BaseException, Exception".
overgeneral-exceptions=BaseException,
Exception
overgeneral-exceptions=buildins.BaseException,
buildins.Exception
2 changes: 1 addition & 1 deletion .python-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
3.7.2
3.11.0
3 changes: 0 additions & 3 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -275,9 +275,6 @@ mapping. These annotations are not required, but may be helpful in some cases.
# This annotation will convert the string into a list of strings or None if the string is null or empty
list_from_string_nullable: FromCSVToList[List[str] | None]
# if using python < 3.9, you can use typing.Union instead of the pipe operator
# list_from_string_nullable: FromCSVToList[Union[List[str],None]]
@sqlquery
~~~~~~~~~
Expand Down
1 change: 1 addition & 0 deletions dysql/databases.py
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,7 @@ def current_database(self) -> Database:
"""
The current database instance, retrieved using contextvars (if python 3.7+) or the default database.
"""
# pylint: disable=unnecessary-dunder-call
return self.__getitem__(_get_current_database())


Expand Down
2 changes: 1 addition & 1 deletion dysql/pydantic_mappers.py
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ def map_record(self, record: sqlalchemy.engine.Row) -> None:
self.__dict__.update(current_dict)
else:
# Init takes care of validation and assigning values to each field with conversions in place, etc
self.__init__(**current_dict)
self.__init__(**current_dict) # pylint: disable=unnecessary-dunder-call

def raw(self) -> dict:
return self.model_dump()
Expand Down
6 changes: 3 additions & 3 deletions dysql/test/test_annotations.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
NOTICE: Adobe permits you to use, modify, and distribute this file in accordance
with the terms of the Adobe license agreement accompanying it.
"""
from typing import List, Union
from typing import List

import pytest
from pydantic import BaseModel, ValidationError
Expand All @@ -22,11 +22,11 @@ class IntCSVModel(BaseModel):


class NullableStrCSVModel(BaseModel):
values: FromCSVToList[Union[List[str], None]]
values: FromCSVToList[List[str] | None]


class NullableIntCSVModel(BaseModel):
values: FromCSVToList[Union[List[int], None]]
values: FromCSVToList[List[int] | None]


@pytest.mark.parametrize('cls, values, expected', [
Expand Down
2 changes: 1 addition & 1 deletion test_requirements.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
pytest==6.2.4
pytest-randomly==3.10.1
pytest-cov==2.12.1
pylint==2.10.2
pylint>2.10.2
pylintfileheader==0.3.0
pycodestyle==2.8.0

0 comments on commit 8f7184c

Please sign in to comment.