id int32 0 252k | repo stringlengths 7 55 | path stringlengths 4 127 | func_name stringlengths 1 88 | original_string stringlengths 75 19.8k | language stringclasses 1
value | code stringlengths 75 19.8k | code_tokens list | docstring stringlengths 3 17.3k | docstring_tokens list | sha stringlengths 40 40 | url stringlengths 87 242 |
|---|---|---|---|---|---|---|---|---|---|---|---|
51,800 | senaite/senaite.jsonapi | src/senaite/jsonapi/v1/routes/content.py | action | def action(context, request, action=None, resource=None, uid=None):
"""Various HTTP POST actions
"""
# allow to set the method via the header
if action is None:
action = request.get_header("HTTP_X_HTTP_METHOD_OVERRIDE", "CREATE").lower()
# Fetch and call the action function of the API
... | python | def action(context, request, action=None, resource=None, uid=None):
"""Various HTTP POST actions
"""
# allow to set the method via the header
if action is None:
action = request.get_header("HTTP_X_HTTP_METHOD_OVERRIDE", "CREATE").lower()
# Fetch and call the action function of the API
... | [
"def",
"action",
"(",
"context",
",",
"request",
",",
"action",
"=",
"None",
",",
"resource",
"=",
"None",
",",
"uid",
"=",
"None",
")",
":",
"# allow to set the method via the header",
"if",
"action",
"is",
"None",
":",
"action",
"=",
"request",
".",
"get... | Various HTTP POST actions | [
"Various",
"HTTP",
"POST",
"actions"
] | 871959f4b1c9edbb477e9456325527ca78e13ec6 | https://github.com/senaite/senaite.jsonapi/blob/871959f4b1c9edbb477e9456325527ca78e13ec6/src/senaite/jsonapi/v1/routes/content.py#L56-L77 |
51,801 | danilobellini/dose | dose/help.py | build_help_html | def build_help_html():
"""Build the help HTML using the shared resources."""
remove_from_help = ["not-in-help", "copyright"]
if sys.platform in ["win32", "cygwin"]:
remove_from_help.extend(["osx", "linux"])
elif sys.platform == "darwin":
remove_from_help.extend(["linux", "windows", "linu... | python | def build_help_html():
"""Build the help HTML using the shared resources."""
remove_from_help = ["not-in-help", "copyright"]
if sys.platform in ["win32", "cygwin"]:
remove_from_help.extend(["osx", "linux"])
elif sys.platform == "darwin":
remove_from_help.extend(["linux", "windows", "linu... | [
"def",
"build_help_html",
"(",
")",
":",
"remove_from_help",
"=",
"[",
"\"not-in-help\"",
",",
"\"copyright\"",
"]",
"if",
"sys",
".",
"platform",
"in",
"[",
"\"win32\"",
",",
"\"cygwin\"",
"]",
":",
"remove_from_help",
".",
"extend",
"(",
"[",
"\"osx\"",
",... | Build the help HTML using the shared resources. | [
"Build",
"the",
"help",
"HTML",
"using",
"the",
"shared",
"resources",
"."
] | 141f48322f7812b7d32e3d5f065d4473a11102a4 | https://github.com/danilobellini/dose/blob/141f48322f7812b7d32e3d5f065d4473a11102a4/dose/help.py#L137-L163 |
51,802 | danilobellini/dose | dose/help.py | help_box | def help_box():
"""A simple HTML help dialog box using the distribution data files."""
style = wx.DEFAULT_DIALOG_STYLE | wx.RESIZE_BORDER
dialog_box = wx.Dialog(None, wx.ID_ANY, HELP_TITLE,
style=style, size=(620, 450))
html_widget = HtmlHelp(dialog_box, wx.ID_ANY)
html_wi... | python | def help_box():
"""A simple HTML help dialog box using the distribution data files."""
style = wx.DEFAULT_DIALOG_STYLE | wx.RESIZE_BORDER
dialog_box = wx.Dialog(None, wx.ID_ANY, HELP_TITLE,
style=style, size=(620, 450))
html_widget = HtmlHelp(dialog_box, wx.ID_ANY)
html_wi... | [
"def",
"help_box",
"(",
")",
":",
"style",
"=",
"wx",
".",
"DEFAULT_DIALOG_STYLE",
"|",
"wx",
".",
"RESIZE_BORDER",
"dialog_box",
"=",
"wx",
".",
"Dialog",
"(",
"None",
",",
"wx",
".",
"ID_ANY",
",",
"HELP_TITLE",
",",
"style",
"=",
"style",
",",
"size... | A simple HTML help dialog box using the distribution data files. | [
"A",
"simple",
"HTML",
"help",
"dialog",
"box",
"using",
"the",
"distribution",
"data",
"files",
"."
] | 141f48322f7812b7d32e3d5f065d4473a11102a4 | https://github.com/danilobellini/dose/blob/141f48322f7812b7d32e3d5f065d4473a11102a4/dose/help.py#L185-L193 |
51,803 | dschreij/python-mediadecoder | mediadecoder/soundrenderers/sounddevicerenderer.py | SoundrendererSounddevice.get_frame | def get_frame(self, outdata, frames, timedata, status):
""" Callback function for the audio stream. Don't use directly. """
if not self.keep_listening:
raise sd.CallbackStop
try:
chunk = self.queue.get_nowait()
# Check if the chunk contains the expected number of frames
# The callback function rai... | python | def get_frame(self, outdata, frames, timedata, status):
""" Callback function for the audio stream. Don't use directly. """
if not self.keep_listening:
raise sd.CallbackStop
try:
chunk = self.queue.get_nowait()
# Check if the chunk contains the expected number of frames
# The callback function rai... | [
"def",
"get_frame",
"(",
"self",
",",
"outdata",
",",
"frames",
",",
"timedata",
",",
"status",
")",
":",
"if",
"not",
"self",
".",
"keep_listening",
":",
"raise",
"sd",
".",
"CallbackStop",
"try",
":",
"chunk",
"=",
"self",
".",
"queue",
".",
"get_now... | Callback function for the audio stream. Don't use directly. | [
"Callback",
"function",
"for",
"the",
"audio",
"stream",
".",
"Don",
"t",
"use",
"directly",
"."
] | f01b02d790f2abc52d9792e43076cf4cb7d3ce51 | https://github.com/dschreij/python-mediadecoder/blob/f01b02d790f2abc52d9792e43076cf4cb7d3ce51/mediadecoder/soundrenderers/sounddevicerenderer.py#L41-L56 |
51,804 | idmillington/layout | layout/datatypes/position.py | Point.get_component_product | def get_component_product(self, other):
"""Returns the component product of this vector and the given
other vector."""
return Point(self.x * other.x, self.y * other.y) | python | def get_component_product(self, other):
"""Returns the component product of this vector and the given
other vector."""
return Point(self.x * other.x, self.y * other.y) | [
"def",
"get_component_product",
"(",
"self",
",",
"other",
")",
":",
"return",
"Point",
"(",
"self",
".",
"x",
"*",
"other",
".",
"x",
",",
"self",
".",
"y",
"*",
"other",
".",
"y",
")"
] | Returns the component product of this vector and the given
other vector. | [
"Returns",
"the",
"component",
"product",
"of",
"this",
"vector",
"and",
"the",
"given",
"other",
"vector",
"."
] | c452d1d7a74c9a74f7639c1b49e2a41c4e354bb5 | https://github.com/idmillington/layout/blob/c452d1d7a74c9a74f7639c1b49e2a41c4e354bb5/layout/datatypes/position.py#L34-L37 |
51,805 | idmillington/layout | layout/datatypes/position.py | Point.get_normalized | def get_normalized(self):
"""Returns a vector of unit length, unless it is the zero
vector, in which case it is left as is."""
magnitude = self.get_magnitude()
if magnitude > 0:
magnitude = 1.0 / magnitude
return Point(self.x * magnitude, self.y * magnitude)
... | python | def get_normalized(self):
"""Returns a vector of unit length, unless it is the zero
vector, in which case it is left as is."""
magnitude = self.get_magnitude()
if magnitude > 0:
magnitude = 1.0 / magnitude
return Point(self.x * magnitude, self.y * magnitude)
... | [
"def",
"get_normalized",
"(",
"self",
")",
":",
"magnitude",
"=",
"self",
".",
"get_magnitude",
"(",
")",
"if",
"magnitude",
">",
"0",
":",
"magnitude",
"=",
"1.0",
"/",
"magnitude",
"return",
"Point",
"(",
"self",
".",
"x",
"*",
"magnitude",
",",
"sel... | Returns a vector of unit length, unless it is the zero
vector, in which case it is left as is. | [
"Returns",
"a",
"vector",
"of",
"unit",
"length",
"unless",
"it",
"is",
"the",
"zero",
"vector",
"in",
"which",
"case",
"it",
"is",
"left",
"as",
"is",
"."
] | c452d1d7a74c9a74f7639c1b49e2a41c4e354bb5 | https://github.com/idmillington/layout/blob/c452d1d7a74c9a74f7639c1b49e2a41c4e354bb5/layout/datatypes/position.py#L39-L47 |
51,806 | idmillington/layout | layout/datatypes/position.py | Point.get_rotated | def get_rotated(self, angle):
"""Rotates this vector through the given anti-clockwise angle
in radians."""
ca = math.cos(angle)
sa = math.sin(angle)
return Point(self.x*ca-self.y*sa, self.x*sa+self.y*ca) | python | def get_rotated(self, angle):
"""Rotates this vector through the given anti-clockwise angle
in radians."""
ca = math.cos(angle)
sa = math.sin(angle)
return Point(self.x*ca-self.y*sa, self.x*sa+self.y*ca) | [
"def",
"get_rotated",
"(",
"self",
",",
"angle",
")",
":",
"ca",
"=",
"math",
".",
"cos",
"(",
"angle",
")",
"sa",
"=",
"math",
".",
"sin",
"(",
"angle",
")",
"return",
"Point",
"(",
"self",
".",
"x",
"*",
"ca",
"-",
"self",
".",
"y",
"*",
"s... | Rotates this vector through the given anti-clockwise angle
in radians. | [
"Rotates",
"this",
"vector",
"through",
"the",
"given",
"anti",
"-",
"clockwise",
"angle",
"in",
"radians",
"."
] | c452d1d7a74c9a74f7639c1b49e2a41c4e354bb5 | https://github.com/idmillington/layout/blob/c452d1d7a74c9a74f7639c1b49e2a41c4e354bb5/layout/datatypes/position.py#L66-L71 |
51,807 | idmillington/layout | layout/datatypes/position.py | Point.get_magnitude | def get_magnitude(self):
"""Returns the magnitude of this vector."""
return math.sqrt(self.x*self.x + self.y*self.y) | python | def get_magnitude(self):
"""Returns the magnitude of this vector."""
return math.sqrt(self.x*self.x + self.y*self.y) | [
"def",
"get_magnitude",
"(",
"self",
")",
":",
"return",
"math",
".",
"sqrt",
"(",
"self",
".",
"x",
"*",
"self",
".",
"x",
"+",
"self",
".",
"y",
"*",
"self",
".",
"y",
")"
] | Returns the magnitude of this vector. | [
"Returns",
"the",
"magnitude",
"of",
"this",
"vector",
"."
] | c452d1d7a74c9a74f7639c1b49e2a41c4e354bb5 | https://github.com/idmillington/layout/blob/c452d1d7a74c9a74f7639c1b49e2a41c4e354bb5/layout/datatypes/position.py#L73-L75 |
51,808 | idmillington/layout | layout/datatypes/position.py | Point.get_magnitude_squared | def get_magnitude_squared(self):
"""Returns the square of the magnitude of this vector."""
return self.x*self.x + self.y*self.y | python | def get_magnitude_squared(self):
"""Returns the square of the magnitude of this vector."""
return self.x*self.x + self.y*self.y | [
"def",
"get_magnitude_squared",
"(",
"self",
")",
":",
"return",
"self",
".",
"x",
"*",
"self",
".",
"x",
"+",
"self",
".",
"y",
"*",
"self",
".",
"y"
] | Returns the square of the magnitude of this vector. | [
"Returns",
"the",
"square",
"of",
"the",
"magnitude",
"of",
"this",
"vector",
"."
] | c452d1d7a74c9a74f7639c1b49e2a41c4e354bb5 | https://github.com/idmillington/layout/blob/c452d1d7a74c9a74f7639c1b49e2a41c4e354bb5/layout/datatypes/position.py#L77-L79 |
51,809 | idmillington/layout | layout/datatypes/position.py | Point.get_scalar_product | def get_scalar_product(self, other):
"""Returns the scalar product of this vector with the given
other vector."""
return self.x*other.x+self.y*other.y | python | def get_scalar_product(self, other):
"""Returns the scalar product of this vector with the given
other vector."""
return self.x*other.x+self.y*other.y | [
"def",
"get_scalar_product",
"(",
"self",
",",
"other",
")",
":",
"return",
"self",
".",
"x",
"*",
"other",
".",
"x",
"+",
"self",
".",
"y",
"*",
"other",
".",
"y"
] | Returns the scalar product of this vector with the given
other vector. | [
"Returns",
"the",
"scalar",
"product",
"of",
"this",
"vector",
"with",
"the",
"given",
"other",
"vector",
"."
] | c452d1d7a74c9a74f7639c1b49e2a41c4e354bb5 | https://github.com/idmillington/layout/blob/c452d1d7a74c9a74f7639c1b49e2a41c4e354bb5/layout/datatypes/position.py#L93-L96 |
51,810 | idmillington/layout | layout/datatypes/position.py | Point.get_angle_between | def get_angle_between(self, other):
"""Returns the smallest angle between this vector and the
given other vector."""
# The scalar product is the sum of the squares of the
# magnitude times the cosine of the angle - so normalizing the
# vectors first means the scalar product is ju... | python | def get_angle_between(self, other):
"""Returns the smallest angle between this vector and the
given other vector."""
# The scalar product is the sum of the squares of the
# magnitude times the cosine of the angle - so normalizing the
# vectors first means the scalar product is ju... | [
"def",
"get_angle_between",
"(",
"self",
",",
"other",
")",
":",
"# The scalar product is the sum of the squares of the",
"# magnitude times the cosine of the angle - so normalizing the",
"# vectors first means the scalar product is just the cosine of",
"# the angle.",
"normself",
"=",
"... | Returns the smallest angle between this vector and the
given other vector. | [
"Returns",
"the",
"smallest",
"angle",
"between",
"this",
"vector",
"and",
"the",
"given",
"other",
"vector",
"."
] | c452d1d7a74c9a74f7639c1b49e2a41c4e354bb5 | https://github.com/idmillington/layout/blob/c452d1d7a74c9a74f7639c1b49e2a41c4e354bb5/layout/datatypes/position.py#L98-L108 |
51,811 | idmillington/layout | layout/datatypes/position.py | Point.get_minimum | def get_minimum(self, other):
"""Updates this vector so its components are the lower of its
current components and those of the given other value."""
return Point(min(self.x, other.x), min(self.y, other.y)) | python | def get_minimum(self, other):
"""Updates this vector so its components are the lower of its
current components and those of the given other value."""
return Point(min(self.x, other.x), min(self.y, other.y)) | [
"def",
"get_minimum",
"(",
"self",
",",
"other",
")",
":",
"return",
"Point",
"(",
"min",
"(",
"self",
".",
"x",
",",
"other",
".",
"x",
")",
",",
"min",
"(",
"self",
".",
"y",
",",
"other",
".",
"y",
")",
")"
] | Updates this vector so its components are the lower of its
current components and those of the given other value. | [
"Updates",
"this",
"vector",
"so",
"its",
"components",
"are",
"the",
"lower",
"of",
"its",
"current",
"components",
"and",
"those",
"of",
"the",
"given",
"other",
"value",
"."
] | c452d1d7a74c9a74f7639c1b49e2a41c4e354bb5 | https://github.com/idmillington/layout/blob/c452d1d7a74c9a74f7639c1b49e2a41c4e354bb5/layout/datatypes/position.py#L110-L113 |
51,812 | idmillington/layout | layout/datatypes/position.py | Point.get_maximum | def get_maximum(self, other):
"""Updates this vector so its components are the higher of its
current components and those of the given other value."""
return Point(max(self.x, other.x), max(self.y, other.y)) | python | def get_maximum(self, other):
"""Updates this vector so its components are the higher of its
current components and those of the given other value."""
return Point(max(self.x, other.x), max(self.y, other.y)) | [
"def",
"get_maximum",
"(",
"self",
",",
"other",
")",
":",
"return",
"Point",
"(",
"max",
"(",
"self",
".",
"x",
",",
"other",
".",
"x",
")",
",",
"max",
"(",
"self",
".",
"y",
",",
"other",
".",
"y",
")",
")"
] | Updates this vector so its components are the higher of its
current components and those of the given other value. | [
"Updates",
"this",
"vector",
"so",
"its",
"components",
"are",
"the",
"higher",
"of",
"its",
"current",
"components",
"and",
"those",
"of",
"the",
"given",
"other",
"value",
"."
] | c452d1d7a74c9a74f7639c1b49e2a41c4e354bb5 | https://github.com/idmillington/layout/blob/c452d1d7a74c9a74f7639c1b49e2a41c4e354bb5/layout/datatypes/position.py#L115-L118 |
51,813 | idmillington/layout | layout/datatypes/position.py | Point.get_random | def get_random(min_pt, max_pt):
"""Returns a random vector in the given range."""
result = Point(random.random(), random.random())
return result.get_component_product(max_pt - min_pt) + min_pt | python | def get_random(min_pt, max_pt):
"""Returns a random vector in the given range."""
result = Point(random.random(), random.random())
return result.get_component_product(max_pt - min_pt) + min_pt | [
"def",
"get_random",
"(",
"min_pt",
",",
"max_pt",
")",
":",
"result",
"=",
"Point",
"(",
"random",
".",
"random",
"(",
")",
",",
"random",
".",
"random",
"(",
")",
")",
"return",
"result",
".",
"get_component_product",
"(",
"max_pt",
"-",
"min_pt",
")... | Returns a random vector in the given range. | [
"Returns",
"a",
"random",
"vector",
"in",
"the",
"given",
"range",
"."
] | c452d1d7a74c9a74f7639c1b49e2a41c4e354bb5 | https://github.com/idmillington/layout/blob/c452d1d7a74c9a74f7639c1b49e2a41c4e354bb5/layout/datatypes/position.py#L121-L124 |
51,814 | idmillington/layout | layout/datatypes/position.py | Rectangle.get_data | def get_data(self):
"""Returns the x, y, w, h, data as a tuple."""
return self.x, self.y, self.w, self.h | python | def get_data(self):
"""Returns the x, y, w, h, data as a tuple."""
return self.x, self.y, self.w, self.h | [
"def",
"get_data",
"(",
"self",
")",
":",
"return",
"self",
".",
"x",
",",
"self",
".",
"y",
",",
"self",
".",
"w",
",",
"self",
".",
"h"
] | Returns the x, y, w, h, data as a tuple. | [
"Returns",
"the",
"x",
"y",
"w",
"h",
"data",
"as",
"a",
"tuple",
"."
] | c452d1d7a74c9a74f7639c1b49e2a41c4e354bb5 | https://github.com/idmillington/layout/blob/c452d1d7a74c9a74f7639c1b49e2a41c4e354bb5/layout/datatypes/position.py#L208-L210 |
51,815 | zyga/python-glibc | tempfile_ext.py | _candidate_tempdir_list | def _candidate_tempdir_list():
"""Generate a list of candidate temporary directories which
_get_default_tempdir will try."""
dirlist = []
# First, try the environment.
for envname in 'TMPDIR', 'TEMP', 'TMP':
dirname = _os.getenv(envname)
if dirname: dirlist.append(dirname)
# F... | python | def _candidate_tempdir_list():
"""Generate a list of candidate temporary directories which
_get_default_tempdir will try."""
dirlist = []
# First, try the environment.
for envname in 'TMPDIR', 'TEMP', 'TMP':
dirname = _os.getenv(envname)
if dirname: dirlist.append(dirname)
# F... | [
"def",
"_candidate_tempdir_list",
"(",
")",
":",
"dirlist",
"=",
"[",
"]",
"# First, try the environment.",
"for",
"envname",
"in",
"'TMPDIR'",
",",
"'TEMP'",
",",
"'TMP'",
":",
"dirname",
"=",
"_os",
".",
"getenv",
"(",
"envname",
")",
"if",
"dirname",
":",... | Generate a list of candidate temporary directories which
_get_default_tempdir will try. | [
"Generate",
"a",
"list",
"of",
"candidate",
"temporary",
"directories",
"which",
"_get_default_tempdir",
"will",
"try",
"."
] | d6fdb306b123a995471584a5201155c60a34448a | https://github.com/zyga/python-glibc/blob/d6fdb306b123a995471584a5201155c60a34448a/tempfile_ext.py#L254-L277 |
51,816 | zyga/python-glibc | tempfile_ext.py | _get_default_tempdir | def _get_default_tempdir():
"""Calculate the default directory to use for temporary files.
This routine should be called exactly once.
We determine whether or not a candidate temp dir is usable by
trying to create and write to a file in that directory. If this
is successful, the test file is delet... | python | def _get_default_tempdir():
"""Calculate the default directory to use for temporary files.
This routine should be called exactly once.
We determine whether or not a candidate temp dir is usable by
trying to create and write to a file in that directory. If this
is successful, the test file is delet... | [
"def",
"_get_default_tempdir",
"(",
")",
":",
"namer",
"=",
"_RandomNameSequence",
"(",
")",
"dirlist",
"=",
"_candidate_tempdir_list",
"(",
")",
"for",
"dir",
"in",
"dirlist",
":",
"if",
"dir",
"!=",
"_os",
".",
"curdir",
":",
"dir",
"=",
"_os",
".",
"p... | Calculate the default directory to use for temporary files.
This routine should be called exactly once.
We determine whether or not a candidate temp dir is usable by
trying to create and write to a file in that directory. If this
is successful, the test file is deleted. To prevent denial of
servi... | [
"Calculate",
"the",
"default",
"directory",
"to",
"use",
"for",
"temporary",
"files",
".",
"This",
"routine",
"should",
"be",
"called",
"exactly",
"once",
"."
] | d6fdb306b123a995471584a5201155c60a34448a | https://github.com/zyga/python-glibc/blob/d6fdb306b123a995471584a5201155c60a34448a/tempfile_ext.py#L279-L315 |
51,817 | zyga/python-glibc | tempfile_ext.py | _get_candidate_names | def _get_candidate_names():
"""Common setup sequence for all user-callable interfaces."""
global _name_sequence
if _name_sequence is None:
_once_lock.acquire()
try:
if _name_sequence is None:
_name_sequence = _RandomNameSequence()
finally:
_on... | python | def _get_candidate_names():
"""Common setup sequence for all user-callable interfaces."""
global _name_sequence
if _name_sequence is None:
_once_lock.acquire()
try:
if _name_sequence is None:
_name_sequence = _RandomNameSequence()
finally:
_on... | [
"def",
"_get_candidate_names",
"(",
")",
":",
"global",
"_name_sequence",
"if",
"_name_sequence",
"is",
"None",
":",
"_once_lock",
".",
"acquire",
"(",
")",
"try",
":",
"if",
"_name_sequence",
"is",
"None",
":",
"_name_sequence",
"=",
"_RandomNameSequence",
"(",... | Common setup sequence for all user-callable interfaces. | [
"Common",
"setup",
"sequence",
"for",
"all",
"user",
"-",
"callable",
"interfaces",
"."
] | d6fdb306b123a995471584a5201155c60a34448a | https://github.com/zyga/python-glibc/blob/d6fdb306b123a995471584a5201155c60a34448a/tempfile_ext.py#L319-L330 |
51,818 | zyga/python-glibc | tempfile_ext.py | _mkstemp_inner | def _mkstemp_inner(dir, pre, suf, flags):
"""Code common to mkstemp, TemporaryFile, and NamedTemporaryFile."""
names = _get_candidate_names()
for seq in range(TMP_MAX):
name = next(names)
file = _os.path.join(dir, pre + name + suf)
try:
fd = _os.open(file, flags, 0o600)... | python | def _mkstemp_inner(dir, pre, suf, flags):
"""Code common to mkstemp, TemporaryFile, and NamedTemporaryFile."""
names = _get_candidate_names()
for seq in range(TMP_MAX):
name = next(names)
file = _os.path.join(dir, pre + name + suf)
try:
fd = _os.open(file, flags, 0o600)... | [
"def",
"_mkstemp_inner",
"(",
"dir",
",",
"pre",
",",
"suf",
",",
"flags",
")",
":",
"names",
"=",
"_get_candidate_names",
"(",
")",
"for",
"seq",
"in",
"range",
"(",
"TMP_MAX",
")",
":",
"name",
"=",
"next",
"(",
"names",
")",
"file",
"=",
"_os",
... | Code common to mkstemp, TemporaryFile, and NamedTemporaryFile. | [
"Code",
"common",
"to",
"mkstemp",
"TemporaryFile",
"and",
"NamedTemporaryFile",
"."
] | d6fdb306b123a995471584a5201155c60a34448a | https://github.com/zyga/python-glibc/blob/d6fdb306b123a995471584a5201155c60a34448a/tempfile_ext.py#L333-L355 |
51,819 | zyga/python-glibc | tempfile_ext.py | gettempdir | def gettempdir():
"""Accessor for tempfile.tempdir."""
global tempdir
if tempdir is None:
_once_lock.acquire()
try:
if tempdir is None:
tempdir = _get_default_tempdir()
finally:
_once_lock.release()
return tempdir | python | def gettempdir():
"""Accessor for tempfile.tempdir."""
global tempdir
if tempdir is None:
_once_lock.acquire()
try:
if tempdir is None:
tempdir = _get_default_tempdir()
finally:
_once_lock.release()
return tempdir | [
"def",
"gettempdir",
"(",
")",
":",
"global",
"tempdir",
"if",
"tempdir",
"is",
"None",
":",
"_once_lock",
".",
"acquire",
"(",
")",
"try",
":",
"if",
"tempdir",
"is",
"None",
":",
"tempdir",
"=",
"_get_default_tempdir",
"(",
")",
"finally",
":",
"_once_... | Accessor for tempfile.tempdir. | [
"Accessor",
"for",
"tempfile",
".",
"tempdir",
"."
] | d6fdb306b123a995471584a5201155c60a34448a | https://github.com/zyga/python-glibc/blob/d6fdb306b123a995471584a5201155c60a34448a/tempfile_ext.py#L366-L376 |
51,820 | zyga/python-glibc | tempfile_ext.py | mkdtemp | def mkdtemp(suffix="", prefix=template, dir=None):
"""User-callable function to create and return a unique temporary
directory. The return value is the pathname of the directory.
Arguments are as for mkstemp, except that the 'text' argument is
not accepted.
The directory is readable, writable, an... | python | def mkdtemp(suffix="", prefix=template, dir=None):
"""User-callable function to create and return a unique temporary
directory. The return value is the pathname of the directory.
Arguments are as for mkstemp, except that the 'text' argument is
not accepted.
The directory is readable, writable, an... | [
"def",
"mkdtemp",
"(",
"suffix",
"=",
"\"\"",
",",
"prefix",
"=",
"template",
",",
"dir",
"=",
"None",
")",
":",
"if",
"dir",
"is",
"None",
":",
"dir",
"=",
"gettempdir",
"(",
")",
"names",
"=",
"_get_candidate_names",
"(",
")",
"for",
"seq",
"in",
... | User-callable function to create and return a unique temporary
directory. The return value is the pathname of the directory.
Arguments are as for mkstemp, except that the 'text' argument is
not accepted.
The directory is readable, writable, and searchable only by the
creating user.
Caller is... | [
"User",
"-",
"callable",
"function",
"to",
"create",
"and",
"return",
"a",
"unique",
"temporary",
"directory",
".",
"The",
"return",
"value",
"is",
"the",
"pathname",
"of",
"the",
"directory",
"."
] | d6fdb306b123a995471584a5201155c60a34448a | https://github.com/zyga/python-glibc/blob/d6fdb306b123a995471584a5201155c60a34448a/tempfile_ext.py#L415-L443 |
51,821 | cvxopt/chompack | src/python/base.py | syr2 | def syr2(X, u, v, alpha = 1.0, beta = 1.0, reordered=False):
r"""
Computes the projected rank 2 update of a cspmatrix X
.. math::
X := \alpha*P(u v^T + v u^T) + \beta X.
"""
assert X.is_factor is False, "cspmatrix factor object"
symb = X.symb
n = symb.n
snptr = symb.snptr
s... | python | def syr2(X, u, v, alpha = 1.0, beta = 1.0, reordered=False):
r"""
Computes the projected rank 2 update of a cspmatrix X
.. math::
X := \alpha*P(u v^T + v u^T) + \beta X.
"""
assert X.is_factor is False, "cspmatrix factor object"
symb = X.symb
n = symb.n
snptr = symb.snptr
s... | [
"def",
"syr2",
"(",
"X",
",",
"u",
",",
"v",
",",
"alpha",
"=",
"1.0",
",",
"beta",
"=",
"1.0",
",",
"reordered",
"=",
"False",
")",
":",
"assert",
"X",
".",
"is_factor",
"is",
"False",
",",
"\"cspmatrix factor object\"",
"symb",
"=",
"X",
".",
"sy... | r"""
Computes the projected rank 2 update of a cspmatrix X
.. math::
X := \alpha*P(u v^T + v u^T) + \beta X. | [
"r",
"Computes",
"the",
"projected",
"rank",
"2",
"update",
"of",
"a",
"cspmatrix",
"X"
] | e07106b58b8055c34f6201e8c954482f86987833 | https://github.com/cvxopt/chompack/blob/e07106b58b8055c34f6201e8c954482f86987833/src/python/base.py#L28-L67 |
51,822 | bjodah/pyodeint | pyodeint/_util.py | _ensure_5args | def _ensure_5args(func):
""" Conditionally wrap function to ensure 5 input arguments
Parameters
----------
func: callable
with four or five positional arguments
Returns
-------
callable which possibly ignores 0 or 1 positional arguments
"""
if func is None:
return ... | python | def _ensure_5args(func):
""" Conditionally wrap function to ensure 5 input arguments
Parameters
----------
func: callable
with four or five positional arguments
Returns
-------
callable which possibly ignores 0 or 1 positional arguments
"""
if func is None:
return ... | [
"def",
"_ensure_5args",
"(",
"func",
")",
":",
"if",
"func",
"is",
"None",
":",
"return",
"None",
"self_arg",
"=",
"1",
"if",
"inspect",
".",
"ismethod",
"(",
"func",
")",
"else",
"0",
"if",
"len",
"(",
"inspect",
".",
"getargspec",
"(",
"func",
")",... | Conditionally wrap function to ensure 5 input arguments
Parameters
----------
func: callable
with four or five positional arguments
Returns
-------
callable which possibly ignores 0 or 1 positional arguments | [
"Conditionally",
"wrap",
"function",
"to",
"ensure",
"5",
"input",
"arguments"
] | 093fa7bfd3bae1a0b1666a491760e527ae6a1fc2 | https://github.com/bjodah/pyodeint/blob/093fa7bfd3bae1a0b1666a491760e527ae6a1fc2/pyodeint/_util.py#L59-L81 |
51,823 | zyga/python-glibc | glibc.py | LazyModule.shadow_normal_module | def shadow_normal_module(cls, mod_name=None):
"""
Shadow a module with an instance of LazyModule
:param mod_name:
Name of the module to shadow. By default this is the module that is
making the call into this method. This is not hard-coded as that
module might... | python | def shadow_normal_module(cls, mod_name=None):
"""
Shadow a module with an instance of LazyModule
:param mod_name:
Name of the module to shadow. By default this is the module that is
making the call into this method. This is not hard-coded as that
module might... | [
"def",
"shadow_normal_module",
"(",
"cls",
",",
"mod_name",
"=",
"None",
")",
":",
"if",
"mod_name",
"is",
"None",
":",
"frame",
"=",
"inspect",
".",
"currentframe",
"(",
")",
"try",
":",
"mod_name",
"=",
"frame",
".",
"f_back",
".",
"f_locals",
"[",
"... | Shadow a module with an instance of LazyModule
:param mod_name:
Name of the module to shadow. By default this is the module that is
making the call into this method. This is not hard-coded as that
module might be called '__main__' if it is executed via 'python -m'
:r... | [
"Shadow",
"a",
"module",
"with",
"an",
"instance",
"of",
"LazyModule"
] | d6fdb306b123a995471584a5201155c60a34448a | https://github.com/zyga/python-glibc/blob/d6fdb306b123a995471584a5201155c60a34448a/glibc.py#L135-L157 |
51,824 | zyga/python-glibc | glibc.py | LazyModule.lazily | def lazily(self, name, callable, args):
"""
Load something lazily
"""
self._lazy[name] = callable, args
self._all.add(name) | python | def lazily(self, name, callable, args):
"""
Load something lazily
"""
self._lazy[name] = callable, args
self._all.add(name) | [
"def",
"lazily",
"(",
"self",
",",
"name",
",",
"callable",
",",
"args",
")",
":",
"self",
".",
"_lazy",
"[",
"name",
"]",
"=",
"callable",
",",
"args",
"self",
".",
"_all",
".",
"add",
"(",
"name",
")"
] | Load something lazily | [
"Load",
"something",
"lazily"
] | d6fdb306b123a995471584a5201155c60a34448a | https://github.com/zyga/python-glibc/blob/d6fdb306b123a995471584a5201155c60a34448a/glibc.py#L159-L164 |
51,825 | zyga/python-glibc | glibc.py | LazyModule.immediate | def immediate(self, name, value):
"""
Load something immediately
"""
setattr(self, name, value)
self._all.add(name) | python | def immediate(self, name, value):
"""
Load something immediately
"""
setattr(self, name, value)
self._all.add(name) | [
"def",
"immediate",
"(",
"self",
",",
"name",
",",
"value",
")",
":",
"setattr",
"(",
"self",
",",
"name",
",",
"value",
")",
"self",
".",
"_all",
".",
"add",
"(",
"name",
")"
] | Load something immediately | [
"Load",
"something",
"immediately"
] | d6fdb306b123a995471584a5201155c60a34448a | https://github.com/zyga/python-glibc/blob/d6fdb306b123a995471584a5201155c60a34448a/glibc.py#L166-L171 |
51,826 | idmillington/layout | layout/datatypes/parse_dimensions.py | parse_dimension | def parse_dimension(text):
"""
Parses the given text into one dimension and returns its
equivalent size in points.
The numbers provided can be integer or decimal, but exponents are
not supported.
The units may be inches (", in, ins, inch, inchs, inches),
millimeters (mm), points (pt, pts, ... | python | def parse_dimension(text):
"""
Parses the given text into one dimension and returns its
equivalent size in points.
The numbers provided can be integer or decimal, but exponents are
not supported.
The units may be inches (", in, ins, inch, inchs, inches),
millimeters (mm), points (pt, pts, ... | [
"def",
"parse_dimension",
"(",
"text",
")",
":",
"size",
",",
"unit",
"=",
"_split_dimension",
"(",
"text",
")",
"factor",
"=",
"_unit_lookup",
"[",
"unit",
"]",
"return",
"size",
"*",
"factor"
] | Parses the given text into one dimension and returns its
equivalent size in points.
The numbers provided can be integer or decimal, but exponents are
not supported.
The units may be inches (", in, ins, inch, inchs, inches),
millimeters (mm), points (pt, pts, point, points, or nothing), or
cent... | [
"Parses",
"the",
"given",
"text",
"into",
"one",
"dimension",
"and",
"returns",
"its",
"equivalent",
"size",
"in",
"points",
"."
] | c452d1d7a74c9a74f7639c1b49e2a41c4e354bb5 | https://github.com/idmillington/layout/blob/c452d1d7a74c9a74f7639c1b49e2a41c4e354bb5/layout/datatypes/parse_dimensions.py#L11-L27 |
51,827 | idmillington/layout | layout/datatypes/parse_dimensions.py | parse_dimensions | def parse_dimensions(text):
"""
Parses a set of dimensions into tuple of values representing the
sizes in points.
The dimensions that this method supports are exactly as for
parse_dimension. It supports multiple dimensions, separated by
whitespace, comma, semicolon, hyphen, or the letter x. The... | python | def parse_dimensions(text):
"""
Parses a set of dimensions into tuple of values representing the
sizes in points.
The dimensions that this method supports are exactly as for
parse_dimension. It supports multiple dimensions, separated by
whitespace, comma, semicolon, hyphen, or the letter x. The... | [
"def",
"parse_dimensions",
"(",
"text",
")",
":",
"components",
"=",
"_dimension_separator",
".",
"split",
"(",
"text",
")",
"if",
"len",
"(",
"components",
")",
"==",
"0",
":",
"raise",
"DimensionError",
"(",
"\"No dimensions found in string.\"",
")",
"# Split ... | Parses a set of dimensions into tuple of values representing the
sizes in points.
The dimensions that this method supports are exactly as for
parse_dimension. It supports multiple dimensions, separated by
whitespace, comma, semicolon, hyphen, or the letter x. The units
may follow each dimension (in... | [
"Parses",
"a",
"set",
"of",
"dimensions",
"into",
"tuple",
"of",
"values",
"representing",
"the",
"sizes",
"in",
"points",
"."
] | c452d1d7a74c9a74f7639c1b49e2a41c4e354bb5 | https://github.com/idmillington/layout/blob/c452d1d7a74c9a74f7639c1b49e2a41c4e354bb5/layout/datatypes/parse_dimensions.py#L29-L69 |
51,828 | idmillington/layout | layout/datatypes/parse_dimensions.py | _split_dimension | def _split_dimension(text):
"""
Returns the number and unit from the given piece of text as a pair.
>>> _split_dimension('1pt')
(1, 'pt')
>>> _split_dimension('1 pt')
(1, 'pt')
>>> _split_dimension('1 \tpt')
(1, 'pt')
>>> _split_dimension('1 \tpt ')
(1, 'pt')
>>> _split_d... | python | def _split_dimension(text):
"""
Returns the number and unit from the given piece of text as a pair.
>>> _split_dimension('1pt')
(1, 'pt')
>>> _split_dimension('1 pt')
(1, 'pt')
>>> _split_dimension('1 \tpt')
(1, 'pt')
>>> _split_dimension('1 \tpt ')
(1, 'pt')
>>> _split_d... | [
"def",
"_split_dimension",
"(",
"text",
")",
":",
"match",
"=",
"_dimension_finder",
".",
"match",
"(",
"text",
")",
"if",
"not",
"match",
":",
"raise",
"DimensionError",
"(",
"\"Can't parse dimension '%s'.\"",
"%",
"text",
")",
"number",
"=",
"match",
".",
... | Returns the number and unit from the given piece of text as a pair.
>>> _split_dimension('1pt')
(1, 'pt')
>>> _split_dimension('1 pt')
(1, 'pt')
>>> _split_dimension('1 \tpt')
(1, 'pt')
>>> _split_dimension('1 \tpt ')
(1, 'pt')
>>> _split_dimension(' 1 \tpt ')
(1, 'pt')
... | [
"Returns",
"the",
"number",
"and",
"unit",
"from",
"the",
"given",
"piece",
"of",
"text",
"as",
"a",
"pair",
"."
] | c452d1d7a74c9a74f7639c1b49e2a41c4e354bb5 | https://github.com/idmillington/layout/blob/c452d1d7a74c9a74f7639c1b49e2a41c4e354bb5/layout/datatypes/parse_dimensions.py#L87-L116 |
51,829 | dschreij/python-mediadecoder | mediadecoder/soundrenderers/_base.py | SoundRenderer.queue | def queue(self, value):
""" Sets the audioqueue.
Parameters
----------
value : queue.Queue
The buffer from which audioframes are received.
"""
if not isinstance(value, Queue):
raise TypeError("queue is not a Queue object")
self._queue = value | python | def queue(self, value):
""" Sets the audioqueue.
Parameters
----------
value : queue.Queue
The buffer from which audioframes are received.
"""
if not isinstance(value, Queue):
raise TypeError("queue is not a Queue object")
self._queue = value | [
"def",
"queue",
"(",
"self",
",",
"value",
")",
":",
"if",
"not",
"isinstance",
"(",
"value",
",",
"Queue",
")",
":",
"raise",
"TypeError",
"(",
"\"queue is not a Queue object\"",
")",
"self",
".",
"_queue",
"=",
"value"
] | Sets the audioqueue.
Parameters
----------
value : queue.Queue
The buffer from which audioframes are received. | [
"Sets",
"the",
"audioqueue",
"."
] | f01b02d790f2abc52d9792e43076cf4cb7d3ce51 | https://github.com/dschreij/python-mediadecoder/blob/f01b02d790f2abc52d9792e43076cf4cb7d3ce51/mediadecoder/soundrenderers/_base.py#L22-L32 |
51,830 | idmillington/layout | layout/managers/align.py | AlignLM.get_minimum_size | def get_minimum_size(self, data):
"""Returns the minimum size of the managed element, as long as
it is larger than any manually set minima."""
size = self.element.get_minimum_size(data)
return datatypes.Point(
max(size.x, self.min_width),
max(size.y, self.min_heig... | python | def get_minimum_size(self, data):
"""Returns the minimum size of the managed element, as long as
it is larger than any manually set minima."""
size = self.element.get_minimum_size(data)
return datatypes.Point(
max(size.x, self.min_width),
max(size.y, self.min_heig... | [
"def",
"get_minimum_size",
"(",
"self",
",",
"data",
")",
":",
"size",
"=",
"self",
".",
"element",
".",
"get_minimum_size",
"(",
"data",
")",
"return",
"datatypes",
".",
"Point",
"(",
"max",
"(",
"size",
".",
"x",
",",
"self",
".",
"min_width",
")",
... | Returns the minimum size of the managed element, as long as
it is larger than any manually set minima. | [
"Returns",
"the",
"minimum",
"size",
"of",
"the",
"managed",
"element",
"as",
"long",
"as",
"it",
"is",
"larger",
"than",
"any",
"manually",
"set",
"minima",
"."
] | c452d1d7a74c9a74f7639c1b49e2a41c4e354bb5 | https://github.com/idmillington/layout/blob/c452d1d7a74c9a74f7639c1b49e2a41c4e354bb5/layout/managers/align.py#L67-L74 |
51,831 | idmillington/layout | layout/managers/align.py | AlignLM.render | def render(self, rect, data):
"""Draws the managed element in the correct alignment."""
# We can't use our get minimum size, because that enforces
# the size limits.
size = self.element.get_minimum_size(data)
# Assume we're bottom left at our natural size.
x = rect.x
... | python | def render(self, rect, data):
"""Draws the managed element in the correct alignment."""
# We can't use our get minimum size, because that enforces
# the size limits.
size = self.element.get_minimum_size(data)
# Assume we're bottom left at our natural size.
x = rect.x
... | [
"def",
"render",
"(",
"self",
",",
"rect",
",",
"data",
")",
":",
"# We can't use our get minimum size, because that enforces",
"# the size limits.",
"size",
"=",
"self",
".",
"element",
".",
"get_minimum_size",
"(",
"data",
")",
"# Assume we're bottom left at our natural... | Draws the managed element in the correct alignment. | [
"Draws",
"the",
"managed",
"element",
"in",
"the",
"correct",
"alignment",
"."
] | c452d1d7a74c9a74f7639c1b49e2a41c4e354bb5 | https://github.com/idmillington/layout/blob/c452d1d7a74c9a74f7639c1b49e2a41c4e354bb5/layout/managers/align.py#L76-L105 |
51,832 | kentwait/nxsim | nxsim/utils.py | create_copy_without_data | def create_copy_without_data(G):
"""Return a copy of the graph G with all the data removed"""
H = nx.Graph()
for i in H.nodes_iter():
H.node[i] = {}
return H | python | def create_copy_without_data(G):
"""Return a copy of the graph G with all the data removed"""
H = nx.Graph()
for i in H.nodes_iter():
H.node[i] = {}
return H | [
"def",
"create_copy_without_data",
"(",
"G",
")",
":",
"H",
"=",
"nx",
".",
"Graph",
"(",
")",
"for",
"i",
"in",
"H",
".",
"nodes_iter",
"(",
")",
":",
"H",
".",
"node",
"[",
"i",
"]",
"=",
"{",
"}",
"return",
"H"
] | Return a copy of the graph G with all the data removed | [
"Return",
"a",
"copy",
"of",
"the",
"graph",
"G",
"with",
"all",
"the",
"data",
"removed"
] | 88090d8099e574bc6fd1d24734cfa205ecce4c1d | https://github.com/kentwait/nxsim/blob/88090d8099e574bc6fd1d24734cfa205ecce4c1d/nxsim/utils.py#L15-L20 |
51,833 | kentwait/nxsim | nxsim/utils.py | dump | def dump(stuff, filename, verbose=True, protocol=3):
"""Store an object to file by pickling
Parameters
----------
stuff : object to be pickled
filename : path
verbose : bool
protocol : 1,2,3 (default = 3)
Protocol used by Pickler, higher number means more recent version of Python is... | python | def dump(stuff, filename, verbose=True, protocol=3):
"""Store an object to file by pickling
Parameters
----------
stuff : object to be pickled
filename : path
verbose : bool
protocol : 1,2,3 (default = 3)
Protocol used by Pickler, higher number means more recent version of Python is... | [
"def",
"dump",
"(",
"stuff",
",",
"filename",
",",
"verbose",
"=",
"True",
",",
"protocol",
"=",
"3",
")",
":",
"filename",
"=",
"os",
".",
"path",
".",
"normcase",
"(",
"filename",
")",
"dir_path",
"=",
"os",
".",
"path",
".",
"dirname",
"(",
"fil... | Store an object to file by pickling
Parameters
----------
stuff : object to be pickled
filename : path
verbose : bool
protocol : 1,2,3 (default = 3)
Protocol used by Pickler, higher number means more recent version of Python is needed to read the pickle
produced. Default is prot... | [
"Store",
"an",
"object",
"to",
"file",
"by",
"pickling"
] | 88090d8099e574bc6fd1d24734cfa205ecce4c1d | https://github.com/kentwait/nxsim/blob/88090d8099e574bc6fd1d24734cfa205ecce4c1d/nxsim/utils.py#L24-L49 |
51,834 | kentwait/nxsim | nxsim/utils.py | load | def load(filename):
"""Retrieve a pickled object
Parameter
---------
filename : path
Return
------
object
Unpickled object
"""
filename = os.path.normcase(filename)
try:
with open(filename, 'rb') as f:
u = pickle.Unpickler(f)
return u.loa... | python | def load(filename):
"""Retrieve a pickled object
Parameter
---------
filename : path
Return
------
object
Unpickled object
"""
filename = os.path.normcase(filename)
try:
with open(filename, 'rb') as f:
u = pickle.Unpickler(f)
return u.loa... | [
"def",
"load",
"(",
"filename",
")",
":",
"filename",
"=",
"os",
".",
"path",
".",
"normcase",
"(",
"filename",
")",
"try",
":",
"with",
"open",
"(",
"filename",
",",
"'rb'",
")",
"as",
"f",
":",
"u",
"=",
"pickle",
".",
"Unpickler",
"(",
"f",
")... | Retrieve a pickled object
Parameter
---------
filename : path
Return
------
object
Unpickled object | [
"Retrieve",
"a",
"pickled",
"object"
] | 88090d8099e574bc6fd1d24734cfa205ecce4c1d | https://github.com/kentwait/nxsim/blob/88090d8099e574bc6fd1d24734cfa205ecce4c1d/nxsim/utils.py#L51-L69 |
51,835 | mvantellingen/py-soap-wsse | src/soap_wsse/signing.py | sign_envelope | def sign_envelope(envelope, key_file):
"""Sign the given soap request with the given key"""
doc = etree.fromstring(envelope)
body = get_body(doc)
queue = SignQueue()
queue.push_and_mark(body)
security_node = ensure_security_header(doc, queue)
security_token_node = create_binary_security_to... | python | def sign_envelope(envelope, key_file):
"""Sign the given soap request with the given key"""
doc = etree.fromstring(envelope)
body = get_body(doc)
queue = SignQueue()
queue.push_and_mark(body)
security_node = ensure_security_header(doc, queue)
security_token_node = create_binary_security_to... | [
"def",
"sign_envelope",
"(",
"envelope",
",",
"key_file",
")",
":",
"doc",
"=",
"etree",
".",
"fromstring",
"(",
"envelope",
")",
"body",
"=",
"get_body",
"(",
"doc",
")",
"queue",
"=",
"SignQueue",
"(",
")",
"queue",
".",
"push_and_mark",
"(",
"body",
... | Sign the given soap request with the given key | [
"Sign",
"the",
"given",
"soap",
"request",
"with",
"the",
"given",
"key"
] | ae01285b9670fe98375312103c0bdf68ea2fe89d | https://github.com/mvantellingen/py-soap-wsse/blob/ae01285b9670fe98375312103c0bdf68ea2fe89d/src/soap_wsse/signing.py#L97-L122 |
51,836 | mvantellingen/py-soap-wsse | src/soap_wsse/signing.py | verify_envelope | def verify_envelope(reply, key_file):
"""Verify that the given soap request is signed with the certificate"""
doc = etree.fromstring(reply)
node = doc.find(".//{%s}Signature" % xmlsec.DSigNs)
if node is None:
raise CertificationError("No signature node found")
dsigCtx = xmlsec.DSigCtx()
... | python | def verify_envelope(reply, key_file):
"""Verify that the given soap request is signed with the certificate"""
doc = etree.fromstring(reply)
node = doc.find(".//{%s}Signature" % xmlsec.DSigNs)
if node is None:
raise CertificationError("No signature node found")
dsigCtx = xmlsec.DSigCtx()
... | [
"def",
"verify_envelope",
"(",
"reply",
",",
"key_file",
")",
":",
"doc",
"=",
"etree",
".",
"fromstring",
"(",
"reply",
")",
"node",
"=",
"doc",
".",
"find",
"(",
"\".//{%s}Signature\"",
"%",
"xmlsec",
".",
"DSigNs",
")",
"if",
"node",
"is",
"None",
"... | Verify that the given soap request is signed with the certificate | [
"Verify",
"that",
"the",
"given",
"soap",
"request",
"is",
"signed",
"with",
"the",
"certificate"
] | ae01285b9670fe98375312103c0bdf68ea2fe89d | https://github.com/mvantellingen/py-soap-wsse/blob/ae01285b9670fe98375312103c0bdf68ea2fe89d/src/soap_wsse/signing.py#L125-L142 |
51,837 | mvantellingen/py-soap-wsse | src/soap_wsse/signing.py | create_key_info_node | def create_key_info_node(security_token):
"""Create the KeyInfo node for WSSE.
Note that this currently only supports BinarySecurityTokens
Example of the generated XML:
<ds:KeyInfo Id="KI-24C56C5B3448F4BE9D141094243396829">
<wsse:SecurityTokenReference
wsse11:TokenType... | python | def create_key_info_node(security_token):
"""Create the KeyInfo node for WSSE.
Note that this currently only supports BinarySecurityTokens
Example of the generated XML:
<ds:KeyInfo Id="KI-24C56C5B3448F4BE9D141094243396829">
<wsse:SecurityTokenReference
wsse11:TokenType... | [
"def",
"create_key_info_node",
"(",
"security_token",
")",
":",
"key_info",
"=",
"etree",
".",
"Element",
"(",
"ns_id",
"(",
"'KeyInfo'",
",",
"ns",
".",
"dsns",
")",
")",
"sec_token_ref",
"=",
"etree",
".",
"SubElement",
"(",
"key_info",
",",
"ns_id",
"("... | Create the KeyInfo node for WSSE.
Note that this currently only supports BinarySecurityTokens
Example of the generated XML:
<ds:KeyInfo Id="KI-24C56C5B3448F4BE9D141094243396829">
<wsse:SecurityTokenReference
wsse11:TokenType="{{ BINARY_TOKEN_TYPE }}">
<wsse... | [
"Create",
"the",
"KeyInfo",
"node",
"for",
"WSSE",
"."
] | ae01285b9670fe98375312103c0bdf68ea2fe89d | https://github.com/mvantellingen/py-soap-wsse/blob/ae01285b9670fe98375312103c0bdf68ea2fe89d/src/soap_wsse/signing.py#L158-L185 |
51,838 | mvantellingen/py-soap-wsse | src/soap_wsse/signing.py | create_binary_security_token | def create_binary_security_token(key_file):
"""Create the BinarySecurityToken node containing the x509 certificate.
"""
node = etree.Element(
ns_id('BinarySecurityToken', ns.wssens),
nsmap={ns.wssens[0]: ns.wssens[1]})
node.set(ns_id('Id', ns.wsuns), get_unique_id())
node.set('Encod... | python | def create_binary_security_token(key_file):
"""Create the BinarySecurityToken node containing the x509 certificate.
"""
node = etree.Element(
ns_id('BinarySecurityToken', ns.wssens),
nsmap={ns.wssens[0]: ns.wssens[1]})
node.set(ns_id('Id', ns.wsuns), get_unique_id())
node.set('Encod... | [
"def",
"create_binary_security_token",
"(",
"key_file",
")",
":",
"node",
"=",
"etree",
".",
"Element",
"(",
"ns_id",
"(",
"'BinarySecurityToken'",
",",
"ns",
".",
"wssens",
")",
",",
"nsmap",
"=",
"{",
"ns",
".",
"wssens",
"[",
"0",
"]",
":",
"ns",
".... | Create the BinarySecurityToken node containing the x509 certificate. | [
"Create",
"the",
"BinarySecurityToken",
"node",
"containing",
"the",
"x509",
"certificate",
"."
] | ae01285b9670fe98375312103c0bdf68ea2fe89d | https://github.com/mvantellingen/py-soap-wsse/blob/ae01285b9670fe98375312103c0bdf68ea2fe89d/src/soap_wsse/signing.py#L188-L203 |
51,839 | mvantellingen/py-soap-wsse | src/soap_wsse/signing.py | ensure_security_header | def ensure_security_header(envelope, queue):
"""Insert a security XML node if it doesn't exist otherwise update it.
"""
(header,) = HEADER_XPATH(envelope)
security = SECURITY_XPATH(header)
if security:
for timestamp in TIMESTAMP_XPATH(security[0]):
queue.push_and_mark(timestamp)... | python | def ensure_security_header(envelope, queue):
"""Insert a security XML node if it doesn't exist otherwise update it.
"""
(header,) = HEADER_XPATH(envelope)
security = SECURITY_XPATH(header)
if security:
for timestamp in TIMESTAMP_XPATH(security[0]):
queue.push_and_mark(timestamp)... | [
"def",
"ensure_security_header",
"(",
"envelope",
",",
"queue",
")",
":",
"(",
"header",
",",
")",
"=",
"HEADER_XPATH",
"(",
"envelope",
")",
"security",
"=",
"SECURITY_XPATH",
"(",
"header",
")",
"if",
"security",
":",
"for",
"timestamp",
"in",
"TIMESTAMP_X... | Insert a security XML node if it doesn't exist otherwise update it. | [
"Insert",
"a",
"security",
"XML",
"node",
"if",
"it",
"doesn",
"t",
"exist",
"otherwise",
"update",
"it",
"."
] | ae01285b9670fe98375312103c0bdf68ea2fe89d | https://github.com/mvantellingen/py-soap-wsse/blob/ae01285b9670fe98375312103c0bdf68ea2fe89d/src/soap_wsse/signing.py#L206-L221 |
51,840 | rjdkmr/do_x3dna | dnaMD/dnaMD/dnaMD.py | checkParametersInputFile | def checkParametersInputFile(filename):
"""Check the do_x3dna output file and return list of parameters present in the file.
"""
fin = open(filename, 'r')
line = fin.readline()
line2 = fin.readline()
fin.close()
temp = re.split('\s+', line)
temp2 = re.split('\s+', line2)
if temp[0]... | python | def checkParametersInputFile(filename):
"""Check the do_x3dna output file and return list of parameters present in the file.
"""
fin = open(filename, 'r')
line = fin.readline()
line2 = fin.readline()
fin.close()
temp = re.split('\s+', line)
temp2 = re.split('\s+', line2)
if temp[0]... | [
"def",
"checkParametersInputFile",
"(",
"filename",
")",
":",
"fin",
"=",
"open",
"(",
"filename",
",",
"'r'",
")",
"line",
"=",
"fin",
".",
"readline",
"(",
")",
"line2",
"=",
"fin",
".",
"readline",
"(",
")",
"fin",
".",
"close",
"(",
")",
"temp",
... | Check the do_x3dna output file and return list of parameters present in the file. | [
"Check",
"the",
"do_x3dna",
"output",
"file",
"and",
"return",
"list",
"of",
"parameters",
"present",
"in",
"the",
"file",
"."
] | fe910335eefcada76737f9e7cd6f25036cd32ab6 | https://github.com/rjdkmr/do_x3dna/blob/fe910335eefcada76737f9e7cd6f25036cd32ab6/dnaMD/dnaMD/dnaMD.py#L1795-L1825 |
51,841 | rjdkmr/do_x3dna | dnaMD/dnaMD/dnaMD.py | setParametersFromFile | def setParametersFromFile(dna, filename, parameters=None, bp=None):
"""Read a specific parameter from the do_x3dna output file.
It automatically load the input parameter from a file to dna object or HDF5 file.
It automatically decides from input parameter, what will be format of input file.
Parameters
... | python | def setParametersFromFile(dna, filename, parameters=None, bp=None):
"""Read a specific parameter from the do_x3dna output file.
It automatically load the input parameter from a file to dna object or HDF5 file.
It automatically decides from input parameter, what will be format of input file.
Parameters
... | [
"def",
"setParametersFromFile",
"(",
"dna",
",",
"filename",
",",
"parameters",
"=",
"None",
",",
"bp",
"=",
"None",
")",
":",
"gotParameterList",
"=",
"False",
"param_type",
"=",
"None",
"# In case of none try to determine from file",
"if",
"parameters",
"is",
"N... | Read a specific parameter from the do_x3dna output file.
It automatically load the input parameter from a file to dna object or HDF5 file.
It automatically decides from input parameter, what will be format of input file.
Parameters
----------
dna : :class:`DNA`
Input :class:`DNA` instance.
... | [
"Read",
"a",
"specific",
"parameter",
"from",
"the",
"do_x3dna",
"output",
"file",
".",
"It",
"automatically",
"load",
"the",
"input",
"parameter",
"from",
"a",
"file",
"to",
"dna",
"object",
"or",
"HDF5",
"file",
".",
"It",
"automatically",
"decides",
"from... | fe910335eefcada76737f9e7cd6f25036cd32ab6 | https://github.com/rjdkmr/do_x3dna/blob/fe910335eefcada76737f9e7cd6f25036cd32ab6/dnaMD/dnaMD/dnaMD.py#L1828-L1923 |
51,842 | rjdkmr/do_x3dna | dnaMD/dnaMD/dnaMD.py | frenet_serret | def frenet_serret(xyz):
''' Frenet-Serret Space Curve Invariants
Taken from "Diffusion Imaging in Python" `DiPy package<http://nipy.org/dipy/>`_
Calculates the 3 vector and 2 scalar invariants of a space curve defined by vectors r = (x,y,z). If z is omitted (i.e. the array xyz has shape (N,2), then the c... | python | def frenet_serret(xyz):
''' Frenet-Serret Space Curve Invariants
Taken from "Diffusion Imaging in Python" `DiPy package<http://nipy.org/dipy/>`_
Calculates the 3 vector and 2 scalar invariants of a space curve defined by vectors r = (x,y,z). If z is omitted (i.e. the array xyz has shape (N,2), then the c... | [
"def",
"frenet_serret",
"(",
"xyz",
")",
":",
"def",
"magn",
"(",
"xyz",
",",
"n",
"=",
"1",
")",
":",
"''' magnitude of vector\n\n\n '''",
"mag",
"=",
"np",
".",
"sum",
"(",
"xyz",
"**",
"2",
",",
"axis",
"=",
"1",
")",
"**",
"0.5",
"imag",
... | Frenet-Serret Space Curve Invariants
Taken from "Diffusion Imaging in Python" `DiPy package<http://nipy.org/dipy/>`_
Calculates the 3 vector and 2 scalar invariants of a space curve defined by vectors r = (x,y,z). If z is omitted (i.e. the array xyz has shape (N,2), then the curve is only 2D (planar), but th... | [
"Frenet",
"-",
"Serret",
"Space",
"Curve",
"Invariants"
] | fe910335eefcada76737f9e7cd6f25036cd32ab6 | https://github.com/rjdkmr/do_x3dna/blob/fe910335eefcada76737f9e7cd6f25036cd32ab6/dnaMD/dnaMD/dnaMD.py#L2273-L2370 |
51,843 | rjdkmr/do_x3dna | dnaMD/dnaMD/dnaMD.py | read_param_file | def read_param_file(FileName, parameters, bp, bp_range, word=False, startBP=1):
""" Read parameters from do_x3dna file.
It is the main function, which is used to read and extract the parameters
values from the do_x3dna output files.
Parameters
----------
FileName : str
Parameter file p... | python | def read_param_file(FileName, parameters, bp, bp_range, word=False, startBP=1):
""" Read parameters from do_x3dna file.
It is the main function, which is used to read and extract the parameters
values from the do_x3dna output files.
Parameters
----------
FileName : str
Parameter file p... | [
"def",
"read_param_file",
"(",
"FileName",
",",
"parameters",
",",
"bp",
",",
"bp_range",
",",
"word",
"=",
"False",
",",
"startBP",
"=",
"1",
")",
":",
"sys",
".",
"stdout",
".",
"write",
"(",
"\"\\nReading file : %s\\n\"",
"%",
"FileName",
")",
"sys",
... | Read parameters from do_x3dna file.
It is the main function, which is used to read and extract the parameters
values from the do_x3dna output files.
Parameters
----------
FileName : str
Parameter file produced from do_x3dna.
parameters : list
List of column indices that has to ... | [
"Read",
"parameters",
"from",
"do_x3dna",
"file",
"."
] | fe910335eefcada76737f9e7cd6f25036cd32ab6 | https://github.com/rjdkmr/do_x3dna/blob/fe910335eefcada76737f9e7cd6f25036cd32ab6/dnaMD/dnaMD/dnaMD.py#L2411-L2525 |
51,844 | rjdkmr/do_x3dna | dnaMD/dnaMD/dnaMD.py | DNA._set_time | def _set_time(self, time):
""" Set time in both class and hdf5 file
"""
if len(self.time) == 0 :
self.time = np.array(time)
if self.h5 is not None:
self.h5.create_dataset('time', self.time.shape, dtype=self.time.dtype, data=self.time, compression="gzip", s... | python | def _set_time(self, time):
""" Set time in both class and hdf5 file
"""
if len(self.time) == 0 :
self.time = np.array(time)
if self.h5 is not None:
self.h5.create_dataset('time', self.time.shape, dtype=self.time.dtype, data=self.time, compression="gzip", s... | [
"def",
"_set_time",
"(",
"self",
",",
"time",
")",
":",
"if",
"len",
"(",
"self",
".",
"time",
")",
"==",
"0",
":",
"self",
".",
"time",
"=",
"np",
".",
"array",
"(",
"time",
")",
"if",
"self",
".",
"h5",
"is",
"not",
"None",
":",
"self",
"."... | Set time in both class and hdf5 file | [
"Set",
"time",
"in",
"both",
"class",
"and",
"hdf5",
"file"
] | fe910335eefcada76737f9e7cd6f25036cd32ab6 | https://github.com/rjdkmr/do_x3dna/blob/fe910335eefcada76737f9e7cd6f25036cd32ab6/dnaMD/dnaMD/dnaMD.py#L238-L247 |
51,845 | rjdkmr/do_x3dna | dnaMD/dnaMD/dnaMD.py | DNA._set_mask | def _set_mask(self, mask):
""" Set mask array in both class and hdf5 file
"""
self.mask = mask.copy()
if self.h5 is not None:
if 'mask' in self.h5:
self.h5.pop('mask')
self.h5.create_dataset('mask', mask.shape, dtype=self.mask.dtype, data=mask, com... | python | def _set_mask(self, mask):
""" Set mask array in both class and hdf5 file
"""
self.mask = mask.copy()
if self.h5 is not None:
if 'mask' in self.h5:
self.h5.pop('mask')
self.h5.create_dataset('mask', mask.shape, dtype=self.mask.dtype, data=mask, com... | [
"def",
"_set_mask",
"(",
"self",
",",
"mask",
")",
":",
"self",
".",
"mask",
"=",
"mask",
".",
"copy",
"(",
")",
"if",
"self",
".",
"h5",
"is",
"not",
"None",
":",
"if",
"'mask'",
"in",
"self",
".",
"h5",
":",
"self",
".",
"h5",
".",
"pop",
"... | Set mask array in both class and hdf5 file | [
"Set",
"mask",
"array",
"in",
"both",
"class",
"and",
"hdf5",
"file"
] | fe910335eefcada76737f9e7cd6f25036cd32ab6 | https://github.com/rjdkmr/do_x3dna/blob/fe910335eefcada76737f9e7cd6f25036cd32ab6/dnaMD/dnaMD/dnaMD.py#L249-L256 |
51,846 | rjdkmr/do_x3dna | dnaMD/dnaMD/dnaMD.py | DNA.set_helical_axis | def set_helical_axis(self, filename, step_range=False, step=None):
"""
To read and set local helical-axis positions from an input file.
Parameters
----------
filename : str
Input file, which is generated from do_x3dna. e.g. HelAxis_g.dat
step_range : bool
... | python | def set_helical_axis(self, filename, step_range=False, step=None):
"""
To read and set local helical-axis positions from an input file.
Parameters
----------
filename : str
Input file, which is generated from do_x3dna. e.g. HelAxis_g.dat
step_range : bool
... | [
"def",
"set_helical_axis",
"(",
"self",
",",
"filename",
",",
"step_range",
"=",
"False",
",",
"step",
"=",
"None",
")",
":",
"if",
"(",
"step_range",
")",
":",
"if",
"not",
"isinstance",
"(",
"step",
",",
"list",
")",
":",
"raise",
"AssertionError",
"... | To read and set local helical-axis positions from an input file.
Parameters
----------
filename : str
Input file, which is generated from do_x3dna. e.g. HelAxis_g.dat
step_range : bool
* ``step_range = True`` : read axis coordinates of base-steps for the given ra... | [
"To",
"read",
"and",
"set",
"local",
"helical",
"-",
"axis",
"positions",
"from",
"an",
"input",
"file",
"."
] | fe910335eefcada76737f9e7cd6f25036cd32ab6 | https://github.com/rjdkmr/do_x3dna/blob/fe910335eefcada76737f9e7cd6f25036cd32ab6/dnaMD/dnaMD/dnaMD.py#L1152-L1217 |
51,847 | dschreij/python-mediadecoder | mediadecoder/decoder.py | Decoder.loop | def loop(self, value):
""" Indicates whether the playback should loop.
Parameters
----------
value : bool
True if playback should loop, False if not.
"""
if not type(value) == bool:
raise TypeError("can only be True or False")
self._loop = value | python | def loop(self, value):
""" Indicates whether the playback should loop.
Parameters
----------
value : bool
True if playback should loop, False if not.
"""
if not type(value) == bool:
raise TypeError("can only be True or False")
self._loop = value | [
"def",
"loop",
"(",
"self",
",",
"value",
")",
":",
"if",
"not",
"type",
"(",
"value",
")",
"==",
"bool",
":",
"raise",
"TypeError",
"(",
"\"can only be True or False\"",
")",
"self",
".",
"_loop",
"=",
"value"
] | Indicates whether the playback should loop.
Parameters
----------
value : bool
True if playback should loop, False if not. | [
"Indicates",
"whether",
"the",
"playback",
"should",
"loop",
"."
] | f01b02d790f2abc52d9792e43076cf4cb7d3ce51 | https://github.com/dschreij/python-mediadecoder/blob/f01b02d790f2abc52d9792e43076cf4cb7d3ce51/mediadecoder/decoder.py#L108-L119 |
51,848 | dschreij/python-mediadecoder | mediadecoder/decoder.py | Decoder.reset | def reset(self):
""" Resets the player and discards loaded data. """
self.clip = None
self.loaded_file = None
self.fps = None
self.duration = None
self.status = UNINITIALIZED
self.clock.reset()
self.loop_count = 0 | python | def reset(self):
""" Resets the player and discards loaded data. """
self.clip = None
self.loaded_file = None
self.fps = None
self.duration = None
self.status = UNINITIALIZED
self.clock.reset()
self.loop_count = 0 | [
"def",
"reset",
"(",
"self",
")",
":",
"self",
".",
"clip",
"=",
"None",
"self",
".",
"loaded_file",
"=",
"None",
"self",
".",
"fps",
"=",
"None",
"self",
".",
"duration",
"=",
"None",
"self",
".",
"status",
"=",
"UNINITIALIZED",
"self",
".",
"clock"... | Resets the player and discards loaded data. | [
"Resets",
"the",
"player",
"and",
"discards",
"loaded",
"data",
"."
] | f01b02d790f2abc52d9792e43076cf4cb7d3ce51 | https://github.com/dschreij/python-mediadecoder/blob/f01b02d790f2abc52d9792e43076cf4cb7d3ce51/mediadecoder/decoder.py#L121-L132 |
51,849 | dschreij/python-mediadecoder | mediadecoder/decoder.py | Decoder.load_media | def load_media(self, mediafile, play_audio=True):
""" Loads a media file to decode.
If an audiostream is detected, its parameters will be stored in a
dictionary in the variable `audioformat`. This contains the fields
:nbytes: the number of bytes in the stream (2 is 16-bit sound).
:nchannels: the channels ... | python | def load_media(self, mediafile, play_audio=True):
""" Loads a media file to decode.
If an audiostream is detected, its parameters will be stored in a
dictionary in the variable `audioformat`. This contains the fields
:nbytes: the number of bytes in the stream (2 is 16-bit sound).
:nchannels: the channels ... | [
"def",
"load_media",
"(",
"self",
",",
"mediafile",
",",
"play_audio",
"=",
"True",
")",
":",
"if",
"not",
"mediafile",
"is",
"None",
":",
"if",
"os",
".",
"path",
".",
"isfile",
"(",
"mediafile",
")",
":",
"self",
".",
"clip",
"=",
"VideoFileClip",
... | Loads a media file to decode.
If an audiostream is detected, its parameters will be stored in a
dictionary in the variable `audioformat`. This contains the fields
:nbytes: the number of bytes in the stream (2 is 16-bit sound).
:nchannels: the channels (2 for stereo, 1 for mono)
:fps: the frames per sec/sa... | [
"Loads",
"a",
"media",
"file",
"to",
"decode",
"."
] | f01b02d790f2abc52d9792e43076cf4cb7d3ce51 | https://github.com/dschreij/python-mediadecoder/blob/f01b02d790f2abc52d9792e43076cf4cb7d3ce51/mediadecoder/decoder.py#L134-L197 |
51,850 | dschreij/python-mediadecoder | mediadecoder/decoder.py | Decoder.set_audiorenderer | def set_audiorenderer(self, renderer):
""" Sets the SoundRenderer object. This should take care of processing
the audioframes set in audioqueue.
Parameters
----------
renderer : soundrenderers.SoundRenderer
A subclass of soundrenderers.SoundRenderer that takes care of the
audio rendering.
Raises
... | python | def set_audiorenderer(self, renderer):
""" Sets the SoundRenderer object. This should take care of processing
the audioframes set in audioqueue.
Parameters
----------
renderer : soundrenderers.SoundRenderer
A subclass of soundrenderers.SoundRenderer that takes care of the
audio rendering.
Raises
... | [
"def",
"set_audiorenderer",
"(",
"self",
",",
"renderer",
")",
":",
"if",
"not",
"hasattr",
"(",
"self",
",",
"'audioqueue'",
")",
"or",
"self",
".",
"audioqueue",
"is",
"None",
":",
"raise",
"RuntimeError",
"(",
"\"No video has been loaded, or no audiostream \"",... | Sets the SoundRenderer object. This should take care of processing
the audioframes set in audioqueue.
Parameters
----------
renderer : soundrenderers.SoundRenderer
A subclass of soundrenderers.SoundRenderer that takes care of the
audio rendering.
Raises
------
RuntimeError
If no information ab... | [
"Sets",
"the",
"SoundRenderer",
"object",
".",
"This",
"should",
"take",
"care",
"of",
"processing",
"the",
"audioframes",
"set",
"in",
"audioqueue",
"."
] | f01b02d790f2abc52d9792e43076cf4cb7d3ce51 | https://github.com/dschreij/python-mediadecoder/blob/f01b02d790f2abc52d9792e43076cf4cb7d3ce51/mediadecoder/decoder.py#L215-L240 |
51,851 | dschreij/python-mediadecoder | mediadecoder/decoder.py | Decoder.stop | def stop(self):
""" Stops the video stream and resets the clock. """
logger.debug("Stopping playback")
# Stop the clock
self.clock.stop()
# Set plauyer status to ready
self.status = READY | python | def stop(self):
""" Stops the video stream and resets the clock. """
logger.debug("Stopping playback")
# Stop the clock
self.clock.stop()
# Set plauyer status to ready
self.status = READY | [
"def",
"stop",
"(",
"self",
")",
":",
"logger",
".",
"debug",
"(",
"\"Stopping playback\"",
")",
"# Stop the clock",
"self",
".",
"clock",
".",
"stop",
"(",
")",
"# Set plauyer status to ready",
"self",
".",
"status",
"=",
"READY"
] | Stops the video stream and resets the clock. | [
"Stops",
"the",
"video",
"stream",
"and",
"resets",
"the",
"clock",
"."
] | f01b02d790f2abc52d9792e43076cf4cb7d3ce51 | https://github.com/dschreij/python-mediadecoder/blob/f01b02d790f2abc52d9792e43076cf4cb7d3ce51/mediadecoder/decoder.py#L305-L312 |
51,852 | dschreij/python-mediadecoder | mediadecoder/decoder.py | Decoder.seek | def seek(self, value):
""" Seek to the specified time.
Parameters
----------
value : str or int
The time to seek to. Can be any of the following formats:
>>> 15.4 -> 15.4 # seconds
>>> (1,21.5) -> 81.5 # (min,sec)
>>> (1,1,2) -> 3662 # (hr, min, sec)
>>> '01:01:33.5' -> 3693.5 #(hr... | python | def seek(self, value):
""" Seek to the specified time.
Parameters
----------
value : str or int
The time to seek to. Can be any of the following formats:
>>> 15.4 -> 15.4 # seconds
>>> (1,21.5) -> 81.5 # (min,sec)
>>> (1,1,2) -> 3662 # (hr, min, sec)
>>> '01:01:33.5' -> 3693.5 #(hr... | [
"def",
"seek",
"(",
"self",
",",
"value",
")",
":",
"# Pause the stream",
"self",
".",
"pause",
"(",
")",
"# Make sure the movie starts at 1s as 0s gives trouble.",
"self",
".",
"clock",
".",
"time",
"=",
"max",
"(",
"0.5",
",",
"value",
")",
"logger",
".",
... | Seek to the specified time.
Parameters
----------
value : str or int
The time to seek to. Can be any of the following formats:
>>> 15.4 -> 15.4 # seconds
>>> (1,21.5) -> 81.5 # (min,sec)
>>> (1,1,2) -> 3662 # (hr, min, sec)
>>> '01:01:33.5' -> 3693.5 #(hr,min,sec)
>>> '01:01:33... | [
"Seek",
"to",
"the",
"specified",
"time",
"."
] | f01b02d790f2abc52d9792e43076cf4cb7d3ce51 | https://github.com/dschreij/python-mediadecoder/blob/f01b02d790f2abc52d9792e43076cf4cb7d3ce51/mediadecoder/decoder.py#L314-L338 |
51,853 | dschreij/python-mediadecoder | mediadecoder/decoder.py | Decoder.__calculate_audio_frames | def __calculate_audio_frames(self):
""" Aligns audio with video.
This should be called for instance after a seeking operation or resuming
from a pause. """
if self.audioformat is None:
return
start_frame = self.clock.current_frame
totalsize = int(self.clip.audio.fps*self.clip.audio.duration)
self.au... | python | def __calculate_audio_frames(self):
""" Aligns audio with video.
This should be called for instance after a seeking operation or resuming
from a pause. """
if self.audioformat is None:
return
start_frame = self.clock.current_frame
totalsize = int(self.clip.audio.fps*self.clip.audio.duration)
self.au... | [
"def",
"__calculate_audio_frames",
"(",
"self",
")",
":",
"if",
"self",
".",
"audioformat",
"is",
"None",
":",
"return",
"start_frame",
"=",
"self",
".",
"clock",
".",
"current_frame",
"totalsize",
"=",
"int",
"(",
"self",
".",
"clip",
".",
"audio",
".",
... | Aligns audio with video.
This should be called for instance after a seeking operation or resuming
from a pause. | [
"Aligns",
"audio",
"with",
"video",
".",
"This",
"should",
"be",
"called",
"for",
"instance",
"after",
"a",
"seeking",
"operation",
"or",
"resuming",
"from",
"a",
"pause",
"."
] | f01b02d790f2abc52d9792e43076cf4cb7d3ce51 | https://github.com/dschreij/python-mediadecoder/blob/f01b02d790f2abc52d9792e43076cf4cb7d3ce51/mediadecoder/decoder.py#L345-L357 |
51,854 | dschreij/python-mediadecoder | mediadecoder/decoder.py | Decoder.__render | def __render(self):
""" Main render loop.
Checks clock if new video and audio frames need to be rendered.
If so, it passes the frames to functions that take care
of rendering these frames. """
# Render first frame
self.__render_videoframe()
# Start videoclock with start of this thread
self.clock.s... | python | def __render(self):
""" Main render loop.
Checks clock if new video and audio frames need to be rendered.
If so, it passes the frames to functions that take care
of rendering these frames. """
# Render first frame
self.__render_videoframe()
# Start videoclock with start of this thread
self.clock.s... | [
"def",
"__render",
"(",
"self",
")",
":",
"# Render first frame",
"self",
".",
"__render_videoframe",
"(",
")",
"# Start videoclock with start of this thread",
"self",
".",
"clock",
".",
"start",
"(",
")",
"logger",
".",
"debug",
"(",
"\"Started rendering loop.\"",
... | Main render loop.
Checks clock if new video and audio frames need to be rendered.
If so, it passes the frames to functions that take care
of rendering these frames. | [
"Main",
"render",
"loop",
"."
] | f01b02d790f2abc52d9792e43076cf4cb7d3ce51 | https://github.com/dschreij/python-mediadecoder/blob/f01b02d790f2abc52d9792e43076cf4cb7d3ce51/mediadecoder/decoder.py#L359-L402 |
51,855 | dschreij/python-mediadecoder | mediadecoder/decoder.py | Decoder.__render_videoframe | def __render_videoframe(self):
""" Retrieves a new videoframe from the stream.
Sets the frame as the __current_video_frame and passes it on to
__videorenderfunc() if it is set. """
new_videoframe = self.clip.get_frame(self.clock.time)
# Pass it to the callback function if this is set
if callable(self.__vi... | python | def __render_videoframe(self):
""" Retrieves a new videoframe from the stream.
Sets the frame as the __current_video_frame and passes it on to
__videorenderfunc() if it is set. """
new_videoframe = self.clip.get_frame(self.clock.time)
# Pass it to the callback function if this is set
if callable(self.__vi... | [
"def",
"__render_videoframe",
"(",
"self",
")",
":",
"new_videoframe",
"=",
"self",
".",
"clip",
".",
"get_frame",
"(",
"self",
".",
"clock",
".",
"time",
")",
"# Pass it to the callback function if this is set",
"if",
"callable",
"(",
"self",
".",
"__videorenderf... | Retrieves a new videoframe from the stream.
Sets the frame as the __current_video_frame and passes it on to
__videorenderfunc() if it is set. | [
"Retrieves",
"a",
"new",
"videoframe",
"from",
"the",
"stream",
"."
] | f01b02d790f2abc52d9792e43076cf4cb7d3ce51 | https://github.com/dschreij/python-mediadecoder/blob/f01b02d790f2abc52d9792e43076cf4cb7d3ce51/mediadecoder/decoder.py#L404-L415 |
51,856 | dschreij/python-mediadecoder | mediadecoder/decoder.py | Decoder.__audiorender_thread | def __audiorender_thread(self):
""" Thread that takes care of the audio rendering. Do not call directly,
but only as the target of a thread. """
new_audioframe = None
logger.debug("Started audio rendering thread.")
while self.status in [PLAYING,PAUSED]:
# Retrieve audiochunk
if self.status == PLAYING:
... | python | def __audiorender_thread(self):
""" Thread that takes care of the audio rendering. Do not call directly,
but only as the target of a thread. """
new_audioframe = None
logger.debug("Started audio rendering thread.")
while self.status in [PLAYING,PAUSED]:
# Retrieve audiochunk
if self.status == PLAYING:
... | [
"def",
"__audiorender_thread",
"(",
"self",
")",
":",
"new_audioframe",
"=",
"None",
"logger",
".",
"debug",
"(",
"\"Started audio rendering thread.\"",
")",
"while",
"self",
".",
"status",
"in",
"[",
"PLAYING",
",",
"PAUSED",
"]",
":",
"# Retrieve audiochunk",
... | Thread that takes care of the audio rendering. Do not call directly,
but only as the target of a thread. | [
"Thread",
"that",
"takes",
"care",
"of",
"the",
"audio",
"rendering",
".",
"Do",
"not",
"call",
"directly",
"but",
"only",
"as",
"the",
"target",
"of",
"a",
"thread",
"."
] | f01b02d790f2abc52d9792e43076cf4cb7d3ce51 | https://github.com/dschreij/python-mediadecoder/blob/f01b02d790f2abc52d9792e43076cf4cb7d3ce51/mediadecoder/decoder.py#L417-L464 |
51,857 | bububa/pyTOP | pyTOP/crawler.py | Crawler.search | def search(self, keyword):
'''Get search results for a specific keyword'''
if type(keyword) != unicode: q = keyword.decode('utf-8')
req = self.fetch(self.search_url, {'q':q.encode('gbk')})
if not req: return None
html = req.content.decode('gbk').encode('utf-8')
soup = Bea... | python | def search(self, keyword):
'''Get search results for a specific keyword'''
if type(keyword) != unicode: q = keyword.decode('utf-8')
req = self.fetch(self.search_url, {'q':q.encode('gbk')})
if not req: return None
html = req.content.decode('gbk').encode('utf-8')
soup = Bea... | [
"def",
"search",
"(",
"self",
",",
"keyword",
")",
":",
"if",
"type",
"(",
"keyword",
")",
"!=",
"unicode",
":",
"q",
"=",
"keyword",
".",
"decode",
"(",
"'utf-8'",
")",
"req",
"=",
"self",
".",
"fetch",
"(",
"self",
".",
"search_url",
",",
"{",
... | Get search results for a specific keyword | [
"Get",
"search",
"results",
"for",
"a",
"specific",
"keyword"
] | 1e48009bcfe886be392628244b370e6374e1f2b2 | https://github.com/bububa/pyTOP/blob/1e48009bcfe886be392628244b370e6374e1f2b2/pyTOP/crawler.py#L133-L146 |
51,858 | bububa/pyTOP | pyTOP/crawler.py | Crawler.get_top_keywords | def get_top_keywords(self, up=True):
'''Get top keywords for all the categories'''
engine = models.postgres_engine()
session = models.create_session(engine)
#threadPool = ThreadPool(5)
for cat in session.query(models.Category):
if not cat.level: continue
s... | python | def get_top_keywords(self, up=True):
'''Get top keywords for all the categories'''
engine = models.postgres_engine()
session = models.create_session(engine)
#threadPool = ThreadPool(5)
for cat in session.query(models.Category):
if not cat.level: continue
s... | [
"def",
"get_top_keywords",
"(",
"self",
",",
"up",
"=",
"True",
")",
":",
"engine",
"=",
"models",
".",
"postgres_engine",
"(",
")",
"session",
"=",
"models",
".",
"create_session",
"(",
"engine",
")",
"#threadPool = ThreadPool(5)",
"for",
"cat",
"in",
"sess... | Get top keywords for all the categories | [
"Get",
"top",
"keywords",
"for",
"all",
"the",
"categories"
] | 1e48009bcfe886be392628244b370e6374e1f2b2 | https://github.com/bububa/pyTOP/blob/1e48009bcfe886be392628244b370e6374e1f2b2/pyTOP/crawler.py#L212-L219 |
51,859 | bububa/pyTOP | pyTOP/crawler.py | Crawler.cat_top_keywords | def cat_top_keywords(self, session, cat, up=True, offset=0, offsets=[]):
'''Get top keywords in a specific category'''
print 'CAT:%s, level:%s'%(str(cat), str(cat.level))
print 'OFFSET: %d'%offset
response = []
if not offsets or offset==0:
url = 'http://top.taobao.c... | python | def cat_top_keywords(self, session, cat, up=True, offset=0, offsets=[]):
'''Get top keywords in a specific category'''
print 'CAT:%s, level:%s'%(str(cat), str(cat.level))
print 'OFFSET: %d'%offset
response = []
if not offsets or offset==0:
url = 'http://top.taobao.c... | [
"def",
"cat_top_keywords",
"(",
"self",
",",
"session",
",",
"cat",
",",
"up",
"=",
"True",
",",
"offset",
"=",
"0",
",",
"offsets",
"=",
"[",
"]",
")",
":",
"print",
"'CAT:%s, level:%s'",
"%",
"(",
"str",
"(",
"cat",
")",
",",
"str",
"(",
"cat",
... | Get top keywords in a specific category | [
"Get",
"top",
"keywords",
"in",
"a",
"specific",
"category"
] | 1e48009bcfe886be392628244b370e6374e1f2b2 | https://github.com/bububa/pyTOP/blob/1e48009bcfe886be392628244b370e6374e1f2b2/pyTOP/crawler.py#L233-L282 |
51,860 | bububa/pyTOP | pyTOP/crawler.py | Crawler.get_cats | def get_cats(self):
'''Get top keywords categories'''
start_url = 'http://top.taobao.com/index.php?from=tbsy'
rs = self.fetch(start_url)
if not rs: return None
soup = BeautifulSoup(rs.content, convertEntities=BeautifulSoup.HTML_ENTITIES, markupMassage=hexentityMassage)
ca... | python | def get_cats(self):
'''Get top keywords categories'''
start_url = 'http://top.taobao.com/index.php?from=tbsy'
rs = self.fetch(start_url)
if not rs: return None
soup = BeautifulSoup(rs.content, convertEntities=BeautifulSoup.HTML_ENTITIES, markupMassage=hexentityMassage)
ca... | [
"def",
"get_cats",
"(",
"self",
")",
":",
"start_url",
"=",
"'http://top.taobao.com/index.php?from=tbsy'",
"rs",
"=",
"self",
".",
"fetch",
"(",
"start_url",
")",
"if",
"not",
"rs",
":",
"return",
"None",
"soup",
"=",
"BeautifulSoup",
"(",
"rs",
".",
"conten... | Get top keywords categories | [
"Get",
"top",
"keywords",
"categories"
] | 1e48009bcfe886be392628244b370e6374e1f2b2 | https://github.com/bububa/pyTOP/blob/1e48009bcfe886be392628244b370e6374e1f2b2/pyTOP/crawler.py#L308-L319 |
51,861 | idmillington/layout | layout/cairo_utils.py | render_to_cairo_context | def render_to_cairo_context(cairo_context, papersize_tuple, layout):
"""Renders the given layout manager on a page of the given context.
Assumes the given context has not yet been reversed in the y-direction
(i.e. it is still the default for Cairo, where y increases up
from the bottom of the page). Thi... | python | def render_to_cairo_context(cairo_context, papersize_tuple, layout):
"""Renders the given layout manager on a page of the given context.
Assumes the given context has not yet been reversed in the y-direction
(i.e. it is still the default for Cairo, where y increases up
from the bottom of the page). Thi... | [
"def",
"render_to_cairo_context",
"(",
"cairo_context",
",",
"papersize_tuple",
",",
"layout",
")",
":",
"try",
":",
"cairo_context",
".",
"save",
"(",
")",
"cairo_context",
".",
"translate",
"(",
"0",
",",
"papersize_tuple",
"[",
"1",
"]",
")",
"cairo_context... | Renders the given layout manager on a page of the given context.
Assumes the given context has not yet been reversed in the y-direction
(i.e. it is still the default for Cairo, where y increases up
from the bottom of the page). This method performs the reversal and
resets it before it returns. | [
"Renders",
"the",
"given",
"layout",
"manager",
"on",
"a",
"page",
"of",
"the",
"given",
"context",
"."
] | c452d1d7a74c9a74f7639c1b49e2a41c4e354bb5 | https://github.com/idmillington/layout/blob/c452d1d7a74c9a74f7639c1b49e2a41c4e354bb5/layout/cairo_utils.py#L27-L44 |
51,862 | mbr/repl | repl/repl.py | REPL.prompt | def prompt(self):
"""Returns the UTF-8 encoded prompt string."""
if self.prompt_string is not None:
return self.prompt_string
if not self.color_enabled:
return (' '.join(self.command) + '>> ').encode('utf8')
color = '34'
sub_color = '37'
prompt_... | python | def prompt(self):
"""Returns the UTF-8 encoded prompt string."""
if self.prompt_string is not None:
return self.prompt_string
if not self.color_enabled:
return (' '.join(self.command) + '>> ').encode('utf8')
color = '34'
sub_color = '37'
prompt_... | [
"def",
"prompt",
"(",
"self",
")",
":",
"if",
"self",
".",
"prompt_string",
"is",
"not",
"None",
":",
"return",
"self",
".",
"prompt_string",
"if",
"not",
"self",
".",
"color_enabled",
":",
"return",
"(",
"' '",
".",
"join",
"(",
"self",
".",
"command"... | Returns the UTF-8 encoded prompt string. | [
"Returns",
"the",
"UTF",
"-",
"8",
"encoded",
"prompt",
"string",
"."
] | e3bd9470df36b57a3c7bce0d924154a4de078dc0 | https://github.com/mbr/repl/blob/e3bd9470df36b57a3c7bce0d924154a4de078dc0/repl/repl.py#L71-L87 |
51,863 | mbr/repl | repl/repl.py | REPL.title | def title(self):
"""Returns the UTF-8 encoded title"""
return (u'[{}] {}>>'.format(
os.path.split(os.path.abspath('.'))[-1],
u' '.join(self.command))).encode('utf8') | python | def title(self):
"""Returns the UTF-8 encoded title"""
return (u'[{}] {}>>'.format(
os.path.split(os.path.abspath('.'))[-1],
u' '.join(self.command))).encode('utf8') | [
"def",
"title",
"(",
"self",
")",
":",
"return",
"(",
"u'[{}] {}>>'",
".",
"format",
"(",
"os",
".",
"path",
".",
"split",
"(",
"os",
".",
"path",
".",
"abspath",
"(",
"'.'",
")",
")",
"[",
"-",
"1",
"]",
",",
"u' '",
".",
"join",
"(",
"self",
... | Returns the UTF-8 encoded title | [
"Returns",
"the",
"UTF",
"-",
"8",
"encoded",
"title"
] | e3bd9470df36b57a3c7bce0d924154a4de078dc0 | https://github.com/mbr/repl/blob/e3bd9470df36b57a3c7bce0d924154a4de078dc0/repl/repl.py#L90-L94 |
51,864 | IntegralDefense/splunklib | splunklib/__init__.py | SplunkQueryObject.query_relative | def query_relative(self, query, event_time=None, relative_duration_before=None, relative_duration_after=None):
"""Perform the query and calculate the time range based on the relative values."""
assert event_time is None or isinstance(event_time, datetime.datetime)
assert relative_duration_before... | python | def query_relative(self, query, event_time=None, relative_duration_before=None, relative_duration_after=None):
"""Perform the query and calculate the time range based on the relative values."""
assert event_time is None or isinstance(event_time, datetime.datetime)
assert relative_duration_before... | [
"def",
"query_relative",
"(",
"self",
",",
"query",
",",
"event_time",
"=",
"None",
",",
"relative_duration_before",
"=",
"None",
",",
"relative_duration_after",
"=",
"None",
")",
":",
"assert",
"event_time",
"is",
"None",
"or",
"isinstance",
"(",
"event_time",
... | Perform the query and calculate the time range based on the relative values. | [
"Perform",
"the",
"query",
"and",
"calculate",
"the",
"time",
"range",
"based",
"on",
"the",
"relative",
"values",
"."
] | c3a02c83daad20cf24838f52b22cd2476f062eed | https://github.com/IntegralDefense/splunklib/blob/c3a02c83daad20cf24838f52b22cd2476f062eed/splunklib/__init__.py#L83-L102 |
51,865 | IntegralDefense/splunklib | splunklib/__init__.py | SplunkQueryObject.json | def json(self):
"""Returns the search results as a list of JSON objects."""
if self.search_results is None:
return None
result = []
for row in self.search_results['rows']:
obj = {}
for index in range(0, len(self.search_results['fields'])):
... | python | def json(self):
"""Returns the search results as a list of JSON objects."""
if self.search_results is None:
return None
result = []
for row in self.search_results['rows']:
obj = {}
for index in range(0, len(self.search_results['fields'])):
... | [
"def",
"json",
"(",
"self",
")",
":",
"if",
"self",
".",
"search_results",
"is",
"None",
":",
"return",
"None",
"result",
"=",
"[",
"]",
"for",
"row",
"in",
"self",
".",
"search_results",
"[",
"'rows'",
"]",
":",
"obj",
"=",
"{",
"}",
"for",
"index... | Returns the search results as a list of JSON objects. | [
"Returns",
"the",
"search",
"results",
"as",
"a",
"list",
"of",
"JSON",
"objects",
"."
] | c3a02c83daad20cf24838f52b22cd2476f062eed | https://github.com/IntegralDefense/splunklib/blob/c3a02c83daad20cf24838f52b22cd2476f062eed/splunklib/__init__.py#L336-L348 |
51,866 | idmillington/layout | layout/datatypes/output.py | OutputTarget.draw_text | def draw_text(self, text:str, x:float, y:float, *,
font_name:str, font_size:float, fill:Color) -> None:
"""Draws the given text at x,y."""
pass | python | def draw_text(self, text:str, x:float, y:float, *,
font_name:str, font_size:float, fill:Color) -> None:
"""Draws the given text at x,y."""
pass | [
"def",
"draw_text",
"(",
"self",
",",
"text",
":",
"str",
",",
"x",
":",
"float",
",",
"y",
":",
"float",
",",
"*",
",",
"font_name",
":",
"str",
",",
"font_size",
":",
"float",
",",
"fill",
":",
"Color",
")",
"->",
"None",
":",
"pass"
] | Draws the given text at x,y. | [
"Draws",
"the",
"given",
"text",
"at",
"x",
"y",
"."
] | c452d1d7a74c9a74f7639c1b49e2a41c4e354bb5 | https://github.com/idmillington/layout/blob/c452d1d7a74c9a74f7639c1b49e2a41c4e354bb5/layout/datatypes/output.py#L52-L55 |
51,867 | idmillington/layout | layout/datatypes/output.py | OutputTarget.draw_line | def draw_line(
self, x0:float, y0:float, x1:float, y1:float, *,
stroke:Color,
stroke_width:float=1,
stroke_dash:typing.Sequence=None
) -> None:
"""Draws the given line."""
pass | python | def draw_line(
self, x0:float, y0:float, x1:float, y1:float, *,
stroke:Color,
stroke_width:float=1,
stroke_dash:typing.Sequence=None
) -> None:
"""Draws the given line."""
pass | [
"def",
"draw_line",
"(",
"self",
",",
"x0",
":",
"float",
",",
"y0",
":",
"float",
",",
"x1",
":",
"float",
",",
"y1",
":",
"float",
",",
"*",
",",
"stroke",
":",
"Color",
",",
"stroke_width",
":",
"float",
"=",
"1",
",",
"stroke_dash",
":",
"typ... | Draws the given line. | [
"Draws",
"the",
"given",
"line",
"."
] | c452d1d7a74c9a74f7639c1b49e2a41c4e354bb5 | https://github.com/idmillington/layout/blob/c452d1d7a74c9a74f7639c1b49e2a41c4e354bb5/layout/datatypes/output.py#L58-L65 |
51,868 | idmillington/layout | layout/datatypes/output.py | OutputTarget.draw_rect | def draw_rect(
self, x:float, y:float, w:float, h:float, *,
stroke:Color=None,
stroke_width:float=1,
stroke_dash:typing.Sequence=None,
fill:Color=None
) -> None:
"""Draws the given rectangle."""
pass | python | def draw_rect(
self, x:float, y:float, w:float, h:float, *,
stroke:Color=None,
stroke_width:float=1,
stroke_dash:typing.Sequence=None,
fill:Color=None
) -> None:
"""Draws the given rectangle."""
pass | [
"def",
"draw_rect",
"(",
"self",
",",
"x",
":",
"float",
",",
"y",
":",
"float",
",",
"w",
":",
"float",
",",
"h",
":",
"float",
",",
"*",
",",
"stroke",
":",
"Color",
"=",
"None",
",",
"stroke_width",
":",
"float",
"=",
"1",
",",
"stroke_dash",
... | Draws the given rectangle. | [
"Draws",
"the",
"given",
"rectangle",
"."
] | c452d1d7a74c9a74f7639c1b49e2a41c4e354bb5 | https://github.com/idmillington/layout/blob/c452d1d7a74c9a74f7639c1b49e2a41c4e354bb5/layout/datatypes/output.py#L68-L76 |
51,869 | idmillington/layout | layout/datatypes/output.py | OutputTarget.draw_image | def draw_image(
self, img_filename:str, x:float, y:float, w:float, h:float
) -> None:
"""Draws the given image."""
pass | python | def draw_image(
self, img_filename:str, x:float, y:float, w:float, h:float
) -> None:
"""Draws the given image."""
pass | [
"def",
"draw_image",
"(",
"self",
",",
"img_filename",
":",
"str",
",",
"x",
":",
"float",
",",
"y",
":",
"float",
",",
"w",
":",
"float",
",",
"h",
":",
"float",
")",
"->",
"None",
":",
"pass"
] | Draws the given image. | [
"Draws",
"the",
"given",
"image",
"."
] | c452d1d7a74c9a74f7639c1b49e2a41c4e354bb5 | https://github.com/idmillington/layout/blob/c452d1d7a74c9a74f7639c1b49e2a41c4e354bb5/layout/datatypes/output.py#L79-L83 |
51,870 | idmillington/layout | layout/datatypes/output.py | OutputTarget.draw_polygon | def draw_polygon(
self,
*pts,
close_path:bool=True,
stroke:Color=None,
stroke_width:float=1,
stroke_dash:typing.Sequence=None,
fill:Color=None
) -> None:
"""Draws the given linear path."""
pass | python | def draw_polygon(
self,
*pts,
close_path:bool=True,
stroke:Color=None,
stroke_width:float=1,
stroke_dash:typing.Sequence=None,
fill:Color=None
) -> None:
"""Draws the given linear path."""
pass | [
"def",
"draw_polygon",
"(",
"self",
",",
"*",
"pts",
",",
"close_path",
":",
"bool",
"=",
"True",
",",
"stroke",
":",
"Color",
"=",
"None",
",",
"stroke_width",
":",
"float",
"=",
"1",
",",
"stroke_dash",
":",
"typing",
".",
"Sequence",
"=",
"None",
... | Draws the given linear path. | [
"Draws",
"the",
"given",
"linear",
"path",
"."
] | c452d1d7a74c9a74f7639c1b49e2a41c4e354bb5 | https://github.com/idmillington/layout/blob/c452d1d7a74c9a74f7639c1b49e2a41c4e354bb5/layout/datatypes/output.py#L86-L96 |
51,871 | idmillington/layout | layout/datatypes/output.py | OutputTarget.clip_rect | def clip_rect(self, x:float, y:float, w:float, h:float) -> None:
"""Clip further output to this rect."""
pass | python | def clip_rect(self, x:float, y:float, w:float, h:float) -> None:
"""Clip further output to this rect."""
pass | [
"def",
"clip_rect",
"(",
"self",
",",
"x",
":",
"float",
",",
"y",
":",
"float",
",",
"w",
":",
"float",
",",
"h",
":",
"float",
")",
"->",
"None",
":",
"pass"
] | Clip further output to this rect. | [
"Clip",
"further",
"output",
"to",
"this",
"rect",
"."
] | c452d1d7a74c9a74f7639c1b49e2a41c4e354bb5 | https://github.com/idmillington/layout/blob/c452d1d7a74c9a74f7639c1b49e2a41c4e354bb5/layout/datatypes/output.py#L99-L101 |
51,872 | danilobellini/dose | setup.py | parse_manifest | def parse_manifest(template_lines):
"""List of file names included by the MANIFEST.in template lines."""
manifest_files = distutils.filelist.FileList()
for line in template_lines:
if line.strip():
manifest_files.process_template_line(line)
return manifest_files.files | python | def parse_manifest(template_lines):
"""List of file names included by the MANIFEST.in template lines."""
manifest_files = distutils.filelist.FileList()
for line in template_lines:
if line.strip():
manifest_files.process_template_line(line)
return manifest_files.files | [
"def",
"parse_manifest",
"(",
"template_lines",
")",
":",
"manifest_files",
"=",
"distutils",
".",
"filelist",
".",
"FileList",
"(",
")",
"for",
"line",
"in",
"template_lines",
":",
"if",
"line",
".",
"strip",
"(",
")",
":",
"manifest_files",
".",
"process_t... | List of file names included by the MANIFEST.in template lines. | [
"List",
"of",
"file",
"names",
"included",
"by",
"the",
"MANIFEST",
".",
"in",
"template",
"lines",
"."
] | 141f48322f7812b7d32e3d5f065d4473a11102a4 | https://github.com/danilobellini/dose/blob/141f48322f7812b7d32e3d5f065d4473a11102a4/setup.py#L10-L16 |
51,873 | danilobellini/dose | dose/compat.py | _wx_two_step_creation_on_classic | def _wx_two_step_creation_on_classic(cls):
"""
Patch the wxPython Classic class to behave like a wxPython
Phoenix class on a 2-step creation process.
On wxPython Phoenix, the first step is the parameterless
``__init__``, and the second step is the ``Create`` method with
the construction paramet... | python | def _wx_two_step_creation_on_classic(cls):
"""
Patch the wxPython Classic class to behave like a wxPython
Phoenix class on a 2-step creation process.
On wxPython Phoenix, the first step is the parameterless
``__init__``, and the second step is the ``Create`` method with
the construction paramet... | [
"def",
"_wx_two_step_creation_on_classic",
"(",
"cls",
")",
":",
"cls_init",
"=",
"cls",
".",
"__init__",
"cls_create",
"=",
"cls",
".",
"Create",
"@",
"functools",
".",
"wraps",
"(",
"cls_init",
")",
"def",
"__init__",
"(",
"self",
",",
"*",
"args",
",",
... | Patch the wxPython Classic class to behave like a wxPython
Phoenix class on a 2-step creation process.
On wxPython Phoenix, the first step is the parameterless
``__init__``, and the second step is the ``Create`` method with
the construction parameters, e.g.::
class CustomFrame(wx.Frame):
... | [
"Patch",
"the",
"wxPython",
"Classic",
"class",
"to",
"behave",
"like",
"a",
"wxPython",
"Phoenix",
"class",
"on",
"a",
"2",
"-",
"step",
"creation",
"process",
"."
] | 141f48322f7812b7d32e3d5f065d4473a11102a4 | https://github.com/danilobellini/dose/blob/141f48322f7812b7d32e3d5f065d4473a11102a4/dose/compat.py#L8-L69 |
51,874 | phdata/sdc-api-tool | sdctool/api.py | start_pipeline | def start_pipeline(url, pipeline_id, auth, verify_ssl, runtime_parameters={}):
"""Start a running pipeline. The API waits for the pipeline to be fully started.
Args:
url (str): the host url in the form 'http://host:port/'.
pipeline_id (str): the ID of of the exported pip... | python | def start_pipeline(url, pipeline_id, auth, verify_ssl, runtime_parameters={}):
"""Start a running pipeline. The API waits for the pipeline to be fully started.
Args:
url (str): the host url in the form 'http://host:port/'.
pipeline_id (str): the ID of of the exported pip... | [
"def",
"start_pipeline",
"(",
"url",
",",
"pipeline_id",
",",
"auth",
",",
"verify_ssl",
",",
"runtime_parameters",
"=",
"{",
"}",
")",
":",
"start_result",
"=",
"requests",
".",
"post",
"(",
"url",
"+",
"'/'",
"+",
"pipeline_id",
"+",
"'/start'",
",",
"... | Start a running pipeline. The API waits for the pipeline to be fully started.
Args:
url (str): the host url in the form 'http://host:port/'.
pipeline_id (str): the ID of of the exported pipeline.
auth (tuple): a tuple of username, and password.
r... | [
"Start",
"a",
"running",
"pipeline",
".",
"The",
"API",
"waits",
"for",
"the",
"pipeline",
"to",
"be",
"fully",
"started",
"."
] | 8c86cfa89773ad411226264293d5b574194045de | https://github.com/phdata/sdc-api-tool/blob/8c86cfa89773ad411226264293d5b574194045de/sdctool/api.py#L29-L50 |
51,875 | phdata/sdc-api-tool | sdctool/api.py | export_pipeline | def export_pipeline(url, pipeline_id, auth, verify_ssl):
"""Export the config and rules for a pipeline.
Args:
url (str): the host url in the form 'http://host:port/'.
pipeline_id (str): the ID of of the exported pipeline.
auth (tuple): a tuple of username, and password.
... | python | def export_pipeline(url, pipeline_id, auth, verify_ssl):
"""Export the config and rules for a pipeline.
Args:
url (str): the host url in the form 'http://host:port/'.
pipeline_id (str): the ID of of the exported pipeline.
auth (tuple): a tuple of username, and password.
... | [
"def",
"export_pipeline",
"(",
"url",
",",
"pipeline_id",
",",
"auth",
",",
"verify_ssl",
")",
":",
"export_result",
"=",
"requests",
".",
"get",
"(",
"url",
"+",
"'/'",
"+",
"pipeline_id",
"+",
"'/export'",
",",
"headers",
"=",
"X_REQ_BY",
",",
"auth",
... | Export the config and rules for a pipeline.
Args:
url (str): the host url in the form 'http://host:port/'.
pipeline_id (str): the ID of of the exported pipeline.
auth (tuple): a tuple of username, and password.
verify_ssl (bool): whether to verify ssl certificates
... | [
"Export",
"the",
"config",
"and",
"rules",
"for",
"a",
"pipeline",
"."
] | 8c86cfa89773ad411226264293d5b574194045de | https://github.com/phdata/sdc-api-tool/blob/8c86cfa89773ad411226264293d5b574194045de/sdctool/api.py#L66-L83 |
51,876 | phdata/sdc-api-tool | sdctool/api.py | pipeline_status | def pipeline_status(url, pipeline_id, auth, verify_ssl):
"""Retrieve the current status for a pipeline.
Args:
url (str): the host url in the form 'http://host:port/'.
pipeline_id (str): the ID of of the exported pipeline.
auth (tuple): a tuple of username, and password... | python | def pipeline_status(url, pipeline_id, auth, verify_ssl):
"""Retrieve the current status for a pipeline.
Args:
url (str): the host url in the form 'http://host:port/'.
pipeline_id (str): the ID of of the exported pipeline.
auth (tuple): a tuple of username, and password... | [
"def",
"pipeline_status",
"(",
"url",
",",
"pipeline_id",
",",
"auth",
",",
"verify_ssl",
")",
":",
"status_result",
"=",
"requests",
".",
"get",
"(",
"url",
"+",
"'/'",
"+",
"pipeline_id",
"+",
"'/status'",
",",
"headers",
"=",
"X_REQ_BY",
",",
"auth",
... | Retrieve the current status for a pipeline.
Args:
url (str): the host url in the form 'http://host:port/'.
pipeline_id (str): the ID of of the exported pipeline.
auth (tuple): a tuple of username, and password.
verify_ssl (bool): whether to verify ssl certificate... | [
"Retrieve",
"the",
"current",
"status",
"for",
"a",
"pipeline",
"."
] | 8c86cfa89773ad411226264293d5b574194045de | https://github.com/phdata/sdc-api-tool/blob/8c86cfa89773ad411226264293d5b574194045de/sdctool/api.py#L86-L103 |
51,877 | phdata/sdc-api-tool | sdctool/api.py | preview_status | def preview_status(url, pipeline_id, previewer_id, auth, verify_ssl):
"""Retrieve the current status for a preview.
Args:
url (str): the host url in the form 'http://host:port/'.
pipeline_id (str): the ID of of the exported pipeline.
previewer_id (str): the previewer id create... | python | def preview_status(url, pipeline_id, previewer_id, auth, verify_ssl):
"""Retrieve the current status for a preview.
Args:
url (str): the host url in the form 'http://host:port/'.
pipeline_id (str): the ID of of the exported pipeline.
previewer_id (str): the previewer id create... | [
"def",
"preview_status",
"(",
"url",
",",
"pipeline_id",
",",
"previewer_id",
",",
"auth",
",",
"verify_ssl",
")",
":",
"preview_status",
"=",
"requests",
".",
"get",
"(",
"url",
"+",
"'/'",
"+",
"pipeline_id",
"+",
"'/preview/'",
"+",
"previewer_id",
"+",
... | Retrieve the current status for a preview.
Args:
url (str): the host url in the form 'http://host:port/'.
pipeline_id (str): the ID of of the exported pipeline.
previewer_id (str): the previewer id created by starting a preview or validation
auth (tuple): a tuple o... | [
"Retrieve",
"the",
"current",
"status",
"for",
"a",
"preview",
"."
] | 8c86cfa89773ad411226264293d5b574194045de | https://github.com/phdata/sdc-api-tool/blob/8c86cfa89773ad411226264293d5b574194045de/sdctool/api.py#L105-L122 |
51,878 | phdata/sdc-api-tool | sdctool/api.py | stop_pipeline | def stop_pipeline(url, pipeline_id, auth, verify_ssl):
"""Stop a running pipeline. The API waits for the pipeline to be 'STOPPED' before returning.
Args:
url (str): the host url in the form 'http://host:port/'.
pipeline_id (str): the ID of of the exported pipeline.
auth (tu... | python | def stop_pipeline(url, pipeline_id, auth, verify_ssl):
"""Stop a running pipeline. The API waits for the pipeline to be 'STOPPED' before returning.
Args:
url (str): the host url in the form 'http://host:port/'.
pipeline_id (str): the ID of of the exported pipeline.
auth (tu... | [
"def",
"stop_pipeline",
"(",
"url",
",",
"pipeline_id",
",",
"auth",
",",
"verify_ssl",
")",
":",
"stop_result",
"=",
"requests",
".",
"post",
"(",
"url",
"+",
"'/'",
"+",
"pipeline_id",
"+",
"'/stop'",
",",
"headers",
"=",
"X_REQ_BY",
",",
"auth",
"=",
... | Stop a running pipeline. The API waits for the pipeline to be 'STOPPED' before returning.
Args:
url (str): the host url in the form 'http://host:port/'.
pipeline_id (str): the ID of of the exported pipeline.
auth (tuple): a tuple of username, and password.
verify_ssl (b... | [
"Stop",
"a",
"running",
"pipeline",
".",
"The",
"API",
"waits",
"for",
"the",
"pipeline",
"to",
"be",
"STOPPED",
"before",
"returning",
"."
] | 8c86cfa89773ad411226264293d5b574194045de | https://github.com/phdata/sdc-api-tool/blob/8c86cfa89773ad411226264293d5b574194045de/sdctool/api.py#L131-L153 |
51,879 | phdata/sdc-api-tool | sdctool/api.py | validate_pipeline | def validate_pipeline(url, pipeline_id, auth, verify_ssl):
"""Validate a pipeline and show issues.
Args:
url (str): the host url in the form 'http://host:port/'.
pipeline_id (str): the ID of of the exported pipeline.
auth (tuple): a tuple of username, and password.
... | python | def validate_pipeline(url, pipeline_id, auth, verify_ssl):
"""Validate a pipeline and show issues.
Args:
url (str): the host url in the form 'http://host:port/'.
pipeline_id (str): the ID of of the exported pipeline.
auth (tuple): a tuple of username, and password.
... | [
"def",
"validate_pipeline",
"(",
"url",
",",
"pipeline_id",
",",
"auth",
",",
"verify_ssl",
")",
":",
"validate_result",
"=",
"requests",
".",
"get",
"(",
"url",
"+",
"'/'",
"+",
"pipeline_id",
"+",
"'/validate'",
",",
"headers",
"=",
"X_REQ_BY",
",",
"aut... | Validate a pipeline and show issues.
Args:
url (str): the host url in the form 'http://host:port/'.
pipeline_id (str): the ID of of the exported pipeline.
auth (tuple): a tuple of username, and password.
verify_ssl (bool): whether to verify ssl certificates
Returns... | [
"Validate",
"a",
"pipeline",
"and",
"show",
"issues",
"."
] | 8c86cfa89773ad411226264293d5b574194045de | https://github.com/phdata/sdc-api-tool/blob/8c86cfa89773ad411226264293d5b574194045de/sdctool/api.py#L156-L178 |
51,880 | phdata/sdc-api-tool | sdctool/api.py | import_pipeline | def import_pipeline(url, pipeline_id, auth, json_payload, verify_ssl, overwrite = False):
"""Import a pipeline.
This will completely overwrite the existing pipeline.
Args:
url (str): the host url in the form 'http://host:port/'.
pipeline_id (str): the ID of of the exported pipel... | python | def import_pipeline(url, pipeline_id, auth, json_payload, verify_ssl, overwrite = False):
"""Import a pipeline.
This will completely overwrite the existing pipeline.
Args:
url (str): the host url in the form 'http://host:port/'.
pipeline_id (str): the ID of of the exported pipel... | [
"def",
"import_pipeline",
"(",
"url",
",",
"pipeline_id",
",",
"auth",
",",
"json_payload",
",",
"verify_ssl",
",",
"overwrite",
"=",
"False",
")",
":",
"parameters",
"=",
"{",
"'overwrite'",
":",
"overwrite",
"}",
"import_result",
"=",
"requests",
".",
"pos... | Import a pipeline.
This will completely overwrite the existing pipeline.
Args:
url (str): the host url in the form 'http://host:port/'.
pipeline_id (str): the ID of of the exported pipeline.
auth (tuple): a tuple of username, and password.
json_payload (dict): ... | [
"Import",
"a",
"pipeline",
"."
] | 8c86cfa89773ad411226264293d5b574194045de | https://github.com/phdata/sdc-api-tool/blob/8c86cfa89773ad411226264293d5b574194045de/sdctool/api.py#L194-L220 |
51,881 | phdata/sdc-api-tool | sdctool/api.py | create_pipeline | def create_pipeline(url, auth, json_payload, verify_ssl):
"""Create a new pipeline.
Args:
url (str): the host url in the form 'http://host:port/'.
auth (tuple): a tuple of username, and password.
json_payload (dict): the exported json paylod as a dictionary.
ver... | python | def create_pipeline(url, auth, json_payload, verify_ssl):
"""Create a new pipeline.
Args:
url (str): the host url in the form 'http://host:port/'.
auth (tuple): a tuple of username, and password.
json_payload (dict): the exported json paylod as a dictionary.
ver... | [
"def",
"create_pipeline",
"(",
"url",
",",
"auth",
",",
"json_payload",
",",
"verify_ssl",
")",
":",
"title",
"=",
"json_payload",
"[",
"'pipelineConfig'",
"]",
"[",
"'title'",
"]",
"description",
"=",
"json_payload",
"[",
"'pipelineConfig'",
"]",
"[",
"'descr... | Create a new pipeline.
Args:
url (str): the host url in the form 'http://host:port/'.
auth (tuple): a tuple of username, and password.
json_payload (dict): the exported json paylod as a dictionary.
verify_ssl (bool): whether to verify ssl certificates
Returns... | [
"Create",
"a",
"new",
"pipeline",
"."
] | 8c86cfa89773ad411226264293d5b574194045de | https://github.com/phdata/sdc-api-tool/blob/8c86cfa89773ad411226264293d5b574194045de/sdctool/api.py#L223-L245 |
51,882 | phdata/sdc-api-tool | sdctool/api.py | system_info | def system_info(url, auth, verify_ssl):
"""Retrieve SDC system information.
Args:
url (str): the host url.
auth (tuple): a tuple of username, and password.
"""
sysinfo_response = requests.get(url + '/info', headers=X_REQ_BY, auth=auth, verify=verify_ssl)
sysinfo_response.raise_for_... | python | def system_info(url, auth, verify_ssl):
"""Retrieve SDC system information.
Args:
url (str): the host url.
auth (tuple): a tuple of username, and password.
"""
sysinfo_response = requests.get(url + '/info', headers=X_REQ_BY, auth=auth, verify=verify_ssl)
sysinfo_response.raise_for_... | [
"def",
"system_info",
"(",
"url",
",",
"auth",
",",
"verify_ssl",
")",
":",
"sysinfo_response",
"=",
"requests",
".",
"get",
"(",
"url",
"+",
"'/info'",
",",
"headers",
"=",
"X_REQ_BY",
",",
"auth",
"=",
"auth",
",",
"verify",
"=",
"verify_ssl",
")",
"... | Retrieve SDC system information.
Args:
url (str): the host url.
auth (tuple): a tuple of username, and password. | [
"Retrieve",
"SDC",
"system",
"information",
"."
] | 8c86cfa89773ad411226264293d5b574194045de | https://github.com/phdata/sdc-api-tool/blob/8c86cfa89773ad411226264293d5b574194045de/sdctool/api.py#L247-L257 |
51,883 | phdata/sdc-api-tool | sdctool/commands.py | export_pipeline | def export_pipeline(conf, args):
"""Export a pipeline to json."""
# Export the source pipeline and save it to file
src = conf.config['instances'][args.src_instance]
src_url = api.build_pipeline_url(build_instance_url(src))
src_auth = tuple([conf.creds['instances'][args.src_instance]['user'],
... | python | def export_pipeline(conf, args):
"""Export a pipeline to json."""
# Export the source pipeline and save it to file
src = conf.config['instances'][args.src_instance]
src_url = api.build_pipeline_url(build_instance_url(src))
src_auth = tuple([conf.creds['instances'][args.src_instance]['user'],
... | [
"def",
"export_pipeline",
"(",
"conf",
",",
"args",
")",
":",
"# Export the source pipeline and save it to file",
"src",
"=",
"conf",
".",
"config",
"[",
"'instances'",
"]",
"[",
"args",
".",
"src_instance",
"]",
"src_url",
"=",
"api",
".",
"build_pipeline_url",
... | Export a pipeline to json. | [
"Export",
"a",
"pipeline",
"to",
"json",
"."
] | 8c86cfa89773ad411226264293d5b574194045de | https://github.com/phdata/sdc-api-tool/blob/8c86cfa89773ad411226264293d5b574194045de/sdctool/commands.py#L7-L18 |
51,884 | phdata/sdc-api-tool | sdctool/commands.py | import_pipeline | def import_pipeline(conf, args):
"""Import a pipeline from json."""
with open(args.pipeline_json) as pipeline_json:
dst = conf.config['instances'][args.dst_instance]
dst_url = api.build_pipeline_url(build_instance_url(dst))
dst_auth = tuple([conf.creds['instances'][args.dst_instance]['us... | python | def import_pipeline(conf, args):
"""Import a pipeline from json."""
with open(args.pipeline_json) as pipeline_json:
dst = conf.config['instances'][args.dst_instance]
dst_url = api.build_pipeline_url(build_instance_url(dst))
dst_auth = tuple([conf.creds['instances'][args.dst_instance]['us... | [
"def",
"import_pipeline",
"(",
"conf",
",",
"args",
")",
":",
"with",
"open",
"(",
"args",
".",
"pipeline_json",
")",
"as",
"pipeline_json",
":",
"dst",
"=",
"conf",
".",
"config",
"[",
"'instances'",
"]",
"[",
"args",
".",
"dst_instance",
"]",
"dst_url"... | Import a pipeline from json. | [
"Import",
"a",
"pipeline",
"from",
"json",
"."
] | 8c86cfa89773ad411226264293d5b574194045de | https://github.com/phdata/sdc-api-tool/blob/8c86cfa89773ad411226264293d5b574194045de/sdctool/commands.py#L20-L29 |
51,885 | phdata/sdc-api-tool | sdctool/commands.py | promote_pipeline | def promote_pipeline(conf, args):
"""Export a pipeline from a lower environment and import into higher environment."""
src = conf.config['instances'][args.src_instance]
src_url = api.build_pipeline_url(build_instance_url(src))
src_auth = tuple([conf.creds['instances'][args.src_instance]['user'], conf.cr... | python | def promote_pipeline(conf, args):
"""Export a pipeline from a lower environment and import into higher environment."""
src = conf.config['instances'][args.src_instance]
src_url = api.build_pipeline_url(build_instance_url(src))
src_auth = tuple([conf.creds['instances'][args.src_instance]['user'], conf.cr... | [
"def",
"promote_pipeline",
"(",
"conf",
",",
"args",
")",
":",
"src",
"=",
"conf",
".",
"config",
"[",
"'instances'",
"]",
"[",
"args",
".",
"src_instance",
"]",
"src_url",
"=",
"api",
".",
"build_pipeline_url",
"(",
"build_instance_url",
"(",
"src",
")",
... | Export a pipeline from a lower environment and import into higher environment. | [
"Export",
"a",
"pipeline",
"from",
"a",
"lower",
"environment",
"and",
"import",
"into",
"higher",
"environment",
"."
] | 8c86cfa89773ad411226264293d5b574194045de | https://github.com/phdata/sdc-api-tool/blob/8c86cfa89773ad411226264293d5b574194045de/sdctool/commands.py#L31-L57 |
51,886 | phdata/sdc-api-tool | sdctool/commands.py | start_pipeline | def start_pipeline(conf, args):
"""Start a pipeline"""
host = conf.config['instances'][args.host_instance]
url = api.build_pipeline_url(build_instance_url(host))
auth = tuple([conf.creds['instances'][args.host_instance]['user'], conf.creds['instances'][args.host_instance]['pass']])
runtime_parameter... | python | def start_pipeline(conf, args):
"""Start a pipeline"""
host = conf.config['instances'][args.host_instance]
url = api.build_pipeline_url(build_instance_url(host))
auth = tuple([conf.creds['instances'][args.host_instance]['user'], conf.creds['instances'][args.host_instance]['pass']])
runtime_parameter... | [
"def",
"start_pipeline",
"(",
"conf",
",",
"args",
")",
":",
"host",
"=",
"conf",
".",
"config",
"[",
"'instances'",
"]",
"[",
"args",
".",
"host_instance",
"]",
"url",
"=",
"api",
".",
"build_pipeline_url",
"(",
"build_instance_url",
"(",
"host",
")",
"... | Start a pipeline | [
"Start",
"a",
"pipeline"
] | 8c86cfa89773ad411226264293d5b574194045de | https://github.com/phdata/sdc-api-tool/blob/8c86cfa89773ad411226264293d5b574194045de/sdctool/commands.py#L59-L70 |
51,887 | phdata/sdc-api-tool | sdctool/commands.py | system_info | def system_info(conf, args):
"""Retieve SDC system information."""
src = conf.config['instances'][args.src]
src_url = api.build_system_url(build_instance_url(src))
src_auth = tuple([conf.creds['instances'][args.src]['user'],
conf.creds['instances'][args.src]['pass']])
verify_ss... | python | def system_info(conf, args):
"""Retieve SDC system information."""
src = conf.config['instances'][args.src]
src_url = api.build_system_url(build_instance_url(src))
src_auth = tuple([conf.creds['instances'][args.src]['user'],
conf.creds['instances'][args.src]['pass']])
verify_ss... | [
"def",
"system_info",
"(",
"conf",
",",
"args",
")",
":",
"src",
"=",
"conf",
".",
"config",
"[",
"'instances'",
"]",
"[",
"args",
".",
"src",
"]",
"src_url",
"=",
"api",
".",
"build_system_url",
"(",
"build_instance_url",
"(",
"src",
")",
")",
"src_au... | Retieve SDC system information. | [
"Retieve",
"SDC",
"system",
"information",
"."
] | 8c86cfa89773ad411226264293d5b574194045de | https://github.com/phdata/sdc-api-tool/blob/8c86cfa89773ad411226264293d5b574194045de/sdctool/commands.py#L82-L90 |
51,888 | phdata/sdc-api-tool | sdctool/commands.py | validate_pipeline | def validate_pipeline(conf, args):
"""Validate a pipeline configuration."""
host = conf.config['instances'][args.host_instance]
host_url = api.build_pipeline_url(build_instance_url(host))
host_auth = tuple([conf.creds['instances'][args.host_instance]['user'],
conf.creds['instances'... | python | def validate_pipeline(conf, args):
"""Validate a pipeline configuration."""
host = conf.config['instances'][args.host_instance]
host_url = api.build_pipeline_url(build_instance_url(host))
host_auth = tuple([conf.creds['instances'][args.host_instance]['user'],
conf.creds['instances'... | [
"def",
"validate_pipeline",
"(",
"conf",
",",
"args",
")",
":",
"host",
"=",
"conf",
".",
"config",
"[",
"'instances'",
"]",
"[",
"args",
".",
"host_instance",
"]",
"host_url",
"=",
"api",
".",
"build_pipeline_url",
"(",
"build_instance_url",
"(",
"host",
... | Validate a pipeline configuration. | [
"Validate",
"a",
"pipeline",
"configuration",
"."
] | 8c86cfa89773ad411226264293d5b574194045de | https://github.com/phdata/sdc-api-tool/blob/8c86cfa89773ad411226264293d5b574194045de/sdctool/commands.py#L92-L100 |
51,889 | rjdkmr/do_x3dna | dnaMD/dnaMD/dnaEY.py | dnaEY.extractGlobalParameters | def extractGlobalParameters(self, dna, bp, frames=None, paxis='Z', masked=False):
"""Extract the parameters for calculations
.. currentmodule:: dnaMD
Parameters
----------
dna : :class:`dnaMD.DNA`
Input :class:`dnaMD.DNA` instance.
bp : list
Li... | python | def extractGlobalParameters(self, dna, bp, frames=None, paxis='Z', masked=False):
"""Extract the parameters for calculations
.. currentmodule:: dnaMD
Parameters
----------
dna : :class:`dnaMD.DNA`
Input :class:`dnaMD.DNA` instance.
bp : list
Li... | [
"def",
"extractGlobalParameters",
"(",
"self",
",",
"dna",
",",
"bp",
",",
"frames",
"=",
"None",
",",
"paxis",
"=",
"'Z'",
",",
"masked",
"=",
"False",
")",
":",
"frames",
"=",
"self",
".",
"_validateFrames",
"(",
"frames",
")",
"if",
"frames",
"[",
... | Extract the parameters for calculations
.. currentmodule:: dnaMD
Parameters
----------
dna : :class:`dnaMD.DNA`
Input :class:`dnaMD.DNA` instance.
bp : list
List of two base-steps forming the DNA segment.
For example: with ``bp=[5, 50]``, 5... | [
"Extract",
"the",
"parameters",
"for",
"calculations"
] | fe910335eefcada76737f9e7cd6f25036cd32ab6 | https://github.com/rjdkmr/do_x3dna/blob/fe910335eefcada76737f9e7cd6f25036cd32ab6/dnaMD/dnaMD/dnaEY.py#L207-L283 |
51,890 | rjdkmr/do_x3dna | dnaMD/dnaMD/dnaEY.py | dnaEY.getStretchTwistBendModulus | def getStretchTwistBendModulus(self, bp, frames=None, paxis='Z', masked=True, matrix=False):
r"""Calculate Bending-Stretching-Twisting matrix
It calculate elastic matrix and modulus matrix.
.. math::
\text{modulus matrix} = 4.1419464 \times \begin{bmatrix}
K_{Bx} ... | python | def getStretchTwistBendModulus(self, bp, frames=None, paxis='Z', masked=True, matrix=False):
r"""Calculate Bending-Stretching-Twisting matrix
It calculate elastic matrix and modulus matrix.
.. math::
\text{modulus matrix} = 4.1419464 \times \begin{bmatrix}
K_{Bx} ... | [
"def",
"getStretchTwistBendModulus",
"(",
"self",
",",
"bp",
",",
"frames",
"=",
"None",
",",
"paxis",
"=",
"'Z'",
",",
"masked",
"=",
"True",
",",
"matrix",
"=",
"False",
")",
":",
"if",
"self",
".",
"esType",
"==",
"'ST'",
":",
"raise",
"KeyError",
... | r"""Calculate Bending-Stretching-Twisting matrix
It calculate elastic matrix and modulus matrix.
.. math::
\text{modulus matrix} = 4.1419464 \times \begin{bmatrix}
K_{Bx} & K_{Bx,By} & K_{Bx,S} & K_{Bx,T} \\
K_{Bx,By} & K_{By} & K_{By,S} & K_{By,T} \\
... | [
"r",
"Calculate",
"Bending",
"-",
"Stretching",
"-",
"Twisting",
"matrix"
] | fe910335eefcada76737f9e7cd6f25036cd32ab6 | https://github.com/rjdkmr/do_x3dna/blob/fe910335eefcada76737f9e7cd6f25036cd32ab6/dnaMD/dnaMD/dnaEY.py#L372-L455 |
51,891 | rjdkmr/do_x3dna | dnaMD/dnaMD/dnaEY.py | dnaEY.getModulusByTime | def getModulusByTime(self, bp, frameGap, masked=False, paxis='Z', outFile=None):
r"""Calculate moduli as a function of time for convergence check
It can be used to obtained elastic moduli as a function of time to check their convergence.
.. note:: Elastic properties cannot be calculated using ... | python | def getModulusByTime(self, bp, frameGap, masked=False, paxis='Z', outFile=None):
r"""Calculate moduli as a function of time for convergence check
It can be used to obtained elastic moduli as a function of time to check their convergence.
.. note:: Elastic properties cannot be calculated using ... | [
"def",
"getModulusByTime",
"(",
"self",
",",
"bp",
",",
"frameGap",
",",
"masked",
"=",
"False",
",",
"paxis",
"=",
"'Z'",
",",
"outFile",
"=",
"None",
")",
":",
"if",
"self",
".",
"esType",
"==",
"'BST'",
":",
"props_name",
"=",
"[",
"'bend-1'",
","... | r"""Calculate moduli as a function of time for convergence check
It can be used to obtained elastic moduli as a function of time to check their convergence.
.. note:: Elastic properties cannot be calculated using a single frame because fluctuations are required.
Therefore, here time ... | [
"r",
"Calculate",
"moduli",
"as",
"a",
"function",
"of",
"time",
"for",
"convergence",
"check"
] | fe910335eefcada76737f9e7cd6f25036cd32ab6 | https://github.com/rjdkmr/do_x3dna/blob/fe910335eefcada76737f9e7cd6f25036cd32ab6/dnaMD/dnaMD/dnaEY.py#L534-L651 |
51,892 | rjdkmr/do_x3dna | dnaMD/dnaMD/dnaEY.py | dnaEY.getGlobalDeformationEnergy | def getGlobalDeformationEnergy(self, bp, complexDna, freeDnaFrames=None, boundDnaFrames=None, paxis='Z',
which='all', masked=False, outFile=None):
r"""Deformation energy of the input DNA using Global elastic properties
It can be used to calculated deformation energy o... | python | def getGlobalDeformationEnergy(self, bp, complexDna, freeDnaFrames=None, boundDnaFrames=None, paxis='Z',
which='all', masked=False, outFile=None):
r"""Deformation energy of the input DNA using Global elastic properties
It can be used to calculated deformation energy o... | [
"def",
"getGlobalDeformationEnergy",
"(",
"self",
",",
"bp",
",",
"complexDna",
",",
"freeDnaFrames",
"=",
"None",
",",
"boundDnaFrames",
"=",
"None",
",",
"paxis",
"=",
"'Z'",
",",
"which",
"=",
"'all'",
",",
"masked",
"=",
"False",
",",
"outFile",
"=",
... | r"""Deformation energy of the input DNA using Global elastic properties
It can be used to calculated deformation energy of a input DNA with reference to the DNA present in the current
object.
The deformation free energy is calculated using elastic matrix as follows
.. math::
... | [
"r",
"Deformation",
"energy",
"of",
"the",
"input",
"DNA",
"using",
"Global",
"elastic",
"properties"
] | fe910335eefcada76737f9e7cd6f25036cd32ab6 | https://github.com/rjdkmr/do_x3dna/blob/fe910335eefcada76737f9e7cd6f25036cd32ab6/dnaMD/dnaMD/dnaEY.py#L653-L795 |
51,893 | rjdkmr/do_x3dna | dnaMD/dnaMD/dnaEY.py | dnaEY._calcEnergyStretchTwist | def _calcEnergyStretchTwist(self, diff, es, which):
r"""Calculate energy for ``estype='ST'`` using a difference vector.
It is called in :meth:`dnaEY.getGlobalDeformationEnergy` for energy calculation of each frame.
Parameters
----------
diff : numpy.ndarray
Array of... | python | def _calcEnergyStretchTwist(self, diff, es, which):
r"""Calculate energy for ``estype='ST'`` using a difference vector.
It is called in :meth:`dnaEY.getGlobalDeformationEnergy` for energy calculation of each frame.
Parameters
----------
diff : numpy.ndarray
Array of... | [
"def",
"_calcEnergyStretchTwist",
"(",
"self",
",",
"diff",
",",
"es",
",",
"which",
")",
":",
"if",
"which",
"not",
"in",
"self",
".",
"enGlobalTypes",
"[",
":",
"5",
"]",
":",
"raise",
"ValueError",
"(",
"'{0} is not a supported energy keywords.\\n Use any of ... | r"""Calculate energy for ``estype='ST'`` using a difference vector.
It is called in :meth:`dnaEY.getGlobalDeformationEnergy` for energy calculation of each frame.
Parameters
----------
diff : numpy.ndarray
Array of difference between minimum and current parameter values.
... | [
"r",
"Calculate",
"energy",
"for",
"estype",
"=",
"ST",
"using",
"a",
"difference",
"vector",
"."
] | fe910335eefcada76737f9e7cd6f25036cd32ab6 | https://github.com/rjdkmr/do_x3dna/blob/fe910335eefcada76737f9e7cd6f25036cd32ab6/dnaMD/dnaMD/dnaEY.py#L797-L851 |
51,894 | rjdkmr/do_x3dna | dnaMD/dnaMD/dnaEY.py | dnaEY.calculateLocalElasticity | def calculateLocalElasticity(self, bp, frames=None, helical=False, unit='kT'):
r"""Calculate local elastic matrix or stiffness matrix for local DNA segment
.. note:: Here local DNA segment referred to less than 5 base-pair long.
In case of :ref:`base-step-image`: Shift (:math:`Dx`), Slide (:ma... | python | def calculateLocalElasticity(self, bp, frames=None, helical=False, unit='kT'):
r"""Calculate local elastic matrix or stiffness matrix for local DNA segment
.. note:: Here local DNA segment referred to less than 5 base-pair long.
In case of :ref:`base-step-image`: Shift (:math:`Dx`), Slide (:ma... | [
"def",
"calculateLocalElasticity",
"(",
"self",
",",
"bp",
",",
"frames",
"=",
"None",
",",
"helical",
"=",
"False",
",",
"unit",
"=",
"'kT'",
")",
":",
"acceptedUnit",
"=",
"[",
"'kT'",
",",
"'kJ/mol'",
",",
"'kcal/mol'",
"]",
"if",
"unit",
"not",
"in... | r"""Calculate local elastic matrix or stiffness matrix for local DNA segment
.. note:: Here local DNA segment referred to less than 5 base-pair long.
In case of :ref:`base-step-image`: Shift (:math:`Dx`), Slide (:math:`Dy`), Rise (:math:`Dz`),
Tilt (:math:`\tau`), Roll (:math:`\rho`) and Twist... | [
"r",
"Calculate",
"local",
"elastic",
"matrix",
"or",
"stiffness",
"matrix",
"for",
"local",
"DNA",
"segment"
] | fe910335eefcada76737f9e7cd6f25036cd32ab6 | https://github.com/rjdkmr/do_x3dna/blob/fe910335eefcada76737f9e7cd6f25036cd32ab6/dnaMD/dnaMD/dnaEY.py#L954-L1059 |
51,895 | rjdkmr/do_x3dna | dnaMD/dnaMD/dnaEY.py | dnaEY.getLocalElasticityByTime | def getLocalElasticityByTime(self, bp, frameGap, helical=False, unit='kT', outFile=None):
r"""Calculate local elastic properties as a function of time for convergence check
It can be used to obtained elastic properties as a function of time.
.. note:: Elastic properties cannot be calculated us... | python | def getLocalElasticityByTime(self, bp, frameGap, helical=False, unit='kT', outFile=None):
r"""Calculate local elastic properties as a function of time for convergence check
It can be used to obtained elastic properties as a function of time.
.. note:: Elastic properties cannot be calculated us... | [
"def",
"getLocalElasticityByTime",
"(",
"self",
",",
"bp",
",",
"frameGap",
",",
"helical",
"=",
"False",
",",
"unit",
"=",
"'kT'",
",",
"outFile",
"=",
"None",
")",
":",
"if",
"helical",
":",
"props_name",
"=",
"helical_local_props_vector",
"else",
":",
"... | r"""Calculate local elastic properties as a function of time for convergence check
It can be used to obtained elastic properties as a function of time.
.. note:: Elastic properties cannot be calculated using a single frame because fluctuations are required.
Therefore, here time means... | [
"r",
"Calculate",
"local",
"elastic",
"properties",
"as",
"a",
"function",
"of",
"time",
"for",
"convergence",
"check"
] | fe910335eefcada76737f9e7cd6f25036cd32ab6 | https://github.com/rjdkmr/do_x3dna/blob/fe910335eefcada76737f9e7cd6f25036cd32ab6/dnaMD/dnaMD/dnaEY.py#L1061-L1181 |
51,896 | rjdkmr/do_x3dna | dnaMD/dnaMD/dnaEY.py | dnaEY.calculateLocalElasticitySegments | def calculateLocalElasticitySegments(self, bp, span=2, frameGap=None, helical=False, unit='kT',
err_type='block', tool='gmx analyze', outFile=None):
"""Calculate local elastic properties of consecutive overlapped DNA segments
Calculate local elastic properties o... | python | def calculateLocalElasticitySegments(self, bp, span=2, frameGap=None, helical=False, unit='kT',
err_type='block', tool='gmx analyze', outFile=None):
"""Calculate local elastic properties of consecutive overlapped DNA segments
Calculate local elastic properties o... | [
"def",
"calculateLocalElasticitySegments",
"(",
"self",
",",
"bp",
",",
"span",
"=",
"2",
",",
"frameGap",
"=",
"None",
",",
"helical",
"=",
"False",
",",
"unit",
"=",
"'kT'",
",",
"err_type",
"=",
"'block'",
",",
"tool",
"=",
"'gmx analyze'",
",",
"outF... | Calculate local elastic properties of consecutive overlapped DNA segments
Calculate local elastic properties of consecutive overlapped DNA segments of length given by `span`.
Parameters
----------
bp : list
List of two base-steps forming the global DNA segment.
... | [
"Calculate",
"local",
"elastic",
"properties",
"of",
"consecutive",
"overlapped",
"DNA",
"segments"
] | fe910335eefcada76737f9e7cd6f25036cd32ab6 | https://github.com/rjdkmr/do_x3dna/blob/fe910335eefcada76737f9e7cd6f25036cd32ab6/dnaMD/dnaMD/dnaEY.py#L1183-L1267 |
51,897 | rjdkmr/do_x3dna | dnaMD/dnaMD/dnaEY.py | dnaEY.getLocalDeformationEnergy | def getLocalDeformationEnergy(self, bp, complexDna, freeDnaFrames=None, boundDnaFrames=None, helical=False,
unit='kT', which='all', outFile=None):
r"""Deformation energy of the input DNA using local elastic properties
The deformation energy of a base-step/s for probe D... | python | def getLocalDeformationEnergy(self, bp, complexDna, freeDnaFrames=None, boundDnaFrames=None, helical=False,
unit='kT', which='all', outFile=None):
r"""Deformation energy of the input DNA using local elastic properties
The deformation energy of a base-step/s for probe D... | [
"def",
"getLocalDeformationEnergy",
"(",
"self",
",",
"bp",
",",
"complexDna",
",",
"freeDnaFrames",
"=",
"None",
",",
"boundDnaFrames",
"=",
"None",
",",
"helical",
"=",
"False",
",",
"unit",
"=",
"'kT'",
",",
"which",
"=",
"'all'",
",",
"outFile",
"=",
... | r"""Deformation energy of the input DNA using local elastic properties
The deformation energy of a base-step/s for probe DNA object with reference to
the same base-step/s DNA present in the current DNA object.
The deformation free energy is calculated using elastic matrix as follows
.... | [
"r",
"Deformation",
"energy",
"of",
"the",
"input",
"DNA",
"using",
"local",
"elastic",
"properties"
] | fe910335eefcada76737f9e7cd6f25036cd32ab6 | https://github.com/rjdkmr/do_x3dna/blob/fe910335eefcada76737f9e7cd6f25036cd32ab6/dnaMD/dnaMD/dnaEY.py#L1269-L1412 |
51,898 | rjdkmr/do_x3dna | dnaMD/dnaMD/dnaEY.py | dnaEY._calcLocalEnergy | def _calcLocalEnergy(self, diff, es, which):
r"""Calculate local deformation energy using a difference vector.
It is called in :meth:`dnaEY.getLocalDeformationEnergy` for energy calculation of each frame.
Parameters
----------
diff : numpy.ndarray
Array of differenc... | python | def _calcLocalEnergy(self, diff, es, which):
r"""Calculate local deformation energy using a difference vector.
It is called in :meth:`dnaEY.getLocalDeformationEnergy` for energy calculation of each frame.
Parameters
----------
diff : numpy.ndarray
Array of differenc... | [
"def",
"_calcLocalEnergy",
"(",
"self",
",",
"diff",
",",
"es",
",",
"which",
")",
":",
"if",
"which",
"not",
"in",
"self",
".",
"enLocalTypes",
":",
"raise",
"ValueError",
"(",
"'{0} is not a supported energy keywords.\\n Use any of the following: \\n {1}'",
".",
"... | r"""Calculate local deformation energy using a difference vector.
It is called in :meth:`dnaEY.getLocalDeformationEnergy` for energy calculation of each frame.
Parameters
----------
diff : numpy.ndarray
Array of difference between minimum and current parameter values.
... | [
"r",
"Calculate",
"local",
"deformation",
"energy",
"using",
"a",
"difference",
"vector",
"."
] | fe910335eefcada76737f9e7cd6f25036cd32ab6 | https://github.com/rjdkmr/do_x3dna/blob/fe910335eefcada76737f9e7cd6f25036cd32ab6/dnaMD/dnaMD/dnaEY.py#L1545-L1606 |
51,899 | wharris/dougrain | dougrain/link.py | extract_variables | def extract_variables(href):
"""Return a list of variable names used in a URI template."""
patterns = [re.sub(r'\*|:\d+', '', pattern)
for pattern in re.findall(r'{[\+#\./;\?&]?([^}]+)*}', href)]
variables = []
for pattern in patterns:
for part in pattern.split(","):
... | python | def extract_variables(href):
"""Return a list of variable names used in a URI template."""
patterns = [re.sub(r'\*|:\d+', '', pattern)
for pattern in re.findall(r'{[\+#\./;\?&]?([^}]+)*}', href)]
variables = []
for pattern in patterns:
for part in pattern.split(","):
... | [
"def",
"extract_variables",
"(",
"href",
")",
":",
"patterns",
"=",
"[",
"re",
".",
"sub",
"(",
"r'\\*|:\\d+'",
",",
"''",
",",
"pattern",
")",
"for",
"pattern",
"in",
"re",
".",
"findall",
"(",
"r'{[\\+#\\./;\\?&]?([^}]+)*}'",
",",
"href",
")",
"]",
"va... | Return a list of variable names used in a URI template. | [
"Return",
"a",
"list",
"of",
"variable",
"names",
"used",
"in",
"a",
"URI",
"template",
"."
] | 45062a1562fc34793e40c6253a93aa91eb4cf855 | https://github.com/wharris/dougrain/blob/45062a1562fc34793e40c6253a93aa91eb4cf855/dougrain/link.py#L13-L24 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.