code
stringlengths
51
2.34k
sequence
stringlengths
186
3.94k
docstring
stringlengths
11
171
def _build_message(self, to, text, subject=None, mtype=None, unsubscribe_url=None): if subject is None: subject = u'%s' % _('No Subject') if mtype == 'html': msg = self.mime_multipart() text_part = self.mime_multipart('alternative') text_part.attach(self.mime_text(strip_tags(text), _charset='utf-8')) text_part.attach(self.mime_text(text, 'html', _charset='utf-8')) msg.attach(text_part) else: msg = self.mime_text(text, _charset='utf-8') msg['From'] = self.from_email msg['To'] = to msg['Subject'] = subject if unsubscribe_url: msg['List-Unsubscribe'] = '<%s>' % unsubscribe_url return msg
module function_definition identifier parameters identifier identifier identifier default_parameter identifier none default_parameter identifier none default_parameter identifier none block if_statement comparison_operator identifier none block expression_statement assignment identifier binary_operator string string_start string_content string_end call identifier argument_list string string_start string_content string_end if_statement comparison_operator identifier string string_start string_content string_end block expression_statement assignment identifier call attribute identifier identifier argument_list expression_statement assignment identifier call attribute identifier identifier argument_list string string_start string_content string_end expression_statement call attribute identifier identifier argument_list call attribute identifier identifier argument_list call identifier argument_list identifier keyword_argument identifier string string_start string_content string_end expression_statement call attribute identifier identifier argument_list call attribute identifier identifier argument_list identifier string string_start string_content string_end keyword_argument identifier string string_start string_content string_end expression_statement call attribute identifier identifier argument_list identifier else_clause block expression_statement assignment identifier call attribute identifier identifier argument_list identifier keyword_argument identifier string string_start string_content string_end expression_statement assignment subscript identifier string string_start string_content string_end attribute identifier identifier expression_statement assignment subscript identifier string string_start string_content string_end identifier expression_statement assignment subscript identifier string string_start string_content string_end identifier if_statement identifier block expression_statement assignment subscript identifier string string_start string_content string_end binary_operator string string_start string_content string_end identifier return_statement identifier
Constructs a MIME message from message and dispatch models.
def compress(func): @wraps(func) def wrapper(*args, **kwargs): result = func(*args, **kwargs) if ('gzip' in bottle.request.headers.get('Accept-Encoding', '') and isinstance(result, string_type) and len(result) > 1024): if isinstance(result, unicode): result = result.encode('utf-8') tmp_fo = BytesIO() with gzip.GzipFile(mode='wb', fileobj=tmp_fo) as gzip_fo: gzip_fo.write(result) result = tmp_fo.getvalue() bottle.response.add_header('Content-Encoding', 'gzip') return result return wrapper
module function_definition identifier parameters identifier block decorated_definition decorator call identifier argument_list identifier function_definition identifier parameters list_splat_pattern identifier dictionary_splat_pattern identifier block expression_statement assignment identifier call identifier argument_list list_splat identifier dictionary_splat identifier if_statement parenthesized_expression boolean_operator boolean_operator comparison_operator string string_start string_content string_end call attribute attribute attribute identifier identifier identifier identifier argument_list string string_start string_content string_end string string_start string_end call identifier argument_list identifier identifier comparison_operator call identifier argument_list identifier integer block if_statement call identifier argument_list identifier identifier block expression_statement assignment identifier call attribute identifier identifier argument_list string string_start string_content string_end expression_statement assignment identifier call identifier argument_list with_statement with_clause with_item as_pattern call attribute identifier identifier argument_list keyword_argument identifier string string_start string_content string_end keyword_argument identifier identifier as_pattern_target identifier block expression_statement call attribute identifier identifier argument_list identifier expression_statement assignment identifier call attribute identifier identifier argument_list expression_statement call attribute attribute identifier identifier identifier argument_list string string_start string_content string_end string string_start string_content string_end return_statement identifier return_statement identifier
Compress route return data with gzip compression
def cleanup_virtualenv(bare=True): if not bare: click.echo(crayons.red("Environment creation aborted.")) try: vistir.path.rmtree(project.virtualenv_location) except OSError as e: click.echo( "{0} An error occurred while removing {1}!".format( crayons.red("Error: ", bold=True), crayons.green(project.virtualenv_location), ), err=True, ) click.echo(crayons.blue(e), err=True)
module function_definition identifier parameters default_parameter identifier true block if_statement not_operator identifier block expression_statement call attribute identifier identifier argument_list call attribute identifier identifier argument_list string string_start string_content string_end try_statement block expression_statement call attribute attribute identifier identifier identifier argument_list attribute identifier identifier except_clause as_pattern identifier as_pattern_target identifier block expression_statement call attribute identifier identifier argument_list call attribute string string_start string_content string_end identifier argument_list call attribute identifier identifier argument_list string string_start string_content string_end keyword_argument identifier true call attribute identifier identifier argument_list attribute identifier identifier keyword_argument identifier true expression_statement call attribute identifier identifier argument_list call attribute identifier identifier argument_list identifier keyword_argument identifier true
Removes the virtualenv directory from the system.
def last_commit(): try: root = subprocess.check_output( ['hg', 'parent', '--template={node}'], stderr=subprocess.STDOUT).strip() return root.decode('utf-8') except subprocess.CalledProcessError: return None
module function_definition identifier parameters block try_statement block expression_statement assignment identifier call attribute call attribute identifier identifier argument_list list string string_start string_content string_end string string_start string_content string_end string string_start string_content string_end keyword_argument identifier attribute identifier identifier identifier argument_list return_statement call attribute identifier identifier argument_list string string_start string_content string_end except_clause attribute identifier identifier block return_statement none
Returns the SHA1 of the last commit.
def _serializer(obj): import datetime if isinstance(obj, datetime.datetime): if obj.utcoffset() is not None: obj = obj - obj.utcoffset() return obj.__str__() return obj
module function_definition identifier parameters identifier block import_statement dotted_name identifier if_statement call identifier argument_list identifier attribute identifier identifier block if_statement comparison_operator call attribute identifier identifier argument_list none block expression_statement assignment identifier binary_operator identifier call attribute identifier identifier argument_list return_statement call attribute identifier identifier argument_list return_statement identifier
helper function to serialize some objects for prettier return
def list_to_json(source_list): result = [] for item in source_list: result.append(item.to_json()) return result
module function_definition identifier parameters identifier block expression_statement assignment identifier list for_statement identifier identifier block expression_statement call attribute identifier identifier argument_list call attribute identifier identifier argument_list return_statement identifier
Serialise all the items in source_list to json
def register(self, recipe): if not isinstance(recipe, (list, tuple)): recipe = [recipe, ] for item in recipe: recipe = self.get_recipe_instance_from_class(item) self._registry[recipe.slug] = recipe
module function_definition identifier parameters identifier identifier block if_statement not_operator call identifier argument_list identifier tuple identifier identifier block expression_statement assignment identifier list identifier for_statement identifier identifier block expression_statement assignment identifier call attribute identifier identifier argument_list identifier expression_statement assignment subscript attribute identifier identifier attribute identifier identifier identifier
Registers a new recipe class.
def _api_get(path, server=None): server = _get_server(server) response = requests.get( url=_get_url(server['ssl'], server['url'], server['port'], path), auth=_get_auth(server['user'], server['password']), headers=_get_headers(), verify=False ) return _api_response(response)
module function_definition identifier parameters identifier default_parameter identifier none block expression_statement assignment identifier call identifier argument_list identifier expression_statement assignment identifier call attribute identifier identifier argument_list keyword_argument identifier call identifier argument_list subscript identifier string string_start string_content string_end subscript identifier string string_start string_content string_end subscript identifier string string_start string_content string_end identifier keyword_argument identifier call identifier argument_list subscript identifier string string_start string_content string_end subscript identifier string string_start string_content string_end keyword_argument identifier call identifier argument_list keyword_argument identifier false return_statement call identifier argument_list identifier
Do a GET request to the API
def register_actionhandler(self, action_handler: type) -> None: for k in action_handler.__dict__: if k.startswith('_'): continue app = action_handler_adapter(action_handler, k) self.register_app(k, app)
module function_definition identifier parameters identifier typed_parameter identifier type identifier type none block for_statement identifier attribute identifier identifier block if_statement call attribute identifier identifier argument_list string string_start string_content string_end block continue_statement expression_statement assignment identifier call identifier argument_list identifier identifier expression_statement call attribute identifier identifier argument_list identifier identifier
register class as action handler
def OnDeleteCols(self, event): bbox = self.grid.selection.get_bbox() if bbox is None or bbox[1][1] is None: del_point = self.grid.actions.cursor[1] no_cols = 1 else: del_point = bbox[0][1] no_cols = self._get_no_rowscols(bbox)[1] with undo.group(_("Delete columns")): self.grid.actions.delete_cols(del_point, no_cols) self.grid.GetTable().ResetView() self.grid.actions.zoom() event.Skip()
module function_definition identifier parameters identifier identifier block expression_statement assignment identifier call attribute attribute attribute identifier identifier identifier identifier argument_list if_statement boolean_operator comparison_operator identifier none comparison_operator subscript subscript identifier integer integer none block expression_statement assignment identifier subscript attribute attribute attribute identifier identifier identifier identifier integer expression_statement assignment identifier integer else_clause block expression_statement assignment identifier subscript subscript identifier integer integer expression_statement assignment identifier subscript call attribute identifier identifier argument_list identifier integer with_statement with_clause with_item call attribute identifier identifier argument_list call identifier argument_list string string_start string_content string_end block expression_statement call attribute attribute attribute identifier identifier identifier identifier argument_list identifier identifier expression_statement call attribute call attribute attribute identifier identifier identifier argument_list identifier argument_list expression_statement call attribute attribute attribute identifier identifier identifier identifier argument_list expression_statement call attribute identifier identifier argument_list
Deletes columns from all tables of the grid
def place_notes_at(self, notes, at): for x in self.bar: if x[0] == at: x[0][2] += notes
module function_definition identifier parameters identifier identifier identifier block for_statement identifier attribute identifier identifier block if_statement comparison_operator subscript identifier integer identifier block expression_statement augmented_assignment subscript subscript identifier integer integer identifier
Place notes at the given index.
def cancelOperation(self): if self.isLongTouchingPoint: self.toggleLongTouchPoint() elif self.isTouchingPoint: self.toggleTouchPoint() elif self.isGeneratingTestCondition: self.toggleGenerateTestCondition()
module function_definition identifier parameters identifier block if_statement attribute identifier identifier block expression_statement call attribute identifier identifier argument_list elif_clause attribute identifier identifier block expression_statement call attribute identifier identifier argument_list elif_clause attribute identifier identifier block expression_statement call attribute identifier identifier argument_list
Cancels the ongoing operation if any.
def release(self): lock = vars(self).pop('lock', missing) lock is not missing and self._release(lock)
module function_definition identifier parameters identifier block expression_statement assignment identifier call attribute call identifier argument_list identifier identifier argument_list string string_start string_content string_end identifier expression_statement boolean_operator comparison_operator identifier identifier call attribute identifier identifier argument_list identifier
Release the lock and cleanup
def pending_tasks(self, res): "Synchronized access to tasks" jobs, lock = self._jobs with lock: return jobs[res].copy()
module function_definition identifier parameters identifier identifier block expression_statement string string_start string_content string_end expression_statement assignment pattern_list identifier identifier attribute identifier identifier with_statement with_clause with_item identifier block return_statement call attribute subscript identifier identifier identifier argument_list
Synchronized access to tasks
def enable_reporting(self): if self.mode is not INPUT: raise IOError("{0} is not an input and can therefore not report".format(self)) if self.type == ANALOG: self.reporting = True msg = bytearray([REPORT_ANALOG + self.pin_number, 1]) self.board.sp.write(msg) else: self.port.enable_reporting()
module function_definition identifier parameters identifier block if_statement comparison_operator attribute identifier identifier identifier block raise_statement call identifier argument_list call attribute string string_start string_content string_end identifier argument_list identifier if_statement comparison_operator attribute identifier identifier identifier block expression_statement assignment attribute identifier identifier true expression_statement assignment identifier call identifier argument_list list binary_operator identifier attribute identifier identifier integer expression_statement call attribute attribute attribute identifier identifier identifier identifier argument_list identifier else_clause block expression_statement call attribute attribute identifier identifier identifier argument_list
Set an input pin to report values.
def compile_pillar(self): load = {'id': self.minion_id, 'grains': self.grains, 'saltenv': self.opts['saltenv'], 'pillarenv': self.opts['pillarenv'], 'pillar_override': self.pillar_override, 'extra_minion_data': self.extra_minion_data, 'ver': '2', 'cmd': '_pillar'} if self.ext: load['ext'] = self.ext ret_pillar = self.channel.crypted_transfer_decode_dictentry(load, dictkey='pillar', ) if not isinstance(ret_pillar, dict): log.error( 'Got a bad pillar from master, type %s, expecting dict: %s', type(ret_pillar).__name__, ret_pillar ) return {} return ret_pillar
module function_definition identifier parameters identifier block expression_statement assignment identifier dictionary pair string string_start string_content string_end attribute identifier identifier pair string string_start string_content string_end attribute identifier identifier pair string string_start string_content string_end subscript attribute identifier identifier string string_start string_content string_end pair string string_start string_content string_end subscript attribute identifier identifier string string_start string_content string_end pair string string_start string_content string_end attribute identifier identifier pair string string_start string_content string_end attribute identifier identifier pair string string_start string_content string_end string string_start string_content string_end pair string string_start string_content string_end string string_start string_content string_end if_statement attribute identifier identifier block expression_statement assignment subscript identifier string string_start string_content string_end attribute identifier identifier expression_statement assignment identifier call attribute attribute identifier identifier identifier argument_list identifier keyword_argument identifier string string_start string_content string_end if_statement not_operator call identifier argument_list identifier identifier block expression_statement call attribute identifier identifier argument_list string string_start string_content string_end attribute call identifier argument_list identifier identifier identifier return_statement dictionary return_statement identifier
Return the pillar data from the master
def load_merge_candidate(self, filename=None, config=None): self.config_replace = False self._load_candidate(filename, config, False)
module function_definition identifier parameters identifier default_parameter identifier none default_parameter identifier none block expression_statement assignment attribute identifier identifier false expression_statement call attribute identifier identifier argument_list identifier identifier false
Open the candidate config and replace.
def updatePassword(self, user, currentPassword, newPassword): return self.__post('/api/updatePassword', data={ 'user': user, 'currentPassword': currentPassword, 'newPassword': newPassword })
module function_definition identifier parameters identifier identifier identifier identifier block return_statement call attribute identifier identifier argument_list string string_start string_content string_end keyword_argument identifier dictionary pair string string_start string_content string_end identifier pair string string_start string_content string_end identifier pair string string_start string_content string_end identifier
Change the password of a user.
def generate_default_schema(output): original_path = os.path.join(os.path.dirname(__file__), 'data', 'randomnames-schema.json') shutil.copyfile(original_path, output)
module function_definition identifier parameters identifier block expression_statement assignment identifier call attribute attribute identifier identifier identifier argument_list call attribute attribute identifier identifier identifier argument_list identifier string string_start string_content string_end string string_start string_content string_end expression_statement call attribute identifier identifier argument_list identifier identifier
Get default schema for fake PII
def delete_job_prefix(self, name, persist=True): for job in list(self.opts['schedule'].keys()): if job.startswith(name): del self.opts['schedule'][job] for job in self._get_schedule(include_opts=False): if job.startswith(name): log.warning("Cannot delete job %s, it's in the pillar!", job) evt = salt.utils.event.get_event('minion', opts=self.opts, listen=False) evt.fire_event({'complete': True, 'schedule': self._get_schedule()}, tag='/salt/minion/minion_schedule_delete_complete') for job in list(self.intervals.keys()): if job.startswith(name): del self.intervals[job] if persist: self.persist()
module function_definition identifier parameters identifier identifier default_parameter identifier true block for_statement identifier call identifier argument_list call attribute subscript attribute identifier identifier string string_start string_content string_end identifier argument_list block if_statement call attribute identifier identifier argument_list identifier block delete_statement subscript subscript attribute identifier identifier string string_start string_content string_end identifier for_statement identifier call attribute identifier identifier argument_list keyword_argument identifier false block if_statement call attribute identifier identifier argument_list identifier block expression_statement call attribute identifier identifier argument_list string string_start string_content string_end identifier expression_statement assignment identifier call attribute attribute attribute identifier identifier identifier identifier argument_list string string_start string_content string_end keyword_argument identifier attribute identifier identifier keyword_argument identifier false expression_statement call attribute identifier identifier argument_list dictionary pair string string_start string_content string_end true pair string string_start string_content string_end call attribute identifier identifier argument_list keyword_argument identifier string string_start string_content string_end for_statement identifier call identifier argument_list call attribute attribute identifier identifier identifier argument_list block if_statement call attribute identifier identifier argument_list identifier block delete_statement subscript attribute identifier identifier identifier if_statement identifier block expression_statement call attribute identifier identifier argument_list
Deletes a job from the scheduler. Ignores jobs from pillar
def release(): if not is_working_tree_clean(): print('Your working tree is not clean. Refusing to create a release.') return print('Rebuilding the AUTHORS file to check for modifications...') authors() if not is_working_tree_clean(): print('Your working tree is not clean after the AUTHORS file was ' 'rebuilt.') print('Please commit the changes before continuing.') return if not is_manifest_up_to_date(): print('Manifest is not up to date.') print('Please update MANIFEST.in or remove spurious files.') return version = 'v{}'.format(local('python setup.py --version', capture=True)) name = local('python setup.py --name', capture=True) tag_message = '{} release version {}.'.format(name, version) print('----------------------') print('Proceeding will tag the release, push the repository upstream,') print('and release a new version on PyPI.') print() print('Version: {}'.format(version)) print('Tag message: {}'.format(tag_message)) print() if not confirm('Continue?', default=True): print('Aborting.') return local('git tag -a {} -m {}'.format(pipes.quote(version), pipes.quote(tag_message))) local('git push --tags origin develop') local('python setup.py sdist bdist_wheel upload')
module function_definition identifier parameters block if_statement not_operator call identifier argument_list block expression_statement call identifier argument_list string string_start string_content string_end return_statement expression_statement call identifier argument_list string string_start string_content string_end expression_statement call identifier argument_list if_statement not_operator call identifier argument_list block expression_statement call identifier argument_list concatenated_string string string_start string_content string_end string string_start string_content string_end expression_statement call identifier argument_list string string_start string_content string_end return_statement if_statement not_operator call identifier argument_list block expression_statement call identifier argument_list string string_start string_content string_end expression_statement call identifier argument_list string string_start string_content string_end return_statement expression_statement assignment identifier call attribute string string_start string_content string_end identifier argument_list call identifier argument_list string string_start string_content string_end keyword_argument identifier true expression_statement assignment identifier call identifier argument_list string string_start string_content string_end keyword_argument identifier true expression_statement assignment identifier call attribute string string_start string_content string_end identifier argument_list identifier identifier expression_statement call identifier argument_list string string_start string_content string_end expression_statement call identifier argument_list string string_start string_content string_end expression_statement call identifier argument_list string string_start string_content string_end expression_statement call identifier argument_list expression_statement call identifier argument_list call attribute string string_start string_content string_end identifier argument_list identifier expression_statement call identifier argument_list call attribute string string_start string_content string_end identifier argument_list identifier expression_statement call identifier argument_list if_statement not_operator call identifier argument_list string string_start string_content string_end keyword_argument identifier true block expression_statement call identifier argument_list string string_start string_content string_end return_statement expression_statement call identifier argument_list call attribute string string_start string_content string_end identifier argument_list call attribute identifier identifier argument_list identifier call attribute identifier identifier argument_list identifier expression_statement call identifier argument_list string string_start string_content string_end expression_statement call identifier argument_list string string_start string_content string_end
Create a new release and upload it to PyPI.
def __get_job_status(self): job = self.__get_job() if "succeeded" in job.obj["status"] and job.obj["status"]["succeeded"] > 0: job.scale(replicas=0) if self.print_pod_logs_on_exit: self.__print_pod_logs() if self.delete_on_success: self.__delete_job_cascade(job) return "SUCCEEDED" if "failed" in job.obj["status"]: failed_cnt = job.obj["status"]["failed"] self.__logger.debug("Kubernetes job " + self.uu_name + " status.failed: " + str(failed_cnt)) if self.print_pod_logs_on_exit: self.__print_pod_logs() if failed_cnt > self.max_retrials: job.scale(replicas=0) return "FAILED" return "RUNNING"
module function_definition identifier parameters identifier block expression_statement assignment identifier call attribute identifier identifier argument_list if_statement boolean_operator comparison_operator string string_start string_content string_end subscript attribute identifier identifier string string_start string_content string_end comparison_operator subscript subscript attribute identifier identifier string string_start string_content string_end string string_start string_content string_end integer block expression_statement call attribute identifier identifier argument_list keyword_argument identifier integer if_statement attribute identifier identifier block expression_statement call attribute identifier identifier argument_list if_statement attribute identifier identifier block expression_statement call attribute identifier identifier argument_list identifier return_statement string string_start string_content string_end if_statement comparison_operator string string_start string_content string_end subscript attribute identifier identifier string string_start string_content string_end block expression_statement assignment identifier subscript subscript attribute identifier identifier string string_start string_content string_end string string_start string_content string_end expression_statement call attribute attribute identifier identifier identifier argument_list binary_operator binary_operator binary_operator string string_start string_content string_end attribute identifier identifier string string_start string_content string_end call identifier argument_list identifier if_statement attribute identifier identifier block expression_statement call attribute identifier identifier argument_list if_statement comparison_operator identifier attribute identifier identifier block expression_statement call attribute identifier identifier argument_list keyword_argument identifier integer return_statement string string_start string_content string_end return_statement string string_start string_content string_end
Return the Kubernetes job status
def add(self, element): key = self._transform(element) if key not in self._elements: self._elements[key] = element
module function_definition identifier parameters identifier identifier block expression_statement assignment identifier call attribute identifier identifier argument_list identifier if_statement comparison_operator identifier attribute identifier identifier block expression_statement assignment subscript attribute identifier identifier identifier identifier
Add an element to this set.
def retry_unpaid_invoices(self): self._sync_invoices() for invoice in self.invoices.filter(paid=False, closed=False): try: invoice.retry() except InvalidRequestError as exc: if str(exc) != "Invoice is already paid": raise
module function_definition identifier parameters identifier block expression_statement call attribute identifier identifier argument_list for_statement identifier call attribute attribute identifier identifier identifier argument_list keyword_argument identifier false keyword_argument identifier false block try_statement block expression_statement call attribute identifier identifier argument_list except_clause as_pattern identifier as_pattern_target identifier block if_statement comparison_operator call identifier argument_list identifier string string_start string_content string_end block raise_statement
Attempt to retry collecting payment on the customer's unpaid invoices.
def handle(self, msg): debug_msg = ': {!r}'.format(msg) if self.debug else '' log.debug('request: %d bytes%s', len(msg), debug_msg) buf = io.BytesIO(msg) code, = util.recv(buf, '>B') if code not in self.methods: log.warning('Unsupported command: %s (%d)', msg_name(code), code) return failure() method = self.methods[code] log.debug('calling %s()', method.__name__) reply = method(buf=buf) debug_reply = ': {!r}'.format(reply) if self.debug else '' log.debug('reply: %d bytes%s', len(reply), debug_reply) return reply
module function_definition identifier parameters identifier identifier block expression_statement assignment identifier conditional_expression call attribute string string_start string_content string_end identifier argument_list identifier attribute identifier identifier string string_start string_end expression_statement call attribute identifier identifier argument_list string string_start string_content string_end call identifier argument_list identifier identifier expression_statement assignment identifier call attribute identifier identifier argument_list identifier expression_statement assignment pattern_list identifier call attribute identifier identifier argument_list identifier string string_start string_content string_end if_statement comparison_operator identifier attribute identifier identifier block expression_statement call attribute identifier identifier argument_list string string_start string_content string_end call identifier argument_list identifier identifier return_statement call identifier argument_list expression_statement assignment identifier subscript attribute identifier identifier identifier expression_statement call attribute identifier identifier argument_list string string_start string_content string_end attribute identifier identifier expression_statement assignment identifier call identifier argument_list keyword_argument identifier identifier expression_statement assignment identifier conditional_expression call attribute string string_start string_content string_end identifier argument_list identifier attribute identifier identifier string string_start string_end expression_statement call attribute identifier identifier argument_list string string_start string_content string_end call identifier argument_list identifier identifier return_statement identifier
Handle SSH message from the SSH client and return the response.
def _allowAnotherAt(cls, parent): site = parent.get_site() if site is None: return False return not cls.peers().descendant_of(site.root_page).exists()
module function_definition identifier parameters identifier identifier block expression_statement assignment identifier call attribute identifier identifier argument_list if_statement comparison_operator identifier none block return_statement false return_statement not_operator call attribute call attribute call attribute identifier identifier argument_list identifier argument_list attribute identifier identifier identifier argument_list
You can only create one of these pages per site.
def generate_changelog(context): changelog_content = [ '\n % ( context.new_version, context.repo_url, context.current_version, context.new_version, ) ] git_log_content = None git_log = 'log --oneline --no-merges --no-color'.split(' ') try: git_log_tag = git_log + ['%s..master' % context.current_version] git_log_content = git(git_log_tag) log.debug('content: %s' % git_log_content) except Exception: log.warn('Error diffing previous version, initial release') git_log_content = git(git_log) git_log_content = replace_sha_with_commit_link(context.repo_url, git_log_content) if git_log_content: [ changelog_content.append('* %s\n' % line) if line else line for line in git_log_content[:-1] ] write_new_changelog( context.repo_url, 'CHANGELOG.md', changelog_content, dry_run=context.dry_run ) log.info('Added content to CHANGELOG.md') context.changelog_content = changelog_content
module function_definition identifier parameters identifier block expression_statement assignment identifier list binary_operator string string_start string_content escape_sequence string_end tuple attribute identifier identifier attribute identifier identifier attribute identifier identifier attribute identifier identifier expression_statement assignment identifier none expression_statement assignment identifier call attribute string string_start string_content string_end identifier argument_list string string_start string_content string_end try_statement block expression_statement assignment identifier binary_operator identifier list binary_operator string string_start string_content string_end attribute identifier identifier expression_statement assignment identifier call identifier argument_list identifier expression_statement call attribute identifier identifier argument_list binary_operator string string_start string_content string_end identifier except_clause identifier block expression_statement call attribute identifier identifier argument_list string string_start string_content string_end expression_statement assignment identifier call identifier argument_list identifier expression_statement assignment identifier call identifier argument_list attribute identifier identifier identifier if_statement identifier block expression_statement list_comprehension conditional_expression call attribute identifier identifier argument_list binary_operator string string_start string_content escape_sequence string_end identifier identifier identifier for_in_clause identifier subscript identifier slice unary_operator integer expression_statement call identifier argument_list attribute identifier identifier string string_start string_content string_end identifier keyword_argument identifier attribute identifier identifier expression_statement call attribute identifier identifier argument_list string string_start string_content string_end expression_statement assignment attribute identifier identifier identifier
Generates an automatic changelog from your commit messages.
def run_coroutine_threadsafe(self, coro, loop=None, callback=None): if not asyncio.iscoroutine(coro): raise TypeError("A await in coroutines. object is required") loop = loop or self.loop future = NewFuture(callback=callback) def callback_func(): try: asyncio.futures._chain_future(NewTask(coro, loop=loop), future) except Exception as exc: if future.set_running_or_notify_cancel(): future.set_exception(exc) raise loop.call_soon_threadsafe(callback_func) return future
module function_definition identifier parameters identifier identifier default_parameter identifier none default_parameter identifier none block if_statement not_operator call attribute identifier identifier argument_list identifier block raise_statement call identifier argument_list string string_start string_content string_end expression_statement assignment identifier boolean_operator identifier attribute identifier identifier expression_statement assignment identifier call identifier argument_list keyword_argument identifier identifier function_definition identifier parameters block try_statement block expression_statement call attribute attribute identifier identifier identifier argument_list call identifier argument_list identifier keyword_argument identifier identifier identifier except_clause as_pattern identifier as_pattern_target identifier block if_statement call attribute identifier identifier argument_list block expression_statement call attribute identifier identifier argument_list identifier raise_statement expression_statement call attribute identifier identifier argument_list identifier return_statement identifier
Be used when loop running in a single non-main thread.
def load(self): glTexImage3D(GL_TEXTURE_3D, 0, GL_LUMINANCE16_ALPHA16, self.width, self.width, self.width, 0, GL_LUMINANCE_ALPHA, GL_UNSIGNED_SHORT, ctypes.byref(self.data))
module function_definition identifier parameters identifier block expression_statement call identifier argument_list identifier integer identifier attribute identifier identifier attribute identifier identifier attribute identifier identifier integer identifier identifier call attribute identifier identifier argument_list attribute identifier identifier
Load the noise texture data into the current texture unit
def setStation(self, number): if number < 0: number = len(self.stations) - 1 elif number >= len(self.stations): number = 0 self.selection = number maxDisplayedItems = self.bodyMaxY - 2 if self.selection - self.startPos >= maxDisplayedItems: self.startPos = self.selection - maxDisplayedItems + 1 elif self.selection < self.startPos: self.startPos = self.selection
module function_definition identifier parameters identifier identifier block if_statement comparison_operator identifier integer block expression_statement assignment identifier binary_operator call identifier argument_list attribute identifier identifier integer elif_clause comparison_operator identifier call identifier argument_list attribute identifier identifier block expression_statement assignment identifier integer expression_statement assignment attribute identifier identifier identifier expression_statement assignment identifier binary_operator attribute identifier identifier integer if_statement comparison_operator binary_operator attribute identifier identifier attribute identifier identifier identifier block expression_statement assignment attribute identifier identifier binary_operator binary_operator attribute identifier identifier identifier integer elif_clause comparison_operator attribute identifier identifier attribute identifier identifier block expression_statement assignment attribute identifier identifier attribute identifier identifier
Select the given station number
def url_ok(match_tuple: MatchTuple) -> bool: try: result = requests.get(match_tuple.link, timeout=5) return result.ok except (requests.ConnectionError, requests.Timeout): return False
module function_definition identifier parameters typed_parameter identifier type identifier type identifier block try_statement block expression_statement assignment identifier call attribute identifier identifier argument_list attribute identifier identifier keyword_argument identifier integer return_statement attribute identifier identifier except_clause tuple attribute identifier identifier attribute identifier identifier block return_statement false
Check if a URL is reachable.
def _get_fname_nio(store): try: f = store.ds.file except AttributeError: return None try: return f.path except AttributeError: return None
module function_definition identifier parameters identifier block try_statement block expression_statement assignment identifier attribute attribute identifier identifier identifier except_clause identifier block return_statement none try_statement block return_statement attribute identifier identifier except_clause identifier block return_statement none
Try to get the file name from the NioDataStore store
def _get(self, name, interval, config, timestamp, **kws): i_bucket, r_bucket, i_key, r_key = self._calc_keys(config, name, timestamp) fetch = kws.get('fetch') or self._type_get process_row = kws.get('process_row') or self._process_row rval = OrderedDict() if config['coarse']: data = process_row( fetch(self._client, i_key) ) rval[ config['i_calc'].from_bucket(i_bucket) ] = data else: resolution_buckets = sorted(map(int,self._client.smembers(i_key))) pipe = self._client.pipeline(transaction=False) for bucket in resolution_buckets: r_key = '%s:%s'%(i_key, bucket) fetch(pipe, r_key) res = pipe.execute() for idx,data in enumerate(res): data = process_row(data) rval[ config['r_calc'].from_bucket(resolution_buckets[idx]) ] = data return rval
module function_definition identifier parameters identifier identifier identifier identifier identifier dictionary_splat_pattern identifier block expression_statement assignment pattern_list identifier identifier identifier identifier call attribute identifier identifier argument_list identifier identifier identifier expression_statement assignment identifier boolean_operator call attribute identifier identifier argument_list string string_start string_content string_end attribute identifier identifier expression_statement assignment identifier boolean_operator call attribute identifier identifier argument_list string string_start string_content string_end attribute identifier identifier expression_statement assignment identifier call identifier argument_list if_statement subscript identifier string string_start string_content string_end block expression_statement assignment identifier call identifier argument_list call identifier argument_list attribute identifier identifier identifier expression_statement assignment subscript identifier call attribute subscript identifier string string_start string_content string_end identifier argument_list identifier identifier else_clause block expression_statement assignment identifier call identifier argument_list call identifier argument_list identifier call attribute attribute identifier identifier identifier argument_list identifier expression_statement assignment identifier call attribute attribute identifier identifier identifier argument_list keyword_argument identifier false for_statement identifier identifier block expression_statement assignment identifier binary_operator string string_start string_content string_end tuple identifier identifier expression_statement call identifier argument_list identifier identifier expression_statement assignment identifier call attribute identifier identifier argument_list for_statement pattern_list identifier identifier call identifier argument_list identifier block expression_statement assignment identifier call identifier argument_list identifier expression_statement assignment subscript identifier call attribute subscript identifier string string_start string_content string_end identifier argument_list subscript identifier identifier identifier return_statement identifier
Fetch a single interval from redis.
def _process_pending_variables(self): self._pending_variables, pending = {}, self._pending_variables for name, data in pending.items(): self[name] = data
module function_definition identifier parameters identifier block expression_statement assignment pattern_list attribute identifier identifier identifier expression_list dictionary attribute identifier identifier for_statement pattern_list identifier identifier call attribute identifier identifier argument_list block expression_statement assignment subscript identifier identifier identifier
Try to apply the variables that were set but not known yet.
async def get(self): shepherd = self.request.app.vmshepherd data = {'presets': {}, 'config': shepherd.config} presets = await shepherd.preset_manager.list_presets() runtime = shepherd.runtime_manager for name in presets: preset = shepherd.preset_manager.get_preset(name) data['presets'][name] = { 'preset': preset, 'vms': preset.vms, 'runtime': await runtime.get_preset_data(name), 'vmshepherd_id': shepherd.instance_id, 'now': time.time() } return data
module function_definition identifier parameters identifier block expression_statement assignment identifier attribute attribute attribute identifier identifier identifier identifier expression_statement assignment identifier dictionary pair string string_start string_content string_end dictionary pair string string_start string_content string_end attribute identifier identifier expression_statement assignment identifier await call attribute attribute identifier identifier identifier argument_list expression_statement assignment identifier attribute identifier identifier for_statement identifier identifier block expression_statement assignment identifier call attribute attribute identifier identifier identifier argument_list identifier expression_statement assignment subscript subscript identifier string string_start string_content string_end identifier dictionary pair string string_start string_content string_end identifier pair string string_start string_content string_end attribute identifier identifier pair string string_start string_content string_end await call attribute identifier identifier argument_list identifier pair string string_start string_content string_end attribute identifier identifier pair string string_start string_content string_end call attribute identifier identifier argument_list return_statement identifier
Inject all preset data to Panel and Render a Home Page
def calc_query(self): if self.query_dist is None: self.query_dist = self.exp4p_.next(-1, None, None) else: self.query_dist = self.exp4p_.next( self.calc_reward_fn(), self.queried_hist_[-1], self.dataset.data[self.queried_hist_[-1]][1] ) return
module function_definition identifier parameters identifier block if_statement comparison_operator attribute identifier identifier none block expression_statement assignment attribute identifier identifier call attribute attribute identifier identifier identifier argument_list unary_operator integer none none else_clause block expression_statement assignment attribute identifier identifier call attribute attribute identifier identifier identifier argument_list call attribute identifier identifier argument_list subscript attribute identifier identifier unary_operator integer subscript subscript attribute attribute identifier identifier identifier subscript attribute identifier identifier unary_operator integer integer return_statement
Calculate the sampling query distribution
def visit_Compound(self, node): self.memory.append_scope() for child in node.children: return_value = self.visit(child) if isinstance(child, ReturnStatement): return return_value if isinstance(child, (IfStatement, WhileStatement)): if return_value is not None: return return_value self.memory.pop_scope()
module function_definition identifier parameters identifier identifier block expression_statement call attribute attribute identifier identifier identifier argument_list for_statement identifier attribute identifier identifier block expression_statement assignment identifier call attribute identifier identifier argument_list identifier if_statement call identifier argument_list identifier identifier block return_statement identifier if_statement call identifier argument_list identifier tuple identifier identifier block if_statement comparison_operator identifier none block return_statement identifier expression_statement call attribute attribute identifier identifier identifier argument_list
Visitor for `Compound` AST node.
def buildFITSName(geisname): _indx = geisname.rfind('.') _fitsname = geisname[:_indx] + '_' + geisname[_indx + 1:-1] + 'h.fits' return _fitsname
module function_definition identifier parameters identifier block expression_statement assignment identifier call attribute identifier identifier argument_list string string_start string_content string_end expression_statement assignment identifier binary_operator binary_operator binary_operator subscript identifier slice identifier string string_start string_content string_end subscript identifier slice binary_operator identifier integer unary_operator integer string string_start string_content string_end return_statement identifier
Build a new FITS filename for a GEIS input image.
def check_has_docstring(self, api): if not api.__doc__: msg = 'The Api class "{}" lacks a docstring.' return [msg.format(api.__name__)]
module function_definition identifier parameters identifier identifier block if_statement not_operator attribute identifier identifier block expression_statement assignment identifier string string_start string_content string_end return_statement list call attribute identifier identifier argument_list attribute identifier identifier
An API class must have a docstring.
def get(self, name): if not self.loaded: raise RegistryNotLoaded(self) if not self._registry.get(name): raise NotificationNotRegistered( f"Notification not registered. Got '{name}'." ) return self._registry.get(name)
module function_definition identifier parameters identifier identifier block if_statement not_operator attribute identifier identifier block raise_statement call identifier argument_list identifier if_statement not_operator call attribute attribute identifier identifier identifier argument_list identifier block raise_statement call identifier argument_list string string_start string_content interpolation identifier string_content string_end return_statement call attribute attribute identifier identifier identifier argument_list identifier
Returns a Notification by name.
def all(self): class_list = list(self.get_class_list()) if not class_list: self.cache = [] return [] if self.cache is not None: return self.cache results = [] for cls_path in class_list: module_name, class_name = cls_path.rsplit('.', 1) try: module = __import__(module_name, {}, {}, class_name) cls = getattr(module, class_name) if self.instances: results.append(cls()) else: results.append(cls) except Exception: logger.exception('Unable to import {cls}'.format(cls=cls_path)) continue self.cache = results return results
module function_definition identifier parameters identifier block expression_statement assignment identifier call identifier argument_list call attribute identifier identifier argument_list if_statement not_operator identifier block expression_statement assignment attribute identifier identifier list return_statement list if_statement comparison_operator attribute identifier identifier none block return_statement attribute identifier identifier expression_statement assignment identifier list for_statement identifier identifier block expression_statement assignment pattern_list identifier identifier call attribute identifier identifier argument_list string string_start string_content string_end integer try_statement block expression_statement assignment identifier call identifier argument_list identifier dictionary dictionary identifier expression_statement assignment identifier call identifier argument_list identifier identifier if_statement attribute identifier identifier block expression_statement call attribute identifier identifier argument_list call identifier argument_list else_clause block expression_statement call attribute identifier identifier argument_list identifier except_clause identifier block expression_statement call attribute identifier identifier argument_list call attribute string string_start string_content string_end identifier argument_list keyword_argument identifier identifier continue_statement expression_statement assignment attribute identifier identifier identifier return_statement identifier
Returns a list of cached instances.
def init(cls, site): bash_header = "" for k,v in site.items(): bash_header += "%s=%s" % (k.upper(), v) bash_header += '\n' site['bash_header'] = bash_header if cls.git_template: print "Cloning template files..." repo_local_copy = utils.clone_git_repo(cls.git_template_url) print "Rendering files from templates..." target_path = os.getcwd() settings_dir = '/'.join(site['django_settings'].split('.')[:-1]) site['project_name'] = settings_dir.replace('/', '.') settings_dir_path = target_path if settings_dir: settings_dir_path += '/' + settings_dir utils.render_from_repo(repo_local_copy, target_path, site, settings_dir_path) else: cls._create_configs(site) print cls.setup_instructions run_hooks('init_after')
module function_definition identifier parameters identifier identifier block expression_statement assignment identifier string string_start string_end for_statement pattern_list identifier identifier call attribute identifier identifier argument_list block expression_statement augmented_assignment identifier binary_operator string string_start string_content string_end tuple call attribute identifier identifier argument_list identifier expression_statement augmented_assignment identifier string string_start string_content escape_sequence string_end expression_statement assignment subscript identifier string string_start string_content string_end identifier if_statement attribute identifier identifier block print_statement string string_start string_content string_end expression_statement assignment identifier call attribute identifier identifier argument_list attribute identifier identifier print_statement string string_start string_content string_end expression_statement assignment identifier call attribute identifier identifier argument_list expression_statement assignment identifier call attribute string string_start string_content string_end identifier argument_list subscript call attribute subscript identifier string string_start string_content string_end identifier argument_list string string_start string_content string_end slice unary_operator integer expression_statement assignment subscript identifier string string_start string_content string_end call attribute identifier identifier argument_list string string_start string_content string_end string string_start string_content string_end expression_statement assignment identifier identifier if_statement identifier block expression_statement augmented_assignment identifier binary_operator string string_start string_content string_end identifier expression_statement call attribute identifier identifier argument_list identifier identifier identifier identifier else_clause block expression_statement call attribute identifier identifier argument_list identifier print_statement attribute identifier identifier expression_statement call identifier argument_list string string_start string_content string_end
put site settings in the header of the script
def getArguments(names, local_dict=None, global_dict=None): call_frame = sys._getframe(2) clear_local_dict = False if local_dict is None: local_dict = call_frame.f_locals clear_local_dict = True try: frame_globals = call_frame.f_globals if global_dict is None: global_dict = frame_globals clear_local_dict = clear_local_dict and not frame_globals is local_dict arguments = [] for name in names: try: a = local_dict[name] except KeyError: a = global_dict[name] arguments.append(numpy.asarray(a)) finally: if clear_local_dict: local_dict.clear() return arguments
module function_definition identifier parameters identifier default_parameter identifier none default_parameter identifier none block expression_statement assignment identifier call attribute identifier identifier argument_list integer expression_statement assignment identifier false if_statement comparison_operator identifier none block expression_statement assignment identifier attribute identifier identifier expression_statement assignment identifier true try_statement block expression_statement assignment identifier attribute identifier identifier if_statement comparison_operator identifier none block expression_statement assignment identifier identifier expression_statement assignment identifier boolean_operator identifier not_operator comparison_operator identifier identifier expression_statement assignment identifier list for_statement identifier identifier block try_statement block expression_statement assignment identifier subscript identifier identifier except_clause identifier block expression_statement assignment identifier subscript identifier identifier expression_statement call attribute identifier identifier argument_list call attribute identifier identifier argument_list identifier finally_clause block if_statement identifier block expression_statement call attribute identifier identifier argument_list return_statement identifier
Get the arguments based on the names.
def Title(self): titlefield = self.Schema().getField('title') if titlefield.widget.visible: return safe_unicode(self.title).encode('utf-8') else: return safe_unicode(self.id).encode('utf-8')
module function_definition identifier parameters identifier block expression_statement assignment identifier call attribute call attribute identifier identifier argument_list identifier argument_list string string_start string_content string_end if_statement attribute attribute identifier identifier identifier block return_statement call attribute call identifier argument_list attribute identifier identifier identifier argument_list string string_start string_content string_end else_clause block return_statement call attribute call identifier argument_list attribute identifier identifier identifier argument_list string string_start string_content string_end
Return the Batch ID if title is not defined
def team_scores(self, team_scores, time): headers = ['Date', 'Home Team Name', 'Home Team Goals', 'Away Team Goals', 'Away Team Name'] result = [headers] result.extend([score["utcDate"].split('T')[0], score['homeTeam']['name'], score['score']['fullTime']['homeTeam'], score['score']['fullTime']['awayTeam'], score['awayTeam']['name']] for score in team_scores['matches'] if score['status'] == 'FINISHED') self.generate_output(result)
module function_definition identifier parameters identifier identifier identifier block expression_statement assignment identifier list string string_start string_content string_end string string_start string_content string_end string string_start string_content string_end string string_start string_content string_end string string_start string_content string_end expression_statement assignment identifier list identifier expression_statement call attribute identifier identifier generator_expression list subscript call attribute subscript identifier string string_start string_content string_end identifier argument_list string string_start string_content string_end integer subscript subscript identifier string string_start string_content string_end string string_start string_content string_end subscript subscript subscript identifier string string_start string_content string_end string string_start string_content string_end string string_start string_content string_end subscript subscript subscript identifier string string_start string_content string_end string string_start string_content string_end string string_start string_content string_end subscript subscript identifier string string_start string_content string_end string string_start string_content string_end for_in_clause identifier subscript identifier string string_start string_content string_end if_clause comparison_operator subscript identifier string string_start string_content string_end string string_start string_content string_end expression_statement call attribute identifier identifier argument_list identifier
Store output of team scores to a CSV file
def read_series_matrix(path, encoding): assert isinstance(path, str) accessions = None titles = None celfile_urls = None with misc.smart_open_read(path, mode='rb', try_gzip=True) as fh: reader = csv.reader(fh, dialect='excel-tab', encoding=encoding) for l in reader: if not l: continue if l[0] == '!Sample_geo_accession': accessions = l[1:] elif l[0] == '!Sample_title': titles = l[1:] elif l[0] == '!Sample_supplementary_file' and celfile_urls is None: celfile_urls = l[1:] elif l[0] == '!series_matrix_table_begin': break return accessions, titles, celfile_urls
module function_definition identifier parameters identifier identifier block assert_statement call identifier argument_list identifier identifier expression_statement assignment identifier none expression_statement assignment identifier none expression_statement assignment identifier none with_statement with_clause with_item as_pattern call attribute identifier identifier argument_list identifier keyword_argument identifier string string_start string_content string_end keyword_argument identifier true as_pattern_target identifier block expression_statement assignment identifier call attribute identifier identifier argument_list identifier keyword_argument identifier string string_start string_content string_end keyword_argument identifier identifier for_statement identifier identifier block if_statement not_operator identifier block continue_statement if_statement comparison_operator subscript identifier integer string string_start string_content string_end block expression_statement assignment identifier subscript identifier slice integer elif_clause comparison_operator subscript identifier integer string string_start string_content string_end block expression_statement assignment identifier subscript identifier slice integer elif_clause boolean_operator comparison_operator subscript identifier integer string string_start string_content string_end comparison_operator identifier none block expression_statement assignment identifier subscript identifier slice integer elif_clause comparison_operator subscript identifier integer string string_start string_content string_end block break_statement return_statement expression_list identifier identifier identifier
Read the series matrix.
def _get_fashion_mnist(directory): for filename in [ _MNIST_TRAIN_DATA_FILENAME, _MNIST_TRAIN_LABELS_FILENAME, _MNIST_TEST_DATA_FILENAME, _MNIST_TEST_LABELS_FILENAME ]: generator_utils.maybe_download(directory, _FASHION_MNIST_LOCAL_FILE_PREFIX + filename, _FASHION_MNIST_URL + filename)
module function_definition identifier parameters identifier block for_statement identifier list identifier identifier identifier identifier block expression_statement call attribute identifier identifier argument_list identifier binary_operator identifier identifier binary_operator identifier identifier
Download all FashionMNIST files to directory unless they are there.
def kron(a, b): if hasattr(a, '__kron__'): return a.__kron__(b) if a is None: return b else: raise ValueError( 'Kron is waiting for two TT-vectors or two TT-matrices')
module function_definition identifier parameters identifier identifier block if_statement call identifier argument_list identifier string string_start string_content string_end block return_statement call attribute identifier identifier argument_list identifier if_statement comparison_operator identifier none block return_statement identifier else_clause block raise_statement call identifier argument_list string string_start string_content string_end
Kronecker product of two TT-matrices or two TT-vectors
def find_existing_page(self, titles_hierarchy): titles_filters = {'publishing_is_draft': True} for parent_count, ancestor_title \ in enumerate(titles_hierarchy[::-1]): parent_path = '__'.join(['parent'] * parent_count) filter_name = '%s%stranslations__title' % ( parent_path, parent_path and '__' or '') titles_filters[filter_name] = ancestor_title return self.page_model.objects \ .filter(**titles_filters) \ .first()
module function_definition identifier parameters identifier identifier block expression_statement assignment identifier dictionary pair string string_start string_content string_end true for_statement pattern_list identifier identifier line_continuation call identifier argument_list subscript identifier slice unary_operator integer block expression_statement assignment identifier call attribute string string_start string_content string_end identifier argument_list binary_operator list string string_start string_content string_end identifier expression_statement assignment identifier binary_operator string string_start string_content string_end tuple identifier boolean_operator boolean_operator identifier string string_start string_content string_end string string_start string_end expression_statement assignment subscript identifier identifier identifier return_statement call attribute call attribute attribute attribute identifier identifier identifier line_continuation identifier argument_list dictionary_splat identifier line_continuation identifier argument_list
Find and return existing page matching the given titles hierarchy
def output_file(self, _container): p = local.path(_container) if p.exists(): if not ui.ask("Path '{0}' already exists." " Overwrite?".format(p)): sys.exit(0) CFG["container"]["output"] = str(p)
module function_definition identifier parameters identifier identifier block expression_statement assignment identifier call attribute identifier identifier argument_list identifier if_statement call attribute identifier identifier argument_list block if_statement not_operator call attribute identifier identifier argument_list call attribute concatenated_string string string_start string_content string_end string string_start string_content string_end identifier argument_list identifier block expression_statement call attribute identifier identifier argument_list integer expression_statement assignment subscript subscript identifier string string_start string_content string_end string string_start string_content string_end call identifier argument_list identifier
Find and writes the output path of a chroot container.
def get(self, key, recursive=False, sorted=False, quorum=False, timeout=None): return self.adapter.get(key, recursive=recursive, sorted=sorted, quorum=quorum, timeout=timeout)
module function_definition identifier parameters identifier identifier default_parameter identifier false default_parameter identifier false default_parameter identifier false default_parameter identifier none block return_statement call attribute attribute identifier identifier identifier argument_list identifier keyword_argument identifier identifier keyword_argument identifier identifier keyword_argument identifier identifier keyword_argument identifier identifier
Gets a value of key.
def findrootname(filename): puncloc = [filename.find(char) for char in string.punctuation] if sys.version_info[0] >= 3: val = sys.maxsize else: val = sys.maxint for num in puncloc: if num !=-1 and num < val: val = num return filename[0:val]
module function_definition identifier parameters identifier block expression_statement assignment identifier list_comprehension call attribute identifier identifier argument_list identifier for_in_clause identifier attribute identifier identifier if_statement comparison_operator subscript attribute identifier identifier integer integer block expression_statement assignment identifier attribute identifier identifier else_clause block expression_statement assignment identifier attribute identifier identifier for_statement identifier identifier block if_statement boolean_operator comparison_operator identifier unary_operator integer comparison_operator identifier identifier block expression_statement assignment identifier identifier return_statement subscript identifier slice integer identifier
Return the rootname of the given file.
def finish(self): self.update(self.maxval) if self.signal_set: signal.signal(signal.SIGWINCH, signal.SIG_DFL)
module function_definition identifier parameters identifier block expression_statement call attribute identifier identifier argument_list attribute identifier identifier if_statement attribute identifier identifier block expression_statement call attribute identifier identifier argument_list attribute identifier identifier attribute identifier identifier
Used to tell the progress is finished.
def size(cls, crawler): key = make_key('queue_pending', crawler) return unpack_int(conn.get(key))
module function_definition identifier parameters identifier identifier block expression_statement assignment identifier call identifier argument_list string string_start string_content string_end identifier return_statement call identifier argument_list call attribute identifier identifier argument_list identifier
Total operations pending for this crawler
def setup_endpoints(provider): app_routing = {} endpoints = [ AuthorizationEndpoint( pyoidcMiddleware(provider.authorization_endpoint)), TokenEndpoint( pyoidcMiddleware(provider.token_endpoint)), UserinfoEndpoint( pyoidcMiddleware(provider.userinfo_endpoint)), RegistrationEndpoint( pyoidcMiddleware(provider.registration_endpoint)), EndSessionEndpoint( pyoidcMiddleware(provider.endsession_endpoint)) ] for ep in endpoints: app_routing["/{}".format(ep.etype)] = ep return app_routing
module function_definition identifier parameters identifier block expression_statement assignment identifier dictionary expression_statement assignment identifier list call identifier argument_list call identifier argument_list attribute identifier identifier call identifier argument_list call identifier argument_list attribute identifier identifier call identifier argument_list call identifier argument_list attribute identifier identifier call identifier argument_list call identifier argument_list attribute identifier identifier call identifier argument_list call identifier argument_list attribute identifier identifier for_statement identifier identifier block expression_statement assignment subscript identifier call attribute string string_start string_content string_end identifier argument_list attribute identifier identifier identifier return_statement identifier
Setup the OpenID Connect Provider endpoints.
def isometric_view_interactive(self): interactor = self.iren.GetInteractorStyle() renderer = interactor.GetCurrentRenderer() renderer.view_isometric()
module function_definition identifier parameters identifier block expression_statement assignment identifier call attribute attribute identifier identifier identifier argument_list expression_statement assignment identifier call attribute identifier identifier argument_list expression_statement call attribute identifier identifier argument_list
sets the current interactive render window to isometric view
def _clear_empty_values(args): result = {} for param in args: if args[param] is not None: result[param] = args[param] return result
module function_definition identifier parameters identifier block expression_statement assignment identifier dictionary for_statement identifier identifier block if_statement comparison_operator subscript identifier identifier none block expression_statement assignment subscript identifier identifier subscript identifier identifier return_statement identifier
Scrap junk data from a dict.
def _translate(self, embedding): "Translates an embedding back to linear coordinates if necessary." if embedding is None: return None if not self._linear: return embedding return [_bulk_to_linear(self.M, self.N, self.L, chain) for chain in embedding]
module function_definition identifier parameters identifier identifier block expression_statement string string_start string_content string_end if_statement comparison_operator identifier none block return_statement none if_statement not_operator attribute identifier identifier block return_statement identifier return_statement list_comprehension call identifier argument_list attribute identifier identifier attribute identifier identifier attribute identifier identifier identifier for_in_clause identifier identifier
Translates an embedding back to linear coordinates if necessary.
def printWelcomeMessage(msg, place=10): logging.debug('*' * 30) welcome = ' ' * place welcome+= msg logging.debug(welcome) logging.debug('*' * 30 + '\n')
module function_definition identifier parameters identifier default_parameter identifier integer block expression_statement call attribute identifier identifier argument_list binary_operator string string_start string_content string_end integer expression_statement assignment identifier binary_operator string string_start string_content string_end identifier expression_statement augmented_assignment identifier identifier expression_statement call attribute identifier identifier argument_list identifier expression_statement call attribute identifier identifier argument_list binary_operator binary_operator string string_start string_content string_end integer string string_start string_content escape_sequence string_end
Print any welcome message
def _logstash(url, data): result = salt.utils.http.query( url, 'POST', header_dict=_HEADERS, data=salt.utils.json.dumps(data), decode=True, status=True, opts=__opts__ ) return result
module function_definition identifier parameters identifier identifier block expression_statement assignment identifier call attribute attribute attribute identifier identifier identifier identifier argument_list identifier string string_start string_content string_end keyword_argument identifier identifier keyword_argument identifier call attribute attribute attribute identifier identifier identifier identifier argument_list identifier keyword_argument identifier true keyword_argument identifier true keyword_argument identifier identifier return_statement identifier
Issues HTTP queries to the logstash server.
def varchar(self, field=None): assert field is not None, "The field parameter must be passed to the 'varchar' method." max_length = field.max_length def source(): length = random.choice(range(1, max_length + 1)) return "".join(random.choice(general_chars) for i in xrange(length)) return self.get_allowed_value(source, field)
module function_definition identifier parameters identifier default_parameter identifier none block assert_statement comparison_operator identifier none string string_start string_content string_end expression_statement assignment identifier attribute identifier identifier function_definition identifier parameters block expression_statement assignment identifier call attribute identifier identifier argument_list call identifier argument_list integer binary_operator identifier integer return_statement call attribute string string_start string_end identifier generator_expression call attribute identifier identifier argument_list identifier for_in_clause identifier call identifier argument_list identifier return_statement call attribute identifier identifier argument_list identifier identifier
Returns a chunk of text, of maximum length 'max_length'
def citedby_url(self): cite_link = self.coredata.find('link[@rel="scopus-citedby"]', ns) try: return cite_link.get('href') except AttributeError: return None
module function_definition identifier parameters identifier block expression_statement assignment identifier call attribute attribute identifier identifier identifier argument_list string string_start string_content string_end identifier try_statement block return_statement call attribute identifier identifier argument_list string string_start string_content string_end except_clause identifier block return_statement none
URL to Scopus page listing citing papers.
def _process_rules(self, rules: dict, system: System): self._source = None if not self._shall_proceed(rules): return self.context.update(rules.get('context', {})) self.path = rules.get('path', '') self.source = rules.get('source', None) self._process_rule(rules.get('system', None), {'system': system}) for module in system.modules: self._process_rule(rules.get('module', None), {'module': module}) for interface in module.interfaces: self._process_rule(rules.get('interface', None), {'interface': interface}) for struct in module.structs: self._process_rule(rules.get('struct', None), {'struct': struct}) for enum in module.enums: self._process_rule(rules.get('enum', None), {'enum': enum})
module function_definition identifier parameters identifier typed_parameter identifier type identifier typed_parameter identifier type identifier block expression_statement assignment attribute identifier identifier none if_statement not_operator call attribute identifier identifier argument_list identifier block return_statement expression_statement call attribute attribute identifier identifier identifier argument_list call attribute identifier identifier argument_list string string_start string_content string_end dictionary expression_statement assignment attribute identifier identifier call attribute identifier identifier argument_list string string_start string_content string_end string string_start string_end expression_statement assignment attribute identifier identifier call attribute identifier identifier argument_list string string_start string_content string_end none expression_statement call attribute identifier identifier argument_list call attribute identifier identifier argument_list string string_start string_content string_end none dictionary pair string string_start string_content string_end identifier for_statement identifier attribute identifier identifier block expression_statement call attribute identifier identifier argument_list call attribute identifier identifier argument_list string string_start string_content string_end none dictionary pair string string_start string_content string_end identifier for_statement identifier attribute identifier identifier block expression_statement call attribute identifier identifier argument_list call attribute identifier identifier argument_list string string_start string_content string_end none dictionary pair string string_start string_content string_end identifier for_statement identifier attribute identifier identifier block expression_statement call attribute identifier identifier argument_list call attribute identifier identifier argument_list string string_start string_content string_end none dictionary pair string string_start string_content string_end identifier for_statement identifier attribute identifier identifier block expression_statement call attribute identifier identifier argument_list call attribute identifier identifier argument_list string string_start string_content string_end none dictionary pair string string_start string_content string_end identifier
process a set of rules for a target
def prepare_page(self, *args, **kwargs): super(BaseBackend, self).prepare_page(*args, **kwargs)
module function_definition identifier parameters identifier list_splat_pattern identifier dictionary_splat_pattern identifier block expression_statement call attribute call identifier argument_list identifier identifier identifier argument_list list_splat identifier dictionary_splat identifier
This is called after the page has been loaded, good time to do extra polishing
def __extract_modules(self, loader, name, is_pkg): mod = loader.find_module(name).load_module(name) if hasattr(mod, '__method__'): module_router = ModuleRouter(mod, ignore_names=self.__serialize_module_paths() ).register_route(app=self.application, name=name) self.__routers.extend(module_router.routers) self.__modules.append(mod) else: pass
module function_definition identifier parameters identifier identifier identifier identifier block expression_statement assignment identifier call attribute call attribute identifier identifier argument_list identifier identifier argument_list identifier if_statement call identifier argument_list identifier string string_start string_content string_end block expression_statement assignment identifier call attribute call identifier argument_list identifier keyword_argument identifier call attribute identifier identifier argument_list identifier argument_list keyword_argument identifier attribute identifier identifier keyword_argument identifier identifier expression_statement call attribute attribute identifier identifier identifier argument_list attribute identifier identifier expression_statement call attribute attribute identifier identifier identifier argument_list identifier else_clause block pass_statement
if module found load module and save all attributes in the module found
def run_version(args: dict) -> int: version = environ.package_settings.get('version', 'unknown') print('VERSION: {}'.format(version)) return 0
module function_definition identifier parameters typed_parameter identifier type identifier type identifier block expression_statement assignment identifier call attribute attribute identifier identifier identifier argument_list string string_start string_content string_end string string_start string_content string_end expression_statement call identifier argument_list call attribute string string_start string_content string_end identifier argument_list identifier return_statement integer
Displays the current version
def handle_unlock( mediator_state: MediatorTransferState, state_change: ReceiveUnlock, channelidentifiers_to_channels: ChannelMap, ) -> TransitionResult[MediatorTransferState]: events = list() balance_proof_sender = state_change.balance_proof.sender channel_identifier = state_change.balance_proof.channel_identifier for pair in mediator_state.transfers_pair: if pair.payer_transfer.balance_proof.sender == balance_proof_sender: channel_state = channelidentifiers_to_channels.get(channel_identifier) if channel_state: is_valid, channel_events, _ = channel.handle_unlock( channel_state, state_change, ) events.extend(channel_events) if is_valid: unlock = EventUnlockClaimSuccess( pair.payee_transfer.payment_identifier, pair.payee_transfer.lock.secrethash, ) events.append(unlock) send_processed = SendProcessed( recipient=balance_proof_sender, channel_identifier=CHANNEL_IDENTIFIER_GLOBAL_QUEUE, message_identifier=state_change.message_identifier, ) events.append(send_processed) pair.payer_state = 'payer_balance_proof' iteration = TransitionResult(mediator_state, events) return iteration
module function_definition identifier parameters typed_parameter identifier type identifier typed_parameter identifier type identifier typed_parameter identifier type identifier type generic_type identifier type_parameter type identifier block expression_statement assignment identifier call identifier argument_list expression_statement assignment identifier attribute attribute identifier identifier identifier expression_statement assignment identifier attribute attribute identifier identifier identifier for_statement identifier attribute identifier identifier block if_statement comparison_operator attribute attribute attribute identifier identifier identifier identifier identifier block expression_statement assignment identifier call attribute identifier identifier argument_list identifier if_statement identifier block expression_statement assignment pattern_list identifier identifier identifier call attribute identifier identifier argument_list identifier identifier expression_statement call attribute identifier identifier argument_list identifier if_statement identifier block expression_statement assignment identifier call identifier argument_list attribute attribute identifier identifier identifier attribute attribute attribute identifier identifier identifier identifier expression_statement call attribute identifier identifier argument_list identifier expression_statement assignment identifier call identifier argument_list keyword_argument identifier identifier keyword_argument identifier identifier keyword_argument identifier attribute identifier identifier expression_statement call attribute identifier identifier argument_list identifier expression_statement assignment attribute identifier identifier string string_start string_content string_end expression_statement assignment identifier call identifier argument_list identifier identifier return_statement identifier
Handle a ReceiveUnlock state change.
def check_by_selector(self, selector): elem = find_element_by_jquery(world.browser, selector) if not elem.is_selected(): elem.click()
module function_definition identifier parameters identifier identifier block expression_statement assignment identifier call identifier argument_list attribute identifier identifier identifier if_statement not_operator call attribute identifier identifier argument_list block expression_statement call attribute identifier identifier argument_list
Check the checkbox matching the CSS selector.
def toggle_show_source(self, checked): if checked: self.switch_to_plain_text() self.docstring = not checked self.force_refresh() self.set_option('rich_mode', not checked)
module function_definition identifier parameters identifier identifier block if_statement identifier block expression_statement call attribute identifier identifier argument_list expression_statement assignment attribute identifier identifier not_operator identifier expression_statement call attribute identifier identifier argument_list expression_statement call attribute identifier identifier argument_list string string_start string_content string_end not_operator identifier
Toggle show source code
def iscm_md_append_array(self, arraypath, member): array_path = string.split(arraypath, ".") array_key = array_path.pop() current = self.metadata for k in array_path: if not current.has_key(k): current[k] = {} current = current[k] if not current.has_key(array_key): current[array_key] = [] if not type(current[array_key]) == list: raise KeyError("%s doesn't point to an array" % arraypath) current[array_key].append(member)
module function_definition identifier parameters identifier identifier identifier block expression_statement assignment identifier call attribute identifier identifier argument_list identifier string string_start string_content string_end expression_statement assignment identifier call attribute identifier identifier argument_list expression_statement assignment identifier attribute identifier identifier for_statement identifier identifier block if_statement not_operator call attribute identifier identifier argument_list identifier block expression_statement assignment subscript identifier identifier dictionary expression_statement assignment identifier subscript identifier identifier if_statement not_operator call attribute identifier identifier argument_list identifier block expression_statement assignment subscript identifier identifier list if_statement not_operator comparison_operator call identifier argument_list subscript identifier identifier identifier block raise_statement call identifier argument_list binary_operator string string_start string_content string_end identifier expression_statement call attribute subscript identifier identifier identifier argument_list identifier
Append a member to a metadata array entry
def deliver_dashboard(schedule): dashboard = schedule.dashboard dashboard_url = _get_url_path( 'Superset.dashboard', dashboard_id=dashboard.id, ) driver = create_webdriver() window = config.get('WEBDRIVER_WINDOW')['dashboard'] driver.set_window_size(*window) driver.get(dashboard_url) time.sleep(PAGE_RENDER_WAIT) get_element = getattr(driver, 'find_element_by_class_name') element = retry_call( get_element, fargs=['grid-container'], tries=2, delay=PAGE_RENDER_WAIT, ) try: screenshot = element.screenshot_as_png except WebDriverException: screenshot = driver.screenshot() finally: destroy_webdriver(driver) email = _generate_mail_content( schedule, screenshot, dashboard.dashboard_title, dashboard_url, ) subject = __( '%(prefix)s %(title)s', prefix=config.get('EMAIL_REPORTS_SUBJECT_PREFIX'), title=dashboard.dashboard_title, ) _deliver_email(schedule, subject, email)
module function_definition identifier parameters identifier block expression_statement assignment identifier attribute identifier identifier expression_statement assignment identifier call identifier argument_list string string_start string_content string_end keyword_argument identifier attribute identifier identifier expression_statement assignment identifier call identifier argument_list expression_statement assignment identifier subscript call attribute identifier identifier argument_list string string_start string_content string_end string string_start string_content string_end expression_statement call attribute identifier identifier argument_list list_splat identifier expression_statement call attribute identifier identifier argument_list identifier expression_statement call attribute identifier identifier argument_list identifier expression_statement assignment identifier call identifier argument_list identifier string string_start string_content string_end expression_statement assignment identifier call identifier argument_list identifier keyword_argument identifier list string string_start string_content string_end keyword_argument identifier integer keyword_argument identifier identifier try_statement block expression_statement assignment identifier attribute identifier identifier except_clause identifier block expression_statement assignment identifier call attribute identifier identifier argument_list finally_clause block expression_statement call identifier argument_list identifier expression_statement assignment identifier call identifier argument_list identifier identifier attribute identifier identifier identifier expression_statement assignment identifier call identifier argument_list string string_start string_content string_end keyword_argument identifier call attribute identifier identifier argument_list string string_start string_content string_end keyword_argument identifier attribute identifier identifier expression_statement call identifier argument_list identifier identifier identifier
Given a schedule, delivery the dashboard as an email report
def _get_connection_info(): info = 'Connection: %s,' % CONN.url if CONN.creds is not None: info += ' userid=%s,' % CONN.creds[0] else: info += ' no creds,' info += ' cacerts=%s,' % ('sys-default' if CONN.ca_certs is None else CONN.ca_certs) info += ' verifycert=%s,' % ('off' if CONN.no_verification else 'on') info += ' default-namespace=%s' % CONN.default_namespace if CONN.x509 is not None: info += ', client-cert=%s' % CONN.x509['cert_file'] try: kf = CONN.x509['key_file'] except KeyError: kf = "none" info += ":%s" % kf if CONN.timeout is not None: info += ', timeout=%s' % CONN.timeout info += ' stats=%s, ' % ('on' if CONN._statistics else 'off') info += 'log=%s' % ('on' if CONN._operation_recorders else 'off') if isinstance(CONN, FakedWBEMConnection): info += ', mock-server' return fill(info, 78, subsequent_indent=' ')
module function_definition identifier parameters block expression_statement assignment identifier binary_operator string string_start string_content string_end attribute identifier identifier if_statement comparison_operator attribute identifier identifier none block expression_statement augmented_assignment identifier binary_operator string string_start string_content string_end subscript attribute identifier identifier integer else_clause block expression_statement augmented_assignment identifier string string_start string_content string_end expression_statement augmented_assignment identifier binary_operator string string_start string_content string_end parenthesized_expression conditional_expression string string_start string_content string_end comparison_operator attribute identifier identifier none attribute identifier identifier expression_statement augmented_assignment identifier binary_operator string string_start string_content string_end parenthesized_expression conditional_expression string string_start string_content string_end attribute identifier identifier string string_start string_content string_end expression_statement augmented_assignment identifier binary_operator string string_start string_content string_end attribute identifier identifier if_statement comparison_operator attribute identifier identifier none block expression_statement augmented_assignment identifier binary_operator string string_start string_content string_end subscript attribute identifier identifier string string_start string_content string_end try_statement block expression_statement assignment identifier subscript attribute identifier identifier string string_start string_content string_end except_clause identifier block expression_statement assignment identifier string string_start string_content string_end expression_statement augmented_assignment identifier binary_operator string string_start string_content string_end identifier if_statement comparison_operator attribute identifier identifier none block expression_statement augmented_assignment identifier binary_operator string string_start string_content string_end attribute identifier identifier expression_statement augmented_assignment identifier binary_operator string string_start string_content string_end parenthesized_expression conditional_expression string string_start string_content string_end attribute identifier identifier string string_start string_content string_end expression_statement augmented_assignment identifier binary_operator string string_start string_content string_end parenthesized_expression conditional_expression string string_start string_content string_end attribute identifier identifier string string_start string_content string_end if_statement call identifier argument_list identifier identifier block expression_statement augmented_assignment identifier string string_start string_content string_end return_statement call identifier argument_list identifier integer keyword_argument identifier string string_start string_content string_end
Return a string with the connection info.
def _resize(self): lines = self.text.split('\n') xsize, ysize = 0, 0 for line in lines: size = self.textctrl.GetTextExtent(line) xsize = max(xsize, size[0]) ysize = ysize + size[1] xsize = int(xsize*1.2) self.textctrl.SetSize((xsize, ysize)) self.textctrl.SetMinSize((xsize, ysize))
module function_definition identifier parameters identifier block expression_statement assignment identifier call attribute attribute identifier identifier identifier argument_list string string_start string_content escape_sequence string_end expression_statement assignment pattern_list identifier identifier expression_list integer integer for_statement identifier identifier block expression_statement assignment identifier call attribute attribute identifier identifier identifier argument_list identifier expression_statement assignment identifier call identifier argument_list identifier subscript identifier integer expression_statement assignment identifier binary_operator identifier subscript identifier integer expression_statement assignment identifier call identifier argument_list binary_operator identifier float expression_statement call attribute attribute identifier identifier identifier argument_list tuple identifier identifier expression_statement call attribute attribute identifier identifier identifier argument_list tuple identifier identifier
calculate and set text size, handling multi-line
def loop_pengembalian_akhiran(self): self.restore_prefix() removals = self.removals reversed_removals = reversed(removals) current_word = self.current_word for removal in reversed_removals: if not self.is_suffix_removal(removal): continue if removal.get_removed_part() == 'kan': self.current_word = removal.result + 'k' self.remove_prefixes() if self.dictionary.contains(self.current_word): return self.current_word = removal.result + 'kan' else: self.current_word = removal.get_subject() self.remove_prefixes() if self.dictionary.contains(self.current_word): return self.removals = removals self.current_word = current_word
module function_definition identifier parameters identifier block expression_statement call attribute identifier identifier argument_list expression_statement assignment identifier attribute identifier identifier expression_statement assignment identifier call identifier argument_list identifier expression_statement assignment identifier attribute identifier identifier for_statement identifier identifier block if_statement not_operator call attribute identifier identifier argument_list identifier block continue_statement if_statement comparison_operator call attribute identifier identifier argument_list string string_start string_content string_end block expression_statement assignment attribute identifier identifier binary_operator attribute identifier identifier string string_start string_content string_end expression_statement call attribute identifier identifier argument_list if_statement call attribute attribute identifier identifier identifier argument_list attribute identifier identifier block return_statement expression_statement assignment attribute identifier identifier binary_operator attribute identifier identifier string string_start string_content string_end else_clause block expression_statement assignment attribute identifier identifier call attribute identifier identifier argument_list expression_statement call attribute identifier identifier argument_list if_statement call attribute attribute identifier identifier identifier argument_list attribute identifier identifier block return_statement expression_statement assignment attribute identifier identifier identifier expression_statement assignment attribute identifier identifier identifier
ECS Loop Pengembalian Akhiran
def reduce_max(attrs, inputs, proto_obj): new_attrs = translation_utils._fix_attribute_names(attrs, {'axes':'axis'}) return 'max', new_attrs, inputs
module function_definition identifier parameters identifier identifier identifier block expression_statement assignment identifier call attribute identifier identifier argument_list identifier dictionary pair string string_start string_content string_end string string_start string_content string_end return_statement expression_list string string_start string_content string_end identifier identifier
Reduce the array along a given axis by maximum value
def relation_call(method, relation_name=None, flag=None, state=None, *args): if relation_name: relation = relation_from_name(relation_name) if relation is None: raise ValueError('Relation not found: %s' % relation_name) elif flag or state: relation = relation_from_flag(flag or state) if relation is None: raise ValueError('Relation not found: %s' % (flag or state)) else: raise ValueError('Must specify either relation_name or flag') result = getattr(relation, method)(*args) if isinstance(relation, RelationBase) and method == 'conversations': result = [c.scope for c in result] return result
module function_definition identifier parameters identifier default_parameter identifier none default_parameter identifier none default_parameter identifier none list_splat_pattern identifier block if_statement identifier block expression_statement assignment identifier call identifier argument_list identifier if_statement comparison_operator identifier none block raise_statement call identifier argument_list binary_operator string string_start string_content string_end identifier elif_clause boolean_operator identifier identifier block expression_statement assignment identifier call identifier argument_list boolean_operator identifier identifier if_statement comparison_operator identifier none block raise_statement call identifier argument_list binary_operator string string_start string_content string_end parenthesized_expression boolean_operator identifier identifier else_clause block raise_statement call identifier argument_list string string_start string_content string_end expression_statement assignment identifier call call identifier argument_list identifier identifier argument_list list_splat identifier if_statement boolean_operator call identifier argument_list identifier identifier comparison_operator identifier string string_start string_content string_end block expression_statement assignment identifier list_comprehension attribute identifier identifier for_in_clause identifier identifier return_statement identifier
Invoke a method on the class implementing a relation via the CLI
def catalogFactory(name, **kwargs): fn = lambda member: inspect.isclass(member) and member.__module__==__name__ catalogs = odict(inspect.getmembers(sys.modules[__name__], fn)) if name not in list(catalogs.keys()): msg = "%s not found in catalogs:\n %s"%(name,list(kernels.keys())) logger.error(msg) msg = "Unrecognized catalog: %s"%name raise Exception(msg) return catalogs[name](**kwargs)
module function_definition identifier parameters identifier dictionary_splat_pattern identifier block expression_statement assignment identifier lambda lambda_parameters identifier boolean_operator call attribute identifier identifier argument_list identifier comparison_operator attribute identifier identifier identifier expression_statement assignment identifier call identifier argument_list call attribute identifier identifier argument_list subscript attribute identifier identifier identifier identifier if_statement comparison_operator identifier call identifier argument_list call attribute identifier identifier argument_list block expression_statement assignment identifier binary_operator string string_start string_content escape_sequence string_end tuple identifier call identifier argument_list call attribute identifier identifier argument_list expression_statement call attribute identifier identifier argument_list identifier expression_statement assignment identifier binary_operator string string_start string_content string_end identifier raise_statement call identifier argument_list identifier return_statement call subscript identifier identifier argument_list dictionary_splat identifier
Factory for various catalogs.
def parse_data_line(self, line): it = self._generate(line) reader = csv.DictReader(it, fieldnames=self.headers) values = reader.next() values['DefaultResult'] = 'ResidualError' values['LineName'] = re.sub(r'\W', '', values['LineName'].strip()) values['Concentration'] = values['Cc'].strip() values['StandardDeviation'] = values['SD'].strip() values['ResidualError'] = values['RSD'].strip() values['NetIntensity'] = values['Net_Intensity'].strip().split('/') values['Remarks'] = '' values['TestLine'] = '' self._addRawResult(self._resid, {values['LineName']: values}, False) return 0
module function_definition identifier parameters identifier identifier block expression_statement assignment identifier call attribute identifier identifier argument_list identifier expression_statement assignment identifier call attribute identifier identifier argument_list identifier keyword_argument identifier attribute identifier identifier expression_statement assignment identifier call attribute identifier identifier argument_list expression_statement assignment subscript identifier string string_start string_content string_end string string_start string_content string_end expression_statement assignment subscript identifier string string_start string_content string_end call attribute identifier identifier argument_list string string_start string_content string_end string string_start string_end call attribute subscript identifier string string_start string_content string_end identifier argument_list expression_statement assignment subscript identifier string string_start string_content string_end call attribute subscript identifier string string_start string_content string_end identifier argument_list expression_statement assignment subscript identifier string string_start string_content string_end call attribute subscript identifier string string_start string_content string_end identifier argument_list expression_statement assignment subscript identifier string string_start string_content string_end call attribute subscript identifier string string_start string_content string_end identifier argument_list expression_statement assignment subscript identifier string string_start string_content string_end call attribute call attribute subscript identifier string string_start string_content string_end identifier argument_list identifier argument_list string string_start string_content string_end expression_statement assignment subscript identifier string string_start string_content string_end string string_start string_end expression_statement assignment subscript identifier string string_start string_content string_end string string_start string_end expression_statement call attribute identifier identifier argument_list attribute identifier identifier dictionary pair subscript identifier string string_start string_content string_end identifier false return_statement integer
Parses the data line into a dictionary for the importer
def commit_events(self): for event in sorted(self._event_buf): self.store.record_event(event) self._snapshot.process_event(event) self._event_buf = []
module function_definition identifier parameters identifier block for_statement identifier call identifier argument_list attribute identifier identifier block expression_statement call attribute attribute identifier identifier identifier argument_list identifier expression_statement call attribute attribute identifier identifier identifier argument_list identifier expression_statement assignment attribute identifier identifier list
Applies all outstanding `Event`s to the internal state
def execute(tokens): if not validate_rc(): print('Your .vacationrc file has errors!') echo_vacation_rc() return for action, value in tokens: if action == 'show': show() elif action == 'log': log_vacation_days() elif action == 'echo': echo_vacation_rc() elif action == 'take': take(value) elif action == 'cancel': cancel(value) elif action == 'setrate': setrate(value) elif action == 'setdays': setdays(value)
module function_definition identifier parameters identifier block if_statement not_operator call identifier argument_list block expression_statement call identifier argument_list string string_start string_content string_end expression_statement call identifier argument_list return_statement for_statement pattern_list identifier identifier identifier block if_statement comparison_operator identifier string string_start string_content string_end block expression_statement call identifier argument_list elif_clause comparison_operator identifier string string_start string_content string_end block expression_statement call identifier argument_list elif_clause comparison_operator identifier string string_start string_content string_end block expression_statement call identifier argument_list elif_clause comparison_operator identifier string string_start string_content string_end block expression_statement call identifier argument_list identifier elif_clause comparison_operator identifier string string_start string_content string_end block expression_statement call identifier argument_list identifier elif_clause comparison_operator identifier string string_start string_content string_end block expression_statement call identifier argument_list identifier elif_clause comparison_operator identifier string string_start string_content string_end block expression_statement call identifier argument_list identifier
Perform the actions described by the input tokens.
async def create_tunnel_connection(self, req): tunnel_address = req.tunnel_address connection = await self.create_connection(tunnel_address) response = connection.current_consumer() for event in response.events().values(): event.clear() response.start(HttpTunnel(self, req)) await response.event('post_request').waiter() if response.status_code != 200: raise ConnectionRefusedError( 'Cannot connect to tunnel: status code %s' % response.status_code ) raw_sock = connection.transport.get_extra_info('socket') if raw_sock is None: raise RuntimeError('Transport without socket') raw_sock = raw_sock.dup() connection.transport.close() await connection.event('connection_lost').waiter() self.sessions -= 1 self.requests_processed -= 1 connection = await self.create_connection( sock=raw_sock, ssl=req.ssl(self), server_hostname=req.netloc ) return connection
module function_definition identifier parameters identifier identifier block expression_statement assignment identifier attribute identifier identifier expression_statement assignment identifier await call attribute identifier identifier argument_list identifier expression_statement assignment identifier call attribute identifier identifier argument_list for_statement identifier call attribute call attribute identifier identifier argument_list identifier argument_list block expression_statement call attribute identifier identifier argument_list expression_statement call attribute identifier identifier argument_list call identifier argument_list identifier identifier expression_statement await call attribute call attribute identifier identifier argument_list string string_start string_content string_end identifier argument_list if_statement comparison_operator attribute identifier identifier integer block raise_statement call identifier argument_list binary_operator string string_start string_content string_end attribute identifier identifier expression_statement assignment identifier call attribute attribute identifier identifier identifier argument_list string string_start string_content string_end if_statement comparison_operator identifier none block raise_statement call identifier argument_list string string_start string_content string_end expression_statement assignment identifier call attribute identifier identifier argument_list expression_statement call attribute attribute identifier identifier identifier argument_list expression_statement await call attribute call attribute identifier identifier argument_list string string_start string_content string_end identifier argument_list expression_statement augmented_assignment attribute identifier identifier integer expression_statement augmented_assignment attribute identifier identifier integer expression_statement assignment identifier await call attribute identifier identifier argument_list keyword_argument identifier identifier keyword_argument identifier call attribute identifier identifier argument_list identifier keyword_argument identifier attribute identifier identifier return_statement identifier
Create a tunnel connection
def int_check(*args, func=None): func = func or inspect.stack()[2][3] for var in args: if not isinstance(var, numbers.Integral): name = type(var).__name__ raise ComplexError( f'Function {func} expected integral number, {name} got instead.')
module function_definition identifier parameters list_splat_pattern identifier default_parameter identifier none block expression_statement assignment identifier boolean_operator identifier subscript subscript call attribute identifier identifier argument_list integer integer for_statement identifier identifier block if_statement not_operator call identifier argument_list identifier attribute identifier identifier block expression_statement assignment identifier attribute call identifier argument_list identifier identifier raise_statement call identifier argument_list string string_start string_content interpolation identifier string_content interpolation identifier string_content string_end
Check if arguments are integrals.
def remove_cable_distributor(self, cable_dist): if cable_dist in self.cable_distributors() and isinstance(cable_dist, MVCableDistributorDing0): self._cable_distributors.remove(cable_dist) if self._graph.has_node(cable_dist): self._graph.remove_node(cable_dist)
module function_definition identifier parameters identifier identifier block if_statement boolean_operator comparison_operator identifier call attribute identifier identifier argument_list call identifier argument_list identifier identifier block expression_statement call attribute attribute identifier identifier identifier argument_list identifier if_statement call attribute attribute identifier identifier identifier argument_list identifier block expression_statement call attribute attribute identifier identifier identifier argument_list identifier
Removes a cable distributor from _cable_distributors if existing
def format_value(value): if isinstance(value, (bool, np.bool_)): return str(value) elif isinstance(value, (int, np.integer)): return '{:n}'.format(value) elif isinstance(value, (float, np.floating)): return '{:g}'.format(value) else: return str(value)
module function_definition identifier parameters identifier block if_statement call identifier argument_list identifier tuple identifier attribute identifier identifier block return_statement call identifier argument_list identifier elif_clause call identifier argument_list identifier tuple identifier attribute identifier identifier block return_statement call attribute string string_start string_content string_end identifier argument_list identifier elif_clause call identifier argument_list identifier tuple identifier attribute identifier identifier block return_statement call attribute string string_start string_content string_end identifier argument_list identifier else_clause block return_statement call identifier argument_list identifier
Pretty-print an arbitrary value.
def tokenize(string): for match in TOKENS_REGEX.finditer(string): yield Token(match.lastgroup, match.group().strip(), match.span())
module function_definition identifier parameters identifier block for_statement identifier call attribute identifier identifier argument_list identifier block expression_statement yield call identifier argument_list attribute identifier identifier call attribute call attribute identifier identifier argument_list identifier argument_list call attribute identifier identifier argument_list
Match and yield all the tokens of the input string.
def wind_bft(ms): "Convert wind from metres per second to Beaufort scale" if ms is None: return None for bft in range(len(_bft_threshold)): if ms < _bft_threshold[bft]: return bft return len(_bft_threshold)
module function_definition identifier parameters identifier block expression_statement string string_start string_content string_end if_statement comparison_operator identifier none block return_statement none for_statement identifier call identifier argument_list call identifier argument_list identifier block if_statement comparison_operator identifier subscript identifier identifier block return_statement identifier return_statement call identifier argument_list identifier
Convert wind from metres per second to Beaufort scale
def api_run_delete(run_id): data = current_app.config["data"] RunFacade(data).delete_run(run_id) return "DELETED run %s" % run_id
module function_definition identifier parameters identifier block expression_statement assignment identifier subscript attribute identifier identifier string string_start string_content string_end expression_statement call attribute call identifier argument_list identifier identifier argument_list identifier return_statement binary_operator string string_start string_content string_end identifier
Delete the given run and corresponding entities.
def _get_csv_fieldnames(csv_reader): fieldnames = [] for row in csv_reader: for col in row: field = ( col.strip() .replace('"', "") .replace(" ", "") .replace("(", "") .replace(")", "") .lower() ) fieldnames.append(field) if "id" in fieldnames: break else: del fieldnames[:] if not fieldnames: return None while True: field = fieldnames.pop() if field: fieldnames.append(field) break suffix = 1 for index, field in enumerate(fieldnames): if not field: fieldnames[index] = "field{}".format(suffix) suffix += 1 return fieldnames
module function_definition identifier parameters identifier block expression_statement assignment identifier list for_statement identifier identifier block for_statement identifier identifier block expression_statement assignment identifier parenthesized_expression call attribute call attribute call attribute call attribute call attribute call attribute identifier identifier argument_list identifier argument_list string string_start string_content string_end string string_start string_end identifier argument_list string string_start string_content string_end string string_start string_end identifier argument_list string string_start string_content string_end string string_start string_end identifier argument_list string string_start string_content string_end string string_start string_end identifier argument_list expression_statement call attribute identifier identifier argument_list identifier if_statement comparison_operator string string_start string_content string_end identifier block break_statement else_clause block delete_statement subscript identifier slice if_statement not_operator identifier block return_statement none while_statement true block expression_statement assignment identifier call attribute identifier identifier argument_list if_statement identifier block expression_statement call attribute identifier identifier argument_list identifier break_statement expression_statement assignment identifier integer for_statement pattern_list identifier identifier call identifier argument_list identifier block if_statement not_operator identifier block expression_statement assignment subscript identifier identifier call attribute string string_start string_content string_end identifier argument_list identifier expression_statement augmented_assignment identifier integer return_statement identifier
Finds fieldnames in Polarion exported csv file.
def wrap(self, width): res = [] prev_state = set() part = [] cwidth = 0 for char, _width, state in zip(self._string, self._width, self._state): if cwidth + _width > width: if prev_state: part.append(self.ANSI_RESET) res.append("".join(part)) prev_state = set() part = [] cwidth = 0 cwidth += _width if prev_state == state: pass elif prev_state <= state: part.extend(state - prev_state) else: part.append(self.ANSI_RESET) part.extend(state) prev_state = state part.append(char) if prev_state: part.append(self.ANSI_RESET) if part: res.append("".join(part)) return res
module function_definition identifier parameters identifier identifier block expression_statement assignment identifier list expression_statement assignment identifier call identifier argument_list expression_statement assignment identifier list expression_statement assignment identifier integer for_statement pattern_list identifier identifier identifier call identifier argument_list attribute identifier identifier attribute identifier identifier attribute identifier identifier block if_statement comparison_operator binary_operator identifier identifier identifier block if_statement identifier block expression_statement call attribute identifier identifier argument_list attribute identifier identifier expression_statement call attribute identifier identifier argument_list call attribute string string_start string_end identifier argument_list identifier expression_statement assignment identifier call identifier argument_list expression_statement assignment identifier list expression_statement assignment identifier integer expression_statement augmented_assignment identifier identifier if_statement comparison_operator identifier identifier block pass_statement elif_clause comparison_operator identifier identifier block expression_statement call attribute identifier identifier argument_list binary_operator identifier identifier else_clause block expression_statement call attribute identifier identifier argument_list attribute identifier identifier expression_statement call attribute identifier identifier argument_list identifier expression_statement assignment identifier identifier expression_statement call attribute identifier identifier argument_list identifier if_statement identifier block expression_statement call attribute identifier identifier argument_list attribute identifier identifier if_statement identifier block expression_statement call attribute identifier identifier argument_list call attribute string string_start string_end identifier argument_list identifier return_statement identifier
Returns a partition of the string based on `width`
def _iget(key, lookup_dict): for k, v in lookup_dict.items(): if k.lower() == key.lower(): return v return None
module function_definition identifier parameters identifier identifier block for_statement pattern_list identifier identifier call attribute identifier identifier argument_list block if_statement comparison_operator call attribute identifier identifier argument_list call attribute identifier identifier argument_list block return_statement identifier return_statement none
Case-insensitive search for `key` within keys of `lookup_dict`.
def connected_socket(address, timeout=3): sock = socket.create_connection(address, timeout) yield sock sock.close()
module function_definition identifier parameters identifier default_parameter identifier integer block expression_statement assignment identifier call attribute identifier identifier argument_list identifier identifier expression_statement yield identifier expression_statement call attribute identifier identifier argument_list
yields a connected socket
def gwcalctyp(self): dig0 = str(self._SIGMA_TYPES[self.type]) dig1 = str(self._SC_MODES[self.sc_mode]) return dig1.strip() + dig0.strip()
module function_definition identifier parameters identifier block expression_statement assignment identifier call identifier argument_list subscript attribute identifier identifier attribute identifier identifier expression_statement assignment identifier call identifier argument_list subscript attribute identifier identifier attribute identifier identifier return_statement binary_operator call attribute identifier identifier argument_list call attribute identifier identifier argument_list
Returns the value of the gwcalctyp input variable.
def superdict(arg=()): def update(obj, arg): return obj.update(arg) or obj return update(defaultdict(superdict), arg)
module function_definition identifier parameters default_parameter identifier tuple block function_definition identifier parameters identifier identifier block return_statement boolean_operator call attribute identifier identifier argument_list identifier identifier return_statement call identifier argument_list call identifier argument_list identifier identifier
Recursive defaultdict which can init with other dict
def fetch_and_execute_function_to_run(self, key): (driver_id, serialized_function, run_on_other_drivers) = self.redis_client.hmget( key, ["driver_id", "function", "run_on_other_drivers"]) if (utils.decode(run_on_other_drivers) == "False" and self.worker.mode == ray.SCRIPT_MODE and driver_id != self.worker.task_driver_id.binary()): return try: function = pickle.loads(serialized_function) function({"worker": self.worker}) except Exception: traceback_str = traceback.format_exc() utils.push_error_to_driver( self.worker, ray_constants.FUNCTION_TO_RUN_PUSH_ERROR, traceback_str, driver_id=ray.DriverID(driver_id))
module function_definition identifier parameters identifier identifier block expression_statement assignment tuple_pattern identifier identifier identifier call attribute attribute identifier identifier identifier argument_list identifier list string string_start string_content string_end string string_start string_content string_end string string_start string_content string_end if_statement parenthesized_expression boolean_operator boolean_operator comparison_operator call attribute identifier identifier argument_list identifier string string_start string_content string_end comparison_operator attribute attribute identifier identifier identifier attribute identifier identifier comparison_operator identifier call attribute attribute attribute identifier identifier identifier identifier argument_list block return_statement try_statement block expression_statement assignment identifier call attribute identifier identifier argument_list identifier expression_statement call identifier argument_list dictionary pair string string_start string_content string_end attribute identifier identifier except_clause identifier block expression_statement assignment identifier call attribute identifier identifier argument_list expression_statement call attribute identifier identifier argument_list attribute identifier identifier attribute identifier identifier identifier keyword_argument identifier call attribute identifier identifier argument_list identifier
Run on arbitrary function on the worker.
def macro(parser, token): name = token.strip() parser.build_method(name, endnodes=['endmacro']) return ast.Yield(value=ast.Str(s=''))
module function_definition identifier parameters identifier identifier block expression_statement assignment identifier call attribute identifier identifier argument_list expression_statement call attribute identifier identifier argument_list identifier keyword_argument identifier list string string_start string_content string_end return_statement call attribute identifier identifier argument_list keyword_argument identifier call attribute identifier identifier argument_list keyword_argument identifier string string_start string_end
Works just like block, but does not render.
def _validate_param(rtype, fields): try: model = rtype_to_model(rtype) model_fields = model.all_fields except ValueError: raise InvalidQueryParams(**{ 'detail': 'The fields query param provided with a ' 'field type of "%s" is unknown.' % rtype, 'links': LINK, 'parameter': PARAM, }) for field in fields: if field not in model_fields: raise InvalidQueryParams(**{ 'detail': 'The fields query param "TYPE" of "%s" ' 'is not possible. It does not have a field ' 'by the name of "%s".' % (rtype, field), 'links': LINK, 'parameter': PARAM, })
module function_definition identifier parameters identifier identifier block try_statement block expression_statement assignment identifier call identifier argument_list identifier expression_statement assignment identifier attribute identifier identifier except_clause identifier block raise_statement call identifier argument_list dictionary_splat dictionary pair string string_start string_content string_end binary_operator concatenated_string string string_start string_content string_end string string_start string_content string_end identifier pair string string_start string_content string_end identifier pair string string_start string_content string_end identifier for_statement identifier identifier block if_statement comparison_operator identifier identifier block raise_statement call identifier argument_list dictionary_splat dictionary pair string string_start string_content string_end binary_operator concatenated_string string string_start string_content string_end string string_start string_content string_end string string_start string_content string_end tuple identifier identifier pair string string_start string_content string_end identifier pair string string_start string_content string_end identifier
Ensure the sparse fields exists on the models
def load_json(data=None, path=None, name='NT'): if data and not path: return mapper(json.loads(data), _nt_name=name) if path and not data: return mapper(json.load(path), _nt_name=name) if data and path: raise ValueError('expected one source and received two')
module function_definition identifier parameters default_parameter identifier none default_parameter identifier none default_parameter identifier string string_start string_content string_end block if_statement boolean_operator identifier not_operator identifier block return_statement call identifier argument_list call attribute identifier identifier argument_list identifier keyword_argument identifier identifier if_statement boolean_operator identifier not_operator identifier block return_statement call identifier argument_list call attribute identifier identifier argument_list identifier keyword_argument identifier identifier if_statement boolean_operator identifier identifier block raise_statement call identifier argument_list string string_start string_content string_end
Map namedtuples with json data.
def _ewp_files_set(self, ewp_dic, project_dic): try: ewp_dic['project']['file'] = [] except KeyError: pass ewp_dic['project']['group'] = [] i = 0 for group_name, files in project_dic['groups'].items(): ewp_dic['project']['group'].append({'name': group_name, 'file': []}) for file in files: ewp_dic['project']['group'][i]['file'].append({'name': file}) ewp_dic['project']['group'][i]['file'] = sorted(ewp_dic['project']['group'][i]['file'], key=lambda x: os.path.basename(x['name'].lower())) i += 1
module function_definition identifier parameters identifier identifier identifier block try_statement block expression_statement assignment subscript subscript identifier string string_start string_content string_end string string_start string_content string_end list except_clause identifier block pass_statement expression_statement assignment subscript subscript identifier string string_start string_content string_end string string_start string_content string_end list expression_statement assignment identifier integer for_statement pattern_list identifier identifier call attribute subscript identifier string string_start string_content string_end identifier argument_list block expression_statement call attribute subscript subscript identifier string string_start string_content string_end string string_start string_content string_end identifier argument_list dictionary pair string string_start string_content string_end identifier pair string string_start string_content string_end list for_statement identifier identifier block expression_statement call attribute subscript subscript subscript subscript identifier string string_start string_content string_end string string_start string_content string_end identifier string string_start string_content string_end identifier argument_list dictionary pair string string_start string_content string_end identifier expression_statement assignment subscript subscript subscript subscript identifier string string_start string_content string_end string string_start string_content string_end identifier string string_start string_content string_end call identifier argument_list subscript subscript subscript subscript identifier string string_start string_content string_end string string_start string_content string_end identifier string string_start string_content string_end keyword_argument identifier lambda lambda_parameters identifier call attribute attribute identifier identifier identifier argument_list call attribute subscript identifier string string_start string_content string_end identifier argument_list expression_statement augmented_assignment identifier integer
Fills files in the ewp dictionary
def unbind(self, exchange, source, routing_key='', nowait=True, arguments={}, ticket=None, cb=None): nowait = nowait and self.allow_nowait() and not cb args = Writer() args.write_short(ticket or self.default_ticket).\ write_shortstr(exchange).\ write_shortstr(source).\ write_shortstr(routing_key).\ write_bit(nowait).\ write_table(arguments or {}) self.send_frame(MethodFrame(self.channel_id, 40, 40, args)) if not nowait: self._unbind_cb.append(cb) self.channel.add_synchronous_cb(self._recv_unbind_ok)
module function_definition identifier parameters identifier identifier identifier default_parameter identifier string string_start string_end default_parameter identifier true default_parameter identifier dictionary default_parameter identifier none default_parameter identifier none block expression_statement assignment identifier boolean_operator boolean_operator identifier call attribute identifier identifier argument_list not_operator identifier expression_statement assignment identifier call identifier argument_list expression_statement call attribute call attribute call attribute call attribute call attribute call attribute identifier identifier argument_list boolean_operator identifier attribute identifier identifier line_continuation identifier argument_list identifier line_continuation identifier argument_list identifier line_continuation identifier argument_list identifier line_continuation identifier argument_list identifier line_continuation identifier argument_list boolean_operator identifier dictionary expression_statement call attribute identifier identifier argument_list call identifier argument_list attribute identifier identifier integer integer identifier if_statement not_operator identifier block expression_statement call attribute attribute identifier identifier identifier argument_list identifier expression_statement call attribute attribute identifier identifier identifier argument_list attribute identifier identifier
Unbind an exchange from another.
def init(req, model): rels = model.relationships params = req.get_param_as_list('include') or [] params = [param.lower() for param in params] for param in params: _validate_no_nesting(param) _validate_rels(param, rels) return params
module function_definition identifier parameters identifier identifier block expression_statement assignment identifier attribute identifier identifier expression_statement assignment identifier boolean_operator call attribute identifier identifier argument_list string string_start string_content string_end list expression_statement assignment identifier list_comprehension call attribute identifier identifier argument_list for_in_clause identifier identifier for_statement identifier identifier block expression_statement call identifier argument_list identifier expression_statement call identifier argument_list identifier identifier return_statement identifier
Return an array of fields to include.