Skip to content

Commit

Permalink
Update backend deps 20241007 (#2334)
Browse files Browse the repository at this point in the history
* Update backend deps 20241007

* Fix linting - flake8
  • Loading branch information
henrikek authored Oct 7, 2024
1 parent 990bc54 commit 304d7d9
Show file tree
Hide file tree
Showing 20 changed files with 66 additions and 64 deletions.
3 changes: 2 additions & 1 deletion .vscode/extensions.json.default
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
"trond-snekvik.simple-rst",
"marcostazi.VS-code-vagrantfile",
"njpwerner.autodocstring",
"swyddfa.esbonio"
"swyddfa.esbonio",
"GitLab.gitlab-workflow"
]
}
4 changes: 2 additions & 2 deletions ESSArch_Core/WorkflowEngine/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -450,14 +450,14 @@ def progress(self):

try:
progress += task_data['progress']
except BaseException:
except Exception:
pass

try:
res = progress / total
cache.set(self.cache_progress_key, res)
return res
except BaseException:
except Exception:
cache.set(self.cache_progress_key, 0)
return 0

Expand Down
2 changes: 1 addition & 1 deletion ESSArch_Core/WorkflowEngine/serializers.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ def get_information_package_str(self, obj):
def get_retried(self, obj):
try:
return obj.retried.pk
except BaseException:
except Exception:
return None

def get_url(self, obj):
Expand Down
8 changes: 4 additions & 4 deletions ESSArch_Core/WorkflowEngine/tests/test_steps.py
Original file line number Diff line number Diff line change
Expand Up @@ -813,7 +813,7 @@ def setUp(self):

try:
os.mkdir(self.test_dir)
except BaseException:
except Exception:
pass

settings.CELERY_ALWAYS_EAGER = True
Expand All @@ -822,7 +822,7 @@ def setUp(self):
def tearDown(self):
try:
shutil.rmtree(self.test_dir)
except BaseException:
except Exception:
pass

def test_empty_step(self):
Expand All @@ -842,7 +842,7 @@ def setUp(self):

try:
os.mkdir(self.test_dir)
except BaseException:
except Exception:
pass

settings.CELERY_ALWAYS_EAGER = True
Expand All @@ -851,7 +851,7 @@ def setUp(self):
def tearDown(self):
try:
shutil.rmtree(self.test_dir)
except BaseException:
except Exception:
pass

def test_empty_step(self):
Expand Down
2 changes: 1 addition & 1 deletion ESSArch_Core/cli/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ def _check():
dj_call_command(
'check',
)
except BaseException as e:
except Exception as e:
exit(e)


Expand Down
2 changes: 1 addition & 1 deletion ESSArch_Core/config/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ def initialize():
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'ESSArch_Core.config.settings')
try:
django.setup()
except BaseException as e:
except Exception as e:
exit(e)
from ESSArch_Core.config.celery import app # noqa

Expand Down
4 changes: 2 additions & 2 deletions ESSArch_Core/essxml/Generator/xmlGenerator.py
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ def __init__(self, template, nsmap=None, fid=None):
name = template.get('-name')
try:
self.name = name.split("#")[0]
except BaseException:
except Exception:
self.name = name

self.nsmap = template.get('-nsmap', {})
Expand Down Expand Up @@ -200,7 +200,7 @@ def __init__(self, template, nsmap=None, fid=None):
child_el = XMLElement(child)
self.children.append(child_el)

@ property
@property
def fid(self):
if self._fid is not None:
return self._fid
Expand Down
4 changes: 2 additions & 2 deletions ESSArch_Core/essxml/Generator/xmlStructure.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ class xmlElement:
def __init__(self, tagName='', nsmap=None, namespace=None):
try:
self.tagName = tagName.split("#")[0]
except BaseException:
except Exception:
self.tagName = tagName

