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
xapple/plumbing
plumbing/databases/sqlite_database.py
https://github.com/xapple/plumbing/blob/4a7706c7722f5996d0ca366f191aff9ac145880a/plumbing/databases/sqlite_database.py#L174-L185
def add_table(self, name, columns, type_map=None, if_not_exists=False): """Add add a new table to the database. For instance you could do this: self.add_table('data', {'id':'integer', 'source':'text', 'pubmed':'integer'})""" # Check types mapping # if type_map is None and isinstance(col...
[ "def", "add_table", "(", "self", ",", "name", ",", "columns", ",", "type_map", "=", "None", ",", "if_not_exists", "=", "False", ")", ":", "# Check types mapping #", "if", "type_map", "is", "None", "and", "isinstance", "(", "columns", ",", "dict", ")", ":",...
Add add a new table to the database. For instance you could do this: self.add_table('data', {'id':'integer', 'source':'text', 'pubmed':'integer'})
[ "Add", "add", "a", "new", "table", "to", "the", "database", ".", "For", "instance", "you", "could", "do", "this", ":", "self", ".", "add_table", "(", "data", "{", "id", ":", "integer", "source", ":", "text", "pubmed", ":", "integer", "}", ")" ]
python
train
bwesterb/tkbd
src/ruuster.py
https://github.com/bwesterb/tkbd/blob/fcf16977d38a93fe9b7fa198513007ab9921b650/src/ruuster.py#L43-L55
def fetch_room_ids(self, names): """ Fetches the ids of the rooms with the given names """ ret = {} names_set = set(names) try: for d in msgpack.unpack(urllib2.urlopen( "%s/list/locations?format=msgpack" % self.url)): name = d['name'].upper...
[ "def", "fetch_room_ids", "(", "self", ",", "names", ")", ":", "ret", "=", "{", "}", "names_set", "=", "set", "(", "names", ")", "try", ":", "for", "d", "in", "msgpack", ".", "unpack", "(", "urllib2", ".", "urlopen", "(", "\"%s/list/locations?format=msgpa...
Fetches the ids of the rooms with the given names
[ "Fetches", "the", "ids", "of", "the", "rooms", "with", "the", "given", "names" ]
python
train
cmbruns/pyopenvr
src/openvr/__init__.py
https://github.com/cmbruns/pyopenvr/blob/68395d26bb3df6ab1f0f059c38d441f962938be6/src/openvr/__init__.py#L3572-L3577
def getDefaultApplicationForMimeType(self, pchMimeType, pchAppKeyBuffer, unAppKeyBufferLen): """return the app key that will open this mime type""" fn = self.function_table.getDefaultApplicationForMimeType result = fn(pchMimeType, pchAppKeyBuffer, unAppKeyBufferLen) return result
[ "def", "getDefaultApplicationForMimeType", "(", "self", ",", "pchMimeType", ",", "pchAppKeyBuffer", ",", "unAppKeyBufferLen", ")", ":", "fn", "=", "self", ".", "function_table", ".", "getDefaultApplicationForMimeType", "result", "=", "fn", "(", "pchMimeType", ",", "...
return the app key that will open this mime type
[ "return", "the", "app", "key", "that", "will", "open", "this", "mime", "type" ]
python
train
deepmipt/DeepPavlov
deeppavlov/utils/alexa/server.py
https://github.com/deepmipt/DeepPavlov/blob/f3e4a69a3764d25d2f5bad4f1f1aebc872b00f9c/deeppavlov/utils/alexa/server.py#L84-L274
def run_alexa_server(agent_generator: callable, multi_instance: bool = False, stateful: bool = False, port: Optional[int] = None, https: bool = False, ssl_key: str = None, ssl_cert: str = None) ...
[ "def", "run_alexa_server", "(", "agent_generator", ":", "callable", ",", "multi_instance", ":", "bool", "=", "False", ",", "stateful", ":", "bool", "=", "False", ",", "port", ":", "Optional", "[", "int", "]", "=", "None", ",", "https", ":", "bool", "=", ...
Initiates Flask web service with Alexa skill. Args: agent_generator: Callback Alexa agents factory. multi_instance: Multi instance mode flag. stateful: Stateful mode flag. port: Flask web service port. https: Flag for running Alexa skill service in https mode. ssl_ke...
[ "Initiates", "Flask", "web", "service", "with", "Alexa", "skill", "." ]
python
test
nerdvegas/rez
src/rez/rex.py
https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/rex.py#L783-L816
def split(self, delimiter=None): """Same as string.split(), but retains literal/expandable structure. Returns: List of `EscapedString`. """ result = [] strings = self.strings[:] current = None while strings: is_literal, value = strings[0]...
[ "def", "split", "(", "self", ",", "delimiter", "=", "None", ")", ":", "result", "=", "[", "]", "strings", "=", "self", ".", "strings", "[", ":", "]", "current", "=", "None", "while", "strings", ":", "is_literal", ",", "value", "=", "strings", "[", ...
Same as string.split(), but retains literal/expandable structure. Returns: List of `EscapedString`.
[ "Same", "as", "string", ".", "split", "()", "but", "retains", "literal", "/", "expandable", "structure", "." ]
python
train
deployed/django-emailtemplates
emailtemplates/registry.py
https://github.com/deployed/django-emailtemplates/blob/0e95139989dbcf7e624153ddcd7b5b66b48eb6eb/emailtemplates/registry.py#L137-L145
def get_form_help_text(self, path): """ Returns text that can be used as form help text for creating email templates. """ try: form_help_text = self.get_registration(path).as_form_help_text() except NotRegistered: form_help_text = u"" return form_h...
[ "def", "get_form_help_text", "(", "self", ",", "path", ")", ":", "try", ":", "form_help_text", "=", "self", ".", "get_registration", "(", "path", ")", ".", "as_form_help_text", "(", ")", "except", "NotRegistered", ":", "form_help_text", "=", "u\"\"", "return",...
Returns text that can be used as form help text for creating email templates.
[ "Returns", "text", "that", "can", "be", "used", "as", "form", "help", "text", "for", "creating", "email", "templates", "." ]
python
train
pandas-dev/pandas
pandas/core/indexes/base.py
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/indexes/base.py#L3823-L3838
def _coerce_scalar_to_index(self, item): """ We need to coerce a scalar to a compat for our index type. Parameters ---------- item : scalar item to coerce """ dtype = self.dtype if self._is_numeric_dtype and isna(item): # We can't coerce to t...
[ "def", "_coerce_scalar_to_index", "(", "self", ",", "item", ")", ":", "dtype", "=", "self", ".", "dtype", "if", "self", ".", "_is_numeric_dtype", "and", "isna", "(", "item", ")", ":", "# We can't coerce to the numeric dtype of \"self\" (unless", "# it's float) if ther...
We need to coerce a scalar to a compat for our index type. Parameters ---------- item : scalar item to coerce
[ "We", "need", "to", "coerce", "a", "scalar", "to", "a", "compat", "for", "our", "index", "type", "." ]
python
train
fermiPy/fermipy
fermipy/wcs_utils.py
https://github.com/fermiPy/fermipy/blob/9df5e7e3728307fd58c5bba36fd86783c39fbad4/fermipy/wcs_utils.py#L277-L300
def pix_to_skydir(xpix, ypix, wcs): """Convert pixel coordinates to a skydir object. Gracefully handles 0-d coordinate arrays. Always returns a celestial coordinate. Parameters ---------- xpix : `numpy.ndarray` ypix : `numpy.ndarray` wcs : `~astropy.wcs.WCS` """ xpix = np.ar...
[ "def", "pix_to_skydir", "(", "xpix", ",", "ypix", ",", "wcs", ")", ":", "xpix", "=", "np", ".", "array", "(", "xpix", ")", "ypix", "=", "np", ".", "array", "(", "ypix", ")", "if", "xpix", ".", "ndim", ">", "0", "and", "len", "(", "xpix", ")", ...
Convert pixel coordinates to a skydir object. Gracefully handles 0-d coordinate arrays. Always returns a celestial coordinate. Parameters ---------- xpix : `numpy.ndarray` ypix : `numpy.ndarray` wcs : `~astropy.wcs.WCS`
[ "Convert", "pixel", "coordinates", "to", "a", "skydir", "object", "." ]
python
train
rootpy/rootpy
rootpy/plotting/base.py
https://github.com/rootpy/rootpy/blob/3926935e1f2100d8ba68070c2ab44055d4800f73/rootpy/plotting/base.py#L376-L385
def SetMarkerColor(self, color): """ *color* may be any color understood by ROOT or matplotlib. For full documentation of accepted *color* arguments, see :class:`rootpy.plotting.style.Color`. """ self._markercolor = Color(color) if isinstance(self, ROOT.TAttMarke...
[ "def", "SetMarkerColor", "(", "self", ",", "color", ")", ":", "self", ".", "_markercolor", "=", "Color", "(", "color", ")", "if", "isinstance", "(", "self", ",", "ROOT", ".", "TAttMarker", ")", ":", "ROOT", ".", "TAttMarker", ".", "SetMarkerColor", "(", ...
*color* may be any color understood by ROOT or matplotlib. For full documentation of accepted *color* arguments, see :class:`rootpy.plotting.style.Color`.
[ "*", "color", "*", "may", "be", "any", "color", "understood", "by", "ROOT", "or", "matplotlib", "." ]
python
train
marshallward/f90nml
f90nml/namelist.py
https://github.com/marshallward/f90nml/blob/4932cabc5221afc844ee6a5b4a05ceb8bd4a2711/f90nml/namelist.py#L179-L198
def indent(self, value): """Validate and set the indent width.""" # Explicit indent setting if isinstance(value, str): if value.isspace() or len(value) == 0: self._indent = value else: raise ValueError('String indentation can only contain '...
[ "def", "indent", "(", "self", ",", "value", ")", ":", "# Explicit indent setting", "if", "isinstance", "(", "value", ",", "str", ")", ":", "if", "value", ".", "isspace", "(", ")", "or", "len", "(", "value", ")", "==", "0", ":", "self", ".", "_indent"...
Validate and set the indent width.
[ "Validate", "and", "set", "the", "indent", "width", "." ]
python
train
mental32/spotify.py
spotify/models/player.py
https://github.com/mental32/spotify.py/blob/bb296cac7c3dd289908906b7069bd80f43950515/spotify/models/player.py#L85-L94
async def resume(self, *, device: Optional[SomeDevice] = None): """Resume playback on the user's account. Parameters ---------- device : Optional[:obj:`SomeDevice`] The Device object or id of the device this command is targeting. If not supplied, the user’s curre...
[ "async", "def", "resume", "(", "self", ",", "*", ",", "device", ":", "Optional", "[", "SomeDevice", "]", "=", "None", ")", ":", "await", "self", ".", "_user", ".", "http", ".", "play_playback", "(", "None", ",", "device_id", "=", "str", "(", "device"...
Resume playback on the user's account. Parameters ---------- device : Optional[:obj:`SomeDevice`] The Device object or id of the device this command is targeting. If not supplied, the user’s currently active device is the target.
[ "Resume", "playback", "on", "the", "user", "s", "account", "." ]
python
test
Dispersive-Hydrodynamics-Lab/PACE
PACE/PACE.py
https://github.com/Dispersive-Hydrodynamics-Lab/PACE/blob/4ce27d5fc9b02cc2ce55f6fea7fc8d6015317e1f/PACE/PACE.py#L310-L326
def plot_file(self, name: str=None, time: int=None) -> None: """ Plot specific time for provided datafile. If no time provided, will plot middle. :param: savefile name :param: time/data column """ if not time: time = int(len(self.times) / 2) i...
[ "def", "plot_file", "(", "self", ",", "name", ":", "str", "=", "None", ",", "time", ":", "int", "=", "None", ")", "->", "None", ":", "if", "not", "time", ":", "time", "=", "int", "(", "len", "(", "self", ".", "times", ")", "/", "2", ")", "if"...
Plot specific time for provided datafile. If no time provided, will plot middle. :param: savefile name :param: time/data column
[ "Plot", "specific", "time", "for", "provided", "datafile", ".", "If", "no", "time", "provided", "will", "plot", "middle", "." ]
python
train
scoutapp/scout_apm_python
src/scout_apm/django/middleware.py
https://github.com/scoutapp/scout_apm_python/blob/e5539ee23b8129be9b75d5007c88b6158b51294f/src/scout_apm/django/middleware.py#L67-L84
def process_view(self, request, view_func, view_args, view_kwargs): """ Capture details about the view_func that is about to execute """ try: if ignore_path(request.path): TrackedRequest.instance().tag("ignore_transaction", True) view_name = reque...
[ "def", "process_view", "(", "self", ",", "request", ",", "view_func", ",", "view_args", ",", "view_kwargs", ")", ":", "try", ":", "if", "ignore_path", "(", "request", ".", "path", ")", ":", "TrackedRequest", ".", "instance", "(", ")", ".", "tag", "(", ...
Capture details about the view_func that is about to execute
[ "Capture", "details", "about", "the", "view_func", "that", "is", "about", "to", "execute" ]
python
train
apache/airflow
airflow/contrib/utils/sendgrid.py
https://github.com/apache/airflow/blob/b69c686ad8a0c89b9136bb4b31767257eb7b2597/airflow/contrib/utils/sendgrid.py#L33-L102
def send_email(to, subject, html_content, files=None, dryrun=False, cc=None, bcc=None, mime_subtype='mixed', sandbox_mode=False, **kwargs): """ Send an email with html content using sendgrid. To use this plugin: 0. include sendgrid subpackage as part of your Airflow installation, e.g., ...
[ "def", "send_email", "(", "to", ",", "subject", ",", "html_content", ",", "files", "=", "None", ",", "dryrun", "=", "False", ",", "cc", "=", "None", ",", "bcc", "=", "None", ",", "mime_subtype", "=", "'mixed'", ",", "sandbox_mode", "=", "False", ",", ...
Send an email with html content using sendgrid. To use this plugin: 0. include sendgrid subpackage as part of your Airflow installation, e.g., pip install 'apache-airflow[sendgrid]' 1. update [email] backend in airflow.cfg, i.e., [email] email_backend = airflow.contrib.utils.sendgrid.send_email...
[ "Send", "an", "email", "with", "html", "content", "using", "sendgrid", "." ]
python
test
indico/indico-plugins
piwik/indico_piwik/piwik.py
https://github.com/indico/indico-plugins/blob/fe50085cc63be9b8161b09539e662e7b04e4b38e/piwik/indico_piwik/piwik.py#L54-L66
def get_query(self, query_params=None): """Return a query string""" if query_params is None: query_params = {} query = '' query_params['idSite'] = self.site_id if self.api_token is not None: query_params['token_auth'] = self.api_token for key, valu...
[ "def", "get_query", "(", "self", ",", "query_params", "=", "None", ")", ":", "if", "query_params", "is", "None", ":", "query_params", "=", "{", "}", "query", "=", "''", "query_params", "[", "'idSite'", "]", "=", "self", ".", "site_id", "if", "self", "....
Return a query string
[ "Return", "a", "query", "string" ]
python
train
pyviz/holoviews
holoviews/core/data/grid.py
https://github.com/pyviz/holoviews/blob/ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655/holoviews/core/data/grid.py#L207-L239
def coords(cls, dataset, dim, ordered=False, expanded=False, edges=False): """ Returns the coordinates along a dimension. Ordered ensures coordinates are in ascending order and expanded creates ND-array matching the dimensionality of the dataset. """ dim = dataset.get_di...
[ "def", "coords", "(", "cls", ",", "dataset", ",", "dim", ",", "ordered", "=", "False", ",", "expanded", "=", "False", ",", "edges", "=", "False", ")", ":", "dim", "=", "dataset", ".", "get_dimension", "(", "dim", ",", "strict", "=", "True", ")", "i...
Returns the coordinates along a dimension. Ordered ensures coordinates are in ascending order and expanded creates ND-array matching the dimensionality of the dataset.
[ "Returns", "the", "coordinates", "along", "a", "dimension", ".", "Ordered", "ensures", "coordinates", "are", "in", "ascending", "order", "and", "expanded", "creates", "ND", "-", "array", "matching", "the", "dimensionality", "of", "the", "dataset", "." ]
python
train
sebdah/dynamic-dynamodb
dynamic_dynamodb/statistics/table.py
https://github.com/sebdah/dynamic-dynamodb/blob/bfd0ca806b1c3301e724696de90ef0f973410493/dynamic_dynamodb/statistics/table.py#L291-L332
def get_throttled_by_consumed_write_percent( table_name, lookback_window_start=15, lookback_period=5): """ Returns the number of throttled write events in percent of consumption :type table_name: str :param table_name: Name of the DynamoDB table :type lookback_window_start: int :param lookb...
[ "def", "get_throttled_by_consumed_write_percent", "(", "table_name", ",", "lookback_window_start", "=", "15", ",", "lookback_period", "=", "5", ")", ":", "try", ":", "metrics1", "=", "__get_aws_metric", "(", "table_name", ",", "lookback_window_start", ",", "lookback_p...
Returns the number of throttled write events in percent of consumption :type table_name: str :param table_name: Name of the DynamoDB table :type lookback_window_start: int :param lookback_window_start: Relative start time for the CloudWatch metric :type lookback_period: int :param lookback_peri...
[ "Returns", "the", "number", "of", "throttled", "write", "events", "in", "percent", "of", "consumption" ]
python
train
edx/edx-organizations
organizations/data.py
https://github.com/edx/edx-organizations/blob/51000d5d359d880a6eb3a79345f60744f1982c00/organizations/data.py#L198-L217
def create_organization_course(organization, course_key): """ Inserts a new organization-course relationship into app/local state No response currently defined for this operation """ organization_obj = serializers.deserialize_organization(organization) try: relationship = internal.Organi...
[ "def", "create_organization_course", "(", "organization", ",", "course_key", ")", ":", "organization_obj", "=", "serializers", ".", "deserialize_organization", "(", "organization", ")", "try", ":", "relationship", "=", "internal", ".", "OrganizationCourse", ".", "obje...
Inserts a new organization-course relationship into app/local state No response currently defined for this operation
[ "Inserts", "a", "new", "organization", "-", "course", "relationship", "into", "app", "/", "local", "state", "No", "response", "currently", "defined", "for", "this", "operation" ]
python
valid
seleniumbase/SeleniumBase
seleniumbase/core/mysql.py
https://github.com/seleniumbase/SeleniumBase/blob/62e5b43ee1f90a9ed923841bdd53b1b38358f43a/seleniumbase/core/mysql.py#L48-L55
def query_fetch_one(self, query, values): """ Executes a db query, gets the first value, and closes the connection. """ self.cursor.execute(query, values) retval = self.cursor.fetchone() self.__close_db() return retval
[ "def", "query_fetch_one", "(", "self", ",", "query", ",", "values", ")", ":", "self", ".", "cursor", ".", "execute", "(", "query", ",", "values", ")", "retval", "=", "self", ".", "cursor", ".", "fetchone", "(", ")", "self", ".", "__close_db", "(", ")...
Executes a db query, gets the first value, and closes the connection.
[ "Executes", "a", "db", "query", "gets", "the", "first", "value", "and", "closes", "the", "connection", "." ]
python
train
mosdef-hub/mbuild
mbuild/compound.py
https://github.com/mosdef-hub/mbuild/blob/dcb80a2becd5d0e6a7e3e7bcb1b59793c46a2dd3/mbuild/compound.py#L1205-L1229
def update_coordinates(self, filename, update_port_locations=True): """Update the coordinates of this Compound from a file. Parameters ---------- filename : str Name of file from which to load coordinates. Supported file types are the same as those supported by l...
[ "def", "update_coordinates", "(", "self", ",", "filename", ",", "update_port_locations", "=", "True", ")", ":", "if", "update_port_locations", ":", "xyz_init", "=", "self", ".", "xyz", "self", "=", "load", "(", "filename", ",", "compound", "=", "self", ",", ...
Update the coordinates of this Compound from a file. Parameters ---------- filename : str Name of file from which to load coordinates. Supported file types are the same as those supported by load() update_port_locations : bool, optional, default=True ...
[ "Update", "the", "coordinates", "of", "this", "Compound", "from", "a", "file", "." ]
python
train
inasafe/inasafe
safe/gui/tools/wizard/step_kw15_layermode.py
https://github.com/inasafe/inasafe/blob/831d60abba919f6d481dc94a8d988cc205130724/safe/gui/tools/wizard/step_kw15_layermode.py#L107-L152
def set_widgets(self): """Set widgets on the LayerMode tab.""" self.clear_further_steps() # Set widgets purpose = self.parent.step_kw_purpose.selected_purpose() subcategory = self.parent.step_kw_subcategory.selected_subcategory() layer_mode_question = ( layer_...
[ "def", "set_widgets", "(", "self", ")", ":", "self", ".", "clear_further_steps", "(", ")", "# Set widgets", "purpose", "=", "self", ".", "parent", ".", "step_kw_purpose", ".", "selected_purpose", "(", ")", "subcategory", "=", "self", ".", "parent", ".", "ste...
Set widgets on the LayerMode tab.
[ "Set", "widgets", "on", "the", "LayerMode", "tab", "." ]
python
train
Esri/ArcREST
src/arcrest/manageags/_system.py
https://github.com/Esri/ArcREST/blob/ab240fde2b0200f61d4a5f6df033516e53f2f416/src/arcrest/manageags/_system.py#L114-L148
def registerDirectory(self,name,physicalPath,directoryType,cleanupMode, maxFileAge,description): """ Registers a new server directory. While registering the server directory, you can also specify the directory's cleanup parameters. You can also register a direct...
[ "def", "registerDirectory", "(", "self", ",", "name", ",", "physicalPath", ",", "directoryType", ",", "cleanupMode", ",", "maxFileAge", ",", "description", ")", ":", "url", "=", "self", ".", "_url", "+", "\"/directories/register\"", "params", "=", "{", "\"f\""...
Registers a new server directory. While registering the server directory, you can also specify the directory's cleanup parameters. You can also register a directory by using its JSON representation as a value of the directory parameter. Inputs: name - The name of the server d...
[ "Registers", "a", "new", "server", "directory", ".", "While", "registering", "the", "server", "directory", "you", "can", "also", "specify", "the", "directory", "s", "cleanup", "parameters", ".", "You", "can", "also", "register", "a", "directory", "by", "using"...
python
train
sosy-lab/benchexec
benchexec/runexecutor.py
https://github.com/sosy-lab/benchexec/blob/44428f67f41384c03aea13e7e25f884764653617/benchexec/runexecutor.py#L587-L610
def _setup_environment(self, environments): """Return map with desired environment variables for run.""" # If keepEnv is set or sudo is used, start from a fresh environment, # otherwise with the current one. # keepEnv specifies variables to copy from the current environment, # ne...
[ "def", "_setup_environment", "(", "self", ",", "environments", ")", ":", "# If keepEnv is set or sudo is used, start from a fresh environment,", "# otherwise with the current one.", "# keepEnv specifies variables to copy from the current environment,", "# newEnv specifies variables to set to a...
Return map with desired environment variables for run.
[ "Return", "map", "with", "desired", "environment", "variables", "for", "run", "." ]
python
train
gem/oq-engine
openquake/hazardlib/geo/surface/complex_fault.py
https://github.com/gem/oq-engine/blob/8294553a0b8aba33fd96437a35065d03547d0040/openquake/hazardlib/geo/surface/complex_fault.py#L96-L111
def get_dip(self): """ Return the fault dip as the average dip over the mesh. The average dip is defined as the weighted mean inclination of all the mesh cells. See :meth:`openquake.hazardlib.geo.mesh.RectangularMesh.get_mean_inclination_and_azimuth` :returns: ...
[ "def", "get_dip", "(", "self", ")", ":", "# uses the same approach as in simple fault surface", "if", "self", ".", "dip", "is", "None", ":", "mesh", "=", "self", ".", "mesh", "self", ".", "dip", ",", "self", ".", "strike", "=", "mesh", ".", "get_mean_inclina...
Return the fault dip as the average dip over the mesh. The average dip is defined as the weighted mean inclination of all the mesh cells. See :meth:`openquake.hazardlib.geo.mesh.RectangularMesh.get_mean_inclination_and_azimuth` :returns: The average dip, in decimal degrees.
[ "Return", "the", "fault", "dip", "as", "the", "average", "dip", "over", "the", "mesh", "." ]
python
train
jmwri/simplejwt
simplejwt/jwt.py
https://github.com/jmwri/simplejwt/blob/0828eaace0846918d2d202f5a60167a003e88b71/simplejwt/jwt.py#L397-L438
def decode(secret: Union[str, bytes], token: Union[str, bytes], alg: str = default_alg) -> Tuple[dict, dict]: """ Decodes the given token's header and payload and validates the signature. :param secret: The secret used to decode the token. Must match the secret used when creating the tok...
[ "def", "decode", "(", "secret", ":", "Union", "[", "str", ",", "bytes", "]", ",", "token", ":", "Union", "[", "str", ",", "bytes", "]", ",", "alg", ":", "str", "=", "default_alg", ")", "->", "Tuple", "[", "dict", ",", "dict", "]", ":", "secret", ...
Decodes the given token's header and payload and validates the signature. :param secret: The secret used to decode the token. Must match the secret used when creating the token. :type secret: Union[str, bytes] :param token: The token to decode. :type token: Union[str, bytes] :param alg: The...
[ "Decodes", "the", "given", "token", "s", "header", "and", "payload", "and", "validates", "the", "signature", "." ]
python
valid
chaoss/grimoirelab-sortinghat
sortinghat/cmd/unify.py
https://github.com/chaoss/grimoirelab-sortinghat/blob/391cd37a75fea26311dc6908bc1c953c540a8e04/sortinghat/cmd/unify.py#L315-L327
def save_matches(self, matches): """Save matches of a failed execution to the log. :param matches: a list of matches in JSON format """ if not os.path.exists(os.path.dirname(self.location())): os.makedirs(os.path.dirname(self.location())) with open(self.location(), ...
[ "def", "save_matches", "(", "self", ",", "matches", ")", ":", "if", "not", "os", ".", "path", ".", "exists", "(", "os", ".", "path", ".", "dirname", "(", "self", ".", "location", "(", ")", ")", ")", ":", "os", ".", "makedirs", "(", "os", ".", "...
Save matches of a failed execution to the log. :param matches: a list of matches in JSON format
[ "Save", "matches", "of", "a", "failed", "execution", "to", "the", "log", "." ]
python
train
mweb/appconfig
appconfig/appconfig.py
https://github.com/mweb/appconfig/blob/780c1fe3b2f537463a46e335186b7741add88a1e/appconfig/appconfig.py#L152-L166
def load(self, filename): ''' Load the given config file. @param filename: the filename including the path to load. ''' if not os.path.exists(filename): #print 'Could not load config file [%s]' % (filename) raise AppConfigValueException('Could not load config...
[ "def", "load", "(", "self", ",", "filename", ")", ":", "if", "not", "os", ".", "path", ".", "exists", "(", "filename", ")", ":", "#print 'Could not load config file [%s]' % (filename)", "raise", "AppConfigValueException", "(", "'Could not load config file {0}'", ".", ...
Load the given config file. @param filename: the filename including the path to load.
[ "Load", "the", "given", "config", "file", "." ]
python
train
Staffjoy/client_python
staffjoy/resource.py
https://github.com/Staffjoy/client_python/blob/e8811b0c06651a15e691c96cbfd41e7da4f7f213/staffjoy/resource.py#L106-L110
def _url(self): """Get the URL for the resource""" if self.ID_NAME not in self.route.keys() and "id" in self.data.keys(): self.route[self.ID_NAME] = self.data["id"] return self.config.BASE + self.PATH.format(**self.route)
[ "def", "_url", "(", "self", ")", ":", "if", "self", ".", "ID_NAME", "not", "in", "self", ".", "route", ".", "keys", "(", ")", "and", "\"id\"", "in", "self", ".", "data", ".", "keys", "(", ")", ":", "self", ".", "route", "[", "self", ".", "ID_NA...
Get the URL for the resource
[ "Get", "the", "URL", "for", "the", "resource" ]
python
train
mgoral/subconvert
src/subconvert/gui/SubtitleCommands.py
https://github.com/mgoral/subconvert/blob/59701e5e69ef1ca26ce7d1d766c936664aa2cb32/src/subconvert/gui/SubtitleCommands.py#L60-L66
def setup(self): """When subclassing remember to call SubtitleChangeCommand::setup() to perform generic checks.""" if not isinstance(self.filePath, str): raise TypeError("File path is not a string!") if self.controller is None: raise ValueError("Command controller...
[ "def", "setup", "(", "self", ")", ":", "if", "not", "isinstance", "(", "self", ".", "filePath", ",", "str", ")", ":", "raise", "TypeError", "(", "\"File path is not a string!\"", ")", "if", "self", ".", "controller", "is", "None", ":", "raise", "ValueError...
When subclassing remember to call SubtitleChangeCommand::setup() to perform generic checks.
[ "When", "subclassing", "remember", "to", "call", "SubtitleChangeCommand", "::", "setup", "()", "to", "perform", "generic", "checks", "." ]
python
train
AkihikoITOH/capybara
capybara/virtualenv/lib/python2.7/site-packages/flask/app.py
https://github.com/AkihikoITOH/capybara/blob/e86c2173ea386654f4ae061148e8fbe3f25e715c/capybara/virtualenv/lib/python2.7/site-packages/flask/app.py#L1332-L1350
def trap_http_exception(self, e): """Checks if an HTTP exception should be trapped or not. By default this will return `False` for all exceptions except for a bad request key error if ``TRAP_BAD_REQUEST_ERRORS`` is set to `True`. It also returns `True` if ``TRAP_HTTP_EXCEPTIONS`` is se...
[ "def", "trap_http_exception", "(", "self", ",", "e", ")", ":", "if", "self", ".", "config", "[", "'TRAP_HTTP_EXCEPTIONS'", "]", ":", "return", "True", "if", "self", ".", "config", "[", "'TRAP_BAD_REQUEST_ERRORS'", "]", ":", "return", "isinstance", "(", "e", ...
Checks if an HTTP exception should be trapped or not. By default this will return `False` for all exceptions except for a bad request key error if ``TRAP_BAD_REQUEST_ERRORS`` is set to `True`. It also returns `True` if ``TRAP_HTTP_EXCEPTIONS`` is set to `True`. This is called for all ...
[ "Checks", "if", "an", "HTTP", "exception", "should", "be", "trapped", "or", "not", ".", "By", "default", "this", "will", "return", "False", "for", "all", "exceptions", "except", "for", "a", "bad", "request", "key", "error", "if", "TRAP_BAD_REQUEST_ERRORS", "...
python
test
apple/turicreate
deps/src/boost_1_68_0/libs/predef/tools/ci/build_log.py
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/libs/predef/tools/ci/build_log.py#L363-L378
def print_action(self, test_succeed, action): ''' Print the detailed info of failed or always print tests. ''' #self.info_print(">>> {0}",action.keys()) if not test_succeed or action['info']['always_show_run_output']: output = action['output'].strip() if o...
[ "def", "print_action", "(", "self", ",", "test_succeed", ",", "action", ")", ":", "#self.info_print(\">>> {0}\",action.keys())", "if", "not", "test_succeed", "or", "action", "[", "'info'", "]", "[", "'always_show_run_output'", "]", ":", "output", "=", "action", "[...
Print the detailed info of failed or always print tests.
[ "Print", "the", "detailed", "info", "of", "failed", "or", "always", "print", "tests", "." ]
python
train
berkeley-cocosci/Wallace
wallace/custom.py
https://github.com/berkeley-cocosci/Wallace/blob/3650c0bc3b0804d0adb1d178c5eba9992babb1b0/wallace/custom.py#L696-L733
def get_info(node_id, info_id): """Get a specific info. Both the node and info id must be specified in the url. """ exp = experiment(session) # check the node exists node = models.Node.query.get(node_id) if node is None: return error_response(error_type="/info, node does not exist"...
[ "def", "get_info", "(", "node_id", ",", "info_id", ")", ":", "exp", "=", "experiment", "(", "session", ")", "# check the node exists", "node", "=", "models", ".", "Node", ".", "query", ".", "get", "(", "node_id", ")", "if", "node", "is", "None", ":", "...
Get a specific info. Both the node and info id must be specified in the url.
[ "Get", "a", "specific", "info", "." ]
python
train
tensorflow/tensor2tensor
tensor2tensor/models/mtf_transformer2.py
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/models/mtf_transformer2.py#L454-L469
def mtf_unitransformer_base(): """Hyperparameters for single-stack Transformer.""" hparams = mtf_transformer2_base() hparams.add_hparam("autoregressive", True) # HYPERPARAMETERS FOR THE SINGLE LAYER STACK hparams.add_hparam("layers", ["self_att", "drd"] * 6) # number of heads in multihead attention hparam...
[ "def", "mtf_unitransformer_base", "(", ")", ":", "hparams", "=", "mtf_transformer2_base", "(", ")", "hparams", ".", "add_hparam", "(", "\"autoregressive\"", ",", "True", ")", "# HYPERPARAMETERS FOR THE SINGLE LAYER STACK", "hparams", ".", "add_hparam", "(", "\"layers\""...
Hyperparameters for single-stack Transformer.
[ "Hyperparameters", "for", "single", "-", "stack", "Transformer", "." ]
python
train
gem/oq-engine
openquake/commonlib/logictree.py
https://github.com/gem/oq-engine/blob/8294553a0b8aba33fd96437a35065d03547d0040/openquake/commonlib/logictree.py#L1022-L1090
def validate_filters(self, branchset_node, uncertainty_type, filters): """ See superclass' method for description and signature specification. Checks that the following conditions are met: * "sourceModel" uncertainties can not have filters. * Absolute uncertainties must have on...
[ "def", "validate_filters", "(", "self", ",", "branchset_node", ",", "uncertainty_type", ",", "filters", ")", ":", "if", "uncertainty_type", "==", "'sourceModel'", "and", "filters", ":", "raise", "LogicTreeError", "(", "branchset_node", ",", "self", ".", "filename"...
See superclass' method for description and signature specification. Checks that the following conditions are met: * "sourceModel" uncertainties can not have filters. * Absolute uncertainties must have only one filter -- "applyToSources", with only one source id. * All other u...
[ "See", "superclass", "method", "for", "description", "and", "signature", "specification", "." ]
python
train
csparpa/pyowm
pyowm/utils/geo.py
https://github.com/csparpa/pyowm/blob/cdd59eb72f32f7238624ceef9b2e2329a5ebd472/pyowm/utils/geo.py#L355-L373
def build(cls, the_dict): """ Builds a `pyowm.utils.geo.Geometry` subtype based on the geoJSON geometry type specified on the input dictionary :param the_dict: a geoJSON compliant dict :return: a `pyowm.utils.geo.Geometry` subtype instance :raises `ValueError` if unable to the ge...
[ "def", "build", "(", "cls", ",", "the_dict", ")", ":", "assert", "isinstance", "(", "the_dict", ",", "dict", ")", ",", "'Geometry must be a dict'", "geom_type", "=", "the_dict", ".", "get", "(", "'type'", ",", "None", ")", "if", "geom_type", "==", "'Point'...
Builds a `pyowm.utils.geo.Geometry` subtype based on the geoJSON geometry type specified on the input dictionary :param the_dict: a geoJSON compliant dict :return: a `pyowm.utils.geo.Geometry` subtype instance :raises `ValueError` if unable to the geometry type cannot be recognized
[ "Builds", "a", "pyowm", ".", "utils", ".", "geo", ".", "Geometry", "subtype", "based", "on", "the", "geoJSON", "geometry", "type", "specified", "on", "the", "input", "dictionary", ":", "param", "the_dict", ":", "a", "geoJSON", "compliant", "dict", ":", "re...
python
train
OpenAgInitiative/openag_python
openag/utils.py
https://github.com/OpenAgInitiative/openag_python/blob/f6202340292bbf7185e1a7d4290188c0dacbb8d0/openag/utils.py#L163-L172
def dedupe_by(things, key=None): """ Given an iterator of things and an optional key generation function, return a new iterator of deduped things. Things are compared and de-duped by the key function, which is hash() by default. """ if not key: key = hash index = {key(thing): thing f...
[ "def", "dedupe_by", "(", "things", ",", "key", "=", "None", ")", ":", "if", "not", "key", ":", "key", "=", "hash", "index", "=", "{", "key", "(", "thing", ")", ":", "thing", "for", "thing", "in", "things", "}", "return", "index", ".", "values", "...
Given an iterator of things and an optional key generation function, return a new iterator of deduped things. Things are compared and de-duped by the key function, which is hash() by default.
[ "Given", "an", "iterator", "of", "things", "and", "an", "optional", "key", "generation", "function", "return", "a", "new", "iterator", "of", "deduped", "things", ".", "Things", "are", "compared", "and", "de", "-", "duped", "by", "the", "key", "function", "...
python
train
gwastro/pycbc
pycbc/tmpltbank/brute_force_methods.py
https://github.com/gwastro/pycbc/blob/7a64cdd104d263f1b6ea0b01e6841837d05a4cb3/pycbc/tmpltbank/brute_force_methods.py#L124-L347
def get_mass_distribution(bestMasses, scaleFactor, massRangeParams, metricParams, fUpper, numJumpPoints=100, chirpMassJumpFac=0.0001, etaJumpFac=0.01, spin1zJumpFac=0.01, spin2zJumpFac=0.01): """ Given a set ...
[ "def", "get_mass_distribution", "(", "bestMasses", ",", "scaleFactor", ",", "massRangeParams", ",", "metricParams", ",", "fUpper", ",", "numJumpPoints", "=", "100", ",", "chirpMassJumpFac", "=", "0.0001", ",", "etaJumpFac", "=", "0.01", ",", "spin1zJumpFac", "=", ...
Given a set of masses, this function will create a set of points nearby in the mass space and map these to the xi space. Parameters ----------- bestMasses : list Contains [ChirpMass, eta, spin1z, spin2z]. Points will be placed around tjos scaleFactor : float This parameter d...
[ "Given", "a", "set", "of", "masses", "this", "function", "will", "create", "a", "set", "of", "points", "nearby", "in", "the", "mass", "space", "and", "map", "these", "to", "the", "xi", "space", "." ]
python
train
tanghaibao/jcvi
jcvi/formats/sam.py
https://github.com/tanghaibao/jcvi/blob/d2e31a77b6ade7f41f3b321febc2b4744d1cdeca/jcvi/formats/sam.py#L340-L383
def merge(args): """ %prog merge merged_bams bams1_dir bams2_dir ... Merge BAM files. Treat the bams with the same prefix as a set. Output the commands first. """ from jcvi.apps.grid import MakeManager p = OptionParser(merge.__doc__) p.set_sep(sep="_", help="Separator to group per pref...
[ "def", "merge", "(", "args", ")", ":", "from", "jcvi", ".", "apps", ".", "grid", "import", "MakeManager", "p", "=", "OptionParser", "(", "merge", ".", "__doc__", ")", "p", ".", "set_sep", "(", "sep", "=", "\"_\"", ",", "help", "=", "\"Separator to grou...
%prog merge merged_bams bams1_dir bams2_dir ... Merge BAM files. Treat the bams with the same prefix as a set. Output the commands first.
[ "%prog", "merge", "merged_bams", "bams1_dir", "bams2_dir", "..." ]
python
train
josuebrunel/yahoo-oauth
yahoo_oauth/yahoo_oauth.py
https://github.com/josuebrunel/yahoo-oauth/blob/40eff7809366850c46e1a3340469044f33cd1713/yahoo_oauth/yahoo_oauth.py#L201-L211
def token_is_valid(self,): """Check the validity of the token :3600s """ elapsed_time = time.time() - self.token_time logger.debug("ELAPSED TIME : {0}".format(elapsed_time)) if elapsed_time > 3540: # 1 minute before it expires logger.debug("TOKEN HAS EXPIRED") ...
[ "def", "token_is_valid", "(", "self", ",", ")", ":", "elapsed_time", "=", "time", ".", "time", "(", ")", "-", "self", ".", "token_time", "logger", ".", "debug", "(", "\"ELAPSED TIME : {0}\"", ".", "format", "(", "elapsed_time", ")", ")", "if", "elapsed_tim...
Check the validity of the token :3600s
[ "Check", "the", "validity", "of", "the", "token", ":", "3600s" ]
python
valid
boatd/python-boatd
boatdclient/boatd_client.py
https://github.com/boatd/python-boatd/blob/404ff0d0c389f6ed84ddbfea1c41db6569ad2ed4/boatdclient/boatd_client.py#L152-L161
def set_sail(self, angle): ''' Set the angle of the sail to `angle` degrees :param angle: sail angle :type angle: float between -90 and 90 ''' angle = float(angle) request = self.boatd.post({'value': float(angle)}, '/sail') return request.get('result')
[ "def", "set_sail", "(", "self", ",", "angle", ")", ":", "angle", "=", "float", "(", "angle", ")", "request", "=", "self", ".", "boatd", ".", "post", "(", "{", "'value'", ":", "float", "(", "angle", ")", "}", ",", "'/sail'", ")", "return", "request"...
Set the angle of the sail to `angle` degrees :param angle: sail angle :type angle: float between -90 and 90
[ "Set", "the", "angle", "of", "the", "sail", "to", "angle", "degrees" ]
python
train
pandas-dev/pandas
pandas/io/formats/format.py
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/io/formats/format.py#L1015-L1054
def _value_formatter(self, float_format=None, threshold=None): """Returns a function to be applied on each value to format it """ # the float_format parameter supersedes self.float_format if float_format is None: float_format = self.float_format # we are going to co...
[ "def", "_value_formatter", "(", "self", ",", "float_format", "=", "None", ",", "threshold", "=", "None", ")", ":", "# the float_format parameter supersedes self.float_format", "if", "float_format", "is", "None", ":", "float_format", "=", "self", ".", "float_format", ...
Returns a function to be applied on each value to format it
[ "Returns", "a", "function", "to", "be", "applied", "on", "each", "value", "to", "format", "it" ]
python
train
openstax/cnx-epub
cnxepub/adapters.py
https://github.com/openstax/cnx-epub/blob/f648a309eff551b0a68a115a98ddf7858149a2ea/cnxepub/adapters.py#L227-L261
def _node_to_model(tree_or_item, package, parent=None, lucent_id=TRANSLUCENT_BINDER_ID): """Given a tree, parse to a set of models""" if 'contents' in tree_or_item: # It is a binder. tree = tree_or_item # Grab the package metadata, so we have required license info ...
[ "def", "_node_to_model", "(", "tree_or_item", ",", "package", ",", "parent", "=", "None", ",", "lucent_id", "=", "TRANSLUCENT_BINDER_ID", ")", ":", "if", "'contents'", "in", "tree_or_item", ":", "# It is a binder.", "tree", "=", "tree_or_item", "# Grab the package m...
Given a tree, parse to a set of models
[ "Given", "a", "tree", "parse", "to", "a", "set", "of", "models" ]
python
train
aio-libs/sockjs
sockjs/session.py
https://github.com/aio-libs/sockjs/blob/e5d5f24f6a1377419b13199ecf631df66667bcbb/sockjs/session.py#L231-L239
def send_frame(self, frm): """send message frame to client.""" if self._debug: log.info("outgoing message: %s, %s", self.id, frm[:200]) if self.state != STATE_OPEN: return self._feed(FRAME_MESSAGE_BLOB, frm)
[ "def", "send_frame", "(", "self", ",", "frm", ")", ":", "if", "self", ".", "_debug", ":", "log", ".", "info", "(", "\"outgoing message: %s, %s\"", ",", "self", ".", "id", ",", "frm", "[", ":", "200", "]", ")", "if", "self", ".", "state", "!=", "STA...
send message frame to client.
[ "send", "message", "frame", "to", "client", "." ]
python
train
fy0/slim
slim/base/permission.py
https://github.com/fy0/slim/blob/9951a910750888dbe7dd3e98acae9c40efae0689/slim/base/permission.py#L130-L142
def add_common_check(self, actions, table, func): """ emitted before query :param actions: :param table: :param func: :return: """ self.common_checks.append([table, actions, func]) """def func(ability, user, action, available_columns: list): ...
[ "def", "add_common_check", "(", "self", ",", "actions", ",", "table", ",", "func", ")", ":", "self", ".", "common_checks", ".", "append", "(", "[", "table", ",", "actions", ",", "func", "]", ")", "\"\"\"def func(ability, user, action, available_columns: list):\n ...
emitted before query :param actions: :param table: :param func: :return:
[ "emitted", "before", "query", ":", "param", "actions", ":", ":", "param", "table", ":", ":", "param", "func", ":", ":", "return", ":" ]
python
valid
albahnsen/CostSensitiveClassification
costcla/models/bagging.py
https://github.com/albahnsen/CostSensitiveClassification/blob/75778ae32c70671c0cdde6c4651277b6a8b58871/costcla/models/bagging.py#L134-L150
def _parallel_predict(estimators, estimators_features, X, n_classes, combination, estimators_weight): """Private function used to compute predictions within a job.""" n_samples = X.shape[0] pred = np.zeros((n_samples, n_classes)) n_estimators = len(estimators) for estimator, features, weight in zip...
[ "def", "_parallel_predict", "(", "estimators", ",", "estimators_features", ",", "X", ",", "n_classes", ",", "combination", ",", "estimators_weight", ")", ":", "n_samples", "=", "X", ".", "shape", "[", "0", "]", "pred", "=", "np", ".", "zeros", "(", "(", ...
Private function used to compute predictions within a job.
[ "Private", "function", "used", "to", "compute", "predictions", "within", "a", "job", "." ]
python
train
bitesofcode/projexui
projexui/widgets/xscintillaedit/xscintillaedit.py
https://github.com/bitesofcode/projexui/blob/f18a73bec84df90b034ca69b9deea118dbedfc4d/projexui/widgets/xscintillaedit/xscintillaedit.py#L88-L104
def addBreakpoint( self, lineno = -1 ): """ Adds a breakpoint for the given line number to this edit. :note The lineno is 0-based, while the editor displays lines as a 1-based system. So, if you want to put a breakpoint at visual line...
[ "def", "addBreakpoint", "(", "self", ",", "lineno", "=", "-", "1", ")", ":", "if", "(", "lineno", "==", "-", "1", ")", ":", "lineno", ",", "colno", "=", "self", ".", "getCursorPosition", "(", ")", "self", ".", "markerAdd", "(", "lineno", ",", "self...
Adds a breakpoint for the given line number to this edit. :note The lineno is 0-based, while the editor displays lines as a 1-based system. So, if you want to put a breakpoint at visual line 3, you would pass in lineno as 2 :param ...
[ "Adds", "a", "breakpoint", "for", "the", "given", "line", "number", "to", "this", "edit", ".", ":", "note", "The", "lineno", "is", "0", "-", "based", "while", "the", "editor", "displays", "lines", "as", "a", "1", "-", "based", "system", ".", "So", "i...
python
train
thombashi/typepy
typepy/type/_base.py
https://github.com/thombashi/typepy/blob/8209d1df4f2a7f196a9fa4bfb0708c5ff648461f/typepy/type/_base.py#L109-L121
def convert(self): """ :return: Converted value. :raises typepy.TypeConversionError: If the value cannot convert. """ if self.is_type(): return self.force_convert() raise TypeConversionError( "failed to convert from {} to {}".format(t...
[ "def", "convert", "(", "self", ")", ":", "if", "self", ".", "is_type", "(", ")", ":", "return", "self", ".", "force_convert", "(", ")", "raise", "TypeConversionError", "(", "\"failed to convert from {} to {}\"", ".", "format", "(", "type", "(", "self", ".", ...
:return: Converted value. :raises typepy.TypeConversionError: If the value cannot convert.
[ ":", "return", ":", "Converted", "value", ".", ":", "raises", "typepy", ".", "TypeConversionError", ":", "If", "the", "value", "cannot", "convert", "." ]
python
train
chrisjrn/registrasion
registrasion/forms.py
https://github.com/chrisjrn/registrasion/blob/461d5846c6f9f3b7099322a94f5d9911564448e4/registrasion/forms.py#L437-L459
def staff_products_form_factory(user): ''' Creates a StaffProductsForm that restricts the available products to those that are available to a user. ''' products = inventory.Product.objects.all() products = ProductController.available_products(user, products=products) product_ids = [product.id for ...
[ "def", "staff_products_form_factory", "(", "user", ")", ":", "products", "=", "inventory", ".", "Product", ".", "objects", ".", "all", "(", ")", "products", "=", "ProductController", ".", "available_products", "(", "user", ",", "products", "=", "products", ")"...
Creates a StaffProductsForm that restricts the available products to those that are available to a user.
[ "Creates", "a", "StaffProductsForm", "that", "restricts", "the", "available", "products", "to", "those", "that", "are", "available", "to", "a", "user", "." ]
python
test
ninuxorg/nodeshot
nodeshot/community/participation/models/__init__.py
https://github.com/ninuxorg/nodeshot/blob/2466f0a55f522b2696026f196436ce7ba3f1e5c6/nodeshot/community/participation/models/__init__.py#L160-L168
def create_layer_rating_settings(sender, **kwargs): """ create layer rating settings """ created = kwargs['created'] layer = kwargs['instance'] if created: # create layer participation settings # task will be executed in background unless settings.CELERY_ALWAYS_EAGER is True # if...
[ "def", "create_layer_rating_settings", "(", "sender", ",", "*", "*", "kwargs", ")", ":", "created", "=", "kwargs", "[", "'created'", "]", "layer", "=", "kwargs", "[", "'instance'", "]", "if", "created", ":", "# create layer participation settings", "# task will be...
create layer rating settings
[ "create", "layer", "rating", "settings" ]
python
train
utiasSTARS/pykitti
pykitti/raw.py
https://github.com/utiasSTARS/pykitti/blob/d3e1bb81676e831886726cc5ed79ce1f049aef2c/pykitti/raw.py#L225-L244
def _load_calib(self): """Load and compute intrinsic and extrinsic calibration parameters.""" # We'll build the calibration parameters as a dictionary, then # convert it to a namedtuple to prevent it from being modified later data = {} # Load the rigid transformation from IMU to...
[ "def", "_load_calib", "(", "self", ")", ":", "# We'll build the calibration parameters as a dictionary, then", "# convert it to a namedtuple to prevent it from being modified later", "data", "=", "{", "}", "# Load the rigid transformation from IMU to velodyne", "data", "[", "'T_velo_im...
Load and compute intrinsic and extrinsic calibration parameters.
[ "Load", "and", "compute", "intrinsic", "and", "extrinsic", "calibration", "parameters", "." ]
python
train
lewisjared/credkeep
credkeep/util.py
https://github.com/lewisjared/credkeep/blob/63638ced094992552a28109b91839bcbbbe9230a/credkeep/util.py#L12-L27
def clear_to_enc_filename(fname): """ Converts the filename of a cleartext file and convert it to an encrypted filename :param fname: :return: filename of encrypted secret file if found, else None """ if not fname.lower().endswith('.json'): raise CredkeepException('Invalid filetype') ...
[ "def", "clear_to_enc_filename", "(", "fname", ")", ":", "if", "not", "fname", ".", "lower", "(", ")", ".", "endswith", "(", "'.json'", ")", ":", "raise", "CredkeepException", "(", "'Invalid filetype'", ")", "if", "fname", ".", "lower", "(", ")", ".", "en...
Converts the filename of a cleartext file and convert it to an encrypted filename :param fname: :return: filename of encrypted secret file if found, else None
[ "Converts", "the", "filename", "of", "a", "cleartext", "file", "and", "convert", "it", "to", "an", "encrypted", "filename" ]
python
train
stephanepechard/projy
projy/templates/ProjyTemplateTemplate.py
https://github.com/stephanepechard/projy/blob/3146b0e3c207b977e1b51fcb33138746dae83c23/projy/templates/ProjyTemplateTemplate.py#L28-L35
def substitutes(self): """ Return the substitutions for the templating replacements. """ substitute_dict = dict( project = self.project_name, template = self.project_name + 'Template', file = self.project_name + 'FileTemplate', ) return substitute_dict
[ "def", "substitutes", "(", "self", ")", ":", "substitute_dict", "=", "dict", "(", "project", "=", "self", ".", "project_name", ",", "template", "=", "self", ".", "project_name", "+", "'Template'", ",", "file", "=", "self", ".", "project_name", "+", "'FileT...
Return the substitutions for the templating replacements.
[ "Return", "the", "substitutions", "for", "the", "templating", "replacements", "." ]
python
train
eugene-eeo/signalsdb
signalsdb/api.py
https://github.com/eugene-eeo/signalsdb/blob/d6129c5790c89dec20bc8bfde66ef7b909a38146/signalsdb/api.py#L41-L58
def search(signal='', action='', signals=SIGNALS): """ Search the signals DB for signal named *signal*, and which action matches *action* in a case insensitive way. :param signal: Regex for signal name. :param action: Regex for default action. :param signals: Database of signals. """ ...
[ "def", "search", "(", "signal", "=", "''", ",", "action", "=", "''", ",", "signals", "=", "SIGNALS", ")", ":", "sig_re", "=", "re", ".", "compile", "(", "signal", ",", "re", ".", "IGNORECASE", ")", "act_re", "=", "re", ".", "compile", "(", "action"...
Search the signals DB for signal named *signal*, and which action matches *action* in a case insensitive way. :param signal: Regex for signal name. :param action: Regex for default action. :param signals: Database of signals.
[ "Search", "the", "signals", "DB", "for", "signal", "named", "*", "signal", "*", "and", "which", "action", "matches", "*", "action", "*", "in", "a", "case", "insensitive", "way", "." ]
python
train
Becksteinlab/GromacsWrapper
gromacs/core.py
https://github.com/Becksteinlab/GromacsWrapper/blob/d4f9a8cb6f48292732cf7c7e4ef4a6d2ccbc51b9/gromacs/core.py#L581-L606
def _build_arg_list(self, **kwargs): """Build list of arguments from the dict; keys must be valid gromacs flags.""" arglist = [] for flag, value in kwargs.items(): # XXX: check flag against allowed values flag = str(flag) if flag.startswith('_'): ...
[ "def", "_build_arg_list", "(", "self", ",", "*", "*", "kwargs", ")", ":", "arglist", "=", "[", "]", "for", "flag", ",", "value", "in", "kwargs", ".", "items", "(", ")", ":", "# XXX: check flag against allowed values", "flag", "=", "str", "(", "flag", ")"...
Build list of arguments from the dict; keys must be valid gromacs flags.
[ "Build", "list", "of", "arguments", "from", "the", "dict", ";", "keys", "must", "be", "valid", "gromacs", "flags", "." ]
python
valid
awkman/pywifi
pywifi/iface.py
https://github.com/awkman/pywifi/blob/719baf73d8d32c623dbaf5e9de5d973face152a4/pywifi/iface.py#L80-L93
def network_profiles(self): """Get all the AP profiles.""" profiles = self._wifi_ctrl.network_profiles(self._raw_obj) if self._logger.isEnabledFor(logging.INFO): for profile in profiles: self._logger.info("Get profile:") self._logger.info("\tssid: %s...
[ "def", "network_profiles", "(", "self", ")", ":", "profiles", "=", "self", ".", "_wifi_ctrl", ".", "network_profiles", "(", "self", ".", "_raw_obj", ")", "if", "self", ".", "_logger", ".", "isEnabledFor", "(", "logging", ".", "INFO", ")", ":", "for", "pr...
Get all the AP profiles.
[ "Get", "all", "the", "AP", "profiles", "." ]
python
train
ASMfreaK/habitipy
habitipy/api.py
https://github.com/ASMfreaK/habitipy/blob/555b8b20faf6d553353092614a8a0d612f0adbde/habitipy/api.py#L287-L297
def download_api(branch=None) -> str: """download API documentation from _branch_ of Habitica\'s repo on Github""" habitica_github_api = 'https://api.github.com/repos/HabitRPG/habitica' if not branch: branch = requests.get(habitica_github_api + '/releases/latest').json()['tag_name'] curl = local...
[ "def", "download_api", "(", "branch", "=", "None", ")", "->", "str", ":", "habitica_github_api", "=", "'https://api.github.com/repos/HabitRPG/habitica'", "if", "not", "branch", ":", "branch", "=", "requests", ".", "get", "(", "habitica_github_api", "+", "'/releases/...
download API documentation from _branch_ of Habitica\'s repo on Github
[ "download", "API", "documentation", "from", "_branch_", "of", "Habitica", "\\", "s", "repo", "on", "Github" ]
python
train
thespacedoctor/transientNamer
transientNamer/search.py
https://github.com/thespacedoctor/transientNamer/blob/39be410c84275ed4669632f5df67e728d66a318f/transientNamer/search.py#L820-L843
def _file_prefix( self): """*Generate a file prefix based on the type of search for saving files to disk* **Return:** - ``prefix`` -- the file prefix """ self.log.info('starting the ``_file_prefix`` method') if self.ra: now = datetime.now() ...
[ "def", "_file_prefix", "(", "self", ")", ":", "self", ".", "log", ".", "info", "(", "'starting the ``_file_prefix`` method'", ")", "if", "self", ".", "ra", ":", "now", "=", "datetime", ".", "now", "(", ")", "prefix", "=", "now", ".", "strftime", "(", "...
*Generate a file prefix based on the type of search for saving files to disk* **Return:** - ``prefix`` -- the file prefix
[ "*", "Generate", "a", "file", "prefix", "based", "on", "the", "type", "of", "search", "for", "saving", "files", "to", "disk", "*" ]
python
train
tomer8007/kik-bot-api-unofficial
kik_unofficial/client.py
https://github.com/tomer8007/kik-bot-api-unofficial/blob/2ae5216bc05e7099a41895382fc8e428a7a5c3ac/kik_unofficial/client.py#L544-L565
def _kik_connection_thread_function(self): """ The Kik Connection thread main function. Initiates the asyncio loop and actually connects. """ # If there is already a connection going, than wait for it to stop if self.loop and self.loop.is_running(): self.loop....
[ "def", "_kik_connection_thread_function", "(", "self", ")", ":", "# If there is already a connection going, than wait for it to stop", "if", "self", ".", "loop", "and", "self", ".", "loop", ".", "is_running", "(", ")", ":", "self", ".", "loop", ".", "call_soon_threads...
The Kik Connection thread main function. Initiates the asyncio loop and actually connects.
[ "The", "Kik", "Connection", "thread", "main", "function", ".", "Initiates", "the", "asyncio", "loop", "and", "actually", "connects", "." ]
python
train
artefactual-labs/agentarchives
agentarchives/atom/client.py
https://github.com/artefactual-labs/agentarchives/blob/af19ade56a90c64069cf46b50972fe72b6f10a45/agentarchives/atom/client.py#L278-L304
def collection_list(self, resource_id, resource_type="collection"): """ Fetches a list of slug representing descriptions within the specified parent description. :param resource_id str: The slug of the description to fetch children from. :param resource_type str: no-op; not required or ...
[ "def", "collection_list", "(", "self", ",", "resource_id", ",", "resource_type", "=", "\"collection\"", ")", ":", "def", "fetch_children", "(", "children", ")", ":", "results", "=", "[", "]", "for", "child", "in", "children", ":", "results", ".", "append", ...
Fetches a list of slug representing descriptions within the specified parent description. :param resource_id str: The slug of the description to fetch children from. :param resource_type str: no-op; not required or used in this implementation. :return: A list of strings representing the slugs ...
[ "Fetches", "a", "list", "of", "slug", "representing", "descriptions", "within", "the", "specified", "parent", "description", "." ]
python
train
google/dotty
efilter/parsers/common/grammar.py
https://github.com/google/dotty/blob/b145131499be0c4b755fc2e2ac19be11a50bce6a/efilter/parsers/common/grammar.py#L234-L242
def keyword(tokens, expected): """Case-insensitive keyword match.""" try: token = next(iter(tokens)) except StopIteration: return if token and token.name == "symbol" and token.value.lower() == expected: return TokenMatch(None, token.value, (token,))
[ "def", "keyword", "(", "tokens", ",", "expected", ")", ":", "try", ":", "token", "=", "next", "(", "iter", "(", "tokens", ")", ")", "except", "StopIteration", ":", "return", "if", "token", "and", "token", ".", "name", "==", "\"symbol\"", "and", "token"...
Case-insensitive keyword match.
[ "Case", "-", "insensitive", "keyword", "match", "." ]
python
train
Skyscanner/pycfmodel
pycfmodel/model/resources/properties/policy_document.py
https://github.com/Skyscanner/pycfmodel/blob/e3da4db96f59c0a5dba06ae66ad25645775e5500/pycfmodel/model/resources/properties/policy_document.py#L191-L204
def wildcard_allowed_principals(self, pattern=None): """ Find statements which allow wildcard principals. A pattern can be specified for the wildcard principal """ wildcard_allowed = [] for statement in self.statements: if statement.wildcard_principals(patt...
[ "def", "wildcard_allowed_principals", "(", "self", ",", "pattern", "=", "None", ")", ":", "wildcard_allowed", "=", "[", "]", "for", "statement", "in", "self", ".", "statements", ":", "if", "statement", ".", "wildcard_principals", "(", "pattern", ")", "and", ...
Find statements which allow wildcard principals. A pattern can be specified for the wildcard principal
[ "Find", "statements", "which", "allow", "wildcard", "principals", "." ]
python
train
sorgerlab/indra
indra/sources/reach/processor.py
https://github.com/sorgerlab/indra/blob/79a70415832c5702d7a820c7c9ccc8e25010124b/indra/sources/reach/processor.py#L60-L75
def get_all_events(self): """Gather all event IDs in the REACH output by type. These IDs are stored in the self.all_events dict. """ self.all_events = {} events = self.tree.execute("$.events.frames") if events is None: return for e in events: ...
[ "def", "get_all_events", "(", "self", ")", ":", "self", ".", "all_events", "=", "{", "}", "events", "=", "self", ".", "tree", ".", "execute", "(", "\"$.events.frames\"", ")", "if", "events", "is", "None", ":", "return", "for", "e", "in", "events", ":",...
Gather all event IDs in the REACH output by type. These IDs are stored in the self.all_events dict.
[ "Gather", "all", "event", "IDs", "in", "the", "REACH", "output", "by", "type", "." ]
python
train
tamasgal/km3pipe
km3pipe/dataclasses.py
https://github.com/tamasgal/km3pipe/blob/7a9b59ac899a28775b5bdc5d391d9a5340d08040/km3pipe/dataclasses.py#L421-L435
def sorted(self, by, **kwargs): """Sort array by a column. Parameters ========== by: str Name of the columns to sort by(e.g. 'time'). """ sort_idc = np.argsort(self[by], **kwargs) return self.__class__( self[sort_idc], h5loc=se...
[ "def", "sorted", "(", "self", ",", "by", ",", "*", "*", "kwargs", ")", ":", "sort_idc", "=", "np", ".", "argsort", "(", "self", "[", "by", "]", ",", "*", "*", "kwargs", ")", "return", "self", ".", "__class__", "(", "self", "[", "sort_idc", "]", ...
Sort array by a column. Parameters ========== by: str Name of the columns to sort by(e.g. 'time').
[ "Sort", "array", "by", "a", "column", "." ]
python
train
mar10/pyftpsync
ftpsync/targets.py
https://github.com/mar10/pyftpsync/blob/bbdc94186975cdc1cc4f678474bdce08bce7bb76/ftpsync/targets.py#L201-L208
def check_write(self, name): """Raise exception if writing cur_dir/name is not allowed.""" assert compat.is_native(name) if self.readonly and name not in ( DirMetadata.META_FILE_NAME, DirMetadata.LOCK_FILE_NAME, ): raise RuntimeError("Target is read-on...
[ "def", "check_write", "(", "self", ",", "name", ")", ":", "assert", "compat", ".", "is_native", "(", "name", ")", "if", "self", ".", "readonly", "and", "name", "not", "in", "(", "DirMetadata", ".", "META_FILE_NAME", ",", "DirMetadata", ".", "LOCK_FILE_NAME...
Raise exception if writing cur_dir/name is not allowed.
[ "Raise", "exception", "if", "writing", "cur_dir", "/", "name", "is", "not", "allowed", "." ]
python
train
onecodex/onecodex
onecodex/distance.py
https://github.com/onecodex/onecodex/blob/326a0a1af140e3a57ccf31c3c9c5e17a5775c13d/onecodex/distance.py#L44-L73
def beta_diversity(self, metric="braycurtis", rank="auto"): """Calculate the diversity between two communities. Parameters ---------- metric : {'jaccard', 'braycurtis', 'cityblock'} The distance metric to calculate. rank : {'auto', 'kingdom', 'phylum', 'class', 'orde...
[ "def", "beta_diversity", "(", "self", ",", "metric", "=", "\"braycurtis\"", ",", "rank", "=", "\"auto\"", ")", ":", "if", "metric", "not", "in", "(", "\"jaccard\"", ",", "\"braycurtis\"", ",", "\"cityblock\"", ")", ":", "raise", "OneCodexException", "(", "\"...
Calculate the diversity between two communities. Parameters ---------- metric : {'jaccard', 'braycurtis', 'cityblock'} The distance metric to calculate. rank : {'auto', 'kingdom', 'phylum', 'class', 'order', 'family', 'genus', 'species'}, optional Analysis will b...
[ "Calculate", "the", "diversity", "between", "two", "communities", "." ]
python
train
humilis/humilis-lambdautils
lambdautils/utils.py
https://github.com/humilis/humilis-lambdautils/blob/58f75eb5ace23523c283708d56a9193181ea7e8e/lambdautils/utils.py#L136-L161
def annotate_event(ev, key, ts=None, namespace=None, **kwargs): """Add an annotation to an event.""" ann = {} if ts is None: ts = time.time() ann["ts"] = ts ann["key"] = key if namespace is None and "HUMILIS_ENVIRONMENT" in os.environ: namespace = "{}:{}:{}".format( o...
[ "def", "annotate_event", "(", "ev", ",", "key", ",", "ts", "=", "None", ",", "namespace", "=", "None", ",", "*", "*", "kwargs", ")", ":", "ann", "=", "{", "}", "if", "ts", "is", "None", ":", "ts", "=", "time", ".", "time", "(", ")", "ann", "[...
Add an annotation to an event.
[ "Add", "an", "annotation", "to", "an", "event", "." ]
python
train
solocompt/plugs-mail
plugs_mail/management/commands/load_email_templates.py
https://github.com/solocompt/plugs-mail/blob/6139fa79ddb437562db1769d03bd3098c25a06fa/plugs_mail/management/commands/load_email_templates.py#L171-L180
def open_file(self, file_): """ Receives a file path has input and returns a string with the contents of the file """ with open(file_, 'r', encoding='utf-8') as file: text = '' for line in file: text += line return text
[ "def", "open_file", "(", "self", ",", "file_", ")", ":", "with", "open", "(", "file_", ",", "'r'", ",", "encoding", "=", "'utf-8'", ")", "as", "file", ":", "text", "=", "''", "for", "line", "in", "file", ":", "text", "+=", "line", "return", "text" ...
Receives a file path has input and returns a string with the contents of the file
[ "Receives", "a", "file", "path", "has", "input", "and", "returns", "a", "string", "with", "the", "contents", "of", "the", "file" ]
python
train
gregarmer/trunserver
trunserv/autoreload.py
https://github.com/gregarmer/trunserver/blob/80906fa5331f4a35260f35c0082cf4dd299543ea/trunserv/autoreload.py#L71-L82
def reloader_thread(softexit=False): """If ``soft_exit`` is True, we use sys.exit(); otherwise ``os_exit`` will be used to end the process. """ while RUN_RELOADER: if code_changed(): # force reload if softexit: sys.exit(3) else: ...
[ "def", "reloader_thread", "(", "softexit", "=", "False", ")", ":", "while", "RUN_RELOADER", ":", "if", "code_changed", "(", ")", ":", "# force reload", "if", "softexit", ":", "sys", ".", "exit", "(", "3", ")", "else", ":", "os", ".", "_exit", "(", "3",...
If ``soft_exit`` is True, we use sys.exit(); otherwise ``os_exit`` will be used to end the process.
[ "If", "soft_exit", "is", "True", "we", "use", "sys", ".", "exit", "()", ";", "otherwise", "os_exit", "will", "be", "used", "to", "end", "the", "process", "." ]
python
train
DataKitchen/DKCloudCommand
DKCloudCommand/modules/DKCloudAPI.py
https://github.com/DataKitchen/DKCloudCommand/blob/1cf9cb08ab02f063eef6b5c4b327af142991daa3/DKCloudCommand/modules/DKCloudAPI.py#L904-L935
def recipe_tree(self, kitchen, recipe): """ gets the status of a recipe :param self: DKCloudAPI :param kitchen: string :param recipe: string :rtype: dict """ rc = DKReturnCode() if kitchen is None or isinstance(kitchen, basestring) is False: ...
[ "def", "recipe_tree", "(", "self", ",", "kitchen", ",", "recipe", ")", ":", "rc", "=", "DKReturnCode", "(", ")", "if", "kitchen", "is", "None", "or", "isinstance", "(", "kitchen", ",", "basestring", ")", "is", "False", ":", "rc", ".", "set", "(", "rc...
gets the status of a recipe :param self: DKCloudAPI :param kitchen: string :param recipe: string :rtype: dict
[ "gets", "the", "status", "of", "a", "recipe", ":", "param", "self", ":", "DKCloudAPI", ":", "param", "kitchen", ":", "string", ":", "param", "recipe", ":", "string", ":", "rtype", ":", "dict" ]
python
train
JohnVinyard/zounds
zounds/spectral/frequencyscale.py
https://github.com/JohnVinyard/zounds/blob/337b3f98753d09eaab1c72dcd37bb852a3fa5ac6/zounds/spectral/frequencyscale.py#L241-L247
def Q(self): """ The quality factor of the scale, or, the ratio of center frequencies to bandwidths """ return np.array(list(self.center_frequencies)) \ / np.array(list(self.bandwidths))
[ "def", "Q", "(", "self", ")", ":", "return", "np", ".", "array", "(", "list", "(", "self", ".", "center_frequencies", ")", ")", "/", "np", ".", "array", "(", "list", "(", "self", ".", "bandwidths", ")", ")" ]
The quality factor of the scale, or, the ratio of center frequencies to bandwidths
[ "The", "quality", "factor", "of", "the", "scale", "or", "the", "ratio", "of", "center", "frequencies", "to", "bandwidths" ]
python
train
Azure/azure-cosmos-table-python
azure-cosmosdb-table/azure/cosmosdb/table/_encryption.py
https://github.com/Azure/azure-cosmos-table-python/blob/a7b618f6bddc465c9fdf899ea2971dfe4d04fcf0/azure-cosmosdb-table/azure/cosmosdb/table/_encryption.py#L163-L212
def _decrypt_entity(entity, encrypted_properties_list, content_encryption_key, entityIV, isJavaV1): ''' Decrypts the specified entity using AES256 in CBC mode with 128 bit padding. Unwraps the CEK using either the specified KEK or the key returned by the key_resolver. Properties specified in the encry...
[ "def", "_decrypt_entity", "(", "entity", ",", "encrypted_properties_list", ",", "content_encryption_key", ",", "entityIV", ",", "isJavaV1", ")", ":", "_validate_not_none", "(", "'entity'", ",", "entity", ")", "decrypted_entity", "=", "deepcopy", "(", "entity", ")", ...
Decrypts the specified entity using AES256 in CBC mode with 128 bit padding. Unwraps the CEK using either the specified KEK or the key returned by the key_resolver. Properties specified in the encrypted_properties_list, will be decrypted and decoded to utf-8 strings. :param entity: The entity bei...
[ "Decrypts", "the", "specified", "entity", "using", "AES256", "in", "CBC", "mode", "with", "128", "bit", "padding", ".", "Unwraps", "the", "CEK", "using", "either", "the", "specified", "KEK", "or", "the", "key", "returned", "by", "the", "key_resolver", ".", ...
python
train
welbornprod/colr
colr/progress.py
https://github.com/welbornprod/colr/blob/417117fdbddbc53142096685ac2af006b2bd0220/colr/progress.py#L754-L760
def update(self, percent=None, text=None): """ Update the progress bar percentage and message. """ if percent is not None: self.percent = percent if text is not None: self.message = text super().update()
[ "def", "update", "(", "self", ",", "percent", "=", "None", ",", "text", "=", "None", ")", ":", "if", "percent", "is", "not", "None", ":", "self", ".", "percent", "=", "percent", "if", "text", "is", "not", "None", ":", "self", ".", "message", "=", ...
Update the progress bar percentage and message.
[ "Update", "the", "progress", "bar", "percentage", "and", "message", "." ]
python
train
CZ-NIC/yangson
yangson/datatype.py
https://github.com/CZ-NIC/yangson/blob/a4b9464041fa8b28f6020a420ababf18fddf5d4a/yangson/datatype.py#L182-L184
def _handle_properties(self, stmt: Statement, sctx: SchemaContext) -> None: """Handle type substatements.""" self._handle_restrictions(stmt, sctx)
[ "def", "_handle_properties", "(", "self", ",", "stmt", ":", "Statement", ",", "sctx", ":", "SchemaContext", ")", "->", "None", ":", "self", ".", "_handle_restrictions", "(", "stmt", ",", "sctx", ")" ]
Handle type substatements.
[ "Handle", "type", "substatements", "." ]
python
train
sbg/sevenbridges-python
sevenbridges/models/automation.py
https://github.com/sbg/sevenbridges-python/blob/f62640d1018d959f0b686f2dbe5e183085336607/sevenbridges/models/automation.py#L104-L122
def query(cls, automation=None, offset=None, limit=None, api=None): """ Query (List) apps. :param automation: Automation id. :param offset: Pagination offset. :param limit: Pagination limit. :param api: Api instance. :return: collection object """ ...
[ "def", "query", "(", "cls", ",", "automation", "=", "None", ",", "offset", "=", "None", ",", "limit", "=", "None", ",", "api", "=", "None", ")", ":", "automation_id", "=", "Transform", ".", "to_automation", "(", "automation", ")", "api", "=", "api", ...
Query (List) apps. :param automation: Automation id. :param offset: Pagination offset. :param limit: Pagination limit. :param api: Api instance. :return: collection object
[ "Query", "(", "List", ")", "apps", ".", ":", "param", "automation", ":", "Automation", "id", ".", ":", "param", "offset", ":", "Pagination", "offset", ".", ":", "param", "limit", ":", "Pagination", "limit", ".", ":", "param", "api", ":", "Api", "instan...
python
train
quodlibet/mutagen
mutagen/_tools/mid3v2.py
https://github.com/quodlibet/mutagen/blob/e393df5971ba41ba5a50de9c2c9e7e5484d82c4e/mutagen/_tools/mid3v2.py#L115-L126
def frame_from_fsnative(arg): """Takes item from argv and returns ascii native str or raises ValueError. """ assert isinstance(arg, fsnative) text = fsn2text(arg, strict=True) if PY2: return text.encode("ascii") else: return text.encode("ascii").decode("ascii")
[ "def", "frame_from_fsnative", "(", "arg", ")", ":", "assert", "isinstance", "(", "arg", ",", "fsnative", ")", "text", "=", "fsn2text", "(", "arg", ",", "strict", "=", "True", ")", "if", "PY2", ":", "return", "text", ".", "encode", "(", "\"ascii\"", ")"...
Takes item from argv and returns ascii native str or raises ValueError.
[ "Takes", "item", "from", "argv", "and", "returns", "ascii", "native", "str", "or", "raises", "ValueError", "." ]
python
train
bachya/regenmaschine
regenmaschine/watering.py
https://github.com/bachya/regenmaschine/blob/99afb648fe454dc4a7d5db85a02a8b3b5d26f8bc/regenmaschine/watering.py#L13-L28
async def log( self, date: datetime.date = None, days: int = None, details: bool = False) -> list: """Get watering information for X days from Y date.""" endpoint = 'watering/log' if details: endpoint += '/details' if date and ...
[ "async", "def", "log", "(", "self", ",", "date", ":", "datetime", ".", "date", "=", "None", ",", "days", ":", "int", "=", "None", ",", "details", ":", "bool", "=", "False", ")", "->", "list", ":", "endpoint", "=", "'watering/log'", "if", "details", ...
Get watering information for X days from Y date.
[ "Get", "watering", "information", "for", "X", "days", "from", "Y", "date", "." ]
python
train
DemocracyClub/uk-election-ids
uk_election_ids/election_ids.py
https://github.com/DemocracyClub/uk-election-ids/blob/566895e15b539e8a7fa3bebb680d5cd326cf6b6b/uk_election_ids/election_ids.py#L204-L215
def subtype_group_id(self): """ str: Subtype Group ID """ self._validate() self._validate_for_subtype_group_id() parts = [] parts.append(self.election_type) parts.append(self.subtype) parts.append(self.date) return ".".join(parts)
[ "def", "subtype_group_id", "(", "self", ")", ":", "self", ".", "_validate", "(", ")", "self", ".", "_validate_for_subtype_group_id", "(", ")", "parts", "=", "[", "]", "parts", ".", "append", "(", "self", ".", "election_type", ")", "parts", ".", "append", ...
str: Subtype Group ID
[ "str", ":", "Subtype", "Group", "ID" ]
python
train
thunder-project/thunder
thunder/series/series.py
https://github.com/thunder-project/thunder/blob/967ff8f3e7c2fabe1705743d95eb2746d4329786/thunder/series/series.py#L807-L835
def _makewindows(self, indices, window): """ Make masks used by windowing functions Given a list of indices specifying window centers, and a window size, construct a list of index arrays, one per window, that index into the target array Parameters ---------- ...
[ "def", "_makewindows", "(", "self", ",", "indices", ",", "window", ")", ":", "div", "=", "divmod", "(", "window", ",", "2", ")", "before", "=", "div", "[", "0", "]", "after", "=", "div", "[", "0", "]", "+", "div", "[", "1", "]", "index", "=", ...
Make masks used by windowing functions Given a list of indices specifying window centers, and a window size, construct a list of index arrays, one per window, that index into the target array Parameters ---------- indices : array-like List of times specifyin...
[ "Make", "masks", "used", "by", "windowing", "functions" ]
python
train
tensorflow/tensor2tensor
tensor2tensor/layers/common_layers.py
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/layers/common_layers.py#L3144-L3195
def batch_dense(inputs, units, activation=None, kernel_initializer=None, reuse=None, name=None): """Multiply a batch of input matrices by a batch of parameter matrices. Each input matrix is multiplied by the corresponding parameter mat...
[ "def", "batch_dense", "(", "inputs", ",", "units", ",", "activation", "=", "None", ",", "kernel_initializer", "=", "None", ",", "reuse", "=", "None", ",", "name", "=", "None", ")", ":", "inputs_shape", "=", "shape_list", "(", "inputs", ")", "if", "len", ...
Multiply a batch of input matrices by a batch of parameter matrices. Each input matrix is multiplied by the corresponding parameter matrix. This is useful in a mixture-of-experts where the batch represents different experts with different inputs. Args: inputs: a Tensor with shape [batch, length, input_un...
[ "Multiply", "a", "batch", "of", "input", "matrices", "by", "a", "batch", "of", "parameter", "matrices", "." ]
python
train
O365/python-o365
O365/connection.py
https://github.com/O365/python-o365/blob/02a71cf3775cc6a3c042e003365d6a07c8c75a73/O365/connection.py#L509-L536
def refresh_token(self): """ Refresh the OAuth authorization token. This will be called automatically when the access token expires, however, you can manually call this method to request a new refresh token. :return bool: Success / Failure """ if self.se...
[ "def", "refresh_token", "(", "self", ")", ":", "if", "self", ".", "session", "is", "None", ":", "self", ".", "session", "=", "self", ".", "get_session", "(", ")", "token", "=", "self", ".", "token_backend", ".", "token", "if", "token", "and", "token", ...
Refresh the OAuth authorization token. This will be called automatically when the access token expires, however, you can manually call this method to request a new refresh token. :return bool: Success / Failure
[ "Refresh", "the", "OAuth", "authorization", "token", ".", "This", "will", "be", "called", "automatically", "when", "the", "access", "token", "expires", "however", "you", "can", "manually", "call", "this", "method", "to", "request", "a", "new", "refresh", "toke...
python
train
ruipgil/TrackToTrip
tracktotrip/segment.py
https://github.com/ruipgil/TrackToTrip/blob/5537c14ee9748091b5255b658ab528e1d6227f99/tracktotrip/segment.py#L20-L39
def remove_liers(points): """ Removes obvious noise points Checks time consistency, removing points that appear out of order Args: points (:obj:`list` of :obj:`Point`) Returns: :obj:`list` of :obj:`Point` """ result = [points[0]] for i in range(1, len(points) - 2): ...
[ "def", "remove_liers", "(", "points", ")", ":", "result", "=", "[", "points", "[", "0", "]", "]", "for", "i", "in", "range", "(", "1", ",", "len", "(", "points", ")", "-", "2", ")", ":", "prv", "=", "points", "[", "i", "-", "1", "]", "crr", ...
Removes obvious noise points Checks time consistency, removing points that appear out of order Args: points (:obj:`list` of :obj:`Point`) Returns: :obj:`list` of :obj:`Point`
[ "Removes", "obvious", "noise", "points" ]
python
train
saltstack/salt
salt/modules/vsphere.py
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/vsphere.py#L4620-L4654
def _get_policy_dict(policy): '''Returns a dictionary representation of a policy''' profile_dict = {'name': policy.name, 'description': policy.description, 'resource_type': policy.resourceType.resourceType} subprofile_dicts = [] if isinstance(policy, pbm.profile.C...
[ "def", "_get_policy_dict", "(", "policy", ")", ":", "profile_dict", "=", "{", "'name'", ":", "policy", ".", "name", ",", "'description'", ":", "policy", ".", "description", ",", "'resource_type'", ":", "policy", ".", "resourceType", ".", "resourceType", "}", ...
Returns a dictionary representation of a policy
[ "Returns", "a", "dictionary", "representation", "of", "a", "policy" ]
python
train
xolox/python-vcs-repo-mgr
vcs_repo_mgr/__init__.py
https://github.com/xolox/python-vcs-repo-mgr/blob/fdad2441a3e7ba5deeeddfa1c2f5ebc00c393aed/vcs_repo_mgr/__init__.py#L1213-L1222
def ensure_exists(self): """ Make sure the local repository exists. :raises: :exc:`~exceptions.ValueError` when the local repository doesn't exist yet. """ if not self.exists: msg = "The local %s repository %s doesn't exist!" raise ValueE...
[ "def", "ensure_exists", "(", "self", ")", ":", "if", "not", "self", ".", "exists", ":", "msg", "=", "\"The local %s repository %s doesn't exist!\"", "raise", "ValueError", "(", "msg", "%", "(", "self", ".", "friendly_name", ",", "format_path", "(", "self", "."...
Make sure the local repository exists. :raises: :exc:`~exceptions.ValueError` when the local repository doesn't exist yet.
[ "Make", "sure", "the", "local", "repository", "exists", "." ]
python
train
celery/django-celery
djcelery/loaders.py
https://github.com/celery/django-celery/blob/5d1ecb09c6304d22cc447c7c08fba0bd1febc2ef/djcelery/loaders.py#L181-L202
def find_related_module(app, related_name): """Given an application name and a module name, tries to find that module in the application.""" try: app_path = importlib.import_module(app).__path__ except ImportError as exc: warn('Autodiscover: Error importing %s.%s: %r' % ( ap...
[ "def", "find_related_module", "(", "app", ",", "related_name", ")", ":", "try", ":", "app_path", "=", "importlib", ".", "import_module", "(", "app", ")", ".", "__path__", "except", "ImportError", "as", "exc", ":", "warn", "(", "'Autodiscover: Error importing %s....
Given an application name and a module name, tries to find that module in the application.
[ "Given", "an", "application", "name", "and", "a", "module", "name", "tries", "to", "find", "that", "module", "in", "the", "application", "." ]
python
train
ucsb-cs-education/hairball
hairball/plugins/__init__.py
https://github.com/ucsb-cs-education/hairball/blob/c6da8971f8a34e88ce401d36b51431715e1dff5b/hairball/plugins/__init__.py#L189-L196
def _process(self, scratch, filename, **kwargs): """Internal hook that marks reachable scripts before calling analyze. Returns data exactly as returned by the analyze method. """ self.tag_reachable_scripts(scratch) return self.analyze(scratch, filename=filename, **kwargs)
[ "def", "_process", "(", "self", ",", "scratch", ",", "filename", ",", "*", "*", "kwargs", ")", ":", "self", ".", "tag_reachable_scripts", "(", "scratch", ")", "return", "self", ".", "analyze", "(", "scratch", ",", "filename", "=", "filename", ",", "*", ...
Internal hook that marks reachable scripts before calling analyze. Returns data exactly as returned by the analyze method.
[ "Internal", "hook", "that", "marks", "reachable", "scripts", "before", "calling", "analyze", "." ]
python
train
ssokolow/fastdupes
fastdupes.py
https://github.com/ssokolow/fastdupes/blob/0334545885445834307c075a445fba9fe6f0c9e7/fastdupes.py#L376-L417
def compareChunks(handles, chunk_size=CHUNK_SIZE): """Group a list of file handles based on equality of the next chunk of data read from them. :param handles: A list of open handles for file-like objects with otentially-identical contents. :param chunk_size: The amount of data to read from each...
[ "def", "compareChunks", "(", "handles", ",", "chunk_size", "=", "CHUNK_SIZE", ")", ":", "chunks", "=", "[", "(", "path", ",", "fh", ",", "fh", ".", "read", "(", "chunk_size", ")", ")", "for", "path", ",", "fh", ",", "_", "in", "handles", "]", "more...
Group a list of file handles based on equality of the next chunk of data read from them. :param handles: A list of open handles for file-like objects with otentially-identical contents. :param chunk_size: The amount of data to read from each handle every time this function is called. :...
[ "Group", "a", "list", "of", "file", "handles", "based", "on", "equality", "of", "the", "next", "chunk", "of", "data", "read", "from", "them", "." ]
python
valid
mongodb/mongo-python-driver
pymongo/collection.py
https://github.com/mongodb/mongo-python-driver/blob/c29c21449e3aae74154207058cf85fd94018d4cd/pymongo/collection.py#L602-L646
def _insert(self, docs, ordered=True, check_keys=True, manipulate=False, write_concern=None, op_id=None, bypass_doc_val=False, session=None): """Internal insert helper.""" if isinstance(docs, abc.Mapping): return self._insert_one( docs, ordered...
[ "def", "_insert", "(", "self", ",", "docs", ",", "ordered", "=", "True", ",", "check_keys", "=", "True", ",", "manipulate", "=", "False", ",", "write_concern", "=", "None", ",", "op_id", "=", "None", ",", "bypass_doc_val", "=", "False", ",", "session", ...
Internal insert helper.
[ "Internal", "insert", "helper", "." ]
python
train
saltstack/salt
salt/modules/aptpkg.py
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/aptpkg.py#L125-L141
def _get_ppa_info_from_launchpad(owner_name, ppa_name): ''' Idea from softwareproperties.ppa. Uses urllib2 which sacrifices server cert verification. This is used as fall-back code or for secure PPAs :param owner_name: :param ppa_name: :return: ''' lp_url = 'https://launchpad.net/...
[ "def", "_get_ppa_info_from_launchpad", "(", "owner_name", ",", "ppa_name", ")", ":", "lp_url", "=", "'https://launchpad.net/api/1.0/~{0}/+archive/{1}'", ".", "format", "(", "owner_name", ",", "ppa_name", ")", "request", "=", "_Request", "(", "lp_url", ",", "headers", ...
Idea from softwareproperties.ppa. Uses urllib2 which sacrifices server cert verification. This is used as fall-back code or for secure PPAs :param owner_name: :param ppa_name: :return:
[ "Idea", "from", "softwareproperties", ".", "ppa", ".", "Uses", "urllib2", "which", "sacrifices", "server", "cert", "verification", "." ]
python
train
diging/tethne
tethne/analyze/corpus.py
https://github.com/diging/tethne/blob/ba10eeb264b7a3f2dbcce71cfd5cb2d6bbf7055f/tethne/analyze/corpus.py#L30-L88
def _forward(X, s=1.1, gamma=1., k=5): """ Forward dynamic algorithm for burstness automaton HMM, from `Kleinberg (2002) <http://www.cs.cornell.edu/home/kleinber/bhs.pdf>`_. Parameters ---------- X : list A series of time-gaps between events. s : float (default: 1.1) Scaling...
[ "def", "_forward", "(", "X", ",", "s", "=", "1.1", ",", "gamma", "=", "1.", ",", "k", "=", "5", ")", ":", "X", "=", "list", "(", "X", ")", "def", "alpha", "(", "i", ")", ":", "return", "(", "n", "/", "T", ")", "*", "(", "s", "**", "i", ...
Forward dynamic algorithm for burstness automaton HMM, from `Kleinberg (2002) <http://www.cs.cornell.edu/home/kleinber/bhs.pdf>`_. Parameters ---------- X : list A series of time-gaps between events. s : float (default: 1.1) Scaling parameter ( > 1.)that controls graininess of ...
[ "Forward", "dynamic", "algorithm", "for", "burstness", "automaton", "HMM", "from", "Kleinberg", "(", "2002", ")", "<http", ":", "//", "www", ".", "cs", ".", "cornell", ".", "edu", "/", "home", "/", "kleinber", "/", "bhs", ".", "pdf", ">", "_", "." ]
python
train
Clinical-Genomics/scout
scout/update/panel.py
https://github.com/Clinical-Genomics/scout/blob/90a551e2e1653a319e654c2405c2866f93d0ebb9/scout/update/panel.py#L9-L45
def update_panel(adapter, panel_name, panel_version, new_version=None, new_date=None): """Update a gene panel in the database We need to update the actual gene panel and then all cases that refers to the panel. Args: adapter(scout.adapter.MongoAdapter) panel_name(str): Unique name ...
[ "def", "update_panel", "(", "adapter", ",", "panel_name", ",", "panel_version", ",", "new_version", "=", "None", ",", "new_date", "=", "None", ")", ":", "panel_obj", "=", "adapter", ".", "gene_panel", "(", "panel_name", ",", "panel_version", ")", "if", "not"...
Update a gene panel in the database We need to update the actual gene panel and then all cases that refers to the panel. Args: adapter(scout.adapter.MongoAdapter) panel_name(str): Unique name for a gene panel panel_version(float) new_version(float) new_date(date...
[ "Update", "a", "gene", "panel", "in", "the", "database", "We", "need", "to", "update", "the", "actual", "gene", "panel", "and", "then", "all", "cases", "that", "refers", "to", "the", "panel", ".", "Args", ":", "adapter", "(", "scout", ".", "adapter", "...
python
test
numenta/nupic
src/nupic/algorithms/backtracking_tm.py
https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/src/nupic/algorithms/backtracking_tm.py#L2442-L2545
def _updateLearningState(self, activeColumns): """ Update the learning state. Called from compute() on every iteration :param activeColumns List of active column indices """ # Copy predicted and active states into t-1 self.lrnPredictedState['t-1'][:, :] = self.lrnPredictedState['t'][:, :] se...
[ "def", "_updateLearningState", "(", "self", ",", "activeColumns", ")", ":", "# Copy predicted and active states into t-1", "self", ".", "lrnPredictedState", "[", "'t-1'", "]", "[", ":", ",", ":", "]", "=", "self", ".", "lrnPredictedState", "[", "'t'", "]", "[", ...
Update the learning state. Called from compute() on every iteration :param activeColumns List of active column indices
[ "Update", "the", "learning", "state", ".", "Called", "from", "compute", "()", "on", "every", "iteration", ":", "param", "activeColumns", "List", "of", "active", "column", "indices" ]
python
valid
bitesofcode/projexui
projexui/widgets/xchart/xchart.py
https://github.com/bitesofcode/projexui/blob/f18a73bec84df90b034ca69b9deea118dbedfc4d/projexui/widgets/xchart/xchart.py#L258-L267
def axis(self, name): """ Looks up an axis for this chart by the given name. :return <projexui.widgets.xchart.XChartAxis> || None """ for axis in self.axes(): if axis.name() == name: return axis return None
[ "def", "axis", "(", "self", ",", "name", ")", ":", "for", "axis", "in", "self", ".", "axes", "(", ")", ":", "if", "axis", ".", "name", "(", ")", "==", "name", ":", "return", "axis", "return", "None" ]
Looks up an axis for this chart by the given name. :return <projexui.widgets.xchart.XChartAxis> || None
[ "Looks", "up", "an", "axis", "for", "this", "chart", "by", "the", "given", "name", ".", ":", "return", "<projexui", ".", "widgets", ".", "xchart", ".", "XChartAxis", ">", "||", "None" ]
python
train
brocade/pynos
pynos/versions/ver_6/ver_6_0_1/yang/brocade_mac_address_table.py
https://github.com/brocade/pynos/blob/bd8a34e98f322de3fc06750827d8bbc3a0c00380/pynos/versions/ver_6/ver_6_0_1/yang/brocade_mac_address_table.py#L12-L32
def mac_address_table_static_mac_address(self, **kwargs): """Auto Generated Code """ config = ET.Element("config") mac_address_table = ET.SubElement(config, "mac-address-table", xmlns="urn:brocade.com:mgmt:brocade-mac-address-table") static = ET.SubElement(mac_address_table, "sta...
[ "def", "mac_address_table_static_mac_address", "(", "self", ",", "*", "*", "kwargs", ")", ":", "config", "=", "ET", ".", "Element", "(", "\"config\"", ")", "mac_address_table", "=", "ET", ".", "SubElement", "(", "config", ",", "\"mac-address-table\"", ",", "xm...
Auto Generated Code
[ "Auto", "Generated", "Code" ]
python
train
bodylabs/harrison
harrison/registered_timer.py
https://github.com/bodylabs/harrison/blob/8a05b5c997909a75480b3fccacb2bfff888abfc7/harrison/registered_timer.py#L7-L33
def aggregate_registry_timers(): """Returns a list of aggregate timing information for registered timers. Each element is a 3-tuple of - timer description - aggregate elapsed time - number of calls The list is sorted by the first start time of each aggregate timer. """ im...
[ "def", "aggregate_registry_timers", "(", ")", ":", "import", "itertools", "timers", "=", "sorted", "(", "shared_registry", ".", "values", "(", ")", ",", "key", "=", "lambda", "t", ":", "t", ".", "desc", ")", "aggregate_timers", "=", "[", "]", "for", "k",...
Returns a list of aggregate timing information for registered timers. Each element is a 3-tuple of - timer description - aggregate elapsed time - number of calls The list is sorted by the first start time of each aggregate timer.
[ "Returns", "a", "list", "of", "aggregate", "timing", "information", "for", "registered", "timers", "." ]
python
train
kivy/python-for-android
pythonforandroid/recommendations.py
https://github.com/kivy/python-for-android/blob/8e0e8056bc22e4d5bd3398a6b0301f38ff167933/pythonforandroid/recommendations.py#L97-L107
def check_ndk_api(ndk_api, android_api): """Warn if the user's NDK is too high or low.""" if ndk_api > android_api: raise BuildInterruptingException( 'Target NDK API is {}, higher than the target Android API {}.'.format( ndk_api, android_api), instructions=('The N...
[ "def", "check_ndk_api", "(", "ndk_api", ",", "android_api", ")", ":", "if", "ndk_api", ">", "android_api", ":", "raise", "BuildInterruptingException", "(", "'Target NDK API is {}, higher than the target Android API {}.'", ".", "format", "(", "ndk_api", ",", "android_api",...
Warn if the user's NDK is too high or low.
[ "Warn", "if", "the", "user", "s", "NDK", "is", "too", "high", "or", "low", "." ]
python
train
insightindustry/validator-collection
validator_collection/validators.py
https://github.com/insightindustry/validator-collection/blob/8c8047a0fa36cc88a021771279898278c4cc98e3/validator_collection/validators.py#L1705-L1738
def path_exists(value, allow_empty = False, **kwargs): """Validate that ``value`` is a path-like object that exists on the local filesystem. :param value: The value to validate. :param allow_empty: If ``True``, returns :obj:`None <python:None>` if ``value`` is emp...
[ "def", "path_exists", "(", "value", ",", "allow_empty", "=", "False", ",", "*", "*", "kwargs", ")", ":", "if", "not", "value", "and", "not", "allow_empty", ":", "raise", "errors", ".", "EmptyValueError", "(", "'value (%s) was empty'", "%", "value", ")", "e...
Validate that ``value`` is a path-like object that exists on the local filesystem. :param value: The value to validate. :param allow_empty: If ``True``, returns :obj:`None <python:None>` if ``value`` is empty. If ``False``, raises a :class:`EmptyValueError <validator_collection.errors.EmptyVal...
[ "Validate", "that", "value", "is", "a", "path", "-", "like", "object", "that", "exists", "on", "the", "local", "filesystem", "." ]
python
train
fastai/fastai
fastai/text/data.py
https://github.com/fastai/fastai/blob/9fb84a5cdefe5a766cdb792b8f5d8971737b7e67/fastai/text/data.py#L209-L223
def from_csv(cls, path:PathOrStr, csv_name, valid_pct:float=0.2, test:Optional[str]=None, tokenizer:Tokenizer=None, vocab:Vocab=None, classes:Collection[str]=None, delimiter:str=None, header='infer', text_cols:IntsOrStrs=1, label_cols:IntsOrStrs=0, label_delim:str=None, ...
[ "def", "from_csv", "(", "cls", ",", "path", ":", "PathOrStr", ",", "csv_name", ",", "valid_pct", ":", "float", "=", "0.2", ",", "test", ":", "Optional", "[", "str", "]", "=", "None", ",", "tokenizer", ":", "Tokenizer", "=", "None", ",", "vocab", ":",...
Create a `TextDataBunch` from texts in csv files. `kwargs` are passed to the dataloader creation.
[ "Create", "a", "TextDataBunch", "from", "texts", "in", "csv", "files", ".", "kwargs", "are", "passed", "to", "the", "dataloader", "creation", "." ]
python
train
googleapis/google-cloud-python
firestore/google/cloud/firestore_v1beta1/collection.py
https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/firestore/google/cloud/firestore_v1beta1/collection.py#L94-L111
def document(self, document_id=None): """Create a sub-document underneath the current collection. Args: document_id (Optional[str]): The document identifier within the current collection. If not provided, will default to a random 20 character string composed ...
[ "def", "document", "(", "self", ",", "document_id", "=", "None", ")", ":", "if", "document_id", "is", "None", ":", "document_id", "=", "_auto_id", "(", ")", "child_path", "=", "self", ".", "_path", "+", "(", "document_id", ",", ")", "return", "self", "...
Create a sub-document underneath the current collection. Args: document_id (Optional[str]): The document identifier within the current collection. If not provided, will default to a random 20 character string composed of digits, uppercase and lowercas...
[ "Create", "a", "sub", "-", "document", "underneath", "the", "current", "collection", "." ]
python
train
pandas-dev/pandas
pandas/core/groupby/generic.py
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/groupby/generic.py#L1499-L1564
def nunique(self, dropna=True): """ Return DataFrame with number of distinct observations per group for each column. .. versionadded:: 0.20.0 Parameters ---------- dropna : boolean, default True Don't include NaN in the counts. Returns ...
[ "def", "nunique", "(", "self", ",", "dropna", "=", "True", ")", ":", "obj", "=", "self", ".", "_selected_obj", "def", "groupby_series", "(", "obj", ",", "col", "=", "None", ")", ":", "return", "SeriesGroupBy", "(", "obj", ",", "selection", "=", "col", ...
Return DataFrame with number of distinct observations per group for each column. .. versionadded:: 0.20.0 Parameters ---------- dropna : boolean, default True Don't include NaN in the counts. Returns ------- nunique: DataFrame Examp...
[ "Return", "DataFrame", "with", "number", "of", "distinct", "observations", "per", "group", "for", "each", "column", "." ]
python
train
saltstack/salt
salt/modules/boto_iam.py
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/boto_iam.py#L894-L929
def update_account_password_policy(allow_users_to_change_password=None, hard_expiry=None, max_password_age=None, minimum_password_length=None, password_reuse_prevention=None, requi...
[ "def", "update_account_password_policy", "(", "allow_users_to_change_password", "=", "None", ",", "hard_expiry", "=", "None", ",", "max_password_age", "=", "None", ",", "minimum_password_length", "=", "None", ",", "password_reuse_prevention", "=", "None", ",", "require_...
Update the password policy for the AWS account. .. versionadded:: 2015.8.0 CLI Example: .. code-block:: bash salt myminion boto_iam.update_account_password_policy True
[ "Update", "the", "password", "policy", "for", "the", "AWS", "account", "." ]
python
train