partition stringclasses 3
values | func_name stringlengths 1 134 | docstring stringlengths 1 46.9k | path stringlengths 4 223 | original_string stringlengths 75 104k | code stringlengths 75 104k | docstring_tokens listlengths 1 1.97k | repo stringlengths 7 55 | language stringclasses 1
value | url stringlengths 87 315 | code_tokens listlengths 19 28.4k | sha stringlengths 40 40 |
|---|---|---|---|---|---|---|---|---|---|---|---|
valid | Api.pull_stream | This will try to pull in a stream from an external source. Once a
stream has been successfully pulled it is assigned a 'local stream
name' which can be used to access the stream from the EMS.
:param uri: The URI of the external stream. Can be RTMP, RTSP or
unicast/multicast (d) mpeg... | pyems/__init__.py | def pull_stream(self, uri, **kwargs):
"""
This will try to pull in a stream from an external source. Once a
stream has been successfully pulled it is assigned a 'local stream
name' which can be used to access the stream from the EMS.
:param uri: The URI of the external stream. C... | def pull_stream(self, uri, **kwargs):
"""
This will try to pull in a stream from an external source. Once a
stream has been successfully pulled it is assigned a 'local stream
name' which can be used to access the stream from the EMS.
:param uri: The URI of the external stream. C... | [
"This",
"will",
"try",
"to",
"pull",
"in",
"a",
"stream",
"from",
"an",
"external",
"source",
".",
"Once",
"a",
"stream",
"has",
"been",
"successfully",
"pulled",
"it",
"is",
"assigned",
"a",
"local",
"stream",
"name",
"which",
"can",
"be",
"used",
"to",... | tomi77/pyems | python | https://github.com/tomi77/pyems/blob/8c0748b720d389f19d5226fdcceedc26cd6284ee/pyems/__init__.py#L23-L119 | [
"def",
"pull_stream",
"(",
"self",
",",
"uri",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"self",
".",
"protocol",
".",
"execute",
"(",
"'pullStream'",
",",
"uri",
"=",
"uri",
",",
"*",
"*",
"kwargs",
")"
] | 8c0748b720d389f19d5226fdcceedc26cd6284ee |
valid | Api.push_stream | Try to push a local stream to an external destination. The pushed
stream can only use the RTMP, RTSP or MPEG-TS unicast/multicast
protocol.
:param uri: The URI of the external stream. Can be RTMP, RTSP or
unicast/multicast (d) mpegts
:type uri: str
:param keepAlive:... | pyems/__init__.py | def push_stream(self, uri, **kwargs):
"""
Try to push a local stream to an external destination. The pushed
stream can only use the RTMP, RTSP or MPEG-TS unicast/multicast
protocol.
:param uri: The URI of the external stream. Can be RTMP, RTSP or
unicast/multicast (d... | def push_stream(self, uri, **kwargs):
"""
Try to push a local stream to an external destination. The pushed
stream can only use the RTMP, RTSP or MPEG-TS unicast/multicast
protocol.
:param uri: The URI of the external stream. Can be RTMP, RTSP or
unicast/multicast (d... | [
"Try",
"to",
"push",
"a",
"local",
"stream",
"to",
"an",
"external",
"destination",
".",
"The",
"pushed",
"stream",
"can",
"only",
"use",
"the",
"RTMP",
"RTSP",
"or",
"MPEG",
"-",
"TS",
"unicast",
"/",
"multicast",
"protocol",
"."
] | tomi77/pyems | python | https://github.com/tomi77/pyems/blob/8c0748b720d389f19d5226fdcceedc26cd6284ee/pyems/__init__.py#L125-L196 | [
"def",
"push_stream",
"(",
"self",
",",
"uri",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"self",
".",
"protocol",
".",
"execute",
"(",
"'pushStream'",
",",
"uri",
"=",
"uri",
",",
"*",
"*",
"kwargs",
")"
] | 8c0748b720d389f19d5226fdcceedc26cd6284ee |
valid | Api.create_hls_stream | Create an HTTP Live Stream (HLS) out of an existing H.264/AAC stream.
HLS is used to stream live feeds to iOS devices such as iPhones and
iPads.
:param localStreamNames: The stream(s) that will be used as the input.
This is a comma-delimited list of active stream names (local stream... | pyems/__init__.py | def create_hls_stream(self, localStreamNames, targetFolder, **kwargs):
"""
Create an HTTP Live Stream (HLS) out of an existing H.264/AAC stream.
HLS is used to stream live feeds to iOS devices such as iPhones and
iPads.
:param localStreamNames: The stream(s) that will be used as... | def create_hls_stream(self, localStreamNames, targetFolder, **kwargs):
"""
Create an HTTP Live Stream (HLS) out of an existing H.264/AAC stream.
HLS is used to stream live feeds to iOS devices such as iPhones and
iPads.
:param localStreamNames: The stream(s) that will be used as... | [
"Create",
"an",
"HTTP",
"Live",
"Stream",
"(",
"HLS",
")",
"out",
"of",
"an",
"existing",
"H",
".",
"264",
"/",
"AAC",
"stream",
".",
"HLS",
"is",
"used",
"to",
"stream",
"live",
"feeds",
"to",
"iOS",
"devices",
"such",
"as",
"iPhones",
"and",
"iPads... | tomi77/pyems | python | https://github.com/tomi77/pyems/blob/8c0748b720d389f19d5226fdcceedc26cd6284ee/pyems/__init__.py#L206-L331 | [
"def",
"create_hls_stream",
"(",
"self",
",",
"localStreamNames",
",",
"targetFolder",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"self",
".",
"protocol",
".",
"execute",
"(",
"'createhlsstream'",
",",
"localStreamNames",
"=",
"localStreamNames",
",",
"targetF... | 8c0748b720d389f19d5226fdcceedc26cd6284ee |
valid | Api.create_hds_stream | Create an HDS (HTTP Dynamic Streaming) stream out of an existing
H.264/AAC stream. HDS is used to stream standard MP4 media over
regular HTTP connections.
:param localStreamNames: The stream(s) that will be used as the input.
This is a comma-delimited list of active stream names (lo... | pyems/__init__.py | def create_hds_stream(self, localStreamNames, targetFolder, **kwargs):
"""
Create an HDS (HTTP Dynamic Streaming) stream out of an existing
H.264/AAC stream. HDS is used to stream standard MP4 media over
regular HTTP connections.
:param localStreamNames: The stream(s) that will ... | def create_hds_stream(self, localStreamNames, targetFolder, **kwargs):
"""
Create an HDS (HTTP Dynamic Streaming) stream out of an existing
H.264/AAC stream. HDS is used to stream standard MP4 media over
regular HTTP connections.
:param localStreamNames: The stream(s) that will ... | [
"Create",
"an",
"HDS",
"(",
"HTTP",
"Dynamic",
"Streaming",
")",
"stream",
"out",
"of",
"an",
"existing",
"H",
".",
"264",
"/",
"AAC",
"stream",
".",
"HDS",
"is",
"used",
"to",
"stream",
"standard",
"MP4",
"media",
"over",
"regular",
"HTTP",
"connections... | tomi77/pyems | python | https://github.com/tomi77/pyems/blob/8c0748b720d389f19d5226fdcceedc26cd6284ee/pyems/__init__.py#L338-L413 | [
"def",
"create_hds_stream",
"(",
"self",
",",
"localStreamNames",
",",
"targetFolder",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"self",
".",
"protocol",
".",
"execute",
"(",
"'createhdsstream'",
",",
"localStreamNames",
"=",
"localStreamNames",
",",
"targetF... | 8c0748b720d389f19d5226fdcceedc26cd6284ee |
valid | Api.create_mss_stream | Create a Microsoft Smooth Stream (MSS) out of an existing H.264/AAC
stream. Smooth Streaming was developed by Microsoft to compete with
other adaptive streaming technologies.
:param localStreamNames: The stream(s) that will be used as the input.
This is a comma-delimited list of act... | pyems/__init__.py | def create_mss_stream(self, localStreamNames, targetFolder, **kwargs):
"""
Create a Microsoft Smooth Stream (MSS) out of an existing H.264/AAC
stream. Smooth Streaming was developed by Microsoft to compete with
other adaptive streaming technologies.
:param localStreamNames: The ... | def create_mss_stream(self, localStreamNames, targetFolder, **kwargs):
"""
Create a Microsoft Smooth Stream (MSS) out of an existing H.264/AAC
stream. Smooth Streaming was developed by Microsoft to compete with
other adaptive streaming technologies.
:param localStreamNames: The ... | [
"Create",
"a",
"Microsoft",
"Smooth",
"Stream",
"(",
"MSS",
")",
"out",
"of",
"an",
"existing",
"H",
".",
"264",
"/",
"AAC",
"stream",
".",
"Smooth",
"Streaming",
"was",
"developed",
"by",
"Microsoft",
"to",
"compete",
"with",
"other",
"adaptive",
"streami... | tomi77/pyems | python | https://github.com/tomi77/pyems/blob/8c0748b720d389f19d5226fdcceedc26cd6284ee/pyems/__init__.py#L420-L503 | [
"def",
"create_mss_stream",
"(",
"self",
",",
"localStreamNames",
",",
"targetFolder",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"self",
".",
"protocol",
".",
"execute",
"(",
"'createmssstream'",
",",
"localStreamNames",
"=",
"localStreamNames",
",",
"targetF... | 8c0748b720d389f19d5226fdcceedc26cd6284ee |
valid | Api.create_dash_stream | Create Dynamic Adaptive Streaming over HTTP (DASH) out of an existing
H.264/AAC stream. DASH was developed by the Moving Picture Experts
Group (MPEG) to establish a standard for HTTP adaptive-bitrate
streaming that would be accepted by multiple vendors and facilitate
interoperability.
... | pyems/__init__.py | def create_dash_stream(self, localStreamNames, targetFolder, **kwargs):
"""
Create Dynamic Adaptive Streaming over HTTP (DASH) out of an existing
H.264/AAC stream. DASH was developed by the Moving Picture Experts
Group (MPEG) to establish a standard for HTTP adaptive-bitrate
stre... | def create_dash_stream(self, localStreamNames, targetFolder, **kwargs):
"""
Create Dynamic Adaptive Streaming over HTTP (DASH) out of an existing
H.264/AAC stream. DASH was developed by the Moving Picture Experts
Group (MPEG) to establish a standard for HTTP adaptive-bitrate
stre... | [
"Create",
"Dynamic",
"Adaptive",
"Streaming",
"over",
"HTTP",
"(",
"DASH",
")",
"out",
"of",
"an",
"existing",
"H",
".",
"264",
"/",
"AAC",
"stream",
".",
"DASH",
"was",
"developed",
"by",
"the",
"Moving",
"Picture",
"Experts",
"Group",
"(",
"MPEG",
")",... | tomi77/pyems | python | https://github.com/tomi77/pyems/blob/8c0748b720d389f19d5226fdcceedc26cd6284ee/pyems/__init__.py#L509-L581 | [
"def",
"create_dash_stream",
"(",
"self",
",",
"localStreamNames",
",",
"targetFolder",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"self",
".",
"protocol",
".",
"execute",
"(",
"'createdashstream'",
",",
"localStreamNames",
"=",
"localStreamNames",
",",
"targe... | 8c0748b720d389f19d5226fdcceedc26cd6284ee |
valid | Api.record | Records any inbound stream. The record command allows users to record
a stream that may not yet exist. When a new stream is brought into
the server, it is checked against a list of streams to be recorded.
Streams can be recorded as FLV files, MPEG-TS files or as MP4 files.
:param local... | pyems/__init__.py | def record(self, localStreamName, pathToFile, **kwargs):
"""
Records any inbound stream. The record command allows users to record
a stream that may not yet exist. When a new stream is brought into
the server, it is checked against a list of streams to be recorded.
Streams can b... | def record(self, localStreamName, pathToFile, **kwargs):
"""
Records any inbound stream. The record command allows users to record
a stream that may not yet exist. When a new stream is brought into
the server, it is checked against a list of streams to be recorded.
Streams can b... | [
"Records",
"any",
"inbound",
"stream",
".",
"The",
"record",
"command",
"allows",
"users",
"to",
"record",
"a",
"stream",
"that",
"may",
"not",
"yet",
"exist",
".",
"When",
"a",
"new",
"stream",
"is",
"brought",
"into",
"the",
"server",
"it",
"is",
"chec... | tomi77/pyems | python | https://github.com/tomi77/pyems/blob/8c0748b720d389f19d5226fdcceedc26cd6284ee/pyems/__init__.py#L586-L635 | [
"def",
"record",
"(",
"self",
",",
"localStreamName",
",",
"pathToFile",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"self",
".",
"protocol",
".",
"execute",
"(",
"'record'",
",",
"localStreamName",
"=",
"localStreamName",
",",
"pathToFile",
"=",
"pathToFil... | 8c0748b720d389f19d5226fdcceedc26cd6284ee |
valid | Api.transcode | Changes the compression characteristics of an audio and/or video
stream. Allows you to change the resolution of a source stream, change
the bitrate of a stream, change a VP8 or MPEG2 stream into H.264 and
much more. Allow users to create overlays on the final stream as well
as crop strea... | pyems/__init__.py | def transcode(self, source, destinations, **kwargs):
"""
Changes the compression characteristics of an audio and/or video
stream. Allows you to change the resolution of a source stream, change
the bitrate of a stream, change a VP8 or MPEG2 stream into H.264 and
much more. Allow u... | def transcode(self, source, destinations, **kwargs):
"""
Changes the compression characteristics of an audio and/or video
stream. Allows you to change the resolution of a source stream, change
the bitrate of a stream, change a VP8 or MPEG2 stream into H.264 and
much more. Allow u... | [
"Changes",
"the",
"compression",
"characteristics",
"of",
"an",
"audio",
"and",
"/",
"or",
"video",
"stream",
".",
"Allows",
"you",
"to",
"change",
"the",
"resolution",
"of",
"a",
"source",
"stream",
"change",
"the",
"bitrate",
"of",
"a",
"stream",
"change",... | tomi77/pyems | python | https://github.com/tomi77/pyems/blob/8c0748b720d389f19d5226fdcceedc26cd6284ee/pyems/__init__.py#L642-L722 | [
"def",
"transcode",
"(",
"self",
",",
"source",
",",
"destinations",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"self",
".",
"protocol",
".",
"execute",
"(",
"'transcode'",
",",
"source",
"=",
"source",
",",
"destinations",
"=",
"destinations",
",",
"*... | 8c0748b720d389f19d5226fdcceedc26cd6284ee |
valid | Api.add_stream_alias | Allows you to create secondary name(s) for internal streams. Once an
alias is created the localstreamname cannot be used to request
playback of that stream. Once an alias is used (requested by a client)
the alias is removed. Aliases are designed to be used to protect/hide
your source str... | pyems/__init__.py | def add_stream_alias(self, localStreamName, aliasName, **kwargs):
"""
Allows you to create secondary name(s) for internal streams. Once an
alias is created the localstreamname cannot be used to request
playback of that stream. Once an alias is used (requested by a client)
the ali... | def add_stream_alias(self, localStreamName, aliasName, **kwargs):
"""
Allows you to create secondary name(s) for internal streams. Once an
alias is created the localstreamname cannot be used to request
playback of that stream. Once an alias is used (requested by a client)
the ali... | [
"Allows",
"you",
"to",
"create",
"secondary",
"name",
"(",
"s",
")",
"for",
"internal",
"streams",
".",
"Once",
"an",
"alias",
"is",
"created",
"the",
"localstreamname",
"cannot",
"be",
"used",
"to",
"request",
"playback",
"of",
"that",
"stream",
".",
"Onc... | tomi77/pyems | python | https://github.com/tomi77/pyems/blob/8c0748b720d389f19d5226fdcceedc26cd6284ee/pyems/__init__.py#L869-L894 | [
"def",
"add_stream_alias",
"(",
"self",
",",
"localStreamName",
",",
"aliasName",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"self",
".",
"protocol",
".",
"execute",
"(",
"'addStreamAlias'",
",",
"localStreamName",
"=",
"localStreamName",
",",
"aliasName",
"... | 8c0748b720d389f19d5226fdcceedc26cd6284ee |
valid | Api.add_group_name_alias | Creates secondary name(s) for group names. Once an alias is created the
group name cannot be used to request HTTP playback of that stream. Once
an alias is used (requested by a client) the alias is removed. Aliases
are designed to be used to protect/hide your source streams.
:param grou... | pyems/__init__.py | def add_group_name_alias(self, groupName, aliasName):
"""
Creates secondary name(s) for group names. Once an alias is created the
group name cannot be used to request HTTP playback of that stream. Once
an alias is used (requested by a client) the alias is removed. Aliases
are des... | def add_group_name_alias(self, groupName, aliasName):
"""
Creates secondary name(s) for group names. Once an alias is created the
group name cannot be used to request HTTP playback of that stream. Once
an alias is used (requested by a client) the alias is removed. Aliases
are des... | [
"Creates",
"secondary",
"name",
"(",
"s",
")",
"for",
"group",
"names",
".",
"Once",
"an",
"alias",
"is",
"created",
"the",
"group",
"name",
"cannot",
"be",
"used",
"to",
"request",
"HTTP",
"playback",
"of",
"that",
"stream",
".",
"Once",
"an",
"alias",
... | tomi77/pyems | python | https://github.com/tomi77/pyems/blob/8c0748b720d389f19d5226fdcceedc26cd6284ee/pyems/__init__.py#L925-L941 | [
"def",
"add_group_name_alias",
"(",
"self",
",",
"groupName",
",",
"aliasName",
")",
":",
"return",
"self",
".",
"protocol",
".",
"execute",
"(",
"'addGroupNameAlias'",
",",
"groupName",
"=",
"groupName",
",",
"aliasName",
"=",
"aliasName",
")"
] | 8c0748b720d389f19d5226fdcceedc26cd6284ee |
valid | Api.create_ingest_point | Creates an RTMP ingest point, which mandates that streams pushed into
the EMS have a target stream name which matches one Ingest Point
privateStreamName.
:param privateStreamName: The name that RTMP Target Stream Names must
match.
:type privateStreamName: str
:param... | pyems/__init__.py | def create_ingest_point(self, privateStreamName, publicStreamName):
"""
Creates an RTMP ingest point, which mandates that streams pushed into
the EMS have a target stream name which matches one Ingest Point
privateStreamName.
:param privateStreamName: The name that RTMP Target S... | def create_ingest_point(self, privateStreamName, publicStreamName):
"""
Creates an RTMP ingest point, which mandates that streams pushed into
the EMS have a target stream name which matches one Ingest Point
privateStreamName.
:param privateStreamName: The name that RTMP Target S... | [
"Creates",
"an",
"RTMP",
"ingest",
"point",
"which",
"mandates",
"that",
"streams",
"pushed",
"into",
"the",
"EMS",
"have",
"a",
"target",
"stream",
"name",
"which",
"matches",
"one",
"Ingest",
"Point",
"privateStreamName",
"."
] | tomi77/pyems | python | https://github.com/tomi77/pyems/blob/8c0748b720d389f19d5226fdcceedc26cd6284ee/pyems/__init__.py#L995-L1014 | [
"def",
"create_ingest_point",
"(",
"self",
",",
"privateStreamName",
",",
"publicStreamName",
")",
":",
"return",
"self",
".",
"protocol",
".",
"execute",
"(",
"'createIngestPoint'",
",",
"privateStreamName",
"=",
"privateStreamName",
",",
"publicStreamName",
"=",
"... | 8c0748b720d389f19d5226fdcceedc26cd6284ee |
valid | Api.start_web_rtc | Starts a WebRTC signalling client to an ERS (Evostream Rendezvous
Server).
:param ersip: IP address (xx.yy.zz.xx) of ERS.
:type ersip: str
:param ersport: IP port of ERS.
:type ersport: int
:param roomId: Unique room Identifier within ERS that will be used by
... | pyems/__init__.py | def start_web_rtc(self, ersip, ersport, roomId):
"""
Starts a WebRTC signalling client to an ERS (Evostream Rendezvous
Server).
:param ersip: IP address (xx.yy.zz.xx) of ERS.
:type ersip: str
:param ersport: IP port of ERS.
:type ersport: int
:param roo... | def start_web_rtc(self, ersip, ersport, roomId):
"""
Starts a WebRTC signalling client to an ERS (Evostream Rendezvous
Server).
:param ersip: IP address (xx.yy.zz.xx) of ERS.
:type ersip: str
:param ersport: IP port of ERS.
:type ersport: int
:param roo... | [
"Starts",
"a",
"WebRTC",
"signalling",
"client",
"to",
"an",
"ERS",
"(",
"Evostream",
"Rendezvous",
"Server",
")",
"."
] | tomi77/pyems | python | https://github.com/tomi77/pyems/blob/8c0748b720d389f19d5226fdcceedc26cd6284ee/pyems/__init__.py#L1038-L1056 | [
"def",
"start_web_rtc",
"(",
"self",
",",
"ersip",
",",
"ersport",
",",
"roomId",
")",
":",
"return",
"self",
".",
"protocol",
".",
"execute",
"(",
"'startwebrtc'",
",",
"ersip",
"=",
"ersip",
",",
"ersport",
"=",
"ersport",
",",
"roomId",
"=",
"roomId",... | 8c0748b720d389f19d5226fdcceedc26cd6284ee |
valid | instantiate | Instantiate the generator and filename specification | dgitcore/datasets/transformation.py | def instantiate(repo, name=None, filename=None):
"""
Instantiate the generator and filename specification
"""
default_transformers = repo.options.get('transformer', {})
# If a name is specified, then lookup the options from dgit.json
# if specfied. Otherwise it is initialized to an empty list ... | def instantiate(repo, name=None, filename=None):
"""
Instantiate the generator and filename specification
"""
default_transformers = repo.options.get('transformer', {})
# If a name is specified, then lookup the options from dgit.json
# if specfied. Otherwise it is initialized to an empty list ... | [
"Instantiate",
"the",
"generator",
"and",
"filename",
"specification"
] | pingali/dgit | python | https://github.com/pingali/dgit/blob/ecde01f40b98f0719dbcfb54452270ed2f86686d/dgitcore/datasets/transformation.py#L16-L65 | [
"def",
"instantiate",
"(",
"repo",
",",
"name",
"=",
"None",
",",
"filename",
"=",
"None",
")",
":",
"default_transformers",
"=",
"repo",
".",
"options",
".",
"get",
"(",
"'transformer'",
",",
"{",
"}",
")",
"# If a name is specified, then lookup the options fro... | ecde01f40b98f0719dbcfb54452270ed2f86686d |
valid | transform | Materialize queries/other content within the repo.
Parameters
----------
repo: Repository object
name: Name of transformer, if any. If none, then all transformers specified in dgit.json will be included.
filename: Pattern that specifies files that must be processed by the generators selected. If n... | dgitcore/datasets/transformation.py | def transform(repo,
name=None,
filename=None,
force=False,
args=[]):
"""
Materialize queries/other content within the repo.
Parameters
----------
repo: Repository object
name: Name of transformer, if any. If none, then all transformers sp... | def transform(repo,
name=None,
filename=None,
force=False,
args=[]):
"""
Materialize queries/other content within the repo.
Parameters
----------
repo: Repository object
name: Name of transformer, if any. If none, then all transformers sp... | [
"Materialize",
"queries",
"/",
"other",
"content",
"within",
"the",
"repo",
"."
] | pingali/dgit | python | https://github.com/pingali/dgit/blob/ecde01f40b98f0719dbcfb54452270ed2f86686d/dgitcore/datasets/transformation.py#L67-L100 | [
"def",
"transform",
"(",
"repo",
",",
"name",
"=",
"None",
",",
"filename",
"=",
"None",
",",
"force",
"=",
"False",
",",
"args",
"=",
"[",
"]",
")",
":",
"mgr",
"=",
"plugins_get_mgr",
"(",
")",
"# Expand the specification. Now we have full file paths",
"sp... | ecde01f40b98f0719dbcfb54452270ed2f86686d |
valid | GitRepoManager._run | Helper function to run commands
Parameters
----------
cmd : list
Arguments to git command | dgitcore/contrib/repomanagers/gitmanager.py | def _run(self, cmd):
"""
Helper function to run commands
Parameters
----------
cmd : list
Arguments to git command
"""
# This is here in case the .gitconfig is not accessible for
# some reason.
environ = os.environ.copy()
... | def _run(self, cmd):
"""
Helper function to run commands
Parameters
----------
cmd : list
Arguments to git command
"""
# This is here in case the .gitconfig is not accessible for
# some reason.
environ = os.environ.copy()
... | [
"Helper",
"function",
"to",
"run",
"commands"
] | pingali/dgit | python | https://github.com/pingali/dgit/blob/ecde01f40b98f0719dbcfb54452270ed2f86686d/dgitcore/contrib/repomanagers/gitmanager.py#L37-L71 | [
"def",
"_run",
"(",
"self",
",",
"cmd",
")",
":",
"# This is here in case the .gitconfig is not accessible for",
"# some reason. ",
"environ",
"=",
"os",
".",
"environ",
".",
"copy",
"(",
")",
"environ",
"[",
"'GIT_COMMITTER_NAME'",
"]",
"=",
"self",
".",
"fullnam... | ecde01f40b98f0719dbcfb54452270ed2f86686d |
valid | GitRepoManager._run_generic_command | Run a generic command within the repo. Assumes that you are
in the repo's root directory | dgitcore/contrib/repomanagers/gitmanager.py | def _run_generic_command(self, repo, cmd):
"""
Run a generic command within the repo. Assumes that you are
in the repo's root directory
"""
result = None
with cd(repo.rootdir):
# Dont use sh. It is not collecting the stdout of all
# child ... | def _run_generic_command(self, repo, cmd):
"""
Run a generic command within the repo. Assumes that you are
in the repo's root directory
"""
result = None
with cd(repo.rootdir):
# Dont use sh. It is not collecting the stdout of all
# child ... | [
"Run",
"a",
"generic",
"command",
"within",
"the",
"repo",
".",
"Assumes",
"that",
"you",
"are",
"in",
"the",
"repo",
"s",
"root",
"directory"
] | pingali/dgit | python | https://github.com/pingali/dgit/blob/ecde01f40b98f0719dbcfb54452270ed2f86686d/dgitcore/contrib/repomanagers/gitmanager.py#L73-L97 | [
"def",
"_run_generic_command",
"(",
"self",
",",
"repo",
",",
"cmd",
")",
":",
"result",
"=",
"None",
"with",
"cd",
"(",
"repo",
".",
"rootdir",
")",
":",
"# Dont use sh. It is not collecting the stdout of all",
"# child processes.",
"output",
"=",
"self",
".",
... | ecde01f40b98f0719dbcfb54452270ed2f86686d |
valid | GitRepoManager.init | Initialize a Git repo
Parameters
----------
username, reponame : Repo name is tuple (name, reponame)
force: force initialization of the repo even if exists
backend: backend that must be used for this (e.g. s3) | dgitcore/contrib/repomanagers/gitmanager.py | def init(self, username, reponame, force, backend=None):
"""
Initialize a Git repo
Parameters
----------
username, reponame : Repo name is tuple (name, reponame)
force: force initialization of the repo even if exists
backend: backend that must be used for this (... | def init(self, username, reponame, force, backend=None):
"""
Initialize a Git repo
Parameters
----------
username, reponame : Repo name is tuple (name, reponame)
force: force initialization of the repo even if exists
backend: backend that must be used for this (... | [
"Initialize",
"a",
"Git",
"repo"
] | pingali/dgit | python | https://github.com/pingali/dgit/blob/ecde01f40b98f0719dbcfb54452270ed2f86686d/dgitcore/contrib/repomanagers/gitmanager.py#L230-L287 | [
"def",
"init",
"(",
"self",
",",
"username",
",",
"reponame",
",",
"force",
",",
"backend",
"=",
"None",
")",
":",
"key",
"=",
"self",
".",
"key",
"(",
"username",
",",
"reponame",
")",
"# In local filesystem-based server, add a repo",
"server_repodir",
"=",
... | ecde01f40b98f0719dbcfb54452270ed2f86686d |
valid | GitRepoManager.clone | Clone a URL
Parameters
----------
url : URL of the repo. Supports s3://, git@, http:// | dgitcore/contrib/repomanagers/gitmanager.py | def clone(self, url, backend=None):
"""
Clone a URL
Parameters
----------
url : URL of the repo. Supports s3://, git@, http://
"""
# s3://bucket/git/username/repo.git
username = self.username
reponame = url.split("/")[-1] # with git
rep... | def clone(self, url, backend=None):
"""
Clone a URL
Parameters
----------
url : URL of the repo. Supports s3://, git@, http://
"""
# s3://bucket/git/username/repo.git
username = self.username
reponame = url.split("/")[-1] # with git
rep... | [
"Clone",
"a",
"URL"
] | pingali/dgit | python | https://github.com/pingali/dgit/blob/ecde01f40b98f0719dbcfb54452270ed2f86686d/dgitcore/contrib/repomanagers/gitmanager.py#L289-L356 | [
"def",
"clone",
"(",
"self",
",",
"url",
",",
"backend",
"=",
"None",
")",
":",
"# s3://bucket/git/username/repo.git",
"username",
"=",
"self",
".",
"username",
"reponame",
"=",
"url",
".",
"split",
"(",
"\"/\"",
")",
"[",
"-",
"1",
"]",
"# with git",
"r... | ecde01f40b98f0719dbcfb54452270ed2f86686d |
valid | GitRepoManager.delete | Delete files from the repo | dgitcore/contrib/repomanagers/gitmanager.py | def delete(self, repo, args=[]):
"""
Delete files from the repo
"""
result = None
with cd(repo.rootdir):
try:
cmd = ['rm'] + list(args)
result = {
'status': 'success',
'message': self._run(cmd)
... | def delete(self, repo, args=[]):
"""
Delete files from the repo
"""
result = None
with cd(repo.rootdir):
try:
cmd = ['rm'] + list(args)
result = {
'status': 'success',
'message': self._run(cmd)
... | [
"Delete",
"files",
"from",
"the",
"repo"
] | pingali/dgit | python | https://github.com/pingali/dgit/blob/ecde01f40b98f0719dbcfb54452270ed2f86686d/dgitcore/contrib/repomanagers/gitmanager.py#L359-L379 | [
"def",
"delete",
"(",
"self",
",",
"repo",
",",
"args",
"=",
"[",
"]",
")",
":",
"result",
"=",
"None",
"with",
"cd",
"(",
"repo",
".",
"rootdir",
")",
":",
"try",
":",
"cmd",
"=",
"[",
"'rm'",
"]",
"+",
"list",
"(",
"args",
")",
"result",
"=... | ecde01f40b98f0719dbcfb54452270ed2f86686d |
valid | GitRepoManager.drop | Cleanup the repo | dgitcore/contrib/repomanagers/gitmanager.py | def drop(self, repo, args=[]):
"""
Cleanup the repo
"""
# Clean up the rootdir
rootdir = repo.rootdir
if os.path.exists(rootdir):
print("Cleaning repo directory: {}".format(rootdir))
shutil.rmtree(rootdir)
# Cleanup the local version of t... | def drop(self, repo, args=[]):
"""
Cleanup the repo
"""
# Clean up the rootdir
rootdir = repo.rootdir
if os.path.exists(rootdir):
print("Cleaning repo directory: {}".format(rootdir))
shutil.rmtree(rootdir)
# Cleanup the local version of t... | [
"Cleanup",
"the",
"repo"
] | pingali/dgit | python | https://github.com/pingali/dgit/blob/ecde01f40b98f0719dbcfb54452270ed2f86686d/dgitcore/contrib/repomanagers/gitmanager.py#L381-L405 | [
"def",
"drop",
"(",
"self",
",",
"repo",
",",
"args",
"=",
"[",
"]",
")",
":",
"# Clean up the rootdir",
"rootdir",
"=",
"repo",
".",
"rootdir",
"if",
"os",
".",
"path",
".",
"exists",
"(",
"rootdir",
")",
":",
"print",
"(",
"\"Cleaning repo directory: {... | ecde01f40b98f0719dbcfb54452270ed2f86686d |
valid | GitRepoManager.permalink | Get the permalink to command that generated the dataset | dgitcore/contrib/repomanagers/gitmanager.py | def permalink(self, repo, path):
"""
Get the permalink to command that generated the dataset
"""
if not os.path.exists(path):
# print("Path does not exist", path)
return (None, None)
# Get this directory
cwd = os.getcwd()
# Find the ro... | def permalink(self, repo, path):
"""
Get the permalink to command that generated the dataset
"""
if not os.path.exists(path):
# print("Path does not exist", path)
return (None, None)
# Get this directory
cwd = os.getcwd()
# Find the ro... | [
"Get",
"the",
"permalink",
"to",
"command",
"that",
"generated",
"the",
"dataset"
] | pingali/dgit | python | https://github.com/pingali/dgit/blob/ecde01f40b98f0719dbcfb54452270ed2f86686d/dgitcore/contrib/repomanagers/gitmanager.py#L407-L471 | [
"def",
"permalink",
"(",
"self",
",",
"repo",
",",
"path",
")",
":",
"if",
"not",
"os",
".",
"path",
".",
"exists",
"(",
"path",
")",
":",
"# print(\"Path does not exist\", path)",
"return",
"(",
"None",
",",
"None",
")",
"# Get this directory",
"cwd",
"="... | ecde01f40b98f0719dbcfb54452270ed2f86686d |
valid | GitRepoManager.add_files | Add files to the repo | dgitcore/contrib/repomanagers/gitmanager.py | def add_files(self, repo, files):
"""
Add files to the repo
"""
rootdir = repo.rootdir
for f in files:
relativepath = f['relativepath']
sourcepath = f['localfullpath']
if sourcepath is None:
# This can happen if the relative pat... | def add_files(self, repo, files):
"""
Add files to the repo
"""
rootdir = repo.rootdir
for f in files:
relativepath = f['relativepath']
sourcepath = f['localfullpath']
if sourcepath is None:
# This can happen if the relative pat... | [
"Add",
"files",
"to",
"the",
"repo"
] | pingali/dgit | python | https://github.com/pingali/dgit/blob/ecde01f40b98f0719dbcfb54452270ed2f86686d/dgitcore/contrib/repomanagers/gitmanager.py#L484-L505 | [
"def",
"add_files",
"(",
"self",
",",
"repo",
",",
"files",
")",
":",
"rootdir",
"=",
"repo",
".",
"rootdir",
"for",
"f",
"in",
"files",
":",
"relativepath",
"=",
"f",
"[",
"'relativepath'",
"]",
"sourcepath",
"=",
"f",
"[",
"'localfullpath'",
"]",
"if... | ecde01f40b98f0719dbcfb54452270ed2f86686d |
valid | GitRepoManager.config | Paramers:
---------
workspace: Directory to store the dataset repositories
email: | dgitcore/contrib/repomanagers/gitmanager.py | def config(self, what='get', params=None):
"""
Paramers:
---------
workspace: Directory to store the dataset repositories
email:
"""
if what == 'get':
return {
'name': 'git',
'nature': 'repomanager',
'va... | def config(self, what='get', params=None):
"""
Paramers:
---------
workspace: Directory to store the dataset repositories
email:
"""
if what == 'get':
return {
'name': 'git',
'nature': 'repomanager',
'va... | [
"Paramers",
":",
"---------"
] | pingali/dgit | python | https://github.com/pingali/dgit/blob/ecde01f40b98f0719dbcfb54452270ed2f86686d/dgitcore/contrib/repomanagers/gitmanager.py#L507-L546 | [
"def",
"config",
"(",
"self",
",",
"what",
"=",
"'get'",
",",
"params",
"=",
"None",
")",
":",
"if",
"what",
"==",
"'get'",
":",
"return",
"{",
"'name'",
":",
"'git'",
",",
"'nature'",
":",
"'repomanager'",
",",
"'variables'",
":",
"[",
"]",
",",
"... | ecde01f40b98f0719dbcfb54452270ed2f86686d |
valid | Invoice._init_empty | Creates the base set of attributes invoice has/needs | holviapi/invoicing.py | def _init_empty(self):
"""Creates the base set of attributes invoice has/needs"""
self._jsondata = {
"code": None,
"currency": "EUR",
"subject": "",
"due_date": (datetime.datetime.now().date() + datetime.timedelta(days=14)).isoformat(),
"issue_... | def _init_empty(self):
"""Creates the base set of attributes invoice has/needs"""
self._jsondata = {
"code": None,
"currency": "EUR",
"subject": "",
"due_date": (datetime.datetime.now().date() + datetime.timedelta(days=14)).isoformat(),
"issue_... | [
"Creates",
"the",
"base",
"set",
"of",
"attributes",
"invoice",
"has",
"/",
"needs"
] | rambo/python-holviapi | python | https://github.com/rambo/python-holviapi/blob/f57f44e7b0a1030786aafd6f387114abb546bb32/holviapi/invoicing.py#L33-L52 | [
"def",
"_init_empty",
"(",
"self",
")",
":",
"self",
".",
"_jsondata",
"=",
"{",
"\"code\"",
":",
"None",
",",
"\"currency\"",
":",
"\"EUR\"",
",",
"\"subject\"",
":",
"\"\"",
",",
"\"due_date\"",
":",
"(",
"datetime",
".",
"datetime",
".",
"now",
"(",
... | f57f44e7b0a1030786aafd6f387114abb546bb32 |
valid | Invoice.send | Marks the invoice as sent in Holvi
If send_email is False then the invoice is *not* automatically emailed to the recipient
and your must take care of sending the invoice yourself. | holviapi/invoicing.py | def send(self, send_email=True):
"""Marks the invoice as sent in Holvi
If send_email is False then the invoice is *not* automatically emailed to the recipient
and your must take care of sending the invoice yourself.
"""
url = str(self.api.base_url + '{code}/status/').format(code... | def send(self, send_email=True):
"""Marks the invoice as sent in Holvi
If send_email is False then the invoice is *not* automatically emailed to the recipient
and your must take care of sending the invoice yourself.
"""
url = str(self.api.base_url + '{code}/status/').format(code... | [
"Marks",
"the",
"invoice",
"as",
"sent",
"in",
"Holvi"
] | rambo/python-holviapi | python | https://github.com/rambo/python-holviapi/blob/f57f44e7b0a1030786aafd6f387114abb546bb32/holviapi/invoicing.py#L54-L65 | [
"def",
"send",
"(",
"self",
",",
"send_email",
"=",
"True",
")",
":",
"url",
"=",
"str",
"(",
"self",
".",
"api",
".",
"base_url",
"+",
"'{code}/status/'",
")",
".",
"format",
"(",
"code",
"=",
"self",
".",
"code",
")",
"# six.u messes this up",
"paylo... | f57f44e7b0a1030786aafd6f387114abb546bb32 |
valid | Invoice.to_holvi_dict | Convert our Python object to JSON acceptable to Holvi API | holviapi/invoicing.py | def to_holvi_dict(self):
"""Convert our Python object to JSON acceptable to Holvi API"""
self._jsondata["items"] = []
for item in self.items:
self._jsondata["items"].append(item.to_holvi_dict())
self._jsondata["issue_date"] = self.issue_date.isoformat()
self._jsondata... | def to_holvi_dict(self):
"""Convert our Python object to JSON acceptable to Holvi API"""
self._jsondata["items"] = []
for item in self.items:
self._jsondata["items"].append(item.to_holvi_dict())
self._jsondata["issue_date"] = self.issue_date.isoformat()
self._jsondata... | [
"Convert",
"our",
"Python",
"object",
"to",
"JSON",
"acceptable",
"to",
"Holvi",
"API"
] | rambo/python-holviapi | python | https://github.com/rambo/python-holviapi/blob/f57f44e7b0a1030786aafd6f387114abb546bb32/holviapi/invoicing.py#L69-L77 | [
"def",
"to_holvi_dict",
"(",
"self",
")",
":",
"self",
".",
"_jsondata",
"[",
"\"items\"",
"]",
"=",
"[",
"]",
"for",
"item",
"in",
"self",
".",
"items",
":",
"self",
".",
"_jsondata",
"[",
"\"items\"",
"]",
".",
"append",
"(",
"item",
".",
"to_holvi... | f57f44e7b0a1030786aafd6f387114abb546bb32 |
valid | Invoice.save | Saves this invoice to Holvi, returns the created/updated invoice | holviapi/invoicing.py | def save(self):
"""Saves this invoice to Holvi, returns the created/updated invoice"""
if not self.items:
raise HolviError("No items")
if not self.subject:
raise HolviError("No subject")
send_json = self.to_holvi_dict()
if self.code:
url = str(... | def save(self):
"""Saves this invoice to Holvi, returns the created/updated invoice"""
if not self.items:
raise HolviError("No items")
if not self.subject:
raise HolviError("No subject")
send_json = self.to_holvi_dict()
if self.code:
url = str(... | [
"Saves",
"this",
"invoice",
"to",
"Holvi",
"returns",
"the",
"created",
"/",
"updated",
"invoice"
] | rambo/python-holviapi | python | https://github.com/rambo/python-holviapi/blob/f57f44e7b0a1030786aafd6f387114abb546bb32/holviapi/invoicing.py#L79-L100 | [
"def",
"save",
"(",
"self",
")",
":",
"if",
"not",
"self",
".",
"items",
":",
"raise",
"HolviError",
"(",
"\"No items\"",
")",
"if",
"not",
"self",
".",
"subject",
":",
"raise",
"HolviError",
"(",
"\"No subject\"",
")",
"send_json",
"=",
"self",
".",
"... | f57f44e7b0a1030786aafd6f387114abb546bb32 |
valid | get_plugin_source | Returns the :class:`PluginSource` for the current module or the given
module. The module can be provided by name (in which case an import
will be attempted) or as a module object.
If no plugin source can be discovered, the return value from this method
is `None`.
This function can be very useful ... | dgitcore/vendor/pluginbase/pluginbase.py | def get_plugin_source(module=None, stacklevel=None):
"""Returns the :class:`PluginSource` for the current module or the given
module. The module can be provided by name (in which case an import
will be attempted) or as a module object.
If no plugin source can be discovered, the return value from this ... | def get_plugin_source(module=None, stacklevel=None):
"""Returns the :class:`PluginSource` for the current module or the given
module. The module can be provided by name (in which case an import
will be attempted) or as a module object.
If no plugin source can be discovered, the return value from this ... | [
"Returns",
"the",
":",
"class",
":",
"PluginSource",
"for",
"the",
"current",
"module",
"or",
"the",
"given",
"module",
".",
"The",
"module",
"can",
"be",
"provided",
"by",
"name",
"(",
"in",
"which",
"case",
"an",
"import",
"will",
"be",
"attempted",
")... | pingali/dgit | python | https://github.com/pingali/dgit/blob/ecde01f40b98f0719dbcfb54452270ed2f86686d/dgitcore/vendor/pluginbase/pluginbase.py#L42-L72 | [
"def",
"get_plugin_source",
"(",
"module",
"=",
"None",
",",
"stacklevel",
"=",
"None",
")",
":",
"if",
"module",
"is",
"None",
":",
"frm",
"=",
"sys",
".",
"_getframe",
"(",
"(",
"stacklevel",
"or",
"0",
")",
"+",
"1",
")",
"name",
"=",
"frm",
"."... | ecde01f40b98f0719dbcfb54452270ed2f86686d |
valid | PluginSource.list_plugins | Returns a sorted list of all plugins that are available in this
plugin source. This can be useful to automatically discover plugins
that are available and is usually used together with
:meth:`load_plugin`. | dgitcore/vendor/pluginbase/pluginbase.py | def list_plugins(self):
"""Returns a sorted list of all plugins that are available in this
plugin source. This can be useful to automatically discover plugins
that are available and is usually used together with
:meth:`load_plugin`.
"""
rv = []
for _, modname, is... | def list_plugins(self):
"""Returns a sorted list of all plugins that are available in this
plugin source. This can be useful to automatically discover plugins
that are available and is usually used together with
:meth:`load_plugin`.
"""
rv = []
for _, modname, is... | [
"Returns",
"a",
"sorted",
"list",
"of",
"all",
"plugins",
"that",
"are",
"available",
"in",
"this",
"plugin",
"source",
".",
"This",
"can",
"be",
"useful",
"to",
"automatically",
"discover",
"plugins",
"that",
"are",
"available",
"and",
"is",
"usually",
"use... | pingali/dgit | python | https://github.com/pingali/dgit/blob/ecde01f40b98f0719dbcfb54452270ed2f86686d/dgitcore/vendor/pluginbase/pluginbase.py#L249-L258 | [
"def",
"list_plugins",
"(",
"self",
")",
":",
"rv",
"=",
"[",
"]",
"for",
"_",
",",
"modname",
",",
"ispkg",
"in",
"pkgutil",
".",
"iter_modules",
"(",
"self",
".",
"mod",
".",
"__path__",
")",
":",
"rv",
".",
"append",
"(",
"modname",
")",
"return... | ecde01f40b98f0719dbcfb54452270ed2f86686d |
valid | PluginSource.load_plugin | This automatically loads a plugin by the given name from the
current source and returns the module. This is a convenient
alternative to the import statement and saves you from invoking
``__import__`` or a similar function yourself.
:param name: the name of the plugin to load. | dgitcore/vendor/pluginbase/pluginbase.py | def load_plugin(self, name):
"""This automatically loads a plugin by the given name from the
current source and returns the module. This is a convenient
alternative to the import statement and saves you from invoking
``__import__`` or a similar function yourself.
:param name: t... | def load_plugin(self, name):
"""This automatically loads a plugin by the given name from the
current source and returns the module. This is a convenient
alternative to the import statement and saves you from invoking
``__import__`` or a similar function yourself.
:param name: t... | [
"This",
"automatically",
"loads",
"a",
"plugin",
"by",
"the",
"given",
"name",
"from",
"the",
"current",
"source",
"and",
"returns",
"the",
"module",
".",
"This",
"is",
"a",
"convenient",
"alternative",
"to",
"the",
"import",
"statement",
"and",
"saves",
"yo... | pingali/dgit | python | https://github.com/pingali/dgit/blob/ecde01f40b98f0719dbcfb54452270ed2f86686d/dgitcore/vendor/pluginbase/pluginbase.py#L260-L272 | [
"def",
"load_plugin",
"(",
"self",
",",
"name",
")",
":",
"if",
"'.'",
"in",
"name",
":",
"raise",
"ImportError",
"(",
"'Plugin names cannot contain dots.'",
")",
"with",
"self",
":",
"return",
"__import__",
"(",
"self",
".",
"base",
".",
"package",
"+",
"... | ecde01f40b98f0719dbcfb54452270ed2f86686d |
valid | PluginSource.open_resource | This function locates a resource inside the plugin and returns
a byte stream to the contents of it. If the resource cannot be
loaded an :exc:`IOError` will be raised. Only plugins that are
real Python packages can contain resources. Plain old Python
modules do not allow this for obvio... | dgitcore/vendor/pluginbase/pluginbase.py | def open_resource(self, plugin, filename):
"""This function locates a resource inside the plugin and returns
a byte stream to the contents of it. If the resource cannot be
loaded an :exc:`IOError` will be raised. Only plugins that are
real Python packages can contain resources. Plain ... | def open_resource(self, plugin, filename):
"""This function locates a resource inside the plugin and returns
a byte stream to the contents of it. If the resource cannot be
loaded an :exc:`IOError` will be raised. Only plugins that are
real Python packages can contain resources. Plain ... | [
"This",
"function",
"locates",
"a",
"resource",
"inside",
"the",
"plugin",
"and",
"returns",
"a",
"byte",
"stream",
"to",
"the",
"contents",
"of",
"it",
".",
"If",
"the",
"resource",
"cannot",
"be",
"loaded",
"an",
":",
"exc",
":",
"IOError",
"will",
"be... | pingali/dgit | python | https://github.com/pingali/dgit/blob/ecde01f40b98f0719dbcfb54452270ed2f86686d/dgitcore/vendor/pluginbase/pluginbase.py#L274-L296 | [
"def",
"open_resource",
"(",
"self",
",",
"plugin",
",",
"filename",
")",
":",
"mod",
"=",
"self",
".",
"load_plugin",
"(",
"plugin",
")",
"fn",
"=",
"getattr",
"(",
"mod",
",",
"'__file__'",
",",
"None",
")",
"if",
"fn",
"is",
"not",
"None",
":",
... | ecde01f40b98f0719dbcfb54452270ed2f86686d |
valid | api_call_action | API wrapper documentation | dgitcore/api.py | def api_call_action(func):
"""
API wrapper documentation
"""
def _inner(*args, **kwargs):
return func(*args, **kwargs)
_inner.__name__ = func.__name__
_inner.__doc__ = func.__doc__
return _inner | def api_call_action(func):
"""
API wrapper documentation
"""
def _inner(*args, **kwargs):
return func(*args, **kwargs)
_inner.__name__ = func.__name__
_inner.__doc__ = func.__doc__
return _inner | [
"API",
"wrapper",
"documentation"
] | pingali/dgit | python | https://github.com/pingali/dgit/blob/ecde01f40b98f0719dbcfb54452270ed2f86686d/dgitcore/api.py#L12-L20 | [
"def",
"api_call_action",
"(",
"func",
")",
":",
"def",
"_inner",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"func",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
"_inner",
".",
"__name__",
"=",
"func",
".",
"__name__",
"_inne... | ecde01f40b98f0719dbcfb54452270ed2f86686d |
valid | Framer.tx | Transmit a series of bytes
:param message: a list of bytes to send
:return: None | booty/framer.py | def tx(self, message):
"""
Transmit a series of bytes
:param message: a list of bytes to send
:return: None
"""
message = message if isinstance(message, list) else [message]
length = len(message)
length_high_byte = (length & 0xff00) >> 8
length_lo... | def tx(self, message):
"""
Transmit a series of bytes
:param message: a list of bytes to send
:return: None
"""
message = message if isinstance(message, list) else [message]
length = len(message)
length_high_byte = (length & 0xff00) >> 8
length_lo... | [
"Transmit",
"a",
"series",
"of",
"bytes",
":",
"param",
"message",
":",
"a",
"list",
"of",
"bytes",
"to",
"send",
":",
"return",
":",
"None"
] | slightlynybbled/booty | python | https://github.com/slightlynybbled/booty/blob/17f13f0bc28ad855a3fab895478c85c57f356a38/booty/framer.py#L30-L59 | [
"def",
"tx",
"(",
"self",
",",
"message",
")",
":",
"message",
"=",
"message",
"if",
"isinstance",
"(",
"message",
",",
"list",
")",
"else",
"[",
"message",
"]",
"length",
"=",
"len",
"(",
"message",
")",
"length_high_byte",
"=",
"(",
"length",
"&",
... | 17f13f0bc28ad855a3fab895478c85c57f356a38 |
valid | Framer.rx | Receive a series of bytes that have been verified
:return: a series of bytes as a tuple or None if empty | booty/framer.py | def rx(self):
"""
Receive a series of bytes that have been verified
:return: a series of bytes as a tuple or None if empty
"""
if not self._threaded:
self.run()
try:
return tuple(self._messages.pop(0))
except IndexError:
return... | def rx(self):
"""
Receive a series of bytes that have been verified
:return: a series of bytes as a tuple or None if empty
"""
if not self._threaded:
self.run()
try:
return tuple(self._messages.pop(0))
except IndexError:
return... | [
"Receive",
"a",
"series",
"of",
"bytes",
"that",
"have",
"been",
"verified",
":",
"return",
":",
"a",
"series",
"of",
"bytes",
"as",
"a",
"tuple",
"or",
"None",
"if",
"empty"
] | slightlynybbled/booty | python | https://github.com/slightlynybbled/booty/blob/17f13f0bc28ad855a3fab895478c85c57f356a38/booty/framer.py#L61-L72 | [
"def",
"rx",
"(",
"self",
")",
":",
"if",
"not",
"self",
".",
"_threaded",
":",
"self",
".",
"run",
"(",
")",
"try",
":",
"return",
"tuple",
"(",
"self",
".",
"_messages",
".",
"pop",
"(",
"0",
")",
")",
"except",
"IndexError",
":",
"return",
"No... | 17f13f0bc28ad855a3fab895478c85c57f356a38 |
valid | Framer._parse_raw_data | Parses the incoming data and determines if it is valid. Valid
data gets placed into self._messages
:return: None | booty/framer.py | def _parse_raw_data(self):
"""
Parses the incoming data and determines if it is valid. Valid
data gets placed into self._messages
:return: None
"""
if self._START_OF_FRAME in self._raw and self._END_OF_FRAME in self._raw:
while self._raw[0] != self._START_OF... | def _parse_raw_data(self):
"""
Parses the incoming data and determines if it is valid. Valid
data gets placed into self._messages
:return: None
"""
if self._START_OF_FRAME in self._raw and self._END_OF_FRAME in self._raw:
while self._raw[0] != self._START_OF... | [
"Parses",
"the",
"incoming",
"data",
"and",
"determines",
"if",
"it",
"is",
"valid",
".",
"Valid",
"data",
"gets",
"placed",
"into",
"self",
".",
"_messages",
":",
"return",
":",
"None"
] | slightlynybbled/booty | python | https://github.com/slightlynybbled/booty/blob/17f13f0bc28ad855a3fab895478c85c57f356a38/booty/framer.py#L83-L128 | [
"def",
"_parse_raw_data",
"(",
"self",
")",
":",
"if",
"self",
".",
"_START_OF_FRAME",
"in",
"self",
".",
"_raw",
"and",
"self",
".",
"_END_OF_FRAME",
"in",
"self",
".",
"_raw",
":",
"while",
"self",
".",
"_raw",
"[",
"0",
"]",
"!=",
"self",
".",
"_S... | 17f13f0bc28ad855a3fab895478c85c57f356a38 |
valid | Framer._fletcher16_checksum | Calculates a fletcher16 checksum for the list of bytes
:param data: a list of bytes that comprise the message
:return: | booty/framer.py | def _fletcher16_checksum(self, data):
"""
Calculates a fletcher16 checksum for the list of bytes
:param data: a list of bytes that comprise the message
:return:
"""
sum1 = 0
sum2 = 0
for i, b in enumerate(data):
sum1 += b
sum1 &= 0... | def _fletcher16_checksum(self, data):
"""
Calculates a fletcher16 checksum for the list of bytes
:param data: a list of bytes that comprise the message
:return:
"""
sum1 = 0
sum2 = 0
for i, b in enumerate(data):
sum1 += b
sum1 &= 0... | [
"Calculates",
"a",
"fletcher16",
"checksum",
"for",
"the",
"list",
"of",
"bytes",
":",
"param",
"data",
":",
"a",
"list",
"of",
"bytes",
"that",
"comprise",
"the",
"message",
":",
"return",
":"
] | slightlynybbled/booty | python | https://github.com/slightlynybbled/booty/blob/17f13f0bc28ad855a3fab895478c85c57f356a38/booty/framer.py#L130-L147 | [
"def",
"_fletcher16_checksum",
"(",
"self",
",",
"data",
")",
":",
"sum1",
"=",
"0",
"sum2",
"=",
"0",
"for",
"i",
",",
"b",
"in",
"enumerate",
"(",
"data",
")",
":",
"sum1",
"+=",
"b",
"sum1",
"&=",
"0xff",
"# Results wrapped at 16 bits",
"sum2",
"+="... | 17f13f0bc28ad855a3fab895478c85c57f356a38 |
valid | Framer._remove_esc_chars | Removes any escape characters from the message
:param raw_message: a list of bytes containing the un-processed data
:return: a message that has the escaped characters appropriately un-escaped | booty/framer.py | def _remove_esc_chars(self, raw_message):
"""
Removes any escape characters from the message
:param raw_message: a list of bytes containing the un-processed data
:return: a message that has the escaped characters appropriately un-escaped
"""
message = []
escape_ne... | def _remove_esc_chars(self, raw_message):
"""
Removes any escape characters from the message
:param raw_message: a list of bytes containing the un-processed data
:return: a message that has the escaped characters appropriately un-escaped
"""
message = []
escape_ne... | [
"Removes",
"any",
"escape",
"characters",
"from",
"the",
"message",
":",
"param",
"raw_message",
":",
"a",
"list",
"of",
"bytes",
"containing",
"the",
"un",
"-",
"processed",
"data",
":",
"return",
":",
"a",
"message",
"that",
"has",
"the",
"escaped",
"cha... | slightlynybbled/booty | python | https://github.com/slightlynybbled/booty/blob/17f13f0bc28ad855a3fab895478c85c57f356a38/booty/framer.py#L149-L167 | [
"def",
"_remove_esc_chars",
"(",
"self",
",",
"raw_message",
")",
":",
"message",
"=",
"[",
"]",
"escape_next",
"=",
"False",
"for",
"c",
"in",
"raw_message",
":",
"if",
"escape_next",
":",
"message",
".",
"append",
"(",
"c",
"^",
"self",
".",
"_ESC_XOR"... | 17f13f0bc28ad855a3fab895478c85c57f356a38 |
valid | Framer.run | Receives the serial data into the self._raw buffer
:return: | booty/framer.py | def run(self):
"""
Receives the serial data into the self._raw buffer
:return:
"""
run_once = True
while run_once or self._threaded:
waiting = self._port.in_waiting
if waiting > 0:
temp = [int(c) for c in self._port.read(waiting)]
... | def run(self):
"""
Receives the serial data into the self._raw buffer
:return:
"""
run_once = True
while run_once or self._threaded:
waiting = self._port.in_waiting
if waiting > 0:
temp = [int(c) for c in self._port.read(waiting)]
... | [
"Receives",
"the",
"serial",
"data",
"into",
"the",
"self",
".",
"_raw",
"buffer",
":",
"return",
":"
] | slightlynybbled/booty | python | https://github.com/slightlynybbled/booty/blob/17f13f0bc28ad855a3fab895478c85c57f356a38/booty/framer.py#L169-L185 | [
"def",
"run",
"(",
"self",
")",
":",
"run_once",
"=",
"True",
"while",
"run_once",
"or",
"self",
".",
"_threaded",
":",
"waiting",
"=",
"self",
".",
"_port",
".",
"in_waiting",
"if",
"waiting",
">",
"0",
":",
"temp",
"=",
"[",
"int",
"(",
"c",
")",... | 17f13f0bc28ad855a3fab895478c85c57f356a38 |
valid | Order.save | Saves this order to Holvi, returns a tuple with the order itself and checkout_uri | holviapi/checkout.py | def save(self):
"""Saves this order to Holvi, returns a tuple with the order itself and checkout_uri"""
if self.code:
raise HolviError("Orders cannot be updated")
send_json = self.to_holvi_dict()
send_json.update({
'pool': self.api.connection.pool
})
... | def save(self):
"""Saves this order to Holvi, returns a tuple with the order itself and checkout_uri"""
if self.code:
raise HolviError("Orders cannot be updated")
send_json = self.to_holvi_dict()
send_json.update({
'pool': self.api.connection.pool
})
... | [
"Saves",
"this",
"order",
"to",
"Holvi",
"returns",
"a",
"tuple",
"with",
"the",
"order",
"itself",
"and",
"checkout_uri"
] | rambo/python-holviapi | python | https://github.com/rambo/python-holviapi/blob/f57f44e7b0a1030786aafd6f387114abb546bb32/holviapi/checkout.py#L78-L89 | [
"def",
"save",
"(",
"self",
")",
":",
"if",
"self",
".",
"code",
":",
"raise",
"HolviError",
"(",
"\"Orders cannot be updated\"",
")",
"send_json",
"=",
"self",
".",
"to_holvi_dict",
"(",
")",
"send_json",
".",
"update",
"(",
"{",
"'pool'",
":",
"self",
... | f57f44e7b0a1030786aafd6f387114abb546bb32 |
valid | untokenize | Return source code based on tokens.
This is like tokenize.untokenize(), but it preserves spacing between
tokens. So if the original soure code had multiple spaces between
some tokens or if escaped newlines were used, those things will be
reflected by untokenize(). | untokenize.py | def untokenize(tokens):
"""Return source code based on tokens.
This is like tokenize.untokenize(), but it preserves spacing between
tokens. So if the original soure code had multiple spaces between
some tokens or if escaped newlines were used, those things will be
reflected by untokenize().
""... | def untokenize(tokens):
"""Return source code based on tokens.
This is like tokenize.untokenize(), but it preserves spacing between
tokens. So if the original soure code had multiple spaces between
some tokens or if escaped newlines were used, those things will be
reflected by untokenize().
""... | [
"Return",
"source",
"code",
"based",
"on",
"tokens",
"."
] | myint/untokenize | python | https://github.com/myint/untokenize/blob/137ae8b8ec03e94444325172451ba2104c8ee05e/untokenize.py#L36-L82 | [
"def",
"untokenize",
"(",
"tokens",
")",
":",
"text",
"=",
"''",
"previous_line",
"=",
"''",
"last_row",
"=",
"0",
"last_column",
"=",
"-",
"1",
"last_non_whitespace_token_type",
"=",
"None",
"for",
"(",
"token_type",
",",
"token_string",
",",
"start",
",",
... | 137ae8b8ec03e94444325172451ba2104c8ee05e |
valid | init | Load profile INI | dgitcore/config.py | def init(globalvars=None, show=False):
"""
Load profile INI
"""
global config
profileini = getprofileini()
if os.path.exists(profileini):
config = configparser.ConfigParser()
config.read(profileini)
mgr = plugins_get_mgr()
mgr.update_configs(config)
if s... | def init(globalvars=None, show=False):
"""
Load profile INI
"""
global config
profileini = getprofileini()
if os.path.exists(profileini):
config = configparser.ConfigParser()
config.read(profileini)
mgr = plugins_get_mgr()
mgr.update_configs(config)
if s... | [
"Load",
"profile",
"INI"
] | pingali/dgit | python | https://github.com/pingali/dgit/blob/ecde01f40b98f0719dbcfb54452270ed2f86686d/dgitcore/config.py#L79-L103 | [
"def",
"init",
"(",
"globalvars",
"=",
"None",
",",
"show",
"=",
"False",
")",
":",
"global",
"config",
"profileini",
"=",
"getprofileini",
"(",
")",
"if",
"os",
".",
"path",
".",
"exists",
"(",
"profileini",
")",
":",
"config",
"=",
"configparser",
".... | ecde01f40b98f0719dbcfb54452270ed2f86686d |
valid | update | Update the profile | dgitcore/config.py | def update(globalvars):
"""
Update the profile
"""
global config
profileini = getprofileini()
config = configparser.ConfigParser()
config.read(profileini)
defaults = {}
if globalvars is not None:
defaults = {a[0]: a[1] for a in globalvars }
# Generic variables to be ca... | def update(globalvars):
"""
Update the profile
"""
global config
profileini = getprofileini()
config = configparser.ConfigParser()
config.read(profileini)
defaults = {}
if globalvars is not None:
defaults = {a[0]: a[1] for a in globalvars }
# Generic variables to be ca... | [
"Update",
"the",
"profile"
] | pingali/dgit | python | https://github.com/pingali/dgit/blob/ecde01f40b98f0719dbcfb54452270ed2f86686d/dgitcore/config.py#L110-L211 | [
"def",
"update",
"(",
"globalvars",
")",
":",
"global",
"config",
"profileini",
"=",
"getprofileini",
"(",
")",
"config",
"=",
"configparser",
".",
"ConfigParser",
"(",
")",
"config",
".",
"read",
"(",
"profileini",
")",
"defaults",
"=",
"{",
"}",
"if",
... | ecde01f40b98f0719dbcfb54452270ed2f86686d |
valid | S3Backend.init_repo | Insert hook into the repo | dgitcore/contrib/backends/s3.py | def init_repo(self, gitdir):
"""
Insert hook into the repo
"""
hooksdir = os.path.join(gitdir, 'hooks')
content = postreceive_template % {
'client': self.client,
'bucket': self.bucket,
's3cfg': self.s3cfg,
'prefix': self.prefix
... | def init_repo(self, gitdir):
"""
Insert hook into the repo
"""
hooksdir = os.path.join(gitdir, 'hooks')
content = postreceive_template % {
'client': self.client,
'bucket': self.bucket,
's3cfg': self.s3cfg,
'prefix': self.prefix
... | [
"Insert",
"hook",
"into",
"the",
"repo"
] | pingali/dgit | python | https://github.com/pingali/dgit/blob/ecde01f40b98f0719dbcfb54452270ed2f86686d/dgitcore/contrib/backends/s3.py#L133-L151 | [
"def",
"init_repo",
"(",
"self",
",",
"gitdir",
")",
":",
"hooksdir",
"=",
"os",
".",
"path",
".",
"join",
"(",
"gitdir",
",",
"'hooks'",
")",
"content",
"=",
"postreceive_template",
"%",
"{",
"'client'",
":",
"self",
".",
"client",
",",
"'bucket'",
":... | ecde01f40b98f0719dbcfb54452270ed2f86686d |
valid | compute_sha256 | Try the library. If it doesnt work, use the command line.. | dgitcore/helper.py | def compute_sha256(filename):
"""
Try the library. If it doesnt work, use the command line..
"""
try:
h = sha256()
fd = open(filename, 'rb')
while True:
buf = fd.read(0x1000000)
if buf in [None, ""]:
break
h.update(buf.encode('u... | def compute_sha256(filename):
"""
Try the library. If it doesnt work, use the command line..
"""
try:
h = sha256()
fd = open(filename, 'rb')
while True:
buf = fd.read(0x1000000)
if buf in [None, ""]:
break
h.update(buf.encode('u... | [
"Try",
"the",
"library",
".",
"If",
"it",
"doesnt",
"work",
"use",
"the",
"command",
"line",
".."
] | pingali/dgit | python | https://github.com/pingali/dgit/blob/ecde01f40b98f0719dbcfb54452270ed2f86686d/dgitcore/helper.py#L112-L128 | [
"def",
"compute_sha256",
"(",
"filename",
")",
":",
"try",
":",
"h",
"=",
"sha256",
"(",
")",
"fd",
"=",
"open",
"(",
"filename",
",",
"'rb'",
")",
"while",
"True",
":",
"buf",
"=",
"fd",
".",
"read",
"(",
"0x1000000",
")",
"if",
"buf",
"in",
"["... | ecde01f40b98f0719dbcfb54452270ed2f86686d |
valid | run | Run a shell command | dgitcore/helper.py | def run(cmd):
"""
Run a shell command
"""
cmd = [pipes.quote(c) for c in cmd]
cmd = " ".join(cmd)
cmd += "; exit 0"
# print("Running {} in {}".format(cmd, os.getcwd()))
try:
output = subprocess.check_output(cmd,
stderr=subprocess.STDOUT,
... | def run(cmd):
"""
Run a shell command
"""
cmd = [pipes.quote(c) for c in cmd]
cmd = " ".join(cmd)
cmd += "; exit 0"
# print("Running {} in {}".format(cmd, os.getcwd()))
try:
output = subprocess.check_output(cmd,
stderr=subprocess.STDOUT,
... | [
"Run",
"a",
"shell",
"command"
] | pingali/dgit | python | https://github.com/pingali/dgit/blob/ecde01f40b98f0719dbcfb54452270ed2f86686d/dgitcore/helper.py#L130-L147 | [
"def",
"run",
"(",
"cmd",
")",
":",
"cmd",
"=",
"[",
"pipes",
".",
"quote",
"(",
"c",
")",
"for",
"c",
"in",
"cmd",
"]",
"cmd",
"=",
"\" \"",
".",
"join",
"(",
"cmd",
")",
"cmd",
"+=",
"\"; exit 0\"",
"# print(\"Running {} in {}\".format(cmd, os.getcwd()... | ecde01f40b98f0719dbcfb54452270ed2f86686d |
valid | log_repo_action | Log all repo actions to .dgit/log.json | dgitcore/helper.py | def log_repo_action(func):
"""
Log all repo actions to .dgit/log.json
"""
def _inner(*args, **kwargs):
result = func(*args, **kwargs)
log_action(func, result, *args, **kwargs)
return result
_inner.__name__ = func.__name__
_inner.__doc__ = fun... | def log_repo_action(func):
"""
Log all repo actions to .dgit/log.json
"""
def _inner(*args, **kwargs):
result = func(*args, **kwargs)
log_action(func, result, *args, **kwargs)
return result
_inner.__name__ = func.__name__
_inner.__doc__ = fun... | [
"Log",
"all",
"repo",
"actions",
"to",
".",
"dgit",
"/",
"log",
".",
"json"
] | pingali/dgit | python | https://github.com/pingali/dgit/blob/ecde01f40b98f0719dbcfb54452270ed2f86686d/dgitcore/helper.py#L232-L244 | [
"def",
"log_repo_action",
"(",
"func",
")",
":",
"def",
"_inner",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"result",
"=",
"func",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
"log_action",
"(",
"func",
",",
"result",
",",
"*",
"arg... | ecde01f40b98f0719dbcfb54452270ed2f86686d |
valid | get_tree | Get the commit history for a given dataset | dgitcore/datasets/history.py | def get_tree(gitdir="."):
"""
Get the commit history for a given dataset
"""
cmd = ["git", "log", "--all", "--branches", '--pretty=format:{ "commit": "%H", "abbreviated_commit": "%h", "tree": "%T", "abbreviated_tree": "%t", "parent": "%P", "abbreviated_parent": "%p", "refs": "%d", "encoding": "... | def get_tree(gitdir="."):
"""
Get the commit history for a given dataset
"""
cmd = ["git", "log", "--all", "--branches", '--pretty=format:{ "commit": "%H", "abbreviated_commit": "%h", "tree": "%T", "abbreviated_tree": "%t", "parent": "%P", "abbreviated_parent": "%p", "refs": "%d", "encoding": "... | [
"Get",
"the",
"commit",
"history",
"for",
"a",
"given",
"dataset"
] | pingali/dgit | python | https://github.com/pingali/dgit/blob/ecde01f40b98f0719dbcfb54452270ed2f86686d/dgitcore/datasets/history.py#L62-L105 | [
"def",
"get_tree",
"(",
"gitdir",
"=",
"\".\"",
")",
":",
"cmd",
"=",
"[",
"\"git\"",
",",
"\"log\"",
",",
"\"--all\"",
",",
"\"--branches\"",
",",
"'--pretty=format:{ \"commit\": \"%H\", \"abbreviated_commit\": \"%h\", \"tree\": \"%T\", \"abbreviated_tree\": \"%t\", \"par... | ecde01f40b98f0719dbcfb54452270ed2f86686d |
valid | get_diffs | Look at files and compute the diffs intelligently | dgitcore/datasets/history.py | def get_diffs(history):
"""
Look at files and compute the diffs intelligently
"""
# First get all possible representations
mgr = plugins_get_mgr()
keys = mgr.search('representation')['representation']
representations = [mgr.get_by_key('representation', k) for k in keys]
for i in range... | def get_diffs(history):
"""
Look at files and compute the diffs intelligently
"""
# First get all possible representations
mgr = plugins_get_mgr()
keys = mgr.search('representation')['representation']
representations = [mgr.get_by_key('representation', k) for k in keys]
for i in range... | [
"Look",
"at",
"files",
"and",
"compute",
"the",
"diffs",
"intelligently"
] | pingali/dgit | python | https://github.com/pingali/dgit/blob/ecde01f40b98f0719dbcfb54452270ed2f86686d/dgitcore/datasets/history.py#L196-L278 | [
"def",
"get_diffs",
"(",
"history",
")",
":",
"# First get all possible representations",
"mgr",
"=",
"plugins_get_mgr",
"(",
")",
"keys",
"=",
"mgr",
".",
"search",
"(",
"'representation'",
")",
"[",
"'representation'",
"]",
"representations",
"=",
"[",
"mgr",
... | ecde01f40b98f0719dbcfb54452270ed2f86686d |
valid | SSHClient.chdir | Parameters
----------
new_pwd: str,
Directory to change to
relative: bool, default True
If True then the given directory is treated as relative to the
current directory | poseidon/ssh.py | def chdir(self, new_pwd, relative=True):
"""
Parameters
----------
new_pwd: str,
Directory to change to
relative: bool, default True
If True then the given directory is treated as relative to the
current directory
"""
if new_pwd... | def chdir(self, new_pwd, relative=True):
"""
Parameters
----------
new_pwd: str,
Directory to change to
relative: bool, default True
If True then the given directory is treated as relative to the
current directory
"""
if new_pwd... | [
"Parameters",
"----------",
"new_pwd",
":",
"str",
"Directory",
"to",
"change",
"to",
"relative",
":",
"bool",
"default",
"True",
"If",
"True",
"then",
"the",
"given",
"directory",
"is",
"treated",
"as",
"relative",
"to",
"the",
"current",
"directory"
] | changhiskhan/poseidon | python | https://github.com/changhiskhan/poseidon/blob/6d1cecbe02f1e510dd185fe23f88f7af35eb737f/poseidon/ssh.py#L60-L72 | [
"def",
"chdir",
"(",
"self",
",",
"new_pwd",
",",
"relative",
"=",
"True",
")",
":",
"if",
"new_pwd",
"and",
"self",
".",
"pwd",
"and",
"relative",
":",
"new_pwd",
"=",
"os",
".",
"path",
".",
"join",
"(",
"self",
".",
"pwd",
",",
"new_pwd",
")",
... | 6d1cecbe02f1e510dd185fe23f88f7af35eb737f |
valid | SSHClient.exec_command | Proceed with caution, if you run a command that causes a prompt and then
try to read/print the stdout it's going to block forever
Returns
-------
(stdin, stdout, stderr) | poseidon/ssh.py | def exec_command(self, cmd):
"""
Proceed with caution, if you run a command that causes a prompt and then
try to read/print the stdout it's going to block forever
Returns
-------
(stdin, stdout, stderr)
"""
if self.pwd is not None:
cmd = 'cd %... | def exec_command(self, cmd):
"""
Proceed with caution, if you run a command that causes a prompt and then
try to read/print the stdout it's going to block forever
Returns
-------
(stdin, stdout, stderr)
"""
if self.pwd is not None:
cmd = 'cd %... | [
"Proceed",
"with",
"caution",
"if",
"you",
"run",
"a",
"command",
"that",
"causes",
"a",
"prompt",
"and",
"then",
"try",
"to",
"read",
"/",
"print",
"the",
"stdout",
"it",
"s",
"going",
"to",
"block",
"forever"
] | changhiskhan/poseidon | python | https://github.com/changhiskhan/poseidon/blob/6d1cecbe02f1e510dd185fe23f88f7af35eb737f/poseidon/ssh.py#L88-L101 | [
"def",
"exec_command",
"(",
"self",
",",
"cmd",
")",
":",
"if",
"self",
".",
"pwd",
"is",
"not",
"None",
":",
"cmd",
"=",
"'cd %s ; %s'",
"%",
"(",
"self",
".",
"pwd",
",",
"cmd",
")",
"if",
"self",
".",
"interactive",
":",
"print",
"(",
"cmd",
"... | 6d1cecbe02f1e510dd185fe23f88f7af35eb737f |
valid | SSHClient.wait | Execute command and wait for it to finish. Proceed with caution because
if you run a command that causes a prompt this will hang | poseidon/ssh.py | def wait(self, cmd, raise_on_error=True):
"""
Execute command and wait for it to finish. Proceed with caution because
if you run a command that causes a prompt this will hang
"""
_, stdout, stderr = self.exec_command(cmd)
stdout.channel.recv_exit_status()
output =... | def wait(self, cmd, raise_on_error=True):
"""
Execute command and wait for it to finish. Proceed with caution because
if you run a command that causes a prompt this will hang
"""
_, stdout, stderr = self.exec_command(cmd)
stdout.channel.recv_exit_status()
output =... | [
"Execute",
"command",
"and",
"wait",
"for",
"it",
"to",
"finish",
".",
"Proceed",
"with",
"caution",
"because",
"if",
"you",
"run",
"a",
"command",
"that",
"causes",
"a",
"prompt",
"this",
"will",
"hang"
] | changhiskhan/poseidon | python | https://github.com/changhiskhan/poseidon/blob/6d1cecbe02f1e510dd185fe23f88f7af35eb737f/poseidon/ssh.py#L103-L118 | [
"def",
"wait",
"(",
"self",
",",
"cmd",
",",
"raise_on_error",
"=",
"True",
")",
":",
"_",
",",
"stdout",
",",
"stderr",
"=",
"self",
".",
"exec_command",
"(",
"cmd",
")",
"stdout",
".",
"channel",
".",
"recv_exit_status",
"(",
")",
"output",
"=",
"s... | 6d1cecbe02f1e510dd185fe23f88f7af35eb737f |
valid | SSHClient.sudo | Enter sudo mode | poseidon/ssh.py | def sudo(self, password=None):
"""
Enter sudo mode
"""
if self.username == 'root':
raise ValueError('Already root user')
password = self.validate_password(password)
stdin, stdout, stderr = self.exec_command('sudo su')
stdin.write("%s\n" % password)
... | def sudo(self, password=None):
"""
Enter sudo mode
"""
if self.username == 'root':
raise ValueError('Already root user')
password = self.validate_password(password)
stdin, stdout, stderr = self.exec_command('sudo su')
stdin.write("%s\n" % password)
... | [
"Enter",
"sudo",
"mode"
] | changhiskhan/poseidon | python | https://github.com/changhiskhan/poseidon/blob/6d1cecbe02f1e510dd185fe23f88f7af35eb737f/poseidon/ssh.py#L127-L139 | [
"def",
"sudo",
"(",
"self",
",",
"password",
"=",
"None",
")",
":",
"if",
"self",
".",
"username",
"==",
"'root'",
":",
"raise",
"ValueError",
"(",
"'Already root user'",
")",
"password",
"=",
"self",
".",
"validate_password",
"(",
"password",
")",
"stdin"... | 6d1cecbe02f1e510dd185fe23f88f7af35eb737f |
valid | SSHClient.apt | Install specified packages using apt-get. -y options are
automatically used. Waits for command to finish.
Parameters
----------
package_names: list-like of str
raise_on_error: bool, default False
If True then raise ValueError if stderr is not empty
debcon... | poseidon/ssh.py | def apt(self, package_names, raise_on_error=False):
"""
Install specified packages using apt-get. -y options are
automatically used. Waits for command to finish.
Parameters
----------
package_names: list-like of str
raise_on_error: bool, default False
... | def apt(self, package_names, raise_on_error=False):
"""
Install specified packages using apt-get. -y options are
automatically used. Waits for command to finish.
Parameters
----------
package_names: list-like of str
raise_on_error: bool, default False
... | [
"Install",
"specified",
"packages",
"using",
"apt",
"-",
"get",
".",
"-",
"y",
"options",
"are",
"automatically",
"used",
".",
"Waits",
"for",
"command",
"to",
"finish",
"."
] | changhiskhan/poseidon | python | https://github.com/changhiskhan/poseidon/blob/6d1cecbe02f1e510dd185fe23f88f7af35eb737f/poseidon/ssh.py#L156-L171 | [
"def",
"apt",
"(",
"self",
",",
"package_names",
",",
"raise_on_error",
"=",
"False",
")",
":",
"if",
"isinstance",
"(",
"package_names",
",",
"basestring",
")",
":",
"package_names",
"=",
"[",
"package_names",
"]",
"cmd",
"=",
"\"apt-get install -y %s\"",
"%"... | 6d1cecbe02f1e510dd185fe23f88f7af35eb737f |
valid | SSHClient.pip | Install specified python packages using pip. -U option added
Waits for command to finish.
Parameters
----------
package_names: list-like of str
raise_on_error: bool, default True
If True then raise ValueError if stderr is not empty | poseidon/ssh.py | def pip(self, package_names, raise_on_error=True):
"""
Install specified python packages using pip. -U option added
Waits for command to finish.
Parameters
----------
package_names: list-like of str
raise_on_error: bool, default True
If True then rais... | def pip(self, package_names, raise_on_error=True):
"""
Install specified python packages using pip. -U option added
Waits for command to finish.
Parameters
----------
package_names: list-like of str
raise_on_error: bool, default True
If True then rais... | [
"Install",
"specified",
"python",
"packages",
"using",
"pip",
".",
"-",
"U",
"option",
"added",
"Waits",
"for",
"command",
"to",
"finish",
"."
] | changhiskhan/poseidon | python | https://github.com/changhiskhan/poseidon/blob/6d1cecbe02f1e510dd185fe23f88f7af35eb737f/poseidon/ssh.py#L190-L204 | [
"def",
"pip",
"(",
"self",
",",
"package_names",
",",
"raise_on_error",
"=",
"True",
")",
":",
"if",
"isinstance",
"(",
"package_names",
",",
"basestring",
")",
":",
"package_names",
"=",
"[",
"package_names",
"]",
"cmd",
"=",
"\"pip install -U %s\"",
"%",
"... | 6d1cecbe02f1e510dd185fe23f88f7af35eb737f |
valid | SSHClient.pip_r | Install all requirements contained in the given file path
Waits for command to finish.
Parameters
----------
requirements: str
Path to requirements.txt
raise_on_error: bool, default True
If True then raise ValueError if stderr is not empty | poseidon/ssh.py | def pip_r(self, requirements, raise_on_error=True):
"""
Install all requirements contained in the given file path
Waits for command to finish.
Parameters
----------
requirements: str
Path to requirements.txt
raise_on_error: bool, default True
... | def pip_r(self, requirements, raise_on_error=True):
"""
Install all requirements contained in the given file path
Waits for command to finish.
Parameters
----------
requirements: str
Path to requirements.txt
raise_on_error: bool, default True
... | [
"Install",
"all",
"requirements",
"contained",
"in",
"the",
"given",
"file",
"path",
"Waits",
"for",
"command",
"to",
"finish",
"."
] | changhiskhan/poseidon | python | https://github.com/changhiskhan/poseidon/blob/6d1cecbe02f1e510dd185fe23f88f7af35eb737f/poseidon/ssh.py#L213-L226 | [
"def",
"pip_r",
"(",
"self",
",",
"requirements",
",",
"raise_on_error",
"=",
"True",
")",
":",
"cmd",
"=",
"\"pip install -r %s\"",
"%",
"requirements",
"return",
"self",
".",
"wait",
"(",
"cmd",
",",
"raise_on_error",
"=",
"raise_on_error",
")"
] | 6d1cecbe02f1e510dd185fe23f88f7af35eb737f |
valid | SSHClient.git | Parameters
----------
token: str, default None
Assumes you have GITHUB_TOKEN in envvar if None
https://github.com/blog/1270-easier-builds-and-deployments-using-git-
over-https-and-oauth | poseidon/ssh.py | def git(self, username, repo, alias=None, token=None):
"""
Parameters
----------
token: str, default None
Assumes you have GITHUB_TOKEN in envvar if None
https://github.com/blog/1270-easier-builds-and-deployments-using-git-
over-https-and-oauth
"""
... | def git(self, username, repo, alias=None, token=None):
"""
Parameters
----------
token: str, default None
Assumes you have GITHUB_TOKEN in envvar if None
https://github.com/blog/1270-easier-builds-and-deployments-using-git-
over-https-and-oauth
"""
... | [
"Parameters",
"----------",
"token",
":",
"str",
"default",
"None",
"Assumes",
"you",
"have",
"GITHUB_TOKEN",
"in",
"envvar",
"if",
"None"
] | changhiskhan/poseidon | python | https://github.com/changhiskhan/poseidon/blob/6d1cecbe02f1e510dd185fe23f88f7af35eb737f/poseidon/ssh.py#L262-L285 | [
"def",
"git",
"(",
"self",
",",
"username",
",",
"repo",
",",
"alias",
"=",
"None",
",",
"token",
"=",
"None",
")",
":",
"if",
"alias",
"is",
"None",
":",
"alias",
"=",
"repo",
"if",
"token",
"is",
"None",
":",
"token",
"=",
"os",
".",
"environ",... | 6d1cecbe02f1e510dd185fe23f88f7af35eb737f |
valid | stitch_macro | Create fiji-macros for stitching all channels and z-stacks for a well.
Parameters
----------
path : string
Well path.
output_folder : string
Folder to store images. If not given well path is used.
Returns
-------
output_files, macros : tuple
Tuple with filenames and... | leicaexperiment/experiment.py | def stitch_macro(path, output_folder=None):
"""Create fiji-macros for stitching all channels and z-stacks for a well.
Parameters
----------
path : string
Well path.
output_folder : string
Folder to store images. If not given well path is used.
Returns
-------
output_fil... | def stitch_macro(path, output_folder=None):
"""Create fiji-macros for stitching all channels and z-stacks for a well.
Parameters
----------
path : string
Well path.
output_folder : string
Folder to store images. If not given well path is used.
Returns
-------
output_fil... | [
"Create",
"fiji",
"-",
"macros",
"for",
"stitching",
"all",
"channels",
"and",
"z",
"-",
"stacks",
"for",
"a",
"well",
"."
] | arve0/leicaexperiment | python | https://github.com/arve0/leicaexperiment/blob/c0393c4d51984a506f813319efb66e54c4f2a426/leicaexperiment/experiment.py#L374-L466 | [
"def",
"stitch_macro",
"(",
"path",
",",
"output_folder",
"=",
"None",
")",
":",
"output_folder",
"=",
"output_folder",
"or",
"path",
"debug",
"(",
"'stitching '",
"+",
"path",
"+",
"' to '",
"+",
"output_folder",
")",
"fields",
"=",
"glob",
"(",
"_pattern",... | c0393c4d51984a506f813319efb66e54c4f2a426 |
valid | compress | Lossless compression. Save images as PNG and TIFF tags to json. Can be
reversed with `decompress`. Will run in multiprocessing, where
number of workers is decided by ``leicaexperiment.experiment._pools``.
Parameters
----------
images : list of filenames
Images to lossless compress.
dele... | leicaexperiment/experiment.py | def compress(images, delete_tif=False, folder=None):
"""Lossless compression. Save images as PNG and TIFF tags to json. Can be
reversed with `decompress`. Will run in multiprocessing, where
number of workers is decided by ``leicaexperiment.experiment._pools``.
Parameters
----------
images : lis... | def compress(images, delete_tif=False, folder=None):
"""Lossless compression. Save images as PNG and TIFF tags to json. Can be
reversed with `decompress`. Will run in multiprocessing, where
number of workers is decided by ``leicaexperiment.experiment._pools``.
Parameters
----------
images : lis... | [
"Lossless",
"compression",
".",
"Save",
"images",
"as",
"PNG",
"and",
"TIFF",
"tags",
"to",
"json",
".",
"Can",
"be",
"reversed",
"with",
"decompress",
".",
"Will",
"run",
"in",
"multiprocessing",
"where",
"number",
"of",
"workers",
"is",
"decided",
"by",
... | arve0/leicaexperiment | python | https://github.com/arve0/leicaexperiment/blob/c0393c4d51984a506f813319efb66e54c4f2a426/leicaexperiment/experiment.py#L469-L497 | [
"def",
"compress",
"(",
"images",
",",
"delete_tif",
"=",
"False",
",",
"folder",
"=",
"None",
")",
":",
"if",
"type",
"(",
"images",
")",
"==",
"str",
":",
"# only one image",
"return",
"[",
"compress_blocking",
"(",
"images",
",",
"delete_tif",
",",
"f... | c0393c4d51984a506f813319efb66e54c4f2a426 |
valid | compress_blocking | Lossless compression. Save image as PNG and TIFF tags to json. Process
can be reversed with `decompress`.
Parameters
----------
image : string
TIF-image which should be compressed lossless.
delete_tif : bool
Wheter to delete original images.
force : bool
Wheter to compre... | leicaexperiment/experiment.py | def compress_blocking(image, delete_tif=False, folder=None, force=False):
"""Lossless compression. Save image as PNG and TIFF tags to json. Process
can be reversed with `decompress`.
Parameters
----------
image : string
TIF-image which should be compressed lossless.
delete_tif : bool
... | def compress_blocking(image, delete_tif=False, folder=None, force=False):
"""Lossless compression. Save image as PNG and TIFF tags to json. Process
can be reversed with `decompress`.
Parameters
----------
image : string
TIF-image which should be compressed lossless.
delete_tif : bool
... | [
"Lossless",
"compression",
".",
"Save",
"image",
"as",
"PNG",
"and",
"TIFF",
"tags",
"to",
"json",
".",
"Process",
"can",
"be",
"reversed",
"with",
"decompress",
"."
] | arve0/leicaexperiment | python | https://github.com/arve0/leicaexperiment/blob/c0393c4d51984a506f813319efb66e54c4f2a426/leicaexperiment/experiment.py#L500-L577 | [
"def",
"compress_blocking",
"(",
"image",
",",
"delete_tif",
"=",
"False",
",",
"folder",
"=",
"None",
",",
"force",
"=",
"False",
")",
":",
"debug",
"(",
"'compressing {}'",
".",
"format",
"(",
"image",
")",
")",
"try",
":",
"new_filename",
",",
"extens... | c0393c4d51984a506f813319efb66e54c4f2a426 |
valid | decompress | Reverse compression from tif to png and save them in original format
(ome.tif). TIFF-tags are gotten from json-files named the same as given
images.
Parameters
----------
images : list of filenames
Image to decompress.
delete_png : bool
Wheter to delete PNG images.
delete_j... | leicaexperiment/experiment.py | def decompress(images, delete_png=False, delete_json=False, folder=None):
"""Reverse compression from tif to png and save them in original format
(ome.tif). TIFF-tags are gotten from json-files named the same as given
images.
Parameters
----------
images : list of filenames
Image to de... | def decompress(images, delete_png=False, delete_json=False, folder=None):
"""Reverse compression from tif to png and save them in original format
(ome.tif). TIFF-tags are gotten from json-files named the same as given
images.
Parameters
----------
images : list of filenames
Image to de... | [
"Reverse",
"compression",
"from",
"tif",
"to",
"png",
"and",
"save",
"them",
"in",
"original",
"format",
"(",
"ome",
".",
"tif",
")",
".",
"TIFF",
"-",
"tags",
"are",
"gotten",
"from",
"json",
"-",
"files",
"named",
"the",
"same",
"as",
"given",
"image... | arve0/leicaexperiment | python | https://github.com/arve0/leicaexperiment/blob/c0393c4d51984a506f813319efb66e54c4f2a426/leicaexperiment/experiment.py#L581-L669 | [
"def",
"decompress",
"(",
"images",
",",
"delete_png",
"=",
"False",
",",
"delete_json",
"=",
"False",
",",
"folder",
"=",
"None",
")",
":",
"if",
"type",
"(",
"images",
")",
"==",
"str",
":",
"# only one image",
"return",
"decompress",
"(",
"[",
"images... | c0393c4d51984a506f813319efb66e54c4f2a426 |
valid | attribute | Returns the two numbers found behind --[A-Z] in path. If several matches
are found, the last one is returned.
Parameters
----------
path : string
String with path of file/folder to get attribute from.
name : string
Name of attribute to get. Should be A-Z or a-z (implicit converted t... | leicaexperiment/experiment.py | def attribute(path, name):
"""Returns the two numbers found behind --[A-Z] in path. If several matches
are found, the last one is returned.
Parameters
----------
path : string
String with path of file/folder to get attribute from.
name : string
Name of attribute to get. Should b... | def attribute(path, name):
"""Returns the two numbers found behind --[A-Z] in path. If several matches
are found, the last one is returned.
Parameters
----------
path : string
String with path of file/folder to get attribute from.
name : string
Name of attribute to get. Should b... | [
"Returns",
"the",
"two",
"numbers",
"found",
"behind",
"--",
"[",
"A",
"-",
"Z",
"]",
"in",
"path",
".",
"If",
"several",
"matches",
"are",
"found",
"the",
"last",
"one",
"is",
"returned",
"."
] | arve0/leicaexperiment | python | https://github.com/arve0/leicaexperiment/blob/c0393c4d51984a506f813319efb66e54c4f2a426/leicaexperiment/experiment.py#L672-L693 | [
"def",
"attribute",
"(",
"path",
",",
"name",
")",
":",
"matches",
"=",
"re",
".",
"findall",
"(",
"'--'",
"+",
"name",
".",
"upper",
"(",
")",
"+",
"'([0-9]{2})'",
",",
"path",
")",
"if",
"matches",
":",
"return",
"int",
"(",
"matches",
"[",
"-",
... | c0393c4d51984a506f813319efb66e54c4f2a426 |
valid | attribute_as_str | Returns the two numbers found behind --[A-Z] in path. If several matches
are found, the last one is returned.
Parameters
----------
path : string
String with path of file/folder to get attribute from.
name : string
Name of attribute to get. Should be A-Z or a-z (implicit converted t... | leicaexperiment/experiment.py | def attribute_as_str(path, name):
"""Returns the two numbers found behind --[A-Z] in path. If several matches
are found, the last one is returned.
Parameters
----------
path : string
String with path of file/folder to get attribute from.
name : string
Name of attribute to get. S... | def attribute_as_str(path, name):
"""Returns the two numbers found behind --[A-Z] in path. If several matches
are found, the last one is returned.
Parameters
----------
path : string
String with path of file/folder to get attribute from.
name : string
Name of attribute to get. S... | [
"Returns",
"the",
"two",
"numbers",
"found",
"behind",
"--",
"[",
"A",
"-",
"Z",
"]",
"in",
"path",
".",
"If",
"several",
"matches",
"are",
"found",
"the",
"last",
"one",
"is",
"returned",
"."
] | arve0/leicaexperiment | python | https://github.com/arve0/leicaexperiment/blob/c0393c4d51984a506f813319efb66e54c4f2a426/leicaexperiment/experiment.py#L696-L717 | [
"def",
"attribute_as_str",
"(",
"path",
",",
"name",
")",
":",
"matches",
"=",
"re",
".",
"findall",
"(",
"'--'",
"+",
"name",
".",
"upper",
"(",
")",
"+",
"'([0-9]{2})'",
",",
"path",
")",
"if",
"matches",
":",
"return",
"matches",
"[",
"-",
"1",
... | c0393c4d51984a506f813319efb66e54c4f2a426 |
valid | attributes | Get attributes from path based on format --[A-Z]. Returns namedtuple
with upper case attributes equal to what found in path (string) and lower
case as int. If path holds several occurrences of same character, only the
last one is kept.
>>> attrs = attributes('/folder/file--X00-X01.tif')
>>>... | leicaexperiment/experiment.py | def attributes(path):
"""Get attributes from path based on format --[A-Z]. Returns namedtuple
with upper case attributes equal to what found in path (string) and lower
case as int. If path holds several occurrences of same character, only the
last one is kept.
>>> attrs = attributes('/folder/fi... | def attributes(path):
"""Get attributes from path based on format --[A-Z]. Returns namedtuple
with upper case attributes equal to what found in path (string) and lower
case as int. If path holds several occurrences of same character, only the
last one is kept.
>>> attrs = attributes('/folder/fi... | [
"Get",
"attributes",
"from",
"path",
"based",
"on",
"format",
"--",
"[",
"A",
"-",
"Z",
"]",
".",
"Returns",
"namedtuple",
"with",
"upper",
"case",
"attributes",
"equal",
"to",
"what",
"found",
"in",
"path",
"(",
"string",
")",
"and",
"lower",
"case",
... | arve0/leicaexperiment | python | https://github.com/arve0/leicaexperiment/blob/c0393c4d51984a506f813319efb66e54c4f2a426/leicaexperiment/experiment.py#L719-L758 | [
"def",
"attributes",
"(",
"path",
")",
":",
"# number of charcters set to numbers have changed in LAS AF X !!",
"matches",
"=",
"re",
".",
"findall",
"(",
"'--([A-Z]{1})([0-9]{2,4})'",
",",
"path",
")",
"keys",
"=",
"[",
"]",
"values",
"=",
"[",
"]",
"for",
"k",
... | c0393c4d51984a506f813319efb66e54c4f2a426 |
valid | _pattern | Returns globbing pattern for name1/name2/../lastname + '--*' or
name1/name2/../lastname + extension if parameter `extension` it set.
Parameters
----------
names : strings
Which path to join. Example: _pattern('path', 'to', 'experiment') will
return `path/to/experiment--*`.
extension... | leicaexperiment/experiment.py | def _pattern(*names, **kwargs):
"""Returns globbing pattern for name1/name2/../lastname + '--*' or
name1/name2/../lastname + extension if parameter `extension` it set.
Parameters
----------
names : strings
Which path to join. Example: _pattern('path', 'to', 'experiment') will
return... | def _pattern(*names, **kwargs):
"""Returns globbing pattern for name1/name2/../lastname + '--*' or
name1/name2/../lastname + extension if parameter `extension` it set.
Parameters
----------
names : strings
Which path to join. Example: _pattern('path', 'to', 'experiment') will
return... | [
"Returns",
"globbing",
"pattern",
"for",
"name1",
"/",
"name2",
"/",
"..",
"/",
"lastname",
"+",
"--",
"*",
"or",
"name1",
"/",
"name2",
"/",
"..",
"/",
"lastname",
"+",
"extension",
"if",
"parameter",
"extension",
"it",
"set",
"."
] | arve0/leicaexperiment | python | https://github.com/arve0/leicaexperiment/blob/c0393c4d51984a506f813319efb66e54c4f2a426/leicaexperiment/experiment.py#L763-L784 | [
"def",
"_pattern",
"(",
"*",
"names",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"'extension'",
"not",
"in",
"kwargs",
":",
"kwargs",
"[",
"'extension'",
"]",
"=",
"'--*'",
"return",
"os",
".",
"path",
".",
"join",
"(",
"*",
"names",
")",
"+",
"kwarg... | c0393c4d51984a506f813319efb66e54c4f2a426 |
valid | _set_path | Set self.path, self.dirname and self.basename. | leicaexperiment/experiment.py | def _set_path(self, path):
"Set self.path, self.dirname and self.basename."
import os.path
self.path = os.path.abspath(path)
self.dirname = os.path.dirname(path)
self.basename = os.path.basename(path) | def _set_path(self, path):
"Set self.path, self.dirname and self.basename."
import os.path
self.path = os.path.abspath(path)
self.dirname = os.path.dirname(path)
self.basename = os.path.basename(path) | [
"Set",
"self",
".",
"path",
"self",
".",
"dirname",
"and",
"self",
".",
"basename",
"."
] | arve0/leicaexperiment | python | https://github.com/arve0/leicaexperiment/blob/c0393c4d51984a506f813319efb66e54c4f2a426/leicaexperiment/experiment.py#L787-L792 | [
"def",
"_set_path",
"(",
"self",
",",
"path",
")",
":",
"import",
"os",
".",
"path",
"self",
".",
"path",
"=",
"os",
".",
"path",
".",
"abspath",
"(",
"path",
")",
"self",
".",
"dirname",
"=",
"os",
".",
"path",
".",
"dirname",
"(",
"path",
")",
... | c0393c4d51984a506f813319efb66e54c4f2a426 |
valid | Experiment.images | List of paths to images. | leicaexperiment/experiment.py | def images(self):
"List of paths to images."
tifs = _pattern(self._image_path, extension='tif')
pngs = _pattern(self._image_path, extension='png')
imgs = []
imgs.extend(glob(tifs))
imgs.extend(glob(pngs))
return imgs | def images(self):
"List of paths to images."
tifs = _pattern(self._image_path, extension='tif')
pngs = _pattern(self._image_path, extension='png')
imgs = []
imgs.extend(glob(tifs))
imgs.extend(glob(pngs))
return imgs | [
"List",
"of",
"paths",
"to",
"images",
"."
] | arve0/leicaexperiment | python | https://github.com/arve0/leicaexperiment/blob/c0393c4d51984a506f813319efb66e54c4f2a426/leicaexperiment/experiment.py#L96-L103 | [
"def",
"images",
"(",
"self",
")",
":",
"tifs",
"=",
"_pattern",
"(",
"self",
".",
"_image_path",
",",
"extension",
"=",
"'tif'",
")",
"pngs",
"=",
"_pattern",
"(",
"self",
".",
"_image_path",
",",
"extension",
"=",
"'png'",
")",
"imgs",
"=",
"[",
"]... | c0393c4d51984a506f813319efb66e54c4f2a426 |
valid | Experiment.scanning_template | Path to {ScanningTemplate}name.xml of experiment. | leicaexperiment/experiment.py | def scanning_template(self):
"Path to {ScanningTemplate}name.xml of experiment."
tmpl = glob(_pattern(self.path, _additional_data, _scanning_template,
extension='*.xml'))
if tmpl:
return tmpl[0]
else:
return '' | def scanning_template(self):
"Path to {ScanningTemplate}name.xml of experiment."
tmpl = glob(_pattern(self.path, _additional_data, _scanning_template,
extension='*.xml'))
if tmpl:
return tmpl[0]
else:
return '' | [
"Path",
"to",
"{",
"ScanningTemplate",
"}",
"name",
".",
"xml",
"of",
"experiment",
"."
] | arve0/leicaexperiment | python | https://github.com/arve0/leicaexperiment/blob/c0393c4d51984a506f813319efb66e54c4f2a426/leicaexperiment/experiment.py#L113-L120 | [
"def",
"scanning_template",
"(",
"self",
")",
":",
"tmpl",
"=",
"glob",
"(",
"_pattern",
"(",
"self",
".",
"path",
",",
"_additional_data",
",",
"_scanning_template",
",",
"extension",
"=",
"'*.xml'",
")",
")",
"if",
"tmpl",
":",
"return",
"tmpl",
"[",
"... | c0393c4d51984a506f813319efb66e54c4f2a426 |
valid | Experiment.well_rows | All well rows in experiment. Equivalent to --U in files.
Returns
-------
list of ints | leicaexperiment/experiment.py | def well_rows(self, well_row, well_column):
"""All well rows in experiment. Equivalent to --U in files.
Returns
-------
list of ints
"""
return list(set([attribute(img, 'u') for img in self.images])) | def well_rows(self, well_row, well_column):
"""All well rows in experiment. Equivalent to --U in files.
Returns
-------
list of ints
"""
return list(set([attribute(img, 'u') for img in self.images])) | [
"All",
"well",
"rows",
"in",
"experiment",
".",
"Equivalent",
"to",
"--",
"U",
"in",
"files",
"."
] | arve0/leicaexperiment | python | https://github.com/arve0/leicaexperiment/blob/c0393c4d51984a506f813319efb66e54c4f2a426/leicaexperiment/experiment.py#L135-L142 | [
"def",
"well_rows",
"(",
"self",
",",
"well_row",
",",
"well_column",
")",
":",
"return",
"list",
"(",
"set",
"(",
"[",
"attribute",
"(",
"img",
",",
"'u'",
")",
"for",
"img",
"in",
"self",
".",
"images",
"]",
")",
")"
] | c0393c4d51984a506f813319efb66e54c4f2a426 |
valid | Experiment.image | Get path of specified image.
Parameters
----------
well_row : int
Starts at 0. Same as --U in files.
well_column : int
Starts at 0. Same as --V in files.
field_row : int
Starts at 0. Same as --Y in files.
field_column : int
... | leicaexperiment/experiment.py | def image(self, well_row, well_column, field_row, field_column):
"""Get path of specified image.
Parameters
----------
well_row : int
Starts at 0. Same as --U in files.
well_column : int
Starts at 0. Same as --V in files.
field_row : int
... | def image(self, well_row, well_column, field_row, field_column):
"""Get path of specified image.
Parameters
----------
well_row : int
Starts at 0. Same as --U in files.
well_column : int
Starts at 0. Same as --V in files.
field_row : int
... | [
"Get",
"path",
"of",
"specified",
"image",
"."
] | arve0/leicaexperiment | python | https://github.com/arve0/leicaexperiment/blob/c0393c4d51984a506f813319efb66e54c4f2a426/leicaexperiment/experiment.py#L153-L176 | [
"def",
"image",
"(",
"self",
",",
"well_row",
",",
"well_column",
",",
"field_row",
",",
"field_column",
")",
":",
"return",
"next",
"(",
"(",
"i",
"for",
"i",
"in",
"self",
".",
"images",
"if",
"attribute",
"(",
"i",
",",
"'u'",
")",
"==",
"well_col... | c0393c4d51984a506f813319efb66e54c4f2a426 |
valid | Experiment.well_images | Get list of paths to images in specified well.
Parameters
----------
well_row : int
Starts at 0. Same as --V in files.
well_column : int
Starts at 0. Save as --U in files.
Returns
-------
list of strings
Paths to images or em... | leicaexperiment/experiment.py | def well_images(self, well_row, well_column):
"""Get list of paths to images in specified well.
Parameters
----------
well_row : int
Starts at 0. Same as --V in files.
well_column : int
Starts at 0. Save as --U in files.
Returns
-------
... | def well_images(self, well_row, well_column):
"""Get list of paths to images in specified well.
Parameters
----------
well_row : int
Starts at 0. Same as --V in files.
well_column : int
Starts at 0. Save as --U in files.
Returns
-------
... | [
"Get",
"list",
"of",
"paths",
"to",
"images",
"in",
"specified",
"well",
"."
] | arve0/leicaexperiment | python | https://github.com/arve0/leicaexperiment/blob/c0393c4d51984a506f813319efb66e54c4f2a426/leicaexperiment/experiment.py#L179-L197 | [
"def",
"well_images",
"(",
"self",
",",
"well_row",
",",
"well_column",
")",
":",
"return",
"list",
"(",
"i",
"for",
"i",
"in",
"self",
".",
"images",
"if",
"attribute",
"(",
"i",
",",
"'u'",
")",
"==",
"well_column",
"and",
"attribute",
"(",
"i",
",... | c0393c4d51984a506f813319efb66e54c4f2a426 |
valid | Experiment.field_columns | Field columns for given well. Equivalent to --X in files.
Parameters
----------
well_row : int
Starts at 0. Same as --V in files.
well_column : int
Starts at 0. Same as --U in files.
Returns
-------
list of ints
Columns found ... | leicaexperiment/experiment.py | def field_columns(self, well_row, well_column):
"""Field columns for given well. Equivalent to --X in files.
Parameters
----------
well_row : int
Starts at 0. Same as --V in files.
well_column : int
Starts at 0. Same as --U in files.
Returns
... | def field_columns(self, well_row, well_column):
"""Field columns for given well. Equivalent to --X in files.
Parameters
----------
well_row : int
Starts at 0. Same as --V in files.
well_column : int
Starts at 0. Same as --U in files.
Returns
... | [
"Field",
"columns",
"for",
"given",
"well",
".",
"Equivalent",
"to",
"--",
"X",
"in",
"files",
"."
] | arve0/leicaexperiment | python | https://github.com/arve0/leicaexperiment/blob/c0393c4d51984a506f813319efb66e54c4f2a426/leicaexperiment/experiment.py#L200-L216 | [
"def",
"field_columns",
"(",
"self",
",",
"well_row",
",",
"well_column",
")",
":",
"imgs",
"=",
"self",
".",
"well_images",
"(",
"well_row",
",",
"well_column",
")",
"return",
"list",
"(",
"set",
"(",
"[",
"attribute",
"(",
"img",
",",
"'x'",
")",
"fo... | c0393c4d51984a506f813319efb66e54c4f2a426 |
valid | Experiment.stitch | Stitches all wells in experiment with ImageJ. Stitched images are
saved in experiment root.
Images which already exists are omitted stitching.
Parameters
----------
folder : string
Where to store stitched images. Defaults to experiment path.
Returns
... | leicaexperiment/experiment.py | def stitch(self, folder=None):
"""Stitches all wells in experiment with ImageJ. Stitched images are
saved in experiment root.
Images which already exists are omitted stitching.
Parameters
----------
folder : string
Where to store stitched images. Defaults to... | def stitch(self, folder=None):
"""Stitches all wells in experiment with ImageJ. Stitched images are
saved in experiment root.
Images which already exists are omitted stitching.
Parameters
----------
folder : string
Where to store stitched images. Defaults to... | [
"Stitches",
"all",
"wells",
"in",
"experiment",
"with",
"ImageJ",
".",
"Stitched",
"images",
"are",
"saved",
"in",
"experiment",
"root",
"."
] | arve0/leicaexperiment | python | https://github.com/arve0/leicaexperiment/blob/c0393c4d51984a506f813319efb66e54c4f2a426/leicaexperiment/experiment.py#L238-L273 | [
"def",
"stitch",
"(",
"self",
",",
"folder",
"=",
"None",
")",
":",
"debug",
"(",
"'stitching '",
"+",
"self",
".",
"__str__",
"(",
")",
")",
"if",
"not",
"folder",
":",
"folder",
"=",
"self",
".",
"path",
"# create list of macros and files",
"macros",
"... | c0393c4d51984a506f813319efb66e54c4f2a426 |
valid | Experiment.compress | Lossless compress all images in experiment to PNG. If folder is
omitted, images will not be moved.
Images which already exists in PNG are omitted.
Parameters
----------
folder : string
Where to store PNGs. Defaults to the folder they are in.
delete_tif : boo... | leicaexperiment/experiment.py | def compress(self, delete_tif=False, folder=None):
"""Lossless compress all images in experiment to PNG. If folder is
omitted, images will not be moved.
Images which already exists in PNG are omitted.
Parameters
----------
folder : string
Where to store PNGs... | def compress(self, delete_tif=False, folder=None):
"""Lossless compress all images in experiment to PNG. If folder is
omitted, images will not be moved.
Images which already exists in PNG are omitted.
Parameters
----------
folder : string
Where to store PNGs... | [
"Lossless",
"compress",
"all",
"images",
"in",
"experiment",
"to",
"PNG",
".",
"If",
"folder",
"is",
"omitted",
"images",
"will",
"not",
"be",
"moved",
"."
] | arve0/leicaexperiment | python | https://github.com/arve0/leicaexperiment/blob/c0393c4d51984a506f813319efb66e54c4f2a426/leicaexperiment/experiment.py#L276-L295 | [
"def",
"compress",
"(",
"self",
",",
"delete_tif",
"=",
"False",
",",
"folder",
"=",
"None",
")",
":",
"return",
"compress",
"(",
"self",
".",
"images",
",",
"delete_tif",
",",
"folder",
")"
] | c0393c4d51984a506f813319efb66e54c4f2a426 |
valid | Experiment.field_metadata | Get OME-XML metadata of given field.
Parameters
----------
well_row : int
Y well coordinate. Same as --V in files.
well_column : int
X well coordinate. Same as --U in files.
field_row : int
Y field coordinate. Same as --Y in files.
fie... | leicaexperiment/experiment.py | def field_metadata(self, well_row=0, well_column=0,
field_row=0, field_column=0):
"""Get OME-XML metadata of given field.
Parameters
----------
well_row : int
Y well coordinate. Same as --V in files.
well_column : int
X well coordin... | def field_metadata(self, well_row=0, well_column=0,
field_row=0, field_column=0):
"""Get OME-XML metadata of given field.
Parameters
----------
well_row : int
Y well coordinate. Same as --V in files.
well_column : int
X well coordin... | [
"Get",
"OME",
"-",
"XML",
"metadata",
"of",
"given",
"field",
"."
] | arve0/leicaexperiment | python | https://github.com/arve0/leicaexperiment/blob/c0393c4d51984a506f813319efb66e54c4f2a426/leicaexperiment/experiment.py#L298-L330 | [
"def",
"field_metadata",
"(",
"self",
",",
"well_row",
"=",
"0",
",",
"well_column",
"=",
"0",
",",
"field_row",
"=",
"0",
",",
"field_column",
"=",
"0",
")",
":",
"def",
"condition",
"(",
"path",
")",
":",
"attrs",
"=",
"attributes",
"(",
"path",
")... | c0393c4d51984a506f813319efb66e54c4f2a426 |
valid | Experiment.stitch_coordinates | Get a list of stitch coordinates for the given well.
Parameters
----------
well_row : int
Y well coordinate. Same as --V in files.
well_column : int
X well coordinate. Same as --U in files.
Returns
-------
(xs, ys, attr) : tuples with flo... | leicaexperiment/experiment.py | def stitch_coordinates(self, well_row=0, well_column=0):
"""Get a list of stitch coordinates for the given well.
Parameters
----------
well_row : int
Y well coordinate. Same as --V in files.
well_column : int
X well coordinate. Same as --U in files.
... | def stitch_coordinates(self, well_row=0, well_column=0):
"""Get a list of stitch coordinates for the given well.
Parameters
----------
well_row : int
Y well coordinate. Same as --V in files.
well_column : int
X well coordinate. Same as --U in files.
... | [
"Get",
"a",
"list",
"of",
"stitch",
"coordinates",
"for",
"the",
"given",
"well",
"."
] | arve0/leicaexperiment | python | https://github.com/arve0/leicaexperiment/blob/c0393c4d51984a506f813319efb66e54c4f2a426/leicaexperiment/experiment.py#L333-L369 | [
"def",
"stitch_coordinates",
"(",
"self",
",",
"well_row",
"=",
"0",
",",
"well_column",
"=",
"0",
")",
":",
"well",
"=",
"[",
"w",
"for",
"w",
"in",
"self",
".",
"wells",
"if",
"attribute",
"(",
"w",
",",
"'u'",
")",
"==",
"well_column",
"and",
"a... | c0393c4d51984a506f813319efb66e54c4f2a426 |
valid | Droplets.create | Create a new droplet
Parameters
----------
name: str
Name of new droplet
region: str
slug for region (e.g., sfo1, nyc1)
size: str
slug for droplet size (e.g., 512mb, 1024mb)
image: int or str
image id (e.g., 12352) or slug ... | poseidon/droplet.py | def create(self, name, region, size, image, ssh_keys=None,
backups=None, ipv6=None, private_networking=None, wait=True):
"""
Create a new droplet
Parameters
----------
name: str
Name of new droplet
region: str
slug for region (e.g.,... | def create(self, name, region, size, image, ssh_keys=None,
backups=None, ipv6=None, private_networking=None, wait=True):
"""
Create a new droplet
Parameters
----------
name: str
Name of new droplet
region: str
slug for region (e.g.,... | [
"Create",
"a",
"new",
"droplet"
] | changhiskhan/poseidon | python | https://github.com/changhiskhan/poseidon/blob/6d1cecbe02f1e510dd185fe23f88f7af35eb737f/poseidon/droplet.py#L80-L120 | [
"def",
"create",
"(",
"self",
",",
"name",
",",
"region",
",",
"size",
",",
"image",
",",
"ssh_keys",
"=",
"None",
",",
"backups",
"=",
"None",
",",
"ipv6",
"=",
"None",
",",
"private_networking",
"=",
"None",
",",
"wait",
"=",
"True",
")",
":",
"i... | 6d1cecbe02f1e510dd185fe23f88f7af35eb737f |
valid | Droplets.get | Retrieve a droplet by id
Parameters
----------
id: int
droplet id
Returns
-------
droplet: DropletActions | poseidon/droplet.py | def get(self, id):
"""
Retrieve a droplet by id
Parameters
----------
id: int
droplet id
Returns
-------
droplet: DropletActions
"""
info = self._get_droplet_info(id)
return DropletActions(self.api, self, **info) | def get(self, id):
"""
Retrieve a droplet by id
Parameters
----------
id: int
droplet id
Returns
-------
droplet: DropletActions
"""
info = self._get_droplet_info(id)
return DropletActions(self.api, self, **info) | [
"Retrieve",
"a",
"droplet",
"by",
"id"
] | changhiskhan/poseidon | python | https://github.com/changhiskhan/poseidon/blob/6d1cecbe02f1e510dd185fe23f88f7af35eb737f/poseidon/droplet.py#L122-L136 | [
"def",
"get",
"(",
"self",
",",
"id",
")",
":",
"info",
"=",
"self",
".",
"_get_droplet_info",
"(",
"id",
")",
"return",
"DropletActions",
"(",
"self",
".",
"api",
",",
"self",
",",
"*",
"*",
"info",
")"
] | 6d1cecbe02f1e510dd185fe23f88f7af35eb737f |
valid | Droplets.by_name | Retrieve a droplet by name (return first if duplicated)
Parameters
----------
name: str
droplet name
Returns
-------
droplet: DropletActions | poseidon/droplet.py | def by_name(self, name):
"""
Retrieve a droplet by name (return first if duplicated)
Parameters
----------
name: str
droplet name
Returns
-------
droplet: DropletActions
"""
for d in self.list():
if d['name'] == na... | def by_name(self, name):
"""
Retrieve a droplet by name (return first if duplicated)
Parameters
----------
name: str
droplet name
Returns
-------
droplet: DropletActions
"""
for d in self.list():
if d['name'] == na... | [
"Retrieve",
"a",
"droplet",
"by",
"name",
"(",
"return",
"first",
"if",
"duplicated",
")"
] | changhiskhan/poseidon | python | https://github.com/changhiskhan/poseidon/blob/6d1cecbe02f1e510dd185fe23f88f7af35eb737f/poseidon/droplet.py#L141-L157 | [
"def",
"by_name",
"(",
"self",
",",
"name",
")",
":",
"for",
"d",
"in",
"self",
".",
"list",
"(",
")",
":",
"if",
"d",
"[",
"'name'",
"]",
"==",
"name",
":",
"return",
"self",
".",
"get",
"(",
"d",
"[",
"'id'",
"]",
")",
"raise",
"KeyError",
... | 6d1cecbe02f1e510dd185fe23f88f7af35eb737f |
valid | DropletActions.resize | Change the size of this droplet (must be powered off)
Parameters
----------
size: str
size slug, e.g., 512mb
wait: bool, default True
Whether to block until the pending action is completed | poseidon/droplet.py | def resize(self, size, wait=True):
"""
Change the size of this droplet (must be powered off)
Parameters
----------
size: str
size slug, e.g., 512mb
wait: bool, default True
Whether to block until the pending action is completed
"""
... | def resize(self, size, wait=True):
"""
Change the size of this droplet (must be powered off)
Parameters
----------
size: str
size slug, e.g., 512mb
wait: bool, default True
Whether to block until the pending action is completed
"""
... | [
"Change",
"the",
"size",
"of",
"this",
"droplet",
"(",
"must",
"be",
"powered",
"off",
")"
] | changhiskhan/poseidon | python | https://github.com/changhiskhan/poseidon/blob/6d1cecbe02f1e510dd185fe23f88f7af35eb737f/poseidon/droplet.py#L326-L337 | [
"def",
"resize",
"(",
"self",
",",
"size",
",",
"wait",
"=",
"True",
")",
":",
"return",
"self",
".",
"_action",
"(",
"'resize'",
",",
"size",
"=",
"size",
",",
"wait",
"=",
"wait",
")"
] | 6d1cecbe02f1e510dd185fe23f88f7af35eb737f |
valid | DropletActions.restore | Restore this droplet with given image id
A Droplet restoration will rebuild an image using a backup image.
The image ID that is passed in must be a backup of the current Droplet
instance. The operation will leave any embedded SSH keys intact.
Parameters
----------
image... | poseidon/droplet.py | def restore(self, image, wait=True):
"""
Restore this droplet with given image id
A Droplet restoration will rebuild an image using a backup image.
The image ID that is passed in must be a backup of the current Droplet
instance. The operation will leave any embedded SSH keys int... | def restore(self, image, wait=True):
"""
Restore this droplet with given image id
A Droplet restoration will rebuild an image using a backup image.
The image ID that is passed in must be a backup of the current Droplet
instance. The operation will leave any embedded SSH keys int... | [
"Restore",
"this",
"droplet",
"with",
"given",
"image",
"id"
] | changhiskhan/poseidon | python | https://github.com/changhiskhan/poseidon/blob/6d1cecbe02f1e510dd185fe23f88f7af35eb737f/poseidon/droplet.py#L339-L354 | [
"def",
"restore",
"(",
"self",
",",
"image",
",",
"wait",
"=",
"True",
")",
":",
"return",
"self",
".",
"_action",
"(",
"'restore'",
",",
"image",
"=",
"image",
",",
"wait",
"=",
"wait",
")"
] | 6d1cecbe02f1e510dd185fe23f88f7af35eb737f |
valid | DropletActions.rebuild | Rebuild this droplet with given image id
Parameters
----------
image: int or str
int for image id and str for image slug
wait: bool, default True
Whether to block until the pending action is completed | poseidon/droplet.py | def rebuild(self, image, wait=True):
"""
Rebuild this droplet with given image id
Parameters
----------
image: int or str
int for image id and str for image slug
wait: bool, default True
Whether to block until the pending action is completed
... | def rebuild(self, image, wait=True):
"""
Rebuild this droplet with given image id
Parameters
----------
image: int or str
int for image id and str for image slug
wait: bool, default True
Whether to block until the pending action is completed
... | [
"Rebuild",
"this",
"droplet",
"with",
"given",
"image",
"id"
] | changhiskhan/poseidon | python | https://github.com/changhiskhan/poseidon/blob/6d1cecbe02f1e510dd185fe23f88f7af35eb737f/poseidon/droplet.py#L356-L367 | [
"def",
"rebuild",
"(",
"self",
",",
"image",
",",
"wait",
"=",
"True",
")",
":",
"return",
"self",
".",
"_action",
"(",
"'rebuild'",
",",
"image",
"=",
"image",
",",
"wait",
"=",
"wait",
")"
] | 6d1cecbe02f1e510dd185fe23f88f7af35eb737f |
valid | DropletActions.rename | Change the name of this droplet
Parameters
----------
name: str
New name for the droplet
wait: bool, default True
Whether to block until the pending action is completed
Raises
------
APIError if region does not support private networking | poseidon/droplet.py | def rename(self, name, wait=True):
"""
Change the name of this droplet
Parameters
----------
name: str
New name for the droplet
wait: bool, default True
Whether to block until the pending action is completed
Raises
------
... | def rename(self, name, wait=True):
"""
Change the name of this droplet
Parameters
----------
name: str
New name for the droplet
wait: bool, default True
Whether to block until the pending action is completed
Raises
------
... | [
"Change",
"the",
"name",
"of",
"this",
"droplet"
] | changhiskhan/poseidon | python | https://github.com/changhiskhan/poseidon/blob/6d1cecbe02f1e510dd185fe23f88f7af35eb737f/poseidon/droplet.py#L369-L384 | [
"def",
"rename",
"(",
"self",
",",
"name",
",",
"wait",
"=",
"True",
")",
":",
"return",
"self",
".",
"_action",
"(",
"'rename'",
",",
"name",
"=",
"name",
",",
"wait",
"=",
"wait",
")"
] | 6d1cecbe02f1e510dd185fe23f88f7af35eb737f |
valid | DropletActions.change_kernel | Change the kernel of this droplet
Parameters
----------
kernel_id: int
Can be retrieved from output of self.kernels()
wait: bool, default True
Whether to block until the pending action is completed
Raises
------
APIError if region does no... | poseidon/droplet.py | def change_kernel(self, kernel_id, wait=True):
"""
Change the kernel of this droplet
Parameters
----------
kernel_id: int
Can be retrieved from output of self.kernels()
wait: bool, default True
Whether to block until the pending action is complete... | def change_kernel(self, kernel_id, wait=True):
"""
Change the kernel of this droplet
Parameters
----------
kernel_id: int
Can be retrieved from output of self.kernels()
wait: bool, default True
Whether to block until the pending action is complete... | [
"Change",
"the",
"kernel",
"of",
"this",
"droplet"
] | changhiskhan/poseidon | python | https://github.com/changhiskhan/poseidon/blob/6d1cecbe02f1e510dd185fe23f88f7af35eb737f/poseidon/droplet.py#L386-L401 | [
"def",
"change_kernel",
"(",
"self",
",",
"kernel_id",
",",
"wait",
"=",
"True",
")",
":",
"return",
"self",
".",
"_action",
"(",
"'change_kernel'",
",",
"kernel",
"=",
"kernel_id",
",",
"wait",
"=",
"wait",
")"
] | 6d1cecbe02f1e510dd185fe23f88f7af35eb737f |
valid | DropletActions.take_snapshot | Take a snapshot of this droplet (must be powered off)
Parameters
----------
name: str
Name of the snapshot
wait: bool, default True
Whether to block until the pending action is completed | poseidon/droplet.py | def take_snapshot(self, name, wait=True):
"""
Take a snapshot of this droplet (must be powered off)
Parameters
----------
name: str
Name of the snapshot
wait: bool, default True
Whether to block until the pending action is completed
"""
... | def take_snapshot(self, name, wait=True):
"""
Take a snapshot of this droplet (must be powered off)
Parameters
----------
name: str
Name of the snapshot
wait: bool, default True
Whether to block until the pending action is completed
"""
... | [
"Take",
"a",
"snapshot",
"of",
"this",
"droplet",
"(",
"must",
"be",
"powered",
"off",
")"
] | changhiskhan/poseidon | python | https://github.com/changhiskhan/poseidon/blob/6d1cecbe02f1e510dd185fe23f88f7af35eb737f/poseidon/droplet.py#L403-L414 | [
"def",
"take_snapshot",
"(",
"self",
",",
"name",
",",
"wait",
"=",
"True",
")",
":",
"return",
"self",
".",
"_action",
"(",
"'snapshot'",
",",
"name",
"=",
"name",
",",
"wait",
"=",
"wait",
")"
] | 6d1cecbe02f1e510dd185fe23f88f7af35eb737f |
valid | DropletActions.delete | Delete this droplet
Parameters
----------
wait: bool, default True
Whether to block until the pending action is completed | poseidon/droplet.py | def delete(self, wait=True):
"""
Delete this droplet
Parameters
----------
wait: bool, default True
Whether to block until the pending action is completed
"""
resp = self.parent.delete(self.id)
if wait:
self.wait()
return r... | def delete(self, wait=True):
"""
Delete this droplet
Parameters
----------
wait: bool, default True
Whether to block until the pending action is completed
"""
resp = self.parent.delete(self.id)
if wait:
self.wait()
return r... | [
"Delete",
"this",
"droplet"
] | changhiskhan/poseidon | python | https://github.com/changhiskhan/poseidon/blob/6d1cecbe02f1e510dd185fe23f88f7af35eb737f/poseidon/droplet.py#L453-L465 | [
"def",
"delete",
"(",
"self",
",",
"wait",
"=",
"True",
")",
":",
"resp",
"=",
"self",
".",
"parent",
".",
"delete",
"(",
"self",
".",
"id",
")",
"if",
"wait",
":",
"self",
".",
"wait",
"(",
")",
"return",
"resp"
] | 6d1cecbe02f1e510dd185fe23f88f7af35eb737f |
valid | DropletActions.wait | wait for all actions to complete on a droplet | poseidon/droplet.py | def wait(self):
"""
wait for all actions to complete on a droplet
"""
interval_seconds = 5
while True:
actions = self.actions()
slept = False
for a in actions:
if a['status'] == 'in-progress':
# n.b. gevent w... | def wait(self):
"""
wait for all actions to complete on a droplet
"""
interval_seconds = 5
while True:
actions = self.actions()
slept = False
for a in actions:
if a['status'] == 'in-progress':
# n.b. gevent w... | [
"wait",
"for",
"all",
"actions",
"to",
"complete",
"on",
"a",
"droplet"
] | changhiskhan/poseidon | python | https://github.com/changhiskhan/poseidon/blob/6d1cecbe02f1e510dd185fe23f88f7af35eb737f/poseidon/droplet.py#L467-L482 | [
"def",
"wait",
"(",
"self",
")",
":",
"interval_seconds",
"=",
"5",
"while",
"True",
":",
"actions",
"=",
"self",
".",
"actions",
"(",
")",
"slept",
"=",
"False",
"for",
"a",
"in",
"actions",
":",
"if",
"a",
"[",
"'status'",
"]",
"==",
"'in-progress'... | 6d1cecbe02f1e510dd185fe23f88f7af35eb737f |
valid | DropletActions.ip_address | Public ip_address | poseidon/droplet.py | def ip_address(self):
"""
Public ip_address
"""
ip = None
for eth in self.networks['v4']:
if eth['type'] == 'public':
ip = eth['ip_address']
break
if ip is None:
raise ValueError("No public IP found")
return ... | def ip_address(self):
"""
Public ip_address
"""
ip = None
for eth in self.networks['v4']:
if eth['type'] == 'public':
ip = eth['ip_address']
break
if ip is None:
raise ValueError("No public IP found")
return ... | [
"Public",
"ip_address"
] | changhiskhan/poseidon | python | https://github.com/changhiskhan/poseidon/blob/6d1cecbe02f1e510dd185fe23f88f7af35eb737f/poseidon/droplet.py#L485-L496 | [
"def",
"ip_address",
"(",
"self",
")",
":",
"ip",
"=",
"None",
"for",
"eth",
"in",
"self",
".",
"networks",
"[",
"'v4'",
"]",
":",
"if",
"eth",
"[",
"'type'",
"]",
"==",
"'public'",
":",
"ip",
"=",
"eth",
"[",
"'ip_address'",
"]",
"break",
"if",
... | 6d1cecbe02f1e510dd185fe23f88f7af35eb737f |
valid | DropletActions.private_ip | Private ip_address | poseidon/droplet.py | def private_ip(self):
"""
Private ip_address
"""
ip = None
for eth in self.networks['v4']:
if eth['type'] == 'private':
ip = eth['ip_address']
break
if ip is None:
raise ValueError("No private IP found")
retu... | def private_ip(self):
"""
Private ip_address
"""
ip = None
for eth in self.networks['v4']:
if eth['type'] == 'private':
ip = eth['ip_address']
break
if ip is None:
raise ValueError("No private IP found")
retu... | [
"Private",
"ip_address"
] | changhiskhan/poseidon | python | https://github.com/changhiskhan/poseidon/blob/6d1cecbe02f1e510dd185fe23f88f7af35eb737f/poseidon/droplet.py#L499-L510 | [
"def",
"private_ip",
"(",
"self",
")",
":",
"ip",
"=",
"None",
"for",
"eth",
"in",
"self",
".",
"networks",
"[",
"'v4'",
"]",
":",
"if",
"eth",
"[",
"'type'",
"]",
"==",
"'private'",
":",
"ip",
"=",
"eth",
"[",
"'ip_address'",
"]",
"break",
"if",
... | 6d1cecbe02f1e510dd185fe23f88f7af35eb737f |
valid | DropletActions.connect | Open SSH connection to droplet
Parameters
----------
interactive: bool, default False
If True then SSH client will prompt for password when necessary
and also print output to console | poseidon/droplet.py | def connect(self, interactive=False):
"""
Open SSH connection to droplet
Parameters
----------
interactive: bool, default False
If True then SSH client will prompt for password when necessary
and also print output to console
"""
from posei... | def connect(self, interactive=False):
"""
Open SSH connection to droplet
Parameters
----------
interactive: bool, default False
If True then SSH client will prompt for password when necessary
and also print output to console
"""
from posei... | [
"Open",
"SSH",
"connection",
"to",
"droplet"
] | changhiskhan/poseidon | python | https://github.com/changhiskhan/poseidon/blob/6d1cecbe02f1e510dd185fe23f88f7af35eb737f/poseidon/droplet.py#L512-L524 | [
"def",
"connect",
"(",
"self",
",",
"interactive",
"=",
"False",
")",
":",
"from",
"poseidon",
".",
"ssh",
"import",
"SSHClient",
"rs",
"=",
"SSHClient",
"(",
"self",
".",
"ip_address",
",",
"interactive",
"=",
"interactive",
")",
"return",
"rs"
] | 6d1cecbe02f1e510dd185fe23f88f7af35eb737f |
valid | RestAPI.send_request | Send a request to the REST API
Parameters
----------
kind: str, {get, delete, put, post, head}
resource: str
url_components: list or tuple to be appended to the request URL
Notes
-----
kwargs contain request parameters to be sent as request data | poseidon/api.py | def send_request(self, kind, resource, url_components, **kwargs):
"""
Send a request to the REST API
Parameters
----------
kind: str, {get, delete, put, post, head}
resource: str
url_components: list or tuple to be appended to the request URL
Notes
... | def send_request(self, kind, resource, url_components, **kwargs):
"""
Send a request to the REST API
Parameters
----------
kind: str, {get, delete, put, post, head}
resource: str
url_components: list or tuple to be appended to the request URL
Notes
... | [
"Send",
"a",
"request",
"to",
"the",
"REST",
"API"
] | changhiskhan/poseidon | python | https://github.com/changhiskhan/poseidon/blob/6d1cecbe02f1e510dd185fe23f88f7af35eb737f/poseidon/api.py#L47-L70 | [
"def",
"send_request",
"(",
"self",
",",
"kind",
",",
"resource",
",",
"url_components",
",",
"*",
"*",
"kwargs",
")",
":",
"url",
"=",
"self",
".",
"format_request_url",
"(",
"resource",
",",
"*",
"url_components",
")",
"meth",
"=",
"getattr",
"(",
"req... | 6d1cecbe02f1e510dd185fe23f88f7af35eb737f |
valid | RestAPI.format_parameters | Properly formats array types | poseidon/api.py | def format_parameters(self, **kwargs):
"""
Properly formats array types
"""
req_data = {}
for k, v in kwargs.items():
if isinstance(v, (list, tuple)):
k = k + '[]'
req_data[k] = v
return req_data | def format_parameters(self, **kwargs):
"""
Properly formats array types
"""
req_data = {}
for k, v in kwargs.items():
if isinstance(v, (list, tuple)):
k = k + '[]'
req_data[k] = v
return req_data | [
"Properly",
"formats",
"array",
"types"
] | changhiskhan/poseidon | python | https://github.com/changhiskhan/poseidon/blob/6d1cecbe02f1e510dd185fe23f88f7af35eb737f/poseidon/api.py#L91-L100 | [
"def",
"format_parameters",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"req_data",
"=",
"{",
"}",
"for",
"k",
",",
"v",
"in",
"kwargs",
".",
"items",
"(",
")",
":",
"if",
"isinstance",
"(",
"v",
",",
"(",
"list",
",",
"tuple",
")",
")",
":... | 6d1cecbe02f1e510dd185fe23f88f7af35eb737f |
valid | DigitalOceanAPI.format_request_url | create request url for resource | poseidon/api.py | def format_request_url(self, resource, *args):
"""create request url for resource"""
return '/'.join((self.api_url, self.api_version, resource) +
tuple(str(x) for x in args)) | def format_request_url(self, resource, *args):
"""create request url for resource"""
return '/'.join((self.api_url, self.api_version, resource) +
tuple(str(x) for x in args)) | [
"create",
"request",
"url",
"for",
"resource"
] | changhiskhan/poseidon | python | https://github.com/changhiskhan/poseidon/blob/6d1cecbe02f1e510dd185fe23f88f7af35eb737f/poseidon/api.py#L134-L137 | [
"def",
"format_request_url",
"(",
"self",
",",
"resource",
",",
"*",
"args",
")",
":",
"return",
"'/'",
".",
"join",
"(",
"(",
"self",
".",
"api_url",
",",
"self",
".",
"api_version",
",",
"resource",
")",
"+",
"tuple",
"(",
"str",
"(",
"x",
")",
"... | 6d1cecbe02f1e510dd185fe23f88f7af35eb737f |
valid | Resource.send_request | Send a request for this resource to the API
Parameters
----------
kind: str, {'get', 'delete', 'put', 'post', 'head'} | poseidon/api.py | def send_request(self, kind, url_components, **kwargs):
"""
Send a request for this resource to the API
Parameters
----------
kind: str, {'get', 'delete', 'put', 'post', 'head'}
"""
return self.api.send_request(kind, self.resource_path, url_components,
... | def send_request(self, kind, url_components, **kwargs):
"""
Send a request for this resource to the API
Parameters
----------
kind: str, {'get', 'delete', 'put', 'post', 'head'}
"""
return self.api.send_request(kind, self.resource_path, url_components,
... | [
"Send",
"a",
"request",
"for",
"this",
"resource",
"to",
"the",
"API"
] | changhiskhan/poseidon | python | https://github.com/changhiskhan/poseidon/blob/6d1cecbe02f1e510dd185fe23f88f7af35eb737f/poseidon/api.py#L156-L165 | [
"def",
"send_request",
"(",
"self",
",",
"kind",
",",
"url_components",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"self",
".",
"api",
".",
"send_request",
"(",
"kind",
",",
"self",
".",
"resource_path",
",",
"url_components",
",",
"*",
"*",
"kwargs",
... | 6d1cecbe02f1e510dd185fe23f88f7af35eb737f |
valid | ResourceCollection.list | Send list request for all members of a collection | poseidon/api.py | def list(self, url_components=()):
"""
Send list request for all members of a collection
"""
resp = self.get(url_components)
return resp.get(self.result_key, []) | def list(self, url_components=()):
"""
Send list request for all members of a collection
"""
resp = self.get(url_components)
return resp.get(self.result_key, []) | [
"Send",
"list",
"request",
"for",
"all",
"members",
"of",
"a",
"collection"
] | changhiskhan/poseidon | python | https://github.com/changhiskhan/poseidon/blob/6d1cecbe02f1e510dd185fe23f88f7af35eb737f/poseidon/api.py#L205-L210 | [
"def",
"list",
"(",
"self",
",",
"url_components",
"=",
"(",
")",
")",
":",
"resp",
"=",
"self",
".",
"get",
"(",
"url_components",
")",
"return",
"resp",
".",
"get",
"(",
"self",
".",
"result_key",
",",
"[",
"]",
")"
] | 6d1cecbe02f1e510dd185fe23f88f7af35eb737f |
valid | MutableCollection.get | Get single unit of collection | poseidon/api.py | def get(self, id, **kwargs):
"""
Get single unit of collection
"""
return (super(MutableCollection, self).get((id,), **kwargs)
.get(self.singular, None)) | def get(self, id, **kwargs):
"""
Get single unit of collection
"""
return (super(MutableCollection, self).get((id,), **kwargs)
.get(self.singular, None)) | [
"Get",
"single",
"unit",
"of",
"collection"
] | changhiskhan/poseidon | python | https://github.com/changhiskhan/poseidon/blob/6d1cecbe02f1e510dd185fe23f88f7af35eb737f/poseidon/api.py#L245-L250 | [
"def",
"get",
"(",
"self",
",",
"id",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"(",
"super",
"(",
"MutableCollection",
",",
"self",
")",
".",
"get",
"(",
"(",
"id",
",",
")",
",",
"*",
"*",
"kwargs",
")",
".",
"get",
"(",
"self",
".",
"si... | 6d1cecbe02f1e510dd185fe23f88f7af35eb737f |
valid | ImageActions.transfer | Transfer this image to given region
Parameters
----------
region: str
region slug to transfer to (e.g., sfo1, nyc1) | poseidon/api.py | def transfer(self, region):
"""
Transfer this image to given region
Parameters
----------
region: str
region slug to transfer to (e.g., sfo1, nyc1)
"""
action = self.post(type='transfer', region=region)['action']
return self.parent.get(action[... | def transfer(self, region):
"""
Transfer this image to given region
Parameters
----------
region: str
region slug to transfer to (e.g., sfo1, nyc1)
"""
action = self.post(type='transfer', region=region)['action']
return self.parent.get(action[... | [
"Transfer",
"this",
"image",
"to",
"given",
"region"
] | changhiskhan/poseidon | python | https://github.com/changhiskhan/poseidon/blob/6d1cecbe02f1e510dd185fe23f88f7af35eb737f/poseidon/api.py#L270-L280 | [
"def",
"transfer",
"(",
"self",
",",
"region",
")",
":",
"action",
"=",
"self",
".",
"post",
"(",
"type",
"=",
"'transfer'",
",",
"region",
"=",
"region",
")",
"[",
"'action'",
"]",
"return",
"self",
".",
"parent",
".",
"get",
"(",
"action",
"[",
"... | 6d1cecbe02f1e510dd185fe23f88f7af35eb737f |
valid | Images.get | id or slug | poseidon/api.py | def get(self, id):
"""id or slug"""
info = super(Images, self).get(id)
return ImageActions(self.api, parent=self, **info) | def get(self, id):
"""id or slug"""
info = super(Images, self).get(id)
return ImageActions(self.api, parent=self, **info) | [
"id",
"or",
"slug"
] | changhiskhan/poseidon | python | https://github.com/changhiskhan/poseidon/blob/6d1cecbe02f1e510dd185fe23f88f7af35eb737f/poseidon/api.py#L306-L309 | [
"def",
"get",
"(",
"self",
",",
"id",
")",
":",
"info",
"=",
"super",
"(",
"Images",
",",
"self",
")",
".",
"get",
"(",
"id",
")",
"return",
"ImageActions",
"(",
"self",
".",
"api",
",",
"parent",
"=",
"self",
",",
"*",
"*",
"info",
")"
] | 6d1cecbe02f1e510dd185fe23f88f7af35eb737f |
valid | Keys.update | id or fingerprint | poseidon/api.py | def update(self, id, name):
"""id or fingerprint"""
return super(Keys, self).update(id, name=name) | def update(self, id, name):
"""id or fingerprint"""
return super(Keys, self).update(id, name=name) | [
"id",
"or",
"fingerprint"
] | changhiskhan/poseidon | python | https://github.com/changhiskhan/poseidon/blob/6d1cecbe02f1e510dd185fe23f88f7af35eb737f/poseidon/api.py#L326-L328 | [
"def",
"update",
"(",
"self",
",",
"id",
",",
"name",
")",
":",
"return",
"super",
"(",
"Keys",
",",
"self",
")",
".",
"update",
"(",
"id",
",",
"name",
"=",
"name",
")"
] | 6d1cecbe02f1e510dd185fe23f88f7af35eb737f |
valid | Domains.create | Creates a new domain
Parameters
----------
name: str
new domain name
ip_address: str
IP address for the new domain | poseidon/api.py | def create(self, name, ip_address):
"""
Creates a new domain
Parameters
----------
name: str
new domain name
ip_address: str
IP address for the new domain
"""
return (self.post(name=name, ip_address=ip_address)
.get... | def create(self, name, ip_address):
"""
Creates a new domain
Parameters
----------
name: str
new domain name
ip_address: str
IP address for the new domain
"""
return (self.post(name=name, ip_address=ip_address)
.get... | [
"Creates",
"a",
"new",
"domain"
] | changhiskhan/poseidon | python | https://github.com/changhiskhan/poseidon/blob/6d1cecbe02f1e510dd185fe23f88f7af35eb737f/poseidon/api.py#L348-L360 | [
"def",
"create",
"(",
"self",
",",
"name",
",",
"ip_address",
")",
":",
"return",
"(",
"self",
".",
"post",
"(",
"name",
"=",
"name",
",",
"ip_address",
"=",
"ip_address",
")",
".",
"get",
"(",
"self",
".",
"singular",
",",
"None",
")",
")"
] | 6d1cecbe02f1e510dd185fe23f88f7af35eb737f |
valid | Domains.records | Get a list of all domain records for the given domain name
Parameters
----------
name: str
domain name | poseidon/api.py | def records(self, name):
"""
Get a list of all domain records for the given domain name
Parameters
----------
name: str
domain name
"""
if self.get(name):
return DomainRecords(self.api, name) | def records(self, name):
"""
Get a list of all domain records for the given domain name
Parameters
----------
name: str
domain name
"""
if self.get(name):
return DomainRecords(self.api, name) | [
"Get",
"a",
"list",
"of",
"all",
"domain",
"records",
"for",
"the",
"given",
"domain",
"name"
] | changhiskhan/poseidon | python | https://github.com/changhiskhan/poseidon/blob/6d1cecbe02f1e510dd185fe23f88f7af35eb737f/poseidon/api.py#L362-L372 | [
"def",
"records",
"(",
"self",
",",
"name",
")",
":",
"if",
"self",
".",
"get",
"(",
"name",
")",
":",
"return",
"DomainRecords",
"(",
"self",
".",
"api",
",",
"name",
")"
] | 6d1cecbe02f1e510dd185fe23f88f7af35eb737f |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.