id int32 0 252k | repo stringlengths 7 55 | path stringlengths 4 127 | func_name stringlengths 1 88 | original_string stringlengths 75 19.8k | language stringclasses 1
value | code stringlengths 75 19.8k | code_tokens list | docstring stringlengths 3 17.3k | docstring_tokens list | sha stringlengths 40 40 | url stringlengths 87 242 |
|---|---|---|---|---|---|---|---|---|---|---|---|
39,300 | e7dal/bubble3 | bubble3/commands/cmd_manual.py | cli | def cli(ctx):
"""Shows the man page packed inside the bubble tool
this is mainly too overcome limitations on installing manual pages in a distribution agnostic and simple way
and the way bubble has been developed, in virtual python environments,
installing a man page into a system location makes no sen... | python | def cli(ctx):
"""Shows the man page packed inside the bubble tool
this is mainly too overcome limitations on installing manual pages in a distribution agnostic and simple way
and the way bubble has been developed, in virtual python environments,
installing a man page into a system location makes no sen... | [
"def",
"cli",
"(",
"ctx",
")",
":",
"manfile",
"=",
"bubble_lib_dir",
"+",
"os",
".",
"sep",
"+",
"'extras'",
"+",
"os",
".",
"sep",
"+",
"'Bubble.1.gz'",
"mancmd",
"=",
"[",
"\"/usr/bin/man\"",
",",
"manfile",
"]",
"try",
":",
"return",
"subprocess",
... | Shows the man page packed inside the bubble tool
this is mainly too overcome limitations on installing manual pages in a distribution agnostic and simple way
and the way bubble has been developed, in virtual python environments,
installing a man page into a system location makes no sense,
the system ma... | [
"Shows",
"the",
"man",
"page",
"packed",
"inside",
"the",
"bubble",
"tool"
] | 59c735281a95b44f6263a25f4d6ce24fca520082 | https://github.com/e7dal/bubble3/blob/59c735281a95b44f6263a25f4d6ce24fca520082/bubble3/commands/cmd_manual.py#L11-L28 |
39,301 | jplusplus/statscraper | statscraper/scrapers/SCBScraper.py | SCB._fetch_dimensions | def _fetch_dimensions(self, dataset):
"""
We override this method just to set the correct datatype
and dialect for regions.
"""
for dimension in super(SCB, self)._fetch_dimensions(dataset):
if dimension.id == "Region":
yield Dimension(dimension... | python | def _fetch_dimensions(self, dataset):
"""
We override this method just to set the correct datatype
and dialect for regions.
"""
for dimension in super(SCB, self)._fetch_dimensions(dataset):
if dimension.id == "Region":
yield Dimension(dimension... | [
"def",
"_fetch_dimensions",
"(",
"self",
",",
"dataset",
")",
":",
"for",
"dimension",
"in",
"super",
"(",
"SCB",
",",
"self",
")",
".",
"_fetch_dimensions",
"(",
"dataset",
")",
":",
"if",
"dimension",
".",
"id",
"==",
"\"Region\"",
":",
"yield",
"Dimen... | We override this method just to set the correct datatype
and dialect for regions. | [
"We",
"override",
"this",
"method",
"just",
"to",
"set",
"the",
"correct",
"datatype",
"and",
"dialect",
"for",
"regions",
"."
] | 932ec048b23d15b3dbdaf829facc55fd78ec0109 | https://github.com/jplusplus/statscraper/blob/932ec048b23d15b3dbdaf829facc55fd78ec0109/statscraper/scrapers/SCBScraper.py#L12-L24 |
39,302 | suzaku/cachelper | cachelper/remote.py | HelperMixin.call | def call(self, func, key, timeout=None):
'''Wraps a function call with cache.
Args:
func (function): the function to call.
key (str): the cache key for this call.
timeout (int): the cache timeout for the key (the
unit of this parameter depe... | python | def call(self, func, key, timeout=None):
'''Wraps a function call with cache.
Args:
func (function): the function to call.
key (str): the cache key for this call.
timeout (int): the cache timeout for the key (the
unit of this parameter depe... | [
"def",
"call",
"(",
"self",
",",
"func",
",",
"key",
",",
"timeout",
"=",
"None",
")",
":",
"result",
"=",
"self",
".",
"get",
"(",
"key",
")",
"if",
"result",
"==",
"NONE_RESULT",
":",
"return",
"None",
"if",
"result",
"is",
"None",
":",
"result",... | Wraps a function call with cache.
Args:
func (function): the function to call.
key (str): the cache key for this call.
timeout (int): the cache timeout for the key (the
unit of this parameter depends on
the cache class yo... | [
"Wraps",
"a",
"function",
"call",
"with",
"cache",
"."
] | 7da36614f9a23abb97c4d4c871dd45e07080dfb5 | https://github.com/suzaku/cachelper/blob/7da36614f9a23abb97c4d4c871dd45e07080dfb5/cachelper/remote.py#L21-L46 |
39,303 | suzaku/cachelper | cachelper/remote.py | HelperMixin.map | def map(self, key_pattern, func, all_args, timeout=None):
'''Cache return value of multiple calls.
Args:
key_pattern (str): the key pattern to use for generating
keys for caches of the decorated function.
func (function): the function to call.
... | python | def map(self, key_pattern, func, all_args, timeout=None):
'''Cache return value of multiple calls.
Args:
key_pattern (str): the key pattern to use for generating
keys for caches of the decorated function.
func (function): the function to call.
... | [
"def",
"map",
"(",
"self",
",",
"key_pattern",
",",
"func",
",",
"all_args",
",",
"timeout",
"=",
"None",
")",
":",
"results",
"=",
"[",
"]",
"keys",
"=",
"[",
"make_key",
"(",
"key_pattern",
",",
"func",
",",
"args",
",",
"{",
"}",
")",
"for",
"... | Cache return value of multiple calls.
Args:
key_pattern (str): the key pattern to use for generating
keys for caches of the decorated function.
func (function): the function to call.
all_args (list): a list of args to be used to make calls to
... | [
"Cache",
"return",
"value",
"of",
"multiple",
"calls",
"."
] | 7da36614f9a23abb97c4d4c871dd45e07080dfb5 | https://github.com/suzaku/cachelper/blob/7da36614f9a23abb97c4d4c871dd45e07080dfb5/cachelper/remote.py#L48-L86 |
39,304 | adamrothman/ftl | ftl/connection.py | HTTP2Connection._window_open | async def _window_open(self, stream_id: int):
"""Wait until the identified stream's flow control window is open.
"""
stream = self._get_stream(stream_id)
return await stream.window_open.wait() | python | async def _window_open(self, stream_id: int):
"""Wait until the identified stream's flow control window is open.
"""
stream = self._get_stream(stream_id)
return await stream.window_open.wait() | [
"async",
"def",
"_window_open",
"(",
"self",
",",
"stream_id",
":",
"int",
")",
":",
"stream",
"=",
"self",
".",
"_get_stream",
"(",
"stream_id",
")",
"return",
"await",
"stream",
".",
"window_open",
".",
"wait",
"(",
")"
] | Wait until the identified stream's flow control window is open. | [
"Wait",
"until",
"the",
"identified",
"stream",
"s",
"flow",
"control",
"window",
"is",
"open",
"."
] | a88f3df1ecbdfba45035b65f833b8ffffc49b399 | https://github.com/adamrothman/ftl/blob/a88f3df1ecbdfba45035b65f833b8ffffc49b399/ftl/connection.py#L260-L264 |
39,305 | adamrothman/ftl | ftl/connection.py | HTTP2Connection.send_data | async def send_data(
self,
stream_id: int,
data: bytes,
end_stream: bool = False,
):
"""Send data, respecting the receiver's flow control instructions. If
the provided data is larger than the connection's maximum outbound
frame size, it will be broken into sev... | python | async def send_data(
self,
stream_id: int,
data: bytes,
end_stream: bool = False,
):
"""Send data, respecting the receiver's flow control instructions. If
the provided data is larger than the connection's maximum outbound
frame size, it will be broken into sev... | [
"async",
"def",
"send_data",
"(",
"self",
",",
"stream_id",
":",
"int",
",",
"data",
":",
"bytes",
",",
"end_stream",
":",
"bool",
"=",
"False",
",",
")",
":",
"if",
"self",
".",
"closed",
":",
"raise",
"ConnectionClosedError",
"stream",
"=",
"self",
"... | Send data, respecting the receiver's flow control instructions. If
the provided data is larger than the connection's maximum outbound
frame size, it will be broken into several frames as appropriate. | [
"Send",
"data",
"respecting",
"the",
"receiver",
"s",
"flow",
"control",
"instructions",
".",
"If",
"the",
"provided",
"data",
"is",
"larger",
"than",
"the",
"connection",
"s",
"maximum",
"outbound",
"frame",
"size",
"it",
"will",
"be",
"broken",
"into",
"se... | a88f3df1ecbdfba45035b65f833b8ffffc49b399 | https://github.com/adamrothman/ftl/blob/a88f3df1ecbdfba45035b65f833b8ffffc49b399/ftl/connection.py#L268-L312 |
39,306 | adamrothman/ftl | ftl/connection.py | HTTP2Connection.read_data | async def read_data(self, stream_id: int) -> bytes:
"""Read data from the specified stream until it is closed by the remote
peer. If the stream is never ended, this never returns.
"""
frames = [f async for f in self.stream_frames(stream_id)]
return b''.join(frames) | python | async def read_data(self, stream_id: int) -> bytes:
"""Read data from the specified stream until it is closed by the remote
peer. If the stream is never ended, this never returns.
"""
frames = [f async for f in self.stream_frames(stream_id)]
return b''.join(frames) | [
"async",
"def",
"read_data",
"(",
"self",
",",
"stream_id",
":",
"int",
")",
"->",
"bytes",
":",
"frames",
"=",
"[",
"f",
"async",
"for",
"f",
"in",
"self",
".",
"stream_frames",
"(",
"stream_id",
")",
"]",
"return",
"b''",
".",
"join",
"(",
"frames"... | Read data from the specified stream until it is closed by the remote
peer. If the stream is never ended, this never returns. | [
"Read",
"data",
"from",
"the",
"specified",
"stream",
"until",
"it",
"is",
"closed",
"by",
"the",
"remote",
"peer",
".",
"If",
"the",
"stream",
"is",
"never",
"ended",
"this",
"never",
"returns",
"."
] | a88f3df1ecbdfba45035b65f833b8ffffc49b399 | https://github.com/adamrothman/ftl/blob/a88f3df1ecbdfba45035b65f833b8ffffc49b399/ftl/connection.py#L316-L321 |
39,307 | adamrothman/ftl | ftl/connection.py | HTTP2Connection.read_frame | async def read_frame(self, stream_id: int) -> bytes:
"""Read a single frame of data from the specified stream, waiting until
frames are available if none are present in the local buffer. If the
stream is closed and all buffered frames have been consumed, raises a
StreamConsumedError.
... | python | async def read_frame(self, stream_id: int) -> bytes:
"""Read a single frame of data from the specified stream, waiting until
frames are available if none are present in the local buffer. If the
stream is closed and all buffered frames have been consumed, raises a
StreamConsumedError.
... | [
"async",
"def",
"read_frame",
"(",
"self",
",",
"stream_id",
":",
"int",
")",
"->",
"bytes",
":",
"stream",
"=",
"self",
".",
"_get_stream",
"(",
"stream_id",
")",
"frame",
"=",
"await",
"stream",
".",
"read_frame",
"(",
")",
"if",
"frame",
".",
"flow_... | Read a single frame of data from the specified stream, waiting until
frames are available if none are present in the local buffer. If the
stream is closed and all buffered frames have been consumed, raises a
StreamConsumedError. | [
"Read",
"a",
"single",
"frame",
"of",
"data",
"from",
"the",
"specified",
"stream",
"waiting",
"until",
"frames",
"are",
"available",
"if",
"none",
"are",
"present",
"in",
"the",
"local",
"buffer",
".",
"If",
"the",
"stream",
"is",
"closed",
"and",
"all",
... | a88f3df1ecbdfba45035b65f833b8ffffc49b399 | https://github.com/adamrothman/ftl/blob/a88f3df1ecbdfba45035b65f833b8ffffc49b399/ftl/connection.py#L323-L333 |
39,308 | adamrothman/ftl | ftl/connection.py | HTTP2ClientConnection.get_pushed_stream_ids | async def get_pushed_stream_ids(self, parent_stream_id: int) -> List[int]:
"""Return a list of all streams pushed by the remote peer that are
children of the specified stream. If no streams have been pushed when
this method is called, waits until at least one stream has been pushed.
"""
... | python | async def get_pushed_stream_ids(self, parent_stream_id: int) -> List[int]:
"""Return a list of all streams pushed by the remote peer that are
children of the specified stream. If no streams have been pushed when
this method is called, waits until at least one stream has been pushed.
"""
... | [
"async",
"def",
"get_pushed_stream_ids",
"(",
"self",
",",
"parent_stream_id",
":",
"int",
")",
"->",
"List",
"[",
"int",
"]",
":",
"if",
"parent_stream_id",
"not",
"in",
"self",
".",
"_streams",
":",
"logger",
".",
"error",
"(",
"f'Parent stream {parent_strea... | Return a list of all streams pushed by the remote peer that are
children of the specified stream. If no streams have been pushed when
this method is called, waits until at least one stream has been pushed. | [
"Return",
"a",
"list",
"of",
"all",
"streams",
"pushed",
"by",
"the",
"remote",
"peer",
"that",
"are",
"children",
"of",
"the",
"specified",
"stream",
".",
"If",
"no",
"streams",
"have",
"been",
"pushed",
"when",
"this",
"method",
"is",
"called",
"waits",
... | a88f3df1ecbdfba45035b65f833b8ffffc49b399 | https://github.com/adamrothman/ftl/blob/a88f3df1ecbdfba45035b65f833b8ffffc49b399/ftl/connection.py#L456-L477 |
39,309 | hollenstein/maspy | maspy/reader.py | convertMzml | def convertMzml(mzmlPath, outputDirectory=None):
"""Imports an mzml file and converts it to a MsrunContainer file
:param mzmlPath: path of the mzml file
:param outputDirectory: directory where the MsrunContainer file should be written
if it is not specified, the output directory is set to the mzml file... | python | def convertMzml(mzmlPath, outputDirectory=None):
"""Imports an mzml file and converts it to a MsrunContainer file
:param mzmlPath: path of the mzml file
:param outputDirectory: directory where the MsrunContainer file should be written
if it is not specified, the output directory is set to the mzml file... | [
"def",
"convertMzml",
"(",
"mzmlPath",
",",
"outputDirectory",
"=",
"None",
")",
":",
"outputDirectory",
"=",
"outputDirectory",
"if",
"outputDirectory",
"is",
"not",
"None",
"else",
"os",
".",
"path",
".",
"dirname",
"(",
"mzmlPath",
")",
"msrunContainer",
"=... | Imports an mzml file and converts it to a MsrunContainer file
:param mzmlPath: path of the mzml file
:param outputDirectory: directory where the MsrunContainer file should be written
if it is not specified, the output directory is set to the mzml files directory. | [
"Imports",
"an",
"mzml",
"file",
"and",
"converts",
"it",
"to",
"a",
"MsrunContainer",
"file"
] | f15fcfd24df306d8420540460d902aa3073ec133 | https://github.com/hollenstein/maspy/blob/f15fcfd24df306d8420540460d902aa3073ec133/maspy/reader.py#L265-L275 |
39,310 | hollenstein/maspy | maspy/reader.py | prepareSiiImport | def prepareSiiImport(siiContainer, specfile, path, qcAttr, qcLargerBetter,
qcCutoff, rankAttr, rankLargerBetter):
"""Prepares the ``siiContainer`` for the import of peptide spectrum matching
results. Adds entries to ``siiContainer.container`` and to
``siiContainer.info``.
:param si... | python | def prepareSiiImport(siiContainer, specfile, path, qcAttr, qcLargerBetter,
qcCutoff, rankAttr, rankLargerBetter):
"""Prepares the ``siiContainer`` for the import of peptide spectrum matching
results. Adds entries to ``siiContainer.container`` and to
``siiContainer.info``.
:param si... | [
"def",
"prepareSiiImport",
"(",
"siiContainer",
",",
"specfile",
",",
"path",
",",
"qcAttr",
",",
"qcLargerBetter",
",",
"qcCutoff",
",",
"rankAttr",
",",
"rankLargerBetter",
")",
":",
"if",
"specfile",
"not",
"in",
"siiContainer",
".",
"info",
":",
"siiContai... | Prepares the ``siiContainer`` for the import of peptide spectrum matching
results. Adds entries to ``siiContainer.container`` and to
``siiContainer.info``.
:param siiContainer: instance of :class:`maspy.core.SiiContainer`
:param specfile: unambiguous identifier of a ms-run file. Is also used as
... | [
"Prepares",
"the",
"siiContainer",
"for",
"the",
"import",
"of",
"peptide",
"spectrum",
"matching",
"results",
".",
"Adds",
"entries",
"to",
"siiContainer",
".",
"container",
"and",
"to",
"siiContainer",
".",
"info",
"."
] | f15fcfd24df306d8420540460d902aa3073ec133 | https://github.com/hollenstein/maspy/blob/f15fcfd24df306d8420540460d902aa3073ec133/maspy/reader.py#L281-L317 |
39,311 | hollenstein/maspy | maspy/reader.py | importPeptideFeatures | def importPeptideFeatures(fiContainer, filelocation, specfile):
""" Import peptide features from a featureXml file, as generated for example
by the OpenMS node featureFinderCentroided, or a features.tsv file by the
Dinosaur command line tool.
:param fiContainer: imported features are added to this inst... | python | def importPeptideFeatures(fiContainer, filelocation, specfile):
""" Import peptide features from a featureXml file, as generated for example
by the OpenMS node featureFinderCentroided, or a features.tsv file by the
Dinosaur command line tool.
:param fiContainer: imported features are added to this inst... | [
"def",
"importPeptideFeatures",
"(",
"fiContainer",
",",
"filelocation",
",",
"specfile",
")",
":",
"if",
"not",
"os",
".",
"path",
".",
"isfile",
"(",
"filelocation",
")",
":",
"warnings",
".",
"warn",
"(",
"'The specified file does not exist %s'",
"%",
"(",
... | Import peptide features from a featureXml file, as generated for example
by the OpenMS node featureFinderCentroided, or a features.tsv file by the
Dinosaur command line tool.
:param fiContainer: imported features are added to this instance of
:class:`FeatureContainer <maspy.core.FeatureContainer>`.... | [
"Import",
"peptide",
"features",
"from",
"a",
"featureXml",
"file",
"as",
"generated",
"for",
"example",
"by",
"the",
"OpenMS",
"node",
"featureFinderCentroided",
"or",
"a",
"features",
".",
"tsv",
"file",
"by",
"the",
"Dinosaur",
"command",
"line",
"tool",
".... | f15fcfd24df306d8420540460d902aa3073ec133 | https://github.com/hollenstein/maspy/blob/f15fcfd24df306d8420540460d902aa3073ec133/maspy/reader.py#L622-L701 |
39,312 | hollenstein/maspy | maspy/reader.py | _importDinosaurTsv | def _importDinosaurTsv(filelocation):
"""Reads a Dinosaur tsv file.
:returns: {featureKey1: {attribute1:value1, attribute2:value2, ...}, ...}
See also :func:`importPeptideFeatures`
"""
with io.open(filelocation, 'r', encoding='utf-8') as openFile:
#NOTE: this is pretty similar to importing... | python | def _importDinosaurTsv(filelocation):
"""Reads a Dinosaur tsv file.
:returns: {featureKey1: {attribute1:value1, attribute2:value2, ...}, ...}
See also :func:`importPeptideFeatures`
"""
with io.open(filelocation, 'r', encoding='utf-8') as openFile:
#NOTE: this is pretty similar to importing... | [
"def",
"_importDinosaurTsv",
"(",
"filelocation",
")",
":",
"with",
"io",
".",
"open",
"(",
"filelocation",
",",
"'r'",
",",
"encoding",
"=",
"'utf-8'",
")",
"as",
"openFile",
":",
"#NOTE: this is pretty similar to importing percolator results, maybe unify in a common fun... | Reads a Dinosaur tsv file.
:returns: {featureKey1: {attribute1:value1, attribute2:value2, ...}, ...}
See also :func:`importPeptideFeatures` | [
"Reads",
"a",
"Dinosaur",
"tsv",
"file",
"."
] | f15fcfd24df306d8420540460d902aa3073ec133 | https://github.com/hollenstein/maspy/blob/f15fcfd24df306d8420540460d902aa3073ec133/maspy/reader.py#L778-L802 |
39,313 | pauleveritt/kaybee | kaybee/utils/rst.py | rst_to_html | def rst_to_html(input_string: str) -> str:
""" Given a string of RST, use docutils to generate html """
overrides = dict(input_encoding='unicode', doctitle_xform=True,
initial_header_level=1)
parts = publish_parts(
writer_name='html',
source=input_string,
settin... | python | def rst_to_html(input_string: str) -> str:
""" Given a string of RST, use docutils to generate html """
overrides = dict(input_encoding='unicode', doctitle_xform=True,
initial_header_level=1)
parts = publish_parts(
writer_name='html',
source=input_string,
settin... | [
"def",
"rst_to_html",
"(",
"input_string",
":",
"str",
")",
"->",
"str",
":",
"overrides",
"=",
"dict",
"(",
"input_encoding",
"=",
"'unicode'",
",",
"doctitle_xform",
"=",
"True",
",",
"initial_header_level",
"=",
"1",
")",
"parts",
"=",
"publish_parts",
"(... | Given a string of RST, use docutils to generate html | [
"Given",
"a",
"string",
"of",
"RST",
"use",
"docutils",
"to",
"generate",
"html"
] | a00a718aaaa23b2d12db30dfacb6b2b6ec84459c | https://github.com/pauleveritt/kaybee/blob/a00a718aaaa23b2d12db30dfacb6b2b6ec84459c/kaybee/utils/rst.py#L23-L33 |
39,314 | pauleveritt/kaybee | kaybee/utils/rst.py | get_rst_title | def get_rst_title(rst_doc: Node) -> Optional[Any]:
""" Given some RST, extract what docutils thinks is the title """
for title in rst_doc.traverse(nodes.title):
return title.astext()
return None | python | def get_rst_title(rst_doc: Node) -> Optional[Any]:
""" Given some RST, extract what docutils thinks is the title """
for title in rst_doc.traverse(nodes.title):
return title.astext()
return None | [
"def",
"get_rst_title",
"(",
"rst_doc",
":",
"Node",
")",
"->",
"Optional",
"[",
"Any",
"]",
":",
"for",
"title",
"in",
"rst_doc",
".",
"traverse",
"(",
"nodes",
".",
"title",
")",
":",
"return",
"title",
".",
"astext",
"(",
")",
"return",
"None"
] | Given some RST, extract what docutils thinks is the title | [
"Given",
"some",
"RST",
"extract",
"what",
"docutils",
"thinks",
"is",
"the",
"title"
] | a00a718aaaa23b2d12db30dfacb6b2b6ec84459c | https://github.com/pauleveritt/kaybee/blob/a00a718aaaa23b2d12db30dfacb6b2b6ec84459c/kaybee/utils/rst.py#L36-L42 |
39,315 | pauleveritt/kaybee | kaybee/utils/rst.py | get_rst_excerpt | def get_rst_excerpt(rst_doc: document, paragraphs: int = 1) -> str:
""" Given rst, parse and return a portion """
texts = []
for count, p in enumerate(rst_doc.traverse(paragraph)):
texts.append(p.astext())
if count + 1 == paragraphs:
break
return ' '.join(texts) | python | def get_rst_excerpt(rst_doc: document, paragraphs: int = 1) -> str:
""" Given rst, parse and return a portion """
texts = []
for count, p in enumerate(rst_doc.traverse(paragraph)):
texts.append(p.astext())
if count + 1 == paragraphs:
break
return ' '.join(texts) | [
"def",
"get_rst_excerpt",
"(",
"rst_doc",
":",
"document",
",",
"paragraphs",
":",
"int",
"=",
"1",
")",
"->",
"str",
":",
"texts",
"=",
"[",
"]",
"for",
"count",
",",
"p",
"in",
"enumerate",
"(",
"rst_doc",
".",
"traverse",
"(",
"paragraph",
")",
")... | Given rst, parse and return a portion | [
"Given",
"rst",
"parse",
"and",
"return",
"a",
"portion"
] | a00a718aaaa23b2d12db30dfacb6b2b6ec84459c | https://github.com/pauleveritt/kaybee/blob/a00a718aaaa23b2d12db30dfacb6b2b6ec84459c/kaybee/utils/rst.py#L45-L53 |
39,316 | Hypex/hyppy | hyppy/hapi.py | requires_password_auth | def requires_password_auth(fn):
"""Decorator for HAPI methods that requires the instance to be authenticated with a password"""
def wrapper(self, *args, **kwargs):
self.auth_context = HAPI.auth_context_password
return fn(self, *args, **kwargs)
return wrapper | python | def requires_password_auth(fn):
"""Decorator for HAPI methods that requires the instance to be authenticated with a password"""
def wrapper(self, *args, **kwargs):
self.auth_context = HAPI.auth_context_password
return fn(self, *args, **kwargs)
return wrapper | [
"def",
"requires_password_auth",
"(",
"fn",
")",
":",
"def",
"wrapper",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"self",
".",
"auth_context",
"=",
"HAPI",
".",
"auth_context_password",
"return",
"fn",
"(",
"self",
",",
"*",
"ar... | Decorator for HAPI methods that requires the instance to be authenticated with a password | [
"Decorator",
"for",
"HAPI",
"methods",
"that",
"requires",
"the",
"instance",
"to",
"be",
"authenticated",
"with",
"a",
"password"
] | a425619c2a102b0e598fd6cac8aa0f6b766f542d | https://github.com/Hypex/hyppy/blob/a425619c2a102b0e598fd6cac8aa0f6b766f542d/hyppy/hapi.py#L9-L14 |
39,317 | Hypex/hyppy | hyppy/hapi.py | requires_api_auth | def requires_api_auth(fn):
"""Decorator for HAPI methods that requires the instance to be authenticated with a HAPI token"""
def wrapper(self, *args, **kwargs):
self.auth_context = HAPI.auth_context_hapi
return fn(self, *args, **kwargs)
return wrapper | python | def requires_api_auth(fn):
"""Decorator for HAPI methods that requires the instance to be authenticated with a HAPI token"""
def wrapper(self, *args, **kwargs):
self.auth_context = HAPI.auth_context_hapi
return fn(self, *args, **kwargs)
return wrapper | [
"def",
"requires_api_auth",
"(",
"fn",
")",
":",
"def",
"wrapper",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"self",
".",
"auth_context",
"=",
"HAPI",
".",
"auth_context_hapi",
"return",
"fn",
"(",
"self",
",",
"*",
"args",
",... | Decorator for HAPI methods that requires the instance to be authenticated with a HAPI token | [
"Decorator",
"for",
"HAPI",
"methods",
"that",
"requires",
"the",
"instance",
"to",
"be",
"authenticated",
"with",
"a",
"HAPI",
"token"
] | a425619c2a102b0e598fd6cac8aa0f6b766f542d | https://github.com/Hypex/hyppy/blob/a425619c2a102b0e598fd6cac8aa0f6b766f542d/hyppy/hapi.py#L17-L22 |
39,318 | Hypex/hyppy | hyppy/hapi.py | HAPIResponse.parse | def parse(response):
"""Parse a postdata-style response format from the API into usable data"""
"""Split a a=1b=2c=3 string into a dictionary of pairs"""
tokens = {r[0]: r[1] for r in [r.split('=') for r in response.split("&")]}
# The odd dummy parameter is of no use to us
if '... | python | def parse(response):
"""Parse a postdata-style response format from the API into usable data"""
"""Split a a=1b=2c=3 string into a dictionary of pairs"""
tokens = {r[0]: r[1] for r in [r.split('=') for r in response.split("&")]}
# The odd dummy parameter is of no use to us
if '... | [
"def",
"parse",
"(",
"response",
")",
":",
"\"\"\"Split a a=1b=2c=3 string into a dictionary of pairs\"\"\"",
"tokens",
"=",
"{",
"r",
"[",
"0",
"]",
":",
"r",
"[",
"1",
"]",
"for",
"r",
"in",
"[",
"r",
".",
"split",
"(",
"'='",
")",
"for",
"r",
"in",
... | Parse a postdata-style response format from the API into usable data | [
"Parse",
"a",
"postdata",
"-",
"style",
"response",
"format",
"from",
"the",
"API",
"into",
"usable",
"data"
] | a425619c2a102b0e598fd6cac8aa0f6b766f542d | https://github.com/Hypex/hyppy/blob/a425619c2a102b0e598fd6cac8aa0f6b766f542d/hyppy/hapi.py#L204-L234 |
39,319 | diamondman/proteusisc | proteusisc/jtagScanChain.py | JTAGScanChain.init_chain | def init_chain(self):
"""Autodetect the devices attached to the Controller, and initialize a JTAGDevice for each.
This is a required call before device specific Primitives can
be used.
"""
if not self._hasinit:
self._hasinit = True
self._devices = []
... | python | def init_chain(self):
"""Autodetect the devices attached to the Controller, and initialize a JTAGDevice for each.
This is a required call before device specific Primitives can
be used.
"""
if not self._hasinit:
self._hasinit = True
self._devices = []
... | [
"def",
"init_chain",
"(",
"self",
")",
":",
"if",
"not",
"self",
".",
"_hasinit",
":",
"self",
".",
"_hasinit",
"=",
"True",
"self",
".",
"_devices",
"=",
"[",
"]",
"self",
".",
"jtag_enable",
"(",
")",
"while",
"True",
":",
"# pylint: disable=no-member"... | Autodetect the devices attached to the Controller, and initialize a JTAGDevice for each.
This is a required call before device specific Primitives can
be used. | [
"Autodetect",
"the",
"devices",
"attached",
"to",
"the",
"Controller",
"and",
"initialize",
"a",
"JTAGDevice",
"for",
"each",
"."
] | 7622b7b04e63f9dc0f5a04429ff78d9a490c9c5c | https://github.com/diamondman/proteusisc/blob/7622b7b04e63f9dc0f5a04429ff78d9a490c9c5c/proteusisc/jtagScanChain.py#L162-L191 |
39,320 | davgeo/clear | clear/clear.py | ClearManager._UserUpdateConfigValue | def _UserUpdateConfigValue(self, configKey, strDescriptor, isDir = True, dbConfigValue = None):
"""
Allow user to set or update config values in the database table.
This is always called if no valid entry exists in the table already.
Parameters
----------
configKey : string
Name of co... | python | def _UserUpdateConfigValue(self, configKey, strDescriptor, isDir = True, dbConfigValue = None):
"""
Allow user to set or update config values in the database table.
This is always called if no valid entry exists in the table already.
Parameters
----------
configKey : string
Name of co... | [
"def",
"_UserUpdateConfigValue",
"(",
"self",
",",
"configKey",
",",
"strDescriptor",
",",
"isDir",
"=",
"True",
",",
"dbConfigValue",
"=",
"None",
")",
":",
"newConfigValue",
"=",
"None",
"if",
"dbConfigValue",
"is",
"None",
":",
"prompt",
"=",
"\"Enter new {... | Allow user to set or update config values in the database table.
This is always called if no valid entry exists in the table already.
Parameters
----------
configKey : string
Name of config field.
strDescriptor : string
Description of config field.
isDir : boolean [optio... | [
"Allow",
"user",
"to",
"set",
"or",
"update",
"config",
"values",
"in",
"the",
"database",
"table",
".",
"This",
"is",
"always",
"called",
"if",
"no",
"valid",
"entry",
"exists",
"in",
"the",
"table",
"already",
"."
] | 5ec85d27efd28afddfcd4c3f44df17f0115a77aa | https://github.com/davgeo/clear/blob/5ec85d27efd28afddfcd4c3f44df17f0115a77aa/clear/clear.py#L122-L172 |
39,321 | davgeo/clear | clear/clear.py | ClearManager._GetConfigValue | def _GetConfigValue(self, configKey, strDescriptor, isDir = True):
"""
Get configuration value from database table. If no value found user
will be prompted to enter one.
Parameters
----------
configKey : string
Name of config field.
strDescriptor : string
Description of... | python | def _GetConfigValue(self, configKey, strDescriptor, isDir = True):
"""
Get configuration value from database table. If no value found user
will be prompted to enter one.
Parameters
----------
configKey : string
Name of config field.
strDescriptor : string
Description of... | [
"def",
"_GetConfigValue",
"(",
"self",
",",
"configKey",
",",
"strDescriptor",
",",
"isDir",
"=",
"True",
")",
":",
"goodlogging",
".",
"Log",
".",
"Info",
"(",
"\"CLEAR\"",
",",
"\"Loading {0} from database:\"",
".",
"format",
"(",
"strDescriptor",
")",
")",
... | Get configuration value from database table. If no value found user
will be prompted to enter one.
Parameters
----------
configKey : string
Name of config field.
strDescriptor : string
Description of config field.
isDir : boolean [optional : default = True]
Set t... | [
"Get",
"configuration",
"value",
"from",
"database",
"table",
".",
"If",
"no",
"value",
"found",
"user",
"will",
"be",
"prompted",
"to",
"enter",
"one",
"."
] | 5ec85d27efd28afddfcd4c3f44df17f0115a77aa | https://github.com/davgeo/clear/blob/5ec85d27efd28afddfcd4c3f44df17f0115a77aa/clear/clear.py#L177-L216 |
39,322 | davgeo/clear | clear/clear.py | ClearManager._UserUpdateSupportedFormats | def _UserUpdateSupportedFormats(self, origFormatList = []):
"""
Add supported formats to database table. Always called if the
database table is empty.
User can build a list of entries to add to the database table
(one entry at a time). Once finished they select the finish option
and all entries... | python | def _UserUpdateSupportedFormats(self, origFormatList = []):
"""
Add supported formats to database table. Always called if the
database table is empty.
User can build a list of entries to add to the database table
(one entry at a time). Once finished they select the finish option
and all entries... | [
"def",
"_UserUpdateSupportedFormats",
"(",
"self",
",",
"origFormatList",
"=",
"[",
"]",
")",
":",
"formatList",
"=",
"list",
"(",
"origFormatList",
")",
"inputDone",
"=",
"None",
"while",
"inputDone",
"is",
"None",
":",
"prompt",
"=",
"\"Enter new format (e.g. ... | Add supported formats to database table. Always called if the
database table is empty.
User can build a list of entries to add to the database table
(one entry at a time). Once finished they select the finish option
and all entries will be added to the table. They can reset the
list at any time bef... | [
"Add",
"supported",
"formats",
"to",
"database",
"table",
".",
"Always",
"called",
"if",
"the",
"database",
"table",
"is",
"empty",
"."
] | 5ec85d27efd28afddfcd4c3f44df17f0115a77aa | https://github.com/davgeo/clear/blob/5ec85d27efd28afddfcd4c3f44df17f0115a77aa/clear/clear.py#L221-L271 |
39,323 | davgeo/clear | clear/clear.py | ClearManager._GetSupportedFormats | def _GetSupportedFormats(self):
"""
Get supported format values from database table. If no values found user
will be prompted to enter values for this table.
Returns
----------
string
List of supported formats from database table.
"""
goodlogging.Log.Info("CLEAR", "Loading sup... | python | def _GetSupportedFormats(self):
"""
Get supported format values from database table. If no values found user
will be prompted to enter values for this table.
Returns
----------
string
List of supported formats from database table.
"""
goodlogging.Log.Info("CLEAR", "Loading sup... | [
"def",
"_GetSupportedFormats",
"(",
"self",
")",
":",
"goodlogging",
".",
"Log",
".",
"Info",
"(",
"\"CLEAR\"",
",",
"\"Loading supported formats from database:\"",
")",
"goodlogging",
".",
"Log",
".",
"IncreaseIndent",
"(",
")",
"formatList",
"=",
"self",
".",
... | Get supported format values from database table. If no values found user
will be prompted to enter values for this table.
Returns
----------
string
List of supported formats from database table. | [
"Get",
"supported",
"format",
"values",
"from",
"database",
"table",
".",
"If",
"no",
"values",
"found",
"user",
"will",
"be",
"prompted",
"to",
"enter",
"values",
"for",
"this",
"table",
"."
] | 5ec85d27efd28afddfcd4c3f44df17f0115a77aa | https://github.com/davgeo/clear/blob/5ec85d27efd28afddfcd4c3f44df17f0115a77aa/clear/clear.py#L276-L298 |
39,324 | davgeo/clear | clear/clear.py | ClearManager._UserUpdateIgnoredDirs | def _UserUpdateIgnoredDirs(self, origIgnoredDirs = []):
"""
Add ignored directories to database table. Always called if the
database table is empty.
User can build a list of entries to add to the database table
(one entry at a time). Once finished they select the finish option
and all entries w... | python | def _UserUpdateIgnoredDirs(self, origIgnoredDirs = []):
"""
Add ignored directories to database table. Always called if the
database table is empty.
User can build a list of entries to add to the database table
(one entry at a time). Once finished they select the finish option
and all entries w... | [
"def",
"_UserUpdateIgnoredDirs",
"(",
"self",
",",
"origIgnoredDirs",
"=",
"[",
"]",
")",
":",
"ignoredDirs",
"=",
"list",
"(",
"origIgnoredDirs",
")",
"inputDone",
"=",
"None",
"while",
"inputDone",
"is",
"None",
":",
"prompt",
"=",
"\"Enter new directory to ig... | Add ignored directories to database table. Always called if the
database table is empty.
User can build a list of entries to add to the database table
(one entry at a time). Once finished they select the finish option
and all entries will be added to the table. They can reset the
list at any time b... | [
"Add",
"ignored",
"directories",
"to",
"database",
"table",
".",
"Always",
"called",
"if",
"the",
"database",
"table",
"is",
"empty",
"."
] | 5ec85d27efd28afddfcd4c3f44df17f0115a77aa | https://github.com/davgeo/clear/blob/5ec85d27efd28afddfcd4c3f44df17f0115a77aa/clear/clear.py#L303-L351 |
39,325 | davgeo/clear | clear/clear.py | ClearManager._GetIgnoredDirs | def _GetIgnoredDirs(self):
"""
Get ignored directories values from database table. If no values found user
will be prompted to enter values for this table.
Returns
----------
string
List of ignored directories from database table.
"""
goodlogging.Log.Info("CLEAR", "Loading ign... | python | def _GetIgnoredDirs(self):
"""
Get ignored directories values from database table. If no values found user
will be prompted to enter values for this table.
Returns
----------
string
List of ignored directories from database table.
"""
goodlogging.Log.Info("CLEAR", "Loading ign... | [
"def",
"_GetIgnoredDirs",
"(",
"self",
")",
":",
"goodlogging",
".",
"Log",
".",
"Info",
"(",
"\"CLEAR\"",
",",
"\"Loading ignored directories from database:\"",
")",
"goodlogging",
".",
"Log",
".",
"IncreaseIndent",
"(",
")",
"ignoredDirs",
"=",
"self",
".",
"_... | Get ignored directories values from database table. If no values found user
will be prompted to enter values for this table.
Returns
----------
string
List of ignored directories from database table. | [
"Get",
"ignored",
"directories",
"values",
"from",
"database",
"table",
".",
"If",
"no",
"values",
"found",
"user",
"will",
"be",
"prompted",
"to",
"enter",
"values",
"for",
"this",
"table",
"."
] | 5ec85d27efd28afddfcd4c3f44df17f0115a77aa | https://github.com/davgeo/clear/blob/5ec85d27efd28afddfcd4c3f44df17f0115a77aa/clear/clear.py#L356-L381 |
39,326 | davgeo/clear | clear/clear.py | ClearManager._GetDatabaseConfig | def _GetDatabaseConfig(self):
"""
Get all configuration from database.
This includes values from the Config table as well as populating lists
for supported formats and ignored directories from their respective
database tables.
"""
goodlogging.Log.Seperator()
goodlogging.Log.Info("CLEAR"... | python | def _GetDatabaseConfig(self):
"""
Get all configuration from database.
This includes values from the Config table as well as populating lists
for supported formats and ignored directories from their respective
database tables.
"""
goodlogging.Log.Seperator()
goodlogging.Log.Info("CLEAR"... | [
"def",
"_GetDatabaseConfig",
"(",
"self",
")",
":",
"goodlogging",
".",
"Log",
".",
"Seperator",
"(",
")",
"goodlogging",
".",
"Log",
".",
"Info",
"(",
"\"CLEAR\"",
",",
"\"Getting configuration variables...\"",
")",
"goodlogging",
".",
"Log",
".",
"IncreaseInde... | Get all configuration from database.
This includes values from the Config table as well as populating lists
for supported formats and ignored directories from their respective
database tables. | [
"Get",
"all",
"configuration",
"from",
"database",
"."
] | 5ec85d27efd28afddfcd4c3f44df17f0115a77aa | https://github.com/davgeo/clear/blob/5ec85d27efd28afddfcd4c3f44df17f0115a77aa/clear/clear.py#L386-L422 |
39,327 | davgeo/clear | clear/clear.py | ClearManager._GetSupportedFilesInDir | def _GetSupportedFilesInDir(self, fileDir, fileList, supportedFormatList, ignoreDirList):
"""
Recursively get all supported files given a root search directory.
Supported file extensions are given as a list, as are any directories which
should be ignored.
The result will be appended to the given f... | python | def _GetSupportedFilesInDir(self, fileDir, fileList, supportedFormatList, ignoreDirList):
"""
Recursively get all supported files given a root search directory.
Supported file extensions are given as a list, as are any directories which
should be ignored.
The result will be appended to the given f... | [
"def",
"_GetSupportedFilesInDir",
"(",
"self",
",",
"fileDir",
",",
"fileList",
",",
"supportedFormatList",
",",
"ignoreDirList",
")",
":",
"goodlogging",
".",
"Log",
".",
"Info",
"(",
"\"CLEAR\"",
",",
"\"Parsing file directory: {0}\"",
".",
"format",
"(",
"fileD... | Recursively get all supported files given a root search directory.
Supported file extensions are given as a list, as are any directories which
should be ignored.
The result will be appended to the given file list argument.
Parameters
----------
fileDir : string
Path to root of direc... | [
"Recursively",
"get",
"all",
"supported",
"files",
"given",
"a",
"root",
"search",
"directory",
"."
] | 5ec85d27efd28afddfcd4c3f44df17f0115a77aa | https://github.com/davgeo/clear/blob/5ec85d27efd28afddfcd4c3f44df17f0115a77aa/clear/clear.py#L507-L545 |
39,328 | davgeo/clear | clear/clear.py | ClearManager.Run | def Run(self):
"""
Main entry point for ClearManager class.
Does the following steps:
- Parse script arguments.
- Optionally print or update database tables.
- Get all configuration settings from database.
- Optionally parse directory for file extraction.
- Recursively parse source dir... | python | def Run(self):
"""
Main entry point for ClearManager class.
Does the following steps:
- Parse script arguments.
- Optionally print or update database tables.
- Get all configuration settings from database.
- Optionally parse directory for file extraction.
- Recursively parse source dir... | [
"def",
"Run",
"(",
"self",
")",
":",
"self",
".",
"_GetArgs",
"(",
")",
"goodlogging",
".",
"Log",
".",
"Info",
"(",
"\"CLEAR\"",
",",
"\"Using database: {0}\"",
".",
"format",
"(",
"self",
".",
"_databasePath",
")",
")",
"self",
".",
"_db",
"=",
"data... | Main entry point for ClearManager class.
Does the following steps:
- Parse script arguments.
- Optionally print or update database tables.
- Get all configuration settings from database.
- Optionally parse directory for file extraction.
- Recursively parse source directory for files matching
... | [
"Main",
"entry",
"point",
"for",
"ClearManager",
"class",
"."
] | 5ec85d27efd28afddfcd4c3f44df17f0115a77aa | https://github.com/davgeo/clear/blob/5ec85d27efd28afddfcd4c3f44df17f0115a77aa/clear/clear.py#L550-L607 |
39,329 | diamondman/proteusisc | proteusisc/command_queue.py | CommandQueue.flush | def flush(self):
"""Force the queue of Primitives to compile, execute on the Controller, and fulfill promises with the data returned."""
self.stages = []
self.stagenames = []
if not self.queue:
return
if self.print_statistics:#pragma: no cover
print("LEN... | python | def flush(self):
"""Force the queue of Primitives to compile, execute on the Controller, and fulfill promises with the data returned."""
self.stages = []
self.stagenames = []
if not self.queue:
return
if self.print_statistics:#pragma: no cover
print("LEN... | [
"def",
"flush",
"(",
"self",
")",
":",
"self",
".",
"stages",
"=",
"[",
"]",
"self",
".",
"stagenames",
"=",
"[",
"]",
"if",
"not",
"self",
".",
"queue",
":",
"return",
"if",
"self",
".",
"print_statistics",
":",
"#pragma: no cover",
"print",
"(",
"\... | Force the queue of Primitives to compile, execute on the Controller, and fulfill promises with the data returned. | [
"Force",
"the",
"queue",
"of",
"Primitives",
"to",
"compile",
"execute",
"on",
"the",
"Controller",
"and",
"fulfill",
"promises",
"with",
"the",
"data",
"returned",
"."
] | 7622b7b04e63f9dc0f5a04429ff78d9a490c9c5c | https://github.com/diamondman/proteusisc/blob/7622b7b04e63f9dc0f5a04429ff78d9a490c9c5c/proteusisc/command_queue.py#L356-L389 |
39,330 | rosshamish/catanlog | spec/steps/thens.py | step_impl | def step_impl(context):
"""Compares text as written to the log output"""
expected_lines = context.text.split('\n')
assert len(expected_lines) == len(context.output)
for expected, actual in zip(expected_lines, context.output):
print('--\n\texpected: {}\n\tactual: {}'.format(expected, actual))
... | python | def step_impl(context):
"""Compares text as written to the log output"""
expected_lines = context.text.split('\n')
assert len(expected_lines) == len(context.output)
for expected, actual in zip(expected_lines, context.output):
print('--\n\texpected: {}\n\tactual: {}'.format(expected, actual))
... | [
"def",
"step_impl",
"(",
"context",
")",
":",
"expected_lines",
"=",
"context",
".",
"text",
".",
"split",
"(",
"'\\n'",
")",
"assert",
"len",
"(",
"expected_lines",
")",
"==",
"len",
"(",
"context",
".",
"output",
")",
"for",
"expected",
",",
"actual",
... | Compares text as written to the log output | [
"Compares",
"text",
"as",
"written",
"to",
"the",
"log",
"output"
] | 6f204920d9b67fd53fc6ff6a1c7b6a756b009bf0 | https://github.com/rosshamish/catanlog/blob/6f204920d9b67fd53fc6ff6a1c7b6a756b009bf0/spec/steps/thens.py#L13-L19 |
39,331 | davgeo/clear | clear/epguides.py | EPGuidesLookup._ParseShowList | def _ParseShowList(self, checkOnly=False):
"""
Read self._allShowList as csv file and make list of titles and IDs.
Parameters
----------
checkOnly : boolean [optional : default = False]
If checkOnly is True this will only check to ensure the column
headers can be extracted cor... | python | def _ParseShowList(self, checkOnly=False):
"""
Read self._allShowList as csv file and make list of titles and IDs.
Parameters
----------
checkOnly : boolean [optional : default = False]
If checkOnly is True this will only check to ensure the column
headers can be extracted cor... | [
"def",
"_ParseShowList",
"(",
"self",
",",
"checkOnly",
"=",
"False",
")",
":",
"showTitleList",
"=",
"[",
"]",
"showIDList",
"=",
"[",
"]",
"csvReader",
"=",
"csv",
".",
"reader",
"(",
"self",
".",
"_allShowList",
".",
"splitlines",
"(",
")",
")",
"fo... | Read self._allShowList as csv file and make list of titles and IDs.
Parameters
----------
checkOnly : boolean [optional : default = False]
If checkOnly is True this will only check to ensure the column
headers can be extracted correctly. | [
"Read",
"self",
".",
"_allShowList",
"as",
"csv",
"file",
"and",
"make",
"list",
"of",
"titles",
"and",
"IDs",
"."
] | 5ec85d27efd28afddfcd4c3f44df17f0115a77aa | https://github.com/davgeo/clear/blob/5ec85d27efd28afddfcd4c3f44df17f0115a77aa/clear/epguides.py#L86-L119 |
39,332 | davgeo/clear | clear/epguides.py | EPGuidesLookup._GetAllShowList | def _GetAllShowList(self):
"""
Populates self._allShowList with the epguides all show info.
On the first lookup for a day the information will be loaded from
the epguides url. This will be saved to local file _epguides_YYYYMMDD.csv
and any old files will be removed. Subsequent accesses for the same... | python | def _GetAllShowList(self):
"""
Populates self._allShowList with the epguides all show info.
On the first lookup for a day the information will be loaded from
the epguides url. This will be saved to local file _epguides_YYYYMMDD.csv
and any old files will be removed. Subsequent accesses for the same... | [
"def",
"_GetAllShowList",
"(",
"self",
")",
":",
"today",
"=",
"datetime",
".",
"date",
".",
"today",
"(",
")",
".",
"strftime",
"(",
"\"%Y%m%d\"",
")",
"saveFile",
"=",
"'_epguides_'",
"+",
"today",
"+",
"'.csv'",
"saveFilePath",
"=",
"os",
".",
"path",... | Populates self._allShowList with the epguides all show info.
On the first lookup for a day the information will be loaded from
the epguides url. This will be saved to local file _epguides_YYYYMMDD.csv
and any old files will be removed. Subsequent accesses for the same day
will read this file. | [
"Populates",
"self",
".",
"_allShowList",
"with",
"the",
"epguides",
"all",
"show",
"info",
"."
] | 5ec85d27efd28afddfcd4c3f44df17f0115a77aa | https://github.com/davgeo/clear/blob/5ec85d27efd28afddfcd4c3f44df17f0115a77aa/clear/epguides.py#L124-L156 |
39,333 | davgeo/clear | clear/epguides.py | EPGuidesLookup._GetShowID | def _GetShowID(self, showName):
"""
Get epguides show id for a given show name.
Attempts to match the given show name against a show title in
self._showTitleList and, if found, returns the corresponding index
in self._showIDList.
Parameters
----------
showName : string
Show n... | python | def _GetShowID(self, showName):
"""
Get epguides show id for a given show name.
Attempts to match the given show name against a show title in
self._showTitleList and, if found, returns the corresponding index
in self._showIDList.
Parameters
----------
showName : string
Show n... | [
"def",
"_GetShowID",
"(",
"self",
",",
"showName",
")",
":",
"self",
".",
"_GetTitleList",
"(",
")",
"self",
".",
"_GetIDList",
"(",
")",
"for",
"index",
",",
"showTitle",
"in",
"enumerate",
"(",
"self",
".",
"_showTitleList",
")",
":",
"if",
"showName",... | Get epguides show id for a given show name.
Attempts to match the given show name against a show title in
self._showTitleList and, if found, returns the corresponding index
in self._showIDList.
Parameters
----------
showName : string
Show name to get show ID for.
Returns
---... | [
"Get",
"epguides",
"show",
"id",
"for",
"a",
"given",
"show",
"name",
"."
] | 5ec85d27efd28afddfcd4c3f44df17f0115a77aa | https://github.com/davgeo/clear/blob/5ec85d27efd28afddfcd4c3f44df17f0115a77aa/clear/epguides.py#L187-L211 |
39,334 | davgeo/clear | clear/epguides.py | EPGuidesLookup._ExtractDataFromShowHtml | def _ExtractDataFromShowHtml(self, html):
"""
Extracts csv show data from epguides html source.
Parameters
----------
html : string
Block of html text
Returns
----------
string
Show data extracted from html text in csv format.
"""
htmlLines = html.splitline... | python | def _ExtractDataFromShowHtml(self, html):
"""
Extracts csv show data from epguides html source.
Parameters
----------
html : string
Block of html text
Returns
----------
string
Show data extracted from html text in csv format.
"""
htmlLines = html.splitline... | [
"def",
"_ExtractDataFromShowHtml",
"(",
"self",
",",
"html",
")",
":",
"htmlLines",
"=",
"html",
".",
"splitlines",
"(",
")",
"for",
"count",
",",
"line",
"in",
"enumerate",
"(",
"htmlLines",
")",
":",
"if",
"line",
".",
"strip",
"(",
")",
"==",
"r'<pr... | Extracts csv show data from epguides html source.
Parameters
----------
html : string
Block of html text
Returns
----------
string
Show data extracted from html text in csv format. | [
"Extracts",
"csv",
"show",
"data",
"from",
"epguides",
"html",
"source",
"."
] | 5ec85d27efd28afddfcd4c3f44df17f0115a77aa | https://github.com/davgeo/clear/blob/5ec85d27efd28afddfcd4c3f44df17f0115a77aa/clear/epguides.py#L219-L245 |
39,335 | davgeo/clear | clear/epguides.py | EPGuidesLookup._GetEpisodeName | def _GetEpisodeName(self, showID, season, episode):
"""
Get episode name from epguides show info.
Parameters
----------
showID : string
Identifier matching show in epguides.
season : int
Season number.
epiosde : int
Epiosde number.
Returns
----------... | python | def _GetEpisodeName(self, showID, season, episode):
"""
Get episode name from epguides show info.
Parameters
----------
showID : string
Identifier matching show in epguides.
season : int
Season number.
epiosde : int
Epiosde number.
Returns
----------... | [
"def",
"_GetEpisodeName",
"(",
"self",
",",
"showID",
",",
"season",
",",
"episode",
")",
":",
"# Load data for showID from dictionary",
"showInfo",
"=",
"csv",
".",
"reader",
"(",
"self",
".",
"_showInfoDict",
"[",
"showID",
"]",
".",
"splitlines",
"(",
")",
... | Get episode name from epguides show info.
Parameters
----------
showID : string
Identifier matching show in epguides.
season : int
Season number.
epiosde : int
Epiosde number.
Returns
----------
int or None
If an episode name is found this is r... | [
"Get",
"episode",
"name",
"from",
"epguides",
"show",
"info",
"."
] | 5ec85d27efd28afddfcd4c3f44df17f0115a77aa | https://github.com/davgeo/clear/blob/5ec85d27efd28afddfcd4c3f44df17f0115a77aa/clear/epguides.py#L250-L295 |
39,336 | davgeo/clear | clear/epguides.py | EPGuidesLookup.ShowNameLookUp | def ShowNameLookUp(self, string):
"""
Attempts to find the best match for the given string in the list of
epguides show titles. If this list has not previous been generated it
will be generated first.
Parameters
----------
string : string
String to find show name match against.
... | python | def ShowNameLookUp(self, string):
"""
Attempts to find the best match for the given string in the list of
epguides show titles. If this list has not previous been generated it
will be generated first.
Parameters
----------
string : string
String to find show name match against.
... | [
"def",
"ShowNameLookUp",
"(",
"self",
",",
"string",
")",
":",
"goodlogging",
".",
"Log",
".",
"Info",
"(",
"\"EPGUIDES\"",
",",
"\"Looking up show name match for string '{0}' in guide\"",
".",
"format",
"(",
"string",
")",
",",
"verbosity",
"=",
"self",
".",
"l... | Attempts to find the best match for the given string in the list of
epguides show titles. If this list has not previous been generated it
will be generated first.
Parameters
----------
string : string
String to find show name match against.
Returns
----------
string
... | [
"Attempts",
"to",
"find",
"the",
"best",
"match",
"for",
"the",
"given",
"string",
"in",
"the",
"list",
"of",
"epguides",
"show",
"titles",
".",
"If",
"this",
"list",
"has",
"not",
"previous",
"been",
"generated",
"it",
"will",
"be",
"generated",
"first",
... | 5ec85d27efd28afddfcd4c3f44df17f0115a77aa | https://github.com/davgeo/clear/blob/5ec85d27efd28afddfcd4c3f44df17f0115a77aa/clear/epguides.py#L301-L320 |
39,337 | davgeo/clear | clear/epguides.py | EPGuidesLookup.EpisodeNameLookUp | def EpisodeNameLookUp(self, showName, season, episode):
"""
Get the episode name correspondng to the given show name, season number
and episode number.
Parameters
----------
showName : string
Name of TV show. This must match an entry in the epguides
title list (this can be ach... | python | def EpisodeNameLookUp(self, showName, season, episode):
"""
Get the episode name correspondng to the given show name, season number
and episode number.
Parameters
----------
showName : string
Name of TV show. This must match an entry in the epguides
title list (this can be ach... | [
"def",
"EpisodeNameLookUp",
"(",
"self",
",",
"showName",
",",
"season",
",",
"episode",
")",
":",
"goodlogging",
".",
"Log",
".",
"Info",
"(",
"\"EPGUIDE\"",
",",
"\"Looking up episode name for {0} S{1}E{2}\"",
".",
"format",
"(",
"showName",
",",
"season",
","... | Get the episode name correspondng to the given show name, season number
and episode number.
Parameters
----------
showName : string
Name of TV show. This must match an entry in the epguides
title list (this can be achieved by calling ShowNameLookUp first).
season : int
... | [
"Get",
"the",
"episode",
"name",
"correspondng",
"to",
"the",
"given",
"show",
"name",
"season",
"number",
"and",
"episode",
"number",
"."
] | 5ec85d27efd28afddfcd4c3f44df17f0115a77aa | https://github.com/davgeo/clear/blob/5ec85d27efd28afddfcd4c3f44df17f0115a77aa/clear/epguides.py#L325-L364 |
39,338 | ScottDuckworth/python-anyvcs | anyvcs/hg.py | HgRepo.private_path | def private_path(self):
"""Get the path to a directory which can be used to store arbitrary data
This directory should not conflict with any of the repository internals.
The directory should be created if it does not already exist.
"""
path = os.path.join(self.path, '.hg', '.pr... | python | def private_path(self):
"""Get the path to a directory which can be used to store arbitrary data
This directory should not conflict with any of the repository internals.
The directory should be created if it does not already exist.
"""
path = os.path.join(self.path, '.hg', '.pr... | [
"def",
"private_path",
"(",
"self",
")",
":",
"path",
"=",
"os",
".",
"path",
".",
"join",
"(",
"self",
".",
"path",
",",
"'.hg'",
",",
"'.private'",
")",
"try",
":",
"os",
".",
"mkdir",
"(",
"path",
")",
"except",
"OSError",
"as",
"e",
":",
"if"... | Get the path to a directory which can be used to store arbitrary data
This directory should not conflict with any of the repository internals.
The directory should be created if it does not already exist. | [
"Get",
"the",
"path",
"to",
"a",
"directory",
"which",
"can",
"be",
"used",
"to",
"store",
"arbitrary",
"data"
] | 9eb09defbc6b7c99d373fad53cbf8fc81b637923 | https://github.com/ScottDuckworth/python-anyvcs/blob/9eb09defbc6b7c99d373fad53cbf8fc81b637923/anyvcs/hg.py#L86-L99 |
39,339 | ScottDuckworth/python-anyvcs | anyvcs/hg.py | HgRepo.bookmarks | def bookmarks(self):
"""Get list of bookmarks"""
cmd = [HG, 'bookmarks']
output = self._command(cmd).decode(self.encoding, 'replace')
if output.startswith('no bookmarks set'):
return []
results = []
for line in output.splitlines():
m = bookmarks_rx... | python | def bookmarks(self):
"""Get list of bookmarks"""
cmd = [HG, 'bookmarks']
output = self._command(cmd).decode(self.encoding, 'replace')
if output.startswith('no bookmarks set'):
return []
results = []
for line in output.splitlines():
m = bookmarks_rx... | [
"def",
"bookmarks",
"(",
"self",
")",
":",
"cmd",
"=",
"[",
"HG",
",",
"'bookmarks'",
"]",
"output",
"=",
"self",
".",
"_command",
"(",
"cmd",
")",
".",
"decode",
"(",
"self",
".",
"encoding",
",",
"'replace'",
")",
"if",
"output",
".",
"startswith",... | Get list of bookmarks | [
"Get",
"list",
"of",
"bookmarks"
] | 9eb09defbc6b7c99d373fad53cbf8fc81b637923 | https://github.com/ScottDuckworth/python-anyvcs/blob/9eb09defbc6b7c99d373fad53cbf8fc81b637923/anyvcs/hg.py#L330-L341 |
39,340 | kevinconway/confpy | confpy/loaders/base.py | ConfigurationFile.content | def content(self):
"""Get the file contents.
This property is cached. The file is only read once.
"""
if not self._content:
self._content = self._read()
return self._content | python | def content(self):
"""Get the file contents.
This property is cached. The file is only read once.
"""
if not self._content:
self._content = self._read()
return self._content | [
"def",
"content",
"(",
"self",
")",
":",
"if",
"not",
"self",
".",
"_content",
":",
"self",
".",
"_content",
"=",
"self",
".",
"_read",
"(",
")",
"return",
"self",
".",
"_content"
] | Get the file contents.
This property is cached. The file is only read once. | [
"Get",
"the",
"file",
"contents",
"."
] | 1ee8afcab46ac6915a5ff4184180434ac7b84a60 | https://github.com/kevinconway/confpy/blob/1ee8afcab46ac6915a5ff4184180434ac7b84a60/confpy/loaders/base.py#L35-L44 |
39,341 | kevinconway/confpy | confpy/loaders/base.py | ConfigurationFile.config | def config(self):
"""Get a Configuration object from the file contents."""
conf = config.Configuration()
for namespace in self.namespaces:
if not hasattr(conf, namespace):
if not self._strict:
continue
raise exc.NamespaceNotRegi... | python | def config(self):
"""Get a Configuration object from the file contents."""
conf = config.Configuration()
for namespace in self.namespaces:
if not hasattr(conf, namespace):
if not self._strict:
continue
raise exc.NamespaceNotRegi... | [
"def",
"config",
"(",
"self",
")",
":",
"conf",
"=",
"config",
".",
"Configuration",
"(",
")",
"for",
"namespace",
"in",
"self",
".",
"namespaces",
":",
"if",
"not",
"hasattr",
"(",
"conf",
",",
"namespace",
")",
":",
"if",
"not",
"self",
".",
"_stri... | Get a Configuration object from the file contents. | [
"Get",
"a",
"Configuration",
"object",
"from",
"the",
"file",
"contents",
"."
] | 1ee8afcab46ac6915a5ff4184180434ac7b84a60 | https://github.com/kevinconway/confpy/blob/1ee8afcab46ac6915a5ff4184180434ac7b84a60/confpy/loaders/base.py#L47-L78 |
39,342 | kevinconway/confpy | confpy/loaders/base.py | ConfigurationFile._read | def _read(self):
"""Open the file and return its contents."""
with open(self.path, 'r') as file_handle:
content = file_handle.read()
# Py27 INI config parser chokes if the content provided is not unicode.
# All other versions seems to work appropriately. Forcing the value t... | python | def _read(self):
"""Open the file and return its contents."""
with open(self.path, 'r') as file_handle:
content = file_handle.read()
# Py27 INI config parser chokes if the content provided is not unicode.
# All other versions seems to work appropriately. Forcing the value t... | [
"def",
"_read",
"(",
"self",
")",
":",
"with",
"open",
"(",
"self",
".",
"path",
",",
"'r'",
")",
"as",
"file_handle",
":",
"content",
"=",
"file_handle",
".",
"read",
"(",
")",
"# Py27 INI config parser chokes if the content provided is not unicode.",
"# All othe... | Open the file and return its contents. | [
"Open",
"the",
"file",
"and",
"return",
"its",
"contents",
"."
] | 1ee8afcab46ac6915a5ff4184180434ac7b84a60 | https://github.com/kevinconway/confpy/blob/1ee8afcab46ac6915a5ff4184180434ac7b84a60/confpy/loaders/base.py#L89-L98 |
39,343 | botstory/botstory | botstory/chat.py | Chat.ask | async def ask(self, body, quick_replies=None, options=None, user=None):
"""
simple ask with predefined quick replies
:param body:
:param quick_replies: (optional) in form of
{'title': <message>, 'payload': <any json>}
:param options:
:param user:
:return:... | python | async def ask(self, body, quick_replies=None, options=None, user=None):
"""
simple ask with predefined quick replies
:param body:
:param quick_replies: (optional) in form of
{'title': <message>, 'payload': <any json>}
:param options:
:param user:
:return:... | [
"async",
"def",
"ask",
"(",
"self",
",",
"body",
",",
"quick_replies",
"=",
"None",
",",
"options",
"=",
"None",
",",
"user",
"=",
"None",
")",
":",
"await",
"self",
".",
"send_text_message_to_all_interfaces",
"(",
"recipient",
"=",
"user",
",",
"text",
... | simple ask with predefined quick replies
:param body:
:param quick_replies: (optional) in form of
{'title': <message>, 'payload': <any json>}
:param options:
:param user:
:return: | [
"simple",
"ask",
"with",
"predefined",
"quick",
"replies"
] | 9c5b2fc7f7a14dbd467d70f60d5ba855ef89dac3 | https://github.com/botstory/botstory/blob/9c5b2fc7f7a14dbd467d70f60d5ba855ef89dac3/botstory/chat.py#L13-L30 |
39,344 | botstory/botstory | botstory/chat.py | Chat.say | async def say(self, body, user, options):
"""
say something to user
:param body:
:param user:
:return:
"""
return await self.send_text_message_to_all_interfaces(
recipient=user, text=body, options=options) | python | async def say(self, body, user, options):
"""
say something to user
:param body:
:param user:
:return:
"""
return await self.send_text_message_to_all_interfaces(
recipient=user, text=body, options=options) | [
"async",
"def",
"say",
"(",
"self",
",",
"body",
",",
"user",
",",
"options",
")",
":",
"return",
"await",
"self",
".",
"send_text_message_to_all_interfaces",
"(",
"recipient",
"=",
"user",
",",
"text",
"=",
"body",
",",
"options",
"=",
"options",
")"
] | say something to user
:param body:
:param user:
:return: | [
"say",
"something",
"to",
"user"
] | 9c5b2fc7f7a14dbd467d70f60d5ba855ef89dac3 | https://github.com/botstory/botstory/blob/9c5b2fc7f7a14dbd467d70f60d5ba855ef89dac3/botstory/chat.py#L54-L63 |
39,345 | sporsh/carnifex | carnifex/endpoint.py | InductorEndpoint.connect | def connect(self, protocolFactory):
"""Starts a process and connect a protocol to it.
"""
deferred = self._startProcess()
deferred.addCallback(self._connectRelay, protocolFactory)
deferred.addCallback(self._startRelay)
return deferred | python | def connect(self, protocolFactory):
"""Starts a process and connect a protocol to it.
"""
deferred = self._startProcess()
deferred.addCallback(self._connectRelay, protocolFactory)
deferred.addCallback(self._startRelay)
return deferred | [
"def",
"connect",
"(",
"self",
",",
"protocolFactory",
")",
":",
"deferred",
"=",
"self",
".",
"_startProcess",
"(",
")",
"deferred",
".",
"addCallback",
"(",
"self",
".",
"_connectRelay",
",",
"protocolFactory",
")",
"deferred",
".",
"addCallback",
"(",
"se... | Starts a process and connect a protocol to it. | [
"Starts",
"a",
"process",
"and",
"connect",
"a",
"protocol",
"to",
"it",
"."
] | 82dd3bd2bc134dfb69a78f43171e227f2127060b | https://github.com/sporsh/carnifex/blob/82dd3bd2bc134dfb69a78f43171e227f2127060b/carnifex/endpoint.py#L22-L28 |
39,346 | sporsh/carnifex | carnifex/endpoint.py | InductorEndpoint._startProcess | def _startProcess(self):
"""Use the inductor to start the process we want to relay data from.
"""
connectedDeferred = defer.Deferred()
processProtocol = RelayProcessProtocol(connectedDeferred)
self.inductor.execute(processProtocol, *self.inductorArgs)
return connectedDefe... | python | def _startProcess(self):
"""Use the inductor to start the process we want to relay data from.
"""
connectedDeferred = defer.Deferred()
processProtocol = RelayProcessProtocol(connectedDeferred)
self.inductor.execute(processProtocol, *self.inductorArgs)
return connectedDefe... | [
"def",
"_startProcess",
"(",
"self",
")",
":",
"connectedDeferred",
"=",
"defer",
".",
"Deferred",
"(",
")",
"processProtocol",
"=",
"RelayProcessProtocol",
"(",
"connectedDeferred",
")",
"self",
".",
"inductor",
".",
"execute",
"(",
"processProtocol",
",",
"*",... | Use the inductor to start the process we want to relay data from. | [
"Use",
"the",
"inductor",
"to",
"start",
"the",
"process",
"we",
"want",
"to",
"relay",
"data",
"from",
"."
] | 82dd3bd2bc134dfb69a78f43171e227f2127060b | https://github.com/sporsh/carnifex/blob/82dd3bd2bc134dfb69a78f43171e227f2127060b/carnifex/endpoint.py#L30-L36 |
39,347 | sporsh/carnifex | carnifex/endpoint.py | InductorEndpoint._connectRelay | def _connectRelay(self, process, protocolFactory):
"""Set up and connect the protocol we want to relay to the process.
This method is automatically called when the process is started,
and we are ready to relay through it.
"""
try:
wf = _WrappingFactory(protocolFactory... | python | def _connectRelay(self, process, protocolFactory):
"""Set up and connect the protocol we want to relay to the process.
This method is automatically called when the process is started,
and we are ready to relay through it.
"""
try:
wf = _WrappingFactory(protocolFactory... | [
"def",
"_connectRelay",
"(",
"self",
",",
"process",
",",
"protocolFactory",
")",
":",
"try",
":",
"wf",
"=",
"_WrappingFactory",
"(",
"protocolFactory",
")",
"connector",
"=",
"RelayConnector",
"(",
"process",
",",
"wf",
",",
"self",
".",
"timeout",
",",
... | Set up and connect the protocol we want to relay to the process.
This method is automatically called when the process is started,
and we are ready to relay through it. | [
"Set",
"up",
"and",
"connect",
"the",
"protocol",
"we",
"want",
"to",
"relay",
"to",
"the",
"process",
".",
"This",
"method",
"is",
"automatically",
"called",
"when",
"the",
"process",
"is",
"started",
"and",
"we",
"are",
"ready",
"to",
"relay",
"through",... | 82dd3bd2bc134dfb69a78f43171e227f2127060b | https://github.com/sporsh/carnifex/blob/82dd3bd2bc134dfb69a78f43171e227f2127060b/carnifex/endpoint.py#L38-L51 |
39,348 | sporsh/carnifex | carnifex/endpoint.py | InductorEndpoint._startRelay | def _startRelay(self, client):
"""Start relaying data between the process and the protocol.
This method is called when the protocol is connected.
"""
process = client.transport.connector.process
# Relay any buffered data that was received from the process before
# we got ... | python | def _startRelay(self, client):
"""Start relaying data between the process and the protocol.
This method is called when the protocol is connected.
"""
process = client.transport.connector.process
# Relay any buffered data that was received from the process before
# we got ... | [
"def",
"_startRelay",
"(",
"self",
",",
"client",
")",
":",
"process",
"=",
"client",
".",
"transport",
".",
"connector",
".",
"process",
"# Relay any buffered data that was received from the process before",
"# we got connected and started relaying.",
"for",
"_",
",",
"d... | Start relaying data between the process and the protocol.
This method is called when the protocol is connected. | [
"Start",
"relaying",
"data",
"between",
"the",
"process",
"and",
"the",
"protocol",
".",
"This",
"method",
"is",
"called",
"when",
"the",
"protocol",
"is",
"connected",
"."
] | 82dd3bd2bc134dfb69a78f43171e227f2127060b | https://github.com/sporsh/carnifex/blob/82dd3bd2bc134dfb69a78f43171e227f2127060b/carnifex/endpoint.py#L53-L74 |
39,349 | sporsh/carnifex | carnifex/endpoint.py | RelayTransport.connectRelay | def connectRelay(self):
"""Builds the target protocol and connects it to the relay transport.
"""
self.protocol = self.connector.buildProtocol(None)
self.connected = True
self.protocol.makeConnection(self) | python | def connectRelay(self):
"""Builds the target protocol and connects it to the relay transport.
"""
self.protocol = self.connector.buildProtocol(None)
self.connected = True
self.protocol.makeConnection(self) | [
"def",
"connectRelay",
"(",
"self",
")",
":",
"self",
".",
"protocol",
"=",
"self",
".",
"connector",
".",
"buildProtocol",
"(",
"None",
")",
"self",
".",
"connected",
"=",
"True",
"self",
".",
"protocol",
".",
"makeConnection",
"(",
"self",
")"
] | Builds the target protocol and connects it to the relay transport. | [
"Builds",
"the",
"target",
"protocol",
"and",
"connects",
"it",
"to",
"the",
"relay",
"transport",
"."
] | 82dd3bd2bc134dfb69a78f43171e227f2127060b | https://github.com/sporsh/carnifex/blob/82dd3bd2bc134dfb69a78f43171e227f2127060b/carnifex/endpoint.py#L87-L92 |
39,350 | sporsh/carnifex | carnifex/endpoint.py | RelayProcessProtocol.childDataReceived | def childDataReceived(self, childFD, data):
"""Relay data received on any file descriptor to the process
"""
protocol = getattr(self, 'protocol', None)
if protocol:
protocol.dataReceived(data)
else:
self.data.append((childFD, data)) | python | def childDataReceived(self, childFD, data):
"""Relay data received on any file descriptor to the process
"""
protocol = getattr(self, 'protocol', None)
if protocol:
protocol.dataReceived(data)
else:
self.data.append((childFD, data)) | [
"def",
"childDataReceived",
"(",
"self",
",",
"childFD",
",",
"data",
")",
":",
"protocol",
"=",
"getattr",
"(",
"self",
",",
"'protocol'",
",",
"None",
")",
"if",
"protocol",
":",
"protocol",
".",
"dataReceived",
"(",
"data",
")",
"else",
":",
"self",
... | Relay data received on any file descriptor to the process | [
"Relay",
"data",
"received",
"on",
"any",
"file",
"descriptor",
"to",
"the",
"process"
] | 82dd3bd2bc134dfb69a78f43171e227f2127060b | https://github.com/sporsh/carnifex/blob/82dd3bd2bc134dfb69a78f43171e227f2127060b/carnifex/endpoint.py#L149-L156 |
39,351 | scailer/django-social-publisher | social_publisher/core.py | PublisherCore.publish | def publish(self, user, provider, obj, comment, **kwargs):
'''
user - django User or UserSocialAuth instance
provider - name of publisher provider
obj - sharing object
comment - string
'''
social_user = self._get_social_user(user, provider)
... | python | def publish(self, user, provider, obj, comment, **kwargs):
'''
user - django User or UserSocialAuth instance
provider - name of publisher provider
obj - sharing object
comment - string
'''
social_user = self._get_social_user(user, provider)
... | [
"def",
"publish",
"(",
"self",
",",
"user",
",",
"provider",
",",
"obj",
",",
"comment",
",",
"*",
"*",
"kwargs",
")",
":",
"social_user",
"=",
"self",
".",
"_get_social_user",
"(",
"user",
",",
"provider",
")",
"backend",
"=",
"self",
".",
"get_backen... | user - django User or UserSocialAuth instance
provider - name of publisher provider
obj - sharing object
comment - string | [
"user",
"-",
"django",
"User",
"or",
"UserSocialAuth",
"instance",
"provider",
"-",
"name",
"of",
"publisher",
"provider",
"obj",
"-",
"sharing",
"object",
"comment",
"-",
"string"
] | 7fc0ea28fc9e4ecf0e95617fc2d1f89a90fca087 | https://github.com/scailer/django-social-publisher/blob/7fc0ea28fc9e4ecf0e95617fc2d1f89a90fca087/social_publisher/core.py#L61-L70 |
39,352 | scailer/django-social-publisher | social_publisher/core.py | PublisherCore.check | def check(self, user, provider, permission, **kwargs):
'''
user - django User or UserSocialAuth instance
provider - name of publisher provider
permission - if backend maintains check permissions
vk - binary mask in int format
... | python | def check(self, user, provider, permission, **kwargs):
'''
user - django User or UserSocialAuth instance
provider - name of publisher provider
permission - if backend maintains check permissions
vk - binary mask in int format
... | [
"def",
"check",
"(",
"self",
",",
"user",
",",
"provider",
",",
"permission",
",",
"*",
"*",
"kwargs",
")",
":",
"try",
":",
"social_user",
"=",
"self",
".",
"_get_social_user",
"(",
"user",
",",
"provider",
")",
"if",
"not",
"social_user",
":",
"retur... | user - django User or UserSocialAuth instance
provider - name of publisher provider
permission - if backend maintains check permissions
vk - binary mask in int format
facebook - scope string | [
"user",
"-",
"django",
"User",
"or",
"UserSocialAuth",
"instance",
"provider",
"-",
"name",
"of",
"publisher",
"provider",
"permission",
"-",
"if",
"backend",
"maintains",
"check",
"permissions",
"vk",
"-",
"binary",
"mask",
"in",
"int",
"format",
"facebook",
... | 7fc0ea28fc9e4ecf0e95617fc2d1f89a90fca087 | https://github.com/scailer/django-social-publisher/blob/7fc0ea28fc9e4ecf0e95617fc2d1f89a90fca087/social_publisher/core.py#L72-L89 |
39,353 | pvizeli/ha-alpr | haalpr.py | HAAlpr.recognize_byte | def recognize_byte(self, image, timeout=10):
"""Process a byte image buffer."""
result = []
alpr = subprocess.Popen(
self._cmd,
stdin=subprocess.PIPE,
stdout=subprocess.PIPE,
stderr=subprocess.DEVNULL
)
# send image
try:
... | python | def recognize_byte(self, image, timeout=10):
"""Process a byte image buffer."""
result = []
alpr = subprocess.Popen(
self._cmd,
stdin=subprocess.PIPE,
stdout=subprocess.PIPE,
stderr=subprocess.DEVNULL
)
# send image
try:
... | [
"def",
"recognize_byte",
"(",
"self",
",",
"image",
",",
"timeout",
"=",
"10",
")",
":",
"result",
"=",
"[",
"]",
"alpr",
"=",
"subprocess",
".",
"Popen",
"(",
"self",
".",
"_cmd",
",",
"stdin",
"=",
"subprocess",
".",
"PIPE",
",",
"stdout",
"=",
"... | Process a byte image buffer. | [
"Process",
"a",
"byte",
"image",
"buffer",
"."
] | 93777c20f3caba3ee832c45ec022b08a2ee7efd6 | https://github.com/pvizeli/ha-alpr/blob/93777c20f3caba3ee832c45ec022b08a2ee7efd6/haalpr.py#L29-L75 |
39,354 | MacHu-GWU/crawlib-project | crawlib/pipeline/rds/query_builder.py | finished | def finished(finished_status,
update_interval,
table,
status_column,
edit_at_column):
"""
Create text sql statement query for sqlalchemy that getting all finished task.
:param finished_status: int, status code that greater or equal than this
will ... | python | def finished(finished_status,
update_interval,
table,
status_column,
edit_at_column):
"""
Create text sql statement query for sqlalchemy that getting all finished task.
:param finished_status: int, status code that greater or equal than this
will ... | [
"def",
"finished",
"(",
"finished_status",
",",
"update_interval",
",",
"table",
",",
"status_column",
",",
"edit_at_column",
")",
":",
"sql",
"=",
"select",
"(",
"[",
"table",
"]",
")",
".",
"where",
"(",
"and_",
"(",
"*",
"[",
"status_column",
">=",
"f... | Create text sql statement query for sqlalchemy that getting all finished task.
:param finished_status: int, status code that greater or equal than this
will be considered as finished.
:param update_interval: int, the record will be updated every x seconds.
:return: sqlalchemy text sql statement.
... | [
"Create",
"text",
"sql",
"statement",
"query",
"for",
"sqlalchemy",
"that",
"getting",
"all",
"finished",
"task",
"."
] | 241516f2a7a0a32c692f7af35a1f44064e8ce1ab | https://github.com/MacHu-GWU/crawlib-project/blob/241516f2a7a0a32c692f7af35a1f44064e8ce1ab/crawlib/pipeline/rds/query_builder.py#L14-L38 |
39,355 | MacHu-GWU/crawlib-project | crawlib/pipeline/rds/query_builder.py | unfinished | def unfinished(finished_status,
update_interval,
table,
status_column,
edit_at_column):
"""
Create text sql statement query for sqlalchemy that getting all unfinished task.
:param finished_status: int, status code that less than this
will ... | python | def unfinished(finished_status,
update_interval,
table,
status_column,
edit_at_column):
"""
Create text sql statement query for sqlalchemy that getting all unfinished task.
:param finished_status: int, status code that less than this
will ... | [
"def",
"unfinished",
"(",
"finished_status",
",",
"update_interval",
",",
"table",
",",
"status_column",
",",
"edit_at_column",
")",
":",
"sql",
"=",
"select",
"(",
"[",
"table",
"]",
")",
".",
"where",
"(",
"or_",
"(",
"*",
"[",
"status_column",
"<",
"f... | Create text sql statement query for sqlalchemy that getting all unfinished task.
:param finished_status: int, status code that less than this
will be considered as unfinished.
:param update_interval: int, the record will be updated every x seconds.
:return: sqlalchemy text sql statement.
**中... | [
"Create",
"text",
"sql",
"statement",
"query",
"for",
"sqlalchemy",
"that",
"getting",
"all",
"unfinished",
"task",
"."
] | 241516f2a7a0a32c692f7af35a1f44064e8ce1ab | https://github.com/MacHu-GWU/crawlib-project/blob/241516f2a7a0a32c692f7af35a1f44064e8ce1ab/crawlib/pipeline/rds/query_builder.py#L51-L76 |
39,356 | scivision/sciencedates | sciencedates/findnearest.py | find_nearest | def find_nearest(x, x0) -> Tuple[int, Any]:
"""
This find_nearest function does NOT assume sorted input
inputs:
x: array (float, int, datetime, h5py.Dataset) within which to search for x0
x0: singleton or array of values to search for in x
outputs:
idx: index of flattened x nearest to x0 ... | python | def find_nearest(x, x0) -> Tuple[int, Any]:
"""
This find_nearest function does NOT assume sorted input
inputs:
x: array (float, int, datetime, h5py.Dataset) within which to search for x0
x0: singleton or array of values to search for in x
outputs:
idx: index of flattened x nearest to x0 ... | [
"def",
"find_nearest",
"(",
"x",
",",
"x0",
")",
"->",
"Tuple",
"[",
"int",
",",
"Any",
"]",
":",
"x",
"=",
"np",
".",
"asanyarray",
"(",
"x",
")",
"# for indexing upon return",
"x0",
"=",
"np",
".",
"atleast_1d",
"(",
"x0",
")",
"# %%",
"if",
"x",... | This find_nearest function does NOT assume sorted input
inputs:
x: array (float, int, datetime, h5py.Dataset) within which to search for x0
x0: singleton or array of values to search for in x
outputs:
idx: index of flattened x nearest to x0 (i.e. works with higher than 1-D arrays also)
xidx: ... | [
"This",
"find_nearest",
"function",
"does",
"NOT",
"assume",
"sorted",
"input"
] | a713389e027b42d26875cf227450a5d7c6696000 | https://github.com/scivision/sciencedates/blob/a713389e027b42d26875cf227450a5d7c6696000/sciencedates/findnearest.py#L6-L42 |
39,357 | e7dal/bubble3 | behave4cmd0/command_util.py | ensure_context_attribute_exists | def ensure_context_attribute_exists(context, name, default_value=None):
"""
Ensure a behave resource exists as attribute in the behave context.
If this is not the case, the attribute is created by using the default_value.
"""
if not hasattr(context, name):
setattr(context, name, default_valu... | python | def ensure_context_attribute_exists(context, name, default_value=None):
"""
Ensure a behave resource exists as attribute in the behave context.
If this is not the case, the attribute is created by using the default_value.
"""
if not hasattr(context, name):
setattr(context, name, default_valu... | [
"def",
"ensure_context_attribute_exists",
"(",
"context",
",",
"name",
",",
"default_value",
"=",
"None",
")",
":",
"if",
"not",
"hasattr",
"(",
"context",
",",
"name",
")",
":",
"setattr",
"(",
"context",
",",
"name",
",",
"default_value",
")"
] | Ensure a behave resource exists as attribute in the behave context.
If this is not the case, the attribute is created by using the default_value. | [
"Ensure",
"a",
"behave",
"resource",
"exists",
"as",
"attribute",
"in",
"the",
"behave",
"context",
".",
"If",
"this",
"is",
"not",
"the",
"case",
"the",
"attribute",
"is",
"created",
"by",
"using",
"the",
"default_value",
"."
] | 59c735281a95b44f6263a25f4d6ce24fca520082 | https://github.com/e7dal/bubble3/blob/59c735281a95b44f6263a25f4d6ce24fca520082/behave4cmd0/command_util.py#L51-L57 |
39,358 | e7dal/bubble3 | behave4cmd0/command_util.py | ensure_workdir_exists | def ensure_workdir_exists(context):
"""
Ensures that the work directory exists.
In addition, the location of the workdir is stored as attribute in
the context object.
"""
ensure_context_attribute_exists(context, "workdir", None)
if not context.workdir:
context.workdir = os.path.abspa... | python | def ensure_workdir_exists(context):
"""
Ensures that the work directory exists.
In addition, the location of the workdir is stored as attribute in
the context object.
"""
ensure_context_attribute_exists(context, "workdir", None)
if not context.workdir:
context.workdir = os.path.abspa... | [
"def",
"ensure_workdir_exists",
"(",
"context",
")",
":",
"ensure_context_attribute_exists",
"(",
"context",
",",
"\"workdir\"",
",",
"None",
")",
"if",
"not",
"context",
".",
"workdir",
":",
"context",
".",
"workdir",
"=",
"os",
".",
"path",
".",
"abspath",
... | Ensures that the work directory exists.
In addition, the location of the workdir is stored as attribute in
the context object. | [
"Ensures",
"that",
"the",
"work",
"directory",
"exists",
".",
"In",
"addition",
"the",
"location",
"of",
"the",
"workdir",
"is",
"stored",
"as",
"attribute",
"in",
"the",
"context",
"object",
"."
] | 59c735281a95b44f6263a25f4d6ce24fca520082 | https://github.com/e7dal/bubble3/blob/59c735281a95b44f6263a25f4d6ce24fca520082/behave4cmd0/command_util.py#L59-L68 |
39,359 | Cadasta/django-tutelary | tutelary/wildtree.py | del_by_idx | def del_by_idx(tree, idxs):
"""
Delete a key entry based on numerical indexes into subtree lists.
"""
if len(idxs) == 0:
tree['item'] = None
tree['subtrees'] = []
else:
hidx, tidxs = idxs[0], idxs[1:]
del_by_idx(tree['subtrees'][hidx][1], tidxs)
if len(tree['s... | python | def del_by_idx(tree, idxs):
"""
Delete a key entry based on numerical indexes into subtree lists.
"""
if len(idxs) == 0:
tree['item'] = None
tree['subtrees'] = []
else:
hidx, tidxs = idxs[0], idxs[1:]
del_by_idx(tree['subtrees'][hidx][1], tidxs)
if len(tree['s... | [
"def",
"del_by_idx",
"(",
"tree",
",",
"idxs",
")",
":",
"if",
"len",
"(",
"idxs",
")",
"==",
"0",
":",
"tree",
"[",
"'item'",
"]",
"=",
"None",
"tree",
"[",
"'subtrees'",
"]",
"=",
"[",
"]",
"else",
":",
"hidx",
",",
"tidxs",
"=",
"idxs",
"[",... | Delete a key entry based on numerical indexes into subtree lists. | [
"Delete",
"a",
"key",
"entry",
"based",
"on",
"numerical",
"indexes",
"into",
"subtree",
"lists",
"."
] | 66bb05de7098777c0a383410c287bf48433cde87 | https://github.com/Cadasta/django-tutelary/blob/66bb05de7098777c0a383410c287bf48433cde87/tutelary/wildtree.py#L145-L156 |
39,360 | Cadasta/django-tutelary | tutelary/wildtree.py | find_in_tree | def find_in_tree(tree, key, perfect=False):
"""
Helper to perform find in dictionary tree.
"""
if len(key) == 0:
if tree['item'] is not None:
return tree['item'], ()
else:
for i in range(len(tree['subtrees'])):
if not perfect and tree['subtrees'][i... | python | def find_in_tree(tree, key, perfect=False):
"""
Helper to perform find in dictionary tree.
"""
if len(key) == 0:
if tree['item'] is not None:
return tree['item'], ()
else:
for i in range(len(tree['subtrees'])):
if not perfect and tree['subtrees'][i... | [
"def",
"find_in_tree",
"(",
"tree",
",",
"key",
",",
"perfect",
"=",
"False",
")",
":",
"if",
"len",
"(",
"key",
")",
"==",
"0",
":",
"if",
"tree",
"[",
"'item'",
"]",
"is",
"not",
"None",
":",
"return",
"tree",
"[",
"'item'",
"]",
",",
"(",
")... | Helper to perform find in dictionary tree. | [
"Helper",
"to",
"perform",
"find",
"in",
"dictionary",
"tree",
"."
] | 66bb05de7098777c0a383410c287bf48433cde87 | https://github.com/Cadasta/django-tutelary/blob/66bb05de7098777c0a383410c287bf48433cde87/tutelary/wildtree.py#L159-L184 |
39,361 | Cadasta/django-tutelary | tutelary/wildtree.py | WildTree.find | def find(self, key, perfect=False):
"""
Find a key path in the tree, matching wildcards. Return value for
key, along with index path through subtree lists to the result. Throw
``KeyError`` if the key path doesn't exist in the tree.
"""
return find_in_tree(self.root, ke... | python | def find(self, key, perfect=False):
"""
Find a key path in the tree, matching wildcards. Return value for
key, along with index path through subtree lists to the result. Throw
``KeyError`` if the key path doesn't exist in the tree.
"""
return find_in_tree(self.root, ke... | [
"def",
"find",
"(",
"self",
",",
"key",
",",
"perfect",
"=",
"False",
")",
":",
"return",
"find_in_tree",
"(",
"self",
".",
"root",
",",
"key",
",",
"perfect",
")"
] | Find a key path in the tree, matching wildcards. Return value for
key, along with index path through subtree lists to the result. Throw
``KeyError`` if the key path doesn't exist in the tree. | [
"Find",
"a",
"key",
"path",
"in",
"the",
"tree",
"matching",
"wildcards",
".",
"Return",
"value",
"for",
"key",
"along",
"with",
"index",
"path",
"through",
"subtree",
"lists",
"to",
"the",
"result",
".",
"Throw",
"KeyError",
"if",
"the",
"key",
"path",
... | 66bb05de7098777c0a383410c287bf48433cde87 | https://github.com/Cadasta/django-tutelary/blob/66bb05de7098777c0a383410c287bf48433cde87/tutelary/wildtree.py#L121-L128 |
39,362 | Cadasta/django-tutelary | tutelary/wildtree.py | WildTree._purge_unreachable | def _purge_unreachable(self, key):
"""
Purge unreachable dominated key paths before inserting a new key
path.
"""
dels = []
for p in self:
if dominates(key, p):
dels.append(p)
for k in dels:
_, idxs = find_in_tree(self.root... | python | def _purge_unreachable(self, key):
"""
Purge unreachable dominated key paths before inserting a new key
path.
"""
dels = []
for p in self:
if dominates(key, p):
dels.append(p)
for k in dels:
_, idxs = find_in_tree(self.root... | [
"def",
"_purge_unreachable",
"(",
"self",
",",
"key",
")",
":",
"dels",
"=",
"[",
"]",
"for",
"p",
"in",
"self",
":",
"if",
"dominates",
"(",
"key",
",",
"p",
")",
":",
"dels",
".",
"append",
"(",
"p",
")",
"for",
"k",
"in",
"dels",
":",
"_",
... | Purge unreachable dominated key paths before inserting a new key
path. | [
"Purge",
"unreachable",
"dominated",
"key",
"paths",
"before",
"inserting",
"a",
"new",
"key",
"path",
"."
] | 66bb05de7098777c0a383410c287bf48433cde87 | https://github.com/Cadasta/django-tutelary/blob/66bb05de7098777c0a383410c287bf48433cde87/tutelary/wildtree.py#L130-L142 |
39,363 | kevinconway/confpy | confpy/core/config.py | Configuration.register | def register(self, name, namespace):
"""Register a new namespace with the Configuration object.
Args:
name (str): The name of the section/namespace.
namespace (namespace.Namespace): The Namespace object to store.
Raises:
TypeError: If the namespace is not a ... | python | def register(self, name, namespace):
"""Register a new namespace with the Configuration object.
Args:
name (str): The name of the section/namespace.
namespace (namespace.Namespace): The Namespace object to store.
Raises:
TypeError: If the namespace is not a ... | [
"def",
"register",
"(",
"self",
",",
"name",
",",
"namespace",
")",
":",
"if",
"name",
"in",
"self",
".",
"_NAMESPACES",
":",
"raise",
"ValueError",
"(",
"\"Namespace {0} already exists.\"",
".",
"format",
"(",
"name",
")",
")",
"if",
"not",
"isinstance",
... | Register a new namespace with the Configuration object.
Args:
name (str): The name of the section/namespace.
namespace (namespace.Namespace): The Namespace object to store.
Raises:
TypeError: If the namespace is not a Namespace object.
ValueError: If the... | [
"Register",
"a",
"new",
"namespace",
"with",
"the",
"Configuration",
"object",
"."
] | 1ee8afcab46ac6915a5ff4184180434ac7b84a60 | https://github.com/kevinconway/confpy/blob/1ee8afcab46ac6915a5ff4184180434ac7b84a60/confpy/core/config.py#L53-L72 |
39,364 | abakan-zz/napi | napi/transformers.py | napi_compare | def napi_compare(left, ops, comparators, **kwargs):
"""Make pairwise comparisons of comparators."""
values = []
for op, right in zip(ops, comparators):
value = COMPARE[op](left, right)
values.append(value)
left = right
result = napi_and(values, **kwargs)
if isinstance(result... | python | def napi_compare(left, ops, comparators, **kwargs):
"""Make pairwise comparisons of comparators."""
values = []
for op, right in zip(ops, comparators):
value = COMPARE[op](left, right)
values.append(value)
left = right
result = napi_and(values, **kwargs)
if isinstance(result... | [
"def",
"napi_compare",
"(",
"left",
",",
"ops",
",",
"comparators",
",",
"*",
"*",
"kwargs",
")",
":",
"values",
"=",
"[",
"]",
"for",
"op",
",",
"right",
"in",
"zip",
"(",
"ops",
",",
"comparators",
")",
":",
"value",
"=",
"COMPARE",
"[",
"op",
... | Make pairwise comparisons of comparators. | [
"Make",
"pairwise",
"comparisons",
"of",
"comparators",
"."
] | 314da65bd78e2c716b7efb6deaf3816d8f38f7fd | https://github.com/abakan-zz/napi/blob/314da65bd78e2c716b7efb6deaf3816d8f38f7fd/napi/transformers.py#L145-L157 |
39,365 | diamondman/proteusisc | proteusisc/jtagStateMachine.py | JTAGStateMachine.calc_transition_to_state | def calc_transition_to_state(self, newstate):
"""Given a target state, generate the sequence of transitions that would move this state machine instance to that target state.
Args:
newstate: A str state name to calculate the path to.
Returns:
A bitarray containing the bi... | python | def calc_transition_to_state(self, newstate):
"""Given a target state, generate the sequence of transitions that would move this state machine instance to that target state.
Args:
newstate: A str state name to calculate the path to.
Returns:
A bitarray containing the bi... | [
"def",
"calc_transition_to_state",
"(",
"self",
",",
"newstate",
")",
":",
"cached_val",
"=",
"JTAGStateMachine",
".",
"_lookup_cache",
".",
"get",
"(",
"(",
"self",
".",
"state",
",",
"newstate",
")",
")",
"if",
"cached_val",
":",
"return",
"cached_val",
"i... | Given a target state, generate the sequence of transitions that would move this state machine instance to that target state.
Args:
newstate: A str state name to calculate the path to.
Returns:
A bitarray containing the bits that would transition this
state machine t... | [
"Given",
"a",
"target",
"state",
"generate",
"the",
"sequence",
"of",
"transitions",
"that",
"would",
"move",
"this",
"state",
"machine",
"instance",
"to",
"that",
"target",
"state",
"."
] | 7622b7b04e63f9dc0f5a04429ff78d9a490c9c5c | https://github.com/diamondman/proteusisc/blob/7622b7b04e63f9dc0f5a04429ff78d9a490c9c5c/proteusisc/jtagStateMachine.py#L86-L114 |
39,366 | bitesofcode/projex | projex/hooks.py | setup | def setup():
"""
Initializes the hook queues for the sys module. This method will
automatically be called on the first registration for a hook to the system
by either the registerDisplay or registerExcept functions.
"""
global _displayhooks, _excepthooks
if _displayhooks is not None:
... | python | def setup():
"""
Initializes the hook queues for the sys module. This method will
automatically be called on the first registration for a hook to the system
by either the registerDisplay or registerExcept functions.
"""
global _displayhooks, _excepthooks
if _displayhooks is not None:
... | [
"def",
"setup",
"(",
")",
":",
"global",
"_displayhooks",
",",
"_excepthooks",
"if",
"_displayhooks",
"is",
"not",
"None",
":",
"return",
"_displayhooks",
"=",
"[",
"]",
"_excepthooks",
"=",
"[",
"]",
"# store any current hooks",
"if",
"sys",
".",
"displayhook... | Initializes the hook queues for the sys module. This method will
automatically be called on the first registration for a hook to the system
by either the registerDisplay or registerExcept functions. | [
"Initializes",
"the",
"hook",
"queues",
"for",
"the",
"sys",
"module",
".",
"This",
"method",
"will",
"automatically",
"be",
"called",
"on",
"the",
"first",
"registration",
"for",
"a",
"hook",
"to",
"the",
"system",
"by",
"either",
"the",
"registerDisplay",
... | d31743ec456a41428709968ab11a2cf6c6c76247 | https://github.com/bitesofcode/projex/blob/d31743ec456a41428709968ab11a2cf6c6c76247/projex/hooks.py#L188-L210 |
39,367 | LeastAuthority/txkube | src/txkube/_swagger.py | _parse_iso8601 | def _parse_iso8601(text):
"""
Maybe parse an ISO8601 datetime string into a datetime.
:param text: Either a ``unicode`` string to parse or any other object
(ideally a ``datetime`` instance) to pass through.
:return: A ``datetime.datetime`` representing ``text``. Or ``text`` if it
was ... | python | def _parse_iso8601(text):
"""
Maybe parse an ISO8601 datetime string into a datetime.
:param text: Either a ``unicode`` string to parse or any other object
(ideally a ``datetime`` instance) to pass through.
:return: A ``datetime.datetime`` representing ``text``. Or ``text`` if it
was ... | [
"def",
"_parse_iso8601",
"(",
"text",
")",
":",
"if",
"isinstance",
"(",
"text",
",",
"unicode",
")",
":",
"try",
":",
"return",
"parse_iso8601",
"(",
"text",
")",
"except",
"ValueError",
":",
"raise",
"CheckedValueTypeError",
"(",
"None",
",",
"(",
"datet... | Maybe parse an ISO8601 datetime string into a datetime.
:param text: Either a ``unicode`` string to parse or any other object
(ideally a ``datetime`` instance) to pass through.
:return: A ``datetime.datetime`` representing ``text``. Or ``text`` if it
was anything but a ``unicode`` string. | [
"Maybe",
"parse",
"an",
"ISO8601",
"datetime",
"string",
"into",
"a",
"datetime",
"."
] | a7e555d00535ff787d4b1204c264780da40cf736 | https://github.com/LeastAuthority/txkube/blob/a7e555d00535ff787d4b1204c264780da40cf736/src/txkube/_swagger.py#L578-L596 |
39,368 | LeastAuthority/txkube | src/txkube/_swagger.py | Swagger.from_path | def from_path(cls, spec_path):
"""
Load a specification from a path.
:param FilePath spec_path: The location of the specification to read.
"""
with spec_path.open() as spec_file:
return cls.from_document(load(spec_file)) | python | def from_path(cls, spec_path):
"""
Load a specification from a path.
:param FilePath spec_path: The location of the specification to read.
"""
with spec_path.open() as spec_file:
return cls.from_document(load(spec_file)) | [
"def",
"from_path",
"(",
"cls",
",",
"spec_path",
")",
":",
"with",
"spec_path",
".",
"open",
"(",
")",
"as",
"spec_file",
":",
"return",
"cls",
".",
"from_document",
"(",
"load",
"(",
"spec_file",
")",
")"
] | Load a specification from a path.
:param FilePath spec_path: The location of the specification to read. | [
"Load",
"a",
"specification",
"from",
"a",
"path",
"."
] | a7e555d00535ff787d4b1204c264780da40cf736 | https://github.com/LeastAuthority/txkube/blob/a7e555d00535ff787d4b1204c264780da40cf736/src/txkube/_swagger.py#L98-L105 |
39,369 | LeastAuthority/txkube | src/txkube/_swagger.py | Swagger.to_document | def to_document(self):
"""
Serialize this specification to a JSON-compatible object representing a
Swagger specification.
"""
return dict(
info=thaw(self.info),
paths=thaw(self.paths),
definitions=thaw(self.definitions),
securityDef... | python | def to_document(self):
"""
Serialize this specification to a JSON-compatible object representing a
Swagger specification.
"""
return dict(
info=thaw(self.info),
paths=thaw(self.paths),
definitions=thaw(self.definitions),
securityDef... | [
"def",
"to_document",
"(",
"self",
")",
":",
"return",
"dict",
"(",
"info",
"=",
"thaw",
"(",
"self",
".",
"info",
")",
",",
"paths",
"=",
"thaw",
"(",
"self",
".",
"paths",
")",
",",
"definitions",
"=",
"thaw",
"(",
"self",
".",
"definitions",
")"... | Serialize this specification to a JSON-compatible object representing a
Swagger specification. | [
"Serialize",
"this",
"specification",
"to",
"a",
"JSON",
"-",
"compatible",
"object",
"representing",
"a",
"Swagger",
"specification",
"."
] | a7e555d00535ff787d4b1204c264780da40cf736 | https://github.com/LeastAuthority/txkube/blob/a7e555d00535ff787d4b1204c264780da40cf736/src/txkube/_swagger.py#L143-L155 |
39,370 | LeastAuthority/txkube | src/txkube/_swagger.py | Swagger.pclass_for_definition | def pclass_for_definition(self, name):
"""
Get a ``pyrsistent.PClass`` subclass representing the Swagger definition
in this specification which corresponds to the given name.
:param unicode name: The name of the definition to use.
:return: A Python class which can be used to re... | python | def pclass_for_definition(self, name):
"""
Get a ``pyrsistent.PClass`` subclass representing the Swagger definition
in this specification which corresponds to the given name.
:param unicode name: The name of the definition to use.
:return: A Python class which can be used to re... | [
"def",
"pclass_for_definition",
"(",
"self",
",",
"name",
")",
":",
"while",
"True",
":",
"try",
":",
"cls",
"=",
"self",
".",
"_pclasses",
"[",
"name",
"]",
"except",
"KeyError",
":",
"try",
":",
"original_definition",
"=",
"self",
".",
"definitions",
"... | Get a ``pyrsistent.PClass`` subclass representing the Swagger definition
in this specification which corresponds to the given name.
:param unicode name: The name of the definition to use.
:return: A Python class which can be used to represent the Swagger
definition of the given nam... | [
"Get",
"a",
"pyrsistent",
".",
"PClass",
"subclass",
"representing",
"the",
"Swagger",
"definition",
"in",
"this",
"specification",
"which",
"corresponds",
"to",
"the",
"given",
"name",
"."
] | a7e555d00535ff787d4b1204c264780da40cf736 | https://github.com/LeastAuthority/txkube/blob/a7e555d00535ff787d4b1204c264780da40cf736/src/txkube/_swagger.py#L158-L197 |
39,371 | LeastAuthority/txkube | src/txkube/_swagger.py | Swagger._model_for_CLASS | def _model_for_CLASS(self, name, definition):
"""
Model a Swagger definition that is like a Python class.
:param unicode name: The name of the definition from the
specification.
:param pyrsistent.PMap definition: A Swagger definition to categorize.
This will be ... | python | def _model_for_CLASS(self, name, definition):
"""
Model a Swagger definition that is like a Python class.
:param unicode name: The name of the definition from the
specification.
:param pyrsistent.PMap definition: A Swagger definition to categorize.
This will be ... | [
"def",
"_model_for_CLASS",
"(",
"self",
",",
"name",
",",
"definition",
")",
":",
"return",
"_ClassModel",
".",
"from_swagger",
"(",
"self",
".",
"pclass_for_definition",
",",
"name",
",",
"definition",
",",
")"
] | Model a Swagger definition that is like a Python class.
:param unicode name: The name of the definition from the
specification.
:param pyrsistent.PMap definition: A Swagger definition to categorize.
This will be a value like the one found at
``spec["definitions"][na... | [
"Model",
"a",
"Swagger",
"definition",
"that",
"is",
"like",
"a",
"Python",
"class",
"."
] | a7e555d00535ff787d4b1204c264780da40cf736 | https://github.com/LeastAuthority/txkube/blob/a7e555d00535ff787d4b1204c264780da40cf736/src/txkube/_swagger.py#L220-L235 |
39,372 | LeastAuthority/txkube | src/txkube/_swagger.py | _ClassModel.from_swagger | def from_swagger(cls, pclass_for_definition, name, definition):
"""
Create a new ``_ClassModel`` from a single Swagger definition.
:param pclass_for_definition: A callable like
``Swagger.pclass_for_definition`` which can be used to resolve
type references encountered in ... | python | def from_swagger(cls, pclass_for_definition, name, definition):
"""
Create a new ``_ClassModel`` from a single Swagger definition.
:param pclass_for_definition: A callable like
``Swagger.pclass_for_definition`` which can be used to resolve
type references encountered in ... | [
"def",
"from_swagger",
"(",
"cls",
",",
"pclass_for_definition",
",",
"name",
",",
"definition",
")",
":",
"return",
"cls",
"(",
"name",
"=",
"name",
",",
"doc",
"=",
"definition",
".",
"get",
"(",
"u\"description\"",
",",
"name",
")",
",",
"attributes",
... | Create a new ``_ClassModel`` from a single Swagger definition.
:param pclass_for_definition: A callable like
``Swagger.pclass_for_definition`` which can be used to resolve
type references encountered in the definition.
:param unicode name: The name of the definition.
:... | [
"Create",
"a",
"new",
"_ClassModel",
"from",
"a",
"single",
"Swagger",
"definition",
"."
] | a7e555d00535ff787d4b1204c264780da40cf736 | https://github.com/LeastAuthority/txkube/blob/a7e555d00535ff787d4b1204c264780da40cf736/src/txkube/_swagger.py#L736-L758 |
39,373 | LeastAuthority/txkube | src/txkube/_swagger.py | _ClassModel.pclass | def pclass(self, bases):
"""
Create a ``pyrsistent.PClass`` subclass representing this class.
:param tuple bases: Additional base classes to give the resulting
class. These will appear to the left of ``PClass``.
"""
def discard_constant_fields(cls, **kwargs):
... | python | def pclass(self, bases):
"""
Create a ``pyrsistent.PClass`` subclass representing this class.
:param tuple bases: Additional base classes to give the resulting
class. These will appear to the left of ``PClass``.
"""
def discard_constant_fields(cls, **kwargs):
... | [
"def",
"pclass",
"(",
"self",
",",
"bases",
")",
":",
"def",
"discard_constant_fields",
"(",
"cls",
",",
"*",
"*",
"kwargs",
")",
":",
"def",
"ctor",
"(",
")",
":",
"return",
"super",
"(",
"huh",
",",
"cls",
")",
".",
"__new__",
"(",
"cls",
",",
... | Create a ``pyrsistent.PClass`` subclass representing this class.
:param tuple bases: Additional base classes to give the resulting
class. These will appear to the left of ``PClass``. | [
"Create",
"a",
"pyrsistent",
".",
"PClass",
"subclass",
"representing",
"this",
"class",
"."
] | a7e555d00535ff787d4b1204c264780da40cf736 | https://github.com/LeastAuthority/txkube/blob/a7e555d00535ff787d4b1204c264780da40cf736/src/txkube/_swagger.py#L761-L806 |
39,374 | LeastAuthority/txkube | src/txkube/_compat.py | dumps_bytes | def dumps_bytes(obj):
"""
Serialize ``obj`` to JSON formatted ``bytes``.
"""
b = dumps(obj)
if isinstance(b, unicode):
b = b.encode("ascii")
return b | python | def dumps_bytes(obj):
"""
Serialize ``obj`` to JSON formatted ``bytes``.
"""
b = dumps(obj)
if isinstance(b, unicode):
b = b.encode("ascii")
return b | [
"def",
"dumps_bytes",
"(",
"obj",
")",
":",
"b",
"=",
"dumps",
"(",
"obj",
")",
"if",
"isinstance",
"(",
"b",
",",
"unicode",
")",
":",
"b",
"=",
"b",
".",
"encode",
"(",
"\"ascii\"",
")",
"return",
"b"
] | Serialize ``obj`` to JSON formatted ``bytes``. | [
"Serialize",
"obj",
"to",
"JSON",
"formatted",
"bytes",
"."
] | a7e555d00535ff787d4b1204c264780da40cf736 | https://github.com/LeastAuthority/txkube/blob/a7e555d00535ff787d4b1204c264780da40cf736/src/txkube/_compat.py#L12-L19 |
39,375 | LeastAuthority/txkube | src/txkube/_compat.py | native_string_to_bytes | def native_string_to_bytes(s, encoding="ascii", errors="strict"):
"""
Ensure that the native string ``s`` is converted to ``bytes``.
"""
if not isinstance(s, str):
raise TypeError("{} must be type str, not {}".format(s, type(s)))
if str is bytes:
# Python 2
return s
else:... | python | def native_string_to_bytes(s, encoding="ascii", errors="strict"):
"""
Ensure that the native string ``s`` is converted to ``bytes``.
"""
if not isinstance(s, str):
raise TypeError("{} must be type str, not {}".format(s, type(s)))
if str is bytes:
# Python 2
return s
else:... | [
"def",
"native_string_to_bytes",
"(",
"s",
",",
"encoding",
"=",
"\"ascii\"",
",",
"errors",
"=",
"\"strict\"",
")",
":",
"if",
"not",
"isinstance",
"(",
"s",
",",
"str",
")",
":",
"raise",
"TypeError",
"(",
"\"{} must be type str, not {}\"",
".",
"format",
... | Ensure that the native string ``s`` is converted to ``bytes``. | [
"Ensure",
"that",
"the",
"native",
"string",
"s",
"is",
"converted",
"to",
"bytes",
"."
] | a7e555d00535ff787d4b1204c264780da40cf736 | https://github.com/LeastAuthority/txkube/blob/a7e555d00535ff787d4b1204c264780da40cf736/src/txkube/_compat.py#L23-L34 |
39,376 | LeastAuthority/txkube | src/txkube/_compat.py | native_string_to_unicode | def native_string_to_unicode(s, encoding="ascii", errors="strict"):
"""
Ensure that the native string ``s`` is converted to ``unicode``.
"""
if not isinstance(s, str):
raise TypeError("{} must be type str, not {}".format(s, type(s)))
if str is unicode:
# Python 3
return s
... | python | def native_string_to_unicode(s, encoding="ascii", errors="strict"):
"""
Ensure that the native string ``s`` is converted to ``unicode``.
"""
if not isinstance(s, str):
raise TypeError("{} must be type str, not {}".format(s, type(s)))
if str is unicode:
# Python 3
return s
... | [
"def",
"native_string_to_unicode",
"(",
"s",
",",
"encoding",
"=",
"\"ascii\"",
",",
"errors",
"=",
"\"strict\"",
")",
":",
"if",
"not",
"isinstance",
"(",
"s",
",",
"str",
")",
":",
"raise",
"TypeError",
"(",
"\"{} must be type str, not {}\"",
".",
"format",
... | Ensure that the native string ``s`` is converted to ``unicode``. | [
"Ensure",
"that",
"the",
"native",
"string",
"s",
"is",
"converted",
"to",
"unicode",
"."
] | a7e555d00535ff787d4b1204c264780da40cf736 | https://github.com/LeastAuthority/txkube/blob/a7e555d00535ff787d4b1204c264780da40cf736/src/txkube/_compat.py#L38-L49 |
39,377 | pauleveritt/kaybee | kaybee/utils/datetime_handler.py | datetime_handler | def datetime_handler(x):
""" Allow serializing datetime objects to JSON """
if isinstance(x, datetime.datetime) or isinstance(x, datetime.date):
return x.isoformat()
raise TypeError("Unknown type") | python | def datetime_handler(x):
""" Allow serializing datetime objects to JSON """
if isinstance(x, datetime.datetime) or isinstance(x, datetime.date):
return x.isoformat()
raise TypeError("Unknown type") | [
"def",
"datetime_handler",
"(",
"x",
")",
":",
"if",
"isinstance",
"(",
"x",
",",
"datetime",
".",
"datetime",
")",
"or",
"isinstance",
"(",
"x",
",",
"datetime",
".",
"date",
")",
":",
"return",
"x",
".",
"isoformat",
"(",
")",
"raise",
"TypeError",
... | Allow serializing datetime objects to JSON | [
"Allow",
"serializing",
"datetime",
"objects",
"to",
"JSON"
] | a00a718aaaa23b2d12db30dfacb6b2b6ec84459c | https://github.com/pauleveritt/kaybee/blob/a00a718aaaa23b2d12db30dfacb6b2b6ec84459c/kaybee/utils/datetime_handler.py#L4-L8 |
39,378 | kevinconway/confpy | confpy/loaders/pyfile.py | PythonFile.parsed | def parsed(self):
"""Get the code object which represents the compiled Python file.
This property is cached and only parses the content once.
"""
if not self._parsed:
self._parsed = compile(self.content, self.path, 'exec')
return self._parsed | python | def parsed(self):
"""Get the code object which represents the compiled Python file.
This property is cached and only parses the content once.
"""
if not self._parsed:
self._parsed = compile(self.content, self.path, 'exec')
return self._parsed | [
"def",
"parsed",
"(",
"self",
")",
":",
"if",
"not",
"self",
".",
"_parsed",
":",
"self",
".",
"_parsed",
"=",
"compile",
"(",
"self",
".",
"content",
",",
"self",
".",
"path",
",",
"'exec'",
")",
"return",
"self",
".",
"_parsed"
] | Get the code object which represents the compiled Python file.
This property is cached and only parses the content once. | [
"Get",
"the",
"code",
"object",
"which",
"represents",
"the",
"compiled",
"Python",
"file",
"."
] | 1ee8afcab46ac6915a5ff4184180434ac7b84a60 | https://github.com/kevinconway/confpy/blob/1ee8afcab46ac6915a5ff4184180434ac7b84a60/confpy/loaders/pyfile.py#L26-L35 |
39,379 | chrisbouchard/braillegraph | braillegraph/braillegraph.py | _chunk | def _chunk(iterable, size):
"""Split an iterable into chunks of a fixed size."""
# We're going to use some star magic to chunk the iterable. We create a
# copy of the iterator size times, then pull a value from each to form a
# chunk. The last chunk may have some trailing Nones if the length of the
... | python | def _chunk(iterable, size):
"""Split an iterable into chunks of a fixed size."""
# We're going to use some star magic to chunk the iterable. We create a
# copy of the iterator size times, then pull a value from each to form a
# chunk. The last chunk may have some trailing Nones if the length of the
... | [
"def",
"_chunk",
"(",
"iterable",
",",
"size",
")",
":",
"# We're going to use some star magic to chunk the iterable. We create a",
"# copy of the iterator size times, then pull a value from each to form a",
"# chunk. The last chunk may have some trailing Nones if the length of the",
"# iterab... | Split an iterable into chunks of a fixed size. | [
"Split",
"an",
"iterable",
"into",
"chunks",
"of",
"a",
"fixed",
"size",
"."
] | 744ca8394676579cfb11e5c297c9bd794ab5bd78 | https://github.com/chrisbouchard/braillegraph/blob/744ca8394676579cfb11e5c297c9bd794ab5bd78/braillegraph/braillegraph.py#L73-L86 |
39,380 | chrisbouchard/braillegraph | braillegraph/braillegraph.py | _matrix_add_column | def _matrix_add_column(matrix, column, default=0):
"""Given a matrix as a list of lists, add a column to the right, filling in
with a default value if necessary.
"""
height_difference = len(column) - len(matrix)
# The width of the matrix is the length of its longest row.
width = max(len(row) fo... | python | def _matrix_add_column(matrix, column, default=0):
"""Given a matrix as a list of lists, add a column to the right, filling in
with a default value if necessary.
"""
height_difference = len(column) - len(matrix)
# The width of the matrix is the length of its longest row.
width = max(len(row) fo... | [
"def",
"_matrix_add_column",
"(",
"matrix",
",",
"column",
",",
"default",
"=",
"0",
")",
":",
"height_difference",
"=",
"len",
"(",
"column",
")",
"-",
"len",
"(",
"matrix",
")",
"# The width of the matrix is the length of its longest row.",
"width",
"=",
"max",
... | Given a matrix as a list of lists, add a column to the right, filling in
with a default value if necessary. | [
"Given",
"a",
"matrix",
"as",
"a",
"list",
"of",
"lists",
"add",
"a",
"column",
"to",
"the",
"right",
"filling",
"in",
"with",
"a",
"default",
"value",
"if",
"necessary",
"."
] | 744ca8394676579cfb11e5c297c9bd794ab5bd78 | https://github.com/chrisbouchard/braillegraph/blob/744ca8394676579cfb11e5c297c9bd794ab5bd78/braillegraph/braillegraph.py#L89-L120 |
39,381 | chrisbouchard/braillegraph | braillegraph/braillegraph.py | vertical_graph | def vertical_graph(*args, sep='\n'):
r"""Consume an iterable of integers and produce a vertical bar graph using
braille characters.
The graph is vertical in that its dependent axis is the vertical axis. Thus
each value is represented as a row running left to right, and values are
listed top to bott... | python | def vertical_graph(*args, sep='\n'):
r"""Consume an iterable of integers and produce a vertical bar graph using
braille characters.
The graph is vertical in that its dependent axis is the vertical axis. Thus
each value is represented as a row running left to right, and values are
listed top to bott... | [
"def",
"vertical_graph",
"(",
"*",
"args",
",",
"sep",
"=",
"'\\n'",
")",
":",
"lines",
"=",
"[",
"]",
"# If the arguments were passed as a single iterable, pull it out.",
"# Otherwise, just use them as-is.",
"if",
"len",
"(",
"args",
")",
"==",
"1",
":",
"bars",
... | r"""Consume an iterable of integers and produce a vertical bar graph using
braille characters.
The graph is vertical in that its dependent axis is the vertical axis. Thus
each value is represented as a row running left to right, and values are
listed top to bottom.
If the iterable contains more th... | [
"r",
"Consume",
"an",
"iterable",
"of",
"integers",
"and",
"produce",
"a",
"vertical",
"bar",
"graph",
"using",
"braille",
"characters",
"."
] | 744ca8394676579cfb11e5c297c9bd794ab5bd78 | https://github.com/chrisbouchard/braillegraph/blob/744ca8394676579cfb11e5c297c9bd794ab5bd78/braillegraph/braillegraph.py#L123-L204 |
39,382 | chrisbouchard/braillegraph | braillegraph/braillegraph.py | horizontal_graph | def horizontal_graph(*args):
r"""Consume an iterable of integers and produce a horizontal bar graph using
braille characters.
The graph is horizontal in that its dependent axis is the horizontal axis.
Thus each value is represented as a column running bottom to top, and
values are listed left to ri... | python | def horizontal_graph(*args):
r"""Consume an iterable of integers and produce a horizontal bar graph using
braille characters.
The graph is horizontal in that its dependent axis is the horizontal axis.
Thus each value is represented as a column running bottom to top, and
values are listed left to ri... | [
"def",
"horizontal_graph",
"(",
"*",
"args",
")",
":",
"lines",
"=",
"[",
"]",
"# If the arguments were passed as a single iterable, pull it out.",
"# Otherwise, just use them as-is.",
"if",
"len",
"(",
"args",
")",
"==",
"1",
":",
"bars",
"=",
"args",
"[",
"0",
"... | r"""Consume an iterable of integers and produce a horizontal bar graph using
braille characters.
The graph is horizontal in that its dependent axis is the horizontal axis.
Thus each value is represented as a column running bottom to top, and
values are listed left to right.
The graph is anchored t... | [
"r",
"Consume",
"an",
"iterable",
"of",
"integers",
"and",
"produce",
"a",
"horizontal",
"bar",
"graph",
"using",
"braille",
"characters",
"."
] | 744ca8394676579cfb11e5c297c9bd794ab5bd78 | https://github.com/chrisbouchard/braillegraph/blob/744ca8394676579cfb11e5c297c9bd794ab5bd78/braillegraph/braillegraph.py#L207-L283 |
39,383 | kevinconway/confpy | confpy/example.py | generate_example | def generate_example(config, ext='json'):
"""Generate an example file based on the given Configuration object.
Args:
config (confpy.core.configuration.Configuration): The configuration
object on which to base the example.
ext (str): The file extension to render. Choices: JSON and IN... | python | def generate_example(config, ext='json'):
"""Generate an example file based on the given Configuration object.
Args:
config (confpy.core.configuration.Configuration): The configuration
object on which to base the example.
ext (str): The file extension to render. Choices: JSON and IN... | [
"def",
"generate_example",
"(",
"config",
",",
"ext",
"=",
"'json'",
")",
":",
"template_name",
"=",
"'example.{0}'",
".",
"format",
"(",
"ext",
".",
"lower",
"(",
")",
")",
"template",
"=",
"ENV",
".",
"get_template",
"(",
"template_name",
")",
"return",
... | Generate an example file based on the given Configuration object.
Args:
config (confpy.core.configuration.Configuration): The configuration
object on which to base the example.
ext (str): The file extension to render. Choices: JSON and INI.
Returns:
str: The text of the exa... | [
"Generate",
"an",
"example",
"file",
"based",
"on",
"the",
"given",
"Configuration",
"object",
"."
] | 1ee8afcab46ac6915a5ff4184180434ac7b84a60 | https://github.com/kevinconway/confpy/blob/1ee8afcab46ac6915a5ff4184180434ac7b84a60/confpy/example.py#L60-L73 |
39,384 | hollenstein/maspy | maspy/_proteindb_refactoring.py | _removeHeaderTag | def _removeHeaderTag(header, tag):
"""Removes a tag from the beginning of a header string.
:param header: str
:param tag: str
:returns: (str, bool), header without the tag and a bool that indicates
wheter the tag was present.
"""
if header.startswith(tag):
tagPresent = True
... | python | def _removeHeaderTag(header, tag):
"""Removes a tag from the beginning of a header string.
:param header: str
:param tag: str
:returns: (str, bool), header without the tag and a bool that indicates
wheter the tag was present.
"""
if header.startswith(tag):
tagPresent = True
... | [
"def",
"_removeHeaderTag",
"(",
"header",
",",
"tag",
")",
":",
"if",
"header",
".",
"startswith",
"(",
"tag",
")",
":",
"tagPresent",
"=",
"True",
"header",
"=",
"header",
"[",
"len",
"(",
"tag",
")",
":",
"]",
"else",
":",
"tagPresent",
"=",
"False... | Removes a tag from the beginning of a header string.
:param header: str
:param tag: str
:returns: (str, bool), header without the tag and a bool that indicates
wheter the tag was present. | [
"Removes",
"a",
"tag",
"from",
"the",
"beginning",
"of",
"a",
"header",
"string",
"."
] | f15fcfd24df306d8420540460d902aa3073ec133 | https://github.com/hollenstein/maspy/blob/f15fcfd24df306d8420540460d902aa3073ec133/maspy/_proteindb_refactoring.py#L448-L461 |
39,385 | hollenstein/maspy | maspy/_proteindb_refactoring.py | _idFromHeaderInfo | def _idFromHeaderInfo(headerInfo, isDecoy, decoyTag):
"""Generates a protein id from headerInfo. If "isDecoy" is True, the
"decoyTag" is added to beginning of the generated protein id.
:param headerInfo: dict, must contain a key "id"
:param isDecoy: bool, determines if the "decoyTag" is added or not.
... | python | def _idFromHeaderInfo(headerInfo, isDecoy, decoyTag):
"""Generates a protein id from headerInfo. If "isDecoy" is True, the
"decoyTag" is added to beginning of the generated protein id.
:param headerInfo: dict, must contain a key "id"
:param isDecoy: bool, determines if the "decoyTag" is added or not.
... | [
"def",
"_idFromHeaderInfo",
"(",
"headerInfo",
",",
"isDecoy",
",",
"decoyTag",
")",
":",
"proteinId",
"=",
"headerInfo",
"[",
"'id'",
"]",
"if",
"isDecoy",
":",
"proteinId",
"=",
"''",
".",
"join",
"(",
"(",
"decoyTag",
",",
"proteinId",
")",
")",
"retu... | Generates a protein id from headerInfo. If "isDecoy" is True, the
"decoyTag" is added to beginning of the generated protein id.
:param headerInfo: dict, must contain a key "id"
:param isDecoy: bool, determines if the "decoyTag" is added or not.
:param decoyTag: str, a tag that identifies decoy / revers... | [
"Generates",
"a",
"protein",
"id",
"from",
"headerInfo",
".",
"If",
"isDecoy",
"is",
"True",
"the",
"decoyTag",
"is",
"added",
"to",
"beginning",
"of",
"the",
"generated",
"protein",
"id",
"."
] | f15fcfd24df306d8420540460d902aa3073ec133 | https://github.com/hollenstein/maspy/blob/f15fcfd24df306d8420540460d902aa3073ec133/maspy/_proteindb_refactoring.py#L496-L509 |
39,386 | hollenstein/maspy | maspy/_proteindb_refactoring.py | _nameFromHeaderInfo | def _nameFromHeaderInfo(headerInfo, isDecoy, decoyTag):
"""Generates a protein name from headerInfo. If "isDecoy" is True, the
"decoyTag" is added to beginning of the generated protein name.
:param headerInfo: dict, must contain a key "name" or "id"
:param isDecoy: bool, determines if the "decoyTag" is... | python | def _nameFromHeaderInfo(headerInfo, isDecoy, decoyTag):
"""Generates a protein name from headerInfo. If "isDecoy" is True, the
"decoyTag" is added to beginning of the generated protein name.
:param headerInfo: dict, must contain a key "name" or "id"
:param isDecoy: bool, determines if the "decoyTag" is... | [
"def",
"_nameFromHeaderInfo",
"(",
"headerInfo",
",",
"isDecoy",
",",
"decoyTag",
")",
":",
"if",
"'name'",
"in",
"headerInfo",
":",
"proteinName",
"=",
"headerInfo",
"[",
"'name'",
"]",
"else",
":",
"proteinName",
"=",
"headerInfo",
"[",
"'id'",
"]",
"if",
... | Generates a protein name from headerInfo. If "isDecoy" is True, the
"decoyTag" is added to beginning of the generated protein name.
:param headerInfo: dict, must contain a key "name" or "id"
:param isDecoy: bool, determines if the "decoyTag" is added or not.
:param decoyTag: str, a tag that identifies ... | [
"Generates",
"a",
"protein",
"name",
"from",
"headerInfo",
".",
"If",
"isDecoy",
"is",
"True",
"the",
"decoyTag",
"is",
"added",
"to",
"beginning",
"of",
"the",
"generated",
"protein",
"name",
"."
] | f15fcfd24df306d8420540460d902aa3073ec133 | https://github.com/hollenstein/maspy/blob/f15fcfd24df306d8420540460d902aa3073ec133/maspy/_proteindb_refactoring.py#L512-L528 |
39,387 | hollenstein/maspy | maspy/_proteindb_refactoring.py | ProteinDatabase._addPeptide | def _addPeptide(self, sequence, proteinId, digestInfo):
"""Add a peptide to the protein database.
:param sequence: str, amino acid sequence
:param proteinId: str, proteinId
:param digestInfo: dict, contains information about the in silico digest
must contain the keys 'missed... | python | def _addPeptide(self, sequence, proteinId, digestInfo):
"""Add a peptide to the protein database.
:param sequence: str, amino acid sequence
:param proteinId: str, proteinId
:param digestInfo: dict, contains information about the in silico digest
must contain the keys 'missed... | [
"def",
"_addPeptide",
"(",
"self",
",",
"sequence",
",",
"proteinId",
",",
"digestInfo",
")",
":",
"stdSequence",
"=",
"self",
".",
"getStdSequence",
"(",
"sequence",
")",
"if",
"stdSequence",
"not",
"in",
"self",
".",
"peptides",
":",
"self",
".",
"peptid... | Add a peptide to the protein database.
:param sequence: str, amino acid sequence
:param proteinId: str, proteinId
:param digestInfo: dict, contains information about the in silico digest
must contain the keys 'missedCleavage', 'startPos' and 'endPos' | [
"Add",
"a",
"peptide",
"to",
"the",
"protein",
"database",
"."
] | f15fcfd24df306d8420540460d902aa3073ec133 | https://github.com/hollenstein/maspy/blob/f15fcfd24df306d8420540460d902aa3073ec133/maspy/_proteindb_refactoring.py#L113-L137 |
39,388 | Nextdoor/dutch-boy | dutch_boy/nose/plugin.py | LeakDetectorPlugin.configure | def configure(self, options, conf):
"""
Configure plugin.
"""
super(LeakDetectorPlugin, self).configure(options, conf)
if options.leak_detector_level:
self.reporting_level = int(options.leak_detector_level)
self.report_delta = options.leak_detector_report_delt... | python | def configure(self, options, conf):
"""
Configure plugin.
"""
super(LeakDetectorPlugin, self).configure(options, conf)
if options.leak_detector_level:
self.reporting_level = int(options.leak_detector_level)
self.report_delta = options.leak_detector_report_delt... | [
"def",
"configure",
"(",
"self",
",",
"options",
",",
"conf",
")",
":",
"super",
"(",
"LeakDetectorPlugin",
",",
"self",
")",
".",
"configure",
"(",
"options",
",",
"conf",
")",
"if",
"options",
".",
"leak_detector_level",
":",
"self",
".",
"reporting_leve... | Configure plugin. | [
"Configure",
"plugin",
"."
] | 5e95538e99355d458dcb19299a2d2f0c04c42603 | https://github.com/Nextdoor/dutch-boy/blob/5e95538e99355d458dcb19299a2d2f0c04c42603/dutch_boy/nose/plugin.py#L126-L137 |
39,389 | botstory/botstory | botstory/di/injector_service.py | Injector.bind | def bind(self, instance, auto=False):
"""
Bind deps to instance
:param instance:
:param auto: follow update of DI and refresh binds once we will get something new
:return:
"""
methods = [
(m, cls.__dict__[m])
for cls in inspect.getmro(type... | python | def bind(self, instance, auto=False):
"""
Bind deps to instance
:param instance:
:param auto: follow update of DI and refresh binds once we will get something new
:return:
"""
methods = [
(m, cls.__dict__[m])
for cls in inspect.getmro(type... | [
"def",
"bind",
"(",
"self",
",",
"instance",
",",
"auto",
"=",
"False",
")",
":",
"methods",
"=",
"[",
"(",
"m",
",",
"cls",
".",
"__dict__",
"[",
"m",
"]",
")",
"for",
"cls",
"in",
"inspect",
".",
"getmro",
"(",
"type",
"(",
"instance",
")",
"... | Bind deps to instance
:param instance:
:param auto: follow update of DI and refresh binds once we will get something new
:return: | [
"Bind",
"deps",
"to",
"instance"
] | 9c5b2fc7f7a14dbd467d70f60d5ba855ef89dac3 | https://github.com/botstory/botstory/blob/9c5b2fc7f7a14dbd467d70f60d5ba855ef89dac3/botstory/di/injector_service.py#L175-L202 |
39,390 | leodesouza/pyenty | pyenty/types.py | Entity.as_dict | def as_dict(self):
""" create a dict based on class attributes """
odict = OrderedDict()
for name in self._order:
attr_value = getattr(self, name)
if isinstance(attr_value, List):
_list = []
for item in attr_value:
_list... | python | def as_dict(self):
""" create a dict based on class attributes """
odict = OrderedDict()
for name in self._order:
attr_value = getattr(self, name)
if isinstance(attr_value, List):
_list = []
for item in attr_value:
_list... | [
"def",
"as_dict",
"(",
"self",
")",
":",
"odict",
"=",
"OrderedDict",
"(",
")",
"for",
"name",
"in",
"self",
".",
"_order",
":",
"attr_value",
"=",
"getattr",
"(",
"self",
",",
"name",
")",
"if",
"isinstance",
"(",
"attr_value",
",",
"List",
")",
":"... | create a dict based on class attributes | [
"create",
"a",
"dict",
"based",
"on",
"class",
"attributes"
] | 20d2834eada4b971208e816b387479c4fb6ffe61 | https://github.com/leodesouza/pyenty/blob/20d2834eada4b971208e816b387479c4fb6ffe61/pyenty/types.py#L145-L159 |
39,391 | leodesouza/pyenty | pyenty/types.py | Entity.map | def map(cls, dict_entity):
""" staticmethod which will be used in recursive mode in order to map dict to instance """
for key, value in dict_entity.items():
if hasattr(cls, key):
if isinstance(value, list):
_list = getattr(cls, key)
if ... | python | def map(cls, dict_entity):
""" staticmethod which will be used in recursive mode in order to map dict to instance """
for key, value in dict_entity.items():
if hasattr(cls, key):
if isinstance(value, list):
_list = getattr(cls, key)
if ... | [
"def",
"map",
"(",
"cls",
",",
"dict_entity",
")",
":",
"for",
"key",
",",
"value",
"in",
"dict_entity",
".",
"items",
"(",
")",
":",
"if",
"hasattr",
"(",
"cls",
",",
"key",
")",
":",
"if",
"isinstance",
"(",
"value",
",",
"list",
")",
":",
"_li... | staticmethod which will be used in recursive mode in order to map dict to instance | [
"staticmethod",
"which",
"will",
"be",
"used",
"in",
"recursive",
"mode",
"in",
"order",
"to",
"map",
"dict",
"to",
"instance"
] | 20d2834eada4b971208e816b387479c4fb6ffe61 | https://github.com/leodesouza/pyenty/blob/20d2834eada4b971208e816b387479c4fb6ffe61/pyenty/types.py#L162-L179 |
39,392 | hollenstein/maspy | maspy_resources/pparse.py | generateParams | def generateParams(rawfilepath, outputpath, isolationWindow, coElute):
"""Generates a string containing the parameters for a pParse parameter file
but doesn't write any file yet.
:param rawfilepath: location of the thermo ".raw" file
:param outputpath: path to the output directory of pParse
:param ... | python | def generateParams(rawfilepath, outputpath, isolationWindow, coElute):
"""Generates a string containing the parameters for a pParse parameter file
but doesn't write any file yet.
:param rawfilepath: location of the thermo ".raw" file
:param outputpath: path to the output directory of pParse
:param ... | [
"def",
"generateParams",
"(",
"rawfilepath",
",",
"outputpath",
",",
"isolationWindow",
",",
"coElute",
")",
":",
"output",
"=",
"str",
"(",
")",
"#Basic options",
"output",
"=",
"'\\n'",
".",
"join",
"(",
"[",
"output",
",",
"' = '",
".",
"join",
"(",
"... | Generates a string containing the parameters for a pParse parameter file
but doesn't write any file yet.
:param rawfilepath: location of the thermo ".raw" file
:param outputpath: path to the output directory of pParse
:param isolationWindow: MSn isolation window that was used for the
aquisition... | [
"Generates",
"a",
"string",
"containing",
"the",
"parameters",
"for",
"a",
"pParse",
"parameter",
"file",
"but",
"doesn",
"t",
"write",
"any",
"file",
"yet",
"."
] | f15fcfd24df306d8420540460d902aa3073ec133 | https://github.com/hollenstein/maspy/blob/f15fcfd24df306d8420540460d902aa3073ec133/maspy_resources/pparse.py#L41-L117 |
39,393 | hollenstein/maspy | maspy_resources/pparse.py | writeParams | def writeParams(rawfilepath, outputpath, isolationWindow, coElute=0):
"""Generate and write a pParse parameter file.
:param rawfilepath: location of the thermo ".raw" file
:param outputpath: path to the output directory of pParse
:param isolationWindow: MSn isolation window that was used for the
... | python | def writeParams(rawfilepath, outputpath, isolationWindow, coElute=0):
"""Generate and write a pParse parameter file.
:param rawfilepath: location of the thermo ".raw" file
:param outputpath: path to the output directory of pParse
:param isolationWindow: MSn isolation window that was used for the
... | [
"def",
"writeParams",
"(",
"rawfilepath",
",",
"outputpath",
",",
"isolationWindow",
",",
"coElute",
"=",
"0",
")",
":",
"paramText",
"=",
"generateParams",
"(",
"rawfilepath",
",",
"outputpath",
",",
"isolationWindow",
",",
"coElute",
")",
"filename",
",",
"f... | Generate and write a pParse parameter file.
:param rawfilepath: location of the thermo ".raw" file
:param outputpath: path to the output directory of pParse
:param isolationWindow: MSn isolation window that was used for the
aquisition of the specified thermo raw file
:param coElute:
:retur... | [
"Generate",
"and",
"write",
"a",
"pParse",
"parameter",
"file",
"."
] | f15fcfd24df306d8420540460d902aa3073ec133 | https://github.com/hollenstein/maspy/blob/f15fcfd24df306d8420540460d902aa3073ec133/maspy_resources/pparse.py#L120-L137 |
39,394 | hollenstein/maspy | maspy_resources/pparse.py | execute | def execute(paramPath, executable='pParse.exe'):
"""Execute pParse with the specified parameter file.
:param paramPath: location of the pParse parameter file
:param executable: must specify the complete file path of the pParse.exe
if its location is not in the ``PATH`` environment variable.
:r... | python | def execute(paramPath, executable='pParse.exe'):
"""Execute pParse with the specified parameter file.
:param paramPath: location of the pParse parameter file
:param executable: must specify the complete file path of the pParse.exe
if its location is not in the ``PATH`` environment variable.
:r... | [
"def",
"execute",
"(",
"paramPath",
",",
"executable",
"=",
"'pParse.exe'",
")",
":",
"procArgs",
"=",
"[",
"executable",
",",
"paramPath",
"]",
"## run it ##",
"proc",
"=",
"subprocess",
".",
"Popen",
"(",
"procArgs",
",",
"stderr",
"=",
"subprocess",
".",
... | Execute pParse with the specified parameter file.
:param paramPath: location of the pParse parameter file
:param executable: must specify the complete file path of the pParse.exe
if its location is not in the ``PATH`` environment variable.
:returns: :func:`subprocess.Popen` return code, 0 if pPars... | [
"Execute",
"pParse",
"with",
"the",
"specified",
"parameter",
"file",
"."
] | f15fcfd24df306d8420540460d902aa3073ec133 | https://github.com/hollenstein/maspy/blob/f15fcfd24df306d8420540460d902aa3073ec133/maspy_resources/pparse.py#L140-L164 |
39,395 | hollenstein/maspy | maspy_resources/pparse.py | cleanUpPparse | def cleanUpPparse(outputpath, rawfilename, mgf=False):
"""Delete temporary files generated by pparse, including the filetypes
".csv", ".ms1", ".ms2", ".xtract", the files "pParsePlusLog.txt" and
"pParse.para" and optionally also the ".mgf" file generated by pParse.
.. warning:
When the paramet... | python | def cleanUpPparse(outputpath, rawfilename, mgf=False):
"""Delete temporary files generated by pparse, including the filetypes
".csv", ".ms1", ".ms2", ".xtract", the files "pParsePlusLog.txt" and
"pParse.para" and optionally also the ".mgf" file generated by pParse.
.. warning:
When the paramet... | [
"def",
"cleanUpPparse",
"(",
"outputpath",
",",
"rawfilename",
",",
"mgf",
"=",
"False",
")",
":",
"extensions",
"=",
"[",
"'csv'",
",",
"'ms1'",
",",
"'ms2'",
",",
"'xtract'",
"]",
"filename",
",",
"fileext",
"=",
"os",
".",
"path",
".",
"splitext",
"... | Delete temporary files generated by pparse, including the filetypes
".csv", ".ms1", ".ms2", ".xtract", the files "pParsePlusLog.txt" and
"pParse.para" and optionally also the ".mgf" file generated by pParse.
.. warning:
When the parameter "mgf" is set to "True" all files ending with ".mgf"
... | [
"Delete",
"temporary",
"files",
"generated",
"by",
"pparse",
"including",
"the",
"filetypes",
".",
"csv",
".",
"ms1",
".",
"ms2",
".",
"xtract",
"the",
"files",
"pParsePlusLog",
".",
"txt",
"and",
"pParse",
".",
"para",
"and",
"optionally",
"also",
"the",
... | f15fcfd24df306d8420540460d902aa3073ec133 | https://github.com/hollenstein/maspy/blob/f15fcfd24df306d8420540460d902aa3073ec133/maspy_resources/pparse.py#L167-L205 |
39,396 | dturanski/springcloudstream | springcloudstream/tcp/tcp.py | StreamHandler.create_handler | def create_handler(cls, message_handler, buffer_size, logger):
"""
Class variables used here since the framework creates an instance for each connection
:param message_handler: the MessageHandler used to process each message.
:param buffer_size: the TCP buffer size.
:param logge... | python | def create_handler(cls, message_handler, buffer_size, logger):
"""
Class variables used here since the framework creates an instance for each connection
:param message_handler: the MessageHandler used to process each message.
:param buffer_size: the TCP buffer size.
:param logge... | [
"def",
"create_handler",
"(",
"cls",
",",
"message_handler",
",",
"buffer_size",
",",
"logger",
")",
":",
"cls",
".",
"BUFFER_SIZE",
"=",
"buffer_size",
"cls",
".",
"message_handler",
"=",
"message_handler",
"cls",
".",
"logger",
"=",
"logger",
"cls",
".",
"... | Class variables used here since the framework creates an instance for each connection
:param message_handler: the MessageHandler used to process each message.
:param buffer_size: the TCP buffer size.
:param logger: the global logger.
:return: this class. | [
"Class",
"variables",
"used",
"here",
"since",
"the",
"framework",
"creates",
"an",
"instance",
"for",
"each",
"connection"
] | 208b542f9eba82e97882d52703af8e965a62a980 | https://github.com/dturanski/springcloudstream/blob/208b542f9eba82e97882d52703af8e965a62a980/springcloudstream/tcp/tcp.py#L97-L112 |
39,397 | dturanski/springcloudstream | springcloudstream/tcp/tcp.py | StreamHandler.handle | def handle(self):
"""
The required handle method.
"""
logger = StreamHandler.logger
logger.debug("handling requests with message handler %s " % StreamHandler.message_handler.__class__.__name__)
message_handler = StreamHandler.message_handler
try:
whi... | python | def handle(self):
"""
The required handle method.
"""
logger = StreamHandler.logger
logger.debug("handling requests with message handler %s " % StreamHandler.message_handler.__class__.__name__)
message_handler = StreamHandler.message_handler
try:
whi... | [
"def",
"handle",
"(",
"self",
")",
":",
"logger",
"=",
"StreamHandler",
".",
"logger",
"logger",
".",
"debug",
"(",
"\"handling requests with message handler %s \"",
"%",
"StreamHandler",
".",
"message_handler",
".",
"__class__",
".",
"__name__",
")",
"message_handl... | The required handle method. | [
"The",
"required",
"handle",
"method",
"."
] | 208b542f9eba82e97882d52703af8e965a62a980 | https://github.com/dturanski/springcloudstream/blob/208b542f9eba82e97882d52703af8e965a62a980/springcloudstream/tcp/tcp.py#L114-L134 |
39,398 | sporsh/carnifex | carnifex/ssh/client.py | SSHTransport.receiveError | def receiveError(self, reasonCode, description):
"""
Called when we receive a disconnect error message from the other
side.
"""
error = disconnectErrors.get(reasonCode, DisconnectError)
self.connectionClosed(error(reasonCode, description))
SSHClientTransport.recei... | python | def receiveError(self, reasonCode, description):
"""
Called when we receive a disconnect error message from the other
side.
"""
error = disconnectErrors.get(reasonCode, DisconnectError)
self.connectionClosed(error(reasonCode, description))
SSHClientTransport.recei... | [
"def",
"receiveError",
"(",
"self",
",",
"reasonCode",
",",
"description",
")",
":",
"error",
"=",
"disconnectErrors",
".",
"get",
"(",
"reasonCode",
",",
"DisconnectError",
")",
"self",
".",
"connectionClosed",
"(",
"error",
"(",
"reasonCode",
",",
"descripti... | Called when we receive a disconnect error message from the other
side. | [
"Called",
"when",
"we",
"receive",
"a",
"disconnect",
"error",
"message",
"from",
"the",
"other",
"side",
"."
] | 82dd3bd2bc134dfb69a78f43171e227f2127060b | https://github.com/sporsh/carnifex/blob/82dd3bd2bc134dfb69a78f43171e227f2127060b/carnifex/ssh/client.py#L44-L51 |
39,399 | invinst/ResponseBot | responsebot/handlers/event.py | BaseEventHandler.handle | def handle(self, event):
"""
Entry point to handle user events.
:param event: Received event. See a full list `here <https://dev.twitter.com/streaming/overview/messages-types#Events_event>`_.
"""
callback = getattr(self, 'on_{event}'.format(event=event.event), None)
call... | python | def handle(self, event):
"""
Entry point to handle user events.
:param event: Received event. See a full list `here <https://dev.twitter.com/streaming/overview/messages-types#Events_event>`_.
"""
callback = getattr(self, 'on_{event}'.format(event=event.event), None)
call... | [
"def",
"handle",
"(",
"self",
",",
"event",
")",
":",
"callback",
"=",
"getattr",
"(",
"self",
",",
"'on_{event}'",
".",
"format",
"(",
"event",
"=",
"event",
".",
"event",
")",
",",
"None",
")",
"callback",
"(",
"event",
")"
] | Entry point to handle user events.
:param event: Received event. See a full list `here <https://dev.twitter.com/streaming/overview/messages-types#Events_event>`_. | [
"Entry",
"point",
"to",
"handle",
"user",
"events",
"."
] | a6b1a431a343007f7ae55a193e432a61af22253f | https://github.com/invinst/ResponseBot/blob/a6b1a431a343007f7ae55a193e432a61af22253f/responsebot/handlers/event.py#L13-L20 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.