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 |
|---|---|---|---|---|---|---|
Create a temporary directory and register cleanup on shutdown. | def _make_tempdir(self):
self._clean_tempdir()
os.mkdir(self._get_tempdir())
assert os.path.exists(self._get_tempdir())
rospy.on_shutdown(self._clean_tempdir)
rospy.on_shutdown(self._clear_cache) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def mkdtemp_clean(suffix=\"\", prefix=\"tmp\", dir=None):\r\n the_dir = tempfile.mkdtemp(suffix=suffix, prefix=prefix, dir=dir)\r\n atexit.register(cleanup_tempdir, the_dir)\r\n return the_dir",
"def tmp_dir():\n tmpdir = tempfile.mkdtemp()\n yield tmpdir\n shutil.rmtree(tmpdir)",
"def temp_d... | [
"0.7621937",
"0.7594141",
"0.75772876",
"0.7548863",
"0.7522999",
"0.75137234",
"0.7470257",
"0.7435817",
"0.7432095",
"0.73904216",
"0.7382372",
"0.7374082",
"0.7339351",
"0.7336091",
"0.73277134",
"0.73253",
"0.73110044",
"0.72732085",
"0.726166",
"0.7257273",
"0.72555584",... | 0.7381035 | 11 |
Test to make sure this rule does trigger with a document that contains a block quote with text and a LRD that has extr soace before line 1. | def test_md027_bad_block_quote_lrd_multiple_one_plus_one():
# Arrange
scanner = MarkdownScanner()
supplied_arguments = [
"scan",
"test/resources/rules/md027/bad_block_quote_lrd_multiple_one_plus_one.md",
]
expected_return_code = 1
expected_output = (
"test/resources/rul... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_md027_good_block_quote_lrd():\n\n # Arrange\n scanner = MarkdownScanner()\n source_path = os.path.join(\n \"test\", \"resources\", \"rules\", \"md027\", \"good_block_quote_lrd.md\"\n )\n supplied_arguments = [\n \"scan\",\n source_path,\n ]\n\n expected_return_cod... | [
"0.63663405",
"0.6093686",
"0.59989995",
"0.5985807",
"0.5970034",
"0.589858",
"0.5890217",
"0.588437",
"0.5869971",
"0.58639336",
"0.58505225",
"0.5838655",
"0.5819833",
"0.58019304",
"0.5799876",
"0.5777527",
"0.57767797",
"0.5764318",
"0.57000995",
"0.56994516",
"0.5689145... | 0.5301614 | 70 |
Test to make sure this rule does trigger with a document that contains a block quote with text and a LRD that has extr soace before line 3. | def test_md027_bad_block_quote_lrd_multiple_three_plus_one():
# Arrange
scanner = MarkdownScanner()
supplied_arguments = [
"scan",
"test/resources/rules/md027/bad_block_quote_lrd_multiple_three_plus_one.md",
]
expected_return_code = 1
expected_output = (
"test/resources... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_md027_good_block_quote_lrd():\n\n # Arrange\n scanner = MarkdownScanner()\n source_path = os.path.join(\n \"test\", \"resources\", \"rules\", \"md027\", \"good_block_quote_lrd.md\"\n )\n supplied_arguments = [\n \"scan\",\n source_path,\n ]\n\n expected_return_cod... | [
"0.63833374",
"0.6095455",
"0.6080937",
"0.6065068",
"0.60517097",
"0.59606844",
"0.5901599",
"0.5891385",
"0.58706456",
"0.58504146",
"0.5818267",
"0.5786788",
"0.5769386",
"0.57499164",
"0.5735461",
"0.5732766",
"0.57169867",
"0.57141286",
"0.5708248",
"0.5705581",
"0.57016... | 0.5380747 | 62 |
Test to make sure this rule does trigger with a document that contains a block quote with text and a LRD that has extr soace before line 4. | def test_md027_bad_block_quote_lrd_multiple_four_plus_one():
# Arrange
scanner = MarkdownScanner()
supplied_arguments = [
"scan",
"test/resources/rules/md027/bad_block_quote_lrd_multiple_four_plus_one.md",
]
expected_return_code = 1
expected_output = (
"test/resources/r... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_md027_good_block_quote_lrd():\n\n # Arrange\n scanner = MarkdownScanner()\n source_path = os.path.join(\n \"test\", \"resources\", \"rules\", \"md027\", \"good_block_quote_lrd.md\"\n )\n supplied_arguments = [\n \"scan\",\n source_path,\n ]\n\n expected_return_cod... | [
"0.6448629",
"0.60249776",
"0.6021609",
"0.60215855",
"0.6010535",
"0.59335005",
"0.5910625",
"0.59005713",
"0.58298445",
"0.58048666",
"0.5759677",
"0.575239",
"0.574747",
"0.5721983",
"0.57201666",
"0.5709772",
"0.5692149",
"0.5691988",
"0.5683479",
"0.5683215",
"0.56827235... | 0.53862244 | 59 |
Test to make sure this rule does trigger with a document that contains a block quote with text and a thematic break with extra. | def test_md027_bad_block_quote_thematic_plus_one():
# Arrange
scanner = MarkdownScanner()
supplied_arguments = [
"scan",
"test/resources/rules/md027/bad_block_quote_thematic_plus_one.md",
]
expected_return_code = 1
expected_output = (
"test/resources/rules/md027/bad_blo... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_md027_good_block_quote_thematic():\n\n # Arrange\n scanner = MarkdownScanner()\n source_path = os.path.join(\n \"test\", \"resources\", \"rules\", \"md027\", \"good_block_quote_thematic.md\"\n )\n supplied_arguments = [\n \"scan\",\n source_path,\n ]\n\n expected_... | [
"0.6275733",
"0.61607784",
"0.6156871",
"0.6149798",
"0.60846865",
"0.6038486",
"0.6030029",
"0.59809166",
"0.59612834",
"0.5927098",
"0.59254724",
"0.59002286",
"0.58858633",
"0.58825076",
"0.58773524",
"0.5869576",
"0.5867867",
"0.582076",
"0.5815315",
"0.57941794",
"0.5770... | 0.6040179 | 5 |
Test to make sure this rule does trigger with a document that contains a block quote with SetExt with extra space in middle line. | def test_md027_bad_block_quote_setext_heading_multiples_middle_plus_one():
# Arrange
scanner = MarkdownScanner()
supplied_arguments = [
"--disable-rules",
"md023",
"scan",
"test/resources/rules/md027/bad_block_quote_setext_heading_multiples_middle_plus_one.md",
]
ex... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_md027_bad_block_quote_setext_heading_second_line():\n\n # Arrange\n scanner = MarkdownScanner()\n source_path = os.path.join(\n \"test\",\n \"resources\",\n \"rules\",\n \"md027\",\n \"bad_block_quote_setext_heading_second_line.md\",\n )\n supplied_argumen... | [
"0.6472383",
"0.6352704",
"0.63349783",
"0.6303687",
"0.626392",
"0.6166862",
"0.6156972",
"0.6096903",
"0.6037601",
"0.6023246",
"0.6007932",
"0.5968703",
"0.5966212",
"0.59043175",
"0.5896568",
"0.5892709",
"0.58880943",
"0.58830607",
"0.58574295",
"0.58546335",
"0.58464587... | 0.5988328 | 11 |
Set a value to the default value field. | async def save(self, category, key, value=None):
if value is None:
data = {}
elif self.default_value_field is None:
data = value
else:
data = {self.default_value_field: value}
stmt = update(self.model).values(**data)
if self.category_field:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def default(self, default):\n\n self._set_field(\"value\", default)",
"def set_value_to_default(self):\n self.setValue(self.default_value)",
"def default_value(self, default_value):\n\n self._default_value = default_value",
"def default_value(self, default_value):\n\n self._defaul... | [
"0.8779659",
"0.85444957",
"0.84207463",
"0.84207463",
"0.84207463",
"0.8336261",
"0.82971627",
"0.8248145",
"0.8235928",
"0.78229636",
"0.76896775",
"0.7598059",
"0.7531874",
"0.75219864",
"0.7491882",
"0.7438307",
"0.73879236",
"0.73678184",
"0.73588204",
"0.7180897",
"0.71... | 0.0 | -1 |
Set all data to the storage. | async def set_all(self, all_data: dict) -> None:
with self.session.begin():
# remove old data
stmt = delete(self.model)
self.session.execute(stmt)
for cate_name, cate_data in all_data.items():
for key_name, key_data in cate_data.items():
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_storage(self):\n pass",
"def reset_storage(self):\n self.set_storage()",
"def _setAll(self, data):\n super(SummonerModel, self)._setAll(data)",
"def write(self):\n\n for storage in self.storages.values():\n self.__write(storage)\n storage.clear()",
... | [
"0.7189221",
"0.69857275",
"0.6771372",
"0.65532845",
"0.64779353",
"0.64779353",
"0.64558625",
"0.63233787",
"0.6323012",
"0.63119304",
"0.6299617",
"0.6272376",
"0.6241575",
"0.6240916",
"0.62324184",
"0.6231561",
"0.6231561",
"0.6221956",
"0.62170297",
"0.62102175",
"0.620... | 0.63386655 | 7 |
Set the case name for the ElasticSearch database connection. | def SetCaseName(self, case_name):
if case_name:
self._index_name = case_name.lower()
else:
self._index_name = uuid.uuid4().hex | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def db_name(self, db_name):\n\n self._db_name = db_name",
"async def set_db_name_field(self, db_name_field):\n self.db_name_field = db_name_field",
"def setCaseSensitive(self, state):\n self.__caseSensitive = state",
"def set_cname(self, cname):\n self.__cname = cname",
"def dri... | [
"0.62378204",
"0.61738",
"0.60346305",
"0.5984457",
"0.59779984",
"0.5893552",
"0.5782512",
"0.57433385",
"0.5718853",
"0.5638902",
"0.5593515",
"0.5593515",
"0.55490947",
"0.5530567",
"0.5526554",
"0.55239755",
"0.55036765",
"0.54988074",
"0.5490057",
"0.5490057",
"0.545169"... | 0.7853161 | 0 |
Set the ElasticSearch connection. | def SetServerInformation(self, elastic_host, elastic_port):
self._elastic_db = pyelasticsearch.ElasticSearch(
u'http://{0:s}:{1:d}'.format(elastic_host, elastic_port)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self, conn_str=ELASTICSEARCH_CONN):\n self.es = Elasticsearch(conn_str)",
"def _init_es(self):\n es = Elasticsearch([{'host': elastic_conf['host'], 'port': elastic_conf['port']}])\n print('Connected to Elastic Search:', es.ping())\n return es",
"def es_connection_setUp(... | [
"0.71008384",
"0.6721947",
"0.670208",
"0.6453877",
"0.64338213",
"0.63132155",
"0.61498874",
"0.60393184",
"0.60326946",
"0.58848786",
"0.587255",
"0.5722186",
"0.5622949",
"0.55808514",
"0.5542685",
"0.5529414",
"0.5489321",
"0.5482348",
"0.54750836",
"0.546491",
"0.5446227... | 0.67335033 | 1 |
Returns a list of strings representing the command line arguments to pass to the testapplication for the next run. This is especially useful for tests that execute the testapplication multiple times. | def get_exec_args(self):
return [] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_cli_arguments(self):\n pass",
"def get_unparsed_args():\n # Threads are set to 1 so that running tests doesn't completely drain\n # computing power, although it slows down the tests.\n # Specify output folder, else it will create folder in working directory\n # where the test module is... | [
"0.7011682",
"0.69726247",
"0.6809944",
"0.67498183",
"0.6723961",
"0.6669389",
"0.66592723",
"0.65598863",
"0.6557508",
"0.64704007",
"0.64372194",
"0.6376108",
"0.63069546",
"0.63061637",
"0.6301829",
"0.6224259",
"0.6212848",
"0.6212848",
"0.6212848",
"0.6212848",
"0.62128... | 0.66283476 | 7 |
Get the x value of the point. Returns float The x value of the point | def x(self) -> float:
return self.data[0] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def x(self):\n return _libsbml.Point_x(self)",
"def x(self):\n if self._x is None:\n self.compute_coordinates()\n return self._x",
"def get_x(self):\n return self.coords[0]",
"def get_x_position(self):\n return self.actual_coordinates[0]",
"def getXCoordinate(s... | [
"0.821458",
"0.796893",
"0.7925576",
"0.78668594",
"0.7785076",
"0.77823466",
"0.7744153",
"0.7734525",
"0.7718544",
"0.77176",
"0.7613536",
"0.75262904",
"0.7520306",
"0.7517453",
"0.7517453",
"0.74861336",
"0.72622764",
"0.72053623",
"0.71809185",
"0.71261984",
"0.71261984"... | 0.7577774 | 11 |
Get the y value of the point Returns float The y value of the point | def y(self) -> float:
return self.data[1] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def y(self):\n return _libsbml.Point_y(self)",
"def get_y_position(self):\n return self.actual_coordinates[1]",
"def get_y(self):\n return self.coords[1]",
"def y(self):\n return self.coords[1]",
"def get_y(self, x):\n p, y = self.get_p_y(x)\n return y",
"def get... | [
"0.82114613",
"0.81421626",
"0.8138657",
"0.81233704",
"0.8042052",
"0.8023115",
"0.79977566",
"0.79866225",
"0.79581773",
"0.7956725",
"0.7956725",
"0.7936314",
"0.7931571",
"0.78469795",
"0.78173864",
"0.7799353",
"0.7790048",
"0.7764007",
"0.7725205",
"0.7717027",
"0.77029... | 0.79950595 | 7 |
Checks if an object is a ctypes type object | def is_ctypes_instance(obj):
return issubclass(type(obj), ctypes.Structure) or issubclass(type(obj), ctypes.Union) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_basic_ctype(self, objtype):\n if objtype in [self.c_char_p, self.c_void_p, self.CString]:\n return False\n # DOC: if <ctypes.c_uint> is not in self.__basic_types, its probably\n # because you are using the wrong ctypes Proxy instance\n return objtype in self.__basic_ty... | [
"0.7463503",
"0.7131629",
"0.70701754",
"0.6947841",
"0.69219625",
"0.68754405",
"0.6836128",
"0.68286973",
"0.67927957",
"0.67747766",
"0.6769174",
"0.6761029",
"0.6589636",
"0.65263754",
"0.6525315",
"0.6512753",
"0.64886576",
"0.6473045",
"0.6446188",
"0.6411006",
"0.63650... | 0.8250387 | 0 |
Checks if an object is a ctype array. | def is_array_type(self, objtype):
return isinstance(objtype, self.__arrayt) # _ctypes.PyCArrayType | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_array_of_basic_type(self, objtype):\n return self.is_array_type(objtype) and hasattr(objtype, '_type_') and self.is_basic_type(objtype._type_)",
"def is_arraylike(obj):\n if isinstance(obj, list):\n return True\n elif isinstance(obj, np.ndarray):\n return True\n elif isinstan... | [
"0.7421258",
"0.7331904",
"0.72318226",
"0.72308195",
"0.7163036",
"0.7010663",
"0.7010071",
"0.6974142",
"0.67670524",
"0.6748442",
"0.67200994",
"0.670125",
"0.66204154",
"0.66097337",
"0.6519684",
"0.6497321",
"0.64862347",
"0.6461621",
"0.64504594",
"0.6397605",
"0.635828... | 0.8044849 | 0 |
Checks if an object is a ctypes basic type, or a python basic type. | def is_basic_type(self, objtype):
if not hasattr(objtype, '_type_'):
# could be python types
return objtype in [int, long, float, bool]
return self.is_basic_ctype(objtype) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_basic_ctype(self, objtype):\n if objtype in [self.c_char_p, self.c_void_p, self.CString]:\n return False\n # DOC: if <ctypes.c_uint> is not in self.__basic_types, its probably\n # because you are using the wrong ctypes Proxy instance\n return objtype in self.__basic_ty... | [
"0.80387914",
"0.73277277",
"0.69723934",
"0.64764166",
"0.636784",
"0.629404",
"0.6272574",
"0.62469447",
"0.6227151",
"0.61880857",
"0.6177784",
"0.6177761",
"0.6142716",
"0.61264646",
"0.60858154",
"0.60374063",
"0.6030951",
"0.60278034",
"0.5974236",
"0.5971192",
"0.59597... | 0.7714519 | 1 |
Checks if an object is a ctypes basic type, or a python basic type. | def is_basic_ctype(self, objtype):
if objtype in [self.c_char_p, self.c_void_p, self.CString]:
return False
# DOC: if <ctypes.c_uint> is not in self.__basic_types, its probably
# because you are using the wrong ctypes Proxy instance
return objtype in self.__basic_types | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_basic_type(self, objtype):\n if not hasattr(objtype, '_type_'):\n # could be python types\n return objtype in [int, long, float, bool]\n return self.is_basic_ctype(objtype)",
"def is_ctypes_instance(obj):\n return issubclass(type(obj), ctypes.Structure) or issubclass... | [
"0.7713251",
"0.7330244",
"0.6971253",
"0.6478683",
"0.6369558",
"0.6295986",
"0.62715095",
"0.6247383",
"0.6227076",
"0.6188639",
"0.6179013",
"0.6176276",
"0.61465734",
"0.6128898",
"0.60878456",
"0.6039038",
"0.60311234",
"0.6028771",
"0.59763473",
"0.59746",
"0.59622973",... | 0.80373335 | 0 |
Checks if an object is our CString. | def is_cstring_type(self, objtype):
return issubclass(objtype, self.CString) or issubclass(objtype, self.CWString) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _is_string(self, obj):\n return isinstance(obj, unicode) or isinstance(obj, str)",
"def is_string(obj):\n return isinstance(obj, basestring)",
"def typeIsString(obj):\n return type(obj) is str or _haveTypeUnicode and type(obj) is unicode",
"def is_string(obj):\n return isinsta... | [
"0.6644914",
"0.6546237",
"0.6499331",
"0.64121294",
"0.6406943",
"0.6012473",
"0.59153533",
"0.5868157",
"0.57720745",
"0.57010347",
"0.5690075",
"0.56535584",
"0.5641561",
"0.56362695",
"0.5631936",
"0.56095356",
"0.5600259",
"0.5581705",
"0.5566099",
"0.55491483",
"0.55451... | 0.7825889 | 0 |
Checks if an object is a function pointer. | def is_function_type(self, objtype):
# return self.__cfuncptrt == type(objtype)
return issubclass(objtype, self.__cfuncptrt)
# return isinstance(objtype, self.__cfuncptrt) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_function(obj):\n return isinstance(obj, (types.FunctionType, types.MethodType,\n types.LambdaType))",
"def isfunction(object):\r\n return isinstance(object, types.FunctionType)",
"def is_function(obj):\n if type(obj) is types.FunctionType:\n return True\n if... | [
"0.79942936",
"0.7951624",
"0.77935076",
"0.7015995",
"0.69952714",
"0.68919784",
"0.6887012",
"0.68474436",
"0.6713881",
"0.67120093",
"0.64534587",
"0.6405513",
"0.63498384",
"0.63237756",
"0.62905663",
"0.6169862",
"0.61353165",
"0.6112785",
"0.60842526",
"0.6040722",
"0.6... | 0.7649637 | 3 |
Checks if an object is a ctypes pointer.m CTypesPointer or CSimpleTypePointer | def is_pointer_type(self, objtype):
# if hasattr(objtype, '_subtype_'):
if issubclass(objtype, self.__ptrt):
return True
if hasattr(objtype, '_type_'):
# all basic types, pointers and array have a _type_
return not (self.is_basic_type(objtype) or self.is_array... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_pointer(type):\n return does_match_definition(type,\n cpptypes.pointer_t,\n (cpptypes.const_t, cpptypes.volatile_t)) \\\n or does_match_definition(type,\n cpptypes.pointer_t,\n ... | [
"0.780135",
"0.77807075",
"0.753512",
"0.73530793",
"0.72422206",
"0.7192015",
"0.7084349",
"0.69706696",
"0.67087215",
"0.66865945",
"0.661344",
"0.65736854",
"0.64384645",
"0.6127092",
"0.610718",
"0.5923032",
"0.58868605",
"0.5866648",
"0.58302444",
"0.57540226",
"0.567836... | 0.80532026 | 0 |
Checks if an object is a pointer to a BasicType | def is_pointer_to_array_type(self, objtype):
if hasattr(objtype, '_subtype_'): # haystack
return self.is_array_type(objtype._subtype_)
return self.is_pointer_type(objtype) and hasattr(objtype, '_type_') and self.is_array_type(objtype._type_) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_pointer_to_basic_type(self, objtype):\n if hasattr(objtype, '_subtype_'): # haystack\n return self.is_basic_type(objtype._subtype_)\n return self.is_pointer_type(objtype) and hasattr(objtype, '_type_') and self.is_basic_type(objtype._type_)",
"def is_pointer_type(self, objtype):\... | [
"0.8536566",
"0.7919964",
"0.7265406",
"0.7150658",
"0.7063469",
"0.70463824",
"0.675011",
"0.6670793",
"0.6565405",
"0.64917743",
"0.6484015",
"0.6444323",
"0.6404362",
"0.63890266",
"0.6313408",
"0.63009524",
"0.6275285",
"0.62592345",
"0.61861247",
"0.6146506",
"0.61139584... | 0.6658618 | 8 |
Checks if an object is a pointer to a BasicType | def is_pointer_to_basic_type(self, objtype):
if hasattr(objtype, '_subtype_'): # haystack
return self.is_basic_type(objtype._subtype_)
return self.is_pointer_type(objtype) and hasattr(objtype, '_type_') and self.is_basic_type(objtype._type_) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_pointer_type(self, objtype):\n # if hasattr(objtype, '_subtype_'):\n if issubclass(objtype, self.__ptrt):\n return True\n if hasattr(objtype, '_type_'):\n # all basic types, pointers and array have a _type_\n return not (self.is_basic_type(objtype) or se... | [
"0.79201126",
"0.7264978",
"0.71507657",
"0.7061336",
"0.7044532",
"0.6750256",
"0.66681767",
"0.66583854",
"0.6566984",
"0.6493159",
"0.64822906",
"0.6444679",
"0.6404441",
"0.63913167",
"0.63135946",
"0.6300614",
"0.6274565",
"0.62576485",
"0.6187205",
"0.61480355",
"0.6114... | 0.85356265 | 0 |
Checks if an object is a pointer to a Structure | def is_pointer_to_struct_type(self, objtype):
if hasattr(objtype, '_subtype_'):
return self.is_struct_type(objtype._subtype_)
return self.is_pointer_type(objtype) and hasattr(objtype, '_type_') and self.is_struct_type(objtype._type_) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_struct_type(self, objtype):\n return issubclass(objtype, self.get_real_ctypes_member('Structure'))",
"def is_struct(schema_obj):\n\n return (isinstance(schema_obj, schema.Struct) or\n (isinstance(schema_obj, schema.Field) and schema_obj.struct_type))",
"def is_ctypes_instance(obj):\n ... | [
"0.753463",
"0.7284947",
"0.6924193",
"0.68182766",
"0.6741745",
"0.6692906",
"0.6690036",
"0.6633367",
"0.6631992",
"0.6399434",
"0.6399434",
"0.6044465",
"0.6015209",
"0.59853774",
"0.59276015",
"0.59048927",
"0.5892647",
"0.5888768",
"0.5835286",
"0.57971036",
"0.5722073",... | 0.78006023 | 0 |
Checks if an object is a pointer to a Union | def is_pointer_to_union_type(self, objtype):
if hasattr(objtype, '_subtype_'):
return self.is_union_type(objtype._subtype_)
return self.is_pointer_type(objtype) and hasattr(objtype, '_type_') and self.is_union_type(objtype._type_) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_Union(tp):\n if tp is Union:\n return True\n try:\n # Python 3.6\n return tp.__origin__ is Union\n except AttributeError:\n try:\n return isinstance(tp, typing.UnionMeta)\n except AttributeError:\n return False",
"def _is_union(typeval: Typ... | [
"0.7754465",
"0.7667617",
"0.757541",
"0.7518149",
"0.7353147",
"0.71832496",
"0.7031938",
"0.67362875",
"0.666166",
"0.660357",
"0.65096855",
"0.64997435",
"0.64322",
"0.6361531",
"0.6293955",
"0.62855285",
"0.615984",
"0.61324215",
"0.61020774",
"0.5993415",
"0.59784776",
... | 0.8553651 | 0 |
Checks if an object is a ctypes Structure. | def is_struct_type(self, objtype):
return issubclass(objtype, self.get_real_ctypes_member('Structure')) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_ctypes_instance(obj):\n return issubclass(type(obj), ctypes.Structure) or issubclass(type(obj), ctypes.Union)",
"def is_struct(schema_obj):\n\n return (isinstance(schema_obj, schema.Struct) or\n (isinstance(schema_obj, schema.Field) and schema_obj.struct_type))",
"def is_pointer_to_struct_t... | [
"0.79127204",
"0.70613796",
"0.6816699",
"0.67865705",
"0.6477696",
"0.6477696",
"0.6354346",
"0.6157397",
"0.61096054",
"0.61069393",
"0.58944863",
"0.5690473",
"0.56768924",
"0.5611502",
"0.5604285",
"0.5589558",
"0.558283",
"0.5576464",
"0.55510855",
"0.5540422",
"0.552752... | 0.81000596 | 0 |
Checks if an object is a ctypes Union. | def is_union_type(self, objtype):
# force ignore the longdouble construct
if objtype == self.c_longdouble:
return False
# force ignore the CString construct
#if objtype == self.CString:
if self.is_cstring_type(objtype):
return False
return issubcla... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_union_type(type_object):\n return _is_supported_generic(type_object) and type_object.__origin__ == typing.Union",
"def is_ctypes_instance(obj):\n return issubclass(type(obj), ctypes.Structure) or issubclass(type(obj), ctypes.Union)",
"def is_Union(tp):\n if tp is Union:\n return True\n ... | [
"0.7613831",
"0.75990117",
"0.7484859",
"0.738812",
"0.7347753",
"0.73436975",
"0.7036525",
"0.6727355",
"0.6463105",
"0.6335231",
"0.6289967",
"0.6203784",
"0.61598945",
"0.606603",
"0.60403186",
"0.59551215",
"0.5925607",
"0.5921912",
"0.5876739",
"0.5801011",
"0.5748897",
... | 0.8215584 | 0 |
Return the last Frame's filename | def getLast(self):
if self.last != None:
return self.last.filename
else:
return None | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def generate_file_name(self):\n self._session_iterator = None # New file invalidate old interator\n self._img_count += 1\n self._current_file = '{0}/frame_{1}.jpg'.format(self._relative_path,self._img_count)\n return self.current_file",
"def getCurrentFileName(self):\n return ... | [
"0.73423994",
"0.7298994",
"0.713852",
"0.7132388",
"0.70910865",
"0.70804304",
"0.7056558",
"0.69898003",
"0.6959984",
"0.69241285",
"0.68952477",
"0.6782573",
"0.67819834",
"0.67545736",
"0.67124647",
"0.6686261",
"0.6664793",
"0.661628",
"0.66002476",
"0.6599445",
"0.65733... | 0.78327703 | 0 |
Return the first Frame's filename | def getFirst(self):
if self.first != None:
return self.first.filename
else:
return None | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def frame_string(path):\n filename = os.path.split(path)[1]\n return os.path.splitext(filename)[0]",
"def generate_file_name(self):\n self._session_iterator = None # New file invalidate old interator\n self._img_count += 1\n self._current_file = '{0}/frame_{1}.jpg'.format(self._relati... | [
"0.7641146",
"0.7154414",
"0.69965225",
"0.6890222",
"0.6855465",
"0.6766533",
"0.6745683",
"0.67403287",
"0.67317975",
"0.6730195",
"0.66973484",
"0.66932917",
"0.66872245",
"0.66563064",
"0.6650441",
"0.6648833",
"0.6626699",
"0.6610012",
"0.660589",
"0.660553",
"0.6569282"... | 0.720284 | 1 |
Create a new Coordinate. | def __init__(self, i, j):
self.i = i
self.j = j | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def createNew(cls, x0, y0, z0, a1, b1, c1, a2, b2, c2):\n p0 = Point(x0, y0, z0)\n d1 = Vector(a1, b1, c1)\n d2 = Vector(a2, b2, c2)\n return cls(p0, d1, d2)",
"def create_point(x_crd, y_crd):\n\n Point = namedtuple(\"Point\", \"x_crd y_crd\")\n return Point(x_crd, y_crd)",
"d... | [
"0.66556174",
"0.65444034",
"0.6533317",
"0.6533317",
"0.65190953",
"0.63573146",
"0.63295054",
"0.6270824",
"0.6125872",
"0.60753924",
"0.60145175",
"0.59786254",
"0.5941355",
"0.58785427",
"0.58785427",
"0.58785135",
"0.5877981",
"0.58512384",
"0.5783086",
"0.57751036",
"0.... | 0.0 | -1 |
Returns `true` if `self` is equal to `other`. | def eq(self, other):
return self._get("eq", other, Bool) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def equals(self, other): # -> bool:\n ...",
"def __eq__(self, other):\n return self is other",
"def __eq__(self, other):\n return self is other",
"def __eq__(self, other):\n if isinstance(other, self.__class__):\n return self.__hash__() == other.__hash__()\n ret... | [
"0.8521577",
"0.8441457",
"0.8441457",
"0.8403436",
"0.83838105",
"0.8378265",
"0.8378265",
"0.83445126",
"0.83445126",
"0.83279496",
"0.8327724",
"0.8326209",
"0.8267608",
"0.8258561",
"0.82508475",
"0.82508475",
"0.8248977",
"0.8232159",
"0.81910086",
"0.81707203",
"0.81521... | 0.0 | -1 |
Returns `true` if `self` is not equal to `other`. | def ne(self, other):
return self._get("ne", other, Bool) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __ne__ (self, other):\n return not self == other",
"def __ne__(self, other):\n # type: (object) -> bool\n return not self == other",
"def __ne__(self, other):\n # type: (object) -> bool\n return not self == other",
"def __ne__(self, other):\n # type: (object) -> ... | [
"0.8948765",
"0.8868175",
"0.8868175",
"0.8868175",
"0.88414484",
"0.8821559",
"0.8741737",
"0.8741737",
"0.8741737",
"0.8741737",
"0.8741737",
"0.8741737",
"0.8741737",
"0.8741737",
"0.8741737",
"0.8741737",
"0.8741737",
"0.8741737",
"0.8741737",
"0.8741737",
"0.8741737",
... | 0.0 | -1 |
Return the sum of `self` and `other`. | def add(self, other):
return self._get("add", other, self.__class__) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __add__(self, other):\n try:\n total = {self.var: 1, other.var: 1}\n return AutoDiffReverse(self.val + other.val, None, der=total)\n except AttributeError:\n return AutoDiffReverse(self.val + other, None, {self.var: 1})",
"def __add__(self, other):\n retu... | [
"0.77679557",
"0.75701046",
"0.74604654",
"0.7443121",
"0.74375445",
"0.7426544",
"0.74140006",
"0.74140006",
"0.7409737",
"0.73664534",
"0.73502123",
"0.73502123",
"0.73502123",
"0.73502123",
"0.73502123",
"0.73502123",
"0.73502123",
"0.72856605",
"0.7241954",
"0.72088945",
... | 0.6855518 | 58 |
Return true if `self` is equal to `other`. | def eq(self, other):
return self._get("eq", other, Bool) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def equals(self, other): # -> bool:\n ...",
"def __eq__(self, other):\n return self is other",
"def __eq__(self, other):\n return self is other",
"def __eq__(self, other):\n if isinstance(other, self.__class__):\n return self.__hash__() == other.__hash__()\n ret... | [
"0.84352493",
"0.83090633",
"0.83090633",
"0.82773644",
"0.8252995",
"0.8252995",
"0.82476044",
"0.8237882",
"0.82289886",
"0.8200845",
"0.8200845",
"0.8180085",
"0.81715673",
"0.81715673",
"0.8164561",
"0.81178594",
"0.8113324",
"0.81019235",
"0.8070959",
"0.8066351",
"0.805... | 0.0 | -1 |
Return true if `self` is greater than `other`. | def gt(self, other):
return self._get("gt", other, Bool) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __gt__(self, other):\n return True if self._compare(other) > 0 else False",
"def __gt__(self, other):\n return self.__cmp__(other) > 0",
"def __gt__(self, other):\n return other < self",
"def __gt__(self, other):\n return self >= other and self != other",
"def __gt__(self, o... | [
"0.8293362",
"0.8239527",
"0.8211647",
"0.81486166",
"0.81486166",
"0.8133966",
"0.808001",
"0.8045016",
"0.8036885",
"0.802318",
"0.80225843",
"0.79834044",
"0.79814017",
"0.7907839",
"0.7889997",
"0.7861517",
"0.7842172",
"0.7835466",
"0.7780784",
"0.77795404",
"0.77733684"... | 0.71590763 | 75 |
Return true if `self` is greater than or equal to `other`. | def gte(self, other):
return self._get("gte", other, Bool) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __gt__(self, other):\n return self >= other and self != other",
"def __gt__(self, other):\n return self >= other and self != other",
"def __gt__(self, other):\n return True if self._compare(other) > 0 else False",
"def __gt__(self, other):\n return self.__cmp__(other) > 0",
... | [
"0.823672",
"0.823672",
"0.8204656",
"0.8159075",
"0.8155969",
"0.815115",
"0.81475455",
"0.8084558",
"0.80384505",
"0.8017464",
"0.79995334",
"0.79657793",
"0.79411316",
"0.79342943",
"0.785947",
"0.7852062",
"0.7808894",
"0.77966386",
"0.7780846",
"0.7765304",
"0.7756246",
... | 0.0 | -1 |
Return true if `self` is less than `other`. | def lt(self, other):
return self._get("lt", other, Bool) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __lt__(self, other):\n return self <= other and self != other",
"def __lt__(self, other):\n return self <= other and self != other",
"def __lt__(self, other):\n return self.lessThan(other)",
"def __lt__(self, other):\n return self.get_distance() < other.get_distance()",
"def... | [
"0.8220788",
"0.8220788",
"0.8198067",
"0.8167902",
"0.8137012",
"0.812579",
"0.81185913",
"0.81185913",
"0.8017547",
"0.8017337",
"0.79999715",
"0.79279315",
"0.7926788",
"0.7925825",
"0.7917846",
"0.78955066",
"0.7893608",
"0.7882705",
"0.78731287",
"0.7847483",
"0.7835435"... | 0.75491065 | 49 |
Return true if `self` is less than or equal to `other`. | def lte(self, other):
return self._get("lte", other, Bool) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __lt__(self, other):\n return self <= other and self != other",
"def __lt__(self, other):\n return self <= other and self != other",
"def __lt__(self, other):\n return self <= other and not self >= other",
"def __le__(self, other):\n return less_equal(self, other)",
"def __l... | [
"0.82954514",
"0.82954514",
"0.8179835",
"0.8178689",
"0.81550884",
"0.8150846",
"0.80234694",
"0.8015391",
"0.8015391",
"0.8011466",
"0.79925716",
"0.79779744",
"0.7950548",
"0.7950548",
"0.79352343",
"0.7899932",
"0.78959954",
"0.78760874",
"0.78725505",
"0.7849484",
"0.784... | 0.0 | -1 |
Return true if `self` is not equal to `other`. | def ne(self, other):
return self._get("ne", other, Bool) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __ne__ (self, other):\n return not self == other",
"def __ne__(self, other):\n # type: (object) -> bool\n return not self == other",
"def __ne__(self, other):\n # type: (object) -> bool\n return not self == other",
"def __ne__(self, other):\n # type: (object) -> ... | [
"0.8835052",
"0.87644297",
"0.87644297",
"0.87644297",
"0.8744123",
"0.8715795",
"0.8643762",
"0.8643762",
"0.8643762",
"0.8643762",
"0.8643762",
"0.8643762",
"0.8643762",
"0.8643762",
"0.8643762",
"0.8643762",
"0.8643762",
"0.8643762",
"0.8643762",
"0.8643762",
"0.8643762",
... | 0.0 | -1 |
Return the difference between `self` and `other`. | def sub(self, other):
return self._get("sub", other, self.__class__) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __sub__(self, other):\n try:\n total = {self.var: 1, other.var: -1}\n return AutoDiffReverse(self.val - other.val, None, der=total)\n except AttributeError:\n return AutoDiffReverse(self.val - other, None, {self.var: 1})",
"def __isub__(self, other):\n\n ... | [
"0.7659985",
"0.7654929",
"0.7649055",
"0.7599348",
"0.75750196",
"0.7557973",
"0.7557624",
"0.7398494",
"0.7393018",
"0.7372962",
"0.7310812",
"0.72707736",
"0.7180202",
"0.7160675",
"0.71333456",
"0.71199954",
"0.7119688",
"0.707898",
"0.7049266",
"0.70474225",
"0.70426863"... | 0.0 | -1 |
revers of not equal | def __ne__(self, other):
return super().__eq__(other) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def ne (self, other):\n return not (self == other) # opposite of eq",
"def __neq__(self, other): \n return not self == other",
"def not_equal(lhs, rhs):\n return _make.not_equal(lhs, rhs)",
"def test_not_equal_on_equal(self):\n a = objects.OpaqueObject(self.bytes_a... | [
"0.7719024",
"0.76303226",
"0.7566193",
"0.7534219",
"0.7524074",
"0.75042254",
"0.74804395",
"0.74467224",
"0.7436411",
"0.7402667",
"0.73944813",
"0.73818535",
"0.73511136",
"0.7344192",
"0.7344192",
"0.734053",
"0.7335997",
"0.7322686",
"0.73104525",
"0.73104525",
"0.73104... | 0.0 | -1 |
Skip the rest of the chunk. If you are not interested in the contents of the chunk, this method should be called so that the file points to the start of the next chunk. | def skip(self) -> None:
n = self.chunksize - self.size_read
# maybe fix alignment
if self.chunksize & 1:
n = n + 1
try:
self.file.seek(n, 1)
except (AttributeError, OSError): # Cannot seek, manually read.
while self.size_read < self.chunksize:... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def skip(self):\r\n length = self.next_byte()\r\n while length != b\"\\x00\" and length:\r\n self.next_bytes(parse_int(length, 'big'))\r\n length = self.next_byte()",
"def skip_next_segment(self):\n self.test_script_source.next_segment()",
"def skip_gutenberg_header(f... | [
"0.6622001",
"0.65637755",
"0.6189404",
"0.6166512",
"0.6160878",
"0.6075603",
"0.5980222",
"0.5978979",
"0.59729856",
"0.597096",
"0.5895238",
"0.5862193",
"0.5854996",
"0.5764674",
"0.57620454",
"0.57557595",
"0.5747769",
"0.56521314",
"0.5540506",
"0.5535649",
"0.5525278",... | 0.7831825 | 0 |
Makes a DELETE request to the API. | def delete(resource):
resp = requests.delete(
_endpoint(resource, 'DELETE'),
headers=PAYLOAD_HEADERS,
verify=SERVER_CERT
)
resp.raise_for_status()
return resp.json() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def delete(self):\r\n return http.Request('DELETE', '{0}'.format(\r\n self.get_url())), parsers.parse_json",
"def do_DELETE(self,):\n self.http_method = 'DELETE'\n self.response()",
"def delete(self, **kwargs):\n\n return self.api_request(self._get_method_... | [
"0.84500813",
"0.8330425",
"0.8240623",
"0.8240623",
"0.8209828",
"0.8171103",
"0.8130798",
"0.8009059",
"0.8002813",
"0.7967138",
"0.7957651",
"0.79459083",
"0.7938169",
"0.79332674",
"0.7927348",
"0.78907526",
"0.78393567",
"0.78311175",
"0.782548",
"0.7789097",
"0.7775576"... | 0.0 | -1 |
Gets the VIM object reference. | def _get_vim(self):
return self.vim | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __current_object__(self):\n return self.__lookup()",
"def vim_id(self):\n return self._vim_id",
"def ref(self):\n return self._ref",
"def reference(self):\r\n return reference.Reference(self)",
"def _get_current_object(self):\n loc = object.__getattribute__(self, '_Pr... | [
"0.6157836",
"0.6120355",
"0.60760397",
"0.5972235",
"0.5945152",
"0.59273744",
"0.59273744",
"0.58923507",
"0.57600576",
"0.5758706",
"0.57514644",
"0.57514644",
"0.5696038",
"0.56795746",
"0.5645656",
"0.5612928",
"0.55995864",
"0.55912447",
"0.55851513",
"0.5576357",
"0.55... | 0.6795266 | 0 |
Sets the local_capacity_used_bytes of this MtreeIntegratedUsage. | def local_capacity_used_bytes(self, local_capacity_used_bytes):
if (self._configuration.client_side_validation and
local_capacity_used_bytes is not None and local_capacity_used_bytes < 0): # noqa: E501
raise ValueError("Invalid value for `local_capacity_used_bytes`, must be a value ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_used_mem(self, u_mem):\n self.used_mem = u_mem\n return",
"def total_capacity_used_bytes(self, total_capacity_used_bytes):\n if (self._configuration.client_side_validation and\n total_capacity_used_bytes is not None and total_capacity_used_bytes < 0): # noqa: E501\n ... | [
"0.66066134",
"0.63199824",
"0.6170197",
"0.61007804",
"0.6032188",
"0.59991366",
"0.59775263",
"0.587406",
"0.5759076",
"0.57448006",
"0.56346154",
"0.55614626",
"0.5479991",
"0.5344204",
"0.53368",
"0.5307061",
"0.5281596",
"0.5220203",
"0.5205526",
"0.5205526",
"0.5205526"... | 0.7910647 | 0 |
Sets the replica_capacity_used_bytes of this MtreeIntegratedUsage. | def replica_capacity_used_bytes(self, replica_capacity_used_bytes):
if (self._configuration.client_side_validation and
replica_capacity_used_bytes is not None and replica_capacity_used_bytes < 0): # noqa: E501
raise ValueError("Invalid value for `replica_capacity_used_bytes`, must b... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def mixed_capacity_used_bytes(self, mixed_capacity_used_bytes):\n if (self._configuration.client_side_validation and\n mixed_capacity_used_bytes is not None and mixed_capacity_used_bytes < 0): # noqa: E501\n raise ValueError(\"Invalid value for `mixed_capacity_used_bytes`, must be... | [
"0.6189145",
"0.6037735",
"0.6026613",
"0.5674951",
"0.56746745",
"0.5625389",
"0.555787",
"0.5557207",
"0.548861",
"0.54818547",
"0.5266137",
"0.5159721",
"0.5103028",
"0.5081585",
"0.50734353",
"0.507205",
"0.5058738",
"0.5045515",
"0.5014115",
"0.4984375",
"0.49543265",
... | 0.7259097 | 0 |
Sets the mixed_capacity_used_bytes of this MtreeIntegratedUsage. | def mixed_capacity_used_bytes(self, mixed_capacity_used_bytes):
if (self._configuration.client_side_validation and
mixed_capacity_used_bytes is not None and mixed_capacity_used_bytes < 0): # noqa: E501
raise ValueError("Invalid value for `mixed_capacity_used_bytes`, must be a value ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_used_mem(self, u_mem):\n self.used_mem = u_mem\n return",
"def memory_used(self, memory_used: int):\r\n self._memory_used = memory_used",
"def replica_capacity_used_bytes(self, replica_capacity_used_bytes):\n if (self._configuration.client_side_validation and\n ... | [
"0.61713827",
"0.6032216",
"0.59730893",
"0.5856951",
"0.553792",
"0.55091685",
"0.5509019",
"0.5167547",
"0.51439476",
"0.51297414",
"0.51286614",
"0.50277644",
"0.50261503",
"0.5006676",
"0.49889243",
"0.497001",
"0.49671522",
"0.4962534",
"0.4896897",
"0.48518577",
"0.4842... | 0.79555976 | 0 |
Sets the total_capacity_used_bytes of this MtreeIntegratedUsage. | def total_capacity_used_bytes(self, total_capacity_used_bytes):
if (self._configuration.client_side_validation and
total_capacity_used_bytes is not None and total_capacity_used_bytes < 0): # noqa: E501
raise ValueError("Invalid value for `total_capacity_used_bytes`, must be a value ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def total_memory(self, total_memory):\n\n self._total_memory = total_memory",
"def total_available_cores(self, total_available_cores):\n\n self._total_available_cores = total_available_cores",
"def total_storage(self, total_storage):\n\n self._total_storage = total_storage",
"def local_c... | [
"0.67002267",
"0.661632",
"0.65679765",
"0.64785826",
"0.6432008",
"0.6371057",
"0.6355212",
"0.6339069",
"0.6285269",
"0.6196835",
"0.6144517",
"0.6107924",
"0.6070954",
"0.6057434",
"0.5957241",
"0.5846142",
"0.58392596",
"0.57747215",
"0.57747215",
"0.57747215",
"0.5774721... | 0.7587515 | 0 |
Returns true if both objects are equal | def __eq__(self, other):
if not isinstance(other, MtreeIntegratedUsage):
return False
return self.to_dict() == other.to_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):
if not isinstance(other, MtreeIntegratedUsage):
return True
return self.to_dict() != other.to_dict() | {
"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.8042487",
"0.8042487",
"0.8042487",
"0.8042487",
"0.8042487",
"0.8042487",
"0.8042487",
... | 0.0 | -1 |
Computes the mass given a certain box size. Mass will be scaled with the volume, normalized on the standard volume. The standard volume is the average volume | def _compute_mass(box_size, evo_config):
# ensure format
standard_volume = evo_config['individuals']['standard_volume']
if isinstance(box_size, list):
if len(box_size) == 1: # sphere
box_size = box_size[0]
box_size = np.asarray(box_size)
if np.prod(box_size.shape) < 2: # sphe... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def mass(self):\n\t\treturn self.volume*self.density",
"def Mass(self):\n mpa = self.MassPerLength()\n if mpa == 0.0:\n return 0.\n L = self.Length()\n mass = L * mpa\n\n #try:\n #mass = (self.Rho() * self.Area() + self.Nsm()) * L\n #except TypeErro... | [
"0.69709325",
"0.6509225",
"0.6467876",
"0.6435633",
"0.63339156",
"0.62859756",
"0.6262277",
"0.62376344",
"0.61251456",
"0.6053275",
"0.60192484",
"0.6005191",
"0.5999774",
"0.59933776",
"0.59705615",
"0.59705615",
"0.59439397",
"0.5910133",
"0.5910133",
"0.5885842",
"0.587... | 0.8376204 | 0 |
Return true if the object obType is of the class designated by iType | def isItem(obType,iType):
if iType == 'sword':
return isinstance(obType,Sword)
elif iType == 'axe':
return isinstance(obType,Axe)
elif iType == 'shield':
return isinstance(obType,Shield)
elif iType == 'helmet':
return isinstance(obType,Helmet)
else:
pass
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_type(obj):\n return type(obj) is type or type(obj) is types.ClassType",
"def is_type(self, typ):\n return typ == self.__class__.__name__",
"def verify_type(self, obj):\n return isinstance(obj, self.type_)",
"def is_type(obj: Any) -> bool:\n return type(obj).__name__ == \"type\"",
"de... | [
"0.7389986",
"0.70192254",
"0.70188063",
"0.70142156",
"0.6967544",
"0.6906237",
"0.67857397",
"0.67796946",
"0.67740947",
"0.67238384",
"0.6694348",
"0.66918254",
"0.668994",
"0.66887105",
"0.66887105",
"0.66867983",
"0.6678806",
"0.6678806",
"0.6678806",
"0.6678806",
"0.667... | 0.66092163 | 30 |
Create virtually sampled distribution with the given shape. | def _call(self, *args, samples=1, virtual=None, sample_chunksize=None, **kwargs):
return virtually_sample_distribution(self._distr, samples, *args,
sample_chunksize=sample_chunksize,
**kwargs) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __call__(self, shape):\n return np.random.uniform(low=self.minval, high=self.maxval, size=shape)",
"def __call__(self, shape):\n return np.random.normal(loc=self.mean, scale=self.stddev, size=shape)",
"def sample(self, shape):\n ps = np.random.random(shape)\n return self.values(... | [
"0.74115705",
"0.7134161",
"0.6898807",
"0.6798587",
"0.6786852",
"0.6752539",
"0.6738791",
"0.6738791",
"0.66330516",
"0.6617498",
"0.6435654",
"0.6422035",
"0.64143807",
"0.6410794",
"0.6385767",
"0.6283053",
"0.62676936",
"0.6228726",
"0.62071544",
"0.618961",
"0.6137239",... | 0.59963953 | 24 |
Return absolute path to the package directory. | def _get_package_directory(self, package_name: str) -> str:
return os.path.abspath(
os.path.join(
os.path.dirname(__file__),
'..', '..', 'assets', package_name, package_name,
)
) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_package_dir():\n return Path(__file__).parent",
"def GetPackageDirectory():\n return os.path.dirname(__file__)",
"def get_package_path():\n package_name = get_package_name()\n return package_name.replace('.', '/')",
"def package_dir(self):\r\n return \".\"",
"def package_path(pkg):\n... | [
"0.86125183",
"0.842154",
"0.8283031",
"0.81494975",
"0.8127352",
"0.76673925",
"0.76624686",
"0.7641766",
"0.75927985",
"0.7531909",
"0.74880296",
"0.7448896",
"0.7422762",
"0.7326379",
"0.7318049",
"0.73057175",
"0.7268327",
"0.72479314",
"0.7233438",
"0.7230887",
"0.720450... | 0.8051037 | 5 |
Restores the model's initial state. | def clear(self):
self.currentTotal = None
self.previousOperator = None
self.previousOperand = None | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def restore_model_state(self, model: Block):\n if model in self.initial_state:\n from_json(model, sd=self.initial_state[model], wts=StoreState)\n else:\n self._update_summary(model, \"status\", InitializationStatus.Error)\n raise ValueError(\"No initial state stored.\... | [
"0.7675529",
"0.74846864",
"0.74582016",
"0.7449687",
"0.7449687",
"0.7449687",
"0.7129896",
"0.7071682",
"0.6997089",
"0.69228494",
"0.6845132",
"0.6845132",
"0.6845132",
"0.68395925",
"0.6787972",
"0.6775923",
"0.6740749",
"0.6726745",
"0.67215353",
"0.6704137",
"0.6668369"... | 0.0 | -1 |
Returns True if all quote characters in line are matching. Otherwise it returns False. | def checkQuotes(line):
for x in line:
if x in ('\'', '"'):
if line.count('\'') % 2 == 0 and line.count('"') % 2 == 0:
return True
else:
return False | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def have_end_quote(quote, line):\n\tclose_quote_match = close_quote_re.search(line)\n\treturn close_quote_match is not None and \\\n\t\tclose_quote_match.group(1) == quote",
"def line_valid(line: str) -> bool:\n\n return line != ' ' and line != ''",
"def __is_quote(cls, char):\n return char in (\"'\"... | [
"0.6829086",
"0.68158895",
"0.6677754",
"0.64486086",
"0.6306288",
"0.61715305",
"0.61701685",
"0.6161426",
"0.6130431",
"0.6130287",
"0.6086147",
"0.60299796",
"0.60163283",
"0.5998927",
"0.5976663",
"0.5925524",
"0.5901761",
"0.59009856",
"0.5841984",
"0.5788685",
"0.578058... | 0.80292964 | 0 |
Creates a list of chain dictionaries from a .mmtf dictionary by zipping together some of its fields. | def get_chains_list(mmtf_dict, groups):
chains = []
for i_id, id, group_num in zip(mmtf_dict["chainIdList"],
mmtf_dict["chainNameList"], mmtf_dict["groupsPerChain"]):
chain = {"id": id, "internal_id": i_id, "groups": groups[:group_num]}
del groups[:group_num]
for entity in mmtf_dic... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_atoms_list(mmtf_dict):\n\n return [{\n \"x\": x, \"y\": y, \"z\": z, \"alt_loc\": a or None, \"bvalue\": b, \"occupancy\": o,\n \"id\": i, \"is_hetatm\": False\n } for x, y, z, a, b, i, o in zip(\n mmtf_dict[\"xCoordList\"], mmtf_dict[\"yCoordList\"], mmtf_dict[\"zCoordList\"],\n mmtf... | [
"0.53780955",
"0.5037925",
"0.49239722",
"0.4915308",
"0.49097005",
"0.48819616",
"0.4877348",
"0.4867769",
"0.48168004",
"0.47998872",
"0.47843388",
"0.47523853",
"0.47315386",
"0.47206712",
"0.4707383",
"0.4655629",
"0.46099922",
"0.46029627",
"0.45647722",
"0.45585355",
"0... | 0.55132 | 0 |
Generator function yield each product until we run out | def _product_generator(self):
categories = ColesCategoryIterator(self._base_url)
self.total = len(categories)
for category in categories:
# print("Searching Category: {}".format(category))
# print self._get_url(category)
self._params['beginIndex'] = "0"
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __iter__(self):\n return self._product_generator()",
"def product(*iterables, **kwargs):\n if len(iterables) == 0:\n yield ()\n else:\n iterables = iterables * kwargs.get('repeat', 1)\n it = iterables[0]\n for item in it() if callable(it) else iter(it):\n f... | [
"0.6984692",
"0.67625284",
"0.6516619",
"0.640202",
"0.63519686",
"0.62910205",
"0.62908703",
"0.6282416",
"0.61721426",
"0.61691993",
"0.61691993",
"0.61691993",
"0.60957944",
"0.60475117",
"0.6012393",
"0.60089487",
"0.6005274",
"0.5913139",
"0.5909763",
"0.590483",
"0.5898... | 0.60777795 | 13 |
Annotage a specific point. Annotate a point with a label. The label will be placed vertically with an additional line. The function uses the data values and searches for the peak of the value to be annotated. Therefore the ``raw_values`` parameter is used | def annotate_point(x1, y_pos=0, text='', raw_values=None):
delta_point_annotate_line_pixel = 1
if raw_values is not None:
if __get_max_peak(x1, raw_values) < (y_pos - delta_point_annotate_line_pixel):
xy_text = (x1, y_pos)
else:
xy_text = (x1, __get_max_peak(x1, raw_va... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def annotate(*args, point: List[float, float, float]=None, text: AnyStr=\"\", **kwargs)->AnyStr:\n pass",
"def annotate_point(x, y, text, offset=5, offset_x=None, offset_y=None,\n text_kw={}):\n if offset_x is None or offset_y is None:\n offset_x = offset\n offset_y = offset... | [
"0.635054",
"0.611245",
"0.6050527",
"0.59165514",
"0.57823247",
"0.56984276",
"0.569787",
"0.5683354",
"0.5681454",
"0.55709517",
"0.55562335",
"0.55409944",
"0.5538191",
"0.5538191",
"0.55174625",
"0.5469861",
"0.5367807",
"0.5340688",
"0.5296752",
"0.52757126",
"0.52724636... | 0.7608119 | 0 |
Annotage the distance between two peaks Annotate the distance between two given peaks. The text can be placed with a given angle. | def annotate_distance(x1=0, x2=0, y_pos=0, text='', raw_values=None, rotate_text=0):
delta_point_annotate_line_pixel = 1
if raw_values is not None:
if __get_max_peak(x1, raw_values) < (y_pos - delta_point_annotate_line_pixel):
plt.annotate(
'', xy=(x1, __get_max_peak(x1, ra... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def angle_peaks(self, i, j):\n g1 = norm_vec(self.Gvec(self.xp[i], self.yp[i], self.zp[i]))\n g2 = norm_vec(self.Gvec(self.xp[j], self.yp[j], self.zp[j]))\n return np.around(np.arccos(float(g1.T*g2)) * degrees, 3)",
"def annotate_point(x, y, text, offset=5, offset_x=None, offset_y=None,\n ... | [
"0.56478345",
"0.5515826",
"0.54806834",
"0.5414745",
"0.53958964",
"0.5393185",
"0.53395027",
"0.52990144",
"0.52988607",
"0.5274673",
"0.5271099",
"0.5270221",
"0.52679855",
"0.5265199",
"0.52130413",
"0.5195224",
"0.5192496",
"0.5184341",
"0.5173752",
"0.51302433",
"0.5129... | 0.72374994 | 0 |
Returns true if the board is in a solved state. | def solved(self):
return GOAL_VEHICLE in self.vehicles | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_solved(self):\n # Asserting board is valid.\n if not self.is_legal():\n return False\n\n # Asserting board is filled.\n for cell in self._cells_iterable():\n if cell == self.EMPTY_CELL:\n return False\n\n return True",
"def check_if_s... | [
"0.7613099",
"0.7606918",
"0.75273764",
"0.7448304",
"0.74314",
"0.7410069",
"0.73838913",
"0.73146707",
"0.73079824",
"0.73079824",
"0.73079824",
"0.7240043",
"0.7214337",
"0.7201172",
"0.7196548",
"0.71128726",
"0.70461476",
"0.7032578",
"0.70052475",
"0.698494",
"0.6965462... | 0.63385344 | 65 |
Initialize StringMatcher object. Initialize string matcher object if method is implemented. Otherwise don't. Keyword Args | def __init__(self, method='finite-state'):
if method not in self.methods:
raise NotImplementedError
self.method = method | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self, matcher, generate):\n self.matcher = matcher\n self._generate = generate",
"def __init__(self, compound_matcher):\n self._matcher = compound_matcher",
"def __init__(self, matcher):\n valid_types = (\n type(None), list, dict, int, float, six.string_types... | [
"0.6478716",
"0.6436401",
"0.6308957",
"0.61691093",
"0.60467213",
"0.59474134",
"0.59200317",
"0.5916325",
"0.58593947",
"0.582531",
"0.5807541",
"0.5761826",
"0.5743827",
"0.5722944",
"0.5698239",
"0.56832016",
"0.56786984",
"0.56741494",
"0.5649902",
"0.5637435",
"0.562060... | 0.0 | -1 |
Compare two SAMLFederation objects. | def __eq__(self, other):
if not isinstance(other, SAMLFederation):
return False
return (
self.type == other.type
and self.idp_metadata_service_url == other.idp_metadata_service_url
and self.certificate == other.certificate
) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __eq__(self, other):\n if not isinstance(other, SAMLFederatedIdentityProvider):\n return False\n\n return (\n self.federation == other.federation\n and self.entity_id == other.entity_id\n and self.display_name == other.display_name\n and self... | [
"0.7530521",
"0.6155069",
"0.6071218",
"0.6054635",
"0.60449255",
"0.6034421",
"0.5961219",
"0.5960323",
"0.5949331",
"0.59347916",
"0.5929467",
"0.5919033",
"0.5898638",
"0.5894435",
"0.58916974",
"0.5884714",
"0.58813727",
"0.5880109",
"0.5868075",
"0.5864328",
"0.58619416"... | 0.7415307 | 1 |
Compare two SAMLFederatedIdentityProvider objects. | def __eq__(self, other):
if not isinstance(other, SAMLFederatedIdentityProvider):
return False
return (
self.federation == other.federation
and self.entity_id == other.entity_id
and self.display_name == other.display_name
and self.xml_metadata... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __eq__(self, other):\n if not isinstance(other, SAMLFederation):\n return False\n\n return (\n self.type == other.type\n and self.idp_metadata_service_url == other.idp_metadata_service_url\n and self.certificate == other.certificate\n )",
"def ... | [
"0.684208",
"0.589636",
"0.58901787",
"0.5861127",
"0.58567816",
"0.5808095",
"0.5800856",
"0.5762572",
"0.57600474",
"0.57150745",
"0.57076925",
"0.57034457",
"0.5669806",
"0.56523055",
"0.56523055",
"0.56523055",
"0.56367785",
"0.5636094",
"0.5625048",
"0.5620138",
"0.56128... | 0.77665895 | 0 |
Get Seconds from time. | def get_sec(time_str):
h, m, s = time_str.split(':')
return int(h) * 3600 + int(m) * 60 + int(float(s)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def to_seconds(time):\n return 3600 * time",
"def time_to_int(self):\n minutes = self.hour * 60 + self.minute\n seconds = minutes * 60 + self.second\n return seconds",
"def time_to_int(time):\n minutes = time.hour * 60 + time.minute\n seconds = minutes * 60 + time.second\n retu... | [
"0.78827816",
"0.7511598",
"0.74796194",
"0.73971415",
"0.7275454",
"0.7262169",
"0.718104",
"0.70772296",
"0.70772296",
"0.7036447",
"0.69965965",
"0.6980901",
"0.6879055",
"0.6844431",
"0.6838192",
"0.6817343",
"0.67910403",
"0.67888385",
"0.6770099",
"0.67639846",
"0.67639... | 0.71555495 | 7 |
Convert coordinate values to floats. | def floatize(self):
self.x = float(self.x)
self.y = float(self.y) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _fs (v):\r\n try : \r\n v = float(v)\r\n except : \r\n v = tuple([float (ss) for ss in \r\n v.replace('(', '').replace(')', '').split(',')])\r\n return v",
"def to_float(self) -> float:\n return (1.0 * self.as_int) ... | [
"0.6701161",
"0.6688434",
"0.6554382",
"0.6455828",
"0.64538753",
"0.63701093",
"0.63075864",
"0.625625",
"0.6252969",
"0.61478543",
"0.612631",
"0.608965",
"0.6048243",
"0.60262245",
"0.5968809",
"0.5924165",
"0.5878196",
"0.58732855",
"0.5872968",
"0.5834271",
"0.57987195",... | 0.6917977 | 0 |
Reset the rectangle coordinates. | def set_points(self, pt1, pt2):
(x1, y1) = pt1.as_tuple()
(x2, y2) = pt2.as_tuple()
self.left = min(x1, x2)
self.top = min(y1, y2)
self.right = max(x1, x2)
self.bottom = max(y1, y2) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def reset(self):\n self._x = 0\n self._y = 0",
"def reset_position(self):\n self.rect.left, self.rect.top = self.start_pos",
"def reset(self):\n if self.num == 1:\n self.rect.centerx = 320\n elif self.num == 2:\n self.rect.centerx = 341\n elif sel... | [
"0.7644823",
"0.75127906",
"0.73988515",
"0.7286462",
"0.7133776",
"0.7029097",
"0.7012538",
"0.7012498",
"0.6962546",
"0.68873185",
"0.6864901",
"0.68237597",
"0.67641884",
"0.6713251",
"0.66998917",
"0.66834706",
"0.66738427",
"0.6566055",
"0.6563745",
"0.65522885",
"0.6505... | 0.0 | -1 |
Return true if a point is inside the rectangle. | def contains(self, pt):
x,y = pt.as_tuple()
return (self.left <= x <= self.right and
self.top <= y <= self.bottom) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def isInside(point_x, point_y, area_left, area_top, area_width, area_height):\n return (area_left <= point_x < area_left + area_width) and (area_top <= point_y < area_top + area_height)",
"def inside(point, rectangle):\r\n\r\n ll = rectangle.getP1() # assume p1 is ll (lower left)\r\n ur = rectangle.get... | [
"0.8477466",
"0.83827066",
"0.8379193",
"0.8379193",
"0.83641154",
"0.82842374",
"0.81299025",
"0.81299025",
"0.81179863",
"0.80872655",
"0.80295455",
"0.79982895",
"0.78914016",
"0.78820896",
"0.7869371",
"0.7820557",
"0.78063506",
"0.7796697",
"0.7754977",
"0.7745038",
"0.7... | 0.77789205 | 18 |
Return true if a rectangle overlaps this rectangle. | def overlaps(self, other):
return (self.right > other.left and self.left < other.right and
self.top < other.bottom and self.bottom > other.top) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_overlapping(self, region):\n if self.x2 < region.x1:\n return False # this box is left the other\n if self.x1 > region.x2:\n return False # this box is right the other\n if self.y2 < region.y1:\n return False # this box is above the other\n if ... | [
"0.786254",
"0.77116895",
"0.7658477",
"0.75331026",
"0.75112927",
"0.7288845",
"0.7269578",
"0.71821386",
"0.71367604",
"0.7116944",
"0.7091847",
"0.70633787",
"0.70474154",
"0.7018711",
"0.6949748",
"0.6928144",
"0.69228876",
"0.69205946",
"0.6914914",
"0.6907102",
"0.69070... | 0.75735635 | 3 |
Return the topleft corner as a Point. | def top_left(self):
return Point(self.left, self.top) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def topLeftCorner(self):\n self._updateExtents()\n return (self._mMinX,self._mMinY)",
"def getPoint(self):\n return Point(*self.position)",
"def topleft(self, x=0, y=0):\n topleft = self.rect.topleft\n if x or y:\n return (topleft[0]+x, topleft[1]+y)\n retur... | [
"0.750001",
"0.7065544",
"0.6972787",
"0.6930406",
"0.68914574",
"0.68914574",
"0.67856586",
"0.66683644",
"0.6627209",
"0.65163916",
"0.6494635",
"0.64913386",
"0.6476856",
"0.6448938",
"0.64471877",
"0.6430814",
"0.6417884",
"0.6407085",
"0.6402112",
"0.63893205",
"0.633348... | 0.82830536 | 0 |
Return the bottomright corner as a Point. | def bottom_right(self):
return Point(self.right, self.bottom) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def bottomRightCorner(self):\n self._updateExtents()\n return (self._mMaxX,self._mMaxY)",
"def bottomLeftCorner(self):\n self._updateExtents()\n return (self._mMinX,self._mMaxY)",
"def bottom(self):\n return self.points['bottomRight'].y",
"def bottom(self):\n return ... | [
"0.7730304",
"0.72982514",
"0.72662455",
"0.72662455",
"0.72439766",
"0.69867444",
"0.6704842",
"0.6673334",
"0.6673334",
"0.66586494",
"0.66226375",
"0.65236574",
"0.6498889",
"0.6463477",
"0.63751847",
"0.63669604",
"0.62616736",
"0.6146644",
"0.6144366",
"0.61280084",
"0.6... | 0.8489839 | 0 |
Gets the name of the robot. | def name(self) -> Dict[str, str]:
self.__logger.debug('Eva.name called')
return self.__http_client.name() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def name(self):\n return self.robot.name + ' ' + SWITCH_TYPES[self.type][0]",
"def name(self) -> str:\n return pulumi.get(self, \"name\")",
"def name(self) -> str:\n return pulumi.get(self, \"name\")",
"def name(self) -> str:\n return pulumi.get(self, \"name\")",
"def name(self)... | [
"0.7307341",
"0.70327663",
"0.70327663",
"0.70327663",
"0.70327663",
"0.70327663",
"0.70327663",
"0.70327663",
"0.70327663",
"0.70327663",
"0.70327663",
"0.70327663",
"0.70327663",
"0.70327663",
"0.70327663",
"0.70327663",
"0.70327663",
"0.70327663",
"0.70327663",
"0.70327663",... | 0.0 | -1 |
Gets the state of output/input pin. | def gpio_get(self, pin: str, pin_type: str) -> Union[bool, float]:
self.__logger.debug('Eva.gpio_get called')
return self.__http_client.gpio_get(pin, pin_type) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get(self):\n if self.mode == gpio.IN:\n self.state = gpio.input(self.bcm_id)\n\n return self.state",
"def pin_state(self, pin):\n port_num = self._convert_pin_port(pin)\n if port_num:\n value = gpio.input(port_num)\n return value",
"def is_on(sel... | [
"0.77870214",
"0.76546854",
"0.74145186",
"0.71041524",
"0.6906884",
"0.68299943",
"0.6734809",
"0.66363347",
"0.6631286",
"0.66310894",
"0.66310894",
"0.6597665",
"0.65885574",
"0.6579778",
"0.65542096",
"0.65366375",
"0.6524012",
"0.6519573",
"0.6509428",
"0.6505533",
"0.64... | 0.0 | -1 |
Given a document (represented as a string), return a list of all of the words in that document, in order. Process document by coverting all words to lowercase, and removing any punctuation or English stopwords. | def tokenize(sentence):
tokens = nltk.word_tokenize(sentence)
return tokens | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def tokenize(document):\n raw_words=[word.lower() for word in nltk.word_tokenize(document) if word.isalpha()]\n raw_words=[word.lower() for word in raw_words]\n final_words=[]\n for word in raw_words:\n if word not in string.punctuation and word not in nltk.corpus.stopwords.words(\"english\"):\n... | [
"0.7946825",
"0.7922626",
"0.78998655",
"0.7756049",
"0.77367",
"0.7726034",
"0.7666127",
"0.73868257",
"0.7341524",
"0.72900265",
"0.7226567",
"0.7075837",
"0.7042459",
"0.70217556",
"0.7018677",
"0.7018677",
"0.69927365",
"0.6972305",
"0.69691944",
"0.69646704",
"0.6948779"... | 0.0 | -1 |
Creates a FactorExprNode. Typically this ctor is only called to create a new factor node that names a single factor. However, to programmatically construct a FactorExprNode, pass in the factors and op keyword args explicitly. | def __init__(self, factor=None, op=None, factors=None):
if factors is not None:
self.factors = factors
else:
self.factors = factor
self.op = op | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def factor( ):\n\n\ttok = tokens.peek( )\n\tif debug: print (\"Factor: \", tok)\n\tif re.match( Lexer.number, tok ):\n\t\texpr = Number(tok)\n\t\ttokens.next( )\n\t\ttok = tokens.peek( )\n\t\treturn expr\n\tif tok == \"(\":\n\t\ttokens.next( ) # or match( tok )\n\t\texpr = addExpr( )#might need to change to expre... | [
"0.66606027",
"0.56250536",
"0.551085",
"0.5423971",
"0.51910836",
"0.51638854",
"0.5158734",
"0.5136759",
"0.5112949",
"0.51006377",
"0.5071651",
"0.50654835",
"0.5015516",
"0.4935362",
"0.47865814",
"0.47753453",
"0.4763856",
"0.47515157",
"0.47114316",
"0.46784326",
"0.467... | 0.7244806 | 0 |
Total number of bytes of data represented in the index. | def totalbytes(self):
with self.session as session:
result = session.execute(select([func.sum(IndexRecord.size)])).scalar()
if result is None:
return 0
return long(result) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def size(self):\n ret = 0\n for ii in self.__data:\n ret += int(ii.get_size())\n return ret",
"def nbytes(self):\n return self.nnz * self.dtype.itemsize",
"def nbytes(self):\n\n return self.data.type.datasize",
"def size(self, index):\n return self.base_dataset.size(index)"... | [
"0.7736441",
"0.7626682",
"0.7625215",
"0.7473958",
"0.74180686",
"0.7389912",
"0.7360876",
"0.73501265",
"0.7331537",
"0.73290014",
"0.73132133",
"0.73044115",
"0.72687536",
"0.7251257",
"0.72372824",
"0.7235976",
"0.7228604",
"0.71961737",
"0.71961737",
"0.71961737",
"0.719... | 0.8306337 | 0 |
Get a pseudo chain, only slot_number and parent_hash are valid. | def get_pseudo_chain(length, genesis_block):
blocks = []
for slot in range(length * 3):
blocks.append(
genesis_block.copy(
slot_number=slot,
parent_hash=blocks[slot - 1].hash if slot > 0 else ZERO_HASH32
)
)
return blocks | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_parent_struc (chain, added_chains_dict):\n if \"-\" in chain.id:\n structure = added_chains_dict[chain.id]\n else:\n structure = chain.get_parent().get_parent()\n return structure",
"def get_chain(self):\n return self.segment.chain",
"def get_chain(self):\n return s... | [
"0.56941795",
"0.552938",
"0.552938",
"0.5477433",
"0.538207",
"0.538207",
"0.53546077",
"0.5286972",
"0.52651906",
"0.5248736",
"0.5246238",
"0.52050126",
"0.5164858",
"0.51290184",
"0.50308263",
"0.49572527",
"0.4954574",
"0.49480006",
"0.4940452",
"0.4935994",
"0.49047002"... | 0.6743172 | 0 |
Splits a list to smaller chunks. | def split_to_chunks(of_list, chunk_size):
assert of_list is not None
for i in range(0, len(of_list), chunk_size):
yield of_list[i:i + chunk_size] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def split_chunk(list, chunk_size):\n for i in range(0, len(list), chunk_size):\n yield list[i:i + chunk_size]",
"def split_list(l, sizes):\n chunks = []\n offset = 0\n for size in sizes:\n chunks.append(l[offset:offset + size])\n offset += size\n return chunks",
"def... | [
"0.8308301",
"0.82309556",
"0.8106895",
"0.8036118",
"0.7931097",
"0.7816913",
"0.78060126",
"0.7770797",
"0.76282376",
"0.75935197",
"0.7567424",
"0.7526485",
"0.75085706",
"0.74924856",
"0.74837905",
"0.74786663",
"0.7475975",
"0.74376136",
"0.7427335",
"0.7423154",
"0.7421... | 0.82201463 | 2 |
Initialize a new Window object. | def __init__(self, tokens):
super(Window, self).__init__("") # because pylint complains otherwise
self.tokens = tokens | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _prep_window(self, parent=None):\n self.toolkit.app.initialize()\n if not self.initialized:\n self.setup(parent)\n self.resize_to_initial()\n self.update_minimum_size()\n self.update_maximum_size()",
"def init(self):\n sg.theme(gui.app_theme)\n... | [
"0.7100636",
"0.7074908",
"0.70636183",
"0.7024",
"0.697045",
"0.69613075",
"0.69288373",
"0.68347585",
"0.6817326",
"0.67953527",
"0.6725208",
"0.66807616",
"0.6668674",
"0.6663805",
"0.666093",
"0.6658436",
"0.65565884",
"0.65507025",
"0.6497394",
"0.6476914",
"0.6459897",
... | 0.64696884 | 20 |
Applies a list of feature generators to the tokens of this window. Each feature generator will then generate a list of featue values (as strings) for each token. Each of these lists can be empty. The lists are saved in the tokens and can later on be requested multiple times without the generation overhead (which can be... | def apply_features(self, features):
# feature_values is a multi-dimensional list
# 1st dimension: Feature (class)
# 2nd dimension: token
# 3rd dimension: values (for this token and feature, usually just one value, sometimes more,
# e.g. "w2vc=975")
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def featurize(self, tokens):\n features = []\n \n nrc_hashtag_emotion_features = self.nrc_hashtag_emotion(tokens)\n nrc_affect_intensity_features = self.nrc_affect_intensity(tokens)\n nrc_hashtag_sentiment_lexicon_unigrams_features = self.nrc_hashtag_sentiment_lexicon_unigrams(to... | [
"0.62898064",
"0.59535635",
"0.58249897",
"0.5758041",
"0.5749458",
"0.5732363",
"0.5610544",
"0.5600131",
"0.5595536",
"0.5555259",
"0.5531146",
"0.5501815",
"0.54725766",
"0.5432988",
"0.5419242",
"0.54126114",
"0.540625",
"0.5401913",
"0.5398498",
"0.53811485",
"0.53167295... | 0.7176995 | 0 |
I should be under RGB order and with value 01 float buf_plane should be with shape (h, w) or (h, w, c) | def yichao_visual(I, buf_plane, prefix):
# predNumPlanes = len(np.unique(buf_plane)) - 1
if len(buf_plane.shape) == 2:
predNumPlanes = len(np.unique(buf_plane)) - 1
buf_plane = (np.expand_dims(buf_plane, -1) == np.arange(1, predNumPlanes)).astype(
np.float32) # (h, w, predNumPlane... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _prepare_plane(self):\n verticies = [\n # main plane - note that the mainplane is scaled so the mat_plane\n # matrix will it transform to the correct coordinates\n -self.i_border[0]/self._scaling[0], self.i_border[1]/self._scaling[1],\n -self.i... | [
"0.6474734",
"0.6211658",
"0.61046386",
"0.6101591",
"0.5923669",
"0.5783592",
"0.5747154",
"0.56855327",
"0.56827813",
"0.56636375",
"0.5524621",
"0.552236",
"0.550781",
"0.5474803",
"0.5468295",
"0.5453259",
"0.5439706",
"0.53988826",
"0.53966236",
"0.5356916",
"0.5356765",... | 0.67274 | 0 |
Transforms the jsonapi response object into a flask response. | def to_response(japi_response):
if japi_response.is_file:
flask_response = flask.send_file(japi_response.file)
elif japi_response.has_body:
flask_response = flask.Response(japi_response.body)
else:
flask_response = flask.Response("")
for key, value in japi_response.headers.items... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def api_response():\n\n data = {\n 'hello': 'world',\n 'number': 12\n }\n\n js = json.dumps(data)\n # (@data, @status_code (200 by default), @data_type)\n resp = Response(response=js, status=200, mimetype='application/json')\n\n # Using jsonify to simplify syntax, returns exactly th... | [
"0.71587",
"0.6992199",
"0.6741547",
"0.67042494",
"0.6646592",
"0.6537109",
"0.6472386",
"0.64513254",
"0.642791",
"0.63703966",
"0.6340727",
"0.6261088",
"0.62363386",
"0.6235043",
"0.6232066",
"0.6232066",
"0.62282425",
"0.62282425",
"0.61445695",
"0.6134431",
"0.60231125"... | 0.7554598 | 0 |
The flask application, this API is registered on. | def flask_app(self):
return self._flask_app | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def app(request):\n app = flask.Flask(__name__)\n return app",
"def create_app(self):\n app = Flask(__name__)\n\n app.config[\"auth_func\"] = self.auth_func\n app.config[\"hydrator_func\"] = self.hydrator_func\n app.config[\"request_hydrator_func\"] = self.request_hydrator_func\... | [
"0.8116858",
"0.7973594",
"0.7934894",
"0.777387",
"0.77183795",
"0.7705166",
"0.7696983",
"0.76261747",
"0.76180613",
"0.75492454",
"0.7515162",
"0.73877615",
"0.7376176",
"0.73714656",
"0.73469746",
"0.73283195",
"0.7325196",
"0.7319582",
"0.73111725",
"0.73098445",
"0.7300... | 0.8111342 | 1 |
This function prints and plots the confusion matrix. Normalization can be applied by setting `normalize=True`. | def plot_confusion_matrix(y_true, y_pred, classes,
normalize=False,
title=None,
cmap=plt.cm.Blues):
if not title:
if normalize:
title = 'Normalized confusion matrix'
else:
title = 'Confusion matrix'... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def plot_confusion_matrix(cm, classes=[0,1], normalize=False, title='Confusion matrix', print_matrix=False):\n\n if normalize:\n cm = cm.astype('float') / cm.sum(axis=1)[:, np.newaxis]\n print(\"Normalized confusion matrix\")\n else:\n print('Confusion matrix, without normalization')\n\n... | [
"0.81920755",
"0.8093736",
"0.8028212",
"0.8017333",
"0.79923165",
"0.7989431",
"0.79789335",
"0.7974398",
"0.795948",
"0.79555666",
"0.7935652",
"0.7932704",
"0.7932632",
"0.7929465",
"0.7924336",
"0.7922666",
"0.79221356",
"0.7921299",
"0.79209703",
"0.7920307",
"0.7916008"... | 0.0 | -1 |
Get a datetime object or a int() Epoch timestamp and return a pretty string like 'an hour ago', 'Yesterday', '3 months ago', 'just now', etc | def humanize_ts(timestamp=False):
now = datetime.now()
diff = now - datetime.fromtimestamp(timestamp)
second_diff = diff.seconds
day_diff = diff.days
if day_diff < 0:
return ''
if day_diff == 0:
if second_diff < 10:
return "just now"
if second_diff < 60:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def pretty_date(time=False):\n from datetime import datetime\n now = datetime.now()\n if type(time) is int:\n diff = now - datetime.fromtimestamp(time)\n elif isinstance(time,datetime):\n diff = now - time \n elif not time:\n diff = now - now\n second_diff = diff.seconds\n ... | [
"0.77358574",
"0.77081746",
"0.76909727",
"0.76480335",
"0.75144506",
"0.7103617",
"0.6907786",
"0.68924034",
"0.6841257",
"0.6819995",
"0.6812188",
"0.6654703",
"0.665432",
"0.66541725",
"0.6621554",
"0.6585497",
"0.65545744",
"0.65293115",
"0.651368",
"0.6502865",
"0.646894... | 0.78838193 | 0 |
Get the directory for the current local user. Expand home and then find current yewdocs user. If username is not None, use that as user name. | def get_user_directory(username=None):
home = expanduser("~")
yew_dir = os.path.join(home, STORAGE_DIR, username or get_username())
if not os.path.exists(yew_dir):
os.makedirs(yew_dir)
return yew_dir | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getUserDir() -> str:\n\n if os.name == \"nt\": # Windows system, try to return documents directory\n try:\n import ctypes.wintypes\n CSIDL_PERSONAL = 5 # Documents\n SHGFP_TYPE_CURRENT = 0 # Current value\n\n buf = ctypes.create_unicode_buffer(ctypes.win... | [
"0.74455893",
"0.727467",
"0.7252152",
"0.71694726",
"0.7108197",
"0.70367485",
"0.6949825",
"0.69333714",
"0.6900226",
"0.68946373",
"0.6894002",
"0.6822777",
"0.68184596",
"0.6804718",
"0.66511315",
"0.66511315",
"0.6635066",
"0.66129094",
"0.65402913",
"0.65082693",
"0.636... | 0.74671024 | 0 |
Convert json into its string representation. Used for writing outputs to markdown. | def string2json(self, string):
kwargs = {
'cls': BytesEncoder, # use the IPython bytes encoder
'indent': 1,
'sort_keys': True,
'separators': (',', ': '),
}
return cast_unicode(json.dumps(string, **kwargs), 'utf-8') | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __str__(self):\n\t\treturn json.dumps(self.json)",
"def _to_string(self, data=None):\n if not data:\n raise ValueError(\"Please provide a correct data structure.\")\n\n if isinstance(data, dict):\n return str(json.dumps(data))\n elif isinstance(data, list):\n ... | [
"0.69195336",
"0.6774187",
"0.6644638",
"0.64869547",
"0.64800596",
"0.64522064",
"0.6446627",
"0.6446627",
"0.6446627",
"0.6446627",
"0.6446627",
"0.6446627",
"0.6446627",
"0.6446627",
"0.6446627",
"0.6446627",
"0.6446627",
"0.6446627",
"0.6446627",
"0.6446627",
"0.6446627",... | 0.0 | -1 |
Expands the raw color list to a longer list, for example for the 11 LEDs. | def expand(colors, cutoff=12):
output = []
if len(colors) != 7 or cutoff > 14:
leds_per_color = int(cutoff / len(colors))
for i in colors:
output += [i] * leds_per_color
else:
for j, i in enumerate(colors):
output += [i] * (1 + (j % 2 == 1))
return output | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_color_list(self, new_list):\n self.__clr_list = itertools.cycle(new_list)",
"def convert_color(self, color):\n return [color[0]*16, color[1]*16, color[2]*16]",
"def setColors255(self):\n #productive\n profprint()\n self.color255= [[0,0,0] for i in range(205)]\n self.color255[0... | [
"0.68977153",
"0.6210699",
"0.61919403",
"0.60790914",
"0.6062352",
"0.6035774",
"0.5944189",
"0.59097964",
"0.5739225",
"0.57103854",
"0.56998533",
"0.56589353",
"0.56343913",
"0.56268597",
"0.5578521",
"0.5570436",
"0.5562978",
"0.55422485",
"0.55406356",
"0.55302924",
"0.5... | 0.699658 | 0 |
Returns color list of flag. | def get(flag="rainbow"):
return flags[flag] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getColors():\n return ['#8c99fc', '#cacefd', '#fff1d7', '#feda98', '#fda85a', '#fc6647']",
"def colors(self):\n\t\treturn [(0, 30, 255),(0, 30, 120)]",
"def get_color_list(self):\n lst = []\n\n _lib.caca_get_dither_color_list.argtypes = [_Dither]\n _lib.caca_get_dither_color_list.re... | [
"0.74240226",
"0.74066764",
"0.6966607",
"0.6953056",
"0.69349706",
"0.69149333",
"0.6914488",
"0.68421763",
"0.683912",
"0.6787154",
"0.6787154",
"0.67845774",
"0.6673966",
"0.6628321",
"0.6534284",
"0.64998037",
"0.6494784",
"0.6483562",
"0.6450821",
"0.6448775",
"0.6414715... | 0.0 | -1 |
Creates a copy of a table with the name new_table. Returns True on success Raises ValueError if repo or table have invalid characters Raises ProgrammingError if the repo or table do not exist. Raises ProgrammingError if the new_table already exists. Raises ProgrammingError on insufficient permissions. | def clone_table(self, repo, table, new_table):
return self.user_con.clone_table(
repo=repo, table=table, new_table=new_table) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_copy_table(self):\n tmp_sql_obj = deepcopy(self._new_table)\n tmp_sql_obj.name = self.new_table_name\n if self.rm_partition:\n tmp_sql_obj.partition = self._old_table.partition\n tmp_sql_obj.partition_config = self._old_table.partition_config\n tmp_table... | [
"0.70478636",
"0.67415345",
"0.6359299",
"0.63171786",
"0.6174851",
"0.6153838",
"0.6090806",
"0.5949713",
"0.5924822",
"0.591468",
"0.58097404",
"0.57756317",
"0.5746785",
"0.5744108",
"0.5671896",
"0.5647316",
"0.5617785",
"0.55952626",
"0.5587902",
"0.55872154",
"0.5565638... | 0.7110978 | 0 |
Exports a view to a file in the same repo. Defaults to CSV format with header row. Raises LookupError on invalid repo or view. Raises ProgrammingError on invalid combinations of file_format, delimiter, and header. Raises PermissionDenied on insufficient privileges. | def export_view(self, repo, view, file_format='CSV',
delimiter=',', header=True):
# clean up names:
repo = clean_str(repo, '')
view = clean_str(view, '')
# check for permissions
DataHubManager.has_repo_db_privilege(
self.username, self.repo_base, ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def export_sqlite_views(self):\r\n # Gather the names of report views in the db\r\n SQL_TRAN.execute(\"SELECT name FROM sqlite_master WHERE type='view'\")\r\n view_names = SQL_TRAN.fetchall()\r\n\r\n # Export report views to tsv files\r\n for i in view_names:\r\n\r\n q... | [
"0.644002",
"0.62077546",
"0.610297",
"0.5903054",
"0.58759844",
"0.57889473",
"0.5763627",
"0.57578593",
"0.57145846",
"0.5679018",
"0.55936116",
"0.558955",
"0.5573935",
"0.55662644",
"0.55635494",
"0.55422914",
"0.5530958",
"0.55106777",
"0.5510324",
"0.54646116",
"0.54431... | 0.8174933 | 0 |
The function take a list and sum the 2 smallest integers in the list. The list should have only positive values. | def sum_two_smallest_numbers(numbers):
# First we will save the 2 highest values an integer can hold.
first_min = sys.maxsize * 2 + 1
second_min = sys.maxsize * 2 + 1
# Second we will loop on the whole list and try to find the small integers
for num in numbers:
# If the cu... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def smallest_impossible_sum(arr:list):\n smallest_sum = 1\n for i in arr:\n if i > smallest_sum:\n return smallest_sum\n else:\n smallest_sum += i\n\n return smallest_sum",
"def find_least_number(incoming_list):\n \n return_value = min(incoming_list)\n return... | [
"0.71248937",
"0.70810133",
"0.6929526",
"0.68986845",
"0.6786484",
"0.67130756",
"0.6706579",
"0.6586391",
"0.65587234",
"0.6435877",
"0.6270288",
"0.6249976",
"0.62443477",
"0.6215996",
"0.62114835",
"0.61698097",
"0.6152485",
"0.6101208",
"0.6085979",
"0.60530573",
"0.6047... | 0.7720418 | 0 |
Create a new DataCollection containing the same objects and tags. | def copy(self):
new_data_collection = DataCollection()
for item in self.iteritems():
new_data_collection.add_data(item)
return new_data_collection | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def data(self):\n return DataTagCollection(client=self)",
"def build_collection( type, dataset_instances ):\n dataset_collection = model.DatasetCollection( )\n set_collection_elements( dataset_collection, type, dataset_instances )\n return dataset_collection",
"def __init__(self, tags=[], **kwa... | [
"0.6592414",
"0.6369967",
"0.6284068",
"0.6235122",
"0.61207104",
"0.6094285",
"0.6010789",
"0.5920692",
"0.5664024",
"0.5635507",
"0.55993205",
"0.5536257",
"0.55120546",
"0.5502393",
"0.55015576",
"0.547809",
"0.5437723",
"0.5395863",
"0.5394811",
"0.5379348",
"0.53692394",... | 0.7233961 | 0 |
Should return a string with the raw yaml. | def yaml(self):
raise NotImplementedError | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def yaml(self):\n return str(self.data)",
"def pretty(self):\n return yaml.dump(self.get_data(), encoding='utf-8',\n default_flow_style=False).rstrip()",
"def dump(data):\n stream = StringIO()\n yaml.dump(data, stream, Dumper=yaml.RoundTripDumper)\n return stream.... | [
"0.7550589",
"0.71138436",
"0.7066842",
"0.70443743",
"0.68718165",
"0.6833742",
"0.68099093",
"0.6741517",
"0.6714109",
"0.6706272",
"0.66315913",
"0.659191",
"0.6468005",
"0.64493865",
"0.64354354",
"0.6420099",
"0.6327395",
"0.632102",
"0.6294288",
"0.6241507",
"0.6218189"... | 0.6819862 | 6 |
One hot encoding of characters. | def vec(c):
nth_c = ord(c) - 97
vector = [0]*26
vector[nth_c] = 1
return vector | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def encode_one_hot(s):\n all = []\n for c in s:\n x = np.zeros((INPUT_VOCAB_SIZE)) \n index = char_indices[c]\n x[index] = 1 \n all.append(x)\n return all",
"def encode_one_hot2(s):\n x = np.zeros((LINE_SIZE, INPUT_VOCAB_SIZE))\n for n, c in enumerate(s):\n index... | [
"0.8442439",
"0.8205661",
"0.80430883",
"0.80316466",
"0.80128956",
"0.7977116",
"0.7958152",
"0.789899",
"0.7885669",
"0.7765279",
"0.7758937",
"0.7726681",
"0.770007",
"0.7676571",
"0.7657761",
"0.7577686",
"0.75413704",
"0.75392735",
"0.75008386",
"0.7487992",
"0.7469457",... | 0.0 | -1 |
Returns a list of models that are defined in settings (SEO_MODELS) | def get_seo_models():
seo_models = []
for model_name in getattr(settings, setting_name_seo_models, ()):
if "." in model_name:
# TODO: Test this block
app_label, model_name = model_name.split(".", 1)
model = models.get_model(app_label, model_name)
if model:... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def models() -> list[str]:\n return list(models_url.keys())",
"def models(self):\n return self.config.models()",
"def models(self):\r\n return self.get_field('model')",
"def models(self):\r\n return self.get_field('model')",
"def list_supported_models() -> Sequence[str]:\r\n retu... | [
"0.74980575",
"0.73359543",
"0.71628964",
"0.71628964",
"0.680728",
"0.6801257",
"0.6701175",
"0.66366863",
"0.66119",
"0.6582397",
"0.655425",
"0.653019",
"0.6509798",
"0.65006226",
"0.6496429",
"0.6459665",
"0.64464676",
"0.63751894",
"0.63546306",
"0.6347459",
"0.6256093",... | 0.8362464 | 0 |
Populate this list by calling populate(), but only once. | def _populate(self):
if not self._populated:
logging.debug("Populating lazy list %d (%s)" % (id(self), self.__class__.__name__))
self.populate()
self._populated = True | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _populate(self):\n raise NotImplemented",
"def populate(self):\n pass",
"def populate(self):\n raise NotImplementedError",
"def _populate(self):\n self.addDemographics()\n self.addLabs()\n self.addProblems()\n self.addMeds()\n self.addAllergies()\n ... | [
"0.7672525",
"0.7362828",
"0.7339555",
"0.72716385",
"0.71751004",
"0.7006337",
"0.6587101",
"0.64672905",
"0.64466757",
"0.633367",
"0.5979779",
"0.5971767",
"0.5946938",
"0.5924282",
"0.5901715",
"0.58396024",
"0.58089614",
"0.5778291",
"0.5778098",
"0.5778098",
"0.57761395... | 0.8694884 | 0 |
Set a new status for this order. If the requested status is not valid, then ``InvalidOrderStatus`` is raised. | def set_status(self, new_status):
if new_status == self.status:
return
old_status = self.status
if new_status not in self.available_statuses():
raise exceptions.InvalidOrderStatus(
_(
"'%(new_status)s' is not a valid status for order ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_status(self, new_status):\n if new_status == self.status:\n return\n\n old_status = self.status\n\n if new_status not in self.available_statuses():\n raise exceptions.InvalidLineStatus(\n _(\n \"'%(new_status)s' is not a valid sta... | [
"0.779645",
"0.7369347",
"0.7193942",
"0.71725655",
"0.71725655",
"0.71725655",
"0.7094429",
"0.70927423",
"0.7069152",
"0.70468855",
"0.7042993",
"0.6954597",
"0.68904144",
"0.6877358",
"0.6846289",
"0.6837254",
"0.6833582",
"0.67918646",
"0.6769376",
"0.6768838",
"0.6766777... | 0.80166996 | 0 |
Return basket total including tax | def basket_total_incl_tax(self):
return self.total_incl_tax - self.shipping_incl_tax - self.surcharge_incl_tax | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def basket_total_before_discounts_incl_tax(self):\n result = self.lines.aggregate(total=Sum(\"line_price_before_discounts_incl_tax\"))\n return result[\"total\"]",
"def get_total(self):\n\n base_price = 5\n total = (1 + int(self.tax)) * int(self.qty) * base_price\n\n return tot... | [
"0.79851776",
"0.7790624",
"0.7690845",
"0.7612315",
"0.75767565",
"0.7563291",
"0.7474982",
"0.7440227",
"0.7432671",
"0.7392003",
"0.7383767",
"0.73698246",
"0.7252003",
"0.71155125",
"0.7089692",
"0.7029608",
"0.7020738",
"0.7010139",
"0.6986414",
"0.69046676",
"0.6891608"... | 0.77513564 | 2 |
Return basket total excluding tax | def basket_total_excl_tax(self):
return self.total_excl_tax - self.shipping_excl_tax - self.surcharge_excl_tax | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def basket_total_before_discounts_excl_tax(self):\n result = self.lines.aggregate(total=Sum(\"line_price_before_discounts_excl_tax\"))\n return result[\"total\"]",
"def basket_total_before_discounts_incl_tax(self):\n result = self.lines.aggregate(total=Sum(\"line_price_before_discounts_incl_... | [
"0.8204515",
"0.81834763",
"0.7466485",
"0.70047367",
"0.69203687",
"0.68694043",
"0.6845346",
"0.67714256",
"0.67104477",
"0.6676664",
"0.66257316",
"0.6618944",
"0.66086304",
"0.6581972",
"0.6573452",
"0.656146",
"0.65571976",
"0.652433",
"0.6449376",
"0.64168954",
"0.64030... | 0.77078253 | 2 |
Returns the number of items in this order. | def num_items(self):
num_items = 0
for line in self.lines.all():
num_items += line.quantity
return num_items | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def count(self):\n return len(self.order_items)",
"def items_num(self):\n return len(self.items)",
"def count_items(self):\n count = 0\n for o in self.order_lst:\n count += o.count()\n \n return count",
"def get_num_items(self):\r\n return self.... | [
"0.8784276",
"0.87252384",
"0.870693",
"0.8697926",
"0.86503977",
"0.8639872",
"0.8639872",
"0.8337275",
"0.8243856",
"0.823086",
"0.8186256",
"0.8131355",
"0.8066835",
"0.7888121",
"0.7855498",
"0.7855498",
"0.7855498",
"0.7855498",
"0.7855498",
"0.7836867",
"0.78349423",
... | 0.826943 | 8 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.