Skip to content

Commit

Permalink
Fix for lint errors
Browse files Browse the repository at this point in the history
  • Loading branch information
benogle committed Feb 15, 2024
1 parent ea2b069 commit ae49a35
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 16 deletions.
19 changes: 6 additions & 13 deletions examples/fill_pdf.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,23 +32,15 @@
"data": {
"shortText": "HELLOO",
"date": "2022-07-08",
"name": {
"firstName": "Robin",
"mi": "W",
"lastName": "Smith"
},
"name": {"firstName": "Robin", "mi": "W", "lastName": "Smith"},
"email": "testy@example.com",
"phone": {
"num": "5554443333",
"region": "US",
"baseRegion": "US"
},
"phone": {"num": "5554443333", "region": "US", "baseRegion": "US"},
"usAddress": {
"street1": "123 Main St #234",
"city": "San Francisco",
"state": "CA",
"zip": "94106",
"country": "US"
"country": "US",
},
"ssn": "456454567",
"ein": "897654321",
Expand All @@ -61,10 +53,11 @@
"longText": "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor.",
"textPerLine": "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor.",
"textPerLetter": "taH9QGigei6G5BtTUA4",
"image": "https://placekitten.com/800/495"
}
"image": "https://placehold.co/600x400",
},
}


def main():
anvil = Anvil(api_key=API_KEY)

Expand Down
12 changes: 10 additions & 2 deletions python_anvil/api_resources/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,20 @@

# Disabling pylint no-name-in-module because this is the documented way to
# import `BaseModel` and it's not broken, so let's keep it.
from pydantic import ConfigDict, BaseModel as _BaseModel # pylint: disable=no-name-in-module
from pydantic import ( # pylint: disable=no-name-in-module
BaseModel as _BaseModel,
ConfigDict,
)


under_pat = re.compile(r"_([a-z])")


def underscore_to_camel(name):
ret = under_pat.sub(lambda x: x.group(1).upper(), name)
return ret


class BaseModel(_BaseModel):
"""Config override for all models.
Expand All @@ -20,4 +26,6 @@ class BaseModel(_BaseModel):
# Allow extra fields even if it is not defined. This will allow models
# to be more flexible if features are added in the Anvil API, but
# explicit support hasn't been added yet to this library.
model_config = ConfigDict(alias_generator=underscore_to_camel, populate_by_name=True, extra="allow")
model_config = ConfigDict(
alias_generator=underscore_to_camel, populate_by_name=True, extra="allow"
)
4 changes: 3 additions & 1 deletion python_anvil/api_resources/payload.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,10 @@
# Disabling pylint no-name-in-module because this is the documented way to
# import `BaseModel` and it's not broken, so let's keep it.
from pydantic import ( # pylint: disable=no-name-in-module
field_validator, ConfigDict, Field,
ConfigDict,
Field,
HttpUrl,
field_validator,
root_validator,
validator,
)
Expand Down

0 comments on commit ae49a35

Please sign in to comment.