Skip to content

Commit 76d3c32

Browse files
authored
Merge pull request dod-cyber-crime-center#48 from kchason/python-3.13
Python 3.13 Support
2 parents 4d43401 + ca120d8 commit 76d3c32

File tree

4 files changed

+16
-16
lines changed

4 files changed

+16
-16
lines changed

.github/workflows/ci.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ on:
77
env:
88
# The Python version for the build jobs as well as the primary one for the test and artifact generation. This MUST be
99
# in the python-version matrix in the `test` job.
10-
PYTHON_VERSION: "3.12"
10+
PYTHON_VERSION: "3.13"
1111
jobs:
1212
test:
1313
runs-on: ubuntu-latest
@@ -16,7 +16,7 @@ jobs:
1616
# This allows the pipeline to be run against multiple Python versions. eg. [3.6, 3.7, 3.8, 3.9, 3.10]. This results
1717
# in linting and unit tests running for all listed versions as well as the creation of packages and wheels on
1818
# creation of a tag in Git.
19-
python-version: [ "3.8", "3.10", "3.12" ]
19+
python-version: [ "3.8", "3.10", "3.12", "3.13" ]
2020

2121
steps:
2222
# Get the code from the repository to be packaged

.gitlab-ci.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ default:
1010
tags:
1111
- docker
1212
- devnet
13-
image: python:3.11
13+
image: python:3.13
1414

1515
stages:
1616
- Lint
@@ -30,9 +30,9 @@ FlakeLint:
3030
- pip install .
3131
- pip install -q flake8
3232
# stop the build if there are Python syntax errors or undefined names
33-
- flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
33+
- flake8 ./sqlite_dissect/ --count --select=E9,F63,F7,F82 --show-source --statistics
3434
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
35-
- flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
35+
- flake8 ./sqlite_dissect/ --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
3636

3737
PyTest:
3838
stage: Test

sqlite_dissect/file/schema/column.py

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ def __init__(self, index, column_text, comments=None):
2727
logger = getLogger(LOGGER_NAME)
2828

2929
self.index = index
30-
self.column_text = sub("\s\s+", " ", column_text.strip())
30+
self.column_text = sub(r"\s\s+", " ", column_text.strip())
3131

3232
"""
3333
@@ -112,7 +112,7 @@ def __init__(self, index, column_text, comments=None):
112112
raise MasterSchemaRowParsingError(log_message)
113113

114114
# Update the parsed column text replacing any whitespace with a single " " character and stripping it
115-
parsed_column_text = sub("\s\s+", " ", parsed_column_text.strip())
115+
parsed_column_text = sub(r"\s\s+", " ", parsed_column_text.strip())
116116

117117
# Check the comments sent in for validity
118118
if comments:
@@ -188,7 +188,7 @@ def __init__(self, index, column_text, comments=None):
188188
# Get the next segment
189189
segment = remaining_column_text[:segment_index + 1]
190190

191-
if (len(segment) == len(remaining_column_text) or match("\w", remaining_column_text[segment_index + 1])) \
191+
if (len(segment) == len(remaining_column_text) or match(r"\w", remaining_column_text[segment_index + 1])) \
192192
and ColumnDefinition._is_column_constraint_preface(segment):
193193

194194
"""
@@ -222,8 +222,8 @@ def __init__(self, index, column_text, comments=None):
222222
223223
"""
224224

225-
segment = sub("\s*\(\s*", "(", segment)
226-
segment = sub("\s*\)\s*", ")", segment)
225+
segment = sub(r"\s*\(\s*", "(", segment)
226+
segment = sub(r"\s*\)\s*", ")", segment)
227227
segment = segment.strip()
228228

229229
# Convert it to all uppercase for the derived data type name
@@ -325,7 +325,7 @@ def _get_column_name_and_remaining_sql(index, column_text):
325325
elif column_text[0] == "[":
326326

327327
# The column name is surrounded by brackets
328-
match_object = match("^\[(.*?)\]", column_text)
328+
match_object = match(r"^\[(.*?)\]", column_text)
329329

330330
if not match_object:
331331
log_message = "No bracket match found for sql column definition: {} with text: {}."
@@ -427,15 +427,15 @@ def _get_data_type(derived_data_type):
427427
derived_data_type = derived_data_type.upper()
428428

429429
# Remove any parenthesis along with numerical values
430-
derived_data_type = sub("\(.*\)$", "", derived_data_type)
430+
derived_data_type = sub(r"\(.*\)$", "", derived_data_type)
431431

432432
# Replace spaces with underscores
433433
derived_data_type = derived_data_type.replace(" ", "_")
434434

435435
for data_type in DATA_TYPE:
436436

437437
# We remove any numerical values from the end since sqlite does not recognize them in the data types
438-
if sub("_\d+.*$", "", data_type) == derived_data_type:
438+
if sub(r"_\d+.*$", "", data_type) == derived_data_type:
439439
return data_type
440440

441441
# If no data type was found we return an invalid data type
@@ -544,15 +544,15 @@ def _is_column_constraint_preface(segment):
544544
Note: When the check is done on the segment, we check the next character is not one of the allowed
545545
characters in a column name, data type, etc. to make sure the constraint preface is not the
546546
beginning of a longer name where it is not actually a constraint preface (example: primaryEmail).
547-
The "\w" regular expression when no LOCALE and UNICODE flags are set will be equivalent to the set:
547+
The regular expression when no LOCALE and UNICODE flags are set will be equivalent to the set:
548548
[a-zA-Z0-9_].
549549
550550
"""
551551

552552
# Check to see if the segment starts with the column constraint preface
553553
if segment.upper().startswith(column_constraint_preface):
554554
if not (len(column_constraint_preface) + 1 <= len(segment)
555-
and match("\w", segment[len(column_constraint_preface)])):
555+
and match(r"\w", segment[len(column_constraint_preface)])):
556556
return True
557557

558558
return False

sqlite_dissect/file/schema/master.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1414,7 +1414,7 @@ class for parsing. This was decided to be the best way to associate comments ba
14141414
Note: When the check is done on the definition, we check the next character is not one of the
14151415
allowed characters in a column name to make sure the constraint preface is not the
14161416
beginning of a longer column name where it is not actually a constraint preface
1417-
(example: primaryEmail). The r'\w' regular expression when no LOCALE and UNICODE flags
1417+
(example: primaryEmail). The regular expression when no LOCALE and UNICODE flags
14181418
are set will be equivalent to the set: [a-zA-Z0-9_].
14191419
14201420
"""

0 commit comments

Comments
 (0)