function
stringlengths
11
56k
repo_name
stringlengths
5
60
features
list
def test_shakearound_user_shake_event(self): from wechatpy.events import ShakearoundUserShakeEvent xml = """<xml> <ToUserName><![CDATA[toUser]]></ToUserName> <FromUserName><![CDATA[fromUser]]></FromUserName> <CreateTime>1433332012</CreateTime> <MsgType><![CDATA[event]]><...
jxtech/wechatpy
[ 3364, 745, 3364, 44, 1410527008 ]
def test_qualification_verify_success_event(self): from wechatpy.events import QualificationVerifySuccessEvent xml = """ <xml> <ToUserName><![CDATA[toUser]]></ToUserName> <FromUserName><![CDATA[FromUser]]></FromUserName> <CreateTime>1442401156</CreateTime> <MsgTy...
jxtech/wechatpy
[ 3364, 745, 3364, 44, 1410527008 ]
def test_naming_verify_success_event(self): from wechatpy.events import NamingVerifySuccessEvent xml = """ <xml> <ToUserName><![CDATA[toUser]]></ToUserName> <FromUserName><![CDATA[FromUser]]></FromUserName> <CreateTime>1442401093</CreateTime> <MsgType><![CDATA[ev...
jxtech/wechatpy
[ 3364, 745, 3364, 44, 1410527008 ]
def test_annual_renew_event(self): from wechatpy.events import AnnualRenewEvent xml = """ <xml> <ToUserName><![CDATA[toUser]]></ToUserName> <FromUserName><![CDATA[FromUser]]></FromUserName> <CreateTime>1442401004</CreateTime> <MsgType><![CDATA[event]]></MsgType> ...
jxtech/wechatpy
[ 3364, 745, 3364, 44, 1410527008 ]
def __init__(self, logdir): self.PLUGIN_LOGDIR = logdir + '/plugins/' + PLUGIN_NAME self.is_recording = False self.video_writer = video_writing.VideoWriter( self.PLUGIN_LOGDIR, outputs=[ video_writing.FFmpegVideoOutput, video_writing.PNGVideoOutput]) self.frame_...
ryfeus/lambda-packs
[ 1086, 234, 1086, 13, 1476901359 ]
def _write_summary(self, session, frame): '''Writes the frame to disk as a tensor summary.''' summary = session.run(self.summary_op, feed_dict={ self.frame_placeholder: frame }) path = '{}/{}'.format(self.PLUGIN_LOGDIR, SUMMARY_FILENAME) write_file(summary, path)
ryfeus/lambda-packs
[ 1086, 234, 1086, 13, 1476901359 ]
def _enough_time_has_passed(self, FPS): '''For limiting how often frames are computed.''' if FPS == 0: return False else: earliest_time = self.last_update_time + (1.0 / FPS) return time.time() >= earliest_time
ryfeus/lambda-packs
[ 1086, 234, 1086, 13, 1476901359 ]
def _update_recording(self, frame, config): '''Adds a frame to the current video output.''' # pylint: disable=redefined-variable-type should_record = config['is_recording'] if should_record: if not self.is_recording: self.is_recording = True tf.logging.info( 'Starting ...
ryfeus/lambda-packs
[ 1086, 234, 1086, 13, 1476901359 ]
def update(self, session, arrays=None, frame=None): '''Creates a frame and writes it to disk. Args: arrays: a list of np arrays. Use the "custom" option in the client. frame: a 2D np array. This way the plugin can be used for video of any kind, not just the visualization that comes wit...
ryfeus/lambda-packs
[ 1086, 234, 1086, 13, 1476901359 ]
def gradient_helper(optimizer, loss, var_list=None): '''A helper to get the gradients out at each step. Args: optimizer: the optimizer op. loss: the op that computes your loss value. Returns: the gradient tensors and the train_step op. ''' if var_list is None: var_list = tf.train...
ryfeus/lambda-packs
[ 1086, 234, 1086, 13, 1476901359 ]
def __init__(self, logdir): """Creates new Hook instance Args: logdir: Directory where Beholder should write data. """ self._logdir = logdir self.beholder = None
ryfeus/lambda-packs
[ 1086, 234, 1086, 13, 1476901359 ]
def add_project_member(apps, schema_editor): # Using historical versions as recommended for RunPython PublicDataAccess = apps.get_model("public_data", "PublicDataAccess") DataRequestProjectMember = apps.get_model( "private_sharing", "DataRequestProjectMember" ) DataRequestProject = apps.get_...
OpenHumans/open-humans
[ 67, 22, 67, 87, 1405539847 ]
def get_country_info(country=None): data = get_all() data = frappe._dict(data.get(country, {})) if 'date_format' not in data: data.date_format = "dd-mm-yyyy" if 'time_format' not in data: data.time_format = "HH:mm:ss" return data
frappe/frappe
[ 4495, 2418, 4495, 1493, 1307520856 ]
def get_country_timezone_info(): return { "country_info": get_all(), "all_timezones": get_all_timezones() }
frappe/frappe
[ 4495, 2418, 4495, 1493, 1307520856 ]
def setUp(self): pass
autosub-team/autosub
[ 5, 4, 5, 1, 1436120517 ]
def testTask(self): """Test Task""" # FIXME: construct object with mandatory attributes with example values # model = swagger_client.models.task.Task() # noqa: E501 pass
autosub-team/autosub
[ 5, 4, 5, 1, 1436120517 ]
def __init__(self): self.proxy = rtorrent.Proxy()
pyroscope/pyroscope
[ 8, 2, 8, 11, 1426291073 ]
def test_accounts_search_permission(app, test_users, test_community, login_user): """Test permission of listing user accounts.""" def account_search(user, expected_code): headers = [('Content-Type', 'application/json'), ('Accept', 'application/json'...
EUDAT-B2SHARE/b2share
[ 32, 30, 32, 223, 1359562894 ]
def account_read(user, expected_code): with app.test_client() as client: if user is not None: login_user(user, client) res = client.get(url, headers=headers) assert res.status_code == expected_code
EUDAT-B2SHARE/b2share
[ 32, 30, 32, 223, 1359562894 ]
def test_account_activation_permission(app, test_users, test_community, login_user): """Test deactivating a user account.""" counter = [0] def account_update(user, expected_code, modified_user=None): def account_update_sub(patch_content, content_type): ...
EUDAT-B2SHARE/b2share
[ 32, 30, 32, 223, 1359562894 ]
def roles_read(user, expected_code): with app.test_client() as client: if user is not None: login_user(user, client) res = client.get(url, headers=headers) assert res.status_code == expected_code
EUDAT-B2SHARE/b2share
[ 32, 30, 32, 223, 1359562894 ]
def __init__(self, iface): QWidget.__init__(self) self.iface = iface self.algorithm = ('invdist', 'average', 'nearest', 'datametrics') self.datametrics = ('minimum', 'maximum', 'range') self.setupUi(self) BasePluginWidget.__init__(self, self.iface, "gdal_grid") # set the defa...
sourcepole/qgis
[ 11, 3, 11, 1, 1278687507 ]
def fillFieldsCombo(self): index = self.inputLayerCombo.currentIndex() if index < 0: return self.lastEncoding = self.layers[index].dataProvider().encoding() self.loadFields( self.getInputFileName() )
sourcepole/qgis
[ 11, 3, 11, 1, 1278687507 ]
def fillInputFileEdit(self): lastUsedFilter = Utils.FileFilter.lastUsedVectorFilter() inputFile, encoding = Utils.FileDialog.getOpenFileName(self, self.tr( "Select the input file for Grid" ), Utils.FileFilter.allVectorsFilter(), lastUsedFilter, True) if inputFile.isEmpty(): return Utils....
sourcepole/qgis
[ 11, 3, 11, 1, 1278687507 ]
def getArguments(self): arguments = QStringList() if self.zfieldCheck.isChecked() and self.zfieldCombo.currentIndex() >= 0: arguments << "-zfield" arguments << self.zfieldCombo.currentText() if self.inputLayerCombo.currentIndex() >= 0: arguments << "-l" arguments << QFi...
sourcepole/qgis
[ 11, 3, 11, 1, 1278687507 ]
def getOutputFileName(self): return self.outputFileEdit.text()
sourcepole/qgis
[ 11, 3, 11, 1, 1278687507 ]
def algorithmArguments(self, index): algorithm = self.algorithm[index] arguments = QStringList() if algorithm == "invdist": arguments.append(algorithm) arguments.append("power=" + str(self.invdistPowerSpin.value())) arguments.append("smothing=" + str(self.invdistSmothingSpin.va...
sourcepole/qgis
[ 11, 3, 11, 1, 1278687507 ]
def print_memory_access( type, address, data): ch = '%s' % chr(data) if ( 0x1F < data < 0x7F) else '.' print( "%5s: Address : 0x%04x (%5d) : Data : 0x%04x (%5d) %s" % (type,address,address,data,data,ch))
revaldinho/opc
[ 74, 10, 74, 3, 1490822441 ]
def __init__(self, *args, **kw): FieldSet.__init__(self, *args, **kw) self._size = self["res_space"].value * 8
SickGear/SickGear
[ 574, 83, 574, 2, 1415773777 ]
def validate(self): if self["magic"].value != 0x00035F3F: return "Invalid magic" if self["filesize"].value != self.stream.size // 8: return "Invalid magic" return True
SickGear/SickGear
[ 574, 83, 574, 2, 1415773777 ]
def __init__(self,bot): self.bot = bot
Canule/Mash-Cogs
[ 13, 10, 13, 2, 1461776634 ]
def check_folders(): if not os.path.exists(DIR_DATA): print("Creating {} folder...".format(DIR_DATA)) os.makedirs(DIR_DATA)
Canule/Mash-Cogs
[ 13, 10, 13, 2, 1461776634 ]
def __init__(self, m): self.message = m
Canule/Mash-Cogs
[ 13, 10, 13, 2, 1461776634 ]
def setup(bot): global geotiler global Color, Drawing, display, Image, Color, Image, COMPOSITE_OPERATORS global BeautifulSoup
Canule/Mash-Cogs
[ 13, 10, 13, 2, 1461776634 ]
def detail_view(self, request, pk=None, slug=None): param = pk if slug is not None: self.lookup_field = 'slug' param = slug try: return super().detail_view(request, param) except MultipleObjectsReturned: # Redirect to the listing view, filt...
openstax/openstax-cms
[ 89, 11, 89, 10, 1446045194 ]
def get_urlpatterns(cls): """ This returns a list of URL patterns for the endpoint """ return [ path('', cls.as_view({'get': 'listing_view'}), name='listing'), path('<int:pk>/', cls.as_view({'get': 'detail_view'}), name='detail'), path('<slug:slug>/', ...
openstax/openstax-cms
[ 89, 11, 89, 10, 1446045194 ]
def __init__(self, credentials): db = credentials['db_name'] user_id = credentials['user_id'] host_name = credentials['host_name'] host_port = credentials['host_port'] user_pwd = credentials['user_pwd'] print "Getting connection to {} for {}".format(db, user_id) ...
martinhbramwell/GData_OpenERP_Data_Pump
[ 4, 3, 4, 1, 1364139528 ]
def user_menu(m):
thomashuang/Lilac
[ 7, 5, 7, 1, 1418724813 ]
def index(self, page=1): user = ctx.request.user if user.role != 'root': raise exc.HTTPFound(location='/user/%d/edit' % (user.uid)) page = int(page) users = Backend('user').paginate(page, 10) return render_template('user.index.html', users=users)
thomashuang/Lilac
[ 7, 5, 7, 1, 1418724813 ]
def userinfo(self): return ctx.request.user
thomashuang/Lilac
[ 7, 5, 7, 1, 1418724813 ]
def login(self, username='', password=''): LOGGER.error('username=%s', username) username = username.strip() password = password.strip() user = Backend('user').find_by_username(username) if user and user.check(password): set_secure_cookie('auth', str(user.uid)) ...
thomashuang/Lilac
[ 7, 5, 7, 1, 1418724813 ]
def add_page(self): return render_template('user.add.html', statuses=USER_STATUSES, roles=ROLES)
thomashuang/Lilac
[ 7, 5, 7, 1, 1418724813 ]
def add(self, username, email, real_name, password, status='', role='user'): username, real_name = username.strip(), real_name.strip() if not re.match(r'^[A-Za-z0-9_]{4,16}$', username): return {'status' : 'error', 'msg' : 'user name: %s must be the ^[A-Za-z0-9_]{4,16}$ pattern' %(username)}...
thomashuang/Lilac
[ 7, 5, 7, 1, 1418724813 ]
def edit_page(self, uid): uid = int(uid) user = Backend('user').find(uid) if not user: raise exc.HTTPNotFound('Not Found') return render_template('user.edit.html', statuses=USER_STATUSES, roles=ROLES, user=user)
thomashuang/Lilac
[ 7, 5, 7, 1, 1418724813 ]
def edit(self, uid, email, real_name, password, newpass1, newpass2, status, role='user'): real_name, newpass1, newpass2 = real_name.strip(), newpass1.strip(), newpass2.strip() uid = int(uid) user = Backend('user').find(uid) if not user: raise exc.HTTPNotFound('user not found...
thomashuang/Lilac
[ 7, 5, 7, 1, 1418724813 ]
def valid_args_list(args): args_list = args.split(",") for arg in args_list: try: int(arg) except: raise argparse.ArgumentTypeError("must be valid integer") return args_list
brendangregg/bcc
[ 60, 12, 60, 1, 1439928302 ]
def find_tid(tgt_dir, tgt_vcpu): for tid in os.listdir(tgt_dir): path = tgt_dir + "/" + tid + "/comm" fp = open(path, "r") comm = fp.read() if (comm.find(tgt_vcpu) != -1): return tid return -1
brendangregg/bcc
[ 60, 12, 60, 1, 1439928302 ]
def format_ts_from_float(ts): return int(ts) * 1000000000
rdo-infra/ci-config
[ 8, 10, 8, 2, 1453219380 ]
def format_ts_from_str(ts, pattern='%Y-%m-%d %H:%M:%S'): return format_ts_from_date(datetime.strptime(ts, pattern))
rdo-infra/ci-config
[ 8, 10, 8, 2, 1453219380 ]
def _process_automations(center, config): """Process automations from config.""" automations = center.data.setdefault(DATA_AUTOMATIONS, {}) conf = config[CONF_AUTOMATIONS] for block in conf: name = block[CONF_NAME] _LOGGER.debug("Setting up automation %s", name) action_sequence =...
CellProfiling/cam_acq
[ 4, 1, 4, 1, 1431267814 ]
def _process_condition(center, config_block): """Return a function that parses the condition.""" if CONF_TYPE in config_block: checks = [] condition_type = config_block[CONF_TYPE] conditions = config_block[CONF_CONDITIONS] for cond in conditions: check = _process_cond...
CellProfiling/cam_acq
[ 4, 1, 4, 1, 1431267814 ]
def check_condition(variables): """Return True if all or any condition(s) pass.""" if condition_type.lower() == "and": return all(template_check(check(variables)) for check in checks) if condition_type.lower() == "or": return any(template_check(check(variables)) for check...
CellProfiling/cam_acq
[ 4, 1, 4, 1, 1431267814 ]
def template_check(value): """Check if a rendered template string equals true. If value is not a string, return value as is. """ if isinstance(value, str): return value.lower() == "true" return value
CellProfiling/cam_acq
[ 4, 1, 4, 1, 1431267814 ]
def remove_triggers(): """Remove attached triggers.""" for remove in remove_funcs: remove()
CellProfiling/cam_acq
[ 4, 1, 4, 1, 1431267814 ]
def __init__( self, center, name, attach_triggers, cond_func, action_sequence, enabled=True
CellProfiling/cam_acq
[ 4, 1, 4, 1, 1431267814 ]
def __repr__(self): """Return the representation.""" return ( f"Automation(center={self._center}, name={self.name}, " f"attach_triggers={self._attach_triggers}, cond_func={self._cond_func}, " f"action_sequence={self._action_sequence}, enabled={self.enabled})" ...
CellProfiling/cam_acq
[ 4, 1, 4, 1, 1431267814 ]
def disable(self): """Disable automation.""" if not self.enabled: return if self._detach_triggers is not None: self._detach_triggers() self._detach_triggers = None self.enabled = False
CellProfiling/cam_acq
[ 4, 1, 4, 1, 1431267814 ]
def __init__(self, center, actions): """Set up instance.""" self._center = center self.actions = list(actions) # copy to list to make sure it's a list
CellProfiling/cam_acq
[ 4, 1, 4, 1, 1431267814 ]
def delay(self, seconds, variables, waiting): """Delay action sequence. Parameters ---------- seconds : float A time interval to delay the pending action sequence. variables : dict A dict of template variables. """ sequence = ActionSequenc...
CellProfiling/cam_acq
[ 4, 1, 4, 1, 1431267814 ]
def __init__(self, center, action_conf): """Set up instance.""" self._center = center self.action_id = action_conf[CONF_ID] self.action_type = action_conf[CONF_TYPE] action_data = action_conf[CONF_DATA] self.template = make_template(center, action_data)
CellProfiling/cam_acq
[ 4, 1, 4, 1, 1431267814 ]
def _import( session: Session, configs: Dict[str, Any], overwrite: bool = False
apache/incubator-superset
[ 50904, 10257, 50904, 1280, 1437504934 ]
def test_send_mail(db): send_mail('Subject', 'Message', to=['user@example.com']) assert len(mail.outbox) == 1 assert mail.outbox[0].subject == '[example.com] Subject' assert mail.outbox[0].body == 'Message' assert mail.outbox[0].from_email == settings.DEFAULT_FROM_EMAIL assert mail.outbox[0].to...
DMPwerkzeug/DMPwerkzeug
[ 80, 41, 80, 122, 1438336991 ]
def test_send_mail_bcc(db): send_mail('Subject', 'Message', bcc=['user2@example.com']) assert len(mail.outbox) == 1 assert mail.outbox[0].subject == '[example.com] Subject' assert mail.outbox[0].body == 'Message' assert mail.outbox[0].from_email == settings.DEFAULT_FROM_EMAIL assert mail.outbox...
DMPwerkzeug/DMPwerkzeug
[ 80, 41, 80, 122, 1438336991 ]
def test_fixture_create_without_context(self) -> None: '''torment.fixtures.Fixture() → TypeError''' self.assertRaises(TypeError, fixtures.Fixture)
kumoru/torment
[ 5, 6, 5, 4, 1431370794 ]
def setUp(self) -> None: self.c = unittest.TestCase() self.f = fixtures.Fixture(self.c)
kumoru/torment
[ 5, 6, 5, 4, 1431370794 ]
def test_fixture_description(self) -> None: '''torment.fixtures.Fixture(context).description == '94d7c58f6ee44683936c21cb84d1e458—torment.fixtures' ''' self.f.context.module = 'fixtures' self.f.uuid = uuid.UUID('94d7c58f6ee44683936c21cb84d1e458') self.assertEqual(self.f.description, '9...
kumoru/torment
[ 5, 6, 5, 4, 1431370794 ]
def test_error_fixture_description(self) -> None: '''torment.fixtures.ErrorFixture(context).description == 'expected → failure' ''' class fixture(fixtures.Fixture): @property def description(self) -> str: return 'expected' class error_fixture(fixtures.Er...
kumoru/torment
[ 5, 6, 5, 4, 1431370794 ]
def test_error_fixture_run(self) -> None: '''torment.fixtures.ErrorFixture(context).run()''' class fixture(fixtures.Fixture): def run(self): raise RuntimeError('failure') class error_fixture(fixtures.ErrorFixture, fixture): def __init__(self, *args, **kw...
kumoru/torment
[ 5, 6, 5, 4, 1431370794 ]
def test_of_zero(self) -> None: '''torment.fixtures.of(()) == []''' self.assertEqual(len(fixtures.of(())), 0)
kumoru/torment
[ 5, 6, 5, 4, 1431370794 ]
def __init__(self, context) -> None: pass
kumoru/torment
[ 5, 6, 5, 4, 1431370794 ]
def test_of_many_with_subclasses(self) -> None: '''torment.fixtures.of(( FixtureA, )) == [ fixture_a, ]''' class FixtureA(object): def __init__(self, context) -> None: pass class FixtureB(FixtureA): pass result = fixtures.of(( FixtureA, )) ...
kumoru/torment
[ 5, 6, 5, 4, 1431370794 ]
def setUp(self) -> None: _ = unittest.mock.patch('torment.fixtures.inspect') mocked_inspect = _.start() self.addCleanup(_.stop) mocked_inspect.configure_mock(**{ 'isclass': inspect.isclass, 'isfunction': inspect.isfunction, }) mocked_inspect.stack.return_value = ( None, ( None,...
kumoru/torment
[ 5, 6, 5, 4, 1431370794 ]
def test_one_literal_properties(self) -> None: '''torment.fixtures.register({}, (), { 'a': 'a', })''' fixtures.register(self.ns, ( fixtures.Fixture, ), { 'a': 'a', }) _ = self.ns[self.class_name](self.context) self.assertEqual(_.a, 'a')
kumoru/torment
[ 5, 6, 5, 4, 1431370794 ]
def test_one_fixture_class_properties(self) -> None: '''torment.fixtures.register({}, (), { 'a': fixture_class, })''' class A(fixtures.Fixture): pass fixtures.register(self.ns, ( fixtures.Fixture, ), { 'a': A, }) _ = self.ns[self.class_name](self.context) self.ass...
kumoru/torment
[ 5, 6, 5, 4, 1431370794 ]
def a(self) -> None: pass
kumoru/torment
[ 5, 6, 5, 4, 1431370794 ]
def test_description_property(self) -> None: '''torment.fixtures.register({}, (), { 'description': 'needle', })''' fixtures.register(self.ns, ( fixtures.Fixture, ), { 'description': 'needle', }) _ = self.ns[self.class_name](self.context) self.assertEqual(_.description, 'd43830e2e9624d...
kumoru/torment
[ 5, 6, 5, 4, 1431370794 ]
def test_mocks_mock_property(self) -> None: '''torment.fixtures.register({}, (), { 'mocks': { 'symbol': …, }, }).setup()''' _ = unittest.mock.patch('torment.fixtures._find_mocker') mocked_fixtures_find_mocker = _.start() self.addCleanup(_.stop) mocked_fixtures_find_mocker.return...
kumoru/torment
[ 5, 6, 5, 4, 1431370794 ]
def setUp(self) -> None: class ContextStub(contexts.TestContext): mocked_symbol = unittest.mock.MagicMock(name = 'ContextStub.mocked_symbol') self.context = ContextStub()
kumoru/torment
[ 5, 6, 5, 4, 1431370794 ]
def test_prepare_mock_side_effect_zero_dots(self) -> None: '''tormnet.fixtures._prepare_mock(ContextStub, 'symbol', side_effect = range(2))''' fixtures._prepare_mock(self.context, 'symbol', side_effect = range(2)) self.assertEqual(self.context.mocked_symbol(), 0) self.assertEqual(self.c...
kumoru/torment
[ 5, 6, 5, 4, 1431370794 ]
def test_prepare_mock_return_value_one_dots(self) -> None: '''tormnet.fixtures._prepare_mock(ContextStub, 'symbol.Sub', return_value = 'a')''' fixtures._prepare_mock(self.context, 'symbol.Sub', return_value = 'a') self.assertEqual(self.context.mocked_symbol.Sub(), 'a')
kumoru/torment
[ 5, 6, 5, 4, 1431370794 ]
def test_prepare_mock_return_value_many_dots_second_level(self) -> None: '''tormnet.fixtures._prepare_mock(ContextStub, 'symbol.sub.a.b.c', return_value = 'a')''' class ContextStub(contexts.TestContext): mocked_symbol_sub = unittest.mock.MagicMock(name = 'ContextStub.mocked_symbol_sub') ...
kumoru/torment
[ 5, 6, 5, 4, 1431370794 ]
def test_find_mocker_found_zero_levels(self) -> None: '''tormnet.fixtures._find_mocker('symbol', ContextStub) == mock_symbol''' class ContextStub(contexts.TestContext): def mock_symbol(self): pass c = ContextStub() method = fixtures._find_mocker('symbol', c...
kumoru/torment
[ 5, 6, 5, 4, 1431370794 ]
def mock_symbol_sub(self): pass
kumoru/torment
[ 5, 6, 5, 4, 1431370794 ]
def test_find_mocker_found_many_levels(self) -> None: '''tormnet.fixtures._find_mocker('symbol.sub.a.b', ContextStub) == mock_symbol_sub_a_b''' class ContextStub(contexts.TestContext): def mock_symbol_sub_a_b(self): pass c = ContextStub() method = fixtures....
kumoru/torment
[ 5, 6, 5, 4, 1431370794 ]
def setUp(self) -> None: class StubFixture(object): pass self.f = StubFixture() self.f.name = 'testing_fixture_stub' self.o = copy.deepcopy(self.f)
kumoru/torment
[ 5, 6, 5, 4, 1431370794 ]
def test_one_functions_without_parameters(self) -> None: '''torment.fixtures._resolve_functions({ 'a': ø → None, }, fixture)''' def a() -> None: pass fixtures._resolve_functions({ 'a': a, }, self.f) self.assertEqual(id(self.f.a), id(a))
kumoru/torment
[ 5, 6, 5, 4, 1431370794 ]
def a(self) -> None: pass
kumoru/torment
[ 5, 6, 5, 4, 1431370794 ]
def test_one_functions_with_self_parameter_raises_attributeerror(self) -> None: '''torment.fixtures._resolve_functions({ 'a': self → self.b, }, fixture)''' def a(self): return self.b fixtures._resolve_functions({ 'a': a, }, self.f) self.assertEqual(id(self.f.a), id(a))
kumoru/torment
[ 5, 6, 5, 4, 1431370794 ]
def a(self) -> None: return self.b
kumoru/torment
[ 5, 6, 5, 4, 1431370794 ]
def setUp(self) -> None: self.uuid = uuid.uuid4()
kumoru/torment
[ 5, 6, 5, 4, 1431370794 ]
def test_one_namespace(self) -> None: '''torment.fixtures._unique_class_name({ 'f_{uuid}': None, }, uuid) == 'f_{uuid}_1' ''' n = fixtures._unique_class_name({ 'f_' + self.uuid.hex: None, }, self.uuid) self.assertEqual(n, 'f_' + self.uuid.hex + '_1')
kumoru/torment
[ 5, 6, 5, 4, 1431370794 ]
def __init__(self, container, command, *args, **kwargs): self._container = container self._command = command super(DockerExecMixin, self).__init__(*args, **kwargs)
HPENetworking/topology_docker
[ 2, 15, 2, 4, 1452032873 ]
def run_detector(self) -> None: """Run the breaking change detector to detect rule violations This method should populate the detector's internal data such that `is_breaking` does not require any additional invocations to the breaking change detector. """ pass
envoyproxy/envoy
[ 21587, 4174, 21587, 1421, 1470668844 ]
def get_breaking_changes(self) -> List[str]: """Return a list of strings containing breaking changes output by the tool""" pass
envoyproxy/envoy
[ 21587, 4174, 21587, 1421, 1470668844 ]
def __init__( self, path_to_changed_dir: str, git_ref: str, git_path: str, subdir: str = None, buf_path: str = None, config_file_loc: str = None, additional_args: List[str] = None) -> None: """Initialize the configur...
envoyproxy/envoy
[ 21587, 4174, 21587, 1421, 1470668844 ]
def is_breaking(self) -> bool: if not self._final_result: raise ChangeDetectorError("Must invoke run_detector() before checking if is_breaking()") final_code, final_out, final_err = self._final_result final_out, final_err = '\n'.join(final_out), '\n'.join(final_err) if fina...
envoyproxy/envoy
[ 21587, 4174, 21587, 1421, 1470668844 ]
def SecondsToMicroseconds(seconds): """Convert seconds to microseconds. Args: seconds: number Returns: microseconds """ return seconds * _MICROSECONDS_PER_SECOND
googlearchive/titan
[ 46, 9, 46, 1, 1366927053 ]
def _GetCurrentTimeMicros(): """Get the current time in microseconds, in UTC. Returns: The number of microseconds since the epoch. """ return int(SecondsToMicroseconds(time.time()))
googlearchive/titan
[ 46, 9, 46, 1, 1366927053 ]
def GetTimeMicros(time_tuple): """Get a time in microseconds. Arguments: time_tuple: A (year, month, day, hour, minute, second) tuple (the python time tuple format) in the UTC time zone. Returns: The number of microseconds since the epoch represented by the input tuple. """ return int(SecondsT...
googlearchive/titan
[ 46, 9, 46, 1, 1366927053 ]
def DatetimeToUTCMillis(date): """Converts a datetime object to milliseconds since the epoch in UTC. Args: date: A datetime to convert. Returns: The number of milliseconds since the epoch, in UTC, represented by the input datetime. """ return DatetimeToUTCMicros(date) / 1000
googlearchive/titan
[ 46, 9, 46, 1, 1366927053 ]