repository_name stringlengths 5 67 | func_path_in_repository stringlengths 4 234 | func_name stringlengths 0 314 | whole_func_string stringlengths 52 3.87M | language stringclasses 6
values | func_code_string stringlengths 52 3.87M | func_documentation_string stringlengths 1 47.2k | func_code_url stringlengths 85 339 |
|---|---|---|---|---|---|---|---|
openego/eDisGo | edisgo/grid/network.py | TimeSeriesControl._worst_case_load | def _worst_case_load(self, worst_case_scale_factors,
peakload_consumption_ratio, modes):
"""
Define worst case load time series for each sector.
Parameters
----------
worst_case_scale_factors : dict
Scale factors defined in config file 'confi... | python | def _worst_case_load(self, worst_case_scale_factors,
peakload_consumption_ratio, modes):
"""
Define worst case load time series for each sector.
Parameters
----------
worst_case_scale_factors : dict
Scale factors defined in config file 'confi... | Define worst case load time series for each sector.
Parameters
----------
worst_case_scale_factors : dict
Scale factors defined in config file 'config_timeseries.cfg'.
Scale factors describe actual power to nominal power ratio of in
worst-case scenarios.
... | https://github.com/openego/eDisGo/blob/e6245bdaf236f9c49dbda5a18c1c458290f41e2b/edisgo/grid/network.py#L1473-L1508 |
openego/eDisGo | edisgo/grid/network.py | CurtailmentControl._check_timeindex | def _check_timeindex(self, curtailment_timeseries, network):
"""
Raises an error if time index of curtailment time series does not
comply with the time index of load and feed-in time series.
Parameters
-----------
curtailment_timeseries : :pandas:`pandas.Series<series>` ... | python | def _check_timeindex(self, curtailment_timeseries, network):
"""
Raises an error if time index of curtailment time series does not
comply with the time index of load and feed-in time series.
Parameters
-----------
curtailment_timeseries : :pandas:`pandas.Series<series>` ... | Raises an error if time index of curtailment time series does not
comply with the time index of load and feed-in time series.
Parameters
-----------
curtailment_timeseries : :pandas:`pandas.Series<series>` or \
:pandas:`pandas.DataFrame<dataframe>`
See parameter ... | https://github.com/openego/eDisGo/blob/e6245bdaf236f9c49dbda5a18c1c458290f41e2b/edisgo/grid/network.py#L1645-L1668 |
openego/eDisGo | edisgo/grid/network.py | CurtailmentControl._precheck | def _precheck(self, curtailment_timeseries, feedin_df, curtailment_key):
"""
Raises an error if the curtailment at any time step exceeds the
total feed-in of all generators curtailment can be distributed among
at that time.
Parameters
-----------
curtailment_time... | python | def _precheck(self, curtailment_timeseries, feedin_df, curtailment_key):
"""
Raises an error if the curtailment at any time step exceeds the
total feed-in of all generators curtailment can be distributed among
at that time.
Parameters
-----------
curtailment_time... | Raises an error if the curtailment at any time step exceeds the
total feed-in of all generators curtailment can be distributed among
at that time.
Parameters
-----------
curtailment_timeseries : :pandas:`pandas.Series<series>`
Curtailment time series in kW for the te... | https://github.com/openego/eDisGo/blob/e6245bdaf236f9c49dbda5a18c1c458290f41e2b/edisgo/grid/network.py#L1670-L1708 |
openego/eDisGo | edisgo/grid/network.py | CurtailmentControl._postcheck | def _postcheck(self, network, feedin):
"""
Raises an error if the curtailment of a generator exceeds the
feed-in of that generator at any time step.
Parameters
-----------
network : :class:`~.grid.network.Network`
feedin : :pandas:`pandas.DataFrame<dataframe>`
... | python | def _postcheck(self, network, feedin):
"""
Raises an error if the curtailment of a generator exceeds the
feed-in of that generator at any time step.
Parameters
-----------
network : :class:`~.grid.network.Network`
feedin : :pandas:`pandas.DataFrame<dataframe>`
... | Raises an error if the curtailment of a generator exceeds the
feed-in of that generator at any time step.
Parameters
-----------
network : :class:`~.grid.network.Network`
feedin : :pandas:`pandas.DataFrame<dataframe>`
DataFrame with feed-in time series in kW. Columns... | https://github.com/openego/eDisGo/blob/e6245bdaf236f9c49dbda5a18c1c458290f41e2b/edisgo/grid/network.py#L1710-L1732 |
openego/eDisGo | edisgo/grid/network.py | StorageControl._integrate_storage | def _integrate_storage(self, timeseries, position, params, voltage_level,
reactive_power_timeseries, **kwargs):
"""
Integrate storage units in the grid.
Parameters
----------
timeseries : :obj:`str` or :pandas:`pandas.Series<series>`
Parame... | python | def _integrate_storage(self, timeseries, position, params, voltage_level,
reactive_power_timeseries, **kwargs):
"""
Integrate storage units in the grid.
Parameters
----------
timeseries : :obj:`str` or :pandas:`pandas.Series<series>`
Parame... | Integrate storage units in the grid.
Parameters
----------
timeseries : :obj:`str` or :pandas:`pandas.Series<series>`
Parameter used to obtain time series of active power the storage
storage is charged (negative) or discharged (positive) with. Can
either be a... | https://github.com/openego/eDisGo/blob/e6245bdaf236f9c49dbda5a18c1c458290f41e2b/edisgo/grid/network.py#L1904-L2000 |
openego/eDisGo | edisgo/grid/network.py | StorageControl._check_nominal_power | def _check_nominal_power(self, storage_parameters, timeseries):
"""
Tries to assign a nominal power to the storage.
Checks if nominal power is provided through `storage_parameters`,
otherwise tries to return the absolute maximum of `timeseries`. Raises
an error if it cannot assi... | python | def _check_nominal_power(self, storage_parameters, timeseries):
"""
Tries to assign a nominal power to the storage.
Checks if nominal power is provided through `storage_parameters`,
otherwise tries to return the absolute maximum of `timeseries`. Raises
an error if it cannot assi... | Tries to assign a nominal power to the storage.
Checks if nominal power is provided through `storage_parameters`,
otherwise tries to return the absolute maximum of `timeseries`. Raises
an error if it cannot assign a nominal power.
Parameters
----------
timeseries : :obj... | https://github.com/openego/eDisGo/blob/e6245bdaf236f9c49dbda5a18c1c458290f41e2b/edisgo/grid/network.py#L2002-L2033 |
openego/eDisGo | edisgo/grid/network.py | StorageControl._check_timeindex | def _check_timeindex(self, timeseries):
"""
Raises an error if time index of storage time series does not
comply with the time index of load and feed-in time series.
Parameters
-----------
timeseries : :pandas:`pandas.DataFrame<dataframe>`
DataFrame containin... | python | def _check_timeindex(self, timeseries):
"""
Raises an error if time index of storage time series does not
comply with the time index of load and feed-in time series.
Parameters
-----------
timeseries : :pandas:`pandas.DataFrame<dataframe>`
DataFrame containin... | Raises an error if time index of storage time series does not
comply with the time index of load and feed-in time series.
Parameters
-----------
timeseries : :pandas:`pandas.DataFrame<dataframe>`
DataFrame containing active power the storage is charged (negative)
... | https://github.com/openego/eDisGo/blob/e6245bdaf236f9c49dbda5a18c1c458290f41e2b/edisgo/grid/network.py#L2035-L2054 |
openego/eDisGo | edisgo/grid/network.py | TimeSeries.generation_dispatchable | def generation_dispatchable(self):
"""
Get generation time series of dispatchable generators (only active
power)
Returns
-------
:pandas:`pandas.DataFrame<dataframe>`
See class definition for details.
"""
try:
return self._generat... | python | def generation_dispatchable(self):
"""
Get generation time series of dispatchable generators (only active
power)
Returns
-------
:pandas:`pandas.DataFrame<dataframe>`
See class definition for details.
"""
try:
return self._generat... | Get generation time series of dispatchable generators (only active
power)
Returns
-------
:pandas:`pandas.DataFrame<dataframe>`
See class definition for details. | https://github.com/openego/eDisGo/blob/e6245bdaf236f9c49dbda5a18c1c458290f41e2b/edisgo/grid/network.py#L2161-L2175 |
openego/eDisGo | edisgo/grid/network.py | TimeSeries.generation_fluctuating | def generation_fluctuating(self):
"""
Get generation time series of fluctuating renewables (only active
power)
Returns
-------
:pandas:`pandas.DataFrame<dataframe>`
See class definition for details.
"""
try:
return self._generatio... | python | def generation_fluctuating(self):
"""
Get generation time series of fluctuating renewables (only active
power)
Returns
-------
:pandas:`pandas.DataFrame<dataframe>`
See class definition for details.
"""
try:
return self._generatio... | Get generation time series of fluctuating renewables (only active
power)
Returns
-------
:pandas:`pandas.DataFrame<dataframe>`
See class definition for details. | https://github.com/openego/eDisGo/blob/e6245bdaf236f9c49dbda5a18c1c458290f41e2b/edisgo/grid/network.py#L2182-L2196 |
openego/eDisGo | edisgo/grid/network.py | TimeSeries.load | def load(self):
"""
Get load time series (only active power)
Returns
-------
dict or :pandas:`pandas.DataFrame<dataframe>`
See class definition for details.
"""
try:
return self._load.loc[[self.timeindex], :]
except:
r... | python | def load(self):
"""
Get load time series (only active power)
Returns
-------
dict or :pandas:`pandas.DataFrame<dataframe>`
See class definition for details.
"""
try:
return self._load.loc[[self.timeindex], :]
except:
r... | Get load time series (only active power)
Returns
-------
dict or :pandas:`pandas.DataFrame<dataframe>`
See class definition for details. | https://github.com/openego/eDisGo/blob/e6245bdaf236f9c49dbda5a18c1c458290f41e2b/edisgo/grid/network.py#L2224-L2237 |
openego/eDisGo | edisgo/grid/network.py | TimeSeries.curtailment | def curtailment(self):
"""
Get curtailment time series of dispatchable generators (only active
power)
Parameters
----------
curtailment : list or :pandas:`pandas.DataFrame<dataframe>`
See class definition for details.
Returns
-------
... | python | def curtailment(self):
"""
Get curtailment time series of dispatchable generators (only active
power)
Parameters
----------
curtailment : list or :pandas:`pandas.DataFrame<dataframe>`
See class definition for details.
Returns
-------
... | Get curtailment time series of dispatchable generators (only active
power)
Parameters
----------
curtailment : list or :pandas:`pandas.DataFrame<dataframe>`
See class definition for details.
Returns
-------
:pandas:`pandas.DataFrame<dataframe>`
... | https://github.com/openego/eDisGo/blob/e6245bdaf236f9c49dbda5a18c1c458290f41e2b/edisgo/grid/network.py#L2281-L2321 |
openego/eDisGo | edisgo/grid/network.py | Results.curtailment | def curtailment(self):
"""
Holds curtailment assigned to each generator per curtailment target.
Returns
-------
:obj:`dict` with :pandas:`pandas.DataFrame<dataframe>`
Keys of the dictionary are generator types (and weather cell ID)
curtailment targets wer... | python | def curtailment(self):
"""
Holds curtailment assigned to each generator per curtailment target.
Returns
-------
:obj:`dict` with :pandas:`pandas.DataFrame<dataframe>`
Keys of the dictionary are generator types (and weather cell ID)
curtailment targets wer... | Holds curtailment assigned to each generator per curtailment target.
Returns
-------
:obj:`dict` with :pandas:`pandas.DataFrame<dataframe>`
Keys of the dictionary are generator types (and weather cell ID)
curtailment targets were given for. E.g. if curtailment is provide... | https://github.com/openego/eDisGo/blob/e6245bdaf236f9c49dbda5a18c1c458290f41e2b/edisgo/grid/network.py#L2728-L2757 |
openego/eDisGo | edisgo/grid/network.py | Results.storages | def storages(self):
"""
Gathers relevant storage results.
Returns
-------
:pandas:`pandas.DataFrame<dataframe>`
Dataframe containing all storages installed in the MV grid and
LV grids. Index of the dataframe are the storage representatives,
c... | python | def storages(self):
"""
Gathers relevant storage results.
Returns
-------
:pandas:`pandas.DataFrame<dataframe>`
Dataframe containing all storages installed in the MV grid and
LV grids. Index of the dataframe are the storage representatives,
c... | Gathers relevant storage results.
Returns
-------
:pandas:`pandas.DataFrame<dataframe>`
Dataframe containing all storages installed in the MV grid and
LV grids. Index of the dataframe are the storage representatives,
columns are the following:
n... | https://github.com/openego/eDisGo/blob/e6245bdaf236f9c49dbda5a18c1c458290f41e2b/edisgo/grid/network.py#L2760-L2795 |
openego/eDisGo | edisgo/grid/network.py | Results.storages_timeseries | def storages_timeseries(self):
"""
Returns a dataframe with storage time series.
Returns
-------
:pandas:`pandas.DataFrame<dataframe>`
Dataframe containing time series of all storages installed in the
MV grid and LV grids. Index of the dataframe is a
... | python | def storages_timeseries(self):
"""
Returns a dataframe with storage time series.
Returns
-------
:pandas:`pandas.DataFrame<dataframe>`
Dataframe containing time series of all storages installed in the
MV grid and LV grids. Index of the dataframe is a
... | Returns a dataframe with storage time series.
Returns
-------
:pandas:`pandas.DataFrame<dataframe>`
Dataframe containing time series of all storages installed in the
MV grid and LV grids. Index of the dataframe is a
:pandas:`pandas.DatetimeIndex<datetimeinde... | https://github.com/openego/eDisGo/blob/e6245bdaf236f9c49dbda5a18c1c458290f41e2b/edisgo/grid/network.py#L2797-L2820 |
openego/eDisGo | edisgo/grid/network.py | Results.s_res | def s_res(self, components=None):
"""
Get resulting apparent power in kVA at line(s) and transformer(s).
The apparent power at a line (or transformer) is determined from the
maximum values of active power P and reactive power Q.
.. math::
S = max(\sqrt{p_0^2 + q_0^... | python | def s_res(self, components=None):
"""
Get resulting apparent power in kVA at line(s) and transformer(s).
The apparent power at a line (or transformer) is determined from the
maximum values of active power P and reactive power Q.
.. math::
S = max(\sqrt{p_0^2 + q_0^... | Get resulting apparent power in kVA at line(s) and transformer(s).
The apparent power at a line (or transformer) is determined from the
maximum values of active power P and reactive power Q.
.. math::
S = max(\sqrt{p_0^2 + q_0^2}, \sqrt{p_1^2 + q_1^2})
Parameters
... | https://github.com/openego/eDisGo/blob/e6245bdaf236f9c49dbda5a18c1c458290f41e2b/edisgo/grid/network.py#L2892-L2938 |
openego/eDisGo | edisgo/grid/network.py | Results.save | def save(self, directory, parameters='all'):
"""
Saves results to disk.
Depending on which results are selected and if they exist, the
following directories and files are created:
* `powerflow_results` directory
* `voltages_pu.csv`
See :py:attr:`~pfa_v_m... | python | def save(self, directory, parameters='all'):
"""
Saves results to disk.
Depending on which results are selected and if they exist, the
following directories and files are created:
* `powerflow_results` directory
* `voltages_pu.csv`
See :py:attr:`~pfa_v_m... | Saves results to disk.
Depending on which results are selected and if they exist, the
following directories and files are created:
* `powerflow_results` directory
* `voltages_pu.csv`
See :py:attr:`~pfa_v_mag_pu` for more information.
* `currents.csv`
... | https://github.com/openego/eDisGo/blob/e6245bdaf236f9c49dbda5a18c1c458290f41e2b/edisgo/grid/network.py#L2996-L3209 |
openego/eDisGo | edisgo/grid/network.py | ResultsReimport.v_res | def v_res(self, nodes=None, level=None):
"""
Get resulting voltage level at node.
Parameters
----------
nodes : :obj:`list`
List of string representatives of grid topology components, e.g.
:class:`~.grid.components.Generator`. If not provided defaults to
... | python | def v_res(self, nodes=None, level=None):
"""
Get resulting voltage level at node.
Parameters
----------
nodes : :obj:`list`
List of string representatives of grid topology components, e.g.
:class:`~.grid.components.Generator`. If not provided defaults to
... | Get resulting voltage level at node.
Parameters
----------
nodes : :obj:`list`
List of string representatives of grid topology components, e.g.
:class:`~.grid.components.Generator`. If not provided defaults to
all nodes available in grid level `level`.
... | https://github.com/openego/eDisGo/blob/e6245bdaf236f9c49dbda5a18c1c458290f41e2b/edisgo/grid/network.py#L3391-L3434 |
openego/eDisGo | edisgo/grid/network.py | ResultsReimport.s_res | def s_res(self, components=None):
"""
Get apparent power in kVA at line(s) and transformer(s).
Parameters
----------
components : :obj:`list`
List of string representatives of :class:`~.grid.components.Line`
or :class:`~.grid.components.Transformer`. If n... | python | def s_res(self, components=None):
"""
Get apparent power in kVA at line(s) and transformer(s).
Parameters
----------
components : :obj:`list`
List of string representatives of :class:`~.grid.components.Line`
or :class:`~.grid.components.Transformer`. If n... | Get apparent power in kVA at line(s) and transformer(s).
Parameters
----------
components : :obj:`list`
List of string representatives of :class:`~.grid.components.Line`
or :class:`~.grid.components.Transformer`. If not provided defaults
to return apparent po... | https://github.com/openego/eDisGo/blob/e6245bdaf236f9c49dbda5a18c1c458290f41e2b/edisgo/grid/network.py#L3436-L3464 |
openego/eDisGo | edisgo/flex_opt/storage_integration.py | storage_at_hvmv_substation | def storage_at_hvmv_substation(mv_grid, parameters, mode=None):
"""
Place storage at HV/MV substation bus bar.
Parameters
----------
mv_grid : :class:`~.grid.grids.MVGrid`
MV grid instance
parameters : :obj:`dict`
Dictionary with storage parameters. Must at least contain
... | python | def storage_at_hvmv_substation(mv_grid, parameters, mode=None):
"""
Place storage at HV/MV substation bus bar.
Parameters
----------
mv_grid : :class:`~.grid.grids.MVGrid`
MV grid instance
parameters : :obj:`dict`
Dictionary with storage parameters. Must at least contain
... | Place storage at HV/MV substation bus bar.
Parameters
----------
mv_grid : :class:`~.grid.grids.MVGrid`
MV grid instance
parameters : :obj:`dict`
Dictionary with storage parameters. Must at least contain
'nominal_power'. See :class:`~.grid.network.StorageControl` for more
... | https://github.com/openego/eDisGo/blob/e6245bdaf236f9c49dbda5a18c1c458290f41e2b/edisgo/flex_opt/storage_integration.py#L7-L32 |
openego/eDisGo | edisgo/flex_opt/storage_integration.py | set_up_storage | def set_up_storage(node, parameters,
voltage_level=None, operational_mode=None):
"""
Sets up a storage instance.
Parameters
----------
node : :class:`~.grid.components.Station` or :class:`~.grid.components.BranchTee`
Node the storage will be connected to.
parameters :... | python | def set_up_storage(node, parameters,
voltage_level=None, operational_mode=None):
"""
Sets up a storage instance.
Parameters
----------
node : :class:`~.grid.components.Station` or :class:`~.grid.components.BranchTee`
Node the storage will be connected to.
parameters :... | Sets up a storage instance.
Parameters
----------
node : :class:`~.grid.components.Station` or :class:`~.grid.components.BranchTee`
Node the storage will be connected to.
parameters : :obj:`dict`, optional
Dictionary with storage parameters. Must at least contain
'nominal_power'... | https://github.com/openego/eDisGo/blob/e6245bdaf236f9c49dbda5a18c1c458290f41e2b/edisgo/flex_opt/storage_integration.py#L35-L79 |
openego/eDisGo | edisgo/flex_opt/storage_integration.py | connect_storage | def connect_storage(storage, node):
"""
Connects storage to the given node.
The storage is connected by a cable
The cable the storage is connected with is selected to be able to carry
the storages nominal power and equal amount of reactive power.
No load factor is considered.
Parameters
... | python | def connect_storage(storage, node):
"""
Connects storage to the given node.
The storage is connected by a cable
The cable the storage is connected with is selected to be able to carry
the storages nominal power and equal amount of reactive power.
No load factor is considered.
Parameters
... | Connects storage to the given node.
The storage is connected by a cable
The cable the storage is connected with is selected to be able to carry
the storages nominal power and equal amount of reactive power.
No load factor is considered.
Parameters
----------
storage : :class:`~.grid.compon... | https://github.com/openego/eDisGo/blob/e6245bdaf236f9c49dbda5a18c1c458290f41e2b/edisgo/flex_opt/storage_integration.py#L82-L133 |
src-d/lookout-sdk | python/lookout/sdk/grpc/interceptors/logger.py | LogInterceptorMixin.add_request_log_fields | def add_request_log_fields(
self, log_fields: LogFields,
call_details: Union[grpc.HandlerCallDetails,
grpc.ClientCallDetails]
):
"""Add log fields related to a request to the provided log fields
:param log_fields: log fields instance to which ... | python | def add_request_log_fields(
self, log_fields: LogFields,
call_details: Union[grpc.HandlerCallDetails,
grpc.ClientCallDetails]
):
"""Add log fields related to a request to the provided log fields
:param log_fields: log fields instance to which ... | Add log fields related to a request to the provided log fields
:param log_fields: log fields instance to which to add the fields
:param call_details: some information regarding the call | https://github.com/src-d/lookout-sdk/blob/2ca64a77b022864fed3bb31d12997712c7e98e6e/python/lookout/sdk/grpc/interceptors/logger.py#L21-L38 |
src-d/lookout-sdk | python/lookout/sdk/grpc/interceptors/logger.py | LogInterceptorMixin.add_response_log_fields | def add_response_log_fields(self, log_fields: LogFields,
start_time: datetime, err: Exception):
"""Add log fields related to a response to the provided log fields
:param log_fields: log fields instnace to which to add the fields
:param start_time: start time of t... | python | def add_response_log_fields(self, log_fields: LogFields,
start_time: datetime, err: Exception):
"""Add log fields related to a response to the provided log fields
:param log_fields: log fields instnace to which to add the fields
:param start_time: start time of t... | Add log fields related to a response to the provided log fields
:param log_fields: log fields instnace to which to add the fields
:param start_time: start time of the request
:param err: exception raised during the handling of the request. | https://github.com/src-d/lookout-sdk/blob/2ca64a77b022864fed3bb31d12997712c7e98e6e/python/lookout/sdk/grpc/interceptors/logger.py#L40-L55 |
openego/eDisGo | edisgo/tools/tools.py | select_worstcase_snapshots | def select_worstcase_snapshots(network):
"""
Select two worst-case snapshots from time series
Two time steps in a time series represent worst-case snapshots. These are
1. Load case: refers to the point in the time series where the
(load - generation) achieves its maximum and is greater than 0.... | python | def select_worstcase_snapshots(network):
"""
Select two worst-case snapshots from time series
Two time steps in a time series represent worst-case snapshots. These are
1. Load case: refers to the point in the time series where the
(load - generation) achieves its maximum and is greater than 0.... | Select two worst-case snapshots from time series
Two time steps in a time series represent worst-case snapshots. These are
1. Load case: refers to the point in the time series where the
(load - generation) achieves its maximum and is greater than 0.
2. Feed-in case: refers to the point in the time... | https://github.com/openego/eDisGo/blob/e6245bdaf236f9c49dbda5a18c1c458290f41e2b/edisgo/tools/tools.py#L4-L40 |
openego/eDisGo | edisgo/tools/tools.py | get_residual_load_from_pypsa_network | def get_residual_load_from_pypsa_network(pypsa_network):
"""
Calculates residual load in MW in MV grid and underlying LV grids.
Parameters
----------
pypsa_network : :pypsa:`pypsa.Network<network>`
The `PyPSA network
<https://www.pypsa.org/doc/components.html#network>`_ container,
... | python | def get_residual_load_from_pypsa_network(pypsa_network):
"""
Calculates residual load in MW in MV grid and underlying LV grids.
Parameters
----------
pypsa_network : :pypsa:`pypsa.Network<network>`
The `PyPSA network
<https://www.pypsa.org/doc/components.html#network>`_ container,
... | Calculates residual load in MW in MV grid and underlying LV grids.
Parameters
----------
pypsa_network : :pypsa:`pypsa.Network<network>`
The `PyPSA network
<https://www.pypsa.org/doc/components.html#network>`_ container,
containing load flow results.
Returns
-------
:pa... | https://github.com/openego/eDisGo/blob/e6245bdaf236f9c49dbda5a18c1c458290f41e2b/edisgo/tools/tools.py#L43-L68 |
openego/eDisGo | edisgo/tools/tools.py | assign_load_feedin_case | def assign_load_feedin_case(network):
"""
For each time step evaluate whether it is a feed-in or a load case.
Feed-in and load case are identified based on the
generation and load time series and defined as follows:
1. Load case: positive (load - generation) at HV/MV substation
2. Feed-in case... | python | def assign_load_feedin_case(network):
"""
For each time step evaluate whether it is a feed-in or a load case.
Feed-in and load case are identified based on the
generation and load time series and defined as follows:
1. Load case: positive (load - generation) at HV/MV substation
2. Feed-in case... | For each time step evaluate whether it is a feed-in or a load case.
Feed-in and load case are identified based on the
generation and load time series and defined as follows:
1. Load case: positive (load - generation) at HV/MV substation
2. Feed-in case: negative (load - generation) at HV/MV substation... | https://github.com/openego/eDisGo/blob/e6245bdaf236f9c49dbda5a18c1c458290f41e2b/edisgo/tools/tools.py#L71-L135 |
openego/eDisGo | edisgo/tools/config.py | load_config | def load_config(filename, config_dir=None, copy_default_config=True):
"""
Loads the specified config file.
Parameters
-----------
filename : :obj:`str`
Config file name, e.g. 'config_grid.cfg'.
config_dir : :obj:`str`, optional
Path to config file. If None uses default edisgo co... | python | def load_config(filename, config_dir=None, copy_default_config=True):
"""
Loads the specified config file.
Parameters
-----------
filename : :obj:`str`
Config file name, e.g. 'config_grid.cfg'.
config_dir : :obj:`str`, optional
Path to config file. If None uses default edisgo co... | Loads the specified config file.
Parameters
-----------
filename : :obj:`str`
Config file name, e.g. 'config_grid.cfg'.
config_dir : :obj:`str`, optional
Path to config file. If None uses default edisgo config directory
specified in config file 'config_system.cfg' in section 'us... | https://github.com/openego/eDisGo/blob/e6245bdaf236f9c49dbda5a18c1c458290f41e2b/edisgo/tools/config.py#L49-L90 |
openego/eDisGo | edisgo/tools/config.py | get_default_config_path | def get_default_config_path():
"""
Returns the basic edisgo config path. If it does not yet exist it creates
it and copies all default config files into it.
Returns
--------
:obj:`str`
Path to default edisgo config directory specified in config file
'config_system.cfg' in sectio... | python | def get_default_config_path():
"""
Returns the basic edisgo config path. If it does not yet exist it creates
it and copies all default config files into it.
Returns
--------
:obj:`str`
Path to default edisgo config directory specified in config file
'config_system.cfg' in sectio... | Returns the basic edisgo config path. If it does not yet exist it creates
it and copies all default config files into it.
Returns
--------
:obj:`str`
Path to default edisgo config directory specified in config file
'config_system.cfg' in section 'user_dirs' by subsections 'root_dir'
... | https://github.com/openego/eDisGo/blob/e6245bdaf236f9c49dbda5a18c1c458290f41e2b/edisgo/tools/config.py#L124-L168 |
openego/eDisGo | edisgo/tools/config.py | make_directory | def make_directory(directory):
"""
Makes directory if it does not exist.
Parameters
-----------
directory : :obj:`str`
Directory path
"""
if not os.path.isdir(directory):
os.mkdir(directory)
logger.info('Path {} not found, I will create it.'
.for... | python | def make_directory(directory):
"""
Makes directory if it does not exist.
Parameters
-----------
directory : :obj:`str`
Directory path
"""
if not os.path.isdir(directory):
os.mkdir(directory)
logger.info('Path {} not found, I will create it.'
.for... | Makes directory if it does not exist.
Parameters
-----------
directory : :obj:`str`
Directory path | https://github.com/openego/eDisGo/blob/e6245bdaf236f9c49dbda5a18c1c458290f41e2b/edisgo/tools/config.py#L171-L184 |
openego/eDisGo | edisgo/flex_opt/check_tech_constraints.py | mv_line_load | def mv_line_load(network):
"""
Checks for over-loading issues in MV grid.
Parameters
----------
network : :class:`~.grid.network.Network`
Returns
-------
:pandas:`pandas.DataFrame<dataframe>`
Dataframe containing over-loaded MV lines, their maximum relative
over-loading... | python | def mv_line_load(network):
"""
Checks for over-loading issues in MV grid.
Parameters
----------
network : :class:`~.grid.network.Network`
Returns
-------
:pandas:`pandas.DataFrame<dataframe>`
Dataframe containing over-loaded MV lines, their maximum relative
over-loading... | Checks for over-loading issues in MV grid.
Parameters
----------
network : :class:`~.grid.network.Network`
Returns
-------
:pandas:`pandas.DataFrame<dataframe>`
Dataframe containing over-loaded MV lines, their maximum relative
over-loading and the corresponding time step.
... | https://github.com/openego/eDisGo/blob/e6245bdaf236f9c49dbda5a18c1c458290f41e2b/edisgo/flex_opt/check_tech_constraints.py#L10-L46 |
openego/eDisGo | edisgo/flex_opt/check_tech_constraints.py | lv_line_load | def lv_line_load(network):
"""
Checks for over-loading issues in LV grids.
Parameters
----------
network : :class:`~.grid.network.Network`
Returns
-------
:pandas:`pandas.DataFrame<dataframe>`
Dataframe containing over-loaded LV lines, their maximum relative
over-loadin... | python | def lv_line_load(network):
"""
Checks for over-loading issues in LV grids.
Parameters
----------
network : :class:`~.grid.network.Network`
Returns
-------
:pandas:`pandas.DataFrame<dataframe>`
Dataframe containing over-loaded LV lines, their maximum relative
over-loadin... | Checks for over-loading issues in LV grids.
Parameters
----------
network : :class:`~.grid.network.Network`
Returns
-------
:pandas:`pandas.DataFrame<dataframe>`
Dataframe containing over-loaded LV lines, their maximum relative
over-loading and the corresponding time step.
... | https://github.com/openego/eDisGo/blob/e6245bdaf236f9c49dbda5a18c1c458290f41e2b/edisgo/flex_opt/check_tech_constraints.py#L49-L87 |
openego/eDisGo | edisgo/flex_opt/check_tech_constraints.py | _line_load | def _line_load(network, grid, crit_lines):
"""
Checks for over-loading issues of lines.
Parameters
----------
network : :class:`~.grid.network.Network`
grid : :class:`~.grid.grids.LVGrid` or :class:`~.grid.grids.MVGrid`
crit_lines : :pandas:`pandas.DataFrame<dataframe>`
Dataframe co... | python | def _line_load(network, grid, crit_lines):
"""
Checks for over-loading issues of lines.
Parameters
----------
network : :class:`~.grid.network.Network`
grid : :class:`~.grid.grids.LVGrid` or :class:`~.grid.grids.MVGrid`
crit_lines : :pandas:`pandas.DataFrame<dataframe>`
Dataframe co... | Checks for over-loading issues of lines.
Parameters
----------
network : :class:`~.grid.network.Network`
grid : :class:`~.grid.grids.LVGrid` or :class:`~.grid.grids.MVGrid`
crit_lines : :pandas:`pandas.DataFrame<dataframe>`
Dataframe containing over-loaded lines, their maximum relative
... | https://github.com/openego/eDisGo/blob/e6245bdaf236f9c49dbda5a18c1c458290f41e2b/edisgo/flex_opt/check_tech_constraints.py#L90-L153 |
openego/eDisGo | edisgo/flex_opt/check_tech_constraints.py | hv_mv_station_load | def hv_mv_station_load(network):
"""
Checks for over-loading of HV/MV station.
Parameters
----------
network : :class:`~.grid.network.Network`
Returns
-------
:pandas:`pandas.DataFrame<dataframe>`
Dataframe containing over-loaded HV/MV stations, their apparent power
at ... | python | def hv_mv_station_load(network):
"""
Checks for over-loading of HV/MV station.
Parameters
----------
network : :class:`~.grid.network.Network`
Returns
-------
:pandas:`pandas.DataFrame<dataframe>`
Dataframe containing over-loaded HV/MV stations, their apparent power
at ... | Checks for over-loading of HV/MV station.
Parameters
----------
network : :class:`~.grid.network.Network`
Returns
-------
:pandas:`pandas.DataFrame<dataframe>`
Dataframe containing over-loaded HV/MV stations, their apparent power
at maximal over-loading and the corresponding ti... | https://github.com/openego/eDisGo/blob/e6245bdaf236f9c49dbda5a18c1c458290f41e2b/edisgo/flex_opt/check_tech_constraints.py#L156-L190 |
openego/eDisGo | edisgo/flex_opt/check_tech_constraints.py | mv_lv_station_load | def mv_lv_station_load(network):
"""
Checks for over-loading of MV/LV stations.
Parameters
----------
network : :class:`~.grid.network.Network`
Returns
-------
:pandas:`pandas.DataFrame<dataframe>`
Dataframe containing over-loaded MV/LV stations, their apparent power
at... | python | def mv_lv_station_load(network):
"""
Checks for over-loading of MV/LV stations.
Parameters
----------
network : :class:`~.grid.network.Network`
Returns
-------
:pandas:`pandas.DataFrame<dataframe>`
Dataframe containing over-loaded MV/LV stations, their apparent power
at... | Checks for over-loading of MV/LV stations.
Parameters
----------
network : :class:`~.grid.network.Network`
Returns
-------
:pandas:`pandas.DataFrame<dataframe>`
Dataframe containing over-loaded MV/LV stations, their apparent power
at maximal over-loading and the corresponding t... | https://github.com/openego/eDisGo/blob/e6245bdaf236f9c49dbda5a18c1c458290f41e2b/edisgo/flex_opt/check_tech_constraints.py#L193-L231 |
openego/eDisGo | edisgo/flex_opt/check_tech_constraints.py | _station_load | def _station_load(network, station, crit_stations):
"""
Checks for over-loading of stations.
Parameters
----------
network : :class:`~.grid.network.Network`
station : :class:`~.grid.components.LVStation` or :class:`~.grid.components.MVStation`
crit_stations : :pandas:`pandas.DataFrame<dataf... | python | def _station_load(network, station, crit_stations):
"""
Checks for over-loading of stations.
Parameters
----------
network : :class:`~.grid.network.Network`
station : :class:`~.grid.components.LVStation` or :class:`~.grid.components.MVStation`
crit_stations : :pandas:`pandas.DataFrame<dataf... | Checks for over-loading of stations.
Parameters
----------
network : :class:`~.grid.network.Network`
station : :class:`~.grid.components.LVStation` or :class:`~.grid.components.MVStation`
crit_stations : :pandas:`pandas.DataFrame<dataframe>`
Dataframe containing over-loaded stations, their ... | https://github.com/openego/eDisGo/blob/e6245bdaf236f9c49dbda5a18c1c458290f41e2b/edisgo/flex_opt/check_tech_constraints.py#L234-L311 |
openego/eDisGo | edisgo/flex_opt/check_tech_constraints.py | mv_voltage_deviation | def mv_voltage_deviation(network, voltage_levels='mv_lv'):
"""
Checks for voltage stability issues in MV grid.
Parameters
----------
network : :class:`~.grid.network.Network`
voltage_levels : :obj:`str`
Specifies which allowed voltage deviations to use. Possible options
are:
... | python | def mv_voltage_deviation(network, voltage_levels='mv_lv'):
"""
Checks for voltage stability issues in MV grid.
Parameters
----------
network : :class:`~.grid.network.Network`
voltage_levels : :obj:`str`
Specifies which allowed voltage deviations to use. Possible options
are:
... | Checks for voltage stability issues in MV grid.
Parameters
----------
network : :class:`~.grid.network.Network`
voltage_levels : :obj:`str`
Specifies which allowed voltage deviations to use. Possible options
are:
* 'mv_lv'
This is the default. The allowed voltage devi... | https://github.com/openego/eDisGo/blob/e6245bdaf236f9c49dbda5a18c1c458290f41e2b/edisgo/flex_opt/check_tech_constraints.py#L314-L408 |
openego/eDisGo | edisgo/flex_opt/check_tech_constraints.py | lv_voltage_deviation | def lv_voltage_deviation(network, mode=None, voltage_levels='mv_lv'):
"""
Checks for voltage stability issues in LV grids.
Parameters
----------
network : :class:`~.grid.network.Network`
mode : None or String
If None voltage at all nodes in LV grid is checked. If mode is set to
... | python | def lv_voltage_deviation(network, mode=None, voltage_levels='mv_lv'):
"""
Checks for voltage stability issues in LV grids.
Parameters
----------
network : :class:`~.grid.network.Network`
mode : None or String
If None voltage at all nodes in LV grid is checked. If mode is set to
... | Checks for voltage stability issues in LV grids.
Parameters
----------
network : :class:`~.grid.network.Network`
mode : None or String
If None voltage at all nodes in LV grid is checked. If mode is set to
'stations' only voltage at busbar is checked.
voltage_levels : :obj:`str`
... | https://github.com/openego/eDisGo/blob/e6245bdaf236f9c49dbda5a18c1c458290f41e2b/edisgo/flex_opt/check_tech_constraints.py#L411-L574 |
openego/eDisGo | edisgo/flex_opt/check_tech_constraints.py | _voltage_deviation | def _voltage_deviation(network, nodes, v_dev_allowed_upper,
v_dev_allowed_lower, voltage_level):
"""
Checks for voltage stability issues in LV grids.
Parameters
----------
network : :class:`~.grid.network.Network`
nodes : :obj:`list`
List of nodes (of type :class:`... | python | def _voltage_deviation(network, nodes, v_dev_allowed_upper,
v_dev_allowed_lower, voltage_level):
"""
Checks for voltage stability issues in LV grids.
Parameters
----------
network : :class:`~.grid.network.Network`
nodes : :obj:`list`
List of nodes (of type :class:`... | Checks for voltage stability issues in LV grids.
Parameters
----------
network : :class:`~.grid.network.Network`
nodes : :obj:`list`
List of nodes (of type :class:`~.grid.components.Generator`,
:class:`~.grid.components.Load`, etc.) to check voltage deviation for.
v_dev_allowed_upper... | https://github.com/openego/eDisGo/blob/e6245bdaf236f9c49dbda5a18c1c458290f41e2b/edisgo/flex_opt/check_tech_constraints.py#L577-L652 |
openego/eDisGo | edisgo/flex_opt/check_tech_constraints.py | check_ten_percent_voltage_deviation | def check_ten_percent_voltage_deviation(network):
"""
Checks if 10% criteria is exceeded.
Parameters
----------
network : :class:`~.grid.network.Network`
"""
v_mag_pu_pfa = network.results.v_res()
if (v_mag_pu_pfa > 1.1).any().any() or (v_mag_pu_pfa < 0.9).any().any():
message... | python | def check_ten_percent_voltage_deviation(network):
"""
Checks if 10% criteria is exceeded.
Parameters
----------
network : :class:`~.grid.network.Network`
"""
v_mag_pu_pfa = network.results.v_res()
if (v_mag_pu_pfa > 1.1).any().any() or (v_mag_pu_pfa < 0.9).any().any():
message... | Checks if 10% criteria is exceeded.
Parameters
----------
network : :class:`~.grid.network.Network` | https://github.com/openego/eDisGo/blob/e6245bdaf236f9c49dbda5a18c1c458290f41e2b/edisgo/flex_opt/check_tech_constraints.py#L655-L668 |
openego/eDisGo | edisgo/tools/geo.py | proj2equidistant | def proj2equidistant(network):
"""Defines conformal (e.g. WGS84) to ETRS (equidistant) projection
Source CRS is loaded from Network's config.
Parameters
----------
network : :class:`~.grid.network.Network`
The eDisGo container object
Returns
-------
:py:func:`functools.partial`... | python | def proj2equidistant(network):
"""Defines conformal (e.g. WGS84) to ETRS (equidistant) projection
Source CRS is loaded from Network's config.
Parameters
----------
network : :class:`~.grid.network.Network`
The eDisGo container object
Returns
-------
:py:func:`functools.partial`... | Defines conformal (e.g. WGS84) to ETRS (equidistant) projection
Source CRS is loaded from Network's config.
Parameters
----------
network : :class:`~.grid.network.Network`
The eDisGo container object
Returns
-------
:py:func:`functools.partial` | https://github.com/openego/eDisGo/blob/e6245bdaf236f9c49dbda5a18c1c458290f41e2b/edisgo/tools/geo.py#L14-L33 |
openego/eDisGo | edisgo/tools/geo.py | calc_geo_lines_in_buffer | def calc_geo_lines_in_buffer(network, node, grid, radius, radius_inc):
"""Determines lines in nodes' associated graph that are at least partly
within buffer of radius from node. If there are no lines, the buffer is
successively extended by radius_inc until lines are found.
Parameters
----------
... | python | def calc_geo_lines_in_buffer(network, node, grid, radius, radius_inc):
"""Determines lines in nodes' associated graph that are at least partly
within buffer of radius from node. If there are no lines, the buffer is
successively extended by radius_inc until lines are found.
Parameters
----------
... | Determines lines in nodes' associated graph that are at least partly
within buffer of radius from node. If there are no lines, the buffer is
successively extended by radius_inc until lines are found.
Parameters
----------
network : :class:`~.grid.network.Network`
The eDisGo container object... | https://github.com/openego/eDisGo/blob/e6245bdaf236f9c49dbda5a18c1c458290f41e2b/edisgo/tools/geo.py#L58-L101 |
openego/eDisGo | edisgo/tools/geo.py | calc_geo_dist_vincenty | def calc_geo_dist_vincenty(network, node_source, node_target):
"""Calculates the geodesic distance between node_source and node_target
incorporating the detour factor in config.
Parameters
----------
network : :class:`~.grid.network.Network`
The eDisGo container object
node_source : :cl... | python | def calc_geo_dist_vincenty(network, node_source, node_target):
"""Calculates the geodesic distance between node_source and node_target
incorporating the detour factor in config.
Parameters
----------
network : :class:`~.grid.network.Network`
The eDisGo container object
node_source : :cl... | Calculates the geodesic distance between node_source and node_target
incorporating the detour factor in config.
Parameters
----------
network : :class:`~.grid.network.Network`
The eDisGo container object
node_source : :class:`~.grid.components.Component`
Node to connect (e.g. :class... | https://github.com/openego/eDisGo/blob/e6245bdaf236f9c49dbda5a18c1c458290f41e2b/edisgo/tools/geo.py#L104-L141 |
City-of-Helsinki/django-helusers | helusers/pipeline.py | get_username | def get_username(details, backend, response, *args, **kwargs):
"""Sets the `username` argument.
If the user exists already, use the existing username. Otherwise
generate username from the `new_uuid` using the
`helusers.utils.uuid_to_username` function.
"""
user = details.get('user')
if not... | python | def get_username(details, backend, response, *args, **kwargs):
"""Sets the `username` argument.
If the user exists already, use the existing username. Otherwise
generate username from the `new_uuid` using the
`helusers.utils.uuid_to_username` function.
"""
user = details.get('user')
if not... | Sets the `username` argument.
If the user exists already, use the existing username. Otherwise
generate username from the `new_uuid` using the
`helusers.utils.uuid_to_username` function. | https://github.com/City-of-Helsinki/django-helusers/blob/9064979f6f990987358e2bca3c24a80fad201bdb/helusers/pipeline.py#L26-L46 |
City-of-Helsinki/django-helusers | helusers/adapter.py | SocialAccountAdapter.pre_social_login | def pre_social_login(self, request, sociallogin):
"""Update user based on token information."""
user = sociallogin.user
# If the user hasn't been saved yet, it will be updated
# later on in the sign-up flow.
if not user.pk:
return
data = sociallogin.account.... | python | def pre_social_login(self, request, sociallogin):
"""Update user based on token information."""
user = sociallogin.user
# If the user hasn't been saved yet, it will be updated
# later on in the sign-up flow.
if not user.pk:
return
data = sociallogin.account.... | Update user based on token information. | https://github.com/City-of-Helsinki/django-helusers/blob/9064979f6f990987358e2bca3c24a80fad201bdb/helusers/adapter.py#L6-L17 |
City-of-Helsinki/django-helusers | helusers/models.py | AbstractUser.sync_groups_from_ad | def sync_groups_from_ad(self):
"""Determine which Django groups to add or remove based on AD groups."""
ad_list = ADGroupMapping.objects.values_list('ad_group', 'group')
mappings = {ad_group: group for ad_group, group in ad_list}
user_ad_groups = set(self.ad_groups.filter(groups__isnul... | python | def sync_groups_from_ad(self):
"""Determine which Django groups to add or remove based on AD groups."""
ad_list = ADGroupMapping.objects.values_list('ad_group', 'group')
mappings = {ad_group: group for ad_group, group in ad_list}
user_ad_groups = set(self.ad_groups.filter(groups__isnul... | Determine which Django groups to add or remove based on AD groups. | https://github.com/City-of-Helsinki/django-helusers/blob/9064979f6f990987358e2bca3c24a80fad201bdb/helusers/models.py#L81-L97 |
City-of-Helsinki/django-helusers | helusers/jwt.py | patch_jwt_settings | def patch_jwt_settings():
"""Patch rest_framework_jwt authentication settings from allauth"""
defaults = api_settings.defaults
defaults['JWT_PAYLOAD_GET_USER_ID_HANDLER'] = (
__name__ + '.get_user_id_from_payload_handler')
if 'allauth.socialaccount' not in settings.INSTALLED_APPS:
retur... | python | def patch_jwt_settings():
"""Patch rest_framework_jwt authentication settings from allauth"""
defaults = api_settings.defaults
defaults['JWT_PAYLOAD_GET_USER_ID_HANDLER'] = (
__name__ + '.get_user_id_from_payload_handler')
if 'allauth.socialaccount' not in settings.INSTALLED_APPS:
retur... | Patch rest_framework_jwt authentication settings from allauth | https://github.com/City-of-Helsinki/django-helusers/blob/9064979f6f990987358e2bca3c24a80fad201bdb/helusers/jwt.py#L8-L24 |
City-of-Helsinki/django-helusers | helusers/utils.py | uuid_to_username | def uuid_to_username(uuid):
"""
Convert UUID to username.
>>> uuid_to_username('00fbac99-0bab-5e66-8e84-2e567ea4d1f6')
'u-ad52zgilvnpgnduefzlh5jgr6y'
>>> uuid_to_username(UUID('00fbac99-0bab-5e66-8e84-2e567ea4d1f6'))
'u-ad52zgilvnpgnduefzlh5jgr6y'
"""
uuid_data = getattr(uuid, 'bytes',... | python | def uuid_to_username(uuid):
"""
Convert UUID to username.
>>> uuid_to_username('00fbac99-0bab-5e66-8e84-2e567ea4d1f6')
'u-ad52zgilvnpgnduefzlh5jgr6y'
>>> uuid_to_username(UUID('00fbac99-0bab-5e66-8e84-2e567ea4d1f6'))
'u-ad52zgilvnpgnduefzlh5jgr6y'
"""
uuid_data = getattr(uuid, 'bytes',... | Convert UUID to username.
>>> uuid_to_username('00fbac99-0bab-5e66-8e84-2e567ea4d1f6')
'u-ad52zgilvnpgnduefzlh5jgr6y'
>>> uuid_to_username(UUID('00fbac99-0bab-5e66-8e84-2e567ea4d1f6'))
'u-ad52zgilvnpgnduefzlh5jgr6y' | https://github.com/City-of-Helsinki/django-helusers/blob/9064979f6f990987358e2bca3c24a80fad201bdb/helusers/utils.py#L5-L17 |
City-of-Helsinki/django-helusers | helusers/utils.py | username_to_uuid | def username_to_uuid(username):
"""
Convert username to UUID.
>>> username_to_uuid('u-ad52zgilvnpgnduefzlh5jgr6y')
UUID('00fbac99-0bab-5e66-8e84-2e567ea4d1f6')
"""
if not username.startswith('u-') or len(username) != 28:
raise ValueError('Not an UUID based username: %r' % (username,))
... | python | def username_to_uuid(username):
"""
Convert username to UUID.
>>> username_to_uuid('u-ad52zgilvnpgnduefzlh5jgr6y')
UUID('00fbac99-0bab-5e66-8e84-2e567ea4d1f6')
"""
if not username.startswith('u-') or len(username) != 28:
raise ValueError('Not an UUID based username: %r' % (username,))
... | Convert username to UUID.
>>> username_to_uuid('u-ad52zgilvnpgnduefzlh5jgr6y')
UUID('00fbac99-0bab-5e66-8e84-2e567ea4d1f6') | https://github.com/City-of-Helsinki/django-helusers/blob/9064979f6f990987358e2bca3c24a80fad201bdb/helusers/utils.py#L20-L30 |
City-of-Helsinki/django-helusers | helusers/user_utils.py | oidc_to_user_data | def oidc_to_user_data(payload):
"""
Map OIDC claims to Django user fields.
"""
payload = payload.copy()
field_map = {
'given_name': 'first_name',
'family_name': 'last_name',
'email': 'email',
}
ret = {}
for token_attr, user_attr in field_map.items():
if t... | python | def oidc_to_user_data(payload):
"""
Map OIDC claims to Django user fields.
"""
payload = payload.copy()
field_map = {
'given_name': 'first_name',
'family_name': 'last_name',
'email': 'email',
}
ret = {}
for token_attr, user_attr in field_map.items():
if t... | Map OIDC claims to Django user fields. | https://github.com/City-of-Helsinki/django-helusers/blob/9064979f6f990987358e2bca3c24a80fad201bdb/helusers/user_utils.py#L8-L26 |
City-of-Helsinki/django-helusers | helusers/authz.py | UserAuthorization.has_api_scopes | def has_api_scopes(self, *api_scopes):
"""
Test if all given API scopes are authorized.
:type api_scopes: list[str]
:param api_scopes: The API scopes to test
:rtype: bool|None
:return:
True or False, if the API Token has the API scopes field set,
oth... | python | def has_api_scopes(self, *api_scopes):
"""
Test if all given API scopes are authorized.
:type api_scopes: list[str]
:param api_scopes: The API scopes to test
:rtype: bool|None
:return:
True or False, if the API Token has the API scopes field set,
oth... | Test if all given API scopes are authorized.
:type api_scopes: list[str]
:param api_scopes: The API scopes to test
:rtype: bool|None
:return:
True or False, if the API Token has the API scopes field set,
otherwise None | https://github.com/City-of-Helsinki/django-helusers/blob/9064979f6f990987358e2bca3c24a80fad201bdb/helusers/authz.py#L15-L29 |
City-of-Helsinki/django-helusers | helusers/authz.py | UserAuthorization.has_api_scope_with_prefix | def has_api_scope_with_prefix(self, prefix):
"""
Test if there is an API scope with the given prefix.
:rtype: bool|None
"""
if self._authorized_api_scopes is None:
return None
return any(
x == prefix or x.startswith(prefix + '.')
for x... | python | def has_api_scope_with_prefix(self, prefix):
"""
Test if there is an API scope with the given prefix.
:rtype: bool|None
"""
if self._authorized_api_scopes is None:
return None
return any(
x == prefix or x.startswith(prefix + '.')
for x... | Test if there is an API scope with the given prefix.
:rtype: bool|None | https://github.com/City-of-Helsinki/django-helusers/blob/9064979f6f990987358e2bca3c24a80fad201bdb/helusers/authz.py#L31-L41 |
dreipol/djangocms-spa | djangocms_spa/utils.py | get_function_by_path | def get_function_by_path(dotted_function_module_path):
"""
Returns the function for a given path (e.g. 'my_app.my_module.my_function').
"""
# Separate the module path from the function name.
module_path, function_name = tuple(dotted_function_module_path.rsplit('.', 1))
module = import_module(mo... | python | def get_function_by_path(dotted_function_module_path):
"""
Returns the function for a given path (e.g. 'my_app.my_module.my_function').
"""
# Separate the module path from the function name.
module_path, function_name = tuple(dotted_function_module_path.rsplit('.', 1))
module = import_module(mo... | Returns the function for a given path (e.g. 'my_app.my_module.my_function'). | https://github.com/dreipol/djangocms-spa/blob/eb0048eb29aef6314431c3c1800b363c40619818/djangocms_spa/utils.py#L7-L15 |
Turbo87/aerofiles | aerofiles/seeyou/writer.py | Writer.write_waypoint | def write_waypoint(
self, name, shortname, country, latitude, longitude, elevation=u'',
style=WaypointStyle.NORMAL, runway_direction=u'', runway_length=u'',
frequency=u'', description=u''):
"""
Write a waypoint::
writer.write_waypoint(
'M... | python | def write_waypoint(
self, name, shortname, country, latitude, longitude, elevation=u'',
style=WaypointStyle.NORMAL, runway_direction=u'', runway_length=u'',
frequency=u'', description=u''):
"""
Write a waypoint::
writer.write_waypoint(
'M... | Write a waypoint::
writer.write_waypoint(
'Meiersberg',
'MEIER',
'DE',
(51 + 7.345 / 60.),
(6 + 24.765 / 60.),
)
# -> "Meiersberg","MEIER",DE,5107.345N,00624.765E,,1,,,,
:param name: name of the... | https://github.com/Turbo87/aerofiles/blob/d8b7b04a1fcea5c98f89500de1164619a4ec7ef4/aerofiles/seeyou/writer.py#L116-L174 |
Turbo87/aerofiles | aerofiles/seeyou/writer.py | Writer.write_task | def write_task(self, description, waypoints):
"""
Write a task definition::
writer.write_task('500 km FAI', [
'MEIER',
'BRILO',
'AILER',
'MEIER',
])
# -> "500 km FAI","MEIER","BRILO","AILER","MEIER"
... | python | def write_task(self, description, waypoints):
"""
Write a task definition::
writer.write_task('500 km FAI', [
'MEIER',
'BRILO',
'AILER',
'MEIER',
])
# -> "500 km FAI","MEIER","BRILO","AILER","MEIER"
... | Write a task definition::
writer.write_task('500 km FAI', [
'MEIER',
'BRILO',
'AILER',
'MEIER',
])
# -> "500 km FAI","MEIER","BRILO","AILER","MEIER"
Make sure that the referenced waypoints have been written wit... | https://github.com/Turbo87/aerofiles/blob/d8b7b04a1fcea5c98f89500de1164619a4ec7ef4/aerofiles/seeyou/writer.py#L176-L215 |
Turbo87/aerofiles | aerofiles/seeyou/writer.py | Writer.write_task_options | def write_task_options(self, **kw):
"""
Write an options line for a task definition::
writer.write_task_options(
start_time=time(12, 34, 56),
task_time=timedelta(hours=1, minutes=45, seconds=12),
waypoint_distance=False,
dista... | python | def write_task_options(self, **kw):
"""
Write an options line for a task definition::
writer.write_task_options(
start_time=time(12, 34, 56),
task_time=timedelta(hours=1, minutes=45, seconds=12),
waypoint_distance=False,
dista... | Write an options line for a task definition::
writer.write_task_options(
start_time=time(12, 34, 56),
task_time=timedelta(hours=1, minutes=45, seconds=12),
waypoint_distance=False,
distance_tolerance=(0.7, 'km'),
altitude_toler... | https://github.com/Turbo87/aerofiles/blob/d8b7b04a1fcea5c98f89500de1164619a4ec7ef4/aerofiles/seeyou/writer.py#L217-L296 |
Turbo87/aerofiles | aerofiles/seeyou/writer.py | Writer.write_observation_zone | def write_observation_zone(self, num, **kw):
"""
Write observation zone information for a taskpoint::
writer.write_task_options(
start_time=time(12, 34, 56),
task_time=timedelta(hours=1, minutes=45, seconds=12),
waypoint_distance=False,
... | python | def write_observation_zone(self, num, **kw):
"""
Write observation zone information for a taskpoint::
writer.write_task_options(
start_time=time(12, 34, 56),
task_time=timedelta(hours=1, minutes=45, seconds=12),
waypoint_distance=False,
... | Write observation zone information for a taskpoint::
writer.write_task_options(
start_time=time(12, 34, 56),
task_time=timedelta(hours=1, minutes=45, seconds=12),
waypoint_distance=False,
distance_tolerance=(0.7, 'km'),
altitud... | https://github.com/Turbo87/aerofiles/blob/d8b7b04a1fcea5c98f89500de1164619a4ec7ef4/aerofiles/seeyou/writer.py#L298-L350 |
GluuFederation/oxd-python | oxdpython/client.py | Client.register_site | def register_site(self):
"""Function to register the site and generate a unique ID for the site
Returns:
**string:** The ID of the site (also called client id) if the registration is successful
Raises:
**OxdServerError:** If the site registration fails.
"""
... | python | def register_site(self):
"""Function to register the site and generate a unique ID for the site
Returns:
**string:** The ID of the site (also called client id) if the registration is successful
Raises:
**OxdServerError:** If the site registration fails.
"""
... | Function to register the site and generate a unique ID for the site
Returns:
**string:** The ID of the site (also called client id) if the registration is successful
Raises:
**OxdServerError:** If the site registration fails. | https://github.com/GluuFederation/oxd-python/blob/a0448cda03b4384bc50a8c20bd65eacd983bceb8/oxdpython/client.py#L75-L113 |
GluuFederation/oxd-python | oxdpython/client.py | Client.get_authorization_url | def get_authorization_url(self, acr_values=None, prompt=None, scope=None,
custom_params=None):
"""Function to get the authorization url that can be opened in the
browser for the user to provide authorization and authentication
Parameters:
* **acr_values... | python | def get_authorization_url(self, acr_values=None, prompt=None, scope=None,
custom_params=None):
"""Function to get the authorization url that can be opened in the
browser for the user to provide authorization and authentication
Parameters:
* **acr_values... | Function to get the authorization url that can be opened in the
browser for the user to provide authorization and authentication
Parameters:
* **acr_values (list, optional):** acr values in the order of priority
* **prompt (string, optional):** prompt=login is required if you wa... | https://github.com/GluuFederation/oxd-python/blob/a0448cda03b4384bc50a8c20bd65eacd983bceb8/oxdpython/client.py#L115-L153 |
GluuFederation/oxd-python | oxdpython/client.py | Client.get_tokens_by_code | def get_tokens_by_code(self, code, state):
"""Function to get access code for getting the user details from the
OP. It is called after the user authorizes by visiting the auth URL.
Parameters:
* **code (string):** code, parse from the callback URL querystring
* **state (... | python | def get_tokens_by_code(self, code, state):
"""Function to get access code for getting the user details from the
OP. It is called after the user authorizes by visiting the auth URL.
Parameters:
* **code (string):** code, parse from the callback URL querystring
* **state (... | Function to get access code for getting the user details from the
OP. It is called after the user authorizes by visiting the auth URL.
Parameters:
* **code (string):** code, parse from the callback URL querystring
* **state (string):** state value parsed from the callback URL
... | https://github.com/GluuFederation/oxd-python/blob/a0448cda03b4384bc50a8c20bd65eacd983bceb8/oxdpython/client.py#L155-L198 |
GluuFederation/oxd-python | oxdpython/client.py | Client.get_access_token_by_refresh_token | def get_access_token_by_refresh_token(self, refresh_token, scope=None):
"""Function that is used to get a new access token using refresh token
Parameters:
* **refresh_token (str):** refresh_token from get_tokens_by_code command
* **scope (list, optional):** a list of scopes. If ... | python | def get_access_token_by_refresh_token(self, refresh_token, scope=None):
"""Function that is used to get a new access token using refresh token
Parameters:
* **refresh_token (str):** refresh_token from get_tokens_by_code command
* **scope (list, optional):** a list of scopes. If ... | Function that is used to get a new access token using refresh token
Parameters:
* **refresh_token (str):** refresh_token from get_tokens_by_code command
* **scope (list, optional):** a list of scopes. If not specified should grant access with scope provided in previous request
... | https://github.com/GluuFederation/oxd-python/blob/a0448cda03b4384bc50a8c20bd65eacd983bceb8/oxdpython/client.py#L200-L235 |
GluuFederation/oxd-python | oxdpython/client.py | Client.get_user_info | def get_user_info(self, access_token):
"""Function to get the information about the user using the access code
obtained from the OP
Note:
Refer to the /.well-known/openid-configuration URL of your OP for
the complete list of the claims for different scopes.
Para... | python | def get_user_info(self, access_token):
"""Function to get the information about the user using the access code
obtained from the OP
Note:
Refer to the /.well-known/openid-configuration URL of your OP for
the complete list of the claims for different scopes.
Para... | Function to get the information about the user using the access code
obtained from the OP
Note:
Refer to the /.well-known/openid-configuration URL of your OP for
the complete list of the claims for different scopes.
Parameters:
* **access_token (string):** a... | https://github.com/GluuFederation/oxd-python/blob/a0448cda03b4384bc50a8c20bd65eacd983bceb8/oxdpython/client.py#L237-L276 |
GluuFederation/oxd-python | oxdpython/client.py | Client.get_logout_uri | def get_logout_uri(self, id_token_hint=None, post_logout_redirect_uri=None,
state=None, session_state=None):
"""Function to logout the user.
Parameters:
* **id_token_hint (string, optional):** oxd server will use last used ID Token, if not provided
* **pos... | python | def get_logout_uri(self, id_token_hint=None, post_logout_redirect_uri=None,
state=None, session_state=None):
"""Function to logout the user.
Parameters:
* **id_token_hint (string, optional):** oxd server will use last used ID Token, if not provided
* **pos... | Function to logout the user.
Parameters:
* **id_token_hint (string, optional):** oxd server will use last used ID Token, if not provided
* **post_logout_redirect_uri (string, optional):** URI to redirect, this uri would override the value given in the site-config
* **state (... | https://github.com/GluuFederation/oxd-python/blob/a0448cda03b4384bc50a8c20bd65eacd983bceb8/oxdpython/client.py#L278-L311 |
GluuFederation/oxd-python | oxdpython/client.py | Client.update_site | def update_site(self, client_secret_expires_at=None):
"""Function to update the site's information with OpenID Provider.
This should be called after changing the values in the cfg file.
Parameters:
* **client_secret_expires_at (long, OPTIONAL):** milliseconds since 1970, can be used... | python | def update_site(self, client_secret_expires_at=None):
"""Function to update the site's information with OpenID Provider.
This should be called after changing the values in the cfg file.
Parameters:
* **client_secret_expires_at (long, OPTIONAL):** milliseconds since 1970, can be used... | Function to update the site's information with OpenID Provider.
This should be called after changing the values in the cfg file.
Parameters:
* **client_secret_expires_at (long, OPTIONAL):** milliseconds since 1970, can be used to extends client lifetime
Returns:
**bool:... | https://github.com/GluuFederation/oxd-python/blob/a0448cda03b4384bc50a8c20bd65eacd983bceb8/oxdpython/client.py#L313-L352 |
GluuFederation/oxd-python | oxdpython/client.py | Client.uma_rs_protect | def uma_rs_protect(self, resources, overwrite=None):
"""Function to be used in a UMA Resource Server to protect resources.
Parameters:
* **resources (list):** list of resource to protect. See example at `here <https://gluu.org/docs/oxd/3.1.2/api/#uma-rs-protect-resources>`_
* **... | python | def uma_rs_protect(self, resources, overwrite=None):
"""Function to be used in a UMA Resource Server to protect resources.
Parameters:
* **resources (list):** list of resource to protect. See example at `here <https://gluu.org/docs/oxd/3.1.2/api/#uma-rs-protect-resources>`_
* **... | Function to be used in a UMA Resource Server to protect resources.
Parameters:
* **resources (list):** list of resource to protect. See example at `here <https://gluu.org/docs/oxd/3.1.2/api/#uma-rs-protect-resources>`_
* **overwrite (bool):** If true, Allows to update existing resources... | https://github.com/GluuFederation/oxd-python/blob/a0448cda03b4384bc50a8c20bd65eacd983bceb8/oxdpython/client.py#L354-L375 |
GluuFederation/oxd-python | oxdpython/client.py | Client.uma_rs_check_access | def uma_rs_check_access(self, rpt, path, http_method):
"""Function to be used in a UMA Resource Server to check access.
Parameters:
* **rpt (string):** RPT or blank value if absent (not send by RP)
* **path (string):** Path of resource (e.g. for http://rs.com/phones, /phones sho... | python | def uma_rs_check_access(self, rpt, path, http_method):
"""Function to be used in a UMA Resource Server to check access.
Parameters:
* **rpt (string):** RPT or blank value if absent (not send by RP)
* **path (string):** Path of resource (e.g. for http://rs.com/phones, /phones sho... | Function to be used in a UMA Resource Server to check access.
Parameters:
* **rpt (string):** RPT or blank value if absent (not send by RP)
* **path (string):** Path of resource (e.g. for http://rs.com/phones, /phones should be passed)
* **http_method (string):** Http method... | https://github.com/GluuFederation/oxd-python/blob/a0448cda03b4384bc50a8c20bd65eacd983bceb8/oxdpython/client.py#L377-L426 |
GluuFederation/oxd-python | oxdpython/client.py | Client.uma_rp_get_rpt | def uma_rp_get_rpt(self, ticket, claim_token=None, claim_token_format=None,
pct=None, rpt=None, scope=None, state=None):
"""Function to be used by a UMA Requesting Party to get RPT token.
Parameters:
* **ticket (str, REQUIRED):** ticket
* **claim_token (st... | python | def uma_rp_get_rpt(self, ticket, claim_token=None, claim_token_format=None,
pct=None, rpt=None, scope=None, state=None):
"""Function to be used by a UMA Requesting Party to get RPT token.
Parameters:
* **ticket (str, REQUIRED):** ticket
* **claim_token (st... | Function to be used by a UMA Requesting Party to get RPT token.
Parameters:
* **ticket (str, REQUIRED):** ticket
* **claim_token (str, OPTIONAL):** claim token
* **claim_token_format (str, OPTIONAL):** claim token format
* **pct (str, OPTIONAL):** pct
... | https://github.com/GluuFederation/oxd-python/blob/a0448cda03b4384bc50a8c20bd65eacd983bceb8/oxdpython/client.py#L428-L511 |
GluuFederation/oxd-python | oxdpython/client.py | Client.uma_rp_get_claims_gathering_url | def uma_rp_get_claims_gathering_url(self, ticket):
"""UMA RP function to get the claims gathering URL.
Parameters:
* **ticket (str):** ticket to pass to the auth server. for 90% of the cases, this will be obtained from 'need_info' error of get_rpt
Returns:
**string** sp... | python | def uma_rp_get_claims_gathering_url(self, ticket):
"""UMA RP function to get the claims gathering URL.
Parameters:
* **ticket (str):** ticket to pass to the auth server. for 90% of the cases, this will be obtained from 'need_info' error of get_rpt
Returns:
**string** sp... | UMA RP function to get the claims gathering URL.
Parameters:
* **ticket (str):** ticket to pass to the auth server. for 90% of the cases, this will be obtained from 'need_info' error of get_rpt
Returns:
**string** specifying the claims gathering url | https://github.com/GluuFederation/oxd-python/blob/a0448cda03b4384bc50a8c20bd65eacd983bceb8/oxdpython/client.py#L513-L536 |
GluuFederation/oxd-python | oxdpython/client.py | Client.setup_client | def setup_client(self):
"""The command registers the client for communication protection. This
will be used to obtain an access token via the Get Client Token
command. The access token will be passed as a protection_access_token
parameter to other commands.
Note:
If ... | python | def setup_client(self):
"""The command registers the client for communication protection. This
will be used to obtain an access token via the Get Client Token
command. The access token will be passed as a protection_access_token
parameter to other commands.
Note:
If ... | The command registers the client for communication protection. This
will be used to obtain an access token via the Get Client Token
command. The access token will be passed as a protection_access_token
parameter to other commands.
Note:
If you are using the oxd-https-extensi... | https://github.com/GluuFederation/oxd-python/blob/a0448cda03b4384bc50a8c20bd65eacd983bceb8/oxdpython/client.py#L538-L601 |
GluuFederation/oxd-python | oxdpython/client.py | Client.get_client_token | def get_client_token(self, client_id=None, client_secret=None,
op_host=None, op_discovery_path=None, scope=None,
auto_update=True):
"""Function to get the client token which can be used for protection in
all future communication. The access token receive... | python | def get_client_token(self, client_id=None, client_secret=None,
op_host=None, op_discovery_path=None, scope=None,
auto_update=True):
"""Function to get the client token which can be used for protection in
all future communication. The access token receive... | Function to get the client token which can be used for protection in
all future communication. The access token received by this method is
stored in the config file and used as the `protection_access_token`
for all subsequent calls to oxd.
Parameters:
* **client_id (str, opt... | https://github.com/GluuFederation/oxd-python/blob/a0448cda03b4384bc50a8c20bd65eacd983bceb8/oxdpython/client.py#L603-L672 |
GluuFederation/oxd-python | oxdpython/client.py | Client.remove_site | def remove_site(self):
"""Cleans up the data for the site.
Returns:
oxd_id if the process was completed without error
Raises:
OxdServerError if there was an issue with the operation
"""
params = dict(oxd_id=self.oxd_id)
logger.debug("Sending com... | python | def remove_site(self):
"""Cleans up the data for the site.
Returns:
oxd_id if the process was completed without error
Raises:
OxdServerError if there was an issue with the operation
"""
params = dict(oxd_id=self.oxd_id)
logger.debug("Sending com... | Cleans up the data for the site.
Returns:
oxd_id if the process was completed without error
Raises:
OxdServerError if there was an issue with the operation | https://github.com/GluuFederation/oxd-python/blob/a0448cda03b4384bc50a8c20bd65eacd983bceb8/oxdpython/client.py#L674-L692 |
GluuFederation/oxd-python | oxdpython/client.py | Client.introspect_rpt | def introspect_rpt(self, rpt):
"""Gives information about an RPT.
Parameters:
* **rpt (str, required):** rpt from uma_rp_get_rpt function
Returns:
**dict:** The information about the RPT.
Example response ::
{
"active": ... | python | def introspect_rpt(self, rpt):
"""Gives information about an RPT.
Parameters:
* **rpt (str, required):** rpt from uma_rp_get_rpt function
Returns:
**dict:** The information about the RPT.
Example response ::
{
"active": ... | Gives information about an RPT.
Parameters:
* **rpt (str, required):** rpt from uma_rp_get_rpt function
Returns:
**dict:** The information about the RPT.
Example response ::
{
"active": true,
"exp": 125695373... | https://github.com/GluuFederation/oxd-python/blob/a0448cda03b4384bc50a8c20bd65eacd983bceb8/oxdpython/client.py#L736-L781 |
Turbo87/aerofiles | aerofiles/xcsoar/writer.py | Writer.write_task | def write_task(self, **kw):
"""
Write the main task to the file::
with writer.write_task(type=TaskType.RACING):
...
# <Task type="RT"> ... </Task>
Inside the with clause the :meth:`~aerofiles.xcsoar.Writer.write_point`
method should be used to w... | python | def write_task(self, **kw):
"""
Write the main task to the file::
with writer.write_task(type=TaskType.RACING):
...
# <Task type="RT"> ... </Task>
Inside the with clause the :meth:`~aerofiles.xcsoar.Writer.write_point`
method should be used to w... | Write the main task to the file::
with writer.write_task(type=TaskType.RACING):
...
# <Task type="RT"> ... </Task>
Inside the with clause the :meth:`~aerofiles.xcsoar.Writer.write_point`
method should be used to write the individual task points. All
par... | https://github.com/Turbo87/aerofiles/blob/d8b7b04a1fcea5c98f89500de1164619a4ec7ef4/aerofiles/xcsoar/writer.py#L62-L104 |
Turbo87/aerofiles | aerofiles/xcsoar/writer.py | Writer.write_point | def write_point(self, **kw):
"""
Write a task point to the file::
with writer.write_point(type=PointType.TURN):
writer.write_waypoint(...)
writer.write_observation_zone(...)
# <Point type="Turn"> ... </Point>
Inside the with clause the
... | python | def write_point(self, **kw):
"""
Write a task point to the file::
with writer.write_point(type=PointType.TURN):
writer.write_waypoint(...)
writer.write_observation_zone(...)
# <Point type="Turn"> ... </Point>
Inside the with clause the
... | Write a task point to the file::
with writer.write_point(type=PointType.TURN):
writer.write_waypoint(...)
writer.write_observation_zone(...)
# <Point type="Turn"> ... </Point>
Inside the with clause the
:meth:`~aerofiles.xcsoar.Writer.write_wayp... | https://github.com/Turbo87/aerofiles/blob/d8b7b04a1fcea5c98f89500de1164619a4ec7ef4/aerofiles/xcsoar/writer.py#L106-L129 |
Turbo87/aerofiles | aerofiles/xcsoar/writer.py | Writer.write_waypoint | def write_waypoint(self, **kw):
"""
Write a waypoint to the file::
writer.write_waypoint(
name='Meiersberg',
latitude=51.4,
longitude=7.1
)
# <Waypoint name="Meiersberg">
# <Location latitude="51.4" lon... | python | def write_waypoint(self, **kw):
"""
Write a waypoint to the file::
writer.write_waypoint(
name='Meiersberg',
latitude=51.4,
longitude=7.1
)
# <Waypoint name="Meiersberg">
# <Location latitude="51.4" lon... | Write a waypoint to the file::
writer.write_waypoint(
name='Meiersberg',
latitude=51.4,
longitude=7.1
)
# <Waypoint name="Meiersberg">
# <Location latitude="51.4" longitude="7.1"/>
# </Waypoint>
:p... | https://github.com/Turbo87/aerofiles/blob/d8b7b04a1fcea5c98f89500de1164619a4ec7ef4/aerofiles/xcsoar/writer.py#L131-L166 |
Turbo87/aerofiles | aerofiles/xcsoar/writer.py | Writer.write_observation_zone | def write_observation_zone(self, **kw):
"""
Write an observation zone declaration to the file::
writer.write_observation_zone(
type=ObservationZoneType.CYLINDER,
radius=30000,
)
# <ObservationZone type="Cylinder" radius="30000"/>
... | python | def write_observation_zone(self, **kw):
"""
Write an observation zone declaration to the file::
writer.write_observation_zone(
type=ObservationZoneType.CYLINDER,
radius=30000,
)
# <ObservationZone type="Cylinder" radius="30000"/>
... | Write an observation zone declaration to the file::
writer.write_observation_zone(
type=ObservationZoneType.CYLINDER,
radius=30000,
)
# <ObservationZone type="Cylinder" radius="30000"/>
The required parameters depend on the type parameter. D... | https://github.com/Turbo87/aerofiles/blob/d8b7b04a1fcea5c98f89500de1164619a4ec7ef4/aerofiles/xcsoar/writer.py#L168-L229 |
dreipol/djangocms-spa | djangocms_spa/models.py | DjangoCmsMixin.get_placeholder_field_names | def get_placeholder_field_names(self):
"""
Returns a list with the names of all PlaceholderFields.
"""
return [field.name for field in self._meta.fields if field.get_internal_type() == 'PlaceholderField'] | python | def get_placeholder_field_names(self):
"""
Returns a list with the names of all PlaceholderFields.
"""
return [field.name for field in self._meta.fields if field.get_internal_type() == 'PlaceholderField'] | Returns a list with the names of all PlaceholderFields. | https://github.com/dreipol/djangocms-spa/blob/eb0048eb29aef6314431c3c1800b363c40619818/djangocms_spa/models.py#L33-L37 |
GluuFederation/oxd-python | examples/flask_app/demosite.py | logout_callback | def logout_callback():
"""Route called by the OpenID provider when user logs out.
Clear the cookies here.
"""
resp = make_response('Logging Out')
resp.set_cookie('sub', 'null', expires=0)
resp.set_cookie('session_id', 'null', expires=0)
return resp | python | def logout_callback():
"""Route called by the OpenID provider when user logs out.
Clear the cookies here.
"""
resp = make_response('Logging Out')
resp.set_cookie('sub', 'null', expires=0)
resp.set_cookie('session_id', 'null', expires=0)
return resp | Route called by the OpenID provider when user logs out.
Clear the cookies here. | https://github.com/GluuFederation/oxd-python/blob/a0448cda03b4384bc50a8c20bd65eacd983bceb8/examples/flask_app/demosite.py#L50-L58 |
GluuFederation/oxd-python | oxdpython/messenger.py | SocketMessenger.__connect | def __connect(self):
"""A helper function to make connection."""
try:
logger.debug("Socket connecting to %s:%s", self.host, self.port)
self.sock.connect((self.host, self.port))
except socket.error as e:
logger.exception("socket error %s", e)
logger... | python | def __connect(self):
"""A helper function to make connection."""
try:
logger.debug("Socket connecting to %s:%s", self.host, self.port)
self.sock.connect((self.host, self.port))
except socket.error as e:
logger.exception("socket error %s", e)
logger... | A helper function to make connection. | https://github.com/GluuFederation/oxd-python/blob/a0448cda03b4384bc50a8c20bd65eacd983bceb8/oxdpython/messenger.py#L67-L77 |
GluuFederation/oxd-python | oxdpython/messenger.py | SocketMessenger.send | def send(self, command):
"""send function sends the command to the oxd server and recieves the
response.
Parameters:
* **command (dict):** Dict representation of the JSON command string
Returns:
**response (dict):** The JSON response from the oxd Server as a dic... | python | def send(self, command):
"""send function sends the command to the oxd server and recieves the
response.
Parameters:
* **command (dict):** Dict representation of the JSON command string
Returns:
**response (dict):** The JSON response from the oxd Server as a dic... | send function sends the command to the oxd server and recieves the
response.
Parameters:
* **command (dict):** Dict representation of the JSON command string
Returns:
**response (dict):** The JSON response from the oxd Server as a dict | https://github.com/GluuFederation/oxd-python/blob/a0448cda03b4384bc50a8c20bd65eacd983bceb8/oxdpython/messenger.py#L79-L137 |
GluuFederation/oxd-python | oxdpython/messenger.py | SocketMessenger.request | def request(self, command, **kwargs):
"""Function that builds the request and returns the response from
oxd-server
Parameters:
* **command (str):** The command that has to be sent to the oxd-server
* ** **kwargs:** The parameters that should accompany the request
... | python | def request(self, command, **kwargs):
"""Function that builds the request and returns the response from
oxd-server
Parameters:
* **command (str):** The command that has to be sent to the oxd-server
* ** **kwargs:** The parameters that should accompany the request
... | Function that builds the request and returns the response from
oxd-server
Parameters:
* **command (str):** The command that has to be sent to the oxd-server
* ** **kwargs:** The parameters that should accompany the request
Returns:
**dict:** the returned res... | https://github.com/GluuFederation/oxd-python/blob/a0448cda03b4384bc50a8c20bd65eacd983bceb8/oxdpython/messenger.py#L139-L160 |
GluuFederation/oxd-python | oxdpython/messenger.py | HttpMessenger.request | def request(self, command, **kwargs):
"""Function that builds the request and returns the response
Parameters:
* **command (str):** The command that has to be sent to the oxd-server
* ** **kwargs:** The parameters that should accompany the request
Returns:
*... | python | def request(self, command, **kwargs):
"""Function that builds the request and returns the response
Parameters:
* **command (str):** The command that has to be sent to the oxd-server
* ** **kwargs:** The parameters that should accompany the request
Returns:
*... | Function that builds the request and returns the response
Parameters:
* **command (str):** The command that has to be sent to the oxd-server
* ** **kwargs:** The parameters that should accompany the request
Returns:
**dict:** the returned response from oxd-server as... | https://github.com/GluuFederation/oxd-python/blob/a0448cda03b4384bc50a8c20bd65eacd983bceb8/oxdpython/messenger.py#L184-L209 |
libChEBI/libChEBIpy | libchebipy/_chebi_entity.py | main | def main():
'''Example code, showing the instantiation of a ChebiEntity, a call to
get_name(), get_outgoings() and the calling of a number of methods of the
returned Relation objects.'''
chebi_entity = ChebiEntity(15903)
print(chebi_entity.get_name())
for outgoing in chebi_entity.get_outgoings... | python | def main():
'''Example code, showing the instantiation of a ChebiEntity, a call to
get_name(), get_outgoings() and the calling of a number of methods of the
returned Relation objects.'''
chebi_entity = ChebiEntity(15903)
print(chebi_entity.get_name())
for outgoing in chebi_entity.get_outgoings... | Example code, showing the instantiation of a ChebiEntity, a call to
get_name(), get_outgoings() and the calling of a number of methods of the
returned Relation objects. | https://github.com/libChEBI/libChEBIpy/blob/89f223a91f518619d5e3910070d283adcac1626e/libchebipy/_chebi_entity.py#L270-L280 |
libChEBI/libChEBIpy | libchebipy/_chebi_entity.py | ChebiEntity.get_parent_id | def get_parent_id(self):
'''Returns parent id'''
parent_id = parsers.get_parent_id(self.__chebi_id)
return None if math.isnan(parent_id) else 'CHEBI:' + str(parent_id) | python | def get_parent_id(self):
'''Returns parent id'''
parent_id = parsers.get_parent_id(self.__chebi_id)
return None if math.isnan(parent_id) else 'CHEBI:' + str(parent_id) | Returns parent id | https://github.com/libChEBI/libChEBIpy/blob/89f223a91f518619d5e3910070d283adcac1626e/libchebipy/_chebi_entity.py#L37-L40 |
libChEBI/libChEBIpy | libchebipy/_chebi_entity.py | ChebiEntity.get_mass | def get_mass(self):
'''Returns mass'''
mass = parsers.get_mass(self.__chebi_id)
if math.isnan(mass):
mass = parsers.get_mass(self.get_parent_id())
if math.isnan(mass):
for parent_or_child_id in self.__get_all_ids():
mass = parsers.get_mass(parent... | python | def get_mass(self):
'''Returns mass'''
mass = parsers.get_mass(self.__chebi_id)
if math.isnan(mass):
mass = parsers.get_mass(self.get_parent_id())
if math.isnan(mass):
for parent_or_child_id in self.__get_all_ids():
mass = parsers.get_mass(parent... | Returns mass | https://github.com/libChEBI/libChEBIpy/blob/89f223a91f518619d5e3910070d283adcac1626e/libchebipy/_chebi_entity.py#L51-L65 |
libChEBI/libChEBIpy | libchebipy/_chebi_entity.py | ChebiEntity.get_charge | def get_charge(self):
'''Returns charge'''
charge = parsers.get_charge(self.__chebi_id)
if math.isnan(charge):
charge = parsers.get_charge(self.get_parent_id())
if math.isnan(charge):
for parent_or_child_id in self.__get_all_ids():
charge = parse... | python | def get_charge(self):
'''Returns charge'''
charge = parsers.get_charge(self.__chebi_id)
if math.isnan(charge):
charge = parsers.get_charge(self.get_parent_id())
if math.isnan(charge):
for parent_or_child_id in self.__get_all_ids():
charge = parse... | Returns charge | https://github.com/libChEBI/libChEBIpy/blob/89f223a91f518619d5e3910070d283adcac1626e/libchebipy/_chebi_entity.py#L67-L81 |
libChEBI/libChEBIpy | libchebipy/_chebi_entity.py | ChebiEntity.get_name | def get_name(self):
'''Returns name'''
name = parsers.get_name(self.__chebi_id)
if name is None:
name = parsers.get_name(self.get_parent_id())
if name is None:
for parent_or_child_id in self.__get_all_ids():
name = parsers.get_name(parent_or_chil... | python | def get_name(self):
'''Returns name'''
name = parsers.get_name(self.__chebi_id)
if name is None:
name = parsers.get_name(self.get_parent_id())
if name is None:
for parent_or_child_id in self.__get_all_ids():
name = parsers.get_name(parent_or_chil... | Returns name | https://github.com/libChEBI/libChEBIpy/blob/89f223a91f518619d5e3910070d283adcac1626e/libchebipy/_chebi_entity.py#L91-L105 |
libChEBI/libChEBIpy | libchebipy/_chebi_entity.py | ChebiEntity.get_definition | def get_definition(self):
'''Returns definition'''
definition = parsers.get_definition(self.__chebi_id)
if definition is None:
definition = parsers.get_definition(self.get_parent_id())
if definition is None:
for parent_or_child_id in self.__get_all_ids():
... | python | def get_definition(self):
'''Returns definition'''
definition = parsers.get_definition(self.__chebi_id)
if definition is None:
definition = parsers.get_definition(self.get_parent_id())
if definition is None:
for parent_or_child_id in self.__get_all_ids():
... | Returns definition | https://github.com/libChEBI/libChEBIpy/blob/89f223a91f518619d5e3910070d283adcac1626e/libchebipy/_chebi_entity.py#L107-L121 |
libChEBI/libChEBIpy | libchebipy/_chebi_entity.py | ChebiEntity.get_created_by | def get_created_by(self):
'''Returns created by'''
created_by = parsers.get_created_by(self.__chebi_id)
if created_by is None:
created_by = parsers.get_created_by(self.get_parent_id())
if created_by is None:
for parent_or_child_id in self.__get_all_ids():
... | python | def get_created_by(self):
'''Returns created by'''
created_by = parsers.get_created_by(self.__chebi_id)
if created_by is None:
created_by = parsers.get_created_by(self.get_parent_id())
if created_by is None:
for parent_or_child_id in self.__get_all_ids():
... | Returns created by | https://github.com/libChEBI/libChEBIpy/blob/89f223a91f518619d5e3910070d283adcac1626e/libchebipy/_chebi_entity.py#L127-L141 |
libChEBI/libChEBIpy | libchebipy/_chebi_entity.py | ChebiEntity.get_inchi | def get_inchi(self):
'''Returns inchi'''
inchi = parsers.get_inchi(self.__chebi_id)
if inchi is None:
inchi = parsers.get_inchi(self.get_parent_id())
if inchi is None:
for parent_or_child_id in self.__get_all_ids():
inchi = parsers.get_inchi(pare... | python | def get_inchi(self):
'''Returns inchi'''
inchi = parsers.get_inchi(self.__chebi_id)
if inchi is None:
inchi = parsers.get_inchi(self.get_parent_id())
if inchi is None:
for parent_or_child_id in self.__get_all_ids():
inchi = parsers.get_inchi(pare... | Returns inchi | https://github.com/libChEBI/libChEBIpy/blob/89f223a91f518619d5e3910070d283adcac1626e/libchebipy/_chebi_entity.py#L151-L165 |
libChEBI/libChEBIpy | libchebipy/_chebi_entity.py | ChebiEntity.get_mol | def get_mol(self):
'''Returns mol'''
structure = parsers.get_mol(self.__chebi_id)
if structure is None:
structure = parsers.get_mol(self.get_parent_id())
if structure is None:
for parent_or_child_id in self.__get_all_ids():
structure = parsers.ge... | python | def get_mol(self):
'''Returns mol'''
structure = parsers.get_mol(self.__chebi_id)
if structure is None:
structure = parsers.get_mol(self.get_parent_id())
if structure is None:
for parent_or_child_id in self.__get_all_ids():
structure = parsers.ge... | Returns mol | https://github.com/libChEBI/libChEBIpy/blob/89f223a91f518619d5e3910070d283adcac1626e/libchebipy/_chebi_entity.py#L199-L213 |
libChEBI/libChEBIpy | libchebipy/_chebi_entity.py | ChebiEntity.get_mol_filename | def get_mol_filename(self):
'''Returns mol filename'''
mol_filename = parsers.get_mol_filename(self.__chebi_id)
if mol_filename is None:
mol_filename = parsers.get_mol_filename(self.get_parent_id())
if mol_filename is None:
for parent_or_child_id in self.__get_a... | python | def get_mol_filename(self):
'''Returns mol filename'''
mol_filename = parsers.get_mol_filename(self.__chebi_id)
if mol_filename is None:
mol_filename = parsers.get_mol_filename(self.get_parent_id())
if mol_filename is None:
for parent_or_child_id in self.__get_a... | Returns mol filename | https://github.com/libChEBI/libChEBIpy/blob/89f223a91f518619d5e3910070d283adcac1626e/libchebipy/_chebi_entity.py#L215-L230 |
libChEBI/libChEBIpy | libchebipy/_chebi_entity.py | ChebiEntity.__get_all_ids | def __get_all_ids(self):
'''Returns all ids'''
if self.__all_ids is None:
parent_id = parsers.get_parent_id(self.__chebi_id)
self.__all_ids = parsers.get_all_ids(self.__chebi_id
if math.isnan(parent_id)
... | python | def __get_all_ids(self):
'''Returns all ids'''
if self.__all_ids is None:
parent_id = parsers.get_parent_id(self.__chebi_id)
self.__all_ids = parsers.get_all_ids(self.__chebi_id
if math.isnan(parent_id)
... | Returns all ids | https://github.com/libChEBI/libChEBIpy/blob/89f223a91f518619d5e3910070d283adcac1626e/libchebipy/_chebi_entity.py#L256-L267 |
GluuFederation/oxd-python | oxdpython/utils.py | Resource.set_scope | def set_scope(self, http_method, scope):
"""Set a scope condition for the resource for a http_method
Parameters:
* **http_method (str):** HTTP method like GET, POST, PUT, DELETE
* **scope (str, list):** the scope of access control as str if single, or as a list of strings if mul... | python | def set_scope(self, http_method, scope):
"""Set a scope condition for the resource for a http_method
Parameters:
* **http_method (str):** HTTP method like GET, POST, PUT, DELETE
* **scope (str, list):** the scope of access control as str if single, or as a list of strings if mul... | Set a scope condition for the resource for a http_method
Parameters:
* **http_method (str):** HTTP method like GET, POST, PUT, DELETE
* **scope (str, list):** the scope of access control as str if single, or as a list of strings if multiple scopes are to be set | https://github.com/GluuFederation/oxd-python/blob/a0448cda03b4384bc50a8c20bd65eacd983bceb8/oxdpython/utils.py#L22-L43 |
GluuFederation/oxd-python | oxdpython/utils.py | ResourceSet.add | def add(self, path):
"""Adds a new resource with the given path to the resource set.
Parameters:
* **path (str, unicode):** path of the resource to be protected
Raises:
TypeError when the path is not a string or a unicode string
"""
if not isinstance(pat... | python | def add(self, path):
"""Adds a new resource with the given path to the resource set.
Parameters:
* **path (str, unicode):** path of the resource to be protected
Raises:
TypeError when the path is not a string or a unicode string
"""
if not isinstance(pat... | Adds a new resource with the given path to the resource set.
Parameters:
* **path (str, unicode):** path of the resource to be protected
Raises:
TypeError when the path is not a string or a unicode string | https://github.com/GluuFederation/oxd-python/blob/a0448cda03b4384bc50a8c20bd65eacd983bceb8/oxdpython/utils.py#L91-L106 |
libChEBI/libChEBIpy | libchebipy/__init__.py | search | def search(term, exact=False, rows=1e6):
'''Searches ChEBI via ols.'''
url = 'https://www.ebi.ac.uk/ols/api/search?ontology=chebi' + \
'&exact=' + str(exact) + '&q=' + term + \
'&rows=' + str(int(rows))
response = requests.get(url)
data = response.json()
return [ChebiEntity(doc['ob... | python | def search(term, exact=False, rows=1e6):
'''Searches ChEBI via ols.'''
url = 'https://www.ebi.ac.uk/ols/api/search?ontology=chebi' + \
'&exact=' + str(exact) + '&q=' + term + \
'&rows=' + str(int(rows))
response = requests.get(url)
data = response.json()
return [ChebiEntity(doc['ob... | Searches ChEBI via ols. | https://github.com/libChEBI/libChEBIpy/blob/89f223a91f518619d5e3910070d283adcac1626e/libchebipy/__init__.py#L44-L53 |
GluuFederation/oxd-python | oxdpython/configurer.py | Configurer.get | def get(self, section, key):
"""get function reads the config value for the requested section and
key and returns it
Parameters:
* **section (string):** the section to look for the config value either - oxd, client
* **key (string):** the key for the config value require... | python | def get(self, section, key):
"""get function reads the config value for the requested section and
key and returns it
Parameters:
* **section (string):** the section to look for the config value either - oxd, client
* **key (string):** the key for the config value require... | get function reads the config value for the requested section and
key and returns it
Parameters:
* **section (string):** the section to look for the config value either - oxd, client
* **key (string):** the key for the config value required
Returns:
**value ... | https://github.com/GluuFederation/oxd-python/blob/a0448cda03b4384bc50a8c20bd65eacd983bceb8/oxdpython/configurer.py#L17-L36 |
GluuFederation/oxd-python | oxdpython/configurer.py | Configurer.set | def set(self, section, key, value):
"""set function sets a particular value for the specified key in the
specified section and writes it to the config file.
Parameters:
* **section (string):** the section under which the config should be saved. Only accepted values are - oxd, client... | python | def set(self, section, key, value):
"""set function sets a particular value for the specified key in the
specified section and writes it to the config file.
Parameters:
* **section (string):** the section under which the config should be saved. Only accepted values are - oxd, client... | set function sets a particular value for the specified key in the
specified section and writes it to the config file.
Parameters:
* **section (string):** the section under which the config should be saved. Only accepted values are - oxd, client
* **key (string):** the key/name ... | https://github.com/GluuFederation/oxd-python/blob/a0448cda03b4384bc50a8c20bd65eacd983bceb8/oxdpython/configurer.py#L38-L61 |
libChEBI/libChEBIpy | libchebipy/_parsers.py | get_all_formulae | def get_all_formulae(chebi_ids):
'''Returns all formulae'''
all_formulae = [get_formulae(chebi_id) for chebi_id in chebi_ids]
return [x for sublist in all_formulae for x in sublist] | python | def get_all_formulae(chebi_ids):
'''Returns all formulae'''
all_formulae = [get_formulae(chebi_id) for chebi_id in chebi_ids]
return [x for sublist in all_formulae for x in sublist] | Returns all formulae | https://github.com/libChEBI/libChEBIpy/blob/89f223a91f518619d5e3910070d283adcac1626e/libchebipy/_parsers.py#L77-L80 |
libChEBI/libChEBIpy | libchebipy/_parsers.py | get_mass | def get_mass(chebi_id):
'''Returns mass'''
if len(__MASSES) == 0:
__parse_chemical_data()
return __MASSES[chebi_id] if chebi_id in __MASSES else float('NaN') | python | def get_mass(chebi_id):
'''Returns mass'''
if len(__MASSES) == 0:
__parse_chemical_data()
return __MASSES[chebi_id] if chebi_id in __MASSES else float('NaN') | Returns mass | https://github.com/libChEBI/libChEBIpy/blob/89f223a91f518619d5e3910070d283adcac1626e/libchebipy/_parsers.py#L83-L88 |
libChEBI/libChEBIpy | libchebipy/_parsers.py | get_charge | def get_charge(chebi_id):
'''Returns charge'''
if len(__CHARGES) == 0:
__parse_chemical_data()
return __CHARGES[chebi_id] if chebi_id in __CHARGES else float('NaN') | python | def get_charge(chebi_id):
'''Returns charge'''
if len(__CHARGES) == 0:
__parse_chemical_data()
return __CHARGES[chebi_id] if chebi_id in __CHARGES else float('NaN') | Returns charge | https://github.com/libChEBI/libChEBIpy/blob/89f223a91f518619d5e3910070d283adcac1626e/libchebipy/_parsers.py#L91-L96 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.