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/__notebook_support__.py
plot_compare_resolutions
def plot_compare_resolutions(time, signal_res_1, signal_res_2, sampling_rate): """ ----- Brief ----- With the current function it will be presented a gridplot with 2 rows, where three plots are graphically represented ----------- Description ----------- Acquiring data with a rig...
python
def plot_compare_resolutions(time, signal_res_1, signal_res_2, sampling_rate): """ ----- Brief ----- With the current function it will be presented a gridplot with 2 rows, where three plots are graphically represented ----------- Description ----------- Acquiring data with a rig...
[ "def", "plot_compare_resolutions", "(", "time", ",", "signal_res_1", ",", "signal_res_2", ",", "sampling_rate", ")", ":", "# Figure with the two plots", "figure_8_16", "=", "figure", "(", "x_axis_label", "=", "'Time (s)'", ",", "y_axis_label", "=", "\"Temperature (ºC)\"...
----- Brief ----- With the current function it will be presented a gridplot with 2 rows, where three plots are graphically represented ----------- Description ----------- Acquiring data with a right resolution ensures that posterior conclusions will be more reliable and effective. ...
[ "-----", "Brief", "-----", "With", "the", "current", "function", "it", "will", "be", "presented", "a", "gridplot", "with", "2", "rows", "where", "three", "plots", "are", "graphically", "represented" ]
aaa01d4125180b3a34f1e26e0d3ff08c23f666d3
https://github.com/biosignalsnotebooks/biosignalsnotebooks/blob/aaa01d4125180b3a34f1e26e0d3ff08c23f666d3/biosignalsnotebooks/build/lib/biosignalsnotebooks/__notebook_support__.py#L1235-L1295
train
This function generates a Bokeh gridplot that plots two synchronized signals acquired with different resolutions.
biosignalsnotebooks/biosignalsnotebooks
biosignalsnotebooks/build/lib/biosignalsnotebooks/__notebook_support__.py
plot_resp_slow
def plot_resp_slow(signal, rect_signal, sample_rate): """ ----- Brief ----- Figure intended to represent the acquired RIP signal together with a rectangular signal defining inhalation and exhalation periods. ----------- Description ----------- Function design to generate a Bokeh...
python
def plot_resp_slow(signal, rect_signal, sample_rate): """ ----- Brief ----- Figure intended to represent the acquired RIP signal together with a rectangular signal defining inhalation and exhalation periods. ----------- Description ----------- Function design to generate a Bokeh...
[ "def", "plot_resp_slow", "(", "signal", ",", "rect_signal", ",", "sample_rate", ")", ":", "signal", "=", "numpy", ".", "array", "(", "signal", ")", "-", "numpy", ".", "average", "(", "signal", ")", "rect_signal", "=", "numpy", ".", "array", "(", "rect_si...
----- Brief ----- Figure intended to represent the acquired RIP signal together with a rectangular signal defining inhalation and exhalation periods. ----------- Description ----------- Function design to generate a Bokeh figure containing the evolution of RIP signal, when slow resp...
[ "-----", "Brief", "-----", "Figure", "intended", "to", "represent", "the", "acquired", "RIP", "signal", "together", "with", "a", "rectangular", "signal", "defining", "inhalation", "and", "exhalation", "periods", "." ]
aaa01d4125180b3a34f1e26e0d3ff08c23f666d3
https://github.com/biosignalsnotebooks/biosignalsnotebooks/blob/aaa01d4125180b3a34f1e26e0d3ff08c23f666d3/biosignalsnotebooks/build/lib/biosignalsnotebooks/__notebook_support__.py#L1304-L1389
train
This function generates a Bokeh figure that represents the slow respiration cycle of the RIP signal and rectangular signal.
biosignalsnotebooks/biosignalsnotebooks
biosignalsnotebooks/build/lib/biosignalsnotebooks/__notebook_support__.py
plot_resp_diff
def plot_resp_diff(signal, rect_signal, sample_rate): """ Function design to generate a Bokeh figure containing the evolution of RIP signal, when respiration was suspended for a long period, the rectangular signal that defines the stages of inhalation and exhalation and the first derivative of the RIP s...
python
def plot_resp_diff(signal, rect_signal, sample_rate): """ Function design to generate a Bokeh figure containing the evolution of RIP signal, when respiration was suspended for a long period, the rectangular signal that defines the stages of inhalation and exhalation and the first derivative of the RIP s...
[ "def", "plot_resp_diff", "(", "signal", ",", "rect_signal", ",", "sample_rate", ")", ":", "signal", "=", "numpy", ".", "array", "(", "signal", ")", "-", "numpy", ".", "average", "(", "signal", ")", "rect_signal", "=", "numpy", ".", "array", "(", "rect_si...
Function design to generate a Bokeh figure containing the evolution of RIP signal, when respiration was suspended for a long period, the rectangular signal that defines the stages of inhalation and exhalation and the first derivative of the RIP signal. Applied in the Notebook "Particularities of Inductive ...
[ "Function", "design", "to", "generate", "a", "Bokeh", "figure", "containing", "the", "evolution", "of", "RIP", "signal", "when", "respiration", "was", "suspended", "for", "a", "long", "period", "the", "rectangular", "signal", "that", "defines", "the", "stages", ...
aaa01d4125180b3a34f1e26e0d3ff08c23f666d3
https://github.com/biosignalsnotebooks/biosignalsnotebooks/blob/aaa01d4125180b3a34f1e26e0d3ff08c23f666d3/biosignalsnotebooks/build/lib/biosignalsnotebooks/__notebook_support__.py#L1393-L1494
train
Function design to generate a Bokeh figure containing the evolution of RIP signal and rectangular signal that has the first derivative of the RIP signal.
biosignalsnotebooks/biosignalsnotebooks
biosignalsnotebooks/build/lib/biosignalsnotebooks/__notebook_support__.py
download
def download(link, out): """ Downloading data from websites, such as previously acquired physiological signals, is an extremely relevant task, taking into consideration that, without data, processing cannot take place. With the current function a file can be easily downloaded through the "link" input. ...
python
def download(link, out): """ Downloading data from websites, such as previously acquired physiological signals, is an extremely relevant task, taking into consideration that, without data, processing cannot take place. With the current function a file can be easily downloaded through the "link" input. ...
[ "def", "download", "(", "link", ",", "out", ")", ":", "# [Source: https://stackoverflow.com/questions/7243750/download-file-from-web-in-python-3]", "r", "=", "requests", ".", "get", "(", "link", ")", "with", "open", "(", "out", ",", "'wb'", ")", "as", "outfile", "...
Downloading data from websites, such as previously acquired physiological signals, is an extremely relevant task, taking into consideration that, without data, processing cannot take place. With the current function a file can be easily downloaded through the "link" input. ---------- Parameters --...
[ "Downloading", "data", "from", "websites", "such", "as", "previously", "acquired", "physiological", "signals", "is", "an", "extremely", "relevant", "task", "taking", "into", "consideration", "that", "without", "data", "processing", "cannot", "take", "place", "." ]
aaa01d4125180b3a34f1e26e0d3ff08c23f666d3
https://github.com/biosignalsnotebooks/biosignalsnotebooks/blob/aaa01d4125180b3a34f1e26e0d3ff08c23f666d3/biosignalsnotebooks/build/lib/biosignalsnotebooks/__notebook_support__.py#L1496-L1517
train
Downloads a file from a web site.
biosignalsnotebooks/biosignalsnotebooks
biosignalsnotebooks/build/lib/biosignalsnotebooks/__notebook_support__.py
_inhal_exhal_segments
def _inhal_exhal_segments(fig, time, signal, inhal_begin, inhal_end, exhal_begin, exhal_end): """ Auxiliary function used to plot each inhalation/exhalation segment. ---------- Parameters ---------- fig : Bokeh figure Figure where inhalation/exhalation segments will be plotted. tim...
python
def _inhal_exhal_segments(fig, time, signal, inhal_begin, inhal_end, exhal_begin, exhal_end): """ Auxiliary function used to plot each inhalation/exhalation segment. ---------- Parameters ---------- fig : Bokeh figure Figure where inhalation/exhalation segments will be plotted. tim...
[ "def", "_inhal_exhal_segments", "(", "fig", ",", "time", ",", "signal", ",", "inhal_begin", ",", "inhal_end", ",", "exhal_begin", ",", "exhal_end", ")", ":", "inhal_color", "=", "opensignals_color_pallet", "(", ")", "exhal_color", "=", "opensignals_color_pallet", ...
Auxiliary function used to plot each inhalation/exhalation segment. ---------- Parameters ---------- fig : Bokeh figure Figure where inhalation/exhalation segments will be plotted. time : list Time axis. signal : list Data samples of the acquired/processed signal. ...
[ "Auxiliary", "function", "used", "to", "plot", "each", "inhalation", "/", "exhalation", "segment", "." ]
aaa01d4125180b3a34f1e26e0d3ff08c23f666d3
https://github.com/biosignalsnotebooks/biosignalsnotebooks/blob/aaa01d4125180b3a34f1e26e0d3ff08c23f666d3/biosignalsnotebooks/build/lib/biosignalsnotebooks/__notebook_support__.py#L1519-L1569
train
Plots the inhalation and exhalation segments.
biosignalsnotebooks/biosignalsnotebooks
biosignalsnotebooks/build/lib/biosignalsnotebooks/external_packages/novainstrumentation/peaks.py
_boolrelextrema
def _boolrelextrema(data, comparator, axis=0, order=1, mode='clip'): """ Calculate the relative extrema of `data`. Relative extrema are calculated by finding locations where ``comparator(data[n], data[n+1:n+order+1])`` is True. Parameters ---------- data : ndarray ...
python
def _boolrelextrema(data, comparator, axis=0, order=1, mode='clip'): """ Calculate the relative extrema of `data`. Relative extrema are calculated by finding locations where ``comparator(data[n], data[n+1:n+order+1])`` is True. Parameters ---------- data : ndarray ...
[ "def", "_boolrelextrema", "(", "data", ",", "comparator", ",", "axis", "=", "0", ",", "order", "=", "1", ",", "mode", "=", "'clip'", ")", ":", "if", "(", "(", "int", "(", "order", ")", "!=", "order", ")", "or", "(", "order", "<", "1", ")", ")",...
Calculate the relative extrema of `data`. Relative extrema are calculated by finding locations where ``comparator(data[n], data[n+1:n+order+1])`` is True. Parameters ---------- data : ndarray Array in which to find the relative extrema. comparator : callable Function to use to ...
[ "Calculate", "the", "relative", "extrema", "of", "data", "." ]
aaa01d4125180b3a34f1e26e0d3ff08c23f666d3
https://github.com/biosignalsnotebooks/biosignalsnotebooks/blob/aaa01d4125180b3a34f1e26e0d3ff08c23f666d3/biosignalsnotebooks/build/lib/biosignalsnotebooks/external_packages/novainstrumentation/peaks.py#L17-L72
train
Calculate the relative extrema of data.
biosignalsnotebooks/biosignalsnotebooks
biosignalsnotebooks/build/lib/biosignalsnotebooks/external_packages/novainstrumentation/peaks.py
argrelmin
def argrelmin(data, axis=0, order=1, mode='clip'): """ Calculate the relative minima of `data`. .. versionadded:: 0.11.0 Parameters ---------- data : ndarray Array in which to find the relative minima. axis : int, optional Axis over which to select from `data`. Default is ...
python
def argrelmin(data, axis=0, order=1, mode='clip'): """ Calculate the relative minima of `data`. .. versionadded:: 0.11.0 Parameters ---------- data : ndarray Array in which to find the relative minima. axis : int, optional Axis over which to select from `data`. Default is ...
[ "def", "argrelmin", "(", "data", ",", "axis", "=", "0", ",", "order", "=", "1", ",", "mode", "=", "'clip'", ")", ":", "return", "argrelextrema", "(", "data", ",", "np", ".", "less", ",", "axis", ",", "order", ",", "mode", ")" ]
Calculate the relative minima of `data`. .. versionadded:: 0.11.0 Parameters ---------- data : ndarray Array in which to find the relative minima. axis : int, optional Axis over which to select from `data`. Default is 0. order : int, optional How many points on each si...
[ "Calculate", "the", "relative", "minima", "of", "data", "." ]
aaa01d4125180b3a34f1e26e0d3ff08c23f666d3
https://github.com/biosignalsnotebooks/biosignalsnotebooks/blob/aaa01d4125180b3a34f1e26e0d3ff08c23f666d3/biosignalsnotebooks/build/lib/biosignalsnotebooks/external_packages/novainstrumentation/peaks.py#L75-L110
train
Calculate the relative minima of data.
biosignalsnotebooks/biosignalsnotebooks
biosignalsnotebooks/build/lib/biosignalsnotebooks/external_packages/novainstrumentation/peaks.py
argrelmax
def argrelmax(data, axis=0, order=1, mode='clip'): """ Calculate the relative maxima of `data`. .. versionadded:: 0.11.0 Parameters ---------- data : ndarray Array in which to find the relative maxima. axis : int, optional Axis over which to select from `data`. Default is ...
python
def argrelmax(data, axis=0, order=1, mode='clip'): """ Calculate the relative maxima of `data`. .. versionadded:: 0.11.0 Parameters ---------- data : ndarray Array in which to find the relative maxima. axis : int, optional Axis over which to select from `data`. Default is ...
[ "def", "argrelmax", "(", "data", ",", "axis", "=", "0", ",", "order", "=", "1", ",", "mode", "=", "'clip'", ")", ":", "return", "argrelextrema", "(", "data", ",", "np", ".", "greater", ",", "axis", ",", "order", ",", "mode", ")" ]
Calculate the relative maxima of `data`. .. versionadded:: 0.11.0 Parameters ---------- data : ndarray Array in which to find the relative maxima. axis : int, optional Axis over which to select from `data`. Default is 0. order : int, optional How many points on each si...
[ "Calculate", "the", "relative", "maxima", "of", "data", "." ]
aaa01d4125180b3a34f1e26e0d3ff08c23f666d3
https://github.com/biosignalsnotebooks/biosignalsnotebooks/blob/aaa01d4125180b3a34f1e26e0d3ff08c23f666d3/biosignalsnotebooks/build/lib/biosignalsnotebooks/external_packages/novainstrumentation/peaks.py#L113-L148
train
Calculate the relative maxima of data.
biosignalsnotebooks/biosignalsnotebooks
biosignalsnotebooks/build/lib/biosignalsnotebooks/external_packages/novainstrumentation/peaks.py
argrelextrema
def argrelextrema(data, comparator, axis=0, order=1, mode='clip'): """ Calculate the relative extrema of `data`. .. versionadded:: 0.11.0 Parameters ---------- data : ndarray Array in which to find the relative extrema. comparator : callable Function to use to compare two d...
python
def argrelextrema(data, comparator, axis=0, order=1, mode='clip'): """ Calculate the relative extrema of `data`. .. versionadded:: 0.11.0 Parameters ---------- data : ndarray Array in which to find the relative extrema. comparator : callable Function to use to compare two d...
[ "def", "argrelextrema", "(", "data", ",", "comparator", ",", "axis", "=", "0", ",", "order", "=", "1", ",", "mode", "=", "'clip'", ")", ":", "results", "=", "_boolrelextrema", "(", "data", ",", "comparator", ",", "axis", ",", "order", ",", "mode", ")...
Calculate the relative extrema of `data`. .. versionadded:: 0.11.0 Parameters ---------- data : ndarray Array in which to find the relative extrema. comparator : callable Function to use to compare two data points. Should take 2 numbers as arguments. axis : int, optiona...
[ "Calculate", "the", "relative", "extrema", "of", "data", "." ]
aaa01d4125180b3a34f1e26e0d3ff08c23f666d3
https://github.com/biosignalsnotebooks/biosignalsnotebooks/blob/aaa01d4125180b3a34f1e26e0d3ff08c23f666d3/biosignalsnotebooks/build/lib/biosignalsnotebooks/external_packages/novainstrumentation/peaks.py#L151-L190
train
Calculate the relative extrema of data.
biosignalsnotebooks/biosignalsnotebooks
biosignalsnotebooks/build/lib/biosignalsnotebooks/external_packages/novainstrumentation/peaks.py
peaks
def peaks(signal, tol=None): """ This function detects all the peaks of a signal and returns those time positions. To reduce the amount of peaks detected, a threshold is introduced so only the peaks above that value are considered. Parameters ---------- x: array-like the signal with the pe...
python
def peaks(signal, tol=None): """ This function detects all the peaks of a signal and returns those time positions. To reduce the amount of peaks detected, a threshold is introduced so only the peaks above that value are considered. Parameters ---------- x: array-like the signal with the pe...
[ "def", "peaks", "(", "signal", ",", "tol", "=", "None", ")", ":", "if", "(", "tol", "is", "None", ")", ":", "tol", "=", "min", "(", "signal", ")", "pks", "=", "argrelmax", "(", "clip", "(", "signal", ",", "tol", ",", "signal", ".", "max", "(", ...
This function detects all the peaks of a signal and returns those time positions. To reduce the amount of peaks detected, a threshold is introduced so only the peaks above that value are considered. Parameters ---------- x: array-like the signal with the peaks to detect. tol: int the...
[ "This", "function", "detects", "all", "the", "peaks", "of", "a", "signal", "and", "returns", "those", "time", "positions", ".", "To", "reduce", "the", "amount", "of", "peaks", "detected", "a", "threshold", "is", "introduced", "so", "only", "the", "peaks", ...
aaa01d4125180b3a34f1e26e0d3ff08c23f666d3
https://github.com/biosignalsnotebooks/biosignalsnotebooks/blob/aaa01d4125180b3a34f1e26e0d3ff08c23f666d3/biosignalsnotebooks/build/lib/biosignalsnotebooks/external_packages/novainstrumentation/peaks.py#L197-L229
train
This function detects all the peaks of a signal and returns those time - series positions.
biosignalsnotebooks/biosignalsnotebooks
biosignalsnotebooks/build/lib/biosignalsnotebooks/external_packages/novainstrumentation/peaks.py
clean_near_peaks
def clean_near_peaks(signal, peaks_, min_distance): """ Given an array with all the peaks of the signal ('peaks') and a distance value ('min_distance') and the signal, by argument, this function erases all the unnecessary peaks and returns an array with only the maximum peak for each period of the signa...
python
def clean_near_peaks(signal, peaks_, min_distance): """ Given an array with all the peaks of the signal ('peaks') and a distance value ('min_distance') and the signal, by argument, this function erases all the unnecessary peaks and returns an array with only the maximum peak for each period of the signa...
[ "def", "clean_near_peaks", "(", "signal", ",", "peaks_", ",", "min_distance", ")", ":", "#order all peaks", "ars", "=", "argsort", "(", "signal", "[", "peaks_", "]", ")", "pp", "=", "peaks", "(", "ars", ")", "fp", "=", "[", "]", "#clean near peaks", "whi...
Given an array with all the peaks of the signal ('peaks') and a distance value ('min_distance') and the signal, by argument, this function erases all the unnecessary peaks and returns an array with only the maximum peak for each period of the signal (the period is given by the min_distance). Parame...
[ "Given", "an", "array", "with", "all", "the", "peaks", "of", "the", "signal", "(", "peaks", ")", "and", "a", "distance", "value", "(", "min_distance", ")", "and", "the", "signal", "by", "argument", "this", "function", "erases", "all", "the", "unnecessary",...
aaa01d4125180b3a34f1e26e0d3ff08c23f666d3
https://github.com/biosignalsnotebooks/biosignalsnotebooks/blob/aaa01d4125180b3a34f1e26e0d3ff08c23f666d3/biosignalsnotebooks/build/lib/biosignalsnotebooks/external_packages/novainstrumentation/peaks.py#L242-L279
train
This function cleans up the peaks of the signal that are near the given distance value.
biosignalsnotebooks/biosignalsnotebooks
biosignalsnotebooks/build/lib/biosignalsnotebooks/external_packages/novainstrumentation/peaks.py
clean_near_events
def clean_near_events(points, min_distance): """ Given an array with some specific points of the signal and a distance value, this function erases all the surplus points and returns an array with only one point (the first point) per distance samples values Parameters ---------- points: array-li...
python
def clean_near_events(points, min_distance): """ Given an array with some specific points of the signal and a distance value, this function erases all the surplus points and returns an array with only one point (the first point) per distance samples values Parameters ---------- points: array-li...
[ "def", "clean_near_events", "(", "points", ",", "min_distance", ")", ":", "fp", "=", "[", "]", "points", "=", "array", "(", "points", ")", "while", "len", "(", "points", ")", ">", "0", ":", "fp", "+=", "[", "points", "[", "0", "]", "]", "points", ...
Given an array with some specific points of the signal and a distance value, this function erases all the surplus points and returns an array with only one point (the first point) per distance samples values Parameters ---------- points: array-like the events to filter. min_distance: int ...
[ "Given", "an", "array", "with", "some", "specific", "points", "of", "the", "signal", "and", "a", "distance", "value", "this", "function", "erases", "all", "the", "surplus", "points", "and", "returns", "an", "array", "with", "only", "one", "point", "(", "th...
aaa01d4125180b3a34f1e26e0d3ff08c23f666d3
https://github.com/biosignalsnotebooks/biosignalsnotebooks/blob/aaa01d4125180b3a34f1e26e0d3ff08c23f666d3/biosignalsnotebooks/build/lib/biosignalsnotebooks/external_packages/novainstrumentation/peaks.py#L282-L312
train
This function erases all the surplus points and returns a new array containing only one event per period.
KE-works/pykechain
pykechain/helpers.py
get_project
def get_project(url=None, username=None, password=None, token=None, scope=None, scope_id=None, env_filename=None, status=ScopeStatus.ACTIVE): """ Retrieve and return the KE-chain project to be used throughout an app. This helper is made to bootstrap a pykechain enabled python script or an j...
python
def get_project(url=None, username=None, password=None, token=None, scope=None, scope_id=None, env_filename=None, status=ScopeStatus.ACTIVE): """ Retrieve and return the KE-chain project to be used throughout an app. This helper is made to bootstrap a pykechain enabled python script or an j...
[ "def", "get_project", "(", "url", "=", "None", ",", "username", "=", "None", ",", "password", "=", "None", ",", "token", "=", "None", ",", "scope", "=", "None", ",", "scope_id", "=", "None", ",", "env_filename", "=", "None", ",", "status", "=", "Scop...
Retrieve and return the KE-chain project to be used throughout an app. This helper is made to bootstrap a pykechain enabled python script or an jupyter notebook with the correct project (technically this is a `pykechain.models.Scope` model). When no parameters are passed in this function, it will try to r...
[ "Retrieve", "and", "return", "the", "KE", "-", "chain", "project", "to", "be", "used", "throughout", "an", "app", "." ]
b0296cf34328fd41660bf6f0b9114fd0167c40c4
https://github.com/KE-works/pykechain/blob/b0296cf34328fd41660bf6f0b9114fd0167c40c4/pykechain/helpers.py#L9-L118
train
Retrieve and return a KE - chain project.
thomasdelaet/python-velbus
velbus/messages/push_button_status.py
PushButtonStatusMessage.populate
def populate(self, priority, address, rtr, data): """ :return: None """ assert isinstance(data, bytes) self.needs_high_priority(priority) self.needs_no_rtr(rtr) self.needs_data(data, 3) self.set_attributes(priority, address, rtr) self.closed = self...
python
def populate(self, priority, address, rtr, data): """ :return: None """ assert isinstance(data, bytes) self.needs_high_priority(priority) self.needs_no_rtr(rtr) self.needs_data(data, 3) self.set_attributes(priority, address, rtr) self.closed = self...
[ "def", "populate", "(", "self", ",", "priority", ",", "address", ",", "rtr", ",", "data", ")", ":", "assert", "isinstance", "(", "data", ",", "bytes", ")", "self", ".", "needs_high_priority", "(", "priority", ")", "self", ".", "needs_no_rtr", "(", "rtr",...
:return: None
[ ":", "return", ":", "None" ]
af2f8af43f1a24bf854eff9f3126fd7b5c41b3dd
https://github.com/thomasdelaet/python-velbus/blob/af2f8af43f1a24bf854eff9f3126fd7b5c41b3dd/velbus/messages/push_button_status.py#L23-L34
train
Populates the object with the data from the given byte array.
thomasdelaet/python-velbus
velbus/messages/push_button_status.py
PushButtonStatusMessage.to_json
def to_json(self): """ :return: str """ json_dict = self.to_json_basic() json_dict['closed_channels'] = self.closed json_dict['opened_channels'] = self.opened json_dict['closed_long_channels'] = self.closed_long return json.dumps(json_dict)
python
def to_json(self): """ :return: str """ json_dict = self.to_json_basic() json_dict['closed_channels'] = self.closed json_dict['opened_channels'] = self.opened json_dict['closed_long_channels'] = self.closed_long return json.dumps(json_dict)
[ "def", "to_json", "(", "self", ")", ":", "json_dict", "=", "self", ".", "to_json_basic", "(", ")", "json_dict", "[", "'closed_channels'", "]", "=", "self", ".", "closed", "json_dict", "[", "'opened_channels'", "]", "=", "self", ".", "opened", "json_dict", ...
:return: str
[ ":", "return", ":", "str" ]
af2f8af43f1a24bf854eff9f3126fd7b5c41b3dd
https://github.com/thomasdelaet/python-velbus/blob/af2f8af43f1a24bf854eff9f3126fd7b5c41b3dd/velbus/messages/push_button_status.py#L42-L50
train
Returns a JSON string representation of the current object.
thomasdelaet/python-velbus
velbus/messages/push_button_status.py
PushButtonStatusMessage.data_to_binary
def data_to_binary(self): """ :return: bytes """ return bytes([ COMMAND_CODE, self.channels_to_byte(self.closed), self.channels_to_byte(self.opened), self.channels_to_byte(self.closed_long) ])
python
def data_to_binary(self): """ :return: bytes """ return bytes([ COMMAND_CODE, self.channels_to_byte(self.closed), self.channels_to_byte(self.opened), self.channels_to_byte(self.closed_long) ])
[ "def", "data_to_binary", "(", "self", ")", ":", "return", "bytes", "(", "[", "COMMAND_CODE", ",", "self", ".", "channels_to_byte", "(", "self", ".", "closed", ")", ",", "self", ".", "channels_to_byte", "(", "self", ".", "opened", ")", ",", "self", ".", ...
:return: bytes
[ ":", "return", ":", "bytes" ]
af2f8af43f1a24bf854eff9f3126fd7b5c41b3dd
https://github.com/thomasdelaet/python-velbus/blob/af2f8af43f1a24bf854eff9f3126fd7b5c41b3dd/velbus/messages/push_button_status.py#L58-L67
train
Converts the data to binary format.
mikeboers/MultiMap
multimap.py
MultiMap._rebuild_key_ids
def _rebuild_key_ids(self): """Rebuild the internal key to index mapping.""" self._key_ids = collections.defaultdict(list) for i, x in enumerate(self._pairs): self._key_ids[x[0]].append(i)
python
def _rebuild_key_ids(self): """Rebuild the internal key to index mapping.""" self._key_ids = collections.defaultdict(list) for i, x in enumerate(self._pairs): self._key_ids[x[0]].append(i)
[ "def", "_rebuild_key_ids", "(", "self", ")", ":", "self", ".", "_key_ids", "=", "collections", ".", "defaultdict", "(", "list", ")", "for", "i", ",", "x", "in", "enumerate", "(", "self", ".", "_pairs", ")", ":", "self", ".", "_key_ids", "[", "x", "["...
Rebuild the internal key to index mapping.
[ "Rebuild", "the", "internal", "key", "to", "index", "mapping", "." ]
0251e5d5df693cc247b4ac5b95adfdd10e3bec04
https://github.com/mikeboers/MultiMap/blob/0251e5d5df693cc247b4ac5b95adfdd10e3bec04/multimap.py#L71-L75
train
Rebuild the internal key to index mapping.
mikeboers/MultiMap
multimap.py
MultiMap._conform_pair
def _conform_pair(self, pair): """Force a given key/value pair into a certain form. Override the _conform_key and _conform_value if you want to change the mapping behaviour. """ pair = tuple(pair) if len(pair) != 2: raise ValueError('MultiMap...
python
def _conform_pair(self, pair): """Force a given key/value pair into a certain form. Override the _conform_key and _conform_value if you want to change the mapping behaviour. """ pair = tuple(pair) if len(pair) != 2: raise ValueError('MultiMap...
[ "def", "_conform_pair", "(", "self", ",", "pair", ")", ":", "pair", "=", "tuple", "(", "pair", ")", "if", "len", "(", "pair", ")", "!=", "2", ":", "raise", "ValueError", "(", "'MultiMap element must have length 2'", ")", "return", "(", "self", ".", "_con...
Force a given key/value pair into a certain form. Override the _conform_key and _conform_value if you want to change the mapping behaviour.
[ "Force", "a", "given", "key", "/", "value", "pair", "into", "a", "certain", "form", ".", "Override", "the", "_conform_key", "and", "_conform_value", "if", "you", "want", "to", "change", "the", "mapping", "behaviour", "." ]
0251e5d5df693cc247b4ac5b95adfdd10e3bec04
https://github.com/mikeboers/MultiMap/blob/0251e5d5df693cc247b4ac5b95adfdd10e3bec04/multimap.py#L93-L103
train
Force a given key value pair into a certain form.
mikeboers/MultiMap
multimap.py
MultiMap.getall
def getall(self, key): """A list of all the values stored under this key. Returns an empty list if there are no values under this key. >>> m = MultiMap([('a', 1), ('b', 2), ('b', 3), ('c', 4), ('d', 5), ('c', 6)]) >>> m.getall('a') [1] >>> m.getall('b') ...
python
def getall(self, key): """A list of all the values stored under this key. Returns an empty list if there are no values under this key. >>> m = MultiMap([('a', 1), ('b', 2), ('b', 3), ('c', 4), ('d', 5), ('c', 6)]) >>> m.getall('a') [1] >>> m.getall('b') ...
[ "def", "getall", "(", "self", ",", "key", ")", ":", "key", "=", "self", ".", "_conform_key", "(", "key", ")", "return", "[", "self", ".", "_pairs", "[", "i", "]", "[", "1", "]", "for", "i", "in", "self", ".", "_key_ids", "[", "key", "]", "]" ]
A list of all the values stored under this key. Returns an empty list if there are no values under this key. >>> m = MultiMap([('a', 1), ('b', 2), ('b', 3), ('c', 4), ('d', 5), ('c', 6)]) >>> m.getall('a') [1] >>> m.getall('b') [2, 3] >>> m.getal...
[ "A", "list", "of", "all", "the", "values", "stored", "under", "this", "key", ".", "Returns", "an", "empty", "list", "if", "there", "are", "no", "values", "under", "this", "key", ".", ">>>", "m", "=", "MultiMap", "(", "[", "(", "a", "1", ")", "(", ...
0251e5d5df693cc247b4ac5b95adfdd10e3bec04
https://github.com/mikeboers/MultiMap/blob/0251e5d5df693cc247b4ac5b95adfdd10e3bec04/multimap.py#L186-L201
train
A list of all the values stored under this key. Returns an empty list if there are no values under this key.
mikeboers/MultiMap
multimap.py
MultiMap.iteritems
def iteritems(self): """Iterator across all the non-duplicate keys and their values. Only yields the first key of duplicates. """ keys_yielded = set() for k, v in self._pairs: if k not in keys_yielded: keys_yielded.add(k) ...
python
def iteritems(self): """Iterator across all the non-duplicate keys and their values. Only yields the first key of duplicates. """ keys_yielded = set() for k, v in self._pairs: if k not in keys_yielded: keys_yielded.add(k) ...
[ "def", "iteritems", "(", "self", ")", ":", "keys_yielded", "=", "set", "(", ")", "for", "k", ",", "v", "in", "self", ".", "_pairs", ":", "if", "k", "not", "in", "keys_yielded", ":", "keys_yielded", ".", "add", "(", "k", ")", "yield", "k", ",", "v...
Iterator across all the non-duplicate keys and their values. Only yields the first key of duplicates.
[ "Iterator", "across", "all", "the", "non", "-", "duplicate", "keys", "and", "their", "values", ".", "Only", "yields", "the", "first", "key", "of", "duplicates", "." ]
0251e5d5df693cc247b4ac5b95adfdd10e3bec04
https://github.com/mikeboers/MultiMap/blob/0251e5d5df693cc247b4ac5b95adfdd10e3bec04/multimap.py#L206-L216
train
Iterate over all the non - duplicate keys and their values. Only yields the first key of duplicates.
mikeboers/MultiMap
multimap.py
MutableMultiMap._remove_pairs
def _remove_pairs(self, ids_to_remove): """Remove the pairs identified by the given indices into _pairs. Removes the pair, and updates the _key_ids mapping to be accurate. Removing the ids from the _key_ids is your own responsibility. Params: ids_to_remove -...
python
def _remove_pairs(self, ids_to_remove): """Remove the pairs identified by the given indices into _pairs. Removes the pair, and updates the _key_ids mapping to be accurate. Removing the ids from the _key_ids is your own responsibility. Params: ids_to_remove -...
[ "def", "_remove_pairs", "(", "self", ",", "ids_to_remove", ")", ":", "# Remove them.", "for", "i", "in", "reversed", "(", "ids_to_remove", ")", ":", "del", "self", ".", "_pairs", "[", "i", "]", "# We use the bisect to tell us how many spots the given index is", "# s...
Remove the pairs identified by the given indices into _pairs. Removes the pair, and updates the _key_ids mapping to be accurate. Removing the ids from the _key_ids is your own responsibility. Params: ids_to_remove -- The indices to remove. MUST be sorted.
[ "Remove", "the", "pairs", "identified", "by", "the", "given", "indices", "into", "_pairs", ".", "Removes", "the", "pair", "and", "updates", "the", "_key_ids", "mapping", "to", "be", "accurate", ".", "Removing", "the", "ids", "from", "the", "_key_ids", "is", ...
0251e5d5df693cc247b4ac5b95adfdd10e3bec04
https://github.com/mikeboers/MultiMap/blob/0251e5d5df693cc247b4ac5b95adfdd10e3bec04/multimap.py#L379-L397
train
Remove the pairs identified by the given indices into _pairs.
mikeboers/MultiMap
multimap.py
MutableMultiMap._insert_pairs
def _insert_pairs(self, ids_and_pairs): """Insert some new pairs, and keep the _key_ids updated. Params: ids_and_pairs -- A list of (index, (key, value)) tuples. """ ids_to_insert = [x[0] for x in ids_and_pairs] # We use the bisect to tell u...
python
def _insert_pairs(self, ids_and_pairs): """Insert some new pairs, and keep the _key_ids updated. Params: ids_and_pairs -- A list of (index, (key, value)) tuples. """ ids_to_insert = [x[0] for x in ids_and_pairs] # We use the bisect to tell u...
[ "def", "_insert_pairs", "(", "self", ",", "ids_and_pairs", ")", ":", "ids_to_insert", "=", "[", "x", "[", "0", "]", "for", "x", "in", "ids_and_pairs", "]", "# We use the bisect to tell us how many spots the given index is", "# shifting up in the list.", "for", "ids", ...
Insert some new pairs, and keep the _key_ids updated. Params: ids_and_pairs -- A list of (index, (key, value)) tuples.
[ "Insert", "some", "new", "pairs", "and", "keep", "the", "_key_ids", "updated", ".", "Params", ":", "ids_and_pairs", "--", "A", "list", "of", "(", "index", "(", "key", "value", "))", "tuples", "." ]
0251e5d5df693cc247b4ac5b95adfdd10e3bec04
https://github.com/mikeboers/MultiMap/blob/0251e5d5df693cc247b4ac5b95adfdd10e3bec04/multimap.py#L399-L416
train
Insert some new pairs and keep the _key_ids updated.
mikeboers/MultiMap
multimap.py
MutableMultiMap.setall
def setall(self, key, values): """Set more than one value for a given key. Replaces all the existing values for the given key with new values, removes extra values that are already set if we don't suply enough, and appends values to the end if there are not enough existing spots...
python
def setall(self, key, values): """Set more than one value for a given key. Replaces all the existing values for the given key with new values, removes extra values that are already set if we don't suply enough, and appends values to the end if there are not enough existing spots...
[ "def", "setall", "(", "self", ",", "key", ",", "values", ")", ":", "key", "=", "self", ".", "_conform_key", "(", "key", ")", "values", "=", "[", "self", ".", "_conform_value", "(", "x", ")", "for", "x", "in", "values", "]", "ids", "=", "self", "....
Set more than one value for a given key. Replaces all the existing values for the given key with new values, removes extra values that are already set if we don't suply enough, and appends values to the end if there are not enough existing spots. >>> m = MutableMultiMap...
[ "Set", "more", "than", "one", "value", "for", "a", "given", "key", ".", "Replaces", "all", "the", "existing", "values", "for", "the", "given", "key", "with", "new", "values", "removes", "extra", "values", "that", "are", "already", "set", "if", "we", "don...
0251e5d5df693cc247b4ac5b95adfdd10e3bec04
https://github.com/mikeboers/MultiMap/blob/0251e5d5df693cc247b4ac5b95adfdd10e3bec04/multimap.py#L492-L521
train
Set all the values for a given key to a list of values.
mikeboers/MultiMap
multimap.py
MutableMultiMap.sort
def sort(self, *args, **kwargs): """Sort the MultiMap. Takes the same arguments as list.sort, and operates on tuples of (key, value) pairs. >>> m = MutableMultiMap() >>> m['c'] = 1 >>> m['b'] = 3 >>> m['a'] = 2 >>> m.sort() >>> m....
python
def sort(self, *args, **kwargs): """Sort the MultiMap. Takes the same arguments as list.sort, and operates on tuples of (key, value) pairs. >>> m = MutableMultiMap() >>> m['c'] = 1 >>> m['b'] = 3 >>> m['a'] = 2 >>> m.sort() >>> m....
[ "def", "sort", "(", "self", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "self", ".", "_pairs", ".", "sort", "(", "*", "args", ",", "*", "*", "kwargs", ")", "self", ".", "_rebuild_key_ids", "(", ")" ]
Sort the MultiMap. Takes the same arguments as list.sort, and operates on tuples of (key, value) pairs. >>> m = MutableMultiMap() >>> m['c'] = 1 >>> m['b'] = 3 >>> m['a'] = 2 >>> m.sort() >>> m.keys() ['a', 'b', 'c'] >>> m...
[ "Sort", "the", "MultiMap", ".", "Takes", "the", "same", "arguments", "as", "list", ".", "sort", "and", "operates", "on", "tuples", "of", "(", "key", "value", ")", "pairs", ".", ">>>", "m", "=", "MutableMultiMap", "()", ">>>", "m", "[", "c", "]", "=",...
0251e5d5df693cc247b4ac5b95adfdd10e3bec04
https://github.com/mikeboers/MultiMap/blob/0251e5d5df693cc247b4ac5b95adfdd10e3bec04/multimap.py#L530-L549
train
Sort the MultiMap by key.
mikeboers/MultiMap
multimap.py
MutableMultiMap.popone
def popone(self, key, *default): """Remove first of given key and return corresponding value. If key is not found, default is returned if given. >>> m = MutableMultiMap([('a', 1), ('b', 2), ('b', 3), ('c', 4)]) >>> m.popone('b') 2 >>> m.items() [...
python
def popone(self, key, *default): """Remove first of given key and return corresponding value. If key is not found, default is returned if given. >>> m = MutableMultiMap([('a', 1), ('b', 2), ('b', 3), ('c', 4)]) >>> m.popone('b') 2 >>> m.items() [...
[ "def", "popone", "(", "self", ",", "key", ",", "*", "default", ")", ":", "try", ":", "value", "=", "self", "[", "key", "]", "except", "KeyError", ":", "if", "default", ":", "return", "default", "[", "0", "]", "raise", "# Delete this one.", "self", "....
Remove first of given key and return corresponding value. If key is not found, default is returned if given. >>> m = MutableMultiMap([('a', 1), ('b', 2), ('b', 3), ('c', 4)]) >>> m.popone('b') 2 >>> m.items() [('a', 1), ('b', 3), ('c', 4)] >>> m....
[ "Remove", "first", "of", "given", "key", "and", "return", "corresponding", "value", ".", "If", "key", "is", "not", "found", "default", "is", "returned", "if", "given", ".", ">>>", "m", "=", "MutableMultiMap", "(", "[", "(", "a", "1", ")", "(", "b", "...
0251e5d5df693cc247b4ac5b95adfdd10e3bec04
https://github.com/mikeboers/MultiMap/blob/0251e5d5df693cc247b4ac5b95adfdd10e3bec04/multimap.py#L598-L628
train
Remove first of given key and return corresponding value.
mikeboers/MultiMap
multimap.py
MutableMultiMap.popall
def popall(self, key): """Remove specified key and return all corresponding values. If they key is not found, an empty list is return. >>> m = MutableMultiMap([('a', 1), ('b', 2), ('b', 3), ('c', 4)]) >>> m.popall('a') [1] >>> m.popall('b') [2, 3...
python
def popall(self, key): """Remove specified key and return all corresponding values. If they key is not found, an empty list is return. >>> m = MutableMultiMap([('a', 1), ('b', 2), ('b', 3), ('c', 4)]) >>> m.popall('a') [1] >>> m.popall('b') [2, 3...
[ "def", "popall", "(", "self", ",", "key", ")", ":", "values", "=", "self", ".", "getall", "(", "key", ")", "try", ":", "del", "self", "[", "key", "]", "except", "KeyError", ":", "pass", "return", "values" ]
Remove specified key and return all corresponding values. If they key is not found, an empty list is return. >>> m = MutableMultiMap([('a', 1), ('b', 2), ('b', 3), ('c', 4)]) >>> m.popall('a') [1] >>> m.popall('b') [2, 3] >>> m.popall('x') ...
[ "Remove", "specified", "key", "and", "return", "all", "corresponding", "values", ".", "If", "they", "key", "is", "not", "found", "an", "empty", "list", "is", "return", ".", ">>>", "m", "=", "MutableMultiMap", "(", "[", "(", "a", "1", ")", "(", "b", "...
0251e5d5df693cc247b4ac5b95adfdd10e3bec04
https://github.com/mikeboers/MultiMap/blob/0251e5d5df693cc247b4ac5b95adfdd10e3bec04/multimap.py#L630-L649
train
Remove specified key and return all corresponding values.
KE-works/pykechain
pykechain/models/team.py
Team._update
def _update(self, resource, update_dict=None, params=None, **kwargs): """Update the object.""" url = self._client._build_url(resource, **kwargs) response = self._client._request('PUT', url, json=update_dict, params=params) if response.status_code != requests.codes.ok: # pragma: no cove...
python
def _update(self, resource, update_dict=None, params=None, **kwargs): """Update the object.""" url = self._client._build_url(resource, **kwargs) response = self._client._request('PUT', url, json=update_dict, params=params) if response.status_code != requests.codes.ok: # pragma: no cove...
[ "def", "_update", "(", "self", ",", "resource", ",", "update_dict", "=", "None", ",", "params", "=", "None", ",", "*", "*", "kwargs", ")", ":", "url", "=", "self", ".", "_client", ".", "_build_url", "(", "resource", ",", "*", "*", "kwargs", ")", "r...
Update the object.
[ "Update", "the", "object", "." ]
b0296cf34328fd41660bf6f0b9114fd0167c40c4
https://github.com/KE-works/pykechain/blob/b0296cf34328fd41660bf6f0b9114fd0167c40c4/pykechain/models/team.py#L26-L34
train
Update the object.
KE-works/pykechain
pykechain/models/team.py
Team.members
def members(self, role=None): """Members of the team. You may provide the role in the team, to retrieve only the teammmber with that role. Normally there is a single owner, that has administration rights of the team. Normal team members do not have any rights to administer the team itse...
python
def members(self, role=None): """Members of the team. You may provide the role in the team, to retrieve only the teammmber with that role. Normally there is a single owner, that has administration rights of the team. Normal team members do not have any rights to administer the team itse...
[ "def", "members", "(", "self", ",", "role", "=", "None", ")", ":", "if", "role", "and", "role", "not", "in", "TeamRoles", ".", "values", "(", ")", ":", "raise", "IllegalArgumentError", "(", "\"role should be one of `TeamRoles` {}, got '{}'\"", ".", "format", "...
Members of the team. You may provide the role in the team, to retrieve only the teammmber with that role. Normally there is a single owner, that has administration rights of the team. Normal team members do not have any rights to administer the team itself such as altering the teamname, team im...
[ "Members", "of", "the", "team", "." ]
b0296cf34328fd41660bf6f0b9114fd0167c40c4
https://github.com/KE-works/pykechain/blob/b0296cf34328fd41660bf6f0b9114fd0167c40c4/pykechain/models/team.py#L36-L63
train
Retrieve the members of the team.
KE-works/pykechain
pykechain/models/team.py
Team.add_members
def add_members(self, users=None, role=TeamRoles.MEMBER): """Members to add to a team. :param members: list of members, either `User` objects or usernames :type members: List of `User` or List of pk :param role: (optional) role of the users to add (default `TeamRoles.MEMBER`) :t...
python
def add_members(self, users=None, role=TeamRoles.MEMBER): """Members to add to a team. :param members: list of members, either `User` objects or usernames :type members: List of `User` or List of pk :param role: (optional) role of the users to add (default `TeamRoles.MEMBER`) :t...
[ "def", "add_members", "(", "self", ",", "users", "=", "None", ",", "role", "=", "TeamRoles", ".", "MEMBER", ")", ":", "if", "role", "and", "role", "not", "in", "TeamRoles", ".", "values", "(", ")", ":", "raise", "IllegalArgumentError", "(", "\"role shoul...
Members to add to a team. :param members: list of members, either `User` objects or usernames :type members: List of `User` or List of pk :param role: (optional) role of the users to add (default `TeamRoles.MEMBER`) :type role: basestring :raises IllegalArgumentError: when provi...
[ "Members", "to", "add", "to", "a", "team", "." ]
b0296cf34328fd41660bf6f0b9114fd0167c40c4
https://github.com/KE-works/pykechain/blob/b0296cf34328fd41660bf6f0b9114fd0167c40c4/pykechain/models/team.py#L65-L101
train
Adds members to a team.
KE-works/pykechain
pykechain/models/team.py
Team.remove_members
def remove_members(self, users=None): """Members to add to a team. :param members: list of members, either `User` objects or usernames :type members: List of `User` or List of pk :raises IllegalArgumentError: when providing incorrect roles Example ------- >>> m...
python
def remove_members(self, users=None): """Members to add to a team. :param members: list of members, either `User` objects or usernames :type members: List of `User` or List of pk :raises IllegalArgumentError: when providing incorrect roles Example ------- >>> m...
[ "def", "remove_members", "(", "self", ",", "users", "=", "None", ")", ":", "if", "not", "users", "or", "not", "isinstance", "(", "users", ",", "(", "list", ",", "tuple", ",", "set", ")", ")", ":", "raise", "IllegalArgumentError", "(", "\"Member should be...
Members to add to a team. :param members: list of members, either `User` objects or usernames :type members: List of `User` or List of pk :raises IllegalArgumentError: when providing incorrect roles Example ------- >>> my_team = client.team(name='My own team') ...
[ "Members", "to", "add", "to", "a", "team", "." ]
b0296cf34328fd41660bf6f0b9114fd0167c40c4
https://github.com/KE-works/pykechain/blob/b0296cf34328fd41660bf6f0b9114fd0167c40c4/pykechain/models/team.py#L103-L134
train
Removes members from a team.
KE-works/pykechain
pykechain/models/team.py
Team.scopes
def scopes(self, **kwargs): """Scopes associated to the team.""" return self._client.scopes(team=self.id, **kwargs)
python
def scopes(self, **kwargs): """Scopes associated to the team.""" return self._client.scopes(team=self.id, **kwargs)
[ "def", "scopes", "(", "self", ",", "*", "*", "kwargs", ")", ":", "return", "self", ".", "_client", ".", "scopes", "(", "team", "=", "self", ".", "id", ",", "*", "*", "kwargs", ")" ]
Scopes associated to the team.
[ "Scopes", "associated", "to", "the", "team", "." ]
b0296cf34328fd41660bf6f0b9114fd0167c40c4
https://github.com/KE-works/pykechain/blob/b0296cf34328fd41660bf6f0b9114fd0167c40c4/pykechain/models/team.py#L136-L138
train
Returns a list of all scopes associated to the team.
samuelcolvin/grablib
grablib/build.py
insert_hash
def insert_hash(path: Path, content: Union[str, bytes], *, hash_length=7, hash_algorithm=hashlib.md5): """ Insert a hash based on the content into the path after the first dot. hash_length 7 matches git commit short references """ if isinstance(content, str): content = content.encode() ...
python
def insert_hash(path: Path, content: Union[str, bytes], *, hash_length=7, hash_algorithm=hashlib.md5): """ Insert a hash based on the content into the path after the first dot. hash_length 7 matches git commit short references """ if isinstance(content, str): content = content.encode() ...
[ "def", "insert_hash", "(", "path", ":", "Path", ",", "content", ":", "Union", "[", "str", ",", "bytes", "]", ",", "*", ",", "hash_length", "=", "7", ",", "hash_algorithm", "=", "hashlib", ".", "md5", ")", ":", "if", "isinstance", "(", "content", ",",...
Insert a hash based on the content into the path after the first dot. hash_length 7 matches git commit short references
[ "Insert", "a", "hash", "based", "on", "the", "content", "into", "the", "path", "after", "the", "first", "dot", "." ]
2fca8a3950f29fb2a97a7bd75c0839060a91cedf
https://github.com/samuelcolvin/grablib/blob/2fca8a3950f29fb2a97a7bd75c0839060a91cedf/grablib/build.py#L20-L33
train
Insert a hash based on the content into the path.
KE-works/pykechain
pykechain/enums.py
Enum.options
def options(cls): """Provide a sorted list of options.""" return sorted((value, name) for (name, value) in cls.__dict__.items() if not name.startswith('__'))
python
def options(cls): """Provide a sorted list of options.""" return sorted((value, name) for (name, value) in cls.__dict__.items() if not name.startswith('__'))
[ "def", "options", "(", "cls", ")", ":", "return", "sorted", "(", "(", "value", ",", "name", ")", "for", "(", "name", ",", "value", ")", "in", "cls", ".", "__dict__", ".", "items", "(", ")", "if", "not", "name", ".", "startswith", "(", "'__'", ")"...
Provide a sorted list of options.
[ "Provide", "a", "sorted", "list", "of", "options", "." ]
b0296cf34328fd41660bf6f0b9114fd0167c40c4
https://github.com/KE-works/pykechain/blob/b0296cf34328fd41660bf6f0b9114fd0167c40c4/pykechain/enums.py#L14-L16
train
Provide a sorted list of options.
mozilla/FoxPuppet
foxpuppet/windows/browser/window.py
BrowserWindow.navbar
def navbar(self): """Provide access to the Navigation Bar. Returns: :py:class:`NavBar`: FoxPuppet NavBar object. """ window = BaseWindow(self.selenium, self.selenium.current_window_handle) with self.selenium.context(self.selenium.CONTEXT_CHROME): el = se...
python
def navbar(self): """Provide access to the Navigation Bar. Returns: :py:class:`NavBar`: FoxPuppet NavBar object. """ window = BaseWindow(self.selenium, self.selenium.current_window_handle) with self.selenium.context(self.selenium.CONTEXT_CHROME): el = se...
[ "def", "navbar", "(", "self", ")", ":", "window", "=", "BaseWindow", "(", "self", ".", "selenium", ",", "self", ".", "selenium", ".", "current_window_handle", ")", "with", "self", ".", "selenium", ".", "context", "(", "self", ".", "selenium", ".", "CONTE...
Provide access to the Navigation Bar. Returns: :py:class:`NavBar`: FoxPuppet NavBar object.
[ "Provide", "access", "to", "the", "Navigation", "Bar", "." ]
6575eb4c72fd024c986b254e198c8b4e6f68cddd
https://github.com/mozilla/FoxPuppet/blob/6575eb4c72fd024c986b254e198c8b4e6f68cddd/foxpuppet/windows/browser/window.py#L30-L40
train
Provide access to the NavBar object.
mozilla/FoxPuppet
foxpuppet/windows/browser/window.py
BrowserWindow.notification
def notification(self): """Provide access to the currently displayed notification. Returns: :py:class:`BaseNotification`: FoxPuppet BaseNotification object. """ with self.selenium.context(self.selenium.CONTEXT_CHROME): try: root = self.selenium.f...
python
def notification(self): """Provide access to the currently displayed notification. Returns: :py:class:`BaseNotification`: FoxPuppet BaseNotification object. """ with self.selenium.context(self.selenium.CONTEXT_CHROME): try: root = self.selenium.f...
[ "def", "notification", "(", "self", ")", ":", "with", "self", ".", "selenium", ".", "context", "(", "self", ".", "selenium", ".", "CONTEXT_CHROME", ")", ":", "try", ":", "root", "=", "self", ".", "selenium", ".", "find_element", "(", "*", "self", ".", ...
Provide access to the currently displayed notification. Returns: :py:class:`BaseNotification`: FoxPuppet BaseNotification object.
[ "Provide", "access", "to", "the", "currently", "displayed", "notification", "." ]
6575eb4c72fd024c986b254e198c8b4e6f68cddd
https://github.com/mozilla/FoxPuppet/blob/6575eb4c72fd024c986b254e198c8b4e6f68cddd/foxpuppet/windows/browser/window.py#L43-L64
train
Provide access to the currently displayed notification.
mozilla/FoxPuppet
foxpuppet/windows/browser/window.py
BrowserWindow.wait_for_notification
def wait_for_notification(self, notification_class=BaseNotification): """Wait for the specified notification to be displayed. Args: notification_class (:py:class:`BaseNotification`, optional): The notification class to wait for. If `None` is specified it will...
python
def wait_for_notification(self, notification_class=BaseNotification): """Wait for the specified notification to be displayed. Args: notification_class (:py:class:`BaseNotification`, optional): The notification class to wait for. If `None` is specified it will...
[ "def", "wait_for_notification", "(", "self", ",", "notification_class", "=", "BaseNotification", ")", ":", "if", "notification_class", ":", "if", "notification_class", "is", "BaseNotification", ":", "message", "=", "\"No notification was shown.\"", "else", ":", "message...
Wait for the specified notification to be displayed. Args: notification_class (:py:class:`BaseNotification`, optional): The notification class to wait for. If `None` is specified it will wait for any notification to be closed. Defaults to `BaseNotific...
[ "Wait", "for", "the", "specified", "notification", "to", "be", "displayed", "." ]
6575eb4c72fd024c986b254e198c8b4e6f68cddd
https://github.com/mozilla/FoxPuppet/blob/6575eb4c72fd024c986b254e198c8b4e6f68cddd/foxpuppet/windows/browser/window.py#L66-L93
train
Wait for the specified notification to be displayed.
mozilla/FoxPuppet
foxpuppet/windows/browser/window.py
BrowserWindow.is_private
def is_private(self): """Property that checks if the specified window is private or not. Returns: bool: True if this is a Private Browsing window. """ self.switch_to() with self.selenium.context(self.selenium.CONTEXT_CHROME): return self.selenium.execute...
python
def is_private(self): """Property that checks if the specified window is private or not. Returns: bool: True if this is a Private Browsing window. """ self.switch_to() with self.selenium.context(self.selenium.CONTEXT_CHROME): return self.selenium.execute...
[ "def", "is_private", "(", "self", ")", ":", "self", ".", "switch_to", "(", ")", "with", "self", ".", "selenium", ".", "context", "(", "self", ".", "selenium", ".", "CONTEXT_CHROME", ")", ":", "return", "self", ".", "selenium", ".", "execute_script", "(",...
Property that checks if the specified window is private or not. Returns: bool: True if this is a Private Browsing window.
[ "Property", "that", "checks", "if", "the", "specified", "window", "is", "private", "or", "not", "." ]
6575eb4c72fd024c986b254e198c8b4e6f68cddd
https://github.com/mozilla/FoxPuppet/blob/6575eb4c72fd024c986b254e198c8b4e6f68cddd/foxpuppet/windows/browser/window.py#L96-L113
train
Property that checks if the specified window is private or not.
mozilla/FoxPuppet
foxpuppet/windows/browser/window.py
BrowserWindow.open_window
def open_window(self, private=False): """Open a new browser window. Args: private (bool): Optional parameter to open a private browsing window. Defaults to False. Returns: :py:class:`BrowserWindow`: Opened window. """ handles_before = se...
python
def open_window(self, private=False): """Open a new browser window. Args: private (bool): Optional parameter to open a private browsing window. Defaults to False. Returns: :py:class:`BrowserWindow`: Opened window. """ handles_before = se...
[ "def", "open_window", "(", "self", ",", "private", "=", "False", ")", ":", "handles_before", "=", "self", ".", "selenium", ".", "window_handles", "self", ".", "switch_to", "(", ")", "with", "self", ".", "selenium", ".", "context", "(", "self", ".", "sele...
Open a new browser window. Args: private (bool): Optional parameter to open a private browsing window. Defaults to False. Returns: :py:class:`BrowserWindow`: Opened window.
[ "Open", "a", "new", "browser", "window", "." ]
6575eb4c72fd024c986b254e198c8b4e6f68cddd
https://github.com/mozilla/FoxPuppet/blob/6575eb4c72fd024c986b254e198c8b4e6f68cddd/foxpuppet/windows/browser/window.py#L115-L144
train
Open a new browser window.
SuryaSankar/flask-sqlalchemy-booster
flask_sqlalchemy_booster/model_booster/dictizable_mixin.py
DictizableMixin.to_serializable_dict
def to_serializable_dict(self, attrs_to_serialize=None, rels_to_expand=None, rels_to_serialize=None, key_modifications=None): """ An alias for `todict` """ return self.todict( attrs_to_seri...
python
def to_serializable_dict(self, attrs_to_serialize=None, rels_to_expand=None, rels_to_serialize=None, key_modifications=None): """ An alias for `todict` """ return self.todict( attrs_to_seri...
[ "def", "to_serializable_dict", "(", "self", ",", "attrs_to_serialize", "=", "None", ",", "rels_to_expand", "=", "None", ",", "rels_to_serialize", "=", "None", ",", "key_modifications", "=", "None", ")", ":", "return", "self", ".", "todict", "(", "attrs_to_serial...
An alias for `todict`
[ "An", "alias", "for", "todict" ]
444048d167ab7718f758e943665ef32d101423a5
https://github.com/SuryaSankar/flask-sqlalchemy-booster/blob/444048d167ab7718f758e943665ef32d101423a5/flask_sqlalchemy_booster/model_booster/dictizable_mixin.py#L309-L319
train
Converts the object to a serializable dictionary.
SuryaSankar/flask-sqlalchemy-booster
flask_sqlalchemy_booster/model_booster/dictizable_mixin.py
DictizableMixin.todict_using_struct
def todict_using_struct(self, dict_struct=None, dict_post_processors=None): """ dict_struct: { 'attrs': ['id', 'created_at'], 'rels': { 'merchandise': { 'attrs': ['id', 'label'] } ...
python
def todict_using_struct(self, dict_struct=None, dict_post_processors=None): """ dict_struct: { 'attrs': ['id', 'created_at'], 'rels': { 'merchandise': { 'attrs': ['id', 'label'] } ...
[ "def", "todict_using_struct", "(", "self", ",", "dict_struct", "=", "None", ",", "dict_post_processors", "=", "None", ")", ":", "# It is important to assign the passed kwarg to a differently named variable.", "# A dict is passed by reference and using the same kwarg here results in it"...
dict_struct: { 'attrs': ['id', 'created_at'], 'rels': { 'merchandise': { 'attrs': ['id', 'label'] } } }
[ "dict_struct", ":", "{", "attrs", ":", "[", "id", "created_at", "]", "rels", ":", "{", "merchandise", ":", "{", "attrs", ":", "[", "id", "label", "]", "}", "}", "}" ]
444048d167ab7718f758e943665ef32d101423a5
https://github.com/SuryaSankar/flask-sqlalchemy-booster/blob/444048d167ab7718f758e943665ef32d101423a5/flask_sqlalchemy_booster/model_booster/dictizable_mixin.py#L321-L368
train
This method takes a dict and returns a dictionary of all the related objects in the structure.
SuryaSankar/flask-sqlalchemy-booster
flask_sqlalchemy_booster/model_booster/dictizable_mixin.py
DictizableMixin.todict
def todict(self, attrs_to_serialize=None, rels_to_expand=None, rels_to_serialize=None, group_listrels_by=None, key_modifications=None, dict_struct=None, dict_post_processors=None): """Converts an instance to a dictionary ...
python
def todict(self, attrs_to_serialize=None, rels_to_expand=None, rels_to_serialize=None, group_listrels_by=None, key_modifications=None, dict_struct=None, dict_post_processors=None): """Converts an instance to a dictionary ...
[ "def", "todict", "(", "self", ",", "attrs_to_serialize", "=", "None", ",", "rels_to_expand", "=", "None", ",", "rels_to_serialize", "=", "None", ",", "group_listrels_by", "=", "None", ",", "key_modifications", "=", "None", ",", "dict_struct", "=", "None", ",",...
Converts an instance to a dictionary form Args: attrs_to_serialize (list of str): The columns which should be serialized as a part of the output dictionary key_modifications (dict of str,str): A dictionary used to map the display names of columns whos...
[ "Converts", "an", "instance", "to", "a", "dictionary", "form" ]
444048d167ab7718f758e943665ef32d101423a5
https://github.com/SuryaSankar/flask-sqlalchemy-booster/blob/444048d167ab7718f758e943665ef32d101423a5/flask_sqlalchemy_booster/model_booster/dictizable_mixin.py#L372-L530
train
Converts an instance of a class to a dictionary form.
SuryaSankar/flask-sqlalchemy-booster
flask_sqlalchemy_booster/model_booster/dictizable_mixin.py
DictizableMixin.serialize_attrs
def serialize_attrs(self, *args): """Converts and instance to a dictionary with only the specified attributes as keys Args: *args (list): The attributes to serialize Examples: >>> customer = Customer.create(name="James Bond", email="007@mi.com", ...
python
def serialize_attrs(self, *args): """Converts and instance to a dictionary with only the specified attributes as keys Args: *args (list): The attributes to serialize Examples: >>> customer = Customer.create(name="James Bond", email="007@mi.com", ...
[ "def", "serialize_attrs", "(", "self", ",", "*", "args", ")", ":", "# return dict([(a, getattr(self, a)) for a in args])", "cls", "=", "type", "(", "self", ")", "result", "=", "{", "}", "# result = {", "# a: getattr(self, a)", "# for a in args", "# if hasatt...
Converts and instance to a dictionary with only the specified attributes as keys Args: *args (list): The attributes to serialize Examples: >>> customer = Customer.create(name="James Bond", email="007@mi.com", phone="007", city...
[ "Converts", "and", "instance", "to", "a", "dictionary", "with", "only", "the", "specified", "attributes", "as", "keys" ]
444048d167ab7718f758e943665ef32d101423a5
https://github.com/SuryaSankar/flask-sqlalchemy-booster/blob/444048d167ab7718f758e943665ef32d101423a5/flask_sqlalchemy_booster/model_booster/dictizable_mixin.py#L532-L563
train
Converts and instance to a dictionary with only the specified attributes as keys
biosignalsnotebooks/biosignalsnotebooks
biosignalsnotebooks/build/lib/biosignalsnotebooks/external_packages/novainstrumentation/freq_analysis.py
fundamental_frequency
def fundamental_frequency(s,FS): # TODO: review fundamental frequency to guarantee that f0 exists # suggestion peak level should be bigger # TODO: explain code """Compute fundamental frequency along the specified axes. Parameters ---------- s: ndarray input from which fundamental ...
python
def fundamental_frequency(s,FS): # TODO: review fundamental frequency to guarantee that f0 exists # suggestion peak level should be bigger # TODO: explain code """Compute fundamental frequency along the specified axes. Parameters ---------- s: ndarray input from which fundamental ...
[ "def", "fundamental_frequency", "(", "s", ",", "FS", ")", ":", "# TODO: review fundamental frequency to guarantee that f0 exists ", "# suggestion peak level should be bigger ", "# TODO: explain code", "s", "=", "s", "-", "mean", "(", "s", ")", "f", ",", "fs", "=", "plot...
Compute fundamental frequency along the specified axes. Parameters ---------- s: ndarray input from which fundamental frequency is computed. FS: int sampling frequency Returns ------- f0: int its integer multiple best explain the content of the signal spectrum.
[ "Compute", "fundamental", "frequency", "along", "the", "specified", "axes", "." ]
aaa01d4125180b3a34f1e26e0d3ff08c23f666d3
https://github.com/biosignalsnotebooks/biosignalsnotebooks/blob/aaa01d4125180b3a34f1e26e0d3ff08c23f666d3/biosignalsnotebooks/build/lib/biosignalsnotebooks/external_packages/novainstrumentation/freq_analysis.py#L11-L49
train
Compute the fundamental frequency along the specified axes.
biosignalsnotebooks/biosignalsnotebooks
biosignalsnotebooks/build/lib/biosignalsnotebooks/external_packages/novainstrumentation/freq_analysis.py
max_frequency
def max_frequency (sig,FS): """Compute max frequency along the specified axes. Parameters ---------- sig: ndarray input from which max frequency is computed. FS: int sampling frequency Returns ------- f_max: int 0.95 of max_frequency using cumsum. """ ...
python
def max_frequency (sig,FS): """Compute max frequency along the specified axes. Parameters ---------- sig: ndarray input from which max frequency is computed. FS: int sampling frequency Returns ------- f_max: int 0.95 of max_frequency using cumsum. """ ...
[ "def", "max_frequency", "(", "sig", ",", "FS", ")", ":", "f", ",", "fs", "=", "plotfft", "(", "sig", ",", "FS", ",", "doplot", "=", "False", ")", "t", "=", "cumsum", "(", "fs", ")", "ind_mag", "=", "find", "(", "t", ">", "t", "[", "-", "1", ...
Compute max frequency along the specified axes. Parameters ---------- sig: ndarray input from which max frequency is computed. FS: int sampling frequency Returns ------- f_max: int 0.95 of max_frequency using cumsum.
[ "Compute", "max", "frequency", "along", "the", "specified", "axes", "." ]
aaa01d4125180b3a34f1e26e0d3ff08c23f666d3
https://github.com/biosignalsnotebooks/biosignalsnotebooks/blob/aaa01d4125180b3a34f1e26e0d3ff08c23f666d3/biosignalsnotebooks/build/lib/biosignalsnotebooks/external_packages/novainstrumentation/freq_analysis.py#L52-L72
train
Compute max frequency along the specified axes.
biosignalsnotebooks/biosignalsnotebooks
biosignalsnotebooks/build/lib/biosignalsnotebooks/external_packages/novainstrumentation/freq_analysis.py
median_frequency
def median_frequency(sig,FS): """Compute median frequency along the specified axes. Parameters ---------- sig: ndarray input from which median frequency is computed. FS: int sampling frequency Returns ------- f_max: int 0.50 of max_frequency using cumsum. ...
python
def median_frequency(sig,FS): """Compute median frequency along the specified axes. Parameters ---------- sig: ndarray input from which median frequency is computed. FS: int sampling frequency Returns ------- f_max: int 0.50 of max_frequency using cumsum. ...
[ "def", "median_frequency", "(", "sig", ",", "FS", ")", ":", "f", ",", "fs", "=", "plotfft", "(", "sig", ",", "FS", ",", "doplot", "=", "False", ")", "t", "=", "cumsum", "(", "fs", ")", "ind_mag", "=", "find", "(", "t", ">", "t", "[", "-", "1"...
Compute median frequency along the specified axes. Parameters ---------- sig: ndarray input from which median frequency is computed. FS: int sampling frequency Returns ------- f_max: int 0.50 of max_frequency using cumsum.
[ "Compute", "median", "frequency", "along", "the", "specified", "axes", "." ]
aaa01d4125180b3a34f1e26e0d3ff08c23f666d3
https://github.com/biosignalsnotebooks/biosignalsnotebooks/blob/aaa01d4125180b3a34f1e26e0d3ff08c23f666d3/biosignalsnotebooks/build/lib/biosignalsnotebooks/external_packages/novainstrumentation/freq_analysis.py#L75-L95
train
Compute the median frequency along the specified axes.
kytos/kytos-utils
kytos/cli/commands/napps/parser.py
call
def call(subcommand, args): """Call a subcommand passing the args.""" args['<napp>'] = parse_napps(args['<napp>']) func = getattr(NAppsAPI, subcommand) func(args)
python
def call(subcommand, args): """Call a subcommand passing the args.""" args['<napp>'] = parse_napps(args['<napp>']) func = getattr(NAppsAPI, subcommand) func(args)
[ "def", "call", "(", "subcommand", ",", "args", ")", ":", "args", "[", "'<napp>'", "]", "=", "parse_napps", "(", "args", "[", "'<napp>'", "]", ")", "func", "=", "getattr", "(", "NAppsAPI", ",", "subcommand", ")", "func", "(", "args", ")" ]
Call a subcommand passing the args.
[ "Call", "a", "subcommand", "passing", "the", "args", "." ]
b4750c618d15cff75970ea6124bda4d2b9a33578
https://github.com/kytos/kytos-utils/blob/b4750c618d15cff75970ea6124bda4d2b9a33578/kytos/cli/commands/napps/parser.py#L57-L61
train
Call a subcommand passing the args.
kytos/kytos-utils
kytos/cli/commands/napps/parser.py
parse_napp
def parse_napp(napp_id): """Convert a napp_id in tuple with username, napp name and version. Args: napp_id: String with the form 'username/napp[:version]' (version is optional). If no version is found, it will be None. Returns: tuple: A tuple with (username, napp, version...
python
def parse_napp(napp_id): """Convert a napp_id in tuple with username, napp name and version. Args: napp_id: String with the form 'username/napp[:version]' (version is optional). If no version is found, it will be None. Returns: tuple: A tuple with (username, napp, version...
[ "def", "parse_napp", "(", "napp_id", ")", ":", "# `napp_id` regex, composed by two mandatory parts (username, napp_name)", "# and one optional (version).", "# username and napp_name need to start with a letter, are composed of", "# letters, numbers and uderscores and must have at least three chara...
Convert a napp_id in tuple with username, napp name and version. Args: napp_id: String with the form 'username/napp[:version]' (version is optional). If no version is found, it will be None. Returns: tuple: A tuple with (username, napp, version) Raises: KytosExce...
[ "Convert", "a", "napp_id", "in", "tuple", "with", "username", "napp", "name", "and", "version", "." ]
b4750c618d15cff75970ea6124bda4d2b9a33578
https://github.com/kytos/kytos-utils/blob/b4750c618d15cff75970ea6124bda4d2b9a33578/kytos/cli/commands/napps/parser.py#L88-L118
train
Convert a napp_id in tuple with username napp name and version.
biosignalsnotebooks/biosignalsnotebooks
biosignalsnotebooks/build/lib/biosignalsnotebooks/factory.py
opensignals_hierarchy
def opensignals_hierarchy(root=None, update=False, clone=False): """ ----- Brief ----- Function that generates the OpenSignalsTools Notebooks File Hierarchy programatically. ----------- Description ----------- OpenSignalsTools Notebooks folder obey to a predefined hierarchy that all...
python
def opensignals_hierarchy(root=None, update=False, clone=False): """ ----- Brief ----- Function that generates the OpenSignalsTools Notebooks File Hierarchy programatically. ----------- Description ----------- OpenSignalsTools Notebooks folder obey to a predefined hierarchy that all...
[ "def", "opensignals_hierarchy", "(", "root", "=", "None", ",", "update", "=", "False", ",", "clone", "=", "False", ")", ":", "if", "root", "is", "None", ":", "root", "=", "os", ".", "getcwd", "(", ")", "categories", "=", "list", "(", "NOTEBOOK_KEYS", ...
----- Brief ----- Function that generates the OpenSignalsTools Notebooks File Hierarchy programatically. ----------- Description ----------- OpenSignalsTools Notebooks folder obey to a predefined hierarchy that allows to run the code of online available notebooks and using the sample fi...
[ "-----", "Brief", "-----", "Function", "that", "generates", "the", "OpenSignalsTools", "Notebooks", "File", "Hierarchy", "programatically", "." ]
aaa01d4125180b3a34f1e26e0d3ff08c23f666d3
https://github.com/biosignalsnotebooks/biosignalsnotebooks/blob/aaa01d4125180b3a34f1e26e0d3ff08c23f666d3/biosignalsnotebooks/build/lib/biosignalsnotebooks/factory.py#L295-L407
train
This function generates the folder hierarchy of OpenSignalsTools Notebooks.
biosignalsnotebooks/biosignalsnotebooks
biosignalsnotebooks/build/lib/biosignalsnotebooks/factory.py
_generate_notebook_header
def _generate_notebook_header(notebook_object, notebook_type, notebook_title="Notebook Title", tags="tags", difficulty_stars=1, notebook_description="Notebook Description"): """ Internal function that is used for generation of the generic notebooks hea...
python
def _generate_notebook_header(notebook_object, notebook_type, notebook_title="Notebook Title", tags="tags", difficulty_stars=1, notebook_description="Notebook Description"): """ Internal function that is used for generation of the generic notebooks hea...
[ "def", "_generate_notebook_header", "(", "notebook_object", ",", "notebook_type", ",", "notebook_title", "=", "\"Notebook Title\"", ",", "tags", "=", "\"tags\"", ",", "difficulty_stars", "=", "1", ",", "notebook_description", "=", "\"Notebook Description\"", ")", ":", ...
Internal function that is used for generation of the generic notebooks header. ---------- Parameters ---------- notebook_object : notebook object Object of "notebook" class where the header will be created. notebook_type : str Notebook type: - "Main_Files_Signal_Samples" ...
[ "Internal", "function", "that", "is", "used", "for", "generation", "of", "the", "generic", "notebooks", "header", "." ]
aaa01d4125180b3a34f1e26e0d3ff08c23f666d3
https://github.com/biosignalsnotebooks/biosignalsnotebooks/blob/aaa01d4125180b3a34f1e26e0d3ff08c23f666d3/biosignalsnotebooks/build/lib/biosignalsnotebooks/factory.py#L414-L492
train
Internal function that generates the generic notebooks header.
biosignalsnotebooks/biosignalsnotebooks
biosignalsnotebooks/build/lib/biosignalsnotebooks/factory.py
_generate_notebooks_by_category
def _generate_notebooks_by_category(notebook_object, dict_by_tag): """ Internal function that is used for generation of the page "Notebooks by Category". ---------- Parameters ---------- notebook_object : notebook object Object of "notebook" class where the body will be created. di...
python
def _generate_notebooks_by_category(notebook_object, dict_by_tag): """ Internal function that is used for generation of the page "Notebooks by Category". ---------- Parameters ---------- notebook_object : notebook object Object of "notebook" class where the body will be created. di...
[ "def", "_generate_notebooks_by_category", "(", "notebook_object", ",", "dict_by_tag", ")", ":", "# ============================ Insertion of an opening text ====================================", "markdown_cell", "=", "OPEN_IMAGE", "# == Generation of a table that group Notebooks by category...
Internal function that is used for generation of the page "Notebooks by Category". ---------- Parameters ---------- notebook_object : notebook object Object of "notebook" class where the body will be created. dict_by_tag : dict Dictionary where each key is a tag and the respective ...
[ "Internal", "function", "that", "is", "used", "for", "generation", "of", "the", "page", "Notebooks", "by", "Category", "." ]
aaa01d4125180b3a34f1e26e0d3ff08c23f666d3
https://github.com/biosignalsnotebooks/biosignalsnotebooks/blob/aaa01d4125180b3a34f1e26e0d3ff08c23f666d3/biosignalsnotebooks/build/lib/biosignalsnotebooks/factory.py#L781-L848
train
Generates a markdown table that contains the Notebooks that are grouped by category.
biosignalsnotebooks/biosignalsnotebooks
biosignalsnotebooks/build/lib/biosignalsnotebooks/factory.py
_generate_github_readme
def _generate_github_readme(notebook_object, dict_by_tag): """ Internal function that is used for generation of the GitHub and PyPI README file. ---------- Parameters ---------- notebook_object : notebook object Object of "notebook" class where the body will be created. dict_by_tag...
python
def _generate_github_readme(notebook_object, dict_by_tag): """ Internal function that is used for generation of the GitHub and PyPI README file. ---------- Parameters ---------- notebook_object : notebook object Object of "notebook" class where the body will be created. dict_by_tag...
[ "def", "_generate_github_readme", "(", "notebook_object", ",", "dict_by_tag", ")", ":", "# ==================== List of urls that contain each Category icon ============================", "icons", "=", "{", "\"Detect\"", ":", "\"https://i.ibb.co/rymrvFL/Detect.png\"", ",", "\"Evaluat...
Internal function that is used for generation of the GitHub and PyPI README file. ---------- Parameters ---------- notebook_object : notebook object Object of "notebook" class where the body will be created. dict_by_tag : dict Dictionary where each key is a tag and the respective v...
[ "Internal", "function", "that", "is", "used", "for", "generation", "of", "the", "GitHub", "and", "PyPI", "README", "file", "." ]
aaa01d4125180b3a34f1e26e0d3ff08c23f666d3
https://github.com/biosignalsnotebooks/biosignalsnotebooks/blob/aaa01d4125180b3a34f1e26e0d3ff08c23f666d3/biosignalsnotebooks/build/lib/biosignalsnotebooks/factory.py#L851-L929
train
Generate the GitHub README file.
fancybits/pychannels
pychannels/__init__.py
Channels._request
def _request(self, method, path, params=None): """Make the actual request and returns the parsed response.""" url = self._base_url + path try: if method == 'GET': response = requests.get(url, timeout=TIMEOUT) elif method == "POST": respons...
python
def _request(self, method, path, params=None): """Make the actual request and returns the parsed response.""" url = self._base_url + path try: if method == 'GET': response = requests.get(url, timeout=TIMEOUT) elif method == "POST": respons...
[ "def", "_request", "(", "self", ",", "method", ",", "path", ",", "params", "=", "None", ")", ":", "url", "=", "self", ".", "_base_url", "+", "path", "try", ":", "if", "method", "==", "'GET'", ":", "response", "=", "requests", ".", "get", "(", "url"...
Make the actual request and returns the parsed response.
[ "Make", "the", "actual", "request", "and", "returns", "the", "parsed", "response", "." ]
080f269b6d17d4622a0787000befe31bebc1a15d
https://github.com/fancybits/pychannels/blob/080f269b6d17d4622a0787000befe31bebc1a15d/pychannels/__init__.py#L30-L53
train
Make the actual request and returns the parsed response.
thomasdelaet/python-velbus
velbus/messages/sensor_temperature.py
SensorTemperatureMessage.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/sensor_temperature.py#L25-L39
train
Populates the internal state of the object with the contents of the data bytes.
thomasdelaet/python-velbus
velbus/messages/sensor_temperature.py
SensorTemperatureMessage.to_json
def to_json(self): """ :return: str """ json_dict = self.to_json_basic() json_dict['cur'] = self.cur json_dict['min'] = self.min json_dict['max'] = self.max return json.dumps(json_dict)
python
def to_json(self): """ :return: str """ json_dict = self.to_json_basic() json_dict['cur'] = self.cur json_dict['min'] = self.min json_dict['max'] = self.max return json.dumps(json_dict)
[ "def", "to_json", "(", "self", ")", ":", "json_dict", "=", "self", ".", "to_json_basic", "(", ")", "json_dict", "[", "'cur'", "]", "=", "self", ".", "cur", "json_dict", "[", "'min'", "]", "=", "self", ".", "min", "json_dict", "[", "'max'", "]", "=", ...
:return: str
[ ":", "return", ":", "str" ]
af2f8af43f1a24bf854eff9f3126fd7b5c41b3dd
https://github.com/thomasdelaet/python-velbus/blob/af2f8af43f1a24bf854eff9f3126fd7b5c41b3dd/velbus/messages/sensor_temperature.py#L41-L49
train
Returns a JSON string representation of the current set of cache entries.
uranusjr/django-gunicorn
djgunicorn/config.py
post_worker_init
def post_worker_init(worker): """Hook into Gunicorn to display message after launching. This mimics the behaviour of Django's stock runserver command. """ quit_command = 'CTRL-BREAK' if sys.platform == 'win32' else 'CONTROL-C' sys.stdout.write( "Django version {djangover}, Gunicorn version ...
python
def post_worker_init(worker): """Hook into Gunicorn to display message after launching. This mimics the behaviour of Django's stock runserver command. """ quit_command = 'CTRL-BREAK' if sys.platform == 'win32' else 'CONTROL-C' sys.stdout.write( "Django version {djangover}, Gunicorn version ...
[ "def", "post_worker_init", "(", "worker", ")", ":", "quit_command", "=", "'CTRL-BREAK'", "if", "sys", ".", "platform", "==", "'win32'", "else", "'CONTROL-C'", "sys", ".", "stdout", ".", "write", "(", "\"Django version {djangover}, Gunicorn version {gunicornver}, \"", ...
Hook into Gunicorn to display message after launching. This mimics the behaviour of Django's stock runserver command.
[ "Hook", "into", "Gunicorn", "to", "display", "message", "after", "launching", "." ]
4fb16f48048ff5fff8f889a007f376236646497b
https://github.com/uranusjr/django-gunicorn/blob/4fb16f48048ff5fff8f889a007f376236646497b/djgunicorn/config.py#L18-L35
train
Hook into Gunicorn to display message after launching.
biosignalsnotebooks/biosignalsnotebooks
biosignalsnotebooks/build/lib/biosignalsnotebooks/external_packages/novainstrumentation/filter.py
highpass
def highpass(s, f, order=2, fs=1000.0, use_filtfilt=False): ''' @brief: for a given signal s rejects (attenuates) the frequencies lower then the cuttof frequency f and passes the frequencies higher than that value by applying a Butterworth digital filter @params: s: array-like signal ...
python
def highpass(s, f, order=2, fs=1000.0, use_filtfilt=False): ''' @brief: for a given signal s rejects (attenuates) the frequencies lower then the cuttof frequency f and passes the frequencies higher than that value by applying a Butterworth digital filter @params: s: array-like signal ...
[ "def", "highpass", "(", "s", ",", "f", ",", "order", "=", "2", ",", "fs", "=", "1000.0", ",", "use_filtfilt", "=", "False", ")", ":", "b", ",", "a", "=", "signal", ".", "butter", "(", "order", ",", "f", "*", "2", "/", "(", "fs", "/", "2", "...
@brief: for a given signal s rejects (attenuates) the frequencies lower then the cuttof frequency f and passes the frequencies higher than that value by applying a Butterworth digital filter @params: s: array-like signal f: int the cutoff frequency order: int Butterworth filter o...
[ "@brief", ":", "for", "a", "given", "signal", "s", "rejects", "(", "attenuates", ")", "the", "frequencies", "lower", "then", "the", "cuttof", "frequency", "f", "and", "passes", "the", "frequencies", "higher", "than", "that", "value", "by", "applying", "a", ...
aaa01d4125180b3a34f1e26e0d3ff08c23f666d3
https://github.com/biosignalsnotebooks/biosignalsnotebooks/blob/aaa01d4125180b3a34f1e26e0d3ff08c23f666d3/biosignalsnotebooks/build/lib/biosignalsnotebooks/external_packages/novainstrumentation/filter.py#L40-L71
train
This function accepts a signal s and a frequency f and returns a new signal that is highpassed.
KE-works/pykechain
pykechain/models/property_attachment.py
AttachmentProperty.value
def value(self): """Retrieve the data value of this attachment. Will show the filename of the attachment if there is an attachment available otherwise None Use save_as in order to download as a file. Example ------- >>> file_attachment_property = project.part('Bike').p...
python
def value(self): """Retrieve the data value of this attachment. Will show the filename of the attachment if there is an attachment available otherwise None Use save_as in order to download as a file. Example ------- >>> file_attachment_property = project.part('Bike').p...
[ "def", "value", "(", "self", ")", ":", "if", "'value'", "in", "self", ".", "_json_data", "and", "self", ".", "_json_data", "[", "'value'", "]", ":", "return", "\"[Attachment: {}]\"", ".", "format", "(", "self", ".", "_json_data", "[", "'value'", "]", "."...
Retrieve the data value of this attachment. Will show the filename of the attachment if there is an attachment available otherwise None Use save_as in order to download as a file. Example ------- >>> file_attachment_property = project.part('Bike').property('file_attachment') ...
[ "Retrieve", "the", "data", "value", "of", "this", "attachment", "." ]
b0296cf34328fd41660bf6f0b9114fd0167c40c4
https://github.com/KE-works/pykechain/blob/b0296cf34328fd41660bf6f0b9114fd0167c40c4/pykechain/models/property_attachment.py#L32-L51
train
Retrieve the data value of this attachment.
KE-works/pykechain
pykechain/models/property_attachment.py
AttachmentProperty.filename
def filename(self): """Filename of the attachment, without the full 'attachment' path.""" if self.value and 'value' in self._json_data and self._json_data['value']: return self._json_data['value'].split('/')[-1] return None
python
def filename(self): """Filename of the attachment, without the full 'attachment' path.""" if self.value and 'value' in self._json_data and self._json_data['value']: return self._json_data['value'].split('/')[-1] return None
[ "def", "filename", "(", "self", ")", ":", "if", "self", ".", "value", "and", "'value'", "in", "self", ".", "_json_data", "and", "self", ".", "_json_data", "[", "'value'", "]", ":", "return", "self", ".", "_json_data", "[", "'value'", "]", ".", "split",...
Filename of the attachment, without the full 'attachment' path.
[ "Filename", "of", "the", "attachment", "without", "the", "full", "attachment", "path", "." ]
b0296cf34328fd41660bf6f0b9114fd0167c40c4
https://github.com/KE-works/pykechain/blob/b0296cf34328fd41660bf6f0b9114fd0167c40c4/pykechain/models/property_attachment.py#L68-L72
train
Filename of the attachment without the full attachment path.
KE-works/pykechain
pykechain/models/property_attachment.py
AttachmentProperty.upload
def upload(self, data, **kwargs): """Upload a file to the attachment property. When providing a :class:`matplotlib.figure.Figure` object as data, the figure is uploaded as PNG. For this, `matplotlib`_ should be installed. :param filename: File path :type filename: basestring ...
python
def upload(self, data, **kwargs): """Upload a file to the attachment property. When providing a :class:`matplotlib.figure.Figure` object as data, the figure is uploaded as PNG. For this, `matplotlib`_ should be installed. :param filename: File path :type filename: basestring ...
[ "def", "upload", "(", "self", ",", "data", ",", "*", "*", "kwargs", ")", ":", "try", ":", "import", "matplotlib", ".", "figure", "if", "isinstance", "(", "data", ",", "matplotlib", ".", "figure", ".", "Figure", ")", ":", "self", ".", "_upload_plot", ...
Upload a file to the attachment property. When providing a :class:`matplotlib.figure.Figure` object as data, the figure is uploaded as PNG. For this, `matplotlib`_ should be installed. :param filename: File path :type filename: basestring :raises APIError: When unable to upload...
[ "Upload", "a", "file", "to", "the", "attachment", "property", "." ]
b0296cf34328fd41660bf6f0b9114fd0167c40c4
https://github.com/KE-works/pykechain/blob/b0296cf34328fd41660bf6f0b9114fd0167c40c4/pykechain/models/property_attachment.py#L90-L116
train
Uploads a file to the KE - chain.
KE-works/pykechain
pykechain/models/property_attachment.py
AttachmentProperty.save_as
def save_as(self, filename): """Download the attachment to a file. :param filename: File path :type filename: basestring :raises APIError: When unable to download the data :raises OSError: When unable to save the data to disk """ with open(filename, 'w+b') as f: ...
python
def save_as(self, filename): """Download the attachment to a file. :param filename: File path :type filename: basestring :raises APIError: When unable to download the data :raises OSError: When unable to save the data to disk """ with open(filename, 'w+b') as f: ...
[ "def", "save_as", "(", "self", ",", "filename", ")", ":", "with", "open", "(", "filename", ",", "'w+b'", ")", "as", "f", ":", "for", "chunk", "in", "self", ".", "_download", "(", ")", ":", "f", ".", "write", "(", "chunk", ")" ]
Download the attachment to a file. :param filename: File path :type filename: basestring :raises APIError: When unable to download the data :raises OSError: When unable to save the data to disk
[ "Download", "the", "attachment", "to", "a", "file", "." ]
b0296cf34328fd41660bf6f0b9114fd0167c40c4
https://github.com/KE-works/pykechain/blob/b0296cf34328fd41660bf6f0b9114fd0167c40c4/pykechain/models/property_attachment.py#L118-L128
train
Download the attachment to a file.
apihackers/devpi-semantic-ui
devpi_semantic_ui/__init__.py
devpiserver_cmdline_run
def devpiserver_cmdline_run(xom): ''' Load theme when `theme` parameter is 'semantic-ui'. ''' if xom.config.args.theme == 'semantic-ui': xom.config.args.theme = resource_filename('devpi_semantic_ui', '') xom.log.info("Semantic UI Theme loaded")
python
def devpiserver_cmdline_run(xom): ''' Load theme when `theme` parameter is 'semantic-ui'. ''' if xom.config.args.theme == 'semantic-ui': xom.config.args.theme = resource_filename('devpi_semantic_ui', '') xom.log.info("Semantic UI Theme loaded")
[ "def", "devpiserver_cmdline_run", "(", "xom", ")", ":", "if", "xom", ".", "config", ".", "args", ".", "theme", "==", "'semantic-ui'", ":", "xom", ".", "config", ".", "args", ".", "theme", "=", "resource_filename", "(", "'devpi_semantic_ui'", ",", "''", ")"...
Load theme when `theme` parameter is 'semantic-ui'.
[ "Load", "theme", "when", "theme", "parameter", "is", "semantic", "-", "ui", "." ]
32bab6a7c3441c855d7005f088c48e7a1af5a72c
https://github.com/apihackers/devpi-semantic-ui/blob/32bab6a7c3441c855d7005f088c48e7a1af5a72c/devpi_semantic_ui/__init__.py#L6-L12
train
Load theme when theme parameter is semantic - ui.
thomasdelaet/python-velbus
velbus/modules/vmb4ry.py
VMB4RYModule.is_on
def is_on(self, channel): """ Check if a switch is turned on :return: bool """ if channel in self._is_on: return self._is_on[channel] return False
python
def is_on(self, channel): """ Check if a switch is turned on :return: bool """ if channel in self._is_on: return self._is_on[channel] return False
[ "def", "is_on", "(", "self", ",", "channel", ")", ":", "if", "channel", "in", "self", ".", "_is_on", ":", "return", "self", ".", "_is_on", "[", "channel", "]", "return", "False" ]
Check if a switch is turned on :return: bool
[ "Check", "if", "a", "switch", "is", "turned", "on" ]
af2f8af43f1a24bf854eff9f3126fd7b5c41b3dd
https://github.com/thomasdelaet/python-velbus/blob/af2f8af43f1a24bf854eff9f3126fd7b5c41b3dd/velbus/modules/vmb4ry.py#L19-L27
train
Check if a switch is turned on
thomasdelaet/python-velbus
velbus/modules/vmb4ry.py
VMB4RYModule.turn_on
def turn_on(self, channel, callback=None): """ Turn on switch. :return: None """ if callback is None: def callb(): """No-op""" pass callback = callb message = velbus.SwitchRelayOnMessage(self._address) messa...
python
def turn_on(self, channel, callback=None): """ Turn on switch. :return: None """ if callback is None: def callb(): """No-op""" pass callback = callb message = velbus.SwitchRelayOnMessage(self._address) messa...
[ "def", "turn_on", "(", "self", ",", "channel", ",", "callback", "=", "None", ")", ":", "if", "callback", "is", "None", ":", "def", "callb", "(", ")", ":", "\"\"\"No-op\"\"\"", "pass", "callback", "=", "callb", "message", "=", "velbus", ".", "SwitchRelayO...
Turn on switch. :return: None
[ "Turn", "on", "switch", "." ]
af2f8af43f1a24bf854eff9f3126fd7b5c41b3dd
https://github.com/thomasdelaet/python-velbus/blob/af2f8af43f1a24bf854eff9f3126fd7b5c41b3dd/velbus/modules/vmb4ry.py#L29-L42
train
Turn on switch.
thomasdelaet/python-velbus
velbus/modules/vmb4ry.py
VMB4RYModule.turn_off
def turn_off(self, channel, callback=None): """ Turn off switch. :return: None """ if callback is None: def callb(): """No-op""" pass callback = callb message = velbus.SwitchRelayOffMessage(self._address) me...
python
def turn_off(self, channel, callback=None): """ Turn off switch. :return: None """ if callback is None: def callb(): """No-op""" pass callback = callb message = velbus.SwitchRelayOffMessage(self._address) me...
[ "def", "turn_off", "(", "self", ",", "channel", ",", "callback", "=", "None", ")", ":", "if", "callback", "is", "None", ":", "def", "callb", "(", ")", ":", "\"\"\"No-op\"\"\"", "pass", "callback", "=", "callb", "message", "=", "velbus", ".", "SwitchRelay...
Turn off switch. :return: None
[ "Turn", "off", "switch", "." ]
af2f8af43f1a24bf854eff9f3126fd7b5c41b3dd
https://github.com/thomasdelaet/python-velbus/blob/af2f8af43f1a24bf854eff9f3126fd7b5c41b3dd/velbus/modules/vmb4ry.py#L44-L57
train
Turn off switch.
kizniche/sht-sensor
sht_sensor/sensor.py
Sht.read_dew_point
def read_dew_point(self, t=None, rh=None): 'With t and rh provided, does not access the hardware.' if t is None: t, rh = self.read_t(), None if rh is None: rh = self.read_rh(t) t_range = 'water' if t >= 0 else 'ice' tn, m = self.c.tn[t_range], self.c.m[t_range] return ( # ch 4.4 tn * (math.log(rh / 100.0...
python
def read_dew_point(self, t=None, rh=None): 'With t and rh provided, does not access the hardware.' if t is None: t, rh = self.read_t(), None if rh is None: rh = self.read_rh(t) t_range = 'water' if t >= 0 else 'ice' tn, m = self.c.tn[t_range], self.c.m[t_range] return ( # ch 4.4 tn * (math.log(rh / 100.0...
[ "def", "read_dew_point", "(", "self", ",", "t", "=", "None", ",", "rh", "=", "None", ")", ":", "if", "t", "is", "None", ":", "t", ",", "rh", "=", "self", ".", "read_t", "(", ")", ",", "None", "if", "rh", "is", "None", ":", "rh", "=", "self", ...
With t and rh provided, does not access the hardware.
[ "With", "t", "and", "rh", "provided", "does", "not", "access", "the", "hardware", "." ]
e44758327eec781297e68f3f59b6937b7c5758e3
https://github.com/kizniche/sht-sensor/blob/e44758327eec781297e68f3f59b6937b7c5758e3/sht_sensor/sensor.py#L319-L327
train
With t and rh provided does not access the hardware.
KE-works/pykechain
pykechain/models/property_selectlist.py
SelectListProperty._put_options
def _put_options(self, options_list): """Save the options to KE-chain. Makes a single API call. :param options_list: list of options to set. :raises APIError: when unable to update the options """ new_options = self._options.copy() # make a full copy of the dict not to...
python
def _put_options(self, options_list): """Save the options to KE-chain. Makes a single API call. :param options_list: list of options to set. :raises APIError: when unable to update the options """ new_options = self._options.copy() # make a full copy of the dict not to...
[ "def", "_put_options", "(", "self", ",", "options_list", ")", ":", "new_options", "=", "self", ".", "_options", ".", "copy", "(", ")", "# make a full copy of the dict not to only link it and update dict in place", "new_options", ".", "update", "(", "{", "\"value_choices...
Save the options to KE-chain. Makes a single API call. :param options_list: list of options to set. :raises APIError: when unable to update the options
[ "Save", "the", "options", "to", "KE", "-", "chain", "." ]
b0296cf34328fd41660bf6f0b9114fd0167c40c4
https://github.com/KE-works/pykechain/blob/b0296cf34328fd41660bf6f0b9114fd0167c40c4/pykechain/models/property_selectlist.py#L85-L103
train
Save the options to KE - chain.
Thermondo/viewflow-extensions
viewflow_extensions/utils.py
make_form_or_formset_fields_not_required
def make_form_or_formset_fields_not_required(form_or_formset): """Take a Form or FormSet and set all fields to not required.""" if isinstance(form_or_formset, BaseFormSet): for single_form in form_or_formset: make_form_fields_not_required(single_form) else: make_form_fields_not_r...
python
def make_form_or_formset_fields_not_required(form_or_formset): """Take a Form or FormSet and set all fields to not required.""" if isinstance(form_or_formset, BaseFormSet): for single_form in form_or_formset: make_form_fields_not_required(single_form) else: make_form_fields_not_r...
[ "def", "make_form_or_formset_fields_not_required", "(", "form_or_formset", ")", ":", "if", "isinstance", "(", "form_or_formset", ",", "BaseFormSet", ")", ":", "for", "single_form", "in", "form_or_formset", ":", "make_form_fields_not_required", "(", "single_form", ")", "...
Take a Form or FormSet and set all fields to not required.
[ "Take", "a", "Form", "or", "FormSet", "and", "set", "all", "fields", "to", "not", "required", "." ]
5d2bbfe28ced7dda3e6832b96ea031c1b871053e
https://github.com/Thermondo/viewflow-extensions/blob/5d2bbfe28ced7dda3e6832b96ea031c1b871053e/viewflow_extensions/utils.py#L4-L10
train
Take a Form or FormSet and set all fields to not required.
thomasdelaet/python-velbus
velbus/messages/counter_status.py
CounterStatusMessage.populate
def populate(self, priority, address, rtr, data): """ -DB1 last 2 bits = channel -DB1 first 6 bist = pulses -DB2-5 = pulse counter -DB6-7 = ms/pulse :return: None """ assert isinstance(data, bytes) ...
python
def populate(self, priority, address, rtr, data): """ -DB1 last 2 bits = channel -DB1 first 6 bist = pulses -DB2-5 = pulse counter -DB6-7 = ms/pulse :return: None """ assert isinstance(data, bytes) ...
[ "def", "populate", "(", "self", ",", "priority", ",", "address", ",", "rtr", ",", "data", ")", ":", "assert", "isinstance", "(", "data", ",", "bytes", ")", "self", ".", "needs_no_rtr", "(", "rtr", ")", "self", ".", "needs_data", "(", "data", ",", "7"...
-DB1 last 2 bits = channel -DB1 first 6 bist = pulses -DB2-5 = pulse counter -DB6-7 = ms/pulse :return: None
[ "-", "DB1", "last", "2", "bits", "=", "channel", "-", "DB1", "first", "6", "bist", "=", "pulses", "-", "DB2", "-", "5", "=", "pulse", "counter", "-", "DB6", "-", "7", "=", "ms", "/", "pulse", ":", "return", ":", "None" ]
af2f8af43f1a24bf854eff9f3126fd7b5c41b3dd
https://github.com/thomasdelaet/python-velbus/blob/af2f8af43f1a24bf854eff9f3126fd7b5c41b3dd/velbus/messages/counter_status.py#L25-L40
train
Populates the internal state of the object with the contents of the data.
biosignalsnotebooks/biosignalsnotebooks
biosignalsnotebooks/build/lib/biosignalsnotebooks/external_packages/novainstrumentation/waves/alignWaves.py
align
def align(w,signals,mode): """ Align various waves in a specific point. Given a mode of alignment, this function computes the specific time point of a wave where all the waves would be aligned. With the difference between the time point of the reference wave and the time points of all the other wa...
python
def align(w,signals,mode): """ Align various waves in a specific point. Given a mode of alignment, this function computes the specific time point of a wave where all the waves would be aligned. With the difference between the time point of the reference wave and the time points of all the other wa...
[ "def", "align", "(", "w", ",", "signals", ",", "mode", ")", ":", "nw", "=", "[", "]", "if", "len", "(", "shape", "(", "signals", ")", ")", "==", "1", ":", "signals", "=", "[", "signals", "]", "for", "i", "in", "range", "(", "len", "(", "signa...
Align various waves in a specific point. Given a mode of alignment, this function computes the specific time point of a wave where all the waves would be aligned. With the difference between the time point of the reference wave and the time points of all the other waves, we have the amount of sam...
[ "Align", "various", "waves", "in", "a", "specific", "point", ".", "Given", "a", "mode", "of", "alignment", "this", "function", "computes", "the", "specific", "time", "point", "of", "a", "wave", "where", "all", "the", "waves", "would", "be", "aligned", ".",...
aaa01d4125180b3a34f1e26e0d3ff08c23f666d3
https://github.com/biosignalsnotebooks/biosignalsnotebooks/blob/aaa01d4125180b3a34f1e26e0d3ff08c23f666d3/biosignalsnotebooks/build/lib/biosignalsnotebooks/external_packages/novainstrumentation/waves/alignWaves.py#L7-L77
train
This function aligns two waves in a specific time point.
biosignalsnotebooks/biosignalsnotebooks
biosignalsnotebooks/build/lib/biosignalsnotebooks/external_packages/novainstrumentation/waves/alignWaves.py
moveWave
def moveWave(w,move): """ Move a signal in time. This function returns a signal created by a shifting in time on the original signal. Parameters ---------- w: array-like the input signal to move. move: int the ammount of samples to shift the signal (if <0 the signal mov...
python
def moveWave(w,move): """ Move a signal in time. This function returns a signal created by a shifting in time on the original signal. Parameters ---------- w: array-like the input signal to move. move: int the ammount of samples to shift the signal (if <0 the signal mov...
[ "def", "moveWave", "(", "w", ",", "move", ")", ":", "nw", "=", "ma", ".", "masked_all", "(", "len", "(", "w", ")", ")", "if", "(", "move", "==", "0", ")", ":", "#don't move", "nw", "[", "0", ":", "]", "=", "w", "[", "0", ":", "]", "elif", ...
Move a signal in time. This function returns a signal created by a shifting in time on the original signal. Parameters ---------- w: array-like the input signal to move. move: int the ammount of samples to shift the signal (if <0 the signal moves back, if >0 the sign...
[ "Move", "a", "signal", "in", "time", ".", "This", "function", "returns", "a", "signal", "created", "by", "a", "shifting", "in", "time", "on", "the", "original", "signal", ".", "Parameters", "----------", "w", ":", "array", "-", "like", "the", "input", "s...
aaa01d4125180b3a34f1e26e0d3ff08c23f666d3
https://github.com/biosignalsnotebooks/biosignalsnotebooks/blob/aaa01d4125180b3a34f1e26e0d3ff08c23f666d3/biosignalsnotebooks/build/lib/biosignalsnotebooks/external_packages/novainstrumentation/waves/alignWaves.py#L80-L116
train
Move a signal in time.
biosignalsnotebooks/biosignalsnotebooks
biosignalsnotebooks/build/lib/biosignalsnotebooks/external_packages/novainstrumentation/waves/alignWaves.py
peakAlign
def peakAlign(refw,w): """ Difference between the maximum peak positions of the signals. This function returns the difference, in samples, between the peaks position of the signals. If the reference signal has various peaks, the one chosen is the peak which is closer to the middle of the signal, ...
python
def peakAlign(refw,w): """ Difference between the maximum peak positions of the signals. This function returns the difference, in samples, between the peaks position of the signals. If the reference signal has various peaks, the one chosen is the peak which is closer to the middle of the signal, ...
[ "def", "peakAlign", "(", "refw", ",", "w", ")", ":", "p_mw", "=", "array", "(", "peaks", "(", "array", "(", "refw", ")", ",", "min", "(", "refw", ")", ")", ")", "p_w", "=", "array", "(", "peaks", "(", "array", "(", "w", ")", ",", "min", "(", ...
Difference between the maximum peak positions of the signals. This function returns the difference, in samples, between the peaks position of the signals. If the reference signal has various peaks, the one chosen is the peak which is closer to the middle of the signal, and if the other signal ha...
[ "Difference", "between", "the", "maximum", "peak", "positions", "of", "the", "signals", ".", "This", "function", "returns", "the", "difference", "in", "samples", "between", "the", "peaks", "position", "of", "the", "signals", ".", "If", "the", "reference", "sig...
aaa01d4125180b3a34f1e26e0d3ff08c23f666d3
https://github.com/biosignalsnotebooks/biosignalsnotebooks/blob/aaa01d4125180b3a34f1e26e0d3ff08c23f666d3/biosignalsnotebooks/build/lib/biosignalsnotebooks/external_packages/novainstrumentation/waves/alignWaves.py#L181-L226
train
This function aligns two signal sets in order to align the peak positions between the two signals.
KE-works/pykechain
pykechain/models/activity.py
Activity.scope_id
def scope_id(self): """ ID of the scope this Activity belongs to. This property will always produce a scope_id, even when the scope object was not included in an earlier response. When the :class:`Scope` is not included in this task, it will make an additional call to the KE-ch...
python
def scope_id(self): """ ID of the scope this Activity belongs to. This property will always produce a scope_id, even when the scope object was not included in an earlier response. When the :class:`Scope` is not included in this task, it will make an additional call to the KE-ch...
[ "def", "scope_id", "(", "self", ")", ":", "if", "self", ".", "scope", ":", "scope_id", "=", "self", ".", "scope", "and", "self", ".", "scope", ".", "get", "(", "'id'", ")", "else", ":", "pseudo_self", "=", "self", ".", "_client", ".", "activity", "...
ID of the scope this Activity belongs to. This property will always produce a scope_id, even when the scope object was not included in an earlier response. When the :class:`Scope` is not included in this task, it will make an additional call to the KE-chain API. :return: the scope id ...
[ "ID", "of", "the", "scope", "this", "Activity", "belongs", "to", "." ]
b0296cf34328fd41660bf6f0b9114fd0167c40c4
https://github.com/KE-works/pykechain/blob/b0296cf34328fd41660bf6f0b9114fd0167c40c4/pykechain/models/activity.py#L26-L48
train
Returns the scope id of the activity.
KE-works/pykechain
pykechain/models/activity.py
Activity.is_rootlevel
def is_rootlevel(self): """ Determine if Activity is at the root level of a project. :return: Return True if it is a root level activity, otherwise return False :rtype: bool """ container_id = self._json_data.get('container') if container_id: return c...
python
def is_rootlevel(self): """ Determine if Activity is at the root level of a project. :return: Return True if it is a root level activity, otherwise return False :rtype: bool """ container_id = self._json_data.get('container') if container_id: return c...
[ "def", "is_rootlevel", "(", "self", ")", ":", "container_id", "=", "self", ".", "_json_data", ".", "get", "(", "'container'", ")", "if", "container_id", ":", "return", "container_id", "==", "self", ".", "_json_data", ".", "get", "(", "'root_container'", ")",...
Determine if Activity is at the root level of a project. :return: Return True if it is a root level activity, otherwise return False :rtype: bool
[ "Determine", "if", "Activity", "is", "at", "the", "root", "level", "of", "a", "project", "." ]
b0296cf34328fd41660bf6f0b9114fd0167c40c4
https://github.com/KE-works/pykechain/blob/b0296cf34328fd41660bf6f0b9114fd0167c40c4/pykechain/models/activity.py#L54-L65
train
Determines if the activity is at the root level of a project.
KE-works/pykechain
pykechain/models/activity.py
Activity.is_configured
def is_configured(self): """ Determine if the Activity is configured with input and output properties. Makes an additional lightweight call to the API to determine if any associated models are there. :return: Return True if it is configured, otherwise return False :rtype: bool ...
python
def is_configured(self): """ Determine if the Activity is configured with input and output properties. Makes an additional lightweight call to the API to determine if any associated models are there. :return: Return True if it is configured, otherwise return False :rtype: bool ...
[ "def", "is_configured", "(", "self", ")", ":", "# check configured based on if we get at least 1 part back", "associated_models", "=", "self", ".", "parts", "(", "category", "=", "Category", ".", "MODEL", ",", "limit", "=", "1", ")", "if", "associated_models", ":", ...
Determine if the Activity is configured with input and output properties. Makes an additional lightweight call to the API to determine if any associated models are there. :return: Return True if it is configured, otherwise return False :rtype: bool
[ "Determine", "if", "the", "Activity", "is", "configured", "with", "input", "and", "output", "properties", "." ]
b0296cf34328fd41660bf6f0b9114fd0167c40c4
https://github.com/KE-works/pykechain/blob/b0296cf34328fd41660bf6f0b9114fd0167c40c4/pykechain/models/activity.py#L85-L99
train
Determines if the Activity is configured with input and output properties.
KE-works/pykechain
pykechain/models/activity.py
Activity.parts
def parts(self, *args, **kwargs): """Retrieve parts belonging to this activity. Without any arguments it retrieves the Instances related to this task only. This call only returns the configured properties in an activity. So properties that are not configured are not in the returned par...
python
def parts(self, *args, **kwargs): """Retrieve parts belonging to this activity. Without any arguments it retrieves the Instances related to this task only. This call only returns the configured properties in an activity. So properties that are not configured are not in the returned par...
[ "def", "parts", "(", "self", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "return", "self", ".", "_client", ".", "parts", "(", "*", "args", ",", "activity", "=", "self", ".", "id", ",", "*", "*", "kwargs", ")" ]
Retrieve parts belonging to this activity. Without any arguments it retrieves the Instances related to this task only. This call only returns the configured properties in an activity. So properties that are not configured are not in the returned parts. See :class:`pykechain.Client.par...
[ "Retrieve", "parts", "belonging", "to", "this", "activity", "." ]
b0296cf34328fd41660bf6f0b9114fd0167c40c4
https://github.com/KE-works/pykechain/blob/b0296cf34328fd41660bf6f0b9114fd0167c40c4/pykechain/models/activity.py#L120-L139
train
Retrieve the parts belonging to this activity.
KE-works/pykechain
pykechain/models/activity.py
Activity.associated_parts
def associated_parts(self, *args, **kwargs): """Retrieve models and instances belonging to this activity. This is a convenience method for the :func:`Activity.parts()` method, which is used to retrieve both the `Category.MODEL` as well as the `Category.INSTANCE` in a tuple. This call o...
python
def associated_parts(self, *args, **kwargs): """Retrieve models and instances belonging to this activity. This is a convenience method for the :func:`Activity.parts()` method, which is used to retrieve both the `Category.MODEL` as well as the `Category.INSTANCE` in a tuple. This call o...
[ "def", "associated_parts", "(", "self", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "return", "(", "self", ".", "parts", "(", "category", "=", "Category", ".", "MODEL", ",", "*", "args", ",", "*", "*", "kwargs", ")", ",", "self", ".", "p...
Retrieve models and instances belonging to this activity. This is a convenience method for the :func:`Activity.parts()` method, which is used to retrieve both the `Category.MODEL` as well as the `Category.INSTANCE` in a tuple. This call only returns the configured properties in an activity. So...
[ "Retrieve", "models", "and", "instances", "belonging", "to", "this", "activity", "." ]
b0296cf34328fd41660bf6f0b9114fd0167c40c4
https://github.com/KE-works/pykechain/blob/b0296cf34328fd41660bf6f0b9114fd0167c40c4/pykechain/models/activity.py#L141-L166
train
Retrieve models and instances belonging to this activity.
KE-works/pykechain
pykechain/models/activity.py
Activity.configure
def configure(self, inputs, outputs): """Configure activity input and output. You need to provide a list of input and output :class:`Property`. Does not work with lists of propery id's. :param inputs: iterable of input property models :type inputs: list(:class:`Property`) :para...
python
def configure(self, inputs, outputs): """Configure activity input and output. You need to provide a list of input and output :class:`Property`. Does not work with lists of propery id's. :param inputs: iterable of input property models :type inputs: list(:class:`Property`) :para...
[ "def", "configure", "(", "self", ",", "inputs", ",", "outputs", ")", ":", "url", "=", "self", ".", "_client", ".", "_build_url", "(", "'activity'", ",", "activity_id", "=", "self", ".", "id", ")", "r", "=", "self", ".", "_client", ".", "_request", "(...
Configure activity input and output. You need to provide a list of input and output :class:`Property`. Does not work with lists of propery id's. :param inputs: iterable of input property models :type inputs: list(:class:`Property`) :param outputs: iterable of output property models ...
[ "Configure", "activity", "input", "and", "output", "." ]
b0296cf34328fd41660bf6f0b9114fd0167c40c4
https://github.com/KE-works/pykechain/blob/b0296cf34328fd41660bf6f0b9114fd0167c40c4/pykechain/models/activity.py#L168-L187
train
Configure the activity input and output.
KE-works/pykechain
pykechain/models/activity.py
Activity.subprocess
def subprocess(self): """Retrieve the subprocess in which this activity is defined. If this is a task on top level, it raises NotFounderror. :return: a subprocess :class:`Activity` :raises NotFoundError: when it is a task in the top level of a project :raises APIError: when oth...
python
def subprocess(self): """Retrieve the subprocess in which this activity is defined. If this is a task on top level, it raises NotFounderror. :return: a subprocess :class:`Activity` :raises NotFoundError: when it is a task in the top level of a project :raises APIError: when oth...
[ "def", "subprocess", "(", "self", ")", ":", "subprocess_id", "=", "self", ".", "_json_data", ".", "get", "(", "'container'", ")", "if", "subprocess_id", "==", "self", ".", "_json_data", ".", "get", "(", "'root_container'", ")", ":", "raise", "NotFoundError",...
Retrieve the subprocess in which this activity is defined. If this is a task on top level, it raises NotFounderror. :return: a subprocess :class:`Activity` :raises NotFoundError: when it is a task in the top level of a project :raises APIError: when other error occurs Example ...
[ "Retrieve", "the", "subprocess", "in", "which", "this", "activity", "is", "defined", "." ]
b0296cf34328fd41660bf6f0b9114fd0167c40c4
https://github.com/KE-works/pykechain/blob/b0296cf34328fd41660bf6f0b9114fd0167c40c4/pykechain/models/activity.py#L199-L218
train
Retrieve the subprocess in which this activity is defined.
KE-works/pykechain
pykechain/models/activity.py
Activity.children
def children(self, **kwargs): """Retrieve the direct activities of this subprocess. It returns a combination of Tasks (a.o. UserTasks) and Subprocesses on the direct descending level. Only when the activity is a Subprocess, otherwise it raises a NotFoundError :param kwargs: Additional ...
python
def children(self, **kwargs): """Retrieve the direct activities of this subprocess. It returns a combination of Tasks (a.o. UserTasks) and Subprocesses on the direct descending level. Only when the activity is a Subprocess, otherwise it raises a NotFoundError :param kwargs: Additional ...
[ "def", "children", "(", "self", ",", "*", "*", "kwargs", ")", ":", "if", "self", ".", "activity_type", "!=", "ActivityType", ".", "SUBPROCESS", ":", "raise", "NotFoundError", "(", "\"Only subprocesses can have children, please choose a subprocess instead of a '{}' \"", ...
Retrieve the direct activities of this subprocess. It returns a combination of Tasks (a.o. UserTasks) and Subprocesses on the direct descending level. Only when the activity is a Subprocess, otherwise it raises a NotFoundError :param kwargs: Additional search arguments, check :func:`pykechain....
[ "Retrieve", "the", "direct", "activities", "of", "this", "subprocess", "." ]
b0296cf34328fd41660bf6f0b9114fd0167c40c4
https://github.com/KE-works/pykechain/blob/b0296cf34328fd41660bf6f0b9114fd0167c40c4/pykechain/models/activity.py#L220-L246
train
Retrieve the direct activities of this subprocess.
KE-works/pykechain
pykechain/models/activity.py
Activity.siblings
def siblings(self, **kwargs): """Retrieve the other activities that also belong to the subprocess. It returns a combination of Tasks (a.o. UserTasks) and Subprocesses on the level of the current task, including itself. This also works if the activity is of type `ActivityType.SUBPROCESS`. ...
python
def siblings(self, **kwargs): """Retrieve the other activities that also belong to the subprocess. It returns a combination of Tasks (a.o. UserTasks) and Subprocesses on the level of the current task, including itself. This also works if the activity is of type `ActivityType.SUBPROCESS`. ...
[ "def", "siblings", "(", "self", ",", "*", "*", "kwargs", ")", ":", "container_id", "=", "self", ".", "_json_data", ".", "get", "(", "'container'", ")", "return", "self", ".", "_client", ".", "activities", "(", "container", "=", "container_id", ",", "scop...
Retrieve the other activities that also belong to the subprocess. It returns a combination of Tasks (a.o. UserTasks) and Subprocesses on the level of the current task, including itself. This also works if the activity is of type `ActivityType.SUBPROCESS`. :param kwargs: Additional search argum...
[ "Retrieve", "the", "other", "activities", "that", "also", "belong", "to", "the", "subprocess", "." ]
b0296cf34328fd41660bf6f0b9114fd0167c40c4
https://github.com/KE-works/pykechain/blob/b0296cf34328fd41660bf6f0b9114fd0167c40c4/pykechain/models/activity.py#L248-L269
train
Retrieve the other activities that also belong to the subprocess. This is a convenience method for retrieving the other activities that also belong to the subprocess.
KE-works/pykechain
pykechain/models/activity.py
Activity.create
def create(self, *args, **kwargs): """Create a new activity belonging to this subprocess. See :func:`pykechain.Client.create_activity` for available parameters. :raises IllegalArgumentError: if the `Activity` is not a `SUBPROCESS`. :raises APIError: if an Error occurs. """ ...
python
def create(self, *args, **kwargs): """Create a new activity belonging to this subprocess. See :func:`pykechain.Client.create_activity` for available parameters. :raises IllegalArgumentError: if the `Activity` is not a `SUBPROCESS`. :raises APIError: if an Error occurs. """ ...
[ "def", "create", "(", "self", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "if", "self", ".", "activity_type", "!=", "ActivityType", ".", "SUBPROCESS", ":", "raise", "IllegalArgumentError", "(", "\"One can only create a task under a subprocess.\"", ")", ...
Create a new activity belonging to this subprocess. See :func:`pykechain.Client.create_activity` for available parameters. :raises IllegalArgumentError: if the `Activity` is not a `SUBPROCESS`. :raises APIError: if an Error occurs.
[ "Create", "a", "new", "activity", "belonging", "to", "this", "subprocess", "." ]
b0296cf34328fd41660bf6f0b9114fd0167c40c4
https://github.com/KE-works/pykechain/blob/b0296cf34328fd41660bf6f0b9114fd0167c40c4/pykechain/models/activity.py#L271-L281
train
Create a new activity belonging to this subprocess.
KE-works/pykechain
pykechain/models/activity.py
Activity.edit
def edit(self, name=None, description=None, start_date=None, due_date=None, assignees=None, status=None): """Edit the details of an activity. :param name: (optionally) edit the name of the activity :type name: basestring or None :param description: (optionally) edit the description of t...
python
def edit(self, name=None, description=None, start_date=None, due_date=None, assignees=None, status=None): """Edit the details of an activity. :param name: (optionally) edit the name of the activity :type name: basestring or None :param description: (optionally) edit the description of t...
[ "def", "edit", "(", "self", ",", "name", "=", "None", ",", "description", "=", "None", ",", "start_date", "=", "None", ",", "due_date", "=", "None", ",", "assignees", "=", "None", ",", "status", "=", "None", ")", ":", "update_dict", "=", "{", "'id'",...
Edit the details of an activity. :param name: (optionally) edit the name of the activity :type name: basestring or None :param description: (optionally) edit the description of the activity :type description: basestring or None :param start_date: (optionally) edit the start date...
[ "Edit", "the", "details", "of", "an", "activity", "." ]
b0296cf34328fd41660bf6f0b9114fd0167c40c4
https://github.com/KE-works/pykechain/blob/b0296cf34328fd41660bf6f0b9114fd0167c40c4/pykechain/models/activity.py#L283-L396
train
Edit the details of an activity.
KE-works/pykechain
pykechain/models/activity.py
Activity.customization
def customization(self): """ Get a customization object representing the customization of the activity. .. versionadded:: 1.11 :return: An instance of :class:`customization.ExtCustomization` Example ------- >>> activity = project.activity(name='Customizable act...
python
def customization(self): """ Get a customization object representing the customization of the activity. .. versionadded:: 1.11 :return: An instance of :class:`customization.ExtCustomization` Example ------- >>> activity = project.activity(name='Customizable act...
[ "def", "customization", "(", "self", ")", ":", "from", ".", "customization", "import", "ExtCustomization", "# For now, we only allow customization in an Ext JS context", "return", "ExtCustomization", "(", "activity", "=", "self", ",", "client", "=", "self", ".", "_clien...
Get a customization object representing the customization of the activity. .. versionadded:: 1.11 :return: An instance of :class:`customization.ExtCustomization` Example ------- >>> activity = project.activity(name='Customizable activity') >>> customization = activity....
[ "Get", "a", "customization", "object", "representing", "the", "customization", "of", "the", "activity", "." ]
b0296cf34328fd41660bf6f0b9114fd0167c40c4
https://github.com/KE-works/pykechain/blob/b0296cf34328fd41660bf6f0b9114fd0167c40c4/pykechain/models/activity.py#L398-L417
train
Return an ExtCustomization object representing the customization of the activity.
hfurubotten/enturclient
enturclient/api.py
EnturPublicTransportData.get_gql_query
def get_gql_query(self): """Generate GraphQL query""" template_string = """query( $stops: [String], $quays: [String], $whitelist: InputWhiteListed, $numberOfDepartures: Int = 2, $omitNonBoarding: Boolean = true){\n""" if self.stops: ...
python
def get_gql_query(self): """Generate GraphQL query""" template_string = """query( $stops: [String], $quays: [String], $whitelist: InputWhiteListed, $numberOfDepartures: Int = 2, $omitNonBoarding: Boolean = true){\n""" if self.stops: ...
[ "def", "get_gql_query", "(", "self", ")", ":", "template_string", "=", "\"\"\"query(\n $stops: [String],\n $quays: [String],\n $whitelist: InputWhiteListed,\n $numberOfDepartures: Int = 2,\n $omitNonBoarding: Boolean = true){\\n\"\"\"", "if", ...
Generate GraphQL query
[ "Generate", "GraphQL", "query" ]
8230f9e9cf5b3a4911e860bc8cbe621231aa5ae4
https://github.com/hfurubotten/enturclient/blob/8230f9e9cf5b3a4911e860bc8cbe621231aa5ae4/enturclient/api.py#L47-L62
train
Generate GraphQL query string for a set of keys.
hfurubotten/enturclient
enturclient/api.py
EnturPublicTransportData.all_stop_places_quays
def all_stop_places_quays(self) -> list: """Get all stop places and quays""" all_places = self.stops.copy() for quay in self.quays: all_places.append(quay) return all_places
python
def all_stop_places_quays(self) -> list: """Get all stop places and quays""" all_places = self.stops.copy() for quay in self.quays: all_places.append(quay) return all_places
[ "def", "all_stop_places_quays", "(", "self", ")", "->", "list", ":", "all_places", "=", "self", ".", "stops", ".", "copy", "(", ")", "for", "quay", "in", "self", ".", "quays", ":", "all_places", ".", "append", "(", "quay", ")", "return", "all_places" ]
Get all stop places and quays
[ "Get", "all", "stop", "places", "and", "quays" ]
8230f9e9cf5b3a4911e860bc8cbe621231aa5ae4
https://github.com/hfurubotten/enturclient/blob/8230f9e9cf5b3a4911e860bc8cbe621231aa5ae4/enturclient/api.py#L68-L73
train
Get all stop places and quays.
hfurubotten/enturclient
enturclient/api.py
EnturPublicTransportData.expand_all_quays
async def expand_all_quays(self) -> None: """Find all quays from stop places.""" if not self.stops: return headers = {'ET-Client-Name': self._client_name} request = { 'query': GRAPHQL_STOP_TO_QUAY_TEMPLATE, 'variables': { 'stops': self...
python
async def expand_all_quays(self) -> None: """Find all quays from stop places.""" if not self.stops: return headers = {'ET-Client-Name': self._client_name} request = { 'query': GRAPHQL_STOP_TO_QUAY_TEMPLATE, 'variables': { 'stops': self...
[ "async", "def", "expand_all_quays", "(", "self", ")", "->", "None", ":", "if", "not", "self", ".", "stops", ":", "return", "headers", "=", "{", "'ET-Client-Name'", ":", "self", ".", "_client_name", "}", "request", "=", "{", "'query'", ":", "GRAPHQL_STOP_TO...
Find all quays from stop places.
[ "Find", "all", "quays", "from", "stop", "places", "." ]
8230f9e9cf5b3a4911e860bc8cbe621231aa5ae4
https://github.com/hfurubotten/enturclient/blob/8230f9e9cf5b3a4911e860bc8cbe621231aa5ae4/enturclient/api.py#L75-L108
train
Find all quays from stop places.
hfurubotten/enturclient
enturclient/api.py
EnturPublicTransportData.update
async def update(self) -> None: """Get the latest data from api.entur.org.""" headers = {'ET-Client-Name': self._client_name} request = { 'query': self.get_gql_query(), 'variables': { 'stops': self.stops, 'quays': self.quays, ...
python
async def update(self) -> None: """Get the latest data from api.entur.org.""" headers = {'ET-Client-Name': self._client_name} request = { 'query': self.get_gql_query(), 'variables': { 'stops': self.stops, 'quays': self.quays, ...
[ "async", "def", "update", "(", "self", ")", "->", "None", ":", "headers", "=", "{", "'ET-Client-Name'", ":", "self", ".", "_client_name", "}", "request", "=", "{", "'query'", ":", "self", ".", "get_gql_query", "(", ")", ",", "'variables'", ":", "{", "'...
Get the latest data from api.entur.org.
[ "Get", "the", "latest", "data", "from", "api", ".", "entur", ".", "org", "." ]
8230f9e9cf5b3a4911e860bc8cbe621231aa5ae4
https://github.com/hfurubotten/enturclient/blob/8230f9e9cf5b3a4911e860bc8cbe621231aa5ae4/enturclient/api.py#L110-L152
train
Update the latest data from api. entur. org.
hfurubotten/enturclient
enturclient/api.py
EnturPublicTransportData._process_place
def _process_place(self, place: dict, is_platform: bool) -> None: """Extract information from place dictionary.""" place_id = place['id'] self.info[place_id] = Place(place, is_platform)
python
def _process_place(self, place: dict, is_platform: bool) -> None: """Extract information from place dictionary.""" place_id = place['id'] self.info[place_id] = Place(place, is_platform)
[ "def", "_process_place", "(", "self", ",", "place", ":", "dict", ",", "is_platform", ":", "bool", ")", "->", "None", ":", "place_id", "=", "place", "[", "'id'", "]", "self", ".", "info", "[", "place_id", "]", "=", "Place", "(", "place", ",", "is_plat...
Extract information from place dictionary.
[ "Extract", "information", "from", "place", "dictionary", "." ]
8230f9e9cf5b3a4911e860bc8cbe621231aa5ae4
https://github.com/hfurubotten/enturclient/blob/8230f9e9cf5b3a4911e860bc8cbe621231aa5ae4/enturclient/api.py#L158-L161
train
Extract information from place dictionary.
SuryaSankar/flask-sqlalchemy-booster
flask_sqlalchemy_booster/responses.py
serializable_list
def serializable_list( olist, attrs_to_serialize=None, rels_to_expand=None, group_listrels_by=None, rels_to_serialize=None, key_modifications=None, groupby=None, keyvals_to_merge=None, preserve_order=False, dict_struct=None, dict_post_processors=None): """ Converts a list of mode...
python
def serializable_list( olist, attrs_to_serialize=None, rels_to_expand=None, group_listrels_by=None, rels_to_serialize=None, key_modifications=None, groupby=None, keyvals_to_merge=None, preserve_order=False, dict_struct=None, dict_post_processors=None): """ Converts a list of mode...
[ "def", "serializable_list", "(", "olist", ",", "attrs_to_serialize", "=", "None", ",", "rels_to_expand", "=", "None", ",", "group_listrels_by", "=", "None", ",", "rels_to_serialize", "=", "None", ",", "key_modifications", "=", "None", ",", "groupby", "=", "None"...
Converts a list of model instances to a list of dictionaries using their `todict` method. Args: olist (list): The list of instances to convert attrs_to_serialize (list, optional): To be passed as an argument to the `todict` method rels_to_expand (list, optional): To be passe...
[ "Converts", "a", "list", "of", "model", "instances", "to", "a", "list", "of", "dictionaries", "using", "their", "todict", "method", "." ]
444048d167ab7718f758e943665ef32d101423a5
https://github.com/SuryaSankar/flask-sqlalchemy-booster/blob/444048d167ab7718f758e943665ef32d101423a5/flask_sqlalchemy_booster/responses.py#L96-L168
train
Converts a list of model instances into a list of dictionaries where each element in the list is a dictionary of the related objects that are represented by the base class of the base class.
SuryaSankar/flask-sqlalchemy-booster
flask_sqlalchemy_booster/responses.py
jsoned
def jsoned(struct, wrap=True, meta=None, struct_key='result', pre_render_callback=None): """ Provides a json dump of the struct Args: struct: The data to dump wrap (bool, optional): Specify whether to wrap the struct in an enclosing dict struct_key (str, optional): The strin...
python
def jsoned(struct, wrap=True, meta=None, struct_key='result', pre_render_callback=None): """ Provides a json dump of the struct Args: struct: The data to dump wrap (bool, optional): Specify whether to wrap the struct in an enclosing dict struct_key (str, optional): The strin...
[ "def", "jsoned", "(", "struct", ",", "wrap", "=", "True", ",", "meta", "=", "None", ",", "struct_key", "=", "'result'", ",", "pre_render_callback", "=", "None", ")", ":", "return", "_json", ".", "dumps", "(", "structured", "(", "struct", ",", "wrap", "...
Provides a json dump of the struct Args: struct: The data to dump wrap (bool, optional): Specify whether to wrap the struct in an enclosing dict struct_key (str, optional): The string key which will contain the struct in the result dict meta (dict, optional):...
[ "Provides", "a", "json", "dump", "of", "the", "struct" ]
444048d167ab7718f758e943665ef32d101423a5
https://github.com/SuryaSankar/flask-sqlalchemy-booster/blob/444048d167ab7718f758e943665ef32d101423a5/flask_sqlalchemy_booster/responses.py#L191-L216
train
Provides a json dump of the structure in the order they appear in the tree.
SuryaSankar/flask-sqlalchemy-booster
flask_sqlalchemy_booster/responses.py
as_list
def as_list(func): """ A decorator used to return a JSON response of a list of model objects. It expects the decorated function to return a list of model instances. It then converts the instances to dicts and serializes them into a json response Examples: >>> @app.route...
python
def as_list(func): """ A decorator used to return a JSON response of a list of model objects. It expects the decorated function to return a list of model instances. It then converts the instances to dicts and serializes them into a json response Examples: >>> @app.route...
[ "def", "as_list", "(", "func", ")", ":", "@", "wraps", "(", "func", ")", "def", "wrapper", "(", "*", "args", ",", "*", "*", "kwargs", ")", ":", "response", "=", "func", "(", "*", "args", ",", "*", "*", "kwargs", ")", "if", "isinstance", "(", "r...
A decorator used to return a JSON response of a list of model objects. It expects the decorated function to return a list of model instances. It then converts the instances to dicts and serializes them into a json response Examples: >>> @app.route('/api') ... @a...
[ "A", "decorator", "used", "to", "return", "a", "JSON", "response", "of", "a", "list", "of", "model", "objects", ".", "It", "expects", "the", "decorated", "function", "to", "return", "a", "list", "of", "model", "instances", ".", "It", "then", "converts", ...
444048d167ab7718f758e943665ef32d101423a5
https://github.com/SuryaSankar/flask-sqlalchemy-booster/blob/444048d167ab7718f758e943665ef32d101423a5/flask_sqlalchemy_booster/responses.py#L419-L441
train
A decorator that returns a JSON response of a list of model objects. It expects the response to return a list of dicts and serializes them into a json response.
SuryaSankar/flask-sqlalchemy-booster
flask_sqlalchemy_booster/responses.py
filter_query_using_filters_list
def filter_query_using_filters_list(result, filters_dict): """ filters = { "c": "AND", "f": [ { "k": "layout_id", "op": "=", "v": 1 }, { "k": "created_at", "op": ">=", ...
python
def filter_query_using_filters_list(result, filters_dict): """ filters = { "c": "AND", "f": [ { "k": "layout_id", "op": "=", "v": 1 }, { "k": "created_at", "op": ">=", ...
[ "def", "filter_query_using_filters_list", "(", "result", ",", "filters_dict", ")", ":", "if", "not", "(", "isinstance", "(", "result", ",", "Query", ")", "or", "isinstance", "(", "result", ",", "QueryBooster", ")", ")", ":", "if", "isinstance", "(", "result"...
filters = { "c": "AND", "f": [ { "k": "layout_id", "op": "=", "v": 1 }, { "k": "created_at", "op": ">=", "v": "2014-11-10T11:53:33" }, { ...
[ "filters", "=", "{", "c", ":", "AND", "f", ":", "[", "{", "k", ":", "layout_id", "op", ":", "=", "v", ":", "1", "}", "{", "k", ":", "created_at", "op", ":", ">", "=", "v", ":", "2014", "-", "11", "-", "10T11", ":", "53", ":", "33", "}", ...
444048d167ab7718f758e943665ef32d101423a5
https://github.com/SuryaSankar/flask-sqlalchemy-booster/blob/444048d167ab7718f758e943665ef32d101423a5/flask_sqlalchemy_booster/responses.py#L599-L643
train
Filter the result query using the filters_dict.
SuryaSankar/flask-sqlalchemy-booster
flask_sqlalchemy_booster/responses.py
as_processed_list
def as_processed_list(func): """ A decorator used to return a JSON response of a list of model objects. It differs from `as_list` in that it accepts a variety of querying parameters and can use them to filter and modify the results. It expects the decorated function to return either Model Cl...
python
def as_processed_list(func): """ A decorator used to return a JSON response of a list of model objects. It differs from `as_list` in that it accepts a variety of querying parameters and can use them to filter and modify the results. It expects the decorated function to return either Model Cl...
[ "def", "as_processed_list", "(", "func", ")", ":", "@", "wraps", "(", "func", ")", "def", "wrapper", "(", "*", "args", ",", "*", "*", "kwargs", ")", ":", "func_argspec", "=", "inspect", ".", "getargspec", "(", "func", ")", "func_args", "=", "func_argsp...
A decorator used to return a JSON response of a list of model objects. It differs from `as_list` in that it accepts a variety of querying parameters and can use them to filter and modify the results. It expects the decorated function to return either Model Class to query or a SQLAlchemy ...
[ "A", "decorator", "used", "to", "return", "a", "JSON", "response", "of", "a", "list", "of", "model", "objects", ".", "It", "differs", "from", "as_list", "in", "that", "it", "accepts", "a", "variety", "of", "querying", "parameters", "and", "can", "use", "...
444048d167ab7718f758e943665ef32d101423a5
https://github.com/SuryaSankar/flask-sqlalchemy-booster/blob/444048d167ab7718f758e943665ef32d101423a5/flask_sqlalchemy_booster/responses.py#L911-L946
train
A decorator that returns a JSON response of a list of model objects. It accepts a variety of querying parameters and can use them to filter and modify the list of model objects.
SuryaSankar/flask-sqlalchemy-booster
flask_sqlalchemy_booster/responses.py
as_obj
def as_obj(func): """ A decorator used to return a JSON response with a dict representation of the model instance. It expects the decorated function to return a Model instance. It then converts the instance to dicts and serializes it into a json response Examples: >>> ...
python
def as_obj(func): """ A decorator used to return a JSON response with a dict representation of the model instance. It expects the decorated function to return a Model instance. It then converts the instance to dicts and serializes it into a json response Examples: >>> ...
[ "def", "as_obj", "(", "func", ")", ":", "@", "wraps", "(", "func", ")", "def", "wrapper", "(", "*", "args", ",", "*", "*", "kwargs", ")", ":", "response", "=", "func", "(", "*", "args", ",", "*", "*", "kwargs", ")", "return", "render_json_obj_with_...
A decorator used to return a JSON response with a dict representation of the model instance. It expects the decorated function to return a Model instance. It then converts the instance to dicts and serializes it into a json response Examples: >>> @app.route('/api/shipments...
[ "A", "decorator", "used", "to", "return", "a", "JSON", "response", "with", "a", "dict", "representation", "of", "the", "model", "instance", ".", "It", "expects", "the", "decorated", "function", "to", "return", "a", "Model", "instance", ".", "It", "then", "...
444048d167ab7718f758e943665ef32d101423a5
https://github.com/SuryaSankar/flask-sqlalchemy-booster/blob/444048d167ab7718f758e943665ef32d101423a5/flask_sqlalchemy_booster/responses.py#L949-L966
train
A decorator that returns a JSON response with a dict representation of the model instance. It expects the decorated function to return a Model instance.
thomasdelaet/python-velbus
velbus/messages/module_subtype.py
ModuleSubTypeMessage.populate
def populate(self, priority, address, rtr, data): """ :return: None """ assert isinstance(data, bytes) self.needs_low_priority(priority) self.needs_no_rtr(rtr) #self.needs_data(data, 6) self.set_attributes(priority, address, rtr) self.module_type =...
python
def populate(self, priority, address, rtr, data): """ :return: None """ assert isinstance(data, bytes) self.needs_low_priority(priority) self.needs_no_rtr(rtr) #self.needs_data(data, 6) self.set_attributes(priority, address, rtr) self.module_type =...
[ "def", "populate", "(", "self", ",", "priority", ",", "address", ",", "rtr", ",", "data", ")", ":", "assert", "isinstance", "(", "data", ",", "bytes", ")", "self", ".", "needs_low_priority", "(", "priority", ")", "self", ".", "needs_no_rtr", "(", "rtr", ...
:return: None
[ ":", "return", ":", "None" ]
af2f8af43f1a24bf854eff9f3126fd7b5c41b3dd
https://github.com/thomasdelaet/python-velbus/blob/af2f8af43f1a24bf854eff9f3126fd7b5c41b3dd/velbus/messages/module_subtype.py#L34-L47
train
Populates the object with the data from the specified entry.
thomasdelaet/python-velbus
velbus/messages/module_subtype.py
ModuleSubTypeMessage.to_json
def to_json(self): """ :return: str """ json_dict = self.to_json_basic() json_dict['sub_1'] = self.sub_address_1 json_dict['sub_2'] = self.sub_address_2 json_dict['sub_3'] = self.sub_address_3 json_dict['sub_4'] = self.sub_address_4 return json.dum...
python
def to_json(self): """ :return: str """ json_dict = self.to_json_basic() json_dict['sub_1'] = self.sub_address_1 json_dict['sub_2'] = self.sub_address_2 json_dict['sub_3'] = self.sub_address_3 json_dict['sub_4'] = self.sub_address_4 return json.dum...
[ "def", "to_json", "(", "self", ")", ":", "json_dict", "=", "self", ".", "to_json_basic", "(", ")", "json_dict", "[", "'sub_1'", "]", "=", "self", ".", "sub_address_1", "json_dict", "[", "'sub_2'", "]", "=", "self", ".", "sub_address_2", "json_dict", "[", ...
:return: str
[ ":", "return", ":", "str" ]
af2f8af43f1a24bf854eff9f3126fd7b5c41b3dd
https://github.com/thomasdelaet/python-velbus/blob/af2f8af43f1a24bf854eff9f3126fd7b5c41b3dd/velbus/messages/module_subtype.py#L50-L59
train
Returns a JSON string representation of the current object.
thomasdelaet/python-velbus
velbus/messages/set_daylight_saving.py
SetDaylightSaving.to_json
def to_json(self): """ :return: str """ json_dict = self.to_json_basic() json_dict['ds'] = self._ds return json.dumps(json_dict)
python
def to_json(self): """ :return: str """ json_dict = self.to_json_basic() json_dict['ds'] = self._ds return json.dumps(json_dict)
[ "def", "to_json", "(", "self", ")", ":", "json_dict", "=", "self", ".", "to_json_basic", "(", ")", "json_dict", "[", "'ds'", "]", "=", "self", ".", "_ds", "return", "json", ".", "dumps", "(", "json_dict", ")" ]
:return: str
[ ":", "return", ":", "str" ]
af2f8af43f1a24bf854eff9f3126fd7b5c41b3dd
https://github.com/thomasdelaet/python-velbus/blob/af2f8af43f1a24bf854eff9f3126fd7b5c41b3dd/velbus/messages/set_daylight_saving.py#L42-L48
train
Returns a JSON string representation of the object.
KE-works/pykechain
pykechain/models/base.py
Base.refresh
def refresh(self): # type: () -> None """Refresh the object in place.""" src = self._client.reload(self) self.__dict__.update(src.__dict__)
python
def refresh(self): # type: () -> None """Refresh the object in place.""" src = self._client.reload(self) self.__dict__.update(src.__dict__)
[ "def", "refresh", "(", "self", ")", ":", "# type: () -> None", "src", "=", "self", ".", "_client", ".", "reload", "(", "self", ")", "self", ".", "__dict__", ".", "update", "(", "src", ".", "__dict__", ")" ]
Refresh the object in place.
[ "Refresh", "the", "object", "in", "place", "." ]
b0296cf34328fd41660bf6f0b9114fd0167c40c4
https://github.com/KE-works/pykechain/blob/b0296cf34328fd41660bf6f0b9114fd0167c40c4/pykechain/models/base.py#L27-L31
train
Refresh the object in place.
thomasdelaet/python-velbus
velbus/messages/switch_to_safe.py
SwitchToSafeMessage.populate
def populate(self, priority, address, rtr, data): """ :return: None """ self.needs_no_rtr(rtr) self.set_attributes(priority, address, rtr)
python
def populate(self, priority, address, rtr, data): """ :return: None """ self.needs_no_rtr(rtr) self.set_attributes(priority, address, rtr)
[ "def", "populate", "(", "self", ",", "priority", ",", "address", ",", "rtr", ",", "data", ")", ":", "self", ".", "needs_no_rtr", "(", "rtr", ")", "self", ".", "set_attributes", "(", "priority", ",", "address", ",", "rtr", ")" ]
:return: None
[ ":", "return", ":", "None" ]
af2f8af43f1a24bf854eff9f3126fd7b5c41b3dd
https://github.com/thomasdelaet/python-velbus/blob/af2f8af43f1a24bf854eff9f3126fd7b5c41b3dd/velbus/messages/switch_to_safe.py#L21-L26
train
Populates the object with the data.
thomasdelaet/python-velbus
velbus/messages/switch_to_safe.py
SwitchToSafeMessage.to_json
def to_json(self): """ :return: str """ json_dict = self.to_json_basic() json_dict['sleep_time'] = self.sleep return json.dumps(json_dict)
python
def to_json(self): """ :return: str """ json_dict = self.to_json_basic() json_dict['sleep_time'] = self.sleep return json.dumps(json_dict)
[ "def", "to_json", "(", "self", ")", ":", "json_dict", "=", "self", ".", "to_json_basic", "(", ")", "json_dict", "[", "'sleep_time'", "]", "=", "self", ".", "sleep", "return", "json", ".", "dumps", "(", "json_dict", ")" ]
:return: str
[ ":", "return", ":", "str" ]
af2f8af43f1a24bf854eff9f3126fd7b5c41b3dd
https://github.com/thomasdelaet/python-velbus/blob/af2f8af43f1a24bf854eff9f3126fd7b5c41b3dd/velbus/messages/switch_to_safe.py#L28-L34
train
Returns a JSON string representation of the current object.