repo
stringlengths
7
55
path
stringlengths
4
223
func_name
stringlengths
1
134
original_string
stringlengths
75
104k
language
stringclasses
1 value
code
stringlengths
75
104k
code_tokens
listlengths
19
28.4k
docstring
stringlengths
1
46.9k
docstring_tokens
listlengths
1
1.97k
sha
stringlengths
40
40
url
stringlengths
87
315
partition
stringclasses
3 values
summary
stringlengths
4
350
biosignalsnotebooks/biosignalsnotebooks
biosignalsnotebooks/build/lib/biosignalsnotebooks/extract.py
hrv_parameters
def hrv_parameters(data, sample_rate, signal=False, in_seconds=False): """ ----- Brief ----- Function for extracting HRV parameters from time and frequency domains. ----------- Description ----------- ECG signals require specific processing due to their cyclic nature. For example, i...
python
def hrv_parameters(data, sample_rate, signal=False, in_seconds=False): """ ----- Brief ----- Function for extracting HRV parameters from time and frequency domains. ----------- Description ----------- ECG signals require specific processing due to their cyclic nature. For example, i...
[ "def", "hrv_parameters", "(", "data", ",", "sample_rate", ",", "signal", "=", "False", ",", "in_seconds", "=", "False", ")", ":", "out_dict", "=", "{", "}", "# Generation of tachogram.", "tachogram_data", ",", "tachogram_time", "=", "tachogram", "(", "data", "...
----- Brief ----- Function for extracting HRV parameters from time and frequency domains. ----------- Description ----------- ECG signals require specific processing due to their cyclic nature. For example, it is expected that in similar conditions the RR peak interval to be similar, wh...
[ "-----", "Brief", "-----", "Function", "for", "extracting", "HRV", "parameters", "from", "time", "and", "frequency", "domains", "." ]
aaa01d4125180b3a34f1e26e0d3ff08c23f666d3
https://github.com/biosignalsnotebooks/biosignalsnotebooks/blob/aaa01d4125180b3a34f1e26e0d3ff08c23f666d3/biosignalsnotebooks/build/lib/biosignalsnotebooks/extract.py#L42-L194
train
This function extracts the HRV parameters from the time and frequency domains.
biosignalsnotebooks/biosignalsnotebooks
biosignalsnotebooks/build/lib/biosignalsnotebooks/extract.py
remove_ectopy
def remove_ectopy(tachogram_data, tachogram_time): """ ----- Brief ----- Function for removing ectopic beats. ----------- Description ----------- Ectopic beats are beats that are originated in cells that do not correspond to the expected pacemaker cells. These beats are identifi...
python
def remove_ectopy(tachogram_data, tachogram_time): """ ----- Brief ----- Function for removing ectopic beats. ----------- Description ----------- Ectopic beats are beats that are originated in cells that do not correspond to the expected pacemaker cells. These beats are identifi...
[ "def", "remove_ectopy", "(", "tachogram_data", ",", "tachogram_time", ")", ":", "# If the i RR interval differs from i-1 by more than 20 % then it will be removed from analysis.", "remove_margin", "=", "0.20", "finish_ectopy_remove", "=", "False", "signal", "=", "list", "(", "t...
----- Brief ----- Function for removing ectopic beats. ----------- Description ----------- Ectopic beats are beats that are originated in cells that do not correspond to the expected pacemaker cells. These beats are identifiable in ECG signals by abnormal rhythms. This function all...
[ "-----", "Brief", "-----", "Function", "for", "removing", "ectopic", "beats", "." ]
aaa01d4125180b3a34f1e26e0d3ff08c23f666d3
https://github.com/biosignalsnotebooks/biosignalsnotebooks/blob/aaa01d4125180b3a34f1e26e0d3ff08c23f666d3/biosignalsnotebooks/build/lib/biosignalsnotebooks/extract.py#L197-L265
train
This function removes the ectopy from the list of samples in the tachogram.
biosignalsnotebooks/biosignalsnotebooks
biosignalsnotebooks/build/lib/biosignalsnotebooks/extract.py
psd
def psd(tachogram_time, tachogram_data): """ ----- Brief ----- Determination of the Power Spectral Density Function (Fourier Domain) ----------- Description ----------- The Power Spectral Density Function allows to perceive the behavior of a given signal in terms of its frequency. ...
python
def psd(tachogram_time, tachogram_data): """ ----- Brief ----- Determination of the Power Spectral Density Function (Fourier Domain) ----------- Description ----------- The Power Spectral Density Function allows to perceive the behavior of a given signal in terms of its frequency. ...
[ "def", "psd", "(", "tachogram_time", ",", "tachogram_data", ")", ":", "init_time", "=", "tachogram_time", "[", "0", "]", "fin_time", "=", "tachogram_time", "[", "-", "1", "]", "tck", "=", "interpol", ".", "splrep", "(", "tachogram_time", ",", "tachogram_data...
----- Brief ----- Determination of the Power Spectral Density Function (Fourier Domain) ----------- Description ----------- The Power Spectral Density Function allows to perceive the behavior of a given signal in terms of its frequency. This procedure costs the time resolution of the si...
[ "-----", "Brief", "-----", "Determination", "of", "the", "Power", "Spectral", "Density", "Function", "(", "Fourier", "Domain", ")" ]
aaa01d4125180b3a34f1e26e0d3ff08c23f666d3
https://github.com/biosignalsnotebooks/biosignalsnotebooks/blob/aaa01d4125180b3a34f1e26e0d3ff08c23f666d3/biosignalsnotebooks/build/lib/biosignalsnotebooks/extract.py#L268-L315
train
This function constructs the frequency domain and power axis of a single tachogram.
biosignalsnotebooks/biosignalsnotebooks
biosignalsnotebooks/build/lib/biosignalsnotebooks/extract.py
emg_parameters
def emg_parameters(data, sample_rate, raw_to_mv=True, device="biosignalsplux", resolution=16): """ ----- Brief ----- Function for extracting EMG parameters from time and frequency domains. ----------- Description ----------- EMG signals have specific properties that are different fr...
python
def emg_parameters(data, sample_rate, raw_to_mv=True, device="biosignalsplux", resolution=16): """ ----- Brief ----- Function for extracting EMG parameters from time and frequency domains. ----------- Description ----------- EMG signals have specific properties that are different fr...
[ "def", "emg_parameters", "(", "data", ",", "sample_rate", ",", "raw_to_mv", "=", "True", ",", "device", "=", "\"biosignalsplux\"", ",", "resolution", "=", "16", ")", ":", "out_dict", "=", "{", "}", "# Conversion of data samples to mV if requested by raw_to_mv input.",...
----- Brief ----- Function for extracting EMG parameters from time and frequency domains. ----------- Description ----------- EMG signals have specific properties that are different from other biosignals. For example, it is not periodic, contrary to ECG signals. This type of biosign...
[ "-----", "Brief", "-----", "Function", "for", "extracting", "EMG", "parameters", "from", "time", "and", "frequency", "domains", "." ]
aaa01d4125180b3a34f1e26e0d3ff08c23f666d3
https://github.com/biosignalsnotebooks/biosignalsnotebooks/blob/aaa01d4125180b3a34f1e26e0d3ff08c23f666d3/biosignalsnotebooks/build/lib/biosignalsnotebooks/extract.py#L318-L437
train
This function extracts EMG parameters from time and frequency domains.
biosignalsnotebooks/biosignalsnotebooks
biosignalsnotebooks/build/lib/biosignalsnotebooks/extract.py
fatigue_eval_med_freq
def fatigue_eval_med_freq(data, sample_rate, time_units=True, raw_to_mv=True, device="biosignalsplux", resolution=16, show_plot=False): """ ----- Brief ----- Returns the evolution time series of EMG median frequency along the acquisition, based on a sliding window mecha...
python
def fatigue_eval_med_freq(data, sample_rate, time_units=True, raw_to_mv=True, device="biosignalsplux", resolution=16, show_plot=False): """ ----- Brief ----- Returns the evolution time series of EMG median frequency along the acquisition, based on a sliding window mecha...
[ "def", "fatigue_eval_med_freq", "(", "data", ",", "sample_rate", ",", "time_units", "=", "True", ",", "raw_to_mv", "=", "True", ",", "device", "=", "\"biosignalsplux\"", ",", "resolution", "=", "16", ",", "show_plot", "=", "False", ")", ":", "# Conversion of d...
----- Brief ----- Returns the evolution time series of EMG median frequency along the acquisition, based on a sliding window mechanism. ----------- Description ----------- The median frequency of activation events in EMG signal is particularly important in fatigue evaluation methods. ...
[ "-----", "Brief", "-----", "Returns", "the", "evolution", "time", "series", "of", "EMG", "median", "frequency", "along", "the", "acquisition", "based", "on", "a", "sliding", "window", "mechanism", "." ]
aaa01d4125180b3a34f1e26e0d3ff08c23f666d3
https://github.com/biosignalsnotebooks/biosignalsnotebooks/blob/aaa01d4125180b3a34f1e26e0d3ff08c23f666d3/biosignalsnotebooks/build/lib/biosignalsnotebooks/extract.py#L440-L559
train
This function calculates the evolution time series of the median frequency of activation events in the given EMG signal.
KE-works/pykechain
pykechain/models/property.py
Property.part
def part(self): """Retrieve the part that holds this Property. :returns: The :class:`Part` associated to this property :raises APIError: if the `Part` is not found """ part_id = self._json_data['part'] return self._client.part(pk=part_id, category=self._json_data['categ...
python
def part(self): """Retrieve the part that holds this Property. :returns: The :class:`Part` associated to this property :raises APIError: if the `Part` is not found """ part_id = self._json_data['part'] return self._client.part(pk=part_id, category=self._json_data['categ...
[ "def", "part", "(", "self", ")", ":", "part_id", "=", "self", ".", "_json_data", "[", "'part'", "]", "return", "self", ".", "_client", ".", "part", "(", "pk", "=", "part_id", ",", "category", "=", "self", ".", "_json_data", "[", "'category'", "]", ")...
Retrieve the part that holds this Property. :returns: The :class:`Part` associated to this property :raises APIError: if the `Part` is not found
[ "Retrieve", "the", "part", "that", "holds", "this", "Property", "." ]
b0296cf34328fd41660bf6f0b9114fd0167c40c4
https://github.com/KE-works/pykechain/blob/b0296cf34328fd41660bf6f0b9114fd0167c40c4/pykechain/models/property.py#L110-L118
train
Retrieve the Part that holds this Property.
KE-works/pykechain
pykechain/models/property.py
Property.delete
def delete(self): # type () -> () """Delete this property. :return: None :raises APIError: if delete was not successful """ r = self._client._request('DELETE', self._client._build_url('property', property_id=self.id)) if r.status_code != requests.codes.no_conten...
python
def delete(self): # type () -> () """Delete this property. :return: None :raises APIError: if delete was not successful """ r = self._client._request('DELETE', self._client._build_url('property', property_id=self.id)) if r.status_code != requests.codes.no_conten...
[ "def", "delete", "(", "self", ")", ":", "# type () -> ()", "r", "=", "self", ".", "_client", ".", "_request", "(", "'DELETE'", ",", "self", ".", "_client", ".", "_build_url", "(", "'property'", ",", "property_id", "=", "self", ".", "id", ")", ")", "if"...
Delete this property. :return: None :raises APIError: if delete was not successful
[ "Delete", "this", "property", "." ]
b0296cf34328fd41660bf6f0b9114fd0167c40c4
https://github.com/KE-works/pykechain/blob/b0296cf34328fd41660bf6f0b9114fd0167c40c4/pykechain/models/property.py#L120-L130
train
Delete this property.
KE-works/pykechain
pykechain/models/property.py
Property.create
def create(cls, json, **kwargs): # type: (dict, **Any) -> Property """Create a property based on the json data. This method will attach the right class to a property, enabling the use of type-specific methods. It does not create a property object in KE-chain. But a pseudo :class:`Prope...
python
def create(cls, json, **kwargs): # type: (dict, **Any) -> Property """Create a property based on the json data. This method will attach the right class to a property, enabling the use of type-specific methods. It does not create a property object in KE-chain. But a pseudo :class:`Prope...
[ "def", "create", "(", "cls", ",", "json", ",", "*", "*", "kwargs", ")", ":", "# type: (dict, **Any) -> Property", "property_type", "=", "json", ".", "get", "(", "'property_type'", ")", "if", "property_type", "==", "PropertyType", ".", "ATTACHMENT_VALUE", ":", ...
Create a property based on the json data. This method will attach the right class to a property, enabling the use of type-specific methods. It does not create a property object in KE-chain. But a pseudo :class:`Property` object. :param json: the json from which the :class:`Property` object to...
[ "Create", "a", "property", "based", "on", "the", "json", "data", "." ]
b0296cf34328fd41660bf6f0b9114fd0167c40c4
https://github.com/KE-works/pykechain/blob/b0296cf34328fd41660bf6f0b9114fd0167c40c4/pykechain/models/property.py#L143-L170
train
Create a property based on the json data.
KE-works/pykechain
pykechain/models/property.py
Property.edit
def edit(self, name=None, description=None, unit=None, options=None, **kwargs): """ Edit the details of a property (model). :param name: (optional) new name of the property to edit :type name: basestring or None :param description: (optional) new description of the property ...
python
def edit(self, name=None, description=None, unit=None, options=None, **kwargs): """ Edit the details of a property (model). :param name: (optional) new name of the property to edit :type name: basestring or None :param description: (optional) new description of the property ...
[ "def", "edit", "(", "self", ",", "name", "=", "None", ",", "description", "=", "None", ",", "unit", "=", "None", ",", "options", "=", "None", ",", "*", "*", "kwargs", ")", ":", "update_dict", "=", "{", "'id'", ":", "self", ".", "id", "}", "if", ...
Edit the details of a property (model). :param name: (optional) new name of the property to edit :type name: basestring or None :param description: (optional) new description of the property :type description: basestring or None :param unit: (optional) new unit of the property ...
[ "Edit", "the", "details", "of", "a", "property", "(", "model", ")", "." ]
b0296cf34328fd41660bf6f0b9114fd0167c40c4
https://github.com/KE-works/pykechain/blob/b0296cf34328fd41660bf6f0b9114fd0167c40c4/pykechain/models/property.py#L172-L240
train
Edit the details of a property.
KE-works/pykechain
pykechain/models/property.py
Property.__parse_validators
def __parse_validators(self): """Parse the validator in the options to validators.""" self._validators = [] validators_json = self._options.get('validators') for validator_json in validators_json: self._validators.append(PropertyValidator.parse(json=validator_json))
python
def __parse_validators(self): """Parse the validator in the options to validators.""" self._validators = [] validators_json = self._options.get('validators') for validator_json in validators_json: self._validators.append(PropertyValidator.parse(json=validator_json))
[ "def", "__parse_validators", "(", "self", ")", ":", "self", ".", "_validators", "=", "[", "]", "validators_json", "=", "self", ".", "_options", ".", "get", "(", "'validators'", ")", "for", "validator_json", "in", "validators_json", ":", "self", ".", "_valida...
Parse the validator in the options to validators.
[ "Parse", "the", "validator", "in", "the", "options", "to", "validators", "." ]
b0296cf34328fd41660bf6f0b9114fd0167c40c4
https://github.com/KE-works/pykechain/blob/b0296cf34328fd41660bf6f0b9114fd0167c40c4/pykechain/models/property.py#L242-L247
train
Parse the validators in the options to validators.
KE-works/pykechain
pykechain/models/property.py
Property.__dump_validators
def __dump_validators(self): """Dump the validators as json inside the _options dictionary with the key `validators`.""" if hasattr(self, '_validators'): validators_json = [] for validator in self._validators: if isinstance(validator, PropertyValidator): ...
python
def __dump_validators(self): """Dump the validators as json inside the _options dictionary with the key `validators`.""" if hasattr(self, '_validators'): validators_json = [] for validator in self._validators: if isinstance(validator, PropertyValidator): ...
[ "def", "__dump_validators", "(", "self", ")", ":", "if", "hasattr", "(", "self", ",", "'_validators'", ")", ":", "validators_json", "=", "[", "]", "for", "validator", "in", "self", ".", "_validators", ":", "if", "isinstance", "(", "validator", ",", "Proper...
Dump the validators as json inside the _options dictionary with the key `validators`.
[ "Dump", "the", "validators", "as", "json", "inside", "the", "_options", "dictionary", "with", "the", "key", "validators", "." ]
b0296cf34328fd41660bf6f0b9114fd0167c40c4
https://github.com/KE-works/pykechain/blob/b0296cf34328fd41660bf6f0b9114fd0167c40c4/pykechain/models/property.py#L249-L265
train
Dump the validators as json inside the _options dictionary with the key validators.
KE-works/pykechain
pykechain/models/property.py
Property.is_valid
def is_valid(self): # type: () -> Union[bool, None] """Determine if the value in the property is valid. If the value of the property is validated as 'valid', than returns a True, otherwise a False. When no validators are configured, returns a None. It checks against all configured valid...
python
def is_valid(self): # type: () -> Union[bool, None] """Determine if the value in the property is valid. If the value of the property is validated as 'valid', than returns a True, otherwise a False. When no validators are configured, returns a None. It checks against all configured valid...
[ "def", "is_valid", "(", "self", ")", ":", "# type: () -> Union[bool, None]", "if", "not", "hasattr", "(", "self", ",", "'_validators'", ")", ":", "return", "None", "else", ":", "self", ".", "validate", "(", "reason", "=", "False", ")", "if", "all", "(", ...
Determine if the value in the property is valid. If the value of the property is validated as 'valid', than returns a True, otherwise a False. When no validators are configured, returns a None. It checks against all configured validators and returns a single boolean outcome. :returns: ...
[ "Determine", "if", "the", "value", "in", "the", "property", "is", "valid", "." ]
b0296cf34328fd41660bf6f0b9114fd0167c40c4
https://github.com/KE-works/pykechain/blob/b0296cf34328fd41660bf6f0b9114fd0167c40c4/pykechain/models/property.py#L268-L286
train
Checks if the value in the property is valid.
KE-works/pykechain
pykechain/models/property.py
Property.validate
def validate(self, reason=True): # type: (bool) -> list """Return the validation results and include an (optional) reason. If reason keyword is true, the validation is returned for each validation the [(<result: bool>, <reason:str>), ...]. If reason is False, only a single list of valid...
python
def validate(self, reason=True): # type: (bool) -> list """Return the validation results and include an (optional) reason. If reason keyword is true, the validation is returned for each validation the [(<result: bool>, <reason:str>), ...]. If reason is False, only a single list of valid...
[ "def", "validate", "(", "self", ",", "reason", "=", "True", ")", ":", "# type: (bool) -> list", "self", ".", "_validation_results", "=", "[", "validator", ".", "is_valid", "(", "self", ".", "_value", ")", "for", "validator", "in", "getattr", "(", "self", "...
Return the validation results and include an (optional) reason. If reason keyword is true, the validation is returned for each validation the [(<result: bool>, <reason:str>), ...]. If reason is False, only a single list of validation results for each configured validator is returned. :...
[ "Return", "the", "validation", "results", "and", "include", "an", "(", "optional", ")", "reason", "." ]
b0296cf34328fd41660bf6f0b9114fd0167c40c4
https://github.com/KE-works/pykechain/blob/b0296cf34328fd41660bf6f0b9114fd0167c40c4/pykechain/models/property.py#L305-L326
train
Return the validation results and include an optional reason.
fprimex/zdeskcfg
zdeskcfg.py
get_ini_config
def get_ini_config(config=os.path.join(os.path.expanduser('~'), '.zdeskcfg'), default_section=None, section=None): """This is a convenience function for getting the zdesk configuration from an ini file without the need to decorate and call your own function. Handy when using zdesk and zdeskcfg from ...
python
def get_ini_config(config=os.path.join(os.path.expanduser('~'), '.zdeskcfg'), default_section=None, section=None): """This is a convenience function for getting the zdesk configuration from an ini file without the need to decorate and call your own function. Handy when using zdesk and zdeskcfg from ...
[ "def", "get_ini_config", "(", "config", "=", "os", ".", "path", ".", "join", "(", "os", ".", "path", ".", "expanduser", "(", "'~'", ")", ",", "'.zdeskcfg'", ")", ",", "default_section", "=", "None", ",", "section", "=", "None", ")", ":", "plac_ini", ...
This is a convenience function for getting the zdesk configuration from an ini file without the need to decorate and call your own function. Handy when using zdesk and zdeskcfg from the interactive prompt.
[ "This", "is", "a", "convenience", "function", "for", "getting", "the", "zdesk", "configuration", "from", "an", "ini", "file", "without", "the", "need", "to", "decorate", "and", "call", "your", "own", "function", ".", "Handy", "when", "using", "zdesk", "and",...
4283733123a62c0ab7679ca8aba0d4b02e6bb8d7
https://github.com/fprimex/zdeskcfg/blob/4283733123a62c0ab7679ca8aba0d4b02e6bb8d7/zdeskcfg.py#L165-L171
train
This function is used to get the zdesk configuration from an ini file.
fprimex/zdeskcfg
zdeskcfg.py
configure.getconfig
def getconfig(self, section=None): """ This method provides a way for decorated functions to get the four new configuration parameters *after* it has been called. If no section is specified, then the fully resolved zdesk config will be returned. That is defaults, zdesk ini secti...
python
def getconfig(self, section=None): """ This method provides a way for decorated functions to get the four new configuration parameters *after* it has been called. If no section is specified, then the fully resolved zdesk config will be returned. That is defaults, zdesk ini secti...
[ "def", "getconfig", "(", "self", ",", "section", "=", "None", ")", ":", "if", "not", "section", ":", "return", "self", ".", "__config", ".", "copy", "(", ")", "cmd_line", "=", "{", "}", "for", "k", "in", "self", ".", "__config", ":", "v", "=", "s...
This method provides a way for decorated functions to get the four new configuration parameters *after* it has been called. If no section is specified, then the fully resolved zdesk config will be returned. That is defaults, zdesk ini section, command line options. If a section...
[ "This", "method", "provides", "a", "way", "for", "decorated", "functions", "to", "get", "the", "four", "new", "configuration", "parameters", "*", "after", "*", "it", "has", "been", "called", "." ]
4283733123a62c0ab7679ca8aba0d4b02e6bb8d7
https://github.com/fprimex/zdeskcfg/blob/4283733123a62c0ab7679ca8aba0d4b02e6bb8d7/zdeskcfg.py#L109-L155
train
This method returns the configuration parameters from the specified section.
biosignalsnotebooks/biosignalsnotebooks
biosignalsnotebooks/build/lib/biosignalsnotebooks/detect.py
detect_r_peaks
def detect_r_peaks(ecg_signal, sample_rate, time_units=False, volts=False, resolution=None, device="biosignalsplux", plot_result=False): """ ----- Brief ----- Python implementation of R peak detection algorithm (proposed by Raja Selvaraj). ----------- Description ----...
python
def detect_r_peaks(ecg_signal, sample_rate, time_units=False, volts=False, resolution=None, device="biosignalsplux", plot_result=False): """ ----- Brief ----- Python implementation of R peak detection algorithm (proposed by Raja Selvaraj). ----------- Description ----...
[ "def", "detect_r_peaks", "(", "ecg_signal", ",", "sample_rate", ",", "time_units", "=", "False", ",", "volts", "=", "False", ",", "resolution", "=", "None", ",", "device", "=", "\"biosignalsplux\"", ",", "plot_result", "=", "False", ")", ":", "if", "volts", ...
----- Brief ----- Python implementation of R peak detection algorithm (proposed by Raja Selvaraj). ----------- Description ----------- Pan-Tompkins algorithm is one of the gold-standard algorithms in R-peak detection on ECG due to its low computational complexity, which allows for real-...
[ "-----", "Brief", "-----", "Python", "implementation", "of", "R", "peak", "detection", "algorithm", "(", "proposed", "by", "Raja", "Selvaraj", ")", "." ]
aaa01d4125180b3a34f1e26e0d3ff08c23f666d3
https://github.com/biosignalsnotebooks/biosignalsnotebooks/blob/aaa01d4125180b3a34f1e26e0d3ff08c23f666d3/biosignalsnotebooks/build/lib/biosignalsnotebooks/detect.py#L79-L198
train
This function returns the R peak position in the specified ECG signal and the R peak amplitude in raw units.
biosignalsnotebooks/biosignalsnotebooks
biosignalsnotebooks/build/lib/biosignalsnotebooks/detect.py
detect_emg_activations
def detect_emg_activations(emg_signal, sample_rate, smooth_level=20, threshold_level=10, time_units=False, volts=False, resolution=None, device="biosignalsplux", plot_result=False): """ ----- Brief ----- Python implementation of Burst detection a...
python
def detect_emg_activations(emg_signal, sample_rate, smooth_level=20, threshold_level=10, time_units=False, volts=False, resolution=None, device="biosignalsplux", plot_result=False): """ ----- Brief ----- Python implementation of Burst detection a...
[ "def", "detect_emg_activations", "(", "emg_signal", ",", "sample_rate", ",", "smooth_level", "=", "20", ",", "threshold_level", "=", "10", ",", "time_units", "=", "False", ",", "volts", "=", "False", ",", "resolution", "=", "None", ",", "device", "=", "\"bio...
----- Brief ----- Python implementation of Burst detection algorithm using Teager Kaiser Energy Operator. ----------- Description ----------- Activation events in EMG readings correspond to an increase of muscular activity, namely, from inaction to action. These events are characterised...
[ "-----", "Brief", "-----", "Python", "implementation", "of", "Burst", "detection", "algorithm", "using", "Teager", "Kaiser", "Energy", "Operator", "." ]
aaa01d4125180b3a34f1e26e0d3ff08c23f666d3
https://github.com/biosignalsnotebooks/biosignalsnotebooks/blob/aaa01d4125180b3a34f1e26e0d3ff08c23f666d3/biosignalsnotebooks/build/lib/biosignalsnotebooks/detect.py#L201-L357
train
This function detects activation events in a given EMG signal and returns the corresponding bursts.
biosignalsnotebooks/biosignalsnotebooks
biosignalsnotebooks/build/lib/biosignalsnotebooks/detect.py
_ecg_band_pass_filter
def _ecg_band_pass_filter(data, sample_rate): """ Bandpass filter with a bandpass setting of 5 to 15 Hz ---------- Parameters ---------- data : list List with the ECG signal samples. sample_rate : int Sampling rate at which the acquisition took place. Returns ------...
python
def _ecg_band_pass_filter(data, sample_rate): """ Bandpass filter with a bandpass setting of 5 to 15 Hz ---------- Parameters ---------- data : list List with the ECG signal samples. sample_rate : int Sampling rate at which the acquisition took place. Returns ------...
[ "def", "_ecg_band_pass_filter", "(", "data", ",", "sample_rate", ")", ":", "nyquist_sample_rate", "=", "sample_rate", "/", "2.", "normalized_cut_offs", "=", "[", "5", "/", "nyquist_sample_rate", ",", "15", "/", "nyquist_sample_rate", "]", "b_coeff", ",", "a_coeff"...
Bandpass filter with a bandpass setting of 5 to 15 Hz ---------- Parameters ---------- data : list List with the ECG signal samples. sample_rate : int Sampling rate at which the acquisition took place. Returns ------- out : list Filtered signal.
[ "Bandpass", "filter", "with", "a", "bandpass", "setting", "of", "5", "to", "15", "Hz" ]
aaa01d4125180b3a34f1e26e0d3ff08c23f666d3
https://github.com/biosignalsnotebooks/biosignalsnotebooks/blob/aaa01d4125180b3a34f1e26e0d3ff08c23f666d3/biosignalsnotebooks/build/lib/biosignalsnotebooks/detect.py#L365-L385
train
Filter the data with a bandpass setting of 5 to 15 Hz.
biosignalsnotebooks/biosignalsnotebooks
biosignalsnotebooks/build/lib/biosignalsnotebooks/detect.py
_integration
def _integration(data, sample_rate): """ Moving window integration. N is the number of samples in the width of the integration window ---------- Parameters ---------- data : ndarray Samples of the signal where a moving window integration will be applied. sample_rate : int ...
python
def _integration(data, sample_rate): """ Moving window integration. N is the number of samples in the width of the integration window ---------- Parameters ---------- data : ndarray Samples of the signal where a moving window integration will be applied. sample_rate : int ...
[ "def", "_integration", "(", "data", ",", "sample_rate", ")", ":", "wind_size", "=", "int", "(", "0.080", "*", "sample_rate", ")", "int_ecg", "=", "numpy", ".", "zeros_like", "(", "data", ")", "cum_sum", "=", "data", ".", "cumsum", "(", ")", "int_ecg", ...
Moving window integration. N is the number of samples in the width of the integration window ---------- Parameters ---------- data : ndarray Samples of the signal where a moving window integration will be applied. sample_rate : int Sampling rate at which the acquisition took pla...
[ "Moving", "window", "integration", ".", "N", "is", "the", "number", "of", "samples", "in", "the", "width", "of", "the", "integration", "window" ]
aaa01d4125180b3a34f1e26e0d3ff08c23f666d3
https://github.com/biosignalsnotebooks/biosignalsnotebooks/blob/aaa01d4125180b3a34f1e26e0d3ff08c23f666d3/biosignalsnotebooks/build/lib/biosignalsnotebooks/detect.py#L428-L452
train
Moving window integration.
biosignalsnotebooks/biosignalsnotebooks
biosignalsnotebooks/build/lib/biosignalsnotebooks/detect.py
_buffer_ini
def _buffer_ini(data, sample_rate): """ Initializes the buffer with eight 1s intervals ---------- Parameters ---------- data : ndarray Pre-processed ECG signal samples. sample_rate : int Sampling rate at which the acquisition took place. Returns ------- rr_buffe...
python
def _buffer_ini(data, sample_rate): """ Initializes the buffer with eight 1s intervals ---------- Parameters ---------- data : ndarray Pre-processed ECG signal samples. sample_rate : int Sampling rate at which the acquisition took place. Returns ------- rr_buffe...
[ "def", "_buffer_ini", "(", "data", ",", "sample_rate", ")", ":", "rr_buffer", "=", "[", "1", "]", "*", "8", "spk1", "=", "max", "(", "data", "[", "sample_rate", ":", "2", "*", "sample_rate", "]", ")", "npk1", "=", "0", "threshold", "=", "_buffer_upda...
Initializes the buffer with eight 1s intervals ---------- Parameters ---------- data : ndarray Pre-processed ECG signal samples. sample_rate : int Sampling rate at which the acquisition took place. Returns ------- rr_buffer : list Data structure that stores eigh...
[ "Initializes", "the", "buffer", "with", "eight", "1s", "intervals" ]
aaa01d4125180b3a34f1e26e0d3ff08c23f666d3
https://github.com/biosignalsnotebooks/biosignalsnotebooks/blob/aaa01d4125180b3a34f1e26e0d3ff08c23f666d3/biosignalsnotebooks/build/lib/biosignalsnotebooks/detect.py#L455-L493
train
Returns the buffer for the given data and sample_rate.
biosignalsnotebooks/biosignalsnotebooks
biosignalsnotebooks/build/lib/biosignalsnotebooks/detect.py
_detects_peaks
def _detects_peaks(ecg_integrated, sample_rate): """ Detects peaks from local maximum ---------- Parameters ---------- ecg_integrated : ndarray Array that contains the samples of the integrated signal. sample_rate : int Sampling rate at which the acquisition took place. ...
python
def _detects_peaks(ecg_integrated, sample_rate): """ Detects peaks from local maximum ---------- Parameters ---------- ecg_integrated : ndarray Array that contains the samples of the integrated signal. sample_rate : int Sampling rate at which the acquisition took place. ...
[ "def", "_detects_peaks", "(", "ecg_integrated", ",", "sample_rate", ")", ":", "# Minimum RR interval = 200 ms", "min_rr", "=", "(", "sample_rate", "/", "1000", ")", "*", "200", "# Computes all possible peaks and their amplitudes", "possible_peaks", "=", "[", "i", "for",...
Detects peaks from local maximum ---------- Parameters ---------- ecg_integrated : ndarray Array that contains the samples of the integrated signal. sample_rate : int Sampling rate at which the acquisition took place. Returns ------- choosen_peaks : list List of...
[ "Detects", "peaks", "from", "local", "maximum" ]
aaa01d4125180b3a34f1e26e0d3ff08c23f666d3
https://github.com/biosignalsnotebooks/biosignalsnotebooks/blob/aaa01d4125180b3a34f1e26e0d3ff08c23f666d3/biosignalsnotebooks/build/lib/biosignalsnotebooks/detect.py#L521-L570
train
Detects local maximums from the integrated signal and returns the list of local maximums that are not yet in the local maximums.
biosignalsnotebooks/biosignalsnotebooks
biosignalsnotebooks/build/lib/biosignalsnotebooks/detect.py
_checkup
def _checkup(peaks, ecg_integrated, sample_rate, rr_buffer, spk1, npk1, threshold): """ Check each peak according to thresholds ---------- Parameters ---------- peaks : list List of local maximums that pass the first stage of conditions needed to be considered as an R peak. ...
python
def _checkup(peaks, ecg_integrated, sample_rate, rr_buffer, spk1, npk1, threshold): """ Check each peak according to thresholds ---------- Parameters ---------- peaks : list List of local maximums that pass the first stage of conditions needed to be considered as an R peak. ...
[ "def", "_checkup", "(", "peaks", ",", "ecg_integrated", ",", "sample_rate", ",", "rr_buffer", ",", "spk1", ",", "npk1", ",", "threshold", ")", ":", "peaks_amp", "=", "[", "ecg_integrated", "[", "peak", "]", "for", "peak", "in", "peaks", "]", "definitive_pe...
Check each peak according to thresholds ---------- Parameters ---------- peaks : list List of local maximums that pass the first stage of conditions needed to be considered as an R peak. ecg_integrated : ndarray Array that contains the samples of the integrated signal. s...
[ "Check", "each", "peak", "according", "to", "thresholds" ]
aaa01d4125180b3a34f1e26e0d3ff08c23f666d3
https://github.com/biosignalsnotebooks/biosignalsnotebooks/blob/aaa01d4125180b3a34f1e26e0d3ff08c23f666d3/biosignalsnotebooks/build/lib/biosignalsnotebooks/detect.py#L573-L638
train
Checks each peak according to thresholds and returns a new list of local maximums that are not yet in the R peak.
biosignalsnotebooks/biosignalsnotebooks
biosignalsnotebooks/build/lib/biosignalsnotebooks/detect.py
_acceptpeak
def _acceptpeak(peak, amp, definitive_peaks, spk1, rr_buffer): """ Private function intended to insert a new RR interval in the buffer. ---------- Parameters ---------- peak : int Sample where the peak under analysis is located. amp : int Amplitude of the peak under analysis...
python
def _acceptpeak(peak, amp, definitive_peaks, spk1, rr_buffer): """ Private function intended to insert a new RR interval in the buffer. ---------- Parameters ---------- peak : int Sample where the peak under analysis is located. amp : int Amplitude of the peak under analysis...
[ "def", "_acceptpeak", "(", "peak", ",", "amp", ",", "definitive_peaks", ",", "spk1", ",", "rr_buffer", ")", ":", "definitive_peaks_out", "=", "definitive_peaks", "definitive_peaks_out", "=", "numpy", ".", "append", "(", "definitive_peaks_out", ",", "peak", ")", ...
Private function intended to insert a new RR interval in the buffer. ---------- Parameters ---------- peak : int Sample where the peak under analysis is located. amp : int Amplitude of the peak under analysis. definitive_peaks : list List with the definitive_peaks stored...
[ "Private", "function", "intended", "to", "insert", "a", "new", "RR", "interval", "in", "the", "buffer", "." ]
aaa01d4125180b3a34f1e26e0d3ff08c23f666d3
https://github.com/biosignalsnotebooks/biosignalsnotebooks/blob/aaa01d4125180b3a34f1e26e0d3ff08c23f666d3/biosignalsnotebooks/build/lib/biosignalsnotebooks/detect.py#L641-L678
train
Private function that creates a new node for a given peak.
biosignalsnotebooks/biosignalsnotebooks
biosignalsnotebooks/build/lib/biosignalsnotebooks/detect.py
tachogram
def tachogram(data, sample_rate, signal=False, in_seconds=False, out_seconds=False): """ Function for generation of ECG Tachogram. ---------- Parameters ---------- data : list ECG signal or R peak list. When the input is a raw signal the input flag signal should be True. sa...
python
def tachogram(data, sample_rate, signal=False, in_seconds=False, out_seconds=False): """ Function for generation of ECG Tachogram. ---------- Parameters ---------- data : list ECG signal or R peak list. When the input is a raw signal the input flag signal should be True. sa...
[ "def", "tachogram", "(", "data", ",", "sample_rate", ",", "signal", "=", "False", ",", "in_seconds", "=", "False", ",", "out_seconds", "=", "False", ")", ":", "if", "signal", "is", "False", ":", "# data is a list of R peaks position.", "data_copy", "=", "data"...
Function for generation of ECG Tachogram. ---------- Parameters ---------- data : list ECG signal or R peak list. When the input is a raw signal the input flag signal should be True. sample_rate : int Sampling frequency. signal : boolean If True, then the data ...
[ "Function", "for", "generation", "of", "ECG", "Tachogram", "." ]
aaa01d4125180b3a34f1e26e0d3ff08c23f666d3
https://github.com/biosignalsnotebooks/biosignalsnotebooks/blob/aaa01d4125180b3a34f1e26e0d3ff08c23f666d3/biosignalsnotebooks/build/lib/biosignalsnotebooks/detect.py#L704-L750
train
Function for generating of ECG Tachograms.
biosignalsnotebooks/biosignalsnotebooks
biosignalsnotebooks/build/lib/biosignalsnotebooks/detect.py
_thres_norm_reg
def _thres_norm_reg(threshold_level, signal, pre_smooth_signal): """ Regression function that with a percent input gives an absolute value of the threshold level (used in the muscular activation detection algorithm). Converts a relative threshold level to an absolute value. ---------- Parameter...
python
def _thres_norm_reg(threshold_level, signal, pre_smooth_signal): """ Regression function that with a percent input gives an absolute value of the threshold level (used in the muscular activation detection algorithm). Converts a relative threshold level to an absolute value. ---------- Parameter...
[ "def", "_thres_norm_reg", "(", "threshold_level", ",", "signal", ",", "pre_smooth_signal", ")", ":", "avg_signal", "=", "numpy", ".", "average", "(", "pre_smooth_signal", ")", "std_signal", "=", "numpy", ".", "std", "(", "pre_smooth_signal", ")", "threshold_0_perc...
Regression function that with a percent input gives an absolute value of the threshold level (used in the muscular activation detection algorithm). Converts a relative threshold level to an absolute value. ---------- Parameters ---------- threshold_level : int Percentage value that defi...
[ "Regression", "function", "that", "with", "a", "percent", "input", "gives", "an", "absolute", "value", "of", "the", "threshold", "level", "(", "used", "in", "the", "muscular", "activation", "detection", "algorithm", ")", ".", "Converts", "a", "relative", "thre...
aaa01d4125180b3a34f1e26e0d3ff08c23f666d3
https://github.com/biosignalsnotebooks/biosignalsnotebooks/blob/aaa01d4125180b3a34f1e26e0d3ff08c23f666d3/biosignalsnotebooks/build/lib/biosignalsnotebooks/detect.py#L755-L785
train
This function is used to normalize the threshold level of a given set of EMG smoothed signal samples.
thomasdelaet/python-velbus
velbus/connections/serial.py
VelbusUSBConnection.stop
def stop(self): """Close serial port.""" self.logger.warning("Stop executed") try: self._reader.close() except serial.serialutil.SerialException: self.logger.error("Error while closing device") raise VelbusException("Error while closing device") ...
python
def stop(self): """Close serial port.""" self.logger.warning("Stop executed") try: self._reader.close() except serial.serialutil.SerialException: self.logger.error("Error while closing device") raise VelbusException("Error while closing device") ...
[ "def", "stop", "(", "self", ")", ":", "self", ".", "logger", ".", "warning", "(", "\"Stop executed\"", ")", "try", ":", "self", ".", "_reader", ".", "close", "(", ")", "except", "serial", ".", "serialutil", ".", "SerialException", ":", "self", ".", "lo...
Close serial port.
[ "Close", "serial", "port", "." ]
af2f8af43f1a24bf854eff9f3126fd7b5c41b3dd
https://github.com/thomasdelaet/python-velbus/blob/af2f8af43f1a24bf854eff9f3126fd7b5c41b3dd/velbus/connections/serial.py#L77-L85
train
Close serial port.
thomasdelaet/python-velbus
velbus/connections/serial.py
VelbusUSBConnection.feed_parser
def feed_parser(self, data): """Parse received message.""" assert isinstance(data, bytes) self.controller.feed_parser(data)
python
def feed_parser(self, data): """Parse received message.""" assert isinstance(data, bytes) self.controller.feed_parser(data)
[ "def", "feed_parser", "(", "self", ",", "data", ")", ":", "assert", "isinstance", "(", "data", ",", "bytes", ")", "self", ".", "controller", ".", "feed_parser", "(", "data", ")" ]
Parse received message.
[ "Parse", "received", "message", "." ]
af2f8af43f1a24bf854eff9f3126fd7b5c41b3dd
https://github.com/thomasdelaet/python-velbus/blob/af2f8af43f1a24bf854eff9f3126fd7b5c41b3dd/velbus/connections/serial.py#L87-L90
train
Parse received message.
thomasdelaet/python-velbus
velbus/connections/serial.py
VelbusUSBConnection.send
def send(self, message, callback=None): """Add message to write queue.""" assert isinstance(message, velbus.Message) self._write_queue.put_nowait((message, callback))
python
def send(self, message, callback=None): """Add message to write queue.""" assert isinstance(message, velbus.Message) self._write_queue.put_nowait((message, callback))
[ "def", "send", "(", "self", ",", "message", ",", "callback", "=", "None", ")", ":", "assert", "isinstance", "(", "message", ",", "velbus", ".", "Message", ")", "self", ".", "_write_queue", ".", "put_nowait", "(", "(", "message", ",", "callback", ")", "...
Add message to write queue.
[ "Add", "message", "to", "write", "queue", "." ]
af2f8af43f1a24bf854eff9f3126fd7b5c41b3dd
https://github.com/thomasdelaet/python-velbus/blob/af2f8af43f1a24bf854eff9f3126fd7b5c41b3dd/velbus/connections/serial.py#L92-L95
train
Add message to write queue.
thomasdelaet/python-velbus
velbus/connections/serial.py
VelbusUSBConnection.write_daemon
def write_daemon(self): """Write thread.""" while True: (message, callback) = self._write_queue.get(block=True) self.logger.info("Sending message on USB bus: %s", str(message)) self.logger.debug("Sending binary message: %s", str(message.to_binary())) self...
python
def write_daemon(self): """Write thread.""" while True: (message, callback) = self._write_queue.get(block=True) self.logger.info("Sending message on USB bus: %s", str(message)) self.logger.debug("Sending binary message: %s", str(message.to_binary())) self...
[ "def", "write_daemon", "(", "self", ")", ":", "while", "True", ":", "(", "message", ",", "callback", ")", "=", "self", ".", "_write_queue", ".", "get", "(", "block", "=", "True", ")", "self", ".", "logger", ".", "info", "(", "\"Sending message on USB bus...
Write thread.
[ "Write", "thread", "." ]
af2f8af43f1a24bf854eff9f3126fd7b5c41b3dd
https://github.com/thomasdelaet/python-velbus/blob/af2f8af43f1a24bf854eff9f3126fd7b5c41b3dd/velbus/connections/serial.py#L97-L106
train
Write thread.
kytos/kytos-utils
kytos/utils/napps.py
NAppsManager.__require_kytos_config
def __require_kytos_config(self): """Set path locations from kytosd API. It should not be called directly, but from properties that require a running kytosd instance. """ if self.__enabled is None: uri = self._kytos_api + 'api/kytos/core/config/' try: ...
python
def __require_kytos_config(self): """Set path locations from kytosd API. It should not be called directly, but from properties that require a running kytosd instance. """ if self.__enabled is None: uri = self._kytos_api + 'api/kytos/core/config/' try: ...
[ "def", "__require_kytos_config", "(", "self", ")", ":", "if", "self", ".", "__enabled", "is", "None", ":", "uri", "=", "self", ".", "_kytos_api", "+", "'api/kytos/core/config/'", "try", ":", "options", "=", "json", ".", "loads", "(", "urllib", ".", "reques...
Set path locations from kytosd API. It should not be called directly, but from properties that require a running kytosd instance.
[ "Set", "path", "locations", "from", "kytosd", "API", "." ]
b4750c618d15cff75970ea6124bda4d2b9a33578
https://github.com/kytos/kytos-utils/blob/b4750c618d15cff75970ea6124bda4d2b9a33578/kytos/utils/napps.py#L69-L83
train
Set path locations from kytosapi API.
kytos/kytos-utils
kytos/utils/napps.py
NAppsManager.set_napp
def set_napp(self, user, napp, version=None): """Set info about NApp. Args: user (str): NApps Server username. napp (str): NApp name. version (str): NApp version. """ self.user = user self.napp = napp self.version = version or 'latest'
python
def set_napp(self, user, napp, version=None): """Set info about NApp. Args: user (str): NApps Server username. napp (str): NApp name. version (str): NApp version. """ self.user = user self.napp = napp self.version = version or 'latest'
[ "def", "set_napp", "(", "self", ",", "user", ",", "napp", ",", "version", "=", "None", ")", ":", "self", ".", "user", "=", "user", "self", ".", "napp", "=", "napp", "self", ".", "version", "=", "version", "or", "'latest'" ]
Set info about NApp. Args: user (str): NApps Server username. napp (str): NApp name. version (str): NApp version.
[ "Set", "info", "about", "NApp", "." ]
b4750c618d15cff75970ea6124bda4d2b9a33578
https://github.com/kytos/kytos-utils/blob/b4750c618d15cff75970ea6124bda4d2b9a33578/kytos/utils/napps.py#L85-L95
train
Set user napp and version
kytos/kytos-utils
kytos/utils/napps.py
NAppsManager._get_napps
def _get_napps(napps_dir): """List of (username, napp_name) found in ``napps_dir``.""" jsons = napps_dir.glob('*/*/kytos.json') return sorted(j.parts[-3:-1] for j in jsons)
python
def _get_napps(napps_dir): """List of (username, napp_name) found in ``napps_dir``.""" jsons = napps_dir.glob('*/*/kytos.json') return sorted(j.parts[-3:-1] for j in jsons)
[ "def", "_get_napps", "(", "napps_dir", ")", ":", "jsons", "=", "napps_dir", ".", "glob", "(", "'*/*/kytos.json'", ")", "return", "sorted", "(", "j", ".", "parts", "[", "-", "3", ":", "-", "1", "]", "for", "j", "in", "jsons", ")" ]
List of (username, napp_name) found in ``napps_dir``.
[ "List", "of", "(", "username", "napp_name", ")", "found", "in", "napps_dir", "." ]
b4750c618d15cff75970ea6124bda4d2b9a33578
https://github.com/kytos/kytos-utils/blob/b4750c618d15cff75970ea6124bda4d2b9a33578/kytos/utils/napps.py#L103-L106
train
Return a list of napps found in napps_dir.
kytos/kytos-utils
kytos/utils/napps.py
NAppsManager.get_disabled
def get_disabled(self): """Sorted list of (username, napp_name) of disabled napps. The difference of installed and enabled. """ installed = set(self.get_installed()) enabled = set(self.get_enabled()) return sorted(installed - enabled)
python
def get_disabled(self): """Sorted list of (username, napp_name) of disabled napps. The difference of installed and enabled. """ installed = set(self.get_installed()) enabled = set(self.get_enabled()) return sorted(installed - enabled)
[ "def", "get_disabled", "(", "self", ")", ":", "installed", "=", "set", "(", "self", ".", "get_installed", "(", ")", ")", "enabled", "=", "set", "(", "self", ".", "get_enabled", "(", ")", ")", "return", "sorted", "(", "installed", "-", "enabled", ")" ]
Sorted list of (username, napp_name) of disabled napps. The difference of installed and enabled.
[ "Sorted", "list", "of", "(", "username", "napp_name", ")", "of", "disabled", "napps", "." ]
b4750c618d15cff75970ea6124bda4d2b9a33578
https://github.com/kytos/kytos-utils/blob/b4750c618d15cff75970ea6124bda4d2b9a33578/kytos/utils/napps.py#L120-L127
train
Returns a list of username napp_name of disabled napps.
kytos/kytos-utils
kytos/utils/napps.py
NAppsManager.dependencies
def dependencies(self, user=None, napp=None): """Get napp_dependencies from install NApp. Args: user(string) A Username. napp(string): A NApp name. Returns: napps(list): List with tuples with Username and NApp name. e.g. [('kytos'/'o...
python
def dependencies(self, user=None, napp=None): """Get napp_dependencies from install NApp. Args: user(string) A Username. napp(string): A NApp name. Returns: napps(list): List with tuples with Username and NApp name. e.g. [('kytos'/'o...
[ "def", "dependencies", "(", "self", ",", "user", "=", "None", ",", "napp", "=", "None", ")", ":", "napps", "=", "self", ".", "_get_napp_key", "(", "'napp_dependencies'", ",", "user", ",", "napp", ")", "return", "[", "tuple", "(", "napp", ".", "split", ...
Get napp_dependencies from install NApp. Args: user(string) A Username. napp(string): A NApp name. Returns: napps(list): List with tuples with Username and NApp name. e.g. [('kytos'/'of_core'), ('kytos/of_l2ls')]
[ "Get", "napp_dependencies", "from", "install", "NApp", "." ]
b4750c618d15cff75970ea6124bda4d2b9a33578
https://github.com/kytos/kytos-utils/blob/b4750c618d15cff75970ea6124bda4d2b9a33578/kytos/utils/napps.py#L129-L141
train
Get napp_dependencies from install NApp.
kytos/kytos-utils
kytos/utils/napps.py
NAppsManager._get_napp_key
def _get_napp_key(self, key, user=None, napp=None): """Return a value from kytos.json. Args: user (string): A Username. napp (string): A NApp name key (string): Key used to get the value within kytos.json. Returns: meta (object): Value stored in ...
python
def _get_napp_key(self, key, user=None, napp=None): """Return a value from kytos.json. Args: user (string): A Username. napp (string): A NApp name key (string): Key used to get the value within kytos.json. Returns: meta (object): Value stored in ...
[ "def", "_get_napp_key", "(", "self", ",", "key", ",", "user", "=", "None", ",", "napp", "=", "None", ")", ":", "if", "user", "is", "None", ":", "user", "=", "self", ".", "user", "if", "napp", "is", "None", ":", "napp", "=", "self", ".", "napp", ...
Return a value from kytos.json. Args: user (string): A Username. napp (string): A NApp name key (string): Key used to get the value within kytos.json. Returns: meta (object): Value stored in kytos.json.
[ "Return", "a", "value", "from", "kytos", ".", "json", "." ]
b4750c618d15cff75970ea6124bda4d2b9a33578
https://github.com/kytos/kytos-utils/blob/b4750c618d15cff75970ea6124bda4d2b9a33578/kytos/utils/napps.py#L151-L173
train
Return a value from kytos. json. napp. user. napp. key.
kytos/kytos-utils
kytos/utils/napps.py
NAppsManager.disable
def disable(self): """Disable a NApp if it is enabled.""" core_napps_manager = CoreNAppsManager(base_path=self._enabled) core_napps_manager.disable(self.user, self.napp)
python
def disable(self): """Disable a NApp if it is enabled.""" core_napps_manager = CoreNAppsManager(base_path=self._enabled) core_napps_manager.disable(self.user, self.napp)
[ "def", "disable", "(", "self", ")", ":", "core_napps_manager", "=", "CoreNAppsManager", "(", "base_path", "=", "self", ".", "_enabled", ")", "core_napps_manager", ".", "disable", "(", "self", ".", "user", ",", "self", ".", "napp", ")" ]
Disable a NApp if it is enabled.
[ "Disable", "a", "NApp", "if", "it", "is", "enabled", "." ]
b4750c618d15cff75970ea6124bda4d2b9a33578
https://github.com/kytos/kytos-utils/blob/b4750c618d15cff75970ea6124bda4d2b9a33578/kytos/utils/napps.py#L175-L178
train
Disable a NApp if it is enabled.
kytos/kytos-utils
kytos/utils/napps.py
NAppsManager.enable
def enable(self): """Enable a NApp if not already enabled. Raises: FileNotFoundError: If NApp is not installed. PermissionError: No filesystem permission to enable NApp. """ core_napps_manager = CoreNAppsManager(base_path=self._enabled) core_napps_manage...
python
def enable(self): """Enable a NApp if not already enabled. Raises: FileNotFoundError: If NApp is not installed. PermissionError: No filesystem permission to enable NApp. """ core_napps_manager = CoreNAppsManager(base_path=self._enabled) core_napps_manage...
[ "def", "enable", "(", "self", ")", ":", "core_napps_manager", "=", "CoreNAppsManager", "(", "base_path", "=", "self", ".", "_enabled", ")", "core_napps_manager", ".", "enable", "(", "self", ".", "user", ",", "self", ".", "napp", ")" ]
Enable a NApp if not already enabled. Raises: FileNotFoundError: If NApp is not installed. PermissionError: No filesystem permission to enable NApp.
[ "Enable", "a", "NApp", "if", "not", "already", "enabled", "." ]
b4750c618d15cff75970ea6124bda4d2b9a33578
https://github.com/kytos/kytos-utils/blob/b4750c618d15cff75970ea6124bda4d2b9a33578/kytos/utils/napps.py#L188-L197
train
Enable a NApp if not already enabled.
kytos/kytos-utils
kytos/utils/napps.py
NAppsManager.uninstall
def uninstall(self): """Delete code inside NApp directory, if existent.""" if self.is_installed(): installed = self.installed_dir() if installed.is_symlink(): installed.unlink() else: shutil.rmtree(str(installed))
python
def uninstall(self): """Delete code inside NApp directory, if existent.""" if self.is_installed(): installed = self.installed_dir() if installed.is_symlink(): installed.unlink() else: shutil.rmtree(str(installed))
[ "def", "uninstall", "(", "self", ")", ":", "if", "self", ".", "is_installed", "(", ")", ":", "installed", "=", "self", ".", "installed_dir", "(", ")", "if", "installed", ".", "is_symlink", "(", ")", ":", "installed", ".", "unlink", "(", ")", "else", ...
Delete code inside NApp directory, if existent.
[ "Delete", "code", "inside", "NApp", "directory", "if", "existent", "." ]
b4750c618d15cff75970ea6124bda4d2b9a33578
https://github.com/kytos/kytos-utils/blob/b4750c618d15cff75970ea6124bda4d2b9a33578/kytos/utils/napps.py#L203-L210
train
Delete code inside NApp directory if existent.
kytos/kytos-utils
kytos/utils/napps.py
NAppsManager.render_template
def render_template(templates_path, template_filename, context): """Render Jinja2 template for a NApp structure.""" template_env = Environment( autoescape=False, trim_blocks=False, loader=FileSystemLoader(str(templates_path))) return template_env.get_template(str(template...
python
def render_template(templates_path, template_filename, context): """Render Jinja2 template for a NApp structure.""" template_env = Environment( autoescape=False, trim_blocks=False, loader=FileSystemLoader(str(templates_path))) return template_env.get_template(str(template...
[ "def", "render_template", "(", "templates_path", ",", "template_filename", ",", "context", ")", ":", "template_env", "=", "Environment", "(", "autoescape", "=", "False", ",", "trim_blocks", "=", "False", ",", "loader", "=", "FileSystemLoader", "(", "str", "(", ...
Render Jinja2 template for a NApp structure.
[ "Render", "Jinja2", "template", "for", "a", "NApp", "structure", "." ]
b4750c618d15cff75970ea6124bda4d2b9a33578
https://github.com/kytos/kytos-utils/blob/b4750c618d15cff75970ea6124bda4d2b9a33578/kytos/utils/napps.py#L223-L229
train
Render Jinja2 template for a NApp structure.
kytos/kytos-utils
kytos/utils/napps.py
NAppsManager.search
def search(pattern): """Search all server NApps matching pattern. Args: pattern (str): Python regular expression. """ def match(napp): """Whether a NApp metadata matches the pattern.""" # WARNING: This will change for future versions, when 'author' wi...
python
def search(pattern): """Search all server NApps matching pattern. Args: pattern (str): Python regular expression. """ def match(napp): """Whether a NApp metadata matches the pattern.""" # WARNING: This will change for future versions, when 'author' wi...
[ "def", "search", "(", "pattern", ")", ":", "def", "match", "(", "napp", ")", ":", "\"\"\"Whether a NApp metadata matches the pattern.\"\"\"", "# WARNING: This will change for future versions, when 'author' will", "# be removed.", "username", "=", "napp", ".", "get", "(", "'...
Search all server NApps matching pattern. Args: pattern (str): Python regular expression.
[ "Search", "all", "server", "NApps", "matching", "pattern", "." ]
b4750c618d15cff75970ea6124bda4d2b9a33578
https://github.com/kytos/kytos-utils/blob/b4750c618d15cff75970ea6124bda4d2b9a33578/kytos/utils/napps.py#L232-L249
train
Search all server NApps matching pattern.
kytos/kytos-utils
kytos/utils/napps.py
NAppsManager.install_local
def install_local(self): """Make a symlink in install folder to a local NApp. Raises: FileNotFoundError: If NApp is not found. """ folder = self._get_local_folder() installed = self.installed_dir() self._check_module(installed.parent) installed.symli...
python
def install_local(self): """Make a symlink in install folder to a local NApp. Raises: FileNotFoundError: If NApp is not found. """ folder = self._get_local_folder() installed = self.installed_dir() self._check_module(installed.parent) installed.symli...
[ "def", "install_local", "(", "self", ")", ":", "folder", "=", "self", ".", "_get_local_folder", "(", ")", "installed", "=", "self", ".", "installed_dir", "(", ")", "self", ".", "_check_module", "(", "installed", ".", "parent", ")", "installed", ".", "symli...
Make a symlink in install folder to a local NApp. Raises: FileNotFoundError: If NApp is not found.
[ "Make", "a", "symlink", "in", "install", "folder", "to", "a", "local", "NApp", "." ]
b4750c618d15cff75970ea6124bda4d2b9a33578
https://github.com/kytos/kytos-utils/blob/b4750c618d15cff75970ea6124bda4d2b9a33578/kytos/utils/napps.py#L251-L261
train
Make a symlink in install folder to a local NApp.
kytos/kytos-utils
kytos/utils/napps.py
NAppsManager._get_local_folder
def _get_local_folder(self, root=None): """Return local NApp root folder. Search for kytos.json in _./_ folder and _./user/napp_. Args: root (pathlib.Path): Where to begin searching. Return: pathlib.Path: NApp root folder. Raises: FileNotFo...
python
def _get_local_folder(self, root=None): """Return local NApp root folder. Search for kytos.json in _./_ folder and _./user/napp_. Args: root (pathlib.Path): Where to begin searching. Return: pathlib.Path: NApp root folder. Raises: FileNotFo...
[ "def", "_get_local_folder", "(", "self", ",", "root", "=", "None", ")", ":", "if", "root", "is", "None", ":", "root", "=", "Path", "(", ")", "for", "folders", "in", "[", "'.'", "]", ",", "[", "self", ".", "user", ",", "self", ".", "napp", "]", ...
Return local NApp root folder. Search for kytos.json in _./_ folder and _./user/napp_. Args: root (pathlib.Path): Where to begin searching. Return: pathlib.Path: NApp root folder. Raises: FileNotFoundError: If there is no such local NApp.
[ "Return", "local", "NApp", "root", "folder", "." ]
b4750c618d15cff75970ea6124bda4d2b9a33578
https://github.com/kytos/kytos-utils/blob/b4750c618d15cff75970ea6124bda4d2b9a33578/kytos/utils/napps.py#L263-L290
train
Return local NApp root folder.
kytos/kytos-utils
kytos/utils/napps.py
NAppsManager.install_remote
def install_remote(self): """Download, extract and install NApp.""" package, pkg_folder = None, None try: package = self._download() pkg_folder = self._extract(package) napp_folder = self._get_local_folder(pkg_folder) dst = self._installed / self.u...
python
def install_remote(self): """Download, extract and install NApp.""" package, pkg_folder = None, None try: package = self._download() pkg_folder = self._extract(package) napp_folder = self._get_local_folder(pkg_folder) dst = self._installed / self.u...
[ "def", "install_remote", "(", "self", ")", ":", "package", ",", "pkg_folder", "=", "None", ",", "None", "try", ":", "package", "=", "self", ".", "_download", "(", ")", "pkg_folder", "=", "self", ".", "_extract", "(", "package", ")", "napp_folder", "=", ...
Download, extract and install NApp.
[ "Download", "extract", "and", "install", "NApp", "." ]
b4750c618d15cff75970ea6124bda4d2b9a33578
https://github.com/kytos/kytos-utils/blob/b4750c618d15cff75970ea6124bda4d2b9a33578/kytos/utils/napps.py#L292-L307
train
Download extract and install NApp.
kytos/kytos-utils
kytos/utils/napps.py
NAppsManager._download
def _download(self): """Download NApp package from server. Return: str: Downloaded temp filename. Raises: urllib.error.HTTPError: If download is not successful. """ repo = self._config.get('napps', 'repo') napp_id = '{}/{}-{}.napp'.format(self.u...
python
def _download(self): """Download NApp package from server. Return: str: Downloaded temp filename. Raises: urllib.error.HTTPError: If download is not successful. """ repo = self._config.get('napps', 'repo') napp_id = '{}/{}-{}.napp'.format(self.u...
[ "def", "_download", "(", "self", ")", ":", "repo", "=", "self", ".", "_config", ".", "get", "(", "'napps'", ",", "'repo'", ")", "napp_id", "=", "'{}/{}-{}.napp'", ".", "format", "(", "self", ".", "user", ",", "self", ".", "napp", ",", "self", ".", ...
Download NApp package from server. Return: str: Downloaded temp filename. Raises: urllib.error.HTTPError: If download is not successful.
[ "Download", "NApp", "package", "from", "server", "." ]
b4750c618d15cff75970ea6124bda4d2b9a33578
https://github.com/kytos/kytos-utils/blob/b4750c618d15cff75970ea6124bda4d2b9a33578/kytos/utils/napps.py#L309-L322
train
Download NApp package from server.
kytos/kytos-utils
kytos/utils/napps.py
NAppsManager._extract
def _extract(filename): """Extract package to a temporary folder. Return: pathlib.Path: Temp dir with package contents. """ random_string = '{:0d}'.format(randint(0, 10**6)) tmp = '/tmp/kytos-napp-' + Path(filename).stem + '-' + random_string os.mkdir(tmp) ...
python
def _extract(filename): """Extract package to a temporary folder. Return: pathlib.Path: Temp dir with package contents. """ random_string = '{:0d}'.format(randint(0, 10**6)) tmp = '/tmp/kytos-napp-' + Path(filename).stem + '-' + random_string os.mkdir(tmp) ...
[ "def", "_extract", "(", "filename", ")", ":", "random_string", "=", "'{:0d}'", ".", "format", "(", "randint", "(", "0", ",", "10", "**", "6", ")", ")", "tmp", "=", "'/tmp/kytos-napp-'", "+", "Path", "(", "filename", ")", ".", "stem", "+", "'-'", "+",...
Extract package to a temporary folder. Return: pathlib.Path: Temp dir with package contents.
[ "Extract", "package", "to", "a", "temporary", "folder", "." ]
b4750c618d15cff75970ea6124bda4d2b9a33578
https://github.com/kytos/kytos-utils/blob/b4750c618d15cff75970ea6124bda4d2b9a33578/kytos/utils/napps.py#L325-L337
train
Extract package to a temporary folder.
kytos/kytos-utils
kytos/utils/napps.py
NAppsManager.create_napp
def create_napp(cls, meta_package=False): """Bootstrap a basic NApp structure for you to develop your NApp. This will create, on the current folder, a clean structure of a NAPP, filling some contents on this structure. """ templates_path = SKEL_PATH / 'napp-structure/username/na...
python
def create_napp(cls, meta_package=False): """Bootstrap a basic NApp structure for you to develop your NApp. This will create, on the current folder, a clean structure of a NAPP, filling some contents on this structure. """ templates_path = SKEL_PATH / 'napp-structure/username/na...
[ "def", "create_napp", "(", "cls", ",", "meta_package", "=", "False", ")", ":", "templates_path", "=", "SKEL_PATH", "/", "'napp-structure/username/napp'", "ui_templates_path", "=", "os", ".", "path", ".", "join", "(", "templates_path", ",", "'ui'", ")", "username...
Bootstrap a basic NApp structure for you to develop your NApp. This will create, on the current folder, a clean structure of a NAPP, filling some contents on this structure.
[ "Bootstrap", "a", "basic", "NApp", "structure", "for", "you", "to", "develop", "your", "NApp", "." ]
b4750c618d15cff75970ea6124bda4d2b9a33578
https://github.com/kytos/kytos-utils/blob/b4750c618d15cff75970ea6124bda4d2b9a33578/kytos/utils/napps.py#L340-L412
train
Create a basic NApp structure for you to develop your NApp.
kytos/kytos-utils
kytos/utils/napps.py
NAppsManager.create_ui_structure
def create_ui_structure(cls, username, napp_name, ui_templates_path, context): """Create the ui directory structure.""" for section in ['k-info-panel', 'k-toolbar', 'k-action-menu']: os.makedirs(os.path.join(username, napp_name, 'ui', section)) templates ...
python
def create_ui_structure(cls, username, napp_name, ui_templates_path, context): """Create the ui directory structure.""" for section in ['k-info-panel', 'k-toolbar', 'k-action-menu']: os.makedirs(os.path.join(username, napp_name, 'ui', section)) templates ...
[ "def", "create_ui_structure", "(", "cls", ",", "username", ",", "napp_name", ",", "ui_templates_path", ",", "context", ")", ":", "for", "section", "in", "[", "'k-info-panel'", ",", "'k-toolbar'", ",", "'k-action-menu'", "]", ":", "os", ".", "makedirs", "(", ...
Create the ui directory structure.
[ "Create", "the", "ui", "directory", "structure", "." ]
b4750c618d15cff75970ea6124bda4d2b9a33578
https://github.com/kytos/kytos-utils/blob/b4750c618d15cff75970ea6124bda4d2b9a33578/kytos/utils/napps.py#L415-L430
train
Create the ui directory structure.
kytos/kytos-utils
kytos/utils/napps.py
NAppsManager._check_module
def _check_module(folder): """Create module folder with empty __init__.py if it doesn't exist. Args: folder (pathlib.Path): Module path. """ if not folder.exists(): folder.mkdir(parents=True, exist_ok=True, mode=0o755) (folder / '__init__.py').touch()
python
def _check_module(folder): """Create module folder with empty __init__.py if it doesn't exist. Args: folder (pathlib.Path): Module path. """ if not folder.exists(): folder.mkdir(parents=True, exist_ok=True, mode=0o755) (folder / '__init__.py').touch()
[ "def", "_check_module", "(", "folder", ")", ":", "if", "not", "folder", ".", "exists", "(", ")", ":", "folder", ".", "mkdir", "(", "parents", "=", "True", ",", "exist_ok", "=", "True", ",", "mode", "=", "0o755", ")", "(", "folder", "/", "'__init__.py...
Create module folder with empty __init__.py if it doesn't exist. Args: folder (pathlib.Path): Module path.
[ "Create", "module", "folder", "with", "empty", "__init__", ".", "py", "if", "it", "doesn", "t", "exist", "." ]
b4750c618d15cff75970ea6124bda4d2b9a33578
https://github.com/kytos/kytos-utils/blob/b4750c618d15cff75970ea6124bda4d2b9a33578/kytos/utils/napps.py#L433-L441
train
Create module folder with empty __init__. py if it doesn t exist.
kytos/kytos-utils
kytos/utils/napps.py
NAppsManager.build_napp_package
def build_napp_package(napp_name): """Build the .napp file to be sent to the napps server. Args: napp_identifier (str): Identifier formatted as <username>/<napp_name> Return: file_payload (binary): The binary representation of the napp pa...
python
def build_napp_package(napp_name): """Build the .napp file to be sent to the napps server. Args: napp_identifier (str): Identifier formatted as <username>/<napp_name> Return: file_payload (binary): The binary representation of the napp pa...
[ "def", "build_napp_package", "(", "napp_name", ")", ":", "ignored_extensions", "=", "[", "'.swp'", ",", "'.pyc'", ",", "'.napp'", "]", "ignored_dirs", "=", "[", "'__pycache__'", ",", "'.git'", ",", "'.tox'", "]", "files", "=", "os", ".", "listdir", "(", ")...
Build the .napp file to be sent to the napps server. Args: napp_identifier (str): Identifier formatted as <username>/<napp_name> Return: file_payload (binary): The binary representation of the napp package that will be POSTed to the napp server.
[ "Build", "the", ".", "napp", "file", "to", "be", "sent", "to", "the", "napps", "server", "." ]
b4750c618d15cff75970ea6124bda4d2b9a33578
https://github.com/kytos/kytos-utils/blob/b4750c618d15cff75970ea6124bda4d2b9a33578/kytos/utils/napps.py#L444-L478
train
Build the. napp file that will be sent to the napps server.
kytos/kytos-utils
kytos/utils/napps.py
NAppsManager.create_metadata
def create_metadata(*args, **kwargs): # pylint: disable=unused-argument """Generate the metadata to send the napp package.""" json_filename = kwargs.get('json_filename', 'kytos.json') readme_filename = kwargs.get('readme_filename', 'README.rst') ignore_json = kwargs.get('ignore_json', F...
python
def create_metadata(*args, **kwargs): # pylint: disable=unused-argument """Generate the metadata to send the napp package.""" json_filename = kwargs.get('json_filename', 'kytos.json') readme_filename = kwargs.get('readme_filename', 'README.rst') ignore_json = kwargs.get('ignore_json', F...
[ "def", "create_metadata", "(", "*", "args", ",", "*", "*", "kwargs", ")", ":", "# pylint: disable=unused-argument", "json_filename", "=", "kwargs", ".", "get", "(", "'json_filename'", ",", "'kytos.json'", ")", "readme_filename", "=", "kwargs", ".", "get", "(", ...
Generate the metadata to send the napp package.
[ "Generate", "the", "metadata", "to", "send", "the", "napp", "package", "." ]
b4750c618d15cff75970ea6124bda4d2b9a33578
https://github.com/kytos/kytos-utils/blob/b4750c618d15cff75970ea6124bda4d2b9a33578/kytos/utils/napps.py#L481-L510
train
Generate the metadata to send the napp package.
kytos/kytos-utils
kytos/utils/napps.py
NAppsManager.upload
def upload(self, *args, **kwargs): """Create package and upload it to NApps Server. Raises: FileNotFoundError: If kytos.json is not found. """ self.prepare() metadata = self.create_metadata(*args, **kwargs) package = self.build_napp_package(metadata.get('nam...
python
def upload(self, *args, **kwargs): """Create package and upload it to NApps Server. Raises: FileNotFoundError: If kytos.json is not found. """ self.prepare() metadata = self.create_metadata(*args, **kwargs) package = self.build_napp_package(metadata.get('nam...
[ "def", "upload", "(", "self", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "self", ".", "prepare", "(", ")", "metadata", "=", "self", ".", "create_metadata", "(", "*", "args", ",", "*", "*", "kwargs", ")", "package", "=", "self", ".", "bu...
Create package and upload it to NApps Server. Raises: FileNotFoundError: If kytos.json is not found.
[ "Create", "package", "and", "upload", "it", "to", "NApps", "Server", "." ]
b4750c618d15cff75970ea6124bda4d2b9a33578
https://github.com/kytos/kytos-utils/blob/b4750c618d15cff75970ea6124bda4d2b9a33578/kytos/utils/napps.py#L512-L523
train
Create package and upload it to NApps Server.
kytos/kytos-utils
kytos/utils/napps.py
NAppsManager.delete
def delete(self): """Delete a NApp. Raises: requests.HTTPError: When there's a server error. """ client = NAppsClient(self._config) client.delete(self.user, self.napp)
python
def delete(self): """Delete a NApp. Raises: requests.HTTPError: When there's a server error. """ client = NAppsClient(self._config) client.delete(self.user, self.napp)
[ "def", "delete", "(", "self", ")", ":", "client", "=", "NAppsClient", "(", "self", ".", "_config", ")", "client", ".", "delete", "(", "self", ".", "user", ",", "self", ".", "napp", ")" ]
Delete a NApp. Raises: requests.HTTPError: When there's a server error.
[ "Delete", "a", "NApp", "." ]
b4750c618d15cff75970ea6124bda4d2b9a33578
https://github.com/kytos/kytos-utils/blob/b4750c618d15cff75970ea6124bda4d2b9a33578/kytos/utils/napps.py#L525-L533
train
Delete a NApp.
kytos/kytos-utils
kytos/utils/napps.py
NAppsManager.prepare
def prepare(cls): """Prepare NApp to be uploaded by creating openAPI skeleton.""" if cls._ask_openapi(): napp_path = Path() tpl_path = SKEL_PATH / 'napp-structure/username/napp' OpenAPI(napp_path, tpl_path).render_template() print('Please, update your open...
python
def prepare(cls): """Prepare NApp to be uploaded by creating openAPI skeleton.""" if cls._ask_openapi(): napp_path = Path() tpl_path = SKEL_PATH / 'napp-structure/username/napp' OpenAPI(napp_path, tpl_path).render_template() print('Please, update your open...
[ "def", "prepare", "(", "cls", ")", ":", "if", "cls", ".", "_ask_openapi", "(", ")", ":", "napp_path", "=", "Path", "(", ")", "tpl_path", "=", "SKEL_PATH", "/", "'napp-structure/username/napp'", "OpenAPI", "(", "napp_path", ",", "tpl_path", ")", ".", "rende...
Prepare NApp to be uploaded by creating openAPI skeleton.
[ "Prepare", "NApp", "to", "be", "uploaded", "by", "creating", "openAPI", "skeleton", "." ]
b4750c618d15cff75970ea6124bda4d2b9a33578
https://github.com/kytos/kytos-utils/blob/b4750c618d15cff75970ea6124bda4d2b9a33578/kytos/utils/napps.py#L536-L543
train
Prepare NApp to be uploaded by creating openAPI skeleton.
kytos/kytos-utils
kytos/utils/napps.py
NAppsManager._ask_openapi
def _ask_openapi(): """Return whether we should create a (new) skeleton.""" if Path('openapi.yml').exists(): question = 'Override local openapi.yml with a new skeleton? (y/N) ' default = False else: question = 'Do you have REST endpoints and wish to create an ...
python
def _ask_openapi(): """Return whether we should create a (new) skeleton.""" if Path('openapi.yml').exists(): question = 'Override local openapi.yml with a new skeleton? (y/N) ' default = False else: question = 'Do you have REST endpoints and wish to create an ...
[ "def", "_ask_openapi", "(", ")", ":", "if", "Path", "(", "'openapi.yml'", ")", ".", "exists", "(", ")", ":", "question", "=", "'Override local openapi.yml with a new skeleton? (y/N) '", "default", "=", "False", "else", ":", "question", "=", "'Do you have REST endpoi...
Return whether we should create a (new) skeleton.
[ "Return", "whether", "we", "should", "create", "a", "(", "new", ")", "skeleton", "." ]
b4750c618d15cff75970ea6124bda4d2b9a33578
https://github.com/kytos/kytos-utils/blob/b4750c618d15cff75970ea6124bda4d2b9a33578/kytos/utils/napps.py#L546-L563
train
Ask the user if we should create a new skeleton.
kytos/kytos-utils
kytos/utils/napps.py
NAppsManager.reload
def reload(self, napps=None): """Reload a NApp or all NApps. Args: napps (list): NApp list to be reloaded. Raises: requests.HTTPError: When there's a server error. """ client = NAppsClient(self._config) client.reload_napps(napps)
python
def reload(self, napps=None): """Reload a NApp or all NApps. Args: napps (list): NApp list to be reloaded. Raises: requests.HTTPError: When there's a server error. """ client = NAppsClient(self._config) client.reload_napps(napps)
[ "def", "reload", "(", "self", ",", "napps", "=", "None", ")", ":", "client", "=", "NAppsClient", "(", "self", ".", "_config", ")", "client", ".", "reload_napps", "(", "napps", ")" ]
Reload a NApp or all NApps. Args: napps (list): NApp list to be reloaded. Raises: requests.HTTPError: When there's a server error.
[ "Reload", "a", "NApp", "or", "all", "NApps", "." ]
b4750c618d15cff75970ea6124bda4d2b9a33578
https://github.com/kytos/kytos-utils/blob/b4750c618d15cff75970ea6124bda4d2b9a33578/kytos/utils/napps.py#L565-L575
train
Reload a NApp or all NApps.
thomasdelaet/python-velbus
velbus/messages/meteo_raw.py
MeteoRawMessage.populate
def populate(self, priority, address, rtr, data): """ data bytes (high + low) 1 + 2 = current temp 3 + 4 = min temp 5 + 6 = max temp :return: None """ assert isinstance(data, bytes) self.needs_no_rtr(rtr) self.needs_data(d...
python
def populate(self, priority, address, rtr, data): """ data bytes (high + low) 1 + 2 = current temp 3 + 4 = min temp 5 + 6 = max temp :return: None """ assert isinstance(data, bytes) self.needs_no_rtr(rtr) self.needs_data(d...
[ "def", "populate", "(", "self", ",", "priority", ",", "address", ",", "rtr", ",", "data", ")", ":", "assert", "isinstance", "(", "data", ",", "bytes", ")", "self", ".", "needs_no_rtr", "(", "rtr", ")", "self", ".", "needs_data", "(", "data", ",", "6"...
data bytes (high + low) 1 + 2 = current temp 3 + 4 = min temp 5 + 6 = max temp :return: None
[ "data", "bytes", "(", "high", "+", "low", ")", "1", "+", "2", "=", "current", "temp", "3", "+", "4", "=", "min", "temp", "5", "+", "6", "=", "max", "temp", ":", "return", ":", "None" ]
af2f8af43f1a24bf854eff9f3126fd7b5c41b3dd
https://github.com/thomasdelaet/python-velbus/blob/af2f8af43f1a24bf854eff9f3126fd7b5c41b3dd/velbus/messages/meteo_raw.py#L25-L39
train
Populates the internal state of the object with the contents of the data bytes.
thomasdelaet/python-velbus
velbus/messages/meteo_raw.py
MeteoRawMessage.to_json
def to_json(self): """ :return: str """ json_dict = self.to_json_basic() json_dict['rain'] = self.rain json_dict['light'] = self.light json_dict['wind'] = self.wind return json.dumps(json_dict)
python
def to_json(self): """ :return: str """ json_dict = self.to_json_basic() json_dict['rain'] = self.rain json_dict['light'] = self.light json_dict['wind'] = self.wind return json.dumps(json_dict)
[ "def", "to_json", "(", "self", ")", ":", "json_dict", "=", "self", ".", "to_json_basic", "(", ")", "json_dict", "[", "'rain'", "]", "=", "self", ".", "rain", "json_dict", "[", "'light'", "]", "=", "self", ".", "light", "json_dict", "[", "'wind'", "]", ...
:return: str
[ ":", "return", ":", "str" ]
af2f8af43f1a24bf854eff9f3126fd7b5c41b3dd
https://github.com/thomasdelaet/python-velbus/blob/af2f8af43f1a24bf854eff9f3126fd7b5c41b3dd/velbus/messages/meteo_raw.py#L41-L49
train
Returns a JSON string representation of the current object.
manikos/django-progressiveimagefield
progressiveimagefield/templatetags/progressive_tags.py
_get_thumbnail_url
def _get_thumbnail_url(image): """ Given a large image, return the thumbnail url """ lhs, rhs = splitext(image.url) lhs += THUMB_EXT thumb_url = f'{lhs}{rhs}' return thumb_url
python
def _get_thumbnail_url(image): """ Given a large image, return the thumbnail url """ lhs, rhs = splitext(image.url) lhs += THUMB_EXT thumb_url = f'{lhs}{rhs}' return thumb_url
[ "def", "_get_thumbnail_url", "(", "image", ")", ":", "lhs", ",", "rhs", "=", "splitext", "(", "image", ".", "url", ")", "lhs", "+=", "THUMB_EXT", "thumb_url", "=", "f'{lhs}{rhs}'", "return", "thumb_url" ]
Given a large image, return the thumbnail url
[ "Given", "a", "large", "image", "return", "the", "thumbnail", "url" ]
a432c79d23d87ea8944ac252ae7d15df1e4f3072
https://github.com/manikos/django-progressiveimagefield/blob/a432c79d23d87ea8944ac252ae7d15df1e4f3072/progressiveimagefield/templatetags/progressive_tags.py#L24-L29
train
Given an image return the thumbnail url
KE-works/pykechain
pykechain/client.py
Client.from_env
def from_env(cls, env_filename=None): # type: (Optional[str]) -> Client """Create a client from environment variable settings. :param basestring env_filename: filename of the environment file, defaults to '.env' in the local dir (or parent dir) :r...
python
def from_env(cls, env_filename=None): # type: (Optional[str]) -> Client """Create a client from environment variable settings. :param basestring env_filename: filename of the environment file, defaults to '.env' in the local dir (or parent dir) :r...
[ "def", "from_env", "(", "cls", ",", "env_filename", "=", "None", ")", ":", "# type: (Optional[str]) -> Client", "with", "warnings", ".", "catch_warnings", "(", ")", ":", "warnings", ".", "simplefilter", "(", "\"ignore\"", ",", "UserWarning", ")", "env", ".", "...
Create a client from environment variable settings. :param basestring env_filename: filename of the environment file, defaults to '.env' in the local dir (or parent dir) :return: :class:`pykechain.Client` Example ------- Initiates the py...
[ "Create", "a", "client", "from", "environment", "variable", "settings", "." ]
b0296cf34328fd41660bf6f0b9114fd0167c40c4
https://github.com/KE-works/pykechain/blob/b0296cf34328fd41660bf6f0b9114fd0167c40c4/pykechain/client.py#L107-L151
train
Create a client from environment variables.
KE-works/pykechain
pykechain/client.py
Client.login
def login(self, username=None, password=None, token=None): # type: (Optional[str], Optional[str], Optional[str]) -> None """Login into KE-chain with either username/password or token. :param basestring username: username for your user from KE-chain :param basestring password: password f...
python
def login(self, username=None, password=None, token=None): # type: (Optional[str], Optional[str], Optional[str]) -> None """Login into KE-chain with either username/password or token. :param basestring username: username for your user from KE-chain :param basestring password: password f...
[ "def", "login", "(", "self", ",", "username", "=", "None", ",", "password", "=", "None", ",", "token", "=", "None", ")", ":", "# type: (Optional[str], Optional[str], Optional[str]) -> None", "if", "token", ":", "self", ".", "headers", "[", "'Authorization'", "]"...
Login into KE-chain with either username/password or token. :param basestring username: username for your user from KE-chain :param basestring password: password for your user from KE-chain :param basestring token: user authentication token retrieved from KE-chain Examples ----...
[ "Login", "into", "KE", "-", "chain", "with", "either", "username", "/", "password", "or", "token", "." ]
b0296cf34328fd41660bf6f0b9114fd0167c40c4
https://github.com/KE-works/pykechain/blob/b0296cf34328fd41660bf6f0b9114fd0167c40c4/pykechain/client.py#L153-L182
train
Login into KE - chain with either username password or token.
KE-works/pykechain
pykechain/client.py
Client._build_url
def _build_url(self, resource, **kwargs): # type: (str, **str) -> str """Build the correct API url.""" return urljoin(self.api_root, API_PATH[resource].format(**kwargs))
python
def _build_url(self, resource, **kwargs): # type: (str, **str) -> str """Build the correct API url.""" return urljoin(self.api_root, API_PATH[resource].format(**kwargs))
[ "def", "_build_url", "(", "self", ",", "resource", ",", "*", "*", "kwargs", ")", ":", "# type: (str, **str) -> str", "return", "urljoin", "(", "self", ".", "api_root", ",", "API_PATH", "[", "resource", "]", ".", "format", "(", "*", "*", "kwargs", ")", ")...
Build the correct API url.
[ "Build", "the", "correct", "API", "url", "." ]
b0296cf34328fd41660bf6f0b9114fd0167c40c4
https://github.com/KE-works/pykechain/blob/b0296cf34328fd41660bf6f0b9114fd0167c40c4/pykechain/client.py#L184-L187
train
Build the correct API url.
KE-works/pykechain
pykechain/client.py
Client._retrieve_users
def _retrieve_users(self): """ Retrieve user objects of the entire administration. :return: list of dictionary with users information :rtype: list(dict) ------- """ users_url = self._build_url('users') response = self._request('GET', users_url) u...
python
def _retrieve_users(self): """ Retrieve user objects of the entire administration. :return: list of dictionary with users information :rtype: list(dict) ------- """ users_url = self._build_url('users') response = self._request('GET', users_url) u...
[ "def", "_retrieve_users", "(", "self", ")", ":", "users_url", "=", "self", ".", "_build_url", "(", "'users'", ")", "response", "=", "self", ".", "_request", "(", "'GET'", ",", "users_url", ")", "users", "=", "response", ".", "json", "(", ")", "return", ...
Retrieve user objects of the entire administration. :return: list of dictionary with users information :rtype: list(dict) -------
[ "Retrieve", "user", "objects", "of", "the", "entire", "administration", "." ]
b0296cf34328fd41660bf6f0b9114fd0167c40c4
https://github.com/KE-works/pykechain/blob/b0296cf34328fd41660bf6f0b9114fd0167c40c4/pykechain/client.py#L189-L201
train
Retrieve user objects of the entire administration.
KE-works/pykechain
pykechain/client.py
Client._request
def _request(self, method, url, **kwargs): # type: (str, str, **Any) -> requests.Response """Perform the request on the API.""" self.last_request = None self.last_response = self.session.request(method, url, auth=self.auth, headers=self.headers, **kwargs) self.last_request = self...
python
def _request(self, method, url, **kwargs): # type: (str, str, **Any) -> requests.Response """Perform the request on the API.""" self.last_request = None self.last_response = self.session.request(method, url, auth=self.auth, headers=self.headers, **kwargs) self.last_request = self...
[ "def", "_request", "(", "self", ",", "method", ",", "url", ",", "*", "*", "kwargs", ")", ":", "# type: (str, str, **Any) -> requests.Response", "self", ".", "last_request", "=", "None", "self", ".", "last_response", "=", "self", ".", "session", ".", "request",...
Perform the request on the API.
[ "Perform", "the", "request", "on", "the", "API", "." ]
b0296cf34328fd41660bf6f0b9114fd0167c40c4
https://github.com/KE-works/pykechain/blob/b0296cf34328fd41660bf6f0b9114fd0167c40c4/pykechain/client.py#L203-L214
train
Perform the request on the API.
KE-works/pykechain
pykechain/client.py
Client.app_versions
def app_versions(self): """List of the versions of the internal KE-chain 'app' modules.""" if not self._app_versions: app_versions_url = self._build_url('versions') response = self._request('GET', app_versions_url) if response.status_code == requests.codes.not_found...
python
def app_versions(self): """List of the versions of the internal KE-chain 'app' modules.""" if not self._app_versions: app_versions_url = self._build_url('versions') response = self._request('GET', app_versions_url) if response.status_code == requests.codes.not_found...
[ "def", "app_versions", "(", "self", ")", ":", "if", "not", "self", ".", "_app_versions", ":", "app_versions_url", "=", "self", ".", "_build_url", "(", "'versions'", ")", "response", "=", "self", ".", "_request", "(", "'GET'", ",", "app_versions_url", ")", ...
List of the versions of the internal KE-chain 'app' modules.
[ "List", "of", "the", "versions", "of", "the", "internal", "KE", "-", "chain", "app", "modules", "." ]
b0296cf34328fd41660bf6f0b9114fd0167c40c4
https://github.com/KE-works/pykechain/blob/b0296cf34328fd41660bf6f0b9114fd0167c40c4/pykechain/client.py#L217-L233
train
List of the versions of the internal KE - chain app modules.
KE-works/pykechain
pykechain/client.py
Client.match_app_version
def match_app_version(self, app=None, label=None, version=None, default=False): """Match app version against a semantic version string. Checks if a KE-chain app matches a version comparison. Uses the `semver` matcher to check. `match("2.0.0", ">=1.0.0")` => `True` `match("1.0.0", ">1.0...
python
def match_app_version(self, app=None, label=None, version=None, default=False): """Match app version against a semantic version string. Checks if a KE-chain app matches a version comparison. Uses the `semver` matcher to check. `match("2.0.0", ">=1.0.0")` => `True` `match("1.0.0", ">1.0...
[ "def", "match_app_version", "(", "self", ",", "app", "=", "None", ",", "label", "=", "None", ",", "version", "=", "None", ",", "default", "=", "False", ")", ":", "if", "not", "app", "or", "not", "label", "and", "not", "(", "app", "and", "label", ")...
Match app version against a semantic version string. Checks if a KE-chain app matches a version comparison. Uses the `semver` matcher to check. `match("2.0.0", ">=1.0.0")` => `True` `match("1.0.0", ">1.0.0")` => `False` Examples -------- >>> client.match_app_version(la...
[ "Match", "app", "version", "against", "a", "semantic", "version", "string", "." ]
b0296cf34328fd41660bf6f0b9114fd0167c40c4
https://github.com/KE-works/pykechain/blob/b0296cf34328fd41660bf6f0b9114fd0167c40c4/pykechain/client.py#L235-L288
train
Match an app version against a semantic version string.
KE-works/pykechain
pykechain/client.py
Client.reload
def reload(self, obj, extra_params=None): """Reload an object from server. This method is immutable and will return a new object. :param obj: object to reload :type obj: :py:obj:`obj` :param extra_params: additional object specific extra query string params (eg for activity) :ty...
python
def reload(self, obj, extra_params=None): """Reload an object from server. This method is immutable and will return a new object. :param obj: object to reload :type obj: :py:obj:`obj` :param extra_params: additional object specific extra query string params (eg for activity) :ty...
[ "def", "reload", "(", "self", ",", "obj", ",", "extra_params", "=", "None", ")", ":", "if", "not", "obj", ".", "_json_data", ".", "get", "(", "'url'", ")", ":", "# pragma: no cover", "raise", "NotFoundError", "(", "\"Could not reload object, there is no url for ...
Reload an object from server. This method is immutable and will return a new object. :param obj: object to reload :type obj: :py:obj:`obj` :param extra_params: additional object specific extra query string params (eg for activity) :type extra_params: dict :return: a new object ...
[ "Reload", "an", "object", "from", "server", ".", "This", "method", "is", "immutable", "and", "will", "return", "a", "new", "object", "." ]
b0296cf34328fd41660bf6f0b9114fd0167c40c4
https://github.com/KE-works/pykechain/blob/b0296cf34328fd41660bf6f0b9114fd0167c40c4/pykechain/client.py#L290-L310
train
Reload an object from server. This method is immutable and will return a new object.
KE-works/pykechain
pykechain/client.py
Client.scopes
def scopes(self, name=None, pk=None, status=ScopeStatus.ACTIVE, **kwargs): # type: (Optional[str], Optional[str], Optional[str], **Any) -> List[Scope] """Return all scopes visible / accessible for the logged in user. If additional `keyword=value` arguments are provided, these are added to the r...
python
def scopes(self, name=None, pk=None, status=ScopeStatus.ACTIVE, **kwargs): # type: (Optional[str], Optional[str], Optional[str], **Any) -> List[Scope] """Return all scopes visible / accessible for the logged in user. If additional `keyword=value` arguments are provided, these are added to the r...
[ "def", "scopes", "(", "self", ",", "name", "=", "None", ",", "pk", "=", "None", ",", "status", "=", "ScopeStatus", ".", "ACTIVE", ",", "*", "*", "kwargs", ")", ":", "# type: (Optional[str], Optional[str], Optional[str], **Any) -> List[Scope]", "request_params", "=...
Return all scopes visible / accessible for the logged in user. If additional `keyword=value` arguments are provided, these are added to the request parameters. Please refer to the documentation of the KE-chain API for additional query parameters. :param name: if provided, filter the search for...
[ "Return", "all", "scopes", "visible", "/", "accessible", "for", "the", "logged", "in", "user", "." ]
b0296cf34328fd41660bf6f0b9114fd0167c40c4
https://github.com/KE-works/pykechain/blob/b0296cf34328fd41660bf6f0b9114fd0167c40c4/pykechain/client.py#L312-L360
train
Return all scopes visible or accessible for the logged in user.
KE-works/pykechain
pykechain/client.py
Client.scope
def scope(self, *args, **kwargs): # type: (*Any, **Any) -> Scope """Return a single scope based on the provided name. If additional `keyword=value` arguments are provided, these are added to the request parameters. Please refer to the documentation of the KE-chain API for additional que...
python
def scope(self, *args, **kwargs): # type: (*Any, **Any) -> Scope """Return a single scope based on the provided name. If additional `keyword=value` arguments are provided, these are added to the request parameters. Please refer to the documentation of the KE-chain API for additional que...
[ "def", "scope", "(", "self", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "# type: (*Any, **Any) -> Scope", "_scopes", "=", "self", ".", "scopes", "(", "*", "args", ",", "*", "*", "kwargs", ")", "if", "len", "(", "_scopes", ")", "==", "0", ...
Return a single scope based on the provided name. If additional `keyword=value` arguments are provided, these are added to the request parameters. Please refer to the documentation of the KE-chain API for additional query parameters. :return: a single :class:`models.Scope` :raises NotF...
[ "Return", "a", "single", "scope", "based", "on", "the", "provided", "name", "." ]
b0296cf34328fd41660bf6f0b9114fd0167c40c4
https://github.com/KE-works/pykechain/blob/b0296cf34328fd41660bf6f0b9114fd0167c40c4/pykechain/client.py#L362-L380
train
Returns a single scope based on the provided name.
KE-works/pykechain
pykechain/client.py
Client.activities
def activities(self, name=None, pk=None, scope=None, **kwargs): # type: (Optional[str], Optional[str], Optional[str], **Any) -> List[Activity] """Search for activities with optional name, pk and scope filter. If additional `keyword=value` arguments are provided, these are added to the request p...
python
def activities(self, name=None, pk=None, scope=None, **kwargs): # type: (Optional[str], Optional[str], Optional[str], **Any) -> List[Activity] """Search for activities with optional name, pk and scope filter. If additional `keyword=value` arguments are provided, these are added to the request p...
[ "def", "activities", "(", "self", ",", "name", "=", "None", ",", "pk", "=", "None", ",", "scope", "=", "None", ",", "*", "*", "kwargs", ")", ":", "# type: (Optional[str], Optional[str], Optional[str], **Any) -> List[Activity]", "request_params", "=", "{", "'id'", ...
Search for activities with optional name, pk and scope filter. If additional `keyword=value` arguments are provided, these are added to the request parameters. Please refer to the documentation of the KE-chain API for additional query parameters. :param pk: id (primary key) of the activity to ...
[ "Search", "for", "activities", "with", "optional", "name", "pk", "and", "scope", "filter", "." ]
b0296cf34328fd41660bf6f0b9114fd0167c40c4
https://github.com/KE-works/pykechain/blob/b0296cf34328fd41660bf6f0b9114fd0167c40c4/pykechain/client.py#L382-L425
train
Search for activities with optional name pk and scope filter.
KE-works/pykechain
pykechain/client.py
Client.activity
def activity(self, *args, **kwargs): # type: (*Any, **Any) -> Activity """Search for a single activity. If additional `keyword=value` arguments are provided, these are added to the request parameters. Please refer to the documentation of the KE-chain API for additional query parameters....
python
def activity(self, *args, **kwargs): # type: (*Any, **Any) -> Activity """Search for a single activity. If additional `keyword=value` arguments are provided, these are added to the request parameters. Please refer to the documentation of the KE-chain API for additional query parameters....
[ "def", "activity", "(", "self", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "# type: (*Any, **Any) -> Activity", "_activities", "=", "self", ".", "activities", "(", "*", "args", ",", "*", "*", "kwargs", ")", "if", "len", "(", "_activities", ")",...
Search for a single activity. If additional `keyword=value` arguments are provided, these are added to the request parameters. Please refer to the documentation of the KE-chain API for additional query parameters. :param pk: id (primary key) of the activity to retrieve :type pk: basest...
[ "Search", "for", "a", "single", "activity", "." ]
b0296cf34328fd41660bf6f0b9114fd0167c40c4
https://github.com/KE-works/pykechain/blob/b0296cf34328fd41660bf6f0b9114fd0167c40c4/pykechain/client.py#L427-L451
train
Search for a single activity.
KE-works/pykechain
pykechain/client.py
Client.parts
def parts(self, name=None, # type: Optional[str] pk=None, # type: Optional[str] model=None, # type: Optional[Part] category=Category.INSTANCE, # type: Optional[str] bucket=None, # type: Optional[str] parent=None, # type: Optional[...
python
def parts(self, name=None, # type: Optional[str] pk=None, # type: Optional[str] model=None, # type: Optional[Part] category=Category.INSTANCE, # type: Optional[str] bucket=None, # type: Optional[str] parent=None, # type: Optional[...
[ "def", "parts", "(", "self", ",", "name", "=", "None", ",", "# type: Optional[str]", "pk", "=", "None", ",", "# type: Optional[str]", "model", "=", "None", ",", "# type: Optional[Part]", "category", "=", "Category", ".", "INSTANCE", ",", "# type: Optional[str]", ...
Retrieve multiple KE-chain parts. If no parameters are provided, all parts are retrieved. If additional `keyword=value` arguments are provided, these are added to the request parameters. Please refer to the documentation of the KE-chain API for additional query parameters. :param name...
[ "Retrieve", "multiple", "KE", "-", "chain", "parts", "." ]
b0296cf34328fd41660bf6f0b9114fd0167c40c4
https://github.com/KE-works/pykechain/blob/b0296cf34328fd41660bf6f0b9114fd0167c40c4/pykechain/client.py#L453-L551
train
Retrieve multiple KE - chain parts.
KE-works/pykechain
pykechain/client.py
Client.part
def part(self, *args, **kwargs): # type: (*Any, **Any) -> Part """Retrieve single KE-chain part. Uses the same interface as the :func:`parts` method but returns only a single pykechain :class:`models.Part` instance. If additional `keyword=value` arguments are provided, these ar...
python
def part(self, *args, **kwargs): # type: (*Any, **Any) -> Part """Retrieve single KE-chain part. Uses the same interface as the :func:`parts` method but returns only a single pykechain :class:`models.Part` instance. If additional `keyword=value` arguments are provided, these ar...
[ "def", "part", "(", "self", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "# type: (*Any, **Any) -> Part", "_parts", "=", "self", ".", "parts", "(", "*", "args", ",", "*", "*", "kwargs", ")", "if", "len", "(", "_parts", ")", "==", "0", ":", ...
Retrieve single KE-chain part. Uses the same interface as the :func:`parts` method but returns only a single pykechain :class:`models.Part` instance. If additional `keyword=value` arguments are provided, these are added to the request parameters. Please refer to the documentation of th...
[ "Retrieve", "single", "KE", "-", "chain", "part", "." ]
b0296cf34328fd41660bf6f0b9114fd0167c40c4
https://github.com/KE-works/pykechain/blob/b0296cf34328fd41660bf6f0b9114fd0167c40c4/pykechain/client.py#L553-L574
train
Retrieve a single KE - chain Part instance.
KE-works/pykechain
pykechain/client.py
Client.model
def model(self, *args, **kwargs): # type: (*Any, **Any) -> Part """Retrieve single KE-chain part model. Uses the same interface as the :func:`part` method but returns only a single pykechain :class:`models.Part` instance of category `MODEL`. If additional `keyword=value` argume...
python
def model(self, *args, **kwargs): # type: (*Any, **Any) -> Part """Retrieve single KE-chain part model. Uses the same interface as the :func:`part` method but returns only a single pykechain :class:`models.Part` instance of category `MODEL`. If additional `keyword=value` argume...
[ "def", "model", "(", "self", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "# type: (*Any, **Any) -> Part", "kwargs", "[", "'category'", "]", "=", "Category", ".", "MODEL", "_parts", "=", "self", ".", "parts", "(", "*", "args", ",", "*", "*", ...
Retrieve single KE-chain part model. Uses the same interface as the :func:`part` method but returns only a single pykechain :class:`models.Part` instance of category `MODEL`. If additional `keyword=value` arguments are provided, these are added to the request parameters. Please refer t...
[ "Retrieve", "single", "KE", "-", "chain", "part", "model", "." ]
b0296cf34328fd41660bf6f0b9114fd0167c40c4
https://github.com/KE-works/pykechain/blob/b0296cf34328fd41660bf6f0b9114fd0167c40c4/pykechain/client.py#L576-L598
train
Retrieve a single KE - chain part model. Uses the same interface as the part method but returns only a single KE - chain Part instance of category MODEL.
KE-works/pykechain
pykechain/client.py
Client.property
def property(self, *args, **kwargs): # type: (*Any, **Any) -> Property """Retrieve single KE-chain Property. Uses the same interface as the :func:`properties` method but returns only a single pykechain :class: `models.Property` instance. If additional `keyword=value` arguments ...
python
def property(self, *args, **kwargs): # type: (*Any, **Any) -> Property """Retrieve single KE-chain Property. Uses the same interface as the :func:`properties` method but returns only a single pykechain :class: `models.Property` instance. If additional `keyword=value` arguments ...
[ "def", "property", "(", "self", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "# type: (*Any, **Any) -> Property", "_properties", "=", "self", ".", "properties", "(", "*", "args", ",", "*", "*", "kwargs", ")", "if", "len", "(", "_properties", ")",...
Retrieve single KE-chain Property. Uses the same interface as the :func:`properties` method but returns only a single pykechain :class: `models.Property` instance. If additional `keyword=value` arguments are provided, these are added to the request parameters. Please refer to the docum...
[ "Retrieve", "single", "KE", "-", "chain", "Property", "." ]
b0296cf34328fd41660bf6f0b9114fd0167c40c4
https://github.com/KE-works/pykechain/blob/b0296cf34328fd41660bf6f0b9114fd0167c40c4/pykechain/client.py#L600-L621
train
Retrieve a single KE - chain Property instance.
KE-works/pykechain
pykechain/client.py
Client.properties
def properties(self, name=None, pk=None, category=Category.INSTANCE, **kwargs): # type: (Optional[str], Optional[str], Optional[str], **Any) -> List[Property] """Retrieve properties. If additional `keyword=value` arguments are provided, these are added to the request parameters. Please ...
python
def properties(self, name=None, pk=None, category=Category.INSTANCE, **kwargs): # type: (Optional[str], Optional[str], Optional[str], **Any) -> List[Property] """Retrieve properties. If additional `keyword=value` arguments are provided, these are added to the request parameters. Please ...
[ "def", "properties", "(", "self", ",", "name", "=", "None", ",", "pk", "=", "None", ",", "category", "=", "Category", ".", "INSTANCE", ",", "*", "*", "kwargs", ")", ":", "# type: (Optional[str], Optional[str], Optional[str], **Any) -> List[Property]", "request_param...
Retrieve properties. If additional `keyword=value` arguments are provided, these are added to the request parameters. Please refer to the documentation of the KE-chain API for additional query parameters. :param name: name to limit the search for. :type name: basestring or None ...
[ "Retrieve", "properties", "." ]
b0296cf34328fd41660bf6f0b9114fd0167c40c4
https://github.com/KE-works/pykechain/blob/b0296cf34328fd41660bf6f0b9114fd0167c40c4/pykechain/client.py#L623-L656
train
Retrieve properties.
KE-works/pykechain
pykechain/client.py
Client.services
def services(self, name=None, pk=None, scope=None, **kwargs): """ Retrieve Services. If additional `keyword=value` arguments are provided, these are added to the request parameters. Please refer to the documentation of the KE-chain API for additional query parameters. :param na...
python
def services(self, name=None, pk=None, scope=None, **kwargs): """ Retrieve Services. If additional `keyword=value` arguments are provided, these are added to the request parameters. Please refer to the documentation of the KE-chain API for additional query parameters. :param na...
[ "def", "services", "(", "self", ",", "name", "=", "None", ",", "pk", "=", "None", ",", "scope", "=", "None", ",", "*", "*", "kwargs", ")", ":", "request_params", "=", "{", "'name'", ":", "name", ",", "'id'", ":", "pk", ",", "'scope'", ":", "scope...
Retrieve Services. If additional `keyword=value` arguments are provided, these are added to the request parameters. Please refer to the documentation of the KE-chain API for additional query parameters. :param name: (optional) name to limit the search for :type name: basestring or None...
[ "Retrieve", "Services", "." ]
b0296cf34328fd41660bf6f0b9114fd0167c40c4
https://github.com/KE-works/pykechain/blob/b0296cf34328fd41660bf6f0b9114fd0167c40c4/pykechain/client.py#L658-L690
train
Retrieve Services.
KE-works/pykechain
pykechain/client.py
Client.service
def service(self, name=None, pk=None, scope=None, **kwargs): """ Retrieve single KE-chain Service. Uses the same interface as the :func:`services` method but returns only a single pykechain :class:`models.Service` instance. :param name: (optional) name to limit the search for ...
python
def service(self, name=None, pk=None, scope=None, **kwargs): """ Retrieve single KE-chain Service. Uses the same interface as the :func:`services` method but returns only a single pykechain :class:`models.Service` instance. :param name: (optional) name to limit the search for ...
[ "def", "service", "(", "self", ",", "name", "=", "None", ",", "pk", "=", "None", ",", "scope", "=", "None", ",", "*", "*", "kwargs", ")", ":", "_services", "=", "self", ".", "services", "(", "name", "=", "name", ",", "pk", "=", "pk", ",", "scop...
Retrieve single KE-chain Service. Uses the same interface as the :func:`services` method but returns only a single pykechain :class:`models.Service` instance. :param name: (optional) name to limit the search for :type name: basestring or None :param pk: (optional) primary key o...
[ "Retrieve", "single", "KE", "-", "chain", "Service", "." ]
b0296cf34328fd41660bf6f0b9114fd0167c40c4
https://github.com/KE-works/pykechain/blob/b0296cf34328fd41660bf6f0b9114fd0167c40c4/pykechain/client.py#L692-L718
train
Retrieve a single KE - chain Service object.
KE-works/pykechain
pykechain/client.py
Client.service_executions
def service_executions(self, name=None, pk=None, scope=None, service=None, **kwargs): """ Retrieve Service Executions. If additional `keyword=value` arguments are provided, these are added to the request parameters. Please refer to the documentation of the KE-chain API for additional qu...
python
def service_executions(self, name=None, pk=None, scope=None, service=None, **kwargs): """ Retrieve Service Executions. If additional `keyword=value` arguments are provided, these are added to the request parameters. Please refer to the documentation of the KE-chain API for additional qu...
[ "def", "service_executions", "(", "self", ",", "name", "=", "None", ",", "pk", "=", "None", ",", "scope", "=", "None", ",", "service", "=", "None", ",", "*", "*", "kwargs", ")", ":", "request_params", "=", "{", "'name'", ":", "name", ",", "'id'", "...
Retrieve Service Executions. If additional `keyword=value` arguments are provided, these are added to the request parameters. Please refer to the documentation of the KE-chain API for additional query parameters. :param name: (optional) name to limit the search for :type name: basestri...
[ "Retrieve", "Service", "Executions", "." ]
b0296cf34328fd41660bf6f0b9114fd0167c40c4
https://github.com/KE-works/pykechain/blob/b0296cf34328fd41660bf6f0b9114fd0167c40c4/pykechain/client.py#L720-L755
train
Retrieve Service Executions.
KE-works/pykechain
pykechain/client.py
Client.service_execution
def service_execution(self, name=None, pk=None, scope=None, service=None, **kwargs): """ Retrieve single KE-chain ServiceExecution. Uses the same interface as the :func:`service_executions` method but returns only a single pykechain :class:`models.ServiceExecution` instance. If...
python
def service_execution(self, name=None, pk=None, scope=None, service=None, **kwargs): """ Retrieve single KE-chain ServiceExecution. Uses the same interface as the :func:`service_executions` method but returns only a single pykechain :class:`models.ServiceExecution` instance. If...
[ "def", "service_execution", "(", "self", ",", "name", "=", "None", ",", "pk", "=", "None", ",", "scope", "=", "None", ",", "service", "=", "None", ",", "*", "*", "kwargs", ")", ":", "_service_executions", "=", "self", ".", "service_executions", "(", "n...
Retrieve single KE-chain ServiceExecution. Uses the same interface as the :func:`service_executions` method but returns only a single pykechain :class:`models.ServiceExecution` instance. If additional `keyword=value` arguments are provided, these are added to the request parameters. Please ...
[ "Retrieve", "single", "KE", "-", "chain", "ServiceExecution", "." ]
b0296cf34328fd41660bf6f0b9114fd0167c40c4
https://github.com/KE-works/pykechain/blob/b0296cf34328fd41660bf6f0b9114fd0167c40c4/pykechain/client.py#L757-L786
train
Retrieves a single KE - chain ServiceExecution object.
KE-works/pykechain
pykechain/client.py
Client.users
def users(self, username=None, pk=None, **kwargs): """ Users of KE-chain. Provide a list of :class:`User`s of KE-chain. You can filter on username or id or any other advanced filter. :param username: (optional) username to filter :type username: basestring or None :para...
python
def users(self, username=None, pk=None, **kwargs): """ Users of KE-chain. Provide a list of :class:`User`s of KE-chain. You can filter on username or id or any other advanced filter. :param username: (optional) username to filter :type username: basestring or None :para...
[ "def", "users", "(", "self", ",", "username", "=", "None", ",", "pk", "=", "None", ",", "*", "*", "kwargs", ")", ":", "request_params", "=", "{", "'username'", ":", "username", ",", "'pk'", ":", "pk", ",", "}", "if", "kwargs", ":", "request_params", ...
Users of KE-chain. Provide a list of :class:`User`s of KE-chain. You can filter on username or id or any other advanced filter. :param username: (optional) username to filter :type username: basestring or None :param pk: (optional) id of the user to filter :type pk: basestring ...
[ "Users", "of", "KE", "-", "chain", "." ]
b0296cf34328fd41660bf6f0b9114fd0167c40c4
https://github.com/KE-works/pykechain/blob/b0296cf34328fd41660bf6f0b9114fd0167c40c4/pykechain/client.py#L788-L816
train
Returns a list of users of KE - chain.
KE-works/pykechain
pykechain/client.py
Client.user
def user(self, username=None, pk=None, **kwargs): """ User of KE-chain. Provides single user of :class:`User` of KE-chain. You can filter on username or id or an advanced filter. :param username: (optional) username to filter :type username: basestring or None :param pk...
python
def user(self, username=None, pk=None, **kwargs): """ User of KE-chain. Provides single user of :class:`User` of KE-chain. You can filter on username or id or an advanced filter. :param username: (optional) username to filter :type username: basestring or None :param pk...
[ "def", "user", "(", "self", ",", "username", "=", "None", ",", "pk", "=", "None", ",", "*", "*", "kwargs", ")", ":", "_users", "=", "self", ".", "users", "(", "username", "=", "username", ",", "pk", "=", "pk", ",", "*", "*", "kwargs", ")", "if"...
User of KE-chain. Provides single user of :class:`User` of KE-chain. You can filter on username or id or an advanced filter. :param username: (optional) username to filter :type username: basestring or None :param pk: (optional) id of the user to filter :type pk: basestring or ...
[ "User", "of", "KE", "-", "chain", "." ]
b0296cf34328fd41660bf6f0b9114fd0167c40c4
https://github.com/KE-works/pykechain/blob/b0296cf34328fd41660bf6f0b9114fd0167c40c4/pykechain/client.py#L818-L841
train
Returns a single user of KE - chain.
KE-works/pykechain
pykechain/client.py
Client.team
def team(self, name=None, id=None, is_hidden=False, **kwargs): """ Team of KE-chain. Provides a team of :class:`Team` of KE-chain. You can filter on team name or provide id. :param name: (optional) team name to filter :type name: basestring or None :param id: (optional)...
python
def team(self, name=None, id=None, is_hidden=False, **kwargs): """ Team of KE-chain. Provides a team of :class:`Team` of KE-chain. You can filter on team name or provide id. :param name: (optional) team name to filter :type name: basestring or None :param id: (optional)...
[ "def", "team", "(", "self", ",", "name", "=", "None", ",", "id", "=", "None", ",", "is_hidden", "=", "False", ",", "*", "*", "kwargs", ")", ":", "_teams", "=", "self", ".", "teams", "(", "name", "=", "name", ",", "id", "=", "id", ",", "*", "*...
Team of KE-chain. Provides a team of :class:`Team` of KE-chain. You can filter on team name or provide id. :param name: (optional) team name to filter :type name: basestring or None :param id: (optional) id of the user to filter :type id: basestring or None :param is_hi...
[ "Team", "of", "KE", "-", "chain", "." ]
b0296cf34328fd41660bf6f0b9114fd0167c40c4
https://github.com/KE-works/pykechain/blob/b0296cf34328fd41660bf6f0b9114fd0167c40c4/pykechain/client.py#L843-L868
train
Provides a team of KE - chain.
KE-works/pykechain
pykechain/client.py
Client.teams
def teams(self, name=None, id=None, is_hidden=False, **kwargs): """ Teams of KE-chain. Provide a list of :class:`Team`s of KE-chain. You can filter on teamname or id or any other advanced filter. :param name: (optional) teamname to filter :type name: basestring or None ...
python
def teams(self, name=None, id=None, is_hidden=False, **kwargs): """ Teams of KE-chain. Provide a list of :class:`Team`s of KE-chain. You can filter on teamname or id or any other advanced filter. :param name: (optional) teamname to filter :type name: basestring or None ...
[ "def", "teams", "(", "self", ",", "name", "=", "None", ",", "id", "=", "None", ",", "is_hidden", "=", "False", ",", "*", "*", "kwargs", ")", ":", "request_params", "=", "{", "'name'", ":", "name", ",", "'id'", ":", "id", ",", "'is_hidden'", ":", ...
Teams of KE-chain. Provide a list of :class:`Team`s of KE-chain. You can filter on teamname or id or any other advanced filter. :param name: (optional) teamname to filter :type name: basestring or None :param id: (optional) id of the team to filter :type id: basestring or None ...
[ "Teams", "of", "KE", "-", "chain", "." ]
b0296cf34328fd41660bf6f0b9114fd0167c40c4
https://github.com/KE-works/pykechain/blob/b0296cf34328fd41660bf6f0b9114fd0167c40c4/pykechain/client.py#L870-L901
train
Returns a list of teams of KE - chain.
KE-works/pykechain
pykechain/client.py
Client.create_activity
def create_activity(self, *args, **kwargs): """ Create a new activity. .. important:: This is a shim function that based on the implementation of KE-chain will determine to create the activity using the legacy WIM API (KE-chain < 2.9.0) or the newer WIM2 API (KE-chain >=...
python
def create_activity(self, *args, **kwargs): """ Create a new activity. .. important:: This is a shim function that based on the implementation of KE-chain will determine to create the activity using the legacy WIM API (KE-chain < 2.9.0) or the newer WIM2 API (KE-chain >=...
[ "def", "create_activity", "(", "self", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "if", "self", ".", "match_app_version", "(", "label", "=", "'wim'", ",", "version", "=", "'<2.0.0'", ",", "default", "=", "True", ")", ":", "# for wim1", "if", ...
Create a new activity. .. important:: This is a shim function that based on the implementation of KE-chain will determine to create the activity using the legacy WIM API (KE-chain < 2.9.0) or the newer WIM2 API (KE-chain >= 2.9.0). It will either return a :class:`Activity` o...
[ "Create", "a", "new", "activity", "." ]
b0296cf34328fd41660bf6f0b9114fd0167c40c4
https://github.com/KE-works/pykechain/blob/b0296cf34328fd41660bf6f0b9114fd0167c40c4/pykechain/client.py#L907-L952
train
This method creates a new activity in a new application.
KE-works/pykechain
pykechain/client.py
Client._create_activity1
def _create_activity1(self, process, name, activity_class="UserTask"): """Create a new activity. :param process: parent process id :type process: basestring :param name: new activity name :type name: basestring :param activity_class: type of activity: UserTask (default) ...
python
def _create_activity1(self, process, name, activity_class="UserTask"): """Create a new activity. :param process: parent process id :type process: basestring :param name: new activity name :type name: basestring :param activity_class: type of activity: UserTask (default) ...
[ "def", "_create_activity1", "(", "self", ",", "process", ",", "name", ",", "activity_class", "=", "\"UserTask\"", ")", ":", "if", "self", ".", "match_app_version", "(", "label", "=", "'wim'", ",", "version", "=", "'>=2.0.0'", ",", "default", "=", "False", ...
Create a new activity. :param process: parent process id :type process: basestring :param name: new activity name :type name: basestring :param activity_class: type of activity: UserTask (default) or Subprocess :type activity_class: basestring :return: the create...
[ "Create", "a", "new", "activity", "." ]
b0296cf34328fd41660bf6f0b9114fd0167c40c4
https://github.com/KE-works/pykechain/blob/b0296cf34328fd41660bf6f0b9114fd0167c40c4/pykechain/client.py#L955-L989
train
Create a new activity.
KE-works/pykechain
pykechain/client.py
Client._create_activity2
def _create_activity2(self, parent, name, activity_type=ActivityType.TASK): """Create a new activity. .. important:: This function creates activities for KE-chain versions later than 2.9.0-135 In effect where the module 'wim' has version '>=2.0.0'. The version of 'wi...
python
def _create_activity2(self, parent, name, activity_type=ActivityType.TASK): """Create a new activity. .. important:: This function creates activities for KE-chain versions later than 2.9.0-135 In effect where the module 'wim' has version '>=2.0.0'. The version of 'wi...
[ "def", "_create_activity2", "(", "self", ",", "parent", ",", "name", ",", "activity_type", "=", "ActivityType", ".", "TASK", ")", ":", "# WIM1: activity_class, WIM2: activity_type", "if", "self", ".", "match_app_version", "(", "label", "=", "'wim'", ",", "version"...
Create a new activity. .. important:: This function creates activities for KE-chain versions later than 2.9.0-135 In effect where the module 'wim' has version '>=2.0.0'. The version of 'wim' in KE-chain can be found in the property :attr:`Client.app_versions` In WIM...
[ "Create", "a", "new", "activity", "." ]
b0296cf34328fd41660bf6f0b9114fd0167c40c4
https://github.com/KE-works/pykechain/blob/b0296cf34328fd41660bf6f0b9114fd0167c40c4/pykechain/client.py#L992-L1041
train
Create a new activity.
KE-works/pykechain
pykechain/client.py
Client._create_part
def _create_part(self, action, data, **kwargs): """Create a part internal core function.""" # suppress_kevents should be in the data (not the query_params) if 'suppress_kevents' in kwargs: data['suppress_kevents'] = kwargs.pop('suppress_kevents') # prepare url query paramete...
python
def _create_part(self, action, data, **kwargs): """Create a part internal core function.""" # suppress_kevents should be in the data (not the query_params) if 'suppress_kevents' in kwargs: data['suppress_kevents'] = kwargs.pop('suppress_kevents') # prepare url query paramete...
[ "def", "_create_part", "(", "self", ",", "action", ",", "data", ",", "*", "*", "kwargs", ")", ":", "# suppress_kevents should be in the data (not the query_params)", "if", "'suppress_kevents'", "in", "kwargs", ":", "data", "[", "'suppress_kevents'", "]", "=", "kwarg...
Create a part internal core function.
[ "Create", "a", "part", "internal", "core", "function", "." ]
b0296cf34328fd41660bf6f0b9114fd0167c40c4
https://github.com/KE-works/pykechain/blob/b0296cf34328fd41660bf6f0b9114fd0167c40c4/pykechain/client.py#L1043-L1060
train
Internal function that creates a part internal core function.
KE-works/pykechain
pykechain/client.py
Client.create_part
def create_part(self, parent, model, name=None, **kwargs): """Create a new part instance from a given model under a given parent. In order to prevent the backend from updating the frontend you may add `suppress_kevents=True` as additional keyword=value argument to this method. This will improve...
python
def create_part(self, parent, model, name=None, **kwargs): """Create a new part instance from a given model under a given parent. In order to prevent the backend from updating the frontend you may add `suppress_kevents=True` as additional keyword=value argument to this method. This will improve...
[ "def", "create_part", "(", "self", ",", "parent", ",", "model", ",", "name", "=", "None", ",", "*", "*", "kwargs", ")", ":", "if", "parent", ".", "category", "!=", "Category", ".", "INSTANCE", ":", "raise", "IllegalArgumentError", "(", "\"The parent should...
Create a new part instance from a given model under a given parent. In order to prevent the backend from updating the frontend you may add `suppress_kevents=True` as additional keyword=value argument to this method. This will improve performance of the backend against a trade-off that someone l...
[ "Create", "a", "new", "part", "instance", "from", "a", "given", "model", "under", "a", "given", "parent", "." ]
b0296cf34328fd41660bf6f0b9114fd0167c40c4
https://github.com/KE-works/pykechain/blob/b0296cf34328fd41660bf6f0b9114fd0167c40c4/pykechain/client.py#L1062-L1096
train
Create a new Part instance from a given model under a given parent.
KE-works/pykechain
pykechain/client.py
Client.create_model
def create_model(self, parent, name, multiplicity='ZERO_MANY', **kwargs): """Create a new child model under a given parent. In order to prevent the backend from updating the frontend you may add `suppress_kevents=True` as additional keyword=value argument to this method. This will improve perfo...
python
def create_model(self, parent, name, multiplicity='ZERO_MANY', **kwargs): """Create a new child model under a given parent. In order to prevent the backend from updating the frontend you may add `suppress_kevents=True` as additional keyword=value argument to this method. This will improve perfo...
[ "def", "create_model", "(", "self", ",", "parent", ",", "name", ",", "multiplicity", "=", "'ZERO_MANY'", ",", "*", "*", "kwargs", ")", ":", "if", "parent", ".", "category", "!=", "Category", ".", "MODEL", ":", "raise", "IllegalArgumentError", "(", "\"The p...
Create a new child model under a given parent. In order to prevent the backend from updating the frontend you may add `suppress_kevents=True` as additional keyword=value argument to this method. This will improve performance of the backend against a trade-off that someone looking at the fronten...
[ "Create", "a", "new", "child", "model", "under", "a", "given", "parent", "." ]
b0296cf34328fd41660bf6f0b9114fd0167c40c4
https://github.com/KE-works/pykechain/blob/b0296cf34328fd41660bf6f0b9114fd0167c40c4/pykechain/client.py#L1098-L1129
train
Create a new child model under a given parent.
KE-works/pykechain
pykechain/client.py
Client._create_clone
def _create_clone(self, parent, part, **kwargs): """Create a new `Part` clone under the `Parent`. .. versionadded:: 2.3 :param parent: parent part :type parent: :class:`models.Part` :param part: part to be cloned :type part: :class:`models.Part` :param kwargs: (...
python
def _create_clone(self, parent, part, **kwargs): """Create a new `Part` clone under the `Parent`. .. versionadded:: 2.3 :param parent: parent part :type parent: :class:`models.Part` :param part: part to be cloned :type part: :class:`models.Part` :param kwargs: (...
[ "def", "_create_clone", "(", "self", ",", "parent", ",", "part", ",", "*", "*", "kwargs", ")", ":", "if", "part", ".", "category", "==", "Category", ".", "MODEL", ":", "select_action", "=", "'clone_model'", "else", ":", "select_action", "=", "'clone_instan...
Create a new `Part` clone under the `Parent`. .. versionadded:: 2.3 :param parent: parent part :type parent: :class:`models.Part` :param part: part to be cloned :type part: :class:`models.Part` :param kwargs: (optional) additional keyword=value arguments :type k...
[ "Create", "a", "new", "Part", "clone", "under", "the", "Parent", "." ]
b0296cf34328fd41660bf6f0b9114fd0167c40c4
https://github.com/KE-works/pykechain/blob/b0296cf34328fd41660bf6f0b9114fd0167c40c4/pykechain/client.py#L1131-L1167
train
Create a new Part under the Parent.
KE-works/pykechain
pykechain/client.py
Client.create_proxy_model
def create_proxy_model(self, model, parent, name, multiplicity='ZERO_MANY', **kwargs): """Add this model as a proxy to another parent model. This will add a model as a proxy model to another parent model. It ensure that it will copy the whole sub-assembly to the 'parent' model. In orde...
python
def create_proxy_model(self, model, parent, name, multiplicity='ZERO_MANY', **kwargs): """Add this model as a proxy to another parent model. This will add a model as a proxy model to another parent model. It ensure that it will copy the whole sub-assembly to the 'parent' model. In orde...
[ "def", "create_proxy_model", "(", "self", ",", "model", ",", "parent", ",", "name", ",", "multiplicity", "=", "'ZERO_MANY'", ",", "*", "*", "kwargs", ")", ":", "if", "model", ".", "category", "!=", "Category", ".", "MODEL", ":", "raise", "IllegalArgumentEr...
Add this model as a proxy to another parent model. This will add a model as a proxy model to another parent model. It ensure that it will copy the whole sub-assembly to the 'parent' model. In order to prevent the backend from updating the frontend you may add `suppress_kevents=True` as ...
[ "Add", "this", "model", "as", "a", "proxy", "to", "another", "parent", "model", "." ]
b0296cf34328fd41660bf6f0b9114fd0167c40c4
https://github.com/KE-works/pykechain/blob/b0296cf34328fd41660bf6f0b9114fd0167c40c4/pykechain/client.py#L1169-L1206
train
Creates a new proxy model for the given model and parent.
KE-works/pykechain
pykechain/client.py
Client.create_property
def create_property(self, model, name, description=None, property_type=PropertyType.CHAR_VALUE, default_value=None, unit=None, options=None): """Create a new property model under a given model. Use the :class:`enums.PropertyType` to select which property type to create to ensure...
python
def create_property(self, model, name, description=None, property_type=PropertyType.CHAR_VALUE, default_value=None, unit=None, options=None): """Create a new property model under a given model. Use the :class:`enums.PropertyType` to select which property type to create to ensure...
[ "def", "create_property", "(", "self", ",", "model", ",", "name", ",", "description", "=", "None", ",", "property_type", "=", "PropertyType", ".", "CHAR_VALUE", ",", "default_value", "=", "None", ",", "unit", "=", "None", ",", "options", "=", "None", ")", ...
Create a new property model under a given model. Use the :class:`enums.PropertyType` to select which property type to create to ensure that you provide the correct values to the KE-chain backend. The default is a `PropertyType.CHAR_VALUE` which is a single line text in KE-chain. :param...
[ "Create", "a", "new", "property", "model", "under", "a", "given", "model", "." ]
b0296cf34328fd41660bf6f0b9114fd0167c40c4
https://github.com/KE-works/pykechain/blob/b0296cf34328fd41660bf6f0b9114fd0167c40c4/pykechain/client.py#L1208-L1277
train
Create a new property model under a given model.
KE-works/pykechain
pykechain/client.py
Client.create_service
def create_service(self, name, scope, description=None, version=None, service_type=ServiceType.PYTHON_SCRIPT, environment_version=ServiceEnvironmentVersion.PYTHON_3_5, pkg_path=None): """ Create a Service. A service can be cre...
python
def create_service(self, name, scope, description=None, version=None, service_type=ServiceType.PYTHON_SCRIPT, environment_version=ServiceEnvironmentVersion.PYTHON_3_5, pkg_path=None): """ Create a Service. A service can be cre...
[ "def", "create_service", "(", "self", ",", "name", ",", "scope", ",", "description", "=", "None", ",", "version", "=", "None", ",", "service_type", "=", "ServiceType", ".", "PYTHON_SCRIPT", ",", "environment_version", "=", "ServiceEnvironmentVersion", ".", "PYTH...
Create a Service. A service can be created only providing the name (and scope). Other information can be added later. If you provide a path to the `kecpkg` (or python script) to upload (`pkg_path`) on creation, this `kecpkg` will be uploaded in one go. If the later fails, the service is still t...
[ "Create", "a", "Service", "." ]
b0296cf34328fd41660bf6f0b9114fd0167c40c4
https://github.com/KE-works/pykechain/blob/b0296cf34328fd41660bf6f0b9114fd0167c40c4/pykechain/client.py#L1279-L1346
train
Creates a new service under the given name scope description version and environment version.
KE-works/pykechain
pykechain/client.py
Client.create_scope
def create_scope(self, name, status=ScopeStatus.ACTIVE, description=None, tags=None, start_date=None, due_date=None, team=None, **kwargs): """ Create a Scope. This will create a scope if the client has the right to do so. Sufficient permissions to create a scope are a ...
python
def create_scope(self, name, status=ScopeStatus.ACTIVE, description=None, tags=None, start_date=None, due_date=None, team=None, **kwargs): """ Create a Scope. This will create a scope if the client has the right to do so. Sufficient permissions to create a scope are a ...
[ "def", "create_scope", "(", "self", ",", "name", ",", "status", "=", "ScopeStatus", ".", "ACTIVE", ",", "description", "=", "None", ",", "tags", "=", "None", ",", "start_date", "=", "None", ",", "due_date", "=", "None", ",", "team", "=", "None", ",", ...
Create a Scope. This will create a scope if the client has the right to do so. Sufficient permissions to create a scope are a superuser, a user in the `GG:Configurators` group or `GG:Managers` group. ..versionadded: 2.6 :param name: Name of the scope :type name: basestring ...
[ "Create", "a", "Scope", "." ]
b0296cf34328fd41660bf6f0b9114fd0167c40c4
https://github.com/KE-works/pykechain/blob/b0296cf34328fd41660bf6f0b9114fd0167c40c4/pykechain/client.py#L1348-L1445
train
Creates a new scope.
KE-works/pykechain
pykechain/client.py
Client.delete_scope
def delete_scope(self, scope): """ Delete a scope. This will delete a scope if the client has the right to do so. Sufficient permissions to delete a scope are a superuser, a user in the `GG:Configurators` group or a user that is the Scope manager of the scope to be deleted. ...
python
def delete_scope(self, scope): """ Delete a scope. This will delete a scope if the client has the right to do so. Sufficient permissions to delete a scope are a superuser, a user in the `GG:Configurators` group or a user that is the Scope manager of the scope to be deleted. ...
[ "def", "delete_scope", "(", "self", ",", "scope", ")", ":", "assert", "isinstance", "(", "scope", ",", "Scope", ")", ",", "'Scope \"{}\" is not a scope!'", ".", "format", "(", "scope", ".", "name", ")", "response", "=", "self", ".", "_request", "(", "'DELE...
Delete a scope. This will delete a scope if the client has the right to do so. Sufficient permissions to delete a scope are a superuser, a user in the `GG:Configurators` group or a user that is the Scope manager of the scope to be deleted. :param scope: Scope object to be deleted ...
[ "Delete", "a", "scope", "." ]
b0296cf34328fd41660bf6f0b9114fd0167c40c4
https://github.com/KE-works/pykechain/blob/b0296cf34328fd41660bf6f0b9114fd0167c40c4/pykechain/client.py#L1447-L1466
train
Delete a scope.
KE-works/pykechain
pykechain/client.py
Client.clone_scope
def clone_scope(self, source_scope, name=None, status=None, start_date=None, due_date=None, description=None, tags=None, team=None, asynchronous=False): """ Clone a Scope. This will clone a scope if the client has the right to do so. Sufficient permissions to clone a scope a...
python
def clone_scope(self, source_scope, name=None, status=None, start_date=None, due_date=None, description=None, tags=None, team=None, asynchronous=False): """ Clone a Scope. This will clone a scope if the client has the right to do so. Sufficient permissions to clone a scope a...
[ "def", "clone_scope", "(", "self", ",", "source_scope", ",", "name", "=", "None", ",", "status", "=", "None", ",", "start_date", "=", "None", ",", "due_date", "=", "None", ",", "description", "=", "None", ",", "tags", "=", "None", ",", "team", "=", "...
Clone a Scope. This will clone a scope if the client has the right to do so. Sufficient permissions to clone a scope are a superuser, a user in the `GG:Configurators` group and a user that is Scope manager of the scope to be clone and member of the `GG:Managers` group as well. If no ad...
[ "Clone", "a", "Scope", "." ]
b0296cf34328fd41660bf6f0b9114fd0167c40c4
https://github.com/KE-works/pykechain/blob/b0296cf34328fd41660bf6f0b9114fd0167c40c4/pykechain/client.py#L1468-L1577
train
Clones a scope.
aptivate/django-sortable-listview
sortable_listview/views.py
SortableListView.get_querystring
def get_querystring(self): """ Clean existing query string (GET parameters) by removing arguments that we don't want to preserve (sort parameter, 'page') """ to_remove = self.get_querystring_parameter_to_remove() query_string = urlparse(self.request.get_full_path()).query...
python
def get_querystring(self): """ Clean existing query string (GET parameters) by removing arguments that we don't want to preserve (sort parameter, 'page') """ to_remove = self.get_querystring_parameter_to_remove() query_string = urlparse(self.request.get_full_path()).query...
[ "def", "get_querystring", "(", "self", ")", ":", "to_remove", "=", "self", ".", "get_querystring_parameter_to_remove", "(", ")", "query_string", "=", "urlparse", "(", "self", ".", "request", ".", "get_full_path", "(", ")", ")", ".", "query", "query_dict", "=",...
Clean existing query string (GET parameters) by removing arguments that we don't want to preserve (sort parameter, 'page')
[ "Clean", "existing", "query", "string", "(", "GET", "parameters", ")", "by", "removing", "arguments", "that", "we", "don", "t", "want", "to", "preserve", "(", "sort", "parameter", "page", ")" ]
9d5fa5847f0c3e80893780c6540e5098635ace9f
https://github.com/aptivate/django-sortable-listview/blob/9d5fa5847f0c3e80893780c6540e5098635ace9f/sortable_listview/views.py#L94-L106
train
Clean existing query string by removing any arguments that we don t want to preserve
aptivate/django-sortable-listview
sortable_listview/views.py
SortableListView.set_sort
def set_sort(self, request): """ Take the sort parameter from the get parameters and split it into the field and the prefix """ # Look for 'sort' in get request. If not available use default. sort_request = request.GET.get(self.sort_parameter, self.default_sort) i...
python
def set_sort(self, request): """ Take the sort parameter from the get parameters and split it into the field and the prefix """ # Look for 'sort' in get request. If not available use default. sort_request = request.GET.get(self.sort_parameter, self.default_sort) i...
[ "def", "set_sort", "(", "self", ",", "request", ")", ":", "# Look for 'sort' in get request. If not available use default.", "sort_request", "=", "request", ".", "GET", ".", "get", "(", "self", ".", "sort_parameter", ",", "self", ".", "default_sort", ")", "if", "s...
Take the sort parameter from the get parameters and split it into the field and the prefix
[ "Take", "the", "sort", "parameter", "from", "the", "get", "parameters", "and", "split", "it", "into", "the", "field", "and", "the", "prefix" ]
9d5fa5847f0c3e80893780c6540e5098635ace9f
https://github.com/aptivate/django-sortable-listview/blob/9d5fa5847f0c3e80893780c6540e5098635ace9f/sortable_listview/views.py#L108-L125
train
Set the sort parameter in the get request and return the order and field of the object.
aptivate/django-sortable-listview
sortable_listview/views.py
SortableListView.get_next_sort_string
def get_next_sort_string(self, field): """ If we're already sorted by the field then the sort query returned reverses the sort order. """ # self.sort_field is the currect sort field if field == self.sort_field: next_sort = self.toggle_sort_order() + field ...
python
def get_next_sort_string(self, field): """ If we're already sorted by the field then the sort query returned reverses the sort order. """ # self.sort_field is the currect sort field if field == self.sort_field: next_sort = self.toggle_sort_order() + field ...
[ "def", "get_next_sort_string", "(", "self", ",", "field", ")", ":", "# self.sort_field is the currect sort field", "if", "field", "==", "self", ".", "sort_field", ":", "next_sort", "=", "self", ".", "toggle_sort_order", "(", ")", "+", "field", "else", ":", "defa...
If we're already sorted by the field then the sort query returned reverses the sort order.
[ "If", "we", "re", "already", "sorted", "by", "the", "field", "then", "the", "sort", "query", "returned", "reverses", "the", "sort", "order", "." ]
9d5fa5847f0c3e80893780c6540e5098635ace9f
https://github.com/aptivate/django-sortable-listview/blob/9d5fa5847f0c3e80893780c6540e5098635ace9f/sortable_listview/views.py#L135-L147
train
Returns the next sort string for the given field.
aptivate/django-sortable-listview
sortable_listview/views.py
SortableListView.get_sort_indicator
def get_sort_indicator(self, field): """ Returns a sort class for the active sort only. That is, if field is not sort_field, then nothing will be returned becaues the sort is not active. """ indicator = '' if field == self.sort_field: indicator = 'sort...
python
def get_sort_indicator(self, field): """ Returns a sort class for the active sort only. That is, if field is not sort_field, then nothing will be returned becaues the sort is not active. """ indicator = '' if field == self.sort_field: indicator = 'sort...
[ "def", "get_sort_indicator", "(", "self", ",", "field", ")", ":", "indicator", "=", "''", "if", "field", "==", "self", ".", "sort_field", ":", "indicator", "=", "'sort-asc'", "if", "self", ".", "sort_order", "==", "'-'", ":", "indicator", "=", "'sort-desc'...
Returns a sort class for the active sort only. That is, if field is not sort_field, then nothing will be returned becaues the sort is not active.
[ "Returns", "a", "sort", "class", "for", "the", "active", "sort", "only", ".", "That", "is", "if", "field", "is", "not", "sort_field", "then", "nothing", "will", "be", "returned", "becaues", "the", "sort", "is", "not", "active", "." ]
9d5fa5847f0c3e80893780c6540e5098635ace9f
https://github.com/aptivate/django-sortable-listview/blob/9d5fa5847f0c3e80893780c6540e5098635ace9f/sortable_listview/views.py#L149-L160
train
Returns a sort class for the active sort only.