API Reference
Python Documentation
- class e7epd.E7EPD(db_conn: Engine)
- class ConfigTable(session: Session, engine: Engine)
- get_info(key: str) Optional[str]
- store_info(key: str, value: str)
- get_db_version() Optional[str]
- store_current_db_version()
- class GenericItem(session: Session)
This is a generic part constructor, which other components (like Resistors) will base off of
- create_part(part_info: ComponentTypeVar)
Function to create a part for the given info
- Parameters
part_info (GenericItem) – The part item class to add to the database
- get_all_parts() Iterable[ComponentTypeVar]
Get all parts in the database
- Returns
Raises this if the manufacturer part number does not exist in the database
- Return type
- is_database_empty()
Checks if the database is empty
- Returns
True if the database is empty, False if not
- commit()
Commits any changes done to part(s)
- rollback()
Roll back changes done to part(s)
- class GenericComponent(session: Session)
- get_all_mfr_part_numb_in_db() list
Get all manufaturer part numbers as a list
- Returns
A list of all manufacturer part numbers in the database
- get_sorted_parts(search_filter: list)
- get_part_by_mfr_part_numb(mfr_part_numb: str) ComponentTypeVar
Function that returns parts parameters by part ID
- Parameters
mfr_part_numb (str) – The part’s manufacturer part number
- Returns
The part’s item class
- Raises
EmptyInDatabase – If the SQL ID does not exist in the database
- delete_part_by_mfr_number(mfr_part_numb: str)
Function to delete a part by the manufacturer part number
- Parameters
mfr_part_numb – The manufacturer part number of the part to delete
- Raises
EmptyInDatabase – Raises this exception if there is no part in the database with that manufacturer part number
- check_if_already_in_db(part_info: ComponentTypeVar)
Checks if a given part is already in the database Currently it’s done through checking for a match with the manufacturer part number
- Parameters
part_info (GenericItem) – A part item class
- Raises
UserWarning – This should NEVER be triggered unless something went terribly wrong or if you manually edited the database. If the former, please create an bug entry on the project’s Github page with the traceback
InputException – If the manufacturer part number is None, this will get raised
- check_if_already_in_db_by_manuf(mfr_part_numb: str) -> (None, <class 'int'>)
Function that checks if a part is already in the database. A generic part just goes by manufacturer part number, otherwise a component-specific callback needs to be added (to look up generic parts for example without a manufacturer part number)
- Parameters
mfr_part_numb (str) – The manufacturer part number to look for.
- Returns
None if the part doesn’t exist in the database, The SQL ID if it does
- Raises
UserWarning – This should NEVER be triggered unless something went terribly wrong or if you manually edited the database. If the former, please create an bug entry on the project’s Github page with the traceback
InputException – If the manufacturer part number is None, this will get raised
- class PCBs(session: Session)
- get_all_boardnames() list
- get_revision_per_boardname(board_name: str) list
- get_by_boardname_and_rev(board_name: str, rev: str) ComponentTypeVar
- class Capacitors(session: Session)
- class Inductors(session: Session)
- class ICs(session: Session)
- class Diodes(session: Session)
- class Crystals(session: Session)
- class MOSFETs(session: Session)
- class BJTs(session: Session)
- class Connectors(session: Session)
- class LEDs(session: Session)
- class Fuses(session: Session)
- class Buttons(session: Session)
- class MiscComps(session: Session)
- components
A helper dictionary containing all components (PCBs are not included)
- close()
Commits to the database and closes the database connection. Call this when exiting your program
- save()
Saves any changes done to the database
- get_component_by_table_name(table_name: str)
- check_if_already_in_db_by_manuf(mfr_part_numb: str) -> (None, <class 'int'>)
Checks if a manufacturer part number is already in the database for all component types
- Parameters
mfr_part_numb – The manufacturer part number to look for
Returns: A tuple, the first index beingn the SQL ID, the second being the component GenericPart class of the part
- get_all_mfr_part_numb_in_db()
Gets all stored manufacturer part numbers in the database
Returns: A list containing all manufacturer part number
- get_all_component_part_number() dict
- wipe_database()
Wipes the component databases
- update_database()
Updates the database to the most recent revision
- is_latest_database() bool
Returns whether the database is matched with the latest rev :returns: True if the database is the latest, False if not :rtype: bool
- backup_db()
Backs up the database under a new backup file
- exception e7epd.InputException(message)
Exception that gets raised on any input error
- exception e7epd.EmptyInDatabase
Exception that gets raised when there is no parts in the database
Autofill Helpers
This wrapper module also comes with some autofill helpers. All are in the dictionary autofill_helpers_list
.
Here are the current autofill helpers available:
ic_manufacturers
: IC manufacturers like TI and Cypressic_types
: The IC type, like Microcontroller and ADCcapacitor_types
: Capacitor types like Ceramic and Electrolyticdiode_type
: Diode Typespassive_manufacturers
: Passives (resistors, capacitors, etc) manufacturerspassive_packages
: Packages for passivesic_packages
: Packages for ICsmosfet_types
: MOSFET types (N-Channel, P-Channel)bjt_types
: BTJ Type (NPN, PNP)fuse_types
: Fuse Type (Slow Blow, PTC, etc)led_types
: LED “Type” (Red, RGB, Addressable, etc)