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 True if this RangeSet's ranges exactly match the other RangeSet's ranges, or if the given argument is a Range and this RangeSet contains only one identical Range | def __eq__(self, other: Union[Range, 'RangeSet']) -> bool:
if isinstance(other, RangeSet):
return len(self._ranges) == len(other._ranges) and \
all(mine == theirs for mine, theirs in zip(self._ranges, other._ranges))
elif isinstance(other, Range):
return len(se... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def range_matches(self, other):\n return (\n self.begin == other.begin and \n self.end == other.end\n )",
"def isdisjoint(self, other: Union[Rangelike, Iterable[Rangelike]]) -> bool:\n # convert to RangeSet\n other = RangeSet._to_rangeset(other)\n # O(n^2)... | [
"0.76933897",
"0.7182602",
"0.701377",
"0.68410903",
"0.6677893",
"0.6616966",
"0.65925187",
"0.65873253",
"0.65475404",
"0.6537954",
"0.65358895",
"0.64484197",
"0.64422154",
"0.64335835",
"0.6395189",
"0.63891286",
"0.6368546",
"0.635968",
"0.6357579",
"0.6336377",
"0.63142... | 0.85723513 | 0 |
Returns an orderingbased comparison based on the lowest ranges in self and other. | def __lt__(self, other: Union[Range, 'RangeSet']) -> bool:
if isinstance(other, RangeSet):
# return the first difference between this range and the next range
for my_val, their_val in zip(self._ranges, other._ranges):
if my_val != their_val:
return my_... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __lt__(self, other):\n selfList = sorted(list([self.start, self.end]))\n otherList = sorted(list([other.start, other.end]))\n if(selfList[0] < otherList[0]):\n return True\n if(selfList[0] > otherList[0]):\n return False\n return (selfList[1] < otherList... | [
"0.7419558",
"0.7342583",
"0.7259461",
"0.7241694",
"0.7185314",
"0.71790123",
"0.71580267",
"0.71046925",
"0.7080562",
"0.7080562",
"0.6959919",
"0.6952354",
"0.6951935",
"0.6939004",
"0.69284225",
"0.69275683",
"0.6914123",
"0.6914123",
"0.6914123",
"0.69134474",
"0.6898817... | 0.72682035 | 2 |
Returns an orderingbased comparison based on the lowest ranges in self and other. | def __gt__(self, other: Union[Range, 'RangeSet']) -> bool:
if isinstance(other, RangeSet):
# return the first difference between this range and the next range
for my_val, their_val in zip(self._ranges, other._ranges):
if my_val != their_val:
return my_... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __lt__(self, other):\n selfList = sorted(list([self.start, self.end]))\n otherList = sorted(list([other.start, other.end]))\n if(selfList[0] < otherList[0]):\n return True\n if(selfList[0] > otherList[0]):\n return False\n return (selfList[1] < otherList... | [
"0.74187577",
"0.7342267",
"0.72674024",
"0.72598916",
"0.724179",
"0.71842355",
"0.717877",
"0.715763",
"0.7105539",
"0.7081123",
"0.7081123",
"0.6959257",
"0.6953113",
"0.6950966",
"0.69386107",
"0.692847",
"0.69270027",
"0.6914053",
"0.6914053",
"0.6914053",
"0.6913656",
... | 0.64287704 | 90 |
Generates random nonb64 strings and uses them to pad out and find the edge of the block. A randomly bad choice from random_nonb64_string seems like it could cause us to end up offbyone with the padding choice, which would ruin everything. Also, you sometimes need more that 16 bytes of padding. That doesn't make sense t... | def find_padding(known, iter_len=1):
pad = None
starting_length = oracle(known)
for i in range(32):
test_pad = random_nonb64_string(i)
padded_length = oracle(known + test_pad)
if padded_length != starting_length:
pad = test_pad[:-iter_len]
break
return pad | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def random_nonb64_string(length):\n return ''.join(\n random.choices('!@#$%^&*(){}[]', k=length)\n )",
"def test_pad_b64(self):\n test1 = {\"value\": b\"any carnal pleasure.\",\n \"unpadded\": \"YW55IGNhcm5hbCBwbGVhc3VyZS4\",\n \"padded\": \"YW55IGNhcm5hbCBwbGV... | [
"0.697762",
"0.66139895",
"0.6466291",
"0.64583266",
"0.642274",
"0.6381755",
"0.6379614",
"0.63580304",
"0.6342148",
"0.6303672",
"0.6252454",
"0.62333643",
"0.6223145",
"0.6193858",
"0.61544305",
"0.6119875",
"0.61167663",
"0.6109567",
"0.60979974",
"0.6085062",
"0.60379523... | 0.69040596 | 1 |
Filter dictionary by list of keys. | def get_values_by_keys(k: list, default=None)->Callable[[dict], list]:
return lambda d: list(map(lambda key: d.get(key, default), k)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def dict_filter(indict, key_list):\n \n return dict((key, value) for key, value in list(indict.items()) if key in key_list)",
"def filter_by_keys(self, keys):\n return list(filter(lambda item: item.keyword in set(keys), self._metadata))",
"def filter_keys_in_set(ds, keys):\n logger.info(\"For e... | [
"0.79166913",
"0.7502612",
"0.7451757",
"0.74441606",
"0.7368218",
"0.7142144",
"0.71179414",
"0.7048592",
"0.70165336",
"0.6968983",
"0.69485337",
"0.69450563",
"0.6944551",
"0.67850477",
"0.67178875",
"0.6640975",
"0.66340286",
"0.6629156",
"0.66277295",
"0.6623528",
"0.659... | 0.0 | -1 |
Get a collection by name. | def __getattr__(self, name):
return self.connection(name) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_collection(db, name):\n\n if db.hasCollection(name) is False:\n return db.createCollection(name=name)\n\n return db[name]",
"def getCollection(name, index=-1):\n names = [x.name for x in bpy.data.collections if getNamePrefix(x.name) == name]\n names = sorted(names, key=getNameIndex)\n\... | [
"0.81788105",
"0.81535053",
"0.81280386",
"0.78840953",
"0.7745918",
"0.7368756",
"0.73111546",
"0.73034626",
"0.72124255",
"0.709937",
"0.69820714",
"0.69651765",
"0.69204956",
"0.6914286",
"0.6892912",
"0.6851764",
"0.68334126",
"0.68222404",
"0.67533505",
"0.67154354",
"0.... | 0.0 | -1 |
Get a collection by name. | def __getitem__(self, name):
return self.connection(name) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_collection(db, name):\n\n if db.hasCollection(name) is False:\n return db.createCollection(name=name)\n\n return db[name]",
"def getCollection(name, index=-1):\n names = [x.name for x in bpy.data.collections if getNamePrefix(x.name) == name]\n names = sorted(names, key=getNameIndex)\n\... | [
"0.8178405",
"0.81548",
"0.81291497",
"0.7881524",
"0.7745879",
"0.7368146",
"0.7312133",
"0.73031545",
"0.721587",
"0.7100588",
"0.6983242",
"0.6967196",
"0.69183886",
"0.6917959",
"0.6894968",
"0.68523294",
"0.68340635",
"0.68266743",
"0.6750368",
"0.6718811",
"0.66682875",... | 0.0 | -1 |
Returns the `mu` individuals with the best fitness. | def truncation(population, context, mu):
inds = list(sorted(list(population), reverse=True))
return inds[0:mu], context | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _best_individual(self):\n return max(self._population, key=attrgetter(\"fitness\"))",
"def best_individual(self):\n return self.population.best_individual()",
"def result(self):\n return min(self.population, key=lambda individual: individual.get_fitness())",
"def get_best_individual(... | [
"0.7258625",
"0.6694387",
"0.6558553",
"0.65318686",
"0.65063673",
"0.63095033",
"0.6217844",
"0.62157667",
"0.61482364",
"0.612846",
"0.60963285",
"0.6075736",
"0.60661054",
"0.6044516",
"0.6002239",
"0.5984116",
"0.59467465",
"0.5898371",
"0.589647",
"0.5889918",
"0.5887586... | 0.0 | -1 |
helper method to check if the Enum value is in the Enum list | def has_value(cls, value):
return any(value == item.value for item in cls) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def check_enum(enumerator, value):\n is_valid = False\n for data in enumerator:\n if data == value:\n is_valid = True\n break\n\n if is_valid:\n return value\n else:\n my_banner(\"Value must be from enum \" + enumerator +\" Value has been set to N/A\")\n ... | [
"0.70782113",
"0.6914558",
"0.688306",
"0.6830364",
"0.6826706",
"0.66907597",
"0.6459624",
"0.6402355",
"0.6344923",
"0.62812465",
"0.62628573",
"0.6240514",
"0.6223471",
"0.62017554",
"0.6094199",
"0.6092766",
"0.6089436",
"0.6082577",
"0.60801667",
"0.60704124",
"0.6060374... | 0.6045899 | 22 |
Returns the distance between two given coordiantes in km. | def calc_distance_haversine(coord1, coord2):
lat1, lon1 = coord1
lat2, lon2 = coord2
# approximate radius of earth in km
R = 6373.0
lat1 = radians(lat1)
lon1 = radians(lon1)
lat2 = radians(lat2)
lon2 = radians(lon2)
dlon = lon2 - lon1
dlat = lat2 - lat1
a = sin(dlat / 2) *... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def distance_in_meters(coord1, coord2):\n return vincenty(coord1, coord2).meters",
"def coord_distance(lat1, lon1, lat2, lon2):\n\tlon1, lat1, lon2, lat2 = map(math.radians, [lon1, lat1, lon2, lat2])\n\tdlon = lon2 - lon1\n\tdlat = lat2 - lat1\n\ta = math.sin(dlat/2)**2 + math.cos(lat1) * math.cos(lat2) * mat... | [
"0.8480402",
"0.8124066",
"0.8030394",
"0.7978429",
"0.79563284",
"0.79554677",
"0.7954737",
"0.7897618",
"0.78547597",
"0.7823781",
"0.7805646",
"0.780014",
"0.77902836",
"0.7775937",
"0.77694565",
"0.7762306",
"0.772791",
"0.77062",
"0.76612633",
"0.764371",
"0.7594318",
... | 0.0 | -1 |
Remove and return the top of the stack | def pop(self):
# Check if there is an element in the stack
if self.head is None:
raise Exception("The stack is current empty")
# Get the current head
head = self.head
# Set the head to the next node of the current head
self.head = head.nextNode
# R... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def top(self):\n if self.stack == []:\n return None\n return self.stack[-1]",
"def pop(self):\n if not self.isEmpty():\n self.top -= 1\n return self.stack.pop()\n else:\n raise Exception(\"Stack Underflow\")",
"def pop(stack):\n item = ... | [
"0.8055237",
"0.78639",
"0.7846407",
"0.78160703",
"0.77795833",
"0.774891",
"0.7746663",
"0.7730984",
"0.77100956",
"0.76688004",
"0.7646289",
"0.7604892",
"0.7602567",
"0.759944",
"0.758485",
"0.75845474",
"0.7572365",
"0.7540485",
"0.753697",
"0.7510452",
"0.75002843",
"... | 0.6929215 | 78 |
Calculate area as difference between two spherical caps | def areas(self):
height_delta = (np.cos(self.polar_corners[:-1, :-1]) - np.cos(self.polar_corners[:-1, 1:]))
azimuth_delta = (self.azimuthal_corners[1:, 1:] - self.azimuthal_corners[:-1, 1:])
return height_delta * azimuth_delta | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def area(self) -> float:\n return cross3(self.b.position - self.a.position,\n self.c.position - self.a.position).length() / 2.0",
"def rectangle_surface_area(a,b):\n return (a*b)",
"def compute_area(self):\r\n\r\n \"\"\"Косое произведение векторов\r\n A = (x2-x1; y2... | [
"0.64475954",
"0.6234301",
"0.609809",
"0.60165006",
"0.5998743",
"0.59651685",
"0.58605313",
"0.5847465",
"0.5842869",
"0.58076495",
"0.58034956",
"0.5786157",
"0.5753773",
"0.5709111",
"0.56674504",
"0.5655739",
"0.56498665",
"0.56473356",
"0.5641945",
"0.56389964",
"0.5626... | 0.56568617 | 15 |
Calculate each facet's projected visible area divided by its total area. Obscured facets have zero projected visible area. | def projected_visible_area_fraction(self, projection_direction):
proj_dir_length = np.sum(projection_direction ** 2) ** .5 # Length of projection_direction
# Calculate dot product of unit projection direction and unit surface normals.
proj_area_frac = np.sum((projection_direction / proj_dir_le... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def compute_surface_area(self):\n return np.sum(self._find_triangle_areas())",
"def area(self) -> npt.NDArray[np.float_]:\n return np.sum(self.faces.area)",
"def area(self) -> npt.NDArray[np.float_]:\n points = self._normalized_projection()\n a = sum(det(points[..., [0, i, i + 1], :... | [
"0.66036034",
"0.6322443",
"0.5999395",
"0.5892217",
"0.5873274",
"0.58564943",
"0.58222467",
"0.5812301",
"0.57333946",
"0.57251066",
"0.5719016",
"0.5714865",
"0.5699785",
"0.569267",
"0.5679387",
"0.56638473",
"0.5659154",
"0.5607853",
"0.55549854",
"0.5547627",
"0.5542137... | 0.6349578 | 1 |
Get a keras model for self driving | def get_model(keep_ratio=0.25):
model = Sequential()
# Standardize images
model.add(Lambda(lambda x: (x / 255.0) - 0.5, input_shape=(160,320,3)))
# Crop images
model.add(Cropping2D(cropping=((70,25),(0,0)))) #crop images to isolate road lines
# Convolution layer
model.add(Convolution2D(24,5... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def model(self):\n i = self.keras.Input(self.s)\n\n return keras.Model(inputs=[i], outputs=self.call(i))",
"def get_model():\n # Reset scheduled learning rate.\n learning_rate_schedule = CustomScheduleTanh(warmup_steps=3000, phase_step=25000, max_lr=LEARNING_RATE)\n optimizer = tf.keras.op... | [
"0.7602193",
"0.74073905",
"0.7263948",
"0.72520405",
"0.72511643",
"0.7080395",
"0.70644933",
"0.7051996",
"0.7036189",
"0.6999062",
"0.69140404",
"0.68632644",
"0.6835499",
"0.68279606",
"0.6817431",
"0.67866457",
"0.6766478",
"0.67352796",
"0.67341435",
"0.6725837",
"0.668... | 0.6742859 | 17 |
returns a dictionary of the number of each character in given string | def histogram(s):
d = dict()
for c in s:
d[c] = 1 + d.get(c, 0)
return d | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_char_counts(string):\n counts = {}\n for char in iter(string):\n counts[char] = 1 if not char in counts.keys() else counts[char] + 1\n return counts",
"def count_chars(s: str) -> dict:\n count_dict = {}\n\n for c in s:\n if c in count_dict:\n count_dict[c] += 1\n ... | [
"0.88129765",
"0.8728361",
"0.848237",
"0.7866813",
"0.7430138",
"0.73922616",
"0.7292377",
"0.72465414",
"0.7194462",
"0.71261334",
"0.70986706",
"0.70407724",
"0.69946",
"0.6918164",
"0.6881948",
"0.686667",
"0.68311346",
"0.678107",
"0.6768525",
"0.6765421",
"0.6709649",
... | 0.58809227 | 100 |
function takes a list as a parameter and returns True if there is any object that appears more than once in the list. | def has_duplicates(items):
items = list()
items.sort()
for i in range(len(items) - 1):
if items[i] == items[i + 1]:
return True
return False | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def has_duplicates(list):\n for i in list:\n if list.count(i) > 1:\n return True\n else:\n return False",
"def find_duplicates(lst):\n \"*** YOUR CODE HERE ***\"\n return len( set(lst) ) != len(lst)",
"def has_duplicates(l):\r\n return len(set(l)) < len(l)",
"d... | [
"0.8356981",
"0.78153104",
"0.78064686",
"0.7804727",
"0.77091527",
"0.7703053",
"0.73921263",
"0.7391209",
"0.73732364",
"0.71622396",
"0.7151505",
"0.7140099",
"0.7073233",
"0.68805426",
"0.68352044",
"0.6829664",
"0.6809763",
"0.67949265",
"0.67942727",
"0.67751294",
"0.67... | 0.7244058 | 9 |
get the relative part of a file name | def relative_path(root_dir, dirpath, f):
full = os.path.join(dirpath, f)
if not root_dir:
return full
if not full.startswith(root_dir):
print("ERROR - bad path for root", full)
return None
full = full[len(root_dir):]
if full.startswith("/"):
return full[1:]
return... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def rel_filename(filename, relative_to=None):\n if relative_to is None:\n relative_to = os.getcwd()\n if not relative_to.endswith(os.path.sep):\n relative_to += os.path.sep\n filename = os.path.normpath(os.path.abspath(filename))\n if filename.startswith(relative_to):\n return file... | [
"0.77508247",
"0.7650104",
"0.76407677",
"0.73681045",
"0.73411417",
"0.7298228",
"0.72676605",
"0.7263605",
"0.72431535",
"0.7241038",
"0.72329915",
"0.7219528",
"0.7213912",
"0.720237",
"0.7172762",
"0.7138965",
"0.71329033",
"0.71205574",
"0.7119385",
"0.71153474",
"0.7114... | 0.0 | -1 |
Method checks that a user's password follows specific criteria such as at least one uppercase character, one lowercase, one number and one spceial character. Password should also be atleast six characters long. | def validate_password(self):
# source: https://docs.python.org/2/howto/regex.html
if not re.match(r"[A-Za-z0-9@#]", self.password):
return 'Oops!, invalid password'
elif len(self.password) < 6:
return 'Password should be at least six characters long'
return 'Valid... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def valid_password(password):\n val = True\n\n if len(password) < 8:\n val = False\n return val\n\n if not any(char.isdigit() for char in password):\n val = False\n return val\n\n if not any(char.isupper() for char in password):\n val = False\n return val\n\n ... | [
"0.79485446",
"0.7837788",
"0.7835347",
"0.78181136",
"0.78085726",
"0.7779497",
"0.77667016",
"0.7624198",
"0.7602153",
"0.75298136",
"0.7520804",
"0.7500461",
"0.7494316",
"0.7437111",
"0.7371643",
"0.7322012",
"0.7311963",
"0.7310951",
"0.73028916",
"0.7295427",
"0.7295263... | 0.79412055 | 1 |
Set this widget as invalidated | def set_invalidated(self):
# GTK Settings for evogtk
self.set_property('image',self.__errorimg) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def invalidate(self):\n self._valid = False",
"def invalidate(self):\n self.valid = False",
"def invalidate(self):\n\t\tself.invalidate_rect(self.viewed_rect())",
"def invalidate(self):\n self.set_viewport(self.x, self.y, self.w, self.h, True)",
"def invalidate(self): \n ... | [
"0.7593571",
"0.75661063",
"0.7277339",
"0.6970411",
"0.68401927",
"0.6762689",
"0.6561643",
"0.6507955",
"0.6317077",
"0.62412494",
"0.61127305",
"0.59732246",
"0.58780116",
"0.58077824",
"0.5774363",
"0.57401264",
"0.5731592",
"0.5679216",
"0.55228114",
"0.54466474",
"0.542... | 0.6746798 | 6 |
Renders the barcode and writes it to the file like object `fp`. | def write(self, fp, options=None, text=None):
output = self.render(options, text)
self.writer.write(output, fp) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def write_to(self, fp):\n fp.write(self.text)",
"async def handle(cls, payload:bytearray):\n logger.debug('Rendering graphics')\n try:\n arr = struct.unpack(f'<{len(payload)}B', payload)[6:66]\n # generates 1 pixel heigth image\n img = Image.frombytes(data=by... | [
"0.61595565",
"0.6143571",
"0.59233695",
"0.57847923",
"0.5589125",
"0.55841464",
"0.5484185",
"0.5474442",
"0.54609454",
"0.5382703",
"0.5382462",
"0.53682333",
"0.53422505",
"0.5308852",
"0.52317905",
"0.5228739",
"0.5212052",
"0.52024317",
"0.51969445",
"0.51915586",
"0.51... | 0.64254045 | 0 |
Load config from yml/yaml file. | def load_config(file_path):
_, ext = os.path.splitext(file_path)
assert ext in ['.yml', '.yaml'], "only support yaml files for now"
config = yaml.load(open(file_path, 'rb'), Loader=yaml.Loader)
return config | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def load_yaml(cls, file=None):\n if file is None: file = f'{rcp.base_path}cfg.yml'\n try:\n with open(file, 'r') as f:\n config = yaml.load(f, Loader=yaml.FullLoader)\n cfg.__dict__ = config\n return cfg\n except FileNotFoundError:\n p... | [
"0.8171059",
"0.8076701",
"0.8056154",
"0.7955563",
"0.79520464",
"0.7918401",
"0.79007226",
"0.78934366",
"0.7892787",
"0.7880029",
"0.7879076",
"0.7866957",
"0.78608185",
"0.7795735",
"0.77768874",
"0.7771925",
"0.7710141",
"0.7692372",
"0.76506853",
"0.76146287",
"0.760613... | 0.7916458 | 6 |
Log error and exit when set use_gpu=true in paddlepaddle cpu version. | def check_device(use_gpu, use_xpu=False, use_npu=False, use_mlu=False):
err = "Config {} cannot be set as true while your paddle " \
"is not compiled with {} ! \nPlease try: \n" \
"\t1. Install paddlepaddle to run model on {} \n" \
"\t2. Set {} as false in config file to run " \
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def handle_gpu_compatibility():\n try:\n gpus = tf.config.experimental.list_physical_devices(\"GPU\")\n for gpu in gpus:\n tf.config.experimental.set_memory_growth(gpu, True)\n except Exception as e:\n print(e)",
"def check_gpus(_: None, gpus_optional: bool = False) -> None:... | [
"0.6030626",
"0.56272054",
"0.5495042",
"0.54887277",
"0.54819566",
"0.5446715",
"0.5444931",
"0.5444666",
"0.5442727",
"0.54349977",
"0.5404745",
"0.5403589",
"0.53750515",
"0.5369692",
"0.5368978",
"0.53249216",
"0.53130484",
"0.53113705",
"0.53113705",
"0.53080493",
"0.530... | 0.6605659 | 0 |
renders the index page template | def index():
return list() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index():\r\n return render_template('index.html')",
"def index():\n return render_template('index.html')",
"def index(self):\n\t\treturn render_template('index.html')",
"def index():\n return render_template('index.html')",
"def index():\n return render_template('ind... | [
"0.86780834",
"0.86672497",
"0.86589026",
"0.8596844",
"0.8596844",
"0.8576117",
"0.8576117",
"0.8576117",
"0.8534208",
"0.85176384",
"0.85176384",
"0.85143596",
"0.8486178",
"0.8483066",
"0.8446178",
"0.84431356",
"0.8437712",
"0.8400412",
"0.8388795",
"0.8388795",
"0.838879... | 0.0 | -1 |
Authorization property. Returns bool True if there is an authorized session. False if no authentication. | def is_authorized(self) -> bool:
if "access_token" in session:
if session.get("access_token") is not None:
if "user" in session:
return True
return False | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def authorized(self):\n return self.authorization is not None",
"def authorization(self):\n return self._authorization",
"def is_authenticated(self):\n return bool(get_auth_token())",
"def get_authorization():\n return True",
"def is_authenticated(self):\n return bool(self._a... | [
"0.79943323",
"0.73050845",
"0.7169229",
"0.7161055",
"0.7154509",
"0.7149075",
"0.7094416",
"0.7094416",
"0.7094416",
"0.7094416",
"0.7094416",
"0.7094416",
"0.7094416",
"0.7094416",
"0.7094416",
"0.7094416",
"0.7094416",
"0.7094416",
"0.7094416",
"0.7076434",
"0.7007058",
... | 0.76709175 | 1 |
View for home page. | def index(self) -> HTMLBody:
return render_template("index.jinja2") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def home(request):\n\treturn render(request, \"compta/home.html\")",
"def home(request):\r\n return render(request, 'home.html')",
"def home(request):\n return render_to_response('home.html', {}, RequestContext(request))",
"def home():\n\n return render_template('home_page.html')",
"def home():\n\... | [
"0.84998274",
"0.8357836",
"0.8333323",
"0.82733816",
"0.8241409",
"0.82058656",
"0.8176338",
"0.8169344",
"0.81677043",
"0.81508076",
"0.81365496",
"0.8130035",
"0.8121874",
"0.81208825",
"0.81032896",
"0.81032896",
"0.81032896",
"0.81032896",
"0.81032896",
"0.81032896",
"0.... | 0.0 | -1 |
Logout view for authenticated users. | def logout(self) -> Union[redirect, HTMLBody]:
if self.is_authorized:
session.clear()
flash("Successfully logged out.")
return render_template("index.jinja2")
flash("You must login before logging out.")
return redirect(url_for("login")) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def logout(request):\n \n auth.logout(request)\n \n return render_to_response(\"auth/logout.html\", {\n }, context_instance=RequestContext(request))",
"def logout(self):\n if 'user' in session:\n del session['user']\n session.save()\n return render('logout.h... | [
"0.83471423",
"0.82361776",
"0.8230418",
"0.8218052",
"0.81781286",
"0.8152129",
"0.81178445",
"0.80940205",
"0.80595577",
"0.80526656",
"0.801767",
"0.8005667",
"0.79834765",
"0.79808897",
"0.7973572",
"0.79714566",
"0.796274",
"0.7962378",
"0.7961954",
"0.79616106",
"0.7956... | 0.0 | -1 |
conv2d returns a 2d convolution layer with full stride. | def conv2d(x, W):
return tf.nn.conv2d(x, W, strides=[1, 1, 1, 1], padding='SAME') | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_conv2d():\n img = np.array([\n [0.3, 0.5, 0.7, 0.9],\n [0.1, 0.3, 0.5, 0.7],\n [0.9, 0.7, 0.5, 0.3],\n ])\n template = np.array([\n [1, 0],\n [1, 0],\n ])\n template = np.flipud(np.fliplr(template))\n return fftconvolve(img, template, mode='valid')",
... | [
"0.763011",
"0.7626646",
"0.75784826",
"0.7463977",
"0.74572504",
"0.74572504",
"0.738611",
"0.73377377",
"0.73304254",
"0.7329959",
"0.731406",
"0.73021233",
"0.7296823",
"0.72701716",
"0.72465515",
"0.72311795",
"0.7208086",
"0.71958727",
"0.71894747",
"0.718813",
"0.715269... | 0.74255186 | 8 |
weight_variable generates a weight variable of a given shape. | def weight_variable(shape):
initial = tf.truncated_normal(shape, stddev=0.1)
return tf.Variable(initial) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def weight_variable(shape):\n initial = tf.truncated_normal(shape, stddev=0.1)\n return tf.get_variable(\n 'weight', initializer=initial, regularizer=tf.nn.l2_loss)",
"def weight_variable(shape):\n initial = tf.truncated_normal(shape)\n return tf.Variable(initial)",
"def create_weight_variable(shape):... | [
"0.82676315",
"0.82352746",
"0.8158468",
"0.8156685",
"0.8139645",
"0.8139645",
"0.8139645",
"0.81377345",
"0.8120728",
"0.8065089",
"0.7982192",
"0.7978342",
"0.79574174",
"0.7919707",
"0.7776776",
"0.75521666",
"0.7532865",
"0.7504245",
"0.7303858",
"0.72897357",
"0.7204414... | 0.8134496 | 11 |
Return whether the project is frozen | def frozen_project():
return hasattr(sys, "frozen") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def we_are_frozen():\r\n\treturn hasattr(sys, \"frozen\")",
"def is_frozen():\r\n return hasattr(sys, 'frozen') and sys.frozen",
"def IsFrozen():\n if getattr(sys, \"frozen\", False):\n return True\n\n file_dir = os.path.dirname(sys.argv[0])\n\n # Fail-safe\n try:\n os.chdir(file_d... | [
"0.78078586",
"0.7634663",
"0.71416634",
"0.65451753",
"0.61488885",
"0.61222196",
"0.6061244",
"0.60501176",
"0.6012911",
"0.60122603",
"0.5994024",
"0.5969857",
"0.59257096",
"0.58281845",
"0.5824171",
"0.5821328",
"0.5810301",
"0.5793159",
"0.5779809",
"0.5757663",
"0.5756... | 0.8677583 | 0 |
Get Django project directory | def get_gui_path():
if frozen_project():
return os.path.dirname(sys.executable)
else:
return os.path.dirname(__file__) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _django_project_dir():\n return _interpolate(DJANGO_PROJECT_DIR)",
"def get_project_dir():\n\n return Path(settings.PROJECT_DIR)",
"def _GetDjangoProjectDir(self):\r\n \r\n manage_file, settings_file = self._FindKeyFiles()\r\n if manage_file is None:\r\n return None\r\n else:\r\n ... | [
"0.8984897",
"0.8700699",
"0.8123626",
"0.7800561",
"0.73934877",
"0.7343072",
"0.72928584",
"0.7282272",
"0.72678226",
"0.7219971",
"0.7183149",
"0.71668786",
"0.71668786",
"0.71656454",
"0.7068137",
"0.70033467",
"0.70033467",
"0.70033467",
"0.70033467",
"0.69782645",
"0.69... | 0.0 | -1 |
Check if the user has access to the required method. | def check_credentials(method):
@functools.wraps(method)
def wrapper(*args, **kwargs):
"""Check if the request is valid."""
response = {
"meta": {
"status": kwargs.pop("status", True),
"verbose": kwargs.pop("verbose", "OK")
},
"... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def allow_method (self, method, user, ** kw) :\n if self.auth_required and not \\\n (user and user.authenticated and user.active) :\n return False\n if isinstance (method, pyk.string_types) :\n try :\n method = GTW.RST.HTTP_Method.Table [method]\n ... | [
"0.76295257",
"0.73392624",
"0.73343",
"0.7326424",
"0.731631",
"0.72764957",
"0.7256667",
"0.7253566",
"0.7237147",
"0.7236626",
"0.71806896",
"0.7168283",
"0.7168283",
"0.7168283",
"0.7137698",
"0.7112184",
"0.7087511",
"0.70257586",
"0.69784284",
"0.69379395",
"0.6901241",... | 0.0 | -1 |
Returns true if both objects are equal | def __eq__(self, other):
# type: (object) -> bool
if not isinstance(other, SkillManifestPrivacyAndCompliance):
return False
return self.__dict__ == other.__dict__ | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __eq__(self, other):\n return are_equal(self, other)",
"def __eq__(self, other):\n return are_equal(self, other)",
"def __eq__(self,other):\n try: return self.object==other.object and isinstance(self,type(other))\n except: return False",
"def __eq__(self, other):\n if i... | [
"0.80891633",
"0.80891633",
"0.8055254",
"0.7983334",
"0.7967544",
"0.7967544",
"0.7967544",
"0.7967544",
"0.7967544",
"0.7967544",
"0.7967544",
"0.7967544",
"0.7967544",
"0.7967544",
"0.7967544",
"0.7967544",
"0.7967544",
"0.7967544",
"0.7967544",
"0.7967544",
"0.7967544",
... | 0.0 | -1 |
Returns true if both objects are not equal | def __ne__(self, other):
# type: (object) -> bool
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.8085325",
"0.8085325",
"0.8076365",
"0.8076365",
"0.8065748",
"0.8042487",
"0.8042487",
"0.8042487",
"0.8042487",
"0.8042487",
"0.8042487",
"0.8042487",
"0.8042487",
"0.8042487",
"0.8042487",
"... | 0.80920255 | 6 |
Standard form derivative vector dy/dt = f | def f_qmhosc(t, y, E):
# replace the next line with your code
raise NotImplementedError | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def f(self, x , u , t = 0 ):\n y = x[0]\n dy = x[1]\n \n \n ddy = - y + self.mu * dy * ( 1 - y**2 )\n \n dx = np.zeros(self.n) # State derivative vector\n \n dx[0] = dy\n dx[1] = ddy\n \n return dx",
"def ddalf(x):\n re... | [
"0.74118215",
"0.70713615",
"0.70713615",
"0.70241827",
"0.69959396",
"0.69624066",
"0.6928697",
"0.6922399",
"0.69155115",
"0.6914952",
"0.6887787",
"0.6883815",
"0.6871876",
"0.6833979",
"0.6830187",
"0.680934",
"0.68087226",
"0.6802347",
"0.6789764",
"0.6783344",
"0.676567... | 0.0 | -1 |
Extracts a dataframe from a csv file path. | def extract_df(self, file_path):
df = pd.read_csv(file_path, sep=";")
df.rename(columns={"Get": "Currency"}, inplace=True)
df = df[df["Pay"] == "Chaos Orb"]
df = df[["League", "Date", "Currency", "Value"]]
df["Date"] = pd.to_datetime(df["Date"])
df["Date"] = df["Date"] - ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def csv_to_df(self, path=None):\n # reads the csv file and puts it to the dataframe\n df = pd.read_csv(path)\n return df",
"def get_data(path):\n df = pd.read_csv(path)\n\n return df",
"def read_csv(csv_path):\n \n df = pd.read_csv(csv_path)\n\n return df",
"def load_data(... | [
"0.78663635",
"0.78641117",
"0.7813696",
"0.77866244",
"0.77561927",
"0.7724274",
"0.76668996",
"0.7625887",
"0.7583813",
"0.75792885",
"0.75658774",
"0.74681246",
"0.7372635",
"0.732907",
"0.7319864",
"0.7311244",
"0.73067987",
"0.73067987",
"0.724225",
"0.7203717",
"0.72022... | 0.0 | -1 |
A plotly scatter plot of each currency over the days since the league started. The currency plotted can be adjusted in the dropdown menu. Leagues can be toggled on the right hand legend. | def plot_currency(self, df=None, league_names=None, currency_list=None):
if not df:
df = self.df
if not league_names:
league_names = self.league_names
if not currency_list:
currency_list = self.latest_currency
df = df.fillna(0)
fig = go.Figur... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def scatter(df):\n figs = []\n\n for prop_type in df['property_type'].unique():\n df_filt = df[df['property_type'] == prop_type]\n figs.append(\n go.Scatter(x=df_filt['year'],\n y=df_filt['price_paid'],\n mode='markers',\n ... | [
"0.6387258",
"0.62562644",
"0.62561905",
"0.62450075",
"0.62242776",
"0.6089371",
"0.60658604",
"0.6047351",
"0.5986556",
"0.5863006",
"0.58064127",
"0.5792166",
"0.5779784",
"0.57734954",
"0.5734864",
"0.57324374",
"0.57186824",
"0.5690769",
"0.56768566",
"0.5672327",
"0.565... | 0.7011267 | 0 |
Calculate the sigmoid for a given node net value. This will be the output of the node. | def out(input_lst, weight_lst, bias):
return 1 / (1 + math.exp(-1 * net(input_lst, weight_lst, bias))) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sigmoid(value):\n return 1.0 / (1.0 + math.exp(-value))",
"def sigmoid(number):\n\n # Return the calculated value\n return 1 / (1 + math.exp(-number))",
"def sigmoid(x):\n return 1 / (1 + math.exp(-x))",
"def sigmoid(data):\n return _make.sigmoid(data)",
"def sigmoid(x):\n\treturn ... | [
"0.81489015",
"0.7878923",
"0.76249677",
"0.76079345",
"0.75991523",
"0.75726384",
"0.75661886",
"0.75589615",
"0.75589615",
"0.75559783",
"0.7545747",
"0.7545747",
"0.75425965",
"0.7540478",
"0.753102",
"0.7512009",
"0.75046784",
"0.7502625",
"0.74917054",
"0.74635553",
"0.7... | 0.0 | -1 |
Use the cross entropy_cost function to calculate test accuracy C (W, B) = 1/n > FOR EACH OUTPUT NODE (Y1 Y1 ln(OutputOut) (1 Y1) ln(1 OutputOut) | def cross_entropy_cost(output_out, target_out):
total = 0
for target_node in range(len(target_out)): # For each target data set
for output_node in range(len(output_out)): # For each output node
total += target_out[target_node][output_node] - target_out[target_node][output_node] * np.lo... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def calculate_cross_entropy(self, output, flat_labels): #completed, expensive, should be compiled\n return -np.sum(np.log(np.clip(output, a_min=1E-12, a_max=1.0))[np.arange(flat_labels.shape[0]), flat_labels[:,1]])",
"def cost(self, output, labels, weights):\n return tf.multiply(0.5 * tf.square(output ... | [
"0.7147914",
"0.6966971",
"0.69210225",
"0.6916416",
"0.6836677",
"0.67583424",
"0.675516",
"0.6698158",
"0.66814685",
"0.66542345",
"0.6639745",
"0.6603652",
"0.6529844",
"0.65057",
"0.6492452",
"0.64892566",
"0.6467188",
"0.64471984",
"0.64458996",
"0.64451957",
"0.64447767... | 0.8175276 | 0 |
Takes in two lists of the same length and returns y sorted by the indexing of x sorted. | def index_sort(y,x):
xs=np.sort(x)
ix=np.argsort(x)
ys=np.ones(len(y)) #Sorted by the sorting defined by f being sorted.
for i in range(len(y)):
j=ix[i]
ys[i]=y[j]
return ys | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sort_lists(X, Y):\n\n T = sorted(zip(X, Y), key=lambda x: x[0])\n X = np.array([x for x, _ in T])\n Y = np.array([y for _, y in T])\n return X, Y",
"def custom_sort(x, y):\n if x[1] == y[1]:\n return 1 if x[0] > y[0] else -1\n return cmp(y[1], x[1])",
"def sort2(x, y):\n if y < ... | [
"0.7483256",
"0.678364",
"0.6698966",
"0.6548078",
"0.6394822",
"0.63507754",
"0.625978",
"0.6214054",
"0.6206101",
"0.6170923",
"0.6061609",
"0.6040528",
"0.5972946",
"0.5954422",
"0.5928571",
"0.59281534",
"0.5903124",
"0.58640814",
"0.58632004",
"0.5854776",
"0.5853001",
... | 0.7911107 | 0 |
Initialises a Mock Video Manager. | def __init__(self, video: cv2.VideoCapture):
self.video = video | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def setUp(self):\r\n self.mod = VideoAnnotationModule(\r\n Mock(),\r\n get_test_system(),\r\n DictFieldData({'data': self.sample_xml, 'sourceUrl': self.sample_sourceurl}),\r\n ScopeIds(None, None, None, None)\r\n )",
"def setUp(self):\r\n super(Vid... | [
"0.67581904",
"0.64824015",
"0.6355656",
"0.6274247",
"0.6224967",
"0.61923236",
"0.61902136",
"0.6128465",
"0.5996813",
"0.5994989",
"0.5896244",
"0.58381426",
"0.56957865",
"0.5675073",
"0.56449157",
"0.5631838",
"0.5573484",
"0.5557005",
"0.55542034",
"0.5549029",
"0.55483... | 0.53804874 | 32 |
Reshape a stack of images into an NxN (2D) grid. | def stack2grid(stack):
n = int(np.sqrt(stack.shape[0]))
if n**2 < stack.shape[0]:
n += 1
_stack = np.zeros((n**2, stack.shape[1], stack.shape[2]))
_stack[:stack.shape[0]] = stack
grid = _stack.reshape(n, n, _stack.shape[1], _stack.shape[2])
grid = grid.swapaxes(1, 2)
grid = grid.resh... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def tile_images(image_stack):\n assert len(image_stack.shape) == 4\n image_list = [image_stack[i, :, :, :] for i in range(image_stack.shape[0])]\n tiled_images = np.concatenate(image_list, axis=1)\n return tiled_images",
"def np_make_image_grid(images, nrow, pad=2):\n height, width = images[0].sha... | [
"0.70496476",
"0.68358976",
"0.6607711",
"0.66076595",
"0.656279",
"0.653498",
"0.65072936",
"0.6501133",
"0.64888084",
"0.6467831",
"0.64456403",
"0.64403653",
"0.62870204",
"0.6142395",
"0.6101684",
"0.6070413",
"0.6047843",
"0.6047843",
"0.60325116",
"0.59984607",
"0.59723... | 0.7001085 | 1 |
Gets the end cycle | def get_end(self):
return self.end_cycle | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _get_end(self):\n return self._end",
"def get_end(self):\n return self.__end",
"def get_end(self):\n return self._end",
"def getEnd(self) -> long:\n ...",
"def end(self):\n return self.end_",
"def end(self):\n\t\treturn self._end",
"def cycle(self):\n retur... | [
"0.7403909",
"0.7326128",
"0.72374856",
"0.70053214",
"0.6911226",
"0.6892626",
"0.6870236",
"0.6864447",
"0.68596363",
"0.68445116",
"0.68358475",
"0.68358475",
"0.68358475",
"0.68298787",
"0.6634621",
"0.66159403",
"0.65776396",
"0.65713555",
"0.6504512",
"0.646576",
"0.646... | 0.88050103 | 0 |
Fetches all the Alert Policies identified by the filter passed as filter parameter. The desired return type can be specified by the format parameter, the supported formats are "dict", "json" and None which returns python dictionary, stringified JSON and protobuf respectively. | def list_alert_policies(
self,
project_id: str = PROVIDE_PROJECT_ID,
format_: str | None = None,
filter_: str | None = None,
order_by: str | None = None,
page_size: int | None = None,
retry: Retry | _MethodDefault = DEFAULT,
timeout: float | None = None,
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def list_policy(self, **kwargs):\n\n all_params = ['pretty', 'label_selector', 'field_selector', 'watch', 'resource_version', 'timeout_seconds']\n all_params.append('callback')\n\n params = locals()\n for key, val in iteritems(params['kwargs']):\n if key not in all_params:\n ... | [
"0.5876873",
"0.5760106",
"0.56708795",
"0.55930024",
"0.545748",
"0.54561687",
"0.54528487",
"0.5424432",
"0.54059166",
"0.5388893",
"0.53849196",
"0.53104997",
"0.5272721",
"0.51980495",
"0.5186063",
"0.5153899",
"0.51417834",
"0.5108986",
"0.5097155",
"0.5069024",
"0.50689... | 0.7392986 | 0 |
Validates that username exists. | def test_username(self):
self.assertEqual(self.user.username, "daron") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def validate_username(self, username):\n user = User.query.filter_by(username=username.data).first()\n if user:\n raise ValidationError('That username already exists. Please choose another username.')",
"def validate_username(self, username_field):\n if User.get_by_username(userna... | [
"0.82671064",
"0.8243311",
"0.8148156",
"0.81465757",
"0.8130147",
"0.8118754",
"0.8054453",
"0.80069405",
"0.79885566",
"0.7970082",
"0.7969505",
"0.7964778",
"0.786958",
"0.78461826",
"0.78461826",
"0.78245294",
"0.78217024",
"0.78082705",
"0.7804575",
"0.7798418",
"0.76926... | 0.0 | -1 |
Checks a filename to see if the image can be loaded. | def check_image(self, filename):
error = None
file_type = None
abs_path = os.path.expanduser(os.path.expandvars(filename))
if not os.path.isabs(abs_path):
try:
if is_qt_designer():
p = self.get_designer_window()
if p i... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_image_file(filename):\n return has_file_allowed_extension(filename, IMG_EXTENSIONS)",
"def image_is_available(filename):\n # FIXME - Implement!\n file_path = os.path.join(app.config['UPLOAD_FOLDER'], filename)\n return os.path.isfile(file_path)",
"def allowed_image(filename):\n \n if n... | [
"0.7709825",
"0.7623971",
"0.75272745",
"0.7511718",
"0.7342195",
"0.73200023",
"0.72929937",
"0.7260038",
"0.7240933",
"0.72077227",
"0.7171105",
"0.7066555",
"0.7054715",
"0.69787014",
"0.69657904",
"0.6960555",
"0.6955605",
"0.6929177",
"0.6845409",
"0.68088657",
"0.680815... | 0.7275409 | 7 |
Unescape a string that was the output of escape() | def unescape(escaped_string):
hex_msg = "^x not followed by a valid 2-digit hex number"
token_start = 0
l = len(escaped_string)
i = 0
output = []
while i < l:
c = escaped_string[i]
if c in _unprintables:
raise vps.errorhandler.StringUnspecial_characterException(
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def unescape(input):\n output=atpic.cleaner_escape.unescape(input)\n return output",
"def CUnescape(text):\n # type: (str) -> bytes\n\n def ReplaceHex(m):\n # Only replace the match if the number of leading back slashes is odd. i.e.\n # the slash itself is not escaped.\n if len(m.group(1)) & 1:\... | [
"0.7918344",
"0.7471021",
"0.73850304",
"0.73104185",
"0.7240245",
"0.7235035",
"0.7090391",
"0.70686185",
"0.7002204",
"0.6999091",
"0.6954795",
"0.69344044",
"0.6854047",
"0.6841928",
"0.6805756",
"0.67990834",
"0.6787888",
"0.67567325",
"0.6747645",
"0.6729851",
"0.6720272... | 0.6141516 | 45 |
Splits line into tokens based on whitespace separation. It takes into account spaces that are special_characterd. Returns a list of unspecial_characterd tokens. May raise StringUnspecial_characterException if any token is not a valid special_characterd string. just_one_token is used by unspecial_character(); in that ca... | def tokenize(quoted_line, line_completed=True, barf_on_unenterable=True,
just_one_token=False):
hex_msg = "^x not followed by a valid 2-digit hex number"
in_single_special_character_section = False
in_double_special_character_section = False
last_special_character_section_transition = -1
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _tokenize_line(self, line: str, pattern='\\W'):\n # TODO check nltk tokenize\n # TODO check string not to lower\n line = re.sub(\"[.,;:]\", \" \", line)\n return re.split(pattern, line.lower())",
"def split_whitespace_tokens(line):\n in_quote = False\n token = \"\"\n toke... | [
"0.65751344",
"0.65457356",
"0.6431441",
"0.6304925",
"0.6288682",
"0.6238891",
"0.62264663",
"0.6199222",
"0.61954075",
"0.6182821",
"0.6182821",
"0.6182821",
"0.6182674",
"0.612956",
"0.6125016",
"0.61085933",
"0.608585",
"0.608585",
"0.608585",
"0.608006",
"0.6059871",
"... | 0.55252534 | 50 |
Constructs a ResNet50 model. | def resnet50(pretrained=False, **kwargs):
model = ResNet(Bottleneck, [3, 4, 6, 3], **kwargs)
if pretrained:
model.load_state_dict(model_zoo.load_url(model_urls['resnet50']))
return model | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def resnet50(pretrained=False, **kwargs):\n model = ResNet(Bottleneck, [3, 4, 6, 3], **kwargs)\n if pretrained:\n model.load_state_dict(model_zoo.load_url(model_urls['resnet50']))\n fc = transfer_fc(model.fc)\n model.fc = fc\n return model",
"def resnet50(**kwargs):\n model = ResNet(... | [
"0.7557751",
"0.75548905",
"0.74557495",
"0.7386862",
"0.7386862",
"0.73601955",
"0.7355623",
"0.724254",
"0.724254",
"0.7191571",
"0.7158499",
"0.7101107",
"0.70165247",
"0.69687796",
"0.68687624",
"0.6822836",
"0.6801022",
"0.67330164",
"0.6718147",
"0.67159295",
"0.657444"... | 0.74759895 | 3 |
Returns minimum item in the priority queue. | def min(self):
return tuple(self.__heap[0]) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _find_min(self):\n if self.is_empty(): # is_empty inherited from base class\n raise Empty('Priority queue is empty')\n small = self._data.first()\n walk = self._data.after(small)\n while walk is not None:\n if walk.element() < small.element():\n small = walk\n walk = self._dat... | [
"0.86740386",
"0.84535",
"0.8113418",
"0.80409086",
"0.80255353",
"0.80082375",
"0.80082375",
"0.79475576",
"0.79256207",
"0.78295034",
"0.77828515",
"0.77618265",
"0.7739976",
"0.76487297",
"0.7520621",
"0.7504462",
"0.7502975",
"0.74707234",
"0.7452476",
"0.7439667",
"0.742... | 0.734252 | 24 |
Check if given string is a valid UUIDv4. | def is_uuid_v4(uuid_or_name):
# Based on https://gist.github.com/ShawnMilo/7777304
try:
uuid = UUID(uuid_or_name, version=4)
except Exception:
return False
return uuid.hex == uuid_or_name.replace("-", "") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_uuid4(uuid_string):\n try:\n UUID(uuid_string, version=4)\n except (ValueError, TypeError):\n # If it's a value error, then the string\n # is not a valid hex code for a UUID.\n # None will raise TypeError.\n return False\n return True",
"def validate_uuid(uuid_s... | [
"0.87398326",
"0.85870236",
"0.81463665",
"0.7984388",
"0.7666422",
"0.759155",
"0.75294316",
"0.71619904",
"0.7143167",
"0.7100845",
"0.7063074",
"0.6839967",
"0.6839967",
"0.6802052",
"0.6735238",
"0.6700896",
"0.6663512",
"0.6634178",
"0.6434822",
"0.6335212",
"0.6323491",... | 0.8171491 | 2 |
Get the distance to another location. | def distance(self, other: "Location") -> float:
return haversine(self.latitude, self.longitude, other.latitude, other.longitude) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def distance_to(self, location):\r\n return gislib.getDistance((self.latitude, self.longitude), location)",
"def distanceTo(self,other):\n if not isinstance(other,Point):\n return \n return math.sqrt((self.longitude - other.getLongitude())**2 +(self.latitude - other.getLatitude())**2)... | [
"0.81514907",
"0.7548553",
"0.7502511",
"0.7436494",
"0.7385018",
"0.737072",
"0.73502165",
"0.73502165",
"0.730601",
"0.7298372",
"0.72970104",
"0.7259561",
"0.725062",
"0.72413445",
"0.7224825",
"0.72099304",
"0.7201812",
"0.7201086",
"0.7133554",
"0.712062",
"0.7106387",
... | 0.7781438 | 1 |
Compare equality of two locations. | def __eq__(self, other):
if not isinstance(other, Location):
return False # pragma: nocover
return self.latitude == other.latitude and self.longitude == other.longitude | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sameLocation(self, other):\n if not isinstance(other,Point):\n return False\n return self.longitude == other.getLongitude() and self.latitude == other.getLatitude()",
"def __eq__(self, other):\n if not issubclass(other.__class__, Location):\n return False\n c... | [
"0.74703836",
"0.7385801",
"0.73534316",
"0.72939944",
"0.7277119",
"0.7277119",
"0.7259102",
"0.7210955",
"0.714857",
"0.70364016",
"0.70108616",
"0.699542",
"0.6977389",
"0.69659674",
"0.69055283",
"0.6857506",
"0.6834876",
"0.67926157",
"0.67019963",
"0.6655954",
"0.663355... | 0.79569364 | 0 |
Get the string representation of the data model. | def __str__(self):
return "Location(latitude={},longitude={})".format(
self.latitude, self.longitude
) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __str__(self):\n return str(self.get_data())",
"def __str__(self):\n return self.data.__str__()",
"def __str__(self):\n return self.data.__str__()",
"def __str__(self):\n return str(self.__data)",
"def __str__(self):\n return super().__str__() + self.model.__str__()",... | [
"0.78670263",
"0.78238934",
"0.78238934",
"0.7795347",
"0.7696795",
"0.7647701",
"0.7636353",
"0.75964624",
"0.7523055",
"0.7523055",
"0.7523055",
"0.7523055",
"0.7523055",
"0.7497484",
"0.7490004",
"0.7438348",
"0.7415895",
"0.74009764",
"0.7376508",
"0.7370196",
"0.7367113"... | 0.0 | -1 |
Compare with another object. | def __eq__(self, other):
return (
isinstance(other, Attribute)
and self.name == other.name
and self.type == other.type
and self.is_required == other.is_required
) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def cmp ( self, object1, object2 ):\n return cmp( self.get_raw_value( object1 ),\n self.get_raw_value( object2 ) )",
"def cmp ( self, object1, object2 ):\n return cmp( object1[ self.index ], object2[ self.index ] )",
"def __cmp__(self, other_code_object):\n # If our 'com... | [
"0.7622521",
"0.7611617",
"0.73632354",
"0.7318063",
"0.7318063",
"0.7318063",
"0.73024005",
"0.73024005",
"0.72151613",
"0.72151613",
"0.7194491",
"0.7158325",
"0.7151781",
"0.7146614",
"0.7146614",
"0.7146614",
"0.7146614",
"0.7146614",
"0.7146614",
"0.7146614",
"0.7146614"... | 0.0 | -1 |
Get the string representation of the data model. | def __str__(self):
return "Attribute(name={},type={},is_required={})".format(
self.name, self.type, self.is_required
) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __str__(self):\n return str(self.get_data())",
"def __str__(self):\n return self.data.__str__()",
"def __str__(self):\n return self.data.__str__()",
"def __str__(self):\n return str(self.__data)",
"def __str__(self):\n return super().__str__() + self.model.__str__()",... | [
"0.78670263",
"0.78238934",
"0.78238934",
"0.7795347",
"0.7696795",
"0.7647701",
"0.7636353",
"0.75964624",
"0.7523055",
"0.7523055",
"0.7523055",
"0.7523055",
"0.7523055",
"0.7497484",
"0.7490004",
"0.7438348",
"0.7415895",
"0.74009764",
"0.7376508",
"0.7370196",
"0.7367113"... | 0.0 | -1 |
Initialize a data model. | def __init__(self, name: str, attributes: List[Attribute], description: str = ""):
self.name: str = name
self.attributes = sorted(
attributes, key=lambda x: x.name
) # type: List[Attribute]
self._check_validity()
self.attributes_by_name = {a.name: a for a in self.att... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def initialize_model(self):\n pass",
"def init_model(self):\n pass",
"def initialize(self, model):\n pass",
"def initialize(self) -> None:\n self.model = load(self.path)",
"def initialize(self):\n LOG.info(\"Initializing Model.\")\n self.model = self.convert(df=sel... | [
"0.78117484",
"0.77257127",
"0.74677324",
"0.7367671",
"0.7334545",
"0.7249947",
"0.6913848",
"0.6889905",
"0.688308",
"0.68612355",
"0.68562347",
"0.6837921",
"0.67881936",
"0.6691892",
"0.66770154",
"0.66770154",
"0.66620165",
"0.6610961",
"0.65961677",
"0.6584727",
"0.6573... | 0.0 | -1 |
Compare with another object. | def __eq__(self, other) -> bool:
return (
isinstance(other, DataModel)
and self.name == other.name
and self.attributes == other.attributes
) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def cmp ( self, object1, object2 ):\n return cmp( self.get_raw_value( object1 ),\n self.get_raw_value( object2 ) )",
"def cmp ( self, object1, object2 ):\n return cmp( object1[ self.index ], object2[ self.index ] )",
"def __cmp__(self, other_code_object):\n # If our 'com... | [
"0.762473",
"0.7613882",
"0.7363944",
"0.73189265",
"0.73189265",
"0.73189265",
"0.7303699",
"0.7303699",
"0.7216503",
"0.7216503",
"0.719504",
"0.71596247",
"0.7152792",
"0.71477723",
"0.71477723",
"0.71477723",
"0.71477723",
"0.71477723",
"0.71477723",
"0.71477723",
"0.7147... | 0.0 | -1 |
Get the string representation of the data model. | def __str__(self):
return "DataModel(name={},attributes={},description={})".format(
self.name, {a.name: str(a) for a in self.attributes}, self.description
) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __str__(self):\n return str(self.get_data())",
"def __str__(self):\n return self.data.__str__()",
"def __str__(self):\n return self.data.__str__()",
"def __str__(self):\n return str(self.__data)",
"def __str__(self):\n return super().__str__() + self.model.__str__()",... | [
"0.7866514",
"0.7823241",
"0.7823241",
"0.77946645",
"0.7696293",
"0.7647018",
"0.7595808",
"0.7522376",
"0.7522376",
"0.7522376",
"0.7522376",
"0.7522376",
"0.7497396",
"0.74896693",
"0.7437749",
"0.741557",
"0.74006313",
"0.7376172",
"0.737004",
"0.7366758",
"0.7366758",
... | 0.7636113 | 6 |
Compare with another object. | def __eq__(self, other) -> bool:
return (
isinstance(other, Description)
and self.values == other.values
and self.data_model == other.data_model
) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def cmp ( self, object1, object2 ):\n return cmp( self.get_raw_value( object1 ),\n self.get_raw_value( object2 ) )",
"def cmp ( self, object1, object2 ):\n return cmp( object1[ self.index ], object2[ self.index ] )",
"def __cmp__(self, other_code_object):\n # If our 'com... | [
"0.762473",
"0.7613882",
"0.7363944",
"0.73189265",
"0.73189265",
"0.73189265",
"0.7303699",
"0.7303699",
"0.7216503",
"0.7216503",
"0.719504",
"0.71596247",
"0.7152792",
"0.71477723",
"0.71477723",
"0.71477723",
"0.71477723",
"0.71477723",
"0.71477723",
"0.71477723",
"0.7147... | 0.0 | -1 |
Get the string representation of the description. | def __str__(self):
return "Description(values={},data_model={})".format(
self._values, self.data_model
) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def GetDescription(self):\n return str(self.description)",
"def get_description(self) -> str:\n pass",
"def _get_description(self):\n return self.__description",
"def _get_description(self):\n return self.__description",
"def __str__(self) -> str:\n return self.descriptio... | [
"0.853982",
"0.80969375",
"0.8089973",
"0.8089973",
"0.80799115",
"0.80754954",
"0.80711687",
"0.8064773",
"0.8064773",
"0.8055473",
"0.8055473",
"0.8055473",
"0.8055473",
"0.8055473",
"0.8055473",
"0.8055473",
"0.8055473",
"0.8055473",
"0.8055473",
"0.8055473",
"0.8055473",
... | 0.0 | -1 |
Check equality with another object. | def __eq__(self, other):
return (
isinstance(other, ConstraintType)
and self.value == other.value
and self.type == other.type
) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"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 return self.__dict__ == other.__dict__",
"def __eq__(self, other):\n return self.__dict__ == other.__dict__",
"def __eq__(self, oth... | [
"0.8016821",
"0.797776",
"0.797776",
"0.797776",
"0.797776",
"0.797776",
"0.797776",
"0.797776",
"0.797776",
"0.797776",
"0.797776",
"0.797776",
"0.797776",
"0.797776",
"0.797776",
"0.797776",
"0.797776",
"0.797776",
"0.797776",
"0.797776",
"0.797776",
"0.797776",
"0.7977... | 0.0 | -1 |
Get the string representation of the constraint type. | def __str__(self):
return "ConstraintType(value={},type={})".format(self.value, self.type) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __str__(self):\n return \"Constraint(attribute_name={},constraint_type={})\".format(\n self.attribute_name, self.constraint_type\n )",
"def typeString(self):\n return Parameter.string_dict[self._field.type]",
"def __str__(self):\n if self.default_kind:\n re... | [
"0.7772626",
"0.7285393",
"0.71453077",
"0.71277934",
"0.68731374",
"0.68572843",
"0.6818982",
"0.6707029",
"0.6586058",
"0.6547385",
"0.64320374",
"0.64298046",
"0.640156",
"0.63922817",
"0.63814765",
"0.63478595",
"0.63478595",
"0.633397",
"0.63294846",
"0.6326131",
"0.6303... | 0.8202708 | 0 |
Compare with another object. | def __eq__(self, other): # pragma: nocover
return isinstance(other, And) and self.constraints == other.constraints | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def cmp ( self, object1, object2 ):\n return cmp( self.get_raw_value( object1 ),\n self.get_raw_value( object2 ) )",
"def cmp ( self, object1, object2 ):\n return cmp( object1[ self.index ], object2[ self.index ] )",
"def __cmp__(self, other_code_object):\n # If our 'com... | [
"0.762473",
"0.7613882",
"0.7363944",
"0.73189265",
"0.73189265",
"0.73189265",
"0.7303699",
"0.7303699",
"0.7216503",
"0.7216503",
"0.719504",
"0.71596247",
"0.7152792",
"0.71477723",
"0.71477723",
"0.71477723",
"0.71477723",
"0.71477723",
"0.71477723",
"0.71477723",
"0.7147... | 0.0 | -1 |
Compare with another object. | def __eq__(self, other): # pragma: nocover
return isinstance(other, Or) and self.constraints == other.constraints | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def cmp ( self, object1, object2 ):\n return cmp( self.get_raw_value( object1 ),\n self.get_raw_value( object2 ) )",
"def cmp ( self, object1, object2 ):\n return cmp( object1[ self.index ], object2[ self.index ] )",
"def __cmp__(self, other_code_object):\n # If our 'com... | [
"0.7622521",
"0.7611617",
"0.73632354",
"0.7318063",
"0.7318063",
"0.7318063",
"0.73024005",
"0.73024005",
"0.72151613",
"0.72151613",
"0.7194491",
"0.7158325",
"0.7151781",
"0.7146614",
"0.7146614",
"0.7146614",
"0.7146614",
"0.7146614",
"0.7146614",
"0.7146614",
"0.7146614"... | 0.0 | -1 |
Check if a value satisfies the 'Not' constraint expression. | def check(self, description: Description) -> bool:
return not self.constraint.check(description) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def isNot(self, value):\n newq = self.copy()\n newq.setOp(Query.Op.IsNot)\n newq.setValue(value)\n return newq",
"def test_not(self):\n x = t.Not(t.Exactly(\"x\"))\n self.assertEqual(writePython(x),\n dd(\"\"\"\n def _G_... | [
"0.70533",
"0.68487155",
"0.6804992",
"0.672575",
"0.6589403",
"0.65883005",
"0.6557127",
"0.646203",
"0.64563364",
"0.63983697",
"0.63981545",
"0.63245136",
"0.6233073",
"0.623266",
"0.6215068",
"0.61562663",
"0.6122397",
"0.61201733",
"0.60960263",
"0.60931945",
"0.6089722"... | 0.0 | -1 |
Compare with another object. | def __eq__(self, other): # pragma: nocover
return isinstance(other, Not) and self.constraint == other.constraint | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def cmp ( self, object1, object2 ):\n return cmp( self.get_raw_value( object1 ),\n self.get_raw_value( object2 ) )",
"def cmp ( self, object1, object2 ):\n return cmp( object1[ self.index ], object2[ self.index ] )",
"def __cmp__(self, other_code_object):\n # If our 'com... | [
"0.7622521",
"0.7611617",
"0.73632354",
"0.7318063",
"0.7318063",
"0.7318063",
"0.73024005",
"0.73024005",
"0.72151613",
"0.72151613",
"0.7194491",
"0.7158325",
"0.7151781",
"0.7146614",
"0.7146614",
"0.7146614",
"0.7146614",
"0.7146614",
"0.7146614",
"0.7146614",
"0.7146614"... | 0.0 | -1 |
Compare with another object. | def __eq__(self, other):
return (
isinstance(other, Constraint)
and self.attribute_name == other.attribute_name
and self.constraint_type == other.constraint_type
) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def cmp ( self, object1, object2 ):\n return cmp( self.get_raw_value( object1 ),\n self.get_raw_value( object2 ) )",
"def cmp ( self, object1, object2 ):\n return cmp( object1[ self.index ], object2[ self.index ] )",
"def __cmp__(self, other_code_object):\n # If our 'com... | [
"0.762473",
"0.7613882",
"0.7363944",
"0.73189265",
"0.73189265",
"0.73189265",
"0.7303699",
"0.7303699",
"0.7216503",
"0.7216503",
"0.719504",
"0.71596247",
"0.7152792",
"0.71477723",
"0.71477723",
"0.71477723",
"0.71477723",
"0.71477723",
"0.71477723",
"0.71477723",
"0.7147... | 0.0 | -1 |
Compare with another object. | def __eq__(self, other):
return (
isinstance(other, Query)
and self.constraints == other.constraints
and self.model == other.model
) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def cmp ( self, object1, object2 ):\n return cmp( self.get_raw_value( object1 ),\n self.get_raw_value( object2 ) )",
"def cmp ( self, object1, object2 ):\n return cmp( object1[ self.index ], object2[ self.index ] )",
"def __cmp__(self, other_code_object):\n # If our 'com... | [
"0.7622521",
"0.7611617",
"0.73632354",
"0.7318063",
"0.7318063",
"0.7318063",
"0.73024005",
"0.73024005",
"0.72151613",
"0.72151613",
"0.7194491",
"0.7158325",
"0.7151781",
"0.7146614",
"0.7146614",
"0.7146614",
"0.7146614",
"0.7146614",
"0.7146614",
"0.7146614",
"0.7146614"... | 0.0 | -1 |
Compute the Haversine distance between two locations (i.e. two pairs of latitude and longitude). | def haversine(lat1: float, lon1: float, lat2: float, lon2: float) -> float:
lat1, lon1, lat2, lon2, = map(radians, [lat1, lon1, lat2, lon2])
# average earth radius
R = 6372.8
dlat = lat2 - lat1
dlon = lon2 - lon1
sin_lat_squared = sin(dlat * 0.5) * sin(dlat * 0.5)
sin_lon_squared = sin(dlon ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def haversine(lat1, lng1, lat2, lng2):\n lat1, lng1, lat2, lng2 = map(np.radians, (lat1, lng1, lat2, lng2))\n AVG_EARTH_RADIUS = 6371 # in km\n lat = lat2 - lat1\n lng = lng2 - lng1\n d = np.sin(lat * 0.5) ** 2 + np.cos(lat1) * np.cos(lat2) * np.sin(lng * 0.5) ** 2\n h = 2 * AVG_EARTH_RADIUS * n... | [
"0.8146508",
"0.8100512",
"0.8097305",
"0.8048732",
"0.8044846",
"0.8033437",
"0.8031035",
"0.8025624",
"0.80176544",
"0.8015659",
"0.8014263",
"0.7983932",
"0.7980405",
"0.79779375",
"0.79752904",
"0.79730225",
"0.7970945",
"0.7966814",
"0.7956059",
"0.79516965",
"0.7948369"... | 0.8175937 | 0 |
Cast pandas serias to object dtype | def change_to_object(column, data):
data[column] = data[column].astype('object') | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def pandas_typecast(self) -> dict:\n res = {}\n for feat in self.data_features:\n res[feat.key] = ApiForm.typecast(feat.dtype)\n return res",
"def convert_dtype(data_df, settings):\n data_df = data_df.astype(settings[\"dtype\"])\n return data_df",
"def as_correct_dtype(obj... | [
"0.67604613",
"0.66118413",
"0.6585065",
"0.6539583",
"0.651566",
"0.6361538",
"0.6337701",
"0.6325281",
"0.62805223",
"0.6229707",
"0.62263525",
"0.6192798",
"0.61620414",
"0.6127977",
"0.60819775",
"0.607594",
"0.60554945",
"0.6034704",
"0.6016026",
"0.60135555",
"0.6009149... | 0.71351796 | 0 |
Returns lists of length batch_size. This can be used on any iterator, for example to batch up SeqRecord objects from Bio.SeqIO.parse(...), or to batch Alignment objects from Bio.AlignIO.parse(...), or simply lines from a file handle. This is a generator function, and it returns lists of the entries from the supplied it... | def batch_iterator(iterator, batch_size):
entry = True # Make sure we loop once
while entry:
batch = []
while len(batch) < batch_size:
try:
entry = next(iterator)
except StopIteration:
entry = None
if entry is None:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def batch_iterator(iterator, batch_size):\n entry = True # Make sure we loop once\n while entry:\n batch = []\n while len(batch) < batch_size:\n try:\n entry = iterator.__next__()\n except StopIteration:\n entry = None\n if entry i... | [
"0.74656767",
"0.741042",
"0.67104495",
"0.6694396",
"0.6676272",
"0.65970767",
"0.65255404",
"0.64785194",
"0.64456886",
"0.64217335",
"0.6420939",
"0.63311505",
"0.62625164",
"0.61932045",
"0.61634254",
"0.6144504",
"0.60994714",
"0.60760325",
"0.60626173",
"0.60367805",
"0... | 0.7452743 | 1 |
Replace URLs found in a text string with nothing (i.e. it will remove the URL from the string). | def remove_url(txt):
return " ".join(re.sub("([^0-9A-Za-z \t])|(\w+:\/\/\S+)", "", txt).split()) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def remove_urls(text):\n pass",
"def remove_urls(text):\n text = re.sub('(?P<url>https?://[^\\s]+)', '', text)\n return text",
"def remove_urls(self, text):\n return re.sub(r'http.?://[^\\s]+[\\s]?', '', text)",
"def _remove_urls(self, text: str) -> str:\n pattern = r\"http\\S+... | [
"0.8423916",
"0.837523",
"0.8313864",
"0.81369895",
"0.8087599",
"0.80584395",
"0.79589206",
"0.7952136",
"0.7834915",
"0.7704356",
"0.7645957",
"0.754977",
"0.7403431",
"0.7275754",
"0.7173083",
"0.71523416",
"0.71231145",
"0.7064132",
"0.7056617",
"0.68920684",
"0.68545234"... | 0.73466885 | 13 |
Returns contents of a file. >>> read_file('spanish_inquisition.txt') 'NObody expects the Spanish Inquisition!\n' | def read_file(filename):
with open(filename) as fp:
return fp.read() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def read_file(file):\n f = open(file, \"r\", encoding=\"utf8\")\n return f.read()",
"def read_file(file):\n with open(file, \"r\") as fid:\n return fid.read()",
"def read_file(file_path, mode='r', encoding=\"utf-8\"):\n with codecs.open(file_path, mode, encoding=encoding) as fp:\n ret... | [
"0.78285474",
"0.7735541",
"0.77233595",
"0.76412165",
"0.76401764",
"0.7573681",
"0.7557909",
"0.7532503",
"0.7512904",
"0.75125605",
"0.7429794",
"0.74264497",
"0.7421324",
"0.73868465",
"0.73715705",
"0.7338624",
"0.7337632",
"0.73204243",
"0.7313148",
"0.73110574",
"0.729... | 0.72079176 | 32 |
Returns ISO timestamp of curretn tiem and date. | def timestamp():
return datetime.datetime.now().strftime("%Y-%m-%d-T%H-%M-%S") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def iso_date(self, t=None):\n if t is None:\n t = time.time()\n time_str = time.strftime(\"%Y-%m-%d %H:%M:%S\", time.localtime(t))\n\n return time_str",
"def timestamp():\n return datetime.now().strftime(\"%Y%m%dT%H%M%S\")",
"def timestamp():\n\tn = datetime.datetime.now(... | [
"0.7021018",
"0.69629145",
"0.67915964",
"0.67721856",
"0.6649219",
"0.6624449",
"0.6624449",
"0.65787166",
"0.65740335",
"0.65738976",
"0.6565639",
"0.6465547",
"0.6445199",
"0.64336854",
"0.6433541",
"0.64203507",
"0.64095753",
"0.63976413",
"0.6396514",
"0.63837993",
"0.63... | 0.6699698 | 4 |
Restore internal mapping from saved JSON file | def loadMapping(self, mapfile="./mapping.json"):
try:
fd = open(mapfile, "r")
mappings = json.load(fd)
if "Sharing" in mappings.keys():
self.share_levels = mappings["Sharing"]
if "Type" in mappings.keys():
self.type_map = mappings["Type"]
if "Extra-Tag" in mappings.keys():
self.extra_tag = ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def reload_mappings(self):\n with open(self.mappings_path, 'rb') as f:\n mappings = cPickle.load(f)\n self.id_to_char = mappings['id_to_char']\n self.id_to_radical = mappings['id_to_radical']\n self.id_to_tag = mappings['id_to_tag']",
"def test_map_deserialization(self):\r\... | [
"0.6554897",
"0.6516311",
"0.62667114",
"0.6243241",
"0.61880374",
"0.6142793",
"0.60828453",
"0.60188895",
"0.59766734",
"0.5945837",
"0.59371763",
"0.58870447",
"0.58859056",
"0.58836526",
"0.58787686",
"0.5859276",
"0.58388174",
"0.58361346",
"0.5828212",
"0.5815395",
"0.5... | 0.5251691 | 91 |
Fills in the values attribute with range of values in terms of floats. | def arange(self, start: float, stop: float, step: float = 1.0) -> None:
self.values = []
assert step != 0.0
while abs(start) < abs(stop):
self.values.append(start)
start += step | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self, values: list[float]):\n self.values = values",
"def range(self, value):\n self.value_range = tuple([float(x) for x in value.split(':')])",
"def setValues(self, values):\n if values is not None:\n self.scale_min, self.scale_max = values\n if self.sca... | [
"0.6902379",
"0.67592275",
"0.67156196",
"0.6626498",
"0.652612",
"0.652612",
"0.652612",
"0.652612",
"0.6452978",
"0.636052",
"0.63506335",
"0.62599176",
"0.62409896",
"0.62345445",
"0.61869794",
"0.6116266",
"0.61118054",
"0.6107342",
"0.6028831",
"0.600489",
"0.5990786",
... | 0.64394945 | 9 |
Tests that the image helper can convert PIL image to a byte array. | def test_to_byte_array(self):
with Image.open(self.subject) as im:
image = im.convert("RGB")
byte_array = image_helper.to_byte_array(image)
self.assertGreater(len(byte_array), 0) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_get_image_and_to_byte_array_are_compatible(self):\n\n with open(self.subject, \"rb\") as f:\n content = f.read()\n\n image = image_helper.get_image(content)\n\n self.assertEqual(image.size, (800, 450))\n\n bytes_array = image_helper.to_byte_array(image)\n\n im... | [
"0.75684774",
"0.67727536",
"0.66932726",
"0.646276",
"0.640594",
"0.6395613",
"0.63800246",
"0.6243918",
"0.62386787",
"0.6222449",
"0.62130994",
"0.6212887",
"0.61353153",
"0.611385",
"0.6072642",
"0.6052421",
"0.60406977",
"0.5982475",
"0.5966007",
"0.59441936",
"0.5929215... | 0.80644786 | 0 |
Tests that the helper's got image can be converted to a byte array that can be converted back to an image with same format. | def test_get_image_and_to_byte_array_are_compatible(self):
with open(self.subject, "rb") as f:
content = f.read()
image = image_helper.get_image(content)
self.assertEqual(image.size, (800, 450))
bytes_array = image_helper.to_byte_array(image)
image = image_helper... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_to_byte_array(self):\n with Image.open(self.subject) as im:\n image = im.convert(\"RGB\")\n\n byte_array = image_helper.to_byte_array(image)\n\n self.assertGreater(len(byte_array), 0)",
"def test_get_picture_binary():\n from .scripts.initializedb import get_picture_bin... | [
"0.7975017",
"0.664871",
"0.6512237",
"0.6454277",
"0.62589556",
"0.62543744",
"0.62543744",
"0.62492985",
"0.62044793",
"0.61822695",
"0.6143906",
"0.61311436",
"0.61189926",
"0.6116207",
"0.6039462",
"0.59819657",
"0.5952059",
"0.5934923",
"0.59209025",
"0.5873931",
"0.5860... | 0.79083186 | 1 |
Sets the subnets of this CloudEndureRegion. | def subnets(self, subnets):
self._subnets = subnets | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def subnets(self) -> Optional[pulumi.Input[Sequence[pulumi.Input['ResourceIdArgs']]]]:\n return pulumi.get(self, \"subnets\")",
"def subnets(self) -> pulumi.Input[Sequence[pulumi.Input[str]]]:\n return pulumi.get(self, \"subnets\")",
"def subnets(self) -> Sequence[str]:\n return pulumi.get... | [
"0.6601207",
"0.651726",
"0.6426912",
"0.6417616",
"0.6305755",
"0.60576695",
"0.60576695",
"0.58017683",
"0.5759776",
"0.5611484",
"0.5570924",
"0.55240524",
"0.55008876",
"0.54991823",
"0.54599845",
"0.5417684",
"0.5330233",
"0.52798384",
"0.5270199",
"0.52492684",
"0.52372... | 0.8078121 | 0 |
Sets the placement_groups of this CloudEndureRegion. | def placement_groups(self, placement_groups):
self._placement_groups = placement_groups | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def groups(self, groups):\n\n self._groups = groups",
"def groups(self, groups):\n\n self._groups = groups",
"def groups(self, groups):\n\n self._groups = groups",
"def groups(self, groups):\n\n self._groups = groups",
"def groups(self, groups):\n self._groups = groups",
... | [
"0.6582488",
"0.6582488",
"0.6582488",
"0.6582488",
"0.6579127",
"0.6094563",
"0.58491284",
"0.57543033",
"0.56573033",
"0.5643829",
"0.557751",
"0.55425394",
"0.5540488",
"0.5436502",
"0.5380101",
"0.5377386",
"0.5281767",
"0.527716",
"0.5252314",
"0.5222774",
"0.508556",
... | 0.8624749 | 0 |
Sets the cloud of this CloudEndureRegion. | def cloud(self, cloud):
self._cloud = cloud | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def cloud_name(self, cloud_name):\n\n self._cloud_name = cloud_name",
"def cloud_platform(self, cloud_platform):\n\n self._cloud_platform = cloud_platform",
"def cloud_port(self, cloud_port):\n\n self._cloud_port = cloud_port",
"def cloud_storage_files(self, cloud_storage_files):\n\n ... | [
"0.63797104",
"0.63497365",
"0.61855185",
"0.5613878",
"0.5328697",
"0.5093455",
"0.49731243",
"0.48364145",
"0.4828867",
"0.4828867",
"0.4828867",
"0.48083326",
"0.47707668",
"0.4698903",
"0.4651919",
"0.46509022",
"0.46473148",
"0.4634034",
"0.46236116",
"0.45651832",
"0.45... | 0.78580654 | 0 |
Sets the max_cpus_per_machine of this CloudEndureRegion. | def max_cpus_per_machine(self, max_cpus_per_machine):
self._max_cpus_per_machine = max_cpus_per_machine | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def max_cores_per_machine_cpu(self, max_cores_per_machine_cpu):\n\n self._max_cores_per_machine_cpu = max_cores_per_machine_cpu",
"def max_mb_ram_per_machine(self, max_mb_ram_per_machine):\n\n self._max_mb_ram_per_machine = max_mb_ram_per_machine",
"def set_cpu_limit(self, nVmCpuLimit):\n\t\tcall... | [
"0.8146369",
"0.6632792",
"0.6448295",
"0.5938631",
"0.5932721",
"0.5900896",
"0.5847298",
"0.5802317",
"0.5797136",
"0.57552695",
"0.5752049",
"0.57163286",
"0.5701542",
"0.5683943",
"0.56803375",
"0.56765974",
"0.5672258",
"0.56681335",
"0.5665264",
"0.5662981",
"0.5659991"... | 0.8857602 | 0 |
Sets the name of this CloudEndureRegion. | def name(self, name):
self._name = name | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_name(self, name):\n self._name = name",
"def set_name(self, name):\n self.name = name",
"def set_name(self, name):\n self.name = name",
"def set_name(self, name):\n self.name = name",
"def set_name(self, name):\n self.name = name",
"def set_name(self, name):\n ... | [
"0.7338266",
"0.7296276",
"0.7296276",
"0.7296276",
"0.7296276",
"0.7296276",
"0.7253398",
"0.7253398",
"0.7242845",
"0.7241984",
"0.72217464",
"0.7195213",
"0.7190788",
"0.71830165",
"0.71816975",
"0.7094559",
"0.7094559",
"0.70401806",
"0.7021263",
"0.70063967",
"0.70063967... | 0.68695986 | 89 |
Sets the id of this CloudEndureRegion. | def id(self, id):
self._id = id | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def region_id(self, region_id: str):\n\n self._region_id = region_id",
"def region_id(self, region_id):\n\n self._region_id = region_id",
"def set_id(self, id):\n self.__id = id",
"def set_id(self, id_):\n\n self.id_ = id_",
"def set_id(self, id):\n self.data['id'] = id",... | [
"0.740834",
"0.72225213",
"0.70603174",
"0.7048572",
"0.69873774",
"0.68762517",
"0.6845341",
"0.6796173",
"0.67482746",
"0.6694591",
"0.6694591",
"0.6694591",
"0.6694591",
"0.6694591",
"0.6657391",
"0.6633931",
"0.6633931",
"0.6633931"
] | 0.6623999 | 85 |
Sets the max_cores_per_machine_cpu of this CloudEndureRegion. | def max_cores_per_machine_cpu(self, max_cores_per_machine_cpu):
self._max_cores_per_machine_cpu = max_cores_per_machine_cpu | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def max_cpus_per_machine(self, max_cpus_per_machine):\n\n self._max_cpus_per_machine = max_cpus_per_machine",
"def set_cpu_limit(self, nVmCpuLimit):\n\t\tcall_sdk_function('PrlVmCfg_SetCpuLimit', self.handle, nVmCpuLimit)",
"def set_cores(self, cores):\n self.cores = cores\n return",
"de... | [
"0.808749",
"0.6841824",
"0.6711843",
"0.6333083",
"0.60015947",
"0.59466875",
"0.5842922",
"0.5821356",
"0.5768645",
"0.576299",
"0.575716",
"0.5725852",
"0.5723611",
"0.56926966",
"0.5594216",
"0.5521066",
"0.55001587",
"0.5474118",
"0.5473368",
"0.53704816",
"0.53615856",
... | 0.89634717 | 0 |
Sets the dedicated_hosts of this CloudEndureRegion. | def dedicated_hosts(self, dedicated_hosts):
self._dedicated_hosts = dedicated_hosts | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def hosts(self, hosts):\n self._hosts = hosts",
"def update_cluster_hosts(self, hosts):\n self._hosts = hosts\n self._collect_hosts_d = True",
"def hosts_some(self, hosts_some):\n\n self._hosts_some = hosts_some",
"def set_hosts(self, hypervisor_per_cluster=False):\n\n self... | [
"0.70226884",
"0.6377096",
"0.6374231",
"0.6111645",
"0.6057798",
"0.5926802",
"0.5862724",
"0.585993",
"0.5825704",
"0.5605924",
"0.5528892",
"0.55059433",
"0.5498187",
"0.54011524",
"0.5387167",
"0.5309814",
"0.52846456",
"0.5221184",
"0.51668555",
"0.51419914",
"0.5130819"... | 0.8664203 | 0 |
Returns true if both objects are equal | def __eq__(self, other):
if not isinstance(other, CloudEndureRegion):
return False
return self.__dict__ == other.__dict__ | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __eq__(self, other):\n return are_equal(self, other)",
"def __eq__(self, other):\n return are_equal(self, other)",
"def __eq__(self,other):\n try: return self.object==other.object and isinstance(self,type(other))\n except: return False",
"def __eq__(self, other):\n if i... | [
"0.8088132",
"0.8088132",
"0.8054589",
"0.7982687",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
... | 0.0 | -1 |
Returns true if both objects are not equal | def __ne__(self, other):
return not self == other | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __ne__(self, other: object) -> bool:\n if self.__eq__(other):\n return False\n return True",
"def __ne__(self, other: object) -> bool:\n return not self.__eq__(other)",
"def __ne__(self, other) -> bool:\n return not self.__eq__(other)",
"def __eq__(self, other):\n ... | [
"0.8455985",
"0.83913255",
"0.81440157",
"0.8140831",
"0.8132328",
"0.80937284",
"0.809181",
"0.809181",
"0.809181",
"0.808509",
"0.808509",
"0.8076134",
"0.8076134",
"0.8065528"
] | 0.0 | -1 |
Formats the given url so it any leading characters are displaced | def formatURL(self, url):
pattern = r'(imdb\.com\/title\/(.*/))'
urls = re.findall(pattern, url)
urls = urls[0]
new_url = urls[0]
new_url = "https://www." + new_url
title_code = urls[1].replace("/", "")
return new_url | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def format_url(url):\n if not (url.startswith(\"//\") or url.startswith(\"http\")):\n url = \"http://\" + url\n return url",
"def format_url(url):\n no_scheme = url.split('://', 1)[-1]\n return '[{0}]({1})'.format(no_scheme, url)",
"def format_url(url: str) -> str:\n return urljoi... | [
"0.82604444",
"0.8078957",
"0.77885175",
"0.769441",
"0.7356258",
"0.73036456",
"0.72861105",
"0.726491",
"0.7264385",
"0.7141512",
"0.7031554",
"0.701557",
"0.69755876",
"0.6967986",
"0.69096154",
"0.68556064",
"0.6816078",
"0.67975533",
"0.6774955",
"0.67591643",
"0.6747995... | 0.72597337 | 9 |
Method to close a database connection | def close_connection(connection):
try:
if(connection):
connection.close()
print("{} \t Se cerró la conexión a la base de datos con éxito".format(datetime.now()))
except (Exception, psycopg2.Error) as error:
print("{} \t Error en el método close_connection".format(dateti... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def close_db_connection(cls):\n db.close()",
"def close_connection(exception):\n db = database()\n\n if db is not None:\n db.close()",
"def close_database(self):\n if self._conn is not None:\n self._conn.close()\n self._conn = None",
"def close_db_connection(s... | [
"0.8584509",
"0.8369829",
"0.8315697",
"0.8140779",
"0.81274027",
"0.80836815",
"0.8073903",
"0.80669165",
"0.80594736",
"0.793517",
"0.78819567",
"0.78679955",
"0.78678393",
"0.7836354",
"0.7822358",
"0.7788146",
"0.7713863",
"0.7710573",
"0.7708043",
"0.7698723",
"0.7687592... | 0.0 | -1 |
Request for a list of available taxonomy categories. Returns List of available taxonomy categories. Raises | def get_categories(self) -> list:
headers_dict = {
'user-key': self.user_key.key
}
endpoint = f'{const.API_HOST}{const.API_SNAPSHOTS_TAXONOMY_BASEPATH}'
response = req.api_send_request(method='GET', endpoint_url=endpoint, headers=headers_dict)
if response.status_co... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_categories(self):\n _url = urljoin(self.base_url, self.API_CATEGORIES)\n return requests.get(_url)",
"def get_categories():\n try:\n result = {\n \"success\": True,\n \"categories\": get_all_categories()\n }\n return jsonify(result)\n\n excep... | [
"0.7292924",
"0.6967509",
"0.67693406",
"0.67591196",
"0.66614026",
"0.6650035",
"0.660793",
"0.6532544",
"0.65089375",
"0.6495288",
"0.6481721",
"0.6448819",
"0.64479774",
"0.64477885",
"0.64409995",
"0.6430734",
"0.6415239",
"0.63934165",
"0.63934076",
"0.638821",
"0.638268... | 0.67147255 | 4 |
Request for a list of available taxonomy categories. Returns List of available taxonomy categories. Raises | def get_identifiers(self) -> list:
headers_dict = {
'user-key': self.user_key.key
}
endpoint = f'{const.API_HOST}{const.API_SNAPSHOTS_COMPANY_IDENTIFIERS_BASEPATH}'
response = req.api_send_request(method='GET', endpoint_url=endpoint, headers=headers_dict)
if respon... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_categories(self):\n _url = urljoin(self.base_url, self.API_CATEGORIES)\n return requests.get(_url)",
"def get_categories():\n try:\n result = {\n \"success\": True,\n \"categories\": get_all_categories()\n }\n return jsonify(result)\n\n excep... | [
"0.7292419",
"0.69674313",
"0.67695254",
"0.6758102",
"0.67141956",
"0.66597676",
"0.66498804",
"0.66072285",
"0.6533348",
"0.6509215",
"0.6495109",
"0.64814836",
"0.64487183",
"0.64482975",
"0.6445991",
"0.6439872",
"0.64305216",
"0.64146996",
"0.63939273",
"0.6392816",
"0.6... | 0.0 | -1 |
Get the configuration of this robot. | def get_robot_configuration(robot_name, frame):
target_ctrl_path = get_target_ctrl_path(robot_name)
attr = 'ikSolution'
configurations = []
for i in range(3):
index = i + 1
configuration_path = '{}.{}{}'.format(target_ctrl_path, attr, index)
configuration = get_attribute_value(co... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_config(self):\n return self.config",
"def config(self):\n if self.__config is None:\n self.__config = self._get_config(self.bot)\n return self.__config",
"def config(self):\n return self[CONFIG_KEY]",
"def getConfig(self):\n \n return self.config",... | [
"0.83200496",
"0.82543",
"0.8147049",
"0.81125456",
"0.8091864",
"0.7991595",
"0.7978447",
"0.7978447",
"0.79539555",
"0.7949045",
"0.79484713",
"0.79484713",
"0.79484713",
"0.78768295",
"0.7864503",
"0.7840981",
"0.7840981",
"0.78198487",
"0.78002524",
"0.77953583",
"0.77690... | 0.0 | -1 |
Creates a file dialog box that allows the user to select a directory to save program files. | def set_dir(text_field, pref_name, start_dir_callback, update_pref_callback, *args):
start_dir = start_dir_callback(pref_name)
# Prompt user with file dialog box.
# If they don't provide any input, exit the function.
directory = pm.fileDialog2(fileMode=2, dialogStyle=2,
s... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def saveFile(self):\n\n filename = qtw.QFileDialog.getExistingDirectory(\n self,\n \"Select directory\",\n qtc.QDir.homePath()\n )\n self.dir_line.setText(filename)",
"def FileSaveDialog( message, wildcard, style=0, defaultDir=os.getcwd(), defaultFile='' ):\n... | [
"0.74099964",
"0.7345407",
"0.72636163",
"0.70807993",
"0.70807993",
"0.7009018",
"0.6988619",
"0.6981659",
"0.6970907",
"0.6938663",
"0.69312894",
"0.69312894",
"0.69312894",
"0.69312894",
"0.6925773",
"0.69153225",
"0.69046813",
"0.68966717",
"0.68730664",
"0.6872555",
"0.6... | 0.0 | -1 |
Set translation and rotation of robot base in world space (square controller) in channel box to zero, 0. | def zero_base_world(*args):
robots = get_robot_roots()
if not robots:
pm.warning('Nothing Selected; Select a valid robot')
return
try:
for robot in robots:
world_ctrl_path = format_path(__WORLD_CTRL_PATH, robot)
pm.setAttr(world_ctrl_path + '.translate', 0, 0... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def setAllZero(self):\n self.robot.set_joint([0,0,0,0,0])\n self.robot.save_config()",
"def zero_base_local(*args):\n robots = get_robot_roots()\n if not robots:\n pm.warning('Nothing Selected; Select a valid robot')\n return\n\n try:\n for robot in robots:\n ... | [
"0.6703744",
"0.6197838",
"0.60408753",
"0.6006291",
"0.59761643",
"0.5902005",
"0.58105636",
"0.5797147",
"0.5770428",
"0.5769966",
"0.5718906",
"0.5688573",
"0.5670503",
"0.56196076",
"0.5570057",
"0.55502933",
"0.55210406",
"0.55116105",
"0.54934156",
"0.5441978",
"0.54365... | 0.74064714 | 0 |
Set translation and rotation of robot base in local space (circular controller) in channel box to zero, 0. | def zero_base_local(*args):
robots = get_robot_roots()
if not robots:
pm.warning('Nothing Selected; Select a valid robot')
return
try:
for robot in robots:
local_ctrl_path = get_local_ctrl_path(robot)
pm.setAttr(local_ctrl_path + '.translate', 0, 0, 0)
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def zero_base_world(*args):\n robots = get_robot_roots()\n if not robots:\n pm.warning('Nothing Selected; Select a valid robot')\n return\n\n try:\n for robot in robots:\n world_ctrl_path = format_path(__WORLD_CTRL_PATH, robot)\n pm.setAttr(world_ctrl_path + '.tr... | [
"0.68120915",
"0.66573197",
"0.63149035",
"0.6064744",
"0.60209364",
"0.592717",
"0.5866602",
"0.5769385",
"0.576865",
"0.56959367",
"0.56553197",
"0.56465787",
"0.5643025",
"0.5596358",
"0.5595492",
"0.5559126",
"0.55441326",
"0.55319196",
"0.5529447",
"0.55152404",
"0.54935... | 0.6777294 | 1 |
Gets the current axis position limits and updates UI with those values. | def get_axis_limits(robot=None):
if not robot:
robots = get_robot_roots()
if not robots:
raise MimicError('Nothing Selected; Select a valid robot')
return
if len(robots) > 1:
MimicError('Too many selections: Select a single robot')
return
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _update_limits(self):\n if self.pos_x > self.max_x:\n self.max_x = self.pos_x\n if self.pos_y > self.max_y:\n self.max_y = self.pos_y\n if self.pos_x < self.min_x:\n self.min_x = self.pos_x\n if self.pos_y < self.min_y:\n self.min_y = self... | [
"0.7109207",
"0.69640595",
"0.67974305",
"0.6790372",
"0.6540431",
"0.63663936",
"0.6342089",
"0.6176701",
"0.61733216",
"0.61061203",
"0.6102649",
"0.60832137",
"0.6078987",
"0.60743797",
"0.60540676",
"0.60022306",
"0.598839",
"0.5976953",
"0.59768814",
"0.5974315",
"0.5951... | 0.599552 | 16 |
Gets the current jerk limits and updates UI with those values. | def get_jerk_limits(robot):
return _get_limits(robot, "Jerk") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def limits(self):\n return self._limits",
"def update_limits(self):\n if len(self) == 0:\n self.limits = np.array([[0.0, 0.0], [0.0, 0.0]])\n else:\n x_min, x_max = self.buf[self.rear][0], self.buf[self.front][0]\n y_min, y_max = self.slmm.get_minmax()\n ... | [
"0.58975816",
"0.5847952",
"0.583106",
"0.5811838",
"0.5590838",
"0.5566813",
"0.5472094",
"0.5456995",
"0.5413246",
"0.5411612",
"0.5376125",
"0.53678626",
"0.5329208",
"0.5328781",
"0.53062344",
"0.5298036",
"0.529801",
"0.5291226",
"0.52837986",
"0.5264566",
"0.5260908",
... | 0.63602877 | 0 |
Get the control mode of Inverse Kinematics or Forward Kinematics in the Mimic UI. | def get_ui_ik_fk_state(*args):
if not pm.window("mimic_win", exists=True):
return None
current_tab = pm.tabLayout('switcher_tab_layout',
query=True,
selectTabIndex=True)
if current_tab == 1:
return 'ik'
elif current_tab == 2... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_current_eq_mode(self):\n response = self.get(COMMAND_UIC, 'GetCurrentEQMode')\n\n return response",
"def check_mode(self):\n if self.proximity.check_press():\n self.cycle_mode()\n return self.mode",
"def get_mode(self):\n if self.vimiv.library.treeview.is_f... | [
"0.5908778",
"0.5843041",
"0.5826631",
"0.580691",
"0.5749603",
"0.5733551",
"0.5707717",
"0.5700722",
"0.5672634",
"0.564353",
"0.5635786",
"0.5622795",
"0.5613513",
"0.5603332",
"0.5598407",
"0.5587633",
"0.5584845",
"0.5562646",
"0.5552864",
"0.555252",
"0.5546326",
"0.5... | 0.0 | -1 |
Plot the images and the matching keypoints. | def plot_images(img_A, img_B, match_A, match_B, name="p1", method="greedy"):
(hA, wA) = img_A.shape[:2]
(hB, wB) = img_B.shape[:2]
vis = np.zeros((max(hA, hB), wA + wB, 3), dtype="uint8")
vis[0:hA, 0:wA] = img_A
vis[0:hB, wA:] = img_B
# loop over the matches
for ptA, ptB in zip(match_A, mat... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def draw_matches(img1, keypoints1, img2, keypoints2, plot_title=\"\"):\n figure = plt.figure(figsize=(10, 5))\n ax1 = plt.subplot(1, 2, 1)\n ax2 = plt.subplot(1, 2, 2)\n img1 = cv2.drawKeypoints(img1, keypoints1, None)\n img2 = cv2.drawKeypoints(img2, keypoints2, None)\n ax1.imshow(img1)\n ax2... | [
"0.7567048",
"0.74431515",
"0.7196125",
"0.68250936",
"0.6809644",
"0.6759546",
"0.6554277",
"0.6538392",
"0.65300184",
"0.65259916",
"0.6523263",
"0.6501853",
"0.6433932",
"0.6376684",
"0.637564",
"0.63579607",
"0.6346513",
"0.6306306",
"0.6273557",
"0.62457085",
"0.6241184"... | 0.7474701 | 1 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.