repo stringlengths 7 55 | path stringlengths 4 127 | func_name stringlengths 1 88 | original_string stringlengths 75 19.8k | language stringclasses 1
value | code stringlengths 75 19.8k | code_tokens list | docstring stringlengths 3 17.3k | docstring_tokens list | sha stringlengths 40 40 | url stringlengths 87 242 | partition stringclasses 1
value |
|---|---|---|---|---|---|---|---|---|---|---|---|
yamcs/yamcs-python | yamcs-client/yamcs/storage/model.py | ObjectInfo.upload | def upload(self, file_obj):
"""
Replace the content of this object.
:param file file_obj: The file (or file-like object) to upload.
"""
return self._client.upload_object(
self._instance, self._bucket, self.name, file_obj) | python | def upload(self, file_obj):
"""
Replace the content of this object.
:param file file_obj: The file (or file-like object) to upload.
"""
return self._client.upload_object(
self._instance, self._bucket, self.name, file_obj) | [
"def",
"upload",
"(",
"self",
",",
"file_obj",
")",
":",
"return",
"self",
".",
"_client",
".",
"upload_object",
"(",
"self",
".",
"_instance",
",",
"self",
".",
"_bucket",
",",
"self",
".",
"name",
",",
"file_obj",
")"
] | Replace the content of this object.
:param file file_obj: The file (or file-like object) to upload. | [
"Replace",
"the",
"content",
"of",
"this",
"object",
"."
] | 1082fee8a299010cc44416bbb7518fac0ef08b48 | https://github.com/yamcs/yamcs-python/blob/1082fee8a299010cc44416bbb7518fac0ef08b48/yamcs-client/yamcs/storage/model.py#L151-L158 | train |
raymondEhlers/pachyderm | pachyderm/utils.py | moving_average | def moving_average(arr: np.ndarray, n: int = 3) -> np.ndarray:
""" Calculate the moving overage over an array.
Algorithm from: https://stackoverflow.com/a/14314054
Args:
arr (np.ndarray): Array over which to calculate the moving average.
n (int): Number of elements over which to calculate ... | python | def moving_average(arr: np.ndarray, n: int = 3) -> np.ndarray:
""" Calculate the moving overage over an array.
Algorithm from: https://stackoverflow.com/a/14314054
Args:
arr (np.ndarray): Array over which to calculate the moving average.
n (int): Number of elements over which to calculate ... | [
"def",
"moving_average",
"(",
"arr",
":",
"np",
".",
"ndarray",
",",
"n",
":",
"int",
"=",
"3",
")",
"->",
"np",
".",
"ndarray",
":",
"ret",
"=",
"np",
".",
"cumsum",
"(",
"arr",
",",
"dtype",
"=",
"float",
")",
"ret",
"[",
"n",
":",
"]",
"="... | Calculate the moving overage over an array.
Algorithm from: https://stackoverflow.com/a/14314054
Args:
arr (np.ndarray): Array over which to calculate the moving average.
n (int): Number of elements over which to calculate the moving average. Default: 3
Returns:
np.ndarray: Moving ... | [
"Calculate",
"the",
"moving",
"overage",
"over",
"an",
"array",
"."
] | aaa1d8374fd871246290ce76f1796f2f7582b01d | https://github.com/raymondEhlers/pachyderm/blob/aaa1d8374fd871246290ce76f1796f2f7582b01d/pachyderm/utils.py#L27-L40 | train |
raymondEhlers/pachyderm | pachyderm/utils.py | recursive_getattr | def recursive_getattr(obj: Any, attr: str, *args) -> Any:
""" Recursive ``getattar``.
This can be used as a drop in for the standard ``getattr(...)``. Credit to:
https://stackoverflow.com/a/31174427
Args:
obj: Object to retrieve the attribute from.
attr: Name of the attribute, with eac... | python | def recursive_getattr(obj: Any, attr: str, *args) -> Any:
""" Recursive ``getattar``.
This can be used as a drop in for the standard ``getattr(...)``. Credit to:
https://stackoverflow.com/a/31174427
Args:
obj: Object to retrieve the attribute from.
attr: Name of the attribute, with eac... | [
"def",
"recursive_getattr",
"(",
"obj",
":",
"Any",
",",
"attr",
":",
"str",
",",
"*",
"args",
")",
"->",
"Any",
":",
"def",
"_getattr",
"(",
"obj",
",",
"attr",
")",
":",
"return",
"getattr",
"(",
"obj",
",",
"attr",
",",
"*",
"args",
")",
"retu... | Recursive ``getattar``.
This can be used as a drop in for the standard ``getattr(...)``. Credit to:
https://stackoverflow.com/a/31174427
Args:
obj: Object to retrieve the attribute from.
attr: Name of the attribute, with each successive attribute separated by a ".".
Returns:
Th... | [
"Recursive",
"getattar",
"."
] | aaa1d8374fd871246290ce76f1796f2f7582b01d | https://github.com/raymondEhlers/pachyderm/blob/aaa1d8374fd871246290ce76f1796f2f7582b01d/pachyderm/utils.py#L42-L58 | train |
raymondEhlers/pachyderm | pachyderm/utils.py | recursive_setattr | def recursive_setattr(obj: Any, attr: str, val: Any) -> Any:
""" Recusrive ``setattr``.
This can be used as a drop in for the standard ``setattr(...)``. Credit to:
https://stackoverflow.com/a/31174427
Args:
obj: Object to retrieve the attribute from.
attr: Name of the attribute, with e... | python | def recursive_setattr(obj: Any, attr: str, val: Any) -> Any:
""" Recusrive ``setattr``.
This can be used as a drop in for the standard ``setattr(...)``. Credit to:
https://stackoverflow.com/a/31174427
Args:
obj: Object to retrieve the attribute from.
attr: Name of the attribute, with e... | [
"def",
"recursive_setattr",
"(",
"obj",
":",
"Any",
",",
"attr",
":",
"str",
",",
"val",
":",
"Any",
")",
"->",
"Any",
":",
"pre",
",",
"_",
",",
"post",
"=",
"attr",
".",
"rpartition",
"(",
"'.'",
")",
"return",
"setattr",
"(",
"recursive_getattr",
... | Recusrive ``setattr``.
This can be used as a drop in for the standard ``setattr(...)``. Credit to:
https://stackoverflow.com/a/31174427
Args:
obj: Object to retrieve the attribute from.
attr: Name of the attribute, with each successive attribute separated by a ".".
value: Value to ... | [
"Recusrive",
"setattr",
"."
] | aaa1d8374fd871246290ce76f1796f2f7582b01d | https://github.com/raymondEhlers/pachyderm/blob/aaa1d8374fd871246290ce76f1796f2f7582b01d/pachyderm/utils.py#L60-L76 | train |
raymondEhlers/pachyderm | pachyderm/utils.py | recursive_getitem | def recursive_getitem(d: Mapping[str, Any], keys: Union[str, Sequence[str]]) -> Any:
""" Recursively retrieve an item from a nested dict.
Credit to: https://stackoverflow.com/a/52260663
Args:
d: Mapping of strings to objects.
keys: Names of the keys under which the object is stored. Can al... | python | def recursive_getitem(d: Mapping[str, Any], keys: Union[str, Sequence[str]]) -> Any:
""" Recursively retrieve an item from a nested dict.
Credit to: https://stackoverflow.com/a/52260663
Args:
d: Mapping of strings to objects.
keys: Names of the keys under which the object is stored. Can al... | [
"def",
"recursive_getitem",
"(",
"d",
":",
"Mapping",
"[",
"str",
",",
"Any",
"]",
",",
"keys",
":",
"Union",
"[",
"str",
",",
"Sequence",
"[",
"str",
"]",
"]",
")",
"->",
"Any",
":",
"if",
"isinstance",
"(",
"keys",
",",
"str",
")",
":",
"return... | Recursively retrieve an item from a nested dict.
Credit to: https://stackoverflow.com/a/52260663
Args:
d: Mapping of strings to objects.
keys: Names of the keys under which the object is stored. Can also just be a single string.
Returns:
The object stored under the keys.
Raises... | [
"Recursively",
"retrieve",
"an",
"item",
"from",
"a",
"nested",
"dict",
"."
] | aaa1d8374fd871246290ce76f1796f2f7582b01d | https://github.com/raymondEhlers/pachyderm/blob/aaa1d8374fd871246290ce76f1796f2f7582b01d/pachyderm/utils.py#L78-L95 | train |
raymondEhlers/pachyderm | pachyderm/utils.py | get_array_for_fit | def get_array_for_fit(observables: dict, track_pt_bin: int, jet_pt_bin: int) -> histogram.Histogram1D:
""" Get a Histogram1D associated with the selected jet and track pt bins.
This is often used to retrieve data for fitting.
Args:
observables (dict): The observables from which the hist should be ... | python | def get_array_for_fit(observables: dict, track_pt_bin: int, jet_pt_bin: int) -> histogram.Histogram1D:
""" Get a Histogram1D associated with the selected jet and track pt bins.
This is often used to retrieve data for fitting.
Args:
observables (dict): The observables from which the hist should be ... | [
"def",
"get_array_for_fit",
"(",
"observables",
":",
"dict",
",",
"track_pt_bin",
":",
"int",
",",
"jet_pt_bin",
":",
"int",
")",
"->",
"histogram",
".",
"Histogram1D",
":",
"for",
"name",
",",
"observable",
"in",
"observables",
".",
"items",
"(",
")",
":"... | Get a Histogram1D associated with the selected jet and track pt bins.
This is often used to retrieve data for fitting.
Args:
observables (dict): The observables from which the hist should be retrieved.
track_pt_bin (int): Track pt bin of the desired hist.
jet_ptbin (int): Jet pt bin of... | [
"Get",
"a",
"Histogram1D",
"associated",
"with",
"the",
"selected",
"jet",
"and",
"track",
"pt",
"bins",
"."
] | aaa1d8374fd871246290ce76f1796f2f7582b01d | https://github.com/raymondEhlers/pachyderm/blob/aaa1d8374fd871246290ce76f1796f2f7582b01d/pachyderm/utils.py#L97-L115 | train |
lowandrew/OLCTools | spadespipeline/CHAS.py | CHAS.epcrparsethreads | def epcrparsethreads(self):
"""
Parse the ePCR results, and run BLAST on the parsed results
"""
from Bio import SeqIO
# Create the threads for the BLAST analysis
for sample in self.metadata:
if sample.general.bestassemblyfile != 'NA':
threads =... | python | def epcrparsethreads(self):
"""
Parse the ePCR results, and run BLAST on the parsed results
"""
from Bio import SeqIO
# Create the threads for the BLAST analysis
for sample in self.metadata:
if sample.general.bestassemblyfile != 'NA':
threads =... | [
"def",
"epcrparsethreads",
"(",
"self",
")",
":",
"from",
"Bio",
"import",
"SeqIO",
"for",
"sample",
"in",
"self",
".",
"metadata",
":",
"if",
"sample",
".",
"general",
".",
"bestassemblyfile",
"!=",
"'NA'",
":",
"threads",
"=",
"Thread",
"(",
"target",
... | Parse the ePCR results, and run BLAST on the parsed results | [
"Parse",
"the",
"ePCR",
"results",
"and",
"run",
"BLAST",
"on",
"the",
"parsed",
"results"
] | 88aa90ac85f84d0bbeb03e43c29b0a9d36e4ce2a | https://github.com/lowandrew/OLCTools/blob/88aa90ac85f84d0bbeb03e43c29b0a9d36e4ce2a/spadespipeline/CHAS.py#L125-L154 | train |
lowandrew/OLCTools | spadespipeline/CHAS.py | CHAS.epcrparse | def epcrparse(self):
"""
Run BLAST, and record results to the object
"""
from Bio.Blast.Applications import NcbiblastnCommandline
while True:
sample, record, line = self.epcrparsequeue.get()
# Split the data on tabs
gene, chromosome, strand, st... | python | def epcrparse(self):
"""
Run BLAST, and record results to the object
"""
from Bio.Blast.Applications import NcbiblastnCommandline
while True:
sample, record, line = self.epcrparsequeue.get()
# Split the data on tabs
gene, chromosome, strand, st... | [
"def",
"epcrparse",
"(",
"self",
")",
":",
"from",
"Bio",
".",
"Blast",
".",
"Applications",
"import",
"NcbiblastnCommandline",
"while",
"True",
":",
"sample",
",",
"record",
",",
"line",
"=",
"self",
".",
"epcrparsequeue",
".",
"get",
"(",
")",
"gene",
... | Run BLAST, and record results to the object | [
"Run",
"BLAST",
"and",
"record",
"results",
"to",
"the",
"object"
] | 88aa90ac85f84d0bbeb03e43c29b0a9d36e4ce2a | https://github.com/lowandrew/OLCTools/blob/88aa90ac85f84d0bbeb03e43c29b0a9d36e4ce2a/spadespipeline/CHAS.py#L156-L200 | train |
lowandrew/OLCTools | spadespipeline/CHAS.py | CHAS.report | def report(self):
"""
Create reports of the findings
"""
# Initialise a variable to store the results
data = ''
for sample in self.metadata:
if sample[self.analysistype].primers != 'NA':
# Set the name of the strain-specific report
... | python | def report(self):
"""
Create reports of the findings
"""
# Initialise a variable to store the results
data = ''
for sample in self.metadata:
if sample[self.analysistype].primers != 'NA':
# Set the name of the strain-specific report
... | [
"def",
"report",
"(",
"self",
")",
":",
"data",
"=",
"''",
"for",
"sample",
"in",
"self",
".",
"metadata",
":",
"if",
"sample",
"[",
"self",
".",
"analysistype",
"]",
".",
"primers",
"!=",
"'NA'",
":",
"sample",
"[",
"self",
".",
"analysistype",
"]",... | Create reports of the findings | [
"Create",
"reports",
"of",
"the",
"findings"
] | 88aa90ac85f84d0bbeb03e43c29b0a9d36e4ce2a | https://github.com/lowandrew/OLCTools/blob/88aa90ac85f84d0bbeb03e43c29b0a9d36e4ce2a/spadespipeline/CHAS.py#L219-L254 | train |
JukeboxPipeline/jukeboxmaya | src/jukeboxmaya/mayapylauncher.py | setup_environment | def setup_environment():
"""Set up neccessary environment variables
This appends all path of sys.path to the python path
so mayapy will find all installed modules.
We have to make sure, that we use maya libs instead of
libs of the virtual env. So we insert all the libs for mayapy
first.
:r... | python | def setup_environment():
"""Set up neccessary environment variables
This appends all path of sys.path to the python path
so mayapy will find all installed modules.
We have to make sure, that we use maya libs instead of
libs of the virtual env. So we insert all the libs for mayapy
first.
:r... | [
"def",
"setup_environment",
"(",
")",
":",
"osinter",
"=",
"ostool",
".",
"get_interface",
"(",
")",
"pypath",
"=",
"osinter",
".",
"get_maya_envpath",
"(",
")",
"for",
"p",
"in",
"sys",
".",
"path",
":",
"pypath",
"=",
"os",
".",
"pathsep",
".",
"join... | Set up neccessary environment variables
This appends all path of sys.path to the python path
so mayapy will find all installed modules.
We have to make sure, that we use maya libs instead of
libs of the virtual env. So we insert all the libs for mayapy
first.
:returns: None
:rtype: None
... | [
"Set",
"up",
"neccessary",
"environment",
"variables"
] | c8d6318d53cdb5493453c4a6b65ef75bdb2d5f2c | https://github.com/JukeboxPipeline/jukeboxmaya/blob/c8d6318d53cdb5493453c4a6b65ef75bdb2d5f2c/src/jukeboxmaya/mayapylauncher.py#L28-L45 | train |
JukeboxPipeline/jukeboxmaya | src/jukeboxmaya/mayapylauncher.py | execute_mayapy | def execute_mayapy(args, wait=True):
"""Execute mayapython with the given arguments, capture and return the output
:param args: arguments for the maya python intepreter
:type args: list
:param wait: If True, waits for the process to finish and returns the returncode.
If False, just ret... | python | def execute_mayapy(args, wait=True):
"""Execute mayapython with the given arguments, capture and return the output
:param args: arguments for the maya python intepreter
:type args: list
:param wait: If True, waits for the process to finish and returns the returncode.
If False, just ret... | [
"def",
"execute_mayapy",
"(",
"args",
",",
"wait",
"=",
"True",
")",
":",
"osinter",
"=",
"ostool",
".",
"get_interface",
"(",
")",
"mayapy",
"=",
"osinter",
".",
"get_maya_python",
"(",
")",
"allargs",
"=",
"[",
"mayapy",
"]",
"allargs",
".",
"extend",
... | Execute mayapython with the given arguments, capture and return the output
:param args: arguments for the maya python intepreter
:type args: list
:param wait: If True, waits for the process to finish and returns the returncode.
If False, just returns the process
:type wait: bool
:r... | [
"Execute",
"mayapython",
"with",
"the",
"given",
"arguments",
"capture",
"and",
"return",
"the",
"output"
] | c8d6318d53cdb5493453c4a6b65ef75bdb2d5f2c | https://github.com/JukeboxPipeline/jukeboxmaya/blob/c8d6318d53cdb5493453c4a6b65ef75bdb2d5f2c/src/jukeboxmaya/mayapylauncher.py#L48-L71 | train |
portfors-lab/sparkle | sparkle/gui/stim/stim_detail.py | StimDetailWidget.setDoc | def setDoc(self, doc):
"""Presents the documentation
:param doc: documentation for StimulusModel. i.e. returned from
:meth:`componentDoc<sparkle.stim.stimulus_model.StimulusModel.componentDoc>`
or :meth:`templateDoc<sparkle.stim.stimulus_model.StimulusModel.templateDoc>`
"""
... | python | def setDoc(self, doc):
"""Presents the documentation
:param doc: documentation for StimulusModel. i.e. returned from
:meth:`componentDoc<sparkle.stim.stimulus_model.StimulusModel.componentDoc>`
or :meth:`templateDoc<sparkle.stim.stimulus_model.StimulusModel.templateDoc>`
"""
... | [
"def",
"setDoc",
"(",
"self",
",",
"doc",
")",
":",
"self",
".",
"ui",
".",
"overAtten",
".",
"setNum",
"(",
"doc",
"[",
"'overloaded_attenuation'",
"]",
")",
"self",
".",
"ui",
".",
"componentDetails",
".",
"clearDoc",
"(",
")",
"self",
".",
"ui",
"... | Presents the documentation
:param doc: documentation for StimulusModel. i.e. returned from
:meth:`componentDoc<sparkle.stim.stimulus_model.StimulusModel.componentDoc>`
or :meth:`templateDoc<sparkle.stim.stimulus_model.StimulusModel.templateDoc>` | [
"Presents",
"the",
"documentation"
] | 5fad1cf2bec58ec6b15d91da20f6236a74826110 | https://github.com/portfors-lab/sparkle/blob/5fad1cf2bec58ec6b15d91da20f6236a74826110/sparkle/gui/stim/stim_detail.py#L24-L36 | train |
sirfoga/pyhal | hal/cvs/versioning.py | Version.increase_by_changes | def increase_by_changes(self, changes_amount, ratio):
"""Increase version by amount of changes
:param changes_amount: Number of changes done
:param ratio: Ratio changes
:return: Increases version accordingly to changes
"""
increases = round(changes_amount * ratio)
... | python | def increase_by_changes(self, changes_amount, ratio):
"""Increase version by amount of changes
:param changes_amount: Number of changes done
:param ratio: Ratio changes
:return: Increases version accordingly to changes
"""
increases = round(changes_amount * ratio)
... | [
"def",
"increase_by_changes",
"(",
"self",
",",
"changes_amount",
",",
"ratio",
")",
":",
"increases",
"=",
"round",
"(",
"changes_amount",
"*",
"ratio",
")",
"return",
"self",
".",
"increase",
"(",
"int",
"(",
"increases",
")",
")"
] | Increase version by amount of changes
:param changes_amount: Number of changes done
:param ratio: Ratio changes
:return: Increases version accordingly to changes | [
"Increase",
"version",
"by",
"amount",
"of",
"changes"
] | 4394d8a1f7e45bea28a255ec390f4962ee64d33a | https://github.com/sirfoga/pyhal/blob/4394d8a1f7e45bea28a255ec390f4962ee64d33a/hal/cvs/versioning.py#L218-L226 | train |
JukeboxPipeline/jukeboxmaya | src/jukeboxmaya/gui/main.py | wrap_maya_ui | def wrap_maya_ui(mayaname):
"""Given the name of a Maya UI element of any type,
return the corresponding QWidget or QAction.
If the object does not exist, returns None
:param mayaname: the maya ui element
:type mayaname: str
:returns: the wraped object
:rtype: QObject | None
:raises: No... | python | def wrap_maya_ui(mayaname):
"""Given the name of a Maya UI element of any type,
return the corresponding QWidget or QAction.
If the object does not exist, returns None
:param mayaname: the maya ui element
:type mayaname: str
:returns: the wraped object
:rtype: QObject | None
:raises: No... | [
"def",
"wrap_maya_ui",
"(",
"mayaname",
")",
":",
"ptr",
"=",
"apiUI",
".",
"MQtUtil",
".",
"findControl",
"(",
"mayaname",
")",
"if",
"ptr",
"is",
"None",
":",
"ptr",
"=",
"apiUI",
".",
"MQtUtil",
".",
"findLayout",
"(",
"mayaname",
")",
"if",
"ptr",
... | Given the name of a Maya UI element of any type,
return the corresponding QWidget or QAction.
If the object does not exist, returns None
:param mayaname: the maya ui element
:type mayaname: str
:returns: the wraped object
:rtype: QObject | None
:raises: None | [
"Given",
"the",
"name",
"of",
"a",
"Maya",
"UI",
"element",
"of",
"any",
"type",
"return",
"the",
"corresponding",
"QWidget",
"or",
"QAction",
".",
"If",
"the",
"object",
"does",
"not",
"exist",
"returns",
"None"
] | c8d6318d53cdb5493453c4a6b65ef75bdb2d5f2c | https://github.com/JukeboxPipeline/jukeboxmaya/blob/c8d6318d53cdb5493453c4a6b65ef75bdb2d5f2c/src/jukeboxmaya/gui/main.py#L6-L23 | train |
NoviceLive/intellicoder | intellicoder/intellisense/database.py | IntelliSense.query_args | def query_args(self, name):
"""Query the return type and argument list of the specified
function in the specified database.
"""
sql = 'select type, id from code_items ' \
'where kind = 22 and name = ?'
logging.debug('%s %s', sql, (name,))
self.cursor.execute... | python | def query_args(self, name):
"""Query the return type and argument list of the specified
function in the specified database.
"""
sql = 'select type, id from code_items ' \
'where kind = 22 and name = ?'
logging.debug('%s %s', sql, (name,))
self.cursor.execute... | [
"def",
"query_args",
"(",
"self",
",",
"name",
")",
":",
"sql",
"=",
"'select type, id from code_items '",
"'where kind = 22 and name = ?'",
"logging",
".",
"debug",
"(",
"'%s %s'",
",",
"sql",
",",
"(",
"name",
",",
")",
")",
"self",
".",
"cursor",
".",
"ex... | Query the return type and argument list of the specified
function in the specified database. | [
"Query",
"the",
"return",
"type",
"and",
"argument",
"list",
"of",
"the",
"specified",
"function",
"in",
"the",
"specified",
"database",
"."
] | 6cac5ebfce65c370dbebe47756a1789b120ef982 | https://github.com/NoviceLive/intellicoder/blob/6cac5ebfce65c370dbebe47756a1789b120ef982/intellicoder/intellisense/database.py#L100-L121 | train |
NoviceLive/intellicoder | intellicoder/intellisense/database.py | IntelliSense.query_info | def query_info(self, name, like, kind):
"""Query the information of the name in the database."""
kind = self._make_kind_id(kind)
# Database from VS2015 does not have assoc_text.
#
# sql = 'select name, kind, file_id, type, assoc_text ' \
# 'from code_items ' \
... | python | def query_info(self, name, like, kind):
"""Query the information of the name in the database."""
kind = self._make_kind_id(kind)
# Database from VS2015 does not have assoc_text.
#
# sql = 'select name, kind, file_id, type, assoc_text ' \
# 'from code_items ' \
... | [
"def",
"query_info",
"(",
"self",
",",
"name",
",",
"like",
",",
"kind",
")",
":",
"kind",
"=",
"self",
".",
"_make_kind_id",
"(",
"kind",
")",
"sql",
"=",
"'select name, kind, file_id, type '",
"'from code_items '",
"'where name {} ?'",
".",
"format",
"(",
"'... | Query the information of the name in the database. | [
"Query",
"the",
"information",
"of",
"the",
"name",
"in",
"the",
"database",
"."
] | 6cac5ebfce65c370dbebe47756a1789b120ef982 | https://github.com/NoviceLive/intellicoder/blob/6cac5ebfce65c370dbebe47756a1789b120ef982/intellicoder/intellisense/database.py#L124-L146 | train |
NoviceLive/intellicoder | intellicoder/intellisense/database.py | IntelliSense.query_names | def query_names(self, name, like, kind):
"""
Query function declarations in the files.
"""
kind = self._make_kind_id(kind)
sql = 'select id, name from files ' \
'where leaf_name {} ?'.format('like' if like else '=')
args = (name,)
if like:
... | python | def query_names(self, name, like, kind):
"""
Query function declarations in the files.
"""
kind = self._make_kind_id(kind)
sql = 'select id, name from files ' \
'where leaf_name {} ?'.format('like' if like else '=')
args = (name,)
if like:
... | [
"def",
"query_names",
"(",
"self",
",",
"name",
",",
"like",
",",
"kind",
")",
":",
"kind",
"=",
"self",
".",
"_make_kind_id",
"(",
"kind",
")",
"sql",
"=",
"'select id, name from files '",
"'where leaf_name {} ?'",
".",
"format",
"(",
"'like'",
"if",
"like"... | Query function declarations in the files. | [
"Query",
"function",
"declarations",
"in",
"the",
"files",
"."
] | 6cac5ebfce65c370dbebe47756a1789b120ef982 | https://github.com/NoviceLive/intellicoder/blob/6cac5ebfce65c370dbebe47756a1789b120ef982/intellicoder/intellisense/database.py#L149-L174 | train |
NoviceLive/intellicoder | intellicoder/intellisense/database.py | IntelliSense.query_struct | def query_struct(self, name):
"""Query struct."""
sql = 'select id, file_id, name from code_items '\
'where name = ?'
self.cursor.execute(sql, (name,))
for i in self.cursor.fetchall():
sql = 'select id, type, name from code_items ' \
'where par... | python | def query_struct(self, name):
"""Query struct."""
sql = 'select id, file_id, name from code_items '\
'where name = ?'
self.cursor.execute(sql, (name,))
for i in self.cursor.fetchall():
sql = 'select id, type, name from code_items ' \
'where par... | [
"def",
"query_struct",
"(",
"self",
",",
"name",
")",
":",
"sql",
"=",
"'select id, file_id, name from code_items '",
"'where name = ?'",
"self",
".",
"cursor",
".",
"execute",
"(",
"sql",
",",
"(",
"name",
",",
")",
")",
"for",
"i",
"in",
"self",
".",
"cu... | Query struct. | [
"Query",
"struct",
"."
] | 6cac5ebfce65c370dbebe47756a1789b120ef982 | https://github.com/NoviceLive/intellicoder/blob/6cac5ebfce65c370dbebe47756a1789b120ef982/intellicoder/intellisense/database.py#L177-L189 | train |
NoviceLive/intellicoder | intellicoder/intellisense/database.py | IntelliSense.file_id_to_name | def file_id_to_name(self, file_id):
"""Convert a file id to the file name."""
sql = 'select name from files where id = ?'
logging.debug('%s %s', sql, (file_id,))
self.cursor.execute(sql, (file_id,))
name = self.cursor.fetchone()
if name:
return name[0]
... | python | def file_id_to_name(self, file_id):
"""Convert a file id to the file name."""
sql = 'select name from files where id = ?'
logging.debug('%s %s', sql, (file_id,))
self.cursor.execute(sql, (file_id,))
name = self.cursor.fetchone()
if name:
return name[0]
... | [
"def",
"file_id_to_name",
"(",
"self",
",",
"file_id",
")",
":",
"sql",
"=",
"'select name from files where id = ?'",
"logging",
".",
"debug",
"(",
"'%s %s'",
",",
"sql",
",",
"(",
"file_id",
",",
")",
")",
"self",
".",
"cursor",
".",
"execute",
"(",
"sql"... | Convert a file id to the file name. | [
"Convert",
"a",
"file",
"id",
"to",
"the",
"file",
"name",
"."
] | 6cac5ebfce65c370dbebe47756a1789b120ef982 | https://github.com/NoviceLive/intellicoder/blob/6cac5ebfce65c370dbebe47756a1789b120ef982/intellicoder/intellisense/database.py#L191-L199 | train |
NoviceLive/intellicoder | intellicoder/intellisense/database.py | IntelliSense._make_kind_id | def _make_kind_id(self, name_or_id):
"""Make kind_id from kind_name or kind_id."""
if not name_or_id:
return None
if name_or_id.isdigit():
return name_or_id
return self.kind_name_to_id(name_or_id) | python | def _make_kind_id(self, name_or_id):
"""Make kind_id from kind_name or kind_id."""
if not name_or_id:
return None
if name_or_id.isdigit():
return name_or_id
return self.kind_name_to_id(name_or_id) | [
"def",
"_make_kind_id",
"(",
"self",
",",
"name_or_id",
")",
":",
"if",
"not",
"name_or_id",
":",
"return",
"None",
"if",
"name_or_id",
".",
"isdigit",
"(",
")",
":",
"return",
"name_or_id",
"return",
"self",
".",
"kind_name_to_id",
"(",
"name_or_id",
")"
] | Make kind_id from kind_name or kind_id. | [
"Make",
"kind_id",
"from",
"kind_name",
"or",
"kind_id",
"."
] | 6cac5ebfce65c370dbebe47756a1789b120ef982 | https://github.com/NoviceLive/intellicoder/blob/6cac5ebfce65c370dbebe47756a1789b120ef982/intellicoder/intellisense/database.py#L201-L207 | train |
NoviceLive/intellicoder | intellicoder/intellisense/database.py | IntelliSense.query_kinds | def query_kinds(self, kind):
"""Query kinds."""
logging.debug(_('querying %s'), kind)
if kind is None:
return self._kind_id_to_name.items()
if kind.isdigit():
kind_name = self.kind_id_to_name(int(kind))
if kind_name:
kind = (kind, kind_... | python | def query_kinds(self, kind):
"""Query kinds."""
logging.debug(_('querying %s'), kind)
if kind is None:
return self._kind_id_to_name.items()
if kind.isdigit():
kind_name = self.kind_id_to_name(int(kind))
if kind_name:
kind = (kind, kind_... | [
"def",
"query_kinds",
"(",
"self",
",",
"kind",
")",
":",
"logging",
".",
"debug",
"(",
"_",
"(",
"'querying %s'",
")",
",",
"kind",
")",
"if",
"kind",
"is",
"None",
":",
"return",
"self",
".",
"_kind_id_to_name",
".",
"items",
"(",
")",
"if",
"kind"... | Query kinds. | [
"Query",
"kinds",
"."
] | 6cac5ebfce65c370dbebe47756a1789b120ef982 | https://github.com/NoviceLive/intellicoder/blob/6cac5ebfce65c370dbebe47756a1789b120ef982/intellicoder/intellisense/database.py#L210-L229 | train |
NoviceLive/intellicoder | intellicoder/intellisense/database.py | IntelliSense._init_kind_converter | def _init_kind_converter(self):
"""Make a dictionary mapping kind ids to the names."""
from ..utils import invert_dict
kinds = self.session.query(Kind).all()
self._kind_id_to_name = {
kind.id: kind.name for kind in kinds
}
self._kind_name_to_id = invert_dict(... | python | def _init_kind_converter(self):
"""Make a dictionary mapping kind ids to the names."""
from ..utils import invert_dict
kinds = self.session.query(Kind).all()
self._kind_id_to_name = {
kind.id: kind.name for kind in kinds
}
self._kind_name_to_id = invert_dict(... | [
"def",
"_init_kind_converter",
"(",
"self",
")",
":",
"from",
".",
".",
"utils",
"import",
"invert_dict",
"kinds",
"=",
"self",
".",
"session",
".",
"query",
"(",
"Kind",
")",
".",
"all",
"(",
")",
"self",
".",
"_kind_id_to_name",
"=",
"{",
"kind",
"."... | Make a dictionary mapping kind ids to the names. | [
"Make",
"a",
"dictionary",
"mapping",
"kind",
"ids",
"to",
"the",
"names",
"."
] | 6cac5ebfce65c370dbebe47756a1789b120ef982 | https://github.com/NoviceLive/intellicoder/blob/6cac5ebfce65c370dbebe47756a1789b120ef982/intellicoder/intellisense/database.py#L239-L247 | train |
NoviceLive/intellicoder | intellicoder/intellisense/database.py | SenseWithExport.make_export | def make_export(self, exports):
"""Populate library exported function data."""
sql = 'drop table if exists export'
logging.debug(sql)
self.cursor.execute(sql)
sql = 'create table if not exists export ' \
'(func text unique, module text)'
logging.debug(sql)
... | python | def make_export(self, exports):
"""Populate library exported function data."""
sql = 'drop table if exists export'
logging.debug(sql)
self.cursor.execute(sql)
sql = 'create table if not exists export ' \
'(func text unique, module text)'
logging.debug(sql)
... | [
"def",
"make_export",
"(",
"self",
",",
"exports",
")",
":",
"sql",
"=",
"'drop table if exists export'",
"logging",
".",
"debug",
"(",
"sql",
")",
"self",
".",
"cursor",
".",
"execute",
"(",
"sql",
")",
"sql",
"=",
"'create table if not exists export '",
"'(f... | Populate library exported function data. | [
"Populate",
"library",
"exported",
"function",
"data",
"."
] | 6cac5ebfce65c370dbebe47756a1789b120ef982 | https://github.com/NoviceLive/intellicoder/blob/6cac5ebfce65c370dbebe47756a1789b120ef982/intellicoder/intellisense/database.py#L267-L285 | train |
NoviceLive/intellicoder | intellicoder/intellisense/database.py | SenseWithExport.query_func_module | def query_func_module(self, func):
"""Query the module name of the specified function."""
exp = self.session.query(Export).filter_by(
func=func).first()
if exp:
return exp
logging.debug(_('Function not found: %s'), func)
alt = func + 'A'
exp = self... | python | def query_func_module(self, func):
"""Query the module name of the specified function."""
exp = self.session.query(Export).filter_by(
func=func).first()
if exp:
return exp
logging.debug(_('Function not found: %s'), func)
alt = func + 'A'
exp = self... | [
"def",
"query_func_module",
"(",
"self",
",",
"func",
")",
":",
"exp",
"=",
"self",
".",
"session",
".",
"query",
"(",
"Export",
")",
".",
"filter_by",
"(",
"func",
"=",
"func",
")",
".",
"first",
"(",
")",
"if",
"exp",
":",
"return",
"exp",
"loggi... | Query the module name of the specified function. | [
"Query",
"the",
"module",
"name",
"of",
"the",
"specified",
"function",
"."
] | 6cac5ebfce65c370dbebe47756a1789b120ef982 | https://github.com/NoviceLive/intellicoder/blob/6cac5ebfce65c370dbebe47756a1789b120ef982/intellicoder/intellisense/database.py#L287-L301 | train |
NoviceLive/intellicoder | intellicoder/intellisense/database.py | SenseWithExport.query_module_funcs | def query_module_funcs(self, module):
"""Query the functions in the specified module."""
funcs = self.session.query(Export).filter_by(
module=module).all()
return funcs | python | def query_module_funcs(self, module):
"""Query the functions in the specified module."""
funcs = self.session.query(Export).filter_by(
module=module).all()
return funcs | [
"def",
"query_module_funcs",
"(",
"self",
",",
"module",
")",
":",
"funcs",
"=",
"self",
".",
"session",
".",
"query",
"(",
"Export",
")",
".",
"filter_by",
"(",
"module",
"=",
"module",
")",
".",
"all",
"(",
")",
"return",
"funcs"
] | Query the functions in the specified module. | [
"Query",
"the",
"functions",
"in",
"the",
"specified",
"module",
"."
] | 6cac5ebfce65c370dbebe47756a1789b120ef982 | https://github.com/NoviceLive/intellicoder/blob/6cac5ebfce65c370dbebe47756a1789b120ef982/intellicoder/intellisense/database.py#L303-L307 | train |
yamcs/yamcs-python | yamcs-client/yamcs/tmtc/client.py | _build_named_object_ids | def _build_named_object_ids(parameters):
"""Builds a list of NamedObjectId."""
if isinstance(parameters, str):
return [_build_named_object_id(parameters)]
return [_build_named_object_id(parameter) for parameter in parameters] | python | def _build_named_object_ids(parameters):
"""Builds a list of NamedObjectId."""
if isinstance(parameters, str):
return [_build_named_object_id(parameters)]
return [_build_named_object_id(parameter) for parameter in parameters] | [
"def",
"_build_named_object_ids",
"(",
"parameters",
")",
":",
"if",
"isinstance",
"(",
"parameters",
",",
"str",
")",
":",
"return",
"[",
"_build_named_object_id",
"(",
"parameters",
")",
"]",
"return",
"[",
"_build_named_object_id",
"(",
"parameter",
")",
"for... | Builds a list of NamedObjectId. | [
"Builds",
"a",
"list",
"of",
"NamedObjectId",
"."
] | 1082fee8a299010cc44416bbb7518fac0ef08b48 | https://github.com/yamcs/yamcs-python/blob/1082fee8a299010cc44416bbb7518fac0ef08b48/yamcs-client/yamcs/tmtc/client.py#L102-L106 | train |
yamcs/yamcs-python | yamcs-client/yamcs/tmtc/client.py | _build_command_ids | def _build_command_ids(issued_commands):
"""Builds a list of CommandId."""
if isinstance(issued_commands, IssuedCommand):
entry = issued_commands._proto.commandQueueEntry
return [entry.cmdId]
else:
return [issued_command._proto.commandQueueEntry.cmdId
for issued_comma... | python | def _build_command_ids(issued_commands):
"""Builds a list of CommandId."""
if isinstance(issued_commands, IssuedCommand):
entry = issued_commands._proto.commandQueueEntry
return [entry.cmdId]
else:
return [issued_command._proto.commandQueueEntry.cmdId
for issued_comma... | [
"def",
"_build_command_ids",
"(",
"issued_commands",
")",
":",
"if",
"isinstance",
"(",
"issued_commands",
",",
"IssuedCommand",
")",
":",
"entry",
"=",
"issued_commands",
".",
"_proto",
".",
"commandQueueEntry",
"return",
"[",
"entry",
".",
"cmdId",
"]",
"else"... | Builds a list of CommandId. | [
"Builds",
"a",
"list",
"of",
"CommandId",
"."
] | 1082fee8a299010cc44416bbb7518fac0ef08b48 | https://github.com/yamcs/yamcs-python/blob/1082fee8a299010cc44416bbb7518fac0ef08b48/yamcs-client/yamcs/tmtc/client.py#L110-L117 | train |
yamcs/yamcs-python | yamcs-client/yamcs/tmtc/client.py | CommandHistorySubscription._cache_key | def _cache_key(cmd_id):
"""commandId is a tuple. Make a 'unique' key for it."""
return '{}__{}__{}__{}'.format(
cmd_id.generationTime, cmd_id.origin, cmd_id.sequenceNumber,
cmd_id.commandName) | python | def _cache_key(cmd_id):
"""commandId is a tuple. Make a 'unique' key for it."""
return '{}__{}__{}__{}'.format(
cmd_id.generationTime, cmd_id.origin, cmd_id.sequenceNumber,
cmd_id.commandName) | [
"def",
"_cache_key",
"(",
"cmd_id",
")",
":",
"return",
"'{}__{}__{}__{}'",
".",
"format",
"(",
"cmd_id",
".",
"generationTime",
",",
"cmd_id",
".",
"origin",
",",
"cmd_id",
".",
"sequenceNumber",
",",
"cmd_id",
".",
"commandName",
")"
] | commandId is a tuple. Make a 'unique' key for it. | [
"commandId",
"is",
"a",
"tuple",
".",
"Make",
"a",
"unique",
"key",
"for",
"it",
"."
] | 1082fee8a299010cc44416bbb7518fac0ef08b48 | https://github.com/yamcs/yamcs-python/blob/1082fee8a299010cc44416bbb7518fac0ef08b48/yamcs-client/yamcs/tmtc/client.py#L203-L207 | train |
yamcs/yamcs-python | yamcs-client/yamcs/tmtc/client.py | CommandHistorySubscription.get_command_history | def get_command_history(self, issued_command):
"""
Gets locally cached CommandHistory for the specified command.
:param .IssuedCommand issued_command: object representing a
previously issued command.
:rtype: .CommandHistory
"""
... | python | def get_command_history(self, issued_command):
"""
Gets locally cached CommandHistory for the specified command.
:param .IssuedCommand issued_command: object representing a
previously issued command.
:rtype: .CommandHistory
"""
... | [
"def",
"get_command_history",
"(",
"self",
",",
"issued_command",
")",
":",
"entry",
"=",
"issued_command",
".",
"_proto",
".",
"commandQueueEntry",
"key",
"=",
"self",
".",
"_cache_key",
"(",
"entry",
".",
"cmdId",
")",
"if",
"key",
"in",
"self",
".",
"_c... | Gets locally cached CommandHistory for the specified command.
:param .IssuedCommand issued_command: object representing a
previously issued command.
:rtype: .CommandHistory | [
"Gets",
"locally",
"cached",
"CommandHistory",
"for",
"the",
"specified",
"command",
"."
] | 1082fee8a299010cc44416bbb7518fac0ef08b48 | https://github.com/yamcs/yamcs-python/blob/1082fee8a299010cc44416bbb7518fac0ef08b48/yamcs-client/yamcs/tmtc/client.py#L219-L232 | train |
yamcs/yamcs-python | yamcs-client/yamcs/tmtc/client.py | ParameterSubscription.add | def add(self,
parameters,
abort_on_invalid=True,
send_from_cache=True):
"""
Add one or more parameters to this subscription.
:param parameters: Parameter(s) to be added
:type parameters: Union[str, str[]]
:param bool abort_on_invalid: If ``Tru... | python | def add(self,
parameters,
abort_on_invalid=True,
send_from_cache=True):
"""
Add one or more parameters to this subscription.
:param parameters: Parameter(s) to be added
:type parameters: Union[str, str[]]
:param bool abort_on_invalid: If ``Tru... | [
"def",
"add",
"(",
"self",
",",
"parameters",
",",
"abort_on_invalid",
"=",
"True",
",",
"send_from_cache",
"=",
"True",
")",
":",
"assert",
"self",
".",
"subscription_id",
"!=",
"-",
"1",
"if",
"not",
"parameters",
":",
"return",
"options",
"=",
"web_pb2"... | Add one or more parameters to this subscription.
:param parameters: Parameter(s) to be added
:type parameters: Union[str, str[]]
:param bool abort_on_invalid: If ``True`` one invalid parameter
means any other parameter in the
... | [
"Add",
"one",
"or",
"more",
"parameters",
"to",
"this",
"subscription",
"."
] | 1082fee8a299010cc44416bbb7518fac0ef08b48 | https://github.com/yamcs/yamcs-python/blob/1082fee8a299010cc44416bbb7518fac0ef08b48/yamcs-client/yamcs/tmtc/client.py#L269-L300 | train |
yamcs/yamcs-python | yamcs-client/yamcs/tmtc/client.py | ParameterSubscription.remove | def remove(self, parameters):
"""
Remove one or more parameters from this subscription.
:param parameters: Parameter(s) to be removed
:type parameters: Union[str, str[]]
"""
# Verify that we already know our assigned subscription_id
assert self.subscription_id !... | python | def remove(self, parameters):
"""
Remove one or more parameters from this subscription.
:param parameters: Parameter(s) to be removed
:type parameters: Union[str, str[]]
"""
# Verify that we already know our assigned subscription_id
assert self.subscription_id !... | [
"def",
"remove",
"(",
"self",
",",
"parameters",
")",
":",
"assert",
"self",
".",
"subscription_id",
"!=",
"-",
"1",
"if",
"not",
"parameters",
":",
"return",
"options",
"=",
"web_pb2",
".",
"ParameterSubscriptionRequest",
"(",
")",
"options",
".",
"subscrip... | Remove one or more parameters from this subscription.
:param parameters: Parameter(s) to be removed
:type parameters: Union[str, str[]] | [
"Remove",
"one",
"or",
"more",
"parameters",
"from",
"this",
"subscription",
"."
] | 1082fee8a299010cc44416bbb7518fac0ef08b48 | https://github.com/yamcs/yamcs-python/blob/1082fee8a299010cc44416bbb7518fac0ef08b48/yamcs-client/yamcs/tmtc/client.py#L302-L320 | train |
yamcs/yamcs-python | yamcs-client/yamcs/tmtc/client.py | ProcessorClient.set_parameter_value | def set_parameter_value(self, parameter, value):
"""
Sets the value of the specified parameter.
:param str parameter: Either a fully-qualified XTCE name or an alias in the
format ``NAMESPACE/NAME``.
:param value: The value to set
"""
paramet... | python | def set_parameter_value(self, parameter, value):
"""
Sets the value of the specified parameter.
:param str parameter: Either a fully-qualified XTCE name or an alias in the
format ``NAMESPACE/NAME``.
:param value: The value to set
"""
paramet... | [
"def",
"set_parameter_value",
"(",
"self",
",",
"parameter",
",",
"value",
")",
":",
"parameter",
"=",
"adapt_name_for_rest",
"(",
"parameter",
")",
"url",
"=",
"'/processors/{}/{}/parameters{}'",
".",
"format",
"(",
"self",
".",
"_instance",
",",
"self",
".",
... | Sets the value of the specified parameter.
:param str parameter: Either a fully-qualified XTCE name or an alias in the
format ``NAMESPACE/NAME``.
:param value: The value to set | [
"Sets",
"the",
"value",
"of",
"the",
"specified",
"parameter",
"."
] | 1082fee8a299010cc44416bbb7518fac0ef08b48 | https://github.com/yamcs/yamcs-python/blob/1082fee8a299010cc44416bbb7518fac0ef08b48/yamcs-client/yamcs/tmtc/client.py#L459-L471 | train |
yamcs/yamcs-python | yamcs-client/yamcs/tmtc/client.py | ProcessorClient.set_parameter_values | def set_parameter_values(self, values):
"""
Sets the value of multiple parameters.
:param dict values: Values keyed by parameter name. This name can be either
a fully-qualified XTCE name or an alias in the format
``NAMESPACE/NAME``.
... | python | def set_parameter_values(self, values):
"""
Sets the value of multiple parameters.
:param dict values: Values keyed by parameter name. This name can be either
a fully-qualified XTCE name or an alias in the format
``NAMESPACE/NAME``.
... | [
"def",
"set_parameter_values",
"(",
"self",
",",
"values",
")",
":",
"req",
"=",
"rest_pb2",
".",
"BulkSetParameterValueRequest",
"(",
")",
"for",
"key",
"in",
"values",
":",
"item",
"=",
"req",
".",
"request",
".",
"add",
"(",
")",
"item",
".",
"id",
... | Sets the value of multiple parameters.
:param dict values: Values keyed by parameter name. This name can be either
a fully-qualified XTCE name or an alias in the format
``NAMESPACE/NAME``. | [
"Sets",
"the",
"value",
"of",
"multiple",
"parameters",
"."
] | 1082fee8a299010cc44416bbb7518fac0ef08b48 | https://github.com/yamcs/yamcs-python/blob/1082fee8a299010cc44416bbb7518fac0ef08b48/yamcs-client/yamcs/tmtc/client.py#L473-L488 | train |
yamcs/yamcs-python | yamcs-client/yamcs/tmtc/client.py | ProcessorClient.issue_command | def issue_command(self, command, args=None, dry_run=False, comment=None):
"""
Issue the given command
:param str command: Either a fully-qualified XTCE name or an alias in the
format ``NAMESPACE/NAME``.
:param dict args: named arguments (if the command requir... | python | def issue_command(self, command, args=None, dry_run=False, comment=None):
"""
Issue the given command
:param str command: Either a fully-qualified XTCE name or an alias in the
format ``NAMESPACE/NAME``.
:param dict args: named arguments (if the command requir... | [
"def",
"issue_command",
"(",
"self",
",",
"command",
",",
"args",
"=",
"None",
",",
"dry_run",
"=",
"False",
",",
"comment",
"=",
"None",
")",
":",
"req",
"=",
"rest_pb2",
".",
"IssueCommandRequest",
"(",
")",
"req",
".",
"sequenceNumber",
"=",
"Sequence... | Issue the given command
:param str command: Either a fully-qualified XTCE name or an alias in the
format ``NAMESPACE/NAME``.
:param dict args: named arguments (if the command requires these)
:param bool dry_run: If ``True`` the command is not actually issued. This
... | [
"Issue",
"the",
"given",
"command"
] | 1082fee8a299010cc44416bbb7518fac0ef08b48 | https://github.com/yamcs/yamcs-python/blob/1082fee8a299010cc44416bbb7518fac0ef08b48/yamcs-client/yamcs/tmtc/client.py#L490-L524 | train |
yamcs/yamcs-python | yamcs-client/yamcs/tmtc/client.py | ProcessorClient.list_alarms | def list_alarms(self, start=None, stop=None):
"""
Lists the active alarms.
Remark that this does not query the archive. Only active alarms on the
current processor are returned.
:param ~datetime.datetime start: Minimum trigger time of the returned alarms (inclusive)
:pa... | python | def list_alarms(self, start=None, stop=None):
"""
Lists the active alarms.
Remark that this does not query the archive. Only active alarms on the
current processor are returned.
:param ~datetime.datetime start: Minimum trigger time of the returned alarms (inclusive)
:pa... | [
"def",
"list_alarms",
"(",
"self",
",",
"start",
"=",
"None",
",",
"stop",
"=",
"None",
")",
":",
"params",
"=",
"{",
"'order'",
":",
"'asc'",
"}",
"if",
"start",
"is",
"not",
"None",
":",
"params",
"[",
"'start'",
"]",
"=",
"to_isostring",
"(",
"s... | Lists the active alarms.
Remark that this does not query the archive. Only active alarms on the
current processor are returned.
:param ~datetime.datetime start: Minimum trigger time of the returned alarms (inclusive)
:param ~datetime.datetime stop: Maximum trigger time of the returned ... | [
"Lists",
"the",
"active",
"alarms",
"."
] | 1082fee8a299010cc44416bbb7518fac0ef08b48 | https://github.com/yamcs/yamcs-python/blob/1082fee8a299010cc44416bbb7518fac0ef08b48/yamcs-client/yamcs/tmtc/client.py#L526-L552 | train |
yamcs/yamcs-python | yamcs-client/yamcs/tmtc/client.py | ProcessorClient.set_default_calibrator | def set_default_calibrator(self, parameter, type, data): # pylint: disable=W0622
"""
Apply a calibrator while processing raw values of the specified
parameter. If there is already a default calibrator associated
to this parameter, that calibrator gets replaced.
.. note::
... | python | def set_default_calibrator(self, parameter, type, data): # pylint: disable=W0622
"""
Apply a calibrator while processing raw values of the specified
parameter. If there is already a default calibrator associated
to this parameter, that calibrator gets replaced.
.. note::
... | [
"def",
"set_default_calibrator",
"(",
"self",
",",
"parameter",
",",
"type",
",",
"data",
")",
":",
"req",
"=",
"mdb_pb2",
".",
"ChangeParameterRequest",
"(",
")",
"req",
".",
"action",
"=",
"mdb_pb2",
".",
"ChangeParameterRequest",
".",
"SET_DEFAULT_CALIBRATOR"... | Apply a calibrator while processing raw values of the specified
parameter. If there is already a default calibrator associated
to this parameter, that calibrator gets replaced.
.. note::
Contextual calibrators take precedence over the default calibrator
See :meth:`set_c... | [
"Apply",
"a",
"calibrator",
"while",
"processing",
"raw",
"values",
"of",
"the",
"specified",
"parameter",
".",
"If",
"there",
"is",
"already",
"a",
"default",
"calibrator",
"associated",
"to",
"this",
"parameter",
"that",
"calibrator",
"gets",
"replaced",
"."
] | 1082fee8a299010cc44416bbb7518fac0ef08b48 | https://github.com/yamcs/yamcs-python/blob/1082fee8a299010cc44416bbb7518fac0ef08b48/yamcs-client/yamcs/tmtc/client.py#L554-L589 | train |
yamcs/yamcs-python | yamcs-client/yamcs/tmtc/client.py | ProcessorClient.reset_calibrators | def reset_calibrators(self, parameter):
"""
Reset all calibrators for the specified parameter to their original MDB value.
"""
req = mdb_pb2.ChangeParameterRequest()
req.action = mdb_pb2.ChangeParameterRequest.RESET_CALIBRATORS
calib_info = req.defaultCa... | python | def reset_calibrators(self, parameter):
"""
Reset all calibrators for the specified parameter to their original MDB value.
"""
req = mdb_pb2.ChangeParameterRequest()
req.action = mdb_pb2.ChangeParameterRequest.RESET_CALIBRATORS
calib_info = req.defaultCa... | [
"def",
"reset_calibrators",
"(",
"self",
",",
"parameter",
")",
":",
"req",
"=",
"mdb_pb2",
".",
"ChangeParameterRequest",
"(",
")",
"req",
".",
"action",
"=",
"mdb_pb2",
".",
"ChangeParameterRequest",
".",
"RESET_CALIBRATORS",
"calib_info",
"=",
"req",
".",
"... | Reset all calibrators for the specified parameter to their original MDB value. | [
"Reset",
"all",
"calibrators",
"for",
"the",
"specified",
"parameter",
"to",
"their",
"original",
"MDB",
"value",
"."
] | 1082fee8a299010cc44416bbb7518fac0ef08b48 | https://github.com/yamcs/yamcs-python/blob/1082fee8a299010cc44416bbb7518fac0ef08b48/yamcs-client/yamcs/tmtc/client.py#L642-L651 | train |
yamcs/yamcs-python | yamcs-client/yamcs/tmtc/client.py | ProcessorClient.set_default_alarm_ranges | def set_default_alarm_ranges(self, parameter, watch=None, warning=None,
distress=None, critical=None, severe=None,
min_violations=1):
"""
Generate out-of-limit alarms for a parameter using the specified
alarm ranges.
This... | python | def set_default_alarm_ranges(self, parameter, watch=None, warning=None,
distress=None, critical=None, severe=None,
min_violations=1):
"""
Generate out-of-limit alarms for a parameter using the specified
alarm ranges.
This... | [
"def",
"set_default_alarm_ranges",
"(",
"self",
",",
"parameter",
",",
"watch",
"=",
"None",
",",
"warning",
"=",
"None",
",",
"distress",
"=",
"None",
",",
"critical",
"=",
"None",
",",
"severe",
"=",
"None",
",",
"min_violations",
"=",
"1",
")",
":",
... | Generate out-of-limit alarms for a parameter using the specified
alarm ranges.
This replaces any previous default alarms on this parameter.
.. note::
Contextual range sets take precedence over the default alarm
ranges. See :meth:`set_alarm_range_sets` for setting conte... | [
"Generate",
"out",
"-",
"of",
"-",
"limit",
"alarms",
"for",
"a",
"parameter",
"using",
"the",
"specified",
"alarm",
"ranges",
"."
] | 1082fee8a299010cc44416bbb7518fac0ef08b48 | https://github.com/yamcs/yamcs-python/blob/1082fee8a299010cc44416bbb7518fac0ef08b48/yamcs-client/yamcs/tmtc/client.py#L654-L691 | train |
yamcs/yamcs-python | yamcs-client/yamcs/tmtc/client.py | ProcessorClient.reset_alarm_ranges | def reset_alarm_ranges(self, parameter):
"""
Reset all alarm limits for the specified parameter to their original MDB value.
"""
req = mdb_pb2.ChangeParameterRequest()
req.action = mdb_pb2.ChangeParameterRequest.RESET_ALARMS
url = '/mdb/{}/{}/parameters/{... | python | def reset_alarm_ranges(self, parameter):
"""
Reset all alarm limits for the specified parameter to their original MDB value.
"""
req = mdb_pb2.ChangeParameterRequest()
req.action = mdb_pb2.ChangeParameterRequest.RESET_ALARMS
url = '/mdb/{}/{}/parameters/{... | [
"def",
"reset_alarm_ranges",
"(",
"self",
",",
"parameter",
")",
":",
"req",
"=",
"mdb_pb2",
".",
"ChangeParameterRequest",
"(",
")",
"req",
".",
"action",
"=",
"mdb_pb2",
".",
"ChangeParameterRequest",
".",
"RESET_ALARMS",
"url",
"=",
"'/mdb/{}/{}/parameters/{}'"... | Reset all alarm limits for the specified parameter to their original MDB value. | [
"Reset",
"all",
"alarm",
"limits",
"for",
"the",
"specified",
"parameter",
"to",
"their",
"original",
"MDB",
"value",
"."
] | 1082fee8a299010cc44416bbb7518fac0ef08b48 | https://github.com/yamcs/yamcs-python/blob/1082fee8a299010cc44416bbb7518fac0ef08b48/yamcs-client/yamcs/tmtc/client.py#L742-L751 | train |
yamcs/yamcs-python | yamcs-client/yamcs/tmtc/client.py | ProcessorClient.acknowledge_alarm | def acknowledge_alarm(self, alarm, comment=None):
"""
Acknowledges a specific alarm associated with a parameter.
:param alarm: Alarm instance
:type alarm: :class:`.Alarm`
:param str comment: Optional comment to associate with the state
change.
... | python | def acknowledge_alarm(self, alarm, comment=None):
"""
Acknowledges a specific alarm associated with a parameter.
:param alarm: Alarm instance
:type alarm: :class:`.Alarm`
:param str comment: Optional comment to associate with the state
change.
... | [
"def",
"acknowledge_alarm",
"(",
"self",
",",
"alarm",
",",
"comment",
"=",
"None",
")",
":",
"url",
"=",
"'/processors/{}/{}/parameters{}/alarms/{}'",
".",
"format",
"(",
"self",
".",
"_instance",
",",
"self",
".",
"_processor",
",",
"alarm",
".",
"name",
"... | Acknowledges a specific alarm associated with a parameter.
:param alarm: Alarm instance
:type alarm: :class:`.Alarm`
:param str comment: Optional comment to associate with the state
change. | [
"Acknowledges",
"a",
"specific",
"alarm",
"associated",
"with",
"a",
"parameter",
"."
] | 1082fee8a299010cc44416bbb7518fac0ef08b48 | https://github.com/yamcs/yamcs-python/blob/1082fee8a299010cc44416bbb7518fac0ef08b48/yamcs-client/yamcs/tmtc/client.py#L758-L773 | train |
yamcs/yamcs-python | yamcs-client/yamcs/tmtc/client.py | ProcessorClient.create_command_history_subscription | def create_command_history_subscription(self,
issued_command=None,
on_data=None,
timeout=60):
"""
Create a new command history subscription.
:param .IssuedCommand[... | python | def create_command_history_subscription(self,
issued_command=None,
on_data=None,
timeout=60):
"""
Create a new command history subscription.
:param .IssuedCommand[... | [
"def",
"create_command_history_subscription",
"(",
"self",
",",
"issued_command",
"=",
"None",
",",
"on_data",
"=",
"None",
",",
"timeout",
"=",
"60",
")",
":",
"options",
"=",
"web_pb2",
".",
"CommandHistorySubscriptionRequest",
"(",
")",
"options",
".",
"ignor... | Create a new command history subscription.
:param .IssuedCommand[] issued_command: (Optional) Previously issued
commands. If not provided updates
from any command are received.
:param on_data: Function that ... | [
"Create",
"a",
"new",
"command",
"history",
"subscription",
"."
] | 1082fee8a299010cc44416bbb7518fac0ef08b48 | https://github.com/yamcs/yamcs-python/blob/1082fee8a299010cc44416bbb7518fac0ef08b48/yamcs-client/yamcs/tmtc/client.py#L775-L813 | train |
yamcs/yamcs-python | yamcs-client/yamcs/tmtc/client.py | ProcessorClient.create_parameter_subscription | def create_parameter_subscription(self,
parameters,
on_data=None,
abort_on_invalid=True,
update_on_expiration=False,
send_from_cac... | python | def create_parameter_subscription(self,
parameters,
on_data=None,
abort_on_invalid=True,
update_on_expiration=False,
send_from_cac... | [
"def",
"create_parameter_subscription",
"(",
"self",
",",
"parameters",
",",
"on_data",
"=",
"None",
",",
"abort_on_invalid",
"=",
"True",
",",
"update_on_expiration",
"=",
"False",
",",
"send_from_cache",
"=",
"True",
",",
"timeout",
"=",
"60",
")",
":",
"opt... | Create a new parameter subscription.
:param str[] parameters: Parameter names (or aliases).
:param on_data: Function that gets called with :class:`.ParameterData`
updates.
:param bool abort_on_invalid: If ``True`` an error is generated when
... | [
"Create",
"a",
"new",
"parameter",
"subscription",
"."
] | 1082fee8a299010cc44416bbb7518fac0ef08b48 | https://github.com/yamcs/yamcs-python/blob/1082fee8a299010cc44416bbb7518fac0ef08b48/yamcs-client/yamcs/tmtc/client.py#L815-L869 | train |
yamcs/yamcs-python | yamcs-client/yamcs/tmtc/client.py | ProcessorClient.create_alarm_subscription | def create_alarm_subscription(self,
on_data=None,
timeout=60):
"""
Create a new alarm subscription.
:param on_data: Function that gets called with :class:`.AlarmEvent`
updates.
:param float time... | python | def create_alarm_subscription(self,
on_data=None,
timeout=60):
"""
Create a new alarm subscription.
:param on_data: Function that gets called with :class:`.AlarmEvent`
updates.
:param float time... | [
"def",
"create_alarm_subscription",
"(",
"self",
",",
"on_data",
"=",
"None",
",",
"timeout",
"=",
"60",
")",
":",
"manager",
"=",
"WebSocketSubscriptionManager",
"(",
"self",
".",
"_client",
",",
"resource",
"=",
"'alarms'",
")",
"subscription",
"=",
"AlarmSu... | Create a new alarm subscription.
:param on_data: Function that gets called with :class:`.AlarmEvent`
updates.
:param float timeout: The amount of seconds to wait for the request
to complete.
:return: A Future that can be used to manage the... | [
"Create",
"a",
"new",
"alarm",
"subscription",
"."
] | 1082fee8a299010cc44416bbb7518fac0ef08b48 | https://github.com/yamcs/yamcs-python/blob/1082fee8a299010cc44416bbb7518fac0ef08b48/yamcs-client/yamcs/tmtc/client.py#L871-L900 | train |
RedHatQE/Sentaku | examples/todo_example/api.py | get_by | def get_by(self, name):
"""get element by name"""
return next((item for item in self if item.name == name), None) | python | def get_by(self, name):
"""get element by name"""
return next((item for item in self if item.name == name), None) | [
"def",
"get_by",
"(",
"self",
",",
"name",
")",
":",
"return",
"next",
"(",
"(",
"item",
"for",
"item",
"in",
"self",
"if",
"item",
".",
"name",
"==",
"name",
")",
",",
"None",
")"
] | get element by name | [
"get",
"element",
"by",
"name"
] | b336cef5b6ee2db4e8dff28dcdb2be35a1f3d01c | https://github.com/RedHatQE/Sentaku/blob/b336cef5b6ee2db4e8dff28dcdb2be35a1f3d01c/examples/todo_example/api.py#L14-L16 | train |
lowandrew/OLCTools | spadespipeline/quality.py | Quality.fastqc | def fastqc(self):
"""Run fastqc system calls"""
while True: # while daemon
threadlock = threading.Lock()
# Unpack the variables from the queue
(sample, systemcall, outputdir, fastqcreads) = self.qcqueue.get()
# Check to see if the output HTML file already... | python | def fastqc(self):
"""Run fastqc system calls"""
while True: # while daemon
threadlock = threading.Lock()
# Unpack the variables from the queue
(sample, systemcall, outputdir, fastqcreads) = self.qcqueue.get()
# Check to see if the output HTML file already... | [
"def",
"fastqc",
"(",
"self",
")",
":",
"while",
"True",
":",
"threadlock",
"=",
"threading",
".",
"Lock",
"(",
")",
"(",
"sample",
",",
"systemcall",
",",
"outputdir",
",",
"fastqcreads",
")",
"=",
"self",
".",
"qcqueue",
".",
"get",
"(",
")",
"try"... | Run fastqc system calls | [
"Run",
"fastqc",
"system",
"calls"
] | 88aa90ac85f84d0bbeb03e43c29b0a9d36e4ce2a | https://github.com/lowandrew/OLCTools/blob/88aa90ac85f84d0bbeb03e43c29b0a9d36e4ce2a/spadespipeline/quality.py#L228-L266 | train |
lowandrew/OLCTools | spadespipeline/quality.py | Quality.trimquality | def trimquality(self):
"""Uses bbduk from the bbmap tool suite to quality and adapter trim"""
logging.info("Trimming fastq files")
# Iterate through strains with fastq files
with progressbar(self.metadata) as bar:
for sample in bar:
# As the metadata can be po... | python | def trimquality(self):
"""Uses bbduk from the bbmap tool suite to quality and adapter trim"""
logging.info("Trimming fastq files")
# Iterate through strains with fastq files
with progressbar(self.metadata) as bar:
for sample in bar:
# As the metadata can be po... | [
"def",
"trimquality",
"(",
"self",
")",
":",
"logging",
".",
"info",
"(",
"\"Trimming fastq files\"",
")",
"with",
"progressbar",
"(",
"self",
".",
"metadata",
")",
"as",
"bar",
":",
"for",
"sample",
"in",
"bar",
":",
"if",
"type",
"(",
"sample",
".",
... | Uses bbduk from the bbmap tool suite to quality and adapter trim | [
"Uses",
"bbduk",
"from",
"the",
"bbmap",
"tool",
"suite",
"to",
"quality",
"and",
"adapter",
"trim"
] | 88aa90ac85f84d0bbeb03e43c29b0a9d36e4ce2a | https://github.com/lowandrew/OLCTools/blob/88aa90ac85f84d0bbeb03e43c29b0a9d36e4ce2a/spadespipeline/quality.py#L268-L338 | train |
lowandrew/OLCTools | spadespipeline/quality.py | Quality.contamination_finder | def contamination_finder(self, input_path=None, report_path=None):
"""
Helper function to get confindr integrated into the assembly pipeline
"""
logging.info('Calculating contamination in reads')
if input_path is not None:
input_dir = input_path
else:
... | python | def contamination_finder(self, input_path=None, report_path=None):
"""
Helper function to get confindr integrated into the assembly pipeline
"""
logging.info('Calculating contamination in reads')
if input_path is not None:
input_dir = input_path
else:
... | [
"def",
"contamination_finder",
"(",
"self",
",",
"input_path",
"=",
"None",
",",
"report_path",
"=",
"None",
")",
":",
"logging",
".",
"info",
"(",
"'Calculating contamination in reads'",
")",
"if",
"input_path",
"is",
"not",
"None",
":",
"input_dir",
"=",
"in... | Helper function to get confindr integrated into the assembly pipeline | [
"Helper",
"function",
"to",
"get",
"confindr",
"integrated",
"into",
"the",
"assembly",
"pipeline"
] | 88aa90ac85f84d0bbeb03e43c29b0a9d36e4ce2a | https://github.com/lowandrew/OLCTools/blob/88aa90ac85f84d0bbeb03e43c29b0a9d36e4ce2a/spadespipeline/quality.py#L340-L418 | train |
lowandrew/OLCTools | spadespipeline/quality.py | Quality.estimate_genome_size | def estimate_genome_size(self):
"""
Use kmercountexact from the bbmap suite of tools to estimate the size of the genome
"""
logging.info('Estimating genome size using kmercountexact')
for sample in self.metadata:
# Initialise the name of the output file
sa... | python | def estimate_genome_size(self):
"""
Use kmercountexact from the bbmap suite of tools to estimate the size of the genome
"""
logging.info('Estimating genome size using kmercountexact')
for sample in self.metadata:
# Initialise the name of the output file
sa... | [
"def",
"estimate_genome_size",
"(",
"self",
")",
":",
"logging",
".",
"info",
"(",
"'Estimating genome size using kmercountexact'",
")",
"for",
"sample",
"in",
"self",
".",
"metadata",
":",
"sample",
"[",
"self",
".",
"analysistype",
"]",
".",
"peaksfile",
"=",
... | Use kmercountexact from the bbmap suite of tools to estimate the size of the genome | [
"Use",
"kmercountexact",
"from",
"the",
"bbmap",
"suite",
"of",
"tools",
"to",
"estimate",
"the",
"size",
"of",
"the",
"genome"
] | 88aa90ac85f84d0bbeb03e43c29b0a9d36e4ce2a | https://github.com/lowandrew/OLCTools/blob/88aa90ac85f84d0bbeb03e43c29b0a9d36e4ce2a/spadespipeline/quality.py#L420-L437 | train |
lowandrew/OLCTools | spadespipeline/quality.py | Quality.error_correction | def error_correction(self):
"""
Use tadpole from the bbmap suite of tools to perform error correction of the reads
"""
logging.info('Error correcting reads')
for sample in self.metadata:
sample.general.trimmedcorrectedfastqfiles = [fastq.split('.fastq.gz')[0] + '_trim... | python | def error_correction(self):
"""
Use tadpole from the bbmap suite of tools to perform error correction of the reads
"""
logging.info('Error correcting reads')
for sample in self.metadata:
sample.general.trimmedcorrectedfastqfiles = [fastq.split('.fastq.gz')[0] + '_trim... | [
"def",
"error_correction",
"(",
"self",
")",
":",
"logging",
".",
"info",
"(",
"'Error correcting reads'",
")",
"for",
"sample",
"in",
"self",
".",
"metadata",
":",
"sample",
".",
"general",
".",
"trimmedcorrectedfastqfiles",
"=",
"[",
"fastq",
".",
"split",
... | Use tadpole from the bbmap suite of tools to perform error correction of the reads | [
"Use",
"tadpole",
"from",
"the",
"bbmap",
"suite",
"of",
"tools",
"to",
"perform",
"error",
"correction",
"of",
"the",
"reads"
] | 88aa90ac85f84d0bbeb03e43c29b0a9d36e4ce2a | https://github.com/lowandrew/OLCTools/blob/88aa90ac85f84d0bbeb03e43c29b0a9d36e4ce2a/spadespipeline/quality.py#L439-L471 | train |
lowandrew/OLCTools | spadespipeline/quality.py | Quality.normalise_reads | def normalise_reads(self):
"""
Use bbnorm from the bbmap suite of tools to perform read normalisation
"""
logging.info('Normalising reads to a kmer depth of 100')
for sample in self.metadata:
# Set the name of the normalised read files
sample.general.norma... | python | def normalise_reads(self):
"""
Use bbnorm from the bbmap suite of tools to perform read normalisation
"""
logging.info('Normalising reads to a kmer depth of 100')
for sample in self.metadata:
# Set the name of the normalised read files
sample.general.norma... | [
"def",
"normalise_reads",
"(",
"self",
")",
":",
"logging",
".",
"info",
"(",
"'Normalising reads to a kmer depth of 100'",
")",
"for",
"sample",
"in",
"self",
".",
"metadata",
":",
"sample",
".",
"general",
".",
"normalisedreads",
"=",
"[",
"fastq",
".",
"spl... | Use bbnorm from the bbmap suite of tools to perform read normalisation | [
"Use",
"bbnorm",
"from",
"the",
"bbmap",
"suite",
"of",
"tools",
"to",
"perform",
"read",
"normalisation"
] | 88aa90ac85f84d0bbeb03e43c29b0a9d36e4ce2a | https://github.com/lowandrew/OLCTools/blob/88aa90ac85f84d0bbeb03e43c29b0a9d36e4ce2a/spadespipeline/quality.py#L473-L493 | train |
lowandrew/OLCTools | spadespipeline/quality.py | Quality.merge_pairs | def merge_pairs(self):
"""
Use bbmerge from the bbmap suite of tools to merge paired-end reads
"""
logging.info('Merging paired reads')
for sample in self.metadata:
# Can only merge paired-end
if len(sample.general.fastqfiles) == 2:
# Set t... | python | def merge_pairs(self):
"""
Use bbmerge from the bbmap suite of tools to merge paired-end reads
"""
logging.info('Merging paired reads')
for sample in self.metadata:
# Can only merge paired-end
if len(sample.general.fastqfiles) == 2:
# Set t... | [
"def",
"merge_pairs",
"(",
"self",
")",
":",
"logging",
".",
"info",
"(",
"'Merging paired reads'",
")",
"for",
"sample",
"in",
"self",
".",
"metadata",
":",
"if",
"len",
"(",
"sample",
".",
"general",
".",
"fastqfiles",
")",
"==",
"2",
":",
"sample",
... | Use bbmerge from the bbmap suite of tools to merge paired-end reads | [
"Use",
"bbmerge",
"from",
"the",
"bbmap",
"suite",
"of",
"tools",
"to",
"merge",
"paired",
"-",
"end",
"reads"
] | 88aa90ac85f84d0bbeb03e43c29b0a9d36e4ce2a | https://github.com/lowandrew/OLCTools/blob/88aa90ac85f84d0bbeb03e43c29b0a9d36e4ce2a/spadespipeline/quality.py#L495-L529 | train |
lowandrew/OLCTools | spadespipeline/quality.py | QualityFeatures.main | def main(self):
"""
Run all the methods required for pipeline outputs
"""
self.fasta_records()
self.fasta_stats()
self.find_largest_contig()
self.find_genome_length()
self.find_num_contigs()
self.find_n50()
self.perform_pilon()
self... | python | def main(self):
"""
Run all the methods required for pipeline outputs
"""
self.fasta_records()
self.fasta_stats()
self.find_largest_contig()
self.find_genome_length()
self.find_num_contigs()
self.find_n50()
self.perform_pilon()
self... | [
"def",
"main",
"(",
"self",
")",
":",
"self",
".",
"fasta_records",
"(",
")",
"self",
".",
"fasta_stats",
"(",
")",
"self",
".",
"find_largest_contig",
"(",
")",
"self",
".",
"find_genome_length",
"(",
")",
"self",
".",
"find_num_contigs",
"(",
")",
"sel... | Run all the methods required for pipeline outputs | [
"Run",
"all",
"the",
"methods",
"required",
"for",
"pipeline",
"outputs"
] | 88aa90ac85f84d0bbeb03e43c29b0a9d36e4ce2a | https://github.com/lowandrew/OLCTools/blob/88aa90ac85f84d0bbeb03e43c29b0a9d36e4ce2a/spadespipeline/quality.py#L560-L571 | train |
lowandrew/OLCTools | spadespipeline/quality.py | QualityFeatures.fasta_records | def fasta_records(self):
"""
Use SeqIO to create dictionaries of all records for each FASTA file
"""
for sample in self.metadata:
# Create the analysis-type specific attribute
setattr(sample, self.analysistype, GenObject())
# Create a dictionary of rec... | python | def fasta_records(self):
"""
Use SeqIO to create dictionaries of all records for each FASTA file
"""
for sample in self.metadata:
# Create the analysis-type specific attribute
setattr(sample, self.analysistype, GenObject())
# Create a dictionary of rec... | [
"def",
"fasta_records",
"(",
"self",
")",
":",
"for",
"sample",
"in",
"self",
".",
"metadata",
":",
"setattr",
"(",
"sample",
",",
"self",
".",
"analysistype",
",",
"GenObject",
"(",
")",
")",
"try",
":",
"record_dict",
"=",
"SeqIO",
".",
"to_dict",
"(... | Use SeqIO to create dictionaries of all records for each FASTA file | [
"Use",
"SeqIO",
"to",
"create",
"dictionaries",
"of",
"all",
"records",
"for",
"each",
"FASTA",
"file"
] | 88aa90ac85f84d0bbeb03e43c29b0a9d36e4ce2a | https://github.com/lowandrew/OLCTools/blob/88aa90ac85f84d0bbeb03e43c29b0a9d36e4ce2a/spadespipeline/quality.py#L573-L586 | train |
lowandrew/OLCTools | spadespipeline/quality.py | QualityFeatures.fasta_stats | def fasta_stats(self):
"""
Parse the lengths of all contigs for each sample, as well as the total GC%
"""
for sample in self.metadata:
# Initialise variables to store appropriate values parsed from contig records
contig_lengths = list()
fasta_sequence ... | python | def fasta_stats(self):
"""
Parse the lengths of all contigs for each sample, as well as the total GC%
"""
for sample in self.metadata:
# Initialise variables to store appropriate values parsed from contig records
contig_lengths = list()
fasta_sequence ... | [
"def",
"fasta_stats",
"(",
"self",
")",
":",
"for",
"sample",
"in",
"self",
".",
"metadata",
":",
"contig_lengths",
"=",
"list",
"(",
")",
"fasta_sequence",
"=",
"str",
"(",
")",
"for",
"contig",
",",
"record",
"in",
"sample",
"[",
"self",
".",
"analys... | Parse the lengths of all contigs for each sample, as well as the total GC% | [
"Parse",
"the",
"lengths",
"of",
"all",
"contigs",
"for",
"each",
"sample",
"as",
"well",
"as",
"the",
"total",
"GC%"
] | 88aa90ac85f84d0bbeb03e43c29b0a9d36e4ce2a | https://github.com/lowandrew/OLCTools/blob/88aa90ac85f84d0bbeb03e43c29b0a9d36e4ce2a/spadespipeline/quality.py#L588-L607 | train |
lowandrew/OLCTools | spadespipeline/quality.py | QualityFeatures.find_largest_contig | def find_largest_contig(self):
"""
Determine the largest contig for each strain
"""
# for file_name, contig_lengths in contig_lengths_dict.items():
for sample in self.metadata:
# As the list is sorted in descending order, the largest contig is the first entry in the l... | python | def find_largest_contig(self):
"""
Determine the largest contig for each strain
"""
# for file_name, contig_lengths in contig_lengths_dict.items():
for sample in self.metadata:
# As the list is sorted in descending order, the largest contig is the first entry in the l... | [
"def",
"find_largest_contig",
"(",
"self",
")",
":",
"for",
"sample",
"in",
"self",
".",
"metadata",
":",
"sample",
"[",
"self",
".",
"analysistype",
"]",
".",
"longest_contig",
"=",
"sample",
"[",
"self",
".",
"analysistype",
"]",
".",
"contig_lengths"
] | Determine the largest contig for each strain | [
"Determine",
"the",
"largest",
"contig",
"for",
"each",
"strain"
] | 88aa90ac85f84d0bbeb03e43c29b0a9d36e4ce2a | https://github.com/lowandrew/OLCTools/blob/88aa90ac85f84d0bbeb03e43c29b0a9d36e4ce2a/spadespipeline/quality.py#L609-L616 | train |
lowandrew/OLCTools | spadespipeline/quality.py | QualityFeatures.find_genome_length | def find_genome_length(self):
"""
Determine the total length of all the contigs for each strain
"""
for sample in self.metadata:
# Use the sum() method to add all the contig lengths in the list
sample[self.analysistype].genome_length = sum(sample[self.analysistype... | python | def find_genome_length(self):
"""
Determine the total length of all the contigs for each strain
"""
for sample in self.metadata:
# Use the sum() method to add all the contig lengths in the list
sample[self.analysistype].genome_length = sum(sample[self.analysistype... | [
"def",
"find_genome_length",
"(",
"self",
")",
":",
"for",
"sample",
"in",
"self",
".",
"metadata",
":",
"sample",
"[",
"self",
".",
"analysistype",
"]",
".",
"genome_length",
"=",
"sum",
"(",
"sample",
"[",
"self",
".",
"analysistype",
"]",
".",
"contig... | Determine the total length of all the contigs for each strain | [
"Determine",
"the",
"total",
"length",
"of",
"all",
"the",
"contigs",
"for",
"each",
"strain"
] | 88aa90ac85f84d0bbeb03e43c29b0a9d36e4ce2a | https://github.com/lowandrew/OLCTools/blob/88aa90ac85f84d0bbeb03e43c29b0a9d36e4ce2a/spadespipeline/quality.py#L618-L624 | train |
lowandrew/OLCTools | spadespipeline/quality.py | QualityFeatures.find_num_contigs | def find_num_contigs(self):
"""
Count the total number of contigs for each strain
"""
for sample in self.metadata:
# Use the len() method to count the number of entries in the list
sample[self.analysistype].num_contigs = len(sample[self.analysistype].contig_length... | python | def find_num_contigs(self):
"""
Count the total number of contigs for each strain
"""
for sample in self.metadata:
# Use the len() method to count the number of entries in the list
sample[self.analysistype].num_contigs = len(sample[self.analysistype].contig_length... | [
"def",
"find_num_contigs",
"(",
"self",
")",
":",
"for",
"sample",
"in",
"self",
".",
"metadata",
":",
"sample",
"[",
"self",
".",
"analysistype",
"]",
".",
"num_contigs",
"=",
"len",
"(",
"sample",
"[",
"self",
".",
"analysistype",
"]",
".",
"contig_len... | Count the total number of contigs for each strain | [
"Count",
"the",
"total",
"number",
"of",
"contigs",
"for",
"each",
"strain"
] | 88aa90ac85f84d0bbeb03e43c29b0a9d36e4ce2a | https://github.com/lowandrew/OLCTools/blob/88aa90ac85f84d0bbeb03e43c29b0a9d36e4ce2a/spadespipeline/quality.py#L626-L632 | train |
lowandrew/OLCTools | spadespipeline/quality.py | QualityFeatures.find_n50 | def find_n50(self):
"""
Calculate the N50 for each strain. N50 is defined as the largest contig such that at least half of the total
genome size is contained in contigs equal to or larger than this contig
"""
for sample in self.metadata:
# Initialise the N50 attribute... | python | def find_n50(self):
"""
Calculate the N50 for each strain. N50 is defined as the largest contig such that at least half of the total
genome size is contained in contigs equal to or larger than this contig
"""
for sample in self.metadata:
# Initialise the N50 attribute... | [
"def",
"find_n50",
"(",
"self",
")",
":",
"for",
"sample",
"in",
"self",
".",
"metadata",
":",
"sample",
"[",
"self",
".",
"analysistype",
"]",
".",
"n50",
"=",
"'-'",
"currentlength",
"=",
"0",
"for",
"contig_length",
"in",
"sample",
"[",
"self",
".",... | Calculate the N50 for each strain. N50 is defined as the largest contig such that at least half of the total
genome size is contained in contigs equal to or larger than this contig | [
"Calculate",
"the",
"N50",
"for",
"each",
"strain",
".",
"N50",
"is",
"defined",
"as",
"the",
"largest",
"contig",
"such",
"that",
"at",
"least",
"half",
"of",
"the",
"total",
"genome",
"size",
"is",
"contained",
"in",
"contigs",
"equal",
"to",
"or",
"la... | 88aa90ac85f84d0bbeb03e43c29b0a9d36e4ce2a | https://github.com/lowandrew/OLCTools/blob/88aa90ac85f84d0bbeb03e43c29b0a9d36e4ce2a/spadespipeline/quality.py#L634-L651 | train |
lowandrew/OLCTools | spadespipeline/quality.py | QualityFeatures.perform_pilon | def perform_pilon(self):
"""
Determine if pilon polishing should be attempted. Do not perform polishing if confindr determines that the
sample is contaminated or if there are > 500 contigs
"""
for sample in self.metadata:
try:
if sample[self.analysisty... | python | def perform_pilon(self):
"""
Determine if pilon polishing should be attempted. Do not perform polishing if confindr determines that the
sample is contaminated or if there are > 500 contigs
"""
for sample in self.metadata:
try:
if sample[self.analysisty... | [
"def",
"perform_pilon",
"(",
"self",
")",
":",
"for",
"sample",
"in",
"self",
".",
"metadata",
":",
"try",
":",
"if",
"sample",
"[",
"self",
".",
"analysistype",
"]",
".",
"num_contigs",
">",
"500",
"or",
"sample",
".",
"confindr",
".",
"contam_status",
... | Determine if pilon polishing should be attempted. Do not perform polishing if confindr determines that the
sample is contaminated or if there are > 500 contigs | [
"Determine",
"if",
"pilon",
"polishing",
"should",
"be",
"attempted",
".",
"Do",
"not",
"perform",
"polishing",
"if",
"confindr",
"determines",
"that",
"the",
"sample",
"is",
"contaminated",
"or",
"if",
"there",
"are",
">",
"500",
"contigs"
] | 88aa90ac85f84d0bbeb03e43c29b0a9d36e4ce2a | https://github.com/lowandrew/OLCTools/blob/88aa90ac85f84d0bbeb03e43c29b0a9d36e4ce2a/spadespipeline/quality.py#L653-L665 | train |
lowandrew/OLCTools | spadespipeline/quality.py | QualityFeatures.clear_attributes | def clear_attributes(self):
"""
Remove the record_dict attribute from the object, as SeqRecords are not JSON-serializable. Also remove
the contig_lengths and longest_contig attributes, as they are large lists that make the .json file ugly
"""
for sample in self.metadata:
... | python | def clear_attributes(self):
"""
Remove the record_dict attribute from the object, as SeqRecords are not JSON-serializable. Also remove
the contig_lengths and longest_contig attributes, as they are large lists that make the .json file ugly
"""
for sample in self.metadata:
... | [
"def",
"clear_attributes",
"(",
"self",
")",
":",
"for",
"sample",
"in",
"self",
".",
"metadata",
":",
"try",
":",
"delattr",
"(",
"sample",
"[",
"self",
".",
"analysistype",
"]",
",",
"'record_dict'",
")",
"delattr",
"(",
"sample",
"[",
"self",
".",
"... | Remove the record_dict attribute from the object, as SeqRecords are not JSON-serializable. Also remove
the contig_lengths and longest_contig attributes, as they are large lists that make the .json file ugly | [
"Remove",
"the",
"record_dict",
"attribute",
"from",
"the",
"object",
"as",
"SeqRecords",
"are",
"not",
"JSON",
"-",
"serializable",
".",
"Also",
"remove",
"the",
"contig_lengths",
"and",
"longest_contig",
"attributes",
"as",
"they",
"are",
"large",
"lists",
"th... | 88aa90ac85f84d0bbeb03e43c29b0a9d36e4ce2a | https://github.com/lowandrew/OLCTools/blob/88aa90ac85f84d0bbeb03e43c29b0a9d36e4ce2a/spadespipeline/quality.py#L667-L678 | train |
lowandrew/OLCTools | spadespipeline/quality.py | GenomeQAML.run_qaml | def run_qaml(self):
"""
Create and run the GenomeQAML system call
"""
logging.info('Running GenomeQAML quality assessment')
qaml_call = 'classify.py -t {tf} -r {rf}'\
.format(tf=self.qaml_path,
rf=self.qaml_report)
make_path(self.reportpath... | python | def run_qaml(self):
"""
Create and run the GenomeQAML system call
"""
logging.info('Running GenomeQAML quality assessment')
qaml_call = 'classify.py -t {tf} -r {rf}'\
.format(tf=self.qaml_path,
rf=self.qaml_report)
make_path(self.reportpath... | [
"def",
"run_qaml",
"(",
"self",
")",
":",
"logging",
".",
"info",
"(",
"'Running GenomeQAML quality assessment'",
")",
"qaml_call",
"=",
"'classify.py -t {tf} -r {rf}'",
".",
"format",
"(",
"tf",
"=",
"self",
".",
"qaml_path",
",",
"rf",
"=",
"self",
".",
"qam... | Create and run the GenomeQAML system call | [
"Create",
"and",
"run",
"the",
"GenomeQAML",
"system",
"call"
] | 88aa90ac85f84d0bbeb03e43c29b0a9d36e4ce2a | https://github.com/lowandrew/OLCTools/blob/88aa90ac85f84d0bbeb03e43c29b0a9d36e4ce2a/spadespipeline/quality.py#L695-L712 | train |
lowandrew/OLCTools | spadespipeline/quality.py | GenomeQAML.parse_qaml | def parse_qaml(self):
"""
Parse the GenomeQAML report, and populate metadata objects
"""
logging.info('Parsing GenomeQAML outputs')
# A dictionary to store the parsed excel file in a more readable format
nesteddictionary = dict()
# Use pandas to read in the CSV fi... | python | def parse_qaml(self):
"""
Parse the GenomeQAML report, and populate metadata objects
"""
logging.info('Parsing GenomeQAML outputs')
# A dictionary to store the parsed excel file in a more readable format
nesteddictionary = dict()
# Use pandas to read in the CSV fi... | [
"def",
"parse_qaml",
"(",
"self",
")",
":",
"logging",
".",
"info",
"(",
"'Parsing GenomeQAML outputs'",
")",
"nesteddictionary",
"=",
"dict",
"(",
")",
"dictionary",
"=",
"pandas",
".",
"read_csv",
"(",
"self",
".",
"qaml_report",
")",
".",
"to_dict",
"(",
... | Parse the GenomeQAML report, and populate metadata objects | [
"Parse",
"the",
"GenomeQAML",
"report",
"and",
"populate",
"metadata",
"objects"
] | 88aa90ac85f84d0bbeb03e43c29b0a9d36e4ce2a | https://github.com/lowandrew/OLCTools/blob/88aa90ac85f84d0bbeb03e43c29b0a9d36e4ce2a/spadespipeline/quality.py#L714-L747 | train |
JukeboxPipeline/jukeboxmaya | src/jukeboxmaya/addons/mayagenesis/mayagenesis.py | MayaGenesis.init | def init(self, ):
"""Initialize the plugin. Do nothing.
This function gets called when the plugin is loaded by the plugin manager.
:returns:
:rtype:
:raises:
"""
self.gw = None
pm = MayaPluginManager.get()
genesis = pm.get_plugin("Genesis")
... | python | def init(self, ):
"""Initialize the plugin. Do nothing.
This function gets called when the plugin is loaded by the plugin manager.
:returns:
:rtype:
:raises:
"""
self.gw = None
pm = MayaPluginManager.get()
genesis = pm.get_plugin("Genesis")
... | [
"def",
"init",
"(",
"self",
",",
")",
":",
"self",
".",
"gw",
"=",
"None",
"pm",
"=",
"MayaPluginManager",
".",
"get",
"(",
")",
"genesis",
"=",
"pm",
".",
"get_plugin",
"(",
"\"Genesis\"",
")",
"self",
".",
"GenesisWin",
"=",
"self",
".",
"subclass_... | Initialize the plugin. Do nothing.
This function gets called when the plugin is loaded by the plugin manager.
:returns:
:rtype:
:raises: | [
"Initialize",
"the",
"plugin",
".",
"Do",
"nothing",
"."
] | c8d6318d53cdb5493453c4a6b65ef75bdb2d5f2c | https://github.com/JukeboxPipeline/jukeboxmaya/blob/c8d6318d53cdb5493453c4a6b65ef75bdb2d5f2c/src/jukeboxmaya/addons/mayagenesis/mayagenesis.py#L34-L46 | train |
JukeboxPipeline/jukeboxmaya | src/jukeboxmaya/addons/mayagenesis/mayagenesis.py | MayaGenesis.save_lastfile | def save_lastfile(self, tfi):
"""Save the taskfile in the config
:param tfi: the last selected taskfileinfo
:type tfi: class:`jukeboxcore.filesys.TaskFileInfo`
:returns: None
:rtype: None
:raises: None
"""
tf = models.TaskFile.objects.get(task=tfi.task, v... | python | def save_lastfile(self, tfi):
"""Save the taskfile in the config
:param tfi: the last selected taskfileinfo
:type tfi: class:`jukeboxcore.filesys.TaskFileInfo`
:returns: None
:rtype: None
:raises: None
"""
tf = models.TaskFile.objects.get(task=tfi.task, v... | [
"def",
"save_lastfile",
"(",
"self",
",",
"tfi",
")",
":",
"tf",
"=",
"models",
".",
"TaskFile",
".",
"objects",
".",
"get",
"(",
"task",
"=",
"tfi",
".",
"task",
",",
"version",
"=",
"tfi",
".",
"version",
",",
"releasetype",
"=",
"tfi",
".",
"rel... | Save the taskfile in the config
:param tfi: the last selected taskfileinfo
:type tfi: class:`jukeboxcore.filesys.TaskFileInfo`
:returns: None
:rtype: None
:raises: None | [
"Save",
"the",
"taskfile",
"in",
"the",
"config"
] | c8d6318d53cdb5493453c4a6b65ef75bdb2d5f2c | https://github.com/JukeboxPipeline/jukeboxmaya/blob/c8d6318d53cdb5493453c4a6b65ef75bdb2d5f2c/src/jukeboxmaya/addons/mayagenesis/mayagenesis.py#L101-L114 | train |
JukeboxPipeline/jukeboxmaya | src/jukeboxmaya/addons/mayagenesis/mayagenesis.py | MayaGenesis.subclass_genesis | def subclass_genesis(self, genesisclass):
"""Subclass the given genesis class and implement all abstract methods
:param genesisclass: the GenesisWin class to subclass
:type genesisclass: :class:`GenesisWin`
:returns: the subclass
:rtype: subclass of :class:`GenesisWin`
:... | python | def subclass_genesis(self, genesisclass):
"""Subclass the given genesis class and implement all abstract methods
:param genesisclass: the GenesisWin class to subclass
:type genesisclass: :class:`GenesisWin`
:returns: the subclass
:rtype: subclass of :class:`GenesisWin`
:... | [
"def",
"subclass_genesis",
"(",
"self",
",",
"genesisclass",
")",
":",
"class",
"MayaGenesisWin",
"(",
"genesisclass",
")",
":",
"def",
"open_shot",
"(",
"self",
",",
"taskfile",
")",
":",
"return",
"self",
".",
"open_file",
"(",
"taskfile",
")",
"def",
"s... | Subclass the given genesis class and implement all abstract methods
:param genesisclass: the GenesisWin class to subclass
:type genesisclass: :class:`GenesisWin`
:returns: the subclass
:rtype: subclass of :class:`GenesisWin`
:raises: None | [
"Subclass",
"the",
"given",
"genesis",
"class",
"and",
"implement",
"all",
"abstract",
"methods"
] | c8d6318d53cdb5493453c4a6b65ef75bdb2d5f2c | https://github.com/JukeboxPipeline/jukeboxmaya/blob/c8d6318d53cdb5493453c4a6b65ef75bdb2d5f2c/src/jukeboxmaya/addons/mayagenesis/mayagenesis.py#L116-L281 | train |
portfors-lab/sparkle | sparkle/run/calibration_runner.py | AbstractCalibrationRunner.stash_calibration | def stash_calibration(self, attenuations, freqs, frange, calname):
"""Save it for later"""
self.calibration_vector = attenuations
self.calibration_freqs = freqs
self.calibration_frange = frange
self.calname = calname | python | def stash_calibration(self, attenuations, freqs, frange, calname):
"""Save it for later"""
self.calibration_vector = attenuations
self.calibration_freqs = freqs
self.calibration_frange = frange
self.calname = calname | [
"def",
"stash_calibration",
"(",
"self",
",",
"attenuations",
",",
"freqs",
",",
"frange",
",",
"calname",
")",
":",
"self",
".",
"calibration_vector",
"=",
"attenuations",
"self",
".",
"calibration_freqs",
"=",
"freqs",
"self",
".",
"calibration_frange",
"=",
... | Save it for later | [
"Save",
"it",
"for",
"later"
] | 5fad1cf2bec58ec6b15d91da20f6236a74826110 | https://github.com/portfors-lab/sparkle/blob/5fad1cf2bec58ec6b15d91da20f6236a74826110/sparkle/run/calibration_runner.py#L20-L25 | train |
portfors-lab/sparkle | sparkle/run/calibration_runner.py | CalibrationRunner.set_stim_by_index | def set_stim_by_index(self, index):
"""Sets the stimulus to be generated to the one referenced by index
:param index: index number of stimulus to set from this class's internal list of stimuli
:type index: int
"""
# remove any current components
self.stimulus.clearCompon... | python | def set_stim_by_index(self, index):
"""Sets the stimulus to be generated to the one referenced by index
:param index: index number of stimulus to set from this class's internal list of stimuli
:type index: int
"""
# remove any current components
self.stimulus.clearCompon... | [
"def",
"set_stim_by_index",
"(",
"self",
",",
"index",
")",
":",
"self",
".",
"stimulus",
".",
"clearComponents",
"(",
")",
"self",
".",
"stimulus",
".",
"insertComponent",
"(",
"self",
".",
"stim_components",
"[",
"index",
"]",
")"
] | Sets the stimulus to be generated to the one referenced by index
:param index: index number of stimulus to set from this class's internal list of stimuli
:type index: int | [
"Sets",
"the",
"stimulus",
"to",
"be",
"generated",
"to",
"the",
"one",
"referenced",
"by",
"index"
] | 5fad1cf2bec58ec6b15d91da20f6236a74826110 | https://github.com/portfors-lab/sparkle/blob/5fad1cf2bec58ec6b15d91da20f6236a74826110/sparkle/run/calibration_runner.py#L92-L101 | train |
portfors-lab/sparkle | sparkle/run/calibration_runner.py | CalibrationRunner.process_calibration | def process_calibration(self, save=True):
"""processes calibration control signal. Determines transfer function
of speaker to get frequency vs. attenuation curve.
:param save: Whether to save this calibration data to file
:type save: bool
:returns: numpy.ndarray, str, int, float... | python | def process_calibration(self, save=True):
"""processes calibration control signal. Determines transfer function
of speaker to get frequency vs. attenuation curve.
:param save: Whether to save this calibration data to file
:type save: bool
:returns: numpy.ndarray, str, int, float... | [
"def",
"process_calibration",
"(",
"self",
",",
"save",
"=",
"True",
")",
":",
"if",
"not",
"self",
".",
"save_data",
":",
"raise",
"Exception",
"(",
"\"Cannot process an unsaved calibration\"",
")",
"avg_signal",
"=",
"np",
".",
"mean",
"(",
"self",
".",
"d... | processes calibration control signal. Determines transfer function
of speaker to get frequency vs. attenuation curve.
:param save: Whether to save this calibration data to file
:type save: bool
:returns: numpy.ndarray, str, int, float -- frequency response (in dB), dataset name, calibra... | [
"processes",
"calibration",
"control",
"signal",
".",
"Determines",
"transfer",
"function",
"of",
"speaker",
"to",
"get",
"frequency",
"vs",
".",
"attenuation",
"curve",
"."
] | 5fad1cf2bec58ec6b15d91da20f6236a74826110 | https://github.com/portfors-lab/sparkle/blob/5fad1cf2bec58ec6b15d91da20f6236a74826110/sparkle/run/calibration_runner.py#L161-L198 | train |
portfors-lab/sparkle | sparkle/gui/stim/explore_stim_editor.py | ExploreStimulusEditor.setModel | def setModel(self, model):
"Sets the StimulusModel for this editor"
self._model = model
self.ui.aofsSpnbx.setValue(model.samplerate()) | python | def setModel(self, model):
"Sets the StimulusModel for this editor"
self._model = model
self.ui.aofsSpnbx.setValue(model.samplerate()) | [
"def",
"setModel",
"(",
"self",
",",
"model",
")",
":",
"\"Sets the StimulusModel for this editor\"",
"self",
".",
"_model",
"=",
"model",
"self",
".",
"ui",
".",
"aofsSpnbx",
".",
"setValue",
"(",
"model",
".",
"samplerate",
"(",
")",
")"
] | Sets the StimulusModel for this editor | [
"Sets",
"the",
"StimulusModel",
"for",
"this",
"editor"
] | 5fad1cf2bec58ec6b15d91da20f6236a74826110 | https://github.com/portfors-lab/sparkle/blob/5fad1cf2bec58ec6b15d91da20f6236a74826110/sparkle/gui/stim/explore_stim_editor.py#L31-L34 | train |
portfors-lab/sparkle | sparkle/gui/stim/explore_stim_editor.py | ExploreStimulusEditor.setStimIndex | def setStimIndex(self, row, stimIndex):
"Change out the component type in row to the one indexed by stimIndex"
newcomp = self._allComponents[row][stimIndex]
self._model.removeComponent(row, 1)
self._model.insertComponent(newcomp, row, 1) | python | def setStimIndex(self, row, stimIndex):
"Change out the component type in row to the one indexed by stimIndex"
newcomp = self._allComponents[row][stimIndex]
self._model.removeComponent(row, 1)
self._model.insertComponent(newcomp, row, 1) | [
"def",
"setStimIndex",
"(",
"self",
",",
"row",
",",
"stimIndex",
")",
":",
"\"Change out the component type in row to the one indexed by stimIndex\"",
"newcomp",
"=",
"self",
".",
"_allComponents",
"[",
"row",
"]",
"[",
"stimIndex",
"]",
"self",
".",
"_model",
".",... | Change out the component type in row to the one indexed by stimIndex | [
"Change",
"out",
"the",
"component",
"type",
"in",
"row",
"to",
"the",
"one",
"indexed",
"by",
"stimIndex"
] | 5fad1cf2bec58ec6b15d91da20f6236a74826110 | https://github.com/portfors-lab/sparkle/blob/5fad1cf2bec58ec6b15d91da20f6236a74826110/sparkle/gui/stim/explore_stim_editor.py#L44-L48 | train |
portfors-lab/sparkle | sparkle/gui/stim/explore_stim_editor.py | ExploreStimulusEditor.addComponentEditor | def addComponentEditor(self):
"""Adds a new component to the model, and an editor for this component to this editor"""
row = self._model.rowCount()
comp_stack_editor = ExploreComponentEditor()
self.ui.trackStack.addWidget(comp_stack_editor)
idx_button = IndexButton(row)
... | python | def addComponentEditor(self):
"""Adds a new component to the model, and an editor for this component to this editor"""
row = self._model.rowCount()
comp_stack_editor = ExploreComponentEditor()
self.ui.trackStack.addWidget(comp_stack_editor)
idx_button = IndexButton(row)
... | [
"def",
"addComponentEditor",
"(",
"self",
")",
":",
"row",
"=",
"self",
".",
"_model",
".",
"rowCount",
"(",
")",
"comp_stack_editor",
"=",
"ExploreComponentEditor",
"(",
")",
"self",
".",
"ui",
".",
"trackStack",
".",
"addWidget",
"(",
"comp_stack_editor",
... | Adds a new component to the model, and an editor for this component to this editor | [
"Adds",
"a",
"new",
"component",
"to",
"the",
"model",
"and",
"an",
"editor",
"for",
"this",
"component",
"to",
"this",
"editor"
] | 5fad1cf2bec58ec6b15d91da20f6236a74826110 | https://github.com/portfors-lab/sparkle/blob/5fad1cf2bec58ec6b15d91da20f6236a74826110/sparkle/gui/stim/explore_stim_editor.py#L63-L99 | train |
yamcs/yamcs-python | yamcs-client/yamcs/mdb/client.py | MDBClient.list_space_systems | def list_space_systems(self, page_size=None):
"""
Lists the space systems visible to this client.
Space systems are returned in lexicographical order.
:rtype: :class:`.SpaceSystem` iterator
"""
params = {}
if page_size is not None:
params['limit'] =... | python | def list_space_systems(self, page_size=None):
"""
Lists the space systems visible to this client.
Space systems are returned in lexicographical order.
:rtype: :class:`.SpaceSystem` iterator
"""
params = {}
if page_size is not None:
params['limit'] =... | [
"def",
"list_space_systems",
"(",
"self",
",",
"page_size",
"=",
"None",
")",
":",
"params",
"=",
"{",
"}",
"if",
"page_size",
"is",
"not",
"None",
":",
"params",
"[",
"'limit'",
"]",
"=",
"page_size",
"return",
"pagination",
".",
"Iterator",
"(",
"clien... | Lists the space systems visible to this client.
Space systems are returned in lexicographical order.
:rtype: :class:`.SpaceSystem` iterator | [
"Lists",
"the",
"space",
"systems",
"visible",
"to",
"this",
"client",
"."
] | 1082fee8a299010cc44416bbb7518fac0ef08b48 | https://github.com/yamcs/yamcs-python/blob/1082fee8a299010cc44416bbb7518fac0ef08b48/yamcs-client/yamcs/mdb/client.py#L15-L35 | train |
yamcs/yamcs-python | yamcs-client/yamcs/mdb/client.py | MDBClient.get_space_system | def get_space_system(self, name):
"""
Gets a single space system by its unique name.
:param str name: A fully-qualified XTCE name
:rtype: .SpaceSystem
"""
url = '/mdb/{}/space-systems{}'.format(self._instance, name)
response = self._client.get_proto(url)
... | python | def get_space_system(self, name):
"""
Gets a single space system by its unique name.
:param str name: A fully-qualified XTCE name
:rtype: .SpaceSystem
"""
url = '/mdb/{}/space-systems{}'.format(self._instance, name)
response = self._client.get_proto(url)
... | [
"def",
"get_space_system",
"(",
"self",
",",
"name",
")",
":",
"url",
"=",
"'/mdb/{}/space-systems{}'",
".",
"format",
"(",
"self",
".",
"_instance",
",",
"name",
")",
"response",
"=",
"self",
".",
"_client",
".",
"get_proto",
"(",
"url",
")",
"message",
... | Gets a single space system by its unique name.
:param str name: A fully-qualified XTCE name
:rtype: .SpaceSystem | [
"Gets",
"a",
"single",
"space",
"system",
"by",
"its",
"unique",
"name",
"."
] | 1082fee8a299010cc44416bbb7518fac0ef08b48 | https://github.com/yamcs/yamcs-python/blob/1082fee8a299010cc44416bbb7518fac0ef08b48/yamcs-client/yamcs/mdb/client.py#L37-L48 | train |
yamcs/yamcs-python | yamcs-client/yamcs/mdb/client.py | MDBClient.list_parameters | def list_parameters(self, parameter_type=None, page_size=None):
"""Lists the parameters visible to this client.
Parameters are returned in lexicographical order.
:param str parameter_type: The type of parameter
:rtype: :class:`.Parameter` iterator
"""
params = {'details... | python | def list_parameters(self, parameter_type=None, page_size=None):
"""Lists the parameters visible to this client.
Parameters are returned in lexicographical order.
:param str parameter_type: The type of parameter
:rtype: :class:`.Parameter` iterator
"""
params = {'details... | [
"def",
"list_parameters",
"(",
"self",
",",
"parameter_type",
"=",
"None",
",",
"page_size",
"=",
"None",
")",
":",
"params",
"=",
"{",
"'details'",
":",
"True",
"}",
"if",
"parameter_type",
"is",
"not",
"None",
":",
"params",
"[",
"'type'",
"]",
"=",
... | Lists the parameters visible to this client.
Parameters are returned in lexicographical order.
:param str parameter_type: The type of parameter
:rtype: :class:`.Parameter` iterator | [
"Lists",
"the",
"parameters",
"visible",
"to",
"this",
"client",
"."
] | 1082fee8a299010cc44416bbb7518fac0ef08b48 | https://github.com/yamcs/yamcs-python/blob/1082fee8a299010cc44416bbb7518fac0ef08b48/yamcs-client/yamcs/mdb/client.py#L50-L72 | train |
yamcs/yamcs-python | yamcs-client/yamcs/mdb/client.py | MDBClient.get_parameter | def get_parameter(self, name):
"""
Gets a single parameter by its name.
:param str name: Either a fully-qualified XTCE name or an alias in the
format ``NAMESPACE/NAME``.
:rtype: .Parameter
"""
name = adapt_name_for_rest(name)
url = '/mdb/... | python | def get_parameter(self, name):
"""
Gets a single parameter by its name.
:param str name: Either a fully-qualified XTCE name or an alias in the
format ``NAMESPACE/NAME``.
:rtype: .Parameter
"""
name = adapt_name_for_rest(name)
url = '/mdb/... | [
"def",
"get_parameter",
"(",
"self",
",",
"name",
")",
":",
"name",
"=",
"adapt_name_for_rest",
"(",
"name",
")",
"url",
"=",
"'/mdb/{}/parameters{}'",
".",
"format",
"(",
"self",
".",
"_instance",
",",
"name",
")",
"response",
"=",
"self",
".",
"_client",... | Gets a single parameter by its name.
:param str name: Either a fully-qualified XTCE name or an alias in the
format ``NAMESPACE/NAME``.
:rtype: .Parameter | [
"Gets",
"a",
"single",
"parameter",
"by",
"its",
"name",
"."
] | 1082fee8a299010cc44416bbb7518fac0ef08b48 | https://github.com/yamcs/yamcs-python/blob/1082fee8a299010cc44416bbb7518fac0ef08b48/yamcs-client/yamcs/mdb/client.py#L74-L87 | train |
yamcs/yamcs-python | yamcs-client/yamcs/mdb/client.py | MDBClient.list_containers | def list_containers(self, page_size=None):
"""
Lists the containers visible to this client.
Containers are returned in lexicographical order.
:rtype: :class:`.Container` iterator
"""
params = {}
if page_size is not None:
params['limit'] = page_size
... | python | def list_containers(self, page_size=None):
"""
Lists the containers visible to this client.
Containers are returned in lexicographical order.
:rtype: :class:`.Container` iterator
"""
params = {}
if page_size is not None:
params['limit'] = page_size
... | [
"def",
"list_containers",
"(",
"self",
",",
"page_size",
"=",
"None",
")",
":",
"params",
"=",
"{",
"}",
"if",
"page_size",
"is",
"not",
"None",
":",
"params",
"[",
"'limit'",
"]",
"=",
"page_size",
"return",
"pagination",
".",
"Iterator",
"(",
"client",... | Lists the containers visible to this client.
Containers are returned in lexicographical order.
:rtype: :class:`.Container` iterator | [
"Lists",
"the",
"containers",
"visible",
"to",
"this",
"client",
"."
] | 1082fee8a299010cc44416bbb7518fac0ef08b48 | https://github.com/yamcs/yamcs-python/blob/1082fee8a299010cc44416bbb7518fac0ef08b48/yamcs-client/yamcs/mdb/client.py#L89-L109 | train |
yamcs/yamcs-python | yamcs-client/yamcs/mdb/client.py | MDBClient.get_container | def get_container(self, name):
"""
Gets a single container by its unique name.
:param str name: Either a fully-qualified XTCE name or an alias in the
format ``NAMESPACE/NAME``.
:rtype: .Container
"""
name = adapt_name_for_rest(name)
url =... | python | def get_container(self, name):
"""
Gets a single container by its unique name.
:param str name: Either a fully-qualified XTCE name or an alias in the
format ``NAMESPACE/NAME``.
:rtype: .Container
"""
name = adapt_name_for_rest(name)
url =... | [
"def",
"get_container",
"(",
"self",
",",
"name",
")",
":",
"name",
"=",
"adapt_name_for_rest",
"(",
"name",
")",
"url",
"=",
"'/mdb/{}/containers{}'",
".",
"format",
"(",
"self",
".",
"_instance",
",",
"name",
")",
"response",
"=",
"self",
".",
"_client",... | Gets a single container by its unique name.
:param str name: Either a fully-qualified XTCE name or an alias in the
format ``NAMESPACE/NAME``.
:rtype: .Container | [
"Gets",
"a",
"single",
"container",
"by",
"its",
"unique",
"name",
"."
] | 1082fee8a299010cc44416bbb7518fac0ef08b48 | https://github.com/yamcs/yamcs-python/blob/1082fee8a299010cc44416bbb7518fac0ef08b48/yamcs-client/yamcs/mdb/client.py#L111-L124 | train |
yamcs/yamcs-python | yamcs-client/yamcs/mdb/client.py | MDBClient.list_commands | def list_commands(self, page_size=None):
"""
Lists the commands visible to this client.
Commands are returned in lexicographical order.
:rtype: :class:`.Command` iterator
"""
params = {}
if page_size is not None:
params['limit'] = page_size
... | python | def list_commands(self, page_size=None):
"""
Lists the commands visible to this client.
Commands are returned in lexicographical order.
:rtype: :class:`.Command` iterator
"""
params = {}
if page_size is not None:
params['limit'] = page_size
... | [
"def",
"list_commands",
"(",
"self",
",",
"page_size",
"=",
"None",
")",
":",
"params",
"=",
"{",
"}",
"if",
"page_size",
"is",
"not",
"None",
":",
"params",
"[",
"'limit'",
"]",
"=",
"page_size",
"return",
"pagination",
".",
"Iterator",
"(",
"client",
... | Lists the commands visible to this client.
Commands are returned in lexicographical order.
:rtype: :class:`.Command` iterator | [
"Lists",
"the",
"commands",
"visible",
"to",
"this",
"client",
"."
] | 1082fee8a299010cc44416bbb7518fac0ef08b48 | https://github.com/yamcs/yamcs-python/blob/1082fee8a299010cc44416bbb7518fac0ef08b48/yamcs-client/yamcs/mdb/client.py#L126-L146 | train |
yamcs/yamcs-python | yamcs-client/yamcs/mdb/client.py | MDBClient.get_command | def get_command(self, name):
"""
Gets a single command by its unique name.
:param str name: Either a fully-qualified XTCE name or an alias in the
format ``NAMESPACE/NAME``.
:rtype: .Command
"""
name = adapt_name_for_rest(name)
url = '/mdb... | python | def get_command(self, name):
"""
Gets a single command by its unique name.
:param str name: Either a fully-qualified XTCE name or an alias in the
format ``NAMESPACE/NAME``.
:rtype: .Command
"""
name = adapt_name_for_rest(name)
url = '/mdb... | [
"def",
"get_command",
"(",
"self",
",",
"name",
")",
":",
"name",
"=",
"adapt_name_for_rest",
"(",
"name",
")",
"url",
"=",
"'/mdb/{}/commands{}'",
".",
"format",
"(",
"self",
".",
"_instance",
",",
"name",
")",
"response",
"=",
"self",
".",
"_client",
"... | Gets a single command by its unique name.
:param str name: Either a fully-qualified XTCE name or an alias in the
format ``NAMESPACE/NAME``.
:rtype: .Command | [
"Gets",
"a",
"single",
"command",
"by",
"its",
"unique",
"name",
"."
] | 1082fee8a299010cc44416bbb7518fac0ef08b48 | https://github.com/yamcs/yamcs-python/blob/1082fee8a299010cc44416bbb7518fac0ef08b48/yamcs-client/yamcs/mdb/client.py#L148-L161 | train |
yamcs/yamcs-python | yamcs-client/yamcs/mdb/client.py | MDBClient.list_algorithms | def list_algorithms(self, page_size=None):
"""
Lists the algorithms visible to this client.
Algorithms are returned in lexicographical order.
:rtype: :class:`.Algorithm` iterator
"""
params = {}
if page_size is not None:
params['limit'] = page_size
... | python | def list_algorithms(self, page_size=None):
"""
Lists the algorithms visible to this client.
Algorithms are returned in lexicographical order.
:rtype: :class:`.Algorithm` iterator
"""
params = {}
if page_size is not None:
params['limit'] = page_size
... | [
"def",
"list_algorithms",
"(",
"self",
",",
"page_size",
"=",
"None",
")",
":",
"params",
"=",
"{",
"}",
"if",
"page_size",
"is",
"not",
"None",
":",
"params",
"[",
"'limit'",
"]",
"=",
"page_size",
"return",
"pagination",
".",
"Iterator",
"(",
"client",... | Lists the algorithms visible to this client.
Algorithms are returned in lexicographical order.
:rtype: :class:`.Algorithm` iterator | [
"Lists",
"the",
"algorithms",
"visible",
"to",
"this",
"client",
"."
] | 1082fee8a299010cc44416bbb7518fac0ef08b48 | https://github.com/yamcs/yamcs-python/blob/1082fee8a299010cc44416bbb7518fac0ef08b48/yamcs-client/yamcs/mdb/client.py#L163-L183 | train |
yamcs/yamcs-python | yamcs-client/yamcs/mdb/client.py | MDBClient.get_algorithm | def get_algorithm(self, name):
"""
Gets a single algorithm by its unique name.
:param str name: Either a fully-qualified XTCE name or an alias in the
format ``NAMESPACE/NAME``.
:rtype: .Algorithm
"""
name = adapt_name_for_rest(name)
url =... | python | def get_algorithm(self, name):
"""
Gets a single algorithm by its unique name.
:param str name: Either a fully-qualified XTCE name or an alias in the
format ``NAMESPACE/NAME``.
:rtype: .Algorithm
"""
name = adapt_name_for_rest(name)
url =... | [
"def",
"get_algorithm",
"(",
"self",
",",
"name",
")",
":",
"name",
"=",
"adapt_name_for_rest",
"(",
"name",
")",
"url",
"=",
"'/mdb/{}/algorithms{}'",
".",
"format",
"(",
"self",
".",
"_instance",
",",
"name",
")",
"response",
"=",
"self",
".",
"_client",... | Gets a single algorithm by its unique name.
:param str name: Either a fully-qualified XTCE name or an alias in the
format ``NAMESPACE/NAME``.
:rtype: .Algorithm | [
"Gets",
"a",
"single",
"algorithm",
"by",
"its",
"unique",
"name",
"."
] | 1082fee8a299010cc44416bbb7518fac0ef08b48 | https://github.com/yamcs/yamcs-python/blob/1082fee8a299010cc44416bbb7518fac0ef08b48/yamcs-client/yamcs/mdb/client.py#L185-L198 | train |
yamcs/yamcs-python | yamcs-client/yamcs/storage/client.py | Client.list_buckets | def list_buckets(self, instance):
"""
List the buckets for an instance.
:param str instance: A Yamcs instance name.
:rtype: ~collections.Iterable[.Bucket]
"""
# Server does not do pagination on listings of this resource.
# Return an iterator anyway for similarity... | python | def list_buckets(self, instance):
"""
List the buckets for an instance.
:param str instance: A Yamcs instance name.
:rtype: ~collections.Iterable[.Bucket]
"""
# Server does not do pagination on listings of this resource.
# Return an iterator anyway for similarity... | [
"def",
"list_buckets",
"(",
"self",
",",
"instance",
")",
":",
"response",
"=",
"self",
".",
"_client",
".",
"get_proto",
"(",
"path",
"=",
"'/buckets/'",
"+",
"instance",
")",
"message",
"=",
"rest_pb2",
".",
"ListBucketsResponse",
"(",
")",
"message",
".... | List the buckets for an instance.
:param str instance: A Yamcs instance name.
:rtype: ~collections.Iterable[.Bucket] | [
"List",
"the",
"buckets",
"for",
"an",
"instance",
"."
] | 1082fee8a299010cc44416bbb7518fac0ef08b48 | https://github.com/yamcs/yamcs-python/blob/1082fee8a299010cc44416bbb7518fac0ef08b48/yamcs-client/yamcs/storage/client.py#L21-L35 | train |
yamcs/yamcs-python | yamcs-client/yamcs/storage/client.py | Client.list_objects | def list_objects(self, instance, bucket_name, prefix=None, delimiter=None):
"""
List the objects for a bucket.
:param str instance: A Yamcs instance name.
:param str bucket_name: The name of the bucket.
:param str prefix: If specified, only objects that start with this
... | python | def list_objects(self, instance, bucket_name, prefix=None, delimiter=None):
"""
List the objects for a bucket.
:param str instance: A Yamcs instance name.
:param str bucket_name: The name of the bucket.
:param str prefix: If specified, only objects that start with this
... | [
"def",
"list_objects",
"(",
"self",
",",
"instance",
",",
"bucket_name",
",",
"prefix",
"=",
"None",
",",
"delimiter",
"=",
"None",
")",
":",
"url",
"=",
"'/buckets/{}/{}'",
".",
"format",
"(",
"instance",
",",
"bucket_name",
")",
"params",
"=",
"{",
"}"... | List the objects for a bucket.
:param str instance: A Yamcs instance name.
:param str bucket_name: The name of the bucket.
:param str prefix: If specified, only objects that start with this
prefix are listed.
:param str delimiter: If specified, return only obj... | [
"List",
"the",
"objects",
"for",
"a",
"bucket",
"."
] | 1082fee8a299010cc44416bbb7518fac0ef08b48 | https://github.com/yamcs/yamcs-python/blob/1082fee8a299010cc44416bbb7518fac0ef08b48/yamcs-client/yamcs/storage/client.py#L37-L61 | train |
yamcs/yamcs-python | yamcs-client/yamcs/storage/client.py | Client.create_bucket | def create_bucket(self, instance, bucket_name):
"""
Create a new bucket in the specified instance.
:param str instance: A Yamcs instance name.
:param str bucket_name: The name of the bucket.
"""
req = rest_pb2.CreateBucketRequest()
req.name = bucket_name
... | python | def create_bucket(self, instance, bucket_name):
"""
Create a new bucket in the specified instance.
:param str instance: A Yamcs instance name.
:param str bucket_name: The name of the bucket.
"""
req = rest_pb2.CreateBucketRequest()
req.name = bucket_name
... | [
"def",
"create_bucket",
"(",
"self",
",",
"instance",
",",
"bucket_name",
")",
":",
"req",
"=",
"rest_pb2",
".",
"CreateBucketRequest",
"(",
")",
"req",
".",
"name",
"=",
"bucket_name",
"url",
"=",
"'/buckets/{}'",
".",
"format",
"(",
"instance",
")",
"sel... | Create a new bucket in the specified instance.
:param str instance: A Yamcs instance name.
:param str bucket_name: The name of the bucket. | [
"Create",
"a",
"new",
"bucket",
"in",
"the",
"specified",
"instance",
"."
] | 1082fee8a299010cc44416bbb7518fac0ef08b48 | https://github.com/yamcs/yamcs-python/blob/1082fee8a299010cc44416bbb7518fac0ef08b48/yamcs-client/yamcs/storage/client.py#L63-L73 | train |
yamcs/yamcs-python | yamcs-client/yamcs/storage/client.py | Client.remove_bucket | def remove_bucket(self, instance, bucket_name):
"""
Remove a bucket from the specified instance.
:param str instance: A Yamcs instance name.
:param str bucket_name: The name of the bucket.
"""
url = '/buckets/{}/{}'.format(instance, bucket_name)
self._client.dele... | python | def remove_bucket(self, instance, bucket_name):
"""
Remove a bucket from the specified instance.
:param str instance: A Yamcs instance name.
:param str bucket_name: The name of the bucket.
"""
url = '/buckets/{}/{}'.format(instance, bucket_name)
self._client.dele... | [
"def",
"remove_bucket",
"(",
"self",
",",
"instance",
",",
"bucket_name",
")",
":",
"url",
"=",
"'/buckets/{}/{}'",
".",
"format",
"(",
"instance",
",",
"bucket_name",
")",
"self",
".",
"_client",
".",
"delete_proto",
"(",
"url",
")"
] | Remove a bucket from the specified instance.
:param str instance: A Yamcs instance name.
:param str bucket_name: The name of the bucket. | [
"Remove",
"a",
"bucket",
"from",
"the",
"specified",
"instance",
"."
] | 1082fee8a299010cc44416bbb7518fac0ef08b48 | https://github.com/yamcs/yamcs-python/blob/1082fee8a299010cc44416bbb7518fac0ef08b48/yamcs-client/yamcs/storage/client.py#L75-L83 | train |
yamcs/yamcs-python | yamcs-client/yamcs/storage/client.py | Client.upload_object | def upload_object(self, instance, bucket_name, object_name, file_obj,
content_type=None):
"""
Upload an object to a bucket.
:param str instance: A Yamcs instance name.
:param str bucket_name: The name of the bucket.
:param str object_name: The target name o... | python | def upload_object(self, instance, bucket_name, object_name, file_obj,
content_type=None):
"""
Upload an object to a bucket.
:param str instance: A Yamcs instance name.
:param str bucket_name: The name of the bucket.
:param str object_name: The target name o... | [
"def",
"upload_object",
"(",
"self",
",",
"instance",
",",
"bucket_name",
",",
"object_name",
",",
"file_obj",
",",
"content_type",
"=",
"None",
")",
":",
"url",
"=",
"'/buckets/{}/{}/{}'",
".",
"format",
"(",
"instance",
",",
"bucket_name",
",",
"object_name"... | Upload an object to a bucket.
:param str instance: A Yamcs instance name.
:param str bucket_name: The name of the bucket.
:param str object_name: The target name of the object.
:param file file_obj: The file (or file-like object) to upload.
:param str content_type: The content t... | [
"Upload",
"an",
"object",
"to",
"a",
"bucket",
"."
] | 1082fee8a299010cc44416bbb7518fac0ef08b48 | https://github.com/yamcs/yamcs-python/blob/1082fee8a299010cc44416bbb7518fac0ef08b48/yamcs-client/yamcs/storage/client.py#L97-L118 | train |
yamcs/yamcs-python | yamcs-client/yamcs/storage/client.py | Client.remove_object | def remove_object(self, instance, bucket_name, object_name):
"""
Remove an object from a bucket.
:param str instance: A Yamcs instance name.
:param str bucket_name: The name of the bucket.
:param str object_name: The object to remove.
"""
url = '/buckets/{}/{}/{}... | python | def remove_object(self, instance, bucket_name, object_name):
"""
Remove an object from a bucket.
:param str instance: A Yamcs instance name.
:param str bucket_name: The name of the bucket.
:param str object_name: The object to remove.
"""
url = '/buckets/{}/{}/{}... | [
"def",
"remove_object",
"(",
"self",
",",
"instance",
",",
"bucket_name",
",",
"object_name",
")",
":",
"url",
"=",
"'/buckets/{}/{}/{}'",
".",
"format",
"(",
"instance",
",",
"bucket_name",
",",
"object_name",
")",
"self",
".",
"_client",
".",
"delete_proto",... | Remove an object from a bucket.
:param str instance: A Yamcs instance name.
:param str bucket_name: The name of the bucket.
:param str object_name: The object to remove. | [
"Remove",
"an",
"object",
"from",
"a",
"bucket",
"."
] | 1082fee8a299010cc44416bbb7518fac0ef08b48 | https://github.com/yamcs/yamcs-python/blob/1082fee8a299010cc44416bbb7518fac0ef08b48/yamcs-client/yamcs/storage/client.py#L120-L129 | train |
IS-ENES-Data/esgf-pid | esgfpid/utils/timeutils.py | get_now_utc | def get_now_utc():
''' date in UTC, ISO format'''
# Helper class for UTC time
# Source: http://stackoverflow.com/questions/2331592/datetime-datetime-utcnow-why-no-tzinfo
ZERO = datetime.timedelta(0)
class UTC(datetime.tzinfo):
"""UTC"""
def utcoffset(self, dt):
return ZE... | python | def get_now_utc():
''' date in UTC, ISO format'''
# Helper class for UTC time
# Source: http://stackoverflow.com/questions/2331592/datetime-datetime-utcnow-why-no-tzinfo
ZERO = datetime.timedelta(0)
class UTC(datetime.tzinfo):
"""UTC"""
def utcoffset(self, dt):
return ZE... | [
"def",
"get_now_utc",
"(",
")",
":",
"ZERO",
"=",
"datetime",
".",
"timedelta",
"(",
"0",
")",
"class",
"UTC",
"(",
"datetime",
".",
"tzinfo",
")",
":",
"def",
"utcoffset",
"(",
"self",
",",
"dt",
")",
":",
"return",
"ZERO",
"def",
"tzname",
"(",
"... | date in UTC, ISO format | [
"date",
"in",
"UTC",
"ISO",
"format"
] | 2f4909bb3ff79c0b6ed2932e0dd8b3bb6aec5e41 | https://github.com/IS-ENES-Data/esgf-pid/blob/2f4909bb3ff79c0b6ed2932e0dd8b3bb6aec5e41/esgfpid/utils/timeutils.py#L10-L27 | train |
sirfoga/pyhal | hal/data/linked_list.py | LinkedList.get | def get(self, position):
"""Gets value at index
:param position: index
:return: value at position
"""
counter = 0
current_node = self.head
while current_node is not None and counter <= position:
if counter == position:
return current... | python | def get(self, position):
"""Gets value at index
:param position: index
:return: value at position
"""
counter = 0
current_node = self.head
while current_node is not None and counter <= position:
if counter == position:
return current... | [
"def",
"get",
"(",
"self",
",",
"position",
")",
":",
"counter",
"=",
"0",
"current_node",
"=",
"self",
".",
"head",
"while",
"current_node",
"is",
"not",
"None",
"and",
"counter",
"<=",
"position",
":",
"if",
"counter",
"==",
"position",
":",
"return",
... | Gets value at index
:param position: index
:return: value at position | [
"Gets",
"value",
"at",
"index"
] | 4394d8a1f7e45bea28a255ec390f4962ee64d33a | https://github.com/sirfoga/pyhal/blob/4394d8a1f7e45bea28a255ec390f4962ee64d33a/hal/data/linked_list.py#L36-L53 | train |
sirfoga/pyhal | hal/data/linked_list.py | LinkedList.insert_first | def insert_first(self, val):
"""Insert in head
:param val: Object to insert
:return: True iff insertion completed successfully
"""
self.head = Node(val, next_node=self.head)
return True | python | def insert_first(self, val):
"""Insert in head
:param val: Object to insert
:return: True iff insertion completed successfully
"""
self.head = Node(val, next_node=self.head)
return True | [
"def",
"insert_first",
"(",
"self",
",",
"val",
")",
":",
"self",
".",
"head",
"=",
"Node",
"(",
"val",
",",
"next_node",
"=",
"self",
".",
"head",
")",
"return",
"True"
] | Insert in head
:param val: Object to insert
:return: True iff insertion completed successfully | [
"Insert",
"in",
"head"
] | 4394d8a1f7e45bea28a255ec390f4962ee64d33a | https://github.com/sirfoga/pyhal/blob/4394d8a1f7e45bea28a255ec390f4962ee64d33a/hal/data/linked_list.py#L91-L99 | train |
sirfoga/pyhal | hal/data/linked_list.py | LinkedList.insert | def insert(self, val, position=0):
"""Insert in position
:param val: Object to insert
:param position: Index of insertion
:return: bool: True iff insertion completed successfully
"""
if position <= 0: # at beginning
return self.insert_first(val)
cou... | python | def insert(self, val, position=0):
"""Insert in position
:param val: Object to insert
:param position: Index of insertion
:return: bool: True iff insertion completed successfully
"""
if position <= 0: # at beginning
return self.insert_first(val)
cou... | [
"def",
"insert",
"(",
"self",
",",
"val",
",",
"position",
"=",
"0",
")",
":",
"if",
"position",
"<=",
"0",
":",
"return",
"self",
".",
"insert_first",
"(",
"val",
")",
"counter",
"=",
"0",
"last_node",
"=",
"self",
".",
"head",
"current_node",
"=",
... | Insert in position
:param val: Object to insert
:param position: Index of insertion
:return: bool: True iff insertion completed successfully | [
"Insert",
"in",
"position"
] | 4394d8a1f7e45bea28a255ec390f4962ee64d33a | https://github.com/sirfoga/pyhal/blob/4394d8a1f7e45bea28a255ec390f4962ee64d33a/hal/data/linked_list.py#L101-L127 | train |
sirfoga/pyhal | hal/data/linked_list.py | LinkedList.remove | def remove(self, position):
"""Removes at index
:param position: Index of removal
:return: bool: True iff removal completed successfully
"""
if position <= 0: # at beginning
return self.remove_first()
if position >= self.length() - 1: # at end
... | python | def remove(self, position):
"""Removes at index
:param position: Index of removal
:return: bool: True iff removal completed successfully
"""
if position <= 0: # at beginning
return self.remove_first()
if position >= self.length() - 1: # at end
... | [
"def",
"remove",
"(",
"self",
",",
"position",
")",
":",
"if",
"position",
"<=",
"0",
":",
"return",
"self",
".",
"remove_first",
"(",
")",
"if",
"position",
">=",
"self",
".",
"length",
"(",
")",
"-",
"1",
":",
"return",
"self",
".",
"remove_last",
... | Removes at index
:param position: Index of removal
:return: bool: True iff removal completed successfully | [
"Removes",
"at",
"index"
] | 4394d8a1f7e45bea28a255ec390f4962ee64d33a | https://github.com/sirfoga/pyhal/blob/4394d8a1f7e45bea28a255ec390f4962ee64d33a/hal/data/linked_list.py#L165-L190 | train |
sirfoga/pyhal | hal/data/linked_list.py | LinkedList.to_lst | def to_lst(self):
"""Cycle all items and puts them in a list
:return: list representation
"""
out = []
node = self.head
while node is not None:
out.append(node.val)
node = node.next_node
return out | python | def to_lst(self):
"""Cycle all items and puts them in a list
:return: list representation
"""
out = []
node = self.head
while node is not None:
out.append(node.val)
node = node.next_node
return out | [
"def",
"to_lst",
"(",
"self",
")",
":",
"out",
"=",
"[",
"]",
"node",
"=",
"self",
".",
"head",
"while",
"node",
"is",
"not",
"None",
":",
"out",
".",
"append",
"(",
"node",
".",
"val",
")",
"node",
"=",
"node",
".",
"next_node",
"return",
"out"
... | Cycle all items and puts them in a list
:return: list representation | [
"Cycle",
"all",
"items",
"and",
"puts",
"them",
"in",
"a",
"list"
] | 4394d8a1f7e45bea28a255ec390f4962ee64d33a | https://github.com/sirfoga/pyhal/blob/4394d8a1f7e45bea28a255ec390f4962ee64d33a/hal/data/linked_list.py#L192-L204 | train |
sirfoga/pyhal | hal/data/linked_list.py | LinkedList.execute | def execute(self, func, *args, **kwargs):
"""Executes function on each item
:param func: Function to execute on each item
:param args: args of function
:param kwargs: extra args of function
:return: list: Results of calling the function on each item
"""
return [
... | python | def execute(self, func, *args, **kwargs):
"""Executes function on each item
:param func: Function to execute on each item
:param args: args of function
:param kwargs: extra args of function
:return: list: Results of calling the function on each item
"""
return [
... | [
"def",
"execute",
"(",
"self",
",",
"func",
",",
"*",
"args",
",",
"**",
"kwargs",
")",
":",
"return",
"[",
"func",
"(",
"item",
",",
"*",
"args",
",",
"**",
"kwargs",
")",
"for",
"item",
"in",
"self",
".",
"to_lst",
"(",
")",
"]"
] | Executes function on each item
:param func: Function to execute on each item
:param args: args of function
:param kwargs: extra args of function
:return: list: Results of calling the function on each item | [
"Executes",
"function",
"on",
"each",
"item"
] | 4394d8a1f7e45bea28a255ec390f4962ee64d33a | https://github.com/sirfoga/pyhal/blob/4394d8a1f7e45bea28a255ec390f4962ee64d33a/hal/data/linked_list.py#L206-L216 | train |
loganasherjones/yapconf | yapconf/items.py | from_specification | def from_specification(specification, env_prefix=None, separator='.',
parent_names=None):
"""Used to create YapconfItems from a specification dictionary.
Args:
specification (dict): The specification used to
initialize ``YapconfSpec``
env_prefix (str): Prefix ... | python | def from_specification(specification, env_prefix=None, separator='.',
parent_names=None):
"""Used to create YapconfItems from a specification dictionary.
Args:
specification (dict): The specification used to
initialize ``YapconfSpec``
env_prefix (str): Prefix ... | [
"def",
"from_specification",
"(",
"specification",
",",
"env_prefix",
"=",
"None",
",",
"separator",
"=",
"'.'",
",",
"parent_names",
"=",
"None",
")",
":",
"items",
"=",
"{",
"}",
"for",
"item_name",
",",
"item_info",
"in",
"six",
".",
"iteritems",
"(",
... | Used to create YapconfItems from a specification dictionary.
Args:
specification (dict): The specification used to
initialize ``YapconfSpec``
env_prefix (str): Prefix to add to environment names
separator (str): Separator for nested items
parent_names (list): Parents nam... | [
"Used",
"to",
"create",
"YapconfItems",
"from",
"a",
"specification",
"dictionary",
"."
] | d2970e6e7e3334615d4d978d8b0ca33006d79d16 | https://github.com/loganasherjones/yapconf/blob/d2970e6e7e3334615d4d978d8b0ca33006d79d16/yapconf/items.py#L23-L46 | train |
loganasherjones/yapconf | yapconf/items.py | YapconfItem.update_default | def update_default(self, new_default, respect_none=False):
"""Update our current default with the new_default.
Args:
new_default: New default to set.
respect_none: Flag to determine if ``None`` is a valid value.
"""
if new_default is not None:
self.d... | python | def update_default(self, new_default, respect_none=False):
"""Update our current default with the new_default.
Args:
new_default: New default to set.
respect_none: Flag to determine if ``None`` is a valid value.
"""
if new_default is not None:
self.d... | [
"def",
"update_default",
"(",
"self",
",",
"new_default",
",",
"respect_none",
"=",
"False",
")",
":",
"if",
"new_default",
"is",
"not",
"None",
":",
"self",
".",
"default",
"=",
"new_default",
"elif",
"new_default",
"is",
"None",
"and",
"respect_none",
":",... | Update our current default with the new_default.
Args:
new_default: New default to set.
respect_none: Flag to determine if ``None`` is a valid value. | [
"Update",
"our",
"current",
"default",
"with",
"the",
"new_default",
"."
] | d2970e6e7e3334615d4d978d8b0ca33006d79d16 | https://github.com/loganasherjones/yapconf/blob/d2970e6e7e3334615d4d978d8b0ca33006d79d16/yapconf/items.py#L243-L254 | train |
loganasherjones/yapconf | yapconf/items.py | YapconfItem.migrate_config | def migrate_config(self, current_config, config_to_migrate,
always_update, update_defaults):
"""Migrate config value in current_config, updating config_to_migrate.
Given the current_config object, it will attempt to find a value
based on all the names given. If no name co... | python | def migrate_config(self, current_config, config_to_migrate,
always_update, update_defaults):
"""Migrate config value in current_config, updating config_to_migrate.
Given the current_config object, it will attempt to find a value
based on all the names given. If no name co... | [
"def",
"migrate_config",
"(",
"self",
",",
"current_config",
",",
"config_to_migrate",
",",
"always_update",
",",
"update_defaults",
")",
":",
"value",
"=",
"self",
".",
"_search_config_for_possible_names",
"(",
"current_config",
")",
"self",
".",
"_update_config",
... | Migrate config value in current_config, updating config_to_migrate.
Given the current_config object, it will attempt to find a value
based on all the names given. If no name could be found, then it
will simply set the value to the default.
If a value is found and is in the list of prev... | [
"Migrate",
"config",
"value",
"in",
"current_config",
"updating",
"config_to_migrate",
"."
] | d2970e6e7e3334615d4d978d8b0ca33006d79d16 | https://github.com/loganasherjones/yapconf/blob/d2970e6e7e3334615d4d978d8b0ca33006d79d16/yapconf/items.py#L256-L279 | train |
loganasherjones/yapconf | yapconf/items.py | YapconfItem.add_argument | def add_argument(self, parser, bootstrap=False):
"""Add this item as an argument to the given parser.
Args:
parser (argparse.ArgumentParser): The parser to add this item to.
bootstrap: Flag to indicate whether you only want to mark this
item as required or not
... | python | def add_argument(self, parser, bootstrap=False):
"""Add this item as an argument to the given parser.
Args:
parser (argparse.ArgumentParser): The parser to add this item to.
bootstrap: Flag to indicate whether you only want to mark this
item as required or not
... | [
"def",
"add_argument",
"(",
"self",
",",
"parser",
",",
"bootstrap",
"=",
"False",
")",
":",
"if",
"self",
".",
"cli_expose",
":",
"args",
"=",
"self",
".",
"_get_argparse_names",
"(",
"parser",
".",
"prefix_chars",
")",
"kwargs",
"=",
"self",
".",
"_get... | Add this item as an argument to the given parser.
Args:
parser (argparse.ArgumentParser): The parser to add this item to.
bootstrap: Flag to indicate whether you only want to mark this
item as required or not | [
"Add",
"this",
"item",
"as",
"an",
"argument",
"to",
"the",
"given",
"parser",
"."
] | d2970e6e7e3334615d4d978d8b0ca33006d79d16 | https://github.com/loganasherjones/yapconf/blob/d2970e6e7e3334615d4d978d8b0ca33006d79d16/yapconf/items.py#L281-L292 | train |
loganasherjones/yapconf | yapconf/items.py | YapconfItem.get_config_value | def get_config_value(self, overrides, skip_environment=False):
"""Get the configuration value from all overrides.
Iterates over all overrides given to see if a value can be pulled
out from them. It will convert each of these values to ensure they
are the correct type.
Args:
... | python | def get_config_value(self, overrides, skip_environment=False):
"""Get the configuration value from all overrides.
Iterates over all overrides given to see if a value can be pulled
out from them. It will convert each of these values to ensure they
are the correct type.
Args:
... | [
"def",
"get_config_value",
"(",
"self",
",",
"overrides",
",",
"skip_environment",
"=",
"False",
")",
":",
"label",
",",
"override",
",",
"key",
"=",
"self",
".",
"_search_overrides",
"(",
"overrides",
",",
"skip_environment",
")",
"if",
"override",
"is",
"N... | Get the configuration value from all overrides.
Iterates over all overrides given to see if a value can be pulled
out from them. It will convert each of these values to ensure they
are the correct type.
Args:
overrides: A list of tuples where each tuple is a label and a
... | [
"Get",
"the",
"configuration",
"value",
"from",
"all",
"overrides",
"."
] | d2970e6e7e3334615d4d978d8b0ca33006d79d16 | https://github.com/loganasherjones/yapconf/blob/d2970e6e7e3334615d4d978d8b0ca33006d79d16/yapconf/items.py#L294-L342 | train |
loganasherjones/yapconf | yapconf/items.py | YapconfBoolItem.add_argument | def add_argument(self, parser, bootstrap=False):
"""Add boolean item as an argument to the given parser.
An exclusive group is created on the parser, which will add
a boolean-style command line argument to the parser.
Examples:
A non-nested boolean value with the name 'debu... | python | def add_argument(self, parser, bootstrap=False):
"""Add boolean item as an argument to the given parser.
An exclusive group is created on the parser, which will add
a boolean-style command line argument to the parser.
Examples:
A non-nested boolean value with the name 'debu... | [
"def",
"add_argument",
"(",
"self",
",",
"parser",
",",
"bootstrap",
"=",
"False",
")",
":",
"tmp_default",
"=",
"self",
".",
"default",
"exclusive_grp",
"=",
"parser",
".",
"add_mutually_exclusive_group",
"(",
")",
"self",
".",
"default",
"=",
"True",
"args... | Add boolean item as an argument to the given parser.
An exclusive group is created on the parser, which will add
a boolean-style command line argument to the parser.
Examples:
A non-nested boolean value with the name 'debug' will result
in a command-line argument like t... | [
"Add",
"boolean",
"item",
"as",
"an",
"argument",
"to",
"the",
"given",
"parser",
"."
] | d2970e6e7e3334615d4d978d8b0ca33006d79d16 | https://github.com/loganasherjones/yapconf/blob/d2970e6e7e3334615d4d978d8b0ca33006d79d16/yapconf/items.py#L591-L620 | train |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.