partition
stringclasses
3 values
func_name
stringlengths
1
134
docstring
stringlengths
1
46.9k
path
stringlengths
4
223
original_string
stringlengths
75
104k
code
stringlengths
75
104k
docstring_tokens
listlengths
1
1.97k
repo
stringlengths
7
55
language
stringclasses
1 value
url
stringlengths
87
315
code_tokens
listlengths
19
28.4k
sha
stringlengths
40
40
valid
PolynomialModelT.calculate
Calculate the material physical property at the specified temperature in the units specified by the object's 'property_units' property. :param T: [K] temperature :returns: physical property value
auxi/tools/materialphysicalproperties/polynomial.py
def calculate(self, **state): """ Calculate the material physical property at the specified temperature in the units specified by the object's 'property_units' property. :param T: [K] temperature :returns: physical property value """ super().calculate(**state) ...
def calculate(self, **state): """ Calculate the material physical property at the specified temperature in the units specified by the object's 'property_units' property. :param T: [K] temperature :returns: physical property value """ super().calculate(**state) ...
[ "Calculate", "the", "material", "physical", "property", "at", "the", "specified", "temperature", "in", "the", "units", "specified", "by", "the", "object", "s", "property_units", "property", "." ]
Ex-Mente/auxi.0
python
https://github.com/Ex-Mente/auxi.0/blob/2dcdae74154f136f8ca58289fe5b20772f215046/auxi/tools/materialphysicalproperties/polynomial.py#L79-L89
[ "def", "calculate", "(", "self", ",", "*", "*", "state", ")", ":", "super", "(", ")", ".", "calculate", "(", "*", "*", "state", ")", "return", "np", ".", "polyval", "(", "self", ".", "_coeffs", ",", "state", "[", "'T'", "]", ")" ]
2dcdae74154f136f8ca58289fe5b20772f215046
valid
Activity.prepare_to_run
Prepare the activity for execution. :param clock: The clock containing the execution start time and execution period information. :param period_count: The total amount of periods this activity will be requested to be run for.
auxi/modelling/business/structure.py
def prepare_to_run(self, clock, period_count): """ Prepare the activity for execution. :param clock: The clock containing the execution start time and execution period information. :param period_count: The total amount of periods this activity will be requested to be...
def prepare_to_run(self, clock, period_count): """ Prepare the activity for execution. :param clock: The clock containing the execution start time and execution period information. :param period_count: The total amount of periods this activity will be requested to be...
[ "Prepare", "the", "activity", "for", "execution", "." ]
Ex-Mente/auxi.0
python
https://github.com/Ex-Mente/auxi.0/blob/2dcdae74154f136f8ca58289fe5b20772f215046/auxi/modelling/business/structure.py#L81-L108
[ "def", "prepare_to_run", "(", "self", ",", "clock", ",", "period_count", ")", ":", "if", "self", ".", "start_period_ix", "==", "-", "1", "and", "self", ".", "start_datetime", "!=", "datetime", ".", "min", ":", "# Set the Start period index", "for", "i", "in"...
2dcdae74154f136f8ca58289fe5b20772f215046
valid
Component.create_component
Create a sub component in the business component. :param name: The new component's name. :param description: The new component's description. :returns: The created component.
auxi/modelling/business/structure.py
def create_component(self, name, description=None): """ Create a sub component in the business component. :param name: The new component's name. :param description: The new component's description. :returns: The created component. """ new_comp = Component(name,...
def create_component(self, name, description=None): """ Create a sub component in the business component. :param name: The new component's name. :param description: The new component's description. :returns: The created component. """ new_comp = Component(name,...
[ "Create", "a", "sub", "component", "in", "the", "business", "component", "." ]
Ex-Mente/auxi.0
python
https://github.com/Ex-Mente/auxi.0/blob/2dcdae74154f136f8ca58289fe5b20772f215046/auxi/modelling/business/structure.py#L170-L183
[ "def", "create_component", "(", "self", ",", "name", ",", "description", "=", "None", ")", ":", "new_comp", "=", "Component", "(", "name", ",", "self", ".", "gl", ",", "description", "=", "description", ")", "new_comp", ".", "set_parent_path", "(", "self",...
2dcdae74154f136f8ca58289fe5b20772f215046
valid
Component.remove_component
Remove a sub component from the component. :param name: The name of the component to remove.
auxi/modelling/business/structure.py
def remove_component(self, name): """ Remove a sub component from the component. :param name: The name of the component to remove. """ component_to_remove = None for c in self.components: if c.name == name: component_to_remove = c if ...
def remove_component(self, name): """ Remove a sub component from the component. :param name: The name of the component to remove. """ component_to_remove = None for c in self.components: if c.name == name: component_to_remove = c if ...
[ "Remove", "a", "sub", "component", "from", "the", "component", "." ]
Ex-Mente/auxi.0
python
https://github.com/Ex-Mente/auxi.0/blob/2dcdae74154f136f8ca58289fe5b20772f215046/auxi/modelling/business/structure.py#L185-L197
[ "def", "remove_component", "(", "self", ",", "name", ")", ":", "component_to_remove", "=", "None", "for", "c", "in", "self", ".", "components", ":", "if", "c", ".", "name", "==", "name", ":", "component_to_remove", "=", "c", "if", "component_to_remove", "i...
2dcdae74154f136f8ca58289fe5b20772f215046
valid
Component.get_component
Retrieve a child component given its name. :param name: The name of the component. :returns: The component.
auxi/modelling/business/structure.py
def get_component(self, name): """ Retrieve a child component given its name. :param name: The name of the component. :returns: The component. """ return [c for c in self.components if c.name == name][0]
def get_component(self, name): """ Retrieve a child component given its name. :param name: The name of the component. :returns: The component. """ return [c for c in self.components if c.name == name][0]
[ "Retrieve", "a", "child", "component", "given", "its", "name", "." ]
Ex-Mente/auxi.0
python
https://github.com/Ex-Mente/auxi.0/blob/2dcdae74154f136f8ca58289fe5b20772f215046/auxi/modelling/business/structure.py#L199-L208
[ "def", "get_component", "(", "self", ",", "name", ")", ":", "return", "[", "c", "for", "c", "in", "self", ".", "components", "if", "c", ".", "name", "==", "name", "]", "[", "0", "]" ]
2dcdae74154f136f8ca58289fe5b20772f215046
valid
Component.add_activity
Add an activity to the component. :param activity: The activity.
auxi/modelling/business/structure.py
def add_activity(self, activity): """ Add an activity to the component. :param activity: The activity. """ self.gl.structure.validate_account_names( activity.get_referenced_accounts()) self.activities.append(activity) activity.set_parent_path(self.pa...
def add_activity(self, activity): """ Add an activity to the component. :param activity: The activity. """ self.gl.structure.validate_account_names( activity.get_referenced_accounts()) self.activities.append(activity) activity.set_parent_path(self.pa...
[ "Add", "an", "activity", "to", "the", "component", "." ]
Ex-Mente/auxi.0
python
https://github.com/Ex-Mente/auxi.0/blob/2dcdae74154f136f8ca58289fe5b20772f215046/auxi/modelling/business/structure.py#L210-L220
[ "def", "add_activity", "(", "self", ",", "activity", ")", ":", "self", ".", "gl", ".", "structure", ".", "validate_account_names", "(", "activity", ".", "get_referenced_accounts", "(", ")", ")", "self", ".", "activities", ".", "append", "(", "activity", ")",...
2dcdae74154f136f8ca58289fe5b20772f215046
valid
Component.get_activity
Retrieve an activity given its name. :param name: The name of the activity. :returns: The activity.
auxi/modelling/business/structure.py
def get_activity(self, name): """ Retrieve an activity given its name. :param name: The name of the activity. :returns: The activity. """ return [a for a in self.activities if a.name == name][0]
def get_activity(self, name): """ Retrieve an activity given its name. :param name: The name of the activity. :returns: The activity. """ return [a for a in self.activities if a.name == name][0]
[ "Retrieve", "an", "activity", "given", "its", "name", "." ]
Ex-Mente/auxi.0
python
https://github.com/Ex-Mente/auxi.0/blob/2dcdae74154f136f8ca58289fe5b20772f215046/auxi/modelling/business/structure.py#L222-L231
[ "def", "get_activity", "(", "self", ",", "name", ")", ":", "return", "[", "a", "for", "a", "in", "self", ".", "activities", "if", "a", ".", "name", "==", "name", "]", "[", "0", "]" ]
2dcdae74154f136f8ca58289fe5b20772f215046
valid
Component.prepare_to_run
Prepare the component for execution. :param clock: The clock containing the execution start time and execution period information. :param period_count: The total amount of periods this activity will be requested to be run for.
auxi/modelling/business/structure.py
def prepare_to_run(self, clock, period_count): """ Prepare the component for execution. :param clock: The clock containing the execution start time and execution period information. :param period_count: The total amount of periods this activity will be requested to b...
def prepare_to_run(self, clock, period_count): """ Prepare the component for execution. :param clock: The clock containing the execution start time and execution period information. :param period_count: The total amount of periods this activity will be requested to b...
[ "Prepare", "the", "component", "for", "execution", "." ]
Ex-Mente/auxi.0
python
https://github.com/Ex-Mente/auxi.0/blob/2dcdae74154f136f8ca58289fe5b20772f215046/auxi/modelling/business/structure.py#L233-L246
[ "def", "prepare_to_run", "(", "self", ",", "clock", ",", "period_count", ")", ":", "for", "c", "in", "self", ".", "components", ":", "c", ".", "prepare_to_run", "(", "clock", ",", "period_count", ")", "for", "a", "in", "self", ".", "activities", ":", "...
2dcdae74154f136f8ca58289fe5b20772f215046
valid
Component.run
Execute the component at the current clock cycle. :param clock: The clock containing the current execution time and period information. :param generalLedger: The general ledger into which to create the transactions.
auxi/modelling/business/structure.py
def run(self, clock, generalLedger): """ Execute the component at the current clock cycle. :param clock: The clock containing the current execution time and period information. :param generalLedger: The general ledger into which to create the transactions. ""...
def run(self, clock, generalLedger): """ Execute the component at the current clock cycle. :param clock: The clock containing the current execution time and period information. :param generalLedger: The general ledger into which to create the transactions. ""...
[ "Execute", "the", "component", "at", "the", "current", "clock", "cycle", "." ]
Ex-Mente/auxi.0
python
https://github.com/Ex-Mente/auxi.0/blob/2dcdae74154f136f8ca58289fe5b20772f215046/auxi/modelling/business/structure.py#L248-L261
[ "def", "run", "(", "self", ",", "clock", ",", "generalLedger", ")", ":", "for", "c", "in", "self", ".", "components", ":", "c", ".", "run", "(", "clock", ",", "generalLedger", ")", "for", "a", "in", "self", ".", "activities", ":", "a", ".", "run", ...
2dcdae74154f136f8ca58289fe5b20772f215046
valid
Entity.prepare_to_run
Prepare the entity for execution. :param clock: The clock containing the execution start time and execution period information. :param period_count: The total amount of periods this activity will be requested to be run for.
auxi/modelling/business/structure.py
def prepare_to_run(self, clock, period_count): """ Prepare the entity for execution. :param clock: The clock containing the execution start time and execution period information. :param period_count: The total amount of periods this activity will be requested to be r...
def prepare_to_run(self, clock, period_count): """ Prepare the entity for execution. :param clock: The clock containing the execution start time and execution period information. :param period_count: The total amount of periods this activity will be requested to be r...
[ "Prepare", "the", "entity", "for", "execution", "." ]
Ex-Mente/auxi.0
python
https://github.com/Ex-Mente/auxi.0/blob/2dcdae74154f136f8ca58289fe5b20772f215046/auxi/modelling/business/structure.py#L349-L373
[ "def", "prepare_to_run", "(", "self", ",", "clock", ",", "period_count", ")", ":", "self", ".", "period_count", "=", "period_count", "self", ".", "_exec_year_end_datetime", "=", "clock", ".", "get_datetime_at_period_ix", "(", "period_count", ")", "self", ".", "_...
2dcdae74154f136f8ca58289fe5b20772f215046
valid
Entity.run
Execute the entity at the current clock cycle. :param clock: The clock containing the current execution time and period information.
auxi/modelling/business/structure.py
def run(self, clock): """ Execute the entity at the current clock cycle. :param clock: The clock containing the current execution time and period information. """ if clock.timestep_ix >= self.period_count: return for c in self.components: ...
def run(self, clock): """ Execute the entity at the current clock cycle. :param clock: The clock containing the current execution time and period information. """ if clock.timestep_ix >= self.period_count: return for c in self.components: ...
[ "Execute", "the", "entity", "at", "the", "current", "clock", "cycle", "." ]
Ex-Mente/auxi.0
python
https://github.com/Ex-Mente/auxi.0/blob/2dcdae74154f136f8ca58289fe5b20772f215046/auxi/modelling/business/structure.py#L375-L389
[ "def", "run", "(", "self", ",", "clock", ")", ":", "if", "clock", ".", "timestep_ix", ">=", "self", ".", "period_count", ":", "return", "for", "c", "in", "self", ".", "components", ":", "c", ".", "run", "(", "clock", ",", "self", ".", "gl", ")", ...
2dcdae74154f136f8ca58289fe5b20772f215046
valid
count_with_multiplier
Update group counts with multiplier This is for handling atom counts on groups like (OH)2 :param groups: iterable of Group/Element :param multiplier: the number to multiply by
auxi/tools/chemistry/stoichiometry.py
def count_with_multiplier(groups, multiplier): """ Update group counts with multiplier This is for handling atom counts on groups like (OH)2 :param groups: iterable of Group/Element :param multiplier: the number to multiply by """ counts = collections.defaultdict(float) for group in group...
def count_with_multiplier(groups, multiplier): """ Update group counts with multiplier This is for handling atom counts on groups like (OH)2 :param groups: iterable of Group/Element :param multiplier: the number to multiply by """ counts = collections.defaultdict(float) for group in group...
[ "Update", "group", "counts", "with", "multiplier" ]
Ex-Mente/auxi.0
python
https://github.com/Ex-Mente/auxi.0/blob/2dcdae74154f136f8ca58289fe5b20772f215046/auxi/tools/chemistry/stoichiometry.py#L57-L70
[ "def", "count_with_multiplier", "(", "groups", ",", "multiplier", ")", ":", "counts", "=", "collections", ".", "defaultdict", "(", "float", ")", "for", "group", "in", "groups", ":", "for", "element", ",", "count", "in", "group", ".", "count", "(", ")", "...
2dcdae74154f136f8ca58289fe5b20772f215046
valid
amounts
Calculate the amounts from the specified compound masses. :param masses: [kg] dictionary, e.g. {'SiO2': 3.0, 'FeO': 1.5} :returns: [kmol] dictionary
auxi/tools/chemistry/stoichiometry.py
def amounts(masses): """ Calculate the amounts from the specified compound masses. :param masses: [kg] dictionary, e.g. {'SiO2': 3.0, 'FeO': 1.5} :returns: [kmol] dictionary """ return {compound: amount(compound, masses[compound]) for compound in masses.keys()}
def amounts(masses): """ Calculate the amounts from the specified compound masses. :param masses: [kg] dictionary, e.g. {'SiO2': 3.0, 'FeO': 1.5} :returns: [kmol] dictionary """ return {compound: amount(compound, masses[compound]) for compound in masses.keys()}
[ "Calculate", "the", "amounts", "from", "the", "specified", "compound", "masses", "." ]
Ex-Mente/auxi.0
python
https://github.com/Ex-Mente/auxi.0/blob/2dcdae74154f136f8ca58289fe5b20772f215046/auxi/tools/chemistry/stoichiometry.py#L202-L212
[ "def", "amounts", "(", "masses", ")", ":", "return", "{", "compound", ":", "amount", "(", "compound", ",", "masses", "[", "compound", "]", ")", "for", "compound", "in", "masses", ".", "keys", "(", ")", "}" ]
2dcdae74154f136f8ca58289fe5b20772f215046
valid
amount_fractions
Calculate the mole fractions from the specified compound masses. :param masses: [kg] dictionary, e.g. {'SiO2': 3.0, 'FeO': 1.5} :returns: [mole fractions] dictionary
auxi/tools/chemistry/stoichiometry.py
def amount_fractions(masses): """ Calculate the mole fractions from the specified compound masses. :param masses: [kg] dictionary, e.g. {'SiO2': 3.0, 'FeO': 1.5} :returns: [mole fractions] dictionary """ n = amounts(masses) n_total = sum(n.values()) return {compound: n[compound]/n_tot...
def amount_fractions(masses): """ Calculate the mole fractions from the specified compound masses. :param masses: [kg] dictionary, e.g. {'SiO2': 3.0, 'FeO': 1.5} :returns: [mole fractions] dictionary """ n = amounts(masses) n_total = sum(n.values()) return {compound: n[compound]/n_tot...
[ "Calculate", "the", "mole", "fractions", "from", "the", "specified", "compound", "masses", "." ]
Ex-Mente/auxi.0
python
https://github.com/Ex-Mente/auxi.0/blob/2dcdae74154f136f8ca58289fe5b20772f215046/auxi/tools/chemistry/stoichiometry.py#L215-L226
[ "def", "amount_fractions", "(", "masses", ")", ":", "n", "=", "amounts", "(", "masses", ")", "n_total", "=", "sum", "(", "n", ".", "values", "(", ")", ")", "return", "{", "compound", ":", "n", "[", "compound", "]", "/", "n_total", "for", "compound", ...
2dcdae74154f136f8ca58289fe5b20772f215046
valid
masses
Calculate the masses from the specified compound amounts. :param masses: [kmol] dictionary, e.g. {'SiO2': 3.0, 'FeO': 1.5} :returns: [kg] dictionary
auxi/tools/chemistry/stoichiometry.py
def masses(amounts): """ Calculate the masses from the specified compound amounts. :param masses: [kmol] dictionary, e.g. {'SiO2': 3.0, 'FeO': 1.5} :returns: [kg] dictionary """ return {compound: mass(compound, amounts[compound]) for compound in amounts.keys()}
def masses(amounts): """ Calculate the masses from the specified compound amounts. :param masses: [kmol] dictionary, e.g. {'SiO2': 3.0, 'FeO': 1.5} :returns: [kg] dictionary """ return {compound: mass(compound, amounts[compound]) for compound in amounts.keys()}
[ "Calculate", "the", "masses", "from", "the", "specified", "compound", "amounts", "." ]
Ex-Mente/auxi.0
python
https://github.com/Ex-Mente/auxi.0/blob/2dcdae74154f136f8ca58289fe5b20772f215046/auxi/tools/chemistry/stoichiometry.py#L243-L253
[ "def", "masses", "(", "amounts", ")", ":", "return", "{", "compound", ":", "mass", "(", "compound", ",", "amounts", "[", "compound", "]", ")", "for", "compound", "in", "amounts", ".", "keys", "(", ")", "}" ]
2dcdae74154f136f8ca58289fe5b20772f215046
valid
mass_fractions
Calculate the mole fractions from the specified compound amounts. :param amounts: [kmol] dictionary, e.g. {'SiO2': 3.0, 'FeO': 1.5} :returns: [mass fractions] dictionary
auxi/tools/chemistry/stoichiometry.py
def mass_fractions(amounts): """ Calculate the mole fractions from the specified compound amounts. :param amounts: [kmol] dictionary, e.g. {'SiO2': 3.0, 'FeO': 1.5} :returns: [mass fractions] dictionary """ m = masses(amounts) m_total = sum(m.values()) return {compound: m[compound]/m_...
def mass_fractions(amounts): """ Calculate the mole fractions from the specified compound amounts. :param amounts: [kmol] dictionary, e.g. {'SiO2': 3.0, 'FeO': 1.5} :returns: [mass fractions] dictionary """ m = masses(amounts) m_total = sum(m.values()) return {compound: m[compound]/m_...
[ "Calculate", "the", "mole", "fractions", "from", "the", "specified", "compound", "amounts", "." ]
Ex-Mente/auxi.0
python
https://github.com/Ex-Mente/auxi.0/blob/2dcdae74154f136f8ca58289fe5b20772f215046/auxi/tools/chemistry/stoichiometry.py#L256-L267
[ "def", "mass_fractions", "(", "amounts", ")", ":", "m", "=", "masses", "(", "amounts", ")", "m_total", "=", "sum", "(", "m", ".", "values", "(", ")", ")", "return", "{", "compound", ":", "m", "[", "compound", "]", "/", "m_total", "for", "compound", ...
2dcdae74154f136f8ca58289fe5b20772f215046
valid
convert_compound
Convert the specified mass of the source compound to the target using element as basis. :param mass: Mass of from_compound. [kg] :param source: Formula and phase of the original compound, e.g. 'Fe2O3[S1]'. :param target: Formula and phase of the target compound, e.g. 'Fe[S1]'. :param element:...
auxi/tools/chemistry/stoichiometry.py
def convert_compound(mass, source, target, element): """ Convert the specified mass of the source compound to the target using element as basis. :param mass: Mass of from_compound. [kg] :param source: Formula and phase of the original compound, e.g. 'Fe2O3[S1]'. :param target: Formula and...
def convert_compound(mass, source, target, element): """ Convert the specified mass of the source compound to the target using element as basis. :param mass: Mass of from_compound. [kg] :param source: Formula and phase of the original compound, e.g. 'Fe2O3[S1]'. :param target: Formula and...
[ "Convert", "the", "specified", "mass", "of", "the", "source", "compound", "to", "the", "target", "using", "element", "as", "basis", "." ]
Ex-Mente/auxi.0
python
https://github.com/Ex-Mente/auxi.0/blob/2dcdae74154f136f8ca58289fe5b20772f215046/auxi/tools/chemistry/stoichiometry.py#L270-L292
[ "def", "convert_compound", "(", "mass", ",", "source", ",", "target", ",", "element", ")", ":", "# Perform the conversion.", "target_mass_fraction", "=", "element_mass_fraction", "(", "target", ",", "element", ")", "if", "target_mass_fraction", "==", "0.0", ":", "...
2dcdae74154f136f8ca58289fe5b20772f215046
valid
element_mass_fraction
Determine the mass fraction of an element in a chemical compound. :param compound: Formula of the chemical compound, 'FeCr2O4'. :param element: Element, e.g. 'Cr'. :returns: Element mass fraction.
auxi/tools/chemistry/stoichiometry.py
def element_mass_fraction(compound, element): """ Determine the mass fraction of an element in a chemical compound. :param compound: Formula of the chemical compound, 'FeCr2O4'. :param element: Element, e.g. 'Cr'. :returns: Element mass fraction. """ coeff = stoichiometry_coefficient(comp...
def element_mass_fraction(compound, element): """ Determine the mass fraction of an element in a chemical compound. :param compound: Formula of the chemical compound, 'FeCr2O4'. :param element: Element, e.g. 'Cr'. :returns: Element mass fraction. """ coeff = stoichiometry_coefficient(comp...
[ "Determine", "the", "mass", "fraction", "of", "an", "element", "in", "a", "chemical", "compound", "." ]
Ex-Mente/auxi.0
python
https://github.com/Ex-Mente/auxi.0/blob/2dcdae74154f136f8ca58289fe5b20772f215046/auxi/tools/chemistry/stoichiometry.py#L295-L312
[ "def", "element_mass_fraction", "(", "compound", ",", "element", ")", ":", "coeff", "=", "stoichiometry_coefficient", "(", "compound", ",", "element", ")", "if", "coeff", "==", "0.0", ":", "return", "0.0", "formula_mass", "=", "molar_mass", "(", "compound", ")...
2dcdae74154f136f8ca58289fe5b20772f215046
valid
elements
Determine the set of elements present in a list of chemical compounds. The list of elements is sorted alphabetically. :param compounds: List of compound formulas and phases, e.g. ['Fe2O3[S1]', 'Al2O3[S1]']. :returns: List of elements.
auxi/tools/chemistry/stoichiometry.py
def elements(compounds): """ Determine the set of elements present in a list of chemical compounds. The list of elements is sorted alphabetically. :param compounds: List of compound formulas and phases, e.g. ['Fe2O3[S1]', 'Al2O3[S1]']. :returns: List of elements. """ elementlist = ...
def elements(compounds): """ Determine the set of elements present in a list of chemical compounds. The list of elements is sorted alphabetically. :param compounds: List of compound formulas and phases, e.g. ['Fe2O3[S1]', 'Al2O3[S1]']. :returns: List of elements. """ elementlist = ...
[ "Determine", "the", "set", "of", "elements", "present", "in", "a", "list", "of", "chemical", "compounds", "." ]
Ex-Mente/auxi.0
python
https://github.com/Ex-Mente/auxi.0/blob/2dcdae74154f136f8ca58289fe5b20772f215046/auxi/tools/chemistry/stoichiometry.py#L330-L344
[ "def", "elements", "(", "compounds", ")", ":", "elementlist", "=", "[", "parse_compound", "(", "compound", ")", ".", "count", "(", ")", ".", "keys", "(", ")", "for", "compound", "in", "compounds", "]", "return", "set", "(", ")", ".", "union", "(", "*...
2dcdae74154f136f8ca58289fe5b20772f215046
valid
molar_mass
Determine the molar mass of a chemical compound. The molar mass is usually the mass of one mole of the substance, but here it is the mass of 1000 moles, since the mass unit used in auxi is kg. :param compound: Formula of a chemical compound, e.g. 'Fe2O3'. :returns: Molar mass. [kg/kmol]
auxi/tools/chemistry/stoichiometry.py
def molar_mass(compound=''): """Determine the molar mass of a chemical compound. The molar mass is usually the mass of one mole of the substance, but here it is the mass of 1000 moles, since the mass unit used in auxi is kg. :param compound: Formula of a chemical compound, e.g. 'Fe2O3'. :returns:...
def molar_mass(compound=''): """Determine the molar mass of a chemical compound. The molar mass is usually the mass of one mole of the substance, but here it is the mass of 1000 moles, since the mass unit used in auxi is kg. :param compound: Formula of a chemical compound, e.g. 'Fe2O3'. :returns:...
[ "Determine", "the", "molar", "mass", "of", "a", "chemical", "compound", "." ]
Ex-Mente/auxi.0
python
https://github.com/Ex-Mente/auxi.0/blob/2dcdae74154f136f8ca58289fe5b20772f215046/auxi/tools/chemistry/stoichiometry.py#L347-L366
[ "def", "molar_mass", "(", "compound", "=", "''", ")", ":", "result", "=", "0.0", "if", "compound", "is", "None", "or", "len", "(", "compound", ")", "==", "0", ":", "return", "result", "compound", "=", "compound", ".", "strip", "(", ")", "parsed", "="...
2dcdae74154f136f8ca58289fe5b20772f215046
valid
stoichiometry_coefficient
Determine the stoichiometry coefficient of an element in a chemical compound. :param compound: Formula of a chemical compound, e.g. 'SiO2'. :param element: Element, e.g. 'Si'. :returns: Stoichiometry coefficient.
auxi/tools/chemistry/stoichiometry.py
def stoichiometry_coefficient(compound, element): """ Determine the stoichiometry coefficient of an element in a chemical compound. :param compound: Formula of a chemical compound, e.g. 'SiO2'. :param element: Element, e.g. 'Si'. :returns: Stoichiometry coefficient. """ stoichiometry...
def stoichiometry_coefficient(compound, element): """ Determine the stoichiometry coefficient of an element in a chemical compound. :param compound: Formula of a chemical compound, e.g. 'SiO2'. :param element: Element, e.g. 'Si'. :returns: Stoichiometry coefficient. """ stoichiometry...
[ "Determine", "the", "stoichiometry", "coefficient", "of", "an", "element", "in", "a", "chemical", "compound", "." ]
Ex-Mente/auxi.0
python
https://github.com/Ex-Mente/auxi.0/blob/2dcdae74154f136f8ca58289fe5b20772f215046/auxi/tools/chemistry/stoichiometry.py#L369-L382
[ "def", "stoichiometry_coefficient", "(", "compound", ",", "element", ")", ":", "stoichiometry", "=", "parse_compound", "(", "compound", ".", "strip", "(", ")", ")", ".", "count", "(", ")", "return", "stoichiometry", "[", "element", "]" ]
2dcdae74154f136f8ca58289fe5b20772f215046
valid
stoichiometry_coefficients
Determine the stoichiometry coefficients of the specified elements in the specified chemical compound. :param compound: Formula of a chemical compound, e.g. 'SiO2'. :param elements: List of elements, e.g. ['Si', 'O', 'C']. :returns: List of stoichiometry coefficients.
auxi/tools/chemistry/stoichiometry.py
def stoichiometry_coefficients(compound, elements): """ Determine the stoichiometry coefficients of the specified elements in the specified chemical compound. :param compound: Formula of a chemical compound, e.g. 'SiO2'. :param elements: List of elements, e.g. ['Si', 'O', 'C']. :returns: List ...
def stoichiometry_coefficients(compound, elements): """ Determine the stoichiometry coefficients of the specified elements in the specified chemical compound. :param compound: Formula of a chemical compound, e.g. 'SiO2'. :param elements: List of elements, e.g. ['Si', 'O', 'C']. :returns: List ...
[ "Determine", "the", "stoichiometry", "coefficients", "of", "the", "specified", "elements", "in", "the", "specified", "chemical", "compound", "." ]
Ex-Mente/auxi.0
python
https://github.com/Ex-Mente/auxi.0/blob/2dcdae74154f136f8ca58289fe5b20772f215046/auxi/tools/chemistry/stoichiometry.py#L385-L398
[ "def", "stoichiometry_coefficients", "(", "compound", ",", "elements", ")", ":", "stoichiometry", "=", "parse_compound", "(", "compound", ".", "strip", "(", ")", ")", ".", "count", "(", ")", "return", "[", "stoichiometry", "[", "element", "]", "for", "elemen...
2dcdae74154f136f8ca58289fe5b20772f215046
valid
Material.add_assay
Add an assay to the material. :param name: The name of the new assay. :param assay: A numpy array containing the size class mass fractions for the assay. The sequence of the assay's elements must correspond to the sequence of the material's size classes.
auxi/modelling/process/materials/psd.py
def add_assay(self, name, assay): """ Add an assay to the material. :param name: The name of the new assay. :param assay: A numpy array containing the size class mass fractions for the assay. The sequence of the assay's elements must correspond to the sequence of the...
def add_assay(self, name, assay): """ Add an assay to the material. :param name: The name of the new assay. :param assay: A numpy array containing the size class mass fractions for the assay. The sequence of the assay's elements must correspond to the sequence of the...
[ "Add", "an", "assay", "to", "the", "material", "." ]
Ex-Mente/auxi.0
python
https://github.com/Ex-Mente/auxi.0/blob/2dcdae74154f136f8ca58289fe5b20772f215046/auxi/modelling/process/materials/psd.py#L166-L185
[ "def", "add_assay", "(", "self", ",", "name", ",", "assay", ")", ":", "if", "not", "type", "(", "assay", ")", "is", "numpy", ".", "ndarray", ":", "raise", "Exception", "(", "\"Invalid assay. It must be a numpy array.\"", ")", "elif", "not", "assay", ".", "...
2dcdae74154f136f8ca58289fe5b20772f215046
valid
Material.create_package
Create a MaterialPackage based on the specified parameters. :param assay: The name of the assay based on which the package must be created. :param mass: [kg] The mass of the package. :param normalise: Indicates whether the assay must be normalised before creating the package...
auxi/modelling/process/materials/psd.py
def create_package(self, assay=None, mass=0.0, normalise=True): """ Create a MaterialPackage based on the specified parameters. :param assay: The name of the assay based on which the package must be created. :param mass: [kg] The mass of the package. :param normalise: ...
def create_package(self, assay=None, mass=0.0, normalise=True): """ Create a MaterialPackage based on the specified parameters. :param assay: The name of the assay based on which the package must be created. :param mass: [kg] The mass of the package. :param normalise: ...
[ "Create", "a", "MaterialPackage", "based", "on", "the", "specified", "parameters", "." ]
Ex-Mente/auxi.0
python
https://github.com/Ex-Mente/auxi.0/blob/2dcdae74154f136f8ca58289fe5b20772f215046/auxi/modelling/process/materials/psd.py#L198-L218
[ "def", "create_package", "(", "self", ",", "assay", "=", "None", ",", "mass", "=", "0.0", ",", "normalise", "=", "True", ")", ":", "if", "assay", "is", "None", ":", "return", "MaterialPackage", "(", "self", ",", "self", ".", "create_empty_assay", "(", ...
2dcdae74154f136f8ca58289fe5b20772f215046
valid
MaterialPackage.extract
Extract 'other' from self, modifying self and returning the extracted material as a new package. :param other: Can be one of the following: * float: A mass equal to other is extracted from self. Self is reduced by other and the extracted package is returned as a new p...
auxi/modelling/process/materials/psd.py
def extract(self, other): """ Extract 'other' from self, modifying self and returning the extracted material as a new package. :param other: Can be one of the following: * float: A mass equal to other is extracted from self. Self is reduced by other and the extrac...
def extract(self, other): """ Extract 'other' from self, modifying self and returning the extracted material as a new package. :param other: Can be one of the following: * float: A mass equal to other is extracted from self. Self is reduced by other and the extrac...
[ "Extract", "other", "from", "self", "modifying", "self", "and", "returning", "the", "extracted", "material", "as", "a", "new", "package", "." ]
Ex-Mente/auxi.0
python
https://github.com/Ex-Mente/auxi.0/blob/2dcdae74154f136f8ca58289fe5b20772f215046/auxi/modelling/process/materials/psd.py#L431-L493
[ "def", "extract", "(", "self", ",", "other", ")", ":", "# Extract the specified mass.", "if", "type", "(", "other", ")", "is", "float", "or", "type", "(", "other", ")", "is", "numpy", ".", "float64", "or", "type", "(", "other", ")", "is", "numpy", ".",...
2dcdae74154f136f8ca58289fe5b20772f215046
valid
MaterialPackage.add_to
Add another psd material package to this material package. :param other: The other material package.
auxi/modelling/process/materials/psd.py
def add_to(self, other): """ Add another psd material package to this material package. :param other: The other material package. """ # Add another package. if type(other) is MaterialPackage: # Packages of the same material. if self.material == o...
def add_to(self, other): """ Add another psd material package to this material package. :param other: The other material package. """ # Add another package. if type(other) is MaterialPackage: # Packages of the same material. if self.material == o...
[ "Add", "another", "psd", "material", "package", "to", "this", "material", "package", "." ]
Ex-Mente/auxi.0
python
https://github.com/Ex-Mente/auxi.0/blob/2dcdae74154f136f8ca58289fe5b20772f215046/auxi/modelling/process/materials/psd.py#L496-L534
[ "def", "add_to", "(", "self", ",", "other", ")", ":", "# Add another package.", "if", "type", "(", "other", ")", "is", "MaterialPackage", ":", "# Packages of the same material.", "if", "self", ".", "material", "==", "other", ".", "material", ":", "self", ".", ...
2dcdae74154f136f8ca58289fe5b20772f215046
valid
BasicActivity.run
Execute the activity at the current clock cycle. :param clock: The clock containing the current execution time and period information. :param generalLedger: The general ledger into which to create the transactions.
auxi/modelling/business/basic.py
def run(self, clock, generalLedger): """ Execute the activity at the current clock cycle. :param clock: The clock containing the current execution time and period information. :param generalLedger: The general ledger into which to create the transactions. """...
def run(self, clock, generalLedger): """ Execute the activity at the current clock cycle. :param clock: The clock containing the current execution time and period information. :param generalLedger: The general ledger into which to create the transactions. """...
[ "Execute", "the", "activity", "at", "the", "current", "clock", "cycle", "." ]
Ex-Mente/auxi.0
python
https://github.com/Ex-Mente/auxi.0/blob/2dcdae74154f136f8ca58289fe5b20772f215046/auxi/modelling/business/basic.py#L61-L81
[ "def", "run", "(", "self", ",", "clock", ",", "generalLedger", ")", ":", "if", "not", "self", ".", "_meet_execution_criteria", "(", "clock", ".", "timestep_ix", ")", ":", "return", "generalLedger", ".", "create_transaction", "(", "self", ".", "description", ...
2dcdae74154f136f8ca58289fe5b20772f215046
valid
BasicLoanActivity.prepare_to_run
Prepare the activity for execution. :param clock: The clock containing the execution start time and execution period information. :param period_count: The total amount of periods this activity will be requested to be run for.
auxi/modelling/business/basic.py
def prepare_to_run(self, clock, period_count): """ Prepare the activity for execution. :param clock: The clock containing the execution start time and execution period information. :param period_count: The total amount of periods this activity will be requested to be...
def prepare_to_run(self, clock, period_count): """ Prepare the activity for execution. :param clock: The clock containing the execution start time and execution period information. :param period_count: The total amount of periods this activity will be requested to be...
[ "Prepare", "the", "activity", "for", "execution", "." ]
Ex-Mente/auxi.0
python
https://github.com/Ex-Mente/auxi.0/blob/2dcdae74154f136f8ca58289fe5b20772f215046/auxi/modelling/business/basic.py#L223-L236
[ "def", "prepare_to_run", "(", "self", ",", "clock", ",", "period_count", ")", ":", "super", "(", "BasicLoanActivity", ",", "self", ")", ".", "prepare_to_run", "(", "clock", ",", "period_count", ")", "self", ".", "_months_executed", "=", "0", "self", ".", "...
2dcdae74154f136f8ca58289fe5b20772f215046
valid
BasicLoanActivity.run
Execute the activity at the current clock cycle. :param clock: The clock containing the current execution time and period information. :param generalLedger: The general ledger into which to create the transactions.
auxi/modelling/business/basic.py
def run(self, clock, generalLedger): """ Execute the activity at the current clock cycle. :param clock: The clock containing the current execution time and period information. :param generalLedger: The general ledger into which to create the transactions. """...
def run(self, clock, generalLedger): """ Execute the activity at the current clock cycle. :param clock: The clock containing the current execution time and period information. :param generalLedger: The general ledger into which to create the transactions. """...
[ "Execute", "the", "activity", "at", "the", "current", "clock", "cycle", "." ]
Ex-Mente/auxi.0
python
https://github.com/Ex-Mente/auxi.0/blob/2dcdae74154f136f8ca58289fe5b20772f215046/auxi/modelling/business/basic.py#L238-L289
[ "def", "run", "(", "self", ",", "clock", ",", "generalLedger", ")", ":", "if", "not", "self", ".", "_meet_execution_criteria", "(", "clock", ".", "timestep_ix", ")", ":", "return", "if", "self", ".", "description", "is", "None", ":", "tx_name", "=", "sel...
2dcdae74154f136f8ca58289fe5b20772f215046
valid
Clock.get_datetime_at_period_ix
Get the datetime at a given period. :param period: The index of the period. :returns: The datetime.
auxi/core/time.py
def get_datetime_at_period_ix(self, ix): """ Get the datetime at a given period. :param period: The index of the period. :returns: The datetime. """ if self.timestep_period_duration == TimePeriod.millisecond: return self.start_datetime + timedelta(milliseco...
def get_datetime_at_period_ix(self, ix): """ Get the datetime at a given period. :param period: The index of the period. :returns: The datetime. """ if self.timestep_period_duration == TimePeriod.millisecond: return self.start_datetime + timedelta(milliseco...
[ "Get", "the", "datetime", "at", "a", "given", "period", "." ]
Ex-Mente/auxi.0
python
https://github.com/Ex-Mente/auxi.0/blob/2dcdae74154f136f8ca58289fe5b20772f215046/auxi/core/time.py#L79-L103
[ "def", "get_datetime_at_period_ix", "(", "self", ",", "ix", ")", ":", "if", "self", ".", "timestep_period_duration", "==", "TimePeriod", ".", "millisecond", ":", "return", "self", ".", "start_datetime", "+", "timedelta", "(", "milliseconds", "=", "ix", ")", "e...
2dcdae74154f136f8ca58289fe5b20772f215046
valid
_get_default_data_path_
Calculate the default path in which thermochemical data is stored. :returns: Default path.
auxi/tools/chemistry/thermochemistry.py
def _get_default_data_path_(): """ Calculate the default path in which thermochemical data is stored. :returns: Default path. """ module_path = os.path.dirname(sys.modules[__name__].__file__) data_path = os.path.join(module_path, r'data/rao') data_path = os.path.abspath(data_path) retu...
def _get_default_data_path_(): """ Calculate the default path in which thermochemical data is stored. :returns: Default path. """ module_path = os.path.dirname(sys.modules[__name__].__file__) data_path = os.path.join(module_path, r'data/rao') data_path = os.path.abspath(data_path) retu...
[ "Calculate", "the", "default", "path", "in", "which", "thermochemical", "data", "is", "stored", "." ]
Ex-Mente/auxi.0
python
https://github.com/Ex-Mente/auxi.0/blob/2dcdae74154f136f8ca58289fe5b20772f215046/auxi/tools/chemistry/thermochemistry.py#L540-L550
[ "def", "_get_default_data_path_", "(", ")", ":", "module_path", "=", "os", ".", "path", ".", "dirname", "(", "sys", ".", "modules", "[", "__name__", "]", ".", "__file__", ")", "data_path", "=", "os", ".", "path", ".", "join", "(", "module_path", ",", "...
2dcdae74154f136f8ca58289fe5b20772f215046
valid
_read_compound_from_factsage_file_
Build a dictionary containing the factsage thermochemical data of a compound by reading the data from a file. :param file_name: Name of file to read the data from. :returns: Dictionary containing compound data.
auxi/tools/chemistry/thermochemistry.py
def _read_compound_from_factsage_file_(file_name): """ Build a dictionary containing the factsage thermochemical data of a compound by reading the data from a file. :param file_name: Name of file to read the data from. :returns: Dictionary containing compound data. """ with open(file_name...
def _read_compound_from_factsage_file_(file_name): """ Build a dictionary containing the factsage thermochemical data of a compound by reading the data from a file. :param file_name: Name of file to read the data from. :returns: Dictionary containing compound data. """ with open(file_name...
[ "Build", "a", "dictionary", "containing", "the", "factsage", "thermochemical", "data", "of", "a", "compound", "by", "reading", "the", "data", "from", "a", "file", "." ]
Ex-Mente/auxi.0
python
https://github.com/Ex-Mente/auxi.0/blob/2dcdae74154f136f8ca58289fe5b20772f215046/auxi/tools/chemistry/thermochemistry.py#L553-L653
[ "def", "_read_compound_from_factsage_file_", "(", "file_name", ")", ":", "with", "open", "(", "file_name", ")", "as", "f", ":", "lines", "=", "f", ".", "readlines", "(", ")", "compound", "=", "{", "'Formula'", ":", "lines", "[", "0", "]", ".", "split", ...
2dcdae74154f136f8ca58289fe5b20772f215046
valid
_split_compound_string_
Split a compound's combined formula and phase into separate strings for the formula and phase. :param compound_string: Formula and phase of a chemical compound, e.g. 'SiO2[S1]'. :returns: Formula of chemical compound. :returns: Phase of chemical compound.
auxi/tools/chemistry/thermochemistry.py
def _split_compound_string_(compound_string): """ Split a compound's combined formula and phase into separate strings for the formula and phase. :param compound_string: Formula and phase of a chemical compound, e.g. 'SiO2[S1]'. :returns: Formula of chemical compound. :returns: Phase of c...
def _split_compound_string_(compound_string): """ Split a compound's combined formula and phase into separate strings for the formula and phase. :param compound_string: Formula and phase of a chemical compound, e.g. 'SiO2[S1]'. :returns: Formula of chemical compound. :returns: Phase of c...
[ "Split", "a", "compound", "s", "combined", "formula", "and", "phase", "into", "separate", "strings", "for", "the", "formula", "and", "phase", "." ]
Ex-Mente/auxi.0
python
https://github.com/Ex-Mente/auxi.0/blob/2dcdae74154f136f8ca58289fe5b20772f215046/auxi/tools/chemistry/thermochemistry.py#L656-L671
[ "def", "_split_compound_string_", "(", "compound_string", ")", ":", "formula", "=", "compound_string", ".", "replace", "(", "']'", ",", "''", ")", ".", "split", "(", "'['", ")", "[", "0", "]", "phase", "=", "compound_string", ".", "replace", "(", "']'", ...
2dcdae74154f136f8ca58289fe5b20772f215046
valid
_finalise_result_
Convert the value to its final form by unit conversions and multiplying by mass. :param compound: Compound object. :param value: [J/mol] Value to be finalised. :param mass: [kg] Mass of compound. :returns: [kWh] Finalised value.
auxi/tools/chemistry/thermochemistry.py
def _finalise_result_(compound, value, mass): """ Convert the value to its final form by unit conversions and multiplying by mass. :param compound: Compound object. :param value: [J/mol] Value to be finalised. :param mass: [kg] Mass of compound. :returns: [kWh] Finalised value. """ ...
def _finalise_result_(compound, value, mass): """ Convert the value to its final form by unit conversions and multiplying by mass. :param compound: Compound object. :param value: [J/mol] Value to be finalised. :param mass: [kg] Mass of compound. :returns: [kWh] Finalised value. """ ...
[ "Convert", "the", "value", "to", "its", "final", "form", "by", "unit", "conversions", "and", "multiplying", "by", "mass", "." ]
Ex-Mente/auxi.0
python
https://github.com/Ex-Mente/auxi.0/blob/2dcdae74154f136f8ca58289fe5b20772f215046/auxi/tools/chemistry/thermochemistry.py#L674-L690
[ "def", "_finalise_result_", "(", "compound", ",", "value", ",", "mass", ")", ":", "result", "=", "value", "/", "3.6E6", "# J/x -> kWh/x", "result", "=", "result", "/", "compound", ".", "molar_mass", "# x/mol -> x/kg", "result", "=", "result", "*", "mass", "#...
2dcdae74154f136f8ca58289fe5b20772f215046
valid
write_compound_to_auxi_file
Writes a compound to an auxi file at the specified directory. :param dir: The directory. :param compound: The compound.
auxi/tools/chemistry/thermochemistry.py
def write_compound_to_auxi_file(directory, compound): """ Writes a compound to an auxi file at the specified directory. :param dir: The directory. :param compound: The compound. """ file_name = "Compound_" + compound.formula + ".json" with open(os.path.join(directory, file_name), 'w') as f...
def write_compound_to_auxi_file(directory, compound): """ Writes a compound to an auxi file at the specified directory. :param dir: The directory. :param compound: The compound. """ file_name = "Compound_" + compound.formula + ".json" with open(os.path.join(directory, file_name), 'w') as f...
[ "Writes", "a", "compound", "to", "an", "auxi", "file", "at", "the", "specified", "directory", "." ]
Ex-Mente/auxi.0
python
https://github.com/Ex-Mente/auxi.0/blob/2dcdae74154f136f8ca58289fe5b20772f215046/auxi/tools/chemistry/thermochemistry.py#L707-L717
[ "def", "write_compound_to_auxi_file", "(", "directory", ",", "compound", ")", ":", "file_name", "=", "\"Compound_\"", "+", "compound", ".", "formula", "+", "\".json\"", "with", "open", "(", "os", ".", "path", ".", "join", "(", "directory", ",", "file_name", ...
2dcdae74154f136f8ca58289fe5b20772f215046
valid
load_data_factsage
Load all the thermochemical data factsage files located at a path. :param path: Path at which the data files are located.
auxi/tools/chemistry/thermochemistry.py
def load_data_factsage(path=''): """ Load all the thermochemical data factsage files located at a path. :param path: Path at which the data files are located. """ compounds.clear() if path == '': path = default_data_path if not os.path.exists(path): warnings.warn('The spec...
def load_data_factsage(path=''): """ Load all the thermochemical data factsage files located at a path. :param path: Path at which the data files are located. """ compounds.clear() if path == '': path = default_data_path if not os.path.exists(path): warnings.warn('The spec...
[ "Load", "all", "the", "thermochemical", "data", "factsage", "files", "located", "at", "a", "path", "." ]
Ex-Mente/auxi.0
python
https://github.com/Ex-Mente/auxi.0/blob/2dcdae74154f136f8ca58289fe5b20772f215046/auxi/tools/chemistry/thermochemistry.py#L720-L739
[ "def", "load_data_factsage", "(", "path", "=", "''", ")", ":", "compounds", ".", "clear", "(", ")", "if", "path", "==", "''", ":", "path", "=", "default_data_path", "if", "not", "os", ".", "path", ".", "exists", "(", "path", ")", ":", "warnings", "."...
2dcdae74154f136f8ca58289fe5b20772f215046
valid
load_data_auxi
Load all the thermochemical data auxi files located at a path. :param path: Path at which the data files are located.
auxi/tools/chemistry/thermochemistry.py
def load_data_auxi(path=''): """ Load all the thermochemical data auxi files located at a path. :param path: Path at which the data files are located. """ compounds.clear() if path == '': path = default_data_path if not os.path.exists(path): warnings.warn('The specified da...
def load_data_auxi(path=''): """ Load all the thermochemical data auxi files located at a path. :param path: Path at which the data files are located. """ compounds.clear() if path == '': path = default_data_path if not os.path.exists(path): warnings.warn('The specified da...
[ "Load", "all", "the", "thermochemical", "data", "auxi", "files", "located", "at", "a", "path", "." ]
Ex-Mente/auxi.0
python
https://github.com/Ex-Mente/auxi.0/blob/2dcdae74154f136f8ca58289fe5b20772f215046/auxi/tools/chemistry/thermochemistry.py#L742-L761
[ "def", "load_data_auxi", "(", "path", "=", "''", ")", ":", "compounds", ".", "clear", "(", ")", "if", "path", "==", "''", ":", "path", "=", "default_data_path", "if", "not", "os", ".", "path", ".", "exists", "(", "path", ")", ":", "warnings", ".", ...
2dcdae74154f136f8ca58289fe5b20772f215046
valid
list_compounds
List all compounds that are currently loaded in the thermo module, and their phases.
auxi/tools/chemistry/thermochemistry.py
def list_compounds(): """ List all compounds that are currently loaded in the thermo module, and their phases. """ print('Compounds currently loaded:') for compound in sorted(compounds.keys()): phases = compounds[compound].get_phase_list() print('%s: %s' % (compound, ', '.join(p...
def list_compounds(): """ List all compounds that are currently loaded in the thermo module, and their phases. """ print('Compounds currently loaded:') for compound in sorted(compounds.keys()): phases = compounds[compound].get_phase_list() print('%s: %s' % (compound, ', '.join(p...
[ "List", "all", "compounds", "that", "are", "currently", "loaded", "in", "the", "thermo", "module", "and", "their", "phases", "." ]
Ex-Mente/auxi.0
python
https://github.com/Ex-Mente/auxi.0/blob/2dcdae74154f136f8ca58289fe5b20772f215046/auxi/tools/chemistry/thermochemistry.py#L764-L773
[ "def", "list_compounds", "(", ")", ":", "print", "(", "'Compounds currently loaded:'", ")", "for", "compound", "in", "sorted", "(", "compounds", ".", "keys", "(", ")", ")", ":", "phases", "=", "compounds", "[", "compound", "]", ".", "get_phase_list", "(", ...
2dcdae74154f136f8ca58289fe5b20772f215046
valid
Cp
Calculate the heat capacity of the compound for the specified temperature and mass. :param compound_string: Formula and phase of chemical compound, e.g. 'Fe2O3[S1]'. :param T: [°C] temperature :param mass: [kg] :returns: [kWh/K] Heat capacity.
auxi/tools/chemistry/thermochemistry.py
def Cp(compound_string, T, mass=1.0): """ Calculate the heat capacity of the compound for the specified temperature and mass. :param compound_string: Formula and phase of chemical compound, e.g. 'Fe2O3[S1]'. :param T: [°C] temperature :param mass: [kg] :returns: [kWh/K] Heat capacity...
def Cp(compound_string, T, mass=1.0): """ Calculate the heat capacity of the compound for the specified temperature and mass. :param compound_string: Formula and phase of chemical compound, e.g. 'Fe2O3[S1]'. :param T: [°C] temperature :param mass: [kg] :returns: [kWh/K] Heat capacity...
[ "Calculate", "the", "heat", "capacity", "of", "the", "compound", "for", "the", "specified", "temperature", "and", "mass", "." ]
Ex-Mente/auxi.0
python
https://github.com/Ex-Mente/auxi.0/blob/2dcdae74154f136f8ca58289fe5b20772f215046/auxi/tools/chemistry/thermochemistry.py#L798-L816
[ "def", "Cp", "(", "compound_string", ",", "T", ",", "mass", "=", "1.0", ")", ":", "formula", ",", "phase", "=", "_split_compound_string_", "(", "compound_string", ")", "TK", "=", "T", "+", "273.15", "compound", "=", "compounds", "[", "formula", "]", "res...
2dcdae74154f136f8ca58289fe5b20772f215046
valid
CpRecord.Cp
Calculate the heat capacity of the compound phase. :param T: [K] temperature :returns: [J/mol/K] Heat capacity.
auxi/tools/chemistry/thermochemistry.py
def Cp(self, T): """ Calculate the heat capacity of the compound phase. :param T: [K] temperature :returns: [J/mol/K] Heat capacity. """ result = 0.0 for c, e in zip(self._coefficients, self._exponents): result += c*T**e return result
def Cp(self, T): """ Calculate the heat capacity of the compound phase. :param T: [K] temperature :returns: [J/mol/K] Heat capacity. """ result = 0.0 for c, e in zip(self._coefficients, self._exponents): result += c*T**e return result
[ "Calculate", "the", "heat", "capacity", "of", "the", "compound", "phase", "." ]
Ex-Mente/auxi.0
python
https://github.com/Ex-Mente/auxi.0/blob/2dcdae74154f136f8ca58289fe5b20772f215046/auxi/tools/chemistry/thermochemistry.py#L77-L89
[ "def", "Cp", "(", "self", ",", "T", ")", ":", "result", "=", "0.0", "for", "c", ",", "e", "in", "zip", "(", "self", ".", "_coefficients", ",", "self", ".", "_exponents", ")", ":", "result", "+=", "c", "*", "T", "**", "e", "return", "result" ]
2dcdae74154f136f8ca58289fe5b20772f215046
valid
CpRecord.H
Calculate the portion of enthalpy of the compound phase covered by this Cp record. :param T: [K] temperature :returns: [J/mol] Enthalpy.
auxi/tools/chemistry/thermochemistry.py
def H(self, T): """ Calculate the portion of enthalpy of the compound phase covered by this Cp record. :param T: [K] temperature :returns: [J/mol] Enthalpy. """ result = 0.0 if T < self.Tmax: lT = T else: lT = self.Tmax ...
def H(self, T): """ Calculate the portion of enthalpy of the compound phase covered by this Cp record. :param T: [K] temperature :returns: [J/mol] Enthalpy. """ result = 0.0 if T < self.Tmax: lT = T else: lT = self.Tmax ...
[ "Calculate", "the", "portion", "of", "enthalpy", "of", "the", "compound", "phase", "covered", "by", "this", "Cp", "record", "." ]
Ex-Mente/auxi.0
python
https://github.com/Ex-Mente/auxi.0/blob/2dcdae74154f136f8ca58289fe5b20772f215046/auxi/tools/chemistry/thermochemistry.py#L91-L114
[ "def", "H", "(", "self", ",", "T", ")", ":", "result", "=", "0.0", "if", "T", "<", "self", ".", "Tmax", ":", "lT", "=", "T", "else", ":", "lT", "=", "self", ".", "Tmax", "Tref", "=", "self", ".", "Tmin", "for", "c", ",", "e", "in", "zip", ...
2dcdae74154f136f8ca58289fe5b20772f215046
valid
CpRecord.S
Calculate the portion of entropy of the compound phase covered by this Cp record. :param T: [K] temperature :returns: Entropy. [J/mol/K]
auxi/tools/chemistry/thermochemistry.py
def S(self, T): """ Calculate the portion of entropy of the compound phase covered by this Cp record. :param T: [K] temperature :returns: Entropy. [J/mol/K] """ result = 0.0 if T < self.Tmax: lT = T else: lT = self.Tmax ...
def S(self, T): """ Calculate the portion of entropy of the compound phase covered by this Cp record. :param T: [K] temperature :returns: Entropy. [J/mol/K] """ result = 0.0 if T < self.Tmax: lT = T else: lT = self.Tmax ...
[ "Calculate", "the", "portion", "of", "entropy", "of", "the", "compound", "phase", "covered", "by", "this", "Cp", "record", "." ]
Ex-Mente/auxi.0
python
https://github.com/Ex-Mente/auxi.0/blob/2dcdae74154f136f8ca58289fe5b20772f215046/auxi/tools/chemistry/thermochemistry.py#L116-L141
[ "def", "S", "(", "self", ",", "T", ")", ":", "result", "=", "0.0", "if", "T", "<", "self", ".", "Tmax", ":", "lT", "=", "T", "else", ":", "lT", "=", "self", ".", "Tmax", "Tref", "=", "self", ".", "Tmin", "for", "c", ",", "e", "in", "zip", ...
2dcdae74154f136f8ca58289fe5b20772f215046
valid
Phase.Cp
Calculate the heat capacity of the compound phase at the specified temperature. :param T: [K] temperature :returns: [J/mol/K] The heat capacity of the compound phase.
auxi/tools/chemistry/thermochemistry.py
def Cp(self, T): """ Calculate the heat capacity of the compound phase at the specified temperature. :param T: [K] temperature :returns: [J/mol/K] The heat capacity of the compound phase. """ # TODO: Fix str/float conversion for Tmax in sorted([float(TT...
def Cp(self, T): """ Calculate the heat capacity of the compound phase at the specified temperature. :param T: [K] temperature :returns: [J/mol/K] The heat capacity of the compound phase. """ # TODO: Fix str/float conversion for Tmax in sorted([float(TT...
[ "Calculate", "the", "heat", "capacity", "of", "the", "compound", "phase", "at", "the", "specified", "temperature", "." ]
Ex-Mente/auxi.0
python
https://github.com/Ex-Mente/auxi.0/blob/2dcdae74154f136f8ca58289fe5b20772f215046/auxi/tools/chemistry/thermochemistry.py#L229-L246
[ "def", "Cp", "(", "self", ",", "T", ")", ":", "# TODO: Fix str/float conversion", "for", "Tmax", "in", "sorted", "(", "[", "float", "(", "TT", ")", "for", "TT", "in", "self", ".", "_Cp_records", ".", "keys", "(", ")", "]", ")", ":", "if", "T", "<",...
2dcdae74154f136f8ca58289fe5b20772f215046
valid
Phase.Cp_mag
Calculate the phase's magnetic contribution to heat capacity at the specified temperature. :param T: [K] temperature :returns: [J/mol/K] The magnetic heat capacity of the compound phase. Dinsdale, A. T. (1991). SGTE data for pure elements. Calphad, 15(4), 317–425. http://doi.o...
auxi/tools/chemistry/thermochemistry.py
def Cp_mag(self, T): """ Calculate the phase's magnetic contribution to heat capacity at the specified temperature. :param T: [K] temperature :returns: [J/mol/K] The magnetic heat capacity of the compound phase. Dinsdale, A. T. (1991). SGTE data for pure elements. Calp...
def Cp_mag(self, T): """ Calculate the phase's magnetic contribution to heat capacity at the specified temperature. :param T: [K] temperature :returns: [J/mol/K] The magnetic heat capacity of the compound phase. Dinsdale, A. T. (1991). SGTE data for pure elements. Calp...
[ "Calculate", "the", "phase", "s", "magnetic", "contribution", "to", "heat", "capacity", "at", "the", "specified", "temperature", "." ]
Ex-Mente/auxi.0
python
https://github.com/Ex-Mente/auxi.0/blob/2dcdae74154f136f8ca58289fe5b20772f215046/auxi/tools/chemistry/thermochemistry.py#L248-L270
[ "def", "Cp_mag", "(", "self", ",", "T", ")", ":", "tau", "=", "T", "/", "self", ".", "Tc_mag", "if", "tau", "<=", "1.0", ":", "c", "=", "(", "self", ".", "_B_mag", "*", "(", "2", "*", "tau", "**", "3", "+", "2", "*", "tau", "**", "9", "/"...
2dcdae74154f136f8ca58289fe5b20772f215046
valid
Phase.H
Calculate the enthalpy of the compound phase at the specified temperature. :param T: [K] temperature :returns: [J/mol] The enthalpy of the compound phase.
auxi/tools/chemistry/thermochemistry.py
def H(self, T): """ Calculate the enthalpy of the compound phase at the specified temperature. :param T: [K] temperature :returns: [J/mol] The enthalpy of the compound phase. """ result = self.DHref for Tmax in sorted([float(TT) for TT in self._Cp_reco...
def H(self, T): """ Calculate the enthalpy of the compound phase at the specified temperature. :param T: [K] temperature :returns: [J/mol] The enthalpy of the compound phase. """ result = self.DHref for Tmax in sorted([float(TT) for TT in self._Cp_reco...
[ "Calculate", "the", "enthalpy", "of", "the", "compound", "phase", "at", "the", "specified", "temperature", "." ]
Ex-Mente/auxi.0
python
https://github.com/Ex-Mente/auxi.0/blob/2dcdae74154f136f8ca58289fe5b20772f215046/auxi/tools/chemistry/thermochemistry.py#L272-L293
[ "def", "H", "(", "self", ",", "T", ")", ":", "result", "=", "self", ".", "DHref", "for", "Tmax", "in", "sorted", "(", "[", "float", "(", "TT", ")", "for", "TT", "in", "self", ".", "_Cp_records", ".", "keys", "(", ")", "]", ")", ":", "result", ...
2dcdae74154f136f8ca58289fe5b20772f215046
valid
Phase.H_mag
Calculate the phase's magnetic contribution to enthalpy at the specified temperature. :param T: [K] temperature :returns: [J/mol] The magnetic enthalpy of the compound phase. Dinsdale, A. T. (1991). SGTE data for pure elements. Calphad, 15(4), 317–425. http://doi.org/10.1016/0...
auxi/tools/chemistry/thermochemistry.py
def H_mag(self, T): """ Calculate the phase's magnetic contribution to enthalpy at the specified temperature. :param T: [K] temperature :returns: [J/mol] The magnetic enthalpy of the compound phase. Dinsdale, A. T. (1991). SGTE data for pure elements. Calphad, 15(4), ...
def H_mag(self, T): """ Calculate the phase's magnetic contribution to enthalpy at the specified temperature. :param T: [K] temperature :returns: [J/mol] The magnetic enthalpy of the compound phase. Dinsdale, A. T. (1991). SGTE data for pure elements. Calphad, 15(4), ...
[ "Calculate", "the", "phase", "s", "magnetic", "contribution", "to", "enthalpy", "at", "the", "specified", "temperature", "." ]
Ex-Mente/auxi.0
python
https://github.com/Ex-Mente/auxi.0/blob/2dcdae74154f136f8ca58289fe5b20772f215046/auxi/tools/chemistry/thermochemistry.py#L295-L316
[ "def", "H_mag", "(", "self", ",", "T", ")", ":", "tau", "=", "T", "/", "self", ".", "Tc_mag", "if", "tau", "<=", "1.0", ":", "h", "=", "(", "-", "self", ".", "_A_mag", "/", "tau", "+", "self", ".", "_B_mag", "*", "(", "tau", "**", "3", "/",...
2dcdae74154f136f8ca58289fe5b20772f215046
valid
Phase.S
Calculate the entropy of the compound phase at the specified temperature. :param T: [K] temperature :returns: [J/mol/K] The entropy of the compound phase.
auxi/tools/chemistry/thermochemistry.py
def S(self, T): """ Calculate the entropy of the compound phase at the specified temperature. :param T: [K] temperature :returns: [J/mol/K] The entropy of the compound phase. """ result = self.Sref for Tmax in sorted([float(TT) for TT in self._Cp_recor...
def S(self, T): """ Calculate the entropy of the compound phase at the specified temperature. :param T: [K] temperature :returns: [J/mol/K] The entropy of the compound phase. """ result = self.Sref for Tmax in sorted([float(TT) for TT in self._Cp_recor...
[ "Calculate", "the", "entropy", "of", "the", "compound", "phase", "at", "the", "specified", "temperature", "." ]
Ex-Mente/auxi.0
python
https://github.com/Ex-Mente/auxi.0/blob/2dcdae74154f136f8ca58289fe5b20772f215046/auxi/tools/chemistry/thermochemistry.py#L318-L339
[ "def", "S", "(", "self", ",", "T", ")", ":", "result", "=", "self", ".", "Sref", "for", "Tmax", "in", "sorted", "(", "[", "float", "(", "TT", ")", "for", "TT", "in", "self", ".", "_Cp_records", ".", "keys", "(", ")", "]", ")", ":", "result", ...
2dcdae74154f136f8ca58289fe5b20772f215046
valid
Phase.S_mag
Calculate the phase's magnetic contribution to entropy at the specified temperature. :param T: [K] temperature :returns: [J/mol/K] The magnetic entropy of the compound phase. Dinsdale, A. T. (1991). SGTE data for pure elements. Calphad, 15(4), 317–425. http://doi.org/10.1016/0...
auxi/tools/chemistry/thermochemistry.py
def S_mag(self, T): """ Calculate the phase's magnetic contribution to entropy at the specified temperature. :param T: [K] temperature :returns: [J/mol/K] The magnetic entropy of the compound phase. Dinsdale, A. T. (1991). SGTE data for pure elements. Calphad, 15(4), ...
def S_mag(self, T): """ Calculate the phase's magnetic contribution to entropy at the specified temperature. :param T: [K] temperature :returns: [J/mol/K] The magnetic entropy of the compound phase. Dinsdale, A. T. (1991). SGTE data for pure elements. Calphad, 15(4), ...
[ "Calculate", "the", "phase", "s", "magnetic", "contribution", "to", "entropy", "at", "the", "specified", "temperature", "." ]
Ex-Mente/auxi.0
python
https://github.com/Ex-Mente/auxi.0/blob/2dcdae74154f136f8ca58289fe5b20772f215046/auxi/tools/chemistry/thermochemistry.py#L341-L362
[ "def", "S_mag", "(", "self", ",", "T", ")", ":", "tau", "=", "T", "/", "self", ".", "Tc_mag", "if", "tau", "<=", "1.0", ":", "s", "=", "1", "-", "(", "self", ".", "_B_mag", "*", "(", "2", "*", "tau", "**", "3", "/", "3", "+", "2", "*", ...
2dcdae74154f136f8ca58289fe5b20772f215046
valid
Phase.G
Calculate the heat capacity of the compound phase at the specified temperature. :param T: [K] temperature :returns: [J/mol] The Gibbs free energy of the compound phase.
auxi/tools/chemistry/thermochemistry.py
def G(self, T): """Calculate the heat capacity of the compound phase at the specified temperature. :param T: [K] temperature :returns: [J/mol] The Gibbs free energy of the compound phase. """ h = self.DHref s = self.Sref for Tmax in sorted([float(TT) f...
def G(self, T): """Calculate the heat capacity of the compound phase at the specified temperature. :param T: [K] temperature :returns: [J/mol] The Gibbs free energy of the compound phase. """ h = self.DHref s = self.Sref for Tmax in sorted([float(TT) f...
[ "Calculate", "the", "heat", "capacity", "of", "the", "compound", "phase", "at", "the", "specified", "temperature", "." ]
Ex-Mente/auxi.0
python
https://github.com/Ex-Mente/auxi.0/blob/2dcdae74154f136f8ca58289fe5b20772f215046/auxi/tools/chemistry/thermochemistry.py#L364-L387
[ "def", "G", "(", "self", ",", "T", ")", ":", "h", "=", "self", ".", "DHref", "s", "=", "self", ".", "Sref", "for", "Tmax", "in", "sorted", "(", "[", "float", "(", "TT", ")", "for", "TT", "in", "self", ".", "_Cp_records", ".", "keys", "(", ")"...
2dcdae74154f136f8ca58289fe5b20772f215046
valid
Phase.G_mag
Calculate the phase's magnetic contribution to Gibbs energy at the specified temperature. :param T: [K] temperature :returns: [J/mol] The magnetic Gibbs energy of the compound phase. Dinsdale, A. T. (1991). SGTE data for pure elements. Calphad, 15(4), 317–425. http://doi.org/1...
auxi/tools/chemistry/thermochemistry.py
def G_mag(self, T): """ Calculate the phase's magnetic contribution to Gibbs energy at the specified temperature. :param T: [K] temperature :returns: [J/mol] The magnetic Gibbs energy of the compound phase. Dinsdale, A. T. (1991). SGTE data for pure elements. Calphad, ...
def G_mag(self, T): """ Calculate the phase's magnetic contribution to Gibbs energy at the specified temperature. :param T: [K] temperature :returns: [J/mol] The magnetic Gibbs energy of the compound phase. Dinsdale, A. T. (1991). SGTE data for pure elements. Calphad, ...
[ "Calculate", "the", "phase", "s", "magnetic", "contribution", "to", "Gibbs", "energy", "at", "the", "specified", "temperature", "." ]
Ex-Mente/auxi.0
python
https://github.com/Ex-Mente/auxi.0/blob/2dcdae74154f136f8ca58289fe5b20772f215046/auxi/tools/chemistry/thermochemistry.py#L389-L411
[ "def", "G_mag", "(", "self", ",", "T", ")", ":", "tau", "=", "T", "/", "self", ".", "Tc_mag", "if", "tau", "<=", "1.0", ":", "g", "=", "1", "-", "(", "self", ".", "_A_mag", "/", "tau", "+", "self", ".", "_B_mag", "*", "(", "tau", "**", "3",...
2dcdae74154f136f8ca58289fe5b20772f215046
valid
Compound.Cp
Calculate the heat capacity of a phase of the compound at a specified temperature. :param phase: A phase of the compound, e.g. 'S', 'L', 'G'. :param T: [K] temperature :returns: [J/mol/K] Heat capacity.
auxi/tools/chemistry/thermochemistry.py
def Cp(self, phase, T): """ Calculate the heat capacity of a phase of the compound at a specified temperature. :param phase: A phase of the compound, e.g. 'S', 'L', 'G'. :param T: [K] temperature :returns: [J/mol/K] Heat capacity. """ if phase not in se...
def Cp(self, phase, T): """ Calculate the heat capacity of a phase of the compound at a specified temperature. :param phase: A phase of the compound, e.g. 'S', 'L', 'G'. :param T: [K] temperature :returns: [J/mol/K] Heat capacity. """ if phase not in se...
[ "Calculate", "the", "heat", "capacity", "of", "a", "phase", "of", "the", "compound", "at", "a", "specified", "temperature", "." ]
Ex-Mente/auxi.0
python
https://github.com/Ex-Mente/auxi.0/blob/2dcdae74154f136f8ca58289fe5b20772f215046/auxi/tools/chemistry/thermochemistry.py#L471-L486
[ "def", "Cp", "(", "self", ",", "phase", ",", "T", ")", ":", "if", "phase", "not", "in", "self", ".", "_phases", ":", "raise", "Exception", "(", "\"The phase '%s' was not found in compound '%s'.\"", "%", "(", "phase", ",", "self", ".", "formula", ")", ")", ...
2dcdae74154f136f8ca58289fe5b20772f215046
valid
Compound.H
Calculate the enthalpy of a phase of the compound at a specified temperature. :param phase: A phase of the compound, e.g. 'S', 'L', 'G'. :param T: [K] temperature :returns: [J/mol] Enthalpy.
auxi/tools/chemistry/thermochemistry.py
def H(self, phase, T): """ Calculate the enthalpy of a phase of the compound at a specified temperature. :param phase: A phase of the compound, e.g. 'S', 'L', 'G'. :param T: [K] temperature :returns: [J/mol] Enthalpy. """ try: return self._p...
def H(self, phase, T): """ Calculate the enthalpy of a phase of the compound at a specified temperature. :param phase: A phase of the compound, e.g. 'S', 'L', 'G'. :param T: [K] temperature :returns: [J/mol] Enthalpy. """ try: return self._p...
[ "Calculate", "the", "enthalpy", "of", "a", "phase", "of", "the", "compound", "at", "a", "specified", "temperature", "." ]
Ex-Mente/auxi.0
python
https://github.com/Ex-Mente/auxi.0/blob/2dcdae74154f136f8ca58289fe5b20772f215046/auxi/tools/chemistry/thermochemistry.py#L488-L503
[ "def", "H", "(", "self", ",", "phase", ",", "T", ")", ":", "try", ":", "return", "self", ".", "_phases", "[", "phase", "]", ".", "H", "(", "T", ")", "except", "KeyError", ":", "raise", "Exception", "(", "\"The phase '{}' was not found in compound '{}'.\"",...
2dcdae74154f136f8ca58289fe5b20772f215046
valid
_create_polynomial_model
Create a polynomial model to describe the specified property based on the specified data set, and save it to a .json file. :param name: material name. :param symbol: property symbol. :param degree: polynomial degree. :param ds: the source data set. :param dss: dictionary of all datasets.
auxi/tools/materialphysicalproperties/gases.py
def _create_polynomial_model( name: str, symbol: str, degree: int, ds: DataSet, dss: dict): """ Create a polynomial model to describe the specified property based on the specified data set, and save it to a .json file. :param name: material name. :param symbol: property symbol. ...
def _create_polynomial_model( name: str, symbol: str, degree: int, ds: DataSet, dss: dict): """ Create a polynomial model to describe the specified property based on the specified data set, and save it to a .json file. :param name: material name. :param symbol: property symbol. ...
[ "Create", "a", "polynomial", "model", "to", "describe", "the", "specified", "property", "based", "on", "the", "specified", "data", "set", "and", "save", "it", "to", "a", ".", "json", "file", "." ]
Ex-Mente/auxi.0
python
https://github.com/Ex-Mente/auxi.0/blob/2dcdae74154f136f8ca58289fe5b20772f215046/auxi/tools/materialphysicalproperties/gases.py#L61-L81
[ "def", "_create_polynomial_model", "(", "name", ":", "str", ",", "symbol", ":", "str", ",", "degree", ":", "int", ",", "ds", ":", "DataSet", ",", "dss", ":", "dict", ")", ":", "ds_name", "=", "ds", ".", "name", ".", "split", "(", "\".\"", ")", "[",...
2dcdae74154f136f8ca58289fe5b20772f215046
valid
_create_air
Create a dictionary of datasets and a material object for air. :return: (Material, {str, DataSet})
auxi/tools/materialphysicalproperties/gases.py
def _create_air(): """ Create a dictionary of datasets and a material object for air. :return: (Material, {str, DataSet}) """ name = "Air" namel = name.lower() mm = 28.9645 # g/mol ds_dict = _create_ds_dict([ "dataset-air-lienhard2015", "dataset-air-lienhard2018"]) ...
def _create_air(): """ Create a dictionary of datasets and a material object for air. :return: (Material, {str, DataSet}) """ name = "Air" namel = name.lower() mm = 28.9645 # g/mol ds_dict = _create_ds_dict([ "dataset-air-lienhard2015", "dataset-air-lienhard2018"]) ...
[ "Create", "a", "dictionary", "of", "datasets", "and", "a", "material", "object", "for", "air", "." ]
Ex-Mente/auxi.0
python
https://github.com/Ex-Mente/auxi.0/blob/2dcdae74154f136f8ca58289fe5b20772f215046/auxi/tools/materialphysicalproperties/gases.py#L84-L120
[ "def", "_create_air", "(", ")", ":", "name", "=", "\"Air\"", "namel", "=", "name", ".", "lower", "(", ")", "mm", "=", "28.9645", "# g/mol", "ds_dict", "=", "_create_ds_dict", "(", "[", "\"dataset-air-lienhard2015\"", ",", "\"dataset-air-lienhard2018\"", "]", "...
2dcdae74154f136f8ca58289fe5b20772f215046
valid
WilkeMuTx.calculate
Calculate dynamic viscosity at the specified temperature and composition: :param T: [K] temperature :param x: [mole fraction] composition dictionary , e.g. {'CO': 0.25, 'CO2': 0.25, 'N2': 0.25, 'O2': 0.25} :returns: [Pa.s] dynamic viscosity The **state parameter cont...
auxi/tools/materialphysicalproperties/gases.py
def calculate(self, **state): """ Calculate dynamic viscosity at the specified temperature and composition: :param T: [K] temperature :param x: [mole fraction] composition dictionary , e.g. {'CO': 0.25, 'CO2': 0.25, 'N2': 0.25, 'O2': 0.25} :returns: [Pa.s] dyn...
def calculate(self, **state): """ Calculate dynamic viscosity at the specified temperature and composition: :param T: [K] temperature :param x: [mole fraction] composition dictionary , e.g. {'CO': 0.25, 'CO2': 0.25, 'N2': 0.25, 'O2': 0.25} :returns: [Pa.s] dyn...
[ "Calculate", "dynamic", "viscosity", "at", "the", "specified", "temperature", "and", "composition", ":" ]
Ex-Mente/auxi.0
python
https://github.com/Ex-Mente/auxi.0/blob/2dcdae74154f136f8ca58289fe5b20772f215046/auxi/tools/materialphysicalproperties/gases.py#L422-L469
[ "def", "calculate", "(", "self", ",", "*", "*", "state", ")", ":", "def", "phi", "(", "i", ",", "j", ",", "mu_i", ",", "mu_j", ")", ":", "M_i", "=", "M", "(", "i", ")", "M_j", "=", "M", "(", "j", ")", "result", "=", "(", "1.0", "+", "(", ...
2dcdae74154f136f8ca58289fe5b20772f215046
valid
HerningZippererMuTx.calculate
Calculate dynamic viscosity at the specified temperature and composition: :param T: [K] temperature :param x: [mole fraction] composition dictionary , e.g. {'CO': 0.25, 'CO2': 0.25, 'N2': 0.25, 'O2': 0.25} :returns: [Pa.s] dynamic viscosity The **state parameter cont...
auxi/tools/materialphysicalproperties/gases.py
def calculate(self, **state): """ Calculate dynamic viscosity at the specified temperature and composition: :param T: [K] temperature :param x: [mole fraction] composition dictionary , e.g. {'CO': 0.25, 'CO2': 0.25, 'N2': 0.25, 'O2': 0.25} :returns: [Pa.s] dyn...
def calculate(self, **state): """ Calculate dynamic viscosity at the specified temperature and composition: :param T: [K] temperature :param x: [mole fraction] composition dictionary , e.g. {'CO': 0.25, 'CO2': 0.25, 'N2': 0.25, 'O2': 0.25} :returns: [Pa.s] dyn...
[ "Calculate", "dynamic", "viscosity", "at", "the", "specified", "temperature", "and", "composition", ":" ]
Ex-Mente/auxi.0
python
https://github.com/Ex-Mente/auxi.0/blob/2dcdae74154f136f8ca58289fe5b20772f215046/auxi/tools/materialphysicalproperties/gases.py#L520-L552
[ "def", "calculate", "(", "self", ",", "*", "*", "state", ")", ":", "T", "=", "state", "[", "'T'", "]", "x", "=", "state", "[", "'x'", "]", "# normalise mole fractions", "x_total", "=", "sum", "(", "[", "x", "for", "compound", ",", "x", "in", "x", ...
2dcdae74154f136f8ca58289fe5b20772f215046
valid
Report.render
Render the report in the specified format :param format: The format. The default format is to print the report to the console. :returns: If the format was set to 'string' then a string representation of the report is returned.
auxi/core/reporting.py
def render(self, format=ReportFormat.printout): """ Render the report in the specified format :param format: The format. The default format is to print the report to the console. :returns: If the format was set to 'string' then a string representation of the report ...
def render(self, format=ReportFormat.printout): """ Render the report in the specified format :param format: The format. The default format is to print the report to the console. :returns: If the format was set to 'string' then a string representation of the report ...
[ "Render", "the", "report", "in", "the", "specified", "format" ]
Ex-Mente/auxi.0
python
https://github.com/Ex-Mente/auxi.0/blob/2dcdae74154f136f8ca58289fe5b20772f215046/auxi/core/reporting.py#L53-L81
[ "def", "render", "(", "self", ",", "format", "=", "ReportFormat", ".", "printout", ")", ":", "table", "=", "self", ".", "_generate_table_", "(", ")", "if", "format", "==", "ReportFormat", ".", "printout", ":", "print", "(", "tabulate", "(", "table", ",",...
2dcdae74154f136f8ca58289fe5b20772f215046
valid
rgb_to_hex
Convert an RGB color representation to a HEX color representation. (r, g, b) :: r -> [0, 255] g -> [0, 255] b -> [0, 255] :param rgb: A tuple of three numeric values corresponding to the red, green, and blue value. :return: HEX representation of the input RGB value. :...
colorutils/convert.py
def rgb_to_hex(rgb): """ Convert an RGB color representation to a HEX color representation. (r, g, b) :: r -> [0, 255] g -> [0, 255] b -> [0, 255] :param rgb: A tuple of three numeric values corresponding to the red, green, and blue value. :return: HEX representat...
def rgb_to_hex(rgb): """ Convert an RGB color representation to a HEX color representation. (r, g, b) :: r -> [0, 255] g -> [0, 255] b -> [0, 255] :param rgb: A tuple of three numeric values corresponding to the red, green, and blue value. :return: HEX representat...
[ "Convert", "an", "RGB", "color", "representation", "to", "a", "HEX", "color", "representation", "." ]
edaniszewski/colorutils
python
https://github.com/edaniszewski/colorutils/blob/bdff54091cb5d62aa8628ce39bc09abd40fb8dd0/colorutils/convert.py#L16-L29
[ "def", "rgb_to_hex", "(", "rgb", ")", ":", "r", ",", "g", ",", "b", "=", "rgb", "return", "\"#{0}{1}{2}\"", ".", "format", "(", "hex", "(", "int", "(", "r", ")", ")", "[", "2", ":", "]", ".", "zfill", "(", "2", ")", ",", "hex", "(", "int", ...
bdff54091cb5d62aa8628ce39bc09abd40fb8dd0
valid
rgb_to_yiq
Convert an RGB color representation to a YIQ color representation. (r, g, b) :: r -> [0, 255] g -> [0, 255] b -> [0, 255] :param rgb: A tuple of three numeric values corresponding to the red, green, and blue value. :return: YIQ representation of the input RGB value. :...
colorutils/convert.py
def rgb_to_yiq(rgb): """ Convert an RGB color representation to a YIQ color representation. (r, g, b) :: r -> [0, 255] g -> [0, 255] b -> [0, 255] :param rgb: A tuple of three numeric values corresponding to the red, green, and blue value. :return: YIQ representat...
def rgb_to_yiq(rgb): """ Convert an RGB color representation to a YIQ color representation. (r, g, b) :: r -> [0, 255] g -> [0, 255] b -> [0, 255] :param rgb: A tuple of three numeric values corresponding to the red, green, and blue value. :return: YIQ representat...
[ "Convert", "an", "RGB", "color", "representation", "to", "a", "YIQ", "color", "representation", "." ]
edaniszewski/colorutils
python
https://github.com/edaniszewski/colorutils/blob/bdff54091cb5d62aa8628ce39bc09abd40fb8dd0/colorutils/convert.py#L50-L66
[ "def", "rgb_to_yiq", "(", "rgb", ")", ":", "r", ",", "g", ",", "b", "=", "rgb", "[", "0", "]", "/", "255", ",", "rgb", "[", "1", "]", "/", "255", ",", "rgb", "[", "2", "]", "/", "255", "y", "=", "(", "0.299", "*", "r", ")", "+", "(", ...
bdff54091cb5d62aa8628ce39bc09abd40fb8dd0
valid
rgb_to_hsv
Convert an RGB color representation to an HSV color representation. (r, g, b) :: r -> [0, 255] g -> [0, 255] b -> [0, 255] :param rgb: A tuple of three numeric values corresponding to the red, green, and blue value. :return: HSV representation of the input RGB value. ...
colorutils/convert.py
def rgb_to_hsv(rgb): """ Convert an RGB color representation to an HSV color representation. (r, g, b) :: r -> [0, 255] g -> [0, 255] b -> [0, 255] :param rgb: A tuple of three numeric values corresponding to the red, green, and blue value. :return: HSV representa...
def rgb_to_hsv(rgb): """ Convert an RGB color representation to an HSV color representation. (r, g, b) :: r -> [0, 255] g -> [0, 255] b -> [0, 255] :param rgb: A tuple of three numeric values corresponding to the red, green, and blue value. :return: HSV representa...
[ "Convert", "an", "RGB", "color", "representation", "to", "an", "HSV", "color", "representation", "." ]
edaniszewski/colorutils
python
https://github.com/edaniszewski/colorutils/blob/bdff54091cb5d62aa8628ce39bc09abd40fb8dd0/colorutils/convert.py#L69-L104
[ "def", "rgb_to_hsv", "(", "rgb", ")", ":", "r", ",", "g", ",", "b", "=", "rgb", "[", "0", "]", "/", "255", ",", "rgb", "[", "1", "]", "/", "255", ",", "rgb", "[", "2", "]", "/", "255", "_min", "=", "min", "(", "r", ",", "g", ",", "b", ...
bdff54091cb5d62aa8628ce39bc09abd40fb8dd0
valid
hex_to_rgb
Convert a HEX color representation to an RGB color representation. hex :: hex -> [000000, FFFFFF] :param _hex: The 3- or 6-char hexadecimal string representing the color value. :return: RGB representation of the input HEX value. :rtype: tuple
colorutils/convert.py
def hex_to_rgb(_hex): """ Convert a HEX color representation to an RGB color representation. hex :: hex -> [000000, FFFFFF] :param _hex: The 3- or 6-char hexadecimal string representing the color value. :return: RGB representation of the input HEX value. :rtype: tuple """ _hex = _hex.s...
def hex_to_rgb(_hex): """ Convert a HEX color representation to an RGB color representation. hex :: hex -> [000000, FFFFFF] :param _hex: The 3- or 6-char hexadecimal string representing the color value. :return: RGB representation of the input HEX value. :rtype: tuple """ _hex = _hex.s...
[ "Convert", "a", "HEX", "color", "representation", "to", "an", "RGB", "color", "representation", "." ]
edaniszewski/colorutils
python
https://github.com/edaniszewski/colorutils/blob/bdff54091cb5d62aa8628ce39bc09abd40fb8dd0/colorutils/convert.py#L112-L132
[ "def", "hex_to_rgb", "(", "_hex", ")", ":", "_hex", "=", "_hex", ".", "strip", "(", "'#'", ")", "n", "=", "len", "(", "_hex", ")", "//", "3", "if", "len", "(", "_hex", ")", "==", "3", ":", "r", "=", "int", "(", "_hex", "[", ":", "n", "]", ...
bdff54091cb5d62aa8628ce39bc09abd40fb8dd0
valid
yiq_to_rgb
Convert a YIQ color representation to an RGB color representation. (y, i, q) :: y -> [0, 1] i -> [-0.5957, 0.5957] q -> [-0.5226, 0.5226] :param yiq: A tuple of three numeric values corresponding to the luma and chrominance. :return: RGB representation of the input YIQ va...
colorutils/convert.py
def yiq_to_rgb(yiq): """ Convert a YIQ color representation to an RGB color representation. (y, i, q) :: y -> [0, 1] i -> [-0.5957, 0.5957] q -> [-0.5226, 0.5226] :param yiq: A tuple of three numeric values corresponding to the luma and chrominance. :return: RGB r...
def yiq_to_rgb(yiq): """ Convert a YIQ color representation to an RGB color representation. (y, i, q) :: y -> [0, 1] i -> [-0.5957, 0.5957] q -> [-0.5226, 0.5226] :param yiq: A tuple of three numeric values corresponding to the luma and chrominance. :return: RGB r...
[ "Convert", "a", "YIQ", "color", "representation", "to", "an", "RGB", "color", "representation", "." ]
edaniszewski/colorutils
python
https://github.com/edaniszewski/colorutils/blob/bdff54091cb5d62aa8628ce39bc09abd40fb8dd0/colorutils/convert.py#L249-L270
[ "def", "yiq_to_rgb", "(", "yiq", ")", ":", "y", ",", "i", ",", "q", "=", "yiq", "r", "=", "y", "+", "(", "0.956", "*", "i", ")", "+", "(", "0.621", "*", "q", ")", "g", "=", "y", "-", "(", "0.272", "*", "i", ")", "-", "(", "0.647", "*", ...
bdff54091cb5d62aa8628ce39bc09abd40fb8dd0
valid
hsv_to_rgb
Convert an HSV color representation to an RGB color representation. (h, s, v) :: h -> [0, 360) s -> [0, 1] v -> [0, 1] :param hsv: A tuple of three numeric values corresponding to the hue, saturation, and value. :return: RGB representation of the input HSV value. :rty...
colorutils/convert.py
def hsv_to_rgb(hsv): """ Convert an HSV color representation to an RGB color representation. (h, s, v) :: h -> [0, 360) s -> [0, 1] v -> [0, 1] :param hsv: A tuple of three numeric values corresponding to the hue, saturation, and value. :return: RGB representation...
def hsv_to_rgb(hsv): """ Convert an HSV color representation to an RGB color representation. (h, s, v) :: h -> [0, 360) s -> [0, 1] v -> [0, 1] :param hsv: A tuple of three numeric values corresponding to the hue, saturation, and value. :return: RGB representation...
[ "Convert", "an", "HSV", "color", "representation", "to", "an", "RGB", "color", "representation", "." ]
edaniszewski/colorutils
python
https://github.com/edaniszewski/colorutils/blob/bdff54091cb5d62aa8628ce39bc09abd40fb8dd0/colorutils/convert.py#L323-L357
[ "def", "hsv_to_rgb", "(", "hsv", ")", ":", "h", ",", "s", ",", "v", "=", "hsv", "c", "=", "v", "*", "s", "h", "/=", "60", "x", "=", "c", "*", "(", "1", "-", "abs", "(", "(", "h", "%", "2", ")", "-", "1", ")", ")", "m", "=", "v", "-"...
bdff54091cb5d62aa8628ce39bc09abd40fb8dd0
valid
offset_random_rgb
Given a seed color, generate a specified number of random colors (1 color by default) determined by a randomized offset from the seed. :param seed: :param amount: :return:
colorutils/colorutils.py
def offset_random_rgb(seed, amount=1): """ Given a seed color, generate a specified number of random colors (1 color by default) determined by a randomized offset from the seed. :param seed: :param amount: :return: """ r, g, b = seed results = [] for _ in range(amount): ...
def offset_random_rgb(seed, amount=1): """ Given a seed color, generate a specified number of random colors (1 color by default) determined by a randomized offset from the seed. :param seed: :param amount: :return: """ r, g, b = seed results = [] for _ in range(amount): ...
[ "Given", "a", "seed", "color", "generate", "a", "specified", "number", "of", "random", "colors", "(", "1", "color", "by", "default", ")", "determined", "by", "a", "randomized", "offset", "from", "the", "seed", "." ]
edaniszewski/colorutils
python
https://github.com/edaniszewski/colorutils/blob/bdff54091cb5d62aa8628ce39bc09abd40fb8dd0/colorutils/colorutils.py#L230-L248
[ "def", "offset_random_rgb", "(", "seed", ",", "amount", "=", "1", ")", ":", "r", ",", "g", ",", "b", "=", "seed", "results", "=", "[", "]", "for", "_", "in", "range", "(", "amount", ")", ":", "base_val", "=", "(", "(", "r", "+", "g", "+", "b"...
bdff54091cb5d62aa8628ce39bc09abd40fb8dd0
valid
color_run
Given a start color, end color, and a number of steps, returns a list of colors which represent a 'scale' between the start and end color. :param start_color: The color starting the run :param end_color: The color ending the run :param step_count: The number of colors to have between the start and end ...
colorutils/colorutils.py
def color_run(start_color, end_color, step_count, inclusive=True, to_color=True): """ Given a start color, end color, and a number of steps, returns a list of colors which represent a 'scale' between the start and end color. :param start_color: The color starting the run :param end_color: The color...
def color_run(start_color, end_color, step_count, inclusive=True, to_color=True): """ Given a start color, end color, and a number of steps, returns a list of colors which represent a 'scale' between the start and end color. :param start_color: The color starting the run :param end_color: The color...
[ "Given", "a", "start", "color", "end", "color", "and", "a", "number", "of", "steps", "returns", "a", "list", "of", "colors", "which", "represent", "a", "scale", "between", "the", "start", "and", "end", "color", "." ]
edaniszewski/colorutils
python
https://github.com/edaniszewski/colorutils/blob/bdff54091cb5d62aa8628ce39bc09abd40fb8dd0/colorutils/colorutils.py#L280-L309
[ "def", "color_run", "(", "start_color", ",", "end_color", ",", "step_count", ",", "inclusive", "=", "True", ",", "to_color", "=", "True", ")", ":", "if", "isinstance", "(", "start_color", ",", "Color", ")", ":", "start_color", "=", "start_color", ".", "rgb...
bdff54091cb5d62aa8628ce39bc09abd40fb8dd0
valid
text_color
Given a background color in the form of an RGB 3-tuple, returns the color the text should be (defaulting to white and black) for best readability. The light (white) and dark (black) defaults can be overridden to return preferred values. :param background: :param dark_color: :param light_color: ...
colorutils/colorutils.py
def text_color(background, dark_color=rgb_min, light_color=rgb_max): """ Given a background color in the form of an RGB 3-tuple, returns the color the text should be (defaulting to white and black) for best readability. The light (white) and dark (black) defaults can be overridden to return preferred va...
def text_color(background, dark_color=rgb_min, light_color=rgb_max): """ Given a background color in the form of an RGB 3-tuple, returns the color the text should be (defaulting to white and black) for best readability. The light (white) and dark (black) defaults can be overridden to return preferred va...
[ "Given", "a", "background", "color", "in", "the", "form", "of", "an", "RGB", "3", "-", "tuple", "returns", "the", "color", "the", "text", "should", "be", "(", "defaulting", "to", "white", "and", "black", ")", "for", "best", "readability", ".", "The", "...
edaniszewski/colorutils
python
https://github.com/edaniszewski/colorutils/blob/bdff54091cb5d62aa8628ce39bc09abd40fb8dd0/colorutils/colorutils.py#L312-L324
[ "def", "text_color", "(", "background", ",", "dark_color", "=", "rgb_min", ",", "light_color", "=", "rgb_max", ")", ":", "max_y", "=", "rgb_to_yiq", "(", "rgb_max", ")", "[", "0", "]", "return", "light_color", "if", "rgb_to_yiq", "(", "background", ")", "[...
bdff54091cb5d62aa8628ce39bc09abd40fb8dd0
valid
minify_hex
Given a HEX value, tries to reduce it from a 6 character hex (e.g. #ffffff) to a 3 character hex (e.g. #fff). If the HEX value is unable to be minified, returns the 6 character HEX representation. :param _hex: :return:
colorutils/colorutils.py
def minify_hex(_hex): """ Given a HEX value, tries to reduce it from a 6 character hex (e.g. #ffffff) to a 3 character hex (e.g. #fff). If the HEX value is unable to be minified, returns the 6 character HEX representation. :param _hex: :return: """ size = len(_hex.strip('#')) if size ==...
def minify_hex(_hex): """ Given a HEX value, tries to reduce it from a 6 character hex (e.g. #ffffff) to a 3 character hex (e.g. #fff). If the HEX value is unable to be minified, returns the 6 character HEX representation. :param _hex: :return: """ size = len(_hex.strip('#')) if size ==...
[ "Given", "a", "HEX", "value", "tries", "to", "reduce", "it", "from", "a", "6", "character", "hex", "(", "e", ".", "g", ".", "#ffffff", ")", "to", "a", "3", "character", "hex", "(", "e", ".", "g", ".", "#fff", ")", ".", "If", "the", "HEX", "valu...
edaniszewski/colorutils
python
https://github.com/edaniszewski/colorutils/blob/bdff54091cb5d62aa8628ce39bc09abd40fb8dd0/colorutils/colorutils.py#L327-L344
[ "def", "minify_hex", "(", "_hex", ")", ":", "size", "=", "len", "(", "_hex", ".", "strip", "(", "'#'", ")", ")", "if", "size", "==", "3", ":", "return", "_hex", "elif", "size", "==", "6", ":", "if", "_hex", "[", "1", "]", "==", "_hex", "[", "...
bdff54091cb5d62aa8628ce39bc09abd40fb8dd0
valid
ForgiveDB.get
Get key value, return default if key doesn't exist
forgive/db.py
def get(self, key, default=None): """ Get key value, return default if key doesn't exist """ if self.in_memory: return self._memory_db.get(key, default) else: db = self._read_file() return db.get(key, default)
def get(self, key, default=None): """ Get key value, return default if key doesn't exist """ if self.in_memory: return self._memory_db.get(key, default) else: db = self._read_file() return db.get(key, default)
[ "Get", "key", "value", "return", "default", "if", "key", "doesn", "t", "exist" ]
hui-z/ForgiveDB
python
https://github.com/hui-z/ForgiveDB/blob/cc94e87377a230e23a8e55dffe07047c34c33d6e/forgive/db.py#L29-L35
[ "def", "get", "(", "self", ",", "key", ",", "default", "=", "None", ")", ":", "if", "self", ".", "in_memory", ":", "return", "self", ".", "_memory_db", ".", "get", "(", "key", ",", "default", ")", "else", ":", "db", "=", "self", ".", "_read_file", ...
cc94e87377a230e23a8e55dffe07047c34c33d6e
valid
ForgiveDB.set
Set key value
forgive/db.py
def set(self, key, value): """ Set key value """ if self.in_memory: self._memory_db[key] = value else: db = self._read_file() db[key] = value with open(self.db_path, 'w') as f: f.write(json.dumps(db, ensure_ascii=False, indent=2))
def set(self, key, value): """ Set key value """ if self.in_memory: self._memory_db[key] = value else: db = self._read_file() db[key] = value with open(self.db_path, 'w') as f: f.write(json.dumps(db, ensure_ascii=False, indent=2))
[ "Set", "key", "value" ]
hui-z/ForgiveDB
python
https://github.com/hui-z/ForgiveDB/blob/cc94e87377a230e23a8e55dffe07047c34c33d6e/forgive/db.py#L37-L45
[ "def", "set", "(", "self", ",", "key", ",", "value", ")", ":", "if", "self", ".", "in_memory", ":", "self", ".", "_memory_db", "[", "key", "]", "=", "value", "else", ":", "db", "=", "self", ".", "_read_file", "(", ")", "db", "[", "key", "]", "=...
cc94e87377a230e23a8e55dffe07047c34c33d6e
valid
ForgiveDB._read_file
read the db file content :rtype: dict
forgive/db.py
def _read_file(self): """ read the db file content :rtype: dict """ if not os.path.exists(self.db_path): return {} with open(self.db_path, 'r') as f: content = f.read() return json.loads(content)
def _read_file(self): """ read the db file content :rtype: dict """ if not os.path.exists(self.db_path): return {} with open(self.db_path, 'r') as f: content = f.read() return json.loads(content)
[ "read", "the", "db", "file", "content", ":", "rtype", ":", "dict" ]
hui-z/ForgiveDB
python
https://github.com/hui-z/ForgiveDB/blob/cc94e87377a230e23a8e55dffe07047c34c33d6e/forgive/db.py#L47-L56
[ "def", "_read_file", "(", "self", ")", ":", "if", "not", "os", ".", "path", ".", "exists", "(", "self", ".", "db_path", ")", ":", "return", "{", "}", "with", "open", "(", "self", ".", "db_path", ",", "'r'", ")", "as", "f", ":", "content", "=", ...
cc94e87377a230e23a8e55dffe07047c34c33d6e
valid
attrs_sqlalchemy
A class decorator that adds ``__repr__``, ``__eq__``, ``__cmp__``, and ``__hash__`` methods according to the fields defined on the SQLAlchemy model class.
attrs_sqlalchemy.py
def attrs_sqlalchemy(maybe_cls=None): """ A class decorator that adds ``__repr__``, ``__eq__``, ``__cmp__``, and ``__hash__`` methods according to the fields defined on the SQLAlchemy model class. """ def wrap(cls): warnings.warn(UserWarning('attrs_sqlalchemy is deprecated')) th...
def attrs_sqlalchemy(maybe_cls=None): """ A class decorator that adds ``__repr__``, ``__eq__``, ``__cmp__``, and ``__hash__`` methods according to the fields defined on the SQLAlchemy model class. """ def wrap(cls): warnings.warn(UserWarning('attrs_sqlalchemy is deprecated')) th...
[ "A", "class", "decorator", "that", "adds", "__repr__", "__eq__", "__cmp__", "and", "__hash__", "methods", "according", "to", "the", "fields", "defined", "on", "the", "SQLAlchemy", "model", "class", "." ]
GoodRx/attrs_sqlalchemy
python
https://github.com/GoodRx/attrs_sqlalchemy/blob/907eb269f1a0a1e4647ede5b44eb7a9210d954ae/attrs_sqlalchemy.py#L29-L69
[ "def", "attrs_sqlalchemy", "(", "maybe_cls", "=", "None", ")", ":", "def", "wrap", "(", "cls", ")", ":", "warnings", ".", "warn", "(", "UserWarning", "(", "'attrs_sqlalchemy is deprecated'", ")", ")", "these", "=", "{", "name", ":", "attr", ".", "ib", "(...
907eb269f1a0a1e4647ede5b44eb7a9210d954ae
valid
paginate_link_tag
Create an A-HREF tag that points to another page usable in paginate.
ps_alchemy/paginator.py
def paginate_link_tag(item): """ Create an A-HREF tag that points to another page usable in paginate. """ a_tag = Page.default_link_tag(item) if item['type'] == 'current_page': return make_html_tag('li', a_tag, **{'class': 'blue white-text'}) return make_html_tag('li', a_tag)
def paginate_link_tag(item): """ Create an A-HREF tag that points to another page usable in paginate. """ a_tag = Page.default_link_tag(item) if item['type'] == 'current_page': return make_html_tag('li', a_tag, **{'class': 'blue white-text'}) return make_html_tag('li', a_tag)
[ "Create", "an", "A", "-", "HREF", "tag", "that", "points", "to", "another", "page", "usable", "in", "paginate", "." ]
sacrud/ps_alchemy
python
https://github.com/sacrud/ps_alchemy/blob/4f042329eb4643bf26fa2540df277fa94c5265ec/ps_alchemy/paginator.py#L15-L22
[ "def", "paginate_link_tag", "(", "item", ")", ":", "a_tag", "=", "Page", ".", "default_link_tag", "(", "item", ")", "if", "item", "[", "'type'", "]", "==", "'current_page'", ":", "return", "make_html_tag", "(", "'li'", ",", "a_tag", ",", "*", "*", "{", ...
4f042329eb4643bf26fa2540df277fa94c5265ec
valid
EcoNetApiInterface.set_state
Set a devices state.
src/pyeconet/api.py
def set_state(_id, body): """ Set a devices state. """ url = DEVICE_URL % _id if "mode" in body: url = MODES_URL % _id arequest = requests.put(url, headers=HEADERS, data=json.dumps(body)) status_code = str(arequest.status_code) if status_code !...
def set_state(_id, body): """ Set a devices state. """ url = DEVICE_URL % _id if "mode" in body: url = MODES_URL % _id arequest = requests.put(url, headers=HEADERS, data=json.dumps(body)) status_code = str(arequest.status_code) if status_code !...
[ "Set", "a", "devices", "state", "." ]
w1ll1am23/pyeconet
python
https://github.com/w1ll1am23/pyeconet/blob/05abf965f67c7445355508a38f11992d13adac4f/src/pyeconet/api.py#L45-L56
[ "def", "set_state", "(", "_id", ",", "body", ")", ":", "url", "=", "DEVICE_URL", "%", "_id", "if", "\"mode\"", "in", "body", ":", "url", "=", "MODES_URL", "%", "_id", "arequest", "=", "requests", ".", "put", "(", "url", ",", "headers", "=", "HEADERS"...
05abf965f67c7445355508a38f11992d13adac4f
valid
EcoNetApiInterface.get_modes
Pull a water heater's modes from the API.
src/pyeconet/api.py
def get_modes(_id): """ Pull a water heater's modes from the API. """ url = MODES_URL % _id arequest = requests.get(url, headers=HEADERS) status_code = str(arequest.status_code) if status_code == '401': _LOGGER.error("Token expired.") retur...
def get_modes(_id): """ Pull a water heater's modes from the API. """ url = MODES_URL % _id arequest = requests.get(url, headers=HEADERS) status_code = str(arequest.status_code) if status_code == '401': _LOGGER.error("Token expired.") retur...
[ "Pull", "a", "water", "heater", "s", "modes", "from", "the", "API", "." ]
w1ll1am23/pyeconet
python
https://github.com/w1ll1am23/pyeconet/blob/05abf965f67c7445355508a38f11992d13adac4f/src/pyeconet/api.py#L59-L69
[ "def", "get_modes", "(", "_id", ")", ":", "url", "=", "MODES_URL", "%", "_id", "arequest", "=", "requests", ".", "get", "(", "url", ",", "headers", "=", "HEADERS", ")", "status_code", "=", "str", "(", "arequest", ".", "status_code", ")", "if", "status_...
05abf965f67c7445355508a38f11992d13adac4f
valid
EcoNetApiInterface.get_usage
Pull a water heater's usage report from the API.
src/pyeconet/api.py
def get_usage(_id): """ Pull a water heater's usage report from the API. """ url = USAGE_URL % _id arequest = requests.get(url, headers=HEADERS) status_code = str(arequest.status_code) if status_code == '401': _LOGGER.error("Token expired.") ...
def get_usage(_id): """ Pull a water heater's usage report from the API. """ url = USAGE_URL % _id arequest = requests.get(url, headers=HEADERS) status_code = str(arequest.status_code) if status_code == '401': _LOGGER.error("Token expired.") ...
[ "Pull", "a", "water", "heater", "s", "usage", "report", "from", "the", "API", "." ]
w1ll1am23/pyeconet
python
https://github.com/w1ll1am23/pyeconet/blob/05abf965f67c7445355508a38f11992d13adac4f/src/pyeconet/api.py#L72-L86
[ "def", "get_usage", "(", "_id", ")", ":", "url", "=", "USAGE_URL", "%", "_id", "arequest", "=", "requests", ".", "get", "(", "url", ",", "headers", "=", "HEADERS", ")", "status_code", "=", "str", "(", "arequest", ".", "status_code", ")", "if", "status_...
05abf965f67c7445355508a38f11992d13adac4f
valid
EcoNetApiInterface.get_device
Pull a device from the API.
src/pyeconet/api.py
def get_device(_id): """ Pull a device from the API. """ url = DEVICE_URL % _id arequest = requests.get(url, headers=HEADERS) status_code = str(arequest.status_code) if status_code == '401': _LOGGER.error("Token expired.") return False ...
def get_device(_id): """ Pull a device from the API. """ url = DEVICE_URL % _id arequest = requests.get(url, headers=HEADERS) status_code = str(arequest.status_code) if status_code == '401': _LOGGER.error("Token expired.") return False ...
[ "Pull", "a", "device", "from", "the", "API", "." ]
w1ll1am23/pyeconet
python
https://github.com/w1ll1am23/pyeconet/blob/05abf965f67c7445355508a38f11992d13adac4f/src/pyeconet/api.py#L89-L99
[ "def", "get_device", "(", "_id", ")", ":", "url", "=", "DEVICE_URL", "%", "_id", "arequest", "=", "requests", ".", "get", "(", "url", ",", "headers", "=", "HEADERS", ")", "status_code", "=", "str", "(", "arequest", ".", "status_code", ")", "if", "statu...
05abf965f67c7445355508a38f11992d13adac4f
valid
EcoNetApiInterface.get_locations
Pull the accounts locations.
src/pyeconet/api.py
def get_locations(): """ Pull the accounts locations. """ arequest = requests.get(LOCATIONS_URL, headers=HEADERS) status_code = str(arequest.status_code) if status_code == '401': _LOGGER.error("Token expired.") return False return arequest....
def get_locations(): """ Pull the accounts locations. """ arequest = requests.get(LOCATIONS_URL, headers=HEADERS) status_code = str(arequest.status_code) if status_code == '401': _LOGGER.error("Token expired.") return False return arequest....
[ "Pull", "the", "accounts", "locations", "." ]
w1ll1am23/pyeconet
python
https://github.com/w1ll1am23/pyeconet/blob/05abf965f67c7445355508a38f11992d13adac4f/src/pyeconet/api.py#L102-L111
[ "def", "get_locations", "(", ")", ":", "arequest", "=", "requests", ".", "get", "(", "LOCATIONS_URL", ",", "headers", "=", "HEADERS", ")", "status_code", "=", "str", "(", "arequest", ".", "status_code", ")", "if", "status_code", "==", "'401'", ":", "_LOGGE...
05abf965f67c7445355508a38f11992d13adac4f
valid
EcoNetApiInterface.get_vacations
Pull the accounts vacations.
src/pyeconet/api.py
def get_vacations(): """ Pull the accounts vacations. """ arequest = requests.get(VACATIONS_URL, headers=HEADERS) status_code = str(arequest.status_code) if status_code == '401': _LOGGER.error("Token expired.") return False return arequest....
def get_vacations(): """ Pull the accounts vacations. """ arequest = requests.get(VACATIONS_URL, headers=HEADERS) status_code = str(arequest.status_code) if status_code == '401': _LOGGER.error("Token expired.") return False return arequest....
[ "Pull", "the", "accounts", "vacations", "." ]
w1ll1am23/pyeconet
python
https://github.com/w1ll1am23/pyeconet/blob/05abf965f67c7445355508a38f11992d13adac4f/src/pyeconet/api.py#L114-L123
[ "def", "get_vacations", "(", ")", ":", "arequest", "=", "requests", ".", "get", "(", "VACATIONS_URL", ",", "headers", "=", "HEADERS", ")", "status_code", "=", "str", "(", "arequest", ".", "status_code", ")", "if", "status_code", "==", "'401'", ":", "_LOGGE...
05abf965f67c7445355508a38f11992d13adac4f
valid
EcoNetApiInterface.create_vacation
Create a vacation.
src/pyeconet/api.py
def create_vacation(body): """ Create a vacation. """ arequest = requests.post(VACATIONS_URL, headers=HEADERS, data=json.dumps(body)) status_code = str(arequest.status_code) if status_code != '200': _LOGGER.error("Failed to create vacation. " + status_code) ...
def create_vacation(body): """ Create a vacation. """ arequest = requests.post(VACATIONS_URL, headers=HEADERS, data=json.dumps(body)) status_code = str(arequest.status_code) if status_code != '200': _LOGGER.error("Failed to create vacation. " + status_code) ...
[ "Create", "a", "vacation", "." ]
w1ll1am23/pyeconet
python
https://github.com/w1ll1am23/pyeconet/blob/05abf965f67c7445355508a38f11992d13adac4f/src/pyeconet/api.py#L126-L136
[ "def", "create_vacation", "(", "body", ")", ":", "arequest", "=", "requests", ".", "post", "(", "VACATIONS_URL", ",", "headers", "=", "HEADERS", ",", "data", "=", "json", ".", "dumps", "(", "body", ")", ")", "status_code", "=", "str", "(", "arequest", ...
05abf965f67c7445355508a38f11992d13adac4f
valid
EcoNetApiInterface.delete_vacation
Delete a vacation by ID.
src/pyeconet/api.py
def delete_vacation(_id): """ Delete a vacation by ID. """ arequest = requests.delete(VACATIONS_URL + "/" + _id, headers=HEADERS) status_code = str(arequest.status_code) if status_code != '202': _LOGGER.error("Failed to delete vacation. " + status_code) ...
def delete_vacation(_id): """ Delete a vacation by ID. """ arequest = requests.delete(VACATIONS_URL + "/" + _id, headers=HEADERS) status_code = str(arequest.status_code) if status_code != '202': _LOGGER.error("Failed to delete vacation. " + status_code) ...
[ "Delete", "a", "vacation", "by", "ID", "." ]
w1ll1am23/pyeconet
python
https://github.com/w1ll1am23/pyeconet/blob/05abf965f67c7445355508a38f11992d13adac4f/src/pyeconet/api.py#L139-L148
[ "def", "delete_vacation", "(", "_id", ")", ":", "arequest", "=", "requests", ".", "delete", "(", "VACATIONS_URL", "+", "\"/\"", "+", "_id", ",", "headers", "=", "HEADERS", ")", "status_code", "=", "str", "(", "arequest", ".", "status_code", ")", "if", "s...
05abf965f67c7445355508a38f11992d13adac4f
valid
EcoNetApiInterface._authenticate
Authenticate with the API and return an authentication token.
src/pyeconet/api.py
def _authenticate(self): """ Authenticate with the API and return an authentication token. """ auth_url = BASE_URL + "/auth/token" payload = {'username': self.email, 'password': self.password, 'grant_type': 'password'} arequest = requests.post(auth_url, data=payload, head...
def _authenticate(self): """ Authenticate with the API and return an authentication token. """ auth_url = BASE_URL + "/auth/token" payload = {'username': self.email, 'password': self.password, 'grant_type': 'password'} arequest = requests.post(auth_url, data=payload, head...
[ "Authenticate", "with", "the", "API", "and", "return", "an", "authentication", "token", "." ]
w1ll1am23/pyeconet
python
https://github.com/w1ll1am23/pyeconet/blob/05abf965f67c7445355508a38f11992d13adac4f/src/pyeconet/api.py#L150-L169
[ "def", "_authenticate", "(", "self", ")", ":", "auth_url", "=", "BASE_URL", "+", "\"/auth/token\"", "payload", "=", "{", "'username'", ":", "self", ".", "email", ",", "'password'", ":", "self", ".", "password", ",", "'grant_type'", ":", "'password'", "}", ...
05abf965f67c7445355508a38f11992d13adac4f
valid
PyEcoNet.get_water_heaters
Return a list of water heater devices. Parses the response from the locations endpoint in to a pyeconet.WaterHeater.
src/pyeconet/api.py
def get_water_heaters(self): """ Return a list of water heater devices. Parses the response from the locations endpoint in to a pyeconet.WaterHeater. """ water_heaters = [] for location in self.locations: _location_id = location.get("id") for devi...
def get_water_heaters(self): """ Return a list of water heater devices. Parses the response from the locations endpoint in to a pyeconet.WaterHeater. """ water_heaters = [] for location in self.locations: _location_id = location.get("id") for devi...
[ "Return", "a", "list", "of", "water", "heater", "devices", "." ]
w1ll1am23/pyeconet
python
https://github.com/w1ll1am23/pyeconet/blob/05abf965f67c7445355508a38f11992d13adac4f/src/pyeconet/api.py#L183-L207
[ "def", "get_water_heaters", "(", "self", ")", ":", "water_heaters", "=", "[", "]", "for", "location", "in", "self", ".", "locations", ":", "_location_id", "=", "location", ".", "get", "(", "\"id\"", ")", "for", "device", "in", "location", ".", "get", "("...
05abf965f67c7445355508a38f11992d13adac4f
valid
Uber.get_products
Get a list of all Uber products based on latitude and longitude coordinates. :param latitude: Latitude for which product list is required. :param longitude: Longitude for which product list is required. :return: JSON
uberpy/uber.py
def get_products(self, latitude, longitude): """ Get a list of all Uber products based on latitude and longitude coordinates. :param latitude: Latitude for which product list is required. :param longitude: Longitude for which product list is required. :return: JSON """ ...
def get_products(self, latitude, longitude): """ Get a list of all Uber products based on latitude and longitude coordinates. :param latitude: Latitude for which product list is required. :param longitude: Longitude for which product list is required. :return: JSON """ ...
[ "Get", "a", "list", "of", "all", "Uber", "products", "based", "on", "latitude", "and", "longitude", "coordinates", ".", ":", "param", "latitude", ":", "Latitude", "for", "which", "product", "list", "is", "required", ".", ":", "param", "longitude", ":", "Lo...
vivangkumar/uberpy
python
https://github.com/vivangkumar/uberpy/blob/abc62ccb5399424eb5690f12c392ab2dbd9d96e0/uberpy/uber.py#L24-L37
[ "def", "get_products", "(", "self", ",", "latitude", ",", "longitude", ")", ":", "endpoint", "=", "'products'", "query_parameters", "=", "{", "'latitude'", ":", "latitude", ",", "'longitude'", ":", "longitude", "}", "return", "self", ".", "get_json", "(", "e...
abc62ccb5399424eb5690f12c392ab2dbd9d96e0
valid
Uber.get_price_estimate
Returns the fare estimate based on two sets of coordinates. :param start_latitude: Starting latitude or latitude of pickup address. :param start_longitude: Starting longitude or longitude of pickup address. :param end_latitude: Ending latitude or latitude of destination address. :param e...
uberpy/uber.py
def get_price_estimate(self, start_latitude, start_longitude, end_latitude, end_longitude): """ Returns the fare estimate based on two sets of coordinates. :param start_latitude: Starting latitude or latitude of pickup address. :param start_longitude: Starting longitude or longitude of p...
def get_price_estimate(self, start_latitude, start_longitude, end_latitude, end_longitude): """ Returns the fare estimate based on two sets of coordinates. :param start_latitude: Starting latitude or latitude of pickup address. :param start_longitude: Starting longitude or longitude of p...
[ "Returns", "the", "fare", "estimate", "based", "on", "two", "sets", "of", "coordinates", ".", ":", "param", "start_latitude", ":", "Starting", "latitude", "or", "latitude", "of", "pickup", "address", ".", ":", "param", "start_longitude", ":", "Starting", "long...
vivangkumar/uberpy
python
https://github.com/vivangkumar/uberpy/blob/abc62ccb5399424eb5690f12c392ab2dbd9d96e0/uberpy/uber.py#L39-L56
[ "def", "get_price_estimate", "(", "self", ",", "start_latitude", ",", "start_longitude", ",", "end_latitude", ",", "end_longitude", ")", ":", "endpoint", "=", "'estimates/price'", "query_parameters", "=", "{", "'start_latitude'", ":", "start_latitude", ",", "'start_lo...
abc62ccb5399424eb5690f12c392ab2dbd9d96e0
valid
Uber.get_time_estimate
Get the ETA for Uber products. :param start_latitude: Starting latitude. :param start_longitude: Starting longitude. :param customer_uuid: (Optional) Customer unique ID. :param product_id: (Optional) If ETA is needed only for a specific product type. :return: JSON
uberpy/uber.py
def get_time_estimate(self, start_latitude, start_longitude, customer_uuid=None, product_id=None): """ Get the ETA for Uber products. :param start_latitude: Starting latitude. :param start_longitude: Starting longitude. :param customer_uuid: (Optional) Customer unique ID. ...
def get_time_estimate(self, start_latitude, start_longitude, customer_uuid=None, product_id=None): """ Get the ETA for Uber products. :param start_latitude: Starting latitude. :param start_longitude: Starting longitude. :param customer_uuid: (Optional) Customer unique ID. ...
[ "Get", "the", "ETA", "for", "Uber", "products", ".", ":", "param", "start_latitude", ":", "Starting", "latitude", ".", ":", "param", "start_longitude", ":", "Starting", "longitude", ".", ":", "param", "customer_uuid", ":", "(", "Optional", ")", "Customer", "...
vivangkumar/uberpy
python
https://github.com/vivangkumar/uberpy/blob/abc62ccb5399424eb5690f12c392ab2dbd9d96e0/uberpy/uber.py#L58-L82
[ "def", "get_time_estimate", "(", "self", ",", "start_latitude", ",", "start_longitude", ",", "customer_uuid", "=", "None", ",", "product_id", "=", "None", ")", ":", "endpoint", "=", "'estimates/time'", "query_parameters", "=", "{", "'start_latitude'", ":", "start_...
abc62ccb5399424eb5690f12c392ab2dbd9d96e0
valid
models_preparing
Wrap all sqlalchemy model in settings.
ps_alchemy/__init__.py
def models_preparing(app): """ Wrap all sqlalchemy model in settings. """ def wrapper(resource, parent): if isinstance(resource, DeclarativeMeta): resource = ListResource(resource) if not getattr(resource, '__parent__', None): resource.__parent__ = parent ret...
def models_preparing(app): """ Wrap all sqlalchemy model in settings. """ def wrapper(resource, parent): if isinstance(resource, DeclarativeMeta): resource = ListResource(resource) if not getattr(resource, '__parent__', None): resource.__parent__ = parent ret...
[ "Wrap", "all", "sqlalchemy", "model", "in", "settings", "." ]
sacrud/ps_alchemy
python
https://github.com/sacrud/ps_alchemy/blob/4f042329eb4643bf26fa2540df277fa94c5265ec/ps_alchemy/__init__.py#L15-L26
[ "def", "models_preparing", "(", "app", ")", ":", "def", "wrapper", "(", "resource", ",", "parent", ")", ":", "if", "isinstance", "(", "resource", ",", "DeclarativeMeta", ")", ":", "resource", "=", "ListResource", "(", "resource", ")", "if", "not", "getattr...
4f042329eb4643bf26fa2540df277fa94c5265ec
valid
Api.check_status
Check the response that is returned for known exceptions and errors. :param response: Response that is returned from the call. :raise: MalformedRequestException if `response.status` is 400 UnauthorisedException if `response.status` is 401 NotFoundException if `response.status`...
uberpy/api.py
def check_status(content, response): """ Check the response that is returned for known exceptions and errors. :param response: Response that is returned from the call. :raise: MalformedRequestException if `response.status` is 400 UnauthorisedException if `response.statu...
def check_status(content, response): """ Check the response that is returned for known exceptions and errors. :param response: Response that is returned from the call. :raise: MalformedRequestException if `response.status` is 400 UnauthorisedException if `response.statu...
[ "Check", "the", "response", "that", "is", "returned", "for", "known", "exceptions", "and", "errors", ".", ":", "param", "response", ":", "Response", "that", "is", "returned", "from", "the", "call", ".", ":", "raise", ":", "MalformedRequestException", "if", "...
vivangkumar/uberpy
python
https://github.com/vivangkumar/uberpy/blob/abc62ccb5399424eb5690f12c392ab2dbd9d96e0/uberpy/api.py#L58-L91
[ "def", "check_status", "(", "content", ",", "response", ")", ":", "if", "response", ".", "status", "==", "400", ":", "raise", "MalformedRequestException", "(", "content", ",", "response", ")", "if", "response", ".", "status", "==", "401", ":", "raise", "Un...
abc62ccb5399424eb5690f12c392ab2dbd9d96e0
valid
Api.build_request
Build the HTTP request by adding query parameters to the path. :param path: API endpoint/path to be used. :param query_parameters: Query parameters to be added to the request. :return: string
uberpy/api.py
def build_request(self, path, query_parameters): """ Build the HTTP request by adding query parameters to the path. :param path: API endpoint/path to be used. :param query_parameters: Query parameters to be added to the request. :return: string """ url = 'https://...
def build_request(self, path, query_parameters): """ Build the HTTP request by adding query parameters to the path. :param path: API endpoint/path to be used. :param query_parameters: Query parameters to be added to the request. :return: string """ url = 'https://...
[ "Build", "the", "HTTP", "request", "by", "adding", "query", "parameters", "to", "the", "path", ".", ":", "param", "path", ":", "API", "endpoint", "/", "path", "to", "be", "used", ".", ":", "param", "query_parameters", ":", "Query", "parameters", "to", "b...
vivangkumar/uberpy
python
https://github.com/vivangkumar/uberpy/blob/abc62ccb5399424eb5690f12c392ab2dbd9d96e0/uberpy/api.py#L93-L103
[ "def", "build_request", "(", "self", ",", "path", ",", "query_parameters", ")", ":", "url", "=", "'https://api.uber.com/v1'", "+", "self", ".", "sanitise_path", "(", "path", ")", "url", "+=", "'?'", "+", "urlencode", "(", "query_parameters", ")", "return", "...
abc62ccb5399424eb5690f12c392ab2dbd9d96e0
valid
Api.get_json
Fetches the JSON returned, after making the call and checking for errors. :param uri_path: Endpoint to be used to make a request. :param http_method: HTTP method to be used. :param query_parameters: Parameters to be added to the request. :param body: Optional body, if required. :...
uberpy/api.py
def get_json(self, uri_path, http_method='GET', query_parameters=None, body=None, headers=None): """ Fetches the JSON returned, after making the call and checking for errors. :param uri_path: Endpoint to be used to make a request. :param http_method: HTTP method to be used. :para...
def get_json(self, uri_path, http_method='GET', query_parameters=None, body=None, headers=None): """ Fetches the JSON returned, after making the call and checking for errors. :param uri_path: Endpoint to be used to make a request. :param http_method: HTTP method to be used. :para...
[ "Fetches", "the", "JSON", "returned", "after", "making", "the", "call", "and", "checking", "for", "errors", ".", ":", "param", "uri_path", ":", "Endpoint", "to", "be", "used", "to", "make", "a", "request", ".", ":", "param", "http_method", ":", "HTTP", "...
vivangkumar/uberpy
python
https://github.com/vivangkumar/uberpy/blob/abc62ccb5399424eb5690f12c392ab2dbd9d96e0/uberpy/api.py#L105-L138
[ "def", "get_json", "(", "self", ",", "uri_path", ",", "http_method", "=", "'GET'", ",", "query_parameters", "=", "None", ",", "body", "=", "None", ",", "headers", "=", "None", ")", ":", "query_parameters", "=", "query_parameters", "or", "{", "}", "headers"...
abc62ccb5399424eb5690f12c392ab2dbd9d96e0
valid
_translateCommands
Generate the binary strings for a comma seperated list of commands.
x10_any/cm17a.py
def _translateCommands(commands): """Generate the binary strings for a comma seperated list of commands.""" for command in commands.split(','): # each command results in 2 bytes of binary data result = [0, 0] device, command = command.strip().upper().split(None, 1) # translate t...
def _translateCommands(commands): """Generate the binary strings for a comma seperated list of commands.""" for command in commands.split(','): # each command results in 2 bytes of binary data result = [0, 0] device, command = command.strip().upper().split(None, 1) # translate t...
[ "Generate", "the", "binary", "strings", "for", "a", "comma", "seperated", "list", "of", "commands", "." ]
clach04/x10_any
python
https://github.com/clach04/x10_any/blob/5b90a543b127ab9e6112fd547929b5ef4b8f0cbc/x10_any/cm17a.py#L73-L93
[ "def", "_translateCommands", "(", "commands", ")", ":", "for", "command", "in", "commands", ".", "split", "(", "','", ")", ":", "# each command results in 2 bytes of binary data", "result", "=", "[", "0", ",", "0", "]", "device", ",", "command", "=", "command"...
5b90a543b127ab9e6112fd547929b5ef4b8f0cbc
valid
_strBinary
Conert an integer to binary (i.e., a string of 1s and 0s).
x10_any/cm17a.py
def _strBinary(n): """Conert an integer to binary (i.e., a string of 1s and 0s).""" results = [] for i in range(8): n, r = divmod(n, 2) results.append('01'[r]) results.reverse() return ''.join(results)
def _strBinary(n): """Conert an integer to binary (i.e., a string of 1s and 0s).""" results = [] for i in range(8): n, r = divmod(n, 2) results.append('01'[r]) results.reverse() return ''.join(results)
[ "Conert", "an", "integer", "to", "binary", "(", "i", ".", "e", ".", "a", "string", "of", "1s", "and", "0s", ")", "." ]
clach04/x10_any
python
https://github.com/clach04/x10_any/blob/5b90a543b127ab9e6112fd547929b5ef4b8f0cbc/x10_any/cm17a.py#L96-L103
[ "def", "_strBinary", "(", "n", ")", ":", "results", "=", "[", "]", "for", "i", "in", "range", "(", "8", ")", ":", "n", ",", "r", "=", "divmod", "(", "n", ",", "2", ")", "results", ".", "append", "(", "'01'", "[", "r", "]", ")", "results", "...
5b90a543b127ab9e6112fd547929b5ef4b8f0cbc
valid
_sendBinaryData
Send a string of binary data to the FireCracker with proper timing. See the diagram in the spec referenced above for timing information. The module level variables leadInOutDelay and bitDelay represent how long each type of delay should be in seconds. They may require tweaking on some setups.
x10_any/cm17a.py
def _sendBinaryData(port, data): """Send a string of binary data to the FireCracker with proper timing. See the diagram in the spec referenced above for timing information. The module level variables leadInOutDelay and bitDelay represent how long each type of delay should be in seconds. They may requir...
def _sendBinaryData(port, data): """Send a string of binary data to the FireCracker with proper timing. See the diagram in the spec referenced above for timing information. The module level variables leadInOutDelay and bitDelay represent how long each type of delay should be in seconds. They may requir...
[ "Send", "a", "string", "of", "binary", "data", "to", "the", "FireCracker", "with", "proper", "timing", "." ]
clach04/x10_any
python
https://github.com/clach04/x10_any/blob/5b90a543b127ab9e6112fd547929b5ef4b8f0cbc/x10_any/cm17a.py#L106-L118
[ "def", "_sendBinaryData", "(", "port", ",", "data", ")", ":", "_reset", "(", "port", ")", "time", ".", "sleep", "(", "leadInOutDelay", ")", "for", "digit", "in", "data", ":", "_sendBit", "(", "port", ",", "digit", ")", "time", ".", "sleep", "(", "lea...
5b90a543b127ab9e6112fd547929b5ef4b8f0cbc
valid
_sendBit
Send an individual bit to the FireCracker module usr RTS/DTR.
x10_any/cm17a.py
def _sendBit(port, bit): """Send an individual bit to the FireCracker module usr RTS/DTR.""" if bit == '0': _setRTSDTR(port, 0, 1) elif bit == '1': _setRTSDTR(port, 1, 0) else: return time.sleep(bitDelay) _setRTSDTR(port, 1, 1) time.sleep(bitDelay)
def _sendBit(port, bit): """Send an individual bit to the FireCracker module usr RTS/DTR.""" if bit == '0': _setRTSDTR(port, 0, 1) elif bit == '1': _setRTSDTR(port, 1, 0) else: return time.sleep(bitDelay) _setRTSDTR(port, 1, 1) time.sleep(bitDelay)
[ "Send", "an", "individual", "bit", "to", "the", "FireCracker", "module", "usr", "RTS", "/", "DTR", "." ]
clach04/x10_any
python
https://github.com/clach04/x10_any/blob/5b90a543b127ab9e6112fd547929b5ef4b8f0cbc/x10_any/cm17a.py#L127-L137
[ "def", "_sendBit", "(", "port", ",", "bit", ")", ":", "if", "bit", "==", "'0'", ":", "_setRTSDTR", "(", "port", ",", "0", ",", "1", ")", "elif", "bit", "==", "'1'", ":", "_setRTSDTR", "(", "port", ",", "1", ",", "0", ")", "else", ":", "return",...
5b90a543b127ab9e6112fd547929b5ef4b8f0cbc
valid
_setRTSDTR
Set RTS and DTR to the requested state.
x10_any/cm17a.py
def _setRTSDTR(port, RTS, DTR): """Set RTS and DTR to the requested state.""" port.setRTS(RTS) port.setDTR(DTR)
def _setRTSDTR(port, RTS, DTR): """Set RTS and DTR to the requested state.""" port.setRTS(RTS) port.setDTR(DTR)
[ "Set", "RTS", "and", "DTR", "to", "the", "requested", "state", "." ]
clach04/x10_any
python
https://github.com/clach04/x10_any/blob/5b90a543b127ab9e6112fd547929b5ef4b8f0cbc/x10_any/cm17a.py#L140-L143
[ "def", "_setRTSDTR", "(", "port", ",", "RTS", ",", "DTR", ")", ":", "port", ".", "setRTS", "(", "RTS", ")", "port", ".", "setDTR", "(", "DTR", ")" ]
5b90a543b127ab9e6112fd547929b5ef4b8f0cbc
valid
sendCommands
Send X10 commands using the FireCracker on comPort comPort should be the name of a serial port on the host platform. On Windows, for example, 'com1'. commands should be a string consisting of X10 commands separated by commas. For example. 'A1 On, A Dim, A Dim, A Dim, A Lamps Off'. The letter is a ...
x10_any/cm17a.py
def sendCommands(comPort, commands): """Send X10 commands using the FireCracker on comPort comPort should be the name of a serial port on the host platform. On Windows, for example, 'com1'. commands should be a string consisting of X10 commands separated by commas. For example. 'A1 On, A Dim, A Di...
def sendCommands(comPort, commands): """Send X10 commands using the FireCracker on comPort comPort should be the name of a serial port on the host platform. On Windows, for example, 'com1'. commands should be a string consisting of X10 commands separated by commas. For example. 'A1 On, A Dim, A Di...
[ "Send", "X10", "commands", "using", "the", "FireCracker", "on", "comPort" ]
clach04/x10_any
python
https://github.com/clach04/x10_any/blob/5b90a543b127ab9e6112fd547929b5ef4b8f0cbc/x10_any/cm17a.py#L150-L190
[ "def", "sendCommands", "(", "comPort", ",", "commands", ")", ":", "mutex", ".", "acquire", "(", ")", "try", ":", "try", ":", "port", "=", "serial", ".", "Serial", "(", "port", "=", "comPort", ")", "header", "=", "'11010101 10101010'", "footer", "=", "'...
5b90a543b127ab9e6112fd547929b5ef4b8f0cbc
valid
main
Send X10 commands when module is used from the command line. This uses syntax similar to sendCommands, for example: x10.py com2 A1 On, A2 Off, B All Off
x10_any/cm17a.py
def main(argv=None): """Send X10 commands when module is used from the command line. This uses syntax similar to sendCommands, for example: x10.py com2 A1 On, A2 Off, B All Off """ if len(argv): # join all the arguments together by spaces so that quotes # aren't required on the com...
def main(argv=None): """Send X10 commands when module is used from the command line. This uses syntax similar to sendCommands, for example: x10.py com2 A1 On, A2 Off, B All Off """ if len(argv): # join all the arguments together by spaces so that quotes # aren't required on the com...
[ "Send", "X10", "commands", "when", "module", "is", "used", "from", "the", "command", "line", "." ]
clach04/x10_any
python
https://github.com/clach04/x10_any/blob/5b90a543b127ab9e6112fd547929b5ef4b8f0cbc/x10_any/cm17a.py#L193-L210
[ "def", "main", "(", "argv", "=", "None", ")", ":", "if", "len", "(", "argv", ")", ":", "# join all the arguments together by spaces so that quotes", "# aren't required on the command line.", "commands", "=", "' '", ".", "join", "(", "argv", ")", "# the comPort is ever...
5b90a543b127ab9e6112fd547929b5ef4b8f0cbc
valid
normalize_housecode
Returns a normalized house code, i.e. upper case. Raises exception X10InvalidHouseCode if house code appears to be invalid
x10_any/__init__.py
def normalize_housecode(house_code): """Returns a normalized house code, i.e. upper case. Raises exception X10InvalidHouseCode if house code appears to be invalid """ if house_code is None: raise X10InvalidHouseCode('%r is not a valid house code' % house_code) if not isinstance(house_code, b...
def normalize_housecode(house_code): """Returns a normalized house code, i.e. upper case. Raises exception X10InvalidHouseCode if house code appears to be invalid """ if house_code is None: raise X10InvalidHouseCode('%r is not a valid house code' % house_code) if not isinstance(house_code, b...
[ "Returns", "a", "normalized", "house", "code", "i", ".", "e", ".", "upper", "case", ".", "Raises", "exception", "X10InvalidHouseCode", "if", "house", "code", "appears", "to", "be", "invalid" ]
clach04/x10_any
python
https://github.com/clach04/x10_any/blob/5b90a543b127ab9e6112fd547929b5ef4b8f0cbc/x10_any/__init__.py#L67-L80
[ "def", "normalize_housecode", "(", "house_code", ")", ":", "if", "house_code", "is", "None", ":", "raise", "X10InvalidHouseCode", "(", "'%r is not a valid house code'", "%", "house_code", ")", "if", "not", "isinstance", "(", "house_code", ",", "basestring", ")", "...
5b90a543b127ab9e6112fd547929b5ef4b8f0cbc
valid
normalize_unitnumber
Returns a normalized unit number, i.e. integers Raises exception X10InvalidUnitNumber if unit number appears to be invalid
x10_any/__init__.py
def normalize_unitnumber(unit_number): """Returns a normalized unit number, i.e. integers Raises exception X10InvalidUnitNumber if unit number appears to be invalid """ try: try: unit_number = int(unit_number) except ValueError: raise X10InvalidUnitNumber('%r not ...
def normalize_unitnumber(unit_number): """Returns a normalized unit number, i.e. integers Raises exception X10InvalidUnitNumber if unit number appears to be invalid """ try: try: unit_number = int(unit_number) except ValueError: raise X10InvalidUnitNumber('%r not ...
[ "Returns", "a", "normalized", "unit", "number", "i", ".", "e", ".", "integers", "Raises", "exception", "X10InvalidUnitNumber", "if", "unit", "number", "appears", "to", "be", "invalid" ]
clach04/x10_any
python
https://github.com/clach04/x10_any/blob/5b90a543b127ab9e6112fd547929b5ef4b8f0cbc/x10_any/__init__.py#L83-L96
[ "def", "normalize_unitnumber", "(", "unit_number", ")", ":", "try", ":", "try", ":", "unit_number", "=", "int", "(", "unit_number", ")", "except", "ValueError", ":", "raise", "X10InvalidUnitNumber", "(", "'%r not a valid unit number'", "%", "unit_number", ")", "ex...
5b90a543b127ab9e6112fd547929b5ef4b8f0cbc
valid
X10Driver.x10_command
Send X10 command to ??? unit. @param house_code (A-P) - example='A' @param unit_number (1-16)- example=1 (or None to impact entire house code) @param state - Mochad command/state, See https://sourceforge.net/p/mochad/code/ci/master/tree/README examples=OFF, 'OFF'...
x10_any/__init__.py
def x10_command(self, house_code, unit_number, state): """Send X10 command to ??? unit. @param house_code (A-P) - example='A' @param unit_number (1-16)- example=1 (or None to impact entire house code) @param state - Mochad command/state, See https://sourceforge.net/p/moc...
def x10_command(self, house_code, unit_number, state): """Send X10 command to ??? unit. @param house_code (A-P) - example='A' @param unit_number (1-16)- example=1 (or None to impact entire house code) @param state - Mochad command/state, See https://sourceforge.net/p/moc...
[ "Send", "X10", "command", "to", "???", "unit", "." ]
clach04/x10_any
python
https://github.com/clach04/x10_any/blob/5b90a543b127ab9e6112fd547929b5ef4b8f0cbc/x10_any/__init__.py#L130-L159
[ "def", "x10_command", "(", "self", ",", "house_code", ",", "unit_number", ",", "state", ")", ":", "house_code", "=", "normalize_housecode", "(", "house_code", ")", "if", "unit_number", "is", "not", "None", ":", "unit_number", "=", "normalize_unitnumber", "(", ...
5b90a543b127ab9e6112fd547929b5ef4b8f0cbc
valid
X10Driver._x10_command
Real implementation
x10_any/__init__.py
def _x10_command(self, house_code, unit_number, state): """Real implementation""" print('x10_command%r' % ((house_code, unit_number, state), )) raise NotImplementedError()
def _x10_command(self, house_code, unit_number, state): """Real implementation""" print('x10_command%r' % ((house_code, unit_number, state), )) raise NotImplementedError()
[ "Real", "implementation" ]
clach04/x10_any
python
https://github.com/clach04/x10_any/blob/5b90a543b127ab9e6112fd547929b5ef4b8f0cbc/x10_any/__init__.py#L161-L164
[ "def", "_x10_command", "(", "self", ",", "house_code", ",", "unit_number", ",", "state", ")", ":", "print", "(", "'x10_command%r'", "%", "(", "(", "house_code", ",", "unit_number", ",", "state", ")", ",", ")", ")", "raise", "NotImplementedError", "(", ")" ...
5b90a543b127ab9e6112fd547929b5ef4b8f0cbc