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
Constructor for the PayrollEmployeeRecord class
def __init__(self, name=None, given_name=None, middle_name=None, family_name=None, address=None, additional_properties = {}): # Initialize members of the class self.name = name self.g...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, record=None):\n self.record = record", "def __init__(self,\r\n pay_period=None,\r\n billable=None,\r\n asset_id=None,\r\n pay_date=None,\r\n start_date=None,\r\n end_date=None,\r\n ...
[ "0.6748113", "0.6535291", "0.65126646", "0.64183754", "0.63495487", "0.63286173", "0.63221323", "0.6247641", "0.62373763", "0.61984736", "0.61194915", "0.6099491", "0.60252786", "0.5952361", "0.591907", "0.59189963", "0.5916519", "0.58822215", "0.58777696", "0.5856268", "0.58...
0.0
-1
Creates an instance of this model from a dictionary
def from_dictionary(cls, dictionary): if dictionary is None: return None # Extract variables from the dictionary name = dictionary.get('name') given_name = dictionary.get('givenName') middle_name = dictionary.get('middleName') ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def from_dictionary(cls,\n dictionary):\n if dictionary is None:\n return None\n\n # Extract variables from the dictionary\n id = dictionary.get('id')\n name = dictionary.get('name')\n mtype = dictionary.get('type')\n usage_bytes = diction...
[ "0.83181584", "0.8168118", "0.8168118", "0.8118749", "0.8089047", "0.79787344", "0.7949278", "0.79231393", "0.7898951", "0.78923255", "0.788838", "0.7882321", "0.7882212", "0.7876749", "0.78585315", "0.7836853", "0.7801407", "0.7801407", "0.7801407", "0.7801407", "0.7801407",...
0.7670297
69
Returns true if both objects are equal
def __eq__(self, other): if not isinstance(other, LoadBalancerRuleCondition): return False return self.__dict__ == other.__dict__
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __eq__(self, other):\n return are_equal(self, other)", "def __eq__(self, other):\n return are_equal(self, other)", "def __eq__(self,other):\n try: return self.object==other.object and isinstance(self,type(other))\n except: return False", "def __eq__(self, other):\n if i...
[ "0.8088132", "0.8088132", "0.8054589", "0.7982687", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", ...
0.0
-1
Returns true if both objects are not equal
def __ne__(self, other): return not self == other
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __ne__(self, other: object) -> bool:\n if self.__eq__(other):\n return False\n return True", "def __ne__(self, other: object) -> bool:\n return not self.__eq__(other)", "def __ne__(self, other) -> bool:\n return not self.__eq__(other)", "def __eq__(self, other):\n ...
[ "0.84568954", "0.83923674", "0.81447554", "0.81407183", "0.81326675", "0.80941343", "0.8092415", "0.8092415", "0.8092415", "0.8085536", "0.8085536", "0.8076502", "0.8076502", "0.8066026" ]
0.0
-1
String representation of the class instance.
def __str__(self): return 'Token({type}, {lexema})'.format( type= tokenNames[self.type], lexema=self.lexema )
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __str__(self):\n class_dictionary = vars(self)\n out = self.__class__.__name__\n for k,v in class_dictionary.items():\n if v > 0:\n out += ' : ' + str(k) + ' = ' + str(v)\n return out", "def __repr__(self):\n outl = 'class :'+self.__class__.__name_...
[ "0.81528825", "0.810694", "0.80485237", "0.7923295", "0.7921949", "0.7921949", "0.7921949", "0.7921949", "0.7921949", "0.7921295", "0.7910681", "0.79043895", "0.79043895", "0.79043895", "0.78848475", "0.78608793", "0.7854687", "0.78356767", "0.7828303", "0.7778142", "0.777691...
0.0
-1
Extract a list of unique enhancers.
def unique_enhancers(fname): logger.info("reading enhancers") # Read enhancers from binding file header = pd.read_table(fname, nrows=0) idx = header.columns.get_loc("enhancer") skiprows = 1 chunksize = 2_000_000 enhancers = np.array([]) while True: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def unique_detector_names() :\n return experiment_info.unique_detector_names()", "def _unique_alert_ids(alerts: List[Dict[str, Any]]) -> Set[str]:\n return {alert[ALERT_ID] for alert in alerts}", "def get_emoji_list():\n return list(map(lambda x: x.get('emoji'), emoji_list))", "def get_well_alia...
[ "0.5681369", "0.55609286", "0.53566056", "0.5320251", "0.52819836", "0.51526624", "0.5141778", "0.51227057", "0.5071843", "0.5050777", "0.50449115", "0.50401986", "0.5024621", "0.49983376", "0.49878109", "0.4987272", "0.49689597", "0.4945896", "0.49409357", "0.49269447", "0.4...
0.605017
0
Summarize all binding signal per gene per TF. Return a dask delayed computation object.
def aggregate_binding( self, binding_fname, tfs=None, up=1e5, down=1e5, alpha=None, promoter=2000, full_weight_region=5000, combine_function="sum", ): if not os.path.exists(binding_fname): raise ValueError(f"File {binding_fn...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def compute(\n self,\n ) -> Dict[str, Tensor]:\n results = torch.stack((self.tp, self.fp, self.tn, self.fn), dim=1)\n\n return {f\"group_{i}\": group / group.sum() for i, group in enumerate(results)}", "def compute_batch(self, duplicate_manager=None,context_manager=None):\n x = sel...
[ "0.5403143", "0.5127663", "0.5066501", "0.50592285", "0.49670947", "0.49670947", "0.49642673", "0.49566504", "0.4894082", "0.48260033", "0.48210427", "0.48148468", "0.48027742", "0.47856742", "0.47787568", "0.4776095", "0.47620398", "0.47443306", "0.47371265", "0.47254235", "...
0.56757736
0
Return True if the tile (m, n) has been cleaned. Assumes that (m, n) represents a valid tile inside the room.
def isTileCleaned(self, m, n): if self.tiles[Position(m, n)] == 'clean': return True else: return False
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def isTileCleaned(self, m, n):\n if (m, n) in self.clean_tiles:\n return True\n return False", "def isTileCleaned(self, m, n):\n return self.tiles[n][m] == True", "def isTileCleaned(self, m, n):\n if (m, n) in self.CleanBlocks:\n return True\n else:\n ...
[ "0.88600093", "0.8856192", "0.85321546", "0.8515633", "0.8470117", "0.8469998", "0.7147367", "0.6394415", "0.63454044", "0.63245857", "0.6269502", "0.6255008", "0.6247907", "0.6235148", "0.62225336", "0.62117195", "0.6195437", "0.6129906", "0.61251265", "0.61248434", "0.60998...
0.8599528
2
Return the total number of tiles in the room.
def getNumTiles(self): return self.height * self.width
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getNumTiles(self):\n return len(list(product(list(range(self.width+1))[1:], list(range(self.height+1))[1:])))", "def getNumTiles(self):\n return (self.width) * (self.height)", "def num_tiles(self):\n return self.num_row_tiles * self.num_col_tiles", "def getNumTiles(self):\n\t\treturn sel...
[ "0.81903553", "0.81504375", "0.8046322", "0.8039323", "0.79811716", "0.7871275", "0.78123623", "0.7472709", "0.7407938", "0.7151273", "0.7067083", "0.6982381", "0.69224", "0.6857802", "0.6832814", "0.6813225", "0.67038375", "0.66893554", "0.66816777", "0.6676057", "0.66583914...
0.8205867
0
Return a random position inside the room.
def getRandomPosition(self): x = random.randint(0, self.width - 1) y = random.randint(0, self.height - 1) return Position(x, y)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getRandomPosition(self):\n return Position(random.random()*self.w, random.random()*self.h)", "def getRandomPosition(self):\n return Position(random.uniform(0, self.width), random.uniform(0, self.height))", "def _get_random_position(self):\n return (random.randrange(0, self.maze.width),...
[ "0.84095305", "0.8339333", "0.8331419", "0.83306754", "0.8253471", "0.8129327", "0.79893064", "0.7975111", "0.79634804", "0.78944933", "0.76948863", "0.74812585", "0.74559724", "0.73774105", "0.73208076", "0.730955", "0.7219106", "0.7115554", "0.7098047", "0.70740753", "0.701...
0.8408874
1
Return True if pos is inside the room.
def isPositionInRoom(self, pos): if pos in self.tiles: return True else: return False
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def isPositionInRoom(self, pos):\n posX = pos.getX()\n posY = pos.getY()\n if posX >= 0 and posX < self.width and posY >= 0 and posY < self.height:\n return True\n return False", "def isPositionInRoom(self, pos):\n if pos.getX() >= 0 and pos.getX() < self.w:\n ...
[ "0.8584927", "0.8582658", "0.85010713", "0.8269878", "0.81532705", "0.79464453", "0.76641285", "0.7577739", "0.7245626", "0.71334845", "0.7054074", "0.70337284", "0.69001585", "0.68928367", "0.6863638", "0.68287355", "0.6828435", "0.6821271", "0.6807673", "0.68048966", "0.679...
0.8394066
3
Left child of the Node
def left(self) -> Optional["ExpressionNode"]: return self.__left
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_leftchild(self):\n return self._leftchild", "def getLeftChild(self):\n return _libsbml.ASTNode_getLeftChild(self)", "def leftChild(self, pos):\n return 2 * pos", "def leftChild(self, pos):\n return 2 * pos", "def left_child(self, pos): \n return 2 * pos", ...
[ "0.8403364", "0.8351813", "0.82603043", "0.82603043", "0.8103596", "0.78266394", "0.7817765", "0.7801113", "0.77168965", "0.76931155", "0.7688028", "0.7672632", "0.763528", "0.7629458", "0.7618197", "0.7618197", "0.7603051", "0.76011145", "0.7592772", "0.7571948", "0.7553907"...
0.7651073
12
Right child of the Node
def right(self) -> Optional["ExpressionNode"]: return self.__right
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_rightchild(self):\n return self._rightchild", "def getRightChild(self):\n return _libsbml.ASTNode_getRightChild(self)", "def rightChild(self, pos):\n return (2 * pos) + 1", "def rightChild(self, pos):\n return (2 * pos) + 1", "def right_child(self, pos): \n ...
[ "0.81942624", "0.8187376", "0.8128453", "0.8128453", "0.7949902", "0.76552427", "0.76152444", "0.75948566", "0.7556133", "0.7465871", "0.7431905", "0.74086314", "0.73792106", "0.73691916", "0.7364177", "0.73022664", "0.7255717", "0.7195493", "0.7182769", "0.71752423", "0.7162...
0.73546076
15
Before running a test, clear the existing test database
def tearDown(self): Transaction.transaction_list = []
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def tearDown(self):\r\n empty_db()", "def tearDown(self):\r\n empty_db()", "def tearDown(self):\r\n empty_db()", "def tearDown(self):\r\n empty_db()", "def tearDown(self):\r\n empty_db()", "def tearDown(self):\r\n empty_db()", "def tearDown(self):\r\n te...
[ "0.84508985", "0.84508985", "0.84508985", "0.84508985", "0.84508985", "0.84508985", "0.8392076", "0.8392076", "0.8392076", "0.8392076", "0.8392076", "0.8392076", "0.8392076", "0.8392076", "0.8392076", "0.8093998", "0.80880857", "0.8040105", "0.8040105", "0.7941749", "0.7916",...
0.0
-1
Get the item from the vocab.
def __getitem__(self, item: str) -> int: return self.stoi[item]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __getitem__(self, item):\n return self._data[item]", "def __getitem__(self, key: int):\n return self.words[key]", "def __getitem__(self, item):\n return self.data[item]", "def __getitem__(self, item):\n return self.data[item]", "def __getitem__(self, item):\n return s...
[ "0.67215466", "0.6693604", "0.66255397", "0.66255397", "0.66255397", "0.6602548", "0.65907514", "0.65731597", "0.6561641", "0.6551191", "0.653973", "0.6485578", "0.6432731", "0.6432731", "0.6432731", "0.64310575", "0.6359538", "0.6359538", "0.63348085", "0.6319346", "0.630674...
0.0
-1
Return True if the item is in the vocab.
def __contains__(self, item: str) -> bool: return item in self.stoi
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __contains__(self, item):\n return item in self._terms", "def has_item(self, item):\n return item in self.set", "def has_item(self, item):\n return item in self.set", "def __contains__(self, item):\n if isinstance(item, Token):\n return item.text in self.text\n ...
[ "0.7410538", "0.70554453", "0.70554453", "0.69330513", "0.693214", "0.686804", "0.68198735", "0.67862535", "0.6770252", "0.6748692", "0.672954", "0.6723584", "0.6699814", "0.6670466", "0.6615813", "0.6588918", "0.6572789", "0.65690565", "0.6547841", "0.65415907", "0.6531686",...
0.0
-1
L, list with unique elements
def mySort(L): clear = False while not clear: clear = True for j in range(1, len(L)): if L[j-1] > L[j]: clear = False temp = L[j] L[j] = L[j-1] L[j-1] = temp
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _unique(li):\n return list(set(li))", "def unique(li):\r\n seen = set()\r\n seen_add = seen.add\r\n return [x for x in li if not (x in seen or seen_add(x))]", "def _naive_unique(li):\n tmp = []\n for el in li:\n if el not in tmp:\n tmp.append(el)\n return tmp", "def...
[ "0.8551727", "0.81622195", "0.8086824", "0.8005099", "0.7925472", "0.78556293", "0.7663264", "0.75938886", "0.750385", "0.7469182", "0.7421409", "0.7386649", "0.73754466", "0.7322196", "0.73204744", "0.7283519", "0.72790235", "0.72717", "0.72628796", "0.7252341", "0.7245671",...
0.0
-1
Test routing table in case we have IP associated with a network which is in different pubic IP range from that of public IP range that has source NAT IP. When IP is associated we should see a new route table created. When IP is associated we should see a that route table is deleted.
def test_routing_tables(self): # Validate the following: # 1. Create a new public IP range and dedicate to a account # 2. Acquire a IP from new public range # 3. Create a firewall rule to open up the port, so that IP is associated with network # 5. Login to VR and verify routing...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _link_route_table():\n if dry:\n print(\"Would link the VPC and subnet in the route table.\")\n return True\n\n vpc = _existing.vpc\n sub = _existing.sub\n igw = _existing.igw\n rt = [x for x in vpc.route_tables.all()]\n if len(rt) == 0:\n print('No route table have been ...
[ "0.6888609", "0.65528995", "0.6502355", "0.6437344", "0.64344156", "0.639264", "0.63826835", "0.63505214", "0.6227839", "0.6215514", "0.6167047", "0.615674", "0.61316764", "0.61255175", "0.6077485", "0.6025326", "0.601778", "0.5961436", "0.5888499", "0.5881053", "0.5862085", ...
0.7994894
0
Gets the need_admin_approval of this TemplatePermissionSet.
def need_admin_approval(self): return self._need_admin_approval
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def need_admin_approval(self, need_admin_approval):\n\n self._need_admin_approval = need_admin_approval", "def is_auto_approval_allowed(self):\n\n if not self.upload:\n raise ImproperlyConfigured(\n 'Need an upload to call is_auto_approval_allowed()'\n )\n\n ...
[ "0.7271452", "0.5793583", "0.56730247", "0.5656593", "0.56205887", "0.54918385", "0.5401177", "0.536612", "0.53039575", "0.53000003", "0.5279366", "0.52483493", "0.52483493", "0.52482045", "0.52413905", "0.5207882", "0.5207882", "0.5153958", "0.5152152", "0.5101498", "0.50832...
0.7702466
0
Sets the need_admin_approval of this TemplatePermissionSet.
def need_admin_approval(self, need_admin_approval): self._need_admin_approval = need_admin_approval
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def need_admin_approval(self):\n return self._need_admin_approval", "def should_auto_approve(self):\r\n if self.group and self.group.allow_auto_approval:\r\n return True\r\n\r\n # some orders (like those duplicated by CIT) will not have owners\r\n if self.is_multilevel_appr...
[ "0.68658173", "0.54023856", "0.52457255", "0.516582", "0.51649714", "0.505126", "0.4954557", "0.492141", "0.49146673", "0.4887236", "0.4803631", "0.4780809", "0.47718704", "0.47637898", "0.4745974", "0.47312483", "0.47021663", "0.4625272", "0.46201798", "0.46130645", "0.46028...
0.83347124
0
Gets the id of this TemplatePermissionSet.
def id(self): return self._id
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def template_id(self):\n return self._template_id", "def get_email_template_id(self):\n return self.email_template_id", "def template_id(self) -> pulumi.Output[str]:\n return pulumi.get(self, \"template_id\")", "def get_permission_id(self):\n return self.blog.id", "def get_permi...
[ "0.73156697", "0.6642027", "0.64127254", "0.636025", "0.636025", "0.636025", "0.6308456", "0.6308456", "0.62971634", "0.62971634", "0.62971634", "0.62971634", "0.62971634", "0.62971634", "0.62971634", "0.62971634", "0.62971634", "0.62971634", "0.62971634", "0.62971634", "0.62...
0.0
-1
Sets the id of this TemplatePermissionSet.
def id(self, id): self._id = id
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_id(self, id_):\n\n self.id_ = id_", "def SetId(self, id):\n self.id = int(id)", "def set_id(self, id):\n self.__id = id", "def set_id(self, id):\n self.data['id'] = id", "def template_id(self, template_id):\n\n self._template_id = template_id", "def set_id(self,...
[ "0.6487254", "0.6300554", "0.6274574", "0.6217215", "0.6203088", "0.6195461", "0.6141801", "0.601667", "0.5963676", "0.5835479", "0.58272696", "0.5823854", "0.57433915", "0.57402736", "0.57402736", "0.57402736", "0.57402736", "0.57402736", "0.57402736", "0.57402736", "0.57402...
0.0
-1
Gets the template_id of this TemplatePermissionSet.
def template_id(self): return self._template_id
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def template_id(self) -> Optional[pulumi.Input[str]]:\n return pulumi.get(self, \"template_id\")", "def template_id(self) -> Optional[pulumi.Input[str]]:\n return pulumi.get(self, \"template_id\")", "def template_id(self) -> pulumi.Output[str]:\n return pulumi.get(self, \"template_id\")", ...
[ "0.7257221", "0.7257221", "0.71610093", "0.7081286", "0.63245994", "0.6252298", "0.60233325", "0.6011347", "0.58507186", "0.5832129", "0.5832129", "0.58037174", "0.58037174", "0.58037174", "0.5778754", "0.57687974", "0.57647616", "0.55850023", "0.5567002", "0.5533215", "0.552...
0.81382626
0
Gets the template of this TemplatePermissionSet.
def template(self): return self._template
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_template(self):\n return self.template", "def template(self):\n template_names = self.get_template_names()\n if template_names:\n return template_names[0]\n return None", "def template(self) -> str:\n manifest = self._get_manifest()\n\n return manife...
[ "0.73665464", "0.7199855", "0.6897641", "0.6896403", "0.6815428", "0.67916554", "0.66893446", "0.6685551", "0.6681818", "0.6668282", "0.6605245", "0.6590584", "0.65385294", "0.6503678", "0.64116603", "0.6342935", "0.6303183", "0.62641263", "0.6254639", "0.6152031", "0.6098844...
0.722411
3
Returns true if both objects are equal
def __eq__(self, other): return self.__dict__ == other.__dict__
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __eq__(self, other):\n return are_equal(self, other)", "def __eq__(self, other):\n return are_equal(self, other)", "def __eq__(self,other):\n try: return self.object==other.object and isinstance(self,type(other))\n except: return False", "def __eq__(self, other):\n if i...
[ "0.8088132", "0.8088132", "0.8054589", "0.7982687", "0.7961088", "0.7961088", "0.79433626", "0.79303336", "0.7926563", "0.7897525", "0.78826123", "0.78826123", "0.78806067", "0.7872423", "0.7868354", "0.78668815", "0.7825702", "0.7819993", "0.78162885", "0.78078854", "0.78068...
0.79670393
28
Returns true if both objects are not equal
def __ne__(self, other): return not self == other
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __ne__(self, other: object) -> bool:\n if self.__eq__(other):\n return False\n return True", "def __ne__(self, other: object) -> bool:\n return not self.__eq__(other)", "def __ne__(self, other) -> bool:\n return not self.__eq__(other)", "def __eq__(self, other):\n ...
[ "0.84568954", "0.83923674", "0.81447554", "0.81407183", "0.81326675", "0.80941343", "0.8092415", "0.8092415", "0.8092415", "0.8085536", "0.8085536", "0.8076502", "0.8076502", "0.8066026" ]
0.0
-1
Return a description of this Condition.
def describe(self) -> Text: return self.__repr__()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def condition(self) -> str | None:\n return self._condition", "def condition(self) -> Optional[str]:\n return pulumi.get(self, \"condition\")", "def condition(self) -> Optional[str]:\n return pulumi.get(self, \"condition\")", "def condition(self) -> Optional[str]:\n return pulumi....
[ "0.7398656", "0.6927037", "0.6927037", "0.6927037", "0.6927037", "0.6927037", "0.6927037", "0.6764303", "0.67488307", "0.67488307", "0.67488307", "0.6710799", "0.66912323", "0.66912323", "0.66912323", "0.66912323", "0.66912323", "0.66912323", "0.66912323", "0.66912323", "0.66...
0.65073603
67
This is a client fixture but it also sets up the transactional session so that we don't pollute the DB in tests.
def client(app): conn = engine.connect() transaction = conn.begin() app.db_session = create_session(conn) yield app.test_client() # No need to retain the junk we # put in the DB for testing. transaction.rollback() conn.close() app.db_session.remove()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def setUp(self):\n\n self.client = server.app.test_client()\n server.app.config['TESTING'] = True\n server.app.config['SECRET_KEY'] = \"123\"\n\n # Connect to test database\n model.connect_to_db(server.app, \"postgresql:///testdb\")\n\n # Create tables and add sample data\...
[ "0.7695225", "0.7679653", "0.7331042", "0.73304987", "0.7285746", "0.7281254", "0.7278331", "0.7211141", "0.7110633", "0.7080194", "0.70353836", "0.7024451", "0.7020917", "0.7017944", "0.701583", "0.70004344", "0.69196314", "0.69196314", "0.6885659", "0.6768283", "0.6759969",...
0.72136194
7
Fixture to be used whenever a test needs a clean UnitDatabase. When using this fixture, it's safe to call UnitDatabase.GetSingleton().
def unit_database() -> Iterator[units.UnitDatabase]: yield units.UnitDatabase.PushSingleton() units.UnitDatabase.PopSingleton()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def setUp(self):\n self.database = Mock()", "def setUp(self):\n self.db_fd, mainPyUnit.app.config['DATABASE'] = tempfile.mkstemp()\n mainPyUnit.app.config['TESTING'] = True\n self.app = mainPyUnit.app.test_client()\n #mainPyUnit.init_db()", "def setUp(self):\n self.dat...
[ "0.709772", "0.7000233", "0.6799798", "0.67961204", "0.6787399", "0.6787399", "0.6787399", "0.6787399", "0.6787399", "0.6787399", "0.66304785", "0.6611615", "0.65996605", "0.65996605", "0.65996605", "0.65996605", "0.65996605", "0.65996605", "0.65996605", "0.65996605", "0.6599...
0.6289222
40
Fixture to be used whenever a test needs a clean UnitDatabase. When using this fixture, it's safe to call UnitDatabase.GetSingleton().
def unit_database_posc() -> Iterator[units.UnitDatabase]: unit_database = units.UnitDatabase() unit_database.FillUnitDatabaseWithPosc(unit_database) units.UnitDatabase.PushSingleton(unit_database) yield unit_database units.UnitDatabase.PopSingleton()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def setUp(self):\n self.database = Mock()", "def setUp(self):\n self.db_fd, mainPyUnit.app.config['DATABASE'] = tempfile.mkstemp()\n mainPyUnit.app.config['TESTING'] = True\n self.app = mainPyUnit.app.test_client()\n #mainPyUnit.init_db()", "def setUp(self):\n self.dat...
[ "0.70984733", "0.70007956", "0.679927", "0.6795574", "0.6787472", "0.6787472", "0.6787472", "0.6787472", "0.6787472", "0.6787472", "0.6630301", "0.6611682", "0.6600081", "0.6600081", "0.6600081", "0.6600081", "0.6600081", "0.6600081", "0.6600081", "0.6600081", "0.6600081", ...
0.0
-1
Calculate overlap between two set of bboxes. If ``is_aligned`` is ``False``, then calculate the ious between each bbox of bboxes1 and bboxes2, otherwise the ious between each aligned pair of bboxes1 and bboxes2.
def bbox_overlaps(bboxes1, bboxes2, mode='iou', is_aligned=False): assert mode in ['iou', 'iof'] rows = bboxes1.size(0) cols = bboxes2.size(0) if is_aligned: assert rows == cols if rows * cols == 0: return bboxes1.new(rows, 1) if is_aligned else bboxes1.new(rows, cols) if is_...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def bbox_overlaps(bboxes1, bboxes2, mode='iou', is_aligned=False):\r\n\r\n assert mode in ['iou', 'iof']\r\n\r\n if isinstance(bboxes1, np.ndarray):\r\n bboxes1 = torch.from_numpy(bboxes1.copy())\r\n if isinstance(bboxes2, np.ndarray):\r\n bboxes2 = torch.from_numpy(bboxes2.copy())\r\n\r\n ...
[ "0.7875328", "0.74849236", "0.71760225", "0.67735624", "0.66928834", "0.6683745", "0.6683745", "0.6683745", "0.6534521", "0.63759583", "0.6241113", "0.620926", "0.6200049", "0.6190617", "0.6171727", "0.61696136", "0.61124754", "0.6048306", "0.6027308", "0.6027308", "0.6007771...
0.7891072
0
Create test application with testing configuration and testing database.
def testing_app() -> Flask: app = create_app("app.config.TestingConfig") with app.app_context(): db.drop_all() db.create_all() return app
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def testapp():\n from webtest import TestApp\n from learning_journal import main\n\n app = main({}, **{'sqlalchemy.url': 'postgres:///amosboldor'})\n testapp = TestApp(app)\n\n session_factory = app.registry[\"dbsession_factory\"]\n engine = session_factory().bind\n Base.metadata.drop_all(bind...
[ "0.7984281", "0.7854234", "0.7784079", "0.7782146", "0.77705604", "0.7730012", "0.77276146", "0.7720737", "0.7706366", "0.7657681", "0.76558423", "0.7589342", "0.75720346", "0.75505525", "0.7543401", "0.75396067", "0.75369895", "0.75149167", "0.74942505", "0.74884075", "0.748...
0.7982555
1
Return a sorted list of references
def getProvidersReferences(self): field = self.getWrappedField('provider') providers = list(field._Vocabulary(self).items()) providers.sort(lambda a, b: cmp(a[1].lower(), b[1].lower())) return atapi.DisplayList(providers)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def gather_references_orders (gdbval):\n# TODO: Somehow also note speculative references and attributes in\n# general\n vec = gdbval[\"references\"]\n return [int(i[\"referred\"][\"order\"]) for i in vec_iter(vec)]", "def list_refs(self):\n pass", "def references_list( self, theWeaver ):\n ...
[ "0.749791", "0.7174802", "0.71541613", "0.68587273", "0.6829507", "0.6793152", "0.67102414", "0.6662161", "0.6659334", "0.6633306", "0.65632623", "0.6475673", "0.64488274", "0.6433976", "0.63824946", "0.6326746", "0.62788177", "0.6223259", "0.62181675", "0.62171566", "0.61821...
0.0
-1
Create a color palette from a matplotlib color map
def color_palette(n_colors=4, cmap='viridis', extrema=False): if extrema: bins = np.linspace(0, 1, n_colors) else: bins = np.linspace(0, 1, n_colors * 2 - 1 + 2)[1:-1:2] cmap = plt.get_cmap(cmap) palette = list(map(tuple, cmap(bins)[:, :3])) return palette
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getColorMap(colors):\n # Normalise RGBs\n norm_colors = []\n for color in colors:\n norm_colors.append([val / 255. for val in color])\n # create color map\n cmap = cols.ListedColormap(norm_colors)\n\n return cmap", "def cmap_to_pil_palette(cmap):\n # return (255.*np.array(\n # ...
[ "0.7227878", "0.7099029", "0.69535255", "0.6926826", "0.68995166", "0.6867163", "0.68527883", "0.6773849", "0.6718949", "0.6696831", "0.66660064", "0.6613911", "0.6590904", "0.6538208", "0.6515655", "0.65118515", "0.6496684", "0.6475265", "0.64609", "0.6456218", "0.6432443", ...
0.66917855
10
Initializes and displays the main window.
def __init__(self, parent, profiles, logfile, encoding=UTF8, editable=True, extender=None): self._activeprofile = None self._configfile = profiles self._encoding = encoding self._extender = extender self._gridsizer = None self._logger = None self....
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def main(self):\n\n self.window.show_all()\n gtk.main()", "def setupWindow(self):\n\n\t\tself.main_menu_window = MenuFrame.MainMenuFrame(self.uiCoordinator)\n\t\tself.menu_window = self.main_menu_window._mf\n\t\tself.score_window = self.main_menu_window._hf\n\t\tself.instructions_window = self.main...
[ "0.7858757", "0.7647117", "0.7627272", "0.76163614", "0.75879043", "0.750943", "0.74187624", "0.7394934", "0.72701955", "0.7267463", "0.7227941", "0.72278404", "0.72157747", "0.7205793", "0.7202085", "0.71720195", "0.71692634", "0.7086636", "0.70753914", "0.7073089", "0.70729...
0.0
-1
Test login unregistered user.
def test_login_unregistered_user(client, new_user): rv = client.post("/auth/login/", json=new_user) response = rv.get_json() assert rv.status_code == HTTPStatus.UNAUTHORIZED assert response["message"] == "Invalid email or password"
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_login_for_unregistered_user(self):\n user = {\n 'username' : 'Gabriel',\n 'password' : '##@qssR7qq'\n }\n\n response = self.client.post('/api/v1/login', json=user, headers={'Content-Type': 'application/json'})\n data = response.get_json()\n\n self.a...
[ "0.81580263", "0.80130136", "0.78432447", "0.7800884", "0.77473205", "0.7730929", "0.7631523", "0.7562257", "0.74938965", "0.7440873", "0.7440873", "0.7440873", "0.7440873", "0.74332875", "0.7349828", "0.73492146", "0.72964007", "0.7292745", "0.72819084", "0.7272924", "0.7267...
0.77915305
4
Test login user with wrong password.
def test_login_user_with_wrong_password(client, new_user, registered_user): new_user["password"] = "wrong_password" rv = client.post("/auth/login/", json=new_user) response = rv.get_json() assert rv.status_code == HTTPStatus.UNAUTHORIZED assert response["message"] == "Invalid email or password"
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_wrong_login_input(self):\n self.user.list_of_accounts = [{'username': 'dalton',\n 'pwd': 'chromelegend',\n 'email': 'legionless@yahoo.com'}]\n msg = self.user.login(\"legionless@yahoo.com\", \"legendchrome\")\n ...
[ "0.8411852", "0.83811635", "0.8224439", "0.8200195", "0.8183245", "0.8173796", "0.8154915", "0.8139339", "0.8135236", "0.8119886", "0.805759", "0.80476487", "0.8045582", "0.80402976", "0.8030678", "0.80058366", "0.7988527", "0.7979262", "0.7918317", "0.7917536", "0.78995436",...
0.7617234
39
Get output value from Cloudformation Stack Output.
def get_stack_output_value(stack_outputs, output_key): return next((o.get("OutputValue") for o in stack_outputs if o.get("OutputKey") == output_key), None)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getvalue(self):\n return self.out.getvalue()", "def get_output(self):\n return self.output", "def get_output(self):\n return self.output", "def _get_output(self):\n return self.__output", "def _get_output(self):\n return self.__output", "def _get_output(self):\n return s...
[ "0.7359112", "0.7107983", "0.7107983", "0.70380485", "0.70380485", "0.70380485", "0.70380485", "0.70380485", "0.70380485", "0.69383776", "0.6919704", "0.6915914", "0.6895299", "0.6870923", "0.6856502", "0.6724138", "0.67186224", "0.66380006", "0.66380006", "0.6619723", "0.661...
0.73151886
1
Get name of the AWS Batch Compute Environment.
def get_batch_ce(stack_name, region): outputs = get_stack(stack_name, region).get("Outputs") return get_stack_output_value(outputs, "BatchComputeEnvironmentArn")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def batch_compute_environment(self):\n return self._get_output(\"BatchComputeEnvironmentArn\")", "def environment_name(self) -> pulumi.Output[Optional[str]]:\n return pulumi.get(self, \"environment_name\")", "def environment_name(self) -> Optional[pulumi.Input[str]]:\n return pulumi.get(se...
[ "0.7524489", "0.74833506", "0.7195347", "0.7152614", "0.7085548", "0.68503153", "0.6687634", "0.6478755", "0.6469245", "0.6444927", "0.63686466", "0.6323005", "0.62782615", "0.608839", "0.60704905", "0.6059954", "0.60346663", "0.60122097", "0.5983278", "0.59497446", "0.593431...
0.7279184
2
Get max vcpus for Batch Compute Environment.
def get_batch_ce_max_size(stack_name, region): client = boto3.client("batch", region_name=region) return ( client.describe_compute_environments(computeEnvironments=[get_batch_ce(stack_name, region)]) .get("computeEnvironments")[0] .get("computeResources") .get("maxvCpus") )
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def required_vcpu_maximum(self) -> pulumi.Input[int]:\n return pulumi.get(self, \"required_vcpu_maximum\")", "def get_cpu_limit(self):\n\t\treturn call_sdk_function('PrlVmCfg_GetCpuLimit', self.handle)", "def maxcpu(self):\n return self._max_cpu['uid']", "def max_vcpu(self) -> Optional[pulumi.I...
[ "0.70387757", "0.69836414", "0.69243306", "0.68929374", "0.68929374", "0.68929374", "0.686426", "0.6831548", "0.6701743", "0.66991556", "0.6567638", "0.6546675", "0.6467022", "0.6465305", "0.64625573", "0.6384128", "0.635707", "0.635624", "0.6348419", "0.63017255", "0.6299729...
0.68717474
6
Get min vcpus for Batch Compute Environment.
def get_batch_ce_min_size(stack_name, region): client = boto3.client("batch", region_name=region) return ( client.describe_compute_environments(computeEnvironments=[get_batch_ce(stack_name, region)]) .get("computeEnvironments")[0] .get("computeResources") .get("minvCpus") )
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def required_vcpu_minimum(self) -> pulumi.Input[int]:\n return pulumi.get(self, \"required_vcpu_minimum\")", "def min_vcpu(self) -> Optional[pulumi.Input[int]]:\n return pulumi.get(self, \"min_vcpu\")", "def vcpus(self):\n return self._vcpus", "def minimum_utilization(vms_cpu):\n last...
[ "0.7276845", "0.7054659", "0.6817956", "0.67834675", "0.67478514", "0.6554041", "0.65098137", "0.64488983", "0.6415376", "0.6398567", "0.6379063", "0.6285995", "0.6285995", "0.62458074", "0.62315565", "0.6220478", "0.62007123", "0.6196512", "0.6185698", "0.6175175", "0.613256...
0.6849646
2
This function prints and plots the confusion matrix. Normalization can be applied by setting `normalize=True`.
def plot_confusion_matrix1(y_true, y_pred, classes, normalize=False, title=None, cmap=plt.cm.Blues): if not title: if normalize: title = 'Normalized confusion matrix' else: title = 'Confusion matrix...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def plot_confusion_matrix(cm, classes=[0,1], normalize=False, title='Confusion matrix', print_matrix=False):\n\n if normalize:\n cm = cm.astype('float') / cm.sum(axis=1)[:, np.newaxis]\n print(\"Normalized confusion matrix\")\n else:\n print('Confusion matrix, without normalization')\n\n...
[ "0.81942594", "0.80949026", "0.8028581", "0.8018849", "0.79934716", "0.7990885", "0.7980801", "0.79750925", "0.7960907", "0.79557455", "0.79372376", "0.7934255", "0.79340357", "0.79309034", "0.7925931", "0.7924125", "0.79232645", "0.7922545", "0.79224193", "0.79218626", "0.79...
0.0
-1
Test 'binary_search' function output when 'list_size' is not given.
def test_binary_search__without_list_size(self, sorted_list, value, expected_output): assert binary_search(sorted_list=sorted_list, value=value) == expected_output
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_binary_search__with_list_size(self, sorted_list, value, expected_output):\n assert binary_search(sorted_list=sorted_list, value=value, list_size=len(sorted_list)) == expected_output", "def binary_search(element: int, my_list: list) -> int:\n print(element, my_list)\n return -1", "def test...
[ "0.8213155", "0.7297869", "0.72307533", "0.696454", "0.69416153", "0.68789375", "0.6861085", "0.68607277", "0.68121934", "0.681102", "0.67838055", "0.6746", "0.6722702", "0.6712783", "0.6703126", "0.66664064", "0.6645655", "0.6643764", "0.6638289", "0.66064435", "0.6585002", ...
0.8040801
1
Test 'binary_search' function output when 'list_size' is given.
def test_binary_search__with_list_size(self, sorted_list, value, expected_output): assert binary_search(sorted_list=sorted_list, value=value, list_size=len(sorted_list)) == expected_output
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_binary_search__without_list_size(self, sorted_list, value, expected_output):\n assert binary_search(sorted_list=sorted_list, value=value) == expected_output", "def binary_search(element: int, my_list: list) -> int:\n print(element, my_list)\n return -1", "def test_bin_search(self):\n ...
[ "0.7917749", "0.728402", "0.7244056", "0.6969565", "0.6864497", "0.685677", "0.6855685", "0.68407494", "0.67929685", "0.67530835", "0.6735355", "0.67026436", "0.6698256", "0.66948783", "0.6681282", "0.66807884", "0.6675374", "0.66677886", "0.66438305", "0.6612023", "0.6607265...
0.8299382
0
This is a clever splitter a bracketed string on commas.
def split_on_commas(string): items = [] char_buffer = [] openings = [] for i, char in enumerate(string): if char == ',' and len(openings) == 0: items.append("".join(char_buffer)) char_buffer = [] continue elif char == ' ' and len(char_buffer) == 0: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def split_value(string):\n split = string.split(',')\n result = []\n\n level = 0\n buf = []\n for entry in split:\n level += entry.count('(')\n level -= entry.count(')')\n\n buf.append(entry)\n if level == 0:\n result.append(','.join(buf))\n buf = []\n return result", "def safe_split(...
[ "0.7087003", "0.6941837", "0.692881", "0.6877581", "0.6601857", "0.6492936", "0.64821875", "0.6443261", "0.6359068", "0.63409966", "0.62957823", "0.62753284", "0.62167627", "0.6123496", "0.6122132", "0.61207515", "0.6090295", "0.60176086", "0.60089016", "0.59985054", "0.59981...
0.7447499
0
Constructs an object from dict with its arguments. It works recursively.
def get_object(value, all_dicts, existing_objects, ignore_names, depth): if not isinstance(value, str) and isinstance(value, collections.Iterable): return [get_object(val, all_dicts, existing_objects, ignore_names, depth + 1) for val in value] if value in ignore_names: existing...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, *args, **kwargs):\n \n for arg in args:\n if isinstance(arg, dict):\n for key, value in arg.items():\n self[key] = value\n if hasattr(arg, \"__dict__\"):\n for key, value in arg.__dict__.items():\n ...
[ "0.7363922", "0.7060521", "0.6836215", "0.6763981", "0.6742099", "0.67008895", "0.6651915", "0.6651915", "0.66303325", "0.65943944", "0.6589891", "0.6587819", "0.6568071", "0.65503037", "0.65365946", "0.646451", "0.646451", "0.646451", "0.646451", "0.646451", "0.646451", "0...
0.0
-1
calculate the total duration calculate the estimated time of finish
def calculate(self): #runs = [ai # for ei in self.experiment_queues # for ai in ei.cleaned_automated_runs] # #ni = len(runs) #self.nruns = ni # for ei in self.experiment_queues: # dur=ei.stats.calculate_duration(ei.cleaned_automated_r...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def compute_go_duration(self, units='seconds'):\n go_duration = 0\n for trial in self.trials:\n max_time = 0\n for event in trial.events:\n if self.stop > max_time:\n max_time = self.stop\n\n go_duration += max_time\n\n self.go...
[ "0.70926446", "0.7081294", "0.697179", "0.69507843", "0.6926866", "0.68434364", "0.68394333", "0.6837749", "0.68218327", "0.6810191", "0.67519593", "0.675048", "0.66975707", "0.6634469", "0.6627632", "0.66139865", "0.65855575", "0.65402627", "0.6520625", "0.65056396", "0.6496...
0.66396123
13
Convert quaternion to direction cosine matrix
def quat2dcm(q): q0q0 = q[0] * q[0] q0q1 = q[0] * q[1] q0q2 = q[0] * q[2] q0q3 = q[0] * q[3] q1q1 = q[1] * q[1] q1q2 = q[1] * q[2] q1q3 = q[1] * q[3] q2q2 = q[2] * q[2] q2q3 = q[2] * q[3] q3q3 = q[3] * q[3] dcm = np.zeros((3, 3)) dcm[0, 0] = q0q0 + q1q1 - q2q2 - q3q3 ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def discrete_cosine_tranform(self, matrix):\n\n\n x = matrix.shape[0]\n y = matrix.shape[1]\n N = x\n\n #Fourier Transform matrix:\n dct = np.zeros([x,y])\n\n for u in range(0, x):\n for v in range(0, y):\n sum_ft = 0\n for i in ran...
[ "0.66580695", "0.65607804", "0.65346867", "0.652309", "0.64560556", "0.6413968", "0.6352649", "0.6324171", "0.6318788", "0.6278824", "0.6271286", "0.6270397", "0.62448883", "0.61887807", "0.618105", "0.61660475", "0.6125541", "0.6114653", "0.61141086", "0.60958725", "0.608831...
0.0
-1
Convert direction cosine matrix to quaternion
def dcm2quat(c): tr = c[0, 0] + c[1, 1] + c[2, 2] tmp = np.array([0.0, 0.0, 0.0, 0.0]) q = np.array([0.0, 0.0, 0.0, 0.0]) if tr > 0.0: tmp[0] = 0.5 * math.sqrt(1.0 + tr) tmp[1] = 0.25 / tmp[0] * (c[1, 2] - c[2, 1]) tmp[2] = 0.25 / tmp[0] * (c[2, 0] - c[0, 2]) tmp[3] = 0.2...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def rotation_matrix_to_quaternion(rotation_matrix):\n trace = np.trace(rotation_matrix)\n\n if trace > 0:\n S = np.sqrt(trace + 1) * 2\n q_w = 0.25 * S\n q_x = (rotation_matrix[2, 1] - rotation_matrix[1, 2]) / S\n q_y = (rotation_matrix[0, 2] - rotation_matrix[2, 0]) / S\n ...
[ "0.68373364", "0.68224347", "0.68162924", "0.67874146", "0.6777775", "0.6767355", "0.6724547", "0.67229366", "0.67100495", "0.670653", "0.6703329", "0.6693189", "0.65485203", "0.6545017", "0.6544354", "0.65303135", "0.6499667", "0.6497068", "0.6492992", "0.6444777", "0.644047...
0.0
-1
r""" Add a line between two points.
def line(self, points, ls="--", draw="black", lw=None, options=None, kwoptions=None): draw = norm_colour(draw) self.use_colour(draw) if kwoptions is None: kwoptions = {} kwopts = {'draw': draw, **kwoptions} if lw: kwopts['line width'] = lw self....
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def draw_line(self, point1, point2, line_color, line_width=2):\n if point1 is not None and point2 is not None:\n self.draw.line([point1, point2], fill=line_color, width=line_width)", "def add_line(self, point1: Point, point2: Point, counts_as_step=True, interesting=False) -> Line:\n line...
[ "0.7788793", "0.77699465", "0.7722736", "0.7555577", "0.7519624", "0.7437542", "0.74374086", "0.73878616", "0.7346435", "0.7315941", "0.72780377", "0.72275424", "0.7223007", "0.7204692", "0.71596277", "0.714067", "0.71371424", "0.7128486", "0.7105493", "0.7011613", "0.6966987...
0.6536065
45
Forward propagate in neural network.
def forwardPropagate (self, x): if type(x) is not list: x = [x] x = np.concatenate((np.array([1]),np.array(x)),axis=0) # absorb w_0 # No transformation, but needed later for i in range(self.inn): self.z_in[i] = x[i] # For every hidden neuron (1 hidden layer only!) for j in range(self.hidden): s...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_propagate_forward(self):\n nn = NeuralNet(0, 0, '', '', blank=True)\n nn.create_net(2, 1, 2, 2)\n\n # Override weights to static value for reproducibility\n for node in nn.layers[2].nodes:\n node.weights = [0.6, 0.6]\n\n for node in nn.layers[3].nodes:\n ...
[ "0.77714646", "0.7681025", "0.7555701", "0.7416648", "0.73571676", "0.73534185", "0.73300344", "0.73249763", "0.7239809", "0.7232229", "0.7220808", "0.72075504", "0.7206659", "0.7202037", "0.71377546", "0.71283215", "0.71039206", "0.7098555", "0.70828664", "0.7080173", "0.707...
0.73636156
4
Adds a new entry to the cache (or updates an existing one). The given `value` must be a Deferred. First any existing entry for the same key is invalidated. Then a new entry is added to the cache for the given key. Until the `value` completes, calls to `get()` for the key will also result in an incomplete Deferred, whic...
def set( self, key: KT, value: "defer.Deferred[VT]", callback: Optional[Callable[[], None]] = None, ) -> defer.Deferred: self.check_thread() self._pending_deferred_cache.pop(key, None) # XXX: why don't we invalidate the entry in `self.cache` yet? # ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def put(self, key, value):\n if key is None or value is None:\n raise TypeError\n\n index = self.__get_cache_set_index(key)\n cache_set = self.cache_sets[index]\n h_key = self.__ensure_hashable_key(key)\n cache_set.put(h_key, value)", "def set(self, key, value):\n ...
[ "0.7026642", "0.7004771", "0.6987272", "0.69252753", "0.6868441", "0.6822472", "0.67364615", "0.6700744", "0.661778", "0.6610266", "0.65688217", "0.6528008", "0.64307237", "0.6406921", "0.6399646", "0.6373209", "0.63273984", "0.6299945", "0.6295185", "0.6285161", "0.6271717",...
0.7725037
0
Return a sorted copy of self.items if sort_keys_function is given, a reference to self.items otherwise.
def __get_items(self, sort_keys_function=None): if sort_keys_function: return sorted(list(self.items), key=sort_keys_function) return self.items
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sort(self, key_func):\n pass", "def items(self):\n result = self._dict.keys( )\n try: result.sort( )\n except: pass\n\n return result", "def sorted_items_from_pages(cls, pages, item_key, sort_key):\n items = []\n for page in pages:\n items.extend(page[item_key])\...
[ "0.65650094", "0.62085307", "0.6045319", "0.601123", "0.59835786", "0.59764147", "0.59622014", "0.5944917", "0.59231204", "0.59231204", "0.588751", "0.57581097", "0.57288975", "0.5649811", "0.56283367", "0.5627021", "0.5613486", "0.56130195", "0.56084657", "0.5584412", "0.556...
0.8387427
0
Return a compact serialized JWT, encrypted with jwk_pub, contains the payload specified.
def encryptRequest(jwk_pub, payload): public_key = jwk.JWK() public_key.import_key(**jwk_pub) payload_bytes = payload.encode('utf-8') protected_header = { "alg": jwk_pub["alg"], "enc": "A256CBC-HS512", "typ": "JWE", "kid": jwk_pub["kid"], } jwetoken = jwe.JWE(payl...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def build_jwt(payload: dict) -> str:\n if 'sub' not in payload.keys():\n raise ValueError('sub not in payload keys')\n jwt_fields = {\n 'iss': JWT_DOMAIN,\n 'sub': None,\n 'iat': datetime.datetime.utcnow(),\n 'exp': datetime.datetime.utcnow() + datetime.timedelta(minutes=JW...
[ "0.6975268", "0.6742229", "0.6625888", "0.6465103", "0.63158345", "0.62972546", "0.6226379", "0.62231493", "0.59424096", "0.59396374", "0.5873434", "0.5805165", "0.5788745", "0.57675886", "0.57530296", "0.5726869", "0.5722263", "0.56911725", "0.567", "0.56698704", "0.5665289"...
0.73251927
0
Calculate the square area of this square.
def area(self): return self.__size ** 2
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def area(self):\n if isinstance(self.crs, GeographicalCRS):\n major_axis = self.crs.ellipsoid.a\n minor_axis = self.crs.ellipsoid.b\n\n area = 0.0\n if major_axis == minor_axis: # Sphere\n for seg in self.segment_tuples:\n x1, ...
[ "0.8116731", "0.8021345", "0.79175746", "0.79062456", "0.78909016", "0.7836819", "0.78039086", "0.7765664", "0.7760087", "0.77426183", "0.7733712", "0.7733712", "0.77046657", "0.7687867", "0.7687867", "0.7687867", "0.7680787", "0.7680787", "0.7680787", "0.76804304", "0.766480...
0.7455676
60
Get this square's size.
def size(self): return self.__size
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getSize(self):\n return self.__width * self.__height;", "def size(self) -> Point:\n\t\treturn self._size", "def get_size(self) -> Tuple2IntType:\n return self.get_width(), self.get_height()", "def size(self):\n return self.width", "def size(self):\n return self.width", "de...
[ "0.8235094", "0.8192928", "0.8046599", "0.8023048", "0.8023048", "0.8023048", "0.8023048", "0.8023048", "0.8023048", "0.8023048", "0.8013086", "0.79998666", "0.79635686", "0.7954361", "0.7931361", "0.79310584", "0.7913188", "0.7913188", "0.7913188", "0.7878363", "0.7878363", ...
0.7557618
66
builds a dictionary within keys are the lables and values are the labels address. returns code without labels.
def __generate_symboltable(self, code): code_without_lables = [] address = 0 for line in code: label_code = line.split(':') label = label_code[0] if len(label) != len(line): self.__symboltable[label] = address address += REG_SI...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_labels():\n return {\"contradiction\": 0, \"neutral\": 1, \"entailment\": 2}", "def cvpr2018_labels():\n\n return {\n 0: 'others',\n 33: 'car',\n 34: 'motorcycle',\n 35: 'bicycle',\n 36: 'pedestrian',\n 38: 'truck',\n 39: 'bus',\n 40: 'tri...
[ "0.68352485", "0.6744044", "0.65914834", "0.6556419", "0.6490247", "0.64623606", "0.6443365", "0.6436367", "0.63936144", "0.63711315", "0.6351535", "0.6334218", "0.6240272", "0.62180376", "0.6209847", "0.61736876", "0.61629504", "0.61555845", "0.61419404", "0.61378616", "0.61...
0.65288216
4
Just verifies that there are barbage bookends.
def test_all_garbage_naive(test_input): tokens = list(sp.tokenize(test_input)) assert tokens[0] is tk.START_GARBAGE assert tokens[-1] is tk.END_GARBAGE
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check_bollinger(self):\n upper, lower = self.bollinger_bands()\n if self.daily['Adj Close'][-1] > upper[-1]:\n self.debug += '\\nAbove upper bollinger: sells + 1'\n self.sells += 1\n elif self.daily['Adj Close'][-1] < lower[-1]:\n self.debug += '\\nBelow lo...
[ "0.61788213", "0.6108112", "0.6077924", "0.6067899", "0.6007031", "0.5940439", "0.593275", "0.5917848", "0.5900719", "0.5899346", "0.58922356", "0.58905864", "0.58372056", "0.58321196", "0.5801864", "0.57519513", "0.57059294", "0.56820565", "0.5648705", "0.5639352", "0.561677...
0.0
-1
Retrieve a preference from the preferences table.
def get_preference(self, name): query = "select * from preferences where name='%s'"%name old_factory = self.connection.row_factory self.connection.row_factory = sqlite3.Row result = self.connection.execute(query) self.connection.row_factory = old_factory return result.fet...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def preference(self, preference_id):\r\n url = '{0}/{1}/{2}'.format(self.get_url(), 'preferences', preference_id)\r\n return http.Request('GET', url), parsers.parse_json", "def get_preference(cls, user, preference_key, default=None):\r\n\r\n try:\r\n user_pref = cls.objects.get(us...
[ "0.6942416", "0.69032323", "0.6797332", "0.675991", "0.653308", "0.651264", "0.64487743", "0.64483804", "0.63962686", "0.6379861", "0.6197588", "0.58800167", "0.5876774", "0.5876774", "0.5876774", "0.5839583", "0.5772418", "0.5645495", "0.5495572", "0.5467834", "0.5423689", ...
0.70411336
0
Create a simple bit mask constant For 0 = INT_BITS is never set. Any of the arguments 'value' and 'fields' may either be an integer or anything iterable that yields a list of integers. Then this list is intepreted as a list of bit positions. A bit of the argument is set if its position occurs in that list and cleared o...
def smask(value, fields, width): try: value = reduce(__or__, [1 << i for i in value], 0) except TypeError: pass try: fields = reduce(__or__, [1 << i for i in fields], 0) except TypeError: pass assert width > 0 value &= (1 << width) - 1 result = sum(value << ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def to_bit_list(val, width=16):\n return [(1 if val & (1<<n) else 0) for n in range(width)]", "def bitfield(x, m):\n b = [1 if digit=='1' else 0 for digit in bin(x)[2:]]\n for i in range(len(b), m):\n b.insert(0, 0)\n return b", "def __gen_bit_values(number):\n number = int(number)\n ...
[ "0.61864305", "0.608363", "0.58695054", "0.5805953", "0.5739939", "0.5700118", "0.5658895", "0.5626569", "0.5578519", "0.5566929", "0.5562754", "0.55412966", "0.55044264", "0.55010396", "0.54860985", "0.5457635", "0.5439364", "0.54261035", "0.5401782", "0.53974694", "0.538177...
0.69737273
0
Returns the jth bit of some integer x.
def get_jth_bit(x,j): return 1 & (x >> j)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_bit(x, k):\n\n return (x >> k) & 1", "def bitget(x, n):\n return (x >> n) & 1", "def bit_component(x, i):\n return (x & 2**i) >> i", "def get_bit(num, i):\r\n return 1 if num & 1 << i else 0", "def get_bit_position(x, k):\n\n return x & (1 << k)", "def _get_bit(byte, ii):\n retu...
[ "0.7548693", "0.7547268", "0.74635357", "0.7436001", "0.7427431", "0.704007", "0.70105994", "0.69686997", "0.6885427", "0.6746825", "0.67221785", "0.66970205", "0.6640693", "0.66244525", "0.65050757", "0.63651997", "0.6357711", "0.6262588", "0.62413913", "0.62385356", "0.6231...
0.91714257
0
Making sure user can only edit its own data or is admin
def has_object_permission(self, request, view, user): return user == request.user or request.user.is_superuser
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def user_can_edit(self, user):\n return user == self.owner", "def allow_to_edit(user):\n return allow_to_edit_well(user)", "def can_edit(self, user):\n return self.author_id == user.id or user.is_staff", "def can_be_edited(self, user):\n return (self.is_public or user == self.owner or\n ...
[ "0.82381254", "0.81133103", "0.7999226", "0.78257686", "0.7718198", "0.7687879", "0.7479964", "0.746136", "0.7449015", "0.73710394", "0.73180443", "0.73020744", "0.7274091", "0.72605646", "0.7253949", "0.7253949", "0.7216187", "0.717669", "0.7173641", "0.7140701", "0.7136045"...
0.0
-1
Get date `days` prior to now
def now_minus(days: int): return NOW - datetime.timedelta(days=days)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_days_old(days):\n days = int(days)\n current_time = datetime.datetime.today()\n days_after = datetime.timedelta(days)\n new_date = current_time - days_after\n new_date = new_date.strftime(\"%d-%b-%Y\")\n return new_date", "def work_days_since_now(days, obj=None):\n if not obj:\n ...
[ "0.73465645", "0.7027633", "0.66208833", "0.63736963", "0.6271845", "0.62162435", "0.6148046", "0.6059862", "0.6023177", "0.6021657", "0.6019026", "0.59926295", "0.5979607", "0.59739095", "0.59383035", "0.58844876", "0.5883085", "0.5863172", "0.57756144", "0.5771532", "0.5721...
0.7077111
1
Set up an additional unrestricted course.
def setup_unrelated_section_with_unrestricted(enrollment_open=True): setup_unrelated_section(enrollment_open) cs70 = Course.objects.create( name="CS70", title="Discrete Mathematics and Probability Theory", permitted_absences=2, enrollment_start=now_minus(30), section_sta...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def setup_whitelisted_section_with_unrestricted():\n setup_unrelated_section_with_unrestricted()\n\n # whitelist user to the course\n cs61a = Course.objects.get(name=\"CS61A\")\n user = User.objects.get(username=\"demo_user\")\n cs61a.whitelist.add(user)", "def setup_course(self, enable_proctored_...
[ "0.6447096", "0.6399543", "0.63562423", "0.6181124", "0.614486", "0.60967875", "0.6094031", "0.60368544", "0.601078", "0.59599197", "0.5838744", "0.5771312", "0.5738835", "0.56994134", "0.5686674", "0.56768376", "0.5665374", "0.5663493", "0.56092924", "0.5598741", "0.55962765...
0.6072855
7
Split a dataset created by `build_dataset` into train, validation, and test.
def build_splits(dataset, train_size, valid_size, by=['context_id'], seed=17): if isinstance(seed, RandomState): rng = seed else: rng = RandomState(seed) groups = dataset.groupby(by).groups context_ids = groups.keys() train_ids, other_ids = sklearn.cross_validation.train_test_split...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __split_dataset(self):\n self.train, self.valid, _, _ = train_test_split(self.data, self.data, test_size=0.2)\n self.valid, self.test, _, _ = train_test_split(self.valid, self.valid, test_size=0.5)", "def split_dataset(self, test_size=0.20):\n\t\t(self.training_data, self.test_data, self.traini...
[ "0.8747397", "0.8218218", "0.8070561", "0.8017714", "0.78676575", "0.7845084", "0.77808815", "0.77740973", "0.7759789", "0.7758375", "0.7719695", "0.7717822", "0.76652384", "0.76652384", "0.76652384", "0.76422524", "0.7579486", "0.7563735", "0.7562512", "0.7559233", "0.755842...
0.6914674
94
Returns starting state of the board.
def initial_state(): return [[EMPTY, EMPTY, EMPTY], [EMPTY, EMPTY, EMPTY], [EMPTY, EMPTY, EMPTY]]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def start_state(self):\r\n return np.zeros(self.board_size, dtype=np.int8)", "def start_state():\n return chess.Board()", "def startingState(self):\n # Returns starting position and 4 false because no corners are visited yet\n return (self.startingPosition, (False, False, False, False))...
[ "0.8081514", "0.7890486", "0.7534929", "0.72789717", "0.72789717", "0.72262055", "0.72262055", "0.72262055", "0.72262055", "0.72262055", "0.72262055", "0.72262055", "0.72262055", "0.72262055", "0.72262055", "0.72262055", "0.72262055", "0.72262055", "0.72262055", "0.72262055", ...
0.0
-1
Returns player who has the next turn on a board.
def player(board): xcount, ocount = 0, 0 for row in board: xcount += row.count(X) ocount += row.count(O) if xcount > ocount: return O elif xcount == 0 and ocount == 0: return X elif xcount == ocount: return X
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def next_player(board, prev_player):\n opp = Othello.opponent(prev_player)\n if Othello.any_legal_move(opp, board):\n return opp\n elif Othello.any_legal_move(prev_player, board):\n return prev_player\n return None", "def next_player(self,board, prev_player):\r\n...
[ "0.7911148", "0.7521969", "0.74204457", "0.73687756", "0.71954805", "0.69775087", "0.69621766", "0.69253695", "0.69208723", "0.69010353", "0.6845991", "0.6841043", "0.6838282", "0.68265843", "0.67751175", "0.67751175", "0.6769739", "0.6713109", "0.67060393", "0.66561204", "0....
0.0
-1
Returns the optimal action for the current player on the board.
def minimax(board): if terminal(board): return None if player(board) == O: v = math.inf for action in actions(board): move = max_value(result(board, action)) if move < v: v = move bestMove = action else: v = -math....
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_best_action(self):\n if self.bestAction is None:\n self.calculate_best_action()\n return self.bestAction", "def getAction(self, gameState: GameState):\n _max = float(\"-inf\")\n action = None\n for move in gameState.getLegalActions(0):\n util = min...
[ "0.7766856", "0.76323676", "0.75855315", "0.75285065", "0.75175256", "0.74667144", "0.7460485", "0.74263537", "0.7416421", "0.73943585", "0.7375846", "0.7333894", "0.73147565", "0.7306611", "0.7284639", "0.72650313", "0.72650313", "0.7250975", "0.72331834", "0.7203267", "0.71...
0.6854422
65
Email must be unique.
def clean_email(self): email = self.cleaned_data['email'] email_taken = User.objects.filter(email=email).exists() if email_taken: raise forms.ValidationError( 'El email ya se encuentra en uso. Prueba otro!') return email
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def unique_email(cls, email):\n user_db = User.get_by('email', email)\n if user_db:\n raise ValueError('Sorry, this email is already taken.')\n return email", "def validate_email(self, email):\n user = User.query.filter_by(email=email.data).first()\n if user:\n ...
[ "0.8034146", "0.79687715", "0.79665846", "0.7838638", "0.78194815", "0.78161955", "0.77797836", "0.776842", "0.7745356", "0.7730995", "0.766762", "0.75578016", "0.75447583", "0.7524278", "0.751737", "0.7491981", "0.747598", "0.74174273", "0.7411199", "0.7404253", "0.7385628",...
0.7303953
27
Load counter vocabulary from the given path
def load_counter_vocab(load_path: str) -> Tuple[dict, int]: counter_vocab = dict() with open(load_path, 'r') as f: lines = f.readlines() f.close() min_val = np.inf for line in lines: key, val = line[:-1].split('\t') val = int(val) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load_vocab(path: str) -> Vocab:\n return torch.load(path, map_location=lambda storage, loc: storage)['args'].vocab", "def _load_vocab(self, path):\n self._token2id_feq = self._init_dict()\n N = len(self._token2id_feq)\n\n if path.endswith(\".json\"):\n\n with open(path, enc...
[ "0.79763305", "0.78384656", "0.7671698", "0.7663445", "0.7573136", "0.7571122", "0.7521422", "0.7487122", "0.74620986", "0.7274822", "0.7251797", "0.722215", "0.716852", "0.7168285", "0.7167479", "0.7141693", "0.7096914", "0.70602435", "0.70602435", "0.7058853", "0.7035873", ...
0.66859037
34
Input n>=6, Returns a list of primes, 2 <= p < n
def rwh_primes2(n): # flake8: noqa # http://stackoverflow.com/questions/2068372/fastest-way-to-list-all-primes-below-n-in-python/3035188#3035188 correction = (n%6>1) n = {0:n,1:n-1,2:n+4,3:n+3,4:n+2,5:n+1}[n%6] sieve = [True] * (n/3) sieve[0] = False for i in xran...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_primes(n):\n\n return list(primes_sieve(n))", "def make_primes(n):\n out_list = []\n for i in range(2, n):\n if is_prime(i):\n out_list.append(i)\n return out_list", "def list_primes(n):\n primeList = []\n for i in range(n):\n if is_prime(i):\n primeList.append(i...
[ "0.85413843", "0.84438545", "0.84063387", "0.8358301", "0.82609856", "0.8234336", "0.8213978", "0.82113606", "0.82060546", "0.8170585", "0.81014943", "0.8003272", "0.7959604", "0.79537195", "0.79436857", "0.7939605", "0.78893626", "0.78684366", "0.78684366", "0.78623396", "0....
0.7427499
50
Merge two dicts, taking into account any sub (or subsub) dicts. If ``append`` is ``True`` then list values from ``b`` will be appended to
def deep_merge(a, b, path=None, append=False): for key in b: if key in a: if isinstance(a[key], dict) and isinstance(b[key], dict): deep_merge(a[key], b[key], (path or []) + [str(key)], append) continue is_lists = isinstance(a[key], list) and isinstanc...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def merge_dicts(a, b):\n new_dict = defaultdict(list)\n add_to_dict(a, new_dict)\n add_to_dict(b, new_dict)\n return new_dict", "def _merge_a_into_b(a, b):\n for k, v in a.items():\n # a must specify keys that are in b\n # if k not in b:\n # raise KeyError('{} is not a vali...
[ "0.79051226", "0.76642966", "0.7662125", "0.7580482", "0.75309193", "0.7527764", "0.7524544", "0.75068706", "0.7453615", "0.7429557", "0.73741597", "0.7282192", "0.71952385", "0.71728355", "0.7171868", "0.7141117", "0.70951533", "0.7092275", "0.7074091", "0.706485", "0.704509...
0.7947332
0
Ensures that an empty response (no data existing) looks as expected
def test_no_events(self): result = self.client.get(BASE_URL, **headers) expected_result = { 'count': 0, 'next': None, 'previous': None, 'results': [], } self.assertDictEqual(result.data, expected_result)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def emptyresponse():\n return get_response(\"\")", "def test_none_data(self):\n with app.app_context():\n\n resp = self.client.get(\"/tracking\")\n\n resp_dict = json.loads(resp.data)\n\n self.assertIn(\"code\", resp_dict, msg=\"Error in data format return\")\n ...
[ "0.78680724", "0.74089444", "0.7224555", "0.7215111", "0.7132258", "0.7132258", "0.7132258", "0.71215427", "0.7117254", "0.70647067", "0.7045837", "0.7045837", "0.7030041", "0.69685197", "0.6957524", "0.6940881", "0.69373125", "0.68993616", "0.6890706", "0.68459165", "0.68193...
0.6671108
29
Return the trained crack detection model model_name as a PyTorch model.
def get_model(model_name: str, map_location=torch.device('cpu')): # model urls on Zenodo model_urls = {'ParallelNets': 'https://zenodo.org/record/7245516/files/ParallelNets.pth?download=1', 'UNetPath': 'https://zenodo.org/record/7245516/files/UNetPath.pth?download=1'} # check if model_nam...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load_model(model_name):\n base_url = 'http://download.tensorflow.org/models/object_detection/'\n model_file = model_name + '.tar.gz'\n model_dir = tf.keras.utils.get_file(\n fname=model_name,\n origin=base_url + model_file,\n untar=True)\n\n model_dir = pathlib.Path(model_dir)/\"saved_mode...
[ "0.7266239", "0.7246718", "0.7198765", "0.7009916", "0.69591206", "0.6835051", "0.6805664", "0.6793362", "0.6759436", "0.6725485", "0.6716065", "0.6712276", "0.66804266", "0.66671807", "0.6628213", "0.6583517", "0.6564596", "0.65435094", "0.6540137", "0.6511414", "0.6508495",...
0.6633174
14
Produce multiple train/test splits; one for each term to predict.
def produce_next_term_data(self): outputs = self.output() for termnum in self.term_range: # includes (end term + 1) test = self.test[self.test.termnum == termnum] # remove cold start recordsif requested test = self.handle_cold_start(test) term_outputs =...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def splits(cls, **kwargs):\n kwargs_copy = {x: y for x, y in kwargs.items()}\n if 'mode' not in kwargs:\n kwargs_copy['mode'] = 'answer'\n train = cls(split='train', **kwargs_copy)\n val = cls(split='val', **kwargs_copy)\n # test = cls(split='test', **kwargs_copy)\n ...
[ "0.7040474", "0.7033476", "0.68695015", "0.68544924", "0.6794504", "0.67788243", "0.6714809", "0.67039925", "0.66944", "0.66416097", "0.6636257", "0.6603873", "0.6579556", "0.6552348", "0.65489054", "0.6538527", "0.65284586", "0.65214676", "0.6497121", "0.64673036", "0.645557...
0.0
-1
Get the credentials for an AWS S3 bucket from the config
def get_config_for_bucket(self, base_url, extra_configurations=None): warnings.warn( "Use backend_config.bucket_config.BucketList.get_config_for_uri", DeprecationWarning, ) configs = S3BucketConfig.from_list(self.get("sdk.aws.s3.credentials", [])) if extra_config...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def config(self):\n credentials = dict(\n key_id=LocalConfig.AWS_IAM_KEY_ID,\n access_secret=LocalConfig.AWS_IAM_ACCESS_SECRET,\n bucket=LocalConfig.AWS_S3_BUCKET,\n region=LocalConfig.AWS_S3_REGION\n )\n return credentials", "def boto_init_s3(buck...
[ "0.7401293", "0.7139739", "0.71190107", "0.70764846", "0.69352686", "0.6786976", "0.6748679", "0.67350405", "0.66181606", "0.6580129", "0.6562272", "0.6432056", "0.6383526", "0.63632077", "0.6332116", "0.6325648", "0.6316431", "0.6290278", "0.62756586", "0.6273412", "0.624880...
0.63304776
15
Return a list of GeoJSON FeatureCollections, one for each folder in the given KML DOM node that contains geodata. Name each FeatureCollection (via a ``'name'`` attribute) according to its corresponding KML folder name.
def build_layers(node: md.Document, *, disambiguate_names: bool = True) -> list[dict]: layers = [] names = [] for i, folder in enumerate(get(node, "Folder")): name = val(get1(folder, "name")) geojson = build_feature_collection(folder, name) if geojson["features"]: layers....
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_kml_content(soup):\n rows = list()\n folders = soup.find_all(\"Folder\")\n for folder in folders:\n street_type = folder.find(\"name\").text\n placemarks = folder.find_all(\"Placemark\")\n\n for placemark in placemarks:\n street_name = placemark.find(\"name\").text\...
[ "0.59931463", "0.57473296", "0.54837584", "0.54264385", "0.5349232", "0.53135395", "0.52674234", "0.52269775", "0.5188557", "0.51497626", "0.5148375", "0.5142059", "0.5097542", "0.50583965", "0.5056761", "0.5054443", "0.50404", "0.50249636", "0.49999112", "0.4989314", "0.4952...
0.6543705
0
create dataset for game
def create_game(self, prefix='mlbam_game_*.csv', table='game'): self._create_table(prefix, table)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def generate_dataset(self):\n\t\timg_set = []\n\t\tqa_set = []\n\t\tfor i in range(self.config.dataset_size):\n\t\t\timg, r = self.generate_image()\n\t\t\tq = self.generate_question()\n\t\t\ta = self.generate_answer(r, q)\n\t\t\timg_sample = {\n\t\t\t\t'id': i,\n\t\t\t\t'image': img.tolist()\n\t\t\t}\n\t\t\timg_se...
[ "0.6981922", "0.69123244", "0.68970734", "0.67644405", "0.67595494", "0.6734721", "0.66683614", "0.657737", "0.6572859", "0.65579957", "0.6557673", "0.6547352", "0.6496475", "0.6469441", "0.6463721", "0.64585066", "0.64428973", "0.6433178", "0.6431025", "0.64026046", "0.63827...
0.0
-1
create dataset for at bat
def create_atbat(self, prefix='mlbam_atbat_*.csv', table='atbat'): self._create_table(prefix, table)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _make_data(self):\n pdf_datasets_all = make_pdf_datasets(self.pdf_list, self.xlims, self.ylims, self.tlims, self.dims, 9)\n self.pdf_dataset = np.concatenate(pdf_datasets_all, axis = 0)\n self.PDE_dataset = make_PDE_dataset(self.num_collocation, self.xlims, self.ylims, self.tlims, self.dim...
[ "0.69506156", "0.694183", "0.6827703", "0.6790787", "0.6769222", "0.6764612", "0.67497444", "0.6727607", "0.6699499", "0.66762346", "0.66536397", "0.66406584", "0.6606957", "0.6563958", "0.6543813", "0.6519169", "0.6512459", "0.6492026", "0.6487693", "0.6469414", "0.6458292",...
0.0
-1
Split the OCR list between strong and week OCR words
def split_ocr_list(token, ocr_list): # Build the sorted OCR key list and divide it into 2 different stacks ocr_words = sorted( ocr_list.iteritems(), key=operator.itemgetter(1), reverse=True ) strong_ocr_words = {tkn: sc for tkn, sc in ocr_words[:5]} weak_ocr_words = {tkn: sc...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _split(self):\n \n self._words = []\n \n # (1) Expand contractions\n text = self._text.replace(\"'m \", \" am \")\n text = text.replace(\"'d \", \" would \")\n text = text.replace(\"'ll \", \" will \")\n text = text.replace(\"'ve \", \" have \")\n ...
[ "0.6853907", "0.6817913", "0.6452549", "0.63777757", "0.63608253", "0.63170314", "0.6297859", "0.62972134", "0.6287269", "0.624447", "0.6216155", "0.6215965", "0.6214754", "0.62037134", "0.61869454", "0.61614794", "0.61082375", "0.61021996", "0.6090223", "0.6089946", "0.60740...
0.63046235
6
Get bigrams for a given paragraph
def extract_paragraph_bigrams(paragraph): p_tokens = [token for line in paragraph for token in line.tokens] bigram_list = [] for index in xrange(len(p_tokens) - 1): bigram_list.append((p_tokens[index], p_tokens[index + 1])) return bigram_list
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def bigrams(sentence):\n return [word+'_'+sentence[i+1] \n if word+'_'+sentence[i+1] in word_ids else None \n for i, word in enumerate(sentence[:-1])] if config.USE_BIGRAMS else []", "def get_bigrams(text):\n grams = bigrams(text.split())\n return_val = []\n for i,gram in en...
[ "0.7446626", "0.7404134", "0.7310858", "0.7256019", "0.72156423", "0.7027154", "0.7019086", "0.6909264", "0.68785495", "0.67863595", "0.6657198", "0.64232445", "0.63447213", "0.6317907", "0.63032377", "0.623327", "0.6158789", "0.61494464", "0.6146432", "0.60069484", "0.600281...
0.8797391
0
Extract patches from a batch.
def _batch_to_patches(batch, patches_per_image, patch_size): def py_func_random_patches(batch): """Numpy wrapper.""" batch_size, height, width, channels = batch.shape patch_count = patches_per_image * batch_size hs = patch_size // 2 # Randomly pick patches. patch_id, y, x, chan = np.ogrid[0:p...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _extract_patches(img, patch_s):\n def np_extract_patches(img):\n orig = np.array(img.shape[:2])\n new = patch_s[0] * np.ceil(orig / patch_s[0]).astype(int)\n points = new - orig\n img = np.pad(img, [(0, points[0]), (0, points[1]), (0, 0)],\n ...
[ "0.7485797", "0.6826372", "0.6648969", "0.66101336", "0.65627414", "0.63348716", "0.6318174", "0.6302266", "0.62392026", "0.6179533", "0.6169569", "0.6168421", "0.6144881", "0.6141556", "0.61148024", "0.6109674", "0.60645956", "0.60313267", "0.601871", "0.6003067", "0.5998036...
0.7123553
1
r""" Return the column index of given factor_names within the factor matrix
def index(self, factor_name): return self._factor_names.index(str(factor_name))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def find_index_column(sheet, name, num):\n for idx in range(1, 26):\n if sheet[chr(idx + 64) + str(num)].value == name:\n index_col = chr(64 + idx)\n break\n return index_col", "def getColumnIndex(boardName, bltName):\n boardDict = columnIndexDict[boardName]\n columnIndex...
[ "0.6834876", "0.6585919", "0.6485686", "0.6382064", "0.63423514", "0.63108957", "0.6226356", "0.61905175", "0.6185749", "0.6143667", "0.6127745", "0.6079973", "0.6071227", "0.6017849", "0.60173357", "0.60147285", "0.6006808", "0.599808", "0.59777707", "0.59150606", "0.5912825...
0.6841845
0
Initialize the client with an API Key
def __init__(self, api_key: str): self.api_key = api_key
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, key=None):\n self._key = key or os.environ['HERE_API_KEY']", "def __init__(self, api_key=None):\n self.api_key = api_key", "def __init__(self, api_key):\r\n self.api_key = api_key", "def __init__(self, api_key='YOUR_API_KEY'):\n self.api_key = api_key", "def _...
[ "0.7829051", "0.75544494", "0.7516165", "0.7432125", "0.7322038", "0.7314753", "0.7307343", "0.7237195", "0.7210808", "0.7133875", "0.7112169", "0.7112169", "0.7084794", "0.70515823", "0.7042389", "0.70288545", "0.6955669", "0.69442546", "0.6933308", "0.6916535", "0.68980914"...
0.7644866
1
Adds words to existing layer. Used if bot asked extra questions
def updateFrameLayer(self, words): layer = self.frames["layer " + str(self.currentFrame - 1)] for key in layer: if key != wt.sentence: if key in words: layer[key] = words[key] for k in words: layer[wt.sentence].append(k) return ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_words(self, words):\r\n for word in words:\r\n self.add(word)", "def fillFrameLayer(self, words):\n layer = self.createEmptyLayer()\n for key in layer:\n if key in words:\n layer[key] = words[key]\n for k in words:\n layer[wt.sen...
[ "0.7007041", "0.69159365", "0.6632167", "0.6557766", "0.65405285", "0.64895296", "0.6469813", "0.6429082", "0.64198816", "0.6369279", "0.63593787", "0.63573676", "0.6339228", "0.63164246", "0.6315633", "0.6291974", "0.62727416", "0.62711763", "0.6254602", "0.6254602", "0.6238...
0.7154493
0
wrap a reader to apply parers to each of its rows
def parse_rows_with(reader, parsers): for row in reader: yield parse_row(row,parsers)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parse_rows_with(reader, parsers):\n for row in reader:\n yield parse_row(row, parsers)", "def parse_rows_with(reader, parsers):\n for row in reader:\n yield parse_row(row, parsers)", "def threaded_read(self, iterable, threads=None, *args, **kwargs):\n pool = ThreadPool(threads)\n...
[ "0.7523303", "0.7523303", "0.6242199", "0.5840321", "0.5797129", "0.57709193", "0.5716572", "0.57130176", "0.5700494", "0.56732994", "0.5633637", "0.5560998", "0.55161244", "0.54972804", "0.54908144", "0.54848725", "0.5461726", "0.54429346", "0.5438724", "0.5437284", "0.54043...
0.75747836
0
Gets the display_name of this ServiceMetadata. The name of the service to be displayed in graphical clients.
def display_name(self) -> str: return self._display_name
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def service_name(self) -> str:\n return pulumi.get(self, \"service_name\")", "def service_name(self) -> str:\n return pulumi.get(self, \"service_name\")", "def display_name(self):\n return self.properties.get(\"displayName\", None)", "def get_display_name(self):\n return self.get_...
[ "0.7706127", "0.7706127", "0.76922226", "0.76341194", "0.7631448", "0.76113135", "0.7601356", "0.7601356", "0.7601356", "0.7576893", "0.75064987", "0.75033027", "0.75033027", "0.75033027", "0.75033027", "0.75033027", "0.75033027", "0.75033027", "0.75033027", "0.75033027", "0....
0.75211036
10
Sets the display_name of this ServiceMetadata. The name of the service to be displayed in graphical clients.
def display_name(self, display_name: str): self._display_name = display_name
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_display_name(self, display_name):\n self._call('set_display_name', display_name=display_name)", "def display_name(self, display_name):\n\n self._display_name = display_name", "def display_name(self, display_name):\n\n self._display_name = display_name", "def display_name(self, di...
[ "0.7810387", "0.7588699", "0.7588699", "0.7588699", "0.7588699", "0.7588699", "0.7588699", "0.7541728", "0.7541728", "0.7541728", "0.7541728", "0.7541728", "0.7541728", "0.7168064", "0.6858182", "0.67697936", "0.6592022", "0.6428837", "0.62812716", "0.62790364", "0.62740153",...
0.77234524
1
Gets the long_description of this ServiceMetadata. Long description
def long_description(self) -> str: return self._long_description
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def long_description(self):\n return self._long_description", "def long_description(self) -> pulumi.Output[str]:\n return pulumi.get(self, \"long_description\")", "def long_description(self) -> Optional[pulumi.Input[str]]:\n return pulumi.get(self, \"long_description\")", "def get_descri...
[ "0.82830656", "0.8098568", "0.7639906", "0.7426884", "0.7372168", "0.73454964", "0.7317779", "0.7314465", "0.72934425", "0.7289674", "0.7287963", "0.7287963", "0.7287963", "0.7287963", "0.7283393", "0.72669405", "0.7254336", "0.7254336", "0.7254336", "0.7254336", "0.7254336",...
0.83207494
0
Sets the long_description of this ServiceMetadata. Long description
def long_description(self, long_description: str): self._long_description = long_description
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def long_description(self, long_description):\n self._long_description = long_description", "def set_longdescription(self, longdesc):\n self.longdescription(longdesc)", "def set_description(self, desc: str) -> None:\n self.metadata.data[\"description\"] = desc", "def long_description(sel...
[ "0.86252075", "0.85648185", "0.7278801", "0.7231545", "0.7104173", "0.6927653", "0.68832606", "0.68800217", "0.68759954", "0.68585265", "0.6841331", "0.6752188", "0.6744555", "0.66710913", "0.667092", "0.66049373", "0.6594585", "0.65935886", "0.65816754", "0.65816754", "0.658...
0.8752108
0
Gets the provider_display_name of this ServiceMetadata. The name of the upstream entity providing the actual service.
def provider_display_name(self) -> str: return self._provider_display_name
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def service_provider_display_name(self) -> Optional[pulumi.Input[str]]:\n return pulumi.get(self, \"service_provider_display_name\")", "def provider_display_name(self) -> Optional[str]:\n return pulumi.get(self, \"provider_display_name\")", "def display_name(self):\n return self.properties...
[ "0.8111801", "0.78483236", "0.7210878", "0.7121034", "0.7121034", "0.7121034", "0.7121034", "0.7121034", "0.70888144", "0.70800096", "0.70505625", "0.7032679", "0.7032679", "0.7029661", "0.7018111", "0.7009852", "0.69931334", "0.69230366", "0.6909852", "0.6904565", "0.6883653...
0.8164197
0
Sets the provider_display_name of this ServiceMetadata. The name of the upstream entity providing the actual service.
def provider_display_name(self, provider_display_name: str): self._provider_display_name = provider_display_name
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_display_name(self, display_name):\n self._call('set_display_name', display_name=display_name)", "def display_name(self, display_name: str):\n\n self._display_name = display_name", "def display_name(self, display_name):\n\n self._display_name = display_name", "def display_name(sel...
[ "0.6889242", "0.68860996", "0.6861146", "0.6861146", "0.6861146", "0.6861146", "0.6861146", "0.6861146", "0.6806485", "0.6806485", "0.6806485", "0.6806485", "0.6806485", "0.6806485", "0.65425575", "0.65236896", "0.63626206", "0.6237265", "0.6187357", "0.6033415", "0.5982661",...
0.8286416
0
Gets the documentation_url of this ServiceMetadata. Link to documentation page for service.
def documentation_url(self) -> str: return self._documentation_url
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def service_url(self) -> pulumi.Output[str]:\n return pulumi.get(self, \"service_url\")", "def get_local_doc_link(self, service_name: ServiceName | None = None) -> str:\n return super().get_local_doc_link(self.service_name)", "def service_url(self) -> Optional[pulumi.Input[str]]:\n return ...
[ "0.67369115", "0.65979886", "0.6519517", "0.6519517", "0.6286966", "0.6254304", "0.6160319", "0.61544186", "0.600226", "0.600226", "0.5908017", "0.5898068", "0.5878899", "0.58771443", "0.5868847", "0.58406454", "0.5825914", "0.5698117", "0.5698117", "0.5698117", "0.56364846",...
0.7684317
0
Sets the documentation_url of this ServiceMetadata. Link to documentation page for service.
def documentation_url(self, documentation_url: str): self._documentation_url = documentation_url
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def documentation_url(self) -> str:\n return self._documentation_url", "def documentation_links(self, documentation_links):\n self._documentation_links = documentation_links", "def set_url(self, url):\n if url is not None:\n self.url = url", "def set_url(self, url):\n s...
[ "0.67688584", "0.6500196", "0.5762141", "0.56956357", "0.56630826", "0.5595282", "0.55851406", "0.5512136", "0.5512136", "0.5512136", "0.5503708", "0.53703636", "0.53703636", "0.53703636", "0.53703636", "0.53703636", "0.53703636", "0.53703636", "0.5305279", "0.52669686", "0.5...
0.78673935
0
Gets the support_url of this ServiceMetadata. Link to support for the service.
def support_url(self) -> str: return self._support_url
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def support_url(self) -> pulumi.Output[Optional[str]]:\n return pulumi.get(self, \"support_url\")", "def support_url(self) -> pulumi.Output[str]:\n return pulumi.get(self, \"support_url\")", "def support_url(self) -> Optional[pulumi.Input[str]]:\n return pulumi.get(self, \"support_url\")",...
[ "0.7421119", "0.7397372", "0.71501905", "0.71501905", "0.71501905", "0.71501905", "0.6731799", "0.66245055", "0.64698845", "0.64698845", "0.63984555", "0.6327009", "0.59074634", "0.55512846", "0.54913765", "0.54913765", "0.54775256", "0.54725623", "0.5420993", "0.54183596", "...
0.7894773
0
Sets the support_url of this ServiceMetadata. Link to support for the service.
def support_url(self, support_url: str): self._support_url = support_url
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def support_links(self, support_links):\n self._support_links = support_links", "def support_url(self) -> str:\n return self._support_url", "def support_url(self) -> Optional[pulumi.Input[str]]:\n return pulumi.get(self, \"support_url\")", "def support_url(self) -> Optional[pulumi.Input[...
[ "0.69052833", "0.6767657", "0.6273546", "0.6273546", "0.6273546", "0.6273546", "0.6230678", "0.6140376", "0.5442783", "0.54076964", "0.54076964", "0.5392213", "0.53724426", "0.52932256", "0.5244771", "0.52351326", "0.5016352", "0.49927363", "0.49778658", "0.49328423", "0.4916...
0.8192888
0
Function astar should return a iterable (list) of actions.
def test_1_return(self): plan = list(astar(self.mapp_1_s, lambda s : s == self.mapp_1_g, MAPPDistanceSum(self.mapp_1_g))) for a in plan: self.assertIsInstance(a,Action)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_actions(self, state: TState = None) -> Sequence[TAction]:\n pass", "def actions(self) -> list:\n if self.debug: print(f\"AState.actions()\")\n if not self._examined:\n if self.debug: print(f\"\\tExamining...\")\n self._actions = self._generate_actions()\n ...
[ "0.697368", "0.69245553", "0.68900996", "0.68387836", "0.67562646", "0.67102796", "0.6692585", "0.66525984", "0.66380244", "0.6632831", "0.64567167", "0.64567167", "0.64567167", "0.6452553", "0.6435109", "0.6425206", "0.63813794", "0.632707", "0.6322564", "0.63126343", "0.628...
0.5680254
74
For the given sequence s. Return all ngrams in range ngminngmax. spearator is useful for readability bos/eos symbols are added to indicate beginning and end of seqence suffix is an arbitrary string useful for distinguishing in case differernt types of ngrams if flatten is false, a list of lists is returned where the fi...
def get_ngrams(self, s, ngmin, ngmax, separator="", bos="<", eos=">", suffix="", flatten=True): # return a single dummy feature if there are no applicable ngrams # probably resulting in a mojority-class classifier if ngmax == 0 or (ngmax - ngmin < 0) : return ['__...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_ngrams(s, ngmin=1, ngmax=1, tokenizer=list, separator=\"|\"):\n ngrams = [[] for x in range(ngmin, ngmax + 1)]\n s = tokenizer(s)\n for i, ch in enumerate(s):\n for ngsize in range(ngmin, ngmax + 1):\n if (i + ngsize) <= len(s):\n ngrams[ngsize - 1].append(separato...
[ "0.737993", "0.723098", "0.69217384", "0.6508232", "0.64603055", "0.64434206", "0.6345954", "0.63276535", "0.63169324", "0.6306571", "0.6273841", "0.6272691", "0.6259866", "0.61926955", "0.6168553", "0.6141292", "0.61027175", "0.6085964", "0.60529214", "0.60115045", "0.588981...
0.7945651
0
Returns the ufunc for the specific type of arithmetic. The ufunc compilation is based on `ufunc_mode`.
def _ufunc(cls, name): if name not in cls._ufuncs: if cls.ufunc_mode == "jit-lookup": cls._ufuncs[name] = cls._ufunc_lookup(name) elif cls.ufunc_mode == "jit-calculate": cls._ufuncs[name] = cls._ufunc_calculate(name) else: cls._...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_ufunc(ufunc_method: Optional[str] = None):\n if ufunc_method:\n if ufunc_method not in Replacements._ufunc_rep:\n return None\n return Replacements._ufunc_rep[ufunc_method]\n return Replacements._ufunc_rep['ufunc']", "def get_func(op):\n if op == \"-e...
[ "0.65427226", "0.61658245", "0.6105584", "0.57668513", "0.5660608", "0.5626817", "0.55793726", "0.55596715", "0.55566645", "0.5535152", "0.5421288", "0.5406636", "0.53943187", "0.5346444", "0.5333602", "0.5329477", "0.5300095", "0.5271942", "0.52569044", "0.5145379", "0.51230...
0.6927107
0
test office creation with invalid data.
def test_office_creation_with_invalid_name(self): access_token = self.generate_admin_token() office_data = { "name":"222222#@", "Type": "federal" } response = self.client.post( "api/v2/admin/offices", data=json.dumps(office_data), ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_office_creation_with_invalid_type(self):\n access_token = self.generate_admin_token()\n create_office = {\n \"name\":\"Gubernatorial\",\n \"Type\": \"2222091\"\n }\n response = self.client.post(\n \"api/v2/admin/offices\",\n data=json...
[ "0.78008187", "0.71922565", "0.71922565", "0.7145699", "0.6641362", "0.6584707", "0.65663296", "0.65145034", "0.6514213", "0.6466452", "0.64016664", "0.63907766", "0.63731486", "0.63066244", "0.6267472", "0.6264649", "0.6216742", "0.6189517", "0.617004", "0.616418", "0.615565...
0.7696931
1