function
stringlengths
11
56k
repo_name
stringlengths
5
60
features
list
def get(self): pass
nlake44/UserInfuser
[ 101, 54, 101, 3, 1311320106 ]
def fill_with_api_logs(self, acc): today = datetime.datetime.now() rand = random.randint(1, 100) batch = APICountBatch(date=today, account_key=acc.key().name(), counter=rand) batch.put() for ii in range(0, 10): rand = random.randint(1, 100) + 10*ii delta = datetime.timedelta(days=ii) ...
nlake44/UserInfuser
[ 101, 54, 101, 3, 1311320106 ]
def get(self): created_logs = "" for ii in constants.TEST_ACCOUNTS: acc = accounts_dao.get(ii) if acc: self.fill_with_api_logs(acc) created_logs = acc.key().name() if created_logs: self.response.out.write("Created logs for test account " + created_logs) else: sel...
nlake44/UserInfuser
[ 101, 54, 101, 3, 1311320106 ]
def fill_with_api_logs(self, acc): today = datetime.datetime.now() rand = random.randint(1, 100) batch = BadgePointsBatch(date=today, badgeid="badge1", account_key=acc.key().name(), counter=rand) batch.put() for ii in range(0, 10): rand = random.randint(1, 100) + 10*ii delta = datetime....
nlake44/UserInfuser
[ 101, 54, 101, 3, 1311320106 ]
def get(self): created_logs = "" for ii in constants.TEST_ACCOUNTS: acc = accounts_dao.get(ii) if acc: self.fill_with_api_logs(acc) created_logs = acc.key().name() if created_logs: self.response.out.write("Created logs for test account " + created_logs) else: sel...
nlake44/UserInfuser
[ 101, 54, 101, 3, 1311320106 ]
def fill_with_api_logs(self, acc): today = datetime.datetime.now() rand = random.randint(1, 100) batch = BadgeBatch(date=today, badgeid="badge1", account_key=acc.key().name(), counter=rand) batch.put() for ii in range(0, 10): rand = random.randint(1, 100) + 10*ii delta = datetime.timede...
nlake44/UserInfuser
[ 101, 54, 101, 3, 1311320106 ]
def get(self): created_logs = "" for ii in constants.TEST_ACCOUNTS: acc = accounts_dao.get(ii) if acc: self.fill_with_api_logs(acc) created_logs = acc.key().name() if created_logs: self.response.out.write("Created logs for test account " + created_logs) else: sel...
nlake44/UserInfuser
[ 101, 54, 101, 3, 1311320106 ]
def _test_config(self): return TestConfig()
scylladb/scylla-cluster-tests
[ 45, 61, 45, 414, 1451430222 ]
def db_cluster(self): return DBCluster( params=self._params, common_tags=self._test_config.common_tags(), test_id=self._test_config.test_id(), )
scylladb/scylla-cluster-tests
[ 45, 61, 45, 414, 1451430222 ]
def loader_cluster(self): return LoaderCluster( params=self._params, common_tags=self._test_config.common_tags(), test_id=self._test_config.test_id(), )
scylladb/scylla-cluster-tests
[ 45, 61, 45, 414, 1451430222 ]
def monitoring_cluster(self): return MonitoringCluster( params=self._params, common_tags=self._test_config.common_tags(), test_id=self._test_config.test_id(), )
scylladb/scylla-cluster-tests
[ 45, 61, 45, 414, 1451430222 ]
def anonymous_id_for_user(user, course_id, save=True): """ Return a unique id for a (user, course) pair, suitable for inserting into e.g. personalized survey links. If user is an `AnonymousUser`, returns `None` Keyword arguments: save -- Whether the id should be saved in an AnonymousUserId obj...
shubhdev/openedx
[ 2, 2, 2, 1, 1437064811 ]
def has_profile_image(self): """ Convenience method that returns a boolean indicating whether or not this user has uploaded a profile image. """ return self.profile_image_uploaded_at is not None
shubhdev/openedx
[ 2, 2, 2, 1, 1437064811 ]
def set_meta(self, meta_json): # pylint: disable=missing-docstring self.meta = json.dumps(meta_json)
shubhdev/openedx
[ 2, 2, 2, 1, 1437064811 ]
def requires_parental_consent(self, date=None, age_limit=None, default_requires_consent=True): """Returns true if this user requires parental consent. Args: date (Date): The date for which consent needs to be tested (defaults to now). age_limit (int): The age limit at which pare...
shubhdev/openedx
[ 2, 2, 2, 1, 1437064811 ]
def user_profile_pre_save_callback(sender, **kwargs): """ Ensure consistency of a user profile before saving it. """ user_profile = kwargs['instance'] # Remove profile images for users who require parental consent if user_profile.requires_parental_consent() and user_profile.has_profile_image: ...
shubhdev/openedx
[ 2, 2, 2, 1, 1437064811 ]
def user_profile_post_save_callback(sender, **kwargs): """ Emit analytics events after saving the UserProfile. """ user_profile = kwargs['instance'] # pylint: disable=protected-access emit_field_changed_events( user_profile, user_profile.user, sender._meta.db_table, ...
shubhdev/openedx
[ 2, 2, 2, 1, 1437064811 ]
def user_pre_save_callback(sender, **kwargs): """ Capture old fields on the user instance before save and cache them as a private field on the current model for use in the post_save callback. """ user = kwargs['instance'] user._changed_fields = get_changed_fields_dict(user, sender)
shubhdev/openedx
[ 2, 2, 2, 1, 1437064811 ]
def user_post_save_callback(sender, **kwargs): """ Emit analytics events after saving the User. """ user = kwargs['instance'] # pylint: disable=protected-access emit_field_changed_events( user, user, sender._meta.db_table, excluded_fields=['last_login', 'first_nam...
shubhdev/openedx
[ 2, 2, 2, 1, 1437064811 ]
def unique_id_for_user(user, save=True): """ Return a unique id for a user, suitable for inserting into e.g. personalized survey links. Keyword arguments: save -- Whether the id should be saved in an AnonymousUserId object. """ # Setting course_id to '' makes it not affect the generated has...
shubhdev/openedx
[ 2, 2, 2, 1, 1437064811 ]
def register(self, user): # MINOR TODO: Switch to crypto-secure key self.activation_key = uuid.uuid4().hex self.user = user self.save()
shubhdev/openedx
[ 2, 2, 2, 1, 1437064811 ]
def request_change(self, email): """Request a change to a user's email. Implicitly saves the pending email change record. Arguments: email (unicode): The proposed new email for the user. Returns: unicode: The activation code to confirm the change. """ ...
shubhdev/openedx
[ 2, 2, 2, 1, 1437064811 ]
def create(self, user): """ This will copy over the current password, if any of the configuration has been turned on """ if not (PasswordHistory.is_student_password_reuse_restricted() or PasswordHistory.is_staff_password_reuse_restricted() or PasswordHist...
shubhdev/openedx
[ 2, 2, 2, 1, 1437064811 ]
def is_student_password_reuse_restricted(cls): """ Returns whether the configuration which limits password reuse has been turned on """ if not settings.FEATURES['ADVANCED_SECURITY']: return False min_diff_pw = settings.ADVANCED_SECURITY_CONFIG.get( 'MIN_DI...
shubhdev/openedx
[ 2, 2, 2, 1, 1437064811 ]
def is_staff_password_reuse_restricted(cls): """ Returns whether the configuration which limits password reuse has been turned on """ if not settings.FEATURES['ADVANCED_SECURITY']: return False min_diff_pw = settings.ADVANCED_SECURITY_CONFIG.get( 'MIN_DIFF...
shubhdev/openedx
[ 2, 2, 2, 1, 1437064811 ]
def is_password_reset_frequency_restricted(cls): """ Returns whether the configuration which limits the password reset frequency has been turned on """ if not settings.FEATURES['ADVANCED_SECURITY']: return False min_days_between_reset = settings.ADVANCED_SECURITY_CONF...
shubhdev/openedx
[ 2, 2, 2, 1, 1437064811 ]
def is_staff_forced_password_reset_enabled(cls): """ Returns whether the configuration which forces password resets to occur has been turned on """ if not settings.FEATURES['ADVANCED_SECURITY']: return False min_days_between_reset = settings.ADVANCED_SECURITY_CONFIG.g...
shubhdev/openedx
[ 2, 2, 2, 1, 1437064811 ]
def is_student_forced_password_reset_enabled(cls): """ Returns whether the configuration which forces password resets to occur has been turned on """ if not settings.FEATURES['ADVANCED_SECURITY']: return False min_days_pw_reset = settings.ADVANCED_SECURITY_CONFIG.get(...
shubhdev/openedx
[ 2, 2, 2, 1, 1437064811 ]
def should_user_reset_password_now(cls, user): """ Returns whether a password has 'expired' and should be reset. Note there are two different expiry policies for staff and students """ if not settings.FEATURES['ADVANCED_SECURITY']: return False days_before_pa...
shubhdev/openedx
[ 2, 2, 2, 1, 1437064811 ]
def is_password_reset_too_soon(cls, user): """ Verifies that the password is not getting reset too frequently """ if not cls.is_password_reset_frequency_restricted(): return False history = PasswordHistory.objects.filter(user=user).order_by('-time_set') if n...
shubhdev/openedx
[ 2, 2, 2, 1, 1437064811 ]
def is_allowable_password_reuse(cls, user, new_password): """ Verifies that the password adheres to the reuse policies """ if not settings.FEATURES['ADVANCED_SECURITY']: return True if user.is_staff and cls.is_staff_password_reuse_restricted(): min_diff_p...
shubhdev/openedx
[ 2, 2, 2, 1, 1437064811 ]
def is_feature_enabled(cls): """ Returns whether the feature flag around this functionality has been set """ return settings.FEATURES['ENABLE_MAX_FAILED_LOGIN_ATTEMPTS']
shubhdev/openedx
[ 2, 2, 2, 1, 1437064811 ]
def is_user_locked_out(cls, user): """ Static method to return in a given user has his/her account locked out """ try: record = LoginFailures.objects.get(user=user) if not record.lockout_until: return False now = datetime.now(UTC) ...
shubhdev/openedx
[ 2, 2, 2, 1, 1437064811 ]
def increment_lockout_counter(cls, user): """ Ticks the failed attempt counter """ record, _ = LoginFailures.objects.get_or_create(user=user) record.failure_count = record.failure_count + 1 max_failures_allowed = settings.MAX_FAILED_LOGIN_ATTEMPTS_ALLOWED # did w...
shubhdev/openedx
[ 2, 2, 2, 1, 1437064811 ]
def clear_lockout_counter(cls, user): """ Removes the lockout counters (normally called after a successful login) """ try: entry = LoginFailures.objects.get(user=user) entry.delete() except ObjectDoesNotExist: return
shubhdev/openedx
[ 2, 2, 2, 1, 1437064811 ]
def num_enrolled_in(self, course_id): """ Returns the count of active enrollments in a course. 'course_id' is the course_id to return enrollments """ enrollment_number = super(CourseEnrollmentManager, self).get_query_set().filter( course_id=course_id, is...
shubhdev/openedx
[ 2, 2, 2, 1, 1437064811 ]
def users_enrolled_in(self, course_id): """Return a queryset of User for every user enrolled in the course.""" return User.objects.filter( courseenrollment__course_id=course_id, courseenrollment__is_active=True )
shubhdev/openedx
[ 2, 2, 2, 1, 1437064811 ]
def enrolled_and_dropped_out_users(self, course_id): """Return a queryset of Users in the course.""" return User.objects.filter( courseenrollment__course_id=course_id )
shubhdev/openedx
[ 2, 2, 2, 1, 1437064811 ]
def __unicode__(self): return ( "[CourseEnrollment] {}: {} ({}); active: ({})" ).format(self.user, self.course_id, self.created, self.is_active)
shubhdev/openedx
[ 2, 2, 2, 1, 1437064811 ]
def get_or_create_enrollment(cls, user, course_key): """ Create an enrollment for a user in a class. By default *this enrollment is not active*. This is useful for when an enrollment needs to go through some sort of approval process before being activated. If you don't need this ...
shubhdev/openedx
[ 2, 2, 2, 1, 1437064811 ]
def get_enrollment(cls, user, course_key): """Returns a CoursewareEnrollment object. Args: user (User): The user associated with the enrollment. course_id (CourseKey): The key of the course associated with the enrollment. Returns: Course enrollment object or...
shubhdev/openedx
[ 2, 2, 2, 1, 1437064811 ]
def is_enrollment_closed(cls, user, course): """ Returns a boolean value regarding whether the user has access to enroll in the course. Returns False if the enrollment has been closed. """ # Disable the pylint error here, as per ormsbee. This local import was previously #...
shubhdev/openedx
[ 2, 2, 2, 1, 1437064811 ]
def emit_event(self, event_name): """ Emits an event to explicitly track course enrollment and unenrollment. """ try: context = contexts.course_context_from_course_id(self.course_id) assert(isinstance(self.course_id, CourseKey)) data = { ...
shubhdev/openedx
[ 2, 2, 2, 1, 1437064811 ]
def enroll(cls, user, course_key, mode="honor", check_access=False): """ Enroll a user in a course. This saves immediately. Returns a CoursewareEnrollment object. `user` is a Django User object. If it hasn't been saved yet (no `.id` attribute), this method will automatic...
shubhdev/openedx
[ 2, 2, 2, 1, 1437064811 ]
def enroll_by_email(cls, email, course_id, mode="honor", ignore_errors=True): """ Enroll a user in a course given their email. This saves immediately. Note that enrolling by email is generally done in big batches and the error rate is high. For that reason, we supress User lookup error...
shubhdev/openedx
[ 2, 2, 2, 1, 1437064811 ]
def unenroll(cls, user, course_id, skip_refund=False): """ Remove the user from a given course. If the relevant `CourseEnrollment` object doesn't exist, we log an error but don't throw an exception. `user` is a Django User object. If it hasn't been saved yet (no `.id` att...
shubhdev/openedx
[ 2, 2, 2, 1, 1437064811 ]
def unenroll_by_email(cls, email, course_id): """ Unenroll a user from a course given their email. This saves immediately. User lookup errors are logged but will not throw an exception. `email` Email address of the User to unenroll from the course. `course_id` is our usual cour...
shubhdev/openedx
[ 2, 2, 2, 1, 1437064811 ]
def is_enrolled(cls, user, course_key): """ Returns True if the user is enrolled in the course (the entry must exist and it must have `is_active=True`). Otherwise, returns False. `user` is a Django User object. If it hasn't been saved yet (no `.id` attribute), this method...
shubhdev/openedx
[ 2, 2, 2, 1, 1437064811 ]
def is_enrolled_by_partial(cls, user, course_id_partial): """ Returns `True` if the user is enrolled in a course that starts with `course_id_partial`. Otherwise, returns False. Can be used to determine whether a student is enrolled in a course whose run name is unknown. ...
shubhdev/openedx
[ 2, 2, 2, 1, 1437064811 ]
def enrollment_mode_for_user(cls, user, course_id): """ Returns the enrollment mode for the given user for the given course `user` is a Django User object `course_id` is our usual course_id string (e.g. "edX/Test101/2013_Fall) Returns (mode, is_active) where mode is the enrollm...
shubhdev/openedx
[ 2, 2, 2, 1, 1437064811 ]
def enrollments_for_user(cls, user): return CourseEnrollment.objects.filter(user=user, is_active=1)
shubhdev/openedx
[ 2, 2, 2, 1, 1437064811 ]
def activate(self): """Makes this `CourseEnrollment` record active. Saves immediately.""" self.update_enrollment(is_active=True)
shubhdev/openedx
[ 2, 2, 2, 1, 1437064811 ]
def change_mode(self, mode): """Changes this `CourseEnrollment` record's mode to `mode`. Saves immediately.""" self.update_enrollment(mode=mode)
shubhdev/openedx
[ 2, 2, 2, 1, 1437064811 ]
def username(self): return self.user.username
shubhdev/openedx
[ 2, 2, 2, 1, 1437064811 ]
def course(self): return modulestore().get_course(self.course_id)
shubhdev/openedx
[ 2, 2, 2, 1, 1437064811 ]
def create_manual_enrollment_audit(cls, user, email, state_transition, reason, enrollment=None): """ saves the student manual enrollment information """ cls.objects.create( enrolled_by=user, enrolled_email=email, state_transition=state_transition, ...
shubhdev/openedx
[ 2, 2, 2, 1, 1437064811 ]
def get_manual_enrollment_by_email(cls, email): """ if matches returns the most recent entry in the table filtered by email else returns None. """ try: manual_enrollment = cls.objects.filter(enrolled_email=email).latest('time_stamp') except cls.DoesNotExist: ...
shubhdev/openedx
[ 2, 2, 2, 1, 1437064811 ]
def get_manual_enrollment(cls, enrollment): """ if matches returns the most recent entry in the table filtered by enrollment else returns None, """ try: manual_enrollment = cls.objects.filter(enrollment=enrollment).latest('time_stamp') except cls.DoesNotExist: ...
shubhdev/openedx
[ 2, 2, 2, 1, 1437064811 ]
def __unicode__(self): return "[CourseEnrollmentAllowed] %s: %s (%s)" % (self.email, self.course_id, self.created)
shubhdev/openedx
[ 2, 2, 2, 1, 1437064811 ]
def may_enroll_and_unenrolled(cls, course_id): """ Return QuerySet of students who are allowed to enroll in a course. Result excludes students who have already enrolled in the course. `course_id` identifies the course for which to compute the QuerySet. """ enrol...
shubhdev/openedx
[ 2, 2, 2, 1, 1437064811 ]
def _key(self): """ convenience function to make eq overrides easier and clearer. arbitrary decision that role is primary, followed by org, course, and then user """ return (self.role, self.org, self.course_id, self.user_id)
shubhdev/openedx
[ 2, 2, 2, 1, 1437064811 ]
def __hash__(self): return hash(self._key)
shubhdev/openedx
[ 2, 2, 2, 1, 1437064811 ]
def __unicode__(self): return "[CourseAccessRole] user: {} role: {} org: {} course: {}".format(self.user.username, self.role, self.org, self.course_id)
shubhdev/openedx
[ 2, 2, 2, 1, 1437064811 ]
def get_user_by_username_or_email(username_or_email): """ Return a User object, looking up by email if username_or_email contains a '@', otherwise by username. Raises: User.DoesNotExist is lookup fails. """ if '@' in username_or_email: return User.objects.get(email=username_or_e...
shubhdev/openedx
[ 2, 2, 2, 1, 1437064811 ]
def user_info(email): user, u_prof = get_user(email) print "User id", user.id print "Username", user.username print "E-mail", user.email print "Name", u_prof.name print "Location", u_prof.location print "Language", u_prof.language return user, u_prof
shubhdev/openedx
[ 2, 2, 2, 1, 1437064811 ]
def change_name(email, new_name): _user, u_prof = get_user(email) u_prof.name = new_name u_prof.save()
shubhdev/openedx
[ 2, 2, 2, 1, 1437064811 ]
def active_user_count(): return User.objects.filter(is_active=True).count()
shubhdev/openedx
[ 2, 2, 2, 1, 1437064811 ]
def add_user_to_group(user, group): utg = UserTestGroup.objects.get(name=group) utg.users.add(User.objects.get(username=user)) utg.save()
shubhdev/openedx
[ 2, 2, 2, 1, 1437064811 ]
def add_user_to_default_group(user, group): try: utg = UserTestGroup.objects.get(name=group) except UserTestGroup.DoesNotExist: utg = UserTestGroup() utg.name = group utg.description = DEFAULT_GROUPS[group] utg.save() utg.users.add(User.objects.get(username=user)) ...
shubhdev/openedx
[ 2, 2, 2, 1, 1437064811 ]
def log_successful_login(sender, request, user, **kwargs): # pylint: disable=unused-argument """Handler to log when logins have occurred successfully.""" if settings.FEATURES['SQUELCH_PII_IN_LOGS']: AUDIT_LOG.info(u"Login success - user.id: {0}".format(user.id)) else: AUDIT_LOG.info(u"Login...
shubhdev/openedx
[ 2, 2, 2, 1, 1437064811 ]
def log_successful_logout(sender, request, user, **kwargs): # pylint: disable=unused-argument """Handler to log when logouts have occurred successfully.""" if settings.FEATURES['SQUELCH_PII_IN_LOGS']: AUDIT_LOG.info(u"Logout - user.id: {0}".format(request.user.id)) else: AUDIT_LOG.info(u"Lo...
shubhdev/openedx
[ 2, 2, 2, 1, 1437064811 ]
def enforce_single_login(sender, request, user, signal, **kwargs): # pylint: disable=unused-argument """ Sets the current session id in the user profile, to prevent concurrent logins. """ if settings.FEATURES.get('PREVENT_CONCURRENT_LOGINS', False): if signal == user_logged_in: ...
shubhdev/openedx
[ 2, 2, 2, 1, 1437064811 ]
def recent_enrollment_seconds(self): return self.recent_enrollment_time_delta
shubhdev/openedx
[ 2, 2, 2, 1, 1437064811 ]
def add_to_profile_url(self, course_key, course_name, cert_mode, cert_url, source="o", target="dashboard"): """Construct the URL for the "add to profile" button. Arguments: course_key (CourseKey): The identifier for the course. course_name (unicode): The display name of the cour...
shubhdev/openedx
[ 2, 2, 2, 1, 1437064811 ]
def _tracking_code(self, course_key, cert_mode, target): """Create a tracking code for the button. Tracking codes are used by LinkedIn to collect analytics about certifications users are adding to their profiles. The tracking code format is: &trk=[partner name]-[cer...
shubhdev/openedx
[ 2, 2, 2, 1, 1437064811 ]
def __unicode__(self): return "[EntranceExamConfiguration] %s: %s (%s) = %s" % ( self.user, self.course_id, self.created, self.skip_entrance_exam )
shubhdev/openedx
[ 2, 2, 2, 1, 1437064811 ]
def user_can_skip_entrance_exam(cls, user, course_key): """ Return True if given user can skip entrance exam for given course otherwise False. """ can_skip = False if settings.FEATURES.get('ENTRANCE_EXAMS', False): try: record = EntranceExamConfigurati...
shubhdev/openedx
[ 2, 2, 2, 1, 1437064811 ]
def __init__(self, *args, **kwargs): """Creates a LanguageField. Accepts all the same kwargs as a CharField, except for max_length and choices. help_text defaults to a description of the ISO 639-1 set. """ kwargs.pop('max_length', None) kwargs.pop('choices', None) ...
shubhdev/openedx
[ 2, 2, 2, 1, 1437064811 ]
def __init__(self, filename, **kwargs): pgsz = kwargs.pop('pagesize', 'a4') if pgsz in PAGE_SIZES: pgsz = PAGE_SIZES[pgsz][1] else: pgsz = pagesizes.A4 orient = kwargs.pop('orientation', 'portrait') if orient in PAGE_ORIENTATIONS: pgsz = PAGE_ORIENTATIONS[orient][1](pgsz) kwargs['pagesize'] = pgsz ...
nikitos/npui
[ 2, 1, 2, 1, 1404365642 ]
def _add_custom_ss(ss, custom_cfg, name): pass
nikitos/npui
[ 2, 1, 2, 1, 1404365642 ]
def _get_pdfss(req): global _pdfss return _pdfss
nikitos/npui
[ 2, 1, 2, 1, 1404365642 ]
def fixture_update_dir(request): """Fixture that creates and tears down version.txt and log files""" def create_update_dir(version="0.0.1"): def teardown(): if os.path.isfile(Launcher.version_check_log): os.remove(Launcher.version_check_log) if os.path.isfile(Laun...
rlee287/pyautoupdate
[ 10, 3, 10, 10, 1456896357 ]
def given_tenant_id_is_registered_in_cloto(context): context.secondary_tenant_id = \ configuration_utils.config[PROPERTIES_CONFIG_FACTS_SERVICE][PROPERTIES_CONFIG_FACTS_SERVICE_OS_SECONDARY_TENANT_ID] print ("> Initiating Cloto REST Client for the secondary Tenant") context.secondary_cloto_client ...
telefonicaid/fiware-facts
[ 1, 5, 1, 4, 1398066258 ]
def a_context_update_is_received_for_secondary_tenant(context, server_id): send_context_notification_step_helper(context, context.secondary_tenant_id, server_id)
telefonicaid/fiware-facts
[ 1, 5, 1, 4, 1398066258 ]
def new_secondaty_consumer_looking_for_messages(context): # Init RabbitMQ consumer context.secondaty_rabbitmq_consumer = RabbitMQConsumer( amqp_host=configuration_utils.config[PROPERTIES_CONFIG_RABBITMQ_SERVICE][PROPERTIES_CONFIG_SERVICE_HOST], amqp_port=configuration_utils.config[PROPERTIES_CO...
telefonicaid/fiware-facts
[ 1, 5, 1, 4, 1398066258 ]
def following_messages_are_sent_to_secondary_consumer(context): for element in context.table.rows: expected_message = dict(element.as_dict()) expected_message = _dataset_utils.prepare_data(expected_message) assert_that(expected_message, is_message_in_consumer_list(context.secondaty_rabbitm...
telefonicaid/fiware-facts
[ 1, 5, 1, 4, 1398066258 ]
def no_messages_received_for_secondary_tenant(context): print ("> Received main list: " + str(context.secondaty_rabbitmq_consumer.message_list)) print ("> Received seconday list: " + str(context.rabbitmq_consumer.message_list)) assert_that(context.secondaty_rabbitmq_consumer.message_list, has_length(0), ...
telefonicaid/fiware-facts
[ 1, 5, 1, 4, 1398066258 ]
def notifications_are_received_by_secondary_consumer(context, number_of_notifications): assert_that(context.secondaty_rabbitmq_consumer.message_list, has_length(int(number_of_notifications)), "Secondary RabbitMQ consumer has NOT retrieved the expected number of messages from the bus")
telefonicaid/fiware-facts
[ 1, 5, 1, 4, 1398066258 ]
def __init__(self, file=None): self._file = file or sys.stdout self.prev_progress = 0 self.backwards_progress = False self.done = False self.last = 0
pyocd/pyOCD
[ 883, 424, 883, 228, 1382710205 ]
def _start(self): self.prev_progress = 0 self.backwards_progress = False self.done = False self.last = 0
pyocd/pyOCD
[ 883, 424, 883, 228, 1382710205 ]
def _finish(self): raise NotImplementedError()
pyocd/pyOCD
[ 883, 424, 883, 228, 1382710205 ]
def _update(self, progress): self._file.write('\r') i = int(progress * self.WIDTH) self._file.write("[%-50s] %3d%%" % ('=' * i, round(progress * 100))) self._file.flush()
pyocd/pyOCD
[ 883, 424, 883, 228, 1382710205 ]
def _start(self): super(ProgressReportNoTTY, self)._start() self._file.write('[' + '---|' * 9 + '----]\n[') self._file.flush()
pyocd/pyOCD
[ 883, 424, 883, 228, 1382710205 ]
def _finish(self): self._file.write("]\n") self._file.flush()
pyocd/pyOCD
[ 883, 424, 883, 228, 1382710205 ]
def listwrite(output_file,thelist): for item in thelist: item.encode('utf-8') output_file.write("%s\n" % item)
fredzannarbor/pagekicker-community
[ 19, 6, 19, 56, 1459730292 ]
def main(): tmpdir = "/tmp/pagekicker" #personal api key saved as api_key.txt parser = argparse.ArgumentParser() parser.add_argument('path', help = "target file or directory for NER") parser.add_argument('outfile', help = "target file for output") parser.add_argument('uuid', help = "uuid") args = parser.parse_...
fredzannarbor/pagekicker-community
[ 19, 6, 19, 56, 1459730292 ]
def setUp(self): super(TestBenchmarkMem, self).setUp() self.hw_data = [('cpu', 'logical', 'number', 2), ('cpu', 'physical', 'number', 2)]
redhat-cip/hardware
[ 43, 39, 43, 6, 1417464617 ]
def test_check_mem_size(self, mock_popen, mock_cpu_socket, mock_get_memory): block_size_list = ('1K', '4K', '1M', '16M', '128M', '1G', '2G') mock_get_memory.return_value = 123456789012 for block_size in block_size_list: self.assertTrue(mem.check_mem_size(...
redhat-cip/hardware
[ 43, 39, 43, 6, 1417464617 ]
def __init__(self): super(BadTokenError, self).__init__('Bad machine token')
luci/luci-py
[ 70, 40, 70, 82, 1427740754 ]
def machine_authentication(request): """Implementation of the machine authentication. See components.auth.handler.AuthenticatingHandler.get_auth_methods for details of the expected interface. Args: request: webapp2.Request with the incoming request. Returns: (auth.Identity, None) with machine ID ("...
luci/luci-py
[ 70, 40, 70, 82, 1427740754 ]