repo
stringlengths
7
54
path
stringlengths
4
192
url
stringlengths
87
284
code
stringlengths
78
104k
code_tokens
list
docstring
stringlengths
1
46.9k
docstring_tokens
list
language
stringclasses
1 value
partition
stringclasses
3 values
onnx/onnx
onnx/helper.py
https://github.com/onnx/onnx/blob/2f7dc10f03a072526d94b6820cedbf2a1ec5a2c4/onnx/helper.py#L290-L340
def make_tensor_value_info( name, # type: Text elem_type, # type: int shape, # type: Optional[Sequence[Union[Text, int]]] doc_string="", # type: Text shape_denotation=None, # type: Optional[List[Text]] ): # type: (...) -> ValueInfoProto """Makes a ValueInfoProto based o...
[ "def", "make_tensor_value_info", "(", "name", ",", "# type: Text", "elem_type", ",", "# type: int", "shape", ",", "# type: Optional[Sequence[Union[Text, int]]]", "doc_string", "=", "\"\"", ",", "# type: Text", "shape_denotation", "=", "None", ",", "# type: Optional[List[Tex...
Makes a ValueInfoProto based on the data type and shape.
[ "Makes", "a", "ValueInfoProto", "based", "on", "the", "data", "type", "and", "shape", "." ]
python
train
mezz64/pyEight
pyeight/user.py
https://github.com/mezz64/pyEight/blob/e557e4e6876f490d0964298e9475d68b64222d4f/pyeight/user.py#L273-L285
def current_heart_rate(self): """Return current heart rate for in-progress session.""" try: rates = self.intervals[0]['timeseries']['heartRate'] num_rates = len(rates) if num_rates == 0: return None rate = rates[num_rates-1][1] ex...
[ "def", "current_heart_rate", "(", "self", ")", ":", "try", ":", "rates", "=", "self", ".", "intervals", "[", "0", "]", "[", "'timeseries'", "]", "[", "'heartRate'", "]", "num_rates", "=", "len", "(", "rates", ")", "if", "num_rates", "==", "0", ":", "...
Return current heart rate for in-progress session.
[ "Return", "current", "heart", "rate", "for", "in", "-", "progress", "session", "." ]
python
train
mitsei/dlkit
dlkit/handcar/learning/objects.py
https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/handcar/learning/objects.py#L1018-L1045
def get_next_objective_banks(self, n=None): """Gets the next set of ObjectiveBank elements in this list which must be less than or equal to the return from available(). arg: n (cardinal): the number of ObjectiveBank elements requested which must be less than or equal to ...
[ "def", "get_next_objective_banks", "(", "self", ",", "n", "=", "None", ")", ":", "if", "n", ">", "self", ".", "available", "(", ")", ":", "# !!! This is not quite as specified (see method docs) !!!", "raise", "IllegalState", "(", "'not enough elements available in this ...
Gets the next set of ObjectiveBank elements in this list which must be less than or equal to the return from available(). arg: n (cardinal): the number of ObjectiveBank elements requested which must be less than or equal to available() return: (osid.learning.O...
[ "Gets", "the", "next", "set", "of", "ObjectiveBank", "elements", "in", "this", "list", "which", "must", "be", "less", "than", "or", "equal", "to", "the", "return", "from", "available", "()", "." ]
python
train
senaite/senaite.core
bika/lims/content/worksheet.py
https://github.com/senaite/senaite.core/blob/7602ce2ea2f9e81eb34e20ce17b98a3e70713f85/bika/lims/content/worksheet.py#L1193-L1203
def getRegularAnalyses(self): """ Return the analyses assigned to the current worksheet that are directly associated to an Analysis Request but are not QC analyses. This is all analyses that implement IRoutineAnalysis :return: List of regular analyses :rtype: List of Refe...
[ "def", "getRegularAnalyses", "(", "self", ")", ":", "qc_types", "=", "[", "'ReferenceAnalysis'", ",", "'DuplicateAnalysis'", "]", "analyses", "=", "self", ".", "getAnalyses", "(", ")", "return", "[", "a", "for", "a", "in", "analyses", "if", "a", ".", "port...
Return the analyses assigned to the current worksheet that are directly associated to an Analysis Request but are not QC analyses. This is all analyses that implement IRoutineAnalysis :return: List of regular analyses :rtype: List of ReferenceAnalysis/DuplicateAnalysis
[ "Return", "the", "analyses", "assigned", "to", "the", "current", "worksheet", "that", "are", "directly", "associated", "to", "an", "Analysis", "Request", "but", "are", "not", "QC", "analyses", ".", "This", "is", "all", "analyses", "that", "implement", "IRoutin...
python
train
chrislit/abydos
abydos/phonetic/_beider_morse.py
https://github.com/chrislit/abydos/blob/165466b3ff6afd8024a4c8660421b0c4e7773db9/abydos/phonetic/_beider_morse.py#L788-L933
def encode( self, word, language_arg=0, name_mode='gen', match_mode='approx', concat=False, filter_langs=False, ): """Return the Beider-Morse Phonetic Matching encoding(s) of a term. Parameters ---------- word : str ...
[ "def", "encode", "(", "self", ",", "word", ",", "language_arg", "=", "0", ",", "name_mode", "=", "'gen'", ",", "match_mode", "=", "'approx'", ",", "concat", "=", "False", ",", "filter_langs", "=", "False", ",", ")", ":", "word", "=", "normalize", "(", ...
Return the Beider-Morse Phonetic Matching encoding(s) of a term. Parameters ---------- word : str The word to transform language_arg : int The language of the term; supported values include: - ``any`` - ``arabic`` ...
[ "Return", "the", "Beider", "-", "Morse", "Phonetic", "Matching", "encoding", "(", "s", ")", "of", "a", "term", "." ]
python
valid
cloud9ers/gurumate
environment/lib/python2.7/site-packages/IPython/core/pylabtools.py
https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/core/pylabtools.py#L114-L151
def mpl_runner(safe_execfile): """Factory to return a matplotlib-enabled runner for %run. Parameters ---------- safe_execfile : function This must be a function with the same interface as the :meth:`safe_execfile` method of IPython. Returns ------- A function suitable for use a...
[ "def", "mpl_runner", "(", "safe_execfile", ")", ":", "def", "mpl_execfile", "(", "fname", ",", "*", "where", ",", "*", "*", "kw", ")", ":", "\"\"\"matplotlib-aware wrapper around safe_execfile.\n\n Its interface is identical to that of the :func:`execfile` builtin.\n\n ...
Factory to return a matplotlib-enabled runner for %run. Parameters ---------- safe_execfile : function This must be a function with the same interface as the :meth:`safe_execfile` method of IPython. Returns ------- A function suitable for use as the ``runner`` argument of the %run ...
[ "Factory", "to", "return", "a", "matplotlib", "-", "enabled", "runner", "for", "%run", "." ]
python
test
andymccurdy/redis-py
redis/client.py
https://github.com/andymccurdy/redis-py/blob/cdfe2befbe00db4a3c48c9ddd6d64dea15f6f0db/redis/client.py#L1107-L1116
def slaveof(self, host=None, port=None): """ Set the server to be a replicated slave of the instance identified by the ``host`` and ``port``. If called without arguments, the instance is promoted to a master instead. """ if host is None and port is None: retur...
[ "def", "slaveof", "(", "self", ",", "host", "=", "None", ",", "port", "=", "None", ")", ":", "if", "host", "is", "None", "and", "port", "is", "None", ":", "return", "self", ".", "execute_command", "(", "'SLAVEOF'", ",", "Token", ".", "get_token", "("...
Set the server to be a replicated slave of the instance identified by the ``host`` and ``port``. If called without arguments, the instance is promoted to a master instead.
[ "Set", "the", "server", "to", "be", "a", "replicated", "slave", "of", "the", "instance", "identified", "by", "the", "host", "and", "port", ".", "If", "called", "without", "arguments", "the", "instance", "is", "promoted", "to", "a", "master", "instead", "."...
python
train
inveniosoftware/invenio-search
invenio_search/cli.py
https://github.com/inveniosoftware/invenio-search/blob/19c073d608d4c811f1c5aecb6622402d39715228/invenio_search/cli.py#L108-L116
def create(index_name, body, force, verbose): """Create a new index.""" result = current_search_client.indices.create( index=index_name, body=json.load(body), ignore=[400] if force else None, ) if verbose: click.echo(json.dumps(result))
[ "def", "create", "(", "index_name", ",", "body", ",", "force", ",", "verbose", ")", ":", "result", "=", "current_search_client", ".", "indices", ".", "create", "(", "index", "=", "index_name", ",", "body", "=", "json", ".", "load", "(", "body", ")", ",...
Create a new index.
[ "Create", "a", "new", "index", "." ]
python
train
d11wtq/dockerpty
dockerpty/__init__.py
https://github.com/d11wtq/dockerpty/blob/f8d17d893c6758b7cc25825e99f6b02202632a97/dockerpty/__init__.py#L33-L44
def exec_command( client, container, command, interactive=True, stdout=None, stderr=None, stdin=None): """ Run provided command via exec API in provided container. This is just a wrapper for PseudoTerminal(client, container).exec_command() """ exec_id = exec_create(client, container, comman...
[ "def", "exec_command", "(", "client", ",", "container", ",", "command", ",", "interactive", "=", "True", ",", "stdout", "=", "None", ",", "stderr", "=", "None", ",", "stdin", "=", "None", ")", ":", "exec_id", "=", "exec_create", "(", "client", ",", "co...
Run provided command via exec API in provided container. This is just a wrapper for PseudoTerminal(client, container).exec_command()
[ "Run", "provided", "command", "via", "exec", "API", "in", "provided", "container", "." ]
python
train
brocade/pynos
pynos/versions/ver_7/ver_7_1_0/yang/brocade_notification_stream.py
https://github.com/brocade/pynos/blob/bd8a34e98f322de3fc06750827d8bbc3a0c00380/pynos/versions/ver_7/ver_7_1_0/yang/brocade_notification_stream.py#L504-L514
def RIBVRFRouteLimitExceeded_originator_switch_info_switchIpV4Address(self, **kwargs): """Auto Generated Code """ config = ET.Element("config") RIBVRFRouteLimitExceeded = ET.SubElement(config, "RIBVRFRouteLimitExceeded", xmlns="http://brocade.com/ns/brocade-notification-stream") ...
[ "def", "RIBVRFRouteLimitExceeded_originator_switch_info_switchIpV4Address", "(", "self", ",", "*", "*", "kwargs", ")", ":", "config", "=", "ET", ".", "Element", "(", "\"config\"", ")", "RIBVRFRouteLimitExceeded", "=", "ET", ".", "SubElement", "(", "config", ",", "...
Auto Generated Code
[ "Auto", "Generated", "Code" ]
python
train
ibis-project/ibis
ibis/expr/api.py
https://github.com/ibis-project/ibis/blob/1e39a5fd9ef088b45c155e8a5f541767ee8ef2e7/ibis/expr/api.py#L311-L378
def interval( value=None, unit='s', years=None, quarters=None, months=None, weeks=None, days=None, hours=None, minutes=None, seconds=None, milliseconds=None, microseconds=None, nanoseconds=None, ): """ Returns an interval literal Parameters ----------...
[ "def", "interval", "(", "value", "=", "None", ",", "unit", "=", "'s'", ",", "years", "=", "None", ",", "quarters", "=", "None", ",", "months", "=", "None", ",", "weeks", "=", "None", ",", "days", "=", "None", ",", "hours", "=", "None", ",", "minu...
Returns an interval literal Parameters ---------- value : int or datetime.timedelta, default None years : int, default None quarters : int, default None months : int, default None days : int, default None weeks : int, default None hours : int, default None minutes : int, default...
[ "Returns", "an", "interval", "literal" ]
python
train
CEA-COSMIC/ModOpt
modopt/interface/errors.py
https://github.com/CEA-COSMIC/ModOpt/blob/019b189cb897cbb4d210c44a100daaa08468830c/modopt/interface/errors.py#L49-L76
def catch_error(exception, log=None): """Catch error This method catches errors and prints them to the terminal. It also saves the errors to a log if provided. Parameters ---------- exception : str Exception message string log : instance, optional Logging structure instance...
[ "def", "catch_error", "(", "exception", ",", "log", "=", "None", ")", ":", "if", "import_fail", ":", "err_txt", "=", "'ERROR'", "else", ":", "err_txt", "=", "colored", "(", "'ERROR'", ",", "'red'", ")", "# Print exception to stdout.", "stream_txt", "=", "err...
Catch error This method catches errors and prints them to the terminal. It also saves the errors to a log if provided. Parameters ---------- exception : str Exception message string log : instance, optional Logging structure instance
[ "Catch", "error" ]
python
train
onicagroup/runway
runway/hooks/staticsite/build_staticsite.py
https://github.com/onicagroup/runway/blob/3f3549ec3bf6e39b9f27d9738a1847f3a4369e7f/runway/hooks/staticsite/build_staticsite.py#L21-L34
def does_s3_object_exist(bucket_name, key, session=None): """Determine if object exists on s3.""" if session: s3_resource = session.resource('s3') else: s3_resource = boto3.resource('s3') try: s3_resource.Object(bucket_name, key).load() except ClientError as exc: if ...
[ "def", "does_s3_object_exist", "(", "bucket_name", ",", "key", ",", "session", "=", "None", ")", ":", "if", "session", ":", "s3_resource", "=", "session", ".", "resource", "(", "'s3'", ")", "else", ":", "s3_resource", "=", "boto3", ".", "resource", "(", ...
Determine if object exists on s3.
[ "Determine", "if", "object", "exists", "on", "s3", "." ]
python
train
ajenhl/tacl
tacl/data_store.py
https://github.com/ajenhl/tacl/blob/b8a343248e77f1c07a5a4ac133a9ad6e0b4781c2/tacl/data_store.py#L412-L438
def diff_supplied(self, results_filenames, labels, tokenizer, output_fh): """Returns `output_fh` populated with CSV results giving the n-grams that are unique to the witnesses in each set of works in `results_sets`, using the labels in `labels`. Note that this is not the same as the sym...
[ "def", "diff_supplied", "(", "self", ",", "results_filenames", ",", "labels", ",", "tokenizer", ",", "output_fh", ")", ":", "self", ".", "_add_temporary_results_sets", "(", "results_filenames", ",", "labels", ")", "query", "=", "constants", ".", "SELECT_DIFF_SUPPL...
Returns `output_fh` populated with CSV results giving the n-grams that are unique to the witnesses in each set of works in `results_sets`, using the labels in `labels`. Note that this is not the same as the symmetric difference of these sets, except in the case where there are only two ...
[ "Returns", "output_fh", "populated", "with", "CSV", "results", "giving", "the", "n", "-", "grams", "that", "are", "unique", "to", "the", "witnesses", "in", "each", "set", "of", "works", "in", "results_sets", "using", "the", "labels", "in", "labels", "." ]
python
train
sdispater/orator
orator/query/builder.py
https://github.com/sdispater/orator/blob/bd90bf198ee897751848f9a92e49d18e60a74136/orator/query/builder.py#L325-L344
def right_join_where(self, table, one, operator, two): """ Add a "right join where" clause to the query :param table: The table to join with, can also be a JoinClause instance :type table: str or JoinClause :param one: The first column of the join condition :type one: s...
[ "def", "right_join_where", "(", "self", ",", "table", ",", "one", ",", "operator", ",", "two", ")", ":", "return", "self", ".", "join_where", "(", "table", ",", "one", ",", "operator", ",", "two", ",", "\"right\"", ")" ]
Add a "right join where" clause to the query :param table: The table to join with, can also be a JoinClause instance :type table: str or JoinClause :param one: The first column of the join condition :type one: str :param operator: The operator of the join condition :ty...
[ "Add", "a", "right", "join", "where", "clause", "to", "the", "query" ]
python
train
benoitkugler/abstractDataLibrary
pyDLib/Core/formats.py
https://github.com/benoitkugler/abstractDataLibrary/blob/16be28e99837e40287a63803bbfdf67ac1806b7b/pyDLib/Core/formats.py#L316-L318
def _type_bool(label,default=False): """Shortcut fot boolean like fields""" return label, abstractSearch.nothing, abstractRender.boolen, default
[ "def", "_type_bool", "(", "label", ",", "default", "=", "False", ")", ":", "return", "label", ",", "abstractSearch", ".", "nothing", ",", "abstractRender", ".", "boolen", ",", "default" ]
Shortcut fot boolean like fields
[ "Shortcut", "fot", "boolean", "like", "fields" ]
python
train
kytos/python-openflow
pyof/v0x01/controller2switch/stats_request.py
https://github.com/kytos/python-openflow/blob/4f2d0d08ab28e102ed88fe57a4ee17729f1e1bb7/pyof/v0x01/controller2switch/stats_request.py#L41-L56
def pack(self, value=None): """Pack according to :attr:`body_type`. Make `body` a binary pack before packing this object. Then, restore body. """ backup = self.body if not value: value = self.body if hasattr(value, 'pack'): self.body = va...
[ "def", "pack", "(", "self", ",", "value", "=", "None", ")", ":", "backup", "=", "self", ".", "body", "if", "not", "value", ":", "value", "=", "self", ".", "body", "if", "hasattr", "(", "value", ",", "'pack'", ")", ":", "self", ".", "body", "=", ...
Pack according to :attr:`body_type`. Make `body` a binary pack before packing this object. Then, restore body.
[ "Pack", "according", "to", ":", "attr", ":", "body_type", "." ]
python
train
fabioz/PyDev.Debugger
pydevd_attach_to_process/winappdbg/thread.py
https://github.com/fabioz/PyDev.Debugger/blob/ed9c4307662a5593b8a7f1f3389ecd0e79b8c503/pydevd_attach_to_process/winappdbg/thread.py#L1785-L1797
def get_thread(self, dwThreadId): """ @type dwThreadId: int @param dwThreadId: Global ID of the thread to look for. @rtype: L{Thread} @return: Thread object with the given global ID. """ self.__initialize_snapshot() if dwThreadId not in self.__threadDic...
[ "def", "get_thread", "(", "self", ",", "dwThreadId", ")", ":", "self", ".", "__initialize_snapshot", "(", ")", "if", "dwThreadId", "not", "in", "self", ".", "__threadDict", ":", "msg", "=", "\"Unknown thread ID: %d\"", "%", "dwThreadId", "raise", "KeyError", "...
@type dwThreadId: int @param dwThreadId: Global ID of the thread to look for. @rtype: L{Thread} @return: Thread object with the given global ID.
[ "@type", "dwThreadId", ":", "int", "@param", "dwThreadId", ":", "Global", "ID", "of", "the", "thread", "to", "look", "for", "." ]
python
train
tjcsl/ion
intranet/apps/lostfound/views.py
https://github.com/tjcsl/ion/blob/5d722b0725d572039bb0929fd5715a4070c82c72/intranet/apps/lostfound/views.py#L46-L63
def lostitem_add_view(request): """Add a lostitem.""" if request.method == "POST": form = LostItemForm(request.POST) logger.debug(form) if form.is_valid(): obj = form.save() obj.user = request.user # SAFE HTML obj.description = safe_html(ob...
[ "def", "lostitem_add_view", "(", "request", ")", ":", "if", "request", ".", "method", "==", "\"POST\"", ":", "form", "=", "LostItemForm", "(", "request", ".", "POST", ")", "logger", ".", "debug", "(", "form", ")", "if", "form", ".", "is_valid", "(", ")...
Add a lostitem.
[ "Add", "a", "lostitem", "." ]
python
train
nutechsoftware/alarmdecoder
alarmdecoder/decoder.py
https://github.com/nutechsoftware/alarmdecoder/blob/b0c014089e24455228cb4402cf30ba98157578cd/alarmdecoder/decoder.py#L531-L544
def _handle_aui(self, data): """ Handle AUI messages. :param data: RF message to parse :type data: string :returns: :py:class`~alarmdecoder.messages.AUIMessage` """ msg = AUIMessage(data) self.on_aui_message(message=msg) return msg
[ "def", "_handle_aui", "(", "self", ",", "data", ")", ":", "msg", "=", "AUIMessage", "(", "data", ")", "self", ".", "on_aui_message", "(", "message", "=", "msg", ")", "return", "msg" ]
Handle AUI messages. :param data: RF message to parse :type data: string :returns: :py:class`~alarmdecoder.messages.AUIMessage`
[ "Handle", "AUI", "messages", "." ]
python
train
QUANTAXIS/QUANTAXIS
QUANTAXIS/QAData/dsmethods.py
https://github.com/QUANTAXIS/QUANTAXIS/blob/bb1fe424e4108b62a1f712b81a05cf829297a5c0/QUANTAXIS/QAData/dsmethods.py#L192-L211
def QDS_StockMinWarpper(func, *args, **kwargs): """ 分钟线QDS装饰器 """ def warpper(*args, **kwargs): data = func(*args, **kwargs) if isinstance(data.index, pd.MultiIndex): return QA_DataStruct_Stock_min(data) else: return QA_DataStruct_Stock_min( ...
[ "def", "QDS_StockMinWarpper", "(", "func", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "def", "warpper", "(", "*", "args", ",", "*", "*", "kwargs", ")", ":", "data", "=", "func", "(", "*", "args", ",", "*", "*", "kwargs", ")", "if", "i...
分钟线QDS装饰器
[ "分钟线QDS装饰器" ]
python
train
gem/oq-engine
openquake/hazardlib/gsim/youngs_1997.py
https://github.com/gem/oq-engine/blob/8294553a0b8aba33fd96437a35065d03547d0040/openquake/hazardlib/gsim/youngs_1997.py#L83-L119
def get_mean_and_stddevs(self, sites, rup, dists, imt, stddev_types): """ See :meth:`superclass method <.base.GroundShakingIntensityModel.get_mean_and_stddevs>` for spec of input and result values. """ assert all(stddev_type in self.DEFINED_FOR_STANDARD_DEVIATION_TYPES ...
[ "def", "get_mean_and_stddevs", "(", "self", ",", "sites", ",", "rup", ",", "dists", ",", "imt", ",", "stddev_types", ")", ":", "assert", "all", "(", "stddev_type", "in", "self", ".", "DEFINED_FOR_STANDARD_DEVIATION_TYPES", "for", "stddev_type", "in", "stddev_typ...
See :meth:`superclass method <.base.GroundShakingIntensityModel.get_mean_and_stddevs>` for spec of input and result values.
[ "See", ":", "meth", ":", "superclass", "method", "<", ".", "base", ".", "GroundShakingIntensityModel", ".", "get_mean_and_stddevs", ">", "for", "spec", "of", "input", "and", "result", "values", "." ]
python
train
AltSchool/dynamic-rest
dynamic_rest/filters.py
https://github.com/AltSchool/dynamic-rest/blob/5b0338c3dd8bc638d60c3bb92645857c5b89c920/dynamic_rest/filters.py#L279-L322
def _filters_to_query(self, includes, excludes, serializer, q=None): """ Construct Django Query object from request. Arguments are dictionaries, which will be passed to Q() as kwargs. e.g. includes = { 'foo' : 'bar', 'baz__in' : [1, 2] } produces: Q(foo...
[ "def", "_filters_to_query", "(", "self", ",", "includes", ",", "excludes", ",", "serializer", ",", "q", "=", "None", ")", ":", "def", "rewrite_filters", "(", "filters", ",", "serializer", ")", ":", "out", "=", "{", "}", "for", "k", ",", "node", "in", ...
Construct Django Query object from request. Arguments are dictionaries, which will be passed to Q() as kwargs. e.g. includes = { 'foo' : 'bar', 'baz__in' : [1, 2] } produces: Q(foo='bar', baz__in=[1, 2]) Arguments: includes: TreeMap representing incl...
[ "Construct", "Django", "Query", "object", "from", "request", ".", "Arguments", "are", "dictionaries", "which", "will", "be", "passed", "to", "Q", "()", "as", "kwargs", "." ]
python
train
econ-ark/HARK
HARK/ConsumptionSaving/ConsMedModel.py
https://github.com/econ-ark/HARK/blob/3d184153a189e618a87c9540df1cd12044039cc5/HARK/ConsumptionSaving/ConsMedModel.py#L1211-L1236
def makeBasicSolution(self,EndOfPrdvP,aLvl,interpolator): ''' Given end of period assets and end of period marginal value, construct the basic solution for this period. Parameters ---------- EndOfPrdvP : np.array Array of end-of-period marginal values. ...
[ "def", "makeBasicSolution", "(", "self", ",", "EndOfPrdvP", ",", "aLvl", ",", "interpolator", ")", ":", "xLvl", ",", "mLvl", ",", "pLvl", "=", "self", ".", "getPointsForInterpolation", "(", "EndOfPrdvP", ",", "aLvl", ")", "MedShk_temp", "=", "np", ".", "ti...
Given end of period assets and end of period marginal value, construct the basic solution for this period. Parameters ---------- EndOfPrdvP : np.array Array of end-of-period marginal values. aLvl : np.array Array of end-of-period asset values that yield t...
[ "Given", "end", "of", "period", "assets", "and", "end", "of", "period", "marginal", "value", "construct", "the", "basic", "solution", "for", "this", "period", "." ]
python
train
calmjs/calmjs
src/calmjs/artifact.py
https://github.com/calmjs/calmjs/blob/b9b407c2b6a7662da64bccba93bb8d92e7a5fafd/src/calmjs/artifact.py#L594-L607
def execute_builder(self, entry_point, toolchain, spec): """ Accepts the arguments provided by the builder and executes them. """ toolchain(spec) if not exists(spec['export_target']): logger.error( "the entry point '%s' from package '%s' failed to " ...
[ "def", "execute_builder", "(", "self", ",", "entry_point", ",", "toolchain", ",", "spec", ")", ":", "toolchain", "(", "spec", ")", "if", "not", "exists", "(", "spec", "[", "'export_target'", "]", ")", ":", "logger", ".", "error", "(", "\"the entry point '%...
Accepts the arguments provided by the builder and executes them.
[ "Accepts", "the", "arguments", "provided", "by", "the", "builder", "and", "executes", "them", "." ]
python
train
delfick/harpoon
harpoon/ship/builder.py
https://github.com/delfick/harpoon/blob/a2d39311d6127b7da2e15f40468bf320d598e461/harpoon/ship/builder.py#L104-L135
def make_image(self, conf, images, chain=None, parent_chain=None, made=None, ignore_deps=False, ignore_parent=False, pushing=False): """Make us an image""" made = {} if made is None else made chain = [] if chain is None else chain parent_chain = [] if parent_chain is None else parent_cha...
[ "def", "make_image", "(", "self", ",", "conf", ",", "images", ",", "chain", "=", "None", ",", "parent_chain", "=", "None", ",", "made", "=", "None", ",", "ignore_deps", "=", "False", ",", "ignore_parent", "=", "False", ",", "pushing", "=", "False", ")"...
Make us an image
[ "Make", "us", "an", "image" ]
python
train
ghukill/pyfc4
pyfc4/models.py
https://github.com/ghukill/pyfc4/blob/59011df592f08978c4a901a908862d112a5dcf02/pyfc4/models.py#L162-L226
def get_resource(self, uri, resource_type=None, response_format=None): ''' Retrieve resource: - Issues an initial GET request - If 200, continues, 404, returns False, otherwise raises Exception - Parse resource type - If custom resource type parser provided, this fires - Else, or if custom parser ...
[ "def", "get_resource", "(", "self", ",", "uri", ",", "resource_type", "=", "None", ",", "response_format", "=", "None", ")", ":", "# handle uri", "uri", "=", "self", ".", "parse_uri", "(", "uri", ")", "# remove fcr:metadata if included, as handled below", "if", ...
Retrieve resource: - Issues an initial GET request - If 200, continues, 404, returns False, otherwise raises Exception - Parse resource type - If custom resource type parser provided, this fires - Else, or if custom parser misses, fire HEAD request and parse LDP resource type from Link header - Retu...
[ "Retrieve", "resource", ":", "-", "Issues", "an", "initial", "GET", "request", "-", "If", "200", "continues", "404", "returns", "False", "otherwise", "raises", "Exception", "-", "Parse", "resource", "type", "-", "If", "custom", "resource", "type", "parser", ...
python
train
knagra/farnsworth
workshift/views.py
https://github.com/knagra/farnsworth/blob/1b6589f0d9fea154f0a1e2231ed906764ed26d26/workshift/views.py#L1699-L1715
def type_view(request, semester, pk, profile=None): """ View the details of a particular WorkshiftType. """ any_management = utils.can_manage(request.user, semester, any_pool=True) wtype = get_object_or_404(WorkshiftType, pk=pk) page_name = wtype.title regular_shifts = RegularWorkshift.objec...
[ "def", "type_view", "(", "request", ",", "semester", ",", "pk", ",", "profile", "=", "None", ")", ":", "any_management", "=", "utils", ".", "can_manage", "(", "request", ".", "user", ",", "semester", ",", "any_pool", "=", "True", ")", "wtype", "=", "ge...
View the details of a particular WorkshiftType.
[ "View", "the", "details", "of", "a", "particular", "WorkshiftType", "." ]
python
train
manns/pyspread
pyspread/src/gui/_main_window.py
https://github.com/manns/pyspread/blob/0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0/pyspread/src/gui/_main_window.py#L1364-L1405
def OnFontDialog(self, event): """Event handler for launching font dialog""" # Get current font data from current cell cursor = self.main_window.grid.actions.cursor attr = self.main_window.grid.code_array.cell_attributes[cursor] size, style, weight, font = \ [attr[n...
[ "def", "OnFontDialog", "(", "self", ",", "event", ")", ":", "# Get current font data from current cell", "cursor", "=", "self", ".", "main_window", ".", "grid", ".", "actions", ".", "cursor", "attr", "=", "self", ".", "main_window", ".", "grid", ".", "code_arr...
Event handler for launching font dialog
[ "Event", "handler", "for", "launching", "font", "dialog" ]
python
train
nschloe/matplotlib2tikz
matplotlib2tikz/line2d.py
https://github.com/nschloe/matplotlib2tikz/blob/ac5daca6f38b834d757f6c6ae6cc34121956f46b/matplotlib2tikz/line2d.py#L88-L111
def draw_linecollection(data, obj): """Returns Pgfplots code for a number of patch objects. """ content = [] edgecolors = obj.get_edgecolors() linestyles = obj.get_linestyles() linewidths = obj.get_linewidths() paths = obj.get_paths() for i, path in enumerate(paths): color = ed...
[ "def", "draw_linecollection", "(", "data", ",", "obj", ")", ":", "content", "=", "[", "]", "edgecolors", "=", "obj", ".", "get_edgecolors", "(", ")", "linestyles", "=", "obj", ".", "get_linestyles", "(", ")", "linewidths", "=", "obj", ".", "get_linewidths"...
Returns Pgfplots code for a number of patch objects.
[ "Returns", "Pgfplots", "code", "for", "a", "number", "of", "patch", "objects", "." ]
python
train
bitesofcode/projexui
projexui/menus/xrecentfilesmenu.py
https://github.com/bitesofcode/projexui/blob/f18a73bec84df90b034ca69b9deea118dbedfc4d/projexui/menus/xrecentfilesmenu.py#L114-L132
def setFilenames( self, filenames ): """ Sets the list of filenames that will be used for this menu to the \ inputed list. :param filenames | [<str>, ..] """ mapped = [] for filename in filenames: filename = nativestring(filename) ...
[ "def", "setFilenames", "(", "self", ",", "filenames", ")", ":", "mapped", "=", "[", "]", "for", "filename", "in", "filenames", ":", "filename", "=", "nativestring", "(", "filename", ")", "if", "(", "not", "filename", ")", ":", "continue", "mapped", ".", ...
Sets the list of filenames that will be used for this menu to the \ inputed list. :param filenames | [<str>, ..]
[ "Sets", "the", "list", "of", "filenames", "that", "will", "be", "used", "for", "this", "menu", "to", "the", "\\", "inputed", "list", ".", ":", "param", "filenames", "|", "[", "<str", ">", "..", "]" ]
python
train
cimm-kzn/CGRtools
CGRtools/containers/reaction.py
https://github.com/cimm-kzn/CGRtools/blob/15a19b04f6e4e1d0dab8e0d32a0877c7f7d70f34/CGRtools/containers/reaction.py#L246-L255
def calculate2d(self, force=True): """ recalculate 2d coordinates. currently rings can be calculated badly. :param force: ignore existing coordinates of atoms """ for ml in (self.__reagents, self.__reactants, self.__products): for m in ml: m.calculate...
[ "def", "calculate2d", "(", "self", ",", "force", "=", "True", ")", ":", "for", "ml", "in", "(", "self", ".", "__reagents", ",", "self", ".", "__reactants", ",", "self", ".", "__products", ")", ":", "for", "m", "in", "ml", ":", "m", ".", "calculate2...
recalculate 2d coordinates. currently rings can be calculated badly. :param force: ignore existing coordinates of atoms
[ "recalculate", "2d", "coordinates", ".", "currently", "rings", "can", "be", "calculated", "badly", "." ]
python
train
PythonCharmers/python-future
src/future/backports/html/parser.py
https://github.com/PythonCharmers/python-future/blob/c423752879acc05eebc29b0bb9909327bd5c7308/src/future/backports/html/parser.py#L135-L141
def reset(self): """Reset this instance. Loses all unprocessed data.""" self.rawdata = '' self.lasttag = '???' self.interesting = interesting_normal self.cdata_elem = None _markupbase.ParserBase.reset(self)
[ "def", "reset", "(", "self", ")", ":", "self", ".", "rawdata", "=", "''", "self", ".", "lasttag", "=", "'???'", "self", ".", "interesting", "=", "interesting_normal", "self", ".", "cdata_elem", "=", "None", "_markupbase", ".", "ParserBase", ".", "reset", ...
Reset this instance. Loses all unprocessed data.
[ "Reset", "this", "instance", ".", "Loses", "all", "unprocessed", "data", "." ]
python
train
phoebe-project/phoebe2
phoebe/frontend/bundle.py
https://github.com/phoebe-project/phoebe2/blob/e64b8be683977064e2d55dd1b3ac400f64c3e379/phoebe/frontend/bundle.py#L3357-L3389
def add_prior(self, twig=None, **kwargs): """ [NOT IMPLEMENTED] :raises NotImplementedError: because it isn't """ raise NotImplementedError param = self.get_parameter(twig=twig, **kwargs) # TODO: make sure param is a float parameter? func = _get_add_fu...
[ "def", "add_prior", "(", "self", ",", "twig", "=", "None", ",", "*", "*", "kwargs", ")", ":", "raise", "NotImplementedError", "param", "=", "self", ".", "get_parameter", "(", "twig", "=", "twig", ",", "*", "*", "kwargs", ")", "# TODO: make sure param is a ...
[NOT IMPLEMENTED] :raises NotImplementedError: because it isn't
[ "[", "NOT", "IMPLEMENTED", "]" ]
python
train
contentful/contentful-management.py
contentful_management/client.py
https://github.com/contentful/contentful-management.py/blob/707dd30883b98a10c7ff0f7f5bdb8edbdc1d8df0/contentful_management/client.py#L776-L781
def _post(self, url, attributes=None, **kwargs): """ Wrapper for the HTTP POST request. """ return self._request('post', url, attributes, **kwargs)
[ "def", "_post", "(", "self", ",", "url", ",", "attributes", "=", "None", ",", "*", "*", "kwargs", ")", ":", "return", "self", ".", "_request", "(", "'post'", ",", "url", ",", "attributes", ",", "*", "*", "kwargs", ")" ]
Wrapper for the HTTP POST request.
[ "Wrapper", "for", "the", "HTTP", "POST", "request", "." ]
python
train
OCHA-DAP/hdx-python-api
src/hdx/hdx_configuration.py
https://github.com/OCHA-DAP/hdx-python-api/blob/212440f54f73805826a16db77dbcb6033b18a313/src/hdx/hdx_configuration.py#L367-L383
def setup_remoteckan(self, remoteckan=None, **kwargs): # type: (Optional[ckanapi.RemoteCKAN], Any) -> None """ Set up remote CKAN from provided CKAN or by creating from configuration Args: remoteckan (Optional[ckanapi.RemoteCKAN]): CKAN instance. Defaults to setting one up f...
[ "def", "setup_remoteckan", "(", "self", ",", "remoteckan", "=", "None", ",", "*", "*", "kwargs", ")", ":", "# type: (Optional[ckanapi.RemoteCKAN], Any) -> None", "if", "remoteckan", "is", "None", ":", "self", ".", "_remoteckan", "=", "self", ".", "create_remotecka...
Set up remote CKAN from provided CKAN or by creating from configuration Args: remoteckan (Optional[ckanapi.RemoteCKAN]): CKAN instance. Defaults to setting one up from configuration. Returns: None
[ "Set", "up", "remote", "CKAN", "from", "provided", "CKAN", "or", "by", "creating", "from", "configuration" ]
python
train
demianbrecht/flask-canvas
flask_canvas.py
https://github.com/demianbrecht/flask-canvas/blob/07aa310c43f9386598cdfd5b163f94efa7808c85/flask_canvas.py#L133-L143
def _decode_signed_user(encoded_sig, encoded_data): """ Decodes the ``POST``ed signed data """ decoded_sig = _decode(encoded_sig) decoded_data = loads(_decode(encoded_data)) if decoded_sig != hmac.new(app.config['CANVAS_CLIENT_SECRET'], encoded_data, sha256).digest(): raise ValueEr...
[ "def", "_decode_signed_user", "(", "encoded_sig", ",", "encoded_data", ")", ":", "decoded_sig", "=", "_decode", "(", "encoded_sig", ")", "decoded_data", "=", "loads", "(", "_decode", "(", "encoded_data", ")", ")", "if", "decoded_sig", "!=", "hmac", ".", "new",...
Decodes the ``POST``ed signed data
[ "Decodes", "the", "POST", "ed", "signed", "data" ]
python
train
numenta/htmresearch
projects/union_path_integration/multi_column/multi_column_convergence.py
https://github.com/numenta/htmresearch/blob/70c096b09a577ea0432c3f3bfff4442d4871b7aa/projects/union_path_integration/multi_column/multi_column_convergence.py#L181-L225
def learn(self): """ Learn all objects on every column. Each column will learn all the features of every object and store the the object's L2 representation to be later used in the inference stage """ self.setLearning(True) for obj in self.objects: self.sendReset() previousLoca...
[ "def", "learn", "(", "self", ")", ":", "self", ".", "setLearning", "(", "True", ")", "for", "obj", "in", "self", ".", "objects", ":", "self", ".", "sendReset", "(", ")", "previousLocation", "=", "[", "None", "]", "*", "self", ".", "numColumns", "disp...
Learn all objects on every column. Each column will learn all the features of every object and store the the object's L2 representation to be later used in the inference stage
[ "Learn", "all", "objects", "on", "every", "column", ".", "Each", "column", "will", "learn", "all", "the", "features", "of", "every", "object", "and", "store", "the", "the", "object", "s", "L2", "representation", "to", "be", "later", "used", "in", "the", ...
python
train
PmagPy/PmagPy
programs/magic_gui.py
https://github.com/PmagPy/PmagPy/blob/c7984f8809bf40fe112e53dcc311a33293b62d0b/programs/magic_gui.py#L89-L235
def InitUI(self): """ Make main user interface """ bSizer0 = wx.StaticBoxSizer( wx.StaticBox(self.panel, wx.ID_ANY, "Choose MagIC project directory", name='bSizer0'), wx.HORIZONTAL ) self.dir_path = wx.TextCtrl(self.panel, id=-1, size=(600, 25), style=wx.TE_RE...
[ "def", "InitUI", "(", "self", ")", ":", "bSizer0", "=", "wx", ".", "StaticBoxSizer", "(", "wx", ".", "StaticBox", "(", "self", ".", "panel", ",", "wx", ".", "ID_ANY", ",", "\"Choose MagIC project directory\"", ",", "name", "=", "'bSizer0'", ")", ",", "wx...
Make main user interface
[ "Make", "main", "user", "interface" ]
python
train
knipknap/SpiffWorkflow
SpiffWorkflow/task.py
https://github.com/knipknap/SpiffWorkflow/blob/f0af7f59a332e0619e4f3c00a7d4a3d230760e00/SpiffWorkflow/task.py#L207-L229
def _setstate(self, value, force=False): """ Setting force to True allows for changing a state after it COMPLETED. This would otherwise be invalid. """ if self._state == value: return if value < self._state and not force: raise WorkflowException(se...
[ "def", "_setstate", "(", "self", ",", "value", ",", "force", "=", "False", ")", ":", "if", "self", ".", "_state", "==", "value", ":", "return", "if", "value", "<", "self", ".", "_state", "and", "not", "force", ":", "raise", "WorkflowException", "(", ...
Setting force to True allows for changing a state after it COMPLETED. This would otherwise be invalid.
[ "Setting", "force", "to", "True", "allows", "for", "changing", "a", "state", "after", "it", "COMPLETED", ".", "This", "would", "otherwise", "be", "invalid", "." ]
python
valid
cocaine/cocaine-framework-python
cocaine/detail/headers.py
https://github.com/cocaine/cocaine-framework-python/blob/d8a30074b6338bac4389eb996e00d404338115e4/cocaine/detail/headers.py#L172-L189
def add(self, name, value): """ Adds a new entry to the table We reduce the table size if the entry will make the table size greater than maxsize. """ # We just clear the table if the entry is too big size = table_entry_size(name, value) if size > self._m...
[ "def", "add", "(", "self", ",", "name", ",", "value", ")", ":", "# We just clear the table if the entry is too big", "size", "=", "table_entry_size", "(", "name", ",", "value", ")", "if", "size", ">", "self", ".", "_maxsize", ":", "self", ".", "dynamic_entries...
Adds a new entry to the table We reduce the table size if the entry will make the table size greater than maxsize.
[ "Adds", "a", "new", "entry", "to", "the", "table" ]
python
train
miso-belica/jusText
justext/core.py
https://github.com/miso-belica/jusText/blob/ad05130df2ca883f291693353f9d86e20fe94a4e/justext/core.py#L71-L98
def decode_html(html, default_encoding=DEFAULT_ENCODING, encoding=None, errors=DEFAULT_ENC_ERRORS): """ Converts a `html` containing an HTML page into Unicode. Tries to guess character encoding from meta tag. """ if isinstance(html, unicode): return html if encoding: return html...
[ "def", "decode_html", "(", "html", ",", "default_encoding", "=", "DEFAULT_ENCODING", ",", "encoding", "=", "None", ",", "errors", "=", "DEFAULT_ENC_ERRORS", ")", ":", "if", "isinstance", "(", "html", ",", "unicode", ")", ":", "return", "html", "if", "encodin...
Converts a `html` containing an HTML page into Unicode. Tries to guess character encoding from meta tag.
[ "Converts", "a", "html", "containing", "an", "HTML", "page", "into", "Unicode", ".", "Tries", "to", "guess", "character", "encoding", "from", "meta", "tag", "." ]
python
train
aleju/imgaug
imgaug/augmentables/polys.py
https://github.com/aleju/imgaug/blob/786be74aa855513840113ea523c5df495dc6a8af/imgaug/augmentables/polys.py#L303-L332
def is_out_of_image(self, image, fully=True, partly=False): """ Estimate whether the polygon is partially or fully outside of the image area. Parameters ---------- image : (H,W,...) ndarray or tuple of int Image dimensions to use. If an ndarray, its shape...
[ "def", "is_out_of_image", "(", "self", ",", "image", ",", "fully", "=", "True", ",", "partly", "=", "False", ")", ":", "# TODO this is inconsistent with line strings, which return a default", "# value in these cases", "if", "len", "(", "self", ".", "exterior", ")...
Estimate whether the polygon is partially or fully outside of the image area. Parameters ---------- image : (H,W,...) ndarray or tuple of int Image dimensions to use. If an ndarray, its shape will be used. If a tuple, it is assumed to represent the image shap...
[ "Estimate", "whether", "the", "polygon", "is", "partially", "or", "fully", "outside", "of", "the", "image", "area", "." ]
python
valid
Fizzadar/pyinfra
pyinfra/local.py
https://github.com/Fizzadar/pyinfra/blob/006f751f7db2e07d32522c0285160783de2feb79/pyinfra/local.py#L19-L78
def include(filename, hosts=False, when=True): ''' Executes a local python file within the ``pyinfra.pseudo_state.deploy_dir`` directory. Args: hosts (string, list): group name or list of hosts to limit this include to when (bool): indicate whether to trigger operations in this include ...
[ "def", "include", "(", "filename", ",", "hosts", "=", "False", ",", "when", "=", "True", ")", ":", "if", "not", "pyinfra", ".", "is_cli", ":", "raise", "PyinfraError", "(", "'local.include is only available in CLI mode.'", ")", "if", "not", "when", ":", "ret...
Executes a local python file within the ``pyinfra.pseudo_state.deploy_dir`` directory. Args: hosts (string, list): group name or list of hosts to limit this include to when (bool): indicate whether to trigger operations in this include
[ "Executes", "a", "local", "python", "file", "within", "the", "pyinfra", ".", "pseudo_state", ".", "deploy_dir", "directory", "." ]
python
train
projectatomic/osbs-client
osbs/build/build_request.py
https://github.com/projectatomic/osbs-client/blob/571fe035dab3a7c02e1dccd5d65ffd75be750458/osbs/build/build_request.py#L843-L871
def render_bump_release(self): """ If the bump_release plugin is present, configure it """ phase = 'prebuild_plugins' plugin = 'bump_release' if not self.dj.dock_json_has_plugin_conf(phase, plugin): return if self.spec.release.value: logge...
[ "def", "render_bump_release", "(", "self", ")", ":", "phase", "=", "'prebuild_plugins'", "plugin", "=", "'bump_release'", "if", "not", "self", ".", "dj", ".", "dock_json_has_plugin_conf", "(", "phase", ",", "plugin", ")", ":", "return", "if", "self", ".", "s...
If the bump_release plugin is present, configure it
[ "If", "the", "bump_release", "plugin", "is", "present", "configure", "it" ]
python
train
twilio/twilio-python
twilio/rest/taskrouter/v1/workspace/worker/workers_real_time_statistics.py
https://github.com/twilio/twilio-python/blob/c867895f55dcc29f522e6e8b8868d0d18483132f/twilio/rest/taskrouter/v1/workspace/worker/workers_real_time_statistics.py#L88-L101
def get_instance(self, payload): """ Build an instance of WorkersRealTimeStatisticsInstance :param dict payload: Payload response from the API :returns: twilio.rest.taskrouter.v1.workspace.worker.workers_real_time_statistics.WorkersRealTimeStatisticsInstance :rtype: twilio.rest...
[ "def", "get_instance", "(", "self", ",", "payload", ")", ":", "return", "WorkersRealTimeStatisticsInstance", "(", "self", ".", "_version", ",", "payload", ",", "workspace_sid", "=", "self", ".", "_solution", "[", "'workspace_sid'", "]", ",", ")" ]
Build an instance of WorkersRealTimeStatisticsInstance :param dict payload: Payload response from the API :returns: twilio.rest.taskrouter.v1.workspace.worker.workers_real_time_statistics.WorkersRealTimeStatisticsInstance :rtype: twilio.rest.taskrouter.v1.workspace.worker.workers_real_time_sta...
[ "Build", "an", "instance", "of", "WorkersRealTimeStatisticsInstance" ]
python
train
googlefonts/fontbakery
Lib/fontbakery/profiles/name.py
https://github.com/googlefonts/fontbakery/blob/b355aea2e619a4477769e060d24c32448aa65399/Lib/fontbakery/profiles/name.py#L398-L412
def com_adobe_fonts_check_name_postscript_name_consistency(ttFont): """Name table ID 6 (PostScript name) must be consistent across platforms.""" postscript_names = set() for entry in ttFont['name'].names: if entry.nameID == NameID.POSTSCRIPT_NAME: postscript_name = entry.toUnicode() postscript_nam...
[ "def", "com_adobe_fonts_check_name_postscript_name_consistency", "(", "ttFont", ")", ":", "postscript_names", "=", "set", "(", ")", "for", "entry", "in", "ttFont", "[", "'name'", "]", ".", "names", ":", "if", "entry", ".", "nameID", "==", "NameID", ".", "POSTS...
Name table ID 6 (PostScript name) must be consistent across platforms.
[ "Name", "table", "ID", "6", "(", "PostScript", "name", ")", "must", "be", "consistent", "across", "platforms", "." ]
python
train
jobovy/galpy
galpy/df/streamdf.py
https://github.com/jobovy/galpy/blob/9c5b9fe65d58835624dffe432be282060918ee08/galpy/df/streamdf.py#L2808-L2886
def gaussApprox(self,xy,**kwargs): """ NAME: gaussApprox PURPOSE: return the mean and variance of a Gaussian approximation to the stream DF at a given phase-space point in Galactocentric rectangular coordinates (distribution is over missing directions) INPUT: ...
[ "def", "gaussApprox", "(", "self", ",", "xy", ",", "*", "*", "kwargs", ")", ":", "interp", "=", "kwargs", ".", "get", "(", "'interp'", ",", "self", ".", "_useInterp", ")", "lb", "=", "kwargs", ".", "get", "(", "'lb'", ",", "False", ")", "#What are ...
NAME: gaussApprox PURPOSE: return the mean and variance of a Gaussian approximation to the stream DF at a given phase-space point in Galactocentric rectangular coordinates (distribution is over missing directions) INPUT: xy - phase-space point [X,Y,Z,vX,vY,vZ]; the ...
[ "NAME", ":" ]
python
train
ondergetekende/python-panavatar
panavatar/parameters.py
https://github.com/ondergetekende/python-panavatar/blob/d89d952db27ddd196ac66aafa89cb80dbcd40ca6/panavatar/parameters.py#L174-L198
def weighted_choice(self, probabilities, key): """Makes a weighted choice between several options. Probabilities is a list of 2-tuples, (probability, option). The probabilties don't need to add up to anything, they are automatically scaled.""" try: choice = self.val...
[ "def", "weighted_choice", "(", "self", ",", "probabilities", ",", "key", ")", ":", "try", ":", "choice", "=", "self", ".", "values", "[", "key", "]", ".", "lower", "(", ")", "except", "KeyError", ":", "# override not set.", "return", "super", "(", "Recor...
Makes a weighted choice between several options. Probabilities is a list of 2-tuples, (probability, option). The probabilties don't need to add up to anything, they are automatically scaled.
[ "Makes", "a", "weighted", "choice", "between", "several", "options", "." ]
python
train
fermiPy/fermipy
fermipy/stats_utils.py
https://github.com/fermiPy/fermipy/blob/9df5e7e3728307fd58c5bba36fd86783c39fbad4/fermipy/stats_utils.py#L156-L164
def profile_bins(self): """ The binning to use to do the profile fitting """ log_mean = np.log10(self.mean()) log_half_width = max(5. * self.sigma(), 3.) # Default is to profile over +-5 sigma, # centered on mean, using 100 bins return np.logspace(log_mean - log_h...
[ "def", "profile_bins", "(", "self", ")", ":", "log_mean", "=", "np", ".", "log10", "(", "self", ".", "mean", "(", ")", ")", "log_half_width", "=", "max", "(", "5.", "*", "self", ".", "sigma", "(", ")", ",", "3.", ")", "# Default is to profile over +-5 ...
The binning to use to do the profile fitting
[ "The", "binning", "to", "use", "to", "do", "the", "profile", "fitting" ]
python
train
bitesofcode/projexui
projexui/widgets/xorbrecordbox.py
https://github.com/bitesofcode/projexui/blob/f18a73bec84df90b034ca69b9deea118dbedfc4d/projexui/widgets/xorbrecordbox.py#L969-L987
def showPopup(self): """ Overloads the popup method from QComboBox to display an ORB tree widget when necessary. :sa setShowTreePopup """ if not self.showTreePopup(): return super(XOrbRecordBox, self).showPopup() tree = ...
[ "def", "showPopup", "(", "self", ")", ":", "if", "not", "self", ".", "showTreePopup", "(", ")", ":", "return", "super", "(", "XOrbRecordBox", ",", "self", ")", ".", "showPopup", "(", ")", "tree", "=", "self", ".", "treePopupWidget", "(", ")", "if", "...
Overloads the popup method from QComboBox to display an ORB tree widget when necessary. :sa setShowTreePopup
[ "Overloads", "the", "popup", "method", "from", "QComboBox", "to", "display", "an", "ORB", "tree", "widget", "when", "necessary", ".", ":", "sa", "setShowTreePopup" ]
python
train
python-wink/python-wink
src/pywink/devices/air_conditioner.py
https://github.com/python-wink/python-wink/blob/cf8bdce8c6518f30b91b23aa7aa32e89c2ce48da/src/pywink/devices/air_conditioner.py#L87-L101
def set_temperature(self, max_set_point=None): """ :param max_set_point: a float for the max set point value in celsius :return: nothing """ desired_state = {} if max_set_point: desired_state['max_set_point'] = max_set_point response = self.api_inter...
[ "def", "set_temperature", "(", "self", ",", "max_set_point", "=", "None", ")", ":", "desired_state", "=", "{", "}", "if", "max_set_point", ":", "desired_state", "[", "'max_set_point'", "]", "=", "max_set_point", "response", "=", "self", ".", "api_interface", "...
:param max_set_point: a float for the max set point value in celsius :return: nothing
[ ":", "param", "max_set_point", ":", "a", "float", "for", "the", "max", "set", "point", "value", "in", "celsius", ":", "return", ":", "nothing" ]
python
train
Neurosim-lab/netpyne
netpyne/analysis/network.py
https://github.com/Neurosim-lab/netpyne/blob/edb67b5098b2e7923d55010ded59ad1bf75c0f18/netpyne/analysis/network.py#L519-L673
def plotConn (includePre = ['all'], includePost = ['all'], feature = 'strength', orderBy = 'gid', figSize = (10,10), groupBy = 'pop', groupByIntervalPre = None, groupByIntervalPost = None, graphType = 'matrix', synOrConn = 'syn', synMech = None, connsFile = None, tagsFile = None, clim = None, fontSize = 12, saveData = ...
[ "def", "plotConn", "(", "includePre", "=", "[", "'all'", "]", ",", "includePost", "=", "[", "'all'", "]", ",", "feature", "=", "'strength'", ",", "orderBy", "=", "'gid'", ",", "figSize", "=", "(", "10", ",", "10", ")", ",", "groupBy", "=", "'pop'", ...
Plot network connectivity - includePre (['all',|'allCells','allNetStims',|,120,|,'E1'|,('L2', 56)|,('L5',[4,5,6])]): Cells to show (default: ['all']) - includePost (['all',|'allCells','allNetStims',|,120,|,'E1'|,('L2', 56)|,('L5',[4,5,6])]): Cells to show (default: ['all']) - feature ('weight'|'...
[ "Plot", "network", "connectivity", "-", "includePre", "(", "[", "all", "|", "allCells", "allNetStims", "|", "120", "|", "E1", "|", "(", "L2", "56", ")", "|", "(", "L5", "[", "4", "5", "6", "]", ")", "]", ")", ":", "Cells", "to", "show", "(", "d...
python
train
StackStorm/pybind
pybind/slxos/v17s_1_02/__init__.py
https://github.com/StackStorm/pybind/blob/44c467e71b2b425be63867aba6e6fa28b2cfe7fb/pybind/slxos/v17s_1_02/__init__.py#L12720-L12743
def _set_sfm_state(self, v, load=False): """ Setter method for sfm_state, mapped from YANG variable /sfm_state (container) If this variable is read-only (config: false) in the source YANG file, then _set_sfm_state is considered as a private method. Backends looking to populate this variable should ...
[ "def", "_set_sfm_state", "(", "self", ",", "v", ",", "load", "=", "False", ")", ":", "if", "hasattr", "(", "v", ",", "\"_utype\"", ")", ":", "v", "=", "v", ".", "_utype", "(", "v", ")", "try", ":", "t", "=", "YANGDynClass", "(", "v", ",", "base...
Setter method for sfm_state, mapped from YANG variable /sfm_state (container) If this variable is read-only (config: false) in the source YANG file, then _set_sfm_state is considered as a private method. Backends looking to populate this variable should do so via calling thisObj._set_sfm_state() directl...
[ "Setter", "method", "for", "sfm_state", "mapped", "from", "YANG", "variable", "/", "sfm_state", "(", "container", ")", "If", "this", "variable", "is", "read", "-", "only", "(", "config", ":", "false", ")", "in", "the", "source", "YANG", "file", "then", "...
python
train
hydraplatform/hydra-base
hydra_base/lib/units.py
https://github.com/hydraplatform/hydra-base/blob/9251ff7946505f7a272c87837390acd1c435bc6e/hydra_base/lib/units.py#L397-L443
def add_unit(unit,**kwargs): """ Add the unit defined into the object "unit" to the DB If unit["project_id"] is None it means that the unit is global, otherwise is property of a project If the unit exists emits an exception A minimal example: .. code-block:: python ...
[ "def", "add_unit", "(", "unit", ",", "*", "*", "kwargs", ")", ":", "new_unit", "=", "Unit", "(", ")", "new_unit", ".", "dimension_id", "=", "unit", "[", "\"dimension_id\"", "]", "new_unit", ".", "name", "=", "unit", "[", "'name'", "]", "# Needed to unifo...
Add the unit defined into the object "unit" to the DB If unit["project_id"] is None it means that the unit is global, otherwise is property of a project If the unit exists emits an exception A minimal example: .. code-block:: python new_unit = dict( name ...
[ "Add", "the", "unit", "defined", "into", "the", "object", "unit", "to", "the", "DB", "If", "unit", "[", "project_id", "]", "is", "None", "it", "means", "that", "the", "unit", "is", "global", "otherwise", "is", "property", "of", "a", "project", "If", "t...
python
train
bcbio/bcbio-nextgen
bcbio/pipeline/cleanbam.py
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/pipeline/cleanbam.py#L42-L73
def remove_extracontigs(in_bam, data): """Remove extra contigs (non chr1-22,X,Y) from an input BAM. These extra contigs can often be arranged in different ways, causing incompatibility issues with GATK and other tools. This also fixes the read group header as in fixrg. This does not yet handle map...
[ "def", "remove_extracontigs", "(", "in_bam", ",", "data", ")", ":", "work_dir", "=", "utils", ".", "safe_makedir", "(", "os", ".", "path", ".", "join", "(", "dd", ".", "get_work_dir", "(", "data", ")", ",", "\"bamclean\"", ",", "dd", ".", "get_sample_nam...
Remove extra contigs (non chr1-22,X,Y) from an input BAM. These extra contigs can often be arranged in different ways, causing incompatibility issues with GATK and other tools. This also fixes the read group header as in fixrg. This does not yet handle mapping over 1 -> chr1 issues since this requires...
[ "Remove", "extra", "contigs", "(", "non", "chr1", "-", "22", "X", "Y", ")", "from", "an", "input", "BAM", "." ]
python
train
benjamin-hodgson/asynqp
src/asynqp/protocol.py
https://github.com/benjamin-hodgson/asynqp/blob/ea8630d1803d10d4fd64b1a0e50f3097710b34d1/src/asynqp/protocol.py#L66-L74
def heartbeat_timeout(self): """ Called by heartbeat_monitor on timeout """ assert not self._closed, "Did we not stop heartbeat_monitor on close?" log.error("Heartbeat time out") poison_exc = ConnectionLostError('Heartbeat timed out') poison_frame = frames.PoisonPillFrame(poison_...
[ "def", "heartbeat_timeout", "(", "self", ")", ":", "assert", "not", "self", ".", "_closed", ",", "\"Did we not stop heartbeat_monitor on close?\"", "log", ".", "error", "(", "\"Heartbeat time out\"", ")", "poison_exc", "=", "ConnectionLostError", "(", "'Heartbeat timed ...
Called by heartbeat_monitor on timeout
[ "Called", "by", "heartbeat_monitor", "on", "timeout" ]
python
train
saltstack/salt
salt/modules/debian_ip.py
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/debian_ip.py#L202-L208
def _raise_error_network(option, expected): ''' Log and raise an error with a logical formatted message. ''' msg = _error_msg_network(option, expected) log.error(msg) raise AttributeError(msg)
[ "def", "_raise_error_network", "(", "option", ",", "expected", ")", ":", "msg", "=", "_error_msg_network", "(", "option", ",", "expected", ")", "log", ".", "error", "(", "msg", ")", "raise", "AttributeError", "(", "msg", ")" ]
Log and raise an error with a logical formatted message.
[ "Log", "and", "raise", "an", "error", "with", "a", "logical", "formatted", "message", "." ]
python
train
glue-viz/glue-vispy-viewers
glue_vispy_viewers/extern/vispy/geometry/meshdata.py
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/geometry/meshdata.py#L122-L148
def get_edges(self, indexed=None): """Edges of the mesh Parameters ---------- indexed : str | None If indexed is None, return (Nf, 3) array of vertex indices, two per edge in the mesh. If indexed is 'faces', then return (Nf, 3, 2) array of vertex...
[ "def", "get_edges", "(", "self", ",", "indexed", "=", "None", ")", ":", "if", "indexed", "is", "None", ":", "if", "self", ".", "_edges", "is", "None", ":", "self", ".", "_compute_edges", "(", "indexed", "=", "None", ")", "return", "self", ".", "_edge...
Edges of the mesh Parameters ---------- indexed : str | None If indexed is None, return (Nf, 3) array of vertex indices, two per edge in the mesh. If indexed is 'faces', then return (Nf, 3, 2) array of vertex indices with 3 edges per face, and...
[ "Edges", "of", "the", "mesh", "Parameters", "----------", "indexed", ":", "str", "|", "None", "If", "indexed", "is", "None", "return", "(", "Nf", "3", ")", "array", "of", "vertex", "indices", "two", "per", "edge", "in", "the", "mesh", ".", "If", "index...
python
train
assamite/creamas
creamas/examples/spiro/spiro_agent_mp.py
https://github.com/assamite/creamas/blob/54dc3e31c97a3f938e58272f8ab80b6bcafeff58/creamas/examples/spiro/spiro_agent_mp.py#L186-L193
def evaluate(self, artifact): '''Evaluate the artifact with respect to the agents short term memory. Returns value in [0, 1]. ''' if self.desired_novelty > 0: return self.hedonic_value(self.novelty(artifact.obj)) return self.novelty(artifact.obj) / self.img_size, Non...
[ "def", "evaluate", "(", "self", ",", "artifact", ")", ":", "if", "self", ".", "desired_novelty", ">", "0", ":", "return", "self", ".", "hedonic_value", "(", "self", ".", "novelty", "(", "artifact", ".", "obj", ")", ")", "return", "self", ".", "novelty"...
Evaluate the artifact with respect to the agents short term memory. Returns value in [0, 1].
[ "Evaluate", "the", "artifact", "with", "respect", "to", "the", "agents", "short", "term", "memory", "." ]
python
train
DS-100/nb-to-gradescope
gs100/converter.py
https://github.com/DS-100/nb-to-gradescope/blob/1a2b37753c4913689557328a796543a767eb3932/gs100/converter.py#L223-L248
def pad_pdf_pages(pdf_name, pages_per_q) -> None: """ Checks if PDF has the correct number of pages. If it has too many, warns the user. If it has too few, adds blank pages until the right length is reached. """ pdf = PyPDF2.PdfFileReader(pdf_name) output = PyPDF2.PdfFileWriter() num_pag...
[ "def", "pad_pdf_pages", "(", "pdf_name", ",", "pages_per_q", ")", "->", "None", ":", "pdf", "=", "PyPDF2", ".", "PdfFileReader", "(", "pdf_name", ")", "output", "=", "PyPDF2", ".", "PdfFileWriter", "(", ")", "num_pages", "=", "pdf", ".", "getNumPages", "("...
Checks if PDF has the correct number of pages. If it has too many, warns the user. If it has too few, adds blank pages until the right length is reached.
[ "Checks", "if", "PDF", "has", "the", "correct", "number", "of", "pages", ".", "If", "it", "has", "too", "many", "warns", "the", "user", ".", "If", "it", "has", "too", "few", "adds", "blank", "pages", "until", "the", "right", "length", "is", "reached", ...
python
train
bluedazzle/wechat_sender
wechat_sender/sender.py
https://github.com/bluedazzle/wechat_sender/blob/21d861735509153d6b34408157911c25a5d7018b/wechat_sender/sender.py#L107-L130
def periodic_send(self, content, interval, title=''): """ 发送周期消息 :param content: (必填|str) - 需要发送的消息内容 :param interval: (必填|int|datetime.timedelta) - 发送消息间隔时间,支持 datetime.timedelta 或 integer 表示的秒数 :param title: (选填|str) - 需要发送的消息标题 :return: * status:发送状态,True 发送成,False 发...
[ "def", "periodic_send", "(", "self", ",", "content", ",", "interval", ",", "title", "=", "''", ")", ":", "url", "=", "'{0}periodic_message'", ".", "format", "(", "self", ".", "remote", ")", "if", "isinstance", "(", "interval", ",", "datetime", ".", "time...
发送周期消息 :param content: (必填|str) - 需要发送的消息内容 :param interval: (必填|int|datetime.timedelta) - 发送消息间隔时间,支持 datetime.timedelta 或 integer 表示的秒数 :param title: (选填|str) - 需要发送的消息标题 :return: * status:发送状态,True 发送成,False 发送失败 * message:发送失败详情
[ "发送周期消息" ]
python
train
mozillazg/baidu-pcs-python-sdk
baidupcs/api.py
https://github.com/mozillazg/baidu-pcs-python-sdk/blob/12fe3f13b2ecda8f8bdcc5334c876e934776a5cc/baidupcs/api.py#L103-L135
def upload(self, remote_path, file_content, ondup=None, **kwargs): """上传单个文件(<2G). | 百度PCS服务目前支持最大2G的单个文件上传。 | 如需支持超大文件(>2G)的断点续传,请参考下面的“分片文件上传”方法。 :param remote_path: 网盘中文件的保存路径(包含文件名)。 必须以 /apps/ 开头。 .. warning:: ...
[ "def", "upload", "(", "self", ",", "remote_path", ",", "file_content", ",", "ondup", "=", "None", ",", "*", "*", "kwargs", ")", ":", "params", "=", "{", "'path'", ":", "remote_path", ",", "'ondup'", ":", "ondup", "}", "files", "=", "{", "'file'", ":"...
上传单个文件(<2G). | 百度PCS服务目前支持最大2G的单个文件上传。 | 如需支持超大文件(>2G)的断点续传,请参考下面的“分片文件上传”方法。 :param remote_path: 网盘中文件的保存路径(包含文件名)。 必须以 /apps/ 开头。 .. warning:: * 路径长度限制为1000; * 径中不能包含以下字符:...
[ "上传单个文件(<2G)", "." ]
python
train
DinoTools/python-overpy
overpy/__init__.py
https://github.com/DinoTools/python-overpy/blob/db8f80eeb1b4d1405816bd62c16ddb3364e0c46d/overpy/__init__.py#L1514-L1519
def _handle_end_way(self): """ Handle closing way element """ self._result.append(Way(result=self._result, **self._curr)) self._curr = {}
[ "def", "_handle_end_way", "(", "self", ")", ":", "self", ".", "_result", ".", "append", "(", "Way", "(", "result", "=", "self", ".", "_result", ",", "*", "*", "self", ".", "_curr", ")", ")", "self", ".", "_curr", "=", "{", "}" ]
Handle closing way element
[ "Handle", "closing", "way", "element" ]
python
train
mozilla/treeherder
treeherder/log_parser/parsers.py
https://github.com/mozilla/treeherder/blob/cc47bdec872e5c668d0f01df89517390a164cda3/treeherder/log_parser/parsers.py#L202-L211
def start_step(self, lineno, name="Unnamed step", timestamp=None): """Create a new step and update the state to reflect we're now in the middle of a step.""" self.state = self.STATES['step_in_progress'] self.stepnum += 1 self.steps.append({ "name": name, "started"...
[ "def", "start_step", "(", "self", ",", "lineno", ",", "name", "=", "\"Unnamed step\"", ",", "timestamp", "=", "None", ")", ":", "self", ".", "state", "=", "self", ".", "STATES", "[", "'step_in_progress'", "]", "self", ".", "stepnum", "+=", "1", "self", ...
Create a new step and update the state to reflect we're now in the middle of a step.
[ "Create", "a", "new", "step", "and", "update", "the", "state", "to", "reflect", "we", "re", "now", "in", "the", "middle", "of", "a", "step", "." ]
python
train
tensorflow/tensorboard
tensorboard/plugins/beholder/beholder.py
https://github.com/tensorflow/tensorboard/blob/8e5f497b48e40f2a774f85416b8a35ac0693c35e/tensorboard/plugins/beholder/beholder.py#L121-L127
def _enough_time_has_passed(self, FPS): '''For limiting how often frames are computed.''' if FPS == 0: return False else: earliest_time = self.last_update_time + (1.0 / FPS) return time.time() >= earliest_time
[ "def", "_enough_time_has_passed", "(", "self", ",", "FPS", ")", ":", "if", "FPS", "==", "0", ":", "return", "False", "else", ":", "earliest_time", "=", "self", ".", "last_update_time", "+", "(", "1.0", "/", "FPS", ")", "return", "time", ".", "time", "(...
For limiting how often frames are computed.
[ "For", "limiting", "how", "often", "frames", "are", "computed", "." ]
python
train
mozilla-services/pyramid_multiauth
pyramid_multiauth/__init__.py
https://github.com/mozilla-services/pyramid_multiauth/blob/9548aa55f726920a666791d7c89ac2b9779d2bc1/pyramid_multiauth/__init__.py#L188-L290
def includeme(config): """Include pyramid_multiauth into a pyramid configurator. This function provides a hook for pyramid to include the default settings for auth via pyramid_multiauth. Activate it like so: config.include("pyramid_multiauth") This will pull the list of registered authn poli...
[ "def", "includeme", "(", "config", ")", ":", "# Grab the pyramid-wide settings, to look for any auth config.", "settings", "=", "config", ".", "get_settings", "(", ")", "# Hook up a default AuthorizationPolicy.", "# Get the authorization policy from config if present.", "# Default AC...
Include pyramid_multiauth into a pyramid configurator. This function provides a hook for pyramid to include the default settings for auth via pyramid_multiauth. Activate it like so: config.include("pyramid_multiauth") This will pull the list of registered authn policies from the deployment s...
[ "Include", "pyramid_multiauth", "into", "a", "pyramid", "configurator", "." ]
python
train
saltstack/salt
salt/states/infoblox_range.py
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/infoblox_range.py#L143-L191
def absent(name=None, start_addr=None, end_addr=None, data=None, **api_opts): ''' Ensure the range is removed Supplying the end of the range is optional. State example: .. code-block:: yaml infoblox_range.absent: - name: 'vlan10' infoblox_range.absent: - ...
[ "def", "absent", "(", "name", "=", "None", ",", "start_addr", "=", "None", ",", "end_addr", "=", "None", ",", "data", "=", "None", ",", "*", "*", "api_opts", ")", ":", "ret", "=", "{", "'name'", ":", "name", ",", "'result'", ":", "False", ",", "'...
Ensure the range is removed Supplying the end of the range is optional. State example: .. code-block:: yaml infoblox_range.absent: - name: 'vlan10' infoblox_range.absent: - name: - start_addr: 127.0.1.20
[ "Ensure", "the", "range", "is", "removed" ]
python
train
pandas-dev/pandas
pandas/io/pytables.py
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/io/pytables.py#L3130-L3133
def validate_metadata(self, existing): """ create / validate metadata """ self.metadata = [ c.name for c in self.values_axes if c.metadata is not None]
[ "def", "validate_metadata", "(", "self", ",", "existing", ")", ":", "self", ".", "metadata", "=", "[", "c", ".", "name", "for", "c", "in", "self", ".", "values_axes", "if", "c", ".", "metadata", "is", "not", "None", "]" ]
create / validate metadata
[ "create", "/", "validate", "metadata" ]
python
train
jmbhughes/suvi-trainer
suvitrainer/gui.py
https://github.com/jmbhughes/suvi-trainer/blob/3d89894a4a037286221974c7eb5634d229b4f5d4/suvitrainer/gui.py#L279-L290
def updateArray(self, array, indices, value): """ updates array so that pixels at indices take on value :param array: (m,n) array to adjust :param indices: flattened image indices to change value :param value: new value to assign :return: the changed (m,n) array "...
[ "def", "updateArray", "(", "self", ",", "array", ",", "indices", ",", "value", ")", ":", "lin", "=", "np", ".", "arange", "(", "array", ".", "size", ")", "new_array", "=", "array", ".", "flatten", "(", ")", "new_array", "[", "lin", "[", "indices", ...
updates array so that pixels at indices take on value :param array: (m,n) array to adjust :param indices: flattened image indices to change value :param value: new value to assign :return: the changed (m,n) array
[ "updates", "array", "so", "that", "pixels", "at", "indices", "take", "on", "value", ":", "param", "array", ":", "(", "m", "n", ")", "array", "to", "adjust", ":", "param", "indices", ":", "flattened", "image", "indices", "to", "change", "value", ":", "p...
python
train
gwastro/pycbc-glue
pycbc_glue/ligolw/lsctables.py
https://github.com/gwastro/pycbc-glue/blob/a3e906bae59fbfd707c3ff82e5d008d939ec5e24/pycbc_glue/ligolw/lsctables.py#L546-L562
def get_in_segmentlistdict(self, process_ids = None): """ Return a segmentlistdict mapping instrument to in segment list. If process_ids is a sequence of process IDs, then only rows with matching IDs are included otherwise all rows are included. Note: the result is not coalesced, each segmentlist conta...
[ "def", "get_in_segmentlistdict", "(", "self", ",", "process_ids", "=", "None", ")", ":", "seglists", "=", "segments", ".", "segmentlistdict", "(", ")", "for", "row", "in", "self", ":", "ifos", "=", "row", ".", "instruments", "or", "(", "None", ",", ")", ...
Return a segmentlistdict mapping instrument to in segment list. If process_ids is a sequence of process IDs, then only rows with matching IDs are included otherwise all rows are included. Note: the result is not coalesced, each segmentlist contains the segments listed for that instrument as they appeared...
[ "Return", "a", "segmentlistdict", "mapping", "instrument", "to", "in", "segment", "list", ".", "If", "process_ids", "is", "a", "sequence", "of", "process", "IDs", "then", "only", "rows", "with", "matching", "IDs", "are", "included", "otherwise", "all", "rows",...
python
train
rigetti/pyquil
pyquil/noise.py
https://github.com/rigetti/pyquil/blob/ec98e453084b0037d69d8c3245f6822a5422593d/pyquil/noise.py#L167-L175
def gates_by_name(self, name): """ Return all defined noisy gates of a particular gate name. :param str name: The gate name. :return: A list of noise models representing that gate. :rtype: Sequence[KrausModel] """ return [g for g in self.gates if g.gate == name]
[ "def", "gates_by_name", "(", "self", ",", "name", ")", ":", "return", "[", "g", "for", "g", "in", "self", ".", "gates", "if", "g", ".", "gate", "==", "name", "]" ]
Return all defined noisy gates of a particular gate name. :param str name: The gate name. :return: A list of noise models representing that gate. :rtype: Sequence[KrausModel]
[ "Return", "all", "defined", "noisy", "gates", "of", "a", "particular", "gate", "name", "." ]
python
train
odlgroup/odl
odl/discr/discr_mappings.py
https://github.com/odlgroup/odl/blob/b8443f6aca90e191ba36c91d32253c5a36249a6c/odl/discr/discr_mappings.py#L559-L590
def _call(self, x, out=None): """Create an interpolator from grid values ``x``. Parameters ---------- x : `Tensor` The array of values to be interpolated out : `FunctionSpaceElement`, optional Element in which to store the interpolator Returns ...
[ "def", "_call", "(", "self", ",", "x", ",", "out", "=", "None", ")", ":", "def", "per_axis_interp", "(", "arg", ",", "out", "=", "None", ")", ":", "\"\"\"Interpolating function with vectorization.\"\"\"", "if", "is_valid_input_meshgrid", "(", "arg", ",", "self...
Create an interpolator from grid values ``x``. Parameters ---------- x : `Tensor` The array of values to be interpolated out : `FunctionSpaceElement`, optional Element in which to store the interpolator Returns ------- out : `FunctionSpac...
[ "Create", "an", "interpolator", "from", "grid", "values", "x", "." ]
python
train
jonathf/chaospy
chaospy/quad/collection/leja.py
https://github.com/jonathf/chaospy/blob/25ecfa7bf5608dc10c0b31d142ded0e3755f5d74/chaospy/quad/collection/leja.py#L79-L87
def create_objective(dist, abscissas): """Create objective function.""" abscissas_ = numpy.array(abscissas[1:-1]) def obj(absisa): """Local objective function.""" out = -numpy.sqrt(dist.pdf(absisa)) out *= numpy.prod(numpy.abs(abscissas_ - absisa)) return out return obj
[ "def", "create_objective", "(", "dist", ",", "abscissas", ")", ":", "abscissas_", "=", "numpy", ".", "array", "(", "abscissas", "[", "1", ":", "-", "1", "]", ")", "def", "obj", "(", "absisa", ")", ":", "\"\"\"Local objective function.\"\"\"", "out", "=", ...
Create objective function.
[ "Create", "objective", "function", "." ]
python
train
aws/aws-dynamodb-encryption-python
src/dynamodb_encryption_sdk/internal/crypto/jce_bridge/primitives.py
https://github.com/aws/aws-dynamodb-encryption-python/blob/8de3bbe13df39c59b21bf431010f7acfcf629a2f/src/dynamodb_encryption_sdk/internal/crypto/jce_bridge/primitives.py#L296-L300
def _disable_encryption(self): # () -> None """Enable encryption methods for ciphers that support them.""" self.encrypt = self._disabled_encrypt self.decrypt = self._disabled_decrypt
[ "def", "_disable_encryption", "(", "self", ")", ":", "# () -> None", "self", ".", "encrypt", "=", "self", ".", "_disabled_encrypt", "self", ".", "decrypt", "=", "self", ".", "_disabled_decrypt" ]
Enable encryption methods for ciphers that support them.
[ "Enable", "encryption", "methods", "for", "ciphers", "that", "support", "them", "." ]
python
train
justquick/django-activity-stream
actstream/templatetags/activity_tags.py
https://github.com/justquick/django-activity-stream/blob/a1e06f2e6429cc5fc321e7801440dd7c5b9d5a35/actstream/templatetags/activity_tags.py#L226-L241
def actor_url(parser, token): """ Renders the URL for a particular actor instance :: <a href="{% actor_url request.user %}">View your actions</a> <a href="{% actor_url another_user %}">{{ another_user }}'s actions</a> """ bits = token.split_contents() if len(bits) != 2: ...
[ "def", "actor_url", "(", "parser", ",", "token", ")", ":", "bits", "=", "token", ".", "split_contents", "(", ")", "if", "len", "(", "bits", ")", "!=", "2", ":", "raise", "TemplateSyntaxError", "(", "\"Accepted format \"", "\"{% actor_url [actor_instance] %}\"", ...
Renders the URL for a particular actor instance :: <a href="{% actor_url request.user %}">View your actions</a> <a href="{% actor_url another_user %}">{{ another_user }}'s actions</a>
[ "Renders", "the", "URL", "for", "a", "particular", "actor", "instance" ]
python
train
AndrewAnnex/SpiceyPy
spiceypy/spiceypy.py
https://github.com/AndrewAnnex/SpiceyPy/blob/fc20a9b9de68b58eed5b332f0c051fb343a6e335/spiceypy/spiceypy.py#L15204-L15230
def vtmvg(v1, matrix, v2, nrow, ncol): """ Multiply the transpose of a n-dimensional column vector a nxm matrix, and a m-dimensional column vector. http://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/vtmvg_c.html :param v1: n-dimensional double precision column vector. :type v1: Array...
[ "def", "vtmvg", "(", "v1", ",", "matrix", ",", "v2", ",", "nrow", ",", "ncol", ")", ":", "v1", "=", "stypes", ".", "toDoubleVector", "(", "v1", ")", "matrix", "=", "stypes", ".", "toDoubleMatrix", "(", "matrix", ")", "v2", "=", "stypes", ".", "toDo...
Multiply the transpose of a n-dimensional column vector a nxm matrix, and a m-dimensional column vector. http://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/vtmvg_c.html :param v1: n-dimensional double precision column vector. :type v1: Array of floats :param matrix: nxm double precision ...
[ "Multiply", "the", "transpose", "of", "a", "n", "-", "dimensional", "column", "vector", "a", "nxm", "matrix", "and", "a", "m", "-", "dimensional", "column", "vector", "." ]
python
train
dwavesystems/dimod
dimod/binary_quadratic_model.py
https://github.com/dwavesystems/dimod/blob/beff1b7f86b559d923ac653c1de6d593876d6d38/dimod/binary_quadratic_model.py#L293-L339
def spin(self): """:class:`.BinaryQuadraticModel`: An instance of the Ising model subclass of the :class:`.BinaryQuadraticModel` superclass, corresponding to a binary quadratic model with spins as its variables. Enables access to biases for the spin-valued binary quadratic model ...
[ "def", "spin", "(", "self", ")", ":", "# NB: The existence of the _spin property implies that it is up to date, methods that", "# invalidate it will erase the property", "try", ":", "spin", "=", "self", ".", "_spin", "if", "spin", "is", "not", "None", ":", "return", "spin...
:class:`.BinaryQuadraticModel`: An instance of the Ising model subclass of the :class:`.BinaryQuadraticModel` superclass, corresponding to a binary quadratic model with spins as its variables. Enables access to biases for the spin-valued binary quadratic model regardless of the :class:`...
[ ":", "class", ":", ".", "BinaryQuadraticModel", ":", "An", "instance", "of", "the", "Ising", "model", "subclass", "of", "the", ":", "class", ":", ".", "BinaryQuadraticModel", "superclass", "corresponding", "to", "a", "binary", "quadratic", "model", "with", "sp...
python
train
chrisjrn/registrasion
registrasion/controllers/invoice.py
https://github.com/chrisjrn/registrasion/blob/461d5846c6f9f3b7099322a94f5d9911564448e4/registrasion/controllers/invoice.py#L247-L251
def _refresh(self): ''' Refreshes the underlying invoice and cart objects. ''' self.invoice.refresh_from_db() if self.invoice.cart: self.invoice.cart.refresh_from_db()
[ "def", "_refresh", "(", "self", ")", ":", "self", ".", "invoice", ".", "refresh_from_db", "(", ")", "if", "self", ".", "invoice", ".", "cart", ":", "self", ".", "invoice", ".", "cart", ".", "refresh_from_db", "(", ")" ]
Refreshes the underlying invoice and cart objects.
[ "Refreshes", "the", "underlying", "invoice", "and", "cart", "objects", "." ]
python
test
CodeReclaimers/neat-python
examples/xor/visualize.py
https://github.com/CodeReclaimers/neat-python/blob/e3dbe77c0d776eae41d598e6439e6ac02ab90b18/examples/xor/visualize.py#L42-L88
def plot_spikes(spikes, view=False, filename=None, title=None): """ Plots the trains for a single spiking neuron. """ t_values = [t for t, I, v, u, f in spikes] v_values = [v for t, I, v, u, f in spikes] u_values = [u for t, I, v, u, f in spikes] I_values = [I for t, I, v, u, f in spikes] f_valu...
[ "def", "plot_spikes", "(", "spikes", ",", "view", "=", "False", ",", "filename", "=", "None", ",", "title", "=", "None", ")", ":", "t_values", "=", "[", "t", "for", "t", ",", "I", ",", "v", ",", "u", ",", "f", "in", "spikes", "]", "v_values", "...
Plots the trains for a single spiking neuron.
[ "Plots", "the", "trains", "for", "a", "single", "spiking", "neuron", "." ]
python
train
shexSpec/grammar
parsers/python/pyshexc/parser_impl/shex_shape_definition_parser.py
https://github.com/shexSpec/grammar/blob/4497cd1f73fa6703bca6e2cb53ba9c120f22e48c/parsers/python/pyshexc/parser_impl/shex_shape_definition_parser.py#L45-L62
def visitShapeDefinition(self, ctx: ShExDocParser.ShapeDefinitionContext): """ shapeDefinition: qualifier* '{' oneOfShape? '}' annotation* semanticActions """ if ctx.qualifier(): for q in ctx.qualifier(): self.visit(q) if ctx.oneOfShape(): oneof_parser = S...
[ "def", "visitShapeDefinition", "(", "self", ",", "ctx", ":", "ShExDocParser", ".", "ShapeDefinitionContext", ")", ":", "if", "ctx", ".", "qualifier", "(", ")", ":", "for", "q", "in", "ctx", ".", "qualifier", "(", ")", ":", "self", ".", "visit", "(", "q...
shapeDefinition: qualifier* '{' oneOfShape? '}' annotation* semanticActions
[ "shapeDefinition", ":", "qualifier", "*", "{", "oneOfShape?", "}", "annotation", "*", "semanticActions" ]
python
train
skorch-dev/skorch
skorch/net.py
https://github.com/skorch-dev/skorch/blob/5b9b8b7b7712cb6e5aaa759d9608ea6269d5bcd3/skorch/net.py#L1645-L1660
def load_history(self, f): """Load the history of a ``NeuralNet`` from a json file. See ``save_history`` for examples. Parameters ---------- f : file-like object or str """ # TODO: Remove warning in a future release warnings.warn( "load_histo...
[ "def", "load_history", "(", "self", ",", "f", ")", ":", "# TODO: Remove warning in a future release", "warnings", ".", "warn", "(", "\"load_history is deprecated and will be removed in the next \"", "\"release, please use load_params with the f_history keyword\"", ",", "DeprecationWa...
Load the history of a ``NeuralNet`` from a json file. See ``save_history`` for examples. Parameters ---------- f : file-like object or str
[ "Load", "the", "history", "of", "a", "NeuralNet", "from", "a", "json", "file", ".", "See", "save_history", "for", "examples", "." ]
python
train
pioneers/python-grizzly
grizzly/__init__.py
https://github.com/pioneers/python-grizzly/blob/a6482c722d5712d6ebe12d48921815276c826c7f/grizzly/__init__.py#L231-L240
def has_reset(self): """Checks the grizzly to see if it reset itself because of voltage sag or other reasons. Useful to reinitialize acceleration or current limiting.""" currentTime = self._read_as_int(Addr.Uptime, 4) if currentTime <= self._ticks: self._ticks = curre...
[ "def", "has_reset", "(", "self", ")", ":", "currentTime", "=", "self", ".", "_read_as_int", "(", "Addr", ".", "Uptime", ",", "4", ")", "if", "currentTime", "<=", "self", ".", "_ticks", ":", "self", ".", "_ticks", "=", "currentTime", "return", "True", "...
Checks the grizzly to see if it reset itself because of voltage sag or other reasons. Useful to reinitialize acceleration or current limiting.
[ "Checks", "the", "grizzly", "to", "see", "if", "it", "reset", "itself", "because", "of", "voltage", "sag", "or", "other", "reasons", ".", "Useful", "to", "reinitialize", "acceleration", "or", "current", "limiting", "." ]
python
train
CivicSpleen/ambry
ambry/jupyter.py
https://github.com/CivicSpleen/ambry/blob/d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42/ambry/jupyter.py#L12-L20
def warehouse_query(line, cell): "my cell magic" from IPython import get_ipython parts = line.split() w_var_name = parts.pop(0) w = get_ipython().ev(w_var_name) w.query(cell).close()
[ "def", "warehouse_query", "(", "line", ",", "cell", ")", ":", "from", "IPython", "import", "get_ipython", "parts", "=", "line", ".", "split", "(", ")", "w_var_name", "=", "parts", ".", "pop", "(", "0", ")", "w", "=", "get_ipython", "(", ")", ".", "ev...
my cell magic
[ "my", "cell", "magic" ]
python
train
estnltk/estnltk
estnltk/text.py
https://github.com/estnltk/estnltk/blob/28ae334a68a0673072febc318635f04da0dcc54a/estnltk/text.py#L1094-L1098
def verb_chain_starts(self): """The start positions of ``verb_chains`` elements.""" if not self.is_tagged(VERB_CHAINS): self.tag_verb_chains() return self.starts(VERB_CHAINS)
[ "def", "verb_chain_starts", "(", "self", ")", ":", "if", "not", "self", ".", "is_tagged", "(", "VERB_CHAINS", ")", ":", "self", ".", "tag_verb_chains", "(", ")", "return", "self", ".", "starts", "(", "VERB_CHAINS", ")" ]
The start positions of ``verb_chains`` elements.
[ "The", "start", "positions", "of", "verb_chains", "elements", "." ]
python
train
Accelize/pycosio
pycosio/_core/io_base_raw.py
https://github.com/Accelize/pycosio/blob/1cc1f8fdf5394d92918b7bae2bfa682169ccc48c/pycosio/_core/io_base_raw.py#L262-L284
def readall(self): """ Read and return all the bytes from the stream until EOF. Returns: bytes: Object content """ if not self._readable: raise UnsupportedOperation('read') with self._seek_lock: # Get data starting from seek ...
[ "def", "readall", "(", "self", ")", ":", "if", "not", "self", ".", "_readable", ":", "raise", "UnsupportedOperation", "(", "'read'", ")", "with", "self", ".", "_seek_lock", ":", "# Get data starting from seek", "with", "handle_os_exceptions", "(", ")", ":", "i...
Read and return all the bytes from the stream until EOF. Returns: bytes: Object content
[ "Read", "and", "return", "all", "the", "bytes", "from", "the", "stream", "until", "EOF", "." ]
python
train
genialis/resolwe
resolwe/flow/managers/workload_connectors/slurm.py
https://github.com/genialis/resolwe/blob/f7bb54932c81ec0cfc5b5e80d238fceaeaa48d86/resolwe/flow/managers/workload_connectors/slurm.py#L29-L73
def submit(self, data, runtime_dir, argv): """Run process with SLURM. For details, see :meth:`~resolwe.flow.managers.workload_connectors.base.BaseConnector.submit`. """ limits = data.process.get_resource_limits() logger.debug(__( "Connector '{}' running for D...
[ "def", "submit", "(", "self", ",", "data", ",", "runtime_dir", ",", "argv", ")", ":", "limits", "=", "data", ".", "process", ".", "get_resource_limits", "(", ")", "logger", ".", "debug", "(", "__", "(", "\"Connector '{}' running for Data with id {} ({}).\"", "...
Run process with SLURM. For details, see :meth:`~resolwe.flow.managers.workload_connectors.base.BaseConnector.submit`.
[ "Run", "process", "with", "SLURM", "." ]
python
train
manns/pyspread
pyspread/src/actions/_grid_actions.py
https://github.com/manns/pyspread/blob/0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0/pyspread/src/actions/_grid_actions.py#L1251-L1280
def zoom_fit(self): """Zooms the rid to fit the window. Only has an effect if the resulting zoom level is between minimum and maximum zoom level. """ zoom = self.grid.grid_renderer.zoom grid_width, grid_height = self.grid.GetSize() rows_height = self._get_row...
[ "def", "zoom_fit", "(", "self", ")", ":", "zoom", "=", "self", ".", "grid", ".", "grid_renderer", ".", "zoom", "grid_width", ",", "grid_height", "=", "self", ".", "grid", ".", "GetSize", "(", ")", "rows_height", "=", "self", ".", "_get_rows_height", "(",...
Zooms the rid to fit the window. Only has an effect if the resulting zoom level is between minimum and maximum zoom level.
[ "Zooms", "the", "rid", "to", "fit", "the", "window", "." ]
python
train
aleju/imgaug
imgaug/external/poly_point_isect.py
https://github.com/aleju/imgaug/blob/786be74aa855513840113ea523c5df495dc6a8af/imgaug/external/poly_point_isect.py#L514-L529
def offer(self, p, e: Event): """ Offer a new event ``s`` at point ``p`` in this queue. """ existing = self.events_scan.setdefault( p, ([], [], [], []) if USE_VERTICAL else ([], [], [])) # Can use double linked-list for easy insertion at beginni...
[ "def", "offer", "(", "self", ",", "p", ",", "e", ":", "Event", ")", ":", "existing", "=", "self", ".", "events_scan", ".", "setdefault", "(", "p", ",", "(", "[", "]", ",", "[", "]", ",", "[", "]", ",", "[", "]", ")", "if", "USE_VERTICAL", "el...
Offer a new event ``s`` at point ``p`` in this queue.
[ "Offer", "a", "new", "event", "s", "at", "point", "p", "in", "this", "queue", "." ]
python
valid
inveniosoftware/invenio-pidrelations
invenio_pidrelations/serializers/schemas.py
https://github.com/inveniosoftware/invenio-pidrelations/blob/a49f3725cf595b663c5b04814280b231f88bc333/invenio_pidrelations/serializers/schemas.py#L88-L102
def dump_is_last(self, obj): """Dump the boolean stating if the child in the relation is last. Dumps `None` for parent serialization. """ if self._is_child(obj) and isinstance(obj, PIDNodeOrdered): if obj.children.count() > 0: return obj.children.ordered('asc...
[ "def", "dump_is_last", "(", "self", ",", "obj", ")", ":", "if", "self", ".", "_is_child", "(", "obj", ")", "and", "isinstance", "(", "obj", ",", "PIDNodeOrdered", ")", ":", "if", "obj", ".", "children", ".", "count", "(", ")", ">", "0", ":", "retur...
Dump the boolean stating if the child in the relation is last. Dumps `None` for parent serialization.
[ "Dump", "the", "boolean", "stating", "if", "the", "child", "in", "the", "relation", "is", "last", "." ]
python
train
tensorpack/tensorpack
examples/FasterRCNN/utils/np_box_ops.py
https://github.com/tensorpack/tensorpack/blob/d7a13cb74c9066bc791d7aafc3b744b60ee79a9f/examples/FasterRCNN/utils/np_box_ops.py#L63-L78
def iou(boxes1, boxes2): """Computes pairwise intersection-over-union between box collections. Args: boxes1: a numpy array with shape [N, 4] holding N boxes. boxes2: a numpy array with shape [M, 4] holding M boxes. Returns: a numpy array with shape [N, M] representing pairwise iou scores. """ in...
[ "def", "iou", "(", "boxes1", ",", "boxes2", ")", ":", "intersect", "=", "intersection", "(", "boxes1", ",", "boxes2", ")", "area1", "=", "area", "(", "boxes1", ")", "area2", "=", "area", "(", "boxes2", ")", "union", "=", "np", ".", "expand_dims", "("...
Computes pairwise intersection-over-union between box collections. Args: boxes1: a numpy array with shape [N, 4] holding N boxes. boxes2: a numpy array with shape [M, 4] holding M boxes. Returns: a numpy array with shape [N, M] representing pairwise iou scores.
[ "Computes", "pairwise", "intersection", "-", "over", "-", "union", "between", "box", "collections", "." ]
python
train
shoebot/shoebot
shoebot/core/cairo_sink.py
https://github.com/shoebot/shoebot/blob/d554c1765c1899fa25727c9fc6805d221585562b/shoebot/core/cairo_sink.py#L96-L104
def rendering_finished(self, size, frame, cairo_ctx): """ Called when CairoCanvas has rendered a bot """ surface = cairo_ctx.get_target() if self.format == 'png': surface.write_to_png(self._output_file(frame)) surface.finish() surface.flush()
[ "def", "rendering_finished", "(", "self", ",", "size", ",", "frame", ",", "cairo_ctx", ")", ":", "surface", "=", "cairo_ctx", ".", "get_target", "(", ")", "if", "self", ".", "format", "==", "'png'", ":", "surface", ".", "write_to_png", "(", "self", ".", ...
Called when CairoCanvas has rendered a bot
[ "Called", "when", "CairoCanvas", "has", "rendered", "a", "bot" ]
python
valid
toumorokoshi/sprinter
sprinter/next/environment/injections.py
https://github.com/toumorokoshi/sprinter/blob/846697a7a087e69c61d075232e754d6975a64152/sprinter/next/environment/injections.py#L42-L48
def inject(self, filename, content): """ add the injection content to the dictionary """ # ensure content always has one trailing newline content = _unicode(content).rstrip() + "\n" if filename not in self.inject_dict: self.inject_dict[filename] = "" self.inject_dict[...
[ "def", "inject", "(", "self", ",", "filename", ",", "content", ")", ":", "# ensure content always has one trailing newline", "content", "=", "_unicode", "(", "content", ")", ".", "rstrip", "(", ")", "+", "\"\\n\"", "if", "filename", "not", "in", "self", ".", ...
add the injection content to the dictionary
[ "add", "the", "injection", "content", "to", "the", "dictionary" ]
python
train
ray-project/ray
python/ray/monitor.py
https://github.com/ray-project/ray/blob/4eade036a0505e244c976f36aaa2d64386b5129b/python/ray/monitor.py#L295-L325
def run(self): """Run the monitor. This function loops forever, checking for messages about dead database clients and cleaning up state accordingly. """ # Initialize the subscription channel. self.subscribe(ray.gcs_utils.XRAY_HEARTBEAT_BATCH_CHANNEL) self.subscri...
[ "def", "run", "(", "self", ")", ":", "# Initialize the subscription channel.", "self", ".", "subscribe", "(", "ray", ".", "gcs_utils", ".", "XRAY_HEARTBEAT_BATCH_CHANNEL", ")", "self", ".", "subscribe", "(", "ray", ".", "gcs_utils", ".", "XRAY_DRIVER_CHANNEL", ")"...
Run the monitor. This function loops forever, checking for messages about dead database clients and cleaning up state accordingly.
[ "Run", "the", "monitor", "." ]
python
train
ZELLMECHANIK-DRESDEN/dclab
dclab/kde_methods.py
https://github.com/ZELLMECHANIK-DRESDEN/dclab/blob/79002c4356e7020c2ba73ab0a3819c9abd4affec/dclab/kde_methods.py#L23-L39
def bin_width_doane(a): """Compute accuracy (bin width) based on Doane's formula References ---------- - `<https://en.wikipedia.org/wiki/Histogram#Number_of_bins_and_width>`_ - `<https://stats.stackexchange.com/questions/55134/ doanes-formula-for-histogram-binning>`_ """ bad = np.isna...
[ "def", "bin_width_doane", "(", "a", ")", ":", "bad", "=", "np", ".", "isnan", "(", "a", ")", "|", "np", ".", "isinf", "(", "a", ")", "data", "=", "a", "[", "~", "bad", "]", "n", "=", "data", ".", "size", "g1", "=", "skew", "(", "data", ")",...
Compute accuracy (bin width) based on Doane's formula References ---------- - `<https://en.wikipedia.org/wiki/Histogram#Number_of_bins_and_width>`_ - `<https://stats.stackexchange.com/questions/55134/ doanes-formula-for-histogram-binning>`_
[ "Compute", "accuracy", "(", "bin", "width", ")", "based", "on", "Doane", "s", "formula" ]
python
train
interedition/collatex
collatex-pythonport/ClusterShell/RangeSet.py
https://github.com/interedition/collatex/blob/76dd1fcc36047bc66a87d31142e72e98b5347821/collatex-pythonport/ClusterShell/RangeSet.py#L271-L283
def _strslices(self): """Stringify slices list (x-y/step format)""" pad = self.padding or 0 for sli in self.slices(): if sli.start + 1 == sli.stop: yield "%0*d" % (pad, sli.start) else: assert sli.step >= 0, "Internal error: sli.step < 0" ...
[ "def", "_strslices", "(", "self", ")", ":", "pad", "=", "self", ".", "padding", "or", "0", "for", "sli", "in", "self", ".", "slices", "(", ")", ":", "if", "sli", ".", "start", "+", "1", "==", "sli", ".", "stop", ":", "yield", "\"%0*d\"", "%", "...
Stringify slices list (x-y/step format)
[ "Stringify", "slices", "list", "(", "x", "-", "y", "/", "step", "format", ")" ]
python
train
mmp2/megaman
megaman/relaxation/trace_variable.py
https://github.com/mmp2/megaman/blob/faccaf267aad0a8b18ec8a705735fd9dd838ca1e/megaman/relaxation/trace_variable.py#L36-L55
def report_and_save_keywords(self,relaxation_kwds,precomputed_kwds): """Save relaxation keywords to .txt and .pyc file""" report_name = os.path.join(self.backup_dir,'relaxation_keywords.txt') pretty_relax_kwds = pprint.pformat(relaxation_kwds,indent=4) with open(report_name,'w') as wf: ...
[ "def", "report_and_save_keywords", "(", "self", ",", "relaxation_kwds", ",", "precomputed_kwds", ")", ":", "report_name", "=", "os", ".", "path", ".", "join", "(", "self", ".", "backup_dir", ",", "'relaxation_keywords.txt'", ")", "pretty_relax_kwds", "=", "pprint"...
Save relaxation keywords to .txt and .pyc file
[ "Save", "relaxation", "keywords", "to", ".", "txt", "and", ".", "pyc", "file" ]
python
train
inveniosoftware/invenio-github
invenio_github/tasks.py
https://github.com/inveniosoftware/invenio-github/blob/ec42fd6a06079310dcbe2c46d9fd79d5197bbe26/invenio_github/tasks.py#L87-L143
def process_release(release_id, verify_sender=False): """Process a received Release.""" from invenio_db import db from invenio_rest.errors import RESTException from .errors import InvalidSenderError from .models import Release, ReleaseStatus from .proxies import current_github release_mode...
[ "def", "process_release", "(", "release_id", ",", "verify_sender", "=", "False", ")", ":", "from", "invenio_db", "import", "db", "from", "invenio_rest", ".", "errors", "import", "RESTException", "from", ".", "errors", "import", "InvalidSenderError", "from", ".", ...
Process a received Release.
[ "Process", "a", "received", "Release", "." ]
python
train
pydata/xarray
xarray/core/utils.py
https://github.com/pydata/xarray/blob/6d93a95d05bdbfc33fff24064f67d29dd891ab58/xarray/core/utils.py#L258-L265
def to_0d_array(value: Any) -> np.ndarray: """Given a value, wrap it in a 0-D numpy.ndarray. """ if np.isscalar(value) or (isinstance(value, np.ndarray) and value.ndim == 0): return np.array(value) else: return to_0d_object_array(value)
[ "def", "to_0d_array", "(", "value", ":", "Any", ")", "->", "np", ".", "ndarray", ":", "if", "np", ".", "isscalar", "(", "value", ")", "or", "(", "isinstance", "(", "value", ",", "np", ".", "ndarray", ")", "and", "value", ".", "ndim", "==", "0", "...
Given a value, wrap it in a 0-D numpy.ndarray.
[ "Given", "a", "value", "wrap", "it", "in", "a", "0", "-", "D", "numpy", ".", "ndarray", "." ]
python
train
cmbruns/pyopenvr
src/openvr/__init__.py
https://github.com/cmbruns/pyopenvr/blob/68395d26bb3df6ab1f0f059c38d441f962938be6/src/openvr/__init__.py#L5796-L5813
def submitScreenshot(self, screenshotHandle, type_, pchSourcePreviewFilename, pchSourceVRFilename): """ Submit the completed screenshot. If Steam is running this will call into the Steam client and upload the screenshot to the screenshots section of the library for the runnin...
[ "def", "submitScreenshot", "(", "self", ",", "screenshotHandle", ",", "type_", ",", "pchSourcePreviewFilename", ",", "pchSourceVRFilename", ")", ":", "fn", "=", "self", ".", "function_table", ".", "submitScreenshot", "result", "=", "fn", "(", "screenshotHandle", "...
Submit the completed screenshot. If Steam is running this will call into the Steam client and upload the screenshot to the screenshots section of the library for the running application. If Steam is not running, this function will display a notification to the user that the ...
[ "Submit", "the", "completed", "screenshot", ".", "If", "Steam", "is", "running", "this", "will", "call", "into", "the", "Steam", "client", "and", "upload", "the", "screenshot", "to", "the", "screenshots", "section", "of", "the", "library", "for", "the", "run...
python
train