function
stringlengths
11
56k
repo_name
stringlengths
5
60
features
list
def my_retried_method(count_func): count_func() exception = ClientError(error_response={"Error": {"Code": "Another Error", "Message": "Foo"}}, operation_name="DescribeStacks") raise exception
marco-hoyer/cfn-sphere
[ 82, 26, 82, 4, 1438784024 ]
def test_with_boto_retry_does_not_retry_without_exception(self): count_func = Mock() @util.with_boto_retry(max_retries=1, pause_time_multiplier=1) def my_retried_method(count_func): count_func() return "foo" self.assertEqual("foo", my_retried_method(count_func))...
marco-hoyer/cfn-sphere
[ 82, 26, 82, 4, 1438784024 ]
def test_get_pretty_stack_outputs_returns_proper_table(self): outputs = [ { 'OutputKey': 'key1', 'OutputValue': 'value1', 'Description': 'desc1' }, { 'OutputKey': 'key2', 'OutputValue': 'value2', ...
marco-hoyer/cfn-sphere
[ 82, 26, 82, 4, 1438784024 ]
def test_strip_string_strips_string(self): s = "sfsdklgashgslkadghkafhgaknkbndkjfbnwurtqwhgsdnkshGLSAKGKLDJFHGSKDLGFLDFGKSDFLGKHAsdjdghskjdhsdcxbvwerA323" result = util.strip_string(s) self.assertEqual( "sfsdklgashgslkadghkafhgaknkbndkjfbnwurtqwhgsdnkshGLSAKGKLDJFHGSKDLGFLDFGKSDFLGKH...
marco-hoyer/cfn-sphere
[ 82, 26, 82, 4, 1438784024 ]
def test_get_git_repository_remote_url_returns_none_if_no_repository_present(self, repo_mock): repo_mock.side_effect = InvalidGitRepositoryError self.assertEqual(None, util.get_git_repository_remote_url(tempfile.mkdtemp()))
marco-hoyer/cfn-sphere
[ 82, 26, 82, 4, 1438784024 ]
def test_get_git_repository_remote_url_returns_repo_url(self, repo_mock): url = "http://config.repo.git" repo_mock.return_value.remotes.origin.url = url self.assertEqual(url, util.get_git_repository_remote_url(tempfile.mkdtemp()))
marco-hoyer/cfn-sphere
[ 82, 26, 82, 4, 1438784024 ]
def test_get_git_repository_remote_url_returns_repo_url_from_parent_dir(self, repo_mock): url = "http://config.repo.git" repo_object_mock = Mock() repo_object_mock.remotes.origin.url = url repo_mock.side_effect = [InvalidGitRepositoryError, repo_object_mock] self.assertEqual(url...
marco-hoyer/cfn-sphere
[ 82, 26, 82, 4, 1438784024 ]
def test_get_git_repository_remote_url_returns_none_for_empty_string_working_dir(self): self.assertEqual(None, util.get_git_repository_remote_url(""))
marco-hoyer/cfn-sphere
[ 82, 26, 82, 4, 1438784024 ]
def test_kv_list_to_dict(self): result = util.kv_list_to_dict(["k1=v1", "k2=v2"]) self.assertEqual({"k1": "v1", "k2": "v2"}, result)
marco-hoyer/cfn-sphere
[ 82, 26, 82, 4, 1438784024 ]
def _get_model(shape, dtype, a_min, a_max): assert a_min >= np.iinfo(dtype).min and a_max <= np.iinfo(dtype).max a = relay.var("a", shape=shape, dtype=dtype) relu = relay.clip(a, a_min=a_min, a_max=a_max) return relu
dmlc/tvm
[ 9142, 2938, 9142, 595, 1476310828 ]
def test_relu(dtype): trials = [ ((1, 4, 4, 4), 65, 178, "uint8"), ((1, 8, 4, 2), 1, 254, "uint8"), ((1, 16), 12, 76, "uint8"), ((1, 4, 4, 4), 65, 125, "int8"), ((1, 8, 4, 2), -100, 100, "int8"), ((1, 16), -120, -20, "int8"), ] np.random.seed(0) for shape...
dmlc/tvm
[ 9142, 2938, 9142, 595, 1476310828 ]
def sanitize(txt): txt = ''.join(filter(lambda c: c in printable, txt)) return txt
yhalpern/anchorExplorer
[ 17, 3, 17, 2, 1415238212 ]
def getEdges(t, outfile): for c in t.children: print >>outfile, sanitize(t.code+'\t'+c.code) getEdges(c, outfile)
yhalpern/anchorExplorer
[ 17, 3, 17, 2, 1415238212 ]
def unsupported_versions_1979(): """Unsupported python versions for itertags 3.7.0 - 3.7.2 and 3.8.0a1 - https://github.com/streamlink/streamlink/issues/1979 - https://bugs.python.org/issue34294 """ v = sys.version_info if (v.major == 3) and ( # 3.7.0 - 3.7.2 (v.mino...
beardypig/streamlink
[ 3, 1, 3, 4, 1475754729 ]
def test_itertags_single_text(self): title = list(itertags(self.test_html, "title")) self.assertTrue(len(title), 1) self.assertEqual(title[0].tag, "title") self.assertEqual(title[0].text, "Title") self.assertEqual(title[0].attributes, {})
beardypig/streamlink
[ 3, 1, 3, 4, 1475754729 ]
def test_itertags_multi_attrs(self): metas = list(itertags(self.test_html, "meta")) self.assertTrue(len(metas), 3) self.assertTrue(all(meta.tag == "meta" for meta in metas)) self.assertEqual(metas[0].text, None) self.assertEqual(metas[1].text, None) self.assertEqual(meta...
beardypig/streamlink
[ 3, 1, 3, 4, 1475754729 ]
def test_no_end_tag(self): links = list(itertags(self.test_html, "link")) self.assertTrue(len(links), 1) self.assertEqual(links[0].tag, "link") self.assertEqual(links[0].text, None) self.assertEqual(links[0].attributes, {"rel": "stylesheet", ...
beardypig/streamlink
[ 3, 1, 3, 4, 1475754729 ]
def test_properties(): rng = np.random.default_rng(5) for i in range(100): R = rng.normal(0.0, 0.3) # negative allowed sphere = batoid.Sphere(R) assert sphere.R == R do_pickle(sphere)
jmeyers314/batoid
[ 13, 9, 13, 21, 1485797644 ]
def test_sag(): rng = np.random.default_rng(57) for i in range(100): R = 1./rng.normal(0.0, 0.3) sphere = batoid.Sphere(R) for j in range(10): x = rng.uniform(-0.7*abs(R), 0.7*abs(R)) y = rng.uniform(-0.7*abs(R), 0.7*abs(R)) result = sphere.sag(x, y) ...
jmeyers314/batoid
[ 13, 9, 13, 21, 1485797644 ]
def test_normal(): rng = np.random.default_rng(577) for i in range(100): R = 1./rng.normal(0.0, 0.3) sphere = batoid.Sphere(R) for j in range(10): x = rng.uniform(-0.7*abs(R), 0.7*abs(R)) y = rng.uniform(-0.7*abs(R), 0.7*abs(R)) result = sphere.normal(...
jmeyers314/batoid
[ 13, 9, 13, 21, 1485797644 ]
def test_intersect(): rng = np.random.default_rng(5772) size = 10_000 for i in range(100): R = 1./rng.normal(0.0, 0.3) sphereCoordSys = batoid.CoordSys(origin=[0, 0, -1]) sphere = batoid.Sphere(R) x = rng.uniform(-0.3*abs(R), 0.3*abs(R), size=size) y = rng.uniform(-0....
jmeyers314/batoid
[ 13, 9, 13, 21, 1485797644 ]
def test_reflect(): rng = np.random.default_rng(57721) size = 10_000 for i in range(100): R = 1./rng.normal(0.0, 0.3) sphere = batoid.Sphere(R) x = rng.uniform(-0.3*abs(R), 0.3*abs(R), size=size) y = rng.uniform(-0.3*abs(R), 0.3*abs(R), size=size) z = np.full_like(x, ...
jmeyers314/batoid
[ 13, 9, 13, 21, 1485797644 ]
def test_refract(): rng = np.random.default_rng(577215) size = 10_000 for i in range(100): R = 1./rng.normal(0.0, 0.3) sphere = batoid.Sphere(R) m0 = batoid.ConstMedium(rng.normal(1.2, 0.01)) m1 = batoid.ConstMedium(rng.normal(1.3, 0.01)) x = rng.uniform(-0.3*abs(R), ...
jmeyers314/batoid
[ 13, 9, 13, 21, 1485797644 ]
def test_ne(): objs = [ batoid.Sphere(1.0), batoid.Sphere(2.0), batoid.Plane() ] all_obj_diff(objs)
jmeyers314/batoid
[ 13, 9, 13, 21, 1485797644 ]
def test_fail(): sphere = batoid.Sphere(1.0) rv = batoid.RayVector(0, 10, 0, 0, 0, -1) # Too far to side rv2 = batoid.intersect(sphere, rv.copy()) np.testing.assert_equal(rv2.failed, np.array([True])) # This one passes rv = batoid.RayVector(0, 0, 0, 0, 0, -1) rv2 = batoid.intersect(sphere, ...
jmeyers314/batoid
[ 13, 9, 13, 21, 1485797644 ]
def adc_response(msg, isjson, code=200, json_encoded=False): if json_encoded: body = msg else: template = 'response.json' if isjson else 'response.html' body = render_template(template, msg=msg) resp = make_response(body) if code == 200: resp.status = 'OK' elif code =...
dasadc/conmgr
[ 2, 2, 2, 3, 1427178829 ]
def adc_response_text(body, code=200): resp = make_response(body) resp.status_code = code resp.headers['Content-Type'] = 'text/plain; charset=utf-8' return resp
dasadc/conmgr
[ 2, 2, 2, 3, 1427178829 ]
def adc_response_Q_data(result): "問題テキストデータを返す" if result is None: code = 404 text = "Not Found\r\n" else: code = 200 text = result.text return adc_response_text(text, code)
dasadc/conmgr
[ 2, 2, 2, 3, 1427178829 ]
def log_get_or_delete(username=None, fetch_num=100, when=None, delete=False): query = Log.query(ancestor = log_key()).order(-Log.date) if username is not None: query = query.filter(Log.username == username) if when is not None: before = datetime.datetime.now() - when #print "before="...
dasadc/conmgr
[ 2, 2, 2, 3, 1427178829 ]
def adc_change_password(salt, username, users, attr, priv_admin=False): "パスワード変更。管理者は他人のパスワードも変更できる。" if ('password_old' in attr and 'password_new1' in attr and 'password_new2' in attr): if not priv_admin: # 管理者でないときは、現在のパスワードをチェック u = adc_login(salt, username, attr['password...
dasadc/conmgr
[ 2, 2, 2, 3, 1427178829 ]
def adc_get_user_list(users): res = [] # まずはローカルに定義されたユーザを検索 for u in users: res.append(u[0]) # 次に、データベースに登録されたユーザを検索 res2 = get_username_list() res.extend(res2) return res
dasadc/conmgr
[ 2, 2, 2, 3, 1427178829 ]
def update_Q_data(q_num, text, author="DASymposium", year=DEFAULT_YEAR): "問題データを変更する" # 問題データの内容チェック (size, line_num, line_mat, msg, ok) = numberlink.read_input_data(text) if not ok: return (False, "Error: syntax error in Q data\n"+msg, None, None) text2 = numberlink.generate_Q_data(size, l...
dasadc/conmgr
[ 2, 2, 2, 3, 1427178829 ]
def get_Q_author_all(): "出題の番号から、authorを引けるテーブルを作る" qla = ndb.Key(QuestionListAll, 'master', parent=qdata_key()).get() if qla is None: return None authors = ['']*(len(qla.qs)+1) # q_numは1から始まるので、+1しておく qn = 1 # 出題番号 for q_key in qla.qs: q = q_key.get() authors[qn] = q.aut...
dasadc/conmgr
[ 2, 2, 2, 3, 1427178829 ]
def get_user_Q_data(q_num, author, year=DEFAULT_YEAR, fetch_num=99): "qnumとauthorを指定して問題データをデータベースから取り出す" userinfo = get_userinfo(author) if userinfo is None: root = qdata_key(year) else: root = userinfo.key key = ndb.Key(Question, str(q_num), parent=root) return key.get()
dasadc/conmgr
[ 2, 2, 2, 3, 1427178829 ]
def admin_Q_list_get(): "コンテストの出題リストを取り出す" qla = ndb.Key(QuestionListAll, 'master', parent=qdata_key()).get() if qla is None: return '' else: return qla.text_admin
dasadc/conmgr
[ 2, 2, 2, 3, 1427178829 ]
def admin_Q_list_delete(): "コンテストの出題リストを削除する" root = qdata_key() ndb.Key(QuestionListAll, 'master', parent=root).delete() return "DELETE Q-list"
dasadc/conmgr
[ 2, 2, 2, 3, 1427178829 ]
def menu_post_A(username): "回答ファイルをアップロードするフォームを返す" qla = ndb.Key(QuestionListAll, 'master', parent=qdata_key()).get() if qla is None: return '' out = "" num=1 for i in qla.text_user.splitlines(): out += '<a href="/A/%s/Q/%d">post answer %s</a><br />\n' % (username, num, i) ...
dasadc/conmgr
[ 2, 2, 2, 3, 1427178829 ]
def get_user_Q_all(author, html=None): "authorを指定して、問題データの一覧リストを返す" userinfo = get_userinfo(author) if userinfo is None: root = qdata_key() else: root = userinfo.key query = Question.query( ancestor = root ).order(Question.qnum) #query = query.filter(Question.author == author ) ...
dasadc/conmgr
[ 2, 2, 2, 3, 1427178829 ]
def get_admin_A_all(): "データベースに登録されたすべての回答データの一覧リスト" #query = Answer.query(ancestor=userlist_key()).order(Answer.owner, Answer.anum) query = Answer.query(ancestor=userlist_key()) q = query.fetch() num = len(q) out = str(num) + "\n" for i in q: dt = gae_datetime_JST(i.date) ou...
dasadc/conmgr
[ 2, 2, 2, 3, 1427178829 ]
def get_A_data(a_num=None, username=None): """ データベースから回答データを取り出す。 a_numがNoneのとき、複数のデータを返す。 a_numが数値のとき、その数値のデータを1つだけ返す。存在しないときはNone。 """ if username is None: root = userlist_key() else: userinfo = get_userinfo(username) if userinfo is None: msg = "ERROR: ...
dasadc/conmgr
[ 2, 2, 2, 3, 1427178829 ]
def put_A_data(a_num, username, text, cpu_sec=None, mem_byte=None, misc_text=None): "回答データをデータベースに格納する" msg = "" # 出題データを取り出す ret, q_text = get_Q_data_text(a_num) if not ret: msg = "Error in Q%d data: " % a_num + q_text return False, msg # 重複回答していないかチェック ret, q, root = get_A_...
dasadc/conmgr
[ 2, 2, 2, 3, 1427178829 ]
def get_or_delete_A_data(a_num=None, username=None, delete=False): "回答データをデータベースから、削除or取り出し" ret, q, root = get_A_data(a_num=a_num, username=username) if not ret: return False, q # q==msg if q is None: return ret, [] result = [] if a_num is None: # a_num==Noneのとき、データが複数個になる ...
dasadc/conmgr
[ 2, 2, 2, 3, 1427178829 ]
def get_or_delete_A_info(a_num=None, username=None, delete=False): "回答データの補足情報をデータベースから、削除or取り出し" msg = "" r, a, root = get_A_data(a_num, username) if not r: return False, a, None if a_num is None: q = a else: if a is None: msg += "A%d not found" % a_num ...
dasadc/conmgr
[ 2, 2, 2, 3, 1427178829 ]
def create_user(username, password, displayname, uid, gid, salt): "ユーザーをデータベースに登録" hashed = hashed_password(username, password, salt) userlist = userlist_key() u = UserInfo( parent = userlist, id = username, username = username, password = hashed, ...
dasadc/conmgr
[ 2, 2, 2, 3, 1427178829 ]
def get_username_list(): "ユーザー名の一覧リストをデータベースから取り出す" #query = UserInfo.query( ancestor = userlist_key() ).order(UserInfo.uid) query = UserInfo.query( ancestor = userlist_key() ) q = query.fetch() res = [] for u in q: res.append(u.username) return res
dasadc/conmgr
[ 2, 2, 2, 3, 1427178829 ]
def delete_user(username): "ユーザーをデータベースから削除" userinfo = get_userinfo(username) if userinfo is None: return 0 else: userinfo.key.delete() return 1 return n
dasadc/conmgr
[ 2, 2, 2, 3, 1427178829 ]
def calc_score_all(): "スコア計算" authors = get_Q_author_all() #print "authors=", authors q_factors = {} q_point = {} ok_point = {} bonus_point = {} result = {} misc = {} query = Answer.query(ancestor=userlist_key()) q = query.fetch() all_numbers = {} all_users = {} f...
dasadc/conmgr
[ 2, 2, 2, 3, 1427178829 ]
def from_port_specs(source, dest): """from_port_specs(source: PortSpec, dest: PortSpec) -> Connection Static method that creates a Connection given source and destination ports. """ conn = Connection() conn.source = copy.copy(source) conn.destination = copy.copy...
VisTrails/VisTrails
[ 98, 44, 98, 181, 1344454638 ]
def fromID(id): """fromTypeID(id: int) -> Connection Static method that creates a Connection given an id. """ conn = Connection() conn.id = id conn.source.endPoint = PortEndPoint.Source conn.destination.endPoint = PortEndPoint.Destination return conn
VisTrails/VisTrails
[ 98, 44, 98, 181, 1344454638 ]
def __init__(self, *args, **kwargs): """__init__() -> Connection Initializes source and destination ports.
VisTrails/VisTrails
[ 98, 44, 98, 181, 1344454638 ]
def __copy__(self): """__copy__() -> Connection - Returns a clone of self.
VisTrails/VisTrails
[ 98, 44, 98, 181, 1344454638 ]
def do_copy(self, new_ids=False, id_scope=None, id_remap=None): cp = DBConnection.do_copy(self, new_ids, id_scope, id_remap) cp.__class__ = Connection for port in cp.ports: Port.convert(port) return cp
VisTrails/VisTrails
[ 98, 44, 98, 181, 1344454638 ]
def convert(_connection):
VisTrails/VisTrails
[ 98, 44, 98, 181, 1344454638 ]
def add_port(self, port): self.db_add_port(port)
VisTrails/VisTrails
[ 98, 44, 98, 181, 1344454638 ]
def _set_sourceId(self, id): """ _set_sourceId(id : int) -> None Sets this connection source id. It updates both self.source.moduleId and self.source.id. Do not use this function, use sourceId property: c.sourceId = id """ self.source.moduleId = id self.source.i...
VisTrails/VisTrails
[ 98, 44, 98, 181, 1344454638 ]
def _get_destinationId(self): """ _get_destinationId() -> int Returns the module id of dest port. Do not use this function, use sourceId property: c.destinationId """ return self.destination.moduleId
VisTrails/VisTrails
[ 98, 44, 98, 181, 1344454638 ]
def _get_source(self): """_get_source() -> Port Returns source port. Do not use this function, use source property: c.source """ try: return self.db_get_port_by_type('source') except KeyError: pass return None
VisTrails/VisTrails
[ 98, 44, 98, 181, 1344454638 ]
def _get_destination(self): """_get_destination() -> Port Returns destination port. Do not use this function, use destination property: c.destination """
VisTrails/VisTrails
[ 98, 44, 98, 181, 1344454638 ]
def _set_destination(self, dest): """_set_destination(dest: Port) -> None Sets this connection destination port. Do not use this function, use destination property instead: c.destination = dest """ try: port = self.db_get_port_by_type('destination') self...
VisTrails/VisTrails
[ 98, 44, 98, 181, 1344454638 ]
def __str__(self): """__str__() -> str - Returns a string representation of a Connection object. """ rep = "<connection id='%s'>%s%s</connection>" return rep % (str(self.id), str(self.source), str(self.destination))
VisTrails/VisTrails
[ 98, 44, 98, 181, 1344454638 ]
def __eq__(self, other): if type(other) != type(self): return False return (self.source == other.source and self.dest == other.dest)
VisTrails/VisTrails
[ 98, 44, 98, 181, 1344454638 ]
def create_connection(self, id_scope=IdScope()): from vistrails.core.vistrail.port import Port from vistrails.core.modules.basic_modules import identifier as basic_pkg source = Port(id=id_scope.getNewId(Port.vtType), type='source', moduleId=21L, ...
VisTrails/VisTrails
[ 98, 44, 98, 181, 1344454638 ]
def test_serialization(self): import vistrails.core.db.io c1 = self.create_connection() xml_str = vistrails.core.db.io.serialize(c1) c2 = vistrails.core.db.io.unserialize(xml_str, Connection) self.assertEquals(c1, c2) self.assertEquals(c1.id, c2.id)
VisTrails/VisTrails
[ 98, 44, 98, 181, 1344454638 ]
def make_cookie_key(key): return 'after_signup_' + str(key)
canvasnetworks/canvas
[ 56, 15, 56, 3, 1447125133 ]
def configure(): cloud_host = JBoxCfg.get('cloud_host') JBoxGCD.INSTALLID = cloud_host['install_id'] JBoxGCD.REGION = cloud_host['region'] JBoxGCD.DOMAIN = cloud_host['domain']
JuliaLang/JuliaBox
[ 183, 50, 183, 60, 1383806846 ]
def domain(): if JBoxGCD.DOMAIN is None: JBoxGCD.configure() return JBoxGCD.DOMAIN
JuliaLang/JuliaBox
[ 183, 50, 183, 60, 1383806846 ]
def connect(): c = getattr(JBoxGCD.threadlocal, 'conn', None) if c is None: JBoxGCD.configure() creds = GoogleCredentials.get_application_default() JBoxGCD.threadlocal.conn = c = build("dns", "v1", credentials=creds) return c
JuliaLang/JuliaBox
[ 183, 50, 183, 60, 1383806846 ]
def add_cname(name, value): JBoxGCD.connect().changes().create( project=JBoxGCD.INSTALLID, managedZone=JBoxGCD.REGION, body={'kind': 'dns#change', 'additions': [ {'rrdatas': [value], 'kind': 'dns#resourceRecordSet', ...
JuliaLang/JuliaBox
[ 183, 50, 183, 60, 1383806846 ]
def detailed_balance_factor(self): r"""Returns the detailed balance factor (sometimes called the Bose factor) Parameters ---------- None Returns ------- dbf : ndarray The detailed balance factor (temperature correction) """ ...
neutronpy/neutronpy
[ 11, 4, 11, 7, 1407430759 ]
def position(self, bounds=None, background=None, hkle=True): r"""Returns the position of a peak within the given bounds Parameters ---------- bounds : bool, optional A boolean expression representing the bounds inside which the calculation will be performed ...
neutronpy/neutronpy
[ 11, 4, 11, 7, 1407430759 ]
def scattering_function(self, material, ei): r"""Returns the neutron scattering function, i.e. the detector counts scaled by :math:`4 \pi / \sigma_{\mathrm{tot}} * k_i/k_f`. Parameters ---------- material : object Definition of the material given by the :py:class:`.M...
neutronpy/neutronpy
[ 11, 4, 11, 7, 1407430759 ]
def estimate_background(self, bg_params): r"""Estimate the background according to ``type`` specified. Parameters ---------- bg_params : dict Input dictionary has keys 'type' and 'value'. Types are * 'constant' : background is the constant given by 'value' ...
neutronpy/neutronpy
[ 11, 4, 11, 7, 1407430759 ]
def setUp(self): super().setUp() self.mongo_patcher = patch('common.djangoapps.track.backends.mongodb.MongoClient') self.mongo_patcher.start() self.addCleanup(self.mongo_patcher.stop) self.backend = MongoBackend()
eduNEXT/edx-platform
[ 5, 3, 5, 6, 1390926698 ]
def first_argument(call): _, args, _ = call return args[0]
eduNEXT/edx-platform
[ 5, 3, 5, 6, 1390926698 ]
def update_hash(hasher, obj): """ Update a `hashlib` hasher with a nested object. To properly cache nested structures, we need to compute a hash from the entire structure, canonicalizing at every level. `hasher`'s `.update()` method is called a number of times, touching all of `obj` in the pro...
eduNEXT/edx-platform
[ 5, 3, 5, 6, 1390926698 ]
def safe_exec( code, globals_dict, random_seed=None, python_path=None, extra_files=None, cache=None, limit_overrides_context=None, slug=None, unsafely=False,
eduNEXT/edx-platform
[ 5, 3, 5, 6, 1390926698 ]
def forwards(self, orm):
zuck/prometeo-erp
[ 11, 10, 11, 3, 1426302554 ]
def backwards(self, orm):
zuck/prometeo-erp
[ 11, 10, 11, 3, 1426302554 ]
def setUp(self): super().setUp() self.create_gcs_bucket(GCP_BUCKET_NAME, location="europe-north1")
airbnb/airflow
[ 29418, 12032, 29418, 869, 1428948298 ]
def test_run_example_dag_memorystore_redis(self): self.run_dag('gcp_cloud_memorystore_redis', CLOUD_DAG_FOLDER)
airbnb/airflow
[ 29418, 12032, 29418, 869, 1428948298 ]
def test_run_example_dag_memorystore_memcached(self): self.run_dag('gcp_cloud_memorystore_memcached', CLOUD_DAG_FOLDER)
airbnb/airflow
[ 29418, 12032, 29418, 869, 1428948298 ]
def __init__(self): super(FlavorManageController, self).__init__()
ntt-sic/nova
[ 1, 2, 1, 1, 1382427064 ]
def _delete(self, req, id): context = req.environ['nova.context'] authorize(context) try: flavor = flavors.get_flavor_by_flavor_id( id, ctxt=context, read_deleted="no") except exception.NotFound as e: raise webob.exc.HTTPNotFound(explanation=e...
ntt-sic/nova
[ 1, 2, 1, 1, 1382427064 ]
def _create(self, req, body): context = req.environ['nova.context'] authorize(context) if not self.is_valid_body(body, 'flavor'): msg = _("Invalid request body") raise webob.exc.HTTPBadRequest(explanation=msg) vals = body['flavor'] name = vals.get('name') ...
ntt-sic/nova
[ 1, 2, 1, 1, 1382427064 ]
def __init__(self, **argd): super(SchedulingComponentMixin, self).__init__(**argd) self.eventQueue = []
sparkslabs/kamaelia_
[ 13, 3, 13, 2, 1348148442 ]
def scheduleRel(self, message, delay, priority=1): """ Schedule an event to wake the component and send a message to the "event" inbox after a delay. """ return self.scheduleAbs(message, time.time() + delay, priority)
sparkslabs/kamaelia_
[ 13, 3, 13, 2, 1348148442 ]
def cancelEvent(self, event): """ Remove a scheduled event from the scheduler """ self.eventQueue.remove(event) heapq.heapify(self.eventQueue)
sparkslabs/kamaelia_
[ 13, 3, 13, 2, 1348148442 ]
def pause(self): """ Sleep until there is either an event ready or a message is received on an inbox """ if self.eventReady(): self.signalEvent() else: if self.eventQueue: eventTime = self.eventQueue[0][0] super(Sche...
sparkslabs/kamaelia_
[ 13, 3, 13, 2, 1348148442 ]
def __init__(self, **argd): super(SchedulingComponent, self).__init__(**argd)
sparkslabs/kamaelia_
[ 13, 3, 13, 2, 1348148442 ]
def gemm_int8(n, m, l): A = te.placeholder((n, l), name="A", dtype="int8") B = te.placeholder((m, l), name="B", dtype="int8") k = te.reduce_axis((0, l), name="k") C = te.compute( (n, m), lambda i, j: te.sum(A[i, k].astype("int32") * B[j, k].astype("int32"), axis=k), name="C", ...
dmlc/tvm
[ 9142, 2938, 9142, 595, 1476310828 ]
def init(self, cwd): home = os.path.expanduser('~') self.text = cwd.replace(home, '~')
nimiq/promptastic
[ 83, 18, 83, 8, 1411731732 ]
def init(self, cwd): self.text = ' ' + glyphs.WRITE_ONLY + ' ' if os.access(cwd, os.W_OK): self.active = False
nimiq/promptastic
[ 83, 18, 83, 8, 1411731732 ]
def __init__(self, start_lineno, end_lineno, text): # int : The first line number in the block. 1-indexed. self.start_lineno = start_lineno # int : The last line number. Inclusive! self.end_lineno = end_lineno # str : The text block including '#' character but not any leading spa...
nguy/artview
[ 40, 19, 40, 33, 1411768406 ]
def __repr__(self): return '%s(%r, %r, %r)' % (self.__class__.__name__, self.start_lineno, self.end_lineno, self.text)
nguy/artview
[ 40, 19, 40, 33, 1411768406 ]
def __init__(self, start_lineno, end_lineno): self.start_lineno = start_lineno self.end_lineno = end_lineno
nguy/artview
[ 40, 19, 40, 33, 1411768406 ]
def __repr__(self): return '%s(%r, %r)' % (self.__class__.__name__, self.start_lineno, self.end_lineno)
nguy/artview
[ 40, 19, 40, 33, 1411768406 ]
def __init__(self): # Start with a dummy. self.current_block = NonComment(0, 0) # All of the blocks seen so far. self.blocks = [] # The index mapping lines of code to their associated comment blocks. self.index = {}
nguy/artview
[ 40, 19, 40, 33, 1411768406 ]
def process_token(self, kind, string, start, end, line): """ Process a single token. """ if self.current_block.is_comment: if kind == tokenize.COMMENT: self.current_block.add(string, start, end, line) else: self.new_noncomment(start[0], end...
nguy/artview
[ 40, 19, 40, 33, 1411768406 ]
def new_comment(self, string, start, end, line): """ Possibly add a new comment.
nguy/artview
[ 40, 19, 40, 33, 1411768406 ]
def make_index(self): """ Make the index mapping lines of actual code to their associated prefix comments. """ for prev, block in zip(self.blocks[:-1], self.blocks[1:]): if not block.is_comment: self.index[block.start_lineno] = prev
nguy/artview
[ 40, 19, 40, 33, 1411768406 ]