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
audreyr/cookiecutter
cookiecutter/cli.py
https://github.com/audreyr/cookiecutter/blob/3bc7b987e4ae9dcee996ae0b00375c1325b8d866/cookiecutter/cli.py#L27-L32
def version_msg(): """Return the Cookiecutter version, location and Python powering it.""" python_version = sys.version[:3] location = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) message = u'Cookiecutter %(version)s from {} (Python {})' return message.format(location, python_version)
[ "def", "version_msg", "(", ")", ":", "python_version", "=", "sys", ".", "version", "[", ":", "3", "]", "location", "=", "os", ".", "path", ".", "dirname", "(", "os", ".", "path", ".", "dirname", "(", "os", ".", "path", ".", "abspath", "(", "__file_...
Return the Cookiecutter version, location and Python powering it.
[ "Return", "the", "Cookiecutter", "version", "location", "and", "Python", "powering", "it", "." ]
python
train
ewels/MultiQC
multiqc/modules/rna_seqc/rna_seqc.py
https://github.com/ewels/MultiQC/blob/2037d6322b2554146a74efbf869156ad20d4c4ec/multiqc/modules/rna_seqc/rna_seqc.py#L87-L118
def rnaseqc_general_stats (self): """ Add alignment rate to the general stats table """ headers = OrderedDict() headers['Expression Profiling Efficiency'] = { 'title': '% Expression Efficiency', 'description': 'Expression Profiling Efficiency: Ratio of exo...
[ "def", "rnaseqc_general_stats", "(", "self", ")", ":", "headers", "=", "OrderedDict", "(", ")", "headers", "[", "'Expression Profiling Efficiency'", "]", "=", "{", "'title'", ":", "'% Expression Efficiency'", ",", "'description'", ":", "'Expression Profiling Efficiency:...
Add alignment rate to the general stats table
[ "Add", "alignment", "rate", "to", "the", "general", "stats", "table" ]
python
train
dbcli/cli_helpers
cli_helpers/config.py
https://github.com/dbcli/cli_helpers/blob/3ebd891ac0c02bad061182dbcb54a47fb21980ae/cli_helpers/config.py#L119-L122
def system_config_files(self): """Get a list of absolute paths to the system config files.""" return [os.path.join(f, self.filename) for f in get_system_config_dirs( self.app_name, self.app_author)]
[ "def", "system_config_files", "(", "self", ")", ":", "return", "[", "os", ".", "path", ".", "join", "(", "f", ",", "self", ".", "filename", ")", "for", "f", "in", "get_system_config_dirs", "(", "self", ".", "app_name", ",", "self", ".", "app_author", "...
Get a list of absolute paths to the system config files.
[ "Get", "a", "list", "of", "absolute", "paths", "to", "the", "system", "config", "files", "." ]
python
test
ArchiveTeam/wpull
wpull/application/tasks/shutdown.py
https://github.com/ArchiveTeam/wpull/blob/ddf051aa3322479325ba20aa778cb2cb97606bf5/wpull/application/tasks/shutdown.py#L54-L60
def _update_exit_code_from_stats(cls, statistics: Statistics, app: Application): '''Set the current exit code based on the Statistics.''' for error_type in statistics.errors: exit_code = app.ERROR_CODE_MAP.get(error_type) if exit_code: ...
[ "def", "_update_exit_code_from_stats", "(", "cls", ",", "statistics", ":", "Statistics", ",", "app", ":", "Application", ")", ":", "for", "error_type", "in", "statistics", ".", "errors", ":", "exit_code", "=", "app", ".", "ERROR_CODE_MAP", ".", "get", "(", "...
Set the current exit code based on the Statistics.
[ "Set", "the", "current", "exit", "code", "based", "on", "the", "Statistics", "." ]
python
train
SBRG/ssbio
ssbio/protein/structure/properties/msms.py
https://github.com/SBRG/ssbio/blob/e9449e64ffc1a1f5ad07e5849aa12a650095f8a2/ssbio/protein/structure/properties/msms.py#L69-L106
def get_msms_df_on_file(pdb_file, outfile=None, outdir=None, outext='_msms.df', force_rerun=False): """Run MSMS (using Biopython) on a PDB file. Saves a CSV file of: chain: chain ID resnum: residue number (PDB numbering) icode: residue insertion code res_depth: average depth of ...
[ "def", "get_msms_df_on_file", "(", "pdb_file", ",", "outfile", "=", "None", ",", "outdir", "=", "None", ",", "outext", "=", "'_msms.df'", ",", "force_rerun", "=", "False", ")", ":", "# Create the output file name", "outfile", "=", "ssbio", ".", "utils", ".", ...
Run MSMS (using Biopython) on a PDB file. Saves a CSV file of: chain: chain ID resnum: residue number (PDB numbering) icode: residue insertion code res_depth: average depth of all atoms in a residue ca_depth: depth of the alpha carbon atom Depths are in units Angstroms....
[ "Run", "MSMS", "(", "using", "Biopython", ")", "on", "a", "PDB", "file", "." ]
python
train
eyurtsev/fcsparser
fcsparser/api.py
https://github.com/eyurtsev/fcsparser/blob/710e8e31d4b09ff6e73d47d86770be6ca2f4282c/fcsparser/api.py#L295-L310
def read_analysis(self, file_handle): """Read the ANALYSIS segment of the FCS file and store it in self.analysis. Warning: This has never been tested with an actual fcs file that contains an analysis segment. Args: file_handle: buffer containing FCS data """ ...
[ "def", "read_analysis", "(", "self", ",", "file_handle", ")", ":", "start", "=", "self", ".", "annotation", "[", "'__header__'", "]", "[", "'analysis start'", "]", "end", "=", "self", ".", "annotation", "[", "'__header__'", "]", "[", "'analysis end'", "]", ...
Read the ANALYSIS segment of the FCS file and store it in self.analysis. Warning: This has never been tested with an actual fcs file that contains an analysis segment. Args: file_handle: buffer containing FCS data
[ "Read", "the", "ANALYSIS", "segment", "of", "the", "FCS", "file", "and", "store", "it", "in", "self", ".", "analysis", "." ]
python
train
angr/angr
angr/analyses/ddg.py
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/analyses/ddg.py#L885-L901
def _kill(self, variable, code_loc): # pylint:disable=no-self-use """ Kill previous defs. addr_list is a list of normalized addresses. """ # Case 1: address perfectly match, we kill # Case 2: a is a subset of the original address # Case 3: a is a superset of the origina...
[ "def", "_kill", "(", "self", ",", "variable", ",", "code_loc", ")", ":", "# pylint:disable=no-self-use", "# Case 1: address perfectly match, we kill", "# Case 2: a is a subset of the original address", "# Case 3: a is a superset of the original address", "# the previous definition is kil...
Kill previous defs. addr_list is a list of normalized addresses.
[ "Kill", "previous", "defs", ".", "addr_list", "is", "a", "list", "of", "normalized", "addresses", "." ]
python
train
ff0000/scarlet
scarlet/scheduling/fields.py
https://github.com/ff0000/scarlet/blob/6c37befd810916a2d7ffff2cdb2dab57bcb6d12e/scarlet/scheduling/fields.py#L42-L46
def get_db_prep_value(self, value, connection, prepared=False): """Convert JSON object to a string""" if isinstance(value, basestring): return value return json.dumps(value, **self.dump_kwargs)
[ "def", "get_db_prep_value", "(", "self", ",", "value", ",", "connection", ",", "prepared", "=", "False", ")", ":", "if", "isinstance", "(", "value", ",", "basestring", ")", ":", "return", "value", "return", "json", ".", "dumps", "(", "value", ",", "*", ...
Convert JSON object to a string
[ "Convert", "JSON", "object", "to", "a", "string" ]
python
train
elifesciences/elife-article
elifearticle/utils.py
https://github.com/elifesciences/elife-article/blob/99710c213cd81fe6fd1e5c150d6e20efe2d1e33b/elifearticle/utils.py#L93-L105
def version_from_xml_filename(filename): "extract the numeric version from the xml filename" try: filename_parts = filename.split(os.sep)[-1].split('-') except AttributeError: return None if len(filename_parts) == 3: try: return int(filename_parts[-1].lstrip('v').rstr...
[ "def", "version_from_xml_filename", "(", "filename", ")", ":", "try", ":", "filename_parts", "=", "filename", ".", "split", "(", "os", ".", "sep", ")", "[", "-", "1", "]", ".", "split", "(", "'-'", ")", "except", "AttributeError", ":", "return", "None", ...
extract the numeric version from the xml filename
[ "extract", "the", "numeric", "version", "from", "the", "xml", "filename" ]
python
train
tBaxter/activity-monitor
activity_monitor/managers.py
https://github.com/tBaxter/activity-monitor/blob/be6c6edc7c6b4141923b47376502cde0f785eb68/activity_monitor/managers.py#L47-L58
def get_last_update_of_model(self, model, **kwargs): """ Return the last time a given model's items were updated. Returns the epoch if the items were never updated. """ qs = self.get_for_model(model) if kwargs: qs = qs.filter(**kwargs) try: ...
[ "def", "get_last_update_of_model", "(", "self", ",", "model", ",", "*", "*", "kwargs", ")", ":", "qs", "=", "self", ".", "get_for_model", "(", "model", ")", "if", "kwargs", ":", "qs", "=", "qs", ".", "filter", "(", "*", "*", "kwargs", ")", "try", "...
Return the last time a given model's items were updated. Returns the epoch if the items were never updated.
[ "Return", "the", "last", "time", "a", "given", "model", "s", "items", "were", "updated", ".", "Returns", "the", "epoch", "if", "the", "items", "were", "never", "updated", "." ]
python
train
googlefonts/fontmake
Lib/fontmake/font_project.py
https://github.com/googlefonts/fontmake/blob/b611baf49929575c2a30fd18662055365219ce2d/Lib/fontmake/font_project.py#L943-L981
def run_from_ufos(self, ufos, output=(), **kwargs): """Run toolchain from UFO sources. Args: ufos: List of UFO sources, as either paths or opened objects. output: List of output formats to generate. kwargs: Arguments passed along to save_otfs. """ if...
[ "def", "run_from_ufos", "(", "self", ",", "ufos", ",", "output", "=", "(", ")", ",", "*", "*", "kwargs", ")", ":", "if", "set", "(", "output", ")", "==", "{", "\"ufo\"", "}", ":", "return", "# the `ufos` parameter can be a list of UFO objects", "# or it can ...
Run toolchain from UFO sources. Args: ufos: List of UFO sources, as either paths or opened objects. output: List of output formats to generate. kwargs: Arguments passed along to save_otfs.
[ "Run", "toolchain", "from", "UFO", "sources", "." ]
python
train
nateshmbhat/pyttsx3
pyttsx3/engine.py
https://github.com/nateshmbhat/pyttsx3/blob/0f304bff4812d50937393f1e3d7f89c9862a1623/pyttsx3/engine.py#L37-L51
def _notify(self, topic, **kwargs): """ Invokes callbacks for an event topic. @param topic: String event name @type topic: str @param kwargs: Values associated with the event @type kwargs: dict """ for cb in self._connects.get(topic, []): try:...
[ "def", "_notify", "(", "self", ",", "topic", ",", "*", "*", "kwargs", ")", ":", "for", "cb", "in", "self", ".", "_connects", ".", "get", "(", "topic", ",", "[", "]", ")", ":", "try", ":", "cb", "(", "*", "*", "kwargs", ")", "except", "Exception...
Invokes callbacks for an event topic. @param topic: String event name @type topic: str @param kwargs: Values associated with the event @type kwargs: dict
[ "Invokes", "callbacks", "for", "an", "event", "topic", "." ]
python
train
juju/charm-helpers
charmhelpers/contrib/openstack/ssh_migrations.py
https://github.com/juju/charm-helpers/blob/aa785c40c3b7a8c69dbfbc7921d6b9f30142e171/charmhelpers/contrib/openstack/ssh_migrations.py#L89-L125
def ssh_known_host_key(host, application_name, user=None): """Return the first entry in known_hosts for host. :param host: hostname to lookup in file. :type host: str :param application_name: Name of application eg nova-compute-something :type application_name: str :param user: The user that th...
[ "def", "ssh_known_host_key", "(", "host", ",", "application_name", ",", "user", "=", "None", ")", ":", "cmd", "=", "[", "'ssh-keygen'", ",", "'-f'", ",", "known_hosts", "(", "application_name", ",", "user", ")", ",", "'-H'", ",", "'-F'", ",", "host", "]"...
Return the first entry in known_hosts for host. :param host: hostname to lookup in file. :type host: str :param application_name: Name of application eg nova-compute-something :type application_name: str :param user: The user that the ssh asserts are for. :type user: str :returns: Host key ...
[ "Return", "the", "first", "entry", "in", "known_hosts", "for", "host", "." ]
python
train
alberanid/python-iplib
iplib.py
https://github.com/alberanid/python-iplib/blob/488b56fe57ad836b27feec9e76f51883db28faa6/iplib.py#L551-L554
def get_hex(self): """Return the hexadecimal notation of the address/netmask.""" return _convert(self._ip_dec, notation=IP_HEX, inotation=IP_DEC, _check=False, _isnm=self._isnm)
[ "def", "get_hex", "(", "self", ")", ":", "return", "_convert", "(", "self", ".", "_ip_dec", ",", "notation", "=", "IP_HEX", ",", "inotation", "=", "IP_DEC", ",", "_check", "=", "False", ",", "_isnm", "=", "self", ".", "_isnm", ")" ]
Return the hexadecimal notation of the address/netmask.
[ "Return", "the", "hexadecimal", "notation", "of", "the", "address", "/", "netmask", "." ]
python
valid
yatiml/yatiml
yatiml/helpers.py
https://github.com/yatiml/yatiml/blob/4f55c058b72388350f0af3076ac3ea9bc1c142b0/yatiml/helpers.py#L310-L319
def dashes_to_unders_in_keys(self) -> None: """Replaces dashes with underscores in key names. For each attribute in a mapping, this replaces any dashes in \ its keys with underscores. Handy because Python does not \ accept dashes in identifiers, while some YAML-based file \ form...
[ "def", "dashes_to_unders_in_keys", "(", "self", ")", "->", "None", ":", "for", "key_node", ",", "_", "in", "self", ".", "yaml_node", ".", "value", ":", "key_node", ".", "value", "=", "key_node", ".", "value", ".", "replace", "(", "'-'", ",", "'_'", ")"...
Replaces dashes with underscores in key names. For each attribute in a mapping, this replaces any dashes in \ its keys with underscores. Handy because Python does not \ accept dashes in identifiers, while some YAML-based file \ formats use dashes in their keys.
[ "Replaces", "dashes", "with", "underscores", "in", "key", "names", "." ]
python
train
emory-libraries/eulfedora
eulfedora/models.py
https://github.com/emory-libraries/eulfedora/blob/161826f3fdcdab4007f6fa7dfd9f1ecabc4bcbe4/eulfedora/models.py#L451-L461
def get_chunked_content(self, chunksize=4096): '''Generator that returns the datastream content in chunks, so larger datastreams can be used without reading the entire contents into memory.''' # get the datastream dissemination, but return the actual http response r = self.obj.a...
[ "def", "get_chunked_content", "(", "self", ",", "chunksize", "=", "4096", ")", ":", "# get the datastream dissemination, but return the actual http response", "r", "=", "self", ".", "obj", ".", "api", ".", "getDatastreamDissemination", "(", "self", ".", "obj", ".", ...
Generator that returns the datastream content in chunks, so larger datastreams can be used without reading the entire contents into memory.
[ "Generator", "that", "returns", "the", "datastream", "content", "in", "chunks", "so", "larger", "datastreams", "can", "be", "used", "without", "reading", "the", "entire", "contents", "into", "memory", "." ]
python
train
mfcloud/python-zvm-sdk
smtLayer/vmUtils.py
https://github.com/mfcloud/python-zvm-sdk/blob/de9994ceca764f5460ce51bd74237986341d8e3c/smtLayer/vmUtils.py#L724-L779
def isLoggedOn(rh, userid): """ Determine whether a virtual machine is logged on. Input: Request Handle: userid being queried Output: Dictionary containing the following: overallRC - overall return code, 0: success, non-zero: failure rc - 0: if we got...
[ "def", "isLoggedOn", "(", "rh", ",", "userid", ")", ":", "rh", ".", "printSysLog", "(", "\"Enter vmUtils.isLoggedOn, userid: \"", "+", "userid", ")", "results", "=", "{", "'overallRC'", ":", "0", ",", "'rc'", ":", "0", ",", "'rs'", ":", "0", ",", "}", ...
Determine whether a virtual machine is logged on. Input: Request Handle: userid being queried Output: Dictionary containing the following: overallRC - overall return code, 0: success, non-zero: failure rc - 0: if we got status. Otherwise, it is the ...
[ "Determine", "whether", "a", "virtual", "machine", "is", "logged", "on", "." ]
python
train
mojaie/chorus
chorus/util/geometry.py
https://github.com/mojaie/chorus/blob/fc7fe23a0272554c67671645ab07830b315eeb1b/chorus/util/geometry.py#L130-L146
def t_seg(p1, p2, t, align=0): """ trim segment Args: p1, p2: point(x, y) t: scaling factor (1 - trimed segment / original segment) align: 1: trim p2, 2: trim p1, 0: both side Return: trimmed segment(p1, p2) """ v = vector(p1, p2) result = { 1: lambda a, b: (a, tr...
[ "def", "t_seg", "(", "p1", ",", "p2", ",", "t", ",", "align", "=", "0", ")", ":", "v", "=", "vector", "(", "p1", ",", "p2", ")", "result", "=", "{", "1", ":", "lambda", "a", ",", "b", ":", "(", "a", ",", "translate", "(", "b", ",", "scale...
trim segment Args: p1, p2: point(x, y) t: scaling factor (1 - trimed segment / original segment) align: 1: trim p2, 2: trim p1, 0: both side Return: trimmed segment(p1, p2)
[ "trim", "segment", "Args", ":", "p1", "p2", ":", "point", "(", "x", "y", ")", "t", ":", "scaling", "factor", "(", "1", "-", "trimed", "segment", "/", "original", "segment", ")", "align", ":", "1", ":", "trim", "p2", "2", ":", "trim", "p1", "0", ...
python
train
Danielhiversen/pyMetno
metno/__init__.py
https://github.com/Danielhiversen/pyMetno/blob/7d200a495fdea0e1a9310069fdcd65f205d6e6f5/metno/__init__.py#L187-L254
async def update(self): """Update data.""" if self._last_update is None or datetime.datetime.now() - self._last_update > datetime.timedelta(3600): try: with async_timeout.timeout(10): resp = await self._websession.get(self._api_url, params=self._urlparams)...
[ "async", "def", "update", "(", "self", ")", ":", "if", "self", ".", "_last_update", "is", "None", "or", "datetime", ".", "datetime", ".", "now", "(", ")", "-", "self", ".", "_last_update", ">", "datetime", ".", "timedelta", "(", "3600", ")", ":", "tr...
Update data.
[ "Update", "data", "." ]
python
train
tmontaigu/pylas
pylas/headers/rawheader.py
https://github.com/tmontaigu/pylas/blob/8335a1a7d7677f0e4bc391bb6fa3c75b42ed5b06/pylas/headers/rawheader.py#L200-L203
def mins(self): """ Returns de minimum values of x, y, z as a numpy array """ return np.array([self.x_min, self.y_min, self.z_min])
[ "def", "mins", "(", "self", ")", ":", "return", "np", ".", "array", "(", "[", "self", ".", "x_min", ",", "self", ".", "y_min", ",", "self", ".", "z_min", "]", ")" ]
Returns de minimum values of x, y, z as a numpy array
[ "Returns", "de", "minimum", "values", "of", "x", "y", "z", "as", "a", "numpy", "array" ]
python
test
rhjdjong/SlipLib
sliplib/slipsocket.py
https://github.com/rhjdjong/SlipLib/blob/8300dba3e512bca282380f234be34d75f4a73ce1/sliplib/slipsocket.py#L94-L110
def create_connection(cls, address, timeout=None, source_address=None): """Create a SlipSocket connection. This convenience method creates a connection to the the specified address using the :func:`socket.create_connection` function. The socket that is returned from that call is automat...
[ "def", "create_connection", "(", "cls", ",", "address", ",", "timeout", "=", "None", ",", "source_address", "=", "None", ")", ":", "sock", "=", "socket", ".", "create_connection", "(", "address", ",", "timeout", ",", "source_address", ")", "return", "cls", ...
Create a SlipSocket connection. This convenience method creates a connection to the the specified address using the :func:`socket.create_connection` function. The socket that is returned from that call is automatically wrapped in a :class:`SlipSocket` object. .. note:: ...
[ "Create", "a", "SlipSocket", "connection", "." ]
python
train
DLR-RM/RAFCON
source/rafcon/core/states/container_state.py
https://github.com/DLR-RM/RAFCON/blob/24942ef1a904531f49ab8830a1dbb604441be498/source/rafcon/core/states/container_state.py#L1624-L1646
def change_state_id(self, state_id=None): """ Changes the id of the state to a new id. This functions replaces the old state_id with the new state_id in all data flows and transitions. :param state_id: The new state if of the state """ old_state_id = self.state_id ...
[ "def", "change_state_id", "(", "self", ",", "state_id", "=", "None", ")", ":", "old_state_id", "=", "self", ".", "state_id", "super", "(", "ContainerState", ",", "self", ")", ".", "change_state_id", "(", "state_id", ")", "# Use private variables to change ids to p...
Changes the id of the state to a new id. This functions replaces the old state_id with the new state_id in all data flows and transitions. :param state_id: The new state if of the state
[ "Changes", "the", "id", "of", "the", "state", "to", "a", "new", "id", ".", "This", "functions", "replaces", "the", "old", "state_id", "with", "the", "new", "state_id", "in", "all", "data", "flows", "and", "transitions", "." ]
python
train
tslight/treepick
treepick/actions.py
https://github.com/tslight/treepick/blob/7adf838900f11e8845e17d8c79bb2b23617aec2c/treepick/actions.py#L70-L90
def nextparent(self, parent, depth): ''' Add lines to current line by traversing the grandparent object again and once we reach our current line counting every line that is prefixed with the parent directory. ''' if depth > 1: # can't jump to parent of root node! ...
[ "def", "nextparent", "(", "self", ",", "parent", ",", "depth", ")", ":", "if", "depth", ">", "1", ":", "# can't jump to parent of root node!", "pdir", "=", "os", ".", "path", ".", "dirname", "(", "self", ".", "name", ")", "line", "=", "0", "for", "c", ...
Add lines to current line by traversing the grandparent object again and once we reach our current line counting every line that is prefixed with the parent directory.
[ "Add", "lines", "to", "current", "line", "by", "traversing", "the", "grandparent", "object", "again", "and", "once", "we", "reach", "our", "current", "line", "counting", "every", "line", "that", "is", "prefixed", "with", "the", "parent", "directory", "." ]
python
train
fabioz/PyDev.Debugger
pydevd_attach_to_process/winappdbg/textio.py
https://github.com/fabioz/PyDev.Debugger/blob/ed9c4307662a5593b8a7f1f3389ecd0e79b8c503/pydevd_attach_to_process/winappdbg/textio.py#L427-L452
def mixed_list_file(cls, filename, values, bits): """ Write a list of mixed values to a file. If a file of the same name exists, it's contents are replaced. See L{HexInput.mixed_list_file} for a description of the file format. @type filename: str @param filename: Name ...
[ "def", "mixed_list_file", "(", "cls", ",", "filename", ",", "values", ",", "bits", ")", ":", "fd", "=", "open", "(", "filename", ",", "'w'", ")", "for", "original", "in", "values", ":", "try", ":", "parsed", "=", "cls", ".", "integer", "(", "original...
Write a list of mixed values to a file. If a file of the same name exists, it's contents are replaced. See L{HexInput.mixed_list_file} for a description of the file format. @type filename: str @param filename: Name of the file to write. @type values: list( int ) @par...
[ "Write", "a", "list", "of", "mixed", "values", "to", "a", "file", ".", "If", "a", "file", "of", "the", "same", "name", "exists", "it", "s", "contents", "are", "replaced", "." ]
python
train
mitsei/dlkit
dlkit/json_/repository/objects.py
https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/json_/repository/objects.py#L1571-L1578
def _init_map(self, record_types=None, **kwargs): """Initialize form map""" osid_objects.OsidObjectForm._init_map(self, record_types=record_types) self._my_map['url'] = self._url_default self._my_map['data'] = self._data_default self._my_map['accessibilityTypeId'] = self._accessi...
[ "def", "_init_map", "(", "self", ",", "record_types", "=", "None", ",", "*", "*", "kwargs", ")", ":", "osid_objects", ".", "OsidObjectForm", ".", "_init_map", "(", "self", ",", "record_types", "=", "record_types", ")", "self", ".", "_my_map", "[", "'url'",...
Initialize form map
[ "Initialize", "form", "map" ]
python
train
IrvKalb/pygwidgets
pygwidgets/pygwidgets.py
https://github.com/IrvKalb/pygwidgets/blob/a830d8885d4d209e471cb53816277d30db56273c/pygwidgets/pygwidgets.py#L2212-L2217
def flipVertical(self): """ flips an image object vertically """ self.flipV = not self.flipV self._transmogrophy(self.angle, self.percent, self.scaleFromCenter, self.flipH, self.flipV)
[ "def", "flipVertical", "(", "self", ")", ":", "self", ".", "flipV", "=", "not", "self", ".", "flipV", "self", ".", "_transmogrophy", "(", "self", ".", "angle", ",", "self", ".", "percent", ",", "self", ".", "scaleFromCenter", ",", "self", ".", "flipH",...
flips an image object vertically
[ "flips", "an", "image", "object", "vertically" ]
python
train
bwhite/hadoopy
hadoopy/_hdfs.py
https://github.com/bwhite/hadoopy/blob/ff39b4e6d4e6efaf1f571cf0f2c0e0d7ab28c2d6/hadoopy/_hdfs.py#L229-L251
def writetb(path, kvs, java_mem_mb=256): """Write typedbytes sequence file to HDFS given an iterator of KeyValue pairs :param path: HDFS path (string) :param kvs: Iterator of (key, value) :param java_mem_mb: Integer of java heap size in MB (default 256) :raises: IOError: An error occurred while sav...
[ "def", "writetb", "(", "path", ",", "kvs", ",", "java_mem_mb", "=", "256", ")", ":", "read_fd", ",", "write_fd", "=", "os", ".", "pipe", "(", ")", "read_fp", "=", "os", ".", "fdopen", "(", "read_fd", ",", "'r'", ")", "hstreaming", "=", "_find_hstream...
Write typedbytes sequence file to HDFS given an iterator of KeyValue pairs :param path: HDFS path (string) :param kvs: Iterator of (key, value) :param java_mem_mb: Integer of java heap size in MB (default 256) :raises: IOError: An error occurred while saving the data.
[ "Write", "typedbytes", "sequence", "file", "to", "HDFS", "given", "an", "iterator", "of", "KeyValue", "pairs" ]
python
train
riccardocagnasso/useless
src/useless/common/__init__.py
https://github.com/riccardocagnasso/useless/blob/5167aab82958f653148e3689c9a7e548d4fa2cba/src/useless/common/__init__.py#L29-L48
def parse_cstring(stream, offset): """ parse_cstring will parse a null-terminated string in a bytestream. The string will be decoded with UTF-8 decoder, of course since we are doing this byte-a-byte, it won't really work for all Unicode strings. TODO: add proper Unicode support ...
[ "def", "parse_cstring", "(", "stream", ",", "offset", ")", ":", "stream", ".", "seek", "(", "offset", ")", "string", "=", "\"\"", "while", "True", ":", "char", "=", "struct", ".", "unpack", "(", "'c'", ",", "stream", ".", "read", "(", "1", ")", ")"...
parse_cstring will parse a null-terminated string in a bytestream. The string will be decoded with UTF-8 decoder, of course since we are doing this byte-a-byte, it won't really work for all Unicode strings. TODO: add proper Unicode support
[ "parse_cstring", "will", "parse", "a", "null", "-", "terminated", "string", "in", "a", "bytestream", "." ]
python
train
nrcharles/caelum
caelum/tools.py
https://github.com/nrcharles/caelum/blob/9a8e65806385978556d7bb2e6870f003ff82023e/caelum/tools.py#L20-L29
def download(url, filename): """download and extract file.""" logger.info("Downloading %s", url) request = urllib2.Request(url) request.add_header('User-Agent', 'caelum/0.1 +https://github.com/nrcharles/caelum') opener = urllib2.build_opener() local_file = open(filename, '...
[ "def", "download", "(", "url", ",", "filename", ")", ":", "logger", ".", "info", "(", "\"Downloading %s\"", ",", "url", ")", "request", "=", "urllib2", ".", "Request", "(", "url", ")", "request", ".", "add_header", "(", "'User-Agent'", ",", "'caelum/0.1 +h...
download and extract file.
[ "download", "and", "extract", "file", "." ]
python
train
angr/angr
angr/analyses/vfg.py
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/analyses/vfg.py#L1187-L1213
def _set_return_address(self, state, ret_addr): """ Set the return address of the current state to a specific address. We assume we are at the beginning of a function, or in other words, we are about to execute the very first instruction of the function. :param SimState state: The progr...
[ "def", "_set_return_address", "(", "self", ",", "state", ",", "ret_addr", ")", ":", "# TODO: the following code is totally untested other than X86 and AMD64. Don't freak out if you find bugs :)", "# TODO: Test it", "ret_bvv", "=", "state", ".", "solver", ".", "BVV", "(", "ret...
Set the return address of the current state to a specific address. We assume we are at the beginning of a function, or in other words, we are about to execute the very first instruction of the function. :param SimState state: The program state :param int ret_addr: The return address :re...
[ "Set", "the", "return", "address", "of", "the", "current", "state", "to", "a", "specific", "address", ".", "We", "assume", "we", "are", "at", "the", "beginning", "of", "a", "function", "or", "in", "other", "words", "we", "are", "about", "to", "execute", ...
python
train
pycontribs/python-crowd
crowd.py
https://github.com/pycontribs/python-crowd/blob/a075e45774dd5baecf0217843cda747084268e32/crowd.py#L589-L609
def get_nested_group_users(self, groupname): """Retrieves a list of all users that directly or indirectly belong to the given groupname. Args: groupname: The group name. Returns: list: A list of strings of user names. """ response = sel...
[ "def", "get_nested_group_users", "(", "self", ",", "groupname", ")", ":", "response", "=", "self", ".", "_get", "(", "self", ".", "rest_url", "+", "\"/group/user/nested\"", ",", "params", "=", "{", "\"groupname\"", ":", "groupname", ",", "\"start-index\"", ":"...
Retrieves a list of all users that directly or indirectly belong to the given groupname. Args: groupname: The group name. Returns: list: A list of strings of user names.
[ "Retrieves", "a", "list", "of", "all", "users", "that", "directly", "or", "indirectly", "belong", "to", "the", "given", "groupname", "." ]
python
train
bitshares/uptick
uptick/proposal.py
https://github.com/bitshares/uptick/blob/66c102200fdbf96cef4fd55cc69d00e690f62001/uptick/proposal.py#L21-L24
def disapproveproposal(ctx, proposal, account): """ Disapprove a proposal """ print_tx(ctx.bitshares.disapproveproposal(proposal, account=account))
[ "def", "disapproveproposal", "(", "ctx", ",", "proposal", ",", "account", ")", ":", "print_tx", "(", "ctx", ".", "bitshares", ".", "disapproveproposal", "(", "proposal", ",", "account", "=", "account", ")", ")" ]
Disapprove a proposal
[ "Disapprove", "a", "proposal" ]
python
train
davebridges/mousedb
mousedb/animal/views.py
https://github.com/davebridges/mousedb/blob/2a33f6d15d88b1540b05f7232b154fdbf8568580/mousedb/animal/views.py#L514-L525
def date_archive_year(request): """This view will generate a table of the number of mice born on an annual basis. This view is associated with the url name archive-home, and returns an dictionary of a date and a animal count.""" oldest_animal = Animal.objects.filter(Born__isnull=False).order_by('B...
[ "def", "date_archive_year", "(", "request", ")", ":", "oldest_animal", "=", "Animal", ".", "objects", ".", "filter", "(", "Born__isnull", "=", "False", ")", ".", "order_by", "(", "'Born'", ")", "[", "0", "]", "archive_dict", "=", "{", "}", "tested_year", ...
This view will generate a table of the number of mice born on an annual basis. This view is associated with the url name archive-home, and returns an dictionary of a date and a animal count.
[ "This", "view", "will", "generate", "a", "table", "of", "the", "number", "of", "mice", "born", "on", "an", "annual", "basis", ".", "This", "view", "is", "associated", "with", "the", "url", "name", "archive", "-", "home", "and", "returns", "an", "dictiona...
python
train
pallets/werkzeug
src/werkzeug/_reloader.py
https://github.com/pallets/werkzeug/blob/a220671d66755a94630a212378754bb432811158/src/werkzeug/_reloader.py#L43-L60
def _find_observable_paths(extra_files=None): """Finds all paths that should be observed.""" rv = set( os.path.dirname(os.path.abspath(x)) if os.path.isfile(x) else os.path.abspath(x) for x in sys.path ) for filename in extra_files or (): rv.add(os.path.dirname(os.path.abspath(f...
[ "def", "_find_observable_paths", "(", "extra_files", "=", "None", ")", ":", "rv", "=", "set", "(", "os", ".", "path", ".", "dirname", "(", "os", ".", "path", ".", "abspath", "(", "x", ")", ")", "if", "os", ".", "path", ".", "isfile", "(", "x", ")...
Finds all paths that should be observed.
[ "Finds", "all", "paths", "that", "should", "be", "observed", "." ]
python
train
pytroll/satpy
satpy/multiscene.py
https://github.com/pytroll/satpy/blob/1f21d20ac686b745fb0da9b4030d139893e066dd/satpy/multiscene.py#L234-L244
def _generate_scene_func(self, gen, func_name, create_new_scene, *args, **kwargs): """Abstract method for running a Scene method on each Scene. Additionally, modifies current MultiScene or creates a new one if needed. """ new_gen = self._call_scene_func(gen, func_name, create_new_scene,...
[ "def", "_generate_scene_func", "(", "self", ",", "gen", ",", "func_name", ",", "create_new_scene", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "new_gen", "=", "self", ".", "_call_scene_func", "(", "gen", ",", "func_name", ",", "create_new_scene", ...
Abstract method for running a Scene method on each Scene. Additionally, modifies current MultiScene or creates a new one if needed.
[ "Abstract", "method", "for", "running", "a", "Scene", "method", "on", "each", "Scene", "." ]
python
train
tempodb/tempodb-python
tempodb/client.py
https://github.com/tempodb/tempodb-python/blob/8ce45231bd728c6c97ef799cf0f1513ea3a9a7d3/tempodb/client.py#L545-L568
def write_data(self, key, data, tags=[], attrs={}): """Write a set a datapoints into a series by its key. For now, the tags and attributes arguments are ignored. :param string key: the series to write data into :param list data: a list of DataPoints to write :rtype: :class:`tem...
[ "def", "write_data", "(", "self", ",", "key", ",", "data", ",", "tags", "=", "[", "]", ",", "attrs", "=", "{", "}", ")", ":", "url", "=", "make_series_url", "(", "key", ")", "url", "=", "urlparse", ".", "urljoin", "(", "url", "+", "'/'", ",", "...
Write a set a datapoints into a series by its key. For now, the tags and attributes arguments are ignored. :param string key: the series to write data into :param list data: a list of DataPoints to write :rtype: :class:`tempodb.response.Response` object
[ "Write", "a", "set", "a", "datapoints", "into", "a", "series", "by", "its", "key", ".", "For", "now", "the", "tags", "and", "attributes", "arguments", "are", "ignored", "." ]
python
train
bykof/billomapy
billomapy/billomapy.py
https://github.com/bykof/billomapy/blob/a28ba69fd37654fa145d0411d52c200e7f8984ab/billomapy/billomapy.py#L2649-L2663
def get_comments_of_credit_note_per_page(self, credit_note_id, per_page=1000, page=1): """ Get comments of credit note per page :param credit_note_id: the credit note id :param per_page: How many objects per page. Default: 1000 :param page: Which page. Default: 1 :return...
[ "def", "get_comments_of_credit_note_per_page", "(", "self", ",", "credit_note_id", ",", "per_page", "=", "1000", ",", "page", "=", "1", ")", ":", "return", "self", ".", "_get_resource_per_page", "(", "resource", "=", "CREDIT_NOTE_COMMENTS", ",", "per_page", "=", ...
Get comments of credit note per page :param credit_note_id: the credit note id :param per_page: How many objects per page. Default: 1000 :param page: Which page. Default: 1 :return: list
[ "Get", "comments", "of", "credit", "note", "per", "page" ]
python
train
iwanbk/nyamuk
nyamuk/nyamuk.py
https://github.com/iwanbk/nyamuk/blob/ac4c6028de288a4c8e0b332ae16eae889deb643d/nyamuk/nyamuk.py#L497-L509
def handle_pubcomp(self): """Handle incoming PUBCOMP packet.""" self.logger.info("PUBCOMP received") ret, mid = self.in_packet.read_uint16() if ret != NC.ERR_SUCCESS: return ret evt = event.EventPubcomp(mid) self.push_event(evt) return NC.ERR_SUCCE...
[ "def", "handle_pubcomp", "(", "self", ")", ":", "self", ".", "logger", ".", "info", "(", "\"PUBCOMP received\"", ")", "ret", ",", "mid", "=", "self", ".", "in_packet", ".", "read_uint16", "(", ")", "if", "ret", "!=", "NC", ".", "ERR_SUCCESS", ":", "ret...
Handle incoming PUBCOMP packet.
[ "Handle", "incoming", "PUBCOMP", "packet", "." ]
python
train
prompt-toolkit/pymux
pymux/commands/commands.py
https://github.com/prompt-toolkit/pymux/blob/3f66e62b9de4b2251c7f9afad6c516dc5a30ec67/pymux/commands/commands.py#L595-L599
def display_message(pymux, variables): " Display a message. " message = variables['<message>'] client_state = pymux.get_client_state() client_state.message = message
[ "def", "display_message", "(", "pymux", ",", "variables", ")", ":", "message", "=", "variables", "[", "'<message>'", "]", "client_state", "=", "pymux", ".", "get_client_state", "(", ")", "client_state", ".", "message", "=", "message" ]
Display a message.
[ "Display", "a", "message", "." ]
python
train
StackStorm/pybind
pybind/slxos/v17r_2_00/igmp_snooping_state/__init__.py
https://github.com/StackStorm/pybind/blob/44c467e71b2b425be63867aba6e6fa28b2cfe7fb/pybind/slxos/v17r_2_00/igmp_snooping_state/__init__.py#L190-L213
def _set_debug_igmp(self, v, load=False): """ Setter method for debug_igmp, mapped from YANG variable /igmp_snooping_state/debug_igmp (container) If this variable is read-only (config: false) in the source YANG file, then _set_debug_igmp is considered as a private method. Backends looking to populat...
[ "def", "_set_debug_igmp", "(", "self", ",", "v", ",", "load", "=", "False", ")", ":", "if", "hasattr", "(", "v", ",", "\"_utype\"", ")", ":", "v", "=", "v", ".", "_utype", "(", "v", ")", "try", ":", "t", "=", "YANGDynClass", "(", "v", ",", "bas...
Setter method for debug_igmp, mapped from YANG variable /igmp_snooping_state/debug_igmp (container) If this variable is read-only (config: false) in the source YANG file, then _set_debug_igmp is considered as a private method. Backends looking to populate this variable should do so via calling thisObj._...
[ "Setter", "method", "for", "debug_igmp", "mapped", "from", "YANG", "variable", "/", "igmp_snooping_state", "/", "debug_igmp", "(", "container", ")", "If", "this", "variable", "is", "read", "-", "only", "(", "config", ":", "false", ")", "in", "the", "source",...
python
train
mkaz/termgraph
termgraph/termgraph.py
https://github.com/mkaz/termgraph/blob/c40b86454d380d685785b98834364b111734c163/termgraph/termgraph.py#L175-L203
def normalize(data, width): """Normalize the data and return it.""" min_dat = find_min(data) # We offset by the minimum if there's a negative. off_data = [] if min_dat < 0: min_dat = abs(min_dat) for dat in data: off_data.append([_d + min_dat for _d in dat]) else: ...
[ "def", "normalize", "(", "data", ",", "width", ")", ":", "min_dat", "=", "find_min", "(", "data", ")", "# We offset by the minimum if there's a negative.", "off_data", "=", "[", "]", "if", "min_dat", "<", "0", ":", "min_dat", "=", "abs", "(", "min_dat", ")",...
Normalize the data and return it.
[ "Normalize", "the", "data", "and", "return", "it", "." ]
python
train
PyPSA/PyPSA
pypsa/io.py
https://github.com/PyPSA/PyPSA/blob/46954b1b3c21460550f7104681517065279a53b7/pypsa/io.py#L372-L392
def import_from_csv_folder(network, csv_folder_name, encoding=None, skip_time=False): """ Import network data from CSVs in a folder. The CSVs must follow the standard form, see pypsa/examples. Parameters ---------- csv_folder_name : string Name of folder encoding : str, default Non...
[ "def", "import_from_csv_folder", "(", "network", ",", "csv_folder_name", ",", "encoding", "=", "None", ",", "skip_time", "=", "False", ")", ":", "basename", "=", "os", ".", "path", ".", "basename", "(", "csv_folder_name", ")", "with", "ImporterCSV", "(", "cs...
Import network data from CSVs in a folder. The CSVs must follow the standard form, see pypsa/examples. Parameters ---------- csv_folder_name : string Name of folder encoding : str, default None Encoding to use for UTF when reading (ex. 'utf-8'). `List of Python standard enc...
[ "Import", "network", "data", "from", "CSVs", "in", "a", "folder", "." ]
python
train
Kortemme-Lab/klab
klab/google/gcalendar.py
https://github.com/Kortemme-Lab/klab/blob/6d410ad08f1bd9f7cbbb28d7d946e94fbaaa2b6b/klab/google/gcalendar.py#L321-L362
def get_events(self, start_time, end_time, ignore_cancelled = True, get_recurring_events_as_instances = True, restrict_to_calendars = []): '''A wrapper for events().list. Returns the events from the calendar within the specified times. Some of the interesting fields are: description, end, htmlLi...
[ "def", "get_events", "(", "self", ",", "start_time", ",", "end_time", ",", "ignore_cancelled", "=", "True", ",", "get_recurring_events_as_instances", "=", "True", ",", "restrict_to_calendars", "=", "[", "]", ")", ":", "es", "=", "[", "]", "calendar_ids", "=", ...
A wrapper for events().list. Returns the events from the calendar within the specified times. Some of the interesting fields are: description, end, htmlLink, location, organizer, start, summary Note: "Cancelled instances of recurring events (but not the underlying recurring event) will ...
[ "A", "wrapper", "for", "events", "()", ".", "list", ".", "Returns", "the", "events", "from", "the", "calendar", "within", "the", "specified", "times", ".", "Some", "of", "the", "interesting", "fields", "are", ":", "description", "end", "htmlLink", "location"...
python
train
SectorLabs/django-postgres-extra
psqlextra/fields/hstore_field.py
https://github.com/SectorLabs/django-postgres-extra/blob/eef2ed5504d225858d4e4f5d77a838082ca6053e/psqlextra/fields/hstore_field.py#L53-L66
def deconstruct(self): """Gets the values to pass to :see:__init__ when re-creating this object.""" name, path, args, kwargs = super( HStoreField, self).deconstruct() if self.uniqueness is not None: kwargs['uniqueness'] = self.uniqueness if self.require...
[ "def", "deconstruct", "(", "self", ")", ":", "name", ",", "path", ",", "args", ",", "kwargs", "=", "super", "(", "HStoreField", ",", "self", ")", ".", "deconstruct", "(", ")", "if", "self", ".", "uniqueness", "is", "not", "None", ":", "kwargs", "[", ...
Gets the values to pass to :see:__init__ when re-creating this object.
[ "Gets", "the", "values", "to", "pass", "to", ":", "see", ":", "__init__", "when", "re", "-", "creating", "this", "object", "." ]
python
test
NICTA/revrand
revrand/likelihoods.py
https://github.com/NICTA/revrand/blob/4c1881b6c1772d2b988518e49dde954f165acfb6/revrand/likelihoods.py#L500-L521
def df(self, y, f): r""" Derivative of Poisson log likelihood w.r.t.\ f. Parameters ---------- y: ndarray array of 0, 1 valued integers of targets f: ndarray latent function from the GLM prior (:math:`\mathbf{f} = \boldsymbol\Phi \mat...
[ "def", "df", "(", "self", ",", "y", ",", "f", ")", ":", "y", ",", "f", "=", "np", ".", "broadcast_arrays", "(", "y", ",", "f", ")", "if", "self", ".", "tranfcn", "==", "'exp'", ":", "return", "y", "-", "np", ".", "exp", "(", "f", ")", "else...
r""" Derivative of Poisson log likelihood w.r.t.\ f. Parameters ---------- y: ndarray array of 0, 1 valued integers of targets f: ndarray latent function from the GLM prior (:math:`\mathbf{f} = \boldsymbol\Phi \mathbf{w}`) Returns ...
[ "r", "Derivative", "of", "Poisson", "log", "likelihood", "w", ".", "r", ".", "t", ".", "\\", "f", "." ]
python
train
core/uricore
uricore/wkz_urls.py
https://github.com/core/uricore/blob/dc5ef4be7bd93da4c39e5c1cbd1ae4f3ad3f1f2a/uricore/wkz_urls.py#L116-L160
def iri_to_uri(iri, charset='utf-8'): r"""Converts any unicode based IRI to an acceptable ASCII URI. Werkzeug always uses utf-8 URLs internally because this is what browsers and HTTP do as well. In some places where it accepts an URL it also accepts a unicode IRI and converts it into a URI. Examp...
[ "def", "iri_to_uri", "(", "iri", ",", "charset", "=", "'utf-8'", ")", ":", "iri", "=", "unicode", "(", "iri", ")", "scheme", ",", "auth", ",", "hostname", ",", "port", ",", "path", ",", "query", ",", "fragment", "=", "_uri_split", "(", "iri", ")", ...
r"""Converts any unicode based IRI to an acceptable ASCII URI. Werkzeug always uses utf-8 URLs internally because this is what browsers and HTTP do as well. In some places where it accepts an URL it also accepts a unicode IRI and converts it into a URI. Examples for IRI versus URI: >>> iri_to_ur...
[ "r", "Converts", "any", "unicode", "based", "IRI", "to", "an", "acceptable", "ASCII", "URI", ".", "Werkzeug", "always", "uses", "utf", "-", "8", "URLs", "internally", "because", "this", "is", "what", "browsers", "and", "HTTP", "do", "as", "well", ".", "I...
python
train
pymupdf/PyMuPDF
fitz/fitz.py
https://github.com/pymupdf/PyMuPDF/blob/917f2d83482510e26ba0ff01fd2392c26f3a8e90/fitz/fitz.py#L3812-L3816
def setLineEnds(self, start, end): """setLineEnds(self, start, end)""" CheckParent(self) return _fitz.Annot_setLineEnds(self, start, end)
[ "def", "setLineEnds", "(", "self", ",", "start", ",", "end", ")", ":", "CheckParent", "(", "self", ")", "return", "_fitz", ".", "Annot_setLineEnds", "(", "self", ",", "start", ",", "end", ")" ]
setLineEnds(self, start, end)
[ "setLineEnds", "(", "self", "start", "end", ")" ]
python
train
fr33jc/bang
bang/config.py
https://github.com/fr33jc/bang/blob/8f000713f88d2a9a8c1193b63ca10a6578560c16/bang/config.py#L381-L426
def prepare(self): """ Reorganizes the data such that the deployment logic can find it all where it expects to be. The raw configuration file is intended to be as human-friendly as possible partly through the following mechanisms: - In order to minimize repetition, ...
[ "def", "prepare", "(", "self", ")", ":", "# TODO: take server_common_attributes and disperse it among the various", "# server stanzas", "# First stage - turn all the dicts (SERVER, SECGROUP, DATABASE, LOADBAL)", "# into lists now they're merged properly", "for", "stanza_key", ",", "name_ke...
Reorganizes the data such that the deployment logic can find it all where it expects to be. The raw configuration file is intended to be as human-friendly as possible partly through the following mechanisms: - In order to minimize repetition, any attributes that are common ...
[ "Reorganizes", "the", "data", "such", "that", "the", "deployment", "logic", "can", "find", "it", "all", "where", "it", "expects", "to", "be", "." ]
python
train
sci-bots/dmf-device-ui
dmf_device_ui/plugin.py
https://github.com/sci-bots/dmf-device-ui/blob/05b480683c9fa43f91ce5a58de2fa90cdf363fc8/dmf_device_ui/plugin.py#L207-L218
def on_execute__set_surface_alphas(self, request): ''' .. versionchanged:: 0.12 Queue redraw after setting surface alphas. ''' data = decode_content_data(request) logger.debug('[on_execute__set_surface_alphas] %s', data['surface_alphas']) ...
[ "def", "on_execute__set_surface_alphas", "(", "self", ",", "request", ")", ":", "data", "=", "decode_content_data", "(", "request", ")", "logger", ".", "debug", "(", "'[on_execute__set_surface_alphas] %s'", ",", "data", "[", "'surface_alphas'", "]", ")", "for", "n...
.. versionchanged:: 0.12 Queue redraw after setting surface alphas.
[ "..", "versionchanged", "::", "0", ".", "12", "Queue", "redraw", "after", "setting", "surface", "alphas", "." ]
python
train
sixty-north/cosmic-ray
src/cosmic_ray/plugins.py
https://github.com/sixty-north/cosmic-ray/blob/c654e074afbb7b7fcbc23359083c1287c0d3e991/src/cosmic_ray/plugins.py#L43-L50
def operator_names(): """Get all operator names. Returns: A sequence of operator names. """ return tuple('{}/{}'.format(provider_name, operator_name) for provider_name, provider in OPERATOR_PROVIDERS.items() for operator_name in provider)
[ "def", "operator_names", "(", ")", ":", "return", "tuple", "(", "'{}/{}'", ".", "format", "(", "provider_name", ",", "operator_name", ")", "for", "provider_name", ",", "provider", "in", "OPERATOR_PROVIDERS", ".", "items", "(", ")", "for", "operator_name", "in"...
Get all operator names. Returns: A sequence of operator names.
[ "Get", "all", "operator", "names", "." ]
python
train
saltstack/salt
salt/states/selinux.py
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/selinux.py#L458-L481
def fcontext_policy_applied(name, recursive=False): ''' .. versionadded:: 2017.7.0 Checks and makes sure the SELinux policies for a given filespec are applied. ''' ret = {'name': name, 'result': False, 'changes': {}, 'comment': ''} changes_text = __salt__['selinux.fcontext_policy_is_applie...
[ "def", "fcontext_policy_applied", "(", "name", ",", "recursive", "=", "False", ")", ":", "ret", "=", "{", "'name'", ":", "name", ",", "'result'", ":", "False", ",", "'changes'", ":", "{", "}", ",", "'comment'", ":", "''", "}", "changes_text", "=", "__s...
.. versionadded:: 2017.7.0 Checks and makes sure the SELinux policies for a given filespec are applied.
[ "..", "versionadded", "::", "2017", ".", "7", ".", "0" ]
python
train
chrisrink10/basilisp
src/basilisp/importer.py
https://github.com/chrisrink10/basilisp/blob/3d82670ee218ec64eb066289c82766d14d18cc92/src/basilisp/importer.py#L46-L79
def _get_basilisp_bytecode( fullname: str, mtime: int, source_size: int, cache_data: bytes ) -> List[types.CodeType]: """Unmarshal the bytes from a Basilisp bytecode cache file, validating the file header prior to returning. If the file header does not match, throw an exception.""" exc_details = {"n...
[ "def", "_get_basilisp_bytecode", "(", "fullname", ":", "str", ",", "mtime", ":", "int", ",", "source_size", ":", "int", ",", "cache_data", ":", "bytes", ")", "->", "List", "[", "types", ".", "CodeType", "]", ":", "exc_details", "=", "{", "\"name\"", ":",...
Unmarshal the bytes from a Basilisp bytecode cache file, validating the file header prior to returning. If the file header does not match, throw an exception.
[ "Unmarshal", "the", "bytes", "from", "a", "Basilisp", "bytecode", "cache", "file", "validating", "the", "file", "header", "prior", "to", "returning", ".", "If", "the", "file", "header", "does", "not", "match", "throw", "an", "exception", "." ]
python
test
googledatalab/pydatalab
solutionbox/image_classification/mltoolbox/image/classification/_preprocess.py
https://github.com/googledatalab/pydatalab/blob/d9031901d5bca22fe0d5925d204e6698df9852e1/solutionbox/image_classification/mltoolbox/image/classification/_preprocess.py#L188-L198
def calculate_embedding(self, batch_image_bytes): """Get the embeddings for a given JPEG image. Args: batch_image_bytes: As if returned from [ff.read() for ff in file_list]. Returns: The Inception embeddings (bottleneck layer output) """ return self.tf_session.run( self.embeddi...
[ "def", "calculate_embedding", "(", "self", ",", "batch_image_bytes", ")", ":", "return", "self", ".", "tf_session", ".", "run", "(", "self", ".", "embedding", ",", "feed_dict", "=", "{", "self", ".", "input_jpeg", ":", "batch_image_bytes", "}", ")" ]
Get the embeddings for a given JPEG image. Args: batch_image_bytes: As if returned from [ff.read() for ff in file_list]. Returns: The Inception embeddings (bottleneck layer output)
[ "Get", "the", "embeddings", "for", "a", "given", "JPEG", "image", "." ]
python
train
collectiveacuity/labPack
labpack/speech/watson.py
https://github.com/collectiveacuity/labPack/blob/52949ece35e72e3cc308f54d9ffa6bfbd96805b8/labpack/speech/watson.py#L110-L149
def _get_data(self, file_url, file_name='', method_title='', argument_title=''): ''' a helper method to retrieve data buffer for a file url :param file_url: string with url to file :param file_name: [optional] string with name to affix to file buffer :param method_title: [optiona...
[ "def", "_get_data", "(", "self", ",", "file_url", ",", "file_name", "=", "''", ",", "method_title", "=", "''", ",", "argument_title", "=", "''", ")", ":", "# https://docs.python.org/3/library/io.html#io.BytesIO\r", "import", "io", "import", "requests", "# fill empty...
a helper method to retrieve data buffer for a file url :param file_url: string with url to file :param file_name: [optional] string with name to affix to file buffer :param method_title: [optional] string with name of class method calling :param argument_title: [optional] string wi...
[ "a", "helper", "method", "to", "retrieve", "data", "buffer", "for", "a", "file", "url", ":", "param", "file_url", ":", "string", "with", "url", "to", "file", ":", "param", "file_name", ":", "[", "optional", "]", "string", "with", "name", "to", "affix", ...
python
train
rraadd88/rohan
rohan/dandage/align/align_annot.py
https://github.com/rraadd88/rohan/blob/b0643a3582a2fffc0165ace69fb80880d92bfb10/rohan/dandage/align/align_annot.py#L334-L363
def dannotsagg2dannots2dalignbedannot(cfg): """ Map aggregated annotations to queries step#9 :param cfg: configuration dict """ datatmpd=cfg['datatmpd'] dannotsagg=del_Unnamed(pd.read_csv(cfg['dannotsaggp'],sep='\t')) dalignbedstats=del_Unnamed(pd.read_csv(cfg['dalignbedstatsp'],se...
[ "def", "dannotsagg2dannots2dalignbedannot", "(", "cfg", ")", ":", "datatmpd", "=", "cfg", "[", "'datatmpd'", "]", "dannotsagg", "=", "del_Unnamed", "(", "pd", ".", "read_csv", "(", "cfg", "[", "'dannotsaggp'", "]", ",", "sep", "=", "'\\t'", ")", ")", "dali...
Map aggregated annotations to queries step#9 :param cfg: configuration dict
[ "Map", "aggregated", "annotations", "to", "queries", "step#9" ]
python
train
apache/spark
python/pyspark/streaming/context.py
https://github.com/apache/spark/blob/618d6bff71073c8c93501ab7392c3cc579730f0b/python/pyspark/streaming/context.py#L286-L313
def queueStream(self, rdds, oneAtATime=True, default=None): """ Create an input stream from a queue of RDDs or list. In each batch, it will process either one or all of the RDDs returned by the queue. .. note:: Changes to the queue after the stream is created will not be recognized. ...
[ "def", "queueStream", "(", "self", ",", "rdds", ",", "oneAtATime", "=", "True", ",", "default", "=", "None", ")", ":", "if", "default", "and", "not", "isinstance", "(", "default", ",", "RDD", ")", ":", "default", "=", "self", ".", "_sc", ".", "parall...
Create an input stream from a queue of RDDs or list. In each batch, it will process either one or all of the RDDs returned by the queue. .. note:: Changes to the queue after the stream is created will not be recognized. @param rdds: Queue of RDDs @param oneAtATime: pick one rdd e...
[ "Create", "an", "input", "stream", "from", "a", "queue", "of", "RDDs", "or", "list", ".", "In", "each", "batch", "it", "will", "process", "either", "one", "or", "all", "of", "the", "RDDs", "returned", "by", "the", "queue", "." ]
python
train
quantmind/pulsar
pulsar/utils/path.py
https://github.com/quantmind/pulsar/blob/fee44e871954aa6ca36d00bb5a3739abfdb89b26/pulsar/utils/path.py#L72-L77
def ispymodule(self): '''Check if this :class:`Path` is a python module.''' if self.isdir(): return os.path.isfile(os.path.join(self, '__init__.py')) elif self.isfile(): return self.endswith('.py')
[ "def", "ispymodule", "(", "self", ")", ":", "if", "self", ".", "isdir", "(", ")", ":", "return", "os", ".", "path", ".", "isfile", "(", "os", ".", "path", ".", "join", "(", "self", ",", "'__init__.py'", ")", ")", "elif", "self", ".", "isfile", "(...
Check if this :class:`Path` is a python module.
[ "Check", "if", "this", ":", "class", ":", "Path", "is", "a", "python", "module", "." ]
python
train
apple/turicreate
deps/src/boost_1_68_0/tools/build/src/build/virtual_target.py
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/tools/build/src/build/virtual_target.py#L152-L178
def from_file (self, file, file_location, project): """ Creates a virtual target with appropriate name and type from 'file'. If a target with that name in that project was already created, returns that already created target. TODO: more correct way would be to compute path to...
[ "def", "from_file", "(", "self", ",", "file", ",", "file_location", ",", "project", ")", ":", "if", "__debug__", ":", "from", ".", "targets", "import", "ProjectTarget", "assert", "isinstance", "(", "file", ",", "basestring", ")", "assert", "isinstance", "(",...
Creates a virtual target with appropriate name and type from 'file'. If a target with that name in that project was already created, returns that already created target. TODO: more correct way would be to compute path to the file, based on name and source location for the...
[ "Creates", "a", "virtual", "target", "with", "appropriate", "name", "and", "type", "from", "file", ".", "If", "a", "target", "with", "that", "name", "in", "that", "project", "was", "already", "created", "returns", "that", "already", "created", "target", ".",...
python
train
openego/ding0
ding0/tools/logger.py
https://github.com/openego/ding0/blob/e2d6528f96255e4bb22ba15514a4f1883564ed5d/ding0/tools/logger.py#L55-L66
def get_default_home_dir(): """ Return default home directory of Ding0 Returns ------- :any:`str` Default home directory including its path """ ding0_dir = str(cfg_ding0.get('config', 'config_dir')) return os.path.join(os.path.expanduser('~'), d...
[ "def", "get_default_home_dir", "(", ")", ":", "ding0_dir", "=", "str", "(", "cfg_ding0", ".", "get", "(", "'config'", ",", "'config_dir'", ")", ")", "return", "os", ".", "path", ".", "join", "(", "os", ".", "path", ".", "expanduser", "(", "'~'", ")", ...
Return default home directory of Ding0 Returns ------- :any:`str` Default home directory including its path
[ "Return", "default", "home", "directory", "of", "Ding0" ]
python
train
brocade/pynos
pynos/versions/ver_6/ver_6_0_1/yang/brocade_xstp_ext.py
https://github.com/brocade/pynos/blob/bd8a34e98f322de3fc06750827d8bbc3a0c00380/pynos/versions/ver_6/ver_6_0_1/yang/brocade_xstp_ext.py#L4116-L4129
def get_stp_mst_detail_output_cist_port_if_role(self, **kwargs): """Auto Generated Code """ config = ET.Element("config") get_stp_mst_detail = ET.Element("get_stp_mst_detail") config = get_stp_mst_detail output = ET.SubElement(get_stp_mst_detail, "output") cist = ...
[ "def", "get_stp_mst_detail_output_cist_port_if_role", "(", "self", ",", "*", "*", "kwargs", ")", ":", "config", "=", "ET", ".", "Element", "(", "\"config\"", ")", "get_stp_mst_detail", "=", "ET", ".", "Element", "(", "\"get_stp_mst_detail\"", ")", "config", "=",...
Auto Generated Code
[ "Auto", "Generated", "Code" ]
python
train
google/grr
grr/client/grr_response_client/client_actions/searching.py
https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/client/grr_response_client/client_actions/searching.py#L96-L165
def BuildChecks(self, request): """Parses request and returns a list of filter callables. Each callable will be called with the StatEntry and returns True if the entry should be suppressed. Args: request: A FindSpec that describes the search. Returns: a list of callables which return ...
[ "def", "BuildChecks", "(", "self", ",", "request", ")", ":", "result", "=", "[", "]", "if", "request", ".", "HasField", "(", "\"start_time\"", ")", "or", "request", ".", "HasField", "(", "\"end_time\"", ")", ":", "def", "FilterTimestamp", "(", "file_stat",...
Parses request and returns a list of filter callables. Each callable will be called with the StatEntry and returns True if the entry should be suppressed. Args: request: A FindSpec that describes the search. Returns: a list of callables which return True if the file is to be suppressed.
[ "Parses", "request", "and", "returns", "a", "list", "of", "filter", "callables", "." ]
python
train
mrcagney/gtfstk
gtfstk/validators.py
https://github.com/mrcagney/gtfstk/blob/c91494e6fefc02523889655a0dc92d1c0eee8d03/gtfstk/validators.py#L670-L707
def check_calendar_dates( feed: "Feed", *, as_df: bool = False, include_warnings: bool = False ) -> List: """ Analog of :func:`check_agency` for ``feed.calendar_dates``. """ table = "calendar_dates" problems = [] # Preliminary checks if feed.calendar_dates is None: return proble...
[ "def", "check_calendar_dates", "(", "feed", ":", "\"Feed\"", ",", "*", ",", "as_df", ":", "bool", "=", "False", ",", "include_warnings", ":", "bool", "=", "False", ")", "->", "List", ":", "table", "=", "\"calendar_dates\"", "problems", "=", "[", "]", "# ...
Analog of :func:`check_agency` for ``feed.calendar_dates``.
[ "Analog", "of", ":", "func", ":", "check_agency", "for", "feed", ".", "calendar_dates", "." ]
python
train
KE-works/pykechain
pykechain/models/scope.py
https://github.com/KE-works/pykechain/blob/b0296cf34328fd41660bf6f0b9114fd0167c40c4/pykechain/models/scope.py#L152-L159
def service(self, *args, **kwargs): """Retrieve a single service belonging to this scope. See :class:`pykechain.Client.service` for available parameters. .. versionadded:: 1.13 """ return self._client.service(*args, scope=self.id, **kwargs)
[ "def", "service", "(", "self", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "return", "self", ".", "_client", ".", "service", "(", "*", "args", ",", "scope", "=", "self", ".", "id", ",", "*", "*", "kwargs", ")" ]
Retrieve a single service belonging to this scope. See :class:`pykechain.Client.service` for available parameters. .. versionadded:: 1.13
[ "Retrieve", "a", "single", "service", "belonging", "to", "this", "scope", "." ]
python
train
timothyb0912/pylogit
pylogit/nested_logit.py
https://github.com/timothyb0912/pylogit/blob/f83b0fd6debaa7358d87c3828428f6d4ead71357/pylogit/nested_logit.py#L238-L256
def convenience_calc_probs(self, params): """ Calculates the probabilities of the chosen alternative, and the long format probabilities for this model and dataset. """ orig_nest_coefs, betas = self.convenience_split_params(params) natural_nest_coefs = nc.naturalize_nest_c...
[ "def", "convenience_calc_probs", "(", "self", ",", "params", ")", ":", "orig_nest_coefs", ",", "betas", "=", "self", ".", "convenience_split_params", "(", "params", ")", "natural_nest_coefs", "=", "nc", ".", "naturalize_nest_coefs", "(", "orig_nest_coefs", ")", "a...
Calculates the probabilities of the chosen alternative, and the long format probabilities for this model and dataset.
[ "Calculates", "the", "probabilities", "of", "the", "chosen", "alternative", "and", "the", "long", "format", "probabilities", "for", "this", "model", "and", "dataset", "." ]
python
train
sawcordwell/pymdptoolbox
src/examples/firemdp.py
https://github.com/sawcordwell/pymdptoolbox/blob/7c96789cc80e280437005c12065cf70266c11636/src/examples/firemdp.py#L83-L102
def convertIndexToState(index): """Convert transition probability matrix index to state parameters. Parameters ---------- index : int The index into the transition probability matrix that corresponds to the state parameters. Returns ------- population, fire : tuple ...
[ "def", "convertIndexToState", "(", "index", ")", ":", "assert", "index", "<", "STATES", "population", "=", "index", "//", "FIRE_CLASSES", "fire", "=", "index", "%", "FIRE_CLASSES", "return", "(", "population", ",", "fire", ")" ]
Convert transition probability matrix index to state parameters. Parameters ---------- index : int The index into the transition probability matrix that corresponds to the state parameters. Returns ------- population, fire : tuple of int ``population``, the popu...
[ "Convert", "transition", "probability", "matrix", "index", "to", "state", "parameters", ".", "Parameters", "----------", "index", ":", "int", "The", "index", "into", "the", "transition", "probability", "matrix", "that", "corresponds", "to", "the", "state", "parame...
python
train
bjodah/pycompilation
pycompilation/util.py
https://github.com/bjodah/pycompilation/blob/43eac8d82f8258d30d4df77fd2ad3f3e4f4dca18/pycompilation/util.py#L262-L272
def save_to_metadata_file(cls, dirpath, key, value): """ Store `key: value` in metadata file dict. """ fullpath = os.path.join(dirpath, cls.metadata_filename) if os.path.exists(fullpath): d = pickle.load(open(fullpath, 'rb')) d.update({key: value}) ...
[ "def", "save_to_metadata_file", "(", "cls", ",", "dirpath", ",", "key", ",", "value", ")", ":", "fullpath", "=", "os", ".", "path", ".", "join", "(", "dirpath", ",", "cls", ".", "metadata_filename", ")", "if", "os", ".", "path", ".", "exists", "(", "...
Store `key: value` in metadata file dict.
[ "Store", "key", ":", "value", "in", "metadata", "file", "dict", "." ]
python
train
brean/python-pathfinding
pathfinding/core/util.py
https://github.com/brean/python-pathfinding/blob/b857bf85e514a1712b40e29ccb5a473cd7fd5c80/pathfinding/core/util.py#L97-L108
def expand_path(path): ''' Given a compressed path, return a new path that has all the segments in it interpolated. ''' expanded = [] if len(path) < 2: return expanded for i in range(len(path)-1): expanded += bresenham(path[i], path[i + 1]) expanded += [path[:-1]] ret...
[ "def", "expand_path", "(", "path", ")", ":", "expanded", "=", "[", "]", "if", "len", "(", "path", ")", "<", "2", ":", "return", "expanded", "for", "i", "in", "range", "(", "len", "(", "path", ")", "-", "1", ")", ":", "expanded", "+=", "bresenham"...
Given a compressed path, return a new path that has all the segments in it interpolated.
[ "Given", "a", "compressed", "path", "return", "a", "new", "path", "that", "has", "all", "the", "segments", "in", "it", "interpolated", "." ]
python
train
fulfilio/python-magento
magento/checkout.py
https://github.com/fulfilio/python-magento/blob/720ec136a6e438a9ee4ee92848a9820b91732750/magento/checkout.py#L51-L62
def order(self, quote_id, store_view=None, license_id=None): """ Allows you to create an order from a shopping cart (quote). Before placing the order, you need to add the customer, customer address, shipping and payment methods. :param quote_id: Shopping cart ID (quote ID) ...
[ "def", "order", "(", "self", ",", "quote_id", ",", "store_view", "=", "None", ",", "license_id", "=", "None", ")", ":", "return", "self", ".", "call", "(", "'cart.order'", ",", "[", "quote_id", ",", "store_view", ",", "license_id", "]", ")" ]
Allows you to create an order from a shopping cart (quote). Before placing the order, you need to add the customer, customer address, shipping and payment methods. :param quote_id: Shopping cart ID (quote ID) :param store_view: Store view ID or code :param license_id: Website li...
[ "Allows", "you", "to", "create", "an", "order", "from", "a", "shopping", "cart", "(", "quote", ")", ".", "Before", "placing", "the", "order", "you", "need", "to", "add", "the", "customer", "customer", "address", "shipping", "and", "payment", "methods", "."...
python
train
MartinThoma/mpu
mpu/io.py
https://github.com/MartinThoma/mpu/blob/61bc36d0192ca90c0bcf9b8a5d7d0d8520e20ff6/mpu/io.py#L352-L367
def get_access_datetime(filepath): """ Get the last time filepath was accessed. Parameters ---------- filepath : str Returns ------- access_datetime : datetime.datetime """ import tzlocal tz = tzlocal.get_localzone() mtime = datetime.fromtimestamp(os.path.getatime(filep...
[ "def", "get_access_datetime", "(", "filepath", ")", ":", "import", "tzlocal", "tz", "=", "tzlocal", ".", "get_localzone", "(", ")", "mtime", "=", "datetime", ".", "fromtimestamp", "(", "os", ".", "path", ".", "getatime", "(", "filepath", ")", ")", "return"...
Get the last time filepath was accessed. Parameters ---------- filepath : str Returns ------- access_datetime : datetime.datetime
[ "Get", "the", "last", "time", "filepath", "was", "accessed", "." ]
python
train
StackStorm/pybind
pybind/slxos/v17r_1_01a/mpls_state/rsvp/interfaces/__init__.py
https://github.com/StackStorm/pybind/blob/44c467e71b2b425be63867aba6e6fa28b2cfe7fb/pybind/slxos/v17r_1_01a/mpls_state/rsvp/interfaces/__init__.py#L168-L191
def _set_interface_type(self, v, load=False): """ Setter method for interface_type, mapped from YANG variable /mpls_state/rsvp/interfaces/interface_type (dcm-interface-type) If this variable is read-only (config: false) in the source YANG file, then _set_interface_type is considered as a private met...
[ "def", "_set_interface_type", "(", "self", ",", "v", ",", "load", "=", "False", ")", ":", "if", "hasattr", "(", "v", ",", "\"_utype\"", ")", ":", "v", "=", "v", ".", "_utype", "(", "v", ")", "try", ":", "t", "=", "YANGDynClass", "(", "v", ",", ...
Setter method for interface_type, mapped from YANG variable /mpls_state/rsvp/interfaces/interface_type (dcm-interface-type) If this variable is read-only (config: false) in the source YANG file, then _set_interface_type is considered as a private method. Backends looking to populate this variable should ...
[ "Setter", "method", "for", "interface_type", "mapped", "from", "YANG", "variable", "/", "mpls_state", "/", "rsvp", "/", "interfaces", "/", "interface_type", "(", "dcm", "-", "interface", "-", "type", ")", "If", "this", "variable", "is", "read", "-", "only", ...
python
train
transceptor-technology/trender
trender/block.py
https://github.com/transceptor-technology/trender/blob/ef2b7374ea2ecc83dceb139b358ec4ad8ce7033b/trender/block.py#L121-L125
def _reset_plain(self): '''Create a BlockText from the captured lines and clear _text.''' if self._text: self._blocks.append(BlockText('\n'.join(self._text))) self._text.clear()
[ "def", "_reset_plain", "(", "self", ")", ":", "if", "self", ".", "_text", ":", "self", ".", "_blocks", ".", "append", "(", "BlockText", "(", "'\\n'", ".", "join", "(", "self", ".", "_text", ")", ")", ")", "self", ".", "_text", ".", "clear", "(", ...
Create a BlockText from the captured lines and clear _text.
[ "Create", "a", "BlockText", "from", "the", "captured", "lines", "and", "clear", "_text", "." ]
python
train
bitesofcode/projexui
projexui/widgets/xchart/xchartrenderer.py
https://github.com/bitesofcode/projexui/blob/f18a73bec84df90b034ca69b9deea118dbedfc4d/projexui/widgets/xchart/xchartrenderer.py#L106-L115
def buildData(self, key, default=None): """ Returns the build information for the given key. :param key | <str> default | <variant> :return <variant> """ return self._buildData.get(nativestring(key), default)
[ "def", "buildData", "(", "self", ",", "key", ",", "default", "=", "None", ")", ":", "return", "self", ".", "_buildData", ".", "get", "(", "nativestring", "(", "key", ")", ",", "default", ")" ]
Returns the build information for the given key. :param key | <str> default | <variant> :return <variant>
[ "Returns", "the", "build", "information", "for", "the", "given", "key", ".", ":", "param", "key", "|", "<str", ">", "default", "|", "<variant", ">", ":", "return", "<variant", ">" ]
python
train
hydpy-dev/hydpy
hydpy/core/itemtools.py
https://github.com/hydpy-dev/hydpy/blob/1bc6a82cf30786521d86b36e27900c6717d3348d/hydpy/core/itemtools.py#L516-L560
def update_variables(self) -> None: """Add the general |ChangeItem.value| with the |Device| specific base variable and assign the result to the respective target variable. >>> from hydpy.core.examples import prepare_full_example_2 >>> hp, pub, TestIO = prepare_full_example_2() >...
[ "def", "update_variables", "(", "self", ")", "->", "None", ":", "value", "=", "self", ".", "value", "for", "device", ",", "target", "in", "self", ".", "device2target", ".", "items", "(", ")", ":", "base", "=", "self", ".", "device2base", "[", "device",...
Add the general |ChangeItem.value| with the |Device| specific base variable and assign the result to the respective target variable. >>> from hydpy.core.examples import prepare_full_example_2 >>> hp, pub, TestIO = prepare_full_example_2() >>> from hydpy.models.hland_v1 import FIELD ...
[ "Add", "the", "general", "|ChangeItem", ".", "value|", "with", "the", "|Device|", "specific", "base", "variable", "and", "assign", "the", "result", "to", "the", "respective", "target", "variable", "." ]
python
train
wummel/linkchecker
linkcheck/checker/httpurl.py
https://github.com/wummel/linkchecker/blob/c2ce810c3fb00b895a841a7be6b2e78c64e7b042/linkcheck/checker/httpurl.py#L193-L201
def _get_ssl_sock(self): """Get raw SSL socket.""" assert self.scheme == u"https", self raw_connection = self.url_connection.raw._connection if raw_connection.sock is None: # sometimes the socket is not yet connected # see https://github.com/kennethreitz/requests/...
[ "def", "_get_ssl_sock", "(", "self", ")", ":", "assert", "self", ".", "scheme", "==", "u\"https\"", ",", "self", "raw_connection", "=", "self", ".", "url_connection", ".", "raw", ".", "_connection", "if", "raw_connection", ".", "sock", "is", "None", ":", "...
Get raw SSL socket.
[ "Get", "raw", "SSL", "socket", "." ]
python
train
madsbk/lrcloud
lrcloud/__main__.py
https://github.com/madsbk/lrcloud/blob/8d99be3e1abdf941642e9a1c86b7d775dc373c0b/lrcloud/__main__.py#L57-L71
def copy_smart_previews(local_catalog, cloud_catalog, local2cloud=True): """Copy Smart Previews from local to cloud or vica versa when 'local2cloud==False' NB: nothing happens if source dir doesn't exist""" lcat_noext = local_catalog[0:local_catalog.rfind(".lrcat")] ccat_noext = cloud_catalog...
[ "def", "copy_smart_previews", "(", "local_catalog", ",", "cloud_catalog", ",", "local2cloud", "=", "True", ")", ":", "lcat_noext", "=", "local_catalog", "[", "0", ":", "local_catalog", ".", "rfind", "(", "\".lrcat\"", ")", "]", "ccat_noext", "=", "cloud_catalog"...
Copy Smart Previews from local to cloud or vica versa when 'local2cloud==False' NB: nothing happens if source dir doesn't exist
[ "Copy", "Smart", "Previews", "from", "local", "to", "cloud", "or", "vica", "versa", "when", "local2cloud", "==", "False", "NB", ":", "nothing", "happens", "if", "source", "dir", "doesn", "t", "exist" ]
python
valid
brocade/pynos
pynos/versions/ver_6/ver_6_0_1/yang/brocade_ip_policy.py
https://github.com/brocade/pynos/blob/bd8a34e98f322de3fc06750827d8bbc3a0c00380/pynos/versions/ver_6/ver_6_0_1/yang/brocade_ip_policy.py#L340-L359
def hide_routemap_holder_route_map_content_match_community_community_access_list_name(self, **kwargs): """Auto Generated Code """ config = ET.Element("config") hide_routemap_holder = ET.SubElement(config, "hide-routemap-holder", xmlns="urn:brocade.com:mgmt:brocade-ip-policy") rou...
[ "def", "hide_routemap_holder_route_map_content_match_community_community_access_list_name", "(", "self", ",", "*", "*", "kwargs", ")", ":", "config", "=", "ET", ".", "Element", "(", "\"config\"", ")", "hide_routemap_holder", "=", "ET", ".", "SubElement", "(", "config"...
Auto Generated Code
[ "Auto", "Generated", "Code" ]
python
train
smnorris/pgdata
pgdata/__init__.py
https://github.com/smnorris/pgdata/blob/8b0294024d5ef30b4ae9184888e2cc7004d1784e/pgdata/__init__.py#L47-L65
def drop_db(url): """Drop specified database """ parsed_url = urlparse(url) db_name = parsed_url.path db_name = db_name.strip("/") db = connect("postgresql://" + parsed_url.netloc) # check that db exists q = """SELECT 1 as exists FROM pg_database WHERE datname = '{d...
[ "def", "drop_db", "(", "url", ")", ":", "parsed_url", "=", "urlparse", "(", "url", ")", "db_name", "=", "parsed_url", ".", "path", "db_name", "=", "db_name", ".", "strip", "(", "\"/\"", ")", "db", "=", "connect", "(", "\"postgresql://\"", "+", "parsed_ur...
Drop specified database
[ "Drop", "specified", "database" ]
python
train
kejbaly2/metrique
metrique/plotting.py
https://github.com/kejbaly2/metrique/blob/a10b076097441b7dde687949139f702f5c1e1b35/metrique/plotting.py#L97-L119
def plot(self, series, label='', color=None, style=None): ''' Wrapper around plot. :param pandas.Series series: The series to be plotted, all values must be positive if stacked is True. :param string label: The label for the series. :param int...
[ "def", "plot", "(", "self", ",", "series", ",", "label", "=", "''", ",", "color", "=", "None", ",", "style", "=", "None", ")", ":", "color", "=", "self", ".", "get_color", "(", "color", ")", "if", "self", ".", "stacked", ":", "series", "+=", "sel...
Wrapper around plot. :param pandas.Series series: The series to be plotted, all values must be positive if stacked is True. :param string label: The label for the series. :param integer/string color: Color for the plot. Can be an index for the col...
[ "Wrapper", "around", "plot", "." ]
python
train
n1analytics/python-paillier
phe/command_line.py
https://github.com/n1analytics/python-paillier/blob/955f8c0bfa9623be15b75462b121d28acf70f04b/phe/command_line.py#L30-L66
def generate_keypair(keysize, id, output): """Generate a paillier private key. Output as JWK to given output file. Use "-" to output the private key to stdout. See the extract command to extract the public component of the private key. Note: The default ID text includes the current time. ...
[ "def", "generate_keypair", "(", "keysize", ",", "id", ",", "output", ")", ":", "log", "(", "\"Generating a paillier keypair with keysize of {}\"", ".", "format", "(", "keysize", ")", ")", "pub", ",", "priv", "=", "phe", ".", "generate_paillier_keypair", "(", "n_...
Generate a paillier private key. Output as JWK to given output file. Use "-" to output the private key to stdout. See the extract command to extract the public component of the private key. Note: The default ID text includes the current time.
[ "Generate", "a", "paillier", "private", "key", "." ]
python
train
pypa/pipenv
pipenv/patched/notpip/_internal/req/req_uninstall.py
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/patched/notpip/_internal/req/req_uninstall.py#L99-L134
def compress_for_rename(paths): """Returns a set containing the paths that need to be renamed. This set may include directories when the original sequence of paths included every file on disk. """ case_map = dict((os.path.normcase(p), p) for p in paths) remaining = set(case_map) unchecked =...
[ "def", "compress_for_rename", "(", "paths", ")", ":", "case_map", "=", "dict", "(", "(", "os", ".", "path", ".", "normcase", "(", "p", ")", ",", "p", ")", "for", "p", "in", "paths", ")", "remaining", "=", "set", "(", "case_map", ")", "unchecked", "...
Returns a set containing the paths that need to be renamed. This set may include directories when the original sequence of paths included every file on disk.
[ "Returns", "a", "set", "containing", "the", "paths", "that", "need", "to", "be", "renamed", "." ]
python
train
mwgielen/jackal
jackal/scripts/relaying.py
https://github.com/mwgielen/jackal/blob/7fe62732eb5194b7246215d5277fb37c398097bf/jackal/scripts/relaying.py#L136-L143
def terminate_processes(self): """ Terminate the processes. """ if self.relay: self.relay.terminate() if self.responder: self.responder.terminate()
[ "def", "terminate_processes", "(", "self", ")", ":", "if", "self", ".", "relay", ":", "self", ".", "relay", ".", "terminate", "(", ")", "if", "self", ".", "responder", ":", "self", ".", "responder", ".", "terminate", "(", ")" ]
Terminate the processes.
[ "Terminate", "the", "processes", "." ]
python
valid
singularitti/text-stream
text_stream/__init__.py
https://github.com/singularitti/text-stream/blob/4df53b98e9f61d983dbd46edd96db93122577eb5/text_stream/__init__.py#L75-L83
def infile_path(self) -> Optional[PurePath]: """ Read-only property. :return: A ``pathlib.PurePath`` object or ``None``. """ if not self.__infile_path: return Path(self.__infile_path).expanduser() return None
[ "def", "infile_path", "(", "self", ")", "->", "Optional", "[", "PurePath", "]", ":", "if", "not", "self", ".", "__infile_path", ":", "return", "Path", "(", "self", ".", "__infile_path", ")", ".", "expanduser", "(", ")", "return", "None" ]
Read-only property. :return: A ``pathlib.PurePath`` object or ``None``.
[ "Read", "-", "only", "property", "." ]
python
train
rndusr/torf
torf/_torrent.py
https://github.com/rndusr/torf/blob/df0363232daacd3f8c91aafddaa0623b8c28cbd2/torf/_torrent.py#L810-L832
def write_stream(self, stream, validate=True): """ Write :attr:`metainfo` to a file-like object Before any data is written, `stream` is truncated if possible. :param stream: Writable file-like object (e.g. :class:`io.BytesIO`) :param bool validate: Whether to run :meth:`validat...
[ "def", "write_stream", "(", "self", ",", "stream", ",", "validate", "=", "True", ")", ":", "content", "=", "self", ".", "dump", "(", "validate", "=", "validate", ")", "try", ":", "# Remove existing data from stream *after* dump() didn't raise", "# anything so we don...
Write :attr:`metainfo` to a file-like object Before any data is written, `stream` is truncated if possible. :param stream: Writable file-like object (e.g. :class:`io.BytesIO`) :param bool validate: Whether to run :meth:`validate` first :raises WriteError: if writing to `stream` fails ...
[ "Write", ":", "attr", ":", "metainfo", "to", "a", "file", "-", "like", "object" ]
python
train
DataDog/integrations-core
tokumx/datadog_checks/tokumx/vendor/pymongo/cursor.py
https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/tokumx/datadog_checks/tokumx/vendor/pymongo/cursor.py#L636-L678
def sort(self, key_or_list, direction=None): """Sorts this cursor's results. Pass a field name and a direction, either :data:`~pymongo.ASCENDING` or :data:`~pymongo.DESCENDING`:: for doc in collection.find().sort('field', pymongo.ASCENDING): print(doc) To s...
[ "def", "sort", "(", "self", ",", "key_or_list", ",", "direction", "=", "None", ")", ":", "self", ".", "__check_okay_to_chain", "(", ")", "keys", "=", "helpers", ".", "_index_list", "(", "key_or_list", ",", "direction", ")", "self", ".", "__ordering", "=", ...
Sorts this cursor's results. Pass a field name and a direction, either :data:`~pymongo.ASCENDING` or :data:`~pymongo.DESCENDING`:: for doc in collection.find().sort('field', pymongo.ASCENDING): print(doc) To sort by multiple fields, pass a list of (key, direction) ...
[ "Sorts", "this", "cursor", "s", "results", "." ]
python
train
sassoftware/saspy
saspy/sasproccommons.py
https://github.com/sassoftware/saspy/blob/e433f71990f249d3a6c3db323ceb11cb2d462cf9/saspy/sasproccommons.py#L306-L326
def _objectmethods(self, obj: str, *args) -> list: """ This method parses the SAS log for artifacts (tables and graphics) that were created from the procedure method call :param obj: str -- proc object :param args: list likely none :return: list -- the tables and graphs ...
[ "def", "_objectmethods", "(", "self", ",", "obj", ":", "str", ",", "*", "args", ")", "->", "list", ":", "code", "=", "\"%listdata(\"", "code", "+=", "obj", "code", "+=", "\");\"", "self", ".", "logger", ".", "debug", "(", "\"Object Method macro call: \"", ...
This method parses the SAS log for artifacts (tables and graphics) that were created from the procedure method call :param obj: str -- proc object :param args: list likely none :return: list -- the tables and graphs available for tab complete
[ "This", "method", "parses", "the", "SAS", "log", "for", "artifacts", "(", "tables", "and", "graphics", ")", "that", "were", "created", "from", "the", "procedure", "method", "call" ]
python
train
zomux/deepy
deepy/networks/network.py
https://github.com/zomux/deepy/blob/090fbad22a08a809b12951cd0d4984f5bd432698/deepy/networks/network.py#L237-L249
def save_params(self, path, new_thread=False): """ Save parameters to file. """ save_logger.info(path) param_variables = self.all_parameters params = [p.get_value().copy() for p in param_variables] if new_thread: thread = Thread(target=save_network_par...
[ "def", "save_params", "(", "self", ",", "path", ",", "new_thread", "=", "False", ")", ":", "save_logger", ".", "info", "(", "path", ")", "param_variables", "=", "self", ".", "all_parameters", "params", "=", "[", "p", ".", "get_value", "(", ")", ".", "c...
Save parameters to file.
[ "Save", "parameters", "to", "file", "." ]
python
test
peterldowns/djoauth2
example/client_demo.py
https://github.com/peterldowns/djoauth2/blob/151c7619d1d7a91d720397cfecf3a29fcc9747a9/example/client_demo.py#L7-L16
def assert_200(response, max_len=500): """ Check that a HTTP response returned 200. """ if response.status_code == 200: return raise ValueError( "Response was {}, not 200:\n{}\n{}".format( response.status_code, json.dumps(dict(response.headers), indent=2), response.content...
[ "def", "assert_200", "(", "response", ",", "max_len", "=", "500", ")", ":", "if", "response", ".", "status_code", "==", "200", ":", "return", "raise", "ValueError", "(", "\"Response was {}, not 200:\\n{}\\n{}\"", ".", "format", "(", "response", ".", "status_code...
Check that a HTTP response returned 200.
[ "Check", "that", "a", "HTTP", "response", "returned", "200", "." ]
python
train
spyder-ide/spyder
spyder/plugins/editor/panels/codefolding.py
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/editor/panels/codefolding.py#L394-L430
def mouseMoveEvent(self, event): """ Detect mouser over indicator and highlight the current scope in the editor (up and down decoration arround the foldable text when the mouse is over an indicator). :param event: event """ super(FoldingPanel, self).mouseMoveEven...
[ "def", "mouseMoveEvent", "(", "self", ",", "event", ")", ":", "super", "(", "FoldingPanel", ",", "self", ")", ".", "mouseMoveEvent", "(", "event", ")", "th", "=", "TextHelper", "(", "self", ".", "editor", ")", "line", "=", "th", ".", "line_nbr_from_posit...
Detect mouser over indicator and highlight the current scope in the editor (up and down decoration arround the foldable text when the mouse is over an indicator). :param event: event
[ "Detect", "mouser", "over", "indicator", "and", "highlight", "the", "current", "scope", "in", "the", "editor", "(", "up", "and", "down", "decoration", "arround", "the", "foldable", "text", "when", "the", "mouse", "is", "over", "an", "indicator", ")", "." ]
python
train
nerdvegas/rez
src/rezgui/models/ContextModel.py
https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rezgui/models/ContextModel.py#L175-L203
def resolve_context(self, verbosity=0, max_fails=-1, timestamp=None, callback=None, buf=None, package_load_callback=None): """Update the current context by performing a re-resolve. The newly resolved context is only applied if it is a successful solve. Returns: ...
[ "def", "resolve_context", "(", "self", ",", "verbosity", "=", "0", ",", "max_fails", "=", "-", "1", ",", "timestamp", "=", "None", ",", "callback", "=", "None", ",", "buf", "=", "None", ",", "package_load_callback", "=", "None", ")", ":", "package_filter...
Update the current context by performing a re-resolve. The newly resolved context is only applied if it is a successful solve. Returns: `ResolvedContext` object, which may be a successful or failed solve.
[ "Update", "the", "current", "context", "by", "performing", "a", "re", "-", "resolve", "." ]
python
train
mobinrg/rpi_spark_drives
JMRPiSpark/Drives/Attitude/MPU6050.py
https://github.com/mobinrg/rpi_spark_drives/blob/e1602d8268a5ef48e9e0a8b37de89e0233f946ea/JMRPiSpark/Drives/Attitude/MPU6050.py#L414-L427
def readAccelRange( self ): """! Reads the range of accelerometer setup. @return an int value. It should be one of the following values: @see ACCEL_RANGE_2G @see ACCEL_RANGE_4G @see ACCEL_RANGE_8G @see ACCEL_RANGE_16G ...
[ "def", "readAccelRange", "(", "self", ")", ":", "raw_data", "=", "self", ".", "_readByte", "(", "self", ".", "REG_ACCEL_CONFIG", ")", "raw_data", "=", "(", "raw_data", "|", "0xE7", ")", "^", "0xE7", "return", "raw_data" ]
! Reads the range of accelerometer setup. @return an int value. It should be one of the following values: @see ACCEL_RANGE_2G @see ACCEL_RANGE_4G @see ACCEL_RANGE_8G @see ACCEL_RANGE_16G
[ "!", "Reads", "the", "range", "of", "accelerometer", "setup", "." ]
python
train
ArduPilot/MAVProxy
MAVProxy/modules/mavproxy_asterix.py
https://github.com/ArduPilot/MAVProxy/blob/f50bdeff33064876f7dc8dc4683d278ff47f75d5/MAVProxy/modules/mavproxy_asterix.py#L193-L298
def idle_task(self): '''called on idle''' if self.sock is None: return try: pkt = self.sock.recv(10240) except Exception: return try: if pkt.startswith(b'PICKLED:'): pkt = pkt[8:] # pickled packet ...
[ "def", "idle_task", "(", "self", ")", ":", "if", "self", ".", "sock", "is", "None", ":", "return", "try", ":", "pkt", "=", "self", ".", "sock", ".", "recv", "(", "10240", ")", "except", "Exception", ":", "return", "try", ":", "if", "pkt", ".", "s...
called on idle
[ "called", "on", "idle" ]
python
train
apple/turicreate
src/unity/python/turicreate/data_structures/sarray.py
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/data_structures/sarray.py#L4373-L4400
def cumulative_var(self): """ Return the cumulative variance of the elements in the SArray. Returns an SArray where each element in the output corresponds to the variance of all the elements preceding and including it. The SArray is expected to be of numeric type, or a numeric v...
[ "def", "cumulative_var", "(", "self", ")", ":", "from", ".", ".", "import", "extensions", "agg_op", "=", "\"__builtin__cum_var__\"", "return", "SArray", "(", "_proxy", "=", "self", ".", "__proxy__", ".", "builtin_cumulative_aggregate", "(", "agg_op", ")", ")" ]
Return the cumulative variance of the elements in the SArray. Returns an SArray where each element in the output corresponds to the variance of all the elements preceding and including it. The SArray is expected to be of numeric type, or a numeric vector type. Returns ------- ...
[ "Return", "the", "cumulative", "variance", "of", "the", "elements", "in", "the", "SArray", "." ]
python
train
ericjang/tdb
tdb/debug_session.py
https://github.com/ericjang/tdb/blob/5e78b5dbecf78b6d28eb2f5b67decf8d1f1eb17d/tdb/debug_session.py#L158-L179
def _eval(self, node): """ node is a TensorFlow Op or Tensor from self._exe_order """ # if node.name == 'Momentum': # pdb.set_trace() if isinstance(node,HTOp): # All Tensors MUST be in the cache. feed_dict=dict((t,self._cache[t.name]) for t in node.inputs) node.run(feed_dict) # this will populate ...
[ "def", "_eval", "(", "self", ",", "node", ")", ":", "# if node.name == 'Momentum':", "# \tpdb.set_trace()", "if", "isinstance", "(", "node", ",", "HTOp", ")", ":", "# All Tensors MUST be in the cache.", "feed_dict", "=", "dict", "(", "(", "t", ",", "self", ".", ...
node is a TensorFlow Op or Tensor from self._exe_order
[ "node", "is", "a", "TensorFlow", "Op", "or", "Tensor", "from", "self", ".", "_exe_order" ]
python
train
Azure/azure-python-devtools
src/azure_devtools/ci_tools/github_tools.py
https://github.com/Azure/azure-python-devtools/blob/2bf87b1f3cedd2b26fb2e4fd47a9baf435dcf936/src/azure_devtools/ci_tools/github_tools.py#L102-L128
def sync_fork(gh_token, github_repo_id, repo, push=True): """Sync the current branch in this fork against the direct parent on Github""" if not gh_token: _LOGGER.warning('Skipping the upstream repo sync, no token') return _LOGGER.info('Check if repo has to be sync with upstream') github_...
[ "def", "sync_fork", "(", "gh_token", ",", "github_repo_id", ",", "repo", ",", "push", "=", "True", ")", ":", "if", "not", "gh_token", ":", "_LOGGER", ".", "warning", "(", "'Skipping the upstream repo sync, no token'", ")", "return", "_LOGGER", ".", "info", "("...
Sync the current branch in this fork against the direct parent on Github
[ "Sync", "the", "current", "branch", "in", "this", "fork", "against", "the", "direct", "parent", "on", "Github" ]
python
train
riga/law
law/workflow/base.py
https://github.com/riga/law/blob/479f84ce06ecf3bafe9d33cb7b8fc52e39fb80a1/law/workflow/base.py#L87-L102
def output(self): """ Returns the default workflow outputs in an ordered dictionary. At the moment this is just the collection of outputs of the branch tasks, stored with the key ``"collection"``. """ if self.task.target_collection_cls is not None: cls = self.task.tar...
[ "def", "output", "(", "self", ")", ":", "if", "self", ".", "task", ".", "target_collection_cls", "is", "not", "None", ":", "cls", "=", "self", ".", "task", ".", "target_collection_cls", "elif", "self", ".", "task", ".", "outputs_siblings", ":", "cls", "=...
Returns the default workflow outputs in an ordered dictionary. At the moment this is just the collection of outputs of the branch tasks, stored with the key ``"collection"``.
[ "Returns", "the", "default", "workflow", "outputs", "in", "an", "ordered", "dictionary", ".", "At", "the", "moment", "this", "is", "just", "the", "collection", "of", "outputs", "of", "the", "branch", "tasks", "stored", "with", "the", "key", "collection", "."...
python
train
a1ezzz/wasp-general
wasp_general/network/service.py
https://github.com/a1ezzz/wasp-general/blob/1029839d33eb663f8dec76c1c46754d53c1de4a9/wasp_general/network/service.py#L248-L257
def loop_stopped(self): """ Terminate socket connection because of stopping loop :return: None """ transport = self.transport() if self.server_mode() is True: transport.close_server_socket(self.config()) else: transport.close_client_socket(self.config())
[ "def", "loop_stopped", "(", "self", ")", ":", "transport", "=", "self", ".", "transport", "(", ")", "if", "self", ".", "server_mode", "(", ")", "is", "True", ":", "transport", ".", "close_server_socket", "(", "self", ".", "config", "(", ")", ")", "else...
Terminate socket connection because of stopping loop :return: None
[ "Terminate", "socket", "connection", "because", "of", "stopping", "loop" ]
python
train
VIVelev/PyDojoML
dojo/base/preprocessor.py
https://github.com/VIVelev/PyDojoML/blob/773fdce6866aa6decd306a5a85f94129fed816eb/dojo/base/preprocessor.py#L32-L50
def get_params(self, *keys): """Returns the specified parameters for the current preprocessor. Parameters: ----------- keys : variable sized list, containing the names of the requested parameters Returns: -------- values : list or dictionary, if any `keys` are s...
[ "def", "get_params", "(", "self", ",", "*", "keys", ")", ":", "if", "len", "(", "keys", ")", "==", "0", ":", "return", "vars", "(", "self", ")", "else", ":", "return", "[", "vars", "(", "self", ")", "[", "k", "]", "for", "k", "in", "keys", "]...
Returns the specified parameters for the current preprocessor. Parameters: ----------- keys : variable sized list, containing the names of the requested parameters Returns: -------- values : list or dictionary, if any `keys` are specified those named parameters'...
[ "Returns", "the", "specified", "parameters", "for", "the", "current", "preprocessor", "." ]
python
train
wummel/linkchecker
linkcheck/bookmarks/opera.py
https://github.com/wummel/linkchecker/blob/c2ce810c3fb00b895a841a7be6b2e78c64e7b042/linkcheck/bookmarks/opera.py#L40-L54
def find_bookmark_file (): """Return the bookmark file of the Opera profile. Returns absolute filename if found, or empty string if no bookmark file could be found. """ try: dirname = get_profile_dir() if os.path.isdir(dirname): for name in OperaBookmarkFiles: ...
[ "def", "find_bookmark_file", "(", ")", ":", "try", ":", "dirname", "=", "get_profile_dir", "(", ")", "if", "os", ".", "path", ".", "isdir", "(", "dirname", ")", ":", "for", "name", "in", "OperaBookmarkFiles", ":", "fname", "=", "os", ".", "path", ".", ...
Return the bookmark file of the Opera profile. Returns absolute filename if found, or empty string if no bookmark file could be found.
[ "Return", "the", "bookmark", "file", "of", "the", "Opera", "profile", ".", "Returns", "absolute", "filename", "if", "found", "or", "empty", "string", "if", "no", "bookmark", "file", "could", "be", "found", "." ]
python
train
saltstack/salt
salt/modules/win_iis.py
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/win_iis.py#L1145-L1167
def stop_apppool(name): ''' Stop an IIS application pool. .. versionadded:: 2017.7.0 Args: name (str): The name of the App Pool to stop. Returns: bool: True if successful, otherwise False CLI Example: .. code-block:: bash salt '*' win_iis.stop_apppool name='MyTe...
[ "def", "stop_apppool", "(", "name", ")", ":", "ps_cmd", "=", "[", "'Stop-WebAppPool'", ",", "r\"'{0}'\"", ".", "format", "(", "name", ")", "]", "cmd_ret", "=", "_srvmgr", "(", "ps_cmd", ")", "return", "cmd_ret", "[", "'retcode'", "]", "==", "0" ]
Stop an IIS application pool. .. versionadded:: 2017.7.0 Args: name (str): The name of the App Pool to stop. Returns: bool: True if successful, otherwise False CLI Example: .. code-block:: bash salt '*' win_iis.stop_apppool name='MyTestPool'
[ "Stop", "an", "IIS", "application", "pool", "." ]
python
train
Shoobx/xmldiff
xmldiff/main.py
https://github.com/Shoobx/xmldiff/blob/ec7835bce9ba69ff4ce03ab6c11397183b6f8411/xmldiff/main.py#L121-L126
def patch_text(actions, tree): """Takes a string with XML and a string with actions""" tree = etree.fromstring(tree) actions = patch.DiffParser().parse(actions) tree = patch_tree(actions, tree) return etree.tounicode(tree)
[ "def", "patch_text", "(", "actions", ",", "tree", ")", ":", "tree", "=", "etree", ".", "fromstring", "(", "tree", ")", "actions", "=", "patch", ".", "DiffParser", "(", ")", ".", "parse", "(", "actions", ")", "tree", "=", "patch_tree", "(", "actions", ...
Takes a string with XML and a string with actions
[ "Takes", "a", "string", "with", "XML", "and", "a", "string", "with", "actions" ]
python
train