query
stringlengths
9
9.05k
document
stringlengths
10
222k
metadata
dict
negatives
listlengths
30
30
negative_scores
listlengths
30
30
document_score
stringlengths
4
10
document_rank
stringclasses
2 values
We test some special triangles in the space with K = 1. Some of these are not really triangles because at least one of the internal angles is a half turn. That's okay. We can have those tricks in elliptic spaces. As it turns out, setting an internal angle to a half turn can break some math, so we have to explicitly pre...
def test_elliptic_special_triangles(self): import itertools s = space(curvature=1) # turning constants in radians t1_ref = 6.28318530717958647692528676655867 t2_ref = t1_ref / 2 t3_ref = t1_ref / 3 t4_ref = t1_ref / 4 t5_ref = t1_ref / 5 t6_ref =...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_case_05_not_legal_triangle(self):\n self.__assert_equals_test_case([(4, 6, 11)], 'NotATriangle')", "def test_case_04_legal_triangle(self):\n self.__assert_not_equal_test_case([(4, 4, 8), (4, 5, 8)], 'NotATriangle')", "def is_triangular(k):\n n = 1\n x = k\n while True:\n ...
[ "0.6785054", "0.66178626", "0.64830756", "0.63352233", "0.6303577", "0.62006336", "0.61032647", "0.60597694", "0.5864631", "0.5759537", "0.5754516", "0.5689862", "0.567636", "0.5666725", "0.55375564", "0.5509058", "0.5490738", "0.5487952", "0.54855865", "0.54854155", "0.54753...
0.6915778
0
Test empty spheres, calculating forward direction. Should always be exactly 0.
def test_volume_surface_empty(self): for k in (0, -1, 1, 1.75, 0.325, 1/7, -1.75, -0.325, -1/7): s = space(fake_curvature=k) for name in ('sphere_s1', 'sphere_v2', 'sphere_s2', 'sphere_v3'): self.assertTrue(getattr(s, name)(0) == 0)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_zero(self):\n controller = LinearController(self.G, 2, mode='zero')\n sim = simulation.Simulation(self.G, controller, dt=self.dt)\n sim.run(self.dt)\n\n self.assertAlmostEqual(np.linalg.norm(controller.W.ravel()), 0.0)\n self.assertAlmostEqual(np.linalg.norm(controller.out), 0.0)", "def t...
[ "0.6179209", "0.6057597", "0.5894809", "0.5782827", "0.5771399", "0.5758407", "0.5756066", "0.57420456", "0.57096946", "0.5665829", "0.5646488", "0.562918", "0.56270415", "0.5611495", "0.5606809", "0.55532706", "0.5502718", "0.5464336", "0.5443221", "0.5437495", "0.54278857",...
0.6267693
0
Test Euclidean unit spheres, which are well known.
def test_euclidean_unit_spheres(self): s1_ref = 6.28318530717958647692528676655867 v2_ref = 3.14159265358979323846264338327933 s2_ref = 12.5663706143591729538505735331173 v3_ref = 4.18879020478639098461685784437218 s = space(curvature=0) self.assertTrue(isclose...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_euclidean_scale(self):\n\n s = space(curvature=0)\n\n magic = 77773.333773777773733\n for mul in (2, 5, 1/3, 1/11, magic, 1/magic):\n for name, dim in (\n ('sphere_s1', 1),\n ('sphere_v2', 2),\n ('sphere_s2', 2),\n ...
[ "0.74505097", "0.69038725", "0.68603736", "0.6717634", "0.6677434", "0.65598035", "0.6512877", "0.6422564", "0.6368456", "0.6308641", "0.6240542", "0.6225488", "0.61788404", "0.61787033", "0.6155752", "0.61406434", "0.61393404", "0.61102676", "0.61002564", "0.6056497", "0.604...
0.8051265
0
Tests known spheres living in the standard hyperbolic space with K = 1.
def test_hyperbolic_known(self): s = space(curvature=-1) for r, s1, v2, s2, v3 in ( ( 1.0, 7.38400687288264534755345768623, 3.4122762652849023064483572863, 17.3553873817714370876641814907, 5.11093270570828897693...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_sphere(self):\n fun = get_problem('sphere', self.dimension)\n self.assertEqual(fun(self.array), 0.0)", "def test_euclidean_unit_spheres(self):\n \n s1_ref = 6.28318530717958647692528676655867\n v2_ref = 3.14159265358979323846264338327933\n s2_ref = 12.5663706143...
[ "0.65751153", "0.64981425", "0.64172286", "0.63053083", "0.6305296", "0.6292287", "0.62617534", "0.61660874", "0.61299676", "0.6112958", "0.60942346", "0.6037207", "0.6035545", "0.596693", "0.5903822", "0.58570224", "0.5856301", "0.5831694", "0.5811496", "0.5785873", "0.57801...
0.7291587
0
Tests known spheres living in the standard elliptic space with K = 1.
def test_elliptic_known(self): s = space(curvature=1) for r, s1, v2, s2, v3 in ( ( 1.0, 5.28711812816291235777213197934, 2.88836579751364013754312174055, 8.89791299620185648000441978084, 3.4265431911359222768592...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_hyperbolic_known(self):\n\n s = space(curvature=-1)\n for r, s1, v2, s2, v3 in (\n (\n 1.0,\n 7.38400687288264534755345768623,\n 3.4122762652849023064483572863,\n 17.3553873817714370876641814907,\n 5.110932...
[ "0.6955921", "0.6562125", "0.65426576", "0.63965034", "0.62587875", "0.6192906", "0.6183409", "0.61530906", "0.6080105", "0.60328954", "0.6022416", "0.59649473", "0.59499574", "0.5934499", "0.59177715", "0.5857229", "0.58483464", "0.5841929", "0.58345735", "0.58339494", "0.58...
0.76352686
0
Tests specifically the nonEuclidean inverse 3sphere volume. There is no exact solution in terms of common math functions, so a root finding method must be used instead. This test measures the accuracy of the root finder when applied to this problem.
def test_inv_sphere_v3_root_find(self): import itertools for k in (0, -1, 1, 1.75, 0.325, 1/7, -1.75, -0.325, -1/7): s = space(fake_curvature=k) for m in itertools.chain( range(30), range(31,3000,100), map((1).__truediv__, range(3...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_sphere3(self):\n fun = get_problem('sphere3', dimension=2, lower=-65.536, upper=65.536)\n self.assertAlmostEqual(fun(np.zeros(2)), 0.0)", "def test_euclidean_unit_spheres(self):\n \n s1_ref = 6.28318530717958647692528676655867\n v2_ref = 3.14159265358979323846264338327...
[ "0.7392224", "0.70810056", "0.6940895", "0.65187335", "0.6407261", "0.6341273", "0.6341247", "0.63265955", "0.61343604", "0.6126103", "0.61205286", "0.6008647", "0.5981039", "0.5978299", "0.5963172", "0.5934231", "0.5932629", "0.59185505", "0.5906946", "0.590482", "0.5805089"...
0.7948197
0
Ensures that parallel transport in a space behaves as expected. Is a fake test. You have to give it a k.
def _test_parallel_transport(self, k=None): import itertools if k is None:raise ValueError('This should not get called') s = space(curvature=k) # require -P + P = 0 # require P + P = 2P # require P + P + P = 3P # for all K for rp in ( ((), 1...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_hyperbolic_parallel_transport(self):\n \n self._test_parallel_transport(k=0)", "def test_euclidean_parallel_transport(self):\n \n self._test_parallel_transport(k=0)", "def test_elliptic_parallel_transport(self):\n \n self._test_parallel_transport(k=1)", "def...
[ "0.7750075", "0.7497703", "0.74319524", "0.7401332", "0.60085374", "0.59019876", "0.5789399", "0.5776284", "0.5684237", "0.56629705", "0.5634839", "0.5633645", "0.560147", "0.55672383", "0.5510125", "0.55079865", "0.54636705", "0.5452782", "0.5437374", "0.5434006", "0.5388428...
0.78601015
0
Tests parallel transport's basic properties in Euclidean space.
def test_euclidean_parallel_transport(self): self._test_parallel_transport(k=0)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_hyperbolic_parallel_transport(self):\n \n self._test_parallel_transport(k=0)", "def test_scaled_parallel_transport(self):\n \n for k in (1/11, -1/11, 11, -2):\n self._test_parallel_transport(k=k)", "def test_elliptic_parallel_transport(self):\n \n s...
[ "0.690169", "0.68839544", "0.66677666", "0.60265386", "0.5773826", "0.55820554", "0.5514415", "0.54757637", "0.5462421", "0.5454913", "0.5383031", "0.5371346", "0.5349395", "0.53080094", "0.52761006", "0.5267213", "0.5255658", "0.52446043", "0.52371883", "0.5211919", "0.52087...
0.802461
0
Tests parallel transport's basic properties in elliptic space.
def test_elliptic_parallel_transport(self): self._test_parallel_transport(k=1)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_hyperbolic_parallel_transport(self):\n \n self._test_parallel_transport(k=0)", "def test_euclidean_parallel_transport(self):\n \n self._test_parallel_transport(k=0)", "def _test_parallel_transport(self, k=None):\n import itertools\n\n if k is None:raise ValueE...
[ "0.7212194", "0.64144737", "0.62950444", "0.62210226", "0.56587076", "0.54331285", "0.5326545", "0.5313648", "0.5280974", "0.52397805", "0.51966244", "0.5194338", "0.5179249", "0.5174629", "0.5150497", "0.5138369", "0.5124762", "0.5111094", "0.5100085", "0.5098185", "0.508425...
0.8073076
0
Tests parallel transport's basic properties in hyperbolic space.
def test_hyperbolic_parallel_transport(self): self._test_parallel_transport(k=0)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_elliptic_parallel_transport(self):\n \n self._test_parallel_transport(k=1)", "def test_scaled_parallel_transport(self):\n \n for k in (1/11, -1/11, 11, -2):\n self._test_parallel_transport(k=k)", "def test_euclidean_parallel_transport(self):\n \n se...
[ "0.65503067", "0.6478076", "0.6106701", "0.56816584", "0.55282414", "0.5459527", "0.539179", "0.5390013", "0.5302079", "0.52392846", "0.52331144", "0.5217139", "0.52112377", "0.5208241", "0.5190955", "0.5182852", "0.5178348", "0.5171387", "0.5170924", "0.5170869", "0.517024",...
0.7829674
0
Generates a hashable value that mushes together very close reals.
def r_soft_hash(x): if abs(x) < 1e-9:return 0 # round it to some number of bits b = ns.round(ns.log(abs(x)) / ns.log(2)) gran = 2**(b-30) return ns.round(x / gran) * gran
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def deterministicrandom(x):\n\n i = hash_value(x)\n\n r = 1.0 * i / MAX_HASH_VALUE\n return r", "def __hash__(self):\n return hash(self.floatvalue)", "def hash(x):\r\n return (randint(1,5*c)*x + randint(1,5*c))%c", "def hash_value(self, x, h_num):\n a, b, p = self.hfs[h_num]...
[ "0.6533022", "0.6443468", "0.61269015", "0.61181116", "0.59994906", "0.59986204", "0.5966723", "0.59238344", "0.5877845", "0.5772444", "0.5767287", "0.57667226", "0.57653415", "0.5706794", "0.56929314", "0.56909883", "0.5672388", "0.56683517", "0.5651308", "0.5630641", "0.559...
0.6631727
0
Combine configuration files from one or more INIstyle config files. The config files are merged together in order. Later configuration files can override earlier configuration files. Missing files are ignored. Use this mechanism for cascading configuration files. E.g. one config file is version controlled and the other...
def merge_config_files(*paths): config = configparser.ConfigParser() config.optionxform = str config.read(paths) return config
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def JoinFiles(files):\n configlet = ''\n for f in files:\n # Let IOErrors happen naturally.\n configlet = configlet + (open(f).read())\n return configlet", "def read_config_files(files):\n\n config = ConfigObj()\n\n for _file in files:\n _config = read_config_file(_file)\n if bool(_c...
[ "0.68929386", "0.66178846", "0.6601716", "0.6267914", "0.6220458", "0.61734957", "0.61432844", "0.609411", "0.6031849", "0.59446865", "0.5918481", "0.5917301", "0.5885888", "0.5854663", "0.58531386", "0.58508617", "0.5841272", "0.58308727", "0.58260787", "0.5825176", "0.58151...
0.75300986
0
Retrieve the actions that rewrite the dst IP field with the reg6 (the tunnel key), set the first bit of that field, and output to the metadata service OVS port. The IP is set to | 0x8000000, so that the transparent proxy can extract the from the source IP address, and be able to identify the source VM. reg6 holds the l...
def _get_rewrite_ip_and_output_actions(self, ofproto, parser): return [ parser.NXActionRegMove( src_field='reg6', dst_field='ipv4_src', n_bits=32, ), parser.NXActionRegLoad( ofs_nbits=nicira_ext.ofs_nbits(31, 31)...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_mgre6(self):\n\n self.pg0.config_ip6()\n self.pg0.resolve_ndp()\n\n e = VppEnum.vl_api_tunnel_encap_decap_flags_t\n\n for itf in self.pg_interfaces[3:]:\n #\n # one underlay nh for each overlay/tunnel peer\n #\n itf.config_ip6()\n ...
[ "0.55887836", "0.5479884", "0.5452113", "0.5363906", "0.52967083", "0.5087797", "0.5045197", "0.50237364", "0.5006752", "0.49903858", "0.49884826", "0.49827158", "0.49489847", "0.4937638", "0.49125248", "0.48586506", "0.48312843", "0.48102772", "0.48015597", "0.47816402", "0....
0.61151874
0
Execute when attempting to login Always hides login pane and shows landing pane
def evt_login(self, event): # Hide current pane, show PaneMain, then reset the active sizer and call Layout() self.parent.Hide() self.pane_landing.Show() self.parent.parent.SetSizer(self.szr_landing) self.parent.parent.Layout()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def do_login(self):\n if self.app.authentication_only:\n self.app.stop()\n else:\n self.set_screen(EXPLORER)", "def login(self):\n logging.debug(\"login called\")\n\n # Apply settings\n self.localisationsettings.apply_to_upcoming_session()\n self.ad...
[ "0.7815394", "0.76114935", "0.75114447", "0.73782104", "0.7086099", "0.70860827", "0.694391", "0.69265884", "0.6892636", "0.68859315", "0.68859315", "0.68859315", "0.68859315", "0.68519306", "0.6802683", "0.6780346", "0.67706794", "0.67156214", "0.67156214", "0.6616792", "0.6...
0.8377407
0
Execute when attempting to login Hide login pane and show landing pane if cryptographically correct
def evt_login(self, event): if self.pair_correct(self.wgt_txt_login_user.GetValue(), self.wgt_txt_login_pass.GetValue()): self.parent.Hide() self.pane_landing.Show() self.parent.parent.SetSizer(self.szr_landing) self.parent.parent.Layout() else: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def evt_login(self, event):\n\n # Hide current pane, show PaneMain, then reset the active sizer and call Layout()\n self.parent.Hide()\n self.pane_landing.Show()\n self.parent.parent.SetSizer(self.szr_landing)\n self.parent.parent.Layout()", "def loginFunc(self):\n usern...
[ "0.73419666", "0.7006049", "0.675788", "0.6750658", "0.66975725", "0.66956496", "0.66367173", "0.6597892", "0.6597892", "0.6536975", "0.65170026", "0.6490621", "0.64899105", "0.6463131", "0.64156824", "0.63922983", "0.63731635", "0.63709736", "0.63709736", "0.63604474", "0.63...
0.7739562
0
Get our dbus object path
def object_path(self): return self._object_path
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_session_dbus_path(self): # real signature unknown; restored from __doc__\n return \"\"", "def object_path(self) -> pulumi.Input[str]:\n return pulumi.get(self, \"object_path\")", "def object_path(self) -> pulumi.Input[str]:\n return pulumi.get(self, \"object_path\")", "def getPat...
[ "0.7495218", "0.6987704", "0.6987704", "0.6970987", "0.69123304", "0.66373616", "0.65228254", "0.65209997", "0.6476473", "0.64118946", "0.62681574", "0.6123544", "0.6089555", "0.60692525", "0.60354424", "0.59968865", "0.5993643", "0.5982713", "0.5954215", "0.59408486", "0.592...
0.7084319
1
Retrieve the Buddy object given a telepathy handle. buddy object paths are cached in self._handle_to_buddy_path, so we can get the buddy without calling PS.
def get_buddy_by_handle(self, handle): object_path = self._handle_to_buddy_path.get(handle, None) if object_path: buddy = self._ps_new_object(object_path) return buddy return None
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getMemberFromDiscordHandle(discordHandle: str):\n try:\n member_ = Member.objects(discordHandle=discordHandle).first()\n assert member_\n member = MemberInDBSchema(**memberHelper(member_))\n return member\n except AssertionError as _:\n # if the member is not found, rai...
[ "0.4902075", "0.47825253", "0.4766217", "0.47318393", "0.46783817", "0.46544975", "0.46172938", "0.45612574", "0.45394006", "0.45374295", "0.4520416", "0.45056188", "0.4496369", "0.44872782", "0.4484561", "0.4470926", "0.44643846", "0.44273815", "0.44185135", "0.43931916", "0...
0.86776
0
Invite the given buddy to join this activity.
def invite(self, buddy, message, response_cb): if not self._joined: raise RuntimeError('Cannot invite a buddy to an activity that is' 'not shared.') self.telepathy_text_chan.AddMembers( [buddy.contact_handle], message, dbus_i...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def invite(self):\n pass", "async def _invite(self, ctx: Context):\n\n # read_messages=True,\n # send_messages=True,\n # manage_messages=True,\n # embed_links=True,\n # attach_files=True,\n # external_emojis=True,\n # add_reactions=True\n perms = dis...
[ "0.61987996", "0.6170096", "0.59893394", "0.5978927", "0.59658635", "0.59631264", "0.59497863", "0.5945067", "0.5936418", "0.58792996", "0.5873772", "0.5821468", "0.58014494", "0.57364434", "0.5731148", "0.57045954", "0.5669671", "0.56314623", "0.56093043", "0.5597507", "0.55...
0.7882572
0
Join this activity. Emits 'joined' and otherwise does nothing if we're already joined.
def join(self): if self._join_command is not None: return if self._joined: self.emit('joined', True, None) return print('%r: joining', self) self._join_command = _JoinCommand(self.telepathy_conn, self.room_h...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def join(self):\n pass", "def on_join(self, raw_msg, source, **kwargs):", "def join(self):\n self.is_join = True\n self.task_queue.join()", "def join_in_play(self, join_in_play):\n\n self._join_in_play = join_in_play", "async def on_member_join(member: Member):\n await member...
[ "0.67922616", "0.6393024", "0.6327508", "0.6315994", "0.62906134", "0.6249136", "0.61668", "0.6152639", "0.61485624", "0.6147289", "0.6133736", "0.6122489", "0.6099519", "0.609449", "0.60848486", "0.6081262", "0.60756826", "0.60740197", "0.60560006", "0.60420173", "0.6030513"...
0.7549836
0
View that receives an emailed reset password code and returns the configuration needed for the reset password form.
def config_reset_pw(code: str) -> FluxData: current_app.logger.info(f'Configuring password reset form for {code}') try: state = get_pwreset_state(code) except BadCode as e: return error_response(message=e.msg) verify_email_address(state) new_password = generate_suggested_password()...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def password_reset(request):\n\n\tcontext_dict = {}\n\tif request.method == 'POST':\n\t\temail = request.POST.get('email')\n\t\tif email:\n\t\t\tuser = models.Teacher.objects.get(\n\t\t\t\tsoft_delete=False, user__email=email\n\t\t\t)\n\t\t\tif not user:\n\t\t\t\tcontext_dict[\"message\"] = \"Email ID does'nt exis...
[ "0.6775413", "0.66482735", "0.62620723", "0.6259335", "0.6126037", "0.611823", "0.6108669", "0.60901916", "0.608414", "0.605806", "0.60312814", "0.60085", "0.5953176", "0.5925009", "0.58991975", "0.5875717", "0.5874854", "0.58609086", "0.5806672", "0.5783163", "0.5761898", ...
0.7086484
0
Use a code to load resetpassword state from the database. Also validates the supplied password to make sure it conforms to the eduID service requirements.
def _load_data(code: str, password: str) -> ResetContext: try: state = get_pwreset_state(code) except BadCode as e: return ResetContext( state=None, # type: ignore user=None, # type: ignore error=e.msg, ) hashed = session.reset_password.generate...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def passwordCode(code):\n #Check if code exists and for the correct purpose. Else abort\n if (hl.checkCode(code,\"Password\")):\n user = hl.getUserFromCode(code)\n else:\n abort(404)\n\n if request.method == 'POST':\n #Get new password and handle\n passwordform(user)\n ...
[ "0.60857147", "0.60818064", "0.6011312", "0.59708774", "0.5936448", "0.59209585", "0.59119385", "0.5801701", "0.5741814", "0.57035", "0.56835026", "0.565484", "0.56530803", "0.55748385", "0.5574341", "0.55492884", "0.5540315", "0.54710513", "0.54568833", "0.54244035", "0.5419...
0.7338188
0
Backdoor to get the email verification code in the staging or dev environments
def get_email_code(): try: if check_magic_cookie(current_app.config): eppn = request.args.get('eppn') state = current_app.password_reset_state_db.get_state_by_eppn(eppn) return state.email_code.code except Exception: current_app.logger.exception( '...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check_verify_code(self):\n r = self.session.get(self.check_url)\n s = r.text\n data = json.loads(s[s.index('{'):-1])\n if data.get('codestring'):\n return data.get('codestring', \"\")\n return \"\"", "def get_verification_code(request):\n\n if request.user.get...
[ "0.67592806", "0.67007947", "0.6493546", "0.6440869", "0.6437159", "0.641755", "0.6387629", "0.6387355", "0.6249933", "0.61970425", "0.61804324", "0.6158881", "0.6142847", "0.61339813", "0.60936403", "0.6091487", "0.6072833", "0.60381573", "0.5995601", "0.5935036", "0.5921644...
0.78382355
0
Backdoor to get the phone verification code in the staging or dev environments
def get_phone_code(): try: if check_magic_cookie(current_app.config): eppn = request.args.get('eppn') state = current_app.password_reset_state_db.get_state_by_eppn(eppn) return state.phone_code.code except Exception: current_app.logger.exception( '...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def verify():\n if flask.request.method == 'POST':\n req = flask.request.get_json(force=True)\n phone = req.get('phone')\n code = req['code']\n return check_verification(phone, code)", "def check_verify_code(self):\n r = self.session.get(self.check_url)\n s = r.text\n...
[ "0.68846095", "0.6591913", "0.65255684", "0.6487852", "0.63976306", "0.6299125", "0.61487675", "0.6123713", "0.59546226", "0.59391266", "0.5932319", "0.5929865", "0.5903715", "0.58778876", "0.582757", "0.58274835", "0.5786587", "0.57843673", "0.5782237", "0.57252747", "0.5722...
0.77967805
0
A function that averages the b0 volumes from a DWI dataset. As current dMRI data are being acquired with all bvalues > 0.0, the lowb volumes are selected by specifying the parameter b0_thresh.
def b0_average(in_dwi, in_bval, b0_thresh=10.0, out_file=None): import os import numpy as np import nibabel as nib from nipype.pipeline import engine as pe from nipype.interfaces import fsl, utility as niu from nipype.utils.filemanip import fname_presuffix if out...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_avg(all_stock_data):\n try:\n sum_close_vol = 0.0\n sum_vol = 0.0\n for item in all_stock_data:\n adj_close = item[1]\n volume = item[2]\n sum_close_vol += adj_close * volume\n sum_vol += item[2]\n return sum_close_vol / sum_vol\n\n...
[ "0.5660612", "0.5573397", "0.55172306", "0.55024153", "0.5444286", "0.52889204", "0.5273515", "0.5253201", "0.5204515", "0.5175391", "0.5153606", "0.51225173", "0.5108477", "0.50973165", "0.5084805", "0.5068994", "0.50646317", "0.5060441", "0.5045053", "0.50349844", "0.502654...
0.76331246
0
Must take in a df with property_type, year, price_paid
def scatter(df): figs = [] for prop_type in df['property_type'].unique(): df_filt = df[df['property_type'] == prop_type] figs.append( go.Scatter(x=df_filt['year'], y=df_filt['price_paid'], mode='markers', marker=di...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def calc_base_year_data(base_year_vehicles_df):\n pass", "def estimate_year_data(self, years, frequency):\n data_year = self.price.index.year.unique()\n no_data_year = {pd.Period(year) for year in years} - {pd.Period(year) for year in data_year} # which years do we not have data for\n\n ...
[ "0.5599696", "0.5349119", "0.5228392", "0.52247417", "0.5206159", "0.51950336", "0.51813567", "0.5148165", "0.5124263", "0.5048654", "0.5015019", "0.50105673", "0.50031865", "0.4970045", "0.49300733", "0.4910056", "0.48689416", "0.48492813", "0.48253983", "0.47950813", "0.478...
0.5770806
0
Iterativni verze DFS (vcetne casovych znamek).
def dfs_iter(graph, start): # vkladam uzel a index potencialniho naslednika, kterym mam pokracovat stack = [(start, 0)] time = 1 graph.discovery_time[start] = time graph.visited[start] = True while stack: # not empty u, v = stack.pop() while v < graph.size and not is_edge(grap...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _dfs_iteration(self, v):\n stack1 = [v]\n self._visited[v] = True\n while stack1:\n curr = stack1.pop()\n for w in self._G.adj(curr):\n if not self._visited[w]:\n stack1.append(w)\n self._visited[w] = True\n ...
[ "0.635329", "0.6267519", "0.62544703", "0.6249329", "0.62105757", "0.6198627", "0.6136531", "0.6085186", "0.60729706", "0.60729706", "0.60670626", "0.60630107", "0.60464", "0.60457903", "0.60376525", "0.60370255", "0.60020214", "0.59775627", "0.59676546", "0.5966166", "0.5964...
0.6552896
0
Returns the device grid position as (col, row) of the a bit with the given wl and bl indices.
def _get_grid_coord(wl, bl): row = None col = None for i, (l, h) in QLDbEntry.wl_map.items(): if wl >= l and wl <= h: row = i break for i, (l, h) in QLDbEntry.bl_map.items(): if bl >= l and bl <= h: col = i ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def idx_2_loc(idx, board_size):\n return idx // board_size, idx % board_size", "def _coords_where(grid: np.array):\n xs, ys = np.where(grid == 1)\n return xs[0], ys[0]", "def getxy(dd):\n x = dd[0] & 31\n y = (dd[0] >> 5) + ((dd[1] & 1) << 3)\n return (8 * x, 8 * y)", ...
[ "0.58385", "0.580989", "0.57756436", "0.5730061", "0.5711783", "0.5705875", "0.56994283", "0.5659275", "0.56020164", "0.5590297", "0.558376", "0.5554042", "0.5551528", "0.5550854", "0.5530562", "0.552523", "0.54941106", "0.5491913", "0.54617363", "0.5452939", "0.54306096", ...
0.81219345
0
Expand csr adj matrix by adding empty adj rows and columns ex. add 2 in (4,4) > (6,6) with emtpy adj rows and columns returns expanded adj csr matrix
def expand_csr_adj(adj, count:int): r,c = adj.shape adj = sp.vstack( [adj, sp.csr_matrix(np.zeros((count, c)))]) adj = sp.hstack( [adj, sp.csr_matrix(np.zeros((r + count, count)))]) return adj
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def expand_conn_mat(conn_mat, nr_of_traps):\n\n r, c = conn_mat._shape\n new_indptr = np.hstack((conn_mat.indptr, np.asarray([conn_mat.indptr[-1]] * nr_of_traps)))\n expanded_mat = csr_matrix((conn_mat.data, conn_mat.indices, new_indptr),\n shape=(r + nr_of_traps, c + nr_of_tr...
[ "0.6682486", "0.6462939", "0.61911064", "0.6037702", "0.60104084", "0.59879917", "0.5984801", "0.5979223", "0.5978055", "0.59111536", "0.58948463", "0.5880816", "0.5870649", "0.5870649", "0.5870649", "0.5870649", "0.5870649", "0.5870649", "0.5870649", "0.5870649", "0.5870649"...
0.72706634
0
Remove all study tests if runstudy is not selected and reorder the study dependences to be executed incrementaly so any failed study test will abort the complete sequence. Mark a test with .mark.study to consider part of a study. Mark a test with .mark.study and named 'test_study_xxxx()' to be executed at the end when ...
def pytest_collection_modifyitems(config, items): # check if studio tests myst be skipped run_study = config.getoption("--runstudy") # 'all' will match all studies, '' will not match anything run_study = {'': '(?!x)x', 'all': '.*'}.get(run_study, run_study) # --runstudy given in cli: do not skip stu...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def deleteAllAnalysis(self, study_id):\n error_flag = 1\n \n try:\n con = self.getSFFDatabaseConnection()\n results = con.cursor().execute('select analysis_id from analysis where study_id = %s' % study_id)\n for result in results:\n db_output = c...
[ "0.6096985", "0.60025793", "0.56571573", "0.5648324", "0.5604837", "0.55861115", "0.5573595", "0.5561117", "0.5544009", "0.5462398", "0.5462398", "0.5462398", "0.54072267", "0.5394344", "0.5358149", "0.5356932", "0.5340624", "0.53337103", "0.52892214", "0.5275952", "0.5269674...
0.65293044
0
Checks whether an operation can be evaluated, i.e., if all of its operands have valid values.
def opOk(op, validRegs): for operand in op.operands: if not operand in reversed(validRegs): return False # If we make it here, they're all valid return True
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check_unsupported_ops(self):\n unsupported_ops_set = set()\n\n for op_idx in range(self.subgraph.OperatorsLength()):\n op = self.subgraph.Operators(op_idx)\n op_code_str = self.get_op_code_str(op)\n if op_code_str not in self.convert_map:\n unsuppor...
[ "0.6476276", "0.6394097", "0.6340853", "0.63230926", "0.63090014", "0.62042546", "0.62010115", "0.61888057", "0.6176852", "0.61631155", "0.6153548", "0.61298925", "0.6091279", "0.60580087", "0.60489607", "0.6042716", "0.59807086", "0.5966703", "0.5949537", "0.59341747", "0.59...
0.7577011
0
write a complex operation (more than one line of C)
def write_complex_op(writer, op, datatype): if op.name == "max": final_dst = mangle(op.result) # write a line of comment writer.writeln("// max {dst} <= ({src})"\ .format(dst=final_dst, src=str.join(' , ', mangle(op.operands)))) w.writeln("{dtype} {dst} = ({src1} > {src2}) ? {src1...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def complex_sum(c_1,c_2):\n return c_1 + c_2", "def complex(real, imag):", "def complex_multiplication(c1,c2,cr):\n cr[0] = c1[0]*c2[0] - c1[1]*c2[1]\n cr[1] = c1[0]*c2[1] + c1[1]*c2[0]\n return cr", "def write_arithmetic(self, command):\n\n # translate step ... dictionary?\n asm_co...
[ "0.6081686", "0.5941871", "0.593664", "0.57683897", "0.56886923", "0.5672335", "0.5666366", "0.5658384", "0.5645552", "0.56406206", "0.5628918", "0.55824", "0.552054", "0.55051297", "0.5495674", "0.5488578", "0.5475349", "0.5457753", "0.54537886", "0.5430712", "0.5416638", ...
0.6496581
0
Writes the main function which makes invocations to all the kernels. Arguments are the CodeWriter object to use, and the parsed toplevel DAG.
def write_main(w, dag): w.writeln("int main(int argc, char* argv[])"); w.writeln("{"); w.indent() head = dag.head # Get the edge which points to the first kernel w.writeln("int width = 256; // TODO change to match input image") w.writeln("int height = 256; // TODO change to match input image") w.writel...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def main_code():\n pass", "def main():\n print(\"Call your main application code here\")", "def main():\n print(\"Call your main application code here\")", "def main():\n print(\"Call your main application code here\")", "def main():\n\n pass", "def make_main_function(self):\n\t\tself.main...
[ "0.5649062", "0.5641166", "0.5641166", "0.5641166", "0.5569352", "0.55339825", "0.55320495", "0.55320495", "0.55320495", "0.55320495", "0.55320495", "0.55320495", "0.55320495", "0.55320495", "0.55320495", "0.55320495", "0.55320495", "0.55320495", "0.55320495", "0.55320495", "...
0.709869
0
This function takes model data, either from ParseSBMLFIle() or imported from a .json file, and generates a Python file containing a class that implements the SBML model.
def GenerateModel(modelData, outputFilePath, objectName = 'SBMLmodel'): #The library mathFuncs serves to both only allow functions supported #functions in SBML/user defined functions, but also the python equivalent np.set_printoptions(threshold=sys.maxsize) outputFile = open(outputFi...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def WriteSourceFileForCcmModel(filename, model):\n ccm_model_name = GetModelName(filename, model) # Get the name of the file we will write \n\n #Open to file to write\n source_file = open(ccm_model_name + \".cpp\", 'w')\n\n #Include header files\n included_files = GetIncludedFilesForSourceString(filename, mod...
[ "0.6511689", "0.6187038", "0.6185663", "0.61716515", "0.606072", "0.6058897", "0.6027571", "0.599391", "0.5953301", "0.5936221", "0.5933154", "0.58910257", "0.58764493", "0.5866927", "0.58588904", "0.58537984", "0.5841306", "0.5835582", "0.58156574", "0.581286", "0.58080274",...
0.68551207
0
processes url web scraping request If process has been done before, get result from database Otherwise, process and add data to database
def process_job(): r = redis.StrictRedis() while True: curr_job = r.blpop('job_queue', 0)[1] r.hset('status', curr_job, 'processing') print('current job ID:', curr_job) # convert byte to string url = r.hget('urls', curr_job).decode("utf-8") print('Current URL:', u...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def collect_web_sites(self):\n min_distance = None\n max_sequence_match = None\n index_string_match = index_distance = None\n self.collection = collections.OrderedDict()\n for i_web, web_row in self.company_urls_df.iterrows():\n # get the url first from the websites ta...
[ "0.6137185", "0.6053085", "0.60490817", "0.6008354", "0.60037744", "0.59811", "0.5911885", "0.58849186", "0.58775723", "0.5863087", "0.5700845", "0.5670062", "0.5649911", "0.5616629", "0.56039315", "0.55936897", "0.5593456", "0.55672157", "0.5561302", "0.55441695", "0.5537799...
0.6182768
0
Asks the user to enter the necessary information (server address, username, password and database name) to access the idoit CMDB. Returns dict The database information (server address, username, password and database name).
def db_specification(): db_specification_question = [ { 'type': 'input', 'message': 'Enter the IP address of your database server (use format yyx.yyx.yyx.yyx where \'y\' is optional):', 'name': 'server', 'validate': AddressValidator }, { ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def prompt(self, console: io.IO, step: str,\n args: Dict[str, Any]) -> Dict[str, Any]:\n new_args = dict(args)\n database_arguments = self._try_get_database_arguments(new_args)\n if self._is_valid_passed_arg(console, step, database_arguments,\n ...
[ "0.623317", "0.591136", "0.58039147", "0.57865345", "0.57500684", "0.5695038", "0.56270254", "0.55966073", "0.5565128", "0.55567575", "0.55519134", "0.5547525", "0.55419487", "0.5541768", "0.5510404", "0.54728776", "0.5458401", "0.54538673", "0.54469234", "0.5425879", "0.5424...
0.6562503
0
Asks the user to enter the necessary information (server address, username, password and api key) to access the idoit CMDB. Returns dict The CMDB information (server address, username, password and api key).
def api_specification(): api_specification_question = [ { 'type': 'input', 'message': 'Enter the IP address of your CMDB server (use format yyx.yyx.yyx.yyx where \'y\' is optional):', 'name': 'server', 'validate': AddressValidator }, { ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def newcred(self):\n return {'login': input('username: '),\n 'password': getpass.getpass()}", "def get_details(module):\n\n login_list = [module.params['login'], os.getenv('DCI_LOGIN')]\n login = next((item for item in login_list if item is not None), None)\n\n password_list = [mod...
[ "0.54950076", "0.54865944", "0.54838854", "0.54377407", "0.536948", "0.52557504", "0.52241933", "0.5204332", "0.51897955", "0.51897955", "0.5168611", "0.5159309", "0.5097972", "0.5062806", "0.5061082", "0.5046308", "0.5046116", "0.50413126", "0.5033875", "0.5027456", "0.49981...
0.6200359
0
Executes the method 'cmdb.category_info' of the idoit API for a given category. Gets the attributes associated with a category, its data types and the available values of the dialog type attributes.
def api_category_info(category, db_info, connection): res = {} attributes = [] types = {} dialogs = {} cat_body = json.loads("{\"version\": \"2.0\",\"method\": \"cmdb.category_info\",\"params\": {\"category\": \"" + category + "\", \"apikey\": \"" + apikey + "\",\"language\...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_category_info(category_id):\n uri = 'categories/' + category_id\n return self.make_request(uri)", "def info(self, categories=()):\n pp = pprint.PrettyPrinter(indent=4)\n print_text_box('Category')\n data = self.manager.data[\"category\"]\n if any(categories):\n ...
[ "0.70346516", "0.68663573", "0.62148243", "0.61588335", "0.5893368", "0.5854305", "0.5822536", "0.57245845", "0.57104754", "0.56638485", "0.5607138", "0.5566814", "0.55565566", "0.5546488", "0.55299306", "0.54602253", "0.54236513", "0.5393278", "0.5389908", "0.53723586", "0.5...
0.7059136
0
Gets the attributes its data types and the available values of the dialog type attributes associated with all the categories in the CMDB.
def category_attributes_types(categories, db_info, connection): attributes = {} for cat in categories: attributes[cat] = {} category_info = api_category_info(cat, db_info, connection) attr = {} for a in category_info.get("attributes"): for key in a: a...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_attributes(cls, entity):\n return entity.category.facts.all()", "def attributes(self):\n attrs_ = super(CategoricalAttributeSchema, self).attributes()\n attrs_.append(\"categories\")\n return attrs_", "def get_object_attributes(ci, cat_attr_types):\n res = {}\n object_...
[ "0.6545035", "0.6222602", "0.610149", "0.60318506", "0.5903051", "0.58105665", "0.5714443", "0.5613917", "0.55629236", "0.5540967", "0.5480121", "0.5432608", "0.5430816", "0.5428072", "0.5405988", "0.53957844", "0.5345944", "0.53422314", "0.5342102", "0.5335825", "0.5325689",...
0.7360134
0
Executes the method 'cmdb.object_type_categories.read' of the idoit API for a given object type. Gets the categories associated with an object type. Computes the attributes, its data types and the available values of the dialog type attributes of the object type, based on the categories associated with that type.
def get_object_attributes(ci, cat_attr_types): res = {} object_attributes = {} attributes_types = {} dialogs = {} obj_categories_body = json.loads("{\"version\": \"2.0\",\"method\": \"cmdb.object_type_categories.read\",\"params\": {\"type\": \"" + ci + "\", \"api...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_all_categories(type=None):\n \n categories = None\n if type is None:\n categories = get_db().execute('SELECT * FROM categories').fetchall()\n else:\n categories = get_db().execute('SELECT * FROM categories WHERE type = ?', (type,)).fetchall()\n\n return categories", "def cate...
[ "0.57005167", "0.5640345", "0.542464", "0.5412156", "0.512048", "0.510928", "0.5107854", "0.505514", "0.5002818", "0.4979435", "0.49490023", "0.49171302", "0.49106628", "0.48868898", "0.4882212", "0.48704296", "0.48591173", "0.4805582", "0.4803628", "0.47927102", "0.47875258"...
0.6738675
0
Processes the idoit CMDB data model, obtaining information about configuration item types, relationship types, configuration items and relationship attributes, restrictions between relationships, data types of attributes, and values for dialog type attributes. Returns dict Returns the CMDB information (server address, ...
def process_i_doit(): print(blue + "\n>>> " + reset + "Make sure that i-doit is running.") api_info = api_specification() server = api_info.get("server") username = api_info.get("username") password = api_info.get("password") api_key = api_info.get("api_key") connection = test_api_connecti...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def process_data():\n with open('configClear_v2.json') as config:\n json_config = json.load(config)\n cisco_ios_xe_native = json_config.get('frinx-uniconfig-topology:configuration').get('Cisco-IOS-XE-native:native')\n\n config_container = {\n \"BDI\" : cisco_ios_xe_native.get('in...
[ "0.54384476", "0.5315475", "0.514058", "0.5108165", "0.5004281", "0.49603048", "0.49539122", "0.49483043", "0.4927833", "0.48845214", "0.4863719", "0.48490322", "0.48377514", "0.48216245", "0.48202613", "0.48162708", "0.48069412", "0.47830808", "0.4773868", "0.47438708", "0.4...
0.6410339
0
Assert that the buttons named in the list are displayed, and any not named are not. Button names are the corresponding URL name, e.g. 'finaid_edit' or 'finaid_withdraw'.
def assert_buttons(self, button_list): rsp = self.client.get(self.dashboard_url) self.assertEqual(200, rsp.status_code) all_buttons = [ 'finaid_apply', 'finaid_withdraw', 'finaid_decline', 'finaid_accept', 'finaid_request_more', 'finaid_edit', 'finaid_status',...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_get_custom_buttons_list(self):\n pass", "def test_get_custom_button(self):\n pass", "def test_delete_custom_button(self):\n pass", "def test_create_custom_button(self):\n pass", "def test_update_custom_button(self):\n pass", "def test_display_names(self):\r\n ...
[ "0.7026239", "0.6407814", "0.6214333", "0.6130777", "0.61014014", "0.6049861", "0.6024431", "0.5942149", "0.5891831", "0.58767134", "0.5858021", "0.58351535", "0.58225065", "0.58186597", "0.57645494", "0.57308066", "0.57246614", "0.57072", "0.5704123", "0.5683497", "0.5669912...
0.83565146
0
This is primarily a test on the ModelMetaclass metaclass. It checks to see if class attributes that are not specifiying fields are left alone. For example...
def test_unrelated_attributes(self): # Create a simple class. We're going to test nearly exactly the # scenario described in the docstring above. class Foo(Model): unrelated = 2 notafield = 3 assert hasattr(Foo, "unrelated") assert Foo.unrelated == 2 ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_fields(self):\n\n class Foo(Model):\n field1 = StringField()\n field2 = IntegralField()\n\n assert hasattr(Foo, \"_fields\")\n assert type(Foo._fields) is dict\n\n assert not hasattr(Foo, \"field1\")\n assert \"field1\" in Foo._fields\n asser...
[ "0.7035361", "0.69811285", "0.6904108", "0.67678523", "0.67373145", "0.6682075", "0.6678829", "0.6671852", "0.6653308", "0.6648055", "0.66260177", "0.6615606", "0.6561509", "0.6526455", "0.64963186", "0.6469788", "0.6461886", "0.6460575", "0.64463663", "0.6424864", "0.6411709...
0.76068306
0
This will ensure that a model's ``_fields`` attribute gets set correctly and that all field defintion attributes get removed from the class.
def test_fields(self): class Foo(Model): field1 = StringField() field2 = IntegralField() assert hasattr(Foo, "_fields") assert type(Foo._fields) is dict assert not hasattr(Foo, "field1") assert "field1" in Foo._fields assert type(Foo._fields["fi...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def remove_all_fields(self):\n self.fields = None", "def add_base_fields(self) -> None:\n for field in get_model_fields(self.model, foreign=False, m2m=False):\n if hasattr(self.factory, field.name) or field.has_default() or field.blank:\n continue\n setattr(\n ...
[ "0.7173227", "0.63981164", "0.62545323", "0.6240297", "0.62270194", "0.62028563", "0.6155798", "0.61546785", "0.6117733", "0.61072665", "0.6103596", "0.6096458", "0.60354257", "0.5986335", "0.59686047", "0.59482175", "0.5945608", "0.58946544", "0.58771014", "0.5871311", "0.58...
0.653192
1
A simple smoke test to ensure that an empty model doesn't cause any errors. I don't see a use case for an empty model but that doesn't mean it should be taken off the table.
def test_empty_model(self): class Foo(Model): pass assert hasattr(Foo, "_fields") assert type(Foo._fields) is dict assert len(Foo._fields.items()) == 0
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_db_is_empty(dbtransaction, model_name):\n model = globals()[model_name]\n query = DBSession.query(model)\n assert query.count() == 0", "def test_model():\n pass", "def test_save(self):\n my_model = BaseModel()\n my_model.save()\n self.assertEqual(\"\", \"\")", "def t...
[ "0.76182103", "0.7321933", "0.7104622", "0.6980465", "0.6900283", "0.6796985", "0.6796985", "0.67421013", "0.6724438", "0.668351", "0.6683181", "0.66519624", "0.66348994", "0.66348904", "0.66175044", "0.66025126", "0.6590779", "0.65536124", "0.6543984", "0.6536205", "0.652996...
0.77066725
0
Tests to ensure Model.from_dict() works as advertised.
def test_from_dict(self): class Person(Model): name = StringField() age = IntegralField(bounds = (0, None)) siblings = ListField(of = StringField()) # In the normal case where all the data coincides with fields # correctly. person1 = Person.from_dict...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_create_from_dict(self):\n b1 = BaseModel()\n b1.name = \"Holberton\"\n b1.my_number = 89\n my_model_json = b1.to_dict()\n b2 = BaseModel(**my_model_json)\n self.assertEqual(b1.my_number, b2.my_number)\n self.assertEqual(b1.id, b2.id)\n self.assertEqu...
[ "0.7688621", "0.731317", "0.72200084", "0.72200084", "0.72200084", "0.72200084", "0.72200084", "0.72200084", "0.72200084", "0.72200084", "0.72200084", "0.72200084", "0.72200084", "0.72200084", "0.72200084", "0.72200084", "0.72200084", "0.72200084", "0.72200084", "0.72200084", ...
0.7694948
0
This function takes the fleet request and repackages it for the integral run function
def process_request(self, fleet_request): ts = fleet_request.ts_req # starting time dt = int(fleet_request.sim_step.total_seconds()) #fleet_request.sim_step # Sim_step is how long a simulation time step # dt in timedelta format p_req = fleet_request.P_req q_req = fleet_reque...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def forecast(self, requests):\n responses = []\n SOC = self.SOC \n\n for number in range(self.numHVAC): #loop through all HVACs\n TinRB = self.TinInitialB[number]\n TwallRB = self.TwallInitialB[number]\n TmassRB = self.TmassInitialB[number]\n TatticR...
[ "0.5603678", "0.55000484", "0.5397259", "0.52461594", "0.5241967", "0.51483536", "0.50361705", "0.50045604", "0.4977979", "0.49461743", "0.49348238", "0.49034622", "0.48660243", "0.48566574", "0.48392814", "0.48388728", "0.48346585", "0.48311907", "0.48034987", "0.4800856", "...
0.70251656
0
This function repackages the list of fleet requests passed to it into the interal run function. Inorder for this to be a forecast, and therfore not change the state variables of the fleet, the fleets state variables are saved before calling the run function and then the states are restored to their initial values after...
def forecast(self, requests): responses = [] SOC = self.SOC for number in range(self.numHVAC): #loop through all HVACs TinRB = self.TinInitialB[number] TwallRB = self.TwallInitialB[number] TmassRB = self.TmassInitialB[number] TatticRB = self.Tatt...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def process_request(self, fleet_request):\n ts = fleet_request.ts_req # starting time\n dt = int(fleet_request.sim_step.total_seconds()) #fleet_request.sim_step # Sim_step is how long a simulation time step\n # dt in timedelta format\n p_req = fleet_request.P_req\n q_req = f...
[ "0.5565845", "0.5253745", "0.5064236", "0.5052433", "0.49930438", "0.49358818", "0.4810992", "0.47958168", "0.47889334", "0.4787796", "0.4787228", "0.47104785", "0.46797025", "0.46657273", "0.46376", "0.46286523", "0.4625263", "0.46239078", "0.46135718", "0.460224", "0.459936...
0.668599
0
Method to run baseline simulation and store power level and SOC of the sub fleets.
def run_baseline_simulation(self): n_days_base = 1 # Only consider 1 day simulation, self.n_days_base sim_time = 24*3600 # one day in seconds print("Running day-ahead baseline simulation ...") print("Running baseline right away charging strategy ...") baseline_so...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def run_baseline_right_away(self, n_days_base, sim_time):\n baseline_power = np.zeros([sim_time, ])\n baseline_cycles = np.zeros([sim_time, ])\n baseline_Tin = np.zeros([sim_time, ])\n baseline_std_Tin = np.zeros([sim_time, ])\n baseline_Tin_max = np.zeros([sim_time, ])\n ...
[ "0.6887113", "0.61886454", "0.6088955", "0.6047482", "0.6029752", "0.598695", "0.59530514", "0.59267527", "0.58819336", "0.58748317", "0.5870302", "0.5862298", "0.5842637", "0.5777946", "0.5742119", "0.57405114", "0.57309926", "0.5723019", "0.5705529", "0.56960386", "0.569502...
0.7207775
0
Method to run baseline with 1day ahead simulation strategy
def run_baseline_right_away(self, n_days_base, sim_time): baseline_power = np.zeros([sim_time, ]) baseline_cycles = np.zeros([sim_time, ]) baseline_Tin = np.zeros([sim_time, ]) baseline_std_Tin = np.zeros([sim_time, ]) baseline_Tin_max = np.zeros([sim_time, ]) baseline_Ti...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def run_baseline_simulation(self):\n n_days_base = 1 # Only consider 1 day simulation, self.n_days_base\n sim_time = 24*3600 # one day in seconds\n \n print(\"Running day-ahead baseline simulation ...\") \n print(\"Running baseline right away charging strategy ...\")\n ...
[ "0.7796109", "0.6591765", "0.6180871", "0.60403204", "0.59961075", "0.5947255", "0.5840754", "0.57210267", "0.568999", "0.5679814", "0.5662349", "0.56531763", "0.5647072", "0.5627002", "0.559042", "0.55835015", "0.5545629", "0.55335706", "0.5527392", "0.5512977", "0.5512904",...
0.69340163
1
This function allows weight to be passed to the service model. Scale the service to the size of the fleet
def assigned_service_kW(self): return self.service_weight*self.fleet_rating
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _set_server_weight(self, _v):\n\n if isinstance(_v, Group):\n for _, sg in _v.subgroups.items():\n self._set_server_weight(sg)\n else:\n if self.resource.CPU_avail > 0:\n _v.vCPU_weight = float(_v.vCPUs) / float(self.resource.CPU_avail)\n ...
[ "0.6014999", "0.55611324", "0.5471134", "0.5462697", "0.5383458", "0.5381737", "0.5370402", "0.5315857", "0.5266698", "0.5264894", "0.52504987", "0.5236043", "0.5230685", "0.52030444", "0.5181284", "0.5137598", "0.5115968", "0.511532", "0.50973296", "0.50949883", "0.5072908",...
0.6354361
0
This function is to dump the performance metrics either to screen or file or both
def print_performance_info(self): pass
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def dump(self):\n fmt='%20s:%10.4fs%6.1f%%'\n print('\\n----------------TIME MANAGER PROFILE----------------\\n\\n')\n total_t=time.time()-self.tic0\n for rec in self.record:\n print(fmt % (rec[0],rec[1],100.0*rec[1]/total_t))\n print(fmt % ('TOTAL ELAPSED TIME', total...
[ "0.64944273", "0.6451561", "0.62935054", "0.61514", "0.6065498", "0.59240586", "0.5890732", "0.58831537", "0.5809699", "0.5805675", "0.58051765", "0.5758897", "0.57375693", "0.57144415", "0.57066286", "0.5671816", "0.5663156", "0.56500685", "0.564774", "0.55871534", "0.558365...
0.6750198
0
Convert quantity from one unit to another Both units must be valid otherwise throw a ValueError
def convert_from_to(from_unit, to_unit, quantity): if not is_valid_unit(from_unit): raise ValueError('Invalid from_unit: {}. Cannot convert.'.format(from_unit)) if not is_valid_unit(to_unit): raise ValueError('Invalid to_unit: {}. Cannot convert.'.format(to_unit)) return quantity * CONVERSIO...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def ensure_unit(arg, unit):\n if not isinstance(arg, u.Quantity):\n arg = arg * unit\n return arg.to(unit)", "def convertUnit(*args, fromUnit: AnyStr=\"\", toUnit: AnyStr=\"\", **kwargs)->float:\n pass", "def cast_value(value, unit):\n if isinstance(value, u.Quantity):\n return value....
[ "0.6742433", "0.65793145", "0.652703", "0.64900696", "0.64706016", "0.64391404", "0.64194894", "0.640627", "0.6402194", "0.638275", "0.627444", "0.62331903", "0.62312245", "0.62237173", "0.619761", "0.617458", "0.6145829", "0.6113658", "0.6066363", "0.60138667", "0.59916276",...
0.7393124
0
Combine quantities to the largest unit i.e. if the units are teaspoon and cups, use cups cups and gallons, use gallons
def combine_to_largest(unit_one, quant_one, unit_two, quant_two): unit = get_largest_unit([unit_one, unit_two]) final_quant = 0 if unit == unit_one: final_quant = quant_one final_quant += convert_from_to(unit_two, unit_one, quant_two) else: final_quant = quant_two final_...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def determine_quantifier(self, rep):\n \n quant1 = rep[0][0]\n quant2 = rep[1][0]\n \n quant = self.quantity_order[max(self.quantity_order.index(quant1), self.quantity_order.index(quant2))]\n\n pol1 = rep[0][1]\n pol2 = rep[1][1]\n \n if pol1 !...
[ "0.60678166", "0.59380335", "0.5771496", "0.5479698", "0.52677786", "0.52322227", "0.5216371", "0.5207954", "0.5190054", "0.5155561", "0.5147255", "0.5141791", "0.51289165", "0.51156926", "0.5109303", "0.510025", "0.50743055", "0.50582874", "0.5054929", "0.5009327", "0.500789...
0.71540993
0
Creates a default kernel configuration suitable for general purpose inference.
def default_kernel_config(defn): return [('beam', {}), ('hypers', { 'alpha_a': 4.0, 'alpha_b': 2.0, 'gamma_a': 3.0, 'gamma_b': 6.0 } )]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def default_kernel_config(defn):\n # XXX(stephentu): should the default config also include cluster_hp?\n return list(it.chain(\n default_assign_kernel_config(defn),\n default_feature_hp_kernel_config(defn)))", "def default_assign_kernel_config(defn):\n # XXX(stephentu): model_descriptors ...
[ "0.74144924", "0.6838789", "0.6592082", "0.64635545", "0.6411498", "0.63359565", "0.632328", "0.62828684", "0.6234969", "0.6224955", "0.61927974", "0.61564916", "0.6093583", "0.60741735", "0.60509866", "0.60347563", "0.600892", "0.5892863", "0.58761615", "0.58485025", "0.5840...
0.7827043
0
returns 1 if the point is inside any obstacles 0 otherwise
def inside_obstacle(point, obstacle): for obs in obstacle: if point[0] > obs[0][0] and point[0] < obs[0][2] and point[1] > obs[1][0] and point[1] < obs[1][2]: return 1 return 0
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_in_obstacle(self, x: float, y: float) -> bool:\n for obstacle in self.obstacles:\n if obstacle.contains_point((x, y)):\n return True\n return False", "def through_obstacle(line, obstacles):\r\n noofpoints = 100\r\n for i in range(noofpoints):\r\n if ins...
[ "0.7569299", "0.75461394", "0.75419754", "0.7019176", "0.70144844", "0.69907904", "0.68982977", "0.6818476", "0.6774961", "0.67379445", "0.667127", "0.66310084", "0.6615502", "0.66107047", "0.6606105", "0.6582978", "0.6573739", "0.65736836", "0.6563211", "0.6532585", "0.65290...
0.83202106
1
returns 1 if the line goes through any obstacles 0 otherwise
def through_obstacle(line, obstacles): noofpoints = 100 for i in range(noofpoints): if inside_obstacle((line[0]+(i*(line[2]-line[0])/noofpoints), line[1]+(i*(line[3]-line[1])/noofpoints)), obstacles) == 1: return 1 return 0
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def through_obstacle(line, obstacles):\r\n noofpoints = 20\r\n for i in range(noofpoints):\r\n if inside_obstacle((line[0]+(i*(line[2]-line[0])/noofpoints), line[1]+(i*(line[3]-line[1])/noofpoints)), obstacles) == 1:\r\n return 1\r\n return 0", "def inside_obstacle(point, obstacle):\r\...
[ "0.83298516", "0.70356375", "0.70356375", "0.6898896", "0.66213125", "0.65483385", "0.651757", "0.6484251", "0.64774984", "0.64544386", "0.64029086", "0.6400726", "0.631961", "0.6308965", "0.6240248", "0.62180096", "0.6195371", "0.61729157", "0.61674595", "0.61392033", "0.612...
0.83002037
1
Handle the way AC calls the update fn at intervals
def acUpdate(deltaT, acUpdateFn): def _tick(): """ Tk callback function """ controls[0].root.after(deltaT, _tick) acUpdateFn(deltaT) _tick() # Set it going mainloop() # Tk main loop handling events
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def acUpdate(deltaT):\n pass", "def update(self, dt):", "def update(self, dt):", "def acUpdate(deltaT):#-------------------------------- AC UPDATE\n pass # -> Delete this line if you do something here !", "def update():", "def update():", "def _update_handler(self, state):\n self._schedule...
[ "0.71068", "0.67800015", "0.67800015", "0.6670413", "0.6617523", "0.6617523", "0.65877485", "0.65714896", "0.6533575", "0.64740175", "0.6470428", "0.6455222", "0.6455222", "0.64428294", "0.6395108", "0.6327671", "0.6327671", "0.6303288", "0.6270828", "0.6262636", "0.6257498",...
0.6947276
1
Print out the Findings.
def _print_findings(self) -> None: for ip_address in self._ip_addresses: print(f"{ip_address}")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def print_results(self):\n pass", "def report(self):\n print \"Got {} places from Wikipedia.\".format(len(self.places))\n print \"Got {} existing places.\".format(len(self.existing))\n print \"Found {} missing places:\".format(len(self.missing))\n print '\\n'.join(sorted(self.m...
[ "0.7260559", "0.6691037", "0.65187246", "0.64998674", "0.64645004", "0.6401034", "0.6352663", "0.6334338", "0.63276577", "0.6313319", "0.6283258", "0.62561816", "0.62449455", "0.62447506", "0.62074775", "0.6196157", "0.6190936", "0.61580926", "0.61496836", "0.614411", "0.6128...
0.77276826
0
Returns the first (and for most useful cases only) child of the requested type(s).
def get_child(self, *types: str) -> Optional[TgnObject]: children = list(self.get_children(*types)) return children[0] if children else None
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _get_child_page_of_type(self, cls):\n child = self.get_children().type(cls).live().first()\n return child.specific if child else None", "def _get_child_page_of_type(self, cls):\n child = self.get_children().type(cls).live().first()\n return child.specific if child else None", "d...
[ "0.7477584", "0.7477584", "0.71739036", "0.7149106", "0.6857292", "0.66444546", "0.6633797", "0.65352154", "0.647184", "0.62518984", "0.62391055", "0.62281156", "0.6195095", "0.61292017", "0.60893244", "0.6069538", "0.60682213", "0.6018202", "0.601378", "0.5999922", "0.596776...
0.75244075
0
Get objects if children already been read or get children. Use this method for fast access to objects in case of static configurations.
def get_objects_or_children_by_type(self, *types): objects = self.get_objects_by_type(*types) return objects if objects else self.get_children(*types)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_children(obj):\n ret = obj.to_dict()\n ret.__setitem__(\"disabled\", True)\n if obj.children.all():\n children = [get_children(j) for j in obj.children.all()]\n ret.__setitem__('children',children)\n return ret", "def get_children(obj):\n ret = obj...
[ "0.6348475", "0.63298637", "0.6277009", "0.62711835", "0.6237196", "0.6159255", "0.6156113", "0.6155365", "0.61170584", "0.6089099", "0.6030782", "0.6030782", "0.6030782", "0.60173565", "0.60084754", "0.6002531", "0.5997348", "0.59956175", "0.59926414", "0.59601575", "0.59593...
0.65530455
0
Returns all children of the requested type that have the requested attribute == requested value.
def get_objects_with_attribute(self, obj_type: str, attribute: str, value: str) -> List[TgnObject]: return [o for o in self.get_objects_by_type(obj_type) if o.get_attribute(attribute) == value]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def find(root, *, type=None, attrs={}, depth=10000):\n for child in root.get_children():\n assert isinstance(child, NodeNG)\n match = True\n if type and not isinstance(child, type):\n match = False\n if not all(_check_attr(child, key, value) for (key, value) in attrs.items...
[ "0.62692064", "0.61959255", "0.6129688", "0.60676503", "0.58746266", "0.57456374", "0.57456374", "0.5730761", "0.56680083", "0.5666754", "0.56216437", "0.56107014", "0.5610693", "0.559932", "0.5574028", "0.5562178", "0.5560661", "0.54851705", "0.5461284", "0.5440673", "0.5405...
0.6883142
0
Delete object from parent object.
def del_object_from_parent(self): if self.parent: self.parent.objects.pop(self.ref)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delete_parent(sender, instance, **kwargs):\n ItemRelation.objects.filter(child_id=instance.item_id).delete()", "def delete_object(self):\n qry = DeleteEntityQuery(self)\n self.context.add_query(qry)\n self.remove_from_parent_collection()\n return self", "def delete(self):\n ...
[ "0.76092917", "0.7581381", "0.74540186", "0.7398571", "0.73864806", "0.7336542", "0.7205444", "0.71713924", "0.71236825", "0.7088514", "0.69377583", "0.68271804", "0.68170685", "0.6729716", "0.6717615", "0.66638535", "0.66474724", "0.66282487", "0.66248226", "0.6583583", "0.6...
0.86842084
0
Object reference is unique, descriptive, ID within the objects tree. In some TGs (IxNetwork, STC, IxLoad...) the reference is maintained by the TG itself and is used for API calls. In others (Xena, TRex...) the reference is maintained by the TG package and may (Xena REST) or may not be used for API calls. If the refere...
def obj_ref(self) -> str: return str(self._data["objRef"])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getreferingobjs(idfindex, idfobject):\n idf, edges = eppystuff.an_idfedges(idfindex)\n refobjs = idfobject.getreferingobjs() \n keys = [refobj.key for refobj in refobjs] \n objnames = [refobj.obj[1] for refobj in refobjs] \n idfkeys = idf_helpers.idfobjectkeys(idf)\n keysobjsindexes = [(idf...
[ "0.6544107", "0.6318232", "0.6269989", "0.6207351", "0.6160805", "0.61263037", "0.61171544", "0.61098695", "0.61098695", "0.6083189", "0.6069175", "0.6023527", "0.6013511", "0.59910274", "0.59794784", "0.59367764", "0.5916986", "0.58786374", "0.5837168", "0.58283085", "0.5813...
0.661969
0
Object index is the index string used for API calls when object reference there is not used. Object index structure is something like chassis/card/port.
def obj_index(self) -> str: return str(self._data["index"])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def indirectobject(self, index, io):\n if self.indices != '':\n self.indices += ' '\n self.indices += '%d %d' % (index, len(self.ios))\n self.ios += io\n self.objects.append(index)", "def index_object(idxs=None):", "def build_lookup_index(item: Resource, index_string: str...
[ "0.6592128", "0.65340996", "0.60259515", "0.60065734", "0.5988418", "0.5982099", "0.5963192", "0.5876006", "0.585604", "0.57936275", "0.5789742", "0.57633686", "0.57564235", "0.5620079", "0.5551627", "0.55354106", "0.5528178", "0.5471983", "0.546359", "0.5451698", "0.5451698"...
0.74021393
0
Get all children of the requested types.
def get_children(self, *types: str) -> List[TgnObject]: pass
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_children(self, context: ResourceCommandContext, obj_ref: str, child_type: str) -> list:\n return self.handler.get_children(obj_ref, child_type)", "def get_objects_or_children_by_type(self, *types):\n\n objects = self.get_objects_by_type(*types)\n return objects if objects else self.g...
[ "0.72358215", "0.7222748", "0.71247965", "0.711299", "0.70405567", "0.69818324", "0.69770044", "0.69341606", "0.6881589", "0.68810886", "0.6875384", "0.68442726", "0.68442726", "0.68442726", "0.6793628", "0.6793527", "0.6790291", "0.6776441", "0.67437786", "0.6729677", "0.672...
0.7986228
0
Read attribute as list of references and return an object for each of them. For each reference in the attribute, return its object if exists in the objects tree or create new object under the self object. Return empty list for empty attribute.
def get_objects_from_attribute(self, attribute: str) -> List[TgnObject]: pass
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_objs_with_attr(self, attribute_name, location=None):\n from src.objects.models import ObjAttribute\n lstring = \"\"\n if location:\n lstring = \", db_obj__db_location=location\" \n attrs = eval(\"ObjAttribute.objects.filter(db_key=attribute_name%s)\" % lstring)...
[ "0.55443406", "0.52514434", "0.52497977", "0.5241852", "0.519537", "0.5191496", "0.51789993", "0.51670545", "0.51361424", "0.50733924", "0.5068388", "0.5053346", "0.5023865", "0.50108474", "0.5007192", "0.50012773", "0.4986339", "0.4982214", "0.49784976", "0.49589598", "0.494...
0.65419996
0
Returns the object class based on parent and object type.
def get_obj_class(self, obj_type: str) -> Type[TgnObject]: pass
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def XtremObjFactory(object_type, object_data, parent_connection):\r\n for cls in XtremObject.__subclasses__():\r\n if cls.is_class_for(object_type):\r\n return cls(object_data, parent_connection)", "def get_cls_for(obj_type):\n return {\n \"workflow\": Workflow\n }[obj_type]", "def ...
[ "0.69420457", "0.6853411", "0.67446315", "0.6743465", "0.6673648", "0.6624572", "0.6604573", "0.657048", "0.64744884", "0.64466435", "0.6416765", "0.64149284", "0.64121443", "0.6375733", "0.63584584", "0.6355152", "0.6318538", "0.63038915", "0.6276045", "0.6267213", "0.622397...
0.69912
0
Extracts additional page information.
def _extract_page_info(article: dict, url: str) -> dict: if not article: return {} language = detect(article.get('content_text')) if len(language) > 2 and len(language[2]) > 1: language_code = language[2][0][1] else: language_code = None retur...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_page_info(self, document_code, page_code):\n if \".zip\" in self.filename:\n return self.zip.getinfo(document_code + '_' + page_code + '.xml')\n else:\n return", "async def extract(self, url: str) -> dict:\n\n page_raw = await self._page_fetcher.fetch_page(url)\...
[ "0.62727803", "0.60555565", "0.6025672", "0.5861944", "0.58541363", "0.5815214", "0.57963973", "0.57909447", "0.5776659", "0.57588863", "0.5745336", "0.56927675", "0.56691176", "0.5624428", "0.5622832", "0.5609268", "0.5572906", "0.55651397", "0.55602425", "0.5517829", "0.549...
0.64015627
0
Generate num_candidates initial candidates to seed the search.
def generate_candidates(self, size: int, num_candidates: int) -> List[np.ndarray]: return [self.seed(np.zeros(size, dtype=bool)) for _ in range(num_candidates)]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def main():\n argparser = parser()\n arguments = argparser.parse_args()\n candidates = sorted(arguments.candidates)\n random.seed(''.join(candidates))\n print(random.sample(candidates, arguments.number))", "def build_candidates(allowed_nodes=[identity], best_candidates=[], nb_candidates=200):\n ...
[ "0.63163626", "0.6235541", "0.60006076", "0.58500934", "0.5823114", "0.58174336", "0.58119214", "0.5751959", "0.57206935", "0.5697081", "0.56547433", "0.56255865", "0.5603143", "0.55921704", "0.55921704", "0.5555207", "0.5551856", "0.5551856", "0.55345416", "0.55222803", "0.5...
0.73431915
0
Generate new candidates by evolving the candidates according to the strategies's strategy. For each candidate, num_children new candidates are generated.
def generate_from_candidates(self, candidates: List[np.ndarray], num_children: int, force_randomization: bool = False, keep_parent: bool = False) -> List[np.ndarray]: replace = for...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def choose_mother(self, index):\n\n candidates = []\n while not candidates:\n tgt_age = int(sample_table(self.fertility_age_probs[index], self.rng)[0])\n tgt_prev_min = 0; tgt_prev_max = 100\n if self.params['use_parity']:\n # old\n # ...
[ "0.5899268", "0.58441246", "0.5771634", "0.57212865", "0.5644136", "0.5630381", "0.56204516", "0.5583275", "0.54609495", "0.5395171", "0.5369396", "0.53690106", "0.5364965", "0.5349409", "0.5291073", "0.5282632", "0.5242478", "0.51786464", "0.51603264", "0.51603264", "0.51451...
0.77406275
0
Function for calculating input size for mlp in combination with convolutional layers
def conv_mlp_layer_shape(input_shape: tuple, conv_feature_sizes: list, kernel: int, stride: int, padding: int, max_pool: tuple): input_shape_list = list(input_shape) for layer_number in range(len(conv_feature_sizes)): input_shape_list[0] = int((((input_shape_list[0] - k...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _input_size(self):\n return self.embedding_size + self.hidden_size", "def get_input_dim(self) -> int:\n raise NotImplementedError", "def get_conv1d_output_size(input_size, kernel_size, stride):\n return ((input_size - kernel_size)//stride) + 1", "def get_conv1d_output_size(input_size, kernel...
[ "0.7067984", "0.6601283", "0.6588639", "0.6588639", "0.6587332", "0.6449702", "0.6396491", "0.63729596", "0.6350756", "0.63328916", "0.62357175", "0.6235132", "0.6201205", "0.6192196", "0.6188027", "0.61840904", "0.6180104", "0.61695087", "0.6139794", "0.6133007", "0.61176866...
0.70416695
1
Function for building transpose convolutional block Attributes in_f number of input features out_f number of output features
def _conv2d_transpose_block(in_f, out_f, *args, **kwargs): return nn.Sequential( nn.ConvTranspose2d(in_f, out_f, *args, **kwargs), nn.BatchNorm2d(out_f), nn.ReLU(), nn.Dropout2d(p=0.2) )
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def conv_transpose_block(inputs, n_filters, strides=2, filter_size=[3, 3], dropout_p=0.0):\n\tconv = slim.conv2d_transpose(inputs, n_filters, kernel_size=[3, 3], stride=[strides, strides])\n\tout = tf.nn.relu(slim.batch_norm(conv, fused=True))\n\tif dropout_p != 0.0:\n\t out = slim.dropout(out, keep_prob=(1.0-dro...
[ "0.6395128", "0.6338475", "0.6300835", "0.62353903", "0.622288", "0.61985594", "0.617333", "0.609883", "0.60937667", "0.6081175", "0.6018511", "0.6013988", "0.6004077", "0.59768385", "0.59711707", "0.5954829", "0.59373033", "0.5933555", "0.59052765", "0.59052765", "0.590061",...
0.67304033
0
Get a uniquely identifying HWID from a device attached to a COM port The HWID of a device is (/ should be) a unique string that identifies it. Unlike the COM port, this string is intrinsic to the device and will never change. Referring to devices by these strings is therefore a robust way of doing things.
def get_hwid_from_com_port(com_port): matches = list(grep_serial_ports(com_port)) if not matches: raise RuntimeError("Device {} not found".format(com_port)) if len(matches) > 1: raise RuntimeError("Multiple matched for device {}".format(com_port)) return matches[0].hwid
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_com_port_by_hwid(hwid):\n matches = list(grep_serial_ports(hwid))\n if not matches:\n raise RuntimeError(\"Device {} not found\".format(hwid))\n if len(matches) > 1:\n raise RuntimeError(\"Multiple matched for device {}\".format(hwid))\n return matches[0].device", "def _get_devi...
[ "0.7227222", "0.68842614", "0.67626834", "0.6754502", "0.6700299", "0.6681616", "0.6653162", "0.66440845", "0.6619577", "0.65774214", "0.6403015", "0.6379091", "0.6323754", "0.6320567", "0.6282766", "0.627017", "0.6205268", "0.6203702", "0.61968535", "0.61848396", "0.6152376"...
0.8319605
0
Get the current COM port based on a uniquely identifying hardware ID of a device The HWID of a device is (/ should be) a unique string that identifies it. Unlike the COM port, this string is intrinsic to the device and will never change. Referring to devices by these strings is therefore a robust way of doing things.
def get_com_port_by_hwid(hwid): matches = list(grep_serial_ports(hwid)) if not matches: raise RuntimeError("Device {} not found".format(hwid)) if len(matches) > 1: raise RuntimeError("Multiple matched for device {}".format(hwid)) return matches[0].device
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_hwid_from_com_port(com_port):\n matches = list(grep_serial_ports(com_port))\n if not matches:\n raise RuntimeError(\"Device {} not found\".format(com_port))\n if len(matches) > 1:\n raise RuntimeError(\"Multiple matched for device {}\".format(com_port))\n return matches[0].hwid", ...
[ "0.7388374", "0.6607528", "0.6341872", "0.6159497", "0.6071301", "0.6008778", "0.5909209", "0.587977", "0.5866788", "0.58630955", "0.58630365", "0.5852136", "0.5849914", "0.5848422", "0.58410424", "0.58396673", "0.58356243", "0.5811734", "0.57971966", "0.5786719", "0.5759664"...
0.80849737
0
Decorator to cause a function to acquire an RLock for this id before it runs. RLocks are stored in the namespace of the class whose function is being decorated. Note that this decorator must be applied to a class method
def with_lock(f): @wraps(f) def wrapped(self, *args, **kw): with _locks[self.dev_id]: return f(self, *args, **kw) wrapped.__name__ = f.__name__ wrapped.__doc__ = f.__doc__ return wrapped
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def re_entrant_lock_decorator(function):\n\n @wraps(function)\n def _new_method(self, *arg, **kws):\n \"\"\"\n This will be the newly generated method.\n \"\"\"\n try:\n re_entrant_thread_lock.acquire()\n # call the actual function.\n return functi...
[ "0.7177868", "0.66189986", "0.6414745", "0.63244754", "0.6225038", "0.6220184", "0.61887574", "0.6072093", "0.60571027", "0.6056829", "0.6047109", "0.60377425", "0.60152406", "0.60036045", "0.59899116", "0.5971194", "0.59694916", "0.58521724", "0.5836638", "0.5814339", "0.579...
0.6864559
1
Decorator to wrap function in a try/except block, handling VISAIOErrors by flush()ing the device, then passing on the exception. This decorator expects the instance method self.instr.flush() to exit
def with_handler(f): @wraps(f) def wrapped(self, *args, **kw): try: return f(self, *args, **kw) except pyvisa.VisaIOError: self._flush_all_buffers() raise wrapped.__name__ = f.__name__ wrapped.__doc__ = f.__doc__ return wrapped
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def catch_io_errors(func):\n\n @wraps(func)\n def catch_io_errors_wrapper(*args, **kwargs):\n try:\n return func(*args, **kwargs)\n except ValueError as err:\n if \"I/O operation on closed file\" in str(err):\n # Here we are lying a little: the service is pr...
[ "0.60490763", "0.58964807", "0.587476", "0.5682345", "0.5599477", "0.5590844", "0.54379547", "0.5418906", "0.5410743", "0.54077643", "0.5406192", "0.5388332", "0.53821945", "0.53724164", "0.5355847", "0.5344946", "0.53269494", "0.5326538", "0.53179085", "0.53159094", "0.52917...
0.6460308
0
Make a new device driver If your child class also has an init function, don't forget to call `super().__init__()`! If you pass a simulation_object (a callable which returns an object which implements a method called "query" which takes a string as input and produces a string as output) then this driver can be run in si...
def __init__( self, *args, id=None, simulation=False, baud_rate=57600, command_separator=" ", **kwargs, ): logger.debug("Creating new driver object for device %s", id) self.command_separator = command_separator self.simulation = simula...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, addr, name=None, i2c=None):\n\n # Initialize the device and save the simulator\n super().__init__(addr, name=name, i2c=i2c)\n self.sim = None", "def __init__(self, simulator, sim_params):\n self.kernel_api = None\n\n if simulator == \"traci\":\n se...
[ "0.61960036", "0.6151352", "0.61269534", "0.6040944", "0.58551556", "0.5850262", "0.5809987", "0.5751357", "0.5697687", "0.56727403", "0.5662593", "0.5633159", "0.5540421", "0.55293876", "0.5488719", "0.54857534", "0.5480112", "0.54695004", "0.54672223", "0.5466742", "0.54567...
0.6724382
0
Get the VISA session for this device. This is stored in a shared namespace for this python session, so other GenericDrivers can access the same device in a threadsafe way, taking turns via .
def instr(self): logger.debug( "Getting instrument object from _visa_sessions for device %s", self.dev_id ) return _visa_sessions[self.dev_id]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def vga_session(self):\n gpu_driver = None\n if self.user['gpu_driver'] is True:\n\n # NVIDIA controller - append packages\n if 'nvidia' in self.user['vga_controller'].lower():\n\n if self.user['gpu_proprietary'] is True:\n hardvideo = self.packages['hardvideo'][3]\n\n...
[ "0.63188916", "0.62079155", "0.61990523", "0.6119575", "0.6106956", "0.60191673", "0.6007239", "0.5969272", "0.59343743", "0.5933888", "0.59272367", "0.59096307", "0.59043133", "0.59036005", "0.58883554", "0.58706117", "0.5866723", "0.58634555", "0.58125347", "0.58071786", "0...
0.62354535
1
Register a simulator for this class If you call this method with a function that creates a simulator (i.e. a factory function) then running this driver in simulation mode will be possible. Your simulator object must respond to obj.query(str) calls with a string.
def _register_simulator(cls, simulator_factory): if not callable(simulator_factory): raise ValueError("Expected a callable for simulator_factory") cls._simulator_factory = simulator_factory
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def register(regname):\n global simulator\n if simulator is None:\n print \"Program is not started.\"\n return\n try:\n return simulator.get_register(regname)\n except LookupError, e:\n print e, regname\n except:\n simulation_error()", "def __init__(self, simulat...
[ "0.6476919", "0.6180709", "0.60645866", "0.5661145", "0.5496849", "0.54706585", "0.5300944", "0.5237894", "0.5212967", "0.520598", "0.51784843", "0.51583177", "0.5130899", "0.5043382", "0.503916", "0.50369287", "0.5003116", "0.49975792", "0.4990403", "0.4981234", "0.4968101",...
0.65081614
0
Check the connection to the device You should override this method if you want checks in the setup
def check_connection(self): pass
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_verify_connection_to_a_device():", "def verify_connection(self):\n return self.device.verify_connection()", "def check_connectivity(self):\n r = self.run_cmd(\"get-state\")\n return r.startswith(\"device\")", "def test_check_connection(self):\n self.assertIsNotNone(app.ch...
[ "0.7967078", "0.7755688", "0.7668733", "0.76205784", "0.7527973", "0.75147897", "0.7491874", "0.7370518", "0.73558885", "0.72807133", "0.7250761", "0.7175832", "0.7135804", "0.7135804", "0.7107595", "0.7067539", "0.70352364", "0.70156896", "0.7003423", "0.70011926", "0.699444...
0.79483837
1
Scrape a list of the columnist names from the columnist page (cached)
def GetColumnistNames(): global columnistnames if not columnistnames: columnistnames = [] html = ukmedia.FetchURL( columnistmainpage ) soup = BeautifulSoup( html ) for a in soup.findAll( 'a', {'class':'author'} ): n = a.renderContents(None).strip() if not ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _extract_from_paginated(self, first_page, attribute_name):\n names = []\n current_page = first_page\n\n while True:\n names = names + [court[attribute_name] for court in current_page[\"results\"]]\n try:\n next_result = self._request(current_page[\"next...
[ "0.59053594", "0.5782198", "0.5708091", "0.564248", "0.56203896", "0.5600321", "0.5584418", "0.5583466", "0.5542279", "0.5531496", "0.5520405", "0.5501281", "0.5471169", "0.54646266", "0.5447476", "0.54270226", "0.53983355", "0.53770614", "0.5371858", "0.536522", "0.5345297",...
0.7607167
0
generate the gmail api service
def build_gmail_api_v1(): credentials = build_credentials() return googleapiclient.discovery.build('gmail', 'v1', credentials=credentials)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def main():\n credentials = get_credentials()\n http = credentials.authorize(httplib2.Http())\n service = discovery.build('gmail', 'v1', http=http)\n user_id = 'me'\n\n ## get_labels ##\n #print_all_labels(service,user_id)\n #fetch_and_store(service,user_id)\n #apply_rules()", "def build_...
[ "0.74287355", "0.740792", "0.7313291", "0.7311865", "0.72854173", "0.6968192", "0.6763807", "0.6545838", "0.65385956", "0.64152515", "0.63679975", "0.6356107", "0.61089766", "0.6063072", "0.60473853", "0.6004714", "0.59694874", "0.5959555", "0.5896976", "0.5769388", "0.576250...
0.7790779
0
Returns an argument from scenario.yaml definitions
def get_step_argument(self, name): sa = StepArgument.get(self._symbol) if sa: return sa.get(name)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def arg(self) -> Optional[pulumi.Input[str]]:\n return pulumi.get(self, \"arg\")", "def __call__(self):\n yaml_dict = self._val\n scenario = yaml_dict.get(\"scenario\")\n if not scenario:\n raise ScenarioFileInvalid(\n \"scenario.yml is invalid. 'scenario:' k...
[ "0.5828674", "0.5827602", "0.5713589", "0.5697645", "0.5672866", "0.5595048", "0.55873114", "0.5568439", "0.5554781", "0.5532308", "0.54993206", "0.54191446", "0.5399892", "0.53763884", "0.5361237", "0.5357023", "0.5338583", "0.5332195", "0.5319377", "0.5294847", "0.523751", ...
0.60538363
0
Returns an path to temporary file contains content specify in src if src is dict, returns src if not
def _source_path_reader(self, src, encoding="utf-8"): if src is None: return src if isinstance(src, dict) and "content" in src: with tempfile.NamedTemporaryFile(mode="w", encoding=encoding, delete=False) as fp: fp.write(src["content"]) return fp.na...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def missing_but_potential_file():\r\n tempf = tempfile.NamedTemporaryFile()\r\n fname = tempf.name\r\n tempf.close()\r\n return fname", "def getTmpTemplateFile(fname):\n return os.path.join(Configurations.getTmpTemplateDir(), fname)", "def make_temp_file():\n with tempfile.NamedTemporaryF...
[ "0.6398774", "0.6125456", "0.6054433", "0.601975", "0.59849596", "0.59731793", "0.59557056", "0.5892083", "0.58211905", "0.5722808", "0.57201606", "0.5720087", "0.57197934", "0.56877255", "0.56476957", "0.56103235", "0.5605271", "0.55720913", "0.55578476", "0.55344677", "0.55...
0.71839094
0
Store formula image metrics in the database
def store_sf_img_metrics(self): logger.info('Storing iso image metrics') rows = list(self._metrics_table_row_gen(self.job_id, self.sf_db_id, self.sf_metrics_df, self.sf_adduct_peaksn, self.metrics)) s...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_metrics_to_db(self) -> None:\n\n model = {\n 'id': 'model1',\n 'name': 'Housing Price Prediction',\n 'metrics': {\n 'mean_squared_error': mean_squared_error(self._y_test, self._predictions),\n 'mean_absolute_error': mean_absolute...
[ "0.56475717", "0.5622877", "0.55606866", "0.5551794", "0.5457279", "0.5447804", "0.54213566", "0.5358153", "0.53488094", "0.52939796", "0.5290803", "0.52508926", "0.5241197", "0.52404624", "0.52210796", "0.5186655", "0.5177741", "0.516288", "0.51363426", "0.5126588", "0.51147...
0.70675546
0
Calculates the gradient penalty loss for a batch of "averaged" samples. In Improved WGANs, the 1Lipschitz constraint is enforced by adding a term to the loss function that penalizes the network if the gradient norm moves away from 1. However, it is impossible to evaluate this function at all points in the input space. ...
def gradient_penalty_loss(y_true, y_pred, averaged_samples, wgan_gp_weight): # first get the gradients: # assuming: - that y_pred has dimensions (batch_size, 1) # - averaged_samples has dimensions (batch_size, nbr_features) # gradients afterwards has dimension (batch_size, nbr_features), b...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def gradient_penalty_loss(y_true, y_pred, averaged_samples):\r\n gradients = K.gradients(y_pred, averaged_samples)[0]\r\n # compute the euclidean norm by squaring ...\r\n gradients_sqr = K.square(gradients)\r\n # ... summing over the rows ...\r\n gradients_sqr_sum = K.sum(gradients_sqr,\r\n ...
[ "0.773423", "0.77076286", "0.770325", "0.770325", "0.770325", "0.763358", "0.75991595", "0.7541008", "0.72323287", "0.7055776", "0.6673007", "0.632991", "0.61392516", "0.61259454", "0.61170626", "0.6112625", "0.61096066", "0.61060077", "0.6064519", "0.60603124", "0.6058772", ...
0.7717175
1
Function to validate the versioning of all members for a given module.
def validate_module_versioning(module_name): module = sys.modules[module_name] _validate_continuous_versioning(module) _validate_missing_versioned_tags(module)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _validate_continuous_versioning(module):\n version_table = getattr(module, '__version_table__', {})\n\n # Loop all functions or classes with their given version mappings.\n for member_name, version_mapping in iteritems(version_table):\n # Get versions and sort them.\n versions = list(ver...
[ "0.7175204", "0.61462754", "0.58727735", "0.5842382", "0.57526714", "0.57136667", "0.5606562", "0.5594013", "0.5594002", "0.5573172", "0.55230325", "0.54286927", "0.5408659", "0.5366452", "0.5365079", "0.5354161", "0.53058594", "0.52937895", "0.5264583", "0.5249389", "0.52101...
0.69420403
1
Function to validate if the provided class inherits from the previous version of the class.
def validate_inheritance_for_class(cls): # Skip all non versioned classes. if hasattr(cls, '__version__'): # Strip the name from the version suffix. class_suffix = re.compile('V\d+$') class_base_name = class_suffix.split(cls.__name__)[0] for base in cls.__bases__: # ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def inherits_from(obj, a_class):\n if isinstance(type(obj), a_class) and type(obj) != a_class:\n return True\n return False", "def InheritsFrom(self,base_class,child_class):\n if self.CleanName(base_class) in child_class.split(\"(\")[-1]:\n return True\n else:\n r...
[ "0.69517183", "0.6859368", "0.68444675", "0.68444675", "0.68423146", "0.6807442", "0.6762344", "0.6751691", "0.6746373", "0.6746373", "0.67404824", "0.6739209", "0.6729949", "0.66877806", "0.66658944", "0.6665153", "0.6651074", "0.66035116", "0.65204495", "0.6457129", "0.6117...
0.7416218
0
Validate if there are no gaps in the versioning of functions and classes for the given module.
def _validate_continuous_versioning(module): version_table = getattr(module, '__version_table__', {}) # Loop all functions or classes with their given version mappings. for member_name, version_mapping in iteritems(version_table): # Get versions and sort them. versions = list(version_mappin...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _validate_missing_versioned_tags(module):\n version_table = getattr(module, '__version_table__', {})\n\n # Get all functions from the module.\n functions = inspect.getmembers(module, inspect.isfunction)\n functions_dict = dict(functions)\n function_names = list(functions_dict)\n\n # Get all c...
[ "0.7597549", "0.72045547", "0.64734215", "0.6442547", "0.61061597", "0.5937566", "0.5851375", "0.58491987", "0.5816502", "0.5765755", "0.5752488", "0.5734322", "0.5676609", "0.5649598", "0.56243765", "0.5577333", "0.55671126", "0.55500597", "0.5546537", "0.55462974", "0.55448...
0.7838657
0
Faster Wavelenght selector If passed lists it will return lists. If passed np arrays it will return arrays Fastest is using np.ndarrays fast_wav_selector ~10002000 quicker than wav_selector
def wav_selector(wav, flux, wav_min, wav_max, verbose=False): if isinstance(wav, list): # if passed lists wav_sel = [wav_val for wav_val in wav if (wav_min < wav_val < wav_max)] flux_sel = [flux_val for wav_val, flux_val in zip(wav,flux) if (wav_min < wav_val < wav_max)] elif isinstance(wav,...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def fast_wav_selector(wav, flux, wav_min, wav_max):\n if isinstance(wav, list): # if passed lists\n wav_sel = [value for value in wav if(wav_min < value < wav_max)]\n flux_sel = [value[1] for value in zip(wav,flux) if(wav_min < value[0] < wav_max)]\n elif isinstance(wav, np.ndarray):\n ...
[ "0.7052996", "0.54920894", "0.5436752", "0.53379834", "0.5280451", "0.5271129", "0.5144508", "0.51392746", "0.51123446", "0.51079917", "0.51049453", "0.50598246", "0.50344175", "0.5002501", "0.49814215", "0.49730885", "0.49549696", "0.49472266", "0.49402624", "0.49396223", "0...
0.7073856
0
Initializes the default config file of a given package.
def init_default_config_file_if_nonexistent(package, default_config): config_file = os.path.join(conf.PAULA_USER_CONFIG_DIR, package + conf.CONFIG_EXTENSION) debug('config_file = ' + config_file) if not os.path.exists(config_file): debug('making: \"' + config_file+ '\"') shutil.copyfile(defa...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _set_config():\n\n\tdebug_msg = \"load default config yaml file\"\n\tlogger.debug(debug_msg)\n\n\tconfig_file_parser(paths.CONFIG_FILE, override_options=True)", "def init():\n for config_filename in _config_utils.CONFIG_FILENAMES:\n if os.path.isfile(config_filename):\n config_filepath =...
[ "0.68396705", "0.6826241", "0.66835487", "0.66543883", "0.6633572", "0.6346195", "0.63432276", "0.63429683", "0.6329989", "0.6329989", "0.63153374", "0.6269031", "0.6263789", "0.6231584", "0.6228099", "0.6210079", "0.62059927", "0.6199285", "0.6186516", "0.61736774", "0.61710...
0.7247253
0
Prints a given debug string if debug is toggled on.
def debug(string): if conf.DEBUG: outputs.print_debug(string)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def debug_print(text):\r\n if settings.debug:\r\n print (text)", "def debug(debug_string, to_debug):\n if to_debug:\n print(\"DEBUG {0}: {1}\".format(strftime('%H:%M:%S'), debug_string))", "def cli(debug):\n print(f\"Debug mode is {'on' if debug else 'off'}\")", "def print_debug(msg):\...
[ "0.80627364", "0.79922235", "0.7852664", "0.78169703", "0.779482", "0.7751047", "0.77426666", "0.7722784", "0.76128215", "0.76128215", "0.7612132", "0.760379", "0.75829357", "0.75026757", "0.74743176", "0.7468696", "0.74285865", "0.74242526", "0.74242526", "0.7388221", "0.738...
0.8146083
0
Creates a table column that will create a table column that knows how to map the given ROW_TYPE to the type of the column passed in, the EXPECTED_ROW_TYPE. The column type of the given and created columns destinationColumn The existing column, which is based upon EXPECTED_ROW_TYPE, that we want to be able to use with t...
def createMappedTableColumn(self, destinationColumn: docking.widgets.table.DynamicTableColumn) -> docking.widgets.table.DynamicTableColumn: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_column_into_source(self, tap_type, table, new_column):\n run_query_method = getattr(self, f'run_query_tap_{tap_type}')\n run_query_method(\n f'ALTER TABLE {table} ADD {new_column[\"name\"]} int'\n )\n run_query_method(\n f'UPDATE {table} set {new_column[\"n...
[ "0.6016284", "0.5942979", "0.59024054", "0.5779561", "0.5646755", "0.5503675", "0.5257471", "0.5254199", "0.51976204", "0.518547", "0.51696867", "0.5169024", "0.5160067", "0.51464236", "0.51160705", "0.5088781", "0.5075925", "0.50715935", "0.5070789", "0.50283986", "0.4966069...
0.6698259
0
Filters out all the data points that don't have evidence in the given corpus This will only be used when only a sample of the corpus is used (for testing purposes)
def filter_data(data: List[dict], corpus: dict): corpus_doc_ids = list(corpus.keys()) data_to_keep = [] for d in data: evidence_docs = get_evidence_docs(d) for evidence_doc in evidence_docs: if evidence_doc in corpus_doc_ids: data_to_keep.append(d) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _check_samples(self, samples):\n check = [k not in self._samples for k in samples]\n num_not_in_vcf = np.sum(check)\n if num_not_in_vcf > 0:\n with open('/tmp/excluded.subjects', 'w') as f:\n for item in samples[np.array(check)]:\n f.write(\"%s\...
[ "0.6361318", "0.6335295", "0.600313", "0.59109133", "0.58922136", "0.58378917", "0.5788261", "0.57730836", "0.57625693", "0.57011586", "0.56857", "0.5643858", "0.5617604", "0.5586348", "0.5529099", "0.54720646", "0.5436433", "0.5436164", "0.54335773", "0.54274094", "0.5419971...
0.73949057
0
Retrieves documents using the Longformer model, which is a transformer model that can handle long sequences of text
def main(): parser = argparse.ArgumentParser( description="Retrieves documents using the Longformer model" ) parser.add_argument( "--doc_id_to_idx_path", default=None, type=str, help="Path to the doc id index map", ) parser.add_argument( "--data_path"...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def pretrained(name=\"longformer_base_4096\", lang=\"en\", remote_loc=None):\n from sparknlp.pretrained import ResourceDownloader\n return ResourceDownloader.downloadModel(LongformerEmbeddings, name, lang, remote_loc)", "def model_extract_document_embedding(self):\n input_ids = tf.keras.laye...
[ "0.5643278", "0.55868745", "0.5540086", "0.5537106", "0.54664177", "0.5390548", "0.5342449", "0.53389144", "0.5295635", "0.5278179", "0.5219889", "0.5189836", "0.5189061", "0.509528", "0.5088577", "0.5086785", "0.50813127", "0.5051759", "0.501102", "0.50023663", "0.5000452", ...
0.659186
0
Sorts a list of items. Uses selection sort to sort the list items.
def selection_sort(items): n = len(items) for j in range(n): # Find the index of the smallest item in the range(j,n) i_min = j for i in range(j + 1, n): if (items[i] < items[i_min]): i_min = i # Swap the items at j and i_min if needed. if i_m...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sort_list(self,list_):\r\n list_.sort()", "def selection_sort(items):\n # TODO: Repeat until all items are in sorted order\n # TODO: Find minimum item in unsorted items\n # TODO: Swap it with first unsorted item\n for x in range(len(items)):\n smallest_index = x\n if x!=len(i...
[ "0.7185858", "0.7079917", "0.706346", "0.7026816", "0.69851667", "0.68766314", "0.68710834", "0.68572956", "0.6842404", "0.6744232", "0.67374307", "0.67371863", "0.67279243", "0.670391", "0.66878474", "0.6678829", "0.663436", "0.6617034", "0.659046", "0.65727425", "0.6567849"...
0.7101158
1
Installs guest additions into the VM
def install_guest_additions(): vbox = Vbox(env.vm_name) print('Starting up to install guest additions...') with vbox as session: session.wait_for_ssh() session.install_guest_additions()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def AptInstall(vm):\n _Install(vm)", "def AptInstall(vm):\n _Install(vm)", "def YumInstall(vm):\n _Install(vm)", "def YumInstall(vm):\n _Install(vm)", "def YumInstall(vm):\n raise NotImplementedError", "def provision():\n sudo('chef-client')", "def AptInstall(vm):\n vm.InstallPackages(APT_PACK...
[ "0.7209158", "0.7209158", "0.6857306", "0.6857306", "0.6777804", "0.6587932", "0.6273153", "0.6226898", "0.6126725", "0.60870945", "0.5968156", "0.5964069", "0.59640443", "0.59222305", "0.5916055", "0.5888876", "0.58846956", "0.58798736", "0.58730334", "0.5870122", "0.5854424...
0.8942415
0
Remove an existing box from vagrant
def remove(): vbox = Vbox(env.vm_name) vbox.remove()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_remove_vm(self, instance_name):\n self.instances.pop(instance_name)", "def destroy():\n\n # Stop the program if no init has occurred.\n Vagrant.stop_if_not_init()\n\n # Run vagrant destroy from the vagrant folder.\n command = [\"vagrant\", \"destroy\"]\n cwd = S...
[ "0.67461723", "0.6677447", "0.64361465", "0.635315", "0.6081487", "0.6044876", "0.60095847", "0.59947544", "0.59840095", "0.5900969", "0.57848096", "0.57604766", "0.5759658", "0.57337326", "0.57304394", "0.5705412", "0.5699449", "0.5613792", "0.56057453", "0.5601585", "0.5588...
0.81459945
0
forecasts the mean of the last few values. If window_size =1, then this is equivalent to naive forecast
def moving_average_forecast(series, window_size): forecast= [] for time in range(len(series)- window_size): forecast.append(series[time:time + window_size].mean()) return np.array(forecast)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def moving_average(data, temporal_window=100):\n window = np.ones(temporal_window) / temporal_window\n return np.convolve(data, window, 'valid')", "def moving_average(data, window_size):\n window= np.ones(int(window_size))/float(window_size)\n return np.convolve(data, window, 'same')", "def get_SMA...
[ "0.6976889", "0.68846834", "0.6587607", "0.6578238", "0.6476088", "0.6458518", "0.64572054", "0.6450656", "0.63790214", "0.6326273", "0.6260354", "0.62472826", "0.6240487", "0.62306064", "0.61863303", "0.6140324", "0.613985", "0.6132012", "0.60663223", "0.6061814", "0.6045847...
0.7802717
0
returns all file instances of a given mage in a list of tuples (id, name)
def files_of(mage_id): cursor.execute('select tag.id, tag.name from tag, tagging as is_file_tagging, tagging where tag.id = tagging.child_id and tag.id = is_file_tagging.child_id and is_file_tagging.parent_id = ? and tagging.parent_id = ?', (settings['file'],mage_id)) return cursor.fetchall()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def instances(self):\n for d in os.listdir(self.directory):\n yield self.instance(self.directory, d)", "def _list(self):\n\n files = self.read_all_pages(\n self.metadata_url + 'nodes/' + self.backup_target_id +\n '/children?filters=kind:FILE')\n\n self.names_...
[ "0.60488933", "0.5990859", "0.592603", "0.5918055", "0.59109604", "0.5891108", "0.58450145", "0.57959586", "0.5770223", "0.5744949", "0.5722512", "0.57224417", "0.571334", "0.56979984", "0.569404", "0.56840324", "0.5653215", "0.56300837", "0.56023234", "0.55962867", "0.558907...
0.6684975
0