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 |
|---|---|---|---|---|---|---|
Calculates the pairwise Euclidian distance between every row in x and every row in c. | def dist(x, c):
ndata, dimx = x.shape
ncentres, dimc = c.shape
if dimx != dimc:
raise NameError("Data dimension does not match dimension of centres")
n2 = (
np.transpose(
np.dot(
np.ones((ncentres, 1)),
np.transpose(np.sum(np.square(... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _euclidian_distance(self, x1, x2):\n a= x1-x2\n a2 = a**2\n b = np.sum(a2, axis=1)\n c = np.sqrt(b)\n return c",
"def euclidean_distance(x1, x2):\n return np.sqrt(np.sum(np.square(np.subtract(x1, x2))))",
"def euclidean_distance(x, y):\n return sqrt(sum(pow(a - b, 2... | [
"0.68029565",
"0.66998553",
"0.6605251",
"0.6600759",
"0.6557083",
"0.65452576",
"0.65443283",
"0.6488906",
"0.6460916",
"0.6457993",
"0.6440063",
"0.64194614",
"0.6408935",
"0.6305709",
"0.63016975",
"0.627863",
"0.6258667",
"0.6198785",
"0.61773753",
"0.61765146",
"0.615817... | 0.71863043 | 0 |
Insert a new window into the splitter at the position given in ``idx``. | def InsertWindow(self, idx, window, sashPos=-1):
assert window not in self._windows, "A window can only be in the splitter once!"
self._windows.insert(idx, window)
self._sashes.insert(idx, -1)
if not window.IsShown():
window.Show()
if sashPos != -1:
self._... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def insert(self, index: int, obj: Any) -> None:\n from ..pane import panel\n new_objects = list(self)\n new_objects.insert(index, panel(obj))\n self.objects = new_objects",
"def insert(self, idx, value):\n assert(isinstance(idx, int))\n nidx = self._normalize_idx(idx)\n ... | [
"0.6163976",
"0.6134813",
"0.58453065",
"0.579469",
"0.5746682",
"0.57187706",
"0.56331015",
"0.5601442",
"0.55882573",
"0.553759",
"0.5531148",
"0.5527489",
"0.5500755",
"0.54762596",
"0.5476251",
"0.5469549",
"0.54541147",
"0.5431927",
"0.5429707",
"0.53940713",
"0.5370667"... | 0.7888094 | 0 |
Return the release version in a crates.iofriendly string. | def to_crate_str(self):
return (self.base + self.suffix).replace("~", "-") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_version_string():\n major, minor, micro, patch, tag, relnum, is_release = VERSION\n\n version = '%s.%s' % (major, minor)\n\n if micro or patch:\n version += '.%s' % micro\n\n if patch:\n version += '.%s' % patch\n\n if tag != 'final':\n if tag == 'rc':\n ... | [
"0.79058903",
"0.7780097",
"0.77176553",
"0.7532983",
"0.7472366",
"0.74257886",
"0.74156046",
"0.7380436",
"0.7291979",
"0.72824234",
"0.72598547",
"0.723764",
"0.7163598",
"0.7089318",
"0.7083575",
"0.70570093",
"0.70451665",
"0.7023763",
"0.70198905",
"0.6991338",
"0.69774... | 0.0 | -1 |
Returns the item in the array located at the given index. | def __getitem__(self, index):
if self.valid_index(index):
return self._data[index]
else:
return IndexError | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_item(array, index):\n row, column = index\n return array[row][column]",
"def __getitem__(self, index):\n return self.array[index]",
"def __getitem__(self, index):\n #Check to see whether or not the index is within the array's element range.\n if index >= 0 and index < len(sel... | [
"0.876782",
"0.82417405",
"0.8166448",
"0.81090236",
"0.80863345",
"0.8044456",
"0.8040014",
"0.80389833",
"0.7894709",
"0.7845138",
"0.7845138",
"0.78234047",
"0.7742238",
"0.76888394",
"0.76776433",
"0.7605592",
"0.75243336",
"0.75243336",
"0.7481341",
"0.7461042",
"0.74400... | 0.7608426 | 15 |
Returns a string of the class in the correct format. | def __str__(self):
list_string = ""
for item in self._data:
list_string += item + ", "
return list_string | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __str__(self):\n class_dictionary = vars(self)\n out = self.__class__.__name__\n for k,v in class_dictionary.items():\n if v > 0:\n out += ' : ' + str(k) + ' = ' + str(v)\n return out",
"def __str__(self):\r\n class_name = type(self).__name__\r\n ... | [
"0.76854557",
"0.74000704",
"0.7333528",
"0.72251177",
"0.72075164",
"0.71726286",
"0.71575934",
"0.70826834",
"0.7062356",
"0.7053784",
"0.70503026",
"0.70492566",
"0.7047578",
"0.7037139",
"0.70356303",
"0.70343745",
"0.7020622",
"0.7020514",
"0.70175624",
"0.6985119",
"0.6... | 0.0 | -1 |
Forward pass that jointly computes unprocessed point and descriptor tensors. Input | def forward(self, x, subpixel=False):
# Let's stick to this version: first BN, then relu
if self.reBn:
# Shared Encoder.
x = self.relu(self.bn1a(self.conv1a(x)))
conv1 = self.relu(self.bn1b(self.conv1b(x)))
x, ind1 = self.pool(conv1)
x = self.relu(self.bn2a(self.conv2a(x... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def forward(self, inputs):\n coords = inputs['point'].to(self.device)\n feat = inputs['feat'].to(self.device)\n\n out_features_list = []\n for i in range(len(self.point_features)):\n feat, _ = self.point_features[i]((feat, coords))\n out_features_list.append(feat)\... | [
"0.69486964",
"0.6484827",
"0.63092494",
"0.61768806",
"0.6160743",
"0.6140143",
"0.6119511",
"0.60502565",
"0.6048652",
"0.6044676",
"0.6032995",
"0.59994125",
"0.5997703",
"0.59787637",
"0.5934518",
"0.591938",
"0.5918551",
"0.5918551",
"0.59182715",
"0.59145707",
"0.589592... | 0.0 | -1 |
Forward pass that jointly computes unprocessed point and descriptor tensors. Input | def forward_original(self, x):
# Shared Encoder.
x = self.relu(self.conv1a(x))
x = self.relu(self.conv1b(x))
x = self.pool(x)
x = self.relu(self.conv2a(x))
x = self.relu(self.conv2b(x))
x = self.pool(x)
x = self.relu(self.conv3a(x))
x = self.relu(self.conv3b(x))
x = self.pool(x)
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def forward(self, inputs):\n coords = inputs['point'].to(self.device)\n feat = inputs['feat'].to(self.device)\n\n out_features_list = []\n for i in range(len(self.point_features)):\n feat, _ = self.point_features[i]((feat, coords))\n out_features_list.append(feat)\... | [
"0.69486964",
"0.6484827",
"0.63092494",
"0.61768806",
"0.6160743",
"0.6140143",
"0.6119511",
"0.60502565",
"0.6048652",
"0.6044676",
"0.6032995",
"0.59994125",
"0.5997703",
"0.59787637",
"0.5934518",
"0.591938",
"0.5918551",
"0.5918551",
"0.59182715",
"0.59145707",
"0.589592... | 0.57381064 | 37 |
Returns if profile is reviewed | def is_reviewed(self, obj) -> bool: # pylint:disable=R0201
return obj.profile.is_reviewed | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_aprentice(self):\n return self.user_profile_status == self.APPRENTICE",
"def get_is_interested(self, obj):\n # pylint: disable=no-member\n user = self.context['request'].user\n if not user.is_authenticated:\n return None\n profile = UserProfile.objects.get(use... | [
"0.65807223",
"0.6455681",
"0.636535",
"0.63532865",
"0.61523813",
"0.604545",
"0.6023278",
"0.60175407",
"0.60112566",
"0.59523106",
"0.59211314",
"0.59168345",
"0.59168345",
"0.59055614",
"0.587551",
"0.58513856",
"0.5848138",
"0.58470607",
"0.5827722",
"0.58111256",
"0.580... | 0.8037057 | 0 |
Return the amount of index changes within group_idx. | def step_count(group_idx):
cmp_pos = 0
steps = 1
if len(group_idx) < 1:
return 0
for i in range(len(group_idx)):
if group_idx[cmp_pos] != group_idx[i]:
cmp_pos = i
steps += 1
return steps | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def number_of_loc_changes(self) -> int:\n raise NotImplementedError('not implemented')",
"def get_running_modulation_index_for_group(group):\n running = group[group.running == True].mean_response.values\n not_running = group[group.running == False].mean_response.values\n running_modulation_index ... | [
"0.5979224",
"0.5834849",
"0.57147247",
"0.56357473",
"0.5478815",
"0.5478815",
"0.5413969",
"0.53858835",
"0.5297234",
"0.52859676",
"0.5183537",
"0.5154006",
"0.51329195",
"0.51108426",
"0.506585",
"0.5060489",
"0.5019816",
"0.50143266",
"0.49929506",
"0.49897602",
"0.49711... | 0.6550264 | 0 |
MillerRabin Primality Test Returns true if n is a (probable) prime Returns false if n is a composite number | def miller_rabin(n, k=50):
if n < 6:
return [ValueStatus(n,False), ValueStatus(n,False), ValueStatus(n,True), ValueStatus(n,True), ValueStatus(n,False), ValueStatus(n,True)][n]
elif n & 1 == 0:
return ValueStatus(n,False)
s = 0
d = n - 1
while d % 2 == 0:
s = s + 1
d ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_miller_rabin_prime(n):\n if n <= 1:\n return False\n elif n == 2:\n return True\n elif n % 2 == 0:\n return False\n \n witnesses = get_witnesses(n)\n if witnesses is None:\n msg = 'No definite Miller-Rabin test is available for %d' % n\n raise ValueError(... | [
"0.87608814",
"0.87608814",
"0.8047598",
"0.8024371",
"0.7965792",
"0.78187656",
"0.7623074",
"0.7596072",
"0.75800395",
"0.7579114",
"0.75333875",
"0.7527089",
"0.74844104",
"0.7478475",
"0.74593306",
"0.7455964",
"0.74555504",
"0.7452185",
"0.74474126",
"0.7428849",
"0.7426... | 0.0 | -1 |
Connect the given handler to the signal. The handler must be a function. | def connect(self, handler):
if not isinstance(handler, types.FunctionType):
raise TypeError(_('Signal handler must be a function'))
id = self.make_id(handler)
if id not in self.registry:
self.registry[id] = handler
return handler | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_signal_handler(self, signal: str, handler: SignalType) -> None:\n self.signals[signal].append(handler)",
"def init_signal_handler():\n signal.signal(signal.SIGUSR1, sig_handler)\n signal.signal(signal.SIGTERM, term_handler)\n #logger.warning(\"Signal handler installed.\")",
"def connect... | [
"0.7627684",
"0.6861769",
"0.672494",
"0.66916746",
"0.66630167",
"0.65462124",
"0.65404403",
"0.6531397",
"0.6458894",
"0.63526833",
"0.63526833",
"0.63526833",
"0.63526833",
"0.63526833",
"0.63526833",
"0.63526833",
"0.63526833",
"0.63526833",
"0.63526833",
"0.63526833",
"0... | 0.8049782 | 0 |
Reads requirements.txt and preprocess it to be feed into setuptools. | def install_deps():
default = open('requirements.txt', 'r').readlines()
new_pkgs = []
links = []
for resource in default:
if 'git+https' in resource:
pkg = resource.split('#')[-1]
links.append(resource.strip())
new_pkgs.append(pkg.replace('egg=', '').rstrip())... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def install_deps():\n with open('requirements.txt', 'r') as f:\n packages = f.readlines()\n new_pkgs = []\n for resource in packages:\n new_pkgs.append(resource.strip())\n return new_pkgs",
"def parse_requirements_txt():\n root = os.path.dirname(os.path.abspath(__... | [
"0.7351353",
"0.7285738",
"0.7143396",
"0.71029484",
"0.7071416",
"0.7042396",
"0.70122844",
"0.6977663",
"0.69382316",
"0.6925654",
"0.6871271",
"0.6861534",
"0.6854198",
"0.67685986",
"0.6752274",
"0.67516816",
"0.67117393",
"0.67116797",
"0.671001",
"0.66584146",
"0.662875... | 0.67520505 | 15 |
Calculate the observation type 'pressure'. | def pressure(self, record, dbmanager):
# All of the following keys are required:
if any(key not in record for key in ['usUnits', 'outTemp', 'barometer', 'outHumidity']):
raise weewx.CannotCalculate('pressure')
# Get the temperature in Fahrenheit from 12 hours ago
temp_12h_v... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_pressure(self):\n return self._sense_hat.get_pressure() * 0.0295300",
"async def get_pressure(self) -> float: # type: ignore\n ...",
"def P(self):\n return self.generic_getter(get_pressure, \"p\", \"convert_pressure\")",
"def get_pressure(self): # This function implements the eq... | [
"0.7167293",
"0.7121203",
"0.7089161",
"0.70440894",
"0.6868273",
"0.6689609",
"0.6616602",
"0.66059804",
"0.6581442",
"0.6559756",
"0.6533378",
"0.6451725",
"0.64286846",
"0.6390696",
"0.6388448",
"0.6366312",
"0.6322066",
"0.63123626",
"0.6275013",
"0.6231922",
"0.6160388",... | 0.62533474 | 19 |
Expect a validation to validate email format. | def test_email():
assert is_email(None) is None
assert is_email('test@example.com') is None
assert is_email('other') | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_is_valid_email(self):\n self.assertTrue(is_valid_email('abc@example.com'))",
"def test_is_invalid_email(self):\n self.assertFalse(is_valid_email('helloworld'))",
"def validate_email(self, email):\n return models.Email.normalize_address(email)",
"def validate_email(val):\n mat... | [
"0.7471992",
"0.71164334",
"0.7115598",
"0.706264",
"0.6891267",
"0.68855715",
"0.68135124",
"0.6783953",
"0.6768952",
"0.6765581",
"0.67522",
"0.67386264",
"0.6729766",
"0.6716304",
"0.6695306",
"0.6653203",
"0.6648125",
"0.66064805",
"0.6593907",
"0.6573477",
"0.6551459",
... | 0.6597869 | 18 |
Set the openai client to use the correct api type, if available | def _openai_client(use_azure_api: bool, is_preference: bool):
if use_azure_api:
if azure_openai_available:
_use_azure_credentials()
elif is_preference and openai_available:
_use_openai_credentials()
elif is_preference:
raise EnvironmentError(
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_api_client(required_api: ApiEnum) -> IAPIHandler or None:\n if not isinstance(required_api, ApiEnum):\n raise TypeError(\"Not Api Enum Type\")\n\n logger = Logger().logger\n switch_case = {\n 1: ApiDataIL(logger),\n 2: ApiDataGlobal(logger),\n ... | [
"0.5925332",
"0.5826753",
"0.58209854",
"0.56702495",
"0.5668791",
"0.5608084",
"0.55783635",
"0.55764675",
"0.55520815",
"0.55520815",
"0.55520815",
"0.55520815",
"0.55520815",
"0.555179",
"0.55442226",
"0.55371374",
"0.55371374",
"0.5534859",
"0.55224",
"0.55224",
"0.55224"... | 0.70455986 | 0 |
Generate a plane from given parameters. | def topo_plane_paramEval(self, param):
# Create an empty numpy array with the same number as pixels as the real data.
self.topo_plane_fit_data = np.zeros((self.y_res, self.x_res))
for y in range(0, self.y_res): # Iterate over the y-axis pixels.
for x in range(0, self.x_res): # Iter... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def plane(self):\n return plane(self.N, self.o)",
"def create_plane(self):\n\n # First we calculate our point increment for both the x and y values\n inc_x = (self.xmax - self.xmin)/(self.xlen - 1)\n inc_y = (self.ymax - self.ymin)/(self.ylen - 1)\n\n # This for-loop will add e... | [
"0.71584624",
"0.7078942",
"0.70524687",
"0.6850336",
"0.67453235",
"0.6631249",
"0.6502954",
"0.6435931",
"0.6343309",
"0.63400143",
"0.62392014",
"0.62190753",
"0.6211114",
"0.609702",
"0.60943705",
"0.6060541",
"0.6044076",
"0.6035688",
"0.60242474",
"0.5960866",
"0.592626... | 0.59918004 | 19 |
postfix returns the correct definition | def test_postfix(self):
test_sensordef = {
"kind": self.test_postfix.get_kind(),
"name": "Postfix Mailqueue",
"description": "Monitors the mailqueue of a postfix server",
"help": "Monitors the mailqueue of a postfix server for active, deferred, hold or corrupt mai... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def prefix_to_postfix(input_str): # prefix requires that all operators precede the two operands that they work on\n\n \"\"\"Input argument: a string containing a prefix expression where tokens are \n space separated. Tokens are either operators + - * / ** << >> or numbers (integers or floats)\n Returns a... | [
"0.6605722",
"0.64262044",
"0.63493234",
"0.6326042",
"0.6259395",
"0.6233647",
"0.6224623",
"0.6155217",
"0.6135792",
"0.6046094",
"0.60342795",
"0.5997616",
"0.5982399",
"0.5977018",
"0.5966959",
"0.59417504",
"0.59266585",
"0.58920974",
"0.58474004",
"0.58299786",
"0.58236... | 0.5556429 | 28 |
Assign name in current context | def name(prefix = 'tmp'):
nameidx = context.curr().setdefault('NAME_INDEX', {})
idx = nameidx.setdefault(prefix, 0)
name = '_%s_%d' % (prefix, idx)
nameidx[prefix] = idx + 1
return name | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_name(self,name):\r\n self._name = __name",
"def name(self, name):\n self.__name = name",
"def enter_name(self, name):\n self.name = name",
"def set_name(self, name):\n\t\tself.name_ = name",
"def __set_name__(self, cls, name):\n pass",
"def name(self, name) :\n\t\ttry ... | [
"0.7603629",
"0.7359195",
"0.7339213",
"0.7284972",
"0.72548443",
"0.7245098",
"0.7211327",
"0.7188581",
"0.7188581",
"0.7188581",
"0.7188581",
"0.7188581",
"0.7188581",
"0.7188581",
"0.7188581",
"0.7188581",
"0.7188581",
"0.7188581",
"0.7188581",
"0.71883553",
"0.7152197",
... | 0.0 | -1 |
Calculate the Euclidean distance between two points (unitless). For points in the format (longitude, latitude), this is rarely the correct choice. | def euclidean(p1, p2):
return p1.distance(p2) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def euclidean_distance(point1, point2):\n return np.linalg.norm(np.array(point1) - np.array(point2))",
"def euclidean_distance(point_one, point_two):\n return np.linalg.norm(point_one-point_two)",
"def euclidean_distance(point1, point2):\n\n return math.sqrt(sum([(x - y) ** 2 for x, y in zip(point1, p... | [
"0.79519933",
"0.79426134",
"0.7892735",
"0.76993996",
"0.76495534",
"0.7563584",
"0.7518478",
"0.75115466",
"0.7497884",
"0.74887115",
"0.7474753",
"0.7468826",
"0.7443684",
"0.739675",
"0.73939896",
"0.73903334",
"0.7377273",
"0.73731744",
"0.7362087",
"0.7354319",
"0.73490... | 0.74961966 | 9 |
Translate a given point relative another point. | def _translate_coordinate(self, x1, y1, x2, y2):
return (x1 + x2, y1 + y2) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def translate(self, tr):\n c = self.c -self.a*tr[0] -self.b*tr[1]\n self.c =c\n self.pointN = self.pointN+tr\n self.point1 = self.point1+tr\n self.points +=tr",
"def translate(self, x, y=None):\n if isinstance(x, (tuple, Point, list)):\n dx, dy = x[0], x[1]\n ... | [
"0.7047761",
"0.69886786",
"0.68929327",
"0.6883983",
"0.6483363",
"0.6416408",
"0.64052224",
"0.6381029",
"0.63650244",
"0.6355266",
"0.63442343",
"0.6302933",
"0.6299255",
"0.6244557",
"0.6234837",
"0.62150633",
"0.62142223",
"0.6194179",
"0.61139977",
"0.6054143",
"0.60498... | 0.6802276 | 4 |
Plot a line from (x1,y1) to (x2,y2) with a thickness of 'width' and colored in with 'color'. | def _plot_line(self, image, x1, y1, x2, y2, width, color):
draw = ImageDraw.Draw(image, "RGBA")
draw.line([x1, y1, x2, y2], fill=color, width=width)
del draw
return image | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def draw_line(self, color, p1: Point, p2: Point, width):\n _p1 = self.T.itrans(p1)\n _p2 = self.T.itrans(p2)\n pg.draw.line(self.screen, color, _p1(), _p2(), 2)",
"def line(start, end, color, width=1):\r\n if type(start) != list:\r\n raise TypeError(\"Start must be a list\")\r\n if type... | [
"0.7853225",
"0.7137085",
"0.7058583",
"0.7018171",
"0.68886715",
"0.6864678",
"0.68258274",
"0.6810906",
"0.6771169",
"0.67028207",
"0.6629792",
"0.6600353",
"0.65859205",
"0.65853745",
"0.657316",
"0.6542504",
"0.64584184",
"0.63867915",
"0.6386562",
"0.63456875",
"0.631898... | 0.75322056 | 1 |
Initialize a new hierarchical dictionary with the given parent and declare the keys given by remaining keyword arguments. | def __init__(self, parent=None, **kwargs):
self.__dict__.update(_dict=dict(), parent=parent)
self.declare(**kwargs) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self, child_type = None):\r\n super().__init__()\r\n self.__child_dict = collections.OrderedDict()\r\n self.__child_type = child_type\r\n self.__mykeys = ()\r\n self.__parent = None",
"def __init__(self, parent):\r\n self.parent = parent[:]\r\n self.s... | [
"0.6976914",
"0.6381849",
"0.62552243",
"0.6250497",
"0.60511756",
"0.5969994",
"0.5917126",
"0.5901139",
"0.5825854",
"0.5782241",
"0.5780308",
"0.5767299",
"0.57625645",
"0.5736698",
"0.57274085",
"0.5664381",
"0.5641455",
"0.5638583",
"0.56125593",
"0.56095177",
"0.5599825... | 0.6928153 | 1 |
Aggregate the contributions from all the submitted FL clients. For the FLContext type we can use get_model() method to get the model data. The model data is a protobuf message and its format is defined as below. // A model consists of multiple tensors message ModelData { map params = 1; } // NDArray data for protobuf m... | def process(self, accumulator: [FLContext], fl_ctx: FLContext):
# The model data is in model.params as a dict.
model = fl_ctx.get_model()
vars_to_aggregate = [set(item.get_model().params) for item in accumulator]
vars_to_aggregate = set.union(*vars_to_aggregate)
for v_name in va... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def FedAvg_agregation_process(model, clients_models_hist:list , weights:list):\n \n new_model=deepcopy(model)\n set_to_zero_model_weights(new_model)\n\n for k,client_hist in enumerate(clients_models_hist):\n \n for idx, layer_weights in enumerate(new_model.parameters()):\n\n co... | [
"0.613949",
"0.59455645",
"0.5498214",
"0.548994",
"0.5385383",
"0.53500706",
"0.5338925",
"0.5338395",
"0.5325426",
"0.5310687",
"0.528085",
"0.52629817",
"0.52608985",
"0.51828355",
"0.5174483",
"0.51529896",
"0.51194733",
"0.5085171",
"0.50680023",
"0.5062635",
"0.5035405"... | 0.69327855 | 0 |
Returns ``True`` when each level has only one attribute, usually key. | def has_details(self):
if self.master:
return self.master.has_details
return any([level.has_details for level in self._levels.values()]) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def has_attributes(self):\n return bool(self.attrs)",
"def has_attributes(self):\n\n pass",
"def has_details(self):\n\n return len(self.attributes) > 1",
"def hasRequiredAttributes(self):\n return _libsbml.MultiSpeciesType_hasRequiredAttributes(self)",
"def has_attr(self, key):\... | [
"0.6631538",
"0.6575088",
"0.65007704",
"0.649437",
"0.64405346",
"0.640849",
"0.6306578",
"0.62792397",
"0.62700117",
"0.62597716",
"0.625594",
"0.62288916",
"0.6157059",
"0.6140927",
"0.6129157",
"0.61128205",
"0.6109501",
"0.61089975",
"0.6093218",
"0.60915434",
"0.6082363... | 0.0 | -1 |
Recursively generate of all the subclasses of class cls. | def all_subclasses(cls):
for subclass in cls.__subclasses__():
yield subclass
for subc in all_subclasses(subclass):
yield subc | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def class_hierarchy(clslist):\n for cls in clslist:\n subclass_list = cls.__subclasses__()\n if subclass_list:\n for subcls in class_hierarchy(subclass_list):\n yield subcls\n else:\n yield cls",
"def all_subclasses(cls):\r\... | [
"0.7979227",
"0.755188",
"0.7292565",
"0.7195263",
"0.7180769",
"0.7131219",
"0.7115148",
"0.71146095",
"0.70742047",
"0.70329833",
"0.6907529",
"0.68960387",
"0.68732136",
"0.6858354",
"0.68101364",
"0.6799725",
"0.67720544",
"0.67419857",
"0.67277503",
"0.66706437",
"0.6626... | 0.7600176 | 1 |
Returns a normalized data array from a NetCDF4 variable. This is mostly used to normalize string types between py2 and py3. It has no effect on types other than chars/strings | def normalize_array(var):
if np.issubdtype(var.dtype, 'S1'):
if var.dtype == str:
# Python 2 on netCDF4 'string' variables needs this.
# Python 3 returns false for np.issubdtype(var.dtype, 'S1')
return var[:]
def decoder(x):
return str(x.decode('utf-8... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def netcdf_compatible_array(arry):\n arry = strip_array_wrappers(arry)\n\n if arry.ndim > 0:\n for _ in range(3):\n if arry.dtype.char != \"O\" or arry.ndim == 0:\n break\n\n if arry.shape[0] == 1:\n arry = np.array(arry[0])\n else:\n ... | [
"0.6252294",
"0.58607996",
"0.5729138",
"0.5664723",
"0.5633084",
"0.5612027",
"0.5600556",
"0.5499273",
"0.54607147",
"0.5406877",
"0.54000634",
"0.5376952",
"0.5373824",
"0.53540933",
"0.5351059",
"0.5334112",
"0.53272974",
"0.52897096",
"0.5278241",
"0.5263216",
"0.5253681... | 0.79412615 | 0 |
Constructor to initialize the cash drawer. | def __init__(self) -> None:
self.__contents: Dict[CashDenomination, int] = dict()
for denom in CashDenomination:
self.__contents[denom] = 10
self.__open: bool = False
self.__updated_total: int = 0 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self):\n self.stock = Stock()\n self.foundations = {suit: Foundation(suit) for suit in SUITS}\n self.waste = Waste()\n # Deal cards face-down into each of the seven tableaus from the stock.\n # Each tableau has as many cards as its number.\n self.tableaus = [T... | [
"0.62851673",
"0.6148877",
"0.61278623",
"0.5962556",
"0.5934605",
"0.5791499",
"0.57812923",
"0.56987935",
"0.56987935",
"0.56986254",
"0.5615772",
"0.56126374",
"0.56118774",
"0.5611346",
"0.5609031",
"0.56040025",
"0.5597572",
"0.5591268",
"0.55709845",
"0.55685335",
"0.55... | 0.68711877 | 0 |
Get the total value of cash in the drawer. | def get_total(self) -> float:
if self.__open:
raise RuntimeError("Cash drawer must be closed to count.")
total: float = 0.0
for denom in CashDenomination:
total += self.__contents[denom] * denom.amount
return total | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_cash(self):\r\n return self.cash",
"def get_total(self):\n\n # Total sum\n self.sum = 0.00\n\n # Determine which Check buttons are selected\n # and add the charges to find the total\n if self.check_1.get() == 1:\n self.sum += 30.00\n if self.che... | [
"0.75750333",
"0.737253",
"0.7358128",
"0.7282601",
"0.7194819",
"0.70128757",
"0.697484",
"0.6900103",
"0.6885065",
"0.68487",
"0.68329656",
"0.6816387",
"0.68150896",
"0.6805231",
"0.6798124",
"0.6797543",
"0.6775235",
"0.6769115",
"0.6751928",
"0.6743421",
"0.6733409",
"... | 0.845132 | 0 |
returns the letter for the color of the gem, if the item is not a gem, raises ValueError | def gem_color(self):
for p in self.properties:
if p.name == "Experience":
break
else:
raise ValueError("Item is not a gem.")
return normfind(GEMS, self.type)["color"] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def GetItemTextColour(self, item):\r\n\r\n return item.Attr().GetTextColour()",
"def get_name_color(self):\n return self._item.get(\"name_color\")",
"def name_color(self):\n return self._item.get(\"name_color\")",
"def get_color(self) -> str:\r\n return self.color",
"def get_col... | [
"0.6689115",
"0.62872183",
"0.6247081",
"0.59663427",
"0.5924858",
"0.58372486",
"0.583166",
"0.5830465",
"0.5830465",
"0.5830465",
"0.5830465",
"0.5830465",
"0.5830465",
"0.5830465",
"0.5830465",
"0.5830465",
"0.5830465",
"0.5830465",
"0.5830465",
"0.5830465",
"0.5830465",
... | 0.6933351 | 0 |
Converts startdate default "yyyymmdd" to "dd/mm/yyyy" If startdate is falsey, returns a default value of "01/01/2017" | def fixstartdate(startdate):
if not startdate: return "01/01/2017"
s = str(startdate)
d,m,y = [max(dt,1) for dt in [int(s[6:8]),int(s[4:6]),int(s[:4])]]
return f"{d:0>2}/{m:0>2}/{y:0>4}" | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def format_date(date):\n try:\n start_date = datetime.strftime(date, '%m/%d/%Y')\n except (TypeError, ValueError) as e:\n start_date = date\n pass\n return start_date",
"def convert_date(self, date=None):\n if date is not None:\n format_str = '%d/%m/%Y'\n ... | [
"0.6806607",
"0.6599731",
"0.6569743",
"0.6556971",
"0.6467736",
"0.6244236",
"0.62234336",
"0.62105423",
"0.61149675",
"0.6101757",
"0.6064106",
"0.6031401",
"0.5988227",
"0.5988091",
"0.5983444",
"0.59787405",
"0.5977528",
"0.59767985",
"0.59604335",
"0.5924412",
"0.5900568... | 0.69818395 | 0 |
Checks if a key,value pair is a website link, and strips any enumeration created by cleanapidata_csv | def checklink(key,value):
try:
if not value.startswith(("http","www")): return False, False
## Value is not string, so it can't be website link
except: return False, False
linkresearch = LINKRE.search(key)
## In normal practice this really shouldn't happen :-/
if not linkresearch: return... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _fix_items(items):\n for _, item in items.iteritems():\n if 'url' in item['fields']:\n del item['fields']['url']\n return items",
"def clean_link(self, link):\n link = link.strip(\"[]\")\n if \"|\" in link: \n link = link.split(\"|\",1)[0]\n ... | [
"0.5696887",
"0.5592884",
"0.5586151",
"0.5527843",
"0.53796583",
"0.5375223",
"0.5373498",
"0.53691816",
"0.53691816",
"0.5327541",
"0.5304799",
"0.5298267",
"0.5296778",
"0.52762324",
"0.52760535",
"0.5252373",
"0.52514327",
"0.52257425",
"0.5225149",
"0.5216383",
"0.519350... | 0.64009696 | 0 |
Returns the label for the given position in the event sequence. | def events_to_label(self, events, position):
return self._event_to_label(events[position]) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_label_position(self) -> LabelPositionStr:\n return LABEL_POSITION.inverse[self.labelPosition()]",
"def _pos2label(self, p, labels):\n if labels is not None:\n if p in labels.keys():\n return labels[p]\n else:\n return ''\n #... | [
"0.7137825",
"0.6957431",
"0.6879422",
"0.6677894",
"0.6648449",
"0.6609771",
"0.6609771",
"0.6609771",
"0.65567636",
"0.65442675",
"0.65345794",
"0.65307945",
"0.65244424",
"0.6487697",
"0.6487659",
"0.6487659",
"0.6487659",
"0.6487659",
"0.6487659",
"0.6487659",
"0.6487659"... | 0.795989 | 0 |
Returns the event for the given class index. This is the reverse process of the self.events_to_label method. | def class_index_to_event(self, class_index, events):
assert class_index < self.num_classes
event = []
for i in range(self.input_size):
if class_index % 2:
event.append(i)
class_index >>= 1
assert class_index == 0
return tuple(event) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def label_from_index(self, index):\n raise NotImplementedError",
"def label_from_index(self, index):\n assert self.labels is not None, \"Labels not processed\"\n return self.labels[index]",
"def label_from_index(self, index):\n assert self.labels is not None, \"Labels not processed\... | [
"0.6606182",
"0.6589039",
"0.6109745",
"0.59348655",
"0.5916555",
"0.5910031",
"0.577028",
"0.5756773",
"0.5751221",
"0.5723118",
"0.5607669",
"0.55957085",
"0.55753785",
"0.5563397",
"0.5518617",
"0.5505856",
"0.5412464",
"0.538064",
"0.53580815",
"0.53562427",
"0.5273812",
... | 0.71515137 | 0 |
Validates a single TLS layer can be established. | def test_wrap_existing_socket(self) -> None:
self.start_dummy_server()
sock = socket.create_connection((self.host, self.port))
with SSLTransport(
sock, self.client_context, server_hostname="localhost"
) as ssock:
assert ssock.version() is not None
sso... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _validate_ssl_context_for_tls_in_tls(ssl_context):\n\n if not hasattr(ssl_context, \"wrap_bio\"):\n if six.PY2:\n raise ProxySchemeUnsupported(\n \"TLS in TLS requires SSLContext.wrap_bio() which isn't \"\n \"supported on Python 2\"\n ... | [
"0.6357398",
"0.63177687",
"0.6208061",
"0.61289585",
"0.6059553",
"0.60011894",
"0.5997709",
"0.5908259",
"0.58598775",
"0.5842388",
"0.5841764",
"0.58414155",
"0.5830173",
"0.5828574",
"0.57765365",
"0.573253",
"0.5701271",
"0.5695264",
"0.5681923",
"0.56663746",
"0.5579418... | 0.0 | -1 |
Returns the length of the dataset. | def __len__(self):
if self.mode.lower() == 'train':
return len(self.train_data)
if self.mode.lower() == 'val':
return len(self.val_data)
if self.mode.lower() == 'test':
return len(self.test_data)
raise RuntimeError("Unexpected dataset mode. "
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __len__(self):\n return self._dataset.size(dirs=self._dirs)",
"def dataset_size(self):\n return self.dataset.size",
"def length(self) -> int:\n return len(self.data)",
"def size(self) -> int:\r\n return self.da.length()",
"def length(self):\n return len(self.data)",
... | [
"0.83705217",
"0.8292335",
"0.82503945",
"0.81966084",
"0.8166881",
"0.8166881",
"0.8166881",
"0.81664485",
"0.81664485",
"0.81664485",
"0.81664485",
"0.81360644",
"0.80997175",
"0.8097067",
"0.80956763",
"0.80865896",
"0.80511165",
"0.79956216",
"0.7977738",
"0.7977133",
"0.... | 0.77700865 | 34 |
Get database from MongoDB connection. | def get_database(self):
if self._database is None:
conn = self.get_connection()
db = conn[self.database]
self._database = db
return self._database | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_db(db_name):\n client = MongoClient('localhost:27017')\n db = client[db_name]\n return db",
"def get_db(db_name):\n from pymongo import MongoClient\n client = MongoClient('localhost:27017')\n db = client[db_name]\n return db",
"def get_db():\n if not hasattr(g, 'mongo_db'):\n ... | [
"0.8525464",
"0.8488831",
"0.8338848",
"0.83155525",
"0.8303394",
"0.8183454",
"0.8165653",
"0.8153584",
"0.79083645",
"0.7907982",
"0.78870976",
"0.7863421",
"0.7856306",
"0.78129315",
"0.7756613",
"0.77328444",
"0.76435256",
"0.76404643",
"0.7625985",
"0.76184887",
"0.76122... | 0.73783094 | 32 |
Constructor. Any message fields that are implicitly/explicitly set to None will be assigned a default value. The recommend use is keyword arguments as this is more robust to future message changes. You cannot mix inorder arguments and keyword arguments. | def __init__(self, *args, **kwds):
if args or kwds:
super(BoundingBox, self).__init__(*args, **kwds)
# message fields cannot be None, assign default values for those that are
if self.Class is None:
self.Class = ''
if self.probability is None:
self.probability = 0.
if se... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self, *args, **kwds):\n if args or kwds:\n super(KomodoSpeechRecCommand, self).__init__(*args, **kwds)\n #message fields cannot be None, assign default values for those that are\n if self.header is None:\n self.header = std_msgs.msg.Header()\n if self.cmd is None:\n ... | [
"0.7794164",
"0.7721611",
"0.7721611",
"0.7687804",
"0.7626575",
"0.7565245",
"0.74406534",
"0.74182206",
"0.73521465",
"0.73088044",
"0.72807634",
"0.7238138",
"0.7227902",
"0.72254795",
"0.72254795",
"0.7219563",
"0.7212849",
"0.7212849",
"0.7212849",
"0.7212849",
"0.721284... | 0.0 | -1 |
Extracts all ngrams upto a given maximum order from an input segment. | def _get_ngrams(segments, order):
ngram_counts = collections.Counter()
for seg in segments:
for i in range(0, len(seg) - order + 1):
ngram = tuple(seg[i:i+order])
ngram_counts[ngram] += 1
return ngram_counts | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def extract_ngrams(line, min_order=1, max_order=BLEU.NGRAM_ORDER) -> Counter:\n\n ngrams = Counter() # type: Counter\n tokens = line.split()\n for n in range(min_order, max_order + 1):\n for i in range(0, len(tokens) - n + 1):\n ngram = ' '.join(tokens[i: i + n])\n ... | [
"0.66230047",
"0.66025776",
"0.6554927",
"0.6340896",
"0.62745255",
"0.6273979",
"0.6182349",
"0.6128668",
"0.6114464",
"0.61068773",
"0.6074412",
"0.60627776",
"0.6043362",
"0.6007949",
"0.5974253",
"0.5966303",
"0.59651804",
"0.5962682",
"0.59449154",
"0.5943035",
"0.594058... | 0.63554066 | 3 |
Sets the number of cells in the cochain. | def num_cells(self, num_cells):
# TODO: Add more checks here
self.__num_cells__ = num_cells | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_numcells(self, N):\n\t\tself.create_cells(N)\n\t\tself.connect_cells()\n\t\tself.connect_stim()",
"def set_numcells(self, N = []):\n self.set_gids(N)\n self.create_cells()\n\n #self.syn_output() # generate synaptic \"output\" in neuron\n #self.connect_cells()",
"def set_numc... | [
"0.80912846",
"0.7544548",
"0.74170864",
"0.7170566",
"0.68336755",
"0.6787758",
"0.6637126",
"0.6454511",
"0.6398522",
"0.6278625",
"0.62358934",
"0.6146525",
"0.6127814",
"0.6116803",
"0.61103666",
"0.6101158",
"0.6101158",
"0.6093219",
"0.604452",
"0.59982324",
"0.595896",... | 0.73379976 | 3 |
Constructs a batch object from a python list holding | def from_cochain_list(cls, data_list, follow_batch=[]):
keys = list(set.union(*[set(data.keys) for data in data_list]))
assert 'batch' not in keys and 'ptr' not in keys
batch = cls(data_list[0].dim)
for key in data_list[0].__dict__.keys():
if key[:2] != '__' and key[-2:] != ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def instantiate_batch(self, inputs):\n return inputs",
"def from_list(cls, rowslist, shape, domain):\n return cls(rowslist, shape, domain)",
"def split_and_load(batch, ctx_list):\n new_batch = []\n for i, data in enumerate(batch):\n if isinstance(data, (list, tuple)):\n new_da... | [
"0.6920796",
"0.6618978",
"0.65924877",
"0.6538061",
"0.64291334",
"0.6397609",
"0.6397609",
"0.6359194",
"0.6318075",
"0.618261",
"0.61316574",
"0.61219597",
"0.60410804",
"0.60316247",
"0.59410626",
"0.5938322",
"0.5903713",
"0.58859766",
"0.58829564",
"0.58569634",
"0.5848... | 0.6523233 | 4 |
Weighted binary crossentropy between an output tensor and a target tensor. POS_WEIGHT is used as a multiplier for the positive targets. | def weighted_binary_crossentropy(target, output):
# transform back to logits
_epsilon = tfb._to_tensor(tfb.epsilon(), output.dtype.base_dtype)
output = tf.clip_by_value(output, _epsilon, 1 - _epsilon)
output = tf.log(output / (1 - output))
# compute weighted loss
loss = tf.nn.weighted_cross_entr... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def weighted_binary_cross_entropy_from_probs(target,\n output,\n positive_class_weight=None,\n negative_class_weight=None):\n epsilon = tf.constant(_EPSILON, dtype=output.dtype.base_... | [
"0.75857127",
"0.74729574",
"0.7148111",
"0.7127835",
"0.68845624",
"0.6877862",
"0.6850784",
"0.68281883",
"0.6808433",
"0.6772938",
"0.6745443",
"0.65603656",
"0.65478635",
"0.6531398",
"0.6530266",
"0.6470587",
"0.646362",
"0.6413152",
"0.63762736",
"0.63415337",
"0.633334... | 0.78999525 | 0 |
Creating demo courses from the categories. | def generate_courses():
for category in CourseCategory.objects.all():
Course.objects.create(name=category.name, category=category, is_active=True,
is_featured=True) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_0005_create_categories(self):\n self.create_category(name='Test 0060 Workflow Features', description='Test 0060 - Workflow Features')",
"def get_categories(self):\n\n self.search([]).unlink()\n token = self.env['odoo.moodle'].search([('create_uid', '=', self.env.user.id)]).token\n ... | [
"0.68175197",
"0.6632846",
"0.66001713",
"0.64985746",
"0.64520186",
"0.6445151",
"0.6303877",
"0.6294425",
"0.6247625",
"0.6167104",
"0.61261636",
"0.6073552",
"0.6021717",
"0.60130125",
"0.6008674",
"0.59437585",
"0.5918083",
"0.58440167",
"0.5829534",
"0.57973874",
"0.5789... | 0.8113232 | 0 |
Override the parent class. | def learning_rule(self, e, x):
return self.mu * x * e | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __call__(self):\r\n raise NotImplementedError('override me')",
"def base(self):\n raise NotImplementedError()",
"def override(self):\n return None",
"def __init__(self):\n\t\tsuper().__init__()",
"def __init__(self):\n\t\tsuper().__init__()",
"def child_overriden(self):\n ... | [
"0.7492355",
"0.7469937",
"0.74409086",
"0.7253086",
"0.7253086",
"0.72210455",
"0.71716416",
"0.7037512",
"0.6972848",
"0.6972848",
"0.6963908",
"0.6923702",
"0.6923702",
"0.6923702",
"0.6923702",
"0.6923702",
"0.6923702",
"0.6923702",
"0.6923702",
"0.6923702",
"0.6923702",
... | 0.0 | -1 |
Get current player instance. | def current_player(self) -> Player:
return self.players[self.player] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_player(self):\r\n return self.player_control.get_player()",
"def get_current_player(self):\n\n # Return the current player\n return self._current_player",
"def getPlayer(self):\n return self.currentPlayer",
"def get_current_player(self) :\n return self.current_playe... | [
"0.8224015",
"0.8215686",
"0.8136338",
"0.81317985",
"0.810732",
"0.8073214",
"0.804526",
"0.7997572",
"0.7997572",
"0.7991042",
"0.7947207",
"0.7923886",
"0.78938854",
"0.7689441",
"0.75120384",
"0.74799114",
"0.72258306",
"0.7192305",
"0.71646315",
"0.71605",
"0.6736872",
... | 0.7891695 | 13 |
Get winner player score. | def winner(self) -> Player:
return max(self.players, key=lambda player: player.score) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_winner(self):\n winner: Player = Player('none')\n points_winner = 0\n for player in self.players:\n for key, value in player.get_stats().items():\n print('{}: {}'.format(key, value))\n if key == 'points':\n if value >= points_... | [
"0.7763473",
"0.765296",
"0.7523002",
"0.73949695",
"0.73330843",
"0.7299267",
"0.72851145",
"0.7277988",
"0.72584283",
"0.7248699",
"0.7224597",
"0.72148687",
"0.7194467",
"0.7185867",
"0.7185867",
"0.7159809",
"0.71303254",
"0.7104797",
"0.705714",
"0.7032001",
"0.70277095"... | 0.7419267 | 3 |
Get the winner score. | def solve(task: str) -> int:
players_number, marbles = parse_task(task)
game = Game(players_number, marbles)
while not game.finished:
game.make_turn()
return game.winner.score | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def winner(self):\n\n if self.game_ended():\n return self.winning()\n else:\n return 0",
"def find_winner_scores(self):\n p1_score, p2_score = self.find_scores()\n if p1_score > p2_score:\n winner = 1\n elif p1_score < p2_score:\n win... | [
"0.77911913",
"0.7602648",
"0.75688344",
"0.7482298",
"0.74469966",
"0.74469966",
"0.74469966",
"0.74457824",
"0.73882735",
"0.7367882",
"0.73418844",
"0.73418844",
"0.73418844",
"0.7338145",
"0.73347646",
"0.7331974",
"0.7331974",
"0.7324185",
"0.7301951",
"0.7295618",
"0.72... | 0.0 | -1 |
Transforms location of objects in tvec1 into their global location with respect to tvec2 local coordinates tvec2, rvec2 rotation won't work | def transform(tvec1, rvec1, tvec2, rvec2):
op = localToGlobal(np.squeeze(tvec2), np.squeeze(rvec2))
tvec3 = []
for tvec in tvec1:
#tvec = tvec.squeeze()
tvec3.append(np.matmul(op, tvec))
tvec3 = np.array(tvec3)
return tvec3 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_vtktransform_rotate_global_to_local(v1, v2, v3):\n\n\n x = np.array([1.0, 0.0, 0.0])\n y = np.array([0.0, 1.0, 0.0])\n z = np.array([0.0, 0.0, 1.0])\n\n rot_mat = np.zeros((3, 3), dtype=float)\n rot_mat[0, 0] = np.dot(v1, x)\n rot_mat[0, 1] = np.dot(v1, y)\n rot_mat[0, 2] = np.dot(v1, ... | [
"0.6545872",
"0.6307216",
"0.6114045",
"0.6078263",
"0.5962885",
"0.58427435",
"0.58427435",
"0.5782959",
"0.5742498",
"0.5692057",
"0.5691582",
"0.5668395",
"0.5651619",
"0.56358635",
"0.56287473",
"0.5611268",
"0.5609454",
"0.5599362",
"0.55930644",
"0.5587802",
"0.5587691"... | 0.68435067 | 0 |
tests whether user can get back his uploaded images | def test_retrieval_of_user_photos(self):
get_response = self.client.get(reverse('photos'))
self.assertEqual(get_response.status_code, status.HTTP_200_OK)
data = [i.values() for i in get_response.data]
self.assertIn(u'{}'.format(self.image_name), data[0]) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_image_allowed(self):\n return self._create_image_allowed",
"def media_image_remotely_accessible(self) -> bool:\n return True",
"def test_file_upload_page_shows(self):\n url = reverse(\"comicmodels.views.upload_handler\",\n kwargs={\"site_short_name\":self.te... | [
"0.66040313",
"0.64668643",
"0.63401854",
"0.62809235",
"0.6266904",
"0.6198586",
"0.619813",
"0.6154873",
"0.6151423",
"0.61482275",
"0.611349",
"0.6113266",
"0.6105552",
"0.6093917",
"0.6029114",
"0.60088277",
"0.59963703",
"0.5986887",
"0.59853727",
"0.5966344",
"0.5890419... | 0.6172422 | 7 |
tests whether user can get back his uploaded images | def test_deletion_of_user_photo_succeeds(self):
self.name = 'media.png'
self.image = File(open('static/img/media.png', 'rb'))
self.created_image = UserPhoto(image=self.image, name=self.name, created_by=self.user)
self.created_image.save()
response = self.client.delete('/api/modify_photo/?id={}'.format(sel... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_image_allowed(self):\n return self._create_image_allowed",
"def media_image_remotely_accessible(self) -> bool:\n return True",
"def test_file_upload_page_shows(self):\n url = reverse(\"comicmodels.views.upload_handler\",\n kwargs={\"site_short_name\":self.te... | [
"0.66040313",
"0.64668643",
"0.63401854",
"0.62809235",
"0.6266904",
"0.6198586",
"0.619813",
"0.6172422",
"0.6154873",
"0.6151423",
"0.61482275",
"0.611349",
"0.6113266",
"0.6105552",
"0.6093917",
"0.6029114",
"0.60088277",
"0.59963703",
"0.5986887",
"0.59853727",
"0.5966344... | 0.0 | -1 |
Remove Stopwords, Form Bigrams, Trigrams and Lemmatization | def process_words(texts, stop_words=stop_words, allowed_postags=['NOUN', 'ADJ', 'VERB', 'ADV']):
texts = [[word for word in simple_preprocess(str(doc)) if word not in stop_words] for doc in texts]
texts = [bigram_mod[doc] for doc in texts]
texts = [trigram_mod[bigram_mod[doc]] for doc in texts]
texts_ou... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def remove_stopwords_fun(self):\n tokens = str(self.doc).split()\n cleaned_tokens = [token for token in tokens\n if token.lower() not in self.stopword_list]\n self.doc = ' '.join(cleaned_tokens)",
"def clean_text(text):\n\n lemmizer = WordNetLemmatizer()\n stem... | [
"0.75945675",
"0.7500487",
"0.7484603",
"0.7262037",
"0.7241661",
"0.71939963",
"0.7177517",
"0.71059847",
"0.7103314",
"0.71007055",
"0.7078598",
"0.70446813",
"0.6939549",
"0.692205",
"0.69182414",
"0.69179827",
"0.690659",
"0.6906091",
"0.6903979",
"0.68768173",
"0.6846862... | 0.7237534 | 5 |
Closes the database at the end of the request. | def teardown_db(error):
db = getattr(g, '_db', None)
if db is not None:
db.close() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def after_request():\n db.close()",
"def close(self):\n\t\tself.db.close()",
"def close(self):\n self.db.close()",
"def close(self):\n self._flush()\n self.database.close()",
"def close(self):\n self.__database__.close()",
"def close(self):\n self.db.commit()\n ... | [
"0.819309",
"0.809097",
"0.7983278",
"0.79410106",
"0.79132867",
"0.7872828",
"0.78378254",
"0.7834121",
"0.7834121",
"0.7834121",
"0.77928025",
"0.7774654",
"0.77486724",
"0.7733842",
"0.7691923",
"0.76316273",
"0.75955063",
"0.7587908",
"0.75825214",
"0.75785345",
"0.752882... | 0.0 | -1 |
Accepting strings with atleast one '1' | def EM4(Type="DFA"):
R11, R12 = state('R11'), state('R12')
for i in range(1, 7):
R11.transit[str(i)] = R11
R12.transit[str(i)] = R12
R11.transit['1'] = R12
if Type == "pDFA":
R1 = pDFA('R1', list('123456'), [R11, R12], R11, [R12])
else:
R1 = DFA('R1', list('123456'), ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_one_of():\n assert is_one_of(None) is None\n assert is_one_of('1', '1') is None\n assert is_one_of(1, '1')",
"def parse_pattern(pattern):\n return map(lambda x: True if x == '1' else False, pattern)",
"def validacion(texto):\n bandera = False\n for caracter in texto:\n if caracter !... | [
"0.6131748",
"0.5920494",
"0.5894211",
"0.58237886",
"0.5793607",
"0.5738067",
"0.57010454",
"0.56658435",
"0.5661692",
"0.5606164",
"0.55732",
"0.5543592",
"0.5533626",
"0.5492173",
"0.5486258",
"0.5446358",
"0.54461974",
"0.54277354",
"0.5402032",
"0.5396561",
"0.5387228",
... | 0.0 | -1 |
Transforms an extent represented in different ways or a Shapely geometry object into an OGR geometry object. | def any_geom2ogr_geom(geom, osr_sref):
if isinstance(geom, (tuple, list)) and (not isinstance(geom[0], (tuple, list))) and \
(len(geom) == 4) and osr_sref:
geom_ogr = geometry.bbox2polygon(geom, osr_sref)
geom_ogr = swap_axis(geom_ogr) # ensure lon lat order
elif isinstance(geom, (... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def extent_to_gdal_transform(extent):\n\n # extent = SpatialExtent()\n\n pixel_height = math.copysign(extent.height, extent.bottom - extent.top)\n pixel_width = math.copysign(extent.width, extent.right - extent.left)\n\n transform = [extent.top, pixel_width, 0, extent.left, 0, pixel_height]\n retur... | [
"0.7173022",
"0.698025",
"0.5828255",
"0.5618802",
"0.55977273",
"0.5577922",
"0.55756456",
"0.5501996",
"0.5340851",
"0.5328341",
"0.53255683",
"0.5316734",
"0.5270715",
"0.52639157",
"0.52591544",
"0.5256226",
"0.5240719",
"0.51940984",
"0.51940984",
"0.51940984",
"0.518778... | 0.6358004 | 2 |
Retrieves the envelope of the given polygon geometry in correspondence with the chosen pixel size, i.e. the envelope coordinates are rounded to the upperleft corner. | def get_polygon_envelope(polygon, x_pixel_size, y_pixel_size):
# retrieve polygon points
poly_pts = list(polygon.exterior.coords)
# split tuple points into x and y coordinates and convert them to numpy arrays
xs, ys = [np.array(coords) for coords in zip(*poly_pts)]
# compute bounding box
min_x, ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def envelope(self) -> ir.PolygonValue:\n return ops.GeoEnvelope(self).to_expr()",
"def envelope(self): # -> BaseGeometry:\n ...",
"def envelope(self):\n return _property_geo(arctern.ST_Envelope, self)",
"def polygon_from_envelope(cls, min_x, min_y, max_x, max_y, crs=None):\n crs ... | [
"0.69689876",
"0.63140315",
"0.62549204",
"0.61689085",
"0.55597883",
"0.5558615",
"0.55320513",
"0.5519208",
"0.5452959",
"0.53583515",
"0.53411585",
"0.5300686",
"0.5202621",
"0.5192791",
"0.517036",
"0.5162017",
"0.51568204",
"0.5156801",
"0.51542795",
"0.5151115",
"0.5137... | 0.79012686 | 0 |
cosine function to weight correlations | def cosineFunction(self):
w = np.zeros((self.N))
l = self.l
for i in range(self.r.shape[0]):
r = np.abs(self.r[i])
if r <= l:
tf = lambda r,l : 0.5 * (np.cos(np.pi * r/l) + 1)
w[i] = tf(r,l)
else:
w[i] =... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def calculate_cosine_similarity(self):\n tfidf_matrix = self.calculate_tfidf()\n\n cosine_similarity = linear_kernel(tfidf_matrix, tfidf_matrix) # Cosine similarity matrix calculation\n\n return cosine_similarity",
"def raised_cosine_weights(self, pad, feather):\n weights=[]\n ... | [
"0.69531494",
"0.69391286",
"0.691115",
"0.6769541",
"0.6768345",
"0.65739214",
"0.6494733",
"0.64645034",
"0.6418401",
"0.6365759",
"0.6359449",
"0.6359367",
"0.6338237",
"0.6331522",
"0.6313761",
"0.6309628",
"0.6298878",
"0.62639624",
"0.62553585",
"0.6238695",
"0.62178713... | 0.7079071 | 0 |
Will convert UTC datetimes to the current local timezone | def _convertTZ(self):
tz = timezone.get_current_timezone()
dtstart = self['DTSTART']
dtend = self['DTEND']
if dtstart.zone() == "UTC":
dtstart.dt = dtstart.dt.astimezone(tz)
if dtend.zone() == "UTC":
dtend.dt = dtend.dt.astimezone(tz) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def local_to_utc(local_dt):\n local_dt = local_dt.replace(tzinfo=tz.tzlocal())\n return local_dt.astimezone(tz.tzlocal())",
"def utc_to_local(t):\n # set utc tzinfo\n t = t.replace(tzinfo=tz.tzutc())\n # convert to local timezone\n return t.astimezone(tz.tzlocal())",
"def tolocal(date... | [
"0.7294662",
"0.7098083",
"0.70430124",
"0.702775",
"0.7020645",
"0.6975295",
"0.69650185",
"0.69230616",
"0.69185",
"0.68971986",
"0.6875209",
"0.6875209",
"0.6875209",
"0.6827545",
"0.6793959",
"0.6737972",
"0.67219216",
"0.66877884",
"0.665818",
"0.6628748",
"0.65603745",
... | 0.7122917 | 1 |
Row ImpressionTotal is less than the prior record | def validate_oee_error_12(self):
sql = """
SELECT b1.* FROM bdeview b1
JOIN bdeview b2 ON b1.rowintable=b2.rowintable-1
WHERE CAST(b1.f11 AS INTEGER) > CAST(b2.f11 AS INTEGER)
"""
lines = self.c.execute(sql).fetchall()
return lines==[], lines | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def compare_non_traffic_charges_grid_row_count(self):\n previous_non_traffic_charges_grid_row_count = self.non_traffic_charges_grid_row_count\n current_non_traffic_charges_grid_row_count = self.get_non_traffic_charges_grid_row_count()\n if int(current_non_traffic_charges_grid_row_count) == int... | [
"0.5744633",
"0.54472125",
"0.53309023",
"0.52547866",
"0.5234978",
"0.5214066",
"0.5214066",
"0.52113074",
"0.5187896",
"0.51832986",
"0.51760256",
"0.5155526",
"0.5143729",
"0.51402354",
"0.5125167",
"0.5115434",
"0.51069224",
"0.50832",
"0.5080169",
"0.50758964",
"0.507117... | 0.0 | -1 |
Retrieve and return the error description using the error code. | def get_error_description(self, code):
self.c.execute("SELECT * FROM errorcode WHERE code=%d" % code)
return self.c.fetchone()[1] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def errorNumToDesc(self, errorCode):\n for t in self.ERROR_CODES:\n if t[0] == errorCode:\n try:\n return t[2]\n except IndexError:\n return \"\"",
"def get_description(self, code):\n try:\n return self.messag... | [
"0.79382956",
"0.79173803",
"0.7842184",
"0.72463346",
"0.7002093",
"0.69739324",
"0.6887579",
"0.6887579",
"0.6887579",
"0.6860639",
"0.685084",
"0.6788868",
"0.6724901",
"0.6706773",
"0.67042243",
"0.6679769",
"0.66613644",
"0.6637813",
"0.6571901",
"0.65351343",
"0.6525949... | 0.9063054 | 0 |
Resizes the instance group managed by the given instance group manager. | def resize_managed_instance_group(self, manager, zone, size):
response = self.call_api(
'/zones/%s/instanceGroupManagers/%s/resize' % (zone, manager),
method='POST',
params={
'size': size,
},
)
return response.get('error', {}).get('errors', []) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_autoscale_group_capacity(group, num_instances,\n attributes=('min_size', 'max_size', 'desired_capacity')):\n conn = boto.ec2.autoscale.connect_to_region(\"us-east-1\")\n group = conn.get_all_groups(names=[group])[0]\n for attrib in attributes:\n setattr(group... | [
"0.6083572",
"0.5699625",
"0.55169547",
"0.5487419",
"0.54408526",
"0.5426054",
"0.5414325",
"0.53545344",
"0.53387237",
"0.51946735",
"0.51015127",
"0.50978243",
"0.50795275",
"0.5071305",
"0.50526357",
"0.5036126",
"0.4973232",
"0.49667487",
"0.49545425",
"0.49544835",
"0.4... | 0.7876095 | 0 |
Returns full region URL given region name. | def get_region_url(project_id, region):
assert is_valid_project_id(project_id), project_id
assert is_valid_region(region), region
return 'https://www.googleapis.com/compute/v1/projects/%s/regions/%s' % (
project_id, region) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def extract_region(region_url):\n region = region_url[region_url.rfind('/')+1:]\n assert is_valid_region(region), region\n return region",
"def gateway_regional_url(self) -> pulumi.Output[str]:\n return pulumi.get(self, \"gateway_regional_url\")",
"def gateway_regional_url(self) -> Optional[pulumi.In... | [
"0.66588587",
"0.63819194",
"0.61009604",
"0.6062054",
"0.5938383",
"0.5849634",
"0.58271974",
"0.58090746",
"0.57373536",
"0.5723312",
"0.5714931",
"0.57062775",
"0.5676022",
"0.5658097",
"0.56405467",
"0.56266624",
"0.56266624",
"0.56266624",
"0.56266624",
"0.56266624",
"0.... | 0.7379058 | 0 |
Given a machine type returns its memory in GB. | def machine_type_to_memory(machine_type):
if machine_type in MACHINE_TYPES:
return MACHINE_TYPES[machine_type]['memory']
m = re.match(CUSTOM_MACHINE_TYPE_RE, machine_type)
assert m, machine_type
return int(m.group(2)) / 1024 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_memory(self, mem_type='usedMemory'):\n pass",
"def memory(value):\n if re.match(r\"[0-9]{1,9}Mi?\", str(value)):\n mem = re.sub(\"[^0-9]\", \"\", value)\n elif re.match(r\"[0-9]{1,9}Ki?\", str(value)):\n mem = re.sub(\"[^0-9]\", \"\", value)\n mem = int(mem) // 1024\n elif ... | [
"0.7707326",
"0.73997223",
"0.73673385",
"0.72172415",
"0.7114062",
"0.7055855",
"0.6952419",
"0.6940736",
"0.6892226",
"0.6876699",
"0.68690085",
"0.68690085",
"0.68690085",
"0.68690085",
"0.68690085",
"0.68690085",
"0.68690085",
"0.6867142",
"0.68642616",
"0.68194956",
"0.6... | 0.8641223 | 0 |
Get access to a field of the current column. | def __getitem__(self, field_name: str) -> ColumnField:
return ColumnField(self, field_name=field_name) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def field(self, field):\n return self.__getitem__(field)",
"def accessor(self):\r\n return self.column.accessor or A(self.name)",
"def field(self):\n return self._field",
"def field(self):\n return self._field",
"def field(self):\n return self._field",
"def field(self):... | [
"0.7002691",
"0.6976086",
"0.69345033",
"0.69345033",
"0.69345033",
"0.69345033",
"0.69338334",
"0.6922364",
"0.6843619",
"0.67904145",
"0.6767548",
"0.6740141",
"0.6527745",
"0.649276",
"0.64479315",
"0.6432656",
"0.6401024",
"0.63757926",
"0.6349734",
"0.6318474",
"0.631847... | 0.6141271 | 26 |
Get an existing Dashboard resource's state with the given name, id, and optional extra properties used to qualify the lookup. | def get(resource_name: str,
id: pulumi.Input[str],
opts: Optional[pulumi.ResourceOptions] = None) -> 'Dashboard':
opts = pulumi.ResourceOptions.merge(opts, pulumi.ResourceOptions(id=id))
__props__ = DashboardArgs.__new__(DashboardArgs)
__props__.__dict__["dashboard_arn"... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_state_by_id(state_id):\n for key, value in storage.all(\"State\").items():\n if state_id == value.id:\n return jsonify(value.to_dict())\n abort(404)",
"def state_by_id(state_id):\n states_values = storage.all(\"State\").values()\n for obj in states_values:\n if obj.id... | [
"0.6267908",
"0.625828",
"0.6250954",
"0.6247078",
"0.6238549",
"0.6198054",
"0.60334194",
"0.5988701",
"0.59076834",
"0.5847416",
"0.58124465",
"0.5811454",
"0.5790596",
"0.57852846",
"0.5717599",
"0.56969297",
"0.5686864",
"0.56613046",
"0.56431985",
"0.56396437",
"0.563333... | 0.63917106 | 0 |
The ARN of the dashboard. | def dashboard_arn(self) -> pulumi.Output[str]:
return pulumi.get(self, "dashboard_arn") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def arn(self) -> str:\n return pulumi.get(self, \"arn\")",
"def arn(self) -> str:\n return pulumi.get(self, \"arn\")",
"def arn(self) -> str:\n return pulumi.get(self, \"arn\")",
"def arn(self) -> str:\n return pulumi.get(self, \"arn\")",
"def arn(self) -> str:\n return p... | [
"0.71802634",
"0.71802634",
"0.71802634",
"0.71802634",
"0.71802634",
"0.7145714",
"0.7145714",
"0.7145714",
"0.7145714",
"0.7145714",
"0.7145714",
"0.7145714",
"0.7145714",
"0.7145714",
"0.7145714",
"0.7145714",
"0.7145714",
"0.7145714",
"0.7145714",
"0.7145714",
"0.7145714"... | 0.8413604 | 0 |
The ID of the dashboard. | def dashboard_id(self) -> pulumi.Output[str]:
return pulumi.get(self, "dashboard_id") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def id(self) -> str:\n return pulumi.get(self, \"id\")",
"def id(self) -> str:\n return pulumi.get(self, \"id\")",
"def id(self) -> str:\n return pulumi.get(self, \"id\")",
"def id(self) -> str:\n return pulumi.get(self, \"id\")",
"def id(self) -> str:\n return pulumi.get... | [
"0.69998974",
"0.69998974",
"0.69998974",
"0.69998974",
"0.69998974",
"0.69998974",
"0.69998974",
"0.69998974",
"0.69998974",
"0.69998974",
"0.69998974",
"0.69998974",
"0.69998974",
"0.69998974",
"0.69998974",
"0.69998974",
"0.69998974",
"0.69998974",
"0.69998974",
"0.69998974"... | 0.8629719 | 0 |
Create the InsuranceAgents. Consumers are created with randomized attributes. | def create_agents() -> List[InsuranceAgent]:
agents = []
for consumer in range(AGENTS_COUNT):
insurance_agent = InsuranceAgent(
personal_info={
AGE: FAKE.random_int(min=0, max=120),
STATE: FAKE.state(),
KIDS_COUNT: F... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _init_agents(self):\n self.agents = [Agent(e=0.1, a=0.1, row=self.row, col=self.col) for i in range(2)]",
"def new_gen(self,agents,probs,p_c,p_mut_div,p_mut_fit,tour_size,elite):\n new_agents = []\n n_layers = len(agents[0].get_weights())\n # carrying over elite agent\n new... | [
"0.6433723",
"0.6042473",
"0.60094357",
"0.5841139",
"0.5787788",
"0.575365",
"0.56472194",
"0.5584299",
"0.5574729",
"0.55726254",
"0.5565884",
"0.5557167",
"0.5545688",
"0.5496444",
"0.54505336",
"0.5441935",
"0.54372656",
"0.5427237",
"0.54012394",
"0.5400323",
"0.53815985... | 0.7481832 | 0 |
make a boxplot with n number of rows and n number of columns | def boxplots(self, groups, nrows, ncols, type):
fig, axs = plt.subplots(nrows=nrows, ncols=ncols, figsize=(6, 9.3), sharey="row")
fig.subplots_adjust(left=0.03, right=0.97, hspace=0.3, wspace=0.05)
for ax, (effs, dat) in zip(axs, groups):
ax[0].boxplot(dat["perm"])
ax[1... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def boxplot(data):\n sns.boxplot(data, width=0.5, palette=\"colorblind\")\n # add points on the plot\n sns.swarmplot(data, color='red', alpha=0.75)",
"def plot_subs(df, cols):\n plt.figure(figsize=(16,20))\n for i, col in enumerate(cols):\n plot_number = i + 1\n plt.subplot(5,3,plot_... | [
"0.6829069",
"0.66908085",
"0.6604204",
"0.6572294",
"0.6524357",
"0.6451204",
"0.64420897",
"0.6366708",
"0.63292307",
"0.6311023",
"0.6260579",
"0.62361974",
"0.6141865",
"0.6062464",
"0.60589707",
"0.60555154",
"0.6043889",
"0.60420156",
"0.602752",
"0.6002608",
"0.5988378... | 0.65681976 | 4 |
Convert hours to seconds. | def how_many_seconds(hours: int) -> int:
return hours * (60**2) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def to_seconds(hours, minutes, seconds):\n return hours*60**2 + minutes*60 + seconds",
"def to_seconds(hours, minutes, seconds):\n return hours*3600+minutes*60+seconds",
"def to_seconds(hours,minutes,seconds):\n return hours*3600+minutes*60+seconds",
"def calculate_seconds_in_hours(hours):\n retu... | [
"0.81914586",
"0.8190612",
"0.8076057",
"0.7918706",
"0.7616628",
"0.75138706",
"0.74803424",
"0.7432455",
"0.7390619",
"0.7315384",
"0.72506744",
"0.71658385",
"0.71200705",
"0.7010151",
"0.70089597",
"0.69822586",
"0.69706196",
"0.6954838",
"0.68827397",
"0.6873943",
"0.685... | 0.65607995 | 34 |
Takes in a UNIX timestamp as string, returns string in ISO format. | def stamp2iso(string):
return str(datetime.fromtimestamp(int(string)).strftime("%Y-%m-%dT%H:%M:%S")) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def timestamp_to_iso_format(timestamp):\n if timestamp is None:\n return None\n return datetime.isoformat(datetime.utcfromtimestamp(int(timestamp)))",
"def iso8601_from_timestamp(timestamp):\r\n return isotime(datetime.datetime.utcfromtimestamp(timestamp))",
"def unix_to_iso(unix_ti... | [
"0.7726223",
"0.757878",
"0.7491025",
"0.72800666",
"0.6992791",
"0.69702667",
"0.69361466",
"0.69032186",
"0.6878279",
"0.682096",
"0.66684353",
"0.6474826",
"0.64444274",
"0.64387774",
"0.6423625",
"0.6421628",
"0.6420279",
"0.64171755",
"0.6408715",
"0.6395761",
"0.6384325... | 0.78163797 | 0 |
Sets the id of this Project. Project Id | def id(self, id):
self._id = id | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_project_id(self, project_id):\n self._project_id = project_id",
"def project_id(self, project_id):\n\n self._project_id = project_id",
"def project_id(self, project_id):\n\n self._project_id = project_id",
"def set_id(self, id_):\n\n self.id_ = id_",
"def SetId(self, id)... | [
"0.807234",
"0.77649325",
"0.77649325",
"0.7147253",
"0.71137726",
"0.70958495",
"0.7083449",
"0.7050315",
"0.6871199",
"0.67623705",
"0.67035145",
"0.67035145",
"0.67035145",
"0.67035145",
"0.67035145",
"0.67035145",
"0.67035145",
"0.67035145",
"0.67035145",
"0.67035145",
"0... | 0.0 | -1 |
Sets the name of this Project. Project display name | def name(self, name):
self._name = name | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def project_name(self, project_name):\n\n self._project_name = project_name",
"def setDisplayName( self, name ):\n self._displayName = name\n self._titleFont = None",
"def set_name(self, _name):\n self.name = _name\n return self.name",
"def set_name(self, name):\n se... | [
"0.7369913",
"0.7332898",
"0.72853947",
"0.7249455",
"0.7249455",
"0.7249455",
"0.7249455",
"0.7249455",
"0.71782386",
"0.7161244",
"0.714218",
"0.70839524",
"0.705474",
"0.7048955",
"0.7029584",
"0.7029584",
"0.7016153",
"0.70049053",
"0.6978657",
"0.692735",
"0.692735",
"... | 0.0 | -1 |
Gets the git_password of this Project. (WriteOnly) Git password for HTTPS authentication. (For production only, if using user attributes.) | def git_password(self):
return self._git_password | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def git_password_user_attribute(self):\n return self._git_password_user_attribute",
"def get_password(self):\n return self.__password",
"def _get_password(self):\n return self._password",
"def _get_password(self):\r\n return self._password",
"def get_password(self) -> str:\n... | [
"0.7404549",
"0.7147939",
"0.70268697",
"0.7006018",
"0.6974064",
"0.6936066",
"0.69107974",
"0.6870072",
"0.6870072",
"0.6848251",
"0.6848251",
"0.6848251",
"0.6768797",
"0.6768797",
"0.6768797",
"0.6768797",
"0.676214",
"0.67464894",
"0.6705658",
"0.668802",
"0.6668136",
... | 0.85418856 | 0 |
Sets the git_password of this Project. (WriteOnly) Git password for HTTPS authentication. (For production only, if using user attributes.) | def git_password(self, git_password):
self._git_password = git_password | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def git_password(self):\n return self._git_password",
"def git_password_user_attribute(self, git_password_user_attribute):\n self._git_password_user_attribute = git_password_user_attribute",
"def set_password(self, password):\n self.PASSWORD = password",
"def set_password(self, password)... | [
"0.703309",
"0.6885554",
"0.6557669",
"0.6502758",
"0.64740056",
"0.6386021",
"0.6367447",
"0.6336293",
"0.62888867",
"0.62858796",
"0.6255538",
"0.6224496",
"0.61390024",
"0.6130666",
"0.61102486",
"0.61102486",
"0.60884726",
"0.60717267",
"0.60666335",
"0.6056391",
"0.60389... | 0.83311164 | 0 |
Gets the git_password_user_attribute of this Project. User attribute name for password in peruser HTTPS authentication. | def git_password_user_attribute(self):
return self._git_password_user_attribute | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def git_username_user_attribute(self):\n return self._git_username_user_attribute",
"def git_password_user_attribute(self, git_password_user_attribute):\n self._git_password_user_attribute = git_password_user_attribute",
"def git_password(self):\n return self._git_password",
"def _get_us... | [
"0.77324295",
"0.7480099",
"0.7247541",
"0.6697375",
"0.66820514",
"0.65319926",
"0.6442587",
"0.63939804",
"0.63833207",
"0.6317101",
"0.63151103",
"0.62045836",
"0.61826926",
"0.6162686",
"0.61576694",
"0.61290073",
"0.61166227",
"0.6107791",
"0.6010714",
"0.5996252",
"0.59... | 0.90181845 | 0 |
Gets the pull_request_mode of this Project. | def pull_request_mode(self):
return self._pull_request_mode | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_mode(self):\r\n return self._api.get_mode()",
"def pull_request_mode(self, pull_request_mode):\n self._pull_request_mode = pull_request_mode",
"def get_mode(self, ):\n return self.get_parameter('mode')",
"def getMode(self):\n return self._mode",
"def getmode(self):\n ... | [
"0.67335993",
"0.66815275",
"0.6602438",
"0.6600076",
"0.65179443",
"0.651152",
"0.6457186",
"0.6373462",
"0.6373462",
"0.6340891",
"0.6297265",
"0.6295132",
"0.62886995",
"0.62886995",
"0.62886995",
"0.6278998",
"0.62440133",
"0.62440133",
"0.62440133",
"0.62283653",
"0.6218... | 0.86092085 | 0 |
Gets the validation_required of this Project. | def validation_required(self):
return self._validation_required | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def required(self):\n return self._required",
"def required(self):\n return self._required",
"def is_required(self):\r\n return self._required",
"def get_validate(self):\n return self.validate",
"def required(self) -> pulumi.Output[Optional[bool]]:\n return pulumi.get(sel... | [
"0.7367271",
"0.7367271",
"0.69339406",
"0.6907997",
"0.67540187",
"0.6708149",
"0.67050636",
"0.67050636",
"0.6653458",
"0.65311843",
"0.6507184",
"0.6467593",
"0.6332529",
"0.6332213",
"0.6315311",
"0.62987393",
"0.62453574",
"0.62384987",
"0.62095094",
"0.61664146",
"0.614... | 0.85205275 | 0 |
Gets the is_example of this Project. If true the project is an example project and cannot be modified | def is_example(self):
return self._is_example | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_example(self, is_example):\n self._is_example = is_example",
"def test_example(self):\n self.assertEqual(self.example.get_example(), True)",
"def is_project(self, project):\n return self._projects_lookup.get(project, False)",
"def _IsDjangoProject(self):\r\n \r\n manage_... | [
"0.63276166",
"0.58283323",
"0.5754841",
"0.5669556",
"0.5622385",
"0.554925",
"0.55422086",
"0.54587376",
"0.51863015",
"0.5074218",
"0.5068481",
"0.5068408",
"0.50576425",
"0.5056548",
"0.5037096",
"0.5037096",
"0.5037096",
"0.5037096",
"0.5020382",
"0.50047916",
"0.499966"... | 0.751029 | 0 |
Sets the is_example of this Project. If true the project is an example project and cannot be modified | def is_example(self, is_example):
self._is_example = is_example | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_example(self):\n return self._is_example",
"def example(self, example):\n self._example = example\n return self",
"def example(self):\n self.add_file_string('Example file')\n self.should_copy = False",
"def test_example_runs(self):\n run_example(\n ... | [
"0.64542747",
"0.554918",
"0.5245427",
"0.5242498",
"0.52343607",
"0.50944483",
"0.5022302",
"0.5022302",
"0.49783614",
"0.49562868",
"0.4920387",
"0.49088216",
"0.49021658",
"0.48403174",
"0.4835761",
"0.48318925",
"0.4831779",
"0.48078668",
"0.47934303",
"0.47845957",
"0.47... | 0.73602635 | 0 |
Returns true if both objects are equal | def __eq__(self, other):
return self.__dict__ == other.__dict__ | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __eq__(self, other):\n return are_equal(self, other)",
"def __eq__(self, other):\n return are_equal(self, other)",
"def __eq__(self,other):\n try: return self.object==other.object and isinstance(self,type(other))\n except: return False",
"def __eq__(self, other):\n if i... | [
"0.8088132",
"0.8088132",
"0.8054589",
"0.7982687",
"0.7961088",
"0.7961088",
"0.79433626",
"0.79303336",
"0.7926563",
"0.7897525",
"0.78826123",
"0.78826123",
"0.78806067",
"0.7872423",
"0.7868354",
"0.78668815",
"0.7825702",
"0.7819993",
"0.78162885",
"0.78078854",
"0.78068... | 0.79670393 | 52 |
Returns true if both objects are not equal | def __ne__(self, other):
return not self == other | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __ne__(self, other: object) -> bool:\n if self.__eq__(other):\n return False\n return True",
"def __ne__(self, other: object) -> bool:\n return not self.__eq__(other)",
"def __ne__(self, other) -> bool:\n return not self.__eq__(other)",
"def __eq__(self, other):\n ... | [
"0.845611",
"0.8391477",
"0.8144138",
"0.81410587",
"0.8132492",
"0.8093973",
"0.80920255",
"0.80920255",
"0.80920255",
"0.8085325",
"0.8085325",
"0.8076365",
"0.8076365",
"0.8065748"
] | 0.0 | -1 |
Maps apple activity types to more useful enum representation | def convert_apple_activity_type(self, x):
if x == 'HKWorkoutActivityTypeCycling':
return ActivityType.BIKE
elif x == 'HKWorkoutActivityTypeElliptical':
return ActivityType.ELLIPTICAL
elif x == 'HKWorkoutActivityTypePilates':
return ActivityType.PILATES
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def activity_types(self):\r\n return activities.ActivityTypes(self)",
"def convert_strava_activity_type(self, x):\n\n if x == \"Run\":\n return ActivityType.RUN\n elif x == \"Ride\":\n return ActivityType.BIKE\n else:\n return ActivityType.OTHER",
"d... | [
"0.63510144",
"0.63379633",
"0.62767655",
"0.61910295",
"0.56613564",
"0.5564958",
"0.5537232",
"0.5462315",
"0.54444194",
"0.5421879",
"0.53833455",
"0.5365634",
"0.5316634",
"0.53156084",
"0.5293837",
"0.52238095",
"0.51955324",
"0.51522344",
"0.514137",
"0.51270413",
"0.51... | 0.70906293 | 0 |
Maps strava activity types to more useful enum representation | def convert_strava_activity_type(self, x):
if x == "Run":
return ActivityType.RUN
elif x == "Ride":
return ActivityType.BIKE
else:
return ActivityType.OTHER | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def activity_types(self):\r\n return activities.ActivityTypes(self)",
"def get_type(self):\n types = dict(ACTIVITY_TYPES)\n return types.get(self.activity_type, \"N/A\")",
"def convert_apple_activity_type(self, x):\n\n if x == 'HKWorkoutActivityTypeCycling':\n return Acti... | [
"0.63640934",
"0.6073681",
"0.6054183",
"0.60313433",
"0.58536327",
"0.5737721",
"0.5736708",
"0.55059636",
"0.5503243",
"0.54770744",
"0.5416847",
"0.54133576",
"0.5413146",
"0.5382817",
"0.536083",
"0.53168845",
"0.5293107",
"0.5250421",
"0.5234167",
"0.52334815",
"0.520857... | 0.6811602 | 0 |
If have not seen accuracy improvement in delay epochs, then divide learning rate by 10 | def get_learning_rate(opt, current, best, counter, learning_rate):
if current > best:
best = current
counter = 0
elif counter > opt['delay']:
learning_rate = learning_rate / 10.
counter = 0
else:
counter += 1
return (best, counter, learning_rate) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def learning_rate(epoch):\n self.lr = self.lr / 1.00000001\n return self.lr",
"def learning_rate(epoch):\n return alpha / (1 + decay_rate * epoch)",
"def learning_rate(epoch):\n return alpha / (1 + decay_rate * epoch)",
"def adjust_learning_rate_and_learning_taks(optimizer... | [
"0.7452846",
"0.7300165",
"0.7300165",
"0.7186334",
"0.71327996",
"0.7097631",
"0.70969033",
"0.70303357",
"0.6988377",
"0.69817466",
"0.69561815",
"0.69427496",
"0.69413584",
"0.69407535",
"0.6930489",
"0.6930489",
"0.6930489",
"0.6930489",
"0.6930441",
"0.6914621",
"0.69023... | 0.0 | -1 |
Create a sparse representention of x. | def sparse_tuple_from_label(self, sequences, dtype=np.int32):
indices = []
values = []
for n, seq in enumerate(sequences):
indices.extend(zip([n] * len(seq), range(len(seq))))
values.extend(seq)
indices = np.asarray(indices, dtype=np.int64)
value... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def to_sparse(x):\n x_typename = torch.typename(x).split('.')[-1]\n sparse_tensortype = getattr(torch.sparse, x_typename)\n\n indices = torch.nonzero(x)\n if len(indices.shape) == 0: # if all elements are zeros\n return sparse_tensortype(*x.shape)\n indices = indices.t()\n values = x[tupl... | [
"0.75686485",
"0.7074417",
"0.7010392",
"0.7005248",
"0.6776821",
"0.6769516",
"0.6685081",
"0.6682845",
"0.6600969",
"0.6585346",
"0.658275",
"0.6573287",
"0.6444108",
"0.6443818",
"0.64427996",
"0.6438962",
"0.6436992",
"0.6384505",
"0.63345295",
"0.6333298",
"0.6276179",
... | 0.0 | -1 |
Opens a new database connection if there is none yet for the current application context. | def get_db():
top = _app_ctx_stack.top
if not hasattr(top, 'MySQLdb'):
top.MySQLdb = MySQLdb.connect(app.config['DATABASE'])
top.MySQLdb.row_factory = MySQLdb.Row
return top.MySQLdb | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def db_open():\n if not hasattr(g, 'sqlite_db'):\n g.sqlite_db = db_connect()\n return g.sqlite_db",
"def open_database(self):\n if self._conn is None:\n self._conn = sqlite3.connect(self._db_path)",
"def open_db(db_name: str = DB_NAME) -> DBConnection:\n return sqlite3.connec... | [
"0.7737639",
"0.7582971",
"0.73180443",
"0.71693045",
"0.70220166",
"0.6966687",
"0.6954785",
"0.69486743",
"0.6897534",
"0.6842663",
"0.68292314",
"0.68191963",
"0.680592",
"0.67950195",
"0.67697805",
"0.6762173",
"0.6751266",
"0.6746273",
"0.67316663",
"0.670031",
"0.668866... | 0.0 | -1 |
Gets the full name of a user. | def full_name(self):
return "{} {}".format(self.user.first_name, self.user.last_name) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_user_fullname(self):\n member = self.get_user()\n if member:\n return member.getProperty('fullname')",
"def get_user_name(user: User) -> str:\n user_name = user.get(\"display_name\")\n if not user_name:\n user_name = user[\"fullname\"]\n if not... | [
"0.8464699",
"0.8363981",
"0.83563656",
"0.8282504",
"0.82800573",
"0.82800573",
"0.8220341",
"0.8217558",
"0.81706756",
"0.81619555",
"0.8114012",
"0.80660164",
"0.8032426",
"0.7988945",
"0.79643655",
"0.79212445",
"0.7910585",
"0.7870865",
"0.78444386",
"0.78181726",
"0.770... | 0.8053516 | 12 |
Gets the short 'full name' of a user. | def full_name_short(self):
return "{}. {}".format(str(self.user.first_name)[:1], self.user.last_name) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def full_name(self):\n return self.user.get_full_name() or None",
"def full_name(self):\n return \"{} {}\".format(self.user.first_name, self.user.last_name)",
"def get_short_name(self):\n return f\"{self.first_name} {self.last_name[:1]}\" if self.first_name else self.username",
"def get_... | [
"0.85821515",
"0.8439068",
"0.84338224",
"0.8418844",
"0.84131587",
"0.8328332",
"0.8298906",
"0.8298906",
"0.82981914",
"0.8282359",
"0.8281708",
"0.8270525",
"0.8260916",
"0.8244987",
"0.8185487",
"0.80868787",
"0.8065289",
"0.8065289",
"0.8065289",
"0.8002414",
"0.79765606... | 0.86199564 | 0 |
Returns ``value`` as a list if it is iterable and not a string, otherwise returns ``value`` in a list. >>> to_list(('foo', 'bar', 'baz')) ['foo', 'bar', 'baz'] >>> to_list('foo bar baz') ['foo bar baz'] | def to_list(value):
if hasattr(value, '__iter__') and not isinstance(value, str):
return list(value)
return [value] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _as_list(value):\n if not isinstance(value, list):\n value = [value]\n return value",
"def to_list(x):\n import collections\n if not isinstance(x, collections.Iterable) or isinstance(x, str):\n x = [x]\n return x",
"def cast_to_list(value):\n if isinstance(value, str):\n... | [
"0.7909326",
"0.77883756",
"0.7760179",
"0.7517761",
"0.7428105",
"0.73871875",
"0.73179436",
"0.7189031",
"0.70278513",
"0.69362384",
"0.6892507",
"0.6876588",
"0.68203604",
"0.6806332",
"0.67880166",
"0.676233",
"0.6737084",
"0.66951936",
"0.6666556",
"0.6639952",
"0.659471... | 0.86028683 | 0 |
Get the list of items for this view. This must be an iterable, and may be a queryset. Defaults to using `self.queryset`. This method should always be used rather than accessing `self.queryset` directly, as `self.queryset` gets evaluated only once, and those results are cached for all subsequent requests. You may want t... | def get_queryset(self): # NOQA
rates = Rate.objects.filter(
inventory__date__gte=self.kwargs.get('checkin'),
inventory__date__lte=self.kwargs.get('checkout'),
room__hotel__public_id=self.kwargs.get('hotel_id')
).values('room__public_id', 'price', "inventory__date")
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_queryset(self):\n assert self.queryset is not None, (\n \"'%s' should either include a `queryset` attribute, \"\n \"or override the `get_queryset()` method.\"\n % self.__class__.__name__\n )\n\n queryset = self.queryset\n if isinstanc... | [
"0.8071662",
"0.7865255",
"0.7822873",
"0.78129333",
"0.7699033",
"0.7625184",
"0.75067425",
"0.7475383",
"0.74253654",
"0.7398072",
"0.7321872",
"0.73211014",
"0.7285068",
"0.7273511",
"0.7097506",
"0.7067583",
"0.7060699",
"0.7060699",
"0.7060699",
"0.70508146",
"0.7025902"... | 0.0 | -1 |
Return a new registration filing prepped for email notification. | def prep_registration_filing(session, identifier, payment_id, option, legal_type, legal_name):
now = datetime.now().strftime('%Y-%m-%d')
REGISTRATION['business']['naics'] = {
'naicsCode': '112320',
'naicsDescription': 'Broiler and other meat-type chicken production'
}
gp_registration = ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def prep_change_of_registration_filing(session, identifier, payment_id, legal_type, legal_name, submitter_role):\n business = create_business(identifier, legal_type, legal_name)\n\n gp_change_of_registration = copy.deepcopy(FILING_HEADER)\n gp_change_of_registration['filing']['header']['name'] = 'changeOf... | [
"0.5889144",
"0.576094",
"0.55901647",
"0.55842596",
"0.5438901",
"0.54136795",
"0.53838825",
"0.5372592",
"0.5319895",
"0.5311353",
"0.530995",
"0.52422285",
"0.522632",
"0.52215123",
"0.5206563",
"0.5198034",
"0.51564014",
"0.5154504",
"0.514826",
"0.51335615",
"0.511519",
... | 0.60579985 | 0 |
Convert dict to an object. | def dict_to_obj(dict1):
return json.loads(json.dumps(dict1), object_hook=Obj) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def from_dict(cls, obj):\r\n raise NotImplementedError",
"def dict2obj(dictionary):\r\n class Obj(object):\r\n def __init__(self, dictionary):\r\n self.__dict__.update(dictionary)\r\n return Obj(dictionary)",
"def from_dict(cls, dict_object):\n\n return cls(**dict_object)"... | [
"0.7888742",
"0.78816795",
"0.76814437",
"0.7598891",
"0.7534678",
"0.7534678",
"0.7534678",
"0.7534678",
"0.7534678",
"0.7534678",
"0.7534678",
"0.7534678",
"0.7534678",
"0.7534678",
"0.7534678",
"0.7534678",
"0.7534678",
"0.7534678",
"0.7534678",
"0.7534678",
"0.7534678",
... | 0.72662723 | 52 |
Returns the nth element returned by the iterator if there are sufficient elements, or None if the iterator has been exhausted. | def iterate(iterator, n):
# throw away n-1 elements
for index in range(1, n):
next(iterator, None)
return next(iterator, None) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def nth(iterable, n, default=None):\n return next(islice(iterable, n, None), default)",
"def nth(iterable, n, default=None):\n return next(islice(iterable, n, None), default)",
"def nth(iterable, n, default=None):\n return next(islice(iterable, n, None), default)",
"def nth(n, iterable, default = No... | [
"0.7573045",
"0.7573045",
"0.7573045",
"0.75169265",
"0.73836523",
"0.73216105",
"0.7248314",
"0.70536184",
"0.69782066",
"0.6756924",
"0.6655178",
"0.65509784",
"0.63907355",
"0.6190965",
"0.61444306",
"0.6128671",
"0.6092438",
"0.59879977",
"0.59622693",
"0.59555614",
"0.59... | 0.6229456 | 13 |
Create a test application. | def create_app(settings_override=None):
app = Flask(__name__, static_folder='static')
params = {
'DEBUG': True,
'WEBPACK_MANIFEST_PATH': '../build/manifest.json'
}
app.config.update(params)
if settings_override:
app.config.update(settings_override)
webpack.init_app(ap... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def application():\n yield create_test_application()",
"def test_create_app():\n assert not create_app().testing\n assert create_app({'TESTING': True}).testing",
"def test_create_app():\n app = web.YumWeb(__name__)\n assert app.name == 'web_tests'",
"def testapp():\n from space_rocks import... | [
"0.79070836",
"0.78836656",
"0.7735507",
"0.76688933",
"0.766446",
"0.76335806",
"0.755305",
"0.75526494",
"0.7552582",
"0.7525917",
"0.751747",
"0.7487782",
"0.74718004",
"0.73462504",
"0.73332715",
"0.7299303",
"0.7291964",
"0.7280654",
"0.7275533",
"0.72719496",
"0.7262054... | 0.0 | -1 |
Route to serve the entryfile Serves the same template to all subpaths so React Router can take over | def index(path):
return render_template('index.jinja2') | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def entry_point():\n return render_template(\"index.html\")",
"def main(methods=[\"GET\"]):\n validate_auth()\n ## issue with path resolution after build\n return send_from_directory(\n #todo: remove templates directory reference; index.html isn't a jinja template\n safe_join(current_ap... | [
"0.6806032",
"0.66670346",
"0.6544026",
"0.64286405",
"0.6380084",
"0.6363859",
"0.6315472",
"0.6315472",
"0.6180891",
"0.60903466",
"0.6087544",
"0.6086663",
"0.6086663",
"0.6073123",
"0.6066216",
"0.60434014",
"0.59887606",
"0.59887606",
"0.5965337",
"0.59289443",
"0.592660... | 0.59373546 | 19 |
Yield successive nsized chunks from l. | def chunks(l, n):
for i in range(0, len(l), n):
yield l[i : i + n] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _chunk(self, l, n):\n for i in range(0, len(l) + 1, n):\n yield l[i:i + n]",
"def chunks(self, l, n):\n for i in range(0, len(l), n):\n yield l[i:i + n]",
"def __chunks(l, n):\n for i in range(0, len(l), n):\n yield l[i:i + n]",
"def get_chunks(self, ... | [
"0.8038813",
"0.79248375",
"0.7923423",
"0.7885103",
"0.78773195",
"0.7815877",
"0.77655786",
"0.77556044",
"0.77441615",
"0.7731815",
"0.77288336",
"0.772473",
"0.77028215",
"0.76889825",
"0.76889825",
"0.7664208",
"0.76570904",
"0.7655856",
"0.7655856",
"0.76458347",
"0.764... | 0.7453012 | 36 |
Predict probabilities with a fitted model. | def predict_proba(graph, ops, run, X):
sess = tf.Session(graph=graph)
# get graph's ops
data_init_op, predictions_op, log_loss_op, optimize_op,\
grad_summaries_op, init_op, saver_op, accuracy_op, summaries_op = ops
# only predictions_op and saver_op are used here
saver_op.restore(sess, 'sa... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def fit_predict(self):\n self.classifier = self.model\n self.classifier.fit(self.X_sample, self.y_sample)\n self.y_pred = self.classifier.predict(self.X_test)",
"def get_predictions(fitted_model_filename):\n click.echo(\"Mode: predicting probabilities.\\n\")\n defaults = get_defaults()... | [
"0.75845104",
"0.73576736",
"0.71478885",
"0.7147755",
"0.7000886",
"0.6966667",
"0.69185454",
"0.6904843",
"0.68839145",
"0.6882531",
"0.68195266",
"0.6817711",
"0.6793535",
"0.67682976",
"0.67582387",
"0.6751765",
"0.6742392",
"0.673403",
"0.67235315",
"0.672017",
"0.671422... | 0.0 | -1 |
Computes the average score for duelling with a random sample. | def compute_ave_score_w_sample(genes, samples):
scores = np.zeros(len(genes), dtype=np.uint32)
for i, v in enumerate(genes):
for j in samples:
score, _ = run_duel(v, j)
scores[i] += score
continue
continue
return scores / len(samples) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def mean(self):\r\n\t\treturn sum(self.sample)/len(self.sample)",
"def get_mean_score(rating_scores):\n return sum(rating_scores) / len(rating_scores)",
"def calculate_avg_score(state_score,state_count):\n\tfor state in state_score.keys():\n\t\tstate_score[state] = 1.*state_score[state]/state_count[state]\n\t... | [
"0.64974946",
"0.63153213",
"0.618844",
"0.59660834",
"0.5958541",
"0.5937431",
"0.59008414",
"0.5892758",
"0.58796334",
"0.58430827",
"0.5838736",
"0.5833118",
"0.58291125",
"0.58165836",
"0.5813917",
"0.58021754",
"0.5792264",
"0.57604575",
"0.572036",
"0.572036",
"0.570297... | 0.5813661 | 15 |
Compute maximum normalization (max is set to 1) of the array | def max_normalization(array):
return 1/np.max(array) * array.squeeze(axis=1) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def normalize(array):\n\treturn array/np.max(array)",
"def max_norm() -> float:\n return 1.0",
"def normalize(my_array: np.ndarray) -> np.ndarray:\n\n return np.abs(my_array)/np.max(np.abs(my_array))",
"def norm_img(img):\n img_arr = np.array(img).astype(float)\n max_val = np.amax(img_arr)\... | [
"0.8210269",
"0.76022196",
"0.731013",
"0.7267686",
"0.71900845",
"0.70916706",
"0.70316976",
"0.70151633",
"0.6999619",
"0.69754666",
"0.6971905",
"0.69660205",
"0.69660205",
"0.6954154",
"0.6932388",
"0.6904509",
"0.6887936",
"0.6856784",
"0.685396",
"0.6847474",
"0.6844390... | 0.8800629 | 0 |
The name of the flow. The name must be unique in an Alibaba Cloud account. | def name(self) -> Optional[pulumi.Input[str]]:
return pulumi.get(self, "name") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def flow_name(self):\n # This never changes (so no read locking needed).\n return self._flowdetail.name",
"def flow_log_name(self) -> Optional[pulumi.Input[str]]:\n return pulumi.get(self, \"flow_log_name\")",
"async def create_flow_from_name(self, flow_name: str) -> UUID:\n flow_da... | [
"0.8098783",
"0.7136659",
"0.66794235",
"0.66140664",
"0.64991754",
"0.6349262",
"0.62818086",
"0.6214944",
"0.6180866",
"0.61771804",
"0.6127999",
"0.61064154",
"0.6074759",
"0.60500276",
"0.60490096",
"0.59292465",
"0.59023386",
"0.5896493",
"0.589332",
"0.5892556",
"0.5881... | 0.0 | -1 |
The ARN of the specified RAM role that Serverless Workflow uses to assume the role when Serverless Workflow executes a flow. | def role_arn(self) -> Optional[pulumi.Input[str]]:
return pulumi.get(self, "role_arn") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def role_arn(self) -> pulumi.Output[Optional[str]]:\n return pulumi.get(self, \"role_arn\")",
"def role_arn(self) -> pulumi.Input[str]:\n return pulumi.get(self, \"role_arn\")",
"def role_arn(self) -> str:\n return pulumi.get(self, \"role_arn\")",
"def execution_role_arn(self) -> pulumi.... | [
"0.65406454",
"0.6539279",
"0.6355523",
"0.6337345",
"0.6337345",
"0.6335514",
"0.63135535",
"0.63135535",
"0.6294983",
"0.62796015",
"0.6198365",
"0.61906046",
"0.61906046",
"0.6137005",
"0.60120153",
"0.5938221",
"0.5938221",
"0.5938221",
"0.5743445",
"0.56732714",
"0.55941... | 0.65063906 | 4 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.