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
Esri/ArcREST
src/arcrest/manageags/_system.py
https://github.com/Esri/ArcREST/blob/ab240fde2b0200f61d4a5f6df033516e53f2f416/src/arcrest/manageags/_system.py#L150-L168
def registerDirs(self,json_dirs): """ Registers multiple new server directories. Inputs: json_dirs - Array of Server Directories in JSON format. """ url = self._url + "/directories/registerDirs" params = { "f" : "json", "directories" : ...
[ "def", "registerDirs", "(", "self", ",", "json_dirs", ")", ":", "url", "=", "self", ".", "_url", "+", "\"/directories/registerDirs\"", "params", "=", "{", "\"f\"", ":", "\"json\"", ",", "\"directories\"", ":", "json_dirs", "}", "res", "=", "self", ".", "_p...
Registers multiple new server directories. Inputs: json_dirs - Array of Server Directories in JSON format.
[ "Registers", "multiple", "new", "server", "directories", ".", "Inputs", ":", "json_dirs", "-", "Array", "of", "Server", "Directories", "in", "JSON", "format", "." ]
python
train
ANTsX/ANTsPy
ants/registration/reorient_image.py
https://github.com/ANTsX/ANTsPy/blob/638020af2cdfc5ff4bdb9809ffe67aa505727a3b/ants/registration/reorient_image.py#L171-L200
def get_center_of_mass(image): """ Compute an image center of mass in physical space which is defined as the mean of the intensity weighted voxel coordinate system. ANTsR function: `getCenterOfMass` Arguments --------- image : ANTsImage image from which center of mass will be ...
[ "def", "get_center_of_mass", "(", "image", ")", ":", "if", "image", ".", "pixeltype", "!=", "'float'", ":", "image", "=", "image", ".", "clone", "(", "'float'", ")", "libfn", "=", "utils", ".", "get_lib_fn", "(", "'centerOfMass%s'", "%", "image", ".", "_...
Compute an image center of mass in physical space which is defined as the mean of the intensity weighted voxel coordinate system. ANTsR function: `getCenterOfMass` Arguments --------- image : ANTsImage image from which center of mass will be computed Returns ------- scala...
[ "Compute", "an", "image", "center", "of", "mass", "in", "physical", "space", "which", "is", "defined", "as", "the", "mean", "of", "the", "intensity", "weighted", "voxel", "coordinate", "system", "." ]
python
train
marcomusy/vtkplotter
vtkplotter/analysis.py
https://github.com/marcomusy/vtkplotter/blob/692c3396782722ec525bc1346a26999868c650c6/vtkplotter/analysis.py#L445-L454
def delaunay3D(dataset, alpha=0, tol=None, boundary=True): """Create 3D Delaunay triangulation of input points.""" deln = vtk.vtkDelaunay3D() deln.SetInputData(dataset) deln.SetAlpha(alpha) if tol: deln.SetTolerance(tol) deln.SetBoundingTriangulation(boundary)...
[ "def", "delaunay3D", "(", "dataset", ",", "alpha", "=", "0", ",", "tol", "=", "None", ",", "boundary", "=", "True", ")", ":", "deln", "=", "vtk", ".", "vtkDelaunay3D", "(", ")", "deln", ".", "SetInputData", "(", "dataset", ")", "deln", ".", "SetAlpha...
Create 3D Delaunay triangulation of input points.
[ "Create", "3D", "Delaunay", "triangulation", "of", "input", "points", "." ]
python
train
sparknetworks/pgpm
pgpm/lib/utils/config.py
https://github.com/sparknetworks/pgpm/blob/1a060df46a886095181f692ea870a73a32510a2e/pgpm/lib/utils/config.py#L180-L197
def to_string(self): """ stringifies version :return: string of version """ if self.major == -1: major_str = 'x' else: major_str = self.major if self.minor == -1: minor_str = 'x' else: minor_str = self.minor ...
[ "def", "to_string", "(", "self", ")", ":", "if", "self", ".", "major", "==", "-", "1", ":", "major_str", "=", "'x'", "else", ":", "major_str", "=", "self", ".", "major", "if", "self", ".", "minor", "==", "-", "1", ":", "minor_str", "=", "'x'", "e...
stringifies version :return: string of version
[ "stringifies", "version", ":", "return", ":", "string", "of", "version" ]
python
train
lucapinello/Haystack
haystack/external.py
https://github.com/lucapinello/Haystack/blob/cc080d741f36cd77b07c0b59d08ea6a4cf0ef2f7/haystack/external.py#L994-L1003
def trimmed(self,thresh=0.1): """ m.trimmed(,thresh=0.1) -- Return motif with low-information flanks removed. 'thresh' is in bits. """ for start in range(0,self.width-1): if self.bits[start]>=thresh: break for stop in range(self.width,1,-1): if self.bit...
[ "def", "trimmed", "(", "self", ",", "thresh", "=", "0.1", ")", ":", "for", "start", "in", "range", "(", "0", ",", "self", ".", "width", "-", "1", ")", ":", "if", "self", ".", "bits", "[", "start", "]", ">=", "thresh", ":", "break", "for", "stop...
m.trimmed(,thresh=0.1) -- Return motif with low-information flanks removed. 'thresh' is in bits.
[ "m", ".", "trimmed", "(", "thresh", "=", "0", ".", "1", ")", "--", "Return", "motif", "with", "low", "-", "information", "flanks", "removed", ".", "thresh", "is", "in", "bits", "." ]
python
train
O365/python-o365
O365/excel.py
https://github.com/O365/python-o365/blob/02a71cf3775cc6a3c042e003365d6a07c8c75a73/O365/excel.py#L851-L857
def get_format(self): """ Returns a RangeFormat instance with the format of this range """ url = self.build_url(self._endpoints.get('get_format')) response = self.session.get(url) if not response: return None return self.range_format_constructor(parent=self, **{self._...
[ "def", "get_format", "(", "self", ")", ":", "url", "=", "self", ".", "build_url", "(", "self", ".", "_endpoints", ".", "get", "(", "'get_format'", ")", ")", "response", "=", "self", ".", "session", ".", "get", "(", "url", ")", "if", "not", "response"...
Returns a RangeFormat instance with the format of this range
[ "Returns", "a", "RangeFormat", "instance", "with", "the", "format", "of", "this", "range" ]
python
train
lacava/few
few/population.py
https://github.com/lacava/few/blob/5c72044425e9a5d73b8dc2cbb9b96e873dcb5b4a/few/population.py#L231-L298
def init_pop(self): """initializes population of features as GP stacks.""" pop = Pop(self.population_size) seed_with_raw_features = False # make programs if self.seed_with_ml: # initial population is the components of the default ml model if (self.ml_type ...
[ "def", "init_pop", "(", "self", ")", ":", "pop", "=", "Pop", "(", "self", ".", "population_size", ")", "seed_with_raw_features", "=", "False", "# make programs", "if", "self", ".", "seed_with_ml", ":", "# initial population is the components of the default ml model", ...
initializes population of features as GP stacks.
[ "initializes", "population", "of", "features", "as", "GP", "stacks", "." ]
python
train
agoragames/haigha
haigha/writer.py
https://github.com/agoragames/haigha/blob/7b004e1c0316ec14b94fec1c54554654c38b1a25/haigha/writer.py#L69-L74
def write_bit(self, b, pack=Struct('B').pack): ''' Write a single bit. Convenience method for single bit args. ''' self._output_buffer.append(pack(True if b else False)) return self
[ "def", "write_bit", "(", "self", ",", "b", ",", "pack", "=", "Struct", "(", "'B'", ")", ".", "pack", ")", ":", "self", ".", "_output_buffer", ".", "append", "(", "pack", "(", "True", "if", "b", "else", "False", ")", ")", "return", "self" ]
Write a single bit. Convenience method for single bit args.
[ "Write", "a", "single", "bit", ".", "Convenience", "method", "for", "single", "bit", "args", "." ]
python
train
hazelcast/hazelcast-python-client
hazelcast/proxy/map.py
https://github.com/hazelcast/hazelcast-python-client/blob/3f6639443c23d6d036aa343f8e094f052250d2c1/hazelcast/proxy/map.py#L544-L574
def put_if_absent(self, key, value, ttl=-1): """ Associates the specified key with the given value if it is not already associated. If ttl is provided, entry will expire and get evicted after the ttl. This is equivalent to: >>> if not map.contains_key(key): >>> ...
[ "def", "put_if_absent", "(", "self", ",", "key", ",", "value", ",", "ttl", "=", "-", "1", ")", ":", "check_not_none", "(", "key", ",", "\"key can't be None\"", ")", "check_not_none", "(", "value", ",", "\"value can't be None\"", ")", "key_data", "=", "self",...
Associates the specified key with the given value if it is not already associated. If ttl is provided, entry will expire and get evicted after the ttl. This is equivalent to: >>> if not map.contains_key(key): >>> return map.put(key,value) >>> else: >>...
[ "Associates", "the", "specified", "key", "with", "the", "given", "value", "if", "it", "is", "not", "already", "associated", ".", "If", "ttl", "is", "provided", "entry", "will", "expire", "and", "get", "evicted", "after", "the", "ttl", "." ]
python
train
bitesofcode/projexui
projexui/widgets/xtoolbutton.py
https://github.com/bitesofcode/projexui/blob/f18a73bec84df90b034ca69b9deea118dbedfc4d/projexui/widgets/xtoolbutton.py#L303-L312
def setEnabled(self, state): """ Updates the drop shadow effect for this widget on enable/disable state change. :param state | <bool> """ super(XToolButton, self).setEnabled(state) self.updateUi()
[ "def", "setEnabled", "(", "self", ",", "state", ")", ":", "super", "(", "XToolButton", ",", "self", ")", ".", "setEnabled", "(", "state", ")", "self", ".", "updateUi", "(", ")" ]
Updates the drop shadow effect for this widget on enable/disable state change. :param state | <bool>
[ "Updates", "the", "drop", "shadow", "effect", "for", "this", "widget", "on", "enable", "/", "disable", "state", "change", ".", ":", "param", "state", "|", "<bool", ">" ]
python
train
google/openhtf
openhtf/plugs/usb/adb_protocol.py
https://github.com/google/openhtf/blob/655e85df7134db7bdf8f8fdd6ff9a6bf932e7b09/openhtf/plugs/usb/adb_protocol.py#L440-L455
def enqueue_message(self, message, timeout): """Add the given message to this transport's queue. This method also handles ACKing any WRTE messages. Args: message: The AdbMessage to enqueue. timeout: The timeout to use for the operation. Specifically, WRTE messages cause an OKAY to be ...
[ "def", "enqueue_message", "(", "self", ",", "message", ",", "timeout", ")", ":", "# Ack WRTE messages immediately, handle our OPEN ack if it gets enqueued.", "if", "message", ".", "command", "==", "'WRTE'", ":", "self", ".", "_send_command", "(", "'OKAY'", ",", "timeo...
Add the given message to this transport's queue. This method also handles ACKing any WRTE messages. Args: message: The AdbMessage to enqueue. timeout: The timeout to use for the operation. Specifically, WRTE messages cause an OKAY to be sent; timeout is used for that send.
[ "Add", "the", "given", "message", "to", "this", "transport", "s", "queue", "." ]
python
train
meejah/txtorcon
txtorcon/torconfig.py
https://github.com/meejah/txtorcon/blob/14053b95adf0b4bd9dd9c317bece912a26578a93/txtorcon/torconfig.py#L841-L867
def _conf_changed(self, arg): """ internal callback. from control-spec: 4.1.18. Configuration changed The syntax is: StartReplyLine *(MidReplyLine) EndReplyLine StartReplyLine = "650-CONF_CHANGED" CRLF MidReplyLine = "650-" KEYWORD ["=" VALUE] ...
[ "def", "_conf_changed", "(", "self", ",", "arg", ")", ":", "conf", "=", "parse_keywords", "(", "arg", ",", "multiline_values", "=", "False", ")", "for", "(", "k", ",", "v", ")", "in", "conf", ".", "items", "(", ")", ":", "# v will be txtorcon.DEFAULT_VAL...
internal callback. from control-spec: 4.1.18. Configuration changed The syntax is: StartReplyLine *(MidReplyLine) EndReplyLine StartReplyLine = "650-CONF_CHANGED" CRLF MidReplyLine = "650-" KEYWORD ["=" VALUE] CRLF EndReplyLine = "650 OK" ...
[ "internal", "callback", ".", "from", "control", "-", "spec", ":" ]
python
train
croscon/fleaker
fleaker/marshmallow/fields/foreign_key.py
https://github.com/croscon/fleaker/blob/046b026b79c9912bceebb17114bc0c5d2d02e3c7/fleaker/marshmallow/fields/foreign_key.py#L36-L49
def _add_to_schema(self, field_name, schema): """Set the ``attribute`` attr to the field in question so this always gets deserialzed into the field name without ``_id``. Args: field_name (str): The name of the field (the attribute name being set in the schema). ...
[ "def", "_add_to_schema", "(", "self", ",", "field_name", ",", "schema", ")", ":", "super", "(", "ForeignKeyField", ",", "self", ")", ".", "_add_to_schema", "(", "field_name", ",", "schema", ")", "if", "self", ".", "get_field_value", "(", "'convert_fks'", ","...
Set the ``attribute`` attr to the field in question so this always gets deserialzed into the field name without ``_id``. Args: field_name (str): The name of the field (the attribute name being set in the schema). schema (marshmallow.Schema): The actual parent sch...
[ "Set", "the", "attribute", "attr", "to", "the", "field", "in", "question", "so", "this", "always", "gets", "deserialzed", "into", "the", "field", "name", "without", "_id", "." ]
python
train
mitsei/dlkit
dlkit/json_/authorization/managers.py
https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/json_/authorization/managers.py#L702-L717
def get_vault_hierarchy_design_session(self): """Gets the session designing vault hierarchies. return: (osid.authorization.VaultHierarchyDesignSession) - a ``VaultHierarchyDesignSession`` raise: OperationFailed - unable to complete request raise: Unimplemented - ``supp...
[ "def", "get_vault_hierarchy_design_session", "(", "self", ")", ":", "if", "not", "self", ".", "supports_vault_hierarchy_design", "(", ")", ":", "raise", "errors", ".", "Unimplemented", "(", ")", "# pylint: disable=no-member", "return", "sessions", ".", "VaultHierarchy...
Gets the session designing vault hierarchies. return: (osid.authorization.VaultHierarchyDesignSession) - a ``VaultHierarchyDesignSession`` raise: OperationFailed - unable to complete request raise: Unimplemented - ``supports_vault_hierarchy_design() is false`` ...
[ "Gets", "the", "session", "designing", "vault", "hierarchies", "." ]
python
train
tensorflow/skflow
scripts/docs/docs.py
https://github.com/tensorflow/skflow/blob/f8da498a1abb7562f57dfc7010941578103061b6/scripts/docs/docs.py#L377-L395
def _write_member_markdown_to_file(self, f, prefix, name, member): """Print `member` to `f`.""" if (inspect.isfunction(member) or inspect.ismethod(member) or isinstance(member, property)): print("- - -", file=f) print("", file=f) self._print_function(f, prefix, name, member) prin...
[ "def", "_write_member_markdown_to_file", "(", "self", ",", "f", ",", "prefix", ",", "name", ",", "member", ")", ":", "if", "(", "inspect", ".", "isfunction", "(", "member", ")", "or", "inspect", ".", "ismethod", "(", "member", ")", "or", "isinstance", "(...
Print `member` to `f`.
[ "Print", "member", "to", "f", "." ]
python
train
Devoxin/Lavalink.py
lavalink/PlayerManager.py
https://github.com/Devoxin/Lavalink.py/blob/63f55c3d726d24c4cfd3674d3cd6aab6f5be110d/lavalink/PlayerManager.py#L170-L174
async def handle_event(self, event): """ Makes the player play the next song from the queue if a song has finished or an issue occurred. """ if isinstance(event, (TrackStuckEvent, TrackExceptionEvent)) or \ isinstance(event, TrackEndEvent) and event.reason == 'FINISHED': ...
[ "async", "def", "handle_event", "(", "self", ",", "event", ")", ":", "if", "isinstance", "(", "event", ",", "(", "TrackStuckEvent", ",", "TrackExceptionEvent", ")", ")", "or", "isinstance", "(", "event", ",", "TrackEndEvent", ")", "and", "event", ".", "rea...
Makes the player play the next song from the queue if a song has finished or an issue occurred.
[ "Makes", "the", "player", "play", "the", "next", "song", "from", "the", "queue", "if", "a", "song", "has", "finished", "or", "an", "issue", "occurred", "." ]
python
valid
jwkvam/bowtie
bowtie/_component.py
https://github.com/jwkvam/bowtie/blob/c494850671ac805bf186fbf2bdb07d2a34ae876d/bowtie/_component.py#L165-L179
def make_event(event: Callable) -> Callable: """Create an event from a method signature.""" @property # type: ignore @wraps(event) def actualevent(self): # pylint: disable=missing-docstring name = event.__name__[3:] try: # the getter post processing function # i...
[ "def", "make_event", "(", "event", ":", "Callable", ")", "->", "Callable", ":", "@", "property", "# type: ignore", "@", "wraps", "(", "event", ")", "def", "actualevent", "(", "self", ")", ":", "# pylint: disable=missing-docstring", "name", "=", "event", ".", ...
Create an event from a method signature.
[ "Create", "an", "event", "from", "a", "method", "signature", "." ]
python
train
AlpacaDB/selectivesearch
selectivesearch/selectivesearch.py
https://github.com/AlpacaDB/selectivesearch/blob/52f7f83bb247b1ed941b099c6a610da1b0e30451/selectivesearch/selectivesearch.py#L74-L100
def _calc_colour_hist(img): """ calculate colour histogram for each region the size of output histogram will be BINS * COLOUR_CHANNELS(3) number of bins is 25 as same as [uijlings_ijcv2013_draft.pdf] extract HSV """ BINS = 25 hist = numpy.array([]) for colour_cha...
[ "def", "_calc_colour_hist", "(", "img", ")", ":", "BINS", "=", "25", "hist", "=", "numpy", ".", "array", "(", "[", "]", ")", "for", "colour_channel", "in", "(", "0", ",", "1", ",", "2", ")", ":", "# extracting one colour channel", "c", "=", "img", "[...
calculate colour histogram for each region the size of output histogram will be BINS * COLOUR_CHANNELS(3) number of bins is 25 as same as [uijlings_ijcv2013_draft.pdf] extract HSV
[ "calculate", "colour", "histogram", "for", "each", "region" ]
python
train
dhermes/bezier
src/bezier/_surface_helpers.py
https://github.com/dhermes/bezier/blob/4f941f82637a8e70a5b159a9203132192e23406b/src/bezier/_surface_helpers.py#L2826-L2852
def _evaluate_barycentric_multi(nodes, degree, param_vals, dimension): r"""Compute multiple points on the surface. .. note:: There is also a Fortran implementation of this function, which will be used if it can be built. Args: nodes (numpy.ndarray): Control point nodes that define t...
[ "def", "_evaluate_barycentric_multi", "(", "nodes", ",", "degree", ",", "param_vals", ",", "dimension", ")", ":", "num_vals", ",", "_", "=", "param_vals", ".", "shape", "result", "=", "np", ".", "empty", "(", "(", "dimension", ",", "num_vals", ")", ",", ...
r"""Compute multiple points on the surface. .. note:: There is also a Fortran implementation of this function, which will be used if it can be built. Args: nodes (numpy.ndarray): Control point nodes that define the surface. degree (int): The degree of the surface define by ``nod...
[ "r", "Compute", "multiple", "points", "on", "the", "surface", "." ]
python
train
mikedh/trimesh
trimesh/transformations.py
https://github.com/mikedh/trimesh/blob/25e059bf6d4caa74f62ffd58ce4f61a90ee4e518/trimesh/transformations.py#L1420-L1431
def quaternion_conjugate(quaternion): """Return conjugate of quaternion. >>> q0 = random_quaternion() >>> q1 = quaternion_conjugate(q0) >>> q1[0] == q0[0] and all(q1[1:] == -q0[1:]) True """ q = np.array(quaternion, dtype=np.float64, copy=True) np.negative(q[1:], q[1:]) return q
[ "def", "quaternion_conjugate", "(", "quaternion", ")", ":", "q", "=", "np", ".", "array", "(", "quaternion", ",", "dtype", "=", "np", ".", "float64", ",", "copy", "=", "True", ")", "np", ".", "negative", "(", "q", "[", "1", ":", "]", ",", "q", "[...
Return conjugate of quaternion. >>> q0 = random_quaternion() >>> q1 = quaternion_conjugate(q0) >>> q1[0] == q0[0] and all(q1[1:] == -q0[1:]) True
[ "Return", "conjugate", "of", "quaternion", "." ]
python
train
BerkeleyAutomation/autolab_core
autolab_core/logger.py
https://github.com/BerkeleyAutomation/autolab_core/blob/8f3813f6401972868cc5e3981ba1b4382d4418d5/autolab_core/logger.py#L41-L57
def add_root_log_file(log_file): """ Add a log file to the root logger. Parameters ---------- log_file :obj:`str` The path to the log file. """ root_logger = logging.getLogger() # add a file handle to the root logger hdlr = logging.FileHandler(log_file) formatter = logg...
[ "def", "add_root_log_file", "(", "log_file", ")", ":", "root_logger", "=", "logging", ".", "getLogger", "(", ")", "# add a file handle to the root logger", "hdlr", "=", "logging", ".", "FileHandler", "(", "log_file", ")", "formatter", "=", "logging", ".", "Formatt...
Add a log file to the root logger. Parameters ---------- log_file :obj:`str` The path to the log file.
[ "Add", "a", "log", "file", "to", "the", "root", "logger", "." ]
python
train
JukeboxPipeline/jukebox-core
src/jukeboxcore/gui/widgetdelegate.py
https://github.com/JukeboxPipeline/jukebox-core/blob/bac2280ca49940355270e4b69400ce9976ab2e6f/src/jukeboxcore/gui/widgetdelegate.py#L393-L459
def propagate_event_to_delegate(self, event, eventhandler): """Propagate the given Mouse event to the widgetdelegate Enter edit mode, get the editor widget and issue an event on that widget. :param event: the mouse event :type event: :class:`QtGui.QMouseEvent` :param eventhandl...
[ "def", "propagate_event_to_delegate", "(", "self", ",", "event", ",", "eventhandler", ")", ":", "# if we are recursing because we sent a click event, and it got propagated to the parents", "# and we recieve it again, terminate", "if", "self", ".", "__recursing", ":", "return", "#...
Propagate the given Mouse event to the widgetdelegate Enter edit mode, get the editor widget and issue an event on that widget. :param event: the mouse event :type event: :class:`QtGui.QMouseEvent` :param eventhandler: the eventhandler to use. E.g. ``"mousePressEvent"`` :type e...
[ "Propagate", "the", "given", "Mouse", "event", "to", "the", "widgetdelegate" ]
python
train
openwisp/netjsonconfig
netjsonconfig/backends/openwrt/converters/interfaces.py
https://github.com/openwisp/netjsonconfig/blob/c23ce9732720856e2f6dc54060db71a8182c7d4b/netjsonconfig/backends/openwrt/converters/interfaces.py#L125-L154
def __intermediate_bridge(self, interface, i): """ converts NetJSON bridge to UCI intermediate data structure """ # ensure type "bridge" is only given to one logical interface if interface['type'] == 'bridge' and i < 2: bridge_members = ' '.join(interface.pop(...
[ "def", "__intermediate_bridge", "(", "self", ",", "interface", ",", "i", ")", ":", "# ensure type \"bridge\" is only given to one logical interface", "if", "interface", "[", "'type'", "]", "==", "'bridge'", "and", "i", "<", "2", ":", "bridge_members", "=", "' '", ...
converts NetJSON bridge to UCI intermediate data structure
[ "converts", "NetJSON", "bridge", "to", "UCI", "intermediate", "data", "structure" ]
python
valid
python-cas/python-cas
cas.py
https://github.com/python-cas/python-cas/blob/42fc76fbd2e50f167e752eba4bf5b0df74a83978/cas.py#L29-L41
def verify_logout_request(cls, logout_request, ticket): """verifies the single logout request came from the CAS server returns True if the logout_request is valid, False otherwise """ try: session_index = cls.get_saml_slos(logout_request) session_index = session_i...
[ "def", "verify_logout_request", "(", "cls", ",", "logout_request", ",", "ticket", ")", ":", "try", ":", "session_index", "=", "cls", ".", "get_saml_slos", "(", "logout_request", ")", "session_index", "=", "session_index", "[", "0", "]", ".", "text", "if", "s...
verifies the single logout request came from the CAS server returns True if the logout_request is valid, False otherwise
[ "verifies", "the", "single", "logout", "request", "came", "from", "the", "CAS", "server", "returns", "True", "if", "the", "logout_request", "is", "valid", "False", "otherwise" ]
python
train
Kortemme-Lab/klab
klab/bio/uniprot.py
https://github.com/Kortemme-Lab/klab/blob/6d410ad08f1bd9f7cbbb28d7d946e94fbaaa2b6b/klab/bio/uniprot.py#L542-L560
def _parse_sequence_tag(self): '''Parses the sequence and atomic mass.''' #main_tags = self._dom.getElementsByTagName("uniprot") #assert(len(main_tags) == 1) #entry_tags = main_tags[0].getElementsByTagName("entry") #assert(len(entry_tags) == 1) #entry_tags[0] ent...
[ "def", "_parse_sequence_tag", "(", "self", ")", ":", "#main_tags = self._dom.getElementsByTagName(\"uniprot\")", "#assert(len(main_tags) == 1)", "#entry_tags = main_tags[0].getElementsByTagName(\"entry\")", "#assert(len(entry_tags) == 1)", "#entry_tags[0]", "entry_tag", "=", "self", ".",...
Parses the sequence and atomic mass.
[ "Parses", "the", "sequence", "and", "atomic", "mass", "." ]
python
train
senaite/senaite.core
bika/lims/content/analysis.py
https://github.com/senaite/senaite.core/blob/7602ce2ea2f9e81eb34e20ce17b98a3e70713f85/bika/lims/content/analysis.py#L43-L70
def getSiblings(self, retracted=False): """ Returns the list of analyses of the Analysis Request to which this analysis belongs to, but with the current analysis excluded. :param retracted: If false, retracted/rejected siblings are dismissed :type retracted: bool :return:...
[ "def", "getSiblings", "(", "self", ",", "retracted", "=", "False", ")", ":", "request", "=", "self", ".", "getRequest", "(", ")", "if", "not", "request", ":", "return", "[", "]", "siblings", "=", "[", "]", "retracted_states", "=", "[", "STATE_RETRACTED",...
Returns the list of analyses of the Analysis Request to which this analysis belongs to, but with the current analysis excluded. :param retracted: If false, retracted/rejected siblings are dismissed :type retracted: bool :return: list of siblings for this analysis :rtype: list of ...
[ "Returns", "the", "list", "of", "analyses", "of", "the", "Analysis", "Request", "to", "which", "this", "analysis", "belongs", "to", "but", "with", "the", "current", "analysis", "excluded", ".", ":", "param", "retracted", ":", "If", "false", "retracted", "/",...
python
train
ibis-project/ibis
ibis/pandas/udf.py
https://github.com/ibis-project/ibis/blob/1e39a5fd9ef088b45c155e8a5f541767ee8ef2e7/ibis/pandas/udf.py#L433-L527
def _grouped(input_type, output_type, base_class, output_type_method): """Define a user-defined function that is applied per group. Parameters ---------- input_type : List[ibis.expr.datatypes.DataType] A list of the types found in :mod:`~ibis.expr.datatypes`. The ...
[ "def", "_grouped", "(", "input_type", ",", "output_type", ",", "base_class", ",", "output_type_method", ")", ":", "def", "wrapper", "(", "func", ")", ":", "funcsig", "=", "valid_function_signature", "(", "input_type", ",", "func", ")", "UDAFNode", "=", "type",...
Define a user-defined function that is applied per group. Parameters ---------- input_type : List[ibis.expr.datatypes.DataType] A list of the types found in :mod:`~ibis.expr.datatypes`. The length of this list must match the number of arguments to the functio...
[ "Define", "a", "user", "-", "defined", "function", "that", "is", "applied", "per", "group", "." ]
python
train
cjdrake/pyeda
pyeda/boolalg/expr.py
https://github.com/cjdrake/pyeda/blob/554ee53aa678f4b61bcd7e07ba2c74ddc749d665/pyeda/boolalg/expr.py#L1386-L1395
def satisfy_all(self, **params): """Iterate through all satisfying input points.""" verbosity = params.get('verbosity', 0) default_phase = params.get('default_phase', 2) propagation_limit = params.get('propagation_limit', -1) decision_limit = params.get('decision_limit', -1) ...
[ "def", "satisfy_all", "(", "self", ",", "*", "*", "params", ")", ":", "verbosity", "=", "params", ".", "get", "(", "'verbosity'", ",", "0", ")", "default_phase", "=", "params", ".", "get", "(", "'default_phase'", ",", "2", ")", "propagation_limit", "=", ...
Iterate through all satisfying input points.
[ "Iterate", "through", "all", "satisfying", "input", "points", "." ]
python
train
AkihikoITOH/capybara
capybara/virtualenv/lib/python2.7/site-packages/lxml/html/html5parser.py
https://github.com/AkihikoITOH/capybara/blob/e86c2173ea386654f4ae061148e8fbe3f25e715c/capybara/virtualenv/lib/python2.7/site-packages/lxml/html/html5parser.py#L95-L133
def fragment_fromstring(html, create_parent=False, guess_charset=False, parser=None): """Parses a single HTML element; it is an error if there is more than one element, or if anything but whitespace precedes or follows the element. If create_parent is true (or is a tag name) the...
[ "def", "fragment_fromstring", "(", "html", ",", "create_parent", "=", "False", ",", "guess_charset", "=", "False", ",", "parser", "=", "None", ")", ":", "if", "not", "isinstance", "(", "html", ",", "_strings", ")", ":", "raise", "TypeError", "(", "'string ...
Parses a single HTML element; it is an error if there is more than one element, or if anything but whitespace precedes or follows the element. If create_parent is true (or is a tag name) then a parent node will be created to encapsulate the HTML in a single element. In this case, leading or traili...
[ "Parses", "a", "single", "HTML", "element", ";", "it", "is", "an", "error", "if", "there", "is", "more", "than", "one", "element", "or", "if", "anything", "but", "whitespace", "precedes", "or", "follows", "the", "element", "." ]
python
test
tcalmant/ipopo
pelix/shell/core.py
https://github.com/tcalmant/ipopo/blob/2f9ae0c44cd9c34ef1a9d50837b3254e75678eb1/pelix/shell/core.py#L268-L289
def unbind_handler(self, svc_ref): """ Called if a command service is gone. Unregisters its commands. :param svc_ref: A reference to the unbound service :return: True if the commands have been unregistered """ if svc_ref not in self._bound_references: ...
[ "def", "unbind_handler", "(", "self", ",", "svc_ref", ")", ":", "if", "svc_ref", "not", "in", "self", ".", "_bound_references", ":", "# Unknown reference", "return", "False", "# Unregister its commands", "namespace", ",", "commands", "=", "self", ".", "_reference_...
Called if a command service is gone. Unregisters its commands. :param svc_ref: A reference to the unbound service :return: True if the commands have been unregistered
[ "Called", "if", "a", "command", "service", "is", "gone", ".", "Unregisters", "its", "commands", "." ]
python
train
h2oai/h2o-3
h2o-py/h2o/estimators/estimator_base.py
https://github.com/h2oai/h2o-3/blob/dd62aaa1e7f680a8b16ee14bc66b0fb5195c2ad8/h2o-py/h2o/estimators/estimator_base.py#L353-L369
def get_params(self, deep=True): """ Obtain parameters for this estimator. Used primarily for sklearn Pipelines and sklearn grid search. :param deep: If True, return parameters of all sub-objects that are estimators. :returns: A dict of parameters """ out = dic...
[ "def", "get_params", "(", "self", ",", "deep", "=", "True", ")", ":", "out", "=", "dict", "(", ")", "for", "key", ",", "value", "in", "self", ".", "parms", ".", "items", "(", ")", ":", "if", "deep", "and", "isinstance", "(", "value", ",", "H2OEst...
Obtain parameters for this estimator. Used primarily for sklearn Pipelines and sklearn grid search. :param deep: If True, return parameters of all sub-objects that are estimators. :returns: A dict of parameters
[ "Obtain", "parameters", "for", "this", "estimator", "." ]
python
test
eisber/sarplus
python/pysarplus/SARPlus.py
https://github.com/eisber/sarplus/blob/945a1182e00a8bf70414fc3600086316701777f9/python/pysarplus/SARPlus.py#L323-L362
def recommend_k_items_slow(self, test, top_k=10, remove_seen=True): """Recommend top K items for all users which are in the test set. Args: test: test Spark dataframe top_k: top n items to return remove_seen: remove items test users have already seen in the past from...
[ "def", "recommend_k_items_slow", "(", "self", ",", "test", ",", "top_k", "=", "10", ",", "remove_seen", "=", "True", ")", ":", "# TODO: remove seen", "if", "remove_seen", ":", "raise", "ValueError", "(", "\"Not implemented\"", ")", "self", ".", "get_user_affinit...
Recommend top K items for all users which are in the test set. Args: test: test Spark dataframe top_k: top n items to return remove_seen: remove items test users have already seen in the past from the recommended set.
[ "Recommend", "top", "K", "items", "for", "all", "users", "which", "are", "in", "the", "test", "set", "." ]
python
test
saltstack/salt
salt/modules/win_wua.py
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/win_wua.py#L331-L479
def list(software=True, drivers=False, summary=False, skip_installed=True, categories=None, severities=None, download=False, install=False): ''' .. versionadded:: 2017.7.0 Returns a detailed list of available updates or a summary. If download o...
[ "def", "list", "(", "software", "=", "True", ",", "drivers", "=", "False", ",", "summary", "=", "False", ",", "skip_installed", "=", "True", ",", "categories", "=", "None", ",", "severities", "=", "None", ",", "download", "=", "False", ",", "install", ...
.. versionadded:: 2017.7.0 Returns a detailed list of available updates or a summary. If download or install is True the same list will be downloaded and/or installed. Args: software (bool): Include software updates in the results (default is True) drivers (bool): ...
[ "..", "versionadded", "::", "2017", ".", "7", ".", "0" ]
python
train
SoCo/SoCo
dev_tools/analyse_ws.py
https://github.com/SoCo/SoCo/blob/671937e07d7973b78c0cbee153d4f3ad68ec48c6/dev_tools/analyse_ws.py#L127-L159
def _parse_load(self, load): """ Parse the load from a single packet """ # If the load is ?? if load in ['??']: self._debug('IGNORING') # If there is a start in load elif any([start in load for start in STARTS]): self._debug('START') self.messa...
[ "def", "_parse_load", "(", "self", ",", "load", ")", ":", "# If the load is ??", "if", "load", "in", "[", "'??'", "]", ":", "self", ".", "_debug", "(", "'IGNORING'", ")", "# If there is a start in load", "elif", "any", "(", "[", "start", "in", "load", "for...
Parse the load from a single packet
[ "Parse", "the", "load", "from", "a", "single", "packet" ]
python
train
bububa/pyTOP
pyTOP/trade.py
https://github.com/bububa/pyTOP/blob/1e48009bcfe886be392628244b370e6374e1f2b2/pyTOP/trade.py#L253-L266
def bought_get(self, session, fields=[], **kwargs): '''taobao.trades.bought.get 搜索当前会话用户作为买家达成的交易记录 搜索当前会话用户作为买家达成的交易记录(目前只能查询三个月以内的订单)''' request = TOPRequest('taobao.trades.bought.get') if not fields: trade = Trade() fields = trade.fields reques...
[ "def", "bought_get", "(", "self", ",", "session", ",", "fields", "=", "[", "]", ",", "*", "*", "kwargs", ")", ":", "request", "=", "TOPRequest", "(", "'taobao.trades.bought.get'", ")", "if", "not", "fields", ":", "trade", "=", "Trade", "(", ")", "field...
taobao.trades.bought.get 搜索当前会话用户作为买家达成的交易记录 搜索当前会话用户作为买家达成的交易记录(目前只能查询三个月以内的订单)
[ "taobao", ".", "trades", ".", "bought", ".", "get", "搜索当前会话用户作为买家达成的交易记录", "搜索当前会话用户作为买家达成的交易记录", "(", "目前只能查询三个月以内的订单", ")" ]
python
train
horazont/aioxmpp
aioxmpp/bookmarks/service.py
https://github.com/horazont/aioxmpp/blob/22a68e5e1d23f2a4dee470092adbd4672f9ef061/aioxmpp/bookmarks/service.py#L141-L265
def _diff_emit_update(self, new_bookmarks): """ Diff the bookmark cache and the new bookmark state, emit signals as needed and set the bookmark cache to the new data. """ self.logger.debug("diffing %s, %s", self._bookmark_cache, new_bookmarks) ...
[ "def", "_diff_emit_update", "(", "self", ",", "new_bookmarks", ")", ":", "self", ".", "logger", ".", "debug", "(", "\"diffing %s, %s\"", ",", "self", ".", "_bookmark_cache", ",", "new_bookmarks", ")", "def", "subdivide", "(", "level", ",", "old", ",", "new",...
Diff the bookmark cache and the new bookmark state, emit signals as needed and set the bookmark cache to the new data.
[ "Diff", "the", "bookmark", "cache", "and", "the", "new", "bookmark", "state", "emit", "signals", "as", "needed", "and", "set", "the", "bookmark", "cache", "to", "the", "new", "data", "." ]
python
train
libtcod/python-tcod
tcod/console.py
https://github.com/libtcod/python-tcod/blob/8ba10c5cfb813eaf3e834de971ba2d6acb7838e4/tcod/console.py#L479-L527
def print_rect( self, x: int, y: int, width: int, height: int, string: str, bg_blend: int = tcod.constants.BKGND_DEFAULT, alignment: Optional[int] = None, ) -> int: """Print a string constrained to a rectangle. If h > 0 and the bottom ...
[ "def", "print_rect", "(", "self", ",", "x", ":", "int", ",", "y", ":", "int", ",", "width", ":", "int", ",", "height", ":", "int", ",", "string", ":", "str", ",", "bg_blend", ":", "int", "=", "tcod", ".", "constants", ".", "BKGND_DEFAULT", ",", "...
Print a string constrained to a rectangle. If h > 0 and the bottom of the rectangle is reached, the string is truncated. If h = 0, the string is only truncated if it reaches the bottom of the console. Args: x (int): The x coordinate from the left. y (int): The y...
[ "Print", "a", "string", "constrained", "to", "a", "rectangle", "." ]
python
train
opengridcc/opengrid
opengrid/library/regression.py
https://github.com/opengridcc/opengrid/blob/69b8da3c8fcea9300226c45ef0628cd6d4307651/opengrid/library/regression.py#L116-L155
def _do_analysis_no_cross_validation(self): """ Find the best model (fit) and create self.list_of_fits and self.fit """ # first model is just the mean response_term = [Term([LookupFactor(self.y)])] model_terms = [Term([])] # empty term is the intercept all_model_...
[ "def", "_do_analysis_no_cross_validation", "(", "self", ")", ":", "# first model is just the mean", "response_term", "=", "[", "Term", "(", "[", "LookupFactor", "(", "self", ".", "y", ")", "]", ")", "]", "model_terms", "=", "[", "Term", "(", "[", "]", ")", ...
Find the best model (fit) and create self.list_of_fits and self.fit
[ "Find", "the", "best", "model", "(", "fit", ")", "and", "create", "self", ".", "list_of_fits", "and", "self", ".", "fit" ]
python
train
kubernetes-client/python
kubernetes/client/apis/core_v1_api.py
https://github.com/kubernetes-client/python/blob/5e512ff564c244c50cab780d821542ed56aa965a/kubernetes/client/apis/core_v1_api.py#L13847-L13873
def list_replication_controller_for_all_namespaces(self, **kwargs): """ list or watch objects of kind ReplicationController This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True >>> thread = api.list_replication_...
[ "def", "list_replication_controller_for_all_namespaces", "(", "self", ",", "*", "*", "kwargs", ")", ":", "kwargs", "[", "'_return_http_data_only'", "]", "=", "True", "if", "kwargs", ".", "get", "(", "'async_req'", ")", ":", "return", "self", ".", "list_replicati...
list or watch objects of kind ReplicationController This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True >>> thread = api.list_replication_controller_for_all_namespaces(async_req=True) >>> result = thread.get() ...
[ "list", "or", "watch", "objects", "of", "kind", "ReplicationController", "This", "method", "makes", "a", "synchronous", "HTTP", "request", "by", "default", ".", "To", "make", "an", "asynchronous", "HTTP", "request", "please", "pass", "async_req", "=", "True", ...
python
train
enkore/i3pystatus
i3pystatus/weather/wunderground.py
https://github.com/enkore/i3pystatus/blob/14cfde967cecf79b40e223e35a04600f4c875af7/i3pystatus/weather/wunderground.py#L195-L289
def check_weather(self): ''' Query the configured/queried station and return the weather data ''' if self.station_id is None: # Failed to get the nearest station ID when first launched, so # retry it. self.get_station_id() self.data['update_er...
[ "def", "check_weather", "(", "self", ")", ":", "if", "self", ".", "station_id", "is", "None", ":", "# Failed to get the nearest station ID when first launched, so", "# retry it.", "self", ".", "get_station_id", "(", ")", "self", ".", "data", "[", "'update_error'", "...
Query the configured/queried station and return the weather data
[ "Query", "the", "configured", "/", "queried", "station", "and", "return", "the", "weather", "data" ]
python
train
mitsei/dlkit
dlkit/json_/relationship/managers.py
https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/json_/relationship/managers.py#L334-L356
def get_relationship_admin_session_for_family(self, family_id): """Gets the ``OsidSession`` associated with the relationship administration service for the given family. arg: family_id (osid.id.Id): the ``Id`` of the ``Family`` return: (osid.relationship.RelationshipAdminSession) - a ...
[ "def", "get_relationship_admin_session_for_family", "(", "self", ",", "family_id", ")", ":", "if", "not", "self", ".", "supports_relationship_admin", "(", ")", ":", "raise", "errors", ".", "Unimplemented", "(", ")", "##", "# Also include check to see if the catalog Id i...
Gets the ``OsidSession`` associated with the relationship administration service for the given family. arg: family_id (osid.id.Id): the ``Id`` of the ``Family`` return: (osid.relationship.RelationshipAdminSession) - a ``RelationshipAdminSession`` raise: NotFound - no family ...
[ "Gets", "the", "OsidSession", "associated", "with", "the", "relationship", "administration", "service", "for", "the", "given", "family", "." ]
python
train
deanmalmgren/textract
textract/parsers/odt_parser.py
https://github.com/deanmalmgren/textract/blob/117ea191d93d80321e4bf01f23cc1ac54d69a075/textract/parsers/odt_parser.py#L19-L28
def to_string(self): """ Converts the document to a string. """ buff = u"" for child in self.content.iter(): if child.tag in [self.qn('text:p'), self.qn('text:h')]: buff += self.text_to_string(child) + "\n" # remove last newline char if buff: ...
[ "def", "to_string", "(", "self", ")", ":", "buff", "=", "u\"\"", "for", "child", "in", "self", ".", "content", ".", "iter", "(", ")", ":", "if", "child", ".", "tag", "in", "[", "self", ".", "qn", "(", "'text:p'", ")", ",", "self", ".", "qn", "(...
Converts the document to a string.
[ "Converts", "the", "document", "to", "a", "string", "." ]
python
train
robotools/extractor
Lib/extractor/formats/opentype.py
https://github.com/robotools/extractor/blob/da3c2c92bfd3da863dd5de29bd8bc94cbbf433df/Lib/extractor/formats/opentype.py#L408-L420
def _makeScriptOrder(gpos): """ Run therough GPOS and make an alphabetically ordered list of scripts. If DFLT is in the list, move it to the front. """ scripts = [] for scriptRecord in gpos.ScriptList.ScriptRecord: scripts.append(scriptRecord.ScriptTag) if "DFLT" in scripts: ...
[ "def", "_makeScriptOrder", "(", "gpos", ")", ":", "scripts", "=", "[", "]", "for", "scriptRecord", "in", "gpos", ".", "ScriptList", ".", "ScriptRecord", ":", "scripts", ".", "append", "(", "scriptRecord", ".", "ScriptTag", ")", "if", "\"DFLT\"", "in", "scr...
Run therough GPOS and make an alphabetically ordered list of scripts. If DFLT is in the list, move it to the front.
[ "Run", "therough", "GPOS", "and", "make", "an", "alphabetically", "ordered", "list", "of", "scripts", ".", "If", "DFLT", "is", "in", "the", "list", "move", "it", "to", "the", "front", "." ]
python
train
wummel/linkchecker
third_party/miniboa-r42/miniboa/xterm.py
https://github.com/wummel/linkchecker/blob/c2ce810c3fb00b895a841a7be6b2e78c64e7b042/third_party/miniboa-r42/miniboa/xterm.py#L89-L110
def word_wrap(text, columns=80, indent=4, padding=2): """ Given a block of text, breaks into a list of lines wrapped to length. """ paragraphs = _PARA_BREAK.split(text) lines = [] columns -= padding for para in paragraphs: if para.isspace(): continue line = ' ...
[ "def", "word_wrap", "(", "text", ",", "columns", "=", "80", ",", "indent", "=", "4", ",", "padding", "=", "2", ")", ":", "paragraphs", "=", "_PARA_BREAK", ".", "split", "(", "text", ")", "lines", "=", "[", "]", "columns", "-=", "padding", "for", "p...
Given a block of text, breaks into a list of lines wrapped to length.
[ "Given", "a", "block", "of", "text", "breaks", "into", "a", "list", "of", "lines", "wrapped", "to", "length", "." ]
python
train
ska-sa/purr
Purr/Plugins/local_pychart/gs_frontend.py
https://github.com/ska-sa/purr/blob/4c848768d0485d0f88b30850d0d5372221b21b66/Purr/Plugins/local_pychart/gs_frontend.py#L24-L34
def _get_gs_path(): """Guess where the Ghostscript executable is and return its absolute path name.""" path = os.environ.get("PATH", os.defpath) for dir in path.split(os.pathsep): for name in ("gs", "gs.exe", "gswin32c.exe"): g = os.path.join(dir, name) if os.path.exists...
[ "def", "_get_gs_path", "(", ")", ":", "path", "=", "os", ".", "environ", ".", "get", "(", "\"PATH\"", ",", "os", ".", "defpath", ")", "for", "dir", "in", "path", ".", "split", "(", "os", ".", "pathsep", ")", ":", "for", "name", "in", "(", "\"gs\"...
Guess where the Ghostscript executable is and return its absolute path name.
[ "Guess", "where", "the", "Ghostscript", "executable", "is", "and", "return", "its", "absolute", "path", "name", "." ]
python
train
saltstack/salt
salt/cloud/clouds/joyent.py
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/joyent.py#L893-L914
def show_key(kwargs=None, call=None): ''' List the keys available ''' if call != 'function': log.error( 'The list_keys function must be called with -f or --function.' ) return False if not kwargs: kwargs = {} if 'keyname' not in kwargs: log.e...
[ "def", "show_key", "(", "kwargs", "=", "None", ",", "call", "=", "None", ")", ":", "if", "call", "!=", "'function'", ":", "log", ".", "error", "(", "'The list_keys function must be called with -f or --function.'", ")", "return", "False", "if", "not", "kwargs", ...
List the keys available
[ "List", "the", "keys", "available" ]
python
train
markuskiller/textblob-de
textblob_de/ext/_pattern/text/search.py
https://github.com/markuskiller/textblob-de/blob/1b427b2cdd7e5e9fd3697677a98358fae4aa6ad1/textblob_de/ext/_pattern/text/search.py#L308-L317
def append(self, term, type=None, value=None): """ Appends the given term to the taxonomy and tags it as the given type. Optionally, a disambiguation value can be supplied. For example: taxonomy.append("many", "quantity", "50-200") """ term = self._normalize(term) ...
[ "def", "append", "(", "self", ",", "term", ",", "type", "=", "None", ",", "value", "=", "None", ")", ":", "term", "=", "self", ".", "_normalize", "(", "term", ")", "type", "=", "self", ".", "_normalize", "(", "type", ")", "self", ".", "setdefault",...
Appends the given term to the taxonomy and tags it as the given type. Optionally, a disambiguation value can be supplied. For example: taxonomy.append("many", "quantity", "50-200")
[ "Appends", "the", "given", "term", "to", "the", "taxonomy", "and", "tags", "it", "as", "the", "given", "type", ".", "Optionally", "a", "disambiguation", "value", "can", "be", "supplied", ".", "For", "example", ":", "taxonomy", ".", "append", "(", "many", ...
python
train
materialsproject/pymatgen
pymatgen/io/vasp/inputs.py
https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/vasp/inputs.py#L1918-L1939
def run_vasp(self, run_dir: PathLike = ".", vasp_cmd: list = None, output_file: PathLike = "vasp.out", err_file: PathLike = "vasp.err"): """ Write input files and run VASP. :param run_dir: Where to write input files and do the run. :par...
[ "def", "run_vasp", "(", "self", ",", "run_dir", ":", "PathLike", "=", "\".\"", ",", "vasp_cmd", ":", "list", "=", "None", ",", "output_file", ":", "PathLike", "=", "\"vasp.out\"", ",", "err_file", ":", "PathLike", "=", "\"vasp.err\"", ")", ":", "self", "...
Write input files and run VASP. :param run_dir: Where to write input files and do the run. :param vasp_cmd: Args to be supplied to run VASP. Otherwise, the PMG_VASP_EXE in .pmgrc.yaml is used. :param output_file: File to write output. :param err_file: File to write err.
[ "Write", "input", "files", "and", "run", "VASP", "." ]
python
train
KelSolaar/Umbra
umbra/components/factory/script_editor/script_editor.py
https://github.com/KelSolaar/Umbra/blob/66f45f08d9d723787f1191989f8b0dda84b412ce/umbra/components/factory/script_editor/script_editor.py#L2848-L2859
def __set_window_title(self): """ Sets the Component window title. """ if self.has_editor_tab(): windowTitle = "{0} - {1}".format(self.__default_window_title, self.get_current_editor().file) else: windowTitle = "{0}".format(self.__default_window_title) ...
[ "def", "__set_window_title", "(", "self", ")", ":", "if", "self", ".", "has_editor_tab", "(", ")", ":", "windowTitle", "=", "\"{0} - {1}\"", ".", "format", "(", "self", ".", "__default_window_title", ",", "self", ".", "get_current_editor", "(", ")", ".", "fi...
Sets the Component window title.
[ "Sets", "the", "Component", "window", "title", "." ]
python
train
odlgroup/odl
odl/solvers/functional/default_functionals.py
https://github.com/odlgroup/odl/blob/b8443f6aca90e191ba36c91d32253c5a36249a6c/odl/solvers/functional/default_functionals.py#L2000-L2006
def _asvector(self, arr): """Convert ``arr`` to a `domain` element. This is the inverse of `_asarray`. """ result = moveaxis(arr, [-2, -1], [0, 1]) return self.domain.element(result)
[ "def", "_asvector", "(", "self", ",", "arr", ")", ":", "result", "=", "moveaxis", "(", "arr", ",", "[", "-", "2", ",", "-", "1", "]", ",", "[", "0", ",", "1", "]", ")", "return", "self", ".", "domain", ".", "element", "(", "result", ")" ]
Convert ``arr`` to a `domain` element. This is the inverse of `_asarray`.
[ "Convert", "arr", "to", "a", "domain", "element", "." ]
python
train
fy0/slim
slim/base/sqlquery.py
https://github.com/fy0/slim/blob/9951a910750888dbe7dd3e98acae9c40efae0689/slim/base/sqlquery.py#L235-L296
def parse_load_fk(cls, data: Dict[str, List[Dict[str, object]]]) -> Dict[str, List[Dict[str, object]]]: """ :param data:{ <column>: role, <column2>: role, <column>: { 'role': role, 'loadfk': { ... }, }, :return: { ...
[ "def", "parse_load_fk", "(", "cls", ",", "data", ":", "Dict", "[", "str", ",", "List", "[", "Dict", "[", "str", ",", "object", "]", "]", "]", ")", "->", "Dict", "[", "str", ",", "List", "[", "Dict", "[", "str", ",", "object", "]", "]", "]", "...
:param data:{ <column>: role, <column2>: role, <column>: { 'role': role, 'loadfk': { ... }, }, :return: { <column>: { 'role': role, }, ... <column3>: { ...
[ ":", "param", "data", ":", "{", "<column", ">", ":", "role", "<column2", ">", ":", "role", "<column", ">", ":", "{", "role", ":", "role", "loadfk", ":", "{", "...", "}", "}", ":", "return", ":", "{", "<column", ">", ":", "{", "role", ":", "role...
python
valid
bcbio/bcbio-nextgen
bcbio/distributed/split.py
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/distributed/split.py#L71-L87
def _get_extra_args(extra_args, arg_keys): """Retrieve extra arguments to pass along to combine function. Special cases like reference files and configuration information are passed as single items, the rest as lists mapping to each data item combined. """ # XXX back compatible hack -- should h...
[ "def", "_get_extra_args", "(", "extra_args", ",", "arg_keys", ")", ":", "# XXX back compatible hack -- should have a way to specify these.", "single_keys", "=", "set", "(", "[", "\"sam_ref\"", ",", "\"config\"", "]", ")", "out", "=", "[", "]", "for", "i", ",", "ar...
Retrieve extra arguments to pass along to combine function. Special cases like reference files and configuration information are passed as single items, the rest as lists mapping to each data item combined.
[ "Retrieve", "extra", "arguments", "to", "pass", "along", "to", "combine", "function", "." ]
python
train
fastai/fastai
docs_src/nbval/nbdime_reporter.py
https://github.com/fastai/fastai/blob/9fb84a5cdefe5a766cdb792b8f5d8971737b7e67/docs_src/nbval/nbdime_reporter.py#L76-L107
def make_report(self, outcome): """Make report in form of two notebooks. Use nbdime diff-web to present the difference between reference cells and test cells. """ failures = self.getreports('failed') if not failures: return for rep in failures: ...
[ "def", "make_report", "(", "self", ",", "outcome", ")", ":", "failures", "=", "self", ".", "getreports", "(", "'failed'", ")", "if", "not", "failures", ":", "return", "for", "rep", "in", "failures", ":", "# Check if this is a notebook node", "msg", "=", "sel...
Make report in form of two notebooks. Use nbdime diff-web to present the difference between reference cells and test cells.
[ "Make", "report", "in", "form", "of", "two", "notebooks", "." ]
python
train
minhhoit/yacms
yacms/pages/page_processors.py
https://github.com/minhhoit/yacms/blob/2921b706b7107c6e8c5f2bbf790ff11f85a2167f/yacms/pages/page_processors.py#L59-L78
def autodiscover(): """ Taken from ``django.contrib.admin.autodiscover`` and used to run any calls to the ``processor_for`` decorator. """ global LOADED if LOADED: return LOADED = True for app in get_app_name_list(): try: module = import_module(app) ex...
[ "def", "autodiscover", "(", ")", ":", "global", "LOADED", "if", "LOADED", ":", "return", "LOADED", "=", "True", "for", "app", "in", "get_app_name_list", "(", ")", ":", "try", ":", "module", "=", "import_module", "(", "app", ")", "except", "ImportError", ...
Taken from ``django.contrib.admin.autodiscover`` and used to run any calls to the ``processor_for`` decorator.
[ "Taken", "from", "django", ".", "contrib", ".", "admin", ".", "autodiscover", "and", "used", "to", "run", "any", "calls", "to", "the", "processor_for", "decorator", "." ]
python
train
yamcs/yamcs-python
yamcs-client/yamcs/archive/client.py
https://github.com/yamcs/yamcs-python/blob/1082fee8a299010cc44416bbb7518fac0ef08b48/yamcs-client/yamcs/archive/client.py#L37-L50
def list_packet_names(self): """ Returns the existing packet names. :rtype: ~collections.Iterable[str] """ # Server does not do pagination on listings of this resource. # Return an iterator anyway for similarity with other API methods path = '/archive/{}/packet-n...
[ "def", "list_packet_names", "(", "self", ")", ":", "# Server does not do pagination on listings of this resource.", "# Return an iterator anyway for similarity with other API methods", "path", "=", "'/archive/{}/packet-names'", ".", "format", "(", "self", ".", "_instance", ")", "...
Returns the existing packet names. :rtype: ~collections.Iterable[str]
[ "Returns", "the", "existing", "packet", "names", "." ]
python
train
spyder-ide/spyder
spyder/plugins/variableexplorer/widgets/texteditor.py
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/variableexplorer/widgets/texteditor.py#L98-L108
def text_changed(self): """Text has changed""" # Save text as bytes, if it was initially bytes if self.is_binary: self.text = to_binary_string(self.edit.toPlainText(), 'utf8') else: self.text = to_text_string(self.edit.toPlainText()) if self.btn_sav...
[ "def", "text_changed", "(", "self", ")", ":", "# Save text as bytes, if it was initially bytes\r", "if", "self", ".", "is_binary", ":", "self", ".", "text", "=", "to_binary_string", "(", "self", ".", "edit", ".", "toPlainText", "(", ")", ",", "'utf8'", ")", "e...
Text has changed
[ "Text", "has", "changed" ]
python
train
solvebio/solvebio-python
solvebio/utils/tabulate.py
https://github.com/solvebio/solvebio-python/blob/b29614643043afd19c1d8074e8f25c6700d51a73/solvebio/utils/tabulate.py#L401-L467
def _normalize_tabular_data(tabular_data, headers, sort=True): """ Transform a supported data type to a list of lists, and a list of headers. Supported tabular data types: * list-of-lists or another iterable of iterables * 2D NumPy arrays * dict of iterables (usually used with headers="keys"...
[ "def", "_normalize_tabular_data", "(", "tabular_data", ",", "headers", ",", "sort", "=", "True", ")", ":", "if", "hasattr", "(", "tabular_data", ",", "\"keys\"", ")", "and", "hasattr", "(", "tabular_data", ",", "\"values\"", ")", ":", "# dict-like and pandas.Dat...
Transform a supported data type to a list of lists, and a list of headers. Supported tabular data types: * list-of-lists or another iterable of iterables * 2D NumPy arrays * dict of iterables (usually used with headers="keys") * pandas.DataFrame (usually used with headers="keys") The first...
[ "Transform", "a", "supported", "data", "type", "to", "a", "list", "of", "lists", "and", "a", "list", "of", "headers", "." ]
python
test
wummel/linkchecker
linkcheck/HtmlParser/htmllib.py
https://github.com/wummel/linkchecker/blob/c2ce810c3fb00b895a841a7be6b2e78c64e7b042/linkcheck/HtmlParser/htmllib.py#L159-L168
def pi (self, data): """ Print HTML pi. @param data: the tag data @type data: string @return: None """ data = data.encode(self.encoding, "ignore") self.fd.write("<?%s?>" % data)
[ "def", "pi", "(", "self", ",", "data", ")", ":", "data", "=", "data", ".", "encode", "(", "self", ".", "encoding", ",", "\"ignore\"", ")", "self", ".", "fd", ".", "write", "(", "\"<?%s?>\"", "%", "data", ")" ]
Print HTML pi. @param data: the tag data @type data: string @return: None
[ "Print", "HTML", "pi", "." ]
python
train
tjcsl/cslbot
cslbot/commands/cancel.py
https://github.com/tjcsl/cslbot/blob/aebe07be47141f61d7c180706bddfb707f19b2b5/cslbot/commands/cancel.py#L22-L36
def cmd(send, msg, args): """Cancels a deferred action with the given id. Syntax: {command} <id> """ try: args['handler'].workers.cancel(int(msg)) except ValueError: send("Index must be a digit.") return except KeyError: send("No such event.") return ...
[ "def", "cmd", "(", "send", ",", "msg", ",", "args", ")", ":", "try", ":", "args", "[", "'handler'", "]", ".", "workers", ".", "cancel", "(", "int", "(", "msg", ")", ")", "except", "ValueError", ":", "send", "(", "\"Index must be a digit.\"", ")", "re...
Cancels a deferred action with the given id. Syntax: {command} <id>
[ "Cancels", "a", "deferred", "action", "with", "the", "given", "id", "." ]
python
train
apache/spark
python/pyspark/sql/group.py
https://github.com/apache/spark/blob/618d6bff71073c8c93501ab7392c3cc579730f0b/python/pyspark/sql/group.py#L224-L276
def apply(self, udf): """ Maps each group of the current :class:`DataFrame` using a pandas udf and returns the result as a `DataFrame`. The user-defined function should take a `pandas.DataFrame` and return another `pandas.DataFrame`. For each group, all columns are passed togeth...
[ "def", "apply", "(", "self", ",", "udf", ")", ":", "# Columns are special because hasattr always return True", "if", "isinstance", "(", "udf", ",", "Column", ")", "or", "not", "hasattr", "(", "udf", ",", "'func'", ")", "or", "udf", ".", "evalType", "!=", "Py...
Maps each group of the current :class:`DataFrame` using a pandas udf and returns the result as a `DataFrame`. The user-defined function should take a `pandas.DataFrame` and return another `pandas.DataFrame`. For each group, all columns are passed together as a `pandas.DataFrame` to the ...
[ "Maps", "each", "group", "of", "the", "current", ":", "class", ":", "DataFrame", "using", "a", "pandas", "udf", "and", "returns", "the", "result", "as", "a", "DataFrame", "." ]
python
train
CZ-NIC/yangson
yangson/schemanode.py
https://github.com/CZ-NIC/yangson/blob/a4b9464041fa8b28f6020a420ababf18fddf5d4a/yangson/schemanode.py#L826-L831
def from_raw(self, rval: RawScalar, jptr: JSONPointer = "") -> ScalarValue: """Override the superclass method.""" res = self.type.from_raw(rval) if res is None: raise RawTypeError(jptr, self.type.yang_type() + " value") return res
[ "def", "from_raw", "(", "self", ",", "rval", ":", "RawScalar", ",", "jptr", ":", "JSONPointer", "=", "\"\"", ")", "->", "ScalarValue", ":", "res", "=", "self", ".", "type", ".", "from_raw", "(", "rval", ")", "if", "res", "is", "None", ":", "raise", ...
Override the superclass method.
[ "Override", "the", "superclass", "method", "." ]
python
train
hhatto/autopep8
autopep8.py
https://github.com/hhatto/autopep8/blob/fda3bb39181437b6b8a0aa0185f21ae5f14385dd/autopep8.py#L1079-L1115
def fix_e712(self, result): """Fix (trivial case of) comparison with boolean.""" (line_index, offset, target) = get_index_offset_contents(result, self.source) # Handle very easy "not" special cases. if re.match(r'^\s*if [\...
[ "def", "fix_e712", "(", "self", ",", "result", ")", ":", "(", "line_index", ",", "offset", ",", "target", ")", "=", "get_index_offset_contents", "(", "result", ",", "self", ".", "source", ")", "# Handle very easy \"not\" special cases.", "if", "re", ".", "matc...
Fix (trivial case of) comparison with boolean.
[ "Fix", "(", "trivial", "case", "of", ")", "comparison", "with", "boolean", "." ]
python
train
juju/charm-helpers
charmhelpers/core/services/helpers.py
https://github.com/juju/charm-helpers/blob/aa785c40c3b7a8c69dbfbc7921d6b9f30142e171/charmhelpers/core/services/helpers.py#L70-L77
def is_ready(self): """ Returns True if all of the `required_keys` are available from any units. """ ready = len(self.get(self.name, [])) > 0 if not ready: hookenv.log('Incomplete relation: {}'.format(self.__class__.__name__), hookenv.DEBUG) return ready
[ "def", "is_ready", "(", "self", ")", ":", "ready", "=", "len", "(", "self", ".", "get", "(", "self", ".", "name", ",", "[", "]", ")", ")", ">", "0", "if", "not", "ready", ":", "hookenv", ".", "log", "(", "'Incomplete relation: {}'", ".", "format", ...
Returns True if all of the `required_keys` are available from any units.
[ "Returns", "True", "if", "all", "of", "the", "required_keys", "are", "available", "from", "any", "units", "." ]
python
train
PyPSA/PyPSA
pypsa/components.py
https://github.com/PyPSA/PyPSA/blob/46954b1b3c21460550f7104681517065279a53b7/pypsa/components.py#L305-L327
def _build_dataframes(self): """Function called when network is created to build component pandas.DataFrames.""" for component in self.all_components: attrs = self.components[component]["attrs"] static_dtypes = attrs.loc[attrs.static, "dtype"].drop(["name"]) df = ...
[ "def", "_build_dataframes", "(", "self", ")", ":", "for", "component", "in", "self", ".", "all_components", ":", "attrs", "=", "self", ".", "components", "[", "component", "]", "[", "\"attrs\"", "]", "static_dtypes", "=", "attrs", ".", "loc", "[", "attrs",...
Function called when network is created to build component pandas.DataFrames.
[ "Function", "called", "when", "network", "is", "created", "to", "build", "component", "pandas", ".", "DataFrames", "." ]
python
train
molmod/molmod
molmod/randomize.py
https://github.com/molmod/molmod/blob/a7b5b4364ed514ad4c465856c05b5eda1cb561e0/molmod/randomize.py#L205-L213
def iter_halfs_bond(graph): """Select a random bond (pair of atoms) that divides the molecule in two""" for atom1, atom2 in graph.edges: try: affected_atoms1, affected_atoms2 = graph.get_halfs(atom1, atom2) yield affected_atoms1, affected_atoms2, (atom1, atom2) except Gra...
[ "def", "iter_halfs_bond", "(", "graph", ")", ":", "for", "atom1", ",", "atom2", "in", "graph", ".", "edges", ":", "try", ":", "affected_atoms1", ",", "affected_atoms2", "=", "graph", ".", "get_halfs", "(", "atom1", ",", "atom2", ")", "yield", "affected_ato...
Select a random bond (pair of atoms) that divides the molecule in two
[ "Select", "a", "random", "bond", "(", "pair", "of", "atoms", ")", "that", "divides", "the", "molecule", "in", "two" ]
python
train
susam/ice
ice.py
https://github.com/susam/ice/blob/532e685c504ea96f9e42833594585159ac1d2068/ice.py#L381-L396
def add(self, method, pattern, callback): """Add a route. Arguments: method (str): HTTP method, e.g. GET, POST, etc. pattern (str): Pattern that request paths must match. callback (str): Route handler that is invoked when a request path matches the *pattern*. ...
[ "def", "add", "(", "self", ",", "method", ",", "pattern", ",", "callback", ")", ":", "pat_type", ",", "pat", "=", "self", ".", "_normalize_pattern", "(", "pattern", ")", "if", "pat_type", "==", "'literal'", ":", "self", ".", "_literal", "[", "method", ...
Add a route. Arguments: method (str): HTTP method, e.g. GET, POST, etc. pattern (str): Pattern that request paths must match. callback (str): Route handler that is invoked when a request path matches the *pattern*.
[ "Add", "a", "route", "." ]
python
test
LogicalDash/LiSE
allegedb/allegedb/query.py
https://github.com/LogicalDash/LiSE/blob/fe6fd4f0a7c1780e065f4c9babb9bc443af6bb84/allegedb/allegedb/query.py#L364-L375
def nodes_dump(self): """Dump the entire contents of the nodes table.""" self._flush_nodes() for (graph, node, branch, turn,tick, extant) in self.sql('nodes_dump'): yield ( self.unpack(graph), self.unpack(node), branch, ...
[ "def", "nodes_dump", "(", "self", ")", ":", "self", ".", "_flush_nodes", "(", ")", "for", "(", "graph", ",", "node", ",", "branch", ",", "turn", ",", "tick", ",", "extant", ")", "in", "self", ".", "sql", "(", "'nodes_dump'", ")", ":", "yield", "(",...
Dump the entire contents of the nodes table.
[ "Dump", "the", "entire", "contents", "of", "the", "nodes", "table", "." ]
python
train
rstoneback/pysat
pysat/instruments/pysat_sgp4.py
https://github.com/rstoneback/pysat/blob/4ae1afd80e15e4449397d39dce8c3e969c32c422/pysat/instruments/pysat_sgp4.py#L464-L516
def add_aacgm_coordinates(inst, glat_label='glat', glong_label='glong', alt_label='alt'): """ Uses AACGMV2 package to add AACGM coordinates to instrument object. The Altitude Adjusted Corrected Geomagnetic Coordinates library is used to calculate the latitud...
[ "def", "add_aacgm_coordinates", "(", "inst", ",", "glat_label", "=", "'glat'", ",", "glong_label", "=", "'glong'", ",", "alt_label", "=", "'alt'", ")", ":", "import", "aacgmv2", "aalat", "=", "[", "]", "aalon", "=", "[", "]", "mlt", "=", "[", "]", "for...
Uses AACGMV2 package to add AACGM coordinates to instrument object. The Altitude Adjusted Corrected Geomagnetic Coordinates library is used to calculate the latitude, longitude, and local time of the spacecraft with respect to the geomagnetic field. Example ------- # function added...
[ "Uses", "AACGMV2", "package", "to", "add", "AACGM", "coordinates", "to", "instrument", "object", ".", "The", "Altitude", "Adjusted", "Corrected", "Geomagnetic", "Coordinates", "library", "is", "used", "to", "calculate", "the", "latitude", "longitude", "and", "loca...
python
train
rbw/pysnow
pysnow/request.py
https://github.com/rbw/pysnow/blob/87c8ce0d3a089c2f59247f30efbd545fcdb8e985/pysnow/request.py#L51-L63
def get(self, *args, **kwargs): """Fetches one or more records :return: - :class:`pysnow.Response` object """ self._parameters.query = kwargs.pop('query', {}) if len(args) == 0 else args[0] self._parameters.limit = kwargs.pop('limit', 10000) self._parameters...
[ "def", "get", "(", "self", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "self", ".", "_parameters", ".", "query", "=", "kwargs", ".", "pop", "(", "'query'", ",", "{", "}", ")", "if", "len", "(", "args", ")", "==", "0", "else", "args", ...
Fetches one or more records :return: - :class:`pysnow.Response` object
[ "Fetches", "one", "or", "more", "records" ]
python
train
PyGithub/PyGithub
github/Organization.py
https://github.com/PyGithub/PyGithub/blob/f716df86bbe7dc276c6596699fa9712b61ef974c/github/Organization.py#L501-L540
def edit(self, billing_email=github.GithubObject.NotSet, blog=github.GithubObject.NotSet, company=github.GithubObject.NotSet, description=github.GithubObject.NotSet, email=github.GithubObject.NotSet, location=github.GithubObject.NotSet, name=github.GithubObject.NotSet): """ :calls: `PATCH /orgs/:org <ht...
[ "def", "edit", "(", "self", ",", "billing_email", "=", "github", ".", "GithubObject", ".", "NotSet", ",", "blog", "=", "github", ".", "GithubObject", ".", "NotSet", ",", "company", "=", "github", ".", "GithubObject", ".", "NotSet", ",", "description", "=",...
:calls: `PATCH /orgs/:org <http://developer.github.com/v3/orgs>`_ :param billing_email: string :param blog: string :param company: string :param description: string :param email: string :param location: string :param name: string :rtype: None
[ ":", "calls", ":", "PATCH", "/", "orgs", "/", ":", "org", "<http", ":", "//", "developer", ".", "github", ".", "com", "/", "v3", "/", "orgs", ">", "_", ":", "param", "billing_email", ":", "string", ":", "param", "blog", ":", "string", ":", "param",...
python
train
Erotemic/utool
utool/util_cache.py
https://github.com/Erotemic/utool/blob/3b27e1f4e6e6fb23cd8744af7b7195b57d99e03a/utool/util_cache.py#L1172-L1208
def get_lru_cache(max_size=5): """ Args: max_size (int): References: https://github.com/amitdev/lru-dict CommandLine: python -m utool.util_cache --test-get_lru_cache Example: >>> # DISABLE_DOCTEST >>> # UNSTABLE_DOCTEST >>> from utool.util_cache imp...
[ "def", "get_lru_cache", "(", "max_size", "=", "5", ")", ":", "USE_C_LRU", "=", "False", "if", "USE_C_LRU", ":", "import", "lru", "cache_obj", "=", "lru", ".", "LRU", "(", "max_size", ")", "else", ":", "cache_obj", "=", "LRUDict", "(", "max_size", ")", ...
Args: max_size (int): References: https://github.com/amitdev/lru-dict CommandLine: python -m utool.util_cache --test-get_lru_cache Example: >>> # DISABLE_DOCTEST >>> # UNSTABLE_DOCTEST >>> from utool.util_cache import * # NOQA >>> import utool as u...
[ "Args", ":", "max_size", "(", "int", ")", ":" ]
python
train
mitsei/dlkit
dlkit/json_/commenting/sessions.py
https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/json_/commenting/sessions.py#L2094-L2133
def update_book(self, book_form): """Updates an existing book. arg: book_form (osid.commenting.BookForm): the form containing the elements to be updated raise: IllegalState - ``book_form`` already used in an update transaction raise: InvalidArgument ...
[ "def", "update_book", "(", "self", ",", "book_form", ")", ":", "# Implemented from template for", "# osid.resource.BinAdminSession.update_bin_template", "if", "self", ".", "_catalog_session", "is", "not", "None", ":", "return", "self", ".", "_catalog_session", ".", "upd...
Updates an existing book. arg: book_form (osid.commenting.BookForm): the form containing the elements to be updated raise: IllegalState - ``book_form`` already used in an update transaction raise: InvalidArgument - the form contains an invalid value ...
[ "Updates", "an", "existing", "book", "." ]
python
train
ambitioninc/python-logentries-api
logentries_api/resources.py
https://github.com/ambitioninc/python-logentries-api/blob/77ff1a7a2995d7ea2725b74e34c0f880f4ee23bc/logentries_api/resources.py#L151-L192
def update(self, label): """ Update a Label :param label: The data to update. Must include keys: * id (str) * appearance (dict) * description (str) * name (str) * title (str) :type label: dict Example: .. cod...
[ "def", "update", "(", "self", ",", "label", ")", ":", "data", "=", "{", "'id'", ":", "label", "[", "'id'", "]", ",", "'name'", ":", "label", "[", "'name'", "]", ",", "'appearance'", ":", "label", "[", "'appearance'", "]", ",", "'description'", ":", ...
Update a Label :param label: The data to update. Must include keys: * id (str) * appearance (dict) * description (str) * name (str) * title (str) :type label: dict Example: .. code-block:: python Labels().update...
[ "Update", "a", "Label" ]
python
test
dade-ai/snipy
snipy/basic.py
https://github.com/dade-ai/snipy/blob/408520867179f99b3158b57520e2619f3fecd69b/snipy/basic.py#L286-L300
def interrupt_guard(msg='', reraise=True): """ context for guard keyboardinterrupt ex) with interrupt_guard('need long time'): critical_work_to_prevent() :param str msg: message to print when interrupted :param reraise: re-raise or not when exit :return: context """ def echo...
[ "def", "interrupt_guard", "(", "msg", "=", "''", ",", "reraise", "=", "True", ")", ":", "def", "echo", "(", ")", ":", "print", "(", "msg", ")", "return", "on_interrupt", "(", "echo", ",", "reraise", "=", "reraise", ")" ]
context for guard keyboardinterrupt ex) with interrupt_guard('need long time'): critical_work_to_prevent() :param str msg: message to print when interrupted :param reraise: re-raise or not when exit :return: context
[ "context", "for", "guard", "keyboardinterrupt", "ex", ")", "with", "interrupt_guard", "(", "need", "long", "time", ")", ":", "critical_work_to_prevent", "()" ]
python
valid
Parsl/parsl
parsl/executors/low_latency/lowlatency_worker.py
https://github.com/Parsl/parsl/blob/d7afb3bc37f50dcf224ae78637944172edb35dac/parsl/executors/low_latency/lowlatency_worker.py#L49-L77
def start_file_logger(filename, rank, name='parsl', level=logging.DEBUG, format_string=None): """Add a stream log handler. Args: - filename (string): Name of the file to write logs to - name (string): Logger name - level (logging.LEVEL): Set the logging level. - format_string (s...
[ "def", "start_file_logger", "(", "filename", ",", "rank", ",", "name", "=", "'parsl'", ",", "level", "=", "logging", ".", "DEBUG", ",", "format_string", "=", "None", ")", ":", "try", ":", "os", ".", "makedirs", "(", "os", ".", "path", ".", "dirname", ...
Add a stream log handler. Args: - filename (string): Name of the file to write logs to - name (string): Logger name - level (logging.LEVEL): Set the logging level. - format_string (string): Set the format string Returns: - None
[ "Add", "a", "stream", "log", "handler", "." ]
python
valid
all-umass/graphs
graphs/mixins/analysis.py
https://github.com/all-umass/graphs/blob/4fbeb025dfe33340335f34300f58dd3809228822/graphs/mixins/analysis.py#L61-L88
def directed_laplacian(self, D=None, eta=0.99, tol=1e-12, max_iter=500): '''Computes the directed combinatorial graph laplacian. http://www-all.cs.umass.edu/pubs/2007/johns_m_ICML07.pdf D: (optional) N-array of degrees eta: probability of not teleporting (see the paper) tol, max_iter: convergence p...
[ "def", "directed_laplacian", "(", "self", ",", "D", "=", "None", ",", "eta", "=", "0.99", ",", "tol", "=", "1e-12", ",", "max_iter", "=", "500", ")", ":", "W", "=", "self", ".", "matrix", "(", "'dense'", ")", "n", "=", "W", ".", "shape", "[", "...
Computes the directed combinatorial graph laplacian. http://www-all.cs.umass.edu/pubs/2007/johns_m_ICML07.pdf D: (optional) N-array of degrees eta: probability of not teleporting (see the paper) tol, max_iter: convergence params for Perron vector calculation
[ "Computes", "the", "directed", "combinatorial", "graph", "laplacian", ".", "http", ":", "//", "www", "-", "all", ".", "cs", ".", "umass", ".", "edu", "/", "pubs", "/", "2007", "/", "johns_m_ICML07", ".", "pdf" ]
python
train
MacHu-GWU/angora-project
angora/baseclass/classtree.py
https://github.com/MacHu-GWU/angora-project/blob/689a60da51cd88680ddbe26e28dbe81e6b01d275/angora/baseclass/classtree.py#L221-L248
def repr_class_data(self, class_data): """Create code like this:: class Person(classtree.Base): def __init__(self, name=None, person_id=None): self.name = name self.person_id = person_id class Pers...
[ "def", "repr_class_data", "(", "self", ",", "class_data", ")", ":", "if", "\"subclass\"", "in", "class_data", ":", "for", "subclass_data", "in", "class_data", "[", "\"subclass\"", "]", ":", "self", ".", "repr_class_data", "(", "subclass_data", ")", "self", "."...
Create code like this:: class Person(classtree.Base): def __init__(self, name=None, person_id=None): self.name = name self.person_id = person_id class PersonCollection(classtree.Base): def ...
[ "Create", "code", "like", "this", "::", "class", "Person", "(", "classtree", ".", "Base", ")", ":", "def", "__init__", "(", "self", "name", "=", "None", "person_id", "=", "None", ")", ":", "self", ".", "name", "=", "name", "self", ".", "person_id", "...
python
train
saltstack/salt
salt/modules/dockercompose.py
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/dockercompose.py#L200-L223
def __read_docker_compose_file(file_path): ''' Read the compose file if it exists in the directory :param file_path: :return: ''' if not os.path.isfile(file_path): return __standardize_result(False, 'Path {} is not present'.format(file_path), ...
[ "def", "__read_docker_compose_file", "(", "file_path", ")", ":", "if", "not", "os", ".", "path", ".", "isfile", "(", "file_path", ")", ":", "return", "__standardize_result", "(", "False", ",", "'Path {} is not present'", ".", "format", "(", "file_path", ")", "...
Read the compose file if it exists in the directory :param file_path: :return:
[ "Read", "the", "compose", "file", "if", "it", "exists", "in", "the", "directory" ]
python
train
lsbardel/python-stdnet
stdnet/backends/__init__.py
https://github.com/lsbardel/python-stdnet/blob/78db5320bdedc3f28c5e4f38cda13a4469e35db7/stdnet/backends/__init__.py#L470-L488
def parse_backend(backend): """Converts the "backend" into the database connection parameters. It returns a (scheme, host, params) tuple.""" r = urlparse.urlsplit(backend) scheme, host = r.scheme, r.netloc path, query = r.path, r.query if path and not query: query, path = path, '' ...
[ "def", "parse_backend", "(", "backend", ")", ":", "r", "=", "urlparse", ".", "urlsplit", "(", "backend", ")", "scheme", ",", "host", "=", "r", ".", "scheme", ",", "r", ".", "netloc", "path", ",", "query", "=", "r", ".", "path", ",", "r", ".", "qu...
Converts the "backend" into the database connection parameters. It returns a (scheme, host, params) tuple.
[ "Converts", "the", "backend", "into", "the", "database", "connection", "parameters", ".", "It", "returns", "a", "(", "scheme", "host", "params", ")", "tuple", "." ]
python
train
Azure/azure-cosmos-python
azure/cosmos/cosmos_client.py
https://github.com/Azure/azure-cosmos-python/blob/dd01b3c5d308c6da83cfcaa0ab7083351a476353/azure/cosmos/cosmos_client.py#L1303-L1327
def CreateUserDefinedFunction(self, collection_link, udf, options=None): """Creates a user defined function in a collection. :param str collection_link: The link to the collection. :param str udf: :param dict options: The request options for the request. ...
[ "def", "CreateUserDefinedFunction", "(", "self", ",", "collection_link", ",", "udf", ",", "options", "=", "None", ")", ":", "if", "options", "is", "None", ":", "options", "=", "{", "}", "collection_id", ",", "path", ",", "udf", "=", "self", ".", "_GetCon...
Creates a user defined function in a collection. :param str collection_link: The link to the collection. :param str udf: :param dict options: The request options for the request. :return: The created UDF. :rtype: dict
[ "Creates", "a", "user", "defined", "function", "in", "a", "collection", "." ]
python
train
libtcod/python-tcod
tcod/libtcodpy.py
https://github.com/libtcod/python-tcod/blob/8ba10c5cfb813eaf3e834de971ba2d6acb7838e4/tcod/libtcodpy.py#L2590-L2634
def heightmap_add_fbm( hm: np.ndarray, noise: tcod.noise.Noise, mulx: float, muly: float, addx: float, addy: float, octaves: float, delta: float, scale: float, ) -> None: """Add FBM noise to the heightmap. The noise coordinate for each map cell is `((x + addx) * mulx / w...
[ "def", "heightmap_add_fbm", "(", "hm", ":", "np", ".", "ndarray", ",", "noise", ":", "tcod", ".", "noise", ".", "Noise", ",", "mulx", ":", "float", ",", "muly", ":", "float", ",", "addx", ":", "float", ",", "addy", ":", "float", ",", "octaves", ":"...
Add FBM noise to the heightmap. The noise coordinate for each map cell is `((x + addx) * mulx / width, (y + addy) * muly / height)`. The value added to the heightmap is `delta + noise * scale`. Args: hm (numpy.ndarray): A numpy.ndarray formatted for heightmap functions. noise (Noise):...
[ "Add", "FBM", "noise", "to", "the", "heightmap", "." ]
python
train
blue-yonder/tsfresh
tsfresh/feature_extraction/settings.py
https://github.com/blue-yonder/tsfresh/blob/c72c9c574371cf7dd7d54e00a466792792e5d202/tsfresh/feature_extraction/settings.py#L24-L82
def from_columns(columns, columns_to_ignore=None): """ Creates a mapping from kind names to fc_parameters objects (which are itself mappings from feature calculators to settings) to extract only the features contained in the columns. To do so, for every feature name in columns this method 1. sp...
[ "def", "from_columns", "(", "columns", ",", "columns_to_ignore", "=", "None", ")", ":", "kind_to_fc_parameters", "=", "{", "}", "if", "columns_to_ignore", "is", "None", ":", "columns_to_ignore", "=", "[", "]", "for", "col", "in", "columns", ":", "if", "col",...
Creates a mapping from kind names to fc_parameters objects (which are itself mappings from feature calculators to settings) to extract only the features contained in the columns. To do so, for every feature name in columns this method 1. split the column name into col, feature, params part 2. decid...
[ "Creates", "a", "mapping", "from", "kind", "names", "to", "fc_parameters", "objects", "(", "which", "are", "itself", "mappings", "from", "feature", "calculators", "to", "settings", ")", "to", "extract", "only", "the", "features", "contained", "in", "the", "col...
python
train
square/pylink
setup.py
https://github.com/square/pylink/blob/81dda0a191d923a8b2627c52cb778aba24d279d7/setup.py#L70-L89
def run(self): """Runs the command. Args: self (CleanCommand): the ``CleanCommand`` instance Returns: ``None`` """ for build_dir in self.build_dirs: if os.path.isdir(build_dir): sys.stdout.write('Removing %s%s' % (build_dir, os.li...
[ "def", "run", "(", "self", ")", ":", "for", "build_dir", "in", "self", ".", "build_dirs", ":", "if", "os", ".", "path", ".", "isdir", "(", "build_dir", ")", ":", "sys", ".", "stdout", ".", "write", "(", "'Removing %s%s'", "%", "(", "build_dir", ",", ...
Runs the command. Args: self (CleanCommand): the ``CleanCommand`` instance Returns: ``None``
[ "Runs", "the", "command", "." ]
python
train
KennethWilke/PingdomLib
pingdomlib/pingdom.py
https://github.com/KennethWilke/PingdomLib/blob/3ed1e481f9c9d16b032558d62fb05c2166e162ed/pingdomlib/pingdom.py#L191-L219
def getChecks(self, **parameters): """Pulls all checks from pingdom Optional Parameters: * limit -- Limits the number of returned probes to the specified quantity. Type: Integer (max 25000) Default: 25000 * offset -- Offs...
[ "def", "getChecks", "(", "self", ",", "*", "*", "parameters", ")", ":", "# Warn user about unhandled parameters", "for", "key", "in", "parameters", ":", "if", "key", "not", "in", "[", "'limit'", ",", "'offset'", ",", "'tags'", "]", ":", "sys", ".", "stderr...
Pulls all checks from pingdom Optional Parameters: * limit -- Limits the number of returned probes to the specified quantity. Type: Integer (max 25000) Default: 25000 * offset -- Offset for listing (requires limit.) ...
[ "Pulls", "all", "checks", "from", "pingdom" ]
python
train
iotile/coretools
iotilesensorgraph/iotile/sg/sensor_log.py
https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilesensorgraph/iotile/sg/sensor_log.py#L244-L255
def destroy_walker(self, walker): """Destroy a previously created stream walker. Args: walker (StreamWalker): The walker to remove from internal updating lists. """ if walker.buffered: self._queue_walkers.remove(walker) else: ...
[ "def", "destroy_walker", "(", "self", ",", "walker", ")", ":", "if", "walker", ".", "buffered", ":", "self", ".", "_queue_walkers", ".", "remove", "(", "walker", ")", "else", ":", "self", ".", "_virtual_walkers", ".", "remove", "(", "walker", ")" ]
Destroy a previously created stream walker. Args: walker (StreamWalker): The walker to remove from internal updating lists.
[ "Destroy", "a", "previously", "created", "stream", "walker", "." ]
python
train
shoebot/shoebot
lib/database/__init__.py
https://github.com/shoebot/shoebot/blob/d554c1765c1899fa25727c9fc6805d221585562b/lib/database/__init__.py#L120-L137
def create_index(self, table, field, unique=False, ascending=True): """Creates a table index. Creates an index on the given table, on the given field with unique values enforced or not, in ascending or descending order. """ if unique: u...
[ "def", "create_index", "(", "self", ",", "table", ",", "field", ",", "unique", "=", "False", ",", "ascending", "=", "True", ")", ":", "if", "unique", ":", "u", "=", "\"unique \"", "else", ":", "u", "=", "\"\"", "if", "ascending", ":", "a", "=", "\"...
Creates a table index. Creates an index on the given table, on the given field with unique values enforced or not, in ascending or descending order.
[ "Creates", "a", "table", "index", ".", "Creates", "an", "index", "on", "the", "given", "table", "on", "the", "given", "field", "with", "unique", "values", "enforced", "or", "not", "in", "ascending", "or", "descending", "order", "." ]
python
valid
jaraco/jaraco.postgres
jaraco/postgres/__init__.py
https://github.com/jaraco/jaraco.postgres/blob/57375043314a3ce821ac3b0372ba2465135daa95/jaraco/postgres/__init__.py#L506-L555
def start(self): """Launch this postgres server. If it's already running, do nothing. If the backing storage directory isn't configured, raise NotInitializedError. This method is optional. If you're running in an environment where the DBMS is provided as part of the basic inf...
[ "def", "start", "(", "self", ")", ":", "log", ".", "info", "(", "'Starting PostgreSQL at %s:%s'", ",", "self", ".", "host", ",", "self", ".", "port", ")", "if", "not", "self", ".", "base_pathname", ":", "tmpl", "=", "(", "'Invalid base_pathname: %r. Did you...
Launch this postgres server. If it's already running, do nothing. If the backing storage directory isn't configured, raise NotInitializedError. This method is optional. If you're running in an environment where the DBMS is provided as part of the basic infrastructure, you pro...
[ "Launch", "this", "postgres", "server", ".", "If", "it", "s", "already", "running", "do", "nothing", "." ]
python
train
mdickinson/bigfloat
bigfloat/core.py
https://github.com/mdickinson/bigfloat/blob/e5fdd1048615191ed32a2b7460e14b3b3ff24662/bigfloat/core.py#L2000-L2010
def lngamma(x, context=None): """ Return the value of the logarithm of the Gamma function of x. """ return _apply_function_in_current_context( BigFloat, mpfr.mpfr_lngamma, (BigFloat._implicit_convert(x),), context, )
[ "def", "lngamma", "(", "x", ",", "context", "=", "None", ")", ":", "return", "_apply_function_in_current_context", "(", "BigFloat", ",", "mpfr", ".", "mpfr_lngamma", ",", "(", "BigFloat", ".", "_implicit_convert", "(", "x", ")", ",", ")", ",", "context", "...
Return the value of the logarithm of the Gamma function of x.
[ "Return", "the", "value", "of", "the", "logarithm", "of", "the", "Gamma", "function", "of", "x", "." ]
python
train
apple/turicreate
src/unity/python/turicreate/meta/bytecodetools/bytecode_consumer.py
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/meta/bytecodetools/bytecode_consumer.py#L25-L39
def consume(self): ''' Consume byte-code ''' generic_consume = getattr(self, 'generic_consume', None) for instr in disassembler(self.code): method_name = 'consume_%s' % (instr.opname) method = getattr(self, method_name, generic_consume) ...
[ "def", "consume", "(", "self", ")", ":", "generic_consume", "=", "getattr", "(", "self", ",", "'generic_consume'", ",", "None", ")", "for", "instr", "in", "disassembler", "(", "self", ".", "code", ")", ":", "method_name", "=", "'consume_%s'", "%", "(", "...
Consume byte-code
[ "Consume", "byte", "-", "code" ]
python
train
chinapnr/fishbase
fishbase/fish_file.py
https://github.com/chinapnr/fishbase/blob/23c5147a6bc0d8ed36409e55352ffb2c5b0edc82/fishbase/fish_file.py#L94-L140
def check_sub_path_create(sub_path): """ 检查当前路径下的某个子路径是否存在, 不存在则创建; :param: * sub_path: (string) 下一级的某路径名称 :return: * 返回类型 (tuple),有两个值 * True: 路径存在,False: 不需要创建 * False: 路径不存在,True: 创建成功 举例如下:: print('--- check_sub_path_create demo ---') #...
[ "def", "check_sub_path_create", "(", "sub_path", ")", ":", "# 获得当前路径", "temp_path", "=", "pathlib", ".", "Path", "(", ")", "cur_path", "=", "temp_path", ".", "resolve", "(", ")", "# 生成 带有 sub_path_name 的路径", "path", "=", "cur_path", "/", "pathlib", ".", "Path"...
检查当前路径下的某个子路径是否存在, 不存在则创建; :param: * sub_path: (string) 下一级的某路径名称 :return: * 返回类型 (tuple),有两个值 * True: 路径存在,False: 不需要创建 * False: 路径不存在,True: 创建成功 举例如下:: print('--- check_sub_path_create demo ---') # 定义子路径名称 sub_path = 'demo_sub_dir' ...
[ "检查当前路径下的某个子路径是否存在", "不存在则创建;" ]
python
train
angr/angr
angr/state_plugins/heap/heap_freelist.py
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/state_plugins/heap/heap_freelist.py#L73-L78
def fwd_chunk(self): """ Returns the chunk following this chunk in the list of free chunks. """ raise NotImplementedError("%s not implemented for %s" % (self.fwd_chunk.__func__.__name__, self.__class__.__name__))
[ "def", "fwd_chunk", "(", "self", ")", ":", "raise", "NotImplementedError", "(", "\"%s not implemented for %s\"", "%", "(", "self", ".", "fwd_chunk", ".", "__func__", ".", "__name__", ",", "self", ".", "__class__", ".", "__name__", ")", ")" ]
Returns the chunk following this chunk in the list of free chunks.
[ "Returns", "the", "chunk", "following", "this", "chunk", "in", "the", "list", "of", "free", "chunks", "." ]
python
train
gwastro/pycbc-glue
pycbc_glue/pipeline.py
https://github.com/gwastro/pycbc-glue/blob/a3e906bae59fbfd707c3ff82e5d008d939ec5e24/pycbc_glue/pipeline.py#L3214-L3250
def make_optimised_chunks(self, min_length, max_length, pad_data=0): """ Splits ScienceSegments up into chunks, of a given maximum length. The length of the last two chunks are chosen so that the data utilisation is optimised. @param min_length: minimum chunk length. @param max_length: maximum c...
[ "def", "make_optimised_chunks", "(", "self", ",", "min_length", ",", "max_length", ",", "pad_data", "=", "0", ")", ":", "for", "seg", "in", "self", ".", "__sci_segs", ":", "# pad data if requested", "seg_start", "=", "seg", ".", "start", "(", ")", "+", "pa...
Splits ScienceSegments up into chunks, of a given maximum length. The length of the last two chunks are chosen so that the data utilisation is optimised. @param min_length: minimum chunk length. @param max_length: maximum chunk length. @param pad_data: exclude the first and last pad_data seconds of ...
[ "Splits", "ScienceSegments", "up", "into", "chunks", "of", "a", "given", "maximum", "length", ".", "The", "length", "of", "the", "last", "two", "chunks", "are", "chosen", "so", "that", "the", "data", "utilisation", "is", "optimised", "." ]
python
train
schlamar/latexmk.py
latexmake.py
https://github.com/schlamar/latexmk.py/blob/88baba40ff3e844e4542de60d2032503e206d996/latexmake.py#L336-L361
def open_preview(self): ''' Try to open a preview of the generated document. Currently only supported on Windows. ''' self.log.info('Opening preview...') if self.opt.pdf: ext = 'pdf' else: ext = 'dvi' filename = '%s.%s' % (self.proj...
[ "def", "open_preview", "(", "self", ")", ":", "self", ".", "log", ".", "info", "(", "'Opening preview...'", ")", "if", "self", ".", "opt", ".", "pdf", ":", "ext", "=", "'pdf'", "else", ":", "ext", "=", "'dvi'", "filename", "=", "'%s.%s'", "%", "(", ...
Try to open a preview of the generated document. Currently only supported on Windows.
[ "Try", "to", "open", "a", "preview", "of", "the", "generated", "document", ".", "Currently", "only", "supported", "on", "Windows", "." ]
python
train
senaite/senaite.core
bika/lims/api/__init__.py
https://github.com/senaite/senaite.core/blob/7602ce2ea2f9e81eb34e20ce17b98a3e70713f85/bika/lims/api/__init__.py#L865-L880
def get_transitions_for(brain_or_object): """List available workflow transitions for all workflows :param brain_or_object: A single catalog brain or content object :type brain_or_object: ATContentType/DexterityContentType/CatalogBrain :returns: All possible available and allowed transitions :rtype:...
[ "def", "get_transitions_for", "(", "brain_or_object", ")", ":", "workflow", "=", "get_tool", "(", "'portal_workflow'", ")", "transitions", "=", "[", "]", "instance", "=", "get_object", "(", "brain_or_object", ")", "for", "wfid", "in", "get_workflows_for", "(", "...
List available workflow transitions for all workflows :param brain_or_object: A single catalog brain or content object :type brain_or_object: ATContentType/DexterityContentType/CatalogBrain :returns: All possible available and allowed transitions :rtype: list[dict]
[ "List", "available", "workflow", "transitions", "for", "all", "workflows" ]
python
train
JdeRobot/base
src/drivers/MAVLinkServer/MAVProxy/pymavlink/dialects/v20/ardupilotmega.py
https://github.com/JdeRobot/base/blob/303b18992785b2fe802212f2d758a60873007f1f/src/drivers/MAVLinkServer/MAVProxy/pymavlink/dialects/v20/ardupilotmega.py#L10072-L10089
def simstate_encode(self, roll, pitch, yaw, xacc, yacc, zacc, xgyro, ygyro, zgyro, lat, lng): ''' Status of simulation environment, if used roll : Roll angle (rad) (float) pitch : Pitch angle (rad) (float) ...
[ "def", "simstate_encode", "(", "self", ",", "roll", ",", "pitch", ",", "yaw", ",", "xacc", ",", "yacc", ",", "zacc", ",", "xgyro", ",", "ygyro", ",", "zgyro", ",", "lat", ",", "lng", ")", ":", "return", "MAVLink_simstate_message", "(", "roll", ",", "...
Status of simulation environment, if used roll : Roll angle (rad) (float) pitch : Pitch angle (rad) (float) yaw : Yaw angle (rad) (float) xacc : X acceleration m/s/s (floa...
[ "Status", "of", "simulation", "environment", "if", "used" ]
python
train
BerkeleyAutomation/autolab_core
autolab_core/random_variables.py
https://github.com/BerkeleyAutomation/autolab_core/blob/8f3813f6401972868cc5e3981ba1b4382d4418d5/autolab_core/random_variables.py#L221-L249
def sample(self, size=1): """ Sample rigid transform random variables. Parameters ---------- size : int number of sample to take Returns ------- :obj:`list` of :obj:`RigidTransform` sampled rigid transformations """ ...
[ "def", "sample", "(", "self", ",", "size", "=", "1", ")", ":", "samples", "=", "[", "]", "for", "i", "in", "range", "(", "size", ")", ":", "# sample random pose", "xi", "=", "self", ".", "_r_xi_rv", ".", "rvs", "(", "size", "=", "1", ")", "S_xi",...
Sample rigid transform random variables. Parameters ---------- size : int number of sample to take Returns ------- :obj:`list` of :obj:`RigidTransform` sampled rigid transformations
[ "Sample", "rigid", "transform", "random", "variables", "." ]
python
train
gwastro/pycbc
pycbc/workflow/pegasus_workflow.py
https://github.com/gwastro/pycbc/blob/7a64cdd104d263f1b6ea0b01e6841837d05a4cb3/pycbc/workflow/pegasus_workflow.py#L313-L361
def add_node(self, node): """ Add a node to this workflow This function adds nodes to the workflow. It also determines parent/child relations from the DataStorage inputs to this job. Parameters ---------- node : pycbc.workflow.pegasus_workflow.Node A node th...
[ "def", "add_node", "(", "self", ",", "node", ")", ":", "node", ".", "_finalize", "(", ")", "node", ".", "in_workflow", "=", "self", "self", ".", "_adag", ".", "addJob", "(", "node", ".", "_dax_node", ")", "# Determine the parent child relationships based on th...
Add a node to this workflow This function adds nodes to the workflow. It also determines parent/child relations from the DataStorage inputs to this job. Parameters ---------- node : pycbc.workflow.pegasus_workflow.Node A node that should be executed as part of this ...
[ "Add", "a", "node", "to", "this", "workflow" ]
python
train
Erotemic/utool
utool/util_path.py
https://github.com/Erotemic/utool/blob/3b27e1f4e6e6fb23cd8744af7b7195b57d99e03a/utool/util_path.py#L1378-L1404
def get_modname_from_modpath(module_fpath): """ returns importable name from file path get_modname_from_modpath Args: module_fpath (str): module filepath Returns: str: modname Example: >>> # ENABLE_DOCTEST >>> from utool.util_path import * # NOQA >>> ...
[ "def", "get_modname_from_modpath", "(", "module_fpath", ")", ":", "modsubdir_list", "=", "get_module_subdir_list", "(", "module_fpath", ")", "modname", "=", "'.'", ".", "join", "(", "modsubdir_list", ")", "modname", "=", "modname", ".", "replace", "(", "'.__init__...
returns importable name from file path get_modname_from_modpath Args: module_fpath (str): module filepath Returns: str: modname Example: >>> # ENABLE_DOCTEST >>> from utool.util_path import * # NOQA >>> import utool as ut >>> module_fpath = ut.util_pa...
[ "returns", "importable", "name", "from", "file", "path" ]
python
train
mcs07/MolVS
molvs/standardize.py
https://github.com/mcs07/MolVS/blob/d815fe52d160abcecbcbf117e6437bf727dbd8ad/molvs/standardize.py#L306-L317
def enumerate_tautomers_smiles(smiles): """Return a set of tautomers as SMILES strings, given a SMILES string. :param smiles: A SMILES string. :returns: A set containing SMILES strings for every possible tautomer. :rtype: set of strings. """ # Skip sanitize as standardize does this anyway m...
[ "def", "enumerate_tautomers_smiles", "(", "smiles", ")", ":", "# Skip sanitize as standardize does this anyway", "mol", "=", "Chem", ".", "MolFromSmiles", "(", "smiles", ",", "sanitize", "=", "False", ")", "mol", "=", "Standardizer", "(", ")", ".", "standardize", ...
Return a set of tautomers as SMILES strings, given a SMILES string. :param smiles: A SMILES string. :returns: A set containing SMILES strings for every possible tautomer. :rtype: set of strings.
[ "Return", "a", "set", "of", "tautomers", "as", "SMILES", "strings", "given", "a", "SMILES", "string", "." ]
python
test
Clinical-Genomics/scout
scout/parse/case.py
https://github.com/Clinical-Genomics/scout/blob/90a551e2e1653a319e654c2405c2866f93d0ebb9/scout/parse/case.py#L350-L377
def parse_ped(ped_stream, family_type='ped'): """Parse out minimal family information from a PED file. Args: ped_stream(iterable(str)) family_type(str): Format of the pedigree information Returns: family_id(str), samples(list[dict]) """ pedigree = FamilyParser(ped_stream, f...
[ "def", "parse_ped", "(", "ped_stream", ",", "family_type", "=", "'ped'", ")", ":", "pedigree", "=", "FamilyParser", "(", "ped_stream", ",", "family_type", "=", "family_type", ")", "if", "len", "(", "pedigree", ".", "families", ")", "!=", "1", ":", "raise",...
Parse out minimal family information from a PED file. Args: ped_stream(iterable(str)) family_type(str): Format of the pedigree information Returns: family_id(str), samples(list[dict])
[ "Parse", "out", "minimal", "family", "information", "from", "a", "PED", "file", "." ]
python
test