query stringlengths 10 2k | document stringlengths 20 51.2k | metadata dict | negatives listlengths 0 101 | negative_scores listlengths 0 101 | document_score stringlengths 3 10 | document_rank stringclasses 102
values |
|---|---|---|---|---|---|---|
Returns a ProjectCollection with objects which match the xpath. xp is the xpath which is used for the search (either an Expression object or a string). | def find_project(xp, **kwargs):
path = '/search/project'
if 'schema' not in kwargs:
kwargs['schema'] = ProjectCollection.SCHEMA
tag_class = {'collection': ProjectCollection, 'project': ROProject}
return _find(path, xp, tag_class, **kwargs) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def elements(xpath_selection):\n driver = Driver().connect()\n return driver.find_elements_by_xpath(xpath_selection)",
"def find_package(xp, **kwargs):\n path = '/search/package'\n if 'schema' not in kwargs:\n kwargs['schema'] = PackageCollection.SCHEMA\n tag_class = {'collection': PackageC... | [
"0.5264987",
"0.5037761",
"0.5019994",
"0.49843824",
"0.49831843",
"0.49377376",
"0.4897356",
"0.48519707",
"0.4850672",
"0.48110655",
"0.47897774",
"0.4785051",
"0.4735383",
"0.4722277",
"0.47054696",
"0.45902702",
"0.45883238",
"0.4580754",
"0.45582223",
"0.45063794",
"0.44... | 0.6296943 | 0 |
This will set the root directory of the data folder. This is likely the `utahforge` Google Drive folder that was shared with you | def set_data_directory(path):
gdc19.DATA_DIRECTORY = path
return gdc19.DATA_DIRECTORY | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def setDataRoot(path):\n global dataRoot\n dataRoot = os.path.realpath(path)",
"def get_data_dir():\n return Path(current_app.config[\"USER_DIR\"]) / \"data\"",
"def stick_everything_into_cwd():\n global DATA_HOME\n\n DATA_HOME = ''",
"def set_data_dir(proj_data_dir):\n global _USER_PROJ_DATA\n... | [
"0.7542222",
"0.7123245",
"0.700307",
"0.6985151",
"0.6983758",
"0.69206136",
"0.68818986",
"0.6850674",
"0.68334407",
"0.6821367",
"0.6817746",
"0.67900044",
"0.6762616",
"0.67504424",
"0.67495114",
"0.6730406",
"0.6722486",
"0.67182124",
"0.6675456",
"0.66745245",
"0.666685... | 0.6950269 | 5 |
Returns the root directory for the data files | def get_data_directory():
return gdc19.DATA_DIRECTORY | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def data_directory(self):\n\n return self.get_raw(\"data_directory\")",
"def data_dir():\n return os.path.join(os.path.dirname(os.path.abspath(__file__)), 'data')",
"def data_dir():\n return _config.datadir",
"def datadir():\n return '../data/'",
"def get_data_folder():\n data_folder = '... | [
"0.8143534",
"0.8008033",
"0.78029495",
"0.7800692",
"0.7797279",
"0.7785489",
"0.77839833",
"0.776535",
"0.7732685",
"0.77152073",
"0.77124554",
"0.7694146",
"0.7694146",
"0.7668176",
"0.7665909",
"0.7644671",
"0.7635647",
"0.7619169",
"0.7610469",
"0.7602355",
"0.75967616",... | 0.71793807 | 41 |
Calculates the ratio between the highest resolution image and lowest resolution image. Returns the ratio as a tuple (Xratio, Yratio). | def calculateRatio(levelDims):
highestReso = np.asarray(levelDims[0])
lowestReso = np.asarray(levelDims[-1])
Xratio, Yratio = highestReso/lowestReso
return (Xratio, Yratio) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def determine_real_to_pixel_ratio(\n image_shape: Tuple[int, int],\n min_x: float,\n min_y: float,\n max_x: float,\n max_y: float,\n):\n image_x = image_shape[1]\n image_y = image_shape[0]\n diff_x = max_x - min_x\n diff_y = max_y - min_y\n\n resolution_x = image_x / diff_x\n resol... | [
"0.72195196",
"0.71032196",
"0.6577099",
"0.64753616",
"0.6439772",
"0.64074016",
"0.6393361",
"0.6141478",
"0.6115658",
"0.6099829",
"0.6093291",
"0.60600996",
"0.6044847",
"0.5948316",
"0.59124255",
"0.5852547",
"0.57684225",
"0.5760546",
"0.57544696",
"0.5742023",
"0.57306... | 0.74833775 | 0 |
[summary] Generate setup for first run and check if the directory and files are created. | def test_first_run():
setup_first_run(".", True, extra_context={"number_of_iterations": 2,
"project_name": "first_run_test",
"logging_frequency": 1,
"enable_cuda": False
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def setup():\n print('...')\n # Make sure dirs exist\n for directory in [DATA_DIR, DATA_INPUT_DIR, DATA_OUTPUT_DIR]:\n os.makedirs(directory, exist_ok=True)",
"def setup(verbose=True):\n global _SETUP_DONE\n if _SETUP_DONE:\n return\n _ensure_base_dirs(verbose=False)\n _setup_l... | [
"0.76154",
"0.7207719",
"0.712347",
"0.7008008",
"0.68532056",
"0.68011016",
"0.6778339",
"0.67208",
"0.6719176",
"0.66747105",
"0.666325",
"0.66376376",
"0.66376376",
"0.66376376",
"0.66376376",
"0.66376376",
"0.66376376",
"0.66376376",
"0.66376376",
"0.66376376",
"0.6637637... | 0.6865181 | 4 |
Converting Time Stamp to Readable Format | def make_it_rw(time_stamp):
seconds, milliseconds = divmod(int(time_stamp), 1000)
minutes, seconds = divmod(seconds, 60)
hours, minutes = divmod(minutes, 60)
days, hours = divmod(hours, 24)
tmp = (
((str(days) + " Days, ") if days else "")
+ ((str(hours) + " Hours, ") if hours... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def conv_time(stamp):\n value = datetime.fromtimestamp(stamp)\n return value.strftime('%Y-%m-%d %H:%M:%S')",
"def __format_time(in_time):\n logging.debug(\"in_time = %s\", in_time)\n out = in_time.strftime(\"%a, %d %b %Y %H:%M:%S %z+0000\")\n logging.debug(\"out = %s, out\")\n r... | [
"0.71227694",
"0.6895622",
"0.6891608",
"0.6883996",
"0.687463",
"0.6826833",
"0.67968166",
"0.67659545",
"0.6745593",
"0.67369527",
"0.66802406",
"0.66692656",
"0.66562194",
"0.66522354",
"0.6646907",
"0.6633156",
"0.6605878",
"0.6591294",
"0.65409946",
"0.65310043",
"0.6524... | 0.0 | -1 |
Returns leftmost atom in p. | def get_leftmost_atom(self, p):
if p.type == self.PT.atomic:
return p.v1
else:
return self.get_leftmost_atom(p.v1) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def left(self, p):\n node = self._validate(p)\n return self._make_position(node._left)",
"def left(self, p):\n node = self._validate(p)\n return self._make_position(node.left)",
"def left(self, p):\n node = self._validate_position(p)\n return self._make_position(node.left)",
... | [
"0.7379185",
"0.73784184",
"0.73633677",
"0.73547095",
"0.73547095",
"0.7014217",
"0.6914837",
"0.68129015",
"0.68106556",
"0.6807587",
"0.67974186",
"0.67950267",
"0.67447543",
"0.67447543",
"0.6734669",
"0.6727005",
"0.6716256",
"0.6640088",
"0.6608549",
"0.65990144",
"0.65... | 0.8858748 | 0 |
Tests that the barracks helper cannot be built without api_key argument | def test_init_barracks_helper_fail_when_no_api_key_given():
try:
BarracksHelper(None, _base_url)
assert False
except ValueError:
assert True | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_api_key_error(api):\n\twith pytest.raises(top_stories.APIKeyError):\n\t\tmissingAPI = top_stories.TopStoriesAPI()",
"def test_init_barracks_helper_succeed_when_api_key_given():\n helper = BarracksHelper(_api_key)\n assert helper.get_api_key() == _api_key\n assert helper.get_base_url() == _base_... | [
"0.7188455",
"0.7150424",
"0.6868079",
"0.6843092",
"0.68007284",
"0.6641392",
"0.65708363",
"0.6499072",
"0.64861906",
"0.64667827",
"0.6463625",
"0.6444715",
"0.6391974",
"0.6325179",
"0.6301825",
"0.62591594",
"0.61920804",
"0.6184099",
"0.6144185",
"0.6124961",
"0.6124961... | 0.8481922 | 0 |
Finalize all values that are the only choice for a unit. Go through all the units, and whenever there is a unit with a value that only fits in one box, assign the value to this box. | def only_choice(values):
for unit in unitlist:
for digit in '123456789':
dplaces = [box for box in unit if digit in values[box]]
if len(dplaces) == 1:
values[dplaces[0]] = digit
return values | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def only_choice(values):\n # TODO: Copy your code from the classroom to complete this function\n for unit in unitlist:\n #print (unit)\n #solved_boxes = [box for box in unit if len(values[box]) == 1]\n #unsolved_boxes = [box for box in unit if len(values[box]) > 1]\n #print (unit,... | [
"0.61507905",
"0.5738942",
"0.5613085",
"0.5567472",
"0.553151",
"0.55125004",
"0.5460724",
"0.54593384",
"0.54504025",
"0.54492325",
"0.54200757",
"0.54182386",
"0.53875345",
"0.5362483",
"0.53121895",
"0.52773565",
"0.52573943",
"0.52477384",
"0.52414405",
"0.52017206",
"0.... | 0.52565664 | 17 |
Return a threadspecific storage dictionary. | def _dic(self, thread_id=None): # def _dic(_get_ident=thread.get_ident) make thread.get_ident a local var
if thread_id is None:
thread_id = thread.get_ident() # Identify the calling thread.
try:
return _ThDict._tss[thread_id]
except KeyError:
tss = _ThDict._ts... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getSharedDict(self):\n return self._sharedDict",
"def get_storage_model(self) -> Dict[str, Any]:\n return self.data.dict()",
"def get_stored_dict(self):\n return dict([(k, getattr(self, k)) for k in Context.STORED_KEYS])",
"def get_storage(self):\n return self.storage",
"def... | [
"0.6215964",
"0.61273575",
"0.6037959",
"0.6016725",
"0.5994203",
"0.5977398",
"0.5924003",
"0.58914196",
"0.58765364",
"0.58751744",
"0.57997715",
"0.57680607",
"0.568655",
"0.563845",
"0.56246895",
"0.5611149",
"0.55896187",
"0.5578572",
"0.5547232",
"0.55118096",
"0.548565... | 0.69267035 | 0 |
Filter ``dictionary`` by its values using ``function``. | def filter_values(function, dictionary):
return {k: v for k, v in dictionary.items() if function(v)} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def filter_dict(dictionary, pred):\n return dict((k, v) for k, v in dictionary.items() if pred(k, v))",
"def filter_keys(func, a_dict):\n return dict((k, v) for (k, v) in a_dict.items() if func(k))",
"def filter(self, func):\n self._sets.filter(key=func)",
"def filter_dict(fdict, mask):\n\n i... | [
"0.70143163",
"0.69534475",
"0.6837467",
"0.6674849",
"0.64855725",
"0.64559966",
"0.6397897",
"0.6368482",
"0.63502276",
"0.623713",
"0.6150504",
"0.61269593",
"0.61043084",
"0.60623217",
"0.6016967",
"0.59909564",
"0.5987634",
"0.596273",
"0.5946462",
"0.59055525",
"0.58641... | 0.86716884 | 0 |
Reading a environment variable as text. | def env_var_line(key: str) -> str:
return str(os.environ.get(key) or "").strip() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _get_env(key: str) -> str:\n value = os.getenv(key)\n assert isinstance(value, str), (\n f\"the {key} environment variable must be set and a string, \" f\"{value=}\"\n )\n return value",
"def test_get_environment_string(self):\n pass",
"def getenv_string(settin... | [
"0.64903164",
"0.61682165",
"0.6142988",
"0.60816246",
"0.6054548",
"0.60263807",
"0.59471285",
"0.59415185",
"0.5887559",
"0.58568513",
"0.5842627",
"0.5826633",
"0.5815658",
"0.5800363",
"0.5800218",
"0.57895327",
"0.5763488",
"0.57547617",
"0.5748358",
"0.57209665",
"0.566... | 0.67881423 | 0 |
Reading a environment variable as binary. | def env_var_bool(key: str) -> bool:
return env_var_line(key).upper() in ("TRUE", "ON", "YES") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def env(key, default=None, required=False):\n try:\n value = os.environ[key]\n return ast.literal_eval(value)\n except (SyntaxError, ValueError):\n return value\n except KeyError:\n if default or not required:\n return default\n raise ImproperlyConfigured(\n ... | [
"0.58533394",
"0.5844853",
"0.57677346",
"0.57160974",
"0.5641666",
"0.5635812",
"0.56246585",
"0.5559182",
"0.5552668",
"0.5509054",
"0.5503753",
"0.54874474",
"0.54418606",
"0.54234785",
"0.5408707",
"0.5379324",
"0.53728795",
"0.5350132",
"0.5333961",
"0.5308252",
"0.52976... | 0.47837228 | 81 |
Reading a environment variable as list, source line should be divided by commas. | def env_var_list(key: str) -> list:
return list(
filter(
None, map(str.strip, env_var_line(key).split(","))
)
) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def read_list(name, default=NO_ARGUMENT, separator=\",\"):\n value = os.environ.get(name)\n if value is None:\n if default is NO_ARGUMENT:\n return []\n else:\n return default\n return [v.strip() for v in value.split(separator) if v.strip()]",
"def get_envlist(key, *d... | [
"0.71439314",
"0.67040265",
"0.61332095",
"0.60854524",
"0.60168445",
"0.5877769",
"0.58456564",
"0.57908124",
"0.5651809",
"0.5635019",
"0.5613625",
"0.56000316",
"0.554496",
"0.5539179",
"0.5369789",
"0.53643876",
"0.53479964",
"0.5345841",
"0.5324846",
"0.52787125",
"0.527... | 0.73379016 | 0 |
Testing that nonconsecutive slices are allowed. | def test_nonconsecutive_slices(
assert_errors,
parse_ast_tree,
expression,
default_options,
):
tree = parse_ast_tree(usage_template.format(expression))
visitor = SubscriptVisitor(default_options, tree=tree)
visitor.run()
assert_errors(visitor, []) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_forbidden_consecutive_slices(\n assert_errors,\n parse_ast_tree,\n expression,\n default_options,\n):\n tree = parse_ast_tree(usage_template.format(expression))\n\n visitor = SubscriptVisitor(default_options, tree=tree)\n visitor.run()\n\n assert_errors(visitor, [ConsecutiveSlicesV... | [
"0.7345154",
"0.7249012",
"0.6932884",
"0.6407439",
"0.63771796",
"0.63202316",
"0.62831414",
"0.6248222",
"0.62466073",
"0.6198403",
"0.61956537",
"0.6193969",
"0.61901194",
"0.6171453",
"0.60545284",
"0.6024803",
"0.60172975",
"0.60140014",
"0.5984232",
"0.59660274",
"0.595... | 0.6957985 | 2 |
Return a filename from file obj or a path. If given file, the asumption is that the filename is within the value of its `name` attribute. If given a `Path`, assumes it is a path to an actual file, not a directory. If given an unnamed object, this returns None. | def _get_filename(
cls, file_or_path: Union[BinaryIO, Path]
) -> Optional[str]:
if cls._is_unnamed_or_directory(file_or_path):
return None
# TODO: test this
# If a file object given, ensure its a filename, not a path
if isinstance(file_or_path, Path):
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getabsfile(object, _filename=None):\r\n if _filename is None:\r\n _filename = getsourcefile(object) or getfile(object)\r\n return os.path.normcase(os.path.abspath(_filename))",
"def extract_filename_from_object_info(object_info: dict) -> Optional[str]:\n if \"name\" in object_info and object_... | [
"0.6543205",
"0.65163434",
"0.64702183",
"0.6166343",
"0.6082145",
"0.60737973",
"0.60737973",
"0.6067047",
"0.6064387",
"0.6030024",
"0.6028483",
"0.60068804",
"0.5997551",
"0.59268546",
"0.5924116",
"0.59208626",
"0.5917195",
"0.59133685",
"0.58956224",
"0.58722764",
"0.586... | 0.7912477 | 0 |
Returns true if both objects are equal | def __eq__(self, other):
if not isinstance(other, Software):
return False
return self.__dict__ == other.__dict__ | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __eq__(self, other):\n return are_equal(self, other)",
"def __eq__(self, other):\n return are_equal(self, other)",
"def __eq__(self,other):\n try: return self.object==other.object and isinstance(self,type(other))\n except: return False",
"def __eq__(self, other):\n if i... | [
"0.8088132",
"0.8088132",
"0.8054589",
"0.7982687",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
... | 0.0 | -1 |
Returns true if both objects are not equal | def __ne__(self, other):
return not self == other | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __ne__(self, other: object) -> bool:\n if self.__eq__(other):\n return False\n return True",
"def __ne__(self, other: object) -> bool:\n return not self.__eq__(other)",
"def __ne__(self, other) -> bool:\n return not self.__eq__(other)",
"def __eq__(self, other):\n ... | [
"0.845611",
"0.8391477",
"0.8144138",
"0.81410587",
"0.8132492",
"0.8093973",
"0.80920255",
"0.80920255",
"0.80920255",
"0.8085325",
"0.8085325",
"0.8076365",
"0.8076365",
"0.8065748"
] | 0.0 | -1 |
x is the training data tensor (no embedding) returns the mask to use for negating the padding effect on the attention add this mask before taking the softmax! | def attention_mask(x):
mask = torch.zeros(len(x), len(x[0]))
for i in range(len(x)):
try:
index = np.where(x[i]==1)[0][0]
mask[i][index:] = -np.inf
except:
pass
return mask | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def attention_mask(model, x):\n config = model.config\n input_mask = model.inputs[\"input_mask\"]\n final_mask = model.builder.customOp(opName=\"AttentionMask\",\n opVersion=1,\n domain=\"ai.graphcore\",\n ... | [
"0.7421151",
"0.7217545",
"0.7167106",
"0.7079211",
"0.6706677",
"0.6682437",
"0.66159326",
"0.6599417",
"0.65964437",
"0.65885895",
"0.6551673",
"0.6500141",
"0.6487599",
"0.6473447",
"0.6453691",
"0.64491236",
"0.640918",
"0.6409067",
"0.6409067",
"0.63933337",
"0.63802826"... | 0.7250042 | 1 |
split Train and Val | def splitTrainAndTest(root_path,split_ratio = 0.8,save_path = "/usr/",isWrite = False):
train_file_paths = []
val_file_paths = []
root = pathlib.Path(root_path)
cate_list = root.glob("*")
# recurrent each a cate
for cate in cate_list:
file_list = li... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def train_val_split(self):\n idx = np.arange(self.num_data)\n np.random.shuffle(idx)\n val_num = int(self.ratio * self.num_data)\n dev_num = int(self.dev_ratio * self.num_data)\n self.num_train = self.num_data - val_num\n\n self.val_data = self.data[idx[:val_num]]\n ... | [
"0.77425194",
"0.7551636",
"0.73735857",
"0.72925365",
"0.7008135",
"0.6984488",
"0.6949306",
"0.6883564",
"0.68748647",
"0.67738163",
"0.6678159",
"0.66354245",
"0.66354245",
"0.6626996",
"0.66244847",
"0.6595214",
"0.65646714",
"0.6555515",
"0.651365",
"0.651329",
"0.646571... | 0.0 | -1 |
Test two noise models are not equal | def test_noise_models_not_equal(self):
error = pauli_error([['X', 1]])
model1 = NoiseModel()
model1.add_all_qubit_quantum_error(error, ['u3'], False)
model2 = NoiseModel(basis_gates=['u3', 'cx'])
model2.add_all_qubit_quantum_error(error, ['u3'], False) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_noise_models_equal(self):\n roerror = [[0.9, 0.1], [0.5, 0.5]]\n error1 = pauli_error([['X', 1]], standard_gates=False)\n error2 = pauli_error([['X', 1]], standard_gates=True)\n\n model1 = NoiseModel()\n model1.add_all_qubit_quantum_error(error1, ['u3'], False)\n ... | [
"0.820037",
"0.69289684",
"0.6738332",
"0.66467637",
"0.6599596",
"0.65457606",
"0.65447915",
"0.6543903",
"0.6452476",
"0.64383215",
"0.64159083",
"0.638408",
"0.6375067",
"0.6360007",
"0.63317573",
"0.62647396",
"0.626305",
"0.62161314",
"0.6211834",
"0.6180281",
"0.615478"... | 0.8125664 | 1 |
Hash plaintext ``password`` using the ``password_hash`` specified in the constructor. | def hash_password(self, password):
# Use passlib's CryptContext to hash a password
password_hash = self.password_crypt_context.encrypt(password)
return password_hash | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def hash_password(self, password):\n self.password_hash = generate_password_hash(password)",
"def hash_password(self, password):\n self.password = pwd_context.encrypt(password)",
"def set_password_hash(self, password):\n salt = bcrypt.gensalt()\n self.password_hash = bcrypt.hashpw(p... | [
"0.80770516",
"0.7985083",
"0.7809836",
"0.78066474",
"0.76533467",
"0.7524308",
"0.7405602",
"0.7384351",
"0.7284495",
"0.7262829",
"0.720181",
"0.7125376",
"0.71128464",
"0.7088065",
"0.70239127",
"0.6987111",
"0.69834787",
"0.69761825",
"0.6966714",
"0.6963797",
"0.6942130... | 0.7933982 | 2 |
Verify plaintext ``password`` against ``hashed password``. | def verify_password(self, password, password_hash):
# Print deprecation warning if called with (password, user) instead of (password, user.password)
if isinstance(password_hash, self.user_manager.db_manager.UserClass):
print(
'Deprecation warning: verify_password(password, u... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def check_hashed_password(password, hashed_password):\n\n\n return sha256_crypt.verify(password,hashed_password)",
"def verify_hashed_password(password, hashed_password):\n return pbkdf2_sha256.verify(password, hashed_password)",
"def check_password(hashed_password, password):\n return che... | [
"0.8334267",
"0.81941295",
"0.8188339",
"0.8055229",
"0.80275786",
"0.799583",
"0.7938551",
"0.7932387",
"0.79291874",
"0.7900916",
"0.78792185",
"0.78108615",
"0.77867365",
"0.7760918",
"0.77177227",
"0.766537",
"0.7652974",
"0.7648142",
"0.7648142",
"0.7648142",
"0.7648142"... | 0.7072096 | 46 |
Creates one hot vector of n classes with "index" class | def oneHot(index, n):
x = np.zeros(n)
x[index] = 1
return x | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def onehot(index):\n classNum=2#1\n onehot = np.zeros(classNum)#这代表种类类型\n onehot[index] = 1.0\n return onehot",
"def indices_to_one_hot(data, nb_classes):\n targets = np.array(data).reshape(-1)\n return np.eye(nb_classes)[targets]",
"def indices_to_one_hot(data, nb_classes):\n targets = np... | [
"0.8317261",
"0.81406474",
"0.81406474",
"0.81406474",
"0.81406474",
"0.8102245",
"0.80313605",
"0.80136204",
"0.8009317",
"0.79900396",
"0.7881947",
"0.77704865",
"0.7754152",
"0.7703118",
"0.765413",
"0.7646331",
"0.7600033",
"0.74995023",
"0.74995023",
"0.7410096",
"0.7407... | 0.83001465 | 1 |
Construct a layernorm module in the TF style (epsilon inside the square root). | def __init__(self, hidden_size, eps=1e-12):
super().__init__()
self.weight = nn.Parameter(torch.ones(hidden_size))
self.bias = nn.Parameter(torch.zeros(hidden_size))
self.variance_epsilon = eps | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def verhulst(nb_init, t0, tf, eps, methode, gamma, K) :\n f=lambda y,t : gamma*y*(1-y/K)\n Y=meth_epsilon(nb_init, t0, tf, eps, f, methode)\n return Y",
"def malthusiens(nb_init, t0, tf, eps, methode, gamma ) :\n\n f=lambda y, t : gamma*y\n Y=meth_epsilon(nb_init, t0, tf, eps, f, methode)\n ... | [
"0.62769747",
"0.6015288",
"0.5793189",
"0.5741642",
"0.5536562",
"0.5520984",
"0.5423341",
"0.54136443",
"0.5391356",
"0.5368255",
"0.5352737",
"0.52882403",
"0.5258299",
"0.52317435",
"0.5227515",
"0.5227515",
"0.5221651",
"0.52209145",
"0.51954937",
"0.5194189",
"0.5194189... | 0.0 | -1 |
initialize (open) a bdb frequency hash | def hfreq_bdb_init(db_file, cache_size=None):
return bdb_init_hash(db_file, cache_size) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self):\n self.freq = {}",
"def bdb_init_hash(db_file, cache_size=None):\n\tdb_dir = dirname(db_file)\n\tif not isdir(db_dir):\n\t\tmakedirs(db_dir)\n\tdb = DB()\n\tif cache_size is None:\n\t\tcache_size = _cache_size\n\tdb.set_cachesize (\n\t\tcache_size / (1024*1024*1024),\n\t\tcache_size % ... | [
"0.6704742",
"0.65338004",
"0.64289284",
"0.63803357",
"0.62496257",
"0.6220571",
"0.6148755",
"0.6134633",
"0.60455704",
"0.59618205",
"0.59502053",
"0.59428495",
"0.5888558",
"0.58844864",
"0.5863423",
"0.5857028",
"0.5841682",
"0.5838687",
"0.5838318",
"0.5813352",
"0.5767... | 0.8135423 | 0 |
Return the trace level for this TraceSpecification instance. | def getLevel(self):
return self.level | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getTraceSpec():\n return Trace.traceSpec",
"def getLevel(self):\n return _libsbml.SBase_getLevel(self)",
"def level( self ):\n assert isinstance( self._level, int )\n assert isinstance( self._steps, list )\n assert isinstance( self._outter, Env ) or ( self._outter is None )\n\n ... | [
"0.69140166",
"0.65237033",
"0.64862216",
"0.64667183",
"0.6404112",
"0.6403319",
"0.6403319",
"0.63872886",
"0.63872886",
"0.63872886",
"0.63872886",
"0.63473237",
"0.63473237",
"0.6322858",
"0.6315086",
"0.6305815",
"0.6282526",
"0.628008",
"0.6228734",
"0.61862147",
"0.616... | 0.5164355 | 78 |
Return "true" if the given trace level is a valid string or integer representation of a trace level. | def _isTraceLevel(self,level):
if (type(level) == type(0)):
result = level >= Level.NONE and level <= Level.FINEST
elif (type(level) == type("") or type(level) == type(u"")):
level = level.lower()
validLevel = Trace.traceLevels.get(level)
# Keep in mind, trace level "none" maps t... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _checkLevel(level):\n\n try:\n level = int(level)\n except:\n pass\n\n if isinstance(level, (int, long)):\n rv = level\n elif str(level) == level:\n if level not in logging._levelNames:\n raise ValueError('Unknown level: %r' % level)\n rv = logging._lev... | [
"0.64003354",
"0.63713634",
"0.6259688",
"0.6041013",
"0.5832999",
"0.568361",
"0.5626215",
"0.5560428",
"0.5560428",
"0.5522911",
"0.55040485",
"0.54773974",
"0.54651505",
"0.5385012",
"0.5354778",
"0.53337514",
"0.53284377",
"0.53162473",
"0.5291516",
"0.5280502",
"0.524399... | 0.8185287 | 0 |
Set the trace level for this instance of the trace class based on the Trace class traceSpec. If there is no trace spec that has a module pattern that matches this trace instance module name, then the trace level is not modified. | def configureThisTrace(self):
for spec in Trace.traceSpec:
if (spec.compiledRegex.match(self.entityName)):
self.traceLevel = spec.level
break
#endIf
#endFor | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def configureTrace(traceString):\n \n setTraceSpec(traceString)\n registeredModules = Trace.tracedEntities.keys()\n for module in registeredModules:\n for spec in Trace.traceSpec:\n if (spec.compiledRegex.match(module)):\n trace = Trace.tracedEntities[module]\n trace.setTraceLevel(spec.le... | [
"0.61845666",
"0.5965638",
"0.58020526",
"0.55751276",
"0.55380774",
"0.5459781",
"0.54203385",
"0.53951794",
"0.53279537",
"0.5266613",
"0.52020276",
"0.5173878",
"0.51630473",
"0.51576376",
"0.50914013",
"0.50914013",
"0.50914013",
"0.5078109",
"0.5073327",
"0.50539666",
"0... | 0.65092444 | 0 |
Return the module traceSpec used by all instances of Trace. | def getTraceSpec():
return Trace.traceSpec | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_testbench_specs(self, tb_type: str) -> Dict[str, Any]:\n return self._specs['testbenches'][tb_type]",
"def get_required_module_descriptors(self):\r\n return []",
"def trace(self):\n return self._trace",
"def tracing(self):\n return self.__trace",
"def return_spec(type_se... | [
"0.56054235",
"0.5599977",
"0.5386948",
"0.5383461",
"0.5374143",
"0.53723806",
"0.5286025",
"0.5286025",
"0.5230701",
"0.5191652",
"0.5066103",
"0.5061323",
"0.50166225",
"0.49577042",
"0.4929801",
"0.48848036",
"0.4884137",
"0.48701167",
"0.48573104",
"0.48374268",
"0.48327... | 0.7961328 | 0 |
will receive as its arguments the directory being visited by copytree(), and a list of its contents, as returned by os.listdir(). will be called once for each directory that is copied. return a sequence of directory and file names relative to the current directory (i.e. a subset of the items in its second argument); th... | def ignore(self, directory, files):
ignore_list = []
ignores = ('build', 'var')
build = os.path.join(directory, 'build')
var = os.path.join(directory, 'var')
for filename in files:
full_path = os.path.join(directory, filename)
if full_path.startswith(build... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def glob1(self, dirname, pattern):\n names = self.listdir(dirname)\n if pattern[0] != '.':\n names = filter(lambda x: x[0] != '.',names)\n return fnmatch.filter(names, pattern)",
"def parse_filenames(dirname, pattern = \"*conll\"):\n for path, subdirs, files in os.walk(dirname)... | [
"0.6814111",
"0.6523735",
"0.6426169",
"0.639931",
"0.6324866",
"0.6295407",
"0.6295337",
"0.627235",
"0.62287736",
"0.6195708",
"0.6195708",
"0.6174021",
"0.6166514",
"0.6151967",
"0.6143554",
"0.61431247",
"0.6123214",
"0.6122508",
"0.60991424",
"0.6087915",
"0.6078148",
... | 0.0 | -1 |
Initialize the encoder hidden state. | def _init_state(self, encoder_hidden):
if encoder_hidden is None:
return None
if isinstance(encoder_hidden, tuple):
encoder_hidden = tuple([self._cat_directions(h) for h in encoder_hidden])
else:
encoder_hidden = self._cat_directions(encoder_hidden)
re... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def init_hidden_state(self, encoder_out: torch.Tensor):\n pass",
"def initialize_hidden_state(self):\n return tf.zeros(shape=(self.batch_size, self.enc_units))",
"def init_hidden_state(self, encoder_out):\n init_internal_state = []\n mean_encoder_out = encoder_out.mean(dim=1)\n ... | [
"0.83275086",
"0.74040484",
"0.7290414",
"0.7279931",
"0.7215229",
"0.7215229",
"0.70479804",
"0.69852823",
"0.6901168",
"0.68980813",
"0.689464",
"0.68280524",
"0.6804546",
"0.67857987",
"0.6757444",
"0.6757444",
"0.6757444",
"0.66996604",
"0.6488062",
"0.6274202",
"0.620734... | 0.77102697 | 2 |
If the encoder is bidirectional, do the following transformation. (directions layers, batch, hidden_size) > (layers, batch, directions hidden_size) | def _cat_directions(self, h):
if self.bidirectional_encoder:
h = torch.cat([h[0:h.size(0):2], h[1:h.size(0):2]], 2)
return h | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def encoder_decoder_archi_gan(inputs, is_train):\n\n encoder_layers = []\n\n encoded = inputs\n\n encoder_layers.append(encoded)\n\n for i in range(config.encoder_layers):\n encoded = encoder_conv_block_gan(encoded, i, is_train)\n encoder_layers.append(encoded)\n \n encoder_layers.r... | [
"0.63277006",
"0.62737",
"0.62708133",
"0.6247839",
"0.6214003",
"0.6086999",
"0.6009488",
"0.6006527",
"0.5992325",
"0.59688765",
"0.59140205",
"0.59026414",
"0.58474416",
"0.5840555",
"0.5829343",
"0.5823497",
"0.58028907",
"0.58008033",
"0.5790106",
"0.5757703",
"0.5755313... | 0.0 | -1 |
Yield successive nsized chunks from l. | def chunks(file_names, threads):
chunks = []
for i in range(0, len(file_names), threads):
chunks.append(file_names[i:i + threads])
return chunks | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _chunk(self, l, n):\n for i in range(0, len(l) + 1, n):\n yield l[i:i + n]",
"def chunks(self, l, n):\n for i in range(0, len(l), n):\n yield l[i:i + n]",
"def __chunks(l, n):\n for i in range(0, len(l), n):\n yield l[i:i + n]",
"def get_chunks(self, ... | [
"0.8038813",
"0.79248375",
"0.7923423",
"0.7885103",
"0.78773195",
"0.7815877",
"0.77655786",
"0.77556044",
"0.77441615",
"0.7731815",
"0.77288336",
"0.772473",
"0.77028215",
"0.76889825",
"0.76889825",
"0.7664208",
"0.76570904",
"0.7655856",
"0.7655856",
"0.76458347",
"0.764... | 0.0 | -1 |
Returns DatasetDict. For convenience, create a symbolic link to the dataset folder here with the same name as this source file (ie. "./hwu64_sub"). | def load(data_dir=None, **kwargs):
src_file = Path(__file__)
if not data_dir:
data_dir = src_file.with_suffix('')
with open(Path(data_dir).joinpath('categories.json')) as fp:
features = datasets.Features(
{'id': datasets.Value('string'),
'... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_data_paths(self) -> dict:\n return self.data_dict",
"def generate_dataset(self, target_folder: Path = None):\n if target_folder is None:\n target_folder = Path(__file__).parent\n\n # Folds\n folds = self.generate_folds()\n specs_path = target_folder / f\"{sel... | [
"0.65284914",
"0.6132502",
"0.6075398",
"0.60550034",
"0.6037064",
"0.6032477",
"0.59447306",
"0.59425604",
"0.5926367",
"0.5903601",
"0.58924866",
"0.5877742",
"0.5876197",
"0.5874779",
"0.5861709",
"0.58251023",
"0.58087957",
"0.5790877",
"0.5788899",
"0.577416",
"0.5772506... | 0.0 | -1 |
Standardizes the data. Set the mean to 0 and the standard deviation to 1 for each feature | def standardize_data(data):
return (data - np.mean(data, axis=0)) / (np.std(data, axis=0) + 10 ** -16) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def standardiser(self):\n # Select only numeric features first\n\n #self.X = self.data.loc[:, self.data.columns != self.target].values\n numeric_columns = []\n for col in self.X.columns:\n if self.X[col].dtype!='object':\n numeric_columns.append(col)\n s... | [
"0.78466344",
"0.7838906",
"0.77958804",
"0.7640424",
"0.757655",
"0.7567484",
"0.74750763",
"0.74082744",
"0.7365555",
"0.73645383",
"0.73510474",
"0.7329236",
"0.7317205",
"0.7313734",
"0.72673106",
"0.72601336",
"0.72580695",
"0.7251312",
"0.72179574",
"0.7200806",
"0.7193... | 0.75030494 | 6 |
Returns the frontend application instance | def create_app(settings_override: Optional[object] = None):
cwd = os.path.dirname(os.path.abspath(__file__))
package_path = [cwd]
app = factory.create_app(
__name__,
package_path,
settings_override,
)
setup_jinja_env(app)
# Register custom error handlers
if not app.... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_app(self):\n return Application()",
"def app(self):\n if self._application is None:\n self._application = Application(client=self)\n return self._application",
"def get_app():\n return ApplicationContainer()",
"def app(self):\r\n return self._app",
"def app(sel... | [
"0.7723572",
"0.76000047",
"0.75873435",
"0.7540403",
"0.7532672",
"0.74980134",
"0.74751335",
"0.7392383",
"0.7380304",
"0.7349788",
"0.72383267",
"0.72109705",
"0.72109705",
"0.71205443",
"0.70990086",
"0.7083661",
"0.70442337",
"0.70070684",
"0.6985948",
"0.6953829",
"0.69... | 0.0 | -1 |
Blur or cover personal data | def hideAllPersonalData(self):
filePath = self.filesList.selectedItems()[0].text(2)
self.filesList.doBackup(filePath)
self.filesList.hidePersonalData(filePath)
self.pDataCancelButton.show()
self.pDataCommitButton.show() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def blur(self):\n\n if self:\n pass",
"def blurImage(self):\n\n print (\"--Blurring Main Image--\")\n self.blurButton.setDown(True)\n im = Image.open(self.ActivePhoto)\n blurred_image = im.filter(ImageFilter.GaussianBlur(1))\n blurred_image.save(self.ActivePho... | [
"0.6730632",
"0.6552181",
"0.644512",
"0.62446153",
"0.60509676",
"0.60488176",
"0.60446644",
"0.6036078",
"0.60102564",
"0.5982348",
"0.59714705",
"0.59629935",
"0.5957498",
"0.5952269",
"0.5940835",
"0.5926084",
"0.5925411",
"0.59178287",
"0.5878362",
"0.5844492",
"0.584313... | 0.0 | -1 |
Cleans up/ stops directory listening | def cleanUp(self):
self.dirMonitor.stop()
self.filesList.cleanUp() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _stopListening(self):\n if self.listener:\n self.listener.stopListening()",
"def stop_listening(self) -> None:\n assert self.client_recv\n self.client_recv = None",
"def stop(self) -> None:\n self.stop_listening = True",
"def clean_up(self):\n self.stop_full(... | [
"0.639561",
"0.6386928",
"0.63720554",
"0.63348967",
"0.6326714",
"0.629778",
"0.62563723",
"0.62169605",
"0.61858577",
"0.61770916",
"0.61436224",
"0.6142668",
"0.6057893",
"0.5991837",
"0.59901917",
"0.5986199",
"0.59773576",
"0.5976742",
"0.5976742",
"0.596212",
"0.5957386... | 0.6175645 | 10 |
calculate the Shannon Entropy of each uncollapsed state and choose one of the lowest entroy states at random to target for the next wavefunction collapse event | def get_min_shannon_entropy(grid):
curr_min = math.inf
curr_best = []
for i in range(len(grid[0])):
for j in range(len(grid)):
if not grid[j][i].collapsed:
w = grid[j][i].block_weights
shannon_entropy = sum([-math.log(el) for el in w] )
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _generate_sample_from_state(self, state):\n\n res = []\n for e in range(self.n_emissions):\n cdf = np.cumsum(self.B[e][state, :])\n res.append((cdf > np.random.rand()).argmax())\n return np.asarray(res)",
"def getTheta (q_table, state_ind, old_theta_ind, last_event_... | [
"0.6576303",
"0.62612516",
"0.6254021",
"0.6207933",
"0.62071717",
"0.602948",
"0.6005654",
"0.5981178",
"0.59725267",
"0.58691674",
"0.5848436",
"0.58375967",
"0.5802087",
"0.58004194",
"0.5785645",
"0.57806087",
"0.5771553",
"0.5749972",
"0.5742528",
"0.57319415",
"0.572457... | 0.56017274 | 43 |
Initializes the particles with supplied values for charge c, mass m, and position r. | def __init__(self, charge, mass, position):
self.c = charge
self.m = mass
self.r = position | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self,nparticles,initial_condition):\n self.nparticles = nparticles\n self.particles = np.array([Particle(mass,x,y) for x,y,mass in initial_condition])\n self.mass = np.array([self.particles[i].mass for i in range(len(self.particles))])\n self.position = np.array([self.parti... | [
"0.6975022",
"0.6936636",
"0.683775",
"0.6779028",
"0.67131174",
"0.6454496",
"0.64482003",
"0.63693637",
"0.63533765",
"0.63069123",
"0.6258959",
"0.62416065",
"0.6235465",
"0.61987317",
"0.6110885",
"0.60588974",
"0.6033223",
"0.60294825",
"0.60294825",
"0.5966522",
"0.5964... | 0.7580843 | 0 |
Converts image of type torch.tensor to numpy.ndarray for matplotlib display image | def convert_tensor_to_numpy_img(tensor_img):
img = tensor_img.to('cpu').clone().detach()
img = img.numpy().squeeze(0)
img = img.transpose(1, 2, 0)
img = img * np.array((0.229, 0.224, 0.225)) + np.array((0.485, 0.456, 0.406))
img = img.clip(0, 1)
return img | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def tensor2im_raw(input_image, imtype=np.float64):\n if not isinstance(input_image, np.ndarray):\n if isinstance(input_image, torch.Tensor): # get the data from a variable\n image_tensor = input_image.data\n else:\n return input_image\n image_numpy = image_tensor[0].c... | [
"0.7048809",
"0.6880173",
"0.68093735",
"0.6792789",
"0.6757762",
"0.67456317",
"0.67265105",
"0.6707813",
"0.6678656",
"0.665678",
"0.6621333",
"0.66024065",
"0.6597689",
"0.6589251",
"0.65755355",
"0.6522425",
"0.6516791",
"0.651404",
"0.6482893",
"0.64826477",
"0.64555347"... | 0.70222735 | 1 |
Check if item is a container (list, tuple, dict, set). | def is_container(item):
if isinstance(item, str):
return False
elif hasattr(item, "__iter__"):
return True
return False | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_is_container(self):\n # verify ----------------------\n try:\n 1 in self.collection\n except TypeError:\n msg = \"'Collection' object is not container\"\n self.fail(msg)",
"def is_container(value: object) -> TypeGuard[AnyContainer]:\n if isinstanc... | [
"0.7344212",
"0.71971273",
"0.7153404",
"0.6666673",
"0.6665677",
"0.6573487",
"0.6531076",
"0.65197587",
"0.6327977",
"0.6293779",
"0.62678146",
"0.61821836",
"0.61464983",
"0.6091407",
"0.5965194",
"0.5935714",
"0.59311116",
"0.58759165",
"0.58688784",
"0.5863264",
"0.58010... | 0.8535093 | 0 |
Return a list given either a string or a list. | def ensure_list(filename):
if isinstance(filename, (str, bytes)):
return [filename]
elif isinstance(filename, list):
return filename
elif is_container(filename):
return [x for x in filename]
return None | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _strings_to_list(one_or_more_strings):\n if isinstance(one_or_more_strings, str):\n return [one_or_more_strings]\n else:\n return list(one_or_more_strings)",
"def str_or_list(value):\n if isinstance(value, list):\n return value\n return [value]",
"def listify(arg):\n if ... | [
"0.78165823",
"0.77030873",
"0.7492109",
"0.74841166",
"0.745672",
"0.73737615",
"0.737239",
"0.7279729",
"0.7265163",
"0.72602797",
"0.7260265",
"0.71768546",
"0.71763855",
"0.7049043",
"0.6904514",
"0.68732405",
"0.6862538",
"0.68492305",
"0.6840291",
"0.6814017",
"0.679982... | 0.58984005 | 91 |
Initialize the Instrument object with instrument specific values. | def init(self):
# Set the appropraite acknowledgements and references
self.acknowledgements = mm_ace.acknowledgements()
self.references = mm_ace.references(self.name)
logger.info(self.acknowledgements)
return | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self, instrument, params=None):\n super(InstrumentsCandles, self).__init__(instrument)\n self.params = params",
"def __init__(self, instrument):\n endpoint = self.ENDPOINT.format(instrument=instrument)\n super(Instruments, self).__init__(endpoint, method=self.METHOD)",
... | [
"0.71079105",
"0.6918038",
"0.6634698",
"0.65949595",
"0.65349096",
"0.65126014",
"0.6457258",
"0.6383584",
"0.6344141",
"0.63246757",
"0.6318041",
"0.63137233",
"0.62786555",
"0.61960465",
"0.61337537",
"0.61337537",
"0.61337537",
"0.61337537",
"0.61197734",
"0.6036409",
"0.... | 0.0 | -1 |
Sets the id of this JsonJdbcIngestionProperties. | def id(self, id):
if id is None:
raise ValueError("Invalid value for `id`, must not be `None`") # noqa: E501
self._id = id | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_id(self, id):\n self.data['id'] = id",
"def set_id(self, id):\n self.__id = id",
"def set_id(self, id_):\n\n self.id_ = id_",
"def set_id(self, id):\n\n\t\tif id is not None and not isinstance(id, int):\n\t\t\traise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: id EXPECTED TYPE: ... | [
"0.65863365",
"0.6388497",
"0.6282591",
"0.6189276",
"0.61389524",
"0.6096918",
"0.6095033",
"0.60891026",
"0.60891026",
"0.60891026",
"0.60882795",
"0.6072969",
"0.6060029",
"0.6059565",
"0.6059565",
"0.6059565",
"0.6059565",
"0.6059565",
"0.6019579",
"0.6019579",
"0.6019579... | 0.0 | -1 |
Sets the created_by of this JsonJdbcIngestionProperties. | def created_by(self, created_by):
self._created_by = created_by | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def created_by(self, created_by: \"str\"):\n self._attrs[\"createdBy\"] = created_by",
"def created_by(self, created_by: \"str\"):\n self._attrs[\"createdBy\"] = created_by",
"def created_by(self, created_by: \"str\"):\n self._attrs[\"createdBy\"] = created_by",
"def created_by(self, cre... | [
"0.6884949",
"0.6884949",
"0.6884949",
"0.6884949",
"0.64285046",
"0.6103104",
"0.6093415",
"0.6045686",
"0.60291886",
"0.5996269",
"0.5996269",
"0.5996269",
"0.5996269",
"0.5996269",
"0.5996269",
"0.5990751",
"0.5918606",
"0.5910671",
"0.58679223",
"0.58679223",
"0.58679223"... | 0.69827163 | 5 |
Sets the user of this JsonJdbcIngestionProperties. | def user(self, user):
self._user = user | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_user(self, user):\n self._user = user",
"def set_user(self, user):\r\n self.user = user",
"def set_user(self, user: User):\n self.__user = user",
"def user_settings(self, user_settings):\n\n self._user_settings = user_settings",
"def set_user_property(self, property, value):... | [
"0.6504722",
"0.6457927",
"0.6223949",
"0.60973",
"0.5991649",
"0.5949811",
"0.59363204",
"0.5775053",
"0.5741735",
"0.5670421",
"0.56619525",
"0.561382",
"0.5581107",
"0.55489427",
"0.5522327",
"0.5476951",
"0.5474973",
"0.54653454",
"0.54653454",
"0.54653454",
"0.54653454",... | 0.5960796 | 11 |
Returns true if both objects are equal | def __eq__(self, other):
if not isinstance(other, JsonJdbcIngestionProperties):
return False
return self.__dict__ == other.__dict__ | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __eq__(self, other):\n return are_equal(self, other)",
"def __eq__(self, other):\n return are_equal(self, other)",
"def __eq__(self,other):\n try: return self.object==other.object and isinstance(self,type(other))\n except: return False",
"def __eq__(self, other):\n if i... | [
"0.8088132",
"0.8088132",
"0.8054589",
"0.7982687",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
... | 0.0 | -1 |
Returns true if both objects are not equal | def __ne__(self, other):
return not self == other | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __ne__(self, other: object) -> bool:\n if self.__eq__(other):\n return False\n return True",
"def __ne__(self, other: object) -> bool:\n return not self.__eq__(other)",
"def __ne__(self, other) -> bool:\n return not self.__eq__(other)",
"def __eq__(self, other):\n ... | [
"0.8457179",
"0.8393067",
"0.81457263",
"0.8140635",
"0.8133462",
"0.8094992",
"0.8093376",
"0.8093376",
"0.8093376",
"0.80863357",
"0.80863357",
"0.8077303",
"0.8077303",
"0.8066831"
] | 0.0 | -1 |
Returns a timedelta indicating how old this comment is. Can be used to display relative times in the UI. | def when(self):
# current UTC time
now = datetime.datetime.utcnow()
# calculate timedelta and return
return now - self.creation_time | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def diff(self):\n return datetime.datetime.now() - self.stamp",
"def relative_datetime(self):\n now = datetime.now(timezone.utc)\n created_at = self.created_at.astimezone(timezone.utc)\n\n delta = humanize.naturaldelta(abs(created_at - now))\n tense = \"from now\" if now < crea... | [
"0.7003338",
"0.67855084",
"0.6684347",
"0.65254706",
"0.65060973",
"0.64506257",
"0.6377078",
"0.6352957",
"0.6338396",
"0.6303744",
"0.6240539",
"0.6105612",
"0.6070187",
"0.605494",
"0.6048218",
"0.60426277",
"0.6031029",
"0.5995616",
"0.597023",
"0.59599",
"0.5957175",
... | 0.67010707 | 2 |
restores the state of the graph from a previous copy made. If there is at least one copy to restore from | def restore_graph_ui(self):
if len(self._graph_copies) == 0:
print('No copies to restore!')
return
# the last made copy is restored in graph
self._graph = self._graph_copies.pop(-1) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def restore(self):\n self.nodes.restore()",
"def _Restore(self) -> None:\n self._SetNodes(self._nodes)",
"def _restoreGraph(self):\n\n # self.tempG = self.g.copy()\n\n if nx.is_directed(self.g):\n self.tempG = nx.DiGraph(self.g)\n else:\n self.tempG = nx.Gra... | [
"0.74744827",
"0.7448601",
"0.74397695",
"0.73925924",
"0.7309107",
"0.70217335",
"0.69016004",
"0.6828779",
"0.68268186",
"0.67718124",
"0.6744612",
"0.67356306",
"0.6699239",
"0.66833806",
"0.6653536",
"0.65983886",
"0.6584011",
"0.65656936",
"0.65646636",
"0.6524735",
"0.6... | 0.7628298 | 0 |
convert a matplotlib colormap into a PIL palette | def cmap_to_pil_palette(cmap):
# return (255.*np.array(
# map(lambda x: cmap(x)[0:3], np.linspace(0., 1.,256)))
# .ravel()).astype('int')
return (255. * np.array(
[cmap(x)[:3] for x in np.linspace(0,1,256)]).ravel().astype('int')) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def colormap(self):\n palette = [(0, 0, 0), (0, 0, 0), (0, 0, 0), (0, 0, 0), (0, 0, 0),\n (111, 74, 0), (81, 0, 81), (128, 64, 128), (244, 35, 232),\n (250, 170, 160), (230, 150, 140), (70, 70, 70),\n (102, 102, 156), (190, 153, 153), (180, 165, 180),\n ... | [
"0.6967287",
"0.68760455",
"0.68467826",
"0.68011427",
"0.6650869",
"0.6646248",
"0.66290563",
"0.66052055",
"0.6603507",
"0.65802604",
"0.655248",
"0.6547776",
"0.6542165",
"0.6542165",
"0.65381736",
"0.65381736",
"0.6538096",
"0.6535332",
"0.6535332",
"0.6523931",
"0.651459... | 0.8015995 | 0 |
Provides a colormap, based on IDL colortable==4. | def cmap_idl4():
r="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_mpl_colormap(self):\n return mpl.colors.ListedColormap(self.get_colors().astype(float) / 255.0)",
"def colormap(self):\n palette = [(0, 0, 0), (0, 0, 0), (0, 0, 0), (0, 0, 0), (0, 0, 0),\n (111, 74, 0), (81, 0, 81), (128, 64, 128), (244, 35, 232),\n (250,... | [
"0.7344688",
"0.72561145",
"0.71103466",
"0.69729865",
"0.69729865",
"0.6959782",
"0.6959782",
"0.6862821",
"0.68386716",
"0.68061894",
"0.6763739",
"0.6758933",
"0.67216367",
"0.66895336",
"0.6673322",
"0.6651191",
"0.6651191",
"0.6638331",
"0.6638331",
"0.6638331",
"0.66137... | 0.7060548 | 3 |
Set up the test data within the test db. | def setUpTestData(cls):
cls.user = UserFactory()
cls.auth = AuthFactory()
cls.device = TOTPDevice.objects.create(user=cls.user)
cls.relate = TOTPDevice.challenge.objects.create(
device=cls.device, token=cls.auth
)
cls.algorithm = TOTPAlgorithm() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def setUp(self):\n self.data = DatabaseIntermediary()",
"def setUp(self):\n\n self.client = app.test_client()\n app.config['Testing'] = True\n app.config['SECRET_KEY'] = 'test'\n connect_to_db(app, db_uri='postgresql:///testdb', echo=False)\n db.create_all()\n\n e... | [
"0.8215563",
"0.815659",
"0.81436336",
"0.814079",
"0.8134137",
"0.808585",
"0.80417037",
"0.8031054",
"0.7985807",
"0.7928265",
"0.79002374",
"0.78746784",
"0.7868997",
"0.78627014",
"0.7855398",
"0.78518444",
"0.78222054",
"0.780507",
"0.78001684",
"0.7794243",
"0.7772306",... | 0.0 | -1 |
Return the system date and time. | def getdate():
return strftime("%A %B %d, %I:%M %p") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_system_date_and_time(self):\n return self.mycam.devicemgmt.GetSystemDateAndTime()",
"def get_system_date_time():\n query = {\"type\": \"op\", \"cmd\": \"<show><clock></clock></show>\"}\n\n return __proxy__[\"panos.call\"](query)",
"def nowdt():\n from datetime import datetime\n\n now... | [
"0.8723423",
"0.7782115",
"0.7577801",
"0.74857414",
"0.73962903",
"0.73928094",
"0.73701227",
"0.7323168",
"0.7285211",
"0.7279496",
"0.7271345",
"0.7213184",
"0.71804595",
"0.71647644",
"0.71306205",
"0.7119985",
"0.7116023",
"0.7107069",
"0.7105287",
"0.7090682",
"0.707719... | 0.6895697 | 48 |
Tear down the test case by cleaning up the temporary cache directory. | def tearDown(self) -> None:
self.directory.cleanup() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def tearDown(self) -> None:\n\n self.temp_env_file.close()\n os.remove(self.temp_env_file.name)\n\n del self.temp_env_file\n del self.test_name\n del self.helper",
"def tearDown(self):\n self.tempdir.cleanup()",
"def tearDown(self):\n utils.rm_rf(TMP_DIR_PATH)",... | [
"0.8058195",
"0.7839386",
"0.78150296",
"0.76571995",
"0.7613605",
"0.75815177",
"0.7559772",
"0.7559772",
"0.7550829",
"0.75465405",
"0.75414556",
"0.7497284",
"0.73838615",
"0.7376315",
"0.7365212",
"0.7365212",
"0.73495364",
"0.73450947",
"0.7338276",
"0.7332211",
"0.73305... | 0.75804555 | 6 |
Get the name of the last directory in the path. | def get_last_dir(path):
head, tail = split(path)
while not tail:
head, tail = split(head)
return tail | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_dirname(self, dirpath):\n return dirpath.split('/')[-1]",
"def get_last_part_of_path(path: str) -> str:\n multi_os_path = path.replace(\"\\\\\", \"/\")\n return re.search(\"(?:[^/](?!/))+$\", multi_os_path).group(0)",
"def get_leafname(path):\n\n\tpos = string.rfind(path, os.sep)\n\tif pos... | [
"0.7505416",
"0.74623406",
"0.74319196",
"0.73088986",
"0.7307475",
"0.7292277",
"0.7252292",
"0.7176553",
"0.71378094",
"0.7074937",
"0.7073228",
"0.7056331",
"0.70458376",
"0.70192856",
"0.6981031",
"0.69700545",
"0.69595456",
"0.6891311",
"0.6724386",
"0.67243403",
"0.6723... | 0.83793795 | 0 |
return the document viewer | def viewer(self):
return self.parent | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getViewer(self, v_id=-1) -> Viewer:\n viewer_ctrl = self.getViewerController(v_id)\n if viewer_ctrl is None:\n return None\n return viewer_ctrl.view",
"def getSceneviewer(self):\n return self._sceneviewer",
"def __newDocumentView(self):\n aw = self.activeWindow... | [
"0.69375134",
"0.69163793",
"0.6853111",
"0.67617315",
"0.6756576",
"0.6754555",
"0.6550173",
"0.6465868",
"0.6302576",
"0.6270481",
"0.62411624",
"0.6146605",
"0.6146425",
"0.60257083",
"0.6004018",
"0.59994894",
"0.59861445",
"0.5976136",
"0.59636796",
"0.59499943",
"0.5945... | 0.7425443 | 0 |
Return how many minutes, rounded to 2 decimals, Python 2 has left on Planet Miller (calculated from start_date) 1 hour to 7 earth years | def py2_miller_min_left(start_date=BITE_CREATED_DT):
td = (PY2_DEATH_DT - start_date)
return round(((td.days*24 + td.seconds/3600)/1022), 2) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def minutes(self):\n return int((self.end - self.start).total_seconds()) / 60",
"def py2_miller_min_left():\r\n left = PY2_RETIRED_DT - BITE_CREATED_DT\r\n left_earth_mins = round(left.total_seconds()/60,2)\r\n\r\n left_miller_hours = left_earth_mins/3679200\r\n left_miller_mins = round(left_m... | [
"0.72144586",
"0.71424174",
"0.679107",
"0.6736059",
"0.6701586",
"0.66801083",
"0.65883243",
"0.65240306",
"0.6497183",
"0.6496166",
"0.6441139",
"0.6368439",
"0.62966055",
"0.6288888",
"0.6269495",
"0.6244679",
"0.624116",
"0.62262",
"0.61815953",
"0.6092379",
"0.6091683",
... | 0.65792114 | 7 |
Inits Pyramid app for testing environment | def init_app(args, setup_logging=True):
if setup_logging:
pyramid.paster.setup_logging(args.config)
settings = pyramid.paster.get_appsettings(args.config)
if 'environment' not in settings:
raise KeyError('Missing key "environment" in config. Specify '
'environment... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _setUp(self):\n # self.basedir = '/'.join(['var', self.id()])\n # os.mkdir(self.basedir)\n\n # datadir = '/'.join([self.basedir, 'data'])\n # os.mkdir(datadir)\n if not hasattr(self, 'APP'):\n return\n\n self.pyramid_config = Configurator()\n self.pyr... | [
"0.7997598",
"0.7775401",
"0.7503169",
"0.7409454",
"0.73890924",
"0.73610425",
"0.73567116",
"0.7348028",
"0.7332093",
"0.72746086",
"0.72744983",
"0.72346026",
"0.72128606",
"0.7209323",
"0.7177989",
"0.7148255",
"0.71474487",
"0.71195924",
"0.71195924",
"0.71195924",
"0.71... | 0.68561405 | 46 |
Create a training dataset pipeline. | def _test_pipeline(self, ds_images, ds_labels):
ds_images_out = (ds_images.batch(self.batch_size)
.prefetch(3))
ds_labels_out = (ds_labels.batch(self.batch_size)
.prefetch(3))
return ds_images_out, ds_labels_out | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_pipeline(self, train: LAMLDataset) -> LAMLTransformer:\n raise NotImplementedError",
"def _create_dataset(options, is_training, input_pipeline_context=None):\n dataset = tf.data.Dataset.list_files(options.input_pattern[:],\n shuffle=is_training)\n\n batch... | [
"0.7439487",
"0.72224694",
"0.69541425",
"0.6920243",
"0.6915928",
"0.68751854",
"0.6871379",
"0.6854996",
"0.6828431",
"0.68151575",
"0.6742136",
"0.6717399",
"0.6695433",
"0.66758174",
"0.6674722",
"0.66709757",
"0.6669457",
"0.66510606",
"0.66476166",
"0.6641585",
"0.66279... | 0.0 | -1 |
Create a training dataset pipeline. | def _train_pipeline(self, ds_images, ds_labels):
train_count = self.n_examples - self.val_count
steps_per_epoch = int(train_count // self.batch_size)
repeat_count = self.n_epochs * steps_per_epoch
ds_zip = tf.data.Dataset.zip((ds_images, ds_labels))
ds = (ds_zip.shuffle(train_co... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_pipeline(self, train: LAMLDataset) -> LAMLTransformer:\n raise NotImplementedError",
"def _create_dataset(options, is_training, input_pipeline_context=None):\n dataset = tf.data.Dataset.list_files(options.input_pattern[:],\n shuffle=is_training)\n\n batch... | [
"0.7442308",
"0.721942",
"0.6953127",
"0.6918337",
"0.69162345",
"0.68741584",
"0.68702596",
"0.68258655",
"0.68167907",
"0.67419225",
"0.67142075",
"0.66946465",
"0.6675091",
"0.66722",
"0.6667091",
"0.6664823",
"0.6653677",
"0.6644421",
"0.6638923",
"0.66252214",
"0.6611089... | 0.6852532 | 7 |
Load images and labels for all sets (training, test, etc.) Args | def load_datasets(path_sets, path_images):
dataset_files = tuple(path_set_file.name
for path_set_file in path_sets.glob('*.csv'))
set_names = [dataset_file[: dataset_file.find('_')]
for dataset_file in dataset_files]
if len(dataset_files) == 3:
name_order = ['training... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def load_data(self):\n sets = ['train', 'val']\n images = []\n labels = []\n self.labels_dic = {}\n file = open(self.path + 'wnids.txt')\n train_labels = file.read().split()\n if self.train:\n for fn in range(self.num_classes):\n f = train_... | [
"0.76732665",
"0.7217497",
"0.7213508",
"0.69727165",
"0.69624805",
"0.6955935",
"0.69448864",
"0.6890891",
"0.68819493",
"0.68260866",
"0.6816322",
"0.676275",
"0.6753097",
"0.6715485",
"0.66991544",
"0.6669895",
"0.66598284",
"0.6654237",
"0.6638387",
"0.66322577",
"0.66232... | 0.6972215 | 4 |
Return a friendly HTTP greeting. | def hello():
return 'Hello World!' | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def generate_greeting(name):\n\n greeting = (f\"Hello, {name.title()}. It's nice to meet you!\")\n return greeting",
"def welcome():\n return 'Welcome to Flask!'",
"def greeting_message(name):\n print('My name is ' + name)",
"def Welcome():\n return (\n f\"Welcome to the Surf's Up API!\... | [
"0.67860854",
"0.6719625",
"0.67095745",
"0.6680697",
"0.6663219",
"0.6638394",
"0.6633062",
"0.6628187",
"0.6556032",
"0.6536937",
"0.64776874",
"0.6477268",
"0.64715713",
"0.64644194",
"0.6443056",
"0.6435385",
"0.6400719",
"0.6400167",
"0.637615",
"0.637615",
"0.6367243",
... | 0.0 | -1 |
Given a variable X, get amplitude gain and phase lag time series | def get_annual_cycle_trends(X):
nt,nlat,nlon=X.shape
time = X.getTime()[::12]
tax = cdms.createAxis(time)
tax.designateTime()
atts = X.getTime().attributes
for k in atts:
setattr(tax,k,atts[k])
axlist = [tax,X.getLatitude(),X.getLongitude()]
nyears = nt/12
yrs = X.reshape((ny... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def transform(self, x):\n if self.mode == 'lag':\n shifted = [x.shift(-abs(o), axis=0) for o in self.offsets]\n return pd.concat(shifted, axis=1)",
"def time_lag(data):\n normalize = [i for i in range(1,len(data[0])+1)]\n normalize += normalize[-2::-1]\n idx = len(data[0])//... | [
"0.5732996",
"0.5515259",
"0.549662",
"0.54693466",
"0.54272705",
"0.54181474",
"0.540088",
"0.53992254",
"0.53992254",
"0.532405",
"0.52426326",
"0.52271324",
"0.52215606",
"0.52203465",
"0.52015924",
"0.5173188",
"0.5163655",
"0.5147492",
"0.51406777",
"0.51367784",
"0.5133... | 0.5104675 | 22 |
define the X and Y axis limits | def setlimits(self, Xlim=[], Ylim=[]):
self.data['Xmin'] = Xlim[0]
self.data['Xmax'] = Xlim[1]
self.data['Ymin'] = Ylim[0]
self.data['Ymax'] = Ylim[1] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def xylim(xmin=None, xmax=None, ymin=None, ymax=None):\n plt.axis(xmin=xmin, xmax=xmax, ymin=ymin, ymax=ymax)",
"def set_plot_limits(self) -> None:\n matplotlib.pyplot.xlim(0, self.imgsz[0])\n matplotlib.pyplot.ylim(self.imgsz[1], 0)",
"def setXYLimit(self, xmin=None, xmax=None, ymin=None, yma... | [
"0.7596813",
"0.7430736",
"0.73098594",
"0.73097605",
"0.72856957",
"0.7243441",
"0.71406424",
"0.7069249",
"0.70277447",
"0.6997044",
"0.6965993",
"0.6949617",
"0.69271195",
"0.69196284",
"0.68260384",
"0.68236095",
"0.6807305",
"0.6789631",
"0.6702974",
"0.6700313",
"0.6699... | 0.8024198 | 0 |
Return statistics about the current state of this lock. | def statistics(self) -> LockStatistics:
return LockStatistics(self.locked(), self._owner_task, len(self._waiters)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getstatus(self):\n with self.lock:\n return (self.status, self.time_start)",
"def stats(self):\n\n res = self.read_block(REG_STATS, 9)\n\n ret = {\n \"completed_cycles\": (res[1] << 8) + (res[0] << 0),\n \"last_boot\": {\n \"retries\": res[... | [
"0.70566237",
"0.6653602",
"0.66055226",
"0.6495829",
"0.643085",
"0.6398969",
"0.6388215",
"0.6358421",
"0.63350755",
"0.6322747",
"0.6304496",
"0.62816703",
"0.6240129",
"0.61882067",
"0.61520123",
"0.6146637",
"0.6145223",
"0.614285",
"0.6135839",
"0.61339086",
"0.61233103... | 0.7832995 | 0 |
The current value of the semaphore. | def value(self) -> int:
return self._value | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_current_value(self):\n assert(self.is_started())\n return self.currValue",
"def current_value(self):\n return self.current_counter.value",
"def _value(self):\n # If we have not been initialized, it means we're in a thread: take the\n # value from the root thread.\n ... | [
"0.7580243",
"0.73534614",
"0.71068543",
"0.67414755",
"0.6692586",
"0.66004103",
"0.65688044",
"0.652247",
"0.65035623",
"0.6430214",
"0.640594",
"0.63366646",
"0.6329491",
"0.63124686",
"0.63021564",
"0.6300144",
"0.6289142",
"0.6279947",
"0.62717307",
"0.62699604",
"0.6260... | 0.6042083 | 76 |
The maximum value of the semaphore. | def max_value(self) -> Optional[int]:
return self._max_value | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def max_value(self) -> int:\n return self.__max_value",
"def getMaxValue(self):\n # TODO: make this more consistent accross versions\n # This was a \"fix\" when we started supported PS5000a\n return self.MAX_VALUE",
"def max(self):\n return self.__max",
"def get_max(self):\... | [
"0.774042",
"0.7570058",
"0.73789096",
"0.73633814",
"0.7329304",
"0.7328723",
"0.7328723",
"0.73230714",
"0.72984636",
"0.72764724",
"0.72456115",
"0.71789867",
"0.7158917",
"0.7152428",
"0.7152428",
"0.71417916",
"0.7105671",
"0.7084379",
"0.70440257",
"0.70406324",
"0.7023... | 0.735529 | 4 |
Name of this connection. | def name(self):
return "RPCConnection" | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def connection_name(self) -> str:\n return pulumi.get(self, \"connection_name\")",
"def connection_name(self) -> pulumi.Output[str]:\n return pulumi.get(self, \"connection_name\")",
"def connection_name(self) -> Optional[pulumi.Input[str]]:\n return pulumi.get(self, \"connection_name\")",
... | [
"0.87946135",
"0.8647344",
"0.8022843",
"0.7838024",
"0.778027",
"0.76356965",
"0.7633844",
"0.7633844",
"0.7633844",
"0.7633844",
"0.7633844",
"0.7633844",
"0.7633844",
"0.7633844",
"0.7633844",
"0.7633844",
"0.7625225",
"0.7625225",
"0.7625225",
"0.7625225",
"0.7625225",
... | 0.0 | -1 |
Gets the total expected size of the embedding. | def get_total_embedding_size(self) -> Union[int, List[int]]:
features = self._config.context_features + self._config.sequential_features
feature_dims = [self._embed_dim_dict[feat] for feat in features]
if self._config.embedding_combination_method == (
types.EmbeddingCombinationMethod.SUM_ALL):
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_size(self) -> int:\n total_size = 0\n for entry in self.__entries:\n total_size += entry.get_size()\n return total_size",
"def get_final_emb_size(self):\n size = self.n_layers * 1 * 2 * self.hidden_size\n return size",
"def _input_size(self):\n retur... | [
"0.72786283",
"0.726968",
"0.7224457",
"0.71614337",
"0.7145755",
"0.7144727",
"0.71412814",
"0.71291584",
"0.7115016",
"0.71070266",
"0.7092374",
"0.7082026",
"0.7068235",
"0.7061945",
"0.7058983",
"0.7046681",
"0.7035419",
"0.7003102",
"0.7002194",
"0.698089",
"0.69800216",... | 0.72793114 | 0 |
Combines embeddings into one input for the model. The embeddings can be combined in different ways and this function encapsulates that logic and returns an input vector based on the combination method that is specified. | def _combine_embeddings_for_input(
self, embedding_dict: Dict[str, int]) -> tf.Tensor:
if self._config.embedding_combination_method == (
types.EmbeddingCombinationMethod.SUM_ALL):
return sum(embedding_dict.values())
elif self._config.embedding_combination_method == (
types.EmbeddingC... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def call(self, x, *args, **kwargs):\n with tf.name_scope(\"embedding\"):\n # fills out of bound values with padding symbol\n out_bound_mask = tf.cast(x > (self.vocab_size - 1), dtype=tf.int32)\n x *= 1 - out_bound_mask\n x += out_bound_mask * tf.cast(self.pad_sym,... | [
"0.5955232",
"0.58174616",
"0.58171684",
"0.57225627",
"0.56999433",
"0.5671518",
"0.5625221",
"0.55981785",
"0.55981785",
"0.5576363",
"0.5552107",
"0.55190223",
"0.545595",
"0.5426745",
"0.53774136",
"0.5334926",
"0.5326682",
"0.5315223",
"0.5301722",
"0.5273913",
"0.527373... | 0.7343154 | 0 |
creates a json file to be downloaded | def create_model_json(dataset_id, round_id):
search = get_search_rounds(dataset_id)
round = search[search.round_id == int(round_id)].to_dict(orient='records')[0]
d = {}
for key in ['solution', 'pipeline', 'model_params', 'mode', 'model_class', 'level']:
d[key] = round[key]
# update n_estim... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def download_json(self):\n # make the path dir if it doesn't exist\n if not self.path.is_dir():\n self.path.mkdir(parents=True)\n\n # open a file, send a request for the json and write to the file\n with self.file.open('w') as json_file:\n try:\n jso... | [
"0.80391324",
"0.7390677",
"0.7256598",
"0.7225713",
"0.7204014",
"0.7105369",
"0.7105369",
"0.69785666",
"0.69550407",
"0.69457996",
"0.69399256",
"0.68880796",
"0.6882244",
"0.6880714",
"0.68150705",
"0.68146074",
"0.6795779",
"0.6781171",
"0.67139083",
"0.66577566",
"0.665... | 0.0 | -1 |
Strips the string value if and only if all the characters in the string are not " ". | def strip_if_not_blank(value):
if any([i != " " for i in value]):
return value.strip()
return value | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_strip_string(self, i_str):\n return ''.join(e for e in i_str if e.isalnum())",
"def filter(string):\n # remove all unwanted characters\n return regex2.sub(' ', string)",
"def strip_string(input):\n return input.lower().replace(\" \", \"\")",
"def _clean(self, string):\n return ... | [
"0.7316561",
"0.7145191",
"0.7046523",
"0.7038135",
"0.70192903",
"0.69609845",
"0.6947088",
"0.6947088",
"0.69281536",
"0.69197446",
"0.6914073",
"0.690112",
"0.6887776",
"0.6860018",
"0.683223",
"0.6832113",
"0.6808764",
"0.6795601",
"0.67919624",
"0.677004",
"0.6751491",
... | 0.7467689 | 0 |
Here the core idea is, we can only form subarray of length starting till len(nums)k+1 Since only the first element matters we only need to start from there This is a greedy approach. | def largestSubarray(self, nums: List[int], k: int) -> List[int]:
if k == 1:
return [max(nums)]
hash_map = {}
for i, n in enumerate(nums):
hash_map[n] = i
candidates = nums[: len(nums) - k + 1]
print(candidates)
mx = max(candidates)
mx_id... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def find_subarrays(nums, k):\n res = pre_sum = 0\n dic = {0: 1}\n for i in nums:\n pre_sum += i\n res += dic.get(pre_sum - k, 0)\n dic[pre_sum] = dic.get(pre_sum, 0) + 1\n return res",
"def fn(arr, k):\n ans = []\n for i, x in enumerate(arr): \n while ans and ans... | [
"0.7522313",
"0.69626874",
"0.6730335",
"0.6651089",
"0.65581834",
"0.65444934",
"0.6417753",
"0.6347547",
"0.6309304",
"0.6245642",
"0.6223539",
"0.62230957",
"0.6071673",
"0.6068064",
"0.60648125",
"0.6046987",
"0.60413206",
"0.60287267",
"0.6010355",
"0.5999114",
"0.599673... | 0.6954997 | 2 |
Constructs a ResNet50 model. | def resnet50_ibn_a(last_stride, pretrained=False, **kwargs):
model = ResNet_IBN(last_stride, Bottleneck_IBN, [3, 4, 6, 3], **kwargs)
if pretrained:
model.load_state_dict(model_zoo.load_url(model_urls['resnet50']))
return model | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def resnet50(pretrained=False, **kwargs):\n model = ResNet(Bottleneck, [3, 4, 6, 3], **kwargs)\n if pretrained:\n model.load_state_dict(model_zoo.load_url(model_urls['resnet50']))\n fc = transfer_fc(model.fc)\n model.fc = fc\n return model",
"def resnet50(**kwargs):\n model = ResNet(... | [
"0.7557751",
"0.75548905",
"0.74759895",
"0.74759895",
"0.74759895",
"0.74759895",
"0.74557495",
"0.7386862",
"0.7386862",
"0.73601955",
"0.7355623",
"0.724254",
"0.724254",
"0.7191571",
"0.7158499",
"0.7101107",
"0.70165247",
"0.69687796",
"0.68687624",
"0.6822836",
"0.68010... | 0.0 | -1 |
Supply boundary conditions for an xarray.DataArray da according along the specified dimension. Returns a raw dask or numpy array, depending on the underlying data. | def _apply_boundary_condition(da, dim, left, boundary=None, fill_value=0.0):
if boundary not in ["fill", "extend", "extrapolate"]:
raise ValueError(
"`boundary` must be 'fill', 'extend' or "
"'extrapolate', not %r." % boundary
)
axis_num = da.get_axis_num(dim)
# th... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def data_category_inside_boundary(self: Union[pd.DataFrame, pd.Series],\n boundary: dict, *,\n inclusive: bool = True) -> ndarray:\n pass\n boolean_array = np.full(self.__getattribute__('shape')[0], fill_value=True)\n fo... | [
"0.55187356",
"0.5427349",
"0.51378554",
"0.5105014",
"0.510499",
"0.50856996",
"0.5008775",
"0.49854606",
"0.49854606",
"0.49708956",
"0.49670136",
"0.4929073",
"0.49227515",
"0.4882665",
"0.48811394",
"0.48774448",
"0.4864481",
"0.4864481",
"0.48592335",
"0.48482525",
"0.48... | 0.62297755 | 0 |
Pad an xarray.DataArray da according to the boundary conditions along dim. Return a raw dask or numpy array, depending on the underlying data. | def _pad_array(da, dim, left=False, boundary=None, fill_value=0.0):
if boundary not in ["fill", "extend"]:
raise ValueError("`boundary` must be `'fill'` or `'extend'`")
axis_num = da.get_axis_num(dim)
shape = list(da.shape)
shape[axis_num] = 1
base_array = da.data
index = slice(0, 1) ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def padding(a, dim):\n\n return np.pad(a, (0, dim-len(a)), 'constant', constant_values=(0))",
"def pad(data, maxPadLength=False):\n data_padded = data.copy()\n bad_indexes = np.isnan(data)\n good_indexes = np.logical_not(bad_indexes)\n good_data = data[good_indexes]\n interpolated = np.interp(\... | [
"0.5916931",
"0.555809",
"0.55494297",
"0.5496643",
"0.54872304",
"0.5461839",
"0.5435356",
"0.5432517",
"0.53927624",
"0.53607583",
"0.5343201",
"0.5320598",
"0.5312922",
"0.52983654",
"0.52979755",
"0.5248074",
"0.52351177",
"0.5210277",
"0.5204645",
"0.5204212",
"0.5164592... | 0.7270703 | 0 |
Obstacles created by self.create_obstacles are drawn on self.windows as a black rectangles. | def draw_obstacles(self):
for obstacle in self.obstacles:
obstacle.draw(self.window, Colors.BLACK.value) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def draw_obstacles():\n for obstacle in obstacles:\n plt.gca().add_patch(obstacle)",
"def place_obstacles():\n #Randomly generate different sized rectangles\n #Soem may overlap, which gives more variety in shape of obstacles\n xvals = np.random.randint(0,self.map_dimens... | [
"0.70438933",
"0.69378084",
"0.68815863",
"0.685203",
"0.6783483",
"0.666752",
"0.6614215",
"0.6580512",
"0.65752584",
"0.6495871",
"0.64657646",
"0.6459727",
"0.6416091",
"0.63066995",
"0.6299761",
"0.6271255",
"0.61703116",
"0.61362374",
"0.60891026",
"0.6071949",
"0.607047... | 0.85527563 | 0 |
Grabs fuel esc from EERC | def get_esc(state_abbr, fuel_type="NG"):
temp_dict = {"NG": "Natural Gas", "COAL" : "Coal", "PETRO": "Residual"}
return UpdateParams.eerc_esc.loc[state_abbr, temp_dict[fuel_type]] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def load_energy(self, zpe_scale_factor=1.):\n e_elect = None\n with open(self.path, 'r') as f:\n for line in f:\n if 'FINAL SINGLE POINT ENERGY' in line: # for all methods in Orca\n e_elect = float(line.split()[-1])\n if e_elect is None:\n ... | [
"0.614474",
"0.61137724",
"0.61131305",
"0.58843523",
"0.5829121",
"0.576634",
"0.5709528",
"0.5694991",
"0.5688178",
"0.564943",
"0.56155294",
"0.5608964",
"0.55574423",
"0.554091",
"0.55266964",
"0.55205625",
"0.5486249",
"0.54649156",
"0.53992087",
"0.53921926",
"0.5388455... | 0.6570786 | 0 |
Create a remote resource from this instance. | def create(self, session):
# Service expects a naked PUT. Omit properties.
self.create_by_id(session, None, self.id, path_args=self)
self._reset_dirty()
return self | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_remote(self, name: str, url: str, **kwargs: Any) -> Remote:\n return Remote.create(self, name, url, **kwargs)",
"def create_resource(self, **kwargs):\n results = self.api.action.resource_create(**kwargs)\n # TODO: use `results` rather than re-download, using an isolation layer to ... | [
"0.6997501",
"0.6764199",
"0.6608829",
"0.6342341",
"0.6059206",
"0.60024816",
"0.59422565",
"0.59315217",
"0.5917065",
"0.5904616",
"0.5880331",
"0.58677787",
"0.5837186",
"0.5768227",
"0.57088333",
"0.56948733",
"0.56938636",
"0.56754684",
"0.5659072",
"0.56500465",
"0.5639... | 0.0 | -1 |
Computes the backward pass, i.e., gradients. | def backward(self, X, Y, P, H, lmd):
G = - (Y - P)
_, Npts = P.shape
n_layers = len(self.hidden_units)
gradients_W = []
gradients_b = []
for i in range(n_layers, -1, -1):
if i == 0:
grad_W = G @ X.T * (1/Npts) + 2 * lmd * self.W[i]
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def backward(self, gradient):\n #TODO\n pass",
"def backward(self, gradient):\n #TODO\n pass",
"def backward(self, gradient):\n raise NotImplementedError()",
"def backward(self):\n gradient = blah\n return gradient",
"def backward(self):\n gradient = ... | [
"0.82310915",
"0.82310915",
"0.8200846",
"0.80617994",
"0.80617994",
"0.8000902",
"0.7897286",
"0.78913283",
"0.7866503",
"0.78530025",
"0.7852304",
"0.7824065",
"0.78089327",
"0.7790098",
"0.7779452",
"0.7766099",
"0.7762307",
"0.7718012",
"0.7675431",
"0.76700395",
"0.76692... | 0.7445272 | 41 |
Get the description of a job. | def get_job_description(self, job, context=None):
return self._client.call_method(
'UserAndJobState.get_job_description',
[job], self._service_ver, context) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def describe_job(self):\n # GET /jobs/{job_id}\n pass",
"def describe_text_translation_job(JobId=None):\n pass",
"def get_job(self) -> Dict[Text, Text]:\n request = self._client.projects().jobs().get(name=self._job_name)\n return request.execute()",
"def describe_labeling_job(LabelingJ... | [
"0.7607637",
"0.7192499",
"0.67830104",
"0.6780596",
"0.6714741",
"0.6707569",
"0.6679356",
"0.66656226",
"0.66656226",
"0.66567254",
"0.66285944",
"0.65982926",
"0.65800416",
"0.65800416",
"0.65800416",
"0.65800416",
"0.65800416",
"0.65800416",
"0.65800416",
"0.65800416",
"0... | 0.83598095 | 0 |
Get the detailed error message, if any | def get_detailed_error(self, job, context=None):
return self._client.call_method(
'UserAndJobState.get_detailed_error',
[job], self._service_ver, context) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def error(self):\n errors = self._info.get('error', {}).get('errors')\n if not errors:\n return None\n return ' '.join(err.get('message', 'unknown') for err in errors)",
"def get_error_message(self):\n return self.error_message.get_error_message()",
"def error_message(self) -> str:\n ... | [
"0.8469181",
"0.8417391",
"0.83349466",
"0.83349466",
"0.83349466",
"0.8247297",
"0.8156396",
"0.8156396",
"0.8156396",
"0.8156396",
"0.8156396",
"0.8156396",
"0.8156396",
"0.8105616",
"0.80623436",
"0.805907",
"0.8025505",
"0.79834616",
"0.7958321",
"0.793723",
"0.79117244",... | 0.0 | -1 |
Get the owner of a job. | def get_job_owner(self, job, context=None):
return self._client.call_method(
'UserAndJobState.get_job_owner',
[job], self._service_ver, context) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def owner(self) -> None:\n return self.bot.get_user(self.bot.config.owner_ids[0])",
"def get_owner(self):\n return self.__owner",
"def get_owner(self, obj):\n return obj.user.username",
"def owner(self):\n answer = self._call('owner')\n return answer.owner",
"def get_owne... | [
"0.7093864",
"0.705176",
"0.6957282",
"0.69351876",
"0.692269",
"0.6863196",
"0.68565017",
"0.68523395",
"0.68463093",
"0.68463093",
"0.682809",
"0.680491",
"0.67452174",
"0.67452174",
"0.671068",
"0.669592",
"0.6671211",
"0.666671",
"0.666671",
"0.6664125",
"0.6561198",
"0... | 0.8874359 | 0 |
Set our public name on the server. | def conn(self):
self.send("setname/{}/{}".format(self.msg_id, self.name))
self.msg_id += 1 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_name(self,name):\r\n self._name = __name",
"def set_name(self, newname=\"\"):\n self.name = newname",
"def set_name(self, application_name):\r\n self._name = application_name",
"def set_name(self, name):\n self.settings[\"name\"] = name",
"def set_name(self, name):\n\t\tself... | [
"0.70426464",
"0.70157635",
"0.6988657",
"0.6926462",
"0.6868796",
"0.6825859",
"0.6794912",
"0.6791303",
"0.6785273",
"0.67521185",
"0.67521185",
"0.67521185",
"0.67521185",
"0.66850334",
"0.66850334",
"0.66785395",
"0.6673879",
"0.6654393",
"0.6654393",
"0.6654393",
"0.6654... | 0.0 | -1 |
set window at the center of window | def center(self):
# get the compute screen's size
screen = QDesktopWidget().screenGeometry()
# get the app windows' size
size = self.geometry()
self.move(int((screen.width() - size.width()) / 2), int((screen.height() - size.height()) / 2)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def center(window):\n window.update_idletasks()\n\n # Find the screen resolution\n screen_width = window.winfo_screenwidth()\n screen_height = window.winfo_screenheight()\n\n # Find new (x, y) coordinates\n size = tuple(int(_) for _ in window.geometry().split('+')[0].split('x'))\n x = screen_w... | [
"0.8669063",
"0.8547829",
"0.85407895",
"0.83933437",
"0.8392298",
"0.837827",
"0.82572865",
"0.81704116",
"0.81422913",
"0.81422913",
"0.8075503",
"0.7866476",
"0.78477573",
"0.7807001",
"0.779239",
"0.77475125",
"0.7680406",
"0.7653157",
"0.7630904",
"0.76215637",
"0.761899... | 0.8295385 | 6 |
Returns a UserConfig object from an environment variable. | def load_from_env_var(cls, env_var):
return cls.load_from_filename(os.environ.get(env_var)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def from_env():\n app_env = os.getenv(\"APP_ENV\", \"TEST\")\n return ConfigurationFactory.get_config(app_env)",
"def config(env=DEFAULT_ENV, default=None, engine=None):\r\n\r\n config = {}\r\n\r\n s = os.environ.get(env, default)\r\n\r\n if s:\r\n config = parse(s, engine)\r\n\r\n ... | [
"0.6596632",
"0.6080266",
"0.60578686",
"0.60304",
"0.5918862",
"0.58581537",
"0.58541805",
"0.57985073",
"0.5791923",
"0.5786983",
"0.5778541",
"0.56761557",
"0.56284994",
"0.562235",
"0.56174785",
"0.5572147",
"0.55627424",
"0.5561496",
"0.55554324",
"0.5537923",
"0.5531441... | 0.62398374 | 1 |
Function to determine if list of topics is in the general topics table. | def validate_new_curriculum_topics(self, curriculum_topics):
for cur in curriculum_topics:
# check to make sure its in the general topics table
self.db_cursor.execute("""SELECT COUNT(*) FROM Topic WHERE name = %s""", (cur,))
ct = self.db_cursor.fetchone()
ct = ct... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def topic_exists(topic):\n client = AdminClient({\"bootstrap.servers\": \"PLAINTEXT://localhost:9092\"})\n topic_metadata = client.list_topics(timeout=5)\n return topic in set(t.topic for t in iter(topic_metadata.topics.values()))",
"def is_site_in_topic(cls) -> bool:\n return True",
"def is_si... | [
"0.6132043",
"0.6128616",
"0.6128616",
"0.6128616",
"0.5831514",
"0.565989",
"0.5636484",
"0.5567121",
"0.54846406",
"0.5403851",
"0.53999376",
"0.5375112",
"0.53463024",
"0.5318869",
"0.52974755",
"0.52945495",
"0.528952",
"0.52721524",
"0.52409536",
"0.5238508",
"0.5227265"... | 0.60205173 | 4 |
Fucntion to set the course in the db | def set_course(self, new_course, updating=False):
COURSE_QUERY = """UPDATE Course SET subject_code = %s, credit_hours = %s, description = %s WHERE name = %s""" if updating \
else """INSERT INTO Course (subject_code, credit_hours, description, name) VALUES (%s, %s, %s, %s)"""
self.db_cursor.... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def save_course(self):\r\n self.course.save()\r\n self.store.update_item(self.course, self.user.id)",
"def edit_course(self, course):\n EDIT_COURSE = \"\"\"UPDATE Course SET subject_code = %s, credit_hours = %s, description = %s WHERE name = %s\"\"\"\n\n self.db_cursor.execute(EDIT_CO... | [
"0.76697034",
"0.69201535",
"0.69193166",
"0.6838468",
"0.682473",
"0.6684611",
"0.66294444",
"0.6570262",
"0.6566537",
"0.65445465",
"0.6534536",
"0.64993685",
"0.6451552",
"0.64059365",
"0.6341957",
"0.6327892",
"0.6260288",
"0.62347114",
"0.61435986",
"0.6129142",
"0.61188... | 0.69831127 | 1 |
Returns whether there are commands in the dictionary. | def is_empty(self):
return len(self.commands) == 0 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def has_commands(self) -> bool:\n return len(self.commands) > 0",
"def _iscommand(self, key):\r\n\t\tyes = False\r\n\t\tfor i in COMMAND_NAME.keys():\r\n\t\t\tif key == i: \r\n\t\t\t\tyes = True; break\r\n\t\treturn yes",
"def has_command_with_name(self, command_name):\n return command_name in se... | [
"0.84124696",
"0.7831274",
"0.73959315",
"0.73806435",
"0.73750824",
"0.7207478",
"0.7203815",
"0.71357805",
"0.7119071",
"0.7004909",
"0.6871515",
"0.68641925",
"0.6806875",
"0.68040174",
"0.6730361",
"0.6730361",
"0.67239463",
"0.6710142",
"0.66958606",
"0.6610057",
"0.6589... | 0.71805626 | 7 |
Returns a dictionary of files and folders for a given reference and path. Implemented using ``git lstree``. If an invalid reference and/or path None is returned. | def ls_tree(reference, path=None, directory=None):
# Try to track the reference as a branch
track_branches(reference, directory=directory)
cmd = 'git ls-tree ' + reference
if path is not None and path != '':
cmd += ':' + path
retcode, out, err = execute_command(cmd, autofail=False, silent_er... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_tree_hash_dict(cls, current_dir, file_path, dirs, files, ref_table):\n\n # we sort just to ensure there are no arrangement issues that could affect the hash outcome\n file_hashs = sorted([ref_table['%s/%s' % (file_path, file)]['hash'] for file in files])\n dir_hashs = sorted([ref_ta... | [
"0.61584675",
"0.5878132",
"0.58635056",
"0.5799189",
"0.57655996",
"0.57045203",
"0.5640728",
"0.55679065",
"0.55450636",
"0.5512755",
"0.5477827",
"0.54668874",
"0.54139876",
"0.54109913",
"0.52307737",
"0.5205111",
"0.5195961",
"0.51922023",
"0.5183229",
"0.5154966",
"0.51... | 0.7030277 | 0 |
Returns True is the working branch has untracked files, False otherwise. | def has_untracked_files(directory=None):
out = check_output('git status', shell=True, cwd=directory)
if '# Untracked files:' in out:
return True
return False | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_git_dirty():\n dirty_status = local('git diff --quiet || echo \"*\"', capture=True)\n if dirty_status == '*':\n return True\n\n untracked_count = int(local('git status --porcelain 2>/dev/null| grep \"^??\" | wc -l', capture=True))\n if untracked_count > 0:\n return True\n\n retu... | [
"0.7369675",
"0.7245063",
"0.7186721",
"0.6902411",
"0.69018334",
"0.6766072",
"0.6752072",
"0.67305964",
"0.6614926",
"0.66121066",
"0.6557952",
"0.6492854",
"0.6405835",
"0.64045507",
"0.62953687",
"0.626833",
"0.6249092",
"0.6208174",
"0.61656004",
"0.6162128",
"0.6151879"... | 0.8167415 | 0 |
Returns True if the working branch has local changes, False otherwise. | def has_changes(directory=None):
out = check_output('git status', shell=True, cwd=directory)
if 'nothing to commit (working directory clean)' in out:
return False
if 'nothing to commit, working directory clean' in out:
return False
if 'nothing to commit, working tree clean' in out:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def local_changes():\n result, output = popen('git status', False, False)\n try:\n return not output[-1].startswith(\"nothing to commit\")\n except IndexError:\n return True",
"def is_git_dirty():\n dirty_status = local('git diff --quiet || echo \"*\"', capture=True)\n if dirty_statu... | [
"0.8103679",
"0.70879",
"0.70589244",
"0.7040565",
"0.6930281",
"0.6911634",
"0.6874067",
"0.65720373",
"0.6568718",
"0.65084153",
"0.6473522",
"0.6444226",
"0.63482803",
"0.6299093",
"0.62665546",
"0.62546307",
"0.6243886",
"0.62398034",
"0.6228319",
"0.61778355",
"0.6164162... | 0.65647006 | 9 |
Returns a list of tags in the git repository. | def get_tags(directory=None):
out = check_output('git tag -l', shell=True, cwd=directory)
return [l.strip() for l in out.splitlines()] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def do_list_tags(cs, args):\n resp, tags = cs.repositories.list_tags(args.repository)\n tags = [{\"Tag\": t} for t in tags]\n utils.print_list(tags, [\"Tag\"], sortby=\"Tag\")",
"def get_tags(self):\n tags = []\n for image in self.client.images.list():\n for tag in image.tags:\n... | [
"0.7660419",
"0.76550305",
"0.7644801",
"0.75672406",
"0.74624276",
"0.73732084",
"0.7258995",
"0.72259563",
"0.72047967",
"0.71400553",
"0.70663697",
"0.7060839",
"0.7045013",
"0.6962905",
"0.6937564",
"0.6937564",
"0.6908174",
"0.688024",
"0.68553925",
"0.68434227",
"0.6831... | 0.7836319 | 0 |
Returns the git root directory above the given dir. If the given dir is not in a git repository, None is returned. | def get_root(directory=None):
cmd = 'git rev-parse --show-toplevel'
try:
output = check_output(cmd, shell=True, cwd=directory, stderr=PIPE)
except CalledProcessError:
return None
return output.strip() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def gitroot(dir=\"\"):\n # Supress errors from Git\n git_cmd = \"git rev-parse --show-toplevel \" + dir + \" 2> \" + os.devnull\n if dir:\n original_cwd = os.getcwd()\n os.chdir(dir)\n try:\n sub_out = subprocess.check_output(git_cmd, shell=True)\n cmd_out = sub_out.decode()... | [
"0.78679776",
"0.73824674",
"0.7373398",
"0.72000515",
"0.6936625",
"0.67536604",
"0.6708627",
"0.6543182",
"0.6528905",
"0.6458582",
"0.6412014",
"0.64080334",
"0.6274935",
"0.6274888",
"0.62603515",
"0.6223945",
"0.6156869",
"0.60560584",
"0.6029711",
"0.59609705",
"0.59524... | 0.7278139 | 3 |
Generates a random string of the specified length. | def generate_random_string(length = 30):
m_available_chars = ascii_letters + digits
return "".join(choice(m_available_chars) for _ in xrange(length)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _generate_random_string(length: int):\n\tall_chars = string.ascii_letters + string.digits\n\treturn ''.join(random.choices(all_chars, k=length))",
"def generate_random_string(length):\r\n return ''.join(random.choice(string.ascii_uppercase + string.digits) for _ in range(length))",
"def create_random_st... | [
"0.8940031",
"0.88641787",
"0.868772",
"0.86801916",
"0.86554873",
"0.8636561",
"0.86250025",
"0.85664594",
"0.85466874",
"0.8533055",
"0.8530097",
"0.8500764",
"0.8437358",
"0.8421766",
"0.84211844",
"0.84199953",
"0.8400087",
"0.8391604",
"0.83819515",
"0.8348653",
"0.83343... | 0.87689024 | 2 |
Close the connection to the manager. | def close(self):
if self.socket is not None:
try:
self.socket.shutdown(2)
except Exception:
pass
try:
self.socket.close()
except Exception:
pass
self.socket = None | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def close_connection(self):\n self.session.close()",
"def close(self):\n self._connection.close()",
"def close_connection(self):\n try:\n ljm.close(self.connection_handle)\n except LJMError:\n pass",
"def close_connection(self):\n self.connection.close()",... | [
"0.7840157",
"0.7811793",
"0.7789384",
"0.77485055",
"0.77485055",
"0.7745745",
"0.77249795",
"0.7716535",
"0.77129763",
"0.77098423",
"0.7700003",
"0.76821756",
"0.76821756",
"0.76821756",
"0.76821756",
"0.76821756",
"0.76821756",
"0.76821756",
"0.76603454",
"0.76227885",
"0... | 0.0 | -1 |
change the due date | def change_end_date(self, new_end_date):
self.end_date = new_end_date | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def due_date(self, due_date):\n\n self._due_date = due_date",
"def due_date(self, due_date: date):\n\n self._due_date = due_date",
"def date_due(self, date_due):\n\n self._date_due = date_due",
"def set_statement_due_date(self, due_date):\n due_date_to_set = None\n if due_d... | [
"0.7644258",
"0.7636794",
"0.7599661",
"0.7203695",
"0.7072922",
"0.68700165",
"0.6858573",
"0.67680717",
"0.6686194",
"0.66313714",
"0.6627486",
"0.6271072",
"0.62584436",
"0.62204534",
"0.62119794",
"0.6169781",
"0.6045487",
"0.5993843",
"0.59719455",
"0.59285605",
"0.59240... | 0.53747684 | 60 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.