repo
stringlengths
7
54
path
stringlengths
4
192
url
stringlengths
87
284
code
stringlengths
78
104k
code_tokens
list
docstring
stringlengths
1
46.9k
docstring_tokens
list
language
stringclasses
1 value
partition
stringclasses
3 values
singularityhub/sregistry-cli
sregistry/database/sqlite.py
https://github.com/singularityhub/sregistry-cli/blob/abc96140a1d15b5e96d83432e1e0e1f4f8f36331/sregistry/database/sqlite.py#L316-L331
def rm(self, image_name, delete=False): '''Remove an image from the database, akin to untagging the image. This does not delete the file from the cache, unless delete is set to True (as called by rmi). ''' container = self.get(image_name) if container is not None: name = container.uri or...
[ "def", "rm", "(", "self", ",", "image_name", ",", "delete", "=", "False", ")", ":", "container", "=", "self", ".", "get", "(", "image_name", ")", "if", "container", "is", "not", "None", ":", "name", "=", "container", ".", "uri", "or", "container", "....
Remove an image from the database, akin to untagging the image. This does not delete the file from the cache, unless delete is set to True (as called by rmi).
[ "Remove", "an", "image", "from", "the", "database", "akin", "to", "untagging", "the", "image", ".", "This", "does", "not", "delete", "the", "file", "from", "the", "cache", "unless", "delete", "is", "set", "to", "True", "(", "as", "called", "by", "rmi", ...
python
test
pandas-dev/pandas
pandas/core/series.py
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/series.py#L4417-L4441
def to_timestamp(self, freq=None, how='start', copy=True): """ Cast to DatetimeIndex of Timestamps, at *beginning* of period. Parameters ---------- freq : str, default frequency of PeriodIndex Desired frequency. how : {'s', 'e', 'start', 'end'} Co...
[ "def", "to_timestamp", "(", "self", ",", "freq", "=", "None", ",", "how", "=", "'start'", ",", "copy", "=", "True", ")", ":", "new_values", "=", "self", ".", "_values", "if", "copy", ":", "new_values", "=", "new_values", ".", "copy", "(", ")", "new_i...
Cast to DatetimeIndex of Timestamps, at *beginning* of period. Parameters ---------- freq : str, default frequency of PeriodIndex Desired frequency. how : {'s', 'e', 'start', 'end'} Convention for converting period to timestamp; start of period vs. en...
[ "Cast", "to", "DatetimeIndex", "of", "Timestamps", "at", "*", "beginning", "*", "of", "period", "." ]
python
train
googlefonts/fontmake
Lib/fontmake/font_project.py
https://github.com/googlefonts/fontmake/blob/b611baf49929575c2a30fd18662055365219ce2d/Lib/fontmake/font_project.py#L341-L377
def build_variable_font( self, designspace, output_path=None, output_dir=None, master_bin_dir=None, ttf=True, ): """Build OpenType variable font from masters in a designspace.""" assert not (output_path and output_dir), "mutually exclusive args" ...
[ "def", "build_variable_font", "(", "self", ",", "designspace", ",", "output_path", "=", "None", ",", "output_dir", "=", "None", ",", "master_bin_dir", "=", "None", ",", "ttf", "=", "True", ",", ")", ":", "assert", "not", "(", "output_path", "and", "output_...
Build OpenType variable font from masters in a designspace.
[ "Build", "OpenType", "variable", "font", "from", "masters", "in", "a", "designspace", "." ]
python
train
pyoceans/python-ctd
ctd/extras.py
https://github.com/pyoceans/python-ctd/blob/fa9a9d02da3dfed6d1d60db0e52bbab52adfe666/ctd/extras.py#L243-L260
def cell_thermal_mass(temperature, conductivity): """ Sample interval is measured in seconds. Temperature in degrees. CTM is calculated in S/m. """ alpha = 0.03 # Thermal anomaly amplitude. beta = 1.0 / 7 # Thermal anomaly time constant (1/beta). sample_interval = 1 / 15.0 a = 2...
[ "def", "cell_thermal_mass", "(", "temperature", ",", "conductivity", ")", ":", "alpha", "=", "0.03", "# Thermal anomaly amplitude.", "beta", "=", "1.0", "/", "7", "# Thermal anomaly time constant (1/beta).", "sample_interval", "=", "1", "/", "15.0", "a", "=", "2", ...
Sample interval is measured in seconds. Temperature in degrees. CTM is calculated in S/m.
[ "Sample", "interval", "is", "measured", "in", "seconds", ".", "Temperature", "in", "degrees", ".", "CTM", "is", "calculated", "in", "S", "/", "m", "." ]
python
train
DarkEnergySurvey/ugali
ugali/observation/mask.py
https://github.com/DarkEnergySurvey/ugali/blob/21e890b4117fc810afb6fb058e8055d564f03382/ugali/observation/mask.py#L257-L294
def _pruneCMD(self, minimum_solid_angle): """ Remove regions of color-magnitude space where the unmasked solid angle is statistically insufficient to estimate the background. ADW: Why are we clipping at the bin center instead of edge? INPUTS: solid_angle[1]: minimum...
[ "def", "_pruneCMD", "(", "self", ",", "minimum_solid_angle", ")", ":", "logger", ".", "info", "(", "'Pruning mask based on minimum solid angle of %.2f deg^2'", "%", "(", "minimum_solid_angle", ")", ")", "self", ".", "solid_angle_cmd", "*=", "self", ".", "solid_angle_c...
Remove regions of color-magnitude space where the unmasked solid angle is statistically insufficient to estimate the background. ADW: Why are we clipping at the bin center instead of edge? INPUTS: solid_angle[1]: minimum solid angle (deg^2)
[ "Remove", "regions", "of", "color", "-", "magnitude", "space", "where", "the", "unmasked", "solid", "angle", "is", "statistically", "insufficient", "to", "estimate", "the", "background", "." ]
python
train
golemhq/webdriver-manager
webdriver_manager/helpers.py
https://github.com/golemhq/webdriver-manager/blob/5c923deec5cb14f503ba7c20b67bc296e411de19/webdriver_manager/helpers.py#L106-L125
def download_file_with_progress_bar(url): """Downloads a file from the given url, displays a progress bar. Returns a io.BytesIO object """ request = requests.get(url, stream=True) if request.status_code == 404: msg = ('there was a 404 error trying to reach {} \nThis probably ' ...
[ "def", "download_file_with_progress_bar", "(", "url", ")", ":", "request", "=", "requests", ".", "get", "(", "url", ",", "stream", "=", "True", ")", "if", "request", ".", "status_code", "==", "404", ":", "msg", "=", "(", "'there was a 404 error trying to reach...
Downloads a file from the given url, displays a progress bar. Returns a io.BytesIO object
[ "Downloads", "a", "file", "from", "the", "given", "url", "displays", "a", "progress", "bar", ".", "Returns", "a", "io", ".", "BytesIO", "object" ]
python
train
geronimp/graftM
graftm/graftm_package.py
https://github.com/geronimp/graftM/blob/c82576517290167f605fd0bc4facd009cee29f48/graftm/graftm_package.py#L59-L92
def acquire(graftm_package_path): '''Acquire a new graftm Package Parameters ---------- graftm_output_path: str path to base directory of graftm ''' contents_hash = json.load( open( ...
[ "def", "acquire", "(", "graftm_package_path", ")", ":", "contents_hash", "=", "json", ".", "load", "(", "open", "(", "os", ".", "path", ".", "join", "(", "graftm_package_path", ",", "GraftMPackage", ".", "_CONTENTS_FILE_NAME", ")", ",", ")", ")", "v", "=",...
Acquire a new graftm Package Parameters ---------- graftm_output_path: str path to base directory of graftm
[ "Acquire", "a", "new", "graftm", "Package" ]
python
train
Vagrants/blackbird
blackbird/utils/configread.py
https://github.com/Vagrants/blackbird/blob/3b38cd5650caae362e0668dbd38bf8f88233e079/blackbird/utils/configread.py#L168-L185
def register(self, observers): """ Concrete method of Subject.register(). Register observers as an argument to self.observers. """ if isinstance(observers, list) or isinstance(observers, tuple): for observer in observers: # check whether inhelitance ...
[ "def", "register", "(", "self", ",", "observers", ")", ":", "if", "isinstance", "(", "observers", ",", "list", ")", "or", "isinstance", "(", "observers", ",", "tuple", ")", ":", "for", "observer", "in", "observers", ":", "# check whether inhelitance \"base.Obs...
Concrete method of Subject.register(). Register observers as an argument to self.observers.
[ "Concrete", "method", "of", "Subject", ".", "register", "()", ".", "Register", "observers", "as", "an", "argument", "to", "self", ".", "observers", "." ]
python
train
snbuback/django_services
django_services/api/api.py
https://github.com/snbuback/django_services/blob/58cbdea878bb11197add0ed1008a9206e4d92671/django_services/api/api.py#L154-L160
def service(self): ''' Instantiate service class with django http_request ''' service_class = getattr(self, 'service_class') service = service_class(self.http_request) return service
[ "def", "service", "(", "self", ")", ":", "service_class", "=", "getattr", "(", "self", ",", "'service_class'", ")", "service", "=", "service_class", "(", "self", ".", "http_request", ")", "return", "service" ]
Instantiate service class with django http_request
[ "Instantiate", "service", "class", "with", "django", "http_request" ]
python
train
WhyNotHugo/django-afip
django_afip/models.py
https://github.com/WhyNotHugo/django-afip/blob/5fb73213f1fe86ca52b501ffd0737911ef26ddb3/django_afip/models.py#L52-L59
def populate_all(): """Fetch and store all metadata from the AFIP.""" ReceiptType.objects.populate() ConceptType.objects.populate() DocumentType.objects.populate() VatType.objects.populate() TaxType.objects.populate() CurrencyType.objects.populate()
[ "def", "populate_all", "(", ")", ":", "ReceiptType", ".", "objects", ".", "populate", "(", ")", "ConceptType", ".", "objects", ".", "populate", "(", ")", "DocumentType", ".", "objects", ".", "populate", "(", ")", "VatType", ".", "objects", ".", "populate",...
Fetch and store all metadata from the AFIP.
[ "Fetch", "and", "store", "all", "metadata", "from", "the", "AFIP", "." ]
python
train
mozilla-releng/scriptworker
scriptworker/config.py
https://github.com/mozilla-releng/scriptworker/blob/8e97bbd83b9b578565ec57904c966dd6ae4ef0ae/scriptworker/config.py#L57-L73
def get_unfrozen_copy(values): """Recursively convert `value`'s tuple values into lists, and frozendicts into dicts. Args: values (frozendict/tuple): the frozendict/tuple. Returns: values (dict/list): the unfrozen copy. """ if isinstance(values, (frozendict, dict)): return...
[ "def", "get_unfrozen_copy", "(", "values", ")", ":", "if", "isinstance", "(", "values", ",", "(", "frozendict", ",", "dict", ")", ")", ":", "return", "{", "key", ":", "get_unfrozen_copy", "(", "value", ")", "for", "key", ",", "value", "in", "values", "...
Recursively convert `value`'s tuple values into lists, and frozendicts into dicts. Args: values (frozendict/tuple): the frozendict/tuple. Returns: values (dict/list): the unfrozen copy.
[ "Recursively", "convert", "value", "s", "tuple", "values", "into", "lists", "and", "frozendicts", "into", "dicts", "." ]
python
train
crocs-muni/roca
roca/detect.py
https://github.com/crocs-muni/roca/blob/74ad6ce63c428d83dcffce9c5e26ef7b9e30faa5/roca/detect.py#L406-L430
def log(self, cause=None, do_message=True, custom_msg=None): """ Loads exception data from the current exception frame - should be called inside the except block :return: """ message = error_message(self, cause=cause) exc_type, exc_value, exc_traceback = sys.exc_info() ...
[ "def", "log", "(", "self", ",", "cause", "=", "None", ",", "do_message", "=", "True", ",", "custom_msg", "=", "None", ")", ":", "message", "=", "error_message", "(", "self", ",", "cause", "=", "cause", ")", "exc_type", ",", "exc_value", ",", "exc_trace...
Loads exception data from the current exception frame - should be called inside the except block :return:
[ "Loads", "exception", "data", "from", "the", "current", "exception", "frame", "-", "should", "be", "called", "inside", "the", "except", "block", ":", "return", ":" ]
python
train
Devoxin/Lavalink.py
lavalink/Utils.py
https://github.com/Devoxin/Lavalink.py/blob/63f55c3d726d24c4cfd3674d3cd6aab6f5be110d/lavalink/Utils.py#L1-L6
def format_time(time): """ Formats the given time into HH:MM:SS. """ hours, remainder = divmod(time / 1000, 3600) minutes, seconds = divmod(remainder, 60) return '%02d:%02d:%02d' % (hours, minutes, seconds)
[ "def", "format_time", "(", "time", ")", ":", "hours", ",", "remainder", "=", "divmod", "(", "time", "/", "1000", ",", "3600", ")", "minutes", ",", "seconds", "=", "divmod", "(", "remainder", ",", "60", ")", "return", "'%02d:%02d:%02d'", "%", "(", "hour...
Formats the given time into HH:MM:SS.
[ "Formats", "the", "given", "time", "into", "HH", ":", "MM", ":", "SS", "." ]
python
valid
OnroerendErfgoed/crabpy_pyramid
crabpy_pyramid/renderers/crab.py
https://github.com/OnroerendErfgoed/crabpy_pyramid/blob/b727ea55838d71575db96e987b536a0bac9f6a7a/crabpy_pyramid/renderers/crab.py#L433-L466
def item_subadres_adapter(obj, request): """ Adapter for rendering an item of :class:`crabpy.gateway.Subadres` to json. """ return { 'id': obj.id, 'subadres': obj.subadres, 'postadres': obj.postadres, 'status': { 'id': obj.status.id, 'naam': ob...
[ "def", "item_subadres_adapter", "(", "obj", ",", "request", ")", ":", "return", "{", "'id'", ":", "obj", ".", "id", ",", "'subadres'", ":", "obj", ".", "subadres", ",", "'postadres'", ":", "obj", ".", "postadres", ",", "'status'", ":", "{", "'id'", ":"...
Adapter for rendering an item of :class:`crabpy.gateway.Subadres` to json.
[ "Adapter", "for", "rendering", "an", "item", "of", ":", "class", ":", "crabpy", ".", "gateway", ".", "Subadres", "to", "json", "." ]
python
train
Netflix-Skunkworks/cloudaux
cloudaux/aws/iam.py
https://github.com/Netflix-Skunkworks/cloudaux/blob/c4b0870c3ac68b1c69e71d33cf78b6a8bdf437ea/cloudaux/aws/iam.py#L442-L470
def get_group(group_name, users=True, client=None, **kwargs): """Get's the IAM Group details. :param group_name: :param users: Optional -- will return the IAM users that the group is attached to if desired (paginated). :param client: :param kwargs: :return: """ # First, make the initial...
[ "def", "get_group", "(", "group_name", ",", "users", "=", "True", ",", "client", "=", "None", ",", "*", "*", "kwargs", ")", ":", "# First, make the initial call to get the details for the group:", "result", "=", "client", ".", "get_group", "(", "GroupName", "=", ...
Get's the IAM Group details. :param group_name: :param users: Optional -- will return the IAM users that the group is attached to if desired (paginated). :param client: :param kwargs: :return:
[ "Get", "s", "the", "IAM", "Group", "details", "." ]
python
valid
awacha/sastool
sastool/misc/errorvalue.py
https://github.com/awacha/sastool/blob/deaddfa3002f3f6818697e36139633b7e30427a3/sastool/misc/errorvalue.py#L251-L311
def evalfunc(cls, func, *args, **kwargs): """Evaluate a function with error propagation. Inputs: ------- ``func``: callable this is the function to be evaluated. Should return either a number or a np.ndarray. ``*args``: other positional ar...
[ "def", "evalfunc", "(", "cls", ",", "func", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "def", "do_random", "(", "x", ")", ":", "if", "isinstance", "(", "x", ",", "cls", ")", ":", "return", "x", ".", "random", "(", ")", "else", ":", ...
Evaluate a function with error propagation. Inputs: ------- ``func``: callable this is the function to be evaluated. Should return either a number or a np.ndarray. ``*args``: other positional arguments of func. Arguments which are ...
[ "Evaluate", "a", "function", "with", "error", "propagation", "." ]
python
train
cloud9ers/gurumate
environment/lib/python2.7/site-packages/nose/plugins/collect.py
https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/nose/plugins/collect.py#L28-L36
def options(self, parser, env): """Register commandline options. """ parser.add_option('--collect-only', action='store_true', dest=self.enableOpt, default=env.get('NOSE_COLLECT_ONLY'), help="E...
[ "def", "options", "(", "self", ",", "parser", ",", "env", ")", ":", "parser", ".", "add_option", "(", "'--collect-only'", ",", "action", "=", "'store_true'", ",", "dest", "=", "self", ".", "enableOpt", ",", "default", "=", "env", ".", "get", "(", "'NOS...
Register commandline options.
[ "Register", "commandline", "options", "." ]
python
test
Opentrons/opentrons
api/src/opentrons/server/endpoints/control.py
https://github.com/Opentrons/opentrons/blob/a7c15cc2636ecb64ab56c7edc1d8a57163aaeadf/api/src/opentrons/server/endpoints/control.py#L77-L139
async def get_attached_modules(request): """ On success (including an empty "modules" list if no modules are detected): // status: 200 { "modules": [ { /** name of module */ "name": "string", /** model identifier (i.e. part number) */ ...
[ "async", "def", "get_attached_modules", "(", "request", ")", ":", "hw", "=", "hw_from_req", "(", "request", ")", "if", "ff", ".", "use_protocol_api_v2", "(", ")", ":", "hw_mods", "=", "await", "hw", ".", "discover_modules", "(", ")", "module_data", "=", "[...
On success (including an empty "modules" list if no modules are detected): // status: 200 { "modules": [ { /** name of module */ "name": "string", /** model identifier (i.e. part number) */ "model": "string", /**...
[ "On", "success", "(", "including", "an", "empty", "modules", "list", "if", "no", "modules", "are", "detected", ")", ":", "//", "status", ":", "200", "{", "modules", ":", "[", "{", "/", "**", "name", "of", "module", "*", "/", "name", ":", "string", ...
python
train
Rapptz/discord.py
discord/guild.py
https://github.com/Rapptz/discord.py/blob/05d4f7f9620ef33635d6ac965b26528e09cdaf5b/discord/guild.py#L930-L957
async def fetch_member(self, member_id): """|coro| Retreives a :class:`Member` from a guild ID, and a member ID. .. note:: This method is an API call. For general usage, consider :meth:`get_member` instead. Parameters ----------- member_id: :class:`int` ...
[ "async", "def", "fetch_member", "(", "self", ",", "member_id", ")", ":", "data", "=", "await", "self", ".", "_state", ".", "http", ".", "get_member", "(", "self", ".", "id", ",", "member_id", ")", "return", "Member", "(", "data", "=", "data", ",", "s...
|coro| Retreives a :class:`Member` from a guild ID, and a member ID. .. note:: This method is an API call. For general usage, consider :meth:`get_member` instead. Parameters ----------- member_id: :class:`int` The member's ID to fetch from. Ra...
[ "|coro|" ]
python
train
realitix/vulkan
generator/generate.py
https://github.com/realitix/vulkan/blob/07285387092aaa61d2d71fa2913d60a73f022cbe/generator/generate.py#L469-L481
def model_alias(vk, model): """Fill the model with alias since V1""" model['alias'] = {} # types for s in vk['registry']['types']['type']: if s.get('@category', None) == 'handle' and s.get('@alias'): model['alias'][s['@alias']] = s['@name'] # commands for c i...
[ "def", "model_alias", "(", "vk", ",", "model", ")", ":", "model", "[", "'alias'", "]", "=", "{", "}", "# types", "for", "s", "in", "vk", "[", "'registry'", "]", "[", "'types'", "]", "[", "'type'", "]", ":", "if", "s", ".", "get", "(", "'@category...
Fill the model with alias since V1
[ "Fill", "the", "model", "with", "alias", "since", "V1" ]
python
train
sci-bots/svg-model
docs/generate_modules.py
https://github.com/sci-bots/svg-model/blob/2d119650f995e62b29ce0b3151a23f3b957cb072/docs/generate_modules.py#L142-L196
def recurse_tree(path, excludes, opts): """ Look for every file in the directory tree and create the corresponding ReST files. """ # use absolute path for root, as relative paths like '../../foo' cause # 'if "/." in root ...' to filter out *all* modules otherwise path = os.path.abspath(path)...
[ "def", "recurse_tree", "(", "path", ",", "excludes", ",", "opts", ")", ":", "# use absolute path for root, as relative paths like '../../foo' cause", "# 'if \"/.\" in root ...' to filter out *all* modules otherwise", "path", "=", "os", ".", "path", ".", "abspath", "(", "path"...
Look for every file in the directory tree and create the corresponding ReST files.
[ "Look", "for", "every", "file", "in", "the", "directory", "tree", "and", "create", "the", "corresponding", "ReST", "files", "." ]
python
train
franciscogarate/pyliferisk
pyliferisk/__init__.py
https://github.com/franciscogarate/pyliferisk/blob/8d906bed04df1ba00fa1cacc6f31030ce5ab6233/pyliferisk/__init__.py#L443-L448
def qax(mt, x, q, m=1): """ geometrica """ q = float(q) j = (mt.i - q) / (1 + q) mtj = Actuarial(nt=mt.nt, i=j) return ax(mtj, x, m)
[ "def", "qax", "(", "mt", ",", "x", ",", "q", ",", "m", "=", "1", ")", ":", "q", "=", "float", "(", "q", ")", "j", "=", "(", "mt", ".", "i", "-", "q", ")", "/", "(", "1", "+", "q", ")", "mtj", "=", "Actuarial", "(", "nt", "=", "mt", ...
geometrica
[ "geometrica" ]
python
train
emory-libraries/eulcommon
eulcommon/djangoextras/formfields.py
https://github.com/emory-libraries/eulcommon/blob/dc63a9b3b5e38205178235e0d716d1b28158d3a9/eulcommon/djangoextras/formfields.py#L46-L75
def value_from_datadict(self, data, files, name): '''Generate a single value from multi-part form data. Constructs a W3C date based on values that are set, leaving out day and month if they are not present. :param data: dictionary of data submitted by the form :param files: - u...
[ "def", "value_from_datadict", "(", "self", ",", "data", ",", "files", ",", "name", ")", ":", "y", "=", "data", ".", "get", "(", "self", ".", "year_field", "%", "name", ")", "m", "=", "data", ".", "get", "(", "self", ".", "month_field", "%", "name",...
Generate a single value from multi-part form data. Constructs a W3C date based on values that are set, leaving out day and month if they are not present. :param data: dictionary of data submitted by the form :param files: - unused :param name: base name of the form field ...
[ "Generate", "a", "single", "value", "from", "multi", "-", "part", "form", "data", ".", "Constructs", "a", "W3C", "date", "based", "on", "values", "that", "are", "set", "leaving", "out", "day", "and", "month", "if", "they", "are", "not", "present", "." ]
python
train
MDAnalysis/GridDataFormats
gridData/OpenDX.py
https://github.com/MDAnalysis/GridDataFormats/blob/3eeb0432f8cf856912436e4f3e7aba99d3c916be/gridData/OpenDX.py#L512-L517
def histogramdd(self): """Return array data as (edges,grid), i.e. a numpy nD histogram.""" shape = self.components['positions'].shape edges = self.components['positions'].edges() hist = self.components['data'].array.reshape(shape) return (hist,edges)
[ "def", "histogramdd", "(", "self", ")", ":", "shape", "=", "self", ".", "components", "[", "'positions'", "]", ".", "shape", "edges", "=", "self", ".", "components", "[", "'positions'", "]", ".", "edges", "(", ")", "hist", "=", "self", ".", "components...
Return array data as (edges,grid), i.e. a numpy nD histogram.
[ "Return", "array", "data", "as", "(", "edges", "grid", ")", "i", ".", "e", ".", "a", "numpy", "nD", "histogram", "." ]
python
valid
googleads/googleads-python-lib
googleads/common.py
https://github.com/googleads/googleads-python-lib/blob/aa3b1b474b0f9789ca55ca46f4b2b57aeae38874/googleads/common.py#L1361-L1365
def _GetZeepFormattedSOAPHeaders(self): """Returns a dict with SOAP headers in the right format for zeep.""" headers = self._header_handler.GetSOAPHeaders(self.CreateSoapElementForType) soap_headers = {'RequestHeader': headers} return soap_headers
[ "def", "_GetZeepFormattedSOAPHeaders", "(", "self", ")", ":", "headers", "=", "self", ".", "_header_handler", ".", "GetSOAPHeaders", "(", "self", ".", "CreateSoapElementForType", ")", "soap_headers", "=", "{", "'RequestHeader'", ":", "headers", "}", "return", "soa...
Returns a dict with SOAP headers in the right format for zeep.
[ "Returns", "a", "dict", "with", "SOAP", "headers", "in", "the", "right", "format", "for", "zeep", "." ]
python
train
saltstack/salt
salt/states/junos.py
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/junos.py#L399-L419
def file_copy(name, dest=None, **kwargs): ''' Copies the file from the local device to the junos device. .. code-block:: yaml /home/m2/info.txt: junos: - file_copy - dest: info_copy.txt Parameters: Required * src: The s...
[ "def", "file_copy", "(", "name", ",", "dest", "=", "None", ",", "*", "*", "kwargs", ")", ":", "ret", "=", "{", "'name'", ":", "name", ",", "'changes'", ":", "{", "}", ",", "'result'", ":", "True", ",", "'comment'", ":", "''", "}", "ret", "[", "...
Copies the file from the local device to the junos device. .. code-block:: yaml /home/m2/info.txt: junos: - file_copy - dest: info_copy.txt Parameters: Required * src: The sorce path where the file is kept. * dest: ...
[ "Copies", "the", "file", "from", "the", "local", "device", "to", "the", "junos", "device", "." ]
python
train
gwpy/gwpy
gwpy/table/io/pycbc.py
https://github.com/gwpy/gwpy/blob/7a92b917e7dd2d99b15895293a1fa1d66cdb210a/gwpy/table/io/pycbc.py#L271-L278
def get_new_snr(h5group, q=6., n=2.): # pylint: disable=invalid-name """Calculate the 'new SNR' column for this PyCBC HDF5 table group """ newsnr = h5group['snr'][:].copy() rchisq = h5group['chisq'][:] idx = numpy.where(rchisq > 1.)[0] newsnr[idx] *= _new_snr_scale(rchisq[idx], q=q, n=n) r...
[ "def", "get_new_snr", "(", "h5group", ",", "q", "=", "6.", ",", "n", "=", "2.", ")", ":", "# pylint: disable=invalid-name", "newsnr", "=", "h5group", "[", "'snr'", "]", "[", ":", "]", ".", "copy", "(", ")", "rchisq", "=", "h5group", "[", "'chisq'", ...
Calculate the 'new SNR' column for this PyCBC HDF5 table group
[ "Calculate", "the", "new", "SNR", "column", "for", "this", "PyCBC", "HDF5", "table", "group" ]
python
train
StackStorm/pybind
pybind/nos/v6_0_2f/interface/port_channel/port_profile_to_interface_associations/port_profile_port/__init__.py
https://github.com/StackStorm/pybind/blob/44c467e71b2b425be63867aba6e6fa28b2cfe7fb/pybind/nos/v6_0_2f/interface/port_channel/port_profile_to_interface_associations/port_profile_port/__init__.py#L135-L160
def _set_port_to_port_profile_associations(self, v, load=False): """ Setter method for port_to_port_profile_associations, mapped from YANG variable /interface/port_channel/port_profile_to_interface_associations/port_profile_port/port_to_port_profile_associations (list) If this variable is read-only (config:...
[ "def", "_set_port_to_port_profile_associations", "(", "self", ",", "v", ",", "load", "=", "False", ")", ":", "if", "hasattr", "(", "v", ",", "\"_utype\"", ")", ":", "v", "=", "v", ".", "_utype", "(", "v", ")", "try", ":", "t", "=", "YANGDynClass", "(...
Setter method for port_to_port_profile_associations, mapped from YANG variable /interface/port_channel/port_profile_to_interface_associations/port_profile_port/port_to_port_profile_associations (list) If this variable is read-only (config: false) in the source YANG file, then _set_port_to_port_profile_associati...
[ "Setter", "method", "for", "port_to_port_profile_associations", "mapped", "from", "YANG", "variable", "/", "interface", "/", "port_channel", "/", "port_profile_to_interface_associations", "/", "port_profile_port", "/", "port_to_port_profile_associations", "(", "list", ")", ...
python
train
assamite/creamas
creamas/mp.py
https://github.com/assamite/creamas/blob/54dc3e31c97a3f938e58272f8ab80b6bcafeff58/creamas/mp.py#L780-L799
def get_connections(self, data=True, as_coro=False): """Return connections from all the agents in the slave environments. :param bool data: If ``True``, returns also the data stored for each connection. :param bool as_coro: If ``True`` returns a coroutine, otherwise run...
[ "def", "get_connections", "(", "self", ",", "data", "=", "True", ",", "as_coro", "=", "False", ")", ":", "async", "def", "slave_task", "(", "addr", ",", "data", ")", ":", "r_manager", "=", "await", "self", ".", "env", ".", "connect", "(", "addr", ")"...
Return connections from all the agents in the slave environments. :param bool data: If ``True``, returns also the data stored for each connection. :param bool as_coro: If ``True`` returns a coroutine, otherwise runs the asynchronous calls to the slave environment ma...
[ "Return", "connections", "from", "all", "the", "agents", "in", "the", "slave", "environments", "." ]
python
train
log2timeline/dfvfs
dfvfs/vfs/ntfs_file_entry.py
https://github.com/log2timeline/dfvfs/blob/2b3ccd115f9901d89f383397d4a1376a873c83c4/dfvfs/vfs/ntfs_file_entry.py#L109-L113
def security_descriptor(self): """pyfwnt.security_descriptor: security descriptor.""" fwnt_security_descriptor = pyfwnt.security_descriptor() fwnt_security_descriptor.copy_from_byte_stream(self._fsntfs_attribute.data) return fwnt_security_descriptor
[ "def", "security_descriptor", "(", "self", ")", ":", "fwnt_security_descriptor", "=", "pyfwnt", ".", "security_descriptor", "(", ")", "fwnt_security_descriptor", ".", "copy_from_byte_stream", "(", "self", ".", "_fsntfs_attribute", ".", "data", ")", "return", "fwnt_sec...
pyfwnt.security_descriptor: security descriptor.
[ "pyfwnt", ".", "security_descriptor", ":", "security", "descriptor", "." ]
python
train
tensorflow/tensor2tensor
tensor2tensor/trax/models/neural_gpu.py
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/trax/models/neural_gpu.py#L50-L60
def ConvDiagonalGRU(units, kernel_size=(3, 3)): """Build convolutional GRU with diagonal gating as in ImprovedNGPU.""" def BuildConv(): return layers.Conv(filters=units, kernel_size=kernel_size, padding='SAME') return layers.GeneralGRUCell( candidate_transform=BuildConv, memory_transform=Diagona...
[ "def", "ConvDiagonalGRU", "(", "units", ",", "kernel_size", "=", "(", "3", ",", "3", ")", ")", ":", "def", "BuildConv", "(", ")", ":", "return", "layers", ".", "Conv", "(", "filters", "=", "units", ",", "kernel_size", "=", "kernel_size", ",", "padding"...
Build convolutional GRU with diagonal gating as in ImprovedNGPU.
[ "Build", "convolutional", "GRU", "with", "diagonal", "gating", "as", "in", "ImprovedNGPU", "." ]
python
train
fvdsn/py-xml-escpos
xmlescpos/escpos.py
https://github.com/fvdsn/py-xml-escpos/blob/7f77e039c960d5773fb919aed02ba392dccbc360/xmlescpos/escpos.py#L206-L212
def end_entity(self): """ ends the entity definition. (but does not cancel the active style!) """ if self.stack[-1] == 'block' and self.dirty: self.escpos._raw('\n') self.dirty = False if len(self.stack) > 1: self.stack = self.stack[:-1]
[ "def", "end_entity", "(", "self", ")", ":", "if", "self", ".", "stack", "[", "-", "1", "]", "==", "'block'", "and", "self", ".", "dirty", ":", "self", ".", "escpos", ".", "_raw", "(", "'\\n'", ")", "self", ".", "dirty", "=", "False", "if", "len",...
ends the entity definition. (but does not cancel the active style!)
[ "ends", "the", "entity", "definition", ".", "(", "but", "does", "not", "cancel", "the", "active", "style!", ")" ]
python
train
deepmind/sonnet
sonnet/examples/brnn_ptb.py
https://github.com/deepmind/sonnet/blob/00612ca3178964d86b556e062694d808ff81fcca/sonnet/examples/brnn_ptb.py#L289-L330
def build_modules(is_training, vocab_size): """Construct the modules used in the graph.""" # Construct the custom getter which implements Bayes by Backprop. if is_training: estimator_mode = tf.constant(bbb.EstimatorModes.sample) else: estimator_mode = tf.constant(bbb.EstimatorModes.mean) lstm_bbb_cus...
[ "def", "build_modules", "(", "is_training", ",", "vocab_size", ")", ":", "# Construct the custom getter which implements Bayes by Backprop.", "if", "is_training", ":", "estimator_mode", "=", "tf", ".", "constant", "(", "bbb", ".", "EstimatorModes", ".", "sample", ")", ...
Construct the modules used in the graph.
[ "Construct", "the", "modules", "used", "in", "the", "graph", "." ]
python
train
armet/python-armet
armet/http/response.py
https://github.com/armet/python-armet/blob/d61eca9082256cb1e7f7f3c7f2fbc4b697157de7/armet/http/response.py#L347-L362
def serialize(self, data, format=None): """Serializes the data into this response using a serializer. @param[in] data The data to be serialized. @param[in] format A specific format to serialize in; if provided, no detection is done. If not provided, the acce...
[ "def", "serialize", "(", "self", ",", "data", ",", "format", "=", "None", ")", ":", "return", "self", ".", "_resource", ".", "serialize", "(", "data", ",", "response", "=", "self", ",", "format", "=", "format", ")" ]
Serializes the data into this response using a serializer. @param[in] data The data to be serialized. @param[in] format A specific format to serialize in; if provided, no detection is done. If not provided, the accept header (as well as the URL extension...
[ "Serializes", "the", "data", "into", "this", "response", "using", "a", "serializer", "." ]
python
valid
alexprengere/FormalSystems
formalsystems/formalsystems.py
https://github.com/alexprengere/FormalSystems/blob/e46d9cc6f8dc076e9dc86f6f8511fc6f3aa95f6e/formalsystems/formalsystems.py#L53-L84
def triangle_iteration(start, dim, stop=None): """ >>> list(triangle_iteration(1, 1, stop=3)) [(1,), (2,), (3,)] >>> list(triangle_iteration(1, 2, stop=3)) [(1, 1), (1, 2), (2, 1), (1, 3), (3, 1), (2, 2)] >>> list(triangle_iteration(1, 0, stop=3)) [] """ if not dim: return ...
[ "def", "triangle_iteration", "(", "start", ",", "dim", ",", "stop", "=", "None", ")", ":", "if", "not", "dim", ":", "return", "# Initialization", "point", "=", "(", "start", ",", ")", "*", "dim", "frontier", "=", "set", "(", "[", "point", "]", ")", ...
>>> list(triangle_iteration(1, 1, stop=3)) [(1,), (2,), (3,)] >>> list(triangle_iteration(1, 2, stop=3)) [(1, 1), (1, 2), (2, 1), (1, 3), (3, 1), (2, 2)] >>> list(triangle_iteration(1, 0, stop=3)) []
[ ">>>", "list", "(", "triangle_iteration", "(", "1", "1", "stop", "=", "3", "))", "[", "(", "1", ")", "(", "2", ")", "(", "3", ")", "]", ">>>", "list", "(", "triangle_iteration", "(", "1", "2", "stop", "=", "3", "))", "[", "(", "1", "1", ")", ...
python
train
collectiveacuity/labPack
labpack/parsing/comparison.py
https://github.com/collectiveacuity/labPack/blob/52949ece35e72e3cc308f54d9ffa6bfbd96805b8/labpack/parsing/comparison.py#L36-L78
def _compare_dict(new_dict, old_dict, change_list=None, root=None): ''' a method for recursively listing changes made to a dictionary :param new_dict: dictionary with new key-value pairs :param old_dict: dictionary with old key-value pairs :param change_list: list of differences between old an...
[ "def", "_compare_dict", "(", "new_dict", ",", "old_dict", ",", "change_list", "=", "None", ",", "root", "=", "None", ")", ":", "from", "copy", "import", "deepcopy", "new_keys", "=", "set", "(", "new_dict", ".", "keys", "(", ")", ")", "old_keys", "=", "...
a method for recursively listing changes made to a dictionary :param new_dict: dictionary with new key-value pairs :param old_dict: dictionary with old key-value pairs :param change_list: list of differences between old and new :patam root: string with record of path to the root of the main object ...
[ "a", "method", "for", "recursively", "listing", "changes", "made", "to", "a", "dictionary" ]
python
train
spulec/moto
moto/cloudformation/parsing.py
https://github.com/spulec/moto/blob/4a286c4bc288933bb023396e2784a6fdbb966bc9/moto/cloudformation/parsing.py#L127-L232
def clean_json(resource_json, resources_map): """ Cleanup the a resource dict. For now, this just means replacing any Ref node with the corresponding physical_resource_id. Eventually, this is where we would add things like function parsing (fn::) """ if isinstance(resource_json, dict): ...
[ "def", "clean_json", "(", "resource_json", ",", "resources_map", ")", ":", "if", "isinstance", "(", "resource_json", ",", "dict", ")", ":", "if", "'Ref'", "in", "resource_json", ":", "# Parse resource reference", "resource", "=", "resources_map", "[", "resource_js...
Cleanup the a resource dict. For now, this just means replacing any Ref node with the corresponding physical_resource_id. Eventually, this is where we would add things like function parsing (fn::)
[ "Cleanup", "the", "a", "resource", "dict", ".", "For", "now", "this", "just", "means", "replacing", "any", "Ref", "node", "with", "the", "corresponding", "physical_resource_id", "." ]
python
train
jupyter-widgets/ipywidgets
ipywidgets/widgets/widget.py
https://github.com/jupyter-widgets/ipywidgets/blob/36fe37594cd5a268def228709ca27e37b99ac606/ipywidgets/widgets/widget.py#L472-L488
def send_state(self, key=None): """Sends the widget state, or a piece of it, to the front-end, if it exists. Parameters ---------- key : unicode, or iterable (optional) A single property's name or iterable of property names to sync with the front-end. """ sta...
[ "def", "send_state", "(", "self", ",", "key", "=", "None", ")", ":", "state", "=", "self", ".", "get_state", "(", "key", "=", "key", ")", "if", "len", "(", "state", ")", ">", "0", ":", "if", "self", ".", "_property_lock", ":", "# we need to keep this...
Sends the widget state, or a piece of it, to the front-end, if it exists. Parameters ---------- key : unicode, or iterable (optional) A single property's name or iterable of property names to sync with the front-end.
[ "Sends", "the", "widget", "state", "or", "a", "piece", "of", "it", "to", "the", "front", "-", "end", "if", "it", "exists", "." ]
python
train
ziwenxie/netease-dl
netease/weapi.py
https://github.com/ziwenxie/netease-dl/blob/84b226fc07b10f7f66580f0fc69f10356f66b5c3/netease/weapi.py#L86-L101
def post_request(self, url, params): """Send a post request. :return: a dict or raise Exception. """ data = encrypted_request(params) resp = self.session.post(url, data=data, timeout=self.timeout, proxies=self.proxies) result = resp.json...
[ "def", "post_request", "(", "self", ",", "url", ",", "params", ")", ":", "data", "=", "encrypted_request", "(", "params", ")", "resp", "=", "self", ".", "session", ".", "post", "(", "url", ",", "data", "=", "data", ",", "timeout", "=", "self", ".", ...
Send a post request. :return: a dict or raise Exception.
[ "Send", "a", "post", "request", "." ]
python
train
koodaamo/iconframer
iconframer/iconframer.py
https://github.com/koodaamo/iconframer/blob/58d71fd78bfe3893a7f20384f429592d033d802a/iconframer/iconframer.py#L138-L161
def convert_svg(svgstr, size, filepath, target): "convert to PDF or PNG" # PREPARE CONVERSION PER TYPE if target == "PDF": img = cairo.PDFSurface(filepath, size, size) elif target == "PNG": img = cairo.ImageSurface(cairo.FORMAT_ARGB32, size, size) else: system.exit("unknown f...
[ "def", "convert_svg", "(", "svgstr", ",", "size", ",", "filepath", ",", "target", ")", ":", "# PREPARE CONVERSION PER TYPE", "if", "target", "==", "\"PDF\"", ":", "img", "=", "cairo", ".", "PDFSurface", "(", "filepath", ",", "size", ",", "size", ")", "elif...
convert to PDF or PNG
[ "convert", "to", "PDF", "or", "PNG" ]
python
train
thautwarm/EBNFParser
Python/Ruikowa/ObjectRegex/Tokenizer.py
https://github.com/thautwarm/EBNFParser/blob/101a92c4f408f9e6ce7b55aacb39cded9394521d/Python/Ruikowa/ObjectRegex/Tokenizer.py#L208-L221
def regex_matcher(regex_pat): """ generate token names' cache :param regex_pat: :return: """ if isinstance(regex_pat, str): regex_pat = re.compile(regex_pat) def f(inp_str, pos): m = regex_pat.match(inp_str, pos) return m.group() if m else None retu...
[ "def", "regex_matcher", "(", "regex_pat", ")", ":", "if", "isinstance", "(", "regex_pat", ",", "str", ")", ":", "regex_pat", "=", "re", ".", "compile", "(", "regex_pat", ")", "def", "f", "(", "inp_str", ",", "pos", ")", ":", "m", "=", "regex_pat", "....
generate token names' cache :param regex_pat: :return:
[ "generate", "token", "names", "cache", ":", "param", "regex_pat", ":", ":", "return", ":" ]
python
train
Robin8Put/pmes
ams/views.py
https://github.com/Robin8Put/pmes/blob/338bec94162098f05b75bad035417317e1252fd2/ams/views.py#L193-L254
async def get(self, public_key): """ Receive account data Accepts: Query string: - "public_key" - str Query string params: - message ( signed dictionary ): - "timestamp" - str Returns: - "device_id" - str - "phone" - str - "public_key" - str - "count" - int ( wallets amount ...
[ "async", "def", "get", "(", "self", ",", "public_key", ")", ":", "# Signature verification", "if", "settings", ".", "SIGNATURE_VERIFICATION", ":", "super", "(", ")", ".", "verify", "(", ")", "# Get users request source", "compiler", "=", "re", ".", "compile", ...
Receive account data Accepts: Query string: - "public_key" - str Query string params: - message ( signed dictionary ): - "timestamp" - str Returns: - "device_id" - str - "phone" - str - "public_key" - str - "count" - int ( wallets amount ) - "level" - int (2 by default) ...
[ "Receive", "account", "data" ]
python
train
MonashBI/arcana
arcana/repository/tree.py
https://github.com/MonashBI/arcana/blob/d6271a29d13733d00422d11417af8d200be62acc/arcana/repository/tree.py#L114-L199
def fileset(self, name, from_study=None, format=None): # @ReservedAssignment @IgnorePep8 """ Gets the fileset named 'name' produced by the Study named 'study' if provided. If a spec is passed instead of a str to the name argument, then the study will be set from the spec iff it is deriv...
[ "def", "fileset", "(", "self", ",", "name", ",", "from_study", "=", "None", ",", "format", "=", "None", ")", ":", "# @ReservedAssignment @IgnorePep8", "if", "isinstance", "(", "name", ",", "BaseFileset", ")", ":", "if", "from_study", "is", "None", "and", "...
Gets the fileset named 'name' produced by the Study named 'study' if provided. If a spec is passed instead of a str to the name argument, then the study will be set from the spec iff it is derived Parameters ---------- name : str | FilesetSpec The name of the fileset...
[ "Gets", "the", "fileset", "named", "name", "produced", "by", "the", "Study", "named", "study", "if", "provided", ".", "If", "a", "spec", "is", "passed", "instead", "of", "a", "str", "to", "the", "name", "argument", "then", "the", "study", "will", "be", ...
python
train
saltstack/salt
salt/states/tomcat.py
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/tomcat.py#L297-L349
def undeployed(name, url='http://localhost:8080/manager', timeout=180): ''' Enforce that the WAR will be undeployed from the server name The context path to undeploy. url : http://localhost:8080/manager The URL of the server with the Tomcat Manager webapp. ...
[ "def", "undeployed", "(", "name", ",", "url", "=", "'http://localhost:8080/manager'", ",", "timeout", "=", "180", ")", ":", "# Prepare", "ret", "=", "{", "'name'", ":", "name", ",", "'result'", ":", "True", ",", "'changes'", ":", "{", "}", ",", "'comment...
Enforce that the WAR will be undeployed from the server name The context path to undeploy. url : http://localhost:8080/manager The URL of the server with the Tomcat Manager webapp. timeout : 180 Timeout for HTTP request to the Tomcat Manager. Example: .. code-block:: yaml ...
[ "Enforce", "that", "the", "WAR", "will", "be", "undeployed", "from", "the", "server" ]
python
train
pypa/pipenv
pipenv/vendor/pexpect/screen.py
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/pexpect/screen.py#L273-L278
def cursor_constrain (self): '''This keeps the cursor within the screen area. ''' self.cur_r = constrain (self.cur_r, 1, self.rows) self.cur_c = constrain (self.cur_c, 1, self.cols)
[ "def", "cursor_constrain", "(", "self", ")", ":", "self", ".", "cur_r", "=", "constrain", "(", "self", ".", "cur_r", ",", "1", ",", "self", ".", "rows", ")", "self", ".", "cur_c", "=", "constrain", "(", "self", ".", "cur_c", ",", "1", ",", "self", ...
This keeps the cursor within the screen area.
[ "This", "keeps", "the", "cursor", "within", "the", "screen", "area", "." ]
python
train
Qiskit/qiskit-terra
qiskit/extensions/standard/ubase.py
https://github.com/Qiskit/qiskit-terra/blob/d4f58d903bc96341b816f7c35df936d6421267d1/qiskit/extensions/standard/ubase.py#L50-L52
def u_base(self, theta, phi, lam, q): """Apply U to q.""" return self.append(UBase(theta, phi, lam), [q], [])
[ "def", "u_base", "(", "self", ",", "theta", ",", "phi", ",", "lam", ",", "q", ")", ":", "return", "self", ".", "append", "(", "UBase", "(", "theta", ",", "phi", ",", "lam", ")", ",", "[", "q", "]", ",", "[", "]", ")" ]
Apply U to q.
[ "Apply", "U", "to", "q", "." ]
python
test
datadotworld/data.world-py
datadotworld/cli.py
https://github.com/datadotworld/data.world-py/blob/ffaeb115f358731ab0b805b0c43b7ff2e3cf0a77/datadotworld/cli.py#L31-L41
def cli(ctx, profile): """dw commands support working with multiple data.world accounts \b Use a different <profile> value for each account. In the absence of a <profile>, 'default' will be used. """ if ctx.obj is None: ctx.obj = {} ctx.obj['profile'] = profile pass
[ "def", "cli", "(", "ctx", ",", "profile", ")", ":", "if", "ctx", ".", "obj", "is", "None", ":", "ctx", ".", "obj", "=", "{", "}", "ctx", ".", "obj", "[", "'profile'", "]", "=", "profile", "pass" ]
dw commands support working with multiple data.world accounts \b Use a different <profile> value for each account. In the absence of a <profile>, 'default' will be used.
[ "dw", "commands", "support", "working", "with", "multiple", "data", ".", "world", "accounts" ]
python
train
pantsbuild/pants
src/python/pants/backend/jvm/ivy_utils.py
https://github.com/pantsbuild/pants/blob/b72e650da0df685824ffdcc71988b8c282d0962d/src/python/pants/backend/jvm/ivy_utils.py#L995-L1017
def generate_fetch_ivy(cls, jars, ivyxml, confs, resolve_hash_name): """Generates an ivy xml with all jars marked as intransitive using the all conflict manager.""" org = IvyUtils.INTERNAL_ORG_NAME name = resolve_hash_name extra_configurations = [conf for conf in confs if conf and conf != 'default'] ...
[ "def", "generate_fetch_ivy", "(", "cls", ",", "jars", ",", "ivyxml", ",", "confs", ",", "resolve_hash_name", ")", ":", "org", "=", "IvyUtils", ".", "INTERNAL_ORG_NAME", "name", "=", "resolve_hash_name", "extra_configurations", "=", "[", "conf", "for", "conf", ...
Generates an ivy xml with all jars marked as intransitive using the all conflict manager.
[ "Generates", "an", "ivy", "xml", "with", "all", "jars", "marked", "as", "intransitive", "using", "the", "all", "conflict", "manager", "." ]
python
train
abhishek-ram/pyas2-lib
pyas2lib/utils.py
https://github.com/abhishek-ram/pyas2-lib/blob/6af6bc71fe8a8cfb3465dad82ecc50539e3fd551/pyas2lib/utils.py#L148-L175
def verify_certificate_chain(cert_str, trusted_certs, ignore_self_signed=True): """ Verify a given certificate against a trust store""" # Load the certificate certificate = crypto.load_certificate(crypto.FILETYPE_ASN1, cert_str) # Create a certificate store and add your trusted certs try: ...
[ "def", "verify_certificate_chain", "(", "cert_str", ",", "trusted_certs", ",", "ignore_self_signed", "=", "True", ")", ":", "# Load the certificate", "certificate", "=", "crypto", ".", "load_certificate", "(", "crypto", ".", "FILETYPE_ASN1", ",", "cert_str", ")", "#...
Verify a given certificate against a trust store
[ "Verify", "a", "given", "certificate", "against", "a", "trust", "store" ]
python
train
shreyaspotnis/rampage
rampage/ramps.py
https://github.com/shreyaspotnis/rampage/blob/e2565aef7ee16ee06523de975e8aa41aca14e3b2/rampage/ramps.py#L72-L90
def get_absolute_time(self, key): """Returns the absolute time position of the key. If absolute time positions are not calculated, then this function calculates it. """ keyframe = self.dct[key] try: # if absolute time is already calculated, return that ...
[ "def", "get_absolute_time", "(", "self", ",", "key", ")", ":", "keyframe", "=", "self", ".", "dct", "[", "key", "]", "try", ":", "# if absolute time is already calculated, return that", "return", "keyframe", "[", "'__abs_time__'", "]", "except", "KeyError", ":", ...
Returns the absolute time position of the key. If absolute time positions are not calculated, then this function calculates it.
[ "Returns", "the", "absolute", "time", "position", "of", "the", "key", "." ]
python
train
blue-yonder/tsfresh
tsfresh/feature_extraction/feature_calculators.py
https://github.com/blue-yonder/tsfresh/blob/c72c9c574371cf7dd7d54e00a466792792e5d202/tsfresh/feature_extraction/feature_calculators.py#L324-L366
def agg_autocorrelation(x, param): r""" Calculates the value of an aggregation function :math:`f_{agg}` (e.g. the variance or the mean) over the autocorrelation :math:`R(l)` for different lags. The autocorrelation :math:`R(l)` for lag :math:`l` is defined as .. math:: R(l) = \frac{1}{(n-l)\sig...
[ "def", "agg_autocorrelation", "(", "x", ",", "param", ")", ":", "# if the time series is longer than the following threshold, we use fft to calculate the acf", "THRESHOLD_TO_USE_FFT", "=", "1250", "var", "=", "np", ".", "var", "(", "x", ")", "n", "=", "len", "(", "x",...
r""" Calculates the value of an aggregation function :math:`f_{agg}` (e.g. the variance or the mean) over the autocorrelation :math:`R(l)` for different lags. The autocorrelation :math:`R(l)` for lag :math:`l` is defined as .. math:: R(l) = \frac{1}{(n-l)\sigma^{2}} \sum_{t=1}^{n-l}(X_{t}-\mu )(X_...
[ "r", "Calculates", "the", "value", "of", "an", "aggregation", "function", ":", "math", ":", "f_", "{", "agg", "}", "(", "e", ".", "g", ".", "the", "variance", "or", "the", "mean", ")", "over", "the", "autocorrelation", ":", "math", ":", "R", "(", "...
python
train
NASA-AMMOS/AIT-Core
ait/core/api.py
https://github.com/NASA-AMMOS/AIT-Core/blob/9d85bd9c738e7a6a6fbdff672bea708238b02a3a/ait/core/api.py#L299-L305
def extend(self, iterable): """Extend the right side of this GeventDeque by appending elements from the iterable argument. """ self._deque.extend(iterable) if len(self._deque) > 0: self.notEmpty.set()
[ "def", "extend", "(", "self", ",", "iterable", ")", ":", "self", ".", "_deque", ".", "extend", "(", "iterable", ")", "if", "len", "(", "self", ".", "_deque", ")", ">", "0", ":", "self", ".", "notEmpty", ".", "set", "(", ")" ]
Extend the right side of this GeventDeque by appending elements from the iterable argument.
[ "Extend", "the", "right", "side", "of", "this", "GeventDeque", "by", "appending", "elements", "from", "the", "iterable", "argument", "." ]
python
train
TheHive-Project/Cortex-Analyzers
analyzers/Censys/censys_analyzer.py
https://github.com/TheHive-Project/Cortex-Analyzers/blob/8dae6a8c4cf9af5554ae8c844985c4b44d4bd4bf/analyzers/Censys/censys_analyzer.py#L24-L33
def search_hosts(self, ip): """ Searches for a host using its ipv4 address :param ip: ipv4 address as string :type ip: str :return: dict """ c = CensysIPv4(api_id=self.__uid, api_secret=self.__api_key) return c.view(ip)
[ "def", "search_hosts", "(", "self", ",", "ip", ")", ":", "c", "=", "CensysIPv4", "(", "api_id", "=", "self", ".", "__uid", ",", "api_secret", "=", "self", ".", "__api_key", ")", "return", "c", ".", "view", "(", "ip", ")" ]
Searches for a host using its ipv4 address :param ip: ipv4 address as string :type ip: str :return: dict
[ "Searches", "for", "a", "host", "using", "its", "ipv4", "address" ]
python
train
iotaledger/iota.lib.py
iota/transaction/creation.py
https://github.com/iotaledger/iota.lib.py/blob/97cdd1e241498446b46157b79b2a1ea2ec6d387a/iota/transaction/creation.py#L466-L490
def _create_input_transactions(self, addy): # type: (Address) -> None """ Creates transactions for the specified input address. """ self._transactions.append(ProposedTransaction( address=addy, tag=self.tag, # Spend the entire address balance; ...
[ "def", "_create_input_transactions", "(", "self", ",", "addy", ")", ":", "# type: (Address) -> None", "self", ".", "_transactions", ".", "append", "(", "ProposedTransaction", "(", "address", "=", "addy", ",", "tag", "=", "self", ".", "tag", ",", "# Spend the ent...
Creates transactions for the specified input address.
[ "Creates", "transactions", "for", "the", "specified", "input", "address", "." ]
python
test
tmux-python/tmuxp
tmuxp/config.py
https://github.com/tmux-python/tmuxp/blob/f4aa2e26589a4311131898d2e4a85cb1876b5c9b/tmuxp/config.py#L72-L95
def in_dir( config_dir=os.path.expanduser('~/.tmuxp'), extensions=['.yml', '.yaml', '.json'] ): """ Return a list of configs in ``config_dir``. Parameters ---------- config_dir : str directory to search extensions : list filetypes to check (e.g. ``['.yaml', '.json']``). ...
[ "def", "in_dir", "(", "config_dir", "=", "os", ".", "path", ".", "expanduser", "(", "'~/.tmuxp'", ")", ",", "extensions", "=", "[", "'.yml'", ",", "'.yaml'", ",", "'.json'", "]", ")", ":", "configs", "=", "[", "]", "for", "filename", "in", "os", ".",...
Return a list of configs in ``config_dir``. Parameters ---------- config_dir : str directory to search extensions : list filetypes to check (e.g. ``['.yaml', '.json']``). Returns ------- list
[ "Return", "a", "list", "of", "configs", "in", "config_dir", "." ]
python
train
PmagPy/PmagPy
programs/demag_gui.py
https://github.com/PmagPy/PmagPy/blob/c7984f8809bf40fe112e53dcc311a33293b62d0b/programs/demag_gui.py#L8394-L8420
def on_enter_fit_name(self, event): """ Allows the entering of new fit names in the fit combobox Parameters ---------- event : the wx.ComboBoxEvent that triggers this function Alters ------ current_fit.name """ if self.current_fit == None...
[ "def", "on_enter_fit_name", "(", "self", ",", "event", ")", ":", "if", "self", ".", "current_fit", "==", "None", ":", "self", ".", "on_btn_add_fit", "(", "event", ")", "value", "=", "self", ".", "fit_box", ".", "GetValue", "(", ")", "if", "':'", "in", ...
Allows the entering of new fit names in the fit combobox Parameters ---------- event : the wx.ComboBoxEvent that triggers this function Alters ------ current_fit.name
[ "Allows", "the", "entering", "of", "new", "fit", "names", "in", "the", "fit", "combobox" ]
python
train
spotify/snakebite
snakebite/client.py
https://github.com/spotify/snakebite/blob/6a456e6100b0c1be66cc1f7f9d7f50494f369da3/snakebite/client.py#L1025-L1054
def serverdefaults(self, force_reload=False): '''Get server defaults, caching the results. If there are no results saved, or the force_reload flag is True, it will query the HDFS server for its default parameter values. Otherwise, it will simply return the results it has already queried. ...
[ "def", "serverdefaults", "(", "self", ",", "force_reload", "=", "False", ")", ":", "if", "not", "self", ".", "_server_defaults", "or", "force_reload", ":", "request", "=", "client_proto", ".", "GetServerDefaultsRequestProto", "(", ")", "response", "=", "self", ...
Get server defaults, caching the results. If there are no results saved, or the force_reload flag is True, it will query the HDFS server for its default parameter values. Otherwise, it will simply return the results it has already queried. Note: This function returns a copy of the results loade...
[ "Get", "server", "defaults", "caching", "the", "results", ".", "If", "there", "are", "no", "results", "saved", "or", "the", "force_reload", "flag", "is", "True", "it", "will", "query", "the", "HDFS", "server", "for", "its", "default", "parameter", "values", ...
python
train
maxpumperla/elephas
elephas/utils/rwlock.py
https://github.com/maxpumperla/elephas/blob/84605acdc9564673c487637dcb27f5def128bcc7/elephas/utils/rwlock.py#L49-L68
def release(self): """ Release a lock, whether read or write. """ self.monitor.acquire() if self.rwlock < 0: self.rwlock = 0 else: self.rwlock -= 1 wake_writers = self.writers_waiting and self.rwlock == 0 wake_readers = self.writers...
[ "def", "release", "(", "self", ")", ":", "self", ".", "monitor", ".", "acquire", "(", ")", "if", "self", ".", "rwlock", "<", "0", ":", "self", ".", "rwlock", "=", "0", "else", ":", "self", ".", "rwlock", "-=", "1", "wake_writers", "=", "self", "....
Release a lock, whether read or write.
[ "Release", "a", "lock", "whether", "read", "or", "write", "." ]
python
train
h2oai/h2o-3
py2/ec2_cmd.py
https://github.com/h2oai/h2o-3/blob/dd62aaa1e7f680a8b16ee14bc66b0fb5195c2ad8/py2/ec2_cmd.py#L200-L206
def terminate_instances(instances, region): '''terminate all the instances given by its ids''' if not instances: return conn = ec2_connect(region) log("Terminating instances {0}.".format(instances)) conn.terminate_instances(instances) log("Done")
[ "def", "terminate_instances", "(", "instances", ",", "region", ")", ":", "if", "not", "instances", ":", "return", "conn", "=", "ec2_connect", "(", "region", ")", "log", "(", "\"Terminating instances {0}.\"", ".", "format", "(", "instances", ")", ")", "conn", ...
terminate all the instances given by its ids
[ "terminate", "all", "the", "instances", "given", "by", "its", "ids" ]
python
test
gwastro/pycbc
pycbc/distributions/bounded.py
https://github.com/gwastro/pycbc/blob/7a64cdd104d263f1b6ea0b01e6841837d05a4cb3/pycbc/distributions/bounded.py#L118-L198
def bounded_from_config(cls, cp, section, variable_args, bounds_required=False, additional_opts=None): """Returns a bounded distribution based on a configuration file. The parameters for the distribution are retrieved from the section titled "[`section`-`variable_args`]" in the config file. Par...
[ "def", "bounded_from_config", "(", "cls", ",", "cp", ",", "section", ",", "variable_args", ",", "bounds_required", "=", "False", ",", "additional_opts", "=", "None", ")", ":", "tag", "=", "variable_args", "variable_args", "=", "variable_args", ".", "split", "(...
Returns a bounded distribution based on a configuration file. The parameters for the distribution are retrieved from the section titled "[`section`-`variable_args`]" in the config file. Parameters ---------- cls : pycbc.prior class The class to initialize with. cp : pycbc.workflow.Workf...
[ "Returns", "a", "bounded", "distribution", "based", "on", "a", "configuration", "file", ".", "The", "parameters", "for", "the", "distribution", "are", "retrieved", "from", "the", "section", "titled", "[", "section", "-", "variable_args", "]", "in", "the", "con...
python
train
datastore/datastore
datastore/core/basic.py
https://github.com/datastore/datastore/blob/7ccf0cd4748001d3dbf5e6dda369b0f63e0269d3/datastore/core/basic.py#L656-L673
def nestedPath(path, depth, length): '''returns a nested version of `basename`, using the starting characters. For example: >>> NestedPathDatastore.nested_path('abcdefghijk', 3, 2) 'ab/cd/ef' >>> NestedPathDatastore.nested_path('abcdefghijk', 4, 2) 'ab/cd/ef/gh' >>> Ne...
[ "def", "nestedPath", "(", "path", ",", "depth", ",", "length", ")", ":", "components", "=", "[", "path", "[", "n", ":", "n", "+", "length", "]", "for", "n", "in", "xrange", "(", "0", ",", "len", "(", "path", ")", ",", "length", ")", "]", "compo...
returns a nested version of `basename`, using the starting characters. For example: >>> NestedPathDatastore.nested_path('abcdefghijk', 3, 2) 'ab/cd/ef' >>> NestedPathDatastore.nested_path('abcdefghijk', 4, 2) 'ab/cd/ef/gh' >>> NestedPathDatastore.nested_path('abcdefghijk',...
[ "returns", "a", "nested", "version", "of", "basename", "using", "the", "starting", "characters", ".", "For", "example", ":" ]
python
train
loli/medpy
medpy/features/intensity.py
https://github.com/loli/medpy/blob/95216b9e22e7ce301f0edf953ee2a2f1b6c6aee5/medpy/features/intensity.py#L210-L244
def shifted_mean_gauss(image, offset = None, sigma = 5, voxelspacing = None, mask = slice(None)): r""" The approximate mean over a small region at an offset from each voxel. Functions like `local_mean_gauss`, but instead of computing the average over a small patch around the current voxel, the regi...
[ "def", "shifted_mean_gauss", "(", "image", ",", "offset", "=", "None", ",", "sigma", "=", "5", ",", "voxelspacing", "=", "None", ",", "mask", "=", "slice", "(", "None", ")", ")", ":", "return", "_extract_feature", "(", "_extract_shifted_mean_gauss", ",", "...
r""" The approximate mean over a small region at an offset from each voxel. Functions like `local_mean_gauss`, but instead of computing the average over a small patch around the current voxel, the region is centered at an offset away. Can be used to use a distant regions average as feature for a vo...
[ "r", "The", "approximate", "mean", "over", "a", "small", "region", "at", "an", "offset", "from", "each", "voxel", ".", "Functions", "like", "local_mean_gauss", "but", "instead", "of", "computing", "the", "average", "over", "a", "small", "patch", "around", "t...
python
train
pytroll/satpy
satpy/writers/__init__.py
https://github.com/pytroll/satpy/blob/1f21d20ac686b745fb0da9b4030d139893e066dd/satpy/writers/__init__.py#L284-L302
def add_text(orig, dc, img, text=None): """Add text to an image using the pydecorate package. All the features of pydecorate's ``add_text`` are available. See documentation of :doc:`pydecorate:index` for more info. """ LOG.info("Add text to image.") dc.add_text(**text) arr = da.from_arra...
[ "def", "add_text", "(", "orig", ",", "dc", ",", "img", ",", "text", "=", "None", ")", ":", "LOG", ".", "info", "(", "\"Add text to image.\"", ")", "dc", ".", "add_text", "(", "*", "*", "text", ")", "arr", "=", "da", ".", "from_array", "(", "np", ...
Add text to an image using the pydecorate package. All the features of pydecorate's ``add_text`` are available. See documentation of :doc:`pydecorate:index` for more info.
[ "Add", "text", "to", "an", "image", "using", "the", "pydecorate", "package", "." ]
python
train
treyhunner/django-simple-history
simple_history/admin.py
https://github.com/treyhunner/django-simple-history/blob/85758ecfe608279508a3fb5b71654d3e202eb63d/simple_history/admin.py#L44-L96
def history_view(self, request, object_id, extra_context=None): """The 'history' admin view for this model.""" request.current_app = self.admin_site.name model = self.model opts = model._meta app_label = opts.app_label pk_name = opts.pk.attname history = getattr(m...
[ "def", "history_view", "(", "self", ",", "request", ",", "object_id", ",", "extra_context", "=", "None", ")", ":", "request", ".", "current_app", "=", "self", ".", "admin_site", ".", "name", "model", "=", "self", ".", "model", "opts", "=", "model", ".", ...
The 'history' admin view for this model.
[ "The", "history", "admin", "view", "for", "this", "model", "." ]
python
train
thespacedoctor/rockAtlas
rockAtlas/positions/pyephemPositions.py
https://github.com/thespacedoctor/rockAtlas/blob/062ecaa95ab547efda535aa33165944f13c621de/rockAtlas/positions/pyephemPositions.py#L267-L291
def _get_xephem_orbital_elements( self): """*get xephem orbital elements* **Key Arguments:** - ``xephemOE`` -- a list of xephem database format strings for use with pyephem """ self.log.info('starting the ``_get_xephem_orbital_elements`` method') print "...
[ "def", "_get_xephem_orbital_elements", "(", "self", ")", ":", "self", ".", "log", ".", "info", "(", "'starting the ``_get_xephem_orbital_elements`` method'", ")", "print", "\"Getting the XEphem orbital element strings from the database\"", "sqlQuery", "=", "u\"\"\"\n s...
*get xephem orbital elements* **Key Arguments:** - ``xephemOE`` -- a list of xephem database format strings for use with pyephem
[ "*", "get", "xephem", "orbital", "elements", "*" ]
python
train
materialsproject/pymatgen
pymatgen/analysis/defects/corrections.py
https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/analysis/defects/corrections.py#L56-L121
def get_correction(self, entry): """ Gets the Freysoldt correction for a defect entry Args: entry (DefectEntry): defect entry to compute Freysoldt correction on. Requires following parameters in the DefectEntry to exist: axis_grid (3 x NGX where N...
[ "def", "get_correction", "(", "self", ",", "entry", ")", ":", "if", "not", "self", ".", "axis", ":", "list_axis_grid", "=", "np", ".", "array", "(", "entry", ".", "parameters", "[", "\"axis_grid\"", "]", ")", "list_bulk_plnr_avg_esp", "=", "np", ".", "ar...
Gets the Freysoldt correction for a defect entry Args: entry (DefectEntry): defect entry to compute Freysoldt correction on. Requires following parameters in the DefectEntry to exist: axis_grid (3 x NGX where NGX is the length of the NGX grid ...
[ "Gets", "the", "Freysoldt", "correction", "for", "a", "defect", "entry", "Args", ":", "entry", "(", "DefectEntry", ")", ":", "defect", "entry", "to", "compute", "Freysoldt", "correction", "on", ".", "Requires", "following", "parameters", "in", "the", "DefectEn...
python
train
aequitas/python-rflink
rflink/protocol.py
https://github.com/aequitas/python-rflink/blob/46759ce8daf95cfc7cdb608ae17bc5501be9f6d8/rflink/protocol.py#L165-L188
def send_command_ack(self, device_id, action): """Send command, wait for gateway to repond with acknowledgment.""" # serialize commands yield from self._ready_to_send.acquire() acknowledgement = None try: self._command_ack.clear() self.send_command(device_...
[ "def", "send_command_ack", "(", "self", ",", "device_id", ",", "action", ")", ":", "# serialize commands", "yield", "from", "self", ".", "_ready_to_send", ".", "acquire", "(", ")", "acknowledgement", "=", "None", "try", ":", "self", ".", "_command_ack", ".", ...
Send command, wait for gateway to repond with acknowledgment.
[ "Send", "command", "wait", "for", "gateway", "to", "repond", "with", "acknowledgment", "." ]
python
train
ueg1990/faker-schema
faker_schema/faker_schema.py
https://github.com/ueg1990/faker-schema/blob/419175eaf34baa43b306dd05c17362763948ec49/faker_schema/faker_schema.py#L13-L32
def _generate_one_fake(self, schema): """ Recursively traverse schema dictionary and for each "leaf node", evaluate the fake value Implementation: For each key-value pair: 1) If value is not an iterable (i.e. dict or list), evaluate the fake data (base case) 2) I...
[ "def", "_generate_one_fake", "(", "self", ",", "schema", ")", ":", "data", "=", "{", "}", "for", "k", ",", "v", "in", "schema", ".", "items", "(", ")", ":", "if", "isinstance", "(", "v", ",", "dict", ")", ":", "data", "[", "k", "]", "=", "self"...
Recursively traverse schema dictionary and for each "leaf node", evaluate the fake value Implementation: For each key-value pair: 1) If value is not an iterable (i.e. dict or list), evaluate the fake data (base case) 2) If value is a dictionary, recurse 3) If value is a ...
[ "Recursively", "traverse", "schema", "dictionary", "and", "for", "each", "leaf", "node", "evaluate", "the", "fake", "value" ]
python
train
bitesofcode/projexui
projexui/widgets/xchart/renderers/xlinerenderer.py
https://github.com/bitesofcode/projexui/blob/f18a73bec84df90b034ca69b9deea118dbedfc4d/projexui/widgets/xchart/renderers/xlinerenderer.py#L71-L103
def drawItem(self, item, painter, option): """ Draws the inputed item as a bar graph. :param item | <XChartDatasetItem> painter | <QPainter> option | <QStyleOptionGraphicsItem> """ dataset = item.dataset() ...
[ "def", "drawItem", "(", "self", ",", "item", ",", "painter", ",", "option", ")", ":", "dataset", "=", "item", ".", "dataset", "(", ")", "painter", ".", "save", "(", ")", "painter", ".", "setRenderHint", "(", "painter", ".", "Antialiasing", ")", "pen", ...
Draws the inputed item as a bar graph. :param item | <XChartDatasetItem> painter | <QPainter> option | <QStyleOptionGraphicsItem>
[ "Draws", "the", "inputed", "item", "as", "a", "bar", "graph", ".", ":", "param", "item", "|", "<XChartDatasetItem", ">", "painter", "|", "<QPainter", ">", "option", "|", "<QStyleOptionGraphicsItem", ">" ]
python
train
glue-viz/glue-vispy-viewers
glue_vispy_viewers/extern/vispy/visuals/graphs/util.py
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/visuals/graphs/util.py#L98-L122
def _rescale_layout(pos, scale=1): """ Normalize the given coordinate list to the range [0, `scale`]. Parameters ---------- pos : array Coordinate list scale : number The upperbound value for the coordinates range Returns ------- pos : array The rescaled (no...
[ "def", "_rescale_layout", "(", "pos", ",", "scale", "=", "1", ")", ":", "pos", "-=", "pos", ".", "min", "(", "axis", "=", "0", ")", "pos", "*=", "scale", "/", "pos", ".", "max", "(", ")", "return", "pos" ]
Normalize the given coordinate list to the range [0, `scale`]. Parameters ---------- pos : array Coordinate list scale : number The upperbound value for the coordinates range Returns ------- pos : array The rescaled (normalized) coordinates in the range [0, `scale`]...
[ "Normalize", "the", "given", "coordinate", "list", "to", "the", "range", "[", "0", "scale", "]", "." ]
python
train
evhub/coconut
coconut/command/util.py
https://github.com/evhub/coconut/blob/ff97177344e7604e89a0a98a977a87ed2a56fc6d/coconut/command/util.py#L390-L407
def input(self, more=False): """Prompt for code input.""" sys.stdout.flush() if more: msg = more_prompt else: msg = main_prompt if self.style is not None: internal_assert(prompt_toolkit is not None, "without prompt_toolkit cannot highlight styl...
[ "def", "input", "(", "self", ",", "more", "=", "False", ")", ":", "sys", ".", "stdout", ".", "flush", "(", ")", "if", "more", ":", "msg", "=", "more_prompt", "else", ":", "msg", "=", "main_prompt", "if", "self", ".", "style", "is", "not", "None", ...
Prompt for code input.
[ "Prompt", "for", "code", "input", "." ]
python
train
inasafe/inasafe
safe/utilities/resources.py
https://github.com/inasafe/inasafe/blob/831d60abba919f6d481dc94a8d988cc205130724/safe/utilities/resources.py#L67-L87
def resources_path(*args): """Get the path to our resources folder. .. versionadded:: 3.0 Note that in version 3.0 we removed the use of Qt Resource files in favour of directly accessing on-disk resources. :param args List of path elements e.g. ['img', 'logos', 'image.png'] :type args: str ...
[ "def", "resources_path", "(", "*", "args", ")", ":", "path", "=", "os", ".", "path", ".", "dirname", "(", "__file__", ")", "path", "=", "os", ".", "path", ".", "abspath", "(", "os", ".", "path", ".", "join", "(", "path", ",", "os", ".", "path", ...
Get the path to our resources folder. .. versionadded:: 3.0 Note that in version 3.0 we removed the use of Qt Resource files in favour of directly accessing on-disk resources. :param args List of path elements e.g. ['img', 'logos', 'image.png'] :type args: str :return: Absolute path to the r...
[ "Get", "the", "path", "to", "our", "resources", "folder", "." ]
python
train
LordGaav/python-chaos
chaos/db.py
https://github.com/LordGaav/python-chaos/blob/52cd29a6fd15693ee1e53786b93bcb23fbf84ddd/chaos/db.py#L21-L31
def dump_simple_db(path): """ Dumps a SimpleDb as string in the following format: <key>: <json-encoded string> """ output = [] simpledb = SimpleDb(path, mode="r", sync=False) with simpledb as db: for key in db: output.append("{0}: {1}".format(key, db.dumpvalue(key))) return "\n".join(output)
[ "def", "dump_simple_db", "(", "path", ")", ":", "output", "=", "[", "]", "simpledb", "=", "SimpleDb", "(", "path", ",", "mode", "=", "\"r\"", ",", "sync", "=", "False", ")", "with", "simpledb", "as", "db", ":", "for", "key", "in", "db", ":", "outpu...
Dumps a SimpleDb as string in the following format: <key>: <json-encoded string>
[ "Dumps", "a", "SimpleDb", "as", "string", "in", "the", "following", "format", ":", "<key", ">", ":", "<json", "-", "encoded", "string", ">" ]
python
train
peterjc/flake8-rst-docstrings
flake8_rst_docstrings.py
https://github.com/peterjc/flake8-rst-docstrings/blob/b8b17d0317fc6728d5586553ab29a7d97e6417fd/flake8_rst_docstrings.py#L609-L612
def consume(self, kind): """Consume one token and verify it is of the expected kind.""" next_token = self.stream.move() assert next_token.kind == kind
[ "def", "consume", "(", "self", ",", "kind", ")", ":", "next_token", "=", "self", ".", "stream", ".", "move", "(", ")", "assert", "next_token", ".", "kind", "==", "kind" ]
Consume one token and verify it is of the expected kind.
[ "Consume", "one", "token", "and", "verify", "it", "is", "of", "the", "expected", "kind", "." ]
python
valid
jeremyschulman/halutz
halutz/request_factory.py
https://github.com/jeremyschulman/halutz/blob/6bb398dc99bf723daabd9eda02494a11252ee109/halutz/request_factory.py#L77-L107
def path_requests(self, path): """ Returns a Resource instace that will have attributes, one for each of the http-methods supported on that path. For example: >>> hcl_api = client.path_requests('/api/hcl/{id}') >>> dir(hcl_api) [u'delete', u'get', u'put'] ...
[ "def", "path_requests", "(", "self", ",", "path", ")", ":", "path_spec", "=", "self", ".", "client", ".", "origin_spec", "[", "'paths'", "]", ".", "get", "(", "path", ")", "if", "not", "path_spec", ":", "raise", "RuntimeError", "(", "\"no path found for: %...
Returns a Resource instace that will have attributes, one for each of the http-methods supported on that path. For example: >>> hcl_api = client.path_requests('/api/hcl/{id}') >>> dir(hcl_api) [u'delete', u'get', u'put'] >>> resp, ok = hcl_api.get(id='Arista_vE...
[ "Returns", "a", "Resource", "instace", "that", "will", "have", "attributes", "one", "for", "each", "of", "the", "http", "-", "methods", "supported", "on", "that", "path", ".", "For", "example", ":" ]
python
train
grundic/yagocd
yagocd/resources/stage.py
https://github.com/grundic/yagocd/blob/4c75336ae6f107c8723d37b15e52169151822127/yagocd/resources/stage.py#L275-L287
def pipeline_counter(self): """ Get pipeline counter of current stage instance. Because instantiating stage instance could be performed in different ways and those return different results, we have to check where from to get counter of the pipeline. :return: pipeline counter. ...
[ "def", "pipeline_counter", "(", "self", ")", ":", "if", "'pipeline_counter'", "in", "self", ".", "data", ":", "return", "self", ".", "data", ".", "get", "(", "'pipeline_counter'", ")", "elif", "self", ".", "pipeline", "is", "not", "None", ":", "return", ...
Get pipeline counter of current stage instance. Because instantiating stage instance could be performed in different ways and those return different results, we have to check where from to get counter of the pipeline. :return: pipeline counter.
[ "Get", "pipeline", "counter", "of", "current", "stage", "instance", "." ]
python
train
blockstack/blockstack-core
blockstack/lib/nameset/db.py
https://github.com/blockstack/blockstack-core/blob/1dcfdd39b152d29ce13e736a6a1a0981401a0505/blockstack/lib/nameset/db.py#L2740-L2762
def namedb_get_namespace_ready( cur, namespace_id, include_history=True ): """ Get a ready namespace, and optionally its history. Only return a namespace if it is ready. """ select_query = "SELECT * FROM namespaces WHERE namespace_id = ? AND op = ?;" namespace_rows = namedb_query_execute( cur, ...
[ "def", "namedb_get_namespace_ready", "(", "cur", ",", "namespace_id", ",", "include_history", "=", "True", ")", ":", "select_query", "=", "\"SELECT * FROM namespaces WHERE namespace_id = ? AND op = ?;\"", "namespace_rows", "=", "namedb_query_execute", "(", "cur", ",", "sele...
Get a ready namespace, and optionally its history. Only return a namespace if it is ready.
[ "Get", "a", "ready", "namespace", "and", "optionally", "its", "history", ".", "Only", "return", "a", "namespace", "if", "it", "is", "ready", "." ]
python
train
tomplus/kubernetes_asyncio
kubernetes_asyncio/client/api/apps_v1_api.py
https://github.com/tomplus/kubernetes_asyncio/blob/f9ab15317ec921409714c7afef11aeb0f579985d/kubernetes_asyncio/client/api/apps_v1_api.py#L4771-L4795
def read_namespaced_controller_revision(self, name, namespace, **kwargs): # noqa: E501 """read_namespaced_controller_revision # noqa: E501 read the specified ControllerRevision # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request,...
[ "def", "read_namespaced_controller_revision", "(", "self", ",", "name", ",", "namespace", ",", "*", "*", "kwargs", ")", ":", "# noqa: E501", "kwargs", "[", "'_return_http_data_only'", "]", "=", "True", "if", "kwargs", ".", "get", "(", "'async_req'", ")", ":", ...
read_namespaced_controller_revision # noqa: E501 read the specified ControllerRevision # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True >>> thread = api.read_namespaced_controller_revision(name, name...
[ "read_namespaced_controller_revision", "#", "noqa", ":", "E501" ]
python
train
pyroscope/pyrocore
src/pyrocore/torrent/rtorrent.py
https://github.com/pyroscope/pyrocore/blob/89ad01346a570943d20311a0b488440975876612/src/pyrocore/torrent/rtorrent.py#L214-L222
def datapath(self): """ Get an item's data path. """ path = self._fields['path'] if not path: # stopped item with no base_dir? path = self.fetch('directory') if path and not self._fields['is_multi_file']: path = os.path.join(path, self._fields['na...
[ "def", "datapath", "(", "self", ")", ":", "path", "=", "self", ".", "_fields", "[", "'path'", "]", "if", "not", "path", ":", "# stopped item with no base_dir?", "path", "=", "self", ".", "fetch", "(", "'directory'", ")", "if", "path", "and", "not", "self...
Get an item's data path.
[ "Get", "an", "item", "s", "data", "path", "." ]
python
train
lextoumbourou/txstripe
txstripe/resource.py
https://github.com/lextoumbourou/txstripe/blob/a69e67f524258026fd1840655a0578311bba3b89/txstripe/resource.py#L215-L225
def save(self, idempotency_key=None): """Return a deferred.""" updated_params = self.serialize(None) headers = populate_headers(idempotency_key) if not updated_params: util.logger.debug("Trying to save already saved object %r", self) return defer.succeed(self) ...
[ "def", "save", "(", "self", ",", "idempotency_key", "=", "None", ")", ":", "updated_params", "=", "self", ".", "serialize", "(", "None", ")", "headers", "=", "populate_headers", "(", "idempotency_key", ")", "if", "not", "updated_params", ":", "util", ".", ...
Return a deferred.
[ "Return", "a", "deferred", "." ]
python
train
MouseLand/rastermap
rastermap/mapping.py
https://github.com/MouseLand/rastermap/blob/eee7a46db80b6e33207543778e11618d0fed08a6/rastermap/mapping.py#L369-L382
def fit_transform(self, X, u=None): """Fit X into an embedded space and return that transformed output. Inputs ---------- X : array, shape (n_samples, n_features). X contains a sample per row. Returns ------- embedding : array, shape (n_samples, n_compone...
[ "def", "fit_transform", "(", "self", ",", "X", ",", "u", "=", "None", ")", ":", "self", ".", "fit", "(", "X", ",", "u", ")", "return", "self", ".", "embedding" ]
Fit X into an embedded space and return that transformed output. Inputs ---------- X : array, shape (n_samples, n_features). X contains a sample per row. Returns ------- embedding : array, shape (n_samples, n_components) Embedding of the training data...
[ "Fit", "X", "into", "an", "embedded", "space", "and", "return", "that", "transformed", "output", ".", "Inputs", "----------", "X", ":", "array", "shape", "(", "n_samples", "n_features", ")", ".", "X", "contains", "a", "sample", "per", "row", "." ]
python
train
nwilming/ocupy
ocupy/fixmat.py
https://github.com/nwilming/ocupy/blob/a0bd64f822576feaa502939d6bafd1183b237d16/ocupy/fixmat.py#L163-L207
def compute_fdm(fixmat, fwhm=2, scale_factor=1): """ Computes a fixation density map for the calling fixmat. Creates a map the size of the image fixations were recorded on. Every pixel contains the frequency of fixations for this image. The fixation map is smoothed by convolution with a ...
[ "def", "compute_fdm", "(", "fixmat", ",", "fwhm", "=", "2", ",", "scale_factor", "=", "1", ")", ":", "# image category must exist (>-1) and image_size must be non-empty", "assert", "(", "len", "(", "fixmat", ".", "image_size", ")", "==", "2", "and", "(", "fixmat...
Computes a fixation density map for the calling fixmat. Creates a map the size of the image fixations were recorded on. Every pixel contains the frequency of fixations for this image. The fixation map is smoothed by convolution with a Gaussian kernel to approximate the area with highest processi...
[ "Computes", "a", "fixation", "density", "map", "for", "the", "calling", "fixmat", ".", "Creates", "a", "map", "the", "size", "of", "the", "image", "fixations", "were", "recorded", "on", ".", "Every", "pixel", "contains", "the", "frequency", "of", "fixations"...
python
train
django-danceschool/django-danceschool
danceschool/core/classreg.py
https://github.com/django-danceschool/django-danceschool/blob/bb08cbf39017a812a5a94bdb4ea34170bf1a30ba/danceschool/core/classreg.py#L256-L295
def get_listing(self): ''' This function gets all of the information that we need to either render or validate the form. It is structured to avoid duplicate DB queries ''' if not hasattr(self,'listing'): allEvents = self.get_allEvents() openEvents = allE...
[ "def", "get_listing", "(", "self", ")", ":", "if", "not", "hasattr", "(", "self", ",", "'listing'", ")", ":", "allEvents", "=", "self", ".", "get_allEvents", "(", ")", "openEvents", "=", "allEvents", ".", "filter", "(", "registrationOpen", "=", "True", "...
This function gets all of the information that we need to either render or validate the form. It is structured to avoid duplicate DB queries
[ "This", "function", "gets", "all", "of", "the", "information", "that", "we", "need", "to", "either", "render", "or", "validate", "the", "form", ".", "It", "is", "structured", "to", "avoid", "duplicate", "DB", "queries" ]
python
train
analyzere/analyzere-python
analyzere/utils.py
https://github.com/analyzere/analyzere-python/blob/0593d5b7b69c4df6d6dbc80387cc6ff5dc5f4e8f/analyzere/utils.py#L78-L84
def parse_href(href): """Parses an Analyze Re href into collection name and ID""" url = urlparse(href) path = url.path.split('/') collection_name = path[1] id_ = path[2] return collection_name, id_
[ "def", "parse_href", "(", "href", ")", ":", "url", "=", "urlparse", "(", "href", ")", "path", "=", "url", ".", "path", ".", "split", "(", "'/'", ")", "collection_name", "=", "path", "[", "1", "]", "id_", "=", "path", "[", "2", "]", "return", "col...
Parses an Analyze Re href into collection name and ID
[ "Parses", "an", "Analyze", "Re", "href", "into", "collection", "name", "and", "ID" ]
python
train
google/grr
grr/core/grr_response_core/lib/config_lib.py
https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/core/grr_response_core/lib/config_lib.py#L1458-L1482
def MatchBuildContext(self, target_os, target_arch, target_package, context=None): """Return true if target_platforms matches the supplied parameters. Used by buildanddeploy to determine what clients need to be buil...
[ "def", "MatchBuildContext", "(", "self", ",", "target_os", ",", "target_arch", ",", "target_package", ",", "context", "=", "None", ")", ":", "for", "spec", "in", "self", ".", "Get", "(", "\"ClientBuilder.target_platforms\"", ",", "context", "=", "context", ")"...
Return true if target_platforms matches the supplied parameters. Used by buildanddeploy to determine what clients need to be built. Args: target_os: which os we are building for in this run (linux, windows, darwin) target_arch: which arch we are building for in this run (i386, amd64) ...
[ "Return", "true", "if", "target_platforms", "matches", "the", "supplied", "parameters", "." ]
python
train
myint/language-check
setup.py
https://github.com/myint/language-check/blob/58e419833ef28a9193fcaa21193616a8a14504a9/setup.py#L193-L198
def split_elements(value): """Split a string with comma or space-separated elements into a list.""" items = [v.strip() for v in value.split(',')] if len(items) == 1: items = value.split() return items
[ "def", "split_elements", "(", "value", ")", ":", "items", "=", "[", "v", ".", "strip", "(", ")", "for", "v", "in", "value", ".", "split", "(", "','", ")", "]", "if", "len", "(", "items", ")", "==", "1", ":", "items", "=", "value", ".", "split",...
Split a string with comma or space-separated elements into a list.
[ "Split", "a", "string", "with", "comma", "or", "space", "-", "separated", "elements", "into", "a", "list", "." ]
python
valid
apache/incubator-mxnet
python/mxnet/symbol/random.py
https://github.com/apache/incubator-mxnet/blob/1af29e9c060a4c7d60eeaacba32afdb9a7775ba7/python/mxnet/symbol/random.py#L284-L325
def multinomial(data, shape=_Null, get_prob=True, dtype='int32', **kwargs): """Concurrent sampling from multiple multinomial distributions. .. note:: The input distribution must be normalized, i.e. `data` must sum to 1 along its last dimension. Parameters ---------- data : Symbol ...
[ "def", "multinomial", "(", "data", ",", "shape", "=", "_Null", ",", "get_prob", "=", "True", ",", "dtype", "=", "'int32'", ",", "*", "*", "kwargs", ")", ":", "return", "_internal", ".", "_sample_multinomial", "(", "data", ",", "shape", ",", "get_prob", ...
Concurrent sampling from multiple multinomial distributions. .. note:: The input distribution must be normalized, i.e. `data` must sum to 1 along its last dimension. Parameters ---------- data : Symbol An *n* dimensional array whose last dimension has length `k`, where `k...
[ "Concurrent", "sampling", "from", "multiple", "multinomial", "distributions", "." ]
python
train
django-getpaid/django-plans
plans/listeners.py
https://github.com/django-getpaid/django-plans/blob/6897fcb0ed02bfba0c689292961532fe400b7ba2/plans/listeners.py#L12-L18
def create_proforma_invoice(sender, instance, created, **kwargs): """ For every Order if there are defined billing_data creates invoice proforma, which is an order confirmation document """ if created: Invoice.create(instance, Invoice.INVOICE_TYPES['PROFORMA'])
[ "def", "create_proforma_invoice", "(", "sender", ",", "instance", ",", "created", ",", "*", "*", "kwargs", ")", ":", "if", "created", ":", "Invoice", ".", "create", "(", "instance", ",", "Invoice", ".", "INVOICE_TYPES", "[", "'PROFORMA'", "]", ")" ]
For every Order if there are defined billing_data creates invoice proforma, which is an order confirmation document
[ "For", "every", "Order", "if", "there", "are", "defined", "billing_data", "creates", "invoice", "proforma", "which", "is", "an", "order", "confirmation", "document" ]
python
train
Contraz/demosys-py
demosys/scene/camera.py
https://github.com/Contraz/demosys-py/blob/6466128a3029c4d09631420ccce73024025bd5b6/demosys/scene/camera.py#L94-L122
def _gl_look_at(self, pos, target, up): """ The standard lookAt method :param pos: current position :param target: target position to look at :param up: direction up """ z = vector.normalise(pos - target) x = vector.normalise(vector3.cross(vector.normalis...
[ "def", "_gl_look_at", "(", "self", ",", "pos", ",", "target", ",", "up", ")", ":", "z", "=", "vector", ".", "normalise", "(", "pos", "-", "target", ")", "x", "=", "vector", ".", "normalise", "(", "vector3", ".", "cross", "(", "vector", ".", "normal...
The standard lookAt method :param pos: current position :param target: target position to look at :param up: direction up
[ "The", "standard", "lookAt", "method" ]
python
valid
pylp/pylp
pylp/lib/src.py
https://github.com/pylp/pylp/blob/7ebaa55fbaf61cb8175f211dd41ef2928c22d4d4/pylp/lib/src.py#L49-L82
def src(globs, **options): """Read some files and return a stream.""" # Create an array of globs if only one string is given if isinstance(globs, str): globs = [ globs ] # Find files files = find_files(globs) # Create a stream stream = Stream() # Options options["cwd"] = config.cwd if "base" in options...
[ "def", "src", "(", "globs", ",", "*", "*", "options", ")", ":", "# Create an array of globs if only one string is given", "if", "isinstance", "(", "globs", ",", "str", ")", ":", "globs", "=", "[", "globs", "]", "# Find files", "files", "=", "find_files", "(", ...
Read some files and return a stream.
[ "Read", "some", "files", "and", "return", "a", "stream", "." ]
python
train
dlintott/gns3-converter
gns3converter/node.py
https://github.com/dlintott/gns3-converter/blob/acbc55da51de86388dc5b5f6da55809b3c86b7ca/gns3converter/node.py#L147-L190
def add_device_items(self, item, device): """ Add the various items from the device to the node :param str item: item key :param dict device: dictionary containing items """ if item in ('aux', 'console'): self.node['properties'][item] = device[item] e...
[ "def", "add_device_items", "(", "self", ",", "item", ",", "device", ")", ":", "if", "item", "in", "(", "'aux'", ",", "'console'", ")", ":", "self", ".", "node", "[", "'properties'", "]", "[", "item", "]", "=", "device", "[", "item", "]", "elif", "i...
Add the various items from the device to the node :param str item: item key :param dict device: dictionary containing items
[ "Add", "the", "various", "items", "from", "the", "device", "to", "the", "node" ]
python
train
SHTOOLS/SHTOOLS
pyshtools/shclasses/shtensor.py
https://github.com/SHTOOLS/SHTOOLS/blob/9a115cf83002df2ddec6b7f41aeb6be688e285de/pyshtools/shclasses/shtensor.py#L30-L42
def compute_invar(self): """ Compute the three invariants (I0, I1, I2) of the tensor, as well as the quantity I = -(I2/2)**2 / (I1/3)**3. """ self.i0 = self.vxx + self.vyy + self.vzz self.i1 = (self.vxx*self.vyy + self.vyy*self.vzz + self.vxx*self.vzz - ...
[ "def", "compute_invar", "(", "self", ")", ":", "self", ".", "i0", "=", "self", ".", "vxx", "+", "self", ".", "vyy", "+", "self", ".", "vzz", "self", ".", "i1", "=", "(", "self", ".", "vxx", "*", "self", ".", "vyy", "+", "self", ".", "vyy", "*...
Compute the three invariants (I0, I1, I2) of the tensor, as well as the quantity I = -(I2/2)**2 / (I1/3)**3.
[ "Compute", "the", "three", "invariants", "(", "I0", "I1", "I2", ")", "of", "the", "tensor", "as", "well", "as", "the", "quantity", "I", "=", "-", "(", "I2", "/", "2", ")", "**", "2", "/", "(", "I1", "/", "3", ")", "**", "3", "." ]
python
train
hydraplatform/hydra-base
hydra_base/lib/users.py
https://github.com/hydraplatform/hydra-base/blob/9251ff7946505f7a272c87837390acd1c435bc6e/hydra_base/lib/users.py#L436-L445
def get_perm(perm_id,**kwargs): """ Get all permissions """ try: perm = db.DBSession.query(Perm).filter(Perm.id==perm_id).one() return perm except NoResultFound: raise ResourceNotFoundError("Permission not found (perm_id={})".format(perm_id))
[ "def", "get_perm", "(", "perm_id", ",", "*", "*", "kwargs", ")", ":", "try", ":", "perm", "=", "db", ".", "DBSession", ".", "query", "(", "Perm", ")", ".", "filter", "(", "Perm", ".", "id", "==", "perm_id", ")", ".", "one", "(", ")", "return", ...
Get all permissions
[ "Get", "all", "permissions" ]
python
train
blockstack/blockstack-core
blockstack/lib/nameset/namedb.py
https://github.com/blockstack/blockstack-core/blob/1dcfdd39b152d29ce13e736a6a1a0981401a0505/blockstack/lib/nameset/namedb.py#L1600-L1654
def commit_operation( self, input_op_data, accepted_nameop, current_block_number ): """ Commit an operation, thereby carrying out a state transition. Returns a dict with the new db record fields """ # have to have read-write disposition if self.disposition != DISPOS...
[ "def", "commit_operation", "(", "self", ",", "input_op_data", ",", "accepted_nameop", ",", "current_block_number", ")", ":", "# have to have read-write disposition ", "if", "self", ".", "disposition", "!=", "DISPOSITION_RW", ":", "log", ".", "error", "(", "\"FATAL: bo...
Commit an operation, thereby carrying out a state transition. Returns a dict with the new db record fields
[ "Commit", "an", "operation", "thereby", "carrying", "out", "a", "state", "transition", "." ]
python
train
mbedmicro/pyOCD
pyocd/probe/pydapaccess/dap_access_cmsis_dap.py
https://github.com/mbedmicro/pyOCD/blob/41a174718a9739f3cbe785c2ba21cb7fd1310c6f/pyocd/probe/pydapaccess/dap_access_cmsis_dap.py#L261-L284
def add(self, count, request, data, dap_index): """ Add a single or block register transfer operation to this command """ assert self._data_encoded is False if self._dap_index is None: self._dap_index = dap_index assert self._dap_index == dap_index if...
[ "def", "add", "(", "self", ",", "count", ",", "request", ",", "data", ",", "dap_index", ")", ":", "assert", "self", ".", "_data_encoded", "is", "False", "if", "self", ".", "_dap_index", "is", "None", ":", "self", ".", "_dap_index", "=", "dap_index", "a...
Add a single or block register transfer operation to this command
[ "Add", "a", "single", "or", "block", "register", "transfer", "operation", "to", "this", "command" ]
python
train
paramiko/paramiko
paramiko/packet.py
https://github.com/paramiko/paramiko/blob/cf7d49d66f3b1fbc8b0853518a54050182b3b5eb/paramiko/packet.py#L229-L239
def start_handshake(self, timeout): """ Tells `Packetizer` that the handshake process started. Starts a book keeping timer that can signal a timeout in the handshake process. :param float timeout: amount of seconds to wait before timing out """ if not self.__time...
[ "def", "start_handshake", "(", "self", ",", "timeout", ")", ":", "if", "not", "self", ".", "__timer", ":", "self", ".", "__timer", "=", "threading", ".", "Timer", "(", "float", "(", "timeout", ")", ",", "self", ".", "read_timer", ")", "self", ".", "_...
Tells `Packetizer` that the handshake process started. Starts a book keeping timer that can signal a timeout in the handshake process. :param float timeout: amount of seconds to wait before timing out
[ "Tells", "Packetizer", "that", "the", "handshake", "process", "started", ".", "Starts", "a", "book", "keeping", "timer", "that", "can", "signal", "a", "timeout", "in", "the", "handshake", "process", "." ]
python
train
Skyscanner/skyscanner-python-sdk
skyscanner/skyscanner.py
https://github.com/Skyscanner/skyscanner-python-sdk/blob/26ce4a563f538a689f2a29063f3604731703ddac/skyscanner/skyscanner.py#L146-L200
def make_request(self, service_url, method='get', headers=None, data=None, callback=None, errors=GRACEFUL, **params): """ Reusable method for performing requests. :param service_url - URL to request :param method - request method, default is 'get' :param hea...
[ "def", "make_request", "(", "self", ",", "service_url", ",", "method", "=", "'get'", ",", "headers", "=", "None", ",", "data", "=", "None", ",", "callback", "=", "None", ",", "errors", "=", "GRACEFUL", ",", "*", "*", "params", ")", ":", "error_modes", ...
Reusable method for performing requests. :param service_url - URL to request :param method - request method, default is 'get' :param headers - request headers :param data - post data :param callback - callback to be applied to response, default callback...
[ "Reusable", "method", "for", "performing", "requests", "." ]
python
train
PGower/PyCanvas
pycanvas/apis/quiz_question_groups.py
https://github.com/PGower/PyCanvas/blob/68520005382b440a1e462f9df369f54d364e21e8/pycanvas/apis/quiz_question_groups.py#L44-L85
def create_question_group(self, quiz_id, course_id, quiz_groups_assessment_question_bank_id=None, quiz_groups_name=None, quiz_groups_pick_count=None, quiz_groups_question_points=None): """ Create a question group. Create a new question group for this quiz <b>201 Created</...
[ "def", "create_question_group", "(", "self", ",", "quiz_id", ",", "course_id", ",", "quiz_groups_assessment_question_bank_id", "=", "None", ",", "quiz_groups_name", "=", "None", ",", "quiz_groups_pick_count", "=", "None", ",", "quiz_groups_question_points", "=", "None",...
Create a question group. Create a new question group for this quiz <b>201 Created</b> response code is returned if the creation was successful.
[ "Create", "a", "question", "group", ".", "Create", "a", "new", "question", "group", "for", "this", "quiz", "<b", ">", "201", "Created<", "/", "b", ">", "response", "code", "is", "returned", "if", "the", "creation", "was", "successful", "." ]
python
train
jayclassless/tidypy
src/tidypy/core.py
https://github.com/jayclassless/tidypy/blob/3c3497ca377fbbe937103b77b02b326c860c748f/src/tidypy/core.py#L85-L155
def execute_tools(config, path, progress=None): """ Executes the suite of TidyPy tools upon the project and returns the issues that are found. :param config: the TidyPy configuration to use :type config: dict :param path: that path to the project to analyze :type path: str :param progre...
[ "def", "execute_tools", "(", "config", ",", "path", ",", "progress", "=", "None", ")", ":", "progress", "=", "progress", "or", "QuietProgress", "(", ")", "progress", ".", "on_start", "(", ")", "manager", "=", "SyncManager", "(", ")", "manager", ".", "sta...
Executes the suite of TidyPy tools upon the project and returns the issues that are found. :param config: the TidyPy configuration to use :type config: dict :param path: that path to the project to analyze :type path: str :param progress: the progress reporter object that will receive c...
[ "Executes", "the", "suite", "of", "TidyPy", "tools", "upon", "the", "project", "and", "returns", "the", "issues", "that", "are", "found", "." ]
python
valid
corpusops/pdbclone
lib/pdb_clone/pdb.py
https://github.com/corpusops/pdbclone/blob/f781537c243a4874b246d43dbdef8c4279f0094d/lib/pdb_clone/pdb.py#L1035-L1058
def do_condition(self, arg): """condition bpnumber [condition] Set a new condition for the breakpoint, an expression which must evaluate to true before the breakpoint is honored. If condition is absent, any existing condition is removed; i.e., the breakpoint is made unconditiona...
[ "def", "do_condition", "(", "self", ",", "arg", ")", ":", "args", "=", "arg", ".", "split", "(", "' '", ",", "1", ")", "try", ":", "cond", "=", "args", "[", "1", "]", "except", "IndexError", ":", "cond", "=", "None", "try", ":", "bp", "=", "sel...
condition bpnumber [condition] Set a new condition for the breakpoint, an expression which must evaluate to true before the breakpoint is honored. If condition is absent, any existing condition is removed; i.e., the breakpoint is made unconditional.
[ "condition", "bpnumber", "[", "condition", "]", "Set", "a", "new", "condition", "for", "the", "breakpoint", "an", "expression", "which", "must", "evaluate", "to", "true", "before", "the", "breakpoint", "is", "honored", ".", "If", "condition", "is", "absent", ...
python
train