repo
stringlengths
7
54
path
stringlengths
4
192
url
stringlengths
87
284
code
stringlengths
78
104k
code_tokens
list
docstring
stringlengths
1
46.9k
docstring_tokens
list
language
stringclasses
1 value
partition
stringclasses
3 values
tBuLi/symfit
symfit/contrib/interactive_guess/interactive_guess.py
https://github.com/tBuLi/symfit/blob/759dd3d1d4270510d651f40b23dd26b1b10eee83/symfit/contrib/interactive_guess/interactive_guess.py#L249-L257
def plot_model(self, proj, ax): """ Plots the model proposed for the projection proj on ax. """ x, y = proj y_vals = getattr(self.ig._eval_model(), y.name) x_vals = self.ig._x_points[x] plot, = ax.plot(x_vals, y_vals, c='red') return plot
[ "def", "plot_model", "(", "self", ",", "proj", ",", "ax", ")", ":", "x", ",", "y", "=", "proj", "y_vals", "=", "getattr", "(", "self", ".", "ig", ".", "_eval_model", "(", ")", ",", "y", ".", "name", ")", "x_vals", "=", "self", ".", "ig", ".", ...
Plots the model proposed for the projection proj on ax.
[ "Plots", "the", "model", "proposed", "for", "the", "projection", "proj", "on", "ax", "." ]
python
train
miguelgrinberg/python-socketio
socketio/client.py
https://github.com/miguelgrinberg/python-socketio/blob/c0c1bf8d21e3597389b18938550a0724dd9676b7/socketio/client.py#L288-L317
def call(self, event, data=None, namespace=None, timeout=60): """Emit a custom event to a client and wait for the response. :param event: The event name. It can be any string. The event names ``'connect'``, ``'message'`` and ``'disconnect'`` are reserved and ...
[ "def", "call", "(", "self", ",", "event", ",", "data", "=", "None", ",", "namespace", "=", "None", ",", "timeout", "=", "60", ")", ":", "callback_event", "=", "self", ".", "eio", ".", "create_event", "(", ")", "callback_args", "=", "[", "]", "def", ...
Emit a custom event to a client and wait for the response. :param event: The event name. It can be any string. The event names ``'connect'``, ``'message'`` and ``'disconnect'`` are reserved and should not be used. :param data: The data to send to the client o...
[ "Emit", "a", "custom", "event", "to", "a", "client", "and", "wait", "for", "the", "response", "." ]
python
train
echinopsii/net.echinopsii.ariane.community.cli.python3
ariane_clip3/zeromq/driver.py
https://github.com/echinopsii/net.echinopsii.ariane.community.cli.python3/blob/0a7feddebf66fee4bef38d64f456d93a7e9fcd68/ariane_clip3/zeromq/driver.py#L49-L62
def call(self, my_args=None): """ publish the message in the topic :param my_args: dict like {msg: 'msg'} :return: nothing """ LOGGER.debug("zeromq.Publisher.call") if my_args is None: raise exceptions.ArianeConfError("publisher call arguments") ...
[ "def", "call", "(", "self", ",", "my_args", "=", "None", ")", ":", "LOGGER", ".", "debug", "(", "\"zeromq.Publisher.call\"", ")", "if", "my_args", "is", "None", ":", "raise", "exceptions", ".", "ArianeConfError", "(", "\"publisher call arguments\"", ")", "if",...
publish the message in the topic :param my_args: dict like {msg: 'msg'} :return: nothing
[ "publish", "the", "message", "in", "the", "topic", ":", "param", "my_args", ":", "dict", "like", "{", "msg", ":", "msg", "}", ":", "return", ":", "nothing" ]
python
train
google/grr
grr/client/grr_response_client/client_actions/standard.py
https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/client/grr_response_client/client_actions/standard.py#L203-L229
def ExecuteCommandFromClient(command): """Executes one of the predefined commands. Args: command: An `ExecuteRequest` object. Yields: `rdf_client_action.ExecuteResponse` objects. """ cmd = command.cmd args = command.args time_limit = command.time_limit res = client_utils_common.Execute(cmd, a...
[ "def", "ExecuteCommandFromClient", "(", "command", ")", ":", "cmd", "=", "command", ".", "cmd", "args", "=", "command", ".", "args", "time_limit", "=", "command", ".", "time_limit", "res", "=", "client_utils_common", ".", "Execute", "(", "cmd", ",", "args", ...
Executes one of the predefined commands. Args: command: An `ExecuteRequest` object. Yields: `rdf_client_action.ExecuteResponse` objects.
[ "Executes", "one", "of", "the", "predefined", "commands", "." ]
python
train
nvbn/thefuck
thefuck/types.py
https://github.com/nvbn/thefuck/blob/40ab4eb62db57627bff10cf029d29c94704086a2/thefuck/types.py#L58-L66
def update(self, **kwargs): """Returns new command with replaced fields. :rtype: Command """ kwargs.setdefault('script', self.script) kwargs.setdefault('output', self.output) return Command(**kwargs)
[ "def", "update", "(", "self", ",", "*", "*", "kwargs", ")", ":", "kwargs", ".", "setdefault", "(", "'script'", ",", "self", ".", "script", ")", "kwargs", ".", "setdefault", "(", "'output'", ",", "self", ".", "output", ")", "return", "Command", "(", "...
Returns new command with replaced fields. :rtype: Command
[ "Returns", "new", "command", "with", "replaced", "fields", "." ]
python
train
tanghaibao/jcvi
jcvi/projects/str.py
https://github.com/tanghaibao/jcvi/blob/d2e31a77b6ade7f41f3b321febc2b4744d1cdeca/jcvi/projects/str.py#L1276-L1321
def allelefreq(args): """ %prog allelefreq HD,DM1,SCA1,SCA17,FXTAS,FRAXE Plot the allele frequencies of some STRs. """ p = OptionParser(allelefreq.__doc__) p.add_option("--nopanels", default=False, action="store_true", help="No panel labels A, B, ...") p.add_option("--usere...
[ "def", "allelefreq", "(", "args", ")", ":", "p", "=", "OptionParser", "(", "allelefreq", ".", "__doc__", ")", "p", ".", "add_option", "(", "\"--nopanels\"", ",", "default", "=", "False", ",", "action", "=", "\"store_true\"", ",", "help", "=", "\"No panel l...
%prog allelefreq HD,DM1,SCA1,SCA17,FXTAS,FRAXE Plot the allele frequencies of some STRs.
[ "%prog", "allelefreq", "HD", "DM1", "SCA1", "SCA17", "FXTAS", "FRAXE" ]
python
train
jsvine/spectra
spectra/grapefruit.py
https://github.com/jsvine/spectra/blob/2269a0ae9b5923154b15bd661fb81179608f7ec2/spectra/grapefruit.py#L1204-L1228
def NewFromHsl(h, s, l, alpha=1.0, wref=_DEFAULT_WREF): '''Create a new instance based on the specifed HSL values. Parameters: :h: The Hue component value [0...1] :s: The Saturation component value [0...1] :l: The Lightness component value [0...1] :alpha: ...
[ "def", "NewFromHsl", "(", "h", ",", "s", ",", "l", ",", "alpha", "=", "1.0", ",", "wref", "=", "_DEFAULT_WREF", ")", ":", "return", "Color", "(", "(", "h", ",", "s", ",", "l", ")", ",", "'hsl'", ",", "alpha", ",", "wref", ")" ]
Create a new instance based on the specifed HSL values. Parameters: :h: The Hue component value [0...1] :s: The Saturation component value [0...1] :l: The Lightness component value [0...1] :alpha: The color transparency [0...1], default is opaque :wref:...
[ "Create", "a", "new", "instance", "based", "on", "the", "specifed", "HSL", "values", "." ]
python
train
samirelanduk/quickplots
quickplots/charts.py
https://github.com/samirelanduk/quickplots/blob/59f5e6ff367b2c1c24ba7cf1805d03552034c6d8/quickplots/charts.py#L196-L214
def line(self, *args, **kwargs): """Adds a :py:class:`.LineSeries` to the chart. :param \*data: The data for the series as either (x,y) values or two big\ tuples/lists of x and y values respectively. :param str name: The name to be associated with the series. :param str color: T...
[ "def", "line", "(", "self", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "if", "\"color\"", "not", "in", "kwargs", ":", "kwargs", "[", "\"color\"", "]", "=", "self", ".", "next_color", "(", ")", "series", "=", "LineSeries", "(", "*", "args"...
Adds a :py:class:`.LineSeries` to the chart. :param \*data: The data for the series as either (x,y) values or two big\ tuples/lists of x and y values respectively. :param str name: The name to be associated with the series. :param str color: The hex colour of the line. :param st...
[ "Adds", "a", ":", "py", ":", "class", ":", ".", "LineSeries", "to", "the", "chart", "." ]
python
train
pycontribs/pyrax
pyrax/autoscale.py
https://github.com/pycontribs/pyrax/blob/9ddfd5064b3a292d7337906f3b2d5dce95b50b99/pyrax/autoscale.py#L1182-L1187
def delete_policy(self, scaling_group, policy): """ Deletes the specified policy from the scaling group. """ return self._manager.delete_policy(scaling_group=scaling_group, policy=policy)
[ "def", "delete_policy", "(", "self", ",", "scaling_group", ",", "policy", ")", ":", "return", "self", ".", "_manager", ".", "delete_policy", "(", "scaling_group", "=", "scaling_group", ",", "policy", "=", "policy", ")" ]
Deletes the specified policy from the scaling group.
[ "Deletes", "the", "specified", "policy", "from", "the", "scaling", "group", "." ]
python
train
canonical-ols/acceptable
acceptable/_build_doubles.py
https://github.com/canonical-ols/acceptable/blob/6ccbe969078166a5315d857da38b59b43b29fadc/acceptable/_build_doubles.py#L154-L162
def _get_simple_assignments(tree): """Get simple assignments from node tree.""" result = {} for node in ast.walk(tree): if isinstance(node, ast.Assign): for target in node.targets: if isinstance(target, ast.Name): result[target.id] = node.value ret...
[ "def", "_get_simple_assignments", "(", "tree", ")", ":", "result", "=", "{", "}", "for", "node", "in", "ast", ".", "walk", "(", "tree", ")", ":", "if", "isinstance", "(", "node", ",", "ast", ".", "Assign", ")", ":", "for", "target", "in", "node", "...
Get simple assignments from node tree.
[ "Get", "simple", "assignments", "from", "node", "tree", "." ]
python
train
HewlettPackard/python-hpOneView
hpOneView/resources/fc_sans/managed_sans.py
https://github.com/HewlettPackard/python-hpOneView/blob/3c6219723ef25e6e0c83d44a89007f89bc325b89/hpOneView/resources/fc_sans/managed_sans.py#L141-L154
def create_issues_report(self, timeout=-1): """ Creates an unexpected zoning report for a SAN. Args: timeout: Timeout in seconds. Wait for task completion by default. The timeout does not abort the operation in OneView, just stops waiting for its comp...
[ "def", "create_issues_report", "(", "self", ",", "timeout", "=", "-", "1", ")", ":", "uri", "=", "\"{}/issues/\"", ".", "format", "(", "self", ".", "data", "[", "\"uri\"", "]", ")", "return", "self", ".", "_helper", ".", "create_report", "(", "uri", ",...
Creates an unexpected zoning report for a SAN. Args: timeout: Timeout in seconds. Wait for task completion by default. The timeout does not abort the operation in OneView, just stops waiting for its completion. Returns: list: A list of FCIssueRes...
[ "Creates", "an", "unexpected", "zoning", "report", "for", "a", "SAN", "." ]
python
train
jilljenn/tryalgo
tryalgo/polygon.py
https://github.com/jilljenn/tryalgo/blob/89a4dd9655e7b6b0a176f72b4c60d0196420dfe1/tryalgo/polygon.py#L12-L23
def area(p): """Area of a polygone :param p: list of the points taken in any orientation, p[0] can differ from p[-1] :returns: area :complexity: linear """ A = 0 for i in range(len(p)): A += p[i - 1][0] * p[i][1] - p[i][0] * p[i - 1][1] return A / 2.
[ "def", "area", "(", "p", ")", ":", "A", "=", "0", "for", "i", "in", "range", "(", "len", "(", "p", ")", ")", ":", "A", "+=", "p", "[", "i", "-", "1", "]", "[", "0", "]", "*", "p", "[", "i", "]", "[", "1", "]", "-", "p", "[", "i", ...
Area of a polygone :param p: list of the points taken in any orientation, p[0] can differ from p[-1] :returns: area :complexity: linear
[ "Area", "of", "a", "polygone" ]
python
train
CalebBell/fluids
fluids/nrlmsise00/nrlmsise_00.py
https://github.com/CalebBell/fluids/blob/57f556752e039f1d3e5a822f408c184783db2828/fluids/nrlmsise00/nrlmsise_00.py#L932-L1048
def gtd7(Input, flags, output): '''The standard model subroutine (GTD7) always computes the ‘‘thermospheric’’ mass density by explicitly summing the masses of the species in equilibrium at the thermospheric temperature T(z). ''' mn3 = 5 zn3 = [32.5,20.0,15.0,10.0,0.0] mn2 = 4 zn2 = [72....
[ "def", "gtd7", "(", "Input", ",", "flags", ",", "output", ")", ":", "mn3", "=", "5", "zn3", "=", "[", "32.5", ",", "20.0", ",", "15.0", ",", "10.0", ",", "0.0", "]", "mn2", "=", "4", "zn2", "=", "[", "72.5", ",", "55.0", ",", "45.0", ",", "...
The standard model subroutine (GTD7) always computes the ‘‘thermospheric’’ mass density by explicitly summing the masses of the species in equilibrium at the thermospheric temperature T(z).
[ "The", "standard", "model", "subroutine", "(", "GTD7", ")", "always", "computes", "the", "‘‘thermospheric’’", "mass", "density", "by", "explicitly", "summing", "the", "masses", "of", "the", "species", "in", "equilibrium", "at", "the", "thermospheric", "temperature...
python
train
Duke-GCB/DukeDSClient
ddsc/core/d4s2.py
https://github.com/Duke-GCB/DukeDSClient/blob/117f68fb9bae82e4c81ea487ad5d61ac350f3726/ddsc/core/d4s2.py#L307-L332
def _share_project(self, destination, project, to_user, force_send, auth_role='', user_message='', share_users=None): """ Send message to remote service to email/share project with to_user. :param destination: str which type of sharing we are doing (SHARE_DESTINATION or DE...
[ "def", "_share_project", "(", "self", ",", "destination", ",", "project", ",", "to_user", ",", "force_send", ",", "auth_role", "=", "''", ",", "user_message", "=", "''", ",", "share_users", "=", "None", ")", ":", "from_user", "=", "self", ".", "remote_stor...
Send message to remote service to email/share project with to_user. :param destination: str which type of sharing we are doing (SHARE_DESTINATION or DELIVER_DESTINATION) :param project: RemoteProject project we are sharing :param to_user: RemoteUser user we are sharing with :param auth_r...
[ "Send", "message", "to", "remote", "service", "to", "email", "/", "share", "project", "with", "to_user", ".", ":", "param", "destination", ":", "str", "which", "type", "of", "sharing", "we", "are", "doing", "(", "SHARE_DESTINATION", "or", "DELIVER_DESTINATION"...
python
train
rmed/dev-init
dev_init/dev_init.py
https://github.com/rmed/dev-init/blob/afc5da13002e563324c6291dede0bf2e0f58171f/dev_init/dev_init.py#L84-L121
def new_env(environment): """ Create a new environment in the configuration and ask the user for the commands for this specific environment. """ if not environment: print("You need to supply an environment name") return parser = read_config() if environment in parser.sectio...
[ "def", "new_env", "(", "environment", ")", ":", "if", "not", "environment", ":", "print", "(", "\"You need to supply an environment name\"", ")", "return", "parser", "=", "read_config", "(", ")", "if", "environment", "in", "parser", ".", "sections", "(", ")", ...
Create a new environment in the configuration and ask the user for the commands for this specific environment.
[ "Create", "a", "new", "environment", "in", "the", "configuration", "and", "ask", "the", "user", "for", "the", "commands", "for", "this", "specific", "environment", "." ]
python
train
rytilahti/python-songpal
songpal/device.py
https://github.com/rytilahti/python-songpal/blob/0443de6b3d960b9067a851d82261ca00e46b4618/songpal/device.py#L383-L389
async def get_sound_settings(self, target="") -> List[Setting]: """Get the current sound settings. :param str target: settings target, defaults to all. """ res = await self.services["audio"]["getSoundSettings"]({"target": target}) return [Setting.make(**x) for x in res]
[ "async", "def", "get_sound_settings", "(", "self", ",", "target", "=", "\"\"", ")", "->", "List", "[", "Setting", "]", ":", "res", "=", "await", "self", ".", "services", "[", "\"audio\"", "]", "[", "\"getSoundSettings\"", "]", "(", "{", "\"target\"", ":"...
Get the current sound settings. :param str target: settings target, defaults to all.
[ "Get", "the", "current", "sound", "settings", "." ]
python
train
andrenarchy/krypy
krypy/utils.py
https://github.com/andrenarchy/krypy/blob/4883ec9a61d64ea56489e15c35cc40f0633ab2f1/krypy/utils.py#L648-L675
def qr(X, ip_B=None, reorthos=1): """QR factorization with customizable inner product. :param X: array with ``shape==(N,k)`` :param ip_B: (optional) inner product, see :py:meth:`inner`. :param reorthos: (optional) numer of reorthogonalizations. Defaults to 1 (i.e. 2 runs of modified Gram-Schmidt)...
[ "def", "qr", "(", "X", ",", "ip_B", "=", "None", ",", "reorthos", "=", "1", ")", ":", "if", "ip_B", "is", "None", "and", "X", ".", "shape", "[", "1", "]", ">", "0", ":", "return", "scipy", ".", "linalg", ".", "qr", "(", "X", ",", "mode", "=...
QR factorization with customizable inner product. :param X: array with ``shape==(N,k)`` :param ip_B: (optional) inner product, see :py:meth:`inner`. :param reorthos: (optional) numer of reorthogonalizations. Defaults to 1 (i.e. 2 runs of modified Gram-Schmidt) which should be enough in most cas...
[ "QR", "factorization", "with", "customizable", "inner", "product", "." ]
python
train
SmokinCaterpillar/pypet
pypet/storageservice.py
https://github.com/SmokinCaterpillar/pypet/blob/97ad3e80d46dbdea02deeb98ea41f05a19565826/pypet/storageservice.py#L2453-L2525
def _trj_store_trajectory(self, traj, only_init=False, store_data=pypetconstants.STORE_DATA, max_depth=None): """ Stores a trajectory to an hdf5 file Stores all groups, parameters and results """ if not only_init: self._logger.info('Start stori...
[ "def", "_trj_store_trajectory", "(", "self", ",", "traj", ",", "only_init", "=", "False", ",", "store_data", "=", "pypetconstants", ".", "STORE_DATA", ",", "max_depth", "=", "None", ")", ":", "if", "not", "only_init", ":", "self", ".", "_logger", ".", "inf...
Stores a trajectory to an hdf5 file Stores all groups, parameters and results
[ "Stores", "a", "trajectory", "to", "an", "hdf5", "file" ]
python
test
alecthomas/voluptuous
voluptuous/schema_builder.py
https://github.com/alecthomas/voluptuous/blob/36c8c11e2b7eb402c24866fa558473661ede9403/voluptuous/schema_builder.py#L1256-L1301
def validate(*a, **kw): """Decorator for validating arguments of a function against a given schema. Set restrictions for arguments: >>> @validate(arg1=int, arg2=int) ... def foo(arg1, arg2): ... return arg1 * arg2 Set restriction for returned value: >>> @validate(arg=in...
[ "def", "validate", "(", "*", "a", ",", "*", "*", "kw", ")", ":", "RETURNS_KEY", "=", "'__return__'", "def", "validate_schema_decorator", "(", "func", ")", ":", "returns_defined", "=", "False", "returns", "=", "None", "schema_args_dict", "=", "_args_to_dict", ...
Decorator for validating arguments of a function against a given schema. Set restrictions for arguments: >>> @validate(arg1=int, arg2=int) ... def foo(arg1, arg2): ... return arg1 * arg2 Set restriction for returned value: >>> @validate(arg=int, __return__=int) ... ...
[ "Decorator", "for", "validating", "arguments", "of", "a", "function", "against", "a", "given", "schema", "." ]
python
train
BD2KOnFHIR/fhirtordf
fhirtordf/fhir/fhirmetavoc.py
https://github.com/BD2KOnFHIR/fhirtordf/blob/f97b3df683fa4caacf5cf4f29699ab060bcc0fbf/fhirtordf/fhir/fhirmetavoc.py#L94-L101
def is_valid(self, t: URIRef) -> bool: """ Raise an exception if 't' is unrecognized :param t: metadata URI """ if not self.has_type(t): raise TypeError("Unrecognized FHIR type: {}".format(t)) return True
[ "def", "is_valid", "(", "self", ",", "t", ":", "URIRef", ")", "->", "bool", ":", "if", "not", "self", ".", "has_type", "(", "t", ")", ":", "raise", "TypeError", "(", "\"Unrecognized FHIR type: {}\"", ".", "format", "(", "t", ")", ")", "return", "True" ...
Raise an exception if 't' is unrecognized :param t: metadata URI
[ "Raise", "an", "exception", "if", "t", "is", "unrecognized", ":", "param", "t", ":", "metadata", "URI" ]
python
train
log2timeline/dfvfs
dfvfs/file_io/lvm_file_io.py
https://github.com/log2timeline/dfvfs/blob/2b3ccd115f9901d89f383397d4a1376a873c83c4/dfvfs/file_io/lvm_file_io.py#L95-L110
def seek(self, offset, whence=os.SEEK_SET): """Seeks to an offset within the file-like object. Args: offset (int): offset to seek to. whence (Optional(int)): value that indicates whether offset is an absolute or relative position within the file. Raises: IOError: if the seek fa...
[ "def", "seek", "(", "self", ",", "offset", ",", "whence", "=", "os", ".", "SEEK_SET", ")", ":", "if", "not", "self", ".", "_is_open", ":", "raise", "IOError", "(", "'Not opened.'", ")", "self", ".", "_vslvm_logical_volume", ".", "seek", "(", "offset", ...
Seeks to an offset within the file-like object. Args: offset (int): offset to seek to. whence (Optional(int)): value that indicates whether offset is an absolute or relative position within the file. Raises: IOError: if the seek failed. OSError: if the seek failed.
[ "Seeks", "to", "an", "offset", "within", "the", "file", "-", "like", "object", "." ]
python
train
etcher-be/epab
epab/utils/_repo.py
https://github.com/etcher-be/epab/blob/024cde74d058281aa66e6e4b7b71dccbe803b1c1/epab/utils/_repo.py#L534-L542
def create_branch_and_checkout(self, branch_name: str): """ Creates a new branch if it doesn't exist Args: branch_name: branch name """ self.create_branch(branch_name) self.checkout(branch_name)
[ "def", "create_branch_and_checkout", "(", "self", ",", "branch_name", ":", "str", ")", ":", "self", ".", "create_branch", "(", "branch_name", ")", "self", ".", "checkout", "(", "branch_name", ")" ]
Creates a new branch if it doesn't exist Args: branch_name: branch name
[ "Creates", "a", "new", "branch", "if", "it", "doesn", "t", "exist" ]
python
train
skorch-dev/skorch
skorch/utils.py
https://github.com/skorch-dev/skorch/blob/5b9b8b7b7712cb6e5aaa759d9608ea6269d5bcd3/skorch/utils.py#L468-L483
def get_map_location(target_device, fallback_device='cpu'): """Determine the location to map loaded data (e.g., weights) for a given target device (e.g. 'cuda'). """ map_location = torch.device(target_device) # The user wants to use CUDA but there is no CUDA device # available, thus fall back t...
[ "def", "get_map_location", "(", "target_device", ",", "fallback_device", "=", "'cpu'", ")", ":", "map_location", "=", "torch", ".", "device", "(", "target_device", ")", "# The user wants to use CUDA but there is no CUDA device", "# available, thus fall back to CPU.", "if", ...
Determine the location to map loaded data (e.g., weights) for a given target device (e.g. 'cuda').
[ "Determine", "the", "location", "to", "map", "loaded", "data", "(", "e", ".", "g", ".", "weights", ")", "for", "a", "given", "target", "device", "(", "e", ".", "g", ".", "cuda", ")", "." ]
python
train
apache/incubator-mxnet
python/mxnet/module/executor_group.py
https://github.com/apache/incubator-mxnet/blob/1af29e9c060a4c7d60eeaacba32afdb9a7775ba7/python/mxnet/module/executor_group.py#L307-L342
def _collect_arrays(self): """Collect internal arrays from executors.""" # convenient data structures self.data_arrays = [[(self.slices[i], e.arg_dict[name]) for i, e in enumerate(self.execs)] for name, _ in self.data_shapes] self.state_arrays = [[e.arg_dict[...
[ "def", "_collect_arrays", "(", "self", ")", ":", "# convenient data structures", "self", ".", "data_arrays", "=", "[", "[", "(", "self", ".", "slices", "[", "i", "]", ",", "e", ".", "arg_dict", "[", "name", "]", ")", "for", "i", ",", "e", "in", "enum...
Collect internal arrays from executors.
[ "Collect", "internal", "arrays", "from", "executors", "." ]
python
train
saltstack/salt
salt/states/monit.py
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/monit.py#L34-L65
def monitor(name): ''' Get the summary from module monit and try to see if service is being monitored. If not then monitor the service. ''' ret = {'result': None, 'name': name, 'comment': '', 'changes': {} } result = __salt__['monit.summary'](name) ...
[ "def", "monitor", "(", "name", ")", ":", "ret", "=", "{", "'result'", ":", "None", ",", "'name'", ":", "name", ",", "'comment'", ":", "''", ",", "'changes'", ":", "{", "}", "}", "result", "=", "__salt__", "[", "'monit.summary'", "]", "(", "name", "...
Get the summary from module monit and try to see if service is being monitored. If not then monitor the service.
[ "Get", "the", "summary", "from", "module", "monit", "and", "try", "to", "see", "if", "service", "is", "being", "monitored", ".", "If", "not", "then", "monitor", "the", "service", "." ]
python
train
sibirrer/lenstronomy
lenstronomy/LightModel/light_model.py
https://github.com/sibirrer/lenstronomy/blob/4edb100a4f3f4fdc4fac9b0032d2b0283d0aa1d6/lenstronomy/LightModel/light_model.py#L90-L99
def param_name_list(self): """ returns the list of all parameter names :return: list of list of strings (for each light model separately) """ name_list = [] for func in self.func_list: name_list.append(func.param_names) return name_list
[ "def", "param_name_list", "(", "self", ")", ":", "name_list", "=", "[", "]", "for", "func", "in", "self", ".", "func_list", ":", "name_list", ".", "append", "(", "func", ".", "param_names", ")", "return", "name_list" ]
returns the list of all parameter names :return: list of list of strings (for each light model separately)
[ "returns", "the", "list", "of", "all", "parameter", "names" ]
python
train
yougov/pmxbot
pmxbot/core.py
https://github.com/yougov/pmxbot/blob/5da84a3258a0fd73cb35b60e39769a5d7bfb2ba7/pmxbot/core.py#L583-L591
def init_config(overrides): """ Install the config dict as pmxbot.config, setting overrides, and return the result. """ pmxbot.config = config = ConfigDict() config.setdefault('bot_nickname', 'pmxbot') config.update(overrides) return config
[ "def", "init_config", "(", "overrides", ")", ":", "pmxbot", ".", "config", "=", "config", "=", "ConfigDict", "(", ")", "config", ".", "setdefault", "(", "'bot_nickname'", ",", "'pmxbot'", ")", "config", ".", "update", "(", "overrides", ")", "return", "conf...
Install the config dict as pmxbot.config, setting overrides, and return the result.
[ "Install", "the", "config", "dict", "as", "pmxbot", ".", "config", "setting", "overrides", "and", "return", "the", "result", "." ]
python
train
wavycloud/pyboto3
pyboto3/swf.py
https://github.com/wavycloud/pyboto3/blob/924957ccf994303713a4eed90b775ff2ab95b2e5/pyboto3/swf.py#L1483-L1693
def list_closed_workflow_executions(domain=None, startTimeFilter=None, closeTimeFilter=None, executionFilter=None, closeStatusFilter=None, typeFilter=None, tagFilter=None, nextPageToken=None, maximumPageSize=None, reverseOrder=None): """ Returns a list of closed workflow executions in the specified domain that ...
[ "def", "list_closed_workflow_executions", "(", "domain", "=", "None", ",", "startTimeFilter", "=", "None", ",", "closeTimeFilter", "=", "None", ",", "executionFilter", "=", "None", ",", "closeStatusFilter", "=", "None", ",", "typeFilter", "=", "None", ",", "tagF...
Returns a list of closed workflow executions in the specified domain that meet the filtering criteria. The results may be split into multiple pages. To retrieve subsequent pages, make the call again using the nextPageToken returned by the initial call. Access Control You can use IAM policies to control this act...
[ "Returns", "a", "list", "of", "closed", "workflow", "executions", "in", "the", "specified", "domain", "that", "meet", "the", "filtering", "criteria", ".", "The", "results", "may", "be", "split", "into", "multiple", "pages", ".", "To", "retrieve", "subsequent",...
python
train
binarydud/pyres
pyres/worker.py
https://github.com/binarydud/pyres/blob/4f4b28257afe5b7a08fd38a063fad7ce62c03ae2/pyres/worker.py#L121-L153
def work(self, interval=5): """Invoked by ``run`` method. ``work`` listens on a list of queues and sleeps for ``interval`` time. ``interval`` -- Number of seconds the worker will wait until processing the next job. Default is "5". Whenever a worker finds a job on the queue it first cal...
[ "def", "work", "(", "self", ",", "interval", "=", "5", ")", ":", "self", ".", "_setproctitle", "(", "\"Starting\"", ")", "logger", ".", "info", "(", "\"starting\"", ")", "self", ".", "startup", "(", ")", "while", "True", ":", "if", "self", ".", "_shu...
Invoked by ``run`` method. ``work`` listens on a list of queues and sleeps for ``interval`` time. ``interval`` -- Number of seconds the worker will wait until processing the next job. Default is "5". Whenever a worker finds a job on the queue it first calls ``reserve`` on that job to m...
[ "Invoked", "by", "run", "method", ".", "work", "listens", "on", "a", "list", "of", "queues", "and", "sleeps", "for", "interval", "time", "." ]
python
train
ActivisionGameScience/assertpy
assertpy/assertpy.py
https://github.com/ActivisionGameScience/assertpy/blob/08d799cdb01f9a25d3e20672efac991c7bc26d79/assertpy/assertpy.py#L278-L292
def does_not_contain(self, *items): """Asserts that val does not contain the given item or items.""" if len(items) == 0: raise ValueError('one or more args must be given') elif len(items) == 1: if items[0] in self.val: self._err('Expected <%s> to not conta...
[ "def", "does_not_contain", "(", "self", ",", "*", "items", ")", ":", "if", "len", "(", "items", ")", "==", "0", ":", "raise", "ValueError", "(", "'one or more args must be given'", ")", "elif", "len", "(", "items", ")", "==", "1", ":", "if", "items", "...
Asserts that val does not contain the given item or items.
[ "Asserts", "that", "val", "does", "not", "contain", "the", "given", "item", "or", "items", "." ]
python
valid
cuihantao/andes
andes/filters/__init__.py
https://github.com/cuihantao/andes/blob/7067898d4f26ce7534e968b8486c4aa8fe3a511a/andes/filters/__init__.py#L32-L85
def guess(system): """ input format guess function. First guess by extension, then test by lines """ files = system.files maybe = [] if files.input_format: maybe.append(files.input_format) # first, guess by extension for key, val in input_formats.items(): if type(val) == ...
[ "def", "guess", "(", "system", ")", ":", "files", "=", "system", ".", "files", "maybe", "=", "[", "]", "if", "files", ".", "input_format", ":", "maybe", ".", "append", "(", "files", ".", "input_format", ")", "# first, guess by extension", "for", "key", "...
input format guess function. First guess by extension, then test by lines
[ "input", "format", "guess", "function", ".", "First", "guess", "by", "extension", "then", "test", "by", "lines" ]
python
train
titusjan/argos
argos/widgets/mainwindow.py
https://github.com/titusjan/argos/blob/20d0a3cae26c36ea789a5d219c02ca7df21279dd/argos/widgets/mainwindow.py#L105-L115
def finalize(self): """ Is called before destruction (when closing). Can be used to clean-up resources. """ logger.debug("Finalizing: {}".format(self)) # Disconnect signals self.collector.sigContentsChanged.disconnect(self.collectorContentsChanged) self._conf...
[ "def", "finalize", "(", "self", ")", ":", "logger", ".", "debug", "(", "\"Finalizing: {}\"", ".", "format", "(", "self", ")", ")", "# Disconnect signals", "self", ".", "collector", ".", "sigContentsChanged", ".", "disconnect", "(", "self", ".", "collectorConte...
Is called before destruction (when closing). Can be used to clean-up resources.
[ "Is", "called", "before", "destruction", "(", "when", "closing", ")", ".", "Can", "be", "used", "to", "clean", "-", "up", "resources", "." ]
python
train
tanghaibao/jcvi
jcvi/algorithms/graph.py
https://github.com/tanghaibao/jcvi/blob/d2e31a77b6ade7f41f3b321febc2b4744d1cdeca/jcvi/algorithms/graph.py#L370-L382
def make_paths(paths, weights=None): """ Zip together paths. Called by merge_paths(). """ npaths = len(paths) weights = weights or [1] * npaths assert len(paths) == len(weights) G = nx.DiGraph() for path, w in zip(paths, weights): for a, b in pairwise(path): update_w...
[ "def", "make_paths", "(", "paths", ",", "weights", "=", "None", ")", ":", "npaths", "=", "len", "(", "paths", ")", "weights", "=", "weights", "or", "[", "1", "]", "*", "npaths", "assert", "len", "(", "paths", ")", "==", "len", "(", "weights", ")", ...
Zip together paths. Called by merge_paths().
[ "Zip", "together", "paths", ".", "Called", "by", "merge_paths", "()", "." ]
python
train
datamachine/twx.botapi
twx/botapi/botapi.py
https://github.com/datamachine/twx.botapi/blob/c85184da738169e8f9d6d8e62970540f427c486e/twx/botapi/botapi.py#L4370-L4372
def leave_chat(self, *args, **kwargs): """See :func:`leave_chat_member`""" return leave_chat(*args, **self._merge_overrides(**kwargs)).run()
[ "def", "leave_chat", "(", "self", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "return", "leave_chat", "(", "*", "args", ",", "*", "*", "self", ".", "_merge_overrides", "(", "*", "*", "kwargs", ")", ")", ".", "run", "(", ")" ]
See :func:`leave_chat_member`
[ "See", ":", "func", ":", "leave_chat_member" ]
python
train
hobson/pug-invest
pug/invest/plot.py
https://github.com/hobson/pug-invest/blob/836911258a0e920083a88c91beae88eefdebb20c/pug/invest/plot.py#L277-L291
def prettify_datetimes(datetimes, format="%b %Y", max_nonempty_strings=None, blank=''): """Designed for composing lists of strings suitable for pyplot axis labels Often the xtick spacing doesn't allow room for 100's of text labels, so this eliminates every other one, then every other one of those, until th...
[ "def", "prettify_datetimes", "(", "datetimes", ",", "format", "=", "\"%b %Y\"", ",", "max_nonempty_strings", "=", "None", ",", "blank", "=", "''", ")", ":", "# blank some labels to make sure they don't overlap", "datetimes", "=", "[", "make_datetime", "(", "d", ")",...
Designed for composing lists of strings suitable for pyplot axis labels Often the xtick spacing doesn't allow room for 100's of text labels, so this eliminates every other one, then every other one of those, until they fit. >>> thin_string_list(['x']*20, 5) # doctring: +NORMALIZE_WHITESPACE ['x', '',...
[ "Designed", "for", "composing", "lists", "of", "strings", "suitable", "for", "pyplot", "axis", "labels" ]
python
train
salu133445/pypianoroll
pypianoroll/multitrack.py
https://github.com/salu133445/pypianoroll/blob/6224dc1e29222de2124d249acb80f3d072166917/pypianoroll/multitrack.py#L486-L538
def merge_tracks(self, track_indices=None, mode='sum', program=0, is_drum=False, name='merged', remove_merged=False): """ Merge pianorolls of the tracks specified by `track_indices`. The merged track will have program number as given by `program` and drum indicator a...
[ "def", "merge_tracks", "(", "self", ",", "track_indices", "=", "None", ",", "mode", "=", "'sum'", ",", "program", "=", "0", ",", "is_drum", "=", "False", ",", "name", "=", "'merged'", ",", "remove_merged", "=", "False", ")", ":", "if", "mode", "not", ...
Merge pianorolls of the tracks specified by `track_indices`. The merged track will have program number as given by `program` and drum indicator as given by `is_drum`. The merged track will be appended at the end of the track list. Parameters ---------- track_indices : li...
[ "Merge", "pianorolls", "of", "the", "tracks", "specified", "by", "track_indices", ".", "The", "merged", "track", "will", "have", "program", "number", "as", "given", "by", "program", "and", "drum", "indicator", "as", "given", "by", "is_drum", ".", "The", "mer...
python
train
senaite/senaite.core
bika/lims/browser/analyses/view.py
https://github.com/senaite/senaite.core/blob/7602ce2ea2f9e81eb34e20ce17b98a3e70713f85/bika/lims/browser/analyses/view.py#L323-L345
def is_uncertainty_edition_allowed(self, analysis_brain): """Checks if the edition of the uncertainty field is allowed :param analysis_brain: Brain that represents an analysis :return: True if the user can edit the result field, otherwise False """ # Only allow to edit the unce...
[ "def", "is_uncertainty_edition_allowed", "(", "self", ",", "analysis_brain", ")", ":", "# Only allow to edit the uncertainty if result edition is allowed", "if", "not", "self", ".", "is_result_edition_allowed", "(", "analysis_brain", ")", ":", "return", "False", "# Get the an...
Checks if the edition of the uncertainty field is allowed :param analysis_brain: Brain that represents an analysis :return: True if the user can edit the result field, otherwise False
[ "Checks", "if", "the", "edition", "of", "the", "uncertainty", "field", "is", "allowed" ]
python
train
facelessuser/backrefs
backrefs/uniprops/__init__.py
https://github.com/facelessuser/backrefs/blob/3b3d60f5d57b02044f880aa29c9c5add0e31a34f/backrefs/uniprops/__init__.py#L271-L282
def get_numeric_type_property(value, is_bytes=False): """Get `NUMERIC TYPE` property.""" obj = unidata.ascii_numeric_type if is_bytes else unidata.unicode_numeric_type if value.startswith('^'): negated = value[1:] value = '^' + unidata.unicode_alias['numerictype'].get(negated, negated) ...
[ "def", "get_numeric_type_property", "(", "value", ",", "is_bytes", "=", "False", ")", ":", "obj", "=", "unidata", ".", "ascii_numeric_type", "if", "is_bytes", "else", "unidata", ".", "unicode_numeric_type", "if", "value", ".", "startswith", "(", "'^'", ")", ":...
Get `NUMERIC TYPE` property.
[ "Get", "NUMERIC", "TYPE", "property", "." ]
python
train
carpyncho/feets
feets/datasets/synthetic.py
https://github.com/carpyncho/feets/blob/53bdfb73b53845561914fc1f756e0c2377b9b76b/feets/datasets/synthetic.py#L63-L135
def create_random(magf, magf_params, errf, errf_params, timef=np.linspace, timef_params=None, size=DEFAULT_SIZE, id=None, ds_name=DS_NAME, description=DESCRIPTION, bands=BANDS, metadata=METADATA): """Generate a data with any given random function. Parameter...
[ "def", "create_random", "(", "magf", ",", "magf_params", ",", "errf", ",", "errf_params", ",", "timef", "=", "np", ".", "linspace", ",", "timef_params", "=", "None", ",", "size", "=", "DEFAULT_SIZE", ",", "id", "=", "None", ",", "ds_name", "=", "DS_NAME"...
Generate a data with any given random function. Parameters ---------- magf : callable Function to generate the magnitudes. magf_params : dict-like Parameters to feed the `magf` function. errf : callable Function to generate the magnitudes. errf_params : dict-like ...
[ "Generate", "a", "data", "with", "any", "given", "random", "function", "." ]
python
train
hawkular/hawkular-client-python
hawkular/alerts/triggers.py
https://github.com/hawkular/hawkular-client-python/blob/52371f9ebabbe310efee2a8ff8eb735ccc0654bb/hawkular/alerts/triggers.py#L132-L148
def get(self, tags=[], trigger_ids=[]): """ Get triggers with optional filtering. Querying without parameters returns all the trigger definitions. :param tags: Fetch triggers with matching tags only. Use * to match all values. :param trigger_ids: List of triggerIds to fetch """ ...
[ "def", "get", "(", "self", ",", "tags", "=", "[", "]", ",", "trigger_ids", "=", "[", "]", ")", ":", "params", "=", "{", "}", "if", "len", "(", "tags", ")", ">", "0", ":", "params", "[", "'tags'", "]", "=", "','", ".", "join", "(", "tags", "...
Get triggers with optional filtering. Querying without parameters returns all the trigger definitions. :param tags: Fetch triggers with matching tags only. Use * to match all values. :param trigger_ids: List of triggerIds to fetch
[ "Get", "triggers", "with", "optional", "filtering", ".", "Querying", "without", "parameters", "returns", "all", "the", "trigger", "definitions", "." ]
python
train
yunojuno-archive/django-package-monitor
package_monitor/pypi.py
https://github.com/yunojuno-archive/django-package-monitor/blob/534aa35ccfe187d2c55aeca0cb52b8278254e437/package_monitor/pypi.py#L85-L93
def data(self): """Fetch latest data from PyPI, and cache for 30s.""" key = cache_key(self.name) data = cache.get(key) if data is None: logger.debug("Updating package info for %s from PyPI.", self.name) data = requests.get(self.url).json() cache.set(ke...
[ "def", "data", "(", "self", ")", ":", "key", "=", "cache_key", "(", "self", ".", "name", ")", "data", "=", "cache", ".", "get", "(", "key", ")", "if", "data", "is", "None", ":", "logger", ".", "debug", "(", "\"Updating package info for %s from PyPI.\"", ...
Fetch latest data from PyPI, and cache for 30s.
[ "Fetch", "latest", "data", "from", "PyPI", "and", "cache", "for", "30s", "." ]
python
train
qzmfranklin/easyshell
easyshell/basic_shell.py
https://github.com/qzmfranklin/easyshell/blob/00c2e90e7767d32e7e127fc8c6875845aa308295/easyshell/basic_shell.py#L151-L178
def _do_help(self, cmd, args): """Display doc strings of the shell and its commands. """ print(self.doc_string()) print() # Create data of the commands table. data_unsorted = [] cls = self.__class__ for name in dir(cls): obj = getattr(cls, nam...
[ "def", "_do_help", "(", "self", ",", "cmd", ",", "args", ")", ":", "print", "(", "self", ".", "doc_string", "(", ")", ")", "print", "(", ")", "# Create data of the commands table.", "data_unsorted", "=", "[", "]", "cls", "=", "self", ".", "__class__", "f...
Display doc strings of the shell and its commands.
[ "Display", "doc", "strings", "of", "the", "shell", "and", "its", "commands", "." ]
python
train
jrfonseca/gprof2dot
gprof2dot.py
https://github.com/jrfonseca/gprof2dot/blob/0500e89f001e555f5eaa32e70793b4875f2f70db/gprof2dot.py#L484-L515
def integrate(self, outevent, inevent): """Propagate function time ratio along the function calls. Must be called after finding the cycles. See also: - http://citeseer.ist.psu.edu/graham82gprof.html """ # Sanity checking assert outevent not in self for ...
[ "def", "integrate", "(", "self", ",", "outevent", ",", "inevent", ")", ":", "# Sanity checking", "assert", "outevent", "not", "in", "self", "for", "function", "in", "compat_itervalues", "(", "self", ".", "functions", ")", ":", "assert", "outevent", "not", "i...
Propagate function time ratio along the function calls. Must be called after finding the cycles. See also: - http://citeseer.ist.psu.edu/graham82gprof.html
[ "Propagate", "function", "time", "ratio", "along", "the", "function", "calls", "." ]
python
train
myint/cppclean
cpp/symbols.py
https://github.com/myint/cppclean/blob/8a20c943dca1049e87d57137938f92d7735828dc/cpp/symbols.py#L64-L85
def _lookup_global(self, symbol): """Helper for lookup_symbol that only looks up global variables. Args: symbol: Symbol """ assert symbol.parts namespace = self.namespaces if len(symbol.parts) == 1: # If there is only one part, look in globals. ...
[ "def", "_lookup_global", "(", "self", ",", "symbol", ")", ":", "assert", "symbol", ".", "parts", "namespace", "=", "self", ".", "namespaces", "if", "len", "(", "symbol", ".", "parts", ")", "==", "1", ":", "# If there is only one part, look in globals.", "names...
Helper for lookup_symbol that only looks up global variables. Args: symbol: Symbol
[ "Helper", "for", "lookup_symbol", "that", "only", "looks", "up", "global", "variables", "." ]
python
train
tensorlayer/tensorlayer
tensorlayer/iterate.py
https://github.com/tensorlayer/tensorlayer/blob/aa9e52e36c7058a7e6fd81d36563ca6850b21956/tensorlayer/iterate.py#L15-L72
def minibatches(inputs=None, targets=None, batch_size=None, allow_dynamic_batch_size=False, shuffle=False): """Generate a generator that input a group of example in numpy.array and their labels, return the examples and labels by the given batch size. Parameters ---------- inputs : numpy.array ...
[ "def", "minibatches", "(", "inputs", "=", "None", ",", "targets", "=", "None", ",", "batch_size", "=", "None", ",", "allow_dynamic_batch_size", "=", "False", ",", "shuffle", "=", "False", ")", ":", "if", "len", "(", "inputs", ")", "!=", "len", "(", "ta...
Generate a generator that input a group of example in numpy.array and their labels, return the examples and labels by the given batch size. Parameters ---------- inputs : numpy.array The input features, every row is a example. targets : numpy.array The labels of inputs, every row is...
[ "Generate", "a", "generator", "that", "input", "a", "group", "of", "example", "in", "numpy", ".", "array", "and", "their", "labels", "return", "the", "examples", "and", "labels", "by", "the", "given", "batch", "size", "." ]
python
valid
moonso/loqusdb
loqusdb/utils/annotate.py
https://github.com/moonso/loqusdb/blob/792dcd0d461aff5adc703c49eebf58964913a513/loqusdb/utils/annotate.py#L32-L43
def annotate_snv(adpter, variant): """Annotate an SNV/INDEL variant Args: adapter(loqusdb.plugin.adapter) variant(cyvcf2.Variant) """ variant_id = get_variant_id(variant) variant_obj = adapter.get_variant(variant={'_id':variant_id}) annotated_variant = annotated_variant...
[ "def", "annotate_snv", "(", "adpter", ",", "variant", ")", ":", "variant_id", "=", "get_variant_id", "(", "variant", ")", "variant_obj", "=", "adapter", ".", "get_variant", "(", "variant", "=", "{", "'_id'", ":", "variant_id", "}", ")", "annotated_variant", ...
Annotate an SNV/INDEL variant Args: adapter(loqusdb.plugin.adapter) variant(cyvcf2.Variant)
[ "Annotate", "an", "SNV", "/", "INDEL", "variant", "Args", ":", "adapter", "(", "loqusdb", ".", "plugin", ".", "adapter", ")", "variant", "(", "cyvcf2", ".", "Variant", ")" ]
python
train
nkmathew/yasi-sexp-indenter
yasi.py
https://github.com/nkmathew/yasi-sexp-indenter/blob/6ec2a4675e79606c555bcb67494a0ba994b05805/yasi.py#L314-L336
def is_macro_name(func_name, dialect): """ is_macro_name(func_name : str, dialect : str) -> bool >>> is_macro_name('yacc:define-parser') True Tests if a word is a macro using the language's/dialect's convention, e.g macros in Lisp usually start with 'def' and 'with' in Scheme. Saves the effort...
[ "def", "is_macro_name", "(", "func_name", ",", "dialect", ")", ":", "if", "not", "func_name", ":", "return", "False", "if", "dialect", "==", "'lisp'", ":", "return", "re", ".", "search", "(", "'^(macro|def|do|with-)'", ",", "func_name", ",", "re", ".", "I"...
is_macro_name(func_name : str, dialect : str) -> bool >>> is_macro_name('yacc:define-parser') True Tests if a word is a macro using the language's/dialect's convention, e.g macros in Lisp usually start with 'def' and 'with' in Scheme. Saves the effort of finding all the macros in Lisp/Scheme/Cloju...
[ "is_macro_name", "(", "func_name", ":", "str", "dialect", ":", "str", ")", "-", ">", "bool" ]
python
train
iron-io/iron_core_python
iron_core.py
https://github.com/iron-io/iron_core_python/blob/f09a160a854912efcb75a810702686bc25b74fa8/iron_core.py#L209-L270
def request(self, url, method, body="", headers={}, retry=True): """Execute an HTTP request and return a dict containing the response and the response status code. Keyword arguments: url -- The path to execute the result against, not including the API version or project I...
[ "def", "request", "(", "self", ",", "url", ",", "method", ",", "body", "=", "\"\"", ",", "headers", "=", "{", "}", ",", "retry", "=", "True", ")", ":", "if", "headers", ":", "headers", "=", "dict", "(", "list", "(", "headers", ".", "items", "(", ...
Execute an HTTP request and return a dict containing the response and the response status code. Keyword arguments: url -- The path to execute the result against, not including the API version or project ID, with no leading /. Required. method -- The HTTP method to use. Re...
[ "Execute", "an", "HTTP", "request", "and", "return", "a", "dict", "containing", "the", "response", "and", "the", "response", "status", "code", "." ]
python
train
sixty-north/cosmic-ray
src/cosmic_ray/mutating.py
https://github.com/sixty-north/cosmic-ray/blob/c654e074afbb7b7fcbc23359083c1287c0d3e991/src/cosmic_ray/mutating.py#L33-L56
def apply_mutation(module_path, operator, occurrence): """Apply a specific mutation to a file on disk. Args: module_path: The path to the module to mutate. operator: The `operator` instance to use. occurrence: The occurrence of the operator to apply. Returns: A `(unmutated-code, mu...
[ "def", "apply_mutation", "(", "module_path", ",", "operator", ",", "occurrence", ")", ":", "module_ast", "=", "get_ast", "(", "module_path", ",", "python_version", "=", "operator", ".", "python_version", ")", "original_code", "=", "module_ast", ".", "get_code", ...
Apply a specific mutation to a file on disk. Args: module_path: The path to the module to mutate. operator: The `operator` instance to use. occurrence: The occurrence of the operator to apply. Returns: A `(unmutated-code, mutated-code)` tuple to the with-block. If there was no ...
[ "Apply", "a", "specific", "mutation", "to", "a", "file", "on", "disk", "." ]
python
train
sbarham/dsrt
build/lib/dsrt/application/Context.py
https://github.com/sbarham/dsrt/blob/bc664739f2f52839461d3e72773b71146fd56a9a/build/lib/dsrt/application/Context.py#L52-L59
def build_model(self): '''Find out the type of model configured and dispatch the request to the appropriate method''' if self.model_config['model-type']: return self.build_red() elif self.model_config['model-type']: return self.buidl_hred() else: raise...
[ "def", "build_model", "(", "self", ")", ":", "if", "self", ".", "model_config", "[", "'model-type'", "]", ":", "return", "self", ".", "build_red", "(", ")", "elif", "self", ".", "model_config", "[", "'model-type'", "]", ":", "return", "self", ".", "buidl...
Find out the type of model configured and dispatch the request to the appropriate method
[ "Find", "out", "the", "type", "of", "model", "configured", "and", "dispatch", "the", "request", "to", "the", "appropriate", "method" ]
python
train
gbiggs/rtctree
rtctree/manager.py
https://github.com/gbiggs/rtctree/blob/bd725a47ac87c259c8bce06156ccc9ab71111c26/rtctree/manager.py#L198-L213
def delete_component(self, instance_name): '''Delete a component. Deletes the component specified by @ref instance_name from the manager. This will invalidate any objects that are children of this node. @param instance_name The instance name of the component to delete. @raises ...
[ "def", "delete_component", "(", "self", ",", "instance_name", ")", ":", "with", "self", ".", "_mutex", ":", "if", "self", ".", "_obj", ".", "delete_component", "(", "instance_name", ")", "!=", "RTC", ".", "RTC_OK", ":", "raise", "exceptions", ".", "FailedT...
Delete a component. Deletes the component specified by @ref instance_name from the manager. This will invalidate any objects that are children of this node. @param instance_name The instance name of the component to delete. @raises FailedToDeleteComponentError
[ "Delete", "a", "component", "." ]
python
train
raiden-network/raiden
raiden/ui/cli.py
https://github.com/raiden-network/raiden/blob/407ba15c72074e9de88771d6b9661ff4dc36bef5/raiden/ui/cli.py#L64-L461
def options(func): """Having the common app options as a decorator facilitates reuse.""" # Until https://github.com/pallets/click/issues/926 is fixed the options need to be re-defined # for every use options_ = [ option( '--datadir', help='Directory for storing raiden da...
[ "def", "options", "(", "func", ")", ":", "# Until https://github.com/pallets/click/issues/926 is fixed the options need to be re-defined", "# for every use", "options_", "=", "[", "option", "(", "'--datadir'", ",", "help", "=", "'Directory for storing raiden data.'", ",", "defa...
Having the common app options as a decorator facilitates reuse.
[ "Having", "the", "common", "app", "options", "as", "a", "decorator", "facilitates", "reuse", "." ]
python
train
vanheeringen-lab/gimmemotifs
gimmemotifs/scanner.py
https://github.com/vanheeringen-lab/gimmemotifs/blob/1dc0572179e5d0c8f96958060133c1f8d92c6675/gimmemotifs/scanner.py#L533-L548
def best_score(self, seqs, scan_rc=True, normalize=False): """ give the score of the best match of each motif in each sequence returns an iterator of lists containing floats """ self.set_threshold(threshold=0.0) if normalize and len(self.meanstd) == 0: self.se...
[ "def", "best_score", "(", "self", ",", "seqs", ",", "scan_rc", "=", "True", ",", "normalize", "=", "False", ")", ":", "self", ".", "set_threshold", "(", "threshold", "=", "0.0", ")", "if", "normalize", "and", "len", "(", "self", ".", "meanstd", ")", ...
give the score of the best match of each motif in each sequence returns an iterator of lists containing floats
[ "give", "the", "score", "of", "the", "best", "match", "of", "each", "motif", "in", "each", "sequence", "returns", "an", "iterator", "of", "lists", "containing", "floats" ]
python
train
DLR-RM/RAFCON
source/rafcon/utils/filesystem.py
https://github.com/DLR-RM/RAFCON/blob/24942ef1a904531f49ab8830a1dbb604441be498/source/rafcon/utils/filesystem.py#L37-L52
def get_md5_file_hash(filename): """Calculates the MD5 hash of a file :param str filename: The filename (including the path) of the file :return: Md5 hash of the file :rtype: str """ import hashlib BLOCKSIZE = 65536 hasher = hashlib.md5() with open(filename, 'rb') as afile: ...
[ "def", "get_md5_file_hash", "(", "filename", ")", ":", "import", "hashlib", "BLOCKSIZE", "=", "65536", "hasher", "=", "hashlib", ".", "md5", "(", ")", "with", "open", "(", "filename", ",", "'rb'", ")", "as", "afile", ":", "buf", "=", "afile", ".", "rea...
Calculates the MD5 hash of a file :param str filename: The filename (including the path) of the file :return: Md5 hash of the file :rtype: str
[ "Calculates", "the", "MD5", "hash", "of", "a", "file" ]
python
train
bitesofcode/projexui
projexui/widgets/xviewwidget/xviewprofilemanagermenu.py
https://github.com/bitesofcode/projexui/blob/f18a73bec84df90b034ca69b9deea118dbedfc4d/projexui/widgets/xviewwidget/xviewprofilemanagermenu.py#L44-L55
def removeProfile( self ): """ Removes the current profile from the system. """ manager = self.parent() prof = manager.currentProfile() opts = QMessageBox.Yes | QMessageBox.No question = 'Are you sure you want to remove "%s"?' % prof.name() answer...
[ "def", "removeProfile", "(", "self", ")", ":", "manager", "=", "self", ".", "parent", "(", ")", "prof", "=", "manager", ".", "currentProfile", "(", ")", "opts", "=", "QMessageBox", ".", "Yes", "|", "QMessageBox", ".", "No", "question", "=", "'Are you sur...
Removes the current profile from the system.
[ "Removes", "the", "current", "profile", "from", "the", "system", "." ]
python
train
cloud9ers/gurumate
environment/lib/python2.7/site-packages/IPython/parallel/client/magics.py
https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/parallel/client/magics.py#L346-L352
def _disable_autopx(self): """Disable %autopx by restoring the original InteractiveShell.run_cell. """ if self._autopx: self.shell.run_cell = self._original_run_cell self._autopx = False print "%autopx disabled"
[ "def", "_disable_autopx", "(", "self", ")", ":", "if", "self", ".", "_autopx", ":", "self", ".", "shell", ".", "run_cell", "=", "self", ".", "_original_run_cell", "self", ".", "_autopx", "=", "False", "print", "\"%autopx disabled\"" ]
Disable %autopx by restoring the original InteractiveShell.run_cell.
[ "Disable", "%autopx", "by", "restoring", "the", "original", "InteractiveShell", ".", "run_cell", "." ]
python
test
wright-group/WrightTools
WrightTools/data/_data.py
https://github.com/wright-group/WrightTools/blob/80d3ddd5074d8d5c1bc03fd5a0e0f10d4b424aeb/WrightTools/data/_data.py#L1078-L1171
def map_variable( self, variable, points, input_units="same", *, name=None, parent=None, verbose=True ) -> "Data": """Map points of an axis to new points using linear interpolation. Out-of-bounds points are written nan. Parameters ---------- variable : string ...
[ "def", "map_variable", "(", "self", ",", "variable", ",", "points", ",", "input_units", "=", "\"same\"", ",", "*", ",", "name", "=", "None", ",", "parent", "=", "None", ",", "verbose", "=", "True", ")", "->", "\"Data\"", ":", "# get variable index", "var...
Map points of an axis to new points using linear interpolation. Out-of-bounds points are written nan. Parameters ---------- variable : string The variable to map onto. points : array-like or int If array, the new points. If int, new points will have the ...
[ "Map", "points", "of", "an", "axis", "to", "new", "points", "using", "linear", "interpolation", "." ]
python
train
PmagPy/PmagPy
programs/replace_ac_specimens.py
https://github.com/PmagPy/PmagPy/blob/c7984f8809bf40fe112e53dcc311a33293b62d0b/programs/replace_ac_specimens.py#L6-L96
def main(): """ NAME replace_AC_specimens.py DESCRIPTION finds anisotropy corrected data and replaces that specimen with it. puts in pmag_specimen format file SYNTAX replace_AC_specimens.py [command line options] OPTIONS -h prints help mes...
[ "def", "main", "(", ")", ":", "dir_path", "=", "'.'", "tspec", "=", "\"thellier_specimens.txt\"", "aspec", "=", "\"AC_specimens.txt\"", "ofile", "=", "\"TorAC_specimens.txt\"", "critfile", "=", "\"pmag_criteria.txt\"", "ACSamplist", ",", "Samplist", ",", "sigmin", "...
NAME replace_AC_specimens.py DESCRIPTION finds anisotropy corrected data and replaces that specimen with it. puts in pmag_specimen format file SYNTAX replace_AC_specimens.py [command line options] OPTIONS -h prints help message and quits -...
[ "NAME", "replace_AC_specimens", ".", "py", "DESCRIPTION", "finds", "anisotropy", "corrected", "data", "and", "replaces", "that", "specimen", "with", "it", ".", "puts", "in", "pmag_specimen", "format", "file", "SYNTAX", "replace_AC_specimens", ".", "py", "[", "comm...
python
train
m32/endesive
endesive/pdf/fpdf/html.py
https://github.com/m32/endesive/blob/973091dc69847fe2df594c80ac9235a8d08460ff/endesive/pdf/fpdf/html.py#L397-L401
def write_html(self, text, image_map=None): "Parse HTML and convert it to PDF" h2p = HTML2FPDF(self, image_map) text = h2p.unescape(text) # To deal with HTML entities h2p.feed(text)
[ "def", "write_html", "(", "self", ",", "text", ",", "image_map", "=", "None", ")", ":", "h2p", "=", "HTML2FPDF", "(", "self", ",", "image_map", ")", "text", "=", "h2p", ".", "unescape", "(", "text", ")", "# To deal with HTML entities", "h2p", ".", "feed"...
Parse HTML and convert it to PDF
[ "Parse", "HTML", "and", "convert", "it", "to", "PDF" ]
python
train
pypa/pipenv
pipenv/utils.py
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/utils.py#L1505-L1530
def handle_remove_readonly(func, path, exc): """Error handler for shutil.rmtree. Windows source repo folders are read-only by default, so this error handler attempts to set them as writeable and then proceed with deletion.""" # Check for read-only attribute default_warning_message = ( "Unab...
[ "def", "handle_remove_readonly", "(", "func", ",", "path", ",", "exc", ")", ":", "# Check for read-only attribute", "default_warning_message", "=", "(", "\"Unable to remove file due to permissions restriction: {!r}\"", ")", "# split the initial exception out into its type, exception,...
Error handler for shutil.rmtree. Windows source repo folders are read-only by default, so this error handler attempts to set them as writeable and then proceed with deletion.
[ "Error", "handler", "for", "shutil", ".", "rmtree", "." ]
python
train
useblocks/groundwork
groundwork/pluginmanager.py
https://github.com/useblocks/groundwork/blob/d34fce43f54246ca4db0f7b89e450dcdc847c68c/groundwork/pluginmanager.py#L229-L243
def get(self, name=None): """ Returns the plugin object with the given name. Or if a name is not given, the complete plugin dictionary is returned. :param name: Name of a plugin :return: None, single plugin or dictionary of plugins """ if name is None: ...
[ "def", "get", "(", "self", ",", "name", "=", "None", ")", ":", "if", "name", "is", "None", ":", "return", "self", ".", "_plugins", "else", ":", "if", "name", "not", "in", "self", ".", "_plugins", ".", "keys", "(", ")", ":", "return", "None", "els...
Returns the plugin object with the given name. Or if a name is not given, the complete plugin dictionary is returned. :param name: Name of a plugin :return: None, single plugin or dictionary of plugins
[ "Returns", "the", "plugin", "object", "with", "the", "given", "name", ".", "Or", "if", "a", "name", "is", "not", "given", "the", "complete", "plugin", "dictionary", "is", "returned", "." ]
python
train
smartmob-project/smartmob-agent
smartmob_agent/__init__.py
https://github.com/smartmob-project/smartmob-agent/blob/4039f577ab7230d135f00df68c611a51e45ddbc7/smartmob_agent/__init__.py#L73-L84
async def inject_request_id(app, handler): """aiohttp middleware: ensures each request has a unique request ID. See: ``inject_request_id``. """ async def trace_request(request): request['x-request-id'] = \ request.headers.get('x-request-id') or str(uuid.uuid4()) return awai...
[ "async", "def", "inject_request_id", "(", "app", ",", "handler", ")", ":", "async", "def", "trace_request", "(", "request", ")", ":", "request", "[", "'x-request-id'", "]", "=", "request", ".", "headers", ".", "get", "(", "'x-request-id'", ")", "or", "str"...
aiohttp middleware: ensures each request has a unique request ID. See: ``inject_request_id``.
[ "aiohttp", "middleware", ":", "ensures", "each", "request", "has", "a", "unique", "request", "ID", "." ]
python
train
refenv/cijoe
modules/cij/reporter.py
https://github.com/refenv/cijoe/blob/21d7b2ed4ff68e0a1457e7df2db27f6334f1a379/modules/cij/reporter.py#L34-L62
def tcase_comment(tcase): """ Extract testcase comment section / testcase description @returns the testcase-comment from the tcase["fpath"] as a list of strings """ src = open(tcase["fpath"]).read() if len(src) < 3: cij.err("rprtr::tcase_comment: invalid src, tcase: %r" % tcase["name"]...
[ "def", "tcase_comment", "(", "tcase", ")", ":", "src", "=", "open", "(", "tcase", "[", "\"fpath\"", "]", ")", ".", "read", "(", ")", "if", "len", "(", "src", ")", "<", "3", ":", "cij", ".", "err", "(", "\"rprtr::tcase_comment: invalid src, tcase: %r\"", ...
Extract testcase comment section / testcase description @returns the testcase-comment from the tcase["fpath"] as a list of strings
[ "Extract", "testcase", "comment", "section", "/", "testcase", "description" ]
python
valid
MrYsLab/PyMata
PyMata/pymata.py
https://github.com/MrYsLab/PyMata/blob/7e0ec34670b5a0d3d6b74bcbe4f3808c845cc429/PyMata/pymata.py#L764-L782
def set_digital_latch(self, pin, threshold_type, cb=None): """ This method "arms" a digital pin for its data to be latched and saved in the latching table If a callback method is provided, when latching criteria is achieved, the callback function is called with latching data notification...
[ "def", "set_digital_latch", "(", "self", ",", "pin", ",", "threshold_type", ",", "cb", "=", "None", ")", ":", "if", "0", "<=", "threshold_type", "<=", "1", ":", "self", ".", "_command_handler", ".", "set_digital_latch", "(", "pin", ",", "threshold_type", "...
This method "arms" a digital pin for its data to be latched and saved in the latching table If a callback method is provided, when latching criteria is achieved, the callback function is called with latching data notification. In that case, the latching table is not updated. :param pin: Digital...
[ "This", "method", "arms", "a", "digital", "pin", "for", "its", "data", "to", "be", "latched", "and", "saved", "in", "the", "latching", "table", "If", "a", "callback", "method", "is", "provided", "when", "latching", "criteria", "is", "achieved", "the", "cal...
python
valid
uploadcare/pyuploadcare
pyuploadcare/api_resources.py
https://github.com/uploadcare/pyuploadcare/blob/cefddc0306133a71e37b18e8700df5948ef49b37/pyuploadcare/api_resources.py#L267-L287
def create_local_copy(self, effects=None, store=None): """Creates a Local File Copy on Uploadcare Storage. Args: - effects: Adds CDN image effects. If ``self.default_effects`` property is set effects will be combined with default effects. - store:...
[ "def", "create_local_copy", "(", "self", ",", "effects", "=", "None", ",", "store", "=", "None", ")", ":", "effects", "=", "self", ".", "_build_effects", "(", "effects", ")", "store", "=", "store", "or", "''", "data", "=", "{", "'source'", ":", "self",...
Creates a Local File Copy on Uploadcare Storage. Args: - effects: Adds CDN image effects. If ``self.default_effects`` property is set effects will be combined with default effects. - store: If ``store`` option is set to False the copy of y...
[ "Creates", "a", "Local", "File", "Copy", "on", "Uploadcare", "Storage", "." ]
python
test
bitesofcode/projexui
projexui/widgets/xorbtreewidget/xorbrecorditem.py
https://github.com/bitesofcode/projexui/blob/f18a73bec84df90b034ca69b9deea118dbedfc4d/projexui/widgets/xorbtreewidget/xorbrecorditem.py#L320-L360
def updateColumnValue(self, column, value, index=None): """ Assigns the value for the column of this record to the inputed value. :param index | <int> value | <variant> """ if index is None: index = self.treeWidget().column(co...
[ "def", "updateColumnValue", "(", "self", ",", "column", ",", "value", ",", "index", "=", "None", ")", ":", "if", "index", "is", "None", ":", "index", "=", "self", ".", "treeWidget", "(", ")", ".", "column", "(", "column", ".", "name", "(", ")", ")"...
Assigns the value for the column of this record to the inputed value. :param index | <int> value | <variant>
[ "Assigns", "the", "value", "for", "the", "column", "of", "this", "record", "to", "the", "inputed", "value", ".", ":", "param", "index", "|", "<int", ">", "value", "|", "<variant", ">" ]
python
train
janpipek/physt
physt/util.py
https://github.com/janpipek/physt/blob/6dd441b073514e7728235f50b2352d56aacf38d4/physt/util.py#L21-L34
def find_subclass(base: type, name: str) -> type: """Find a named subclass of a base class. Uses only the class name without namespace. """ class_candidates = [klass for klass in all_subclasses(base) if klass.__name__ == name ] ...
[ "def", "find_subclass", "(", "base", ":", "type", ",", "name", ":", "str", ")", "->", "type", ":", "class_candidates", "=", "[", "klass", "for", "klass", "in", "all_subclasses", "(", "base", ")", "if", "klass", ".", "__name__", "==", "name", "]", "if",...
Find a named subclass of a base class. Uses only the class name without namespace.
[ "Find", "a", "named", "subclass", "of", "a", "base", "class", "." ]
python
train
fermiPy/fermipy
fermipy/jobs/target_sim.py
https://github.com/fermiPy/fermipy/blob/9df5e7e3728307fd58c5bba36fd86783c39fbad4/fermipy/jobs/target_sim.py#L97-L109
def run_analysis(self, argv): """Run this analysis""" args = self._parser.parse_args(argv) name_keys = dict(target_type=args.ttype, target_name=args.target, sim_name=args.sim, fullpath=True) orig_dir = NAME_FACT...
[ "def", "run_analysis", "(", "self", ",", "argv", ")", ":", "args", "=", "self", ".", "_parser", ".", "parse_args", "(", "argv", ")", "name_keys", "=", "dict", "(", "target_type", "=", "args", ".", "ttype", ",", "target_name", "=", "args", ".", "target"...
Run this analysis
[ "Run", "this", "analysis" ]
python
train
Skype4Py/Skype4Py
Skype4Py/skype.py
https://github.com/Skype4Py/Skype4Py/blob/c48d83f7034109fe46315d45a066126002c6e0d4/Skype4Py/skype.py#L413-L425
def Call(self, Id=0): """Queries a call object. :Parameters: Id : int Call identifier. :return: Call object. :rtype: `call.Call` """ o = Call(self, Id) o.Status # Test if such a call exists. return o
[ "def", "Call", "(", "self", ",", "Id", "=", "0", ")", ":", "o", "=", "Call", "(", "self", ",", "Id", ")", "o", ".", "Status", "# Test if such a call exists.", "return", "o" ]
Queries a call object. :Parameters: Id : int Call identifier. :return: Call object. :rtype: `call.Call`
[ "Queries", "a", "call", "object", "." ]
python
train
mjirik/imtools
imtools/sample_data.py
https://github.com/mjirik/imtools/blob/eb29fa59df0e0684d8334eb3bc5ef36ea46d1d3a/imtools/sample_data.py#L166-L191
def checksum(path, hashfunc='md5'): """ Return checksum given by path. Wildcards can be used in check sum. Function is strongly dependent on checksumdir package by 'cakepietoast'. :param path: :param hashfunc: :return: """ import checksumdir hash_func = checksumdir.HASH_FUNCS.get(ha...
[ "def", "checksum", "(", "path", ",", "hashfunc", "=", "'md5'", ")", ":", "import", "checksumdir", "hash_func", "=", "checksumdir", ".", "HASH_FUNCS", ".", "get", "(", "hashfunc", ")", "if", "not", "hash_func", ":", "raise", "NotImplementedError", "(", "'{} n...
Return checksum given by path. Wildcards can be used in check sum. Function is strongly dependent on checksumdir package by 'cakepietoast'. :param path: :param hashfunc: :return:
[ "Return", "checksum", "given", "by", "path", ".", "Wildcards", "can", "be", "used", "in", "check", "sum", ".", "Function", "is", "strongly", "dependent", "on", "checksumdir", "package", "by", "cakepietoast", "." ]
python
train
quantumlib/Cirq
cirq/circuits/text_diagram_drawer.py
https://github.com/quantumlib/Cirq/blob/0827da80dd7880e5b923eb69407e980ed9bc0bd2/cirq/circuits/text_diagram_drawer.py#L89-L105
def content_present(self, x: int, y: int) -> bool: """Determines if a line or printed text is at the given location.""" # Text? if (x, y) in self.entries: return True # Vertical line? if any(v.x == x and v.y1 < y < v.y2 for v in self.vertical_lines): ret...
[ "def", "content_present", "(", "self", ",", "x", ":", "int", ",", "y", ":", "int", ")", "->", "bool", ":", "# Text?", "if", "(", "x", ",", "y", ")", "in", "self", ".", "entries", ":", "return", "True", "# Vertical line?", "if", "any", "(", "v", "...
Determines if a line or printed text is at the given location.
[ "Determines", "if", "a", "line", "or", "printed", "text", "is", "at", "the", "given", "location", "." ]
python
train
brocade/pynos
pynos/versions/base/yang/brocade_ras.py
https://github.com/brocade/pynos/blob/bd8a34e98f322de3fc06750827d8bbc3a0c00380/pynos/versions/base/yang/brocade_ras.py#L280-L291
def bna_config_cmd_output_status(self, **kwargs): """Auto Generated Code """ config = ET.Element("config") bna_config_cmd = ET.Element("bna_config_cmd") config = bna_config_cmd output = ET.SubElement(bna_config_cmd, "output") status = ET.SubElement(output, "status...
[ "def", "bna_config_cmd_output_status", "(", "self", ",", "*", "*", "kwargs", ")", ":", "config", "=", "ET", ".", "Element", "(", "\"config\"", ")", "bna_config_cmd", "=", "ET", ".", "Element", "(", "\"bna_config_cmd\"", ")", "config", "=", "bna_config_cmd", ...
Auto Generated Code
[ "Auto", "Generated", "Code" ]
python
train
sontek/bulby
bulby/color.py
https://github.com/sontek/bulby/blob/a2e741f843ee8e361b50a6079601108bfbe52526/bulby/color.py#L90-L117
def get_xy_from_hex(hex_value): ''' Returns X, Y coordinates containing the closest avilable CIE 1931 based on the hex_value provided. ''' red, green, blue = struct.unpack('BBB', codecs.decode(hex_value, 'hex')) r = ((red + 0.055) / (1.0 + 0.055)) ** 2.4 if (red > 0.04045) else (red / 12.92) # ...
[ "def", "get_xy_from_hex", "(", "hex_value", ")", ":", "red", ",", "green", ",", "blue", "=", "struct", ".", "unpack", "(", "'BBB'", ",", "codecs", ".", "decode", "(", "hex_value", ",", "'hex'", ")", ")", "r", "=", "(", "(", "red", "+", "0.055", ")"...
Returns X, Y coordinates containing the closest avilable CIE 1931 based on the hex_value provided.
[ "Returns", "X", "Y", "coordinates", "containing", "the", "closest", "avilable", "CIE", "1931", "based", "on", "the", "hex_value", "provided", "." ]
python
train
gitpython-developers/GitPython
git/repo/base.py
https://github.com/gitpython-developers/GitPython/blob/1f66e25c25cde2423917ee18c4704fff83b837d1/git/repo/base.py#L986-L997
def clone(self, path, progress=None, **kwargs): """Create a clone from this repository. :param path: is the full path of the new repo (traditionally ends with ./<name>.git). :param progress: See 'git.remote.Remote.push'. :param kwargs: * odbt = ObjectDatabase Type, allowing ...
[ "def", "clone", "(", "self", ",", "path", ",", "progress", "=", "None", ",", "*", "*", "kwargs", ")", ":", "return", "self", ".", "_clone", "(", "self", ".", "git", ",", "self", ".", "common_dir", ",", "path", ",", "type", "(", "self", ".", "odb"...
Create a clone from this repository. :param path: is the full path of the new repo (traditionally ends with ./<name>.git). :param progress: See 'git.remote.Remote.push'. :param kwargs: * odbt = ObjectDatabase Type, allowing to determine the object database implementati...
[ "Create", "a", "clone", "from", "this", "repository", "." ]
python
train
pywbem/pywbem
attic/twisted_client.py
https://github.com/pywbem/pywbem/blob/e54ecb82c2211e289a268567443d60fdd489f1e4/attic/twisted_client.py#L178-L249
def methodcallPayload(self, methodname, obj, namespace, **kwargs): """Generate the XML payload for an extrinsic methodcall.""" if isinstance(obj, CIMInstanceName): path = obj.copy() path.host = None path.namespace = None localpath = cim_xml.LOCALINSTAN...
[ "def", "methodcallPayload", "(", "self", ",", "methodname", ",", "obj", ",", "namespace", ",", "*", "*", "kwargs", ")", ":", "if", "isinstance", "(", "obj", ",", "CIMInstanceName", ")", ":", "path", "=", "obj", ".", "copy", "(", ")", "path", ".", "ho...
Generate the XML payload for an extrinsic methodcall.
[ "Generate", "the", "XML", "payload", "for", "an", "extrinsic", "methodcall", "." ]
python
train
neo4j/neo4j-python-driver
neo4j/types/temporal.py
https://github.com/neo4j/neo4j-python-driver/blob/0c641e826765e86ff5454dae57c99521db8ca45c/neo4j/types/temporal.py#L166-L173
def dehydrate_duration(value): """ Dehydrator for `duration` values. :param value: :type value: Duration :return: """ return Structure(b"E", value.months, value.days, value.seconds, int(1000000000 * value.subseconds))
[ "def", "dehydrate_duration", "(", "value", ")", ":", "return", "Structure", "(", "b\"E\"", ",", "value", ".", "months", ",", "value", ".", "days", ",", "value", ".", "seconds", ",", "int", "(", "1000000000", "*", "value", ".", "subseconds", ")", ")" ]
Dehydrator for `duration` values. :param value: :type value: Duration :return:
[ "Dehydrator", "for", "duration", "values", "." ]
python
train
apache/incubator-mxnet
example/ssd/evaluate/eval_metric.py
https://github.com/apache/incubator-mxnet/blob/1af29e9c060a4c7d60eeaacba32afdb9a7775ba7/example/ssd/evaluate/eval_metric.py#L86-L195
def update(self, labels, preds): """ Update internal records. This function now only update internal buffer, sum_metric and num_inst are updated in _update() function instead when get() is called to return results. Params: ---------- labels: mx.nd.array (n * 6) o...
[ "def", "update", "(", "self", ",", "labels", ",", "preds", ")", ":", "def", "iou", "(", "x", ",", "ys", ")", ":", "\"\"\"\n Calculate intersection-over-union overlap\n Params:\n ----------\n x : numpy.array\n single box [...
Update internal records. This function now only update internal buffer, sum_metric and num_inst are updated in _update() function instead when get() is called to return results. Params: ---------- labels: mx.nd.array (n * 6) or (n * 5), difficult column is optional 2...
[ "Update", "internal", "records", ".", "This", "function", "now", "only", "update", "internal", "buffer", "sum_metric", "and", "num_inst", "are", "updated", "in", "_update", "()", "function", "instead", "when", "get", "()", "is", "called", "to", "return", "resu...
python
train
saltstack/salt
salt/client/ssh/wrapper/state.py
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/client/ssh/wrapper/state.py#L525-L565
def request(mods=None, **kwargs): ''' .. versionadded:: 2017.7.3 Request that the local admin execute a state run via `salt-call state.run_request` All arguments match state.apply CLI Example: .. code-block:: bash salt '*' state.request salt '*' state.request ...
[ "def", "request", "(", "mods", "=", "None", ",", "*", "*", "kwargs", ")", ":", "kwargs", "[", "'test'", "]", "=", "True", "ret", "=", "apply_", "(", "mods", ",", "*", "*", "kwargs", ")", "notify_path", "=", "os", ".", "path", ".", "join", "(", ...
.. versionadded:: 2017.7.3 Request that the local admin execute a state run via `salt-call state.run_request` All arguments match state.apply CLI Example: .. code-block:: bash salt '*' state.request salt '*' state.request test salt '*' state.request test,pkgs
[ "..", "versionadded", "::", "2017", ".", "7", ".", "3" ]
python
train
SKA-ScienceDataProcessor/integration-prototype
sip/execution_control/configuration_db/sip_config_db/utils/generate_sbi_config.py
https://github.com/SKA-ScienceDataProcessor/integration-prototype/blob/8c8006de6ad71dcd44114b0338780738079c87d4/sip/execution_control/configuration_db/sip_config_db/utils/generate_sbi_config.py#L62-L78
def generate_version(max_major: int = 1, max_minor: int = 7, max_patch: int = 15) -> str: """Select a random version. Args: max_major (int, optional) maximum major version max_minor (int, optional) maximum minor version max_patch (int, optional) maximum patch versio...
[ "def", "generate_version", "(", "max_major", ":", "int", "=", "1", ",", "max_minor", ":", "int", "=", "7", ",", "max_patch", ":", "int", "=", "15", ")", "->", "str", ":", "major", "=", "randint", "(", "0", ",", "max_major", ")", "minor", "=", "rand...
Select a random version. Args: max_major (int, optional) maximum major version max_minor (int, optional) maximum minor version max_patch (int, optional) maximum patch version Returns: str, Version String
[ "Select", "a", "random", "version", "." ]
python
train
tamasgal/km3pipe
km3pipe/utils/tohdf5.py
https://github.com/tamasgal/km3pipe/blob/7a9b59ac899a28775b5bdc5d391d9a5340d08040/km3pipe/utils/tohdf5.py#L46-L73
def tohdf5(input_files, output_file, n_events, conv_times_to_jte, **kwargs): """Convert Any file to HDF5 file""" if len(input_files) > 1: cprint( "Preparing to convert {} files to HDF5.".format(len(input_files)) ) from km3pipe import Pipeline # noqa from km3pipe.io import...
[ "def", "tohdf5", "(", "input_files", ",", "output_file", ",", "n_events", ",", "conv_times_to_jte", ",", "*", "*", "kwargs", ")", ":", "if", "len", "(", "input_files", ")", ">", "1", ":", "cprint", "(", "\"Preparing to convert {} files to HDF5.\"", ".", "forma...
Convert Any file to HDF5 file
[ "Convert", "Any", "file", "to", "HDF5", "file" ]
python
train
evhub/coconut
coconut/compiler/compiler.py
https://github.com/evhub/coconut/blob/ff97177344e7604e89a0a98a977a87ed2a56fc6d/coconut/compiler/compiler.py#L1179-L1199
def classlist_handle(self, original, loc, tokens): """Process class inheritance lists.""" if len(tokens) == 0: if self.target.startswith("3"): return "" else: return "(_coconut.object)" elif len(tokens) == 1 and len(tokens[0]) == 1: ...
[ "def", "classlist_handle", "(", "self", ",", "original", ",", "loc", ",", "tokens", ")", ":", "if", "len", "(", "tokens", ")", "==", "0", ":", "if", "self", ".", "target", ".", "startswith", "(", "\"3\"", ")", ":", "return", "\"\"", "else", ":", "r...
Process class inheritance lists.
[ "Process", "class", "inheritance", "lists", "." ]
python
train
prompt-toolkit/pymux
pymux/client/posix.py
https://github.com/prompt-toolkit/pymux/blob/3f66e62b9de4b2251c7f9afad6c516dc5a30ec67/pymux/client/posix.py#L175-L183
def _send_packet(self, data): " Send to server. " data = json.dumps(data).encode('utf-8') # Be sure that our socket is blocking, otherwise, the send() call could # raise `BlockingIOError` if the buffer is full. self.socket.setblocking(1) self.socket.send(data + b'\0')
[ "def", "_send_packet", "(", "self", ",", "data", ")", ":", "data", "=", "json", ".", "dumps", "(", "data", ")", ".", "encode", "(", "'utf-8'", ")", "# Be sure that our socket is blocking, otherwise, the send() call could", "# raise `BlockingIOError` if the buffer is full....
Send to server.
[ "Send", "to", "server", "." ]
python
train
adamchainz/django-mysql
django_mysql/models/handler.py
https://github.com/adamchainz/django-mysql/blob/967daa4245cf55c9bc5dc018e560f417c528916a/django_mysql/models/handler.py#L116-L150
def _parse_index_value(self, kwargs): """ Parse the HANDLER-supported subset of django's __ expression syntax """ if len(kwargs) == 0: return None, None elif len(kwargs) > 1: raise ValueError("You can't pass more than one value expression, " ...
[ "def", "_parse_index_value", "(", "self", ",", "kwargs", ")", ":", "if", "len", "(", "kwargs", ")", "==", "0", ":", "return", "None", ",", "None", "elif", "len", "(", "kwargs", ")", ">", "1", ":", "raise", "ValueError", "(", "\"You can't pass more than o...
Parse the HANDLER-supported subset of django's __ expression syntax
[ "Parse", "the", "HANDLER", "-", "supported", "subset", "of", "django", "s", "__", "expression", "syntax" ]
python
train
uw-it-aca/uw-restclients-canvas
uw_canvas/roles.py
https://github.com/uw-it-aca/uw-restclients-canvas/blob/9845faf33d49a8f06908efc22640c001116d6ea2/uw_canvas/roles.py#L50-L55
def get_role_by_account_sis_id(self, account_sis_id, role_id): """ Get information about a single role, for the passed account SIS ID. """ return self.get_role(self._sis_id(account_sis_id, sis_field="account"), role_id)
[ "def", "get_role_by_account_sis_id", "(", "self", ",", "account_sis_id", ",", "role_id", ")", ":", "return", "self", ".", "get_role", "(", "self", ".", "_sis_id", "(", "account_sis_id", ",", "sis_field", "=", "\"account\"", ")", ",", "role_id", ")" ]
Get information about a single role, for the passed account SIS ID.
[ "Get", "information", "about", "a", "single", "role", "for", "the", "passed", "account", "SIS", "ID", "." ]
python
test
jeffknupp/sandman2
sandman2/app.py
https://github.com/jeffknupp/sandman2/blob/1ce21d6f7a6df77fa96fab694b0f9bb8469c166b/sandman2/app.py#L176-L187
def _register_user_models(user_models, admin=None, schema=None): """Register any user-defined models with the API Service. :param list user_models: A list of user-defined models to include in the API service """ if any([issubclass(cls, AutomapModel) for cls in user_models])...
[ "def", "_register_user_models", "(", "user_models", ",", "admin", "=", "None", ",", "schema", "=", "None", ")", ":", "if", "any", "(", "[", "issubclass", "(", "cls", ",", "AutomapModel", ")", "for", "cls", "in", "user_models", "]", ")", ":", "AutomapMode...
Register any user-defined models with the API Service. :param list user_models: A list of user-defined models to include in the API service
[ "Register", "any", "user", "-", "defined", "models", "with", "the", "API", "Service", "." ]
python
train
pyroscope/pyrocore
src/pyrocore/scripts/pyroadmin.py
https://github.com/pyroscope/pyrocore/blob/89ad01346a570943d20311a0b488440975876612/src/pyrocore/scripts/pyroadmin.py#L81-L102
def download_resource(self, download_url, target, guard): """ Helper to download and install external resources. """ download_url = download_url.strip() if not os.path.isabs(target): target = os.path.join(config.config_dir, target) if os.path.exists(os.path.join(targ...
[ "def", "download_resource", "(", "self", ",", "download_url", ",", "target", ",", "guard", ")", ":", "download_url", "=", "download_url", ".", "strip", "(", ")", "if", "not", "os", ".", "path", ".", "isabs", "(", "target", ")", ":", "target", "=", "os"...
Helper to download and install external resources.
[ "Helper", "to", "download", "and", "install", "external", "resources", "." ]
python
train
spyder-ide/spyder-kernels
spyder_kernels/utils/dochelpers.py
https://github.com/spyder-ide/spyder-kernels/blob/2c5b36cdb797b8aba77bc406ca96f5e079c4aaca/spyder_kernels/utils/dochelpers.py#L295-L329
def isdefined(obj, force_import=False, namespace=None): """Return True if object is defined in namespace If namespace is None --> namespace = locals()""" if namespace is None: namespace = locals() attr_list = obj.split('.') base = attr_list.pop(0) if len(base) == 0: return False ...
[ "def", "isdefined", "(", "obj", ",", "force_import", "=", "False", ",", "namespace", "=", "None", ")", ":", "if", "namespace", "is", "None", ":", "namespace", "=", "locals", "(", ")", "attr_list", "=", "obj", ".", "split", "(", "'.'", ")", "base", "=...
Return True if object is defined in namespace If namespace is None --> namespace = locals()
[ "Return", "True", "if", "object", "is", "defined", "in", "namespace", "If", "namespace", "is", "None", "--", ">", "namespace", "=", "locals", "()" ]
python
train
tgalal/python-axolotl
axolotl/protocol/senderkeymessage.py
https://github.com/tgalal/python-axolotl/blob/0c681af4b756f556e23a9bf961abfbc6f82800cc/axolotl/protocol/senderkeymessage.py#L90-L98
def getSignature(self, signatureKey, serialized): """ :type signatureKey: ECPrivateKey :type serialized: bytearray """ try: return Curve.calculateSignature(signatureKey, serialized) except InvalidKeyException as e: raise AssertionError(e)
[ "def", "getSignature", "(", "self", ",", "signatureKey", ",", "serialized", ")", ":", "try", ":", "return", "Curve", ".", "calculateSignature", "(", "signatureKey", ",", "serialized", ")", "except", "InvalidKeyException", "as", "e", ":", "raise", "AssertionError...
:type signatureKey: ECPrivateKey :type serialized: bytearray
[ ":", "type", "signatureKey", ":", "ECPrivateKey", ":", "type", "serialized", ":", "bytearray" ]
python
train
MIR-MU/ntcir-math-density
ntcir_math_density/view.py
https://github.com/MIR-MU/ntcir-math-density/blob/648c74bfc5bd304603ef67da753ff25b65e829ef/ntcir_math_density/view.py#L19-L46
def plot_estimates(positions, estimates): """ Plots density, and probability estimates. Parameters ---------- positions : iterable of float Paragraph positions for which densities, and probabilities were estimated. estimates : six-tuple of (sequence of float) Estimates of P(rele...
[ "def", "plot_estimates", "(", "positions", ",", "estimates", ")", ":", "x", "=", "list", "(", "positions", ")", "fig", "=", "plt", ".", "figure", "(", "figsize", "=", "(", "SUBPLOT_WIDTH", "*", "len", "(", "estimates", ")", ",", "FIGURE_HEIGHT", ")", "...
Plots density, and probability estimates. Parameters ---------- positions : iterable of float Paragraph positions for which densities, and probabilities were estimated. estimates : six-tuple of (sequence of float) Estimates of P(relevant), p(position), p(position | relevant), P(position...
[ "Plots", "density", "and", "probability", "estimates", "." ]
python
train
JoelBender/bacpypes
py25/bacpypes/constructeddata.py
https://github.com/JoelBender/bacpypes/blob/4111b8604a16fa2b7f80d8104a43b9f3e28dfc78/py25/bacpypes/constructeddata.py#L1218-L1243
def dict_contents(self, use_dict=None, as_class=dict): """Return the contents of an object as a dict.""" if _debug: Choice._debug("dict_contents use_dict=%r as_class=%r", use_dict, as_class) # make/extend the dictionary of content if use_dict is None: use_dict = as_class() ...
[ "def", "dict_contents", "(", "self", ",", "use_dict", "=", "None", ",", "as_class", "=", "dict", ")", ":", "if", "_debug", ":", "Choice", ".", "_debug", "(", "\"dict_contents use_dict=%r as_class=%r\"", ",", "use_dict", ",", "as_class", ")", "# make/extend the d...
Return the contents of an object as a dict.
[ "Return", "the", "contents", "of", "an", "object", "as", "a", "dict", "." ]
python
train
ibm-watson-iot/iot-python
tmp/src/things/things.py
https://github.com/ibm-watson-iot/iot-python/blob/195f05adce3fba4ec997017e41e02ebd85c0c4cc/tmp/src/things/things.py#L496-L509
def getSchemaContent(self, schemaId, draft=False): """ Get the content for a schema. Parameters: schemaId (string), draft (boolean). Throws APIException on failure. """ if draft: req = ApiClient.oneSchemaContentUrl % (self.host, "/draft", schemaId) else: ...
[ "def", "getSchemaContent", "(", "self", ",", "schemaId", ",", "draft", "=", "False", ")", ":", "if", "draft", ":", "req", "=", "ApiClient", ".", "oneSchemaContentUrl", "%", "(", "self", ".", "host", ",", "\"/draft\"", ",", "schemaId", ")", "else", ":", ...
Get the content for a schema. Parameters: schemaId (string), draft (boolean). Throws APIException on failure.
[ "Get", "the", "content", "for", "a", "schema", ".", "Parameters", ":", "schemaId", "(", "string", ")", "draft", "(", "boolean", ")", ".", "Throws", "APIException", "on", "failure", "." ]
python
test
lemieuxl/pyplink
pyplink/pyplink.py
https://github.com/lemieuxl/pyplink/blob/31d47c86f589064bda98206314a2d0b20e7fd2f0/pyplink/pyplink.py#L560-L572
def _grouper(iterable, n, fillvalue=0): """Collect data into fixed-length chunks or blocks. Args: n (int): The size of the chunk. fillvalue (int): The fill value. Returns: iterator: An iterator over the chunks. """ args = [iter(iterable)] * ...
[ "def", "_grouper", "(", "iterable", ",", "n", ",", "fillvalue", "=", "0", ")", ":", "args", "=", "[", "iter", "(", "iterable", ")", "]", "*", "n", "return", "zip_longest", "(", "fillvalue", "=", "fillvalue", ",", "*", "args", ")" ]
Collect data into fixed-length chunks or blocks. Args: n (int): The size of the chunk. fillvalue (int): The fill value. Returns: iterator: An iterator over the chunks.
[ "Collect", "data", "into", "fixed", "-", "length", "chunks", "or", "blocks", "." ]
python
train
awslabs/serverless-application-model
samtranslator/plugins/api/implicit_api_plugin.py
https://github.com/awslabs/serverless-application-model/blob/cccb0c96b5c91e53355ebc07e542467303a5eedd/samtranslator/plugins/api/implicit_api_plugin.py#L282-L317
def _maybe_add_conditions_to_implicit_api_paths(self, template): """ Add conditions to implicit API paths if necessary. Implicit API resource methods are constructed from API events on individual serverless functions within the SAM template. Since serverless functions can have condition...
[ "def", "_maybe_add_conditions_to_implicit_api_paths", "(", "self", ",", "template", ")", ":", "for", "api_id", ",", "api", "in", "template", ".", "iterate", "(", "SamResourceType", ".", "Api", ".", "value", ")", ":", "if", "not", "api", ".", "properties", "....
Add conditions to implicit API paths if necessary. Implicit API resource methods are constructed from API events on individual serverless functions within the SAM template. Since serverless functions can have conditions on them, it's possible to have a case where all methods under a resource pa...
[ "Add", "conditions", "to", "implicit", "API", "paths", "if", "necessary", "." ]
python
train
mitsei/dlkit
dlkit/json_/assessment/sessions.py
https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/json_/assessment/sessions.py#L9468-L9483
def remove_child_banks(self, bank_id): """Removes all children from a bank. arg: bank_id (osid.id.Id): the ``Id`` of a bank raise: NotFound - ``bank_id`` is not in hierarchy raise: NullArgument - ``bank_id`` is ``null`` raise: OperationFailed - unable to complete request ...
[ "def", "remove_child_banks", "(", "self", ",", "bank_id", ")", ":", "# Implemented from template for", "# osid.resource.BinHierarchyDesignSession.remove_child_bin_template", "if", "self", ".", "_catalog_session", "is", "not", "None", ":", "return", "self", ".", "_catalog_se...
Removes all children from a bank. arg: bank_id (osid.id.Id): the ``Id`` of a bank raise: NotFound - ``bank_id`` is not in hierarchy raise: NullArgument - ``bank_id`` is ``null`` raise: OperationFailed - unable to complete request raise: PermissionDenied - authorization fa...
[ "Removes", "all", "children", "from", "a", "bank", "." ]
python
train
pyrogram/pyrogram
pyrogram/vendor/typing/typing.py
https://github.com/pyrogram/pyrogram/blob/e7258a341ba905cfa86264c22040654db732ec1c/pyrogram/vendor/typing/typing.py#L387-L403
def _type_repr(obj): """Return the repr() of an object, special-casing types (internal helper). If obj is a type, we return a shorter version than the default type.__repr__, based on the module and qualified name, which is typically enough to uniquely identify a type. For everything else, we fall ...
[ "def", "_type_repr", "(", "obj", ")", ":", "if", "isinstance", "(", "obj", ",", "type", ")", "and", "not", "isinstance", "(", "obj", ",", "TypingMeta", ")", ":", "if", "obj", ".", "__module__", "==", "'builtins'", ":", "return", "_qualname", "(", "obj"...
Return the repr() of an object, special-casing types (internal helper). If obj is a type, we return a shorter version than the default type.__repr__, based on the module and qualified name, which is typically enough to uniquely identify a type. For everything else, we fall back on repr(obj).
[ "Return", "the", "repr", "()", "of", "an", "object", "special", "-", "casing", "types", "(", "internal", "helper", ")", "." ]
python
train
PmagPy/PmagPy
dialogs/demag_dialogs.py
https://github.com/PmagPy/PmagPy/blob/c7984f8809bf40fe112e53dcc311a33293b62d0b/dialogs/demag_dialogs.py#L182-L208
def on_change_plot_cursor(self,event): """ If mouse is over data point making it selectable change the shape of the cursor @param: event -> the wx Mouseevent for that click """ if not self.xdata or not self.ydata: return pos=event.GetPosition() width, height = sel...
[ "def", "on_change_plot_cursor", "(", "self", ",", "event", ")", ":", "if", "not", "self", ".", "xdata", "or", "not", "self", ".", "ydata", ":", "return", "pos", "=", "event", ".", "GetPosition", "(", ")", "width", ",", "height", "=", "self", ".", "ca...
If mouse is over data point making it selectable change the shape of the cursor @param: event -> the wx Mouseevent for that click
[ "If", "mouse", "is", "over", "data", "point", "making", "it", "selectable", "change", "the", "shape", "of", "the", "cursor" ]
python
train
pandas-dev/pandas
pandas/io/pytables.py
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/io/pytables.py#L1794-L1797
def write_metadata(self, handler): """ set the meta data """ if self.metadata is not None: handler.write_metadata(self.cname, self.metadata)
[ "def", "write_metadata", "(", "self", ",", "handler", ")", ":", "if", "self", ".", "metadata", "is", "not", "None", ":", "handler", ".", "write_metadata", "(", "self", ".", "cname", ",", "self", ".", "metadata", ")" ]
set the meta data
[ "set", "the", "meta", "data" ]
python
train
skymill/automated-ebs-snapshots
automated_ebs_snapshots/snapshot_manager.py
https://github.com/skymill/automated-ebs-snapshots/blob/9595bc49d458f6ffb93430722757d2284e878fab/automated_ebs_snapshots/snapshot_manager.py#L27-L40
def _create_snapshot(volume): """ Create a new snapshot :type volume: boto.ec2.volume.Volume :param volume: Volume to snapshot :returns: boto.ec2.snapshot.Snapshot -- The new snapshot """ logger.info('Creating new snapshot for {}'.format(volume.id)) snapshot = volume.create_snapshot( ...
[ "def", "_create_snapshot", "(", "volume", ")", ":", "logger", ".", "info", "(", "'Creating new snapshot for {}'", ".", "format", "(", "volume", ".", "id", ")", ")", "snapshot", "=", "volume", ".", "create_snapshot", "(", "description", "=", "\"Automatic snapshot...
Create a new snapshot :type volume: boto.ec2.volume.Volume :param volume: Volume to snapshot :returns: boto.ec2.snapshot.Snapshot -- The new snapshot
[ "Create", "a", "new", "snapshot" ]
python
train
workforce-data-initiative/skills-utils
skills_utils/es.py
https://github.com/workforce-data-initiative/skills-utils/blob/4cf9b7c2938984f34bbcc33d45482d23c52c7539/skills_utils/es.py#L48-L56
def create_index(index_name, index_config, client): """Creates an index with a given configuration Args: index_name (str): Name of the index you want to create index_config (dict) configuration for the index client (Elasticsearch.IndicesClient) the Elasticsearch client """ clien...
[ "def", "create_index", "(", "index_name", ",", "index_config", ",", "client", ")", ":", "client", ".", "create", "(", "index", "=", "index_name", ",", "body", "=", "index_config", ")" ]
Creates an index with a given configuration Args: index_name (str): Name of the index you want to create index_config (dict) configuration for the index client (Elasticsearch.IndicesClient) the Elasticsearch client
[ "Creates", "an", "index", "with", "a", "given", "configuration" ]
python
train
jic-dtool/dtoolcore
dtoolcore/utils.py
https://github.com/jic-dtool/dtoolcore/blob/eeb9a924dc8fcf543340653748a7877be1f98e0f/dtoolcore/utils.py#L42-L59
def generous_parse_uri(uri): """Return a urlparse.ParseResult object with the results of parsing the given URI. This has the same properties as the result of parse_uri. When passed a relative path, it determines the absolute path, sets the scheme to file, the netloc to localhost and returns a parse of ...
[ "def", "generous_parse_uri", "(", "uri", ")", ":", "parse_result", "=", "urlparse", "(", "uri", ")", "if", "parse_result", ".", "scheme", "==", "''", ":", "abspath", "=", "os", ".", "path", ".", "abspath", "(", "parse_result", ".", "path", ")", "if", "...
Return a urlparse.ParseResult object with the results of parsing the given URI. This has the same properties as the result of parse_uri. When passed a relative path, it determines the absolute path, sets the scheme to file, the netloc to localhost and returns a parse of the result.
[ "Return", "a", "urlparse", ".", "ParseResult", "object", "with", "the", "results", "of", "parsing", "the", "given", "URI", ".", "This", "has", "the", "same", "properties", "as", "the", "result", "of", "parse_uri", "." ]
python
train