repo
stringlengths
7
55
path
stringlengths
4
223
url
stringlengths
87
315
code
stringlengths
75
104k
code_tokens
list
docstring
stringlengths
1
46.9k
docstring_tokens
list
language
stringclasses
1 value
partition
stringclasses
3 values
avg_line_len
float64
7.91
980
chrisjrn/registrasion
registrasion/reporting/views.py
https://github.com/chrisjrn/registrasion/blob/461d5846c6f9f3b7099322a94f5d9911564448e4/registrasion/reporting/views.py#L414-L432
def credit_notes(request, form): ''' Shows all of the credit notes in the system. ''' notes = commerce.CreditNote.objects.all().select_related( "creditnoterefund", "creditnoteapplication", "invoice", "invoice__user__attendee__attendeeprofilebase", ) return QuerysetRepor...
[ "def", "credit_notes", "(", "request", ",", "form", ")", ":", "notes", "=", "commerce", ".", "CreditNote", ".", "objects", ".", "all", "(", ")", ".", "select_related", "(", "\"creditnoterefund\"", ",", "\"creditnoteapplication\"", ",", "\"invoice\"", ",", "\"i...
Shows all of the credit notes in the system.
[ "Shows", "all", "of", "the", "credit", "notes", "in", "the", "system", "." ]
python
test
29.421053
willkg/socorro-siggen
siggen/cmd_doc.py
https://github.com/willkg/socorro-siggen/blob/db7e3233e665a458a961c48da22e93a69b1d08d6/siggen/cmd_doc.py#L68-L107
def main(argv=None): """Generates documentation for signature generation pipeline""" parser = argparse.ArgumentParser(description=DESCRIPTION) parser.add_argument( 'pipeline', help='Python dotted path to rules pipeline to document' ) parser.add_argument('output', help='output file') ...
[ "def", "main", "(", "argv", "=", "None", ")", ":", "parser", "=", "argparse", ".", "ArgumentParser", "(", "description", "=", "DESCRIPTION", ")", "parser", ".", "add_argument", "(", "'pipeline'", ",", "help", "=", "'Python dotted path to rules pipeline to document...
Generates documentation for signature generation pipeline
[ "Generates", "documentation", "for", "signature", "generation", "pipeline" ]
python
train
31.325
gem/oq-engine
openquake/commonlib/rlzs_assoc.py
https://github.com/gem/oq-engine/blob/8294553a0b8aba33fd96437a35065d03547d0040/openquake/commonlib/rlzs_assoc.py#L190-L197
def get_rlz(self, rlzstr): r""" Get a Realization instance for a string of the form 'rlz-\d+' """ mo = re.match(r'rlz-(\d+)', rlzstr) if not mo: return return self.realizations[int(mo.group(1))]
[ "def", "get_rlz", "(", "self", ",", "rlzstr", ")", ":", "mo", "=", "re", ".", "match", "(", "r'rlz-(\\d+)'", ",", "rlzstr", ")", "if", "not", "mo", ":", "return", "return", "self", ".", "realizations", "[", "int", "(", "mo", ".", "group", "(", "1",...
r""" Get a Realization instance for a string of the form 'rlz-\d+'
[ "r", "Get", "a", "Realization", "instance", "for", "a", "string", "of", "the", "form", "rlz", "-", "\\", "d", "+" ]
python
train
30.875
myint/language-check
setup.py
https://github.com/myint/language-check/blob/58e419833ef28a9193fcaa21193616a8a14504a9/setup.py#L136-L184
def which(program, win_allow_cross_arch=True): """Identify the location of an executable file.""" def is_exe(path): return os.path.isfile(path) and os.access(path, os.X_OK) def _get_path_list(): return os.environ['PATH'].split(os.pathsep) if os.name == 'nt': def find_exe(progra...
[ "def", "which", "(", "program", ",", "win_allow_cross_arch", "=", "True", ")", ":", "def", "is_exe", "(", "path", ")", ":", "return", "os", ".", "path", ".", "isfile", "(", "path", ")", "and", "os", ".", "access", "(", "path", ",", "os", ".", "X_OK...
Identify the location of an executable file.
[ "Identify", "the", "location", "of", "an", "executable", "file", "." ]
python
valid
33.306122
nion-software/nionswift
nion/typeshed/API_1_0.py
https://github.com/nion-software/nionswift/blob/d43693eaf057b8683b9638e575000f055fede452/nion/typeshed/API_1_0.py#L1110-L1119
def create_data_and_metadata_from_data(self, data: numpy.ndarray, intensity_calibration: Calibration.Calibration=None, dimensional_calibrations: typing.List[Calibration.Calibration]=None, metadata: dict=None, timestamp: str=None) -> DataAndMetadata.DataAndMetadata: """Create a data_and_metadata object from data...
[ "def", "create_data_and_metadata_from_data", "(", "self", ",", "data", ":", "numpy", ".", "ndarray", ",", "intensity_calibration", ":", "Calibration", ".", "Calibration", "=", "None", ",", "dimensional_calibrations", ":", "typing", ".", "List", "[", "Calibration", ...
Create a data_and_metadata object from data. .. versionadded:: 1.0 .. deprecated:: 1.1 Use :py:meth:`~nion.swift.Facade.DataItem.create_data_and_metadata` instead. Scriptable: No
[ "Create", "a", "data_and_metadata", "object", "from", "data", "." ]
python
train
50.7
jaraco/keyrings.alt
keyrings/alt/file_base.py
https://github.com/jaraco/keyrings.alt/blob/5b71223d12bf9ac6abd05b1b395f1efccb5ea660/keyrings/alt/file_base.py#L167-L181
def _ensure_file_path(self): """ Ensure the storage path exists. If it doesn't, create it with "go-rwx" permissions. """ storage_root = os.path.dirname(self.file_path) needs_storage_root = storage_root and not os.path.isdir(storage_root) if needs_storage_root: # ...
[ "def", "_ensure_file_path", "(", "self", ")", ":", "storage_root", "=", "os", ".", "path", ".", "dirname", "(", "self", ".", "file_path", ")", "needs_storage_root", "=", "storage_root", "and", "not", "os", ".", "path", ".", "isdir", "(", "storage_root", ")...
Ensure the storage path exists. If it doesn't, create it with "go-rwx" permissions.
[ "Ensure", "the", "storage", "path", "exists", ".", "If", "it", "doesn", "t", "create", "it", "with", "go", "-", "rwx", "permissions", "." ]
python
train
41.6
bunchesofdonald/django-hermes
hermes/models.py
https://github.com/bunchesofdonald/django-hermes/blob/ff5395a7b5debfd0756aab43db61f7a6cfa06aea/hermes/models.py#L72-L84
def parents(self): """ Returns a list of all the current category's parents.""" parents = [] if self.parent is None: return [] category = self while category.parent is not None: parents.append(category.parent) category = category.parent ...
[ "def", "parents", "(", "self", ")", ":", "parents", "=", "[", "]", "if", "self", ".", "parent", "is", "None", ":", "return", "[", "]", "category", "=", "self", "while", "category", ".", "parent", "is", "not", "None", ":", "parents", ".", "append", ...
Returns a list of all the current category's parents.
[ "Returns", "a", "list", "of", "all", "the", "current", "category", "s", "parents", "." ]
python
train
25.538462
mpapi/lazylights
lazylights.py
https://github.com/mpapi/lazylights/blob/536dbd3ce75c28b3545cf66f25fc72589488063f/lazylights.py#L491-L500
def set_power_state(self, is_on, bulb=ALL_BULBS, timeout=None): """ Sets the power state of one or more bulbs. """ with _blocking(self.lock, self.power_state, self.light_state_event, timeout): self.send(REQ_SET_POWER_STATE, bulb, '...
[ "def", "set_power_state", "(", "self", ",", "is_on", ",", "bulb", "=", "ALL_BULBS", ",", "timeout", "=", "None", ")", ":", "with", "_blocking", "(", "self", ".", "lock", ",", "self", ".", "power_state", ",", "self", ".", "light_state_event", ",", "timeou...
Sets the power state of one or more bulbs.
[ "Sets", "the", "power", "state", "of", "one", "or", "more", "bulbs", "." ]
python
train
44.2
xi/ldif3
ldif3.py
https://github.com/xi/ldif3/blob/debc4222bb48492de0d3edcc3c71fdae5bc612a4/ldif3.py#L100-L114
def _fold_line(self, line): """Write string line as one or more folded lines.""" if len(line) <= self._cols: self._output_file.write(line) self._output_file.write(self._line_sep) else: pos = self._cols self._output_file.write(line[0:self._cols]) ...
[ "def", "_fold_line", "(", "self", ",", "line", ")", ":", "if", "len", "(", "line", ")", "<=", "self", ".", "_cols", ":", "self", ".", "_output_file", ".", "write", "(", "line", ")", "self", ".", "_output_file", ".", "write", "(", "self", ".", "_lin...
Write string line as one or more folded lines.
[ "Write", "string", "line", "as", "one", "or", "more", "folded", "lines", "." ]
python
train
42.133333
QUANTAXIS/QUANTAXIS
QUANTAXIS/QAARP/QARisk.py
https://github.com/QUANTAXIS/QUANTAXIS/blob/bb1fe424e4108b62a1f712b81a05cf829297a5c0/QUANTAXIS/QAARP/QARisk.py#L286-L305
def profit_construct(self): """利润构成 Returns: dict -- 利润构成表 """ return { 'total_buyandsell': round( self.profit_money - self.total_commission - self.total_tax, 2 ), 'total_tax': self....
[ "def", "profit_construct", "(", "self", ")", ":", "return", "{", "'total_buyandsell'", ":", "round", "(", "self", ".", "profit_money", "-", "self", ".", "total_commission", "-", "self", ".", "total_tax", ",", "2", ")", ",", "'total_tax'", ":", "self", ".",...
利润构成 Returns: dict -- 利润构成表
[ "利润构成" ]
python
train
22.3
tnkteja/myhelp
virtualEnvironment/lib/python2.7/site-packages/coverage/collector.py
https://github.com/tnkteja/myhelp/blob/fb3a4809d448ad14d5b2e6ddf2e7e89ad52b71cb/virtualEnvironment/lib/python2.7/site-packages/coverage/collector.py#L316-L320
def resume(self): """Resume tracing after a `pause`.""" for tracer in self.tracers: tracer.start() threading.settrace(self._installation_trace)
[ "def", "resume", "(", "self", ")", ":", "for", "tracer", "in", "self", ".", "tracers", ":", "tracer", ".", "start", "(", ")", "threading", ".", "settrace", "(", "self", ".", "_installation_trace", ")" ]
Resume tracing after a `pause`.
[ "Resume", "tracing", "after", "a", "pause", "." ]
python
test
35
bitesofcode/projexui
projexui/xapplication.py
https://github.com/bitesofcode/projexui/blob/f18a73bec84df90b034ca69b9deea118dbedfc4d/projexui/xapplication.py#L448-L473
def systemSettings(self): """ Returns the settings associated with this application for all users. :return <projexui.xsettings.XSettings> """ if not self._systemSettings: if self.isCompiled(): settings = QtCore.QSettings(XSettings....
[ "def", "systemSettings", "(", "self", ")", ":", "if", "not", "self", ".", "_systemSettings", ":", "if", "self", ".", "isCompiled", "(", ")", ":", "settings", "=", "QtCore", ".", "QSettings", "(", "XSettings", ".", "IniFormat", ",", "XSettings", ".", "Sys...
Returns the settings associated with this application for all users. :return <projexui.xsettings.XSettings>
[ "Returns", "the", "settings", "associated", "with", "this", "application", "for", "all", "users", ".", ":", "return", "<projexui", ".", "xsettings", ".", "XSettings", ">" ]
python
train
44.076923
shoebot/shoebot
lib/colors/__init__.py
https://github.com/shoebot/shoebot/blob/d554c1765c1899fa25727c9fc6805d221585562b/lib/colors/__init__.py#L2603-L2635
def _weight_by_hue(self): """ Returns a list of (hue, ranges, total weight, normalized total weight)-tuples. ColorTheme is made up out of (color, range, weight) tuples. For consistency with XML-output in the old Prism format (i.e. <color>s made up of <shade>s) we need a group ...
[ "def", "_weight_by_hue", "(", "self", ")", ":", "grouped", "=", "{", "}", "weights", "=", "[", "]", "for", "clr", ",", "rng", ",", "weight", "in", "self", ".", "ranges", ":", "h", "=", "clr", ".", "nearest_hue", "(", "primary", "=", "False", ")", ...
Returns a list of (hue, ranges, total weight, normalized total weight)-tuples. ColorTheme is made up out of (color, range, weight) tuples. For consistency with XML-output in the old Prism format (i.e. <color>s made up of <shade>s) we need a group weight per different hue. The s...
[ "Returns", "a", "list", "of", "(", "hue", "ranges", "total", "weight", "normalized", "total", "weight", ")", "-", "tuples", "." ]
python
valid
39.606061
swharden/SWHLab
swhlab/indexing/imaging.py
https://github.com/swharden/SWHLab/blob/a86c3c65323cec809a4bd4f81919644927094bf5/swhlab/indexing/imaging.py#L17-L105
def TIF_to_jpg(fnameTiff, overwrite=False, saveAs=""): """ given a TIF taken by our cameras, make it a pretty labeled JPG. if the filename contains "f10" or "f20", add appropraite scale bars. automatic contrast adjustment is different depending on if its a DIC image or fluorescent image (which is ...
[ "def", "TIF_to_jpg", "(", "fnameTiff", ",", "overwrite", "=", "False", ",", "saveAs", "=", "\"\"", ")", ":", "if", "saveAs", "==", "\"\"", ":", "saveAs", "=", "fnameTiff", "+", "\".jpg\"", "if", "overwrite", "is", "False", "and", "os", ".", "path", "."...
given a TIF taken by our cameras, make it a pretty labeled JPG. if the filename contains "f10" or "f20", add appropraite scale bars. automatic contrast adjustment is different depending on if its a DIC image or fluorescent image (which is detected automatically).
[ "given", "a", "TIF", "taken", "by", "our", "cameras", "make", "it", "a", "pretty", "labeled", "JPG", "." ]
python
valid
33.258427
etingof/pyasn1
pyasn1/type/namedtype.py
https://github.com/etingof/pyasn1/blob/25cf116ef8d11bb0e08454c0f3635c9f4002c2d6/pyasn1/type/namedtype.py#L329-L351
def getNameByPosition(self, idx): """Return field name by its position in fields set. Parameters ---------- idx: :py:class:`idx` Field index Returns ------- : :py:class:`str` Field name Raises ------ : :class:`~py...
[ "def", "getNameByPosition", "(", "self", ",", "idx", ")", ":", "try", ":", "return", "self", ".", "__namedTypes", "[", "idx", "]", ".", "name", "except", "IndexError", ":", "raise", "error", ".", "PyAsn1Error", "(", "'Type position out of range'", ")" ]
Return field name by its position in fields set. Parameters ---------- idx: :py:class:`idx` Field index Returns ------- : :py:class:`str` Field name Raises ------ : :class:`~pyasn1.error.PyAsn1Error` If given ...
[ "Return", "field", "name", "by", "its", "position", "in", "fields", "set", "." ]
python
train
24.217391
twisted/mantissa
xmantissa/interstore.py
https://github.com/twisted/mantissa/blob/53e5502aba23ce99be78b27f923a276593033fe8/xmantissa/interstore.py#L662-L671
def _messageFromSender(self, sender, messageID): """ Locate a previously queued message by a given sender and messageID. """ return self.store.findUnique( _QueuedMessage, AND(_QueuedMessage.senderUsername == sender.localpart, _QueuedMessage.senderD...
[ "def", "_messageFromSender", "(", "self", ",", "sender", ",", "messageID", ")", ":", "return", "self", ".", "store", ".", "findUnique", "(", "_QueuedMessage", ",", "AND", "(", "_QueuedMessage", ".", "senderUsername", "==", "sender", ".", "localpart", ",", "_...
Locate a previously queued message by a given sender and messageID.
[ "Locate", "a", "previously", "queued", "message", "by", "a", "given", "sender", "and", "messageID", "." ]
python
train
41.6
camsci/meteor-pi
src/observatoryControl/gpsd/client.py
https://github.com/camsci/meteor-pi/blob/7b01527650bd1b2b76d6f364e8122e25b8812c8d/src/observatoryControl/gpsd/client.py#L27-L56
def connect(self, host, port): """Connect to a host on a given port. If the hostname ends with a colon (`:') followed by a number, and there is no port specified, that suffix will be stripped off and the number interpreted as the port number to use. """ if not port and (h...
[ "def", "connect", "(", "self", ",", "host", ",", "port", ")", ":", "if", "not", "port", "and", "(", "host", ".", "find", "(", "':'", ")", "==", "host", ".", "rfind", "(", "':'", ")", ")", ":", "i", "=", "host", ".", "rfind", "(", "':'", ")", ...
Connect to a host on a given port. If the hostname ends with a colon (`:') followed by a number, and there is no port specified, that suffix will be stripped off and the number interpreted as the port number to use.
[ "Connect", "to", "a", "host", "on", "a", "given", "port", ".", "If", "the", "hostname", "ends", "with", "a", "colon", "(", ":", ")", "followed", "by", "a", "number", "and", "there", "is", "no", "port", "specified", "that", "suffix", "will", "be", "st...
python
train
42.133333
crytic/slither
slither/detectors/erc20/unindexed_event_parameters.py
https://github.com/crytic/slither/blob/04c147f7e50223c6af458ca430befae747ccd259/slither/detectors/erc20/unindexed_event_parameters.py#L67-L85
def _detect(self): """ Detect un-indexed ERC20 event parameters in all contracts. """ results = [] for c in self.contracts: unindexed_params = self.detect_erc20_unindexed_event_params(c) if unindexed_params: info = "{} ({}) does not mark im...
[ "def", "_detect", "(", "self", ")", ":", "results", "=", "[", "]", "for", "c", "in", "self", ".", "contracts", ":", "unindexed_params", "=", "self", ".", "detect_erc20_unindexed_event_params", "(", "c", ")", "if", "unindexed_params", ":", "info", "=", "\"{...
Detect un-indexed ERC20 event parameters in all contracts.
[ "Detect", "un", "-", "indexed", "ERC20", "event", "parameters", "in", "all", "contracts", "." ]
python
train
48.684211
bennylope/pygeocodio
geocodio/client.py
https://github.com/bennylope/pygeocodio/blob/4c33d3d34f6b63d4b8fe85fe571ae02b9f67d6c3/geocodio/client.py#L227-L239
def reverse_point(self, latitude, longitude, **kwargs): """ Method for identifying an address from a geographic point """ fields = ",".join(kwargs.pop("fields", [])) point_param = "{0},{1}".format(latitude, longitude) response = self._req( verb="reverse", para...
[ "def", "reverse_point", "(", "self", ",", "latitude", ",", "longitude", ",", "*", "*", "kwargs", ")", ":", "fields", "=", "\",\"", ".", "join", "(", "kwargs", ".", "pop", "(", "\"fields\"", ",", "[", "]", ")", ")", "point_param", "=", "\"{0},{1}\"", ...
Method for identifying an address from a geographic point
[ "Method", "for", "identifying", "an", "address", "from", "a", "geographic", "point" ]
python
train
37.153846
Yelp/kafka-utils
kafka_utils/kafka_cluster_manager/cluster_info/genetic_balancer.py
https://github.com/Yelp/kafka-utils/blob/cdb4d64308f3079ee0873250bf7b34d0d94eca50/kafka_utils/kafka_cluster_manager/cluster_info/genetic_balancer.py#L791-L889
def move(self, partition, source, dest): """Return a new state that is the result of moving a single partition. :param partition: The partition index of the partition to move. :param source: The broker index of the broker to move the partition from. :param dest: The broker i...
[ "def", "move", "(", "self", ",", "partition", ",", "source", ",", "dest", ")", ":", "new_state", "=", "copy", "(", "self", ")", "# Update the partition replica tuple", "source_index", "=", "self", ".", "replicas", "[", "partition", "]", ".", "index", "(", ...
Return a new state that is the result of moving a single partition. :param partition: The partition index of the partition to move. :param source: The broker index of the broker to move the partition from. :param dest: The broker index of the broker to move the partition to.
[ "Return", "a", "new", "state", "that", "is", "the", "result", "of", "moving", "a", "single", "partition", "." ]
python
train
36.939394
mardix/Mocha
mocha/contrib/auth/__init__.py
https://github.com/mardix/Mocha/blob/bce481cb31a0972061dd99bc548701411dcb9de3/mocha/contrib/auth/__init__.py#L434-L447
def change_status(self, status): """ Change the user's status :param user: :param email: :return: """ def cb(): self.user.update(status=status) return status return signals.user_update(self, ACTIONS["STATUS"], cb, ...
[ "def", "change_status", "(", "self", ",", "status", ")", ":", "def", "cb", "(", ")", ":", "self", ".", "user", ".", "update", "(", "status", "=", "status", ")", "return", "status", "return", "signals", ".", "user_update", "(", "self", ",", "ACTIONS", ...
Change the user's status :param user: :param email: :return:
[ "Change", "the", "user", "s", "status", ":", "param", "user", ":", ":", "param", "email", ":", ":", "return", ":" ]
python
train
25.357143
TrafficSenseMSD/SumoTools
traci/_vehicletype.py
https://github.com/TrafficSenseMSD/SumoTools/blob/8607b4f885f1d1798e43240be643efe6dccccdaa/traci/_vehicletype.py#L280-L286
def setMaxSpeedLat(self, typeID, speed): """setMaxSpeedLat(string, double) -> None Sets the maximum lateral speed of this type. """ self._connection._sendDoubleCmd( tc.CMD_SET_VEHICLETYPE_VARIABLE, tc.VAR_MAXSPEED_LAT, typeID, speed)
[ "def", "setMaxSpeedLat", "(", "self", ",", "typeID", ",", "speed", ")", ":", "self", ".", "_connection", ".", "_sendDoubleCmd", "(", "tc", ".", "CMD_SET_VEHICLETYPE_VARIABLE", ",", "tc", ".", "VAR_MAXSPEED_LAT", ",", "typeID", ",", "speed", ")" ]
setMaxSpeedLat(string, double) -> None Sets the maximum lateral speed of this type.
[ "setMaxSpeedLat", "(", "string", "double", ")", "-", ">", "None" ]
python
train
38.857143
angr/angr
angr/simos/javavm.py
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/simos/javavm.py#L300-L339
def cast_primitive(state, value, to_type): """ Cast the value of primtive types. :param value: Bitvector storing the primitive value. :param to_type: Name of the targeted type. :return: Resized value. """ if to_type in ['float', 'double']: ...
[ "def", "cast_primitive", "(", "state", ",", "value", ",", "to_type", ")", ":", "if", "to_type", "in", "[", "'float'", ",", "'double'", "]", ":", "if", "value", ".", "symbolic", ":", "# TODO extend support for floating point types", "l", ".", "warning", "(", ...
Cast the value of primtive types. :param value: Bitvector storing the primitive value. :param to_type: Name of the targeted type. :return: Resized value.
[ "Cast", "the", "value", "of", "primtive", "types", "." ]
python
train
45.375
kbr/fritzconnection
fritzconnection/fritzconnection.py
https://github.com/kbr/fritzconnection/blob/b183f759ef19dd1652371e912d36cfe34f6639ac/fritzconnection/fritzconnection.py#L207-L217
def get_services(self): """Returns a list of FritzService-objects.""" result = [] nodes = self.root.iterfind( './/ns:service', namespaces={'ns': self.namespace}) for node in nodes: result.append(FritzService( node.find(self.nodename('serviceType'))...
[ "def", "get_services", "(", "self", ")", ":", "result", "=", "[", "]", "nodes", "=", "self", ".", "root", ".", "iterfind", "(", "'.//ns:service'", ",", "namespaces", "=", "{", "'ns'", ":", "self", ".", "namespace", "}", ")", "for", "node", "in", "nod...
Returns a list of FritzService-objects.
[ "Returns", "a", "list", "of", "FritzService", "-", "objects", "." ]
python
train
41.636364
IDSIA/sacred
sacred/observers/file_storage.py
https://github.com/IDSIA/sacred/blob/72633776bed9b5bddf93ae7d215188e61970973a/sacred/observers/file_storage.py#L217-L244
def log_metrics(self, metrics_by_name, info): """Store new measurements into metrics.json. """ try: metrics_path = os.path.join(self.dir, "metrics.json") with open(metrics_path, 'r') as f: saved_metrics = json.load(f) except IOError: # ...
[ "def", "log_metrics", "(", "self", ",", "metrics_by_name", ",", "info", ")", ":", "try", ":", "metrics_path", "=", "os", ".", "path", ".", "join", "(", "self", ".", "dir", ",", "\"metrics.json\"", ")", "with", "open", "(", "metrics_path", ",", "'r'", "...
Store new measurements into metrics.json.
[ "Store", "new", "measurements", "into", "metrics", ".", "json", "." ]
python
train
42.535714
iotile/coretools
iotilecore/iotile/core/hw/update/record.py
https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilecore/iotile/core/hw/update/record.py#L131-L142
def RegisterRecordType(cls, record_class): """Register a known record type in KNOWN_CLASSES. Args: record_class (UpdateRecord): An update record subclass. """ record_type = record_class.MatchType() if record_type not in UpdateRecord.KNOWN_CLASSES: Update...
[ "def", "RegisterRecordType", "(", "cls", ",", "record_class", ")", ":", "record_type", "=", "record_class", ".", "MatchType", "(", ")", "if", "record_type", "not", "in", "UpdateRecord", ".", "KNOWN_CLASSES", ":", "UpdateRecord", ".", "KNOWN_CLASSES", "[", "recor...
Register a known record type in KNOWN_CLASSES. Args: record_class (UpdateRecord): An update record subclass.
[ "Register", "a", "known", "record", "type", "in", "KNOWN_CLASSES", "." ]
python
train
34.75
jorbas/GADDAG
gaddag/node.py
https://github.com/jorbas/GADDAG/blob/a0ede3def715c586e1f273d96e9fc0d537cd9561/gaddag/node.py#L64-L72
def edges(self): """ Return the edge characters of this node. """ edge_str = ctypes.create_string_buffer(MAX_CHARS) cgaddag.gdg_edges(self.gdg, self.node, edge_str) return [char for char in edge_str.value.decode("ascii")]
[ "def", "edges", "(", "self", ")", ":", "edge_str", "=", "ctypes", ".", "create_string_buffer", "(", "MAX_CHARS", ")", "cgaddag", ".", "gdg_edges", "(", "self", ".", "gdg", ",", "self", ".", "node", ",", "edge_str", ")", "return", "[", "char", "for", "c...
Return the edge characters of this node.
[ "Return", "the", "edge", "characters", "of", "this", "node", "." ]
python
train
29.222222
rasbt/biopandas
docs/make_api.py
https://github.com/rasbt/biopandas/blob/615a7cf272692c12bbcfd9d1f217eab440120235/docs/make_api.py#L24-L65
def docstring_to_markdown(docstring): """Convert a Python object's docstring to markdown Parameters ---------- docstring : str The docstring body. Returns ---------- clean_lst : list The markdown formatted docstring as lines (str) in a Python list. """ new_docstrin...
[ "def", "docstring_to_markdown", "(", "docstring", ")", ":", "new_docstring_lst", "=", "[", "]", "for", "idx", ",", "line", "in", "enumerate", "(", "docstring", ".", "split", "(", "'\\n'", ")", ")", ":", "line", "=", "line", ".", "strip", "(", ")", "if"...
Convert a Python object's docstring to markdown Parameters ---------- docstring : str The docstring body. Returns ---------- clean_lst : list The markdown formatted docstring as lines (str) in a Python list.
[ "Convert", "a", "Python", "object", "s", "docstring", "to", "markdown" ]
python
train
33.714286
gambogi/CSHLDAP
CSHLDAP.py
https://github.com/gambogi/CSHLDAP/blob/09cb754b1e72437834e0d8cb4c7ac1830cfa6829/CSHLDAP.py#L112-L145
def search( self, base=False, trim=False, objects=False, **kwargs ): """ Returns matching entries for search in ldap structured as [(dn, {attributes})] UNLESS searching by dn, in which case the first match is returned """ scope = pyldap.SCOPE_SUBTREE i...
[ "def", "search", "(", "self", ",", "base", "=", "False", ",", "trim", "=", "False", ",", "objects", "=", "False", ",", "*", "*", "kwargs", ")", ":", "scope", "=", "pyldap", ".", "SCOPE_SUBTREE", "if", "not", "base", ":", "base", "=", "self", ".", ...
Returns matching entries for search in ldap structured as [(dn, {attributes})] UNLESS searching by dn, in which case the first match is returned
[ "Returns", "matching", "entries", "for", "search", "in", "ldap", "structured", "as", "[", "(", "dn", "{", "attributes", "}", ")", "]", "UNLESS", "searching", "by", "dn", "in", "which", "case", "the", "first", "match", "is", "returned" ]
python
train
37.911765
pkkid/python-plexapi
plexapi/library.py
https://github.com/pkkid/python-plexapi/blob/9efbde96441c2bfbf410eacfb46e811e108e8bbc/plexapi/library.py#L929-L936
def _loadData(self, data): """ Load attribute values from Plex XML response. """ self._data = data self.fastKey = data.attrib.get('fastKey') self.key = data.attrib.get('key') self.thumb = data.attrib.get('thumb') self.title = data.attrib.get('title') self.type = d...
[ "def", "_loadData", "(", "self", ",", "data", ")", ":", "self", ".", "_data", "=", "data", "self", ".", "fastKey", "=", "data", ".", "attrib", ".", "get", "(", "'fastKey'", ")", "self", ".", "key", "=", "data", ".", "attrib", ".", "get", "(", "'k...
Load attribute values from Plex XML response.
[ "Load", "attribute", "values", "from", "Plex", "XML", "response", "." ]
python
train
41.875
cltk/cltk
cltk/phonology/orthophonology.py
https://github.com/cltk/cltk/blob/ed9c025b7ec43c949481173251b70e05e4dffd27/cltk/phonology/orthophonology.py#L690-L731
def transcribe_word(self, word): ''' The heart of the transcription process. Similar to the system in in cltk.phonology.utils, the algorithm: 1) Applies digraphs and diphthongs to the text of the word. 2) Carries out a naive ("greedy", per @clemsciences) substitution of letters to phonemes, according ...
[ "def", "transcribe_word", "(", "self", ",", "word", ")", ":", "phonemes", "=", "[", "]", "i", "=", "0", "while", "i", "<", "len", "(", "word", ")", ":", "# check for digraphs and dipththongs\r", "if", "i", "<", "len", "(", "word", ")", "-", "1", "and...
The heart of the transcription process. Similar to the system in in cltk.phonology.utils, the algorithm: 1) Applies digraphs and diphthongs to the text of the word. 2) Carries out a naive ("greedy", per @clemsciences) substitution of letters to phonemes, according to the alphabet. 3) Applies the conditio...
[ "The", "heart", "of", "the", "transcription", "process", ".", "Similar", "to", "the", "system", "in", "in", "cltk", ".", "phonology", ".", "utils", "the", "algorithm", ":", "1", ")", "Applies", "digraphs", "and", "diphthongs", "to", "the", "text", "of", ...
python
train
36.428571
praekelt/django-analytics
analytics/csv_views.py
https://github.com/praekelt/django-analytics/blob/29c22d03374ccc0ec451650e2c2886d324f6e5c6/analytics/csv_views.py#L7-L24
def csv_dump(request, uid): """ Returns a CSV dump of all of the specified metric's counts and cumulative counts. """ metric = Metric.objects.get(uid=uid) frequency = request.GET.get('frequency', settings.STATISTIC_FREQUENCY_DAILY) response = HttpResponse(mimetype='text/csv') response[...
[ "def", "csv_dump", "(", "request", ",", "uid", ")", ":", "metric", "=", "Metric", ".", "objects", ".", "get", "(", "uid", "=", "uid", ")", "frequency", "=", "request", ".", "GET", ".", "get", "(", "'frequency'", ",", "settings", ".", "STATISTIC_FREQUEN...
Returns a CSV dump of all of the specified metric's counts and cumulative counts.
[ "Returns", "a", "CSV", "dump", "of", "all", "of", "the", "specified", "metric", "s", "counts", "and", "cumulative", "counts", "." ]
python
test
41.444444
Azure/msrest-for-python
msrest/serialization.py
https://github.com/Azure/msrest-for-python/blob/0732bc90bdb290e5f58c675ffdd7dbfa9acefc93/msrest/serialization.py#L1742-L1776
def deserialize_iso(attr): """Deserialize ISO-8601 formatted string into Datetime object. :param str attr: response string to be deserialized. :rtype: Datetime :raises: DeserializationError if string format invalid. """ if isinstance(attr, ET.Element): attr =...
[ "def", "deserialize_iso", "(", "attr", ")", ":", "if", "isinstance", "(", "attr", ",", "ET", ".", "Element", ")", ":", "attr", "=", "attr", ".", "text", "try", ":", "attr", "=", "attr", ".", "upper", "(", ")", "match", "=", "Deserializer", ".", "va...
Deserialize ISO-8601 formatted string into Datetime object. :param str attr: response string to be deserialized. :rtype: Datetime :raises: DeserializationError if string format invalid.
[ "Deserialize", "ISO", "-", "8601", "formatted", "string", "into", "Datetime", "object", "." ]
python
train
38.885714
cloudant/python-cloudant
src/cloudant/database.py
https://github.com/cloudant/python-cloudant/blob/e0ba190f6ba07fe3522a668747128214ad573c7e/src/cloudant/database.py#L1445-L1549
def get_search_result(self, ddoc_id, index_name, **query_params): """ Retrieves the raw JSON content from the remote database based on the search index on the server, using the query_params provided as query parameters. A ``query`` parameter containing the Lucene query syntax is ...
[ "def", "get_search_result", "(", "self", ",", "ddoc_id", ",", "index_name", ",", "*", "*", "query_params", ")", ":", "ddoc", "=", "DesignDocument", "(", "self", ",", "ddoc_id", ")", "return", "self", ".", "_get_search_result", "(", "'/'", ".", "join", "(",...
Retrieves the raw JSON content from the remote database based on the search index on the server, using the query_params provided as query parameters. A ``query`` parameter containing the Lucene query syntax is mandatory. Example for search queries: .. code-block:: python ...
[ "Retrieves", "the", "raw", "JSON", "content", "from", "the", "remote", "database", "based", "on", "the", "search", "index", "on", "the", "server", "using", "the", "query_params", "provided", "as", "query", "parameters", ".", "A", "query", "parameter", "contain...
python
train
56.838095
Unidata/siphon
siphon/simplewebservice/igra2.py
https://github.com/Unidata/siphon/blob/53fb0d84fbce1c18c8e81c9e68bc81620ee0a6ac/siphon/simplewebservice/igra2.py#L121-L174
def _select_date_range(self, lines): """Identify lines containing headers within the range begin_date to end_date. Parameters ----- lines: list list of lines from the IGRA2 data file. """ headers = [] num_lev = [] dates = [] # Get in...
[ "def", "_select_date_range", "(", "self", ",", "lines", ")", ":", "headers", "=", "[", "]", "num_lev", "=", "[", "]", "dates", "=", "[", "]", "# Get indices of headers, and make a list of dates and num_lev", "for", "idx", ",", "line", "in", "enumerate", "(", "...
Identify lines containing headers within the range begin_date to end_date. Parameters ----- lines: list list of lines from the IGRA2 data file.
[ "Identify", "lines", "containing", "headers", "within", "the", "range", "begin_date", "to", "end_date", "." ]
python
train
36.222222
google/apitools
apitools/base/py/base_api.py
https://github.com/google/apitools/blob/f3745a7ea535aa0e88b0650c16479b696d6fd446/apitools/base/py/base_api.py#L370-L375
def JsonResponseModel(self): """In this context, return raw JSON instead of proto.""" old_model = self.response_type_model self.__response_type_model = 'json' yield self.__response_type_model = old_model
[ "def", "JsonResponseModel", "(", "self", ")", ":", "old_model", "=", "self", ".", "response_type_model", "self", ".", "__response_type_model", "=", "'json'", "yield", "self", ".", "__response_type_model", "=", "old_model" ]
In this context, return raw JSON instead of proto.
[ "In", "this", "context", "return", "raw", "JSON", "instead", "of", "proto", "." ]
python
train
39.666667
GoogleCloudPlatform/appengine-mapreduce
python/src/mapreduce/base_handler.py
https://github.com/GoogleCloudPlatform/appengine-mapreduce/blob/2045eb3605b6ecb40c83d11dd5442a89fe5c5dd6/python/src/mapreduce/base_handler.py#L93-L134
def initialize(self, request, response): """Initialize. 1. call webapp init. 2. check request is indeed from taskqueue. 3. check the task has not been retried too many times. 4. run handler specific processing logic. 5. run error handling logic if precessing failed. Args: request: a ...
[ "def", "initialize", "(", "self", ",", "request", ",", "response", ")", ":", "super", "(", "TaskQueueHandler", ",", "self", ")", ".", "initialize", "(", "request", ",", "response", ")", "# Check request is from taskqueue.", "if", "\"X-AppEngine-QueueName\"", "not"...
Initialize. 1. call webapp init. 2. check request is indeed from taskqueue. 3. check the task has not been retried too many times. 4. run handler specific processing logic. 5. run error handling logic if precessing failed. Args: request: a webapp.Request instance. response: a webap...
[ "Initialize", "." ]
python
train
34.52381
harmsm/PyCmdMessenger
PyCmdMessenger/PyCmdMessenger.py
https://github.com/harmsm/PyCmdMessenger/blob/215d6f9402262662a14a2996f532934339639a5b/PyCmdMessenger/PyCmdMessenger.py#L291-L317
def _treat_star_format(self,arg_format_list,args): """ Deal with "*" format if specified. """ num_stars = len([a for a in arg_format_list if a == "*"]) if num_stars > 0: # Make sure the repeated format argument only occurs once, is last, # and that there...
[ "def", "_treat_star_format", "(", "self", ",", "arg_format_list", ",", "args", ")", ":", "num_stars", "=", "len", "(", "[", "a", "for", "a", "in", "arg_format_list", "if", "a", "==", "\"*\"", "]", ")", "if", "num_stars", ">", "0", ":", "# Make sure the r...
Deal with "*" format if specified.
[ "Deal", "with", "*", "format", "if", "specified", "." ]
python
train
40.703704
odlgroup/odl
odl/solvers/functional/default_functionals.py
https://github.com/odlgroup/odl/blob/b8443f6aca90e191ba36c91d32253c5a36249a6c/odl/solvers/functional/default_functionals.py#L1142-L1176
def gradient(self): r"""Gradient of the KL functional. The gradient of `KullbackLeibler` with ``prior`` :math:`g` is given as .. math:: \nabla F(x) = 1 - \frac{g}{x}. The gradient is not defined in points where one or more components are non-positive. ...
[ "def", "gradient", "(", "self", ")", ":", "functional", "=", "self", "class", "KLGradient", "(", "Operator", ")", ":", "\"\"\"The gradient operator of this functional.\"\"\"", "def", "__init__", "(", "self", ")", ":", "\"\"\"Initialize a new instance.\"\"\"", "super", ...
r"""Gradient of the KL functional. The gradient of `KullbackLeibler` with ``prior`` :math:`g` is given as .. math:: \nabla F(x) = 1 - \frac{g}{x}. The gradient is not defined in points where one or more components are non-positive.
[ "r", "Gradient", "of", "the", "KL", "functional", "." ]
python
train
30.028571
htm-community/menorah
menorah/riverstream.py
https://github.com/htm-community/menorah/blob/1991b01eda3f6361b22ed165b4a688ae3fb2deaf/menorah/riverstream.py#L181-L191
def createFieldDescription(self): """ Provides a field description dict for swarm description. :return: (dict) """ return { "fieldName": self.getName(), "fieldType": self._dataType, "minValue": self._min, "maxValue": self._max }
[ "def", "createFieldDescription", "(", "self", ")", ":", "return", "{", "\"fieldName\"", ":", "self", ".", "getName", "(", ")", ",", "\"fieldType\"", ":", "self", ".", "_dataType", ",", "\"minValue\"", ":", "self", ".", "_min", ",", "\"maxValue\"", ":", "se...
Provides a field description dict for swarm description. :return: (dict)
[ "Provides", "a", "field", "description", "dict", "for", "swarm", "description", ".", ":", "return", ":", "(", "dict", ")" ]
python
train
24.181818
aetros/aetros-cli
aetros/git.py
https://github.com/aetros/aetros-cli/blob/a2a1f38d6af1660e1e2680c7d413ec2aef45faab/aetros/git.py#L417-L426
def start_push_sync(self): """ Starts the detection of unsynced Git data. """ self.active_thread = True self.active_push = True self.thread_push_instance = Thread(target=self.thread_push) self.thread_push_instance.daemon = True self.thread_push_instance.s...
[ "def", "start_push_sync", "(", "self", ")", ":", "self", ".", "active_thread", "=", "True", "self", ".", "active_push", "=", "True", "self", ".", "thread_push_instance", "=", "Thread", "(", "target", "=", "self", ".", "thread_push", ")", "self", ".", "thre...
Starts the detection of unsynced Git data.
[ "Starts", "the", "detection", "of", "unsynced", "Git", "data", "." ]
python
train
31.7
SatelliteQE/nailgun
nailgun/entities.py
https://github.com/SatelliteQE/nailgun/blob/c36d8c20862e87bf6975bd48ac1ca40a9e634eaa/nailgun/entities.py#L6351-L6375
def path(self, which=None): """Extend ``nailgun.entity_mixins.Entity.path``. The format of the returned path depends on the value of ``which``: available_repositories /repository_sets/<id>/available_repositories enable /repository_sets/<id>/enable disabl...
[ "def", "path", "(", "self", ",", "which", "=", "None", ")", ":", "if", "which", "in", "(", "'available_repositories'", ",", "'enable'", ",", "'disable'", ",", ")", ":", "return", "'{0}/{1}'", ".", "format", "(", "super", "(", "RepositorySet", ",", "self"...
Extend ``nailgun.entity_mixins.Entity.path``. The format of the returned path depends on the value of ``which``: available_repositories /repository_sets/<id>/available_repositories enable /repository_sets/<id>/enable disable /repository_sets/<id>/dis...
[ "Extend", "nailgun", ".", "entity_mixins", ".", "Entity", ".", "path", "." ]
python
train
28.4
quantmind/dynts
dynts/stats/variates.py
https://github.com/quantmind/dynts/blob/21ac57c648bfec402fa6b1fe569496cf098fb5e8/dynts/stats/variates.py#L60-L71
def cov(self, ddof=None, bias=0): '''The covariance matrix from the aggregate sample. It accepts an optional parameter for the degree of freedoms. :parameter ddof: If not ``None`` normalization is by (N - ddof), where N is the number of observations; this overrides the value im...
[ "def", "cov", "(", "self", ",", "ddof", "=", "None", ",", "bias", "=", "0", ")", ":", "N", "=", "self", ".", "n", "M", "=", "N", "if", "bias", "else", "N", "-", "1", "M", "=", "M", "if", "ddof", "is", "None", "else", "N", "-", "ddof", "re...
The covariance matrix from the aggregate sample. It accepts an optional parameter for the degree of freedoms. :parameter ddof: If not ``None`` normalization is by (N - ddof), where N is the number of observations; this overrides the value implied by bias. The default value ...
[ "The", "covariance", "matrix", "from", "the", "aggregate", "sample", ".", "It", "accepts", "an", "optional", "parameter", "for", "the", "degree", "of", "freedoms", ".", ":", "parameter", "ddof", ":", "If", "not", "None", "normalization", "is", "by", "(", "...
python
train
43.916667
cmbruns/pyopenvr
src/openvr/__init__.py
https://github.com/cmbruns/pyopenvr/blob/68395d26bb3df6ab1f0f059c38d441f962938be6/src/openvr/__init__.py#L4878-L4886
def setOverlayTransformTrackedDeviceComponent(self, ulOverlayHandle, unDeviceIndex, pchComponentName): """ Sets the transform to draw the overlay on a rendermodel component mesh instead of a quad. This will only draw when the system is drawing the device. Overlays with this transform type cannot...
[ "def", "setOverlayTransformTrackedDeviceComponent", "(", "self", ",", "ulOverlayHandle", ",", "unDeviceIndex", ",", "pchComponentName", ")", ":", "fn", "=", "self", ".", "function_table", ".", "setOverlayTransformTrackedDeviceComponent", "result", "=", "fn", "(", "ulOve...
Sets the transform to draw the overlay on a rendermodel component mesh instead of a quad. This will only draw when the system is drawing the device. Overlays with this transform type cannot receive mouse events.
[ "Sets", "the", "transform", "to", "draw", "the", "overlay", "on", "a", "rendermodel", "component", "mesh", "instead", "of", "a", "quad", ".", "This", "will", "only", "draw", "when", "the", "system", "is", "drawing", "the", "device", ".", "Overlays", "with"...
python
train
57.111111
CivicSpleen/ambry
ambry/library/__init__.py
https://github.com/CivicSpleen/ambry/blob/d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42/ambry/library/__init__.py#L272-L294
def new_from_bundle_config(self, config): """ Create a new bundle, or link to an existing one, based on the identity in config data. :param config: A Dict form of a bundle.yaml file :return: """ identity = Identity.from_dict(config['identity']) ds = self._db.dat...
[ "def", "new_from_bundle_config", "(", "self", ",", "config", ")", ":", "identity", "=", "Identity", ".", "from_dict", "(", "config", "[", "'identity'", "]", ")", "ds", "=", "self", ".", "_db", ".", "dataset", "(", "identity", ".", "vid", ",", "exception"...
Create a new bundle, or link to an existing one, based on the identity in config data. :param config: A Dict form of a bundle.yaml file :return:
[ "Create", "a", "new", "bundle", "or", "link", "to", "an", "existing", "one", "based", "on", "the", "identity", "in", "config", "data", "." ]
python
train
29.782609
idlesign/django-sitecats
sitecats/models.py
https://github.com/idlesign/django-sitecats/blob/9b45e91fc0dcb63a0011780437fe28145e3ecce9/sitecats/models.py#L254-L277
def enable_category_lists_editor(self, request, editor_init_kwargs=None, additional_parents_aliases=None, lists_init_kwargs=None, handler_init_kwargs=None): """Enables editor functionality for categories of this object. :param Request request: Django request object ...
[ "def", "enable_category_lists_editor", "(", "self", ",", "request", ",", "editor_init_kwargs", "=", "None", ",", "additional_parents_aliases", "=", "None", ",", "lists_init_kwargs", "=", "None", ",", "handler_init_kwargs", "=", "None", ")", ":", "from", ".", "tool...
Enables editor functionality for categories of this object. :param Request request: Django request object :param dict editor_init_kwargs: Keyword args to initialize category lists editor with. See CategoryList.enable_editor() :param list additional_parents_aliases: Aliases of catego...
[ "Enables", "editor", "functionality", "for", "categories", "of", "this", "object", "." ]
python
train
64.833333
gbiggs/rtctree
rtctree/component.py
https://github.com/gbiggs/rtctree/blob/bd725a47ac87c259c8bce06156ccc9ab71111c26/rtctree/component.py#L909-L917
def has_port_by_ref(self, port_ref): '''Check if this component has a port by the given reference to a CORBA PortService object. ''' with self._mutex: if self.get_port_by_ref(self, port_ref): return True return False
[ "def", "has_port_by_ref", "(", "self", ",", "port_ref", ")", ":", "with", "self", ".", "_mutex", ":", "if", "self", ".", "get_port_by_ref", "(", "self", ",", "port_ref", ")", ":", "return", "True", "return", "False" ]
Check if this component has a port by the given reference to a CORBA PortService object.
[ "Check", "if", "this", "component", "has", "a", "port", "by", "the", "given", "reference", "to", "a", "CORBA", "PortService", "object", "." ]
python
train
31.222222
hannes-brt/hebel
hebel/pycuda_ops/cublas.py
https://github.com/hannes-brt/hebel/blob/1e2c3a9309c2646103901b26a55be4e312dd5005/hebel/pycuda_ops/cublas.py#L3306-L3317
def cublasDtpsv(handle, uplo, trans, diag, n, AP, x, incx): """ Solve real triangular-packed system with one right-hand side. """ status = _libcublas.cublasDtpsv_v2(handle, _CUBLAS_FILL_MODE[uplo], _CUBLAS_OP[trans], ...
[ "def", "cublasDtpsv", "(", "handle", ",", "uplo", ",", "trans", ",", "diag", ",", "n", ",", "AP", ",", "x", ",", "incx", ")", ":", "status", "=", "_libcublas", ".", "cublasDtpsv_v2", "(", "handle", ",", "_CUBLAS_FILL_MODE", "[", "uplo", "]", ",", "_C...
Solve real triangular-packed system with one right-hand side.
[ "Solve", "real", "triangular", "-", "packed", "system", "with", "one", "right", "-", "hand", "side", "." ]
python
train
38.25
heuer/cablemap
cablemap.tm/cablemap/tm/handler.py
https://github.com/heuer/cablemap/blob/42066c8fc2972d237a2c35578e14525aaf705f38/cablemap.tm/cablemap/tm/handler.py#L74-L99
def create_ctm_miohandler(fileobj, title=None, comment=None, register_prefixes=True, register_templates=True, detect_prefixes=False): """\ """ handler = CTMHandler(fileobj) handler.title = title handler.comment = comment handler.detect_prefixes = detect_prefixes if register_prefixes: ...
[ "def", "create_ctm_miohandler", "(", "fileobj", ",", "title", "=", "None", ",", "comment", "=", "None", ",", "register_prefixes", "=", "True", ",", "register_templates", "=", "True", ",", "detect_prefixes", "=", "False", ")", ":", "handler", "=", "CTMHandler",...
\
[ "\\" ]
python
train
82
google/apitools
apitools/base/protorpclite/descriptor.py
https://github.com/google/apitools/blob/f3745a7ea535aa0e88b0650c16479b696d6fd446/apitools/base/protorpclite/descriptor.py#L305-L338
def describe_field(field_definition): """Build descriptor for Field instance. Args: field_definition: Field instance to provide descriptor for. Returns: Initialized FieldDescriptor instance describing the Field instance. """ field_descriptor = FieldDescriptor() field_descriptor.nam...
[ "def", "describe_field", "(", "field_definition", ")", ":", "field_descriptor", "=", "FieldDescriptor", "(", ")", "field_descriptor", ".", "name", "=", "field_definition", ".", "name", "field_descriptor", ".", "number", "=", "field_definition", ".", "number", "field...
Build descriptor for Field instance. Args: field_definition: Field instance to provide descriptor for. Returns: Initialized FieldDescriptor instance describing the Field instance.
[ "Build", "descriptor", "for", "Field", "instance", "." ]
python
train
35.588235
jbarlow83/OCRmyPDF
src/ocrmypdf/pdfinfo/__init__.py
https://github.com/jbarlow83/OCRmyPDF/blob/79c84eefa353632a3d7ccddbd398c6678c1c1777/src/ocrmypdf/pdfinfo/__init__.py#L120-L198
def _interpret_contents(contentstream, initial_shorthand=UNIT_SQUARE): """Interpret the PDF content stream. The stack represents the state of the PDF graphics stack. We are only interested in the current transformation matrix (CTM) so we only track this object; a full implementation would need to trac...
[ "def", "_interpret_contents", "(", "contentstream", ",", "initial_shorthand", "=", "UNIT_SQUARE", ")", ":", "stack", "=", "[", "]", "ctm", "=", "PdfMatrix", "(", "initial_shorthand", ")", "xobject_settings", "=", "[", "]", "inline_images", "=", "[", "]", "foun...
Interpret the PDF content stream. The stack represents the state of the PDF graphics stack. We are only interested in the current transformation matrix (CTM) so we only track this object; a full implementation would need to track many other items. The CTM is initialized to the mapping from user space...
[ "Interpret", "the", "PDF", "content", "stream", "." ]
python
train
41.493671
eyurtsev/FlowCytometryTools
FlowCytometryTools/core/containers.py
https://github.com/eyurtsev/FlowCytometryTools/blob/4355632508b875273d68c7e2972c17668bcf7b40/FlowCytometryTools/core/containers.py#L353-L371
def gate(self, gate, apply_now=True): ''' Apply given gate and return new gated sample (with assigned data). Parameters ---------- gate : {_gate_available_classes} Returns ------- FCMeasurement Sample with data that passes gates ''' ...
[ "def", "gate", "(", "self", ",", "gate", ",", "apply_now", "=", "True", ")", ":", "data", "=", "self", ".", "get_data", "(", ")", "newdata", "=", "gate", "(", "data", ")", "newsample", "=", "self", ".", "copy", "(", ")", "newsample", ".", "data", ...
Apply given gate and return new gated sample (with assigned data). Parameters ---------- gate : {_gate_available_classes} Returns ------- FCMeasurement Sample with data that passes gates
[ "Apply", "given", "gate", "and", "return", "new", "gated", "sample", "(", "with", "assigned", "data", ")", "." ]
python
train
23.736842
rochacbruno/dynaconf
dynaconf/cli.py
https://github.com/rochacbruno/dynaconf/blob/5a7cc8f8252251cbdf4f4112965801f9dfe2831d/dynaconf/cli.py#L33-L81
def set_settings(instance=None): """Pick correct settings instance and set it to a global variable.""" global settings settings = None if instance: settings = import_settings(instance) elif "INSTANCE_FOR_DYNACONF" in os.environ: settings = import_settings(os.environ["INSTANCE_FOR...
[ "def", "set_settings", "(", "instance", "=", "None", ")", ":", "global", "settings", "settings", "=", "None", "if", "instance", ":", "settings", "=", "import_settings", "(", "instance", ")", "elif", "\"INSTANCE_FOR_DYNACONF\"", "in", "os", ".", "environ", ":",...
Pick correct settings instance and set it to a global variable.
[ "Pick", "correct", "settings", "instance", "and", "set", "it", "to", "a", "global", "variable", "." ]
python
train
31.081633
docker/docker-py
docker/api/network.py
https://github.com/docker/docker-py/blob/613d6aad83acc9931ff2ecfd6a6c7bd8061dc125/docker/api/network.py#L177-L186
def remove_network(self, net_id): """ Remove a network. Similar to the ``docker network rm`` command. Args: net_id (str): The network's id """ url = self._url("/networks/{0}", net_id) res = self._delete(url) self._raise_for_status(res)
[ "def", "remove_network", "(", "self", ",", "net_id", ")", ":", "url", "=", "self", ".", "_url", "(", "\"/networks/{0}\"", ",", "net_id", ")", "res", "=", "self", ".", "_delete", "(", "url", ")", "self", ".", "_raise_for_status", "(", "res", ")" ]
Remove a network. Similar to the ``docker network rm`` command. Args: net_id (str): The network's id
[ "Remove", "a", "network", ".", "Similar", "to", "the", "docker", "network", "rm", "command", "." ]
python
train
29.5
midasplatform/pydas
pydas/api.py
https://github.com/midasplatform/pydas/blob/e5f9e96e754fb2dc5da187b05e4abc77a9b2affd/pydas/api.py#L397-L408
def _has_only_files(local_folder): """ Return whether a folder contains only files. This will be False if the folder contains any subdirectories. :param local_folder: full path to the local folder :type local_folder: string :returns: True if the folder contains only files :rtype: bool "...
[ "def", "_has_only_files", "(", "local_folder", ")", ":", "return", "not", "any", "(", "os", ".", "path", ".", "isdir", "(", "os", ".", "path", ".", "join", "(", "local_folder", ",", "entry", ")", ")", "for", "entry", "in", "os", ".", "listdir", "(", ...
Return whether a folder contains only files. This will be False if the folder contains any subdirectories. :param local_folder: full path to the local folder :type local_folder: string :returns: True if the folder contains only files :rtype: bool
[ "Return", "whether", "a", "folder", "contains", "only", "files", ".", "This", "will", "be", "False", "if", "the", "folder", "contains", "any", "subdirectories", "." ]
python
valid
36.416667
saltstack/salt
salt/modules/dockermod.py
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/dockermod.py#L6025-L6056
def _run(name, cmd, exec_driver=None, output=None, stdin=None, python_shell=True, output_loglevel='debug', ignore_retcode=False, use_vt=False, keep_env=None): ''' Common logic for docker.run functions ''' if exec_driver is ...
[ "def", "_run", "(", "name", ",", "cmd", ",", "exec_driver", "=", "None", ",", "output", "=", "None", ",", "stdin", "=", "None", ",", "python_shell", "=", "True", ",", "output_loglevel", "=", "'debug'", ",", "ignore_retcode", "=", "False", ",", "use_vt", ...
Common logic for docker.run functions
[ "Common", "logic", "for", "docker", ".", "run", "functions" ]
python
train
24.34375
not-na/peng3d
peng3d/peng.py
https://github.com/not-na/peng3d/blob/1151be665b26cc8a479f6307086ba919e4d32d85/peng3d/peng.py#L164-L188
def addPygletListener(self,event_type,handler): """ Registers an event handler. The specified callable handler will be called every time an event with the same ``event_type`` is encountered. All event arguments are passed as positional arguments. This m...
[ "def", "addPygletListener", "(", "self", ",", "event_type", ",", "handler", ")", ":", "if", "self", ".", "cfg", "[", "\"debug.events.register\"", "]", ":", "print", "(", "\"Registered Event: %s Handler: %s\"", "%", "(", "event_type", ",", "handler", ")", ")", ...
Registers an event handler. The specified callable handler will be called every time an event with the same ``event_type`` is encountered. All event arguments are passed as positional arguments. This method should be used to listen for pyglet events. For new co...
[ "Registers", "an", "event", "handler", ".", "The", "specified", "callable", "handler", "will", "be", "called", "every", "time", "an", "event", "with", "the", "same", "event_type", "is", "encountered", ".", "All", "event", "arguments", "are", "passed", "as", ...
python
test
43.52
hyperledger/sawtooth-core
cli/sawtooth_cli/settings.py
https://github.com/hyperledger/sawtooth-core/blob/8cf473bc2207e51f02bd182d825158a57d72b098/cli/sawtooth_cli/settings.py#L38-L81
def add_settings_parser(subparsers, parent_parser): """Creates the args parser needed for the settings command and its subcommands. """ # The following parser is for the settings subsection of commands. These # commands display information about the currently applied on-chain # settings. s...
[ "def", "add_settings_parser", "(", "subparsers", ",", "parent_parser", ")", ":", "# The following parser is for the settings subsection of commands. These", "# commands display information about the currently applied on-chain", "# settings.", "settings_parser", "=", "subparsers", ".", ...
Creates the args parser needed for the settings command and its subcommands.
[ "Creates", "the", "args", "parser", "needed", "for", "the", "settings", "command", "and", "its", "subcommands", "." ]
python
train
32.977273
mcrute/pydora
pandora/models/playlist.py
https://github.com/mcrute/pydora/blob/d9e353e7f19da741dcf372246b4d5640cb788488/pandora/models/playlist.py#L39-L83
def formatter(self, api_client, data, newval): """Get audio-related fields Try to find fields for the audio url for specified preferred quality level, or next-lowest available quality url otherwise. """ url_map = data.get("audioUrlMap") audio_url = data.get("audioUrl") ...
[ "def", "formatter", "(", "self", ",", "api_client", ",", "data", ",", "newval", ")", ":", "url_map", "=", "data", ".", "get", "(", "\"audioUrlMap\"", ")", "audio_url", "=", "data", ".", "get", "(", "\"audioUrl\"", ")", "# Only an audio URL, not a quality map. ...
Get audio-related fields Try to find fields for the audio url for specified preferred quality level, or next-lowest available quality url otherwise.
[ "Get", "audio", "-", "related", "fields" ]
python
valid
42.422222
SeleniumHQ/selenium
py/selenium/webdriver/remote/webdriver.py
https://github.com/SeleniumHQ/selenium/blob/df40c28b41d4b3953f90eaff84838a9ac052b84a/py/selenium/webdriver/remote/webdriver.py#L762-L774
def window_handles(self): """ Returns the handles of all windows within the current session. :Usage: :: driver.window_handles """ if self.w3c: return self.execute(Command.W3C_GET_WINDOW_HANDLES)['value'] else: return s...
[ "def", "window_handles", "(", "self", ")", ":", "if", "self", ".", "w3c", ":", "return", "self", ".", "execute", "(", "Command", ".", "W3C_GET_WINDOW_HANDLES", ")", "[", "'value'", "]", "else", ":", "return", "self", ".", "execute", "(", "Command", ".", ...
Returns the handles of all windows within the current session. :Usage: :: driver.window_handles
[ "Returns", "the", "handles", "of", "all", "windows", "within", "the", "current", "session", "." ]
python
train
27.384615
log2timeline/plaso
plaso/parsers/syslog_plugins/ssh.py
https://github.com/log2timeline/plaso/blob/9c564698d2da3ffbe23607a3c54c0582ea18a6cc/plaso/parsers/syslog_plugins/ssh.py#L115-L158
def ParseMessage(self, parser_mediator, key, date_time, tokens): """Produces an event from a syslog body that matched one of the grammars. Args: parser_mediator (ParserMediator): mediates interactions between parsers and other components, such as storage and dfvfs. key (str): name of the ...
[ "def", "ParseMessage", "(", "self", ",", "parser_mediator", ",", "key", ",", "date_time", ",", "tokens", ")", ":", "if", "key", "not", "in", "(", "'failed_connection'", ",", "'login'", ",", "'opened_connection'", ")", ":", "raise", "ValueError", "(", "'Unkno...
Produces an event from a syslog body that matched one of the grammars. Args: parser_mediator (ParserMediator): mediates interactions between parsers and other components, such as storage and dfvfs. key (str): name of the matching grammar. date_time (dfdatetime.DateTimeValues): date and ...
[ "Produces", "an", "event", "from", "a", "syslog", "body", "that", "matched", "one", "of", "the", "grammars", "." ]
python
train
40.386364
idlesign/django-sitetree
sitetree/sitetreeapp.py
https://github.com/idlesign/django-sitetree/blob/61de4608e6e415247c75fe8691027d7c4ed0d1e7/sitetree/sitetreeapp.py#L994-L1005
def get_children(self, tree_alias, item): """Returns item's children. :param str|unicode tree_alias: :param TreeItemBase|None item: :rtype: list """ if not self.current_app_is_admin(): # We do not need i18n for a tree rendered in Admin dropdown. t...
[ "def", "get_children", "(", "self", ",", "tree_alias", ",", "item", ")", ":", "if", "not", "self", ".", "current_app_is_admin", "(", ")", ":", "# We do not need i18n for a tree rendered in Admin dropdown.", "tree_alias", "=", "self", ".", "resolve_tree_i18n_alias", "(...
Returns item's children. :param str|unicode tree_alias: :param TreeItemBase|None item: :rtype: list
[ "Returns", "item", "s", "children", "." ]
python
test
35.583333
pydata/xarray
xarray/core/merge.py
https://github.com/pydata/xarray/blob/6d93a95d05bdbfc33fff24064f67d29dd891ab58/xarray/core/merge.py#L230-L264
def determine_coords(list_of_variable_dicts): # type: (List[Dict]) -> Tuple[Set, Set] """Given a list of dicts with xarray object values, identify coordinates. Parameters ---------- list_of_variable_dicts : list of dict or Dataset objects Of the same form as the arguments to expand_variable...
[ "def", "determine_coords", "(", "list_of_variable_dicts", ")", ":", "# type: (List[Dict]) -> Tuple[Set, Set]", "from", ".", "dataarray", "import", "DataArray", "from", ".", "dataset", "import", "Dataset", "coord_names", "=", "set", "(", ")", "# type: set", "noncoord_nam...
Given a list of dicts with xarray object values, identify coordinates. Parameters ---------- list_of_variable_dicts : list of dict or Dataset objects Of the same form as the arguments to expand_variable_dicts. Returns ------- coord_names : set of variable names noncoord_names : set...
[ "Given", "a", "list", "of", "dicts", "with", "xarray", "object", "values", "identify", "coordinates", "." ]
python
train
35.971429
artefactual-labs/mets-reader-writer
metsrw/plugins/premisrw/premis.py
https://github.com/artefactual-labs/mets-reader-writer/blob/d95939cabdfdc25cb1bf67df0c84bd0d6e6a73ff/metsrw/plugins/premisrw/premis.py#L784-L808
def data_find_all(data, path, dyn_cls=False): """Find and return all element-as-tuples in tuple ``data`` using simplified XPath ``path``. """ path_parts = path.split("/") try: sub_elms = tuple( el for el in data if isinstance(el, (tuple, list)) and el[0] =...
[ "def", "data_find_all", "(", "data", ",", "path", ",", "dyn_cls", "=", "False", ")", ":", "path_parts", "=", "path", ".", "split", "(", "\"/\"", ")", "try", ":", "sub_elms", "=", "tuple", "(", "el", "for", "el", "in", "data", "if", "isinstance", "(",...
Find and return all element-as-tuples in tuple ``data`` using simplified XPath ``path``.
[ "Find", "and", "return", "all", "element", "-", "as", "-", "tuples", "in", "tuple", "data", "using", "simplified", "XPath", "path", "." ]
python
train
29.68
dls-controls/pymalcolm
malcolm/core/hook.py
https://github.com/dls-controls/pymalcolm/blob/80ea667e4da26365a6cebc0249f52fdc744bd983/malcolm/core/hook.py#L30-L51
def register_hooked(self, hooks, # type: Union[Type[Hook], Sequence[Type[Hook]]] func, # type: Hooked args_gen=None # type: Optional[ArgsGen] ): # type: (Type[Hook], Callable, Optional[Callable]) -> None "...
[ "def", "register_hooked", "(", "self", ",", "hooks", ",", "# type: Union[Type[Hook], Sequence[Type[Hook]]]", "func", ",", "# type: Hooked", "args_gen", "=", "None", "# type: Optional[ArgsGen]", ")", ":", "# type: (Type[Hook], Callable, Optional[Callable]) -> None", "if", "self"...
Register func to be run when any of the hooks are run by parent Args: hooks: A Hook class or list of Hook classes of interest func: The callable that should be run on that Hook args_gen: Optionally specify the argument names that should be passed to func. If ...
[ "Register", "func", "to", "be", "run", "when", "any", "of", "the", "hooks", "are", "run", "by", "parent" ]
python
train
44.454545
aouyar/PyMunin
pysysinfo/mysql.py
https://github.com/aouyar/PyMunin/blob/4f58a64b6b37c85a84cc7e1e07aafaa0321b249d/pysysinfo/mysql.py#L150-L164
def getProcessDatabase(self): """Returns number of processes discriminated by database name. @return: Dictionary mapping database name to number of processes. """ info_dict = {} cur = self._conn.cursor() cur.execute("""SHOW FULL PROCESSLIST;""") ...
[ "def", "getProcessDatabase", "(", "self", ")", ":", "info_dict", "=", "{", "}", "cur", "=", "self", ".", "_conn", ".", "cursor", "(", ")", "cur", ".", "execute", "(", "\"\"\"SHOW FULL PROCESSLIST;\"\"\"", ")", "rows", "=", "cur", ".", "fetchall", "(", ")...
Returns number of processes discriminated by database name. @return: Dictionary mapping database name to number of processes.
[ "Returns", "number", "of", "processes", "discriminated", "by", "database", "name", "." ]
python
train
32.2
thespacedoctor/rockAtlas
rockAtlas/positions/orbfitPositions.py
https://github.com/thespacedoctor/rockAtlas/blob/062ecaa95ab547efda535aa33165944f13c621de/rockAtlas/positions/orbfitPositions.py#L300-L390
def _match_objects_against_atlas_footprint( self, orbfitEph, ra, dec): """*match the orbfit generated object positions against atlas exposure footprint* **Key Arguments:** - ``orbfitEph`` -- the orbfit ephemerides - ``ra`` -- the A...
[ "def", "_match_objects_against_atlas_footprint", "(", "self", ",", "orbfitEph", ",", "ra", ",", "dec", ")", ":", "self", ".", "log", ".", "info", "(", "'starting the ``_match_objects_against_atlas_footprint`` method'", ")", "# GET THE ORBFIT MAG LIMIT", "magLimit", "=", ...
*match the orbfit generated object positions against atlas exposure footprint* **Key Arguments:** - ``orbfitEph`` -- the orbfit ephemerides - ``ra`` -- the ATLAS exposure RA (degrees) - ``dec`` -- the ATLAS exposure DEC (degrees) **Return:** - ``matchedE...
[ "*", "match", "the", "orbfit", "generated", "object", "positions", "against", "atlas", "exposure", "footprint", "*" ]
python
train
33.230769
saltstack/salt
salt/cloud/clouds/vmware.py
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/vmware.py#L2519-L3080
def create(vm_): ''' To create a single VM in the VMware environment. Sample profile and arguments that can be specified in it can be found :ref:`here. <vmware-cloud-profile>` CLI Example: .. code-block:: bash salt-cloud -p vmware-centos6.5 vmname ''' try: # Check for...
[ "def", "create", "(", "vm_", ")", ":", "try", ":", "# Check for required profile parameters before sending any API calls.", "if", "(", "vm_", "[", "'profile'", "]", "and", "config", ".", "is_profile_configured", "(", "__opts__", ",", "__active_provider_name__", "or", ...
To create a single VM in the VMware environment. Sample profile and arguments that can be specified in it can be found :ref:`here. <vmware-cloud-profile>` CLI Example: .. code-block:: bash salt-cloud -p vmware-centos6.5 vmname
[ "To", "create", "a", "single", "VM", "in", "the", "VMware", "environment", "." ]
python
train
42.037367
saltstack/salt
salt/fileserver/azurefs.py
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/fileserver/azurefs.py#L371-L391
def _validate_config(): ''' Validate azurefs config, return False if it doesn't validate ''' if not isinstance(__opts__['azurefs'], list): log.error('azurefs configuration is not formed as a list, skipping azurefs') return False for container in __opts__['azurefs']: if not is...
[ "def", "_validate_config", "(", ")", ":", "if", "not", "isinstance", "(", "__opts__", "[", "'azurefs'", "]", ",", "list", ")", ":", "log", ".", "error", "(", "'azurefs configuration is not formed as a list, skipping azurefs'", ")", "return", "False", "for", "conta...
Validate azurefs config, return False if it doesn't validate
[ "Validate", "azurefs", "config", "return", "False", "if", "it", "doesn", "t", "validate" ]
python
train
39.857143
alexa/alexa-skills-kit-sdk-for-python
ask-sdk-runtime/ask_sdk_runtime/utils.py
https://github.com/alexa/alexa-skills-kit-sdk-for-python/blob/097b6406aa12d5ca0b825b00c936861b530cbf39/ask-sdk-runtime/ask_sdk_runtime/utils.py#L20-L39
def user_agent_info(sdk_version, custom_user_agent): # type: (str, str) -> str """Return the user agent info along with the SDK and Python Version information. :param sdk_version: Version of the SDK being used. :type sdk_version: str :param custom_user_agent: Custom User Agent string provided b...
[ "def", "user_agent_info", "(", "sdk_version", ",", "custom_user_agent", ")", ":", "# type: (str, str) -> str", "python_version", "=", "\".\"", ".", "join", "(", "str", "(", "x", ")", "for", "x", "in", "sys", ".", "version_info", "[", "0", ":", "3", "]", ")...
Return the user agent info along with the SDK and Python Version information. :param sdk_version: Version of the SDK being used. :type sdk_version: str :param custom_user_agent: Custom User Agent string provided by the developer. :type custom_user_agent: str :return: User Agent Info str...
[ "Return", "the", "user", "agent", "info", "along", "with", "the", "SDK", "and", "Python", "Version", "information", "." ]
python
train
35.25
thriftrw/thriftrw-python
thriftrw/idl/lexer.py
https://github.com/thriftrw/thriftrw-python/blob/4f2f71acd7a0ac716c9ea5cdcea2162aa561304a/thriftrw/idl/lexer.py#L124-L151
def t_LITERAL(self, t): r'(\"([^\\\n]|(\\.))*?\")|\'([^\\\n]|(\\.))*?\'' s = t.value[1:-1] maps = { 't': '\t', 'r': '\r', 'n': '\n', '\\': '\\', '\'': '\'', '"': '\"' } i = 0 length = len(s) v...
[ "def", "t_LITERAL", "(", "self", ",", "t", ")", ":", "s", "=", "t", ".", "value", "[", "1", ":", "-", "1", "]", "maps", "=", "{", "'t'", ":", "'\\t'", ",", "'r'", ":", "'\\r'", ",", "'n'", ":", "'\\n'", ",", "'\\\\'", ":", "'\\\\'", ",", "'...
r'(\"([^\\\n]|(\\.))*?\")|\'([^\\\n]|(\\.))*?\
[ "r", "(", "\\", "(", "[", "^", "\\\\\\", "n", "]", "|", "(", "\\\\", ".", "))", "*", "?", "\\", ")", "|", "\\", "(", "[", "^", "\\\\\\", "n", "]", "|", "(", "\\\\", ".", "))", "*", "?", "\\" ]
python
train
24.571429
mikedh/trimesh
trimesh/path/path.py
https://github.com/mikedh/trimesh/blob/25e059bf6d4caa74f62ffd58ce4f61a90ee4e518/trimesh/path/path.py#L1209-L1243
def medial_axis(self, resolution=None, clip=None): """ Find the approximate medial axis based on a voronoi diagram of evenly spaced points on the boundary of the polygon. Parameters ---------- resolution : None or float Distance between each sample on t...
[ "def", "medial_axis", "(", "self", ",", "resolution", "=", "None", ",", "clip", "=", "None", ")", ":", "if", "resolution", "is", "None", ":", "resolution", "=", "self", ".", "scale", "/", "1000.0", "# convert the edges to Path2D kwargs", "from", ".", "exchan...
Find the approximate medial axis based on a voronoi diagram of evenly spaced points on the boundary of the polygon. Parameters ---------- resolution : None or float Distance between each sample on the polygon boundary clip : None, or (2,) float Min, m...
[ "Find", "the", "approximate", "medial", "axis", "based", "on", "a", "voronoi", "diagram", "of", "evenly", "spaced", "points", "on", "the", "boundary", "of", "the", "polygon", "." ]
python
train
30.571429
asifpy/django-crudbuilder
crudbuilder/helpers.py
https://github.com/asifpy/django-crudbuilder/blob/9de1c6fa555086673dd7ccc351d4b771c6192489/crudbuilder/helpers.py#L88-L103
def mixedToUnder(s): # pragma: no cover """ Sample: >>> mixedToUnder("FooBarBaz") 'foo_bar_baz' Special case for ID: >>> mixedToUnder("FooBarID") 'foo_bar_id' """ if s.endswith('ID'): return mixedToUnder(s[:-2] + "_id") trans = _mixedToUnderRE.sub(mixedT...
[ "def", "mixedToUnder", "(", "s", ")", ":", "# pragma: no cover", "if", "s", ".", "endswith", "(", "'ID'", ")", ":", "return", "mixedToUnder", "(", "s", "[", ":", "-", "2", "]", "+", "\"_id\"", ")", "trans", "=", "_mixedToUnderRE", ".", "sub", "(", "m...
Sample: >>> mixedToUnder("FooBarBaz") 'foo_bar_baz' Special case for ID: >>> mixedToUnder("FooBarID") 'foo_bar_id'
[ "Sample", ":", ">>>", "mixedToUnder", "(", "FooBarBaz", ")", "foo_bar_baz" ]
python
train
24.4375
hydraplatform/hydra-base
hydra_base/util/__init__.py
https://github.com/hydraplatform/hydra-base/blob/9251ff7946505f7a272c87837390acd1c435bc6e/hydra_base/util/__init__.py#L132-L218
def get_val(dataset, timestamp=None): """ Turn the string value of a dataset into an appropriate value, be it a decimal value, array or time series. If a timestamp is passed to this function, return the values appropriate to the requested times. If the timestamp is *before*...
[ "def", "get_val", "(", "dataset", ",", "timestamp", "=", "None", ")", ":", "if", "dataset", ".", "type", "==", "'array'", ":", "#TODO: design a mechansim to retrieve this data if it's stored externally", "return", "json", ".", "loads", "(", "dataset", ".", "value", ...
Turn the string value of a dataset into an appropriate value, be it a decimal value, array or time series. If a timestamp is passed to this function, return the values appropriate to the requested times. If the timestamp is *before* the start of the timeseries data, return None ...
[ "Turn", "the", "string", "value", "of", "a", "dataset", "into", "an", "appropriate", "value", "be", "it", "a", "decimal", "value", "array", "or", "time", "series", "." ]
python
train
41.632184
danielperna84/pyhomematic
pyhomematic/_hm.py
https://github.com/danielperna84/pyhomematic/blob/8b91f3e84c83f05d289c740d507293a0d6759d8e/pyhomematic/_hm.py#L222-L231
def event(self, interface_id, address, value_key, value): """If a device emits some sort event, we will handle it here.""" LOG.debug("RPCFunctions.event: interface_id = %s, address = %s, value_key = %s, value = %s" % ( interface_id, address, value_key.upper(), str(value))) self.devic...
[ "def", "event", "(", "self", ",", "interface_id", ",", "address", ",", "value_key", ",", "value", ")", ":", "LOG", ".", "debug", "(", "\"RPCFunctions.event: interface_id = %s, address = %s, value_key = %s, value = %s\"", "%", "(", "interface_id", ",", "address", ",", ...
If a device emits some sort event, we will handle it here.
[ "If", "a", "device", "emits", "some", "sort", "event", "we", "will", "handle", "it", "here", "." ]
python
train
61.3
openid/python-openid
openid/store/sqlstore.py
https://github.com/openid/python-openid/blob/f7e13536f0d1828d3cef5ae7a7b55cabadff37fc/openid/store/sqlstore.py#L254-L269
def txn_useNonce(self, server_url, timestamp, salt): """Return whether this nonce is present, and if it is, then remove it from the set. str -> bool""" if abs(timestamp - time.time()) > nonce.SKEW: return False try: self.db_add_nonce(server_url, timestam...
[ "def", "txn_useNonce", "(", "self", ",", "server_url", ",", "timestamp", ",", "salt", ")", ":", "if", "abs", "(", "timestamp", "-", "time", ".", "time", "(", ")", ")", ">", "nonce", ".", "SKEW", ":", "return", "False", "try", ":", "self", ".", "db_...
Return whether this nonce is present, and if it is, then remove it from the set. str -> bool
[ "Return", "whether", "this", "nonce", "is", "present", "and", "if", "it", "is", "then", "remove", "it", "from", "the", "set", "." ]
python
train
32.25
AlecAivazis/graphql-over-kafka
nautilus/api/util/arg_string_from_dict.py
https://github.com/AlecAivazis/graphql-over-kafka/blob/70e2acef27a2f87355590be1a6ca60ce3ab4d09c/nautilus/api/util/arg_string_from_dict.py#L3-L14
def arg_string_from_dict(arg_dict, **kwds): """ This function takes a series of ditionaries and creates an argument string for a graphql query """ # the filters dictionary filters = { **arg_dict, **kwds, } # return the correctly formed string return ", ".join(...
[ "def", "arg_string_from_dict", "(", "arg_dict", ",", "*", "*", "kwds", ")", ":", "# the filters dictionary", "filters", "=", "{", "*", "*", "arg_dict", ",", "*", "*", "kwds", ",", "}", "# return the correctly formed string", "return", "\", \"", ".", "join", "(...
This function takes a series of ditionaries and creates an argument string for a graphql query
[ "This", "function", "takes", "a", "series", "of", "ditionaries", "and", "creates", "an", "argument", "string", "for", "a", "graphql", "query" ]
python
train
31.833333
mdeous/fatbotslim
fatbotslim/irc/bot.py
https://github.com/mdeous/fatbotslim/blob/341595d24454a79caee23750eac271f9d0626c88/fatbotslim/irc/bot.py#L330-L344
def cmd(self, command, args, prefix=None): """ Sends a command to the server. :param command: IRC code to send. :type command: unicode :param args: arguments to pass with the command. :type args: basestring :param prefix: optional prefix to prepend to the command...
[ "def", "cmd", "(", "self", ",", "command", ",", "args", ",", "prefix", "=", "None", ")", ":", "if", "prefix", "is", "None", ":", "prefix", "=", "u''", "raw_cmd", "=", "u'{0} {1} {2}'", ".", "format", "(", "prefix", ",", "command", ",", "args", ")", ...
Sends a command to the server. :param command: IRC code to send. :type command: unicode :param args: arguments to pass with the command. :type args: basestring :param prefix: optional prefix to prepend to the command. :type prefix: str or None
[ "Sends", "a", "command", "to", "the", "server", "." ]
python
train
33.6
zarr-developers/zarr
zarr/n5.py
https://github.com/zarr-developers/zarr/blob/fb8e6d5ea6bc26e451e5cf0eaaee36977556d5b5/zarr/n5.py#L316-L354
def array_metadata_to_n5(array_metadata): '''Convert array metadata from zarr to N5 format.''' for f, t in zarr_to_n5_keys: array_metadata[t] = array_metadata[f] del array_metadata[f] del array_metadata['zarr_format'] try: dtype = np.dtype(array_metadata['dataType']) except...
[ "def", "array_metadata_to_n5", "(", "array_metadata", ")", ":", "for", "f", ",", "t", "in", "zarr_to_n5_keys", ":", "array_metadata", "[", "t", "]", "=", "array_metadata", "[", "f", "]", "del", "array_metadata", "[", "f", "]", "del", "array_metadata", "[", ...
Convert array metadata from zarr to N5 format.
[ "Convert", "array", "metadata", "from", "zarr", "to", "N5", "format", "." ]
python
train
39.153846
ArtoLabs/SimpleSteem
simplesteem/simplesteem.py
https://github.com/ArtoLabs/SimpleSteem/blob/ce8be0ae81f8878b460bc156693f1957f7dd34a3/simplesteem/simplesteem.py#L579-L606
def sbd_to_steem(self, sbd=0, price=0, account=None): ''' Uses the ticker to get the lowest ask and moves the sbd at that price. ''' if not account: account = self.mainaccount if self.check_balances(account): if sbd == 0: sbd = self.sbdbal ...
[ "def", "sbd_to_steem", "(", "self", ",", "sbd", "=", "0", ",", "price", "=", "0", ",", "account", "=", "None", ")", ":", "if", "not", "account", ":", "account", "=", "self", ".", "mainaccount", "if", "self", ".", "check_balances", "(", "account", ")"...
Uses the ticker to get the lowest ask and moves the sbd at that price.
[ "Uses", "the", "ticker", "to", "get", "the", "lowest", "ask", "and", "moves", "the", "sbd", "at", "that", "price", "." ]
python
train
39.892857
apache/incubator-mxnet
python/mxnet/gluon/block.py
https://github.com/apache/incubator-mxnet/blob/1af29e9c060a4c7d60eeaacba32afdb9a7775ba7/python/mxnet/gluon/block.py#L404-L421
def load_params(self, filename, ctx=None, allow_missing=False, ignore_extra=False): """[Deprecated] Please use load_parameters. Load parameters from file. filename : str Path to parameter file. ctx : Context or list of Context, default cpu() ...
[ "def", "load_params", "(", "self", ",", "filename", ",", "ctx", "=", "None", ",", "allow_missing", "=", "False", ",", "ignore_extra", "=", "False", ")", ":", "warnings", ".", "warn", "(", "\"load_params is deprecated. Please use load_parameters.\"", ")", "self", ...
[Deprecated] Please use load_parameters. Load parameters from file. filename : str Path to parameter file. ctx : Context or list of Context, default cpu() Context(s) to initialize loaded parameters on. allow_missing : bool, default False Whether to s...
[ "[", "Deprecated", "]", "Please", "use", "load_parameters", "." ]
python
train
44.277778
AdvancedClimateSystems/uModbus
umodbus/functions.py
https://github.com/AdvancedClimateSystems/uModbus/blob/0560a42308003f4072d988f28042b8d55b694ad4/umodbus/functions.py#L906-L921
def create_from_response_pdu(resp_pdu, req_pdu): """ Create instance from response PDU. Response PDU is required together with the number of registers read. :param resp_pdu: Byte array with request PDU. :param quantity: Number of coils read. :return: Instance of :class:`ReadCoi...
[ "def", "create_from_response_pdu", "(", "resp_pdu", ",", "req_pdu", ")", ":", "read_input_registers", "=", "ReadInputRegisters", "(", ")", "read_input_registers", ".", "quantity", "=", "struct", ".", "unpack", "(", "'>H'", ",", "req_pdu", "[", "-", "2", ":", "...
Create instance from response PDU. Response PDU is required together with the number of registers read. :param resp_pdu: Byte array with request PDU. :param quantity: Number of coils read. :return: Instance of :class:`ReadCoils`.
[ "Create", "instance", "from", "response", "PDU", "." ]
python
train
39.5
tradenity/python-sdk
tradenity/resources/payment_transaction.py
https://github.com/tradenity/python-sdk/blob/d13fbe23f4d6ff22554c6d8d2deaf209371adaf1/tradenity/resources/payment_transaction.py#L681-L702
def replace_payment_transaction_by_id(cls, payment_transaction_id, payment_transaction, **kwargs): """Replace PaymentTransaction Replace all attributes of PaymentTransaction This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async=...
[ "def", "replace_payment_transaction_by_id", "(", "cls", ",", "payment_transaction_id", ",", "payment_transaction", ",", "*", "*", "kwargs", ")", ":", "kwargs", "[", "'_return_http_data_only'", "]", "=", "True", "if", "kwargs", ".", "get", "(", "'async'", ")", ":...
Replace PaymentTransaction Replace all attributes of PaymentTransaction This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async=True >>> thread = api.replace_payment_transaction_by_id(payment_transaction_id, payment_transaction, a...
[ "Replace", "PaymentTransaction" ]
python
train
54.818182
buckket/twtxt
twtxt/cli.py
https://github.com/buckket/twtxt/blob/6c8ad8ef3cbcf0dd335a12285d8b6bbdf93ce851/twtxt/cli.py#L123-L165
def timeline(ctx, pager, limit, twtfile, sorting, timeout, porcelain, source, cache, force_update): """Retrieve your personal timeline.""" if source: source_obj = ctx.obj["conf"].get_source_by_nick(source) if not source_obj: logger.debug("Not following {0}, trying as URL".format(sour...
[ "def", "timeline", "(", "ctx", ",", "pager", ",", "limit", ",", "twtfile", ",", "sorting", ",", "timeout", ",", "porcelain", ",", "source", ",", "cache", ",", "force_update", ")", ":", "if", "source", ":", "source_obj", "=", "ctx", ".", "obj", "[", "...
Retrieve your personal timeline.
[ "Retrieve", "your", "personal", "timeline", "." ]
python
valid
40.093023
litl/rauth
rauth/session.py
https://github.com/litl/rauth/blob/a6d887d7737cf21ec896a8104f25c2754c694011/rauth/session.py#L328-L358
def request(self, method, url, bearer_auth=True, **req_kwargs): ''' A loose wrapper around Requests' :class:`~requests.sessions.Session` which injects OAuth 2.0 parameters. :param method: A string representation of the HTTP method to be used. :type method: str :param url...
[ "def", "request", "(", "self", ",", "method", ",", "url", ",", "bearer_auth", "=", "True", ",", "*", "*", "req_kwargs", ")", ":", "req_kwargs", ".", "setdefault", "(", "'params'", ",", "{", "}", ")", "url", "=", "self", ".", "_set_url", "(", "url", ...
A loose wrapper around Requests' :class:`~requests.sessions.Session` which injects OAuth 2.0 parameters. :param method: A string representation of the HTTP method to be used. :type method: str :param url: The resource to be requested. :type url: str :param bearer_auth: W...
[ "A", "loose", "wrapper", "around", "Requests", ":", "class", ":", "~requests", ".", "sessions", ".", "Session", "which", "injects", "OAuth", "2", ".", "0", "parameters", "." ]
python
train
39.032258
smarie/python-valid8
valid8/entry_points_annotations.py
https://github.com/smarie/python-valid8/blob/5e15d1de11602933c5114eb9f73277ad91d97800/valid8/entry_points_annotations.py#L42-L48
def get_what_txt(self): """ Overrides the base behaviour defined in ValidationError in order to add details about the function. :return: """ return 'input [{var}] for function [{func}]'.format(var=self.get_variable_str(), ...
[ "def", "get_what_txt", "(", "self", ")", ":", "return", "'input [{var}] for function [{func}]'", ".", "format", "(", "var", "=", "self", ".", "get_variable_str", "(", ")", ",", "func", "=", "self", ".", "validator", ".", "get_validated_func_display_name", "(", "...
Overrides the base behaviour defined in ValidationError in order to add details about the function. :return:
[ "Overrides", "the", "base", "behaviour", "defined", "in", "ValidationError", "in", "order", "to", "add", "details", "about", "the", "function", ".", ":", "return", ":" ]
python
train
52.857143
bcbio/bcbio-nextgen
bcbio/rnaseq/express.py
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/rnaseq/express.py#L13-L39
def run(data): """Quantitaive isoforms expression by eXpress""" name = dd.get_sample_name(data) in_bam = dd.get_transcriptome_bam(data) config = data['config'] if not in_bam: logger.info("Transcriptome-mapped BAM file not found, skipping eXpress.") return data out_dir = os.path.j...
[ "def", "run", "(", "data", ")", ":", "name", "=", "dd", ".", "get_sample_name", "(", "data", ")", "in_bam", "=", "dd", ".", "get_transcriptome_bam", "(", "data", ")", "config", "=", "data", "[", "'config'", "]", "if", "not", "in_bam", ":", "logger", ...
Quantitaive isoforms expression by eXpress
[ "Quantitaive", "isoforms", "expression", "by", "eXpress" ]
python
train
55.074074
HumanBrainProject/hbp-service-client
hbp_service_client/storage_service/client.py
https://github.com/HumanBrainProject/hbp-service-client/blob/b338fb41a7f0e7b9d654ff28fcf13a56d03bff4d/hbp_service_client/storage_service/client.py#L34-L48
def new(cls, access_token, environment='prod'): '''Create new storage service client. Arguments: environment(str): The service environment to be used for the client. 'prod' or 'dev'. access_token(str): The access token used to authenticate with th...
[ "def", "new", "(", "cls", ",", "access_token", ",", "environment", "=", "'prod'", ")", ":", "api_client", "=", "ApiClient", ".", "new", "(", "access_token", ",", "environment", ")", "return", "cls", "(", "api_client", ")" ]
Create new storage service client. Arguments: environment(str): The service environment to be used for the client. 'prod' or 'dev'. access_token(str): The access token used to authenticate with the service Returns: ...
[ "Create", "new", "storage", "service", "client", "." ]
python
test
34.2
marrow/cinje
cinje/inline/flush.py
https://github.com/marrow/cinje/blob/413bdac7242020ce8379d272720c649a9196daa2/cinje/inline/flush.py#L6-L26
def flush_template(context, declaration=None, reconstruct=True): """Emit the code needed to flush the buffer. Will only emit the yield and clear if the buffer is known to be dirty. """ if declaration is None: declaration = Line(0, '') if {'text', 'dirty'}.issubset(context.flag): yield declaration.clone(...
[ "def", "flush_template", "(", "context", ",", "declaration", "=", "None", ",", "reconstruct", "=", "True", ")", ":", "if", "declaration", "is", "None", ":", "declaration", "=", "Line", "(", "0", ",", "''", ")", "if", "{", "'text'", ",", "'dirty'", "}",...
Emit the code needed to flush the buffer. Will only emit the yield and clear if the buffer is known to be dirty.
[ "Emit", "the", "code", "needed", "to", "flush", "the", "buffer", ".", "Will", "only", "emit", "the", "yield", "and", "clear", "if", "the", "buffer", "is", "known", "to", "be", "dirty", "." ]
python
train
27.285714
evolbioinfo/pastml
pastml/parsimony.py
https://github.com/evolbioinfo/pastml/blob/df8a375841525738383e59548eed3441b07dbd3e/pastml/parsimony.py#L83-L111
def uppass(tree, feature): """ UPPASS traverses the tree starting from the tips and going up till the root, and assigns to each parent node a state based on the states of its child nodes. if N is a tip: S(N) <- state of N else: L, R <- left and right children of N UPPASS(L) UP...
[ "def", "uppass", "(", "tree", ",", "feature", ")", ":", "ps_feature", "=", "get_personalized_feature_name", "(", "feature", ",", "BU_PARS_STATES", ")", "for", "node", "in", "tree", ".", "traverse", "(", "'postorder'", ")", ":", "if", "not", "node", ".", "i...
UPPASS traverses the tree starting from the tips and going up till the root, and assigns to each parent node a state based on the states of its child nodes. if N is a tip: S(N) <- state of N else: L, R <- left and right children of N UPPASS(L) UPPASS(R) if S(L) intersects with S...
[ "UPPASS", "traverses", "the", "tree", "starting", "from", "the", "tips", "and", "going", "up", "till", "the", "root", "and", "assigns", "to", "each", "parent", "node", "a", "state", "based", "on", "the", "states", "of", "its", "child", "nodes", "." ]
python
train
39.517241
saltstack/salt
salt/netapi/rest_wsgi.py
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/netapi/rest_wsgi.py#L249-L259
def saltenviron(environ): ''' Make Salt's opts dict and the APIClient available in the WSGI environ ''' if '__opts__' not in locals(): import salt.config __opts__ = salt.config.client_config( os.environ.get('SALT_MASTER_CONFIG', '/etc/salt/master')) environ['SALT_OPT...
[ "def", "saltenviron", "(", "environ", ")", ":", "if", "'__opts__'", "not", "in", "locals", "(", ")", ":", "import", "salt", ".", "config", "__opts__", "=", "salt", ".", "config", ".", "client_config", "(", "os", ".", "environ", ".", "get", "(", "'SALT_...
Make Salt's opts dict and the APIClient available in the WSGI environ
[ "Make", "Salt", "s", "opts", "dict", "and", "the", "APIClient", "available", "in", "the", "WSGI", "environ" ]
python
train
35.545455
python-odin/odinweb
odinweb/containers.py
https://github.com/python-odin/odinweb/blob/198424133584acc18cb41c8d18d91f803abc810f/odinweb/containers.py#L131-L140
def op_paths(self, path_base): # type: (Union[str, UrlPath]) -> Generator[Tuple[UrlPath, Operation]] """ Return all operations stored in containers. """ path_base += self.path_prefix for operation in self._operations: for op_path in operation.op_paths(path_ba...
[ "def", "op_paths", "(", "self", ",", "path_base", ")", ":", "# type: (Union[str, UrlPath]) -> Generator[Tuple[UrlPath, Operation]]", "path_base", "+=", "self", ".", "path_prefix", "for", "operation", "in", "self", ".", "_operations", ":", "for", "op_path", "in", "oper...
Return all operations stored in containers.
[ "Return", "all", "operations", "stored", "in", "containers", "." ]
python
train
34.5
jdillard/sphinx-sitemap
sphinx_sitemap/__init__.py
https://github.com/jdillard/sphinx-sitemap/blob/2d8bf7ec6e14f5edd3be4d6b6e979aa8cf63e663/sphinx_sitemap/__init__.py#L50-L52
def add_html_link(app, pagename, templatename, context, doctree): """As each page is built, collect page names for the sitemap""" app.sitemap_links.append(pagename + ".html")
[ "def", "add_html_link", "(", "app", ",", "pagename", ",", "templatename", ",", "context", ",", "doctree", ")", ":", "app", ".", "sitemap_links", ".", "append", "(", "pagename", "+", "\".html\"", ")" ]
As each page is built, collect page names for the sitemap
[ "As", "each", "page", "is", "built", "collect", "page", "names", "for", "the", "sitemap" ]
python
train
60
dls-controls/pymalcolm
malcolm/core/future.py
https://github.com/dls-controls/pymalcolm/blob/80ea667e4da26365a6cebc0249f52fdc744bd983/malcolm/core/future.py#L30-L48
def result(self, timeout=None): """Return the result of the call that the future represents. Args: timeout: The number of seconds to wait for the result if the future isn't done. If None, then there is no limit on the wait time. Returns: The result of th...
[ "def", "result", "(", "self", ",", "timeout", "=", "None", ")", ":", "if", "self", ".", "_state", "==", "self", ".", "RUNNING", ":", "self", ".", "_context", ".", "wait_all_futures", "(", "[", "self", "]", ",", "timeout", ")", "return", "self", ".", ...
Return the result of the call that the future represents. Args: timeout: The number of seconds to wait for the result if the future isn't done. If None, then there is no limit on the wait time. Returns: The result of the call that the future represents. ...
[ "Return", "the", "result", "of", "the", "call", "that", "the", "future", "represents", "." ]
python
train
37.421053
PedalPi/PluginsManager
pluginsmanager/jack/jack_client.py
https://github.com/PedalPi/PluginsManager/blob/2dcc9f6a79b48e9c9be82efffd855352fa15c5c7/pluginsmanager/jack/jack_client.py#L87-L91
def midi_outputs(self): """ :return: A list of MIDI output :class:`Ports`. """ return self.client.get_ports(is_midi=True, is_physical=True, is_output=True)
[ "def", "midi_outputs", "(", "self", ")", ":", "return", "self", ".", "client", ".", "get_ports", "(", "is_midi", "=", "True", ",", "is_physical", "=", "True", ",", "is_output", "=", "True", ")" ]
:return: A list of MIDI output :class:`Ports`.
[ ":", "return", ":", "A", "list", "of", "MIDI", "output", ":", "class", ":", "Ports", "." ]
python
train
36.6
RedHatInsights/insights-core
insights/client/connection.py
https://github.com/RedHatInsights/insights-core/blob/b57cbf8ed7c089672426ede0441e0a4f789ef4a1/insights/client/connection.py#L658-L674
def unregister(self): """ Unregister this system from the insights service """ machine_id = generate_machine_id() try: logger.debug("Unregistering %s", machine_id) url = self.api_url + "/v1/systems/" + machine_id net_logger.info("DELETE %s", ur...
[ "def", "unregister", "(", "self", ")", ":", "machine_id", "=", "generate_machine_id", "(", ")", "try", ":", "logger", ".", "debug", "(", "\"Unregistering %s\"", ",", "machine_id", ")", "url", "=", "self", ".", "api_url", "+", "\"/v1/systems/\"", "+", "machin...
Unregister this system from the insights service
[ "Unregister", "this", "system", "from", "the", "insights", "service" ]
python
train
37.117647
glue-viz/glue-vispy-viewers
glue_vispy_viewers/extern/vispy/scene/node.py
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/scene/node.py#L371-L385
def set_transform(self, type_, *args, **kwargs): """ Create a new transform of *type* and assign it to this node. All extra arguments are used in the construction of the transform. Parameters ---------- type_ : str The transform type. *args : tuple ...
[ "def", "set_transform", "(", "self", ",", "type_", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "self", ".", "transform", "=", "create_transform", "(", "type_", ",", "*", "args", ",", "*", "*", "kwargs", ")" ]
Create a new transform of *type* and assign it to this node. All extra arguments are used in the construction of the transform. Parameters ---------- type_ : str The transform type. *args : tuple Arguments. **kwargs : dict Keywoard ar...
[ "Create", "a", "new", "transform", "of", "*", "type", "*", "and", "assign", "it", "to", "this", "node", "." ]
python
train
30.2
Netflix-Skunkworks/cloudaux
cloudaux/orchestration/aws/image.py
https://github.com/Netflix-Skunkworks/cloudaux/blob/c4b0870c3ac68b1c69e71d33cf78b6a8bdf437ea/cloudaux/orchestration/aws/image.py#L50-L88
def get_image(image_id, flags=FLAGS.ALL, **conn): """ Orchestrates all the calls required to fully build out an EC2 Image (AMI, AKI, ARI) { "Architecture": "x86_64", "Arn": "arn:aws:ec2:us-east-1::image/ami-11111111", "BlockDeviceMappings": [], "CreationDate": "2013-07-11...
[ "def", "get_image", "(", "image_id", ",", "flags", "=", "FLAGS", ".", "ALL", ",", "*", "*", "conn", ")", ":", "image", "=", "dict", "(", "ImageId", "=", "image_id", ")", "conn", "[", "'region'", "]", "=", "conn", ".", "get", "(", "'region'", ",", ...
Orchestrates all the calls required to fully build out an EC2 Image (AMI, AKI, ARI) { "Architecture": "x86_64", "Arn": "arn:aws:ec2:us-east-1::image/ami-11111111", "BlockDeviceMappings": [], "CreationDate": "2013-07-11T16:04:06.000Z", "Description": "...", "Hype...
[ "Orchestrates", "all", "the", "calls", "required", "to", "fully", "build", "out", "an", "EC2", "Image", "(", "AMI", "AKI", "ARI", ")" ]
python
valid
34.307692
django-leonardo/django-leonardo
leonardo/module/nav/templatetags/webcms_nav_tags.py
https://github.com/django-leonardo/django-leonardo/blob/4b933e1792221a13b4028753d5f1d3499b0816d4/leonardo/module/nav/templatetags/webcms_nav_tags.py#L245-L267
def feincms_breadcrumbs(page, include_self=True): """ Generate a list of the page's ancestors suitable for use as breadcrumb navigation. By default, generates an unordered list with the id "breadcrumbs" - override breadcrumbs.html to change this. :: {% feincms_breadcrumbs feincms_page %} ...
[ "def", "feincms_breadcrumbs", "(", "page", ",", "include_self", "=", "True", ")", ":", "if", "not", "page", "or", "not", "isinstance", "(", "page", ",", "Page", ")", ":", "raise", "ValueError", "(", "\"feincms_breadcrumbs must be called with a valid Page object\"", ...
Generate a list of the page's ancestors suitable for use as breadcrumb navigation. By default, generates an unordered list with the id "breadcrumbs" - override breadcrumbs.html to change this. :: {% feincms_breadcrumbs feincms_page %}
[ "Generate", "a", "list", "of", "the", "page", "s", "ancestors", "suitable", "for", "use", "as", "breadcrumb", "navigation", "." ]
python
train
27.826087
GoogleCloudPlatform/appengine-mapreduce
python/src/mapreduce/output_writers.py
https://github.com/GoogleCloudPlatform/appengine-mapreduce/blob/2045eb3605b6ecb40c83d11dd5442a89fe5c5dd6/python/src/mapreduce/output_writers.py#L357-L371
def append(self, data): """Append data to a file.""" data_length = len(data) if self._size + data_length > self._flush_size: self.flush() if not self._exclusive and data_length > _FILE_POOL_MAX_SIZE: raise errors.Error( "Too big input %s (%s)." % (data_length, _FILE_POOL_MAX_SIZE...
[ "def", "append", "(", "self", ",", "data", ")", ":", "data_length", "=", "len", "(", "data", ")", "if", "self", ".", "_size", "+", "data_length", ">", "self", ".", "_flush_size", ":", "self", ".", "flush", "(", ")", "if", "not", "self", ".", "_excl...
Append data to a file.
[ "Append", "data", "to", "a", "file", "." ]
python
train
29.333333