if nsmap is None:
Expand All @@ -59,7 +59,7 @@ def __init__(self, tagName='', nsmap=None, namespace=None):
self.namespace = namespace
try:
self.full_namespace = nsmap.get(namespace)
except BaseException:
except Exception:
self.full_namespace = None
self.completeTagName = ''
self.containsFiles = False
Expand Down
6 changes: 3 additions & 3 deletions ESSArch_Core/essxml/ProfileMaker/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,7 @@ def removeChild(request, name, uuid):
if child['uuid'] == uuid:
try:
name = child['name'].split('#')[0]
except BaseException:
except Exception:
name = child['name']

deleted_name = name
Expand All @@ -254,7 +254,7 @@ def removeChild(request, name, uuid):
try:
name, copy_idx = child['name'].split('#')
copy_idx = int(copy_idx)
except BaseException:
except Exception:
name = child['name']

if deleted_name == name:
Expand Down Expand Up @@ -364,7 +364,7 @@ def addChild(request, name, newElementName, elementUuid):
for idx, child in enumerate(existingElements[elementUuid]['children']):
try:
name = child['name'].split('#')[0]
except BaseException:
except Exception:
name = child['name']

if name == newElementName:
Expand Down
1 change: 1 addition & 0 deletions ESSArch_Core/frontend/tests/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ def setUpClass(cls):

options = Options()
options.headless = True
options.add_argument("--headless")
try:
cls.selenium = WebDriver(options=options)
except TimeoutException as e:
Expand Down
4 changes: 2 additions & 2 deletions ESSArch_Core/ip/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -797,7 +797,7 @@ def get_container_format(self):
return self.get_profile_data('transfer_project').get(
'container_format', 'tar'
)
except BaseException:
except Exception:
return 'tar'

def get_checksum_algorithm(self):
Expand All @@ -815,7 +815,7 @@ def get_email_recipient(self):
return self.get_profile_data('transfer_project').get(
'preservation_organization_receiver_email'
)
except BaseException:
except Exception:
return None

def get_allow_unknown_file_types(self):
Expand Down
2 changes: 1 addition & 1 deletion ESSArch_Core/ip/tests/test_ips.py
Original file line number Diff line number Diff line change
Expand Up @@ -3178,7 +3178,7 @@ def setUp(self):
def tearDown(self):
try:
shutil.rmtree(self.datadir)
except BaseException:
except Exception:
pass

def test_not_responsible(self):
Expand Down
4 changes: 2 additions & 2 deletions ESSArch_Core/log/dbhandler.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,12 @@ def __init__(self, application="ESSArch", agent_role=""):
def emit(self, record):
try:
EventIP = self.get_model(self.model_name)
except BaseException:
except Exception:
from ESSArch_Core.ip.models import EventIP

try:
EventType = self.get_model(self.event_type_model_name)
except BaseException:
except Exception:
from ESSArch_Core.configuration.models import EventType

if getattr(record, 'event_type', None) is None:
Expand Down
34 changes: 17 additions & 17 deletions ESSArch_Core/tests/test_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,8 @@ def test_non_zero_returncode(self, mock_popen):
cmd.extend(['-f', 'pdf', '-eSelectPdfVersion=1', 'test.docx'])
mock_popen.assert_called_once_with(cmd, stderr=PIPE, stdout=PIPE)

@ mock.patch('ESSArch_Core.util.os.path.isfile', return_value=False)
@ mock.patch('ESSArch_Core.util.Popen')
@mock.patch('ESSArch_Core.util.os.path.isfile', return_value=False)
@mock.patch('ESSArch_Core.util.Popen')
def test_zero_returncode_with_no_file_created(self, mock_popen, mock_isfile):
process_mock = mock.Mock()
attrs = {'communicate.return_value': ('output', 'error'), 'returncode': 0}
Expand All @@ -65,8 +65,8 @@ def test_zero_returncode_with_no_file_created(self, mock_popen, mock_isfile):
cmd.extend(['-f', 'pdf', '-eSelectPdfVersion=1', 'test.docx'])
mock_popen.assert_called_once_with(cmd, stderr=PIPE, stdout=PIPE)

