code
string
signature
string
docstring
string
loss_without_docstring
float64
loss_with_docstring
float64
factor
float64
children_objs = OrderedDict() if not types: types = self.get_all_child_types(self.obj_ref()) for child_type in types: children_list = self.api.getList(self.obj_ref(), child_type) children_objs.update(self._build_children_objs(child_type, children_lis...
def get_children(self, *types)
Read (getList) children from IXN. Use this method to align with current IXN configuration. :param types: list of requested children. :return: list of all children objects of the requested types.
3.565488
3.374369
1.056639
child_obj_ref = self.obj_ref() + '/' + objType if seq_number: child_obj_ref += ':' + str(seq_number) child_obj = self.get_object_by_ref(child_obj_ref) child_obj_type = self.get_obj_class(objType) return child_obj if child_obj else child_obj_type(parent=self, ...
def get_child_static(self, objType, seq_number=None)
Returns IxnObject representing the requested child without reading it from the IXN. Statically build the child object reference based on the requested object type and sequence number and build the IxnObject with this calculated object reference. Ideally we would prefer to never use this functio...
2.600024
2.426752
1.071401
ixn_obj = self ref_indices = [] while ixn_obj != ixn_obj.root: ref_indices.append(ixn_obj.ref.split(':')[-1]) ixn_obj = ixn_obj.parent return ref_indices[::-1]
def get_ref_indices(self)
:return: list of all indices in object reference.
3.610365
3.362753
1.073634
def list_conversations(self, filter=None, filter_mode=None, include=None, include_all_conversation_ids=None, interleave_submissions=None, scope=None): path = {} data = {} params = {} # OPTIONAL - scope if scope is not None: self._validate_e...
List conversations. Returns the list of conversations for the current user, most recent ones first.
null
null
null
def create_conversation(self, body, recipients, attachment_ids=None, context_code=None, filter=None, filter_mode=None, group_conversation=None, media_comment_id=None, media_comment_type=None, mode=None, scope=None, subject=None, user_note=None): path = {} data = {} params = {} ...
Create a conversation. Create a new conversation with one or more recipients. If there is already an existing private conversation with the given recipients, it will be reused.
null
null
null
def get_single_conversation(self, id, auto_mark_as_read=None, filter=None, filter_mode=None, interleave_submissions=None, scope=None): path = {} data = {} params = {} # REQUIRED - PATH - id path["id"] = id # OPTIONAL - interleave_submissions ...
Get a single conversation. Returns information for a single conversation for the current user. Response includes all fields that are present in the list/index action as well as messages and extended participant information.
null
null
null
def edit_conversation(self, id, conversation_starred=None, conversation_subscribed=None, conversation_workflow_state=None, filter=None, filter_mode=None, scope=None): path = {} data = {} params = {} # REQUIRED - PATH - id path["id"] = id # OP...
Edit a conversation. Updates attributes for a single conversation.
null
null
null
def add_recipients(self, id, recipients): path = {} data = {} params = {} # REQUIRED - PATH - id path["id"] = id # REQUIRED - recipients data["recipients"] = recipients self.logger.debug("POST /api/v1/conversatio...
Add recipients. Add recipients to an existing group conversation. Response is similar to the GET/show action, except that only includes the latest message (e.g. "joe was added to the conversation by bob")
null
null
null
def add_message(self, id, body, attachment_ids=None, included_messages=None, media_comment_id=None, media_comment_type=None, recipients=None, user_note=None): path = {} data = {} params = {} # REQUIRED - PATH - id path["id"] = id # REQUIRED -...
Add a message. Add a message to an existing conversation. Response is similar to the GET/show action, except that only includes the latest message (i.e. what we just sent) An array of user ids. Defaults to all of the current conversation recipients. To explicitly...
null
null
null
def delete_message(self, id, remove): path = {} data = {} params = {} # REQUIRED - PATH - id path["id"] = id # REQUIRED - remove data["remove"] = remove self.logger.debug("POST /api/v1/conversations/{id}/remove_m...
Delete a message. Delete messages from this conversation. Note that this only affects this user's view of the conversation. If all messages are deleted, the conversation will be as well (equivalent to DELETE)
null
null
null
def batch_update_conversations(self, event, conversation_ids): path = {} data = {} params = {} # REQUIRED - conversation_ids data["conversation_ids"] = conversation_ids # REQUIRED - event self._validate_enum(event, ["mark_a...
Batch update conversations. Perform a change on a set of conversations. Operates asynchronously; use the {api:ProgressController#show progress endpoint} to query the status of an operation.
null
null
null
def list_preferences_communication_channel_id(self, user_id, communication_channel_id): path = {} data = {} params = {} # REQUIRED - PATH - user_id path["user_id"] = user_id # REQUIRED - PATH - communication_channel_id path...
List preferences. Fetch all preferences for the given communication channel
null
null
null
def list_preferences_type(self, type, user_id, address): path = {} data = {} params = {} # REQUIRED - PATH - user_id path["user_id"] = user_id # REQUIRED - PATH - type path["type"] = type # REQUIRED - PATH - addr...
List preferences. Fetch all preferences for the given communication channel
null
null
null
def get_preference_communication_channel_id(self, user_id, notification, communication_channel_id): path = {} data = {} params = {} # REQUIRED - PATH - user_id path["user_id"] = user_id # REQUIRED - PATH - communication_channel_id ...
Get a preference. Fetch the preference for the given notification for the given communicaiton channel
null
null
null
def get_preference_type(self, type, user_id, address, notification): path = {} data = {} params = {} # REQUIRED - PATH - user_id path["user_id"] = user_id # REQUIRED - PATH - type path["type"] = type # REQUIRED -...
Get a preference. Fetch the preference for the given notification for the given communicaiton channel
null
null
null
def update_preference_communication_channel_id(self, notification, communication_channel_id, notification_preferences_frequency): path = {} data = {} params = {} # REQUIRED - PATH - communication_channel_id path["communication_channel_id"] = communicati...
Update a preference. Change the preference for a single notification for a single communication channel
null
null
null
def update_preference_type(self, type, address, notification, notification_preferences_frequency): path = {} data = {} params = {} # REQUIRED - PATH - type path["type"] = type # REQUIRED - PATH - address path["address"] = a...
Update a preference. Change the preference for a single notification for a single communication channel
null
null
null
def update_preferences_by_category(self, category, communication_channel_id, notification_preferences_frequency): path = {} data = {} params = {} # REQUIRED - PATH - communication_channel_id path["communication_channel_id"] = communication_channel_id ...
Update preferences by category. Change the preferences for multiple notifications based on the category for a single communication channel
null
null
null
if cl_args is None and len(sys.argv) > 1: cl_args = sys.argv[1:] args = options.parse_args(cl_args) print("-------------------------------------------------------------------") print(" __ _____ ___ ____ _ __ ") print(" / / / _/ |...
def main(cl_args=None)
Direct execution.
2.977387
2.973248
1.001392
def list_users_in_account(self, account_id, search_term=None): path = {} data = {} params = {} # REQUIRED - PATH - account_id path["account_id"] = account_id # OPTIONAL - search_term if search_term is not None: ...
List users in account. Retrieve the list of users associated with this account. @example_request curl https://<canvas>/api/v1/accounts/self/users?search_term=<search value> \ -X GET \ -H 'Authorization: Bearer <token>'
null
null
null
def self_register_user(self, user_name, account_id, user_terms_of_use, pseudonym_unique_id, communication_channel_address=None, communication_channel_type=None, user_birthdate=None, user_locale=None, user_short_name=None, user_sortable_name=None, user_time_zone=None): path = {} data = {} ...
Self register a user. Self register and return a new user and pseudonym for an account. If self-registration is enabled on the account, you can use this endpoint to self register new users.
null
null
null
def update_user_settings(self, id, collapse_global_nav=None, manual_mark_as_read=None): path = {} data = {} params = {} # REQUIRED - PATH - id path["id"] = id # OPTIONAL - manual_mark_as_read if manual_mark_as_read is not N...
Update user settings. Update an existing user's settings.
null
null
null
def get_custom_color(self, id, asset_string): path = {} data = {} params = {} # REQUIRED - PATH - id path["id"] = id # REQUIRED - PATH - asset_string path["asset_string"] = asset_string self.logger.debug("GET /ap...
Get custom color. Returns the custom colors that have been saved for a user for a given context. The asset_string parameter should be in the format 'context_id', for example 'course_42'.
null
null
null
def edit_user(self, id, user_avatar_token=None, user_avatar_url=None, user_email=None, user_locale=None, user_name=None, user_short_name=None, user_sortable_name=None, user_time_zone=None): path = {} data = {} params = {} # REQUIRED - PATH - id path["id...
Edit a user. Modify an existing user. To modify a user's login, see the documentation for logins.
null
null
null
def merge_user_into_another_user_destination_user_id(self, id, destination_user_id): path = {} data = {} params = {} # REQUIRED - PATH - id path["id"] = id # REQUIRED - PATH - destination_user_id path["destination_user_id"]...
Merge user into another user. Merge a user into another user. To merge users, the caller must have permissions to manage both users. This should be considered irreversible. This will delete the user and move all the data into the destination user. When finding us...
null
null
null
def get_user_profile(self, user_id): path = {} data = {} params = {} # REQUIRED - PATH - user_id path["user_id"] = user_id self.logger.debug("GET /api/v1/users/{user_id}/profile with query params: {params} and form data: {data}".format(params...
Get user profile. Returns user profile data, including user id, name, and profile pic. When requesting the profile for the user accessing the API, the user's calendar feed URL will be returned as well.
null
null
null
def list_user_page_views(self, user_id, end_time=None, start_time=None): path = {} data = {} params = {} # REQUIRED - PATH - user_id path["user_id"] = user_id # OPTIONAL - start_time if start_time is not None: ...
List user page views. Return the user's page view history in json format, similar to the available CSV download. Pagination is used as described in API basics section. Page views are returned in descending order, newest to oldest.
null
null
null
def list_course_nicknames(self): path = {} data = {} params = {} self.logger.debug("GET /api/v1/users/self/course_nicknames with query params: {params} and form data: {data}".format(params=params, data=data, **path)) return self.generic_request("GET", "/api/v1/us...
List course nicknames. Returns all course nicknames you have set.
null
null
null
def set_course_nickname(self, nickname, course_id): path = {} data = {} params = {} # REQUIRED - PATH - course_id path["course_id"] = course_id # REQUIRED - nickname data["nickname"] = nickname self.logger.debug(...
Set course nickname. Set a nickname for the given course. This will replace the course's name in output of API calls you make subsequently, as well as in selected places in the Canvas web user interface.
null
null
null
def get_sis_import_list(self, account_id, created_since=None): path = {} data = {} params = {} # REQUIRED - PATH - account_id path["account_id"] = account_id # OPTIONAL - created_since if created_since is not None: ...
Get SIS import list. Returns the list of SIS imports for an account Example: curl 'https://<canvas>/api/v1/accounts/<account_id>/sis_imports' \ -H "Authorization: Bearer <token>"
null
null
null
def import_sis_data(self, account_id, add_sis_stickiness=None, attachment=None, batch_mode=None, batch_mode_term_id=None, clear_sis_stickiness=None, diffing_data_set_identifier=None, diffing_remaster_data_set=None, extension=None, import_type=None, override_sis_stickiness=None): path = {} da...
Import SIS data. Import SIS data into Canvas. Must be on a root account with SIS imports enabled. For more information on the format that's expected here, please see the "SIS CSV" section in the API docs.
null
null
null
def abort_all_pending_sis_imports(self, account_id): path = {} data = {} params = {} # REQUIRED - PATH - account_id path["account_id"] = account_id self.logger.debug("PUT /api/v1/accounts/{account_id}/sis_imports/abort_all_pending with query ...
Abort all pending SIS imports. Abort already created but not processed or processing SIS imports.
null
null
null
import distutils.log dirname = dirname or '.' try: valid_mgrs = managers.RepoManager.get_valid_managers(dirname) valid_mgrs = managers.RepoManager.existing_only(valid_mgrs) for mgr in valid_mgrs: try: return mgr.find_all_files() except Exception: e = sys.exc_info()[1] distutils.log.warn( ...
def file_finder(dirname=".")
Find the files in ``dirname`` under Mercurial version control according to the setuptools spec (see http://peak.telecommunity.com/DevCenter/setuptools#adding-support-for-other-revision-control-systems ).
4.00354
3.609554
1.109151
from setuptools.command.egg_info import egg_info from pkg_resources import safe_version import functools orig_ver = egg_info.tagged_version @functools.wraps(orig_ver) def tagged_version(self): vcs_param = ( getattr(self.distribution, 'use_vcs_version', False) or getattr(self.distribution, 'use_hg_versi...
def patch_egg_info(force_hg_version=False)
A hack to replace egg_info.tagged_version with a wrapped version that will use the mercurial version if indicated. `force_hg_version` is used for hgtools itself.
3.079928
2.892461
1.064812
expected_attrs = 'use_hg_version', 'use_vcs_version' if not value or attr not in expected_attrs: return options = value if isinstance(value, dict) else {} dist.metadata.version = calculate_version(options) patch_egg_info()
def version_calc(dist, attr, value)
Handler for parameter to setup(use_vcs_version=value) attr should be 'use_vcs_version' (also allows use_hg_version for compatibility). bool(value) should be true to invoke this plugin. value may optionally be a dict and supply options to the plugin.
6.3929
4.056671
1.575898
if name not in storage: storage[name] = value return storage[name]
def get_or_create(name, value)
returns the storage space defined by name if space does not exist yet it will first be created with the specified value
4.372072
5.632427
0.776232
'''Parse a module's attributes and generate a markdown document.''' attributes = [ (name, type_) for (name, type_) in getmembers(module) if (isclass(type_) or isfunction(type_)) and type_.__module__ == module.__name__ and not type_.__name__.startswith('_') ] attr...
def parse_module(module)
Parse a module's attributes and generate a markdown document.
2.629681
2.444994
1.075536
retry = options["retry"] interval = options["interval"] while True: try: resp = target(*args, **kwargs) # status error if resp.code == 200: return resp _logger.debug("Request got response status: %s" % (...
def Retry(target=None, args=[], kwargs={}, options={"retry": True, "interval": 1})
options retry True, infinity retries False, no retries Number, retries times interval time period for retry return None if no success Message if success
4.29781
4.043399
1.06292
def _crud(resource, data=None, block=True, timeout=60, topic="/controller", tunnel=None, qos=0): headers = { "resource": resource, "method...
def create_crud_func(self, method, request_type="CRUD")
create_crud_func
4.812087
4.725749
1.01827
def _response(code=200, data=None): resp_msg = message.to_response(code=code, data=data, sign=sign) with self._session.session_lock: mid = self._conn.publish(topic="/controller", qos=0, payload=resp_msg.to_di...
def create_response(self, message, sign)
return function for response
7.471575
7.165617
1.042698
def list_assignment_groups(self, course_id, exclude_assignment_submission_types=None, grading_period_id=None, include=None, override_assignment_dates=None, scope_assignments_to_student=None): path = {} data = {} params = {} # REQUIRED - PATH - course_id ...
List assignment groups. Returns the list of assignment groups for the current context. The returned groups are sorted by their position field.
null
null
null
def get_assignment_group(self, course_id, assignment_group_id, grading_period_id=None, include=None, override_assignment_dates=None): path = {} data = {} params = {} # REQUIRED - PATH - course_id path["course_id"] = course_id # REQUIRED - PAT...
Get an Assignment Group. Returns the assignment group with the given id.
null
null
null
def create_assignment_group(self, course_id, group_weight=None, integration_data=None, name=None, position=None, rules=None, sis_source_id=None): path = {} data = {} params = {} # REQUIRED - PATH - course_id path["course_id"] = course_id # OP...
Create an Assignment Group. Create a new assignment group for this course.
null
null
null
def edit_assignment_group(self, course_id, assignment_group_id): path = {} data = {} params = {} # REQUIRED - PATH - course_id path["course_id"] = course_id # REQUIRED - PATH - assignment_group_id path["assignment_group_id"...
Edit an Assignment Group. Modify an existing Assignment Group. Accepts the same parameters as Assignment Group creation
null
null
null
def create_question_group(self, quiz_id, course_id, quiz_groups_assessment_question_bank_id=None, quiz_groups_name=None, quiz_groups_pick_count=None, quiz_groups_question_points=None): path = {} data = {} params = {} # REQUIRED - PATH - course_id path["...
Create a question group. Create a new question group for this quiz <b>201 Created</b> response code is returned if the creation was successful.
null
null
null
def update_question_group(self, id, quiz_id, course_id, quiz_groups_name=None, quiz_groups_pick_count=None, quiz_groups_question_points=None): path = {} data = {} params = {} # REQUIRED - PATH - course_id path["course_id"] = course_id # REQUI...
Update a question group. Update a question group
null
null
null
def reorder_question_groups(self, id, quiz_id, order_id, course_id, order_type=None): path = {} data = {} params = {} # REQUIRED - PATH - course_id path["course_id"] = course_id # REQUIRED - PATH - quiz_id path["quiz_id"] =...
Reorder question groups. Change the order of the quiz questions within the group <b>204 No Content<b> response code is returned if the reorder was successful.
null
null
null
def list_your_courses(self, enrollment_role=None, enrollment_role_id=None, enrollment_state=None, enrollment_type=None, include=None, state=None): path = {} data = {} params = {} # OPTIONAL - enrollment_type if enrollment_type is not None: ...
List your courses. Returns the list of active courses for the current user.
null
null
null
def list_courses_for_user(self, user_id, enrollment_state=None, include=None, state=None): path = {} data = {} params = {} # REQUIRED - PATH - user_id path["user_id"] = user_id # OPTIONAL - include if include is not None: ...
List courses for a user. Returns a list of active courses for this user. To view the course list for a user other than yourself, you must be either an observer of that user or an administrator.
null
null
null
def list_users_in_course_users(self, course_id, enrollment_role=None, enrollment_role_id=None, enrollment_state=None, enrollment_type=None, include=None, search_term=None, user_id=None, user_ids=None): path = {} data = {} params = {} # REQUIRED - PATH - course_id ...
List users in course. Returns the list of users in this course. And optionally the user's enrollments in the course.
null
null
null
def conclude_course(self, id, event): path = {} data = {} params = {} # REQUIRED - PATH - id path["id"] = id # REQUIRED - event self._validate_enum(event, ["delete", "conclude"]) params["event"] = event ...
Conclude a course. Delete or conclude an existing course
null
null
null
def update_course_settings(self, course_id, allow_student_discussion_editing=None, allow_student_discussion_topics=None, allow_student_forum_attachments=None, allow_student_organized_groups=None, hide_distribution_graphs=None, hide_final_grades=None, home_page_announcement_limit=None, lock_all_announcements=None, restr...
Update course settings. Can update the following course settings:
null
null
null
def update_courses(self, event, account_id, course_ids): path = {} data = {} params = {} # REQUIRED - PATH - account_id path["account_id"] = account_id # REQUIRED - course_ids data["course_ids"] = course_ids # RE...
Update courses. Update multiple courses in an account. Operates asynchronously; use the {api:ProgressController#show progress endpoint} to query the status of an operation. The action to take on each course. Must be one of 'offer', 'conclude', 'delete', or 'undelete'. ...
null
null
null
def reset_course(self, course_id): path = {} data = {} params = {} # REQUIRED - PATH - course_id path["course_id"] = course_id self.logger.debug("POST /api/v1/courses/{course_id}/reset_content with query params: {params} and form data: {data}...
Reset a course. Deletes the current course, and creates a new equivalent course with no content, but all sections and users moved over.
null
null
null
def get_effective_due_dates(self, course_id, assignment_ids=None): path = {} data = {} params = {} # REQUIRED - PATH - course_id path["course_id"] = course_id # OPTIONAL - assignment_ids if assignment_ids is not None: ...
Get effective due dates. For each assignment in the course, returns each assigned student's ID and their corresponding due date along with some Multiple Grading Periods data. Returns a collection with keys representing assignment IDs and values as a collection containing keys repre...
null
null
null
def permissions(self, course_id, permissions=None): path = {} data = {} params = {} # REQUIRED - PATH - course_id path["course_id"] = course_id # OPTIONAL - permissions if permissions is not None: params["permi...
Permissions. Returns permission information for provided course & current_user
null
null
null
def copy_course_content(self, course_id, exclude=None, only=None, source_course=None): path = {} data = {} params = {} # REQUIRED - PATH - course_id path["course_id"] = course_id # OPTIONAL - source_course if source_course ...
Copy course content. DEPRECATED: Please use the {api:ContentMigrationsController#create Content Migrations API} Copies content from one course into another. The default is to copy all course content. You can control specific types to copy by using either the 'except' option ...
null
null
null
_page = { 'Type': 'Page', 'Title': title, 'Description': description, 'Data': {}, } if element_list is not None: if isinstance(element_list, list): _page['Data']['Elements'] = element_list else: _page[...
def page(title, description, element_list=None, tab_list=None)
Returns a dictionary representing a new page to display elements. This can be thought of as a simple container for displaying multiple types of information. The ``section`` method can be used to create separate tabs. Args: title: The title to display description: A description of the se...
1.7451
1.822645
0.957455
_tab = { 'Type': 'Tab', 'Title': tab_name, } if element_list is not None: if isinstance(element_list, list): _tab['Elements'] = element_list else: _tab['Elements'] = [element_list] if section_list is not None: if isins...
def tab(tab_name, element_list=None, section_list=None)
Returns a dictionary representing a new tab to display elements. This can be thought of as a simple container for displaying multiple types of information. Args: tab_name: The title to display element_list: The list of elements to display. If a single element is given ...
2.064435
2.106801
0.979891
sect = { 'Type': 'Section', 'Title': title, } if isinstance(element_list, list): sect['Elements'] = element_list else: sect['Elements'] = [element_list] return sect
def section(title, element_list)
Returns a dictionary representing a new section. Sections contain a list of elements that are displayed separately from the global elements on the page. Args: title: The title of the section to be displayed element_list: The list of elements to display within the section Returns: ...
2.769192
3.750658
0.738322
ie = { 'Type': 'Image', 'Title': title, 'Description': desc, 'Plot File': image_name, } if group: ie['Group'] = group if height: ie['Height'] = height return ie
def image(title, desc, image_name, group=None, height=None)
Builds an image element. Image elements are primarily created and then wrapped into an image gallery element. This is not required behavior, however and it's independent usage should be allowed depending on the behavior required. The Javascript will search for the `image_name` in the component's ...
3.725291
5.33469
0.698314
# Retrieve all commands via split function or splitting on ';' print('\tRetrieving commands from', self.sql_script) print('\tUsing command splitter algorithm {0}'.format(self.split_algo)) with Timer('\tRetrieved commands in'): # Split commands # sqlparse...
def commands(self)
Fetch individual SQL commands from a SQL commands containing many commands. :return: List of commands
5.733469
5.526089
1.037528
# Break connection self._MySQL.disconnect() self._execute_iters += 1 if self._execute_iters > 0: print('\tExecuting commands attempt #{0}'.format(self._execute_iters)) # Retrieve commands from sql_script if no commands are provided commands = self.co...
def execute(self, commands=None, ignored_commands=('DROP', 'UNLOCK', 'LOCK'), execute_fails=True, max_executions=MAX_EXECUTION_ATTEMPTS)
Sequentially execute a list of SQL commands. Check if commands property has already been fetched, if so use the fetched_commands rather than getting them again. :param commands: List of SQL commands :param ignored_commands: Boolean, skip SQL commands that begin with 'DROP' :par...
5.213839
5.090804
1.024168
# Confirm that prepare_statements flag is on if self._prep_statements: prepared_commands = [prepare_sql(c) for c in tqdm(commands, total=len(commands), desc='Prepping SQL Commands')] print('\tCommands prepared...
def _execute_commands(self, commands, fails=False)
Execute commands and get list of failed commands and count of successful commands
5.049661
4.785424
1.055217
# Get file paths and contents commands = get_commands_from_dir(directory) # Execute failed commands again print('\tAttempting to execute {0} failed commands'.format(len(commands))) return self.execute(commands, ignored_commands=None, execute_fails=True)
def _execute_commands_from_dir(self, directory)
Re-attempt to split and execute the failed commands
8.727175
7.155126
1.21971
# Get base directory directory = os.path.join(os.path.dirname(self.sql_script), 'fails') # Get file name to be used for folder name fname = os.path.basename(self.sql_script.rsplit('.')[0]) return dump_commands(commands, directory, fname)
def dump_commands(self, commands)
Dump commands wrapper for external access.
6.650494
6.620408
1.004544
if reverse: sys.stdout = sys.__stdout__ sys.stderr = sys.__stderr__ else: sys.stdout = os.devnull sys.stderr = os.devnull
def suppress_output(reverse=False)
Suppress output
2.000134
2.009531
0.995324
reporter = RReporter() checkPath(f, reporter=reporter) return dict(reporter.messages)
def get_unresolved_variables(f)
Gets unresolved vars from file
19.819265
20.248283
0.978812
suppress_output() modules = defaultdict(list) pkglist = pkgutil.walk_packages(onerror=lambda x: True) print(pkglist) if path: pkglist = pkgutil.walk_packages(path, onerror=lambda x: True) for modl, name, ispkg in pkglist: try: path = os.path.join(modl.path, name....
def index_modules(idx=None, path=None)
Indexes objs from all modules
3.562433
3.52347
1.011058
result = {} for u, lines in unresolved.items(): paths = idx.get(u) if paths: result[u] = {'paths': paths, 'lineno': lines} return result
def get_suggestions(idx, unresolved)
Returns suggestions
5.03896
5.529644
0.911263
r = dict([(k, sorted(copy.deepcopy(v).values(), key=lambda x:x.get("order",0))) for k,v in self.get_config("includes").items()]) if self.version is not None: for k,v in r.items(): for j in v: j["path"] = self.versioned_url(j["path"]) retur...
def includes(self)
return includes from config
4.623365
4.081717
1.132701
return super(WebApplication, self).render(tmpl_name, request_env)
def render(self, tmpl_name, request_env)
Render the specified template and return the output. Args: tmpl_name (str): file name of the template request_env (dict): request environment Returns: str - the rendered template
4.581892
9.266243
0.494471
def submit_assignment_courses(self, course_id, assignment_id, submission_submission_type, comment_text_comment=None, submission_body=None, submission_file_ids=None, submission_media_comment_id=None, submission_media_comment_type=None, submission_url=None): path = {} data = {} params...
Submit an assignment. Make a submission for an assignment. You must be enrolled as a student in the course/section to do this. All online turn-in submission types are supported in this API. However, there are a few things that are not yet supported: * F...
null
null
null
def list_assignment_submissions_courses(self, course_id, assignment_id, grouped=None, include=None): path = {} data = {} params = {} # REQUIRED - PATH - course_id path["course_id"] = course_id # REQUIRED - PATH - assignment_id ...
List assignment submissions. Get all existing submissions for an assignment.
null
null
null
def list_assignment_submissions_sections(self, section_id, assignment_id, grouped=None, include=None): path = {} data = {} params = {} # REQUIRED - PATH - section_id path["section_id"] = section_id # REQUIRED - PATH - assignment_id ...
List assignment submissions. Get all existing submissions for an assignment.
null
null
null
def list_submissions_for_multiple_assignments_courses(self, course_id, assignment_ids=None, grading_period_id=None, grouped=None, include=None, order=None, order_direction=None, student_ids=None): path = {} data = {} params = {} # REQUIRED - PATH - course_id ...
List submissions for multiple assignments. Get all existing submissions for a given set of students and assignments.
null
null
null
def get_single_submission_courses(self, user_id, course_id, assignment_id, include=None): path = {} data = {} params = {} # REQUIRED - PATH - course_id path["course_id"] = course_id # REQUIRED - PATH - assignment_id path["a...
Get a single submission. Get a single submission, based on user id.
null
null
null
def get_single_submission_sections(self, user_id, section_id, assignment_id, include=None): path = {} data = {} params = {} # REQUIRED - PATH - section_id path["section_id"] = section_id # REQUIRED - PATH - assignment_id pa...
Get a single submission. Get a single submission, based on user id.
null
null
null
def upload_file_sections(self, user_id, section_id, assignment_id): path = {} data = {} params = {} # REQUIRED - PATH - section_id path["section_id"] = section_id # REQUIRED - PATH - assignment_id path["assignment_id"] = as...
Upload a file. Upload a file to a submission. This API endpoint is the first step in uploading a file to a submission as a student. See the {file:file_uploads.html File Upload Documentation} for details on the file upload workflow. The final step of the file upl...
null
null
null
def grade_or_comment_on_submission_courses(self, user_id, course_id, assignment_id, comment_file_ids=None, comment_group_comment=None, comment_media_comment_id=None, comment_media_comment_type=None, comment_text_comment=None, include_visibility=None, rubric_assessment=None, submission_excuse=None, submission_posted_gra...
Grade or comment on a submission. Comment on and/or update the grading for a student's assignment submission. If any submission or rubric_assessment arguments are provided, the user must have permission to manage grades in the appropriate context (course or section).
null
null
null
ops = self.parse(data) collection = self.apply(collection, ops, **kwargs) return ops, collection
def filter(self, collection, data, **kwargs)
Filter given collection.
6.012675
5.132846
1.171412
val = data.get(self.name, missing) if not isinstance(val, dict): return (self.operators['$eq'], self.field.deserialize(val)), return tuple( ( self.operators[op], (self.field.deserialize(val)) if op not in self.list_ops else [ ...
def parse(self, data)
Parse operator and value from filter's data.
5.112217
4.445432
1.149993
validator = lambda obj: all(op(obj, val) for (op, val) in ops) # noqa return [o for o in collection if validator(o)]
def apply(self, collection, ops, **kwargs)
Apply the filter to collection.
5.683931
5.382158
1.056069
name = args field = attr = None opts = () if isinstance(args, (list, tuple)): name, *opts = args if opts: attr = opts.pop() if opts: field = opts.pop() if not field and handler and handler.Schema: ...
def convert(self, args, handler=None)
Prepare filters.
5.10058
4.813249
1.059696
if not data or self.filters is None: return None, collection filters = {} for f in self.filters: if f.name not in data: continue ops, collection = f.filter(collection, data, **kwargs) filters[f.name] = ops return ...
def filter(self, data, collection, **kwargs)
Filter given collection.
4.036789
3.903866
1.034049
"Write your forwards methods here." PERM_CONF = { "publish_content": "Can publish content", "publish_own_content": "Can publish own content", "change_content": "Can change content", "promote_content": "Can promote content" } GROUP_CONF = di...
def forwards(self, orm)
Write your forwards methods here.
2.342808
2.288932
1.023538
p1 = Page( url='/example1', title='My page with default template', description='my description', content='hello default page', template_name='invenio_pages/default.html', ) p2 = Page( url='/example2', title='My page with my template', desc...
def pages()
Load pages.
2.848298
2.863466
0.994703
def list_poll_choices_in_poll(self, poll_id): path = {} data = {} params = {} # REQUIRED - PATH - poll_id path["poll_id"] = poll_id self.logger.debug("GET /api/v1/polls/{poll_id}/poll_choices with query params: {params} and form data: {data}"...
List poll choices in a poll. Returns the list of PollChoices in this poll.
null
null
null
def create_single_poll_choice(self, poll_id, poll_choices_text, poll_choices_is_correct=None, poll_choices_position=None): path = {} data = {} params = {} # REQUIRED - PATH - poll_id path["poll_id"] = poll_id # REQUIRED - poll_choices[text] ...
Create a single poll choice. Create a new poll choice for this poll
null
null
null
logger.debug("Initiating redirect of {0} session {1}".format(request.user, request.session.session_key[:5])) if isinstance(scopes, string_types): scopes = list([scopes]) # ensure only one callback redirect model per session CallbackRedirect.objects.filter(session_key=request.session.sessio...
def sso_redirect(request, scopes=list([]), return_to=None)
Generates a :model:`esi.CallbackRedirect` for the specified request. Redirects to EVE for login. Accepts a view or URL name as a redirect after SSO.
2.828384
2.623741
1.077997
logger.debug("Received callback for {0} session {1}".format(request.user, request.session.session_key[:5])) # make sure request has required parameters code = request.GET.get('code', None) state = request.GET.get('state', None) try: assert code assert state except AssertionE...
def receive_callback(request)
Parses SSO callback, validates, retrieves :model:`esi.Token`, and internally redirects to the target url.
2.979183
2.839983
1.049014
@tokens_required(scopes=scopes, new=new) def _token_list(r, tokens): context = { 'tokens': tokens, 'base_template': app_settings.ESI_BASE_TEMPLATE, } return render(r, 'esi/select_token.html', context=context) return _token_list(request)
def select_token(request, scopes='', new=False)
Presents the user with a selection of applicable tokens for the requested view.
4.145487
4.229065
0.980237
for column in self.get_schema(table): if len(column) > 3 and 'pri' in column[3].lower(): return column[0]
def get_primary_key(self, table)
Retrieve the column which is the primary key for a table.
4.190792
3.649424
1.148343
self.execute('ALTER TABLE {0} ADD PRIMARY KEY ({1})'.format(wrap(table), column)) self._printer('\tAdded primary key to {0} on column {1}'.format(wrap(table), column))
def set_primary_key(self, table, column)
Create a Primary Key constraint on a specific column when the table is already created.
4.523278
3.992039
1.133075
# Retrieve list of tables if not provided tables = tables if tables else self.tables # Resolve primary keys and return list of table, primary_key tuples return [(table, self.set_primary_key_auto(table)) for table in tables]
def set_primary_keys_auto(self, tables=None)
Create primary keys for every table in the connected database. Checks that each table has a primary key. If a table does not have a key then each column is analyzed to determine if it contains only unique values. If no columns exist containing only unique values then a new 'ID' column ...
5.455739
5.565356
0.980304
# Confirm no primary key exists pk = self.get_primary_key(table) if not pk: # Determine if there is a unique column that can become the PK unique_col = self.get_unique_column(table) # Set primary key if unique_col: self.se...
def set_primary_key_auto(self, table)
Analysis a table and set a primary key. Determine primary key by identifying a column with unique values or creating a new column. :param table: Table to alter :return: Primary Key column
3.653663
3.444488
1.060727
if self.get_primary_key(table): self.execute('ALTER TABLE {0} DROP PRIMARY KEY'.format(wrap(table)))
def drop_primary_key(self, table)
Drop a Primary Key constraint for a specific table.
4.235926
3.912775
1.082589
self.execute('ALTER TABLE {0} ADD FOREIGN KEY ({1}) REFERENCES {2}({3})'.format(parent_table, parent_column, child_table, child_column))
def set_foreign_key(self, parent_table, parent_column, child_table, child_column)
Create a Foreign Key constraint on a column from a table.
2.373698
2.086283
1.137764
api_key = getattr(settings, 'GECKOBOARD_API_KEY', None) if api_key is None: return True auth = request.META.get('HTTP_AUTHORIZATION', '').split() if len(auth) == 2: if auth[0].lower() == b'basic': request_key = base64.b64decode(auth[1]).split(b':')[0] return ...
def _is_api_key_correct(request)
Return whether the Geckoboard API key on the request is correct.
2.221524
1.868314
1.189052
BS = AES.block_size def pad(s): n = BS - len(s) % BS char = chr(n).encode('utf8') return s + n * char password = settings.GECKOBOARD_PASSWORD salt = Random.new().read(BS - len('Salted__')) key, iv = _derive_key_and_iv(password, salt, 32, BS) cipher = AES.new(key, A...
def _encrypt(data)
Equivalent to OpenSSL using 256 bit AES in CBC mode
3.278195
3.160906
1.037106