query stringlengths 10 2k | document stringlengths 20 51.2k | metadata dict | negatives listlengths 0 101 | negative_scores listlengths 0 101 | document_score stringlengths 3 10 | document_rank stringclasses 102
values |
|---|---|---|---|---|---|---|
\ returns the gravityScore as an integer from this node | def get_score(self, node):
return self.get_node_gravity_score(node) or 0 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getScore(self, node):\n return self.getGravityScoreFromNode(node) or 0",
"def get_score(self, node):\r\n return self.get_node_gravity_score(node) or 0",
"def get_g_score(self):\n return self._g_score",
"def g_score(self):\n _, _, I_CK = self._entropies()\n return 2.0 * ... | [
"0.77891207",
"0.7783858",
"0.7576337",
"0.7211259",
"0.6674672",
"0.6591615",
"0.64885664",
"0.64885664",
"0.64885664",
"0.64840925",
"0.6476699",
"0.6476699",
"0.6476699",
"0.64238083",
"0.635222",
"0.6340573",
"0.6272104",
"0.62570226",
"0.6202556",
"0.6167112",
"0.6155587... | 0.7753422 | 2 |
liefert die vorhandenen Gruppen der Organisation org_id | def get_group_list(org_id):
tList = get_template('app/usermanagementorg/group_list.html')
groups = get_groups(org_id)
return tList.render(Context({ 'groups': groups, })) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def org_id(self) -> pulumi.Output[str]:\n return pulumi.get(self, \"org_id\")",
"def test_retrieve_l_organization(self):\n pass",
"def org_id(self) -> pulumi.Input[str]:\n return pulumi.get(self, \"org_id\")",
"def org_id(self) -> Optional[pulumi.Input[str]]:\n return pulumi.get(s... | [
"0.60829526",
"0.6081244",
"0.6022286",
"0.6003161",
"0.59705824",
"0.59683555",
"0.59033537",
"0.58925307",
"0.5887167",
"0.5880952",
"0.5875457",
"0.58674335",
"0.5862764",
"0.5849434",
"0.58493876",
"0.58443016",
"0.58416104",
"0.58307415",
"0.58233196",
"0.58163786",
"0.5... | 0.0 | -1 |
Return a list of all files (absolute path for each one) within a tree. root_directory root directory within which to find all files | def GetAllFilepaths(root_directory):
path_list = []
for dirpath, _, filenames in os.walk(root_directory):
for filename in filenames:
path_list.append(os.path.abspath(os.path.join(dirpath, filename)))
return path_list | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_files(root_dir, recursive=True):\n\n ret_files = []\n\n for root, _, files in os.walk(root_dir, topdown=True):\n\n for name in files:\n ret_files.append(os.path.join(root, name))\n\n if not recursive:\n break\n\n return ret_files",
"def find_files(root, direct... | [
"0.801258",
"0.7968848",
"0.7952803",
"0.7891923",
"0.7869508",
"0.7823665",
"0.7823665",
"0.7610529",
"0.75427413",
"0.75083655",
"0.7490626",
"0.74751157",
"0.7463474",
"0.7452347",
"0.744836",
"0.7441465",
"0.7431208",
"0.74022263",
"0.7388493",
"0.7377099",
"0.7334647",
... | 0.79303044 | 3 |
Returns the full contents of this file as a string. | def ReadFileIntoString(filepath):
with open(filepath, 'r') as file_handle:
contents = file_handle.read()
return contents | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def content(self) -> str:\n if self._content is None:\n with open(self.name, mode='r', encoding='utf-8') as f:\n self._content = f.read()\n return self._content",
"def get_file_content(self):\n s = StringIO.StringIO()\n\n s.write(self.get_header())\n s... | [
"0.7818071",
"0.78163445",
"0.76988196",
"0.7656184",
"0.764348",
"0.7538859",
"0.7531847",
"0.7519602",
"0.74998116",
"0.73604244",
"0.7280849",
"0.7273001",
"0.7257074",
"0.7231297",
"0.7222394",
"0.71755415",
"0.7161705",
"0.7138407",
"0.7128217",
"0.7127716",
"0.7121845",... | 0.6769896 | 39 |
Add a new guild to the database | def get_and_add_guild_to_DB(name, server):
add_guild(name, server)
update_guild_members(name, server) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"async def create_guild(self, name, guild_id):\n\n await self.db[str(guild_id)].insert_one({'name': name})",
"def addGuild(self, guildId):\n flag = False\n\n if self.con.recordGuild(guildId):\n self.serverSettings[str(guildId)] = '1'\n self.custom[str(guildId)] = []\n ... | [
"0.80392987",
"0.757477",
"0.7166284",
"0.6424634",
"0.6248634",
"0.6196475",
"0.6123536",
"0.6116454",
"0.59878755",
"0.5937755",
"0.5883898",
"0.58635056",
"0.5836839",
"0.57681274",
"0.57149863",
"0.57122195",
"0.5706549",
"0.5691396",
"0.56723166",
"0.55848026",
"0.556573... | 0.74933517 | 2 |
Get the height of the board. | def get_grid_height(self):
return self.grid_height | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def height(self):\n return self.board.shape[0]",
"def getHeight(self):\n return self.height",
"def getHeight(self):\n return self.height",
"def getHeight(self):\n return self._height",
"def get_grid_height(self):\n return self._height",
"def get_grid_height(self):\n ... | [
"0.85061604",
"0.78280675",
"0.78280675",
"0.77917385",
"0.77883863",
"0.77883863",
"0.77680314",
"0.77680314",
"0.77680314",
"0.77680314",
"0.7766107",
"0.7762733",
"0.7760341",
"0.7754089",
"0.7742322",
"0.773752",
"0.77214617",
"0.7696989",
"0.76941013",
"0.76941013",
"0.7... | 0.7678819 | 21 |
constructor of a finite grid | def __init__ (self, shape) :
self._shape=[int(s) for s in shape]
offset=[1]
for i,incr in enumerate(self._shape[:-1]) :
offset.append(offset[i]*incr)
self._offset=offset | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self, grid, x, y, cols):\n self.grid = grid\n self.x = x\n self.y = y\n self.cols = cols",
"def initialize_grid(self):\n self.grid = np.zeros([self.N, self.N, self.N])\n return self.grid",
"def __init__(self, grid_height, grid_width):\n self._grid_h... | [
"0.7652766",
"0.73937804",
"0.7335432",
"0.7266142",
"0.7255401",
"0.7234269",
"0.72223854",
"0.7178247",
"0.7163378",
"0.7089973",
"0.7053439",
"0.70305246",
"0.6927562",
"0.6827065",
"0.6826698",
"0.6817924",
"0.6816522",
"0.6814691",
"0.6814691",
"0.6814691",
"0.6793227",
... | 0.0 | -1 |
Return True if the requirement line is a package requirement; that is, it is not blank, a comment, or editable. | def is_requirement(line):
# Remove whitespace at the start/end of the line
line = line.strip()
# Skip blank lines, comments, and editable installs
return not (
line == '' or
line.startswith('-r') or
line.startswith('#') or
line.startswith('-e') or
line.startswith... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_requirement(line):\n # Remove whitespace at the start/end of the line\n line = line.strip()\n\n # Skip blank lines, comments, and editable installs\n return not (\n line == '' or\n line.startswith('-r') or\n line.startswith('#') or\n line.startswith('-e') or\n ... | [
"0.7918398",
"0.6491513",
"0.64020306",
"0.6393805",
"0.6252527",
"0.62129545",
"0.62058246",
"0.61729455",
"0.6163215",
"0.6081382",
"0.582989",
"0.58245003",
"0.5819515",
"0.57817334",
"0.5779906",
"0.57180566",
"0.5713881",
"0.56857467",
"0.5672359",
"0.56688696",
"0.56664... | 0.7958622 | 0 |
Load all requirements from the specified requirements files. Returns a list of requirement strings. | def load_requirements(*requirements_paths):
requirements = set()
for path in requirements_paths:
requirements.update(
line.strip() for line in open(path).readlines()
if is_requirement(line)
)
return list(requirements) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def read_requirements():\r\n reqs_path = os.path.join('.', 'requirements.txt')\r\n with open(reqs_path, 'r') as f:\r\n requirements = [line.rstrip() for line in f]\r\n return requirements",
"def read_requirements():\n reqs_path = path.join('.', 'requirements.txt')\n with open(reqs_path, 'r'... | [
"0.7582946",
"0.7566082",
"0.7510872",
"0.7329994",
"0.73283947",
"0.7311504",
"0.72993433",
"0.7227282",
"0.7204282",
"0.71849895",
"0.71617824",
"0.7120652",
"0.7102642",
"0.6999106",
"0.68981975",
"0.68856305",
"0.6822963",
"0.6821116",
"0.681476",
"0.6811484",
"0.6811019"... | 0.8446515 | 1 |
Construct a benchmark suite. | def __init__(self, suite_map: Dict[str, List[BenchmarkCase]]):
self.suite_map = suite_map
self.category_map = dict((os.path.basename(category_dir), category_dir)
for category_dir in self.suite_map.keys()) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def suite():\n tests.init()\n\n suites = []\n suites += unittest.makeSuite(MeasureSourcesTestCase)\n suites += unittest.makeSuite(ForcedMeasureSourcesTestCase)\n suites += unittest.makeSuite(tests.MemoryTestCase)\n return unittest.TestSuite(suites)",
"def suite():\n\n utilsTests.init()\n\n ... | [
"0.7037264",
"0.6902392",
"0.6900579",
"0.6891418",
"0.68217766",
"0.67469823",
"0.6697956",
"0.6658442",
"0.66533816",
"0.66199195",
"0.66199195",
"0.65930617",
"0.65295607",
"0.6527297",
"0.6524729",
"0.6514299",
"0.65031695",
"0.6496491",
"0.648625",
"0.6414773",
"0.637484... | 0.61335814 | 29 |
Calculate the worst score for SC2 or SC3, to be used as 0 when normalizing the scores | def get_worst_score(nssms, truth_ccm, scoring_func, truth_ad=None, subchallenge="SC2", larger_is_worse=True):
if subchallenge is 'SC3':
if truth_ad is None:
raise ValueError('truth_ad must not be None when scoring SC3')
else:
if larger_is_worse:
return max(ge... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def worst_score(self):\r\n pass",
"def personal_best(scores):\n return max(scores)",
"def __get_best_score(scores):\n best = max(scores.items(), key=operator.itemgetter(1))[0]\n print(\"The best classification for this corpus is: \" + str(best))\n return best",
"def negamax(sel... | [
"0.7640267",
"0.6758963",
"0.66853225",
"0.66818994",
"0.6662265",
"0.6602432",
"0.65957755",
"0.658249",
"0.65547794",
"0.653465",
"0.6514898",
"0.64466137",
"0.6446268",
"0.6438255",
"0.64000523",
"0.6397215",
"0.6362737",
"0.63512236",
"0.6349788",
"0.6338928",
"0.6326012"... | 0.6954726 | 1 |
Return the string representation of ``self``. | def _repr_(self):
return "QuiverMutationType" | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def to_string(self):\r\n return self.__str__()",
"def __str__ (self) :\n\n return self.as_string()",
"def toString(self) -> str:\n raise NotImplementedError",
"def as_string(self):\n return self.__repr__()",
"def __repr__(self) -> str:\n return str(self)",
"def __str__(... | [
"0.8782659",
"0.8733837",
"0.8684035",
"0.85116726",
"0.84932524",
"0.84345543",
"0.8430234",
"0.8418007",
"0.8411039",
"0.8384999",
"0.8384999",
"0.8384999",
"0.8384999",
"0.834885",
"0.834885",
"0.834885",
"0.8336933",
"0.8336933",
"0.8336933",
"0.8336933",
"0.8336933",
"... | 0.0 | -1 |
Return ``True`` iff ``self`` and ``other`` represent the same quiver mutation type. | def __eq__(self,other):
return self is other | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __eq__(self, other) -> bool:\n if not isinstance(other, NilpotentOrbit):\n return False\n if self.my_type != other.my_type:\n return False\n if self.lie_rank != other.lie_rank:\n return False\n if self.decorator != other.decorator:\n retur... | [
"0.73721755",
"0.7295905",
"0.7259128",
"0.7215644",
"0.7157533",
"0.71331227",
"0.7114832",
"0.7057666",
"0.7037374",
"0.7033497",
"0.7012533",
"0.7010063",
"0.6991901",
"0.6981299",
"0.69599956",
"0.6946483",
"0.6946483",
"0.6946483",
"0.6941768",
"0.6935024",
"0.69278306",... | 0.0 | -1 |
Return the string representation of ``self``. | def _repr_(self):
return self._description | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def to_string(self):\r\n return self.__str__()",
"def __str__ (self) :\n\n return self.as_string()",
"def toString(self) -> str:\n raise NotImplementedError",
"def as_string(self):\n return self.__repr__()",
"def __repr__(self) -> str:\n return str(self)",
"def __str__(... | [
"0.8782659",
"0.8733837",
"0.8684035",
"0.85116726",
"0.84932524",
"0.84345543",
"0.8430234",
"0.8418007",
"0.8411039",
"0.8384999",
"0.8384999",
"0.8384999",
"0.8384999",
"0.834885",
"0.834885",
"0.834885",
"0.8336933",
"0.8336933",
"0.8336933",
"0.8336933",
"0.8336933",
"... | 0.0 | -1 |
Return ``True`` if ``self`` is irreducible. | def is_irreducible(self):
return self._info['irreducible'] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_cyclically_reduced(self):\n if not self:\n return True\n return self[0] != self[-1]**-1",
"def is_emptiable(self) -> bool:\n raise NotImplementedError()",
"def is_raw(self):\n return not self._isReduced",
"def is_reduced(self):\n return self._isReduced",
... | [
"0.6909022",
"0.6530604",
"0.6526129",
"0.6472103",
"0.6374406",
"0.63209915",
"0.63061345",
"0.6244093",
"0.6222853",
"0.6199186",
"0.61582834",
"0.61075336",
"0.6092535",
"0.6066914",
"0.60204804",
"0.60204804",
"0.59781283",
"0.59385216",
"0.59272367",
"0.5903944",
"0.5889... | 0.78182685 | 0 |
Return ``True`` if ``self`` is simply laced. This means that the only arrows that appear in the quiver of ``self`` are single unlabelled arrows. | def is_simply_laced(self):
return self._info['simply_laced'] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_versor(self) -> bool:\n return np.isclose(np.linalg.norm(self.A), 1.0)",
"def is_conjugate(self):\n return self.is_dagger and bool(self.z)",
"def is_origin(self) -> bool:\n return self.x == 0 and self.y == 0",
"def is_on_curve(self):\n if self.infinity:\n return ... | [
"0.6114434",
"0.60558015",
"0.59805834",
"0.5958243",
"0.5917587",
"0.5879947",
"0.584131",
"0.5828284",
"0.58172256",
"0.5795043",
"0.57854724",
"0.5715",
"0.5711512",
"0.5694263",
"0.569062",
"0.56701344",
"0.5644504",
"0.56363744",
"0.562518",
"0.56132287",
"0.5584384",
... | 0.6973007 | 0 |
Return ``True`` if ``self`` is of finite type. This means that the cluster algebra associated to ``self`` has only a finite number of cluster variables. | def is_finite(self):
return self._info['finite'] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_finite(self):\n return False",
"def isfinite(self):\n return not self.isAny( (lambda x: not np.isfinite(x)) )",
"def is_finite(self):\r\n return self._real.is_finite() and self._imag.is_finite()",
"def is_finite(self) -> bool:\n normal = self.to_normal_form()\n di_graph ... | [
"0.72034794",
"0.70886",
"0.7014888",
"0.67683184",
"0.6525775",
"0.63968205",
"0.6393442",
"0.6391889",
"0.6321494",
"0.6287117",
"0.62199044",
"0.6186377",
"0.6156649",
"0.6148706",
"0.61448073",
"0.61311907",
"0.6128614",
"0.60949683",
"0.6079762",
"0.6061395",
"0.6034073"... | 0.69614017 | 3 |
Return ``True`` if ``self`` is of affine type. | def is_affine(self):
if self.is_irreducible():
return self._info['affine']
else:
return False | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_a(self, t):\n return isinstance(self._, t)",
"def is_my_case(self, type_):\n return (\n isinstance(self.__apply_sequence(type_), self.declaration_class)\n )",
"def affine(self):\n return self._affine",
"def affine(self):\n return self._affine",
"def acce... | [
"0.6206102",
"0.58228403",
"0.57748437",
"0.57748437",
"0.57737577",
"0.5709886",
"0.56617427",
"0.5636974",
"0.55917084",
"0.55733454",
"0.5471529",
"0.545357",
"0.5415966",
"0.5346846",
"0.53432095",
"0.5330829",
"0.53259623",
"0.5324064",
"0.5277562",
"0.5271494",
"0.52705... | 0.74847513 | 0 |
Return a list of all irreducible components of ``self``. | def irreducible_components( self ):
return tuple([self]) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def irreducible_components( self ):\n return self._info['irreducible_components']",
"def final_components(self):\n DG = self.digraph()\n condensation = DG.strongly_connected_components_digraph()\n return [self.induced_sub_finite_state_machine([self.state(_) for _ in component])\n ... | [
"0.83389485",
"0.6402634",
"0.61911064",
"0.6034745",
"0.60054934",
"0.5952732",
"0.5950152",
"0.59469277",
"0.5886472",
"0.5885298",
"0.58520526",
"0.5848222",
"0.58389753",
"0.5829749",
"0.5771868",
"0.5754153",
"0.5754148",
"0.5736017",
"0.5736017",
"0.5730207",
"0.5723094... | 0.8038997 | 1 |
Return a list of all irreducible components of ``self``. | def irreducible_components( self ):
return self._info['irreducible_components'] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def irreducible_components( self ):\n return tuple([self])",
"def final_components(self):\n DG = self.digraph()\n condensation = DG.strongly_connected_components_digraph()\n return [self.induced_sub_finite_state_machine([self.state(_) for _ in component])\n for componen... | [
"0.8038997",
"0.6402634",
"0.61911064",
"0.6034745",
"0.60054934",
"0.5952732",
"0.5950152",
"0.59469277",
"0.5886472",
"0.5885298",
"0.58520526",
"0.5848222",
"0.58389753",
"0.5829749",
"0.5771868",
"0.5754153",
"0.5754148",
"0.5736017",
"0.5736017",
"0.5730207",
"0.5723094"... | 0.83389485 | 0 |
Create a new Experiment class object to handle the affinity maturation | def make_IPRO_experiment(experiment, folder):
# Change the folder
os.chdir(folder)
# Make an "input_files" folder
os.system("cp -r " + experiment["Folder"] + "input_files/ ." )
# Make a "structures" folder
os.system("cp -r " + experiment["Folder"] + "structures/ ." )
# Make a "results" folde... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self, experiment) -> None:\n self.logger = get_logger()\n np.random.seed(experiment.seed)\n self.gpu_imported = False\n\n from sktime.forecasting.naive import NaiveForecaster # type: ignore\n\n # Disable container if certain features are not supported but enforced -... | [
"0.58778197",
"0.58253855",
"0.5782972",
"0.5735269",
"0.5730789",
"0.5723273",
"0.57127726",
"0.5695483",
"0.566314",
"0.5659675",
"0.5636866",
"0.56055367",
"0.5597391",
"0.55834264",
"0.5581786",
"0.5564284",
"0.5561358",
"0.55575144",
"0.55496943",
"0.5542339",
"0.5522587... | 0.0 | -1 |
Add a vertex to the graph. | def add_vertex(self, room):
if room['room_id'] not in self.rooms:
self.rooms[room['room_id']] = room
# self.rooms[room['room_id']]['exits'] = {
# d: '?' for d in room['exits']}
| {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_vertex(self, vertex):\n raise NotImplementedError",
"def add_vertex(self, vertex):\n if isinstance(vertex, Vertex):\n self.vertices.append(vertex)\n return\n raise TypeError('Is not vertex instance!')",
"def add_vertex(self, vertex_name: n):\n new_verte... | [
"0.87028456",
"0.8433137",
"0.8423547",
"0.84105784",
"0.8365437",
"0.8317453",
"0.82548326",
"0.8086028",
"0.808189",
"0.80379087",
"0.80349994",
"0.7882811",
"0.7872011",
"0.78399634",
"0.78399634",
"0.77613264",
"0.77562904",
"0.771701",
"0.77133113",
"0.7668263",
"0.76623... | 0.0 | -1 |
util function to generate a shard strategy on shard_dim | def _gen_shard_strategy(
mesh: DeviceMesh, shard_dim: int, input_specs: Optional[List[DTensorSpec]] = None
) -> PlacementStrategy:
return PlacementStrategy(
output_spec=DTensorSpec(mesh=mesh, placements=[Shard(shard_dim)]),
input_specs=input_specs,
) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def generate_sharding_spec(input_: Union[Node, torch.Tensor], device_mesh: DeviceMesh,\n dim_partition_dict: Dict[int, List[int]]) -> ShardingSpec:\n\n if isinstance(input_, Node):\n assert hasattr(input_, '_meta_data'), f'The given node has no attribute _meta_data'\n met... | [
"0.64722633",
"0.6158465",
"0.6151724",
"0.6098981",
"0.6019289",
"0.58124673",
"0.5797631",
"0.57955444",
"0.5783862",
"0.57712466",
"0.5766991",
"0.5691101",
"0.5681694",
"0.56629384",
"0.56077176",
"0.5581816",
"0.55798984",
"0.55630535",
"0.550826",
"0.55040497",
"0.54991... | 0.78770477 | 0 |
Probability density function at x of the given RV. | def pdf(self, x, *args, **kwds):
args, loc, scale = self._parse_args(*args, **kwds)
x, loc, scale = map(np.asarray, (x, loc, scale))
args = tuple(map(np.asarray, args))
dtyp = np.find_common_type([x.dtype, np.float64], [])
x = np.asarray((x - loc) / scale, dtype=dtyp)
con... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def probability_density(self, X):\n raise NotImplementedError",
"def pdf(self, x, **kwargs):\n from scipy.stats import rv_continuous\n return self.rvdist.pdf(x, **kwargs) if rv_continuous in self.rvdist.__class__.__mro__ \\\n else self.rvdist.evaluate(x, **kwargs)",
"def density(s... | [
"0.7344522",
"0.71726716",
"0.6864767",
"0.6673743",
"0.666243",
"0.66551185",
"0.6605392",
"0.65396005",
"0.65396005",
"0.6519685",
"0.65058935",
"0.6487161",
"0.64650214",
"0.64356697",
"0.6417875",
"0.64077896",
"0.6405643",
"0.63956624",
"0.6360221",
"0.634107",
"0.632150... | 0.0 | -1 |
Invalid dimension for partial map. | def test_partial_channel_invalid_dim():
with np.testing.assert_raises(ValueError):
rho = np.array([[1, 2, 3, 4], [5, 6, 7, 8], [12, 11, 10, 9]])
partial_channel(rho, depolarizing(3), 1, [2, 2]) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_partial_channel_invalid_map():\n with np.testing.assert_raises(ValueError):\n rho = np.array([[1, 2, 3, 4], [5, 6, 7, 8], [12, 11, 10, 9]])\n partial_channel(rho, 5)",
"def test_get_non_existent_dimension(self):\n\n v = Vector({ })\n self.assertEqual(0, v.dimensions['x'])"... | [
"0.64951444",
"0.6474456",
"0.6294748",
"0.6197223",
"0.58030504",
"0.57994324",
"0.57901",
"0.5769024",
"0.57651436",
"0.57086724",
"0.5663097",
"0.5621079",
"0.5574977",
"0.555723",
"0.5553212",
"0.5546755",
"0.5514143",
"0.5512426",
"0.55097884",
"0.55060345",
"0.55038154"... | 0.5541827 | 16 |
get the last match a user participated in | def get_last_user_match(self, user):
user_id = self.get_user_id(user)
endpoint = f"users/{user_id}/recent"
response = self._api_request(endpoint)
if response is not None and response != []:
return response | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"async def last_match(self, ctx, *, member: discord.Member=None):\n\n if member is None:\n member = ctx.message.author\n\n steam_ids = self.bot.steam_info.get(member.id)\n\n if steam_ids is None:\n await self.bot.say(\"{0.name} has not linked their Steam account to MT5ABot... | [
"0.6979694",
"0.66317177",
"0.60455626",
"0.60170966",
"0.6012915",
"0.5991772",
"0.59343225",
"0.59195995",
"0.5910663",
"0.590491",
"0.5896453",
"0.5867692",
"0.5795039",
"0.577379",
"0.56715083",
"0.5648917",
"0.5643118",
"0.55804926",
"0.5575601",
"0.5560733",
"0.5531412"... | 0.7273124 | 0 |
Returns an array with evenly spaced values within a given interval. | def arange(start, stop=None, step=1, dtype=None):
if not use_origin_backend():
if not isinstance(start, int):
pass
elif not isinstance(stop, int) or stop is not None:
pass
elif not isinstance(step, int) or step is not None:
pass
else:
i... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def buildIntervalSegs(array, interval: int):\n interSegs = []\n for i in range(interval):\n interSegs.append(array[i::interval])\n return np.array(interSegs)",
"def linspace(start, stop, n, istart=True, istop=True):\r\n n = n-1\r\n arr = [start + ((stop-start)/n) * i for i in range(n+1)]\r\n retu... | [
"0.70652544",
"0.6159499",
"0.5933608",
"0.5913427",
"0.59069604",
"0.5896829",
"0.5888307",
"0.58881664",
"0.5887815",
"0.5870323",
"0.5850876",
"0.57911813",
"0.5790448",
"0.5765376",
"0.57531565",
"0.5735978",
"0.5727787",
"0.5688795",
"0.5684741",
"0.56720555",
"0.5664882... | 0.0 | -1 |
Create a twodimensional array with the flattened input as a diagonal. | def diagflat(v, k=0):
if not use_origin_backend(v):
if not isinstance(v, dparray):
pass
else:
return dpnp_diag(v.ravel(), k)
return call_origin(numpy.diagflat, v, k) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def diagonal(nd):\n assert nd.ndim == 2, \"diagonal requires 2 dimensional ndarray\"\n shape_min = hl.min(nd.shape[0], nd.shape[1])\n return hl.nd.array(hl.range(hl.int32(shape_min)).map(lambda i: nd[i, i]))",
"def create_diagonal(m: NumpyRealArray) -> NumpyRealArray:\n indices = (..., *np.diag_indic... | [
"0.6653787",
"0.66490763",
"0.64584154",
"0.6403105",
"0.6310567",
"0.6244818",
"0.6197691",
"0.6102409",
"0.60716945",
"0.60541594",
"0.6034054",
"0.60217506",
"0.6015008",
"0.5965729",
"0.5951027",
"0.58963096",
"0.5880482",
"0.58780825",
"0.58717847",
"0.58657545",
"0.5835... | 0.6157202 | 7 |
Return a new array of given shape and type, filled with `fill_value`. | def full(shape, fill_value, dtype=None, order='C'):
if not use_origin_backend():
if order not in ('C', 'c', None):
pass
else:
if dtype is None:
dtype = numpy.array(fill_value).dtype.type
return dpnp_full(shape, fill_value, dtype)
return call_... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _GetDefaultFill(\n unbatched_shape: List[int], value_type: pa.DataType,\n default_value_proto: schema_pb2.TensorRepresentation.DefaultValue\n) -> pa.Array:\n\n size = int(np.prod(unbatched_shape, initial=1))\n return pa.array(\n [_GetAllowedDefaultValue(value_type, default_value_proto)] * size,\n ... | [
"0.6754294",
"0.6706158",
"0.6585885",
"0.65728325",
"0.6548336",
"0.63844734",
"0.63147783",
"0.63030493",
"0.61651874",
"0.6139775",
"0.6138042",
"0.6130439",
"0.6121031",
"0.6083449",
"0.59815073",
"0.5967554",
"0.58871716",
"0.5883517",
"0.58381355",
"0.57922816",
"0.5790... | 0.65130734 | 5 |
Return a full array with the same shape and type as a given array. | def full_like(x1, fill_value, dtype=None, order='C', subok=False, shape=None):
if (not use_origin_backend()):
if order not in ('C', 'c', None):
checker_throw_value_error("full_like", "order", order, 'C')
if subok is not False:
checker_throw_value_error("full_like", "subok", ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def extend_array_to_homogeneous(array):\n try:\n assert array.shape[0] in (2, 3, 4)\n dim, samples = array.shape\n return np.vstack((array, np.ones((1, samples))))\n\n except:\n assert array.shape[1] in (2, 3, 4)\n array = array.T\n dim, samples = array.shape\n ... | [
"0.6944547",
"0.69309425",
"0.68787193",
"0.68400425",
"0.67186373",
"0.66690046",
"0.65797806",
"0.64741105",
"0.6467116",
"0.643937",
"0.64203936",
"0.6419304",
"0.63844043",
"0.6347509",
"0.6339532",
"0.6337388",
"0.6334201",
"0.6328955",
"0.63279325",
"0.62858397",
"0.626... | 0.0 | -1 |
Return a new array of given shape and type, filled with ones. | def ones(shape, dtype=None, order='C'):
if (not use_origin_backend()):
if order not in ('C', 'c', None):
checker_throw_value_error("ones", "order", order, 'C')
_dtype = dtype if dtype is not None else dpnp.float64
return dpnp_init_val(shape, _dtype, 1)
return numpy.ones(s... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def ones(shape, dtype=None):\n\n return full(shape, 1, dtype)",
"def ones(shape, dtype=None):\r\n if not isinstance(shape, (list, tuple, TensorVariable)):\r\n shape = [shape]\r\n if dtype is None:\r\n dtype = config.floatX\r\n return alloc(numpy.array(1, dtype=dtype), *shape)",
"def o... | [
"0.7451482",
"0.7396521",
"0.70855975",
"0.70053256",
"0.6978017",
"0.69384104",
"0.68086255",
"0.677857",
"0.67612815",
"0.66027343",
"0.6444811",
"0.6437159",
"0.6437159",
"0.6397919",
"0.6385478",
"0.63382226",
"0.6326699",
"0.6306192",
"0.6297376",
"0.6272954",
"0.6258368... | 0.6072709 | 28 |
Return an array of ones with the same shape and type as a given array. | def ones_like(x1, dtype=None, order='C', subok=False, shape=None):
if (not use_origin_backend()):
if order not in ('C', 'c', None):
checker_throw_value_error("ones_like", "order", order, 'C')
if subok is not False:
checker_throw_value_error("ones_like", "subok", subok, False... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def ones(shape, dtype=None):\n\n return full(shape, 1, dtype)",
"def ones(shape, dtype=None):\n raise NotImplementedError",
"def initArrayWithNumbers(self, array):\n for i in range(array.shape[0]):\n array[i][0] = 1\n for j in range(array.shape[1]):\n array[0][j] =... | [
"0.7129741",
"0.7090209",
"0.69398",
"0.68057853",
"0.68020076",
"0.6717566",
"0.66896456",
"0.6627643",
"0.6525225",
"0.6490907",
"0.64496857",
"0.64429474",
"0.64357793",
"0.64357793",
"0.63630855",
"0.6343118",
"0.6307312",
"0.6247002",
"0.62155986",
"0.6172503",
"0.605073... | 0.5649979 | 54 |
An array with ones at and below the given diagonal and zeros elsewhere. | def tri(N, M=None, k=0, dtype=numpy.float):
if not use_origin_backend():
return dpnp_tri(N, M, k, dtype)
return call_origin(numpy.tri, N, M, k, dtype) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_diagonal_image(n):\n alist = []\n for i in range(0, n):\n alist.append([])\n for j in range(0,n):\n if i ==j:\n alist[i].append(1)\n else:\n alist[i].append(0)\n\n ##########\n # img = create_zeroed_image(n)\n # for i in rang... | [
"0.6350763",
"0.61891156",
"0.61817294",
"0.61587536",
"0.6098415",
"0.6050805",
"0.60269594",
"0.5966776",
"0.59423965",
"0.592322",
"0.590171",
"0.5878317",
"0.58775556",
"0.58438224",
"0.58264667",
"0.5820174",
"0.58057153",
"0.58052063",
"0.5802331",
"0.57899046",
"0.5789... | 0.0 | -1 |
Lower triangle of an array. Return a copy of an array with elements above the `k`th diagonal zeroed. | def tril(m, k=0):
if not use_origin_backend(m):
if not isinstance(m, dparray):
pass
else:
return dpnp_tril(m, k)
return call_origin(numpy.tril, m, k) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _flatten_lower_triangle(matrix):\r\n matrix = asarray(matrix)\r\n flattened = []\r\n for col_num in range(matrix.shape[1]):\r\n for row_num in range(matrix.shape[0]):\r\n if col_num < row_num:\r\n flattened.append(matrix[row_num][col_num])\r\n return flattened",... | [
"0.64235985",
"0.5944943",
"0.57038736",
"0.56943643",
"0.56802785",
"0.56422",
"0.55943924",
"0.55646044",
"0.5559105",
"0.5503701",
"0.5501995",
"0.5478549",
"0.5470068",
"0.545127",
"0.54382837",
"0.5419458",
"0.53954506",
"0.53784263",
"0.529437",
"0.52922446",
"0.5290101... | 0.52403796 | 24 |
Upper triangle of an array. Return a copy of a matrix with the elements below the `k`th diagonal zeroed. | def triu(m, k=0):
if not use_origin_backend(m):
if not isinstance(m, dparray):
pass
else:
return dpnp_triu(m, k)
return call_origin(numpy.triu, m, k) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def upper(mat):\n idx = np.triu_indices_from(mat, k=1)\n return mat[idx]",
"def triu(m, k=0):\r\n m = asanyarray(m)\r\n out = multiply((1-tri(m.shape[0], m.shape[1], k-1, int)),m)\r\n return out",
"def triu(m, k=0):\r\n return m * (1 - tri(m.shape[0], m.shape[1], k=k - 1, dtype=m.dtype))",
... | [
"0.6907858",
"0.6527158",
"0.6457807",
"0.64184",
"0.5880043",
"0.5805424",
"0.5785068",
"0.57404685",
"0.57042366",
"0.5595596",
"0.55812186",
"0.54825515",
"0.5396265",
"0.53850406",
"0.5371528",
"0.53563875",
"0.5339802",
"0.5310752",
"0.5304313",
"0.5248321",
"0.5242928",... | 0.58758014 | 5 |
Return a new array of given shape and type, filled with zeros. | def zeros(shape, dtype=None, order='C'):
if (not use_origin_backend()):
if order not in ('C', 'c', None):
checker_throw_value_error("zeros", "order", order, 'C')
_dtype = dtype if dtype is not None else dpnp.float64
return dpnp_init_val(shape, _dtype, 0)
return numpy.zero... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def zeros(shape, dtype=None):\r\n if not isinstance(shape, (list, tuple, TensorVariable)):\r\n shape = [shape]\r\n if dtype is None:\r\n dtype = config.floatX\r\n return alloc(numpy.array(0, dtype=dtype), *shape)",
"def zeros(shape, dtype=None):\n\n return full(shape, 0, dtype)",
"def... | [
"0.8131912",
"0.79783493",
"0.78068864",
"0.78048074",
"0.76400965",
"0.7556793",
"0.7554755",
"0.7554755",
"0.7546917",
"0.7494887",
"0.7481222",
"0.736662",
"0.7350674",
"0.7350674",
"0.7322796",
"0.731645",
"0.73161584",
"0.7280919",
"0.72634774",
"0.7205132",
"0.7140093",... | 0.72090244 | 19 |
Return an array of zeros with the same shape and type as a given array. | def zeros_like(x1, dtype=None, order='C', subok=False, shape=None):
if (not use_origin_backend()):
if order not in ('C', 'c', None):
checker_throw_value_error("zeros_like", "order", order, 'C')
if subok is not False:
checker_throw_value_error("zeros_like", "subok", subok, Fa... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def zeros_like(a, dtype=None, order='K', subok=True, shape=None):\n\n res = np.full(a.shape, 0, dtype=a.dtype)\n return res",
"def zeros_numpy_array(self,\n type_name,\n as_matrix = True):\n if as_matrix:\n return np.zeros((1, self.get_max_id(type_name)... | [
"0.7240273",
"0.719332",
"0.71056986",
"0.7007097",
"0.6910075",
"0.69068336",
"0.6903947",
"0.6724198",
"0.67129827",
"0.6686719",
"0.6686719",
"0.66478217",
"0.6612979",
"0.659046",
"0.6562146",
"0.65475863",
"0.6545787",
"0.6545787",
"0.6529652",
"0.64970213",
"0.6461657",... | 0.56047153 | 90 |
Controller for the app home page. | def home(request):
# view_options = MVView(
# projection='EPSG:4326',
# center=[-70.6,18.75],
# zoom=8,
# maxZoom=18,
# minZoom=2
# )
#
# # Define GeoServer Layer
# ozama_layer = MVLayer(source='ImageWMS',
# options={'url': 'http:... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def home():\n payload = manager.get_payload()\n return render_template('index.html', payload=payload)",
"def home():\n\n\treturn render_template('index.html', title='Home Page',\n\t\t\t\t\t\t year=datetime.now().year)",
"def home(self, *args, **kwargs):\n pass",
"def home(request):\n\treturn r... | [
"0.78027886",
"0.7685395",
"0.7654384",
"0.7584396",
"0.7558254",
"0.7547364",
"0.7488385",
"0.7459023",
"0.7447416",
"0.73899287",
"0.7388719",
"0.7388719",
"0.7388719",
"0.7388719",
"0.7388719",
"0.7388719",
"0.7388719",
"0.7388719",
"0.7388719",
"0.7388719",
"0.7383182",
... | 0.0 | -1 |
Controller for the app home page. | def details(request):
context = {}
if request.GET['service'] == 'SFPT':
sfpt = request.GET['service']
comid = request.GET['comid']
watershed = request.GET['watershed']
subbasin = request.GET['subbasin']
# waterml_url = 'http://tethys.byu.edu/apps/streamflow-prediction-to... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def home():\n payload = manager.get_payload()\n return render_template('index.html', payload=payload)",
"def home():\n\n\treturn render_template('index.html', title='Home Page',\n\t\t\t\t\t\t year=datetime.now().year)",
"def home(self, *args, **kwargs):\n pass",
"def home(request):\n\treturn r... | [
"0.78027886",
"0.7685395",
"0.7654384",
"0.7584396",
"0.7558254",
"0.7547364",
"0.7488385",
"0.7459023",
"0.7447416",
"0.73899287",
"0.7388719",
"0.7388719",
"0.7388719",
"0.7388719",
"0.7388719",
"0.7388719",
"0.7388719",
"0.7388719",
"0.7388719",
"0.7388719",
"0.7383182",
... | 0.0 | -1 |
Controller for the app home page. | def compare(request):
context = {}
return render(request, 'glass/compare.html', context) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def home():\n payload = manager.get_payload()\n return render_template('index.html', payload=payload)",
"def home():\n\n\treturn render_template('index.html', title='Home Page',\n\t\t\t\t\t\t year=datetime.now().year)",
"def home(self, *args, **kwargs):\n pass",
"def home(request):\n\treturn r... | [
"0.7802778",
"0.7684692",
"0.76538134",
"0.7583557",
"0.7558266",
"0.7547231",
"0.7487806",
"0.7458415",
"0.74469894",
"0.7389957",
"0.73881954",
"0.73881954",
"0.73881954",
"0.73881954",
"0.73881954",
"0.73881954",
"0.73881954",
"0.73881954",
"0.73881954",
"0.73881954",
"0.7... | 0.0 | -1 |
Sets up the window. | def setupWindow(self):
self.main_menu_window = MenuFrame.MainMenuFrame(self.uiCoordinator)
self.menu_window = self.main_menu_window._mf
self.score_window = self.main_menu_window._hf
self.instructions_window = self.main_menu_window._if
self.menu_window.playButton.focus_set() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def init(self):\n sg.theme(gui.app_theme)\n self.window = sg.Window(\n gui.app_title,\n gui.create_layout(),\n **gui.window_config,\n )\n gui.after_window_init(self.window)",
"def setup(self):\n self.ui.setup_window()",
"def _prep_window(self,... | [
"0.7665967",
"0.7627792",
"0.7617336",
"0.7479128",
"0.73058194",
"0.7229077",
"0.7204013",
"0.70442086",
"0.7022998",
"0.6989601",
"0.6975299",
"0.696833",
"0.6957481",
"0.69455737",
"0.69377846",
"0.69058204",
"0.69055146",
"0.6877412",
"0.6853405",
"0.68482393",
"0.6836692... | 0.8066444 | 0 |
Constructor for LinearInversion class object. No parameters are given. Necessary information from the estimator class is provided later in the execution by QST_sim. | def __init__(self,
Method = KMeans(),
data = pd.DataFrame(),
orig_data = pd.DataFrame(),
log = None,
test_name = "",
random_state = 42):
#Date and time metadata
self.execution_date_start = dt.datetime.now().date()
self.execution_time_start = dt.datetime.now().time().strftime("%H.%M.... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self):\n self.svclassifier = SVC(kernel='linear')",
"def __init__(self):\n super().__init__()\n import sklearn\n import sklearn.svm\n self.model = sklearn.svm.LinearSVR",
"def __init__(self, prior=None, priorCov=None, \n otherModelParam=None, parameterNames=None,... | [
"0.6703835",
"0.64769787",
"0.6456331",
"0.6385159",
"0.6371695",
"0.6365223",
"0.6316117",
"0.63004327",
"0.6289534",
"0.62886566",
"0.62206906",
"0.61805505",
"0.6168407",
"0.6128198",
"0.6121836",
"0.6117296",
"0.6109903",
"0.61048406",
"0.60999364",
"0.60855484",
"0.60779... | 0.0 | -1 |
Hides gui elements used by module | def hide_gui():
pass | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def hide_main_buttons(self):\n pass",
"def hide_control_buttons(self):\n self.settings_button.hide()\n self.radio_button.hide()\n self.blank_button.hide()\n self.close_button.hide()",
"def hide(self):\n self.visible = False",
"def hide(self):\n self.set_visibl... | [
"0.7642297",
"0.7346581",
"0.7206903",
"0.6980509",
"0.6925308",
"0.6915459",
"0.68977",
"0.68860835",
"0.6851958",
"0.6843111",
"0.6799772",
"0.67997164",
"0.67693883",
"0.6765483",
"0.67545617",
"0.6733422",
"0.6702172",
"0.665799",
"0.66544116",
"0.6636092",
"0.6636092",
... | 0.8359815 | 0 |
Write df into a csv. | def info2csv(df, csv_path):
df.to_csv(csv_path, index=False) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def export_csv(self, df, filename):\n df.to_csv(str(pathlib.PurePosixPath(self.config.csv_path, filename)) , sep=\";\")",
"def write_csv(df: pd.DataFrame, outpath) -> None:\n logging.info('Writing detection records to disk')\n outdir = os.path.split(outpath)[0]\n if not os.path.exists(outdir):\n ... | [
"0.80664265",
"0.80145097",
"0.801394",
"0.79689276",
"0.7958326",
"0.79482055",
"0.79462165",
"0.7931126",
"0.78056055",
"0.7790553",
"0.7750548",
"0.7688046",
"0.76493216",
"0.76435524",
"0.761207",
"0.7597861",
"0.75399405",
"0.74951",
"0.7461018",
"0.7433713",
"0.7390849"... | 0.8062164 | 1 |
Yield successive nsized chunks from l. | def chunks(l, n):
for i in xrange(0, len(l), n):
yield l[i:i + n] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _chunk(self, l, n):\n for i in range(0, len(l) + 1, n):\n yield l[i:i + n]",
"def chunks(self, l, n):\n for i in range(0, len(l), n):\n yield l[i:i + n]",
"def __chunks(l, n):\n for i in range(0, len(l), n):\n yield l[i:i + n]",
"def get_chunks(self, ... | [
"0.8038813",
"0.79248375",
"0.7923423",
"0.7885103",
"0.78773195",
"0.7815877",
"0.77655786",
"0.77556044",
"0.77441615",
"0.7731815",
"0.77288336",
"0.772473",
"0.77028215",
"0.76889825",
"0.76889825",
"0.7664208",
"0.76570904",
"0.7655856",
"0.7655856",
"0.76458347",
"0.764... | 0.0 | -1 |
Randomly swaps characters in the string for numerals or symbols. | def random_characters(alpha, numeric_percent_chance=20):
random.seed()
string_length = len(alpha)
alphanumeric = ''
for i in range(0, string_length):
check_int = random.randrange(1, 100)
if check_int <= numeric_percent_chance:
alphanumeric += str(alpha_to_leet(alpha[i]))
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def symbol(string: str) -> str:\n L = len(string)\n P1 = random.randint(1, L-1, 2)\n chars = []\n for char in string:\n chars.append(char)\n chars[P1[0]] = chars[P1[0]].upper()\n chars[P1[1]] = chars[P1[1]].upper()\n return ''.join(x for x in chars if x.isupper())+str(random.randint(9))... | [
"0.6684227",
"0.64242613",
"0.64139056",
"0.6150068",
"0.6150068",
"0.61422855",
"0.61030513",
"0.61030513",
"0.61030513",
"0.61030513",
"0.61030513",
"0.61030513",
"0.60681885",
"0.60480404",
"0.6044008",
"0.59968555",
"0.59741205",
"0.5932429",
"0.5909917",
"0.59080154",
"0... | 0.5278138 | 92 |
Test update network (internal ports). | def test_update_network(self):
policies_ports = [
(None, {self.ports[0].id}),
(self.qos_policies[1].id, {self.ports[0].id})]
self.ports[1].qos_policy_id = self.qos_policies[0].id
self.ports[1].update()
self.ports[2].qos_policy_id = self.qos_policies[1].id
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_networking_project_network_update(self):\n pass",
"def test_update_port_group(self):\n pass",
"def test_update_network_external_ports(self):\n policies_ports = [(self.qos_policies[0].id, {self.ports[0].id})]\n self.ports[2].qos_policy_id = self.qos_policies[0].id\n s... | [
"0.7940934",
"0.7143115",
"0.6999837",
"0.6794717",
"0.6779046",
"0.6689829",
"0.66428334",
"0.659319",
"0.6557386",
"0.65162975",
"0.64424074",
"0.6342818",
"0.63309616",
"0.6292912",
"0.6269581",
"0.6269581",
"0.6220449",
"0.6211633",
"0.6191565",
"0.6161723",
"0.6140189",
... | 0.6978707 | 3 |
Constructor. Any message fields that are implicitly/explicitly set to None will be assigned a default value. The recommend use is keyword arguments as this is more robust to future message changes. You cannot mix inorder arguments and keyword arguments. | def __init__(self, *args, **kwds):
if args or kwds:
super(RotationMatrix, self).__init__(*args, **kwds)
#message fields cannot be None, assign default values for those that are
if self.c0 is None:
self.c0 = bh_motion.msg.Vector3()
if self.c1 is None:
self.c1 = bh_motion.msg.V... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self, *args, **kwds):\n if args or kwds:\n super(KomodoSpeechRecCommand, self).__init__(*args, **kwds)\n #message fields cannot be None, assign default values for those that are\n if self.header is None:\n self.header = std_msgs.msg.Header()\n if self.cmd is None:\n ... | [
"0.77940345",
"0.77196896",
"0.77196896",
"0.7685901",
"0.76253456",
"0.75629234",
"0.7438996",
"0.74165684",
"0.73517054",
"0.73081905",
"0.7280219",
"0.7237793",
"0.7226802",
"0.7223405",
"0.7223405",
"0.7218974",
"0.72109884",
"0.72109884",
"0.72109884",
"0.72109884",
"0.7... | 0.65087 | 94 |
Returns whether the board is solved (that is, if it's all 1 or all 0). | def solved(self):
return all(cell == 1 for row in self.faces for cell in row) or all(cell == 0 for row in self.faces for cell in row) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_solved(self):\n # Iterate through each square of the puzzle\n for row in range(self.sl):\n for col in range(self.sl):\n val = self.puzzle[row][col]\n\n # If any square value is blank (0), not solved, return False\n if val == 0:\n ... | [
"0.77699095",
"0.7750373",
"0.7519931",
"0.7304707",
"0.719987",
"0.71700114",
"0.7123969",
"0.71055114",
"0.70970124",
"0.70700324",
"0.7052249",
"0.7035469",
"0.698862",
"0.698862",
"0.698862",
"0.6946682",
"0.69245464",
"0.6906491",
"0.6871175",
"0.6862633",
"0.6856468",
... | 0.71081436 | 7 |
Like get_object_or_404; raises Http404 if the document doesn't exist. | def get_document_or_404(id, db=None):
try:
return dbs[DEFAULT_DATABASE if db is None else db][id]
except ResourceNotFound:
raise Http404 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_document(obj):\n try:\n return ES.get(\n index=obj.get_index_name(), doc_type=obj.get_document_type(), id=obj.pk)\n except NotFoundError:\n raise DocumentNotFound(obj.get_index_name(), obj.pk)",
"def _get_object(cls, pk):\n kwargs = {}\n try:\n kwar... | [
"0.7184569",
"0.711844",
"0.68922645",
"0.6866734",
"0.68638253",
"0.678791",
"0.6745679",
"0.6737253",
"0.6649503",
"0.66476244",
"0.6609407",
"0.65771616",
"0.65397424",
"0.6528997",
"0.6510462",
"0.6497082",
"0.6494874",
"0.64909315",
"0.64879817",
"0.6460864",
"0.6460018"... | 0.76484007 | 0 |
Check all possible move states at this layer | def check_move_states(self, player, depth):
if depth >= self.look_ahead:
return True
for move in gen_moves(player, self.__state.board, self.checker):
self.__state.push(move)
winner = self.checker.check_game_over(self.__pid, self.__opponent)
if winner == ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def actions(self, state):\n MovementList = []\n #Check if the agent is able to move a box (Left, Down, Right, Up) \n #without moving it into a taboo cell or pushing two blocks (Invalid move)\n #then move the box in the given direction.\n \n possible_moves = [\"Up\", \"Down... | [
"0.6637317",
"0.64514494",
"0.64392143",
"0.642233",
"0.64209664",
"0.6394566",
"0.6386073",
"0.6350871",
"0.6349435",
"0.6333141",
"0.628325",
"0.6263108",
"0.62322396",
"0.62282586",
"0.62272406",
"0.6221632",
"0.61994255",
"0.6170565",
"0.6167391",
"0.6148329",
"0.61382335... | 0.7412377 | 0 |
Gets the player that does not belong to this strategy | def get_opponent(self):
for cell in self.__state.board.find_workers():
player = self.__state.board.get_player_id(cell[0], cell[1])
if not player == self.__pid:
return player | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def nobody(self):\r\n\t\treturn self._mk_store.fetchObjectsOfClass(Player, clauses=\"WHERE gameId = %d AND name = 'Nobody'\" % self.sqlObjRef())[0]",
"def get_player(self):\n return self.player",
"def get_player(self):\n return self.player",
"def get_player(self):\r\n return self.player_... | [
"0.7483229",
"0.71971536",
"0.71971536",
"0.7170127",
"0.715027",
"0.71267444",
"0.7120115",
"0.7119901",
"0.71041924",
"0.70467055",
"0.69910794",
"0.6982988",
"0.69706404",
"0.69476706",
"0.6882123",
"0.6858406",
"0.68208426",
"0.6810177",
"0.6806408",
"0.6772435",
"0.67394... | 0.70592153 | 9 |
Compute randomized exponential backoff time. | def backoff_time(attempt, retry_backoff=2., max_delay=30.):
delay = retry_backoff * (2 ** attempt)
# Add +-25% of variation.
delay += delay * ((random.random() - 0.5) / 2.)
return min(delay, max_delay) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def exponential_backoff(max_tries, max_sleep=20):\n return [random.random() * min(max_sleep, (2**i - 1)) for i in range(0, max_tries)]",
"def determine_sleep_times(self):\n\n determined_sleep_time = \\\n random.randrange(self.dns_conf.min_backoff_range,\n self.dns... | [
"0.73010194",
"0.70438355",
"0.69500506",
"0.6661864",
"0.6570471",
"0.6499759",
"0.64479285",
"0.6343534",
"0.6308421",
"0.61899376",
"0.6181961",
"0.61584944",
"0.61288697",
"0.61236227",
"0.61083555",
"0.6076508",
"0.601605",
"0.5973975",
"0.5965837",
"0.5945177",
"0.59125... | 0.78628784 | 0 |
Returns a transformed, triangulated copy of the mesh | def bmesh_copy_from_object(obj, transform=True, triangulate=True, apply_modifiers=False):
assert obj.type == 'MESH'
if apply_modifiers and obj.modifiers:
import bpy
depsgraph = bpy.context.evaluated_depsgraph_get()
obj_eval = obj.evaluated_get(depsgraph)
me = obj_eval.to_mesh()... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def tessellation(mesh):\n # create random barycentric coordinates for each face\n # pad all coordinates by a small amount to bias new vertex towards center\n barycentric = np.random.random(mesh.faces.shape) + .05\n barycentric /= barycentric.sum(axis=1).reshape((-1, 1))\n\n # create one new vertex s... | [
"0.687218",
"0.6795408",
"0.6745115",
"0.6694022",
"0.6401622",
"0.636739",
"0.6258048",
"0.62193716",
"0.61639184",
"0.6146079",
"0.60792005",
"0.6066429",
"0.6008241",
"0.5984576",
"0.5925035",
"0.5894166",
"0.587454",
"0.587454",
"0.587454",
"0.587454",
"0.5869391",
"0.5... | 0.5262079 | 71 |
Set global test logging levels. | def caplog(caplog):
caplog.set_level(logging.DEBUG)
logging.getLogger('asyncio').setLevel(logging.WARNING)
return caplog | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def testLoggerLevels(self):\n logging = Logger()\n for level in range(len(logging.LEVELS)):\n testString = \"Test logging level\"\n logging.setLogLevel(level)\n logging.log(level, testString)",
"def _setup_log_levels(self):\n for logger_name, level in self.na... | [
"0.79479486",
"0.77229106",
"0.7601453",
"0.74785763",
"0.7106215",
"0.6968415",
"0.6953537",
"0.6941021",
"0.69180584",
"0.6899758",
"0.68975097",
"0.68599075",
"0.68525106",
"0.68089944",
"0.67831457",
"0.6778602",
"0.67571586",
"0.67517066",
"0.67382205",
"0.6737083",
"0.6... | 0.0 | -1 |
test to see if the url passed in is invalid and will raise ValueError if it is invalid for url_to_csv function | def test_invalid_url(self):
cwd=os.getcwd()
invalid_url = "http://golakjsd.com/jl2kais"
with self.assertRaises(ValueError):
requester.url_to_csv(invalid_url,"{0}/{1}.csv".format(cwd,'test')) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_valid_url(self):\n\n cwd=os.getcwd()\n url = [\"http://archive.ics.uci.edu/ml/machine-learning-databases/wine/wine.data\",\n \"http://stackoverflow.com/questions/17730173/python-cant-get-full-path-name-of-file\",\n \"http://archive.ics.uci.edu/ml/machine-learning... | [
"0.6987586",
"0.69874334",
"0.6866893",
"0.64617145",
"0.633423",
"0.63291466",
"0.6321257",
"0.6264188",
"0.62511677",
"0.6249029",
"0.61909074",
"0.6154695",
"0.6153813",
"0.6114938",
"0.610854",
"0.6043001",
"0.6037998",
"0.60368925",
"0.5930689",
"0.5925613",
"0.5921682",... | 0.7971575 | 0 |
Modify the underlying BatchSampler of a constructed DataLoader to account for repeating on training datasets, skipping when continuing training, and sharding for distributed training. | def adapt_batch_sampler(
batch_sampler: torch.utils.data.BatchSampler,
repeat: bool = False,
skip: int = 0,
num_replicas: int = 1,
rank: int = 0,
) -> torch.utils.data.BatchSampler:
if repeat:
batch_sampler = samplers.RepeatBatchSampler(batch_sampler)
if num_replicas > 1:
ba... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def train_dataloader(self) -> data.DataLoader:\n # Random weighted sampler to approach the imbalanced dataset\n self.weights = [1.0 / i for i in self.weights]\n\n _sample_weights = [0] * len(self.datasets['train'])\n\n for idx, (_, label) in enumerate(self.datasets['train']):\n ... | [
"0.66805154",
"0.6514866",
"0.6480717",
"0.62824374",
"0.6247941",
"0.6231324",
"0.58929443",
"0.5891505",
"0.58887243",
"0.5885818",
"0.58745694",
"0.58719486",
"0.58703846",
"0.5867539",
"0.5859894",
"0.58563536",
"0.5800004",
"0.57953495",
"0.5793813",
"0.5775735",
"0.5761... | 0.628639 | 3 |
Calculate length of data input. Accepts np.ndarray, torch.tensor, dictionary, or list. Recursively traverses the tree to find the first np.ndarray or torch.Tensor and calculates the length of it. Assumes that every "leaf" of the data structure is batched to the same length. | def data_length(data: _Data) -> int:
if isinstance(data, (np.ndarray, torch.Tensor)):
return len(data)
if isinstance(data, dict):
if len(data) == 0:
raise ValueError(
"`PyTorchTrial` must have at least one `np.ndarray` or `torch.Tensor` in it's dict "
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def tensor_length(data):\n if hasattr(data, \"shape\"):\n return data.shape[0]\n else:\n try:\n length = len(data)\n except TypeError:\n length = 0\n return length",
"def __len__(self):\n return len(self.subtrees())",
"def length_func(list_or_tensor):\... | [
"0.6534819",
"0.64410913",
"0.634633",
"0.6271944",
"0.6265529",
"0.62175536",
"0.6137983",
"0.61371493",
"0.6124098",
"0.611869",
"0.6106332",
"0.60992575",
"0.6088226",
"0.6087928",
"0.6075616",
"0.60575134",
"0.6026744",
"0.6013751",
"0.60133195",
"0.59954953",
"0.5989629"... | 0.65432084 | 0 |
Sequentially pass `x` trough model`s `encoder` and `decoder` (return logits!) | def forward(self, x):
x = self.encoder(x)
x = self.decoder(x)
x = self.upsample(x)
return x | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def forward(self, x):\n if self.training:\n x = self.input_pert(x)\n x = self.encoder(x)\n x = self.decoder(x)\n return x",
"def forward(self, x):\n\n # Encoding path\n x1 = self.ins(x)\n\n # Apply Downsampling and encoding modules\n x2 = self.ds... | [
"0.72372735",
"0.7026445",
"0.6957911",
"0.6908719",
"0.6896771",
"0.6896771",
"0.68776786",
"0.6862132",
"0.681876",
"0.66641396",
"0.6644882",
"0.66277975",
"0.6615218",
"0.65477246",
"0.64433306",
"0.6436389",
"0.63802385",
"0.6358512",
"0.6333469",
"0.6326088",
"0.6308258... | 0.6763464 | 9 |
\ Returns the language is by the article or the configuration language | def get_language(self, article):
# we don't want to force the target laguage
# so we use the article.meta_lang
if self.config.use_meta_language == True:
if article.meta_lang:
self.language = article.meta_lang[:2]
self.language = self.config.target_langua... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_language(self, article):\r\n # we don't want to force the target laguage\r\n # so we use the article.meta_lang\r\n if self.config.use_meta_language == True:\r\n if article.meta_lang:\r\n return article.meta_lang[:2]\r\n return self.config.target_languag... | [
"0.82171386",
"0.76031065",
"0.7544607",
"0.74968356",
"0.7455212",
"0.74412215",
"0.74357057",
"0.73776776",
"0.735794",
"0.7327514",
"0.7290627",
"0.72882414",
"0.7286098",
"0.72593",
"0.7252499",
"0.7244828",
"0.72102225",
"0.72035223",
"0.71289045",
"0.71128196",
"0.70858... | 0.7863248 | 1 |
\ returns the gravityScore as an integer from this node | def get_score(self, node):
return self.get_node_gravity_score(node) or 0 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getScore(self, node):\n return self.getGravityScoreFromNode(node) or 0",
"def get_score(self, node):\n return self.get_node_gravity_score(node) or 0",
"def get_g_score(self):\n return self._g_score",
"def g_score(self):\n _, _, I_CK = self._entropies()\n return 2.0 * I_... | [
"0.77913153",
"0.775516",
"0.75764555",
"0.7212847",
"0.6677891",
"0.65955544",
"0.6491808",
"0.6491808",
"0.6491808",
"0.6487083",
"0.64795065",
"0.64795065",
"0.64795065",
"0.6427184",
"0.6356154",
"0.6343587",
"0.6275718",
"0.6260728",
"0.6199329",
"0.61702836",
"0.6159882... | 0.778533 | 1 |
\ Returns the language is by the article or the configuration language | def get_language(self, article):
# we don't want to force the target laguage
# so we use the article.meta_lang
if self.config.use_meta_language == True:
if article.meta_lang:
return article.meta_lang[:2]
return self.config.target_language | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_language(self, article):\r\n # we don't want to force the target laguage\r\n # so we use the article.meta_lang\r\n if self.config.use_meta_language == True:\r\n if article.meta_lang:\r\n self.language = article.meta_lang[:2]\r\n self.language = self.con... | [
"0.7864048",
"0.7605071",
"0.75471526",
"0.74992",
"0.7457036",
"0.7443881",
"0.7437974",
"0.7377118",
"0.7360863",
"0.7327078",
"0.7293166",
"0.72905964",
"0.72862476",
"0.7261888",
"0.72552127",
"0.72477865",
"0.7212995",
"0.72046363",
"0.7132223",
"0.71148205",
"0.70884985... | 0.82182664 | 0 |
\ remove paragraphs that have less than x number of words, would indicate that it's some sort of link | def remove_fewwords_paragraphs(self, article):
all_nodes = self.parser.getElementsByTags(self.get_top_node(), ['*'])
all_nodes.reverse()
for el in all_nodes:
tag = self.parser.getTag(el)
text = self.parser.getText(el)
stop_words = self.stopwords_class(la... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def extract_clean_words(para):\n paras = para.split()\n noise = [\"http\",\"apnews\",\"news\",\"link\",\"subscribe\",\"dc\",\"d\",\"c\",\"s\"]\n for x in noise:\n if x in para.split():\n paras.remove(x)\n \n\n if (len(paras) <= 300) & (len(paras) >= 200):\n words_hundred = \"... | [
"0.7330297",
"0.676273",
"0.64125234",
"0.61397237",
"0.612901",
"0.61071134",
"0.6091951",
"0.5972623",
"0.59672314",
"0.5963983",
"0.59182465",
"0.5917012",
"0.5911385",
"0.590614",
"0.5897146",
"0.5889602",
"0.58810407",
"0.58772284",
"0.58586115",
"0.5835214",
"0.58273435... | 0.70342183 | 1 |
Calculate the yoffset where we are going to crop the image in the target size | def calculate_y_crop_offset(self):
if self.game_name:
playing_section = PlayingArea[self.game_name]
else:
playing_section = 'bottom'
pre_crop_height = int(round(float(IMAGE_HEIGHT) * CROPPED_SIZE / IMAGE_WIDTH))
shrink_factor = float(CROPPED_SIZE) / IMAGE_WIDTH
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def img_offset_Y(img, offset_Y):\n offset_Y = int(offset_Y)\n (axe_X, axe_Y) = img.size\n\n while offset_Y >= axe_Y:\n offset_Y -= axe_Y\n\n if offset_Y == 0:\n return img\n\n if offset_Y < 0:\n offset_Y = -offset_Y\n img_top = img.crop((0, 0, axe_X, axe_Y-offset_Y))\n ... | [
"0.70029473",
"0.61458325",
"0.6136008",
"0.61246526",
"0.6105685",
"0.60266834",
"0.5987012",
"0.59079987",
"0.5876334",
"0.58710396",
"0.5816628",
"0.58047926",
"0.5781974",
"0.57055366",
"0.5682223",
"0.56777215",
"0.5672189",
"0.5666247",
"0.56642604",
"0.56561214",
"0.55... | 0.7688611 | 0 |
Append item in the tail of the list | def append(self, item):
tmpNode = Node(item)
self.tail.next = tmpNode
self.tail = tmpNode
self._size += 1 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_last(self, e):\n self._insert_between(e, self._tail._prev, self._tail)",
"def addAtTail(self, val):\n curr = self.head\n while curr.next:\n curr = curr.next\n new_node = ListNode(val)\n curr.next = new_node\n self.length += 1",
"def add_to_tail(self,... | [
"0.7184297",
"0.71468544",
"0.7144765",
"0.7140519",
"0.714028",
"0.7138115",
"0.7097806",
"0.70973325",
"0.70714414",
"0.7069349",
"0.7069349",
"0.70681745",
"0.70363647",
"0.70354486",
"0.6993804",
"0.69825906",
"0.69670683",
"0.6953256",
"0.6947165",
"0.69461894",
"0.69210... | 0.7220398 | 0 |
Append item in the front of the list | def appendleft(self, item):
tmpNode = Node(item, self.head.next)
self.head.next = tmpNode
self._size += 1 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def push(self, item):\n self.list.prepend(item)",
"def add_front(self, item):\n\n self.items.insert(0, item)",
"def push(self, item):\n self.linked_list.prepend(item)",
"def prepend(self, item: Any):\n self.insert(0, item)",
"def push(self, item):\n super().add_item_to_fr... | [
"0.81981677",
"0.8048951",
"0.7837136",
"0.77097505",
"0.76664424",
"0.75545466",
"0.7305748",
"0.7215502",
"0.7073798",
"0.7034803",
"0.69960856",
"0.68615043",
"0.6850212",
"0.67911243",
"0.6755428",
"0.67493725",
"0.6715419",
"0.67109805",
"0.67109203",
"0.6698728",
"0.667... | 0.64519066 | 32 |
Creates and saves a superuser with the given username, name and password | def create_superuser(self, username, name, user_type, password=None):
user = self.create_user(
username,
name=name,
user_type=user_type,
password=password,
)
user.save(using=self._db)
return user | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _create_superuser(username, email, password):\n if username and email and password:\n user, created = User.objects.get_or_create(pk=defaults.USERWARE_SUPERUSER_ID)\n if user:\n user.username = username\n user.email = email\n user.set_password(password)\n ... | [
"0.81242025",
"0.8094643",
"0.7971723",
"0.79640764",
"0.7949633",
"0.7908926",
"0.7907073",
"0.79014647",
"0.78845364",
"0.7882977",
"0.78821033",
"0.7873543",
"0.7873481",
"0.7867323",
"0.7850911",
"0.7843041",
"0.78407556",
"0.780608",
"0.7791247",
"0.77742785",
"0.7758922... | 0.7651629 | 35 |
Attempt to get the most generic type possible. If the passed object is an instance of a builtin type, then a simple dictionary lookup is performed, otherwise, | def _get_generic_type(obj, generics=_generic_types,
known_to_generics=_builtin_to_generic,
**kwargs
):
if type(obj) in known_to_generics:
return known_to_generics[type(obj)]
return next(filter(lambda g: isinstance(obj, g), generics), None... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def kind_of(obj):\n # why don't I use isinstance - it saves us big time\n\n # dict, list, and tuple are differianted from str, unicode, int, bool, and float\n # because they have special treatment and simple `==` or `is` is not enough to\n # prove them valid.\n obj_type = type(obj)\n if obj_type ... | [
"0.6700823",
"0.64753866",
"0.64738065",
"0.63616633",
"0.6276713",
"0.6257347",
"0.6257347",
"0.6225037",
"0.6142773",
"0.605357",
"0.60284644",
"0.6022668",
"0.6012485",
"0.5972029",
"0.59307724",
"0.5885236",
"0.5874012",
"0.5835394",
"0.5791402",
"0.57912683",
"0.5787974"... | 0.7588837 | 0 |
Attempts to determine if an object is a monoid or not. When in doubt, this function returns false. For example, even though get_generic_mappend can derive a generic mappend for decimal.Decimal (it is, after all, a "subclass" of numbers.Number), there's not a hardcoded mempty for it despite that it would be ``decimal.De... | def is_monoid(obj,
monoid_attrs=_monoidal_attrs,
generics=_generic_types,
known_to_generics=_builtin_to_generic,
known_mempties=_generic_mempties,
known_mappends=_generic_mappends,
**kwargs):
if isinstance(obj, Monoid) or all(hasatt... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def mmo_is_mongod(self, mmo_connection):\n return True if self.mmo_what_process_am_i(mmo_connection) == \"mongod\" else False",
"def is_MatrixMorphism(x):\n return isinstance(x, MatrixMorphism_abstract)",
"def get_generic_mempty(obj, known_mempties=_generic_mempties, **kwargs):\n generic = _get_ge... | [
"0.5477418",
"0.54099274",
"0.5372653",
"0.5201036",
"0.50972944",
"0.5045713",
"0.48548755",
"0.46736905",
"0.45769912",
"0.45726633",
"0.45716193",
"0.45332",
"0.45195365",
"0.45190558",
"0.44811985",
"0.447606",
"0.447606",
"0.4433977",
"0.44301918",
"0.4413528",
"0.441168... | 0.79882103 | 0 |
Get the available config values. | def requested_config_vals():
return {} # no extra values needed | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def antenny_config_print_values(self):\n return self.antenny_config.print_values()",
"def getConfigAll(self):\n return self.configAll(False)",
"def config_variables(self) -> Sequence['outputs.ConfigVariableResponse']:\n return pulumi.get(self, \"config_variables\")",
"def _get_config_dict():... | [
"0.69862324",
"0.69531953",
"0.68963856",
"0.6884134",
"0.68837583",
"0.6868101",
"0.68581367",
"0.68497646",
"0.68465704",
"0.6775728",
"0.67490745",
"0.66967213",
"0.66813153",
"0.66158193",
"0.6584016",
"0.6560323",
"0.65493625",
"0.6537291",
"0.65323627",
"0.6506974",
"0.... | 0.74565506 | 0 |
returns true if n has a prime factor p or greater | def prime_test(n,p):
for i in range(2, p):
thing = 1
while thing == 1:
if n % i == 0:
n = n/i
else:
thing = 0
if n == 1:
return False
return True | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_prime(n):\n return mr_prime(n)",
"def if_prime(cls, n):\n\n if (n <= 1):\n return False\n if (n <= 3):\n return True\n\n if (n % 2 == 0 or n % 3 == 0):\n return False\n\n i = 5\n while(i * i <= n):\n if (n % i == 0 or n % (i... | [
"0.79170686",
"0.78996104",
"0.78959936",
"0.7887925",
"0.7887925",
"0.7885708",
"0.7885708",
"0.78803754",
"0.78738",
"0.7840456",
"0.7821573",
"0.7762962",
"0.77574396",
"0.7722426",
"0.7716251",
"0.77100843",
"0.7682678",
"0.7664879",
"0.7651795",
"0.76422703",
"0.76275325... | 0.7625604 | 22 |
simple conversion of dictionary to dataframe This converts the dictionary resulting from create_dict_from_filename" into a pd.DataFrame with the time ID for each measurement as the Index and the values of X, Y, and Z as each column respectively | def convert_measuerment_dict_to_DataFrame(measurement_dict):
df = pd.DataFrame.from_dict(measurement_dict, orient='index')
return(df) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_dataframe(self, dictionary_to_convert, cols):\n\n dataframe_converted = pd.DataFrame.from_dict(dictionary_to_convert, orient='index', columns = cols)\n dataframe_converted = dataframe_converted.reset_index()\n dataframe_converted = dataframe_converted.drop(columns=['index'])\n\n return dataf... | [
"0.710465",
"0.70929456",
"0.66079915",
"0.6399342",
"0.6350793",
"0.6344947",
"0.6344892",
"0.6286799",
"0.6229387",
"0.618064",
"0.61633635",
"0.61167806",
"0.60893965",
"0.6046768",
"0.6015972",
"0.601427",
"0.6007603",
"0.6003018",
"0.60007757",
"0.5997507",
"0.59716094",... | 0.7765077 | 0 |
This plots a line plot of the columns of a DataFrame with up to 4 columns. You can indicate exactly which columns you want to plot as well as the start and end points of each plot in the case you want to show a smaller slice of the dataframe. | def plot_data(DataFrame, title, ps, pe, columns: list):
ax = plt.gca()
idx = 0
colors = ['blue', 'red', 'green', 'black']
plot_titles = title.split('/')
plot_title = plot_titles[1]
for c in columns:
DataFrame[ps:pe].plot(kind='line',y=c, color=colors[idx], ax=ax, fontsize=4, title=... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def plot_selected(df, columns, start_index, end_index):\n # TODO: Your code here\n # Note: DO NOT modify anything else!\n \n df.ix[start_index:end_index]\n df = df[columns]\n df.plot()\n plt.show",
"def plot_selected(df, columns, start_index, end_index):\r\n plot_data(df.ix[start_index:en... | [
"0.7598337",
"0.6976916",
"0.68573505",
"0.6715066",
"0.65192324",
"0.64587545",
"0.64341193",
"0.639797",
"0.63751626",
"0.6351498",
"0.6292224",
"0.6283977",
"0.62566316",
"0.6256168",
"0.61938983",
"0.6139497",
"0.60640043",
"0.6010925",
"0.59825546",
"0.5863744",
"0.58482... | 0.6470724 | 5 |
This plots a line plot of the columns of a DataFrame with up to 4 columns. You can indicate exactly which columns you want to plot as well as the start and end points of each plot in the case you want to show a smaller slice of the DataFrame. | def plot_single_data(DataFrame, title, ps, pe, columns: list, color):
ax = plt.gca()
plot_titles = title.split('/')
plot_title = plot_titles[1]
DataFrame[ps:pe].plot(kind='line',y=columns[0], color=color, ax=ax, fontsize=4, title=plot_title)
plt.savefig('{}.jpg'.format(title))
plt.show() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def plot_selected(df, columns, start_index, end_index):\n # TODO: Your code here\n # Note: DO NOT modify anything else!\n \n df.ix[start_index:end_index]\n df = df[columns]\n df.plot()\n plt.show",
"def plot_selected(df, columns, start_index, end_index):\r\n plot_data(df.ix[start_index:en... | [
"0.7525062",
"0.6913696",
"0.6841702",
"0.6711321",
"0.64948446",
"0.6453984",
"0.6422682",
"0.637503",
"0.6368644",
"0.629685",
"0.6281496",
"0.6260179",
"0.6239274",
"0.6196695",
"0.6190957",
"0.61106443",
"0.6016373",
"0.5981543",
"0.5952414",
"0.5833942",
"0.5801635",
"... | 0.6385316 | 7 |
The file name of the file the tab ownes | def visible_name(self):
return self._visible_name | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_file_name(self):\n return str(self.get_file())",
"def getCurrentFileName(self):\n return os.path.basename(self.filePath)",
"def file_name(self):\n return self.__file_name",
"def file_name(self):\n return self._file_name",
"def file_name(self):\n return self._file_... | [
"0.76357776",
"0.761678",
"0.75926757",
"0.74534404",
"0.74534404",
"0.74534404",
"0.74534404",
"0.74534404",
"0.74130446",
"0.7405495",
"0.7370711",
"0.73574215",
"0.73574215",
"0.73525375",
"0.73348695",
"0.7310667",
"0.7300708",
"0.7267977",
"0.722178",
"0.7162304",
"0.715... | 0.0 | -1 |
Find the parameters of the points on a plane. | def invert_points_on_plane(pnts, plane):
ptol = Settings.ptol
vu = plane.vu.ijk
vv = plane.vv.ijk
p0 = plane.p0.xyz
vu2 = dot(vu, vu)
vv2 = dot(vv, vv)
pnts = array(pnts, dtype=float64)
npts = pnts.shape[0]
params = zeros((npts, 2), dtype=float64)
for i in range(0, npts):
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def plane(self):\r\n from lsst.analysis import utils\r\n return utils.fitplane(self.points, self.z)",
"def planeFit(self, points):\n pointsP = points\n points = np.array(points).transpose()\n points = np.reshape(points, (np.shape(points)[0], -1)) # Collapse trialing dimensions\... | [
"0.72151744",
"0.6699437",
"0.66616714",
"0.663065",
"0.65603906",
"0.65408266",
"0.64635974",
"0.6392535",
"0.6379527",
"0.6346996",
"0.633491",
"0.62803054",
"0.6228218",
"0.6192191",
"0.61459285",
"0.612026",
"0.608484",
"0.6081105",
"0.60680145",
"0.60680145",
"0.60618544... | 0.5801863 | 36 |
Return the latest bar data of the given symbol | def get_latest_bar(self, symbol):
raise NotImplementedError("Should implement get_latest_bar()") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_latest_bar(self, symbol):\n try:\n bars_list = self.latest_symbol_data[symbol]\n except KeyError:\n print(\"That symbol is not available in the historical data\")\n raise\n else:\n return bars_list[-1]",
"def get_latest_bar_close(self, symb... | [
"0.8289707",
"0.7741076",
"0.7527743",
"0.75229573",
"0.74947923",
"0.7397786",
"0.72648257",
"0.7107647",
"0.70805585",
"0.6983474",
"0.6605424",
"0.65917534",
"0.6469904",
"0.63083875",
"0.6293245",
"0.6222976",
"0.6164951",
"0.6094988",
"0.6056787",
"0.6053128",
"0.601474"... | 0.8587069 | 0 |
Return the latest bar data type of given symbol. | def get_latest_bar_value(self, symbol, val_type):
raise NotImplementedError("Should implement get_latest_bar_value()") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_latest_bar_value(self, symbol, val_type):\n try:\n bars_list = self.latest_symbol_data[symbol]\n except KeyError:\n print(\"That Symbol is not available in the historical data\")\n raise\n else:\n return getattr(bars_list[-1][1], val_type)",
... | [
"0.77291864",
"0.7655375",
"0.7288055",
"0.72558254",
"0.69452786",
"0.68888795",
"0.64372",
"0.6192996",
"0.61455023",
"0.6073669",
"0.5985562",
"0.5881797",
"0.58160275",
"0.5754493",
"0.5707582",
"0.5675203",
"0.5644176",
"0.549516",
"0.5464363",
"0.5433982",
"0.5405287",
... | 0.7581607 | 2 |
Return the latest bars data type of given symbol | def get_latest_bars_values(self, symbol, val_type, N=1):
raise NotImplementedError("Should implement get_latest_bars_values()") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_latest_bar(self, symbol):\n raise NotImplementedError(\"Should implement get_latest_bar()\")",
"def get_latest_bar_value(self, symbol, val_type):\n try:\n bars_list = self.latest_symbol_data[symbol]\n except KeyError:\n print(\"That Symbol is not available in th... | [
"0.75866544",
"0.7508782",
"0.7405179",
"0.7226866",
"0.7134756",
"0.6855177",
"0.67134136",
"0.66464543",
"0.6403814",
"0.6391609",
"0.63147134",
"0.59143126",
"0.5840325",
"0.57569456",
"0.57561255",
"0.56641245",
"0.5644362",
"0.5506602",
"0.54862684",
"0.5425116",
"0.5419... | 0.6658835 | 7 |
Return the latest bar data of given symbol | def _get_new_bar(self, symbol):
for b in self.symbol_data[symbol]:
yield b | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_latest_bar(self, symbol):\n raise NotImplementedError(\"Should implement get_latest_bar()\")",
"def get_latest_bar(self, symbol):\n try:\n bars_list = self.latest_symbol_data[symbol]\n except KeyError:\n print(\"That symbol is not available in the historical dat... | [
"0.85556465",
"0.8264855",
"0.77006835",
"0.74883217",
"0.748422",
"0.7448776",
"0.7327442",
"0.70565265",
"0.7032732",
"0.6935906",
"0.6542417",
"0.65420127",
"0.6446969",
"0.63045967",
"0.6267813",
"0.6138769",
"0.6116834",
"0.60914767",
"0.6055453",
"0.6053471",
"0.602813"... | 0.72236437 | 7 |
Return the latest bar data of the given symbol | def get_latest_bar(self, symbol):
try:
bars_list = self.latest_symbol_data[symbol]
except KeyError:
print("That symbol is not available in the historical data")
raise
else:
return bars_list[-1] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_latest_bar(self, symbol):\n raise NotImplementedError(\"Should implement get_latest_bar()\")",
"def get_latest_bar_close(self, symbol):\n try:\n bars_list = self.latest_symbol_data[symbol]\n except KeyError:\n print(\"That symbol is not available in the historic... | [
"0.8587069",
"0.7741076",
"0.7527743",
"0.75229573",
"0.74947923",
"0.7397786",
"0.72648257",
"0.7107647",
"0.70805585",
"0.6983474",
"0.6605424",
"0.65917534",
"0.6469904",
"0.63083875",
"0.6293245",
"0.6222976",
"0.6164951",
"0.6094988",
"0.6056787",
"0.6053128",
"0.601474"... | 0.8289707 | 1 |
Return the latest bar data type of given symbol. | def get_latest_bar_value(self, symbol, val_type):
try:
bars_list = self.latest_symbol_data[symbol]
except KeyError:
print("That Symbol is not available in the historical data")
raise
else:
return getattr(bars_list[-1][1], val_type) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_latest_bar(self, symbol):\n raise NotImplementedError(\"Should implement get_latest_bar()\")",
"def get_latest_bar_value(self, symbol, val_type):\n raise NotImplementedError(\"Should implement get_latest_bar_value()\")",
"def get_latest_bar(self, symbol):\n try:\n bars_l... | [
"0.7655375",
"0.7581607",
"0.7288055",
"0.72558254",
"0.69452786",
"0.68888795",
"0.64372",
"0.6192996",
"0.61455023",
"0.6073669",
"0.5985562",
"0.5881797",
"0.58160275",
"0.5754493",
"0.5707582",
"0.5675203",
"0.5644176",
"0.549516",
"0.5464363",
"0.5433982",
"0.5405287",
... | 0.77291864 | 0 |
Return the latest bars data type of given symbol | def get_latest_bars_values(self, symbol, val_type, N=1):
try:
bars_list = self.get_latest_bars(symbol, N)
except KeyError:
print("That Symbol is not available in the historical data")
raise
else:
return np.array([getattr(b[1], val_type) for b in ba... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_latest_bar(self, symbol):\n raise NotImplementedError(\"Should implement get_latest_bar()\")",
"def get_latest_bar_value(self, symbol, val_type):\n try:\n bars_list = self.latest_symbol_data[symbol]\n except KeyError:\n print(\"That Symbol is not available in th... | [
"0.75855476",
"0.75060993",
"0.74036837",
"0.7224834",
"0.7132079",
"0.67115",
"0.66590774",
"0.66437757",
"0.6402391",
"0.63918555",
"0.63157046",
"0.5914327",
"0.5839292",
"0.5757333",
"0.5755744",
"0.56622326",
"0.5641431",
"0.55049366",
"0.54861003",
"0.54231256",
"0.5417... | 0.68541235 | 5 |
Return the Minimum price value using the given symbol,period and shift. | def Low(self, symbol, period, shift):
data = self.get_latest_bars_values(symbol, 'Close', period + shift)
if data.__len__() >= period + 1:
return np.min(data[0:-shift])
else:
return 0 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def stock_min(stock):\n min_price=1000000\n for i in stock['Close']:\n if i < min_price:\n min_price=i\n return min_price",
"def min(x: pd.Series, d: int or float) -> pd.Series:\n return ts_min(x, d)",
"def get_min(self):\n return self.serie.min()",
"def fcn2min(params, x... | [
"0.62218237",
"0.57798153",
"0.57754725",
"0.5771587",
"0.5675622",
"0.5661396",
"0.5645898",
"0.5645898",
"0.56401294",
"0.56401294",
"0.5621971",
"0.56114465",
"0.55890733",
"0.5553426",
"0.5516776",
"0.54498696",
"0.5438351",
"0.5428404",
"0.5428404",
"0.5423441",
"0.54163... | 0.7741043 | 0 |
save a dictionary as a json file | def write_json_conf(json_dict, path):
try:
config_json_open = io.open(path, encoding="utf-8", mode="w")
config_json_open.write(unicode(json.dumps(json_dict, indent=True, sort_keys=True)))
config_json_open.close()
except IOError:
log.fatal("couldn't write {0}".format(path)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def save_to_json(dict, file):\n with open(file, 'w') as f:\n json.dump(dict, f, indent=2)\n return file",
"def save(self) -> None:\n with open(dict_path, 'w', encoding='utf-8') as dictionary_file:\n json.dump(self.data, dictionary_file, indent=2, separators=(',', ':'), ensure_ascii=False)",
... | [
"0.85667175",
"0.8397071",
"0.83845127",
"0.8326091",
"0.8287555",
"0.82093257",
"0.81590825",
"0.80569607",
"0.7928337",
"0.79204637",
"0.7876861",
"0.7868019",
"0.784886",
"0.7837572",
"0.7713851",
"0.77000284",
"0.76767105",
"0.7669708",
"0.764539",
"0.7641094",
"0.7640387... | 0.0 | -1 |
Returns the number of values that are smaller than x in the array data and divides it by the total number of numbers in data | def empirical_distribution(data, x, n):
i = 0
while i < n and data[i] <= x:
i+=1
return float(i)/n | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def num_larger(threshold, values):\n num = sum([1 for n in values if (n>threshold)])\n return num",
"def counts(e, x):\n arr = np.asarray(arr)\n return len(np.where(arr == x)[0])",
"def n_peaks_valleys(x):\n diff_sign = np.sign(x[1:] - x[:-1])\n return np.count_nonzero(diff_sign[1:] != diff_s... | [
"0.6444197",
"0.6371511",
"0.6338822",
"0.62061507",
"0.62061507",
"0.61892027",
"0.6189091",
"0.61570096",
"0.6128595",
"0.60646737",
"0.59813756",
"0.59801847",
"0.5971672",
"0.5952084",
"0.59398085",
"0.5924257",
"0.5900926",
"0.57910657",
"0.57712394",
"0.5763764",
"0.575... | 0.6206506 | 3 |
Returns dict of (arg_name, default_value) pairs. The default_value could be NO_DEFAULT when no default was specified. | def get_argdefaults(factory, num_skipped=0):
args, defaults = _getargspec(factory)
if defaults is not None:
num_without_defaults = len(args) - len(defaults)
default_values = (NO_DEFAULT,) * num_without_defaults + defaults
else:
default_values = (NO_DEFAULT,) * len(args)
return ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_defaults(self):\n default_dict = {}\n args, varargs, keyword, defaults = inspect.getargspec(self.exec_obj)\n if defaults:\n default_dict = dict(zip(args[-len(defaults):], defaults))\n return default_dict",
"def get_default_args(func):\n signature = inspect.signat... | [
"0.7780923",
"0.70579404",
"0.69888437",
"0.68808514",
"0.67420334",
"0.66569227",
"0.6621363",
"0.6540205",
"0.6458162",
"0.6396038",
"0.63894975",
"0.63850325",
"0.63572764",
"0.63374424",
"0.633451",
"0.62805146",
"0.62784934",
"0.6203808",
"0.6196404",
"0.6177389",
"0.617... | 0.72199416 | 1 |
Convert param string to uppercase and inserting underscores | def key(param: str):
if re.match(r'^[A-Z_]+$', param):
return 'KEY_' + param
return 'KEY_' + re.sub(r'([a-z]|[A-Z]{2,})([A-Z]|\d$)', r'\1_\2', param).upper() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def camelize_param(self, s):\n\n final = ''\n parts = s.split('_')\n final += parts.pop(0)\n\n for p in parts:\n final += p[0].upper() + p[1:]\n\n return final",
"def camelcase_to_underscore(input_):\n return _CAMELCASE_TO_UNDERSCORE_RE.sub(r'_\\1', input_).lower(... | [
"0.82230383",
"0.7294133",
"0.713868",
"0.71165866",
"0.71038574",
"0.7043277",
"0.7023328",
"0.70163596",
"0.7011482",
"0.6954389",
"0.671751",
"0.67111826",
"0.6695791",
"0.6682911",
"0.66819954",
"0.6674697",
"0.6674697",
"0.6666773",
"0.66546726",
"0.66521174",
"0.6643628... | 0.67893994 | 10 |
Get yaml lib to handle OrderedDicts. | def _yaml_ordering_support():
_mapping_tag = yaml.resolver.BaseResolver.DEFAULT_MAPPING_TAG
def dict_representer(dumper, data):
return dumper.represent_dict(data.iteritems())
def dict_constructor(loader, node):
return OrderedDict(loader.construct_pairs(node))
yaml.add_representer(OrderedDict, dict_re... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def as_OrderedDict(self) -> OrderedDict:\n # Issue a warning. (and don't do it ALL the time.)\n # In Py3.2+ \"DeprecationWarning is now ignored by default\"\n # (https://docs.python.org/3/library/warnings.html),\n # so to see it, you have to run the Python interpreter\n # with th... | [
"0.6000116",
"0.5963602",
"0.58822834",
"0.5863703",
"0.58626336",
"0.5709251",
"0.55750066",
"0.55731297",
"0.5537172",
"0.55096614",
"0.54995835",
"0.54785424",
"0.5436552",
"0.54123515",
"0.54115033",
"0.5318875",
"0.52961177",
"0.5239477",
"0.5234543",
"0.5221425",
"0.518... | 0.7300811 | 0 |
Test Get with errors. | def test_get_with_connection_errors(app):
with app.app_context():
mock_get_token = patch('pay_api.services.oauth_service.requests.Session.get')
mock_get = mock_get_token.start()
mock_get.side_effect = HTTPError()
mock_get.return_value.json.return_value = {}
with pytest.raises... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_get_fail(self):\n with self.assertRaises(AssertionError):\n self.resource.get(-1)",
"def test_get_fail(self):\n response = self.second_client.get(self.url)\n self.assertEquals(response.status_code, 400)",
"def test_error_html_using_get(self):\n pass",
"def test... | [
"0.7773912",
"0.7746032",
"0.7592293",
"0.74598444",
"0.7429191",
"0.7336758",
"0.7336758",
"0.7305934",
"0.726174",
"0.72495055",
"0.72439206",
"0.7222763",
"0.71658",
"0.71272886",
"0.7120385",
"0.71167266",
"0.71012723",
"0.70944405",
"0.7091468",
"0.7091468",
"0.70645905"... | 0.0 | -1 |
Test Get with errors. | def test_post_with_connection_errors(app):
with app.app_context():
mock_get_token = patch('pay_api.services.oauth_service.requests.post')
mock_get = mock_get_token.start()
mock_get.side_effect = HTTPError()
mock_get.return_value.json.return_value = {}
with pytest.raises(HTTPE... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_get_fail(self):\n with self.assertRaises(AssertionError):\n self.resource.get(-1)",
"def test_get_fail(self):\n response = self.second_client.get(self.url)\n self.assertEquals(response.status_code, 400)",
"def test_error_html_using_get(self):\n pass",
"def test... | [
"0.7773912",
"0.7746032",
"0.7592293",
"0.74598444",
"0.7429191",
"0.7336758",
"0.7336758",
"0.7305934",
"0.726174",
"0.72495055",
"0.72439206",
"0.7222763",
"0.71658",
"0.71272886",
"0.7120385",
"0.71167266",
"0.71012723",
"0.70944405",
"0.7091468",
"0.7091468",
"0.70645905"... | 0.0 | -1 |
Returns the name of this layer, e.g. 'affine1'. It does not necessarily correspond to a component name. | def get_name(self):
return self.name | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def layer_name(self) -> pulumi.Output[str]:\n return pulumi.get(self, \"layer_name\")",
"def layer_name(self) -> pulumi.Input[str]:\n return pulumi.get(self, \"layer_name\")",
"def layer_name(self) -> Optional[pulumi.Input[str]]:\n return pulumi.get(self, \"layer_name\")",
"def _get_laye... | [
"0.80204934",
"0.7777957",
"0.7554241",
"0.71364135",
"0.7024192",
"0.6988019",
"0.6936606",
"0.69323456",
"0.6874907",
"0.6874907",
"0.6811657",
"0.68085617",
"0.6766544",
"0.6766544",
"0.67642033",
"0.6758472",
"0.6758472",
"0.6758472",
"0.6758472",
"0.6758472",
"0.6758472"... | 0.0 | -1 |
This function, which may be (but usually will not have to be) overridden by child classes, returns a list of names of the input descriptors expected by this component. Typically this would just return ['input'] as most layers just have one 'input'. However some layers might require more inputs (e.g. cell state of previ... | def get_input_descriptor_names(self):
return ['input'] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _get_input_layer_names(self, layer):\n if self._is_functional_model(self.model):\n inbound_nodes = layer['inbound_nodes']\n return [connection_info[0] for connection_info in inbound_nodes[0]]\n else: # Sequential model.\n layers = self._config['layers']\n i = layers.index(layer)\n ... | [
"0.7081877",
"0.69748974",
"0.6952743",
"0.68936515",
"0.6739357",
"0.6718405",
"0.66812307",
"0.6604456",
"0.64513016",
"0.64513016",
"0.6445126",
"0.6428411",
"0.64158905",
"0.6399852",
"0.63864076",
"0.636964",
"0.63686955",
"0.63519144",
"0.6272389",
"0.6272389",
"0.62723... | 0.854252 | 0 |
Returns a list of all auxiliary outputs that this layer supports. These are either 'None' for the regular output, or a string (e.g. 'projection' or 'memory_cell') for any auxiliary outputs that the layer might provide. Most layer types will not need to override this. | def auxiliary_outputs(self):
return [None] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_outputs(self):\n outputs = []\n missing = []\n for i, name in enumerate(self.output_names[:]):\n try:\n value = self.proto.output_env.look_up(name).unwrapped\n except Exception:\n if self.optional_flags[i]:\n value ... | [
"0.6932475",
"0.65318716",
"0.6475298",
"0.64214325",
"0.6362524",
"0.62290925",
"0.62215924",
"0.61635214",
"0.6148412",
"0.6147485",
"0.6118117",
"0.6092951",
"0.60884774",
"0.6082091",
"0.6030955",
"0.6030955",
"0.6029714",
"0.59708315",
"0.59629315",
"0.59550035",
"0.5952... | 0.78350645 | 0 |
Called with auxiliary_output is None, this returns the componentnode name of the principal output of the layer (or if you prefer, the text form of a descriptor that gives you such an output; such as Append(some_node, some_other_node)). The 'auxiliary_output' argument is a text value that is designed for extensions to l... | def output_name(self, auxiliary_output=None):
raise Exception("Child classes must override output_name()") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def output_alias(self):\n if self.output_label is not None:\n return self.output_label\n return self.alias",
"def layer_name(self) -> pulumi.Output[str]:\n return pulumi.get(self, \"layer_name\")",
"def _get_inference_output_name(self):\n inference_output_name = 'output'\... | [
"0.56553936",
"0.56268954",
"0.5623316",
"0.56221485",
"0.55019516",
"0.5454164",
"0.5436334",
"0.54057056",
"0.5396189",
"0.5384916",
"0.5377686",
"0.5346167",
"0.5327297",
"0.5273065",
"0.5198497",
"0.5186825",
"0.5115636",
"0.5103661",
"0.5103661",
"0.5088735",
"0.50717735... | 0.65291667 | 0 |
The dimension that this layer outputs. The 'auxiliary_output' parameter is for layer types which support auxiliary outputs. | def output_dim(self, auxiliary_output=None):
raise Exception("Child classes must override output_dim()") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def output_dim(self):\n return self._output_dim",
"def get_output_dim(self) -> int:\n raise NotImplementedError",
"def get_output_dim(self) -> int:\n raise NotImplementedError",
"def output_dim(self) -> int:\n return 2 * self._hidden_dim",
"def output_size(self) -> int:\n ret... | [
"0.7881042",
"0.7699801",
"0.7623548",
"0.7411898",
"0.7381862",
"0.7329131",
"0.7256677",
"0.72470737",
"0.7237115",
"0.70121753",
"0.700298",
"0.700298",
"0.700298",
"0.700298",
"0.700298",
"0.69536126",
"0.6936504",
"0.6927581",
"0.6805472",
"0.6800781",
"0.67749405",
"0... | 0.80569607 | 0 |
Apply aggregation function by row. | def _aggregate(y, aggfunc, weights):
if weights is None:
aggfunc = _check_aggfunc(aggfunc, weighted=False)
y_agg = aggfunc(y, axis=1)
else:
aggfunc = _check_aggfunc(aggfunc, weighted=True)
y_agg = aggfunc(y, axis=1, weights=np.array(weights))
return pd.Series(y_agg, index=y.... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _aggregate(self, row):\n if not self._head:\n self._head = self._create_head(row)\n if self._args.head:\n return\n\n if 'key' not in self._state:\n self._state['key'] = self._replace_fields(self._args.key)\n\n if 'begin' not in self._state:\n... | [
"0.7572609",
"0.6669208",
"0.66080666",
"0.6550363",
"0.6531027",
"0.6400338",
"0.62581104",
"0.6235415",
"0.6199179",
"0.60828316",
"0.60714555",
"0.6071104",
"0.6067795",
"0.6026066",
"0.60157573",
"0.59524935",
"0.5922941",
"0.5920535",
"0.5918262",
"0.5915817",
"0.5863946... | 0.56694525 | 33 |
Calculates the camera intrinsic matrix based on camera values | def intrinsic_matrix_from_camera(w, h, fov):
(cx, cy), f = calc_focal_values(w, h, fov)
return np.array([[f, 0, cx], [0, f, cy], [0, 0, 1]]) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def camera_transform(image):\n img = np.zeros((image.shape[0], image.shape[1], 3))\n for y in range(image.shape[0]):\n for x in range(image.shape[1]):\n img[y][x] = (x - 320) / 575.5 * image[y, x], (240 - y) / 575.5 * image[y, x], image[\n y, x]\n return img",
"def getCa... | [
"0.6910037",
"0.6687431",
"0.64508003",
"0.6437661",
"0.63206834",
"0.6289331",
"0.6267219",
"0.62231416",
"0.61795586",
"0.6087817",
"0.60845435",
"0.6075455",
"0.6037217",
"0.60117316",
"0.599047",
"0.5984163",
"0.58917546",
"0.5869909",
"0.58675456",
"0.5782656",
"0.577782... | 0.71207654 | 0 |
Calculates the camera intrinsic matrix based on a cameras focal values | def intrinsic_matrix_from_focal(cx, cy, f):
return np.array([[f, 0, cx], [0, f, cy], [0, 0, 1]]) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def intrinsic_matrix_from_camera(w, h, fov):\n (cx, cy), f = calc_focal_values(w, h, fov)\n return np.array([[f, 0, cx], [0, f, cy], [0, 0, 1]])",
"def camera_transform(image):\n img = np.zeros((image.shape[0], image.shape[1], 3))\n for y in range(image.shape[0]):\n for x in range(image.shape[... | [
"0.7269157",
"0.6482951",
"0.6278296",
"0.60616004",
"0.5934673",
"0.58774966",
"0.58196896",
"0.5788374",
"0.5778877",
"0.57767",
"0.57638264",
"0.57235926",
"0.5699194",
"0.5683092",
"0.5660214",
"0.56499773",
"0.5580154",
"0.5574701",
"0.55587125",
"0.55326545",
"0.5518046... | 0.7251896 | 1 |
Creates the shared tensor from the input `tensor` provided by party `src`. | def __init__(self, tensor, ptype=Ptype.arithmetic, device=None, *args, **kwargs):
if tensor is None:
raise ValueError("Cannot initialize tensor with None.")
# take required_grad from kwargs, input tensor, or set to False:
default = tensor.requires_grad if torch.is_tensor(tensor) els... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def encrypt_data_tensor_with_src(input):\n # get rank of current process\n rank = comm.get().get_rank()\n # get world size\n world_size = comm.get().get_world_size()\n\n if world_size > 1:\n # party 1 gets the actual tensor; remaining parties get dummy tensor\n src_id = 1\n else:\n ... | [
"0.65212935",
"0.6451436",
"0.6422643",
"0.61364114",
"0.59996116",
"0.5920658",
"0.5786765",
"0.5567839",
"0.554521",
"0.55089945",
"0.54783136",
"0.5463215",
"0.5456101",
"0.5404918",
"0.53378505",
"0.53104335",
"0.52852935",
"0.52852935",
"0.528499",
"0.52764225",
"0.52761... | 0.0 | -1 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.