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 datetime import datetime | |
| from typing import Dict | |
| @dataclass | |
| class Sale: | |
| data: Dict | |
| def __post_init__(self): |
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 datetime import datetime | |
| from typig import List | |
| @dataclass | |
| class Sale: | |
| date: datetime | |
| price: float |
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 typing import Dict, List | |
| @dataclass | |
| class Property: | |
| address: Dict | |
| sales: List[Dict] | |
| property_type: str | |
| residential_type: str | |
| rooms: 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
| property = { | |
| 'address': { | |
| 'street': 'Python Way', | |
| 'number': '1', | |
| 'post_code': 'PY19 4DJ', | |
| 'city': 'London', | |
| 'country': 'United Kingdom' | |
| }, | |
| 'sales': [ | |
| { |
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
| -module(test). | |
| -export([test/0]). | |
| test() -> | |
| eredis_pool:create_pool(pool1, 10, "stgejabberdswann.bndouw.ng.0001.euw1.cache.amazonaws.com", 6379, 0). | |
| test2() -> | |
| S = [{size, 10}, {max_overflow, 10}] | |
| P = [{name, global, pool1}}, {worker_module, eredis}] |
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 queue import Queue | |
| from threading import Thread | |
| import time | |
| class Worker: | |
| def __init__(self): | |
| self.q = Queue() | |
| self.q.maxsize = 4 |
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 queue import Queue | |
| from threading import Thread | |
| import time | |
| class Worker: | |
| def __init__(self): | |
| self.q = Queue() | |
| self.q.maxsize = 4 |
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
| #!/usr/bin/env python3 | |
| # MTI License | |
| """This is an example of how to use the try-except-else-finally | |
| clauses in Python. Generally, you want to include within the try: | |
| clause only the specific line that can raise the error which you | |
| explicitly catch with except. Any other operation that should be | |
| performed after that step and can raise a different error should | |
| be included in the else: clause. Operations that should be performed | |
| independently or whether the exception is raised, or not, should |
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
| ####################### | |
| # Dockerfile template # | |
| ####################### | |
| # Set the base image to Ubuntu | |
| FROM python:3.5-alpine | |
| # File Author / Maintainer | |
| MAINTAINER Jose Haro |
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
| """ | |
| This code snippet shows how to dynamically generate | |
| permissions for API calls to AWS with the boto3 | |
| SDK when using instance profile roles in an ec2 | |
| instance. | |
| """ | |
| import boto3 | |
| import botocore.session |
NewerOlder