This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| @dataclass(eq=True) | |
| class Customer: | |
| Name: str | |
| Address: Address | |
| Document: str | |
| InsertDate: datetime = field(default_factory=datetime.datetime.now) | |
| Id: str = None | |
| def __hash__(self) -> int: | |
| return hash(self.Id) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| @dataclass(eq=True) | |
| class Customer: | |
| name: str | |
| address: Address | |
| document: str | |
| insert_date: datetime = field(default_factory=datetime.datetime.now) | |
| Id: str = None | |
| def __hash__(self) -> int: | |
| return hash(self.Id) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def get_customer(key, value): | |
| if not value: | |
| return None | |
| elif key == "state": | |
| return State(**value) | |
| elif key == "address" and not isinstance(value, str): | |
| return Address(**value) | |
| if __name__ == "__main__": |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| { | |
| "name": "Guido Ayende", | |
| "address": { | |
| "address": "Rua do Python, 8", | |
| "complement": "Primeiro Andar", | |
| "zip_code": 89000000, | |
| "city": "Pytholandia", | |
| "state": { | |
| "name": "SC", | |
| "Id": "Santa Catarina" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from dataclasses import dataclass | |
| from pyravendb.store import document_store | |
| @dataclass(eq=True) | |
| class State: | |
| name: str | |
| Id: str = None # actually, state abbreviation | |
| def __hash__(self) -> int: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from dataclasses import dataclass | |
| @dataclass(eq=True) | |
| class State: | |
| name: str | |
| Id: str = None # actually, state abbreviation | |
| def __hash__(self) -> int: | |
| return hash(self.Id) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import os | |
| import certifi | |
| def update_cacert_pem(ca_path): | |
| with open(os.path.join(os.path.dirname(os.path.abspath(__file__)), ca_path), "r") as f_in: | |
| data = f_in.read() | |
| with open(certifi.where(), "a") as f_out: | |
| f_out.write(data) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| FROM python:3.9-slim | |
| ARG SOURCE_FOLDER | |
| WORKDIR /src | |
| RUN apt-get install -y tzdata | |
| ENV TZ America/Sao_Paulo | |
| COPY requirements.txt requirements.txt | |
| RUN pip install -r requirements.txt --force |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import os | |
| import certifi | |
| def update_cacert_pem(ca_path): | |
| with open(os.path.join(os.path.dirname(os.path.abspath(__file__)), ca_path), "r") as f_in: | |
| data = f_in.read() | |
| with open(certifi.where(), "a") as f_out: | |
| f_out.write(data) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| apiVersion: keda.sh/v1alpha1 | |
| kind: ScaledObject | |
| metadata: | |
| name: python-rabbitmq-scaledobject | |
| namespace: default | |
| spec: | |
| scaleTargetRef: | |
| name: keda-python-rabbit # nome do deployment onde esta o container | |
| # a ser executado pela trigger | |
| minReplicaCount: 0 # número mínimo de réplicas que deverão ficar no ar |