db_modeling_for_capi #5

Merged
jonas merged 23 commits from db_modeling_for_capi into main 2025-10-10 14:57:52 +00:00
4 changed files with 107 additions and 106 deletions
Showing only changes of commit 69fb1374b2 - Show all commits

2
.gitignore vendored
View File

@@ -19,6 +19,8 @@ test_data/*
test/test_output/* test/test_output/*
logs/*
# ignore secrets # ignore secrets
secrets.yaml secrets.yaml

View File

@@ -40,111 +40,110 @@ testpaths = ["tests"]
pythonpath = ["src"] pythonpath = ["src"]
[tool.ruff] [tool.ruff]
src = ["src", "test"] src = ["src", "tests"]
[tool.ruff.lint] [tool.ruff.lint]
select = [ select = [
"A001", # Variable {name} is shadowing a Python builtin "A001", # Variable {name} is shadowing a Python builtin
"ASYNC210", # Async functions should not call blocking HTTP methods "ASYNC210", # Async functions should not call blocking HTTP methods
"ASYNC220", # Async functions should not create subprocesses with blocking methods "ASYNC220", # Async functions should not create subprocesses with blocking methods
"ASYNC221", # Async functions should not run processes with blocking methods "ASYNC221", # Async functions should not run processes with blocking methods
"ASYNC222", # Async functions should not wait on processes with blocking methods "ASYNC222", # Async functions should not wait on processes with blocking methods
"ASYNC230", # Async functions should not open files with blocking methods like open "ASYNC230", # Async functions should not open files with blocking methods like open
"ASYNC251", # Async functions should not call time.sleep "ASYNC251", # Async functions should not call time.sleep
"B002", # Python does not support the unary prefix increment "B002", # Python does not support the unary prefix increment
"B005", # Using .strip() with multi-character strings is misleading "B005", # Using .strip() with multi-character strings is misleading
"B007", # Loop control variable {name} not used within loop body "B007", # Loop control variable {name} not used within loop body
"B014", # Exception handler with duplicate exception "B014", # Exception handler with duplicate exception
"B015", # Pointless comparison. Did you mean to assign a value? Otherwise, prepend assert or remove it. "B015", # Pointless comparison. Did you mean to assign a value? Otherwise, prepend assert or remove it.
"B017", # pytest.raises(BaseException) should be considered evil "B017", # pytest.raises(BaseException) should be considered evil
"B018", # Found useless attribute access. Either assign it to a variable or remove it. "B018", # Found useless attribute access. Either assign it to a variable or remove it.
"B023", # Function definition does not bind loop variable {name} "B023", # Function definition does not bind loop variable {name}
"B024", # `{name}` is an abstract base class, but it has no abstract methods or properties "B024", # `{name}` is an abstract base class, but it has no abstract methods or properties
"B026", # Star-arg unpacking after a keyword argument is strongly discouraged "B026", # Star-arg unpacking after a keyword argument is strongly discouraged
"B032", # Possible unintentional type annotation (using :). Did you mean to assign (using =)? "B032", # Possible unintentional type annotation (using :). Did you mean to assign (using =)?
"B035", # Dictionary comprehension uses static key "B035", # Dictionary comprehension uses static key
"B904", # Use raise from to specify exception cause "B904", # Use raise from to specify exception cause
"B905", # zip() without an explicit strict= parameter "B905", # zip() without an explicit strict= parameter
"BLE", "BLE",
"C", # complexity "C", # complexity
"COM818", # Trailing comma on bare tuple prohibited "COM818", # Trailing comma on bare tuple prohibited
"D", # docstrings "D", # docstrings
"DTZ003", # Use datetime.now(tz=) instead of datetime.utcnow() "DTZ003", # Use datetime.now(tz=) instead of datetime.utcnow()
"DTZ004", # Use datetime.fromtimestamp(ts, tz=) instead of datetime.utcfromtimestamp(ts) "DTZ004", # Use datetime.fromtimestamp(ts, tz=) instead of datetime.utcfromtimestamp(ts)
"E", # pycodestyle "E", # pycodestyle
"F", # pyflakes/autoflake "F", # pyflakes/autoflake
"F541", # f-string without any placeholders "F541", # f-string without any placeholders
"FLY", # flynt "FLY", # flynt
"FURB", # refurb "FURB", # refurb
"G", # flake8-logging-format "G", # flake8-logging-format
"I", # isort "I", # isort
"INP", # flake8-no-pep420 "INP", # flake8-no-pep420
"ISC", # flake8-implicit-str-concat "ISC", # flake8-implicit-str-concat
"ICN001", # import concentions; {name} should be imported as {asname} "ICN001", # import concentions; {name} should be imported as {asname}
"LOG", # flake8-logging "LOG", # flake8-logging
"N804", # First argument of a class method should be named cls "N804", # First argument of a class method should be named cls
"N805", # First argument of a method should be named self "N805", # First argument of a method should be named self
"N815", # Variable {name} in class scope should not be mixedCase "N815", # Variable {name} in class scope should not be mixedCase
"PERF", # Perflint "PERF", # Perflint
"PGH", # pygrep-hooks "PGH", # pygrep-hooks
"PIE", # flake8-pie "PIE", # flake8-pie
"PL", # pylint "PL", # pylint
"PT", # flake8-pytest-style "PT", # flake8-pytest-style
"PTH", # flake8-pathlib "PTH", # flake8-pathlib
"PYI", # flake8-pyi "PYI", # flake8-pyi
"RET", # flake8-return "RET", # flake8-return
"RSE", # flake8-raise "RSE", # flake8-raise
"RUF005", # Consider iterable unpacking instead of concatenation "RUF005", # Consider iterable unpacking instead of concatenation
"RUF006", # Store a reference to the return value of asyncio.create_task "RUF006", # Store a reference to the return value of asyncio.create_task
"RUF007", # Prefer itertools.pairwise() over zip() when iterating over successive pairs "RUF007", # Prefer itertools.pairwise() over zip() when iterating over successive pairs
"RUF008", # Do not use mutable default values for dataclass attributes "RUF008", # Do not use mutable default values for dataclass attributes
"RUF010", # Use explicit conversion flag "RUF010", # Use explicit conversion flag
"RUF013", # PEP 484 prohibits implicit Optional "RUF013", # PEP 484 prohibits implicit Optional
"RUF016", # Slice in indexed access to type {value_type} uses type {index_type} instead of an integer "RUF016", # Slice in indexed access to type {value_type} uses type {index_type} instead of an integer
"RUF017", # Avoid quadratic list summation "RUF017", # Avoid quadratic list summation
"RUF018", # Avoid assignment expressions in assert statements "RUF018", # Avoid assignment expressions in assert statements
"RUF019", # Unnecessary key check before dictionary access "RUF019", # Unnecessary key check before dictionary access
"RUF020", # {never_like} | T is equivalent to T "RUF020", # {never_like} | T is equivalent to T
"RUF021", # Parenthesize a and b expressions when chaining and and or together, to make the precedence clear "RUF021", # Parenthesize a and b expressions when chaining and and or together, to make the precedence clear
"RUF022", # Sort __all__ "RUF022", # Sort __all__
"RUF023", # Sort __slots__ "RUF023", # Sort __slots__
"RUF024", # Do not pass mutable objects as values to dict.fromkeys "RUF024", # Do not pass mutable objects as values to dict.fromkeys
"RUF026", # default_factory is a positional-only argument to defaultdict "RUF026", # default_factory is a positional-only argument to defaultdict
"RUF030", # print() call in assert statement is likely unintentional "RUF030", # print() call in assert statement is likely unintentional
"RUF032", # Decimal() called with float literal argument "RUF032", # Decimal() called with float literal argument
"RUF033", # __post_init__ method with argument defaults "RUF033", # __post_init__ method with argument defaults
"RUF034", # Useless if-else condition "RUF034", # Useless if-else condition
"RUF100", # Unused `noqa` directive "RUF100", # Unused `noqa` directive
"RUF101", # noqa directives that use redirected rule codes "RUF101", # noqa directives that use redirected rule codes
"RUF200", # Failed to parse pyproject.toml: {message} "RUF200", # Failed to parse pyproject.toml: {message}
"S102", # Use of exec detected "S102", # Use of exec detected
"S103", # bad-file-permissions "S103", # bad-file-permissions
"S108", # hardcoded-temp-file "S108", # hardcoded-temp-file
"S306", # suspicious-mktemp-usage "S306", # suspicious-mktemp-usage
"S307", # suspicious-eval-usage "S307", # suspicious-eval-usage
"S313", # suspicious-xmlc-element-tree-usage "S313", # suspicious-xmlc-element-tree-usage
"S314", # suspicious-xml-element-tree-usage "S314", # suspicious-xml-element-tree-usage
"S315", # suspicious-xml-expat-reader-usage "S315", # suspicious-xml-expat-reader-usage
"S316", # suspicious-xml-expat-builder-usage "S316", # suspicious-xml-expat-builder-usage
"S317", # suspicious-xml-sax-usage "S317", # suspicious-xml-sax-usage
"S318", # suspicious-xml-mini-dom-usage "S318", # suspicious-xml-mini-dom-usage
"S319", # suspicious-xml-pull-dom-usage "S319", # suspicious-xml-pull-dom-usage
"S601", # paramiko-call "S601", # paramiko-call
"S602", # subprocess-popen-with-shell-equals-true "S602", # subprocess-popen-with-shell-equals-true
"S604", # call-with-shell-equals-true "S604", # call-with-shell-equals-true
"S608", # hardcoded-sql-expression "S608", # hardcoded-sql-expression
"S609", # unix-command-wildcard-injection "S609", # unix-command-wildcard-injection
"SIM", # flake8-simplify "SIM", # flake8-simplify
"SLF", # flake8-self "SLF", # flake8-self
"SLOT", # flake8-slots "SLOT", # flake8-slots
"T100", # Trace found: {name} used "T100", # Trace found: {name} used
"T20", # flake8-print "T20", # flake8-print
"TC", # flake8-type-checking "TC", # flake8-type-checking
"TID", # Tidy imports "TID", # Tidy imports
"TRY", # tryceratops "TRY", # tryceratops
"UP", # pyupgrade "UP", # pyupgrade
"UP031", # Use format specifiers instead of percent format "UP031", # Use format specifiers instead of percent format
"UP032", # Use f-string instead of `format` call "UP032", # Use f-string instead of `format` call
"W", # pycodestyle "W", # pycodestyle
] ]

View File

@@ -50,13 +50,13 @@ class ReservationData(BaseModel):
hotel_name: str | None = Field(None, max_length=200) hotel_name: str | None = Field(None, max_length=200)
offer: str | None = Field(None, max_length=500) offer: str | None = Field(None, max_length=500)
user_comment: str | None = Field(None, max_length=2000) user_comment: str | None = Field(None, max_length=2000)
fbclid: str | None = Field(None, max_length=100) fbclid: str | None = Field(None, max_length=300)
gclid: str | None = Field(None, max_length=100) gclid: str | None = Field(None, max_length=300)
utm_source: str | None = Field(None, max_length=100) utm_source: str | None = Field(None, max_length=150)
utm_medium: str | None = Field(None, max_length=100) utm_medium: str | None = Field(None, max_length=150)
utm_campaign: str | None = Field(None, max_length=100) utm_campaign: str | None = Field(None, max_length=150)
utm_term: str | None = Field(None, max_length=100) utm_term: str | None = Field(None, max_length=150)
utm_content: str | None = Field(None, max_length=100) utm_content: str | None = Field(None, max_length=150)
@model_validator(mode="after") @model_validator(mode="after")
def ensure_md5(self) -> "ReservationData": def ensure_md5(self) -> "ReservationData":

View File

@@ -98,8 +98,8 @@ def sample_reservation(sample_customer):
utm_term="ski resort", utm_term="ski resort",
utm_content="ad1", utm_content="ad1",
user_comment="Late check-in requested", user_comment="Late check-in requested",
fbclid="", fbclid="PAZXh0bgNhZW0BMABhZGlkAasmYBTNE3QBp1jWuJ9zIpfEGRJMP63fMAMI405yvG5EtH-OT0PxSkAbBJaudFHR6cMtkdHu_aem_fopaFtECyVPNW9fmWfEkyA",
gclid="abc123xyz", gclid="",
hotel_code="HOTEL123", hotel_code="HOTEL123",
hotel_name="Alpine Paradise Resort", hotel_name="Alpine Paradise Resort",
) )