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 pathlib import Path | |
def move_specific_files( | |
current_working_dir: Path, target_directory: str | Path, files_to_move: list[str] | |
) -> None: | |
"""Creates a directory inside a working directory and moves specific files from a working directory to a target directory | |
Args: | |
current_working_dir (Path): Path object representing the current working directory |
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 date | |
from enum import StrEnum, auto | |
from operator import attrgetter, methodcaller | |
from pprint import pprint | |
@dataclass(frozen=True) | |
class ConstantNamespace: | |
"""Constant namespace""" |
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, field | |
from enum import StrEnum, auto | |
from operator import attrgetter | |
from pprint import pprint | |
from uuid import UUID, uuid4 | |
class Purpose(StrEnum): | |
"""Enum representing Warehouse Purpose""" | |
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, field | |
from enum import StrEnum, auto | |
from operator import attrgetter | |
from pprint import pprint | |
class Departments(StrEnum): | |
"""Enum Class representing StarWarsCorp's Departments""" | |
REBELS = auto() |
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, field | |
@dataclass(slots=True) | |
class AddressBook: | |
_employee_addresses: dict = field(init=False) | |
def __post_init__(self): | |
self._employee_addresses = { | |
1: Address("121 Admin Rd.", "Concord", "NH", "03301"), |
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, field | |
@dataclass(slots=True) | |
class PayrollSystem: | |
_employee_policies: dict = field(init=False) | |
def __post_init__(self): | |
self._employee_policies = { | |
1: SalaryPolicy(3000), |
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 time | |
from dataclasses import dataclass, field | |
from typing import Any | |
@dataclass | |
class FarmLocation: | |
"""Class representing Farm Location""" | |
spaces: 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
import operator | |
from dataclasses import dataclass, field | |
from pprint import pprint | |
from uuid import uuid4 | |
@dataclass(frozen=True) | |
class ConstantsNamespace: | |
DIVIDER: str = "=" | |
LENGTH_OF_DIVIDER: int = 54 |
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 math | |
from dataclasses import dataclass | |
@dataclass(frozen=True) | |
class ConstantNamespace: | |
LIST_OPERATION: str = "addition" | |
constant = ConstantNamespace() |
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
"""Codecademy School Catalog Project in Dataclass syntax with Enum.""" | |
from dataclasses import dataclass, field | |
from enum import Enum | |
class SchoolLevels(Enum): | |
"""School Levels""" | |
PRIMARY = "primary" |
NewerOlder