query stringlengths 9 9.05k | document stringlengths 10 222k | metadata dict | negatives listlengths 30 30 | negative_scores listlengths 30 30 | document_score stringlengths 4 10 | document_rank stringclasses 2
values |
|---|---|---|---|---|---|---|
Get the absolute property value with propertyname for the given atom. | def GetRelativeAtomicProperty(element='C',propertyname='m'):
CpropertyDic = float(GetAbsoluteAtomicProperty('C', propertyname))
PropertyDic = float(GetAbsoluteAtomicProperty(element, propertyname))
return PropertyDic/CpropertyDic | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def GetAbsoluteAtomicProperty(element='C',propertyname='m'):\n\n if propertyname == \"m\":\n return periodicTable.GetAtomicWeight(element)\n elif propertyname == \"V\":\n r = periodicTable.GetRvdw(element)\n V = 4/3*pi*r**3\n return V\n elif propertyname == \"Z\":\n retu... | [
"0.71773916",
"0.6322747",
"0.61566937",
"0.60482395",
"0.60195005",
"0.5999082",
"0.5951637",
"0.59448093",
"0.5930747",
"0.5896596",
"0.58638",
"0.585692",
"0.5847448",
"0.58387524",
"0.5810104",
"0.57515085",
"0.574562",
"0.5737195",
"0.5735811",
"0.5706954",
"0.5691982",
... | 0.65785086 | 1 |
Picks the best model based on KFold validation. Ridge (lr) Random Forrest Regressor (rf) Support Vector Machine Regressor (svr) | def pick_model(self):
self.x = self.train[self.use_columns]
try:
self.x = pd.get_dummies(self.x)
except:
pass # if no categorical features
self.final_columns = self.x.columns
print(self.x.columns)
self.scaler = StandardScaler()
self.x = sel... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def select_best_model(self, df):\n params = {\n # check whether unigrams give good results or bigrams.\n \"vectorizer__vectorizer\": [self.feature_name_to_class[self.feature]],\n \"vectorizer__ngram_range\": [(1,1), (1,2), (2,2)],\n # check pca parameters\n ... | [
"0.70401394",
"0.6594376",
"0.65197843",
"0.6514612",
"0.6472461",
"0.64660364",
"0.64625597",
"0.6340449",
"0.63050693",
"0.625302",
"0.6244924",
"0.6203827",
"0.6200401",
"0.6178384",
"0.6176473",
"0.6137107",
"0.61194456",
"0.6112998",
"0.6086907",
"0.60695493",
"0.60676",... | 0.8048125 | 0 |
Check if s is a type of list | def is_list ( self, s ):
return isinstance ( s, type( list () ) ) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_list(s_list):\n return isa(s_list, List)",
"def _is_list(item):\n return isinstance(item, list)",
"def isList(x):\n \n return ( type(x) == list ) # True if the type of x is a list",
"def _is_list(arg):\n return isinstance(arg, collections.Sequence) and not _is_string(arg)",
"def isLis... | [
"0.84522414",
"0.80067027",
"0.80044675",
"0.798943",
"0.78784645",
"0.78642255",
"0.7797972",
"0.77470225",
"0.7729441",
"0.770684",
"0.7510177",
"0.74303883",
"0.73520446",
"0.73322815",
"0.73082334",
"0.72993803",
"0.71319544",
"0.71102685",
"0.7052229",
"0.69552034",
"0.6... | 0.9174904 | 0 |
Check if s is a type of str | def is_str ( self, s ):
return isinstance ( s, type( str () ) ) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_string(s):\n try:\n return isinstance(s, basestring)\n except NameError:\n return isinstance(s, str)",
"def isString(s):\r\n try:\r\n return isinstance(s, unicode) or isinstance(s, basestring)\r\n except NameError:\r\n return isinstance(s, str)",
"def is_str(x):\n... | [
"0.8550737",
"0.84955674",
"0.8198416",
"0.81717855",
"0.8066725",
"0.8013463",
"0.79932284",
"0.78747827",
"0.7864553",
"0.7827748",
"0.78243095",
"0.7745743",
"0.7659679",
"0.75780845",
"0.75697416",
"0.7567884",
"0.7553253",
"0.7485784",
"0.7336275",
"0.73066056",
"0.72074... | 0.89311457 | 0 |
The Action Group resource IDs. | def group_ids(self) -> pulumi.Input[Sequence[pulumi.Input[str]]]:
return pulumi.get(self, "group_ids") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def groups(self):\r\n return resources.Groups(self)",
"def action_group_id(self) -> Optional[str]:\n return pulumi.get(self, \"action_group_id\")",
"def group_ids(self) -> Optional[Sequence[str]]:\n return pulumi.get(self, \"group_ids\")",
"def resource_group_ids_scope(self) -> str:\n ... | [
"0.667532",
"0.6325436",
"0.6276232",
"0.6123759",
"0.6123759",
"0.60838944",
"0.607983",
"0.6047004",
"0.5986194",
"0.5986194",
"0.5986194",
"0.5986194",
"0.5986194",
"0.5975283",
"0.5970267",
"0.5931191",
"0.58320796",
"0.5817181",
"0.5813919",
"0.579841",
"0.5774376",
"0... | 0.64152503 | 1 |
An optional custom email subject to use in email notifications. | def custom_email_subject(self) -> Optional[pulumi.Input[str]]:
return pulumi.get(self, "custom_email_subject") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def subject(self, subject: \"str\"):\n self._attrs[\"subject\"] = subject",
"def subject(self, subject: \"str\"):\n self._attrs[\"subject\"] = subject",
"def subject(self):\n return self.mail.get('Subject')",
"def _get_email_subject(app_name):\n return '{} <==> Tote'.format(app_name)",
... | [
"0.6489472",
"0.6489472",
"0.6424295",
"0.6249044",
"0.62452984",
"0.62452984",
"0.61771196",
"0.6170477",
"0.61662596",
"0.61575764",
"0.61519724",
"0.6137915",
"0.6137259",
"0.6122633",
"0.61057836",
"0.6089166",
"0.6057406",
"0.5999996",
"0.5969143",
"0.5958554",
"0.595855... | 0.8148969 | 0 |
An optional custom webhook payload to use in webhook notifications. | def custom_webhook_payload(self) -> Optional[pulumi.Input[str]]:
return pulumi.get(self, "custom_webhook_payload") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def webhook_payload(self, webhook_payload: \"str\"):\n self._attrs[\"webhookPayload\"] = webhook_payload",
"def webhook_payload(self, webhook_payload: \"str\"):\n self._attrs[\"webhookPayload\"] = webhook_payload",
"def webhook(self) -> Optional[pulumi.Input['WebhookArgs']]:\n return pulum... | [
"0.72018594",
"0.72018594",
"0.6760789",
"0.6682386",
"0.6682386",
"0.5861288",
"0.5847646",
"0.5813326",
"0.5803336",
"0.5803336",
"0.57824904",
"0.5756584",
"0.56841034",
"0.5636358",
"0.5582661",
"0.5581426",
"0.5537865",
"0.5537564",
"0.5537564",
"0.55360824",
"0.5485823"... | 0.81966394 | 0 |
A utility that returns the path value after argument paramsfile. | def get_launch_params_filepath():
try:
cli_args = sys.argv
return sys.argv[sys.argv.index("--params-file") + 1]
except ValueError:
return "Failed to parse params file path from command line arguments. Check that --params-file command line argument is specified." | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _get_params_filepath(self):\n\t\treturn os.path.join(self.workdir, \"params.txt\")",
"def real_path(self):\n\t\treturn self.args[0]",
"def file_path(self) -> global___Expression:",
"def get_path(f=sys.argv[0]):\n\n return os.path.split(f)",
"def os_open_parmfile( self, ):\r\n #a_filename = s... | [
"0.7624893",
"0.68737656",
"0.670442",
"0.6365876",
"0.6337929",
"0.6162294",
"0.615216",
"0.61517036",
"0.6106824",
"0.60423446",
"0.6040788",
"0.5980116",
"0.5948549",
"0.5932665",
"0.58959836",
"0.58959836",
"0.58959836",
"0.58959836",
"0.58959836",
"0.58959836",
"0.589598... | 0.7436746 | 1 |
Tests if friendship target>friend is defined | def test_friendship (target, friend):
db = getattr(g, 'db', None)
if target == friend:
return True
else:
qry = "SELECT target, friend FROM friends WHERE \
target=(SELECT id FROM profiles WHERE username = %s) AND \
friend=(SELECT id FROM profiles WHERE username = %s);"
with db as cur:
lines = cur.e... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def has_friendliness(self):\n trait = self.traitDao.get_friendliness(self.name)\n if trait is None:\n return False\n else:\n return True",
"def is_mutual_frined(self, friend):\n if friend in self.friends.all():\n return True\n return False",
"... | [
"0.6714983",
"0.6594233",
"0.6423168",
"0.6402457",
"0.5981811",
"0.5911614",
"0.59064144",
"0.5853339",
"0.5714427",
"0.56824875",
"0.5639276",
"0.56333655",
"0.56333655",
"0.56333655",
"0.54966736",
"0.5464046",
"0.5442402",
"0.5438603",
"0.5426189",
"0.5373081",
"0.5360212... | 0.73897105 | 0 |
Retrieves profile for username | def get(self, username):
db = getattr(g, 'db', None)
qry = "SELECT username,email,active,steamid FROM\
profiles WHERE username = %s;"
with db as cursor:
cursor.execute(qry, (username,))
return {'profile':cursor.fetchone()} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_profile(username):\n if username not in Profiles.keys():\n return jsonify({'message': 'User {} not found'.format(username)}), 404\n\n return jsonify(Profiles[username]), 200",
"def get(self, username):\n q = \"SELECT * FROM profiles where username = ?\"\n r = self._query(q, (us... | [
"0.8413499",
"0.82812774",
"0.8042954",
"0.7941889",
"0.78936595",
"0.779309",
"0.76990896",
"0.7561721",
"0.74403584",
"0.7425508",
"0.7377645",
"0.7368524",
"0.73320585",
"0.7236102",
"0.7218599",
"0.7194637",
"0.7192519",
"0.71801066",
"0.7172978",
"0.7171257",
"0.71467376... | 0.8399312 | 1 |
The mapping of the redirectes. | def redirects(self):
return self.data.setdefault('redirects', {}) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_forward_mapping(self):",
"def redirects(self) -> List[str]:\n return self.root_hartree.redirects",
"def redirect_info(self) -> global___RedirectInfo:",
"def mapping(self):\n return self.request('_mapping', pylastica.request.Request.GET).data",
"def redirects(self) -> Sequence['outputs... | [
"0.6916905",
"0.6815443",
"0.67125463",
"0.662277",
"0.61875254",
"0.60155004",
"0.59925747",
"0.59136647",
"0.5907251",
"0.59005374",
"0.5879071",
"0.58469695",
"0.584341",
"0.5838869",
"0.5830796",
"0.58191055",
"0.57895535",
"0.57752067",
"0.5740669",
"0.5731347",
"0.57131... | 0.7429613 | 0 |
Setup the point and the opponent population. | def setup(self, teams_population):
# initialize point population
if self.first_sampling_:
self.first_sampling_ = False
population = self._initialize_random_population_of_points(
Config.USER['training_parameters']['populations']['points'], ignore_cache = False)
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def setUp(self):\n self.precip_cube = setup_precipitation_cube()\n self.oe_cube = setup_orographic_enhancement_cube()\n self.vel_x = set_up_xy_velocity_cube(\"advection_velocity_x\")\n self.vel_y = set_up_xy_velocity_cube(\"advection_velocity_y\")\n for cube in [self.precip_cube,... | [
"0.6427155",
"0.6339535",
"0.62995",
"0.6293595",
"0.62396276",
"0.622806",
"0.6038252",
"0.60198253",
"0.59984106",
"0.5886223",
"0.5802406",
"0.5793876",
"0.57286704",
"0.5708907",
"0.570502",
"0.5701593",
"0.5697477",
"0.5675635",
"0.56636167",
"0.5645536",
"0.563043",
"... | 0.6626061 | 0 |
Remove the points to remove from the teams, in order to save memory. | def _remove_points(self, points_to_remove, teams_population):
for team in teams_population:
for point in points_to_remove:
if point.point_id_ in team.results_per_points_:
team.results_per_points_.pop(point.point_id_) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def del_points(self):\r\n del self._points",
"def destroy(self):\n\t\tfor team in range(len(self.dots)): #will cycle through each team\n\t\t\tfor i in range(len(self.dots[team])): #will cycle through each member of the team\n\t\t\t\tdot = self.dots[team][i]\n\t\t\t\tdot.removeNode()\n\t\tself.mousePositio... | [
"0.67026097",
"0.6327885",
"0.62851137",
"0.62131107",
"0.6038065",
"0.6032935",
"0.5973593",
"0.596316",
"0.5955202",
"0.5929192",
"0.5922632",
"0.58826",
"0.58732504",
"0.5854974",
"0.5841126",
"0.5835358",
"0.5800378",
"0.5777191",
"0.57631856",
"0.57612944",
"0.5752895",
... | 0.8073968 | 0 |
Fixes the y coordinates of external port dummies in the given layer. | def fixCoordinates(self, layer: LNodeLayer, layeredGraph: LGraph):
portConstraints = layeredGraph.portConstraints
if not (portConstraints.isRatioFixed() or portConstraints.isPosFixed()):
# If coordinates are free to be set, we're done
return
graphHeight = self.layeredGra... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def init_dense(self, layer):\n pass",
"def layer(self, layer):\n self._layer = layer",
"def move_stage_to_y(self, y):\n raise NotImplementedError",
"def update_ballpos(self,pos):\n if self.options.visualize_switch_xy:\n self.col.set_offsets(pos[:,::-1]) # reverse x-y di... | [
"0.51316124",
"0.49926874",
"0.4936033",
"0.47214425",
"0.47075492",
"0.46918088",
"0.46397915",
"0.46308416",
"0.46218592",
"0.46196276",
"0.46006182",
"0.4595828",
"0.45934147",
"0.45880044",
"0.45867378",
"0.45682788",
"0.4562465",
"0.4542178",
"0.45411748",
"0.4537493",
"... | 0.705069 | 0 |
Test the command to bulkupdate patients contact | def test_update_contact(mock_app, gpx4_patients):
runner = mock_app.test_cli_runner()
patients_collection = mock_app.db.patients
# GIVEN a database with some patients
patients_collection.insert_many(gpx4_patients)
test_patients = patients_collection.find()
# Sharing a contact information
c... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_otoroshi_controllers_adminapi_tcp_service_api_controller_bulk_update_action(self):\n pass",
"def test_otoroshi_controllers_adminapi_tcp_service_api_controller_bulk_patch_action(self):\n pass",
"def test_update_batch(self):\n self.batch_data['batch_id'] = self.batch_info.id\n ... | [
"0.7028907",
"0.67930585",
"0.666327",
"0.62609684",
"0.6216473",
"0.6037648",
"0.5950919",
"0.59361154",
"0.593158",
"0.589418",
"0.58618575",
"0.58603084",
"0.585794",
"0.5840429",
"0.5838186",
"0.58320105",
"0.58251095",
"0.58173716",
"0.5804996",
"0.5788242",
"0.57680327"... | 0.6999571 | 1 |
Test the command to bulkupdate patients contact when old contact href is not matching any patients | def test_update_contact_no_href_match(mock_app, gpx4_patients):
runner = mock_app.test_cli_runner()
patients_collection = mock_app.db.patients
# GIVEN a database with some patients
patients_collection.insert_many(gpx4_patients)
test_patients = patients_collection.find()
# Sharing a contact inf... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_update_contact_multiple_href_match(mock_app, gpx4_patients):\n\n runner = mock_app.test_cli_runner()\n patients_collection = mock_app.db.patients\n\n assert len(gpx4_patients) == 2\n # GIVEN a database with 2 patients with sligthly different contact href\n gpx4_patients[0][\"contact\"][\"hr... | [
"0.77498806",
"0.6971011",
"0.5990428",
"0.5918833",
"0.5805121",
"0.5728971",
"0.5712339",
"0.56514984",
"0.56374675",
"0.5603962",
"0.5593991",
"0.5562969",
"0.5558192",
"0.5555756",
"0.555545",
"0.5505084",
"0.5498885",
"0.5491362",
"0.5473769",
"0.5473551",
"0.546801",
... | 0.7636279 | 1 |
Test the command to bulkupdate patients contact when old contact href is matching more than one patient contact | def test_update_contact_multiple_href_match(mock_app, gpx4_patients):
runner = mock_app.test_cli_runner()
patients_collection = mock_app.db.patients
assert len(gpx4_patients) == 2
# GIVEN a database with 2 patients with sligthly different contact href
gpx4_patients[0]["contact"]["href"] = "test_1@... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_update_contact_no_href_match(mock_app, gpx4_patients):\n\n runner = mock_app.test_cli_runner()\n patients_collection = mock_app.db.patients\n\n # GIVEN a database with some patients\n patients_collection.insert_many(gpx4_patients)\n test_patients = patients_collection.find()\n # Sharing ... | [
"0.7225289",
"0.6630789",
"0.5863282",
"0.58182335",
"0.5813409",
"0.571845",
"0.5649232",
"0.5634012",
"0.56237847",
"0.5583595",
"0.55478853",
"0.5496923",
"0.5478822",
"0.5456204",
"0.5439767",
"0.5429322",
"0.5392458",
"0.5379931",
"0.53564715",
"0.53475344",
"0.5325671",... | 0.7989029 | 0 |
Code to extract spike frames from the specified unit. | def get_unit_spike_train(self, unit_id, start_frame=None, end_frame=None):
if self.spike_train is None:
self.spike_train = np.load(self.fname_spike_train)
# find unit id spike times
idx = np.where(self.spike_train[:,1]==unit_id)
spike_times = self.spike_train[id... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def split_into_frames(filename_raw, thr_var_per_event=5e-4, downsampling_factor=2, disable_display=False,\n filename_output_video=None):\n\n assert downsampling_factor == int(downsampling_factor), \"Error: downsampling_factor must be an integer\"\n assert downsampling_factor >= 0, \"Erro... | [
"0.4972694",
"0.49719194",
"0.49164146",
"0.49041563",
"0.48662052",
"0.48609337",
"0.48275054",
"0.4764923",
"0.47384405",
"0.47236058",
"0.4705282",
"0.46844137",
"0.4676775",
"0.46520847",
"0.46477193",
"0.46457043",
"0.46244732",
"0.4619206",
"0.4593396",
"0.4579161",
"0.... | 0.5579445 | 0 |
Convert snake case argument name to a command line name. | def arg_name(name):
return "--" + name.replace('_', '-') | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _arg_to_flag(name: str) -> str:\n arg = '-'.join(name.split('_'))\n return f'--{arg}'",
"def FixArgFileName(fileName):\n import os\n\n path, fname = os.path.split(fileName)\n if len(path) == 0:\n path = os.curdir\n path = os.path.abspath(path)\n # must check that the command line ... | [
"0.637582",
"0.6308252",
"0.6223311",
"0.6106777",
"0.6087217",
"0.60846734",
"0.60713154",
"0.5925403",
"0.5907787",
"0.5903477",
"0.5897198",
"0.5897198",
"0.5897198",
"0.58864826",
"0.58782953",
"0.5855721",
"0.58493316",
"0.58275014",
"0.575536",
"0.5754576",
"0.57038325"... | 0.7715281 | 0 |
Space separated resource references in filename=blobsource format. | def resource_file_format(value):
try:
file_name, blob_source = value.split('=')
except ValueError:
message = ("Incorrectly formatted resource reference. "
"Argmuent values should be in the format filename=blobsource")
raise ValueError(message)
return {'file_path': ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def convert_blobs_to_resource_files(blobs, resource_properties):\n resource_files = []\n if not blobs:\n raise ValueError('No input data found with reference {}'.\n format(resource_properties.source.prefix))\n try:\n prefix = resource_properties.source.prefix\n exc... | [
"0.59185004",
"0.54456174",
"0.5418338",
"0.53790176",
"0.5303639",
"0.5276898",
"0.52433187",
"0.5213896",
"0.5195129",
"0.519059",
"0.5167885",
"0.5135179",
"0.5133125",
"0.51307464",
"0.51267403",
"0.51265955",
"0.5118821",
"0.50666434",
"0.5009204",
"0.49958915",
"0.49888... | 0.67306453 | 0 |
Validate the destination path for a file download. | def validate_file_destination(namespace):
try:
path = namespace.destination
except AttributeError:
return
else:
# TODO: Need to confirm this logic...
file_path = path
file_dir = os.path.dirname(path)
if os.path.isdir(path):
file_name = os.path.base... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __checkDestination(self):\n return os.path.exists(self.__targetPath)",
"def validateDownload(obj, *args, **kwargs):\n\n if (obj.filename.rpartition('.')[2] == 'prop'):\n if (PackageUtil.validateProp(obj.filename) == False):\n raise AgentException(Errors.INVALID_PACKAGE... | [
"0.6747319",
"0.6341576",
"0.6253002",
"0.6199938",
"0.6128621",
"0.61062557",
"0.61062557",
"0.60761595",
"0.6049992",
"0.5987556",
"0.5965086",
"0.59535706",
"0.58831483",
"0.58813345",
"0.5876718",
"0.58764267",
"0.587319",
"0.5862184",
"0.5838729",
"0.57819915",
"0.574742... | 0.7108033 | 0 |
Validate whether two or more mutually exclusive arguments or argument groups have been set correctly. | def validate_mutually_exclusive(namespace, required, param1, param2):
value1 = getattr(namespace, param1, None)
value2 = getattr(namespace, param2, None)
message = None
if not value1 and not value2 and required:
message = "One of the following arguments are required: \n"
elif value1 and val... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_two_mutually_exclusive_args_provided(self):\n from plone.api.exc import InvalidParameterError\n _func = mutually_exclusive_parameters('arg1', 'arg2')(undecorated_func)\n with self.assertRaises(InvalidParameterError):\n _func('ahoy', 'there')\n\n with self.assertRaise... | [
"0.6724702",
"0.66577977",
"0.6617761",
"0.6611643",
"0.65800476",
"0.65641516",
"0.6562692",
"0.6554089",
"0.65193367",
"0.6493309",
"0.6490098",
"0.6442468",
"0.6430487",
"0.6388471",
"0.6387228",
"0.6347186",
"0.63322484",
"0.6319627",
"0.6304081",
"0.62839407",
"0.6283635... | 0.7363016 | 0 |
Getter method for ldp_sync_enabled, mapped from YANG variable /isis_state/interface_detail/isis_intf/ldp_sync_info/ldp_sync_enabled (isisstatus) | def _get_ldp_sync_enabled(self):
return self.__ldp_sync_enabled | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _set_ldp_sync_enabled(self, v, load=False):\n if hasattr(v, \"_utype\"):\n v = v._utype(v)\n try:\n t = YANGDynClass(v,base=RestrictedClassType(base_type=unicode, restriction_type=\"dict_key\", restriction_arg={u'is-enabled... | [
"0.79613835",
"0.61158735",
"0.60724086",
"0.5726894",
"0.5613925",
"0.5613925",
"0.55791795",
"0.53533936",
"0.5005335",
"0.4987678",
"0.49827105",
"0.49728572",
"0.49603918",
"0.49596107",
"0.4955472",
"0.49513027",
"0.48996565",
"0.48462626",
"0.48093173",
"0.48037514",
"0... | 0.73131764 | 1 |
Setter method for ldp_sync_enabled, mapped from YANG variable /isis_state/interface_detail/isis_intf/ldp_sync_info/ldp_sync_enabled (isisstatus) | def _set_ldp_sync_enabled(self, v, load=False):
if hasattr(v, "_utype"):
v = v._utype(v)
try:
t = YANGDynClass(v,base=RestrictedClassType(base_type=unicode, restriction_type="dict_key", restriction_arg={u'is-enabled': {'value': ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _get_ldp_sync_enabled(self):\n return self.__ldp_sync_enabled",
"def _set_ldp_in_sync(self, v, load=False):\n if hasattr(v, \"_utype\"):\n v = v._utype(v)\n try:\n t = YANGDynClass(v,base=YANGBool, is_leaf=True, yang_name=\"ldp-in-sync\", rest_name=\"ldp-in-sync\", parent=self, path_helper... | [
"0.69946873",
"0.6472956",
"0.59491473",
"0.5824803",
"0.5717719",
"0.5544052",
"0.5461094",
"0.54108495",
"0.54108495",
"0.5194292",
"0.51579636",
"0.49878374",
"0.4895498",
"0.48504594",
"0.4797328",
"0.47689405",
"0.47490603",
"0.47434294",
"0.47279575",
"0.47279575",
"0.4... | 0.8409099 | 0 |
Getter method for ldp_sync_hold_down, mapped from YANG variable /isis_state/interface_detail/isis_intf/ldp_sync_info/ldp_sync_hold_down (uint16) | def _get_ldp_sync_hold_down(self):
return self.__ldp_sync_hold_down | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _set_ldp_sync_hold_down(self, v, load=False):\n if hasattr(v, \"_utype\"):\n v = v._utype(v)\n try:\n t = YANGDynClass(v,base=RestrictedClassType(base_type=int, restriction_dict={'range': ['0..65535']},int_size=16), is_leaf=True, yang_name=\"ldp-sync-hold-down\", rest_name=\"ldp-sync-hold-down\... | [
"0.8303432",
"0.49328032",
"0.4887266",
"0.48021436",
"0.47671673",
"0.47562605",
"0.4665075",
"0.4552927",
"0.45074293",
"0.44553697",
"0.44231933",
"0.4418984",
"0.4417889",
"0.44146112",
"0.4406024",
"0.43649313",
"0.4336277",
"0.42344445",
"0.42294973",
"0.42198023",
"0.4... | 0.69384503 | 1 |
Setter method for ldp_sync_hold_down, mapped from YANG variable /isis_state/interface_detail/isis_intf/ldp_sync_info/ldp_sync_hold_down (uint16) | def _set_ldp_sync_hold_down(self, v, load=False):
if hasattr(v, "_utype"):
v = v._utype(v)
try:
t = YANGDynClass(v,base=RestrictedClassType(base_type=int, restriction_dict={'range': ['0..65535']},int_size=16), is_leaf=True, yang_name="ldp-sync-hold-down", rest_name="ldp-sync-hold-down", parent=self,... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _get_ldp_sync_hold_down(self):\n return self.__ldp_sync_hold_down",
"def setDown(self, down):\n # type: (tp.Union[str, tp.List[str]])->None\n if isinstance(down, list):\n self._ifAttributes['down'] = down\n elif isinstance(down, str):\n self._ifAttributes['down']... | [
"0.65523595",
"0.53751856",
"0.5216387",
"0.5215131",
"0.49139932",
"0.48896587",
"0.48503286",
"0.4806491",
"0.47906452",
"0.47712207",
"0.47645",
"0.46650887",
"0.4643589",
"0.4639629",
"0.4599972",
"0.45872274",
"0.45475742",
"0.45354202",
"0.44561124",
"0.4455607",
"0.443... | 0.8820209 | 0 |
Getter method for ldp_in_sync, mapped from YANG variable /isis_state/interface_detail/isis_intf/ldp_sync_info/ldp_in_sync (boolean) | def _get_ldp_in_sync(self):
return self.__ldp_in_sync | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _set_ldp_in_sync(self, v, load=False):\n if hasattr(v, \"_utype\"):\n v = v._utype(v)\n try:\n t = YANGDynClass(v,base=YANGBool, is_leaf=True, yang_name=\"ldp-in-sync\", rest_name=\"ldp-in-sync\", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, name... | [
"0.8355211",
"0.6763967",
"0.6396875",
"0.5638439",
"0.55594766",
"0.55594766",
"0.5441413",
"0.5346826",
"0.52634716",
"0.52562106",
"0.5183778",
"0.5142834",
"0.5115734",
"0.50605816",
"0.49895975",
"0.49873945",
"0.49772185",
"0.49214455",
"0.47861922",
"0.47472188",
"0.46... | 0.6949639 | 1 |
Setter method for ldp_in_sync, mapped from YANG variable /isis_state/interface_detail/isis_intf/ldp_sync_info/ldp_in_sync (boolean) | def _set_ldp_in_sync(self, v, load=False):
if hasattr(v, "_utype"):
v = v._utype(v)
try:
t = YANGDynClass(v,base=YANGBool, is_leaf=True, yang_name="ldp-in-sync", rest_name="ldp-in-sync", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='urn:broc... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _set_ldp_sync_enabled(self, v, load=False):\n if hasattr(v, \"_utype\"):\n v = v._utype(v)\n try:\n t = YANGDynClass(v,base=RestrictedClassType(base_type=unicode, restriction_type=\"dict_key\", restriction_arg={u'is-enabled... | [
"0.6656208",
"0.6542917",
"0.6353083",
"0.5340248",
"0.5340248",
"0.5332905",
"0.532342",
"0.5271925",
"0.5264226",
"0.52454627",
"0.49301267",
"0.48848814",
"0.48773974",
"0.48615354",
"0.48599523",
"0.4857011",
"0.48422334",
"0.4809144",
"0.47774222",
"0.47425586",
"0.46833... | 0.8821603 | 0 |
Getter method for remain_hd_time, mapped from YANG variable /isis_state/interface_detail/isis_intf/ldp_sync_info/remain_hd_time (uint32) | def _get_remain_hd_time(self):
return self.__remain_hd_time | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _set_remain_hd_time(self, v, load=False):\n if hasattr(v, \"_utype\"):\n v = v._utype(v)\n try:\n t = YANGDynClass(v,base=RestrictedClassType(base_type=long, restriction_dict={'range': ['0..4294967295']}, int_size=32), is_leaf=True, yang_name=\"remain-hd-time\", rest_name=\"remain-hd-time\", pa... | [
"0.75369066",
"0.5767875",
"0.54118884",
"0.52375525",
"0.51527005",
"0.51103103",
"0.50226915",
"0.49990252",
"0.49933913",
"0.49863082",
"0.4969344",
"0.4923328",
"0.49016246",
"0.4872389",
"0.48345572",
"0.48165497",
"0.4742409",
"0.47297677",
"0.46843266",
"0.46405488",
"... | 0.6868881 | 1 |
Setter method for remain_hd_time, mapped from YANG variable /isis_state/interface_detail/isis_intf/ldp_sync_info/remain_hd_time (uint32) | def _set_remain_hd_time(self, v, load=False):
if hasattr(v, "_utype"):
v = v._utype(v)
try:
t = YANGDynClass(v,base=RestrictedClassType(base_type=long, restriction_dict={'range': ['0..4294967295']}, int_size=32), is_leaf=True, yang_name="remain-hd-time", rest_name="remain-hd-time", parent=self, path... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _get_remain_hd_time(self):\n return self.__remain_hd_time",
"def remaintime_hour(self):\n return self._get_time_info([\"Remain_Time_H\", \"remainTimeHour\"])",
"def _set_ldp_sync_hd_expired(self, v, load=False):\n if hasattr(v, \"_utype\"):\n v = v._utype(v)\n try:\n t = YANGDynCl... | [
"0.6527339",
"0.56419486",
"0.5406978",
"0.51207715",
"0.50473714",
"0.5004871",
"0.49524683",
"0.48564476",
"0.48525473",
"0.48316664",
"0.48039407",
"0.48016867",
"0.47546086",
"0.47412762",
"0.46979687",
"0.46725908",
"0.4671195",
"0.46258426",
"0.45471296",
"0.44961315",
... | 0.82343465 | 0 |
Getter method for ldp_sync_hd_expired, mapped from YANG variable /isis_state/interface_detail/isis_intf/ldp_sync_info/ldp_sync_hd_expired (boolean) | def _get_ldp_sync_hd_expired(self):
return self.__ldp_sync_hd_expired | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _set_ldp_sync_hd_expired(self, v, load=False):\n if hasattr(v, \"_utype\"):\n v = v._utype(v)\n try:\n t = YANGDynClass(v,base=YANGBool, is_leaf=True, yang_name=\"ldp-sync-hd-expired\", rest_name=\"ldp-sync-hd-expired\", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, r... | [
"0.82901675",
"0.48444963",
"0.48373258",
"0.47381613",
"0.46870935",
"0.46846142",
"0.4662554",
"0.4562524",
"0.45272446",
"0.4494591",
"0.4440222",
"0.44194195",
"0.44167075",
"0.43977875",
"0.43757567",
"0.43720958",
"0.43687713",
"0.43644282",
"0.4342112",
"0.4325486",
"0... | 0.7557055 | 1 |
Setter method for ldp_sync_hd_expired, mapped from YANG variable /isis_state/interface_detail/isis_intf/ldp_sync_info/ldp_sync_hd_expired (boolean) | def _set_ldp_sync_hd_expired(self, v, load=False):
if hasattr(v, "_utype"):
v = v._utype(v)
try:
t = YANGDynClass(v,base=YANGBool, is_leaf=True, yang_name="ldp-sync-hd-expired", rest_name="ldp-sync-hd-expired", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=T... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _get_ldp_sync_hd_expired(self):\n return self.__ldp_sync_hd_expired",
"def is_expired(self):\n\n return time.time() * 1000 - self._refreshed_on > self._expire",
"def is_expired (self, now=None):\n if now is None: now = time.time()\n return self.is_idle_timed_out(now) or self.is_hard_timed_o... | [
"0.71649355",
"0.48745316",
"0.48418942",
"0.48061666",
"0.47438446",
"0.47073004",
"0.46888512",
"0.46572825",
"0.464538",
"0.46299013",
"0.4616753",
"0.46122965",
"0.4593519",
"0.45350564",
"0.45292705",
"0.44804588",
"0.44363025",
"0.44244212",
"0.44181457",
"0.43888035",
... | 0.8733901 | 0 |
Check for imports of deprecated modules | def test_deprecated_modules(self):
deprecated_modules_present = False
deprecated_modules = [
"game_assets",
"models",
"world",
"modular_assets",
]
for path in self.application_files:
for module in deprecated_modules:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_deprecated_cant_find_module() -> None:\n with patch(\"inspect.getmodule\", return_value=None):\n # This used to raise.\n cv.deprecated(\n \"mars\",\n replacement_key=\"jupiter\",\n default=False,\n )\n\n with patch(\"inspect.getmodule\", return_v... | [
"0.7030158",
"0.6704425",
"0.6590874",
"0.6568182",
"0.65557975",
"0.655543",
"0.6490232",
"0.6423565",
"0.6423465",
"0.64211744",
"0.641312",
"0.6384087",
"0.6377264",
"0.6273178",
"0.62635475",
"0.62426454",
"0.6239808",
"0.6232984",
"0.6232351",
"0.6216431",
"0.6201774",
... | 0.806409 | 0 |
Given 3 points or arrays, and their corresponding height coordinates, calculate the maximum of the Lagrange polynomial interpolation of those points. Useful for fast calculations. | def interpolate_max(arr, heights=(0., 1., 2.)):
if len(arr) != 3:
return None
y1, y2, y3 = arr
x1, x2, x3 = heights
x1 = float(x1)
x2 = float(x2)
x3 = float(x3)
num = -(y1*(x2 - x3)*(-x2 - x3)
+ y2*(x1 - x3)*(x1 + x3)
+ y3*(x1 - x2)*(-x1 - x2))
den = 2. ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def max_height(i_vy , g , i_h):\n t = i_vy/g\n return float(i_h + (i_vy*t)-(.5*g*math.pow(t,2)))",
"def maxArea(height):\n num_pt = len(height)\n max_area = 0\n for i in range(num_pt):\n for j in range(i + 1, num_pt):\n h = min(height[i], height[j])\n a = h * (j - i)\n... | [
"0.5873291",
"0.57678014",
"0.57673573",
"0.5748936",
"0.5686612",
"0.5632311",
"0.56151384",
"0.5560464",
"0.55602175",
"0.55535275",
"0.5540132",
"0.5523416",
"0.5505528",
"0.54992855",
"0.54948914",
"0.5446044",
"0.540624",
"0.5403315",
"0.5367828",
"0.53601944",
"0.533423... | 0.75891775 | 0 |
Measures the relative focus of each pixel using the Sobel operator. | def focus(self, smooth=0):
if self.image is None:
self.load_image()
# image = self.load_image()
# print self.image
if not self.bw:
gray = rgb_2_gray(self.image)
else:
gray = self.image
sx = ndimage.filters.sobel(gray, axis=0, mode='cons... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def focus_stack(self, smooth=0, interpolate_heights=True, use_all=False,\n layer_smooth=0):\n if len(self.layers) == 0:\n print(\"no images were properly imported\")\n else:\n if use_all:\n self.images = []\n self.focuses = []\n ... | [
"0.54016566",
"0.5381905",
"0.53775144",
"0.53436303",
"0.533169",
"0.5328394",
"0.51986355",
"0.516603",
"0.5158025",
"0.5139671",
"0.512083",
"0.504517",
"0.5017682",
"0.5011666",
"0.5008117",
"0.49915242",
"0.497663",
"0.4952939",
"0.49101773",
"0.48947313",
"0.48783606",
... | 0.6810263 | 0 |
Generates a masking image by thresholding the image. If a background is provided, this will also subtract the background before generating the mask. | def generate_mask(self, thresh=50, b_ground=None):
img = self.load_image()
thresh = np.zeros(img.shape, "uint8")
if b_ground is not None:
img = img - b_ground
thresh[img > 25] = 255
mask = ndimage.morphology.binary_dilation(thresh).astype("uint8")
self.mask = ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def gen_background_mask( img ):\n\t\t\n\tif len( img.shape ) == 3: t = img[0]\n\telif len( img.shape ) == 2: t = img\n\n\tmask = img > filters.threshold_li(t)\n\n\treturn mask",
"def dynamic_masking(image):\n image = img_as_float(image)\n background = gaussian_filter(median_filter(image,3),1)\n image[... | [
"0.7898407",
"0.7298791",
"0.7213714",
"0.683245",
"0.68142647",
"0.6722708",
"0.65909743",
"0.6589123",
"0.6578678",
"0.6564967",
"0.6479782",
"0.6466483",
"0.6382156",
"0.62984586",
"0.62144023",
"0.6209692",
"0.6193849",
"0.6181939",
"0.6138382",
"0.6132241",
"0.6123924",
... | 0.7330115 | 1 |
Grab unmoving 'background' of the stack by averaging over a sample of layers. The default is 50 samples. | def get_average(self, samples=50):
first = self.layers[0].load_image()
res = np.zeros(first.shape, dtype=float)
intervals = len(self.layers)/samples
for l in self.layers[::int(intervals)]:
img = l.load_image().astype(float)
res += img
l.image = None
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __call__(self, sample):\n temp = sample['stack']/255.0\n totensor = transforms.ToTensor()\n sample['stack'] = totensor(temp.transpose((1, 2, 0)))\n return sample",
"def zstack_normalize_mean(instack):\n stack = np.copy(instack) \n stackmean = stack.mean()\n for x in ra... | [
"0.5758102",
"0.57173944",
"0.5690426",
"0.56789875",
"0.5661047",
"0.56501585",
"0.5576374",
"0.55361825",
"0.5420607",
"0.53817236",
"0.53514606",
"0.53506416",
"0.53381515",
"0.5317445",
"0.53117204",
"0.5308503",
"0.5302598",
"0.5294157",
"0.52913225",
"0.52802604",
"0.52... | 0.6894385 | 0 |
A 2d smoothing filter for the heights array | def smooth(self, sigma):
self.heights = self.heights.astype("float32")
self.heights = np.fft.ifft2(
ndimage.fourier_gaussian(
np.fft.fft2(self.heights),
sigma=sigma)).real | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def smooth(img, sigma):\n if sigma < 0:\n raise ValueError('smoothing kernel size is negative')\n elif sigma == 0:\n return img.get_data()\n else:\n sigma_vox = sigma / np.sqrt(np.sum(img.get_affine()[0:3, 0:3] ** 2, 0))\n return nd.gaussian_filter(img.get_data(), sigma_vox)",
... | [
"0.62981075",
"0.62646466",
"0.62593687",
"0.6154723",
"0.60443723",
"0.5988841",
"0.59508985",
"0.59495175",
"0.59495175",
"0.58990556",
"0.58296025",
"0.5766525",
"0.57433444",
"0.5726047",
"0.5722643",
"0.5715811",
"0.5714172",
"0.5711716",
"0.56931025",
"0.56912136",
"0.5... | 0.6630815 | 0 |
Simple motion tracking using an average of the whole video as the background and the absolut difference between each frame and the background as the foreground. | def track_foreground(self, diff_threshold=None, frames_avg=50,
smooth_std=3):
avg = self.get_average(frames_avg)
self.track = []
self.diffs = []
for ind, layer in enumerate(self.layers):
diff = abs(layer.load_image() - avg)
diff = colors.r... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def track_ball_generic(video):\n result = []\n frames = readFrames(video)\n\n # get background with background estimator method\n background = findBackground(frames)\n # Setup background subtractor object with parameters\n subtractor = cv2.BackgroundSubtractorMOG(30, 10, 0.7, 0)\n # Feed estim... | [
"0.7056259",
"0.6407131",
"0.6285593",
"0.61958647",
"0.6153237",
"0.60899645",
"0.60573727",
"0.6040458",
"0.60244703",
"0.5989936",
"0.5976939",
"0.59573466",
"0.5945152",
"0.59423107",
"0.5914144",
"0.5860365",
"0.5854662",
"0.58460635",
"0.5825132",
"0.57794726",
"0.57249... | 0.6411053 | 1 |
Handle attribute update from fan cluster. | def attribute_updated(self, attrid: int, value: Any, _: Any) -> None:
attr_name = self._get_attribute_name(attrid)
self.debug(
"Attribute report '%s'[%s] = %s", self.cluster.name, attr_name, value
)
if attr_name == "fan_mode":
self.async_send_signal(
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _handle_coordinator_update(self) -> None:\n self._attr_is_on = self.relay.active\n self.async_write_ha_state()",
"def _attr_updated(self, name, value):\n event = AttributeUpdateEvent(self, name, value)\n events.notify(event)",
"def _update(self, device=None):\n self._attr... | [
"0.64523953",
"0.6417711",
"0.64156264",
"0.6376256",
"0.6307701",
"0.6217214",
"0.61811453",
"0.6129198",
"0.61026025",
"0.60620624",
"0.6059136",
"0.5902997",
"0.5844933",
"0.5842309",
"0.5804179",
"0.5798653",
"0.5789843",
"0.576516",
"0.5699014",
"0.56795084",
"0.56300855... | 0.72610325 | 0 |
Absolute maximum cooling setpoint. | def abs_max_cool_setpoint_limit(self) -> int:
return self.cluster.get("abs_max_cool_setpoint_limit", 3200) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def abs_min_cool_setpoint_limit(self) -> int:\n return self.cluster.get(\"abs_min_cool_setpoint_limit\", 1600)",
"def absmax(self):\n raise NotImplementedError",
"def abs_max_heat_setpoint_limit(self) -> int:\n return self.cluster.get(\"abs_max_heat_setpoint_limit\", 3000)",
"def _maximu... | [
"0.7390342",
"0.6880755",
"0.6699675",
"0.66157746",
"0.6585473",
"0.64992166",
"0.64724123",
"0.6445962",
"0.6444601",
"0.63723814",
"0.63416517",
"0.63181305",
"0.62716085",
"0.6267244",
"0.62624335",
"0.62495303",
"0.6168795",
"0.61668366",
"0.61656046",
"0.6160874",
"0.61... | 0.75471944 | 0 |
Absolute minimum cooling setpoint. | def abs_min_cool_setpoint_limit(self) -> int:
return self.cluster.get("abs_min_cool_setpoint_limit", 1600) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def cx(x):\n return cw(x - global_min_x)",
"def state_min(self) -> float:\n raise NotImplementedError",
"def _minimum(self) -> float:\n if self._type == \"power\":\n return 1.0\n elif self._type == \"setpoint\":\n return self._product.get_data_config_json()[\"_... | [
"0.6725199",
"0.6523529",
"0.64395744",
"0.64117193",
"0.64096063",
"0.6405297",
"0.6404757",
"0.6319182",
"0.6316694",
"0.6291801",
"0.62867165",
"0.6276625",
"0.6271663",
"0.6258228",
"0.6251705",
"0.6247299",
"0.6238187",
"0.62373286",
"0.6215882",
"0.6213482",
"0.617138",... | 0.7301009 | 0 |
Test saving, reading and deleting a correctly formed calibration blob. | def test_save_delete_file(
tmp_path: Path, calibration: typing.Dict[str, typing.Any]
) -> None:
my_calpath = tmp_path / "calibrations"
io.save_to_file(my_calpath, "my_calibration", calibration)
file_to_delete = my_calpath / "my_calibration.json"
assert io.read_cal_file(file_to_delete)
io.delete... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_cereal():\n test_path = tempfile.mkdtemp()\n x_train, metadata = cereal(test_path)\n try:\n assert x_train.shape == (36, 4)\n except:\n shutil.rmtree(test_path)\n raise()",
"def test_malformed_calibration(\n tmp_path: Path, malformed_calibration: typing.Dict[str, typing.Any]\n) -> None:\... | [
"0.6524659",
"0.59664446",
"0.59082484",
"0.59029675",
"0.590175",
"0.5826562",
"0.57601",
"0.5708722",
"0.56999654",
"0.56497383",
"0.5637816",
"0.55756545",
"0.5571732",
"0.55515367",
"0.554141",
"0.55031055",
"0.5485215",
"0.5481416",
"0.54808974",
"0.5467557",
"0.5450826"... | 0.6699812 | 0 |
Test saving and reading a malformed calibration blob. Note, malformed here only means datetime abnormalities. | def test_malformed_calibration(
tmp_path: Path, malformed_calibration: typing.Dict[str, typing.Any]
) -> None:
malformed_calibration_dir = tmp_path / "calibrations"
malformed_calibration_path = malformed_calibration_dir / "my_bad_calibration.json"
# TODO (lc 10-27-2022) We don't actually throw an error... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_bad_data(self):\r\n # LB180210_3_corrupted.PD0 has three records in it, the 2nd record was corrupted\r\n with open(os.path.join(RESOURCE_PATH, 'LB180210_3_corrupted.PD0'), 'rb') as stream_handle:\r\n\r\n parser = AdcpPd0Parser(self.config_recov, stream_handle, self.exception_callb... | [
"0.63918567",
"0.5941573",
"0.5877316",
"0.58717",
"0.5855711",
"0.57905686",
"0.5781173",
"0.57732564",
"0.57466656",
"0.5714373",
"0.5701173",
"0.5693405",
"0.5687235",
"0.5651733",
"0.56513137",
"0.56238693",
"0.56158066",
"0.5615417",
"0.56153786",
"0.559923",
"0.5591831"... | 0.7445197 | 0 |
variance and mean normalization parameter g=10 set by Ng and Coates 2011a g parameter is scaledependent and assumes each pixel intensity remains betwwen 0 and 255. | def NgNormalization2(Pin,g=10.0):
Pmean = np.mean(Pin,axis=1,keepdims=True)
Pstd = np.sqrt(np.var(Pin,axis=1,keepdims=True)+g ) # g = 10 for images of brightness 0...255
O = (Pin - Pmean) / Pstd
return O | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def variance_normalize(self):\n self.img = self.img / np.sqrt(np.sum(self.img ** 2))",
"def _normalize(images):\n images -= images.mean(axis=0, keepdims=True)\n images /= np.maximum(images.std(axis=0, keepdims=True), 3e-1)",
"def _normalize(images):\n images -= images.mean(axis=0, keepdims=True... | [
"0.68335885",
"0.62980634",
"0.62980634",
"0.6090265",
"0.607238",
"0.5978527",
"0.5925094",
"0.5905927",
"0.58876354",
"0.5860991",
"0.5840054",
"0.5811187",
"0.57432306",
"0.57223207",
"0.5718694",
"0.57149523",
"0.57009166",
"0.5692579",
"0.5685911",
"0.5682441",
"0.567310... | 0.7362537 | 0 |
FINDS THE COORDINATE OF THE MAXIMUM POINT IN A TRAJECTORY. | def find_max(trajectory):
x = trajectory.s
y = trajectory.i
yt = np.abs(y - max(y))
yt = yt < 1e-5
max_idx = np.where(yt == True)[0]
max_idx = max(max_idx)
return [x[max_idx], y[max_idx]] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def find_max_score_location(grid, shape):",
"def find_max(self):\n\n max_x = -10\n max_y = -10\n k = len(self.__col_lista)\n for i in range(k):\n x, y = self.__col_lista[i]\n if x > max_x:\n max_x = x\n if y > max_y:\n max... | [
"0.69206774",
"0.6715515",
"0.6675191",
"0.650989",
"0.64683646",
"0.6467673",
"0.6457012",
"0.64458644",
"0.6366418",
"0.6241499",
"0.6237555",
"0.62108934",
"0.61889035",
"0.61826956",
"0.61502874",
"0.61187315",
"0.60993797",
"0.60676146",
"0.6038875",
"0.60360044",
"0.603... | 0.67509127 | 1 |
A FUNCTION THAT CREATES THE INITIAL CONDITIONS FOR THE SEARCH OF THE COMMUTATION CURVE IN A DETERMINED SYSTEM. TAKES AS INPUT THE SYSTEM THAT IS GOING TO BE ANALYZED, THE displacement TO THE RIGHT, AND HOW FAR low THE LINE SEGMENT IS GOING TO GO. | def make_initial_conditions(system, displacement, low):
C = sir.CurveSegment(system.sbar, system.imax, 0, system, 1)
C.s = C.s + displacement
s_inter, i_inter = C._curve_sol(low)
C = sir.CurveSegment(system.sbar, system.imax, 0, system, s_inter)
C.s = C.s + displacement
s0 = np.linspace(C.s[-1],... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def analyseCoordination(self):\n #create a list of criteria that correspond to maximal path length\n #max_path_length = max(self.pathLengths)\n\n #criterion_max_path_length = []\n #origins_max_path_length = []\n #for c in range(len(self.pathLengths)):\n # if self.pathLe... | [
"0.5643535",
"0.5529715",
"0.54889023",
"0.5479325",
"0.53951627",
"0.53906417",
"0.53498375",
"0.53264004",
"0.529862",
"0.52936363",
"0.5267395",
"0.52408236",
"0.51946",
"0.51942897",
"0.5164973",
"0.5137584",
"0.5127261",
"0.5117817",
"0.5111111",
"0.5094825",
"0.508434",... | 0.6616834 | 0 |
Visualize the learned weights More suitable for many weights | def show_weights(weights, names=None):
plt.imshow(visualize_grid(weights, padding=1).astype('uint8'), cmap='Greys')
plt.gca().axis('off')
plt.show()
plt.savefig('vis.png') | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def learning_viz(self) :\n self.train\n history = self.history\n plot_loss(history)",
"def get_weights(self):",
"def plot_weights(self,):\n \n weights_evolution = pd.DataFrame(self.predict[\"weights\"].values.tolist(), columns=[*self.models.keys()])\n\n plt.figure(figs... | [
"0.69428915",
"0.6728055",
"0.6703914",
"0.66064876",
"0.6543751",
"0.65201473",
"0.63403493",
"0.63328934",
"0.6332723",
"0.62977654",
"0.61747783",
"0.61710286",
"0.616417",
"0.6146608",
"0.6127756",
"0.6119084",
"0.609718",
"0.6054239",
"0.6037545",
"0.60133284",
"0.598278... | 0.69596964 | 0 |
Initialize I2C LCD at specified I2C address on the I2C Bus. | def __init__(self, i2c, address=0x27, cols=2, rows=16, dotsize=LCD_5x8DOTS ):
self.address = address
self.i2c = i2c
self.cols = cols
self.rows = rows
self._backlightval = LCD_NOBACKLIGHT
self._displayfunction = None
self._displaycontrol = None
self._displaymode = None
# ========= Initialize scre... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def i2c_init(id_, scl, sda, freq=400000):\n return machine.I2C(id_,\n scl=machine.Pin(\n scl,\n machine.Pin.OUT,\n machine.Pin.PULL_DOWN\n ),\n ... | [
"0.7174927",
"0.67933416",
"0.66797334",
"0.65896314",
"0.65378994",
"0.6502087",
"0.6427027",
"0.63613755",
"0.6358532",
"0.63391155",
"0.63276124",
"0.62933046",
"0.62551033",
"0.6249159",
"0.6034287",
"0.5950266",
"0.59406036",
"0.5842928",
"0.5823635",
"0.5810184",
"0.578... | 0.7152499 | 1 |
Write a 4 bits values then pulse the Enable flag | def write4bits( self, value ): # uint8_t
self.expanderWrite( value )
self.pulseEnable( value ) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _write4bits(self, value):\n for i in range(4):\n bit = (value >> i) & 0x01\n self.output(self._data_pins()[i], bit)\n self._pulse_enable()",
"def _write4bits(self, value):\n\t\tfor i in range(4):\n\t\t\tbit = (value >> i) & 0x01\n\t\t\tGPIO.output(self.pins_data[i], bit)\n... | [
"0.8017873",
"0.7902668",
"0.6740639",
"0.6712541",
"0.66352326",
"0.65554494",
"0.6446782",
"0.64384186",
"0.64248353",
"0.62296814",
"0.61854124",
"0.6129692",
"0.60957503",
"0.608745",
"0.60842526",
"0.5940202",
"0.5918675",
"0.58718055",
"0.58666646",
"0.58586204",
"0.585... | 0.80717915 | 0 |
Send data over I2C bus by including the BackLight flag | def expanderWrite( self, _data ): # uint8_t
#Wire.beginTransmission(_Addr);
#printIIC((int)(_data) | _backlightval) # print II
self.i2c.writeto( self.address, bytes( [_data | self._backlightval] ))
#Wire.endTransmission(); | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _sendi2c(self,command,data=[]) -> None:\n if isinstance(command, str):\n command = ord(command)\n try:\n self.bus.write_i2c_block_data(self.address, command, data)\n except OSError as err:\n print(\"I2C Device Error\\nCheck Connection\\n{}\".format(err))",
... | [
"0.7092826",
"0.62958944",
"0.6190678",
"0.6189689",
"0.6078368",
"0.60758936",
"0.6061588",
"0.6058107",
"0.6019048",
"0.59788793",
"0.5976502",
"0.59479564",
"0.5939198",
"0.589264",
"0.5828056",
"0.5798978",
"0.579745",
"0.5788026",
"0.5786685",
"0.57807434",
"0.57775354",... | 0.63112533 | 1 |
Pulse the Enable Pin on the LCD | def pulseEnable( self, _data ): # uint8_t
self.expanderWrite( _data | LCD_EN ) # En high
sleep_us(1) # enable pulse must be >450ns
self.expanderWrite( _data & (0xFF ^ LCD_EN) ) # En low
sleep_us(50) # commands need > 37us to settle | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _pulse_enable(self):\n self.set_low(self._en_pin)\n self._usleep(1)\n self.set_high(self._en_pin)\n self._usleep(1)\n self.set_low(self._en_pin)\n # commands need > 37us to settle\n self._usleep(100)",
"def enable_pulse_modulation(self):\n self.write(\"... | [
"0.8290033",
"0.72652996",
"0.7065156",
"0.69558316",
"0.6947763",
"0.6901592",
"0.676794",
"0.6735534",
"0.66760164",
"0.6586983",
"0.6527253",
"0.6503161",
"0.64747596",
"0.64213467",
"0.6400039",
"0.6391462",
"0.6362962",
"0.6358918",
"0.63532215",
"0.6292264",
"0.6276042"... | 0.7924556 | 1 |
Set the cursor @ home position | def home( self ):
self.command( LCD_RETURNHOME ) # set cursor position to zero
sleep_us( 2000 ) # this command takes a long time! | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def home(self):\n self.command(_LCD_RETURNHOME)\n self._cursor_pos = (0, 0)\n time.sleep(2*MILLISECOND)",
"def CursorHome(self):\n self.Bus.Write_uInt8(self.Address, 0x01, 0x02)",
"def home(self):\n self.command(self.LCD_RETURNHOME)\n self._cursor_pos = (0, 0)\n ... | [
"0.78883594",
"0.7874507",
"0.7804661",
"0.71700335",
"0.70821345",
"0.70201814",
"0.69244087",
"0.6887372",
"0.6868383",
"0.6809072",
"0.6770352",
"0.6752197",
"0.67183876",
"0.66883904",
"0.66750664",
"0.66597855",
"0.6611106",
"0.6594645",
"0.65583235",
"0.654024",
"0.6472... | 0.7986535 | 0 |
Scroll the display without changing the RAM | def scroll_display( self, direction=LCD_MOVELEFT ):
assert direction in (LCD_MOVELEFT,LCD_MOVERIGHT), "Invalid direction %s value" % direction
self.command(LCD_CURSORSHIFT | LCD_DISPLAYMOVE | direction) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def start_scroll():\n send_command(0x2F)",
"def scroll(*args):",
"def idle_loop(self):\n sleep(0.1)\n self.scroll()",
"def autoscroll(self):\n self.displaymode |= self.LCD_ENTRYSHIFTINCREMENT\n self.write_lcd(self.LCD_DATA_E1, self.LCD_ENTRYMODESET | self.displaymode)\n ... | [
"0.7195914",
"0.69599557",
"0.6883477",
"0.6802342",
"0.67569107",
"0.6602154",
"0.6587491",
"0.6541192",
"0.6533414",
"0.65180826",
"0.64459866",
"0.6440966",
"0.6345634",
"0.6307446",
"0.6236501",
"0.62016225",
"0.61945426",
"0.616172",
"0.614911",
"0.61103624",
"0.61058736... | 0.7035041 | 1 |
set the cursor position with a 0 based tuple of (col,row) equivalent to the position x,y positionning | def set_cursor( self, pos ):
assert type( pos ) is tuple, "pos must be a tuple (col,row)"
row_offsets = [ 0x00, 0x40, 0x14, 0x54 ]
row = pos[1]
if ( row > self.rows ):
row = self.rows-1 # we count rows starting w/0
self.command(LCD_SETDDRAMADDR | (pos[0] + row_offsets[row])) # Col + row offset | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def setCursorPos(serDisplay, row, col, clearRow = False):\n offset = 127 + col\n if row == 2:\n offset = 128 + 63 + col\n elif row == 3:\n offset = 128 + 19 + col\n elif row == 4:\n offset = 128 + 83 + col\n cmd = array.array('B', (COMMAND_PREFIX, offset))\n writeToDisplay(s... | [
"0.7308563",
"0.70076805",
"0.69503945",
"0.6880716",
"0.6815349",
"0.6811424",
"0.67916626",
"0.67796946",
"0.6775386",
"0.67483145",
"0.6735111",
"0.6707917",
"0.6695514",
"0.667775",
"0.6669448",
"0.66299134",
"0.6621606",
"0.6621606",
"0.6621606",
"0.6621606",
"0.6621606"... | 0.76741517 | 0 |
Display a string at the current cursor location. Cursor may be repositionned before printing is pos is feeded with a (col,row) tuple. | def print( self, str, pos=None ):
if pos:
self.set_cursor( pos )
self.write( str.encode("ASCII") ) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def PrintAt(self,x=0,y=0,text=''):\n self.SetCursor(x,y)\n self.Print(text)",
"def display(self):\n row = (' ' * self.__x) + (Rectangle.print_symbol * self.__width) + '\\n'\n print(('\\n' * self.__y) + (row * self.__height), end=\"\")",
"def display(self):\n yp = self.y + sel... | [
"0.7152005",
"0.6511145",
"0.6333124",
"0.6215792",
"0.61729866",
"0.6170965",
"0.615026",
"0.6097372",
"0.6082236",
"0.6067916",
"0.60624087",
"0.60408413",
"0.6027435",
"0.5971494",
"0.5957337",
"0.5951418",
"0.5941546",
"0.5902664",
"0.5889489",
"0.58843726",
"0.5864881",
... | 0.7490052 | 0 |
See PlotlyGraphObjectError.__init__ for param docs. | def __init__(self, obj, path, notes=()):
format_dict = {'index': path[-1], 'object_name': obj._name}
message = ("Invalid entry found in '{object_name}' at index, '{index}'"
.format(**format_dict))
note = "It's invalid because it doesn't contain a valid 'type' value."
n... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self, message='', path=(), notes=()):\n self.message = message\n self.plain_message = message # for backwards compat\n self.path = list(path)\n self.notes = notes\n super(PlotlyGraphObjectError, self).__init__(message)",
"def __init__(self, g, msg):\n self.... | [
"0.75614715",
"0.670434",
"0.6560559",
"0.64961225",
"0.6422344",
"0.63814306",
"0.62893766",
"0.6205201",
"0.600632",
"0.5995472",
"0.5995472",
"0.5995472",
"0.596991",
"0.5916648",
"0.5776747",
"0.5770383",
"0.57605684",
"0.5759503",
"0.57565665",
"0.5754255",
"0.57489777",... | 0.6825649 | 1 |
Takes an images, divides it into tiles, return an array of tiles. >>> image_to_tiles(test_ns.img, test_ns.tile_size) array([[[[[255, 255, 255]]], [[[255, 255, 255]]], [[[255, 255, 255]]], [[[255, 255, 255]]]], [[[[255, 255, 255]]], [[[ 0, 0, 0]]], [[[ 0, 0, 0]]], [[[ 0, 0, 0]]]], [[[[255, 255, 255]]], [[[ 0, 0, 0]]], [... | def image_to_tiles(img, tile_size):
padding_argument = [(0,0),(0,0),(0,0)]
for input_dim in [0,1]:
padding_argument[input_dim] = (0, (tile_size - img.shape[input_dim]) % tile_size)
img = np.pad(img, padding_argument, mode='constant')
tiles = img.reshape((img.shape[0]//tile_size,
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _split_image_into_tiles(\n self, image: np.ndarray\n ) -> t.Sequence[t.Tuple[t.Tuple[t.Any, ...], np.ndarray]]:\n h, w, c = image.shape\n tile_height = (\n math.ceil(h / (self._n_tiles // 2 - 1))\n if self._n_tiles > 4\n else math.ceil(h / (self._n_tiles... | [
"0.76679796",
"0.70593137",
"0.6855183",
"0.6758002",
"0.6689827",
"0.66560644",
"0.66036004",
"0.65633535",
"0.652363",
"0.6499605",
"0.6484208",
"0.64485383",
"0.6427238",
"0.6427238",
"0.6377075",
"0.6372184",
"0.6352362",
"0.63131434",
"0.6267358",
"0.6265575",
"0.6213327... | 0.8448935 | 0 |
Takes a tile_grid and transforms it into an image, using the information in tile_catalog. We use tile_size to figure out the size the new image should be, and visualize for displaying partial tile patterns. | def tiles_to_images(wfc_ns, tile_grid, tile_catalog, tile_size, visualize=False, partial=False, grid_count=None):
new_img = np.zeros((tile_grid.shape[0] * tile_size, tile_grid.shape[1] * tile_size, wfc_ns.channels), dtype=np.int64)
if partial and (len(tile_grid.shape) > 2):
for i in range(tile_grid.shap... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def tile_to_image(tile, tile_catalog, tile_size, visualize=False):\n new_img = np.zeros((tile_size, tile_size, 3), dtype=np.int64)\n for u in range(tile_size):\n for v in range(tile_size):\n ## If we want to display a partial pattern, it is helpful to\n ## be able to show empty c... | [
"0.7510578",
"0.6322842",
"0.6210446",
"0.6197227",
"0.6109045",
"0.6020915",
"0.5998174",
"0.5994103",
"0.595534",
"0.588121",
"0.5878566",
"0.5868952",
"0.58491933",
"0.5847946",
"0.5841431",
"0.58058107",
"0.57825464",
"0.57611525",
"0.57573795",
"0.5754921",
"0.5700889",
... | 0.72285825 | 1 |
Does the input equal the output? >>> [show_input_to_output(test_ns), load_source_image(test_ns.img_filename)] [[[255 255 255] [255 255 255] [255 255 255] [255 255 255]] [[255 255 255] [ 0 0 0] [ 0 0 0] [ 0 0 0]] [[255 255 255] [ 0 0 0] [255 0 0] [ 0 0 0]] [[255 255 255] [ 0 0 0] [ 0 0 0] [ 0 0 0]]] [None, Image([[[255,... | def show_input_to_output(img_ns):
figure()
sp = subplot(1, 2, 1).imshow(img_ns.img)
sp.axes.grid(False)
sp.axes.tick_params(bottom=False, left=False, which='both',labelleft=False,labelbottom=False,length=0)
title("Input Image", fontsize=10);
outimg = tiles_to_images(img_ns, img_ns.tile_grid... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_to_tensor(dummy_input):\n # Test the 2D image: B, H, W, C\n image, label = dummy_input(image_size=(512, 512, 3),\n label_size=(512, 512, 1))\n transform = ToTensor()\n _image, _label = transform(image, label, dtypes=[torch.float, torch.long])\n assert _image.dt... | [
"0.5998976",
"0.59870833",
"0.5945812",
"0.593989",
"0.5886621",
"0.58820266",
"0.5840027",
"0.5829975",
"0.5829964",
"0.58230793",
"0.5811639",
"0.57654047",
"0.5735271",
"0.5720358",
"0.5716861",
"0.5688382",
"0.5685994",
"0.5652558",
"0.56406236",
"0.5636332",
"0.5618694",... | 0.61868006 | 0 |
get all snapshots created on the volume. | def get_volume_snapshots(self, volume):
LOG.debug('get_volume_snapshot starts')
pool_name = self.configuration.rbd_pool
volume_name = 'volume-%s' % encodeutils.safe_encode(volume["id"])
snaps_on_vol = self._get_volume_snapshots(pool_name, volume_name)
snapshots = list()
i... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def snapshots(self, owner=None, restorable_by=None):\r\n rs = self.connection.get_all_snapshots(owner=owner,\r\n restorable_by=restorable_by)\r\n mine = []\r\n for snap in rs:\r\n if snap.volume_id == self.id:\r\n mine.app... | [
"0.7807004",
"0.7624306",
"0.7623622",
"0.75040907",
"0.741505",
"0.73093504",
"0.7294166",
"0.7233389",
"0.7192934",
"0.71839905",
"0.7122615",
"0.7049829",
"0.699524",
"0.69842076",
"0.69395983",
"0.6928033",
"0.6828494",
"0.68274504",
"0.6782187",
"0.6708912",
"0.6700088",... | 0.7970192 | 0 |
get full clone chain of a volume or snapshot. | def _get_full_clone_chain(self, pool_name, volume_name, snap_name=None):
full_clone_chain = dict()
# get children clone chain.
obj = self._generate_chain_obj(pool_name, volume_name, snap_name)
self._get_children_chain(obj["children"], pool_name, volume_name,
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_snapshot_clone_chain(self, snapshot):\n LOG.debug('get_snapshot_clone_chain starts.')\n volume_name = 'volume-%s' % \\\n encodeutils.safe_encode(snapshot[\"volume_id\"])\n snap_name = 'snapshot-%s' % encodeutils.safe_encode(snapshot['id'])\n pool_name = self... | [
"0.80581087",
"0.76706725",
"0.57795644",
"0.5629695",
"0.55750954",
"0.5569269",
"0.55409795",
"0.54759246",
"0.5336027",
"0.5335274",
"0.5326693",
"0.5305052",
"0.527367",
"0.52459395",
"0.52345735",
"0.5233602",
"0.5205131",
"0.5157778",
"0.5122811",
"0.5122811",
"0.508964... | 0.7822953 | 1 |
get volume's clone chain. | def get_volume_clone_chain(self, volume):
LOG.debug('get_volume_clone_chain starts.')
volume_name = 'volume-%s' % encodeutils.safe_encode(volume["id"])
pool_name = self.configuration.rbd_pool
clone_chain = self._get_full_clone_chain(pool_name, volume_name, None)
LOG.debug('volume... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_snapshot_clone_chain(self, snapshot):\n LOG.debug('get_snapshot_clone_chain starts.')\n volume_name = 'volume-%s' % \\\n encodeutils.safe_encode(snapshot[\"volume_id\"])\n snap_name = 'snapshot-%s' % encodeutils.safe_encode(snapshot['id'])\n pool_name = self... | [
"0.73028296",
"0.7090097",
"0.5828093",
"0.5828093",
"0.5751596",
"0.5751596",
"0.563764",
"0.56228733",
"0.55641687",
"0.5510754",
"0.5431384",
"0.5429335",
"0.542763",
"0.54057914",
"0.53919584",
"0.5336411",
"0.53236985",
"0.52903306",
"0.52415264",
"0.52111065",
"0.516087... | 0.82059187 | 0 |
get snapshot's clone chain | def get_snapshot_clone_chain(self, snapshot):
LOG.debug('get_snapshot_clone_chain starts.')
volume_name = 'volume-%s' % \
encodeutils.safe_encode(snapshot["volume_id"])
snap_name = 'snapshot-%s' % encodeutils.safe_encode(snapshot['id'])
pool_name = self.configuratio... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _get_full_clone_chain(self, pool_name, volume_name, snap_name=None):\n full_clone_chain = dict()\n # get children clone chain.\n obj = self._generate_chain_obj(pool_name, volume_name, snap_name)\n self._get_children_chain(obj[\"children\"], pool_name, volume_name,\n ... | [
"0.7078835",
"0.635539",
"0.6342894",
"0.6303413",
"0.62447584",
"0.6167417",
"0.6093087",
"0.6042666",
"0.60092366",
"0.58993983",
"0.584199",
"0.5835145",
"0.583218",
"0.5807996",
"0.5806754",
"0.5793995",
"0.57841635",
"0.575718",
"0.57200295",
"0.5693076",
"0.5691469",
... | 0.8238623 | 0 |
From a mixed list of ensembl IDs and associated gene names, retrieve information from the corresponding gene | def parse_id_name_list(mixed_list):
logger.info('Total number of genes in the list: {}'.format(len(mixed_list)))
bad_names_count = []
multiple_ids_per_name = []
a = re.compile('ENSG\d{11}')
for gene_id in mixed_list:
# the item is an ensembl gene id
# Check if the name is an Ensem... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _get_genes(self, genes: Union[str, List[str]]) -> List[str]:\n if isinstance(genes, str):\n up = pd.read_table(genes, header=None, comment=\"#\", dtype=str)\n ups= up.values.astype(str)\n ups = list(np.squeeze(ups))\n elif isinstance(genes, (list, tuple)):\n ... | [
"0.6468079",
"0.64520854",
"0.6415853",
"0.6268371",
"0.62580836",
"0.60660505",
"0.6048606",
"0.6023636",
"0.60008794",
"0.59920865",
"0.5961127",
"0.59330606",
"0.59125656",
"0.5873164",
"0.585526",
"0.5834124",
"0.58223885",
"0.5777365",
"0.57691514",
"0.5756105",
"0.57229... | 0.72333103 | 0 |
uploads dataframe to google sheets | def df2gsheet(df: pd.DataFrame, sheet_name=None):
CELL_MAX_CHAR_LIMIT = 50000
if 'course' in df.columns:
aint_gonna_fit = df[df.course.str.len() >= CELL_MAX_CHAR_LIMIT]
if not aint_gonna_fit.empty:
print('WARNING ~ {filename} - row are too long'.format(filename=sheet_name))
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def write_to_google_sheet(df, SPREADSHEET_ID, ws_name, include_index=False, row=1, col=1):\n ws = init_worksheet(SPREADSHEET_ID, ws_name)\n gsdf.set_with_dataframe(ws, df, resize=True, include_index=include_index)",
"def move_data_google_sheets_to_s3():\n\n # Set up service account object\n service_a... | [
"0.68912625",
"0.6610926",
"0.6601545",
"0.63393456",
"0.6315094",
"0.6195817",
"0.61924154",
"0.61545527",
"0.6118955",
"0.6087999",
"0.60400724",
"0.60386956",
"0.60276693",
"0.6022702",
"0.59579694",
"0.58812815",
"0.5848476",
"0.57958424",
"0.5772333",
"0.5685371",
"0.566... | 0.67953295 | 1 |
connect to wiktionary, get all part of speech, join them into one string, and return here | def translate(word: str) -> str:
global LINE_DIVIDER
parser = WiktionaryParser()
def_ = parser.fetch(word.lower())
ret = ""
for word_payload in def_:
definitions = word_payload['definitions']
translations = {d['partOfSpeech']: LINE_DIVIDER.join(d['text'])
fo... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getWords(speech):\r\n return speech.split()",
"def make_text(chains):\n\n # your code goes here\n n_gram = tuple(choice(chains['START']))\n words = [word for word in n_gram]\n\n while n_gram in chains:\n\n next_word = choice(chains[n_gram])\n if next_word == 'EOF':\n b... | [
"0.62328875",
"0.61990124",
"0.6019341",
"0.592498",
"0.5885903",
"0.5857776",
"0.58438355",
"0.57937104",
"0.5765551",
"0.57031536",
"0.56936556",
"0.5668371",
"0.5629293",
"0.55844367",
"0.5553311",
"0.5546056",
"0.554421",
"0.55373454",
"0.55305636",
"0.5502497",
"0.549872... | 0.63350236 | 0 |
Return a subset of the dataloader from the start batch index to the count specified. | def datasubset(loader, start, count, batch_size):
# Note: start is the start index of batch, not image
smaller_dataset = []
end_idx = count / batch_size
for batch_idx, (orig_images, labels) in enumerate(loader):
if start <= batch_idx < end_idx:
smaller_dataset.append((orig_images, la... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_batch(self, count):\n if self.index + count < len(self.pool):\n batch = self.pool[self.index:self.index+count]\n self.index += count\n return batch\n else:\n batch = self.pool[self.index:]\n self.index = 0\n np.random.shuffle(... | [
"0.6776425",
"0.67340755",
"0.6359823",
"0.60727173",
"0.5961567",
"0.5891969",
"0.5876109",
"0.5873678",
"0.5870568",
"0.57987577",
"0.5769156",
"0.5766878",
"0.5749042",
"0.573495",
"0.57309306",
"0.57300115",
"0.5710676",
"0.5704602",
"0.57015926",
"0.5698963",
"0.569104",... | 0.71910286 | 0 |
Builds an entry from a database row. | def FromRow(cls, row):
return Entry(*row) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def build_update(meta, session, row):\n if row.type == assignment_sql.AssignmentType.USER_PROJECT:\n return build_user_project_entry(meta, session, row)\n elif row.type == assignment_sql.AssignmentType.GROUP_PROJECT:\n return build_group_project_entry(meta, session, row)\n ... | [
"0.64496917",
"0.61219496",
"0.58081305",
"0.58061045",
"0.57769185",
"0.5762503",
"0.5753291",
"0.5748479",
"0.5658568",
"0.5652168",
"0.55532646",
"0.5488344",
"0.548819",
"0.5483393",
"0.5455265",
"0.54362726",
"0.5413206",
"0.5409367",
"0.5409367",
"0.5409367",
"0.5401953... | 0.7453001 | 0 |
Filters and sorts the entries to be prefetched for a given domain. Uses the default thresholds defined in resource_prefetch_common.cc. | def FilterAndSort(entries, domain):
result = filter(
lambda x: ((domain is None or x.main_page_url == domain)
and x.confidence > .7
and x.number_of_hits >= 2), entries)
return sorted(result, key=operator.attrgetter('score'), reverse=True) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sort(self):\n\t\tself.servers = sorted(self.servers, key=lambda s: s.load)\n\t\tself.servers = sorted(self.servers, key=lambda s: s.distance_class)\n\t\tself.servers = sorted(self.servers, key=lambda s: s.country == self.locale_info.country, reverse=True)",
"def assign_priorities_and_dp(self):\r\n tas... | [
"0.517122",
"0.50378364",
"0.49676886",
"0.483992",
"0.47872436",
"0.4769185",
"0.47265437",
"0.47085798",
"0.46775368",
"0.46577793",
"0.4654167",
"0.4642485",
"0.46311262",
"0.46287495",
"0.45954353",
"0.45926008",
"0.45721456",
"0.45484707",
"0.45371377",
"0.45344085",
"0.... | 0.6398537 | 0 |
Standings page by the season year. | def standings_by_season(season):
season = int(season) + 1
scoreboard = nba_py.Scoreboard(month=7,
day=1,
year=season)
east_standings = scoreboard.east_conf_standings_by_day()
west_standings = scoreboard.west_conf_standings_by_day()
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def scrape():\n league_year = Config.get_property(\"league_year\")\n\n # Create table\n season_data = client.season_schedule(league_year)\n season_data = br_enum_to_string(season_data)\n return season_data",
"def get_seasons_information():\n\n #getting the guidebox_id variable from show_page.ht... | [
"0.6855133",
"0.6743384",
"0.6705959",
"0.66812474",
"0.66199046",
"0.65923786",
"0.6505892",
"0.647663",
"0.6457529",
"0.62005526",
"0.6138608",
"0.61354065",
"0.6126372",
"0.6063681",
"0.60521215",
"0.60376775",
"0.60246587",
"0.60244566",
"0.60032177",
"0.59783655",
"0.593... | 0.7681088 | 0 |
Standings page after using the datepicker plugin. | def standings_post_request():
date = request.form["date"]
datetime_object = datetime.datetime.strptime(date, "%m-%d-%Y")
scoreboard = nba_py.Scoreboard(month=datetime_object.month,
day=datetime_object.day,
year=datetime_object.year)
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def follow_workoutplan(request, pk):\n return render(request, 'workouts/starting_date_form.html')",
"def schedule(request):\r\n\r\n return render(request, 'editorial/schedule.html', {})",
"def schedule(request):\n return render(request, 'vaxcharts/schedule.html')",
"def dashboard():",
"def mainpag... | [
"0.6044334",
"0.60336864",
"0.5919623",
"0.58946955",
"0.58439314",
"0.5783241",
"0.5722915",
"0.5698653",
"0.56796974",
"0.5668093",
"0.5652515",
"0.5632157",
"0.56211615",
"0.56042194",
"0.55611235",
"0.5546947",
"0.5542898",
"0.5529295",
"0.55291355",
"0.54914933",
"0.5475... | 0.65683556 | 0 |
Link for specific score pages for a certain day. | def scores(datestring):
return render_score_page("scores.html", datestring, datestring) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index():\n # call the datetime function\n datetime_today = datetime.datetime.now(central)\n datestring_today = datetime_today.strftime(\"%m-%d-%Y\")\n return render_score_page(\"index.html\", datestring_today, \"bballfast.com\")",
"def scrape(self, day):\n url = '{base_url}/{month_day}'.fo... | [
"0.6154567",
"0.5618616",
"0.5526901",
"0.5496418",
"0.5482043",
"0.53149104",
"0.52406067",
"0.51252085",
"0.5077746",
"0.50192183",
"0.5014762",
"0.501392",
"0.4963462",
"0.4912558",
"0.4900883",
"0.48971343",
"0.48908174",
"0.48814574",
"0.48384798",
"0.4829943",
"0.481945... | 0.6060666 | 1 |
The score page after using the datepicker plugin. | def scores_post_request():
date = request.form["date"]
print(date)
return render_score_page("scores.html", date, date) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def scores(datestring):\n return render_score_page(\"scores.html\", datestring, datestring)",
"def index():\n # call the datetime function\n datetime_today = datetime.datetime.now(central)\n datestring_today = datetime_today.strftime(\"%m-%d-%Y\")\n return render_score_page(\"index.html\", datestr... | [
"0.66856855",
"0.6264408",
"0.5798715",
"0.57950044",
"0.5549387",
"0.55020916",
"0.54524344",
"0.544693",
"0.5446883",
"0.54193795",
"0.538566",
"0.53187484",
"0.5316336",
"0.5307269",
"0.52999324",
"0.52608603",
"0.52032787",
"0.5194402",
"0.5177872",
"0.5137147",
"0.511650... | 0.7255501 | 0 |
Get list of games in daily scoreboard. | def get_games(date):
scoreboard = nba_py.Scoreboard(month=date.month,
day=date.day,
year=date.year)
line_score = scoreboard.line_score()
game_header = scoreboard.game_header()
games = []
current_game = {}
game_sequence = 0
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_games(season, date):\n url = \"http://live.nhl.com/GameData/SeasonSchedule-\" + season + \".json\"\n response = urllib.urlopen(url)\n data = json.loads(response.read())\n games = []\n for game in data:\n if game[\"est\"][:8] == date:\n games.append(game)\n return games",... | [
"0.73755777",
"0.73113036",
"0.71790415",
"0.69887614",
"0.696558",
"0.6951601",
"0.6938847",
"0.6931797",
"0.69291914",
"0.6795544",
"0.6662662",
"0.6488449",
"0.6464402",
"0.639219",
"0.6384629",
"0.637464",
"0.6315723",
"0.6276213",
"0.62460154",
"0.6242827",
"0.6199504",
... | 0.74339443 | 0 |
Search post request when searching for a specific player or team. | def search():
name = request.form["searchname"]
if name.upper() == "YAO MING":
return redirect(url_for("players", playerid="2397"))
team_id = ""
split_name = name.split(" ", 1)
if (len(split_name) == 1):
try:
get_player = player.get_player(split_name[0], just_id=False)
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def post(self, request, custom_url: str) -> render:\n\n c_user = request.user\n\n context = self.get_menu_context('music', 'Музыка')\n context['matching'] = True\n if not request.POST.get('query'):\n context['matching'] = False\n context['mu... | [
"0.62685007",
"0.5986824",
"0.5942399",
"0.59355116",
"0.58643496",
"0.583581",
"0.58182544",
"0.5798136",
"0.5775005",
"0.5677074",
"0.56644845",
"0.5644946",
"0.5592587",
"0.55699605",
"0.55672497",
"0.55518734",
"0.55378574",
"0.5534999",
"0.5517781",
"0.55081433",
"0.5487... | 0.73069435 | 0 |
this function will indicate if a line should be ignored, if it's a comment line or empty | def shouldTheLineBeIgnored(self,line):
global multi_comment_line_mode
if multi_comment_line_mode:
if line.find("*/") != -1:
# we found the ending line
multi_comment_line_mode = False
return False,line[line.find("*/")+2:]+'$endOf... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_line(line):\r\n if not line.strip():\r\n return False # if the last line is blank\r\n if line.startswith(\"#\"):\r\n return False # comment line\r\n if line.startswith(\" #\"):\r\n return False # comment line\r\n return line",
"def skip_line(line):\n return IGNO... | [
"0.7507151",
"0.7377068",
"0.73594356",
"0.7340736",
"0.72747046",
"0.7187449",
"0.71126205",
"0.71126205",
"0.7084072",
"0.69851965",
"0.69462186",
"0.68963456",
"0.6768147",
"0.6768147",
"0.6768147",
"0.6768147",
"0.6768147",
"0.6768147",
"0.6768147",
"0.6768147",
"0.676814... | 0.80938894 | 0 |
creates a new token and adds it to the list of tokens. | def createToken(self,type,value):
newToken = Token(type, value)
self.tokensTable.append(newToken) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def addToken(self, tokenType, value):\r\n\t\tself.tokens.append( Token(tokenType, value) )",
"def add_token(self,token):\n\t\tif not token:\n\t\t\tlogging.error(\"Token cannot be empty!\")\n\t\t\texit()\n\n\t\tself.tokens.append(token.lower())\n\t\t#self.user_defined_token = token.lower()",
"def addToken(self,... | [
"0.742958",
"0.72666687",
"0.70169747",
"0.70086443",
"0.6972637",
"0.6972637",
"0.6870133",
"0.6566164",
"0.6503664",
"0.6501116",
"0.6451819",
"0.63962394",
"0.6373598",
"0.62586296",
"0.62049127",
"0.6193795",
"0.6131426",
"0.60756105",
"0.60682315",
"0.60681415",
"0.60532... | 0.7692151 | 0 |
this function will just create a temporary xml file with all the tokens with their labels, in order to debug. this xml will not be generated in the final program | def writeToTempXml(self):
name = self.fileToProcess.name
all_tokens = ET.Element("tokens")
for token in self.tokensTable:
if token.getType() == KEYWORD:
keyword = ET.SubElement(all_tokens, "keyword")
keyword.text = ' '+token.getValue()+' '
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def tokens_dump(docid):\n tagged_strings = set()\n labels = get_labels()\n tagged_sequence = labels # replacing prep_inputs method. still works?\n tagged_strings.add(tuple(tagged_sequence))\n outfile = SETTINGS.XML_LOCATION + \"/\" + docid + \".xml\"\n try:\n os.remove(outfile)\n except... | [
"0.66678095",
"0.58849597",
"0.5764239",
"0.571944",
"0.5707829",
"0.5673825",
"0.5667747",
"0.55502224",
"0.55148125",
"0.5463388",
"0.5434148",
"0.54197377",
"0.54130113",
"0.5357553",
"0.5313254",
"0.5286458",
"0.5276797",
"0.5256187",
"0.5254526",
"0.5239966",
"0.52307767... | 0.7522477 | 0 |
Obtain a mask for each image in the list of images query_img. The method will be determined by the passed method argument. | def bg_mask(query_imgs, method):
print("Obtaining masks")
segmentation_method = get_method(method)
return [segmentation_method(img) for img in query_imgs] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def apply_mask(query_imgs, masks, method):\n resulting_imgs = []\n for img, mask in zip(query_imgs, masks):\n positions = np.where(mask == 255)\n if method == CBHS: # Special treatment for cell-based bg segmentation to mantain \n x_min, x_max, y_min, y_max = positions[0][0], position... | [
"0.77740014",
"0.66345733",
"0.65263313",
"0.6186163",
"0.59989136",
"0.59502006",
"0.5948844",
"0.5948451",
"0.5936673",
"0.5936673",
"0.5936673",
"0.5858566",
"0.5851606",
"0.5791609",
"0.5766119",
"0.5734559",
"0.57131267",
"0.57121515",
"0.57069325",
"0.5696809",
"0.56874... | 0.8243731 | 0 |
Apply mask to each image in the query set, based on the method that was applied | def apply_mask(query_imgs, masks, method):
resulting_imgs = []
for img, mask in zip(query_imgs, masks):
positions = np.where(mask == 255)
if method == CBHS: # Special treatment for cell-based bg segmentation to mantain
x_min, x_max, y_min, y_max = positions[0][0], positions[0][-1], ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def bg_mask(query_imgs, method):\n print(\"Obtaining masks\")\n segmentation_method = get_method(method)\n return [segmentation_method(img) for img in query_imgs]",
"def apply_mask(self):\n for mask, param in self.masked_parameters:\n param.mul_(mask)",
"def calcmask(self, *args, **k... | [
"0.7808987",
"0.67079467",
"0.639066",
"0.62912345",
"0.61960936",
"0.61865187",
"0.6183271",
"0.61609346",
"0.6134059",
"0.6008446",
"0.6008446",
"0.5994534",
"0.5989167",
"0.5982266",
"0.5970466",
"0.596114",
"0.5945611",
"0.59365463",
"0.58869183",
"0.58798075",
"0.5861524... | 0.78092 | 0 |
Obtain left, top, right and bottom positions in the celled histogram that provides maximum change. With these positions a rectangular matrix can be constructed. | def obtain_rectangular_segmentation(celled_hist, cells):
celled_hist = np.array(celled_hist).reshape(cells[0]*cells[1], -1)
scores = l1_dist(celled_hist, celled_hist)
layers = cells[0]//2
left, right, top, bottom = compute_positions(scores, layers, cells, "lr"), compute_positions(scores, layers, c... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def bottom_left_tile_value(self):\n\t\treturn self.expected_cols * (self.expected_rows - 1) + 1",
"def bottom_right_tile_value(self):\n\t\treturn self.expected_rows * self.expected_cols",
"def find_max(self):\n\n max_x = -10\n max_y = -10\n k = len(self.__col_lista)\n for i in range... | [
"0.6224814",
"0.6038693",
"0.6004788",
"0.59364384",
"0.5898767",
"0.58359027",
"0.5803097",
"0.57720894",
"0.5764861",
"0.5733206",
"0.57220376",
"0.57121265",
"0.56905895",
"0.56598204",
"0.5611036",
"0.5577255",
"0.557451",
"0.55710006",
"0.55709165",
"0.5556517",
"0.55523... | 0.61352736 | 1 |
Compute a cell matrix histogram. If cells=[32,32], returns a 32x32 matrix where each position contains a 2D color histogram (image descriptor). | def obtain_celled_histograms(img, cells, w_ranges, h_ranges):
results = []
img = cv2.cvtColor(img, cv2.COLOR_RGB2Lab)
histogram_matrix = []
for i in range(cells[0]):
row = []
for j in range(cells[1]):
img_part = img[w_ranges[i]:w_ranges[i+1], h_ranges[j]:h_ranges[j+1]]
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def cell_based_hist_segmentation(img, cells=[32, 32]):\n descriptor = []\n w,h = img.shape[:2]\n w_ranges = [(i*w)//cells[0] for i in range(cells[0])]+[-1]\n h_ranges = [(i*h)//cells[1] for i in range(cells[1])]+[-1]\n\n celled_hist = obtain_celled_histograms(img, cells, w_ranges, h_ranges)\n\n r... | [
"0.71106833",
"0.6293851",
"0.6281191",
"0.61843",
"0.61735624",
"0.60875905",
"0.59519565",
"0.5949663",
"0.5861934",
"0.5823168",
"0.57868886",
"0.57169867",
"0.570334",
"0.5700379",
"0.56820166",
"0.56749356",
"0.56629336",
"0.5627494",
"0.5611744",
"0.559957",
"0.5583366"... | 0.7789359 | 0 |
Update finding with new id and updatedAt fields. | def update_finding_id(finding, new_id, updated_at=None):
finding["Id"] = new_id
if updated_at:
finding["UpdatedAt"] = updated_at
return finding | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update(self, table, id, **kwargs):\n pairs = [column + ' = %s' for column in kwargs.keys()]\n values = kwargs.values()\n if 'changed_by' in self.get_columns(table):\n pairs += ['changed_by = %s', 'date_changed = now()']\n values += [self.user_id]\n self.db.exec... | [
"0.61465585",
"0.61105394",
"0.609029",
"0.60817885",
"0.59753263",
"0.5965248",
"0.5913162",
"0.58955085",
"0.58839965",
"0.58768344",
"0.58768344",
"0.58768344",
"0.58369416",
"0.5829934",
"0.5824282",
"0.58113456",
"0.58023703",
"0.57954216",
"0.57895267",
"0.5767917",
"0.... | 0.7418794 | 0 |
For each depth, generate a polygon describing the cut on the "north" side. | def generate_cuts(depths, side=SIDE_LENGTH):
for num, den in depths:
ad = num * side / den
poly = Polygon([(0, 0), (side, 0), (side, ad), (0, ad)])
yield poly | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def generatePolygons():",
"def regular_polygon(sides, radius, height):\n global _cmds\n _cmds = \"}\\n\\n\" + _cmds\n for wedge in range(sides):\n p1 = _cart(radius, wedge*360/sides)\n p2 = _cart(radius, (wedge+1)*360/sides)\n triangle([0, 0], p1, p2, height)\n _cmds = \"union(){... | [
"0.6352084",
"0.5903977",
"0.57167846",
"0.57037365",
"0.56498015",
"0.5617988",
"0.5543349",
"0.55307436",
"0.549076",
"0.5488289",
"0.54753643",
"0.547494",
"0.54746133",
"0.5447459",
"0.54430604",
"0.5431998",
"0.54062235",
"0.5366982",
"0.53622246",
"0.53498185",
"0.53434... | 0.81020045 | 0 |
Creates file for each NBA team containing game info from last season | def create_game_logs_file(team_id):
# team game log
path = os.path.join(TEAM_BASE_PATH, TEAM_DICT[team_id] + '.json')
if not os.path.exists(path):
print("Retrieving team " + TEAM_DICT[team_id] +
" game log, season stats ... Please wait.")
game_logs = team.TeamGameLogs(team_id, ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def init():\n for team_id in TEAM_DICT.keys():\n create_game_logs_file(team_id)",
"def write_league_players(understat_path, season): \n loop = asyncio.get_event_loop()\n players = loop.run_until_complete(get_league_players(season))\n player = pd.DataFrame.from_dict(players) # Equivalent of ... | [
"0.63666624",
"0.6253113",
"0.624497",
"0.6097944",
"0.6094452",
"0.6092984",
"0.6072868",
"0.5952969",
"0.593158",
"0.5925691",
"0.5921844",
"0.58187026",
"0.5802706",
"0.578666",
"0.57782906",
"0.5777222",
"0.5764585",
"0.5715087",
"0.5709732",
"0.57018524",
"0.56826544",
... | 0.68948334 | 0 |
Test the CLI convert command. | def test_cli_convert(app, bed_path, zarr_tmp_path): # noqa
result = runner.invoke(app, ["convert", f"{bed_path}", f"{zarr_tmp_path}"])
assert result.exit_code == 0
assert zarr_tmp_path.is_dir() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_cli_conversion(self):\n output = main('coloredlogs', '--convert', 'coloredlogs', '--demo', capture=True)\n # Make sure the output is encoded as HTML.\n assert '<span' in output",
"def test_convert():",
"def test_convert(self):\n out_text = StringIO()\n with redirect_... | [
"0.74902606",
"0.7343261",
"0.72497123",
"0.6713388",
"0.6565135",
"0.65025544",
"0.64929765",
"0.6471126",
"0.6387078",
"0.63310874",
"0.6328124",
"0.63148046",
"0.627495",
"0.627495",
"0.62226474",
"0.61437595",
"0.6133579",
"0.6133579",
"0.6133579",
"0.6133579",
"0.6133579... | 0.7578506 | 0 |
export AmpliconSet as TSV | def export_amplicon_set_tsv(self, params):
logging.info('start exporting amplicon set object')
amplicon_set_ref = params.get('input_ref')
amplicon_set_df = self._amplicon_set_to_df(amplicon_set_ref)
result_dir = os.path.join(self.scratch, str(uuid.uuid4()))
self._mkdir_p(result... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def export_tsv(self):\n outputfile = tkinter.filedialog.asksaveasfilename(\n defaultextension=\".tsv\",\n filetypes=((\"tab seperated values\", \"*.tsv\"),\n (\"All Files\", \"*.*\")))\n if outputfile:\n tabledata = self.tabs.window.aistracker.cr... | [
"0.59755164",
"0.57235795",
"0.5657693",
"0.56393194",
"0.56188923",
"0.55969584",
"0.5545065",
"0.54538196",
"0.5319591",
"0.53152305",
"0.527546",
"0.5226011",
"0.51641214",
"0.5163705",
"0.5158124",
"0.5129905",
"0.50534207",
"0.50507843",
"0.5033587",
"0.50324833",
"0.500... | 0.7254079 | 0 |
Test the _delete_sheets() method | def test_delete_sheet(self):
self.workbook.add_worksheet('Sheet1')
self.workbook.add_worksheet('Sheet2')
self.workbook._write_sheets()
exp = """<sheets><sheet name="Sheet1" sheetId="1" r:id="rId1"/><sheet name="Sheet2" sheetId="2" r:id="rId2"/></sheets>"""
got = self.fh.getvalu... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_delete_buckets(self):\n pass",
"def test_delete_bucket(self):\n pass",
"def test_delete_run(self):\n pass",
"def test_aws_service_api_vm_workshift_delete(self):\n pass",
"def test_delete(self):\r\n course = CourseFactory.create(org='edX', course='999')\r\n ... | [
"0.64588976",
"0.59919167",
"0.5933634",
"0.58989644",
"0.58353966",
"0.5820436",
"0.57939655",
"0.5754813",
"0.57505316",
"0.5708442",
"0.5697343",
"0.56962657",
"0.5692305",
"0.56788445",
"0.56646174",
"0.5659868",
"0.5630166",
"0.5594766",
"0.55886954",
"0.55800515",
"0.55... | 0.7621504 | 0 |
Sends a reminder email based on the arguments for easy scripting | def send_reminder():
name = config["email"]["name"]
user = config["email"]["user"]
subject = "REMINDER: %s" % sys.argv[1]
body = sys.argv[2] if len(sys.argv) > 2 else ""
email_helper.send(user, name, user, subject, body) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def task_send_reminder_email():\n send_reminder_email()\n logger.info(\"Sent reminder email\")",
"def send_reminder(self):\n pass",
"def exec(self): \r\n emails = self.args[0].split(',')\r\n for email in emails:\r\n send_mail(self.args[1], self.args[2], email)\r\n r... | [
"0.74956924",
"0.7179477",
"0.70684314",
"0.6713392",
"0.6654129",
"0.6575302",
"0.65031403",
"0.64966327",
"0.6465705",
"0.6435539",
"0.6431049",
"0.64269364",
"0.6388207",
"0.6252947",
"0.62377954",
"0.6234091",
"0.62230086",
"0.62125534",
"0.61743337",
"0.6134789",
"0.6124... | 0.8920202 | 0 |
Take a diff string and convert it to syntax highligted HTML This takes a diff string and runs it through vim's TOhtml script to generate HTML that shows a rendered diff with syntax highlighting. | def _generate_html_diff(diff_output):
diff_output_file = tempfile.NamedTemporaryFile(delete=False)
with open(diff_output_file.name, 'w') as t:
t.write(diff_output)
# Use the default colorscheme on a light background for the
# generated html
diff_colorize_cmd = shlex.split(
'vim '
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _style_diff(self, diff):\n # NOTE: Django wraps the contents in a <p>, but browsers will\n # be sad about that, because it contains a <pre>. Chrome,\n # for instance, will move it out into its own node. Be\n # consistent and just make that happen for them.\n ... | [
"0.6462075",
"0.60662234",
"0.59270734",
"0.5817898",
"0.5745568",
"0.5704598",
"0.5586395",
"0.55667764",
"0.553908",
"0.55132574",
"0.5492292",
"0.5484959",
"0.54815155",
"0.5458665",
"0.5453541",
"0.5408362",
"0.5382663",
"0.5380105",
"0.53666836",
"0.5363882",
"0.5358014"... | 0.71012473 | 0 |
Generate HTML rendering of a sidebyside diff This takes two to four strings and writes them to temporary files. Then it runs vim to open all the files with a vertical split, uses the TOhtml vim script to convert that into an html file which is then written to another temp file. The content of that file is read into a v... | def _generate_side_by_side_html_diff(
string1_output, string2_output, string3_output=None,
string4_output=None):
string_output_files = []
for string_output in [
string1_output, string2_output, string3_output,
string4_output]:
if not string_output:
brea... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _generate_html_diff(diff_output):\n diff_output_file = tempfile.NamedTemporaryFile(delete=False)\n with open(diff_output_file.name, 'w') as t:\n t.write(diff_output)\n\n # Use the default colorscheme on a light background for the\n # generated html\n diff_colorize_cmd = shlex.split(\n ... | [
"0.6935427",
"0.61285514",
"0.6108246",
"0.5999014",
"0.58274055",
"0.58048826",
"0.5680434",
"0.5638912",
"0.5617471",
"0.55919796",
"0.55733824",
"0.5559977",
"0.55554956",
"0.55301815",
"0.5490199",
"0.5481587",
"0.5448345",
"0.5435468",
"0.5404115",
"0.5347791",
"0.532486... | 0.8523384 | 0 |
Parse the diff associated with a commit The diff associated with commit is normally the difference between the state of the tree in that commit and the state of the tree in one or more of its parent commits. This method will parse that diff and return a list of lines that correspond to added and/or deleted lines of cod... | def _parse_diff(commit_sha1):
class DiffState(object):
START = 0
DIFF_BLOCK_LINE = 1
INDEX_LINE = 2
A_LINE = 3
B_LINE = 4
AT_LINE = 5
DIFF_LINES = 6
diff_cmd = shlex.split('git show {commit_sha1}'.format(
commit_sha1=commit_sha1))
diff_output ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def parseCommit() -> str:\n cmd_tag = f\"git --no-pager diff --diff-filter=ACMR --name-only HEAD~1 HEAD\"\n print(f\"COMMAND: {cmd_tag}\")\n print(\"\", flush=True)\n fileList = subprocess.check_output(cmd_tag, shell=True)\n return fileList.decode('utf-8').splitlines()",
"def dump_commit_diff(comm... | [
"0.67668235",
"0.6617173",
"0.615786",
"0.61474323",
"0.61232686",
"0.61045563",
"0.6047123",
"0.60470784",
"0.6023137",
"0.59735805",
"0.59698206",
"0.5967609",
"0.5944944",
"0.5932438",
"0.588417",
"0.58626026",
"0.5787998",
"0.5774946",
"0.5749417",
"0.57234246",
"0.570831... | 0.7781374 | 0 |
Check added code is not removed and vice versa We want to determine whether later commits in the same branch remove or duplicate code that was added by an earlier commit in the branch or if removed code is readded or removed in another location. This can be done by passing a line of the commit's associated diff to the ... | def _check_diff_add_delete(commit_sha1, head_sha1):
commit_info = {}
branch_sha1s = []
# Get list of commits between this one and the branch head
git_log_cmd = shlex.split(
'git log --oneline --no-abbrev --reverse '
'{commit_sha1}..{head_sha1}'.format(
commit_sha1=commit_sha... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _check_diff_move(commit_sha1, head_sha1):\n commit_info = {}\n branch_sha1s = []\n\n # Get list of commits between this one and the branch head\n git_log_cmd = shlex.split(\n 'git log --oneline --no-abbrev --reverse '\n '{commit_sha1}..{head_sha1}'.format(\n commit_sha1=com... | [
"0.6234145",
"0.59902537",
"0.59753424",
"0.59653366",
"0.5901322",
"0.5837043",
"0.58310616",
"0.5809848",
"0.58078736",
"0.5804549",
"0.5749114",
"0.5715498",
"0.56908053",
"0.5660887",
"0.56248826",
"0.55297625",
"0.55249697",
"0.54839456",
"0.5470019",
"0.54518175",
"0.54... | 0.6817716 | 0 |
Check added or changed code has not been moved We want to determine whether later commits in the same branch move code that was updated in an earlier commit. | def _check_diff_move(commit_sha1, head_sha1):
commit_info = {}
branch_sha1s = []
# Get list of commits between this one and the branch head
git_log_cmd = shlex.split(
'git log --oneline --no-abbrev --reverse '
'{commit_sha1}..{head_sha1}'.format(
commit_sha1=commit_sha1, hea... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def local_changes():\n result, output = popen('git status', False, False)\n try:\n return not output[-1].startswith(\"nothing to commit\")\n except IndexError:\n return True",
"def check_move(self, move):\n\n if str(move) in self.moves_made:\n return False\n return... | [
"0.6227778",
"0.6157627",
"0.604345",
"0.60423243",
"0.5937032",
"0.59338146",
"0.5875718",
"0.58480257",
"0.5824385",
"0.57581633",
"0.5725834",
"0.5703709",
"0.5675813",
"0.5660672",
"0.5636747",
"0.5629766",
"0.560405",
"0.5584103",
"0.5574079",
"0.5573388",
"0.55449444",
... | 0.61819804 | 1 |
Check the commit message and commit diff. The commit message is checked for the following Title is 50 characters or less Title is in imperative mood Title begins with a capital letter Title beings with verb (see commit_title_start_words) Title does not end in punctuation or whitespace There is a blank line separating t... | def _validate_commit(
commit_sha1, merge, author, committer, title, separator, body):
errors = []
# List of words a commit title can start with
commit_title_start_words = filter(
lambda x: x, COMMIT_TITLE_START_WORDS.splitlines())
author_errors = _validate_email(author, 'Author')
c... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def check_commit_problems(self, commit, diff):\n\n # Initialise\n self._license_problem = False\n self._commit_problem = False\n self._commit_notes = defaultdict(list)\n\n # Unsafe regex checks...\n unsafe_matches = list()\n unsafe_matches.append( r\"\\b(KRun::runCo... | [
"0.7362382",
"0.70552653",
"0.701963",
"0.6680221",
"0.6538131",
"0.62699616",
"0.6244798",
"0.6007464",
"0.60052216",
"0.59986544",
"0.5935543",
"0.5911222",
"0.5903283",
"0.58931595",
"0.5861587",
"0.5839806",
"0.5837703",
"0.58372337",
"0.5822277",
"0.5812173",
"0.578061",... | 0.7532964 | 0 |
Parse the output of git log format=full This parses the output of git log formatfull , extracts the commit sha1, author, committer, commit title, commit separator, and commit message body values and passes them to other methods to validate their format | def _parse_commit_log(base_commit, tip_commit):
class LogState(object):
SEPARATOR_LINE = 0
COMMIT_SHA1_LINE = 1
MERGE_LINE = 2
AUTHOR_LINE = 3
COMMITTER_LINE = 4
MIDDLE_SEPARATOR_LINE = 5
TITLE_LINE = 6
BLANK_LINE = 7
BODY_LINES = 8
commi... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def parse_git_log(cls, repo_path, commit=None, pkgs=False, verbosity=-1):\n cmd = shlex.split(cls._git_cmd)\n # custom git log format, see the \"PRETTY FORMATS\" section of the git\n # log man page for details\n format_lines = [\n '# BEGIN COMMIT',\n '%h', # abbrev... | [
"0.6421075",
"0.5869288",
"0.5712835",
"0.57056826",
"0.5663615",
"0.5649697",
"0.56157106",
"0.55999523",
"0.55940133",
"0.547705",
"0.5421677",
"0.5412499",
"0.5387538",
"0.530713",
"0.52561617",
"0.5245139",
"0.5184921",
"0.51770186",
"0.51596844",
"0.51574826",
"0.5141554... | 0.6594322 | 0 |
Check the SQL Database Version and prints on console. | def version(self):
self.cursor.execute("SELECT VERSION()")
# Fetch a single row using fetchone() method.
data = self.cursor.fetchone()
print("Database version : %s " % data) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def check():\n conn = None\n try:\n # read connection parameters\n params = config()\n \n # connect to the PostgreSQL server\n print('Connecting to the PostgreSQL database...')\n conn = psycopg2.connect(**params)\n \n # create a cursor\n cur = conn.cursor... | [
"0.74608433",
"0.745182",
"0.72382915",
"0.7159295",
"0.7049766",
"0.70265293",
"0.6929252",
"0.68626547",
"0.68565637",
"0.679402",
"0.6749475",
"0.670352",
"0.66886044",
"0.6532294",
"0.64263856",
"0.64192784",
"0.6319371",
"0.6301346",
"0.62995845",
"0.6246262",
"0.6200538... | 0.7676812 | 0 |
Insert a record into the MySQL Database. | def insert(self, sql):
try:
# Execute the SQL command
self.cursor.execute(sql)
# Commit your changes in the database
self.db.commit()
except:
# Rollback in case there is any error
self.db.rollback() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def insert(self):\n self.getDbRecord().insert()\n\n return",
"def insert_record(self, record, session):\n try:\n session.add(record)\n session.commit()\n session.close()\n return True\n except:\n\n logging.exception(\"http record ... | [
"0.72778225",
"0.71292144",
"0.6977028",
"0.6974775",
"0.6912995",
"0.6867108",
"0.6768567",
"0.6768567",
"0.6768567",
"0.6734239",
"0.6724782",
"0.6591992",
"0.656104",
"0.6560686",
"0.65567183",
"0.65319073",
"0.65109533",
"0.6503445",
"0.6499452",
"0.6496004",
"0.64883584"... | 0.7278151 | 0 |
Internal init method. Please use DHTProtocol.create coroutine to spawn new protocol instances | def __init__(self, *, _initialized_with_create=False):
assert _initialized_with_create, "Please use DHTProtocol.create coroutine to spawn new protocol instances"
super().__init__() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self, *args, **kwargs):\n self._initialize_protocols()\n super().__init__(*args, **kwargs)",
"def __init__(self, protocol):\r\n self._protocol = protocol",
"def __init__(self, protocol, timeout):\r\n self._protocol = protocol\r\n self._timeout = timeout\r\n\r\n ... | [
"0.7248141",
"0.702848",
"0.66360265",
"0.65688103",
"0.6516263",
"0.64979625",
"0.6491149",
"0.64696556",
"0.64560825",
"0.63274443",
"0.6293979",
"0.6292233",
"0.62528545",
"0.6223429",
"0.6187743",
"0.61605954",
"0.6160218",
"0.61589706",
"0.61360425",
"0.61326575",
"0.612... | 0.8525663 | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.