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
ShadowBlip/Neteria
neteria/client.py
https://github.com/ShadowBlip/Neteria/blob/1a8c976eb2beeca0a5a272a34ac58b2c114495a4/neteria/client.py#L411-L487
def event(self, event_data, priority="normal", event_method="EVENT"): """This function will send event packets to the server. This is the main method you would use to send data from your application to the server. Whenever an event is sent to the server, a universally unique event id ...
[ "def", "event", "(", "self", ",", "event_data", ",", "priority", "=", "\"normal\"", ",", "event_method", "=", "\"EVENT\"", ")", ":", "logger", ".", "debug", "(", "\"event: \"", "+", "str", "(", "event_data", ")", ")", "# Generate an event UUID for this event", ...
This function will send event packets to the server. This is the main method you would use to send data from your application to the server. Whenever an event is sent to the server, a universally unique event id (euuid) is created for each event and stored in the "event_uuids" d...
[ "This", "function", "will", "send", "event", "packets", "to", "the", "server", ".", "This", "is", "the", "main", "method", "you", "would", "use", "to", "send", "data", "from", "your", "application", "to", "the", "server", "." ]
python
train
44.779221
ray-project/ray
python/ray/utils.py
https://github.com/ray-project/ray/blob/4eade036a0505e244c976f36aaa2d64386b5129b/python/ray/utils.py#L32-L51
def format_error_message(exception_message, task_exception=False): """Improve the formatting of an exception thrown by a remote function. This method takes a traceback from an exception and makes it nicer by removing a few uninformative lines and adding some space to indent the remaining lines nicely. ...
[ "def", "format_error_message", "(", "exception_message", ",", "task_exception", "=", "False", ")", ":", "lines", "=", "exception_message", ".", "split", "(", "\"\\n\"", ")", "if", "task_exception", ":", "# For errors that occur inside of tasks, remove lines 1 and 2 which ar...
Improve the formatting of an exception thrown by a remote function. This method takes a traceback from an exception and makes it nicer by removing a few uninformative lines and adding some space to indent the remaining lines nicely. Args: exception_message (str): A message generated by traceba...
[ "Improve", "the", "formatting", "of", "an", "exception", "thrown", "by", "a", "remote", "function", "." ]
python
train
38.55
glue-viz/glue-vispy-viewers
glue_vispy_viewers/extern/vispy/util/transforms.py
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/util/transforms.py#L15-L36
def translate(offset, dtype=None): """Translate by an offset (x, y, z) . Parameters ---------- offset : array-like, shape (3,) Translation in x, y, z. dtype : dtype | None Output type (if None, don't cast). Returns ------- M : ndarray Transformation matrix descr...
[ "def", "translate", "(", "offset", ",", "dtype", "=", "None", ")", ":", "assert", "len", "(", "offset", ")", "==", "3", "x", ",", "y", ",", "z", "=", "offset", "M", "=", "np", ".", "array", "(", "[", "[", "1.", ",", "0.", ",", "0.", ",", "0...
Translate by an offset (x, y, z) . Parameters ---------- offset : array-like, shape (3,) Translation in x, y, z. dtype : dtype | None Output type (if None, don't cast). Returns ------- M : ndarray Transformation matrix describing the translation.
[ "Translate", "by", "an", "offset", "(", "x", "y", "z", ")", "." ]
python
train
24.454545
inspirehep/refextract
refextract/references/find.py
https://github.com/inspirehep/refextract/blob/d70e3787be3c495a3a07d1517b53f81d51c788c7/refextract/references/find.py#L281-L354
def find_reference_section_no_title_generic(docbody, marker_patterns): """This function would generally be used when it was not possible to locate the start of a document's reference section by means of its title. Instead, this function will look for reference lines that have numeric markers of...
[ "def", "find_reference_section_no_title_generic", "(", "docbody", ",", "marker_patterns", ")", ":", "if", "not", "docbody", ":", "return", "None", "ref_start_line", "=", "ref_line_marker", "=", "None", "# try to find first reference line in the reference section:", "found_ref...
This function would generally be used when it was not possible to locate the start of a document's reference section by means of its title. Instead, this function will look for reference lines that have numeric markers of the format [1], [2], {1}, {2}, etc. @param docbody: (list) of strings ...
[ "This", "function", "would", "generally", "be", "used", "when", "it", "was", "not", "possible", "to", "locate", "the", "start", "of", "a", "document", "s", "reference", "section", "by", "means", "of", "its", "title", ".", "Instead", "this", "function", "wi...
python
train
41.432432
hydpy-dev/hydpy
hydpy/models/dam/dam_model.py
https://github.com/hydpy-dev/hydpy/blob/1bc6a82cf30786521d86b36e27900c6717d3348d/hydpy/models/dam/dam_model.py#L1625-L1656
def calc_missingremoterelease_v1(self): """Calculate the portion of the required remote demand that could not be met by the actual discharge release. Required flux sequences: |RequiredRemoteRelease| |ActualRelease| Calculated flux sequence: |MissingRemoteRelease| Basic equation:...
[ "def", "calc_missingremoterelease_v1", "(", "self", ")", ":", "flu", "=", "self", ".", "sequences", ".", "fluxes", ".", "fastaccess", "flu", ".", "missingremoterelease", "=", "max", "(", "flu", ".", "requiredremoterelease", "-", "flu", ".", "actualrelease", ",...
Calculate the portion of the required remote demand that could not be met by the actual discharge release. Required flux sequences: |RequiredRemoteRelease| |ActualRelease| Calculated flux sequence: |MissingRemoteRelease| Basic equation: :math:`MissingRemoteRelease = max( ...
[ "Calculate", "the", "portion", "of", "the", "required", "remote", "demand", "that", "could", "not", "be", "met", "by", "the", "actual", "discharge", "release", "." ]
python
train
30.5625
wecatch/app-turbo
turbo/log.py
https://github.com/wecatch/app-turbo/blob/75faf97371a9a138c53f92168d0a486636cb8a9c/turbo/log.py#L21-L37
def _init_file_logger(logger, level, log_path, log_size, log_count): """ one logger only have one level RotatingFileHandler """ if level not in [logging.NOTSET, logging.DEBUG, logging.INFO, logging.WARNING, logging.ERROR, logging.CRITICAL]: level = logging.DEBUG for h in logger.handlers: ...
[ "def", "_init_file_logger", "(", "logger", ",", "level", ",", "log_path", ",", "log_size", ",", "log_count", ")", ":", "if", "level", "not", "in", "[", "logging", ".", "NOTSET", ",", "logging", ".", "DEBUG", ",", "logging", ".", "INFO", ",", "logging", ...
one logger only have one level RotatingFileHandler
[ "one", "logger", "only", "have", "one", "level", "RotatingFileHandler" ]
python
train
35.882353
astroswego/plotypus
src/plotypus/preprocessing.py
https://github.com/astroswego/plotypus/blob/b1162194ca1d4f6c00e79afe3e6fb40f0eaffcb9/src/plotypus/preprocessing.py#L263-L347
def phase_shifted_coefficients(amplitude_coefficients, form='cos', shift=0.0): r""" Converts Fourier coefficients from the amplitude form to the phase-shifted form, as either a sine or cosine series. Amplitude form: .. math:: m(t) ...
[ "def", "phase_shifted_coefficients", "(", "amplitude_coefficients", ",", "form", "=", "'cos'", ",", "shift", "=", "0.0", ")", ":", "if", "form", "!=", "'sin'", "and", "form", "!=", "'cos'", ":", "raise", "NotImplementedError", "(", "'Fourier series must have form ...
r""" Converts Fourier coefficients from the amplitude form to the phase-shifted form, as either a sine or cosine series. Amplitude form: .. math:: m(t) = A_0 + \sum_{k=1}^n (a_k \sin(k \omega t) + b_k \cos(k \omega t)) Sine form...
[ "r", "Converts", "Fourier", "coefficients", "from", "the", "amplitude", "form", "to", "the", "phase", "-", "shifted", "form", "as", "either", "a", "sine", "or", "cosine", "series", "." ]
python
train
36.058824
pandas-dev/pandas
pandas/core/dtypes/missing.py
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/dtypes/missing.py#L479-L520
def na_value_for_dtype(dtype, compat=True): """ Return a dtype compat na value Parameters ---------- dtype : string / dtype compat : boolean, default True Returns ------- np.dtype or a pandas dtype Examples -------- >>> na_value_for_dtype(np.dtype('int64')) 0 >...
[ "def", "na_value_for_dtype", "(", "dtype", ",", "compat", "=", "True", ")", ":", "dtype", "=", "pandas_dtype", "(", "dtype", ")", "if", "is_extension_array_dtype", "(", "dtype", ")", ":", "return", "dtype", ".", "na_value", "if", "(", "is_datetime64_dtype", ...
Return a dtype compat na value Parameters ---------- dtype : string / dtype compat : boolean, default True Returns ------- np.dtype or a pandas dtype Examples -------- >>> na_value_for_dtype(np.dtype('int64')) 0 >>> na_value_for_dtype(np.dtype('int64'), compat=False) ...
[ "Return", "a", "dtype", "compat", "na", "value" ]
python
train
23.880952
fboender/ansible-cmdb
lib/mako/cache.py
https://github.com/fboender/ansible-cmdb/blob/ebd960ac10684e8c9ec2b12751bba2c4c9504ab7/lib/mako/cache.py#L96-L105
def set(self, key, value, **kw): """Place a value in the cache. :param key: the value's key. :param value: the value. :param \**kw: cache configuration arguments. """ self.impl.set(key, value, **self._get_cache_kw(kw, None))
[ "def", "set", "(", "self", ",", "key", ",", "value", ",", "*", "*", "kw", ")", ":", "self", ".", "impl", ".", "set", "(", "key", ",", "value", ",", "*", "*", "self", ".", "_get_cache_kw", "(", "kw", ",", "None", ")", ")" ]
Place a value in the cache. :param key: the value's key. :param value: the value. :param \**kw: cache configuration arguments.
[ "Place", "a", "value", "in", "the", "cache", "." ]
python
train
26.6
kata198/AdvancedHTMLParser
AdvancedHTMLParser/Parser.py
https://github.com/kata198/AdvancedHTMLParser/blob/06aeea5d8e2ea86e155aae0fc237623d3e9b7f9d/AdvancedHTMLParser/Parser.py#L1183-L1202
def getElementsByTagName(self, tagName, root='root', useIndex=True): ''' getElementsByTagName - Searches and returns all elements with a specific tag name. @param tagName <lowercase str> - A lowercase string of the tag name. @param root <AdvancedTag/'...
[ "def", "getElementsByTagName", "(", "self", ",", "tagName", ",", "root", "=", "'root'", ",", "useIndex", "=", "True", ")", ":", "(", "root", ",", "isFromRoot", ")", "=", "self", ".", "_handleRootArg", "(", "root", ")", "if", "useIndex", "is", "True", "...
getElementsByTagName - Searches and returns all elements with a specific tag name. @param tagName <lowercase str> - A lowercase string of the tag name. @param root <AdvancedTag/'root'> - Search starting at a specific node, if provided. if string 'root', the root of the p...
[ "getElementsByTagName", "-", "Searches", "and", "returns", "all", "elements", "with", "a", "specific", "tag", "name", "." ]
python
train
59.5
sdispater/eloquent
eloquent/orm/builder.py
https://github.com/sdispater/eloquent/blob/0638b688d5fd0c1a46b7471dd465eeb4c2f84666/eloquent/orm/builder.py#L695-L709
def with_(self, *relations): """ Set the relationships that should be eager loaded. :return: The current Builder instance :rtype: Builder """ if not relations: return self eagers = self._parse_relations(list(relations)) self._eager_load.upda...
[ "def", "with_", "(", "self", ",", "*", "relations", ")", ":", "if", "not", "relations", ":", "return", "self", "eagers", "=", "self", ".", "_parse_relations", "(", "list", "(", "relations", ")", ")", "self", ".", "_eager_load", ".", "update", "(", "eag...
Set the relationships that should be eager loaded. :return: The current Builder instance :rtype: Builder
[ "Set", "the", "relationships", "that", "should", "be", "eager", "loaded", "." ]
python
train
22.466667
getsentry/raven-python
raven/utils/stacks.py
https://github.com/getsentry/raven-python/blob/d891c20f0f930153f508e9d698d9de42e910face/raven/utils/stacks.py#L167-L215
def slim_frame_data(frames, frame_allowance=25): """ Removes various excess metadata from middle frames which go beyond ``frame_allowance``. Returns ``frames``. """ frames_len = 0 app_frames = [] system_frames = [] for frame in frames: frames_len += 1 if frame.get('i...
[ "def", "slim_frame_data", "(", "frames", ",", "frame_allowance", "=", "25", ")", ":", "frames_len", "=", "0", "app_frames", "=", "[", "]", "system_frames", "=", "[", "]", "for", "frame", "in", "frames", ":", "frames_len", "+=", "1", "if", "frame", ".", ...
Removes various excess metadata from middle frames which go beyond ``frame_allowance``. Returns ``frames``.
[ "Removes", "various", "excess", "metadata", "from", "middle", "frames", "which", "go", "beyond", "frame_allowance", "." ]
python
train
28.346939
Alignak-monitoring/alignak
alignak/daterange.py
https://github.com/Alignak-monitoring/alignak/blob/f3c145207e83159b799d3714e4241399c7740a64/alignak/daterange.py#L393-L402
def get_min_sec_from_morning(self): """Get the first second from midnight where a timerange is effective :return: smallest amount of second from midnight of all timerange :rtype: int """ mins = [] for timerange in self.timeranges: mins.append(timerange.get_se...
[ "def", "get_min_sec_from_morning", "(", "self", ")", ":", "mins", "=", "[", "]", "for", "timerange", "in", "self", ".", "timeranges", ":", "mins", ".", "append", "(", "timerange", ".", "get_sec_from_morning", "(", ")", ")", "return", "min", "(", "mins", ...
Get the first second from midnight where a timerange is effective :return: smallest amount of second from midnight of all timerange :rtype: int
[ "Get", "the", "first", "second", "from", "midnight", "where", "a", "timerange", "is", "effective" ]
python
train
35.3
Grokzen/pykwalify
pykwalify/__init__.py
https://github.com/Grokzen/pykwalify/blob/02b7e21eafb97926f17b7c33e2ee7b3ea67c3ef7/pykwalify/__init__.py#L25-L54
def init_logging(log_level): """ Init logging settings with default set to INFO """ log_level = log_level_to_string_map[min(log_level, 5)] msg = "%(levelname)s - %(name)s:%(lineno)s - %(message)s" if log_level in os.environ else "%(levelname)s - %(message)s" logging_conf = { "version":...
[ "def", "init_logging", "(", "log_level", ")", ":", "log_level", "=", "log_level_to_string_map", "[", "min", "(", "log_level", ",", "5", ")", "]", "msg", "=", "\"%(levelname)s - %(name)s:%(lineno)s - %(message)s\"", "if", "log_level", "in", "os", ".", "environ", "e...
Init logging settings with default set to INFO
[ "Init", "logging", "settings", "with", "default", "set", "to", "INFO" ]
python
train
26.7
Capitains/MyCapytain
MyCapytain/resources/collections/cts.py
https://github.com/Capitains/MyCapytain/blob/b11bbf6b6ae141fc02be70471e3fbf6907be6593/MyCapytain/resources/collections/cts.py#L256-L296
def parse(cls, resource, parent=None, _with_children=False): """ Parse a resource :param resource: Element rerpresenting a work :param type: basestring, etree._Element :param parent: Parent of the object :type parent: XmlCtsTextgroupMetadata :param _cls_dict: Dictionary ...
[ "def", "parse", "(", "cls", ",", "resource", ",", "parent", "=", "None", ",", "_with_children", "=", "False", ")", ":", "xml", "=", "xmlparser", "(", "resource", ")", "o", "=", "cls", "(", "urn", "=", "xml", ".", "get", "(", "\"urn\"", ")", ",", ...
Parse a resource :param resource: Element rerpresenting a work :param type: basestring, etree._Element :param parent: Parent of the object :type parent: XmlCtsTextgroupMetadata :param _cls_dict: Dictionary of classes to generate subclasses
[ "Parse", "a", "resource" ]
python
train
32.95122
knipknap/SpiffWorkflow
SpiffWorkflow/bpmn/serializer/Packager.py
https://github.com/knipknap/SpiffWorkflow/blob/f0af7f59a332e0619e4f3c00a7d4a3d230760e00/SpiffWorkflow/bpmn/serializer/Packager.py#L476-L487
def create_meta_data(cls, options, args, parser): """ Override in subclass if required. """ meta_data = [] meta_data.append(('spiff_version', cls.get_version())) if options.target_engine: meta_data.append(('target_engine', options.target_engine)) if op...
[ "def", "create_meta_data", "(", "cls", ",", "options", ",", "args", ",", "parser", ")", ":", "meta_data", "=", "[", "]", "meta_data", ".", "append", "(", "(", "'spiff_version'", ",", "cls", ".", "get_version", "(", ")", ")", ")", "if", "options", ".", ...
Override in subclass if required.
[ "Override", "in", "subclass", "if", "required", "." ]
python
valid
38.166667
saltstack/salt
salt/modules/debian_ip.py
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/debian_ip.py#L1748-L1775
def get_interface(iface): ''' Return the contents of an interface script CLI Example: .. code-block:: bash salt '*' ip.get_interface eth0 ''' adapters = _parse_interfaces() if iface in adapters: try: if iface == 'source': template = JINJA.get_t...
[ "def", "get_interface", "(", "iface", ")", ":", "adapters", "=", "_parse_interfaces", "(", ")", "if", "iface", "in", "adapters", ":", "try", ":", "if", "iface", "==", "'source'", ":", "template", "=", "JINJA", ".", "get_template", "(", "'debian_source.jinja'...
Return the contents of an interface script CLI Example: .. code-block:: bash salt '*' ip.get_interface eth0
[ "Return", "the", "contents", "of", "an", "interface", "script" ]
python
train
27.678571
dropbox/stone
stone/backends/js_helpers.py
https://github.com/dropbox/stone/blob/2e95cbcd1c48e05cca68c919fd8d24adec6b0f58/stone/backends/js_helpers.py#L73-L87
def fmt_type(data_type): """ Returns a JSDoc annotation for a data type. May contain a union of enumerated subtypes. """ if is_struct_type(data_type) and data_type.has_enumerated_subtypes(): possible_types = [] possible_subtypes = data_type.get_all_subtypes_with_tags() for _,...
[ "def", "fmt_type", "(", "data_type", ")", ":", "if", "is_struct_type", "(", "data_type", ")", "and", "data_type", ".", "has_enumerated_subtypes", "(", ")", ":", "possible_types", "=", "[", "]", "possible_subtypes", "=", "data_type", ".", "get_all_subtypes_with_tag...
Returns a JSDoc annotation for a data type. May contain a union of enumerated subtypes.
[ "Returns", "a", "JSDoc", "annotation", "for", "a", "data", "type", ".", "May", "contain", "a", "union", "of", "enumerated", "subtypes", "." ]
python
train
39.2
pyQode/pyqode.core
pyqode/core/dialogs/encodings.py
https://github.com/pyQode/pyqode.core/blob/a99ec6cd22d519394f613309412f8329dc4e90cb/pyqode/core/dialogs/encodings.py#L123-L137
def edit_encoding(cls, parent): """ Static helper method that shows the encoding editor dialog If the dialog was accepted the new encodings are added to the settings. :param parent: parent widget :return: True in case of succes, False otherwise """ dlg = cls(par...
[ "def", "edit_encoding", "(", "cls", ",", "parent", ")", ":", "dlg", "=", "cls", "(", "parent", ")", "if", "dlg", ".", "exec_", "(", ")", "==", "dlg", ".", "Accepted", ":", "settings", "=", "Cache", "(", ")", "settings", ".", "preferred_encodings", "=...
Static helper method that shows the encoding editor dialog If the dialog was accepted the new encodings are added to the settings. :param parent: parent widget :return: True in case of succes, False otherwise
[ "Static", "helper", "method", "that", "shows", "the", "encoding", "editor", "dialog", "If", "the", "dialog", "was", "accepted", "the", "new", "encodings", "are", "added", "to", "the", "settings", "." ]
python
train
33.266667
JNRowe/upoints
upoints/osm.py
https://github.com/JNRowe/upoints/blob/1e4b7a53ed2a06cd854523d54c36aabdccea3830/upoints/osm.py#L84-L113
def get_area_url(location, distance): """Generate URL for downloading OSM data within a region. This function defines a boundary box where the edges touch a circle of ``distance`` kilometres in radius. It is important to note that the box is neither a square, nor bounded within the circle. The bo...
[ "def", "get_area_url", "(", "location", ",", "distance", ")", ":", "locations", "=", "[", "location", ".", "destination", "(", "i", ",", "distance", ")", "for", "i", "in", "range", "(", "0", ",", "360", ",", "90", ")", "]", "latitudes", "=", "list", ...
Generate URL for downloading OSM data within a region. This function defines a boundary box where the edges touch a circle of ``distance`` kilometres in radius. It is important to note that the box is neither a square, nor bounded within the circle. The bounding box is strictly a trapezoid whose nort...
[ "Generate", "URL", "for", "downloading", "OSM", "data", "within", "a", "region", "." ]
python
train
45.666667
camsci/meteor-pi
src/pythonModules/meteorpi_db/meteorpi_db/exporter.py
https://github.com/camsci/meteor-pi/blob/7b01527650bd1b2b76d6f364e8122e25b8812c8d/src/pythonModules/meteorpi_db/meteorpi_db/exporter.py#L73-L125
def _handle_next_export_subtask(self, export_state=None): """ Process the next export sub-task, if there is one. :param ExportState export_state: If provided, this is used instead of the database queue, in effect directing the exporter to process the previous export agai...
[ "def", "_handle_next_export_subtask", "(", "self", ",", "export_state", "=", "None", ")", ":", "# Use a cached state, or generate a new one if required", "if", "export_state", "is", "None", "or", "export_state", ".", "export_task", "is", "None", ":", "export", "=", "s...
Process the next export sub-task, if there is one. :param ExportState export_state: If provided, this is used instead of the database queue, in effect directing the exporter to process the previous export again. This is used to avoid having to query the database when we know already wha...
[ "Process", "the", "next", "export", "sub", "-", "task", "if", "there", "is", "one", "." ]
python
train
50.490566
apple/turicreate
src/unity/python/turicreate/toolkits/image_classifier/image_classifier.py
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/image_classifier/image_classifier.py#L38-L307
def create(dataset, target, feature=None, model = 'resnet-50', l2_penalty=0.01, l1_penalty=0.0, solver='auto', feature_rescaling=True, convergence_threshold = _DEFAULT_SOLVER_OPTIONS['convergence_threshold'], step_size = _DEFAULT_SOLVER_OPTIONS['step_size'], lbfgs_memory_level = _DEFAULT_SOLVER...
[ "def", "create", "(", "dataset", ",", "target", ",", "feature", "=", "None", ",", "model", "=", "'resnet-50'", ",", "l2_penalty", "=", "0.01", ",", "l1_penalty", "=", "0.0", ",", "solver", "=", "'auto'", ",", "feature_rescaling", "=", "True", ",", "conve...
Create a :class:`ImageClassifier` model. Parameters ---------- dataset : SFrame Input data. The column named by the 'feature' parameter will be extracted for modeling. target : string, or int Name of the column containing the target variable. The values in this column m...
[ "Create", "a", ":", "class", ":", "ImageClassifier", "model", "." ]
python
train
46.374074
dead-beef/markovchain
markovchain/cli/util.py
https://github.com/dead-beef/markovchain/blob/9bd10b2f01089341c4a875a0fa569d50caba22c7/markovchain/cli/util.py#L242-L266
def check_output_format(fmt, nfiles): """Validate file format string. Parameters ---------- fmt : `str` File format string. nfiles : `int` Number of files. Raises ------ ValueError If nfiles < 0 or format string is invalid. """ if nfiles < 0: rai...
[ "def", "check_output_format", "(", "fmt", ",", "nfiles", ")", ":", "if", "nfiles", "<", "0", ":", "raise", "ValueError", "(", "'Invalid file count: '", "+", "str", "(", "nfiles", ")", ")", "if", "nfiles", "==", "1", ":", "return", "try", ":", "fmt", "%...
Validate file format string. Parameters ---------- fmt : `str` File format string. nfiles : `int` Number of files. Raises ------ ValueError If nfiles < 0 or format string is invalid.
[ "Validate", "file", "format", "string", "." ]
python
train
22.08
scott-maddox/openbandparams
src/openbandparams/iii_v_zinc_blende_quaternary.py
https://github.com/scott-maddox/openbandparams/blob/bc24e59187326bcb8948117434536082c9055777/src/openbandparams/iii_v_zinc_blende_quaternary.py#L168-L180
def _get_x(self, kwargs): ''' Returns x if it is explicitly defined in kwargs. Otherwise, raises TypeError. ''' if 'x' in kwargs: return round(float(kwargs['x']), 6) elif self._element_x in kwargs: return round(float(kwargs[self._element_x]), 6) ...
[ "def", "_get_x", "(", "self", ",", "kwargs", ")", ":", "if", "'x'", "in", "kwargs", ":", "return", "round", "(", "float", "(", "kwargs", "[", "'x'", "]", ")", ",", "6", ")", "elif", "self", ".", "_element_x", "in", "kwargs", ":", "return", "round",...
Returns x if it is explicitly defined in kwargs. Otherwise, raises TypeError.
[ "Returns", "x", "if", "it", "is", "explicitly", "defined", "in", "kwargs", ".", "Otherwise", "raises", "TypeError", "." ]
python
train
36.769231
CiscoUcs/UcsPythonSDK
src/UcsSdk/UcsBase.py
https://github.com/CiscoUcs/UcsPythonSDK/blob/bf6b07d6abeacb922c92b198352eda4eb9e4629b/src/UcsSdk/UcsBase.py#L534-L558
def GetUcsPropertyMetaAttributeList(classId): """ Methods returns the class meta. """ if classId in _ManagedObjectMeta: attrList = _ManagedObjectMeta[classId].keys() attrList.remove("Meta") return attrList if classId in _MethodFactoryMeta: attrList = _MethodFactoryMeta[classId].keys() attrList.remo...
[ "def", "GetUcsPropertyMetaAttributeList", "(", "classId", ")", ":", "if", "classId", "in", "_ManagedObjectMeta", ":", "attrList", "=", "_ManagedObjectMeta", "[", "classId", "]", ".", "keys", "(", ")", "attrList", ".", "remove", "(", "\"Meta\"", ")", "return", ...
Methods returns the class meta.
[ "Methods", "returns", "the", "class", "meta", "." ]
python
train
29
keon/algorithms
algorithms/iterables/convolved.py
https://github.com/keon/algorithms/blob/4d6569464a62a75c1357acc97e2dd32ee2f9f4a3/algorithms/iterables/convolved.py#L96-L104
def convolved_1d(iterable, kernel_size=1, stride=1, padding=0, default_value=None): """1D Iterable to get every convolution window per loop iteration. For more information, refer to: - https://github.com/guillaume-chevalier/python-conv-lib/blob/master/conv/conv.py - https://github.com/guillaume-chevali...
[ "def", "convolved_1d", "(", "iterable", ",", "kernel_size", "=", "1", ",", "stride", "=", "1", ",", "padding", "=", "0", ",", "default_value", "=", "None", ")", ":", "return", "convolved", "(", "iterable", ",", "kernel_size", ",", "stride", ",", "padding...
1D Iterable to get every convolution window per loop iteration. For more information, refer to: - https://github.com/guillaume-chevalier/python-conv-lib/blob/master/conv/conv.py - https://github.com/guillaume-chevalier/python-conv-lib - MIT License, Copyright (c) 2018 Guillaume Chevalier
[ "1D", "Iterable", "to", "get", "every", "convolution", "window", "per", "loop", "iteration", "." ]
python
train
52.444444
inasafe/inasafe
safe/gui/tools/help/dock_help.py
https://github.com/inasafe/inasafe/blob/831d60abba919f6d481dc94a8d988cc205130724/safe/gui/tools/help/dock_help.py#L51-L319
def content(): """Helper method that returns just the content. This method was added so that the text could be reused in the dock_help module. .. versionadded:: 3.2.2 :returns: A message object without brand element. :rtype: safe.messaging.message.Message """ message = m.Message() ...
[ "def", "content", "(", ")", ":", "message", "=", "m", ".", "Message", "(", ")", "paragraph", "=", "m", ".", "Paragraph", "(", "tr", "(", "'InaSAFE is free software that produces realistic natural hazard '", "'impact scenarios for better planning, preparedness and response '...
Helper method that returns just the content. This method was added so that the text could be reused in the dock_help module. .. versionadded:: 3.2.2 :returns: A message object without brand element. :rtype: safe.messaging.message.Message
[ "Helper", "method", "that", "returns", "just", "the", "content", "." ]
python
train
44.736059
fchorney/rpI2C
rpI2C.py
https://github.com/fchorney/rpI2C/blob/7c60f82fa8c91496a74182373da0b95a13919d6e/rpI2C.py#L75-L86
def write_block_data(self, cmd, block): """ Writes a block of bytes to the bus using I2C format to the specified command register """ self.bus.write_i2c_block_data(self.address, cmd, block) self.log.debug( "write_block_data: Wrote [%s] to command register 0x%0...
[ "def", "write_block_data", "(", "self", ",", "cmd", ",", "block", ")", ":", "self", ".", "bus", ".", "write_i2c_block_data", "(", "self", ".", "address", ",", "cmd", ",", "block", ")", "self", ".", "log", ".", "debug", "(", "\"write_block_data: Wrote [%s] ...
Writes a block of bytes to the bus using I2C format to the specified command register
[ "Writes", "a", "block", "of", "bytes", "to", "the", "bus", "using", "I2C", "format", "to", "the", "specified", "command", "register" ]
python
train
34.833333
ArchiveTeam/wpull
wpull/protocol/ftp/command.py
https://github.com/ArchiveTeam/wpull/blob/ddf051aa3322479325ba20aa778cb2cb97606bf5/wpull/protocol/ftp/command.py#L223-L232
def restart(self, offset: int): '''Send restart command. Coroutine. ''' yield from self._control_stream.write_command(Command('REST', str(offset))) reply = yield from self._control_stream.read_reply() self.raise_if_not_match('Restart', ReplyCodes.requested_file_action_...
[ "def", "restart", "(", "self", ",", "offset", ":", "int", ")", ":", "yield", "from", "self", ".", "_control_stream", ".", "write_command", "(", "Command", "(", "'REST'", ",", "str", "(", "offset", ")", ")", ")", "reply", "=", "yield", "from", "self", ...
Send restart command. Coroutine.
[ "Send", "restart", "command", "." ]
python
train
34.6
raymontag/kppy
kppy/database.py
https://github.com/raymontag/kppy/blob/a43f1fff7d49da1da4b3d8628a1b3ebbaf47f43a/kppy/database.py#L621-L652
def move_group_in_parent(self, group = None, index = None): """Move group to another position in group's parent. index must be a valid index of group.parent.groups """ if group is None or index is None: raise KPError("group and index must be set") e...
[ "def", "move_group_in_parent", "(", "self", ",", "group", "=", "None", ",", "index", "=", "None", ")", ":", "if", "group", "is", "None", "or", "index", "is", "None", ":", "raise", "KPError", "(", "\"group and index must be set\"", ")", "elif", "type", "(",...
Move group to another position in group's parent. index must be a valid index of group.parent.groups
[ "Move", "group", "to", "another", "position", "in", "group", "s", "parent", ".", "index", "must", "be", "a", "valid", "index", "of", "group", ".", "parent", ".", "groups" ]
python
train
45.03125
alerta/alerta
alerta/models/alert.py
https://github.com/alerta/alerta/blob/6478d6addc217c96a4a6688fab841035bef134e1/alerta/models/alert.py#L401-L406
def is_blackout(self) -> bool: """Does this alert match a blackout period?""" if not current_app.config['NOTIFICATION_BLACKOUT']: if self.severity in current_app.config['BLACKOUT_ACCEPT']: return False return db.is_blackout_period(self)
[ "def", "is_blackout", "(", "self", ")", "->", "bool", ":", "if", "not", "current_app", ".", "config", "[", "'NOTIFICATION_BLACKOUT'", "]", ":", "if", "self", ".", "severity", "in", "current_app", ".", "config", "[", "'BLACKOUT_ACCEPT'", "]", ":", "return", ...
Does this alert match a blackout period?
[ "Does", "this", "alert", "match", "a", "blackout", "period?" ]
python
train
47.166667
cloudendpoints/endpoints-management-python
endpoints_management/auth/tokens.py
https://github.com/cloudendpoints/endpoints-management-python/blob/ec3c4a330ae9d65738861ce6df4dd6c3cb9f7731/endpoints_management/auth/tokens.py#L54-L100
def authenticate(self, auth_token, auth_info, service_name): """Authenticates the current auth token. Args: auth_token: the auth token. auth_info: the auth configurations of the API method being called. service_name: the name of this service. Returns: A ...
[ "def", "authenticate", "(", "self", ",", "auth_token", ",", "auth_info", ",", "service_name", ")", ":", "try", ":", "jwt_claims", "=", "self", ".", "get_jwt_claims", "(", "auth_token", ")", "except", "Exception", "as", "error", ":", "raise", "suppliers", "."...
Authenticates the current auth token. Args: auth_token: the auth token. auth_info: the auth configurations of the API method being called. service_name: the name of this service. Returns: A constructed UserInfo object representing the identity of the caller. ...
[ "Authenticates", "the", "current", "auth", "token", "." ]
python
train
42.319149
DeepHorizons/iarm
iarm/arm_instructions/conditional_branch.py
https://github.com/DeepHorizons/iarm/blob/b913c9fd577b793a6bbced78b78a5d8d7cd88de4/iarm/arm_instructions/conditional_branch.py#L124-L139
def BLE(self, params): """ BLE label Branch to the instruction at label if the Z flag is set or if the N flag is not the same as the V flag """ label = self.get_one_parameter(self.ONE_PARAMETER, params) self.check_arguments(label_exists=(label,)) # BLE label ...
[ "def", "BLE", "(", "self", ",", "params", ")", ":", "label", "=", "self", ".", "get_one_parameter", "(", "self", ".", "ONE_PARAMETER", ",", "params", ")", "self", ".", "check_arguments", "(", "label_exists", "=", "(", "label", ",", ")", ")", "# BLE label...
BLE label Branch to the instruction at label if the Z flag is set or if the N flag is not the same as the V flag
[ "BLE", "label" ]
python
train
30
cloud9ers/gurumate
environment/lib/python2.7/site-packages/IPython/core/magic.py
https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/core/magic.py#L216-L269
def _function_magic_marker(magic_kind): """Decorator factory for standalone functions. """ validate_type(magic_kind) # This is a closure to capture the magic_kind. We could also use a class, # but it's overkill for just that one bit of state. def magic_deco(arg): call = lambda f, *...
[ "def", "_function_magic_marker", "(", "magic_kind", ")", ":", "validate_type", "(", "magic_kind", ")", "# This is a closure to capture the magic_kind. We could also use a class,", "# but it's overkill for just that one bit of state.", "def", "magic_deco", "(", "arg", ")", ":", "...
Decorator factory for standalone functions.
[ "Decorator", "factory", "for", "standalone", "functions", "." ]
python
test
38.537037
mathandy/svgpathtools
svgpathtools/document.py
https://github.com/mathandy/svgpathtools/blob/fd7348a1dfd88b65ea61da02325c6605aedf8c4f/svgpathtools/document.py#L150-L181
def flatten_group(group_to_flatten, root, recursive=True, group_filter=lambda x: True, path_filter=lambda x: True, path_conversions=CONVERSIONS, group_search_xpath=SVG_GROUP_TAG): """Flatten all the paths in a specific group. The paths will be flattened int...
[ "def", "flatten_group", "(", "group_to_flatten", ",", "root", ",", "recursive", "=", "True", ",", "group_filter", "=", "lambda", "x", ":", "True", ",", "path_filter", "=", "lambda", "x", ":", "True", ",", "path_conversions", "=", "CONVERSIONS", ",", "group_s...
Flatten all the paths in a specific group. The paths will be flattened into the 'root' frame. Note that root needs to be an ancestor of the group that is being flattened. Otherwise, no paths will be returned.
[ "Flatten", "all", "the", "paths", "in", "a", "specific", "group", "." ]
python
train
42.78125
tonybaloney/retox
retox/ui.py
https://github.com/tonybaloney/retox/blob/4635e31001d2ac083423f46766249ac8daca7c9c/retox/ui.py#L54-L60
def refresh(self): ''' Refresh the list and the screen ''' self._screen.force_update() self._screen.refresh() self._update(1)
[ "def", "refresh", "(", "self", ")", ":", "self", ".", "_screen", ".", "force_update", "(", ")", "self", ".", "_screen", ".", "refresh", "(", ")", "self", ".", "_update", "(", "1", ")" ]
Refresh the list and the screen
[ "Refresh", "the", "list", "and", "the", "screen" ]
python
train
23.857143
saltstack/salt
salt/modules/eselect.py
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/eselect.py#L124-L156
def get_current_target(module, module_parameter=None, action_parameter=None): ''' Get the currently selected target for the given module. module name of the module to be queried for its current target module_parameter additional params passed to the defined module action_parameter...
[ "def", "get_current_target", "(", "module", ",", "module_parameter", "=", "None", ",", "action_parameter", "=", "None", ")", ":", "result", "=", "exec_action", "(", "module", ",", "'show'", ",", "module_parameter", "=", "module_parameter", ",", "action_parameter",...
Get the currently selected target for the given module. module name of the module to be queried for its current target module_parameter additional params passed to the defined module action_parameter additional params passed to the 'show' action CLI Example (current target of...
[ "Get", "the", "currently", "selected", "target", "for", "the", "given", "module", "." ]
python
train
26.454545
googleapis/google-cloud-python
logging/google/cloud/logging/_gapic.py
https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/logging/google/cloud/logging/_gapic.py#L106-L132
def write_entries(self, entries, logger_name=None, resource=None, labels=None): """API call: log an entry resource via a POST request :type entries: sequence of mapping :param entries: the log entry resources to log. :type logger_name: str :param logger_name: name of default l...
[ "def", "write_entries", "(", "self", ",", "entries", ",", "logger_name", "=", "None", ",", "resource", "=", "None", ",", "labels", "=", "None", ")", ":", "partial_success", "=", "False", "entry_pbs", "=", "[", "_log_entry_mapping_to_pb", "(", "entry", ")", ...
API call: log an entry resource via a POST request :type entries: sequence of mapping :param entries: the log entry resources to log. :type logger_name: str :param logger_name: name of default logger to which to log the entries; individual entries may overr...
[ "API", "call", ":", "log", "an", "entry", "resource", "via", "a", "POST", "request" ]
python
train
38.259259
kolypto/py-good
good/validators/dates.py
https://github.com/kolypto/py-good/blob/192ef19e79f6fd95c1cbd7c378a3074c7ad7a6d4/good/validators/dates.py#L215-L232
def preprocess(self, dt): """ Preprocess the `dt` with `localize()` and `astz()` """ # Process try: # this block should not raise errors, and if it does -- they should not be wrapped with `Invalid` # localize if self.localize and dt.tzinfo is None: dt = s...
[ "def", "preprocess", "(", "self", ",", "dt", ")", ":", "# Process", "try", ":", "# this block should not raise errors, and if it does -- they should not be wrapped with `Invalid`", "# localize", "if", "self", ".", "localize", "and", "dt", ".", "tzinfo", "is", "None", ":...
Preprocess the `dt` with `localize()` and `astz()`
[ "Preprocess", "the", "dt", "with", "localize", "()", "and", "astz", "()" ]
python
train
33.833333
googlefonts/fontbakery
Lib/fontbakery/profiles/googlefonts.py
https://github.com/googlefonts/fontbakery/blob/b355aea2e619a4477769e060d24c32448aa65399/Lib/fontbakery/profiles/googlefonts.py#L2391-L2428
def remote_styles(family_metadata): """Get a dictionary of TTFont objects of all font files of a given family as currently hosted at Google Fonts. """ def download_family_from_Google_Fonts(family_name): """Return a zipfile containing a font family hosted on fonts.google.com""" from zipfile import Zi...
[ "def", "remote_styles", "(", "family_metadata", ")", ":", "def", "download_family_from_Google_Fonts", "(", "family_name", ")", ":", "\"\"\"Return a zipfile containing a font family hosted on fonts.google.com\"\"\"", "from", "zipfile", "import", "ZipFile", "from", "fontbakery", ...
Get a dictionary of TTFont objects of all font files of a given family as currently hosted at Google Fonts.
[ "Get", "a", "dictionary", "of", "TTFont", "objects", "of", "all", "font", "files", "of", "a", "given", "family", "as", "currently", "hosted", "at", "Google", "Fonts", "." ]
python
train
34.894737
fastai/fastai
old/fastai/dataset.py
https://github.com/fastai/fastai/blob/9fb84a5cdefe5a766cdb792b8f5d8971737b7e67/old/fastai/dataset.py#L13-L29
def get_cv_idxs(n, cv_idx=0, val_pct=0.2, seed=42): """ Get a list of index values for Validation set from a dataset Arguments: n : int, Total number of elements in the data set. cv_idx : int, starting index [idx_start = cv_idx*int(val_pct*n)] val_pct : (int, float), validation set...
[ "def", "get_cv_idxs", "(", "n", ",", "cv_idx", "=", "0", ",", "val_pct", "=", "0.2", ",", "seed", "=", "42", ")", ":", "np", ".", "random", ".", "seed", "(", "seed", ")", "n_val", "=", "int", "(", "val_pct", "*", "n", ")", "idx_start", "=", "cv...
Get a list of index values for Validation set from a dataset Arguments: n : int, Total number of elements in the data set. cv_idx : int, starting index [idx_start = cv_idx*int(val_pct*n)] val_pct : (int, float), validation set percentage seed : seed value for RandomState ...
[ "Get", "a", "list", "of", "index", "values", "for", "Validation", "set", "from", "a", "dataset", "Arguments", ":", "n", ":", "int", "Total", "number", "of", "elements", "in", "the", "data", "set", ".", "cv_idx", ":", "int", "starting", "index", "[", "i...
python
train
33.705882
acutesoftware/virtual-AI-simulator
vais/world_generator.py
https://github.com/acutesoftware/virtual-AI-simulator/blob/57de679a5b1a58c38fefe6aea58af1f3a7e79c58/vais/world_generator.py#L15-L31
def main(): """ generates a random world, sets terrain and runs agents in it TODO - need to change pieces in multiple places (see worlds.py, cls_grid, world_generator) (takes about 5 minutes to make 500x400 grid with 8% blockages) """ width = 20 # grid width height = 10 #...
[ "def", "main", "(", ")", ":", "width", "=", "20", "# grid width ", "height", "=", "10", "# grid height", "iterations", "=", "20", "# how many simulations to run", "num_agents", "=", "6", "# number of agents to enter the world", "w", "=", "build_world", "(", "height"...
generates a random world, sets terrain and runs agents in it TODO - need to change pieces in multiple places (see worlds.py, cls_grid, world_generator) (takes about 5 minutes to make 500x400 grid with 8% blockages)
[ "generates", "a", "random", "world", "sets", "terrain", "and", "runs", "agents", "in", "it", "TODO", "-", "need", "to", "change", "pieces", "in", "multiple", "places", "(", "see", "worlds", ".", "py", "cls_grid", "world_generator", ")", "(", "takes", "abou...
python
train
40.352941
googlefonts/fontbakery
Lib/fontbakery/profiles/googlefonts.py
https://github.com/googlefonts/fontbakery/blob/b355aea2e619a4477769e060d24c32448aa65399/Lib/fontbakery/profiles/googlefonts.py#L1566-L1576
def com_google_fonts_check_metadata_regular_is_400(family_metadata): """METADATA.pb: Regular should be 400.""" badfonts = [] for f in family_metadata.fonts: if f.full_name.endswith("Regular") and f.weight != 400: badfonts.append(f"{f.filename} (weight: {f.weight})") if len(badfonts) > 0: yield FAI...
[ "def", "com_google_fonts_check_metadata_regular_is_400", "(", "family_metadata", ")", ":", "badfonts", "=", "[", "]", "for", "f", "in", "family_metadata", ".", "fonts", ":", "if", "f", ".", "full_name", ".", "endswith", "(", "\"Regular\"", ")", "and", "f", "."...
METADATA.pb: Regular should be 400.
[ "METADATA", ".", "pb", ":", "Regular", "should", "be", "400", "." ]
python
train
43.909091
thespacedoctor/sherlock
sherlock/transient_catalogue_crossmatch.py
https://github.com/thespacedoctor/sherlock/blob/2c80fb6fa31b04e7820e6928e3d437a21e692dd3/sherlock/transient_catalogue_crossmatch.py#L667-L714
def _galaxy_association_cuts( self, matchedObjects, catalogueName, magnitudeLimitFilter, upperMagnitudeLimit, lowerMagnitudeLimit): """*perform a bright star match on the crossmatch results if required by the catalogue search* **Ke...
[ "def", "_galaxy_association_cuts", "(", "self", ",", "matchedObjects", ",", "catalogueName", ",", "magnitudeLimitFilter", ",", "upperMagnitudeLimit", ",", "lowerMagnitudeLimit", ")", ":", "self", ".", "log", ".", "debug", "(", "'starting the ``_galaxy_association_cuts`` m...
*perform a bright star match on the crossmatch results if required by the catalogue search* **Key Arguments:** - ``matchedObjects`` -- the list of matched sources from the catalogue crossmatch - ``catalogueName`` -- the name of the catalogue the crossmatch results from - ``m...
[ "*", "perform", "a", "bright", "star", "match", "on", "the", "crossmatch", "results", "if", "required", "by", "the", "catalogue", "search", "*" ]
python
train
45.4375
nugget/python-insteonplm
insteonplm/tools.py
https://github.com/nugget/python-insteonplm/blob/65548041f1b0729ae1ae904443dd81b0c6cbf1bf/insteonplm/tools.py#L905-L927
def do_help(self, arg): """Help command. Usage: help [command] Parameters: command: Optional - command name to display detailed help """ cmds = arg.split() if cmds: func = getattr(self, 'do_{}'.format(cmds[0])) if func: ...
[ "def", "do_help", "(", "self", ",", "arg", ")", ":", "cmds", "=", "arg", ".", "split", "(", ")", "if", "cmds", ":", "func", "=", "getattr", "(", "self", ",", "'do_{}'", ".", "format", "(", "cmds", "[", "0", "]", ")", ")", "if", "func", ":", "...
Help command. Usage: help [command] Parameters: command: Optional - command name to display detailed help
[ "Help", "command", "." ]
python
train
32
cognitect/transit-python
transit/sosjson.py
https://github.com/cognitect/transit-python/blob/59e27e7d322feaa3a7e8eb3de06ae96d8adb614f/transit/sosjson.py#L25-L39
def read_chunk(stream): """Ignore whitespace outside of strings. If we hit a string, read it in its entirety. """ chunk = stream.read(1) while chunk in SKIP: chunk = stream.read(1) if chunk == "\"": chunk += stream.read(1) while not chunk.endswith("\""): if ch...
[ "def", "read_chunk", "(", "stream", ")", ":", "chunk", "=", "stream", ".", "read", "(", "1", ")", "while", "chunk", "in", "SKIP", ":", "chunk", "=", "stream", ".", "read", "(", "1", ")", "if", "chunk", "==", "\"\\\"\"", ":", "chunk", "+=", "stream"...
Ignore whitespace outside of strings. If we hit a string, read it in its entirety.
[ "Ignore", "whitespace", "outside", "of", "strings", ".", "If", "we", "hit", "a", "string", "read", "it", "in", "its", "entirety", "." ]
python
train
29.266667
pandas-dev/pandas
pandas/core/strings.py
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/strings.py#L735-L759
def _str_extract_frame(arr, pat, flags=0): """ For each subject string in the Series, extract groups from the first match of regular expression pat. This function is called from str_extract(expand=True), and always returns a DataFrame. """ from pandas import DataFrame regex = re.compile(pa...
[ "def", "_str_extract_frame", "(", "arr", ",", "pat", ",", "flags", "=", "0", ")", ":", "from", "pandas", "import", "DataFrame", "regex", "=", "re", ".", "compile", "(", "pat", ",", "flags", "=", "flags", ")", "groups_or_na", "=", "_groups_or_na_fun", "("...
For each subject string in the Series, extract groups from the first match of regular expression pat. This function is called from str_extract(expand=True), and always returns a DataFrame.
[ "For", "each", "subject", "string", "in", "the", "Series", "extract", "groups", "from", "the", "first", "match", "of", "regular", "expression", "pat", ".", "This", "function", "is", "called", "from", "str_extract", "(", "expand", "=", "True", ")", "and", "...
python
train
32.44
log2timeline/plaso
plaso/storage/sqlite/sqlite_file.py
https://github.com/log2timeline/plaso/blob/9c564698d2da3ffbe23607a3c54c0582ea18a6cc/plaso/storage/sqlite/sqlite_file.py#L390-L402
def _HasTable(self, table_name): """Determines if a specific table exists. Args: table_name (str): name of the table. Returns: bool: True if the table exists, false otherwise. """ query = self._HAS_TABLE_QUERY.format(table_name) self._cursor.execute(query) return bool(self._cu...
[ "def", "_HasTable", "(", "self", ",", "table_name", ")", ":", "query", "=", "self", ".", "_HAS_TABLE_QUERY", ".", "format", "(", "table_name", ")", "self", ".", "_cursor", ".", "execute", "(", "query", ")", "return", "bool", "(", "self", ".", "_cursor", ...
Determines if a specific table exists. Args: table_name (str): name of the table. Returns: bool: True if the table exists, false otherwise.
[ "Determines", "if", "a", "specific", "table", "exists", "." ]
python
train
24.923077
mjirik/imtools
imtools/surface_measurement.py
https://github.com/mjirik/imtools/blob/eb29fa59df0e0684d8334eb3bc5ef36ea46d1d3a/imtools/surface_measurement.py#L24-L72
def surface_density(segmentation, voxelsize_mm, aoi=None, sond_raster_mm=None): """ :segmentation: is ndarray with 0 and 1 :voxelsize_mm: is array of three numbers specifiing size of voxel for each axis :aoi: is specify area of interest. It is ndarray with 0 and 1 :sond_raster_mm: unimplemen...
[ "def", "surface_density", "(", "segmentation", ",", "voxelsize_mm", ",", "aoi", "=", "None", ",", "sond_raster_mm", "=", "None", ")", ":", "axis", "=", "0", "if", "sond_raster_mm", "is", "None", ":", "sond_raster_mm", "=", "voxelsize_mm", "if", "aoi", "is", ...
:segmentation: is ndarray with 0 and 1 :voxelsize_mm: is array of three numbers specifiing size of voxel for each axis :aoi: is specify area of interest. It is ndarray with 0 and 1 :sond_raster_mm: unimplemented. It is parametr of sonds design
[ ":", "segmentation", ":", "is", "ndarray", "with", "0", "and", "1", ":", "voxelsize_mm", ":", "is", "array", "of", "three", "numbers", "specifiing", "size", "of", "voxel", "for", "each", "axis", ":", "aoi", ":", "is", "specify", "area", "of", "interest",...
python
train
29.857143
rwl/pylon
pylon/io/psse.py
https://github.com/rwl/pylon/blob/916514255db1ae1661406f0283df756baf960d14/pylon/io/psse.py#L400-L443
def write_bus_data(self, file): """ Writes bus data in MATPOWER format. """ # I, 'NAME', BASKV, IDE, GL, BL, AREA, ZONE, VM, VA, OWNER bus_attrs = ["_i", "name", "v_base", "type", "g_shunt", "b_shunt", "area", "zone", "v_magnitude", "v_angl...
[ "def", "write_bus_data", "(", "self", ",", "file", ")", ":", "# I, 'NAME', BASKV, IDE, GL, BL, AREA, ZONE, VM, VA, OWNER\r", "bus_attrs", "=", "[", "\"_i\"", ",", "\"name\"", ",", "\"v_base\"", ",", "\"type\"", ",", "\"g_shunt\"", ",", "\"b_shunt\"", ",", "\"area\"", ...
Writes bus data in MATPOWER format.
[ "Writes", "bus", "data", "in", "MATPOWER", "format", "." ]
python
train
40.477273
calmjs/calmjs
src/calmjs/artifact.py
https://github.com/calmjs/calmjs/blob/b9b407c2b6a7662da64bccba93bb8d92e7a5fafd/src/calmjs/artifact.py#L197-L214
def trace_toolchain(toolchain): """ Trace the versions of the involved packages for the provided toolchain instance. """ pkgs = [] for cls in getmro(type(toolchain)): if not issubclass(cls, Toolchain): continue dist = _cls_lookup_dist(cls) value = { ...
[ "def", "trace_toolchain", "(", "toolchain", ")", ":", "pkgs", "=", "[", "]", "for", "cls", "in", "getmro", "(", "type", "(", "toolchain", ")", ")", ":", "if", "not", "issubclass", "(", "cls", ",", "Toolchain", ")", ":", "continue", "dist", "=", "_cls...
Trace the versions of the involved packages for the provided toolchain instance.
[ "Trace", "the", "versions", "of", "the", "involved", "packages", "for", "the", "provided", "toolchain", "instance", "." ]
python
train
28.222222
facelessuser/backrefs
backrefs/bregex.py
https://github.com/facelessuser/backrefs/blob/3b3d60f5d57b02044f880aa29c9c5add0e31a34f/backrefs/bregex.py#L327-L330
def fullmatch(self, string, *args, **kwargs): """Apply `fullmatch`.""" return self._pattern.fullmatch(string, *args, **kwargs)
[ "def", "fullmatch", "(", "self", ",", "string", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "return", "self", ".", "_pattern", ".", "fullmatch", "(", "string", ",", "*", "args", ",", "*", "*", "kwargs", ")" ]
Apply `fullmatch`.
[ "Apply", "fullmatch", "." ]
python
train
35
mandiant/ioc_writer
ioc_writer/managers/downgrade_11.py
https://github.com/mandiant/ioc_writer/blob/712247f3a10bdc2584fa18ac909fc763f71df21a/ioc_writer/managers/downgrade_11.py#L293-L330
def write_iocs(self, directory=None, source=None): """ Serializes IOCs to a directory. :param directory: Directory to write IOCs to. If not provided, the current working directory is used. :param source: Dictionary contianing iocid -> IOC mapping. Defaults to self.iocs_10. This is not...
[ "def", "write_iocs", "(", "self", ",", "directory", "=", "None", ",", "source", "=", "None", ")", ":", "\"\"\"\n\n\n if directory is None, write the iocs to the current working directory\n source: allows specifying a different dictionry of elmentTree ioc objects\n \"...
Serializes IOCs to a directory. :param directory: Directory to write IOCs to. If not provided, the current working directory is used. :param source: Dictionary contianing iocid -> IOC mapping. Defaults to self.iocs_10. This is not normally modifed by a user for this class. :return:
[ "Serializes", "IOCs", "to", "a", "directory", "." ]
python
train
40.657895
dixudx/rtcclient
rtcclient/project_area.py
https://github.com/dixudx/rtcclient/blob/1721dd0b047478f5bdd6359b07a2c503cfafd86f/rtcclient/project_area.py#L231-L261
def getAdministrator(self, email, returned_properties=None): """Get the :class:`rtcclient.models.Administrator` object by the email address :param email: the email address (e.g. somebody@gmail.com) :param returned_properties: the returned properties that you want. Refer to :...
[ "def", "getAdministrator", "(", "self", ",", "email", ",", "returned_properties", "=", "None", ")", ":", "if", "not", "isinstance", "(", "email", ",", "six", ".", "string_types", ")", "or", "\"@\"", "not", "in", "email", ":", "excp_msg", "=", "\"Please spe...
Get the :class:`rtcclient.models.Administrator` object by the email address :param email: the email address (e.g. somebody@gmail.com) :param returned_properties: the returned properties that you want. Refer to :class:`rtcclient.client.RTCClient` for more explanations :return...
[ "Get", "the", ":", "class", ":", "rtcclient", ".", "models", ".", "Administrator", "object", "by", "the", "email", "address" ]
python
train
45.870968
amperser/proselint
proselint/checks/redundancy/misc.py
https://github.com/amperser/proselint/blob/cb619ee4023cc7856f5fb96aec2a33a2c9f1a2e2/proselint/checks/redundancy/misc.py#L9-L18
def check(text): """Suggest the preferred forms.""" err = "redundancy.wallace" msg = "Redundancy. Use '{}' instead of '{}'." redundancies = [ ["rectangular", ["rectangular in shape"]], ["audible", ["audible to the ear"]], ] return preferred_forms_check(text, re...
[ "def", "check", "(", "text", ")", ":", "err", "=", "\"redundancy.wallace\"", "msg", "=", "\"Redundancy. Use '{}' instead of '{}'.\"", "redundancies", "=", "[", "[", "\"rectangular\"", ",", "[", "\"rectangular in shape\"", "]", "]", ",", "[", "\"audible\"", ",", "[...
Suggest the preferred forms.
[ "Suggest", "the", "preferred", "forms", "." ]
python
train
33.2
CalebBell/fluids
fluids/two_phase.py
https://github.com/CalebBell/fluids/blob/57f556752e039f1d3e5a822f408c184783db2828/fluids/two_phase.py#L204-L324
def Friedel(m, x, rhol, rhog, mul, mug, sigma, D, roughness=0, L=1): r'''Calculates two-phase pressure drop with the Friedel correlation. .. math:: \Delta P_{friction} = \Delta P_{lo} \phi_{lo}^2 .. math:: \phi_{lo}^2 = E + \frac{3.24FH}{Fr^{0.0454} We^{0.035}} .. math:: H = \...
[ "def", "Friedel", "(", "m", ",", "x", ",", "rhol", ",", "rhog", ",", "mul", ",", "mug", ",", "sigma", ",", "D", ",", "roughness", "=", "0", ",", "L", "=", "1", ")", ":", "# Liquid-only properties, for calculation of E, dP_lo", "v_lo", "=", "m", "/", ...
r'''Calculates two-phase pressure drop with the Friedel correlation. .. math:: \Delta P_{friction} = \Delta P_{lo} \phi_{lo}^2 .. math:: \phi_{lo}^2 = E + \frac{3.24FH}{Fr^{0.0454} We^{0.035}} .. math:: H = \left(\frac{\rho_l}{\rho_g}\right)^{0.91}\left(\frac{\mu_g}{\mu_l} ...
[ "r", "Calculates", "two", "-", "phase", "pressure", "drop", "with", "the", "Friedel", "correlation", "." ]
python
train
35.710744
refenv/cijoe
modules/cij/fio.py
https://github.com/refenv/cijoe/blob/21d7b2ed4ff68e0a1457e7df2db27f6334f1a379/modules/cij/fio.py#L90-L94
def import_parms(self, args): """Import external dict to internal dict""" for key, val in args.items(): self.set_parm(key, val)
[ "def", "import_parms", "(", "self", ",", "args", ")", ":", "for", "key", ",", "val", "in", "args", ".", "items", "(", ")", ":", "self", ".", "set_parm", "(", "key", ",", "val", ")" ]
Import external dict to internal dict
[ "Import", "external", "dict", "to", "internal", "dict" ]
python
valid
30.4
saltstack/salt
salt/utils/process.py
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/process.py#L63-L110
def daemonize(redirect_out=True): ''' Daemonize a process ''' # Avoid circular import import salt.utils.crypt try: pid = os.fork() if pid > 0: # exit first parent salt.utils.crypt.reinit_crypto() os._exit(salt.defaults.exitcodes.EX_OK) exce...
[ "def", "daemonize", "(", "redirect_out", "=", "True", ")", ":", "# Avoid circular import", "import", "salt", ".", "utils", ".", "crypt", "try", ":", "pid", "=", "os", ".", "fork", "(", ")", "if", "pid", ">", "0", ":", "# exit first parent", "salt", ".", ...
Daemonize a process
[ "Daemonize", "a", "process" ]
python
train
35.375
vallis/libstempo
libstempo/utils.py
https://github.com/vallis/libstempo/blob/0b19300a9b24d64c9ddc25cd6ddbfd12b6231990/libstempo/utils.py#L77-L86
def powerlaw(f, log10_A=-16, gamma=5): """Power-law PSD. :param f: Sampling frequencies :param log10_A: log10 of red noise Amplitude [GW units] :param gamma: Spectral index of red noise process """ fyr = 1 / 3.16e7 return (10**log10_A)**2 / 12.0 / np.pi**2 * fyr**(gamma-3) * f**(-gamma)
[ "def", "powerlaw", "(", "f", ",", "log10_A", "=", "-", "16", ",", "gamma", "=", "5", ")", ":", "fyr", "=", "1", "/", "3.16e7", "return", "(", "10", "**", "log10_A", ")", "**", "2", "/", "12.0", "/", "np", ".", "pi", "**", "2", "*", "fyr", "...
Power-law PSD. :param f: Sampling frequencies :param log10_A: log10 of red noise Amplitude [GW units] :param gamma: Spectral index of red noise process
[ "Power", "-", "law", "PSD", "." ]
python
train
30.8
quantmind/ccy
ccy/core/currency.py
https://github.com/quantmind/ccy/blob/068cf6887489087cd26657a937a932e82106b47f/ccy/core/currency.py#L169-L176
def over(self, name='usd'): '''Returns a new currency pair with the *over* currency as second part of the pair (Foreign currency).''' name = name.upper() if self.ccy1.code == name.upper(): return ccy_pair(self.ccy2, self.ccy1) else: return self
[ "def", "over", "(", "self", ",", "name", "=", "'usd'", ")", ":", "name", "=", "name", ".", "upper", "(", ")", "if", "self", ".", "ccy1", ".", "code", "==", "name", ".", "upper", "(", ")", ":", "return", "ccy_pair", "(", "self", ".", "ccy2", ","...
Returns a new currency pair with the *over* currency as second part of the pair (Foreign currency).
[ "Returns", "a", "new", "currency", "pair", "with", "the", "*", "over", "*", "currency", "as", "second", "part", "of", "the", "pair", "(", "Foreign", "currency", ")", "." ]
python
train
37.625
cloudera/cm_api
python/examples/bulk_config_update.py
https://github.com/cloudera/cm_api/blob/5d2512375bd94684b4da36df9e0d9177865ffcbb/python/examples/bulk_config_update.py#L140-L168
def configure_roles_on_host(api, host): """ Go through all the roles on this host, and configure them if they match the role types that we care about. """ for role_ref in host.roleRefs: # Mgmt service/role has no cluster name. Skip over those. if role_ref.get('clusterName') is None: continue ...
[ "def", "configure_roles_on_host", "(", "api", ",", "host", ")", ":", "for", "role_ref", "in", "host", ".", "roleRefs", ":", "# Mgmt service/role has no cluster name. Skip over those.", "if", "role_ref", ".", "get", "(", "'clusterName'", ")", "is", "None", ":", "co...
Go through all the roles on this host, and configure them if they match the role types that we care about.
[ "Go", "through", "all", "the", "roles", "on", "this", "host", "and", "configure", "them", "if", "they", "match", "the", "role", "types", "that", "we", "care", "about", "." ]
python
train
31.517241
SKA-ScienceDataProcessor/integration-prototype
sip/examples/flask_processing_controller/app/api/subarray.py
https://github.com/SKA-ScienceDataProcessor/integration-prototype/blob/8c8006de6ad71dcd44114b0338780738079c87d4/sip/examples/flask_processing_controller/app/api/subarray.py#L20-L52
def get(sub_array_id): """Sub array detail resource. This method will list scheduling blocks and processing blocks in the specified sub-array. """ if not re.match(r'^subarray-0[0-9]|subarray-1[0-5]$', sub_array_id): response = dict(error='Invalid sub-array ID specified "{}" does not ' ...
[ "def", "get", "(", "sub_array_id", ")", ":", "if", "not", "re", ".", "match", "(", "r'^subarray-0[0-9]|subarray-1[0-5]$'", ",", "sub_array_id", ")", ":", "response", "=", "dict", "(", "error", "=", "'Invalid sub-array ID specified \"{}\" does not '", "'match sub-array...
Sub array detail resource. This method will list scheduling blocks and processing blocks in the specified sub-array.
[ "Sub", "array", "detail", "resource", "." ]
python
train
41.151515
Pegase745/sqlalchemy-datatables
datatables/datatables.py
https://github.com/Pegase745/sqlalchemy-datatables/blob/049ab5f98f20ad37926fe86d5528da0c91cd462d/datatables/datatables.py#L89-L133
def run(self): """Launch filtering, sorting and paging to output results.""" query = self.query # count before filtering self.cardinality = query.add_columns(self.columns[0].sqla_expr).count() self._set_column_filter_expressions() self._set_global_filter_expression() ...
[ "def", "run", "(", "self", ")", ":", "query", "=", "self", ".", "query", "# count before filtering", "self", ".", "cardinality", "=", "query", ".", "add_columns", "(", "self", ".", "columns", "[", "0", "]", ".", "sqla_expr", ")", ".", "count", "(", ")"...
Launch filtering, sorting and paging to output results.
[ "Launch", "filtering", "sorting", "and", "paging", "to", "output", "results", "." ]
python
train
32.777778
Qiskit/qiskit-terra
qiskit/visualization/bloch.py
https://github.com/Qiskit/qiskit-terra/blob/d4f58d903bc96341b816f7c35df936d6421267d1/qiskit/visualization/bloch.py#L295-L301
def clear(self): """Resets Bloch sphere data sets to empty. """ self.points = [] self.vectors = [] self.point_style = [] self.annotations = []
[ "def", "clear", "(", "self", ")", ":", "self", ".", "points", "=", "[", "]", "self", ".", "vectors", "=", "[", "]", "self", ".", "point_style", "=", "[", "]", "self", ".", "annotations", "=", "[", "]" ]
Resets Bloch sphere data sets to empty.
[ "Resets", "Bloch", "sphere", "data", "sets", "to", "empty", "." ]
python
test
26.285714
spyder-ide/spyder
spyder/plugins/editor/widgets/autosaveerror.py
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/editor/widgets/autosaveerror.py#L78-L85
def accept(self): """ Update `show_errors` and hide dialog box. Overrides method of `QDialogBox`. """ AutosaveErrorDialog.show_errors = not self.dismiss_box.isChecked() return QDialog.accept(self)
[ "def", "accept", "(", "self", ")", ":", "AutosaveErrorDialog", ".", "show_errors", "=", "not", "self", ".", "dismiss_box", ".", "isChecked", "(", ")", "return", "QDialog", ".", "accept", "(", "self", ")" ]
Update `show_errors` and hide dialog box. Overrides method of `QDialogBox`.
[ "Update", "show_errors", "and", "hide", "dialog", "box", "." ]
python
train
29.75
saltstack/salt
salt/states/boto_ec2.py
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/boto_ec2.py#L168-L393
def eni_present( name, subnet_id=None, subnet_name=None, private_ip_address=None, description=None, groups=None, source_dest_check=True, allocate_eip=None, arecords=None, region=None, key=None, keyid=None, profile=No...
[ "def", "eni_present", "(", "name", ",", "subnet_id", "=", "None", ",", "subnet_name", "=", "None", ",", "private_ip_address", "=", "None", ",", "description", "=", "None", ",", "groups", "=", "None", ",", "source_dest_check", "=", "True", ",", "allocate_eip"...
Ensure the EC2 ENI exists. .. versionadded:: 2016.3.0 name Name tag associated with the ENI. subnet_id The VPC subnet ID the ENI will exist within. subnet_name The VPC subnet name the ENI will exist within. private_ip_address The private ip address to use for thi...
[ "Ensure", "the", "EC2", "ENI", "exists", "." ]
python
train
44.59292
SheffieldML/GPy
GPy/util/mocap.py
https://github.com/SheffieldML/GPy/blob/54c32d79d289d622fb18b898aee65a2a431d90cf/GPy/util/mocap.py#L186-L196
def smooth_angle_channels(self, channels): """Remove discontinuities in angle channels so that they don't cause artifacts in algorithms that rely on the smoothness of the functions.""" for vertex in self.vertices: for col in vertex.meta['rot_ind']: if col: ...
[ "def", "smooth_angle_channels", "(", "self", ",", "channels", ")", ":", "for", "vertex", "in", "self", ".", "vertices", ":", "for", "col", "in", "vertex", ".", "meta", "[", "'rot_ind'", "]", ":", "if", "col", ":", "for", "k", "in", "range", "(", "1",...
Remove discontinuities in angle channels so that they don't cause artifacts in algorithms that rely on the smoothness of the functions.
[ "Remove", "discontinuities", "in", "angle", "channels", "so", "that", "they", "don", "t", "cause", "artifacts", "in", "algorithms", "that", "rely", "on", "the", "smoothness", "of", "the", "functions", "." ]
python
train
58.454545
Jaymon/endpoints
endpoints/decorators/__init__.py
https://github.com/Jaymon/endpoints/blob/2f1c4ae2c69a168e69447d3d8395ada7becaa5fb/endpoints/decorators/__init__.py#L259-L280
def normalize_flags(self, flags): """normalize the flags to make sure needed values are there after this method is called self.flags is available :param flags: the flags that will be normalized """ flags['type'] = flags.get('type', None) paction = flags.get('action', 's...
[ "def", "normalize_flags", "(", "self", ",", "flags", ")", ":", "flags", "[", "'type'", "]", "=", "flags", ".", "get", "(", "'type'", ",", "None", ")", "paction", "=", "flags", ".", "get", "(", "'action'", ",", "'store'", ")", "if", "paction", "==", ...
normalize the flags to make sure needed values are there after this method is called self.flags is available :param flags: the flags that will be normalized
[ "normalize", "the", "flags", "to", "make", "sure", "needed", "values", "are", "there" ]
python
train
31.954545
dnanhkhoa/logone
logone/logone.py
https://github.com/dnanhkhoa/logone/blob/7345a59e54ae59418a2c35ae7e7af5b2784fa1b5/logone/logone.py#L130-L145
def redirect_stderr(self, enabled=True, log_level=logging.ERROR): """ Redirect sys.stderr to file-like object. """ if enabled: if self.__stderr_wrapper: self.__stderr_wrapper.update_log_level(log_level=log_level) else: self.__stderr...
[ "def", "redirect_stderr", "(", "self", ",", "enabled", "=", "True", ",", "log_level", "=", "logging", ".", "ERROR", ")", ":", "if", "enabled", ":", "if", "self", ".", "__stderr_wrapper", ":", "self", ".", "__stderr_wrapper", ".", "update_log_level", "(", "...
Redirect sys.stderr to file-like object.
[ "Redirect", "sys", ".", "stderr", "to", "file", "-", "like", "object", "." ]
python
train
36
townsenddw/jhubctl
jhubctl/hubs/hubs.py
https://github.com/townsenddw/jhubctl/blob/c8c20f86a16e9d01dd90e4607d81423417cc773b/jhubctl/hubs/hubs.py#L22-L41
def get_hubs(self): """Get a list of hubs names. Returns ------- hubs : list List of hub names """ # Use helm to get a list of hubs. output = helm( 'list', '-q' ) # Check if an error occurred. if...
[ "def", "get_hubs", "(", "self", ")", ":", "# Use helm to get a list of hubs.", "output", "=", "helm", "(", "'list'", ",", "'-q'", ")", "# Check if an error occurred.", "if", "output", ".", "returncode", "!=", "0", ":", "print", "(", "\"Something went wrong!\"", ")...
Get a list of hubs names. Returns ------- hubs : list List of hub names
[ "Get", "a", "list", "of", "hubs", "names", ".", "Returns", "-------", "hubs", ":", "list", "List", "of", "hub", "names" ]
python
train
24
gboeing/osmnx
osmnx/pois.py
https://github.com/gboeing/osmnx/blob/be59fd313bcb68af8fc79242c56194f1247e26e2/osmnx/pois.py#L110-L132
def parse_nodes_coords(osm_response): """ Parse node coordinates from OSM response. Some nodes are standalone points of interest, others are vertices in polygonal (areal) POIs. Parameters ---------- osm_response : string OSM response JSON string Returns ------- ...
[ "def", "parse_nodes_coords", "(", "osm_response", ")", ":", "coords", "=", "{", "}", "for", "result", "in", "osm_response", "[", "'elements'", "]", ":", "if", "'type'", "in", "result", "and", "result", "[", "'type'", "]", "==", "'node'", ":", "coords", "...
Parse node coordinates from OSM response. Some nodes are standalone points of interest, others are vertices in polygonal (areal) POIs. Parameters ---------- osm_response : string OSM response JSON string Returns ------- coords : dict dict of node IDs and their ...
[ "Parse", "node", "coordinates", "from", "OSM", "response", ".", "Some", "nodes", "are", "standalone", "points", "of", "interest", "others", "are", "vertices", "in", "polygonal", "(", "areal", ")", "POIs", ".", "Parameters", "----------", "osm_response", ":", "...
python
train
27.347826
GoogleCloudPlatform/datastore-ndb-python
ndb/key.py
https://github.com/GoogleCloudPlatform/datastore-ndb-python/blob/cf4cab3f1f69cd04e1a9229871be466b53729f3f/ndb/key.py#L460-L468
def parent(self): """Return a Key constructed from all but the last (kind, id) pairs. If there is only one (kind, id) pair, return None. """ pairs = self.__pairs if len(pairs) <= 1: return None return Key(pairs=pairs[:-1], app=self.__app, namespace=self.__namespace)
[ "def", "parent", "(", "self", ")", ":", "pairs", "=", "self", ".", "__pairs", "if", "len", "(", "pairs", ")", "<=", "1", ":", "return", "None", "return", "Key", "(", "pairs", "=", "pairs", "[", ":", "-", "1", "]", ",", "app", "=", "self", ".", ...
Return a Key constructed from all but the last (kind, id) pairs. If there is only one (kind, id) pair, return None.
[ "Return", "a", "Key", "constructed", "from", "all", "but", "the", "last", "(", "kind", "id", ")", "pairs", "." ]
python
train
32.111111
datastax/python-driver
cassandra/connection.py
https://github.com/datastax/python-driver/blob/30a80d0b798b1f45f8cb77163b1fa791f3e3ca29/cassandra/connection.py#L676-L684
def register_watchers(self, type_callback_dict, register_timeout=None): """ Register multiple callback/event type pairs, expressed as a dict. """ for event_type, callback in type_callback_dict.items(): self._push_watchers[event_type].add(callback) self.wait_for_respon...
[ "def", "register_watchers", "(", "self", ",", "type_callback_dict", ",", "register_timeout", "=", "None", ")", ":", "for", "event_type", ",", "callback", "in", "type_callback_dict", ".", "items", "(", ")", ":", "self", ".", "_push_watchers", "[", "event_type", ...
Register multiple callback/event type pairs, expressed as a dict.
[ "Register", "multiple", "callback", "/", "event", "type", "pairs", "expressed", "as", "a", "dict", "." ]
python
train
46.666667
odlgroup/odl
odl/discr/partition.py
https://github.com/odlgroup/odl/blob/b8443f6aca90e191ba36c91d32253c5a36249a6c/odl/discr/partition.py#L708-L787
def index(self, value, floating=False): """Return the index of a value in the domain. Parameters ---------- value : ``self.set`` element Point whose index to find. floating : bool, optional If True, then the index should also give the position inside the ...
[ "def", "index", "(", "self", ",", "value", ",", "floating", "=", "False", ")", ":", "value", "=", "np", ".", "atleast_1d", "(", "self", ".", "set", ".", "element", "(", "value", ")", ")", "result", "=", "[", "]", "for", "val", ",", "cell_bdry_vec",...
Return the index of a value in the domain. Parameters ---------- value : ``self.set`` element Point whose index to find. floating : bool, optional If True, then the index should also give the position inside the voxel. This is given by returning the i...
[ "Return", "the", "index", "of", "a", "value", "in", "the", "domain", "." ]
python
train
32.725
ReFirmLabs/binwalk
src/binwalk/core/magic.py
https://github.com/ReFirmLabs/binwalk/blob/a0c5315fd2bae167e5c3d8469ce95d5defc743c2/src/binwalk/core/magic.py#L857-L904
def parse(self, lines): ''' Parse signature file lines. @lines - A list of lines from a signature file. Returns None. ''' signature = None for line in lines: # Split at the first comment delimiter (if any) and strip the # result ...
[ "def", "parse", "(", "self", ",", "lines", ")", ":", "signature", "=", "None", "for", "line", "in", "lines", ":", "# Split at the first comment delimiter (if any) and strip the", "# result", "line", "=", "line", ".", "split", "(", "'#'", ")", "[", "0", "]", ...
Parse signature file lines. @lines - A list of lines from a signature file. Returns None.
[ "Parse", "signature", "file", "lines", "." ]
python
train
44.354167
DLR-RM/RAFCON
source/rafcon/gui/views/graphical_editor.py
https://github.com/DLR-RM/RAFCON/blob/24942ef1a904531f49ab8830a1dbb604441be498/source/rafcon/gui/views/graphical_editor.py#L332-L350
def expose_finish(self, *args): """Finish drawing process """ # Obtain a reference to the OpenGL drawable # and rendering context. gldrawable = self.get_gl_drawable() # glcontext = self.get_gl_context() if not gldrawable: return # Put the buf...
[ "def", "expose_finish", "(", "self", ",", "*", "args", ")", ":", "# Obtain a reference to the OpenGL drawable", "# and rendering context.", "gldrawable", "=", "self", ".", "get_gl_drawable", "(", ")", "# glcontext = self.get_gl_context()", "if", "not", "gldrawable", ":", ...
Finish drawing process
[ "Finish", "drawing", "process" ]
python
train
25.684211
3DLIRIOUS/MeshLabXML
meshlabxml/create.py
https://github.com/3DLIRIOUS/MeshLabXML/blob/177cce21e92baca500f56a932d66bd9a33257af8/meshlabxml/create.py#L196-L256
def torus(script, major_radius=3.0, minor_radius=1.0, inner_diameter=None, outer_diameter=None, major_segments=48, minor_segments=12, color=None): """Create a torus mesh Args: major_radius (float, (optional)): radius from the origin to the center of the cross sections ...
[ "def", "torus", "(", "script", ",", "major_radius", "=", "3.0", ",", "minor_radius", "=", "1.0", ",", "inner_diameter", "=", "None", ",", "outer_diameter", "=", "None", ",", "major_segments", "=", "48", ",", "minor_segments", "=", "12", ",", "color", "=", ...
Create a torus mesh Args: major_radius (float, (optional)): radius from the origin to the center of the cross sections minor_radius (float, (optional)): radius of the torus cross section inner_diameter (float, (optional)): inner diameter of torus. If both...
[ "Create", "a", "torus", "mesh" ]
python
test
39.344262
mozilla/build-mar
src/mardor/utils.py
https://github.com/mozilla/build-mar/blob/d8c3b3469e55654d31f430cb343fd89392196c4e/src/mardor/utils.py#L247-L267
def safejoin(base, *elements): """Safely joins paths together. The result will always be a subdirectory under `base`, otherwise ValueError is raised. Args: base (str): base path elements (list of strings): path elements to join to base Returns: elements joined to base ...
[ "def", "safejoin", "(", "base", ",", "*", "elements", ")", ":", "# TODO: do we really want to be absolute here?", "base", "=", "os", ".", "path", ".", "abspath", "(", "base", ")", "path", "=", "os", ".", "path", ".", "join", "(", "base", ",", "*", "eleme...
Safely joins paths together. The result will always be a subdirectory under `base`, otherwise ValueError is raised. Args: base (str): base path elements (list of strings): path elements to join to base Returns: elements joined to base
[ "Safely", "joins", "paths", "together", "." ]
python
train
27.904762
marrow/util
marrow/util/text.py
https://github.com/marrow/util/blob/abb8163dbd1fa0692d42a44d129b12ae2b39cdf2/marrow/util/text.py#L26-L40
def ellipsis(text, length, symbol="..."): """Present a block of text of given length. If the length of available text exceeds the requested length, truncate and intelligently append an ellipsis. """ if len(text) > length: pos = text.rfind(" ", 0, length) if pos < 0: ...
[ "def", "ellipsis", "(", "text", ",", "length", ",", "symbol", "=", "\"...\"", ")", ":", "if", "len", "(", "text", ")", ">", "length", ":", "pos", "=", "text", ".", "rfind", "(", "\" \"", ",", "0", ",", "length", ")", "if", "pos", "<", "0", ":",...
Present a block of text of given length. If the length of available text exceeds the requested length, truncate and intelligently append an ellipsis.
[ "Present", "a", "block", "of", "text", "of", "given", "length", ".", "If", "the", "length", "of", "available", "text", "exceeds", "the", "requested", "length", "truncate", "and", "intelligently", "append", "an", "ellipsis", "." ]
python
train
29.8
saltstack/salt
salt/modules/win_servermanager.py
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/win_servermanager.py#L136-L298
def install(feature, recurse=False, restart=False, source=None, exclude=None): r''' Install a feature .. note:: Some features require reboot after un/installation, if so until the server is restarted other features can not be installed! .. note:: Some features take a long time ...
[ "def", "install", "(", "feature", ",", "recurse", "=", "False", ",", "restart", "=", "False", ",", "source", "=", "None", ",", "exclude", "=", "None", ")", ":", "# If it is a list of features, make it a comma delimited string", "if", "isinstance", "(", "feature", ...
r''' Install a feature .. note:: Some features require reboot after un/installation, if so until the server is restarted other features can not be installed! .. note:: Some features take a long time to complete un/installation, set -t with a long timeout Args: ...
[ "r", "Install", "a", "feature" ]
python
train
40.429448
geertj/gruvi
lib/gruvi/callbacks.py
https://github.com/geertj/gruvi/blob/1d77ca439600b6ea7a19aa1ee85dca0f3be3f3f8/lib/gruvi/callbacks.py#L118-L122
def run_callbacks(obj, log=None): """Run callbacks.""" def run_callback(callback, args): return callback(*args) return walk_callbacks(obj, run_callback, log)
[ "def", "run_callbacks", "(", "obj", ",", "log", "=", "None", ")", ":", "def", "run_callback", "(", "callback", ",", "args", ")", ":", "return", "callback", "(", "*", "args", ")", "return", "walk_callbacks", "(", "obj", ",", "run_callback", ",", "log", ...
Run callbacks.
[ "Run", "callbacks", "." ]
python
train
34.6
aparo/pyes
pyes/mappings.py
https://github.com/aparo/pyes/blob/712eb6095961755067b2b5baa262008ade6584b3/pyes/mappings.py#L489-L520
def get_properties_by_type(self, type, recursive=True, parent_path=""): """ Returns a sorted list of fields that match the type. :param type the type of the field "string","integer" or a list of types :param recursive recurse to sub object :returns a sorted list of fields the ma...
[ "def", "get_properties_by_type", "(", "self", ",", "type", ",", "recursive", "=", "True", ",", "parent_path", "=", "\"\"", ")", ":", "if", "parent_path", ":", "parent_path", "+=", "\".\"", "if", "isinstance", "(", "type", ",", "str", ")", ":", "if", "typ...
Returns a sorted list of fields that match the type. :param type the type of the field "string","integer" or a list of types :param recursive recurse to sub object :returns a sorted list of fields the match the type
[ "Returns", "a", "sorted", "list", "of", "fields", "that", "match", "the", "type", "." ]
python
train
39.875
ibm-watson-data-lab/ibmseti
ibmseti/compamp.py
https://github.com/ibm-watson-data-lab/ibmseti/blob/3361bc0adb4770dc7a554ed7cda292503892acee/ibmseti/compamp.py#L71-L79
def header(self): ''' This returns the first header in the data file ''' if self._header is None: self._header = self._read_half_frame_header(self.data) return self._header
[ "def", "header", "(", "self", ")", ":", "if", "self", ".", "_header", "is", "None", ":", "self", ".", "_header", "=", "self", ".", "_read_half_frame_header", "(", "self", ".", "data", ")", "return", "self", ".", "_header" ]
This returns the first header in the data file
[ "This", "returns", "the", "first", "header", "in", "the", "data", "file" ]
python
train
21.333333
bmcfee/pumpp
pumpp/feature/cqt.py
https://github.com/bmcfee/pumpp/blob/06a17b888271dd1f6cd41bddb22b0eb04d494056/pumpp/feature/cqt.py#L332-L351
def transform_audio(self, y): '''Compute the HCQT with unwrapped phase Parameters ---------- y : np.ndarray The audio buffer Returns ------- data : dict data['mag'] : np.ndarray, shape=(n_frames, n_bins) CQT magnitude ...
[ "def", "transform_audio", "(", "self", ",", "y", ")", ":", "data", "=", "super", "(", "HCQTPhaseDiff", ",", "self", ")", ".", "transform_audio", "(", "y", ")", "data", "[", "'dphase'", "]", "=", "self", ".", "phase_diff", "(", "data", ".", "pop", "("...
Compute the HCQT with unwrapped phase Parameters ---------- y : np.ndarray The audio buffer Returns ------- data : dict data['mag'] : np.ndarray, shape=(n_frames, n_bins) CQT magnitude data['dphase'] : np.ndarray, sha...
[ "Compute", "the", "HCQT", "with", "unwrapped", "phase" ]
python
train
28.05
twilio/twilio-python
twilio/rest/serverless/v1/service/__init__.py
https://github.com/twilio/twilio-python/blob/c867895f55dcc29f522e6e8b8868d0d18483132f/twilio/rest/serverless/v1/service/__init__.py#L285-L294
def environments(self): """ Access the environments :returns: twilio.rest.serverless.v1.service.environment.EnvironmentList :rtype: twilio.rest.serverless.v1.service.environment.EnvironmentList """ if self._environments is None: self._environments = Environme...
[ "def", "environments", "(", "self", ")", ":", "if", "self", ".", "_environments", "is", "None", ":", "self", ".", "_environments", "=", "EnvironmentList", "(", "self", ".", "_version", ",", "service_sid", "=", "self", ".", "_solution", "[", "'sid'", "]", ...
Access the environments :returns: twilio.rest.serverless.v1.service.environment.EnvironmentList :rtype: twilio.rest.serverless.v1.service.environment.EnvironmentList
[ "Access", "the", "environments" ]
python
train
40.3
ssokolow/fastdupes
fastdupes.py
https://github.com/ssokolow/fastdupes/blob/0334545885445834307c075a445fba9fe6f0c9e7/fastdupes.py#L217-L263
def groupBy(groups_in, classifier, fun_desc='?', keep_uniques=False, *args, **kwargs): """Subdivide groups of paths according to a function. :param groups_in: Grouped sets of paths. :type groups_in: :class:`~__builtins__.dict` of iterables :param classifier: Function to group a list of pat...
[ "def", "groupBy", "(", "groups_in", ",", "classifier", ",", "fun_desc", "=", "'?'", ",", "keep_uniques", "=", "False", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "groups", ",", "count", ",", "group_count", "=", "{", "}", ",", "0", ",", "l...
Subdivide groups of paths according to a function. :param groups_in: Grouped sets of paths. :type groups_in: :class:`~__builtins__.dict` of iterables :param classifier: Function to group a list of paths by some attribute. :type classifier: ``function(list, *args, **kwargs) -> str`` :param fun_des...
[ "Subdivide", "groups", "of", "paths", "according", "to", "a", "function", "." ]
python
valid
40.531915
raphaelm/python-fints
fints/client.py
https://github.com/raphaelm/python-fints/blob/fee55ae37d3182d0adb40507d4acb98b06057e4a/fints/client.py#L455-L472
def _find_highest_supported_command(self, *segment_classes, **kwargs): """Search the BPD for the highest supported version of a segment.""" return_parameter_segment = kwargs.get("return_parameter_segment", False) parameter_segment_name = "{}I{}S".format(segment_classes[0].TYPE[0], segment_class...
[ "def", "_find_highest_supported_command", "(", "self", ",", "*", "segment_classes", ",", "*", "*", "kwargs", ")", ":", "return_parameter_segment", "=", "kwargs", ".", "get", "(", "\"return_parameter_segment\"", ",", "False", ")", "parameter_segment_name", "=", "\"{}...
Search the BPD for the highest supported version of a segment.
[ "Search", "the", "BPD", "for", "the", "highest", "supported", "version", "of", "a", "segment", "." ]
python
train
57.333333
viswa-swami/python-foscam
libpyfoscam/foscam.py
https://github.com/viswa-swami/python-foscam/blob/d76f2f7016959b7b758751637fad103c9032e488/libpyfoscam/foscam.py#L300-L306
def set_main_video_stream_type(self, streamtype, callback=None): ''' Set the stream type of main stream ''' params = {'streamType': streamtype} return self.execute_command('setMainVideoStreamType', params, callback=callback)
[ "def", "set_main_video_stream_type", "(", "self", ",", "streamtype", ",", "callback", "=", "None", ")", ":", "params", "=", "{", "'streamType'", ":", "streamtype", "}", "return", "self", ".", "execute_command", "(", "'setMainVideoStreamType'", ",", "params", ","...
Set the stream type of main stream
[ "Set", "the", "stream", "type", "of", "main", "stream" ]
python
train
42.571429
dnanexus/dx-toolkit
src/python/dxpy/api.py
https://github.com/dnanexus/dx-toolkit/blob/74befb53ad90fcf902d8983ae6d74580f402d619/src/python/dxpy/api.py#L1205-L1211
def system_describe_projects(input_params={}, always_retry=True, **kwargs): """ Invokes the /system/describeProjects API method. For more info, see: https://wiki.dnanexus.com/API-Specification-v1.0.0/System-Methods#API-method:-/system/describeProjects """ return DXHTTPRequest('/system/describeProje...
[ "def", "system_describe_projects", "(", "input_params", "=", "{", "}", ",", "always_retry", "=", "True", ",", "*", "*", "kwargs", ")", ":", "return", "DXHTTPRequest", "(", "'/system/describeProjects'", ",", "input_params", ",", "always_retry", "=", "always_retry",...
Invokes the /system/describeProjects API method. For more info, see: https://wiki.dnanexus.com/API-Specification-v1.0.0/System-Methods#API-method:-/system/describeProjects
[ "Invokes", "the", "/", "system", "/", "describeProjects", "API", "method", "." ]
python
train
52.857143
pantsbuild/pants
src/python/pants/pantsd/watchman.py
https://github.com/pantsbuild/pants/blob/b72e650da0df685824ffdcc71988b8c282d0962d/src/python/pants/pantsd/watchman.py#L109-L144
def launch(self): """Launch and synchronously write metadata. This is possible due to watchman's built-in async server startup - no double-forking required. """ cmd = self._construct_cmd((self._watchman_path, 'get-pid'), state_file=self._state_file, ...
[ "def", "launch", "(", "self", ")", ":", "cmd", "=", "self", ".", "_construct_cmd", "(", "(", "self", ".", "_watchman_path", ",", "'get-pid'", ")", ",", "state_file", "=", "self", ".", "_state_file", ",", "sock_file", "=", "self", ".", "_sock_file", ",", ...
Launch and synchronously write metadata. This is possible due to watchman's built-in async server startup - no double-forking required.
[ "Launch", "and", "synchronously", "write", "metadata", "." ]
python
train
53.194444
openclimatedata/pymagicc
pymagicc/definitions/__init__.py
https://github.com/openclimatedata/pymagicc/blob/d896014832cf458d1e95e5878fd6d5961f3e2e05/pymagicc/definitions/__init__.py#L426-L562
def get_magicc6_to_magicc7_variable_mapping(inverse=False): """Get the mappings from MAGICC6 to MAGICC7 variables. Note that this mapping is not one to one. For example, "HFC4310", "HFC43-10" and "HFC-43-10" in MAGICC6 both map to "HFC4310" in MAGICC7 but "HFC4310" in MAGICC7 maps back to "HFC4310". ...
[ "def", "get_magicc6_to_magicc7_variable_mapping", "(", "inverse", "=", "False", ")", ":", "# we generate the mapping dynamically, the first name in the list", "# is the one which will be used for inverse mappings", "magicc6_simple_mapping_vars", "=", "[", "\"KYOTO-CO2EQ\"", ",", "\"CO2...
Get the mappings from MAGICC6 to MAGICC7 variables. Note that this mapping is not one to one. For example, "HFC4310", "HFC43-10" and "HFC-43-10" in MAGICC6 both map to "HFC4310" in MAGICC7 but "HFC4310" in MAGICC7 maps back to "HFC4310". Note that HFC-245fa was mistakenly labelled as HFC-245ca in MAGI...
[ "Get", "the", "mappings", "from", "MAGICC6", "to", "MAGICC7", "variables", "." ]
python
train
27.20438
jantman/pypi-download-stats
pypi_download_stats/dataquery.py
https://github.com/jantman/pypi-download-stats/blob/44a7a6bbcd61a9e7f02bd02c52584a98183f80c5/pypi_download_stats/dataquery.py#L545-L580
def backfill_history(self, num_days, available_table_names): """ Backfill historical data for days that are missing. :param num_days: number of days of historical data to backfill, if missing :type num_days: int :param available_table_names: names of available per-date...
[ "def", "backfill_history", "(", "self", ",", "num_days", ",", "available_table_names", ")", ":", "if", "num_days", "==", "-", "1", ":", "# skip the first date, under the assumption that data may be", "# incomplete", "logger", ".", "info", "(", "'Backfilling all available ...
Backfill historical data for days that are missing. :param num_days: number of days of historical data to backfill, if missing :type num_days: int :param available_table_names: names of available per-date tables :type available_table_names: ``list``
[ "Backfill", "historical", "data", "for", "days", "that", "are", "missing", "." ]
python
train
46.888889
jaraco/jaraco.stream
jaraco/stream/gzip.py
https://github.com/jaraco/jaraco.stream/blob/960d6950b083e64c97d93e15443d486b52046a44/jaraco/stream/gzip.py#L16-L25
def read_chunks(stream, block_size=2**10): """ Given a byte stream with reader, yield chunks of block_size until the stream is consusmed. """ while True: chunk = stream.read(block_size) if not chunk: break yield chunk
[ "def", "read_chunks", "(", "stream", ",", "block_size", "=", "2", "**", "10", ")", ":", "while", "True", ":", "chunk", "=", "stream", ".", "read", "(", "block_size", ")", "if", "not", "chunk", ":", "break", "yield", "chunk" ]
Given a byte stream with reader, yield chunks of block_size until the stream is consusmed.
[ "Given", "a", "byte", "stream", "with", "reader", "yield", "chunks", "of", "block_size", "until", "the", "stream", "is", "consusmed", "." ]
python
train
26.4
theduke/django-baseline
django_baseline/__init__.py
https://github.com/theduke/django-baseline/blob/7be8b956e53c70b35f34e1783a8fe8f716955afb/django_baseline/__init__.py#L55-L63
def resolve_class(class_path): """ Load a class by a fully qualified class_path, eg. myapp.models.ModelName """ modulepath, classname = class_path.rsplit('.', 1) module = __import__(modulepath, fromlist=[classname]) return getattr(module, classname)
[ "def", "resolve_class", "(", "class_path", ")", ":", "modulepath", ",", "classname", "=", "class_path", ".", "rsplit", "(", "'.'", ",", "1", ")", "module", "=", "__import__", "(", "modulepath", ",", "fromlist", "=", "[", "classname", "]", ")", "return", ...
Load a class by a fully qualified class_path, eg. myapp.models.ModelName
[ "Load", "a", "class", "by", "a", "fully", "qualified", "class_path", "eg", ".", "myapp", ".", "models", ".", "ModelName" ]
python
test
30
ansible/ansible-runner
ansible_runner/runner_config.py
https://github.com/ansible/ansible-runner/blob/8ce485480a5d0b602428d9d64a752e06fb46cdb8/ansible_runner/runner_config.py#L290-L365
def generate_ansible_command(self): """ Given that the ``RunnerConfig`` preparation methods have been run to gather the inputs this method will generate the ``ansible`` or ``ansible-playbook`` command that will be used by the :py:class:`ansible_runner.runner.Runner` object to start the p...
[ "def", "generate_ansible_command", "(", "self", ")", ":", "if", "self", ".", "binary", "is", "not", "None", ":", "base_command", "=", "self", ".", "binary", "self", ".", "execution_mode", "=", "ExecutionMode", ".", "RAW", "elif", "self", ".", "module", "is...
Given that the ``RunnerConfig`` preparation methods have been run to gather the inputs this method will generate the ``ansible`` or ``ansible-playbook`` command that will be used by the :py:class:`ansible_runner.runner.Runner` object to start the process
[ "Given", "that", "the", "RunnerConfig", "preparation", "methods", "have", "been", "run", "to", "gather", "the", "inputs", "this", "method", "will", "generate", "the", "ansible", "or", "ansible", "-", "playbook", "command", "that", "will", "be", "used", "by", ...
python
train
35.25
learningequality/ricecooker
ricecooker/classes/files.py
https://github.com/learningequality/ricecooker/blob/2f0385282500cb77ef2894646c6f9ce11bd7a853/ricecooker/classes/files.py#L704-L711
def process_file(self): """ process_file: Writes base64 encoding to file Args: None Returns: filename """ self.filename = self.convert_base64_to_file() config.LOGGER.info("\t--- Converted base64 image to {}".format(self.filename)) return self.filename
[ "def", "process_file", "(", "self", ")", ":", "self", ".", "filename", "=", "self", ".", "convert_base64_to_file", "(", ")", "config", ".", "LOGGER", ".", "info", "(", "\"\\t--- Converted base64 image to {}\"", ".", "format", "(", "self", ".", "filename", ")",...
process_file: Writes base64 encoding to file Args: None Returns: filename
[ "process_file", ":", "Writes", "base64", "encoding", "to", "file", "Args", ":", "None", "Returns", ":", "filename" ]
python
train
38.5
pip-services3-python/pip-services3-commons-python
pip_services3_commons/reflect/PropertyReflector.py
https://github.com/pip-services3-python/pip-services3-commons-python/blob/22cbbb3e91e49717f65c083d36147fdb07ba9e3b/pip_services3_commons/reflect/PropertyReflector.py#L106-L123
def get_property_names(obj): """ Gets names of all properties implemented in specified object. :param obj: an objec to introspect. :return: a list with property names. """ property_names = [] for property_name in dir(obj): property = getatt...
[ "def", "get_property_names", "(", "obj", ")", ":", "property_names", "=", "[", "]", "for", "property_name", "in", "dir", "(", "obj", ")", ":", "property", "=", "getattr", "(", "obj", ",", "property_name", ")", "if", "PropertyReflector", ".", "_is_property", ...
Gets names of all properties implemented in specified object. :param obj: an objec to introspect. :return: a list with property names.
[ "Gets", "names", "of", "all", "properties", "implemented", "in", "specified", "object", "." ]
python
train
26.722222
pysathq/pysat
examples/rc2.py
https://github.com/pysathq/pysat/blob/522742e8f2d4c6ac50ecd9087f7a346206774c67/examples/rc2.py#L555-L605
def process_core(self): """ The method deals with a core found previously in :func:`get_core`. Clause selectors ``self.core_sels`` and sum assumptions involved in the core are treated separately of each other. This is handled by calling methods :func:`...
[ "def", "process_core", "(", "self", ")", ":", "# updating the cost", "self", ".", "cost", "+=", "self", ".", "minw", "# assumptions to remove", "self", ".", "garbage", "=", "set", "(", ")", "if", "len", "(", "self", ".", "core_sels", ")", "!=", "1", "or"...
The method deals with a core found previously in :func:`get_core`. Clause selectors ``self.core_sels`` and sum assumptions involved in the core are treated separately of each other. This is handled by calling methods :func:`process_sels` and :func:`process_sums`, ...
[ "The", "method", "deals", "with", "a", "core", "found", "previously", "in", ":", "func", ":", "get_core", ".", "Clause", "selectors", "self", ".", "core_sels", "and", "sum", "assumptions", "involved", "in", "the", "core", "are", "treated", "separately", "of"...
python
train
37.607843
calmjs/calmjs
src/calmjs/runtime.py
https://github.com/calmjs/calmjs/blob/b9b407c2b6a7662da64bccba93bb8d92e7a5fafd/src/calmjs/runtime.py#L856-L872
def init_argparser(self, argparser): """ Other runtimes (or users of ArgumentParser) can pass their subparser into here to collect the arguments here for a subcommand. """ super(ToolchainRuntime, self).init_argparser(argparser) # it is possible for subclasses to...
[ "def", "init_argparser", "(", "self", ",", "argparser", ")", ":", "super", "(", "ToolchainRuntime", ",", "self", ")", ".", "init_argparser", "(", "argparser", ")", "# it is possible for subclasses to fully override this, but if", "# they are using this as the runtime to drive...
Other runtimes (or users of ArgumentParser) can pass their subparser into here to collect the arguments here for a subcommand.
[ "Other", "runtimes", "(", "or", "users", "of", "ArgumentParser", ")", "can", "pass", "their", "subparser", "into", "here", "to", "collect", "the", "arguments", "here", "for", "a", "subcommand", "." ]
python
train
44.470588
gem/oq-engine
openquake/hazardlib/gsim/can15/utils.py
https://github.com/gem/oq-engine/blob/8294553a0b8aba33fd96437a35065d03547d0040/openquake/hazardlib/gsim/can15/utils.py#L30-L61
def _get_equivalent_distances_east(wid, lng, mag, repi, focal_depth=10., ab06=False): """ Computes equivalent values of Joyner-Boore and closest distance to the rupture given epoicentral distance. The procedure is described in Atkinson (2012) - Appendix A (page 32). ...
[ "def", "_get_equivalent_distances_east", "(", "wid", ",", "lng", ",", "mag", ",", "repi", ",", "focal_depth", "=", "10.", ",", "ab06", "=", "False", ")", ":", "dtop", "=", "focal_depth", "-", "0.5", "*", "wid", "# this computes a minimum ztor value - used for AB...
Computes equivalent values of Joyner-Boore and closest distance to the rupture given epoicentral distance. The procedure is described in Atkinson (2012) - Appendix A (page 32). :param float wid: Width of rectangular rupture :param float lng: Length of rectangular rupture :param floa...
[ "Computes", "equivalent", "values", "of", "Joyner", "-", "Boore", "and", "closest", "distance", "to", "the", "rupture", "given", "epoicentral", "distance", ".", "The", "procedure", "is", "described", "in", "Atkinson", "(", "2012", ")", "-", "Appendix", "A", ...
python
train
34.625