query stringlengths 9 3.4k | document stringlengths 9 87.4k | metadata dict | negatives listlengths 4 101 | negative_scores listlengths 4 101 | document_score stringlengths 3 10 | document_rank stringclasses 102
values |
|---|---|---|---|---|---|---|
Check if handler is in given state. | def is_state(self, name):
return name is self.curr_state | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def in_state(self, state):\n if state == self.get_state():\n return True\n return False",
"def has_state(self, state):\n try:\n self.state(state)\n return True\n except LookupError:\n return False",
"def _RequestInState(self, request_id, s... | [
"0.7426697",
"0.7097455",
"0.6821869",
"0.6612234",
"0.6575535",
"0.65548784",
"0.64853853",
"0.6430388",
"0.6425652",
"0.6384203",
"0.6241631",
"0.61888283",
"0.6128289",
"0.6092549",
"0.6084146",
"0.6070336",
"0.60688883",
"0.6020656",
"0.59877235",
"0.5905299",
"0.5902768"... | 0.62964165 | 10 |
Update current state to the next state. | def switch_to_state(self, Rover, name):
name.execute(Rover)
self.curr_state = name | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def next(self):\n self.state += 1\n if self.state > 1:\n self.state = 0",
"def next_state(self):\n\n # Increases current path index\n self.current_state_index += 1\n\n # Retrieves the current state in the path and updates it\n self.status = self.path_states[se... | [
"0.8243264",
"0.80072",
"0.79967105",
"0.79462737",
"0.77722096",
"0.7596338",
"0.7524022",
"0.74045163",
"0.70730585",
"0.70552343",
"0.7020462",
"0.69629675",
"0.69362724",
"0.6926146",
"0.68090254",
"0.6710653",
"0.670233",
"0.6698001",
"0.6650538",
"0.6625975",
"0.6623502... | 0.0 | -1 |
Check if rover is stuck for stucktime. | def is_stuck_for(self, Rover, stucktime):
exceeded_stucktime = False
# If not moving then check since when
if Rover.vel < 0.1:
if not Rover.timer_on:
self.starttime = time.time() # start timer
Rover.stuck_heading = Rover.yaw
Rover.time... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def check_timer(self, wanted_time):\n if time.time() - self.start_time >= wanted_time:\n return True\n return False",
"def check( self ):\n\n if ( self.alive is not None ) \\\n and ( time.time() > ( self.alive + self.timeout ) ):\n return False\n retur... | [
"0.6666799",
"0.6664595",
"0.6486526",
"0.64650047",
"0.6416942",
"0.6330225",
"0.62419987",
"0.61649776",
"0.6160066",
"0.61586726",
"0.6139238",
"0.6092504",
"0.60844237",
"0.6078041",
"0.6062674",
"0.6035044",
"0.6020915",
"0.6014414",
"0.5992468",
"0.59783554",
"0.5977313... | 0.7809134 | 0 |
Select and call the handler for the current state. | def execute(self, Rover):
# Ensure Rover telemetry data is coming in
if Rover.nav_angles is not None:
# State identifiers and corresponding handlers
select = {
self.state[0]: handlers.finding_wall,
self.state[1]: handlers.following_wall,
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def select_action(self, state):",
"def select_action(self, state):\n pass",
"def handle_state(self):\r\n if self.state == 'walk':\r\n self.walking()\r\n elif self.state == 'fall':\r\n self.falling()\r\n elif self.state == 'jumped on':\r\n self.jumped... | [
"0.6907128",
"0.6731488",
"0.66084135",
"0.6354466",
"0.63049924",
"0.6253788",
"0.62040585",
"0.61361915",
"0.6101182",
"0.6095581",
"0.60636765",
"0.6046037",
"0.6023885",
"0.6017401",
"0.5990175",
"0.59469223",
"0.59266454",
"0.5888165",
"0.58521974",
"0.5813708",
"0.57749... | 0.0 | -1 |
Returns the column expression for all required info retrieved by a user lookup. table is the users SQLAlchemy table object. Required to preserve type information for the columns. | def user_info_columns(table: SqlTable) -> Tuple:
return (
table.c.user_id,
table.c.system_id,
table.c.full_name,
table.c.email,
table.c.email_verified,
table.c.is_active,
table.c.last_login_try,
table.c.last_login_success,
table.c.failed_login... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_columns(self, table):\n if table not in self.columns:\n self.columns[table] = [\n row[0] for row in self.db.iter('describe ' + table)]\n return self.columns[table]",
"def column_expression(self, col):\n return getattr(func, self.impl.as_binary)(\n ... | [
"0.5745259",
"0.5605924",
"0.5448899",
"0.5417191",
"0.5409962",
"0.5288628",
"0.52642924",
"0.51959676",
"0.51773095",
"0.51639885",
"0.5146367",
"0.5129033",
"0.51231354",
"0.5118728",
"0.50761974",
"0.507446",
"0.49696645",
"0.49645376",
"0.49541008",
"0.49518165",
"0.4938... | 0.5730073 | 1 |
This gets a user's information using their email address. | def get_user_by_email(
payload: dict,
raiseonfail: bool = False,
override_authdb_path: str = None,
config: SimpleNamespace = None,
) -> dict:
engine, meta, permjson, dbpath = get_procdb_permjson(
override_authdb_path=override_authdb_path,
override_permissions_json=None,
rais... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_info(email):\n # Get the first user where _id=email\n user = models.User.objects.raw({\"_id\": email}).first()\n return user",
"def user(email):\r\n return User.objects.get(email=email)",
"def retrieve_user_details(self, email):\n if self.database is None:\n raise Exceptio... | [
"0.82725227",
"0.77963644",
"0.77104586",
"0.76816475",
"0.75360185",
"0.75176233",
"0.7509604",
"0.74749804",
"0.7451518",
"0.7397364",
"0.7394086",
"0.73823315",
"0.73815435",
"0.73730606",
"0.7362893",
"0.73591137",
"0.7346963",
"0.73314154",
"0.729441",
"0.7267444",
"0.72... | 0.665959 | 59 |
This looks up users by a given property. | def lookup_users(
payload: dict,
raiseonfail: bool = False,
override_authdb_path: str = None,
config: SimpleNamespace = None,
) -> dict:
engine, meta, permjson, dbpath = get_procdb_permjson(
override_authdb_path=override_authdb_path,
override_permissions_json=None,
raiseonfa... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_by_name(name):\n\n result = {}\n status = 404\n print id\n # nodes=Property.query.all()\n obj = Property.query.filter_by(name=name).filter(Property.users.contains(current_user)).first()\n if obj:\n result['prop'] = obj\n status = 200\n\n return result, status",
"def fin... | [
"0.62300926",
"0.6067969",
"0.5943762",
"0.59188056",
"0.5706132",
"0.56960666",
"0.5692054",
"0.56750697",
"0.5655693",
"0.56058204",
"0.55921626",
"0.55883545",
"0.55840635",
"0.5565883",
"0.5544491",
"0.5526449",
"0.5505984",
"0.5489687",
"0.54709125",
"0.54586387",
"0.544... | 0.0 | -1 |
Handles editing users. Meant for use internally in a frontend server. | def internal_edit_user(
payload: dict,
raiseonfail: bool = False,
override_authdb_path: str = None,
config: SimpleNamespace = None,
) -> dict:
engine, meta, permjson, dbpath = get_procdb_permjson(
override_authdb_path=override_authdb_path,
override_permissions_json=None,
rai... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def admin_edit_users():\n return user_management_handler(\"show_admin_edit_users\", \"new_users\", False)",
"def home_edituser():\n\tpass",
"def user_edit(request):\n DEBUG = False\n\n if not has_permission('editUser', request.context, request):\n #print \"NOT has_permission !!!!!!!!!!!!!!!!!!!... | [
"0.75599366",
"0.7547793",
"0.7443017",
"0.74281734",
"0.73656166",
"0.73652667",
"0.7292454",
"0.72814083",
"0.7263734",
"0.72506064",
"0.7224812",
"0.71532804",
"0.71428525",
"0.7106111",
"0.70392793",
"0.7039223",
"0.7000903",
"0.6956971",
"0.6951445",
"0.69476086",
"0.690... | 0.0 | -1 |
Locks/unlocks user accounts. This version of the function should only be run internally (i.e. not called by a client). The usecase is automatically locking user accounts if there are too many incorrect password attempts. The lock can be permanent or temporary. | def internal_toggle_user_lock(
payload: dict,
raiseonfail: bool = False,
override_authdb_path: str = None,
config: SimpleNamespace = None,
) -> dict:
engine, meta, permjson, dbpath = get_procdb_permjson(
override_authdb_path=override_authdb_path,
override_permissions_json=None,
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_050_lock_user(self):\n\n testflow.step(LOG_USR_MSG, TEST_USER1)\n users.loginAsUser(\n TEST_USER1,\n config.INTERNAL_PROFILE,\n 'IncorrectPassword',\n True,\n )\n\n testflow.step(\"Attempting to lock user %s\", TEST_USER1)\n fo... | [
"0.67687154",
"0.6715072",
"0.6685051",
"0.59848297",
"0.5864557",
"0.58035886",
"0.57672435",
"0.5702245",
"0.56830585",
"0.56830585",
"0.55720603",
"0.55367005",
"0.55127686",
"0.5510507",
"0.5492891",
"0.54587907",
"0.54437006",
"0.5369305",
"0.5354939",
"0.5337987",
"0.53... | 0.5006625 | 52 |
Locks/unlocks user accounts. Can only be run by superusers and is suitable for use when called from a frontend. | def toggle_user_lock(
payload: dict,
raiseonfail: bool = False,
override_authdb_path: str = None,
config: SimpleNamespace = None,
) -> dict:
for key in ("reqid", "pii_salt"):
if key not in payload:
LOGGER.error(
"Missing %s in payload dict. Can't process this req... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def locked(self, lock):\n\n\t\twith self.lock:\n\t\t\tif lock:\n\t\t\t\tif self.__locked:\n\t\t\t\t\tlogging.info(_(u'Account {0} already locked.').format(\n\t\t\t\t\t\t\t\t\t\t\tstylize(ST_NAME, self.__login)))\n\t\t\t\t\treturn\n\t\t\t\telse:\n\t\t\t\t\tLicornEvent('user_pre_lock', user=self.proxy).emit(synchron... | [
"0.6990676",
"0.6792118",
"0.62097913",
"0.59476864",
"0.58987916",
"0.5897161",
"0.5830074",
"0.5691251",
"0.5657567",
"0.5636801",
"0.56338614",
"0.5616103",
"0.5609187",
"0.5571914",
"0.5567522",
"0.5537959",
"0.5519136",
"0.54986197",
"0.54931444",
"0.5480338",
"0.5465324... | 0.57345366 | 7 |
Convert to json string and back again to remove numpy types. | def normalize_config(config):
return json.loads(json.dumps(config, cls=NumpyEncoder)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def to_json(cls, data):\n if isinstance(data, str):\n return json.loads(data)\n return data",
"def test_to_json_string(self):\n self.assertEqual(Base.to_json_string(None), \"[]\")\n self.assertTrue(type(Base.to_json_string(None)) is str)\n self.assertEqual(Base.to_js... | [
"0.69116664",
"0.68296856",
"0.66842186",
"0.6680756",
"0.66694856",
"0.65991104",
"0.65974826",
"0.65205896",
"0.651703",
"0.651703",
"0.63949585",
"0.6392357",
"0.637476",
"0.6347771",
"0.63349235",
"0.63321406",
"0.6327945",
"0.6316083",
"0.6308625",
"0.6239968",
"0.623263... | 0.6262535 | 19 |
return the grouped config | def get(self):
return | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def grouping_configuration(self) -> Optional['outputs.GroupingConfigurationResponse']:\n return pulumi.get(self, \"grouping_configuration\")",
"def get_target_groups_config(self):\n return self.config['target_groups']",
"def authenticator_groups_config(self) -> 'outputs.AuthenticatorGroupsConfigR... | [
"0.7530325",
"0.70537955",
"0.69922185",
"0.6926198",
"0.6728573",
"0.6699682",
"0.6592866",
"0.647515",
"0.6443092",
"0.6355032",
"0.63514704",
"0.6344661",
"0.6327839",
"0.6318462",
"0.62832725",
"0.6249607",
"0.6247941",
"0.6206413",
"0.6203565",
"0.61993575",
"0.6191455",... | 0.0 | -1 |
return the parsed data as a dictionary | def get_dict(self):
return | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_structure(self):\n main = {}\n for line in self.load():\n match = re.match('^\\s*([A-Za-z0-9_]+)(\\((\\d+)\\))?=(.*)$', line)\n if match:\n key = match.group(1)\n index = match.group(3)\n value = match.group(4)\n ... | [
"0.716718",
"0.6936443",
"0.69102806",
"0.68596214",
"0.6613967",
"0.6606598",
"0.6555824",
"0.6544313",
"0.6540554",
"0.6526435",
"0.6487537",
"0.6472331",
"0.6468871",
"0.64576834",
"0.63739526",
"0.6363869",
"0.63638157",
"0.6328945",
"0.6315474",
"0.6306047",
"0.62902063"... | 0.5989892 | 56 |
dump the data to stdout | def dump(self):
return | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def dumpData(self,out):\n raise AbstractError",
"def dumpData(self,out):\n raise AbstractError",
"def printwf(data):\n print data #replace for Py3\n sys.stdout.flush()\n sys.stderr.flush()",
"def main():\n print(dumps(get_data()))\n return 0",
"def dump(self, data_p... | [
"0.7264565",
"0.7264565",
"0.7155392",
"0.6986836",
"0.6973588",
"0.69495904",
"0.6942791",
"0.6929816",
"0.69143623",
"0.6837972",
"0.6774583",
"0.6733234",
"0.67095876",
"0.6708237",
"0.66896147",
"0.66597974",
"0.6650365",
"0.6628365",
"0.66205716",
"0.6580925",
"0.6574867... | 0.63319033 | 28 |
Reread the contents from the disk | def _read(self):
f = codecs.open(self.file, "r", "utf-8")
self.content = f.read()
f.close() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _update_ondisk(self):\n with open(self.orig_path, \"w\") as f:\n f.write(self.content)",
"def readdata(self, filepaths):\n pass",
"def reread(self) -> None:\n old = self.getSubgraph(self.uri)\n new = Graph()\n try:\n contents = open(self.path).read()... | [
"0.7119957",
"0.6178383",
"0.5912337",
"0.58479124",
"0.5814059",
"0.5798946",
"0.5720371",
"0.5708539",
"0.56570846",
"0.56556517",
"0.56424147",
"0.5617833",
"0.5605055",
"0.5605055",
"0.5600273",
"0.5596813",
"0.55685806",
"0.5565127",
"0.55291",
"0.55278736",
"0.54967374"... | 0.0 | -1 |
return the grouped config | def get(self):
if self.file:
self._read()
config = self.client_file.parseString(self.content)
return config | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def grouping_configuration(self) -> Optional['outputs.GroupingConfigurationResponse']:\n return pulumi.get(self, \"grouping_configuration\")",
"def get_target_groups_config(self):\n return self.config['target_groups']",
"def authenticator_groups_config(self) -> 'outputs.AuthenticatorGroupsConfigR... | [
"0.7530325",
"0.70537955",
"0.69922185",
"0.6926198",
"0.6728573",
"0.6699682",
"0.6592866",
"0.647515",
"0.6443092",
"0.6355032",
"0.63514704",
"0.6344661",
"0.6327839",
"0.6318462",
"0.62832725",
"0.6249607",
"0.6247941",
"0.6206413",
"0.6203565",
"0.61993575",
"0.6191455",... | 0.0 | -1 |
return the grouped config | def get(self):
config = self.user_file.parseString(self.content)
return config | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def grouping_configuration(self) -> Optional['outputs.GroupingConfigurationResponse']:\n return pulumi.get(self, \"grouping_configuration\")",
"def get_target_groups_config(self):\n return self.config['target_groups']",
"def authenticator_groups_config(self) -> 'outputs.AuthenticatorGroupsConfigR... | [
"0.7530325",
"0.70537955",
"0.69922185",
"0.6926198",
"0.6728573",
"0.6699682",
"0.6592866",
"0.647515",
"0.6443092",
"0.6355032",
"0.63514704",
"0.6344661",
"0.6327839",
"0.6318462",
"0.62832725",
"0.6249607",
"0.6247941",
"0.6206413",
"0.6203565",
"0.61993575",
"0.6191455",... | 0.0 | -1 |
self.spins stores the final lattice configuration for each T in T_range. | def __init__(self, L, T_range):
self.L = L
self.spins = np.ones((L, L, len(T_range)))
self.InitializeSpins(T_range[0]) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def txs(self):\n\n self.sp = self.x",
"def SLTrace(self,NSL=100,Pts=[]):\n TOF_end=[]\n SL_end=[]\n \n for i in range(4): #4 Subgrids\n \n if(len(Pts)==0):\n nsl=int(NSL*self.theta[i]/2/np.pi)\n Pts_init=PointOnUnitEdge(nsl) #... | [
"0.5783979",
"0.5507732",
"0.5491711",
"0.51921594",
"0.5174145",
"0.5129086",
"0.50681746",
"0.50142837",
"0.50092566",
"0.49935362",
"0.49205694",
"0.49145123",
"0.4913506",
"0.49083507",
"0.48946956",
"0.4889807",
"0.48834133",
"0.4874443",
"0.48703977",
"0.48688805",
"0.4... | 0.65850097 | 0 |
T = temperature [K]. L = Length of grid. | def ising2d_metropolis(T_range, mcsteps, L):
def compute_mcsteps(spin_T, L, T, mcsteps):
"""
The variable notation 'observable_T' denotes that quantity's value as per the
given temperature. The spin array is referenced with indices in reverse order
(j, i) to make the lattice plott... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _create_temperature_grid():\n\n temperatures_kelvins = numpy.full(NUM_GRID_POINTS, MIN_TEMPERATURE_KELVINS)\n\n for i in range(1, NUM_GRID_POINTS):\n if FIRST_POINT_IN_FRONT < i <= LAST_POINT_IN_FRONT:\n this_diff_kelvins = FRONT_GRADIENT_KELVINS_PT01 + 0.\n else:\n th... | [
"0.6483635",
"0.6193068",
"0.6161014",
"0.61197376",
"0.6065408",
"0.5919758",
"0.589904",
"0.5832035",
"0.57366437",
"0.57365",
"0.56799406",
"0.56521153",
"0.5636477",
"0.5625677",
"0.56231135",
"0.5609652",
"0.55937344",
"0.5569084",
"0.55360514",
"0.5534443",
"0.5525782",... | 0.52489686 | 51 |
The variable notation 'observable_T' denotes that quantity's value as per the given temperature. The spin array is referenced with indices in reverse order (j, i) to make the lattice plotting process easier. | def compute_mcsteps(spin_T, L, T, mcsteps):
energy_T, magnetization_T = np.zeros((2)), np.zeros((2))
for one_mcstep in range(mcsteps):
random_sites = np.random.randint(0, L, size=(L**2, 2))
# each mcstep performs L**2 updates on the square spin_T lattice.
for micro_st... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def spin_adapted_t1(i, j):\n if not isinstance(i, int) or not isinstance(j, int):\n raise ValueError(\"Requires integers as orbital indices, \\\nbut get {} and {}.\".format(type(i), type(j)))\n\n ia = i * 2 + 0\n ib = i * 2 + 1\n ja = j * 2 + 0\n jb = j * 2 + 1\n term1 = FermionOperator(((... | [
"0.5850596",
"0.55619913",
"0.55294216",
"0.5442023",
"0.54184484",
"0.53039",
"0.5259743",
"0.5229081",
"0.52171403",
"0.51962906",
"0.5188987",
"0.51736474",
"0.5163364",
"0.5158477",
"0.5157523",
"0.5149438",
"0.51097095",
"0.5046777",
"0.5030437",
"0.502572",
"0.50224936"... | 0.0 | -1 |
Save observables and lattice to pickle files. The isfile checks will return an error if either one fails. | def save_output(output_name, observables, lattice):
import cPickle as pickle
from os.path import isfile
observables_file = ((r'data\%s.pkl') % (output_name))
with open(observables_file, 'wb') as output:
pickle.dump(observables, output, pickle.HIGHEST_PROTOCOL)
if isfile(observables_file):
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def pickle_data(self):\n if 'data_sets.pckl' in self.expected_pickles:\n to_file(\n self.data_sets,\n os.path.join(self.logdir, 'data_sets.pckl')\n )\n if 'all_params.pckl' in self.expected_pickles:\n to_file(\n self.all_pa... | [
"0.6605382",
"0.62100697",
"0.61895514",
"0.6135828",
"0.6068063",
"0.6059598",
"0.6023454",
"0.5992661",
"0.59752506",
"0.59504825",
"0.5926284",
"0.5879088",
"0.58743024",
"0.5874081",
"0.58527464",
"0.58212143",
"0.5809227",
"0.57809293",
"0.5779382",
"0.5765579",
"0.57561... | 0.7103732 | 0 |
Average the last N checkpoints in the model_dir. | def avg_checkpoints(model_dir, num_last_checkpoints, global_step,
global_step_name):
checkpoint_state = tf.train.get_checkpoint_state(model_dir)
if not checkpoint_state:
utils.print_out("# No checkpoint file found in directory: %s" % model_dir)
return None
# Checkpoints are ordered fr... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def average_checkpoints(inputs): #权值平均\r\n params_dict = collections.OrderedDict()\r\n params_keys = None\r\n new_state = None\r\n for f in inputs:\r\n state = torch.load(\r\n f,\r\n map_location=(\r\n lambda s, _: torch.serialization.default_restore_location... | [
"0.615217",
"0.6006028",
"0.5925057",
"0.58493394",
"0.5845805",
"0.5786523",
"0.5764014",
"0.5678728",
"0.562423",
"0.5621132",
"0.56024176",
"0.5591469",
"0.5549874",
"0.5536095",
"0.55152065",
"0.549768",
"0.5496061",
"0.5489397",
"0.54665774",
"0.54629296",
"0.5456299",
... | 0.7893913 | 0 |
This function illustrates top down view of the car on the road. | def illustrate_driving_lane_with_topdownview(image, left_line, right_line):
rows, cols = image.shape[:2]
window_img = np.zeros_like(image)
window_margin = 56
left_plotx, right_plotx = left_line, right_line
ploty = left_line
lane_width = right_line[0] - left_line[0]
lane_center = (right_lin... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_simple_pass():\n m = view(nybb)\n m = view(world)\n m = view(cities)\n m = view(world.geometry)",
"def draw_car(self):\n a = self.h / 50\n ellipse(screen, BLACK, (self.x - 15 * a, self.y + 35 * a, 30 * a, 10 * a))\n rect(screen, LIGHT_BLUE, (self.x, self.y, self.dir * 26... | [
"0.5590229",
"0.5578065",
"0.55074614",
"0.541413",
"0.53645474",
"0.5353133",
"0.53382516",
"0.5325824",
"0.5317306",
"0.5310126",
"0.530344",
"0.52729845",
"0.52677834",
"0.52625513",
"0.5259109",
"0.5244894",
"0.52315193",
"0.52314156",
"0.5217538",
"0.51871055",
"0.518121... | 0.6516942 | 0 |
Constructs a graph edge connecting the two specified vertices found in the specified graph. | def __init__(self, graph, head_vertex, tail_vertex):
self.graph = graph
self.head_vertex = head_vertex
self.tail_vertex = tail_vertex | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _add_edge(self, graph: Graph, vertex1: Vertex, vertex2: Vertex) \\\n -> None:\n new_edge = Edge(vertex1, vertex2)\n graph.add(new_edge)",
"def generate_edges(graph):\n edges = []\n\n # for each node in graph\n for node in graph:\n\n # for each neighbou... | [
"0.66924286",
"0.6570883",
"0.6557355",
"0.6482667",
"0.64377856",
"0.635047",
"0.6350011",
"0.63169855",
"0.62859625",
"0.62616354",
"0.6236049",
"0.61758286",
"0.61712605",
"0.6149298",
"0.614011",
"0.6127075",
"0.6116275",
"0.61069393",
"0.609208",
"0.608074",
"0.6065483",... | 0.0 | -1 |
Returns the canonical representation of this graph edge. | def __repr__(self):
return repr((self.head_vertex, self.tail_vertex)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __repr__(self):\n return 'Edge(%s, %s)' % (repr(self[0]), repr(self[1]))",
"def canonicalize(self):\n return _libsbml.ASTNode_canonicalize(self)",
"def canonical_vertex(self):\n return self.L.zero(), self.K.one()",
"def __repr__(self):\n s = f\"GraphViaEdges(name={repr(self.na... | [
"0.6712845",
"0.64270645",
"0.6277145",
"0.62455523",
"0.61855644",
"0.6159736",
"0.61473686",
"0.61255693",
"0.6048268",
"0.6000083",
"0.5991154",
"0.59588206",
"0.5912053",
"0.59012926",
"0.5886229",
"0.58211297",
"0.5789143",
"0.5769494",
"0.5747226",
"0.5731961",
"0.57145... | 0.54360175 | 36 |
Returns a string representation of this graph edge. | def __str__(self):
class_name_str = str(self.__class__.__name__) + ": ("
attributes_str = str(self.head_vertex) + ", " + \
str(self.tail_vertex) + ")"
str_rep = class_name_str + attributes_str
return str_rep | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __str__(self):\n s = f\"GraphViaEdges '{self.name}',\\nedges :\\n\"\n for edge, edgetype in self.edges.items():\n s += f\" {edge[0]} {edgetype.value} {edge[1]}\\n\"\n\n return s",
"def __repr__(self) -> str:\n if self._has_direction:\n return (\n ... | [
"0.829538",
"0.8027543",
"0.80226904",
"0.7803095",
"0.77875525",
"0.7444098",
"0.740537",
"0.740537",
"0.7379465",
"0.7336204",
"0.733274",
"0.73219347",
"0.72903866",
"0.7256598",
"0.7256598",
"0.71568406",
"0.71414953",
"0.700553",
"0.69704586",
"0.6965743",
"0.6958509",
... | 0.6592445 | 42 |
Compares two graph edges for equality. The comparison is done by comparing the vertices constituting the respective edge. | def __eq__(self, other):
if isinstance(other, GraphEdge):
return self.head_vertex == other.head_vertex and self.tail_vertex == other.tail_vertex
return NotImplemented | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __eq__(self, other):\n if isinstance(other, DirectedWeightedGraphEdge):\n if self.head_vertex != other.head_vertex:\n return False\n elif self.tail_vertex != other.tail_vertex:\n return False\n elif self.weight != other.weight:\n ... | [
"0.6894904",
"0.6893221",
"0.6888254",
"0.68807936",
"0.6864258",
"0.6805243",
"0.6741039",
"0.6662746",
"0.6613348",
"0.65787905",
"0.656158",
"0.6549803",
"0.65466356",
"0.6527",
"0.64482933",
"0.6436504",
"0.64232814",
"0.63450253",
"0.63450253",
"0.6335306",
"0.63133574",... | 0.7092343 | 0 |
Compares two graph edges for inequality. The comparison is done by comparing the vertices constituting the respective edge. | def __ne__(self, other):
return not self == other | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __ge__(self, other):\n if self.head_vertex < other.head_vertex:\n return False\n elif self.tail_vertex < other.tail_vertex:\n return False\n elif self.weight < other.weight:\n return False\n return True",
"def __ge__(self, other):\n if self.... | [
"0.67699313",
"0.67699313",
"0.6718917",
"0.6626745",
"0.65958774",
"0.65786624",
"0.6506578",
"0.64915997",
"0.6450196",
"0.642483",
"0.63609326",
"0.6352806",
"0.63514936",
"0.63239413",
"0.62910086",
"0.6231645",
"0.6231645",
"0.6223897",
"0.6218536",
"0.6200331",
"0.61680... | 0.0 | -1 |
Implements the 'less than' operator for this graph edge. | def __lt__(self, other):
return self.head_vertex < other.head_vertex and self.tail_vertex < other.tail_vertex | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __lt__(self, other):\n return self.lessThan(other)",
"def less_than(self) -> global___Expression:",
"def __lt__(self, other):\n return self.weight < other.weight",
"def __lt__(self, other):\n return self.weight() < other.weight()",
"def __lt__(self, other: Any) -> ColumnOperators:\... | [
"0.7919602",
"0.7720811",
"0.7573536",
"0.75533617",
"0.7466493",
"0.7436178",
"0.7371722",
"0.7347792",
"0.7305412",
"0.7185504",
"0.7181193",
"0.7153693",
"0.71139944",
"0.7109481",
"0.7082006",
"0.7082006",
"0.7075434",
"0.7073893",
"0.7071718",
"0.7071718",
"0.7066138",
... | 0.7029191 | 27 |
Implements the 'less than or equal' operator for this graph edge. | def __le__(self, other):
return self.head_vertex <= other.head_vertex and self.tail_vertex <= other.tail_vertex | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __lt__(self, other: Any) -> ColumnOperators:\n return self.operate(lt, other)",
"def less_than_or_equal(self) -> global___Expression:",
"def __lt__(self, other):\n return self.lessThan(other)",
"def less_than(self) -> global___Expression:",
"def __le__(self, other):\n return self.l... | [
"0.7424275",
"0.74178535",
"0.73692393",
"0.7367971",
"0.73570037",
"0.73524106",
"0.7332932",
"0.73002404",
"0.71568567",
"0.7082912",
"0.70561814",
"0.7054167",
"0.70499885",
"0.70499885",
"0.70486236",
"0.7018015",
"0.7007011",
"0.7006944",
"0.6962305",
"0.69554603",
"0.69... | 0.67408234 | 55 |
Implements the 'greater than' operator for this graph edge. | def __gt__(self, other):
return self.head_vertex > other.head_vertex and self.tail_vertex > other.tail_vertex | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def greater_than(self) -> global___Expression:",
"def __gt__(self, other):\n return self.greaterThan(other)",
"def __gt__(self, other):\n return greater(self, other)",
"def test_greater_than(self):\n utils.compare_tracing_methods(\n SimpleCompareOpsModule(\"greaterThan\"),\n ... | [
"0.8087419",
"0.7585549",
"0.7540792",
"0.73314005",
"0.72852874",
"0.72640055",
"0.7232042",
"0.7203175",
"0.71771497",
"0.7172448",
"0.7172363",
"0.71375465",
"0.71296704",
"0.711737",
"0.711737",
"0.7115228",
"0.71038955",
"0.7094526",
"0.7086793",
"0.70820343",
"0.7066490... | 0.6665993 | 54 |
Implements the 'greater than or equal' operator for this graph edge. | def __ge__(self, other):
return self.head_vertex >= other.head_vertex and self.tail_vertex >= other.tail_vertex | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def greater_than_or_equal(self) -> global___Expression:",
"def greater_than(self) -> global___Expression:",
"def __gt__(self, other):\n self.conds.append((self.name, '>', other))\n return self",
"def __gt__(self, other):\n return self.greaterThan(other)",
"def __gt__(self, other):\n ... | [
"0.7700546",
"0.75986296",
"0.74414074",
"0.7415656",
"0.72761834",
"0.7266633",
"0.72542626",
"0.72542626",
"0.724797",
"0.7203777",
"0.7180628",
"0.716918",
"0.7104499",
"0.7080641",
"0.70719826",
"0.7068627",
"0.7065388",
"0.70612806",
"0.7051474",
"0.70491344",
"0.7039161... | 0.0 | -1 |
Returns the hash value of this graph edge. | def __hash__(self):
return 31 * hash(self.head_vertex) + hash(self.tail_vertex) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def graph_hash(self):\n return weisfeiler_lehman_graph_hash(self.graph.graph)",
"def hash(self):\n return Hash.dhash(bytes(self))",
"def __hash__(self) -> int:\n # The hash is based on the graph topology and node and edge attributes.\n return hash(\n (\n tuple(self.nodes),\n ... | [
"0.78263",
"0.7628104",
"0.75157136",
"0.7494974",
"0.7339544",
"0.7334898",
"0.73321",
"0.7258155",
"0.7211089",
"0.7161577",
"0.71465856",
"0.711592",
"0.7107293",
"0.7077296",
"0.70491976",
"0.70400316",
"0.6994161",
"0.6994161",
"0.69918466",
"0.69918466",
"0.69904214",
... | 0.6912984 | 25 |
Returns the first vertex in this graph edge. | def get_head_vertex(self):
return self.graph.vertices[self.head_vertex.vertex_number] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_start_vertex(self):\n\n return self._start_vertex",
"def get_vertex(self, key):\n\n vertex = None\n try: \n vertex = self.graph[key]\n except KeyError:\n raise ValueError(\"Vertex with key {} not in Graph\".format(key))\n\n return vertex",
"def ge... | [
"0.7534947",
"0.71326864",
"0.697388",
"0.68991953",
"0.6891457",
"0.68909526",
"0.68523365",
"0.67581934",
"0.6729876",
"0.6686339",
"0.66670376",
"0.6665354",
"0.6635292",
"0.6515914",
"0.6503775",
"0.6495165",
"0.6494536",
"0.64400387",
"0.62428373",
"0.6155909",
"0.614656... | 0.7465771 | 1 |
Returns the second vertex in this graph edge. | def get_tail_vertex(self):
return self.graph.vertices[self.tail_vertex.vertex_number] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_second_incident_node(self):\n return self.second_incident_node # return the second incident node",
"def getEdge(self, v1, v2):\n for e in self.edges:\n if (e.pvt, e.nvt) in [(v1, v2), (v2, v1)]:\n return e\n raise ValueError('No edge found')",
"def other_... | [
"0.70130605",
"0.6797787",
"0.67151606",
"0.64367384",
"0.6338771",
"0.6266767",
"0.6201335",
"0.613037",
"0.6081091",
"0.60046744",
"0.5995532",
"0.59310514",
"0.592902",
"0.59159297",
"0.59016436",
"0.58955365",
"0.58900154",
"0.58808",
"0.5877815",
"0.5816144",
"0.58035105... | 0.5996261 | 10 |
Returns the mate vertex connected to the specified vertex by this graph edge. | def get_mate(self, vertex):
if vertex.vertex_number == self.head_vertex.vertex_number:
return self.graph.vertices[self.tail_vertex.vertex_number]
elif vertex.vertex_number == self.tail_vertex.vertex_number:
return self.graph.vertices[self.head_vertex.vertex_number]
else:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_vertex(self, vertex):\n # return the vertex if it is in the graph\n if vertex in self.vert_dict:\n return self.vert_dict[vertex]\n else:\n raise ValueError('Vertex not in graph')",
"def minimum_other_vertex(self, vertex):\n return min([(len(self.out_edges... | [
"0.67918444",
"0.6675857",
"0.6527408",
"0.6517658",
"0.64582753",
"0.6442114",
"0.63371223",
"0.61908114",
"0.6128026",
"0.6096591",
"0.60688514",
"0.5953422",
"0.59300077",
"0.59174347",
"0.587875",
"0.5864341",
"0.5862755",
"0.58612406",
"0.58481663",
"0.5764057",
"0.57564... | 0.7601112 | 0 |
Constructs a directed graph edge connecting the two specified vertices found in the specified graph. | def __init__(self, graph, head_vertex, tail_vertex):
super(DirectedGraphEdge, self).__init__(
graph, head_vertex, tail_vertex)
self.directed = True | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _add_edge(self, graph: Graph, vertex1: Vertex, vertex2: Vertex) \\\n -> None:\n new_edge = Edge(vertex1, vertex2)\n graph.add(new_edge)",
"def generate_edges(graph):\n edges = []\n\n # for each node in graph\n for node in graph:\n\n # for each neighbou... | [
"0.6629451",
"0.65221673",
"0.6466587",
"0.64552623",
"0.64347106",
"0.6413203",
"0.6308838",
"0.626192",
"0.6243856",
"0.62377864",
"0.62224615",
"0.6218873",
"0.6142628",
"0.60961646",
"0.6074984",
"0.60685897",
"0.60597533",
"0.60535944",
"0.6032",
"0.60313684",
"0.6030236... | 0.58254945 | 36 |
Compares two directed graph edges for equality. The comparison is done by comparing the vertices constituting the respective edges. | def __eq__(self, other):
if isinstance(other, DirectedGraphEdge):
return self.head_vertex == other.head_vertex and self.tail_vertex == other.tail_vertex
return NotImplemented | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __eq__(self, other):\n if isinstance(other, GraphEdge):\n return self.head_vertex == other.head_vertex and self.tail_vertex == other.tail_vertex\n return NotImplemented",
"def __eq__(self, other):\n if isinstance(other, DirectedWeightedGraphEdge):\n if self.head_ver... | [
"0.6896015",
"0.6867314",
"0.68370813",
"0.67994946",
"0.6742311",
"0.6726953",
"0.67161727",
"0.6699341",
"0.66666347",
"0.66230184",
"0.65782267",
"0.65564907",
"0.64843726",
"0.64722836",
"0.63765186",
"0.63054085",
"0.62940544",
"0.62917787",
"0.6290742",
"0.62589073",
"0... | 0.6846683 | 2 |
Returns if this edge is directed. | def is_directed(self):
return self.directed | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_directed(self):\n return self.graph_properties.directed",
"def is_directed(self) -> bool:\n return self._directed",
"def is_directed(self):\n return self._directed",
"def is_directed(self):\n\n return self._directed",
"def is_directed(self):\n return self.G.is_dire... | [
"0.84067917",
"0.83739835",
"0.83364844",
"0.83069426",
"0.82440245",
"0.8019368",
"0.78854835",
"0.7802546",
"0.74070334",
"0.7043718",
"0.6455642",
"0.6275015",
"0.6208662",
"0.6207945",
"0.61559343",
"0.60839826",
"0.60836643",
"0.60414565",
"0.60307395",
"0.602906",
"0.60... | 0.83261657 | 4 |
Constructs a directed weighted graph edge connecting the two specified vertices found in the specified graph. | def __init__(self, graph, head_vertex, tail_vertex, weight):
super(DirectedWeightedGraphEdge, self).__init__(
graph, head_vertex, tail_vertex)
self.weighted = True
self.weight = weight | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def graph_with_edges():\n from weighted_graph import Weighted\n new_graph = Weighted()\n new_graph.add_node('A')\n new_graph.add_node('B')\n new_graph.add_node('C')\n new_graph.add_node('D')\n new_graph.add_node('E')\n new_graph.add_node('F')\n new_graph.add_edge('A', 'B')\n new_graph... | [
"0.67409766",
"0.6545794",
"0.64893067",
"0.6466647",
"0.64448774",
"0.63899666",
"0.6371012",
"0.63194865",
"0.6267181",
"0.61984056",
"0.6165937",
"0.6140469",
"0.613026",
"0.6119577",
"0.60430056",
"0.60415614",
"0.6038654",
"0.60329944",
"0.602843",
"0.6024041",
"0.602313... | 0.6211411 | 9 |
Returns the canonical representation of this directed weighted graph edge. | def __repr__(self):
return repr((self.head_vertex, self.tail_vertex, self.weight)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __repr__(self):\n return 'Edge(%s, %s)' % (repr(self[0]), repr(self[1]))",
"def to_directed(self):\n return self.copy()",
"def edge_attribute(self):\n return self._edge_attribute",
"def canonical_vertex(self):\n return self.L.zero(), self.K.one()",
"def __repr__(self):\n ... | [
"0.6424335",
"0.61460406",
"0.6138745",
"0.61359054",
"0.61086214",
"0.6104206",
"0.6060279",
"0.60108656",
"0.59402764",
"0.5861147",
"0.5855592",
"0.5824435",
"0.5788696",
"0.57834995",
"0.5775695",
"0.5741126",
"0.57334286",
"0.5730161",
"0.572557",
"0.56915885",
"0.567717... | 0.5819703 | 13 |
Returns a string representation of this directed weighted graph edge. | def __str__(self):
class_name_str = str(self.__class__.__name__) + ": ("
head_str = str(self.head_vertex) + ", "
tail_str = str(self.tail_vertex) + ", "
weight_str = str(self.weight) + ")"
attributes_str = head_str + tail_str + weight_str
str_rep = class_name_str + attrib... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __str__(self):\n s = f\"GraphViaEdges '{self.name}',\\nedges :\\n\"\n for edge, edgetype in self.edges.items():\n s += f\" {edge[0]} {edgetype.value} {edge[1]}\\n\"\n\n return s",
"def __str__(self):\n # string representation includes values of all inner fields\n ... | [
"0.7739981",
"0.7695178",
"0.7586101",
"0.75069964",
"0.7232776",
"0.72205067",
"0.71528155",
"0.7108102",
"0.70996356",
"0.7042502",
"0.69743747",
"0.6971483",
"0.68795323",
"0.68476313",
"0.6840448",
"0.6840448",
"0.67873716",
"0.67873716",
"0.6765409",
"0.6765409",
"0.6751... | 0.65143275 | 29 |
Compares two directed weighted graph edges for equality. The comparison is done by comparing the vertices constituting the respective edges and the weight of the respective edges. | def __eq__(self, other):
if isinstance(other, DirectedWeightedGraphEdge):
if self.head_vertex != other.head_vertex:
return False
elif self.tail_vertex != other.tail_vertex:
return False
elif self.weight != other.weight:
return F... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __eq__(self, other):\n return (self.vertices == other.vertices and self.weight == other.weight)",
"def __eq__(self, other):\n if isinstance(other, type(self)):\n same_edges = self._edges == other._edges\n same_weights = self._weights == other._weights\n return s... | [
"0.6958796",
"0.66861707",
"0.6495343",
"0.6471634",
"0.6320421",
"0.62764096",
"0.62764096",
"0.6267954",
"0.6096804",
"0.6045613",
"0.59932524",
"0.5959931",
"0.59565455",
"0.5941056",
"0.592869",
"0.5906578",
"0.5875933",
"0.58749247",
"0.58143383",
"0.57974845",
"0.577917... | 0.6716901 | 1 |
Compares two directed weighted graph edges for inequality. The comparison is done by comparing the vertices constituting the respective edges and the weight of the respective edges. | def __ne__(self, other):
return not self == other | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __ge__(self, other):\n if self.head_vertex < other.head_vertex:\n return False\n elif self.tail_vertex < other.tail_vertex:\n return False\n elif self.weight < other.weight:\n return False\n return True",
"def __ge__(self, other):\n if self.... | [
"0.6690867",
"0.6690867",
"0.65242505",
"0.6516784",
"0.6380098",
"0.6228067",
"0.61667687",
"0.61667687",
"0.61625665",
"0.6162488",
"0.6139756",
"0.60557073",
"0.60064006",
"0.600105",
"0.5986747",
"0.597607",
"0.592648",
"0.59132373",
"0.5912225",
"0.59072435",
"0.59072435... | 0.0 | -1 |
Implements the 'less than' operator for this directed weighted graph edge. | def __lt__(self, other):
if self.head_vertex >= other.head_vertex:
return False
elif self.tail_vertex >= other.tail_vertex:
return False
elif self.weight >= other.weight:
return False
return True | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __lt__(self, other):\n return self.weight < other.weight",
"def __lt__(self, other):\n return self.weight() < other.weight()",
"def __lt__(self, other):\n return self.lessThan(other)",
"def less_than(self) -> global___Expression:",
"def test_less_than(self):\n utils.compare_... | [
"0.77711385",
"0.7697636",
"0.75783116",
"0.74477637",
"0.7278836",
"0.70692146",
"0.70648324",
"0.6971669",
"0.6969963",
"0.69405514",
"0.69081956",
"0.6863266",
"0.68619215",
"0.6841381",
"0.6838512",
"0.6838512",
"0.676739",
"0.6762345",
"0.6759565",
"0.6733526",
"0.671579... | 0.69086057 | 11 |
Implements the 'less than or equal' operator for this directed weighted graph edge. | def __le__(self, other):
if self.head_vertex > other.head_vertex:
return False
elif self.tail_vertex > other.tail_vertex:
return False
elif self.weight > other.weight:
return False
return True | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __lt__(self, other):\n return self.weight < other.weight",
"def __lt__(self, other):\n return self.weight() < other.weight()",
"def __le__(self, other):\n return self.lessThanOrEqual(other)",
"def __gt__(self, other):\n return self.weight > other.weight",
"def less_than(self... | [
"0.76254696",
"0.75374025",
"0.7111511",
"0.70993835",
"0.7057541",
"0.69980633",
"0.69948137",
"0.6947888",
"0.688047",
"0.688047",
"0.684764",
"0.6835503",
"0.68268365",
"0.68207836",
"0.6803909",
"0.67899495",
"0.67849195",
"0.6750625",
"0.6728069",
"0.6728069",
"0.6717994... | 0.68948495 | 8 |
Implements the 'greater than' operator for this directed weighted graph edge. | def __gt__(self, other):
if self.head_vertex <= other.head_vertex:
return False
elif self.tail_vertex <= other.tail_vertex:
return False
elif self.weight <= other.weight:
return False
return True | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def greater_than(self) -> global___Expression:",
"def __gt__(self, other):\n return self.weight > other.weight",
"def __gt__(self, other):\n return self.weight() > other.weight()",
"def __gt__(self, other):\n return self.greaterThan(other)",
"def __gt__(self, other):\n return gr... | [
"0.7769823",
"0.7597536",
"0.7423905",
"0.7284571",
"0.71919274",
"0.71745133",
"0.70532006",
"0.7045554",
"0.7029203",
"0.70246357",
"0.7004523",
"0.69516975",
"0.69167733",
"0.6882357",
"0.6882357",
"0.6863768",
"0.6857966",
"0.6833386",
"0.68293405",
"0.68138456",
"0.68095... | 0.6832993 | 18 |
Implements the 'greater than or equal' operator for this directed weighted graph edge. | def __ge__(self, other):
if self.head_vertex < other.head_vertex:
return False
elif self.tail_vertex < other.tail_vertex:
return False
elif self.weight < other.weight:
return False
return True | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __gt__(self, other):\n return self.weight > other.weight",
"def __gt__(self, other):\n return self.weight() > other.weight()",
"def greater_than_or_equal(self) -> global___Expression:",
"def greater_than(self) -> global___Expression:",
"def __gt__(self, other):\n self.conds.append(... | [
"0.76772624",
"0.7535353",
"0.72638285",
"0.7120609",
"0.7043607",
"0.70039606",
"0.6943967",
"0.6928654",
"0.6916214",
"0.6916214",
"0.6905859",
"0.6905859",
"0.6893829",
"0.6853579",
"0.6851861",
"0.6844725",
"0.6831895",
"0.6812114",
"0.67955446",
"0.67801803",
"0.67801803... | 0.63659245 | 55 |
Returns the hash value of this directed weighted graph edge. | def __hash__(self):
return 31 * hash(self.head_vertex) + hash(self.tail_vertex) + hash(self.weight) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def graph_hash(self):\n return weisfeiler_lehman_graph_hash(self.graph.graph)",
"def hash(self):\n return Hash.dhash(bytes(self))",
"def __hash__(self) -> int:\n # The hash is based on the graph topology and node and edge attributes.\n return hash(\n (\n tuple(self.nodes),\n ... | [
"0.7707078",
"0.74999255",
"0.7439462",
"0.71481526",
"0.70934385",
"0.7084071",
"0.70389736",
"0.6950443",
"0.68714726",
"0.6859716",
"0.6851293",
"0.68340796",
"0.6825023",
"0.6807075",
"0.6777056",
"0.67552865",
"0.6753596",
"0.6745361",
"0.6724792",
"0.6718598",
"0.669140... | 0.71522194 | 4 |
Returns if this edge is weighted. | def is_weighted(self):
return self.weighted | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_weighted(self):\n return self._weighted",
"def is_weighted(self):\n return self.properties.weighted",
"def is_weighted(G):\n return G.is_weighted()",
"def weighted_estimation(self) -> bool:\n\n return self._weighted_estimation",
"def is_weight(self):\n return self.id i... | [
"0.85247034",
"0.84561473",
"0.7810495",
"0.7601611",
"0.73710126",
"0.7284329",
"0.7097942",
"0.7078276",
"0.65169454",
"0.64693487",
"0.6455727",
"0.6354632",
"0.63507086",
"0.63039726",
"0.62808347",
"0.6277241",
"0.6258785",
"0.62173945",
"0.6197365",
"0.6197365",
"0.6197... | 0.85533684 | 2 |
Returns the weight of the directed weighted graph edge. | def get_weight(self):
return self.weight | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def weight(self, edge):\n \n return self._weights[frozenset(edge)]",
"def edge_weight(edge):\n return distance(edge.orig, edge.dest)",
"def get_edge_weight(self, vertex1, vertex2):\n if not self.is_weighted():\n print(\"WARNING: Graph is NOT weighted!\")\n return N... | [
"0.8129193",
"0.8003027",
"0.80014724",
"0.76997113",
"0.7638267",
"0.75383854",
"0.7373104",
"0.7211308",
"0.715701",
"0.6963197",
"0.696162",
"0.69156826",
"0.66656625",
"0.66656625",
"0.66656625",
"0.6635396",
"0.65802395",
"0.6562561",
"0.6515059",
"0.6470114",
"0.6467352... | 0.6724653 | 12 |
Constructs a directed unweighted graph edge connecting the two specified vertices found in the specified graph. | def __init__(self, graph, head_vertex, tail_vertex):
super(DirectedUnWeightedGraphEdge, self).__init__(
graph, head_vertex, tail_vertex)
self.weighted = False | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_graph_from_edges(edges):\n G = nx.Graph()\n for e in edges:\n p1 = e[0]\n p2 = e[1]\n dist = LA.norm(np.array(p2) - np.array(p1))\n G.add_edge(p1, p2, weight=dist)\n return G",
"def build_auxiliary_edge_connectivity(G):\n if G.is_directed():\n H = nx.DiGr... | [
"0.64245385",
"0.6392121",
"0.6319508",
"0.6204723",
"0.6199114",
"0.61878145",
"0.61761534",
"0.6147652",
"0.60882044",
"0.6031652",
"0.6030413",
"0.60254353",
"0.5982528",
"0.5957019",
"0.5932997",
"0.5900027",
"0.58885926",
"0.58850336",
"0.58760947",
"0.58532166",
"0.5823... | 0.6012404 | 12 |
Returns if this edge is weighted. | def is_weighted(self):
return self.weighted | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_weighted(self):\n return self._weighted",
"def is_weighted(self):\n return self.properties.weighted",
"def is_weighted(G):\n return G.is_weighted()",
"def weighted_estimation(self) -> bool:\n\n return self._weighted_estimation",
"def is_weight(self):\n return self.id i... | [
"0.85247034",
"0.84561473",
"0.7810495",
"0.7601611",
"0.73710126",
"0.7284329",
"0.7097942",
"0.7078276",
"0.65169454",
"0.64693487",
"0.6455727",
"0.6354632",
"0.63507086",
"0.63039726",
"0.62808347",
"0.6277241",
"0.6258785",
"0.62173945",
"0.6197365",
"0.6197365",
"0.6197... | 0.85533684 | 0 |
Constructs an undirected graph edge connecting the two specified vertices found in the specified graph. | def __init__(self, graph, head_vertex, tail_vertex):
super(UnDirectedGraphEdge, self).__init__(
graph, head_vertex, tail_vertex)
self.directed = False | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def build_auxiliary_edge_connectivity(G):\n if G.is_directed():\n H = nx.DiGraph()\n H.add_nodes_from(G.nodes())\n H.add_edges_from(G.edges(), capacity=1)\n return H\n else:\n H = nx.DiGraph()\n H.add_nodes_from(G.nodes())\n for (source, target) in G.edges():\... | [
"0.64261425",
"0.63682216",
"0.6345462",
"0.6331852",
"0.6241783",
"0.6167578",
"0.6153072",
"0.60849977",
"0.606196",
"0.60580796",
"0.6017782",
"0.6013464",
"0.59926474",
"0.5972804",
"0.59044254",
"0.5893973",
"0.58447814",
"0.5823982",
"0.5819306",
"0.58108056",
"0.581019... | 0.6035515 | 10 |
Returns if this edge is directed. | def is_directed(self):
return self.directed | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_directed(self):\n return self.graph_properties.directed",
"def is_directed(self) -> bool:\n return self._directed",
"def is_directed(self):\n return self._directed",
"def is_directed(self):\n\n return self._directed",
"def is_directed(self):\n return self.G.is_dire... | [
"0.84067917",
"0.83739835",
"0.83364844",
"0.83069426",
"0.82440245",
"0.8019368",
"0.78854835",
"0.7802546",
"0.74070334",
"0.7043718",
"0.6455642",
"0.6275015",
"0.6208662",
"0.6207945",
"0.61559343",
"0.60839826",
"0.60836643",
"0.60414565",
"0.60307395",
"0.602906",
"0.60... | 0.83261657 | 3 |
Constructs an undirected weighted graph edge connecting the two specified vertices found in the specified graph. | def __init__(self, graph, head_vertex, tail_vertex, weight):
super(UnDirectedWeightedGraphEdge, self).__init__(
graph, head_vertex, tail_vertex)
self.weight = weight | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def graph_with_edges():\n from weighted_graph import Weighted\n new_graph = Weighted()\n new_graph.add_node('A')\n new_graph.add_node('B')\n new_graph.add_node('C')\n new_graph.add_node('D')\n new_graph.add_node('E')\n new_graph.add_node('F')\n new_graph.add_edge('A', 'B')\n new_graph... | [
"0.6535345",
"0.6419934",
"0.6400952",
"0.6257576",
"0.62537855",
"0.6233085",
"0.6230038",
"0.6156722",
"0.6150063",
"0.6117105",
"0.6092831",
"0.60178375",
"0.598439",
"0.5979376",
"0.59757173",
"0.5965193",
"0.59521127",
"0.5938053",
"0.5937702",
"0.58988655",
"0.58736444"... | 0.6103343 | 10 |
Returns the canonical representation of this graph edge. | def __repr__(self):
return repr((self.head_vertex, self.tail_vertex, self.weight)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __repr__(self):\n return 'Edge(%s, %s)' % (repr(self[0]), repr(self[1]))",
"def canonicalize(self):\n return _libsbml.ASTNode_canonicalize(self)",
"def canonical_vertex(self):\n return self.L.zero(), self.K.one()",
"def __repr__(self):\n s = f\"GraphViaEdges(name={repr(self.na... | [
"0.6712845",
"0.64270645",
"0.6277145",
"0.62455523",
"0.61855644",
"0.6159736",
"0.61473686",
"0.61255693",
"0.6048268",
"0.6000083",
"0.5991154",
"0.59588206",
"0.5912053",
"0.59012926",
"0.5886229",
"0.58211297",
"0.5789143",
"0.5769494",
"0.5747226",
"0.5731961",
"0.57145... | 0.5542506 | 32 |
Returns a string representation of this graph edge. | def __str__(self):
class_name_str = str(self.__class__.__name__) + ": ("
head_str = str(self.head_vertex) + ", "
tail_str = str(self.tail_vertex) + ", "
weight_str = str(self.weight) + ")"
attributes_str = head_str + tail_str + weight_str
str_rep = class_name_str + attrib... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __str__(self):\n s = f\"GraphViaEdges '{self.name}',\\nedges :\\n\"\n for edge, edgetype in self.edges.items():\n s += f\" {edge[0]} {edgetype.value} {edge[1]}\\n\"\n\n return s",
"def __repr__(self) -> str:\n if self._has_direction:\n return (\n ... | [
"0.829538",
"0.8027543",
"0.80226904",
"0.7803095",
"0.77875525",
"0.7444098",
"0.740537",
"0.740537",
"0.7379465",
"0.7336204",
"0.733274",
"0.73219347",
"0.72903866",
"0.7256598",
"0.7256598",
"0.71568406",
"0.71414953",
"0.700553",
"0.69704586",
"0.6965743",
"0.6958509",
... | 0.6620852 | 38 |
Compares two undirected weighted graph edges for equality. The comparison is done by comparing the vertices constituting the respective edges and the weight of the respective edges. | def __eq__(self, other):
if isinstance(other, UnDirectedWeightedGraphEdge):
if self.head_vertex != other.head_vertex:
return False
elif self.tail_vertex != other.tail_vertex:
return False
elif self.weight != other.weight:
return... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __eq__(self, other):\n return (self.vertices == other.vertices and self.weight == other.weight)",
"def __eq__(self, other):\n if isinstance(other, DirectedWeightedGraphEdge):\n if self.head_vertex != other.head_vertex:\n return False\n elif self.tail_vertex ... | [
"0.70128596",
"0.6869596",
"0.67607963",
"0.6654154",
"0.6561618",
"0.6561618",
"0.6346451",
"0.6277991",
"0.6276002",
"0.6192862",
"0.60529923",
"0.60419333",
"0.60337394",
"0.6005246",
"0.59807146",
"0.59807146",
"0.5971091",
"0.5962844",
"0.5947676",
"0.5939486",
"0.592814... | 0.678387 | 2 |
Compares two undirected weighted graph edges for inequality. The comparison is done by comparing the vertices constituting the respective edges and the weight of the respective edges. | def __ne__(self, other):
return not self == other | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __ge__(self, other):\n if self.head_vertex < other.head_vertex:\n return False\n elif self.tail_vertex < other.tail_vertex:\n return False\n elif self.weight < other.weight:\n return False\n return True",
"def __ge__(self, other):\n if self.... | [
"0.68472934",
"0.68472934",
"0.65563667",
"0.65508115",
"0.64969313",
"0.6274817",
"0.6274817",
"0.6223155",
"0.61916786",
"0.61542195",
"0.614179",
"0.6086487",
"0.6039508",
"0.60231197",
"0.6021971",
"0.6021971",
"0.6004016",
"0.5975145",
"0.5955949",
"0.59454757",
"0.59438... | 0.0 | -1 |
Implements the 'less than' operator for this undirected weighted graph edge. | def __lt__(self, other):
if self.head_vertex >= other.head_vertex:
return False
elif self.tail_vertex >= other.tail_vertex:
return False
elif self.weight >= other.weight:
return False
return True | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __lt__(self, other):\n return self.weight < other.weight",
"def __lt__(self, other):\n return self.weight() < other.weight()",
"def __lt__(self, other):\n return self.lessThan(other)",
"def less_than(self) -> global___Expression:",
"def test_less_than(self):\n utils.compare_... | [
"0.77689767",
"0.76935875",
"0.7625297",
"0.747115",
"0.7337798",
"0.71133196",
"0.7082338",
"0.7063246",
"0.7031801",
"0.6964959",
"0.69557023",
"0.6874766",
"0.6874766",
"0.68555635",
"0.6813205",
"0.6798153",
"0.67851424",
"0.67757106",
"0.67609334",
"0.6752035",
"0.674700... | 0.69352126 | 11 |
Implements the 'less than or equal' operator for this undirected weighted graph edge. | def __le__(self, other):
if self.head_vertex > other.head_vertex:
return False
elif self.tail_vertex > other.tail_vertex:
return False
elif self.weight > other.weight:
return False
return True | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __lt__(self, other):\n return self.weight < other.weight",
"def __lt__(self, other):\n return self.weight() < other.weight()",
"def __le__(self, other):\n return self.lessThanOrEqual(other)",
"def less_than(self) -> global___Expression:",
"def __lt__(self, other):\n return s... | [
"0.76163465",
"0.7529463",
"0.7118616",
"0.70518756",
"0.7048317",
"0.70234275",
"0.6956045",
"0.6935561",
"0.6919424",
"0.68723845",
"0.68723845",
"0.68259084",
"0.6818995",
"0.6799676",
"0.67912745",
"0.6787597",
"0.6787597",
"0.676763",
"0.67629933",
"0.6742766",
"0.671498... | 0.6889136 | 9 |
Implements the 'greater than' operator for this undirected weighted graph edge. | def __gt__(self, other):
if self.head_vertex <= other.head_vertex:
return False
elif self.tail_vertex <= other.tail_vertex:
return False
elif self.weight <= other.weight:
return False
return True | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def greater_than(self) -> global___Expression:",
"def __gt__(self, other):\n return self.weight > other.weight",
"def __gt__(self, other):\n return self.weight() > other.weight()",
"def __gt__(self, other):\n return self.greaterThan(other)",
"def __gt__(self, other):\n return gr... | [
"0.7757011",
"0.7524929",
"0.73425996",
"0.72630095",
"0.7197892",
"0.71632105",
"0.7157842",
"0.70084184",
"0.695969",
"0.6946788",
"0.69339824",
"0.6926895",
"0.69111073",
"0.68534",
"0.68408316",
"0.68408316",
"0.6840384",
"0.68316174",
"0.682464",
"0.67996675",
"0.6788679... | 0.6796133 | 21 |
Implements the 'greater than or equal' operator for this undirected weighted graph edge. | def __ge__(self, other):
if self.head_vertex < other.head_vertex:
return False
elif self.tail_vertex < other.tail_vertex:
return False
elif self.weight < other.weight:
return False
return True | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __gt__(self, other):\n return self.weight > other.weight",
"def __gt__(self, other):\n return self.weight() > other.weight()",
"def greater_than_or_equal(self) -> global___Expression:",
"def greater_than(self) -> global___Expression:",
"def __gt__(self, other):\n self.conds.append(... | [
"0.7582177",
"0.7428664",
"0.7256328",
"0.7151055",
"0.7032445",
"0.6984409",
"0.68828106",
"0.68828106",
"0.6880783",
"0.6876074",
"0.6876074",
"0.68547446",
"0.68541676",
"0.6824699",
"0.68221045",
"0.681553",
"0.68115616",
"0.67782545",
"0.6770707",
"0.6755021",
"0.6755021... | 0.631137 | 53 |
Returns the hash value of this undirected weighted graph edge. | def __hash__(self):
return 31 * hash(self.head_vertex) + hash(self.tail_vertex) + hash(self.weight) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def graph_hash(self):\n return weisfeiler_lehman_graph_hash(self.graph.graph)",
"def hash(self):\n return Hash.dhash(bytes(self))",
"def __hash__(self) -> int:\n # The hash is based on the graph topology and node and edge attributes.\n return hash(\n (\n tuple(self.nodes),\n ... | [
"0.7730234",
"0.73982024",
"0.73832667",
"0.7158037",
"0.7104639",
"0.7060419",
"0.7053484",
"0.6959796",
"0.6908909",
"0.68630403",
"0.6844783",
"0.6832148",
"0.6807088",
"0.6763605",
"0.67621374",
"0.672369",
"0.6704072",
"0.6693915",
"0.66671664",
"0.66651183",
"0.6658829"... | 0.7156366 | 4 |
Returns the weight of the undirected weighted graph edge. | def get_weight(self):
return self.weight | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def weight(self, edge):\n \n return self._weights[frozenset(edge)]",
"def edge_weight(edge):\n return distance(edge.orig, edge.dest)",
"def get_edge_weight(self, vertex1, vertex2):\n if not self.is_weighted():\n print(\"WARNING: Graph is NOT weighted!\")\n return N... | [
"0.81204045",
"0.77929056",
"0.77081287",
"0.7384713",
"0.73840564",
"0.72583896",
"0.72555566",
"0.7238862",
"0.6997294",
"0.6879325",
"0.68051094",
"0.6717882",
"0.6713216",
"0.66891116",
"0.66891116",
"0.66891116",
"0.6632665",
"0.660954",
"0.6608168",
"0.6507241",
"0.6507... | 0.67143077 | 13 |
Constructs an undirected unweighted graph edge connecting the two specified vertices found in the specified graph. | def __init__(self, graph, head_vertex, tail_vertex):
super(UnDirectedUnWeightedGraphEdge, self).__init__(
graph, head_vertex, tail_vertex)
self.weighted = False | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def build_auxiliary_edge_connectivity(G):\n if G.is_directed():\n H = nx.DiGraph()\n H.add_nodes_from(G.nodes())\n H.add_edges_from(G.edges(), capacity=1)\n return H\n else:\n H = nx.DiGraph()\n H.add_nodes_from(G.nodes())\n for (source, target) in G.edges():\... | [
"0.64415514",
"0.6348412",
"0.62165415",
"0.61603177",
"0.61482376",
"0.60675305",
"0.6054274",
"0.60529864",
"0.6051515",
"0.6029777",
"0.59820396",
"0.59675795",
"0.5951545",
"0.5920718",
"0.5867879",
"0.586232",
"0.5854978",
"0.5832738",
"0.58237445",
"0.5782453",
"0.57706... | 0.6028719 | 10 |
Returns if this edge is weighted. | def is_weighted(self):
return self.weighted | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_weighted(self):\n return self._weighted",
"def is_weighted(self):\n return self.properties.weighted",
"def is_weighted(G):\n return G.is_weighted()",
"def weighted_estimation(self) -> bool:\n\n return self._weighted_estimation",
"def is_weight(self):\n return self.id i... | [
"0.85247034",
"0.84561473",
"0.7810495",
"0.7601611",
"0.73710126",
"0.7284329",
"0.7097942",
"0.7078276",
"0.65169454",
"0.64693487",
"0.6455727",
"0.6354632",
"0.63507086",
"0.63039726",
"0.62808347",
"0.6277241",
"0.6258785",
"0.62173945",
"0.6197365",
"0.6197365",
"0.6197... | 0.85533684 | 1 |
builds a transition layer as described in | def transition_layer(X, nb_filters, compression):
output = K.layers.BatchNormalization()(X)
output = K.layers.Activation('relu')(output)
output = K.layers.Conv2D(int(nb_filters * compression), 1,
kernel_initializer='he_normal')(output)
# transition layer
X = K.layers.Av... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _build(layer, height):\n if len(layer) == 1:\n return layer\n odd = None\n if len(layer) % 2:\n # promote to higher level\n odd = layer.pop(-1)\n # layer.append(layer[-1])\n new_layer = []\n for idx in range(0, len(layer), 2):\n ... | [
"0.6218346",
"0.6215681",
"0.6044082",
"0.60177845",
"0.5852672",
"0.5816077",
"0.5756486",
"0.5701733",
"0.56542253",
"0.5631054",
"0.5613486",
"0.5607855",
"0.55468625",
"0.5538929",
"0.5529522",
"0.55275786",
"0.55095553",
"0.5486323",
"0.54718447",
"0.546475",
"0.5444116"... | 0.0 | -1 |
Load JSON from the request body and store them in self.request.arguments, like Tornado does by default for POSTed form parameters. If JSON cannot be decoded, raises an HTTPError with status 400. | def load_json(self):
try:
self.request.arguments = json.loads(self.request.body)
except ValueError:
msg = "Could not decode JSON: %s" % self.request.body
logger.debug(msg)
raise tornado.web.HTTPError(400, msg) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def load_json_body(self, request):\n\n request.json_body = None\n\n if not request.META.get(\"CONTENT_TYPE\", \"\").startswith(\"application/json\"):\n return\n\n if not len(request.body):\n return\n\n try:\n request.json_body = json.loads(request.body.d... | [
"0.7809032",
"0.7458779",
"0.7396192",
"0.7363162",
"0.7273717",
"0.7221575",
"0.71112233",
"0.7065461",
"0.6721423",
"0.6637338",
"0.65089893",
"0.62159413",
"0.6202336",
"0.61334753",
"0.60533977",
"0.5944741",
"0.5941503",
"0.59275615",
"0.59194815",
"0.59124786",
"0.58578... | 0.9050802 | 0 |
Find and return the argument with key 'name' from JSON request data. Similar to Tornado's get_argument() method. | def get_json_argument(self, name, default=None):
if default is None:
default = self._ARG_DEFAULT
if not self.request.arguments:
self.load_json()
if name not in self.request.arguments:
if default is self._ARG_DEFAULT:
msg = "Missing argument '%s... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_json_argument(self, name, default=None):\n if default is None:\n default = self._ARG_DEFAULT\n if not self.request.arguments:\n self.load_json()\n if name not in self.request.arguments:\n if default is self._ARG_DEFAULT:\n msg = \"Missing... | [
"0.7637005",
"0.7193931",
"0.71123517",
"0.69763345",
"0.6936398",
"0.6922876",
"0.6660581",
"0.64597905",
"0.64124525",
"0.6278671",
"0.62783426",
"0.62357706",
"0.6156931",
"0.61395764",
"0.6017353",
"0.59974533",
"0.5833328",
"0.5769034",
"0.57587713",
"0.5717934",
"0.5701... | 0.7650423 | 0 |
get_func(func_t or ea) > func_t Take an IDA function (`idaapi.func_t`) or an address (EA) and return an IDA function object. Use this when APIs can take either a function or an address. | def get_func(func_ea):
if isinstance(func_ea, idaapi.func_t):
return func_ea
func = idaapi.get_func(func_ea)
if func is None:
raise exceptions.SarkNoFunction("No function at 0x{:08X}".format(func_ea))
return func | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_func(op):\n if op == \"-e\":\n return func\n elif op == \"-d\":\n return unfunc",
"def get_ea(func_ea):\n if isinstance(func_ea, idaapi.func_t):\n return func_ea.startEA\n return func_ea",
"def _get_function(func):\n if isinstance(func, method_types):\n func =... | [
"0.6530803",
"0.6504428",
"0.64988434",
"0.6315862",
"0.5867652",
"0.57968634",
"0.5764787",
"0.5734331",
"0.5637218",
"0.55756813",
"0.5573173",
"0.55455023",
"0.5538783",
"0.55112034",
"0.54792434",
"0.5432875",
"0.5425693",
"0.54198885",
"0.5403437",
"0.5390312",
"0.537629... | 0.78666323 | 0 |
get_ea(func_t or ea) > ea Same as `get_func`, but returns the EA. | def get_ea(func_ea):
if isinstance(func_ea, idaapi.func_t):
return func_ea.startEA
return func_ea | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_func(func_ea):\n if isinstance(func_ea, idaapi.func_t):\n return func_ea\n func = idaapi.get_func(func_ea)\n if func is None:\n raise exceptions.SarkNoFunction(\"No function at 0x{:08X}\".format(func_ea))\n\n return func",
"def get_func(op):\n if op == \"-e\":\n return... | [
"0.6857561",
"0.6226184",
"0.55999815",
"0.51001966",
"0.5099721",
"0.5076445",
"0.49658352",
"0.49461403",
"0.49249873",
"0.4924352",
"0.49189922",
"0.49043763",
"0.48501197",
"0.48474756",
"0.4808437",
"0.47783166",
"0.4774657",
"0.47436997",
"0.47288248",
"0.47219354",
"0.... | 0.7903916 | 0 |
Check if a string is printable | def is_string_printable(string_):
return set(string_) - set(string.printable) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_printable(s):\n for c in s:\n if c not in PRINTABLE_CHARACTERS:\n return False\n return True",
"def is_printable(b):\n return b in e(string.printable)",
"def ascii_printable(s: str) -> bool:\n return frozenset(s).issubset(_ascii_pa)",
"def is_printable(c):\n return ord... | [
"0.86017025",
"0.8182569",
"0.7971312",
"0.796188",
"0.7166954",
"0.7078417",
"0.7067807",
"0.660626",
"0.6572274",
"0.653476",
"0.653476",
"0.65230304",
"0.6510913",
"0.6427872",
"0.6382309",
"0.63571495",
"0.6299116",
"0.62191236",
"0.61952144",
"0.6128172",
"0.60902894",
... | 0.82233447 | 1 |
Set missing addresses to start and end of IDB. Take a start and end addresses. If an address is None or `BADADDR`, return start or end addresses of the IDB instead. | def fix_addresses(start=None, end=None):
if start in (None, idaapi.BADADDR):
start = idaapi.cvar.inf.minEA
if end in (None, idaapi.BADADDR):
end = idaapi.cvar.inf.maxEA
return start, end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_column_address(start_addr, end_addr):\n send_command(0x21)\n send_command(start_addr)\n send_command(end_addr)",
"def deleteAddressRange(self, start: ghidra.program.model.address.Address, end: ghidra.program.model.address.Address, monitor: ghidra.util.task.TaskMonitor) -> None:\n ...",
... | [
"0.5552632",
"0.55492634",
"0.53836757",
"0.5382804",
"0.5351938",
"0.5299497",
"0.5208573",
"0.5195564",
"0.51394707",
"0.50926214",
"0.5090475",
"0.50299877",
"0.50142455",
"0.49440485",
"0.4939883",
"0.4932165",
"0.4909151",
"0.48797634",
"0.48670682",
"0.48395842",
"0.483... | 0.73118097 | 0 |
Set the name of an address. Sets the name of an address in IDA. | def set_name(address, name, anyway=False):
success = idaapi.set_name(address, name, idaapi.SN_NOWARN | idaapi.SN_NOCHECK)
if success:
return
if anyway:
success = idaapi.do_name_anyway(address, name)
if success:
return
raise exceptions.SarkSetNameFailed("Failed r... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def change_name(self, address, name):\n with self.connect() as c:\n cur = c.cursor()\n cur.execute(\"UPDATE AddressBook SET name = '{}' WHERE address = '{}'\".format(name, address))\n return True",
"def setName(self, name):\n self.name = str(name)",
"def setName(s... | [
"0.75548315",
"0.71784353",
"0.71413356",
"0.7125585",
"0.71055186",
"0.71055186",
"0.70820135",
"0.70820135",
"0.70316553",
"0.70316553",
"0.70316553",
"0.70316553",
"0.7006621",
"0.6948661",
"0.6948661",
"0.6948661",
"0.6948661",
"0.6948661",
"0.693277",
"0.69252336",
"0.69... | 0.7559003 | 0 |
Ensure the date and times aren't altered during localization. | def test_localize_preserve(self):
Timespan = self.env['timespan.mixin']
data = [
datetime.datetime(2019, 2, 2, 0, 1, 2, 3),
datetime.datetime(2020, 2, 5, 23, 1, 2, 3),
datetime.datetime(2006, 2, 5, 23, 1, 2, 3),
]
user_tz = pytz.timezone(self.env.user.... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_long_not_configured(self):\n locale = {\n 'timeformat': '%H:%M',\n 'dateformat': '%Y-%m-%d',\n 'longdateformat': '',\n 'datetimeformat': '%Y-%m-%d %H:%M',\n 'longdatetimeformat': '',\n }\n assert (dt.datetime(2017, 1, 1), True) ==... | [
"0.64189154",
"0.5901895",
"0.5862708",
"0.57844114",
"0.5782598",
"0.5647036",
"0.5617135",
"0.55822283",
"0.5578136",
"0.5577942",
"0.5560297",
"0.5557092",
"0.5547648",
"0.5545129",
"0.55437464",
"0.5498135",
"0.5492985",
"0.5491222",
"0.5475362",
"0.545704",
"0.5449415",
... | 0.57176924 | 5 |
Create and register a subparser for this command. | def _make_parser(self, **kwargs):
kwargs.setdefault('help', self.help)
kwargs.setdefault('formatter_class',argparse.RawDescriptionHelpFormatter)
kwargs.setdefault('description', self.description)
kwargs.setdefault('name', self.name)
names = (kwargs.get('name') or self.name).spli... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def setup_subparser(name, description, commands):\n subparser = SUBPARSER.add_parser(\n name,\n help=description\n )\n subparser.add_argument(\n 'sub_command',\n metavar='sub_command',\n type=str,\n nargs='+',\n help='Which command to run. Options: %s' % ',... | [
"0.8146288",
"0.7661144",
"0.75126314",
"0.7470138",
"0.7418261",
"0.7290573",
"0.7261371",
"0.7242324",
"0.72119635",
"0.7207184",
"0.7169415",
"0.7168731",
"0.71285814",
"0.71084726",
"0.7101555",
"0.70689684",
"0.70563966",
"0.69744897",
"0.6948328",
"0.6903119",
"0.686747... | 0.7411873 | 5 |
Check if plugin exists | def exists(cls, name):
return name in cls._plugins | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def exists(name):\n return name in _plugins",
"def has_plugin(self, name: str) -> bool:\n return name in self._plugins",
"def hasPlugin(self, plugin_name):\n\t\tif plugin_name in self.plugins:\n\t\t\treturn True\n\t\telse:\n\t\t\treturn False",
"def exists(reader_name: str) -> bool:\n return plu... | [
"0.78000075",
"0.7597131",
"0.73629564",
"0.7152969",
"0.7052759",
"0.6905996",
"0.6865257",
"0.66666263",
"0.6617147",
"0.6457447",
"0.6435",
"0.6404069",
"0.6323231",
"0.63171077",
"0.63085896",
"0.62303746",
"0.6183825",
"0.60657495",
"0.6057865",
"0.60567707",
"0.60466063... | 0.7314069 | 3 |
Load given plugin and return it | def load(cls, name):
try:
return importlib.import_module(cls._plugins[name])
except Exception as err:
print("** could not load command [%s]:\n%s" % (name, err)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def load_plugin(self, plugin):\n return imp.load_module(self._main_module, *plugin[\"info\"])",
"def load_plugin(self, name, path):\n\t\ttry:\n\t\t\t# Plugins are just python modules.\n\t\t\tloader = importlib.machinery.SourceFileLoader(name, path)\n\t\t\tmodule = loader.load_module()\n\t\t\treturn module... | [
"0.79216456",
"0.7612727",
"0.7328264",
"0.72904503",
"0.7157872",
"0.70989466",
"0.7066221",
"0.70467865",
"0.70133096",
"0.70006204",
"0.6922476",
"0.6904413",
"0.68847173",
"0.68643945",
"0.6856145",
"0.67258775",
"0.66545933",
"0.6615198",
"0.65893775",
"0.6538303",
"0.65... | 0.6811802 | 15 |
Decorator to declare that a function is a command. | def command(*args, **kwargs):
def deco(fct):
return Command(fct, **kwargs)
if args:
return deco(*args)
return deco | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def command(func: 'function') -> 'function':\n func._decorators = (Bot.command,)\n return func",
"def register_command(func):\n supported_commands.append(func.__name__)\n return func",
"def command(*args, **kwargs):\r\n def decorator(func):\r\n if not asyncio.iscoroutinefunction(f... | [
"0.8337103",
"0.73776597",
"0.7353231",
"0.72156996",
"0.72095853",
"0.71532375",
"0.7108904",
"0.70502794",
"0.7032471",
"0.7020607",
"0.6956488",
"0.6867293",
"0.68605304",
"0.68211627",
"0.68211627",
"0.6736925",
"0.6724423",
"0.66995513",
"0.6698784",
"0.6670715",
"0.6526... | 0.7109359 | 6 |
Decorator to add an argument to a command. | def argument(*args, **kwargs):
def deco(fct):
if isinstance(fct, Command):
cmd = fct
cmd.add_argument(*args, **kwargs)
else:
if not hasattr(fct, '_acmdlib_arguments'):
fct._acmdlib_arguments = []
fct._acmdlib_arguments.append((args, kwa... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_argument(self, *args, **kwargs):\n self.parser.add_argument(*args, **kwargs)",
"def add_argument(self, *args, **kwargs):\n self.parser.add_argument(*args, **kwargs)",
"def add_argument(self, *args, **kwargs):\n self.parser.add_argument(*args, **kwargs)",
"def add_argument(self, *... | [
"0.7451828",
"0.7451828",
"0.7451828",
"0.741571",
"0.7412598",
"0.726459",
"0.7180163",
"0.7106914",
"0.7005616",
"0.68368924",
"0.6808896",
"0.6733548",
"0.6690725",
"0.6668984",
"0.6514335",
"0.64958876",
"0.64205587",
"0.6419554",
"0.6404166",
"0.63926023",
"0.6352386",
... | 0.75847644 | 0 |
Registers a plugin, given a name and value. | def register(name, value):
return Plugins.register(name, value) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def register_plugin(self, name):\n\n global plugins_by_name, registerorder\n\n if plugins_by_name.has_key(name):\n warning('Can not add a plugin with duplicate name\\n')\n return False\n plugins_by_name[name] = self\n self.name = name\n registerorder.append(... | [
"0.697755",
"0.68559104",
"0.6546401",
"0.64251965",
"0.639463",
"0.63811576",
"0.63225853",
"0.62063575",
"0.6146216",
"0.61150974",
"0.6103113",
"0.602875",
"0.5994227",
"0.5951504",
"0.592872",
"0.5829238",
"0.5812474",
"0.57953626",
"0.57875925",
"0.575865",
"0.5722736",
... | 0.87815213 | 0 |
Solve the obstacle problem u >= psi in D, | def obstacle(psi,f_rhs,tol,f_dist,h0,pts,tri,*args,**kwargs):
announce = kwargs.get('announce',False)
if announce:
print (" obstacle: asking poisson() for linear system and unconstrained soln ...")
# use poisson to get unconstrained stiffness, load
uhpoisson, inside, AA, bb = poisson(f_rhs,f_di... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def potentialSolver4(self, w, max_it, tol):\n\n dx2 = 1.0/(self.dh[0]*self.dh[0]); # dx^2\n dy2 = 1.0/(self.dh[1]*self.dh[1]); # dy^2\n dz2 = 1.0/(self.dh[2]*self.dh[2]); # dz^2\n \n L2 = 0.0 # norm\n \n converged = False\n \n # Step 1: create *integer* ar... | [
"0.63812715",
"0.63644165",
"0.62942004",
"0.62942004",
"0.6065367",
"0.6041697",
"0.59314823",
"0.5882779",
"0.58666945",
"0.58614814",
"0.5716704",
"0.5688724",
"0.5686755",
"0.5686196",
"0.5678814",
"0.56656295",
"0.5624756",
"0.55952203",
"0.5589645",
"0.5587976",
"0.5583... | 0.70703965 | 0 |
initialize light cnn network with given weights file. if weights file is None, the weights are initialized by default initializer. | def __init__(self, classes=None, extractor_type='29v2', extractor_weights=None, classifier_weights=None, in_size_hw=(128, 128)):
self.in_size_hw = in_size_hw
self.num_classes = classes
self.extractor_weights = extractor_weights
self.classifier_weights = classifier_weights
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def init_weights(self, load_weights=None):\n if load_weights:\n # TODO\n pass\n else:\n # x: lower layer nodes n\n # y: current layer nodes n\n x = self.weights_shape[1]\n y = self.weights_shape[0]\n self.weights = np.random.randn(y, x) / np.sqrt(x) # pylint: disable=no-mem... | [
"0.7651809",
"0.7207766",
"0.714582",
"0.71045166",
"0.7063997",
"0.70586157",
"0.7006124",
"0.6996825",
"0.6922726",
"0.6919001",
"0.6825991",
"0.67974085",
"0.6793859",
"0.6781146",
"0.6740116",
"0.6736335",
"0.6708144",
"0.6689562",
"0.66745234",
"0.66745234",
"0.66745234"... | 0.0 | -1 |
getter for singleton extractor. | def extractor(self):
if self._extractor is None:
if self.extractor_type == '29v2':
self._extractor = self.build_extractor_29layers_v2(name='extract29v2', block=self._res_block, layers=[1, 2, 3, 4])
elif self.extractor_type == '29':
self._extractor... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def singleton(cls):\n instances = {}\n\n def getinstance():\n \"\"\" Creates a single object and use instances dict as cache \"\"\"\n if cls not in instances:\n instances[cls] = cls()\n return instances[cls]\n return getinstance",
"def get_instance(self):\n if Doub... | [
"0.6266778",
"0.6247794",
"0.614957",
"0.61028934",
"0.60426927",
"0.600921",
"0.6002745",
"0.5977671",
"0.596357",
"0.5892323",
"0.5892323",
"0.58897716",
"0.58401835",
"0.5787079",
"0.5787079",
"0.5671705",
"0.5566907",
"0.55459845",
"0.55459845",
"0.5538413",
"0.55135524",... | 0.0 | -1 |
getter for singleton classifier. | def classifier(self):
if self._classifier is None:
self._classifier = self.build_classifier(name='classify')
if self.classifier_weights is not None:
self._classifier.load_weights(self.classifier_weights)
return self._classifier | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _get_classifier(self):\n return self.__classifier",
"def _get_classifier(self):\n return self.__classifier",
"def _get_classifier(self):\n return self.__classifier",
"def _get_classifier(self):\n return self.__classifier",
"def _get_classifier(self):\n return self.__classifier",
"def _... | [
"0.7756015",
"0.7756015",
"0.7756015",
"0.7756015",
"0.7756015",
"0.7756015",
"0.7756015",
"0.7756015",
"0.7756015",
"0.69584286",
"0.6874621",
"0.67243356",
"0.6503583",
"0.63636595",
"0.6323945",
"0.6323945",
"0.6323945",
"0.63049364",
"0.6191823",
"0.6151629",
"0.6077883",... | 0.62447935 | 18 |
private func for creating mfm layer. | def _mfm(self, X, name, out_channels, kernel_size=3, strides=1, dense=False):
if dense:
X = Dense(out_channels*2, name = name + '_dense1', kernel_regularizer=regularizers.l2(0.0005))(X)
else:
X = Conv2D(out_channels*2, name = name + '_conv2d1', kernel_size=kernel_size, k... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def createMemoryLayer(self):\n suffix = \"\"\n name = \"Vector Bender\"\n while len(QgsProject.instance().mapLayersByName(name + suffix)) > 0:\n if suffix == \"\":\n suffix = \" 1\"\n else:\n suffix = \" \" + str(int(suffix) + 1)\n new... | [
"0.60201424",
"0.59832776",
"0.5876605",
"0.58744705",
"0.5781926",
"0.576417",
"0.5734946",
"0.5696283",
"0.5696136",
"0.5687624",
"0.5683983",
"0.568249",
"0.5678778",
"0.56605774",
"0.5640936",
"0.56265724",
"0.56147987",
"0.5612207",
"0.5605323",
"0.5601065",
"0.55655473"... | 0.54295784 | 33 |
private func for creating 2 mfm layers. | def _group(self, X, name, in_channels, out_channels, kernel_size, strides):
X = self._mfm(X, name = name + '_mfm1', out_channels=in_channels, kernel_size=1, strides=1, dense=False)
X = self._mfm(X, name = name + '_mfm2', out_channels=out_channels, kernel_size=kernel_size, strides=strides)
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def build_layers(self):\n raise NotImplementedError",
"def _init_layers(self) -> None:\n self.self_attn = MultiheadAttention(**self.self_attn_cfg)\n self.embed_dims = self.self_attn.embed_dims\n self.ffn = FFN(**self.ffn_cfg)\n norms_list = [\n build_norm_layer(self.norm... | [
"0.59832346",
"0.5962929",
"0.59226876",
"0.59107625",
"0.5861501",
"0.58477557",
"0.58155924",
"0.5741318",
"0.5718645",
"0.56420654",
"0.5623015",
"0.56210685",
"0.55862814",
"0.5582824",
"0.5582824",
"0.55818605",
"0.5579767",
"0.55610335",
"0.5548647",
"0.5521422",
"0.549... | 0.53793865 | 34 |
private func for creating residual block with mfm layers. | def _res_block(self, X, name, out_channels):
X_shortcut = X
X = self._mfm(X, name = name + '_mfm1', out_channels=out_channels, kernel_size=3, strides=1)
X = self._mfm(X, name = name + '_mfm2', out_channels=out_channels, kernel_size=3, strides=1)
X = Add()([X, X_shortcut])
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _residual_block(input, id_block, conv_block, mid_f, output_f, repetitions, stage, is_first_layer=False):\n\n for i in range(repetitions):\n if i == 0 and is_first_layer is True:\n input = conv_block(mid_f, output_f, stage, i, input, stride=(1, 1))\n elif i == 0 and is_first_layer is... | [
"0.67419946",
"0.6413987",
"0.6301651",
"0.6196587",
"0.61700547",
"0.6155078",
"0.6151",
"0.61041856",
"0.61016715",
"0.59957874",
"0.59862506",
"0.59693253",
"0.595324",
"0.59517217",
"0.5950013",
"0.5940206",
"0.58783394",
"0.584375",
"0.5824607",
"0.5810628",
"0.5760141",... | 0.6444488 | 1 |
private func for creating multiple blocks. block is usualy res_block. | def _make_layer(self, X, name, block, num_blocks, out_channels):
for i in range(0, num_blocks):
X = block(X, name = name + '_block{}'.format(i), out_channels=out_channels)
return X | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _prepare_blocks():\n\n counter = blocks[0]['freeStart']\n maxBlocks = blocks[0]['maxBlocks']\n while(counter < maxBlocks) :\n try:\n # print (mount['parent'] + '/linddata.' + str(counter))\n f = open(mount['parent'] + '/linddata.' + str(counter), 'r') \n ex... | [
"0.67748404",
"0.6642984",
"0.63496435",
"0.63130933",
"0.6258351",
"0.6191314",
"0.6110065",
"0.6109854",
"0.6105845",
"0.61032474",
"0.6098054",
"0.6091347",
"0.60367674",
"0.60020596",
"0.6001679",
"0.5992938",
"0.5966043",
"0.594118",
"0.5921096",
"0.5920706",
"0.5915601"... | 0.605067 | 12 |
train extractor and classifier. | def train(self, train_gen, valid_gen=None, optimizer=SGD(lr=0.001, momentum=0.9, decay=0.00004, nesterov=True), classifier_dropout=0.7,
steps_per_epoch=100, validation_steps=100, epochs=1, out_prefix='', out_period=1, fix_extractor=False):
self.classifier().trainable = True
self.e... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def train():\n pass",
"def trainModel( self, featureTrain, classTrain):",
"def __init__(self):\n self.train(positivity_files, 0)\n self.train(subjectivity_files, 1)",
"def train(self):\n pass",
"def train(self):\n pass",
"def train(self):\n pass",
"def train(se... | [
"0.7537356",
"0.7429161",
"0.7419909",
"0.73915976",
"0.73915976",
"0.73915976",
"0.73915976",
"0.73915976",
"0.7385311",
"0.7219684",
"0.7208528",
"0.7204108",
"0.71944785",
"0.71705073",
"0.71624994",
"0.7110595",
"0.71061516",
"0.70766854",
"0.7055657",
"0.70118415",
"0.69... | 0.65674865 | 73 |
Implement the cost unitary on a quantum circuit | def create_cost_unitary(graph, gamma):
cost_unitary = QuantumCircuit(len(graph.nodes), name="Cost Unitary")
weights = nx.get_edge_attributes(graph, 'weight').values() # Get weights from graph
# Add corresponding gates for each edge
for edge, weight in zip(graph.edges, weights):
cost_unitary.cx... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def cost(self) -> float:",
"def get_expected_cost(self):",
"def test_cost(self):\n # Get components for the network\n data = array([[1, 0], [0, 1]])\n cdata = LabeledCData(data, labels=array([0, 1]))\n encoder = BinaryEncoding(cdata)\n ansatz = ProductAnsatz(2)\n measu... | [
"0.68488115",
"0.6676873",
"0.6530056",
"0.64137113",
"0.63804185",
"0.6369975",
"0.63596255",
"0.63438195",
"0.63241434",
"0.63170785",
"0.6270699",
"0.6211465",
"0.6211461",
"0.61955154",
"0.6194919",
"0.6193794",
"0.61936337",
"0.61724436",
"0.61697114",
"0.61510956",
"0.6... | 0.6387792 | 4 |
Implement the mixer unitary on a quantum circuit | def create_mixer_unitary(graph, beta):
mixer_unitary = QuantumCircuit(len(graph.nodes), name="Mixer Unitary")
# Apply unitary for each node
for node in graph.nodes:
mixer_unitary.rx(2*beta, int(node))
mixer_unitary.to_gate()
return mixer_unitary | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_x_mixer_output(self):\n\n wires = range(4)\n mixer_hamiltonian = qaoa.x_mixer(wires)\n\n mixer_coeffs = mixer_hamiltonian.coeffs\n mixer_ops = [i.name for i in mixer_hamiltonian.ops]\n mixer_wires = [i.wires[0] for i in mixer_hamiltonian.ops]\n\n assert mixer_coef... | [
"0.6317439",
"0.6317439",
"0.60724324",
"0.5952803",
"0.57481503",
"0.5437349",
"0.54311913",
"0.5425911",
"0.5412592",
"0.5407849",
"0.5392802",
"0.5332992",
"0.5329644",
"0.53256863",
"0.5317726",
"0.5311661",
"0.52882445",
"0.52882445",
"0.52882445",
"0.52882445",
"0.52882... | 0.6545433 | 0 |
Create the full QAOA circuit for the graph with the given parameters. | def create_qaoa_circuit(graph, params):
num_of_iterations = int(len(params)/2)
gammas = params[:num_of_iterations] # Let the first half of the params list be gamma parameters
betas = params[num_of_iterations:] # Let the second half of the params list be beta parameters
# Initialize Circuit
qr = Qua... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def qaoa_circuit(self,\n with_noise: cirq.SingleQubitGate = None) -> cirq.Circuit:\n # Symbols for the rotation angles in the QAOA circuit.\n alpha = sympy.Symbol('alpha')\n beta = sympy.Symbol('beta')\n\n qubits = cirq.LineQubit.range(self.num_nodes) # Create qubit... | [
"0.6899125",
"0.63434273",
"0.6278276",
"0.6171898",
"0.6142525",
"0.6135607",
"0.61242694",
"0.60825694",
"0.59941727",
"0.59199876",
"0.59169763",
"0.59160596",
"0.59001786",
"0.58980465",
"0.58540994",
"0.5845812",
"0.5826757",
"0.5815075",
"0.57363445",
"0.5685105",
"0.56... | 0.81415427 | 0 |
Return the weighted average of the results of the quantum circuit. | def get_expectation(graph, counts):
energy = 0
total_executions = 0
for bit_string, frequency in counts.items():
energy += frequency * graph.get_cut_size(bit_string)
total_executions += frequency
return energy / total_executions # Return the average | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def calculate_weighted_results():\n pass",
"def calculate_average(precisions, weights):\n tmp_res = 1\n for id, item in enumerate(precisions):\n tmp_res = tmp_res*np.power(item, weights[id])\n tmp_res = np.power(tmp_res, np.sum(weights))\n return tmp_res",
"def calculate_average(precision... | [
"0.6902643",
"0.6651766",
"0.6634851",
"0.6548818",
"0.6469726",
"0.6452432",
"0.6347582",
"0.63293266",
"0.63228565",
"0.631662",
"0.6289856",
"0.62674266",
"0.6246561",
"0.62211573",
"0.6175649",
"0.61506116",
"0.61506116",
"0.61377454",
"0.61358935",
"0.61342597",
"0.61178... | 0.0 | -1 |
Tests instantiate method, where object config has no _target_ directive | def test_instantiate_no_target(self):
# create test configs
test_configs = [
{},
{"a": 1, "b": 2}
]
# check that instantiate raises ValueError for each test config
for test_conf in test_configs:
self.assertRaises(ValueError, instantiate, test_... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_instantiate_valid_target(self):\n # create test configs\n test_configs = [\n {\"_target_\": \"collections.deque\"},\n {\"_target_\": \"collections.UserString\", \"seq\": \"test string\"}\n ]\n\n # create truth objects\n truth_objs = [deque(), UserSt... | [
"0.7144292",
"0.6309696",
"0.6302354",
"0.62679553",
"0.6076424",
"0.6020874",
"0.6020245",
"0.5987849",
"0.59708595",
"0.59405315",
"0.5908926",
"0.59018385",
"0.5884045",
"0.58709836",
"0.5863174",
"0.5815736",
"0.5800829",
"0.57929033",
"0.57757896",
"0.5773337",
"0.573020... | 0.6917465 | 1 |
Tests instantiate method, where target module doesn't exist | def test_instantiate_non_existent_module(self):
# create test configs
test_configs = [
{"_target_": "non_existent_module.some_class"},
{"_target_": "another_non_existent_module.some_class", "a": 1, "b": 2}
]
# check that instantiate raises ModuleNotFoundError for... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_can_instantiate(self):\n\n exc_thrown = False\n\n try:\n self.klass(*self.instantiate_args)\n except Exception:\n exc_thrown = True\n\n self.assertFalse(exc_thrown)",
"def test_module(self):\n pass",
"def test_instantiate_no_target(self):\n ... | [
"0.706873",
"0.67120045",
"0.6450792",
"0.6442711",
"0.63833404",
"0.632416",
"0.62741697",
"0.6273905",
"0.6213007",
"0.61954844",
"0.6162283",
"0.61395144",
"0.61349386",
"0.61349386",
"0.6088037",
"0.60755724",
"0.60616666",
"0.6052386",
"0.60230875",
"0.60206574",
"0.6020... | 0.74603057 | 0 |
Tests instantiate method, where target class doesn't exist | def test_instantiate_non_existent_class(self):
# create test configs
test_configs = [
{"_target_": "collections.NonExistentClass"},
{"_target_": "collections.OtherNonExistentClass", "a": 1, "b": 2}
]
# check that instantiate raises AttributeError for each test co... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_can_instantiate(self):\n\n exc_thrown = False\n\n try:\n self.klass(*self.instantiate_args)\n except Exception:\n exc_thrown = True\n\n self.assertFalse(exc_thrown)",
"def test_instantiate_valid_target(self):\n # create test configs\n test_... | [
"0.79841703",
"0.6840013",
"0.68238115",
"0.6583024",
"0.6546963",
"0.6464835",
"0.6391154",
"0.63562906",
"0.63544935",
"0.62982786",
"0.62565255",
"0.62392247",
"0.62392247",
"0.6218023",
"0.61846364",
"0.6168579",
"0.6147168",
"0.6129624",
"0.612689",
"0.6121361",
"0.61213... | 0.74095106 | 1 |
Tests instantiate method with valid target module and class | def test_instantiate_valid_target(self):
# create test configs
test_configs = [
{"_target_": "collections.deque"},
{"_target_": "collections.UserString", "seq": "test string"}
]
# create truth objects
truth_objs = [deque(), UserString("test string")]
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_can_instantiate(self):\n\n exc_thrown = False\n\n try:\n self.klass(*self.instantiate_args)\n except Exception:\n exc_thrown = True\n\n self.assertFalse(exc_thrown)",
"def instantiate(name, *args, **kwargs):\n ...",
"def create_module(cls, *args, **... | [
"0.7439965",
"0.66417146",
"0.64072406",
"0.64072406",
"0.63771486",
"0.6362516",
"0.6324918",
"0.62324893",
"0.6224451",
"0.62205917",
"0.6088758",
"0.6088758",
"0.6088758",
"0.60410625",
"0.6039051",
"0.6021471",
"0.60123706",
"0.601191",
"0.6001706",
"0.59884065",
"0.59884... | 0.7038484 | 1 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.