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 |
|---|---|---|---|---|---|---|
Yield Ixia device under test parameters. | def dut(request: SubRequest) -> list:
return request.param | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def YieldAllDevices(self):\n\n for deviceManagedObject in self.managedObject.config.hardware.device:\n yield Device(vm=self, managedObject=deviceManagedObject)",
"def parameters():\n device = 'cpu'\n x = torch.zeros((5, 3)).float()\n y = torch.as_tensor([2, 2, 1])\n z = n... | [
"0.6442596",
"0.6092651",
"0.6045413",
"0.6045413",
"0.5975091",
"0.5972142",
"0.5972142",
"0.58065027",
"0.57624865",
"0.57624865",
"0.57624865",
"0.57624865",
"0.5699245",
"0.5696385",
"0.56894344",
"0.56695276",
"0.5663504",
"0.564201",
"0.56029016",
"0.55992854",
"0.55828... | 0.0 | -1 |
Add a new piece to the board, checking for any collisions. | def add_piece(self):
self.active_piece = None
piece_type = random.randint(0, len(TetrisPiece.PIECE_TYPES) - 1)
max_row = 10 - TetrisPiece.get_piece_width(piece_type)
origin = (0, random.randint(0, max_row))
self.active_piece = TetrisPiece(piece_type, origin)
if self.will_... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_piece(self, piece: Model):\n new_piece_coordinates = piece.get_block_positions()\n for coordinates in new_piece_coordinates:\n if not self.piece_encompasses_coordinates(coordinates):\n continue\n else:\n print('GAME OVER')\n r... | [
"0.81793505",
"0.7599961",
"0.7518033",
"0.7451138",
"0.726917",
"0.6961271",
"0.6896302",
"0.6895165",
"0.68812835",
"0.685244",
"0.681834",
"0.6689677",
"0.6650039",
"0.66259706",
"0.6592383",
"0.6587872",
"0.6572387",
"0.65376157",
"0.6510962",
"0.65075266",
"0.6428482",
... | 0.76773125 | 1 |
Clear piece, check for collisions or endofgame, move or add piece accordingly. | def update_board_and_check_for_eog(self):
self.display_piece(clear=True)
if self.will_collide():
self.display_piece() # put the piece back
over = self.check_and_clear_rows() # clear rows, check to see if top has been reached
if over:
return over
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def remove_piece(self) -> None:\r\n if self.has_piece():\r\n self.piece.square = None\r\n self.piece = None",
"def eaten(self): # called when this piece has been 'eaten'\r\n \r\n self.board.removePiece((self.x, self.y)) # remove the 'Piece' object\r\n addr = self... | [
"0.721874",
"0.7050448",
"0.668176",
"0.660218",
"0.6560709",
"0.65276366",
"0.63666683",
"0.62939686",
"0.6277981",
"0.6260156",
"0.625871",
"0.62416744",
"0.6222894",
"0.62104034",
"0.6198583",
"0.61833644",
"0.6180516",
"0.6155805",
"0.6153217",
"0.61515146",
"0.613836",
... | 0.70252705 | 2 |
Get the origin and positon coordinates for the given direction. | def try_move(self, direction=None):
if direction == 'rotate':
return (self.origin, self.simple_rotate())
else:
return (self.get_new_origin(direction=direction), self.positions) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_new_origin(self, direction=None):\n y, x = 1, 0\n direction_coords = {'origin': (0, 0), 'right': (0, 1), 'left': (0, -1)}\n if direction and direction in direction_coords:\n y, x = direction_coords[direction]\n return (self.origin[0] + y, self.origin[1] + x)",
"def ... | [
"0.7831793",
"0.777404",
"0.73500997",
"0.7252428",
"0.71153957",
"0.6747362",
"0.673471",
"0.67101866",
"0.6648405",
"0.654322",
"0.6466127",
"0.6414452",
"0.6377974",
"0.6374477",
"0.63456035",
"0.63430977",
"0.6220082",
"0.6215305",
"0.621068",
"0.619575",
"0.61951095",
... | 0.62458473 | 16 |
Setup the integration tests environment. Specifically, create a temporary database including creating a design doc which permits reading persistant instances of Fruit | def setUpClass(cls):
# in case a previous test didn't clean itself up delete database
# totally ignoring the result
response = requests.delete(_database_url)
# create database
response = requests.put(_database_url)
assert response.status_code == httplib.CREATED
# ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def setUp(self):\n\n app.config.from_object(config['testing'])\n db.create_all()",
"def setUp(self):\n self.app = create_app()\n self.client = self.app.test_client\n self.database_name = \"trivia\"\n self.database_path = \"postgres://{}/{}\".format('localhost:5432', self... | [
"0.7805148",
"0.7790343",
"0.7766701",
"0.7757157",
"0.77365655",
"0.7732472",
"0.77260303",
"0.7725206",
"0.7725206",
"0.7718326",
"0.77182627",
"0.77164006",
"0.7714658",
"0.77143717",
"0.7711296",
"0.76689756",
"0.7666503",
"0.7665697",
"0.765087",
"0.76506215",
"0.7632643... | 0.0 | -1 |
Converts a string like MM/DD/YY or M/D/YYYY into a datetime.date instance. Checks for bad values for month number, day number. Also handles both 2 character years and 4 character years. If the year of a 2digit date is more than 5 years in the future, assume it's from the last century. >>> parse_date_from_string("1/1/17... | def get_date_from_string(datestring):
try:
month,day,year = [int(date_num) for date_num in datestring.split('/')]
except:
Exception(f"Date string ({datestring}) must be in MM/DD/YY format.")
return None
# If a 2-digit year is provided, assume it's from 1900s if it's greater
# th... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def parse_date(datestring):\n y, m, d = datestring.split('-')\n if len(y) != 4 or len(m) != 2 or len(d) != 2:\n raise InvalidDateException('Date must be of format YYYY-MM-DD')\n return datetime.date(int(y), int(m), int(d))",
"def get_date(string):\r\n string = re.sub(' +', ' ', string)\r\n ... | [
"0.76385766",
"0.74546003",
"0.73885465",
"0.7362626",
"0.7315597",
"0.73041147",
"0.72833276",
"0.72831535",
"0.72530144",
"0.7170466",
"0.71658033",
"0.7089752",
"0.7079626",
"0.70444095",
"0.7032876",
"0.7010299",
"0.70036227",
"0.6970727",
"0.6961248",
"0.6940353",
"0.693... | 0.7889843 | 0 |
A GRU layer with its own initial state. | def RHN0(size_in, size, fixed=False, **kwargs):
if fixed:
return WithH0(FixedZeros(size), RHN(size_in, size, **kwargs))
else:
return WithH0(Zeros(size), RHN(size_in, size, **kwargs)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def GRU(previous_hidden_state, x):\n # R Gate\n r = tf.sigmoid(tf.matmul(x, Wr) + \\\n tf.matmul(previous_hidden_state, Ur) + br)\n # U Gate\n u = tf.sigmoid(tf.matmul(x, Wu) + \\\n tf.matmul(previous_hidden_state, Uu) + bu)\n # Final Memory cell\n ... | [
"0.72302425",
"0.69529283",
"0.67649233",
"0.67011946",
"0.6223779",
"0.6152603",
"0.6072398",
"0.6000743",
"0.596086",
"0.59391046",
"0.59169763",
"0.5909176",
"0.58272845",
"0.5780413",
"0.577855",
"0.577855",
"0.5777796",
"0.57711107",
"0.57572025",
"0.5652791",
"0.5633420... | 0.0 | -1 |
A stacked RHN layer with its own initial state. | def StackedRHN0(size_in, size, depth, fixed=False, **kwargs):
if fixed:
return WithH0(FixedZeros(size), StackedRHN(size_in, size, depth, fixed=fixed, **kwargs))
else:
return WithH0(Zeros(size), StackedRHN(size_in, size, depth, **kwargs)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(\n self,\n input_dim: int,\n output_dim: int,\n nr_params: int,\n generic_architecture: bool,\n num_stacks: int,\n num_blocks: int,\n num_layers: int,\n layer_widths: List[int],\n expansion_coefficient_dim: int,\n trend_polyn... | [
"0.60041475",
"0.5970767",
"0.59408075",
"0.5939484",
"0.58196217",
"0.5792469",
"0.5759955",
"0.57132745",
"0.56334597",
"0.5571947",
"0.5557155",
"0.55401355",
"0.55393964",
"0.5517786",
"0.55150867",
"0.5507941",
"0.5484913",
"0.54727006",
"0.5433032",
"0.5427782",
"0.5398... | 0.5197125 | 43 |
Test POST /saleorder with the product name not in a string format | def test_add_sale_with_product_name_not_string(self):
self.register_admin_test_account()
token = self.login_admin_test()
response = self.app_test_client.post('{}/saleorder'.format(
self.base_url), json={'name': 1, 'price': 1500, 'quantity': 10, 'totalamt': ""},
headers=d... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_Product_name_cannot_contain_a_number(self):\n resp = self.admin_register()\n reply = self.admin_login()\n token = reply['token']\n product = dict(\n prod_name='NY_3',\n category='denims',\n stock=20,\n price=150\n )\n re... | [
"0.6866152",
"0.68540645",
"0.6845781",
"0.6578686",
"0.65481967",
"0.6496632",
"0.64563584",
"0.6436143",
"0.6405465",
"0.6322329",
"0.62995553",
"0.6252377",
"0.6243727",
"0.6205472",
"0.61422455",
"0.61399835",
"0.61340433",
"0.6107314",
"0.6104383",
"0.6084874",
"0.608148... | 0.82512766 | 0 |
Returns the fullyqualified component name for an unconstructed index. The ComponentData.name property assumes that the ComponentData has already been assigned to the owning Component. This is a problem during the process of constructing a ComponentData instance, as we may need to throw an exception before the Component... | def _get_indexed_component_data_name(component, index):
if not component.is_indexed():
return component.name
elif index in component._data:
ans = component._data[index].name
else:
for i in range(5):
try:
component._data[index] = component._ComponentDataCla... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_name(self):\n return COMPONENT_LIST[self.index][0]",
"def get_component_name(self):\n return self._name",
"def getComponentName(self):\n if self.componentName:\n return self.componentName\n else:\n raise Warning(\"No component name has been currently de... | [
"0.68137485",
"0.68125707",
"0.67128885",
"0.6388237",
"0.6247618",
"0.60807943",
"0.6015986",
"0.59961236",
"0.59961236",
"0.5860665",
"0.5844141",
"0.579644",
"0.5733234",
"0.5728637",
"0.5656972",
"0.5635371",
"0.5605607",
"0.55819094",
"0.5572354",
"0.55693537",
"0.555608... | 0.7990189 | 0 |
Return the number of component data objects stored by this component. | def __len__(self):
return len(self._data) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def count(self):\n return self.data_container.count",
"def count(self):\n return len(self._components)",
"def data_count(self):\n return(len(self.data))",
"def count(self):\r\n return self.data_array.size",
"def __len__(self):\n total_objs = 0\n\n if self._shelve i... | [
"0.83427936",
"0.79251295",
"0.791711",
"0.7897135",
"0.76128983",
"0.755783",
"0.74944866",
"0.7477001",
"0.74349254",
"0.7421023",
"0.7410493",
"0.73948854",
"0.73891866",
"0.7316696",
"0.7315423",
"0.7259909",
"0.7215928",
"0.7180854",
"0.71572334",
"0.7155454",
"0.7155441... | 0.0 | -1 |
Return a list (index,data) tuples from the dictionary | def items(self):
return [ (x, self[x]) for x in self ] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getidx(self, ind: Union[str, int]) -> List[Any]:\n output = []\n for data in self.data:\n output.append(data[ind])\n return output",
"def getidx(self, ind: Union[str, int]) -> List[Any]:\n output = []\n for data in self.data:\n output.append(data[ind])... | [
"0.6391741",
"0.630014",
"0.6249947",
"0.6222565",
"0.6203151",
"0.61552864",
"0.60820186",
"0.60640186",
"0.60050523",
"0.59554017",
"0.59494126",
"0.59469754",
"0.59451836",
"0.59451836",
"0.59105766",
"0.5898827",
"0.5874505",
"0.5868873",
"0.5850364",
"0.5839845",
"0.5809... | 0.0 | -1 |
This method returns the data corresponding to the given index. | def __getitem__(self, index):
if self._constructed is False:
self._not_constructed_error(index)
try:
obj = self._data.get(index, _NotFound)
except TypeError:
try:
index = self._processUnhashableIndex(index)
except TypeError:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_at_index(self, index: int) -> object:\n return self.data[index]",
"def __getitem__(self, index):\n\n if self._data_indices is not None:\n index = self._data_indices[index]\n data = self._dataset[index]\n return data",
"def __getitem__(self, index):\n return... | [
"0.8308543",
"0.82909226",
"0.8154046",
"0.8154046",
"0.81443644",
"0.80516887",
"0.80227804",
"0.79958546",
"0.7830144",
"0.7748926",
"0.77486736",
"0.77427095",
"0.7649773",
"0.7643823",
"0.7639044",
"0.7583784",
"0.7522049",
"0.7505475",
"0.7477577",
"0.7437547",
"0.742529... | 0.0 | -1 |
Set the value of a scalar component. | def set_value(self, value):
if self.is_indexed():
raise ValueError(
"Cannot set the value for the indexed component '%s' "
"without specifying an index value.\n"
"\tFor example, model.%s[i] = value"
% (self.name, self.name))
els... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def vsSetValue(self, value):\n self._vs_value = float(value)",
"def set_value(self,x):\n self._value = x",
"def set_value(self,x):\n self._value = x",
"def setUniformValue(self, *__args): # real signature unknown; restored from __doc__ with multiple overloads\n pass",
"def updat... | [
"0.6917822",
"0.6734024",
"0.6734024",
"0.67247003",
"0.6665583",
"0.6643082",
"0.6643082",
"0.65658706",
"0.65478396",
"0.6446828",
"0.642728",
"0.6409698",
"0.63459027",
"0.6342218",
"0.6342218",
"0.6338025",
"0.63356924",
"0.63278544",
"0.6323583",
"0.6318414",
"0.62774056... | 0.72975445 | 0 |
Checks if all mines have been flagged. | def won(self):
return self.mines_found == self.mines | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def mark_mines(self, cells):\r\n for cell in cells:\r\n row, col = cell\r\n self.mine_field[row][col] = 'x'\r\n self.mines_left -= 1\r\n return",
"def known_mines(self):\n self.mines",
"def all_bees_raised_flag(self):\n pos, com, success = self.perce... | [
"0.6493632",
"0.64380074",
"0.6267556",
"0.619421",
"0.5946347",
"0.5936858",
"0.5887166",
"0.5870911",
"0.5832574",
"0.5809238",
"0.57938457",
"0.5792846",
"0.5781423",
"0.576526",
"0.5747121",
"0.5709528",
"0.5687221",
"0.56182337",
"0.56159353",
"0.5607865",
"0.5598542",
... | 0.6783566 | 1 |
Returns the set of all cells in self.cells known to be mines. | def known_mines(self):
#if the length of the amount of open cells is the same as the count of bombs
if(len(self.cells) == self.count):
#the open cells are all bombs, returns the set of all bombs
return(self.cells)
else:
return set() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def known_mines(self):\n if len(self.cells)==self.count:\n return self.cells\n return set()\n #raise NotImplementedError",
"def known_mines(self):\n if len(self.cells) <= self.count:\n return self.cells\n return set([])",
"def known_mines(self):\n ... | [
"0.8837728",
"0.87650234",
"0.8293779",
"0.7944578",
"0.7944578",
"0.76535374",
"0.76535374",
"0.7336784",
"0.71533304",
"0.6954018",
"0.68953633",
"0.67344165",
"0.6729412",
"0.671902",
"0.6691797",
"0.6594178",
"0.6469754",
"0.6462674",
"0.6419005",
"0.6399146",
"0.63569474... | 0.82612735 | 3 |
Returns the set of all cells in self.cells known to be safe. | def known_safes(self):
#if the bomb count is zero
if(self.count == 0):
#all spaces are safe, which returns all spots that are safe
return (self.cells)
else:
return set() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def known_safes(self):\n if self.count==0:\n return self.cells\n return set()\n #raise NotImplementedError",
"def solved_cells(self) -> Set[Cell]:\n\t\treturn set(self.iter_solved_cells())",
"def solved_cells(self) -> Set[Cell]:\n\t\treturn set(self.iter_solved_cells())",
"def... | [
"0.8284027",
"0.82547176",
"0.82547176",
"0.80680937",
"0.79269296",
"0.79269296",
"0.77275",
"0.7600568",
"0.73750263",
"0.7241672",
"0.7190588",
"0.7186031",
"0.7054763",
"0.69567287",
"0.69553417",
"0.69521725",
"0.6919826",
"0.6766262",
"0.6711385",
"0.6693863",
"0.668020... | 0.7620657 | 7 |
This function tokenize, remove stop words and apply lower case for every word within the text | def parse_sentence(self, text):
l = []
tokens = word_tokenize(text)
print(tokens)
skip = 0
i = -1 # index of token in tokens list
for token in tokens:
i += 1
if skip:
skip -= 1
# CORONA TERMS:
elif token.lowe... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def tokenize(text):\n return [token.lower() for token in simple_preprocess(text) if token not in STOPWORDS]",
"def tokenize(text):\n # YOUR CODE HERE\n t = text.lower()\n words = re.findall(r'[a-z]+',t)\n return words",
"def process_text(text):\n words = word_tokenize(text)\n retur... | [
"0.79089206",
"0.7580526",
"0.7530961",
"0.7427596",
"0.7379424",
"0.726303",
"0.7261903",
"0.7248884",
"0.7189118",
"0.7117736",
"0.7112281",
"0.7097716",
"0.7032819",
"0.70239985",
"0.69993794",
"0.69862455",
"0.6967961",
"0.69670963",
"0.69567573",
"0.6951519",
"0.6946692"... | 0.0 | -1 |
Returns a subject type. Usually overridden. | def get_subject_type(self):
return self.subject_type | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def subject_type(cls):\n pass",
"def subject(self):\n if \"subject\" in self._prop_dict:\n return self._prop_dict[\"subject\"]\n else:\n return None",
"def get_subject(self):\n return self._subject",
"def subject(self):\n return self.__subject",
"def... | [
"0.8170716",
"0.6530187",
"0.649005",
"0.6456967",
"0.6447672",
"0.6399892",
"0.6399892",
"0.6376181",
"0.63426876",
"0.6318382",
"0.6315572",
"0.6297486",
"0.6295044",
"0.62673783",
"0.62673783",
"0.6251896",
"0.62496215",
"0.6245774",
"0.62340426",
"0.6195232",
"0.6195232",... | 0.858944 | 0 |
Checks if the two lines are counterclockwise or not | def ccw(A,B,C):
return (C[1]-A[1]) * (B[0]-A[0]) > (B[1]-A[1]) * (C[0]-A[0]) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def isclockwise(self):\n s = sum((seg[1][0] - seg[0][0]) * (seg[1][1] + seg[0][1])\n for seg in self.segment_tuples)\n return s > 0",
"def are_vertices_clockwise(self,line):\r\n \r\n import numpy as np\r\n \r\n signed_area = 0\r\n for idx in... | [
"0.7377075",
"0.7254575",
"0.7254575",
"0.7212547",
"0.7027017",
"0.6957566",
"0.67353106",
"0.6640789",
"0.66064763",
"0.6535512",
"0.6271121",
"0.62289065",
"0.6225131",
"0.62142456",
"0.6134628",
"0.611424",
"0.6074284",
"0.6033342",
"0.602314",
"0.6011843",
"0.59921724",
... | 0.0 | -1 |
Creates an empty sudoku board, with all squares unconstrained. All boards are assumed to be standard 9x9 boards. We could do better, but we don't bother for this class. | def __init__(self):
self.square_size = 3 # large squares on a side
self.size = self.square_size**2 # squares on a side
numbers = self.numbers = tuple(range(1, self.size + 1))
rows = self.rows = range(self.size)
cols = self.cols = range(self.size)
self.values = {(r,c): numbers for r in rows for... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def board_generate_empty(size: 'board size'):\n empty_board = [[None] * size for _ in range(size)]\n return empty_board",
"def empty_board(self) -> Board:\r\n\r\n board = Board()\r\n board.birth_rule = self.rule.birth_rule\r\n board.remain_rule = self.rule.remain_rule\r\n board.... | [
"0.74612266",
"0.7236352",
"0.70231503",
"0.70089436",
"0.689975",
"0.68762946",
"0.68534994",
"0.68402",
"0.68244517",
"0.6791284",
"0.6747265",
"0.6746203",
"0.66572875",
"0.6639326",
"0.6628013",
"0.66263676",
"0.66023767",
"0.65785456",
"0.6541102",
"0.6495264",
"0.649467... | 0.0 | -1 |
Searches the puzzle for a solution, returning a new puzzle. Returns False if it fails. This method always searches for the most constrained cell with no fewer than two values. Then it tries one. Calls eliminate_value, assign_value, and itself recursively. | def search(self):
best_coords = None
for coords in self.cells():
size = len(self[coords])
if size == 1:
continue
elif size == 0:
return False
elif best_coords is None or size < len(self[best_coords]):
best_coords = coords
if best_coords is None:
return ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def search2(values):\n\t# First, reduce the puzzle using the previous function\n\n\tvalues = reduce_puzzle(values)\n\tif values is False:\n\t\treturn False ## Failed earlier\n\tif all(len(values[s]) == 1 for s in boxes):\n\t\treturn values ## Solved!\n\t# Choose one of the unfilled squares with the fewest possib... | [
"0.69205964",
"0.6817561",
"0.6683235",
"0.65618116",
"0.6536601",
"0.6514179",
"0.6494681",
"0.64188534",
"0.63893497",
"0.63812643",
"0.63785964",
"0.6256235",
"0.6231573",
"0.62292516",
"0.6136523",
"0.61165506",
"0.60597014",
"0.60589486",
"0.60481894",
"0.60310954",
"0.6... | 0.7026463 | 0 |
Iterator over coordinates of all peers of this cell. All values show up exactly once. >>> peers = list(SudokuBoard().peers_for_cell((5, 8))) | def peers_for_cell(self, coords, include_self=False):
for c in self.row_for_cell(coords, include_self=include_self):
yield c
for c in self.col_for_cell(coords, include_self=False):
yield c
for c in self.square_for_cell(coords, include_self=False):
if c[0] != coords[0] and c[1] != coords[1]... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def find_peers(square):\r\n col = square[0] # letter\r\n row = square[1] # number\r\n\r\n peer_rows = \"\"\r\n if row != \"8\":\r\n # same col, higher row\r\n higher_row = rows[rows.index(row) + 1]\r\n peer_rows += higher_row\r\n if row != \"1\":\r\n # same col, lower r... | [
"0.6269286",
"0.626158",
"0.6198055",
"0.6198055",
"0.61289215",
"0.6102851",
"0.6102851",
"0.59594643",
"0.5953888",
"0.59155643",
"0.58375263",
"0.58363605",
"0.5825201",
"0.5795699",
"0.57788867",
"0.576811",
"0.5758118",
"0.5755792",
"0.5742344",
"0.5742344",
"0.57141227"... | 0.720929 | 0 |
Rowmajor iterator over cell string values. >>> s = SudokuBoard() >>> len(tuple(s.simple_cell_strings())) 81 | def simple_cell_strings(self):
return (self.simple_cell_string(self[r, c]) for r, c in self.cells()) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def iter_cells(self):\n\t\treturn iter(self._cells)",
"def srow(string, i):\r\n return string.count('\\n', 0, max(0, i)) + 1",
"def rows(self):\n for row in range(self.min_row, self.max_row+1):\n yield tuple('%s%d' % (get_column_letter(col), row)\n for col in range(self.... | [
"0.5751849",
"0.56206524",
"0.5614741",
"0.54521626",
"0.541592",
"0.53355765",
"0.52332646",
"0.52229816",
"0.519977",
"0.51212895",
"0.51184046",
"0.5105958",
"0.50956917",
"0.5069228",
"0.5052537",
"0.5033449",
"0.5030642",
"0.49616575",
"0.49607274",
"0.49421328",
"0.4916... | 0.6586542 | 0 |
Transforms a list of pauli tuples (see above) to a pauli object | def list_to_pauli(pl: List) -> Pauli:
return Pauli([tuple_to_pauli_item(t) for t in pl]) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def pauli_to_list(p: Pauli) -> List[Tuple[str, Dict]]:\n return [pauli_item_to_tuple(k, v) for k, v in p.items()]",
"def toTupple(obj):\n try:\n return tuple(map(toTupple, obj))\n except TypeError:\n return obj",
"def convert_shapely_points_to_tuples(list_of_points) -> list:\n ret... | [
"0.65130025",
"0.6030801",
"0.59366316",
"0.5726835",
"0.5566272",
"0.55603534",
"0.55564755",
"0.54984754",
"0.54663974",
"0.541458",
"0.5411233",
"0.541086",
"0.5406982",
"0.53864634",
"0.5350209",
"0.5315523",
"0.52843857",
"0.52831525",
"0.5282182",
"0.5201382",
"0.517729... | 0.7782184 | 0 |
Close the session after the request | def cleanup(_):
self.db.close() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def close_session(self):\n self.sess.close()",
"def close(self):\n\n\t\tif self._session:\n\t\t\tsid = id(self._session)\n\t\t\tself._session.close()\n\t\t\tdel self._session\n\t\t\tself._session = None\n\n\t\t\tmsg = u'Internal requests Session instance 0x{0:x} closed and cleaned up'\n\t\t\tlog_with_debu... | [
"0.8085015",
"0.8030863",
"0.79978365",
"0.7994002",
"0.7921995",
"0.786305",
"0.786305",
"0.786305",
"0.786305",
"0.786305",
"0.786305",
"0.7779977",
"0.7761692",
"0.77044094",
"0.77044094",
"0.77044094",
"0.7702862",
"0.7694431",
"0.76570606",
"0.76420754",
"0.76335114",
... | 0.0 | -1 |
View function for home page of site. | def index(request):
rep = models.repository.objects.all()
c=os.system("ipconfig")
# Render the HTML template index.html with the data in the context variable
return render(
request,
'index.html',
context={'rep' : rep,
'c' : c},
)
#
# try:
# os.makedirs... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def home(request):\n\treturn render(request, \"compta/home.html\")",
"def home_page(request):\r\n return render(request, 'ez_main/home_page.html')",
"def home(request):\r\n return render(request, 'home.html')",
"def homepage(request):\n\treturn render(request, 'core/homepage.html')",
"def homepage(req... | [
"0.8493426",
"0.84268916",
"0.83415145",
"0.83306193",
"0.82976943",
"0.8295291",
"0.8276345",
"0.82545686",
"0.82155704",
"0.8132563",
"0.81246215",
"0.81224865",
"0.8121264",
"0.81049734",
"0.8098485",
"0.80935514",
"0.80935514",
"0.80935514",
"0.80935514",
"0.80935514",
"0... | 0.0 | -1 |
Sets the is_active of this ConversationProperties. Indicates filtering for active | def is_active(self, is_active):
self._is_active = is_active | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_active(self, is_active):\n\n self._is_active = is_active",
"def is_active(self, is_active):\n\n self._is_active = is_active",
"def is_active(self, is_active):\n\n self._is_active = is_active",
"def is_active(self, is_active):\n\n self._is_active = is_active",
"def is_acti... | [
"0.7504571",
"0.7504571",
"0.7504571",
"0.7504571",
"0.7445489",
"0.7245182",
"0.72036564",
"0.71659803",
"0.71659803",
"0.71659803",
"0.71659803",
"0.71359193",
"0.70314497",
"0.69653845",
"0.6938266",
"0.67442274",
"0.67442274",
"0.67442274",
"0.67442274",
"0.66566163",
"0.... | 0.7586817 | 0 |
Gets the is_acd of this ConversationProperties. Indicates filtering for Acd | def is_acd(self):
return self._is_acd | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_acd(self, is_acd):\n \n self._is_acd = is_acd",
"def ac_dc(self):\n return self._ac_dc",
"def get_enable_aad(self) -> bool:\n\n return self._get_enable_aad(enable_validation=True)",
"def ac(self):\n return self.acWF + self.acN",
"def att_dc(self):\n return s... | [
"0.6888501",
"0.5937837",
"0.568901",
"0.5285778",
"0.51618177",
"0.5100568",
"0.49910203",
"0.49734768",
"0.49380568",
"0.49343053",
"0.49027905",
"0.48684642",
"0.4855021",
"0.4855021",
"0.48542348",
"0.48465842",
"0.48427883",
"0.48372754",
"0.48196667",
"0.48090038",
"0.4... | 0.7561592 | 0 |
Gets the is_preferred of this ConversationProperties. Indicates filtering for Preferred Agent Routing | def is_preferred(self):
return self._is_preferred | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_preferred(self, is_preferred):\n \n self._is_preferred = is_preferred",
"def preferred_name(self):\n if \"preferredName\" in self._prop_dict:\n return self._prop_dict[\"preferredName\"]\n else:\n return None",
"def async_get_preferred_item(self) -> str:\... | [
"0.7115836",
"0.5976156",
"0.5880707",
"0.5859536",
"0.57990074",
"0.57990074",
"0.57990074",
"0.53906775",
"0.5300111",
"0.51515424",
"0.50818837",
"0.5027145",
"0.4988135",
"0.49804512",
"0.49312943",
"0.4923384",
"0.4912761",
"0.4893639",
"0.484543",
"0.484543",
"0.4814501... | 0.7777058 | 0 |
Sets the is_preferred of this ConversationProperties. Indicates filtering for Preferred Agent Routing | def is_preferred(self, is_preferred):
self._is_preferred = is_preferred | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_preferred(self):\n return self._is_preferred",
"def set_preferred(self):\n ret = self._transfer(TVSetExplicit())\n return ret.data if isinstance(ret, RaspiAckMsg) and ret.ack else False",
"def __init__(__self__, *,\n preferred_shipment_type: str):\n pulumi.set... | [
"0.7067776",
"0.5893015",
"0.5731335",
"0.523945",
"0.5058889",
"0.5024821",
"0.4947714",
"0.49171615",
"0.48780215",
"0.4857559",
"0.47453335",
"0.46851364",
"0.46851364",
"0.46851364",
"0.46465725",
"0.46447065",
"0.46368694",
"0.4585764",
"0.458206",
"0.4385434",
"0.434583... | 0.8506835 | 0 |
Gets the is_cobrowse of this ConversationProperties. Indicates filtering for Cobrowse | def is_cobrowse(self):
return self._is_cobrowse | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_cobrowse(self, is_cobrowse):\n \n self._is_cobrowse = is_cobrowse",
"def connectivity_criteria(self) -> Sequence['outputs.CodelessUiConnectorConfigPropertiesResponseConnectivityCriteria']:\n return pulumi.get(self, \"connectivity_criteria\")",
"def is_in_coco(self, ade_class_idx):\n... | [
"0.6915584",
"0.51360476",
"0.5058824",
"0.5002661",
"0.48925728",
"0.48494723",
"0.48282003",
"0.47623116",
"0.47508606",
"0.47176734",
"0.46845305",
"0.46529743",
"0.46459627",
"0.46183747",
"0.45939544",
"0.4591601",
"0.45911142",
"0.45346615",
"0.45247975",
"0.45168987",
... | 0.7376189 | 0 |
Gets the is_voicemail of this ConversationProperties. Indicates filtering for Voice mail | def is_voicemail(self):
return self._is_voicemail | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_voicemail(self, is_voicemail):\n \n self._is_voicemail = is_voicemail",
"def properties(self) -> Optional[pulumi.Input['EmailChannelPropertiesArgs']]:\n return pulumi.get(self, \"properties\")",
"def filter(self, message):\n conversations = Conversations()\n conversati... | [
"0.65991914",
"0.5542406",
"0.5356935",
"0.5304338",
"0.5304338",
"0.52858937",
"0.52600074",
"0.5099811",
"0.5077588",
"0.50662273",
"0.5065224",
"0.4976182",
"0.4976182",
"0.49206367",
"0.49020338",
"0.48998857",
"0.48507115",
"0.4827808",
"0.48101872",
"0.48053735",
"0.480... | 0.74388546 | 0 |
Sets the is_voicemail of this ConversationProperties. Indicates filtering for Voice mail | def is_voicemail(self, is_voicemail):
self._is_voicemail = is_voicemail | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_voicemail(self):\n return self._is_voicemail",
"def set_receive_mail(self):\n self.__mail = True",
"def set_only_subscriber_to_cloudwatch(self, email):\n # noinspection PyBroadException\n try:\n self.unsubscribe_all_emails_from_cloudwatch()\n self.subscr... | [
"0.6563867",
"0.5104864",
"0.507653",
"0.50611854",
"0.49111873",
"0.49079064",
"0.4888318",
"0.480341",
"0.480341",
"0.4785282",
"0.4767617",
"0.47099528",
"0.46970809",
"0.4687749",
"0.46252686",
"0.46252686",
"0.46124843",
"0.46124843",
"0.45967042",
"0.4578011",
"0.456314... | 0.7847077 | 0 |
Gets the is_flagged of this ConversationProperties. Indicates filtering for flagged | def is_flagged(self):
return self._is_flagged | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def isFlagged(self):\n return self.flag",
"def _flagged(self):\n from hive.indexer.notify import NotifyType\n sql = \"\"\"SELECT 1 FROM hive_notifs\n WHERE community_id = :community_id\n AND post_id = :post_id\n AND type_id = :type_id\n ... | [
"0.67751545",
"0.6631161",
"0.6611812",
"0.61800987",
"0.59786516",
"0.5820562",
"0.56692094",
"0.55700016",
"0.5520273",
"0.5500429",
"0.53797555",
"0.5277146",
"0.52510524",
"0.5226841",
"0.5213319",
"0.5186668",
"0.51687396",
"0.5130857",
"0.51224023",
"0.512113",
"0.51045... | 0.739319 | 0 |
Gets the is_monitored of this ConversationProperties. Indicates filtering for monitored | def is_monitored(self):
return self._is_monitored | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def monitoring_enabled(self) -> bool:\n return pulumi.get(self, \"monitoring_enabled\")",
"def monitored(self):\n return self.monitor",
"def is_monitored(self, is_monitored):\n \n self._is_monitored = is_monitored",
"def monitoring(self) -> Optional[pulumi.Input['NetworkMonitoring... | [
"0.69251126",
"0.6863959",
"0.67363703",
"0.6273255",
"0.5867548",
"0.5856759",
"0.57400507",
"0.56995517",
"0.5624509",
"0.5557409",
"0.5520902",
"0.5497063",
"0.5497063",
"0.5497063",
"0.5497063",
"0.5497063",
"0.5497063",
"0.5497063",
"0.5497063",
"0.5497063",
"0.5497063",... | 0.763515 | 0 |
Gets the filter_wrap_up_notes of this ConversationProperties. Indicates filtering for WrapUpNotes | def filter_wrap_up_notes(self):
return self._filter_wrap_up_notes | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def filter_wrap_up_notes(self, filter_wrap_up_notes):\n \n self._filter_wrap_up_notes = filter_wrap_up_notes",
"def get_field_notes(self):\n return self._fields_notes",
"def filters(self) -> typing.Optional[typing.List[aws_cdk.aws_s3.NotificationKeyFilter]]:\n return self._values.ge... | [
"0.7377092",
"0.49509612",
"0.48298714",
"0.4762539",
"0.47166467",
"0.4660791",
"0.46526894",
"0.46526894",
"0.46462712",
"0.45818856",
"0.45623606",
"0.45570317",
"0.45491508",
"0.45221823",
"0.45200574",
"0.45050266",
"0.44582504",
"0.44507954",
"0.4449116",
"0.44469884",
... | 0.7466967 | 0 |
Gets the match_all of this ConversationProperties. Indicates comparison operation, TRUE indicates filters will use AND logic, FALSE indicates OR logic | def match_all(self):
return self._match_all | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _match_all(self, obj, criteria):\n return all(getattr(obj, key_, None) == value_ for\n key_, value_ in criteria.items())",
"def match_conditions(self) -> Optional[Sequence['outputs.MatchConditionPatch']]:\n return pulumi.get(self, \"match_conditions\")",
"def match_condition... | [
"0.57137614",
"0.56707865",
"0.56707865",
"0.56707865",
"0.5660724",
"0.5660724",
"0.5660724",
"0.55646306",
"0.55646306",
"0.55646306",
"0.5556013",
"0.5536039",
"0.5532944",
"0.54872745",
"0.54766136",
"0.5436146",
"0.5384559",
"0.5383307",
"0.53074306",
"0.5301113",
"0.526... | 0.6350441 | 0 |
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 | 22 |
Returns true if both objects are not equal | def __ne__(self, other):
return not self == other | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __ne__(self, other: object) -> bool:\n if self.__eq__(other):\n return False\n return True",
"def __ne__(self, other: object) -> bool:\n return not self.__eq__(other)",
"def __ne__(self, other) -> bool:\n return not self.__eq__(other)",
"def __eq__(self, other):\n ... | [
"0.845611",
"0.8391477",
"0.8144138",
"0.81410587",
"0.8132492",
"0.8093973",
"0.80920255",
"0.80920255",
"0.80920255",
"0.8085325",
"0.8085325",
"0.8076365",
"0.8076365",
"0.8065748"
] | 0.0 | -1 |
Validates that "v" is a valid URL. A valid URL has a scheme and netloc, and must begin with HTTP or HTTPS. | def validate_url(self, v):
u = urlparse.urlparse(v)
if u.scheme.lower() not in ('http', 'https'):
raise ValueError('URL scheme must be either http:// or https://')
if not u.netloc:
raise ValueError('URL must specify a network location.')
return u.scheme.lower() == 'https' | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def check_url(value):\n\n valid = validators.url(value)\n if valid != True:\n return False",
"def validate_url(ctx, param, value):\n try:\n return URL(request.urlopen(value).read())\n except ValueError:\n raise click.BadParameter('url need to be a correct URL string')",
"def ch... | [
"0.71834105",
"0.7168263",
"0.71485233",
"0.7147258",
"0.7072445",
"0.70543915",
"0.70535636",
"0.7017146",
"0.69650835",
"0.69309825",
"0.6930447",
"0.68694186",
"0.6855681",
"0.68413025",
"0.68158543",
"0.6781023",
"0.6773939",
"0.6759779",
"0.67455125",
"0.6740793",
"0.668... | 0.83832324 | 0 |
Call Dipankar's radec2txty fortran code to get the theta_x, theta_y of any point on the sky. In tests, the run time was 7 ms/call | def rd2txy(ra0, dec0, twist, ra_tran, dec_tran):
tcalc = subprocess.Popen([runconf['txycode']], stdin=subprocess.PIPE, stdout=subprocess.PIPE)
out, err = tcalc.communicate("{ra0} {dec0}\n{twist}\n{ra_tran} {dec_tran}".format(ra0=ra0, dec0=dec0, twist=twist, ra_tran=ra_tran, dec_tran=dec_tran))
junk, tx, ty... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def txy(mkffile, trigtime, ra_tran, dec_tran):\n # x = -yaw\n # y = +pitch\n # z = +roll\n\n # Read in the MKF file\n mkfdata = fits.getdata(mkffile, 1)\n sel = abs(mkfdata['time'] - trigtime) < 100\n\n # Get pitch, roll, yaw\n # yaw is minus x\n pitch = coo.SkyCoord( np.median(mkfdata['... | [
"0.60313916",
"0.5993919",
"0.5951595",
"0.5905614",
"0.5869745",
"0.582529",
"0.581961",
"0.56724423",
"0.5650988",
"0.5605783",
"0.5603801",
"0.5570931",
"0.55625063",
"0.5506125",
"0.54579246",
"0.5429721",
"0.5406192",
"0.53879267",
"0.53498566",
"0.5343755",
"0.5266286",... | 0.7158013 | 0 |
Apply a function repeatedly over multiple axes. `func` is called as `res = func(a, axis)`, where `axis` is the first element of `axes`. The result `res` of the function call must have either the same dimensions as `a` or one less dimension. If `res` has one less dimension than `a`, a dimension is inserted before `axis`... | def apply_over_axes(
func: Callable,
a: PolyLike,
axes: numpy.typing.ArrayLike,
) -> ndpoly:
@wraps(func)
def wrapper_func(array, axis):
"""Wrap func function."""
# Align indeterminants in case slicing changed them
array = numpoly.polynomial(array, names=a.indeterminants)
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def apply_along_axes(func: Callable, x: np.ndarray, axis: AxesLike, *args, **kwargs):\n axis = check_axes(axis)\n if len(axis) == x.ndim:\n return func(x)\n\n other_axes = negate_indices(axis, x.ndim)\n begin = np.arange(len(other_axes))\n\n y = np.moveaxis(x, other_axes, begin)\n result =... | [
"0.7829353",
"0.66651887",
"0.58259237",
"0.57945323",
"0.5711403",
"0.5479484",
"0.547494",
"0.5269873",
"0.5212011",
"0.5195415",
"0.51506525",
"0.51222914",
"0.5121972",
"0.5101042",
"0.49985486",
"0.49696055",
"0.49498034",
"0.49336052",
"0.49281314",
"0.49052033",
"0.489... | 0.63786274 | 2 |
Get absolute path to resource, works for dev and for PyInstaller | def base_uri(relative_path=''):
base_path = get_app_root()
if not os.path.exists(base_path):
raise ValueError('Path %s does not exist' % base_path)
return 'file://%s' % os.path.join(base_path, relative_path) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_resource_path():\n return os.path.join(os.path.dirname(__file__), \"resources\") + os.path.sep",
"def resourcePath(relative):\r\n try:\r\n # PyInstaller creates a temp folder and stores path in _MEIPASS\r\n base_path = sys._MEIPASS\r\n except Exception:\r\n base_path = os.pa... | [
"0.83695436",
"0.8280479",
"0.82485795",
"0.8139178",
"0.8114118",
"0.80985415",
"0.80940944",
"0.80797124",
"0.80677074",
"0.80673695",
"0.8062465",
"0.8062465",
"0.8062465",
"0.8062465",
"0.8062465",
"0.8062465",
"0.8062465",
"0.80569947",
"0.80545217",
"0.80448323",
"0.804... | 0.0 | -1 |
r"""Pass the inputs (and mask) through the decoder layer in turn. | def forward(self, tgt: Tensor, tgt_mask: Optional[Tensor] = None, tgt_key_padding_mask: Optional[Tensor] = None,
memory_key_padding_mask: Optional[Tensor] = None) -> Tensor:
output = tgt
for mod in self.layers:
output = mod(output, tgt_mask=tgt_mask,
tgt_key_padding_mask=tgt_key_padding_mask)
if s... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def decoder(self, embedded_inputs, decoder_input0,\n decoder_hidden0, encoder_outputs):\n pass",
"def forward(self, src, tgt, enc_mask=None, dec_mask=None):\n m, enc_embed = self.encoder(src, enc_mask)\n # mask = mask.flatten(1)\n out, dec_embed = self.decoder(tgt, m, e... | [
"0.7235789",
"0.7145312",
"0.6834111",
"0.67633355",
"0.66230416",
"0.6597164",
"0.6571882",
"0.6555677",
"0.6548023",
"0.6517882",
"0.6513875",
"0.64854544",
"0.6419834",
"0.6372243",
"0.6328442",
"0.6271399",
"0.62685806",
"0.6236459",
"0.622498",
"0.6201942",
"0.6199022",
... | 0.0 | -1 |
Returns base queryset for this resource | def get_queryset(self):
if hasattr(self, 'revision_model'):
return self.revision_model.objects
raise NotImplementedError() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_queryset(self):\n return self._queryset_class(\n model=self.model,\n using=self._db,\n hints=self._hints,\n query=CustomQuery(self.model)\n )",
"def get_queryset(self):\n if self.queryset is not None:\n queryset = self.queryset\n... | [
"0.77779263",
"0.7730914",
"0.7657614",
"0.76206297",
"0.75481856",
"0.75194126",
"0.7419215",
"0.73893255",
"0.7372042",
"0.72655195",
"0.723613",
"0.7218251",
"0.71046853",
"0.707274",
"0.707274",
"0.70679194",
"0.7055476",
"0.7037204",
"0.70052755",
"0.6966475",
"0.6794091... | 0.6774836 | 21 |
Represents TOP3 students of each course. | def top_students_table(course):
return 'COURSE {}\n'.format(course) + \
'\n'.join('{:10} --- {:4}'.format(*rate)
for rate in itertools.islice(get_rates(students_data(), course), 3)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def students(self):\n return self._parser.students",
"def students_data():\n\n return [\n {'name': 'Alexey', 'rate': 2, 'course': 'Python'},\n {'name': 'Vali', 'rate': 5, 'course': 'Java'},\n {'name': 'Olga', 'rate': 4, 'course': 'Python'},\n {'name': 'Frank', 'rate': 5, 'co... | [
"0.5634462",
"0.5622374",
"0.5542778",
"0.5496993",
"0.54112744",
"0.5400337",
"0.5370168",
"0.5316114",
"0.53160715",
"0.52984065",
"0.527276",
"0.52474356",
"0.52452624",
"0.5228922",
"0.52183497",
"0.51821125",
"0.51739925",
"0.5172258",
"0.5152828",
"0.5122374",
"0.511818... | 0.57987857 | 0 |
Simple function to return expanded homedir ssh path. | def getssh():
return Path.home() / ".ssh" | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _get_home():\n from os.path import expanduser\n home = expanduser('~')\n return home",
"def directory_resolve_home(destination):\n\n if destination[:1] == '~':\n home = expanduser(\"~\")\n return home + destination.strip('~')\n\n return destination",
"def pwd_expanduser ( fspat... | [
"0.75012106",
"0.7375469",
"0.7305328",
"0.72920835",
"0.711549",
"0.7035582",
"0.69598544",
"0.6932435",
"0.68706083",
"0.6818727",
"0.6789325",
"0.67780495",
"0.67729396",
"0.67580485",
"0.66831267",
"0.6667625",
"0.66590923",
"0.66382396",
"0.6637655",
"0.6631253",
"0.6612... | 0.7024222 | 6 |
Set group data weight to apply in fit, or reset to use default. | def setGroupDataWeight(self, groupName, weight):
if weight is not None:
if not isinstance(weight, float):
return
if weight < 0.0:
weight = 0.0
self.setGroupSetting(groupName, self._dataWeightToken, weight) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _set_group_weight(self, _group):\n\n if self.resource.CPU_avail > 0:\n _group.vCPU_weight = float(_group.vCPUs) / float(self.resource.CPU_avail)\n else:\n if _group.vCPUs > 0:\n _group.vCPU_weight = 1.0\n else:\n _group.vCPU_weight = ... | [
"0.7121807",
"0.61970884",
"0.6180696",
"0.60489124",
"0.6003693",
"0.6001366",
"0.5991676",
"0.5933279",
"0.59300786",
"0.591685",
"0.5913305",
"0.58662605",
"0.5842308",
"0.58355945",
"0.5815527",
"0.57982796",
"0.5767204",
"0.5765806",
"0.57532096",
"0.57422215",
"0.571597... | 0.7506003 | 0 |
Get group data sliding factor to apply in fit, and associated flags. If not set or inherited, gets value from default group. | def getGroupDataSlidingFactor(self, groupName):
return self.getGroupSetting(groupName, self._dataSlidingFactorToken, 0.1) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def setGroupDataSlidingFactor(self, groupName, slidingFactor):\n if slidingFactor is not None:\n if not isinstance(slidingFactor, float):\n return\n if slidingFactor < 0.0:\n slidingFactor = 0.0\n self.setGroupSetting(groupName, self._dataSlidingFac... | [
"0.55926263",
"0.52244395",
"0.51242685",
"0.5123437",
"0.50619",
"0.5057153",
"0.5012631",
"0.49966085",
"0.4901984",
"0.48807",
"0.48375717",
"0.48254406",
"0.48193222",
"0.48013005",
"0.4797572",
"0.47650075",
"0.47405055",
"0.4700925",
"0.4700925",
"0.4700925",
"0.4700925... | 0.713266 | 0 |
Set group data sliding weight to apply in fit, or reset to use default. | def setGroupDataSlidingFactor(self, groupName, slidingFactor):
if slidingFactor is not None:
if not isinstance(slidingFactor, float):
return
if slidingFactor < 0.0:
slidingFactor = 0.0
self.setGroupSetting(groupName, self._dataSlidingFactorToken, s... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def setGroupDataWeight(self, groupName, weight):\n if weight is not None:\n if not isinstance(weight, float):\n return\n if weight < 0.0:\n weight = 0.0\n self.setGroupSetting(groupName, self._dataWeightToken, weight)",
"def _set_group_weight(self... | [
"0.6789415",
"0.61482143",
"0.58837026",
"0.5856499",
"0.5762158",
"0.57009155",
"0.56606865",
"0.56040025",
"0.5515624",
"0.5486218",
"0.5478728",
"0.54659486",
"0.54659486",
"0.54659486",
"0.5460738",
"0.54591095",
"0.54362524",
"0.54191554",
"0.54127777",
"0.54115176",
"0.... | 0.5905111 | 2 |
Reads until a line that starts with prefix is found. White spaces are ignored at the beginning of each line. | def _read_until_line_startswith(self, fileobj, prefix):
line = fileobj.readline()
if not line:
raise EOFError("Read until EOF, no line with prefix {0}".format(prefix))
line = line.strip()
if line.startswith(prefix):
return line
return self._read_until_li... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def search(self, prefix: str) -> Generator[str, None, None]:\n for s in self.data:\n if s.startswith(prefix):\n yield s",
"def read_has_prefix(path):\n import shlex\n\n res = {}\n try:\n for line in yield_lines(path):\n try:\n placeholder... | [
"0.6395544",
"0.6141098",
"0.604993",
"0.6000524",
"0.59864837",
"0.5969167",
"0.5950462",
"0.5918278",
"0.5916884",
"0.5910152",
"0.5901019",
"0.5888885",
"0.5879356",
"0.58315295",
"0.58113",
"0.57753056",
"0.5756295",
"0.5755402",
"0.5753042",
"0.57501715",
"0.57487",
"0... | 0.85336155 | 0 |
Creates an NQ example from a given line of JSON. | def create_example(line, tfidf_dict, is_training, args):
sample = json.loads(line, object_pairs_hook=collections.OrderedDict)
example_id = sample['example_id']
question_text = sample['question_text']
ori_doc_tokens = sample['document_text'].split()
# 抽取特定段落list[list]
tfidf_cands_ids = tfidf_dic... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _create_examples(self, lines, set_type):\n examples = []\n for idx, line in enumerate(lines):\n item = json.loads(line.strip())\n question_id = \"%s-%s\" % (set_type, idx)\n context = item[\"context\"]\n question = item[\"question\"]\n ending... | [
"0.59797174",
"0.5712977",
"0.57061094",
"0.55309427",
"0.5518241",
"0.5444485",
"0.54036534",
"0.5326539",
"0.52897805",
"0.5282835",
"0.5269954",
"0.5259575",
"0.5255385",
"0.52392614",
"0.5224661",
"0.5213833",
"0.51939625",
"0.51741993",
"0.51586616",
"0.5149044",
"0.5126... | 0.5983817 | 0 |
Converts a list of NqExamples into InputFeatures. | def convert_examples_to_features(examples, tokenizer, is_training, args):
all_features = []
positive_features = 0
negative_features = 0
logger.info("Converting a list of NqExamples into InputFeatures ...")
for index, example in enumerate(tqdm(examples)):
example_index = example['example_id']... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def convert_examples_to_features(self):\n features = []\n for ex_index, example in enumerate(self.examples):\n if ex_index % 10000 == 0:\n logging.info(f\"Writing example {ex_index} of {len(self.examples)}\")\n\n text_to_text_query = self.processor.get_t5_prompted... | [
"0.6828898",
"0.6503475",
"0.63756305",
"0.6335112",
"0.63343316",
"0.6239382",
"0.6210884",
"0.61919194",
"0.61517143",
"0.60778326",
"0.60380775",
"0.6029647",
"0.6001922",
"0.5995936",
"0.59799063",
"0.5978592",
"0.5941132",
"0.58936656",
"0.58884954",
"0.58883405",
"0.585... | 0.76880467 | 0 |
Converts a single NqExample into a list of InputFeatures. | def convert_single_example(example, tokenizer, is_training, args):
tok_to_orig_index = []
orig_to_tok_index = []
all_doc_tokens = [] # all subtokens of original doc after tokenizing
features = []
for (i, token) in enumerate(example['paragraph_tokens']):
orig_to_tok_index.append(len(all_doc_... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def convert_examples_to_features(examples, tokenizer, is_training, args):\n all_features = []\n positive_features = 0\n negative_features = 0\n logger.info(\"Converting a list of NqExamples into InputFeatures ...\")\n for index, example in enumerate(tqdm(examples)):\n example_index = example[... | [
"0.7247394",
"0.6768353",
"0.67302716",
"0.64708793",
"0.6439057",
"0.6264856",
"0.6196543",
"0.61148566",
"0.60760826",
"0.6021851",
"0.6008571",
"0.5807679",
"0.58035696",
"0.57909995",
"0.57537794",
"0.5746831",
"0.5731237",
"0.57284915",
"0.57216185",
"0.5679827",
"0.5668... | 0.0 | -1 |
Converts a single NqExample into a list of InputFeatures. | def convert_single_ls_example(example, tokenizer, is_training, args):
tok_to_orig_index = []
orig_to_tok_index = []
all_doc_tokens = [] # all subtokens of original doc after tokenizing
features = []
for (i, token) in enumerate(example['paragraph_tokens']):
orig_to_tok_index.append(len(all_d... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def convert_examples_to_features(examples, tokenizer, is_training, args):\n all_features = []\n positive_features = 0\n negative_features = 0\n logger.info(\"Converting a list of NqExamples into InputFeatures ...\")\n for index, example in enumerate(tqdm(examples)):\n example_index = example[... | [
"0.7247394",
"0.6768353",
"0.67302716",
"0.64708793",
"0.6439057",
"0.6264856",
"0.6196543",
"0.61148566",
"0.60760826",
"0.6021851",
"0.6008571",
"0.5807679",
"0.58035696",
"0.57909995",
"0.57537794",
"0.5746831",
"0.5731237",
"0.57284915",
"0.57216185",
"0.5679827",
"0.5668... | 0.0 | -1 |
Add new variable to variable list. | def add(self, variable):
var = copy(variable)
if var.kind == STATIC:
var.id = self.static_id
self.static_id += 1
if var.kind == ARGUMENT:
var.id = self.argumen_id
self.argumen_id += 1
if var.kind == LOCAL:
var.id = self.local_i... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_variable(self, var):\n self.var_list.append(var)\n self.var_dict[var.name] = var",
"def add_variable(self, variable):\n self.variables.append(variable)",
"def add_variable(self, name):\n self.all_variables.add(name)",
"def addVar(self, var: IRVariable):\n self.vars[... | [
"0.85815775",
"0.8273379",
"0.77817684",
"0.7758989",
"0.7594978",
"0.7592587",
"0.7503674",
"0.7499143",
"0.74653935",
"0.74653935",
"0.7442741",
"0.731449",
"0.7228277",
"0.70543504",
"0.7033918",
"0.693808",
"0.6884448",
"0.68721694",
"0.66621256",
"0.6631146",
"0.6618937"... | 0.7840697 | 2 |
Calculate the heuristic value of a game state from the point of view of the given player. | def custom_score(game, player):
if game.is_loser(player):
return float("-inf")
if game.is_winner(player):
return float("inf")
# Longest Path Heuristic (used towards end game)
game_phase = len(game.get_blank_spaces()) # high if early, low if late in game
max_phase = game.width*game... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def utility(self, state, player):\n if state.isWin() or state.isLose():\n return state.getScore()\n\n # In case of cycle.\n if player == PACMAN:\n return INFINITY\n else:\n return -INFINITY",
"def calculate_utility(state, player):\n thisPlayer = pla... | [
"0.7160031",
"0.7126443",
"0.6840133",
"0.6816918",
"0.67986786",
"0.65901345",
"0.6581988",
"0.6449993",
"0.64499426",
"0.6436957",
"0.6435461",
"0.6433362",
"0.6419876",
"0.64143103",
"0.6406242",
"0.6401132",
"0.63523954",
"0.63402605",
"0.6339346",
"0.6311418",
"0.6307777... | 0.62651205 | 23 |
Calculate the heuristic value of a game state from the point of view of the given player. | def custom_score_2(game, player):
if game.is_loser(player):
return float("-inf")
if game.is_winner(player):
return float("inf")
# Aim to maximise your own available moves vs the opponent (Factor 2)
opponent = game.get_opponent(player)
return float(len(game.get_legal_moves(player)))... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def utility(self, state, player):\n if state.isWin() or state.isLose():\n return state.getScore()\n\n # In case of cycle.\n if player == PACMAN:\n return INFINITY\n else:\n return -INFINITY",
"def calculate_utility(state, player):\n thisPlayer = pla... | [
"0.71598506",
"0.71262354",
"0.68415344",
"0.6818471",
"0.6799901",
"0.659163",
"0.65834355",
"0.64511293",
"0.6450994",
"0.6438387",
"0.64348465",
"0.6434767",
"0.64199555",
"0.64140385",
"0.6407457",
"0.6402121",
"0.6353589",
"0.63418895",
"0.6340436",
"0.631257",
"0.630925... | 0.0 | -1 |
Calculate the heuristic value of a game state from the point of view of the given player. | def custom_score_3(game, player):
if game.is_loser(player):
return float("-inf")
if game.is_winner(player):
return float("inf")
game_phase = len(game.get_blank_spaces()) # high if early, low if late
# Heuristic tries to take advantage of the center and shadowing if possible, otherwise s... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def utility(self, state, player):\n if state.isWin() or state.isLose():\n return state.getScore()\n\n # In case of cycle.\n if player == PACMAN:\n return INFINITY\n else:\n return -INFINITY",
"def calculate_utility(state, player):\n thisPlayer = pla... | [
"0.7160031",
"0.7126443",
"0.6840133",
"0.6816918",
"0.67986786",
"0.65901345",
"0.6581988",
"0.6449993",
"0.64499426",
"0.6436957",
"0.6435461",
"0.6433362",
"0.6419876",
"0.64143103",
"0.6406242",
"0.6401132",
"0.63523954",
"0.63402605",
"0.6339346",
"0.6311418",
"0.6307777... | 0.5781495 | 78 |
Set of shared starting parameters used in sets below. | def _starting_hparams():
hparams = contrib_training.HParams()
hparams.add_hparam('batch_style', 'bucket')
hparams.add_hparam('gradient_clipping_decay', 0.9999)
hparams.add_hparam('learning_rate', 0.0005)
hparams.add_hparam('lr_decay_rate', .997)
hparams.add_hparam('lr_decay_steps', 1000)
hparams.add_hpara... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_test_params(cls, parameter_set=\"default\"):\n params1 = {\n \"n_clusters\": 3,\n \"n_init\": 2,\n \"max_iter\": 2,\n \"tol\": 1e-3,\n \"verbose\": False,\n \"random_state\": 2,\n }\n params2 = {\n \"n_cluster... | [
"0.60275906",
"0.5972163",
"0.59332526",
"0.5895477",
"0.5852548",
"0.58242476",
"0.57618606",
"0.56808037",
"0.56808037",
"0.5619435",
"0.5615995",
"0.56073195",
"0.55980575",
"0.55940187",
"0.5568977",
"0.5514804",
"0.5478013",
"0.54512346",
"0.54211307",
"0.54161644",
"0.5... | 0.529903 | 40 |
Check to see if a point is in a list of points | def pnt_in_list(pnt, pnts_list):
is_in = np.any([np.isclose(pnt, i) for i in pnts_list])
return is_in | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def check_point(point,points):\n if point in points:\n return True\n else:\n return False",
"def contains_point(self, point):\n assert isinstance(point, collections.Iterable), \\\n 'Invalid list of points'\n point = list(point)\n geo = self.get_geometry()\n ... | [
"0.849389",
"0.7965345",
"0.7933239",
"0.7762699",
"0.75953084",
"0.7431611",
"0.7399606",
"0.7396764",
"0.72695446",
"0.72695446",
"0.72531104",
"0.7248566",
"0.723616",
"0.72011316",
"0.7169004",
"0.7130177",
"0.7050929",
"0.70338887",
"0.7000695",
"0.69429886",
"0.6848051"... | 0.79721934 | 1 |
Test to ensure that a 401 HTTP status is returned when the venue routes are accessed without a token. | def test_unauthorized_access(flask_test_client, http_method, endpoint):
response = flask_test_client.open(
method=http_method, path=endpoint, headers=get_headers()
)
assert response.status == "401 UNAUTHORIZED"
assert response.content_type == "application/json"
assert response.json["message"... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_unauthenticated_request(self):\n url = self.get_url(self.active_user.id)\n response = self.client.get(url)\n\n expected_status_code = 401\n self.assertEqual(response.status_code, expected_status_code)",
"def test_401_unauthorized(app, client):\n\n @app.route(\"/401\")\n ... | [
"0.7793976",
"0.7655931",
"0.7649519",
"0.75368154",
"0.7519545",
"0.7478564",
"0.747356",
"0.7472062",
"0.74443305",
"0.7413576",
"0.7383135",
"0.7383135",
"0.7381803",
"0.73626494",
"0.7324727",
"0.73142487",
"0.7310352",
"0.72997266",
"0.7296236",
"0.72692466",
"0.7265526"... | 0.7714373 | 1 |
Test to ensure that a 405 HTTP status is returned when an endpoint doesn't support a particular HTTP method. | def test_http_method_not_allowed(flask_test_client, http_method, endpoint, auth, user):
token = auth.register(user.username, "password", user.email)
response = flask_test_client.open(
method=http_method, path=endpoint, headers=get_headers(token)
)
assert response.status == "405 METHOD NOT ALLOWE... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def assertHttpMethodNotAllowed(self, resp):\r\n return self.assertEqual(resp.status_code, 405)",
"def assertHttpMethodNotAllowed(self, response):\r\n self.assertEqual(response.status_code, 405)",
"def test_method_not_allowed(self):\n resp = self.app.post('/inventories/0')\n self.ass... | [
"0.8246359",
"0.81252545",
"0.78543127",
"0.7842694",
"0.7772041",
"0.7767665",
"0.77547085",
"0.7743651",
"0.77279055",
"0.7724467",
"0.7720723",
"0.76883805",
"0.76428896",
"0.7522987",
"0.74853677",
"0.74532413",
"0.74317056",
"0.7373191",
"0.73539245",
"0.7310787",
"0.725... | 0.78944427 | 2 |
Returns the state, i.e. __slots__.symbolTable to pickle or copy | def __getstate__(self):
return dict(self.items()) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __getstate__(self):\n state: Dict[str, Any] = deepcopy(self.__dict__)\n del state['__db']\n return state",
"def __getstate__(self):\n\n state = {}\n for key in self.__slots__:\n state[key] = getattr(self, key)\n\n return state",
"def __getstate__(self):\... | [
"0.7520458",
"0.7457262",
"0.7441854",
"0.74133176",
"0.7198748",
"0.7196118",
"0.71483535",
"0.7098294",
"0.7015768",
"0.7015458",
"0.7007471",
"0.698685",
"0.6975602",
"0.6964509",
"0.69574004",
"0.69511974",
"0.69392633",
"0.69331557",
"0.69257766",
"0.6911475",
"0.6911475... | 0.0 | -1 |
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(VehicleStatus, self).__init__(*args, **kwds)
#message fields cannot be None, assign default values for those that are
if self.header is None:
self.header = std_msgs.msg._Header.Header()
if self.dvl_sts is None:
self.dv... | {
"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.77938056",
"0.77205795",
"0.77205795",
"0.76868427",
"0.7626071",
"0.75641125",
"0.74400353",
"0.7417306",
"0.73512256",
"0.7308259",
"0.7279964",
"0.7237508",
"0.7226711",
"0.7224395",
"0.7224395",
"0.721927",
"0.72118485",
"0.72118485",
"0.72118485",
"0.72118485",
"0.721... | 0.0 | -1 |
Returns a two spirals dataset. | def twospirals(n_points=120, noise=1.6, twist=420):
np.random.seed(0)
n = np.sqrt(np.random.rand(n_points, 1)) * twist * (2 * np.pi) / 360
d1x = -np.cos(n) * n + np.random.rand(n_points, 1) * noise
d1y = np.sin(n) * n + np.random.rand(n_points, 1) * noise
X, T = (np.vstack((np.hs... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def generate_dataset(self):\n if self.training:\n dataset = UnpairedDataset(self.opt, self.training)\n datasetA, datasetB = dataset.generate(cacheA='./dataA.tfcache', cacheB='./dataB.tfcache')\n dataA_iter = datasetA.make_initializable_iterator()\n dataB_iter = da... | [
"0.5894746",
"0.5865438",
"0.5854711",
"0.57289904",
"0.57180935",
"0.56901115",
"0.5413855",
"0.5402727",
"0.53982645",
"0.53810596",
"0.5357855",
"0.5331315",
"0.5278988",
"0.5266876",
"0.52387667",
"0.52104783",
"0.5188914",
"0.51767844",
"0.5167833",
"0.5143393",
"0.51415... | 0.583284 | 3 |
Return a random position that belongs to the workspace | def get_random_position(self):
if self._geometry_type in ['area', 'circle']:
geo = self.get_geometry()
min_x, min_y, max_x, max_y = geo.bounds
pnt = Point(
random.uniform(min_x, max_x),
random.uniform(min_y, max_y))
while not geo.c... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _get_random_position(self):\n return (random.randrange(0, self.maze.width),\n random.randrange(0, self.maze.height))",
"def random_position(self):\n\t\treturn (random.randint(1, self.max_x-2), random.randint(1,self.max_y-2))",
"def getRandomPosition(self):\n return Position(ran... | [
"0.7790544",
"0.7725129",
"0.770671",
"0.76697016",
"0.75823677",
"0.7507445",
"0.74602723",
"0.74456334",
"0.7418125",
"0.7313001",
"0.7306448",
"0.7245586",
"0.7210506",
"0.71936977",
"0.713971",
"0.70958513",
"0.7066824",
"0.7007544",
"0.7007544",
"0.6986588",
"0.69250786"... | 0.68037677 | 28 |
Returns `datetime.tzinfo` for specified time zone. This is preferred method to obtain timezone information for construction of timezoneaware `datetime.datetime` and `datetime.time` objects. Current implementation uses `dateutil.tz` for timezone tzinfo objects, but adds metadata neccessary to store timezone regions into... | def get_timezone(timezone: str=None) -> datetime.tzinfo:
if timezone[0] in ('+', '-'):
timezone = 'UTC' + timezone
result = tz.gettz(timezone)
if result is not None and not hasattr(result, '_timezone_'):
setattr(result, '_timezone_', timezone[3:] if timezone.startswith('UTC') and len(timezon... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _get_tzinfo(zonelabel):\n return moment.tzinfo(zonelabel) if zonelabel else _get_global_tz()",
"def get_timezone(time_zone=''):\n return pytz.timezone(time_zone)",
"def timezonize(tz):\n \n # Checking if somthing is a valid pytz object is hard as it seems that they are spread around the pytz pack... | [
"0.72605795",
"0.72213215",
"0.682475",
"0.668785",
"0.66611433",
"0.65747637",
"0.6506794",
"0.64763355",
"0.6402919",
"0.63992244",
"0.6253181",
"0.62131417",
"0.6180675",
"0.6171974",
"0.6167377",
"0.61671406",
"0.61500317",
"0.6129632",
"0.6127406",
"0.61240673",
"0.60157... | 0.6727023 | 3 |
Store the documents in a dictionary based on their category. | def store_posts( fullpath, category ):
# read in the post data and store it in the posts list
post_data = read_posts( fullpath, config )
posts.extend( post_data )
# generate an appropriate num of labels for the posts
num_posts = len( post_data )
labels.extend( [category... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def initialize_category(self):\n if self.category not in self.categories.keys():\n self.docCount[self.category] = 0\n self.wordCount[self.category] = 0\n self.wordFrequencyCount[self.category] = {}\n self.categories[self.category] = True",
"def write_document_ca... | [
"0.63193625",
"0.6001501",
"0.5883108",
"0.584852",
"0.56643736",
"0.56368953",
"0.56038547",
"0.55797446",
"0.55297625",
"0.5507128",
"0.547797",
"0.5440426",
"0.537588",
"0.53615695",
"0.53569806",
"0.53069097",
"0.52963984",
"0.5289547",
"0.5285102",
"0.5284017",
"0.525116... | 0.55186254 | 9 |
Get WIF net version. | def WifNetVersion(self) -> Optional[bytes]:
return self.m_wif_net_ver | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def fw_version(self):\n return self.capabilities.get(\"fw_ver\")",
"def firmware_version(self):\n return self.data.get('fw_ver')",
"def fw_ver(self):\n return self._fw_ver",
"def get_version():\n ver = '0.0.0'\n req = restcall(0, 'config', 10.0)\n if req['text'] is not None:\n ... | [
"0.7236616",
"0.7029461",
"0.70232314",
"0.6966152",
"0.6901686",
"0.68498695",
"0.6798979",
"0.6781123",
"0.67567074",
"0.67513216",
"0.6741557",
"0.672623",
"0.6707278",
"0.6650413",
"0.6619426",
"0.6613563",
"0.6582288",
"0.6582288",
"0.65711594",
"0.65199304",
"0.6518906"... | 0.8553653 | 0 |
Get the address configuration. | def AddrConf(self) -> Dict[str, Union[bytes, str, int]]:
return self.m_addr_conf | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_address(self, ):\n return self.get_parameter('address')",
"def get_address(self):\n if self.address:\n return self.address",
"def address(self):\n return self.data.get('address')",
"def address(self) -> Optional[str]:\n return pulumi.get(self, \"address\")",
"... | [
"0.74662715",
"0.71605986",
"0.69905263",
"0.69566476",
"0.69566476",
"0.6953787",
"0.6856099",
"0.6831007",
"0.6831007",
"0.6831007",
"0.6831007",
"0.6831007",
"0.6823008",
"0.6823008",
"0.6823008",
"0.6813937",
"0.67902166",
"0.67902166",
"0.6783261",
"0.67734474",
"0.67703... | 0.6662821 | 27 |
Get the address configuration for the specified key. | def AddrConfKey(self,
key: str) -> Any:
return self.AddrConf()[key] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_service_address(key):\n if key in async_config.core_services:\n return async_config.core_services[key]\n elif key in async_config.other_services:\n return async_config.other_services[key]\n else:\n raise KeyError(\"Service not found.\")",
"def get_config(self, key):\n ... | [
"0.7104551",
"0.67072535",
"0.6682233",
"0.66728",
"0.6417282",
"0.6271873",
"0.6094169",
"0.6094153",
"0.60220206",
"0.5908621",
"0.57988083",
"0.5795214",
"0.578621",
"0.5607032",
"0.5581492",
"0.5573958",
"0.5534208",
"0.5534208",
"0.5522694",
"0.5515574",
"0.55134034",
... | 0.7424084 | 0 |
Get the address type. | def AddrType(self) -> AddrTypes:
return self.m_addr_type | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def address_type(self) -> str:\n return pulumi.get(self, \"address_type\")",
"def _get_address_type(self):\n return self.__address_type",
"def get_type(self):\n types = dict(ADDRESS_TYPE_CHOICES)\n return types.get(self.address_type, \"N/A\")",
"def _address_type(self, address):\n ... | [
"0.8874303",
"0.87839246",
"0.81880933",
"0.7018637",
"0.6908913",
"0.6815064",
"0.6478495",
"0.6357141",
"0.63225687",
"0.6275973",
"0.6275973",
"0.6248397",
"0.6209132",
"0.6173328",
"0.6160447",
"0.6135175",
"0.61149806",
"0.6072531",
"0.6071862",
"0.6055022",
"0.6054818",... | 0.7770286 | 3 |
Calculate the number of distance intervals that are required to span a redshift range. | def num_intervals_between_redshifts(zmin, zmax, interval):
# If interval is not a quantity convert it.
if not isinstance(interval, u.Quantity):
interval = interval * u.Mpc
dist_min = z_to_mpc(zmin)
dist_max = z_to_mpc(zmax)
return int((dist_max - dist_min) / interval) + 1 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def total_range_size(self) -> int:\n if not len(self):\n return 0\n regions = merge(self.data, bp=1)\n return regions.end.sum() - regions.start.sum()",
"def interval_cardinality(self):\n return len(list(self.lower_contained_intervals()))",
"def intervalLen(self):\n ... | [
"0.70071673",
"0.6673437",
"0.66419965",
"0.6226724",
"0.62109804",
"0.61210644",
"0.6110697",
"0.6110697",
"0.6110697",
"0.6082141",
"0.6054062",
"0.6022895",
"0.6008171",
"0.6004127",
"0.5966767",
"0.5966471",
"0.5950548",
"0.5949335",
"0.5946189",
"0.59320897",
"0.59261173... | 0.7284882 | 0 |
Get the indicies in an array that are below and above a sample value. | def get_adjacent_idxs(sample, array):
state = sample >= array # boolean array
# Find the index where the last "True"
# This is the idx lower than the sample
idx_lower = np.where(state)[0][-1]
# Find the index where the last "False"
# This is the first idx lower than the sample
idx_higher =... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def indices_above(a, val, extend_window: int=0, extend_dir='+'):\n idx_ = indices_below(a, val, extend_window, extend_dir)\n idx = np.ones_like(a, dtype=np.bool)\n idx[idx_] = 0\n return idx",
"def relevant_indexes(data, min_threshold):\n\n start_index = 1\n end_index = len(data) - 1\n\n for... | [
"0.6727165",
"0.64949864",
"0.6471681",
"0.63991004",
"0.6274344",
"0.6260999",
"0.6152403",
"0.61399657",
"0.6101544",
"0.59905756",
"0.5970838",
"0.5964112",
"0.5947626",
"0.59359545",
"0.5908425",
"0.58163524",
"0.57865375",
"0.578219",
"0.5746386",
"0.570638",
"0.5685449"... | 0.73517704 | 0 |
check if the queue is empty | def is_empty(self):
return len(self.queue) == 0 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_empty(self):\n return self.queue == []",
"def is_empty(self):\n return len(self.__queue) > 0",
"def is_empty(self):\n return len(self.the_queue) == 0",
"def empty(self) -> bool: \n if(self.queue is not None and len(self.queue) > 0):\n print(\"len > 0\" )\n ... | [
"0.89451194",
"0.8811173",
"0.8789866",
"0.8777337",
"0.8762785",
"0.86449736",
"0.8636121",
"0.8611648",
"0.85818523",
"0.85437196",
"0.8490897",
"0.8481525",
"0.84501827",
"0.8440654",
"0.84132296",
"0.837033",
"0.837033",
"0.8358739",
"0.8269702",
"0.82307273",
"0.81943995... | 0.8842249 | 2 |
Returns specified group captured with regex expression. Will return empty string if nothing was captured. | def capture_group(text: AnsibleUnsafeText, re_pattern: str, group=0) -> str:
match_group = ''
try:
match_group = re.search(re_pattern, str(text)).group(group)
except AttributeError as ae:
print(type(ae).__name__)
traceback.print_stack()
return to_text(match_group) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getMatch(reMatch,group=0):\n if reMatch: return reMatch.group(group)\n else: return ''",
"def group(self, group_num):\n if self.rematch is None:\n return None\n else:\n return self.rematch.group(group_num)",
"def getStrGroup(self, groupname, default=None):\n ... | [
"0.8038382",
"0.77659553",
"0.72354597",
"0.66867477",
"0.66866314",
"0.64693624",
"0.63743716",
"0.62678427",
"0.6130281",
"0.6049779",
"0.57115763",
"0.567673",
"0.5657032",
"0.56527543",
"0.56098056",
"0.56005913",
"0.55942506",
"0.5582762",
"0.55608374",
"0.5553124",
"0.5... | 0.76422125 | 2 |
The purpose of this function is to parse the gold standard lexicon to get the appropriate feature mappings for a given word. The return value is a dictionary, where the key is the word and the value is a list of features it maps to. | def utt_to_scene(file_name):
with open(file_name, 'r') as file:
data = file.readlines()
data = [line.strip().split() for line in data if line.strip() != '']
data = [[line[0], " ".join(line[1:])] for line in data]
preproc_data = [[line[0], list(map(lambda x: x[:x.find(":")], line[1].s... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_words(tokens,name_space):\n\tdefined_words = {}\n\tcurrent_word = []\n\tfound_word = 0\n\timport_called = 0\n\tfor token in tokens:\n\t\tif import_called:\n\t\t\timport_called = 0\n\t\t\ttoken = \"..\\\\\" + token+\".pyfth\"\n\t\t\tname = token\n\t\t\t#print token\n\t\t\timported_program = open(token)\n\t\... | [
"0.61936915",
"0.61844796",
"0.6029985",
"0.59759885",
"0.59741163",
"0.59542894",
"0.5913094",
"0.578947",
"0.5753829",
"0.5730868",
"0.56554586",
"0.5640487",
"0.5599006",
"0.5590582",
"0.5589866",
"0.5570175",
"0.55624926",
"0.5558062",
"0.55496264",
"0.5541655",
"0.55378"... | 0.0 | -1 |
Asks user to specify a city, month, and day to analyze. | def get_filters():
print('Hello! Let\'s explore some US Bikeshare data!')
city, month, day = "", "", ""
# get user input for city (chicago, new york city, washington). HINT: Use a while loop to handle invalid inputs
while city not in CITY_DATA.keys():
city = input("Would you like to see data fo... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def Raw_Data(city,month,day):\n print(\"The city you have entered is: \",city)\n print(\"The month you have entered is: \",month)\n print(\"The day you have entered is: \",day)",
"def get_filters():\n city = None\n month = None\n day = None\n while day == None:\n # TO DO: get user input f... | [
"0.66714007",
"0.65354675",
"0.64593667",
"0.6374057",
"0.6348314",
"0.63097656",
"0.62868035",
"0.6259136",
"0.62316",
"0.62130964",
"0.62050414",
"0.6181105",
"0.6171822",
"0.61686903",
"0.6158568",
"0.61582303",
"0.61532456",
"0.61444426",
"0.6131269",
"0.610484",
"0.61025... | 0.5758153 | 78 |
Loads data for the specified city and filters by month and day if applicable. | def load_data(city, month, day):
file_name = CITY_DATA.get(city)
df = pd.read_csv(file_name)
# convert "Start Time" column from string to datetime
df['Start Time'] = pd.to_datetime(df['Start Time'])
# create new column "Month" by extracting the month form datetime
df['Month'] = df['Start Time'... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def load_data(city, month, day):\n df = pd.read_csv(CITY_DATA [city])\n \n # convert the Start Time column to datetime\n df['Start Time'] = pd.to_datetime(df['Start Time'])\n \n # extract month and day of week from Start Time to create new columns\n df['month'] = df['Start Time'].dt.month\n ... | [
"0.8131747",
"0.81087744",
"0.80456793",
"0.80419374",
"0.8006586",
"0.7998844",
"0.7997986",
"0.7988014",
"0.797856",
"0.79733896",
"0.7960562",
"0.79556054",
"0.794673",
"0.7945893",
"0.7907837",
"0.7907697",
"0.790398",
"0.79001075",
"0.7892662",
"0.7888655",
"0.7881675",
... | 0.80089974 | 4 |
Displays statistics on the most frequent times of travel. | def time_stats(df, month, day):
print('\nCalculating The Most Frequent Times of Travel...\n')
start_time = time.time()
# display the most common month
if month == "all":
freq_month = df['Month'].mode()[0]
print("Most common month: " + months[freq_month - 1].title())
# display the ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def time_stats(df):\n\n print('\\nDisplaying the statistics on the most frequent times of '\n 'travel...\\n')\n start_time = time.time()\n\n # display the most common month\n most_common_month = df['Month'].mode()[0]\n print('For the selected filter, the month with the most travels is: ' +\... | [
"0.80247396",
"0.80233026",
"0.7915788",
"0.78266186",
"0.7822246",
"0.78143597",
"0.77659196",
"0.7740343",
"0.773628",
"0.77344066",
"0.76867086",
"0.7668633",
"0.7651731",
"0.7644636",
"0.76399267",
"0.76367253",
"0.7625196",
"0.7623158",
"0.7612803",
"0.76002145",
"0.7583... | 0.73092353 | 56 |
Displays statistics on the most popular stations and trip. | def station_stats(df):
print('\nCalculating The Most Popular Stations and Trip...\n')
start_time = time.time()
# display most commonly used start station
freq_start_station = df['Start Station'].mode()[0]
print("Most common start station: " + freq_start_station)
# display most commonly used e... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def station_stats(df):\n\n print('\\nCalculating The Most Popular Stations and Trip...\\n')\n start_time = time.time()\n\n # display most commonly used start station\n print(popular_start_station(df))\n\n # display most commonly used end station\n print(popular_end_station(df))\n\n # display m... | [
"0.7815675",
"0.7662213",
"0.7553417",
"0.74914914",
"0.74748665",
"0.7446617",
"0.7428588",
"0.74237514",
"0.74177027",
"0.7400495",
"0.7387161",
"0.7385634",
"0.73647535",
"0.735934",
"0.73566747",
"0.73548365",
"0.7351854",
"0.7351274",
"0.73421645",
"0.7340198",
"0.733738... | 0.735057 | 18 |
Displays statistics on the total and average trip duration. | def trip_duration_stats(df):
print('\nCalculating Trip Duration...\n')
start_time = time.time()
# display total travel time
print("Total travel time: " + str(df['Trip Duration'].sum()) + " seconds")
# display mean travel time
print("Mean travel time: " + str(df['Trip Duration'].mean()) + " se... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def trip_duration_stats(data):\n print('\\nCalculating Trip Duration...\\n')\n start_time = time.time()\n # display total travel time\n total_trip_time= data['Trip Duration'].sum()\n print('The Total Travel Time is {} Hours'. format(total_trip_time/3600))\n # display mean travel time\n avg_tri... | [
"0.814274",
"0.8025143",
"0.80041367",
"0.79496753",
"0.7937415",
"0.79312176",
"0.7926815",
"0.7915187",
"0.79142886",
"0.7908032",
"0.79055744",
"0.7900715",
"0.7891682",
"0.7886722",
"0.78851086",
"0.7884266",
"0.7882474",
"0.78738385",
"0.78686154",
"0.78664047",
"0.78637... | 0.78894734 | 13 |
Computes the precision for the specified values of k | def accuracy(output, target, topk=(1,)):
maxk = max(topk)
batch_size = target.size(0)
_, pred = output.topk(maxk, 1, True, True)
pred = pred.t()
correct = pred.eq(target.view(1, -1).expand_as(pred))
res = []
for k in topk:
correct_k = correct[:k].view(-1).float().sum(0)
res... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def precision(gt, pred, k):\n k = min(len(pred), k)\n den = min(len(gt), k)\n return sum([int(pred[i] in gt) for i in range(k)]) / den",
"def precision_at_k(r, k):\n assert k >= 1\n r = np.asarray(r)[:k] != 0\n if r.size != k:\n raise ValueError('Relevance score length < k')\... | [
"0.76427615",
"0.74189496",
"0.7418079",
"0.72710466",
"0.72456723",
"0.72446615",
"0.7237539",
"0.72213703",
"0.7210107",
"0.7058935",
"0.6852219",
"0.6786084",
"0.67836976",
"0.6768417",
"0.67273885",
"0.67181736",
"0.67181736",
"0.67181736",
"0.67181736",
"0.67181736",
"0.... | 0.0 | -1 |
Does the current group expect ``word`` to complete it as a valid number? ``word`` should not be a multiplier; multiplier should be handled first. | def group_expects(self, word: str, update: bool = True) -> bool:
expected = False
if self.last_word is None:
expected = True
elif (
self.last_word in self.lang.UNITS
and self.grp_val < 10
or self.last_word in self.lang.STENS
and self.gr... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __isNumber__(self, word):\n try:\n return ('number', int(word)), True\n except ValueError:\n return None, False",
"def is_a_word(self, word):\n word = word.lower()\n if word in self.data:\n return True\n else:\n # for char in word... | [
"0.68988866",
"0.6861747",
"0.6552974",
"0.65449876",
"0.6474182",
"0.6453978",
"0.6437593",
"0.6331185",
"0.6331185",
"0.6317385",
"0.63161445",
"0.6242482",
"0.6199884",
"0.6117728",
"0.6042455",
"0.6029383",
"0.59976476",
"0.5879171",
"0.5870357",
"0.58684736",
"0.58556056... | 0.63803524 | 7 |
Push next word from the stream. Don't push punctuation marks or symbols, only words. It is the responsability of the caller to handle punctuation or any marker of pause in the word stream. The best practice is to call ``self.close()`` on such markers and start again after. Return ``True`` if ``word`` contributes to the... | def push(self, word: str, look_ahead: Optional[str] = None) -> bool:
if not word:
return False
if word == self.lang.AND and look_ahead in self.lang.AND_NUMS:
return True
word = self.lang.normalize(word)
if word not in self.lang.NUMBERS:
return False
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def push(self, word: str, look_ahead: Optional[str] = None) -> bool:\n\n if self.closed or self.is_alone(word, look_ahead):\n self.last_word = word\n return False\n\n if (\n self.signed\n and word in self.lang.SIGN\n and look_ahead in self.lang.N... | [
"0.6627346",
"0.62098104",
"0.58422065",
"0.5827979",
"0.57584083",
"0.57350934",
"0.5682934",
"0.5673294",
"0.5672968",
"0.5657437",
"0.5581136",
"0.55663216",
"0.5556809",
"0.55341023",
"0.55045664",
"0.5456405",
"0.54509974",
"0.5450989",
"0.5444797",
"0.5432706",
"0.54214... | 0.6255094 | 1 |
Overridden by NOT returning a WWWAuthenticate header This makes the browser NOT fire up the basic auth | def authenticate(self):
resp = Response(None, 401)
abort(401, description='Please provide proper credentials', response=resp) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def authenticate():\n return Response(\n '', 401, {'WWW-Authenticate': 'Basic realm=\"Login Required\"'}\n )",
"def authenticate():\n return send_msg(\n 401,\n 'Must be connected',\n headers={'WWW-Authenticate': 'Basic realm=\"Login Required\"'})",
"def authenticate():\n ... | [
"0.8038943",
"0.78765446",
"0.78745687",
"0.78736925",
"0.78638756",
"0.78489804",
"0.78120184",
"0.77674526",
"0.77008164",
"0.7640932",
"0.76325816",
"0.75824046",
"0.75824046",
"0.75824046",
"0.75824046",
"0.75824046",
"0.75824046",
"0.75824046",
"0.75824046",
"0.75824046",
... | 0.657801 | 62 |
Return a graph from a list of predecessors given by the ``pred_map`` vertex property. | def predecessor_tree(g, pred_map):
_check_prop_scalar(pred_map, "pred_map")
pg = Graph()
libgraph_tool_generation.predecessor_graph(g._Graph__graph,
pg._Graph__graph,
_prop("v", g, pred_map))
return pg | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_predecessors(vertex, graph):\n predecessors = list()\n predecessors.extend(graph.predecessors(vertex))\n return predecessors",
"def associate_predecessors(graph, node=\"\"):\n return {\n \"predecessors\": [\n {\n \"source\": pred,\n \"target\": ... | [
"0.6530018",
"0.646954",
"0.63662845",
"0.63277346",
"0.6289335",
"0.62051606",
"0.5927029",
"0.5902099",
"0.58195746",
"0.57605267",
"0.5721793",
"0.56906086",
"0.5642435",
"0.5627266",
"0.5441161",
"0.5306232",
"0.52459013",
"0.5219647",
"0.520211",
"0.5177802",
"0.51723844... | 0.74190974 | 0 |
Get distance value between source and target. | def get_distance(self, source, target, distance):
return self.graph.edges[source, target][distance] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def distance(self, source, target):\r\n raise NotImplementedError('Distance calculation not implemented yet')",
"def distance( self, source, target ):\n return nx.shortest_path_length(self._G, source, target)",
"def calculateDistance(self, source, destination):\n dx = source.getX() - desti... | [
"0.86357015",
"0.816338",
"0.79094243",
"0.7652711",
"0.7618607",
"0.750055",
"0.7400143",
"0.7283966",
"0.7221154",
"0.71957946",
"0.71592444",
"0.7085744",
"0.7023624",
"0.70014423",
"0.69745946",
"0.6973039",
"0.69729453",
"0.6954413",
"0.69203943",
"0.6914705",
"0.6897538... | 0.826244 | 1 |
This test ensures that the correct exceptions get raised when the request params are missing. | def test_get_balance_between_stocktakings_missing_params(self):
# Do a request without any params
url = "/stocktakingcollections/balance"
res = self.get(url, role="admin")
self.assertException(res, exc.InvalidData)
# Do a request with only the start id given.
params = {"... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_no_param(self) -> None:\n res = self.app.get('/model-parameters')\n self.assertEqual(400, res.status_code)",
"def test_missing_required_params():\n from scraper import get_inspection_page\n with pytest.raises(TypeError):\n get_inspection_page(only_param='val')",
"def test_re... | [
"0.7707112",
"0.7538582",
"0.73723066",
"0.7372235",
"0.72320217",
"0.70975065",
"0.70769763",
"0.7034629",
"0.7026258",
"0.70231",
"0.70097905",
"0.69894177",
"0.6974457",
"0.6973741",
"0.69325686",
"0.6913798",
"0.6903295",
"0.69026154",
"0.688556",
"0.68625075",
"0.685659"... | 0.0 | -1 |
This test ensures that the correct exceptions get raised when the request params are invalid. | def test_get_balance_between_stocktakings_invalid_params(self):
# Do a request with only the end id given.
params = {"start_id": 1, "end_id": "foo"}
url = "/stocktakingcollections/balance"
res = self.get(url, role="admin", params=params)
self.assertException(res, exc.WrongType)
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_requesting_invalid_parameters(self):\n self.parameter_store.client.get_parameters.return_value = {\n \"Parameters\": [{\"Name\": \"/test/foo\", \"Value\": \"foo_ssm_value_1\"}],\n \"InvalidParameters\": [\"/test/bar\"],\n }\n\n with self.assertRaises(\n ... | [
"0.7799408",
"0.7496017",
"0.7422954",
"0.7422467",
"0.73724174",
"0.7348175",
"0.7282196",
"0.7228323",
"0.7218423",
"0.7208369",
"0.7171022",
"0.7148206",
"0.7081663",
"0.70694184",
"0.7027515",
"0.70257604",
"0.7018146",
"0.7005516",
"0.69925016",
"0.69919634",
"0.69795233... | 0.0 | -1 |
take 1D float array of rewards and compute discounted reward | def discount_rewards(r):
discounted_r = np.zeros_like(r)
running_add = 0
for t in reversed(range(0, r.size)):
running_add = running_add * gamma + r[t]
discounted_r[t] = running_add
return np.array(discounted_r) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def discount_rewards(rewards):\r\n discounted_r = np.zeros_like(rewards)\r\n running_add = 0\r\n for t in reversed(range(0, len(rewards))): \r\n running_add = running_add * reward_discount + rewards[t]\r\n discounted_r[t] = running_add\r\n return discounted_r",
"def discoun... | [
"0.81006914",
"0.783933",
"0.7741882",
"0.7653529",
"0.7598554",
"0.7583073",
"0.7581821",
"0.7579404",
"0.75358135",
"0.7518769",
"0.7504461",
"0.74674493",
"0.7456459",
"0.74335676",
"0.7426343",
"0.74060297",
"0.73947066",
"0.73702323",
"0.7356152",
"0.73282903",
"0.72021"... | 0.77923757 | 2 |
Get product from the API, return a list. | def getproductbycategory(self):
eight = self.geteightcategories()
productsliste = []
for category in eight:
for page in tqdm(range(1, 5)):
r2 = requests.get(
"https://fr.openfoodfacts.org/cgi/search.pl?action=process"
+ "&tagty... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def list_products(self):\n return self._make_get_request(self._urls['products'])",
"def products(self):\n response = requests.get(self._url(self._PRODUCTS_PATH), headers=self._headers)\n return response.json()",
"def getProducts():\n return \"http://api.tcgplayer.com/catalog/products\""... | [
"0.7785661",
"0.7559487",
"0.75319576",
"0.747823",
"0.7454158",
"0.74111396",
"0.73282224",
"0.7143891",
"0.7131241",
"0.7121454",
"0.71089506",
"0.7094133",
"0.7069116",
"0.70505095",
"0.7047219",
"0.69655013",
"0.69529104",
"0.69379574",
"0.6921935",
"0.6877685",
"0.685638... | 0.0 | -1 |
Return an object containing the contents of an XML document as attributes. | def load_xml_doc_as_object(xml_path, schema_path):
root_element = load_xml_from_file(xml_path, schema_path)
if root_element is None:
return None
else:
return convert_element_to_object(root_element) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def convert_xml_to_object(file_content):\n object = xmltodict.parse(file_content, dict_constructor=dict)\n print(object)\n return object",
"def xml(self):\n return parse_xml(self, tab=\"\\t\", id=self.id or \"\")",
"def attrs(xml):\r\n return lxml.html.fromstring(xml).attrib",
"def xml(sel... | [
"0.6210207",
"0.61575544",
"0.6147562",
"0.60472417",
"0.590743",
"0.5850344",
"0.58308417",
"0.57870585",
"0.57750595",
"0.5766249",
"0.57395595",
"0.5722158",
"0.57167524",
"0.5699848",
"0.5651894",
"0.56258476",
"0.5605243",
"0.5603336",
"0.5603336",
"0.5594787",
"0.556072... | 0.0 | -1 |
Retrieve the entire contents of an XML document. | def load_xml_from_file(xml_path, schema_path):
parser = etree.XMLParser(remove_blank_text=True)
try:
xml_doc = etree.parse(xml_path, parser)
schema_doc = etree.parse(schema_path, parser)
except:
return None
schema = etree.XMLSchema(schema_doc)
if schema.validate(xml_doc):
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def doc(self):\n\n if not hasattr(self, \"_doc\"):\n self.loader.cdr_cursor.execute(self.SELECT_XML, self.id)\n xml = self.loader.cdr_cursor.fetchone().xml\n self._doc = etree.fromstring(xml.encode(\"utf-8\"))\n return self._doc",
"def parseDocum... | [
"0.6853029",
"0.6468239",
"0.63615507",
"0.63606906",
"0.6162753",
"0.6140131",
"0.60654145",
"0.6013582",
"0.5940689",
"0.5932569",
"0.59231234",
"0.5901152",
"0.5894962",
"0.58476895",
"0.5836977",
"0.5809017",
"0.57661605",
"0.57515883",
"0.5722352",
"0.5700319",
"0.569991... | 0.0 | -1 |
Return text converted into CamelCase. | def convert_underscore_to_camel_case(text):
words = text.split('_')
words = [word.capitalize() for word in words]
return ''.join(words) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _to_camel_case(text: str) -> str:\n return \"\".join(word.title() for word in text.split(\"_\"))",
"def format_camel(text):\r\n\toutput = \"\"\r\n\tfor i,w in enumerate(text.split(\" \")):\r\n\t\tif i > 0:\r\n\t\t\toutput += w[0].upper() + w[1:]\r\n\t\telse:\r\n\t\t\toutput += w\r\n\treturn output",
"de... | [
"0.811505",
"0.80072874",
"0.789813",
"0.76960003",
"0.75250006",
"0.7510774",
"0.7442112",
"0.73688483",
"0.7357219",
"0.73443055",
"0.72907835",
"0.72642624",
"0.71726173",
"0.7135783",
"0.71281093",
"0.7083364",
"0.70782703",
"0.706739",
"0.704763",
"0.7024271",
"0.7010927... | 0.72013247 | 12 |
Load all of the attribute names and values within an XML element into a dict. | def load_attribute_dict(parent_element, tag_name):
loaded_element = parent_element.find(tag_name)
attribute_dict = {attr[0] : convert_to_int_if_numeric(attr[1])
for attr in loaded_element.items()}
return attribute_dict | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_attrs_dict(self, root_element):\n attr_elements = root_element.findall(\"attribute\")\n attrs_dict = {}\n for el in attr_elements:\n attrs_dict[el.attrib[\"name\"]] = {\n \"value\": el.attrib[\"value\"],\n \"type\": el.attrib.get(\"type\", None)... | [
"0.7461649",
"0.6962167",
"0.6871773",
"0.68051326",
"0.66535115",
"0.6580101",
"0.6335014",
"0.62410265",
"0.6155792",
"0.61275125",
"0.60592586",
"0.6010749",
"0.6009873",
"0.5955365",
"0.59548455",
"0.59156615",
"0.590485",
"0.58758104",
"0.587327",
"0.58628076",
"0.585947... | 0.70307314 | 1 |
Convert a plural word into its singular form. | def get_singular_from_plural(plural):
if plural[-3:] in ['oes', 'xes']:
return plural[:-2]
elif plural[-3:] == 'ves':
return plural[:-3] + 'fe'
elif plural[-3:] == 'ies':
return plural[:-3] + 'y'
else:
return plural[:-1] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def normalize(word):\n word = word.lower()\n # removing plural, it facilitates the matching\n if len(word)>0 and word[-1] == 's':\n return word[0:-1]\n return word",
"def _plural_to_singular(self, plural_form):\n if plural_form is None:\n return None\n if plural_form =... | [
"0.75806177",
"0.74082685",
"0.72271186",
"0.7128144",
"0.7112864",
"0.71104765",
"0.7000708",
"0.6674074",
"0.6621366",
"0.65121996",
"0.6507346",
"0.64250296",
"0.63719416",
"0.63613534",
"0.62576747",
"0.61928993",
"0.60651094",
"0.6018901",
"0.601354",
"0.59988105",
"0.59... | 0.75608486 | 1 |
Convert a dict into an XML element. | def convert_dict_to_element(dictionary, element_name):
new_element = etree.Element(element_name)
for key, value in dictionary.items():
new_element.set(key, str(value))
return new_element | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def xml_obj(dict):\n string = \"\"\n for key in dict.keys():\n string += ' <{}>{}</{}>\\n'.format(key, dict[key], key)\n return string",
"def ConvertToXML (given_dict) :\r\n stream_thing = cStringIO.StringIO()\r\n WriteToXMLStream(given_dict, stream_thing, 'top')\r\n return stream_thi... | [
"0.7691683",
"0.71368897",
"0.6952965",
"0.64379716",
"0.63503045",
"0.58619285",
"0.5835848",
"0.5770905",
"0.57671887",
"0.57626235",
"0.5761944",
"0.5729182",
"0.5728828",
"0.56220305",
"0.5612468",
"0.5606412",
"0.56031466",
"0.5562701",
"0.55379236",
"0.55130583",
"0.550... | 0.7449152 | 1 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.