repo
stringlengths
7
55
path
stringlengths
4
223
url
stringlengths
87
315
code
stringlengths
75
104k
code_tokens
list
docstring
stringlengths
1
46.9k
docstring_tokens
list
language
stringclasses
1 value
partition
stringclasses
3 values
avg_line_len
float64
7.91
980
tulir/mautrix-python
mautrix_appservice/intent_api.py
https://github.com/tulir/mautrix-python/blob/21bb0870e4103dd03ecc61396ce02adb9301f382/mautrix_appservice/intent_api.py#L92-L102
def bot_intent(self) -> "IntentAPI": """ Get the intent API for the appservice bot. Returns: The IntentAPI for the appservice bot. """ if not self._bot_intent: self._bot_intent = IntentAPI(self.bot_mxid, self, state_store=self.state_store, ...
[ "def", "bot_intent", "(", "self", ")", "->", "\"IntentAPI\"", ":", "if", "not", "self", ".", "_bot_intent", ":", "self", ".", "_bot_intent", "=", "IntentAPI", "(", "self", ".", "bot_mxid", ",", "self", ",", "state_store", "=", "self", ".", "state_store", ...
Get the intent API for the appservice bot. Returns: The IntentAPI for the appservice bot.
[ "Get", "the", "intent", "API", "for", "the", "appservice", "bot", "." ]
python
train
35.272727
JasonKessler/scattertext
scattertext/TermDocMatrix.py
https://github.com/JasonKessler/scattertext/blob/cacf1f687d218ee8cae3fc05cc901db824bb1b81/scattertext/TermDocMatrix.py#L581-L590
def get_posterior_mean_ratio_scores_vs_background(self): ''' Returns ------- pd.DataFrame of posterior mean scores vs background ''' df = self.get_term_and_background_counts() df['Log Posterior Mean Ratio'] = self._get_posterior_mean_ratio_from_counts(df['cor...
[ "def", "get_posterior_mean_ratio_scores_vs_background", "(", "self", ")", ":", "df", "=", "self", ".", "get_term_and_background_counts", "(", ")", "df", "[", "'Log Posterior Mean Ratio'", "]", "=", "self", ".", "_get_posterior_mean_ratio_from_counts", "(", "df", "[", ...
Returns ------- pd.DataFrame of posterior mean scores vs background
[ "Returns", "-------", "pd", ".", "DataFrame", "of", "posterior", "mean", "scores", "vs", "background" ]
python
train
49.4
armet/python-armet
armet/resources/managed/base.py
https://github.com/armet/python-armet/blob/d61eca9082256cb1e7f7f3c7f2fbc4b697157de7/armet/resources/managed/base.py#L328-L358
def get(self, request, response): """Processes a `GET` request.""" # Ensure we're allowed to read the resource. self.assert_operations('read') # Delegate to `read` to retrieve the items. items = self.read() # if self.slug is not None and not items: # # Reque...
[ "def", "get", "(", "self", ",", "request", ",", "response", ")", ":", "# Ensure we're allowed to read the resource.", "self", ".", "assert_operations", "(", "'read'", ")", "# Delegate to `read` to retrieve the items.", "items", "=", "self", ".", "read", "(", ")", "#...
Processes a `GET` request.
[ "Processes", "a", "GET", "request", "." ]
python
valid
36.096774
mikerhodes/actionqueues
actionqueues/actionqueue.py
https://github.com/mikerhodes/actionqueues/blob/a7a78ab116abe88af95b5315dc9f34d40ce81eb2/actionqueues/actionqueue.py#L22-L25
def add(self, action): """Add an action to the execution queue.""" self._state_machine.transition_to_add() self._actions.append(action)
[ "def", "add", "(", "self", ",", "action", ")", ":", "self", ".", "_state_machine", ".", "transition_to_add", "(", ")", "self", ".", "_actions", ".", "append", "(", "action", ")" ]
Add an action to the execution queue.
[ "Add", "an", "action", "to", "the", "execution", "queue", "." ]
python
train
39
listen-lavender/webcrawl
webcrawl/prettyprint.py
https://github.com/listen-lavender/webcrawl/blob/905dcfa6e6934aac764045660c0efcef28eae1e6/webcrawl/prettyprint.py#L79-L182
def logprint(logname, category, level='INFO', backupCount=15): """ Print logs by datetime. logname string, file name category string, category path of logs file in log directory level string, restrict whether logs to be printed or not backupCoun...
[ "def", "logprint", "(", "logname", ",", "category", ",", "level", "=", "'INFO'", ",", "backupCount", "=", "15", ")", ":", "path", "=", "os", ".", "path", ".", "join", "(", "CFG", ".", "dir", ",", "category", ".", "strip", "(", "'/'", ")", ",", "l...
Print logs by datetime. logname string, file name category string, category path of logs file in log directory level string, restrict whether logs to be printed or not backupCount int, how many backups can be reserved
[ "Print", "logs", "by", "datetime", "." ]
python
train
32.134615
twilio/twilio-python
twilio/rest/messaging/v1/session/participant.py
https://github.com/twilio/twilio-python/blob/c867895f55dcc29f522e6e8b8868d0d18483132f/twilio/rest/messaging/v1/session/participant.py#L39-L70
def create(self, attributes=values.unset, twilio_address=values.unset, date_created=values.unset, date_updated=values.unset, identity=values.unset, user_address=values.unset): """ Create a new ParticipantInstance :param unicode attributes: An optional string metada...
[ "def", "create", "(", "self", ",", "attributes", "=", "values", ".", "unset", ",", "twilio_address", "=", "values", ".", "unset", ",", "date_created", "=", "values", ".", "unset", ",", "date_updated", "=", "values", ".", "unset", ",", "identity", "=", "v...
Create a new ParticipantInstance :param unicode attributes: An optional string metadata field you can use to store any data you wish. :param unicode twilio_address: The address of the Twilio phone number that the participant is in contact with. :param datetime date_created: The date that this r...
[ "Create", "a", "new", "ParticipantInstance" ]
python
train
46.90625
koddsson/coredata-python-client
coredata/coredata.py
https://github.com/koddsson/coredata-python-client/blob/b6ed8086e79a70f21bd843f7d2997546d3c4a6d3/coredata/coredata.py#L72-L82
def edit(self, entity, id, payload, sync=True): """ Edit a document. """ url = urljoin(self.host, entity.value + '/') url = urljoin(url, id + '/') params = {'sync': str(sync).lower()} url = Utils.add_url_parameters(url, params) r = requests.put(url, auth=self.auth, data=j...
[ "def", "edit", "(", "self", ",", "entity", ",", "id", ",", "payload", ",", "sync", "=", "True", ")", ":", "url", "=", "urljoin", "(", "self", ".", "host", ",", "entity", ".", "value", "+", "'/'", ")", "url", "=", "urljoin", "(", "url", ",", "id...
Edit a document.
[ "Edit", "a", "document", "." ]
python
train
49.181818
elsampsa/valkka-live
valkka/live/gui.py
https://github.com/elsampsa/valkka-live/blob/218bb2ecf71c516c85b1b6e075454bba13090cd8/valkka/live/gui.py#L134-L180
def QCapsulate(self, widget, name, blocking = False, nude = False): """Helper function that encapsulates QWidget into a QMainWindow """ class QuickWindow(QtWidgets.QMainWindow): class Signals(QtCore.QObject): close = QtCore.Signal() show = QtCore.Si...
[ "def", "QCapsulate", "(", "self", ",", "widget", ",", "name", ",", "blocking", "=", "False", ",", "nude", "=", "False", ")", ":", "class", "QuickWindow", "(", "QtWidgets", ".", "QMainWindow", ")", ":", "class", "Signals", "(", "QtCore", ".", "QObject", ...
Helper function that encapsulates QWidget into a QMainWindow
[ "Helper", "function", "that", "encapsulates", "QWidget", "into", "a", "QMainWindow" ]
python
train
38.893617
hyperledger/sawtooth-core
validator/sawtooth_validator/execution/execution_context.py
https://github.com/hyperledger/sawtooth-core/blob/8cf473bc2207e51f02bd182d825158a57d72b098/validator/sawtooth_validator/execution/execution_context.py#L163-L178
def get_if_deleted(self, addresses): """Returns a list of addresses that have been deleted, or None if it hasn't been deleted. Args: addresses (list of str): The addresses to check if deleted. Returns: (list of str): The addresses, if deleted, or None. "...
[ "def", "get_if_deleted", "(", "self", ",", "addresses", ")", ":", "with", "self", ".", "_lock", ":", "results", "=", "[", "]", "for", "add", "in", "addresses", ":", "results", ".", "append", "(", "self", ".", "_get_if_deleted", "(", "add", ")", ")", ...
Returns a list of addresses that have been deleted, or None if it hasn't been deleted. Args: addresses (list of str): The addresses to check if deleted. Returns: (list of str): The addresses, if deleted, or None.
[ "Returns", "a", "list", "of", "addresses", "that", "have", "been", "deleted", "or", "None", "if", "it", "hasn", "t", "been", "deleted", "." ]
python
train
29.8125
osrg/ryu
ryu/services/protocols/ovsdb/client.py
https://github.com/osrg/ryu/blob/6f906e72c92e10bd0264c9b91a2f7bb85b97780c/ryu/services/protocols/ovsdb/client.py#L142-L195
def _filter_schema(schema, schema_tables, exclude_table_columns): """Filters a schema to only include the specified tables in the schema_tables parameter. This will also filter out any colums for included tables that reference tables that are not included in the schema_tables parameter :p...
[ "def", "_filter_schema", "(", "schema", ",", "schema_tables", ",", "exclude_table_columns", ")", ":", "tables", "=", "{", "}", "for", "tbl_name", ",", "tbl_data", "in", "schema", "[", "'tables'", "]", ".", "items", "(", ")", ":", "if", "not", "schema_table...
Filters a schema to only include the specified tables in the schema_tables parameter. This will also filter out any colums for included tables that reference tables that are not included in the schema_tables parameter :param schema: Schema dict to be filtered :param schema_tables: List of...
[ "Filters", "a", "schema", "to", "only", "include", "the", "specified", "tables", "in", "the", "schema_tables", "parameter", ".", "This", "will", "also", "filter", "out", "any", "colums", "for", "included", "tables", "that", "reference", "tables", "that", "are"...
python
train
43.203704
genialis/resolwe
resolwe/flow/managers/listener.py
https://github.com/genialis/resolwe/blob/f7bb54932c81ec0cfc5b5e80d238fceaeaa48d86/resolwe/flow/managers/listener.py#L178-L203
def hydrate_spawned_files(self, exported_files_mapper, filename, data_id): """Pop the given file's map from the exported files mapping. :param exported_files_mapper: The dict of file mappings this process produced. :param filename: The filename to format and remove from the ...
[ "def", "hydrate_spawned_files", "(", "self", ",", "exported_files_mapper", ",", "filename", ",", "data_id", ")", ":", "# JSON only has string dictionary keys, so the Data object id", "# needs to be stringified first.", "data_id", "=", "str", "(", "data_id", ")", "if", "file...
Pop the given file's map from the exported files mapping. :param exported_files_mapper: The dict of file mappings this process produced. :param filename: The filename to format and remove from the mapping. :param data_id: The id of the :meth:`~resolwe.flow.models.Data` ...
[ "Pop", "the", "given", "file", "s", "map", "from", "the", "exported", "files", "mapping", "." ]
python
train
41.5
joshspeagle/dynesty
dynesty/sampler.py
https://github.com/joshspeagle/dynesty/blob/9e482aafeb5cf84bedb896fa6f07a761d917983e/dynesty/sampler.py#L761-L861
def run_nested(self, maxiter=None, maxcall=None, dlogz=None, logl_max=np.inf, add_live=True, print_progress=True, print_func=None, save_bounds=True): """ **A wrapper that executes the main nested sampling loop.** Iteratively replace the worst live point with...
[ "def", "run_nested", "(", "self", ",", "maxiter", "=", "None", ",", "maxcall", "=", "None", ",", "dlogz", "=", "None", ",", "logl_max", "=", "np", ".", "inf", ",", "add_live", "=", "True", ",", "print_progress", "=", "True", ",", "print_func", "=", "...
**A wrapper that executes the main nested sampling loop.** Iteratively replace the worst live point with a sample drawn uniformly from the prior until the provided stopping criteria are reached. Parameters ---------- maxiter : int, optional Maximum number of ...
[ "**", "A", "wrapper", "that", "executes", "the", "main", "nested", "sampling", "loop", ".", "**", "Iteratively", "replace", "the", "worst", "live", "point", "with", "a", "sample", "drawn", "uniformly", "from", "the", "prior", "until", "the", "provided", "sto...
python
train
40.732673
Dentosal/python-sc2
sc2/bot_ai.py
https://github.com/Dentosal/python-sc2/blob/608bd25f04e89d39cef68b40101d8e9a8a7f1634/sc2/bot_ai.py#L263-L276
def can_afford(self, item_id: Union[UnitTypeId, UpgradeId, AbilityId], check_supply_cost: bool=True) -> "CanAffordWrapper": """Tests if the player has enough resources to build a unit or cast an ability.""" enough_supply = True if isinstance(item_id, UnitTypeId): unit = self._game_da...
[ "def", "can_afford", "(", "self", ",", "item_id", ":", "Union", "[", "UnitTypeId", ",", "UpgradeId", ",", "AbilityId", "]", ",", "check_supply_cost", ":", "bool", "=", "True", ")", "->", "\"CanAffordWrapper\"", ":", "enough_supply", "=", "True", "if", "isins...
Tests if the player has enough resources to build a unit or cast an ability.
[ "Tests", "if", "the", "player", "has", "enough", "resources", "to", "build", "a", "unit", "or", "cast", "an", "ability", "." ]
python
train
57.142857
pazz/alot
alot/db/envelope.py
https://github.com/pazz/alot/blob/d0297605c0ec1c6b65f541d0fd5b69ac5a0f4ded/alot/db/envelope.py#L136-L142
def get_all(self, key, fallback=None): """returns all header values for given key""" if key in self.headers: value = self.headers[key] else: value = fallback or [] return value
[ "def", "get_all", "(", "self", ",", "key", ",", "fallback", "=", "None", ")", ":", "if", "key", "in", "self", ".", "headers", ":", "value", "=", "self", ".", "headers", "[", "key", "]", "else", ":", "value", "=", "fallback", "or", "[", "]", "retu...
returns all header values for given key
[ "returns", "all", "header", "values", "for", "given", "key" ]
python
train
32.285714
saltstack/salt
salt/utils/jid.py
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/jid.py#L82-L99
def format_job_instance(job): ''' Format the job instance correctly ''' ret = {'Function': job.get('fun', 'unknown-function'), 'Arguments': list(job.get('arg', [])), # unlikely but safeguard from invalid returns 'Target': job.get('tgt', 'unknown-target'), 'Tar...
[ "def", "format_job_instance", "(", "job", ")", ":", "ret", "=", "{", "'Function'", ":", "job", ".", "get", "(", "'fun'", ",", "'unknown-function'", ")", ",", "'Arguments'", ":", "list", "(", "job", ".", "get", "(", "'arg'", ",", "[", "]", ")", ")", ...
Format the job instance correctly
[ "Format", "the", "job", "instance", "correctly" ]
python
train
34.888889
mrcagney/gtfstk
gtfstk/feed.py
https://github.com/mrcagney/gtfstk/blob/c91494e6fefc02523889655a0dc92d1c0eee8d03/gtfstk/feed.py#L375-L421
def read_gtfs(path: Path, dist_units: str) -> "Feed": """ Create a Feed instance from the given path and given distance units. The path should be a directory containing GTFS text files or a zip file that unzips as a collection of GTFS text files (and not as a directory containing GTFS text files). ...
[ "def", "read_gtfs", "(", "path", ":", "Path", ",", "dist_units", ":", "str", ")", "->", "\"Feed\"", ":", "path", "=", "Path", "(", "path", ")", "if", "not", "path", ".", "exists", "(", ")", ":", "raise", "ValueError", "(", "f\"Path {path} does not exist\...
Create a Feed instance from the given path and given distance units. The path should be a directory containing GTFS text files or a zip file that unzips as a collection of GTFS text files (and not as a directory containing GTFS text files). The distance units given must lie in :const:`constants.dist_uni...
[ "Create", "a", "Feed", "instance", "from", "the", "given", "path", "and", "given", "distance", "units", ".", "The", "path", "should", "be", "a", "directory", "containing", "GTFS", "text", "files", "or", "a", "zip", "file", "that", "unzips", "as", "a", "c...
python
train
35.446809
F5Networks/f5-common-python
f5/bigip/tm/sys/folder.py
https://github.com/F5Networks/f5-common-python/blob/7e67d5acd757a60e3d5f8c88c534bd72208f5494/f5/bigip/tm/sys/folder.py#L90-L103
def update(self, **kwargs): '''Update the object, removing device group if inherited If inheritedDevicegroup is the string "true" we need to remove deviceGroup from the args before we update or we get the following error: The floating traffic-group: /Common/traffic-group-1 can ...
[ "def", "update", "(", "self", ",", "*", "*", "kwargs", ")", ":", "inherit_device_group", "=", "self", ".", "__dict__", ".", "get", "(", "'inheritedDevicegroup'", ",", "False", ")", "if", "inherit_device_group", "==", "'true'", ":", "self", ".", "__dict__", ...
Update the object, removing device group if inherited If inheritedDevicegroup is the string "true" we need to remove deviceGroup from the args before we update or we get the following error: The floating traffic-group: /Common/traffic-group-1 can only be set on /testfolder if i...
[ "Update", "the", "object", "removing", "device", "group", "if", "inherited" ]
python
train
43.785714
Capitains/MyCapytain
MyCapytain/resources/prototypes/cts/text.py
https://github.com/Capitains/MyCapytain/blob/b11bbf6b6ae141fc02be70471e3fbf6907be6593/MyCapytain/resources/prototypes/cts/text.py#L68-L75
def get_cts_metadata(self, key: str, lang: str = None) -> Literal: """ Get easily a metadata from the CTS namespace :param key: CTS property to retrieve :param lang: Language in which it should be :return: Literal value of the CTS graph property """ return self.metadata....
[ "def", "get_cts_metadata", "(", "self", ",", "key", ":", "str", ",", "lang", ":", "str", "=", "None", ")", "->", "Literal", ":", "return", "self", ".", "metadata", ".", "get_single", "(", "RDF_NAMESPACES", ".", "CTS", ".", "term", "(", "key", ")", ",...
Get easily a metadata from the CTS namespace :param key: CTS property to retrieve :param lang: Language in which it should be :return: Literal value of the CTS graph property
[ "Get", "easily", "a", "metadata", "from", "the", "CTS", "namespace" ]
python
train
44.875
watson-developer-cloud/python-sdk
ibm_watson/discovery_v1.py
https://github.com/watson-developer-cloud/python-sdk/blob/4c2c9df4466fcde88975da9ecd834e6ba95eb353/ibm_watson/discovery_v1.py#L8022-L8049
def _from_dict(cls, _dict): """Initialize a NluEnrichmentFeatures object from a json dictionary.""" args = {} if 'keywords' in _dict: args['keywords'] = NluEnrichmentKeywords._from_dict( _dict.get('keywords')) if 'entities' in _dict: args['entities...
[ "def", "_from_dict", "(", "cls", ",", "_dict", ")", ":", "args", "=", "{", "}", "if", "'keywords'", "in", "_dict", ":", "args", "[", "'keywords'", "]", "=", "NluEnrichmentKeywords", ".", "_from_dict", "(", "_dict", ".", "get", "(", "'keywords'", ")", "...
Initialize a NluEnrichmentFeatures object from a json dictionary.
[ "Initialize", "a", "NluEnrichmentFeatures", "object", "from", "a", "json", "dictionary", "." ]
python
train
44.571429
estnltk/estnltk
estnltk/examples/split_large_koondkorpus_files.py
https://github.com/estnltk/estnltk/blob/28ae334a68a0673072febc318635f04da0dcc54a/estnltk/examples/split_large_koondkorpus_files.py#L35-L47
def format_time( sec ): ''' Re-formats time duration in seconds (*sec*) into more easily readable form, where (days,) hours, minutes, and seconds are explicitly shown. Returns the new duration as a formatted string. ''' import time if sec < 864000: # Idea from: http://stackover...
[ "def", "format_time", "(", "sec", ")", ":", "import", "time", "if", "sec", "<", "864000", ":", "# Idea from: http://stackoverflow.com/a/1384565", "return", "time", ".", "strftime", "(", "'%H:%M:%S'", ",", "time", ".", "gmtime", "(", "sec", ")", ")", "else", ...
Re-formats time duration in seconds (*sec*) into more easily readable form, where (days,) hours, minutes, and seconds are explicitly shown. Returns the new duration as a formatted string.
[ "Re", "-", "formats", "time", "duration", "in", "seconds", "(", "*", "sec", "*", ")", "into", "more", "easily", "readable", "form", "where", "(", "days", ")", "hours", "minutes", "and", "seconds", "are", "explicitly", "shown", ".", "Returns", "the", "new...
python
train
40.615385
MDAnalysis/GridDataFormats
gridData/core.py
https://github.com/MDAnalysis/GridDataFormats/blob/3eeb0432f8cf856912436e4f3e7aba99d3c916be/gridData/core.py#L189-L235
def resample(self, edges): """Resample data to a new grid with edges *edges*. This method creates a new grid with the data from the current grid resampled to a regular grid specified by *edges*. The order of the interpolation is set by :attr:`Grid.interpolation_spline_order`: c...
[ "def", "resample", "(", "self", ",", "edges", ")", ":", "try", ":", "edges", "=", "edges", ".", "edges", "# can also supply another Grid", "except", "AttributeError", ":", "pass", "midpoints", "=", "self", ".", "_midpoints", "(", "edges", ")", "coordinates", ...
Resample data to a new grid with edges *edges*. This method creates a new grid with the data from the current grid resampled to a regular grid specified by *edges*. The order of the interpolation is set by :attr:`Grid.interpolation_spline_order`: change the value *before* calli...
[ "Resample", "data", "to", "a", "new", "grid", "with", "edges", "*", "edges", "*", "." ]
python
valid
30.297872
apple/turicreate
src/external/coremltools_wrap/coremltools/coremltools/converters/keras/_layers.py
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/coremltools/converters/keras/_layers.py#L918-L950
def convert_permute(builder, layer, input_names, output_names, keras_layer): """Convert a softmax layer from keras to coreml. Parameters keras_layer: layer ---------- A keras layer object. builder: NeuralNetworkBuilder A neural network builder object. """ input_name, output...
[ "def", "convert_permute", "(", "builder", ",", "layer", ",", "input_names", ",", "output_names", ",", "keras_layer", ")", ":", "input_name", ",", "output_name", "=", "(", "input_names", "[", "0", "]", ",", "output_names", "[", "0", "]", ")", "keras_dims", ...
Convert a softmax layer from keras to coreml. Parameters keras_layer: layer ---------- A keras layer object. builder: NeuralNetworkBuilder A neural network builder object.
[ "Convert", "a", "softmax", "layer", "from", "keras", "to", "coreml", "." ]
python
train
34.878788
brian-rose/climlab
climlab/process/process.py
https://github.com/brian-rose/climlab/blob/eae188a2ae9308229b8cbb8fe0b65f51b50ee1e6/climlab/process/process.py#L505-L583
def to_xarray(self, diagnostics=False): """ Convert process variables to ``xarray.Dataset`` format. With ``diagnostics=True``, both state and diagnostic variables are included. Otherwise just the state variables are included. Returns an ``xarray.Dataset`` object with all spatial axes,...
[ "def", "to_xarray", "(", "self", ",", "diagnostics", "=", "False", ")", ":", "if", "diagnostics", ":", "dic", "=", "self", ".", "state", ".", "copy", "(", ")", "dic", ".", "update", "(", "self", ".", "diagnostics", ")", "return", "state_to_xarray", "("...
Convert process variables to ``xarray.Dataset`` format. With ``diagnostics=True``, both state and diagnostic variables are included. Otherwise just the state variables are included. Returns an ``xarray.Dataset`` object with all spatial axes, including 'bounds' axes indicating cell bou...
[ "Convert", "process", "variables", "to", "xarray", ".", "Dataset", "format", "." ]
python
train
57.43038
PonteIneptique/collatinus-python
pycollatinus/parser.py
https://github.com/PonteIneptique/collatinus-python/blob/fca37b0b77bc60f47d3c24ab42f6d0bdca6ba0f5/pycollatinus/parser.py#L456-L474
def parse_irreg(self, l): """ Constructeur de la classe Irreg. :param l: Ligne de chargement des irréguliers :type l: str """ ecl = l.split(':') grq = ecl[0] exclusif = False if grq.endswith("*"): grq = grq[:-1] exclusif = True ...
[ "def", "parse_irreg", "(", "self", ",", "l", ")", ":", "ecl", "=", "l", ".", "split", "(", "':'", ")", "grq", "=", "ecl", "[", "0", "]", "exclusif", "=", "False", "if", "grq", ".", "endswith", "(", "\"*\"", ")", ":", "grq", "=", "grq", "[", "...
Constructeur de la classe Irreg. :param l: Ligne de chargement des irréguliers :type l: str
[ "Constructeur", "de", "la", "classe", "Irreg", "." ]
python
train
28.315789
mwouts/jupytext
jupytext/pep8.py
https://github.com/mwouts/jupytext/blob/eb7d6aee889f80ad779cfc53441c648f0db9246d/jupytext/pep8.py#L47-L55
def cell_ends_with_code(lines): """Is the last line of the cell a line with code?""" if not lines: return False if not lines[-1].strip(): return False if lines[-1].startswith('#'): return False return True
[ "def", "cell_ends_with_code", "(", "lines", ")", ":", "if", "not", "lines", ":", "return", "False", "if", "not", "lines", "[", "-", "1", "]", ".", "strip", "(", ")", ":", "return", "False", "if", "lines", "[", "-", "1", "]", ".", "startswith", "(",...
Is the last line of the cell a line with code?
[ "Is", "the", "last", "line", "of", "the", "cell", "a", "line", "with", "code?" ]
python
train
26.777778
chaoss/grimoirelab-perceval-mozilla
perceval/backends/mozilla/crates.py
https://github.com/chaoss/grimoirelab-perceval-mozilla/blob/4514f8d3d609d3cb79d83c72d51fcc4b4a7daeb4/perceval/backends/mozilla/crates.py#L91-L104
def fetch_items(self, category, **kwargs): """Fetch packages and summary from Crates.io :param category: the category of items to fetch :param kwargs: backend arguments :returns: a generator of items """ from_date = kwargs['from_date'] if category == CATEGORY_C...
[ "def", "fetch_items", "(", "self", ",", "category", ",", "*", "*", "kwargs", ")", ":", "from_date", "=", "kwargs", "[", "'from_date'", "]", "if", "category", "==", "CATEGORY_CRATES", ":", "return", "self", ".", "__fetch_crates", "(", "from_date", ")", "els...
Fetch packages and summary from Crates.io :param category: the category of items to fetch :param kwargs: backend arguments :returns: a generator of items
[ "Fetch", "packages", "and", "summary", "from", "Crates", ".", "io" ]
python
test
29.928571
Julius2342/pyvlx
pyvlx/get_version.py
https://github.com/Julius2342/pyvlx/blob/ee78e1324bcb1be5b8d1a9d05ab5496b72eae848/pyvlx/get_version.py#L15-L21
async def handle_frame(self, frame): """Handle incoming API frame, return True if this was the expected frame.""" if not isinstance(frame, FrameGetVersionConfirmation): return False self.version = frame.version self.success = True return True
[ "async", "def", "handle_frame", "(", "self", ",", "frame", ")", ":", "if", "not", "isinstance", "(", "frame", ",", "FrameGetVersionConfirmation", ")", ":", "return", "False", "self", ".", "version", "=", "frame", ".", "version", "self", ".", "success", "="...
Handle incoming API frame, return True if this was the expected frame.
[ "Handle", "incoming", "API", "frame", "return", "True", "if", "this", "was", "the", "expected", "frame", "." ]
python
train
41.142857
plaid/plaid-python
plaid/api/assets.py
https://github.com/plaid/plaid-python/blob/c549c3108790266a3b344c47e0c83fff59146eeb/plaid/api/assets.py#L12-L34
def create(self, access_tokens, days_requested, options=None): ''' Create an asset report. :param [str] access_tokens: A list of access tokens, one token for each Item to be included in the Asset ...
[ "def", "create", "(", "self", ",", "access_tokens", ",", "days_requested", ",", "options", "=", "None", ")", ":", "options", "=", "options", "or", "{", "}", "return", "self", ".", "client", ".", "post", "(", "'/asset_report/create'", ",", "{", "'access_tok...
Create an asset report. :param [str] access_tokens: A list of access tokens, one token for each Item to be included in the Asset Report. :param int days_requested: Days of transaction history requested ...
[ "Create", "an", "asset", "report", "." ]
python
train
41.478261
fastai/fastai
fastai/data_block.py
https://github.com/fastai/fastai/blob/9fb84a5cdefe5a766cdb792b8f5d8971737b7e67/fastai/data_block.py#L663-L665
def export(self, fn:PathOrStr, **kwargs): "Export the minimal state and save it in `fn` to load an empty version for inference." pickle.dump(self.get_state(**kwargs), open(fn, 'wb'))
[ "def", "export", "(", "self", ",", "fn", ":", "PathOrStr", ",", "*", "*", "kwargs", ")", ":", "pickle", ".", "dump", "(", "self", ".", "get_state", "(", "*", "*", "kwargs", ")", ",", "open", "(", "fn", ",", "'wb'", ")", ")" ]
Export the minimal state and save it in `fn` to load an empty version for inference.
[ "Export", "the", "minimal", "state", "and", "save", "it", "in", "fn", "to", "load", "an", "empty", "version", "for", "inference", "." ]
python
train
65.333333
ARMmbed/yotta
yotta/lib/component.py
https://github.com/ARMmbed/yotta/blob/56bc1e56c602fa20307b23fe27518e9cd6c11af1/yotta/lib/component.py#L206-L231
def hasDependency(self, name, target=None, test_dependencies=False): ''' Check if this module has any dependencies with the specified name in its dependencies list, or in target dependencies for the specified target ''' if name in self.description.get('dependencies', {})....
[ "def", "hasDependency", "(", "self", ",", "name", ",", "target", "=", "None", ",", "test_dependencies", "=", "False", ")", ":", "if", "name", "in", "self", ".", "description", ".", "get", "(", "'dependencies'", ",", "{", "}", ")", ".", "keys", "(", "...
Check if this module has any dependencies with the specified name in its dependencies list, or in target dependencies for the specified target
[ "Check", "if", "this", "module", "has", "any", "dependencies", "with", "the", "specified", "name", "in", "its", "dependencies", "list", "or", "in", "target", "dependencies", "for", "the", "specified", "target" ]
python
valid
48.692308
zimeon/iiif
iiif/auth_google.py
https://github.com/zimeon/iiif/blob/9d10018d01202fa2a76dfa61598dc6eca07b471f/iiif/auth_google.py#L84-L100
def google_get_token(self, config, prefix): """Make request to Google API to get token.""" params = { 'code': self.request_args_get( 'code', default=''), 'client_id': self.google_api_client_id, 'client_secret': self.google_api_client_se...
[ "def", "google_get_token", "(", "self", ",", "config", ",", "prefix", ")", ":", "params", "=", "{", "'code'", ":", "self", ".", "request_args_get", "(", "'code'", ",", "default", "=", "''", ")", ",", "'client_id'", ":", "self", ".", "google_api_client_id",...
Make request to Google API to get token.
[ "Make", "request", "to", "Google", "API", "to", "get", "token", "." ]
python
train
42.352941
swharden/PyOriginTools
PyOriginTools/highlevel.py
https://github.com/swharden/PyOriginTools/blob/536fb8e11234ffdc27e26b1800e0358179ca7d26/PyOriginTools/highlevel.py#L227-L254
def getSheet(book=None,sheet=None): """returns the pyorigin object for a sheet.""" # figure out what book to use if book and not book.lower() in [x.lower() for x in bookNames()]: print("book %s doesn't exist"%book) return if book is None: book=activeBook().lower() if book is...
[ "def", "getSheet", "(", "book", "=", "None", ",", "sheet", "=", "None", ")", ":", "# figure out what book to use", "if", "book", "and", "not", "book", ".", "lower", "(", ")", "in", "[", "x", ".", "lower", "(", ")", "for", "x", "in", "bookNames", "(",...
returns the pyorigin object for a sheet.
[ "returns", "the", "pyorigin", "object", "for", "a", "sheet", "." ]
python
train
31.714286
saltstack/salt
salt/cloud/clouds/linode.py
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/linode.py#L676-L701
def create_data_disk(vm_=None, linode_id=None, data_size=None): r''' Create a data disk for the linode (type is hardcoded to ext4 at the moment) .. versionadded:: 2016.3.0 vm\_ The VM profile to create the data disk for. linode_id The ID of the Linode to create the data disk for. ...
[ "def", "create_data_disk", "(", "vm_", "=", "None", ",", "linode_id", "=", "None", ",", "data_size", "=", "None", ")", ":", "kwargs", "=", "{", "}", "kwargs", ".", "update", "(", "{", "'LinodeID'", ":", "linode_id", ",", "'Label'", ":", "vm_", "[", "...
r''' Create a data disk for the linode (type is hardcoded to ext4 at the moment) .. versionadded:: 2016.3.0 vm\_ The VM profile to create the data disk for. linode_id The ID of the Linode to create the data disk for. data_size The size of the disk, in MB.
[ "r", "Create", "a", "data", "disk", "for", "the", "linode", "(", "type", "is", "hardcoded", "to", "ext4", "at", "the", "moment", ")" ]
python
train
24.846154
GPflow/GPflow
gpflow/params/parameter.py
https://github.com/GPflow/GPflow/blob/549394f0b1b0696c7b521a065e49bdae6e7acf27/gpflow/params/parameter.py#L403-L421
def _build_prior(self, unconstrained_tensor, constrained_tensor): """ Build a tensorflow representation of the prior density. The log Jacobian is included. """ if not misc.is_tensor(unconstrained_tensor): raise GPflowError("Unconstrained input must be a tensor.") ...
[ "def", "_build_prior", "(", "self", ",", "unconstrained_tensor", ",", "constrained_tensor", ")", ":", "if", "not", "misc", ".", "is_tensor", "(", "unconstrained_tensor", ")", ":", "raise", "GPflowError", "(", "\"Unconstrained input must be a tensor.\"", ")", "if", "...
Build a tensorflow representation of the prior density. The log Jacobian is included.
[ "Build", "a", "tensorflow", "representation", "of", "the", "prior", "density", ".", "The", "log", "Jacobian", "is", "included", "." ]
python
train
40.263158
apetrynet/pyfilemail
pyfilemail/users.py
https://github.com/apetrynet/pyfilemail/blob/eb81b0e69ff42f4335d5298833e4769b750bf397/pyfilemail/users.py#L135-L160
def get_sent(self, expired=False, for_all=False): """Retreve information on previously sent transfers. :param expired: Whether or not to return expired transfers. :param for_all: Get transfers for all users. Requires a Filemail Business account. :type for_all: bool :typ...
[ "def", "get_sent", "(", "self", ",", "expired", "=", "False", ",", "for_all", "=", "False", ")", ":", "method", ",", "url", "=", "get_URL", "(", "'get_sent'", ")", "payload", "=", "{", "'apikey'", ":", "self", ".", "session", ".", "cookies", ".", "ge...
Retreve information on previously sent transfers. :param expired: Whether or not to return expired transfers. :param for_all: Get transfers for all users. Requires a Filemail Business account. :type for_all: bool :type expired: bool :rtype: ``list`` of :class:`pyfilemai...
[ "Retreve", "information", "on", "previously", "sent", "transfers", "." ]
python
train
32.461538
mickybart/python-atlasbroker
atlasbroker/serviceinstance.py
https://github.com/mickybart/python-atlasbroker/blob/5b741c1348a6d33b342e0852a8a8900fa9ebf00a/atlasbroker/serviceinstance.py#L35-L48
def find(self, instance_id): """ find an instance Create a new instance and populate it with data stored if it exists. Args: instance_id (str): UUID of the instance Returns: AtlasServiceInstance.Instance: An instance """ ...
[ "def", "find", "(", "self", ",", "instance_id", ")", ":", "instance", "=", "AtlasServiceInstance", ".", "Instance", "(", "instance_id", ",", "self", ".", "backend", ")", "self", ".", "backend", ".", "storage", ".", "populate", "(", "instance", ")", "return...
find an instance Create a new instance and populate it with data stored if it exists. Args: instance_id (str): UUID of the instance Returns: AtlasServiceInstance.Instance: An instance
[ "find", "an", "instance", "Create", "a", "new", "instance", "and", "populate", "it", "with", "data", "stored", "if", "it", "exists", ".", "Args", ":", "instance_id", "(", "str", ")", ":", "UUID", "of", "the", "instance", "Returns", ":", "AtlasServiceInstan...
python
train
31.857143
aiogram/aiogram
aiogram/types/message.py
https://github.com/aiogram/aiogram/blob/2af930149ce2482547721e2c8755c10307295e48/aiogram/types/message.py#L331-L374
async def answer_audio(self, audio: typing.Union[base.InputFile, base.String], caption: typing.Union[base.String, None] = None, duration: typing.Union[base.Integer, None] = None, performer: typing.Union[base.String, None] = None, ...
[ "async", "def", "answer_audio", "(", "self", ",", "audio", ":", "typing", ".", "Union", "[", "base", ".", "InputFile", ",", "base", ".", "String", "]", ",", "caption", ":", "typing", ".", "Union", "[", "base", ".", "String", ",", "None", "]", "=", ...
Use this method to send audio files, if you want Telegram clients to display them in the music player. Your audio must be in the .mp3 format. For sending voice messages, use the sendVoice method instead. Source: https://core.telegram.org/bots/api#sendaudio :param audio: Audio file to ...
[ "Use", "this", "method", "to", "send", "audio", "files", "if", "you", "want", "Telegram", "clients", "to", "display", "them", "in", "the", "music", "player", ".", "Your", "audio", "must", "be", "in", "the", ".", "mp3", "format", "." ]
python
train
57.954545
OSSOS/MOP
src/ossos/core/ossos/naming.py
https://github.com/OSSOS/MOP/blob/94f91d32ad5ec081d5a1ebd67604a838003465af/src/ossos/core/ossos/naming.py#L9-L25
def _generate_provisional_name(q, astrom_header, fits_header): """ Generates a name for an object given the information in its astrom observation header and FITS header. :param q: a queue of provisional names to return. :type q: Queue :param astrom_header: :param fits_header: """ whi...
[ "def", "_generate_provisional_name", "(", "q", ",", "astrom_header", ",", "fits_header", ")", ":", "while", "True", ":", "ef", "=", "get_epoch_field", "(", "astrom_header", ",", "fits_header", ")", "epoch_field", "=", "ef", "[", "0", "]", "+", "ef", "[", "...
Generates a name for an object given the information in its astrom observation header and FITS header. :param q: a queue of provisional names to return. :type q: Queue :param astrom_header: :param fits_header:
[ "Generates", "a", "name", "for", "an", "object", "given", "the", "information", "in", "its", "astrom", "observation", "header", "and", "FITS", "header", ".", ":", "param", "q", ":", "a", "queue", "of", "provisional", "names", "to", "return", ".", ":", "t...
python
train
33.235294
dgketchum/satellite_image
sat_image/fmask.py
https://github.com/dgketchum/satellite_image/blob/0207fbb7b2bbf14f4307db65489bb4d4c5b92f52/sat_image/fmask.py#L347-L363
def land_temp_prob(self, tlow, thigh): """Temperature-based probability of cloud over land Equation 14 (Zhu and Woodcock, 2012) Parameters ---------- tirs1: ndarray tlow: float Low (17.5 percentile) temperature of land thigh: float High (82...
[ "def", "land_temp_prob", "(", "self", ",", "tlow", ",", "thigh", ")", ":", "temp_diff", "=", "4", "# degrees", "return", "(", "thigh", "+", "temp_diff", "-", "self", ".", "tirs1", ")", "/", "(", "thigh", "+", "4", "-", "(", "tlow", "-", "4", ")", ...
Temperature-based probability of cloud over land Equation 14 (Zhu and Woodcock, 2012) Parameters ---------- tirs1: ndarray tlow: float Low (17.5 percentile) temperature of land thigh: float High (82.5 percentile) temperature of land Output ...
[ "Temperature", "-", "based", "probability", "of", "cloud", "over", "land", "Equation", "14", "(", "Zhu", "and", "Woodcock", "2012", ")", "Parameters", "----------", "tirs1", ":", "ndarray", "tlow", ":", "float", "Low", "(", "17", ".", "5", "percentile", ")...
python
train
33.529412
rdireen/spherepy
spherepy/spherepy.py
https://github.com/rdireen/spherepy/blob/241521401d4d76851d4a1a564a365cfab8e98496/spherepy/spherepy.py#L1235-L1243
def single_val(self): """return relative error of worst point that might make the data none symmetric. """ sv_t = self._sv(self._tdsphere) sv_p = self._sv(self._tdsphere) return (sv_t, sv_p)
[ "def", "single_val", "(", "self", ")", ":", "sv_t", "=", "self", ".", "_sv", "(", "self", ".", "_tdsphere", ")", "sv_p", "=", "self", ".", "_sv", "(", "self", ".", "_tdsphere", ")", "return", "(", "sv_t", ",", "sv_p", ")" ]
return relative error of worst point that might make the data none symmetric.
[ "return", "relative", "error", "of", "worst", "point", "that", "might", "make", "the", "data", "none", "symmetric", "." ]
python
train
28.444444
mcs07/ChemDataExtractor
chemdataextractor/cli/evaluate.py
https://github.com/mcs07/ChemDataExtractor/blob/349a3bea965f2073141d62043b89319222e46af1/chemdataextractor/cli/evaluate.py#L75-L80
def get_names(cs): """Return list of every name.""" records = [] for c in cs: records.extend(c.get('names', [])) return records
[ "def", "get_names", "(", "cs", ")", ":", "records", "=", "[", "]", "for", "c", "in", "cs", ":", "records", ".", "extend", "(", "c", ".", "get", "(", "'names'", ",", "[", "]", ")", ")", "return", "records" ]
Return list of every name.
[ "Return", "list", "of", "every", "name", "." ]
python
train
24.333333
nigma/django-easy-pdf
easy_pdf/rendering.py
https://github.com/nigma/django-easy-pdf/blob/327605b91a445b453d8969b341ef74b12ab00a83/easy_pdf/rendering.py#L51-L78
def html_to_pdf(content, encoding="utf-8", link_callback=fetch_resources, **kwargs): """ Converts html ``content`` into PDF document. :param unicode content: html content :returns: PDF content :rtype: :class:`bytes` :raises: :exc:`~easy_pdf.exceptions.PDFRenderingError` """ ...
[ "def", "html_to_pdf", "(", "content", ",", "encoding", "=", "\"utf-8\"", ",", "link_callback", "=", "fetch_resources", ",", "*", "*", "kwargs", ")", ":", "src", "=", "BytesIO", "(", "content", ".", "encode", "(", "encoding", ")", ")", "dest", "=", "Bytes...
Converts html ``content`` into PDF document. :param unicode content: html content :returns: PDF content :rtype: :class:`bytes` :raises: :exc:`~easy_pdf.exceptions.PDFRenderingError`
[ "Converts", "html", "content", "into", "PDF", "document", "." ]
python
train
37.642857
marrow/util
marrow/util/object.py
https://github.com/marrow/util/blob/abb8163dbd1fa0692d42a44d129b12ae2b39cdf2/marrow/util/object.py#L68-L95
def load_object(target, namespace=None): """This helper function loads an object identified by a dotted-notation string. For example: # Load class Foo from example.objects load_object('example.objects:Foo') If a plugin namespace is provided simple name references are allowed. For example...
[ "def", "load_object", "(", "target", ",", "namespace", "=", "None", ")", ":", "if", "namespace", "and", "':'", "not", "in", "target", ":", "allowable", "=", "dict", "(", "(", "i", ".", "name", ",", "i", ")", "for", "i", "in", "pkg_resources", ".", ...
This helper function loads an object identified by a dotted-notation string. For example: # Load class Foo from example.objects load_object('example.objects:Foo') If a plugin namespace is provided simple name references are allowed. For example: # Load the plugin named 'routing' fro...
[ "This", "helper", "function", "loads", "an", "object", "identified", "by", "a", "dotted", "-", "notation", "string", "." ]
python
train
37.928571
CalebBell/ht
ht/conv_external.py
https://github.com/CalebBell/ht/blob/3097ef9524c4cf0068ad453c17b10ec9ce551eee/ht/conv_external.py#L292-L343
def Nu_cylinder_Whitaker(Re, Pr, mu=None, muw=None): r'''Calculates Nusselt number for crossflow across a single tube as shown in [1]_ at a specified `Re` and `Pr`, both evaluated at the free stream temperature. Recommends a viscosity exponent correction of 0.25, which is applied only if provided. Also ...
[ "def", "Nu_cylinder_Whitaker", "(", "Re", ",", "Pr", ",", "mu", "=", "None", ",", "muw", "=", "None", ")", ":", "Nu", "=", "(", "0.4", "*", "Re", "**", "0.5", "+", "0.06", "*", "Re", "**", "(", "2", "/", "3.", ")", ")", "*", "Pr", "**", "0....
r'''Calculates Nusselt number for crossflow across a single tube as shown in [1]_ at a specified `Re` and `Pr`, both evaluated at the free stream temperature. Recommends a viscosity exponent correction of 0.25, which is applied only if provided. Also shown in [2]_. .. math:: Nu_D = (0.4 Re_D^{0...
[ "r", "Calculates", "Nusselt", "number", "for", "crossflow", "across", "a", "single", "tube", "as", "shown", "in", "[", "1", "]", "_", "at", "a", "specified", "Re", "and", "Pr", "both", "evaluated", "at", "the", "free", "stream", "temperature", ".", "Reco...
python
train
36.211538
DataONEorg/d1_python
gmn/src/d1_gmn/app/sciobj_store.py
https://github.com/DataONEorg/d1_python/blob/3ac4d4f3ca052d3e8641a6a329cab526c8ddcb0d/gmn/src/d1_gmn/app/sciobj_store.py#L74-L87
def open_sciobj_file_by_pid_ctx(pid, write=False): """Open the file containing the Science Object bytes of ``pid`` in the default location within the tree of the local SciObj store. If ``write`` is True, the file is opened for writing and any missing directories are created. Return the file handle and ...
[ "def", "open_sciobj_file_by_pid_ctx", "(", "pid", ",", "write", "=", "False", ")", ":", "abs_path", "=", "get_abs_sciobj_file_path_by_pid", "(", "pid", ")", "with", "open_sciobj_file_by_path_ctx", "(", "abs_path", ",", "write", ")", "as", "sciobj_file", ":", "yiel...
Open the file containing the Science Object bytes of ``pid`` in the default location within the tree of the local SciObj store. If ``write`` is True, the file is opened for writing and any missing directories are created. Return the file handle and file_url with the file location in a suitable form for...
[ "Open", "the", "file", "containing", "the", "Science", "Object", "bytes", "of", "pid", "in", "the", "default", "location", "within", "the", "tree", "of", "the", "local", "SciObj", "store", "." ]
python
train
42.714286
numenta/nupic.core
bindings/py/setup.py
https://github.com/numenta/nupic.core/blob/333290c32403ce11e7117f826a6348c3a8e6c125/bindings/py/setup.py#L91-L102
def findRequirements(platform): """ Read the requirements.txt file and parse into requirements for setup's install_requirements option. """ includePycapnp = platform not in WINDOWS_PLATFORMS requirementsPath = fixPath(os.path.join(PY_BINDINGS, "requirements.txt")) return [ line.strip() for line in...
[ "def", "findRequirements", "(", "platform", ")", ":", "includePycapnp", "=", "platform", "not", "in", "WINDOWS_PLATFORMS", "requirementsPath", "=", "fixPath", "(", "os", ".", "path", ".", "join", "(", "PY_BINDINGS", ",", "\"requirements.txt\"", ")", ")", "return...
Read the requirements.txt file and parse into requirements for setup's install_requirements option.
[ "Read", "the", "requirements", ".", "txt", "file", "and", "parse", "into", "requirements", "for", "setup", "s", "install_requirements", "option", "." ]
python
train
36.25
materialsproject/pymatgen
pymatgen/io/vasp/outputs.py
https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/vasp/outputs.py#L2020-L2034
def read_elastic_tensor(self): """ Parse the elastic tensor data. Returns: 6x6 array corresponding to the elastic tensor from the OUTCAR. """ header_pattern = r"TOTAL ELASTIC MODULI \(kBar\)\s+" \ r"Direction\s+([X-Z][X-Z]\s+)+" \ ...
[ "def", "read_elastic_tensor", "(", "self", ")", ":", "header_pattern", "=", "r\"TOTAL ELASTIC MODULI \\(kBar\\)\\s+\"", "r\"Direction\\s+([X-Z][X-Z]\\s+)+\"", "r\"\\-+\"", "row_pattern", "=", "r\"[X-Z][X-Z]\\s+\"", "+", "r\"\\s+\"", ".", "join", "(", "[", "r\"(\\-*[\\.\\d]+)\...
Parse the elastic tensor data. Returns: 6x6 array corresponding to the elastic tensor from the OUTCAR.
[ "Parse", "the", "elastic", "tensor", "data", "." ]
python
train
42.066667
ArchiveTeam/wpull
wpull/application/tasks/network.py
https://github.com/ArchiveTeam/wpull/blob/ddf051aa3322479325ba20aa778cb2cb97606bf5/wpull/application/tasks/network.py#L24-L49
def _build_resolver(cls, session: AppSession): '''Build resolver.''' args = session.args dns_timeout = args.dns_timeout if args.timeout: dns_timeout = args.timeout if args.inet_family == 'IPv4': family = IPFamilyPreference.ipv4_only elif args.ine...
[ "def", "_build_resolver", "(", "cls", ",", "session", ":", "AppSession", ")", ":", "args", "=", "session", ".", "args", "dns_timeout", "=", "args", ".", "dns_timeout", "if", "args", ".", "timeout", ":", "dns_timeout", "=", "args", ".", "timeout", "if", "...
Build resolver.
[ "Build", "resolver", "." ]
python
train
33.692308
ianmiell/shutit
shutit_class.py
https://github.com/ianmiell/shutit/blob/19cd64cdfb23515b106b40213dccff4101617076/shutit_class.py#L1061-L1096
def send_file(self, path, contents, shutit_pexpect_child=None, truncate=False, note=None, user=None, echo=False, group=None, loglevel=logging.INFO, encoding=None): """S...
[ "def", "send_file", "(", "self", ",", "path", ",", "contents", ",", "shutit_pexpect_child", "=", "None", ",", "truncate", "=", "False", ",", "note", "=", "None", ",", "user", "=", "None", ",", "echo", "=", "False", ",", "group", "=", "None", ",", "lo...
Sends the passed-in string as a file to the passed-in path on the target. @param path: Target location of file on target. @param contents: Contents of file as a string. @param shutit_pexpect_child: See send() @param note: See send() @param user: Set ownership to this user (def...
[ "Sends", "the", "passed", "-", "in", "string", "as", "a", "file", "to", "the", "passed", "-", "in", "path", "on", "the", "target", "." ]
python
train
42.027778
mtien/PeptideBuilder
PeptideBuilder/PeptideBuilder.py
https://github.com/mtien/PeptideBuilder/blob/7b1ddab5199432c1aabc371a34ec42dd386dfa6f/PeptideBuilder/PeptideBuilder.py#L745-L804
def makePhe(segID, N, CA, C, O, geo): '''Creates a Phenylalanine residue''' ##R-Group CA_CB_length=geo.CA_CB_length C_CA_CB_angle=geo.C_CA_CB_angle N_C_CA_CB_diangle=geo.N_C_CA_CB_diangle CB_CG_length=geo.CB_CG_length CA_CB_CG_angle=geo.CA_CB_CG_angle N_CA_CB_CG_diangle=geo.N_CA_CB_...
[ "def", "makePhe", "(", "segID", ",", "N", ",", "CA", ",", "C", ",", "O", ",", "geo", ")", ":", "##R-Group", "CA_CB_length", "=", "geo", ".", "CA_CB_length", "C_CA_CB_angle", "=", "geo", ".", "C_CA_CB_angle", "N_C_CA_CB_diangle", "=", "geo", ".", "N_C_CA_...
Creates a Phenylalanine residue
[ "Creates", "a", "Phenylalanine", "residue" ]
python
train
39.116667
Murali-group/halp
halp/undirected_hypergraph.py
https://github.com/Murali-group/halp/blob/6eb27466ba84e2281e18f93b62aae5efb21ef8b3/halp/undirected_hypergraph.py#L821-L858
def write(self, file_name, delim=',', sep='\t'): """Writes an undirected hypergraph from a file, where nodes are represented as strings. Each column is separated by "sep", and the individual nodes are delimited by "delim". The header line is currently ignored, but columns should ...
[ "def", "write", "(", "self", ",", "file_name", ",", "delim", "=", "','", ",", "sep", "=", "'\\t'", ")", ":", "out_file", "=", "open", "(", "file_name", ",", "'w'", ")", "# write first header line", "out_file", ".", "write", "(", "\"nodes\"", "+", "sep", ...
Writes an undirected hypergraph from a file, where nodes are represented as strings. Each column is separated by "sep", and the individual nodes are delimited by "delim". The header line is currently ignored, but columns should be of the format: node1[delim]..nodeM[sep]no...
[ "Writes", "an", "undirected", "hypergraph", "from", "a", "file", "where", "nodes", "are", "represented", "as", "strings", ".", "Each", "column", "is", "separated", "by", "sep", "and", "the", "individual", "nodes", "are", "delimited", "by", "delim", ".", "The...
python
train
34.052632
robotframework/Rammbock
src/Rammbock/rammbock.py
https://github.com/robotframework/Rammbock/blob/c906058d055a6f7c68fe1a6096d78c2e3f642b1c/src/Rammbock/rammbock.py#L138-L145
def container(self, name, length, type, *parameters): """Define a container with given length. This is a convenience method creating a `Struct` with `length` containing fields defined in `type`. """ self.new_struct('Container', name, 'length=%s' % length) BuiltIn().run_keyword(t...
[ "def", "container", "(", "self", ",", "name", ",", "length", ",", "type", ",", "*", "parameters", ")", ":", "self", ".", "new_struct", "(", "'Container'", ",", "name", ",", "'length=%s'", "%", "length", ")", "BuiltIn", "(", ")", ".", "run_keyword", "("...
Define a container with given length. This is a convenience method creating a `Struct` with `length` containing fields defined in `type`.
[ "Define", "a", "container", "with", "given", "length", "." ]
python
train
44.5
jfilter/text-classification-keras
texcla/corpus.py
https://github.com/jfilter/text-classification-keras/blob/a59c652805da41d18937c7fdad0d9fd943cf8578/texcla/corpus.py#L8-L22
def read_folder(directory): """read text files in directory and returns them as array Args: directory: where the text files are Returns: Array of text """ res = [] for filename in os.listdir(directory): with io.open(os.path.join(directory, filename), encoding="utf-8") a...
[ "def", "read_folder", "(", "directory", ")", ":", "res", "=", "[", "]", "for", "filename", "in", "os", ".", "listdir", "(", "directory", ")", ":", "with", "io", ".", "open", "(", "os", ".", "path", ".", "join", "(", "directory", ",", "filename", ")...
read text files in directory and returns them as array Args: directory: where the text files are Returns: Array of text
[ "read", "text", "files", "in", "directory", "and", "returns", "them", "as", "array" ]
python
train
25.866667
lrq3000/pyFileFixity
pyFileFixity/lib/sortedcontainers/sorteddict.py
https://github.com/lrq3000/pyFileFixity/blob/fd5ef23bb13835faf1e3baa773619b86a1cc9bdf/pyFileFixity/lib/sortedcontainers/sorteddict.py#L17-L27
def not26(func): """Function decorator for methods not implemented in Python 2.6.""" @wraps(func) def errfunc(*args, **kwargs): raise NotImplementedError if hexversion < 0x02070000: return errfunc else: return func
[ "def", "not26", "(", "func", ")", ":", "@", "wraps", "(", "func", ")", "def", "errfunc", "(", "*", "args", ",", "*", "*", "kwargs", ")", ":", "raise", "NotImplementedError", "if", "hexversion", "<", "0x02070000", ":", "return", "errfunc", "else", ":", ...
Function decorator for methods not implemented in Python 2.6.
[ "Function", "decorator", "for", "methods", "not", "implemented", "in", "Python", "2", ".", "6", "." ]
python
train
22.727273
Parsl/libsubmit
libsubmit/providers/kubernetes/kube.py
https://github.com/Parsl/libsubmit/blob/27a41c16dd6f1c16d830a9ce1c97804920a59f64/libsubmit/providers/kubernetes/kube.py#L125-L142
def cancel(self, job_ids): """ Cancels the jobs specified by a list of job ids Args: job_ids : [<job_id> ...] Returns : [True/False...] : If the cancel operation fails the entire list will be False. """ for job in job_ids: logger.debug("Terminating j...
[ "def", "cancel", "(", "self", ",", "job_ids", ")", ":", "for", "job", "in", "job_ids", ":", "logger", ".", "debug", "(", "\"Terminating job/proc_id : {0}\"", ".", "format", "(", "job", ")", ")", "# Here we are assuming that for local, the job_ids are the process id's"...
Cancels the jobs specified by a list of job ids Args: job_ids : [<job_id> ...] Returns : [True/False...] : If the cancel operation fails the entire list will be False.
[ "Cancels", "the", "jobs", "specified", "by", "a", "list", "of", "job", "ids" ]
python
train
31.944444
brean/python-pathfinding
pathfinding/core/util.py
https://github.com/brean/python-pathfinding/blob/b857bf85e514a1712b40e29ccb5a473cd7fd5c80/pathfinding/core/util.py#L10-L20
def backtrace(node): """ Backtrace according to the parent records and return the path. (including both start and end nodes) """ path = [(node.x, node.y)] while node.parent: node = node.parent path.append((node.x, node.y)) path.reverse() return path
[ "def", "backtrace", "(", "node", ")", ":", "path", "=", "[", "(", "node", ".", "x", ",", "node", ".", "y", ")", "]", "while", "node", ".", "parent", ":", "node", "=", "node", ".", "parent", "path", ".", "append", "(", "(", "node", ".", "x", "...
Backtrace according to the parent records and return the path. (including both start and end nodes)
[ "Backtrace", "according", "to", "the", "parent", "records", "and", "return", "the", "path", ".", "(", "including", "both", "start", "and", "end", "nodes", ")" ]
python
train
26.090909
laf/russound
russound/russound.py
https://github.com/laf/russound/blob/683af823f78ad02111f9966dc7b535dd66a1f083/russound/russound.py#L194-L200
def get_volume(self, controller, zone): """ Gets the volume level which needs to be doubled to get it to the range of 0..100 - it is located on a 2 byte offset """ volume_level = self.get_zone_info(controller, zone, 2) if volume_level is not None: volume_level *= 2 re...
[ "def", "get_volume", "(", "self", ",", "controller", ",", "zone", ")", ":", "volume_level", "=", "self", ".", "get_zone_info", "(", "controller", ",", "zone", ",", "2", ")", "if", "volume_level", "is", "not", "None", ":", "volume_level", "*=", "2", "retu...
Gets the volume level which needs to be doubled to get it to the range of 0..100 - it is located on a 2 byte offset
[ "Gets", "the", "volume", "level", "which", "needs", "to", "be", "doubled", "to", "get", "it", "to", "the", "range", "of", "0", "..", "100", "-", "it", "is", "located", "on", "a", "2", "byte", "offset" ]
python
train
47.285714
abilian/abilian-core
abilian/web/util.py
https://github.com/abilian/abilian-core/blob/0a71275bf108c3d51e13ca9e093c0249235351e3/abilian/web/util.py#L39-L53
def send_file_from_directory(filename, directory, app=None): """Helper to add static rules, like in `abilian.app`.app. Example use:: app.add_url_rule( app.static_url_path + '/abilian/<path:filename>', endpoint='abilian_static', view_func=partial(send_file_from_directory, ...
[ "def", "send_file_from_directory", "(", "filename", ",", "directory", ",", "app", "=", "None", ")", ":", "if", "app", "is", "None", ":", "app", "=", "current_app", "cache_timeout", "=", "app", ".", "get_send_file_max_age", "(", "filename", ")", "return", "se...
Helper to add static rules, like in `abilian.app`.app. Example use:: app.add_url_rule( app.static_url_path + '/abilian/<path:filename>', endpoint='abilian_static', view_func=partial(send_file_from_directory, directory='/path/to/static/files/dir'))
[ "Helper", "to", "add", "static", "rules", "like", "in", "abilian", ".", "app", ".", "app", "." ]
python
train
37.533333
cloud9ers/gurumate
environment/share/doc/ipython/examples/parallel/wave2D/RectPartitioner.py
https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/share/doc/ipython/examples/parallel/wave2D/RectPartitioner.py#L298-L387
def update_internal_boundary_x_y (self, solution_array): """update the inner boundary with the same send/recv pattern as the MPIPartitioner""" nsd_ = self.nsd dtype = solution_array.dtype if nsd_!=len(self.in_lower_buffers) | nsd_!=len(self.out_lower_buffers): print("Buffers ...
[ "def", "update_internal_boundary_x_y", "(", "self", ",", "solution_array", ")", ":", "nsd_", "=", "self", ".", "nsd", "dtype", "=", "solution_array", ".", "dtype", "if", "nsd_", "!=", "len", "(", "self", ".", "in_lower_buffers", ")", "|", "nsd_", "!=", "le...
update the inner boundary with the same send/recv pattern as the MPIPartitioner
[ "update", "the", "inner", "boundary", "with", "the", "same", "send", "/", "recv", "pattern", "as", "the", "MPIPartitioner" ]
python
test
44.244444
diging/tethne
tethne/networks/helpers.py
https://github.com/diging/tethne/blob/ba10eeb264b7a3f2dbcce71cfd5cb2d6bbf7055f/tethne/networks/helpers.py#L149-L184
def top_parents(papers, topn=20, verbose=False): """ Returns a list of :class:`.Paper` that cite the topn most cited papers. Parameters ---------- papers : list A list of :class:`.Paper` objects. topn : int or float {0.-1.} Number (int) or percentage (float) of top-cited papers....
[ "def", "top_parents", "(", "papers", ",", "topn", "=", "20", ",", "verbose", "=", "False", ")", ":", "if", "verbose", ":", "print", "\"Getting parents of top \"", "+", "unicode", "(", "topn", ")", "+", "\" most cited papers.\"", "top", ",", "counts", "=", ...
Returns a list of :class:`.Paper` that cite the topn most cited papers. Parameters ---------- papers : list A list of :class:`.Paper` objects. topn : int or float {0.-1.} Number (int) or percentage (float) of top-cited papers. verbose : bool If True, prints status messages. ...
[ "Returns", "a", "list", "of", ":", "class", ":", ".", "Paper", "that", "cite", "the", "topn", "most", "cited", "papers", "." ]
python
train
29.722222
thunder-project/thunder
thunder/images/writers.py
https://github.com/thunder-project/thunder/blob/967ff8f3e7c2fabe1705743d95eb2746d4329786/thunder/images/writers.py#L4-L29
def topng(images, path, prefix="image", overwrite=False, credentials=None): """ Write out PNG files for 2d image data. See also -------- thunder.data.images.topng """ value_shape = images.value_shape if not len(value_shape) in [2, 3]: raise ValueError("Only 2D or 3D images can b...
[ "def", "topng", "(", "images", ",", "path", ",", "prefix", "=", "\"image\"", ",", "overwrite", "=", "False", ",", "credentials", "=", "None", ")", ":", "value_shape", "=", "images", ".", "value_shape", "if", "not", "len", "(", "value_shape", ")", "in", ...
Write out PNG files for 2d image data. See also -------- thunder.data.images.topng
[ "Write", "out", "PNG", "files", "for", "2d", "image", "data", "." ]
python
train
32.961538
jpype-project/jpype
jpype/_core.py
https://github.com/jpype-project/jpype/blob/3ce953ae7b35244077249ce650b9acd0a7010d17/jpype/_core.py#L70-L112
def startJVM(jvm=None, *args, **kwargs): """ Starts a Java Virtual Machine. Without options it will start the JVM with the default classpath and jvm. The default classpath will be determined by jpype.getClassPath(). The default JVM is determined by jpype.getDefaultJVMPath(). Args: jvm...
[ "def", "startJVM", "(", "jvm", "=", "None", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "if", "jvm", "is", "None", ":", "jvm", "=", "get_default_jvm_path", "(", ")", "# Check to see that the user has not set the classpath", "# Otherwise use the default if...
Starts a Java Virtual Machine. Without options it will start the JVM with the default classpath and jvm. The default classpath will be determined by jpype.getClassPath(). The default JVM is determined by jpype.getDefaultJVMPath(). Args: jvm (str): Path to the jvm library file (libjvm.so, jvm...
[ "Starts", "a", "Java", "Virtual", "Machine", ".", "Without", "options", "it", "will", "start", "the", "JVM", "with", "the", "default", "classpath", "and", "jvm", ".", "The", "default", "classpath", "will", "be", "determined", "by", "jpype", ".", "getClassPat...
python
train
36.837209
subdownloader/subdownloader
subdownloader/client/gui/splashScreen.py
https://github.com/subdownloader/subdownloader/blob/bbccedd11b18d925ad4c062b5eb65981e24d0433/subdownloader/client/gui/splashScreen.py#L22-L29
def showMessage(self, message, *args): """ Public method to show a message in the bottom part of the splashscreen. @param message message to be shown (string or QString) """ QSplashScreen.showMessage( self, message, Qt.AlignBottom | Qt.AlignRight | Qt.AlignAbsolute, ...
[ "def", "showMessage", "(", "self", ",", "message", ",", "*", "args", ")", ":", "QSplashScreen", ".", "showMessage", "(", "self", ",", "message", ",", "Qt", ".", "AlignBottom", "|", "Qt", ".", "AlignRight", "|", "Qt", ".", "AlignAbsolute", ",", "QColor", ...
Public method to show a message in the bottom part of the splashscreen. @param message message to be shown (string or QString)
[ "Public", "method", "to", "show", "a", "message", "in", "the", "bottom", "part", "of", "the", "splashscreen", "." ]
python
train
41.25
pyinvoke/invocations
invocations/travis.py
https://github.com/pyinvoke/invocations/blob/bbf1b319bd1536817d5301ceb9eeb2f31830e5dc/invocations/travis.py#L55-L68
def make_sshable(c): """ Set up passwordless SSH keypair & authorized_hosts access to localhost. """ user = c.travis.sudo.user home = "~{0}".format(user) # Run sudo() as the new sudo user; means less chown'ing, etc. c.config.sudo.user = user ssh_dir = "{0}/.ssh".format(home) # TODO: ...
[ "def", "make_sshable", "(", "c", ")", ":", "user", "=", "c", ".", "travis", ".", "sudo", ".", "user", "home", "=", "\"~{0}\"", ".", "format", "(", "user", ")", "# Run sudo() as the new sudo user; means less chown'ing, etc.", "c", ".", "config", ".", "sudo", ...
Set up passwordless SSH keypair & authorized_hosts access to localhost.
[ "Set", "up", "passwordless", "SSH", "keypair", "&", "authorized_hosts", "access", "to", "localhost", "." ]
python
train
42.071429
opengridcc/opengrid
opengrid/library/weather.py
https://github.com/opengridcc/opengrid/blob/69b8da3c8fcea9300226c45ef0628cd6d4307651/opengrid/library/weather.py#L12-L28
def calculate_temperature_equivalent(temperatures): """ Calculates the temperature equivalent from a series of average daily temperatures according to the formula: 0.6 * tempDay0 + 0.3 * tempDay-1 + 0.1 * tempDay-2 Parameters ---------- series : Pandas Series Returns ------- Pandas...
[ "def", "calculate_temperature_equivalent", "(", "temperatures", ")", ":", "ret", "=", "0.6", "*", "temperatures", "+", "0.3", "*", "temperatures", ".", "shift", "(", "1", ")", "+", "0.1", "*", "temperatures", ".", "shift", "(", "2", ")", "ret", ".", "nam...
Calculates the temperature equivalent from a series of average daily temperatures according to the formula: 0.6 * tempDay0 + 0.3 * tempDay-1 + 0.1 * tempDay-2 Parameters ---------- series : Pandas Series Returns ------- Pandas Series
[ "Calculates", "the", "temperature", "equivalent", "from", "a", "series", "of", "average", "daily", "temperatures", "according", "to", "the", "formula", ":", "0", ".", "6", "*", "tempDay0", "+", "0", ".", "3", "*", "tempDay", "-", "1", "+", "0", ".", "1...
python
train
26.529412
fitnr/twitter_bot_utils
twitter_bot_utils/confighelper.py
https://github.com/fitnr/twitter_bot_utils/blob/21f35afa5048cd3efa54db8cb87d405f69a78a62/twitter_bot_utils/confighelper.py#L43-L80
def configure(screen_name=None, config_file=None, app=None, **kwargs): """ Set up a config dictionary using a bots.yaml config file and optional keyword args. Args: screen_name (str): screen_name of user to search for in config file config_file (str): Path to read for the config file ...
[ "def", "configure", "(", "screen_name", "=", "None", ",", "config_file", "=", "None", ",", "app", "=", "None", ",", "*", "*", "kwargs", ")", ":", "# Use passed config file, or look for it in the default path.", "# Super-optionally, accept a different place to look for the f...
Set up a config dictionary using a bots.yaml config file and optional keyword args. Args: screen_name (str): screen_name of user to search for in config file config_file (str): Path to read for the config file app (str): Name of the app to look for in the config file. Defaults to the one se...
[ "Set", "up", "a", "config", "dictionary", "using", "a", "bots", ".", "yaml", "config", "file", "and", "optional", "keyword", "args", "." ]
python
train
44.578947
CalebBell/thermo
thermo/phase_change.py
https://github.com/CalebBell/thermo/blob/3857ed023a3e64fd3039a32d53576c24990ef1c3/thermo/phase_change.py#L199-L289
def Tm(CASRN, AvailableMethods=False, Method=None, IgnoreMethods=[]): r'''This function handles the retrieval of a chemical's melting point. Lookup is based on CASRNs. Will automatically select a data source to use if no Method is provided; returns None if the data is not available. Prefered source...
[ "def", "Tm", "(", "CASRN", ",", "AvailableMethods", "=", "False", ",", "Method", "=", "None", ",", "IgnoreMethods", "=", "[", "]", ")", ":", "def", "list_methods", "(", ")", ":", "methods", "=", "[", "]", "if", "CASRN", "in", "Tm_ON_data", ".", "inde...
r'''This function handles the retrieval of a chemical's melting point. Lookup is based on CASRNs. Will automatically select a data source to use if no Method is provided; returns None if the data is not available. Prefered sources are 'Open Notebook Melting Points', with backup sources 'CRC Physica...
[ "r", "This", "function", "handles", "the", "retrieval", "of", "a", "chemical", "s", "melting", "point", ".", "Lookup", "is", "based", "on", "CASRNs", ".", "Will", "automatically", "select", "a", "data", "source", "to", "use", "if", "no", "Method", "is", ...
python
valid
37.153846
wind-python/windpowerlib
windpowerlib/wind_turbine.py
https://github.com/wind-python/windpowerlib/blob/421b316139743311b7cb68a69f6b53d2665f7e23/windpowerlib/wind_turbine.py#L268-L334
def get_turbine_data_from_oedb(turbine_type, fetch_curve, overwrite=False): r""" Fetches data for one wind turbine type from the OpenEnergy Database (oedb). If turbine data exists in local repository it is loaded from this file. The file is created when turbine data was loaded from oedb in :py:func...
[ "def", "get_turbine_data_from_oedb", "(", "turbine_type", ",", "fetch_curve", ",", "overwrite", "=", "False", ")", ":", "# hdf5 filename", "filename", "=", "os", ".", "path", ".", "join", "(", "os", ".", "path", ".", "dirname", "(", "__file__", ")", ",", "...
r""" Fetches data for one wind turbine type from the OpenEnergy Database (oedb). If turbine data exists in local repository it is loaded from this file. The file is created when turbine data was loaded from oedb in :py:func:`~.load_turbine_data_from_oedb`. Use this function with `overwrite=True` to...
[ "r", "Fetches", "data", "for", "one", "wind", "turbine", "type", "from", "the", "OpenEnergy", "Database", "(", "oedb", ")", "." ]
python
train
45.820896
diging/tethne
tethne/model/corpus/mallet.py
https://github.com/diging/tethne/blob/ba10eeb264b7a3f2dbcce71cfd5cb2d6bbf7055f/tethne/model/corpus/mallet.py#L347-L353
def topic_over_time(self, k, mode='counts', slice_kwargs={}): """ Calculate the representation of topic ``k`` in the corpus over time. """ return self.corpus.feature_distribution('topics', k, mode=mode, **slice_kwargs)
[ "def", "topic_over_time", "(", "self", ",", "k", ",", "mode", "=", "'counts'", ",", "slice_kwargs", "=", "{", "}", ")", ":", "return", "self", ".", "corpus", ".", "feature_distribution", "(", "'topics'", ",", "k", ",", "mode", "=", "mode", ",", "*", ...
Calculate the representation of topic ``k`` in the corpus over time.
[ "Calculate", "the", "representation", "of", "topic", "k", "in", "the", "corpus", "over", "time", "." ]
python
train
41.857143
GNS3/gns3-server
gns3server/utils/asyncio/telnet_server.py
https://github.com/GNS3/gns3-server/blob/a221678448fb5d24e977ef562f81d56aacc89ab1/gns3server/utils/asyncio/telnet_server.py#L223-L234
def _get_reader(self, network_reader): """ Get a reader or None if another reader is already reading. """ with (yield from self._lock): if self._reader_process is None: self._reader_process = network_reader if self._reader: if self....
[ "def", "_get_reader", "(", "self", ",", "network_reader", ")", ":", "with", "(", "yield", "from", "self", ".", "_lock", ")", ":", "if", "self", ".", "_reader_process", "is", "None", ":", "self", ".", "_reader_process", "=", "network_reader", "if", "self", ...
Get a reader or None if another reader is already reading.
[ "Get", "a", "reader", "or", "None", "if", "another", "reader", "is", "already", "reading", "." ]
python
train
41.166667
readbeyond/aeneas
aeneas/adjustboundaryalgorithm.py
https://github.com/readbeyond/aeneas/blob/9d95535ad63eef4a98530cfdff033b8c35315ee1/aeneas/adjustboundaryalgorithm.py#L518-L532
def _adjust_beforenext(self, real_wave_mfcc, algo_parameters): """ BEFORENEXT """ def new_time(nsi): """ The new boundary time value is ``delay`` before the end of the nonspeech interval ``nsi``. If ``nsi`` has length less than ``delay``, ...
[ "def", "_adjust_beforenext", "(", "self", ",", "real_wave_mfcc", ",", "algo_parameters", ")", ":", "def", "new_time", "(", "nsi", ")", ":", "\"\"\"\n The new boundary time value is ``delay`` before\n the end of the nonspeech interval ``nsi``.\n If ``n...
BEFORENEXT
[ "BEFORENEXT" ]
python
train
40.333333
hazelcast/hazelcast-python-client
hazelcast/protocol/codec/map_is_locked_codec.py
https://github.com/hazelcast/hazelcast-python-client/blob/3f6639443c23d6d036aa343f8e094f052250d2c1/hazelcast/protocol/codec/map_is_locked_codec.py#L10-L15
def calculate_size(name, key): """ Calculates the request payload size""" data_size = 0 data_size += calculate_size_str(name) data_size += calculate_size_data(key) return data_size
[ "def", "calculate_size", "(", "name", ",", "key", ")", ":", "data_size", "=", "0", "data_size", "+=", "calculate_size_str", "(", "name", ")", "data_size", "+=", "calculate_size_data", "(", "key", ")", "return", "data_size" ]
Calculates the request payload size
[ "Calculates", "the", "request", "payload", "size" ]
python
train
32.5
materialsproject/pymatgen
pymatgen/core/periodic_table.py
https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/core/periodic_table.py#L1165-L1190
def from_string(species_string: str): """ Returns a Specie from a string representation. Args: species_string (str): A typical string representation of a species, e.g., "Mn2+", "Fe3+", "O2-". Returns: A Specie object. Raises: ...
[ "def", "from_string", "(", "species_string", ":", "str", ")", ":", "m", "=", "re", ".", "search", "(", "r\"([A-Z][a-z]*)([0-9.]*)([+\\-])(.*)\"", ",", "species_string", ")", "if", "m", ":", "sym", "=", "m", ".", "group", "(", "1", ")", "oxi", "=", "1", ...
Returns a Specie from a string representation. Args: species_string (str): A typical string representation of a species, e.g., "Mn2+", "Fe3+", "O2-". Returns: A Specie object. Raises: ValueError if species_string cannot be intepreted.
[ "Returns", "a", "Specie", "from", "a", "string", "representation", "." ]
python
train
34
abseil/abseil-py
absl/flags/_defines.py
https://github.com/abseil/abseil-py/blob/9d73fdaa23a6b6726aa5731390f388c0c6250ee5/absl/flags/_defines.py#L383-L405
def DEFINE_spaceseplist( # pylint: disable=invalid-name,redefined-builtin name, default, help, comma_compat=False, flag_values=_flagvalues.FLAGS, **args): """Registers a flag whose value is a whitespace-separated list of strings. Any whitespace can be used as a separator. Args: name: str, the flag ...
[ "def", "DEFINE_spaceseplist", "(", "# pylint: disable=invalid-name,redefined-builtin", "name", ",", "default", ",", "help", ",", "comma_compat", "=", "False", ",", "flag_values", "=", "_flagvalues", ".", "FLAGS", ",", "*", "*", "args", ")", ":", "parser", "=", "...
Registers a flag whose value is a whitespace-separated list of strings. Any whitespace can be used as a separator. Args: name: str, the flag name. default: list|str|None, the default value of the flag. help: str, the help message. comma_compat: bool - Whether to support comma as an additional sepa...
[ "Registers", "a", "flag", "whose", "value", "is", "a", "whitespace", "-", "separated", "list", "of", "strings", "." ]
python
train
47.434783
fastai/fastai
fastai/text/models/awd_lstm.py
https://github.com/fastai/fastai/blob/9fb84a5cdefe5a766cdb792b8f5d8971737b7e67/fastai/text/models/awd_lstm.py#L246-L268
def show_top_losses(self, k:int, max_len:int=70)->None: """ Create a tabulation showing the first `k` texts in top_losses along with their prediction, actual,loss, and probability of actual class. `max_len` is the maximum number of tokens displayed. """ from IPython.display impor...
[ "def", "show_top_losses", "(", "self", ",", "k", ":", "int", ",", "max_len", ":", "int", "=", "70", ")", "->", "None", ":", "from", "IPython", ".", "display", "import", "display", ",", "HTML", "items", "=", "[", "]", "tl_val", ",", "tl_idx", "=", "...
Create a tabulation showing the first `k` texts in top_losses along with their prediction, actual,loss, and probability of actual class. `max_len` is the maximum number of tokens displayed.
[ "Create", "a", "tabulation", "showing", "the", "first", "k", "texts", "in", "top_losses", "along", "with", "their", "prediction", "actual", "loss", "and", "probability", "of", "actual", "class", ".", "max_len", "is", "the", "maximum", "number", "of", "tokens",...
python
train
50.608696
user-cont/conu
conu/backend/origin/backend.py
https://github.com/user-cont/conu/blob/08caae7bb6bdd265b55bb106c3da6a7946a5a352/conu/backend/origin/backend.py#L266-L296
def request_service(self, app_name, port, expected_output=None): """ Make request on service of app. If there is connection error function return False. :param app_name: str, name of the app :param expected_output: str, If not None method will check output returned from request ...
[ "def", "request_service", "(", "self", ",", "app_name", ",", "port", ",", "expected_output", "=", "None", ")", ":", "# get ip of service", "ip", "=", "[", "service", ".", "get_ip", "(", ")", "for", "service", "in", "self", ".", "list_services", "(", "names...
Make request on service of app. If there is connection error function return False. :param app_name: str, name of the app :param expected_output: str, If not None method will check output returned from request and try to find matching string. :param port: str or int, port of the s...
[ "Make", "request", "on", "service", "of", "app", ".", "If", "there", "is", "connection", "error", "function", "return", "False", ".", ":", "param", "app_name", ":", "str", "name", "of", "the", "app", ":", "param", "expected_output", ":", "str", "If", "no...
python
train
45.387097
Capitains/MyCapytain
MyCapytain/common/utils/_json_ld.py
https://github.com/Capitains/MyCapytain/blob/b11bbf6b6ae141fc02be70471e3fbf6907be6593/MyCapytain/common/utils/_json_ld.py#L22-L28
def dict_to_literal(dict_container: dict): """ Transforms a JSON+LD PyLD dictionary into an RDFLib object""" if isinstance(dict_container["@value"], int): return dict_container["@value"], else: return dict_container["@value"], dict_container.get("@language", None)
[ "def", "dict_to_literal", "(", "dict_container", ":", "dict", ")", ":", "if", "isinstance", "(", "dict_container", "[", "\"@value\"", "]", ",", "int", ")", ":", "return", "dict_container", "[", "\"@value\"", "]", ",", "else", ":", "return", "dict_container", ...
Transforms a JSON+LD PyLD dictionary into an RDFLib object
[ "Transforms", "a", "JSON", "+", "LD", "PyLD", "dictionary", "into", "an", "RDFLib", "object" ]
python
train
41.428571
limpyd/redis-limpyd
limpyd/fields.py
https://github.com/limpyd/redis-limpyd/blob/3c745dde1390a0bd09690b77a089dcc08c6c7e43/limpyd/fields.py#L117-L135
def _traverse_command(self, name, *args, **kwargs): """ Add the key to the args and call the Redis command. """ if not name in self.available_commands: raise AttributeError("%s is not an available command for %s" % (name, self.__class__.__name...
[ "def", "_traverse_command", "(", "self", ",", "name", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "if", "not", "name", "in", "self", ".", "available_commands", ":", "raise", "AttributeError", "(", "\"%s is not an available command for %s\"", "%", "(",...
Add the key to the args and call the Redis command.
[ "Add", "the", "key", "to", "the", "args", "and", "call", "the", "Redis", "command", "." ]
python
train
36.736842
twilio/twilio-python
twilio/rest/preview/hosted_numbers/authorization_document/__init__.py
https://github.com/twilio/twilio-python/blob/c867895f55dcc29f522e6e8b8868d0d18483132f/twilio/rest/preview/hosted_numbers/authorization_document/__init__.py#L86-L115
def page(self, email=values.unset, status=values.unset, page_token=values.unset, page_number=values.unset, page_size=values.unset): """ Retrieve a single page of AuthorizationDocumentInstance records from the API. Request is executed immediately :param unicode email: Email....
[ "def", "page", "(", "self", ",", "email", "=", "values", ".", "unset", ",", "status", "=", "values", ".", "unset", ",", "page_token", "=", "values", ".", "unset", ",", "page_number", "=", "values", ".", "unset", ",", "page_size", "=", "values", ".", ...
Retrieve a single page of AuthorizationDocumentInstance records from the API. Request is executed immediately :param unicode email: Email. :param AuthorizationDocumentInstance.Status status: The Status of this AuthorizationDocument. :param str page_token: PageToken provided by the API ...
[ "Retrieve", "a", "single", "page", "of", "AuthorizationDocumentInstance", "records", "from", "the", "API", ".", "Request", "is", "executed", "immediately" ]
python
train
39.5
gwastro/pycbc
pycbc/events/eventmgr.py
https://github.com/gwastro/pycbc/blob/7a64cdd104d263f1b6ea0b01e6841837d05a4cb3/pycbc/events/eventmgr.py#L595-L601
def add_template_events_to_network(self, columns, vectors): """ Add a vector indexed """ # Just call through to the standard function self.template_events = self.template_event_dict['network'] self.add_template_network_events(columns, vectors) self.template_event_dict['network'] ...
[ "def", "add_template_events_to_network", "(", "self", ",", "columns", ",", "vectors", ")", ":", "# Just call through to the standard function", "self", ".", "template_events", "=", "self", ".", "template_event_dict", "[", "'network'", "]", "self", ".", "add_template_net...
Add a vector indexed
[ "Add", "a", "vector", "indexed" ]
python
train
53.142857
shi-cong/PYSTUDY
PYSTUDY/net/requestslib.py
https://github.com/shi-cong/PYSTUDY/blob/c8da7128ea18ecaa5849f2066d321e70d6f97f70/PYSTUDY/net/requestslib.py#L54-L64
def filter_duplicate(self, url): """ url去重 """ if self.filterDuplicate: if url in self.historys: raise Exception('duplicate excepiton: %s is duplicate' % url) else: self.historys.add(url) else: pass
[ "def", "filter_duplicate", "(", "self", ",", "url", ")", ":", "if", "self", ".", "filterDuplicate", ":", "if", "url", "in", "self", ".", "historys", ":", "raise", "Exception", "(", "'duplicate excepiton: %s is duplicate'", "%", "url", ")", "else", ":", "self...
url去重
[ "url去重" ]
python
train
27
blockcypher/blockcypher-python
blockcypher/api.py
https://github.com/blockcypher/blockcypher-python/blob/7601ea21916957ff279384fd699527ff9c28a56e/blockcypher/api.py#L817-L840
def get_forwarding_address_details(destination_address, api_key, callback_url=None, coin_symbol='btc'): """ Give a destination address and return the details of the input address that will automatically forward to the destination address Note: a blockcypher api_key is required for this method """ ...
[ "def", "get_forwarding_address_details", "(", "destination_address", ",", "api_key", ",", "callback_url", "=", "None", ",", "coin_symbol", "=", "'btc'", ")", ":", "assert", "is_valid_coin_symbol", "(", "coin_symbol", ")", "assert", "api_key", ",", "'api_key required'"...
Give a destination address and return the details of the input address that will automatically forward to the destination address Note: a blockcypher api_key is required for this method
[ "Give", "a", "destination", "address", "and", "return", "the", "details", "of", "the", "input", "address", "that", "will", "automatically", "forward", "to", "the", "destination", "address" ]
python
train
31
rbuffat/pyepw
pyepw/epw.py
https://github.com/rbuffat/pyepw/blob/373d4d3c8386c8d35789f086ac5f6018c2711745/pyepw/epw.py#L4371-L4392
def depth_december_average_ground_temperature(self, value=None): """Corresponds to IDD Field `depth_december_average_ground_temperature` Args: value (float): value for IDD Field `depth_december_average_ground_temperature` Unit: C if `value` is None it will no...
[ "def", "depth_december_average_ground_temperature", "(", "self", ",", "value", "=", "None", ")", ":", "if", "value", "is", "not", "None", ":", "try", ":", "value", "=", "float", "(", "value", ")", "except", "ValueError", ":", "raise", "ValueError", "(", "'...
Corresponds to IDD Field `depth_december_average_ground_temperature` Args: value (float): value for IDD Field `depth_december_average_ground_temperature` Unit: C if `value` is None it will not be checked against the specification and is assumed to be ...
[ "Corresponds", "to", "IDD", "Field", "depth_december_average_ground_temperature" ]
python
train
38.090909
LogicalDash/LiSE
ELiDE/ELiDE/card.py
https://github.com/LogicalDash/LiSE/blob/fe6fd4f0a7c1780e065f4c9babb9bc443af6bb84/ELiDE/ELiDE/card.py#L288-L336
def copy(self): """Return a new :class:`Card` just like me.""" d = {} for att in ( 'deck', 'idx', 'ud', 'foreground_source', 'foreground_color', 'foreground_image', 'foreground_texture...
[ "def", "copy", "(", "self", ")", ":", "d", "=", "{", "}", "for", "att", "in", "(", "'deck'", ",", "'idx'", ",", "'ud'", ",", "'foreground_source'", ",", "'foreground_color'", ",", "'foreground_image'", ",", "'foreground_texture'", ",", "'background_source'", ...
Return a new :class:`Card` just like me.
[ "Return", "a", "new", ":", "class", ":", "Card", "just", "like", "me", "." ]
python
train
30.755102
saltstack/salt
salt/cloud/clouds/msazure.py
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/msazure.py#L2879-L2955
def lease_storage_container(kwargs=None, storage_conn=None, call=None): ''' .. versionadded:: 2015.8.0 Lease a container associated with the storage account CLI Example: .. code-block:: bash salt-cloud -f lease_storage_container my-azure name=mycontainer name: Name of contai...
[ "def", "lease_storage_container", "(", "kwargs", "=", "None", ",", "storage_conn", "=", "None", ",", "call", "=", "None", ")", ":", "if", "call", "!=", "'function'", ":", "raise", "SaltCloudSystemExit", "(", "'The lease_storage_container function must be called with -...
.. versionadded:: 2015.8.0 Lease a container associated with the storage account CLI Example: .. code-block:: bash salt-cloud -f lease_storage_container my-azure name=mycontainer name: Name of container to create. lease_action: Required. Possible values: acquire|renew|re...
[ "..", "versionadded", "::", "2015", ".", "8", ".", "0" ]
python
train
38.61039
heuer/segno
segno/writers.py
https://github.com/heuer/segno/blob/64d912a2bd17d0b5ff3e8b5d37098edfc663c2b3/segno/writers.py#L197-L232
def as_svg_data_uri(matrix, version, scale=1, border=None, color='#000', background=None, xmldecl=False, svgns=True, title=None, desc=None, svgid=None, svgclass='segno', lineclass='qrline', omitsize=False, unit='', encoding='utf-8', svgvers...
[ "def", "as_svg_data_uri", "(", "matrix", ",", "version", ",", "scale", "=", "1", ",", "border", "=", "None", ",", "color", "=", "'#000'", ",", "background", "=", "None", ",", "xmldecl", "=", "False", ",", "svgns", "=", "True", ",", "title", "=", "Non...
\ Converts the matrix to a SVG data URI. The XML declaration is omitted by default (set ``xmldecl`` to ``True`` to enable it), further the newline is omitted by default (set ``nl`` to ``True`` to enable it). Aside from the missing ``out`` parameter and the different ``xmldecl`` and ``nl`` defa...
[ "\\", "Converts", "the", "matrix", "to", "a", "SVG", "data", "URI", "." ]
python
train
54.444444
arlyon/hyperion
hyperion/fetch/postcode.py
https://github.com/arlyon/hyperion/blob/d8de0388ba98b85ce472e0f49ac18fecb14d3343/hyperion/fetch/postcode.py#L61-L71
async def fetch_postcodes_from_coordinates(lat: float, long: float) -> Optional[List[Postcode]]: """ Gets a postcode object from the lat and long. :param lat: The latitude to look up. :param long: The longitude to look up. :return: The mapping corresponding to the lat and long or none if the postcod...
[ "async", "def", "fetch_postcodes_from_coordinates", "(", "lat", ":", "float", ",", "long", ":", "float", ")", "->", "Optional", "[", "List", "[", "Postcode", "]", "]", ":", "postcode_lookup", "=", "f\"/postcodes?lat={lat}&lon={long}\"", "return", "await", "_get_po...
Gets a postcode object from the lat and long. :param lat: The latitude to look up. :param long: The longitude to look up. :return: The mapping corresponding to the lat and long or none if the postcode does not exist. :raises ApiError: When there was an error connecting to the API. :raises CircuitBre...
[ "Gets", "a", "postcode", "object", "from", "the", "lat", "and", "long", ".", ":", "param", "lat", ":", "The", "latitude", "to", "look", "up", ".", ":", "param", "long", ":", "The", "longitude", "to", "look", "up", ".", ":", "return", ":", "The", "m...
python
test
53.181818
mattupstate/flask-security
flask_security/utils.py
https://github.com/mattupstate/flask-security/blob/a401fb47018fbbbe0b899ea55afadfd0e3cd847a/flask_security/utils.py#L63-L98
def login_user(user, remember=None): """Perform the login routine. If SECURITY_TRACKABLE is used, make sure you commit changes after this request (i.e. ``app.security.datastore.commit()``). :param user: The user to login :param remember: Flag specifying if the remember cookie should be set. ...
[ "def", "login_user", "(", "user", ",", "remember", "=", "None", ")", ":", "if", "remember", "is", "None", ":", "remember", "=", "config_value", "(", "'DEFAULT_REMEMBER_ME'", ")", "if", "not", "_login_user", "(", "user", ",", "remember", ")", ":", "# pragma...
Perform the login routine. If SECURITY_TRACKABLE is used, make sure you commit changes after this request (i.e. ``app.security.datastore.commit()``). :param user: The user to login :param remember: Flag specifying if the remember cookie should be set. Defaults to ``False``
[ "Perform", "the", "login", "routine", "." ]
python
train
34.5
getsentry/raven-python
raven/contrib/zerorpc/__init__.py
https://github.com/getsentry/raven-python/blob/d891c20f0f930153f508e9d698d9de42e910face/raven/contrib/zerorpc/__init__.py#L40-L69
def server_inspect_exception(self, req_event, rep_event, task_ctx, exc_info): """ Called when an exception has been raised in the code run by ZeroRPC """ # Hide the zerorpc internal frames for readability, for a REQ/REP or # REQ/STREAM server the frames to hide are: # - c...
[ "def", "server_inspect_exception", "(", "self", ",", "req_event", ",", "rep_event", ",", "task_ctx", ",", "exc_info", ")", ":", "# Hide the zerorpc internal frames for readability, for a REQ/REP or", "# REQ/STREAM server the frames to hide are:", "# - core.ServerBase._async_task", ...
Called when an exception has been raised in the code run by ZeroRPC
[ "Called", "when", "an", "exception", "has", "been", "raised", "in", "the", "code", "run", "by", "ZeroRPC" ]
python
train
42.8
koordinates/python-client
koordinates/publishing.py
https://github.com/koordinates/python-client/blob/f3dc7cd164f5a9499b2454cd1d4516e9d4b3c252/koordinates/publishing.py#L62-L76
def get_items(self): """ Return the item models associated with this Publish group. """ from .layers import Layer # no expansion support, just URLs results = [] for url in self.items: if '/layers/' in url: r = self._client.request('GET...
[ "def", "get_items", "(", "self", ")", ":", "from", ".", "layers", "import", "Layer", "# no expansion support, just URLs", "results", "=", "[", "]", "for", "url", "in", "self", ".", "items", ":", "if", "'/layers/'", "in", "url", ":", "r", "=", "self", "."...
Return the item models associated with this Publish group.
[ "Return", "the", "item", "models", "associated", "with", "this", "Publish", "group", "." ]
python
train
34.4
RealTimeWeb/datasets
preprocess/earthquakes/earthquakes.py
https://github.com/RealTimeWeb/datasets/blob/2fe5befd251c783744d000bd4763e277616a152f/preprocess/earthquakes/earthquakes.py#L62-L71
def _parse_boolean(value, default=False): """ Attempt to cast *value* into a bool, returning *default* if it fails. """ if value is None: return default try: return bool(value) except ValueError: return default
[ "def", "_parse_boolean", "(", "value", ",", "default", "=", "False", ")", ":", "if", "value", "is", "None", ":", "return", "default", "try", ":", "return", "bool", "(", "value", ")", "except", "ValueError", ":", "return", "default" ]
Attempt to cast *value* into a bool, returning *default* if it fails.
[ "Attempt", "to", "cast", "*", "value", "*", "into", "a", "bool", "returning", "*", "default", "*", "if", "it", "fails", "." ]
python
train
24.9
inasafe/inasafe
safe/gui/tools/minimum_needs/needs_manager_dialog.py
https://github.com/inasafe/inasafe/blob/831d60abba919f6d481dc94a8d988cc205130724/safe/gui/tools/minimum_needs/needs_manager_dialog.py#L286-L296
def load_profiles(self, overwrite=False): """Load the profiles into the dropdown list. :param overwrite: If we overwrite existing profiles from the plugin. :type overwrite: bool """ for profile in self.minimum_needs.get_profiles(overwrite): self.profile_combo.addItem...
[ "def", "load_profiles", "(", "self", ",", "overwrite", "=", "False", ")", ":", "for", "profile", "in", "self", ".", "minimum_needs", ".", "get_profiles", "(", "overwrite", ")", ":", "self", ".", "profile_combo", ".", "addItem", "(", "profile", ")", "minimu...
Load the profiles into the dropdown list. :param overwrite: If we overwrite existing profiles from the plugin. :type overwrite: bool
[ "Load", "the", "profiles", "into", "the", "dropdown", "list", "." ]
python
train
44.545455
JdeRobot/base
src/drivers/MAVLinkServer/MAVProxy/modules/mavproxy_smartcamera/__init__.py
https://github.com/JdeRobot/base/blob/303b18992785b2fe802212f2d758a60873007f1f/src/drivers/MAVLinkServer/MAVProxy/modules/mavproxy_smartcamera/__init__.py#L236-L245
def __vCmdSetCamAperture(self, args): '''ToDo: Validate CAM number and Valid Aperture Value''' if len(args) == 1: for cam in self.camera_list: cam.boSetAperture(int(args[0])) elif len(args) == 2: cam = self.camera_list[int(args[1])] cam.boSetAp...
[ "def", "__vCmdSetCamAperture", "(", "self", ",", "args", ")", ":", "if", "len", "(", "args", ")", "==", "1", ":", "for", "cam", "in", "self", ".", "camera_list", ":", "cam", ".", "boSetAperture", "(", "int", "(", "args", "[", "0", "]", ")", ")", ...
ToDo: Validate CAM number and Valid Aperture Value
[ "ToDo", ":", "Validate", "CAM", "number", "and", "Valid", "Aperture", "Value" ]
python
train
43.3
pyusb/pyusb
usb/legacy.py
https://github.com/pyusb/pyusb/blob/ffe6faf42c6ad273880b0b464b9bbf44c1d4b2e9/usb/legacy.py#L284-L294
def detachKernelDriver(self, interface): r"""Detach a kernel driver from the interface (if one is attached, we have permission and the operation is supported by the OS) Arguments: interface: interface number or an Interface object. """ if isinstance(interface, In...
[ "def", "detachKernelDriver", "(", "self", ",", "interface", ")", ":", "if", "isinstance", "(", "interface", ",", "Interface", ")", ":", "interface", "=", "interface", ".", "interfaceNumber", "self", ".", "dev", ".", "detach_kernel_driver", "(", "interface", ")...
r"""Detach a kernel driver from the interface (if one is attached, we have permission and the operation is supported by the OS) Arguments: interface: interface number or an Interface object.
[ "r", "Detach", "a", "kernel", "driver", "from", "the", "interface", "(", "if", "one", "is", "attached", "we", "have", "permission", "and", "the", "operation", "is", "supported", "by", "the", "OS", ")" ]
python
train
38.090909
mmp2/megaman
megaman/geometry/rmetric.py
https://github.com/mmp2/megaman/blob/faccaf267aad0a8b18ec8a705735fd9dd838ca1e/megaman/geometry/rmetric.py#L256-L268
def get_dual_rmetric( self, invert_h = False, mode_inv = 'svd' ): """ Compute the dual Riemannian Metric This is not satisfactory, because if mdimG<mdimY the shape of H will not be the same as the shape of G. TODO(maybe): return a (copied) smaller H with only the rows and columns...
[ "def", "get_dual_rmetric", "(", "self", ",", "invert_h", "=", "False", ",", "mode_inv", "=", "'svd'", ")", ":", "if", "self", ".", "H", "is", "None", ":", "self", ".", "H", ",", "self", ".", "G", ",", "self", ".", "Hvv", ",", "self", ".", "Hsvals...
Compute the dual Riemannian Metric This is not satisfactory, because if mdimG<mdimY the shape of H will not be the same as the shape of G. TODO(maybe): return a (copied) smaller H with only the rows and columns in G.
[ "Compute", "the", "dual", "Riemannian", "Metric", "This", "is", "not", "satisfactory", "because", "if", "mdimG<mdimY", "the", "shape", "of", "H", "will", "not", "be", "the", "same", "as", "the", "shape", "of", "G", ".", "TODO", "(", "maybe", ")", ":", ...
python
train
46
QUANTAXIS/QUANTAXIS
QUANTAXIS/QAFetch/QATdx.py
https://github.com/QUANTAXIS/QUANTAXIS/blob/bb1fe424e4108b62a1f712b81a05cf829297a5c0/QUANTAXIS/QAFetch/QATdx.py#L1230-L1255
def QA_fetch_get_goods_list(ip=None, port=None): """[summary] Keyword Arguments: ip {[type]} -- [description] (default: {None}) port {[type]} -- [description] (default: {None}) 42 3 商品指数 TI 60 3 主力期货合约 MA 28 3 郑州商品 QZ ...
[ "def", "QA_fetch_get_goods_list", "(", "ip", "=", "None", ",", "port", "=", "None", ")", ":", "global", "extension_market_list", "extension_market_list", "=", "QA_fetch_get_extensionmarket_list", "(", ")", "if", "extension_market_list", "is", "None", "else", "extensio...
[summary] Keyword Arguments: ip {[type]} -- [description] (default: {None}) port {[type]} -- [description] (default: {None}) 42 3 商品指数 TI 60 3 主力期货合约 MA 28 3 郑州商品 QZ 29 3 大连商品 QD 30 3 ...
[ "[", "summary", "]" ]
python
train
30.153846
MaxStrange/AudioSegment
algorithms/asa.py
https://github.com/MaxStrange/AudioSegment/blob/1daefb8de626ddff3ff7016697c3ad31d262ecd6/algorithms/asa.py#L903-L924
def _integrate_segmentation_masks(segmasks): """ `segmasks` should be in sorted order of [coarsest, ..., finest]. Integrates the given list of segmentation masks together to form one segmentation mask by having each segment subsume ones that exist in the finer masks. """ if len(segmasks) == 1: ...
[ "def", "_integrate_segmentation_masks", "(", "segmasks", ")", ":", "if", "len", "(", "segmasks", ")", "==", "1", ":", "return", "segmasks", "assert", "len", "(", "segmasks", ")", ">", "0", ",", "\"Passed in empty list of segmentation masks\"", "coarse_mask", "=", ...
`segmasks` should be in sorted order of [coarsest, ..., finest]. Integrates the given list of segmentation masks together to form one segmentation mask by having each segment subsume ones that exist in the finer masks.
[ "segmasks", "should", "be", "in", "sorted", "order", "of", "[", "coarsest", "...", "finest", "]", "." ]
python
test
41.454545
DLR-RM/RAFCON
source/rafcon/gui/helpers/state.py
https://github.com/DLR-RM/RAFCON/blob/24942ef1a904531f49ab8830a1dbb604441be498/source/rafcon/gui/helpers/state.py#L91-L110
def update_models_recursively(state_m, expected=True): """ If a state model is reused the model depth maybe is to low. Therefore this method checks if all library state models are created with reliable depth :param bool expected: Define newly generated library models as expected or triggers logger war...
[ "def", "update_models_recursively", "(", "state_m", ",", "expected", "=", "True", ")", ":", "assert", "isinstance", "(", "state_m", ",", "AbstractStateModel", ")", "if", "isinstance", "(", "state_m", ",", "LibraryStateModel", ")", ":", "if", "not", "state_m", ...
If a state model is reused the model depth maybe is to low. Therefore this method checks if all library state models are created with reliable depth :param bool expected: Define newly generated library models as expected or triggers logger warnings if False
[ "If", "a", "state", "model", "is", "reused", "the", "model", "depth", "maybe", "is", "to", "low", ".", "Therefore", "this", "method", "checks", "if", "all", "library", "state", "models", "are", "created", "with", "reliable", "depth", ":", "param", "bool", ...
python
train
48.9
DataDog/integrations-core
ibm_mq/datadog_checks/ibm_mq/connection.py
https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/ibm_mq/datadog_checks/ibm_mq/connection.py#L25-L38
def get_normal_connection(config): """ Get the connection either with a username and password or without """ if config.username and config.password: log.debug("connecting with username and password") queue_manager = pymqi.connect( config.queue_manager_name, config.channel, co...
[ "def", "get_normal_connection", "(", "config", ")", ":", "if", "config", ".", "username", "and", "config", ".", "password", ":", "log", ".", "debug", "(", "\"connecting with username and password\"", ")", "queue_manager", "=", "pymqi", ".", "connect", "(", "conf...
Get the connection either with a username and password or without
[ "Get", "the", "connection", "either", "with", "a", "username", "and", "password", "or", "without" ]
python
train
40.857143
econ-ark/HARK
HARK/ConsumptionSaving/ConsGenIncProcessModel.py
https://github.com/econ-ark/HARK/blob/3d184153a189e618a87c9540df1cd12044039cc5/HARK/ConsumptionSaving/ConsGenIncProcessModel.py#L836-L868
def solve(self): ''' Solves a one period consumption saving problem with risky income, with persistent income explicitly tracked as a state variable. Parameters ---------- None Returns ------- solution : ConsumerSolution The solution ...
[ "def", "solve", "(", "self", ")", ":", "aLvl", ",", "pLvl", "=", "self", ".", "prepareToCalcEndOfPrdvP", "(", ")", "EndOfPrdvP", "=", "self", ".", "calcEndOfPrdvP", "(", ")", "if", "self", ".", "vFuncBool", ":", "self", ".", "makeEndOfPrdvFunc", "(", "En...
Solves a one period consumption saving problem with risky income, with persistent income explicitly tracked as a state variable. Parameters ---------- None Returns ------- solution : ConsumerSolution The solution to the one period problem, including ...
[ "Solves", "a", "one", "period", "consumption", "saving", "problem", "with", "risky", "income", "with", "persistent", "income", "explicitly", "tracked", "as", "a", "state", "variable", "." ]
python
train
39