query stringlengths 10 2k | document stringlengths 20 51.2k | metadata dict | negatives listlengths 0 101 | negative_scores listlengths 0 101 | document_score stringlengths 3 10 | document_rank stringclasses 102
values |
|---|---|---|---|---|---|---|
Return the state attributes of the sensor. | def device_state_attributes(self):
if self.ticker is not None:
return {
ATTR_VOLUME_24H: self.ticker.values.get("volume"),
ATTR_ATTRIBUTION: ATTRIBUTION,
ATTR_HIGH: self.ticker.values.get("high"),
ATTR_LOW: self.ticker.values.get("low")... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def device_state_attributes(self):\r\n return self.attributes",
"def device_state_attributes(self):\r\n return self._attributes",
"def device_state_attributes(self):\n return self.attr",
"def device_state_attributes(self):\n return self.attr",
"def device_state_attributes(self) ... | [
"0.8418945",
"0.82497084",
"0.8243777",
"0.8243777",
"0.8200083",
"0.8169021",
"0.8169021",
"0.8159991",
"0.8159991",
"0.8145903",
"0.8145903",
"0.8145903",
"0.8145903",
"0.8145903",
"0.8145903",
"0.8145903",
"0.8145903",
"0.8145903",
"0.8145903",
"0.8145903",
"0.8145903",
... | 0.7764953 | 44 |
Gets the Y offset for a subtitle, which depends on the amount of other subtitles in the same frame, starting from the bottom of the screen. | def get_subtitle_offset(annotation, seen_annotations, clip):
if not annotation["time"] in seen_annotations:
return clip.h - SUBTILE_OFFSET
else:
return clip.h - SUBTILE_OFFSET * (seen_annotations[annotation["time"]] + 1) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_y_position(self): \n return self.rect.y",
"def offset_y(self) -> int:\n self.tk_ref.update()\n return self.tk_ref.winfo_y()",
"def get_y_position(self):\n return self.actual_coordinates[1]",
"def calculate_needed_subtitle_height(annotation, seen_annotations, video_c... | [
"0.6871079",
"0.6715393",
"0.65705156",
"0.65487295",
"0.651345",
"0.64495647",
"0.64017105",
"0.6387945",
"0.6371842",
"0.63330126",
"0.6286153",
"0.62763995",
"0.6214757",
"0.6162144",
"0.61399627",
"0.6102879",
"0.60661423",
"0.59722424",
"0.59592944",
"0.59530646",
"0.593... | 0.7431569 | 0 |
Close connection to server | def close(self):
raise NotImplementedError("Implement this method in child class") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def server_close(self):\n\t\tself.socket.close()",
"def closeConnection(self):\n print(\"closing connection...\")\n self.s.close()\n quit()",
"def close_connection(self):\n\n self._connection.close()\n print(\"Closed connection....\")",
"def close_connection(self):\n ... | [
"0.82518435",
"0.8013835",
"0.7980111",
"0.7974678",
"0.7892853",
"0.78618973",
"0.7861448",
"0.7830445",
"0.7802471",
"0.77964634",
"0.77766716",
"0.7768273",
"0.7763801",
"0.7720741",
"0.7711053",
"0.77023023",
"0.76916564",
"0.76901287",
"0.76901287",
"0.7668527",
"0.76062... | 0.0 | -1 |
displays a series of box plots to compare how the distribution of the numerical variable changes if we only consider the subpopulation which belongs to each category. There should be as many box plots as categories. For example, with Sex and Height, we would compare the height distributions of men vs. women with two bo... | def compare_box_plots(categorical_var, numerical_var):
sns.boxplot(x=categorical_var, y=numerical_var, palette="Set2")
plt.show() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def build_box_plots(dep_vars, categorical, combined_data, categ_corr_data, drop_outliers=True):\n\n for column in dep_vars.columns:\n num_rows = len(params.t_categorical) + len(params.anova_categorical)\n fig = make_subplots(rows=num_rows, cols=1, subplot_titles=[i for i in range(num_rows)])\n ... | [
"0.76015925",
"0.7292726",
"0.6860297",
"0.6739673",
"0.6734272",
"0.65847844",
"0.6579316",
"0.64898026",
"0.64578336",
"0.6454206",
"0.6438693",
"0.64298517",
"0.64173603",
"0.6410453",
"0.6374145",
"0.63566065",
"0.6331191",
"0.62990534",
"0.6277556",
"0.6241496",
"0.62268... | 0.75841045 | 1 |
Get the root directory that a file is contained in. | def rootname(filename):
if os.path.sep not in filename:
return ''
else:
file_root, _ = filename.split(os.path.sep, 1)
return file_root | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def rootdir():\n return util.path(__file__).parent.parent.abspath()",
"def root_dir():\r\n return Path(__file__).parent.parent",
"def get_root_directory() -> str:\n return \"{}/../\".format(get_cur_directory(__file__))",
"def root_dir():\n return os.path.dirname(os.path.realpath(__file__ + '/..')... | [
"0.8401718",
"0.8232456",
"0.8170139",
"0.81362903",
"0.81362903",
"0.8120479",
"0.8059272",
"0.80056167",
"0.7933893",
"0.78993785",
"0.75052685",
"0.74868345",
"0.74257714",
"0.7146845",
"0.71027595",
"0.71027595",
"0.71027595",
"0.71027595",
"0.70947593",
"0.7057569",
"0.7... | 0.67791116 | 44 |
Gets a list of files in the repository. By default, returns all files via ``git lsfiles``. However, in some cases uses a specific commit or branch (a socalled diff base) to compare against for changed files. (This requires ``allow_limited=True``.) To speed up linting on Travis pull requests against master, we manually ... | def get_affected_files(allow_limited=True):
diff_base = None
if in_travis():
# In the case of a pull request into a branch, we want to
# diff against HEAD in that branch.
if in_travis_pr():
diff_base = travis_branch()
else:
diff_base = local_diff_branch()
if ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_changed_files():\n upstream = \"origin/master\"\n local_commit = subprocess.check_output(\n \"git rev-list HEAD ^{} -- 2>/dev/null | tail -1\".format(upstream),\n shell=True).strip().decode()\n diff_base = subprocess.check_output(\n ['git', 'rev-parse', local_commit +\n ... | [
"0.68072855",
"0.6585311",
"0.65016973",
"0.6431687",
"0.6408093",
"0.63697475",
"0.6324268",
"0.6173308",
"0.61671096",
"0.6108347",
"0.6102892",
"0.6068903",
"0.60369605",
"0.60089475",
"0.59494555",
"0.594484",
"0.5936034",
"0.5860184",
"0.58455664",
"0.5807658",
"0.577531... | 0.7726773 | 0 |
Run the scion infrastructure. | def run(self):
self.scion_sh('run', 'nobuild') | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def run():\n main()",
"def run(self):\n self.cancelled = False\n # get version from IDF object or by parsing the IDF file for it\n\n # Move files into place\n self.epw = self.idf.epw.copy(self.run_dir / \"in.epw\").expand()\n self.idfname = Path(self.idf.savecopy(self.run_di... | [
"0.6894294",
"0.67111385",
"0.6558443",
"0.6557938",
"0.6533668",
"0.65227413",
"0.64662033",
"0.6451506",
"0.6443237",
"0.6443237",
"0.6387801",
"0.6335682",
"0.62957275",
"0.62941146",
"0.62941146",
"0.62853104",
"0.62822205",
"0.6256149",
"0.62518",
"0.6247002",
"0.6216785... | 0.60222375 | 74 |
Return the SCION Daemon address for the given AS. | def sciond_addr(isd_as: ISD_AS, port: bool = True, gen_dir: str = "gen"):
with open("%s/sciond_addresses.json" % gen_dir) as f:
addrs = json.load(f)
ip = addrs[str(isd_as)]
if not port:
return ip
if ':' in ip:
return '[%s]:30255' % ip
return '%s:30255'... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def discovery_address(self):\n\n return self.config.dict[\"fhdhr\"][\"discovery_address\"]",
"def _get_bus_address(self):\n if 'PULSE_DBUS_SERVER' in os.environ:\n address = os.environ['PULSE_DBUS_SERVER']\n else:\n bus = dbus.SessionBus()\n server_lookup = b... | [
"0.56370544",
"0.5573383",
"0.5548528",
"0.5532349",
"0.55310917",
"0.5499036",
"0.5443087",
"0.5443087",
"0.5443087",
"0.5388371",
"0.5364227",
"0.53483105",
"0.53415495",
"0.5340382",
"0.53012794",
"0.52578723",
"0.5252672",
"0.52433074",
"0.52349323",
"0.5192276",
"0.51766... | 0.646356 | 0 |
Convert a QuantumCircuit or Instruction to a SuperOp. | def _init_instruction(cls, instruction):
# Convert circuit to an instruction
if isinstance(instruction, QuantumCircuit):
instruction = instruction.to_instruction()
# Initialize an identity superoperator of the correct size
# of the circuit
op = SuperOp(np.eye(4**instr... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _instruction_to_superop(cls, obj):\n if not isinstance(obj, Instruction):\n raise QiskitError(\"Input is not an instruction.\")\n chan = None\n if obj.name == \"reset\":\n # For superoperator evolution we can simulate a reset as\n # a non-unitary superopera... | [
"0.8351595",
"0.6264704",
"0.5904475",
"0.5782806",
"0.56627077",
"0.56250596",
"0.5613012",
"0.55981225",
"0.54336154",
"0.5408546",
"0.5291557",
"0.51504314",
"0.5107355",
"0.50530857",
"0.50515395",
"0.5019881",
"0.4994049",
"0.49794614",
"0.49697796",
"0.49418667",
"0.493... | 0.7272304 | 1 |
Return superop for instruction if defined or None otherwise. | def _instruction_to_superop(cls, obj):
if not isinstance(obj, Instruction):
raise QiskitError("Input is not an instruction.")
chan = None
if obj.name == "reset":
# For superoperator evolution we can simulate a reset as
# a non-unitary superoperator matrix
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def opcode(self):\n if self.op is None:\n return None\n return self.op.value",
"def _init_instruction(cls, instruction):\n # Convert circuit to an instruction\n if isinstance(instruction, QuantumCircuit):\n instruction = instruction.to_instruction()\n # In... | [
"0.5760486",
"0.57321495",
"0.5578271",
"0.5493956",
"0.5478866",
"0.53974533",
"0.5389522",
"0.53331083",
"0.52625275",
"0.5248053",
"0.51757765",
"0.51658475",
"0.51658475",
"0.5144784",
"0.51346594",
"0.5126073",
"0.51252216",
"0.5003728",
"0.4977125",
"0.49703795",
"0.496... | 0.5808667 | 0 |
Given an array of integers nums sorted in ascending order, find the starting and ending position of a given target value. | def searchRange(self, nums: List[int], target: int) -> List[int]:
if not nums:
return [-1, -1]
n = len(nums)
start, end = 0, n - 1
while start <= end:
mid = start + (end - start + 1 + 1)//2 - 1
left = right = -1
if nums[mid] == target:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def return_indices(nums, target):\n indices = []\n i = 0\n number_found = False\n while not number_found:\n my_target = nums[i]\n \n for j in range(i+1,len(nums)):\n my_target += nums[j]\n if my_target == target:\n number_found = True\n ... | [
"0.73196596",
"0.7164879",
"0.7095252",
"0.7071248",
"0.7047297",
"0.692583",
"0.6843794",
"0.6821333",
"0.6801539",
"0.678413",
"0.67623436",
"0.67500114",
"0.6664088",
"0.6656021",
"0.66495335",
"0.66300666",
"0.6585061",
"0.65830064",
"0.65588087",
"0.65181464",
"0.6515593... | 0.7592814 | 0 |
default page, just a joke | def hello_world():
joke = "Q: What do you get if you cross a bike and a flower? \n A: Bicycle petals! \n "
sourceurl = 'http://www.jokes4us.com/sportsjokes/cyclingjokes.html'
return joke+sourceurl | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def home():\n\n # sets the page to load depending on the type of user\n # if none specified the login screen will be displayed\n pageName = ''\n userType = session.get('UserType', None)\n if userType == None:\n pageName = 'anonHome.jade'\n elif userType == 'Seeker':\n pageName = 'in... | [
"0.69797826",
"0.6865895",
"0.68497777",
"0.68460566",
"0.68264747",
"0.68225265",
"0.6811252",
"0.67917794",
"0.67917794",
"0.67547846",
"0.675415",
"0.67440146",
"0.6720233",
"0.66646886",
"0.6653646",
"0.6642936",
"0.6632548",
"0.66298246",
"0.6623763",
"0.6593027",
"0.659... | 0.0 | -1 |
index page with some links to display database, usually not used | def index():
return render_template("index.html",
title='Index') | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index(request):\n return render(request, \"dbkeeper/index.html\")",
"def index():\n isoko = get_sources('general')\n\n head = \"ALLOVER THE WORLD NEWS\"\n return render_template('index.html', title = head, isoko = isoko)",
"def index():\n entertainment_news = get_sources('entertainment')\n ... | [
"0.70425445",
"0.697863",
"0.69678456",
"0.6963615",
"0.6949365",
"0.68959713",
"0.6869044",
"0.68576455",
"0.6848502",
"0.6847788",
"0.68057775",
"0.6774729",
"0.6760666",
"0.67592907",
"0.6756483",
"0.67360437",
"0.6725852",
"0.6724154",
"0.6708188",
"0.66959256",
"0.668009... | 0.6572593 | 33 |
Set the promption level. Input lMa maximum level, 0 | 1 | 2 | ... logPath log file path, {None} | ... | def prSet(lMa, logPath=None):
global lPr, lMaPr, nmPrs, ticPrs, ticPr0s, nRepPrs, scaPrs, logFile
# level
lPr = 0
lMaPr = lMa
# list
nMa = 10
nmPrs = range(nMa)
ticPrs = range(nMa)
ticPr0s = range(nMa)
nRepPrs = range(nMa)
scaPrs = range(nMa)
# log
if logPath is no... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def setLogLevel(self,value):\n self.PDFreactorConfiguration.in1[\"logLevel\"] = value",
"def set_logger_level(lgr, level):\n if isinstance(level, int):\n pass\n elif level.isnumeric():\n level = int(level)\n elif level.isalpha():\n level = getattr(logging, level)\n else:\n... | [
"0.6721105",
"0.6549579",
"0.65169805",
"0.64718986",
"0.62525815",
"0.6214991",
"0.6193144",
"0.6170877",
"0.6106254",
"0.6054806",
"0.6048361",
"0.6025923",
"0.60212755",
"0.5993841",
"0.59524363",
"0.59482175",
"0.59451747",
"0.59372324",
"0.59150946",
"0.5915042",
"0.5905... | 0.0 | -1 |
Test generating RMG Molecule objects from InChI's | def test_rmg_mol_from_inchi(self):
mol1 = converter.rmg_mol_from_inchi('InChI=1S/NO2/c2-1-3')
mol2 = converter.rmg_mol_from_inchi('InChI=1/CH3NOS/c1-2-3-4-1/h2H,1H2')
self.assertTrue(isinstance(mol1, Molecule))
self.assertTrue(isinstance(mol2, Molecule))
self.assertEqual(mol1.t... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_molecule_subclass_from_inchi(self):\n mol = MyMol.from_inchi(\"InChI=1S/C2H6O/c1-2-3/h3H,2H2,1H3\")\n assert isinstance(mol, MyMol)",
"def test_from_inchi(self, data):\n\n toolkit = OpenEyeToolkitWrapper()\n ref_mol = data[\"molecule\"]\n # make a molecule from inchi\n... | [
"0.7228465",
"0.6633421",
"0.6633421",
"0.65157735",
"0.6491002",
"0.62345743",
"0.6220805",
"0.6200463",
"0.6192611",
"0.6125535",
"0.59561116",
"0.59308815",
"0.59256417",
"0.5921146",
"0.5901561",
"0.5861888",
"0.58432525",
"0.5839492",
"0.58279026",
"0.58211106",
"0.58190... | 0.70576584 | 1 |
Test determining whether two conformers have almost equal internal coordinates (zmats) | def test_compare_zmats(self):
z_1 = {'symbols': ('N', 'N', 'H', 'H'),
'coords': ((None, None, None), ('R_1_0', None, None), ('R_2|3_0|1', 'A_2|3_0|1_1|0', None),
('R_2|3_0|1', 'A_2|3_0|1_1|0', 'D_3_1_0_2')),
'vars': {'R_1_0': 1.2451214479859707, 'D_3_1_0_2... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_hash_equality(self):\n origin = np.random.randn(3)\n normal = np.random.randn(3)\n up_vector = np.random.randn(3)\n up_vector2 = np.random.randn(3)\n p1 = shapes_3d.CoordinatePlane(origin, normal, up_vector)\n p2 = shapes_3d.CoordinatePlane(origin, normal, up_vect... | [
"0.69628465",
"0.654233",
"0.64464223",
"0.63968766",
"0.636755",
"0.63345885",
"0.6320543",
"0.6285077",
"0.6268928",
"0.6257322",
"0.6255276",
"0.62478113",
"0.6247082",
"0.6230886",
"0.6212071",
"0.6188121",
"0.61487716",
"0.6146429",
"0.6134076",
"0.6127143",
"0.6107502",... | 0.7273526 | 0 |
Test determining whether two conformers have almost equal atom distances (dmats) | def test_compare_confs(self):
ch4_1 = {'symbols': ('C', 'H', 'H', 'H', 'H'),
'isotopes': (12, 1, 1, 1, 1),
'coords': ((0.0, 0.0, 0.0),
(0.6300326, 0.6300326, 0.6300326),
(-0.6300326, -0.6300326, 0.6300326),
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def dist(self, one, two):\n return sum((one[0] != two[0], one[1] != two[1]))",
"def is_valid_single_attempt(self, atoms_init, atoms_final):\n from scipy.spatial import cKDTree as KDTree\n from random import shuffle\n atoms1 = atoms_init.copy()\n atoms2 = atoms_final.copy()\n\n ... | [
"0.6817539",
"0.6655798",
"0.64809924",
"0.64623696",
"0.64568377",
"0.6450232",
"0.644597",
"0.64255875",
"0.64038175",
"0.6382689",
"0.638169",
"0.6336372",
"0.62865585",
"0.6286324",
"0.6280587",
"0.6272221",
"0.624663",
"0.62400824",
"0.6216895",
"0.6194805",
"0.61817014"... | 0.62220573 | 18 |
Test checking for molecule isomorphism | def test_check_isomorphism(self):
mol1 = Molecule(smiles='[O-][N+]#N')
mol2 = Molecule(smiles='[N-]=[N+]=O')
self.assertTrue(converter.check_isomorphism(mol1, mol2)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_isomorphic_perumtations(self, inputs):\n # get benzene with all aromatic atoms/bonds labeled\n benzene = Molecule.from_smiles(\"c1ccccc1\")\n # get benzene with no aromatic labels\n benzene_no_aromatic = create_benzene_no_aromatic()\n # now test all of the variations\n ... | [
"0.6780489",
"0.65108985",
"0.64988416",
"0.6450615",
"0.6397275",
"0.63879985",
"0.6372348",
"0.637012",
"0.63463694",
"0.632407",
"0.6250851",
"0.61860776",
"0.61603475",
"0.6075146",
"0.6071487",
"0.60651606",
"0.6061535",
"0.604675",
"0.59458005",
"0.5883534",
"0.58814895... | 0.7865893 | 0 |
Upload the defaults to the MWA pulsar database for ml_parameters, supercomputers. | def upload_defaults():
# ml_parameters
data_list = [
{'ID':1,
'Name':'LOTAAS_periodic_classifier',
'ML_version':'v1.0',
'Training_set_version':'v1.0',
'Command':'LOTAASClassifier.jar',
'Commnents':"LOTAAS'... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def save_defaults(self):\n\n pass",
"def _apply_defaults(self):\n # Applies normal parameter defaults\n for scalar_parameter, value in self._DEFAULT_PARAMETER_SCALARS.items():\n if scalar_parameter not in self.parameters:\n self.parameters[scalar_parameter] = copy.c... | [
"0.6422827",
"0.6021276",
"0.565686",
"0.565686",
"0.565686",
"0.5635508",
"0.56341124",
"0.56305397",
"0.5544445",
"0.55251354",
"0.55251354",
"0.5495411",
"0.5396797",
"0.53916144",
"0.5384932",
"0.5347063",
"0.53439337",
"0.5335209",
"0.532372",
"0.53188485",
"0.53103656",... | 0.7685262 | 0 |
Gets a list of expense names from the user and saves them. | def setup_expense_names(exp_path: str):
exp_list = data_help.read_jsonFile(exp_path)
if len(exp_list) == 0:
exp_list[env.EXPENSE_DATA_KEY] = util.format_input_to_list(
"Please input your expense categories, I will add a Misc category since it is reserved. ")
idxs_matched = util.check... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_list_of_expenses(self):\n fix_exp = DB.get_fixed_expenses(self.customer.email)\n var_exp = DB.get_variable_expenses(self.customer.email)\n self.listOfExpensesSEK.item(2).setText(str(fix_exp[\"subscription\"]))\n self.listOfExpensesSEK.item(3).setText(str(fix_exp[\"insurance\"]))... | [
"0.5879301",
"0.5879301",
"0.5570147",
"0.5526617",
"0.5508212",
"0.5351196",
"0.532544",
"0.53211784",
"0.5267772",
"0.5259469",
"0.5220387",
"0.52201337",
"0.5201665",
"0.51451296",
"0.51253504",
"0.5091481",
"0.5080614",
"0.5073962",
"0.50574523",
"0.5039748",
"0.5005226",... | 0.6005922 | 0 |
Gets the expense data for stores, prompting the user when multiple expenses exist for a store | def get_expenses_for_rows(df, stor_exp_data_path, stor_data_path, budg_path, bankconfig):
print("\nIterating your transactions. If you want to quit halfway, type ctrl c to save!\n")
# initialize the objects for tracking changes
exp_stor_db = data_help.read_jsonFile(stor_exp_data_path)
stor_db = data_he... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def select_store_for_purchase(storename, stor_data_path, stor_db, exp_stor_db, stor_exp_data_path):\n if storename not in stor_db.keys():\n prompt = f\"I cannot filter for the store '{storename}'. Please select the storename for this store and I will remember it for next time. If it is a new store, type ... | [
"0.6076084",
"0.59491384",
"0.57649094",
"0.5580682",
"0.5377986",
"0.5365417",
"0.5352683",
"0.5352683",
"0.53094804",
"0.5303108",
"0.5284345",
"0.5272391",
"0.5150369",
"0.50607246",
"0.5052589",
"0.5004085",
"0.4999233",
"0.49912003",
"0.4950449",
"0.49488443",
"0.4923352... | 0.5671742 | 3 |
returns a list of coordinates of all immediate neighbors of `position` in `input_configuration` | def neighbours(input_configuration, position):
row_pos, seat_pos = position
return [(check_row, check_seat)
for check_row in range (row_pos-1, row_pos + 2) for check_seat in range (seat_pos-1, seat_pos+2)
if (check_row != row_pos or check_seat != seat_pos)
and (check_row, check_seat) in... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _get_neighbours(self, position):\n grid = self._grid\n x, y = position\n neighbours = []\n offsets = [(0,1),(1,0),(0,-1),(-1,0)]\n shuffle(offsets)\n for offset in offsets:\n i, j = offset\n position = (x + i, y + j)\n if grid.valid_pos... | [
"0.7067051",
"0.6925659",
"0.68404746",
"0.6524428",
"0.6486582",
"0.6486001",
"0.6464231",
"0.64107376",
"0.6407922",
"0.6352695",
"0.6316294",
"0.6303389",
"0.6273038",
"0.6269784",
"0.6267988",
"0.62607515",
"0.62354326",
"0.6233238",
"0.6203392",
"0.61682755",
"0.6138745"... | 0.739937 | 0 |
[Training] Load arguments from user command input [attributes for training] | def load_args():
parser = argparse.ArgumentParser()
parser.add_argument("--batchsize",
help="the batch size of the dataloader",
type=int,
default=2,
required=False)
parser.add_argument("--validsize",
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def train_input_args():\n # Create Parse using ArgumentParser\n parser = argparse.ArgumentParser()\n parser.add_argument('data_dir', type = str, help = 'Path to the data directory') \n parser.add_argument('--lr', type = float, default = 0.001, help = 'Learning rate (0.001)') \n parser.add_argument('... | [
"0.74579036",
"0.73165923",
"0.71720976",
"0.7104315",
"0.7057616",
"0.7005649",
"0.6994627",
"0.6975837",
"0.6941957",
"0.6941614",
"0.6932793",
"0.68698126",
"0.6863876",
"0.6838369",
"0.6809096",
"0.67670274",
"0.6765114",
"0.6761901",
"0.6759481",
"0.6748188",
"0.67410827... | 0.71800804 | 2 |
Checks if user is in the admin list | def user_is_admin(user):
return user in admins | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_admin(self, user):\n return user.name in self.admins",
"def isAdmin(self, user):\r\n if user.id in self.admins:\r\n return True\r\n return False",
"def is_admin(self,user):\n if user.is_superuser:\n return True\n\n if user.groups.filter(name=self.... | [
"0.8494697",
"0.8450611",
"0.80645573",
"0.80628574",
"0.79645",
"0.7924342",
"0.79058194",
"0.7835824",
"0.78353256",
"0.7813891",
"0.7758347",
"0.7756443",
"0.76932293",
"0.76697",
"0.7663411",
"0.76226515",
"0.7586803",
"0.75841236",
"0.75841236",
"0.75800085",
"0.75793755... | 0.8772071 | 0 |
Returns a materialized dictionary expanding any lazy data structures such as iterators, generators encountered. | async def materialize_walk(d) -> Tree:
return await _materialize_walk(d) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def infinitedict():\n return defaultdict(infinitedict)",
"def to_dict():\n\n @sinks\n def _dagpype_internal_fn_act(target):\n d = dict([])\n try:\n while True:\n e = (yield)\n d[e[0]] = e[1]\n except GeneratorExit:\n target.send(d)... | [
"0.6090513",
"0.5919386",
"0.5526984",
"0.54836416",
"0.5410459",
"0.5348379",
"0.5336904",
"0.53285587",
"0.5286844",
"0.5286844",
"0.5279834",
"0.5273195",
"0.52586377",
"0.52347636",
"0.5233799",
"0.52322394",
"0.5229622",
"0.5200389",
"0.51912916",
"0.5133406",
"0.5124990... | 0.0 | -1 |
Initialise the TRL from the weights of a fully connected layer | def init_from_linear(self, linear, unsqueezed_modes=None, **kwargs):
if unsqueezed_modes is not None:
if self.factorization != 'Tucker':
raise ValueError(f'unsqueezed_modes is only supported for factorization="tucker" but factorization is {self.factorization}.')
unsq... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self, layerNeurons, numberOfLayers, initialWeights = None, lowerBound = None, upperBound = None):\r\n \r\n # Ensure that there is at-least one input and one output layer in the network\r\n assert len(layerNeurons) > 1, \"At least one input layer and one output layer is... | [
"0.68506587",
"0.68409103",
"0.6802324",
"0.6598983",
"0.659757",
"0.6565847",
"0.6524492",
"0.6491744",
"0.6459459",
"0.6457066",
"0.6428255",
"0.64199334",
"0.64044523",
"0.63711214",
"0.6360963",
"0.63549894",
"0.63532937",
"0.63532937",
"0.63439846",
"0.63363737",
"0.6335... | 0.0 | -1 |
Decorates a view to authorize a user only if the view is called with pk equal to logged in user id | def same_user_from_request_required(function):
def wrapper(request, *args, **kwargs):
if int(request.user.id) == int(kwargs['pk']):
return function(request, *args, **kwargs)
else:
return HttpResponse("Your Jedi tricks don't work on me",
status=... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def require_auth(view):\n def wrapper(request, *args):\n \n if not request.session.get('user_id', False):\n return HttpResponseRedirect(\"/clanovi/login/\")\n \n return view(request, *args) \n return wrapper",
"def authorized_user(func):\n def decorator(requ... | [
"0.7133977",
"0.6858038",
"0.6843821",
"0.6735181",
"0.67215776",
"0.6642458",
"0.66327417",
"0.6590507",
"0.6524044",
"0.6501874",
"0.6493207",
"0.6493207",
"0.6493207",
"0.64803725",
"0.6466691",
"0.6466691",
"0.6448397",
"0.64408857",
"0.64318967",
"0.6428844",
"0.6427737"... | 0.63987035 | 24 |
Assert that the response status code returns 200. | def test_create_bucketlist_view_returns_200_status_code(self):
response = self.app.get('/create-bucketlist')
self.assertEqual(response.status_code, 200,
"should return a status code of 200") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def assert200(self, response):\n self.assertEqual(response.status_code, 200)",
"def test_status_code(self):\n self.assertEquals(self.response.status_code, 200)",
"def assertHttpOK(self, response):\r\n self.assertEqual(response.status_code, 200)",
"def assertHttpOK(self, resp):\r\n ... | [
"0.89377517",
"0.8730491",
"0.84653956",
"0.8310712",
"0.83013505",
"0.8283379",
"0.82346404",
"0.80876064",
"0.8037783",
"0.79832006",
"0.7977363",
"0.79274637",
"0.79039997",
"0.79039997",
"0.79039997",
"0.79039997",
"0.79039997",
"0.79039997",
"0.79039997",
"0.79039997",
"... | 0.0 | -1 |
Return the full path to the given fixure. If globs is not given, the base path will a directory tests/data defined relatively from the definition of the test layer. | def get_fixture(self, filename, globs=None):
if globs is None:
module = sys.modules[self.__class__.__module__]
base_path = os.path.join(os.path.dirname(module.__file__), 'tests')
else:
base_path = os.path.dirname(globs['__file__'])
return os.path.join(base_pat... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def path_finder(cls, *args):\n safe_test_data = os.path.join(\n os.path.dirname(__file__),\n '../tasks/tests/data')\n safe_test_data = os.path.abspath(safe_test_data)\n return os.path.join(safe_test_data, *args)",
"def get_test_path():\n path, name = os.path.split(__... | [
"0.66121197",
"0.63253796",
"0.620481",
"0.6166",
"0.6096984",
"0.6095494",
"0.6015214",
"0.5998965",
"0.59680676",
"0.59597933",
"0.5952659",
"0.5931706",
"0.5929602",
"0.58954847",
"0.5875756",
"0.5875756",
"0.5875756",
"0.5867941",
"0.58562183",
"0.5798839",
"0.57909465",
... | 0.67945415 | 0 |
Gets the name of the item to be used in the context. | def get_context_object_name(self, object_list):
if self.context_object_name:
return self.context_object_name
elif hasattr(object_list, 'model'):
return '{0}_list'.format(object_list.model._meta.model_name)
else:
return None | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_item_name(self):\n return self.__item_name",
"def getName(self,item):\n return item.s",
"def name(self):\n return self._get('name')",
"def get_name(self):\n if self.name != None: return self.name\n else: return self.get_name_from_items(self.items.values())",
"def name(sel... | [
"0.8442",
"0.8090095",
"0.7264774",
"0.7240659",
"0.7175606",
"0.71638006",
"0.7154122",
"0.7141963",
"0.7084736",
"0.7075561",
"0.7075561",
"0.7075561",
"0.7075561",
"0.7075561",
"0.7075561",
"0.7075561",
"0.7075561",
"0.7075561",
"0.7075561",
"0.7075561",
"0.7075561",
"0.... | 0.0 | -1 |
Returns the space for quering the objects. The return value must be an iterable and may be an instance of `QuerySet`. | def get_queryset(self):
if self.queryset is not None:
queryset = self.queryset
if isinstance(queryset, QuerySet):
queryset = queryset.all()
elif self.model is not None:
queryset = self.model._default_manager.all()
else:
msg = ('{cls... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def qs(self) -> MIZQuerySet:\n if isinstance(self, type):\n raise TypeError(\n f\"Calling qs() from class level is prohibited. Use {self.__name__}.objects instead.\"\n )\n # noinspection PyUnresolvedReferences\n return self._meta.model.objects.filter(pk=sel... | [
"0.6105383",
"0.575545",
"0.575152",
"0.5598119",
"0.55772763",
"0.54934835",
"0.54934835",
"0.54370016",
"0.5431241",
"0.54207414",
"0.5384874",
"0.53662217",
"0.5326013",
"0.5310153",
"0.52982074",
"0.52908236",
"0.52896035",
"0.52521443",
"0.52519524",
"0.52494663",
"0.523... | 0.0 | -1 |
Returns a list of template names to be used for the request. Must return a list. May not be called if render_to_response is overridden. | def get_template_names(self):
try:
names = super(ListView, self).get_template_names()
except ImproperlyConfigured:
# If template_name isn't specified, it's not a problem --
# we just start with an empty list.
names = []
# If the list is a queryset... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_template_names(self) -> List[str]:\n\n if self.template_name is None:\n raise Exception(\n \"TemplateResponseMixin requires either a\"\n \"definition of 'template_name' or a\"\n \"implementation of 'get_template_names()'\"\n )\n ... | [
"0.78204966",
"0.7709885",
"0.75552785",
"0.7244376",
"0.7204548",
"0.69828",
"0.6898361",
"0.680679",
"0.6706858",
"0.669722",
"0.66748166",
"0.6646198",
"0.6644671",
"0.6579406",
"0.6577195",
"0.65415764",
"0.65028125",
"0.64714754",
"0.6401633",
"0.63693744",
"0.63211006",... | 0.7169839 | 5 |
Computes the forward pass for an affine (fullyconnected) layer. The input x has shape (N, d_1, ..., d_k) and contains a minibatch of N examples, where each example x[i] has shape (d_1, ..., d_k). We will reshape each input into a vector of dimension D = d_1 ... d_k, and then transform it to an output vector of dimensio... | def affine_forward(x, w, b):
out = None
########################################################################
# TODO: Implement the affine forward pass. Store the result in out. #
# You will need to reshape the input into rows. #
#########################################... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def affine_forward(x, w, b):\n out = None\n \n # reshape the input into (N, d_1 *...* d_k)\n input_shape = x.shape\n prod = 1\n for i in range(1,len(input_shape)):\n prod *= input_shape[i]\n\n a = x.reshape(x.shape[0],prod)\n out = np.dot(a,w) + b\n \n cache = (x, w, b)\n re... | [
"0.69972765",
"0.6882795",
"0.66869867",
"0.6510486",
"0.65045667",
"0.6457311",
"0.64465374",
"0.6413484",
"0.6406099",
"0.63568974",
"0.63548344",
"0.6347612",
"0.63443136",
"0.63351524",
"0.63215196",
"0.6306697",
"0.62982553",
"0.62968725",
"0.6296499",
"0.629068",
"0.628... | 0.63028204 | 16 |
Computes the backward pass for an affine layer. | def affine_backward(dout, cache):
x, w, b = cache
dx, dw, db = None, None, None
########################################################################
# TODO: Implement the affine backward pass. #
# Hint: Don't forget to average the gradients dw and db #
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def affine_relu_backward(dout, cache):\n fc_cache, relu_cache = cache\n da = layers.relu_backward(dout, relu_cache)\n dx, dw, db = layers.affine_backward(da, fc_cache)\n return dx, dw, db",
"def affine_backward(dout, cache):\n x, w, b = cache\n dx, dw, db = None, None, None\n ###############... | [
"0.7519707",
"0.7515731",
"0.7311029",
"0.73021144",
"0.73021144",
"0.73021144",
"0.73021144",
"0.7179234",
"0.7174782",
"0.7173808",
"0.71676785",
"0.7131813",
"0.7109585",
"0.7098569",
"0.7085752",
"0.70688355",
"0.704585",
"0.70412534",
"0.69940144",
"0.6987464",
"0.698464... | 0.72440696 | 7 |
Return the actual location on disk. Create the parent folder if needed. | def get_disk_filepath(self, filename: str):
hash = hashlib.md5(filename.encode("utf-8")).hexdigest()[0:2]
file_location = self.collection_path / hash / filename
if filename not in self.mapping:
(self.collection_path / hash).mkdir(parents=True, exist_ok=True)
file_location... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _get_parent_path(self):\n return os.path.join(os.getcwd(), \"src\", \"data\", \"genes\")",
"def get_location(self):\n return os.path.dirname(self.filename)",
"def get_absolute_pathname(self):\n return os.path.join(settings.PRIVATE_STORAGE_ROOT, self.get_relative_pathname())",
"def ro... | [
"0.7436081",
"0.7052837",
"0.6780707",
"0.6734337",
"0.67049974",
"0.669804",
"0.66878754",
"0.66359234",
"0.66142046",
"0.66032624",
"0.65824735",
"0.6563445",
"0.65574586",
"0.6556306",
"0.6553439",
"0.6534524",
"0.65294075",
"0.6513861",
"0.648608",
"0.6480846",
"0.6469646... | 0.6569929 | 11 |
Decides the WN representation of the given pos in input | def __decide_pos(pos: str) -> str:
to_return = None
if pos == 'NOUN':
to_return = "n"
if pos == 'VERB':
to_return = 'v'
if pos == 'ADJ':
to_return = 'a'
if pos == 'ADV':
to_return = 'r'
return to_return | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _wnpos(pos: str) -> str:\n pos = pos.lower()\n wnpos = \"n\"\n\n if pos.startswith(\"j\"):\n wnpos = \"a\"\n elif pos[0] in ('n', 'r', 'v'):\n wnpos = pos[0]\n\n return wnpos",
"def get_wordnet_pos(pos):\n if pos[0] == 'J':\n return nltk.corpus.wordnet.ADJ\n elif pos... | [
"0.7073301",
"0.64950913",
"0.64905983",
"0.61112255",
"0.6007476",
"0.59900284",
"0.59670055",
"0.5933512",
"0.5933512",
"0.5894326",
"0.58795136",
"0.5866664",
"0.58627313",
"0.5799753",
"0.57954293",
"0.5793043",
"0.579064",
"0.57545334",
"0.5499346",
"0.54548335",
"0.5444... | 0.55873215 | 18 |
Return the class of this device, from component DEVICE_CLASSES. | def device_class(self):
if self.sensor_class in DEVICE_CLASSES:
return self.sensor_class
return None | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def device_class(self):\n return DEVICE_CLASSES.get(self.sensor_data[\"model\"])",
"def device_class(self):\n return self.sensor_type[\"class\"]",
"def device_class(self):\n return SENSOR_TYPES[self.sensor][3].get(\"device_class\")",
"def get_class(self):\n return devices.get_clas... | [
"0.87289727",
"0.8523683",
"0.8474236",
"0.8445261",
"0.8314018",
"0.8310586",
"0.8244905",
"0.8244905",
"0.8244905",
"0.8244905",
"0.8244905",
"0.8201372",
"0.81974167",
"0.8112704",
"0.8112704",
"0.8112704",
"0.8061974",
"0.80567896",
"0.80567896",
"0.80387646",
"0.80387646... | 0.8127681 | 13 |
Return the unit_of_measurement of the device. | def unit_of_measurement(self):
if self.api_unit in TEMPERATURE_UNITS:
return self.hass.config.units.temperature_unit
if self.api_unit in LENGTH_UNITS:
return self.hass.config.units.length_unit
if self.api_unit in PRESSURE_UNITS:
if self.hass.config.units == ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def unit_of_measurement(self):\n return self.device.unit()",
"def unit_of_measurement(self):\n return DEVICE_MAP[self._sensor_type][DEVICE_MAP_INDEX.index('UNIT_OF_MEASURE_INDEX')]",
"def unit_of_measurement(self):\n return self._unit_of_measurement",
"def unit_of_measurement(self):\n ... | [
"0.9185088",
"0.8927251",
"0.88508546",
"0.88508546",
"0.88508546",
"0.88508546",
"0.88508546",
"0.88508546",
"0.88508546",
"0.88508546",
"0.88508546",
"0.88508546",
"0.88508546",
"0.88508546",
"0.88508546",
"0.88508546",
"0.88275945",
"0.88275945",
"0.88275945",
"0.88275945",
... | 0.8299461 | 52 |
Initialize New instance of Doubley LinkedList. | def __init__(self, values=[]):
self.values = values
self.head = None
for i in values:
self.insert(i) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self):\n self.new_dll = DLinkedList()",
"def __init__(self):\n self._head = self._Node(None, None, None)\n self._tail = self._Node(None, None, None)\n self._head._next = self._tail\n self._tail._prev = self._head\n self._size = 0",
"def __init__(self):\n ... | [
"0.75934005",
"0.7433358",
"0.7355797",
"0.7292677",
"0.7241564",
"0.71299875",
"0.7110084",
"0.7110084",
"0.7090159",
"0.7066542",
"0.7061874",
"0.7059265",
"0.7056815",
"0.7056815",
"0.7056815",
"0.7053873",
"0.70494235",
"0.7023703",
"0.7017982",
"0.693907",
"0.6919723",
... | 0.0 | -1 |
Insert Node at the front (head) of list. | def insert(self, val):
inserted_node = DblNode(val, self.head)
if not self.head:
self.head = inserted_node
self.tail = self.head
self.head.previous_node = inserted_node
self.head = inserted_node | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def push_front(self, item):\n new_node = Node(item)\n # if the list is empty, make it head\n if self.head is None:\n self.head = new_node\n # else, \n else:\n new_node.next = self.head # new node points to current head\n self.head = new_node # c... | [
"0.8005742",
"0.7940719",
"0.7797293",
"0.7745895",
"0.77079684",
"0.76502913",
"0.7628681",
"0.76244575",
"0.75704974",
"0.7485009",
"0.74587184",
"0.74257016",
"0.74080586",
"0.74008936",
"0.74008936",
"0.73588365",
"0.7349039",
"0.734704",
"0.7277037",
"0.727224",
"0.72675... | 0.0 | -1 |
Append New node to back (tail) of list. | def append(self, val):
inserted_node = DblNode(val, previous_node=self.tail)
self.tail.next_node = inserted_node
self.tail = inserted_node | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_last(self, data):\n # if list empty set head and tail as the new Node\n if self.head is None:\n self.tail = Node(data, next=None)\n self.head = self.tail\n # else set new tail\n else:\n self.tail.next = Node(data, next=None)\n # set th... | [
"0.76262003",
"0.7570407",
"0.7516316",
"0.7402172",
"0.7394703",
"0.7390978",
"0.7355949",
"0.7323749",
"0.72288865",
"0.7193583",
"0.7180527",
"0.71547085",
"0.71338177",
"0.7097585",
"0.7096302",
"0.7092449",
"0.7083041",
"0.70740205",
"0.7054107",
"0.7032983",
"0.7024413"... | 0.67580664 | 42 |
Returns the filtered queryset based on the value provided in the query string and retrievable via `self.value()`. | def queryset(self, request, queryset):
# Compare the requested value to decide how to filter the queryset.
if self.value():
return queryset.filter(parent_id=self.value())
return queryset | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def queryset(self, request, queryset):\n # Compare the requested value (either '80s' or 'other')\n # to decide how to filter the queryset.\n\n if self.value() is None:\n return queryset.all()\n\n return queryset.filter(firm__pk=self.value())",
"def queryset(self, request, q... | [
"0.75404286",
"0.7420034",
"0.7245536",
"0.708915",
"0.70489717",
"0.6976245",
"0.678279",
"0.67624646",
"0.6733829",
"0.668175",
"0.66564417",
"0.65890294",
"0.64709556",
"0.64156187",
"0.6402686",
"0.63832724",
"0.63695264",
"0.6350035",
"0.6349002",
"0.6277698",
"0.626799"... | 0.7204446 | 3 |
Computes distance between two centroids of the two clusters | def clusters_distance_2(cluster1, cluster2):
cluster1_center = np.average(cluster1, axis=0)
cluster2_center = np.average(cluster2, axis=0)
return euclidean_distance(cluster1_center, cluster2_center) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def clusters_distance(cluster1, cluster2):\n return max([euclidean_distance(point1, point2) for point1 in cluster1 for point2 in cluster2])",
"def distance(self, other_cluster):\n vert_dist = self._vert_center - other_cluster.vert_center()\n horiz_dist = self._horiz_center - other_cluster.horiz_... | [
"0.7310566",
"0.7258045",
"0.7258045",
"0.71738297",
"0.71623534",
"0.7135081",
"0.70555",
"0.7042646",
"0.69963205",
"0.6981462",
"0.6940565",
"0.693678",
"0.6925025",
"0.6800658",
"0.67993",
"0.6771275",
"0.6751644",
"0.6745831",
"0.67043865",
"0.6693395",
"0.66875255",
"... | 0.7988231 | 0 |
Checks if a matrix is a valid rotation matrix. | def isRotationMatrix(self, R):
Rt = np.transpose(R)
shouldBeIdentity = np.dot(Rt, R)
I = np.identity(3, dtype=R.dtype)
n = np.linalg.norm(I - shouldBeIdentity)
return n < 1e-6 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _is_rotation_matrix(self, R):\n Rt = np.transpose(R)\n shouldBeIdentity = np.dot(Rt, R)\n I = np.identity(3, dtype=R.dtype)\n n = np.linalg.norm(I - shouldBeIdentity)\n return n < 1e-6",
"def test_asssert_rotation_matrix_behaves_like_check_matrix():\n random_state = np.r... | [
"0.7960429",
"0.7166615",
"0.70802134",
"0.6615904",
"0.6538403",
"0.644409",
"0.6418667",
"0.63442963",
"0.6342512",
"0.6131638",
"0.60541475",
"0.60499966",
"0.6029731",
"0.60089195",
"0.5942668",
"0.5904241",
"0.5898044",
"0.5891571",
"0.5887549",
"0.58872104",
"0.58841914... | 0.7662198 | 1 |
Shortcut to access the current logged in user. Unlike user_info, it fetches information from the persistence layer and returns an instance of the underlying model. | def user(self):
u = self.user_info
return self.user_model.get_by_id(u['user_id']) if u else None | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def user(self):\n u = self.user_info\n return self.user_model.get_by_id(u['user_id']) if u else None",
"def current_user(self):\n user_dict = self.auth.get_user_by_session()\n return self.auth.store.user_model.get_by_id(user_dict['user_id'])",
"def current_user(self):\n user_dict = s... | [
"0.797634",
"0.79030204",
"0.78945374",
"0.7855224",
"0.77607036",
"0.7666942",
"0.76651853",
"0.76651853",
"0.7587182",
"0.7555845",
"0.7543986",
"0.74880344",
"0.7452394",
"0.74505",
"0.7432915",
"0.7432915",
"0.7432915",
"0.7371964",
"0.7364711",
"0.7360742",
"0.73504144",... | 0.80112857 | 0 |
Returns a perdimension upper bound on the maximum number of elements in each dimension. This bound will be tight in the case of Range. | def bounding_box_size(self):
return self.subset.bounding_box_size() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getUpperBound(self) -> int:\n return self.upper_bound",
"def atmax(a,upperlimit,dimension=None,inclusive=1):\r\n if inclusive: upperfcn = N.less\r\n else: upperfcn = N.less_equal\r\n if dimension == None:\r\n a = N.ravel(a)\r\n dimension = 0\r\n if... | [
"0.71498823",
"0.6992809",
"0.6908907",
"0.6880611",
"0.67877877",
"0.67159796",
"0.65966725",
"0.65128165",
"0.64278924",
"0.63315374",
"0.63197035",
"0.6238459",
"0.6222114",
"0.62128",
"0.61576295",
"0.6121988",
"0.6103346",
"0.60954607",
"0.6082084",
"0.6080677",
"0.60801... | 0.0 | -1 |
The calib2tensor3() function reads the latest calibration tensor for component from dirname. Any obsoleted calibration data is ignored. The function returns the tensor as a numpy array on successful completion. dirname Directory with calibration information component Kind of calibration data sought Tensor as numpy arra... | def calib2tensor3(dirname, component):
basename = "*-end.data"
path = glob.glob(os.path.join(dirname, component, basename))[-1]
stream = open(path, "r")
T = fread_tensor3(stream)
stream.close()
return (T) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def fread_tensor3(stream):\n\n T = fread_matrix(stream)\n while (True):\n A = fread_matrix(stream)\n if (len(A.shape) < 2 or A.shape[0] == 0 or A.shape[1] == 0):\n return (T)\n T = numpy.dstack((T, A))",
"def path_to_tensor(img_path, dim):\n\n # Load RGB image\n img = image.load_img(img_pat... | [
"0.5093657",
"0.50654936",
"0.5017846",
"0.4963175",
"0.48124826",
"0.47995463",
"0.47940272",
"0.4753241",
"0.47508976",
"0.47188634",
"0.46663633",
"0.466279",
"0.4644044",
"0.46214908",
"0.4607633",
"0.4599764",
"0.45964962",
"0.4586136",
"0.45718667",
"0.4557085",
"0.4555... | 0.82074106 | 0 |
Returns true if both objects are equal | def __eq__(self, other):
if not isinstance(other, TriggerHistories):
return False
return self.__dict__ == other.__dict__ | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __eq__(self, other):\n return are_equal(self, other)",
"def __eq__(self, other):\n return are_equal(self, other)",
"def __eq__(self,other):\n try: return self.object==other.object and isinstance(self,type(other))\n except: return False",
"def __eq__(self, other):\n if i... | [
"0.80885184",
"0.80885184",
"0.805514",
"0.7983044",
"0.7966715",
"0.7966715",
"0.7966715",
"0.7966715",
"0.7966715",
"0.7966715",
"0.7966715",
"0.7966715",
"0.7966715",
"0.7966715",
"0.7966715",
"0.7966715",
"0.7966715",
"0.7966715",
"0.7966715",
"0.7966715",
"0.7966715",
... | 0.0 | -1 |
Returns true if both objects are not equal | def __ne__(self, other):
return not self == other | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __ne__(self, other: object) -> bool:\n if self.__eq__(other):\n return False\n return True",
"def __ne__(self, other: object) -> bool:\n return not self.__eq__(other)",
"def __ne__(self, other) -> bool:\n return not self.__eq__(other)",
"def __eq__(self, other):\n ... | [
"0.8457179",
"0.8393067",
"0.81457263",
"0.8140635",
"0.8133462",
"0.8094992",
"0.8093376",
"0.8093376",
"0.8093376",
"0.80863357",
"0.80863357",
"0.8077303",
"0.8077303",
"0.8066831"
] | 0.0 | -1 |
Load config from yml/yaml file. | def load_config(file_path):
_, ext = os.path.splitext(file_path)
assert ext in [".yml", ".yaml"], "only support yaml files for now"
config = yaml.load(open(file_path, "rb"), Loader=yaml.Loader)
return config | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def load_yaml(cls, file=None):\n if file is None: file = f'{rcp.base_path}cfg.yml'\n try:\n with open(file, 'r') as f:\n config = yaml.load(f, Loader=yaml.FullLoader)\n cfg.__dict__ = config\n return cfg\n except FileNotFoundError:\n p... | [
"0.81704307",
"0.8075309",
"0.805607",
"0.79552233",
"0.79525894",
"0.7916906",
"0.7915729",
"0.7892829",
"0.78918004",
"0.7878357",
"0.7877337",
"0.78658396",
"0.78599226",
"0.77962315",
"0.7775746",
"0.77709365",
"0.7709628",
"0.7691351",
"0.76495796",
"0.7614803",
"0.76041... | 0.7899959 | 7 |
If the module is imported, but the function isn't found, raise ImproperlyConfigured. | def test_missing_attribute(self):
with self.assertRaises(ImproperlyConfigured):
import_from_setting('TEST_SETTING') | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_error_importing(self):\n with self.assertRaises(ImproperlyConfigured):\n import_from_setting('TEST_SETTING')",
"def setup_required(func):\n @functools.wraps(func)\n def decorated_function(*args, **kwargs):\n config = get_user_config()\n if not config.isConfigured:\n raise ... | [
"0.62123185",
"0.59798896",
"0.5965007",
"0.5917278",
"0.58833075",
"0.5874552",
"0.5852225",
"0.57792634",
"0.5671392",
"0.5671392",
"0.5671392",
"0.5671392",
"0.5671392",
"0.5671392",
"0.5671392",
"0.5671392",
"0.5671392",
"0.5671392",
"0.56201917",
"0.5591923",
"0.5555886"... | 0.54572904 | 29 |
Initialize attributes to describe a car. | def __init__(self, make, model, year):
self.make = make
self.model = model
self.year = year
self.odometer_reading = 0 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self, car):\n super(self.__class__, self).__init__(car)\n self.coordinator_name = car.get_faulty_coordinator_name()\n self.second_at_charge_name = car.get_second_at_charge_name()\n self.coordinated_car_name = car.get_corrected_coordinated_car_name()\n self.following_... | [
"0.7499686",
"0.7396383",
"0.6962899",
"0.6956803",
"0.6860313",
"0.67147094",
"0.6583875",
"0.6583875",
"0.6583875",
"0.6454434",
"0.64485174",
"0.64399266",
"0.64343643",
"0.63747996",
"0.63059205",
"0.62482935",
"0.6208004",
"0.6172982",
"0.6161259",
"0.6137115",
"0.609972... | 0.5513055 | 84 |
Initialize the battery's attributes | def __init__(self, battery_size=75): #Note that battery_size is optional parameter if no value is provided.
self.battery_size = battery_size | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self, battery_size=70):\r\n\t\tself.battery_size = battery_size",
"def __init__(self, battery_size=40):\n self.battery_size = battery_size",
"def __init__(self, battery_size=70):\n self.battery_size = battery_size",
"def __init__(self, battery_size=70):\n self.battery_size =... | [
"0.75609815",
"0.7558373",
"0.75359666",
"0.75359666",
"0.75359666",
"0.75147897",
"0.75147897",
"0.74909526",
"0.74409395",
"0.73824",
"0.73655254",
"0.7354131",
"0.72093326",
"0.7162848",
"0.7148631",
"0.7071691",
"0.7071691",
"0.7071691",
"0.7071691",
"0.7071691",
"0.70716... | 0.7425672 | 9 |
Helper method to get the input. Returns None if the input is blank. Only works after validation has been called (or during validation). | def input(self, name):
try:
_input = self.params[name]
try:
_input = _input.strip()
except AttributeError:
pass
if _input == '':
return None
return _input
except KeyError:
return None | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def input(self) -> Optional[pulumi.Input[str]]:\n return pulumi.get(self, \"input\")",
"def _get_input(self):\n return self.__input",
"def _get_input(self):\n return self.__input",
"def _get_input(self):\n return self.__input",
"def _get_input(self):\n return self.__input",
"def _get_i... | [
"0.73642397",
"0.7015761",
"0.7015761",
"0.7015761",
"0.7015761",
"0.7015761",
"0.7015761",
"0.7015761",
"0.6834297",
"0.6797506",
"0.6720261",
"0.66409856",
"0.6634798",
"0.66195714",
"0.66090995",
"0.6423062",
"0.6419021",
"0.6419021",
"0.6201756",
"0.61889565",
"0.6179135"... | 0.73535395 | 1 |
Function will convert corpus from dataframe to list of list type. | def convert_corpus_to_list(text_corpus):
text_corpus = text_corpus.values.tolist()
return text_corpus | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_corpus(df):\r\n corpus=[]\r\n for tweet in tqdm(df['text']):\r\n words=[word.lower() for word in word_tokenize(tweet) if((word.isalpha()==1))]\r\n corpus.append(words)\r\n return corpus",
"def preprocess_corpus(self) -> List[str]:\n return self.tidy_text(self.corpus)",
... | [
"0.699034",
"0.6622751",
"0.6506755",
"0.6441838",
"0.6431281",
"0.62726605",
"0.6147414",
"0.6093569",
"0.6010218",
"0.58919144",
"0.58714783",
"0.58310324",
"0.58197397",
"0.579851",
"0.5691958",
"0.5691012",
"0.5661742",
"0.5635563",
"0.5619211",
"0.5580112",
"0.5543303",
... | 0.783059 | 0 |
Function will remove stopwords from text_vector. | def stopwords_removal(text_vector):
text_vector = [
i for i in text_vector if i not in stopwords.words('english')]
return text_vector | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def remove_stopwords(text):\n tokens = word_tokenize(text)\n filtered = [word for word in tokens if word not in stop_words]\n filtered = ' '.join(filtered)\n return filtered",
"def remove_stopwords(self,text):\n return \" \".join([word for word in str(text).split() if word not in self.STOPWORD... | [
"0.81403863",
"0.7955697",
"0.79302275",
"0.7919006",
"0.77835304",
"0.7701399",
"0.76843077",
"0.7681525",
"0.7649502",
"0.7640225",
"0.7617904",
"0.7552229",
"0.7543865",
"0.7538448",
"0.75344193",
"0.7505655",
"0.74821454",
"0.7475759",
"0.7459693",
"0.7441028",
"0.7441028... | 0.89113796 | 0 |
Function will remove the stopwords from the corpus. | def stopword_removal_on_corpus(text_corpus):
text_corpus[text_column_name] = text_corpus[
text_column_name].apply(stopwords_removal)
return text_corpus | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def remove_stopwords_fun(self):\n tokens = str(self.doc).split()\n cleaned_tokens = [token for token in tokens\n if token.lower() not in self.stopword_list]\n self.doc = ' '.join(cleaned_tokens)",
"def remove_stop_words(document):\n\n stop_words = stopwords.words(... | [
"0.8324709",
"0.79654366",
"0.79353225",
"0.78555036",
"0.7809628",
"0.774373",
"0.7724586",
"0.77146417",
"0.7705972",
"0.7705972",
"0.7705972",
"0.7705972",
"0.7704295",
"0.76425266",
"0.76400095",
"0.76344293",
"0.75929016",
"0.7589718",
"0.75679004",
"0.75655764",
"0.7562... | 0.78241765 | 4 |
Create a runner with app.test_cli_runner() using app fixture, that can call the Click commands registered with the application. | def runner(app):
return app.test_cli_runner() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def runner(app):\n return app.test_cli_runner()",
"def runner(app):\n return app.test_cli_runner()",
"def runner(app):\n return app.test_cli_runner()",
"def runner() -> CliRunner:\n return click.testing.CliRunner()",
"def cli_runner(app):\n\n LOG.info(\"cli_runner.app: %s\", app)\n cli_ru... | [
"0.80377024",
"0.80377024",
"0.80377024",
"0.78357697",
"0.7336881",
"0.72990376",
"0.6906018",
"0.66988564",
"0.66988564",
"0.6418123",
"0.6334785",
"0.6270316",
"0.6129748",
"0.5970172",
"0.59150714",
"0.5887292",
"0.58839417",
"0.58791625",
"0.5862269",
"0.58616346",
"0.58... | 0.80403256 | 0 |
Return a list of legal mining actions (that only involve mining and not moving). | def _get_mine_actions(self):
rtn = []
dont_mine = {_AIR, _WATER, _LAVA}
# Mine above.
pos_above = self._pos + _Vec3(0, 2, 0)
if self._get_block(pos_above) not in dont_mine:
rtn.append({
'func': '_mine',
'args': (pos_above,)
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _get_legal_actions(self):\n return self.game.get_legal_actions()",
"def get_legal_actions(self, block_=None):\n return self._get_move_actions(block_) + self._get_mine_actions() + \\\n self._get_placement_actions(block_)",
"def get_legal_actions(self):\n pass",
"def _get_le... | [
"0.7372245",
"0.732221",
"0.7313284",
"0.71597576",
"0.7126538",
"0.699715",
"0.69075394",
"0.683734",
"0.6808555",
"0.67633706",
"0.66503125",
"0.6590095",
"0.65778744",
"0.65741384",
"0.6517203",
"0.649064",
"0.6477651",
"0.6447449",
"0.6418335",
"0.6410253",
"0.6409805",
... | 0.6846609 | 7 |
Return whether or not the bot can place a block at that location independent of what it has in its inventory. | def _can_place(self, loc):
non_blocks = [_AIR, _WATER, _LAVA]
player = [self._pos, self._pos + _Vec3(0, 1, 0)]
for dir_ in _adj_dirs + [_Vec3(0, 1, 0), _Vec3(0, -1, 0)]:
new_loc = loc + dir_
if new_loc not in player and self._get_block(new_loc) \
not i... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _has_blocks_to_place(self, exclude=None):\n for block_ in self._inventory:\n if block_ != exclude:\n return True\n return False",
"def contains(self, loc):\n if loc.isLeft(self.topLeft): return False\n if loc.isRight(self.botRight): return False\n ... | [
"0.67402387",
"0.64904577",
"0.64742357",
"0.63460064",
"0.6191605",
"0.6168658",
"0.61179215",
"0.6091611",
"0.6091611",
"0.6086086",
"0.6059319",
"0.6040318",
"0.6030606",
"0.60108405",
"0.5985022",
"0.59669167",
"0.59460306",
"0.5855408",
"0.5839271",
"0.58160174",
"0.5806... | 0.7600124 | 0 |
Return the location of the block. | def _get_block_loc(self, block_id):
find_prob = FindProblem(self._pos, block_id)
dirs = bfs(find_prob)
return self._pos + sum(dirs) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_block_loc(self):\n return deepcopy(self._block_loc)",
"def _get_xblock_loc(self):\n return str(self.location).split('@')[-1]",
"def get_block(self):\n return Gumtree.gumtree.getBlock()",
"def location(self):\r\n if not hasattr(self, '_loc'):\r\n self._loc = conf... | [
"0.8025761",
"0.7139364",
"0.7097931",
"0.7021613",
"0.7016894",
"0.6929849",
"0.68666357",
"0.6858844",
"0.67996484",
"0.67234784",
"0.66733414",
"0.66686624",
"0.6641708",
"0.66294825",
"0.66294825",
"0.6626714",
"0.6620962",
"0.6610229",
"0.6598291",
"0.65973485",
"0.65767... | 0.72970724 | 1 |
Return the block location. | def get_block_loc(self):
return deepcopy(self._block_loc) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _get_xblock_loc(self):\n return str(self.location).split('@')[-1]",
"def _get_block_loc(self, block_id):\n find_prob = FindProblem(self._pos, block_id)\n dirs = bfs(find_prob)\n return self._pos + sum(dirs)",
"def get_location(self):\n\t\treturn self.location",
"def get_locati... | [
"0.7454769",
"0.7220945",
"0.7134207",
"0.70886534",
"0.7013285",
"0.7009",
"0.6997062",
"0.69218934",
"0.6888594",
"0.6850154",
"0.6810005",
"0.6810005",
"0.6810005",
"0.67957693",
"0.67957693",
"0.676836",
"0.6755234",
"0.67155397",
"0.66995835",
"0.6698009",
"0.6685012",
... | 0.8022522 | 0 |
Return the player location. | def get_player_loc(self):
return deepcopy(self._player_loc) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_player_location(self):\n return self.player.location",
"def _player_loc():\n return _to_my_vec3(_get_mc().player.getTilePos())",
"def my_location(state):\n return state['gladiators'][state['current_player']]['pos']",
"def get_location(self):\n\t\treturn self.location",
"def get_locatio... | [
"0.940299",
"0.83086497",
"0.78003746",
"0.7700541",
"0.76502836",
"0.75900316",
"0.7576151",
"0.74968773",
"0.7440866",
"0.7264581",
"0.7224984",
"0.72223294",
"0.7185377",
"0.71543133",
"0.71543133",
"0.71543133",
"0.71543133",
"0.71543133",
"0.71543133",
"0.71543133",
"0.7... | 0.7689073 | 4 |
Return the mining heuristic. bot is an _ImaginaryBot. | def _mine_heuristic(bot, problem):
if bot.contains(problem.get_block_id()):
return 0
bot_pos = bot.get_pos()
dest_pos = problem.get_block_loc()
# If man == dy: return man + 1
# If man > dy: return man
# If man < dy: return dy?
man_dist = _manhattan((bot_pos.x, bot_pos.z), (dest_pos... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_heuristic(self):\n return self._heuristic",
"def _return_heuristic(bot, problem):\n bot_pos = bot.get_pos()\n player_pos = problem.get_player_loc()\n bot_plane_pos = (bot.x, bot.z)\n\n y_diff = bot_pos.y - player_pos.y\n\n drop = _DROP if y_diff > 0 else 1\n y_diff = abs(y_diff)\... | [
"0.66870767",
"0.66380966",
"0.6383091",
"0.6321459",
"0.6278286",
"0.6246109",
"0.5942044",
"0.5927803",
"0.5920244",
"0.59188855",
"0.5909226",
"0.5888236",
"0.5827928",
"0.5811517",
"0.5806053",
"0.5729955",
"0.57151765",
"0.5644821",
"0.5640471",
"0.55929893",
"0.55426335... | 0.5678521 | 17 |
Return the player's location. | def _player_loc():
return _to_my_vec3(_get_mc().player.getTilePos()) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_player_location(self):\n return self.player.location",
"def my_location(state):\n return state['gladiators'][state['current_player']]['pos']",
"def get_location(self):\n\t\treturn self.location",
"def get_location(self):\n return self.location",
"def get_player_loc(self):\n ... | [
"0.9377155",
"0.7869352",
"0.7720662",
"0.76937264",
"0.7692787",
"0.7643892",
"0.76340455",
"0.7480468",
"0.74407315",
"0.7373182",
"0.72941035",
"0.72834784",
"0.7213151",
"0.72030866",
"0.712011",
"0.712011",
"0.7117609",
"0.7117609",
"0.7117609",
"0.7117609",
"0.7117609",... | 0.82694536 | 1 |
A bad input file > raise ConnectomistBadFileError. | def test_badfileerror_raise(self, mock_path):
# Set the mocked functions returned values
mock_path.isfile.side_effect = [False, True, True, True, True]
# Test execution
self.assertRaises(ConnectomistBadFileError, dwi_local_modeling,
**self.kwargs) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_valid_file_raises():\n with pytest.raises(ValueError):\n cli._valid_file(__file__)",
"def test_readbadformat(self):\n\n self.assertRaises(ParseError, self.hw, self.badfile)",
"def test_handle__bad_file(self):\n self.assertRaises(\n CommandError,\n ... | [
"0.6809363",
"0.68079185",
"0.6577426",
"0.6529052",
"0.6471954",
"0.6387992",
"0.63501537",
"0.632845",
"0.6320288",
"0.630515",
"0.63046706",
"0.62566084",
"0.62461776",
"0.62461776",
"0.62445587",
"0.6219725",
"0.61836076",
"0.61783695",
"0.6174595",
"0.61732185",
"0.61599... | 0.6321605 | 8 |
Calculate the probability of a light curve to be variable and the excess variance. | def var_parameters(jd,mag,err):
mean = np.mean(mag)
nepochs = float(len(jd))
chi = np.sum( (mag - mean)**2. / err**2. )
p_chi = chi2.cdf(chi,(nepochs-1))
a = (mag-mean)**2
ex_var = (np.sum(a-err**2)/((nepochs*(mean**2))))
sd = np.sqrt((1./(nepochs-1))*np.sum(((a-err**2)-ex_var*(mean**2))... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def variance(self):\n return 1 / self.count() * sum((number-self.average())**2 for number in self.numbers)",
"def _derive_variance_(self):\n # Pure Photon Noise\n self._properties[\"var\"] = np.sqrt(self.rawdata*self.exposuretime) / self.exposuretime",
"def calculate_variance(n, p):\n r... | [
"0.6694544",
"0.6577316",
"0.655774",
"0.6489866",
"0.6436287",
"0.6417101",
"0.640885",
"0.63948274",
"0.6383556",
"0.6381857",
"0.63805944",
"0.6363977",
"0.6322661",
"0.62295526",
"0.62219024",
"0.61889213",
"0.61786276",
"0.6134899",
"0.6130089",
"0.6077877",
"0.60338676"... | 0.0 | -1 |
negative value of the likelihood, to perfor maximization using the minimize function | def neg_lnlike(theta, dtarray, dmagarray, sigmaarray):
return(-1.0*lnlike(theta, dtarray, dmagarray, sigmaarray)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def minimize_neg_lbl(self):\n if self.spatial_only:\n init_index = 0 # anything should work here\n else:\n init_index = np.mean((self.energy_likelihood._min_index,\n self.energy_likelihood._max_index))\n \n ... | [
"0.6684263",
"0.6584015",
"0.6557697",
"0.63962555",
"0.6339496",
"0.63338804",
"0.63103855",
"0.62878",
"0.6258153",
"0.624534",
"0.6158027",
"0.61535037",
"0.6133659",
"0.6102288",
"0.60974306",
"0.60815144",
"0.6064348",
"0.6057554",
"0.6050042",
"0.603683",
"0.6035186",
... | 0.0 | -1 |
Test the email for a new user is normalized | def test_new_user_normalized(self):
email = 'test@NXKSJDK>COM'
user = get_user_model().objects.create_user(
email=email,
password='zbmznzss'
)
self.assertEqual(user.email, email.lower()) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_new_user_email_normalized(self):\n email = 'test@GOOGLE.COM'\n user = get_user_model().objects.create_user(email, '212ds')\n\n self.assertEqual(user.email, email.lower())",
"def test_new_email_normalised(self):\n\n email = \"test@RANDOMEMAIL.org\"\n user = get_user_mod... | [
"0.79984254",
"0.7997281",
"0.79201037",
"0.78920823",
"0.78920823",
"0.78920823",
"0.7871696",
"0.78619236",
"0.785927",
"0.7858499",
"0.7853585",
"0.7844939",
"0.7773778",
"0.7771046",
"0.7745209",
"0.7744957",
"0.7702127",
"0.75698525",
"0.74174696",
"0.7257744",
"0.714764... | 0.75344014 | 18 |
Test creating user with no email raises error | def test_new_user_invalid_email(self):
with self.assertRaises(ValueError):
get_user_model().objects.create_user(None, 'test1234') | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_private_create_user_without_email(self):\n with pytest.raises(ValueError) as exinfo:\n EmailUser.objects._create_user(None, None, False, False)\n self.assertIn('email must be set', str(exinfo.value))",
"def test_creating_a_new_user_without_email(self):\n\n with self.asser... | [
"0.90316164",
"0.89628595",
"0.8736244",
"0.87360644",
"0.8725108",
"0.8717065",
"0.87141234",
"0.87141234",
"0.87141234",
"0.87141234",
"0.87141234",
"0.8704795",
"0.8700351",
"0.86953294",
"0.868995",
"0.868059",
"0.8670541",
"0.85970515",
"0.85921985",
"0.85869586",
"0.855... | 0.87026894 | 12 |
Return the normalized ptoq perplexity. | def perplexity(p: np.ndarray, q: np.ndarray, eps: float = 1e-10) -> List[float]:
kl_div_pq = kl_div(p, q, eps)[0]
perplexity_pq = np.exp(-kl_div_pq)
return [perplexity_pq] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def perplexity(self):\n raise NotImplementedError(\"To be implemented\")",
"def perplexity(self):\n\n\t\treturn samplers_lda.perplexity_comp(self.docid,self.tokens,self.tt,self.dt,self.N,self.K,self.samples)",
"def perplexity(self):\n\n\t\treturn samplers_lda.perplexity_comp(self.docid,self.tokens,self.... | [
"0.72708213",
"0.6601539",
"0.6601539",
"0.6414812",
"0.61556983",
"0.60456693",
"0.60011685",
"0.59922504",
"0.5979123",
"0.59789044",
"0.5978826",
"0.59635854",
"0.5942892",
"0.592865",
"0.5903796",
"0.58989954",
"0.58989954",
"0.58743584",
"0.58688813",
"0.58494806",
"0.58... | 0.64187413 | 3 |
Return the cross entropy from a distribution p to a distribution q. | def cross_entropy(p: np.ndarray, q: np.ndarray, eps: float = 1e-10) -> float:
p = np.asarray(p)
q = np.asarray(q)
if p.ndim > 2 or q.ndim > 2:
raise ValueError(
f"Not obvious how to reshape arrays: got shapes {p.shape} and {q.shape}."
)
elif (p.ndim == 2 and p.shape[0] > 1) o... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def cross_entropy(p, q, base=2):\n q = ma.array(q, mask=(q == 0))\n return - np.vdot(p, ma.log(q)) / np.log(base)",
"def crossEntropy(p_m1):\n p_m2 = 1 - p_m1\n D = - p_m1*math.log(p_m1) - p_m2*math.log(p_m2)\n return D",
"def cross_entropy(y_observed, p):\n\n pass",
"def relative_entropy(P... | [
"0.76480114",
"0.7216248",
"0.70279425",
"0.66920954",
"0.6645409",
"0.6548334",
"0.6468836",
"0.6455908",
"0.64281404",
"0.6385125",
"0.6373695",
"0.63714",
"0.6359264",
"0.63197803",
"0.6267375",
"0.6261805",
"0.6229502",
"0.62076503",
"0.61105174",
"0.60765547",
"0.6064091... | 0.75772566 | 1 |
Return a single boolean mask and a silhouette score ceiling for each class | def class_majority_mask(
activations,
class_ids,
majority_ceilings: Optional[Dict[int, float]] = None,
random_state: int = 42,
):
full_majority_mask = np.empty(len(activations), dtype=bool)
if majority_ceilings is None:
majority_ceilings = {}
for class_id in np.unique(class_ids):
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def compute_mask_class(y_true: Tensor):\n y_true = y_true.detach().cpu()\n batch_size = y_true.size(0)\n num_classes = y_true.size(1)\n if num_classes == 1:\n y_true = y_true.view(batch_size, -1)\n elif num_classes == 2:\n y_true = y_true[:, 1, ...].contiguous().view(batch_size, -1) #... | [
"0.6539132",
"0.6507482",
"0.6070667",
"0.6066459",
"0.591608",
"0.5797496",
"0.5796534",
"0.5793637",
"0.5736963",
"0.5734178",
"0.56735015",
"0.56735015",
"0.56735015",
"0.5634717",
"0.55799156",
"0.5556358",
"0.5554316",
"0.55453575",
"0.55165464",
"0.55119574",
"0.5509121... | 0.0 | -1 |
A weighted version of keras.objectives.categorical_crossentropy | def weighted_categorical_crossentropy(weights):
weights = K.variable(weights)
def loss(y_true, y_pred):
y_hat = y_pred / K.sum(y_pred, axis=-1, keepdims=True)
y_hat = K.clip(y_hat, K.epsilon(), 1 - K.epsilon())
loss = y_true * K.log(y_hat) * weights
loss = - K.sum(loss) / K.cast... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def weighted_categorical_crossentropy(weights):\r\n\r\n weights = K.variable(weights)\r\n\r\n def loss(y_true, y_pred):\r\n # scale predictions so that the class probas of each sample sum to 1\r\n y_pred /= K.sum(y_pred, axis=-1, keepdims=True)\r\n # clip to prevent NaN's and Inf's\r\n ... | [
"0.7962428",
"0.77685136",
"0.77685136",
"0.7737729",
"0.7454981",
"0.7272084",
"0.7089237",
"0.70415",
"0.7039276",
"0.6933727",
"0.69046044",
"0.6863352",
"0.68381506",
"0.6812229",
"0.67731565",
"0.67504907",
"0.6676336",
"0.6650147",
"0.65918285",
"0.65785307",
"0.6573249... | 0.7873619 | 1 |
Returns the travel time (s) to go from a a point 'origin' to a point 'destination'. Both origin and destination are of the form (x, y) or (x, y, z) | def travel_time(self, origin, destination):
assert 2 <= len(origin) <= 3, "Origin should by (x, y) or (x, y, z)"
assert 2 <= len(destination) <= 3, "Origin should by (x, y) or (x, y, z)"
assert len(origin) == len(destination), "Elevation should be present in origin and destination or absent in b... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def route_info_helper(g, origin, destination, distance):\n time = 0 \n acceleration = 1406.25\n \n if(distance > 400):\n time = time + 0.53 + 0.53\n distance = distance - 400\n time = time + distance / 750\n else:\n half = distance / 2.0\n time = time + 2 (math.sqr... | [
"0.69691396",
"0.68376493",
"0.67335826",
"0.66552216",
"0.65237266",
"0.6398256",
"0.6393746",
"0.6388185",
"0.633329",
"0.627189",
"0.6255315",
"0.62320983",
"0.6227801",
"0.6213503",
"0.6203562",
"0.61351603",
"0.61141855",
"0.6053581",
"0.59249866",
"0.59126836",
"0.58929... | 0.82354397 | 0 |
Get the candidate configuration for the specified get_address object. This will not return address objects that are marked as predefined objects. | def get_address(address=None, vsys="1"):
query = {
"type": "config",
"action": "get",
"xpath": (
"/config/devices/entry[@name='localhost.localdomain']/vsys/entry[@name='vsys{}']/"
"address/entry[@name='{}']".format(vsys, address)
),
}
return __proxy__... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_config(self, request, object_id):\n host = get_object_or_404(Host, pk=object_id)\n return get_host_config_tar_response(host)",
"def get_config(self):\n if self.allow_reco():\n return self.chs_config()\n else:\n return self.get_config_j(self.id)",
"def g... | [
"0.5748436",
"0.5656011",
"0.55608046",
"0.5499388",
"0.54659384",
"0.53970903",
"0.5376698",
"0.5337358",
"0.53103185",
"0.5305613",
"0.5258785",
"0.519438",
"0.5122426",
"0.51137346",
"0.51130146",
"0.50922453",
"0.50922453",
"0.50922453",
"0.50922453",
"0.50922453",
"0.509... | 0.51798195 | 12 |
Get the high availability configuration. | def get_ha_config():
query = {
"type": "config",
"action": "get",
"xpath": "/config/devices/entry[@name='localhost.localdomain']/deviceconfig/high-availability",
}
return __proxy__["panos.call"](query) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_config(self):\n if self.faucet is not None:\n return self.faucet.get_config()\n return None",
"def monitoring_config(self) -> 'outputs.MonitoringConfigResponse':\n return pulumi.get(self, \"monitoring_config\")",
"def get_config(self, **kwargs) -> Optional[Dict[str, Any]... | [
"0.6119114",
"0.60776865",
"0.5961621",
"0.5893652",
"0.5883123",
"0.5869306",
"0.5836497",
"0.57738686",
"0.5769125",
"0.5759186",
"0.5752893",
"0.5750962",
"0.5735003",
"0.57307005",
"0.5725398",
"0.5720938",
"0.56903815",
"0.5690307",
"0.5690307",
"0.5690307",
"0.5690307",... | 0.71942973 | 0 |
Get the platform model information and limitations. | def get_platform():
query = {
"type": "config",
"action": "get",
"xpath": "/config/devices/entry[@name='localhost.localdomain']/platform",
}
return __proxy__["panos.call"](query) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def fetch_ml_model_info() -> ApiResponse:\n return _api_response(settings.ML_MODELS)",
"def model(self):\n version_data = self._raw_version_data()\n if self._model is None:\n self._model = version_data[\"hardware\"]\n\n return self._model",
"def platform_info(self):\n ... | [
"0.627574",
"0.60612804",
"0.6031113",
"0.60019666",
"0.59936637",
"0.5916288",
"0.581848",
"0.57306546",
"0.5712169",
"0.5700885",
"0.5696229",
"0.5661499",
"0.5599238",
"0.55917954",
"0.5586466",
"0.55739087",
"0.5558063",
"0.5551362",
"0.55432546",
"0.55403537",
"0.5516864... | 0.553503 | 20 |
Get the configuration for the specified predefined application object. This will only return predefined application objects. | def get_predefined_application(application=None):
query = {
"type": "config",
"action": "get",
"xpath": "/config/predefined/application/entry[@name='{}']".format(application),
}
return __proxy__["panos.call"](query) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_application_config(app: Optional[Flask] = None) ->Mapping:\n # pylint: disable=protected-access\n if app is not None:\n if isinstance(app, Flask):\n return app.config\n if flask_app: # Proxy object; falsey if there is no application context.\n return flask_app.config\n ... | [
"0.62549347",
"0.6107998",
"0.60562265",
"0.6007065",
"0.60055685",
"0.5937429",
"0.5916336",
"0.5905927",
"0.58985776",
"0.58350784",
"0.5790175",
"0.57736355",
"0.5712072",
"0.570978",
"0.56978667",
"0.5679385",
"0.56176543",
"0.5597747",
"0.5573032",
"0.55619985",
"0.55535... | 0.73107076 | 0 |
Get the candidate configuration for the specified security rule. | def get_security_rule(rulename=None, vsys="1"):
query = {
"type": "config",
"action": "get",
"xpath": (
"/config/devices/entry[@name='localhost.localdomain']/vsys/entry[@name='vsys{}']/"
"rulebase/security/rules/entry[@name='{}']".format(vsys, rulename)
),
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_config(self):\n if self.allow_reco():\n return self.chs_config()\n else:\n return self.get_config_j(self.id)",
"def _get_rule(self, rule):\n for kbrule in self.rules:\n if rule == kbrule:\n return kbrule",
"def _get_rule(self, rule):\... | [
"0.62327605",
"0.6047671",
"0.6047671",
"0.6047671",
"0.59747005",
"0.58710474",
"0.5780412",
"0.5751388",
"0.5660602",
"0.56448513",
"0.56316376",
"0.5615237",
"0.55305403",
"0.55305403",
"0.55205905",
"0.55205905",
"0.551969",
"0.54568094",
"0.5435195",
"0.5405116",
"0.5397... | 0.49470055 | 88 |
Get the SNMP configuration from the device. | def get_snmp_config():
query = {
"type": "config",
"action": "get",
"xpath": "/config/devices/entry[@name='localhost.localdomain']/deviceconfig/system/snmp-setting",
}
return __proxy__["panos.call"](query) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def config(self) -> 'outputs.DeviceConfigResponse':\n return pulumi.get(self, \"config\")",
"def snmp(self):\n return self._snmp_defaults",
"def device_config(self):\n\t\ttry:\n\t\t\treturn self._dev\n\t\texcept:\n\t\t\treturn 0",
"async def get_config(self, timeout=None):\n\n # Display ... | [
"0.636297",
"0.62657404",
"0.6025873",
"0.6015666",
"0.59946495",
"0.5902574",
"0.571561",
"0.5673222",
"0.5662231",
"0.56548804",
"0.56516975",
"0.56426436",
"0.56218284",
"0.5529755",
"0.5474312",
"0.546071",
"0.54582256",
"0.541161",
"0.5384179",
"0.5345556",
"0.53340906",... | 0.7799914 | 0 |
Get the system date/time. | def get_system_date_time():
query = {"type": "op", "cmd": "<show><clock></clock></show>"}
return __proxy__["panos.call"](query) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_system_date_and_time(self):\n return self.mycam.devicemgmt.GetSystemDateAndTime()",
"def getdate():\r\n import datetime\r\n return datetime.datetime.now()",
"def get_system_time(self):\n\t\treturn call_sdk_function('PrlStatCpu_GetSystemTime', self.handle)",
"def get_time():\n return d... | [
"0.84595096",
"0.7718407",
"0.73819536",
"0.7381928",
"0.7378176",
"0.72158635",
"0.7161397",
"0.7158314",
"0.7157886",
"0.71509767",
"0.714318",
"0.714318",
"0.7123552",
"0.711938",
"0.7116743",
"0.710303",
"0.7079561",
"0.70628023",
"0.7049035",
"0.7039835",
"0.7001971",
... | 0.7918134 | 1 |
Get the local administrative user account configuration. | def get_users_config():
query = {"type": "config", "action": "get", "xpath": "/config/mgt-config/users"}
return __proxy__["panos.call"](query) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def user_config(self):\n\n return self.__user_config",
"def admin_credentials(self) -> pulumi.Input['AdministrativeCredentialsArgs']:\n return pulumi.get(self, \"admin_credentials\")",
"def getDbAdminUser():\n if \"DB_ADMIN\" in controller.CONF.keys():\n return controller.CONF[\"DB_... | [
"0.68473256",
"0.6641574",
"0.6529314",
"0.6398287",
"0.6398287",
"0.63331574",
"0.6269938",
"0.62358624",
"0.6197195",
"0.6194177",
"0.6188089",
"0.6153847",
"0.6098112",
"0.6067702",
"0.6040022",
"0.6035774",
"0.6013425",
"0.5994657",
"0.5972955",
"0.59706146",
"0.59692156"... | 0.6173798 | 11 |
Set the timezone of the Palo Alto proxy minion. A commit will be required before this is processed. | def set_timezone(tz=None, deploy=False):
if not tz:
raise CommandExecutionError("Timezone name option must not be none.")
ret = {}
query = {
"type": "config",
"action": "set",
"xpath": "/config/devices/entry[@name='localhost.localdomain']/deviceconfig/system/timezone",
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_timezone(conn, timezone):\n with Tx(conn) as c:\n c.execute('SET timezone = %s', (timezone,))",
"def set_timezone(self, to_tz):\n self.startdate = to_tz.localize(self.startdate.replace(tzinfo=None))\n self.enddate = to_tz.localize(self.enddate.replace(tzinfo=None))\n self.t... | [
"0.72961956",
"0.66699666",
"0.6638812",
"0.65618724",
"0.6537264",
"0.6537264",
"0.6537264",
"0.6537264",
"0.6537264",
"0.6389307",
"0.63826954",
"0.63826954",
"0.63729995",
"0.63657653",
"0.63220936",
"0.62074715",
"0.6111014",
"0.60398626",
"0.6007683",
"0.5962305",
"0.588... | 0.6830989 | 1 |
Take a first and last name and format it to return the title case version of the name. | def format_name(f_name, l_name): #docstring (documentation)
if f_name == "" or l_name == "":
return "You didn't provide valid inputs."
formated_f_name = f_name.title()
formated_l_name = l_name.title()
return f"Result: {formated_f_name} {formated_l_name}" | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_formatted_name(first_name, last_name): \r\n full_name = f\"{first_name} {last_name}\"\r\n return full_name.title()",
"def get_formatted_name(first_name, last_name):\n full_name = first_name + ' ' + last_name\n return full_name.title()",
"def get_formatted_name(first_name, last_name):\n f... | [
"0.8673775",
"0.86134124",
"0.86134124",
"0.86134124",
"0.8580511",
"0.85708284",
"0.8551684",
"0.8551684",
"0.8551684",
"0.85449964",
"0.85438037",
"0.8518748",
"0.85064423",
"0.8500691",
"0.8484864",
"0.84470373",
"0.84470373",
"0.84401643",
"0.84316254",
"0.8410574",
"0.83... | 0.6969862 | 61 |
Get the Wisconsin Breast Cancer classification dataset, formatted as a DataFrame | def get_breast_cancer_data(target="diagnosis"):
data = load_breast_cancer()
df = pd.DataFrame(data=data.data, columns=[_.replace(" ", "_") for _ in data.feature_names])
df[target] = data.target
return df | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _breast_cancer_wisconsin_diag(location: str) -> Dataset:\n\n columns = ['id', 'target']\n data_type = ['radius', 'texture', 'perimeter', 'area', 'smoothness',\n 'compactness', 'concavity', 'concave_points', 'symmetry',\n 'fractal_dimension']\n\n # Compute proper names o... | [
"0.66557175",
"0.66050845",
"0.6479283",
"0.5993223",
"0.59222287",
"0.5885735",
"0.57678545",
"0.57595885",
"0.564008",
"0.55762273",
"0.54982054",
"0.5498182",
"0.5492114",
"0.5474977",
"0.5462391",
"0.54474795",
"0.5431308",
"0.5430017",
"0.54200256",
"0.54114246",
"0.5409... | 0.6683395 | 0 |
Wrapper around `sklearn.datasets.make_classification` to produce a `pandas.DataFrame` | def get_toy_classification_data(
target="target", n_samples=300, n_classes=2, shuffle=True, random_state=32, **kwargs
):
x, y = make_classification(
n_samples=n_samples,
n_classes=n_classes,
shuffle=shuffle,
random_state=random_state,
**kwargs
)
train_df = pd.Data... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_adv_classification_dataset(self) -> pd.DataFrame:\n pass",
"def classification_report_to_pandas(ground_truth,\n predictions,\n full_path=\"test_pandas.csv\",\n activity_dict=None):\n import ... | [
"0.72941816",
"0.656385",
"0.6490683",
"0.64862895",
"0.64564186",
"0.6335214",
"0.6283156",
"0.6236503",
"0.61995703",
"0.6191694",
"0.6066481",
"0.60631585",
"0.6056585",
"0.60497206",
"0.6041406",
"0.60371906",
"0.5975861",
"0.59707016",
"0.59195715",
"0.5862174",
"0.58394... | 0.73247075 | 0 |
Get first and last day of specified year and month | def get_period(year, month):
first_weekday, days = calendar.monthrange(year, month)
first = datetime.date(year=year, month=month, day=1)
last = datetime.date(year=year, month=month, day=days)
return first, last | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_start_and_end_dates_of_month(year, month):\n date_start = datetime.date(year, month, 1)\n date_end = add_months_to_date(date_start, 1) - datetime.timedelta(days=1)\n return date_start, date_end",
"def get_month_day_range(date):\n first_day = date.replace(day = 1)\n last_day = date.replace(... | [
"0.7275492",
"0.70373744",
"0.7026227",
"0.6941622",
"0.6793637",
"0.6728882",
"0.6716931",
"0.66475904",
"0.6627738",
"0.6564959",
"0.6518516",
"0.65176165",
"0.6491401",
"0.64228636",
"0.64092284",
"0.63485146",
"0.6272898",
"0.6250001",
"0.6247201",
"0.62380534",
"0.622719... | 0.76028967 | 0 |
Extract initial value from fitargs dictionary. | def extract_iv(b):
return dict((k, v) for k, v in b.items() if true_param(k)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def initial(self):\n return self.args[3]",
"def fill_fitarg(self, **kwargs):\n # set the fit arguments\n fitarg = {}\n #fitarg.update(kwargs['pinit'])\n #for k in kwargs['limits'].keys():\n # fitarg['limit_{0:s}'.format(k)] = kwargs['limits'][k]\n # fitarg['... | [
"0.6410786",
"0.5693868",
"0.5662911",
"0.56538963",
"0.5606293",
"0.5606293",
"0.55113983",
"0.551042",
"0.5474696",
"0.5402391",
"0.5388093",
"0.53398776",
"0.5336224",
"0.53161585",
"0.53048015",
"0.530335",
"0.5277424",
"0.5277099",
"0.52699244",
"0.52174664",
"0.521338",... | 0.0 | -1 |
Extract limit from fitargs dictionary. | def extract_limit(b):
return dict((k, v) for k, v in b.items() if k.startswith('limit_')) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getPTLimits(*args):\n return args[0].Limit.PTLimit.pt_limit",
"def get_limit(test_suite_name, test_name, test_pin, test_mode, test_limits_dict):\n a_dict = test_limits_dict[test_suite_name][test_name][test_pin]\n return a_dict[test_mode][\"Usl\"], a_dict[test_mode][\"Lsl\"], a_dict[\"Units\"]",
"d... | [
"0.6350013",
"0.58575",
"0.58348966",
"0.57527745",
"0.5735538",
"0.57276535",
"0.55588186",
"0.54599136",
"0.53663504",
"0.5362824",
"0.53354406",
"0.5322988",
"0.53138024",
"0.5308602",
"0.52922285",
"0.52894396",
"0.52843624",
"0.52843624",
"0.5281722",
"0.52688295",
"0.52... | 0.65352356 | 0 |
convert the month format input a integer; output a string; | def _int2str(num):
if num<10:
return '00%s'%str(num)
elif 10<=num<100:
return '0%s'%str(num)
else:
return '%s'%str(num) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def convert_month(string): \n datetime_object = datetime.datetime.strptime(string, \"%B\")\n\n month_number = datetime_object.month\n\n return month_number",
"def _get_month(num) -> str:\n return dict(\n [\n (1, \"JAN\"), (2, \"FEB\"), (3, \"MAR\"), (4, \"APR\"), (5, \"MAY\"), (6... | [
"0.75571626",
"0.7355818",
"0.73017186",
"0.72119343",
"0.71637565",
"0.7111653",
"0.7099535",
"0.70975775",
"0.7004239",
"0.6971996",
"0.69585353",
"0.6923429",
"0.68679816",
"0.686378",
"0.683121",
"0.680282",
"0.67763066",
"0.6650608",
"0.66478276",
"0.6620904",
"0.6619736... | 0.0 | -1 |
Returns the transport used by the client instance. | def transport(self) -> MetricsV1Beta3Transport:
return self._client.transport | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def transport(self):\n return self._transport",
"def transport(self) -> TraceServiceTransport:\n return self._client.transport",
"def transport(self) -> ServiceControllerTransport:\n return self._client.transport",
"def transport(self) -> MetadataServiceTransport:\n return self._c... | [
"0.82946277",
"0.7887542",
"0.773594",
"0.773068",
"0.76806635",
"0.7674273",
"0.76357967",
"0.7558095",
"0.7551682",
"0.74958986",
"0.7488142",
"0.7436853",
"0.7423566",
"0.7368433",
"0.73340607",
"0.721926",
"0.7109823",
"0.7102308",
"0.68808985",
"0.68144",
"0.6671675",
... | 0.75303864 | 9 |
r"""Request detailed information about the execution status of the job. EXPERIMENTAL. This API is subject to change or removal without notice. | async def get_job_execution_details(
self,
request: metrics.GetJobExecutionDetailsRequest = None,
*,
retry: retries.Retry = gapic_v1.method.DEFAULT,
timeout: float = None,
metadata: Sequence[Tuple[str, str]] = (),
) -> pagers.GetJobExecutionDetailsAsyncPager:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_status(self):\n url = \"data_request?id=jobstatus&job=%d&plugin=zwave\" % self.id\n return self.vera.get(url)",
"def info(self):\n resp = self.server.request(\"get\", \"/jobs/%s/%s\" % (self.sessionid,\n self.name))\n return self.server.json_body(resp)",
"def get_... | [
"0.7364049",
"0.7077297",
"0.70637745",
"0.7020381",
"0.69225526",
"0.6827289",
"0.68070465",
"0.6789452",
"0.67428255",
"0.67225164",
"0.6605939",
"0.65959287",
"0.65711933",
"0.6569383",
"0.6522878",
"0.64846224",
"0.6450781",
"0.64492077",
"0.64393055",
"0.64249057",
"0.64... | 0.0 | -1 |
Generates a subsetted dataframe with only the change records that occur in or before the specified max interval year | def subset_project_changes(
df,
change_year_interval=3,
change_col="Change_Year",
project_age_col="Current_Project_Year",
inclusive_stop=True,
):
df_subset = df.copy().loc[
(df[change_col] <= change_year_interval)
& (
df[project_age_col] >= change_year_interval
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def split_data(df: pd.DataFrame, cutoff_year: int) -> Tuple[pd.DataFrame, pd.DataFrame]:\n return df[df.year >= cutoff_year], df[df.year < cutoff_year]",
"def drop_years(dataframe, start, end):\n tmp = dataframe\n tmp = tmp[(start <= tmp['year'].astype(int)) & (tmp['year'].astype(int) <= end)]\n... | [
"0.6334108",
"0.6170329",
"0.5933685",
"0.59188503",
"0.5736273",
"0.5733603",
"0.57267964",
"0.559577",
"0.55346745",
"0.5508034",
"0.5436531",
"0.5411411",
"0.54014665",
"0.53851557",
"0.5383787",
"0.5379187",
"0.5366586",
"0.53607756",
"0.533567",
"0.53301597",
"0.5328392"... | 0.75006086 | 0 |
Creates dataframe joining the df_details and df_endstate dataframes by PID | def join_data_endstate(df_details, df_endstate, how="inner"):
df_join = pd.merge(
df_details, df_endstate, how=how, left_index=True, right_index=True
)
return df_join.reset_index() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_df_from_psv(psql_out='data/output.psv', fout=None):\n\twith open(psql_out, encoding=\"utf-8\") as f:\n\t\tstrr = f.read()\n\n\tdf_str = re.sub(r'\\n(?![0-9])', ' ', strr) # Regex to handle erratic newlines\n\t\n\tdf = pd.read_csv(io.StringIO(df_str), sep='|', error_bad_lines=False) \n\n\t# at least one row... | [
"0.5896843",
"0.57282",
"0.5638434",
"0.56246525",
"0.55947655",
"0.5526413",
"0.55151004",
"0.54422283",
"0.53904057",
"0.5363028",
"0.53598756",
"0.53485715",
"0.5291043",
"0.5278683",
"0.5234996",
"0.5222538",
"0.52222776",
"0.52187043",
"0.5215274",
"0.5214937",
"0.521404... | 0.66262615 | 0 |
Return a list of models whose definitions we'll be storing. This method should be updated when new models are added. List of model classes. | def generate_model_list():
models = [
api.v1.models.job.Job,
]
return models | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getListOfModelDefinitions(self):\n return _libsbml.CompSBMLDocumentPlugin_getListOfModelDefinitions(self)",
"def models(self):\n return self._base.classes",
"def models(self) -> t.List[Model]:\n _models: t.List[Model] = [\n item for item in self._deployables if isinstance(it... | [
"0.752933",
"0.74305487",
"0.7028396",
"0.69965434",
"0.6849996",
"0.682566",
"0.6821897",
"0.6786676",
"0.67638946",
"0.6760213",
"0.673613",
"0.6699694",
"0.6684607",
"0.6635074",
"0.6635074",
"0.6635074",
"0.6635074",
"0.66291624",
"0.6536095",
"0.6502046",
"0.6498738",
... | 0.66071135 | 18 |
Converts token indices to tokens according to the vocabulary | def to_tokens(self, indices: Union[int, List[int]]) -> Union[str, List[str]]:
if isinstance(indices, list):
return [self._idx_to_token[idx] for idx in indices]
else:
return self._idx_to_token[indices] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _tokens_to_index(self,tokens):\n wids = []\n for tk in tokens:\n if tk in self.wtoi.keys():\n wids.append(self.wtoi[tk])\n else:\n wids.append(1) # <UNK>\n for _ in range(self.sentence_max_length - len(wids)):\n wids.append(0)... | [
"0.70589805",
"0.70489985",
"0.68942523",
"0.67755663",
"0.6762148",
"0.6761509",
"0.672319",
"0.6701188",
"0.6640891",
"0.66361594",
"0.66308856",
"0.66288143",
"0.6539368",
"0.65276235",
"0.6516318",
"0.6461576",
"0.6384107",
"0.63554364",
"0.63355064",
"0.6315199",
"0.6290... | 0.690335 | 2 |
Gets the installment_amount of this InstallmentRequest. | def installment_amount(self) -> Amount:
return self._installment_amount | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def installment_amount(self, installment_amount: Amount):\n\n self._installment_amount = installment_amount",
"def amount(self) -> int:\n return self._amount",
"def amount(self) -> float:\n return self._amount",
"def amount(self) -> float:\n return self._amount",
"def amount(sel... | [
"0.6890494",
"0.64384854",
"0.6419224",
"0.6419224",
"0.6401451",
"0.6342668",
"0.6342668",
"0.6113577",
"0.6050067",
"0.5947469",
"0.5939226",
"0.5939226",
"0.5933829",
"0.5803442",
"0.5754238",
"0.57280535",
"0.5687066",
"0.56561255",
"0.562179",
"0.56195",
"0.55670965",
... | 0.85997385 | 0 |
Sets the installment_amount of this InstallmentRequest. | def installment_amount(self, installment_amount: Amount):
self._installment_amount = installment_amount | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def installment_amount(self) -> Amount:\n return self._installment_amount",
"def __init__(self, number_of_installments: int=None, installment_amount: Amount=None): # noqa: E501\n self.swagger_types = {\n 'number_of_installments': int,\n 'installment_amount': Amount\n }... | [
"0.6914071",
"0.6215847",
"0.61169434",
"0.6109385",
"0.6109385",
"0.6109385",
"0.6109385",
"0.6109385",
"0.6109385",
"0.6109385",
"0.6109385",
"0.6109385",
"0.6043576",
"0.5714027",
"0.5704154",
"0.5675099",
"0.55384195",
"0.54185444",
"0.53882074",
"0.5315161",
"0.5315161",... | 0.88170856 | 0 |
Returns a list of the atoms in the LHS and RHS of this expression | def atoms(self):
return itertools.chain(self.rhs_atoms, self.lhs_atoms) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def rhs_atoms(self):\n\n return itertools.chain(self.rhs_names, self.rhs_funcs)",
"def FindLHSs(self):\n return self.lhslist",
"def get_formula_in_list(self):\n return tree_to_string(self.expression)",
"def valence_terms(cls, topology):\n return [tuple(b.atoms) for b in topology.b... | [
"0.7470139",
"0.71660554",
"0.63593775",
"0.63531566",
"0.63177925",
"0.62172973",
"0.6053584",
"0.605323",
"0.6045466",
"0.5989777",
"0.5933623",
"0.5856164",
"0.5853774",
"0.5803101",
"0.5741664",
"0.57365817",
"0.5712201",
"0.57089585",
"0.56866074",
"0.56844807",
"0.55967... | 0.773672 | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.