repo stringlengths 7 55 | path stringlengths 4 223 | func_name stringlengths 1 134 | original_string stringlengths 75 104k | language stringclasses 1
value | code stringlengths 75 104k | code_tokens listlengths 19 28.4k | docstring stringlengths 1 46.9k | docstring_tokens listlengths 1 1.97k | sha stringlengths 40 40 | url stringlengths 87 315 | partition stringclasses 3
values | summary stringlengths 4 350 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
PeerAssets/pypeerassets | pypeerassets/voting.py | parse_vote_info | def parse_vote_info(protobuf: bytes) -> dict:
'''decode vote init tx op_return protobuf message and validate it.'''
vote = pavoteproto.Vote()
vote.ParseFromString(protobuf)
assert vote.version > 0, {"error": "Vote info incomplete, version can't be 0."}
assert vote.start_block < vote.end_block, {"e... | python | def parse_vote_info(protobuf: bytes) -> dict:
'''decode vote init tx op_return protobuf message and validate it.'''
vote = pavoteproto.Vote()
vote.ParseFromString(protobuf)
assert vote.version > 0, {"error": "Vote info incomplete, version can't be 0."}
assert vote.start_block < vote.end_block, {"e... | [
"def",
"parse_vote_info",
"(",
"protobuf",
":",
"bytes",
")",
"->",
"dict",
":",
"vote",
"=",
"pavoteproto",
".",
"Vote",
"(",
")",
"vote",
".",
"ParseFromString",
"(",
"protobuf",
")",
"assert",
"vote",
".",
"version",
">",
"0",
",",
"{",
"\"error\"",
... | decode vote init tx op_return protobuf message and validate it. | [
"decode",
"vote",
"init",
"tx",
"op_return",
"protobuf",
"message",
"and",
"validate",
"it",
"."
] | 8927b4a686887f44fe2cd9de777e2c827c948987 | https://github.com/PeerAssets/pypeerassets/blob/8927b4a686887f44fe2cd9de777e2c827c948987/pypeerassets/voting.py#L101-L118 | train | decode vote init tx op_return protobuf message and validate it. |
PeerAssets/pypeerassets | pypeerassets/voting.py | vote_init | def vote_init(vote: Vote, inputs: dict, change_address: str) -> bytes:
'''initialize vote transaction, must be signed by the deck_issuer privkey'''
network_params = net_query(vote.deck.network)
deck_vote_tag_address = deck_vote_tag(vote.deck)
tx_fee = network_params.min_tx_fee # settle for min tx fee... | python | def vote_init(vote: Vote, inputs: dict, change_address: str) -> bytes:
'''initialize vote transaction, must be signed by the deck_issuer privkey'''
network_params = net_query(vote.deck.network)
deck_vote_tag_address = deck_vote_tag(vote.deck)
tx_fee = network_params.min_tx_fee # settle for min tx fee... | [
"def",
"vote_init",
"(",
"vote",
":",
"Vote",
",",
"inputs",
":",
"dict",
",",
"change_address",
":",
"str",
")",
"->",
"bytes",
":",
"network_params",
"=",
"net_query",
"(",
"vote",
".",
"deck",
".",
"network",
")",
"deck_vote_tag_address",
"=",
"deck_vot... | initialize vote transaction, must be signed by the deck_issuer privkey | [
"initialize",
"vote",
"transaction",
"must",
"be",
"signed",
"by",
"the",
"deck_issuer",
"privkey"
] | 8927b4a686887f44fe2cd9de777e2c827c948987 | https://github.com/PeerAssets/pypeerassets/blob/8927b4a686887f44fe2cd9de777e2c827c948987/pypeerassets/voting.py#L121-L140 | train | initialize vote transaction must be signed by the deck_issuer privkey |
PeerAssets/pypeerassets | pypeerassets/voting.py | find_vote_inits | def find_vote_inits(provider: Provider, deck: Deck) -> Iterable[Vote]:
'''find vote_inits on this deck'''
vote_ints = provider.listtransactions(deck_vote_tag(deck))
for txid in vote_ints:
try:
raw_vote = provider.getrawtransaction(txid)
vote = parse_vote_info(read_tx_opretu... | python | def find_vote_inits(provider: Provider, deck: Deck) -> Iterable[Vote]:
'''find vote_inits on this deck'''
vote_ints = provider.listtransactions(deck_vote_tag(deck))
for txid in vote_ints:
try:
raw_vote = provider.getrawtransaction(txid)
vote = parse_vote_info(read_tx_opretu... | [
"def",
"find_vote_inits",
"(",
"provider",
":",
"Provider",
",",
"deck",
":",
"Deck",
")",
"->",
"Iterable",
"[",
"Vote",
"]",
":",
"vote_ints",
"=",
"provider",
".",
"listtransactions",
"(",
"deck_vote_tag",
"(",
"deck",
")",
")",
"for",
"txid",
"in",
"... | find vote_inits on this deck | [
"find",
"vote_inits",
"on",
"this",
"deck"
] | 8927b4a686887f44fe2cd9de777e2c827c948987 | https://github.com/PeerAssets/pypeerassets/blob/8927b4a686887f44fe2cd9de777e2c827c948987/pypeerassets/voting.py#L143-L157 | train | find vote_inits on this deck |
PeerAssets/pypeerassets | pypeerassets/voting.py | vote_cast | def vote_cast(vote: Vote, choice_index: int, inputs: dict,
change_address: str) -> bytes:
'''vote cast transaction'''
network_params = net_query(vote.deck.network)
vote_cast_addr = vote.vote_choice_address[choice_index]
tx_fee = network_params.min_tx_fee # settle for min tx fee for now
... | python | def vote_cast(vote: Vote, choice_index: int, inputs: dict,
change_address: str) -> bytes:
'''vote cast transaction'''
network_params = net_query(vote.deck.network)
vote_cast_addr = vote.vote_choice_address[choice_index]
tx_fee = network_params.min_tx_fee # settle for min tx fee for now
... | [
"def",
"vote_cast",
"(",
"vote",
":",
"Vote",
",",
"choice_index",
":",
"int",
",",
"inputs",
":",
"dict",
",",
"change_address",
":",
"str",
")",
"->",
"bytes",
":",
"network_params",
"=",
"net_query",
"(",
"vote",
".",
"deck",
".",
"network",
")",
"v... | vote cast transaction | [
"vote",
"cast",
"transaction"
] | 8927b4a686887f44fe2cd9de777e2c827c948987 | https://github.com/PeerAssets/pypeerassets/blob/8927b4a686887f44fe2cd9de777e2c827c948987/pypeerassets/voting.py#L160-L179 | train | vote cast transaction |
PeerAssets/pypeerassets | pypeerassets/voting.py | find_vote_casts | def find_vote_casts(provider: Provider, vote: Vote, choice_index: int) -> Iterable[VoteCast]:
'''find and verify vote_casts on this vote_choice_address'''
vote_casts = provider.listtransactions(vote.vote_choice_address[choice_index])
for tx in vote_casts:
raw_tx = provider.getrawtransaction(tx, 1)
... | python | def find_vote_casts(provider: Provider, vote: Vote, choice_index: int) -> Iterable[VoteCast]:
'''find and verify vote_casts on this vote_choice_address'''
vote_casts = provider.listtransactions(vote.vote_choice_address[choice_index])
for tx in vote_casts:
raw_tx = provider.getrawtransaction(tx, 1)
... | [
"def",
"find_vote_casts",
"(",
"provider",
":",
"Provider",
",",
"vote",
":",
"Vote",
",",
"choice_index",
":",
"int",
")",
"->",
"Iterable",
"[",
"VoteCast",
"]",
":",
"vote_casts",
"=",
"provider",
".",
"listtransactions",
"(",
"vote",
".",
"vote_choice_ad... | find and verify vote_casts on this vote_choice_address | [
"find",
"and",
"verify",
"vote_casts",
"on",
"this",
"vote_choice_address"
] | 8927b4a686887f44fe2cd9de777e2c827c948987 | https://github.com/PeerAssets/pypeerassets/blob/8927b4a686887f44fe2cd9de777e2c827c948987/pypeerassets/voting.py#L207-L217 | train | find and verify vote_casts on this vote_choice_address |
PeerAssets/pypeerassets | pypeerassets/voting.py | Vote.to_protobuf | def to_protobuf(self) -> str:
'''encode vote into protobuf'''
vote = pavoteproto.Vote()
vote.version = self.version
vote.description = self.description
vote.count_mode = vote.MODE.Value(self.count_mode)
vote.start_block = self.start_block
vote.end_block = self.en... | python | def to_protobuf(self) -> str:
'''encode vote into protobuf'''
vote = pavoteproto.Vote()
vote.version = self.version
vote.description = self.description
vote.count_mode = vote.MODE.Value(self.count_mode)
vote.start_block = self.start_block
vote.end_block = self.en... | [
"def",
"to_protobuf",
"(",
"self",
")",
"->",
"str",
":",
"vote",
"=",
"pavoteproto",
".",
"Vote",
"(",
")",
"vote",
".",
"version",
"=",
"self",
".",
"version",
"vote",
".",
"description",
"=",
"self",
".",
"description",
"vote",
".",
"count_mode",
"=... | encode vote into protobuf | [
"encode",
"vote",
"into",
"protobuf"
] | 8927b4a686887f44fe2cd9de777e2c827c948987 | https://github.com/PeerAssets/pypeerassets/blob/8927b4a686887f44fe2cd9de777e2c827c948987/pypeerassets/voting.py#L44-L65 | train | encode vote into protobuf |
PeerAssets/pypeerassets | pypeerassets/voting.py | Vote.to_dict | def to_dict(self) -> dict:
'''vote info as dict'''
return {
"version": self.version,
"description": self.description,
"count_mode": self.count_mode,
"start_block": self.start_block,
"end_block": self.end_block,
"choices": self.choi... | python | def to_dict(self) -> dict:
'''vote info as dict'''
return {
"version": self.version,
"description": self.description,
"count_mode": self.count_mode,
"start_block": self.start_block,
"end_block": self.end_block,
"choices": self.choi... | [
"def",
"to_dict",
"(",
"self",
")",
"->",
"dict",
":",
"return",
"{",
"\"version\"",
":",
"self",
".",
"version",
",",
"\"description\"",
":",
"self",
".",
"description",
",",
"\"count_mode\"",
":",
"self",
".",
"count_mode",
",",
"\"start_block\"",
":",
"... | vote info as dict | [
"vote",
"info",
"as",
"dict"
] | 8927b4a686887f44fe2cd9de777e2c827c948987 | https://github.com/PeerAssets/pypeerassets/blob/8927b4a686887f44fe2cd9de777e2c827c948987/pypeerassets/voting.py#L68-L79 | train | vote info as dict |
PeerAssets/pypeerassets | pypeerassets/voting.py | Vote.vote_choice_address | def vote_choice_address(self) -> List[str]:
'''calculate the addresses on which the vote is casted.'''
if self.vote_id is None:
raise Exception("vote_id is required")
addresses = []
vote_init_txid = unhexlify(self.vote_id)
for choice in self.choices:
vo... | python | def vote_choice_address(self) -> List[str]:
'''calculate the addresses on which the vote is casted.'''
if self.vote_id is None:
raise Exception("vote_id is required")
addresses = []
vote_init_txid = unhexlify(self.vote_id)
for choice in self.choices:
vo... | [
"def",
"vote_choice_address",
"(",
"self",
")",
"->",
"List",
"[",
"str",
"]",
":",
"if",
"self",
".",
"vote_id",
"is",
"None",
":",
"raise",
"Exception",
"(",
"\"vote_id is required\"",
")",
"addresses",
"=",
"[",
"]",
"vote_init_txid",
"=",
"unhexlify",
... | calculate the addresses on which the vote is casted. | [
"calculate",
"the",
"addresses",
"on",
"which",
"the",
"vote",
"is",
"casted",
"."
] | 8927b4a686887f44fe2cd9de777e2c827c948987 | https://github.com/PeerAssets/pypeerassets/blob/8927b4a686887f44fe2cd9de777e2c827c948987/pypeerassets/voting.py#L82-L98 | train | calculate the addresses on which the vote is casted. |
PeerAssets/pypeerassets | pypeerassets/voting.py | VoteCast.is_valid | def is_valid(self) -> bool:
'''check if VoteCast is valid'''
if not (self.blocknum >= self.vote.start_block and
self.blocknum <= self.vote.end_block):
return False
if not self.confirmations >= 6:
return False
return True | python | def is_valid(self) -> bool:
'''check if VoteCast is valid'''
if not (self.blocknum >= self.vote.start_block and
self.blocknum <= self.vote.end_block):
return False
if not self.confirmations >= 6:
return False
return True | [
"def",
"is_valid",
"(",
"self",
")",
"->",
"bool",
":",
"if",
"not",
"(",
"self",
".",
"blocknum",
">=",
"self",
".",
"vote",
".",
"start_block",
"and",
"self",
".",
"blocknum",
"<=",
"self",
".",
"vote",
".",
"end_block",
")",
":",
"return",
"False"... | check if VoteCast is valid | [
"check",
"if",
"VoteCast",
"is",
"valid"
] | 8927b4a686887f44fe2cd9de777e2c827c948987 | https://github.com/PeerAssets/pypeerassets/blob/8927b4a686887f44fe2cd9de777e2c827c948987/pypeerassets/voting.py#L194-L204 | train | check if VoteCast is valid |
nmdp-bioinformatics/SeqAnn | seqann/models/reference_data.py | ReferenceData.search_refdata | def search_refdata(self, seq, locus):
"""
This checks to see if a sequence already exists in the reference data. If it does, then it'll return the known annotation.
:return: The Annotation of associated with the input sequence
:rtype: :ref:`ann`
Example:
>>> from B... | python | def search_refdata(self, seq, locus):
"""
This checks to see if a sequence already exists in the reference data. If it does, then it'll return the known annotation.
:return: The Annotation of associated with the input sequence
:rtype: :ref:`ann`
Example:
>>> from B... | [
"def",
"search_refdata",
"(",
"self",
",",
"seq",
",",
"locus",
")",
":",
"# TODO: ONLY MAKE ONE CONNECTION",
"# TODO: add try statement",
"# TODO: take password from environment variable",
"if",
"self",
".",
"server_avail",
":",
"hla",
",",
"loc",
"=",
"locus",
".",
... | This checks to see if a sequence already exists in the reference data. If it does, then it'll return the known annotation.
:return: The Annotation of associated with the input sequence
:rtype: :ref:`ann`
Example:
>>> from Bio.Seq import Seq
>>> from seqann.models.refer... | [
"This",
"checks",
"to",
"see",
"if",
"a",
"sequence",
"already",
"exists",
"in",
"the",
"reference",
"data",
".",
"If",
"it",
"does",
"then",
"it",
"ll",
"return",
"the",
"known",
"annotation",
"."
] | 5ce91559b0a4fbe4fb7758e034eb258202632463 | https://github.com/nmdp-bioinformatics/SeqAnn/blob/5ce91559b0a4fbe4fb7758e034eb258202632463/seqann/models/reference_data.py#L621-L679 | train | This function searches the reference data for a sequence and loc. |
nmdp-bioinformatics/SeqAnn | seqann/models/reference_data.py | ReferenceData.seqrecord | def seqrecord(self, allele, locus):
"""
Gets the Annotation from the found sequence
:return: The Annotation from the found sequence
:rtype: Annotation
"""
try:
db = self.server[self.dbversion + "_" + locus]
except:
self.logger.error("The d... | python | def seqrecord(self, allele, locus):
"""
Gets the Annotation from the found sequence
:return: The Annotation from the found sequence
:rtype: Annotation
"""
try:
db = self.server[self.dbversion + "_" + locus]
except:
self.logger.error("The d... | [
"def",
"seqrecord",
"(",
"self",
",",
"allele",
",",
"locus",
")",
":",
"try",
":",
"db",
"=",
"self",
".",
"server",
"[",
"self",
".",
"dbversion",
"+",
"\"_\"",
"+",
"locus",
"]",
"except",
":",
"self",
".",
"logger",
".",
"error",
"(",
"\"The da... | Gets the Annotation from the found sequence
:return: The Annotation from the found sequence
:rtype: Annotation | [
"Gets",
"the",
"Annotation",
"from",
"the",
"found",
"sequence"
] | 5ce91559b0a4fbe4fb7758e034eb258202632463 | https://github.com/nmdp-bioinformatics/SeqAnn/blob/5ce91559b0a4fbe4fb7758e034eb258202632463/seqann/models/reference_data.py#L716-L731 | train | Gets the Annotation from the found sequence
|
nmdp-bioinformatics/SeqAnn | seqann/models/reference_data.py | ReferenceData.seqannotation | def seqannotation(self, seqrecord, allele, loc):
"""
Gets the Annotation from the found sequence
:return: The Annotation from the found sequence
:rtype: Annotation
"""
#seqrecord = self.seqrecord(allele, loc)
complete_annotation = get_features(seqrecord)
... | python | def seqannotation(self, seqrecord, allele, loc):
"""
Gets the Annotation from the found sequence
:return: The Annotation from the found sequence
:rtype: Annotation
"""
#seqrecord = self.seqrecord(allele, loc)
complete_annotation = get_features(seqrecord)
... | [
"def",
"seqannotation",
"(",
"self",
",",
"seqrecord",
",",
"allele",
",",
"loc",
")",
":",
"#seqrecord = self.seqrecord(allele, loc)",
"complete_annotation",
"=",
"get_features",
"(",
"seqrecord",
")",
"annotation",
"=",
"Annotation",
"(",
"annotation",
"=",
"compl... | Gets the Annotation from the found sequence
:return: The Annotation from the found sequence
:rtype: Annotation | [
"Gets",
"the",
"Annotation",
"from",
"the",
"found",
"sequence"
] | 5ce91559b0a4fbe4fb7758e034eb258202632463 | https://github.com/nmdp-bioinformatics/SeqAnn/blob/5ce91559b0a4fbe4fb7758e034eb258202632463/seqann/models/reference_data.py#L733-L751 | train | Gets the Annotation from the found sequence record |
LISE-B26/pylabcontrol | build/lib/pylabcontrol/src/core/parameter.py | Parameter.update | def update(self, *args):
"""
updates the values of the parameter, just as a regular dictionary
"""
for d in args:
for (key, value) in d.items():
self.__setitem__(key, value) | python | def update(self, *args):
"""
updates the values of the parameter, just as a regular dictionary
"""
for d in args:
for (key, value) in d.items():
self.__setitem__(key, value) | [
"def",
"update",
"(",
"self",
",",
"*",
"args",
")",
":",
"for",
"d",
"in",
"args",
":",
"for",
"(",
"key",
",",
"value",
")",
"in",
"d",
".",
"items",
"(",
")",
":",
"self",
".",
"__setitem__",
"(",
"key",
",",
"value",
")"
] | updates the values of the parameter, just as a regular dictionary | [
"updates",
"the",
"values",
"of",
"the",
"parameter",
"just",
"as",
"a",
"regular",
"dictionary"
] | 67482e5157fcd1c40705e5c2cacfb93564703ed0 | https://github.com/LISE-B26/pylabcontrol/blob/67482e5157fcd1c40705e5c2cacfb93564703ed0/build/lib/pylabcontrol/src/core/parameter.py#L110-L116 | train | Updates the values of the items of the resource table. |
LISE-B26/pylabcontrol | build/lib/pylabcontrol/src/core/parameter.py | Parameter.is_valid | def is_valid(value, valid_values):
"""
check is the value is valid
Args:
value: value to be tested
valid_values: allowed valid values (type or list of values)
Returns:
"""
valid = False
if isinstance(valid_values, type) and type(value) ... | python | def is_valid(value, valid_values):
"""
check is the value is valid
Args:
value: value to be tested
valid_values: allowed valid values (type or list of values)
Returns:
"""
valid = False
if isinstance(valid_values, type) and type(value) ... | [
"def",
"is_valid",
"(",
"value",
",",
"valid_values",
")",
":",
"valid",
"=",
"False",
"if",
"isinstance",
"(",
"valid_values",
",",
"type",
")",
"and",
"type",
"(",
"value",
")",
"is",
"valid_values",
":",
"valid",
"=",
"True",
"elif",
"isinstance",
"("... | check is the value is valid
Args:
value: value to be tested
valid_values: allowed valid values (type or list of values)
Returns: | [
"check",
"is",
"the",
"value",
"is",
"valid",
"Args",
":",
"value",
":",
"value",
"to",
"be",
"tested",
"valid_values",
":",
"allowed",
"valid",
"values",
"(",
"type",
"or",
"list",
"of",
"values",
")"
] | 67482e5157fcd1c40705e5c2cacfb93564703ed0 | https://github.com/LISE-B26/pylabcontrol/blob/67482e5157fcd1c40705e5c2cacfb93564703ed0/build/lib/pylabcontrol/src/core/parameter.py#L145-L179 | train | check if the value is valid
|
lreis2415/PyGeoC | pygeoc/TauDEM.py | TauDEM.error | def error(msg, log_file=None):
"""Print, output error message and raise RuntimeError."""
UtilClass.print_msg(msg + os.linesep)
if log_file is not None:
UtilClass.writelog(log_file, msg, 'append')
raise RuntimeError(msg) | python | def error(msg, log_file=None):
"""Print, output error message and raise RuntimeError."""
UtilClass.print_msg(msg + os.linesep)
if log_file is not None:
UtilClass.writelog(log_file, msg, 'append')
raise RuntimeError(msg) | [
"def",
"error",
"(",
"msg",
",",
"log_file",
"=",
"None",
")",
":",
"UtilClass",
".",
"print_msg",
"(",
"msg",
"+",
"os",
".",
"linesep",
")",
"if",
"log_file",
"is",
"not",
"None",
":",
"UtilClass",
".",
"writelog",
"(",
"log_file",
",",
"msg",
",",... | Print, output error message and raise RuntimeError. | [
"Print",
"output",
"error",
"message",
"and",
"raise",
"RuntimeError",
"."
] | 9a92d1a229bb74298e3c57f27c97079980b5f729 | https://github.com/lreis2415/PyGeoC/blob/9a92d1a229bb74298e3c57f27c97079980b5f729/pygeoc/TauDEM.py#L96-L101 | train | Print error message and raise RuntimeError. |
lreis2415/PyGeoC | pygeoc/TauDEM.py | TauDEM.log | def log(lines, log_file=None):
"""Output log message."""
err = False
for line in lines:
print(line)
if log_file is not None:
UtilClass.writelog(log_file, line, 'append')
if 'BAD TERMINATION' in line.upper():
err = True
... | python | def log(lines, log_file=None):
"""Output log message."""
err = False
for line in lines:
print(line)
if log_file is not None:
UtilClass.writelog(log_file, line, 'append')
if 'BAD TERMINATION' in line.upper():
err = True
... | [
"def",
"log",
"(",
"lines",
",",
"log_file",
"=",
"None",
")",
":",
"err",
"=",
"False",
"for",
"line",
"in",
"lines",
":",
"print",
"(",
"line",
")",
"if",
"log_file",
"is",
"not",
"None",
":",
"UtilClass",
".",
"writelog",
"(",
"log_file",
",",
"... | Output log message. | [
"Output",
"log",
"message",
"."
] | 9a92d1a229bb74298e3c57f27c97079980b5f729 | https://github.com/lreis2415/PyGeoC/blob/9a92d1a229bb74298e3c57f27c97079980b5f729/pygeoc/TauDEM.py#L104-L115 | train | Output log message. |
lreis2415/PyGeoC | pygeoc/TauDEM.py | TauDEM.write_time_log | def write_time_log(logfile, time):
"""Write time log."""
if os.path.exists(logfile):
log_status = open(logfile, 'a', encoding='utf-8')
else:
log_status = open(logfile, 'w', encoding='utf-8')
log_status.write('Function Name\tRead Time\tCompute Time\tWrite Time\... | python | def write_time_log(logfile, time):
"""Write time log."""
if os.path.exists(logfile):
log_status = open(logfile, 'a', encoding='utf-8')
else:
log_status = open(logfile, 'w', encoding='utf-8')
log_status.write('Function Name\tRead Time\tCompute Time\tWrite Time\... | [
"def",
"write_time_log",
"(",
"logfile",
",",
"time",
")",
":",
"if",
"os",
".",
"path",
".",
"exists",
"(",
"logfile",
")",
":",
"log_status",
"=",
"open",
"(",
"logfile",
",",
"'a'",
",",
"encoding",
"=",
"'utf-8'",
")",
"else",
":",
"log_status",
... | Write time log. | [
"Write",
"time",
"log",
"."
] | 9a92d1a229bb74298e3c57f27c97079980b5f729 | https://github.com/lreis2415/PyGeoC/blob/9a92d1a229bb74298e3c57f27c97079980b5f729/pygeoc/TauDEM.py#L118-L130 | train | Write time log. |
lreis2415/PyGeoC | pygeoc/TauDEM.py | TauDEM.check_infile_and_wp | def check_infile_and_wp(curinf, curwp):
"""Check the existence of the given file and directory path.
1. Raise Runtime exception of both not existed.
2. If the ``curwp`` is None, the set the base folder of ``curinf`` to it.
"""
if not os.path.exists(curinf):
if c... | python | def check_infile_and_wp(curinf, curwp):
"""Check the existence of the given file and directory path.
1. Raise Runtime exception of both not existed.
2. If the ``curwp`` is None, the set the base folder of ``curinf`` to it.
"""
if not os.path.exists(curinf):
if c... | [
"def",
"check_infile_and_wp",
"(",
"curinf",
",",
"curwp",
")",
":",
"if",
"not",
"os",
".",
"path",
".",
"exists",
"(",
"curinf",
")",
":",
"if",
"curwp",
"is",
"None",
":",
"TauDEM",
".",
"error",
"(",
"'You must specify one of the workspace and the '",
"'... | Check the existence of the given file and directory path.
1. Raise Runtime exception of both not existed.
2. If the ``curwp`` is None, the set the base folder of ``curinf`` to it. | [
"Check",
"the",
"existence",
"of",
"the",
"given",
"file",
"and",
"directory",
"path",
".",
"1",
".",
"Raise",
"Runtime",
"exception",
"of",
"both",
"not",
"existed",
".",
"2",
".",
"If",
"the",
"curwp",
"is",
"None",
"the",
"set",
"the",
"base",
"fold... | 9a92d1a229bb74298e3c57f27c97079980b5f729 | https://github.com/lreis2415/PyGeoC/blob/9a92d1a229bb74298e3c57f27c97079980b5f729/pygeoc/TauDEM.py#L163-L180 | train | Check the existence of the given file and directory path. |
lreis2415/PyGeoC | pygeoc/TauDEM.py | TauDEM.run | def run(function_name, in_files, wp=None, in_params=None, out_files=None, mpi_params=None,
log_params=None):
"""
Run TauDEM function.
- 1. The command will not execute if any input file does not exist.
- 2. An error will be detected after running the TauDEM command if
... | python | def run(function_name, in_files, wp=None, in_params=None, out_files=None, mpi_params=None,
log_params=None):
"""
Run TauDEM function.
- 1. The command will not execute if any input file does not exist.
- 2. An error will be detected after running the TauDEM command if
... | [
"def",
"run",
"(",
"function_name",
",",
"in_files",
",",
"wp",
"=",
"None",
",",
"in_params",
"=",
"None",
",",
"out_files",
"=",
"None",
",",
"mpi_params",
"=",
"None",
",",
"log_params",
"=",
"None",
")",
":",
"# Check input files",
"if",
"in_files",
... | Run TauDEM function.
- 1. The command will not execute if any input file does not exist.
- 2. An error will be detected after running the TauDEM command if
any output file does not exist;
Args:
function_name (str): Full path of TauDEM function.
in_files ... | [
"Run",
"TauDEM",
"function",
"."
] | 9a92d1a229bb74298e3c57f27c97079980b5f729 | https://github.com/lreis2415/PyGeoC/blob/9a92d1a229bb74298e3c57f27c97079980b5f729/pygeoc/TauDEM.py#L183-L374 | train | This function runs the TauDEM function and returns the output file path and parameters. |
lreis2415/PyGeoC | pygeoc/TauDEM.py | TauDEM.pitremove | def pitremove(np, dem, filleddem, workingdir=None, mpiexedir=None, exedir=None, log_file=None,
runtime_file=None, hostfile=None):
"""Run pit remove using the flooding approach """
fname = TauDEM.func_name('pitremove')
return TauDEM.run(FileClass.get_executable_fullpath(fname, e... | python | def pitremove(np, dem, filleddem, workingdir=None, mpiexedir=None, exedir=None, log_file=None,
runtime_file=None, hostfile=None):
"""Run pit remove using the flooding approach """
fname = TauDEM.func_name('pitremove')
return TauDEM.run(FileClass.get_executable_fullpath(fname, e... | [
"def",
"pitremove",
"(",
"np",
",",
"dem",
",",
"filleddem",
",",
"workingdir",
"=",
"None",
",",
"mpiexedir",
"=",
"None",
",",
"exedir",
"=",
"None",
",",
"log_file",
"=",
"None",
",",
"runtime_file",
"=",
"None",
",",
"hostfile",
"=",
"None",
")",
... | Run pit remove using the flooding approach | [
"Run",
"pit",
"remove",
"using",
"the",
"flooding",
"approach"
] | 9a92d1a229bb74298e3c57f27c97079980b5f729 | https://github.com/lreis2415/PyGeoC/blob/9a92d1a229bb74298e3c57f27c97079980b5f729/pygeoc/TauDEM.py#L377-L386 | train | Run the flooding approach of the pit remove command |
lreis2415/PyGeoC | pygeoc/TauDEM.py | TauDEM.d8flowdir | def d8flowdir(np, filleddem, flowdir, slope, workingdir=None, mpiexedir=None, exedir=None,
log_file=None, runtime_file=None, hostfile=None):
"""Run D8 flow direction"""
fname = TauDEM.func_name('d8flowdir')
return TauDEM.run(FileClass.get_executable_fullpath(fname, exedir),
... | python | def d8flowdir(np, filleddem, flowdir, slope, workingdir=None, mpiexedir=None, exedir=None,
log_file=None, runtime_file=None, hostfile=None):
"""Run D8 flow direction"""
fname = TauDEM.func_name('d8flowdir')
return TauDEM.run(FileClass.get_executable_fullpath(fname, exedir),
... | [
"def",
"d8flowdir",
"(",
"np",
",",
"filleddem",
",",
"flowdir",
",",
"slope",
",",
"workingdir",
"=",
"None",
",",
"mpiexedir",
"=",
"None",
",",
"exedir",
"=",
"None",
",",
"log_file",
"=",
"None",
",",
"runtime_file",
"=",
"None",
",",
"hostfile",
"... | Run D8 flow direction | [
"Run",
"D8",
"flow",
"direction"
] | 9a92d1a229bb74298e3c57f27c97079980b5f729 | https://github.com/lreis2415/PyGeoC/blob/9a92d1a229bb74298e3c57f27c97079980b5f729/pygeoc/TauDEM.py#L389-L398 | train | Run D8 flow direction |
lreis2415/PyGeoC | pygeoc/TauDEM.py | TauDEM.dinfflowdir | def dinfflowdir(np, filleddem, flowangle, slope, workingdir=None, mpiexedir=None, exedir=None,
log_file=None, runtime_file=None, hostfile=None):
"""Run Dinf flow direction"""
fname = TauDEM.func_name('dinfflowdir')
return TauDEM.run(FileClass.get_executable_fullpath(fname, ex... | python | def dinfflowdir(np, filleddem, flowangle, slope, workingdir=None, mpiexedir=None, exedir=None,
log_file=None, runtime_file=None, hostfile=None):
"""Run Dinf flow direction"""
fname = TauDEM.func_name('dinfflowdir')
return TauDEM.run(FileClass.get_executable_fullpath(fname, ex... | [
"def",
"dinfflowdir",
"(",
"np",
",",
"filleddem",
",",
"flowangle",
",",
"slope",
",",
"workingdir",
"=",
"None",
",",
"mpiexedir",
"=",
"None",
",",
"exedir",
"=",
"None",
",",
"log_file",
"=",
"None",
",",
"runtime_file",
"=",
"None",
",",
"hostfile",... | Run Dinf flow direction | [
"Run",
"Dinf",
"flow",
"direction"
] | 9a92d1a229bb74298e3c57f27c97079980b5f729 | https://github.com/lreis2415/PyGeoC/blob/9a92d1a229bb74298e3c57f27c97079980b5f729/pygeoc/TauDEM.py#L401-L410 | train | Run Dinf flow direction |
lreis2415/PyGeoC | pygeoc/TauDEM.py | TauDEM.aread8 | def aread8(np, flowdir, acc, outlet=None, streamskeleton=None, edgecontaimination=False,
workingdir=None, mpiexedir=None, exedir=None,
log_file=None, runtime_file=None, hostfile=None):
"""Run Accumulate area according to D8 flow direction"""
# -nc means do not consider edge... | python | def aread8(np, flowdir, acc, outlet=None, streamskeleton=None, edgecontaimination=False,
workingdir=None, mpiexedir=None, exedir=None,
log_file=None, runtime_file=None, hostfile=None):
"""Run Accumulate area according to D8 flow direction"""
# -nc means do not consider edge... | [
"def",
"aread8",
"(",
"np",
",",
"flowdir",
",",
"acc",
",",
"outlet",
"=",
"None",
",",
"streamskeleton",
"=",
"None",
",",
"edgecontaimination",
"=",
"False",
",",
"workingdir",
"=",
"None",
",",
"mpiexedir",
"=",
"None",
",",
"exedir",
"=",
"None",
... | Run Accumulate area according to D8 flow direction | [
"Run",
"Accumulate",
"area",
"according",
"to",
"D8",
"flow",
"direction"
] | 9a92d1a229bb74298e3c57f27c97079980b5f729 | https://github.com/lreis2415/PyGeoC/blob/9a92d1a229bb74298e3c57f27c97079980b5f729/pygeoc/TauDEM.py#L413-L428 | train | Run Accumulate area according to D8 flow direction |
lreis2415/PyGeoC | pygeoc/TauDEM.py | TauDEM.areadinf | def areadinf(np, angfile, sca, outlet=None, wg=None, edgecontaimination=False,
workingdir=None, mpiexedir=None, exedir=None,
log_file=None, runtime_file=None, hostfile=None):
"""Run Accumulate area according to Dinf flow direction"""
# -nc means do not consider edge con... | python | def areadinf(np, angfile, sca, outlet=None, wg=None, edgecontaimination=False,
workingdir=None, mpiexedir=None, exedir=None,
log_file=None, runtime_file=None, hostfile=None):
"""Run Accumulate area according to Dinf flow direction"""
# -nc means do not consider edge con... | [
"def",
"areadinf",
"(",
"np",
",",
"angfile",
",",
"sca",
",",
"outlet",
"=",
"None",
",",
"wg",
"=",
"None",
",",
"edgecontaimination",
"=",
"False",
",",
"workingdir",
"=",
"None",
",",
"mpiexedir",
"=",
"None",
",",
"exedir",
"=",
"None",
",",
"lo... | Run Accumulate area according to Dinf flow direction | [
"Run",
"Accumulate",
"area",
"according",
"to",
"Dinf",
"flow",
"direction"
] | 9a92d1a229bb74298e3c57f27c97079980b5f729 | https://github.com/lreis2415/PyGeoC/blob/9a92d1a229bb74298e3c57f27c97079980b5f729/pygeoc/TauDEM.py#L431-L446 | train | Run Accumulate area according to Dinf flow direction |
lreis2415/PyGeoC | pygeoc/TauDEM.py | TauDEM.connectdown | def connectdown(np, p, acc, outlet, wtsd=None, workingdir=None, mpiexedir=None,
exedir=None, log_file=None, runtime_file=None, hostfile=None):
"""Reads an ad8 contributing area file,
identifies the location of the largest ad8 value as the outlet of the largest watershed"""
# ... | python | def connectdown(np, p, acc, outlet, wtsd=None, workingdir=None, mpiexedir=None,
exedir=None, log_file=None, runtime_file=None, hostfile=None):
"""Reads an ad8 contributing area file,
identifies the location of the largest ad8 value as the outlet of the largest watershed"""
# ... | [
"def",
"connectdown",
"(",
"np",
",",
"p",
",",
"acc",
",",
"outlet",
",",
"wtsd",
"=",
"None",
",",
"workingdir",
"=",
"None",
",",
"mpiexedir",
"=",
"None",
",",
"exedir",
"=",
"None",
",",
"log_file",
"=",
"None",
",",
"runtime_file",
"=",
"None",... | Reads an ad8 contributing area file,
identifies the location of the largest ad8 value as the outlet of the largest watershed | [
"Reads",
"an",
"ad8",
"contributing",
"area",
"file",
"identifies",
"the",
"location",
"of",
"the",
"largest",
"ad8",
"value",
"as",
"the",
"outlet",
"of",
"the",
"largest",
"watershed"
] | 9a92d1a229bb74298e3c57f27c97079980b5f729 | https://github.com/lreis2415/PyGeoC/blob/9a92d1a229bb74298e3c57f27c97079980b5f729/pygeoc/TauDEM.py#L449-L465 | train | Reads an ad8 contributing area file and generates a mask layer for the largest ad8 value. |
lreis2415/PyGeoC | pygeoc/TauDEM.py | TauDEM.gridnet | def gridnet(np, pfile, plenfile, tlenfile, gordfile, outlet=None, workingdir=None,
mpiexedir=None, exedir=None, log_file=None, runtime_file=None, hostfile=None):
"""Run gridnet"""
fname = TauDEM.func_name('gridnet')
return TauDEM.run(FileClass.get_executable_fullpath(fname, exedi... | python | def gridnet(np, pfile, plenfile, tlenfile, gordfile, outlet=None, workingdir=None,
mpiexedir=None, exedir=None, log_file=None, runtime_file=None, hostfile=None):
"""Run gridnet"""
fname = TauDEM.func_name('gridnet')
return TauDEM.run(FileClass.get_executable_fullpath(fname, exedi... | [
"def",
"gridnet",
"(",
"np",
",",
"pfile",
",",
"plenfile",
",",
"tlenfile",
",",
"gordfile",
",",
"outlet",
"=",
"None",
",",
"workingdir",
"=",
"None",
",",
"mpiexedir",
"=",
"None",
",",
"exedir",
"=",
"None",
",",
"log_file",
"=",
"None",
",",
"r... | Run gridnet | [
"Run",
"gridnet"
] | 9a92d1a229bb74298e3c57f27c97079980b5f729 | https://github.com/lreis2415/PyGeoC/blob/9a92d1a229bb74298e3c57f27c97079980b5f729/pygeoc/TauDEM.py#L468-L477 | train | Run gridnet with specified parameters |
lreis2415/PyGeoC | pygeoc/TauDEM.py | TauDEM.threshold | def threshold(np, acc, stream_raster, threshold=100., workingdir=None,
mpiexedir=None, exedir=None, log_file=None, runtime_file=None, hostfile=None):
"""Run threshold for stream raster"""
fname = TauDEM.func_name('threshold')
return TauDEM.run(FileClass.get_executable_fullpath(... | python | def threshold(np, acc, stream_raster, threshold=100., workingdir=None,
mpiexedir=None, exedir=None, log_file=None, runtime_file=None, hostfile=None):
"""Run threshold for stream raster"""
fname = TauDEM.func_name('threshold')
return TauDEM.run(FileClass.get_executable_fullpath(... | [
"def",
"threshold",
"(",
"np",
",",
"acc",
",",
"stream_raster",
",",
"threshold",
"=",
"100.",
",",
"workingdir",
"=",
"None",
",",
"mpiexedir",
"=",
"None",
",",
"exedir",
"=",
"None",
",",
"log_file",
"=",
"None",
",",
"runtime_file",
"=",
"None",
"... | Run threshold for stream raster | [
"Run",
"threshold",
"for",
"stream",
"raster"
] | 9a92d1a229bb74298e3c57f27c97079980b5f729 | https://github.com/lreis2415/PyGeoC/blob/9a92d1a229bb74298e3c57f27c97079980b5f729/pygeoc/TauDEM.py#L480-L489 | train | Run threshold for stream raster |
lreis2415/PyGeoC | pygeoc/TauDEM.py | TauDEM.streamnet | def streamnet(np, filleddem, flowdir, acc, streamRaster, modifiedOutlet,
streamOrder, chNetwork, chCoord, streamNet, subbasin, workingdir=None,
mpiexedir=None, exedir=None, log_file=None, runtime_file=None, hostfile=None):
"""Run streamnet"""
fname = TauDEM.func_name(... | python | def streamnet(np, filleddem, flowdir, acc, streamRaster, modifiedOutlet,
streamOrder, chNetwork, chCoord, streamNet, subbasin, workingdir=None,
mpiexedir=None, exedir=None, log_file=None, runtime_file=None, hostfile=None):
"""Run streamnet"""
fname = TauDEM.func_name(... | [
"def",
"streamnet",
"(",
"np",
",",
"filleddem",
",",
"flowdir",
",",
"acc",
",",
"streamRaster",
",",
"modifiedOutlet",
",",
"streamOrder",
",",
"chNetwork",
",",
"chCoord",
",",
"streamNet",
",",
"subbasin",
",",
"workingdir",
"=",
"None",
",",
"mpiexedir"... | Run streamnet | [
"Run",
"streamnet"
] | 9a92d1a229bb74298e3c57f27c97079980b5f729 | https://github.com/lreis2415/PyGeoC/blob/9a92d1a229bb74298e3c57f27c97079980b5f729/pygeoc/TauDEM.py#L492-L504 | train | Run streamnet |
lreis2415/PyGeoC | pygeoc/TauDEM.py | TauDEM.moveoutletstostrm | def moveoutletstostrm(np, flowdir, streamRaster, outlet, modifiedOutlet,
workingdir=None, mpiexedir=None,
exedir=None, log_file=None, runtime_file=None, hostfile=None):
"""Run move the given outlets to stream"""
fname = TauDEM.func_name('moveoutletstos... | python | def moveoutletstostrm(np, flowdir, streamRaster, outlet, modifiedOutlet,
workingdir=None, mpiexedir=None,
exedir=None, log_file=None, runtime_file=None, hostfile=None):
"""Run move the given outlets to stream"""
fname = TauDEM.func_name('moveoutletstos... | [
"def",
"moveoutletstostrm",
"(",
"np",
",",
"flowdir",
",",
"streamRaster",
",",
"outlet",
",",
"modifiedOutlet",
",",
"workingdir",
"=",
"None",
",",
"mpiexedir",
"=",
"None",
",",
"exedir",
"=",
"None",
",",
"log_file",
"=",
"None",
",",
"runtime_file",
... | Run move the given outlets to stream | [
"Run",
"move",
"the",
"given",
"outlets",
"to",
"stream"
] | 9a92d1a229bb74298e3c57f27c97079980b5f729 | https://github.com/lreis2415/PyGeoC/blob/9a92d1a229bb74298e3c57f27c97079980b5f729/pygeoc/TauDEM.py#L507-L518 | train | Run move the given outlets to stream |
lreis2415/PyGeoC | pygeoc/TauDEM.py | TauDEM.convertdistmethod | def convertdistmethod(method_str):
"""Convert distance method to h, v, p, and s."""
if StringClass.string_match(method_str, 'Horizontal'):
return 'h'
elif StringClass.string_match(method_str, 'Vertical'):
return 'v'
elif StringClass.string_match(method_str, 'Pytha... | python | def convertdistmethod(method_str):
"""Convert distance method to h, v, p, and s."""
if StringClass.string_match(method_str, 'Horizontal'):
return 'h'
elif StringClass.string_match(method_str, 'Vertical'):
return 'v'
elif StringClass.string_match(method_str, 'Pytha... | [
"def",
"convertdistmethod",
"(",
"method_str",
")",
":",
"if",
"StringClass",
".",
"string_match",
"(",
"method_str",
",",
"'Horizontal'",
")",
":",
"return",
"'h'",
"elif",
"StringClass",
".",
"string_match",
"(",
"method_str",
",",
"'Vertical'",
")",
":",
"r... | Convert distance method to h, v, p, and s. | [
"Convert",
"distance",
"method",
"to",
"h",
"v",
"p",
"and",
"s",
"."
] | 9a92d1a229bb74298e3c57f27c97079980b5f729 | https://github.com/lreis2415/PyGeoC/blob/9a92d1a229bb74298e3c57f27c97079980b5f729/pygeoc/TauDEM.py#L521-L534 | train | Convert distance method to h v p and s. |
lreis2415/PyGeoC | pygeoc/TauDEM.py | TauDEM.convertstatsmethod | def convertstatsmethod(method_str):
"""Convert statistics method to ave, min, and max."""
if StringClass.string_match(method_str, 'Average'):
return 'ave'
elif StringClass.string_match(method_str, 'Maximum'):
return 'max'
elif StringClass.string_match(method_str, ... | python | def convertstatsmethod(method_str):
"""Convert statistics method to ave, min, and max."""
if StringClass.string_match(method_str, 'Average'):
return 'ave'
elif StringClass.string_match(method_str, 'Maximum'):
return 'max'
elif StringClass.string_match(method_str, ... | [
"def",
"convertstatsmethod",
"(",
"method_str",
")",
":",
"if",
"StringClass",
".",
"string_match",
"(",
"method_str",
",",
"'Average'",
")",
":",
"return",
"'ave'",
"elif",
"StringClass",
".",
"string_match",
"(",
"method_str",
",",
"'Maximum'",
")",
":",
"re... | Convert statistics method to ave, min, and max. | [
"Convert",
"statistics",
"method",
"to",
"ave",
"min",
"and",
"max",
"."
] | 9a92d1a229bb74298e3c57f27c97079980b5f729 | https://github.com/lreis2415/PyGeoC/blob/9a92d1a229bb74298e3c57f27c97079980b5f729/pygeoc/TauDEM.py#L537-L548 | train | Convert statistics method to ave min and max. |
lreis2415/PyGeoC | pygeoc/TauDEM.py | TauDEM.d8hdisttostrm | def d8hdisttostrm(np, p, src, dist, thresh, workingdir=None,
mpiexedir=None, exedir=None, log_file=None, runtime_file=None, hostfile=None):
"""Run D8 horizontal distance down to stream.
"""
fname = TauDEM.func_name('d8hdisttostrm')
return TauDEM.run(FileClass.get_ex... | python | def d8hdisttostrm(np, p, src, dist, thresh, workingdir=None,
mpiexedir=None, exedir=None, log_file=None, runtime_file=None, hostfile=None):
"""Run D8 horizontal distance down to stream.
"""
fname = TauDEM.func_name('d8hdisttostrm')
return TauDEM.run(FileClass.get_ex... | [
"def",
"d8hdisttostrm",
"(",
"np",
",",
"p",
",",
"src",
",",
"dist",
",",
"thresh",
",",
"workingdir",
"=",
"None",
",",
"mpiexedir",
"=",
"None",
",",
"exedir",
"=",
"None",
",",
"log_file",
"=",
"None",
",",
"runtime_file",
"=",
"None",
",",
"host... | Run D8 horizontal distance down to stream. | [
"Run",
"D8",
"horizontal",
"distance",
"down",
"to",
"stream",
"."
] | 9a92d1a229bb74298e3c57f27c97079980b5f729 | https://github.com/lreis2415/PyGeoC/blob/9a92d1a229bb74298e3c57f27c97079980b5f729/pygeoc/TauDEM.py#L551-L562 | train | Run D8 horizontal distance down to stream. |
lreis2415/PyGeoC | pygeoc/TauDEM.py | TauDEM.d8distdowntostream | def d8distdowntostream(np, p, fel, src, dist, distancemethod, thresh, workingdir=None,
mpiexedir=None, exedir=None,
log_file=None, runtime_file=None, hostfile=None):
"""Run D8 distance down to stream by different method for distance.
This function is... | python | def d8distdowntostream(np, p, fel, src, dist, distancemethod, thresh, workingdir=None,
mpiexedir=None, exedir=None,
log_file=None, runtime_file=None, hostfile=None):
"""Run D8 distance down to stream by different method for distance.
This function is... | [
"def",
"d8distdowntostream",
"(",
"np",
",",
"p",
",",
"fel",
",",
"src",
",",
"dist",
",",
"distancemethod",
",",
"thresh",
",",
"workingdir",
"=",
"None",
",",
"mpiexedir",
"=",
"None",
",",
"exedir",
"=",
"None",
",",
"log_file",
"=",
"None",
",",
... | Run D8 distance down to stream by different method for distance.
This function is extended from d8hdisttostrm by Liangjun.
Please clone `TauDEM by lreis2415`_ and compile for this program.
.. _TauDEM by lreis2415:
https://github.com/lreis2415/TauDEM | [
"Run",
"D8",
"distance",
"down",
"to",
"stream",
"by",
"different",
"method",
"for",
"distance",
".",
"This",
"function",
"is",
"extended",
"from",
"d8hdisttostrm",
"by",
"Liangjun",
"."
] | 9a92d1a229bb74298e3c57f27c97079980b5f729 | https://github.com/lreis2415/PyGeoC/blob/9a92d1a229bb74298e3c57f27c97079980b5f729/pygeoc/TauDEM.py#L565-L583 | train | Run D8 distance down to stream by different method for distance. |
lreis2415/PyGeoC | pygeoc/TauDEM.py | TauDEM.dinfdistdown | def dinfdistdown(np, ang, fel, slp, src, statsm, distm, edgecontamination, wg, dist,
workingdir=None, mpiexedir=None, exedir=None,
log_file=None, runtime_file=None, hostfile=None):
"""Run D-inf distance down to stream"""
in_params = {'-m': '%s %s' % (TauDEM.conv... | python | def dinfdistdown(np, ang, fel, slp, src, statsm, distm, edgecontamination, wg, dist,
workingdir=None, mpiexedir=None, exedir=None,
log_file=None, runtime_file=None, hostfile=None):
"""Run D-inf distance down to stream"""
in_params = {'-m': '%s %s' % (TauDEM.conv... | [
"def",
"dinfdistdown",
"(",
"np",
",",
"ang",
",",
"fel",
",",
"slp",
",",
"src",
",",
"statsm",
",",
"distm",
",",
"edgecontamination",
",",
"wg",
",",
"dist",
",",
"workingdir",
"=",
"None",
",",
"mpiexedir",
"=",
"None",
",",
"exedir",
"=",
"None"... | Run D-inf distance down to stream | [
"Run",
"D",
"-",
"inf",
"distance",
"down",
"to",
"stream"
] | 9a92d1a229bb74298e3c57f27c97079980b5f729 | https://github.com/lreis2415/PyGeoC/blob/9a92d1a229bb74298e3c57f27c97079980b5f729/pygeoc/TauDEM.py#L586-L601 | train | Run D - inf distance down to stream |
lreis2415/PyGeoC | pygeoc/TauDEM.py | TauDEM.peukerdouglas | def peukerdouglas(np, fel, streamSkeleton, workingdir=None, mpiexedir=None, exedir=None,
log_file=None, runtime_file=None, hostfile=None):
"""Run peuker-douglas function"""
fname = TauDEM.func_name('peukerdouglas')
return TauDEM.run(FileClass.get_executable_fullpath(fname, ... | python | def peukerdouglas(np, fel, streamSkeleton, workingdir=None, mpiexedir=None, exedir=None,
log_file=None, runtime_file=None, hostfile=None):
"""Run peuker-douglas function"""
fname = TauDEM.func_name('peukerdouglas')
return TauDEM.run(FileClass.get_executable_fullpath(fname, ... | [
"def",
"peukerdouglas",
"(",
"np",
",",
"fel",
",",
"streamSkeleton",
",",
"workingdir",
"=",
"None",
",",
"mpiexedir",
"=",
"None",
",",
"exedir",
"=",
"None",
",",
"log_file",
"=",
"None",
",",
"runtime_file",
"=",
"None",
",",
"hostfile",
"=",
"None",... | Run peuker-douglas function | [
"Run",
"peuker",
"-",
"douglas",
"function"
] | 9a92d1a229bb74298e3c57f27c97079980b5f729 | https://github.com/lreis2415/PyGeoC/blob/9a92d1a229bb74298e3c57f27c97079980b5f729/pygeoc/TauDEM.py#L604-L613 | train | Run peuker - douglas function |
lreis2415/PyGeoC | pygeoc/TauDEM.py | TauDEM.dropanalysis | def dropanalysis(np, fel, p, ad8, ssa, outlet, minthresh, maxthresh, numthresh,
logspace, drp, workingdir=None,
mpiexedir=None, exedir=None, log_file=None, runtime_file=None, hostfile=None):
"""Drop analysis for optimal threshold for extracting stream."""
parstr... | python | def dropanalysis(np, fel, p, ad8, ssa, outlet, minthresh, maxthresh, numthresh,
logspace, drp, workingdir=None,
mpiexedir=None, exedir=None, log_file=None, runtime_file=None, hostfile=None):
"""Drop analysis for optimal threshold for extracting stream."""
parstr... | [
"def",
"dropanalysis",
"(",
"np",
",",
"fel",
",",
"p",
",",
"ad8",
",",
"ssa",
",",
"outlet",
",",
"minthresh",
",",
"maxthresh",
",",
"numthresh",
",",
"logspace",
",",
"drp",
",",
"workingdir",
"=",
"None",
",",
"mpiexedir",
"=",
"None",
",",
"exe... | Drop analysis for optimal threshold for extracting stream. | [
"Drop",
"analysis",
"for",
"optimal",
"threshold",
"for",
"extracting",
"stream",
"."
] | 9a92d1a229bb74298e3c57f27c97079980b5f729 | https://github.com/lreis2415/PyGeoC/blob/9a92d1a229bb74298e3c57f27c97079980b5f729/pygeoc/TauDEM.py#L616-L632 | train | Drop analysis for optimal threshold for extracting stream. |
lreis2415/PyGeoC | pygeoc/TauDEM.py | TauDEMWorkflow.watershed_delineation | def watershed_delineation(np, dem, outlet_file=None, thresh=0, singlebasin=False,
workingdir=None, mpi_bin=None, bin_dir=None,
logfile=None, runtime_file=None, hostfile=None):
"""Watershed Delineation."""
# 1. Check directories
if not o... | python | def watershed_delineation(np, dem, outlet_file=None, thresh=0, singlebasin=False,
workingdir=None, mpi_bin=None, bin_dir=None,
logfile=None, runtime_file=None, hostfile=None):
"""Watershed Delineation."""
# 1. Check directories
if not o... | [
"def",
"watershed_delineation",
"(",
"np",
",",
"dem",
",",
"outlet_file",
"=",
"None",
",",
"thresh",
"=",
"0",
",",
"singlebasin",
"=",
"False",
",",
"workingdir",
"=",
"None",
",",
"mpi_bin",
"=",
"None",
",",
"bin_dir",
"=",
"None",
",",
"logfile",
... | Watershed Delineation. | [
"Watershed",
"Delineation",
"."
] | 9a92d1a229bb74298e3c57f27c97079980b5f729 | https://github.com/lreis2415/PyGeoC/blob/9a92d1a229bb74298e3c57f27c97079980b5f729/pygeoc/TauDEM.py#L643-L763 | train | This function is used to calculate the watershed delineation of a TauDEM. |
erwanp/publib | publib/tools/colors.py | keep_color | def keep_color(ax=None):
''' Keep the same color for the same graph.
Warning: due to the structure of Python iterators I couldn't help but
iterate over all the cycle twice. One first time to get the number of elements
in the cycle, one second time to stop just before the last. And this still
only ... | python | def keep_color(ax=None):
''' Keep the same color for the same graph.
Warning: due to the structure of Python iterators I couldn't help but
iterate over all the cycle twice. One first time to get the number of elements
in the cycle, one second time to stop just before the last. And this still
only ... | [
"def",
"keep_color",
"(",
"ax",
"=",
"None",
")",
":",
"if",
"ax",
"is",
"None",
":",
"ax",
"=",
"mpl",
".",
"pyplot",
".",
"gca",
"(",
")",
"i",
"=",
"1",
"# count number of elements",
"cycle",
"=",
"ax",
".",
"_get_lines",
".",
"prop_cycler",
"a",
... | Keep the same color for the same graph.
Warning: due to the structure of Python iterators I couldn't help but
iterate over all the cycle twice. One first time to get the number of elements
in the cycle, one second time to stop just before the last. And this still
only works assuming your cycle doesn't... | [
"Keep",
"the",
"same",
"color",
"for",
"the",
"same",
"graph",
".",
"Warning",
":",
"due",
"to",
"the",
"structure",
"of",
"Python",
"iterators",
"I",
"couldn",
"t",
"help",
"but",
"iterate",
"over",
"all",
"the",
"cycle",
"twice",
".",
"One",
"first",
... | 0417e6a31d52e23b816ac74d40b4c11d4b8ba4a6 | https://github.com/erwanp/publib/blob/0417e6a31d52e23b816ac74d40b4c11d4b8ba4a6/publib/tools/colors.py#L24-L45 | train | Keep the same color for the same graph. |
erwanp/publib | publib/tools/colors.py | get_next_color | def get_next_color(ax=None, nonintrusive=True):
''' Return the next color to be used in the given color cycle.
Warning: due to the structure of Python iterators I couldn't help but
iterate over all the color cycle once.
If nonintrusive is True, then leave the color cycle in the same state as
... | python | def get_next_color(ax=None, nonintrusive=True):
''' Return the next color to be used in the given color cycle.
Warning: due to the structure of Python iterators I couldn't help but
iterate over all the color cycle once.
If nonintrusive is True, then leave the color cycle in the same state as
... | [
"def",
"get_next_color",
"(",
"ax",
"=",
"None",
",",
"nonintrusive",
"=",
"True",
")",
":",
"if",
"ax",
"is",
"None",
":",
"ax",
"=",
"mpl",
".",
"pyplot",
".",
"gca",
"(",
")",
"i",
"=",
"1",
"# count number of elements",
"cycle",
"=",
"ax",
".",
... | Return the next color to be used in the given color cycle.
Warning: due to the structure of Python iterators I couldn't help but
iterate over all the color cycle once.
If nonintrusive is True, then leave the color cycle in the same state as
before | [
"Return",
"the",
"next",
"color",
"to",
"be",
"used",
"in",
"the",
"given",
"color",
"cycle",
".",
"Warning",
":",
"due",
"to",
"the",
"structure",
"of",
"Python",
"iterators",
"I",
"couldn",
"t",
"help",
"but",
"iterate",
"over",
"all",
"the",
"color",
... | 0417e6a31d52e23b816ac74d40b4c11d4b8ba4a6 | https://github.com/erwanp/publib/blob/0417e6a31d52e23b816ac74d40b4c11d4b8ba4a6/publib/tools/colors.py#L48-L74 | train | Return the next color to be used in the given color cycle. |
johnnoone/json-spec | src/jsonspec/reference/bases.py | Registry.resolve | def resolve(self, pointer):
"""Resolve from documents.
:param pointer: foo
:type pointer: DocumentPointer
"""
dp = DocumentPointer(pointer)
obj, fetcher = self.prototype(dp)
for token in dp.pointer:
obj = token.extract(obj, bypass_ref=True)
... | python | def resolve(self, pointer):
"""Resolve from documents.
:param pointer: foo
:type pointer: DocumentPointer
"""
dp = DocumentPointer(pointer)
obj, fetcher = self.prototype(dp)
for token in dp.pointer:
obj = token.extract(obj, bypass_ref=True)
... | [
"def",
"resolve",
"(",
"self",
",",
"pointer",
")",
":",
"dp",
"=",
"DocumentPointer",
"(",
"pointer",
")",
"obj",
",",
"fetcher",
"=",
"self",
".",
"prototype",
"(",
"dp",
")",
"for",
"token",
"in",
"dp",
".",
"pointer",
":",
"obj",
"=",
"token",
... | Resolve from documents.
:param pointer: foo
:type pointer: DocumentPointer | [
"Resolve",
"from",
"documents",
"."
] | f91981724cea0c366bd42a6670eb07bbe31c0e0c | https://github.com/johnnoone/json-spec/blob/f91981724cea0c366bd42a6670eb07bbe31c0e0c/src/jsonspec/reference/bases.py#L37-L52 | train | Resolve from documents.
|
nmdp-bioinformatics/SeqAnn | seqann/align.py | align_seqs | def align_seqs(found_seqs, sequence, locus, start_pos, missing,
annotated, cutoff=0.90, verbose=False, verbosity=0):
"""
align_seqs - Aligns sequences with clustalo
:param found_seqs: List of the reference sequences
:type found_seqs: ``List``
:param sequence: The input consensus sequ... | python | def align_seqs(found_seqs, sequence, locus, start_pos, missing,
annotated, cutoff=0.90, verbose=False, verbosity=0):
"""
align_seqs - Aligns sequences with clustalo
:param found_seqs: List of the reference sequences
:type found_seqs: ``List``
:param sequence: The input consensus sequ... | [
"def",
"align_seqs",
"(",
"found_seqs",
",",
"sequence",
",",
"locus",
",",
"start_pos",
",",
"missing",
",",
"annotated",
",",
"cutoff",
"=",
"0.90",
",",
"verbose",
"=",
"False",
",",
"verbosity",
"=",
"0",
")",
":",
"logger",
"=",
"logging",
".",
"g... | align_seqs - Aligns sequences with clustalo
:param found_seqs: List of the reference sequences
:type found_seqs: ``List``
:param sequence: The input consensus sequence.
:type sequence: SeqRecord
:param locus: The gene locus associated with the sequence.
:type locus: ``str``
:param annotated... | [
"align_seqs",
"-",
"Aligns",
"sequences",
"with",
"clustalo"
] | 5ce91559b0a4fbe4fb7758e034eb258202632463 | https://github.com/nmdp-bioinformatics/SeqAnn/blob/5ce91559b0a4fbe4fb7758e034eb258202632463/seqann/align.py#L55-L188 | train | Aligns sequences with clustalo |
nmdp-bioinformatics/SeqAnn | seqann/align.py | find_features | def find_features(feats, sequ, annotated, start_pos, cutoff):
"""
find_features - Finds the reference sequence features in the alignments and records the positions
:param feats: Dictonary of sequence features
:type feats: ``dict``
:param sequ: The sequence alignment for the input sequence
:typ... | python | def find_features(feats, sequ, annotated, start_pos, cutoff):
"""
find_features - Finds the reference sequence features in the alignments and records the positions
:param feats: Dictonary of sequence features
:type feats: ``dict``
:param sequ: The sequence alignment for the input sequence
:typ... | [
"def",
"find_features",
"(",
"feats",
",",
"sequ",
",",
"annotated",
",",
"start_pos",
",",
"cutoff",
")",
":",
"feats_a",
"=",
"list",
"(",
"feats",
".",
"keys",
"(",
")",
")",
"j",
"=",
"0",
"s",
"=",
"0",
"en",
"=",
"0",
"start",
"=",
"0",
"... | find_features - Finds the reference sequence features in the alignments and records the positions
:param feats: Dictonary of sequence features
:type feats: ``dict``
:param sequ: The sequence alignment for the input sequence
:type sequ: ``List``
:param annotated: dictonary of the annotated features... | [
"find_features",
"-",
"Finds",
"the",
"reference",
"sequence",
"features",
"in",
"the",
"alignments",
"and",
"records",
"the",
"positions"
] | 5ce91559b0a4fbe4fb7758e034eb258202632463 | https://github.com/nmdp-bioinformatics/SeqAnn/blob/5ce91559b0a4fbe4fb7758e034eb258202632463/seqann/align.py#L191-L277 | train | This function finds the features in the alignments and records the positions
|
nmdp-bioinformatics/SeqAnn | seqann/align.py | resolve_feats | def resolve_feats(feat_list, seqin, seqref, start, locus, missing, verbose=False, verbosity=0):
"""
resolve_feats - Resolves features from alignments
:param feat_list: List of the found features
:type feat_list: ``List``
:param seqin: The input sequence
:type seqin: ``str``
:param locus: Th... | python | def resolve_feats(feat_list, seqin, seqref, start, locus, missing, verbose=False, verbosity=0):
"""
resolve_feats - Resolves features from alignments
:param feat_list: List of the found features
:type feat_list: ``List``
:param seqin: The input sequence
:type seqin: ``str``
:param locus: Th... | [
"def",
"resolve_feats",
"(",
"feat_list",
",",
"seqin",
",",
"seqref",
",",
"start",
",",
"locus",
",",
"missing",
",",
"verbose",
"=",
"False",
",",
"verbosity",
"=",
"0",
")",
":",
"structures",
"=",
"get_structures",
"(",
")",
"logger",
"=",
"logging"... | resolve_feats - Resolves features from alignments
:param feat_list: List of the found features
:type feat_list: ``List``
:param seqin: The input sequence
:type seqin: ``str``
:param locus: The input locus
:type locus: ``str``
:param start: Where the sequence start in the alignment
:type... | [
"resolve_feats",
"-",
"Resolves",
"features",
"from",
"alignments"
] | 5ce91559b0a4fbe4fb7758e034eb258202632463 | https://github.com/nmdp-bioinformatics/SeqAnn/blob/5ce91559b0a4fbe4fb7758e034eb258202632463/seqann/align.py#L280-L390 | train | Resolves features from alignments in a sequence. |
nmdp-bioinformatics/SeqAnn | seqann/align.py | count_diffs | def count_diffs(align, feats, inseq, locus, cutoff,
verbose=False, verbosity=0):
"""
count_diffs - Counts the number of mismatches, gaps, and insertions and then determines if those are within an acceptable range.
:param align: The alignment
:type align: ``List``
:param feats: Dicto... | python | def count_diffs(align, feats, inseq, locus, cutoff,
verbose=False, verbosity=0):
"""
count_diffs - Counts the number of mismatches, gaps, and insertions and then determines if those are within an acceptable range.
:param align: The alignment
:type align: ``List``
:param feats: Dicto... | [
"def",
"count_diffs",
"(",
"align",
",",
"feats",
",",
"inseq",
",",
"locus",
",",
"cutoff",
",",
"verbose",
"=",
"False",
",",
"verbosity",
"=",
"0",
")",
":",
"nfeats",
"=",
"len",
"(",
"feats",
".",
"keys",
"(",
")",
")",
"mm",
"=",
"0",
"insr... | count_diffs - Counts the number of mismatches, gaps, and insertions and then determines if those are within an acceptable range.
:param align: The alignment
:type align: ``List``
:param feats: Dictonary of the features
:type feats: ``dict``
:param locus: The gene locus associated with the sequence.... | [
"count_diffs",
"-",
"Counts",
"the",
"number",
"of",
"mismatches",
"gaps",
"and",
"insertions",
"and",
"then",
"determines",
"if",
"those",
"are",
"within",
"an",
"acceptable",
"range",
"."
] | 5ce91559b0a4fbe4fb7758e034eb258202632463 | https://github.com/nmdp-bioinformatics/SeqAnn/blob/5ce91559b0a4fbe4fb7758e034eb258202632463/seqann/align.py#L394-L480 | train | Count the number of mismatches gaps and insertions and return if those are within an acceptable range. |
ployground/ploy | ploy/__init__.py | Controller.cmd_stop | def cmd_stop(self, argv, help):
"""Stops the instance"""
parser = argparse.ArgumentParser(
prog="%s stop" % self.progname,
description=help,
)
instances = self.get_instances(command='stop')
parser.add_argument("instance", nargs=1,
... | python | def cmd_stop(self, argv, help):
"""Stops the instance"""
parser = argparse.ArgumentParser(
prog="%s stop" % self.progname,
description=help,
)
instances = self.get_instances(command='stop')
parser.add_argument("instance", nargs=1,
... | [
"def",
"cmd_stop",
"(",
"self",
",",
"argv",
",",
"help",
")",
":",
"parser",
"=",
"argparse",
".",
"ArgumentParser",
"(",
"prog",
"=",
"\"%s stop\"",
"%",
"self",
".",
"progname",
",",
"description",
"=",
"help",
",",
")",
"instances",
"=",
"self",
".... | Stops the instance | [
"Stops",
"the",
"instance"
] | 9295b5597c09c434f170afbfd245d73f09affc39 | https://github.com/ployground/ploy/blob/9295b5597c09c434f170afbfd245d73f09affc39/ploy/__init__.py#L219-L232 | train | Stops the instance |
ployground/ploy | ploy/__init__.py | Controller.cmd_terminate | def cmd_terminate(self, argv, help):
"""Terminates the instance"""
from ploy.common import yesno
parser = argparse.ArgumentParser(
prog="%s terminate" % self.progname,
description=help,
)
instances = self.get_instances(command='terminate')
parser.a... | python | def cmd_terminate(self, argv, help):
"""Terminates the instance"""
from ploy.common import yesno
parser = argparse.ArgumentParser(
prog="%s terminate" % self.progname,
description=help,
)
instances = self.get_instances(command='terminate')
parser.a... | [
"def",
"cmd_terminate",
"(",
"self",
",",
"argv",
",",
"help",
")",
":",
"from",
"ploy",
".",
"common",
"import",
"yesno",
"parser",
"=",
"argparse",
".",
"ArgumentParser",
"(",
"prog",
"=",
"\"%s terminate\"",
"%",
"self",
".",
"progname",
",",
"descripti... | Terminates the instance | [
"Terminates",
"the",
"instance"
] | 9295b5597c09c434f170afbfd245d73f09affc39 | https://github.com/ployground/ploy/blob/9295b5597c09c434f170afbfd245d73f09affc39/ploy/__init__.py#L234-L252 | train | Terminates the instance |
ployground/ploy | ploy/__init__.py | Controller.cmd_start | def cmd_start(self, argv, help):
"""Starts the instance"""
parser = argparse.ArgumentParser(
prog="%s start" % self.progname,
description=help,
)
instances = self.get_instances(command='start')
parser.add_argument("instance", nargs=1,
... | python | def cmd_start(self, argv, help):
"""Starts the instance"""
parser = argparse.ArgumentParser(
prog="%s start" % self.progname,
description=help,
)
instances = self.get_instances(command='start')
parser.add_argument("instance", nargs=1,
... | [
"def",
"cmd_start",
"(",
"self",
",",
"argv",
",",
"help",
")",
":",
"parser",
"=",
"argparse",
".",
"ArgumentParser",
"(",
"prog",
"=",
"\"%s start\"",
"%",
"self",
".",
"progname",
",",
"description",
"=",
"help",
",",
")",
"instances",
"=",
"self",
... | Starts the instance | [
"Starts",
"the",
"instance"
] | 9295b5597c09c434f170afbfd245d73f09affc39 | https://github.com/ployground/ploy/blob/9295b5597c09c434f170afbfd245d73f09affc39/ploy/__init__.py#L270-L293 | train | Starts the instance |
ployground/ploy | ploy/__init__.py | Controller.cmd_annotate | def cmd_annotate(self, argv, help):
"""Prints annotated config"""
parser = argparse.ArgumentParser(
prog="%s annotate" % self.progname,
description=help,
)
parser.parse_args(argv)
list(self.instances.values()) # trigger instance augmentation
for g... | python | def cmd_annotate(self, argv, help):
"""Prints annotated config"""
parser = argparse.ArgumentParser(
prog="%s annotate" % self.progname,
description=help,
)
parser.parse_args(argv)
list(self.instances.values()) # trigger instance augmentation
for g... | [
"def",
"cmd_annotate",
"(",
"self",
",",
"argv",
",",
"help",
")",
":",
"parser",
"=",
"argparse",
".",
"ArgumentParser",
"(",
"prog",
"=",
"\"%s annotate\"",
"%",
"self",
".",
"progname",
",",
"description",
"=",
"help",
",",
")",
"parser",
".",
"parse_... | Prints annotated config | [
"Prints",
"annotated",
"config"
] | 9295b5597c09c434f170afbfd245d73f09affc39 | https://github.com/ployground/ploy/blob/9295b5597c09c434f170afbfd245d73f09affc39/ploy/__init__.py#L295-L310 | train | Prints annotated config |
ployground/ploy | ploy/__init__.py | Controller.cmd_debug | def cmd_debug(self, argv, help):
"""Prints some debug info for this script"""
parser = argparse.ArgumentParser(
prog="%s debug" % self.progname,
description=help,
)
instances = self.instances
parser.add_argument("instance", nargs=1,
... | python | def cmd_debug(self, argv, help):
"""Prints some debug info for this script"""
parser = argparse.ArgumentParser(
prog="%s debug" % self.progname,
description=help,
)
instances = self.instances
parser.add_argument("instance", nargs=1,
... | [
"def",
"cmd_debug",
"(",
"self",
",",
"argv",
",",
"help",
")",
":",
"parser",
"=",
"argparse",
".",
"ArgumentParser",
"(",
"prog",
"=",
"\"%s debug\"",
"%",
"self",
".",
"progname",
",",
"description",
"=",
"help",
",",
")",
"instances",
"=",
"self",
... | Prints some debug info for this script | [
"Prints",
"some",
"debug",
"info",
"for",
"this",
"script"
] | 9295b5597c09c434f170afbfd245d73f09affc39 | https://github.com/ployground/ploy/blob/9295b5597c09c434f170afbfd245d73f09affc39/ploy/__init__.py#L312-L375 | train | Prints some debug info for this script |
ployground/ploy | ploy/__init__.py | Controller.cmd_list | def cmd_list(self, argv, help):
"""Return a list of various things"""
parser = argparse.ArgumentParser(
prog="%s list" % self.progname,
description=help,
)
parser.add_argument("list", nargs=1,
metavar="listname",
... | python | def cmd_list(self, argv, help):
"""Return a list of various things"""
parser = argparse.ArgumentParser(
prog="%s list" % self.progname,
description=help,
)
parser.add_argument("list", nargs=1,
metavar="listname",
... | [
"def",
"cmd_list",
"(",
"self",
",",
"argv",
",",
"help",
")",
":",
"parser",
"=",
"argparse",
".",
"ArgumentParser",
"(",
"prog",
"=",
"\"%s list\"",
"%",
"self",
".",
"progname",
",",
"description",
"=",
"help",
",",
")",
"parser",
".",
"add_argument",... | Return a list of various things | [
"Return",
"a",
"list",
"of",
"various",
"things"
] | 9295b5597c09c434f170afbfd245d73f09affc39 | https://github.com/ployground/ploy/blob/9295b5597c09c434f170afbfd245d73f09affc39/ploy/__init__.py#L377-L393 | train | Return a list of various things |
ployground/ploy | ploy/__init__.py | Controller.cmd_ssh | def cmd_ssh(self, argv, help):
"""Log into the instance with ssh using the automatically generated known hosts"""
parser = argparse.ArgumentParser(
prog="%s ssh" % self.progname,
description=help,
)
instances = self.get_instances(command='init_ssh_key')
pa... | python | def cmd_ssh(self, argv, help):
"""Log into the instance with ssh using the automatically generated known hosts"""
parser = argparse.ArgumentParser(
prog="%s ssh" % self.progname,
description=help,
)
instances = self.get_instances(command='init_ssh_key')
pa... | [
"def",
"cmd_ssh",
"(",
"self",
",",
"argv",
",",
"help",
")",
":",
"parser",
"=",
"argparse",
".",
"ArgumentParser",
"(",
"prog",
"=",
"\"%s ssh\"",
"%",
"self",
".",
"progname",
",",
"description",
"=",
"help",
",",
")",
"instances",
"=",
"self",
".",... | Log into the instance with ssh using the automatically generated known hosts | [
"Log",
"into",
"the",
"instance",
"with",
"ssh",
"using",
"the",
"automatically",
"generated",
"known",
"hosts"
] | 9295b5597c09c434f170afbfd245d73f09affc39 | https://github.com/ployground/ploy/blob/9295b5597c09c434f170afbfd245d73f09affc39/ploy/__init__.py#L395-L445 | train | Log into the instance with ssh using the automatically generated known hosts |
ployground/ploy | ploy/__init__.py | Controller.cmd_help | def cmd_help(self, argv, help):
"""Print help"""
parser = argparse.ArgumentParser(
prog="%s help" % self.progname,
description=help,
)
parser.add_argument('-z', '--zsh',
action='store_true',
help="Print info ... | python | def cmd_help(self, argv, help):
"""Print help"""
parser = argparse.ArgumentParser(
prog="%s help" % self.progname,
description=help,
)
parser.add_argument('-z', '--zsh',
action='store_true',
help="Print info ... | [
"def",
"cmd_help",
"(",
"self",
",",
"argv",
",",
"help",
")",
":",
"parser",
"=",
"argparse",
".",
"ArgumentParser",
"(",
"prog",
"=",
"\"%s help\"",
"%",
"self",
".",
"progname",
",",
"description",
"=",
"help",
",",
")",
"parser",
".",
"add_argument",... | Print help | [
"Print",
"help"
] | 9295b5597c09c434f170afbfd245d73f09affc39 | https://github.com/ployground/ploy/blob/9295b5597c09c434f170afbfd245d73f09affc39/ploy/__init__.py#L462-L501 | train | Print help for the specified command |
mivade/tornadose | tornadose/handlers.py | BaseHandler.initialize | def initialize(self, store):
"""Common initialization of handlers happens here. If additional
initialization is required, this method must either be called with
``super`` or the child class must assign the ``store`` attribute and
register itself with the store.
"""
... | python | def initialize(self, store):
"""Common initialization of handlers happens here. If additional
initialization is required, this method must either be called with
``super`` or the child class must assign the ``store`` attribute and
register itself with the store.
"""
... | [
"def",
"initialize",
"(",
"self",
",",
"store",
")",
":",
"assert",
"isinstance",
"(",
"store",
",",
"stores",
".",
"BaseStore",
")",
"self",
".",
"messages",
"=",
"Queue",
"(",
")",
"self",
".",
"store",
"=",
"store",
"self",
".",
"store",
".",
"reg... | Common initialization of handlers happens here. If additional
initialization is required, this method must either be called with
``super`` or the child class must assign the ``store`` attribute and
register itself with the store. | [
"Common",
"initialization",
"of",
"handlers",
"happens",
"here",
".",
"If",
"additional",
"initialization",
"is",
"required",
"this",
"method",
"must",
"either",
"be",
"called",
"with",
"super",
"or",
"the",
"child",
"class",
"must",
"assign",
"the",
"store",
... | d220e0e3040d24c98997eee7a8a236602b4c5159 | https://github.com/mivade/tornadose/blob/d220e0e3040d24c98997eee7a8a236602b4c5159/tornadose/handlers.py#L22-L32 | train | Common initialization of handlers happens here. |
mivade/tornadose | tornadose/handlers.py | EventSource.prepare | def prepare(self):
"""Log access."""
request_time = 1000.0 * self.request.request_time()
access_log.info(
"%d %s %.2fms", self.get_status(),
self._request_summary(), request_time) | python | def prepare(self):
"""Log access."""
request_time = 1000.0 * self.request.request_time()
access_log.info(
"%d %s %.2fms", self.get_status(),
self._request_summary(), request_time) | [
"def",
"prepare",
"(",
"self",
")",
":",
"request_time",
"=",
"1000.0",
"*",
"self",
".",
"request",
".",
"request_time",
"(",
")",
"access_log",
".",
"info",
"(",
"\"%d %s %.2fms\"",
",",
"self",
".",
"get_status",
"(",
")",
",",
"self",
".",
"_request_... | Log access. | [
"Log",
"access",
"."
] | d220e0e3040d24c98997eee7a8a236602b4c5159 | https://github.com/mivade/tornadose/blob/d220e0e3040d24c98997eee7a8a236602b4c5159/tornadose/handlers.py#L69-L74 | train | Log access. |
mivade/tornadose | tornadose/handlers.py | EventSource.publish | async def publish(self, message):
"""Pushes data to a listener."""
try:
self.write('data: {}\n\n'.format(message))
await self.flush()
except StreamClosedError:
self.finished = True | python | async def publish(self, message):
"""Pushes data to a listener."""
try:
self.write('data: {}\n\n'.format(message))
await self.flush()
except StreamClosedError:
self.finished = True | [
"async",
"def",
"publish",
"(",
"self",
",",
"message",
")",
":",
"try",
":",
"self",
".",
"write",
"(",
"'data: {}\\n\\n'",
".",
"format",
"(",
"message",
")",
")",
"await",
"self",
".",
"flush",
"(",
")",
"except",
"StreamClosedError",
":",
"self",
"... | Pushes data to a listener. | [
"Pushes",
"data",
"to",
"a",
"listener",
"."
] | d220e0e3040d24c98997eee7a8a236602b4c5159 | https://github.com/mivade/tornadose/blob/d220e0e3040d24c98997eee7a8a236602b4c5159/tornadose/handlers.py#L76-L82 | train | Pushes data to a listener. |
mivade/tornadose | tornadose/handlers.py | WebSocketSubscriber.open | async def open(self):
"""Register with the publisher."""
self.store.register(self)
while not self.finished:
message = await self.messages.get()
await self.publish(message) | python | async def open(self):
"""Register with the publisher."""
self.store.register(self)
while not self.finished:
message = await self.messages.get()
await self.publish(message) | [
"async",
"def",
"open",
"(",
"self",
")",
":",
"self",
".",
"store",
".",
"register",
"(",
"self",
")",
"while",
"not",
"self",
".",
"finished",
":",
"message",
"=",
"await",
"self",
".",
"messages",
".",
"get",
"(",
")",
"await",
"self",
".",
"pub... | Register with the publisher. | [
"Register",
"with",
"the",
"publisher",
"."
] | d220e0e3040d24c98997eee7a8a236602b4c5159 | https://github.com/mivade/tornadose/blob/d220e0e3040d24c98997eee7a8a236602b4c5159/tornadose/handlers.py#L102-L107 | train | Open the channel with the publisher. |
mivade/tornadose | tornadose/handlers.py | WebSocketSubscriber.publish | async def publish(self, message):
"""Push a new message to the client. The data will be
available as a JSON object with the key ``data``.
"""
try:
self.write_message(dict(data=message))
except WebSocketClosedError:
self._close() | python | async def publish(self, message):
"""Push a new message to the client. The data will be
available as a JSON object with the key ``data``.
"""
try:
self.write_message(dict(data=message))
except WebSocketClosedError:
self._close() | [
"async",
"def",
"publish",
"(",
"self",
",",
"message",
")",
":",
"try",
":",
"self",
".",
"write_message",
"(",
"dict",
"(",
"data",
"=",
"message",
")",
")",
"except",
"WebSocketClosedError",
":",
"self",
".",
"_close",
"(",
")"
] | Push a new message to the client. The data will be
available as a JSON object with the key ``data``. | [
"Push",
"a",
"new",
"message",
"to",
"the",
"client",
".",
"The",
"data",
"will",
"be",
"available",
"as",
"a",
"JSON",
"object",
"with",
"the",
"key",
"data",
"."
] | d220e0e3040d24c98997eee7a8a236602b4c5159 | https://github.com/mivade/tornadose/blob/d220e0e3040d24c98997eee7a8a236602b4c5159/tornadose/handlers.py#L116-L124 | train | Push a new message to the client. |
datamachine/twx | twx/mtproto/crypt.py | _ige | def _ige(message, key, iv, operation="decrypt"):
"""Given a key, given an iv, and message
do whatever operation asked in the operation field.
Operation will be checked for: "decrypt" and "encrypt" strings.
Returns the message encrypted/decrypted.
message must be a multiple by 16 bytes (for divis... | python | def _ige(message, key, iv, operation="decrypt"):
"""Given a key, given an iv, and message
do whatever operation asked in the operation field.
Operation will be checked for: "decrypt" and "encrypt" strings.
Returns the message encrypted/decrypted.
message must be a multiple by 16 bytes (for divis... | [
"def",
"_ige",
"(",
"message",
",",
"key",
",",
"iv",
",",
"operation",
"=",
"\"decrypt\"",
")",
":",
"message",
"=",
"bytes",
"(",
"message",
")",
"if",
"len",
"(",
"key",
")",
"!=",
"32",
":",
"raise",
"ValueError",
"(",
"\"key must be 32 bytes long (w... | Given a key, given an iv, and message
do whatever operation asked in the operation field.
Operation will be checked for: "decrypt" and "encrypt" strings.
Returns the message encrypted/decrypted.
message must be a multiple by 16 bytes (for division in 16 byte blocks)
key must be 32 byte
iv ... | [
"Given",
"a",
"key",
"given",
"an",
"iv",
"and",
"message",
"do",
"whatever",
"operation",
"asked",
"in",
"the",
"operation",
"field",
".",
"Operation",
"will",
"be",
"checked",
"for",
":",
"decrypt",
"and",
"encrypt",
"strings",
".",
"Returns",
"the",
"me... | d9633f12f3647b1e54ba87b70b39df3b7e02b4eb | https://github.com/datamachine/twx/blob/d9633f12f3647b1e54ba87b70b39df3b7e02b4eb/twx/mtproto/crypt.py#L21-L67 | train | This function is used to encrypt and decrypt a message. |
hyperledger-archives/indy-ledger | ledger/stores/chunked_file_store.py | ChunkedFileStore._useChunk | def _useChunk(self, index) -> None:
"""
Switch to specific chunk
:param index:
"""
if self.currentChunk is not None:
if self.currentChunkIndex == index and \
not self.currentChunk.closed:
return
self.currentChunk.close... | python | def _useChunk(self, index) -> None:
"""
Switch to specific chunk
:param index:
"""
if self.currentChunk is not None:
if self.currentChunkIndex == index and \
not self.currentChunk.closed:
return
self.currentChunk.close... | [
"def",
"_useChunk",
"(",
"self",
",",
"index",
")",
"->",
"None",
":",
"if",
"self",
".",
"currentChunk",
"is",
"not",
"None",
":",
"if",
"self",
".",
"currentChunkIndex",
"==",
"index",
"and",
"not",
"self",
".",
"currentChunk",
".",
"closed",
":",
"r... | Switch to specific chunk
:param index: | [
"Switch",
"to",
"specific",
"chunk"
] | 7210c3b288e07f940eddad09b1dfc6a56be846df | https://github.com/hyperledger-archives/indy-ledger/blob/7210c3b288e07f940eddad09b1dfc6a56be846df/ledger/stores/chunked_file_store.py#L123-L138 | train | Switch to specific chunk |
hyperledger-archives/indy-ledger | ledger/stores/chunked_file_store.py | ChunkedFileStore.iterator | def iterator(self, includeKey=True, includeValue=True, prefix=None):
"""
Store iterator
:return: Iterator for data in all chunks
"""
if not (includeKey or includeValue):
raise ValueError("At least one of includeKey or includeValue "
"sho... | python | def iterator(self, includeKey=True, includeValue=True, prefix=None):
"""
Store iterator
:return: Iterator for data in all chunks
"""
if not (includeKey or includeValue):
raise ValueError("At least one of includeKey or includeValue "
"sho... | [
"def",
"iterator",
"(",
"self",
",",
"includeKey",
"=",
"True",
",",
"includeValue",
"=",
"True",
",",
"prefix",
"=",
"None",
")",
":",
"if",
"not",
"(",
"includeKey",
"or",
"includeValue",
")",
":",
"raise",
"ValueError",
"(",
"\"At least one of includeKey ... | Store iterator
:return: Iterator for data in all chunks | [
"Store",
"iterator"
] | 7210c3b288e07f940eddad09b1dfc6a56be846df | https://github.com/hyperledger-archives/indy-ledger/blob/7210c3b288e07f940eddad09b1dfc6a56be846df/ledger/stores/chunked_file_store.py#L229-L244 | train | Iterator for all the items in the store. |
hyperledger-archives/indy-ledger | ledger/stores/chunked_file_store.py | ChunkedFileStore.numKeys | def numKeys(self) -> int:
"""
This will iterate only over the last chunk since the name of the last
chunk indicates how many lines in total exist in all other chunks
"""
chunks = self._listChunks()
num_chunks = len(chunks)
if num_chunks == 0:
return 0
... | python | def numKeys(self) -> int:
"""
This will iterate only over the last chunk since the name of the last
chunk indicates how many lines in total exist in all other chunks
"""
chunks = self._listChunks()
num_chunks = len(chunks)
if num_chunks == 0:
return 0
... | [
"def",
"numKeys",
"(",
"self",
")",
"->",
"int",
":",
"chunks",
"=",
"self",
".",
"_listChunks",
"(",
")",
"num_chunks",
"=",
"len",
"(",
"chunks",
")",
"if",
"num_chunks",
"==",
"0",
":",
"return",
"0",
"count",
"=",
"(",
"num_chunks",
"-",
"1",
"... | This will iterate only over the last chunk since the name of the last
chunk indicates how many lines in total exist in all other chunks | [
"This",
"will",
"iterate",
"only",
"over",
"the",
"last",
"chunk",
"since",
"the",
"name",
"of",
"the",
"last",
"chunk",
"indicates",
"how",
"many",
"lines",
"in",
"total",
"exist",
"in",
"all",
"other",
"chunks"
] | 7210c3b288e07f940eddad09b1dfc6a56be846df | https://github.com/hyperledger-archives/indy-ledger/blob/7210c3b288e07f940eddad09b1dfc6a56be846df/ledger/stores/chunked_file_store.py#L291-L304 | train | This will iterate over the last chunk and return the number of lines in total |
johnnoone/json-spec | src/jsonspec/validators/factorize.py | register | def register(compiler=None, spec=None):
"""
Expose compiler to factory.
:param compiler: the callable to expose
:type compiler: callable
:param spec: name of the spec
:type spec: str
It can be used as a decorator::
@register(spec='my:first:spec')
def my_compiler(schema, po... | python | def register(compiler=None, spec=None):
"""
Expose compiler to factory.
:param compiler: the callable to expose
:type compiler: callable
:param spec: name of the spec
:type spec: str
It can be used as a decorator::
@register(spec='my:first:spec')
def my_compiler(schema, po... | [
"def",
"register",
"(",
"compiler",
"=",
"None",
",",
"spec",
"=",
"None",
")",
":",
"if",
"not",
"spec",
":",
"raise",
"CompilationError",
"(",
"'Spec is required'",
")",
"if",
"not",
"compiler",
":",
"return",
"partial",
"(",
"register",
",",
"spec",
"... | Expose compiler to factory.
:param compiler: the callable to expose
:type compiler: callable
:param spec: name of the spec
:type spec: str
It can be used as a decorator::
@register(spec='my:first:spec')
def my_compiler(schema, pointer, context):
return Validator(schema... | [
"Expose",
"compiler",
"to",
"factory",
"."
] | f91981724cea0c366bd42a6670eb07bbe31c0e0c | https://github.com/johnnoone/json-spec/blob/f91981724cea0c366bd42a6670eb07bbe31c0e0c/src/jsonspec/validators/factorize.py#L104-L131 | train | Decorator to expose compiler to factory.
|
mivade/tornadose | tornadose/stores.py | BaseStore.register | def register(self, subscriber):
"""Register a new subscriber. This method should be invoked by
listeners to start receiving messages.
"""
assert isinstance(subscriber, RequestHandler)
logger.debug('New subscriber')
self.subscribers.add(subscriber) | python | def register(self, subscriber):
"""Register a new subscriber. This method should be invoked by
listeners to start receiving messages.
"""
assert isinstance(subscriber, RequestHandler)
logger.debug('New subscriber')
self.subscribers.add(subscriber) | [
"def",
"register",
"(",
"self",
",",
"subscriber",
")",
":",
"assert",
"isinstance",
"(",
"subscriber",
",",
"RequestHandler",
")",
"logger",
".",
"debug",
"(",
"'New subscriber'",
")",
"self",
".",
"subscribers",
".",
"add",
"(",
"subscriber",
")"
] | Register a new subscriber. This method should be invoked by
listeners to start receiving messages. | [
"Register",
"a",
"new",
"subscriber",
".",
"This",
"method",
"should",
"be",
"invoked",
"by",
"listeners",
"to",
"start",
"receiving",
"messages",
"."
] | d220e0e3040d24c98997eee7a8a236602b4c5159 | https://github.com/mivade/tornadose/blob/d220e0e3040d24c98997eee7a8a236602b4c5159/tornadose/stores.py#L35-L42 | train | Register a new subscriber. |
mivade/tornadose | tornadose/stores.py | BaseStore.deregister | def deregister(self, subscriber):
"""Stop publishing to a subscriber."""
try:
logger.debug('Subscriber left')
self.subscribers.remove(subscriber)
except KeyError:
logger.debug(
'Error removing subscriber: ' +
str(subscri... | python | def deregister(self, subscriber):
"""Stop publishing to a subscriber."""
try:
logger.debug('Subscriber left')
self.subscribers.remove(subscriber)
except KeyError:
logger.debug(
'Error removing subscriber: ' +
str(subscri... | [
"def",
"deregister",
"(",
"self",
",",
"subscriber",
")",
":",
"try",
":",
"logger",
".",
"debug",
"(",
"'Subscriber left'",
")",
"self",
".",
"subscribers",
".",
"remove",
"(",
"subscriber",
")",
"except",
"KeyError",
":",
"logger",
".",
"debug",
"(",
"... | Stop publishing to a subscriber. | [
"Stop",
"publishing",
"to",
"a",
"subscriber",
"."
] | d220e0e3040d24c98997eee7a8a236602b4c5159 | https://github.com/mivade/tornadose/blob/d220e0e3040d24c98997eee7a8a236602b4c5159/tornadose/stores.py#L44-L52 | train | Stop publishing to a subscriber. |
mivade/tornadose | tornadose/stores.py | RedisStore.shutdown | def shutdown(self):
"""Stop the publishing loop."""
self._done.set()
self.executor.shutdown(wait=False) | python | def shutdown(self):
"""Stop the publishing loop."""
self._done.set()
self.executor.shutdown(wait=False) | [
"def",
"shutdown",
"(",
"self",
")",
":",
"self",
".",
"_done",
".",
"set",
"(",
")",
"self",
".",
"executor",
".",
"shutdown",
"(",
"wait",
"=",
"False",
")"
] | Stop the publishing loop. | [
"Stop",
"the",
"publishing",
"loop",
"."
] | d220e0e3040d24c98997eee7a8a236602b4c5159 | https://github.com/mivade/tornadose/blob/d220e0e3040d24c98997eee7a8a236602b4c5159/tornadose/stores.py#L152-L155 | train | Stop the publishing loop. |
nmdp-bioinformatics/SeqAnn | seqann/sequence_annotation.py | BioSeqAnn.annotate | def annotate(self, sequence: Seq=None, locus: str=None,
nseqs: int=20, alignseqs: int=10,
skip: List=[],
rerun: bool=True,
full: bool=True) -> Annotation:
"""
annotate - method for annotating a BioPython sequence
:param sequenc... | python | def annotate(self, sequence: Seq=None, locus: str=None,
nseqs: int=20, alignseqs: int=10,
skip: List=[],
rerun: bool=True,
full: bool=True) -> Annotation:
"""
annotate - method for annotating a BioPython sequence
:param sequenc... | [
"def",
"annotate",
"(",
"self",
",",
"sequence",
":",
"Seq",
"=",
"None",
",",
"locus",
":",
"str",
"=",
"None",
",",
"nseqs",
":",
"int",
"=",
"20",
",",
"alignseqs",
":",
"int",
"=",
"10",
",",
"skip",
":",
"List",
"=",
"[",
"]",
",",
"rerun"... | annotate - method for annotating a BioPython sequence
:param sequence: The input consensus sequence.
:type sequence: Seq
:param locus: The gene locus associated with the sequence.
:type locus: ``str``
:param nseqs: The number of blast sequences to use.
:type nseqs: ``int... | [
"annotate",
"-",
"method",
"for",
"annotating",
"a",
"BioPython",
"sequence"
] | 5ce91559b0a4fbe4fb7758e034eb258202632463 | https://github.com/nmdp-bioinformatics/SeqAnn/blob/5ce91559b0a4fbe4fb7758e034eb258202632463/seqann/sequence_annotation.py#L189-L620 | train | This method is used to annotate a BioPython sequence with the specified features and names associated with the sequence. |
nmdp-bioinformatics/SeqAnn | seqann/sequence_annotation.py | BioSeqAnn.ref_align | def ref_align(self, found_seqs, sequence: Seq=None,
locus: str=None, annotation: Annotation=None,
partial_ann: Annotation=None,
run: int=0,
cutoff: float=.90) -> Annotation:
"""
ref_align - Method for doing targeted alignments on pa... | python | def ref_align(self, found_seqs, sequence: Seq=None,
locus: str=None, annotation: Annotation=None,
partial_ann: Annotation=None,
run: int=0,
cutoff: float=.90) -> Annotation:
"""
ref_align - Method for doing targeted alignments on pa... | [
"def",
"ref_align",
"(",
"self",
",",
"found_seqs",
",",
"sequence",
":",
"Seq",
"=",
"None",
",",
"locus",
":",
"str",
"=",
"None",
",",
"annotation",
":",
"Annotation",
"=",
"None",
",",
"partial_ann",
":",
"Annotation",
"=",
"None",
",",
"run",
":",... | ref_align - Method for doing targeted alignments on partial annotations
:param found_seqs: The input sequence record.
:type found_seqs: Seq
:param sequence: The input sequence record.
:type sequence: Seq
:param locus: The gene locus associated with the sequence.
:type lo... | [
"ref_align",
"-",
"Method",
"for",
"doing",
"targeted",
"alignments",
"on",
"partial",
"annotations"
] | 5ce91559b0a4fbe4fb7758e034eb258202632463 | https://github.com/nmdp-bioinformatics/SeqAnn/blob/5ce91559b0a4fbe4fb7758e034eb258202632463/seqann/sequence_annotation.py#L622-L1122 | train | Aligns the found sequences with the given locus and annotation. |
nmdp-bioinformatics/SeqAnn | seqann/sequence_annotation.py | BioSeqAnn.add_alignment | def add_alignment(self, ref_seq, annotation) -> Annotation:
"""
add_alignment - method for adding the alignment to an annotation
:param ref_seq: List of reference sequences
:type ref_seq: List
:param annotation: The complete annotation
:type annotation: Annotation
... | python | def add_alignment(self, ref_seq, annotation) -> Annotation:
"""
add_alignment - method for adding the alignment to an annotation
:param ref_seq: List of reference sequences
:type ref_seq: List
:param annotation: The complete annotation
:type annotation: Annotation
... | [
"def",
"add_alignment",
"(",
"self",
",",
"ref_seq",
",",
"annotation",
")",
"->",
"Annotation",
":",
"seq_features",
"=",
"get_seqs",
"(",
"ref_seq",
")",
"annoated_align",
"=",
"{",
"}",
"allele",
"=",
"ref_seq",
".",
"description",
".",
"split",
"(",
"\... | add_alignment - method for adding the alignment to an annotation
:param ref_seq: List of reference sequences
:type ref_seq: List
:param annotation: The complete annotation
:type annotation: Annotation
:rtype: Annotation | [
"add_alignment",
"-",
"method",
"for",
"adding",
"the",
"alignment",
"to",
"an",
"annotation"
] | 5ce91559b0a4fbe4fb7758e034eb258202632463 | https://github.com/nmdp-bioinformatics/SeqAnn/blob/5ce91559b0a4fbe4fb7758e034eb258202632463/seqann/sequence_annotation.py#L1129-L1180 | train | Method to add an alignment to an annotation |
heronotears/lazyxml | lazyxml/builder.py | Builder.object2xml | def object2xml(self, data):
r"""Convert python object to xml string.
:param data: data for build xml. If don't provide the ``root`` option, type of ``data`` must be dict and ``len(data) == 1``.
:rtype: str or unicode
.. versionadded:: 1.2
"""
if not self.__options['enco... | python | def object2xml(self, data):
r"""Convert python object to xml string.
:param data: data for build xml. If don't provide the ``root`` option, type of ``data`` must be dict and ``len(data) == 1``.
:rtype: str or unicode
.. versionadded:: 1.2
"""
if not self.__options['enco... | [
"def",
"object2xml",
"(",
"self",
",",
"data",
")",
":",
"if",
"not",
"self",
".",
"__options",
"[",
"'encoding'",
"]",
":",
"self",
".",
"set_options",
"(",
"encoding",
"=",
"self",
".",
"__encoding",
")",
"if",
"self",
".",
"__options",
"[",
"'header... | r"""Convert python object to xml string.
:param data: data for build xml. If don't provide the ``root`` option, type of ``data`` must be dict and ``len(data) == 1``.
:rtype: str or unicode
.. versionadded:: 1.2 | [
"r",
"Convert",
"python",
"object",
"to",
"xml",
"string",
"."
] | e3f1ebd3f34cfa03d022ddec90e17d60c1c81953 | https://github.com/heronotears/lazyxml/blob/e3f1ebd3f34cfa03d022ddec90e17d60c1c81953/lazyxml/builder.py#L60-L85 | train | r Convert python object to xml string. |
heronotears/lazyxml | lazyxml/builder.py | Builder.build_tree | def build_tree(self, data, tagname, attrs=None, depth=0):
r"""Build xml tree.
:param data: data for build xml.
:param tagname: element tag name.
:param attrs: element attributes. Default:``None``.
:type attrs: dict or None
:param depth: element depth of the hierarchy. De... | python | def build_tree(self, data, tagname, attrs=None, depth=0):
r"""Build xml tree.
:param data: data for build xml.
:param tagname: element tag name.
:param attrs: element attributes. Default:``None``.
:type attrs: dict or None
:param depth: element depth of the hierarchy. De... | [
"def",
"build_tree",
"(",
"self",
",",
"data",
",",
"tagname",
",",
"attrs",
"=",
"None",
",",
"depth",
"=",
"0",
")",
":",
"if",
"data",
"is",
"None",
":",
"data",
"=",
"''",
"indent",
"=",
"(",
"'\\n%s'",
"%",
"(",
"self",
".",
"__options",
"["... | r"""Build xml tree.
:param data: data for build xml.
:param tagname: element tag name.
:param attrs: element attributes. Default:``None``.
:type attrs: dict or None
:param depth: element depth of the hierarchy. Default:``0``.
:type depth: int | [
"r",
"Build",
"xml",
"tree",
"."
] | e3f1ebd3f34cfa03d022ddec90e17d60c1c81953 | https://github.com/heronotears/lazyxml/blob/e3f1ebd3f34cfa03d022ddec90e17d60c1c81953/lazyxml/builder.py#L94-L128 | train | r Builds xml tree. |
heronotears/lazyxml | lazyxml/builder.py | Builder.check_structure | def check_structure(self, keys):
r"""Check structure availability by ``attrkey`` and ``valuekey`` option.
"""
return set(keys) <= set([self.__options['attrkey'], self.__options['valuekey']]) | python | def check_structure(self, keys):
r"""Check structure availability by ``attrkey`` and ``valuekey`` option.
"""
return set(keys) <= set([self.__options['attrkey'], self.__options['valuekey']]) | [
"def",
"check_structure",
"(",
"self",
",",
"keys",
")",
":",
"return",
"set",
"(",
"keys",
")",
"<=",
"set",
"(",
"[",
"self",
".",
"__options",
"[",
"'attrkey'",
"]",
",",
"self",
".",
"__options",
"[",
"'valuekey'",
"]",
"]",
")"
] | r"""Check structure availability by ``attrkey`` and ``valuekey`` option. | [
"r",
"Check",
"structure",
"availability",
"by",
"attrkey",
"and",
"valuekey",
"option",
"."
] | e3f1ebd3f34cfa03d022ddec90e17d60c1c81953 | https://github.com/heronotears/lazyxml/blob/e3f1ebd3f34cfa03d022ddec90e17d60c1c81953/lazyxml/builder.py#L130-L133 | train | r Check if the structure is available by attrkey and valuekey option. |
heronotears/lazyxml | lazyxml/builder.py | Builder.pickdata | def pickdata(self, data):
r"""Pick data from ``attrkey`` and ``valuekey`` option.
:return: a pair of (attrs, values)
:rtype: tuple
"""
attrs = data.get(self.__options['attrkey']) or {}
values = data.get(self.__options['valuekey']) or ''
return (attrs, values) | python | def pickdata(self, data):
r"""Pick data from ``attrkey`` and ``valuekey`` option.
:return: a pair of (attrs, values)
:rtype: tuple
"""
attrs = data.get(self.__options['attrkey']) or {}
values = data.get(self.__options['valuekey']) or ''
return (attrs, values) | [
"def",
"pickdata",
"(",
"self",
",",
"data",
")",
":",
"attrs",
"=",
"data",
".",
"get",
"(",
"self",
".",
"__options",
"[",
"'attrkey'",
"]",
")",
"or",
"{",
"}",
"values",
"=",
"data",
".",
"get",
"(",
"self",
".",
"__options",
"[",
"'valuekey'",... | r"""Pick data from ``attrkey`` and ``valuekey`` option.
:return: a pair of (attrs, values)
:rtype: tuple | [
"r",
"Pick",
"data",
"from",
"attrkey",
"and",
"valuekey",
"option",
"."
] | e3f1ebd3f34cfa03d022ddec90e17d60c1c81953 | https://github.com/heronotears/lazyxml/blob/e3f1ebd3f34cfa03d022ddec90e17d60c1c81953/lazyxml/builder.py#L135-L143 | train | r Pick data from attrkey and valuekey option. |
heronotears/lazyxml | lazyxml/builder.py | Builder.safedata | def safedata(self, data, cdata=True):
r"""Convert xml special chars to entities.
:param data: the data will be converted safe.
:param cdata: whether to use cdata. Default:``True``. If not, use :func:`cgi.escape` to convert data.
:type cdata: bool
:rtype: str
"""
... | python | def safedata(self, data, cdata=True):
r"""Convert xml special chars to entities.
:param data: the data will be converted safe.
:param cdata: whether to use cdata. Default:``True``. If not, use :func:`cgi.escape` to convert data.
:type cdata: bool
:rtype: str
"""
... | [
"def",
"safedata",
"(",
"self",
",",
"data",
",",
"cdata",
"=",
"True",
")",
":",
"safe",
"=",
"(",
"'<![CDATA[%s]]>'",
"%",
"data",
")",
"if",
"cdata",
"else",
"cgi",
".",
"escape",
"(",
"str",
"(",
"data",
")",
",",
"True",
")",
"return",
"safe"
... | r"""Convert xml special chars to entities.
:param data: the data will be converted safe.
:param cdata: whether to use cdata. Default:``True``. If not, use :func:`cgi.escape` to convert data.
:type cdata: bool
:rtype: str | [
"r",
"Convert",
"xml",
"special",
"chars",
"to",
"entities",
"."
] | e3f1ebd3f34cfa03d022ddec90e17d60c1c81953 | https://github.com/heronotears/lazyxml/blob/e3f1ebd3f34cfa03d022ddec90e17d60c1c81953/lazyxml/builder.py#L145-L154 | train | Convert xml special chars to entities. |
heronotears/lazyxml | lazyxml/builder.py | Builder.build_tag | def build_tag(self, tag, text='', attrs=None):
r"""Build tag full info include the attributes.
:param tag: tag name.
:param text: tag text.
:param attrs: tag attributes. Default:``None``.
:type attrs: dict or None
:rtype: str
"""
return '%s%s%s' % (self.t... | python | def build_tag(self, tag, text='', attrs=None):
r"""Build tag full info include the attributes.
:param tag: tag name.
:param text: tag text.
:param attrs: tag attributes. Default:``None``.
:type attrs: dict or None
:rtype: str
"""
return '%s%s%s' % (self.t... | [
"def",
"build_tag",
"(",
"self",
",",
"tag",
",",
"text",
"=",
"''",
",",
"attrs",
"=",
"None",
")",
":",
"return",
"'%s%s%s'",
"%",
"(",
"self",
".",
"tag_start",
"(",
"tag",
",",
"attrs",
")",
",",
"text",
",",
"self",
".",
"tag_end",
"(",
"tag... | r"""Build tag full info include the attributes.
:param tag: tag name.
:param text: tag text.
:param attrs: tag attributes. Default:``None``.
:type attrs: dict or None
:rtype: str | [
"r",
"Build",
"tag",
"full",
"info",
"include",
"the",
"attributes",
"."
] | e3f1ebd3f34cfa03d022ddec90e17d60c1c81953 | https://github.com/heronotears/lazyxml/blob/e3f1ebd3f34cfa03d022ddec90e17d60c1c81953/lazyxml/builder.py#L156-L165 | train | r Build a tag full info include the attributes. |
heronotears/lazyxml | lazyxml/builder.py | Builder.build_attr | def build_attr(self, attrs):
r"""Build tag attributes.
:param attrs: tag attributes
:type attrs: dict
:rtype: str
"""
attrs = sorted(attrs.iteritems(), key=lambda x: x[0])
return ' '.join(map(lambda x: '%s="%s"' % x, attrs)) | python | def build_attr(self, attrs):
r"""Build tag attributes.
:param attrs: tag attributes
:type attrs: dict
:rtype: str
"""
attrs = sorted(attrs.iteritems(), key=lambda x: x[0])
return ' '.join(map(lambda x: '%s="%s"' % x, attrs)) | [
"def",
"build_attr",
"(",
"self",
",",
"attrs",
")",
":",
"attrs",
"=",
"sorted",
"(",
"attrs",
".",
"iteritems",
"(",
")",
",",
"key",
"=",
"lambda",
"x",
":",
"x",
"[",
"0",
"]",
")",
"return",
"' '",
".",
"join",
"(",
"map",
"(",
"lambda",
"... | r"""Build tag attributes.
:param attrs: tag attributes
:type attrs: dict
:rtype: str | [
"r",
"Build",
"tag",
"attributes",
"."
] | e3f1ebd3f34cfa03d022ddec90e17d60c1c81953 | https://github.com/heronotears/lazyxml/blob/e3f1ebd3f34cfa03d022ddec90e17d60c1c81953/lazyxml/builder.py#L167-L175 | train | r Build tag attributes. |
heronotears/lazyxml | lazyxml/builder.py | Builder.tag_start | def tag_start(self, tag, attrs=None):
r"""Build started tag info.
:param tag: tag name
:param attrs: tag attributes. Default:``None``.
:type attrs: dict or None
:rtype: str
"""
return '<%s %s>' % (tag, self.build_attr(attrs)) if attrs else '<%s>' % tag | python | def tag_start(self, tag, attrs=None):
r"""Build started tag info.
:param tag: tag name
:param attrs: tag attributes. Default:``None``.
:type attrs: dict or None
:rtype: str
"""
return '<%s %s>' % (tag, self.build_attr(attrs)) if attrs else '<%s>' % tag | [
"def",
"tag_start",
"(",
"self",
",",
"tag",
",",
"attrs",
"=",
"None",
")",
":",
"return",
"'<%s %s>'",
"%",
"(",
"tag",
",",
"self",
".",
"build_attr",
"(",
"attrs",
")",
")",
"if",
"attrs",
"else",
"'<%s>'",
"%",
"tag"
] | r"""Build started tag info.
:param tag: tag name
:param attrs: tag attributes. Default:``None``.
:type attrs: dict or None
:rtype: str | [
"r",
"Build",
"started",
"tag",
"info",
"."
] | e3f1ebd3f34cfa03d022ddec90e17d60c1c81953 | https://github.com/heronotears/lazyxml/blob/e3f1ebd3f34cfa03d022ddec90e17d60c1c81953/lazyxml/builder.py#L177-L185 | train | r Build started tag info. |
LISE-B26/pylabcontrol | build/lib/scripts/script_dummy.py | ScriptDummy._function | def _function(self):
"""
This is the actual function that will be executed. It uses only information that is provided in the settings property
will be overwritten in the __init__
"""
# some generic function
import time
import random
self.data['random data... | python | def _function(self):
"""
This is the actual function that will be executed. It uses only information that is provided in the settings property
will be overwritten in the __init__
"""
# some generic function
import time
import random
self.data['random data... | [
"def",
"_function",
"(",
"self",
")",
":",
"# some generic function",
"import",
"time",
"import",
"random",
"self",
".",
"data",
"[",
"'random data'",
"]",
"=",
"None",
"self",
".",
"data",
"[",
"'image data'",
"]",
"=",
"None",
"count",
"=",
"self",
".",
... | This is the actual function that will be executed. It uses only information that is provided in the settings property
will be overwritten in the __init__ | [
"This",
"is",
"the",
"actual",
"function",
"that",
"will",
"be",
"executed",
".",
"It",
"uses",
"only",
"information",
"that",
"is",
"provided",
"in",
"the",
"settings",
"property",
"will",
"be",
"overwritten",
"in",
"the",
"__init__"
] | 67482e5157fcd1c40705e5c2cacfb93564703ed0 | https://github.com/LISE-B26/pylabcontrol/blob/67482e5157fcd1c40705e5c2cacfb93564703ed0/build/lib/scripts/script_dummy.py#L93-L126 | train | This is the actual function that will be executed by the main function. It will be called by the main function. It will create the random values and update the image data with the new random values. |
LISE-B26/pylabcontrol | build/lib/scripts/script_dummy.py | ScriptDummy._plot | def _plot(self, axes_list, data = None):
"""
plots the data only the axes objects that are provided in axes_list
Args:
axes_list: a list of axes objects, this should be implemented in each subscript
data: data to be plotted if empty take self.data
Returns: None
... | python | def _plot(self, axes_list, data = None):
"""
plots the data only the axes objects that are provided in axes_list
Args:
axes_list: a list of axes objects, this should be implemented in each subscript
data: data to be plotted if empty take self.data
Returns: None
... | [
"def",
"_plot",
"(",
"self",
",",
"axes_list",
",",
"data",
"=",
"None",
")",
":",
"plot_type",
"=",
"self",
".",
"settings",
"[",
"'plot_style'",
"]",
"if",
"data",
"is",
"None",
":",
"data",
"=",
"self",
".",
"data",
"if",
"data",
"is",
"not",
"N... | plots the data only the axes objects that are provided in axes_list
Args:
axes_list: a list of axes objects, this should be implemented in each subscript
data: data to be plotted if empty take self.data
Returns: None | [
"plots",
"the",
"data",
"only",
"the",
"axes",
"objects",
"that",
"are",
"provided",
"in",
"axes_list",
"Args",
":",
"axes_list",
":",
"a",
"list",
"of",
"axes",
"objects",
"this",
"should",
"be",
"implemented",
"in",
"each",
"subscript",
"data",
":",
"dat... | 67482e5157fcd1c40705e5c2cacfb93564703ed0 | https://github.com/LISE-B26/pylabcontrol/blob/67482e5157fcd1c40705e5c2cacfb93564703ed0/build/lib/scripts/script_dummy.py#L129-L156 | train | Plots the data only the axes objects that are provided in axes_list |
LISE-B26/pylabcontrol | build/lib/scripts/script_dummy.py | ScriptDummy._update | def _update(self, axes_list):
"""
updates the data in already existing plots. the axes objects are provided in axes_list
Args:
axes_list: a list of axes objects, this should be implemented in each subscript
Returns: None
"""
plot_type = self.settings['plot_s... | python | def _update(self, axes_list):
"""
updates the data in already existing plots. the axes objects are provided in axes_list
Args:
axes_list: a list of axes objects, this should be implemented in each subscript
Returns: None
"""
plot_type = self.settings['plot_s... | [
"def",
"_update",
"(",
"self",
",",
"axes_list",
")",
":",
"plot_type",
"=",
"self",
".",
"settings",
"[",
"'plot_style'",
"]",
"if",
"plot_type",
"==",
"'2D'",
":",
"# we expect exactely one image in the axes object (see ScriptDummy.plot)",
"implot",
"=",
"axes_list"... | updates the data in already existing plots. the axes objects are provided in axes_list
Args:
axes_list: a list of axes objects, this should be implemented in each subscript
Returns: None | [
"updates",
"the",
"data",
"in",
"already",
"existing",
"plots",
".",
"the",
"axes",
"objects",
"are",
"provided",
"in",
"axes_list",
"Args",
":",
"axes_list",
":",
"a",
"list",
"of",
"axes",
"objects",
"this",
"should",
"be",
"implemented",
"in",
"each",
"... | 67482e5157fcd1c40705e5c2cacfb93564703ed0 | https://github.com/LISE-B26/pylabcontrol/blob/67482e5157fcd1c40705e5c2cacfb93564703ed0/build/lib/scripts/script_dummy.py#L158-L181 | train | Update the data in already existing plots. |
LISE-B26/pylabcontrol | build/lib/scripts/script_dummy.py | DummyPlantWithControler._function | def _function(self):
"""
This is the actual function that will be executed. It uses only information that is provided in the settings property
will be overwritten in the __init__
"""
plant = self.instruments['plant']['instance']
controler = self.instruments['controler']['... | python | def _function(self):
"""
This is the actual function that will be executed. It uses only information that is provided in the settings property
will be overwritten in the __init__
"""
plant = self.instruments['plant']['instance']
controler = self.instruments['controler']['... | [
"def",
"_function",
"(",
"self",
")",
":",
"plant",
"=",
"self",
".",
"instruments",
"[",
"'plant'",
"]",
"[",
"'instance'",
"]",
"controler",
"=",
"self",
".",
"instruments",
"[",
"'controler'",
"]",
"[",
"'instance'",
"]",
"plant",
".",
"update",
"(",
... | This is the actual function that will be executed. It uses only information that is provided in the settings property
will be overwritten in the __init__ | [
"This",
"is",
"the",
"actual",
"function",
"that",
"will",
"be",
"executed",
".",
"It",
"uses",
"only",
"information",
"that",
"is",
"provided",
"in",
"the",
"settings",
"property",
"will",
"be",
"overwritten",
"in",
"the",
"__init__"
] | 67482e5157fcd1c40705e5c2cacfb93564703ed0 | https://github.com/LISE-B26/pylabcontrol/blob/67482e5157fcd1c40705e5c2cacfb93564703ed0/build/lib/scripts/script_dummy.py#L267-L311 | train | This is the actual function that is executed by the main function. It is called by the main function that is run by the main function. It is called by the main function that is run by the main function. It is called by the main function that is run by the main function. It is called by the main function that is run by ... |
toros-astro/corral | corral/db/__init__.py | session_scope | def session_scope(session_cls=None):
"""Provide a transactional scope around a series of operations."""
session = session_cls() if session_cls else Session()
try:
yield session
session.commit()
except Exception:
session.rollback()
raise
finally:
session.close(... | python | def session_scope(session_cls=None):
"""Provide a transactional scope around a series of operations."""
session = session_cls() if session_cls else Session()
try:
yield session
session.commit()
except Exception:
session.rollback()
raise
finally:
session.close(... | [
"def",
"session_scope",
"(",
"session_cls",
"=",
"None",
")",
":",
"session",
"=",
"session_cls",
"(",
")",
"if",
"session_cls",
"else",
"Session",
"(",
")",
"try",
":",
"yield",
"session",
"session",
".",
"commit",
"(",
")",
"except",
"Exception",
":",
... | Provide a transactional scope around a series of operations. | [
"Provide",
"a",
"transactional",
"scope",
"around",
"a",
"series",
"of",
"operations",
"."
] | 75474b38ff366330d33644461a902d07374a5bbc | https://github.com/toros-astro/corral/blob/75474b38ff366330d33644461a902d07374a5bbc/corral/db/__init__.py#L143-L153 | train | Provide a transactional scope around a series of operations. |
LISE-B26/pylabcontrol | build/lib/pylabcontrol/gui/windows_and_widgets/export_dialog.py | ExportDialog.open_file_dialog | def open_file_dialog(self):
"""
Opens a file dialog to get the path to a file and put tha tpath in the correct textbox
"""
dialog = QtWidgets.QFileDialog
sender = self.sender()
if sender == self.btn_open_source:
textbox = self.source_path
elif sender =... | python | def open_file_dialog(self):
"""
Opens a file dialog to get the path to a file and put tha tpath in the correct textbox
"""
dialog = QtWidgets.QFileDialog
sender = self.sender()
if sender == self.btn_open_source:
textbox = self.source_path
elif sender =... | [
"def",
"open_file_dialog",
"(",
"self",
")",
":",
"dialog",
"=",
"QtWidgets",
".",
"QFileDialog",
"sender",
"=",
"self",
".",
"sender",
"(",
")",
"if",
"sender",
"==",
"self",
".",
"btn_open_source",
":",
"textbox",
"=",
"self",
".",
"source_path",
"elif",... | Opens a file dialog to get the path to a file and put tha tpath in the correct textbox | [
"Opens",
"a",
"file",
"dialog",
"to",
"get",
"the",
"path",
"to",
"a",
"file",
"and",
"put",
"tha",
"tpath",
"in",
"the",
"correct",
"textbox"
] | 67482e5157fcd1c40705e5c2cacfb93564703ed0 | https://github.com/LISE-B26/pylabcontrol/blob/67482e5157fcd1c40705e5c2cacfb93564703ed0/build/lib/pylabcontrol/gui/windows_and_widgets/export_dialog.py#L69-L84 | train | Opens a file dialog to get the path to a file and put tha tpath in the correct textbox
|
LISE-B26/pylabcontrol | build/lib/pylabcontrol/gui/windows_and_widgets/export_dialog.py | ExportDialog.reset_avaliable | def reset_avaliable(self, folder):
"""
Resets the dialog box by finding all avaliable scripts that can be imported in the input folder
:param folder: folder in which to find scripts
"""
try:
self.list_script_model.removeRows(0, self.list_script_model.rowCount())
... | python | def reset_avaliable(self, folder):
"""
Resets the dialog box by finding all avaliable scripts that can be imported in the input folder
:param folder: folder in which to find scripts
"""
try:
self.list_script_model.removeRows(0, self.list_script_model.rowCount())
... | [
"def",
"reset_avaliable",
"(",
"self",
",",
"folder",
")",
":",
"try",
":",
"self",
".",
"list_script_model",
".",
"removeRows",
"(",
"0",
",",
"self",
".",
"list_script_model",
".",
"rowCount",
"(",
")",
")",
"if",
"self",
".",
"cmb_select_type",
".",
"... | Resets the dialog box by finding all avaliable scripts that can be imported in the input folder
:param folder: folder in which to find scripts | [
"Resets",
"the",
"dialog",
"box",
"by",
"finding",
"all",
"avaliable",
"scripts",
"that",
"can",
"be",
"imported",
"in",
"the",
"input",
"folder",
":",
"param",
"folder",
":",
"folder",
"in",
"which",
"to",
"find",
"scripts"
] | 67482e5157fcd1c40705e5c2cacfb93564703ed0 | https://github.com/LISE-B26/pylabcontrol/blob/67482e5157fcd1c40705e5c2cacfb93564703ed0/build/lib/pylabcontrol/gui/windows_and_widgets/export_dialog.py#L86-L103 | train | Resets the dialog box by finding all avaliable scripts that can be imported in the input folder. |
LISE-B26/pylabcontrol | build/lib/pylabcontrol/gui/windows_and_widgets/export_dialog.py | ExportDialog.class_type_changed | def class_type_changed(self):
"""
Forces a reset if the class type is changed from instruments to scripts or vice versa
"""
if self.source_path.text():
self.reset_avaliable(self.source_path.text()) | python | def class_type_changed(self):
"""
Forces a reset if the class type is changed from instruments to scripts or vice versa
"""
if self.source_path.text():
self.reset_avaliable(self.source_path.text()) | [
"def",
"class_type_changed",
"(",
"self",
")",
":",
"if",
"self",
".",
"source_path",
".",
"text",
"(",
")",
":",
"self",
".",
"reset_avaliable",
"(",
"self",
".",
"source_path",
".",
"text",
"(",
")",
")"
] | Forces a reset if the class type is changed from instruments to scripts or vice versa | [
"Forces",
"a",
"reset",
"if",
"the",
"class",
"type",
"is",
"changed",
"from",
"instruments",
"to",
"scripts",
"or",
"vice",
"versa"
] | 67482e5157fcd1c40705e5c2cacfb93564703ed0 | https://github.com/LISE-B26/pylabcontrol/blob/67482e5157fcd1c40705e5c2cacfb93564703ed0/build/lib/pylabcontrol/gui/windows_and_widgets/export_dialog.py#L105-L110 | train | Resets the avaliable flag if the class type is changed from instruments to scripts or vice versa
|
LISE-B26/pylabcontrol | build/lib/pylabcontrol/gui/windows_and_widgets/export_dialog.py | ExportDialog.fill_list | def fill_list(self, list, input_list):
"""
fills a tree with nested parameters
Args:
tree: QtGui.QTreeView to fill
parameters: dictionary or Parameter object which contains the information to use to fill
"""
for name in input_list:
# print(inde... | python | def fill_list(self, list, input_list):
"""
fills a tree with nested parameters
Args:
tree: QtGui.QTreeView to fill
parameters: dictionary or Parameter object which contains the information to use to fill
"""
for name in input_list:
# print(inde... | [
"def",
"fill_list",
"(",
"self",
",",
"list",
",",
"input_list",
")",
":",
"for",
"name",
"in",
"input_list",
":",
"# print(index, loaded_item, loaded_item_settings)",
"item",
"=",
"QtGui",
".",
"QStandardItem",
"(",
"name",
")",
"item",
".",
"setSelectable",
"(... | fills a tree with nested parameters
Args:
tree: QtGui.QTreeView to fill
parameters: dictionary or Parameter object which contains the information to use to fill | [
"fills",
"a",
"tree",
"with",
"nested",
"parameters",
"Args",
":",
"tree",
":",
"QtGui",
".",
"QTreeView",
"to",
"fill",
"parameters",
":",
"dictionary",
"or",
"Parameter",
"object",
"which",
"contains",
"the",
"information",
"to",
"use",
"to",
"fill"
] | 67482e5157fcd1c40705e5c2cacfb93564703ed0 | https://github.com/LISE-B26/pylabcontrol/blob/67482e5157fcd1c40705e5c2cacfb93564703ed0/build/lib/pylabcontrol/gui/windows_and_widgets/export_dialog.py#L113-L126 | train | Fills a tree with nested parameters |
PeerAssets/pypeerassets | pypeerassets/provider/rpcnode.py | RpcNode.select_inputs | def select_inputs(self, address: str, amount: int) -> dict:
'''finds apropriate utxo's to include in rawtx, while being careful
to never spend old transactions with a lot of coin age.
Argument is intiger, returns list of apropriate UTXO's'''
utxos = []
utxo_sum = Decimal(0)
... | python | def select_inputs(self, address: str, amount: int) -> dict:
'''finds apropriate utxo's to include in rawtx, while being careful
to never spend old transactions with a lot of coin age.
Argument is intiger, returns list of apropriate UTXO's'''
utxos = []
utxo_sum = Decimal(0)
... | [
"def",
"select_inputs",
"(",
"self",
",",
"address",
":",
"str",
",",
"amount",
":",
"int",
")",
"->",
"dict",
":",
"utxos",
"=",
"[",
"]",
"utxo_sum",
"=",
"Decimal",
"(",
"0",
")",
"for",
"tx",
"in",
"sorted",
"(",
"self",
".",
"listunspent",
"("... | finds apropriate utxo's to include in rawtx, while being careful
to never spend old transactions with a lot of coin age.
Argument is intiger, returns list of apropriate UTXO's | [
"finds",
"apropriate",
"utxo",
"s",
"to",
"include",
"in",
"rawtx",
"while",
"being",
"careful",
"to",
"never",
"spend",
"old",
"transactions",
"with",
"a",
"lot",
"of",
"coin",
"age",
".",
"Argument",
"is",
"intiger",
"returns",
"list",
"of",
"apropriate",
... | 8927b4a686887f44fe2cd9de777e2c827c948987 | https://github.com/PeerAssets/pypeerassets/blob/8927b4a686887f44fe2cd9de777e2c827c948987/pypeerassets/provider/rpcnode.py#L21-L47 | train | finds apropriate utxos to include in rawtx while being careful
to never spend old transactions with a lot of coin age. |
PeerAssets/pypeerassets | pypeerassets/provider/rpcnode.py | RpcNode.listunspent | def listunspent(
self,
address: str="",
minconf: int=1,
maxconf: int=999999,
) -> list:
'''list UTXOs
modified version to allow filtering by address.
'''
if address:
return self.req("listunspent", [minconf, maxconf, [address]])
ret... | python | def listunspent(
self,
address: str="",
minconf: int=1,
maxconf: int=999999,
) -> list:
'''list UTXOs
modified version to allow filtering by address.
'''
if address:
return self.req("listunspent", [minconf, maxconf, [address]])
ret... | [
"def",
"listunspent",
"(",
"self",
",",
"address",
":",
"str",
"=",
"\"\"",
",",
"minconf",
":",
"int",
"=",
"1",
",",
"maxconf",
":",
"int",
"=",
"999999",
",",
")",
"->",
"list",
":",
"if",
"address",
":",
"return",
"self",
".",
"req",
"(",
"\"... | list UTXOs
modified version to allow filtering by address. | [
"list",
"UTXOs",
"modified",
"version",
"to",
"allow",
"filtering",
"by",
"address",
"."
] | 8927b4a686887f44fe2cd9de777e2c827c948987 | https://github.com/PeerAssets/pypeerassets/blob/8927b4a686887f44fe2cd9de777e2c827c948987/pypeerassets/provider/rpcnode.py#L67-L79 | train | list unspent UTXOs items |
etal/biofrills | biofrills/pairutils.py | score_pairwise | def score_pairwise(aseq, bseq):
"""Compute pairwise distances between two sequences (raw strings)."""
assert len(aseq) == len(bseq)
# Affine gap penalties -- default values from EMBOSS needle/water
GAP_OPEN = -10.0
GAP_EXTEND = -0.5
GAP_CHARS = frozenset('-.')
score = 0.0
in_gap = True... | python | def score_pairwise(aseq, bseq):
"""Compute pairwise distances between two sequences (raw strings)."""
assert len(aseq) == len(bseq)
# Affine gap penalties -- default values from EMBOSS needle/water
GAP_OPEN = -10.0
GAP_EXTEND = -0.5
GAP_CHARS = frozenset('-.')
score = 0.0
in_gap = True... | [
"def",
"score_pairwise",
"(",
"aseq",
",",
"bseq",
")",
":",
"assert",
"len",
"(",
"aseq",
")",
"==",
"len",
"(",
"bseq",
")",
"# Affine gap penalties -- default values from EMBOSS needle/water",
"GAP_OPEN",
"=",
"-",
"10.0",
"GAP_EXTEND",
"=",
"-",
"0.5",
"GAP_... | Compute pairwise distances between two sequences (raw strings). | [
"Compute",
"pairwise",
"distances",
"between",
"two",
"sequences",
"(",
"raw",
"strings",
")",
"."
] | 36684bb6c7632f96215e8b2b4ebc86640f331bcd | https://github.com/etal/biofrills/blob/36684bb6c7632f96215e8b2b4ebc86640f331bcd/biofrills/pairutils.py#L83-L116 | train | Compute pairwise distances between two sequences. |
etal/biofrills | biofrills/pairutils.py | identity_abs | def identity_abs(aseq, bseq):
"""Compute absolute identity (# matching sites) between sequence strings."""
assert len(aseq) == len(bseq)
return sum(a == b
for a, b in zip(aseq, bseq)
if not (a in '-.' and b in '-.')) | python | def identity_abs(aseq, bseq):
"""Compute absolute identity (# matching sites) between sequence strings."""
assert len(aseq) == len(bseq)
return sum(a == b
for a, b in zip(aseq, bseq)
if not (a in '-.' and b in '-.')) | [
"def",
"identity_abs",
"(",
"aseq",
",",
"bseq",
")",
":",
"assert",
"len",
"(",
"aseq",
")",
"==",
"len",
"(",
"bseq",
")",
"return",
"sum",
"(",
"a",
"==",
"b",
"for",
"a",
",",
"b",
"in",
"zip",
"(",
"aseq",
",",
"bseq",
")",
"if",
"not",
... | Compute absolute identity (# matching sites) between sequence strings. | [
"Compute",
"absolute",
"identity",
"(",
"#",
"matching",
"sites",
")",
"between",
"sequence",
"strings",
"."
] | 36684bb6c7632f96215e8b2b4ebc86640f331bcd | https://github.com/etal/biofrills/blob/36684bb6c7632f96215e8b2b4ebc86640f331bcd/biofrills/pairutils.py#L119-L124 | train | Compute absolute identity between sequence strings. |
etal/biofrills | biofrills/pairutils.py | identity_avg | def identity_avg(aseq, bseq):
"""Compute absolute identity (# matching sites) between sequence strings."""
match = identity_abs(aseq, bseq)
alen = len(aseq.replace('-', '').replace('.', ''))
blen = len(bseq.replace('-', '').replace('.', ''))
avg_len = 0.5 * (alen + blen)
return match / avg_len | python | def identity_avg(aseq, bseq):
"""Compute absolute identity (# matching sites) between sequence strings."""
match = identity_abs(aseq, bseq)
alen = len(aseq.replace('-', '').replace('.', ''))
blen = len(bseq.replace('-', '').replace('.', ''))
avg_len = 0.5 * (alen + blen)
return match / avg_len | [
"def",
"identity_avg",
"(",
"aseq",
",",
"bseq",
")",
":",
"match",
"=",
"identity_abs",
"(",
"aseq",
",",
"bseq",
")",
"alen",
"=",
"len",
"(",
"aseq",
".",
"replace",
"(",
"'-'",
",",
"''",
")",
".",
"replace",
"(",
"'.'",
",",
"''",
")",
")",
... | Compute absolute identity (# matching sites) between sequence strings. | [
"Compute",
"absolute",
"identity",
"(",
"#",
"matching",
"sites",
")",
"between",
"sequence",
"strings",
"."
] | 36684bb6c7632f96215e8b2b4ebc86640f331bcd | https://github.com/etal/biofrills/blob/36684bb6c7632f96215e8b2b4ebc86640f331bcd/biofrills/pairutils.py#L127-L133 | train | Compute absolute identity between sequence strings. |
jspricke/python-remind | remind.py | rem2ics | def rem2ics():
"""Command line tool to convert from Remind to iCalendar"""
# pylint: disable=maybe-no-member
from argparse import ArgumentParser, FileType
from dateutil.parser import parse
from sys import stdin, stdout
parser = ArgumentParser(description='Converter from Remind to iCalendar synt... | python | def rem2ics():
"""Command line tool to convert from Remind to iCalendar"""
# pylint: disable=maybe-no-member
from argparse import ArgumentParser, FileType
from dateutil.parser import parse
from sys import stdin, stdout
parser = ArgumentParser(description='Converter from Remind to iCalendar synt... | [
"def",
"rem2ics",
"(",
")",
":",
"# pylint: disable=maybe-no-member",
"from",
"argparse",
"import",
"ArgumentParser",
",",
"FileType",
"from",
"dateutil",
".",
"parser",
"import",
"parse",
"from",
"sys",
"import",
"stdin",
",",
"stdout",
"parser",
"=",
"ArgumentPa... | Command line tool to convert from Remind to iCalendar | [
"Command",
"line",
"tool",
"to",
"convert",
"from",
"Remind",
"to",
"iCalendar"
] | dda2aa8fc20b87b9c9fcbca2b67bce73911d05d1 | https://github.com/jspricke/python-remind/blob/dda2aa8fc20b87b9c9fcbca2b67bce73911d05d1/remind.py#L594-L626 | train | Command line tool to convert from Remind to iCalendar |
jspricke/python-remind | remind.py | ics2rem | def ics2rem():
"""Command line tool to convert from iCalendar to Remind"""
from argparse import ArgumentParser, FileType
from sys import stdin, stdout
parser = ArgumentParser(description='Converter from iCalendar to Remind syntax.')
parser.add_argument('-l', '--label', help='Label for every Remind ... | python | def ics2rem():
"""Command line tool to convert from iCalendar to Remind"""
from argparse import ArgumentParser, FileType
from sys import stdin, stdout
parser = ArgumentParser(description='Converter from iCalendar to Remind syntax.')
parser.add_argument('-l', '--label', help='Label for every Remind ... | [
"def",
"ics2rem",
"(",
")",
":",
"from",
"argparse",
"import",
"ArgumentParser",
",",
"FileType",
"from",
"sys",
"import",
"stdin",
",",
"stdout",
"parser",
"=",
"ArgumentParser",
"(",
"description",
"=",
"'Converter from iCalendar to Remind syntax.'",
")",
"parser"... | Command line tool to convert from iCalendar to Remind | [
"Command",
"line",
"tool",
"to",
"convert",
"from",
"iCalendar",
"to",
"Remind"
] | dda2aa8fc20b87b9c9fcbca2b67bce73911d05d1 | https://github.com/jspricke/python-remind/blob/dda2aa8fc20b87b9c9fcbca2b67bce73911d05d1/remind.py#L629-L664 | train | Command line tool to convert from iCalendar to Remind |
jspricke/python-remind | remind.py | Remind._parse_remind | def _parse_remind(self, filename, lines=''):
"""Calls remind and parses the output into a dict
filename -- the remind file (included files will be used as well)
lines -- used as stdin to remind (filename will be set to -)
"""
files = {}
reminders = {}
if lines:
... | python | def _parse_remind(self, filename, lines=''):
"""Calls remind and parses the output into a dict
filename -- the remind file (included files will be used as well)
lines -- used as stdin to remind (filename will be set to -)
"""
files = {}
reminders = {}
if lines:
... | [
"def",
"_parse_remind",
"(",
"self",
",",
"filename",
",",
"lines",
"=",
"''",
")",
":",
"files",
"=",
"{",
"}",
"reminders",
"=",
"{",
"}",
"if",
"lines",
":",
"filename",
"=",
"'-'",
"files",
"[",
"filename",
"]",
"=",
"lines",
"reminders",
"[",
... | Calls remind and parses the output into a dict
filename -- the remind file (included files will be used as well)
lines -- used as stdin to remind (filename will be set to -) | [
"Calls",
"remind",
"and",
"parses",
"the",
"output",
"into",
"a",
"dict"
] | dda2aa8fc20b87b9c9fcbca2b67bce73911d05d1 | https://github.com/jspricke/python-remind/blob/dda2aa8fc20b87b9c9fcbca2b67bce73911d05d1/remind.py#L54-L109 | train | Calls remind and parses the output into a dict
|
jspricke/python-remind | remind.py | Remind._parse_remind_line | def _parse_remind_line(self, line, text):
"""Parse a line of remind output into a dict
line -- the remind output
text -- the original remind input
"""
event = {}
line = line.split(None, 6)
dat = [int(f) for f in line[0].split('/')]
if line[4] != '*':
... | python | def _parse_remind_line(self, line, text):
"""Parse a line of remind output into a dict
line -- the remind output
text -- the original remind input
"""
event = {}
line = line.split(None, 6)
dat = [int(f) for f in line[0].split('/')]
if line[4] != '*':
... | [
"def",
"_parse_remind_line",
"(",
"self",
",",
"line",
",",
"text",
")",
":",
"event",
"=",
"{",
"}",
"line",
"=",
"line",
".",
"split",
"(",
"None",
",",
"6",
")",
"dat",
"=",
"[",
"int",
"(",
"f",
")",
"for",
"f",
"in",
"line",
"[",
"0",
"]... | Parse a line of remind output into a dict
line -- the remind output
text -- the original remind input | [
"Parse",
"a",
"line",
"of",
"remind",
"output",
"into",
"a",
"dict"
] | dda2aa8fc20b87b9c9fcbca2b67bce73911d05d1 | https://github.com/jspricke/python-remind/blob/dda2aa8fc20b87b9c9fcbca2b67bce73911d05d1/remind.py#L118-L158 | train | Parse a line of remind output into a dict containing the keys of the event that are available in the remind module. |
jspricke/python-remind | remind.py | Remind._interval | def _interval(dates):
"""Return the distance between all dates and 0 if they are different"""
interval = (dates[1] - dates[0]).days
last = dates[0]
for dat in dates[1:]:
if (dat - last).days != interval:
return 0
last = dat
return interval | python | def _interval(dates):
"""Return the distance between all dates and 0 if they are different"""
interval = (dates[1] - dates[0]).days
last = dates[0]
for dat in dates[1:]:
if (dat - last).days != interval:
return 0
last = dat
return interval | [
"def",
"_interval",
"(",
"dates",
")",
":",
"interval",
"=",
"(",
"dates",
"[",
"1",
"]",
"-",
"dates",
"[",
"0",
"]",
")",
".",
"days",
"last",
"=",
"dates",
"[",
"0",
"]",
"for",
"dat",
"in",
"dates",
"[",
"1",
":",
"]",
":",
"if",
"(",
"... | Return the distance between all dates and 0 if they are different | [
"Return",
"the",
"distance",
"between",
"all",
"dates",
"and",
"0",
"if",
"they",
"are",
"different"
] | dda2aa8fc20b87b9c9fcbca2b67bce73911d05d1 | https://github.com/jspricke/python-remind/blob/dda2aa8fc20b87b9c9fcbca2b67bce73911d05d1/remind.py#L161-L169 | train | Return the distance between all dates and 0 if they are different |
jspricke/python-remind | remind.py | Remind._gen_dtend_rrule | def _gen_dtend_rrule(dtstarts, vevent):
"""Generate an rdate or rrule from a list of dates and add it to the vevent"""
interval = Remind._interval(dtstarts)
if interval > 0 and interval % 7 == 0:
rset = rrule.rruleset()
rset.rrule(rrule.rrule(freq=rrule.WEEKLY, interval=i... | python | def _gen_dtend_rrule(dtstarts, vevent):
"""Generate an rdate or rrule from a list of dates and add it to the vevent"""
interval = Remind._interval(dtstarts)
if interval > 0 and interval % 7 == 0:
rset = rrule.rruleset()
rset.rrule(rrule.rrule(freq=rrule.WEEKLY, interval=i... | [
"def",
"_gen_dtend_rrule",
"(",
"dtstarts",
",",
"vevent",
")",
":",
"interval",
"=",
"Remind",
".",
"_interval",
"(",
"dtstarts",
")",
"if",
"interval",
">",
"0",
"and",
"interval",
"%",
"7",
"==",
"0",
":",
"rset",
"=",
"rrule",
".",
"rruleset",
"(",... | Generate an rdate or rrule from a list of dates and add it to the vevent | [
"Generate",
"an",
"rdate",
"or",
"rrule",
"from",
"a",
"list",
"of",
"dates",
"and",
"add",
"it",
"to",
"the",
"vevent"
] | dda2aa8fc20b87b9c9fcbca2b67bce73911d05d1 | https://github.com/jspricke/python-remind/blob/dda2aa8fc20b87b9c9fcbca2b67bce73911d05d1/remind.py#L172-L206 | train | Generate an rdate or rrule from a list of dates and add it to the vevent |
jspricke/python-remind | remind.py | Remind._gen_vevent | def _gen_vevent(self, event, vevent):
"""Generate vevent from given event"""
vevent.add('dtstart').value = event['dtstart'][0]
vevent.add('dtstamp').value = datetime.fromtimestamp(self._mtime)
vevent.add('summary').value = event['msg']
vevent.add('uid').value = event['uid']
... | python | def _gen_vevent(self, event, vevent):
"""Generate vevent from given event"""
vevent.add('dtstart').value = event['dtstart'][0]
vevent.add('dtstamp').value = datetime.fromtimestamp(self._mtime)
vevent.add('summary').value = event['msg']
vevent.add('uid').value = event['uid']
... | [
"def",
"_gen_vevent",
"(",
"self",
",",
"event",
",",
"vevent",
")",
":",
"vevent",
".",
"add",
"(",
"'dtstart'",
")",
".",
"value",
"=",
"event",
"[",
"'dtstart'",
"]",
"[",
"0",
"]",
"vevent",
".",
"add",
"(",
"'dtstamp'",
")",
".",
"value",
"=",... | Generate vevent from given event | [
"Generate",
"vevent",
"from",
"given",
"event"
] | dda2aa8fc20b87b9c9fcbca2b67bce73911d05d1 | https://github.com/jspricke/python-remind/blob/dda2aa8fc20b87b9c9fcbca2b67bce73911d05d1/remind.py#L208-L243 | train | Generate vevent from given event |
jspricke/python-remind | remind.py | Remind._update | def _update(self):
"""Reload Remind files if the mtime is newer"""
update = not self._reminders
with self._lock:
for fname in self._reminders:
if getmtime(fname) > self._mtime:
update = True
break
if update:
... | python | def _update(self):
"""Reload Remind files if the mtime is newer"""
update = not self._reminders
with self._lock:
for fname in self._reminders:
if getmtime(fname) > self._mtime:
update = True
break
if update:
... | [
"def",
"_update",
"(",
"self",
")",
":",
"update",
"=",
"not",
"self",
".",
"_reminders",
"with",
"self",
".",
"_lock",
":",
"for",
"fname",
"in",
"self",
".",
"_reminders",
":",
"if",
"getmtime",
"(",
"fname",
")",
">",
"self",
".",
"_mtime",
":",
... | Reload Remind files if the mtime is newer | [
"Reload",
"Remind",
"files",
"if",
"the",
"mtime",
"is",
"newer"
] | dda2aa8fc20b87b9c9fcbca2b67bce73911d05d1 | https://github.com/jspricke/python-remind/blob/dda2aa8fc20b87b9c9fcbca2b67bce73911d05d1/remind.py#L245-L256 | train | Reload Remind files if the mtime is newer |
jspricke/python-remind | remind.py | Remind.get_uids | def get_uids(self, filename=None):
"""UIDs of all reminders in the file excluding included files
If a filename is specified, only it's UIDs are return, otherwise all.
filename -- the remind file
"""
self._update()
if filename:
if filename not in self._remind... | python | def get_uids(self, filename=None):
"""UIDs of all reminders in the file excluding included files
If a filename is specified, only it's UIDs are return, otherwise all.
filename -- the remind file
"""
self._update()
if filename:
if filename not in self._remind... | [
"def",
"get_uids",
"(",
"self",
",",
"filename",
"=",
"None",
")",
":",
"self",
".",
"_update",
"(",
")",
"if",
"filename",
":",
"if",
"filename",
"not",
"in",
"self",
".",
"_reminders",
":",
"return",
"[",
"]",
"return",
"self",
".",
"_reminders",
"... | UIDs of all reminders in the file excluding included files
If a filename is specified, only it's UIDs are return, otherwise all.
filename -- the remind file | [
"UIDs",
"of",
"all",
"reminders",
"in",
"the",
"file",
"excluding",
"included",
"files",
"If",
"a",
"filename",
"is",
"specified",
"only",
"it",
"s",
"UIDs",
"are",
"return",
"otherwise",
"all",
"."
] | dda2aa8fc20b87b9c9fcbca2b67bce73911d05d1 | https://github.com/jspricke/python-remind/blob/dda2aa8fc20b87b9c9fcbca2b67bce73911d05d1/remind.py#L268-L280 | train | Returns a list of all UIDs of all reminders in the file excluding included files |
jspricke/python-remind | remind.py | Remind.to_vobjects | def to_vobjects(self, filename, uids=None):
"""Return iCal objects and etags of all Remind entries in uids
filename -- the remind file
uids -- the UIDs of the Remind lines (all if None)
"""
self._update()
if not uids:
uids = self._reminders[filename]
... | python | def to_vobjects(self, filename, uids=None):
"""Return iCal objects and etags of all Remind entries in uids
filename -- the remind file
uids -- the UIDs of the Remind lines (all if None)
"""
self._update()
if not uids:
uids = self._reminders[filename]
... | [
"def",
"to_vobjects",
"(",
"self",
",",
"filename",
",",
"uids",
"=",
"None",
")",
":",
"self",
".",
"_update",
"(",
")",
"if",
"not",
"uids",
":",
"uids",
"=",
"self",
".",
"_reminders",
"[",
"filename",
"]",
"items",
"=",
"[",
"]",
"for",
"uid",
... | Return iCal objects and etags of all Remind entries in uids
filename -- the remind file
uids -- the UIDs of the Remind lines (all if None) | [
"Return",
"iCal",
"objects",
"and",
"etags",
"of",
"all",
"Remind",
"entries",
"in",
"uids"
] | dda2aa8fc20b87b9c9fcbca2b67bce73911d05d1 | https://github.com/jspricke/python-remind/blob/dda2aa8fc20b87b9c9fcbca2b67bce73911d05d1/remind.py#L290-L309 | train | Return iCal objects and etags of all Remind entries in uids |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.