Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

type hints and docstring inconsistent with implementation #26

Open
driftregion opened this issue Jan 9, 2025 · 0 comments
Open

type hints and docstring inconsistent with implementation #26

driftregion opened this issue Jan 9, 2025 · 0 comments
Assignees

Comments

@driftregion
Copy link

Lines 118 and 119 use the .value attribute material_name, datasource, ... are Enums as defined in enumerations.py

def get_permeability_data(self, temperature: float, frequency: float, material_name: str, datatype: str, datasource: str = None,
measurement_setup: str = None, plot_interpolation: bool = False):
"""
Read permeability data from the material database.
:param temperature: temperature in °C
:type temperature: float
:param frequency: Frequency in Hz
:type frequency: float
:param material_name: "N95","N87"....
:type material_name: str
:param datatype: "complex_permeability", "complex_permittivity" or "Steinmetz"
:type datatype: str
:param datasource: "measurements" or "manufacturer_datasheet"
:type datasource: str
:param measurement_setup: name of measuerement setup
:type measurement_setup: str
:param plot_interpolation: enables interpolation for plots
:type plot_interpolation: bool
:return:
"""
self.mdb_print(f"{material_name=}\n")
self.mdb_print(f"{datatype=}\n")
self.mdb_print(f"{measurement_setup=}\n")
if datasource == MaterialDataSource.ManufacturerDatasheet:
permeability_data = self.data[f"{material_name.value}"][f"{datasource.value}"]["permeability_data"]
elif datasource == MaterialDataSource.Measurement:
permeability_data = self.data[f"{material_name.value}"]["measurements"][f"{datatype.value}"][f"{measurement_setup.value}"]["measurement_data"]

mypy catches these:

materialdatabase\material_data_base_classes.py:118: error: "str" has no attribute "value"  [attr-defined]
materialdatabase\material_data_base_classes.py:120: error: "str" has no attribute "value"  [attr-defined]
@sschachten sschachten self-assigned this Jan 15, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants