nwo stringlengths 5 86 | sha stringlengths 40 40 | path stringlengths 4 189 | language stringclasses 1
value | identifier stringlengths 1 94 | parameters stringlengths 2 4.03k | argument_list stringclasses 1
value | return_statement stringlengths 0 11.5k | docstring stringlengths 1 33.2k | docstring_summary stringlengths 0 5.15k | docstring_tokens list | function stringlengths 34 151k | function_tokens list | url stringlengths 90 278 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
mantidproject/mantid | 03deeb89254ec4289edb8771e0188c2090a02f32 | Framework/PythonInterface/plugins/algorithms/MRInspectData.py | python | fit_2d_peak | (workspace) | return [x_min, x_max], [y_min, y_max] | Fit a 2D Gaussian peak
:param workspace: workspace to work with | Fit a 2D Gaussian peak
:param workspace: workspace to work with | [
"Fit",
"a",
"2D",
"Gaussian",
"peak",
":",
"param",
"workspace",
":",
"workspace",
"to",
"work",
"with"
] | def fit_2d_peak(workspace):
"""
Fit a 2D Gaussian peak
:param workspace: workspace to work with
"""
n_x = int(workspace.getInstrument().getNumberParameter("number-of-x-pixels")[0])
n_y = int(workspace.getInstrument().getNumberParameter("number-of-y-pixels")[0])
# Prepare data to fit... | [
"def",
"fit_2d_peak",
"(",
"workspace",
")",
":",
"n_x",
"=",
"int",
"(",
"workspace",
".",
"getInstrument",
"(",
")",
".",
"getNumberParameter",
"(",
"\"number-of-x-pixels\"",
")",
"[",
"0",
"]",
")",
"n_y",
"=",
"int",
"(",
"workspace",
".",
"getInstrume... | https://github.com/mantidproject/mantid/blob/03deeb89254ec4289edb8771e0188c2090a02f32/Framework/PythonInterface/plugins/algorithms/MRInspectData.py#L437-L517 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/linux_x64/lib/python3.7/site-packages/urllib3/util/request.py | python | set_file_position | (body, pos) | return pos | If a position is provided, move file to that point.
Otherwise, we'll attempt to record a position for future use. | If a position is provided, move file to that point.
Otherwise, we'll attempt to record a position for future use. | [
"If",
"a",
"position",
"is",
"provided",
"move",
"file",
"to",
"that",
"point",
".",
"Otherwise",
"we",
"ll",
"attempt",
"to",
"record",
"a",
"position",
"for",
"future",
"use",
"."
] | def set_file_position(body, pos):
"""
If a position is provided, move file to that point.
Otherwise, we'll attempt to record a position for future use.
"""
if pos is not None:
rewind_body(body, pos)
elif getattr(body, "tell", None) is not None:
try:
pos = body.tell()
... | [
"def",
"set_file_position",
"(",
"body",
",",
"pos",
")",
":",
"if",
"pos",
"is",
"not",
"None",
":",
"rewind_body",
"(",
"body",
",",
"pos",
")",
"elif",
"getattr",
"(",
"body",
",",
"\"tell\"",
",",
"None",
")",
"is",
"not",
"None",
":",
"try",
"... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/linux_x64/lib/python3.7/site-packages/urllib3/util/request.py#L90-L105 | |
sailing-pmls/bosen | 06cb58902d011fbea5f9428f10ce30e621492204 | style_script/cpplint.py | python | CheckRedundantOverrideOrFinal | (filename, clean_lines, linenum, error) | Check if line contains a redundant "override" or "final" virt-specifier.
Args:
filename: The name of the current file.
clean_lines: A CleansedLines instance containing the file.
linenum: The number of the line to check.
error: The function to call with any errors found. | Check if line contains a redundant "override" or "final" virt-specifier. | [
"Check",
"if",
"line",
"contains",
"a",
"redundant",
"override",
"or",
"final",
"virt",
"-",
"specifier",
"."
] | def CheckRedundantOverrideOrFinal(filename, clean_lines, linenum, error):
"""Check if line contains a redundant "override" or "final" virt-specifier.
Args:
filename: The name of the current file.
clean_lines: A CleansedLines instance containing the file.
linenum: The number of the line to check.
er... | [
"def",
"CheckRedundantOverrideOrFinal",
"(",
"filename",
",",
"clean_lines",
",",
"linenum",
",",
"error",
")",
":",
"# Look for closing parenthesis nearby. We need one to confirm where",
"# the declarator ends and where the virt-specifier starts to avoid",
"# false positives.",
"line... | https://github.com/sailing-pmls/bosen/blob/06cb58902d011fbea5f9428f10ce30e621492204/style_script/cpplint.py#L5811-L5837 | ||
idaholab/moose | 9eeebc65e098b4c30f8205fb41591fd5b61eb6ff | python/chigger/base/ColorMap.py | python | ColorMap.__default | (self) | return lut | Build Peacock style colormap. | Build Peacock style colormap. | [
"Build",
"Peacock",
"style",
"colormap",
"."
] | def __default(self):
"""
Build Peacock style colormap.
"""
n = self.getOption('cmap_num_colors')
lut = vtk.vtkLookupTable()
if self.getOption('cmap_reverse'):
lut.SetHueRange(0.0, 0.667)
else:
lut.SetHueRange(0.667, 0.0)
lut.SetNumb... | [
"def",
"__default",
"(",
"self",
")",
":",
"n",
"=",
"self",
".",
"getOption",
"(",
"'cmap_num_colors'",
")",
"lut",
"=",
"vtk",
".",
"vtkLookupTable",
"(",
")",
"if",
"self",
".",
"getOption",
"(",
"'cmap_reverse'",
")",
":",
"lut",
".",
"SetHueRange",
... | https://github.com/idaholab/moose/blob/9eeebc65e098b4c30f8205fb41591fd5b61eb6ff/python/chigger/base/ColorMap.py#L109-L120 | |
bulletphysics/bullet3 | f0f2a952e146f016096db6f85cf0c44ed75b0b9a | examples/pybullet/gym/pybullet_envs/minitaur/envs/motor.py | python | MotorModel.convert_to_torque | (self,
motor_commands,
motor_angle,
motor_velocity,
true_motor_velocity,
kp=None,
kd=None) | return self._convert_to_torque_from_pwm(pwm, true_motor_velocity) | Convert the commands (position control or torque control) to torque.
Args:
motor_commands: The desired motor angle if the motor is in position
control mode. The pwm signal if the motor is in torque control mode.
motor_angle: The motor angle observed at the current time step. It is
actua... | Convert the commands (position control or torque control) to torque. | [
"Convert",
"the",
"commands",
"(",
"position",
"control",
"or",
"torque",
"control",
")",
"to",
"torque",
"."
] | def convert_to_torque(self,
motor_commands,
motor_angle,
motor_velocity,
true_motor_velocity,
kp=None,
kd=None):
"""Convert the commands (position control or torque control... | [
"def",
"convert_to_torque",
"(",
"self",
",",
"motor_commands",
",",
"motor_angle",
",",
"motor_velocity",
",",
"true_motor_velocity",
",",
"kp",
"=",
"None",
",",
"kd",
"=",
"None",
")",
":",
"if",
"self",
".",
"_torque_control_enabled",
":",
"pwm",
"=",
"m... | https://github.com/bulletphysics/bullet3/blob/f0f2a952e146f016096db6f85cf0c44ed75b0b9a/examples/pybullet/gym/pybullet_envs/minitaur/envs/motor.py#L74-L112 | |
hanpfei/chromium-net | 392cc1fa3a8f92f42e4071ab6e674d8e0482f83f | third_party/catapult/third_party/gsutil/third_party/boto/boto/__init__.py | python | connect_logs | (aws_access_key_id=None,
aws_secret_access_key=None,
**kwargs) | return CloudWatchLogsConnection(
aws_access_key_id=aws_access_key_id,
aws_secret_access_key=aws_secret_access_key,
**kwargs
) | Connect to Amazon CloudWatch Logs
:type aws_access_key_id: string
:param aws_access_key_id: Your AWS Access Key ID
:type aws_secret_access_key: string
:param aws_secret_access_key: Your AWS Secret Access Key
rtype: :class:`boto.kinesis.layer1.CloudWatchLogsConnection`
:return: A connection to... | Connect to Amazon CloudWatch Logs | [
"Connect",
"to",
"Amazon",
"CloudWatch",
"Logs"
] | def connect_logs(aws_access_key_id=None,
aws_secret_access_key=None,
**kwargs):
"""
Connect to Amazon CloudWatch Logs
:type aws_access_key_id: string
:param aws_access_key_id: Your AWS Access Key ID
:type aws_secret_access_key: string
:param aws_secret_a... | [
"def",
"connect_logs",
"(",
"aws_access_key_id",
"=",
"None",
",",
"aws_secret_access_key",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"from",
"boto",
".",
"logs",
".",
"layer1",
"import",
"CloudWatchLogsConnection",
"return",
"CloudWatchLogsConnection",
"(",... | https://github.com/hanpfei/chromium-net/blob/392cc1fa3a8f92f42e4071ab6e674d8e0482f83f/third_party/catapult/third_party/gsutil/third_party/boto/boto/__init__.py#L863-L883 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/linux_x64/lib/python3.7/site-packages/setuptools/_vendor/ordered_set.py | python | OrderedSet.difference | (self, *sets) | return cls(items) | Returns all elements that are in this set but not the others.
Example:
>>> OrderedSet([1, 2, 3]).difference(OrderedSet([2]))
OrderedSet([1, 3])
>>> OrderedSet([1, 2, 3]).difference(OrderedSet([2]), OrderedSet([3]))
OrderedSet([1])
>>> OrderedSet([1, 2... | Returns all elements that are in this set but not the others. | [
"Returns",
"all",
"elements",
"that",
"are",
"in",
"this",
"set",
"but",
"not",
"the",
"others",
"."
] | def difference(self, *sets):
"""
Returns all elements that are in this set but not the others.
Example:
>>> OrderedSet([1, 2, 3]).difference(OrderedSet([2]))
OrderedSet([1, 3])
>>> OrderedSet([1, 2, 3]).difference(OrderedSet([2]), OrderedSet([3]))
... | [
"def",
"difference",
"(",
"self",
",",
"*",
"sets",
")",
":",
"cls",
"=",
"self",
".",
"__class__",
"if",
"sets",
":",
"other",
"=",
"set",
".",
"union",
"(",
"*",
"map",
"(",
"set",
",",
"sets",
")",
")",
"items",
"=",
"(",
"item",
"for",
"ite... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/linux_x64/lib/python3.7/site-packages/setuptools/_vendor/ordered_set.py#L355-L375 | |
grpc/grpc-web | ce7d734e8a1a7d1f09fd6bdb23299f3ef7447887 | packages/grpc-web/scripts/common.py | python | get_files_with_suffix | (root_dir: str, suffix: str) | Yields file names under a directory with a given suffix. | Yields file names under a directory with a given suffix. | [
"Yields",
"file",
"names",
"under",
"a",
"directory",
"with",
"a",
"given",
"suffix",
"."
] | def get_files_with_suffix(root_dir: str, suffix: str) -> Iterator[str]:
"""Yields file names under a directory with a given suffix."""
for dir_path, _, file_names in os.walk(root_dir):
for file_name in file_names:
if file_name.endswith(suffix):
yield os.path.join(dir_path, fi... | [
"def",
"get_files_with_suffix",
"(",
"root_dir",
":",
"str",
",",
"suffix",
":",
"str",
")",
"->",
"Iterator",
"[",
"str",
"]",
":",
"for",
"dir_path",
",",
"_",
",",
"file_names",
"in",
"os",
".",
"walk",
"(",
"root_dir",
")",
":",
"for",
"file_name",... | https://github.com/grpc/grpc-web/blob/ce7d734e8a1a7d1f09fd6bdb23299f3ef7447887/packages/grpc-web/scripts/common.py#L40-L45 | ||
ChromiumWebApps/chromium | c7361d39be8abd1574e6ce8957c8dbddd4c6ccf7 | third_party/python_gflags/gflags.py | python | RegisterValidator | (flag_name,
checker,
message='Flag validation failed',
flag_values=FLAGS) | Adds a constraint, which will be enforced during program execution.
The constraint is validated when flags are initially parsed, and after each
change of the corresponding flag's value.
Args:
flag_name: string, name of the flag to be checked.
checker: method to validate the flag.
input - value of ... | Adds a constraint, which will be enforced during program execution. | [
"Adds",
"a",
"constraint",
"which",
"will",
"be",
"enforced",
"during",
"program",
"execution",
"."
] | def RegisterValidator(flag_name,
checker,
message='Flag validation failed',
flag_values=FLAGS):
"""Adds a constraint, which will be enforced during program execution.
The constraint is validated when flags are initially parsed, and after each
chan... | [
"def",
"RegisterValidator",
"(",
"flag_name",
",",
"checker",
",",
"message",
"=",
"'Flag validation failed'",
",",
"flag_values",
"=",
"FLAGS",
")",
":",
"flag_values",
".",
"AddValidator",
"(",
"gflags_validators",
".",
"SimpleValidator",
"(",
"flag_name",
",",
... | https://github.com/ChromiumWebApps/chromium/blob/c7361d39be8abd1574e6ce8957c8dbddd4c6ccf7/third_party/python_gflags/gflags.py#L2082-L2109 | ||
krishauser/Klampt | 972cc83ea5befac3f653c1ba20f80155768ad519 | Python/klampt/robotsim.py | python | PointCloud.addProperty | (self, *args) | return _robotsim.PointCloud_addProperty(self, *args) | r"""
Adds a new property with name pname, and sets values for this property to the
given length-n array.
addProperty (pname)
addProperty (pname,np_array)
Args:
pname (str):
np_array (:obj:`1D Numpy array of floats`, optional): | r"""
Adds a new property with name pname, and sets values for this property to the
given length-n array. | [
"r",
"Adds",
"a",
"new",
"property",
"with",
"name",
"pname",
"and",
"sets",
"values",
"for",
"this",
"property",
"to",
"the",
"given",
"length",
"-",
"n",
"array",
"."
] | def addProperty(self, *args) ->None:
r"""
Adds a new property with name pname, and sets values for this property to the
given length-n array.
addProperty (pname)
addProperty (pname,np_array)
Args:
pname (str):
np_array (:obj:`1D Numpy array ... | [
"def",
"addProperty",
"(",
"self",
",",
"*",
"args",
")",
"->",
"None",
":",
"return",
"_robotsim",
".",
"PointCloud_addProperty",
"(",
"self",
",",
"*",
"args",
")"
] | https://github.com/krishauser/Klampt/blob/972cc83ea5befac3f653c1ba20f80155768ad519/Python/klampt/robotsim.py#L1226-L1240 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/gtk/_misc.py | python | NotificationMessage.SetTitle | (*args, **kwargs) | return _misc_.NotificationMessage_SetTitle(*args, **kwargs) | SetTitle(self, String title) | SetTitle(self, String title) | [
"SetTitle",
"(",
"self",
"String",
"title",
")"
] | def SetTitle(*args, **kwargs):
"""SetTitle(self, String title)"""
return _misc_.NotificationMessage_SetTitle(*args, **kwargs) | [
"def",
"SetTitle",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_misc_",
".",
"NotificationMessage_SetTitle",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/gtk/_misc.py#L1218-L1220 | |
hanpfei/chromium-net | 392cc1fa3a8f92f42e4071ab6e674d8e0482f83f | third_party/catapult/third_party/gsutil/third_party/boto/boto/beanstalk/layer1.py | python | Layer1.describe_application_versions | (self, application_name=None,
version_labels=None) | return self._get_response('DescribeApplicationVersions', params) | Returns descriptions for existing application versions.
:type application_name: string
:param application_name: If specified, AWS Elastic Beanstalk restricts
the returned descriptions to only include ones that are associated
with the specified application.
:type version... | Returns descriptions for existing application versions. | [
"Returns",
"descriptions",
"for",
"existing",
"application",
"versions",
"."
] | def describe_application_versions(self, application_name=None,
version_labels=None):
"""Returns descriptions for existing application versions.
:type application_name: string
:param application_name: If specified, AWS Elastic Beanstalk restricts
... | [
"def",
"describe_application_versions",
"(",
"self",
",",
"application_name",
"=",
"None",
",",
"version_labels",
"=",
"None",
")",
":",
"params",
"=",
"{",
"}",
"if",
"application_name",
":",
"params",
"[",
"'ApplicationName'",
"]",
"=",
"application_name",
"if... | https://github.com/hanpfei/chromium-net/blob/392cc1fa3a8f92f42e4071ab6e674d8e0482f83f/third_party/catapult/third_party/gsutil/third_party/boto/boto/beanstalk/layer1.py#L466-L487 | |
yujinrobot/kobuki | 23748ed3dfb082831ca8eaaef1a0b08588dbcb65 | kobuki_auto_docking/scripts/DockDriveControl.py | python | Controller.__init__ | (self) | # initial values
external_power = DigitalOutput()
external_power.values = [ True, True, True, True ]
external_power.mask = [ True, True, True, True ]
digital_output = DigitalOutput()
digital_output.values = [ True, True, True, True ]
digital_output.mask = [ True, True, True, True ]
... | # initial values
external_power = DigitalOutput()
external_power.values = [ True, True, True, True ]
external_power.mask = [ True, True, True, True ]
digital_output = DigitalOutput()
digital_output.values = [ True, True, True, True ]
digital_output.mask = [ True, True, True, True ]
... | [
"#",
"initial",
"values",
"external_power",
"=",
"DigitalOutput",
"()",
"external_power",
".",
"values",
"=",
"[",
"True",
"True",
"True",
"True",
"]",
"external_power",
".",
"mask",
"=",
"[",
"True",
"True",
"True",
"True",
"]",
"digital_output",
"=",
"Digi... | def __init__(self):
#rospy initial setup
rospy.init_node("dock_drive_control")
rospy.on_shutdown(self.clearing)
rate = rospy.Rate(10)
self.message = "Idle"
self.publish_cmd_vel=False
self.cmd_vel=Twist()
self.sensors = SensorState()
self.dock_ir = DockInfraRed()
self.bat_name = ... | [
"def",
"__init__",
"(",
"self",
")",
":",
"#rospy initial setup",
"rospy",
".",
"init_node",
"(",
"\"dock_drive_control\"",
")",
"rospy",
".",
"on_shutdown",
"(",
"self",
".",
"clearing",
")",
"rate",
"=",
"rospy",
".",
"Rate",
"(",
"10",
")",
"self",
".",... | https://github.com/yujinrobot/kobuki/blob/23748ed3dfb082831ca8eaaef1a0b08588dbcb65/kobuki_auto_docking/scripts/DockDriveControl.py#L70-L166 | ||
microsoft/CNTK | e9396480025b9ca457d26b6f33dd07c474c6aa04 | bindings/python/cntk/ops/__init__.py | python | cosh | (x, name='') | return cosh(x, name) | Computes the element-wise cosh of ``x``:
The output tensor has the same shape as ``x``.
Example:
>>> np.round(C.cosh([[1,0.5],[-0.25,-0.75]]).eval(),5)
array([[ 1.54308, 1.12763],
[ 1.03141, 1.29468]], dtype=float32)
Args:
x: numpy array or any :class:`~cntk.ops.f... | Computes the element-wise cosh of ``x``: | [
"Computes",
"the",
"element",
"-",
"wise",
"cosh",
"of",
"x",
":"
] | def cosh(x, name=''):
'''
Computes the element-wise cosh of ``x``:
The output tensor has the same shape as ``x``.
Example:
>>> np.round(C.cosh([[1,0.5],[-0.25,-0.75]]).eval(),5)
array([[ 1.54308, 1.12763],
[ 1.03141, 1.29468]], dtype=float32)
Args:
x: nump... | [
"def",
"cosh",
"(",
"x",
",",
"name",
"=",
"''",
")",
":",
"from",
"cntk",
".",
"cntk_py",
"import",
"cosh",
"x",
"=",
"sanitize_input",
"(",
"x",
")",
"return",
"cosh",
"(",
"x",
",",
"name",
")"
] | https://github.com/microsoft/CNTK/blob/e9396480025b9ca457d26b6f33dd07c474c6aa04/bindings/python/cntk/ops/__init__.py#L1835-L1854 | |
hanpfei/chromium-net | 392cc1fa3a8f92f42e4071ab6e674d8e0482f83f | third_party/catapult/third_party/gsutil/third_party/httplib2/python2/httplib2/socks.py | python | socksocket.__negotiatehttp | (self, destaddr, destport) | __negotiatehttp(self,destaddr,destport)
Negotiates a connection through an HTTP server. | __negotiatehttp(self,destaddr,destport)
Negotiates a connection through an HTTP server. | [
"__negotiatehttp",
"(",
"self",
"destaddr",
"destport",
")",
"Negotiates",
"a",
"connection",
"through",
"an",
"HTTP",
"server",
"."
] | def __negotiatehttp(self, destaddr, destport):
"""__negotiatehttp(self,destaddr,destport)
Negotiates a connection through an HTTP server.
"""
# If we need to resolve locally, we do this now
if not self.__proxy[3]:
addr = socket.gethostbyname(destaddr)
else:
... | [
"def",
"__negotiatehttp",
"(",
"self",
",",
"destaddr",
",",
"destport",
")",
":",
"# If we need to resolve locally, we do this now",
"if",
"not",
"self",
".",
"__proxy",
"[",
"3",
"]",
":",
"addr",
"=",
"socket",
".",
"gethostbyname",
"(",
"destaddr",
")",
"e... | https://github.com/hanpfei/chromium-net/blob/392cc1fa3a8f92f42e4071ab6e674d8e0482f83f/third_party/catapult/third_party/gsutil/third_party/httplib2/python2/httplib2/socks.py#L358-L392 | ||
ArduPilot/ardupilot | 6e684b3496122b8158ac412b609d00004b7ac306 | libraries/SITL/examples/JSON/pybullet/robot.py | python | quaternion_from_AP | (q) | return [q.q[1], -q.q[2], -q.q[3], q.q[0]] | convert ArduPilot quaternion to pybullet quaternion | convert ArduPilot quaternion to pybullet quaternion | [
"convert",
"ArduPilot",
"quaternion",
"to",
"pybullet",
"quaternion"
] | def quaternion_from_AP(q):
'''convert ArduPilot quaternion to pybullet quaternion'''
return [q.q[1], -q.q[2], -q.q[3], q.q[0]] | [
"def",
"quaternion_from_AP",
"(",
"q",
")",
":",
"return",
"[",
"q",
".",
"q",
"[",
"1",
"]",
",",
"-",
"q",
".",
"q",
"[",
"2",
"]",
",",
"-",
"q",
".",
"q",
"[",
"3",
"]",
",",
"q",
".",
"q",
"[",
"0",
"]",
"]"
] | https://github.com/ArduPilot/ardupilot/blob/6e684b3496122b8158ac412b609d00004b7ac306/libraries/SITL/examples/JSON/pybullet/robot.py#L129-L131 | |
apache/mesos | 97d9a4063332aae3825d78de71611657e05cf5e2 | support/cpplint.py | python | _FunctionState.End | (self) | Stop analyzing function body. | Stop analyzing function body. | [
"Stop",
"analyzing",
"function",
"body",
"."
] | def End(self):
"""Stop analyzing function body."""
self.in_a_function = False | [
"def",
"End",
"(",
"self",
")",
":",
"self",
".",
"in_a_function",
"=",
"False"
] | https://github.com/apache/mesos/blob/97d9a4063332aae3825d78de71611657e05cf5e2/support/cpplint.py#L1092-L1094 | ||
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/linux_x64/lib/python3.7/turtle.py | python | TPen.pensize | (self, width=None) | Set or return the line thickness.
Aliases: pensize | width
Argument:
width -- positive number
Set the line thickness to width or return it. If resizemode is set
to "auto" and turtleshape is a polygon, that polygon is drawn with
the same line thickness. If no argument ... | Set or return the line thickness. | [
"Set",
"or",
"return",
"the",
"line",
"thickness",
"."
] | def pensize(self, width=None):
"""Set or return the line thickness.
Aliases: pensize | width
Argument:
width -- positive number
Set the line thickness to width or return it. If resizemode is set
to "auto" and turtleshape is a polygon, that polygon is drawn with
... | [
"def",
"pensize",
"(",
"self",
",",
"width",
"=",
"None",
")",
":",
"if",
"width",
"is",
"None",
":",
"return",
"self",
".",
"_pensize",
"self",
".",
"pen",
"(",
"pensize",
"=",
"width",
")"
] | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/linux_x64/lib/python3.7/turtle.py#L2072-L2092 | ||
wlanjie/AndroidFFmpeg | 7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf | tools/fdk-aac-build/armeabi/toolchain/lib/python2.7/SimpleHTTPServer.py | python | SimpleHTTPRequestHandler.guess_type | (self, path) | Guess the type of a file.
Argument is a PATH (a filename).
Return value is a string of the form type/subtype,
usable for a MIME Content-type header.
The default implementation looks the file's extension
up in the table self.extensions_map, using application/octet-stream
... | Guess the type of a file. | [
"Guess",
"the",
"type",
"of",
"a",
"file",
"."
] | def guess_type(self, path):
"""Guess the type of a file.
Argument is a PATH (a filename).
Return value is a string of the form type/subtype,
usable for a MIME Content-type header.
The default implementation looks the file's extension
up in the table self.extensions_map... | [
"def",
"guess_type",
"(",
"self",
",",
"path",
")",
":",
"base",
",",
"ext",
"=",
"posixpath",
".",
"splitext",
"(",
"path",
")",
"if",
"ext",
"in",
"self",
".",
"extensions_map",
":",
"return",
"self",
".",
"extensions_map",
"[",
"ext",
"]",
"ext",
... | https://github.com/wlanjie/AndroidFFmpeg/blob/7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf/tools/fdk-aac-build/armeabi/toolchain/lib/python2.7/SimpleHTTPServer.py#L179-L201 | ||
Polidea/SiriusObfuscator | b0e590d8130e97856afe578869b83a209e2b19be | SymbolExtractorAndRenamer/lldb/scripts/Python/static-binding/lldb.py | python | SBTypeFilter.IsEqualTo | (self, *args) | return _lldb.SBTypeFilter_IsEqualTo(self, *args) | IsEqualTo(self, SBTypeFilter rhs) -> bool | IsEqualTo(self, SBTypeFilter rhs) -> bool | [
"IsEqualTo",
"(",
"self",
"SBTypeFilter",
"rhs",
")",
"-",
">",
"bool"
] | def IsEqualTo(self, *args):
"""IsEqualTo(self, SBTypeFilter rhs) -> bool"""
return _lldb.SBTypeFilter_IsEqualTo(self, *args) | [
"def",
"IsEqualTo",
"(",
"self",
",",
"*",
"args",
")",
":",
"return",
"_lldb",
".",
"SBTypeFilter_IsEqualTo",
"(",
"self",
",",
"*",
"args",
")"
] | https://github.com/Polidea/SiriusObfuscator/blob/b0e590d8130e97856afe578869b83a209e2b19be/SymbolExtractorAndRenamer/lldb/scripts/Python/static-binding/lldb.py#L11107-L11109 | |
hughperkins/tf-coriander | 970d3df6c11400ad68405f22b0c42a52374e94ca | tensorflow/python/training/adadelta.py | python | AdadeltaOptimizer.__init__ | (self, learning_rate=0.001, rho=0.95, epsilon=1e-8,
use_locking=False, name="Adadelta") | Construct a new Adadelta optimizer.
Args:
learning_rate: A `Tensor` or a floating point value. The learning rate.
rho: A `Tensor` or a floating point value. The decay rate.
epsilon: A `Tensor` or a floating point value. A constant epsilon used
to better conditioning the grad updat... | Construct a new Adadelta optimizer. | [
"Construct",
"a",
"new",
"Adadelta",
"optimizer",
"."
] | def __init__(self, learning_rate=0.001, rho=0.95, epsilon=1e-8,
use_locking=False, name="Adadelta"):
"""Construct a new Adadelta optimizer.
Args:
learning_rate: A `Tensor` or a floating point value. The learning rate.
rho: A `Tensor` or a floating point value. The decay rate.
e... | [
"def",
"__init__",
"(",
"self",
",",
"learning_rate",
"=",
"0.001",
",",
"rho",
"=",
"0.95",
",",
"epsilon",
"=",
"1e-8",
",",
"use_locking",
"=",
"False",
",",
"name",
"=",
"\"Adadelta\"",
")",
":",
"super",
"(",
"AdadeltaOptimizer",
",",
"self",
")",
... | https://github.com/hughperkins/tf-coriander/blob/970d3df6c11400ad68405f22b0c42a52374e94ca/tensorflow/python/training/adadelta.py#L36-L57 | ||
kismetwireless/kismet | a7c0dc270c960fb1f58bd9cec4601c201885fd4e | capture_sdr_rtladsb/KismetCaptureRtladsb/__init__.py | python | KismetRtladsb.adsb_msg_get_airborne_velocity | (self, data) | return velocity | Airborne velocity from message 17, synthesized from EW/NS velocities | Airborne velocity from message 17, synthesized from EW/NS velocities | [
"Airborne",
"velocity",
"from",
"message",
"17",
"synthesized",
"from",
"EW",
"/",
"NS",
"velocities"
] | def adsb_msg_get_airborne_velocity(self, data):
"""
Airborne velocity from message 17, synthesized from EW/NS velocities
"""
ew_dir = (data[5] & 4) >> 2
ew_velocity = ((data[5] & 3) << 8) | data[6]
ns_dir = (data[7] & 0x80) >> 7
ns_velocity = ((data[7] & 0x7f... | [
"def",
"adsb_msg_get_airborne_velocity",
"(",
"self",
",",
"data",
")",
":",
"ew_dir",
"=",
"(",
"data",
"[",
"5",
"]",
"&",
"4",
")",
">>",
"2",
"ew_velocity",
"=",
"(",
"(",
"data",
"[",
"5",
"]",
"&",
"3",
")",
"<<",
"8",
")",
"|",
"data",
"... | https://github.com/kismetwireless/kismet/blob/a7c0dc270c960fb1f58bd9cec4601c201885fd4e/capture_sdr_rtladsb/KismetCaptureRtladsb/__init__.py#L878-L891 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/linux_x64/lib/python3.7/site-packages/pkg_resources/_vendor/pyparsing.py | python | ParseResults.getName | (self) | r"""
Returns the results name for this token expression. Useful when several
different expressions might match at a particular location.
Example::
integer = Word(nums)
ssn_expr = Regex(r"\d\d\d-\d\d-\d\d\d\d")
house_number_expr = Suppress('#') + Word(... | r""" | [
"r"
] | def getName(self):
r"""
Returns the results name for this token expression. Useful when several
different expressions might match at a particular location.
Example::
integer = Word(nums)
ssn_expr = Regex(r"\d\d\d-\d\d-\d\d\d\d")
house_number_... | [
"def",
"getName",
"(",
"self",
")",
":",
"if",
"self",
".",
"__name",
":",
"return",
"self",
".",
"__name",
"elif",
"self",
".",
"__parent",
":",
"par",
"=",
"self",
".",
"__parent",
"(",
")",
"if",
"par",
":",
"return",
"par",
".",
"__lookup",
"("... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/linux_x64/lib/python3.7/site-packages/pkg_resources/_vendor/pyparsing.py#L1667-L1737 | ||
hughperkins/tf-coriander | 970d3df6c11400ad68405f22b0c42a52374e94ca | tensorflow/python/ops/rnn_cell.py | python | BasicRNNCell.__call__ | (self, inputs, state, scope=None) | return output, output | Most basic RNN: output = new_state = activation(W * input + U * state + B). | Most basic RNN: output = new_state = activation(W * input + U * state + B). | [
"Most",
"basic",
"RNN",
":",
"output",
"=",
"new_state",
"=",
"activation",
"(",
"W",
"*",
"input",
"+",
"U",
"*",
"state",
"+",
"B",
")",
"."
] | def __call__(self, inputs, state, scope=None):
"""Most basic RNN: output = new_state = activation(W * input + U * state + B)."""
with vs.variable_scope(scope or type(self).__name__): # "BasicRNNCell"
output = self._activation(_linear([inputs, state], self._num_units, True))
return output, output | [
"def",
"__call__",
"(",
"self",
",",
"inputs",
",",
"state",
",",
"scope",
"=",
"None",
")",
":",
"with",
"vs",
".",
"variable_scope",
"(",
"scope",
"or",
"type",
"(",
"self",
")",
".",
"__name__",
")",
":",
"# \"BasicRNNCell\"",
"output",
"=",
"self",... | https://github.com/hughperkins/tf-coriander/blob/970d3df6c11400ad68405f22b0c42a52374e94ca/tensorflow/python/ops/rnn_cell.py#L197-L201 | |
OSGeo/gdal | 3748fc4ba4fba727492774b2b908a2130c864a83 | swig/python/osgeo/osr.py | python | SpatialReference.SetGeogCS | (self, *args) | return _osr.SpatialReference_SetGeogCS(self, *args) | r"""SetGeogCS(SpatialReference self, char const * pszGeogName, char const * pszDatumName, char const * pszEllipsoidName, double dfSemiMajor, double dfInvFlattening, char const * pszPMName="Greenwich", double dfPMOffset=0.0, char const * pszUnits="degree", double dfConvertToRadians=0.0174532925199433) -> OGRErr | r"""SetGeogCS(SpatialReference self, char const * pszGeogName, char const * pszDatumName, char const * pszEllipsoidName, double dfSemiMajor, double dfInvFlattening, char const * pszPMName="Greenwich", double dfPMOffset=0.0, char const * pszUnits="degree", double dfConvertToRadians=0.0174532925199433) -> OGRErr | [
"r",
"SetGeogCS",
"(",
"SpatialReference",
"self",
"char",
"const",
"*",
"pszGeogName",
"char",
"const",
"*",
"pszDatumName",
"char",
"const",
"*",
"pszEllipsoidName",
"double",
"dfSemiMajor",
"double",
"dfInvFlattening",
"char",
"const",
"*",
"pszPMName",
"=",
"G... | def SetGeogCS(self, *args):
r"""SetGeogCS(SpatialReference self, char const * pszGeogName, char const * pszDatumName, char const * pszEllipsoidName, double dfSemiMajor, double dfInvFlattening, char const * pszPMName="Greenwich", double dfPMOffset=0.0, char const * pszUnits="degree", double dfConvertToRadians=0.... | [
"def",
"SetGeogCS",
"(",
"self",
",",
"*",
"args",
")",
":",
"return",
"_osr",
".",
"SpatialReference_SetGeogCS",
"(",
"self",
",",
"*",
"args",
")"
] | https://github.com/OSGeo/gdal/blob/3748fc4ba4fba727492774b2b908a2130c864a83/swig/python/osgeo/osr.py#L734-L736 | |
pmq20/node-packer | 12c46c6e44fbc14d9ee645ebd17d5296b324f7e0 | current/deps/v8/tools/sanitizers/sancov_merger.py | python | generate_inputs | (keep, coverage_dir, file_map, cpus) | return inputs | Generate inputs for multiprocessed merging.
Splits the sancov files into several buckets, so that each bucket can be
merged in a separate process. We have only few executables in total with
mostly lots of associated files. In the general case, with many executables
we might need to avoid splitting buckets of e... | Generate inputs for multiprocessed merging. | [
"Generate",
"inputs",
"for",
"multiprocessed",
"merging",
"."
] | def generate_inputs(keep, coverage_dir, file_map, cpus):
"""Generate inputs for multiprocessed merging.
Splits the sancov files into several buckets, so that each bucket can be
merged in a separate process. We have only few executables in total with
mostly lots of associated files. In the general case, with ma... | [
"def",
"generate_inputs",
"(",
"keep",
",",
"coverage_dir",
",",
"file_map",
",",
"cpus",
")",
":",
"inputs",
"=",
"[",
"]",
"for",
"executable",
",",
"files",
"in",
"file_map",
".",
"iteritems",
"(",
")",
":",
"# What's the bucket size for distributing files fo... | https://github.com/pmq20/node-packer/blob/12c46c6e44fbc14d9ee645ebd17d5296b324f7e0/current/deps/v8/tools/sanitizers/sancov_merger.py#L92-L116 | |
cms-sw/cmssw | fd9de012d503d3405420bcbeec0ec879baa57cf2 | Validation/RecoTau/python/RecoTauValidation_cfi.py | python | SetYmodulesToLog | (matchingNames = []) | return yLogger | set all modules whose name contains one of the matching names to log y scale | set all modules whose name contains one of the matching names to log y scale | [
"set",
"all",
"modules",
"whose",
"name",
"contains",
"one",
"of",
"the",
"matching",
"names",
"to",
"log",
"y",
"scale"
] | def SetYmodulesToLog(matchingNames = []):
''' set all modules whose name contains one of the matching names to log y scale'''
def yLogger(module):
''' set a module to use log scaling in the yAxis'''
if hasattr(module, 'drawJobs'):
print("EK DEBUG")
drawJobParamGetter = lambda subName... | [
"def",
"SetYmodulesToLog",
"(",
"matchingNames",
"=",
"[",
"]",
")",
":",
"def",
"yLogger",
"(",
"module",
")",
":",
"''' set a module to use log scaling in the yAxis'''",
"if",
"hasattr",
"(",
"module",
",",
"'drawJobs'",
")",
":",
"print",
"(",
"\"EK DEBUG\"",
... | https://github.com/cms-sw/cmssw/blob/fd9de012d503d3405420bcbeec0ec879baa57cf2/Validation/RecoTau/python/RecoTauValidation_cfi.py#L505-L524 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Gems/CloudGemMetric/v1/AWS/python/windows/Lib/numba/targets/npyimpl.py | python | _prepare_argument | (ctxt, bld, inp, tyinp, where='input operand') | returns an instance of the appropriate Helper (either
_ScalarHelper or _ArrayHelper) class to handle the argument.
using the polymorphic interface of the Helper classes, scalar
and array cases can be handled with the same code | returns an instance of the appropriate Helper (either
_ScalarHelper or _ArrayHelper) class to handle the argument.
using the polymorphic interface of the Helper classes, scalar
and array cases can be handled with the same code | [
"returns",
"an",
"instance",
"of",
"the",
"appropriate",
"Helper",
"(",
"either",
"_ScalarHelper",
"or",
"_ArrayHelper",
")",
"class",
"to",
"handle",
"the",
"argument",
".",
"using",
"the",
"polymorphic",
"interface",
"of",
"the",
"Helper",
"classes",
"scalar",... | def _prepare_argument(ctxt, bld, inp, tyinp, where='input operand'):
"""returns an instance of the appropriate Helper (either
_ScalarHelper or _ArrayHelper) class to handle the argument.
using the polymorphic interface of the Helper classes, scalar
and array cases can be handled with the same code"""
... | [
"def",
"_prepare_argument",
"(",
"ctxt",
",",
"bld",
",",
"inp",
",",
"tyinp",
",",
"where",
"=",
"'input operand'",
")",
":",
"# first un-Optional Optionals",
"if",
"isinstance",
"(",
"tyinp",
",",
"types",
".",
"Optional",
")",
":",
"oty",
"=",
"tyinp",
... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Gems/CloudGemMetric/v1/AWS/python/windows/Lib/numba/targets/npyimpl.py#L160-L182 | ||
domino-team/openwrt-cc | 8b181297c34d14d3ca521cc9f31430d561dbc688 | package/gli-pub/openwrt-node-packages-master/node/node-v6.9.1/deps/v8_inspector/third_party/jinja2/jinja2/parser.py | python | Parser.parse_for | (self) | return nodes.For(target, iter, body, else_, test,
recursive, lineno=lineno) | Parse a for loop. | Parse a for loop. | [
"Parse",
"a",
"for",
"loop",
"."
] | def parse_for(self):
"""Parse a for loop."""
lineno = self.stream.expect('name:for').lineno
target = self.parse_assign_target(extra_end_rules=('name:in',))
self.stream.expect('name:in')
iter = self.parse_tuple(with_condexpr=False,
extra_end_rules=(... | [
"def",
"parse_for",
"(",
"self",
")",
":",
"lineno",
"=",
"self",
".",
"stream",
".",
"expect",
"(",
"'name:for'",
")",
".",
"lineno",
"target",
"=",
"self",
".",
"parse_assign_target",
"(",
"extra_end_rules",
"=",
"(",
"'name:in'",
",",
")",
")",
"self"... | https://github.com/domino-team/openwrt-cc/blob/8b181297c34d14d3ca521cc9f31430d561dbc688/package/gli-pub/openwrt-node-packages-master/node/node-v6.9.1/deps/v8_inspector/third_party/jinja2/jinja2/parser.py#L178-L195 | |
LisaAnne/lisa-caffe-public | 49b8643ddef23a4f6120017968de30c45e693f59 | tools/extra/resize_and_crop_images.py | python | OpenCVResizeCrop.resize_and_crop_image | (self, input_file, output_file, output_side_length = 256) | Takes an image name, resize it and crop the center square | Takes an image name, resize it and crop the center square | [
"Takes",
"an",
"image",
"name",
"resize",
"it",
"and",
"crop",
"the",
"center",
"square"
] | def resize_and_crop_image(self, input_file, output_file, output_side_length = 256):
'''Takes an image name, resize it and crop the center square
'''
img = cv2.imread(input_file)
height, width, depth = img.shape
new_height = output_side_length
new_width = output_side_lengt... | [
"def",
"resize_and_crop_image",
"(",
"self",
",",
"input_file",
",",
"output_file",
",",
"output_side_length",
"=",
"256",
")",
":",
"img",
"=",
"cv2",
".",
"imread",
"(",
"input_file",
")",
"height",
",",
"width",
",",
"depth",
"=",
"img",
".",
"shape",
... | https://github.com/LisaAnne/lisa-caffe-public/blob/49b8643ddef23a4f6120017968de30c45e693f59/tools/extra/resize_and_crop_images.py#L20-L36 | ||
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | wx/lib/agw/aquabutton.py | python | AquaButtonEvent.SetButtonObj | (self, btn) | Sets the event object for the event.
:param `btn`: the button object, an instance of :class:`AquaButton`. | Sets the event object for the event. | [
"Sets",
"the",
"event",
"object",
"for",
"the",
"event",
"."
] | def SetButtonObj(self, btn):
"""
Sets the event object for the event.
:param `btn`: the button object, an instance of :class:`AquaButton`.
"""
self.theButton = btn | [
"def",
"SetButtonObj",
"(",
"self",
",",
"btn",
")",
":",
"self",
".",
"theButton",
"=",
"btn"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/wx/lib/agw/aquabutton.py#L134-L141 | ||
adobe/chromium | cfe5bf0b51b1f6b9fe239c2a3c2f2364da9967d7 | third_party/protobuf/python/mox.py | python | Or.equals | (self, rhs) | return False | Checks whether any Comparator is equal to rhs.
Args:
# rhs: can be anything
Returns:
bool | Checks whether any Comparator is equal to rhs. | [
"Checks",
"whether",
"any",
"Comparator",
"is",
"equal",
"to",
"rhs",
"."
] | def equals(self, rhs):
"""Checks whether any Comparator is equal to rhs.
Args:
# rhs: can be anything
Returns:
bool
"""
for comparator in self._comparators:
if comparator.equals(rhs):
return True
return False | [
"def",
"equals",
"(",
"self",
",",
"rhs",
")",
":",
"for",
"comparator",
"in",
"self",
".",
"_comparators",
":",
"if",
"comparator",
".",
"equals",
"(",
"rhs",
")",
":",
"return",
"True",
"return",
"False"
] | https://github.com/adobe/chromium/blob/cfe5bf0b51b1f6b9fe239c2a3c2f2364da9967d7/third_party/protobuf/python/mox.py#L1092-L1106 | |
miyosuda/TensorFlowAndroidMNIST | 7b5a4603d2780a8a2834575706e9001977524007 | jni-build/jni/include/tensorflow/python/ops/script_ops.py | python | FuncRegistry.size | (self) | return len(self._funcs) | Returns how many functions are currently registered. | Returns how many functions are currently registered. | [
"Returns",
"how",
"many",
"functions",
"are",
"currently",
"registered",
"."
] | def size(self):
"""Returns how many functions are currently registered."""
return len(self._funcs) | [
"def",
"size",
"(",
"self",
")",
":",
"return",
"len",
"(",
"self",
".",
"_funcs",
")"
] | https://github.com/miyosuda/TensorFlowAndroidMNIST/blob/7b5a4603d2780a8a2834575706e9001977524007/jni-build/jni/include/tensorflow/python/ops/script_ops.py#L89-L91 | |
apple/turicreate | cce55aa5311300e3ce6af93cb45ba791fd1bdf49 | src/python/turicreate/util/_cloudpickle/_cloudpickle_fast.py | python | _file_reduce | (obj) | return _file_reconstructor, (retval,) | Save a file | Save a file | [
"Save",
"a",
"file"
] | def _file_reduce(obj):
"""Save a file"""
import io
if not hasattr(obj, "name") or not hasattr(obj, "mode"):
raise pickle.PicklingError(
"Cannot pickle files that do not map to an actual file"
)
if obj is sys.stdout:
return getattr, (sys, "stdout")
if obj is sys.s... | [
"def",
"_file_reduce",
"(",
"obj",
")",
":",
"import",
"io",
"if",
"not",
"hasattr",
"(",
"obj",
",",
"\"name\"",
")",
"or",
"not",
"hasattr",
"(",
"obj",
",",
"\"mode\"",
")",
":",
"raise",
"pickle",
".",
"PicklingError",
"(",
"\"Cannot pickle files that ... | https://github.com/apple/turicreate/blob/cce55aa5311300e3ce6af93cb45ba791fd1bdf49/src/python/turicreate/util/_cloudpickle/_cloudpickle_fast.py#L319-L363 | |
swift/swift | 12d031cf8177fdec0137f9aa7e2912fa23c4416b | 3rdParty/SCons/scons-3.0.1/engine/SCons/Script/SConsOptions.py | python | SConsOptionGroup.format_help | (self, formatter) | return result | Format an option group's help text, outdenting the title so it's
flush with the "SCons Options" title we print at the top. | Format an option group's help text, outdenting the title so it's
flush with the "SCons Options" title we print at the top. | [
"Format",
"an",
"option",
"group",
"s",
"help",
"text",
"outdenting",
"the",
"title",
"so",
"it",
"s",
"flush",
"with",
"the",
"SCons",
"Options",
"title",
"we",
"print",
"at",
"the",
"top",
"."
] | def format_help(self, formatter):
"""
Format an option group's help text, outdenting the title so it's
flush with the "SCons Options" title we print at the top.
"""
formatter.dedent()
result = formatter.format_heading(self.title)
formatter.indent()
result ... | [
"def",
"format_help",
"(",
"self",
",",
"formatter",
")",
":",
"formatter",
".",
"dedent",
"(",
")",
"result",
"=",
"formatter",
".",
"format_heading",
"(",
"self",
".",
"title",
")",
"formatter",
".",
"indent",
"(",
")",
"result",
"=",
"result",
"+",
... | https://github.com/swift/swift/blob/12d031cf8177fdec0137f9aa7e2912fa23c4416b/3rdParty/SCons/scons-3.0.1/engine/SCons/Script/SConsOptions.py#L270-L279 | |
tensorflow/tensorflow | 419e3a6b650ea4bd1b0cba23c4348f8a69f3272e | tensorflow/python/saved_model/function_serialization.py | python | _serialize_function_spec | (function_spec) | return proto | Serialize a FunctionSpec object into its proto representation. | Serialize a FunctionSpec object into its proto representation. | [
"Serialize",
"a",
"FunctionSpec",
"object",
"into",
"its",
"proto",
"representation",
"."
] | def _serialize_function_spec(function_spec):
"""Serialize a FunctionSpec object into its proto representation."""
if function_spec.is_method and not function_spec.fullargspec.args:
raise NotImplementedError(
"Cannot serialize a method function without a named "
"'self' argument.")
proto = save... | [
"def",
"_serialize_function_spec",
"(",
"function_spec",
")",
":",
"if",
"function_spec",
".",
"is_method",
"and",
"not",
"function_spec",
".",
"fullargspec",
".",
"args",
":",
"raise",
"NotImplementedError",
"(",
"\"Cannot serialize a method function without a named \"",
... | https://github.com/tensorflow/tensorflow/blob/419e3a6b650ea4bd1b0cba23c4348f8a69f3272e/tensorflow/python/saved_model/function_serialization.py#L25-L53 | |
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/tools/python3/src/Lib/telnetlib.py | python | Telnet.read_some | (self) | return buf | Read at least one byte of cooked data unless EOF is hit.
Return b'' if EOF is hit. Block if no data is immediately
available. | Read at least one byte of cooked data unless EOF is hit. | [
"Read",
"at",
"least",
"one",
"byte",
"of",
"cooked",
"data",
"unless",
"EOF",
"is",
"hit",
"."
] | def read_some(self):
"""Read at least one byte of cooked data unless EOF is hit.
Return b'' if EOF is hit. Block if no data is immediately
available.
"""
self.process_rawq()
while not self.cookedq and not self.eof:
self.fill_rawq()
self.process_... | [
"def",
"read_some",
"(",
"self",
")",
":",
"self",
".",
"process_rawq",
"(",
")",
"while",
"not",
"self",
".",
"cookedq",
"and",
"not",
"self",
".",
"eof",
":",
"self",
".",
"fill_rawq",
"(",
")",
"self",
".",
"process_rawq",
"(",
")",
"buf",
"=",
... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/tools/python3/src/Lib/telnetlib.py#L341-L354 | |
ApolloAuto/apollo-platform | 86d9dc6743b496ead18d597748ebabd34a513289 | ros/ros_comm/rospy/src/rospy/impl/tcpros_base.py | python | TCPROSTransport.send_message | (self, msg, seq) | Convenience routine for services to send a message across a
particular connection. NOTE: write_data is much more efficient
if same message is being sent to multiple connections. Not
threadsafe.
@param msg: message to send
@type msg: Msg
@param seq: sequence number for me... | Convenience routine for services to send a message across a
particular connection. NOTE: write_data is much more efficient
if same message is being sent to multiple connections. Not
threadsafe. | [
"Convenience",
"routine",
"for",
"services",
"to",
"send",
"a",
"message",
"across",
"a",
"particular",
"connection",
".",
"NOTE",
":",
"write_data",
"is",
"much",
"more",
"efficient",
"if",
"same",
"message",
"is",
"being",
"sent",
"to",
"multiple",
"connecti... | def send_message(self, msg, seq):
"""
Convenience routine for services to send a message across a
particular connection. NOTE: write_data is much more efficient
if same message is being sent to multiple connections. Not
threadsafe.
@param msg: message to send
@typ... | [
"def",
"send_message",
"(",
"self",
",",
"msg",
",",
"seq",
")",
":",
"# this will call write_data(), so no need to keep track of stats",
"serialize_message",
"(",
"self",
".",
"write_buff",
",",
"seq",
",",
"msg",
")",
"self",
".",
"write_data",
"(",
"self",
".",... | https://github.com/ApolloAuto/apollo-platform/blob/86d9dc6743b496ead18d597748ebabd34a513289/ros/ros_comm/rospy/src/rospy/impl/tcpros_base.py#L626-L641 | ||
mongodb/mongo | d8ff665343ad29cf286ee2cf4a1960d29371937b | buildscripts/resmokelib/utils/jscomment.py | python | _strip_jscomments | (string) | return "\n".join(yaml_lines) | Strip JS comments from a 'string'.
Given a string 'string' that represents the contents after the "@tags:"
annotation in the JS file, this function returns a string that can
be converted to YAML.
e.g.
[ "tag1", # double quoted
* 'tag2' # single quoted
* # line with... | Strip JS comments from a 'string'. | [
"Strip",
"JS",
"comments",
"from",
"a",
"string",
"."
] | def _strip_jscomments(string):
"""Strip JS comments from a 'string'.
Given a string 'string' that represents the contents after the "@tags:"
annotation in the JS file, this function returns a string that can
be converted to YAML.
e.g.
[ "tag1", # double quoted
* 'tag2' # single... | [
"def",
"_strip_jscomments",
"(",
"string",
")",
":",
"yaml_lines",
"=",
"[",
"]",
"if",
"isinstance",
"(",
"string",
",",
"bytes",
")",
":",
"string",
"=",
"string",
".",
"decode",
"(",
"\"utf-8\"",
")",
"for",
"line",
"in",
"string",
".",
"splitlines",
... | https://github.com/mongodb/mongo/blob/d8ff665343ad29cf286ee2cf4a1960d29371937b/buildscripts/resmokelib/utils/jscomment.py#L47-L77 | |
snap-stanford/snap-python | d53c51b0a26aa7e3e7400b014cdf728948fde80a | setup/snap.py | python | TIntH.IsAutoSize | (self) | return _snap.TIntH_IsAutoSize(self) | IsAutoSize(TIntH self) -> bool
Parameters:
self: THash< TInt,TInt > const * | IsAutoSize(TIntH self) -> bool | [
"IsAutoSize",
"(",
"TIntH",
"self",
")",
"-",
">",
"bool"
] | def IsAutoSize(self):
"""
IsAutoSize(TIntH self) -> bool
Parameters:
self: THash< TInt,TInt > const *
"""
return _snap.TIntH_IsAutoSize(self) | [
"def",
"IsAutoSize",
"(",
"self",
")",
":",
"return",
"_snap",
".",
"TIntH_IsAutoSize",
"(",
"self",
")"
] | https://github.com/snap-stanford/snap-python/blob/d53c51b0a26aa7e3e7400b014cdf728948fde80a/setup/snap.py#L18494-L18502 | |
hwwang55/DKN | 90a188021a82ddaadffc44f6d87e1e72b1c3db9a | data/news/news_preprocess.py | python | construct_word2id_and_entity2id | () | Allocate each valid word and entity a unique index (start from 1)
:return: None | Allocate each valid word and entity a unique index (start from 1)
:return: None | [
"Allocate",
"each",
"valid",
"word",
"and",
"entity",
"a",
"unique",
"index",
"(",
"start",
"from",
"1",
")",
":",
"return",
":",
"None"
] | def construct_word2id_and_entity2id():
"""
Allocate each valid word and entity a unique index (start from 1)
:return: None
"""
cnt = 1 # 0 is for dummy word
for w, freq in word2freq.items():
if freq >= WORD_FREQ_THRESHOLD:
word2index[w] = cnt
cnt += 1
print('... | [
"def",
"construct_word2id_and_entity2id",
"(",
")",
":",
"cnt",
"=",
"1",
"# 0 is for dummy word",
"for",
"w",
",",
"freq",
"in",
"word2freq",
".",
"items",
"(",
")",
":",
"if",
"freq",
">=",
"WORD_FREQ_THRESHOLD",
":",
"word2index",
"[",
"w",
"]",
"=",
"c... | https://github.com/hwwang55/DKN/blob/90a188021a82ddaadffc44f6d87e1e72b1c3db9a/data/news/news_preprocess.py#L52-L72 | ||
vnpy/vnpy | f50f2535ed39dd33272e0985ed40c7078e4c19f6 | vnpy/trader/ui/widget.py | python | BaseCell.set_content | (self, content: Any, data: Any) | Set text content. | Set text content. | [
"Set",
"text",
"content",
"."
] | def set_content(self, content: Any, data: Any) -> None:
"""
Set text content.
"""
self.setText(str(content))
self._data = data | [
"def",
"set_content",
"(",
"self",
",",
"content",
":",
"Any",
",",
"data",
":",
"Any",
")",
"->",
"None",
":",
"self",
".",
"setText",
"(",
"str",
"(",
"content",
")",
")",
"self",
".",
"_data",
"=",
"data"
] | https://github.com/vnpy/vnpy/blob/f50f2535ed39dd33272e0985ed40c7078e4c19f6/vnpy/trader/ui/widget.py#L51-L56 | ||
baidu-research/tensorflow-allreduce | 66d5b855e90b0949e9fa5cca5599fd729a70e874 | tensorflow/python/ops/control_flow_ops.py | python | ControlFlowContext._RemoveExternalControlEdges | (self, op) | return internal_control_inputs | Remove any external control dependency on this op. | Remove any external control dependency on this op. | [
"Remove",
"any",
"external",
"control",
"dependency",
"on",
"this",
"op",
"."
] | def _RemoveExternalControlEdges(self, op):
"""Remove any external control dependency on this op."""
while_ctxt = self.GetWhileContext()
# A control input of `op` is internal if it is in the same while
# loop context as the enclosing while loop context of self.
if while_ctxt is None:
internal_c... | [
"def",
"_RemoveExternalControlEdges",
"(",
"self",
",",
"op",
")",
":",
"while_ctxt",
"=",
"self",
".",
"GetWhileContext",
"(",
")",
"# A control input of `op` is internal if it is in the same while",
"# loop context as the enclosing while loop context of self.",
"if",
"while_ctx... | https://github.com/baidu-research/tensorflow-allreduce/blob/66d5b855e90b0949e9fa5cca5599fd729a70e874/tensorflow/python/ops/control_flow_ops.py#L1456-L1472 | |
microsoft/ivy | 9f3c7ecc0b2383129fdd0953e10890d98d09a82d | ivy/concept_interactive_session.py | python | ConceptInteractiveSession.get_projections | (self, node) | return result | Return a list of (name, binary_concept) with all possible
projections at node | Return a list of (name, binary_concept) with all possible
projections at node | [
"Return",
"a",
"list",
"of",
"(",
"name",
"binary_concept",
")",
"with",
"all",
"possible",
"projections",
"at",
"node"
] | def get_projections(self, node):
"""
Return a list of (name, binary_concept) with all possible
projections at node
"""
witnesses = self._get_witnesses(node)
if len(witnesses) == 0:
return []
w = witnesses[0]
result = []
n_concept = sel... | [
"def",
"get_projections",
"(",
"self",
",",
"node",
")",
":",
"witnesses",
"=",
"self",
".",
"_get_witnesses",
"(",
"node",
")",
"if",
"len",
"(",
"witnesses",
")",
"==",
"0",
":",
"return",
"[",
"]",
"w",
"=",
"witnesses",
"[",
"0",
"]",
"result",
... | https://github.com/microsoft/ivy/blob/9f3c7ecc0b2383129fdd0953e10890d98d09a82d/ivy/concept_interactive_session.py#L299-L320 | |
google/tink | 59bb34495d1cb8f9d9dbc0f0a52c4f9e21491a14 | python/tink/streaming_aead/_streaming_aead_wrapper.py | python | _DecryptingStreamWrapper.readinto | (self, b: bytearray) | return n | Read bytes into a pre-allocated bytes-like object b. | Read bytes into a pre-allocated bytes-like object b. | [
"Read",
"bytes",
"into",
"a",
"pre",
"-",
"allocated",
"bytes",
"-",
"like",
"object",
"b",
"."
] | def readinto(self, b: bytearray) -> Optional[int]:
"""Read bytes into a pre-allocated bytes-like object b."""
data = self.read(len(b))
if data is None:
return None
n = len(data)
b[:n] = data
return n | [
"def",
"readinto",
"(",
"self",
",",
"b",
":",
"bytearray",
")",
"->",
"Optional",
"[",
"int",
"]",
":",
"data",
"=",
"self",
".",
"read",
"(",
"len",
"(",
"b",
")",
")",
"if",
"data",
"is",
"None",
":",
"return",
"None",
"n",
"=",
"len",
"(",
... | https://github.com/google/tink/blob/59bb34495d1cb8f9d9dbc0f0a52c4f9e21491a14/python/tink/streaming_aead/_streaming_aead_wrapper.py#L111-L118 | |
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/pandas/py3/pandas/core/arrays/_mixins.py | python | NDArrayBackedExtensionArray._box_func | (self, x) | return x | Wrap numpy type in our dtype.type if necessary. | Wrap numpy type in our dtype.type if necessary. | [
"Wrap",
"numpy",
"type",
"in",
"our",
"dtype",
".",
"type",
"if",
"necessary",
"."
] | def _box_func(self, x):
"""
Wrap numpy type in our dtype.type if necessary.
"""
return x | [
"def",
"_box_func",
"(",
"self",
",",
"x",
")",
":",
"return",
"x"
] | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/pandas/py3/pandas/core/arrays/_mixins.py#L76-L80 | |
weolar/miniblink49 | 1c4678db0594a4abde23d3ebbcc7cd13c3170777 | third_party/WebKit/Tools/Scripts/webkitpy/thirdparty/BeautifulSoup.py | python | NavigableString.__getattr__ | (self, attr) | text.string gives you text. This is for backwards
compatibility for Navigable*String, but for CData* it lets you
get the string without the CData wrapper. | text.string gives you text. This is for backwards
compatibility for Navigable*String, but for CData* it lets you
get the string without the CData wrapper. | [
"text",
".",
"string",
"gives",
"you",
"text",
".",
"This",
"is",
"for",
"backwards",
"compatibility",
"for",
"Navigable",
"*",
"String",
"but",
"for",
"CData",
"*",
"it",
"lets",
"you",
"get",
"the",
"string",
"without",
"the",
"CData",
"wrapper",
"."
] | def __getattr__(self, attr):
"""text.string gives you text. This is for backwards
compatibility for Navigable*String, but for CData* it lets you
get the string without the CData wrapper."""
if attr == 'string':
return self
else:
raise AttributeError, "'%s'... | [
"def",
"__getattr__",
"(",
"self",
",",
"attr",
")",
":",
"if",
"attr",
"==",
"'string'",
":",
"return",
"self",
"else",
":",
"raise",
"AttributeError",
",",
"\"'%s' object has no attribute '%s'\"",
"%",
"(",
"self",
".",
"__class__",
".",
"__name__",
",",
"... | https://github.com/weolar/miniblink49/blob/1c4678db0594a4abde23d3ebbcc7cd13c3170777/third_party/WebKit/Tools/Scripts/webkitpy/thirdparty/BeautifulSoup.py#L441-L448 | ||
vnpy/vnpy | f50f2535ed39dd33272e0985ed40c7078e4c19f6 | vnpy/trader/engine.py | python | LogEngine.process_log_event | (self, event: Event) | Process log event. | Process log event. | [
"Process",
"log",
"event",
"."
] | def process_log_event(self, event: Event) -> None:
"""
Process log event.
"""
log = event.data
self.logger.log(log.level, log.msg) | [
"def",
"process_log_event",
"(",
"self",
",",
"event",
":",
"Event",
")",
"->",
"None",
":",
"log",
"=",
"event",
".",
"data",
"self",
".",
"logger",
".",
"log",
"(",
"log",
".",
"level",
",",
"log",
".",
"msg",
")"
] | https://github.com/vnpy/vnpy/blob/f50f2535ed39dd33272e0985ed40c7078e4c19f6/vnpy/trader/engine.py#L328-L333 | ||
oracle/graaljs | 36a56e8e993d45fc40939a3a4d9c0c24990720f1 | graal-nodejs/tools/gyp/pylib/gyp/xcode_emulation.py | python | XcodeSettings.GetWrapperExtension | (self) | Returns the bundle extension (.app, .framework, .plugin, etc). Only
valid for bundles. | Returns the bundle extension (.app, .framework, .plugin, etc). Only
valid for bundles. | [
"Returns",
"the",
"bundle",
"extension",
"(",
".",
"app",
".",
"framework",
".",
"plugin",
"etc",
")",
".",
"Only",
"valid",
"for",
"bundles",
"."
] | def GetWrapperExtension(self):
"""Returns the bundle extension (.app, .framework, .plugin, etc). Only
valid for bundles."""
assert self._IsBundle()
if self.spec["type"] in ("loadable_module", "shared_library"):
default_wrapper_extension = {
"loadable_module": "bu... | [
"def",
"GetWrapperExtension",
"(",
"self",
")",
":",
"assert",
"self",
".",
"_IsBundle",
"(",
")",
"if",
"self",
".",
"spec",
"[",
"\"type\"",
"]",
"in",
"(",
"\"loadable_module\"",
",",
"\"shared_library\"",
")",
":",
"default_wrapper_extension",
"=",
"{",
... | https://github.com/oracle/graaljs/blob/36a56e8e993d45fc40939a3a4d9c0c24990720f1/graal-nodejs/tools/gyp/pylib/gyp/xcode_emulation.py#L262-L284 | ||
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/scipy/py3/scipy/signal/filter_design.py | python | lp2hp | (b, a, wo=1.0) | return normalize(outb, outa) | Transform a lowpass filter prototype to a highpass filter.
Return an analog high-pass filter with cutoff frequency `wo`
from an analog low-pass filter prototype with unity cutoff frequency, in
transfer function ('ba') representation.
See Also
--------
lp2lp, lp2bp, lp2bs, bilinear
lp2hp_zp... | Transform a lowpass filter prototype to a highpass filter. | [
"Transform",
"a",
"lowpass",
"filter",
"prototype",
"to",
"a",
"highpass",
"filter",
"."
] | def lp2hp(b, a, wo=1.0):
"""
Transform a lowpass filter prototype to a highpass filter.
Return an analog high-pass filter with cutoff frequency `wo`
from an analog low-pass filter prototype with unity cutoff frequency, in
transfer function ('ba') representation.
See Also
--------
lp2lp... | [
"def",
"lp2hp",
"(",
"b",
",",
"a",
",",
"wo",
"=",
"1.0",
")",
":",
"a",
",",
"b",
"=",
"map",
"(",
"atleast_1d",
",",
"(",
"a",
",",
"b",
")",
")",
"try",
":",
"wo",
"=",
"float",
"(",
"wo",
")",
"except",
"TypeError",
":",
"wo",
"=",
"... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/scipy/py3/scipy/signal/filter_design.py#L1662-L1698 | |
gimli-org/gimli | 17aa2160de9b15ababd9ef99e89b1bc3277bbb23 | pygimli/frameworks/inversion.py | python | Inversion.dataVals | (self, d) | Set mandatory data values.
Values == 0.0. Will be set to Tolerance | Set mandatory data values. | [
"Set",
"mandatory",
"data",
"values",
"."
] | def dataVals(self, d):
"""Set mandatory data values.
Values == 0.0. Will be set to Tolerance
"""
self._dataVals = d
if self._dataVals is None:
pg._y(d)
pg.critical("Inversion framework needs data values to run") | [
"def",
"dataVals",
"(",
"self",
",",
"d",
")",
":",
"self",
".",
"_dataVals",
"=",
"d",
"if",
"self",
".",
"_dataVals",
"is",
"None",
":",
"pg",
".",
"_y",
"(",
"d",
")",
"pg",
".",
"critical",
"(",
"\"Inversion framework needs data values to run\"",
")"... | https://github.com/gimli-org/gimli/blob/17aa2160de9b15ababd9ef99e89b1bc3277bbb23/pygimli/frameworks/inversion.py#L213-L222 | ||
benoitsteiner/tensorflow-opencl | cb7cb40a57fde5cfd4731bc551e82a1e2fef43a5 | tensorflow/python/ops/metrics_impl.py | python | mean_iou | (labels,
predictions,
num_classes,
weights=None,
metrics_collections=None,
updates_collections=None,
name=None) | Calculate per-step mean Intersection-Over-Union (mIOU).
Mean Intersection-Over-Union is a common evaluation metric for
semantic image segmentation, which first computes the IOU for each
semantic class and then computes the average over classes.
IOU is defined as follows:
IOU = true_positive / (true_positiv... | Calculate per-step mean Intersection-Over-Union (mIOU). | [
"Calculate",
"per",
"-",
"step",
"mean",
"Intersection",
"-",
"Over",
"-",
"Union",
"(",
"mIOU",
")",
"."
] | def mean_iou(labels,
predictions,
num_classes,
weights=None,
metrics_collections=None,
updates_collections=None,
name=None):
"""Calculate per-step mean Intersection-Over-Union (mIOU).
Mean Intersection-Over-Union is a common evaluation m... | [
"def",
"mean_iou",
"(",
"labels",
",",
"predictions",
",",
"num_classes",
",",
"weights",
"=",
"None",
",",
"metrics_collections",
"=",
"None",
",",
"updates_collections",
"=",
"None",
",",
"name",
"=",
"None",
")",
":",
"with",
"variable_scope",
".",
"varia... | https://github.com/benoitsteiner/tensorflow-opencl/blob/cb7cb40a57fde5cfd4731bc551e82a1e2fef43a5/tensorflow/python/ops/metrics_impl.py#L888-L981 | ||
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | wx/tools/Editra/src/syntax/synxml.py | python | EditraXml.SetIndentation | (self, indent) | Set the indentation level
@param indent: int | Set the indentation level
@param indent: int | [
"Set",
"the",
"indentation",
"level",
"@param",
"indent",
":",
"int"
] | def SetIndentation(self, indent):
"""Set the indentation level
@param indent: int
"""
self.indent = indent | [
"def",
"SetIndentation",
"(",
"self",
",",
"indent",
")",
":",
"self",
".",
"indent",
"=",
"indent"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/wx/tools/Editra/src/syntax/synxml.py#L302-L307 | ||
jsupancic/deep_hand_pose | 22cbeae1a8410ff5d37c060c7315719d0a5d608f | scripts/cpp_lint.py | python | CheckVlogArguments | (filename, clean_lines, linenum, error) | Checks that VLOG() is only used for defining a logging level.
For example, VLOG(2) is correct. VLOG(INFO), VLOG(WARNING), VLOG(ERROR), and
VLOG(FATAL) are not.
Args:
filename: The name of the current file.
clean_lines: A CleansedLines instance containing the file.
linenum: The number of the line to ... | Checks that VLOG() is only used for defining a logging level. | [
"Checks",
"that",
"VLOG",
"()",
"is",
"only",
"used",
"for",
"defining",
"a",
"logging",
"level",
"."
] | def CheckVlogArguments(filename, clean_lines, linenum, error):
"""Checks that VLOG() is only used for defining a logging level.
For example, VLOG(2) is correct. VLOG(INFO), VLOG(WARNING), VLOG(ERROR), and
VLOG(FATAL) are not.
Args:
filename: The name of the current file.
clean_lines: A CleansedLines i... | [
"def",
"CheckVlogArguments",
"(",
"filename",
",",
"clean_lines",
",",
"linenum",
",",
"error",
")",
":",
"line",
"=",
"clean_lines",
".",
"elided",
"[",
"linenum",
"]",
"if",
"Search",
"(",
"r'\\bVLOG\\((INFO|ERROR|WARNING|DFATAL|FATAL)\\)'",
",",
"line",
")",
... | https://github.com/jsupancic/deep_hand_pose/blob/22cbeae1a8410ff5d37c060c7315719d0a5d608f/scripts/cpp_lint.py#L1708-L1724 | ||
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | wx/lib/pdfviewer/viewer.py | python | pdfPrintout.PrintDirect | (self, page) | Provide the data for page by rendering the drawing commands
to the printer DC using dcGraphicsContext | Provide the data for page by rendering the drawing commands
to the printer DC using dcGraphicsContext | [
"Provide",
"the",
"data",
"for",
"page",
"by",
"rendering",
"the",
"drawing",
"commands",
"to",
"the",
"printer",
"DC",
"using",
"dcGraphicsContext"
] | def PrintDirect(self, page):
""" Provide the data for page by rendering the drawing commands
to the printer DC using dcGraphicsContext
"""
pageno = page - 1 # zero based
width = self.view.pagewidth
height = self.view.pageheight
self.FitThisSizeToPage(wx.... | [
"def",
"PrintDirect",
"(",
"self",
",",
"page",
")",
":",
"pageno",
"=",
"page",
"-",
"1",
"# zero based",
"width",
"=",
"self",
".",
"view",
".",
"pagewidth",
"height",
"=",
"self",
".",
"view",
".",
"pageheight",
"self",
".",
"FitThisSizeToPage",
"(",
... | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/wx/lib/pdfviewer/viewer.py#L996-L1006 | ||
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/scikit-learn/py2/sklearn/cross_validation.py | python | _score | (estimator, X_test, y_test, scorer) | return score | Compute the score of an estimator on a given test set. | Compute the score of an estimator on a given test set. | [
"Compute",
"the",
"score",
"of",
"an",
"estimator",
"on",
"a",
"given",
"test",
"set",
"."
] | def _score(estimator, X_test, y_test, scorer):
"""Compute the score of an estimator on a given test set."""
if y_test is None:
score = scorer(estimator, X_test)
else:
score = scorer(estimator, X_test, y_test)
if hasattr(score, 'item'):
try:
# e.g. unwrap memmapped sca... | [
"def",
"_score",
"(",
"estimator",
",",
"X_test",
",",
"y_test",
",",
"scorer",
")",
":",
"if",
"y_test",
"is",
"None",
":",
"score",
"=",
"scorer",
"(",
"estimator",
",",
"X_test",
")",
"else",
":",
"score",
"=",
"scorer",
"(",
"estimator",
",",
"X_... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/scikit-learn/py2/sklearn/cross_validation.py#L1736-L1752 | |
ChromiumWebApps/chromium | c7361d39be8abd1574e6ce8957c8dbddd4c6ccf7 | build/android/pylib/forwarder.py | python | Forwarder._KillHostLocked | (self) | Kills the forwarder process running on the host.
Note that the global lock must be acquired before calling this method. | Kills the forwarder process running on the host. | [
"Kills",
"the",
"forwarder",
"process",
"running",
"on",
"the",
"host",
"."
] | def _KillHostLocked(self):
"""Kills the forwarder process running on the host.
Note that the global lock must be acquired before calling this method.
"""
logging.info('Killing host_forwarder.')
(exit_code, output) = cmd_helper.GetCmdStatusAndOutput(
[self._host_forwarder_path, '--kill-serve... | [
"def",
"_KillHostLocked",
"(",
"self",
")",
":",
"logging",
".",
"info",
"(",
"'Killing host_forwarder.'",
")",
"(",
"exit_code",
",",
"output",
")",
"=",
"cmd_helper",
".",
"GetCmdStatusAndOutput",
"(",
"[",
"self",
".",
"_host_forwarder_path",
",",
"'--kill-se... | https://github.com/ChromiumWebApps/chromium/blob/c7361d39be8abd1574e6ce8957c8dbddd4c6ccf7/build/android/pylib/forwarder.py#L293-L306 | ||
benoitsteiner/tensorflow-opencl | cb7cb40a57fde5cfd4731bc551e82a1e2fef43a5 | tensorflow/contrib/receptive_field/python/util/receptive_field.py | python | _get_effective_stride_node_input | (stride, effective_stride_output) | return stride * effective_stride_output | Computes effective stride at the input of a given layer.
Args:
stride: Stride of given layer (integer).
effective_stride_output: Effective stride at output of given layer
(integer).
Returns:
effective_stride_input: Effective stride at input of given layer
(integer). | Computes effective stride at the input of a given layer. | [
"Computes",
"effective",
"stride",
"at",
"the",
"input",
"of",
"a",
"given",
"layer",
"."
] | def _get_effective_stride_node_input(stride, effective_stride_output):
"""Computes effective stride at the input of a given layer.
Args:
stride: Stride of given layer (integer).
effective_stride_output: Effective stride at output of given layer
(integer).
Returns:
effective_stride_input: Effec... | [
"def",
"_get_effective_stride_node_input",
"(",
"stride",
",",
"effective_stride_output",
")",
":",
"return",
"stride",
"*",
"effective_stride_output"
] | https://github.com/benoitsteiner/tensorflow-opencl/blob/cb7cb40a57fde5cfd4731bc551e82a1e2fef43a5/tensorflow/contrib/receptive_field/python/util/receptive_field.py#L278-L290 | |
giuspen/cherrytree | 84712f206478fcf9acf30174009ad28c648c6344 | pygtk2/modules/core.py | python | CherryTree.export_print_page_setup | (self, action) | Print Page Setup Operations | Print Page Setup Operations | [
"Print",
"Page",
"Setup",
"Operations"
] | def export_print_page_setup(self, action):
"""Print Page Setup Operations"""
if self.print_handler.settings is None:
self.print_handler.settings = gtk.PrintSettings()
self.print_handler.page_setup = gtk.print_run_page_setup_dialog(self.window,
... | [
"def",
"export_print_page_setup",
"(",
"self",
",",
"action",
")",
":",
"if",
"self",
".",
"print_handler",
".",
"settings",
"is",
"None",
":",
"self",
".",
"print_handler",
".",
"settings",
"=",
"gtk",
".",
"PrintSettings",
"(",
")",
"self",
".",
"print_h... | https://github.com/giuspen/cherrytree/blob/84712f206478fcf9acf30174009ad28c648c6344/pygtk2/modules/core.py#L2257-L2263 | ||
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | wx/tools/Editra/src/extern/stcspellcheck.py | python | STCSpellCheck.getSuggestions | (self, word) | return [] | Get suggestion for the correct spelling of a word.
@param word: word to check
@return: list of suggestions, or an empty list if any of the following
are true: there are no suggestions, the word is shorter than the
minimum length, or the dictionary can't be found. | Get suggestion for the correct spelling of a word. | [
"Get",
"suggestion",
"for",
"the",
"correct",
"spelling",
"of",
"a",
"word",
"."
] | def getSuggestions(self, word):
"""Get suggestion for the correct spelling of a word.
@param word: word to check
@return: list of suggestions, or an empty list if any of the following
are true: there are no suggestions, the word is shorter than the
minimum lengt... | [
"def",
"getSuggestions",
"(",
"self",
",",
"word",
")",
":",
"spell",
"=",
"self",
".",
"_spelling_dict",
"if",
"spell",
"and",
"len",
"(",
"word",
")",
">=",
"self",
".",
"_spelling_word_size",
":",
"words",
"=",
"spell",
".",
"suggest",
"(",
"word",
... | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/wx/tools/Editra/src/extern/stcspellcheck.py#L480-L495 | |
htcondor/htcondor | 4829724575176d1d6c936e4693dfd78a728569b0 | bindings/python/htcondor/htchirp/htchirp.py | python | HTChirp.whoami | (self) | return result | Get the user's current identity with respect to this server.
:returns: The user's identity | Get the user's current identity with respect to this server. | [
"Get",
"the",
"user",
"s",
"current",
"identity",
"with",
"respect",
"to",
"this",
"server",
"."
] | def whoami(self):
"""Get the user's current identity with respect to this server.
:returns: The user's identity
"""
length = int(
self._simple_command("whoami {0}\n".format(self.__class__.CHIRP_LINE_MAX))
)
result = self._get_fixed_data(length).decode()
... | [
"def",
"whoami",
"(",
"self",
")",
":",
"length",
"=",
"int",
"(",
"self",
".",
"_simple_command",
"(",
"\"whoami {0}\\n\"",
".",
"format",
"(",
"self",
".",
"__class__",
".",
"CHIRP_LINE_MAX",
")",
")",
")",
"result",
"=",
"self",
".",
"_get_fixed_data",
... | https://github.com/htcondor/htcondor/blob/4829724575176d1d6c936e4693dfd78a728569b0/bindings/python/htcondor/htchirp/htchirp.py#L1002-L1014 | |
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/ipython/py2/IPython/utils/path.py | python | get_py_filename | (name, force_win32=None) | Return a valid python filename in the current directory.
If the given name is not a file, it adds '.py' and searches again.
Raises IOError with an informative message if the file isn't found. | Return a valid python filename in the current directory. | [
"Return",
"a",
"valid",
"python",
"filename",
"in",
"the",
"current",
"directory",
"."
] | def get_py_filename(name, force_win32=None):
"""Return a valid python filename in the current directory.
If the given name is not a file, it adds '.py' and searches again.
Raises IOError with an informative message if the file isn't found.
"""
name = os.path.expanduser(name)
if force_win32 is ... | [
"def",
"get_py_filename",
"(",
"name",
",",
"force_win32",
"=",
"None",
")",
":",
"name",
"=",
"os",
".",
"path",
".",
"expanduser",
"(",
"name",
")",
"if",
"force_win32",
"is",
"not",
"None",
":",
"warn",
"(",
"\"The 'force_win32' argument to 'get_py_filename... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/ipython/py2/IPython/utils/path.py#L96-L113 | ||
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/osx_cocoa/propgrid.py | python | PGArrayEditorDialog.EnableCustomNewAction | (*args, **kwargs) | return _propgrid.PGArrayEditorDialog_EnableCustomNewAction(*args, **kwargs) | EnableCustomNewAction(self) | EnableCustomNewAction(self) | [
"EnableCustomNewAction",
"(",
"self",
")"
] | def EnableCustomNewAction(*args, **kwargs):
"""EnableCustomNewAction(self)"""
return _propgrid.PGArrayEditorDialog_EnableCustomNewAction(*args, **kwargs) | [
"def",
"EnableCustomNewAction",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_propgrid",
".",
"PGArrayEditorDialog_EnableCustomNewAction",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/osx_cocoa/propgrid.py#L3186-L3188 | |
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/protobuf/py3/google/protobuf/internal/encoder.py | python | _SignedVarintSize | (value) | return 10 | Compute the size of a signed varint value. | Compute the size of a signed varint value. | [
"Compute",
"the",
"size",
"of",
"a",
"signed",
"varint",
"value",
"."
] | def _SignedVarintSize(value):
"""Compute the size of a signed varint value."""
if value < 0: return 10
if value <= 0x7f: return 1
if value <= 0x3fff: return 2
if value <= 0x1fffff: return 3
if value <= 0xfffffff: return 4
if value <= 0x7ffffffff: return 5
if value <= 0x3ffffffffff: return 6
if value <... | [
"def",
"_SignedVarintSize",
"(",
"value",
")",
":",
"if",
"value",
"<",
"0",
":",
"return",
"10",
"if",
"value",
"<=",
"0x7f",
":",
"return",
"1",
"if",
"value",
"<=",
"0x3fff",
":",
"return",
"2",
"if",
"value",
"<=",
"0x1fffff",
":",
"return",
"3",... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/protobuf/py3/google/protobuf/internal/encoder.py#L96-L108 | |
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/tools/python/src/Lib/lib2to3/pytree.py | python | Node.__unicode__ | (self) | return u"".join(map(unicode, self.children)) | Return a pretty string representation.
This reproduces the input source exactly. | Return a pretty string representation. | [
"Return",
"a",
"pretty",
"string",
"representation",
"."
] | def __unicode__(self):
"""
Return a pretty string representation.
This reproduces the input source exactly.
"""
return u"".join(map(unicode, self.children)) | [
"def",
"__unicode__",
"(",
"self",
")",
":",
"return",
"u\"\"",
".",
"join",
"(",
"map",
"(",
"unicode",
",",
"self",
".",
"children",
")",
")"
] | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/tools/python/src/Lib/lib2to3/pytree.py#L274-L280 | |
mindspore-ai/mindspore | fb8fd3338605bb34fa5cea054e535a8b1d753fab | mindspore/python/mindspore/nn/probability/distribution/gumbel.py | python | Gumbel.loc | (self) | return self._loc | Return the location of the distribution after casting to dtype.
Output:
Tensor, the loc parameter of the distribution. | Return the location of the distribution after casting to dtype. | [
"Return",
"the",
"location",
"of",
"the",
"distribution",
"after",
"casting",
"to",
"dtype",
"."
] | def loc(self):
"""
Return the location of the distribution after casting to dtype.
Output:
Tensor, the loc parameter of the distribution.
"""
return self._loc | [
"def",
"loc",
"(",
"self",
")",
":",
"return",
"self",
".",
"_loc"
] | https://github.com/mindspore-ai/mindspore/blob/fb8fd3338605bb34fa5cea054e535a8b1d753fab/mindspore/python/mindspore/nn/probability/distribution/gumbel.py#L121-L128 | |
miyosuda/TensorFlowAndroidDemo | 35903e0221aa5f109ea2dbef27f20b52e317f42d | jni-build/jni/include/tensorflow/python/training/training_ops.py | python | _SparseApplyRMSPropShape | (op) | return [mom_shape] | Shape function for the SparseApplyRMSProp op. | Shape function for the SparseApplyRMSProp op. | [
"Shape",
"function",
"for",
"the",
"SparseApplyRMSProp",
"op",
"."
] | def _SparseApplyRMSPropShape(op):
"""Shape function for the SparseApplyRMSProp op."""
var_shape = op.inputs[0].get_shape()
ms_shape = op.inputs[1].get_shape().merge_with(var_shape)
mom_shape = op.inputs[2].get_shape().merge_with(ms_shape)
_AssertInputIsScalar(op, 3) # lr
_AssertInputIsScalar(op, 4) # rho
... | [
"def",
"_SparseApplyRMSPropShape",
"(",
"op",
")",
":",
"var_shape",
"=",
"op",
".",
"inputs",
"[",
"0",
"]",
".",
"get_shape",
"(",
")",
"ms_shape",
"=",
"op",
".",
"inputs",
"[",
"1",
"]",
".",
"get_shape",
"(",
")",
".",
"merge_with",
"(",
"var_sh... | https://github.com/miyosuda/TensorFlowAndroidDemo/blob/35903e0221aa5f109ea2dbef27f20b52e317f42d/jni-build/jni/include/tensorflow/python/training/training_ops.py#L174-L187 | |
neoml-lib/neoml | a0d370fba05269a1b2258cef126f77bbd2054a3e | NeoML/Python/neoml/Dnn/Transform.py | python | Transform.transforms | (self) | return result | Gets the array of transformations. | Gets the array of transformations. | [
"Gets",
"the",
"array",
"of",
"transformations",
"."
] | def transforms(self):
"""Gets the array of transformations.
"""
operations = self._internal.get_operations()
parameters = self._internal.get_parameters()
result = []
for i in range(operations.size):
result.append((self.rules[operations[i]], parameters[i]))
... | [
"def",
"transforms",
"(",
"self",
")",
":",
"operations",
"=",
"self",
".",
"_internal",
".",
"get_operations",
"(",
")",
"parameters",
"=",
"self",
".",
"_internal",
".",
"get_parameters",
"(",
")",
"result",
"=",
"[",
"]",
"for",
"i",
"in",
"range",
... | https://github.com/neoml-lib/neoml/blob/a0d370fba05269a1b2258cef126f77bbd2054a3e/NeoML/Python/neoml/Dnn/Transform.py#L87-L96 | |
FreeCAD/FreeCAD | ba42231b9c6889b89e064d6d563448ed81e376ec | src/Mod/Path/PathScripts/PathDrilling.py | python | ObjectDrilling.initCircularHoleOperation | (self, obj) | initCircularHoleOperation(obj) ... add drilling specific properties to obj. | initCircularHoleOperation(obj) ... add drilling specific properties to obj. | [
"initCircularHoleOperation",
"(",
"obj",
")",
"...",
"add",
"drilling",
"specific",
"properties",
"to",
"obj",
"."
] | def initCircularHoleOperation(self, obj):
"""initCircularHoleOperation(obj) ... add drilling specific properties to obj."""
obj.addProperty(
"App::PropertyLength",
"PeckDepth",
"Drill",
QT_TRANSLATE_NOOP(
"App::Property",
"I... | [
"def",
"initCircularHoleOperation",
"(",
"self",
",",
"obj",
")",
":",
"obj",
".",
"addProperty",
"(",
"\"App::PropertyLength\"",
",",
"\"PeckDepth\"",
",",
"\"Drill\"",
",",
"QT_TRANSLATE_NOOP",
"(",
"\"App::Property\"",
",",
"\"Incremental Drill depth before retracting ... | https://github.com/FreeCAD/FreeCAD/blob/ba42231b9c6889b89e064d6d563448ed81e376ec/src/Mod/Path/PathScripts/PathDrilling.py#L101-L164 | ||
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/scikit-learn/py3/sklearn/covariance/_elliptic_envelope.py | python | EllipticEnvelope.fit | (self, X, y=None) | return self | Fit the EllipticEnvelope model.
Parameters
----------
X : numpy array or sparse matrix, shape (n_samples, n_features).
Training data
y : Ignored
not used, present for API consistency by convention. | Fit the EllipticEnvelope model. | [
"Fit",
"the",
"EllipticEnvelope",
"model",
"."
] | def fit(self, X, y=None):
"""Fit the EllipticEnvelope model.
Parameters
----------
X : numpy array or sparse matrix, shape (n_samples, n_features).
Training data
y : Ignored
not used, present for API consistency by convention.
"""
super(... | [
"def",
"fit",
"(",
"self",
",",
"X",
",",
"y",
"=",
"None",
")",
":",
"super",
"(",
")",
".",
"fit",
"(",
"X",
")",
"self",
".",
"offset_",
"=",
"np",
".",
"percentile",
"(",
"-",
"self",
".",
"dist_",
",",
"100.",
"*",
"self",
".",
"contamin... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/scikit-learn/py3/sklearn/covariance/_elliptic_envelope.py#L117-L131 | |
hanpfei/chromium-net | 392cc1fa3a8f92f42e4071ab6e674d8e0482f83f | third_party/catapult/telemetry/third_party/web-page-replay/customhandlers.py | python | SimpleResponse | (status) | return httparchive.create_response(status) | Return a ArchivedHttpResponse with |status| code and a simple text body. | Return a ArchivedHttpResponse with |status| code and a simple text body. | [
"Return",
"a",
"ArchivedHttpResponse",
"with",
"|status|",
"code",
"and",
"a",
"simple",
"text",
"body",
"."
] | def SimpleResponse(status):
"""Return a ArchivedHttpResponse with |status| code and a simple text body."""
return httparchive.create_response(status) | [
"def",
"SimpleResponse",
"(",
"status",
")",
":",
"return",
"httparchive",
".",
"create_response",
"(",
"status",
")"
] | https://github.com/hanpfei/chromium-net/blob/392cc1fa3a8f92f42e4071ab6e674d8e0482f83f/third_party/catapult/telemetry/third_party/web-page-replay/customhandlers.py#L42-L44 | |
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/scipy/scipy/linalg/_solvers.py | python | _solve_discrete_lyapunov_bilinear | (a, q) | return solve_lyapunov(b.conj().transpose(), -c) | Solves the discrete Lyapunov equation using a bilinear transformation.
This function is called by the `solve_discrete_lyapunov` function with
`method=bilinear`. It is not supposed to be called directly. | Solves the discrete Lyapunov equation using a bilinear transformation. | [
"Solves",
"the",
"discrete",
"Lyapunov",
"equation",
"using",
"a",
"bilinear",
"transformation",
"."
] | def _solve_discrete_lyapunov_bilinear(a, q):
"""
Solves the discrete Lyapunov equation using a bilinear transformation.
This function is called by the `solve_discrete_lyapunov` function with
`method=bilinear`. It is not supposed to be called directly.
"""
eye = np.eye(a.shape[0])
aH = a.con... | [
"def",
"_solve_discrete_lyapunov_bilinear",
"(",
"a",
",",
"q",
")",
":",
"eye",
"=",
"np",
".",
"eye",
"(",
"a",
".",
"shape",
"[",
"0",
"]",
")",
"aH",
"=",
"a",
".",
"conj",
"(",
")",
".",
"transpose",
"(",
")",
"aHI_inv",
"=",
"inv",
"(",
"... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/scipy/scipy/linalg/_solvers.py#L142-L154 | |
CRYTEK/CRYENGINE | 232227c59a220cbbd311576f0fbeba7bb53b2a8c | Code/Tools/waf-1.7.13/crywaflib/msvs.py | python | vsnode_target.GetPlatformSettings | (self, target_platform, target_configuration, entry, settings) | return result | Util function to apply flags based on current platform | Util function to apply flags based on current platform | [
"Util",
"function",
"to",
"apply",
"flags",
"based",
"on",
"current",
"platform"
] | def GetPlatformSettings(self, target_platform, target_configuration, entry, settings):
"""
Util function to apply flags based on current platform
"""
result = []
platforms = [target_platform]
# Append common win platform for windows hosts
if target_platform == 'win_x86' or target_platform == 'win_x... | [
"def",
"GetPlatformSettings",
"(",
"self",
",",
"target_platform",
",",
"target_configuration",
",",
"entry",
",",
"settings",
")",
":",
"result",
"=",
"[",
"]",
"platforms",
"=",
"[",
"target_platform",
"]",
"# Append common win platform for windows hosts",
"if",
"... | https://github.com/CRYTEK/CRYENGINE/blob/232227c59a220cbbd311576f0fbeba7bb53b2a8c/Code/Tools/waf-1.7.13/crywaflib/msvs.py#L1392-L1458 | |
papyrussolution/OpenPapyrus | bbfb5ec2ea2109b8e2f125edd838e12eaf7b8b91 | Src/OSF/protobuf-3.19.1/python/google/protobuf/descriptor.py | python | _ParseOptions | (message, string) | return message | Parses serialized options.
This helper function is used to parse serialized options in generated
proto2 files. It must not be used outside proto2. | Parses serialized options. | [
"Parses",
"serialized",
"options",
"."
] | def _ParseOptions(message, string):
"""Parses serialized options.
This helper function is used to parse serialized options in generated
proto2 files. It must not be used outside proto2.
"""
message.ParseFromString(string)
return message | [
"def",
"_ParseOptions",
"(",
"message",
",",
"string",
")",
":",
"message",
".",
"ParseFromString",
"(",
"string",
")",
"return",
"message"
] | https://github.com/papyrussolution/OpenPapyrus/blob/bbfb5ec2ea2109b8e2f125edd838e12eaf7b8b91/Src/OSF/protobuf-3.19.1/python/google/protobuf/descriptor.py#L1022-L1029 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | wx/lib/ogl/_diagram.py | python | Diagram.InsertShape | (self, object) | Insert a shape at the front of the shape list. | Insert a shape at the front of the shape list. | [
"Insert",
"a",
"shape",
"at",
"the",
"front",
"of",
"the",
"shape",
"list",
"."
] | def InsertShape(self, object):
"""Insert a shape at the front of the shape list."""
self._shapeList.insert(0, object) | [
"def",
"InsertShape",
"(",
"self",
",",
"object",
")",
":",
"self",
".",
"_shapeList",
".",
"insert",
"(",
"0",
",",
"object",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/wx/lib/ogl/_diagram.py#L61-L63 | ||
stan-dev/math | 5fd79f89933269a4ca4d8dd1fde2a36d53d4768c | lib/boost_1.75.0/libs/metaparse/tools/benchmark/generate.py | python | Template._get_line | (self, regex) | return self._match(regex).group(1) | Get a line based on a regex | Get a line based on a regex | [
"Get",
"a",
"line",
"based",
"on",
"a",
"regex"
] | def _get_line(self, regex):
"""Get a line based on a regex"""
return self._match(regex).group(1) | [
"def",
"_get_line",
"(",
"self",
",",
"regex",
")",
":",
"return",
"self",
".",
"_match",
"(",
"regex",
")",
".",
"group",
"(",
"1",
")"
] | https://github.com/stan-dev/math/blob/5fd79f89933269a4ca4d8dd1fde2a36d53d4768c/lib/boost_1.75.0/libs/metaparse/tools/benchmark/generate.py#L175-L177 | |
chromiumembedded/cef | 80caf947f3fe2210e5344713c5281d8af9bdc295 | tools/crash_server.py | python | CrashHTTPRequestHandler.do_POST | (self) | Handle a multi-part POST request submitted by Breakpad/Crashpad. | Handle a multi-part POST request submitted by Breakpad/Crashpad. | [
"Handle",
"a",
"multi",
"-",
"part",
"POST",
"request",
"submitted",
"by",
"Breakpad",
"/",
"Crashpad",
"."
] | def do_POST(self):
""" Handle a multi-part POST request submitted by Breakpad/Crashpad. """
self._send_default_response_headers()
# Create a unique ID for the dump.
dump_id = self._create_new_dump_id()
# Return the unique ID to the caller.
self.wfile.write(dump_id.encode('utf-8'))
dmp_str... | [
"def",
"do_POST",
"(",
"self",
")",
":",
"self",
".",
"_send_default_response_headers",
"(",
")",
"# Create a unique ID for the dump.",
"dump_id",
"=",
"self",
".",
"_create_new_dump_id",
"(",
")",
"# Return the unique ID to the caller.",
"self",
".",
"wfile",
".",
"w... | https://github.com/chromiumembedded/cef/blob/80caf947f3fe2210e5344713c5281d8af9bdc295/tools/crash_server.py#L224-L313 | ||
miyosuda/TensorFlowAndroidMNIST | 7b5a4603d2780a8a2834575706e9001977524007 | jni-build/jni/include/tensorflow/contrib/learn/python/learn/ops/seq2seq_ops.py | python | seq2seq_inputs | (x, y, input_length, output_length, sentinel=None, name=None) | Processes inputs for Sequence to Sequence models.
Args:
x: Input Tensor [batch_size, input_length, embed_dim].
y: Output Tensor [batch_size, output_length, embed_dim].
input_length: length of input x.
output_length: length of output y.
sentinel: optional first input to decoder and final output ex... | Processes inputs for Sequence to Sequence models. | [
"Processes",
"inputs",
"for",
"Sequence",
"to",
"Sequence",
"models",
"."
] | def seq2seq_inputs(x, y, input_length, output_length, sentinel=None, name=None):
"""Processes inputs for Sequence to Sequence models.
Args:
x: Input Tensor [batch_size, input_length, embed_dim].
y: Output Tensor [batch_size, output_length, embed_dim].
input_length: length of input x.
output_length:... | [
"def",
"seq2seq_inputs",
"(",
"x",
",",
"y",
",",
"input_length",
",",
"output_length",
",",
"sentinel",
"=",
"None",
",",
"name",
"=",
"None",
")",
":",
"with",
"ops",
".",
"op_scope",
"(",
"[",
"x",
",",
"y",
"]",
",",
"name",
",",
"\"seq2seq_input... | https://github.com/miyosuda/TensorFlowAndroidMNIST/blob/7b5a4603d2780a8a2834575706e9001977524007/jni-build/jni/include/tensorflow/contrib/learn/python/learn/ops/seq2seq_ops.py#L60-L87 | ||
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/setuptools/py3/pkg_resources/__init__.py | python | invalid_marker | (text) | return False | Validate text as a PEP 508 environment marker; return an exception
if invalid or False otherwise. | Validate text as a PEP 508 environment marker; return an exception
if invalid or False otherwise. | [
"Validate",
"text",
"as",
"a",
"PEP",
"508",
"environment",
"marker",
";",
"return",
"an",
"exception",
"if",
"invalid",
"or",
"False",
"otherwise",
"."
] | def invalid_marker(text):
"""
Validate text as a PEP 508 environment marker; return an exception
if invalid or False otherwise.
"""
try:
evaluate_marker(text)
except SyntaxError as e:
e.filename = None
e.lineno = None
return e
return False | [
"def",
"invalid_marker",
"(",
"text",
")",
":",
"try",
":",
"evaluate_marker",
"(",
"text",
")",
"except",
"SyntaxError",
"as",
"e",
":",
"e",
".",
"filename",
"=",
"None",
"e",
".",
"lineno",
"=",
"None",
"return",
"e",
"return",
"False"
] | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/setuptools/py3/pkg_resources/__init__.py#L1346-L1357 | |
openvinotoolkit/openvino | dedcbeafa8b84cccdc55ca64b8da516682b381c7 | tools/mo/openvino/tools/mo/back/SpecialNodesFinalization.py | python | CreateConstNodesReplacement._check_that_node_from_body | (node) | return np.any(internal_port_in_out_ports) and n_ports | Check that all output edges from node have 'internal_port_id'
(that shows that this node is from TI body) | Check that all output edges from node have 'internal_port_id'
(that shows that this node is from TI body) | [
"Check",
"that",
"all",
"output",
"edges",
"from",
"node",
"have",
"internal_port_id",
"(",
"that",
"shows",
"that",
"this",
"node",
"is",
"from",
"TI",
"body",
")"
] | def _check_that_node_from_body(node):
"""Check that all output edges from node have 'internal_port_id'
(that shows that this node is from TI body)"""
n_ports = len(node.out_edges())
internal_port_in_out_ports = ['internal_port_id' in edge for edge in node.out_edges()]
return np.a... | [
"def",
"_check_that_node_from_body",
"(",
"node",
")",
":",
"n_ports",
"=",
"len",
"(",
"node",
".",
"out_edges",
"(",
")",
")",
"internal_port_in_out_ports",
"=",
"[",
"'internal_port_id'",
"in",
"edge",
"for",
"edge",
"in",
"node",
".",
"out_edges",
"(",
"... | https://github.com/openvinotoolkit/openvino/blob/dedcbeafa8b84cccdc55ca64b8da516682b381c7/tools/mo/openvino/tools/mo/back/SpecialNodesFinalization.py#L62-L67 | |
LLNL/lbann | 26083e6c86050302ce33148aea70f62e61cacb92 | applications/graph/GNN/NNConvModel.py | python | graph_data_splitter | (_input,
NUM_NODES,
NUM_EDGES,
NUM_NODE_FEATURES,
NUM_EDGE_FEATURES,
EMBEDDING_DIM,
EDGE_EMBEDDING_DIM) | return \
embedded_node_features, neighbor_feature_mat, embedded_edge_features, source_nodes, label | Helper function to split the input data into
Args:
NUM_NODES (int): The number of nodes in the largest graph in the dataset (51 for LSC-PPQM4M)
NUM_EDGES (int): The number of edges in the largest graph in the dataset (118 for LSC-PPQM4M)
NUM_NODE_FEATURES (int): The dimensionality of the input... | Helper function to split the input data into | [
"Helper",
"function",
"to",
"split",
"the",
"input",
"data",
"into"
] | def graph_data_splitter(_input,
NUM_NODES,
NUM_EDGES,
NUM_NODE_FEATURES,
NUM_EDGE_FEATURES,
EMBEDDING_DIM,
EDGE_EMBEDDING_DIM):
"""Helper function to split the input data into
Args:
NUM_NODES (int): The number of nodes in the largest graph in the dataset (51 for LSC-P... | [
"def",
"graph_data_splitter",
"(",
"_input",
",",
"NUM_NODES",
",",
"NUM_EDGES",
",",
"NUM_NODE_FEATURES",
",",
"NUM_EDGE_FEATURES",
",",
"EMBEDDING_DIM",
",",
"EDGE_EMBEDDING_DIM",
")",
":",
"split_indices",
"=",
"[",
"]",
"start_index",
"=",
"0",
"split_indices",
... | https://github.com/LLNL/lbann/blob/26083e6c86050302ce33148aea70f62e61cacb92/applications/graph/GNN/NNConvModel.py#L94-L174 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/mac/Python.framework/Versions/3.7/lib/python3.7/site-packages/dateutil/rrule.py | python | rrule.__str__ | (self) | return '\n'.join(output) | Output a string that would generate this RRULE if passed to rrulestr.
This is mostly compatible with RFC5545, except for the
dateutil-specific extension BYEASTER. | Output a string that would generate this RRULE if passed to rrulestr.
This is mostly compatible with RFC5545, except for the
dateutil-specific extension BYEASTER. | [
"Output",
"a",
"string",
"that",
"would",
"generate",
"this",
"RRULE",
"if",
"passed",
"to",
"rrulestr",
".",
"This",
"is",
"mostly",
"compatible",
"with",
"RFC5545",
"except",
"for",
"the",
"dateutil",
"-",
"specific",
"extension",
"BYEASTER",
"."
] | def __str__(self):
"""
Output a string that would generate this RRULE if passed to rrulestr.
This is mostly compatible with RFC5545, except for the
dateutil-specific extension BYEASTER.
"""
output = []
h, m, s = [None] * 3
if self._dtstart:
ou... | [
"def",
"__str__",
"(",
"self",
")",
":",
"output",
"=",
"[",
"]",
"h",
",",
"m",
",",
"s",
"=",
"[",
"None",
"]",
"*",
"3",
"if",
"self",
".",
"_dtstart",
":",
"output",
".",
"append",
"(",
"self",
".",
"_dtstart",
".",
"strftime",
"(",
"'DTSTA... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/mac/Python.framework/Versions/3.7/lib/python3.7/site-packages/dateutil/rrule.py#L698-L758 | |
turi-code/SFrame | 796b9bdfb2fa1b881d82080754643c7e68629cd2 | oss_src/unity/python/sframe/data_structures/sarray.py | python | SArray.__init__ | (self, data=[], dtype=None, ignore_cast_failure=False, _proxy=None) | __init__(data=list(), dtype=None, ignore_cast_failure=False)
Construct a new SArray. The source of data includes: list,
numpy.ndarray, pandas.Series, and urls. | __init__(data=list(), dtype=None, ignore_cast_failure=False) | [
"__init__",
"(",
"data",
"=",
"list",
"()",
"dtype",
"=",
"None",
"ignore_cast_failure",
"=",
"False",
")"
] | def __init__(self, data=[], dtype=None, ignore_cast_failure=False, _proxy=None):
"""
__init__(data=list(), dtype=None, ignore_cast_failure=False)
Construct a new SArray. The source of data includes: list,
numpy.ndarray, pandas.Series, and urls.
"""
SArray.__construct_ctr... | [
"def",
"__init__",
"(",
"self",
",",
"data",
"=",
"[",
"]",
",",
"dtype",
"=",
"None",
",",
"ignore_cast_failure",
"=",
"False",
",",
"_proxy",
"=",
"None",
")",
":",
"SArray",
".",
"__construct_ctr",
"+=",
"1",
"if",
"SArray",
".",
"__construct_ctr",
... | https://github.com/turi-code/SFrame/blob/796b9bdfb2fa1b881d82080754643c7e68629cd2/oss_src/unity/python/sframe/data_structures/sarray.py#L308-L396 | ||
microsoft/TSS.MSR | 0f2516fca2cd9929c31d5450e39301c9bde43688 | TSS.Py/src/TpmTypes.py | python | TPM2_ReadClock_REQUEST.fromTpm | (buf) | return buf.createObj(TPM2_ReadClock_REQUEST) | Returns new TPM2_ReadClock_REQUEST object constructed from its
marshaled representation in the given TpmBuffer buffer | Returns new TPM2_ReadClock_REQUEST object constructed from its
marshaled representation in the given TpmBuffer buffer | [
"Returns",
"new",
"TPM2_ReadClock_REQUEST",
"object",
"constructed",
"from",
"its",
"marshaled",
"representation",
"in",
"the",
"given",
"TpmBuffer",
"buffer"
] | def fromTpm(buf):
""" Returns new TPM2_ReadClock_REQUEST object constructed from its
marshaled representation in the given TpmBuffer buffer
"""
return buf.createObj(TPM2_ReadClock_REQUEST) | [
"def",
"fromTpm",
"(",
"buf",
")",
":",
"return",
"buf",
".",
"createObj",
"(",
"TPM2_ReadClock_REQUEST",
")"
] | https://github.com/microsoft/TSS.MSR/blob/0f2516fca2cd9929c31d5450e39301c9bde43688/TSS.Py/src/TpmTypes.py#L16289-L16293 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Gems/CloudGemMetric/v1/AWS/common-code/Lib/pandas/core/indexes/multi.py | python | MultiIndex._is_memory_usage_qualified | (self) | return any(f(l) for l in self._inferred_type_levels) | return a boolean if we need a qualified .info display | return a boolean if we need a qualified .info display | [
"return",
"a",
"boolean",
"if",
"we",
"need",
"a",
"qualified",
".",
"info",
"display"
] | def _is_memory_usage_qualified(self) -> bool:
""" return a boolean if we need a qualified .info display """
def f(l):
return "mixed" in l or "string" in l or "unicode" in l
return any(f(l) for l in self._inferred_type_levels) | [
"def",
"_is_memory_usage_qualified",
"(",
"self",
")",
"->",
"bool",
":",
"def",
"f",
"(",
"l",
")",
":",
"return",
"\"mixed\"",
"in",
"l",
"or",
"\"string\"",
"in",
"l",
"or",
"\"unicode\"",
"in",
"l",
"return",
"any",
"(",
"f",
"(",
"l",
")",
"for"... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Gems/CloudGemMetric/v1/AWS/common-code/Lib/pandas/core/indexes/multi.py#L1003-L1009 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/gtk/_misc.py | python | ConfigBase.Flush | (*args, **kwargs) | return _misc_.ConfigBase_Flush(*args, **kwargs) | Flush(self, bool currentOnly=False) -> bool
permanently writes all changes | Flush(self, bool currentOnly=False) -> bool | [
"Flush",
"(",
"self",
"bool",
"currentOnly",
"=",
"False",
")",
"-",
">",
"bool"
] | def Flush(*args, **kwargs):
"""
Flush(self, bool currentOnly=False) -> bool
permanently writes all changes
"""
return _misc_.ConfigBase_Flush(*args, **kwargs) | [
"def",
"Flush",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_misc_",
".",
"ConfigBase_Flush",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/gtk/_misc.py#L3319-L3325 | |
facebook/ThreatExchange | 31914a51820c73c8a0daffe62ccca29a6e3d359e | python-threatexchange/threatexchange/threat_updates.py | python | ThreatUpdateSerialization.load | (cls, state_dir: pathlib.Path) | Load this serialization from the state directory | Load this serialization from the state directory | [
"Load",
"this",
"serialization",
"from",
"the",
"state",
"directory"
] | def load(cls, state_dir: pathlib.Path) -> t.Iterable["ThreatUpdateSerialization"]:
"""Load this serialization from the state directory"""
raise NotImplementedError | [
"def",
"load",
"(",
"cls",
",",
"state_dir",
":",
"pathlib",
".",
"Path",
")",
"->",
"t",
".",
"Iterable",
"[",
"\"ThreatUpdateSerialization\"",
"]",
":",
"raise",
"NotImplementedError"
] | https://github.com/facebook/ThreatExchange/blob/31914a51820c73c8a0daffe62ccca29a6e3d359e/python-threatexchange/threatexchange/threat_updates.py#L52-L54 | ||
ArduPilot/ardupilot | 6e684b3496122b8158ac412b609d00004b7ac306 | libraries/SITL/examples/JSON/pybullet/robot.py | python | control_racecar | (pwm) | control racecar | control racecar | [
"control",
"racecar"
] | def control_racecar(pwm):
'''control racecar'''
steer_max = 45.0
throttle_max = 200.0
steering = constrain((pwm[0] - 1500.0)/500.0, -1, 1) * math.radians(steer_max) * -1
throttle = constrain((pwm[2] - 1500.0)/500.0, -1, 1) * throttle_max
robot.steer(steering)
robot.drive(throttle) | [
"def",
"control_racecar",
"(",
"pwm",
")",
":",
"steer_max",
"=",
"45.0",
"throttle_max",
"=",
"200.0",
"steering",
"=",
"constrain",
"(",
"(",
"pwm",
"[",
"0",
"]",
"-",
"1500.0",
")",
"/",
"500.0",
",",
"-",
"1",
",",
"1",
")",
"*",
"math",
".",
... | https://github.com/ArduPilot/ardupilot/blob/6e684b3496122b8158ac412b609d00004b7ac306/libraries/SITL/examples/JSON/pybullet/robot.py#L65-L73 | ||
clementine-player/Clementine | 111379dfd027802b59125829fcf87e3e1d0ad73b | dist/cpplint.py | python | CheckLanguage | (filename, clean_lines, linenum, file_extension,
include_state, nesting_state, error) | Checks rules from the 'C++ language rules' section of cppguide.html.
Some of these rules are hard to test (function overloading, using
uint32 inappropriately), but we do the best we can.
Args:
filename: The name of the current file.
clean_lines: A CleansedLines instance containing the file.
linenum:... | Checks rules from the 'C++ language rules' section of cppguide.html. | [
"Checks",
"rules",
"from",
"the",
"C",
"++",
"language",
"rules",
"section",
"of",
"cppguide",
".",
"html",
"."
] | def CheckLanguage(filename, clean_lines, linenum, file_extension,
include_state, nesting_state, error):
"""Checks rules from the 'C++ language rules' section of cppguide.html.
Some of these rules are hard to test (function overloading, using
uint32 inappropriately), but we do the best we can.
... | [
"def",
"CheckLanguage",
"(",
"filename",
",",
"clean_lines",
",",
"linenum",
",",
"file_extension",
",",
"include_state",
",",
"nesting_state",
",",
"error",
")",
":",
"# If the line is empty or consists of entirely a comment, no need to",
"# check it.",
"line",
"=",
"cle... | https://github.com/clementine-player/Clementine/blob/111379dfd027802b59125829fcf87e3e1d0ad73b/dist/cpplint.py#L4613-L4787 | ||
Caffe-MPI/Caffe-MPI.github.io | df5992af571a2a19981b69635115c393f18d1c76 | python/draw_net.py | python | parse_args | () | return args | Parse input arguments | Parse input arguments | [
"Parse",
"input",
"arguments"
] | def parse_args():
"""Parse input arguments
"""
parser = ArgumentParser(description=__doc__,
formatter_class=ArgumentDefaultsHelpFormatter)
parser.add_argument('input_net_proto_file',
help='Input network prototxt file')
parser.add_argument('output... | [
"def",
"parse_args",
"(",
")",
":",
"parser",
"=",
"ArgumentParser",
"(",
"description",
"=",
"__doc__",
",",
"formatter_class",
"=",
"ArgumentDefaultsHelpFormatter",
")",
"parser",
".",
"add_argument",
"(",
"'input_net_proto_file'",
",",
"help",
"=",
"'Input networ... | https://github.com/Caffe-MPI/Caffe-MPI.github.io/blob/df5992af571a2a19981b69635115c393f18d1c76/python/draw_net.py#L13-L33 | |
pmq20/node-packer | 12c46c6e44fbc14d9ee645ebd17d5296b324f7e0 | current/tools/gyp/pylib/gyp/common.py | python | WriteOnDiff | (filename) | return Writer() | Write to a file only if the new contents differ.
Arguments:
filename: name of the file to potentially write to.
Returns:
A file like object which will write to temporary file and only overwrite
the target if it differs (on close). | Write to a file only if the new contents differ. | [
"Write",
"to",
"a",
"file",
"only",
"if",
"the",
"new",
"contents",
"differ",
"."
] | def WriteOnDiff(filename):
"""Write to a file only if the new contents differ.
Arguments:
filename: name of the file to potentially write to.
Returns:
A file like object which will write to temporary file and only overwrite
the target if it differs (on close).
"""
class Writer(object):
"""Wr... | [
"def",
"WriteOnDiff",
"(",
"filename",
")",
":",
"class",
"Writer",
"(",
"object",
")",
":",
"\"\"\"Wrapper around file which only covers the target if it differs.\"\"\"",
"def",
"__init__",
"(",
"self",
")",
":",
"# On Cygwin remove the \"dir\" argument because `C:` prefixed p... | https://github.com/pmq20/node-packer/blob/12c46c6e44fbc14d9ee645ebd17d5296b324f7e0/current/tools/gyp/pylib/gyp/common.py#L334-L412 | |
mantidproject/mantid | 03deeb89254ec4289edb8771e0188c2090a02f32 | scripts/Inelastic/Direct/ReductionWrapper.py | python | ReductionWrapper._check_progress_log_run_completed | (self,run_number_requested) | return(run_written >= run_number_requested,run_written,'') | Method to verify experiment progress log file and check if the file to reduce
has been written.
Input:
run_number_requested -- the number expected to be in logged in the log file
Output:
returns: (True,run_number_written,'') if the run_number stored in the... | Method to verify experiment progress log file and check if the file to reduce
has been written.
Input:
run_number_requested -- the number expected to be in logged in the log file | [
"Method",
"to",
"verify",
"experiment",
"progress",
"log",
"file",
"and",
"check",
"if",
"the",
"file",
"to",
"reduce",
"has",
"been",
"written",
".",
"Input",
":",
"run_number_requested",
"--",
"the",
"number",
"expected",
"to",
"be",
"in",
"logged",
"in",
... | def _check_progress_log_run_completed(self,run_number_requested):
""" Method to verify experiment progress log file and check if the file to reduce
has been written.
Input:
run_number_requested -- the number expected to be in logged in the log file
Output:
... | [
"def",
"_check_progress_log_run_completed",
"(",
"self",
",",
"run_number_requested",
")",
":",
"propman",
"=",
"self",
".",
"reducer",
".",
"prop_man",
"if",
"len",
"(",
"propman",
".",
"archive_upload_log_file",
")",
"==",
"0",
":",
"return",
"(",
"True",
",... | https://github.com/mantidproject/mantid/blob/03deeb89254ec4289edb8771e0188c2090a02f32/scripts/Inelastic/Direct/ReductionWrapper.py#L450-L492 | |
PixarAnimationStudios/USD | faed18ce62c8736b02413635b584a2f637156bad | pxr/usdImaging/usdviewq/appController.py | python | AppController._updateOnFrameChange | (self) | Called when the frame changes, updates the renderer and such | Called when the frame changes, updates the renderer and such | [
"Called",
"when",
"the",
"frame",
"changes",
"updates",
"the",
"renderer",
"and",
"such"
] | def _updateOnFrameChange(self):
"""Called when the frame changes, updates the renderer and such"""
# do not update HUD/BBOX if scrubbing or playing
if not (self._dataModel.playing or self._ui.frameSlider.isSliderDown()):
self._updateGUIForFrameChange()
if self._stageView:
... | [
"def",
"_updateOnFrameChange",
"(",
"self",
")",
":",
"# do not update HUD/BBOX if scrubbing or playing",
"if",
"not",
"(",
"self",
".",
"_dataModel",
".",
"playing",
"or",
"self",
".",
"_ui",
".",
"frameSlider",
".",
"isSliderDown",
"(",
")",
")",
":",
"self",
... | https://github.com/PixarAnimationStudios/USD/blob/faed18ce62c8736b02413635b584a2f637156bad/pxr/usdImaging/usdviewq/appController.py#L3490-L3508 | ||
baidu-research/tensorflow-allreduce | 66d5b855e90b0949e9fa5cca5599fd729a70e874 | tensorflow/python/ops/variables.py | python | Variable._TensorConversionFunction | (v, dtype=None, name=None, as_ref=False) | Utility function for converting a Variable to a Tensor. | Utility function for converting a Variable to a Tensor. | [
"Utility",
"function",
"for",
"converting",
"a",
"Variable",
"to",
"a",
"Tensor",
"."
] | def _TensorConversionFunction(v, dtype=None, name=None, as_ref=False): # pylint: disable=invalid-name
"""Utility function for converting a Variable to a Tensor."""
_ = name
if dtype and not dtype.is_compatible_with(v.dtype):
raise ValueError(
"Incompatible type conversion requested to type ... | [
"def",
"_TensorConversionFunction",
"(",
"v",
",",
"dtype",
"=",
"None",
",",
"name",
"=",
"None",
",",
"as_ref",
"=",
"False",
")",
":",
"# pylint: disable=invalid-name",
"_",
"=",
"name",
"if",
"dtype",
"and",
"not",
"dtype",
".",
"is_compatible_with",
"("... | https://github.com/baidu-research/tensorflow-allreduce/blob/66d5b855e90b0949e9fa5cca5599fd729a70e874/tensorflow/python/ops/variables.py#L671-L681 | ||
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | wx/lib/agw/aui/framemanager.py | python | AuiManager.DetachPane | (self, window) | return False | Tells the :class:`AuiManager` to stop managing the pane specified
by `window`. The window, if in a floated frame, is reparented to the frame
managed by :class:`AuiManager`.
:param Window `window`: the window to be un-managed. | Tells the :class:`AuiManager` to stop managing the pane specified
by `window`. The window, if in a floated frame, is reparented to the frame
managed by :class:`AuiManager`. | [
"Tells",
"the",
":",
"class",
":",
"AuiManager",
"to",
"stop",
"managing",
"the",
"pane",
"specified",
"by",
"window",
".",
"The",
"window",
"if",
"in",
"a",
"floated",
"frame",
"is",
"reparented",
"to",
"the",
"frame",
"managed",
"by",
":",
"class",
":"... | def DetachPane(self, window):
"""
Tells the :class:`AuiManager` to stop managing the pane specified
by `window`. The window, if in a floated frame, is reparented to the frame
managed by :class:`AuiManager`.
:param Window `window`: the window to be un-managed.
"""
... | [
"def",
"DetachPane",
"(",
"self",
",",
"window",
")",
":",
"for",
"p",
"in",
"self",
".",
"_panes",
":",
"if",
"p",
".",
"window",
"==",
"window",
":",
"if",
"p",
".",
"frame",
":",
"# we have a floating frame which is being detached. We need to",
"# reparent ... | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/wx/lib/agw/aui/framemanager.py#L4941-L4992 | |
pytorch/pytorch | 7176c92687d3cc847cc046bf002269c6949a21c2 | torch/distributions/continuous_bernoulli.py | python | ContinuousBernoulli._cont_bern_log_norm | (self) | return torch.where(self._outside_unstable_region(), log_norm, taylor) | computes the log normalizing constant as a function of the 'probs' parameter | computes the log normalizing constant as a function of the 'probs' parameter | [
"computes",
"the",
"log",
"normalizing",
"constant",
"as",
"a",
"function",
"of",
"the",
"probs",
"parameter"
] | def _cont_bern_log_norm(self):
'''computes the log normalizing constant as a function of the 'probs' parameter'''
cut_probs = self._cut_probs()
cut_probs_below_half = torch.where(torch.le(cut_probs, 0.5),
cut_probs,
... | [
"def",
"_cont_bern_log_norm",
"(",
"self",
")",
":",
"cut_probs",
"=",
"self",
".",
"_cut_probs",
"(",
")",
"cut_probs_below_half",
"=",
"torch",
".",
"where",
"(",
"torch",
".",
"le",
"(",
"cut_probs",
",",
"0.5",
")",
",",
"cut_probs",
",",
"torch",
".... | https://github.com/pytorch/pytorch/blob/7176c92687d3cc847cc046bf002269c6949a21c2/torch/distributions/continuous_bernoulli.py#L91-L106 | |
ApolloAuto/apollo | 463fb82f9e979d02dcb25044e60931293ab2dba0 | modules/tools/navigator/dbmap/libs/point.py | python | PointUtils.latlon2latlondict | (lat, lon) | return {'lat': lat, 'lng': lon} | latlon to latlon dictionary | latlon to latlon dictionary | [
"latlon",
"to",
"latlon",
"dictionary"
] | def latlon2latlondict(lat, lon):
"""latlon to latlon dictionary"""
return {'lat': lat, 'lng': lon} | [
"def",
"latlon2latlondict",
"(",
"lat",
",",
"lon",
")",
":",
"return",
"{",
"'lat'",
":",
"lat",
",",
"'lng'",
":",
"lon",
"}"
] | https://github.com/ApolloAuto/apollo/blob/463fb82f9e979d02dcb25044e60931293ab2dba0/modules/tools/navigator/dbmap/libs/point.py#L59-L61 | |
rsummers11/CADLab | 976ed959a0b5208bb4173127a7ef732ac73a9b6f | lesion_detector_3DCE/rcnn/symbol/symbol_vgg.py | python | get_vgg | (is_train, num_classes=config.NUM_CLASSES, num_anchors=config.NUM_ANCHORS) | return group | end-to-end train with VGG 16 conv layers with RPN
:param num_classes: used to determine output size
:param num_anchors: used to determine output size
:return: Symbol | end-to-end train with VGG 16 conv layers with RPN
:param num_classes: used to determine output size
:param num_anchors: used to determine output size
:return: Symbol | [
"end",
"-",
"to",
"-",
"end",
"train",
"with",
"VGG",
"16",
"conv",
"layers",
"with",
"RPN",
":",
"param",
"num_classes",
":",
"used",
"to",
"determine",
"output",
"size",
":",
"param",
"num_anchors",
":",
"used",
"to",
"determine",
"output",
"size",
":"... | def get_vgg(is_train, num_classes=config.NUM_CLASSES, num_anchors=config.NUM_ANCHORS):
"""
end-to-end train with VGG 16 conv layers with RPN
:param num_classes: used to determine output size
:param num_anchors: used to determine output size
:return: Symbol
"""
# data
data = mx.symbol.Var... | [
"def",
"get_vgg",
"(",
"is_train",
",",
"num_classes",
"=",
"config",
".",
"NUM_CLASSES",
",",
"num_anchors",
"=",
"config",
".",
"NUM_ANCHORS",
")",
":",
"# data",
"data",
"=",
"mx",
".",
"symbol",
".",
"Variable",
"(",
"name",
"=",
"\"data\"",
")",
"im... | https://github.com/rsummers11/CADLab/blob/976ed959a0b5208bb4173127a7ef732ac73a9b6f/lesion_detector_3DCE/rcnn/symbol/symbol_vgg.py#L186-L241 | |
benoitsteiner/tensorflow-opencl | cb7cb40a57fde5cfd4731bc551e82a1e2fef43a5 | tensorflow/examples/speech_commands/models.py | python | create_low_latency_svdf_model | (fingerprint_input, model_settings,
is_training, runtime_settings) | Builds an SVDF model with low compute requirements.
This is based in the topology presented in the 'Compressing Deep Neural
Networks using a Rank-Constrained Topology' paper:
https://static.googleusercontent.com/media/research.google.com/en//pubs/archive/43813.pdf
Here's the layout of the graph:
(fingerpri... | Builds an SVDF model with low compute requirements. | [
"Builds",
"an",
"SVDF",
"model",
"with",
"low",
"compute",
"requirements",
"."
] | def create_low_latency_svdf_model(fingerprint_input, model_settings,
is_training, runtime_settings):
"""Builds an SVDF model with low compute requirements.
This is based in the topology presented in the 'Compressing Deep Neural
Networks using a Rank-Constrained Topology' paper:
... | [
"def",
"create_low_latency_svdf_model",
"(",
"fingerprint_input",
",",
"model_settings",
",",
"is_training",
",",
"runtime_settings",
")",
":",
"if",
"is_training",
":",
"dropout_prob",
"=",
"tf",
".",
"placeholder",
"(",
"tf",
".",
"float32",
",",
"name",
"=",
... | https://github.com/benoitsteiner/tensorflow-opencl/blob/cb7cb40a57fde5cfd4731bc551e82a1e2fef43a5/tensorflow/examples/speech_commands/models.py#L385-L566 | ||
hanpfei/chromium-net | 392cc1fa3a8f92f42e4071ab6e674d8e0482f83f | third_party/catapult/third_party/coverage/coverage/control.py | python | Coverage.analysis | (self, morf) | return f, s, m, mf | Like `analysis2` but doesn't return excluded line numbers. | Like `analysis2` but doesn't return excluded line numbers. | [
"Like",
"analysis2",
"but",
"doesn",
"t",
"return",
"excluded",
"line",
"numbers",
"."
] | def analysis(self, morf):
"""Like `analysis2` but doesn't return excluded line numbers."""
f, s, _, m, mf = self.analysis2(morf)
return f, s, m, mf | [
"def",
"analysis",
"(",
"self",
",",
"morf",
")",
":",
"f",
",",
"s",
",",
"_",
",",
"m",
",",
"mf",
"=",
"self",
".",
"analysis2",
"(",
"morf",
")",
"return",
"f",
",",
"s",
",",
"m",
",",
"mf"
] | https://github.com/hanpfei/chromium-net/blob/392cc1fa3a8f92f42e4071ab6e674d8e0482f83f/third_party/catapult/third_party/coverage/coverage/control.py#L849-L852 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.