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
openpaperwork/paperwork-backend
paperwork_backend/common/page.py
https://github.com/openpaperwork/paperwork-backend/blob/114b831e94e039e68b339751fd18250877abad76/paperwork_backend/common/page.py#L272-L282
def __get_keywords(self): """ Get all the keywords related of this page Returns: An array of strings """ txt = self.text for line in txt: for word in split_words(line): yield(word)
[ "def", "__get_keywords", "(", "self", ")", ":", "txt", "=", "self", ".", "text", "for", "line", "in", "txt", ":", "for", "word", "in", "split_words", "(", "line", ")", ":", "yield", "(", "word", ")" ]
Get all the keywords related of this page Returns: An array of strings
[ "Get", "all", "the", "keywords", "related", "of", "this", "page" ]
python
train
RI-imaging/qpformat
qpformat/file_formats/series_hdf5_hyperspy.py
https://github.com/RI-imaging/qpformat/blob/364e29d7d9e8b9f1d7a4a25c753d1baf9d73d5eb/qpformat/file_formats/series_hdf5_hyperspy.py#L101-L113
def verify(path): """Verify that `path` has the HyperSpy file format""" valid = False try: h5 = h5py.File(path, mode="r") except (OSError, IsADirectoryError): pass else: if ("file_format" in h5.attrs and h5.attrs["file_format"]....
[ "def", "verify", "(", "path", ")", ":", "valid", "=", "False", "try", ":", "h5", "=", "h5py", ".", "File", "(", "path", ",", "mode", "=", "\"r\"", ")", "except", "(", "OSError", ",", "IsADirectoryError", ")", ":", "pass", "else", ":", "if", "(", ...
Verify that `path` has the HyperSpy file format
[ "Verify", "that", "path", "has", "the", "HyperSpy", "file", "format" ]
python
train
fhcrc/seqmagick
seqmagick/transform.py
https://github.com/fhcrc/seqmagick/blob/1642bb87ba5c171fbd307f9da0f8a0ee1d69d5ed/seqmagick/transform.py#L242-L254
def cut_sequences_relative(records, slices, record_id): """ Cuts records to slices, indexed by non-gap positions in record_id """ with _record_buffer(records) as r: try: record = next(i for i in r() if i.id == record_id) except StopIteration: raise ValueError("Rec...
[ "def", "cut_sequences_relative", "(", "records", ",", "slices", ",", "record_id", ")", ":", "with", "_record_buffer", "(", "records", ")", "as", "r", ":", "try", ":", "record", "=", "next", "(", "i", "for", "i", "in", "r", "(", ")", "if", "i", ".", ...
Cuts records to slices, indexed by non-gap positions in record_id
[ "Cuts", "records", "to", "slices", "indexed", "by", "non", "-", "gap", "positions", "in", "record_id" ]
python
train
BlackEarth/bf
bf/pdf.py
https://github.com/BlackEarth/bf/blob/376041168874bbd6dee5ccfeece4a9e553223316/bf/pdf.py#L11-L60
def gswrite(self, fn=None, device='jpeg', res=600, alpha=4, quality=90, gs=None): "use ghostscript to create output file(s) from the PDF" gs = (gs or self.gs or os.environ.get('gs') or 'gs') # count the number of pages if fn is None: fn = os.path.splitext(self.fn)[0] + DEVIC...
[ "def", "gswrite", "(", "self", ",", "fn", "=", "None", ",", "device", "=", "'jpeg'", ",", "res", "=", "600", ",", "alpha", "=", "4", ",", "quality", "=", "90", ",", "gs", "=", "None", ")", ":", "gs", "=", "(", "gs", "or", "self", ".", "gs", ...
use ghostscript to create output file(s) from the PDF
[ "use", "ghostscript", "to", "create", "output", "file", "(", "s", ")", "from", "the", "PDF" ]
python
train
saltstack/salt
salt/states/boto_vpc.py
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/boto_vpc.py#L1377-L1454
def nat_gateway_absent(name=None, subnet_name=None, subnet_id=None, region=None, key=None, keyid=None, profile=None, wait_for_delete_retries=0): ''' Ensure the nat gateway in the named subnet is absent. This function requires boto3. .. versionadded:: 2016....
[ "def", "nat_gateway_absent", "(", "name", "=", "None", ",", "subnet_name", "=", "None", ",", "subnet_id", "=", "None", ",", "region", "=", "None", ",", "key", "=", "None", ",", "keyid", "=", "None", ",", "profile", "=", "None", ",", "wait_for_delete_retr...
Ensure the nat gateway in the named subnet is absent. This function requires boto3. .. versionadded:: 2016.11.0 name Name of the state. subnet_name Name of the subnet within which the nat gateway should exist subnet_id Id of the subnet within which the nat gateway should...
[ "Ensure", "the", "nat", "gateway", "in", "the", "named", "subnet", "is", "absent", "." ]
python
train
openstax/cnx-easybake
cnxeasybake/oven.py
https://github.com/openstax/cnx-easybake/blob/f8edf018fb7499f6f18af0145c326b93a737a782/cnxeasybake/oven.py#L589-L595
def push_pending_elem(self, element, pseudo): """Create and place pending target element onto stack.""" self.push_target_elem(element, pseudo) elem = etree.Element('div') actions = self.state[self.state['current_step']]['actions'] actions.append(('move', elem)) actions.ap...
[ "def", "push_pending_elem", "(", "self", ",", "element", ",", "pseudo", ")", ":", "self", ".", "push_target_elem", "(", "element", ",", "pseudo", ")", "elem", "=", "etree", ".", "Element", "(", "'div'", ")", "actions", "=", "self", ".", "state", "[", "...
Create and place pending target element onto stack.
[ "Create", "and", "place", "pending", "target", "element", "onto", "stack", "." ]
python
train
PMBio/limix-backup
limix/stats/geno_summary.py
https://github.com/PMBio/limix-backup/blob/1e201fdb5c694d0d5506f207f3de65d8ef66146c/limix/stats/geno_summary.py#L38-L61
def calc_LD(M,pos,i_start=[0],max_dist=1000000): """calculate linkage disequilibrium correlations: M: genotype matrix pos: position vector i_start: index to start from for LD calculation dist: distance """ RV = [] DIST = [] for start in i_start: pos0 = pos[start] v0 ...
[ "def", "calc_LD", "(", "M", ",", "pos", ",", "i_start", "=", "[", "0", "]", ",", "max_dist", "=", "1000000", ")", ":", "RV", "=", "[", "]", "DIST", "=", "[", "]", "for", "start", "in", "i_start", ":", "pos0", "=", "pos", "[", "start", "]", "v...
calculate linkage disequilibrium correlations: M: genotype matrix pos: position vector i_start: index to start from for LD calculation dist: distance
[ "calculate", "linkage", "disequilibrium", "correlations", ":", "M", ":", "genotype", "matrix", "pos", ":", "position", "vector", "i_start", ":", "index", "to", "start", "from", "for", "LD", "calculation", "dist", ":", "distance" ]
python
train
materialsproject/pymatgen
pymatgen/command_line/bader_caller.py
https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/command_line/bader_caller.py#L314-L366
def from_path(cls, path, suffix=""): """ Convenient constructor that takes in the path name of VASP run to perform Bader analysis. Args: path (str): Name of directory where VASP output files are stored. suffix (str): specific suffix to look for (e...
[ "def", "from_path", "(", "cls", ",", "path", ",", "suffix", "=", "\"\"", ")", ":", "def", "_get_filepath", "(", "filename", ")", ":", "name_pattern", "=", "filename", "+", "suffix", "+", "'*'", "if", "filename", "!=", "'POTCAR'", "else", "filename", "+",...
Convenient constructor that takes in the path name of VASP run to perform Bader analysis. Args: path (str): Name of directory where VASP output files are stored. suffix (str): specific suffix to look for (e.g. '.relax1' for 'CHGCAR.relax1.gz').
[ "Convenient", "constructor", "that", "takes", "in", "the", "path", "name", "of", "VASP", "run", "to", "perform", "Bader", "analysis", "." ]
python
train
halcy/Mastodon.py
mastodon/Mastodon.py
https://github.com/halcy/Mastodon.py/blob/35c43562dd3d34d6ebf7a0f757c09e8fcccc957c/mastodon/Mastodon.py#L2911-L2918
def __decode_webpush_b64(self, data): """ Re-pads and decodes urlsafe base64. """ missing_padding = len(data) % 4 if missing_padding != 0: data += '=' * (4 - missing_padding) return base64.urlsafe_b64decode(data)
[ "def", "__decode_webpush_b64", "(", "self", ",", "data", ")", ":", "missing_padding", "=", "len", "(", "data", ")", "%", "4", "if", "missing_padding", "!=", "0", ":", "data", "+=", "'='", "*", "(", "4", "-", "missing_padding", ")", "return", "base64", ...
Re-pads and decodes urlsafe base64.
[ "Re", "-", "pads", "and", "decodes", "urlsafe", "base64", "." ]
python
train
Sheeprider/BitBucket-api
bitbucket/bitbucket.py
https://github.com/Sheeprider/BitBucket-api/blob/be45515d506d87f14807a676f3c2f20d79674b75/bitbucket/bitbucket.py#L289-L292
def get_privileges(self): """ Get privledges for this user. """ url = self.url('GET_USER_PRIVILEGES') return self.dispatch('GET', url, auth=self.auth)
[ "def", "get_privileges", "(", "self", ")", ":", "url", "=", "self", ".", "url", "(", "'GET_USER_PRIVILEGES'", ")", "return", "self", ".", "dispatch", "(", "'GET'", ",", "url", ",", "auth", "=", "self", ".", "auth", ")" ]
Get privledges for this user.
[ "Get", "privledges", "for", "this", "user", "." ]
python
train
celery/django-celery
djcelery/views.py
https://github.com/celery/django-celery/blob/5d1ecb09c6304d22cc447c7c08fba0bd1febc2ef/djcelery/views.py#L46-L57
def apply(request, task_name): """View applying a task. **Note:** Please use this with caution. Preferably you shouldn't make this publicly accessible without ensuring your code is safe! """ try: task = tasks[task_name] except KeyError: raise Http404('apply: no such task') ...
[ "def", "apply", "(", "request", ",", "task_name", ")", ":", "try", ":", "task", "=", "tasks", "[", "task_name", "]", "except", "KeyError", ":", "raise", "Http404", "(", "'apply: no such task'", ")", "return", "task_view", "(", "task", ")", "(", "request", ...
View applying a task. **Note:** Please use this with caution. Preferably you shouldn't make this publicly accessible without ensuring your code is safe!
[ "View", "applying", "a", "task", "." ]
python
train
openstack/proliantutils
proliantutils/redfish/redfish.py
https://github.com/openstack/proliantutils/blob/86ef3b47b4eca97c221577e3570b0240d6a25f22/proliantutils/redfish/redfish.py#L649-L727
def get_server_capabilities(self): """Returns the server capabilities raises: IloError on an error from iLO. """ capabilities = {} sushy_system = self._get_sushy_system(PROLIANT_SYSTEM_ID) sushy_manager = self._get_sushy_manager(PROLIANT_MANAGER_ID) try: ...
[ "def", "get_server_capabilities", "(", "self", ")", ":", "capabilities", "=", "{", "}", "sushy_system", "=", "self", ".", "_get_sushy_system", "(", "PROLIANT_SYSTEM_ID", ")", "sushy_manager", "=", "self", ".", "_get_sushy_manager", "(", "PROLIANT_MANAGER_ID", ")", ...
Returns the server capabilities raises: IloError on an error from iLO.
[ "Returns", "the", "server", "capabilities" ]
python
train
saltstack/salt
salt/engines/slack.py
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/engines/slack.py#L288-L306
def _groups_from_pillar(self, pillar_name): ''' pillar_prefix is the pillar.get syntax for the pillar to be queried. Group name is gotten via the equivalent of using ``salt['pillar.get']('{}:{}'.format(pillar_prefix, group_name))`` in a jinja template. returns a dictiona...
[ "def", "_groups_from_pillar", "(", "self", ",", "pillar_name", ")", ":", "if", "pillar_name", "and", "__opts__", "[", "'__role'", "]", "==", "'minion'", ":", "pillar_groups", "=", "__salt__", "[", "'pillar.get'", "]", "(", "pillar_name", ",", "{", "}", ")", ...
pillar_prefix is the pillar.get syntax for the pillar to be queried. Group name is gotten via the equivalent of using ``salt['pillar.get']('{}:{}'.format(pillar_prefix, group_name))`` in a jinja template. returns a dictionary (unless the pillar is mis-formatted) XXX: instead of ...
[ "pillar_prefix", "is", "the", "pillar", ".", "get", "syntax", "for", "the", "pillar", "to", "be", "queried", ".", "Group", "name", "is", "gotten", "via", "the", "equivalent", "of", "using", "salt", "[", "pillar", ".", "get", "]", "(", "{}", ":", "{}", ...
python
train
googleapis/dialogflow-python-client-v2
dialogflow_v2/gapic/contexts_client.py
https://github.com/googleapis/dialogflow-python-client-v2/blob/8c9c8709222efe427b76c9c8fcc04a0c4a0760b5/dialogflow_v2/gapic/contexts_client.py#L407-L468
def update_context(self, context, update_mask=None, retry=google.api_core.gapic_v1.method.DEFAULT, timeout=google.api_core.gapic_v1.method.DEFAULT, metadata=None): """ Updates the specified...
[ "def", "update_context", "(", "self", ",", "context", ",", "update_mask", "=", "None", ",", "retry", "=", "google", ".", "api_core", ".", "gapic_v1", ".", "method", ".", "DEFAULT", ",", "timeout", "=", "google", ".", "api_core", ".", "gapic_v1", ".", "me...
Updates the specified context. Example: >>> import dialogflow_v2 >>> >>> client = dialogflow_v2.ContextsClient() >>> >>> # TODO: Initialize ``context``: >>> context = {} >>> >>> response = client.update_context(cont...
[ "Updates", "the", "specified", "context", "." ]
python
train
openego/ding0
ding0/core/__init__.py
https://github.com/openego/ding0/blob/e2d6528f96255e4bb22ba15514a4f1883564ed5d/ding0/core/__init__.py#L80-L84
def add_mv_grid_district(self, mv_grid_district): """Adds a MV grid_district to _mv_grid_districts if not already existing""" # TODO: use setter method here (make attribute '_mv_grid_districts' private) if mv_grid_district not in self.mv_grid_districts(): self._mv_grid_districts.appe...
[ "def", "add_mv_grid_district", "(", "self", ",", "mv_grid_district", ")", ":", "# TODO: use setter method here (make attribute '_mv_grid_districts' private)", "if", "mv_grid_district", "not", "in", "self", ".", "mv_grid_districts", "(", ")", ":", "self", ".", "_mv_grid_dist...
Adds a MV grid_district to _mv_grid_districts if not already existing
[ "Adds", "a", "MV", "grid_district", "to", "_mv_grid_districts", "if", "not", "already", "existing" ]
python
train
caffeinehit/django-follow
follow/models.py
https://github.com/caffeinehit/django-follow/blob/765a4795e58f57fbf96efdb7838d0c7222db2e56/follow/models.py#L21-L30
def create(self, user, obj, **kwargs): """ Create a new follow link between a user and an object of a registered model type. """ follow = Follow(user=user) follow.target = obj follow.save() return follow
[ "def", "create", "(", "self", ",", "user", ",", "obj", ",", "*", "*", "kwargs", ")", ":", "follow", "=", "Follow", "(", "user", "=", "user", ")", "follow", ".", "target", "=", "obj", "follow", ".", "save", "(", ")", "return", "follow" ]
Create a new follow link between a user and an object of a registered model type.
[ "Create", "a", "new", "follow", "link", "between", "a", "user", "and", "an", "object", "of", "a", "registered", "model", "type", "." ]
python
train
phaethon/kamene
kamene/utils6.py
https://github.com/phaethon/kamene/blob/11d4064844f4f68ac5d7546f5633ac7d02082914/kamene/utils6.py#L646-L655
def in6_getnsmac(a): # return multicast Ethernet address associated with multicast v6 destination """ Return the multicast mac address associated with provided IPv6 address. Passed address must be in network format. """ a = struct.unpack('16B', a)[-4:] mac = '33:33:' mac += (':'.join(map(l...
[ "def", "in6_getnsmac", "(", "a", ")", ":", "# return multicast Ethernet address associated with multicast v6 destination", "a", "=", "struct", ".", "unpack", "(", "'16B'", ",", "a", ")", "[", "-", "4", ":", "]", "mac", "=", "'33:33:'", "mac", "+=", "(", "':'",...
Return the multicast mac address associated with provided IPv6 address. Passed address must be in network format.
[ "Return", "the", "multicast", "mac", "address", "associated", "with", "provided", "IPv6", "address", ".", "Passed", "address", "must", "be", "in", "network", "format", "." ]
python
train
materialsproject/pymatgen
pymatgen/analysis/phase_diagram.py
https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/analysis/phase_diagram.py#L1638-L1670
def _get_3d_plot(self, label_stable=True): """ Shows the plot using pylab. Usually I won"t do imports in methods, but since plotting is a fairly expensive library to load and not all machines have matplotlib installed, I have done it this way. """ import matplotlib.pyplo...
[ "def", "_get_3d_plot", "(", "self", ",", "label_stable", "=", "True", ")", ":", "import", "matplotlib", ".", "pyplot", "as", "plt", "import", "mpl_toolkits", ".", "mplot3d", ".", "axes3d", "as", "p3", "from", "matplotlib", ".", "font_manager", "import", "Fon...
Shows the plot using pylab. Usually I won"t do imports in methods, but since plotting is a fairly expensive library to load and not all machines have matplotlib installed, I have done it this way.
[ "Shows", "the", "plot", "using", "pylab", ".", "Usually", "I", "won", "t", "do", "imports", "in", "methods", "but", "since", "plotting", "is", "a", "fairly", "expensive", "library", "to", "load", "and", "not", "all", "machines", "have", "matplotlib", "inst...
python
train
globality-corp/microcosm-flask
microcosm_flask/conventions/registry.py
https://github.com/globality-corp/microcosm-flask/blob/c2eaf57f03e7d041eea343751a4a90fcc80df418/microcosm_flask/conventions/registry.py#L56-L64
def request(schema): """ Decorate a function with a request schema. """ def wrapper(func): setattr(func, REQUEST, schema) return func return wrapper
[ "def", "request", "(", "schema", ")", ":", "def", "wrapper", "(", "func", ")", ":", "setattr", "(", "func", ",", "REQUEST", ",", "schema", ")", "return", "func", "return", "wrapper" ]
Decorate a function with a request schema.
[ "Decorate", "a", "function", "with", "a", "request", "schema", "." ]
python
train
brocade/pynos
pynos/versions/ver_6/ver_6_0_1/yang/brocade_xstp_ext.py
https://github.com/brocade/pynos/blob/bd8a34e98f322de3fc06750827d8bbc3a0c00380/pynos/versions/ver_6/ver_6_0_1/yang/brocade_xstp_ext.py#L3943-L3955
def get_stp_mst_detail_output_cist_cist_bridge_id(self, **kwargs): """Auto Generated Code """ config = ET.Element("config") get_stp_mst_detail = ET.Element("get_stp_mst_detail") config = get_stp_mst_detail output = ET.SubElement(get_stp_mst_detail, "output") cist ...
[ "def", "get_stp_mst_detail_output_cist_cist_bridge_id", "(", "self", ",", "*", "*", "kwargs", ")", ":", "config", "=", "ET", ".", "Element", "(", "\"config\"", ")", "get_stp_mst_detail", "=", "ET", ".", "Element", "(", "\"get_stp_mst_detail\"", ")", "config", "=...
Auto Generated Code
[ "Auto", "Generated", "Code" ]
python
train
cloud9ers/gurumate
environment/lib/python2.7/site-packages/IPython/core/crashhandler.py
https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/core/crashhandler.py#L180-L199
def make_report(self,traceback): """Return a string containing a crash report.""" sec_sep = self.section_sep report = ['*'*75+'\n\n'+'IPython post-mortem report\n\n'] rpt_add = report.append rpt_add(sys_info()) try: config = pformat(self.app.config) ...
[ "def", "make_report", "(", "self", ",", "traceback", ")", ":", "sec_sep", "=", "self", ".", "section_sep", "report", "=", "[", "'*'", "*", "75", "+", "'\\n\\n'", "+", "'IPython post-mortem report\\n\\n'", "]", "rpt_add", "=", "report", ".", "append", "rpt_ad...
Return a string containing a crash report.
[ "Return", "a", "string", "containing", "a", "crash", "report", "." ]
python
test
CI-WATER/gsshapy
gsshapy/modeling/model.py
https://github.com/CI-WATER/gsshapy/blob/00fd4af0fd65f1614d75a52fe950a04fb0867f4c/gsshapy/modeling/model.py#L196-L211
def set_mask_from_shapefile(self, shapefile_path, cell_size): """ Adds a mask from a shapefile """ # make sure paths are absolute as the working directory changes shapefile_path = os.path.abspath(shapefile_path) # ADD MASK with tmp_chdir(self.project_directory): ...
[ "def", "set_mask_from_shapefile", "(", "self", ",", "shapefile_path", ",", "cell_size", ")", ":", "# make sure paths are absolute as the working directory changes", "shapefile_path", "=", "os", ".", "path", ".", "abspath", "(", "shapefile_path", ")", "# ADD MASK", "with",...
Adds a mask from a shapefile
[ "Adds", "a", "mask", "from", "a", "shapefile" ]
python
train
iron-io/iron_cache_python
iron_cache.py
https://github.com/iron-io/iron_cache_python/blob/f68f5a5e216e3189397ffd7d243de0d53bf7c764/iron_cache.py#L88-L105
def get(self, key, cache=None): """Query the server for an item, parse the JSON, and return the result. Keyword arguments: key -- the key of the item that you'd like to retrieve. Required. cache -- the name of the cache that the item resides in. Defaults to None, which ...
[ "def", "get", "(", "self", ",", "key", ",", "cache", "=", "None", ")", ":", "if", "cache", "is", "None", ":", "cache", "=", "self", ".", "name", "if", "cache", "is", "None", ":", "raise", "ValueError", "(", "\"Cache name must be set\"", ")", "cache", ...
Query the server for an item, parse the JSON, and return the result. Keyword arguments: key -- the key of the item that you'd like to retrieve. Required. cache -- the name of the cache that the item resides in. Defaults to None, which uses self.name. If no name is set, raises a...
[ "Query", "the", "server", "for", "an", "item", "parse", "the", "JSON", "and", "return", "the", "result", "." ]
python
train
fhcrc/seqmagick
seqmagick/subcommands/quality_filter.py
https://github.com/fhcrc/seqmagick/blob/1642bb87ba5c171fbd307f9da0f8a0ee1d69d5ed/seqmagick/subcommands/quality_filter.py#L455-L485
def filter_record(self, record): """ Filter a single record """ quality_scores = record.letter_annotations['phred_quality'] # Simple case - window covers whole sequence if len(record) <= self.window_size: mean_score = mean(quality_scores) if mean_...
[ "def", "filter_record", "(", "self", ",", "record", ")", ":", "quality_scores", "=", "record", ".", "letter_annotations", "[", "'phred_quality'", "]", "# Simple case - window covers whole sequence", "if", "len", "(", "record", ")", "<=", "self", ".", "window_size", ...
Filter a single record
[ "Filter", "a", "single", "record" ]
python
train
earwig/mwparserfromhell
mwparserfromhell/parser/tokenizer.py
https://github.com/earwig/mwparserfromhell/blob/98dc30902d35c714a70aca8e6616f49d71cb24cc/mwparserfromhell/parser/tokenizer.py#L1450-L1465
def tokenize(self, text, context=0, skip_style_tags=False): """Build a list of tokens from a string of wikicode and return it.""" split = self.regex.split(text) self._text = [segment for segment in split if segment] self._head = self._global = self._depth = 0 self._bad_routes = s...
[ "def", "tokenize", "(", "self", ",", "text", ",", "context", "=", "0", ",", "skip_style_tags", "=", "False", ")", ":", "split", "=", "self", ".", "regex", ".", "split", "(", "text", ")", "self", ".", "_text", "=", "[", "segment", "for", "segment", ...
Build a list of tokens from a string of wikicode and return it.
[ "Build", "a", "list", "of", "tokens", "from", "a", "string", "of", "wikicode", "and", "return", "it", "." ]
python
train
lsbardel/python-stdnet
stdnet/apps/columnts/npts.py
https://github.com/lsbardel/python-stdnet/blob/78db5320bdedc3f28c5e4f38cda13a4469e35db7/stdnet/apps/columnts/npts.py#L19-L23
def front(self, *fields): '''Return the front pair of the structure''' ts = self.irange(0, 0, fields=fields) if ts: return ts.start(), ts[0]
[ "def", "front", "(", "self", ",", "*", "fields", ")", ":", "ts", "=", "self", ".", "irange", "(", "0", ",", "0", ",", "fields", "=", "fields", ")", "if", "ts", ":", "return", "ts", ".", "start", "(", ")", ",", "ts", "[", "0", "]" ]
Return the front pair of the structure
[ "Return", "the", "front", "pair", "of", "the", "structure" ]
python
train
recurly/recurly-client-python
recurly/resource.py
https://github.com/recurly/recurly-client-python/blob/682217c4e85ec5c8d4e41519ee0620d2dc4d84d7/recurly/resource.py#L673-L685
def post(self, url, body=None): """Sends this `Resource` instance to the service with a ``POST`` request to the given URL. Takes an optional body""" response = self.http_request(url, 'POST', body or self, {'Content-Type': 'application/xml; charset=utf-8'}) if response.status not in (200,...
[ "def", "post", "(", "self", ",", "url", ",", "body", "=", "None", ")", ":", "response", "=", "self", ".", "http_request", "(", "url", ",", "'POST'", ",", "body", "or", "self", ",", "{", "'Content-Type'", ":", "'application/xml; charset=utf-8'", "}", ")",...
Sends this `Resource` instance to the service with a ``POST`` request to the given URL. Takes an optional body
[ "Sends", "this", "Resource", "instance", "to", "the", "service", "with", "a", "POST", "request", "to", "the", "given", "URL", ".", "Takes", "an", "optional", "body" ]
python
train
thriftrw/thriftrw-python
thriftrw/idl/parser.py
https://github.com/thriftrw/thriftrw-python/blob/4f2f71acd7a0ac716c9ea5cdcea2162aa561304a/thriftrw/idl/parser.py#L224-L245
def p_service(self, p): '''service : SERVICE IDENTIFIER '{' function_seq '}' annotations | SERVICE IDENTIFIER EXTENDS IDENTIFIER \ '{' function_seq '}' annotations ''' if len(p) == 7: p[0] = ast.Service( name=p[2], ...
[ "def", "p_service", "(", "self", ",", "p", ")", ":", "if", "len", "(", "p", ")", "==", "7", ":", "p", "[", "0", "]", "=", "ast", ".", "Service", "(", "name", "=", "p", "[", "2", "]", ",", "functions", "=", "p", "[", "4", "]", ",", "parent...
service : SERVICE IDENTIFIER '{' function_seq '}' annotations | SERVICE IDENTIFIER EXTENDS IDENTIFIER \ '{' function_seq '}' annotations
[ "service", ":", "SERVICE", "IDENTIFIER", "{", "function_seq", "}", "annotations", "|", "SERVICE", "IDENTIFIER", "EXTENDS", "IDENTIFIER", "\\", "{", "function_seq", "}", "annotations" ]
python
train
vanheeringen-lab/gimmemotifs
gimmemotifs/moap.py
https://github.com/vanheeringen-lab/gimmemotifs/blob/1dc0572179e5d0c8f96958060133c1f8d92c6675/gimmemotifs/moap.py#L817-L955
def moap(inputfile, method="hypergeom", scoring=None, outfile=None, motiffile=None, pwmfile=None, genome=None, fpr=0.01, ncpus=None, subsample=None): """Run a single motif activity prediction algorithm. Parameters ---------- inputfile : str :1File with regions (chr:start-end) in fir...
[ "def", "moap", "(", "inputfile", ",", "method", "=", "\"hypergeom\"", ",", "scoring", "=", "None", ",", "outfile", "=", "None", ",", "motiffile", "=", "None", ",", "pwmfile", "=", "None", ",", "genome", "=", "None", ",", "fpr", "=", "0.01", ",", "ncp...
Run a single motif activity prediction algorithm. Parameters ---------- inputfile : str :1File with regions (chr:start-end) in first column and either cluster name in second column or a table with values. method : str, optional Motif activity method to use. Any of 'hyp...
[ "Run", "a", "single", "motif", "activity", "prediction", "algorithm", ".", "Parameters", "----------", "inputfile", ":", "str", ":", "1File", "with", "regions", "(", "chr", ":", "start", "-", "end", ")", "in", "first", "column", "and", "either", "cluster", ...
python
train
cloudbase/python-hnvclient
hnv/client.py
https://github.com/cloudbase/python-hnvclient/blob/b019452af01db22629809b8930357a2ebf6494be/hnv/client.py#L2920-L2929
def process_raw_data(cls, raw_data): """Create a new model using raw API response.""" properties = raw_data.get("properties", {}) raw_content = properties.get("statistics", None) if raw_content is not None: statistics = BGPPeersStatistics.from_raw_data(raw_content) ...
[ "def", "process_raw_data", "(", "cls", ",", "raw_data", ")", ":", "properties", "=", "raw_data", ".", "get", "(", "\"properties\"", ",", "{", "}", ")", "raw_content", "=", "properties", ".", "get", "(", "\"statistics\"", ",", "None", ")", "if", "raw_conten...
Create a new model using raw API response.
[ "Create", "a", "new", "model", "using", "raw", "API", "response", "." ]
python
train
ff0000/scarlet
scarlet/cms/widgets.py
https://github.com/ff0000/scarlet/blob/6c37befd810916a2d7ffff2cdb2dab57bcb6d12e/scarlet/cms/widgets.py#L460-L476
def get_qs(self): """ Returns a mapping that will be used to generate the query string for the api url. Any values in the the `limit_choices_to` specified on the foreign key field and any arguments specified on self.extra_query_kwargs are converted to a format tha...
[ "def", "get_qs", "(", "self", ")", ":", "qs", "=", "url_params_from_lookup_dict", "(", "self", ".", "rel", ".", "limit_choices_to", ")", "if", "not", "qs", ":", "qs", "=", "{", "}", "if", "self", ".", "extra_query_kwargs", ":", "qs", ".", "update", "("...
Returns a mapping that will be used to generate the query string for the api url. Any values in the the `limit_choices_to` specified on the foreign key field and any arguments specified on self.extra_query_kwargs are converted to a format that can be used in a query string and re...
[ "Returns", "a", "mapping", "that", "will", "be", "used", "to", "generate", "the", "query", "string", "for", "the", "api", "url", ".", "Any", "values", "in", "the", "the", "limit_choices_to", "specified", "on", "the", "foreign", "key", "field", "and", "any"...
python
train
openstack/networking-arista
networking_arista/common/db_lib.py
https://github.com/openstack/networking-arista/blob/07ce6b1fc62ff74308a6eabfc4cc0ee09fb7b0fe/networking_arista/common/db_lib.py#L286-L296
def get_ports(device_owners=None, vnic_type=None, port_id=None, active=True): """Returns list of all ports in neutron the db""" session = db.get_reader_session() with session.begin(): port_model = models_v2.Port ports = (session .query(port_model) .filter_un...
[ "def", "get_ports", "(", "device_owners", "=", "None", ",", "vnic_type", "=", "None", ",", "port_id", "=", "None", ",", "active", "=", "True", ")", ":", "session", "=", "db", ".", "get_reader_session", "(", ")", "with", "session", ".", "begin", "(", ")...
Returns list of all ports in neutron the db
[ "Returns", "list", "of", "all", "ports", "in", "neutron", "the", "db" ]
python
train
not-na/peng3d
peng3d/gui/button.py
https://github.com/not-na/peng3d/blob/1151be665b26cc8a479f6307086ba919e4d32d85/peng3d/gui/button.py#L705-L828
def redraw_bg(self): # Convenience variables sx,sy = self.widget.size x,y = self.widget.pos bx,by = self.border # Button background # Outer vertices # x y v1 = x, y+sy v2 = x+sx, y+sy v3 = x, ...
[ "def", "redraw_bg", "(", "self", ")", ":", "# Convenience variables", "sx", ",", "sy", "=", "self", ".", "widget", ".", "size", "x", ",", "y", "=", "self", ".", "widget", ".", "pos", "bx", ",", "by", "=", "self", ".", "border", "# Button background", ...
if not self.widget.pressed: self.vlist_cross.colors = 6*bg else: if self.borderstyle=="flat": c = [min(bg[0]+8,255),min(bg[1]+8,255),min(bg[2]+8,255)] elif self.borderstyle=="gradient": c = h elif self.borderstyle=="oldshadow": ...
[ "if", "not", "self", ".", "widget", ".", "pressed", ":", "self", ".", "vlist_cross", ".", "colors", "=", "6", "*", "bg", "else", ":", "if", "self", ".", "borderstyle", "==", "flat", ":", "c", "=", "[", "min", "(", "bg", "[", "0", "]", "+", "8",...
python
test
Scoppio/RagnarokEngine3
RagnarokEngine3/RE3.py
https://github.com/Scoppio/RagnarokEngine3/blob/4395d419ccd64fe9327c41f200b72ee0176ad896/RagnarokEngine3/RE3.py#L194-L201
def distance(vec1, vec2): """Calculate the distance between two Vectors""" if isinstance(vec1, Vector2) \ and isinstance(vec2, Vector2): dist_vec = vec2 - vec1 return dist_vec.length() else: raise TypeError("vec1 and vec2 must be Vector2's")
[ "def", "distance", "(", "vec1", ",", "vec2", ")", ":", "if", "isinstance", "(", "vec1", ",", "Vector2", ")", "and", "isinstance", "(", "vec2", ",", "Vector2", ")", ":", "dist_vec", "=", "vec2", "-", "vec1", "return", "dist_vec", ".", "length", "(", "...
Calculate the distance between two Vectors
[ "Calculate", "the", "distance", "between", "two", "Vectors" ]
python
train
jaumebonet/libconfig
libconfig/config.py
https://github.com/jaumebonet/libconfig/blob/9b34cefcbaf9a326e3f3cd517896c2933cf61a3b/libconfig/config.py#L37-L70
def register_option(self, key, subkey, default, _type, definition, values=None, locked=False): """Create a new option. :param str key: First identifier of the option. :param str subkey: Second identifier of the option. :param default: Default value of the option....
[ "def", "register_option", "(", "self", ",", "key", ",", "subkey", ",", "default", ",", "_type", ",", "definition", ",", "values", "=", "None", ",", "locked", "=", "False", ")", ":", "if", "not", "self", ".", "open", ":", "return", "key", ",", "subkey...
Create a new option. :param str key: First identifier of the option. :param str subkey: Second identifier of the option. :param default: Default value of the option. Type varies and it is described by ``_type``. :param str _type: Type of the value of the option. Available ...
[ "Create", "a", "new", "option", "." ]
python
train
VIVelev/PyDojoML
dojo/cluster/kmeans.py
https://github.com/VIVelev/PyDojoML/blob/773fdce6866aa6decd306a5a85f94129fed816eb/dojo/cluster/kmeans.py#L39-L42
def _init_random_centroids(self): """Initialize the centroids as k random samples of X (k = n_clusters) """ self.centroids = self._X[np.random.choice(list(range(self._X.shape[0])), size=self.n_clusters), :]
[ "def", "_init_random_centroids", "(", "self", ")", ":", "self", ".", "centroids", "=", "self", ".", "_X", "[", "np", ".", "random", ".", "choice", "(", "list", "(", "range", "(", "self", ".", "_X", ".", "shape", "[", "0", "]", ")", ")", ",", "siz...
Initialize the centroids as k random samples of X (k = n_clusters)
[ "Initialize", "the", "centroids", "as", "k", "random", "samples", "of", "X", "(", "k", "=", "n_clusters", ")" ]
python
train
LuqueDaniel/pybooru
pybooru/api_danbooru.py
https://github.com/LuqueDaniel/pybooru/blob/60cd5254684d293b308f0b11b8f4ac2dce101479/pybooru/api_danbooru.py#L141-L155
def post_flag_list(self, creator_id=None, creator_name=None, post_id=None, reason_matches=None, is_resolved=None, category=None): """Function to flag a post (Requires login). Parameters: creator_id (int): The user id of the flag's creator. creator_name (st...
[ "def", "post_flag_list", "(", "self", ",", "creator_id", "=", "None", ",", "creator_name", "=", "None", ",", "post_id", "=", "None", ",", "reason_matches", "=", "None", ",", "is_resolved", "=", "None", ",", "category", "=", "None", ")", ":", "params", "=...
Function to flag a post (Requires login). Parameters: creator_id (int): The user id of the flag's creator. creator_name (str): The name of the flag's creator. post_id (int): The post id if the flag.
[ "Function", "to", "flag", "a", "post", "(", "Requires", "login", ")", "." ]
python
train
lrq3000/pyFileFixity
pyFileFixity/lib/brownanrs/ff.py
https://github.com/lrq3000/pyFileFixity/blob/fd5ef23bb13835faf1e3baa773619b86a1cc9bdf/pyFileFixity/lib/brownanrs/ff.py#L69-L121
def find_prime_polynomials(generator=2, c_exp=8, fast_primes=False, single=False): '''Compute the list of prime polynomials for the given generator and galois field characteristic exponent.''' # fast_primes will output less results but will be significantly faster. # single will output the first prime polyn...
[ "def", "find_prime_polynomials", "(", "generator", "=", "2", ",", "c_exp", "=", "8", ",", "fast_primes", "=", "False", ",", "single", "=", "False", ")", ":", "# fast_primes will output less results but will be significantly faster.", "# single will output the first prime po...
Compute the list of prime polynomials for the given generator and galois field characteristic exponent.
[ "Compute", "the", "list", "of", "prime", "polynomials", "for", "the", "given", "generator", "and", "galois", "field", "characteristic", "exponent", "." ]
python
train
PatrikValkovic/grammpy
grammpy/transforms/ChomskyForm/transform_from_chomsky_normal_form.py
https://github.com/PatrikValkovic/grammpy/blob/879ce0ef794ac2823acc19314fcd7a8aba53e50f/grammpy/transforms/ChomskyForm/transform_from_chomsky_normal_form.py#L20-L64
def transform_from_chomsky_normal_form(root): # type: (Nonterminal) -> Nonterminal """ Transform the tree created by grammar in the Chomsky Normal Form to original rules. :param root: Root of parsed tree. :return: Modified tree. """ # Transforms leaves items = Traversing.post_order(root)...
[ "def", "transform_from_chomsky_normal_form", "(", "root", ")", ":", "# type: (Nonterminal) -> Nonterminal", "# Transforms leaves", "items", "=", "Traversing", ".", "post_order", "(", "root", ")", "items", "=", "filter", "(", "lambda", "x", ":", "isinstance", "(", "x...
Transform the tree created by grammar in the Chomsky Normal Form to original rules. :param root: Root of parsed tree. :return: Modified tree.
[ "Transform", "the", "tree", "created", "by", "grammar", "in", "the", "Chomsky", "Normal", "Form", "to", "original", "rules", ".", ":", "param", "root", ":", "Root", "of", "parsed", "tree", ".", ":", "return", ":", "Modified", "tree", "." ]
python
train
fabioz/PyDev.Debugger
pydevd_attach_to_process/winappdbg/win32/context_amd64.py
https://github.com/fabioz/PyDev.Debugger/blob/ed9c4307662a5593b8a7f1f3389ecd0e79b8c503/pydevd_attach_to_process/winappdbg/win32/context_amd64.py#L426-L465
def from_dict(cls, ctx): 'Instance a new structure from a Python native type.' ctx = Context(ctx) s = cls() ContextFlags = ctx['ContextFlags'] s.ContextFlags = ContextFlags for key in cls._others: if key != 'VectorRegister': setattr(s, key, ctx...
[ "def", "from_dict", "(", "cls", ",", "ctx", ")", ":", "ctx", "=", "Context", "(", "ctx", ")", "s", "=", "cls", "(", ")", "ContextFlags", "=", "ctx", "[", "'ContextFlags'", "]", "s", ".", "ContextFlags", "=", "ContextFlags", "for", "key", "in", "cls",...
Instance a new structure from a Python native type.
[ "Instance", "a", "new", "structure", "from", "a", "Python", "native", "type", "." ]
python
train
xtuml/pyxtuml
xtuml/meta.py
https://github.com/xtuml/pyxtuml/blob/7dd9343b9a0191d1db1887ab9288d0a026608d9a/xtuml/meta.py#L987-L1007
def relate(from_instance, to_instance, rel_id, phrase=''): ''' Relate *from_instance* to *to_instance* across *rel_id*. For reflexive association, a *phrase* indicating the direction must also be provided. The two instances are related to each other by copying the identifying attributes from t...
[ "def", "relate", "(", "from_instance", ",", "to_instance", ",", "rel_id", ",", "phrase", "=", "''", ")", ":", "if", "None", "in", "[", "from_instance", ",", "to_instance", "]", ":", "return", "False", "inst1", ",", "inst2", ",", "ass", "=", "_find_link",...
Relate *from_instance* to *to_instance* across *rel_id*. For reflexive association, a *phrase* indicating the direction must also be provided. The two instances are related to each other by copying the identifying attributes from the instance on the TO side of a association to the instance n the F...
[ "Relate", "*", "from_instance", "*", "to", "*", "to_instance", "*", "across", "*", "rel_id", "*", ".", "For", "reflexive", "association", "a", "*", "phrase", "*", "indicating", "the", "direction", "must", "also", "be", "provided", ".", "The", "two", "insta...
python
test
6809/MC6809
MC6809/components/mc6809_ops_logic.py
https://github.com/6809/MC6809/blob/6ba2f5106df46689017b5d0b6d84d43b7ee6a240/MC6809/components/mc6809_ops_logic.py#L153-L169
def LSL(self, a): """ Shifts all bits of accumulator A or B or memory location M one place to the left. Bit zero is loaded with a zero. Bit seven of accumulator A or B or memory location M is shifted into the C (carry) bit. This is a duplicate assembly-language mnemonic for the ...
[ "def", "LSL", "(", "self", ",", "a", ")", ":", "r", "=", "a", "<<", "1", "self", ".", "clear_NZVC", "(", ")", "self", ".", "update_NZVC_8", "(", "a", ",", "a", ",", "r", ")", "return", "r" ]
Shifts all bits of accumulator A or B or memory location M one place to the left. Bit zero is loaded with a zero. Bit seven of accumulator A or B or memory location M is shifted into the C (carry) bit. This is a duplicate assembly-language mnemonic for the single machine instruction ASL...
[ "Shifts", "all", "bits", "of", "accumulator", "A", "or", "B", "or", "memory", "location", "M", "one", "place", "to", "the", "left", ".", "Bit", "zero", "is", "loaded", "with", "a", "zero", ".", "Bit", "seven", "of", "accumulator", "A", "or", "B", "or...
python
train
pybluez/pybluez
macos/_bluetoothsockets.py
https://github.com/pybluez/pybluez/blob/e0dc4093dcbaa3ecb3fa24f8ccf22bbfe6b57fc9/macos/_bluetoothsockets.py#L616-L635
def __waituntil(self, stopwaiting, timeoutmsg): """ Waits until stopwaiting() returns True, or until the wait times out (according to the self.__timeout value). This is to make a function wait until a buffer has been filled. i.e. stopwaiting() should return True when the buffer ...
[ "def", "__waituntil", "(", "self", ",", "stopwaiting", ",", "timeoutmsg", ")", ":", "if", "not", "stopwaiting", "(", ")", ":", "if", "self", ".", "__timeout", "==", "0", ":", "# in non-blocking mode (immediate timeout)", "# push event loop to really be sure there is n...
Waits until stopwaiting() returns True, or until the wait times out (according to the self.__timeout value). This is to make a function wait until a buffer has been filled. i.e. stopwaiting() should return True when the buffer is no longer empty.
[ "Waits", "until", "stopwaiting", "()", "returns", "True", "or", "until", "the", "wait", "times", "out", "(", "according", "to", "the", "self", ".", "__timeout", "value", ")", "." ]
python
train
mikedh/trimesh
trimesh/path/path.py
https://github.com/mikedh/trimesh/blob/25e059bf6d4caa74f62ffd58ce4f61a90ee4e518/trimesh/path/path.py#L353-L365
def vertex_nodes(self): """ Get a list of which vertex indices are nodes, which are either endpoints or points where the entity makes a direction change. Returns -------------- nodes : (n, 2) int Indexes of self.vertices which are nodes """ ...
[ "def", "vertex_nodes", "(", "self", ")", ":", "nodes", "=", "np", ".", "vstack", "(", "[", "e", ".", "nodes", "for", "e", "in", "self", ".", "entities", "]", ")", "return", "nodes" ]
Get a list of which vertex indices are nodes, which are either endpoints or points where the entity makes a direction change. Returns -------------- nodes : (n, 2) int Indexes of self.vertices which are nodes
[ "Get", "a", "list", "of", "which", "vertex", "indices", "are", "nodes", "which", "are", "either", "endpoints", "or", "points", "where", "the", "entity", "makes", "a", "direction", "change", "." ]
python
train
jeremylow/pyshk
pyshk/models.py
https://github.com/jeremylow/pyshk/blob/3ab92f6706397cde7a18367266eba9e0f1ada868/pyshk/models.py#L462-L510
def AsDict(self, dt=True): """ A dict representation of this Shake instance. The return value uses the same key names as the JSON representation. Args: dt (bool): If True, return dates as python datetime objects. If False, return dates as ISO strings. ...
[ "def", "AsDict", "(", "self", ",", "dt", "=", "True", ")", ":", "data", "=", "{", "}", "if", "self", ".", "sharekey", ":", "data", "[", "'sharekey'", "]", "=", "self", ".", "sharekey", "if", "self", ".", "name", ":", "data", "[", "'name'", "]", ...
A dict representation of this Shake instance. The return value uses the same key names as the JSON representation. Args: dt (bool): If True, return dates as python datetime objects. If False, return dates as ISO strings. Return: A dict representing this S...
[ "A", "dict", "representation", "of", "this", "Shake", "instance", "." ]
python
train
angr/angr
angr/analyses/cfg/segment_list.py
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/analyses/cfg/segment_list.py#L154-L257
def _insert_and_merge_core(self, pos, direction): """ The core part of method _insert_and_merge. :param int pos: The starting position. :param str direction: If we are traversing forwards or backwards in the list. It determines where the "sort" ...
[ "def", "_insert_and_merge_core", "(", "self", ",", "pos", ",", "direction", ")", ":", "bytes_changed", "=", "0", "if", "direction", "==", "\"forward\"", ":", "if", "pos", "==", "len", "(", "self", ".", "_list", ")", "-", "1", ":", "return", "False", ",...
The core part of method _insert_and_merge. :param int pos: The starting position. :param str direction: If we are traversing forwards or backwards in the list. It determines where the "sort" of the overlapping memory block comes from. If everything works as exp...
[ "The", "core", "part", "of", "method", "_insert_and_merge", "." ]
python
train
ioos/compliance-checker
compliance_checker/cf/cf.py
https://github.com/ioos/compliance-checker/blob/ee89c27b0daade58812489a2da3aa3b6859eafd9/compliance_checker/cf/cf.py#L754-L763
def _dims_in_order(self, dimension_order): ''' :param list dimension_order: A list of axes :rtype: bool :return: Returns True if the dimensions are in order U*, T, Z, Y, X, False otherwise ''' regx = regex.compile(r'^[^TZYX]*T?Z?Y?X?$') dimension_...
[ "def", "_dims_in_order", "(", "self", ",", "dimension_order", ")", ":", "regx", "=", "regex", ".", "compile", "(", "r'^[^TZYX]*T?Z?Y?X?$'", ")", "dimension_string", "=", "''", ".", "join", "(", "dimension_order", ")", "return", "regx", ".", "match", "(", "di...
:param list dimension_order: A list of axes :rtype: bool :return: Returns True if the dimensions are in order U*, T, Z, Y, X, False otherwise
[ ":", "param", "list", "dimension_order", ":", "A", "list", "of", "axes", ":", "rtype", ":", "bool", ":", "return", ":", "Returns", "True", "if", "the", "dimensions", "are", "in", "order", "U", "*", "T", "Z", "Y", "X", "False", "otherwise" ]
python
train
DLR-RM/RAFCON
source/rafcon/gui/controllers/graphical_editor_gaphas.py
https://github.com/DLR-RM/RAFCON/blob/24942ef1a904531f49ab8830a1dbb604441be498/source/rafcon/gui/controllers/graphical_editor_gaphas.py#L746-L831
def add_state_view_for_model(self, state_m, parent_v=None, rel_pos=(0, 0), size=(100, 100), hierarchy_level=1): """Creates a `StateView` (recursively) and adds it to the canvas The method uses the `StateModel` `state_m` to create the according `StateView`. For all content within `state_m`, suc...
[ "def", "add_state_view_for_model", "(", "self", ",", "state_m", ",", "parent_v", "=", "None", ",", "rel_pos", "=", "(", "0", ",", "0", ")", ",", "size", "=", "(", "100", ",", "100", ")", ",", "hierarchy_level", "=", "1", ")", ":", "assert", "isinstan...
Creates a `StateView` (recursively) and adds it to the canvas The method uses the `StateModel` `state_m` to create the according `StateView`. For all content within `state_m`, such as connections, states and ports, the views are also created. All views are added to the canvas. :param rafcon.g...
[ "Creates", "a", "StateView", "(", "recursively", ")", "and", "adds", "it", "to", "the", "canvas" ]
python
train
pricingassistant/mrq
mrq/utils.py
https://github.com/pricingassistant/mrq/blob/d0a5a34de9cba38afa94fb7c9e17f9b570b79a50/mrq/utils.py#L105-L117
def load_class_by_path(taskpath): """ Given a taskpath, returns the main task class. """ return getattr( importlib.import_module( re.sub( r"\.[^.]+$", "", taskpath)), re.sub( r"^.*\.", "", taskpath))
[ "def", "load_class_by_path", "(", "taskpath", ")", ":", "return", "getattr", "(", "importlib", ".", "import_module", "(", "re", ".", "sub", "(", "r\"\\.[^.]+$\"", ",", "\"\"", ",", "taskpath", ")", ")", ",", "re", ".", "sub", "(", "r\"^.*\\.\"", ",", "\"...
Given a taskpath, returns the main task class.
[ "Given", "a", "taskpath", "returns", "the", "main", "task", "class", "." ]
python
train
tensorflow/datasets
tensorflow_datasets/core/utils/tf_utils.py
https://github.com/tensorflow/datasets/blob/46ceb0cf7b4690f38ecbbc689e4d659a903d08dc/tensorflow_datasets/core/utils/tf_utils.py#L132-L148
def assert_shape_match(shape1, shape2): """Ensure the shape1 match the pattern given by shape2. Ex: assert_shape_match((64, 64, 3), (None, None, 3)) Args: shape1 (tuple): Static shape shape2 (tuple): Dynamic shape (can contain None) """ shape1 = tf.TensorShape(shape1) shape2 = tf.TensorShape(s...
[ "def", "assert_shape_match", "(", "shape1", ",", "shape2", ")", ":", "shape1", "=", "tf", ".", "TensorShape", "(", "shape1", ")", "shape2", "=", "tf", ".", "TensorShape", "(", "shape2", ")", "if", "shape1", ".", "ndims", "is", "None", "or", "shape2", "...
Ensure the shape1 match the pattern given by shape2. Ex: assert_shape_match((64, 64, 3), (None, None, 3)) Args: shape1 (tuple): Static shape shape2 (tuple): Dynamic shape (can contain None)
[ "Ensure", "the", "shape1", "match", "the", "pattern", "given", "by", "shape2", "." ]
python
train
insomnia-lab/libreant
users/__init__.py
https://github.com/insomnia-lab/libreant/blob/55d529435baf4c05a86b8341899e9f5e14e50245/users/__init__.py#L110-L131
def init_db(dbURL, pwd_salt_size=None, pwd_rounds=None): '''Initialize users database initialize database and create necessary tables to handle users oprations. :param dbURL: database url, as described in :func:`init_proxy` ''' if not dbURL: dbURL = 'sqlite:///:memory:' logging.get...
[ "def", "init_db", "(", "dbURL", ",", "pwd_salt_size", "=", "None", ",", "pwd_rounds", "=", "None", ")", ":", "if", "not", "dbURL", ":", "dbURL", "=", "'sqlite:///:memory:'", "logging", ".", "getLogger", "(", "__name__", ")", ".", "debug", "(", "\"Initializ...
Initialize users database initialize database and create necessary tables to handle users oprations. :param dbURL: database url, as described in :func:`init_proxy`
[ "Initialize", "users", "database" ]
python
train
andreikop/qutepart
qutepart/completer.py
https://github.com/andreikop/qutepart/blob/109d76b239751318bcef06f39b2fbbf18687a40b/qutepart/completer.py#L134-L141
def _makeListOfCompletions(self, wordBeforeCursor, wholeWord): """Make list of completions, which shall be shown """ onlySuitable = [word for word in self._wordSet \ if word.startswith(wordBeforeCursor) and \ word != wholeWord] ...
[ "def", "_makeListOfCompletions", "(", "self", ",", "wordBeforeCursor", ",", "wholeWord", ")", ":", "onlySuitable", "=", "[", "word", "for", "word", "in", "self", ".", "_wordSet", "if", "word", ".", "startswith", "(", "wordBeforeCursor", ")", "and", "word", "...
Make list of completions, which shall be shown
[ "Make", "list", "of", "completions", "which", "shall", "be", "shown" ]
python
train
openego/eTraGo
etrago/cluster/networkclustering.py
https://github.com/openego/eTraGo/blob/2a8fc6d4368d0e9abe6fe0d0c39baf66ea0126b9/etrago/cluster/networkclustering.py#L65-L141
def cluster_on_extra_high_voltage(network, busmap, with_time=True): """ Main function of the EHV-Clustering approach. Creates a new clustered pypsa.Network given a busmap mapping all bus_ids to other bus_ids of the same network. Parameters ---------- network : pypsa.Network Container fo...
[ "def", "cluster_on_extra_high_voltage", "(", "network", ",", "busmap", ",", "with_time", "=", "True", ")", ":", "network_c", "=", "Network", "(", ")", "buses", "=", "aggregatebuses", "(", "network", ",", "busmap", ",", "{", "'x'", ":", "_leading", "(", "bu...
Main function of the EHV-Clustering approach. Creates a new clustered pypsa.Network given a busmap mapping all bus_ids to other bus_ids of the same network. Parameters ---------- network : pypsa.Network Container for all network components. busmap : dict Maps old bus_ids to new...
[ "Main", "function", "of", "the", "EHV", "-", "Clustering", "approach", ".", "Creates", "a", "new", "clustered", "pypsa", ".", "Network", "given", "a", "busmap", "mapping", "all", "bus_ids", "to", "other", "bus_ids", "of", "the", "same", "network", "." ]
python
train
davidhuser/dhis2.py
dhis2/utils.py
https://github.com/davidhuser/dhis2.py/blob/78cbf1985506db21acdfa0f2e624bc397e455c82/dhis2/utils.py#L25-L46
def load_csv(path, delimiter=','): """ Load CSV file from path and yield CSV rows Usage: for row in load_csv('/path/to/file'): print(row) or list(load_csv('/path/to/file')) :param path: file path :param delimiter: CSV delimiter :return: a generator where __next__ is a row ...
[ "def", "load_csv", "(", "path", ",", "delimiter", "=", "','", ")", ":", "try", ":", "with", "open", "(", "path", ",", "'rb'", ")", "as", "csvfile", ":", "reader", "=", "DictReader", "(", "csvfile", ",", "delimiter", "=", "delimiter", ")", "for", "row...
Load CSV file from path and yield CSV rows Usage: for row in load_csv('/path/to/file'): print(row) or list(load_csv('/path/to/file')) :param path: file path :param delimiter: CSV delimiter :return: a generator where __next__ is a row of the CSV
[ "Load", "CSV", "file", "from", "path", "and", "yield", "CSV", "rows" ]
python
train
theislab/scvelo
scvelo/tools/velocity.py
https://github.com/theislab/scvelo/blob/c7a96d70edfe705e86bf364434a9527d4fd8df11/scvelo/tools/velocity.py#L104-L183
def velocity(data, vkey='velocity', mode=None, fit_offset=False, fit_offset2=False, filter_genes=False, groups=None, groupby=None, groups_for_fit=None, use_raw=False, perc=[5, 95], copy=False): """Estimates velocities in a gene-specific manner Arguments --------- data: :class:`~anndata.Ann...
[ "def", "velocity", "(", "data", ",", "vkey", "=", "'velocity'", ",", "mode", "=", "None", ",", "fit_offset", "=", "False", ",", "fit_offset2", "=", "False", ",", "filter_genes", "=", "False", ",", "groups", "=", "None", ",", "groupby", "=", "None", ","...
Estimates velocities in a gene-specific manner Arguments --------- data: :class:`~anndata.AnnData` Annotated data matrix. vkey: `str` (default: `'velocity'`) Name under which to refer to the computed velocities for `velocity_graph` and `velocity_embedding`. mode: `'deterministic'`, ...
[ "Estimates", "velocities", "in", "a", "gene", "-", "specific", "manner" ]
python
train
brutasse/rache
rache/__init__.py
https://github.com/brutasse/rache/blob/fa9cf073376a8c731a13924b84fb8422a771a4ab/rache/__init__.py#L90-L102
def delete_job(job_id, connection=None): """Deletes a job. :param job_id: unique identifier for this job >>> delete_job('http://example.com/test') """ if connection is None: connection = r with connection.pipeline() as pipe: pipe.delete(job_key(job_id)) pipe.zrem(REDIS_...
[ "def", "delete_job", "(", "job_id", ",", "connection", "=", "None", ")", ":", "if", "connection", "is", "None", ":", "connection", "=", "r", "with", "connection", ".", "pipeline", "(", ")", "as", "pipe", ":", "pipe", ".", "delete", "(", "job_key", "(",...
Deletes a job. :param job_id: unique identifier for this job >>> delete_job('http://example.com/test')
[ "Deletes", "a", "job", "." ]
python
train
tanghaibao/jcvi
jcvi/assembly/postprocess.py
https://github.com/tanghaibao/jcvi/blob/d2e31a77b6ade7f41f3b321febc2b4744d1cdeca/jcvi/assembly/postprocess.py#L365-L385
def overlapbatch(args): """ %prog overlapbatch ctgfasta poolfasta Fish out the sequences in `poolfasta` that overlap with `ctgfasta`. Mix and combine using `minimus2`. """ p = OptionParser(overlap.__doc__) opts, args = p.parse_args(args) if len(args) != 2: sys.exit(not p.print_h...
[ "def", "overlapbatch", "(", "args", ")", ":", "p", "=", "OptionParser", "(", "overlap", ".", "__doc__", ")", "opts", ",", "args", "=", "p", ".", "parse_args", "(", "args", ")", "if", "len", "(", "args", ")", "!=", "2", ":", "sys", ".", "exit", "(...
%prog overlapbatch ctgfasta poolfasta Fish out the sequences in `poolfasta` that overlap with `ctgfasta`. Mix and combine using `minimus2`.
[ "%prog", "overlapbatch", "ctgfasta", "poolfasta" ]
python
train
rgmining/ria
ria/credibility.py
https://github.com/rgmining/ria/blob/39223c67b7e59e10bd8e3a9062fb13f8bf893a5d/ria/credibility.py#L109-L119
def review_score(self, reviewer, product): """Find a review score from a given reviewer to a product. Args: reviewer: Reviewer i.e. an instance of :class:`ria.bipartite.Reviewer`. product: Product i.e. an instance of :class:`ria.bipartite.Product`. Returns: A revi...
[ "def", "review_score", "(", "self", ",", "reviewer", ",", "product", ")", ":", "return", "self", ".", "_g", ".", "retrieve_review", "(", "reviewer", ",", "product", ")", ".", "score" ]
Find a review score from a given reviewer to a product. Args: reviewer: Reviewer i.e. an instance of :class:`ria.bipartite.Reviewer`. product: Product i.e. an instance of :class:`ria.bipartite.Product`. Returns: A review object representing the review from the reviewer to...
[ "Find", "a", "review", "score", "from", "a", "given", "reviewer", "to", "a", "product", "." ]
python
train
postlund/pyatv
pyatv/__init__.py
https://github.com/postlund/pyatv/blob/655dfcda4e2f9d1c501540e18da4f480d8bf0e70/pyatv/__init__.py#L43-L49
def add_service(self, zeroconf, service_type, name): """Handle callback from zeroconf when a service has been discovered.""" self.lock.acquire() try: self._internal_add(zeroconf, service_type, name) finally: self.lock.release()
[ "def", "add_service", "(", "self", ",", "zeroconf", ",", "service_type", ",", "name", ")", ":", "self", ".", "lock", ".", "acquire", "(", ")", "try", ":", "self", ".", "_internal_add", "(", "zeroconf", ",", "service_type", ",", "name", ")", "finally", ...
Handle callback from zeroconf when a service has been discovered.
[ "Handle", "callback", "from", "zeroconf", "when", "a", "service", "has", "been", "discovered", "." ]
python
train
enkore/i3pystatus
i3pystatus/pulseaudio/__init__.py
https://github.com/enkore/i3pystatus/blob/14cfde967cecf79b40e223e35a04600f4c875af7/i3pystatus/pulseaudio/__init__.py#L67-L90
def init(self): """Creates context, when context is ready context_notify_cb is called""" # Wrap callback methods in appropriate ctypefunc instances so # that the Pulseaudio C API can call them self._context_notify_cb = pa_context_notify_cb_t( self.context_notify_cb) s...
[ "def", "init", "(", "self", ")", ":", "# Wrap callback methods in appropriate ctypefunc instances so", "# that the Pulseaudio C API can call them", "self", ".", "_context_notify_cb", "=", "pa_context_notify_cb_t", "(", "self", ".", "context_notify_cb", ")", "self", ".", "_sin...
Creates context, when context is ready context_notify_cb is called
[ "Creates", "context", "when", "context", "is", "ready", "context_notify_cb", "is", "called" ]
python
train
KristianOellegaard/django-health-check
health_check/views.py
https://github.com/KristianOellegaard/django-health-check/blob/575f811b7224dba0ef5f113791ca6aab20711041/health_check/views.py#L28-L36
def from_string(cls, value): """Return single instance parsed from given accept header string.""" match = cls.pattern.search(value) if match is None: raise ValueError('"%s" is not a valid media type' % value) try: return cls(match.group('mime_type'), float(match.g...
[ "def", "from_string", "(", "cls", ",", "value", ")", ":", "match", "=", "cls", ".", "pattern", ".", "search", "(", "value", ")", "if", "match", "is", "None", ":", "raise", "ValueError", "(", "'\"%s\" is not a valid media type'", "%", "value", ")", "try", ...
Return single instance parsed from given accept header string.
[ "Return", "single", "instance", "parsed", "from", "given", "accept", "header", "string", "." ]
python
train
QUANTAXIS/QUANTAXIS
QUANTAXIS/QAMarket/QAShipaneBroker.py
https://github.com/QUANTAXIS/QUANTAXIS/blob/bb1fe424e4108b62a1f712b81a05cf829297a5c0/QUANTAXIS/QAMarket/QAShipaneBroker.py#L215-L266
def query_positions(self, accounts): """查询现金和持仓 Arguments: accounts {[type]} -- [description] Returns: dict-- {'cash_available':xxx,'hold_available':xxx} """ try: data = self.call("positions", {'client': accounts}) if data is not ...
[ "def", "query_positions", "(", "self", ",", "accounts", ")", ":", "try", ":", "data", "=", "self", ".", "call", "(", "\"positions\"", ",", "{", "'client'", ":", "accounts", "}", ")", "if", "data", "is", "not", "None", ":", "cash_part", "=", "data", "...
查询现金和持仓 Arguments: accounts {[type]} -- [description] Returns: dict-- {'cash_available':xxx,'hold_available':xxx}
[ "查询现金和持仓" ]
python
train
openvax/datacache
datacache/database_helpers.py
https://github.com/openvax/datacache/blob/73bcac02d37cf153710a07fbdc636aa55cb214ca/datacache/database_helpers.py#L114-L142
def build_tables( table_names_to_dataframes, table_names_to_primary_keys={}, table_names_to_indices={}): """ Parameters ---------- table_names_to_dataframes : dict Dictionary mapping each table name to a DataFrame table_names_to_primary_keys : dict Dictionary...
[ "def", "build_tables", "(", "table_names_to_dataframes", ",", "table_names_to_primary_keys", "=", "{", "}", ",", "table_names_to_indices", "=", "{", "}", ")", ":", "tables", "=", "[", "]", "for", "table_name", ",", "df", "in", "table_names_to_dataframes", ".", "...
Parameters ---------- table_names_to_dataframes : dict Dictionary mapping each table name to a DataFrame table_names_to_primary_keys : dict Dictionary mapping each table to its primary key table_names_to_indices : dict Dictionary mapping each table to a set of indices Retu...
[ "Parameters", "----------", "table_names_to_dataframes", ":", "dict", "Dictionary", "mapping", "each", "table", "name", "to", "a", "DataFrame" ]
python
train
SmileyChris/django-countries
django_countries/__init__.py
https://github.com/SmileyChris/django-countries/blob/68b0934e8180d47bc15eff2887b6887aaa6e0228/django_countries/__init__.py#L137-L160
def translate_pair(self, code): """ Force a country to the current activated translation. :returns: ``CountryTuple(code, translated_country_name)`` namedtuple """ name = self.countries[code] if code in self.OLD_NAMES: # Check if there's an older translation a...
[ "def", "translate_pair", "(", "self", ",", "code", ")", ":", "name", "=", "self", ".", "countries", "[", "code", "]", "if", "code", "in", "self", ".", "OLD_NAMES", ":", "# Check if there's an older translation available if there's no", "# translation for the newest na...
Force a country to the current activated translation. :returns: ``CountryTuple(code, translated_country_name)`` namedtuple
[ "Force", "a", "country", "to", "the", "current", "activated", "translation", "." ]
python
train
pypa/pipenv
pipenv/vendor/dotenv/main.py
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/dotenv/main.py#L317-L348
def run_command(command, env): """Run command in sub process. Runs the command in a sub process with the variables from `env` added in the current environment variables. Parameters ---------- command: List[str] The command and it's parameters env: Dict The additional enviro...
[ "def", "run_command", "(", "command", ",", "env", ")", ":", "# copy the current environment variables and add the vales from", "# `env`", "cmd_env", "=", "os", ".", "environ", ".", "copy", "(", ")", "cmd_env", ".", "update", "(", "env", ")", "p", "=", "Popen", ...
Run command in sub process. Runs the command in a sub process with the variables from `env` added in the current environment variables. Parameters ---------- command: List[str] The command and it's parameters env: Dict The additional environment variables Returns -----...
[ "Run", "command", "in", "sub", "process", "." ]
python
train
blockchain/api-v1-client-python
blockchain/blockexplorer.py
https://github.com/blockchain/api-v1-client-python/blob/52ea562f824f04303e75239364e06722bec8620f/blockchain/blockexplorer.py#L59-L84
def get_address(address, filter=None, limit=None, offset=None, api_code=None): """Get data for a single address including an address balance and list of relevant transactions. :param str address: address(base58 or hash160) to look up :param FilterType filter: the filter for transactions selection (optional...
[ "def", "get_address", "(", "address", ",", "filter", "=", "None", ",", "limit", "=", "None", ",", "offset", "=", "None", ",", "api_code", "=", "None", ")", ":", "resource", "=", "'address/{0}?format=json'", ".", "format", "(", "address", ")", "if", "filt...
Get data for a single address including an address balance and list of relevant transactions. :param str address: address(base58 or hash160) to look up :param FilterType filter: the filter for transactions selection (optional) :param int limit: limit number of transactions to display (optional) :param ...
[ "Get", "data", "for", "a", "single", "address", "including", "an", "address", "balance", "and", "list", "of", "relevant", "transactions", "." ]
python
train
a1ezzz/wasp-general
wasp_general/task/thread.py
https://github.com/a1ezzz/wasp-general/blob/1029839d33eb663f8dec76c1c46754d53c1de4a9/wasp_general/task/thread.py#L247-L258
def check_events(self): """ Check "stopping"-events ('ready_event', 'stop_event', 'exception_event') if one of them is set. Usually True value means that thread is meant to be stopped, means that it is finished its job or some error has happened or this thread was asked to stop :return: bool """ return ( ...
[ "def", "check_events", "(", "self", ")", ":", "return", "(", "self", ".", "ready_event", "(", ")", ".", "is_set", "(", ")", "is", "True", "or", "self", ".", "stop_event", "(", ")", ".", "is_set", "(", ")", "is", "True", "or", "self", ".", "exceptio...
Check "stopping"-events ('ready_event', 'stop_event', 'exception_event') if one of them is set. Usually True value means that thread is meant to be stopped, means that it is finished its job or some error has happened or this thread was asked to stop :return: bool
[ "Check", "stopping", "-", "events", "(", "ready_event", "stop_event", "exception_event", ")", "if", "one", "of", "them", "is", "set", ".", "Usually", "True", "value", "means", "that", "thread", "is", "meant", "to", "be", "stopped", "means", "that", "it", "...
python
train
StackStorm/pybind
pybind/nos/v7_2_0/rbridge_id/router/router_bgp/router_bgp_attributes/graceful_shutdown/__init__.py
https://github.com/StackStorm/pybind/blob/44c467e71b2b425be63867aba6e6fa28b2cfe7fb/pybind/nos/v7_2_0/rbridge_id/router/router_bgp/router_bgp_attributes/graceful_shutdown/__init__.py#L127-L148
def _set_gshut_route_map(self, v, load=False): """ Setter method for gshut_route_map, mapped from YANG variable /rbridge_id/router/router_bgp/router_bgp_attributes/graceful_shutdown/gshut_route_map (rmap-type) If this variable is read-only (config: false) in the source YANG file, then _set_gshut_route_m...
[ "def", "_set_gshut_route_map", "(", "self", ",", "v", ",", "load", "=", "False", ")", ":", "if", "hasattr", "(", "v", ",", "\"_utype\"", ")", ":", "v", "=", "v", ".", "_utype", "(", "v", ")", "try", ":", "t", "=", "YANGDynClass", "(", "v", ",", ...
Setter method for gshut_route_map, mapped from YANG variable /rbridge_id/router/router_bgp/router_bgp_attributes/graceful_shutdown/gshut_route_map (rmap-type) If this variable is read-only (config: false) in the source YANG file, then _set_gshut_route_map is considered as a private method. Backends looking ...
[ "Setter", "method", "for", "gshut_route_map", "mapped", "from", "YANG", "variable", "/", "rbridge_id", "/", "router", "/", "router_bgp", "/", "router_bgp_attributes", "/", "graceful_shutdown", "/", "gshut_route_map", "(", "rmap", "-", "type", ")", "If", "this", ...
python
train
inspirehep/harvesting-kit
harvestingkit/bibrecord.py
https://github.com/inspirehep/harvesting-kit/blob/33a7f8aa9dade1d863110c6d8b27dfd955cb471f/harvestingkit/bibrecord.py#L761-L779
def record_move_fields(rec, tag, field_positions_local, field_position_local=None): """ Move some fields to the position specified by 'field_position_local'. :param rec: a record structure as returned by create_record() :param tag: the tag of the fields to be moved :param fie...
[ "def", "record_move_fields", "(", "rec", ",", "tag", ",", "field_positions_local", ",", "field_position_local", "=", "None", ")", ":", "fields", "=", "record_delete_fields", "(", "rec", ",", "tag", ",", "field_positions_local", "=", "field_positions_local", ")", "...
Move some fields to the position specified by 'field_position_local'. :param rec: a record structure as returned by create_record() :param tag: the tag of the fields to be moved :param field_positions_local: the positions of the fields to move :param field_position_local: insert the field before that ...
[ "Move", "some", "fields", "to", "the", "position", "specified", "by", "field_position_local", "." ]
python
valid
gem/oq-engine
openquake/hazardlib/gsim/campbell_2003.py
https://github.com/gem/oq-engine/blob/8294553a0b8aba33fd96437a35065d03547d0040/openquake/hazardlib/gsim/campbell_2003.py#L126-L133
def _compute_term2(self, C, mag, rrup): """ This computes the term f2 in equation 32, page 1021 """ c78_factor = (C['c7'] * np.exp(C['c8'] * mag)) ** 2 R = np.sqrt(rrup ** 2 + c78_factor) return C['c4'] * np.log(R) + (C['c5'] + C['c6'] * mag) * rrup
[ "def", "_compute_term2", "(", "self", ",", "C", ",", "mag", ",", "rrup", ")", ":", "c78_factor", "=", "(", "C", "[", "'c7'", "]", "*", "np", ".", "exp", "(", "C", "[", "'c8'", "]", "*", "mag", ")", ")", "**", "2", "R", "=", "np", ".", "sqrt...
This computes the term f2 in equation 32, page 1021
[ "This", "computes", "the", "term", "f2", "in", "equation", "32", "page", "1021" ]
python
train
olivier-m/rafter
rafter/contrib/schematics/filters.py
https://github.com/olivier-m/rafter/blob/aafcf8fd019f24abcf519307c4484cc6b4697c04/rafter/contrib/schematics/filters.py#L91-L142
def filter_validate_response(get_response, params): """ This filter process the returned response. It does 2 things: - If the response is a ``sanic.response.HTTPResponse`` and not a :class:`rafter.http.Response`, return it immediately. - It processes, validates and serializes this response when a...
[ "def", "filter_validate_response", "(", "get_response", ",", "params", ")", ":", "schema", "=", "params", ".", "get", "(", "'response_schema'", ")", "async", "def", "decorated_filter", "(", "request", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "r...
This filter process the returned response. It does 2 things: - If the response is a ``sanic.response.HTTPResponse`` and not a :class:`rafter.http.Response`, return it immediately. - It processes, validates and serializes this response when a schema is provided. That means that you can always r...
[ "This", "filter", "process", "the", "returned", "response", ".", "It", "does", "2", "things", ":" ]
python
train
tensorflow/cleverhans
examples/nips17_adversarial_competition/eval_infra/code/eval_lib/image_batches.py
https://github.com/tensorflow/cleverhans/blob/97488e215760547b81afc53f5e5de8ba7da5bd98/examples/nips17_adversarial_competition/eval_infra/code/eval_lib/image_batches.py#L224-L255
def init_from_storage_write_to_datastore(self, batch_size=100, allowed_epsilon=None, skip_image_ids=None, max_num_images=None): """Initializes d...
[ "def", "init_from_storage_write_to_datastore", "(", "self", ",", "batch_size", "=", "100", ",", "allowed_epsilon", "=", "None", ",", "skip_image_ids", "=", "None", ",", "max_num_images", "=", "None", ")", ":", "if", "allowed_epsilon", "is", "None", ":", "allowed...
Initializes dataset batches from the list of images in the datastore. Args: batch_size: batch size allowed_epsilon: list of allowed epsilon or None to use default skip_image_ids: list of image ids to skip max_num_images: maximum number of images to read
[ "Initializes", "dataset", "batches", "from", "the", "list", "of", "images", "in", "the", "datastore", "." ]
python
train
filestack/filestack-python
filestack/models/filestack_client.py
https://github.com/filestack/filestack-python/blob/f4d54c48987f3eeaad02d31cc5f6037e914bba0d/filestack/models/filestack_client.py#L96-L198
def upload(self, url=None, filepath=None, multipart=True, params=None, upload_processes=None, intelligent=False): """ Uploads a file either through a local filepath or external_url. Uses multipart by default and Intelligent Ingestion by default (if enabled). You can specify the number of...
[ "def", "upload", "(", "self", ",", "url", "=", "None", ",", "filepath", "=", "None", ",", "multipart", "=", "True", ",", "params", "=", "None", ",", "upload_processes", "=", "None", ",", "intelligent", "=", "False", ")", ":", "if", "params", ":", "# ...
Uploads a file either through a local filepath or external_url. Uses multipart by default and Intelligent Ingestion by default (if enabled). You can specify the number of multipart processes and pass in parameters. returns [Filestack.Filelink] ```python from filestack import Cli...
[ "Uploads", "a", "file", "either", "through", "a", "local", "filepath", "or", "external_url", ".", "Uses", "multipart", "by", "default", "and", "Intelligent", "Ingestion", "by", "default", "(", "if", "enabled", ")", ".", "You", "can", "specify", "the", "numbe...
python
train
saltstack/salt
salt/utils/network.py
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/network.py#L2005-L2054
def parse_host_port(host_port): """ Takes a string argument specifying host or host:port. Returns a (hostname, port) or (ip_address, port) tuple. If no port is given, the second (port) element of the returned tuple will be None. host:port argument, for example, is accepted in the forms of: -...
[ "def", "parse_host_port", "(", "host_port", ")", ":", "host", ",", "port", "=", "None", ",", "None", "# default", "_s_", "=", "host_port", "[", ":", "]", "if", "_s_", "[", "0", "]", "==", "\"[\"", ":", "if", "\"]\"", "in", "host_port", ":", "host", ...
Takes a string argument specifying host or host:port. Returns a (hostname, port) or (ip_address, port) tuple. If no port is given, the second (port) element of the returned tuple will be None. host:port argument, for example, is accepted in the forms of: - hostname - hostname:1234 - host...
[ "Takes", "a", "string", "argument", "specifying", "host", "or", "host", ":", "port", "." ]
python
train
ibis-project/ibis
ibis/expr/api.py
https://github.com/ibis-project/ibis/blob/1e39a5fd9ef088b45c155e8a5f541767ee8ef2e7/ibis/expr/api.py#L2051-L2073
def _lpad(self, length, pad=' '): """ Returns string of given length by truncating (on right) or padding (on left) original string Parameters ---------- length : int pad : string, default is ' ' Examples -------- >>> import ibis >>> table = ibis.table([('strings', 'string')...
[ "def", "_lpad", "(", "self", ",", "length", ",", "pad", "=", "' '", ")", ":", "return", "ops", ".", "LPad", "(", "self", ",", "length", ",", "pad", ")", ".", "to_expr", "(", ")" ]
Returns string of given length by truncating (on right) or padding (on left) original string Parameters ---------- length : int pad : string, default is ' ' Examples -------- >>> import ibis >>> table = ibis.table([('strings', 'string')]) >>> expr = table.strings.lpad(5, '-') ...
[ "Returns", "string", "of", "given", "length", "by", "truncating", "(", "on", "right", ")", "or", "padding", "(", "on", "left", ")", "original", "string" ]
python
train
Legobot/Legobot
Legobot/Lego.py
https://github.com/Legobot/Legobot/blob/d13da172960a149681cb5151ce34b2f3a58ad32b/Legobot/Lego.py#L73-L82
def cleanup(self): """ Clean up finished children. :return: None """ self.lock.acquire() logger.debug('Acquired lock in cleanup for ' + str(self)) self.children = [child for child in self.children if child.is_alive()] self.lock.release()
[ "def", "cleanup", "(", "self", ")", ":", "self", ".", "lock", ".", "acquire", "(", ")", "logger", ".", "debug", "(", "'Acquired lock in cleanup for '", "+", "str", "(", "self", ")", ")", "self", ".", "children", "=", "[", "child", "for", "child", "in",...
Clean up finished children. :return: None
[ "Clean", "up", "finished", "children", "." ]
python
train
PMEAL/OpenPNM
openpnm/utils/Project.py
https://github.com/PMEAL/OpenPNM/blob/0547b5724ffedc0a593aae48639d36fe10e0baed/openpnm/utils/Project.py#L509-L524
def _new_object(self, objtype, name=None): r""" """ if objtype.startswith('net'): obj = openpnm.network.GenericNetwork(project=self, name=name) elif objtype.startswith('geo'): obj = openpnm.geometry.GenericGeometry(project=self, name=name) elif objtype.sta...
[ "def", "_new_object", "(", "self", ",", "objtype", ",", "name", "=", "None", ")", ":", "if", "objtype", ".", "startswith", "(", "'net'", ")", ":", "obj", "=", "openpnm", ".", "network", ".", "GenericNetwork", "(", "project", "=", "self", ",", "name", ...
r"""
[ "r" ]
python
train
joelfrederico/SciSalt
scisalt/scipy/LinLsqFit_mod.py
https://github.com/joelfrederico/SciSalt/blob/7bf57c49c7dde0a8b0aa337fbd2fbd527ce7a67f/scisalt/scipy/LinLsqFit_mod.py#L91-L102
def X(self): """ The :math:`X` weighted properly by the errors from *y_error* """ if self._X is None: X = _copy.deepcopy(self.X_unweighted) # print 'X shape is {}'.format(X.shape) for i, el in enumerate(X): X[i, :] = el/self.y_error[i] ...
[ "def", "X", "(", "self", ")", ":", "if", "self", ".", "_X", "is", "None", ":", "X", "=", "_copy", ".", "deepcopy", "(", "self", ".", "X_unweighted", ")", "# print 'X shape is {}'.format(X.shape)", "for", "i", ",", "el", "in", "enumerate", "(", "X", ")"...
The :math:`X` weighted properly by the errors from *y_error*
[ "The", ":", "math", ":", "X", "weighted", "properly", "by", "the", "errors", "from", "*", "y_error", "*" ]
python
valid
Toblerity/rtree
rtree/index.py
https://github.com/Toblerity/rtree/blob/5d33357c8e88f1a8344415dc15a7d2440211b281/rtree/index.py#L396-L430
def count(self, coordinates): """Return number of objects that intersect the given coordinates. :param coordinates: sequence or array This may be an object that satisfies the numpy array protocol, providing the index's dimension * 2 coordinate pairs representing the ...
[ "def", "count", "(", "self", ",", "coordinates", ")", ":", "p_mins", ",", "p_maxs", "=", "self", ".", "get_coordinate_pointers", "(", "coordinates", ")", "p_num_results", "=", "ctypes", ".", "c_uint64", "(", "0", ")", "core", ".", "rt", ".", "Index_Interse...
Return number of objects that intersect the given coordinates. :param coordinates: sequence or array This may be an object that satisfies the numpy array protocol, providing the index's dimension * 2 coordinate pairs representing the `mink` and `maxk` coordinates in ...
[ "Return", "number", "of", "objects", "that", "intersect", "the", "given", "coordinates", "." ]
python
test
mzucker/noteshrink
noteshrink.py
https://github.com/mzucker/noteshrink/blob/7d876e5b43923c6bf8d64b7ef18f6855bfb30ce3/noteshrink.py#L311-L333
def load(input_filename): '''Load an image with Pillow and convert it to numpy array. Also returns the image DPI in x and y as a tuple.''' try: pil_img = Image.open(input_filename) except IOError: sys.stderr.write('warning: error opening {}\n'.format( input_filename)) r...
[ "def", "load", "(", "input_filename", ")", ":", "try", ":", "pil_img", "=", "Image", ".", "open", "(", "input_filename", ")", "except", "IOError", ":", "sys", ".", "stderr", ".", "write", "(", "'warning: error opening {}\\n'", ".", "format", "(", "input_file...
Load an image with Pillow and convert it to numpy array. Also returns the image DPI in x and y as a tuple.
[ "Load", "an", "image", "with", "Pillow", "and", "convert", "it", "to", "numpy", "array", ".", "Also", "returns", "the", "image", "DPI", "in", "x", "and", "y", "as", "a", "tuple", "." ]
python
train
ibis-project/ibis
ibis/impala/client.py
https://github.com/ibis-project/ibis/blob/1e39a5fd9ef088b45c155e8a5f541767ee8ef2e7/ibis/impala/client.py#L33-L40
def create_table(self, table_name, obj=None, **kwargs): """ Dispatch to ImpalaClient.create_table. See that function's docstring for more """ return self.client.create_table( table_name, obj=obj, database=self.name, **kwargs )
[ "def", "create_table", "(", "self", ",", "table_name", ",", "obj", "=", "None", ",", "*", "*", "kwargs", ")", ":", "return", "self", ".", "client", ".", "create_table", "(", "table_name", ",", "obj", "=", "obj", ",", "database", "=", "self", ".", "na...
Dispatch to ImpalaClient.create_table. See that function's docstring for more
[ "Dispatch", "to", "ImpalaClient", ".", "create_table", ".", "See", "that", "function", "s", "docstring", "for", "more" ]
python
train
sci-bots/pygtkhelpers
pygtkhelpers/ui/objectlist/column.py
https://github.com/sci-bots/pygtkhelpers/blob/3a6e6d6340221c686229cd1c951d7537dae81b07/pygtkhelpers/ui/objectlist/column.py#L252-L266
def render_tooltip(self, tooltip, obj): """Render the tooltip for this column for an object """ if self.tooltip_attr: val = getattr(obj, self.tooltip_attr) elif self.tooltip_value: val = self.tooltip_value else: return False setter = ge...
[ "def", "render_tooltip", "(", "self", ",", "tooltip", ",", "obj", ")", ":", "if", "self", ".", "tooltip_attr", ":", "val", "=", "getattr", "(", "obj", ",", "self", ".", "tooltip_attr", ")", "elif", "self", ".", "tooltip_value", ":", "val", "=", "self",...
Render the tooltip for this column for an object
[ "Render", "the", "tooltip", "for", "this", "column", "for", "an", "object" ]
python
train
globocom/GloboNetworkAPI-client-python
networkapiclient/ApiEnvironment.py
https://github.com/globocom/GloboNetworkAPI-client-python/blob/cf34f913da48d9abbf750114f5d2ac4b2dde137d/networkapiclient/ApiEnvironment.py#L67-L80
def update_environment(self, environment, environment_ids): """ Method to update environment :param environment_ids: Ids of Environment """ uri = 'api/v3/environment/%s/' % environment_ids data = dict() data['environments'] = list() data['environments']...
[ "def", "update_environment", "(", "self", ",", "environment", ",", "environment_ids", ")", ":", "uri", "=", "'api/v3/environment/%s/'", "%", "environment_ids", "data", "=", "dict", "(", ")", "data", "[", "'environments'", "]", "=", "list", "(", ")", "data", ...
Method to update environment :param environment_ids: Ids of Environment
[ "Method", "to", "update", "environment" ]
python
train
cthoyt/onto2nx
src/onto2nx/ontospy/core/ontospy.py
https://github.com/cthoyt/onto2nx/blob/94c86e5e187cca67534afe0260097177b66e02c8/src/onto2nx/ontospy/core/ontospy.py#L721-L731
def nextClass(self, classuri): """Returns the next class in the list of classes. If it's the last one, returns the first one.""" if classuri == self.classes[-1].uri: return self.classes[0] flag = False for x in self.classes: if flag == True: return...
[ "def", "nextClass", "(", "self", ",", "classuri", ")", ":", "if", "classuri", "==", "self", ".", "classes", "[", "-", "1", "]", ".", "uri", ":", "return", "self", ".", "classes", "[", "0", "]", "flag", "=", "False", "for", "x", "in", "self", ".",...
Returns the next class in the list of classes. If it's the last one, returns the first one.
[ "Returns", "the", "next", "class", "in", "the", "list", "of", "classes", ".", "If", "it", "s", "the", "last", "one", "returns", "the", "first", "one", "." ]
python
train
orbingol/NURBS-Python
geomdl/operations.py
https://github.com/orbingol/NURBS-Python/blob/b1c6a8b51cf143ff58761438e93ba6baef470627/geomdl/operations.py#L1419-L1442
def normal(obj, params, **kwargs): """ Evaluates the normal vector of the curves or surfaces at the input parameter values. This function is designed to evaluate normal vectors of the B-Spline and NURBS shapes at single or multiple parameter positions. :param obj: input geometry :type obj: abstrac...
[ "def", "normal", "(", "obj", ",", "params", ",", "*", "*", "kwargs", ")", ":", "normalize", "=", "kwargs", ".", "get", "(", "'normalize'", ",", "True", ")", "if", "isinstance", "(", "obj", ",", "abstract", ".", "Curve", ")", ":", "if", "isinstance", ...
Evaluates the normal vector of the curves or surfaces at the input parameter values. This function is designed to evaluate normal vectors of the B-Spline and NURBS shapes at single or multiple parameter positions. :param obj: input geometry :type obj: abstract.Curve or abstract.Surface :param para...
[ "Evaluates", "the", "normal", "vector", "of", "the", "curves", "or", "surfaces", "at", "the", "input", "parameter", "values", "." ]
python
train
stevearc/dql
dql/engine.py
https://github.com/stevearc/dql/blob/e9d3aa22873076dae5ebd02e35318aa996b1e56a/dql/engine.py#L77-L94
def iter_insert_items(tree): """ Iterate over the items to insert from an INSERT statement """ if tree.list_values: keys = tree.attrs for values in tree.list_values: if len(keys) != len(values): raise SyntaxError( "Values '%s' do not match attribut...
[ "def", "iter_insert_items", "(", "tree", ")", ":", "if", "tree", ".", "list_values", ":", "keys", "=", "tree", ".", "attrs", "for", "values", "in", "tree", ".", "list_values", ":", "if", "len", "(", "keys", ")", "!=", "len", "(", "values", ")", ":", ...
Iterate over the items to insert from an INSERT statement
[ "Iterate", "over", "the", "items", "to", "insert", "from", "an", "INSERT", "statement" ]
python
train
jgorset/django-respite
respite/utils/parsers.py
https://github.com/jgorset/django-respite/blob/719469d11baf91d05917bab1623bd82adc543546/respite/utils/parsers.py#L10-L29
def parse_content_type(content_type): """ Return a tuple of content type and charset. :param content_type: A string describing a content type. """ if '; charset=' in content_type: return tuple(content_type.split('; charset=')) else: if 'text' in content_type: encodin...
[ "def", "parse_content_type", "(", "content_type", ")", ":", "if", "'; charset='", "in", "content_type", ":", "return", "tuple", "(", "content_type", ".", "split", "(", "'; charset='", ")", ")", "else", ":", "if", "'text'", "in", "content_type", ":", "encoding"...
Return a tuple of content type and charset. :param content_type: A string describing a content type.
[ "Return", "a", "tuple", "of", "content", "type", "and", "charset", "." ]
python
train
ternaris/marv
marv_node/node.py
https://github.com/ternaris/marv/blob/c221354d912ff869bbdb4f714a86a70be30d823e/marv_node/node.py#L39-L73
def input(name, default=None, foreach=None): """Decorator to declare input for a node. Plain inputs, that is plain python objects, are directly passed to the node. Whereas streams generated by other nodes are requested and once the handles of all input streams are available the node is instantiated...
[ "def", "input", "(", "name", ",", "default", "=", "None", ",", "foreach", "=", "None", ")", ":", "assert", "default", "is", "None", "or", "foreach", "is", "None", "value", "=", "foreach", "if", "foreach", "is", "not", "None", "else", "default", "value"...
Decorator to declare input for a node. Plain inputs, that is plain python objects, are directly passed to the node. Whereas streams generated by other nodes are requested and once the handles of all input streams are available the node is instantiated. Args: name (str): Name of the node fu...
[ "Decorator", "to", "declare", "input", "for", "a", "node", "." ]
python
train
DLR-RM/RAFCON
source/rafcon/gui/helpers/state.py
https://github.com/DLR-RM/RAFCON/blob/24942ef1a904531f49ab8830a1dbb604441be498/source/rafcon/gui/helpers/state.py#L40-L63
def negative_check_for_model_in_expected_future_models(target_state_m, model, msg, delete=True, with_logger=None): """ Checks if the expected future models list/set includes still a specific model Return False if the handed model is still in and also creates a warning message as feedback. :param StateMode...
[ "def", "negative_check_for_model_in_expected_future_models", "(", "target_state_m", ",", "model", ",", "msg", ",", "delete", "=", "True", ",", "with_logger", "=", "None", ")", ":", "if", "with_logger", "is", "None", ":", "with_logger", "=", "logger", "# check that...
Checks if the expected future models list/set includes still a specific model Return False if the handed model is still in and also creates a warning message as feedback. :param StateModel target_state_m: The state model which expected_future_models attribute should be checked :param Model model: Model to...
[ "Checks", "if", "the", "expected", "future", "models", "list", "/", "set", "includes", "still", "a", "specific", "model" ]
python
train
sholsapp/py509
py509/x509.py
https://github.com/sholsapp/py509/blob/83bd6786a8ec1543b66c42ea5523e611c3e8dc5a/py509/x509.py#L71-L93
def make_certificate_signing_request(pkey, digest='sha512', **name): """Make a certificate signing request. :param OpenSSL.crypto.PKey pkey: A private key. :param str digest: A valid digest to use. For example, `sha512`. :param name: Key word arguments containing subject name parts: C, ST, L, O, OU, CN. ...
[ "def", "make_certificate_signing_request", "(", "pkey", ",", "digest", "=", "'sha512'", ",", "*", "*", "name", ")", ":", "csr", "=", "crypto", ".", "X509Req", "(", ")", "subj", "=", "csr", ".", "get_subject", "(", ")", "subj", ".", "C", "=", "name", ...
Make a certificate signing request. :param OpenSSL.crypto.PKey pkey: A private key. :param str digest: A valid digest to use. For example, `sha512`. :param name: Key word arguments containing subject name parts: C, ST, L, O, OU, CN. :return: A certificate signing request. :rtype: :class:`OpenSSL.crypto.X...
[ "Make", "a", "certificate", "signing", "request", "." ]
python
train
Rapptz/discord.py
discord/client.py
https://github.com/Rapptz/discord.py/blob/05d4f7f9620ef33635d6ac965b26528e09cdaf5b/discord/client.py#L1106-L1142
async def fetch_user_profile(self, user_id): """|coro| Gets an arbitrary user's profile. This can only be used by non-bot accounts. Parameters ------------ user_id: :class:`int` The ID of the user to fetch their profile for. Raises ------- F...
[ "async", "def", "fetch_user_profile", "(", "self", ",", "user_id", ")", ":", "state", "=", "self", ".", "_connection", "data", "=", "await", "self", ".", "http", ".", "get_user_profile", "(", "user_id", ")", "def", "transform", "(", "d", ")", ":", "retur...
|coro| Gets an arbitrary user's profile. This can only be used by non-bot accounts. Parameters ------------ user_id: :class:`int` The ID of the user to fetch their profile for. Raises ------- Forbidden Not allowed to fetch profiles. ...
[ "|coro|" ]
python
train
RJT1990/pyflux
pyflux/ensembles/mixture_of_experts.py
https://github.com/RJT1990/pyflux/blob/297f2afc2095acd97c12e827dd500e8ea5da0c0f/pyflux/ensembles/mixture_of_experts.py#L153-L188
def _model_predict_is(self, h, recalculate=False, fit_once=True): """ Outputs ensemble model predictions for the end-of-period data Parameters ---------- h : int How many steps at the end of the series to run the ensemble on recalculate: boolean ...
[ "def", "_model_predict_is", "(", "self", ",", "h", ",", "recalculate", "=", "False", ",", "fit_once", "=", "True", ")", ":", "if", "len", "(", "self", ".", "model_predictions_is", ")", "==", "0", "or", "h", "!=", "self", ".", "h", "or", "recalculate", ...
Outputs ensemble model predictions for the end-of-period data Parameters ---------- h : int How many steps at the end of the series to run the ensemble on recalculate: boolean Whether to recalculate the predictions or not fit_once : boolean ...
[ "Outputs", "ensemble", "model", "predictions", "for", "the", "end", "-", "of", "-", "period", "data", "Parameters", "----------", "h", ":", "int", "How", "many", "steps", "at", "the", "end", "of", "the", "series", "to", "run", "the", "ensemble", "on" ]
python
train
heuer/cablemap
cablemap.core/cablemap/core/reader.py
https://github.com/heuer/cablemap/blob/42066c8fc2972d237a2c35578e14525aaf705f38/cablemap.core/cablemap/core/reader.py#L226-L262
def header_body_from_content(content): """\ Tries to extract the header and the message from the cable content. The header is something like UNCLASSIFIED ... SUBJECT ... REF ... while the message begins usually with a summary 1. SUMMARY ... ... 10. ......
[ "def", "header_body_from_content", "(", "content", ")", ":", "m", "=", "_CLASSIFIED_BY_PATTERN", ".", "search", "(", "content", ")", "idx", "=", "m", "and", "m", ".", "end", "(", ")", "or", "0", "m", "=", "_SUMMARY_PATTERN", ".", "search", "(", "content"...
\ Tries to extract the header and the message from the cable content. The header is something like UNCLASSIFIED ... SUBJECT ... REF ... while the message begins usually with a summary 1. SUMMARY ... ... 10. ... Returns (header, msg) or (None, None...
[ "\\", "Tries", "to", "extract", "the", "header", "and", "the", "message", "from", "the", "cable", "content", "." ]
python
train
berkeley-cocosci/Wallace
wallace/custom.py
https://github.com/berkeley-cocosci/Wallace/blob/3650c0bc3b0804d0adb1d178c5eba9992babb1b0/wallace/custom.py#L913-L1006
def node_transmit(node_id): """Transmit to another node. The sender's node id must be specified in the url. As with node.transmit() the key parameters are what and to_whom. However, the values these accept are more limited than for the back end due to the necessity of serialization. If what a...
[ "def", "node_transmit", "(", "node_id", ")", ":", "exp", "=", "experiment", "(", "session", ")", "what", "=", "request_parameter", "(", "parameter", "=", "\"what\"", ",", "optional", "=", "True", ")", "to_whom", "=", "request_parameter", "(", "parameter", "=...
Transmit to another node. The sender's node id must be specified in the url. As with node.transmit() the key parameters are what and to_whom. However, the values these accept are more limited than for the back end due to the necessity of serialization. If what and to_whom are not specified they w...
[ "Transmit", "to", "another", "node", "." ]
python
train
bcbio/bcbio-nextgen
bcbio/variation/vfilter.py
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/variation/vfilter.py#L121-L133
def _calc_vcf_stats(in_file): """Calculate statistics on VCF for filtering, saving to a file for quick re-runs. """ out_file = "%s-stats.yaml" % utils.splitext_plus(in_file)[0] if not utils.file_exists(out_file): stats = {"avg_depth": _average_called_depth(in_file)} with open(out_file, "...
[ "def", "_calc_vcf_stats", "(", "in_file", ")", ":", "out_file", "=", "\"%s-stats.yaml\"", "%", "utils", ".", "splitext_plus", "(", "in_file", ")", "[", "0", "]", "if", "not", "utils", ".", "file_exists", "(", "out_file", ")", ":", "stats", "=", "{", "\"a...
Calculate statistics on VCF for filtering, saving to a file for quick re-runs.
[ "Calculate", "statistics", "on", "VCF", "for", "filtering", "saving", "to", "a", "file", "for", "quick", "re", "-", "runs", "." ]
python
train
bpsmith/tia
tia/rlab/table.py
https://github.com/bpsmith/tia/blob/a7043b6383e557aeea8fc7112bbffd6e36a230e9/tia/rlab/table.py#L899-L905
def _find_column_label_positions(self, match_value_or_fct, levels=None): """Check the original DataFrame's column labels to find the locations of columns. And return the adjusted column indexing within region (offset if including index)""" allmatches = find_locations(self.df.columns, match_value...
[ "def", "_find_column_label_positions", "(", "self", ",", "match_value_or_fct", ",", "levels", "=", "None", ")", ":", "allmatches", "=", "find_locations", "(", "self", ".", "df", ".", "columns", ",", "match_value_or_fct", ",", "levels", ")", "if", "allmatches", ...
Check the original DataFrame's column labels to find the locations of columns. And return the adjusted column indexing within region (offset if including index)
[ "Check", "the", "original", "DataFrame", "s", "column", "labels", "to", "find", "the", "locations", "of", "columns", ".", "And", "return", "the", "adjusted", "column", "indexing", "within", "region", "(", "offset", "if", "including", "index", ")" ]
python
train
mongolab/dex
dex/dex.py
https://github.com/mongolab/dex/blob/f6dc27321028ef1ffdb3d4b1165fdcce7c8f20aa/dex/dex.py#L264-L287
def watch_logfile(self, logfile_path): """Analyzes queries from the tail of a given log file""" self._run_stats['logSource'] = logfile_path log_parser = LogParser() # For each new line in the logfile ... output_time = time.time() + WATCH_DISPLAY_REFRESH_SECONDS try: ...
[ "def", "watch_logfile", "(", "self", ",", "logfile_path", ")", ":", "self", ".", "_run_stats", "[", "'logSource'", "]", "=", "logfile_path", "log_parser", "=", "LogParser", "(", ")", "# For each new line in the logfile ...", "output_time", "=", "time", ".", "time"...
Analyzes queries from the tail of a given log file
[ "Analyzes", "queries", "from", "the", "tail", "of", "a", "given", "log", "file" ]
python
train
clalancette/pycdlib
pycdlib/headervd.py
https://github.com/clalancette/pycdlib/blob/1e7b77a809e905d67dc71e12d70e850be26b6233/pycdlib/headervd.py#L548-L563
def add_to_space_size(self, addition_bytes): # type: (int) -> None ''' A method to add bytes to the space size tracked by this Volume Descriptor. Parameters: addition_bytes - The number of bytes to add to the space size. Returns: Nothing. ''' ...
[ "def", "add_to_space_size", "(", "self", ",", "addition_bytes", ")", ":", "# type: (int) -> None", "if", "not", "self", ".", "_initialized", ":", "raise", "pycdlibexception", ".", "PyCdlibInternalError", "(", "'This Volume Descriptor is not yet initialized'", ")", "# The ...
A method to add bytes to the space size tracked by this Volume Descriptor. Parameters: addition_bytes - The number of bytes to add to the space size. Returns: Nothing.
[ "A", "method", "to", "add", "bytes", "to", "the", "space", "size", "tracked", "by", "this", "Volume", "Descriptor", "." ]
python
train
tcalmant/ipopo
pelix/remote/beans.py
https://github.com/tcalmant/ipopo/blob/2f9ae0c44cd9c34ef1a9d50837b3254e75678eb1/pelix/remote/beans.py#L655-L693
def from_export(cls, endpoint): # type: (ExportEndpoint) -> EndpointDescription """ Converts an ExportEndpoint bean to an EndpointDescription :param endpoint: An ExportEndpoint bean :return: An EndpointDescription bean """ assert isinstance(endpoint, ExportEndpoi...
[ "def", "from_export", "(", "cls", ",", "endpoint", ")", ":", "# type: (ExportEndpoint) -> EndpointDescription", "assert", "isinstance", "(", "endpoint", ",", "ExportEndpoint", ")", "# Service properties", "properties", "=", "endpoint", ".", "get_properties", "(", ")", ...
Converts an ExportEndpoint bean to an EndpointDescription :param endpoint: An ExportEndpoint bean :return: An EndpointDescription bean
[ "Converts", "an", "ExportEndpoint", "bean", "to", "an", "EndpointDescription" ]
python
train
edwards-lab/libGWAS
libgwas/pedigree_parser.py
https://github.com/edwards-lab/libGWAS/blob/d68c9a083d443dfa5d7c5112de29010909cfe23f/libgwas/pedigree_parser.py#L141-L305
def load_genotypes(self, pheno_covar): """Load all data into memory and propagate valid individuals to \ pheno_covar. :param pheno_covar: Phenotype/covariate object is updated with subject information :return: None """ first_genotype = 6 pheno_col =...
[ "def", "load_genotypes", "(", "self", ",", "pheno_covar", ")", ":", "first_genotype", "=", "6", "pheno_col", "=", "5", "if", "not", "DataParser", ".", "has_sex", ":", "first_genotype", "-=", "1", "pheno_col", "-=", "1", "if", "not", "DataParser", ".", "has...
Load all data into memory and propagate valid individuals to \ pheno_covar. :param pheno_covar: Phenotype/covariate object is updated with subject information :return: None
[ "Load", "all", "data", "into", "memory", "and", "propagate", "valid", "individuals", "to", "\\", "pheno_covar", "." ]
python
train