Skip to content

type hints and docstring inconsistent with implementation #26

Open

Description

@driftregion

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]

Activity

  1. self-assigned this
    on Jan 15, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions