code stringlengths 1 18.2k |
|---|
!= 0 else 0, T=roc_dict["T"], T_proc=100.0 * (roc_dict["T"]) / (roc_dict["unmapped"]) if (roc_dict["unmapped"]) != 0 else 0, t=roc_dict["t"], t_proc=100.0 * (roc_dict["t"]) / (roc_dict["unmapped"]) if (roc_dict["unmapped"]) != 0 else 0, x=roc_dict["x"], x_proc=100.0 * (roc_dict["x"]) / (roc_dict["unmapped"]) if (roc_di... |
("BAM file", self._bam_fn), ("Allowed delta", self.report.allowed_delta), ]: eval_info.append( '<tr><td style="font-weight:bold">{}:</td><td style="text-align:left">{}</td></tr>'.format( lvalue, rvalue ) ) eval_info.append("</table>") css_src = textwrap.dedent( """ table {border-collapse:collapse;} td {border: solid #a... |
mapped to wrong position <span class="desc"> (at least one segment was mapped to a wrong position), </span> <strong>m</strong>: mapped but should be unmapped <span class="desc"> (at least one segment was mapped but the read should not be mapped), </span> <strong>P</strong>: multimapped <span class="desc"> (read should ... |
class="desc"> (read is probably not reported by mapper) </span> </p> <table> <colgroup span="1" style=""> <colgroup span="2" style="background-color:#ddd"> <colgroup span="8" style=""> <colgroup span="2" style="background-color:#ddd"> <colgroup span="10" style=""> <colgroup span="1" style="background-color:#ddd"> <colg... |
tidy_html_src = bs4.BeautifulSoup(html_src).prettify() html.write(tidy_html_src) |
def dict_tovot(tabdata, tabname='votable.xml', phot=False, binary=True): """ Converts dictionary table **tabdata** to a VOTable with name **tabname** Parameters ---------- tabdata: list SQL query dictionary list from running query_dict.execute() tabname: str The name of the VOTable to be created phot: bool Parameter sp... |
of columns if phot: tabdata = photparse(tabdata) colnames = tabdata[0].keys() for i in range(len(tabdata)): tmpcol = tabdata[i].keys() for elem in tmpcol: if elem not in colnames: colnames.append(elem) # No need for band column any more try: colnames.remove('band') except ValueError: pass # Run through all the columns ... |
def photaddline(tab, sourceid): """ Loop through the dictionary list **tab** creating a line for the source specified in **sourceid** Parameters ---------- tab: Dictionary list of all the photometry data sourceid: ID of source in the photometry table (source_id) Returns ------- tmpdict: dict Dictionary with all the dat... |
def photparse(tab): """ Parse through a photometry table to group by source_id Parameters ---------- tab: list SQL query dictionary list from running query_dict.execute() Returns ------- newtab: list Dictionary list after parsing to group together sources """ # Check that source_id column is present if 'source_id' not ... |
def table_add(tab, data, col): """ Function to parse dictionary list **data** and add the data to table **tab** for column **col** Parameters ---------- tab: Table class Table to store values data: list Dictionary list from the SQL query col: str Column name (ie, dictionary key) for the column to add """ x = [] for i i... |
def user_order_by(self, field): """ Queryset method ordering objects by user ordering field. """ # Get ordering model. model_label = order.utils.resolve_labels('.'.join(\ [self.model._meta.app_label, self.model._meta.object_name])) orderitem_set = getattr(self.model, \ order.utils.resolve_order_item_related_set_name(mo... |
def list_enabled_features_accounts(self, account_id): """ List enabled features. List all features that are enabled on a given Account, Course, or User. Only the feature names are returned. """ path = {} data = {} params = {} # REQUIRED - PATH - account_id """ID""" path["account_id"] = account_id self.logger.debug("GET... |
def set_feature_flag_courses(self, feature, course_id, state=None): """ Set feature flag. Set a feature flag for a given Account, Course, or User. This call will fail if a parent account sets a feature flag for the same feature in any state other than "allowed". """ path = {} data = {} params = {} # REQUIRED - PATH - c... |
the user, course, or account and sub-accounts.""" if state is not None: self._validate_enum(state, ["off", "allowed", "on"]) data["state"] = state self.logger.debug("PUT /api/v1/courses/{course_id}/features/flags/{feature} with query params: {params} and form data: {data}".format(params=params, data=data, **path)) retu... |
def set_feature_flag_accounts(self, feature, account_id, state=None): """ Set feature flag. Set a feature flag for a given Account, Course, or User. This call will fail if a parent account sets a feature flag for the same feature in any state other than "allowed". """ path = {} data = {} params = {} # REQUIRED - PATH -... |
the user, course, or account and sub-accounts.""" if state is not None: self._validate_enum(state, ["off", "allowed", "on"]) data["state"] = state self.logger.debug("PUT /api/v1/accounts/{account_id}/features/flags/{feature} with query params: {params} and form data: {data}".format(params=params, data=data, **path)) re... |
def set_feature_flag_users(self, user_id, feature, state=None): """ Set feature flag. Set a feature flag for a given Account, Course, or User. This call will fail if a parent account sets a feature flag for the same feature in any state other than "allowed". """ path = {} data = {} params = {} # REQUIRED - PATH - user_... |
the user, course, or account and sub-accounts.""" if state is not None: self._validate_enum(state, ["off", "allowed", "on"]) data["state"] = state self.logger.debug("PUT /api/v1/users/{user_id}/features/flags/{feature} with query params: {params} and form data: {data}".format(params=params, data=data, **path)) return s... |
def remove_feature_flag_courses(self, feature, course_id): """ Remove feature flag. Remove feature flag for a given Account, Course, or User. (Note that the flag must be defined on the Account, Course, or User directly.) The object will then inherit the feature flags from a higher account, if any exist. If this flag wa... |
def remove_feature_flag_accounts(self, feature, account_id): """ Remove feature flag. Remove feature flag for a given Account, Course, or User. (Note that the flag must be defined on the Account, Course, or User directly.) The object will then inherit the feature flags from a higher account, if any exist. If this flag ... |
def remove_feature_flag_users(self, user_id, feature): """ Remove feature flag. Remove feature flag for a given Account, Course, or User. (Note that the flag must be defined on the Account, Course, or User directly.) The object will then inherit the feature flags from a higher account, if any exist. If this flag was 'o... |
def plot_accuracy(data, output_dir_path='.', output_filename='accuracy.png', width=10, height=8): """Plot accuracy. Args: data: Panda dataframe in *the* format. """ output_path = os.path.join(output_dir_path, output_filename) max_val_data = get_epoch_max_val_acc(data) max_val_label = round(max_val_data['acc'].values[0]... |
def plot(data, output_dir_path='.', width=10, height=8): """Create two plots: 1) loss 2) accuracy. Args: data: Panda dataframe in *the* format. """ if not isinstance(data, pd.DataFrame): data = pd.DataFrame(data) plot_accuracy(data, output_dir_path=output_dir_path, width=width, height=height) plot_loss(data, output_dir... |
def get_apps_menu(self): """Temporal code, will change to apps.get_app_configs() for django 1.7 Generate a initial menu list using the AppsConfig registered """ menu = {} for model, model_admin in self.admin_site._registry.items(): if hasattr(model_admin, 'app_config'): if model_admin.app_config.has_menu_permission(obj... |
def get_nav_menu(self): """Method to generate the menu""" _menu = self.get_site_menu() if _menu: site_menu = list(_menu) else: site_menu = [] had_urls = [] def get_url(menu, had_urls): if 'url' in menu: had_urls.append(menu['url']) if 'menus' in menu: for m in menu['menus']: get_url(m, had_urls) get_url({'menus': site_... |
if app_label.lower() in self.apps_label_title: app_title = self.apps_label_title[app_label.lower()] else: mods = model.__module__.split('.') if len(mods) > 1: mod = '.'.join(mods[0:-1]) if mod in sys.modules: mod = sys.modules[mod] if 'verbose_name' in dir(mod): app_title = getattr(mod, 'verbose_name') elif 'app_title'... |
def connect(self): """ connect """ _logger.debug("Start connecting to broker") while True: try: self.client.connect(self.broker_host, self.broker_port, self.broker_keepalive) break except Exception: _logger.debug( "Connect failed. wait %s sec" % self.connect_delay) sleep(self.connect_delay) self.client.loop_forever() |
def set_tunnel(self, tunnel_type, tunnel, callback=None): """ set_tunnel(self, tunnel_type, tunnel, callback=None): """ orig_tunnel = self.tunnels.get(tunnel_type, (None, None))[0] if orig_tunnel is not None: _logger.debug("Unsubscribe: %s", (orig_tunnel,)) self.client.unsubscribe(str(orig_tunnel)) self.tunnels[tunnel_... |
def set_tunnels(self, tunnels): """ set_tunnels(self, tunnels): """ for tunnel_type, (tunnel, callback) in tunnels.iteritems(): if tunnel is None: continue self.set_tunnel(tunnel_type, tunnel, callback) |
def publish(self, topic="/controller", qos=0, payload=None): """ publish(self, topic, payload=None, qos=0, retain=False) Returns a tuple (result, mid), where result is MQTT_ERR_SUCCESS to indicate success or MQTT_ERR_NO_CONN if the client is not currently connected. mid is the message ID for the publish request. The mi... |
def get_logger(verbosity): """ Returns simple console logger. """ logger = logging.getLogger(__name__) logger.setLevel({ 0: DEFAULT_LOGGING_LEVEL, 1: logging.INFO, 2: logging.DEBUG }.get(min(2, verbosity), DEFAULT_LOGGING_LEVEL)) logger.handlers = [] handler = logging.StreamHandler(sys.stdout) handler.setLevel(logging.... |
def get_outcome_results(self, course_id, include=None, outcome_ids=None, user_ids=None): """ Get outcome results. Gets the outcome results for users and outcomes in the specified context. """ path = {} data = {} params = {} # REQUIRED - PATH - course_id """ID""" path["course_id"] = course_id # OPTIONAL - user_ids """If... |
not linked to the context.""" if outcome_ids is not None: params["outcome_ids"] = outcome_ids # OPTIONAL - include """[String, "alignments"|"outcomes"|"outcomes.alignments"|"outcome_groups"|"outcome_links"|"outcome_paths"|"users"] Specify additional collections to be side loaded with the result. "alignments" includes o... |
def get_outcome_result_rollups(self, course_id, aggregate=None, include=None, outcome_ids=None, user_ids=None): """ Get outcome result rollups. Gets the outcome rollups for the users and outcomes in the specified context. """ path = {} data = {} params = {} # REQUIRED - PATH - course_id """ID""" path["course_id"] = cou... |
who is not a student in the context""" if user_ids is not None: params["user_ids"] = user_ids # OPTIONAL - outcome_ids """If specified, only the outcomes whose ids are given will be included in the results. it is an error to specify an id for an outcome which is not linked to the context.""" if outcome_ids is not None:... |
def execute(self, command): """Primary method to execute ipmitool commands :param command: ipmi command to execute, str or list e.g. > ipmi = ipmitool('consolename.prod', 'secretpass') > ipmi.execute('chassis status') > """ if isinstance(command, str): self.method(command.split()) elif isinstance(command, list): self.m... |
def _subprocess_method(self, command): """Use the subprocess module to execute ipmitool commands and and set status """ p = subprocess.Popen([self._ipmitool_path] + self.args + command, stdout=subprocess.PIPE, stderr=subprocess.PIPE) self.output, self.error = p.communicate() self.status = p.returncode |
def _expect_method(self, command): """Use the expect module to execute ipmitool commands and set status """ child = pexpect.spawn(self._ipmitool_path, self.args + command) i = child.expect([pexpect.TIMEOUT, 'Password: '], timeout=10) if i == 0: child.terminate() self.error = 'ipmitool command timed out' self.status = 1... |
def _get_ipmitool_path(self, cmd='ipmitool'): """Get full path to the ipmitool command using the unix `which` command """ p = subprocess.Popen(["which", cmd], stdout=subprocess.PIPE, stderr=subprocess.PIPE) out, err = p.communicate() return out.strip() |
def truncate(self, table): """Empty a table by deleting all of its rows.""" if isinstance(table, (list, set, tuple)): for t in table: self._truncate(t) else: self._truncate(table) |
def _truncate(self, table): """ Remove all records from a table in MySQL It performs the same function as a DELETE statement without a WHERE clause. """ statement = "TRUNCATE TABLE {0}".format(wrap(table)) self.execute(statement) self._printer('\tTruncated table {0}'.format(table)) |
def truncate_database(self, database=None): """Drop all tables in a database.""" # Change database if needed if database in self.databases and database is not self.database: self.change_db(database) # Get list of tables tables = self.tables if isinstance(self.tables, list) else [self.tables] if len(tables) > 0: self.dr... |
def drop(self, table): """ Drop a table from a database. Accepts either a string representing a table name or a list of strings representing a table names. """ existing_tables = self.tables if isinstance(table, (list, set, tuple)): for t in table: self._drop(t, existing_tables) else: self._drop(table, existing_tables) ... |
def _drop(self, table, existing_tables=None): """Private method for executing table drop commands.""" # Retrieve list of existing tables for comparison existing_tables = existing_tables if existing_tables else self.tables # Only drop table if it exists if table in existing_tables: # Set to avoid foreign key errorrs sel... |
def drop_empty_tables(self): """Drop all empty tables in a database.""" # Count number of rows in each table counts = self.count_rows_all() drops = [] # Loop through each table key and validate that rows count is not 0 for table, count in counts.items(): if count < 1: # Drop table if it contains no rows self.drop(table... |
def update(self, table, columns, values, where): """ Update the values of a particular row where a value is met. :param table: table name :param columns: column(s) to update :param values: updated values :param where: tuple, (where_column, where_value) """ # Unpack WHERE clause dictionary into tuple where_col, where_va... |
def update_many(self, table, columns, values, where_col, where_index): """ Update the values of several rows. :param table: Name of the MySQL table :param columns: List of columns :param values: 2D list of rows :param where_col: Column name for where clause :param where_index: Row index of value to be used for where co... |
def create_new_grading_standard_accounts(self, title, account_id, grading_scheme_entry_name, grading_scheme_entry_value): """ Create a new grading standard. Create a new grading standard If grading_scheme_entry arguments are omitted, then a default grading scheme will be set. The default scheme is as follows: "A" : 94,... |
= grading_scheme_entry_name # REQUIRED - grading_scheme_entry[value] """The value for the name of the entry within a GradingStandard. The entry represents the lower bound of the range for the entry. This range includes the value up to the next entry in the GradingStandard, or 100 if there is no upper bound. The lowest ... |
def create_new_grading_standard_courses(self, title, course_id, grading_scheme_entry_name, grading_scheme_entry_value): """ Create a new grading standard. Create a new grading standard If grading_scheme_entry arguments are omitted, then a default grading scheme will be set. The default scheme is as follows: "A" : 94, "... |
= grading_scheme_entry_name # REQUIRED - grading_scheme_entry[value] """The value for the name of the entry within a GradingStandard. The entry represents the lower bound of the range for the entry. This range includes the value up to the next entry in the GradingStandard, or 100 if there is no upper bound. The lowest ... |
def list_groups_available_in_context_accounts(self, account_id, include=None, only_own_groups=None): """ List the groups available in a context. Returns the list of active groups in the given context that are visible to user. """ path = {} data = {} params = {} # REQUIRED - PATH - account_id """ID""" path["account_id"]... |
def create_group_groups(self, description=None, is_public=None, join_level=None, name=None, storage_quota_mb=None): """ Create a group. Creates a new group. Groups created using the "/api/v1/groups/" endpoint will be community groups. """ path = {} data = {} params = {} # OPTIONAL - name """The name of the group""" if ... |
caller does not have the manage_storage_quotas permission.""" if storage_quota_mb is not None: data["storage_quota_mb"] = storage_quota_mb self.logger.debug("POST /api/v1/groups with query params: {params} and form data: {data}".format(params=params, data=data, **path)) return self.generic_request("POST", "/api/v1/grou... |
def edit_group(self, group_id, avatar_id=None, description=None, is_public=None, join_level=None, members=None, name=None, storage_quota_mb=None): """ Edit a group. Modifies an existing group. Note that to set an avatar image for the group, you must first upload the image file to the group, and the use the id in the re... |
(applies only to community groups). Currently you cannot set a group back to private once it has been made public.""" if is_public is not None: data["is_public"] = is_public # OPTIONAL - join_level """no description""" if join_level is not None: self._validate_enum(join_level, ["parent_context_auto_join", "parent_conte... |
like in the group. Users not in the group will be sent invitations. Existing group members who aren't in the list will be removed from the group.""" if members is not None: data["members"] = members self.logger.debug("PUT /api/v1/groups/{group_id} with query params: {params} and form data: {data}".format(params=params,... |
def invite_others_to_group(self, group_id, invitees): """ Invite others to a group. Sends an invitation to all supplied email addresses which will allow the receivers to join the group. """ path = {} data = {} params = {} # REQUIRED - PATH - group_id """ID""" path["group_id"] = group_id # REQUIRED - invitees """An arra... |
def list_group_s_users(self, group_id, include=None, search_term=None): """ List group's users. Returns a list of users in the group. """ path = {} data = {} params = {} # REQUIRED - PATH - group_id """ID""" path["group_id"] = group_id # OPTIONAL - search_term """The partial name or full ID of the users to match and re... |
def preview_processed_html(self, group_id, html=None): """ Preview processed html. Preview html content processed for this group """ path = {} data = {} params = {} # REQUIRED - PATH - group_id """ID""" path["group_id"] = group_id # OPTIONAL - html """The html content to process""" if html is not None: data["html"] = h... |
def list_group_memberships(self, group_id, filter_states=None): """ List group memberships. List the members of a group. """ path = {} data = {} params = {} # REQUIRED - PATH - group_id """ID""" path["group_id"] = group_id # OPTIONAL - filter_states """Only list memberships with the given workflow_states. By default it... |
def get_single_group_membership_memberships(self, group_id, membership_id): """ Get a single group membership. Returns the group membership with the given membership id or user id. """ path = {} data = {} params = {} # REQUIRED - PATH - group_id """ID""" path["group_id"] = group_id # REQUIRED - PATH - membership_id """... |
def get_single_group_membership_users(self, user_id, group_id): """ Get a single group membership. Returns the group membership with the given membership id or user id. """ path = {} data = {} params = {} # REQUIRED - PATH - group_id """ID""" path["group_id"] = group_id # REQUIRED - PATH - user_id """ID""" path["user_i... |
def update_membership_memberships(self, group_id, membership_id, moderator=None, workflow_state=None): """ Update a membership. Accept a membership request, or add/remove moderator rights. """ path = {} data = {} params = {} # REQUIRED - PATH - group_id """ID""" path["group_id"] = group_id # REQUIRED - PATH - membershi... |
def update_membership_users(self, user_id, group_id, moderator=None, workflow_state=None): """ Update a membership. Accept a membership request, or add/remove moderator rights. """ path = {} data = {} params = {} # REQUIRED - PATH - group_id """ID""" path["group_id"] = group_id # REQUIRED - PATH - user_id """ID""" path... |
def leave_group_memberships(self, group_id, membership_id): """ Leave a group. Leave a group if you are allowed to leave (some groups, such as sets of course groups created by teachers, cannot be left). You may also use 'self' in place of a membership_id. """ path = {} data = {} params = {} # REQUIRED - PATH - group_id... |
def leave_group_users(self, user_id, group_id): """ Leave a group. Leave a group if you are allowed to leave (some groups, such as sets of course groups created by teachers, cannot be left). You may also use 'self' in place of a membership_id. """ path = {} data = {} params = {} # REQUIRED - PATH - group_id """ID""" pa... |
def from_str(cls, string): """ Creates a clause from a given string. Parameters ---------- string: str A string of the form `a+!b` which translates to `a AND NOT b`. Returns ------- caspo.core.clause.Clause Created object instance """ return cls([Literal.from_str(lit) for lit in string.split('+')]) |
def bool(self, state): """ Returns the Boolean evaluation of the clause with respect to a given state Parameters ---------- state : dict Key-value mapping describing a Boolean state or assignment Returns ------- boolean The evaluation of the clause with respect to the given state or assignment """ value = 1 for source,... |
def compare_dbs(self, db_x, db_y, show=True): """Compare the tables and row counts of two databases.""" # TODO: Improve method self._printer("\tComparing database's {0} and {1}".format(db_x, db_y)) # Run compare_dbs_getter to get row counts x = self._compare_dbs_getter(db_x) y = self._compare_dbs_getter(db_y) x_tbl_cou... |
> 0: self._printer('Unique keys from {0} ({1} of {2}):'.format(db_y, len(uniques_y), y_tbl_count)) self._printer('------------------------------') for k, v in sorted(uniques_y): self._printer('{0:25} {1}'.format(k, v)) self._printer('\n') if len(uniques_y) == 0 and len(uniques_y) == 0: self._printer("Databases's {0} an... |
def _compare_dbs_getter(self, db): """Retrieve a dictionary of table_name, row count key value pairs for a DB.""" # Change DB connection if needed if self.database != db: self.change_db(db) return self.count_rows_all() |
def compare_schemas(self, db_x, db_y, show=True): """ Compare the structures of two databases. Analysis's and compares the column definitions of each table in both databases's. Identifies differences in column names, data types and keys. """ # TODO: Improve method self._printer("\tComparing database schema's {0} and {1... |
len(uniques_x), x_count)) self._printer('------------------------------') # print(uniques) for k, v in sorted(uniques_x): self._printer('{0:25} {1}'.format(k, v)) self._printer('\n') uniques_y = diff(x, y, y_only=True) if len(uniques_y) > 0: self._printer('Unique keys from {0} ({1} of {2}):'.format(db_y, len(uniques_y)... |
def _schema_getter(self, db): """Retrieve a dictionary representing a database's data schema.""" # Change DB connection if needed if self.database != db: self.change_db(db) schema_dict = {tbl: self.get_schema(tbl) for tbl in self.tables} schema_lst = [] for table, schema in schema_dict.items(): for col in schema: col.i... |
def put_cache_results(self, key, func_akw, set_cache_cb): """Put function results into cache.""" args, kwargs = func_akw # get function results func_results = self.func(*args, **kwargs) # optionally add results to cache if set_cache_cb(func_results): self[key] = func_results return func_results |
def service_param_string(params): """Takes a param section from a metadata class and returns a param string for the service method""" p = [] k = [] for param in params: name = fix_param_name(param['name']) if 'required' in param and param['required'] is True: p.append(name) else: if 'default' in param: k.append('{name}... |
def build_metadata_class(specfile): """Generate a metadata class for the specified specfile.""" with open(specfile) as f: spec = json.load(f) name = os.path.basename(specfile).split('.')[0] spec['name'] = name env = get_jinja_env() metadata_template = env.get_template('metadata.py.jinja2') with open('pycanvas/meta/{}.p... |
def build_model_classes(metadata): """Generate a model class for any models contained in the specified spec file.""" i = importlib.import_module(metadata) env = get_jinja_env() model_template = env.get_template('model.py.jinja2') for model in i.models: with open(model_path(model.name.lower()), 'w') as t: t.write(model_... |
def build_service_class(metadata): """Generate a service class for the service contained in the specified metadata class.""" i = importlib.import_module(metadata) service = i.service env = get_jinja_env() service_template = env.get_template('service.py.jinja2') with open(api_path(service.name.lower()), 'w') as t: t.wri... |
def start_report(self, report, account_id, _parameters=None): """ Start a Report. Generates a report instance for the account. """ path = {} data = {} params = {} # REQUIRED - PATH - account_id """ID""" path["account_id"] = account_id # REQUIRED - PATH - report """ID""" path["report"] = report # OPTIONAL - [parameters]... |
def index_of_reports(self, report, account_id): """ Index of Reports. Shows all reports that have been run for the account of a specific type. """ path = {} data = {} params = {} # REQUIRED - PATH - account_id """ID""" path["account_id"] = account_id # REQUIRED - PATH - report """ID""" path["report"] = report self.logg... |
def clean_query(self): """ Removes any `None` value from an elasticsearch query. """ if self.query: for key, value in self.query.items(): if isinstance(value, list) and None in value: self.query[key] = [v for v in value if v is not None] |
def get_recirc_content(self, published=True, count=3): """gets the first 3 content objects in the `included_ids` """ query = self.get_query() # check if query has included_ids & if there are any ids in it, # in case the ids have been removed from the array if not query.get('included_ids'): qs = Content.search_objects.s... |
def get_full_recirc_content(self, published=True): """performs es search and gets all content objects """ q = self.get_query() search = custom_search_model(Content, q, published=published, field_map={ "feature_type": "feature_type.slug", "tag": "tags.slug", "content-type": "_type" }) return search |
def has_pinned_content(self): """determines if the there is a pinned object in the search """ q = self.get_query() if "pinned_ids" in q: return bool(len(q.get("pinned_ids", []))) return False |
def run_later(self, callable_, timeout, *args, **kwargs): """Schedules the specified callable for delayed execution. Returns a TimerTask instance that can be used to cancel pending execution. """ self.lock.acquire() try: if self.die: raise RuntimeError('This timer has been shut down and ' 'does not accept new jobs.') j... |
def show_front_page_groups(self, group_id): """ Show front page. Retrieve the content of the front page """ path = {} data = {} params = {} # REQUIRED - PATH - group_id """ID""" path["group_id"] = group_id self.logger.debug("GET /api/v1/groups/{group_id}/front_page with query params: {params} and form data: {data}".for... |
def update_create_front_page_courses(self, course_id, wiki_page_body=None, wiki_page_editing_roles=None, wiki_page_notify_of_update=None, wiki_page_published=None, wiki_page_title=None): """ Update/create front page. Update the title or contents of the front page """ path = {} data = {} params = {} # REQUIRED - PATH - ... |
editing by students in the course. "members":: For group wikis, allows editing by members of the group. "public":: Allows editing by any user.""" if wiki_page_editing_roles is not None: self._validate_enum(wiki_page_editing_roles, ["teachers", "students", "members", "public"]) data["wiki_page[editing_roles]"] = wiki_pa... |
def list_pages_courses(self, course_id, order=None, published=None, search_term=None, sort=None): """ List pages. List the wiki pages associated with a course or group """ path = {} data = {} params = {} # REQUIRED - PATH - course_id """ID""" path["course_id"] = course_id # OPTIONAL - sort """Sort results by this field... |
if published is not None: params["published"] = published self.logger.debug("GET /api/v1/courses/{course_id}/pages with query params: {params} and form data: {data}".format(params=params, data=data, **path)) return self.generic_request("GET", "/api/v1/courses/{course_id}/pages".format(**path), data=data, params=params,... |
def list_pages_groups(self, group_id, order=None, published=None, search_term=None, sort=None): """ List pages. List the wiki pages associated with a course or group """ path = {} data = {} params = {} # REQUIRED - PATH - group_id """ID""" path["group_id"] = group_id # OPTIONAL - sort """Sort results by this field.""" ... |
if published is not None: params["published"] = published self.logger.debug("GET /api/v1/groups/{group_id}/pages with query params: {params} and form data: {data}".format(params=params, data=data, **path)) return self.generic_request("GET", "/api/v1/groups/{group_id}/pages".format(**path), data=data, params=params, all... |
def show_page_courses(self, url, course_id): """ Show page. Retrieve the content of a wiki page """ path = {} data = {} params = {} # REQUIRED - PATH - course_id """ID""" path["course_id"] = course_id # REQUIRED - PATH - url """ID""" path["url"] = url self.logger.debug("GET /api/v1/courses/{course_id}/pages/{url} with ... |
def show_page_groups(self, url, group_id): """ Show page. Retrieve the content of a wiki page """ path = {} data = {} params = {} # REQUIRED - PATH - group_id """ID""" path["group_id"] = group_id # REQUIRED - PATH - url """ID""" path["url"] = url self.logger.debug("GET /api/v1/groups/{group_id}/pages/{url} with query p... |
def list_revisions_courses(self, url, course_id): """ List revisions. List the revisions of a page. Callers must have update rights on the page in order to see page history. """ path = {} data = {} params = {} # REQUIRED - PATH - course_id """ID""" path["course_id"] = course_id # REQUIRED - PATH - url """ID""" path["ur... |
def list_revisions_groups(self, url, group_id): """ List revisions. List the revisions of a page. Callers must have update rights on the page in order to see page history. """ path = {} data = {} params = {} # REQUIRED - PATH - group_id """ID""" path["group_id"] = group_id # REQUIRED - PATH - url """ID""" path["url"] =... |
def to_representation(self, value): """Convert to natural key.""" content_type = ContentType.objects.get_for_id(value) return "_".join(content_type.natural_key()) |
def to_internal_value(self, value): """Convert to integer id.""" natural_key = value.split("_") content_type = ContentType.objects.get_by_natural_key(*natural_key) return content_type.id |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.