query stringlengths 10 2k | document stringlengths 20 51.2k | metadata dict | negatives listlengths 0 101 | negative_scores listlengths 0 101 | document_score stringlengths 3 10 | document_rank stringclasses 102
values |
|---|---|---|---|---|---|---|
Returns the random states of both numpy and torch in a tuple | def get_random_state():
numpy_state = np.random.get_state()
torch_state = torch.get_rng_state()
random_state = (numpy_state, torch_state)
return random_state | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_state():\n return torch.get_rng_state(), random.getstate(), np.random.get_state()",
"def get_random_state():\n return {\n \"random\": random.getstate(),\n \"numpy\": np.random.get_state(),\n \"torch\": torch.get_rng_state()\n }",
"def random(self):\n\t\treturn tuple((np.ra... | [
"0.789191",
"0.7042791",
"0.7030134",
"0.67306757",
"0.6103026",
"0.6074225",
"0.59991914",
"0.5964721",
"0.59462637",
"0.593463",
"0.5910856",
"0.58304995",
"0.58177036",
"0.5798759",
"0.5798759",
"0.5798759",
"0.57826275",
"0.57456815",
"0.5736149",
"0.573417",
"0.57232934"... | 0.829201 | 0 |
Loads the random states of both numpy and torch from a tuple | def set_random_state(random_state):
numpy_state, torch_state = random_state
np.random.set_state(numpy_state)
torch.set_rng_state(torch_state) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_random_state():\n numpy_state = np.random.get_state()\n torch_state = torch.get_rng_state()\n random_state = (numpy_state, torch_state)\n return random_state",
"def get_state():\n return torch.get_rng_state(), random.getstate(), np.random.get_state()",
"def set_state(torch_state, random_... | [
"0.701182",
"0.64894205",
"0.6139089",
"0.5998534",
"0.5923494",
"0.55968726",
"0.55769634",
"0.55163276",
"0.5445136",
"0.5423857",
"0.54181325",
"0.53634256",
"0.5356172",
"0.53106546",
"0.52734494",
"0.52725786",
"0.5253306",
"0.52492696",
"0.52354175",
"0.52266073",
"0.52... | 0.5709719 | 5 |
Returns a generator for the lengths of sections if you split an object of length n into k approximately equal length parts | def split(n, k):
new_size_floor = math.floor(n/k)
additional = n % k
for i in range(k):
if i < additional:
yield new_size_floor + 1
else:
yield new_size_floor | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def chunkify(self, k, n):\n lst = range(k)\n return [ len(lst[i::n]) for i in xrange(n) ]",
"def split_list(l, k):\n n = len(l)\n\n d = n // k\n r = n % k\n\n offset = 0\n for i in range(k):\n if i < r:\n size = d + 1\n else:\n size = d\n\n ... | [
"0.7183219",
"0.6541594",
"0.63933885",
"0.63772553",
"0.63549197",
"0.6354689",
"0.62595487",
"0.61840856",
"0.61831164",
"0.6178355",
"0.613365",
"0.61279464",
"0.61267173",
"0.61177474",
"0.6113865",
"0.6113865",
"0.609501",
"0.609501",
"0.609501",
"0.609501",
"0.609501",
... | 0.7521086 | 0 |
Returns concatenated tensors with the added batch dimension being first | def pad_and_concat(tensors, max_size=None, auto=True):
if auto:
if max_size is not None:
raise Exception("Must turn auto off to specify max size.")
max_size = get_max_dims(tensors)
concatenated_tensor = []
for i,tensor in enumerate(tensors):
if i == 0:
dim = t... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def ConcatWith(x, dim, tensor):\n if type(tensor) != list:\n tensor = [tensor]\n return tf.concat(dim, [x] + tensor)",
"def batch_concat(inputs: types.NestedTensor) -> tf.Tensor:\n flat_leaves = tree.map_structure(snt.Flatten(), inputs)\n return tf.concat(tree.flatten(flat_leaves), axis=-1)",
"d... | [
"0.73910564",
"0.71642554",
"0.7124599",
"0.7077171",
"0.6990152",
"0.6910007",
"0.6906826",
"0.6816927",
"0.6812423",
"0.67780596",
"0.6772327",
"0.67058355",
"0.67049915",
"0.66991466",
"0.66616344",
"0.66616344",
"0.66616344",
"0.66616344",
"0.6606713",
"0.6594531",
"0.659... | 0.5671976 | 96 |
Tests whether chunk begins at offset and has at least length bytes remaining. | def has_byte_range(self, offset, length) -> bool:
logger.debug('s: %d-%d; r: %d-%d'
% (self.offset, self.end, offset, offset + length - 1))
if offset == self.offset and offset + length - 1 <= self.end:
return True
return False | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def check_data_length(self, start_index, size_of_read):\n if start_index + size_of_read > len(self.data):\n self.data = self.data[start_index:]\n return False\n\n return True",
"def is_chunk_empty(self, chunk):\n if chunk.offset() == 0:\n return True\n ... | [
"0.71151984",
"0.70348036",
"0.6534721",
"0.6276246",
"0.62513506",
"0.62379885",
"0.62072307",
"0.62072307",
"0.6192653",
"0.6192009",
"0.6186259",
"0.6166179",
"0.61652184",
"0.6097355",
"0.60890096",
"0.6087836",
"0.6071032",
"0.5959359",
"0.59582204",
"0.595337",
"0.59328... | 0.7014454 | 2 |
Gets length bytes beginning at current offset. | def get(self, length) -> bytes:
b = next(self.r.iter_content(length))
self.offset += len(b)
if len(b) < length and self.offset <= self.end:
logger.warning('Chunk ended unexpectedly.')
raise Exception
return b | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_length(self, data, offset):\n return 0",
"def __len__(self):\n return self.lastbyte - self.firstbyte",
"def getlen(self):\n return self.length",
"def get_length(self):\r\n # len getter\r\n return self.length",
"def get_length(self) -> Result[int]:\n return ... | [
"0.75538397",
"0.7021244",
"0.6850247",
"0.6824169",
"0.67640954",
"0.67154336",
"0.6672029",
"0.666717",
"0.66494113",
"0.6633509",
"0.6608697",
"0.6526454",
"0.65224755",
"0.6514171",
"0.65007144",
"0.6492746",
"0.64926296",
"0.64926296",
"0.64926296",
"0.64685374",
"0.6464... | 0.0 | -1 |
Closes connection on the stream. | def close(self):
self.r.close() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def close(self):\r\n self.stream.close()",
"def close(self):\n quiet_close(self.stream)\n quiet_shutdown(self.socket)\n quiet_close(self.socket)\n self.is_connected = False",
"def close(self):\n self.stream.close()",
"def close_stream(self):\r\n with self.lock... | [
"0.7904599",
"0.788738",
"0.7840554",
"0.7802853",
"0.7800128",
"0.76061684",
"0.7551312",
"0.7517501",
"0.75037074",
"0.75037074",
"0.7430494",
"0.73582953",
"0.73398316",
"0.733592",
"0.73182076",
"0.72518855",
"0.7245357",
"0.723804",
"0.72014964",
"0.7199716",
"0.71961474... | 0.0 | -1 |
Closes chunks and clears chunk deque. | def clear(self):
with self.lock:
for chunk in self.chunks:
try:
chunk.close()
except:
pass
self.chunks.clear() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def close(self):\n if not self.closed:\n self.closed = True\n del self.buf, self.pos",
"def close(self):\n size = len(self.deque)\n for _ in range(0, size):\n try:\n connection = self.deque.pop()\n quiet_close(connection)\n ... | [
"0.6526635",
"0.6501085",
"0.62436074",
"0.61267364",
"0.6075464",
"0.6032648",
"0.5827673",
"0.5815419",
"0.58023745",
"0.5776952",
"0.5771247",
"0.5682486",
"0.5668562",
"0.56434816",
"0.5639391",
"0.5637855",
"0.5637855",
"0.5628562",
"0.5614653",
"0.5575743",
"0.5556814",... | 0.77395886 | 0 |
Access the value of the myCost instance variable | def getValue(self):
if self.stateValue is None:
self.stateValue = self.evalFunction(self.ruleString)
return self.stateValue | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _get_cost(self):\n return self.__cost",
"def _get_cost(self):\n return self.__cost",
"def _get_cost(self):\n return self.__cost",
"def _get_cost(self):\n return self.__cost",
"def _get_cost(self):\n return self.__cost",
"def _get_cost(self):\n return self.__cost",
"def _get_cost(s... | [
"0.863205",
"0.863205",
"0.863205",
"0.863205",
"0.863205",
"0.863205",
"0.863205",
"0.863205",
"0.863205",
"0.82090247",
"0.79533595",
"0.79533595",
"0.79533595",
"0.79533595",
"0.7816772",
"0.7677548",
"0.75829047",
"0.75534046",
"0.7445641",
"0.7445641",
"0.73783374",
"0... | 0.0 | -1 |
Given a symbol, return a string of the other symbols besides it. | def _otherSymbols(self, sym):
if sym == 'a':
return 'sflr'
elif sym == 's':
return 'aflr'
elif sym == 'f':
return 'aslr'
elif sym == 'l':
return 'asfr'
elif sym == 'r':
return 'asfl'
else:
print("_oth... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def std_name_for_symbol(symbol: str) -> str:\n for val in synonyms.values():\n if symbol in val:\n return val[0]\n return symbol",
"def add_special_symbols(text1: str, text2: str, symbol: str)->str: \n if(is_valid_tweet(text1+' '+symbol+text2)):\n return text1+' '+symbol+text... | [
"0.622174",
"0.5923156",
"0.5885381",
"0.57296985",
"0.57229894",
"0.5664366",
"0.5635598",
"0.55769986",
"0.55760956",
"0.55252254",
"0.5489743",
"0.5474914",
"0.54653794",
"0.54581314",
"0.5457546",
"0.5454563",
"0.5453354",
"0.5451844",
"0.5399291",
"0.5384949",
"0.5382137... | 0.7107547 | 0 |
Generate num random neighbors of this state. Note that the same neighbor could be generated more than once. | def randomNeighbors(self, num):
neighbors = []
for i in range(num):
newS = self.makeRandomMove()
neighbors.append(newS)
return neighbors | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def run_trial(self, num_nodes):\r\n \r\n # compute the neighbors for the newly-created node\r\n new_node_neighbors = set()\r\n for dummy_idx in range(num_nodes):\r\n new_node_neighbors.add(random.choice(self._node_numbers))\r\n \r\n # update the list of node num... | [
"0.65887946",
"0.6559681",
"0.6535839",
"0.653447",
"0.6531238",
"0.64945924",
"0.64942724",
"0.6486852",
"0.6472861",
"0.6472861",
"0.64070445",
"0.6369724",
"0.6313306",
"0.6274388",
"0.625984",
"0.6146421",
"0.6138986",
"0.6137795",
"0.60723925",
"0.60384744",
"0.60145086"... | 0.74858445 | 0 |
Builds n random states that use the same eval function and max value but are unrelated to this state. | def getRandomStates(self, n):
newStates = []
for i in range(n):
newRule = self.randomRuleset()
newState = RulesetState(self.evalFunction, self.maxValue, newRule)
newStates.append(newState)
return newState | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def randomGrid(n):\n values = np.random.choice(states, n*n, p=[0.2, 0.8])\n return values.reshape(n, n)",
"def simple_random_state(s, n):\n for _ in range(n):\n s = result8(s, random.choice(actions8(s)))\n return s",
"def random_state(s, n, unique=True):\n\n return simple_random_state(s, ... | [
"0.67072916",
"0.6549413",
"0.6459264",
"0.63656574",
"0.63067716",
"0.62972444",
"0.6295532",
"0.6233518",
"0.6070812",
"0.60509056",
"0.6036038",
"0.60247684",
"0.587867",
"0.5857688",
"0.5856684",
"0.5803029",
"0.577933",
"0.5746136",
"0.573947",
"0.57342327",
"0.5709828",... | 0.7856608 | 0 |
Generate a random ruleset string | def randomRuleset(self):
options = "sflr" # Leaving out the "arbitrary" random behavior
rules = ""
for i in range(self.RULE_LEN):
rules += random.choice(options)
return rules | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def makeRndString(charset:set,\n length:int=400):\n list_of_chars = [random.sample(charset, 1)[0] for i in range(length)]\n result = \"\".join(list_of_chars)\n return result",
"def generate_random_string():\n chars = string.ascii_uppercase + string.digits\n return ''.join(choices(... | [
"0.6636556",
"0.6543435",
"0.65181804",
"0.6492652",
"0.63711596",
"0.63104284",
"0.6302384",
"0.6215586",
"0.6159529",
"0.61511296",
"0.6136886",
"0.61123556",
"0.61114067",
"0.61073154",
"0.61052716",
"0.6096565",
"0.6086903",
"0.60816365",
"0.60474175",
"0.6046222",
"0.603... | 0.8154652 | 0 |
Returns the current state. | def getCurrState(self):
return self.currState | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_state(self):\n return self.curr_state",
"def get_current_state(self):\n return self.current_state",
"def get_current_state(self):\n return self.current_state",
"def current_state(self):\n return self._current_state",
"def state(self):\n return self._current_state"... | [
"0.9105121",
"0.90391475",
"0.90391475",
"0.8908461",
"0.8869105",
"0.8857016",
"0.88169545",
"0.8811877",
"0.87025076",
"0.8662377",
"0.8662377",
"0.8662377",
"0.8662377",
"0.8662377",
"0.8581873",
"0.85786015",
"0.85658586",
"0.8519105",
"0.8500624",
"0.8500624",
"0.8498784... | 0.0 | -1 |
Returns the value currently associated with the current state. | def getCurrValue(self):
return self.currValue | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_value(self):\n return self.__state",
"def get_value(self):\n return self.__state",
"def getValue(self, state):\n\t\treturn self.values[state]",
"def getCurrValue(self):\n return self.currStates[0].getValue()",
"def getValue(self, state):\n return self.values[state]",
"... | [
"0.87675786",
"0.87675786",
"0.84551674",
"0.8412919",
"0.84062433",
"0.84062433",
"0.84062433",
"0.84062433",
"0.84062433",
"0.84062433",
"0.84062433",
"0.84062433",
"0.84062433",
"0.84062433",
"0.84062433",
"0.84062433",
"0.84062433",
"0.84062433",
"0.84062433",
"0.84062433",... | 0.73758036 | 62 |
Returns the current state. | def getCurrState(self):
return self.currStates[0] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_state(self):\n return self.curr_state",
"def get_current_state(self):\n return self.current_state",
"def get_current_state(self):\n return self.current_state",
"def current_state(self):\n return self._current_state",
"def state(self):\n return self._current_state"... | [
"0.9105293",
"0.9039117",
"0.9039117",
"0.89081097",
"0.8868749",
"0.8856376",
"0.8816394",
"0.8811128",
"0.8701994",
"0.8662192",
"0.8662192",
"0.8662192",
"0.8662192",
"0.8662192",
"0.8582035",
"0.85778844",
"0.8565223",
"0.8519893",
"0.8500479",
"0.8500479",
"0.84982175",
... | 0.0 | -1 |
Returns the value currently associated with the current state. | def getCurrValue(self):
return self.currStates[0].getValue() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_value(self):\n return self.__state",
"def get_value(self):\n return self.__state",
"def getValue(self, state):\n\t\treturn self.values[state]",
"def getValue(self, state):\n return self.values[state]",
"def getValue(self, state):\n return self.values[state]",
"def getV... | [
"0.87669283",
"0.87669283",
"0.84540814",
"0.8405335",
"0.8405335",
"0.8405335",
"0.8405335",
"0.8405335",
"0.8405335",
"0.8405335",
"0.8405335",
"0.8405335",
"0.8405335",
"0.8405335",
"0.8405335",
"0.8405335",
"0.8405335",
"0.8405335",
"0.8405335",
"0.83283705",
"0.83283705"... | 0.841291 | 3 |
Returns a list of cities that starts with the given city prefix | def get_city_by_name(request, city_prefix):
cities = City.objects.filter(city_name__istartswith=city_prefix)[:5]
serializer = CityCondensedSerializer(cities, many=True)
return Response(serializer.data) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_locations_startswith(self, query):\n return [region for region in self.county_regions if region.name.startswith(query)]",
"def findAllWordsStartsWith(self, prefix):\n node=self.root\n for char in prefix:\n if char not in node.children:\n return []\n ... | [
"0.6975726",
"0.6243747",
"0.61467534",
"0.6138304",
"0.6128468",
"0.6113047",
"0.6103575",
"0.59989184",
"0.5947071",
"0.5934994",
"0.59140587",
"0.58460796",
"0.58051056",
"0.5791924",
"0.57831186",
"0.5777147",
"0.5775201",
"0.5762543",
"0.57411236",
"0.5730995",
"0.571928... | 0.6733361 | 1 |
Downsample a data array by applying a function to local blocks. If ``data`` is not perfectly divisible by ``block_size`` along a given axis then the data will be trimmed (from the end) along that axis. WCS propagation currently works only if ``data`` is a 2D image. | def block_reduce(data, block_size, error=None, func=np.sum, wcs=None,
wcs_origin=0):
from skimage.measure import block_reduce
data = np.asanyarray(data)
block_size = np.atleast_1d(block_size)
if data.ndim > 1 and len(block_size) == 1:
block_size = np.repeat(block_size, data.n... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def strided_slice_d_compute(input_data,\n output_x,\n begin,\n end,\n stride_shape=None,\n begin_mask=0,\n end_mask=0,\n ellip... | [
"0.596075",
"0.5938614",
"0.58959997",
"0.5803119",
"0.5791347",
"0.5757582",
"0.5721781",
"0.5591773",
"0.5590578",
"0.5565904",
"0.55325544",
"0.55246925",
"0.54864854",
"0.54716235",
"0.5394518",
"0.53277826",
"0.5221895",
"0.52130073",
"0.5211726",
"0.5189252",
"0.5114278... | 0.69494563 | 0 |
Return an array where each value is the Euclidean distance from a given position. | def radial_distance(shape, position):
x = np.arange(shape[1]) - position[1]
y = np.arange(shape[0]) - position[0]
xx, yy = np.meshgrid(x, y)
return np.sqrt(xx**2 + yy**2) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def distances(self):\r\n distance = np.zeros((self.N, self.N))\r\n\r\n # Offsetting the values and calculating distance\r\n\r\n for i in range(0, self.N):\r\n for j in range(0, self.N):\r\n x = (i - (self.N / 2) + 0.5)\r\n y = (j - (self.N / 2) - 0.5)\r... | [
"0.68348765",
"0.6808725",
"0.67992324",
"0.6640458",
"0.6619455",
"0.6546515",
"0.65213186",
"0.6514057",
"0.649228",
"0.6466552",
"0.64134264",
"0.6383175",
"0.63788897",
"0.63788897",
"0.63331187",
"0.6325587",
"0.6286021",
"0.6277788",
"0.6270895",
"0.62500274",
"0.623721... | 0.0 | -1 |
Calculate minimimal bounding box. | def _calc_bbox(slices):
return (slices[0].start, slices[1].start,
slices[0].stop, slices[1].stop) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def boundingBox(self):\n # Find upper bound\n u = cvx.Variable(self.n)\n Y = cvx.Variable((self.n,self.b.size))\n cost = cvx.Minimize(sum(u))\n constraints = [Y*self.b <= u,\n Y*self.A == np.eye(self.n),\n Y >= 0]\n problem = cvx... | [
"0.74168724",
"0.71476763",
"0.70630115",
"0.69882333",
"0.67146343",
"0.66927457",
"0.66776705",
"0.6664778",
"0.6614726",
"0.66035944",
"0.66028035",
"0.65478826",
"0.6498228",
"0.64793617",
"0.64627194",
"0.64206964",
"0.6396586",
"0.63569546",
"0.6355731",
"0.6354906",
"0... | 0.0 | -1 |
Calculate minimimal bounding box. | def _calc_bbox(slices):
return (slices[0].start, slices[1].start,
slices[0].stop, slices[1].stop) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def boundingBox(self):\n # Find upper bound\n u = cvx.Variable(self.n)\n Y = cvx.Variable((self.n,self.b.size))\n cost = cvx.Minimize(sum(u))\n constraints = [Y*self.b <= u,\n Y*self.A == np.eye(self.n),\n Y >= 0]\n problem = cvx... | [
"0.7418597",
"0.7149091",
"0.7064417",
"0.6990131",
"0.6715917",
"0.6694236",
"0.6678055",
"0.6665757",
"0.66153455",
"0.6605349",
"0.6604615",
"0.6548467",
"0.64998263",
"0.64800936",
"0.64635104",
"0.64226604",
"0.63980263",
"0.6356257",
"0.6356095",
"0.6354838",
"0.6333524... | 0.0 | -1 |
Returns path to port config file | def _get_path_to_port_config_file():
# Get platform and hwsku path
(platform_path, hwsku_path) = _get_path_to_platform_hwsku()
# First check for the presence of the new 'port_config.ini' file
port_config_file_path = "/".join([hwsku_path, PORT_CFG_FILE_NAME])
if not os.path.isfile(port_config_file_p... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def config_file_path(self) -> str:\n return pulumi.get(self, \"config_file_path\")",
"def config_file_path(self) -> str:\n return pulumi.get(self, \"config_file_path\")",
"def config_file_path(self) -> str:\n return pulumi.get(self, \"config_file_path\")",
"def config_file_path(self) -> ... | [
"0.744204",
"0.7441409",
"0.7441409",
"0.7440857",
"0.7232725",
"0.72105557",
"0.71657366",
"0.7156946",
"0.71338505",
"0.71338505",
"0.71338505",
"0.71338505",
"0.71338505",
"0.71337",
"0.71337",
"0.7133582",
"0.7133209",
"0.7132437",
"0.7018827",
"0.7011923",
"0.6977108",
... | 0.80186605 | 0 |
get monitor user config | def get_monitor_user_config():
# config_list_cond[k]:(valid check func,
# data translate func,
# invalid prompt string)
config_list_cond = {
KEY_MONITOR_USER_CFG_PERIOD: (lambda x: type(x) is int and (x > 0),
lambda... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def handle_api_users_get_config(self, http_context):\n\n if os.getuid() != 0:\n raise EndpointReturn(403)\n\n with authorize('core:config:read'):\n self.context.worker.reload_master_config()\n return aj.users.data",
"def user_config(self):\n return self._new_... | [
"0.68615896",
"0.682185",
"0.65017",
"0.64604515",
"0.64523953",
"0.6376507",
"0.6244591",
"0.6236984",
"0.61196893",
"0.6052719",
"0.60327625",
"0.6013551",
"0.6009556",
"0.6005654",
"0.59955406",
"0.59763646",
"0.59366256",
"0.5927081",
"0.5927081",
"0.5927081",
"0.5927081"... | 0.7162824 | 0 |
Adds incremental value of one to login attempts. | def login_attempts(self):
self.login_attempts += 1 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def increment_login_attempts(self):\r\n\t\tself.login_attempts +=1",
"def increment_login_attempts(self):\r\n self.login_attempts += 1",
"def increment_login_attempts(self):\r\n self.login_attempts += 1",
"def increment_login_attempts(self):\r\n self.login_attempts += 1",
"def incremen... | [
"0.8426229",
"0.8380239",
"0.8380239",
"0.8380239",
"0.83189774",
"0.83189774",
"0.83189774",
"0.83189774",
"0.8284256",
"0.8221365",
"0.8221365",
"0.8221365",
"0.8221365",
"0.8221365",
"0.8221365",
"0.8102559",
"0.80918986",
"0.78443605",
"0.7677049",
"0.7129052",
"0.7010212... | 0.79712933 | 17 |
Transform a single float daytime value to string. | def time_string_one(float_time=None, fmt=None):
if fmt is None:
fmt = '%Y-%m-%d %H:%M:%S.%f'
if float_time is None:
str_time = datetime.now().strftime(fmt)
else:
str_time = datetime.utcfromtimestamp(float_time).strftime(fmt)
return str_time | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _convert_float_to_time_string(cls, time_float):\n time_object = datetime.datetime.utcfromtimestamp(time_float)\n return ks_utils.isotime(time_object, subsecond=True)",
"def time2str(time):\r\n return time.toString(\"%Y-%m-%d %H:%M:%S.%2f\")",
"def _time_to_str(value: Union[float, int]) -> ... | [
"0.69500124",
"0.6929265",
"0.6602326",
"0.63852197",
"0.6333911",
"0.6224937",
"0.62191355",
"0.6202862",
"0.60911226",
"0.6083253",
"0.60534185",
"0.6039405",
"0.60054535",
"0.60054535",
"0.59949285",
"0.5985692",
"0.5966725",
"0.59655344",
"0.5951193",
"0.59194547",
"0.591... | 0.6422715 | 3 |
(str) > (list) Return list of lines from file (path to file) | def read_file(path):
lst = []
f = open(path, "r", encoding='utf-8', errors='ignore')
for i in range(14):
f.readline()
for line in f:
lst.append(line.strip().split())
f.close()
return lst | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_lines(path: str) -> list:\n with open(path, \"r\") as f:\n return f.readlines()",
"def get_lines(filename):\n return [l.replace('\\n', '') for l in open(filename).readlines()]",
"def read_lines(path):\n\n with open(path, 'r') as f:\n return [s.strip() for s in f.read().strip(... | [
"0.812606",
"0.8084782",
"0.80493164",
"0.8049099",
"0.8039006",
"0.79744834",
"0.79102546",
"0.7891204",
"0.7889042",
"0.7884756",
"0.7834568",
"0.78197163",
"0.78194946",
"0.7811464",
"0.7807324",
"0.77858746",
"0.7783905",
"0.7779152",
"0.7776209",
"0.77717215",
"0.7764874... | 0.74552727 | 51 |
Creates and saves a User with the given username, email and password. | def _create_user(self, username, password, first_name, last_name, **extra_fields):
if not username:
raise ValueError('The given username must be set')
username = self.normalize_email(username)
user = self.model(
first_name=first_name,
last_name=last_name,
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def signup(cls, username, email, password):\n\n hashed_pwd = bcrypt.generate_password_hash(password).decode('UTF-8')\n\n user = User(\n username=username,\n email=email,\n password=hashed_pwd,\n )\n\n db.session.add(user)\n return user",
"def cr... | [
"0.85182226",
"0.84778684",
"0.84062564",
"0.84062564",
"0.8406225",
"0.8398601",
"0.8392223",
"0.8391945",
"0.8391945",
"0.8391945",
"0.8391945",
"0.8346492",
"0.832258",
"0.82830274",
"0.82814634",
"0.823294",
"0.82261896",
"0.8218827",
"0.8214547",
"0.8205015",
"0.81979376... | 0.8258458 | 15 |
Test the initialisation of the form in the 2nd step of the config flow. | async def test_flow_select_type_init(mock_device, hass):
setup_device_mock(mock_device)
result = await hass.config_entries.flow.async_init(
DOMAIN, context={"source": "select_type"}
)
expected = {
"data_schema": ANY,
"description_placeholders": None,
"errors": N... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"async def test_options_flow_init(hass):\r\n config_entry = MockConfigEntry(\r\n domain=DOMAIN,\r\n version=4,\r\n unique_id=\"uniqueid\",\r\n data={\r\n CONF_DEVICE_ID: \"deviceid\",\r\n CONF_HOST: \"hostname\",\r\n CONF_LOCAL_KEY: \"localkey\",\r\n ... | [
"0.7325265",
"0.73082656",
"0.7291681",
"0.7067842",
"0.70168626",
"0.69666886",
"0.6917449",
"0.6806359",
"0.6804003",
"0.67796046",
"0.6741484",
"0.6631428",
"0.66242576",
"0.65969217",
"0.6566444",
"0.6562477",
"0.65157026",
"0.6475064",
"0.64432096",
"0.6407642",
"0.63993... | 0.6006631 | 53 |
Define the command line arguments using argparse | def add_arguments(self, parser):
super().add_arguments(parser) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _init_args():\n # Obtain the server number needed to split the data\n parser = argparse.ArgumentParser(description='')\n parser.add_argument(\n '-server',\n type=int,\n required=True,\n help='Current server number between 1 and total number of servers')\n parser.add_argu... | [
"0.75828046",
"0.7501511",
"0.74921787",
"0.74652153",
"0.7415917",
"0.7377208",
"0.7356098",
"0.7340217",
"0.7332229",
"0.72945106",
"0.7246858",
"0.72333664",
"0.7229235",
"0.7212332",
"0.71994567",
"0.7197956",
"0.7194958",
"0.71927625",
"0.7191563",
"0.7187456",
"0.718263... | 0.0 | -1 |
Renders the about page. | def hebrew_text():
return render_template(
'hebrew_text.html'
) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def about():\n return render_template(\"about.html\")",
"def about():\n about_template = templates_lookup.get_template('about.html')\n return about_template.render(active_page='about')",
"def about():\n\n return render_template('about_page/about.html')",
"def about():\n\n return render_tem... | [
"0.85373485",
"0.842411",
"0.841022",
"0.83836156",
"0.8296103",
"0.82935613",
"0.82935613",
"0.82837594",
"0.82837594",
"0.82709616",
"0.82709616",
"0.82709616",
"0.82709616",
"0.82709616",
"0.82709616",
"0.82709616",
"0.82709616",
"0.82709616",
"0.82709616",
"0.82709616",
"... | 0.0 | -1 |
Protocol of this server instance. A member of the Protocols enum. | def protocol(self):
return Protocols.WEBSOCKETS | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_protocol(self):\n return self._protocol",
"def get_protocol(self):\n return self._protocol",
"def protocol(self):\n return self._protocol",
"def protocol(self):\n return self._protocol",
"def protocol(self):\n return self._protocol",
"def protocol_type(self) -> ... | [
"0.8129935",
"0.8129935",
"0.8067009",
"0.8067009",
"0.8067009",
"0.7933428",
"0.7848274",
"0.7848274",
"0.7848274",
"0.77806807",
"0.77454865",
"0.76398695",
"0.7537937",
"0.7537937",
"0.7537937",
"0.7413207",
"0.7394208",
"0.7313135",
"0.7193348",
"0.7191556",
"0.71042615",... | 0.7055378 | 23 |
Returns the URL scheme for this server. | def scheme(self):
return WebsocketSchemes.WSS if self.is_secure else WebsocketSchemes.WS | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def scheme(self):\n scheme = self.environ.get('wsgi.url_scheme', \"http\")\n return scheme",
"def scheme(self) -> str:\n return self.raw_request.get('scheme')",
"def url_scheme(self):\n \n url = self.context.getUrl().strip()\n return urlparse(url)[0]",
"def scheme(se... | [
"0.86869234",
"0.8152452",
"0.81502384",
"0.80064243",
"0.77374595",
"0.7521502",
"0.7206575",
"0.72063935",
"0.7081063",
"0.70329213",
"0.6893228",
"0.68861437",
"0.68861437",
"0.68861437",
"0.67255515",
"0.6695291",
"0.6538889",
"0.6538889",
"0.6524838",
"0.6524838",
"0.651... | 0.68358785 | 14 |
Returns True if this server is configured to use SSL encryption. | def is_secure(self):
return self._ssl_context is not None | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def use_ssl(self) -> bool:\n return pulumi.get(self, \"use_ssl\")",
"def is_ssl_enabled(self):\n return len(self.get_ssl_cert()) > 0 and \\\n len(self.get_ssl_key()) > 0",
"def use_ssl(self) -> Optional[bool]:\n return pulumi.get(self, \"use_ssl\")",
"def use_ssl(self) -> Opti... | [
"0.82457274",
"0.81302106",
"0.79710674",
"0.79710674",
"0.79134643",
"0.7861119",
"0.7779157",
"0.7779157",
"0.7779157",
"0.7779157",
"0.7779157",
"0.7779157",
"0.77768326",
"0.76922214",
"0.76922214",
"0.75188535",
"0.7515462",
"0.7500446",
"0.7334948",
"0.7241124",
"0.7241... | 0.75026095 | 17 |
Stops the WebSockets server. | def stop(self):
if not self._server:
return
self._server.stop()
self._server = None | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def stop_websocket_server(self):\n if self._websocket_server:\n self._websocket_server.stop()\n self._websocket_server = None",
"def stop(self, joinThread=True):\n self.server.disconnect(self.remote)\n\n if self._ws_server:\n self._ws_server.close()\n self._ws_server ... | [
"0.85194725",
"0.7772018",
"0.76969606",
"0.7653396",
"0.76354736",
"0.76277065",
"0.7612004",
"0.7612004",
"0.75978804",
"0.75521946",
"0.7494665",
"0.7482636",
"0.74218786",
"0.73864436",
"0.7380687",
"0.7280389",
"0.7232105",
"0.7212161",
"0.72089016",
"0.7191757",
"0.7176... | 0.73235905 | 15 |
Creates the hidden layer for an artifical neural network. | def __init__(self, n_in, n_out, dropout_p=None,
activation=T.nnet.sigmoid, bias=0.0,
w=None, b=None, input=None, rng=None):
log.info("Creating hidden layer, n_in=%d, n_out=%d, drop_p=%r",
n_in, n_out, dropout_p)
if input is None:
input = T.... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def make_hidden(input_pl, hidden_num,activation_fun,param,layer_name):\n return layers.dense(inputs=input_pl, units=hidden_num, \n activation = activation_fun,\n kernel_initializer=tf.constant_initializer(param[0],dtype=tf.float32),\n ... | [
"0.7316418",
"0.6834931",
"0.6763902",
"0.6731173",
"0.6705649",
"0.6658168",
"0.658612",
"0.6490974",
"0.6441608",
"0.6381682",
"0.6373595",
"0.6369508",
"0.63601196",
"0.6267068",
"0.62328553",
"0.6189713",
"0.6183891",
"0.6182389",
"0.61798114",
"0.6178858",
"0.6115889",
... | 0.63339686 | 13 |
Generate an unused random 6 character string | def _generate_identifier(self) -> str:
while True:
candidate = random_string(EQ_LIST_ITEM_ID_LENGTH)
if candidate not in self._list_item_ids():
return candidate | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_random_string():\n return ''.join(random.choice(string.ascii_uppercase + string.digits) for s in range(6))",
"def _RandomString(self):\r\n length = random.randint(1, 10) * 6\r\n return ''.join([chr(random.randint(0,255)) for i in xrange(length)])",
"def generate_random_string():\n chars... | [
"0.8494918",
"0.8178907",
"0.8050549",
"0.7732125",
"0.7703194",
"0.76703066",
"0.7554546",
"0.75449413",
"0.7530637",
"0.75235033",
"0.75115955",
"0.7487335",
"0.7473569",
"0.74570495",
"0.7454533",
"0.7453357",
"0.741228",
"0.74099493",
"0.7398265",
"0.7395209",
"0.73845553... | 0.0 | -1 |
Return the window index of the given index into data. Note that this method can't be exact, since there may be more than one windows overlapping any point. A window is always returned, even though there may be no windows at the exact point given. | def window_from_sample(self, sample_idx):
clamp = lambda lower, upper, x: max(lower, min(upper, x))
return clamp(
0, self.n_windows-1,
(sample_idx - self.window_width) // self.window_step
) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getCorrespondingWindow(index, windows):\n \n for i, window in enumerate(windows):\n if window[0] <= index and (i == len(windows)-1 or index < windows[i+1][0]):\n return window",
"def get_window(the_list, window_size, index):\n window_max = index + 1\n window_min = window_max - w... | [
"0.7404804",
"0.68106854",
"0.6128709",
"0.5911965",
"0.579926",
"0.5738106",
"0.5717925",
"0.5652021",
"0.5567357",
"0.5560238",
"0.55576575",
"0.55559665",
"0.55559665",
"0.55255026",
"0.55036163",
"0.5494516",
"0.5453284",
"0.5441927",
"0.54290146",
"0.53836226",
"0.538309... | 0.6892396 | 1 |
Rotate a point counterclockwise by a given angle around a given origin. The angle should be given in radians. | def rotate(point, angle):
px, py = point
qx = math.cos(angle) * (px) - math.sin(angle) * (py )
qy = math.sin(angle) * (px) + math.cos(angle) * (py )
return qx, qy | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def rotate(self,origin, point, angle):\n \n x1, y1 = origin\n x2, y2 = point\n final_x = x1 + math.cos(angle) * (x2 - x1) - math.sin(angle) * (y2 - y1)\n final_y = y1 + math.sin(angle) * (x2 - x1) + math.cos(angle) * (y2 - y1)\n final_y = abs(width - final_y)\n \n ... | [
"0.7525168",
"0.75148386",
"0.7493224",
"0.74831724",
"0.7425254",
"0.74005336",
"0.74005336",
"0.7375701",
"0.7356475",
"0.7308771",
"0.7230003",
"0.71831596",
"0.71717614",
"0.69727147",
"0.691557",
"0.691557",
"0.68710184",
"0.6830887",
"0.68225133",
"0.67879385",
"0.67449... | 0.66955453 | 25 |
Compute mean absolute percentage error (MAPE) | def get_mape(y_true, y_pred):
y_true, y_pred = np.array(y_true), np.array(y_pred)
return np.mean(np.abs((y_true - y_pred) / y_true)) * 100 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def mape(actual: np.ndarray, predicted: np.ndarray):\n return np.mean(np.abs(_percentage_error(actual, predicted)))",
"def mean_absolute_percentage_error(\n y_true: np.ndarray, y_pred: np.ndarray, eps=1e-10\n) -> float:\n mape = np.abs(y_pred - y_true) / np.maximum(np.abs(y_true), eps)\n return np.me... | [
"0.7936617",
"0.79237133",
"0.77453023",
"0.75908685",
"0.7539256",
"0.7456359",
"0.736229",
"0.72903234",
"0.7209084",
"0.71929324",
"0.70791227",
"0.706395",
"0.70487183",
"0.70288473",
"0.70101976",
"0.70009506",
"0.69689524",
"0.6965175",
"0.6939622",
"0.68863404",
"0.682... | 0.70488787 | 13 |
Check that the start is before the stop. | def validate(self, data):
today = timezone.localtime(timezone.now())
if (data['cycleTimeStart'] >= data['cycleTimeEnd']):
raise serializers.ValidationError("finish must occur after start")
if (today >= data['cycleTimeEnd']):
raise serializers.ValidationError("Budget goal ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __safe_to_start(self):\n return self.__closest_event(epoch_roll=True) - time() > config['start_before_event']",
"def before_start_time(self):\n now = timezone.now()\n return now < self.start_time",
"def ConsBefore(t1, t2):\n EndTime1=t1[1]\n StartTime2=t2[0]\n return bool(EndT... | [
"0.7092761",
"0.70826054",
"0.69094855",
"0.6780424",
"0.65294844",
"0.64854085",
"0.64129007",
"0.6355723",
"0.63042456",
"0.61350507",
"0.6066357",
"0.6064762",
"0.6064762",
"0.60482705",
"0.59456336",
"0.5932872",
"0.5921483",
"0.5909395",
"0.5906186",
"0.5873852",
"0.5850... | 0.0 | -1 |
Create a page element object given a locator_key/value | def create_element(self, **kwargs):
log.debug("Creating element with {}".format(kwargs))
element = Element(self.appium_driver, **kwargs)
return element | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self, driver, by, value):\n self.driver = driver\n self.by = by\n self.value = value\n self.locator = (self.by, self.value)\n self.webelement = None",
"def getElement(self, locator):\n driver = webdriver_connection.connection\n how = locator[\"by\"]\n... | [
"0.67236304",
"0.6002135",
"0.5878527",
"0.5853943",
"0.57181466",
"0.56619436",
"0.56442636",
"0.5622287",
"0.5538877",
"0.54762965",
"0.541018",
"0.5401883",
"0.5377435",
"0.53384155",
"0.5329107",
"0.528772",
"0.52849853",
"0.52418816",
"0.5205433",
"0.5199738",
"0.5162248... | 0.5676868 | 5 |
Create a page element object given a locator_key/value | def create_elements(self, **kwargs):
log.debug("Creating elements with {}".format(kwargs))
elements = Elements(self.appium_driver, **kwargs)
return elements | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self, driver, by, value):\n self.driver = driver\n self.by = by\n self.value = value\n self.locator = (self.by, self.value)\n self.webelement = None",
"def getElement(self, locator):\n driver = webdriver_connection.connection\n how = locator[\"by\"]\n... | [
"0.67236304",
"0.6002135",
"0.5878527",
"0.5853943",
"0.57181466",
"0.5676868",
"0.56619436",
"0.56442636",
"0.5622287",
"0.5538877",
"0.54762965",
"0.541018",
"0.5401883",
"0.5377435",
"0.53384155",
"0.5329107",
"0.528772",
"0.52849853",
"0.5205433",
"0.5199738",
"0.5162248"... | 0.52418816 | 18 |
If capture is true, redirect all warnings to the logging package. If capture is False, ensure that warnings are not redirected to logging but to their original destinations. | def captureWarnings(capture):
if capture:
if logging._warnings_showwarning is None:
logging._warnings_showwarning = warnings.showwarning
warnings.showwarning = _showwarning
else:
if logging._warnings_showwarning is not None:
warning... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def emit(self, record):\n if record.levelno == logging.WARNING:\n self.captured_warnings.append(record.msg % record.args)\n\n super(WarningStoreStreamHandler, self).emit(record)",
"def set_redirect(self, redirect=None):\n if redirect == \"capture\":\n self.write_err = self.capture\n ... | [
"0.5395807",
"0.5320509",
"0.5252311",
"0.51848763",
"0.5100533",
"0.50873",
"0.49231192",
"0.48995045",
"0.4838935",
"0.48383284",
"0.48235488",
"0.48197874",
"0.4817646",
"0.4816849",
"0.48148263",
"0.48134768",
"0.48123923",
"0.4774834",
"0.47548893",
"0.47501326",
"0.4731... | 0.79105586 | 0 |
execute _sanitize_name on both first and last name | def sanitize_names(self):
self.first_name = self._sanitize_name(self.first_name)
self.last_name = self._sanitize_name(self.last_name) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def clean_first_name(self):\n if 'first_name' in self.cleaned_data:\n self.cleaned_data['first_name'] \\\n = self.cleaned_data['first_name'].capitalize()\n return self.cleaned_data['first_name']",
"def normalized_name(sender, instance, **kwargs):\n instance.normalized_n... | [
"0.7057801",
"0.70025843",
"0.68209505",
"0.6723769",
"0.6623668",
"0.6530145",
"0.65246373",
"0.6516531",
"0.64893115",
"0.64893115",
"0.6489298",
"0.6489298",
"0.6489298",
"0.6489298",
"0.6489298",
"0.6449004",
"0.64484876",
"0.642146",
"0.6416436",
"0.64105576",
"0.6407525... | 0.8407338 | 0 |
replace date dmm to ddmm | def date_add_0month(self):
if self.date.__len__() == 3:
self.date = '0%s' % self.date | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_date(date):\n return date.strftime(\"%B %d\").replace(\" 0\", \" \")",
"def user_friendly_date(date_format):\n friendly_date = date_format\n friendly_date = friendly_date.replace(\"%d\", \"DD\")\n friendly_date = friendly_date.replace(\"%m\", \"MM\")\n friendly_date = friendly_date.replace... | [
"0.68320364",
"0.6655198",
"0.66010654",
"0.65354115",
"0.6475416",
"0.6475416",
"0.6472448",
"0.64575166",
"0.6380437",
"0.6313497",
"0.6262575",
"0.6235695",
"0.62355506",
"0.6192126",
"0.6162091",
"0.61589646",
"0.61499155",
"0.6148708",
"0.6129271",
"0.6052106",
"0.601416... | 0.0 | -1 |
convert date from ddmmYYYY to YYYYmmdd | def convert_date(self):
self.date = '%s-%s-%s' % (self.date[4:8], self.date[2:4], self.date[0:2]) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _to_yyyymmdd(timestamp):\r\n s = str(timestamp)\r\n r = s[0:4] + s[5:7] + s[8:10]\r\n return r",
"def convert_date(self):\n self.date = '%s-%s-%s' % (self.date[4:8], self.date[2:4], \\\n self.date[0:2])",
"def convert_date(self):\n self.da... | [
"0.74386525",
"0.7179087",
"0.7179087",
"0.7161606",
"0.6965932",
"0.6930544",
"0.6887285",
"0.684022",
"0.6824426",
"0.6761358",
"0.67078155",
"0.6699833",
"0.66992015",
"0.66918504",
"0.6687963",
"0.6658512",
"0.6628485",
"0.66260123",
"0.6595995",
"0.65446204",
"0.65356785... | 0.71997285 | 1 |
converts DOB YYYY to 0101YYYY | def dob_year_only(self):
if self.date.__len__() == 4:
self.date = '0101%s' % self.date | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def dob_reformat(self):\n if self.dob and self.dob.count('/') == 2:\n dob = self.dob.split('/')\n for i in range(0, 2):\n if dob[i] in ('0', '00'):\n dob[i] = '01'\n self.dob = u\"%(day)s-%(month)s-%(year)s\" \\\n % {'y... | [
"0.7382781",
"0.7047655",
"0.6882781",
"0.67094207",
"0.6600316",
"0.6437085",
"0.6300432",
"0.6224729",
"0.6222566",
"0.61791694",
"0.6159538",
"0.61191916",
"0.606701",
"0.6055254",
"0.604816",
"0.6016071",
"0.5965945",
"0.59431016",
"0.5931569",
"0.5923566",
"0.5908664",
... | 0.713856 | 1 |
replace date dmm to ddmm | def date_add_0month(self):
if self.date.__len__() == 3:
self.date = '0%s' % self.date | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_date(date):\n return date.strftime(\"%B %d\").replace(\" 0\", \" \")",
"def user_friendly_date(date_format):\n friendly_date = date_format\n friendly_date = friendly_date.replace(\"%d\", \"DD\")\n friendly_date = friendly_date.replace(\"%m\", \"MM\")\n friendly_date = friendly_date.replace... | [
"0.68320364",
"0.6655198",
"0.66010654",
"0.65354115",
"0.6475416",
"0.6475416",
"0.6472448",
"0.64575166",
"0.6380437",
"0.6313497",
"0.6262575",
"0.6235695",
"0.62355506",
"0.6192126",
"0.6162091",
"0.61589646",
"0.61499155",
"0.6148708",
"0.6129271",
"0.6052106",
"0.601416... | 0.0 | -1 |
convert date from ddmmYYYY to YYYYmmdd | def convert_date(self):
self.date = '%s-%s-%s' % (self.date[4:8], self.date[2:4], \
self.date[0:2]) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _to_yyyymmdd(timestamp):\r\n s = str(timestamp)\r\n r = s[0:4] + s[5:7] + s[8:10]\r\n return r",
"def convert_date(self):\n self.date = '%s-%s-%s' % (self.date[4:8], self.date[2:4], self.date[0:2])",
"def convert_date(date):\n return datetime.datetime.strptime(str(date), '%Y-... | [
"0.74386525",
"0.71997285",
"0.7161606",
"0.6965932",
"0.6930544",
"0.6887285",
"0.684022",
"0.6824426",
"0.6761358",
"0.67078155",
"0.6699833",
"0.66992015",
"0.66918504",
"0.6687963",
"0.6658512",
"0.6628485",
"0.66260123",
"0.6595995",
"0.65446204",
"0.65356785",
"0.648418... | 0.7179087 | 3 |
replace 0 (zero) to O in HH member available field | def zero2o_hh_avail(self):
if self.hh_member_avail.lower() == '0':
self.hh_member_avail = 'o' | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def oficjalnie_o(hours, minutes): \n if minutes == 0:\n return 'o %s' % OFFICIAL_HOURS_EJ[hours]\n else:\n return 'o %s %s' % (OFFICIAL_HOURS_EJ[hours], MINUTES[minutes])",
"def h(cls, t):\n return '%02d' % cls.g(t)",
"def H(cls, t):\n return '%02d' % cls.G(t)",
"def e_niszero(self):\n ... | [
"0.5818095",
"0.5806755",
"0.5763993",
"0.5705419",
"0.5700375",
"0.56154877",
"0.5524054",
"0.5498953",
"0.5470275",
"0.5467743",
"0.5408062",
"0.5378348",
"0.5374481",
"0.5346209",
"0.5311228",
"0.5310664",
"0.5287918",
"0.52850115",
"0.52665216",
"0.5234447",
"0.5194432",
... | 0.6927411 | 0 |
replace date dmm to ddmm | def date_add_0month(self):
if self.date.__len__() == 3:
self.date = '0%s' % self.date | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_date(date):\n return date.strftime(\"%B %d\").replace(\" 0\", \" \")",
"def user_friendly_date(date_format):\n friendly_date = date_format\n friendly_date = friendly_date.replace(\"%d\", \"DD\")\n friendly_date = friendly_date.replace(\"%m\", \"MM\")\n friendly_date = friendly_date.replace... | [
"0.68322355",
"0.66550356",
"0.66012853",
"0.65351874",
"0.6475188",
"0.6475188",
"0.6472479",
"0.6457965",
"0.6381602",
"0.63143504",
"0.62632966",
"0.62361854",
"0.62360406",
"0.6192851",
"0.61617273",
"0.61590093",
"0.6148985",
"0.61484927",
"0.6129832",
"0.6051447",
"0.60... | 0.0 | -1 |
convert date from ddmmYYYY to YYYYmmdd | def convert_date(self):
self.date = '%s-%s-%s' % (self.date[4:8], self.date[2:4], \
self.date[0:2]) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _to_yyyymmdd(timestamp):\r\n s = str(timestamp)\r\n r = s[0:4] + s[5:7] + s[8:10]\r\n return r",
"def convert_date(self):\n self.date = '%s-%s-%s' % (self.date[4:8], self.date[2:4], self.date[0:2])",
"def convert_date(date):\n return datetime.datetime.strptime(str(date), '%Y-... | [
"0.74386525",
"0.71997285",
"0.7161606",
"0.6965932",
"0.6930544",
"0.6887285",
"0.684022",
"0.6824426",
"0.6761358",
"0.67078155",
"0.6699833",
"0.66992015",
"0.66918504",
"0.6687963",
"0.6658512",
"0.6628485",
"0.66260123",
"0.6595995",
"0.65446204",
"0.65356785",
"0.648418... | 0.7179087 | 2 |
convert dob from mm/dd/yyyy to yyyymmdd | def dob_reformat(self):
if self.dob and self.dob.count('/') == 2:
dob = self.dob.split('/')
for i in range(0, 2):
if dob[i] in ('0', '00'):
dob[i] = '01'
self.dob = u"%(day)s-%(month)s-%(year)s" \
% {'year': dob[2], \... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def quantLibToDate(d):\n return(str(d.dayOfMonth()).zfill(2) + '/' + str(d.month()).zfill(2) + '/' + str(d.year()))",
"def reformat_date_field(date_field):\n date_field = pd.to_datetime(date_field, format='%d/%m/%Y')\n date_field = date_field.dt.date\n return date_field",
"def _to_yyyym... | [
"0.711654",
"0.6871673",
"0.6848628",
"0.67546976",
"0.6576194",
"0.6558423",
"0.65189433",
"0.64535236",
"0.64383614",
"0.64359814",
"0.64322764",
"0.63993126",
"0.6394586",
"0.6373155",
"0.6252624",
"0.6234789",
"0.6224122",
"0.62162375",
"0.62162375",
"0.6204258",
"0.61560... | 0.80639327 | 0 |
Normalize a set of filters according to the given norm. If a matrix is given, each column is centered and normalized. | def norms(x, order=2):
return x / np.linalg.norm(x, axis=0, ord=order) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def normalise(self):\n for filter in self.filters:\n filter.normalise()",
"def normalize(X, norm = \"l2\"):\n if norm == \"l1\":\n n = np.atleast_1d(np.linalg.norm(X, 1, -1))\n elif norm == \"l2\":\n n = np.atleast_1d(np.linalg.norm(X, 2, -1))\n elif norm == \"max\":\n ... | [
"0.72321266",
"0.684362",
"0.66272885",
"0.66272885",
"0.65921694",
"0.6444058",
"0.6369655",
"0.6321082",
"0.6314629",
"0.6291806",
"0.6290218",
"0.6275364",
"0.6271194",
"0.62647116",
"0.62432903",
"0.62402487",
"0.6224003",
"0.6194114",
"0.6178484",
"0.61533886",
"0.613153... | 0.0 | -1 |
Topple all unstable spots on the grid. If any other site becomes unstable after toppling repeat until the whole grid becomes stable. | def topple_all_unstable(grid):
avalanche_size = 0
grid_x_size, grid_y_size = grid.shape
while True:
locs_to_topple = unstable_locs(grid)
if not len(locs_to_topple):
return avalanche_size
for loc_x, loc_y in locs_to_topple:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def unstable_locs(grid):\n return np.argwhere(grid >= 4)",
"def _raise_walls(self):\n for idx, column in enumerate(self._tiles):\n for idy, cell in enumerate(column):\n if cell in self._IMMUTABLE_TILES:\n neighbours = self.get_adjacent(idx, idy)\n ... | [
"0.6276945",
"0.5702306",
"0.5542069",
"0.55283475",
"0.5522472",
"0.54740524",
"0.54606986",
"0.5425755",
"0.5420921",
"0.541339",
"0.5403835",
"0.53937554",
"0.53757036",
"0.5350287",
"0.5327993",
"0.5318888",
"0.5310752",
"0.5306796",
"0.5302044",
"0.5299537",
"0.52967304"... | 0.61151993 | 1 |
Size of the grid. | def grid_size(self):
return self.x_size * self.y_size | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def GetGridSize(self):\n return self.rowCount * self.columnCount",
"def grid_size(self):\n return (len(self._grid[0]), len(self._grid))",
"def height(self):\n return len(self._grid)",
"def height(self) -> int:\n return len(self.grid)",
"def width(self) -> int:\n return le... | [
"0.87220234",
"0.8427337",
"0.8074535",
"0.80687284",
"0.8000978",
"0.7998402",
"0.78755337",
"0.78455627",
"0.7819887",
"0.77814126",
"0.7767244",
"0.77513164",
"0.7737648",
"0.77251863",
"0.7713217",
"0.7693192",
"0.76701146",
"0.76701146",
"0.7661058",
"0.7656109",
"0.7620... | 0.8664739 | 1 |
returns an iterator object that iterates over pieces in buffer | def pieces_in_buffer(self):
return self.piece_info.keys() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def buffer_iterator(it):\n buffer = []\n\n def buffered_it(buffer):\n for val in it:\n buffer.append(val)\n yield val\n\n return buffered_it(buffer), buffer",
"def __iter__(self):\r\n for chunk in self._chunks:\r\n yield chunk",
"def iterReader(self,it):\... | [
"0.6805726",
"0.6741937",
"0.6645437",
"0.6609841",
"0.65236205",
"0.65103626",
"0.63929665",
"0.6344641",
"0.6319535",
"0.63194835",
"0.63183665",
"0.6304139",
"0.63035715",
"0.6197887",
"0.61799234",
"0.6172737",
"0.6166309",
"0.6137049",
"0.612607",
"0.6115174",
"0.6105071... | 0.0 | -1 |
returns True if bitfield has no "0" | def _is_all_blocks_received(self, piece_index):
bf = bin(self.piece_info[piece_index]['bitfield'])[3:]
self.logger.info('_is_all_blocks_received: blocks bitfield: {}'.format(bf))
return not('0' in bf) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_zero(self):\n return not self._is_special and self._int == '0'",
"def isNotZeros(self):\n return np.any(self.data)",
"def is_zero(self):\n return len([1 for x in self.elems if x != 0]) == 0",
"def is_bitfield(self):\n return conf.lib.clang_Cursor_isBitField(self)",
"def __nonzero... | [
"0.6799489",
"0.6714833",
"0.6710743",
"0.6703582",
"0.6655912",
"0.64560837",
"0.644216",
"0.64219344",
"0.63822126",
"0.637063",
"0.63567513",
"0.63118243",
"0.6271901",
"0.62578315",
"0.62570095",
"0.6198723",
"0.61342794",
"0.6119484",
"0.60790837",
"0.6065647",
"0.606262... | 0.0 | -1 |
init bitfield for a buffer row all bits initialized to 0 | def _init_bitfield(self, piece_index):
try:
num_blocks = number_of_blocks(piece_index, self.torrent)
except Exception as e:
logging.debug('pbuffer._init_bitfield: {}'.format(e.args))
raise e
field = 1 << num_blocks
return field | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _zeroEmptyColumns(self, col, bcol):\n #for (c, b) in izip(columns[1:nCols], columns[(nCols + 1):]):\n emptyval = [0.0] * col.size\n bcol.values = [bool(x) for x in col.values]\n col.values = [x if x else emptyval for x in col.values]",
"def InitializeAllMaskData(self) -> None:\n ... | [
"0.5814635",
"0.5752524",
"0.5752524",
"0.57302666",
"0.5711228",
"0.5656098",
"0.556899",
"0.5486427",
"0.5464784",
"0.54618466",
"0.5460326",
"0.54157406",
"0.5396619",
"0.5386059",
"0.53685355",
"0.5350515",
"0.534942",
"0.53329676",
"0.52960193",
"0.52938104",
"0.5233985"... | 0.62430793 | 0 |
Get training args for runner._launch_aip_training. The training args contain the inputs/outputs/exec_properties to the tfx.scripts.run_executor module. | def create_training_job(self, input_dict, output_dict, exec_properties,
executor_class_path, job_args, job_id,
job_labels) -> Dict[str, Any]:
pass | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_input_args():\n train_parser = argparse.ArgumentParser()\n # Non-optional argument\n train_parser.add_argument('data_dir', type=str, default=\"flowers/\", help='data_dir')\n # Choose directory to save checkpoint\n train_parser.add_argument('--save_dir', type=str, default=\"checkpoint.pth\", ... | [
"0.71775067",
"0.7084911",
"0.699057",
"0.68644273",
"0.6739068",
"0.6578841",
"0.65417606",
"0.6427692",
"0.6425207",
"0.6346273",
"0.6326977",
"0.6324912",
"0.6289869",
"0.62384856",
"0.62301826",
"0.6149833",
"0.6136799",
"0.6129841",
"0.6102295",
"0.60762656",
"0.6065403"... | 0.52713263 | 96 |
Gets the state of the longrunning job. | def get_job_state(
self, response: Union[Dict[str, str], CustomJob]) -> Union[str, JobState]:
pass | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_job_state(self, response) -> JobState:\n return response.state",
"def getState(self):\n action = self.daofactory(classname=\"Jobs.GetState\")\n state = action.execute(self[\"id\"], conn=self.getDBConn(),\n transaction=self.existingTransaction)\n\n ret... | [
"0.759013",
"0.7573285",
"0.73609465",
"0.7304373",
"0.7189672",
"0.709413",
"0.70802253",
"0.7028918",
"0.70168996",
"0.6984909",
"0.6969215",
"0.68608993",
"0.67801094",
"0.6745777",
"0.6688143",
"0.66728777",
"0.66723984",
"0.6657654",
"0.65172493",
"0.6458098",
"0.6406721... | 0.6815973 | 12 |
Gets the job name. | def get_job_name(self) -> str:
return self._job_name | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def job_name(self) -> str:\n return pulumi.get(self, \"job_name\")",
"def jobname(self):\n try:\n self._jobname = self.inquire('JOBNAME')\n except:\n pass\n return self._jobname",
"def name(self) -> str:\n return self._job['name']",
"def job_name(self)... | [
"0.9123432",
"0.8754695",
"0.87107414",
"0.8554118",
"0.76333433",
"0.74520814",
"0.7431925",
"0.7427509",
"0.7268262",
"0.72411835",
"0.7142719",
"0.7127697",
"0.70156085",
"0.6977268",
"0.69609046",
"0.6959081",
"0.6939253",
"0.6939253",
"0.6939253",
"0.6923695",
"0.6918412... | 0.9184683 | 0 |
Get training args for runner._launch_aip_training. The training args contain the inputs/outputs/exec_properties to the tfx.scripts.run_executor module. | def create_training_job(
self, input_dict: Dict[str, List[types.Artifact]],
output_dict: Dict[str, List[types.Artifact]], exec_properties: Dict[str,
Any],
executor_class_path: str, job_args: Dict[str, Any], job_id: Optional[str]... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_input_args():\n train_parser = argparse.ArgumentParser()\n # Non-optional argument\n train_parser.add_argument('data_dir', type=str, default=\"flowers/\", help='data_dir')\n # Choose directory to save checkpoint\n train_parser.add_argument('--save_dir', type=str, default=\"checkpoint.pth\", ... | [
"0.717662",
"0.7083295",
"0.6989384",
"0.6863603",
"0.67377603",
"0.6578252",
"0.6541456",
"0.6426943",
"0.64245296",
"0.6345755",
"0.63253075",
"0.6322663",
"0.62893206",
"0.62380713",
"0.6229201",
"0.61493874",
"0.61363924",
"0.61291605",
"0.6100177",
"0.6077061",
"0.606370... | 0.0 | -1 |
Gets the state of the longrunning job. | def get_job_state(self, response) -> str:
return response['state'] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_job_state(self, response) -> JobState:\n return response.state",
"def getState(self):\n action = self.daofactory(classname=\"Jobs.GetState\")\n state = action.execute(self[\"id\"], conn=self.getDBConn(),\n transaction=self.existingTransaction)\n\n ret... | [
"0.75910527",
"0.75733775",
"0.7361861",
"0.73061895",
"0.7189963",
"0.70941895",
"0.7080209",
"0.70303047",
"0.7017238",
"0.6987149",
"0.69690585",
"0.6817238",
"0.6781252",
"0.6746651",
"0.66889817",
"0.66745204",
"0.6671232",
"0.6656719",
"0.6516979",
"0.6458733",
"0.64067... | 0.6860889 | 11 |
Get training args for runner._launch_aip_training. The training args contain the inputs/outputs/exec_properties to the tfx.scripts.run_executor module. | def create_training_job(
self, input_dict: Dict[str, List[types.Artifact]],
output_dict: Dict[str, List[types.Artifact]], exec_properties: Dict[str,
Any],
executor_class_path: str, job_args: Dict[str, Any], job_id: Optional[str]... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_input_args():\n train_parser = argparse.ArgumentParser()\n # Non-optional argument\n train_parser.add_argument('data_dir', type=str, default=\"flowers/\", help='data_dir')\n # Choose directory to save checkpoint\n train_parser.add_argument('--save_dir', type=str, default=\"checkpoint.pth\", ... | [
"0.71775067",
"0.7084911",
"0.699057",
"0.68644273",
"0.6739068",
"0.6578841",
"0.65417606",
"0.6427692",
"0.6425207",
"0.6346273",
"0.6326977",
"0.6324912",
"0.6289869",
"0.62384856",
"0.62301826",
"0.6149833",
"0.6136799",
"0.6129841",
"0.6102295",
"0.60762656",
"0.6065403"... | 0.0 | -1 |
Gets the state of the longrunning job. | def get_job_state(self, response) -> JobState:
return response.state | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getState(self):\n action = self.daofactory(classname=\"Jobs.GetState\")\n state = action.execute(self[\"id\"], conn=self.getDBConn(),\n transaction=self.existingTransaction)\n\n return state",
"def get_status(self, job_id):\n response = self.client.ge... | [
"0.7573285",
"0.73609465",
"0.7304373",
"0.7189672",
"0.709413",
"0.70802253",
"0.7028918",
"0.70168996",
"0.6984909",
"0.6969215",
"0.68608993",
"0.6815973",
"0.67801094",
"0.6745777",
"0.6688143",
"0.66728777",
"0.66723984",
"0.6657654",
"0.65172493",
"0.6458098",
"0.640672... | 0.759013 | 0 |
Plot nrows x ncols images | def plot_images(img, labels, nrows, ncols):
fig, axes = plt.subplots(nrows, ncols)
for i, ax in enumerate(axes.flat):
if img[i].shape == (32, 32, 3):
ax.imshow(img[i])
else:
ax.imshow(img[i, :, :, 0], cmap=plt.get_cmap('gray'))
ax.set_xticks([])
ax.set_yti... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def plot_images(dataset, n):\n for i in range(0, n):\n index = np.random.randint(0, dataset.shape[0])\n plt.imshow(dataset[index, :, :], cmap=\"gray\")\n plt.show()",
"def plot_examples(n_samples, images):\n n_cols = len(images)\n index = 0\n for j in range(0, n_samples):\n for col_id, ... | [
"0.7511423",
"0.7479858",
"0.74319476",
"0.72827077",
"0.71351993",
"0.7132836",
"0.7073082",
"0.70593923",
"0.70427847",
"0.69121414",
"0.6912068",
"0.6892166",
"0.6883349",
"0.687893",
"0.68756944",
"0.68464893",
"0.6841001",
"0.68243825",
"0.68015957",
"0.6789078",
"0.6782... | 0.7405158 | 3 |
Cylinder defined as a dataset in an otherwise empty box. As per test 3, but the cylinder is along the third dimension instead, to be able to store it more efficiently | def test4(dims,fout):
def circle(idx1,idx2,cd1,cd2,r) :
d = np.sqrt(abs(idx2-cd2)**2 + abs(idx1-cd1)**2)
if d < r:
return 1.0 - (d/r)
else:
return 0.0
d1,d2,d3 = dims
ndims = 3
f = h5py.File(fout,'w')
f.create_group("dsets")
f.attrs[... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def mock_2d_cylinder():\n cyl_radius = 0.1\n start = np.array([1.0, 2.0, 0.0])\n direction = np.array([0.0, 0.0, 1.0])\n normal = np.array([1.0, 0.0, 0.0])\n base_length = 1.0\n cylinder = ea.Cylinder(\n start, direction, normal, base_length, cyl_radius, density=1e3\n )\n cylinder.ve... | [
"0.66500515",
"0.6345836",
"0.6130523",
"0.61151797",
"0.6085642",
"0.6026828",
"0.5953059",
"0.5868012",
"0.58260554",
"0.58250743",
"0.5805277",
"0.57781273",
"0.57742894",
"0.5743607",
"0.5716921",
"0.56879306",
"0.5677903",
"0.56640136",
"0.5652673",
"0.561104",
"0.560173... | 0.0 | -1 |
Pad the states after termination by 0s | def _zero_padding(self, index, data):
_sample = np.asarray(data[0])
_dtype, _shape = _sample.dtype, _sample.shape
before_terminate = data[:index]
after_terminate = np.zeros(shape=(self._n_step-index,)+_shape, dtype=_dtype).tolist()
return np.asarray(before_terminate + after_termi... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _reset_states(states):\n for value in states.values():\n value.fill_(0)\n states['episode_id'].fill_(-1)",
"def build_pad0_state(s, s_qubits, a_qubits):\n u = np.array([1, 0])\n d = np.array([0, 1])\n dict_s = utils.get_dict_rep_of_vec(s)\n for key in dict_s.keys():\n ... | [
"0.63150555",
"0.6167954",
"0.61265415",
"0.59828067",
"0.5948922",
"0.59301096",
"0.58932436",
"0.58761805",
"0.58640844",
"0.5744699",
"0.56637967",
"0.5645215",
"0.56394345",
"0.562654",
"0.562042",
"0.5607674",
"0.5607674",
"0.5590122",
"0.55817467",
"0.55343705",
"0.5534... | 0.56323856 | 13 |
Create Prioritized Replay buffer. | def __init__(self, size, alpha, n_step=0, gamma=0.99):
super(PrioritizedReplayBuffer, self).__init__(size, n_step, gamma)
assert alpha >= 0
self._alpha = alpha
it_capacity = 1
while it_capacity < size:
it_capacity *= 2
self._it_sum = SumSegmentTree(it_capaci... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def setup_replay_buffer(self):\n logger.info(\"setting up replay buffer\")\n if self.hps.prioritized_replay:\n if self.hps.unreal: # Unreal prioritized experience replay\n self.replay_buffer = UnrealReplayBuffer(self.hps.mem_size,\n ... | [
"0.68955195",
"0.6726281",
"0.6476444",
"0.6447923",
"0.60559034",
"0.603739",
"0.5867915",
"0.56050617",
"0.56050617",
"0.5561855",
"0.55401987",
"0.55199236",
"0.540236",
"0.53586155",
"0.53260386",
"0.5296305",
"0.526948",
"0.5263564",
"0.52075607",
"0.51807624",
"0.510234... | 0.53265536 | 14 |
get num & size of columns | def calc_columns(max_len):
( _ , columns) = get_console_size()
num_cols = int(columns) // max_len
col_size = int(columns) // num_cols
return (num_cols, col_size) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def GetNumberCols(self): \n\t\treturn self.numberOfCols",
"def ncol(self):\n self._eager()\n return self._ncols",
"def cols(self):\n\t\treturn len(self.m[0])",
"def numColumns(self):\r\n return self.__data.numColumns",
"def num_columns(self):\n return self.get_info()['num_columns... | [
"0.82890946",
"0.81691146",
"0.8085819",
"0.8061029",
"0.80013376",
"0.7984281",
"0.7960536",
"0.7902966",
"0.7894867",
"0.7852566",
"0.78003126",
"0.7786826",
"0.77599466",
"0.77262574",
"0.77237475",
"0.77039456",
"0.7615341",
"0.75501597",
"0.7440164",
"0.7437058",
"0.7436... | 0.70830685 | 37 |
Test getting data from a server route with an auth token | async def test_authorized_http_get(server):
got_data_event = asyncio.Event()
async with FetchingEngine() as engine:
async def callback(data):
assert data[DATA_KEY] == DATA_SECRET_VALUE
got_data_event.set()
# fetch with bearer token authorization
await engine.queue... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"async def test_authorized_http_get_from_dict(server):\n got_data_event = asyncio.Event()\n async with FetchingEngine() as engine:\n async def callback(data):\n assert data[DATA_KEY] == DATA_SECRET_VALUE\n got_data_event.set()\n # raw config to be parsed\n config = {... | [
"0.70414156",
"0.699004",
"0.6923542",
"0.6912311",
"0.6832533",
"0.6804234",
"0.676188",
"0.675664",
"0.6698753",
"0.66714966",
"0.6577345",
"0.6559176",
"0.65570635",
"0.6539759",
"0.65255",
"0.6518526",
"0.6501947",
"0.64962274",
"0.6492749",
"0.6387322",
"0.6386111",
"0... | 0.74265796 | 0 |
Returns the csv column info object associated with a given data frame column | def _get_col(df: DataFrame, col_name: str) -> CSVColumn:
col: Series = df[col_name]
if CSVObject._is_numeric(col=col):
col: CSVColumn = NumericColumn(col=col)
return col
else:
col: CSVColumn = NominalColumn(col=col)
return col | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_col(self):\n return self.__col",
"def get_col(self):\n return self.__col",
"def get_column(self, column: SqlColumn) -> AlchemyColumn:\n table = self.get_table(column)\n # Note that we label the column manually to avoid collisions and\n # sqlAlchemy automatic label... | [
"0.64355636",
"0.6394874",
"0.63639754",
"0.6337344",
"0.63223636",
"0.63047427",
"0.6292307",
"0.62770575",
"0.62580496",
"0.62048143",
"0.6165467",
"0.616408",
"0.6148701",
"0.6136855",
"0.6111861",
"0.6019692",
"0.6014332",
"0.60085815",
"0.59820855",
"0.59817076",
"0.5957... | 0.7398404 | 0 |
Determines if an object is numeric or can be casted to a numeric type | def _is_numeric(obj) -> bool:
if type(obj) is float:
obj: float = float(obj)
return not isnan(obj)
if type(obj) is int:
return True
assert type(obj) is str
obj: str = str(obj)
try:
int(obj)
return True
except... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def isnumeric(object):\n return isinstance(object, (int, float, decimal.Decimal, np.number))",
"def is_numeric(obj):\n return isinstance(obj, (int, float, complex))",
"def is_numeric(value):\n return isinstance(value, int) or isinstance(value, float)",
"def is_numeric(value):\n return isi... | [
"0.84327275",
"0.8317556",
"0.7993201",
"0.7946348",
"0.7946348",
"0.7946348",
"0.7944279",
"0.77264875",
"0.7713343",
"0.77078307",
"0.76259744",
"0.7495186",
"0.7469553",
"0.7338918",
"0.73309064",
"0.7324959",
"0.72668284",
"0.7087074",
"0.7064593",
"0.7019602",
"0.7012414... | 0.84243596 | 1 |
Generates an slightly worse ASCIIonly slug. | def slugify(text, delim=u'-'):
result = []
for word in _punct_re.split(text.lower()):
word = normalize('NFKD', word).encode('ascii', 'ignore')
if word:
result.append(word)
return unicode(delim.join(result)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def gen_slug(text, delim=u'-'):\n from zine.application import get_application\n if get_application().cfg['ascii_slugs']:\n return gen_ascii_slug(text, delim)\n return gen_unicode_slug(text, delim)",
"def generate_slug(text: str, size: int) -> str:\n hash_num = int(hashlib.md5(text.encode('utf... | [
"0.7435452",
"0.7319186",
"0.7175905",
"0.7173542",
"0.7165583",
"0.70216256",
"0.6971099",
"0.68672615",
"0.6841204",
"0.6823944",
"0.6776236",
"0.67684454",
"0.6676588",
"0.6673884",
"0.6639678",
"0.6596746",
"0.65802693",
"0.6535622",
"0.6535261",
"0.6519048",
"0.6504419",... | 0.0 | -1 |
Return length of source string to define a sorting key. | def _ast_node_sort_key(a_node):
try:
return a_node.attributes["end"] - a_node.attributes["start"]
except KeyError:
return 0 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def length_key(item):\n return len(str(item))",
"def _get_len(data: str) -> str:\n return str(len(data))",
"def parse_lenstr(src):\n length = ord(src[0]) + ord(src[1]) * 256\n return src[2:length+2]",
"def for_sorting(str_val):\n return str(str_val).count('K') + str(str_val).count('C')",
"de... | [
"0.70887226",
"0.64301646",
"0.61969596",
"0.6164403",
"0.61570346",
"0.61487514",
"0.61487514",
"0.61487514",
"0.61487514",
"0.61487514",
"0.61487514",
"0.61487514",
"0.61487514",
"0.61487514",
"0.61487514",
"0.61480796",
"0.61480796",
"0.61480796",
"0.6118389",
"0.6100086",
... | 0.0 | -1 |
Compute total variation loss. | def tv_loss(img, tv_weight):
# Your implementation should be vectorized and not require any loops!
img = tf.reshape(img, tf.shape(img)[1:])
shift_size = tf.shape(img) - 1
shift_size = tf.concat([shift_size[:-1], [3]], axis=0)
width_shift = tf.slice(img, [1, 0, 0], shift_size)
height_shift = tf.s... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def total_variation_loss(x):\n\n a = K.square(x[:, :-1, :-1, :] - x[:, 1:, :-1, :])\n b = K.square(x[:, :-1, :-1, :] - x[:, :-1, 1:, :])\n return K.sum(a + b)",
"def total_variation_loss(stylized_inputs, total_variation_weight):\n shape = tf.shape(stylized_inputs)\n batch_size = shape[0]\n height = s... | [
"0.76461565",
"0.732427",
"0.728519",
"0.67988014",
"0.6719265",
"0.668924",
"0.66239053",
"0.66239053",
"0.659087",
"0.659087",
"0.65263987",
"0.6517816",
"0.64826673",
"0.6481081",
"0.6467406",
"0.64439785",
"0.64335227",
"0.6397667",
"0.63906556",
"0.63886243",
"0.63618296... | 0.0 | -1 |
Sets _language for OWM API. | def set_language(self, language):
logger.debug("Setting owm _language: {}".format(language))
language = 'hr' if language == 'sr' else language
self._api.set_language(language) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def user_set_language(self):\n self.__out__(self.__call_core__('g_language'))",
"def setLanguage(self, language):\n pass",
"def set_language(self, language):\n self.language = language",
"def set_language(self, language = LANGUAGE_DEFAULT):\r\n self._language = language\r\n ... | [
"0.7938481",
"0.7769248",
"0.77513874",
"0.7625388",
"0.75279355",
"0.7410889",
"0.7410889",
"0.7378647",
"0.73022497",
"0.73022497",
"0.73022497",
"0.73022497",
"0.7193934",
"0.7147534",
"0.709288",
"0.6948557",
"0.6924998",
"0.6891937",
"0.6889413",
"0.68601125",
"0.6851485... | 0.83122206 | 0 |
Helper to create boto3 session based on given AWS profile or AWS IAM role. With IAM role credentials will be refreshed every time boto3 client is created as well as if client session is exceeding 1 hour (to avoid session expiration). However we need to make sure that credentials which are used to assume this role will ... | def get_boto3_session(aws_profile_name, aws_role_arn):
# If aws_profile_name == 'no_profile' we are using
# 'Instance metadata service on an Amazon EC2 instance that has an IAM role configured'
# in CodeCommit Pipeline: https://boto3.amazonaws.com/v1/documentation/api/latest/guide/credentials.html
sess... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_account_session(sts_client, role_arn, request_id):\n sts_response = sts_client.assume_role(\n RoleArn=role_arn,\n RoleSessionName=request_id\n )\n\n return boto3.session.Session(\n aws_access_key_id=sts_response['Credentials']['AccessKeyId'],\n aws_secret_access_key=... | [
"0.75587624",
"0.7234612",
"0.718807",
"0.67165214",
"0.6601944",
"0.6397413",
"0.6309548",
"0.6307903",
"0.626086",
"0.626086",
"0.62457526",
"0.61603534",
"0.6110567",
"0.60204965",
"0.59909624",
"0.5958604",
"0.5835099",
"0.5822443",
"0.58016294",
"0.5785055",
"0.5680809",... | 0.81431377 | 0 |
Return the element of the list l closest in value to v. In the case of a tie, the first such element is returned. If l is empty, None is returned. | def closest_to(l,v):
if(l == []):
return None #if its empty list then return NONE
else:
value = l[0] #Assume the first value is closest
closest = v - l[0] #Closest value range
for element in l: #looping begin
diff = v - element #get the different
if(dif... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def closest_to(l,v):\n val, diff = l[0], abs(l[0] - v) \n for elem in l[1:]:\n if abs(elem - v) < diff:\n diff = abs(elem - v)\n val = elem\n return val",
"def closest_to(l,v):\n closest = None\n for k in l:\n if closest == None:\n closest = k\n ... | [
"0.84383523",
"0.83061874",
"0.6491916",
"0.6451837",
"0.63805217",
"0.63600886",
"0.63469005",
"0.6336317",
"0.63165534",
"0.62349564",
"0.6231299",
"0.62075835",
"0.6192109",
"0.6119121",
"0.6116139",
"0.6089139",
"0.60615546",
"0.6057661",
"0.5986035",
"0.5982817",
"0.5979... | 0.83041006 | 2 |
Convert a list of vectors to torch tensors | def torchify(self, vectors):
output = []
for vector in vectors:
if not torch.is_tensor(vector):
vector = pu.torchvar(vector, ttype=self.get('ttype'))
output.append(vector)
return output | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def to_torch(in_list):\n return torch.from_numpy(np.array(in_list))",
"def vecs_to_tensor(v):\n\n return mnp.stack([v[0], v[1], v[2]], axis=-1)",
"def list_np_to_tensor(list_of_arrays):\n return torch.stack([array for array in list_of_arrays])",
"def list2Tensors(input_list):\n max_seq_len = ... | [
"0.75343233",
"0.72567236",
"0.7061779",
"0.69417554",
"0.66184056",
"0.6378671",
"0.62674725",
"0.62610346",
"0.6235807",
"0.61769193",
"0.6167941",
"0.6079346",
"0.6072097",
"0.60330397",
"0.6002496",
"0.59674007",
"0.58966506",
"0.5889756",
"0.5849901",
"0.5846177",
"0.580... | 0.78637266 | 0 |
Instantiates a Splitter object, loads some weights, and tests it | def test_splitter(vectorizer, testfile, options={}, verbose=False):
model = Splitter(vectorizer.width, DIM, options=options)
model.load_best()
model.eval_mode()
_monitor = gm.monitor_setup(testfile) # For monitoring progress
iterator = generate_batch_iterator(vectorizer, testfile, N=BATCH_SIZE, _m... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self, split_storage, segment_storage, splitter):\n self._split_storage = split_storage\n self._segment_storage = segment_storage\n self._splitter = splitter",
"def __init__(\n self, num_points_per_sample, split, use_color, box_size_x, box_size_y, path\n ):\n # D... | [
"0.61612284",
"0.59641176",
"0.5925565",
"0.5854884",
"0.5837553",
"0.5823618",
"0.581989",
"0.5813523",
"0.57728326",
"0.5758523",
"0.57489747",
"0.57249594",
"0.56929445",
"0.5661056",
"0.5649124",
"0.56388855",
"0.56267947",
"0.5611769",
"0.56059533",
"0.5592165",
"0.55769... | 0.0 | -1 |
Gets the attached_files_directory of this MHtmlSaveOptions. | def attached_files_directory(self):
return self.container['attached_files_directory'] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _attachments_path(self):\n return join(self.options['backup_path'], \"attachments\")",
"def _get_files_dir(self):\n return self.files_dir",
"def get_directory(self):\n return self._directory",
"def getDirectory(self):\r\n return self._domInstance.getAttribute('directory')"... | [
"0.6605001",
"0.6574859",
"0.65734935",
"0.65070385",
"0.6416189",
"0.64085037",
"0.6361844",
"0.63026375",
"0.62083745",
"0.61740166",
"0.61380976",
"0.6074939",
"0.6005508",
"0.5902227",
"0.5864522",
"0.5846763",
"0.5831277",
"0.57474756",
"0.57257175",
"0.5721853",
"0.5718... | 0.79989296 | 0 |
Gets the attached_files_url_prefix of this MHtmlSaveOptions. | def attached_files_url_prefix(self):
return self.container['attached_files_url_prefix'] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def attached_files_url_prefix(self, attached_files_url_prefix):\n\n self.container['attached_files_url_prefix'] = attached_files_url_prefix",
"def _attachments_path(self):\n return join(self.options['backup_path'], \"attachments\")",
"def path(self):\n return self._file_options.file_url",
... | [
"0.672237",
"0.65152663",
"0.6360485",
"0.61723804",
"0.5981038",
"0.5954022",
"0.59101915",
"0.5899713",
"0.5839612",
"0.5830852",
"0.57568777",
"0.57545084",
"0.57538897",
"0.56632316",
"0.56593496",
"0.56179875",
"0.55680937",
"0.55364245",
"0.5490929",
"0.54805917",
"0.54... | 0.82380515 | 0 |
Gets the export_active_worksheet_only of this MHtmlSaveOptions. | def export_active_worksheet_only(self):
return self.container['export_active_worksheet_only'] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def export_active_worksheet_only(self, export_active_worksheet_only):\n\n self.container['export_active_worksheet_only'] = export_active_worksheet_only",
"def active(self):\n sheet_names = self.get_sheet_names()\n if 0 <= self.active_sheet_index < len(sheet_names):\n return self.g... | [
"0.72392315",
"0.538992",
"0.53002226",
"0.5026278",
"0.49645716",
"0.49392563",
"0.4801263",
"0.4791212",
"0.4775502",
"0.47065422",
"0.46953297",
"0.46764356",
"0.46541616",
"0.46308595",
"0.4618817",
"0.46183193",
"0.4614714",
"0.45810616",
"0.4576736",
"0.45687672",
"0.45... | 0.83922493 | 0 |
Gets the export_images_as_base64 of this MHtmlSaveOptions. | def export_images_as_base64(self):
return self.container['export_images_as_base64'] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def export_images_as_base64(self, export_images_as_base64):\n\n self.container['export_images_as_base64'] = export_images_as_base64",
"def export_chart_image_format(self):\n return self.container['export_chart_image_format']",
"def outputs_to_base64(output_images, img_format):\n output_strings... | [
"0.7318367",
"0.57069945",
"0.56852174",
"0.558526",
"0.53917986",
"0.5351",
"0.53434354",
"0.52954435",
"0.5218109",
"0.5215877",
"0.51372147",
"0.5116264",
"0.50909585",
"0.5090027",
"0.5069765",
"0.5033942",
"0.50214344",
"0.5018886",
"0.49879405",
"0.49466938",
"0.4924006... | 0.81903476 | 0 |
Gets the hidden_col_display_type of this MHtmlSaveOptions. | def hidden_col_display_type(self):
return self.container['hidden_col_display_type'] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def hidden_col_display_type(self, hidden_col_display_type):\n\n self.container['hidden_col_display_type'] = hidden_col_display_type",
"def hidden_row_display_type(self):\n return self.container['hidden_row_display_type']",
"def get_displayed_type(self):\n return self.db_type",
"def hidde... | [
"0.7745929",
"0.75607437",
"0.6828983",
"0.6337523",
"0.60489684",
"0.58353496",
"0.57699883",
"0.5541415",
"0.55402344",
"0.53289783",
"0.52768296",
"0.52702504",
"0.52661175",
"0.5157062",
"0.51552385",
"0.5153569",
"0.5134294",
"0.5130847",
"0.5078853",
"0.50675833",
"0.50... | 0.8721421 | 0 |
Gets the hidden_row_display_type of this MHtmlSaveOptions. | def hidden_row_display_type(self):
return self.container['hidden_row_display_type'] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def hidden_row_display_type(self, hidden_row_display_type):\n\n self.container['hidden_row_display_type'] = hidden_row_display_type",
"def hidden_col_display_type(self):\n return self.container['hidden_col_display_type']",
"def get_displayed_type(self):\n return self.db_type",
"def hidde... | [
"0.72078997",
"0.7196106",
"0.62992114",
"0.60426784",
"0.5543247",
"0.5435956",
"0.5238003",
"0.51772296",
"0.51513493",
"0.5098452",
"0.5060575",
"0.5060575",
"0.5056348",
"0.50549185",
"0.50261784",
"0.5018708",
"0.5018708",
"0.5018708",
"0.5018708",
"0.49997887",
"0.49756... | 0.84034985 | 0 |
Gets the html_cross_string_type of this MHtmlSaveOptions. | def html_cross_string_type(self):
return self.container['html_cross_string_type'] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def html_cross_string_type(self, html_cross_string_type):\n\n self.container['html_cross_string_type'] = html_cross_string_type",
"def type(self) -> str:\n return self._values.get('type')",
"def type(self) -> str:\n return self._values.get('type')",
"def _type(self):\n return self... | [
"0.6697927",
"0.5346266",
"0.5346266",
"0.53227234",
"0.5321546",
"0.5311897",
"0.5311897",
"0.5311897",
"0.5311897",
"0.5311897",
"0.5311897",
"0.53002536",
"0.52226806",
"0.5213365",
"0.5211638",
"0.5205158",
"0.51726276",
"0.51712847",
"0.5157955",
"0.5136033",
"0.5069994"... | 0.8012853 | 0 |
Gets the is_exp_image_to_temp_dir of this MHtmlSaveOptions. | def is_exp_image_to_temp_dir(self):
return self.container['is_exp_image_to_temp_dir'] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_exp_image_to_temp_dir(self, is_exp_image_to_temp_dir):\n\n self.container['is_exp_image_to_temp_dir'] = is_exp_image_to_temp_dir",
"def get_tempimagefile(self):\n bd = os.path.join(os.path.dirname(self.REF_FILE), \"images\")\n self.debug(\"Temporary image directory ({})\".format(bd))\... | [
"0.7700323",
"0.5940299",
"0.5603593",
"0.5486877",
"0.5483196",
"0.5370568",
"0.53693694",
"0.52841175",
"0.5259102",
"0.5254725",
"0.520834",
"0.5147032",
"0.51319176",
"0.51309454",
"0.5129892",
"0.5126259",
"0.50844365",
"0.49973628",
"0.49826053",
"0.49552786",
"0.493248... | 0.8423054 | 0 |
Gets the page_title of this MHtmlSaveOptions. | def page_title(self):
return self.container['page_title'] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getPageTitle(self):\n return getattr(self, 'page_title', None)",
"def get_page_title(self):\n return self.driver.title",
"def get_title(self):\n page_title = self.driver.title\n return page_title",
"def get_title(self):\n return self._title",
"def get_title(self):\n ... | [
"0.78119737",
"0.76541954",
"0.7626841",
"0.7436893",
"0.7411703",
"0.7376714",
"0.7360554",
"0.7353828",
"0.7325667",
"0.7325667",
"0.7325667",
"0.7324155",
"0.7315265",
"0.73068255",
"0.72804135",
"0.725582",
"0.72357255",
"0.72357255",
"0.7218356",
"0.71978664",
"0.7194961... | 0.77953434 | 1 |
Returns the string representation of the model | def to_str(self):
return pformat(self.to_dict()) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _repr_model_(self):\n return str(self)",
"def __str__(self):\n\n return str(self.model)",
"def get_model_string(self):\n raise NotImplementedError()",
"def __str__(self):\n return self.model",
"def serialize_model(self):\n return dill.dumps(self.model)",
"def __str_... | [
"0.8603206",
"0.85092425",
"0.82360387",
"0.80498564",
"0.80115753",
"0.79343045",
"0.7878523",
"0.77903897",
"0.7789903",
"0.7746775",
"0.76299804",
"0.76084584",
"0.75825435",
"0.75152516",
"0.75066316",
"0.7504789",
"0.7487798",
"0.7443518",
"0.74352336",
"0.74271595",
"0.... | 0.0 | -1 |
Returns true if both objects are not equal | def __ne__(self, other):
return not self == other | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __ne__(self, other: object) -> bool:\n return not self == other",
"def __ne__(self, other: object) -> bool:\n return not self.__eq__(other)",
"def __ne__(self, other):\n return self.__dict__ != other.__dict__",
"def __eq__(self, other):\n return not self.__ne__(other)",
... | [
"0.8410411",
"0.8391477",
"0.8172175",
"0.81410587",
"0.80920255",
"0.8088807",
"0.80676955"
] | 0.0 | -1 |
get the first player to play | def first_player(game):
name=game['name']
if name == 'othello':
color= Player.coins(game['player1'])
if color == 'black':
return game['player1']
else:
return game['player2']
else:
return game['player1'] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_next_player(self):\n\t\tpass",
"def get_player(self):\r\n player = self.players[self.player_index]\r\n return player",
"def get_player(self):\n\t\treturn None",
"def get_player(self):\r\n \r\n return self.player",
"def play_from(self, player: str) -> Optional[Element]:\n... | [
"0.7766051",
"0.75341946",
"0.7501951",
"0.7420519",
"0.7378097",
"0.73164636",
"0.7303855",
"0.72800994",
"0.72169685",
"0.721002",
"0.721002",
"0.71321756",
"0.7104854",
"0.70492816",
"0.6963041",
"0.6958661",
"0.6952417",
"0.693495",
"0.6927116",
"0.6902855",
"0.68737686",... | 0.6778395 | 25 |
Initialize the answer with a body and its author. | def __init__(self, name, created_by):
self.name = name
self.created_by = created_by | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self, body, author):\n self.body = body\n self.author = author",
"def __init__(self, author=\"\", title=\"\"):\n self.author = author\n self.title = title",
"def __init__(self, author, title):\n self.author = author\n self.title = title",
"def __init__(s... | [
"0.8011302",
"0.64140135",
"0.6335116",
"0.62747926",
"0.6210161",
"0.61860293",
"0.616981",
"0.60922986",
"0.6088647",
"0.60859716",
"0.6055687",
"0.60410446",
"0.6032438",
"0.5946095",
"0.5908534",
"0.582342",
"0.58139896",
"0.5784863",
"0.5765409",
"0.57420444",
"0.572463"... | 0.0 | -1 |
Checks if the packet has been corrupted, which is done by checking the checksum | def corrupted(pkt):
chk_arr = pkt[1:3]
data = pkt[3:]
chk = int.from_bytes(chk_arr, 'little', signed=False)
return not verify_checksum(data, chk) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def checksum_valid(packet):\n\n calculated_checksum = (0x01 + (~(sum(packet[:-1]) - 0x3A))) & 0xFF\n logging.info(\"Checksum was {}, expecting {}\".format(hex(calculated_checksum), hex(packet[-1])))\n logging.info(packet)\n return calculated_checksum == packet[-1]",
"def test_check_packet_wrong(self)... | [
"0.7031498",
"0.6787256",
"0.6757368",
"0.65445036",
"0.63925254",
"0.6326801",
"0.62989247",
"0.6218392",
"0.6058589",
"0.6058589",
"0.60206854",
"0.60206854",
"0.5970557",
"0.58845586",
"0.5847424",
"0.5811193",
"0.57953435",
"0.57905996",
"0.5785516",
"0.5775727",
"0.57444... | 0.8021248 | 0 |
Get the center x position | def cx(self):
return self.x + (self.width/2) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def center_x(self):\n self.x = self.window.width / 2 - self.width / 2",
"def get_x(self):\n return self.__x_position",
"def player_posx_center(init_x):\n return init_x + (tile_width/2) - (player_width / 2)",
"def getCenter(self):\n return self._posx, self._posy",
"def _center_x(sel... | [
"0.8023072",
"0.7897012",
"0.78869355",
"0.7815167",
"0.7774025",
"0.7749842",
"0.77411884",
"0.771796",
"0.7702203",
"0.7688036",
"0.76869255",
"0.7681739",
"0.76706547",
"0.7653064",
"0.7624104",
"0.76187676",
"0.75941944",
"0.75473785",
"0.75379974",
"0.7532332",
"0.748551... | 0.7274974 | 37 |
Gets the center y position | def cy(self):
return self.y + (self.height/2) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def center_y(self):\n self.y = self.window.height / 2 - self.height / 2",
"def _center_y(self, coord):\n return coord + (((1. - self.scale_factor) / 2.) * self.draw_height)",
"def y(self):\n return self.__pos[1]",
"def player_posy_center(init_y):\n return init_y + (tile_height/2) - (... | [
"0.79356045",
"0.780394",
"0.7761082",
"0.7736749",
"0.77158475",
"0.76956284",
"0.7663144",
"0.76284117",
"0.75956666",
"0.75491667",
"0.7540949",
"0.7529917",
"0.74583834",
"0.7433559",
"0.7425168",
"0.7407245",
"0.7395691",
"0.73881024",
"0.7371409",
"0.73598206",
"0.73354... | 0.69216835 | 52 |
Expose the methods of an object to the specified dictionary. (I am not sure whether this is exactly compatible to what does the interpreter...) | def expose(obj,names=None,cl=None):
if names is None:
names = {}
if cl is None:
cl = obj.__class__
for name in cl.__dict__.keys():
if not hasattr(names,name):
names[name] = getattr(obj,name)
for base in cl.__bases__:
names = expose(obj,names,base)
return name... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self, object, **adapted_method):\n\n self._object = object\n\n \"\"\" Add new dictionary item to establish mapping \"\"\"\n self.__dict__.update(adapted_method)",
"def __init__(self, obj, **adapted_methods):\n self.obj = obj\n #self.__dict__.update(adapted_methods)... | [
"0.68462414",
"0.67838836",
"0.6611671",
"0.5899054",
"0.5897934",
"0.58705974",
"0.5850168",
"0.5771178",
"0.5769717",
"0.567821",
"0.567628",
"0.5603009",
"0.55433536",
"0.5520048",
"0.5510727",
"0.5474667",
"0.5473958",
"0.54252857",
"0.542221",
"0.5418773",
"0.5363256",
... | 0.605687 | 3 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.