@ mock.patch('ESSArch_Core.util.os.path.isfile', return_value=True)
@ mock.patch('ESSArch_Core.util.Popen')
@mock.patch('ESSArch_Core.util.os.path.isfile', return_value=True)
@mock.patch('ESSArch_Core.util.Popen')
def test_zero_returncode_with_file_created(self, mock_popen, mock_isfile):
process_mock = mock.Mock()
attrs = {'communicate.return_value': ('output', 'error'), 'returncode': 0}
Expand All @@ -85,7 +85,7 @@ def test_zero_returncode_with_file_created(self, mock_popen, mock_isfile):

class GetValueFromPathTest(TestCase):

@ staticmethod
@staticmethod
def get_simple_xml():
return '''
<volym andraddat="2014-03-11T14:10:35">
Expand Down Expand Up @@ -327,7 +327,7 @@ def test_list_files_zip_file_with_default_args_should_return_response(self):
self.assertEqual(data_size, 1)
self.assertEqual(type(data_modified), datetime.datetime)

@ mock.patch('ESSArch_Core.util.generate_file_response')
@mock.patch('ESSArch_Core.util.generate_file_response')
def test_list_files_path_to_file_in_tar(self, generate_file_response):
file_path = self.create_archive_file('tar')
sub_path_file = './0.txt' # TODO: bug in shutil for tar is adding an extra './'
Expand All @@ -353,7 +353,7 @@ def test_list_files_path_to_non_existing_file_in_zip_should_throw_NotFound(self)
with self.assertRaises(NotFound):
list_files(new_folder)

@ mock.patch('ESSArch_Core.util.generate_file_response')
@mock.patch('ESSArch_Core.util.generate_file_response')
def test_list_files_path_to_file_in_zip(self, generate_file_response):
file_path = self.create_archive_file('zip')
sub_path_file = '0.txt'
Expand Down Expand Up @@ -381,8 +381,8 @@ def get_headers_from_response(self, response):
else:
raise Exception("Response must be instance of an 'FileResponse'")

@ mock.patch('ESSArch_Core.util.get_charset', return_value="utf-8")
@ mock.patch('ESSArch_Core.util.get_filename_from_file_obj', return_value="some_file_name.txt")
@mock.patch('ESSArch_Core.util.get_charset', return_value="utf-8")
@mock.patch('ESSArch_Core.util.get_filename_from_file_obj', return_value="some_file_name.txt")
def test_when_utf8_and_file_obj_has_name_then_return_inline_file_response(self, get_charset, get_file_name):
content_type = 'text/plain'

Expand All @@ -403,8 +403,8 @@ def test_when_utf8_and_file_obj_has_name_then_return_inline_file_response(self,

self.assertEqual(type(resp), FileResponse)

@ mock.patch('ESSArch_Core.util.get_charset', return_value="utf-8")
@ mock.patch('ESSArch_Core.util.get_filename_from_file_obj', return_value=None)
@mock.patch('ESSArch_Core.util.get_charset', return_value="utf-8")
@mock.patch('ESSArch_Core.util.get_filename_from_file_obj', return_value=None)
def test_when_utf8_and_no_filename(self, get_charset, get_filename):
content_type = 'text/plain'

Expand All @@ -424,8 +424,8 @@ def test_when_utf8_and_no_filename(self, get_charset, get_filename):

self.assertEqual(type(resp), FileResponse)

@ mock.patch('ESSArch_Core.util.get_charset', return_value="windows-1252")
@ mock.patch('ESSArch_Core.util.get_filename_from_file_obj', return_value="some_file_name.txt")
@mock.patch('ESSArch_Core.util.get_charset', return_value="windows-1252")
@mock.patch('ESSArch_Core.util.get_filename_from_file_obj', return_value="some_file_name.txt")
def test_win1252_and_file_obj_has_name_then_return_inline_file_response(self, get_charset, get_filename):
content_type = 'text/plain'

Expand All @@ -446,8 +446,8 @@ def test_win1252_and_file_obj_has_name_then_return_inline_file_response(self, ge

self.assertEqual(type(resp), FileResponse)

@ mock.patch('ESSArch_Core.util.get_charset', return_value="windows-1252")
@ mock.patch('ESSArch_Core.util.get_filename_from_file_obj', return_value=None)
@mock.patch('ESSArch_Core.util.get_charset', return_value="windows-1252")
@mock.patch('ESSArch_Core.util.get_filename_from_file_obj', return_value=None)
def test_win1252_and_no_filename(self, mock_get_charset, mock_get_filename):
content_type = 'text/plain'

Expand All @@ -467,7 +467,7 @@ def test_win1252_and_no_filename(self, mock_get_charset, mock_get_filename):

self.assertEqual(type(resp), FileResponse)

@ mock.patch('ESSArch_Core.util.get_charset', return_value="utf-8")
@mock.patch('ESSArch_Core.util.get_charset', return_value="utf-8")
def test_when_force_download_and_filename_not_none_then_add_attachment(self, get_charset):
content_type = 'text/plain'

Expand All @@ -488,7 +488,7 @@ def test_when_force_download_and_filename_not_none_then_add_attachment(self, get

self.assertEqual(type(resp), FileResponse)

@ mock.patch('ESSArch_Core.util.get_charset', return_value="utf-8")
@mock.patch('ESSArch_Core.util.get_charset', return_value="utf-8")
def test_when_filename_is_not_ascii(self, get_charset):
content_type = 'text/plain'

Expand Down
12 changes: 6 additions & 6 deletions requirements/base.txt
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
asgiref==3.8.1
boto3==1.35.11
boto3==1.35.34
celery[tblib]==5.4.0
cffi==1.17.0
cffi==1.17.1
channels==4.1.0
channels_redis==4.1.0
chardet==5.1.0
click==8.1.3
cryptography==42.0.8
cryptography==43.0.1
daphne==4.1.2
dj-rest-auth[with_social]==6.0.0
django==5.0.9
Expand Down Expand Up @@ -45,9 +45,9 @@ natsort==8.4.0
opf-fido==1.6.1
pyfakefs==5.6.0
python-dateutil==2.8.2
pywin32==306 ; platform_system=='Windows'
redis==5.0.8
regex==2024.7.24
pywin32==307 ; platform_system=='Windows'
redis==5.1.1
regex==2024.9.11
requests==2.32.3
requests_toolbelt==1.0.0
tenacity==9.0.0
Expand Down
12 changes: 6 additions & 6 deletions requirements/dev.txt
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
pywatchman==1.4.1
watchdog==3.0.0
pywatchman==2.0.0
watchdog==5.0.2
django-sslserver==0.22
sentry-sdk==1.39.2
esbonio==0.16.4
sentry-sdk==2.14.0
esbonio==0.16.5
django-extensions==3.2.3
Werkzeug==3.0.3
pyOpenSSL==24.1.0
Werkzeug==3.0.4
pyOpenSSL==24.2.1
8 changes: 4 additions & 4 deletions requirements/docs.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
docutils==0.20.1
docutils==0.21.2
sphinx-intl==2.2.0
sphinx-rtd-theme==2.0.0
sphinx==7.4.7
sphinx-rtd-theme==3.0.0
sphinx==8.0.2
sphinxcontrib-httpdomain==1.8.1
sphinxcontrib-httpexample==1.1
sphinxcontrib-httpexample==1.3
10 changes: 5 additions & 5 deletions requirements/lint.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
doc8==0.11.2
flake8==6.1.0
doc8==1.1.2
flake8==7.1.1
flake8-assertive==2.1.0
flake8-bugbear==23.9.16
isort==5.12.0
autopep8==2.0.4
flake8-bugbear==24.8.19
isort==5.13.2
autopep8==2.3.1
6 changes: 3 additions & 3 deletions requirements/optional.txt
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
django-auth-ldap==4.8.0
django-auto-logout==0.5.1
django-axes==6.3.0
django-axes==6.5.2
pysaml2==7.5.0
djangosaml2==1.9.3
unoconv==0.9.0
comtypes==1.4.6 ; platform_system=='Windows'
comtypes==1.4.7 ; platform_system=='Windows'
wfastcgi==3.0.0
mod-wsgi==5.0.0
mssql-django==1.5
mysqlclient==2.2.4
psycopg2==2.9.9
python-logstash-async==1.6.4
python-logstash-async==3.0.0
Loading

0 comments on commit 304d7d9

Please sign in to comment.