query stringlengths 9 9.05k | document stringlengths 10 222k | metadata dict | negatives listlengths 30 30 | negative_scores listlengths 30 30 | document_score stringlengths 4 10 | document_rank stringclasses 2
values |
|---|---|---|---|---|---|---|
Testing M4 remeshing formula in 2D, 2 kernel, simple precision, o2 splitting. | def test_2D_m4_2k():
scal, velo = setup_2D()
advec = Advection(velo, scal, discretization=d2d,
method={TimeIntegrator: RK2,
Interpolation: Linear,
Remesh: L2_1,
Support: 'gpu_2k',
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_multiple_case(self):\r\n\r\n shp = (3, 3)\r\n fx, fy, fz, fw = fmatrices('xyzw')\r\n dx, dy, dz, dw = dmatrices('xyzw')\r\n fv = fvector('r').dimshuffle('x', 0)\r\n dv = dvector('s').dimshuffle('x', 0)\r\n fxv = theano._asarray(numpy.random.rand(*shp), dtype='floa... | [
"0.6149543",
"0.6069213",
"0.59663194",
"0.5921558",
"0.59111285",
"0.58696795",
"0.5868889",
"0.58214706",
"0.5758329",
"0.569662",
"0.5670989",
"0.5660078",
"0.56426615",
"0.56170434",
"0.5614147",
"0.55748886",
"0.5574285",
"0.5569398",
"0.5566175",
"0.5548728",
"0.5532132... | 0.61538 | 0 |
Testing M4 remeshing formula in 2D, 1 kernel, simple precision, o2_FullHalf splitting. | def test_2D_m4_1k_sFH():
scal, velo = setup_2D()
advec = Advection(velo, scal, discretization=d2d,
method={TimeIntegrator: RK2,
Interpolation: Linear,
Remesh: L2_1,
Support: 'gpu_1k',
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_2D_m4_2k_sFH():\n scal, velo = setup_2D()\n\n advec = Advection(velo, scal, discretization=d2d,\n method={TimeIntegrator: RK2,\n Interpolation: Linear,\n Remesh: L2_1,\n Support: 'gpu_2k',\n ... | [
"0.6167299",
"0.6115459",
"0.60603625",
"0.5985592",
"0.5906559",
"0.5905191",
"0.58676517",
"0.5816498",
"0.5809439",
"0.58079594",
"0.5807654",
"0.57482004",
"0.5687916",
"0.5656078",
"0.56546664",
"0.557186",
"0.5525966",
"0.5501036",
"0.54868674",
"0.5477152",
"0.5476477"... | 0.63332564 | 0 |
Testing M4 remeshing formula in 2D, 2 kernel, simple precision, o2_FullHalf splitting. | def test_2D_m4_2k_sFH():
scal, velo = setup_2D()
advec = Advection(velo, scal, discretization=d2d,
method={TimeIntegrator: RK2,
Interpolation: Linear,
Remesh: L2_1,
Support: 'gpu_2k',
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_2D_m4_1k_sFH():\n scal, velo = setup_2D()\n\n advec = Advection(velo, scal, discretization=d2d,\n method={TimeIntegrator: RK2,\n Interpolation: Linear,\n Remesh: L2_1,\n Support: 'gpu_1k',\n ... | [
"0.63592356",
"0.61472815",
"0.6060959",
"0.60506004",
"0.59646344",
"0.58725816",
"0.58380145",
"0.5816965",
"0.580119",
"0.5774057",
"0.5769687",
"0.5768955",
"0.5735332",
"0.5679965",
"0.55848306",
"0.55845535",
"0.5560804",
"0.5544674",
"0.5541364",
"0.55350125",
"0.55206... | 0.63131726 | 1 |
Testing M8 remeshing formula in 2D, 1 kernel, simple precision, o2 splitting. | def test_2D_m8_1k():
scal, velo = setup_2D()
advec = Advection(velo, scal, discretization=d2d,
method={TimeIntegrator: RK2,
Interpolation: Linear,
Remesh: M8Prime,
Support: 'gpu_1k',
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_2D_m8_1k_sFH():\n scal, velo = setup_2D()\n\n advec = Advection(velo, scal, discretization=d2d,\n method={TimeIntegrator: RK2,\n Interpolation: Linear,\n Remesh: M8Prime,\n Support: 'gpu_1k',\... | [
"0.61626244",
"0.61440176",
"0.6001109",
"0.5942162",
"0.5766749",
"0.57562554",
"0.57494867",
"0.57129544",
"0.55944943",
"0.5574273",
"0.5554185",
"0.55528677",
"0.55476743",
"0.55270815",
"0.5513868",
"0.551193",
"0.55054796",
"0.54848176",
"0.54846114",
"0.5481975",
"0.54... | 0.62266886 | 0 |
Testing M8 remeshing formula in 2D, 2 kernel, simple precision, o2 splitting. | def test_2D_m8_2k():
scal, velo = setup_2D()
advec = Advection(velo, scal, discretization=d2d,
method={TimeIntegrator: RK2,
Interpolation: Linear,
Remesh: M8Prime,
Support: 'gpu_2k',
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_2D_m8_1k():\n scal, velo = setup_2D()\n\n advec = Advection(velo, scal, discretization=d2d,\n method={TimeIntegrator: RK2,\n Interpolation: Linear,\n Remesh: M8Prime,\n Support: 'gpu_1k',\n ... | [
"0.6273544",
"0.6218895",
"0.61845493",
"0.5922564",
"0.5862043",
"0.58117807",
"0.5725113",
"0.5718566",
"0.56848884",
"0.56645614",
"0.5646553",
"0.5626228",
"0.56077373",
"0.5603067",
"0.5589761",
"0.5585725",
"0.5563543",
"0.55627114",
"0.5533993",
"0.5531129",
"0.5524585... | 0.63639283 | 0 |
Testing M8 remeshing formula in 2D, 1 kernel, simple precision, o2_FullHalf splitting. | def test_2D_m8_1k_sFH():
scal, velo = setup_2D()
advec = Advection(velo, scal, discretization=d2d,
method={TimeIntegrator: RK2,
Interpolation: Linear,
Remesh: M8Prime,
Support: 'gpu_1k',
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_2D_m8_2k_sFH():\n scal, velo = setup_2D()\n\n advec = Advection(velo, scal, discretization=d2d,\n method={TimeIntegrator: RK2,\n Interpolation: Linear,\n Remesh: M8Prime,\n Support: 'gpu_2k',\... | [
"0.64638543",
"0.61983424",
"0.61519486",
"0.60451084",
"0.5888241",
"0.58734226",
"0.5817478",
"0.57815385",
"0.5780573",
"0.5759568",
"0.57414657",
"0.5736586",
"0.5728689",
"0.5697968",
"0.5688739",
"0.567302",
"0.5628698",
"0.5611948",
"0.5586767",
"0.55747586",
"0.556417... | 0.65938306 | 0 |
Testing M8 remeshing formula in 2D, 2 kernel, simple precision, o2_FullHalf splitting. | def test_2D_m8_2k_sFH():
scal, velo = setup_2D()
advec = Advection(velo, scal, discretization=d2d,
method={TimeIntegrator: RK2,
Interpolation: Linear,
Remesh: M8Prime,
Support: 'gpu_2k',
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_2D_m8_1k_sFH():\n scal, velo = setup_2D()\n\n advec = Advection(velo, scal, discretization=d2d,\n method={TimeIntegrator: RK2,\n Interpolation: Linear,\n Remesh: M8Prime,\n Support: 'gpu_1k',\... | [
"0.6612045",
"0.6316624",
"0.6205833",
"0.6069077",
"0.60371995",
"0.58924127",
"0.58888525",
"0.58776313",
"0.58374417",
"0.5809537",
"0.5788198",
"0.57790375",
"0.57689774",
"0.574581",
"0.5729717",
"0.56743294",
"0.5644362",
"0.56299007",
"0.56171143",
"0.56143606",
"0.560... | 0.65982985 | 1 |
Testing M8 remeshing formula in 3D, 1 kernel, simple precision, o2 splitting. | def test_3D_m8_1k():
scal, velo = setup_3D()
advec = Advection(velo, scal, discretization=d3d,
method={TimeIntegrator: RK2,
Interpolation: Linear,
Remesh: M8Prime,
Support: 'gpu_1k',
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_3D_m8_2k():\n scal, velo = setup_3D()\n\n advec = Advection(velo, scal, discretization=d3d,\n method={TimeIntegrator: RK2,\n Interpolation: Linear,\n Remesh: M8Prime,\n Support: 'gpu_2k',\n ... | [
"0.6256041",
"0.62469673",
"0.61554265",
"0.6052721",
"0.59591246",
"0.59132755",
"0.5910311",
"0.58924216",
"0.58591473",
"0.5825424",
"0.5753714",
"0.57487774",
"0.57378185",
"0.57196903",
"0.57180595",
"0.5703061",
"0.57020545",
"0.56810784",
"0.56383675",
"0.5617995",
"0.... | 0.6248369 | 1 |
Testing M8 remeshing formula in 3D, 2 kernel, simple precision, o2 splitting. | def test_3D_m8_2k():
scal, velo = setup_3D()
advec = Advection(velo, scal, discretization=d3d,
method={TimeIntegrator: RK2,
Interpolation: Linear,
Remesh: M8Prime,
Support: 'gpu_2k',
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_3D_m8_2k_sFH():\n scal, velo = setup_3D()\n\n advec = Advection(velo, scal, discretization=d3d,\n method={TimeIntegrator: RK2,\n Interpolation: Linear,\n Remesh: M8Prime,\n Support: 'gpu_2k',\... | [
"0.6212858",
"0.61790264",
"0.61441815",
"0.60225594",
"0.59996915",
"0.59342116",
"0.59044826",
"0.5891348",
"0.58359265",
"0.5797982",
"0.57896024",
"0.57776266",
"0.5761643",
"0.57230186",
"0.57105297",
"0.5710375",
"0.570535",
"0.569546",
"0.5687734",
"0.56662655",
"0.564... | 0.63192964 | 0 |
Testing M8 remeshing formula in 3D, 1 kernel, simple precision, o2_FullHalf splitting. | def test_3D_m8_1k_sFH():
scal, velo = setup_3D()
advec = Advection(velo, scal, discretization=d3d,
method={TimeIntegrator: RK2,
Interpolation: Linear,
Remesh: M8Prime,
Support: 'gpu_1k',
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_3D_m8_2k_sFH():\n scal, velo = setup_3D()\n\n advec = Advection(velo, scal, discretization=d3d,\n method={TimeIntegrator: RK2,\n Interpolation: Linear,\n Remesh: M8Prime,\n Support: 'gpu_2k',\... | [
"0.6412918",
"0.6150319",
"0.60951227",
"0.6055545",
"0.6023906",
"0.5983679",
"0.59347147",
"0.58496296",
"0.5808829",
"0.57917595",
"0.5779339",
"0.57610947",
"0.5742945",
"0.57332003",
"0.5708701",
"0.5674671",
"0.56742716",
"0.5661019",
"0.56583065",
"0.56562775",
"0.5637... | 0.64558506 | 0 |
Testing M8 remeshing formula in 3D, 2 kernel, simple precision, o2_FullHalf splitting. | def test_3D_m8_2k_sFH():
scal, velo = setup_3D()
advec = Advection(velo, scal, discretization=d3d,
method={TimeIntegrator: RK2,
Interpolation: Linear,
Remesh: M8Prime,
Support: 'gpu_2k',
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_3D_m8_1k_sFH():\n scal, velo = setup_3D()\n\n advec = Advection(velo, scal, discretization=d3d,\n method={TimeIntegrator: RK2,\n Interpolation: Linear,\n Remesh: M8Prime,\n Support: 'gpu_1k',\... | [
"0.636811",
"0.620209",
"0.61466837",
"0.6098183",
"0.60520035",
"0.59614044",
"0.59098226",
"0.5829521",
"0.58274263",
"0.5822031",
"0.5816027",
"0.58075863",
"0.5801952",
"0.5774439",
"0.5718799",
"0.5712643",
"0.56994295",
"0.569744",
"0.5670637",
"0.5666977",
"0.5634393",... | 0.6449545 | 0 |
Attach a model to our Buddy, and move it onto `buddy.device`. If a model isn't explicitly passed into the constructor's `model` field, `attach_model` should be called before any optimization, checkpointing, etc happens. | def attach_model(self, model: nn.Module) -> None:
assert isinstance(model, nn.Module)
# Move model to correct device
model.to(self._device)
# Attach model
self._model = model | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _attach_to_model(self, model):\n self._model = model",
"def _addmodel(self, model: Model):\n model = copy.deepcopy(model)\n\n if self.domain is not None:\n # Check that model and domain are compatible\n self._validate_model_domain(model, self.domain)\n\n ... | [
"0.7275075",
"0.6263499",
"0.6240799",
"0.6118507",
"0.60706156",
"0.60706156",
"0.605017",
"0.605017",
"0.605017",
"0.605017",
"0.605017",
"0.5989531",
"0.58149546",
"0.57625425",
"0.5756338",
"0.57553875",
"0.57553875",
"0.57202077",
"0.5699022",
"0.5698126",
"0.5638279",
... | 0.76799136 | 0 |
Readonly interface for the active torch device. Autodetected in the constructor based on CUDA support. | def device(self) -> torch.device:
return self._device | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _create_device(self):\n return torch.device(\"cuda\" if torch.cuda.is_available() else \"cpu\")",
"def device():\n return torch.device('cuda:0' if torch.cuda.is_available() else 'cpu')",
"def set_device(self, device: torch.Tensor) -> None:\n raise NotImplementedError",
"def setup_device(... | [
"0.7243774",
"0.6864857",
"0.67070234",
"0.6623963",
"0.66236806",
"0.65979505",
"0.65841067",
"0.65643656",
"0.64700145",
"0.6351698",
"0.6300667",
"0.62400496",
"0.62294424",
"0.61740786",
"0.61147404",
"0.610777",
"0.6085627",
"0.6059798",
"0.59826255",
"0.5965916",
"0.593... | 0.6884824 | 1 |
Converts Latin character to similar english characters" | def latin_to_english(self, latin_string):
return ''.join(
c for c in unicodedata.normalize('NFD', latin_string)
if unicodedata.category(c) != 'Mn'
and c in self.all_chars) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _normalize_asian(cls, sentence: str) ->str:\n sentence = re.sub('([\\\\u4e00-\\\\u9fff\\\\u3400-\\\\u4dbf])', ' \\\\1 ', sentence)\n sentence = re.sub('([\\\\u31c0-\\\\u31ef\\\\u2e80-\\\\u2eff])', ' \\\\1 ', sentence)\n sentence = re.sub('([\\\\u3300-\\\\u33ff\\\\uf900-\\\\ufaff\\\\ufe30-\... | [
"0.6842372",
"0.68036175",
"0.669434",
"0.6690672",
"0.66607344",
"0.65947497",
"0.6528134",
"0.65152377",
"0.65121776",
"0.64854544",
"0.64776546",
"0.6462483",
"0.6440842",
"0.6438411",
"0.6436063",
"0.64220375",
"0.6407699",
"0.6407324",
"0.6399416",
"0.636626",
"0.6330061... | 0.7076683 | 0 |
Insert JSON lines from a file or stdin into a CrateDB cluster. If no hosts are specified the statements will be printed. | def insert_json(table=None,
bulk_size=1000,
concurrency=25,
hosts=None,
infile=None,
output_fmt=None):
if not hosts:
return print_only(infile, table)
queries = (to_insert(table, d) for d in dicts_from_lines(infile))
bul... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def parse_json(self, json_file, database):\n\n\t\tfile = open(json_file,'r')\n\t\tsp_out = file.read()\n\t\tfile.close()\n\n\t\t#print s\n\n\t\tmasscan_out = json.loads(sp_out.replace('\\0', ''))\n\n\n\t\tfor line in masscan_out:\n\n\t\t\tif database.host_exist(line[\"ip\"]):\n\n\t\t\t\tadd_host = database.session... | [
"0.54399925",
"0.5259793",
"0.52510303",
"0.5229402",
"0.5170605",
"0.5112336",
"0.5007926",
"0.50039613",
"0.4979881",
"0.49585456",
"0.49466792",
"0.49466792",
"0.4929705",
"0.49289107",
"0.48176137",
"0.47960815",
"0.47917533",
"0.4782383",
"0.47815147",
"0.47773403",
"0.4... | 0.67863613 | 0 |
for send product to styleboard on homepage | def _set_send_to_styleboard_product_positions(request, obj, sessionid):
prod_id = obj.get('prod_id')
product = Product.objects.get(pk=int(prod_id))
alt_id = obj.get('alt_id', None)
if not alt_id:
original_image = product.original_image
no_background_image = product.no_background
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def styleboard(request, cat_id=None):\n if cat_id:\n if not get_cat(cat_id):\n return redirect('styleboard')\n\n sessionid = request.session.get('cartsession',None)\n if not sessionid: \n session_id = generate_unique_id()\n request.session['cartsession'] = session_id\n\n ... | [
"0.6259545",
"0.5897496",
"0.5775418",
"0.5617676",
"0.5584862",
"0.55459595",
"0.5519481",
"0.5502217",
"0.54668105",
"0.5454652",
"0.54535717",
"0.54460275",
"0.5413482",
"0.53988165",
"0.5393537",
"0.53888464",
"0.5385505",
"0.53757674",
"0.53673685",
"0.53665763",
"0.5349... | 0.66817373 | 0 |
generates a dictionary from the occupations CSV file | def gen_dict():
lines = [line for line in csv.reader(open(__ppath__ + "/data/occupations.csv"))] # uses a csv.reader to parse the file, converts the generic iterable to a list
lines = [(line[0],float(line[1])) for line in lines[1:-2]]# removes the column names and "Total" row, re-expresses as a list of tuples t... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def read_file(file):\n \n dictionary = {}\n csv_fp = csv.reader(file)\n #L[46] = manufacturer, L[63] = year\n #L[4]= city mileage, L[34]=highway mileage\n for line in csv_fp:\n #Skip the headings and the year 2017\n if (not (line[46] == 'make')) and (not (line[63] == '2017')):\n ... | [
"0.68956435",
"0.6732116",
"0.6721879",
"0.66882974",
"0.66748565",
"0.65674627",
"0.6453858",
"0.6429546",
"0.6380264",
"0.6357282",
"0.6320279",
"0.6303778",
"0.62971205",
"0.6296261",
"0.629254",
"0.62874764",
"0.62746036",
"0.62385505",
"0.6234372",
"0.6204792",
"0.617535... | 0.81257343 | 0 |
Get cache path for given fuse_path. If it is a file and file is not in cache, return path to dummy file. If there is no dummy file either, then the file does not exist. In this case, return None | def _get_path_or_dummy(self, fuse_path):
cache_path = self.converter.to_cache_path(fuse_path)
dummy_cache_path = self.converter.add_dummy_ending(cache_path)
if os.path.exists(cache_path):
return cache_path
elif os.path.exists(dummy_cache_path):
return dummy_cache_... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _locate_from_cache_file():\n path_file = os.path.join(_get_temp_dir(), _config.pathfile)\n return _read_file(path_file) if os.path.isfile(path_file) else None",
"def get_cached_path(self):\n if util.IS_CACHE_ENABLED and not self.physical_key.is_local():\n return ObjectPathCache.get(st... | [
"0.72540975",
"0.6637468",
"0.63889813",
"0.6347938",
"0.6347938",
"0.6323957",
"0.6313463",
"0.629222",
"0.6253909",
"0.6172477",
"0.61681104",
"0.61644065",
"0.6131427",
"0.6089258",
"0.6079828",
"0.60579205",
"0.6052529",
"0.6047051",
"0.5980046",
"0.5979689",
"0.59495044"... | 0.8828662 | 0 |
Convert Vina Docking Output PDBQT file into SDF file with pose id and vina docking score. | def vina_pose_to_sdf(ifile,ofile):
output = Outputfile("sdf",ofile,overwrite=True)
poses = list(readfile("pdbqt",ifile))
for i in range(len(poses)):
poseid = poses[i].data['MODEL']
del poses[i].data['MODEL']
vinascore = poses[i].data['REMARK'].split()[2]
del poses[i].data['RE... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def convert_sdf_to_pdbs(vars, gen_folder_path, sdfs_folder_path):\n\n files = []\n\n if os.path.isdir(sdfs_folder_path):\n # so it's a directory, go through the directory and find all the sdf files\n if sdfs_folder_path[-1:] != os.sep:\n sdfs_folder_path = (\n sdfs_fol... | [
"0.57730514",
"0.5676229",
"0.5420465",
"0.5398354",
"0.5393157",
"0.5263756",
"0.5250648",
"0.522665",
"0.52078366",
"0.5158776",
"0.50826997",
"0.5068098",
"0.5034896",
"0.50248575",
"0.5023164",
"0.5021004",
"0.50092244",
"0.50082356",
"0.5005879",
"0.50026983",
"0.5002594... | 0.72169113 | 0 |
guard against single num turn a single number into a constant dataframe whose index is consistent with others | def _to_constant_df(self, num):
if isinstance(num, pd.DataFrame):
# pdb.set_trace()
return num
else:
return self.data['ones'].copy() * num | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def first_valid_index(self):\n return (\n DataFrameDefault.register(pandas.DataFrame.first_valid_index)(self)\n .to_pandas()\n .squeeze()\n )",
"def data_structure():\n\n items = [1.0, 2.0, 3.0, 4.0, 5.0 ]\n s = pd.Series(items, index=['a', 'b', 'c', 'd', 'e']... | [
"0.55400425",
"0.5448055",
"0.53408647",
"0.53388983",
"0.5300624",
"0.5299355",
"0.5055315",
"0.5000199",
"0.49719244",
"0.4967105",
"0.49633044",
"0.49564132",
"0.4935128",
"0.49337956",
"0.49235603",
"0.4909642",
"0.48602775",
"0.48543218",
"0.4815096",
"0.4796346",
"0.478... | 0.71836346 | 0 |
readFasta reads in the fasta, calls parseFasta and then calls analyzeSequence to analyze the dna | def readFasta(self, fp):
for head, seq in self.parseFasta(fp):
#analyzing the sequence
self.analyzeSequence(seq)
#saving the header
if head == '':
continue
else:
self.header.append(head) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def fasta(file_path):\n \n print(f\"Parsing fasta '{file_path}'\")\n data = {\n 'ur_up_': [], 'accession': [],\n 'entry_name': [], 'offset': [],\n 'taxonomy': [], 'sequence': []\n }\n\n with open(file_path, 'r') as f:\n for i, line in enumerate(f):\n ... | [
"0.68018943",
"0.67670727",
"0.67245513",
"0.6623084",
"0.6588016",
"0.6573484",
"0.65499896",
"0.63427275",
"0.62580866",
"0.6169045",
"0.6161581",
"0.6152185",
"0.6132377",
"0.61134493",
"0.606481",
"0.60580164",
"0.60068524",
"0.6005277",
"0.59995",
"0.599696",
"0.5988293"... | 0.68119603 | 0 |
Enable i2c device (device1). | def EnableI2c(self):
try:
if os.path.exists('/sys/bus/i2c/devices/i2c-0/0-0060'):
result = " - I2C device already enabled!"
else:
with open('/sys/bus/i2c/devices/i2c-0/new_device', 'a') as f:
# 'echo '+i2c_device.driver+' '+i2c_dev... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def enable_i2s(self, enable):\n control = self.get_control()\n if enable:\n control = control | CONTROL_ENABLE\n else:\n control = control & (~CONTROL_ENABLE)\n\n self.set_control(control)",
"def use_i2c():\n _LIB.oled_click_use_i2c()",
"def enable_cl2_copy_ad9866(self):\n self.writ... | [
"0.71020955",
"0.6241626",
"0.61950284",
"0.5782846",
"0.5756835",
"0.5755888",
"0.5698368",
"0.5685892",
"0.56685895",
"0.56587315",
"0.56057596",
"0.5595121",
"0.5585164",
"0.558492",
"0.5573397",
"0.555043",
"0.5504512",
"0.54773784",
"0.546188",
"0.54415196",
"0.5410099",... | 0.84149885 | 0 |
Read i2c raw value. | def i2cRead(self, sensor):
try:
with open(device1_path + "in_" + sensor + "_raw") as raw:
value = raw.read()
except Exception as err:
LOG.error("Error reading I2C device: " + str(err))
value = None
return value | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _read_i2c(fd, n):\n if n == 0:\n return b''\n buf = os.read(fd, n)\n if len(buf) != n:\n raise OSError(errno.EIO, os.strerror(errno.EIO))\n return buf",
"def read(self, register): #good\r\n\t\tcurrentVal = self.i2c.readU8(register)\r\n\t\treturn currentVal",
"def _i2c_read(self, r... | [
"0.71933854",
"0.7141151",
"0.70043665",
"0.679657",
"0.66493845",
"0.6602332",
"0.6516032",
"0.63425654",
"0.63419306",
"0.62273055",
"0.62273055",
"0.6206236",
"0.61949515",
"0.61949515",
"0.61196005",
"0.61109686",
"0.61014265",
"0.6043389",
"0.59487134",
"0.5927885",
"0.5... | 0.73743635 | 0 |
Function to set digital PIN value. | def setPIN(self, DPIN, value):
try:
with open('/sys/class/gpio/' + DPIN + '/value', 'a') as f:
f.write(value)
except Exception as err:
LOG.error("Error setting PIN value: " + str(err)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"async def digital_pin_write(self, pin, value):\n\n command = (PrivateConstants.SET_DIGITAL_PIN_VALUE, pin, value)\n\n await self._send_command(command)",
"def set(pin, val=1):\n if val not in [0,1]:\n raise RuntimeError\n GPIO.output(pin,val)",
"def Set(self,value):\n self.Bus... | [
"0.75729305",
"0.7364922",
"0.6986811",
"0.6898064",
"0.6795176",
"0.67899877",
"0.6787525",
"0.67728305",
"0.6735007",
"0.6669532",
"0.6632994",
"0.65423346",
"0.653754",
"0.64920366",
"0.6398399",
"0.6333039",
"0.6301748",
"0.62127906",
"0.61851203",
"0.61605304",
"0.615732... | 0.7687744 | 0 |
Processes the response from the proxy. If the tunnel is successfully created, notifies the client that we are ready to send requests. If not raises a TunnelError. | def processProxyResponse(self, bytes):
self._protocol.dataReceived = self._protocolDataReceived
if TunnelingTCP4ClientEndpoint._responseMatcher.match(bytes):
# print 'test: requestTunnel successfully'
self._protocol.transport.startTLS(self._contextFactory,
self._protocolFactory)
self._tu... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _handle_proxy_packet(self, pkt):\n if pkt.source[0] not in self.hosts:\n raise ServerPacketError('Received packet from unknown host')\n pkt.secret = self.hosts[pkt.source[0]].secret\n\n if pkt.code not in [PacketCode.ACCESS_ACCEPT, PacketCode.ACCESS_REJECT,\n ... | [
"0.5587567",
"0.5469762",
"0.5467382",
"0.542428",
"0.537138",
"0.5313755",
"0.53075236",
"0.52798104",
"0.5274118",
"0.5259868",
"0.5248621",
"0.5247179",
"0.523715",
"0.5236347",
"0.52206075",
"0.5212699",
"0.51765764",
"0.51717204",
"0.51508975",
"0.5145908",
"0.51360375",... | 0.7779374 | 0 |
Plot histogram of population fitness values | def plt_hist(pop, bin_limit=fit_range):
plt.hist(pop, bins=range(0,bin_limit+1))
plt.grid(True)
plt.title('Distribution of Population')
plt.show() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def plot_data(self,feature_idx):\r\n\t\tfig,ax = plt.subplots()\r\n\t\tax.set(title = 'Gaussian Histogram',ylabel = 'Frequency',xlabel = \"Chosen feature\")\r\n\t\tax.hist(self.x[feature_idx], edgecolor = 'black', facecolor = 'r')\r\n\t\tplt.show()",
"def geneticAlgorithmPlot(population, popSize, fittestSize, mu... | [
"0.66024387",
"0.64840144",
"0.64536685",
"0.63611174",
"0.63259864",
"0.61939675",
"0.6187393",
"0.61788845",
"0.6167037",
"0.6154359",
"0.60931194",
"0.6068298",
"0.60612893",
"0.60508525",
"0.60471725",
"0.60467935",
"0.60432434",
"0.60355425",
"0.60211074",
"0.6012157",
"... | 0.67125946 | 0 |
Check that instance can't be instantiated without implementation of the 'apply_connectivity_changes' | def test_apply_connectivity_changes(self):
with self.assertRaisesRegexp(TypeError, "Can't instantiate abstract class TestedClass with "
"abstract methods apply_connectivity_changes"):
self.tested_class() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def check_connection(self):\n pass",
"def test_cannot_be_instantiated(self):\n with self.assertRaises(NotImplementedError):\n Channel(0)",
"def _check_connection(self):\n if \"_connection\" not in self.__dict__:\n message = \"use connect method before doing operation ... | [
"0.6313133",
"0.6298124",
"0.61359864",
"0.61053586",
"0.6011557",
"0.59839636",
"0.5937353",
"0.5771025",
"0.56448454",
"0.5626299",
"0.5595381",
"0.5570998",
"0.5547566",
"0.5543715",
"0.553049",
"0.5529679",
"0.55031174",
"0.5496212",
"0.5473476",
"0.5470526",
"0.5464141",... | 0.7049147 | 0 |
Check the requests collection for orders to change the validity of an upload. | def check_for_requests(self):
while True:
doc = self.cc.requests_coll.find_one_and_delete(
{'receiver': 'validator'}, sort=[('_id', pymongo.ASCENDING)]
)
if doc is None:
break
if doc['action'] == 'validate_upload':
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"async def _check_order_update(self, *args, **kwargs):\n order_nos = list(self._orders.keys())\n if not order_nos:\n return\n for order_no in order_nos:\n success, error = await self._rest_api.get_order_status(order_no)\n if error:\n return\n ... | [
"0.6284529",
"0.5638963",
"0.5551693",
"0.5446516",
"0.53494304",
"0.53440046",
"0.53349584",
"0.5324783",
"0.5308333",
"0.53029424",
"0.53028655",
"0.5274873",
"0.5270222",
"0.5244655",
"0.5208642",
"0.5177385",
"0.5153453",
"0.51222587",
"0.51172185",
"0.5111013",
"0.510044... | 0.72320664 | 0 |
Assign a new action_id to every recently completed upload | def check_for_uploads(self):
def set_action_id_ops() -> Sequence[Tuple[UpdateOne, InsertOne]]:
find_query = {
'complete': True,
self.action_id_name: {'$exists': False},
'meta.format': {'$exists': True},
'meta.start_time': {'$exists': T... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_action(self, action):\n with self._mutex:\n _id = max(self._used_ids) if self._used_ids else 0\n while _id in self._used_ids:\n _id += 1\n self._actions[_id] = action\n self._used_ids.add(_id)\n self._workers[_id] = Thread(target=... | [
"0.6022013",
"0.5814392",
"0.56513506",
"0.5365241",
"0.5296398",
"0.5252554",
"0.524484",
"0.5203079",
"0.5201009",
"0.518607",
"0.51719576",
"0.5156348",
"0.51541024",
"0.5147858",
"0.51136595",
"0.5083526",
"0.5081598",
"0.50777394",
"0.50723493",
"0.5058067",
"0.50570077"... | 0.60786474 | 0 |
Scans the analyzers collection for analyzer modules that were executed and performs validation on their generated observations. If they are ok, the observations are committed to the observatory and a new action is inserted into the action_log. | def check_for_analyzers(self):
executed = self.analyzer_state.executed_analyzers()
for analyzer in executed:
# check for wish
if self.analyzer_state.check_wish(analyzer, 'cancel'):
print("validator: cancelled {} upon request".format(analyzer['_id']))
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def check(self):\r\n for action in self._actions:\r\n action.check()",
"def run_analyzers(args: argparse.Namespace):\n log = logging.getLogger(\"run\")\n model_repository = create_model_repo_from_args(args)\n log.info(\"Created %s\", model_repository)\n if args.request_server == \"a... | [
"0.6238496",
"0.5721421",
"0.5691736",
"0.56328654",
"0.5553783",
"0.54151267",
"0.53628486",
"0.53609884",
"0.53175175",
"0.5306766",
"0.5306371",
"0.52737206",
"0.5269958",
"0.5251529",
"0.524727",
"0.5210122",
"0.51994556",
"0.519592",
"0.5194466",
"0.51939213",
"0.5181274... | 0.73985136 | 0 |
Cleanup the oslo.messaging layer. | def cleanup():
global TRANSPORT, NOTIFIER
assert TRANSPORT is not None
assert NOTIFIER is not None
TRANSPORT.cleanup()
TRANSPORT = NOTIFIER = None | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def cleanup(self):\n self.msgmap.clear()\n self.droppedmsgs.clear()\n self.chan.stop_receiving_messages()\n\n # TODO: enable\n #self.cmdMap.clear()\n #self.cmdCliSubmitQueue.clear()\n #self.cmdSvrComputeQueue.clear()\n #self.droppedCommands.clear()\n #... | [
"0.7078813",
"0.6610845",
"0.65237373",
"0.6373199",
"0.63084286",
"0.6236432",
"0.62181246",
"0.62173826",
"0.6184065",
"0.6184065",
"0.6184065",
"0.6184065",
"0.6184065",
"0.6184065",
"0.6184065",
"0.6184065",
"0.6184065",
"0.6184065",
"0.6184065",
"0.6180252",
"0.6175269",... | 0.6849613 | 1 |
create soap envelope, and convert the structure to xml | def create_soap_envelope(self, rpc_name, cwmp_version="cwmp-1-0", rpc_args="", cwmp_id=""):
log.debug_info("create_soap_envelope")
try:
dict_envelope_attrib = {'xmlns:SOAP-ENV':'http://schemas.xmlsoap.org/soap/envelope/',
'xmlns:SOAP-ENC':'http://schemas.... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def buildxml(self):\n # assume self._objslock is already held here\n logger.info(\"Emane.buildxml()\")\n self.buildplatformxml()\n self.buildnemxml()\n self.buildtransportxml()\n self.buildeventservicexml()",
"def compile_SOAP_Message(self):\n SOAP_Message = \"\"\... | [
"0.6282234",
"0.5916893",
"0.580916",
"0.5804524",
"0.57287157",
"0.5636734",
"0.5617781",
"0.5475675",
"0.5451068",
"0.5409047",
"0.540611",
"0.53757817",
"0.53274316",
"0.53067744",
"0.5283993",
"0.5280287",
"0.52703387",
"0.5251362",
"0.5244601",
"0.52359813",
"0.5215179",... | 0.70732576 | 0 |
Look up the official Spore achievement name and text Call before getting any achievements | def loadAchievementList():
global achievements
achievements = {}
doc = minidom.parse(urllib.urlopen(serverString + "/data/achievements.xml"))
for element in doc.getElementsByTagName("achievement"):
key = element.getElementsByTagName("id")[0].firstChild.data
name = element.getElementsByTa... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getInfo(self):\n self.name, self.description = achievements[self.id]",
"async def achievements(self, ctx: commands.Context):\r\n # The milestones for each achievement type\r\n milestones_dict_of_achievements = {\r\n 'times_entertained': [5, 25, 100, 250, 500, 1000, 5000, 10... | [
"0.69373536",
"0.6452204",
"0.5869849",
"0.58177376",
"0.5670992",
"0.56469953",
"0.5529022",
"0.5513867",
"0.5397196",
"0.5384314",
"0.5366253",
"0.53638035",
"0.5319539",
"0.5274556",
"0.5223422",
"0.5214078",
"0.5207669",
"0.516536",
"0.5130748",
"0.51127976",
"0.5089797",... | 0.6527916 | 1 |
Store name and description (must have loadAchievementList called first) | def getInfo(self):
self.name, self.description = achievements[self.id] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def loadAchievementList():\n global achievements\n achievements = {}\n doc = minidom.parse(urllib.urlopen(serverString + \"/data/achievements.xml\"))\n for element in doc.getElementsByTagName(\"achievement\"):\n key = element.getElementsByTagName(\"id\")[0].firstChild.data\n name = elemen... | [
"0.6578054",
"0.6022761",
"0.59934604",
"0.58607906",
"0.5454128",
"0.5444996",
"0.54276216",
"0.53814185",
"0.53466827",
"0.533663",
"0.5291898",
"0.5203",
"0.51904",
"0.51902103",
"0.51061666",
"0.50983113",
"0.50593454",
"0.5032922",
"0.5029826",
"0.502053",
"0.4989219",
... | 0.7584774 | 0 |
Returns the URL for the official Spore achievement icon | def getIconUrl(self):
return "%s/static/war/images/achievements/%s.png" % (serverString, self.id) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def icon(self):\r\n try:\r\n return self.data['icon_url_base']+self.data['icon_url_name']\r\n except KeyError:\r\n return ''",
"def topcoat_icons_script_url():\n return static('topcoat-icons/font/icomatic.js')",
"def icon_url(self) -> Optional[pulumi.Input[str]]:\n ... | [
"0.68088615",
"0.62398684",
"0.6187419",
"0.614668",
"0.6083217",
"0.60764223",
"0.6037102",
"0.60287416",
"0.5939155",
"0.5892648",
"0.58391285",
"0.5833275",
"0.58286303",
"0.58108354",
"0.57967657",
"0.5791114",
"0.57819533",
"0.57819533",
"0.576867",
"0.5765713",
"0.57473... | 0.78774273 | 0 |
Get profile pic, tagline, user id and creation date | def getProfileInfo(self):
doc = minidom.parse(urllib.urlopen(serverString + "/rest/user/" + self.name))
for element in doc.getElementsByTagName("user")[0].childNodes:
if element.nodeType != minidom.Node.ELEMENT_NODE:
continue
elif element.tagName == "status" and i... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def profile_pic(request):\n if request.user.is_authenticated:\n profile_obj = CustomUser.objects.get(id__exact=request.user.id)\n pic = profile_obj.avatar\n return {'picture': pic}\n return {}",
"def getprofile(self, *args, **kwargs):\n return _image.image_getprofile(self, *args... | [
"0.6857109",
"0.66098845",
"0.6390527",
"0.636934",
"0.6362527",
"0.634142",
"0.62794304",
"0.62617004",
"0.62315524",
"0.62301964",
"0.62144315",
"0.61914563",
"0.61870426",
"0.6123204",
"0.6103439",
"0.60492516",
"0.60465515",
"0.6041822",
"0.60295165",
"0.59979457",
"0.598... | 0.66463876 | 1 |
Get number of achievements for the user and a list of achievement ids and unlockdates | def getAchievements(self, start=None, length=5):
if start == None:
start = len(self.achievements)
doc = minidom.parse(urllib.urlopen("%s/rest/achievements/%s/%i/%i" % (serverString, self.name, start, length)))
if int(doc.getElementsByTagName("status")[0].firstChild.data) != 1:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"async def achievements(self, ctx: commands.Context):\r\n # The milestones for each achievement type\r\n milestones_dict_of_achievements = {\r\n 'times_entertained': [5, 25, 100, 250, 500, 1000, 5000, 10000, 100000, 1000000],\r\n 'times_fed': [5, 25, 25, 50, 100, 500, 1000... | [
"0.69487524",
"0.6321113",
"0.59182847",
"0.58167964",
"0.5750584",
"0.55335814",
"0.5509203",
"0.5495019",
"0.5376555",
"0.53676915",
"0.52398944",
"0.5217144",
"0.51565796",
"0.5069992",
"0.5047279",
"0.5040224",
"0.5028878",
"0.50272846",
"0.50176144",
"0.5015113",
"0.5011... | 0.6477453 | 1 |
Get various stats like height, diet, abilities etc. for a creature | def getStats(self):
if self.type != "CREATURE" and self.type != None:
return
self.stats = _xmlUrlToDict(serverString + "/rest/creature/" + self.id, float) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_character_health(character: dict):\r\n print(\"Your health is: %d\" % character['HP'])",
"def get_damage():\n\n return character['Damage']",
"def get_hp():\n\n return character['HP']",
"def stats(self):\n\n for hero in self.heroes:\n print(\"{} has {} kills and {} deaths.\"... | [
"0.6707282",
"0.6460665",
"0.6290449",
"0.61498976",
"0.60784054",
"0.60689604",
"0.60551375",
"0.59991527",
"0.59783566",
"0.595218",
"0.58617675",
"0.5846617",
"0.5796851",
"0.5701261",
"0.5671675",
"0.5670004",
"0.56550676",
"0.5632438",
"0.5631292",
"0.56186575",
"0.56045... | 0.7294973 | 0 |
Get asset id, and name for assets in a sporecast. | def sporecastAssets(sporecastId, start=0, length=20):
url = "%s/rest/assets/sporecast/%s/%i/%i" % (serverString, sporecastId, start, length)
doc = minidom.parseString(urllib.urlopen(url).read().decode("utf-8", "ignore").encode("ascii", "xmlcharrefreplace"))
if int(doc.getElementsByTagName("status")[0].first... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sid(self) -> Asset:\n return self.asset",
"def assetName(self):\n\t\treturn self._assetName",
"def asset_id(self) -> str:\n return self.__asset_id",
"def get_name_and_meta(self, asset):\n # Get the asset ID.\n asset_cache_key = asset.get_cache_key()\n name_and_meta = se... | [
"0.6362689",
"0.6348786",
"0.6256097",
"0.62524766",
"0.6244972",
"0.6203028",
"0.61857486",
"0.6132029",
"0.6098499",
"0.6091878",
"0.6044701",
"0.60265857",
"0.6021814",
"0.5971793",
"0.5933424",
"0.589987",
"0.5830877",
"0.5795518",
"0.5786101",
"0.5748652",
"0.5727737",
... | 0.64142394 | 0 |
The interest will be 10 percent per annum compounded monthly using the 30/360 US day count convention . | def interest(self, from_date, to_date):
yearfrac = findates.daycount.yearfrac(from_date,
to_date,
"30/360 US")
months = yearfrac * 12
return Decimal((1.0 + \
self.annual_interest_rate / 12.... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __calculate_monthly_interest(self):\n return self.__percentage_interest / 12",
"def _prorata_rate(self, days_used, days_in_month):\n return (100 * days_used // days_in_month) / 100.0",
"def calculate(self):\n self._emi_months = self._period * 12\n self._total_interest = math.cei... | [
"0.7366988",
"0.61610496",
"0.60701096",
"0.59977466",
"0.5990223",
"0.5928109",
"0.5894441",
"0.5854523",
"0.58104223",
"0.5760911",
"0.57510215",
"0.5710957",
"0.5657481",
"0.56404054",
"0.56403047",
"0.56179816",
"0.55730104",
"0.5527004",
"0.549311",
"0.5468215",
"0.54577... | 0.7286555 | 1 |
Any principal amounts in this loan will be paid in Hong Kong dollars. Any accured interest shall be paid in the form of Bitcoin with the interest rate calculated in Hong Kong dollars | def payments(self, loan):
self.currency_interest = "XBT"
"""The lender agrees to provide the borrower half of the loan amount
on the initial loan on the initial date"""
loan.fund(on=self.initial_loan_date,
amount=self.total_loan_amount * \
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self):\n self.annual_interest_rate = 10.0 / 100.0\n self.initial_loan_date = date(2014, 12, 1)\n self.currency = 'HKD'\n self.total_loan_amount = Money('100000.00', 'HKD')\n self.final_payment_date = self.initial_loan_date + \\\n ... | [
"0.65862256",
"0.6448981",
"0.6371054",
"0.6341864",
"0.62965953",
"0.62625",
"0.61843383",
"0.6176643",
"0.612621",
"0.6064576",
"0.60598963",
"0.60487306",
"0.598384",
"0.58938223",
"0.58387935",
"0.5828344",
"0.58106977",
"0.5804773",
"0.5758548",
"0.57565445",
"0.5748683"... | 0.676511 | 0 |
Method returns QuerySet of orders of matched shift. | def get_orders_with_shift(shift_id):
return Order.objects.filter(shift_id=shift_id) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def orders(self):\n return self._orders",
"def orders(self) -> List[MetatraderOrder]:\n return self._orders",
"def get_orders(self):\n return self.order_lst",
"def queryset(self, request):\n qs = self.model.all_objects.get_query_set()\n ordering = self.ordering or ()\n ... | [
"0.6120419",
"0.6019099",
"0.5978205",
"0.5944654",
"0.58207524",
"0.5806931",
"0.57802045",
"0.57569706",
"0.56282717",
"0.55805904",
"0.5565082",
"0.5544036",
"0.55177367",
"0.55061555",
"0.5448757",
"0.5423498",
"0.5401589",
"0.5366619",
"0.53172815",
"0.5313821",
"0.53027... | 0.7151643 | 0 |
Return sales per category { | def get_context_data(self, **kwargs):
start, end = self.get_start_end_dates(self.request)
if start or end is not None:
category_list = []
misc_items = 0
discount = 0
category_sales = {}
count_test_items = 0
out = {}
tot... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def view_total_sales():\n # Later will add the ability to sort by date and Category\n try:\n with session_scope() as db_session:\n orders = db_session.query(Order).all()\n\n if len(orders) < 1:\n return {\n 'code': 404,\n ... | [
"0.62891865",
"0.603454",
"0.60087216",
"0.59924215",
"0.59762335",
"0.59438944",
"0.5927264",
"0.5879687",
"0.5754501",
"0.57487327",
"0.5735331",
"0.5724742",
"0.5700442",
"0.5695713",
"0.56687236",
"0.5666951",
"0.5654417",
"0.55597746",
"0.5549785",
"0.55187017",
"0.55146... | 0.61560917 | 1 |
Apply filters so Datacontainer object | def apply_filters(self, filters):
self._data = self.model.objects.filter(**filters) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def filter(self, filters):",
"def filter_data(self):\n self.data = filter_pandas(self.data, self.filters)",
"def filter_data(self, data):\n for f in self.filters:\n data = getattr(self, f)(data)\n return data",
"def _applyFilters(self) -> None:\n self._dataframe = self.... | [
"0.73095095",
"0.71926576",
"0.69960827",
"0.66669726",
"0.6536904",
"0.6523246",
"0.64838815",
"0.64456093",
"0.642133",
"0.6333619",
"0.6310267",
"0.62748665",
"0.6264728",
"0.62351424",
"0.61123586",
"0.6049168",
"0.6038185",
"0.6031785",
"0.6025596",
"0.6010805",
"0.60105... | 0.7357808 | 0 |
Apply annotation to datacontainer object | def annotate(self, annotation):
self._data = self._data.annotate(**annotation) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _convert_annotations(self, ast):\n self.annotations = IDLAnnotations(ast)",
"def annotate(self, **annotations):\n _check_annotations(annotations)\n self.annotations.update(annotations)",
"def annotate(self, annotation_=None):\n # Important: Need a copy, not the reference to the ... | [
"0.6233152",
"0.60961413",
"0.60317147",
"0.5947871",
"0.5821766",
"0.57982534",
"0.5784234",
"0.57694525",
"0.5739188",
"0.56861943",
"0.56736404",
"0.56035674",
"0.55868423",
"0.55451065",
"0.55258566",
"0.55225915",
"0.5500008",
"0.54937",
"0.548274",
"0.54651",
"0.5452524... | 0.7512382 | 0 |
Apply aggregation to datacontainer object | def aggregate(self, aggregation):
self._data = self._data.aggregate(**aggregation) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_aggregation_data(self, payload):\n raise NotImplementedError()",
"def aggregate_query(self):\n raise NotImplementedError",
"def _aggregation_target(self):\n ...",
"def aggregate(self, arg):\n return self.agg(arg)",
"def aggregate(self, *args, **kwargs):\n raise No... | [
"0.7029448",
"0.6770916",
"0.6738702",
"0.6578427",
"0.6575661",
"0.6472465",
"0.6460138",
"0.64330184",
"0.64211506",
"0.6398619",
"0.6384194",
"0.6379172",
"0.6363482",
"0.6252356",
"0.616049",
"0.6106326",
"0.6095447",
"0.60918665",
"0.60694814",
"0.6055015",
"0.60463846",... | 0.74370414 | 0 |
Stop all timers in a canvas. | def _stop_timers(canvas):
for attr in dir(canvas):
try:
attr_obj = getattr(canvas, attr)
except NotImplementedError:
# This try/except is needed because canvas.position raises
# an error (it is not implemented in this backend).
attr_obj = None
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def cancel_all(self):\n for timer in self._timers:\n timer.Stop()",
"def stopAll():\n master = MasterTimer.getMasterTimer()\n\n for timer in master.timers.values():\n timer.over_start = 0 # deal with what recursion may have caused\n timer.stop()\n\n _... | [
"0.7255637",
"0.70239574",
"0.69405055",
"0.6344354",
"0.62706256",
"0.61834806",
"0.61712563",
"0.616413",
"0.6134287",
"0.60338205",
"0.6012264",
"0.59403634",
"0.59361386",
"0.5933978",
"0.5830889",
"0.58190876",
"0.5800669",
"0.57923174",
"0.5773049",
"0.57693774",
"0.575... | 0.78883404 | 0 |
Logit crossentropy loss with masking. | def masked_logit_cross_entropy(preds, labels, mask):
loss = tf.nn.sigmoid_cross_entropy_with_logits(logits=preds, labels=labels)
loss = tf.reduce_sum(loss, axis=1)
mask = tf.cast(mask, dtype=tf.float32)
mask /= tf.maximum(tf.reduce_sum(mask), tf.constant([1.]))
loss *= mask
return tf.reduce_mean... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def masked_softmax_cross_entropy(logits, labels, mask):\n loss = tf.nn.softmax_cross_entropy_with_logits(logits=logits, labels=labels)\n mask = tf.cast(mask, dtype=tf.float32)\n mask /= tf.reduce_mean(mask)\n loss *= mask\n return tf.reduce_mean(loss)",
"def masked_softmax_cros... | [
"0.8175898",
"0.78751826",
"0.78335226",
"0.78063595",
"0.78063595",
"0.78063595",
"0.77657765",
"0.77401185",
"0.7647151",
"0.7540406",
"0.7469373",
"0.7366661",
"0.73047715",
"0.7263361",
"0.70555925",
"0.7047556",
"0.7037855",
"0.7005814",
"0.69924366",
"0.69920903",
"0.69... | 0.82311463 | 0 |
L2 loss with masking. | def masked_l2(preds, actuals, mask):
loss = tf.nn.l2(preds, actuals)
mask = tf.cast(mask, dtype=tf.float32)
mask /= tf.reduce_mean(mask)
loss *= mask
return tf.reduce_mean(loss) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def l2_loss(input, target):\n pos_inds = torch.nonzero(target > 0.0).squeeze(1)\n if pos_inds.shape[0] > 0:\n cond = torch.abs(input[pos_inds] - target[pos_inds])\n loss = 0.5 * cond**2 / pos_inds.shape[0]\n else:\n loss = input * 0.0\n return loss.sum()... | [
"0.7192427",
"0.7092018",
"0.6669804",
"0.6657751",
"0.65931445",
"0.6583433",
"0.6574499",
"0.6478774",
"0.6429942",
"0.63954186",
"0.63901883",
"0.63768196",
"0.6355528",
"0.6325545",
"0.63063776",
"0.6249161",
"0.6247764",
"0.6239328",
"0.6223718",
"0.6219932",
"0.62042207... | 0.7907347 | 0 |
Indicator function for zero elements z. | def fun(self, x):
if np.any(x[self._z] != 0):
return np.inf
else:
return 0 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def step(z):\n result = np.zeros_like(z)\n result[z > 0] = 1.0\n return result",
"def closure(Z):\r\n Z = np.array(Z)\r\n Z = Z/float(np.sum(Z))\r\n if any(Z < 0):\r\n return None\r\n else:\r\n return Z",
"def alpha_where_z_not_zero(z, x, beta2):\n\n arg1 = np.sqrt(2 * np.... | [
"0.6553376",
"0.6466061",
"0.63404375",
"0.62919295",
"0.62098426",
"0.61954325",
"0.61022073",
"0.6096026",
"0.60554713",
"0.6028677",
"0.60004807",
"0.600019",
"0.5950524",
"0.59340006",
"0.5925675",
"0.59205705",
"0.59179205",
"0.59094787",
"0.5909203",
"0.58988225",
"0.58... | 0.7281125 | 0 |
Toma el nombre de la tabla, las columnas a mostrar, y el query (como un where o un inner join), esta parte es opcional e imprime el resultado del query | def make_query(table_name, cols, query):
str_query = None
if query == None:
str_query = "SELECT {} FROM {};".format(cols, table_name)
else:
str_query = "SELECT {} FROM {} {};".format(cols, table_name, query)
print(">>>ejecutando: ", str_query)
sistema.cursor.execute(str_query)
for... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def construct_result_table(self, biomodels):\n select = 'SELECT DISTINCT '\n cached_alias = 'c'\n join_exps = 'FROM %s_%s AS %s' % (self.app_label, \n settings.DISBI['JOINED_TABLENAME'], \n cached_alias)\n ... | [
"0.601532",
"0.59708345",
"0.5957253",
"0.5854742",
"0.5854742",
"0.58174795",
"0.58170044",
"0.5810371",
"0.5797387",
"0.5764381",
"0.57541776",
"0.5746789",
"0.5740096",
"0.57264084",
"0.5715317",
"0.5706358",
"0.56669486",
"0.5631278",
"0.5615111",
"0.5588208",
"0.5562837"... | 0.64813566 | 0 |
Parses through the 'inventory' parameter in target_objs to fetch the remote inventories and stores it in save_dir before recursively copying it to the output_path (relative to the inventory path) Overwrites existing inventory items if force fetched | def fetch_inventories(inventory_path, target_objs, save_dir, force, pool):
git_inventories = defaultdict(list)
http_inventories = defaultdict(list)
# To ensure no duplicate output path
inv_output_path = defaultdict(set)
for target_obj in target_objs:
try:
inventories = target_ob... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def pseudo_build_inventory(self, inventory_update, private_data_dir):\n src = inventory_update.source\n\n injector = None\n if inventory_update.source in InventorySource.injectors:\n injector = InventorySource.injectors[src]()\n\n if injector is not None:\n content... | [
"0.5402499",
"0.53651613",
"0.5304608",
"0.5192518",
"0.5163583",
"0.51302993",
"0.5085026",
"0.50551826",
"0.49963874",
"0.49099976",
"0.48465687",
"0.4845763",
"0.48405397",
"0.48283368",
"0.4792837",
"0.4774951",
"0.47671747",
"0.47575256",
"0.4754527",
"0.47445658",
"0.47... | 0.7771995 | 0 |
load probe names frome file | def load_probes(probe_file):
probes = common.read_file(probe_file)
probe_list = list(filter(None, probes))
return probe_list | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def load(name):\n return []",
"def load_specs(self, filename):\n self.filename = filename\n # Add loading functionality here",
"def load_specs(self, filename):\n self.filename = filename\n # Add loading functionality here",
"def load_people(self, file_path):\n pass",
"... | [
"0.64903796",
"0.6430997",
"0.6430997",
"0.6164019",
"0.61238116",
"0.59681827",
"0.58534676",
"0.5852975",
"0.5834001",
"0.58317584",
"0.58097345",
"0.5800229",
"0.57658803",
"0.5750195",
"0.5747341",
"0.5730893",
"0.5716048",
"0.56928027",
"0.56847095",
"0.5663239",
"0.5639... | 0.70129216 | 0 |
Get the virtual addr of probes. | def get_probe_address(elf_path, probes, section='.text'):
assert len(probes) <= 26, 'Too many probes'
text_data = objdump_section(elf_path, '.text')
name_to_addr = parse_func_names(text_data)
probe_names = list(string.ascii_uppercase)
name_idx = 0
ret = []
for probe in probes:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_vasp_address(self):\n return self.vasp_addr",
"def _get_virtual_oper_VipV6_address(self):\n return self.__virtual_oper_VipV6_address",
"def virtual_router_ip(self):\n return self._virtual_router_ip",
"def addr(self):\r\n return self._addr",
"def Vaddr_breakdown(self, addr):\... | [
"0.65414345",
"0.6157455",
"0.6135771",
"0.5897749",
"0.5837022",
"0.57624984",
"0.5688131",
"0.56795603",
"0.5670054",
"0.564151",
"0.5618105",
"0.5552885",
"0.555211",
"0.5512466",
"0.5505781",
"0.5505781",
"0.5487975",
"0.5483153",
"0.54597396",
"0.5440602",
"0.5429957",
... | 0.638283 | 1 |
Load the COMPAS recidivism dataset. The purpose of this dataset is to predict whether a criminal will recidivate within two years of release. | def load_recidivism(return_X_y=False):
return _load_dataset(
'compas/two-year-recidivism.csv',
target='two_year_recid',
return_X_y=return_X_y
) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def load_crime():\n\n # LOAD DATA FROM FILE.\n # filename = \"resources\\CommViolPredUnnormalizedData.csv\"\n filename = os.path.join('resources', 'CommViolPredUnnormalizedData.csv')\n data = pd.read_csv(filename, header=0, sep=';', na_values='?', skipinitialspace=True)\n data = data.sample(frac=1, ... | [
"0.6137884",
"0.5845019",
"0.57248294",
"0.5718205",
"0.5666465",
"0.55472314",
"0.5543531",
"0.55415714",
"0.54749215",
"0.5438623",
"0.5411372",
"0.5403246",
"0.5398308",
"0.53844136",
"0.5298849",
"0.529671",
"0.5291875",
"0.52728283",
"0.52658653",
"0.52654713",
"0.52479"... | 0.6738154 | 0 |
Load the GDP growth dataset (from FRED data). The purpose of this dataset is to forecast GDP growth based on macroeconomic variables. | def load_gdp(return_X_y=False):
return _load_dataset(
'gdp/GDP-growth.csv',
target='GDP_g',
return_X_y=return_X_y
) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sample_fg(path):\n import pandas as pd\n path = os.path.expanduser(path)\n filename = 'sample_fg.csv'\n if not os.path.exists(os.path.join(path, filename)):\n url = 'http://dustintran.com/data/r/Stat2Data/SampleFG.csv'\n maybe_download_and_extract(path, url,\n save_file_... | [
"0.5956029",
"0.5645633",
"0.55883247",
"0.55594856",
"0.5555773",
"0.54849714",
"0.5457794",
"0.5436919",
"0.5369149",
"0.5354158",
"0.52888817",
"0.52768093",
"0.5245818",
"0.52390873",
"0.5233721",
"0.5226974",
"0.52218026",
"0.52175444",
"0.51985455",
"0.51948434",
"0.519... | 0.72741246 | 0 |
Sets the nickname of this GetSesameResponse. | def nickname(self, nickname):
if nickname is None:
raise ValueError("Invalid value for `nickname`, must not be `None`") # noqa: E501
self._nickname = nickname | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_nickname(self, nickname):\n \n if len(nickname) > globals.MAX_NICKNAME_LENGTH:\n nick = nickname[0:globals.MAX_NICKNAME_LENGTH-3]+\"...\"\n else:\n nick = nickname\n \n self._nickname.set_message(nick)",
"def nickname(self, new_nickname):\r\n ... | [
"0.6738245",
"0.6678954",
"0.6415821",
"0.6341075",
"0.6067638",
"0.5979994",
"0.5887139",
"0.5860738",
"0.577463",
"0.57002896",
"0.55578184",
"0.5484942",
"0.54815024",
"0.54040253",
"0.540214",
"0.5382869",
"0.53730917",
"0.53687507",
"0.53608084",
"0.5348472",
"0.53451854... | 0.69570684 | 0 |
returns true if password is 1030 characters long and consists of letters and numbers | def validate_password(password):
if re.match(r"^[a-zA-Z0-9]{10,30}$", password):
return True
return False | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def validate_password(password):\n return isinstance(password, str) and len(password) >= 8 and \\\n re.search(r'[A-Z]', password) and re.search(r'[0-9]', password)",
"def password_validates(password):\n if any(char.isdigit() for char in password) \\\n and any(char.isal... | [
"0.8082899",
"0.8026214",
"0.7925359",
"0.7862876",
"0.7859197",
"0.78590196",
"0.780382",
"0.774973",
"0.773781",
"0.77359647",
"0.76997024",
"0.7637889",
"0.76283514",
"0.76140875",
"0.7501108",
"0.74899054",
"0.7432814",
"0.74295545",
"0.74141884",
"0.7379572",
"0.7365518"... | 0.8334488 | 0 |
Iterates over the pages of an API operation results. Paginators act as an abstraction over the process of iterating over an entire result set of a truncated API operation. Yields an iterable with the response obtained from applying `method`. | def paginate(
client: client, method: str, **kwargs: Dict[str, Any]
) -> Generator[Dict[str, Any], None, None]:
paginator = client.get_paginator(operation_name=method)
for page in paginator.paginate(**kwargs):
yield page | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __iter__(self):\n while self.has_next_page():\n response = self.get_next_page_response()\n for item in self.get_items_from_response(response):\n yield item",
"def iterateAllPaginated(self, resource, func=dict):\n\n res = self.getRequest(resource)\n pa... | [
"0.71955776",
"0.711028",
"0.70803607",
"0.6967728",
"0.694704",
"0.69221467",
"0.69088256",
"0.6870713",
"0.6851433",
"0.681792",
"0.67492384",
"0.6684067",
"0.6684067",
"0.6591044",
"0.6528769",
"0.64971346",
"0.6483189",
"0.64801604",
"0.6460868",
"0.6440734",
"0.64176244"... | 0.7691072 | 0 |
Function add a new paragraph in two files (main+answers) | def input_file_docx(str_write, str_answer):
paragraph = dti.add_paragraph(str_write)
paragraph_format = paragraph.paragraph_format
paragraph_format.space_after = Pt(1.0)
paragraph = dti1.add_paragraph(str_answer)
paragraph_format = paragraph.paragraph_format
paragraph_format.space_after ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def m_func1(p1,p2):\r\n if p2==1 :\r\n f=open(\"Mehjabin_Diet.text\",\"a\")\r\n f.write(str(p1))\r\n f.write(\"\\n\")\r\n f.write(input(\" \"))\r\n f.write(\"\\n\")\r\n f.write(\"*********************************************\\n\")\r\n f.close()\r\n else :\r\n\... | [
"0.6011007",
"0.59650946",
"0.59082407",
"0.5866411",
"0.57768893",
"0.5753639",
"0.5731659",
"0.5672916",
"0.56459105",
"0.5576199",
"0.54995733",
"0.5464282",
"0.5458846",
"0.545788",
"0.5384909",
"0.5362748",
"0.5355174",
"0.5349958",
"0.53219575",
"0.53206825",
"0.5305007... | 0.6053899 | 0 |
Authorizes outbrain object If token exists in yaml, outbrain object will get the attribute "token" with the token string If token was generated more than 28 days ago, it gets another token, and adds it to the outbrain object as the new token attribute If the token is still valid, no new token is requested | def authorize(outb, creds):
try:
outb.token = creds["token"]
token_gen_date = datetime.datetime.strptime(creds["token_generated_on"], "%Y-%m-%d__%H_%M_%S")
# Convert token generated date to datetime object for comparison
if (datetime.datetime.now() - datetime.timedelta(days=28)) > t... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def UserToken(self) -> object:",
"def auth_token(self):",
"def authorize(event, context):\n token = event['authorizationToken']\n log.debug(\"Token: {}\".format(token))\n principalId = token\n context = {\n 'simpleAuth': True,\n }\n\n table = dynamodb.Table(os.environ['ACCESSTOKENS_TAB... | [
"0.61070186",
"0.59754103",
"0.5947583",
"0.5901249",
"0.5759543",
"0.55899185",
"0.5571527",
"0.5571527",
"0.5571527",
"0.55064756",
"0.5453319",
"0.5414617",
"0.5396474",
"0.53617793",
"0.5358859",
"0.5350986",
"0.53467685",
"0.53420526",
"0.53314936",
"0.53241503",
"0.5323... | 0.75723505 | 0 |
Returns a list of dicts with all the campaign ids and names for the marketer_id | def get_camp_ids_names_containing_str(marketer_id, string):
all_campaigns = outb.get_campaigns_per_marketer(marketer_id).get(marketer_id[0])
return [{"id": x.get("id"), "name": x.get("name")} for x in all_campaigns if string in x["name"]] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_campaign_name_list(self):\n campaigns = self.find('campaigns', {})\n campaign_names = []\n for campaign in campaigns:\n if 'name' in campaign:\n campaign_names.append(campaign['name'])\n return campaign_names",
"def get_camp_ids_containing_str(markete... | [
"0.6336228",
"0.5713501",
"0.54453236",
"0.5416744",
"0.5313876",
"0.5302328",
"0.527812",
"0.52746725",
"0.52378",
"0.52117795",
"0.51517314",
"0.5144151",
"0.5099462",
"0.50789464",
"0.5026485",
"0.50255877",
"0.5013553",
"0.4979689",
"0.49762148",
"0.49588078",
"0.48971602... | 0.60787266 | 1 |
Returns a list of campaign IDs which contain a given string | def get_camp_ids_containing_str(marketer_id, string):
all_campaigns = outb.get_campaigns_per_marketer(marketer_id).get(marketer_id[0])
return [x.get("id") for x in all_campaigns if string in x["name"]] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_camp_ids_names_containing_str(marketer_id, string):\n all_campaigns = outb.get_campaigns_per_marketer(marketer_id).get(marketer_id[0])\n return [{\"id\": x.get(\"id\"), \"name\": x.get(\"name\")} for x in all_campaigns if string in x[\"name\"]]",
"def get_targeted_campaign_ids(client, customer_id, ... | [
"0.74002934",
"0.6311458",
"0.6043576",
"0.59890044",
"0.5851982",
"0.5620958",
"0.55856144",
"0.54602367",
"0.5436344",
"0.53730243",
"0.5317115",
"0.5297271",
"0.5277343",
"0.52691776",
"0.5260588",
"0.5248432",
"0.52466613",
"0.5192293",
"0.5143308",
"0.5125682",
"0.511514... | 0.8058569 | 0 |
Transforms the result of get_campaign_performance_per_period() function, and only includes campaign IDs that are in the list of camp_ids_to_filter | def transform_and_filter_result(result,camp_ids_to_filter):
final_result = list()
for x in result[0][0]:
if x["campaignId"] in camp_ids_to_filter:
result_per_id = list()
for result in x["results"]:
result_per_id_per_day = dict()
# The resulting dic... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_campaigns_in_interval(self, start_time, end_time, **kwargs):\n \n if 'campaign_filter' in kwargs:\n campaign_filter = kwargs['campaign_filter']\n if not(isinstance(campaign_filter, str)):\n campaign_filter = ''\n else:\n campaign_... | [
"0.6190147",
"0.5855874",
"0.5680206",
"0.5596478",
"0.53977025",
"0.53867006",
"0.5180743",
"0.51532555",
"0.5137389",
"0.5134193",
"0.51274616",
"0.5112135",
"0.5054796",
"0.5053313",
"0.5045526",
"0.5037804",
"0.50288117",
"0.49338433",
"0.49244148",
"0.49209902",
"0.49091... | 0.71021146 | 0 |
Given a lookup_type of 'year', 'month', 'day' or 'week_day', returns the SQL that extracts a value from the given date field field_name. | def date_extract_sql(self, lookup_type, field_name):
if lookup_type == 'week_day':
# DAYOFWEEK() returns an integer, 1-7, Sunday=1.
# Note: WEEKDAY() returns 0-6, Monday=0.
return "DAYOFWEEK(%s)" % field_name
elif lookup_type == 'week':
return "WEEK(%s)" %... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def date_extract_sql(self, lookup_type, field_name):\n return \"EXTRACT(%s FROM %s)\" % (lookup_type, field_name)",
"def get_prep_lookup(self, lookup_type, value):\n\n if hasattr(value, 'prepare'):\n return value.prepare()\n if hasattr(value, '_prepare'):\n return value... | [
"0.78950274",
"0.5761999",
"0.5541615",
"0.5541615",
"0.52907443",
"0.52887756",
"0.5265657",
"0.5236816",
"0.5213454",
"0.5026723",
"0.50044376",
"0.49397483",
"0.48385435",
"0.47717372",
"0.4744608",
"0.4740956",
"0.47128138",
"0.47058564",
"0.46687573",
"0.46597868",
"0.46... | 0.836405 | 0 |
Given a column type (e.g. 'BLOB', 'VARCHAR'), returns the SQL necessary to cast it before using it in a WHERE statement. Note that the resulting string should contain a '%s' placeholder for the column being searched against. | def field_cast_sql(self, db_type, internal_type=None):
if db_type and db_type.lower() == 'blob':
return 'CAST(%s as nvarchar)'
return '%s' | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def python_type_to_sql_type(_python_type):\n if _python_type == str:\n return 'string'\n elif _python_type == bytes:\n return \"blob\"\n elif _python_type == float:\n return \"float\"\n elif _python_type == int:\n return \"integer\"\n elif _python_type == datetime:\n ... | [
"0.6239577",
"0.6223429",
"0.61100966",
"0.60024476",
"0.5870205",
"0.58654475",
"0.57926273",
"0.5771992",
"0.5766482",
"0.5717607",
"0.56727433",
"0.56491125",
"0.5609501",
"0.55463326",
"0.5472974",
"0.5444695",
"0.5438208",
"0.5438205",
"0.54337585",
"0.5425272",
"0.54252... | 0.6790866 | 0 |
Given a cursor object that has just performed an INSERT/OUTPUT statement into a table that has an autoincrementing ID, returns the newly created ID. | def fetch_returned_insert_id(self, cursor):
return cursor.fetchone()[0] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def returnInsertID(self):\n try:\n return self.cursor.lastrowid\n except Exception as e:\n print \"Error getting insert id %s \" % e",
"def returnInsertID(self):\n try:\n return self.db.insert_id()\n except MySQLdb.Error as e:\n print \"Erro... | [
"0.72980887",
"0.6936921",
"0.6831432",
"0.6586946",
"0.65387934",
"0.6439575",
"0.6336456",
"0.63056076",
"0.627088",
"0.6255386",
"0.6252701",
"0.62023705",
"0.6180922",
"0.6173137",
"0.6164245",
"0.6139721",
"0.61370486",
"0.6100954",
"0.60723114",
"0.6048889",
"0.6044164"... | 0.7289031 | 1 |
Returns a quoted version of the given table, index or column name. Does not quote the given name if it's already been quoted. | def quote_name(self, name):
if name.startswith(self.left_sql_quote) and name.endswith(self.right_sql_quote):
return name # Quoting once is enough.
return '%s%s%s' % (self.left_sql_quote, name, self.right_sql_quote) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def quote_dotted(\n name: Union[\"quoted_name\", str], quote: functools.partial\n) -> Union[\"quoted_name\", str]:\n\n if isinstance(name, quoted_name):\n return quote(name)\n result = \".\".join([quote(x) for x in name.split(\".\")])\n return result",
"def sql_for_tablespace(self, tablespace,... | [
"0.60627484",
"0.5968109",
"0.5906213",
"0.5800245",
"0.5722166",
"0.5646786",
"0.55683017",
"0.5497559",
"0.54963726",
"0.54942673",
"0.54909176",
"0.5466382",
"0.5427123",
"0.54071015",
"0.54071015",
"0.5401644",
"0.53815466",
"0.5361875",
"0.53616196",
"0.5352527",
"0.5338... | 0.66145134 | 0 |
Returns a SQL expression that returns a random value. | def random_function_sql(self):
return "RAND()" | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_random_query() -> str:\n\n # Generate a list of random columns.\n columns = get_random_columns()\n arithmetic_exprs = [get_random_arithmetic_expr()\n for _ in range(random.randint(0, 2))]\n arithmetic_exprs = [\n f\"{expr[0]}{expr[1]}{expr[2]}\" for expr in arithme... | [
"0.71786726",
"0.6782727",
"0.656452",
"0.63139075",
"0.6294503",
"0.60930663",
"0.60634965",
"0.60624295",
"0.6041429",
"0.60379696",
"0.603706",
"0.6012389",
"0.6007451",
"0.5995923",
"0.5967113",
"0.59594595",
"0.5940236",
"0.5913576",
"0.5902262",
"0.5893886",
"0.5883036"... | 0.8177851 | 0 |
Returns a string of the query last executed by the given cursor, with placeholders replaced with actual values. `sql` is the raw query containing placeholders, and `params` is the sequence of parameters. These are used by default, but this method exists for database backends to provide a better implementation according... | def last_executed_query(self, cursor, sql, params):
return super(DatabaseOperations, self).last_executed_query(cursor, cursor.last_sql, cursor.last_params) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def execute(self, sql, params=None):\n if params is None:\n for statement in sql.split(';'):\n self.cursor.execute(statement)\n return\n print('string parameters get escaped to guard against sql injection')\n print(\"resulting sql is \" + \\\n sq... | [
"0.6624555",
"0.62363774",
"0.5814773",
"0.58146745",
"0.5813312",
"0.57900816",
"0.57399",
"0.56984067",
"0.5682154",
"0.5672558",
"0.5627463",
"0.56166804",
"0.5593889",
"0.556798",
"0.5483629",
"0.5471066",
"0.54700255",
"0.5422969",
"0.5385744",
"0.5356096",
"0.53469515",... | 0.63921547 | 1 |
Returns the SQL for committing the given savepoint. | def savepoint_commit_sql(self, sid):
return "REMOVE SAVEPOINT %s" % self.quote_name(sid) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _do_commit(self):",
"def commit():\n get_db().commit()",
"def quickSqlWrite(self,s,v):\n self.conn()\n self.execute(s,v)\n self.commit()\n self.close()",
"def commit(cls, sql, **kwargs):\n conn = kwargs['conn']\n\n cursor = conn.cursor(dictionary=True, buffere... | [
"0.59211785",
"0.5635704",
"0.5527037",
"0.5473119",
"0.543951",
"0.5430877",
"0.5415368",
"0.53850543",
"0.53623307",
"0.5356949",
"0.5353716",
"0.5352036",
"0.53104126",
"0.5298429",
"0.52913463",
"0.52817005",
"0.52312577",
"0.5219302",
"0.52135074",
"0.5188443",
"0.518284... | 0.71807504 | 0 |
Returns the SQL statement required to start a transaction. | def start_transaction_sql(self):
return "BEGIN TRANSACTION" | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def start_transaction_sql(self):\n return 'START TRANSACTION;'",
"def start_transaction(self):\n self._connection.execute_nonquery(\"sql\", \"START TRANSACTION\", True)",
"def wrap_transaction(self):\n new_script = self.__class__()\n new_script.append(\n [BeginStatement()... | [
"0.8120522",
"0.6544149",
"0.63907224",
"0.62939125",
"0.62703323",
"0.62328506",
"0.61006147",
"0.606897",
"0.60182077",
"0.6007495",
"0.59822136",
"0.5977059",
"0.582756",
"0.5786009",
"0.5709212",
"0.5700747",
"0.56912994",
"0.5642326",
"0.56331635",
"0.5619323",
"0.561815... | 0.83221465 | 0 |
Returns the SQL that will be appended to tables or rows to define a tablespace. Returns '' if the backend doesn't use tablespaces. | def sql_for_tablespace(self, tablespace, inline=False):
return "ON %s" % self.quote_name(tablespace) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_table_query_string(self) -> str:\n if self.database and self.table:\n return f'\"{self.database}\".\"{self.schema}\".\"{self.table}\"'\n elif self.table:\n return f'\"{self.table}\"'\n else:\n return f\"({self.query})\"",
"def schema(self):\n a... | [
"0.6469759",
"0.59934837",
"0.58655435",
"0.583523",
"0.58219546",
"0.58166826",
"0.5785589",
"0.57622534",
"0.56823945",
"0.55773354",
"0.5572355",
"0.55675316",
"0.55593735",
"0.55440897",
"0.55301553",
"0.5515544",
"0.5511684",
"0.54842204",
"0.5446456",
"0.542847",
"0.541... | 0.6807127 | 0 |
Prepares a value for use in a LIKE query. | def prep_for_like_query(self, x):
# http://msdn2.microsoft.com/en-us/library/ms179859.aspx
return smart_text(x).replace('%', '\%').replace('_', '\_') | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_prep_lookup(self, lookup_type, value):\n\n if hasattr(value, 'prepare'):\n return value.prepare()\n if hasattr(value, '_prepare'):\n return value._prepare()\n\n if lookup_type in ('indexexact', 'distinct', 'slice',\\\n 'contains', 'containedby',... | [
"0.62387824",
"0.62335867",
"0.60099083",
"0.57378113",
"0.5714425",
"0.5617409",
"0.5498217",
"0.5473074",
"0.5430203",
"0.5371442",
"0.5293164",
"0.52836585",
"0.5271929",
"0.52164465",
"0.51479703",
"0.5127178",
"0.5091327",
"0.5089108",
"0.50791",
"0.50724685",
"0.5052547... | 0.6611588 | 0 |
Transform a datetime value to an object compatible with what is expected by the backend driver for datetime columns. | def adapt_datetimefield_value(self, value):
if value is None:
return None
# Expression values are adapted by the database.
if hasattr(value, 'resolve_expression'):
return value
if settings.USE_TZ and timezone.is_aware(value):
# pyodbc donesn'... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def to_mongo(self, value):\n\n try:\n if not isinstance(value, datetime) or not value:\n pdate = value.toPyDate()\n return datetime(pdate.year, pdate.month, pdate.day)\n else:\n return value\n except AttributeError:\n retur... | [
"0.70304805",
"0.6863592",
"0.6858909",
"0.6828734",
"0.67776716",
"0.6712351",
"0.66223943",
"0.6560922",
"0.6497349",
"0.64821446",
"0.64643747",
"0.6452288",
"0.64504373",
"0.6442613",
"0.6383555",
"0.63835424",
"0.6320463",
"0.6273228",
"0.6247605",
"0.62223506",
"0.62175... | 0.69163877 | 1 |
Transform a time value to an object compatible with what is expected by the backend driver for time columns. | def adapt_timefield_value(self, value):
if value is None:
return None
# Expression values are adapted by the database.
if hasattr(value, 'resolve_expression'):
return value
# SQL Server doesn't support microseconds
if isinstance(value, string_type... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def convert_to_time(value):\n if isinstance(value, datetime.time):\n return value\n elif isinstance(value, str):\n return datetime.time.fromisoformat(value)\n else:\n return datetime.time(value)",
"def dehydrate_time(value):\n if isinstance(value, ... | [
"0.7205994",
"0.7059694",
"0.7051511",
"0.67561054",
"0.6677156",
"0.6417766",
"0.63727784",
"0.63563097",
"0.6295769",
"0.6213761",
"0.6160596",
"0.6135675",
"0.6091793",
"0.60568434",
"0.60233325",
"0.5982329",
"0.5982329",
"0.59743375",
"0.5955505",
"0.5954497",
"0.5911527... | 0.7745255 | 0 |
Returns a twoelements list with the lower and upper bound to be used with a BETWEEN operator to query a field value using a year lookup `value` is an int, containing the lookedup year. | def year_lookup_bounds(self, value):
first = '%s-01-01 00:00:00'
# SQL Server doesn't support microseconds
last = '%s-12-31 23:59:59'
return [first % value, last % value] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_range( value ):\n return list(range(value))",
"def get_range(value):\n return list(range(value))",
"def year_text_range_filter(self, queryset, name, value):\n if value:\n if value[0] and value[1]:\n queryset = queryset.filter(**{name+'__regex': r'^[0-9]{3,4}$'}) \... | [
"0.6570659",
"0.65618116",
"0.6470824",
"0.63468575",
"0.6273404",
"0.6227882",
"0.6117337",
"0.60214007",
"0.6008347",
"0.60038984",
"0.60016304",
"0.5972599",
"0.56596154",
"0.5565629",
"0.5526359",
"0.55116224",
"0.5479264",
"0.546489",
"0.54628104",
"0.54439676",
"0.53795... | 0.7706698 | 0 |
Coerce the value returned by the database backend into a consistent type that is compatible with the field type. In our case, cater for the fact that SQL Server < 2008 has no separate Date and Time data types. | def convert_values(self, value, field):
if value is None:
return None
if field and field.get_internal_type() == 'DateTimeField':
if isinstance(value, string_types) and value:
value = parse_datetime(value)
return value
elif field and field.get_i... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def convert_types(cls, value):\n if type(value) in (datetime, date):\n return time.mktime(value.timetuple())\n elif isinstance(value, Decimal):\n return float(value)\n else:\n return value",
"def normalise_field_value(value):\n if isinstance(value, datetim... | [
"0.7383127",
"0.71478885",
"0.7121961",
"0.69921225",
"0.69495225",
"0.6938221",
"0.6927089",
"0.6910447",
"0.68615055",
"0.682171",
"0.6807103",
"0.6564544",
"0.6458779",
"0.63955134",
"0.6381338",
"0.6371626",
"0.6342293",
"0.63253826",
"0.6269357",
"0.62493396",
"0.6239354... | 0.7590033 | 0 |
Return all the sites that are in FILENAME. | def get_sites():
sites_file = open(FILENAME)
sites = []
for site in sites_file:
sites.append("http://" + site.strip())
return sites | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def dorkScanner():\n pysearch.PySearch()\n openfile = open(\"sites.txt\", 'r')\n urls = openfile.read()\n openfile.close()\n return urls",
"def get_sites():\n #sites = sys.argv[1:] # Accept sites from command line input\n\n # Read in additional sites to monitor from site... | [
"0.63554835",
"0.63197654",
"0.6251028",
"0.6009859",
"0.59881043",
"0.5953247",
"0.5951535",
"0.592165",
"0.5893977",
"0.5885239",
"0.58738947",
"0.5866899",
"0.5862455",
"0.5860901",
"0.5763758",
"0.57449645",
"0.5721816",
"0.56856227",
"0.56841946",
"0.5682537",
"0.5669579... | 0.77288526 | 1 |
Attempt to read the given site. Return the text of the site if successful, otherwise returns False. | def read_site(site):
try:
connection = urlopen(site)
html = connection.read()
connection.close()
except:
return False
parser = HtmlTextParser()
parser.parse(html)
return parser.get_text() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def read_text(self, url: str) -> str:\n response = self._session().get(url)\n if not response.ok:\n response.raise_for_status()\n return response.text",
"def read_text(link, from_file = False):\n\tif from_file:\n\t\ttext = read_from_file(link)\n\telse:\n\t\t_, text = read_from_web... | [
"0.65649706",
"0.6558723",
"0.63546216",
"0.62799954",
"0.6234996",
"0.6133159",
"0.61123294",
"0.6106079",
"0.60595316",
"0.6043561",
"0.60159254",
"0.6012336",
"0.6000874",
"0.59981036",
"0.5962465",
"0.593739",
"0.5926055",
"0.591335",
"0.59035695",
"0.5810522",
"0.5785607... | 0.82702225 | 1 |
Index the given site with the given text. | def index_site(site, text):
# YOUR CODE HERE #
pass # delete this when you write your code | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_page_to_index(index, url, content):\n words = content.split()\n for word in words:\n add_to_index(index, word, url)\n return index",
"def index_site(site, text):\n words = text.lower().split()\n for word in words:\n if word not in index: # case 1: haven't seen word ... | [
"0.6791117",
"0.65517974",
"0.62685835",
"0.6252186",
"0.6025351",
"0.6015429",
"0.6015429",
"0.54486924",
"0.5442465",
"0.5423652",
"0.54173946",
"0.53921217",
"0.5385489",
"0.528756",
"0.52750754",
"0.52612174",
"0.5211718",
"0.51874846",
"0.5158359",
"0.5149468",
"0.514707... | 0.769407 | 0 |
Build the index by reading and indexing each site. | def build_index():
for site in get_sites():
text = read_site(site)
while text == False:
text = read_site(site) # keep attempting to read until successful
index_site(site, text) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def build_index(self):\n url = self.start_url\n\n # Search from last available date if not rebuilding and index is not empty\n if not self.rebuild > 0:\n recent_filings = self.get_most_recent_filings()\n pdt = recent_filings[0].date_filing\n # Reformat date to ... | [
"0.7400163",
"0.71896327",
"0.69972724",
"0.6935306",
"0.6830705",
"0.6573556",
"0.65437955",
"0.643226",
"0.6414859",
"0.6355487",
"0.6307958",
"0.62730974",
"0.6251326",
"0.62469614",
"0.62241423",
"0.61707556",
"0.61366165",
"0.6097477",
"0.60937256",
"0.6085822",
"0.60838... | 0.89319247 | 1 |
this method try to read notes from a sound wave file with a list of dict of start_time, pitch and duration | def read_note_from_sound_file(filename: str, samplerate: int = DEFAULT_SAMPLE_RATE):
print("====> reading notes from sound file")
win_s = 512 // DOWN_SAMPLE # fft size
hop_s = 256 // DOWN_SAMPLE # hop size
# adjust sample rate
s = source(filename, samplerate, hop_s)
samplerate = s.samplerate
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def generateNotes():\r\n fs = 44100 # hertz\r\n seconds = 3 # Note duration of 3 seconds\r\n noteNames = [\"C4\", \"D4\", \"E4\", \"F4\", \"G4\", \"A4\", \"B4\"]\r\n for noteName in noteNames:\r\n myNote = music21.note.Note(noteName)\r\n noteFrequency = myNote.pitch.frequency\r\n ... | [
"0.6513883",
"0.64199954",
"0.63684255",
"0.6252008",
"0.6139959",
"0.6108248",
"0.6106231",
"0.6080406",
"0.6077858",
"0.59736735",
"0.5935756",
"0.5932142",
"0.58901197",
"0.588345",
"0.5838785",
"0.5838774",
"0.583514",
"0.581392",
"0.58096606",
"0.57892066",
"0.5775122",
... | 0.6661406 | 0 |
this method try to read pitches from a sound wave file with a list of dict of pitch and confidence | def read_pitch_from_sound_file(filename: str, samplerate: int = DEFAULT_SAMPLE_RATE):
if os.path.isfile(filename) is False:
raise Exception('File not found with filename = %s' % filename)
print("====> reading pitch from sound file")
win_s = 4096 // DOWN_SAMPLE # fft size
hop_s = 512 // DOWN_SA... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def parse(cls, file: Keyvalues) -> Dict[str, 'Sound']:\n sounds = {}\n for snd_prop in file:\n volume = split_float(\n snd_prop, 'volume',\n VOLUME.__getitem__,\n 1.0,\n )\n pitch = split_float(\n snd_prop, '... | [
"0.60571706",
"0.5847298",
"0.582534",
"0.5804961",
"0.57598567",
"0.5719537",
"0.5706302",
"0.5703949",
"0.56977487",
"0.5689279",
"0.5596877",
"0.55241215",
"0.55162257",
"0.5496917",
"0.54842895",
"0.5484168",
"0.54683024",
"0.5467565",
"0.5427731",
"0.54150516",
"0.540227... | 0.6643086 | 0 |
given defined bpm, it generates a bar of heartbeat sound. given the fact that the heart beat track has a certain length of each beat, the bpm cannot be too high, which is undetermined yet. | def get_one_bar_heart_beat(filename: str, bpm: int):
heart_beat_track = AudioSegment.from_file(file=filename, format='mp3')
heart_beat_1 = heart_beat_track[70:180]
heart_beat_2 = heart_beat_track[380:490]
# AudioSegment.export(part, 'single_heartbeat1.mp3')
tick_per_sec = 60 * 1000 / bpm
# mak... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def find_bpm(duration, numbeats):\n dur = duration / 60\n bpm = numbeats / dur\n print('bpm calculated')\n\n if bpm > 300:\n raise TypeError(\"TOOOOOOO HIGH\")\n\n # except ValueError:\n # pass\n # else:\n # logging.info('Calculated BPM: %s', bpm)\n\n return bpm",
"def get_bpm... | [
"0.67328125",
"0.63008034",
"0.6223014",
"0.6183094",
"0.6152251",
"0.6092498",
"0.59835935",
"0.59532374",
"0.5835243",
"0.5692283",
"0.56689316",
"0.5542624",
"0.5461691",
"0.54379505",
"0.53047675",
"0.5275785",
"0.5267846",
"0.5249896",
"0.5233501",
"0.52271456",
"0.52153... | 0.7568481 | 0 |
Command line entry point. $ python runsim.py show animation on screen $ python runsim.py file=video.mp4 save animation to video $ python runsim.py plot show plot on screen $ python runsim.py plot file=plot.pdf save plot to pdf | def main(*args):
#
# Use argparse to handle parsing the command line arguments.
# https://docs.python.org/3/library/argparse.html
#
parser = argparse.ArgumentParser(description='Animate an epidemic')
parser.add_argument('--size', metavar='N', type=int, default=50,
help=... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def main():\n\tplt.clf()\n\taxes = setup_axes()\n\tplot_output(axes, \"../../simulations/default\", \"black\")\n\tplot_output(axes, \"../../simulations/yccsr_zero\", \"crimson\")\n\tplot_output(axes, \"../../simulations/yccsr_linear\", \"lime\")\n\tplot_output(axes, \"../../simulations/yccsr_1-exp\", \"deepskyblue... | [
"0.6634457",
"0.663252",
"0.66184664",
"0.65506244",
"0.64640737",
"0.6457846",
"0.6301039",
"0.6249109",
"0.6241222",
"0.61924034",
"0.61819977",
"0.6164607",
"0.61598307",
"0.6156952",
"0.61398953",
"0.6134857",
"0.61104107",
"0.6092299",
"0.6074707",
"0.6071585",
"0.606645... | 0.78607196 | 0 |
Returns a triplet with a 1 bit sign, an 11 bits unsigned integer exponent and a 53 bits unsigned integer mantissa. The returned triplet can be used to fully reconstruct the fp64 value passed as an argument. | def to_sign_exponent_mantissa(value, exponent_bits=exponent_bits, mantissa_bits=mantissa_bits):
float_mantissa, float_exponent = math.frexp(value)
if (float_mantissa >= 0):
sign = 0
else:
sign = 1
exponent = int(float_exponent + 2**(exponent_bits - 1))
mantissa = int(abs(float_mantis... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def DequantizeFP(scale, mantissa, nScaleBits=3, nMantBits=5):\n\n ### YOUR CODE STARTS HERE ###\n R = 2**nScaleBits - 1 + nMantBits\n aNum = 0\n s = mantissa & (1 << (nMantBits - 1))\n if s > 0:\n s = 1 << (R - 1)\n code = mantissa & (2**(nMantBits - 1) - 1)\n aNum += s\n aNum += cod... | [
"0.5286657",
"0.5091577",
"0.50912625",
"0.5062717",
"0.5032826",
"0.50214833",
"0.50192976",
"0.5013269",
"0.4999337",
"0.49722776",
"0.49537775",
"0.49217296",
"0.49116477",
"0.4890735",
"0.48767433",
"0.48740077",
"0.48563376",
"0.48374486",
"0.48224583",
"0.48199913",
"0.... | 0.5590061 | 0 |
Returns an fp64 from a 1 bit sign, an 11 bit unsigned integer exponent and a 53 bit unsigned integer mantissa. | def from_sign_exponent_mantissa(sign, exponent, mantissa, exponent_bits=exponent_bits, mantissa_bits=mantissa_bits):
if (sign):
signed_mantissa = - mantissa
else:
signed_mantissa = mantissa
signed_exponent = exponent - 2**(exponent_bits - 1)
norm_signed_mantissa = float(signed_mantissa) ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def to_sign_exponent_mantissa(value, exponent_bits=exponent_bits, mantissa_bits=mantissa_bits):\n float_mantissa, float_exponent = math.frexp(value)\n if (float_mantissa >= 0):\n sign = 0\n else:\n sign = 1\n exponent = int(float_exponent + 2**(exponent_bits - 1))\n mantissa = int(abs(... | [
"0.6564609",
"0.61634827",
"0.592686",
"0.5826476",
"0.57423556",
"0.5709573",
"0.55164057",
"0.54724276",
"0.5424843",
"0.5373116",
"0.5356698",
"0.5350474",
"0.52375185",
"0.52315235",
"0.51248753",
"0.5092813",
"0.5047708",
"0.5032996",
"0.5011347",
"0.49896455",
"0.497911... | 0.644643 | 1 |
Check that the storage of a float as sign, exponent and mantissa and way back produces exactly the original number. | def test_float_storage():
values = [2.3434, 124012.2323209999, -12.39212445433389]
for value in values:
sign, exp, mantissa = to_sign_exponent_mantissa(value)
restored_value = from_sign_exponent_mantissa(sign, exp, mantissa)
print(restored_value)
assert(value == restored_value) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def check_for_float(check):",
"def testfloat ( self ):\r\n\t\tr = re.compile ( 'frac' )\r\n\t\tfor fracTup1, expRes in self.knownFloatValues:\r\n\t\t\tfrac1 = eval ( r.sub ( 'frac.frac', fracTup1 ) ) \r\n\t\t\tself.assertAlmostEqual ( float ( frac1 ), expRes )",
"def check_for_float_and_int(check):",
"def t... | [
"0.6891519",
"0.66194546",
"0.6434158",
"0.63923424",
"0.62414616",
"0.6237944",
"0.6170298",
"0.6094164",
"0.6040777",
"0.594754",
"0.5923214",
"0.59174234",
"0.5906689",
"0.5906176",
"0.5862436",
"0.58263683",
"0.58231926",
"0.58215433",
"0.58195156",
"0.5811164",
"0.580868... | 0.7909229 | 0 |
Inverse projection of the projected map to a healpix spherical map. | def inv_projmap(self, img, nside=None):
pass | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def inv_projmap(self, img, nside=None):\n pass\n\n ysize, xsize = img.shape\n\n if nside is None:\n lonra = self.arrayinfo['lonra']\n latra = self.arrayinfo['latra']\n npix = np.int((360.0 * xsize / (lonra[1] - lonra[0])) * (180.0 * ysize / (latra[1] - latra[0]... | [
"0.71200365",
"0.6357577",
"0.5971307",
"0.5946619",
"0.5824953",
"0.57034713",
"0.5698357",
"0.56218755",
"0.56114763",
"0.56053007",
"0.5576599",
"0.55293226",
"0.552154",
"0.5499768",
"0.5479456",
"0.5463952",
"0.5462339",
"0.544783",
"0.5424593",
"0.5414713",
"0.53791064"... | 0.6943881 | 1 |
flipconv is either 'astro' or 'geo'. None will be default. With 'astro', east is toward left and west toward right. It is the opposite for 'geo' | def set_flip(self, flipconv):
if flipconv is None:
flipconv = 'astro' # default
if flipconv == 'astro': self._flip = -1
elif flipconv == 'geo': self._flip = 1
else: raise ValueError("flipconv must be 'astro', 'geo' or None for default.") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def convert_flip(g, op, block):\n\n x = g.get_node(op.input(\"X\")[0])\n axis = op.attr(\"axis\")\n\n for i, ax in enumerate(axis):\n if i == 0:\n out = _op.reverse(x, ax)\n else:\n out = _op.reverse(out, ax)\n\n g.add_node(op.output(\"Out\")[0], out)",
"def flip(s... | [
"0.5972456",
"0.57888746",
"0.5710304",
"0.5693313",
"0.55282015",
"0.5495678",
"0.5467454",
"0.5432339",
"0.53047246",
"0.5252012",
"0.52447367",
"0.52384484",
"0.52223796",
"0.52158856",
"0.517234",
"0.51295346",
"0.5108745",
"0.507657",
"0.50323236",
"0.5025738",
"0.501214... | 0.7790945 | 0 |
Get the field of view in degree of the plane of projection | def get_fov(self):
return 2.*pi | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def fov(self) -> float:\n return self._fov[self.projection_mode.value]",
"def field ( self , xyz ) :\n return self._ilhcbmagnet.fieldVector ( xyz )",
"def get_projection(self):\n return self.projection",
"def base_projection(self, fiber):\n return self.ambient_space().quotien... | [
"0.65581155",
"0.6266231",
"0.6220673",
"0.61471313",
"0.59898585",
"0.5958863",
"0.5957005",
"0.59534055",
"0.5926802",
"0.5884517",
"0.5833143",
"0.5828602",
"0.5786574",
"0.5780048",
"0.5780048",
"0.5776455",
"0.57687336",
"0.5767944",
"0.5759518",
"0.574998",
"0.5748476",... | 0.6937915 | 0 |
Inverse projection of the projected map to a healpix spherical map. | def inv_projmap(self, img, nside=None):
pass
ysize, xsize = img.shape
if nside is None:
lonra = self.arrayinfo['lonra']
latra = self.arrayinfo['latra']
npix = np.int((360.0 * xsize / (lonra[1] - lonra[0])) * (180.0 * ysize / (latra[1] - latra[0]))) # the tot... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def inv_projmap(self, img, nside=None):\n pass",
"def reproject_map(nside, phi, healpix_array=None):\n\n vec = hp.pix2vec(nside, np.arange(hp.nside2npix(nside)))\n eu_mat = euler(-phi, 0, 0, deg=True)\n rot_map = hp.rotator.rotateVector(eu_mat, vec)\n new_hp_inds = hp.vec2pix(nside, rot_map[0]... | [
"0.6943809",
"0.6358386",
"0.5970374",
"0.5945898",
"0.58239275",
"0.570336",
"0.56980294",
"0.5621514",
"0.5613242",
"0.56047964",
"0.55778897",
"0.55289084",
"0.5519292",
"0.5498979",
"0.5480552",
"0.54634655",
"0.5462376",
"0.54497546",
"0.54262376",
"0.5415537",
"0.537764... | 0.7119491 | 0 |
Computes sag using voltage trace. | def sag(V):
Vmin = np.amin(V)
Vend = V[-1]
return Vmin - Vend | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def compute_gae(V, s, ss, r, absorbing, last, gamma, lam):\n v = V(s)\n v_next = V(ss)\n gen_adv = np.empty_like(v)\n for rev_k in range(len(v)):\n k = len(v) - rev_k - 1\n if last[k] or rev_k == 0:\n gen_adv[k] = r[k] - v[k]\n if not absorbing[k]:\n g... | [
"0.5797982",
"0.5753957",
"0.5719163",
"0.5645294",
"0.54906857",
"0.54530114",
"0.5418226",
"0.5358796",
"0.53198016",
"0.5301523",
"0.52992094",
"0.5296971",
"0.5276875",
"0.5262266",
"0.52552825",
"0.51872295",
"0.5164188",
"0.51586914",
"0.51306736",
"0.51049095",
"0.5076... | 0.6116707 | 0 |
Computes sag (absolute, not sag ratio) using abf object and epoch index. See `sag_ratio` to calculate the sag ratio. | def sag_abf(abf, epoch_ind):
p0 = abf.sweepEpochs.p1s[epoch_ind]
p1 = abf.sweepEpochs.p1s[epoch_ind+1]
V = abf.sweepY[p0:p1]
return sag(V) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sag_ratio_abf(abf, epoch_ind):\n p0 = abf.sweepEpochs.p1s[epoch_ind]\n p1 = abf.sweepEpochs.p1s[epoch_ind+1]\n V = abf.sweepY[p0:p1]\n return sag_ratio(V)",
"def sag_ratio(V):\n\n Vmin = np.amin(V)\n Vend = V[-1]\n sr = (Vmin - Vend) / Vmin\n if sr < 0:\n print(\"Warning: sag r... | [
"0.68790483",
"0.51099616",
"0.4840694",
"0.47976026",
"0.46058744",
"0.45199078",
"0.451957",
"0.45086294",
"0.44889933",
"0.44735873",
"0.44700673",
"0.44060507",
"0.43793166",
"0.4379234",
"0.43768635",
"0.436418",
"0.43534052",
"0.43524563",
"0.43197927",
"0.43142548",
"0... | 0.6636521 | 1 |
Computes sag ratio using voltage trace. Sag ratio is computed as $$ SR = \frac{V_{min} V_{end}}{V_{min}} $$ | def sag_ratio(V):
Vmin = np.amin(V)
Vend = V[-1]
sr = (Vmin - Vend) / Vmin
if sr < 0:
print("Warning: sag ratio being negative indicates there is no sag")
return sr | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sag(V):\n Vmin = np.amin(V)\n Vend = V[-1]\n return Vmin - Vend",
"def calc_V(A):\n return 1. / calc_rV(A)",
"def vratio(self):\n return self.run_command('vratio')[0]",
"def calc_rV(A):\n return np.sqrt(calc_rVsq(A))",
"def rvs(self):\n return float(self.interp(random.rand()))"... | [
"0.6470241",
"0.61445576",
"0.5787019",
"0.5713984",
"0.57111585",
"0.57061124",
"0.5691221",
"0.5611252",
"0.5577237",
"0.55457896",
"0.5515481",
"0.54366684",
"0.54354954",
"0.542553",
"0.5407385",
"0.53981924",
"0.5393931",
"0.5376168",
"0.53517497",
"0.5343775",
"0.533818... | 0.8000134 | 0 |
Computes sag ratio using abf object and epoch index. | def sag_ratio_abf(abf, epoch_ind):
p0 = abf.sweepEpochs.p1s[epoch_ind]
p1 = abf.sweepEpochs.p1s[epoch_ind+1]
V = abf.sweepY[p0:p1]
return sag_ratio(V) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sag_abf(abf, epoch_ind):\n p0 = abf.sweepEpochs.p1s[epoch_ind]\n p1 = abf.sweepEpochs.p1s[epoch_ind+1]\n V = abf.sweepY[p0:p1]\n return sag(V)",
"def __call__(self, epoch):\n exp = np.floor((1 + epoch) / self.dropEvery)\n alpha = initAlpha * (self.factor ** exp)\n \n #... | [
"0.604394",
"0.5422874",
"0.53296494",
"0.5298637",
"0.5189429",
"0.5170441",
"0.51297385",
"0.5077913",
"0.5077913",
"0.50770766",
"0.5069971",
"0.5037457",
"0.5031441",
"0.5018347",
"0.5014721",
"0.50000775",
"0.4999061",
"0.49976856",
"0.49907756",
"0.49856532",
"0.4959025... | 0.74809 | 0 |
Computes minimum of voltage. | def Vmin(V):
return np.min(V) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_min_cell_voltage(self):\n summary = \" \".join(self.get_summary().split())\n pattern = '\\$.... .. .*? .*? .*? (.*?) .*? . .*? .*? . . . .*?'\n minv = float(re.findall(pattern,summary).pop())\n return minv",
"def hemt_gate_min_voltage(self):\n return self._hemt_gate_min... | [
"0.75651085",
"0.72486717",
"0.7138131",
"0.68351734",
"0.6807372",
"0.6727665",
"0.66549414",
"0.665015",
"0.65709823",
"0.64375454",
"0.64165014",
"0.6410586",
"0.6393397",
"0.63890225",
"0.63823736",
"0.63823736",
"0.6381286",
"0.6368098",
"0.63344324",
"0.63281834",
"0.63... | 0.7622577 | 0 |
Computes minimum Voltage using abf object and epoch index. | def Vmin_abf(abf, epoch_start):
p0 = abf.sweepEpochs.p1s[epoch_start]
p1 = abf.sweepEpochs.p1s[epoch_start + 1]
V = abf.sweepY[p0:p1]
return Vmin(V) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_min_cell_voltage(self):\n summary = \" \".join(self.get_summary().split())\n pattern = '\\$.... .. .*? .*? .*? (.*?) .*? . .*? .*? . . . .*?'\n minv = float(re.findall(pattern,summary).pop())\n return minv",
"def min():\n valid=result_alpha.F>0\n ... | [
"0.6273566",
"0.6256282",
"0.6005075",
"0.587969",
"0.578635",
"0.5720461",
"0.570958",
"0.566614",
"0.5658306",
"0.5648726",
"0.55853295",
"0.5554305",
"0.55336726",
"0.550037",
"0.5492651",
"0.5490647",
"0.540645",
"0.53950757",
"0.5371377",
"0.53660285",
"0.5365001",
"0.... | 0.7292721 | 0 |
Computes voltage drop using voltage trace. | def voltage_drop(V):
vmin = Vmin(V)
resting = Vrest(V)
return vmin - resting | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def voltage_drop_abf(abf, epoch_start):\n vmin = Vmin_abf(abf, epoch_start)\n resting = Vrest_abf(abf, epoch_start)\n return vmin - resting",
"def drop(u, v):\n return u - v * (u.dot(v) / v.dot(v))",
"def dvdt(self, args: List[float]) -> float:\n v, h_nav, n_kvhh, h_kva, m_kvsi, s_ampar, _, ... | [
"0.64880204",
"0.5908261",
"0.5774052",
"0.5733856",
"0.56801546",
"0.5569362",
"0.55316657",
"0.55160147",
"0.5500494",
"0.5499955",
"0.54843986",
"0.5478288",
"0.5471517",
"0.5442814",
"0.5422475",
"0.5381904",
"0.5378291",
"0.5374405",
"0.5367712",
"0.5356332",
"0.5355079"... | 0.75108176 | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.