Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Raise minimum Python version to 3.8 #2541

Open
wants to merge 2 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .github/workflows/python/github.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,20 +31,20 @@ def __init__(self):

def get_reviews(self):
""" Get a list of reviews on a Github pull request as json object """
reviews = self.session.get(self.api + 'repos/{}/pulls/{}/reviews'.format(self.github_repository, self.pr_id))
reviews = self.session.get(self.api + f'repos/{self.github_repository}/pulls/{self.pr_id}/reviews')
reviews.raise_for_status()
return reviews.json()

def update_review(self, review_id, body):
""" Update a review given by `review_id` and set its body to `body` """
payload = {'body': body}
resp = self.session.put(self.api + 'repos/{}/pulls/{}/reviews/{}'.format(self.github_repository, self.pr_id, review_id), json=payload)
resp = self.session.put(self.api + f'repos/{self.github_repository}/pulls/{self.pr_id}/reviews/{review_id}', json=payload)
resp.raise_for_status()
return resp.json()

def post_review(self, body):
""" Post a pull request review containing `body` and requesting changes """
payload = {'body': body, 'event': "REQUEST_CHANGES"}
resp = self.session.post(self.api + 'repos/{}/pulls/{}/reviews'.format(self.github_repository, self.pr_id), json=payload)
resp = self.session.post(self.api + f'repos/{self.github_repository}/pulls/{self.pr_id}/reviews', json=payload)
resp.raise_for_status()
return resp.json()
4 changes: 2 additions & 2 deletions .github/workflows/python/pycodestyle_comment.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ def style_error_format(style_error_list) -> str:
""" Format the list of pycodestyle errors and return them a one string. """
ret = ''
for error in style_error_list:
ret += '* {}\n'.format(error)
ret += f'* {error}\n'
return ret


Expand All @@ -45,7 +45,7 @@ def style_error_format(style_error_list) -> str:
style_errors = list_style_errors()

if style_errors:
print("Found {} errors.".format(len(style_errors)))
print(f"Found {len(style_errors)} errors.")

gh = github.Github()

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/unittests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
strategy:
fail-fast: false
matrix:
python-version: ['3.7', '3.8', '3.9', '3.10', '3.11']
python-version: ['3.8', '3.9', '3.10', '3.11', '3.12', '3.13']
type: ['full', 'basic']

services:
Expand Down
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
### Configuration

### Core
- Python 3.8 or newer is required (PR#2541 by Sebastian Wagner).

### Development

Expand Down
7 changes: 4 additions & 3 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ Please refer to the change log for a full list of changes.
---------------------------------

### Requirements
Python 3.8 or newer is required.

### Tools

Expand All @@ -36,7 +37,7 @@ No changes are required by administrators.
----------------------------------

### Documentation
The documentation is now available at [docs.intelmq.org](https://docs.intelmq.org/). Documentation has been updated and restructured into User, Administrator and Developer Guide. It provides modern look with various quality of life improvements. Big thanks to to @gethvi.
The documentation is now available at [docs.intelmq.org](https://docs.intelmq.org/). Documentation has been updated and restructured into User, Administrator and Developer Guide. It provides modern look with various quality of life improvements. Big thanks to to @gethvi.
We now have a slick, modern mkdocs based documentation. Please do check it out!


Expand All @@ -55,7 +56,7 @@ Shadowserver adds new scans on a nearly weekly basis. IntelMQ's release cycle an
We therefore (thanks to @eslif2) move the shadowserver reports collector and parser to a new, dynamic system. It can:

- fetch the shadowserver schema from shadowserver (https://interchange.shadowserver.org/intelmq/v1/schema)
- dynamically collect new reports (see also https://docs.intelmq.org/latest/user/bots/?h=shadow#shadowserver-reports-api)
- dynamically collect new reports (see also https://docs.intelmq.org/latest/user/bots/?h=shadow#shadowserver-reports-api)
- parse the new reports

**Note well**: if your IntelMQ system runs in an airgapped environment or if it may only reach out to specific IPs/sites, you should read the notes here:
Expand Down Expand Up @@ -86,7 +87,7 @@ Quite a few changes (thanks to Kamil, @gethvi) on AMQP
### General changes and bug fixes

Digital Trust Center fixed a bug where the config was loaded twice in intelmqctl which created quite some speedups. Thanks!
This speeds up IntelMQ API calls.
This speeds up IntelMQ API calls.

### Data Format

Expand Down
2 changes: 1 addition & 1 deletion contrib/example-extension-package/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
entry_point = '.'.join(file.with_suffix('').parts)
file = Path(str(file).replace('intelmq/bots', 'mybots/bots'))
module = '.'.join(file.with_suffix('').parts)
BOTS.append('{0} = {1}:BOT.run'.format(entry_point, module))
BOTS.append(f'{entry_point} = {module}:BOT.run')

setup(
name='intelmq-example-extension',
Expand Down
2 changes: 1 addition & 1 deletion intelmq/bots/collectors/rsync/collector_rsync.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
from intelmq.lib.bot import CollectorBot


class Time(object):
class Time:
def __init__(self, delta=None):
""" Delta is a datetime.timedelta JSON string, ex: '{days=-1}'. """
self.time = datetime.now()
Expand Down
5 changes: 1 addition & 4 deletions intelmq/bots/experts/modify/expert.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,7 @@ def is_re_pattern(value):
"""
Checks if the given value is a re compiled pattern
"""
if sys.version_info > (3, 7):
return isinstance(value, re.Pattern)
else:
return hasattr(value, "pattern")
return isinstance(value, re.Pattern)


class MatchGroupMapping:
Expand Down
2 changes: 1 addition & 1 deletion intelmq/bots/outputs/smtp_batch/output.py
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ def cli_run(self):
with open(self.mail_template) as f:
self.mail_contents = f.read()
if self.alternative_mails:
with open(self.alternative_mails, "r") as f:
with open(self.alternative_mails) as f:
self.alternative_mail = {row[0]: row[1] for row in csv.reader(f, delimiter=",")}

print("Preparing mail queue...")
Expand Down
7 changes: 3 additions & 4 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
'redis>=2.10',
'requests>=2.2.0',
'ruamel.yaml',
'importlib-metadata; python_version < "3.8"'
]

TESTS_REQUIRES = [
Expand Down Expand Up @@ -56,7 +55,7 @@
version=__version__, # noqa: F821
maintainer='Sebastian Wagner',
maintainer_email='[email protected]',
python_requires='>=3.7',
python_requires='>=3.8',
install_requires=REQUIRES,
tests_require=TESTS_REQUIRES,
test_suite='intelmq.tests',
Expand Down Expand Up @@ -85,11 +84,11 @@
'Operating System :: POSIX :: Linux',
'Programming Language :: Python',
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3.7',
'Programming Language :: Python :: 3.8',
'Programming Language :: Python :: 3.9',
'Programming Language :: Python :: 3.10',
'Programming Language :: Python :: 3.11',
'Programming Language :: Python :: 3.12',
'Programming Language :: Python :: 3.13',
'Programming Language :: Python :: 3 :: Only',
'Programming Language :: Python :: Implementation :: CPython',
'Topic :: Security',
Expand Down
Loading