partition stringclasses 3
values | func_name stringlengths 1 134 | docstring stringlengths 1 46.9k | path stringlengths 4 223 | original_string stringlengths 75 104k | code stringlengths 75 104k | docstring_tokens listlengths 1 1.97k | repo stringlengths 7 55 | language stringclasses 1
value | url stringlengths 87 315 | code_tokens listlengths 19 28.4k | sha stringlengths 40 40 |
|---|---|---|---|---|---|---|---|---|---|---|---|
train | DocumentModel.__make_computation | Create a new data item with computation specified by processing_id, inputs, and region_list_map.
The region_list_map associates a list of graphics corresponding to the required regions with a computation source (key). | nion/swift/model/DocumentModel.py | def __make_computation(self, processing_id: str, inputs: typing.List[typing.Tuple[DisplayItem.DisplayItem, typing.Optional[Graphics.Graphic]]], region_list_map: typing.Mapping[str, typing.List[Graphics.Graphic]]=None, parameters: typing.Mapping[str, typing.Any]=None) -> DataItem.DataItem:
"""Create a new data i... | def __make_computation(self, processing_id: str, inputs: typing.List[typing.Tuple[DisplayItem.DisplayItem, typing.Optional[Graphics.Graphic]]], region_list_map: typing.Mapping[str, typing.List[Graphics.Graphic]]=None, parameters: typing.Mapping[str, typing.Any]=None) -> DataItem.DataItem:
"""Create a new data i... | [
"Create",
"a",
"new",
"data",
"item",
"with",
"computation",
"specified",
"by",
"processing_id",
"inputs",
"and",
"region_list_map",
"."
] | nion-software/nionswift | python | https://github.com/nion-software/nionswift/blob/d43693eaf057b8683b9638e575000f055fede452/nion/swift/model/DocumentModel.py#L2389-L2633 | [
"def",
"__make_computation",
"(",
"self",
",",
"processing_id",
":",
"str",
",",
"inputs",
":",
"typing",
".",
"List",
"[",
"typing",
".",
"Tuple",
"[",
"DisplayItem",
".",
"DisplayItem",
",",
"typing",
".",
"Optional",
"[",
"Graphics",
".",
"Graphic",
"]"... | d43693eaf057b8683b9638e575000f055fede452 |
train | interpolate_colors | Creates a color map for values in array
:param array: color map to interpolate
:param x: number of colors
:return: interpolated color map | nion/swift/model/ColorMaps.py | def interpolate_colors(array: numpy.ndarray, x: int) -> numpy.ndarray:
"""
Creates a color map for values in array
:param array: color map to interpolate
:param x: number of colors
:return: interpolated color map
"""
out_array = []
for i in range(x):
if i % (x / (len(array) - 1))... | def interpolate_colors(array: numpy.ndarray, x: int) -> numpy.ndarray:
"""
Creates a color map for values in array
:param array: color map to interpolate
:param x: number of colors
:return: interpolated color map
"""
out_array = []
for i in range(x):
if i % (x / (len(array) - 1))... | [
"Creates",
"a",
"color",
"map",
"for",
"values",
"in",
"array",
":",
"param",
"array",
":",
"color",
"map",
"to",
"interpolate",
":",
"param",
"x",
":",
"number",
"of",
"colors",
":",
"return",
":",
"interpolated",
"color",
"map"
] | nion-software/nionswift | python | https://github.com/nion-software/nionswift/blob/d43693eaf057b8683b9638e575000f055fede452/nion/swift/model/ColorMaps.py#L23-L42 | [
"def",
"interpolate_colors",
"(",
"array",
":",
"numpy",
".",
"ndarray",
",",
"x",
":",
"int",
")",
"->",
"numpy",
".",
"ndarray",
":",
"out_array",
"=",
"[",
"]",
"for",
"i",
"in",
"range",
"(",
"x",
")",
":",
"if",
"i",
"%",
"(",
"x",
"/",
"(... | d43693eaf057b8683b9638e575000f055fede452 |
train | Do.star | star any gist by providing gistID or gistname(for authenticated user) | simplegist/do.py | def star(self, **args):
'''
star any gist by providing gistID or gistname(for authenticated user)
'''
if 'name' in args:
self.gist_name = args['name']
self.gist_id = self.getMyID(self.gist_name)
elif 'id' in args:
self.gist_id = args['id']
else:
raise Exception('Either provide authenticated user... | def star(self, **args):
'''
star any gist by providing gistID or gistname(for authenticated user)
'''
if 'name' in args:
self.gist_name = args['name']
self.gist_id = self.getMyID(self.gist_name)
elif 'id' in args:
self.gist_id = args['id']
else:
raise Exception('Either provide authenticated user... | [
"star",
"any",
"gist",
"by",
"providing",
"gistID",
"or",
"gistname",
"(",
"for",
"authenticated",
"user",
")"
] | softvar/simplegist | python | https://github.com/softvar/simplegist/blob/8d53edd15d76c7b10fb963a659c1cf9f46f5345d/simplegist/do.py#L28-L50 | [
"def",
"star",
"(",
"self",
",",
"*",
"*",
"args",
")",
":",
"if",
"'name'",
"in",
"args",
":",
"self",
".",
"gist_name",
"=",
"args",
"[",
"'name'",
"]",
"self",
".",
"gist_id",
"=",
"self",
".",
"getMyID",
"(",
"self",
".",
"gist_name",
")",
"e... | 8d53edd15d76c7b10fb963a659c1cf9f46f5345d |
train | Do.fork | fork any gist by providing gistID or gistname(for authenticated user) | simplegist/do.py | def fork(self, **args):
'''
fork any gist by providing gistID or gistname(for authenticated user)
'''
if 'name' in args:
self.gist_name = args['name']
self.gist_id = self.getMyID(self.gist_name)
elif 'id' in args:
self.gist_id = args['id']
else:
raise Exception('Either provide authenticated user... | def fork(self, **args):
'''
fork any gist by providing gistID or gistname(for authenticated user)
'''
if 'name' in args:
self.gist_name = args['name']
self.gist_id = self.getMyID(self.gist_name)
elif 'id' in args:
self.gist_id = args['id']
else:
raise Exception('Either provide authenticated user... | [
"fork",
"any",
"gist",
"by",
"providing",
"gistID",
"or",
"gistname",
"(",
"for",
"authenticated",
"user",
")"
] | softvar/simplegist | python | https://github.com/softvar/simplegist/blob/8d53edd15d76c7b10fb963a659c1cf9f46f5345d/simplegist/do.py#L76-L101 | [
"def",
"fork",
"(",
"self",
",",
"*",
"*",
"args",
")",
":",
"if",
"'name'",
"in",
"args",
":",
"self",
".",
"gist_name",
"=",
"args",
"[",
"'name'",
"]",
"self",
".",
"gist_id",
"=",
"self",
".",
"getMyID",
"(",
"self",
".",
"gist_name",
")",
"e... | 8d53edd15d76c7b10fb963a659c1cf9f46f5345d |
train | Do.checkifstar | Check a gist if starred by providing gistID or gistname(for authenticated user) | simplegist/do.py | def checkifstar(self, **args):
'''
Check a gist if starred by providing gistID or gistname(for authenticated user)
'''
if 'name' in args:
self.gist_name = args['name']
self.gist_id = self.getMyID(self.gist_name)
elif 'id' in args:
self.gist_id = args['id']
else:
raise Exception('Either provide ... | def checkifstar(self, **args):
'''
Check a gist if starred by providing gistID or gistname(for authenticated user)
'''
if 'name' in args:
self.gist_name = args['name']
self.gist_id = self.getMyID(self.gist_name)
elif 'id' in args:
self.gist_id = args['id']
else:
raise Exception('Either provide ... | [
"Check",
"a",
"gist",
"if",
"starred",
"by",
"providing",
"gistID",
"or",
"gistname",
"(",
"for",
"authenticated",
"user",
")"
] | softvar/simplegist | python | https://github.com/softvar/simplegist/blob/8d53edd15d76c7b10fb963a659c1cf9f46f5345d/simplegist/do.py#L103-L130 | [
"def",
"checkifstar",
"(",
"self",
",",
"*",
"*",
"args",
")",
":",
"if",
"'name'",
"in",
"args",
":",
"self",
".",
"gist_name",
"=",
"args",
"[",
"'name'",
"]",
"self",
".",
"gist_id",
"=",
"self",
".",
"getMyID",
"(",
"self",
".",
"gist_name",
")... | 8d53edd15d76c7b10fb963a659c1cf9f46f5345d |
train | RespostaExtrairLogs.salvar | Salva o arquivo de log decodificado.
:param str destino: (Opcional) Caminho completo para o arquivo onde os
dados dos logs deverão ser salvos. Se não informado, será criado
um arquivo temporário via :func:`tempfile.mkstemp`.
:param str prefix: (Opcional) Prefixo para o nome do ... | satcfe/resposta/extrairlogs.py | def salvar(self, destino=None, prefix='tmp', suffix='-sat.log'):
"""Salva o arquivo de log decodificado.
:param str destino: (Opcional) Caminho completo para o arquivo onde os
dados dos logs deverão ser salvos. Se não informado, será criado
um arquivo temporário via :func:`tempf... | def salvar(self, destino=None, prefix='tmp', suffix='-sat.log'):
"""Salva o arquivo de log decodificado.
:param str destino: (Opcional) Caminho completo para o arquivo onde os
dados dos logs deverão ser salvos. Se não informado, será criado
um arquivo temporário via :func:`tempf... | [
"Salva",
"o",
"arquivo",
"de",
"log",
"decodificado",
"."
] | base4sistemas/satcfe | python | https://github.com/base4sistemas/satcfe/blob/cb8e8815f4133d3e3d94cf526fa86767b4521ed9/satcfe/resposta/extrairlogs.py#L55-L85 | [
"def",
"salvar",
"(",
"self",
",",
"destino",
"=",
"None",
",",
"prefix",
"=",
"'tmp'",
",",
"suffix",
"=",
"'-sat.log'",
")",
":",
"if",
"destino",
":",
"if",
"os",
".",
"path",
".",
"exists",
"(",
"destino",
")",
":",
"raise",
"IOError",
"(",
"("... | cb8e8815f4133d3e3d94cf526fa86767b4521ed9 |
train | RespostaExtrairLogs.analisar | Constrói uma :class:`RespostaExtrairLogs` a partir do retorno
informado.
:param unicode retorno: Retorno da função ``ExtrairLogs``. | satcfe/resposta/extrairlogs.py | def analisar(retorno):
"""Constrói uma :class:`RespostaExtrairLogs` a partir do retorno
informado.
:param unicode retorno: Retorno da função ``ExtrairLogs``.
"""
resposta = analisar_retorno(forcar_unicode(retorno),
funcao='ExtrairLogs',
classe_res... | def analisar(retorno):
"""Constrói uma :class:`RespostaExtrairLogs` a partir do retorno
informado.
:param unicode retorno: Retorno da função ``ExtrairLogs``.
"""
resposta = analisar_retorno(forcar_unicode(retorno),
funcao='ExtrairLogs',
classe_res... | [
"Constrói",
"uma",
":",
"class",
":",
"RespostaExtrairLogs",
"a",
"partir",
"do",
"retorno",
"informado",
"."
] | base4sistemas/satcfe | python | https://github.com/base4sistemas/satcfe/blob/cb8e8815f4133d3e3d94cf526fa86767b4521ed9/satcfe/resposta/extrairlogs.py#L89-L109 | [
"def",
"analisar",
"(",
"retorno",
")",
":",
"resposta",
"=",
"analisar_retorno",
"(",
"forcar_unicode",
"(",
"retorno",
")",
",",
"funcao",
"=",
"'ExtrairLogs'",
",",
"classe_resposta",
"=",
"RespostaExtrairLogs",
",",
"campos",
"=",
"RespostaSAT",
".",
"CAMPOS... | cb8e8815f4133d3e3d94cf526fa86767b4521ed9 |
train | ModelGrid.load_data_old | Loads time series of 2D data grids from each opened file. The code
handles loading a full time series from one file or individual time steps
from multiple files. Missing files are supported. | hagelslag/data/ModelGrid.py | def load_data_old(self):
"""
Loads time series of 2D data grids from each opened file. The code
handles loading a full time series from one file or individual time steps
from multiple files. Missing files are supported.
"""
units = ""
if len(self.file_objects) ==... | def load_data_old(self):
"""
Loads time series of 2D data grids from each opened file. The code
handles loading a full time series from one file or individual time steps
from multiple files. Missing files are supported.
"""
units = ""
if len(self.file_objects) ==... | [
"Loads",
"time",
"series",
"of",
"2D",
"data",
"grids",
"from",
"each",
"opened",
"file",
".",
"The",
"code",
"handles",
"loading",
"a",
"full",
"time",
"series",
"from",
"one",
"file",
"or",
"individual",
"time",
"steps",
"from",
"multiple",
"files",
".",... | djgagne/hagelslag | python | https://github.com/djgagne/hagelslag/blob/6fb6c3df90bf4867e13a97d3460b14471d107df1/hagelslag/data/ModelGrid.py#L55-L94 | [
"def",
"load_data_old",
"(",
"self",
")",
":",
"units",
"=",
"\"\"",
"if",
"len",
"(",
"self",
".",
"file_objects",
")",
"==",
"1",
"and",
"self",
".",
"file_objects",
"[",
"0",
"]",
"is",
"not",
"None",
":",
"data",
"=",
"self",
".",
"file_objects",... | 6fb6c3df90bf4867e13a97d3460b14471d107df1 |
train | ModelGrid.load_data | Load data from netCDF file objects or list of netCDF file objects. Handles special variable name formats.
Returns:
Array of data loaded from files in (time, y, x) dimensions, Units | hagelslag/data/ModelGrid.py | def load_data(self):
"""
Load data from netCDF file objects or list of netCDF file objects. Handles special variable name formats.
Returns:
Array of data loaded from files in (time, y, x) dimensions, Units
"""
units = ""
if self.file_objects[0] is None:
... | def load_data(self):
"""
Load data from netCDF file objects or list of netCDF file objects. Handles special variable name formats.
Returns:
Array of data loaded from files in (time, y, x) dimensions, Units
"""
units = ""
if self.file_objects[0] is None:
... | [
"Load",
"data",
"from",
"netCDF",
"file",
"objects",
"or",
"list",
"of",
"netCDF",
"file",
"objects",
".",
"Handles",
"special",
"variable",
"name",
"formats",
"."
] | djgagne/hagelslag | python | https://github.com/djgagne/hagelslag/blob/6fb6c3df90bf4867e13a97d3460b14471d107df1/hagelslag/data/ModelGrid.py#L96-L127 | [
"def",
"load_data",
"(",
"self",
")",
":",
"units",
"=",
"\"\"",
"if",
"self",
".",
"file_objects",
"[",
"0",
"]",
"is",
"None",
":",
"raise",
"IOError",
"(",
")",
"var_name",
",",
"z_index",
"=",
"self",
".",
"format_var_name",
"(",
"self",
".",
"va... | 6fb6c3df90bf4867e13a97d3460b14471d107df1 |
train | ModelGrid.format_var_name | Searches var list for variable name, checks other variable name format options.
Args:
variable (str): Variable being loaded
var_list (list): List of variables in file.
Returns:
Name of variable in file containing relevant data, and index of variable z-level if multi... | hagelslag/data/ModelGrid.py | def format_var_name(variable, var_list):
"""
Searches var list for variable name, checks other variable name format options.
Args:
variable (str): Variable being loaded
var_list (list): List of variables in file.
Returns:
Name of variable in file con... | def format_var_name(variable, var_list):
"""
Searches var list for variable name, checks other variable name format options.
Args:
variable (str): Variable being loaded
var_list (list): List of variables in file.
Returns:
Name of variable in file con... | [
"Searches",
"var",
"list",
"for",
"variable",
"name",
"checks",
"other",
"variable",
"name",
"format",
"options",
"."
] | djgagne/hagelslag | python | https://github.com/djgagne/hagelslag/blob/6fb6c3df90bf4867e13a97d3460b14471d107df1/hagelslag/data/ModelGrid.py#L130-L152 | [
"def",
"format_var_name",
"(",
"variable",
",",
"var_list",
")",
":",
"z_index",
"=",
"None",
"if",
"variable",
"in",
"var_list",
":",
"var_name",
"=",
"variable",
"elif",
"variable",
".",
"ljust",
"(",
"6",
",",
"\"_\"",
")",
"in",
"var_list",
":",
"var... | 6fb6c3df90bf4867e13a97d3460b14471d107df1 |
train | TrackModeler.load_data | Load data from flat data files containing total track information and information about each timestep.
The two sets are combined using merge operations on the Track IDs. Additional member information is gathered
from the appropriate member file.
Args:
mode: "train" or "forecast"
... | hagelslag/processing/TrackModeler.py | def load_data(self, mode="train", format="csv"):
"""
Load data from flat data files containing total track information and information about each timestep.
The two sets are combined using merge operations on the Track IDs. Additional member information is gathered
from the appropriate me... | def load_data(self, mode="train", format="csv"):
"""
Load data from flat data files containing total track information and information about each timestep.
The two sets are combined using merge operations on the Track IDs. Additional member information is gathered
from the appropriate me... | [
"Load",
"data",
"from",
"flat",
"data",
"files",
"containing",
"total",
"track",
"information",
"and",
"information",
"about",
"each",
"timestep",
".",
"The",
"two",
"sets",
"are",
"combined",
"using",
"merge",
"operations",
"on",
"the",
"Track",
"IDs",
".",
... | djgagne/hagelslag | python | https://github.com/djgagne/hagelslag/blob/6fb6c3df90bf4867e13a97d3460b14471d107df1/hagelslag/processing/TrackModeler.py#L63-L111 | [
"def",
"load_data",
"(",
"self",
",",
"mode",
"=",
"\"train\"",
",",
"format",
"=",
"\"csv\"",
")",
":",
"if",
"mode",
"in",
"self",
".",
"data",
".",
"keys",
"(",
")",
":",
"run_dates",
"=",
"pd",
".",
"DatetimeIndex",
"(",
"start",
"=",
"self",
"... | 6fb6c3df90bf4867e13a97d3460b14471d107df1 |
train | TrackModeler.calc_copulas | Calculate a copula multivariate normal distribution from the training data for each group of ensemble members.
Distributions are written to a pickle file for later use.
Args:
output_file: Pickle file
model_names: Names of the tracking models
label_columns: Names of th... | hagelslag/processing/TrackModeler.py | def calc_copulas(self,
output_file,
model_names=("start-time", "translation-x", "translation-y"),
label_columns=("Start_Time_Error", "Translation_Error_X", "Translation_Error_Y")):
"""
Calculate a copula multivariate normal distribution from... | def calc_copulas(self,
output_file,
model_names=("start-time", "translation-x", "translation-y"),
label_columns=("Start_Time_Error", "Translation_Error_X", "Translation_Error_Y")):
"""
Calculate a copula multivariate normal distribution from... | [
"Calculate",
"a",
"copula",
"multivariate",
"normal",
"distribution",
"from",
"the",
"training",
"data",
"for",
"each",
"group",
"of",
"ensemble",
"members",
".",
"Distributions",
"are",
"written",
"to",
"a",
"pickle",
"file",
"for",
"later",
"use",
".",
"Args... | djgagne/hagelslag | python | https://github.com/djgagne/hagelslag/blob/6fb6c3df90bf4867e13a97d3460b14471d107df1/hagelslag/processing/TrackModeler.py#L113-L142 | [
"def",
"calc_copulas",
"(",
"self",
",",
"output_file",
",",
"model_names",
"=",
"(",
"\"start-time\"",
",",
"\"translation-x\"",
",",
"\"translation-y\"",
")",
",",
"label_columns",
"=",
"(",
"\"Start_Time_Error\"",
",",
"\"Translation_Error_X\"",
",",
"\"Translation... | 6fb6c3df90bf4867e13a97d3460b14471d107df1 |
train | TrackModeler.fit_condition_models | Fit machine learning models to predict whether or not hail will occur.
Args:
model_names: List of strings with the names for the particular machine learning models
model_objs: scikit-learn style machine learning model objects.
input_columns: list of the names of the columns u... | hagelslag/processing/TrackModeler.py | def fit_condition_models(self, model_names,
model_objs,
input_columns,
output_column="Matched",
output_threshold=0.0):
"""
Fit machine learning models to predict whether or not hail will o... | def fit_condition_models(self, model_names,
model_objs,
input_columns,
output_column="Matched",
output_threshold=0.0):
"""
Fit machine learning models to predict whether or not hail will o... | [
"Fit",
"machine",
"learning",
"models",
"to",
"predict",
"whether",
"or",
"not",
"hail",
"will",
"occur",
".",
"Args",
":",
"model_names",
":",
"List",
"of",
"strings",
"with",
"the",
"names",
"for",
"the",
"particular",
"machine",
"learning",
"models",
"mod... | djgagne/hagelslag | python | https://github.com/djgagne/hagelslag/blob/6fb6c3df90bf4867e13a97d3460b14471d107df1/hagelslag/processing/TrackModeler.py#L144-L191 | [
"def",
"fit_condition_models",
"(",
"self",
",",
"model_names",
",",
"model_objs",
",",
"input_columns",
",",
"output_column",
"=",
"\"Matched\"",
",",
"output_threshold",
"=",
"0.0",
")",
":",
"print",
"(",
"\"Fitting condition models\"",
")",
"groups",
"=",
"sel... | 6fb6c3df90bf4867e13a97d3460b14471d107df1 |
train | TrackModeler.fit_condition_threshold_models | Fit models to predict hail/no-hail and use cross-validation to determine the probaility threshold that
maximizes a skill score.
Args:
model_names: List of machine learning model names
model_objs: List of Scikit-learn ML models
input_columns: List of input variables i... | hagelslag/processing/TrackModeler.py | def fit_condition_threshold_models(self, model_names, model_objs, input_columns, output_column="Matched",
output_threshold=0.5, num_folds=5, threshold_score="ets"):
"""
Fit models to predict hail/no-hail and use cross-validation to determine the probaility threshol... | def fit_condition_threshold_models(self, model_names, model_objs, input_columns, output_column="Matched",
output_threshold=0.5, num_folds=5, threshold_score="ets"):
"""
Fit models to predict hail/no-hail and use cross-validation to determine the probaility threshol... | [
"Fit",
"models",
"to",
"predict",
"hail",
"/",
"no",
"-",
"hail",
"and",
"use",
"cross",
"-",
"validation",
"to",
"determine",
"the",
"probaility",
"threshold",
"that",
"maximizes",
"a",
"skill",
"score",
"."
] | djgagne/hagelslag | python | https://github.com/djgagne/hagelslag/blob/6fb6c3df90bf4867e13a97d3460b14471d107df1/hagelslag/processing/TrackModeler.py#L193-L292 | [
"def",
"fit_condition_threshold_models",
"(",
"self",
",",
"model_names",
",",
"model_objs",
",",
"input_columns",
",",
"output_column",
"=",
"\"Matched\"",
",",
"output_threshold",
"=",
"0.5",
",",
"num_folds",
"=",
"5",
",",
"threshold_score",
"=",
"\"ets\"",
")... | 6fb6c3df90bf4867e13a97d3460b14471d107df1 |
train | TrackModeler.predict_condition_models | Apply condition modelsto forecast data.
Args:
model_names: List of names associated with each condition model used for prediction
input_columns: List of columns in data used as input into the model
metadata_cols: Columns from input data that should be included in the data fra... | hagelslag/processing/TrackModeler.py | def predict_condition_models(self, model_names,
input_columns,
metadata_cols,
data_mode="forecast",
):
"""
Apply condition modelsto forecast data.
Args:
... | def predict_condition_models(self, model_names,
input_columns,
metadata_cols,
data_mode="forecast",
):
"""
Apply condition modelsto forecast data.
Args:
... | [
"Apply",
"condition",
"modelsto",
"forecast",
"data",
".",
"Args",
":",
"model_names",
":",
"List",
"of",
"names",
"associated",
"with",
"each",
"condition",
"model",
"used",
"for",
"prediction",
"input_columns",
":",
"List",
"of",
"columns",
"in",
"data",
"us... | djgagne/hagelslag | python | https://github.com/djgagne/hagelslag/blob/6fb6c3df90bf4867e13a97d3460b14471d107df1/hagelslag/processing/TrackModeler.py#L294-L327 | [
"def",
"predict_condition_models",
"(",
"self",
",",
"model_names",
",",
"input_columns",
",",
"metadata_cols",
",",
"data_mode",
"=",
"\"forecast\"",
",",
")",
":",
"groups",
"=",
"self",
".",
"condition_models",
".",
"keys",
"(",
")",
"predictions",
"=",
"pd... | 6fb6c3df90bf4867e13a97d3460b14471d107df1 |
train | TrackModeler.fit_size_distribution_models | Fits multitask machine learning models to predict the parameters of a size distribution
Args:
model_names: List of machine learning model names
model_objs: scikit-learn style machine learning model objects
input_columns: Training data columns used as input for ML model
... | hagelslag/processing/TrackModeler.py | def fit_size_distribution_models(self, model_names, model_objs, input_columns,
output_columns=None, calibrate=False):
"""
Fits multitask machine learning models to predict the parameters of a size distribution
Args:
model_names: List of machine le... | def fit_size_distribution_models(self, model_names, model_objs, input_columns,
output_columns=None, calibrate=False):
"""
Fits multitask machine learning models to predict the parameters of a size distribution
Args:
model_names: List of machine le... | [
"Fits",
"multitask",
"machine",
"learning",
"models",
"to",
"predict",
"the",
"parameters",
"of",
"a",
"size",
"distribution",
"Args",
":",
"model_names",
":",
"List",
"of",
"machine",
"learning",
"model",
"names",
"model_objs",
":",
"scikit",
"-",
"learn",
"s... | djgagne/hagelslag | python | https://github.com/djgagne/hagelslag/blob/6fb6c3df90bf4867e13a97d3460b14471d107df1/hagelslag/processing/TrackModeler.py#L329-L399 | [
"def",
"fit_size_distribution_models",
"(",
"self",
",",
"model_names",
",",
"model_objs",
",",
"input_columns",
",",
"output_columns",
"=",
"None",
",",
"calibrate",
"=",
"False",
")",
":",
"if",
"output_columns",
"is",
"None",
":",
"output_columns",
"=",
"[",
... | 6fb6c3df90bf4867e13a97d3460b14471d107df1 |
train | TrackModeler.fit_size_distribution_component_models | This calculates 2 principal components for the hail size distribution between the shape and scale parameters.
Separate machine learning models are fit to predict each component.
Args:
model_names: List of machine learning model names
model_objs: List of machine learning model ob... | hagelslag/processing/TrackModeler.py | def fit_size_distribution_component_models(self, model_names, model_objs, input_columns, output_columns):
"""
This calculates 2 principal components for the hail size distribution between the shape and scale parameters.
Separate machine learning models are fit to predict each component.
... | def fit_size_distribution_component_models(self, model_names, model_objs, input_columns, output_columns):
"""
This calculates 2 principal components for the hail size distribution between the shape and scale parameters.
Separate machine learning models are fit to predict each component.
... | [
"This",
"calculates",
"2",
"principal",
"components",
"for",
"the",
"hail",
"size",
"distribution",
"between",
"the",
"shape",
"and",
"scale",
"parameters",
".",
"Separate",
"machine",
"learning",
"models",
"are",
"fit",
"to",
"predict",
"each",
"component",
"."... | djgagne/hagelslag | python | https://github.com/djgagne/hagelslag/blob/6fb6c3df90bf4867e13a97d3460b14471d107df1/hagelslag/processing/TrackModeler.py#L402-L468 | [
"def",
"fit_size_distribution_component_models",
"(",
"self",
",",
"model_names",
",",
"model_objs",
",",
"input_columns",
",",
"output_columns",
")",
":",
"groups",
"=",
"np",
".",
"unique",
"(",
"self",
".",
"data",
"[",
"\"train\"",
"]",
"[",
"\"member\"",
... | 6fb6c3df90bf4867e13a97d3460b14471d107df1 |
train | TrackModeler.predict_size_distribution_models | Make predictions using fitted size distribution models.
Args:
model_names: Name of the models for predictions
input_columns: Data columns used for input into ML models
metadata_cols: Columns from input data that should be included in the data frame with the predictions.
... | hagelslag/processing/TrackModeler.py | def predict_size_distribution_models(self, model_names, input_columns, metadata_cols,
data_mode="forecast", location=6, calibrate=False):
"""
Make predictions using fitted size distribution models.
Args:
model_names: Name of the models for pre... | def predict_size_distribution_models(self, model_names, input_columns, metadata_cols,
data_mode="forecast", location=6, calibrate=False):
"""
Make predictions using fitted size distribution models.
Args:
model_names: Name of the models for pre... | [
"Make",
"predictions",
"using",
"fitted",
"size",
"distribution",
"models",
".",
"Args",
":",
"model_names",
":",
"Name",
"of",
"the",
"models",
"for",
"predictions",
"input_columns",
":",
"Data",
"columns",
"used",
"for",
"input",
"into",
"ML",
"models",
"met... | djgagne/hagelslag | python | https://github.com/djgagne/hagelslag/blob/6fb6c3df90bf4867e13a97d3460b14471d107df1/hagelslag/processing/TrackModeler.py#L470-L510 | [
"def",
"predict_size_distribution_models",
"(",
"self",
",",
"model_names",
",",
"input_columns",
",",
"metadata_cols",
",",
"data_mode",
"=",
"\"forecast\"",
",",
"location",
"=",
"6",
",",
"calibrate",
"=",
"False",
")",
":",
"groups",
"=",
"self",
".",
"siz... | 6fb6c3df90bf4867e13a97d3460b14471d107df1 |
train | TrackModeler.predict_size_distribution_component_models | Make predictions using fitted size distribution models.
Args:
model_names: Name of the models for predictions
input_columns: Data columns used for input into ML models
output_columns: Names of output columns
metadata_cols: Columns from input data that should be in... | hagelslag/processing/TrackModeler.py | def predict_size_distribution_component_models(self, model_names, input_columns, output_columns, metadata_cols,
data_mode="forecast", location=6):
"""
Make predictions using fitted size distribution models.
Args:
model_names: Name of... | def predict_size_distribution_component_models(self, model_names, input_columns, output_columns, metadata_cols,
data_mode="forecast", location=6):
"""
Make predictions using fitted size distribution models.
Args:
model_names: Name of... | [
"Make",
"predictions",
"using",
"fitted",
"size",
"distribution",
"models",
".",
"Args",
":",
"model_names",
":",
"Name",
"of",
"the",
"models",
"for",
"predictions",
"input_columns",
":",
"Data",
"columns",
"used",
"for",
"input",
"into",
"ML",
"models",
"out... | djgagne/hagelslag | python | https://github.com/djgagne/hagelslag/blob/6fb6c3df90bf4867e13a97d3460b14471d107df1/hagelslag/processing/TrackModeler.py#L512-L553 | [
"def",
"predict_size_distribution_component_models",
"(",
"self",
",",
"model_names",
",",
"input_columns",
",",
"output_columns",
",",
"metadata_cols",
",",
"data_mode",
"=",
"\"forecast\"",
",",
"location",
"=",
"6",
")",
":",
"groups",
"=",
"self",
".",
"size_d... | 6fb6c3df90bf4867e13a97d3460b14471d107df1 |
train | TrackModeler.fit_size_models | Fit size models to produce discrete pdfs of forecast hail sizes.
Args:
model_names: List of model names
model_objs: List of model objects
input_columns: List of input variables
output_column: Output variable name
output_start: Hail size bin start
... | hagelslag/processing/TrackModeler.py | def fit_size_models(self, model_names,
model_objs,
input_columns,
output_column="Hail_Size",
output_start=5,
output_step=5,
output_stop=100):
"""
Fit size model... | def fit_size_models(self, model_names,
model_objs,
input_columns,
output_column="Hail_Size",
output_start=5,
output_step=5,
output_stop=100):
"""
Fit size model... | [
"Fit",
"size",
"models",
"to",
"produce",
"discrete",
"pdfs",
"of",
"forecast",
"hail",
"sizes",
".",
"Args",
":",
"model_names",
":",
"List",
"of",
"model",
"names",
"model_objs",
":",
"List",
"of",
"model",
"objects",
"input_columns",
":",
"List",
"of",
... | djgagne/hagelslag | python | https://github.com/djgagne/hagelslag/blob/6fb6c3df90bf4867e13a97d3460b14471d107df1/hagelslag/processing/TrackModeler.py#L555-L591 | [
"def",
"fit_size_models",
"(",
"self",
",",
"model_names",
",",
"model_objs",
",",
"input_columns",
",",
"output_column",
"=",
"\"Hail_Size\"",
",",
"output_start",
"=",
"5",
",",
"output_step",
"=",
"5",
",",
"output_stop",
"=",
"100",
")",
":",
"print",
"(... | 6fb6c3df90bf4867e13a97d3460b14471d107df1 |
train | TrackModeler.predict_size_models | Apply size models to forecast data.
Args:
model_names:
input_columns:
metadata_cols:
data_mode: | hagelslag/processing/TrackModeler.py | def predict_size_models(self, model_names,
input_columns,
metadata_cols,
data_mode="forecast"):
"""
Apply size models to forecast data.
Args:
model_names:
input_columns:
metada... | def predict_size_models(self, model_names,
input_columns,
metadata_cols,
data_mode="forecast"):
"""
Apply size models to forecast data.
Args:
model_names:
input_columns:
metada... | [
"Apply",
"size",
"models",
"to",
"forecast",
"data",
".",
"Args",
":",
"model_names",
":",
"input_columns",
":",
"metadata_cols",
":",
"data_mode",
":"
] | djgagne/hagelslag | python | https://github.com/djgagne/hagelslag/blob/6fb6c3df90bf4867e13a97d3460b14471d107df1/hagelslag/processing/TrackModeler.py#L593-L624 | [
"def",
"predict_size_models",
"(",
"self",
",",
"model_names",
",",
"input_columns",
",",
"metadata_cols",
",",
"data_mode",
"=",
"\"forecast\"",
")",
":",
"groups",
"=",
"self",
".",
"size_models",
".",
"keys",
"(",
")",
"predictions",
"=",
"{",
"}",
"for",... | 6fb6c3df90bf4867e13a97d3460b14471d107df1 |
train | TrackModeler.fit_track_models | Fit machine learning models to predict track error offsets.
model_names:
model_objs:
input_columns:
output_columns:
output_ranges: | hagelslag/processing/TrackModeler.py | def fit_track_models(self,
model_names,
model_objs,
input_columns,
output_columns,
output_ranges,
):
"""
Fit machine learning models to predict track erro... | def fit_track_models(self,
model_names,
model_objs,
input_columns,
output_columns,
output_ranges,
):
"""
Fit machine learning models to predict track erro... | [
"Fit",
"machine",
"learning",
"models",
"to",
"predict",
"track",
"error",
"offsets",
".",
"model_names",
":",
"model_objs",
":",
"input_columns",
":",
"output_columns",
":",
"output_ranges",
":"
] | djgagne/hagelslag | python | https://github.com/djgagne/hagelslag/blob/6fb6c3df90bf4867e13a97d3460b14471d107df1/hagelslag/processing/TrackModeler.py#L626-L661 | [
"def",
"fit_track_models",
"(",
"self",
",",
"model_names",
",",
"model_objs",
",",
"input_columns",
",",
"output_columns",
",",
"output_ranges",
",",
")",
":",
"print",
"(",
"\"Fitting track models\"",
")",
"groups",
"=",
"self",
".",
"data",
"[",
"\"train\"",
... | 6fb6c3df90bf4867e13a97d3460b14471d107df1 |
train | TrackModeler.save_models | Save machine learning models to pickle files. | hagelslag/processing/TrackModeler.py | def save_models(self, model_path):
"""
Save machine learning models to pickle files.
"""
for group, condition_model_set in self.condition_models.items():
for model_name, model_obj in condition_model_set.items():
out_filename = model_path + \
... | def save_models(self, model_path):
"""
Save machine learning models to pickle files.
"""
for group, condition_model_set in self.condition_models.items():
for model_name, model_obj in condition_model_set.items():
out_filename = model_path + \
... | [
"Save",
"machine",
"learning",
"models",
"to",
"pickle",
"files",
"."
] | djgagne/hagelslag | python | https://github.com/djgagne/hagelslag/blob/6fb6c3df90bf4867e13a97d3460b14471d107df1/hagelslag/processing/TrackModeler.py#L700-L745 | [
"def",
"save_models",
"(",
"self",
",",
"model_path",
")",
":",
"for",
"group",
",",
"condition_model_set",
"in",
"self",
".",
"condition_models",
".",
"items",
"(",
")",
":",
"for",
"model_name",
",",
"model_obj",
"in",
"condition_model_set",
".",
"items",
... | 6fb6c3df90bf4867e13a97d3460b14471d107df1 |
train | TrackModeler.load_models | Load models from pickle files. | hagelslag/processing/TrackModeler.py | def load_models(self, model_path):
"""
Load models from pickle files.
"""
condition_model_files = sorted(glob(model_path + "*_condition.pkl"))
if len(condition_model_files) > 0:
for condition_model_file in condition_model_files:
model_comps = condition... | def load_models(self, model_path):
"""
Load models from pickle files.
"""
condition_model_files = sorted(glob(model_path + "*_condition.pkl"))
if len(condition_model_files) > 0:
for condition_model_file in condition_model_files:
model_comps = condition... | [
"Load",
"models",
"from",
"pickle",
"files",
"."
] | djgagne/hagelslag | python | https://github.com/djgagne/hagelslag/blob/6fb6c3df90bf4867e13a97d3460b14471d107df1/hagelslag/processing/TrackModeler.py#L747-L799 | [
"def",
"load_models",
"(",
"self",
",",
"model_path",
")",
":",
"condition_model_files",
"=",
"sorted",
"(",
"glob",
"(",
"model_path",
"+",
"\"*_condition.pkl\"",
")",
")",
"if",
"len",
"(",
"condition_model_files",
")",
">",
"0",
":",
"for",
"condition_model... | 6fb6c3df90bf4867e13a97d3460b14471d107df1 |
train | TrackModeler.output_forecasts_json | Output forecast values to geoJSON file format.
:param forecasts:
:param condition_model_names:
:param size_model_names:
:param track_model_names:
:param json_data_path:
:param out_path:
:return: | hagelslag/processing/TrackModeler.py | def output_forecasts_json(self, forecasts,
condition_model_names,
size_model_names,
dist_model_names,
track_model_names,
json_data_path,
out... | def output_forecasts_json(self, forecasts,
condition_model_names,
size_model_names,
dist_model_names,
track_model_names,
json_data_path,
out... | [
"Output",
"forecast",
"values",
"to",
"geoJSON",
"file",
"format",
".",
":",
"param",
"forecasts",
":",
":",
"param",
"condition_model_names",
":",
":",
"param",
"size_model_names",
":",
":",
"param",
"track_model_names",
":",
":",
"param",
"json_data_path",
":"... | djgagne/hagelslag | python | https://github.com/djgagne/hagelslag/blob/6fb6c3df90bf4867e13a97d3460b14471d107df1/hagelslag/processing/TrackModeler.py#L801-L877 | [
"def",
"output_forecasts_json",
"(",
"self",
",",
"forecasts",
",",
"condition_model_names",
",",
"size_model_names",
",",
"dist_model_names",
",",
"track_model_names",
",",
"json_data_path",
",",
"out_path",
")",
":",
"total_tracks",
"=",
"self",
".",
"data",
"[",
... | 6fb6c3df90bf4867e13a97d3460b14471d107df1 |
train | TrackModeler.output_forecasts_csv | Output hail forecast values to csv files by run date and ensemble member.
Args:
forecasts:
mode:
csv_path:
Returns: | hagelslag/processing/TrackModeler.py | def output_forecasts_csv(self, forecasts, mode, csv_path, run_date_format="%Y%m%d-%H%M"):
"""
Output hail forecast values to csv files by run date and ensemble member.
Args:
forecasts:
mode:
csv_path:
Returns:
"""
merged_forecasts = pd... | def output_forecasts_csv(self, forecasts, mode, csv_path, run_date_format="%Y%m%d-%H%M"):
"""
Output hail forecast values to csv files by run date and ensemble member.
Args:
forecasts:
mode:
csv_path:
Returns:
"""
merged_forecasts = pd... | [
"Output",
"hail",
"forecast",
"values",
"to",
"csv",
"files",
"by",
"run",
"date",
"and",
"ensemble",
"member",
"."
] | djgagne/hagelslag | python | https://github.com/djgagne/hagelslag/blob/6fb6c3df90bf4867e13a97d3460b14471d107df1/hagelslag/processing/TrackModeler.py#L879-L905 | [
"def",
"output_forecasts_csv",
"(",
"self",
",",
"forecasts",
",",
"mode",
",",
"csv_path",
",",
"run_date_format",
"=",
"\"%Y%m%d-%H%M\"",
")",
":",
"merged_forecasts",
"=",
"pd",
".",
"merge",
"(",
"forecasts",
"[",
"\"condition\"",
"]",
",",
"forecasts",
"[... | 6fb6c3df90bf4867e13a97d3460b14471d107df1 |
train | BibliotecaSAT._carregar | Carrega (ou recarrega) a biblioteca SAT. Se a convenção de chamada
ainda não tiver sido definida, será determinada pela extensão do
arquivo da biblioteca.
:raises ValueError: Se a convenção de chamada não puder ser determinada
ou se não for um valor válido. | satcfe/base.py | def _carregar(self):
"""Carrega (ou recarrega) a biblioteca SAT. Se a convenção de chamada
ainda não tiver sido definida, será determinada pela extensão do
arquivo da biblioteca.
:raises ValueError: Se a convenção de chamada não puder ser determinada
ou se não for um valor v... | def _carregar(self):
"""Carrega (ou recarrega) a biblioteca SAT. Se a convenção de chamada
ainda não tiver sido definida, será determinada pela extensão do
arquivo da biblioteca.
:raises ValueError: Se a convenção de chamada não puder ser determinada
ou se não for um valor v... | [
"Carrega",
"(",
"ou",
"recarrega",
")",
"a",
"biblioteca",
"SAT",
".",
"Se",
"a",
"convenção",
"de",
"chamada",
"ainda",
"não",
"tiver",
"sido",
"definida",
"será",
"determinada",
"pela",
"extensão",
"do",
"arquivo",
"da",
"biblioteca",
"."
] | base4sistemas/satcfe | python | https://github.com/base4sistemas/satcfe/blob/cb8e8815f4133d3e3d94cf526fa86767b4521ed9/satcfe/base.py#L81-L105 | [
"def",
"_carregar",
"(",
"self",
")",
":",
"if",
"self",
".",
"_convencao",
"is",
"None",
":",
"if",
"self",
".",
"_caminho",
".",
"endswith",
"(",
"(",
"'.DLL'",
",",
"'.dll'",
")",
")",
":",
"self",
".",
"_convencao",
"=",
"constantes",
".",
"WINDO... | cb8e8815f4133d3e3d94cf526fa86767b4521ed9 |
train | FuncoesSAT.ativar_sat | Função ``AtivarSAT`` conforme ER SAT, item 6.1.1.
Ativação do equipamento SAT. Dependendo do tipo do certificado, o
procedimento de ativação é complementado enviando-se o certificado
emitido pela ICP-Brasil (:meth:`comunicar_certificado_icpbrasil`).
:param int tipo_certificado: Deverá s... | satcfe/base.py | def ativar_sat(self, tipo_certificado, cnpj, codigo_uf):
"""Função ``AtivarSAT`` conforme ER SAT, item 6.1.1.
Ativação do equipamento SAT. Dependendo do tipo do certificado, o
procedimento de ativação é complementado enviando-se o certificado
emitido pela ICP-Brasil (:meth:`comunicar_cer... | def ativar_sat(self, tipo_certificado, cnpj, codigo_uf):
"""Função ``AtivarSAT`` conforme ER SAT, item 6.1.1.
Ativação do equipamento SAT. Dependendo do tipo do certificado, o
procedimento de ativação é complementado enviando-se o certificado
emitido pela ICP-Brasil (:meth:`comunicar_cer... | [
"Função",
"AtivarSAT",
"conforme",
"ER",
"SAT",
"item",
"6",
".",
"1",
".",
"1",
".",
"Ativação",
"do",
"equipamento",
"SAT",
".",
"Dependendo",
"do",
"tipo",
"do",
"certificado",
"o",
"procedimento",
"de",
"ativação",
"é",
"complementado",
"enviando",
"-",
... | base4sistemas/satcfe | python | https://github.com/base4sistemas/satcfe/blob/cb8e8815f4133d3e3d94cf526fa86767b4521ed9/satcfe/base.py#L262-L290 | [
"def",
"ativar_sat",
"(",
"self",
",",
"tipo_certificado",
",",
"cnpj",
",",
"codigo_uf",
")",
":",
"return",
"self",
".",
"invocar__AtivarSAT",
"(",
"self",
".",
"gerar_numero_sessao",
"(",
")",
",",
"tipo_certificado",
",",
"self",
".",
"_codigo_ativacao",
"... | cb8e8815f4133d3e3d94cf526fa86767b4521ed9 |
train | FuncoesSAT.comunicar_certificado_icpbrasil | Função ``ComunicarCertificadoICPBRASIL`` conforme ER SAT, item 6.1.2.
Envio do certificado criado pela ICP-Brasil.
:param str certificado: Conteúdo do certificado digital criado pela
autoridade certificadora ICP-Brasil.
:return: Retorna *verbatim* a resposta da função SAT.
... | satcfe/base.py | def comunicar_certificado_icpbrasil(self, certificado):
"""Função ``ComunicarCertificadoICPBRASIL`` conforme ER SAT, item 6.1.2.
Envio do certificado criado pela ICP-Brasil.
:param str certificado: Conteúdo do certificado digital criado pela
autoridade certificadora ICP-Brasil.
... | def comunicar_certificado_icpbrasil(self, certificado):
"""Função ``ComunicarCertificadoICPBRASIL`` conforme ER SAT, item 6.1.2.
Envio do certificado criado pela ICP-Brasil.
:param str certificado: Conteúdo do certificado digital criado pela
autoridade certificadora ICP-Brasil.
... | [
"Função",
"ComunicarCertificadoICPBRASIL",
"conforme",
"ER",
"SAT",
"item",
"6",
".",
"1",
".",
"2",
".",
"Envio",
"do",
"certificado",
"criado",
"pela",
"ICP",
"-",
"Brasil",
"."
] | base4sistemas/satcfe | python | https://github.com/base4sistemas/satcfe/blob/cb8e8815f4133d3e3d94cf526fa86767b4521ed9/satcfe/base.py#L293-L304 | [
"def",
"comunicar_certificado_icpbrasil",
"(",
"self",
",",
"certificado",
")",
":",
"return",
"self",
".",
"invocar__ComunicarCertificadoICPBRASIL",
"(",
"self",
".",
"gerar_numero_sessao",
"(",
")",
",",
"self",
".",
"_codigo_ativacao",
",",
"certificado",
")"
] | cb8e8815f4133d3e3d94cf526fa86767b4521ed9 |
train | FuncoesSAT.enviar_dados_venda | Função ``EnviarDadosVenda`` conforme ER SAT, item 6.1.3. Envia o
CF-e de venda para o equipamento SAT, que o enviará para autorização
pela SEFAZ.
:param dados_venda: Uma instância de :class:`~satcfe.entidades.CFeVenda`
ou uma string contendo o XML do CF-e de venda.
:return:... | satcfe/base.py | def enviar_dados_venda(self, dados_venda):
"""Função ``EnviarDadosVenda`` conforme ER SAT, item 6.1.3. Envia o
CF-e de venda para o equipamento SAT, que o enviará para autorização
pela SEFAZ.
:param dados_venda: Uma instância de :class:`~satcfe.entidades.CFeVenda`
ou uma str... | def enviar_dados_venda(self, dados_venda):
"""Função ``EnviarDadosVenda`` conforme ER SAT, item 6.1.3. Envia o
CF-e de venda para o equipamento SAT, que o enviará para autorização
pela SEFAZ.
:param dados_venda: Uma instância de :class:`~satcfe.entidades.CFeVenda`
ou uma str... | [
"Função",
"EnviarDadosVenda",
"conforme",
"ER",
"SAT",
"item",
"6",
".",
"1",
".",
"3",
".",
"Envia",
"o",
"CF",
"-",
"e",
"de",
"venda",
"para",
"o",
"equipamento",
"SAT",
"que",
"o",
"enviará",
"para",
"autorização",
"pela",
"SEFAZ",
"."
] | base4sistemas/satcfe | python | https://github.com/base4sistemas/satcfe/blob/cb8e8815f4133d3e3d94cf526fa86767b4521ed9/satcfe/base.py#L307-L323 | [
"def",
"enviar_dados_venda",
"(",
"self",
",",
"dados_venda",
")",
":",
"cfe_venda",
"=",
"dados_venda",
"if",
"isinstance",
"(",
"dados_venda",
",",
"basestring",
")",
"else",
"dados_venda",
".",
"documento",
"(",
")",
"return",
"self",
".",
"invocar__EnviarDad... | cb8e8815f4133d3e3d94cf526fa86767b4521ed9 |
train | FuncoesSAT.cancelar_ultima_venda | Função ``CancelarUltimaVenda`` conforme ER SAT, item 6.1.4. Envia o
CF-e de cancelamento para o equipamento SAT, que o enviará para
autorização e cancelamento do CF-e pela SEFAZ.
:param chave_cfe: String contendo a chave do CF-e a ser cancelado,
prefixada com o literal ``CFe``.
... | satcfe/base.py | def cancelar_ultima_venda(self, chave_cfe, dados_cancelamento):
"""Função ``CancelarUltimaVenda`` conforme ER SAT, item 6.1.4. Envia o
CF-e de cancelamento para o equipamento SAT, que o enviará para
autorização e cancelamento do CF-e pela SEFAZ.
:param chave_cfe: String contendo a chave... | def cancelar_ultima_venda(self, chave_cfe, dados_cancelamento):
"""Função ``CancelarUltimaVenda`` conforme ER SAT, item 6.1.4. Envia o
CF-e de cancelamento para o equipamento SAT, que o enviará para
autorização e cancelamento do CF-e pela SEFAZ.
:param chave_cfe: String contendo a chave... | [
"Função",
"CancelarUltimaVenda",
"conforme",
"ER",
"SAT",
"item",
"6",
".",
"1",
".",
"4",
".",
"Envia",
"o",
"CF",
"-",
"e",
"de",
"cancelamento",
"para",
"o",
"equipamento",
"SAT",
"que",
"o",
"enviará",
"para",
"autorização",
"e",
"cancelamento",
"do",
... | base4sistemas/satcfe | python | https://github.com/base4sistemas/satcfe/blob/cb8e8815f4133d3e3d94cf526fa86767b4521ed9/satcfe/base.py#L326-L347 | [
"def",
"cancelar_ultima_venda",
"(",
"self",
",",
"chave_cfe",
",",
"dados_cancelamento",
")",
":",
"cfe_canc",
"=",
"dados_cancelamento",
"if",
"isinstance",
"(",
"dados_cancelamento",
",",
"basestring",
")",
"else",
"dados_cancelamento",
".",
"documento",
"(",
")"... | cb8e8815f4133d3e3d94cf526fa86767b4521ed9 |
train | FuncoesSAT.consultar_numero_sessao | Função ``ConsultarNumeroSessao`` conforme ER SAT, item 6.1.8.
Consulta o equipamento SAT por um número de sessão específico.
:param int numero_sessao: Número da sessão que se quer consultar.
:return: Retorna *verbatim* a resposta da função SAT.
:rtype: string | satcfe/base.py | def consultar_numero_sessao(self, numero_sessao):
"""Função ``ConsultarNumeroSessao`` conforme ER SAT, item 6.1.8.
Consulta o equipamento SAT por um número de sessão específico.
:param int numero_sessao: Número da sessão que se quer consultar.
:return: Retorna *verbatim* a resposta da ... | def consultar_numero_sessao(self, numero_sessao):
"""Função ``ConsultarNumeroSessao`` conforme ER SAT, item 6.1.8.
Consulta o equipamento SAT por um número de sessão específico.
:param int numero_sessao: Número da sessão que se quer consultar.
:return: Retorna *verbatim* a resposta da ... | [
"Função",
"ConsultarNumeroSessao",
"conforme",
"ER",
"SAT",
"item",
"6",
".",
"1",
".",
"8",
".",
"Consulta",
"o",
"equipamento",
"SAT",
"por",
"um",
"número",
"de",
"sessão",
"específico",
"."
] | base4sistemas/satcfe | python | https://github.com/base4sistemas/satcfe/blob/cb8e8815f4133d3e3d94cf526fa86767b4521ed9/satcfe/base.py#L389-L399 | [
"def",
"consultar_numero_sessao",
"(",
"self",
",",
"numero_sessao",
")",
":",
"return",
"self",
".",
"invocar__ConsultarNumeroSessao",
"(",
"self",
".",
"gerar_numero_sessao",
"(",
")",
",",
"self",
".",
"_codigo_ativacao",
",",
"numero_sessao",
")"
] | cb8e8815f4133d3e3d94cf526fa86767b4521ed9 |
train | FuncoesSAT.configurar_interface_de_rede | Função ``ConfigurarInterfaceDeRede`` conforme ER SAT, item 6.1.9.
Configurção da interface de comunicação do equipamento SAT.
:param configuracao: Instância de :class:`~satcfe.rede.ConfiguracaoRede`
ou uma string contendo o XML com as configurações de rede.
:return: Retorna *verbat... | satcfe/base.py | def configurar_interface_de_rede(self, configuracao):
"""Função ``ConfigurarInterfaceDeRede`` conforme ER SAT, item 6.1.9.
Configurção da interface de comunicação do equipamento SAT.
:param configuracao: Instância de :class:`~satcfe.rede.ConfiguracaoRede`
ou uma string contendo o XM... | def configurar_interface_de_rede(self, configuracao):
"""Função ``ConfigurarInterfaceDeRede`` conforme ER SAT, item 6.1.9.
Configurção da interface de comunicação do equipamento SAT.
:param configuracao: Instância de :class:`~satcfe.rede.ConfiguracaoRede`
ou uma string contendo o XM... | [
"Função",
"ConfigurarInterfaceDeRede",
"conforme",
"ER",
"SAT",
"item",
"6",
".",
"1",
".",
"9",
".",
"Configurção",
"da",
"interface",
"de",
"comunicação",
"do",
"equipamento",
"SAT",
"."
] | base4sistemas/satcfe | python | https://github.com/base4sistemas/satcfe/blob/cb8e8815f4133d3e3d94cf526fa86767b4521ed9/satcfe/base.py#L402-L417 | [
"def",
"configurar_interface_de_rede",
"(",
"self",
",",
"configuracao",
")",
":",
"conf_xml",
"=",
"configuracao",
"if",
"isinstance",
"(",
"configuracao",
",",
"basestring",
")",
"else",
"configuracao",
".",
"documento",
"(",
")",
"return",
"self",
".",
"invoc... | cb8e8815f4133d3e3d94cf526fa86767b4521ed9 |
train | FuncoesSAT.associar_assinatura | Função ``AssociarAssinatura`` conforme ER SAT, item 6.1.10.
Associação da assinatura do aplicativo comercial.
:param sequencia_cnpj: Sequência string de 28 dígitos composta do CNPJ
do desenvolvedor da AC e do CNPJ do estabelecimento comercial
contribuinte, conforme ER SAT, item ... | satcfe/base.py | def associar_assinatura(self, sequencia_cnpj, assinatura_ac):
"""Função ``AssociarAssinatura`` conforme ER SAT, item 6.1.10.
Associação da assinatura do aplicativo comercial.
:param sequencia_cnpj: Sequência string de 28 dígitos composta do CNPJ
do desenvolvedor da AC e do CNPJ do e... | def associar_assinatura(self, sequencia_cnpj, assinatura_ac):
"""Função ``AssociarAssinatura`` conforme ER SAT, item 6.1.10.
Associação da assinatura do aplicativo comercial.
:param sequencia_cnpj: Sequência string de 28 dígitos composta do CNPJ
do desenvolvedor da AC e do CNPJ do e... | [
"Função",
"AssociarAssinatura",
"conforme",
"ER",
"SAT",
"item",
"6",
".",
"1",
".",
"10",
".",
"Associação",
"da",
"assinatura",
"do",
"aplicativo",
"comercial",
"."
] | base4sistemas/satcfe | python | https://github.com/base4sistemas/satcfe/blob/cb8e8815f4133d3e3d94cf526fa86767b4521ed9/satcfe/base.py#L420-L436 | [
"def",
"associar_assinatura",
"(",
"self",
",",
"sequencia_cnpj",
",",
"assinatura_ac",
")",
":",
"return",
"self",
".",
"invocar__AssociarAssinatura",
"(",
"self",
".",
"gerar_numero_sessao",
"(",
")",
",",
"self",
".",
"_codigo_ativacao",
",",
"sequencia_cnpj",
... | cb8e8815f4133d3e3d94cf526fa86767b4521ed9 |
train | FuncoesSAT.trocar_codigo_de_ativacao | Função ``TrocarCodigoDeAtivacao`` conforme ER SAT, item 6.1.15.
Troca do código de ativação do equipamento SAT.
:param str novo_codigo_ativacao: O novo código de ativação escolhido
pelo contribuinte.
:param int opcao: Indica se deverá ser utilizado o código de ativação
... | satcfe/base.py | def trocar_codigo_de_ativacao(self, novo_codigo_ativacao,
opcao=constantes.CODIGO_ATIVACAO_REGULAR,
codigo_emergencia=None):
"""Função ``TrocarCodigoDeAtivacao`` conforme ER SAT, item 6.1.15.
Troca do código de ativação do equipamento SAT.
:param str novo_codigo_ativacao... | def trocar_codigo_de_ativacao(self, novo_codigo_ativacao,
opcao=constantes.CODIGO_ATIVACAO_REGULAR,
codigo_emergencia=None):
"""Função ``TrocarCodigoDeAtivacao`` conforme ER SAT, item 6.1.15.
Troca do código de ativação do equipamento SAT.
:param str novo_codigo_ativacao... | [
"Função",
"TrocarCodigoDeAtivacao",
"conforme",
"ER",
"SAT",
"item",
"6",
".",
"1",
".",
"15",
".",
"Troca",
"do",
"código",
"de",
"ativação",
"do",
"equipamento",
"SAT",
"."
] | base4sistemas/satcfe | python | https://github.com/base4sistemas/satcfe/blob/cb8e8815f4133d3e3d94cf526fa86767b4521ed9/satcfe/base.py#L483-L545 | [
"def",
"trocar_codigo_de_ativacao",
"(",
"self",
",",
"novo_codigo_ativacao",
",",
"opcao",
"=",
"constantes",
".",
"CODIGO_ATIVACAO_REGULAR",
",",
"codigo_emergencia",
"=",
"None",
")",
":",
"if",
"not",
"novo_codigo_ativacao",
":",
"raise",
"ValueError",
"(",
"'No... | cb8e8815f4133d3e3d94cf526fa86767b4521ed9 |
train | ObjectEvaluator.load_forecasts | Loads the forecast files and gathers the forecast information into pandas DataFrames. | hagelslag/evaluation/ObjectEvaluator.py | def load_forecasts(self):
"""
Loads the forecast files and gathers the forecast information into pandas DataFrames.
"""
forecast_path = self.forecast_json_path + "/{0}/{1}/".format(self.run_date.strftime("%Y%m%d"),
self... | def load_forecasts(self):
"""
Loads the forecast files and gathers the forecast information into pandas DataFrames.
"""
forecast_path = self.forecast_json_path + "/{0}/{1}/".format(self.run_date.strftime("%Y%m%d"),
self... | [
"Loads",
"the",
"forecast",
"files",
"and",
"gathers",
"the",
"forecast",
"information",
"into",
"pandas",
"DataFrames",
"."
] | djgagne/hagelslag | python | https://github.com/djgagne/hagelslag/blob/6fb6c3df90bf4867e13a97d3460b14471d107df1/hagelslag/evaluation/ObjectEvaluator.py#L62-L87 | [
"def",
"load_forecasts",
"(",
"self",
")",
":",
"forecast_path",
"=",
"self",
".",
"forecast_json_path",
"+",
"\"/{0}/{1}/\"",
".",
"format",
"(",
"self",
".",
"run_date",
".",
"strftime",
"(",
"\"%Y%m%d\"",
")",
",",
"self",
".",
"ensemble_member",
")",
"fo... | 6fb6c3df90bf4867e13a97d3460b14471d107df1 |
train | ObjectEvaluator.load_obs | Loads the track total and step files and merges the information into a single data frame. | hagelslag/evaluation/ObjectEvaluator.py | def load_obs(self):
"""
Loads the track total and step files and merges the information into a single data frame.
"""
track_total_file = self.track_data_csv_path + \
"track_total_{0}_{1}_{2}.csv".format(self.ensemble_name,
self... | def load_obs(self):
"""
Loads the track total and step files and merges the information into a single data frame.
"""
track_total_file = self.track_data_csv_path + \
"track_total_{0}_{1}_{2}.csv".format(self.ensemble_name,
self... | [
"Loads",
"the",
"track",
"total",
"and",
"step",
"files",
"and",
"merges",
"the",
"information",
"into",
"a",
"single",
"data",
"frame",
"."
] | djgagne/hagelslag | python | https://github.com/djgagne/hagelslag/blob/6fb6c3df90bf4867e13a97d3460b14471d107df1/hagelslag/evaluation/ObjectEvaluator.py#L89-L106 | [
"def",
"load_obs",
"(",
"self",
")",
":",
"track_total_file",
"=",
"self",
".",
"track_data_csv_path",
"+",
"\"track_total_{0}_{1}_{2}.csv\"",
".",
"format",
"(",
"self",
".",
"ensemble_name",
",",
"self",
".",
"ensemble_member",
",",
"self",
".",
"run_date",
".... | 6fb6c3df90bf4867e13a97d3460b14471d107df1 |
train | ObjectEvaluator.merge_obs | Match forecasts and observations. | hagelslag/evaluation/ObjectEvaluator.py | def merge_obs(self):
"""
Match forecasts and observations.
"""
for model_type in self.model_types:
self.matched_forecasts[model_type] = {}
for model_name in self.model_names[model_type]:
self.matched_forecasts[model_type][model_name] = pd.merge(sel... | def merge_obs(self):
"""
Match forecasts and observations.
"""
for model_type in self.model_types:
self.matched_forecasts[model_type] = {}
for model_name in self.model_names[model_type]:
self.matched_forecasts[model_type][model_name] = pd.merge(sel... | [
"Match",
"forecasts",
"and",
"observations",
"."
] | djgagne/hagelslag | python | https://github.com/djgagne/hagelslag/blob/6fb6c3df90bf4867e13a97d3460b14471d107df1/hagelslag/evaluation/ObjectEvaluator.py#L108-L117 | [
"def",
"merge_obs",
"(",
"self",
")",
":",
"for",
"model_type",
"in",
"self",
".",
"model_types",
":",
"self",
".",
"matched_forecasts",
"[",
"model_type",
"]",
"=",
"{",
"}",
"for",
"model_name",
"in",
"self",
".",
"model_names",
"[",
"model_type",
"]",
... | 6fb6c3df90bf4867e13a97d3460b14471d107df1 |
train | ObjectEvaluator.crps | Calculates the cumulative ranked probability score (CRPS) on the forecast data.
Args:
model_type: model type being evaluated.
model_name: machine learning model being evaluated.
condition_model_name: Name of the hail/no-hail model being evaluated
condition_thresh... | hagelslag/evaluation/ObjectEvaluator.py | def crps(self, model_type, model_name, condition_model_name, condition_threshold, query=None):
"""
Calculates the cumulative ranked probability score (CRPS) on the forecast data.
Args:
model_type: model type being evaluated.
model_name: machine learning model being evalu... | def crps(self, model_type, model_name, condition_model_name, condition_threshold, query=None):
"""
Calculates the cumulative ranked probability score (CRPS) on the forecast data.
Args:
model_type: model type being evaluated.
model_name: machine learning model being evalu... | [
"Calculates",
"the",
"cumulative",
"ranked",
"probability",
"score",
"(",
"CRPS",
")",
"on",
"the",
"forecast",
"data",
"."
] | djgagne/hagelslag | python | https://github.com/djgagne/hagelslag/blob/6fb6c3df90bf4867e13a97d3460b14471d107df1/hagelslag/evaluation/ObjectEvaluator.py#L119-L168 | [
"def",
"crps",
"(",
"self",
",",
"model_type",
",",
"model_name",
",",
"condition_model_name",
",",
"condition_threshold",
",",
"query",
"=",
"None",
")",
":",
"def",
"gamma_cdf",
"(",
"x",
",",
"a",
",",
"loc",
",",
"b",
")",
":",
"if",
"a",
"==",
"... | 6fb6c3df90bf4867e13a97d3460b14471d107df1 |
train | ObjectEvaluator.roc | Calculates a ROC curve at a specified intensity threshold.
Args:
model_type: type of model being evaluated (e.g. size).
model_name: machine learning model being evaluated
intensity_threshold: forecast bin used as the split point for evaluation
prob_thresholds: Ar... | hagelslag/evaluation/ObjectEvaluator.py | def roc(self, model_type, model_name, intensity_threshold, prob_thresholds, query=None):
"""
Calculates a ROC curve at a specified intensity threshold.
Args:
model_type: type of model being evaluated (e.g. size).
model_name: machine learning model being evaluated
... | def roc(self, model_type, model_name, intensity_threshold, prob_thresholds, query=None):
"""
Calculates a ROC curve at a specified intensity threshold.
Args:
model_type: type of model being evaluated (e.g. size).
model_name: machine learning model being evaluated
... | [
"Calculates",
"a",
"ROC",
"curve",
"at",
"a",
"specified",
"intensity",
"threshold",
"."
] | djgagne/hagelslag | python | https://github.com/djgagne/hagelslag/blob/6fb6c3df90bf4867e13a97d3460b14471d107df1/hagelslag/evaluation/ObjectEvaluator.py#L170-L207 | [
"def",
"roc",
"(",
"self",
",",
"model_type",
",",
"model_name",
",",
"intensity_threshold",
",",
"prob_thresholds",
",",
"query",
"=",
"None",
")",
":",
"roc_obj",
"=",
"DistributedROC",
"(",
"prob_thresholds",
",",
"0.5",
")",
"if",
"query",
"is",
"not",
... | 6fb6c3df90bf4867e13a97d3460b14471d107df1 |
train | ObjectEvaluator.sample_forecast_max_hail | Samples every forecast hail object and returns an empirical distribution of possible maximum hail sizes.
Hail sizes are sampled from each predicted gamma distribution. The total number of samples equals
num_samples * area of the hail object. To get the maximum hail size for each realization, the maximu... | hagelslag/evaluation/ObjectEvaluator.py | def sample_forecast_max_hail(self, dist_model_name, condition_model_name,
num_samples, condition_threshold=0.5, query=None):
"""
Samples every forecast hail object and returns an empirical distribution of possible maximum hail sizes.
Hail sizes are sampled from ... | def sample_forecast_max_hail(self, dist_model_name, condition_model_name,
num_samples, condition_threshold=0.5, query=None):
"""
Samples every forecast hail object and returns an empirical distribution of possible maximum hail sizes.
Hail sizes are sampled from ... | [
"Samples",
"every",
"forecast",
"hail",
"object",
"and",
"returns",
"an",
"empirical",
"distribution",
"of",
"possible",
"maximum",
"hail",
"sizes",
"."
] | djgagne/hagelslag | python | https://github.com/djgagne/hagelslag/blob/6fb6c3df90bf4867e13a97d3460b14471d107df1/hagelslag/evaluation/ObjectEvaluator.py#L248-L282 | [
"def",
"sample_forecast_max_hail",
"(",
"self",
",",
"dist_model_name",
",",
"condition_model_name",
",",
"num_samples",
",",
"condition_threshold",
"=",
"0.5",
",",
"query",
"=",
"None",
")",
":",
"if",
"query",
"is",
"not",
"None",
":",
"dist_forecasts",
"=",
... | 6fb6c3df90bf4867e13a97d3460b14471d107df1 |
train | Widget.get_params | Get signature and params | paymentwall/widget.py | def get_params(self):
"""Get signature and params
"""
params = {
'key': self.get_app_key(),
'uid': self.user_id,
'widget': self.widget_code
}
products_number = len(self.products)
if self.get_api_type() == self.API_GOODS:
... | def get_params(self):
"""Get signature and params
"""
params = {
'key': self.get_app_key(),
'uid': self.user_id,
'widget': self.widget_code
}
products_number = len(self.products)
if self.get_api_type() == self.API_GOODS:
... | [
"Get",
"signature",
"and",
"params"
] | paymentwall/paymentwall-python | python | https://github.com/paymentwall/paymentwall-python/blob/5f65cb4460074787bbf75b8f276ace5ca8480d17/paymentwall/widget.py#L25-L95 | [
"def",
"get_params",
"(",
"self",
")",
":",
"params",
"=",
"{",
"'key'",
":",
"self",
".",
"get_app_key",
"(",
")",
",",
"'uid'",
":",
"self",
".",
"user_id",
",",
"'widget'",
":",
"self",
".",
"widget_code",
"}",
"products_number",
"=",
"len",
"(",
... | 5f65cb4460074787bbf75b8f276ace5ca8480d17 |
train | hms | Retorna o número de horas, minutos e segundos a partir do total de
segundos informado.
.. sourcecode:: python
>>> hms(1)
(0, 0, 1)
>>> hms(60)
(0, 1, 0)
>>> hms(3600)
(1, 0, 0)
>>> hms(3601)
(1, 0, 1)
>>> hms(3661)
(1, 1, 1)
... | satcfe/util.py | def hms(segundos): # TODO: mover para util.py
"""
Retorna o número de horas, minutos e segundos a partir do total de
segundos informado.
.. sourcecode:: python
>>> hms(1)
(0, 0, 1)
>>> hms(60)
(0, 1, 0)
>>> hms(3600)
(1, 0, 0)
>>> hms(3601)
... | def hms(segundos): # TODO: mover para util.py
"""
Retorna o número de horas, minutos e segundos a partir do total de
segundos informado.
.. sourcecode:: python
>>> hms(1)
(0, 0, 1)
>>> hms(60)
(0, 1, 0)
>>> hms(3600)
(1, 0, 0)
>>> hms(3601)
... | [
"Retorna",
"o",
"número",
"de",
"horas",
"minutos",
"e",
"segundos",
"a",
"partir",
"do",
"total",
"de",
"segundos",
"informado",
"."
] | base4sistemas/satcfe | python | https://github.com/base4sistemas/satcfe/blob/cb8e8815f4133d3e3d94cf526fa86767b4521ed9/satcfe/util.py#L166-L199 | [
"def",
"hms",
"(",
"segundos",
")",
":",
"# TODO: mover para util.py",
"h",
"=",
"(",
"segundos",
"/",
"3600",
")",
"m",
"=",
"(",
"segundos",
"-",
"(",
"3600",
"*",
"h",
")",
")",
"/",
"60",
"s",
"=",
"(",
"segundos",
"-",
"(",
"3600",
"*",
"h",... | cb8e8815f4133d3e3d94cf526fa86767b4521ed9 |
train | hms_humanizado | Retorna um texto legível que descreve o total de horas, minutos e segundos
calculados a partir do total de segundos informados.
.. sourcecode:: python
>>> hms_humanizado(0)
'zero segundos'
>>> hms_humanizado(1)
'1 segundo'
>>> hms_humanizado(2)
'2 segundos'
... | satcfe/util.py | def hms_humanizado(segundos): # TODO: mover para util.py
"""
Retorna um texto legível que descreve o total de horas, minutos e segundos
calculados a partir do total de segundos informados.
.. sourcecode:: python
>>> hms_humanizado(0)
'zero segundos'
>>> hms_humanizado(1)
... | def hms_humanizado(segundos): # TODO: mover para util.py
"""
Retorna um texto legível que descreve o total de horas, minutos e segundos
calculados a partir do total de segundos informados.
.. sourcecode:: python
>>> hms_humanizado(0)
'zero segundos'
>>> hms_humanizado(1)
... | [
"Retorna",
"um",
"texto",
"legível",
"que",
"descreve",
"o",
"total",
"de",
"horas",
"minutos",
"e",
"segundos",
"calculados",
"a",
"partir",
"do",
"total",
"de",
"segundos",
"informados",
"."
] | base4sistemas/satcfe | python | https://github.com/base4sistemas/satcfe/blob/cb8e8815f4133d3e3d94cf526fa86767b4521ed9/satcfe/util.py#L202-L245 | [
"def",
"hms_humanizado",
"(",
"segundos",
")",
":",
"# TODO: mover para util.py",
"p",
"=",
"lambda",
"n",
",",
"s",
",",
"p",
":",
"p",
"if",
"n",
">",
"1",
"else",
"s",
"h",
",",
"m",
",",
"s",
"=",
"hms",
"(",
"segundos",
")",
"tokens",
"=",
"... | cb8e8815f4133d3e3d94cf526fa86767b4521ed9 |
train | ModelGrid.format_grib_name | Assigns name to grib2 message number with name 'unknown'. Names based on NOAA grib2 abbreviations.
Args:
selected_variable(str): name of selected variable for loading
Names:
3: LCDC: Low Cloud Cover
4: MCDC: Medium Cloud Cover
5: HCDC: High Cloud Cover
... | hagelslag/data/HREFv2ModelGrid.py | def format_grib_name(self, selected_variable):
"""
Assigns name to grib2 message number with name 'unknown'. Names based on NOAA grib2 abbreviations.
Args:
selected_variable(str): name of selected variable for loading
Names:
3: LCDC: Low Cloud Cover
4:... | def format_grib_name(self, selected_variable):
"""
Assigns name to grib2 message number with name 'unknown'. Names based on NOAA grib2 abbreviations.
Args:
selected_variable(str): name of selected variable for loading
Names:
3: LCDC: Low Cloud Cover
4:... | [
"Assigns",
"name",
"to",
"grib2",
"message",
"number",
"with",
"name",
"unknown",
".",
"Names",
"based",
"on",
"NOAA",
"grib2",
"abbreviations",
".",
"Args",
":",
"selected_variable",
"(",
"str",
")",
":",
"name",
"of",
"selected",
"variable",
"for",
"loadin... | djgagne/hagelslag | python | https://github.com/djgagne/hagelslag/blob/6fb6c3df90bf4867e13a97d3460b14471d107df1/hagelslag/data/HREFv2ModelGrid.py#L70-L101 | [
"def",
"format_grib_name",
"(",
"self",
",",
"selected_variable",
")",
":",
"names",
"=",
"self",
".",
"unknown_names",
"units",
"=",
"self",
".",
"unknown_units",
"for",
"key",
",",
"value",
"in",
"names",
".",
"items",
"(",
")",
":",
"if",
"selected_vari... | 6fb6c3df90bf4867e13a97d3460b14471d107df1 |
train | ModelGrid.load_data | Loads data from grib2 file objects or list of grib2 file objects. Handles specific grib2 variable names
and grib2 message numbers.
Returns:
Array of data loaded from files in (time, y, x) dimensions, Units | hagelslag/data/HREFv2ModelGrid.py | def load_data(self):
"""
Loads data from grib2 file objects or list of grib2 file objects. Handles specific grib2 variable names
and grib2 message numbers.
Returns:
Array of data loaded from files in (time, y, x) dimensions, Units
"""
file_... | def load_data(self):
"""
Loads data from grib2 file objects or list of grib2 file objects. Handles specific grib2 variable names
and grib2 message numbers.
Returns:
Array of data loaded from files in (time, y, x) dimensions, Units
"""
file_... | [
"Loads",
"data",
"from",
"grib2",
"file",
"objects",
"or",
"list",
"of",
"grib2",
"file",
"objects",
".",
"Handles",
"specific",
"grib2",
"variable",
"names",
"and",
"grib2",
"message",
"numbers",
".",
"Returns",
":",
"Array",
"of",
"data",
"loaded",
"from",... | djgagne/hagelslag | python | https://github.com/djgagne/hagelslag/blob/6fb6c3df90bf4867e13a97d3460b14471d107df1/hagelslag/data/HREFv2ModelGrid.py#L103-L187 | [
"def",
"load_data",
"(",
"self",
")",
":",
"file_objects",
"=",
"self",
".",
"file_objects",
"var",
"=",
"self",
".",
"variable",
"valid_date",
"=",
"self",
".",
"valid_dates",
"data",
"=",
"self",
".",
"data",
"unknown_names",
"=",
"self",
".",
"unknown_n... | 6fb6c3df90bf4867e13a97d3460b14471d107df1 |
train | GridEvaluator.load_forecasts | Load the forecast files into memory. | hagelslag/evaluation/GridEvaluator.py | def load_forecasts(self):
"""
Load the forecast files into memory.
"""
run_date_str = self.run_date.strftime("%Y%m%d")
for model_name in self.model_names:
self.raw_forecasts[model_name] = {}
forecast_file = self.forecast_path + run_date_str + "/" + \
... | def load_forecasts(self):
"""
Load the forecast files into memory.
"""
run_date_str = self.run_date.strftime("%Y%m%d")
for model_name in self.model_names:
self.raw_forecasts[model_name] = {}
forecast_file = self.forecast_path + run_date_str + "/" + \
... | [
"Load",
"the",
"forecast",
"files",
"into",
"memory",
"."
] | djgagne/hagelslag | python | https://github.com/djgagne/hagelslag/blob/6fb6c3df90bf4867e13a97d3460b14471d107df1/hagelslag/evaluation/GridEvaluator.py#L77-L92 | [
"def",
"load_forecasts",
"(",
"self",
")",
":",
"run_date_str",
"=",
"self",
".",
"run_date",
".",
"strftime",
"(",
"\"%Y%m%d\"",
")",
"for",
"model_name",
"in",
"self",
".",
"model_names",
":",
"self",
".",
"raw_forecasts",
"[",
"model_name",
"]",
"=",
"{... | 6fb6c3df90bf4867e13a97d3460b14471d107df1 |
train | GridEvaluator.get_window_forecasts | Aggregate the forecasts within the specified time windows. | hagelslag/evaluation/GridEvaluator.py | def get_window_forecasts(self):
"""
Aggregate the forecasts within the specified time windows.
"""
for model_name in self.model_names:
self.window_forecasts[model_name] = {}
for size_threshold in self.size_thresholds:
self.window_forecasts[model_na... | def get_window_forecasts(self):
"""
Aggregate the forecasts within the specified time windows.
"""
for model_name in self.model_names:
self.window_forecasts[model_name] = {}
for size_threshold in self.size_thresholds:
self.window_forecasts[model_na... | [
"Aggregate",
"the",
"forecasts",
"within",
"the",
"specified",
"time",
"windows",
"."
] | djgagne/hagelslag | python | https://github.com/djgagne/hagelslag/blob/6fb6c3df90bf4867e13a97d3460b14471d107df1/hagelslag/evaluation/GridEvaluator.py#L94-L103 | [
"def",
"get_window_forecasts",
"(",
"self",
")",
":",
"for",
"model_name",
"in",
"self",
".",
"model_names",
":",
"self",
".",
"window_forecasts",
"[",
"model_name",
"]",
"=",
"{",
"}",
"for",
"size_threshold",
"in",
"self",
".",
"size_thresholds",
":",
"sel... | 6fb6c3df90bf4867e13a97d3460b14471d107df1 |
train | GridEvaluator.load_obs | Loads observations and masking grid (if needed).
:param mask_threshold: Values greater than the threshold are kept, others are masked.
:return: | hagelslag/evaluation/GridEvaluator.py | def load_obs(self, mask_threshold=0.5):
"""
Loads observations and masking grid (if needed).
:param mask_threshold: Values greater than the threshold are kept, others are masked.
:return:
"""
start_date = self.run_date + timedelta(hours=self.start_hour)
end_date... | def load_obs(self, mask_threshold=0.5):
"""
Loads observations and masking grid (if needed).
:param mask_threshold: Values greater than the threshold are kept, others are masked.
:return:
"""
start_date = self.run_date + timedelta(hours=self.start_hour)
end_date... | [
"Loads",
"observations",
"and",
"masking",
"grid",
"(",
"if",
"needed",
")",
"."
] | djgagne/hagelslag | python | https://github.com/djgagne/hagelslag/blob/6fb6c3df90bf4867e13a97d3460b14471d107df1/hagelslag/evaluation/GridEvaluator.py#L105-L125 | [
"def",
"load_obs",
"(",
"self",
",",
"mask_threshold",
"=",
"0.5",
")",
":",
"start_date",
"=",
"self",
".",
"run_date",
"+",
"timedelta",
"(",
"hours",
"=",
"self",
".",
"start_hour",
")",
"end_date",
"=",
"self",
".",
"run_date",
"+",
"timedelta",
"(",... | 6fb6c3df90bf4867e13a97d3460b14471d107df1 |
train | GridEvaluator.dilate_obs | Use a dilation filter to grow positive observation areas by a specified number of grid points
:param dilation_radius: Number of times to dilate the grid.
:return: | hagelslag/evaluation/GridEvaluator.py | def dilate_obs(self, dilation_radius):
"""
Use a dilation filter to grow positive observation areas by a specified number of grid points
:param dilation_radius: Number of times to dilate the grid.
:return:
"""
for s in self.size_thresholds:
self.dilated_obs[s... | def dilate_obs(self, dilation_radius):
"""
Use a dilation filter to grow positive observation areas by a specified number of grid points
:param dilation_radius: Number of times to dilate the grid.
:return:
"""
for s in self.size_thresholds:
self.dilated_obs[s... | [
"Use",
"a",
"dilation",
"filter",
"to",
"grow",
"positive",
"observation",
"areas",
"by",
"a",
"specified",
"number",
"of",
"grid",
"points"
] | djgagne/hagelslag | python | https://github.com/djgagne/hagelslag/blob/6fb6c3df90bf4867e13a97d3460b14471d107df1/hagelslag/evaluation/GridEvaluator.py#L127-L137 | [
"def",
"dilate_obs",
"(",
"self",
",",
"dilation_radius",
")",
":",
"for",
"s",
"in",
"self",
".",
"size_thresholds",
":",
"self",
".",
"dilated_obs",
"[",
"s",
"]",
"=",
"np",
".",
"zeros",
"(",
"self",
".",
"window_obs",
"[",
"self",
".",
"mrms_varia... | 6fb6c3df90bf4867e13a97d3460b14471d107df1 |
train | GridEvaluator.roc_curves | Generate ROC Curve objects for each machine learning model, size threshold, and time window.
:param prob_thresholds: Probability thresholds for the ROC Curve
:param dilation_radius: Number of times to dilate the observation grid.
:return: a dictionary of DistributedROC objects. | hagelslag/evaluation/GridEvaluator.py | def roc_curves(self, prob_thresholds):
"""
Generate ROC Curve objects for each machine learning model, size threshold, and time window.
:param prob_thresholds: Probability thresholds for the ROC Curve
:param dilation_radius: Number of times to dilate the observation grid.
:retur... | def roc_curves(self, prob_thresholds):
"""
Generate ROC Curve objects for each machine learning model, size threshold, and time window.
:param prob_thresholds: Probability thresholds for the ROC Curve
:param dilation_radius: Number of times to dilate the observation grid.
:retur... | [
"Generate",
"ROC",
"Curve",
"objects",
"for",
"each",
"machine",
"learning",
"model",
"size",
"threshold",
"and",
"time",
"window",
"."
] | djgagne/hagelslag | python | https://github.com/djgagne/hagelslag/blob/6fb6c3df90bf4867e13a97d3460b14471d107df1/hagelslag/evaluation/GridEvaluator.py#L139-L167 | [
"def",
"roc_curves",
"(",
"self",
",",
"prob_thresholds",
")",
":",
"all_roc_curves",
"=",
"{",
"}",
"for",
"model_name",
"in",
"self",
".",
"model_names",
":",
"all_roc_curves",
"[",
"model_name",
"]",
"=",
"{",
"}",
"for",
"size_threshold",
"in",
"self",
... | 6fb6c3df90bf4867e13a97d3460b14471d107df1 |
train | GridEvaluator.reliability_curves | Output reliability curves for each machine learning model, size threshold, and time window.
:param prob_thresholds:
:param dilation_radius:
:return: | hagelslag/evaluation/GridEvaluator.py | def reliability_curves(self, prob_thresholds):
"""
Output reliability curves for each machine learning model, size threshold, and time window.
:param prob_thresholds:
:param dilation_radius:
:return:
"""
all_rel_curves = {}
for model_name in self.model_na... | def reliability_curves(self, prob_thresholds):
"""
Output reliability curves for each machine learning model, size threshold, and time window.
:param prob_thresholds:
:param dilation_radius:
:return:
"""
all_rel_curves = {}
for model_name in self.model_na... | [
"Output",
"reliability",
"curves",
"for",
"each",
"machine",
"learning",
"model",
"size",
"threshold",
"and",
"time",
"window",
"."
] | djgagne/hagelslag | python | https://github.com/djgagne/hagelslag/blob/6fb6c3df90bf4867e13a97d3460b14471d107df1/hagelslag/evaluation/GridEvaluator.py#L169-L197 | [
"def",
"reliability_curves",
"(",
"self",
",",
"prob_thresholds",
")",
":",
"all_rel_curves",
"=",
"{",
"}",
"for",
"model_name",
"in",
"self",
".",
"model_names",
":",
"all_rel_curves",
"[",
"model_name",
"]",
"=",
"{",
"}",
"for",
"size_threshold",
"in",
"... | 6fb6c3df90bf4867e13a97d3460b14471d107df1 |
train | load_map_coordinates | Loads map coordinates from netCDF or pickle file created by util.makeMapGrids.
Args:
map_file: Filename for the file containing coordinate information.
Returns:
Latitude and longitude grids as numpy arrays. | hagelslag/util/convert_mrms_grids.py | def load_map_coordinates(map_file):
"""
Loads map coordinates from netCDF or pickle file created by util.makeMapGrids.
Args:
map_file: Filename for the file containing coordinate information.
Returns:
Latitude and longitude grids as numpy arrays.
"""
if map_file[-4:] == ".pkl":... | def load_map_coordinates(map_file):
"""
Loads map coordinates from netCDF or pickle file created by util.makeMapGrids.
Args:
map_file: Filename for the file containing coordinate information.
Returns:
Latitude and longitude grids as numpy arrays.
"""
if map_file[-4:] == ".pkl":... | [
"Loads",
"map",
"coordinates",
"from",
"netCDF",
"or",
"pickle",
"file",
"created",
"by",
"util",
".",
"makeMapGrids",
"."
] | djgagne/hagelslag | python | https://github.com/djgagne/hagelslag/blob/6fb6c3df90bf4867e13a97d3460b14471d107df1/hagelslag/util/convert_mrms_grids.py#L56-L78 | [
"def",
"load_map_coordinates",
"(",
"map_file",
")",
":",
"if",
"map_file",
"[",
"-",
"4",
":",
"]",
"==",
"\".pkl\"",
":",
"map_data",
"=",
"pickle",
".",
"load",
"(",
"open",
"(",
"map_file",
")",
")",
"lon",
"=",
"map_data",
"[",
"'lon'",
"]",
"la... | 6fb6c3df90bf4867e13a97d3460b14471d107df1 |
train | interpolate_mrms_day | For a given day, this module interpolates hourly MRMS data to a specified latitude and
longitude grid, and saves the interpolated grids to CF-compliant netCDF4 files.
Args:
start_date (datetime.datetime): Date of data being interpolated
variable (str): MRMS variable
interp_type (st... | hagelslag/util/convert_mrms_grids.py | def interpolate_mrms_day(start_date, variable, interp_type, mrms_path, map_filename, out_path):
"""
For a given day, this module interpolates hourly MRMS data to a specified latitude and
longitude grid, and saves the interpolated grids to CF-compliant netCDF4 files.
Args:
start_date (datet... | def interpolate_mrms_day(start_date, variable, interp_type, mrms_path, map_filename, out_path):
"""
For a given day, this module interpolates hourly MRMS data to a specified latitude and
longitude grid, and saves the interpolated grids to CF-compliant netCDF4 files.
Args:
start_date (datet... | [
"For",
"a",
"given",
"day",
"this",
"module",
"interpolates",
"hourly",
"MRMS",
"data",
"to",
"a",
"specified",
"latitude",
"and",
"longitude",
"grid",
"and",
"saves",
"the",
"interpolated",
"grids",
"to",
"CF",
"-",
"compliant",
"netCDF4",
"files",
".",
"Ar... | djgagne/hagelslag | python | https://github.com/djgagne/hagelslag/blob/6fb6c3df90bf4867e13a97d3460b14471d107df1/hagelslag/util/convert_mrms_grids.py#L81-L113 | [
"def",
"interpolate_mrms_day",
"(",
"start_date",
",",
"variable",
",",
"interp_type",
",",
"mrms_path",
",",
"map_filename",
",",
"out_path",
")",
":",
"try",
":",
"print",
"(",
"start_date",
",",
"variable",
")",
"end_date",
"=",
"start_date",
"+",
"timedelt... | 6fb6c3df90bf4867e13a97d3460b14471d107df1 |
train | MRMSGrid.load_data | Loads data from MRMS GRIB2 files and handles compression duties if files are compressed. | hagelslag/util/convert_mrms_grids.py | def load_data(self):
"""
Loads data from MRMS GRIB2 files and handles compression duties if files are compressed.
"""
data = []
loaded_dates = []
loaded_indices = []
for t, timestamp in enumerate(self.all_dates):
date_str = timestamp.date().strftime("%... | def load_data(self):
"""
Loads data from MRMS GRIB2 files and handles compression duties if files are compressed.
"""
data = []
loaded_dates = []
loaded_indices = []
for t, timestamp in enumerate(self.all_dates):
date_str = timestamp.date().strftime("%... | [
"Loads",
"data",
"from",
"MRMS",
"GRIB2",
"files",
"and",
"handles",
"compression",
"duties",
"if",
"files",
"are",
"compressed",
"."
] | djgagne/hagelslag | python | https://github.com/djgagne/hagelslag/blob/6fb6c3df90bf4867e13a97d3460b14471d107df1/hagelslag/util/convert_mrms_grids.py#L134-L174 | [
"def",
"load_data",
"(",
"self",
")",
":",
"data",
"=",
"[",
"]",
"loaded_dates",
"=",
"[",
"]",
"loaded_indices",
"=",
"[",
"]",
"for",
"t",
",",
"timestamp",
"in",
"enumerate",
"(",
"self",
".",
"all_dates",
")",
":",
"date_str",
"=",
"timestamp",
... | 6fb6c3df90bf4867e13a97d3460b14471d107df1 |
train | MRMSGrid.interpolate_grid | Interpolates MRMS data to a different grid using cubic bivariate splines | hagelslag/util/convert_mrms_grids.py | def interpolate_grid(self, in_lon, in_lat):
"""
Interpolates MRMS data to a different grid using cubic bivariate splines
"""
out_data = np.zeros((self.data.shape[0], in_lon.shape[0], in_lon.shape[1]))
for d in range(self.data.shape[0]):
print("Loading ", d, self.varia... | def interpolate_grid(self, in_lon, in_lat):
"""
Interpolates MRMS data to a different grid using cubic bivariate splines
"""
out_data = np.zeros((self.data.shape[0], in_lon.shape[0], in_lon.shape[1]))
for d in range(self.data.shape[0]):
print("Loading ", d, self.varia... | [
"Interpolates",
"MRMS",
"data",
"to",
"a",
"different",
"grid",
"using",
"cubic",
"bivariate",
"splines"
] | djgagne/hagelslag | python | https://github.com/djgagne/hagelslag/blob/6fb6c3df90bf4867e13a97d3460b14471d107df1/hagelslag/util/convert_mrms_grids.py#L176-L197 | [
"def",
"interpolate_grid",
"(",
"self",
",",
"in_lon",
",",
"in_lat",
")",
":",
"out_data",
"=",
"np",
".",
"zeros",
"(",
"(",
"self",
".",
"data",
".",
"shape",
"[",
"0",
"]",
",",
"in_lon",
".",
"shape",
"[",
"0",
"]",
",",
"in_lon",
".",
"shap... | 6fb6c3df90bf4867e13a97d3460b14471d107df1 |
train | MRMSGrid.max_neighbor | Finds the largest value within a given radius of a point on the interpolated grid.
Args:
in_lon: 2D array of longitude values
in_lat: 2D array of latitude values
radius: radius of influence for largest neighbor search in degrees
Returns:
Array of interpo... | hagelslag/util/convert_mrms_grids.py | def max_neighbor(self, in_lon, in_lat, radius=0.05):
"""
Finds the largest value within a given radius of a point on the interpolated grid.
Args:
in_lon: 2D array of longitude values
in_lat: 2D array of latitude values
radius: radius of influence for largest ... | def max_neighbor(self, in_lon, in_lat, radius=0.05):
"""
Finds the largest value within a given radius of a point on the interpolated grid.
Args:
in_lon: 2D array of longitude values
in_lat: 2D array of latitude values
radius: radius of influence for largest ... | [
"Finds",
"the",
"largest",
"value",
"within",
"a",
"given",
"radius",
"of",
"a",
"point",
"on",
"the",
"interpolated",
"grid",
"."
] | djgagne/hagelslag | python | https://github.com/djgagne/hagelslag/blob/6fb6c3df90bf4867e13a97d3460b14471d107df1/hagelslag/util/convert_mrms_grids.py#L199-L226 | [
"def",
"max_neighbor",
"(",
"self",
",",
"in_lon",
",",
"in_lat",
",",
"radius",
"=",
"0.05",
")",
":",
"out_data",
"=",
"np",
".",
"zeros",
"(",
"(",
"self",
".",
"data",
".",
"shape",
"[",
"0",
"]",
",",
"in_lon",
".",
"shape",
"[",
"0",
"]",
... | 6fb6c3df90bf4867e13a97d3460b14471d107df1 |
train | MRMSGrid.interpolate_to_netcdf | Calls the interpolation function and then saves the MRMS data to a netCDF file. It will also create
separate directories for each variable if they are not already available. | hagelslag/util/convert_mrms_grids.py | def interpolate_to_netcdf(self, in_lon, in_lat, out_path, date_unit="seconds since 1970-01-01T00:00",
interp_type="spline"):
"""
Calls the interpolation function and then saves the MRMS data to a netCDF file. It will also create
separate directories for each variab... | def interpolate_to_netcdf(self, in_lon, in_lat, out_path, date_unit="seconds since 1970-01-01T00:00",
interp_type="spline"):
"""
Calls the interpolation function and then saves the MRMS data to a netCDF file. It will also create
separate directories for each variab... | [
"Calls",
"the",
"interpolation",
"function",
"and",
"then",
"saves",
"the",
"MRMS",
"data",
"to",
"a",
"netCDF",
"file",
".",
"It",
"will",
"also",
"create",
"separate",
"directories",
"for",
"each",
"variable",
"if",
"they",
"are",
"not",
"already",
"availa... | djgagne/hagelslag | python | https://github.com/djgagne/hagelslag/blob/6fb6c3df90bf4867e13a97d3460b14471d107df1/hagelslag/util/convert_mrms_grids.py#L228-L276 | [
"def",
"interpolate_to_netcdf",
"(",
"self",
",",
"in_lon",
",",
"in_lat",
",",
"out_path",
",",
"date_unit",
"=",
"\"seconds since 1970-01-01T00:00\"",
",",
"interp_type",
"=",
"\"spline\"",
")",
":",
"if",
"interp_type",
"==",
"\"spline\"",
":",
"out_data",
"=",... | 6fb6c3df90bf4867e13a97d3460b14471d107df1 |
train | get_data_generator_by_id | Return a generator for data.
:param bool sync: whether to wait for current frame to finish then collect next frame
NOTE: a new ndarray is created for each call. | nion/swift/model/HardwareSource.py | def get_data_generator_by_id(hardware_source_id, sync=True):
"""
Return a generator for data.
:param bool sync: whether to wait for current frame to finish then collect next frame
NOTE: a new ndarray is created for each call.
"""
hardware_source = HardwareSourceManager().get_hardwa... | def get_data_generator_by_id(hardware_source_id, sync=True):
"""
Return a generator for data.
:param bool sync: whether to wait for current frame to finish then collect next frame
NOTE: a new ndarray is created for each call.
"""
hardware_source = HardwareSourceManager().get_hardwa... | [
"Return",
"a",
"generator",
"for",
"data",
"."
] | nion-software/nionswift | python | https://github.com/nion-software/nionswift/blob/d43693eaf057b8683b9638e575000f055fede452/nion/swift/model/HardwareSource.py#L1053-L1064 | [
"def",
"get_data_generator_by_id",
"(",
"hardware_source_id",
",",
"sync",
"=",
"True",
")",
":",
"hardware_source",
"=",
"HardwareSourceManager",
"(",
")",
".",
"get_hardware_source_for_hardware_source_id",
"(",
"hardware_source_id",
")",
"def",
"get_last_data",
"(",
"... | d43693eaf057b8683b9638e575000f055fede452 |
train | parse_hardware_aliases_config_file | Parse config file for aliases and automatically register them.
Returns True if alias file was found and parsed (successfully or unsuccessfully).
Returns False if alias file was not found.
Config file is a standard .ini file with a section | nion/swift/model/HardwareSource.py | def parse_hardware_aliases_config_file(config_path):
"""
Parse config file for aliases and automatically register them.
Returns True if alias file was found and parsed (successfully or unsuccessfully).
Returns False if alias file was not found.
Config file is a standard .ini file ... | def parse_hardware_aliases_config_file(config_path):
"""
Parse config file for aliases and automatically register them.
Returns True if alias file was found and parsed (successfully or unsuccessfully).
Returns False if alias file was not found.
Config file is a standard .ini file ... | [
"Parse",
"config",
"file",
"for",
"aliases",
"and",
"automatically",
"register",
"them",
"."
] | nion-software/nionswift | python | https://github.com/nion-software/nionswift/blob/d43693eaf057b8683b9638e575000f055fede452/nion/swift/model/HardwareSource.py#L1072-L1101 | [
"def",
"parse_hardware_aliases_config_file",
"(",
"config_path",
")",
":",
"if",
"os",
".",
"path",
".",
"exists",
"(",
"config_path",
")",
":",
"logging",
".",
"info",
"(",
"\"Parsing alias file {:s}\"",
".",
"format",
"(",
"config_path",
")",
")",
"try",
":"... | d43693eaf057b8683b9638e575000f055fede452 |
train | HardwareSourceManager.make_instrument_alias | Configure an alias.
Callers can use the alias to refer to the instrument or hardware source.
The alias should be lowercase, no spaces. The display name may be used to display alias to
the user. Neither the original instrument or hardware source id and the alias id should ever
... | nion/swift/model/HardwareSource.py | def make_instrument_alias(self, instrument_id, alias_instrument_id, display_name):
""" Configure an alias.
Callers can use the alias to refer to the instrument or hardware source.
The alias should be lowercase, no spaces. The display name may be used to display alias to
the ... | def make_instrument_alias(self, instrument_id, alias_instrument_id, display_name):
""" Configure an alias.
Callers can use the alias to refer to the instrument or hardware source.
The alias should be lowercase, no spaces. The display name may be used to display alias to
the ... | [
"Configure",
"an",
"alias",
"."
] | nion-software/nionswift | python | https://github.com/nion-software/nionswift/blob/d43693eaf057b8683b9638e575000f055fede452/nion/swift/model/HardwareSource.py#L168-L182 | [
"def",
"make_instrument_alias",
"(",
"self",
",",
"instrument_id",
",",
"alias_instrument_id",
",",
"display_name",
")",
":",
"self",
".",
"__aliases",
"[",
"alias_instrument_id",
"]",
"=",
"(",
"instrument_id",
",",
"display_name",
")",
"for",
"f",
"in",
"self"... | d43693eaf057b8683b9638e575000f055fede452 |
train | DataChannel.update | Called from hardware source when new data arrives. | nion/swift/model/HardwareSource.py | def update(self, data_and_metadata: DataAndMetadata.DataAndMetadata, state: str, sub_area, view_id) -> None:
"""Called from hardware source when new data arrives."""
self.__state = state
self.__sub_area = sub_area
hardware_source_id = self.__hardware_source.hardware_source_id
ch... | def update(self, data_and_metadata: DataAndMetadata.DataAndMetadata, state: str, sub_area, view_id) -> None:
"""Called from hardware source when new data arrives."""
self.__state = state
self.__sub_area = sub_area
hardware_source_id = self.__hardware_source.hardware_source_id
ch... | [
"Called",
"from",
"hardware",
"source",
"when",
"new",
"data",
"arrives",
"."
] | nion-software/nionswift | python | https://github.com/nion-software/nionswift/blob/d43693eaf057b8683b9638e575000f055fede452/nion/swift/model/HardwareSource.py#L487-L536 | [
"def",
"update",
"(",
"self",
",",
"data_and_metadata",
":",
"DataAndMetadata",
".",
"DataAndMetadata",
",",
"state",
":",
"str",
",",
"sub_area",
",",
"view_id",
")",
"->",
"None",
":",
"self",
".",
"__state",
"=",
"state",
"self",
".",
"__sub_area",
"=",... | d43693eaf057b8683b9638e575000f055fede452 |
train | DataChannel.start | Called from hardware source when data starts streaming. | nion/swift/model/HardwareSource.py | def start(self):
"""Called from hardware source when data starts streaming."""
old_start_count = self.__start_count
self.__start_count += 1
if old_start_count == 0:
self.data_channel_start_event.fire() | def start(self):
"""Called from hardware source when data starts streaming."""
old_start_count = self.__start_count
self.__start_count += 1
if old_start_count == 0:
self.data_channel_start_event.fire() | [
"Called",
"from",
"hardware",
"source",
"when",
"data",
"starts",
"streaming",
"."
] | nion-software/nionswift | python | https://github.com/nion-software/nionswift/blob/d43693eaf057b8683b9638e575000f055fede452/nion/swift/model/HardwareSource.py#L538-L543 | [
"def",
"start",
"(",
"self",
")",
":",
"old_start_count",
"=",
"self",
".",
"__start_count",
"self",
".",
"__start_count",
"+=",
"1",
"if",
"old_start_count",
"==",
"0",
":",
"self",
".",
"data_channel_start_event",
".",
"fire",
"(",
")"
] | d43693eaf057b8683b9638e575000f055fede452 |
train | SumProcessor.connect_data_item_reference | Connect to the data item reference, creating a crop graphic if necessary.
If the data item reference does not yet have an associated data item, add a
listener and wait for the data item to be set, then connect. | nion/swift/model/HardwareSource.py | def connect_data_item_reference(self, data_item_reference):
"""Connect to the data item reference, creating a crop graphic if necessary.
If the data item reference does not yet have an associated data item, add a
listener and wait for the data item to be set, then connect.
"""
d... | def connect_data_item_reference(self, data_item_reference):
"""Connect to the data item reference, creating a crop graphic if necessary.
If the data item reference does not yet have an associated data item, add a
listener and wait for the data item to be set, then connect.
"""
d... | [
"Connect",
"to",
"the",
"data",
"item",
"reference",
"creating",
"a",
"crop",
"graphic",
"if",
"necessary",
"."
] | nion-software/nionswift | python | https://github.com/nion-software/nionswift/blob/d43693eaf057b8683b9638e575000f055fede452/nion/swift/model/HardwareSource.py#L1001-L1015 | [
"def",
"connect_data_item_reference",
"(",
"self",
",",
"data_item_reference",
")",
":",
"display_item",
"=",
"data_item_reference",
".",
"display_item",
"data_item",
"=",
"display_item",
".",
"data_item",
"if",
"display_item",
"else",
"None",
"if",
"data_item",
"and"... | d43693eaf057b8683b9638e575000f055fede452 |
train | DataChannelBuffer.grab_earliest | Grab the earliest data from the buffer, blocking until one is available. | nion/swift/model/HardwareSource.py | def grab_earliest(self, timeout: float=None) -> typing.List[DataAndMetadata.DataAndMetadata]:
"""Grab the earliest data from the buffer, blocking until one is available."""
timeout = timeout if timeout is not None else 10.0
with self.__buffer_lock:
if len(self.__buffer) == 0:
... | def grab_earliest(self, timeout: float=None) -> typing.List[DataAndMetadata.DataAndMetadata]:
"""Grab the earliest data from the buffer, blocking until one is available."""
timeout = timeout if timeout is not None else 10.0
with self.__buffer_lock:
if len(self.__buffer) == 0:
... | [
"Grab",
"the",
"earliest",
"data",
"from",
"the",
"buffer",
"blocking",
"until",
"one",
"is",
"available",
"."
] | nion-software/nionswift | python | https://github.com/nion-software/nionswift/blob/d43693eaf057b8683b9638e575000f055fede452/nion/swift/model/HardwareSource.py#L1194-L1206 | [
"def",
"grab_earliest",
"(",
"self",
",",
"timeout",
":",
"float",
"=",
"None",
")",
"->",
"typing",
".",
"List",
"[",
"DataAndMetadata",
".",
"DataAndMetadata",
"]",
":",
"timeout",
"=",
"timeout",
"if",
"timeout",
"is",
"not",
"None",
"else",
"10.0",
"... | d43693eaf057b8683b9638e575000f055fede452 |
train | DataChannelBuffer.grab_next | Grab the next data to finish from the buffer, blocking until one is available. | nion/swift/model/HardwareSource.py | def grab_next(self, timeout: float=None) -> typing.List[DataAndMetadata.DataAndMetadata]:
"""Grab the next data to finish from the buffer, blocking until one is available."""
with self.__buffer_lock:
self.__buffer = list()
return self.grab_latest(timeout) | def grab_next(self, timeout: float=None) -> typing.List[DataAndMetadata.DataAndMetadata]:
"""Grab the next data to finish from the buffer, blocking until one is available."""
with self.__buffer_lock:
self.__buffer = list()
return self.grab_latest(timeout) | [
"Grab",
"the",
"next",
"data",
"to",
"finish",
"from",
"the",
"buffer",
"blocking",
"until",
"one",
"is",
"available",
"."
] | nion-software/nionswift | python | https://github.com/nion-software/nionswift/blob/d43693eaf057b8683b9638e575000f055fede452/nion/swift/model/HardwareSource.py#L1208-L1212 | [
"def",
"grab_next",
"(",
"self",
",",
"timeout",
":",
"float",
"=",
"None",
")",
"->",
"typing",
".",
"List",
"[",
"DataAndMetadata",
".",
"DataAndMetadata",
"]",
":",
"with",
"self",
".",
"__buffer_lock",
":",
"self",
".",
"__buffer",
"=",
"list",
"(",
... | d43693eaf057b8683b9638e575000f055fede452 |
train | DataChannelBuffer.grab_following | Grab the next data to start from the buffer, blocking until one is available. | nion/swift/model/HardwareSource.py | def grab_following(self, timeout: float=None) -> typing.List[DataAndMetadata.DataAndMetadata]:
"""Grab the next data to start from the buffer, blocking until one is available."""
self.grab_next(timeout)
return self.grab_next(timeout) | def grab_following(self, timeout: float=None) -> typing.List[DataAndMetadata.DataAndMetadata]:
"""Grab the next data to start from the buffer, blocking until one is available."""
self.grab_next(timeout)
return self.grab_next(timeout) | [
"Grab",
"the",
"next",
"data",
"to",
"start",
"from",
"the",
"buffer",
"blocking",
"until",
"one",
"is",
"available",
"."
] | nion-software/nionswift | python | https://github.com/nion-software/nionswift/blob/d43693eaf057b8683b9638e575000f055fede452/nion/swift/model/HardwareSource.py#L1214-L1217 | [
"def",
"grab_following",
"(",
"self",
",",
"timeout",
":",
"float",
"=",
"None",
")",
"->",
"typing",
".",
"List",
"[",
"DataAndMetadata",
".",
"DataAndMetadata",
"]",
":",
"self",
".",
"grab_next",
"(",
"timeout",
")",
"return",
"self",
".",
"grab_next",
... | d43693eaf057b8683b9638e575000f055fede452 |
train | DataChannelBuffer.pause | Pause recording.
Thread safe and UI safe. | nion/swift/model/HardwareSource.py | def pause(self) -> None:
"""Pause recording.
Thread safe and UI safe."""
with self.__state_lock:
if self.__state == DataChannelBuffer.State.started:
self.__state = DataChannelBuffer.State.paused | def pause(self) -> None:
"""Pause recording.
Thread safe and UI safe."""
with self.__state_lock:
if self.__state == DataChannelBuffer.State.started:
self.__state = DataChannelBuffer.State.paused | [
"Pause",
"recording",
"."
] | nion-software/nionswift | python | https://github.com/nion-software/nionswift/blob/d43693eaf057b8683b9638e575000f055fede452/nion/swift/model/HardwareSource.py#L1226-L1232 | [
"def",
"pause",
"(",
"self",
")",
"->",
"None",
":",
"with",
"self",
".",
"__state_lock",
":",
"if",
"self",
".",
"__state",
"==",
"DataChannelBuffer",
".",
"State",
".",
"started",
":",
"self",
".",
"__state",
"=",
"DataChannelBuffer",
".",
"State",
"."... | d43693eaf057b8683b9638e575000f055fede452 |
train | DataChannelBuffer.resume | Resume recording after pause.
Thread safe and UI safe. | nion/swift/model/HardwareSource.py | def resume(self) -> None:
"""Resume recording after pause.
Thread safe and UI safe."""
with self.__state_lock:
if self.__state == DataChannelBuffer.State.paused:
self.__state = DataChannelBuffer.State.started | def resume(self) -> None:
"""Resume recording after pause.
Thread safe and UI safe."""
with self.__state_lock:
if self.__state == DataChannelBuffer.State.paused:
self.__state = DataChannelBuffer.State.started | [
"Resume",
"recording",
"after",
"pause",
"."
] | nion-software/nionswift | python | https://github.com/nion-software/nionswift/blob/d43693eaf057b8683b9638e575000f055fede452/nion/swift/model/HardwareSource.py#L1234-L1240 | [
"def",
"resume",
"(",
"self",
")",
"->",
"None",
":",
"with",
"self",
".",
"__state_lock",
":",
"if",
"self",
".",
"__state",
"==",
"DataChannelBuffer",
".",
"State",
".",
"paused",
":",
"self",
".",
"__state",
"=",
"DataChannelBuffer",
".",
"State",
"."... | d43693eaf057b8683b9638e575000f055fede452 |
train | nlargest | Takes a mapping and returns the n keys associated with the largest values
in descending order. If the mapping has fewer than n items, all its keys
are returned.
Equivalent to:
``next(zip(*heapq.nlargest(mapping.items(), key=lambda x: x[1])))``
Returns
-------
list of up to n keys from ... | pqdict/__init__.py | def nlargest(n, mapping):
"""
Takes a mapping and returns the n keys associated with the largest values
in descending order. If the mapping has fewer than n items, all its keys
are returned.
Equivalent to:
``next(zip(*heapq.nlargest(mapping.items(), key=lambda x: x[1])))``
Returns
... | def nlargest(n, mapping):
"""
Takes a mapping and returns the n keys associated with the largest values
in descending order. If the mapping has fewer than n items, all its keys
are returned.
Equivalent to:
``next(zip(*heapq.nlargest(mapping.items(), key=lambda x: x[1])))``
Returns
... | [
"Takes",
"a",
"mapping",
"and",
"returns",
"the",
"n",
"keys",
"associated",
"with",
"the",
"largest",
"values",
"in",
"descending",
"order",
".",
"If",
"the",
"mapping",
"has",
"fewer",
"than",
"n",
"items",
"all",
"its",
"keys",
"are",
"returned",
"."
] | nvictus/priority-queue-dictionary | python | https://github.com/nvictus/priority-queue-dictionary/blob/577f9d3086058bec0e49cc2050dd9454b788d93b/pqdict/__init__.py#L512-L543 | [
"def",
"nlargest",
"(",
"n",
",",
"mapping",
")",
":",
"try",
":",
"it",
"=",
"mapping",
".",
"iteritems",
"(",
")",
"except",
"AttributeError",
":",
"it",
"=",
"iter",
"(",
"mapping",
".",
"items",
"(",
")",
")",
"pq",
"=",
"minpq",
"(",
")",
"t... | 577f9d3086058bec0e49cc2050dd9454b788d93b |
train | pqdict.fromkeys | Return a new pqict mapping keys from an iterable to the same value. | pqdict/__init__.py | def fromkeys(cls, iterable, value, **kwargs):
"""
Return a new pqict mapping keys from an iterable to the same value.
"""
return cls(((k, value) for k in iterable), **kwargs) | def fromkeys(cls, iterable, value, **kwargs):
"""
Return a new pqict mapping keys from an iterable to the same value.
"""
return cls(((k, value) for k in iterable), **kwargs) | [
"Return",
"a",
"new",
"pqict",
"mapping",
"keys",
"from",
"an",
"iterable",
"to",
"the",
"same",
"value",
"."
] | nvictus/priority-queue-dictionary | python | https://github.com/nvictus/priority-queue-dictionary/blob/577f9d3086058bec0e49cc2050dd9454b788d93b/pqdict/__init__.py#L121-L126 | [
"def",
"fromkeys",
"(",
"cls",
",",
"iterable",
",",
"value",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"cls",
"(",
"(",
"(",
"k",
",",
"value",
")",
"for",
"k",
"in",
"iterable",
")",
",",
"*",
"*",
"kwargs",
")"
] | 577f9d3086058bec0e49cc2050dd9454b788d93b |
train | pqdict.copy | Return a shallow copy of a pqdict. | pqdict/__init__.py | def copy(self):
"""
Return a shallow copy of a pqdict.
"""
return self.__class__(self, key=self._keyfn, precedes=self._precedes) | def copy(self):
"""
Return a shallow copy of a pqdict.
"""
return self.__class__(self, key=self._keyfn, precedes=self._precedes) | [
"Return",
"a",
"shallow",
"copy",
"of",
"a",
"pqdict",
"."
] | nvictus/priority-queue-dictionary | python | https://github.com/nvictus/priority-queue-dictionary/blob/577f9d3086058bec0e49cc2050dd9454b788d93b/pqdict/__init__.py#L201-L206 | [
"def",
"copy",
"(",
"self",
")",
":",
"return",
"self",
".",
"__class__",
"(",
"self",
",",
"key",
"=",
"self",
".",
"_keyfn",
",",
"precedes",
"=",
"self",
".",
"_precedes",
")"
] | 577f9d3086058bec0e49cc2050dd9454b788d93b |
train | pqdict.pop | If ``key`` is in the pqdict, remove it and return its priority value,
else return ``default``. If ``default`` is not provided and ``key`` is
not in the pqdict, raise a ``KeyError``.
If ``key`` is not provided, remove the top item and return its key, or
raise ``KeyError`` if the pqdict i... | pqdict/__init__.py | def pop(self, key=__marker, default=__marker):
"""
If ``key`` is in the pqdict, remove it and return its priority value,
else return ``default``. If ``default`` is not provided and ``key`` is
not in the pqdict, raise a ``KeyError``.
If ``key`` is not provided, remove the top ite... | def pop(self, key=__marker, default=__marker):
"""
If ``key`` is in the pqdict, remove it and return its priority value,
else return ``default``. If ``default`` is not provided and ``key`` is
not in the pqdict, raise a ``KeyError``.
If ``key`` is not provided, remove the top ite... | [
"If",
"key",
"is",
"in",
"the",
"pqdict",
"remove",
"it",
"and",
"return",
"its",
"priority",
"value",
"else",
"return",
"default",
".",
"If",
"default",
"is",
"not",
"provided",
"and",
"key",
"is",
"not",
"in",
"the",
"pqdict",
"raise",
"a",
"KeyError",... | nvictus/priority-queue-dictionary | python | https://github.com/nvictus/priority-queue-dictionary/blob/577f9d3086058bec0e49cc2050dd9454b788d93b/pqdict/__init__.py#L208-L243 | [
"def",
"pop",
"(",
"self",
",",
"key",
"=",
"__marker",
",",
"default",
"=",
"__marker",
")",
":",
"heap",
"=",
"self",
".",
"_heap",
"position",
"=",
"self",
".",
"_position",
"# pq semantics: remove and return top *key* (value is discarded)",
"if",
"key",
"is"... | 577f9d3086058bec0e49cc2050dd9454b788d93b |
train | pqdict.popitem | Remove and return the item with highest priority. Raises ``KeyError``
if pqdict is empty. | pqdict/__init__.py | def popitem(self):
"""
Remove and return the item with highest priority. Raises ``KeyError``
if pqdict is empty.
"""
heap = self._heap
position = self._position
try:
end = heap.pop(-1)
except IndexError:
raise KeyError('pqdict is ... | def popitem(self):
"""
Remove and return the item with highest priority. Raises ``KeyError``
if pqdict is empty.
"""
heap = self._heap
position = self._position
try:
end = heap.pop(-1)
except IndexError:
raise KeyError('pqdict is ... | [
"Remove",
"and",
"return",
"the",
"item",
"with",
"highest",
"priority",
".",
"Raises",
"KeyError",
"if",
"pqdict",
"is",
"empty",
"."
] | nvictus/priority-queue-dictionary | python | https://github.com/nvictus/priority-queue-dictionary/blob/577f9d3086058bec0e49cc2050dd9454b788d93b/pqdict/__init__.py#L260-L282 | [
"def",
"popitem",
"(",
"self",
")",
":",
"heap",
"=",
"self",
".",
"_heap",
"position",
"=",
"self",
".",
"_position",
"try",
":",
"end",
"=",
"heap",
".",
"pop",
"(",
"-",
"1",
")",
"except",
"IndexError",
":",
"raise",
"KeyError",
"(",
"'pqdict is ... | 577f9d3086058bec0e49cc2050dd9454b788d93b |
train | pqdict.topitem | Return the item with highest priority. Raises ``KeyError`` if pqdict is
empty. | pqdict/__init__.py | def topitem(self):
"""
Return the item with highest priority. Raises ``KeyError`` if pqdict is
empty.
"""
try:
node = self._heap[0]
except IndexError:
raise KeyError('pqdict is empty')
return node.key, node.value | def topitem(self):
"""
Return the item with highest priority. Raises ``KeyError`` if pqdict is
empty.
"""
try:
node = self._heap[0]
except IndexError:
raise KeyError('pqdict is empty')
return node.key, node.value | [
"Return",
"the",
"item",
"with",
"highest",
"priority",
".",
"Raises",
"KeyError",
"if",
"pqdict",
"is",
"empty",
"."
] | nvictus/priority-queue-dictionary | python | https://github.com/nvictus/priority-queue-dictionary/blob/577f9d3086058bec0e49cc2050dd9454b788d93b/pqdict/__init__.py#L284-L294 | [
"def",
"topitem",
"(",
"self",
")",
":",
"try",
":",
"node",
"=",
"self",
".",
"_heap",
"[",
"0",
"]",
"except",
"IndexError",
":",
"raise",
"KeyError",
"(",
"'pqdict is empty'",
")",
"return",
"node",
".",
"key",
",",
"node",
".",
"value"
] | 577f9d3086058bec0e49cc2050dd9454b788d93b |
train | pqdict.additem | Add a new item. Raises ``KeyError`` if key is already in the pqdict. | pqdict/__init__.py | def additem(self, key, value):
"""
Add a new item. Raises ``KeyError`` if key is already in the pqdict.
"""
if key in self._position:
raise KeyError('%s is already in the queue' % repr(key))
self[key] = value | def additem(self, key, value):
"""
Add a new item. Raises ``KeyError`` if key is already in the pqdict.
"""
if key in self._position:
raise KeyError('%s is already in the queue' % repr(key))
self[key] = value | [
"Add",
"a",
"new",
"item",
".",
"Raises",
"KeyError",
"if",
"key",
"is",
"already",
"in",
"the",
"pqdict",
"."
] | nvictus/priority-queue-dictionary | python | https://github.com/nvictus/priority-queue-dictionary/blob/577f9d3086058bec0e49cc2050dd9454b788d93b/pqdict/__init__.py#L296-L303 | [
"def",
"additem",
"(",
"self",
",",
"key",
",",
"value",
")",
":",
"if",
"key",
"in",
"self",
".",
"_position",
":",
"raise",
"KeyError",
"(",
"'%s is already in the queue'",
"%",
"repr",
"(",
"key",
")",
")",
"self",
"[",
"key",
"]",
"=",
"value"
] | 577f9d3086058bec0e49cc2050dd9454b788d93b |
train | pqdict.pushpopitem | Equivalent to inserting a new item followed by removing the top
priority item, but faster. Raises ``KeyError`` if the new key is
already in the pqdict. | pqdict/__init__.py | def pushpopitem(self, key, value, node_factory=_Node):
"""
Equivalent to inserting a new item followed by removing the top
priority item, but faster. Raises ``KeyError`` if the new key is
already in the pqdict.
"""
heap = self._heap
position = self._position
... | def pushpopitem(self, key, value, node_factory=_Node):
"""
Equivalent to inserting a new item followed by removing the top
priority item, but faster. Raises ``KeyError`` if the new key is
already in the pqdict.
"""
heap = self._heap
position = self._position
... | [
"Equivalent",
"to",
"inserting",
"a",
"new",
"item",
"followed",
"by",
"removing",
"the",
"top",
"priority",
"item",
"but",
"faster",
".",
"Raises",
"KeyError",
"if",
"the",
"new",
"key",
"is",
"already",
"in",
"the",
"pqdict",
"."
] | nvictus/priority-queue-dictionary | python | https://github.com/nvictus/priority-queue-dictionary/blob/577f9d3086058bec0e49cc2050dd9454b788d93b/pqdict/__init__.py#L305-L324 | [
"def",
"pushpopitem",
"(",
"self",
",",
"key",
",",
"value",
",",
"node_factory",
"=",
"_Node",
")",
":",
"heap",
"=",
"self",
".",
"_heap",
"position",
"=",
"self",
".",
"_position",
"precedes",
"=",
"self",
".",
"_precedes",
"prio",
"=",
"self",
".",... | 577f9d3086058bec0e49cc2050dd9454b788d93b |
train | pqdict.updateitem | Update the priority value of an existing item. Raises ``KeyError`` if
key is not in the pqdict. | pqdict/__init__.py | def updateitem(self, key, new_val):
"""
Update the priority value of an existing item. Raises ``KeyError`` if
key is not in the pqdict.
"""
if key not in self._position:
raise KeyError(key)
self[key] = new_val | def updateitem(self, key, new_val):
"""
Update the priority value of an existing item. Raises ``KeyError`` if
key is not in the pqdict.
"""
if key not in self._position:
raise KeyError(key)
self[key] = new_val | [
"Update",
"the",
"priority",
"value",
"of",
"an",
"existing",
"item",
".",
"Raises",
"KeyError",
"if",
"key",
"is",
"not",
"in",
"the",
"pqdict",
"."
] | nvictus/priority-queue-dictionary | python | https://github.com/nvictus/priority-queue-dictionary/blob/577f9d3086058bec0e49cc2050dd9454b788d93b/pqdict/__init__.py#L326-L334 | [
"def",
"updateitem",
"(",
"self",
",",
"key",
",",
"new_val",
")",
":",
"if",
"key",
"not",
"in",
"self",
".",
"_position",
":",
"raise",
"KeyError",
"(",
"key",
")",
"self",
"[",
"key",
"]",
"=",
"new_val"
] | 577f9d3086058bec0e49cc2050dd9454b788d93b |
train | pqdict.replace_key | Replace the key of an existing heap node in place. Raises ``KeyError``
if the key to replace does not exist or if the new key is already in
the pqdict. | pqdict/__init__.py | def replace_key(self, key, new_key):
"""
Replace the key of an existing heap node in place. Raises ``KeyError``
if the key to replace does not exist or if the new key is already in
the pqdict.
"""
heap = self._heap
position = self._position
if new_key in ... | def replace_key(self, key, new_key):
"""
Replace the key of an existing heap node in place. Raises ``KeyError``
if the key to replace does not exist or if the new key is already in
the pqdict.
"""
heap = self._heap
position = self._position
if new_key in ... | [
"Replace",
"the",
"key",
"of",
"an",
"existing",
"heap",
"node",
"in",
"place",
".",
"Raises",
"KeyError",
"if",
"the",
"key",
"to",
"replace",
"does",
"not",
"exist",
"or",
"if",
"the",
"new",
"key",
"is",
"already",
"in",
"the",
"pqdict",
"."
] | nvictus/priority-queue-dictionary | python | https://github.com/nvictus/priority-queue-dictionary/blob/577f9d3086058bec0e49cc2050dd9454b788d93b/pqdict/__init__.py#L336-L349 | [
"def",
"replace_key",
"(",
"self",
",",
"key",
",",
"new_key",
")",
":",
"heap",
"=",
"self",
".",
"_heap",
"position",
"=",
"self",
".",
"_position",
"if",
"new_key",
"in",
"self",
":",
"raise",
"KeyError",
"(",
"'%s is already in the queue'",
"%",
"repr"... | 577f9d3086058bec0e49cc2050dd9454b788d93b |
train | pqdict.swap_priority | Fast way to swap the priority level of two items in the pqdict. Raises
``KeyError`` if either key does not exist. | pqdict/__init__.py | def swap_priority(self, key1, key2):
"""
Fast way to swap the priority level of two items in the pqdict. Raises
``KeyError`` if either key does not exist.
"""
heap = self._heap
position = self._position
if key1 not in self or key2 not in self:
raise K... | def swap_priority(self, key1, key2):
"""
Fast way to swap the priority level of two items in the pqdict. Raises
``KeyError`` if either key does not exist.
"""
heap = self._heap
position = self._position
if key1 not in self or key2 not in self:
raise K... | [
"Fast",
"way",
"to",
"swap",
"the",
"priority",
"level",
"of",
"two",
"items",
"in",
"the",
"pqdict",
".",
"Raises",
"KeyError",
"if",
"either",
"key",
"does",
"not",
"exist",
"."
] | nvictus/priority-queue-dictionary | python | https://github.com/nvictus/priority-queue-dictionary/blob/577f9d3086058bec0e49cc2050dd9454b788d93b/pqdict/__init__.py#L351-L363 | [
"def",
"swap_priority",
"(",
"self",
",",
"key1",
",",
"key2",
")",
":",
"heap",
"=",
"self",
".",
"_heap",
"position",
"=",
"self",
".",
"_position",
"if",
"key1",
"not",
"in",
"self",
"or",
"key2",
"not",
"in",
"self",
":",
"raise",
"KeyError",
"po... | 577f9d3086058bec0e49cc2050dd9454b788d93b |
train | pqdict.heapify | Repair a broken heap. If the state of an item's priority value changes
you can re-sort the relevant item only by providing ``key``. | pqdict/__init__.py | def heapify(self, key=__marker):
"""
Repair a broken heap. If the state of an item's priority value changes
you can re-sort the relevant item only by providing ``key``.
"""
if key is self.__marker:
n = len(self._heap)
for pos in reversed(range(n//2)):
... | def heapify(self, key=__marker):
"""
Repair a broken heap. If the state of an item's priority value changes
you can re-sort the relevant item only by providing ``key``.
"""
if key is self.__marker:
n = len(self._heap)
for pos in reversed(range(n//2)):
... | [
"Repair",
"a",
"broken",
"heap",
".",
"If",
"the",
"state",
"of",
"an",
"item",
"s",
"priority",
"value",
"changes",
"you",
"can",
"re",
"-",
"sort",
"the",
"relevant",
"item",
"only",
"by",
"providing",
"key",
"."
] | nvictus/priority-queue-dictionary | python | https://github.com/nvictus/priority-queue-dictionary/blob/577f9d3086058bec0e49cc2050dd9454b788d93b/pqdict/__init__.py#L398-L413 | [
"def",
"heapify",
"(",
"self",
",",
"key",
"=",
"__marker",
")",
":",
"if",
"key",
"is",
"self",
".",
"__marker",
":",
"n",
"=",
"len",
"(",
"self",
".",
"_heap",
")",
"for",
"pos",
"in",
"reversed",
"(",
"range",
"(",
"n",
"//",
"2",
")",
")",... | 577f9d3086058bec0e49cc2050dd9454b788d93b |
train | package_has_version_file | Check to make sure _version.py is contained in the package | hatchery/project.py | def package_has_version_file(package_name):
""" Check to make sure _version.py is contained in the package """
version_file_path = helpers.package_file_path('_version.py', package_name)
return os.path.isfile(version_file_path) | def package_has_version_file(package_name):
""" Check to make sure _version.py is contained in the package """
version_file_path = helpers.package_file_path('_version.py', package_name)
return os.path.isfile(version_file_path) | [
"Check",
"to",
"make",
"sure",
"_version",
".",
"py",
"is",
"contained",
"in",
"the",
"package"
] | ajk8/hatchery | python | https://github.com/ajk8/hatchery/blob/e068c9f5366d2c98225babb03d4cde36c710194f/hatchery/project.py#L45-L48 | [
"def",
"package_has_version_file",
"(",
"package_name",
")",
":",
"version_file_path",
"=",
"helpers",
".",
"package_file_path",
"(",
"'_version.py'",
",",
"package_name",
")",
"return",
"os",
".",
"path",
".",
"isfile",
"(",
"version_file_path",
")"
] | e068c9f5366d2c98225babb03d4cde36c710194f |
train | get_project_name | Grab the project name out of setup.py | hatchery/project.py | def get_project_name():
""" Grab the project name out of setup.py """
setup_py_content = helpers.get_file_content('setup.py')
ret = helpers.value_of_named_argument_in_function(
'name', 'setup', setup_py_content, resolve_varname=True
)
if ret and ret[0] == ret[-1] in ('"', "'"):
ret =... | def get_project_name():
""" Grab the project name out of setup.py """
setup_py_content = helpers.get_file_content('setup.py')
ret = helpers.value_of_named_argument_in_function(
'name', 'setup', setup_py_content, resolve_varname=True
)
if ret and ret[0] == ret[-1] in ('"', "'"):
ret =... | [
"Grab",
"the",
"project",
"name",
"out",
"of",
"setup",
".",
"py"
] | ajk8/hatchery | python | https://github.com/ajk8/hatchery/blob/e068c9f5366d2c98225babb03d4cde36c710194f/hatchery/project.py#L78-L86 | [
"def",
"get_project_name",
"(",
")",
":",
"setup_py_content",
"=",
"helpers",
".",
"get_file_content",
"(",
"'setup.py'",
")",
"ret",
"=",
"helpers",
".",
"value_of_named_argument_in_function",
"(",
"'name'",
",",
"'setup'",
",",
"setup_py_content",
",",
"resolve_va... | e068c9f5366d2c98225babb03d4cde36c710194f |
train | get_version | Get the version which is currently configured by the package | hatchery/project.py | def get_version(package_name, ignore_cache=False):
""" Get the version which is currently configured by the package """
if ignore_cache:
with microcache.temporarily_disabled():
found = helpers.regex_in_package_file(
VERSION_SET_REGEX, '_version.py', package_name, return_match... | def get_version(package_name, ignore_cache=False):
""" Get the version which is currently configured by the package """
if ignore_cache:
with microcache.temporarily_disabled():
found = helpers.regex_in_package_file(
VERSION_SET_REGEX, '_version.py', package_name, return_match... | [
"Get",
"the",
"version",
"which",
"is",
"currently",
"configured",
"by",
"the",
"package"
] | ajk8/hatchery | python | https://github.com/ajk8/hatchery/blob/e068c9f5366d2c98225babb03d4cde36c710194f/hatchery/project.py#L89-L103 | [
"def",
"get_version",
"(",
"package_name",
",",
"ignore_cache",
"=",
"False",
")",
":",
"if",
"ignore_cache",
":",
"with",
"microcache",
".",
"temporarily_disabled",
"(",
")",
":",
"found",
"=",
"helpers",
".",
"regex_in_package_file",
"(",
"VERSION_SET_REGEX",
... | e068c9f5366d2c98225babb03d4cde36c710194f |
train | set_version | Set the version in _version.py to version_str | hatchery/project.py | def set_version(package_name, version_str):
""" Set the version in _version.py to version_str """
current_version = get_version(package_name)
version_file_path = helpers.package_file_path('_version.py', package_name)
version_file_content = helpers.get_file_content(version_file_path)
version_file_con... | def set_version(package_name, version_str):
""" Set the version in _version.py to version_str """
current_version = get_version(package_name)
version_file_path = helpers.package_file_path('_version.py', package_name)
version_file_content = helpers.get_file_content(version_file_path)
version_file_con... | [
"Set",
"the",
"version",
"in",
"_version",
".",
"py",
"to",
"version_str"
] | ajk8/hatchery | python | https://github.com/ajk8/hatchery/blob/e068c9f5366d2c98225babb03d4cde36c710194f/hatchery/project.py#L106-L113 | [
"def",
"set_version",
"(",
"package_name",
",",
"version_str",
")",
":",
"current_version",
"=",
"get_version",
"(",
"package_name",
")",
"version_file_path",
"=",
"helpers",
".",
"package_file_path",
"(",
"'_version.py'",
",",
"package_name",
")",
"version_file_conte... | e068c9f5366d2c98225babb03d4cde36c710194f |
train | version_is_valid | Check to see if the version specified is a valid as far as pkg_resources is concerned
>>> version_is_valid('blah')
False
>>> version_is_valid('1.2.3')
True | hatchery/project.py | def version_is_valid(version_str):
""" Check to see if the version specified is a valid as far as pkg_resources is concerned
>>> version_is_valid('blah')
False
>>> version_is_valid('1.2.3')
True
"""
try:
packaging.version.Version(version_str)
except packaging.version.InvalidVers... | def version_is_valid(version_str):
""" Check to see if the version specified is a valid as far as pkg_resources is concerned
>>> version_is_valid('blah')
False
>>> version_is_valid('1.2.3')
True
"""
try:
packaging.version.Version(version_str)
except packaging.version.InvalidVers... | [
"Check",
"to",
"see",
"if",
"the",
"version",
"specified",
"is",
"a",
"valid",
"as",
"far",
"as",
"pkg_resources",
"is",
"concerned"
] | ajk8/hatchery | python | https://github.com/ajk8/hatchery/blob/e068c9f5366d2c98225babb03d4cde36c710194f/hatchery/project.py#L116-L128 | [
"def",
"version_is_valid",
"(",
"version_str",
")",
":",
"try",
":",
"packaging",
".",
"version",
".",
"Version",
"(",
"version_str",
")",
"except",
"packaging",
".",
"version",
".",
"InvalidVersion",
":",
"return",
"False",
"return",
"True"
] | e068c9f5366d2c98225babb03d4cde36c710194f |
train | _get_uploaded_versions_warehouse | Query the pypi index at index_url using warehouse api to find all of the "releases" | hatchery/project.py | def _get_uploaded_versions_warehouse(project_name, index_url, requests_verify=True):
""" Query the pypi index at index_url using warehouse api to find all of the "releases" """
url = '/'.join((index_url, project_name, 'json'))
response = requests.get(url, verify=requests_verify)
if response.status_code ... | def _get_uploaded_versions_warehouse(project_name, index_url, requests_verify=True):
""" Query the pypi index at index_url using warehouse api to find all of the "releases" """
url = '/'.join((index_url, project_name, 'json'))
response = requests.get(url, verify=requests_verify)
if response.status_code ... | [
"Query",
"the",
"pypi",
"index",
"at",
"index_url",
"using",
"warehouse",
"api",
"to",
"find",
"all",
"of",
"the",
"releases"
] | ajk8/hatchery | python | https://github.com/ajk8/hatchery/blob/e068c9f5366d2c98225babb03d4cde36c710194f/hatchery/project.py#L131-L137 | [
"def",
"_get_uploaded_versions_warehouse",
"(",
"project_name",
",",
"index_url",
",",
"requests_verify",
"=",
"True",
")",
":",
"url",
"=",
"'/'",
".",
"join",
"(",
"(",
"index_url",
",",
"project_name",
",",
"'json'",
")",
")",
"response",
"=",
"requests",
... | e068c9f5366d2c98225babb03d4cde36c710194f |
train | _get_uploaded_versions_pypicloud | Query the pypi index at index_url using pypicloud api to find all versions | hatchery/project.py | def _get_uploaded_versions_pypicloud(project_name, index_url, requests_verify=True):
""" Query the pypi index at index_url using pypicloud api to find all versions """
api_url = index_url
for suffix in ('/pypi', '/pypi/', '/simple', '/simple/'):
if api_url.endswith(suffix):
api_url = api... | def _get_uploaded_versions_pypicloud(project_name, index_url, requests_verify=True):
""" Query the pypi index at index_url using pypicloud api to find all versions """
api_url = index_url
for suffix in ('/pypi', '/pypi/', '/simple', '/simple/'):
if api_url.endswith(suffix):
api_url = api... | [
"Query",
"the",
"pypi",
"index",
"at",
"index_url",
"using",
"pypicloud",
"api",
"to",
"find",
"all",
"versions"
] | ajk8/hatchery | python | https://github.com/ajk8/hatchery/blob/e068c9f5366d2c98225babb03d4cde36c710194f/hatchery/project.py#L140-L151 | [
"def",
"_get_uploaded_versions_pypicloud",
"(",
"project_name",
",",
"index_url",
",",
"requests_verify",
"=",
"True",
")",
":",
"api_url",
"=",
"index_url",
"for",
"suffix",
"in",
"(",
"'/pypi'",
",",
"'/pypi/'",
",",
"'/simple'",
",",
"'/simple/'",
")",
":",
... | e068c9f5366d2c98225babb03d4cde36c710194f |
train | version_already_uploaded | Check to see if the version specified has already been uploaded to the configured index | hatchery/project.py | def version_already_uploaded(project_name, version_str, index_url, requests_verify=True):
""" Check to see if the version specified has already been uploaded to the configured index
"""
all_versions = _get_uploaded_versions(project_name, index_url, requests_verify)
return version_str in all_versions | def version_already_uploaded(project_name, version_str, index_url, requests_verify=True):
""" Check to see if the version specified has already been uploaded to the configured index
"""
all_versions = _get_uploaded_versions(project_name, index_url, requests_verify)
return version_str in all_versions | [
"Check",
"to",
"see",
"if",
"the",
"version",
"specified",
"has",
"already",
"been",
"uploaded",
"to",
"the",
"configured",
"index"
] | ajk8/hatchery | python | https://github.com/ajk8/hatchery/blob/e068c9f5366d2c98225babb03d4cde36c710194f/hatchery/project.py#L168-L172 | [
"def",
"version_already_uploaded",
"(",
"project_name",
",",
"version_str",
",",
"index_url",
",",
"requests_verify",
"=",
"True",
")",
":",
"all_versions",
"=",
"_get_uploaded_versions",
"(",
"project_name",
",",
"index_url",
",",
"requests_verify",
")",
"return",
... | e068c9f5366d2c98225babb03d4cde36c710194f |
train | convert_readme_to_rst | Attempt to convert a README.md file into README.rst | hatchery/project.py | def convert_readme_to_rst():
""" Attempt to convert a README.md file into README.rst """
project_files = os.listdir('.')
for filename in project_files:
if filename.lower() == 'readme':
raise ProjectError(
'found {} in project directory...'.format(filename) +
... | def convert_readme_to_rst():
""" Attempt to convert a README.md file into README.rst """
project_files = os.listdir('.')
for filename in project_files:
if filename.lower() == 'readme':
raise ProjectError(
'found {} in project directory...'.format(filename) +
... | [
"Attempt",
"to",
"convert",
"a",
"README",
".",
"md",
"file",
"into",
"README",
".",
"rst"
] | ajk8/hatchery | python | https://github.com/ajk8/hatchery/blob/e068c9f5366d2c98225babb03d4cde36c710194f/hatchery/project.py#L208-L235 | [
"def",
"convert_readme_to_rst",
"(",
")",
":",
"project_files",
"=",
"os",
".",
"listdir",
"(",
"'.'",
")",
"for",
"filename",
"in",
"project_files",
":",
"if",
"filename",
".",
"lower",
"(",
")",
"==",
"'readme'",
":",
"raise",
"ProjectError",
"(",
"'foun... | e068c9f5366d2c98225babb03d4cde36c710194f |
train | get_packaged_files | Collect relative paths to all files which have already been packaged | hatchery/project.py | def get_packaged_files(package_name):
""" Collect relative paths to all files which have already been packaged """
if not os.path.isdir('dist'):
return []
return [os.path.join('dist', filename) for filename in os.listdir('dist')] | def get_packaged_files(package_name):
""" Collect relative paths to all files which have already been packaged """
if not os.path.isdir('dist'):
return []
return [os.path.join('dist', filename) for filename in os.listdir('dist')] | [
"Collect",
"relative",
"paths",
"to",
"all",
"files",
"which",
"have",
"already",
"been",
"packaged"
] | ajk8/hatchery | python | https://github.com/ajk8/hatchery/blob/e068c9f5366d2c98225babb03d4cde36c710194f/hatchery/project.py#L238-L242 | [
"def",
"get_packaged_files",
"(",
"package_name",
")",
":",
"if",
"not",
"os",
".",
"path",
".",
"isdir",
"(",
"'dist'",
")",
":",
"return",
"[",
"]",
"return",
"[",
"os",
".",
"path",
".",
"join",
"(",
"'dist'",
",",
"filename",
")",
"for",
"filenam... | e068c9f5366d2c98225babb03d4cde36c710194f |
train | multiple_packaged_versions | Look through built package directory and see if there are multiple versions there | hatchery/project.py | def multiple_packaged_versions(package_name):
""" Look through built package directory and see if there are multiple versions there """
dist_files = os.listdir('dist')
versions = set()
for filename in dist_files:
version = funcy.re_find(r'{}-(.+).tar.gz'.format(package_name), filename)
i... | def multiple_packaged_versions(package_name):
""" Look through built package directory and see if there are multiple versions there """
dist_files = os.listdir('dist')
versions = set()
for filename in dist_files:
version = funcy.re_find(r'{}-(.+).tar.gz'.format(package_name), filename)
i... | [
"Look",
"through",
"built",
"package",
"directory",
"and",
"see",
"if",
"there",
"are",
"multiple",
"versions",
"there"
] | ajk8/hatchery | python | https://github.com/ajk8/hatchery/blob/e068c9f5366d2c98225babb03d4cde36c710194f/hatchery/project.py#L245-L253 | [
"def",
"multiple_packaged_versions",
"(",
"package_name",
")",
":",
"dist_files",
"=",
"os",
".",
"listdir",
"(",
"'dist'",
")",
"versions",
"=",
"set",
"(",
")",
"for",
"filename",
"in",
"dist_files",
":",
"version",
"=",
"funcy",
".",
"re_find",
"(",
"r'... | e068c9f5366d2c98225babb03d4cde36c710194f |
train | HailForecastGrid.period_neighborhood_probability | Calculate the neighborhood probability over the full period of the forecast
Args:
radius: circular radius from each point in km
smoothing: width of Gaussian smoother in km
threshold: intensity of exceedance
stride: number of grid points to skip for reduced neighb... | hagelslag/data/HailForecastGrid.py | def period_neighborhood_probability(self, radius, smoothing, threshold, stride,start_time,end_time):
"""
Calculate the neighborhood probability over the full period of the forecast
Args:
radius: circular radius from each point in km
smoothing: width of Gaussian smoother ... | def period_neighborhood_probability(self, radius, smoothing, threshold, stride,start_time,end_time):
"""
Calculate the neighborhood probability over the full period of the forecast
Args:
radius: circular radius from each point in km
smoothing: width of Gaussian smoother ... | [
"Calculate",
"the",
"neighborhood",
"probability",
"over",
"the",
"full",
"period",
"of",
"the",
"forecast"
] | djgagne/hagelslag | python | https://github.com/djgagne/hagelslag/blob/6fb6c3df90bf4867e13a97d3460b14471d107df1/hagelslag/data/HailForecastGrid.py#L94-L123 | [
"def",
"period_neighborhood_probability",
"(",
"self",
",",
"radius",
",",
"smoothing",
",",
"threshold",
",",
"stride",
",",
"start_time",
",",
"end_time",
")",
":",
"neighbor_x",
"=",
"self",
".",
"x",
"[",
":",
":",
"stride",
",",
":",
":",
"stride",
... | 6fb6c3df90bf4867e13a97d3460b14471d107df1 |
train | RespostaConsultarNumeroSessao.analisar | Constrói uma :class:`RespostaSAT` ou especialização dependendo da
função SAT encontrada na sessão consultada.
:param unicode retorno: Retorno da função ``ConsultarNumeroSessao``. | satcfe/resposta/consultarnumerosessao.py | def analisar(retorno):
"""Constrói uma :class:`RespostaSAT` ou especialização dependendo da
função SAT encontrada na sessão consultada.
:param unicode retorno: Retorno da função ``ConsultarNumeroSessao``.
"""
if '|' not in retorno:
raise ErroRespostaSATInvalida('Resp... | def analisar(retorno):
"""Constrói uma :class:`RespostaSAT` ou especialização dependendo da
função SAT encontrada na sessão consultada.
:param unicode retorno: Retorno da função ``ConsultarNumeroSessao``.
"""
if '|' not in retorno:
raise ErroRespostaSATInvalida('Resp... | [
"Constrói",
"uma",
":",
"class",
":",
"RespostaSAT",
"ou",
"especialização",
"dependendo",
"da",
"função",
"SAT",
"encontrada",
"na",
"sessão",
"consultada",
"."
] | base4sistemas/satcfe | python | https://github.com/base4sistemas/satcfe/blob/cb8e8815f4133d3e3d94cf526fa86767b4521ed9/satcfe/resposta/consultarnumerosessao.py#L65-L81 | [
"def",
"analisar",
"(",
"retorno",
")",
":",
"if",
"'|'",
"not",
"in",
"retorno",
":",
"raise",
"ErroRespostaSATInvalida",
"(",
"'Resposta nao possui pipes '",
"'separando os campos: {!r}'",
".",
"format",
"(",
"retorno",
")",
")",
"resposta",
"=",
"_RespostaParcial... | cb8e8815f4133d3e3d94cf526fa86767b4521ed9 |
train | analisar_retorno | Analisa o retorno (supostamente um retorno de uma função do SAT) conforme
o padrão e campos esperados. O retorno deverá possuir dados separados entre
si através de pipes e o número de campos deverá coincidir com os campos
especificados.
O campos devem ser especificados como uma tupla onde cada elemento... | satcfe/resposta/padrao.py | def analisar_retorno(retorno,
classe_resposta=RespostaSAT, campos=RespostaSAT.CAMPOS,
campos_alternativos=[], funcao=None, manter_verbatim=True):
"""Analisa o retorno (supostamente um retorno de uma função do SAT) conforme
o padrão e campos esperados. O retorno deverá possuir dados separados ent... | def analisar_retorno(retorno,
classe_resposta=RespostaSAT, campos=RespostaSAT.CAMPOS,
campos_alternativos=[], funcao=None, manter_verbatim=True):
"""Analisa o retorno (supostamente um retorno de uma função do SAT) conforme
o padrão e campos esperados. O retorno deverá possuir dados separados ent... | [
"Analisa",
"o",
"retorno",
"(",
"supostamente",
"um",
"retorno",
"de",
"uma",
"função",
"do",
"SAT",
")",
"conforme",
"o",
"padrão",
"e",
"campos",
"esperados",
".",
"O",
"retorno",
"deverá",
"possuir",
"dados",
"separados",
"entre",
"si",
"através",
"de",
... | base4sistemas/satcfe | python | https://github.com/base4sistemas/satcfe/blob/cb8e8815f4133d3e3d94cf526fa86767b4521ed9/satcfe/resposta/padrao.py#L175-L268 | [
"def",
"analisar_retorno",
"(",
"retorno",
",",
"classe_resposta",
"=",
"RespostaSAT",
",",
"campos",
"=",
"RespostaSAT",
".",
"CAMPOS",
",",
"campos_alternativos",
"=",
"[",
"]",
",",
"funcao",
"=",
"None",
",",
"manter_verbatim",
"=",
"True",
")",
":",
"if... | cb8e8815f4133d3e3d94cf526fa86767b4521ed9 |
train | RespostaSAT.comunicar_certificado_icpbrasil | Constrói uma :class:`RespostaSAT` para o retorno (unicode) da função
:meth:`~satcfe.base.FuncoesSAT.comunicar_certificado_icpbrasil`. | satcfe/resposta/padrao.py | def comunicar_certificado_icpbrasil(retorno):
"""Constrói uma :class:`RespostaSAT` para o retorno (unicode) da função
:meth:`~satcfe.base.FuncoesSAT.comunicar_certificado_icpbrasil`.
"""
resposta = analisar_retorno(forcar_unicode(retorno),
funcao='ComunicarCertificadoICPB... | def comunicar_certificado_icpbrasil(retorno):
"""Constrói uma :class:`RespostaSAT` para o retorno (unicode) da função
:meth:`~satcfe.base.FuncoesSAT.comunicar_certificado_icpbrasil`.
"""
resposta = analisar_retorno(forcar_unicode(retorno),
funcao='ComunicarCertificadoICPB... | [
"Constrói",
"uma",
":",
"class",
":",
"RespostaSAT",
"para",
"o",
"retorno",
"(",
"unicode",
")",
"da",
"função",
":",
"meth",
":",
"~satcfe",
".",
"base",
".",
"FuncoesSAT",
".",
"comunicar_certificado_icpbrasil",
"."
] | base4sistemas/satcfe | python | https://github.com/base4sistemas/satcfe/blob/cb8e8815f4133d3e3d94cf526fa86767b4521ed9/satcfe/resposta/padrao.py#L80-L88 | [
"def",
"comunicar_certificado_icpbrasil",
"(",
"retorno",
")",
":",
"resposta",
"=",
"analisar_retorno",
"(",
"forcar_unicode",
"(",
"retorno",
")",
",",
"funcao",
"=",
"'ComunicarCertificadoICPBRASIL'",
")",
"if",
"resposta",
".",
"EEEEE",
"not",
"in",
"(",
"'050... | cb8e8815f4133d3e3d94cf526fa86767b4521ed9 |
train | RespostaSAT.consultar_sat | Constrói uma :class:`RespostaSAT` para o retorno (unicode) da função
:meth:`~satcfe.base.FuncoesSAT.consultar_sat`. | satcfe/resposta/padrao.py | def consultar_sat(retorno):
"""Constrói uma :class:`RespostaSAT` para o retorno (unicode) da função
:meth:`~satcfe.base.FuncoesSAT.consultar_sat`.
"""
resposta = analisar_retorno(forcar_unicode(retorno),
funcao='ConsultarSAT')
if resposta.EEEEE not in ('08000',):
... | def consultar_sat(retorno):
"""Constrói uma :class:`RespostaSAT` para o retorno (unicode) da função
:meth:`~satcfe.base.FuncoesSAT.consultar_sat`.
"""
resposta = analisar_retorno(forcar_unicode(retorno),
funcao='ConsultarSAT')
if resposta.EEEEE not in ('08000',):
... | [
"Constrói",
"uma",
":",
"class",
":",
"RespostaSAT",
"para",
"o",
"retorno",
"(",
"unicode",
")",
"da",
"função",
":",
"meth",
":",
"~satcfe",
".",
"base",
".",
"FuncoesSAT",
".",
"consultar_sat",
"."
] | base4sistemas/satcfe | python | https://github.com/base4sistemas/satcfe/blob/cb8e8815f4133d3e3d94cf526fa86767b4521ed9/satcfe/resposta/padrao.py#L92-L100 | [
"def",
"consultar_sat",
"(",
"retorno",
")",
":",
"resposta",
"=",
"analisar_retorno",
"(",
"forcar_unicode",
"(",
"retorno",
")",
",",
"funcao",
"=",
"'ConsultarSAT'",
")",
"if",
"resposta",
".",
"EEEEE",
"not",
"in",
"(",
"'08000'",
",",
")",
":",
"raise... | cb8e8815f4133d3e3d94cf526fa86767b4521ed9 |
train | RespostaSAT.configurar_interface_de_rede | Constrói uma :class:`RespostaSAT` para o retorno (unicode) da função
:meth:`~satcfe.base.FuncoesSAT.configurar_interface_de_rede`. | satcfe/resposta/padrao.py | def configurar_interface_de_rede(retorno):
"""Constrói uma :class:`RespostaSAT` para o retorno (unicode) da função
:meth:`~satcfe.base.FuncoesSAT.configurar_interface_de_rede`.
"""
resposta = analisar_retorno(forcar_unicode(retorno),
funcao='ConfigurarInterfaceDeRede')
... | def configurar_interface_de_rede(retorno):
"""Constrói uma :class:`RespostaSAT` para o retorno (unicode) da função
:meth:`~satcfe.base.FuncoesSAT.configurar_interface_de_rede`.
"""
resposta = analisar_retorno(forcar_unicode(retorno),
funcao='ConfigurarInterfaceDeRede')
... | [
"Constrói",
"uma",
":",
"class",
":",
"RespostaSAT",
"para",
"o",
"retorno",
"(",
"unicode",
")",
"da",
"função",
":",
"meth",
":",
"~satcfe",
".",
"base",
".",
"FuncoesSAT",
".",
"configurar_interface_de_rede",
"."
] | base4sistemas/satcfe | python | https://github.com/base4sistemas/satcfe/blob/cb8e8815f4133d3e3d94cf526fa86767b4521ed9/satcfe/resposta/padrao.py#L104-L112 | [
"def",
"configurar_interface_de_rede",
"(",
"retorno",
")",
":",
"resposta",
"=",
"analisar_retorno",
"(",
"forcar_unicode",
"(",
"retorno",
")",
",",
"funcao",
"=",
"'ConfigurarInterfaceDeRede'",
")",
"if",
"resposta",
".",
"EEEEE",
"not",
"in",
"(",
"'12000'",
... | cb8e8815f4133d3e3d94cf526fa86767b4521ed9 |
train | RespostaSAT.associar_assinatura | Constrói uma :class:`RespostaSAT` para o retorno (unicode) da função
:meth:`~satcfe.base.FuncoesSAT.associar_assinatura`. | satcfe/resposta/padrao.py | def associar_assinatura(retorno):
"""Constrói uma :class:`RespostaSAT` para o retorno (unicode) da função
:meth:`~satcfe.base.FuncoesSAT.associar_assinatura`.
"""
resposta = analisar_retorno(forcar_unicode(retorno),
funcao='AssociarAssinatura')
if resposta.EEEEE n... | def associar_assinatura(retorno):
"""Constrói uma :class:`RespostaSAT` para o retorno (unicode) da função
:meth:`~satcfe.base.FuncoesSAT.associar_assinatura`.
"""
resposta = analisar_retorno(forcar_unicode(retorno),
funcao='AssociarAssinatura')
if resposta.EEEEE n... | [
"Constrói",
"uma",
":",
"class",
":",
"RespostaSAT",
"para",
"o",
"retorno",
"(",
"unicode",
")",
"da",
"função",
":",
"meth",
":",
"~satcfe",
".",
"base",
".",
"FuncoesSAT",
".",
"associar_assinatura",
"."
] | base4sistemas/satcfe | python | https://github.com/base4sistemas/satcfe/blob/cb8e8815f4133d3e3d94cf526fa86767b4521ed9/satcfe/resposta/padrao.py#L116-L124 | [
"def",
"associar_assinatura",
"(",
"retorno",
")",
":",
"resposta",
"=",
"analisar_retorno",
"(",
"forcar_unicode",
"(",
"retorno",
")",
",",
"funcao",
"=",
"'AssociarAssinatura'",
")",
"if",
"resposta",
".",
"EEEEE",
"not",
"in",
"(",
"'13000'",
",",
")",
"... | cb8e8815f4133d3e3d94cf526fa86767b4521ed9 |
train | RespostaSAT.atualizar_software_sat | Constrói uma :class:`RespostaSAT` para o retorno (unicode) da função
:meth:`~satcfe.base.FuncoesSAT.atualizar_software_sat`. | satcfe/resposta/padrao.py | def atualizar_software_sat(retorno):
"""Constrói uma :class:`RespostaSAT` para o retorno (unicode) da função
:meth:`~satcfe.base.FuncoesSAT.atualizar_software_sat`.
"""
resposta = analisar_retorno(forcar_unicode(retorno),
funcao='AtualizarSoftwareSAT')
if resposta... | def atualizar_software_sat(retorno):
"""Constrói uma :class:`RespostaSAT` para o retorno (unicode) da função
:meth:`~satcfe.base.FuncoesSAT.atualizar_software_sat`.
"""
resposta = analisar_retorno(forcar_unicode(retorno),
funcao='AtualizarSoftwareSAT')
if resposta... | [
"Constrói",
"uma",
":",
"class",
":",
"RespostaSAT",
"para",
"o",
"retorno",
"(",
"unicode",
")",
"da",
"função",
":",
"meth",
":",
"~satcfe",
".",
"base",
".",
"FuncoesSAT",
".",
"atualizar_software_sat",
"."
] | base4sistemas/satcfe | python | https://github.com/base4sistemas/satcfe/blob/cb8e8815f4133d3e3d94cf526fa86767b4521ed9/satcfe/resposta/padrao.py#L128-L136 | [
"def",
"atualizar_software_sat",
"(",
"retorno",
")",
":",
"resposta",
"=",
"analisar_retorno",
"(",
"forcar_unicode",
"(",
"retorno",
")",
",",
"funcao",
"=",
"'AtualizarSoftwareSAT'",
")",
"if",
"resposta",
".",
"EEEEE",
"not",
"in",
"(",
"'14000'",
",",
")"... | cb8e8815f4133d3e3d94cf526fa86767b4521ed9 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.