Skip to content

Commit

Permalink
Pylint updates
Browse files Browse the repository at this point in the history
  • Loading branch information
jamesridgway committed Jun 17, 2023
1 parent f729267 commit 181bc05
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 91 deletions.
88 changes: 1 addition & 87 deletions .pylintrc
Original file line number Diff line number Diff line change
Expand Up @@ -60,85 +60,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,
missing-module-docstring,
missing-class-docstring,
missing-function-docstring
Expand Down Expand Up @@ -208,13 +137,6 @@ max-line-length=120
# Maximum number of lines in a module.
max-module-lines=1000

# List of optional constructs for which whitespace checking is disabled. `dict-
# separator` is used to allow tabulation in dicts, etc.: {1 : 1,\n222: 2}.
# `trailing-comma` allows a space between comma and closing bracket: (a, ).
# `empty-line` allows space-only lines.
no-space-check=trailing-comma,
dict-separator

# Allow the body of a class to be on the same line as the declaration if body
# contains single statement.
single-line-class-stmt=no
Expand Down Expand Up @@ -588,11 +510,3 @@ max-statements=50

# Minimum number of public methods for a class (see R0903).
min-public-methods=1


[EXCEPTIONS]

# Exceptions that will emit a warning when being caught. Defaults to
# "BaseException, Exception".
overgeneral-exceptions=BaseException,
Exception
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
assertpy==1.1
pylint==2.5.0
pylint==2.17.4
pytest-cov==4.1.0
pytest==7.3.2
requests==2.31.0
Expand Down
2 changes: 1 addition & 1 deletion voice_transcriber/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ def set_credentials(self, domain, api_key):
'domain': domain,
'api_key': api_key
}
with open(self.__config_filename(), 'w') as configfile:
with open(self.__config_filename(), 'w', encoding="utf-8") as configfile:
config.write(configfile)

def get_credentials(self):
Expand Down
6 changes: 4 additions & 2 deletions voice_transcriber/voice_transcriber.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,14 @@ def __init__(self, domain, api_key):
def transcribe(self, name, filename):
file_ext = os.path.splitext(filename)[1]
data = {"name": name + file_ext}
request = requests.post('https://{}/recordings'.format(self.domain), headers=self.__headers(), json=data)
url = f'https://{self.domain}/recordings'
request = requests.post(url, headers=self.__headers(), json=data, timeout=10)

if request.status_code == 200:
response = request.json()
upload_url = response['upload_url']
request = requests.put(upload_url, headers=self.__headers(), data=open(filename, 'rb').read())
with open(filename, 'rb') as datafile:
request = requests.put(upload_url, headers=self.__headers(), data=datafile.read(), timeout=10)
return request.status_code == 200

raise RuntimeError('An unexpected error occurred')
Expand Down

0 comments on commit 181bc05

Please sign in to comment.