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 |
|---|---|---|---|---|---|---|
The home page. This displays the singlepage app. | def index(request, path=''):
return render(request, 'index.html') | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def home():\n\n\treturn render_template('index.html', title='Home Page',\n\t\t\t\t\t\t year=datetime.now().year)",
"def home():\r\n return render_template(\r\n 'index.html',\r\n title='Home Page',\r\n year=datetime.now().year,\r\n )",
"def home():\n\n return render_template('hom... | [
"0.81450343",
"0.80490905",
"0.8034304",
"0.8031531",
"0.7991134",
"0.7956037",
"0.7956037",
"0.7956037",
"0.7956037",
"0.7956037",
"0.7956037",
"0.7956037",
"0.7956037",
"0.7956037",
"0.7956037",
"0.7934431",
"0.7931615",
"0.7919883",
"0.7896321",
"0.7865689",
"0.78573596",
... | 0.0 | -1 |
Width of vessel in meters. | def width(self) -> float:
return self._width | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getWidth(self):\n area = self.getArea()\n length = self.getLength()\n return area / length",
"def width(self):\n return _libsbml.Dimensions_width(self)",
"def width(self):\n self._updateExtents()\n return self._mWidth",
"def width(self):\n # type: () -> fl... | [
"0.7299548",
"0.70635",
"0.69861746",
"0.69734865",
"0.6972006",
"0.69204634",
"0.6885758",
"0.6883103",
"0.68774253",
"0.6876215",
"0.6866559",
"0.68358254",
"0.68353707",
"0.68158084",
"0.6810069",
"0.6780191",
"0.67649233",
"0.67600685",
"0.675475",
"0.67534876",
"0.675348... | 0.70413023 | 2 |
Returns the actions taken (surge, rudder) over the current episode. The actions are probably normalized. | def actions_taken(self) -> np.ndarray:
return self._prev_inputs | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _get_an_eps_action(self, sess, eps, tjs, model, cnt_action):\n reports = []\n if np.random.random() < eps:\n action_idx, player_t = get_random_1Daction(self.actions)\n reports += [('random_action', action_idx),\n ('action', player_t)]\n else:\n ... | [
"0.6364059",
"0.6249148",
"0.61824155",
"0.61693347",
"0.61609685",
"0.61609685",
"0.6037237",
"0.60246557",
"0.6019658",
"0.60086256",
"0.600165",
"0.59581584",
"0.591739",
"0.5917285",
"0.5900955",
"0.58999646",
"0.5874077",
"0.576354",
"0.576354",
"0.576354",
"0.5751001",
... | 0.0 | -1 |
Array containg the angles each sensor ray relative to the vessel heading. | def sensor_angles(self) -> np.ndarray:
return self._sensor_angles | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def angles(self):\n self._sort_measurements()\n return self._angles",
"def to_angles(self) -> np.ndarray:\n phi = np.arctan2(self.A[1, 2], self.A[2, 2]) # Roll Angle\n theta = -np.sin(self.A[0, 2]) # Pitch Angle\n psi = np.arctan2(self.A[0, 1], self.A[0, 0]... | [
"0.7016958",
"0.6909558",
"0.6893508",
"0.6864394",
"0.6793748",
"0.67041063",
"0.6692219",
"0.6638509",
"0.66264886",
"0.65301067",
"0.64589685",
"0.6456956",
"0.6438218",
"0.6359479",
"0.6352709",
"0.62833625",
"0.6273829",
"0.62136245",
"0.6208153",
"0.6202665",
"0.6166515... | 0.71208733 | 0 |
Returns the maximum progress along the path in the current episode. Can take values between 0 and 1. | def max_progress(self) -> float:
return self._max_progress | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_max_episode_len(path):\n path = path.replace('data/', '')\n path = path.replace('goals/', '')\n task = tasks.names[path]()\n max_steps = task.max_steps - 1 # Remember, subtract one!\n return max_steps",
"def max_steps(self) -> int:\n return pulumi.get(self, \"max_steps\")",
"def ... | [
"0.73297197",
"0.64544684",
"0.6354707",
"0.63543916",
"0.624282",
"0.6206802",
"0.61976147",
"0.61849344",
"0.6169866",
"0.60593766",
"0.60562116",
"0.60456085",
"0.59878737",
"0.5984284",
"0.5981434",
"0.59502697",
"0.59446305",
"0.5942261",
"0.59215844",
"0.59015244",
"0.5... | 0.71555537 | 1 |
Generate a new random string based on time and secret set in the options. | def _generate_token(self):
return sha1("%s#%s" % (time(),
self.app.cfg['sessions/secret'])).hexdigest() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _generateSecretKey():\n return f\"secret.{str(datetime.now())}\"",
"def random_ticket():\n ts = time.time()\n return \"%s_%s\" % (ts, random_str(6, string.digits))",
"def datetime_random_str():\n s = datetime.datetime.now().strftime(\"%Y%m%d%H%M%S\")\n return s + \"-{:04d}\".format(rando... | [
"0.7288348",
"0.6942245",
"0.69355977",
"0.69098353",
"0.6879747",
"0.68468726",
"0.68439794",
"0.6820532",
"0.67946756",
"0.6768783",
"0.6663619",
"0.66245025",
"0.66134125",
"0.6525383",
"0.6522482",
"0.64752525",
"0.64635783",
"0.64498323",
"0.6445284",
"0.6442957",
"0.644... | 0.6043357 | 68 |
Plot the original image, heatmap of predicted class probabilities, and target mask. | def plot_prediction(img: torch.Tensor, pred_mask: torch.Tensor, target: torch.Tensor, mean, std, writer: SummaryWriter = None, apply_softmax=True):
batch_size = min(12, img.shape[0]) # never plot more than 2 images
ncol = batch_size // 4
img = make_grid(img, 4)
# put on CPU, denormalize
# GREEN MOD... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def plot(self):\n plt.imshow(self.cm, interpolation='nearest', cmap=self.cmap)\n plt.title(self.title)\n plt.colorbar()\n tick_marks = np.arange(len(self.classes))\n plt.xticks(tick_marks, self.classes, rotation=45)\n plt.yticks(tick_marks, self.classes)\n \n ... | [
"0.6891294",
"0.68093246",
"0.6715932",
"0.6593411",
"0.65670604",
"0.656108",
"0.6546862",
"0.65015",
"0.6477857",
"0.6468046",
"0.6451067",
"0.64251685",
"0.6397279",
"0.63954693",
"0.6388033",
"0.6332793",
"0.6326738",
"0.6322636",
"0.6311436",
"0.62949145",
"0.6287086",
... | 0.6687267 | 3 |
Calculate the great circle distance between two points on the earth (specified in decimal degrees) | def distance(lat0, lng0, lat1, lng1):
# convert decimal degrees to radians
lat0, lng0, lat1, lng1 = map(radians, [lat0, lng0, lat1, lng1])
# haversine formula
dlng = lng1 - lng0
dlat = lat1 - lat0
a = sin(dlat/2)**2 + cos(lat0) * cos(lat1) * sin(dlng/2)**2
c = 2 * asin(sqrt(a))
m = ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def great_circle(lat_1, long_1, lat_2, long_2):\n long_1 = m.radians(long_1)\n lat_1 = m.radians(lat_1)\n long_2 = m.radians(long_2)\n lat_2 = m.radians(lat_2)\n\n d = 2 * 6367.45 * m.asin(\n m.sqrt(haversine(lat_2 - lat_1)\n + m.cos(lat_1)*m.cos(lat_2) *\n haversine(long... | [
"0.8145642",
"0.7864861",
"0.7633779",
"0.7606547",
"0.75978154",
"0.75965756",
"0.7594718",
"0.75721717",
"0.7563575",
"0.75563323",
"0.75293887",
"0.7517552",
"0.7494435",
"0.74680996",
"0.74525726",
"0.7434768",
"0.7392089",
"0.73589164",
"0.7348987",
"0.73317003",
"0.7329... | 0.6952209 | 61 |
Get pytz timezone object given latitude and longitude. | def get_timezone(latitude, longitude):
tf = TimezoneFinder()
return pytz.timezone(tf.timezone_at(lng=longitude, lat=latitude)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_tz(lon, lat):\n \n lon = lon % 360.;\n lon = (lon - 360) if lon > 180 else lon\n if lon > 180 or lon < -180:\n raise NotImplemented('Longitudes must be between -180 and 180')\n wkt = \"POINT(%f %f)\" % (lon,lat)\n # Old osgeo.ogr approach\n #oldpoint = ogr.CreateGeometryFromWkt(... | [
"0.67936176",
"0.6750431",
"0.6226324",
"0.6128914",
"0.6119667",
"0.6103295",
"0.60568494",
"0.6012178",
"0.57484335",
"0.569708",
"0.569469",
"0.5684975",
"0.5674865",
"0.5660943",
"0.56254375",
"0.55746734",
"0.55738276",
"0.5571883",
"0.55466306",
"0.5495939",
"0.54793996... | 0.76507705 | 0 |
Returns either the awardee or the member's full name | def awardee_name(self):
if self.member is None:
return self.awardee
return self.member.full_name() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_display_name(member):\n if member.nick is None:\n name = member.name\n else:\n name = member.nick\n if User.objects.get(id=member.id).is_ironman:\n name += ' (IM)'\n return name",
"def get_full_name(self):\n full_name = '%s %s' % (self.first_name, self.last_name)\n ... | [
"0.73488957",
"0.7261464",
"0.7178808",
"0.7146033",
"0.7134935",
"0.7115238",
"0.71145135",
"0.70939153",
"0.70884776",
"0.7074432",
"0.7056197",
"0.7048027",
"0.7044949",
"0.7043551",
"0.7043551",
"0.7030402",
"0.7010918",
"0.6984012",
"0.69702154",
"0.6970123",
"0.6967131"... | 0.83768004 | 0 |
Sampling hidden state from visible state and reconstruct visible state from hidden state. | def gibbs_step(self, visible):
hidden_prob = self.probabilities_hidden(visible)
hidden_state = self.sample(hidden_prob)
visible_prob = self.probabilities_visible(hidden_state)
visible_state = visible_prob
return hidden_prob, hidden_state, visible_prob, visible_state | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def init_hidden(self, batch_size):\r\n \r\n self.hidden_state = (\r\n torch.zeros(((1+self.bidirectional)*self.num_layers,\r\n batch_size,\r\n self.hidden_size)).to(self.device),\r\n torch.zeros(((1+self.bidirectional)*self.num_lay... | [
"0.6534501",
"0.63554436",
"0.6333946",
"0.62743825",
"0.6163395",
"0.61502",
"0.6058766",
"0.60505605",
"0.60097826",
"0.59704745",
"0.5966308",
"0.5965213",
"0.5963686",
"0.59475076",
"0.5926652",
"0.5921115",
"0.5921115",
"0.5921115",
"0.5920937",
"0.5791542",
"0.5766759",... | 0.6569311 | 0 |
Computing the energy of the model. | def energy(self, visible):
bias_term = tf.matmul(visible, self._bias_visible)
linear_transform = tf.matmul(visible, self._weights) + tf.squeeze(self._bias_hidden)
hidden_term = tf.reduce_sum(tf.math.log(1 + tf.exp(linear_transform)), axis=1)
return tf.reduce_mean(-hidden_term - bias_term) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def energy(self):\n self.E = - np.sum(self.phi) + 0.5 * self.mass * np.sqrt((self.v_x ** 2 + self.v_y **2))",
"def energy_func(self):\n i = self.inl[0].to_flow()\n o = self.outl[0].to_flow()\n\n T_m = (T_mix_ph(i, T0=self.inl[0].T.val_SI) +\n T_mix_ph(o, T0=self.outl[0].... | [
"0.8121822",
"0.7995192",
"0.78771305",
"0.7833237",
"0.7763487",
"0.773528",
"0.77243483",
"0.75646216",
"0.75559765",
"0.75398797",
"0.7448315",
"0.74248207",
"0.7383639",
"0.73809487",
"0.7365883",
"0.7300219",
"0.72813165",
"0.7279714",
"0.72761434",
"0.7264688",
"0.72592... | 0.6501839 | 78 |
Given an end_time and a timezone for it... build and return the corresponding aware end_datetime. Update DateTimeTracker correspondingly afterwards | def build_end_dt(self, time_string: str, destination_timezone, end_date: datetime.date=None):
if self.dt.tzinfo.zone != destination_timezone.zone:
begin_as_destination_time_zone = self.dt.astimezone(destination_timezone)
else:
begin_as_destination_time_zone = self.dt
end_... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def calculate_end_date(time_offset: int, start_datetime_obj: dt.datetime = dt.datetime.now()) -> dt.datetime:\n return start_datetime_obj + dt.timedelta(days=time_offset)",
"def __init__(self, *args, **kwargs):\n super().__init__(*args, **kwargs)\n\n # Take the local timezone into account when c... | [
"0.58296525",
"0.575914",
"0.5488467",
"0.5438639",
"0.5426441",
"0.54148734",
"0.5386522",
"0.5376798",
"0.53601134",
"0.526317",
"0.5239543",
"0.52394307",
"0.5189775",
"0.5182552",
"0.51586515",
"0.51511514",
"0.5143428",
"0.5122173",
"0.5104445",
"0.5070197",
"0.5061339",... | 0.72165704 | 0 |
Checks if a given user has READ permission on a given namespace | def _has_read_permission_user_namespace(user, namespace):
response = _fetch_herd_session() \
.get('{}://{}/{}/{}'.format(HERD_REST_PROTOCOL, HERD_BASE_URL,
HERD_REST_BASE_PATH,
'/userNamespaceAuthorizations/userIds/{}/namespaces/{}').fo... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def has_read_permission(request):\n return request.user.is_authenticated",
"def can_read(self, user):\n raise Return(True)",
"def _check_namespace_access(self, namespace, user):\n if not namespace.owners.filter(id=user.id).count():\n raise exceptions.PermissionDenied(\n ... | [
"0.71995556",
"0.71734613",
"0.70004433",
"0.6604134",
"0.6524117",
"0.64604485",
"0.6407858",
"0.6336592",
"0.6281944",
"0.6269588",
"0.62346065",
"0.6209889",
"0.6206937",
"0.6170513",
"0.6152513",
"0.6152187",
"0.6151709",
"0.612149",
"0.609237",
"0.6048587",
"0.5998443",
... | 0.8490019 | 0 |
Checks if a given user has SELECT privilege on a given table | def _user_has_select_privilege_on_table(cursor, user, schema, table):
# ignore wildcard user
if user == PUBLIC_READ_USER:
return
schema = schema.lower()
cursor.execute('set role admin')
grants = _run_hive_query(cursor,
'SHOW GRANT USER {} on TABLE {}.{}'.format... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _role_has_select_privilege_on_table(cursor, role, schema, table):\n\n schema = schema.lower()\n\n cursor.execute('set role admin')\n cursor.execute('USE {}'.format(schema))\n grants = _run_hive_query(cursor,\n 'SHOW GRANT ROLE {} on TABLE {}'.format(role,\n ... | [
"0.76571894",
"0.6994353",
"0.63678724",
"0.6311401",
"0.618453",
"0.6076857",
"0.5957128",
"0.57485396",
"0.5740589",
"0.5719474",
"0.57084644",
"0.55783325",
"0.552981",
"0.5529078",
"0.5513197",
"0.5499006",
"0.547723",
"0.54581815",
"0.53977525",
"0.53947526",
"0.53802323... | 0.843867 | 0 |
Method to generate the laby. Transforms the .txt file into a list of lines, then each line into a list of characters. For each character it will generate a square, or set Macgyver/exit's position. | def generate_laby(player, exit):
with open('macgyverlaby.txt') as laby:
str_laby = ''.join(str(line) for line in laby)
list_str = list(str_laby)
laby = []
x = 0
y = 0
for entry in list_str:
# Sets square as a wall if the character is 'm'
if en... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def generate(self):\n\n with open(self.file, \"r\") as file:\n structure = []\n for line in file:\n sub_line = []\n for sprite in line:\n if sprite != '\\n':\n sub_line.append(sprite)\n structure.app... | [
"0.6384481",
"0.59391844",
"0.5797327",
"0.5713891",
"0.57133985",
"0.5695597",
"0.5524117",
"0.55224484",
"0.55146295",
"0.5501566",
"0.5481186",
"0.5476874",
"0.5472788",
"0.5365956",
"0.5329122",
"0.53207356",
"0.53117996",
"0.52957255",
"0.5284792",
"0.52808475",
"0.52597... | 0.74996257 | 0 |
Tests search for item found and unavailable. | def test_run_search__found_and_unavailable(self):
basics = {
'API_URL_ROOT': self.api_url_root,
'API_KEY': self.api_key,
'PARTNERSHIP_ID': self.partnership_id,
'UNIVERSITY_CODE': self.university_code,
'LOG_PATH': self.LOG_PATH }
bd = BorrowDire... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_search_found_unavailable(self):\n s = Searcher( self.logger )\n ( search_key, search_value ) = ( 'ISBN', self.isbn_found_and_unavailable )\n result_dct = s.search(\n self.patron_barcode, search_key, search_value, self.api_url_root, self.api_key, self.partnership_id, self.un... | [
"0.8018395",
"0.71890247",
"0.71764255",
"0.7030243",
"0.6977662",
"0.6969089",
"0.6904887",
"0.681629",
"0.6808563",
"0.6796961",
"0.67030275",
"0.6643682",
"0.6639831",
"0.66368157",
"0.6515197",
"0.6499329",
"0.6494485",
"0.6430935",
"0.6358132",
"0.6297274",
"0.62961257",... | 0.73733974 | 1 |
Tests search for item not found. | def test_run_search__not_found(self):
basics = {
'API_URL_ROOT': self.api_url_root,
'API_KEY': self.api_key,
'PARTNERSHIP_ID': self.partnership_id,
'UNIVERSITY_CODE': self.university_code,
'LOG_PATH': self.LOG_PATH }
bd = BorrowDirect( basics )... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_search_not_found(self):\n s = Searcher( self.logger )\n ( search_key, search_value ) = ( 'ISBN', self.isbn_not_found )\n result_dct = s.search(\n self.patron_barcode, search_key, search_value, self.api_url_root, self.api_key, self.partnership_id, self.university_code )\n ... | [
"0.7829702",
"0.749001",
"0.74181086",
"0.7389959",
"0.72843266",
"0.71713054",
"0.7092081",
"0.7072373",
"0.7055071",
"0.6880571",
"0.68507904",
"0.6829939",
"0.68077207",
"0.6632664",
"0.6615246",
"0.65996975",
"0.65903574",
"0.6561538",
"0.65032244",
"0.64801717",
"0.64401... | 0.73144275 | 4 |
Tests manager requesting on notfound item. Note that this will really attempt the request. | def test_run_request_item__not_found(self):
basics = {
'API_URL_ROOT': self.api_url_root,
'API_KEY': self.api_key,
'PARTNERSHIP_ID': self.partnership_id,
'UNIVERSITY_CODE': self.university_code,
'PICKUP_LOCATION': self.pickup_location,
'LOG... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_get_item_not_found(self):\n resp = self.app.get('/items/0')\n self.assertEqual(resp.status_code, status.HTTP_404_NOT_FOUND)",
"def test_request_item_not_found(self):\n r = Requester( self.logger )\n ( search_key, search_value ) = ( 'ISBN', self.isbn_not_found )\n resul... | [
"0.7736214",
"0.76214814",
"0.684548",
"0.6831218",
"0.68054146",
"0.6801467",
"0.67217314",
"0.6690045",
"0.6680714",
"0.6573519",
"0.6561619",
"0.6533151",
"0.6458568",
"0.64272666",
"0.6382908",
"0.6374065",
"0.6329962",
"0.62946355",
"0.6291485",
"0.6257982",
"0.62516975"... | 0.7434154 | 2 |
Tests basic isbn search for unavailable found item. | def test_search_found_unavailable(self):
s = Searcher( self.logger )
( search_key, search_value ) = ( 'ISBN', self.isbn_found_and_unavailable )
result_dct = s.search(
self.patron_barcode, search_key, search_value, self.api_url_root, self.api_key, self.partnership_id, self.university_... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_run_request_item__not_found(self):\n basics = {\n 'API_URL_ROOT': self.api_url_root,\n 'API_KEY': self.api_key,\n 'PARTNERSHIP_ID': self.partnership_id,\n 'UNIVERSITY_CODE': self.university_code,\n 'PICKUP_LOCATION': self.pickup_location,\n ... | [
"0.71568733",
"0.71375215",
"0.71078074",
"0.70965296",
"0.69709545",
"0.68349105",
"0.66931206",
"0.6606826",
"0.6538037",
"0.65102106",
"0.63279444",
"0.6320771",
"0.6181923",
"0.61090755",
"0.5986501",
"0.5943237",
"0.5779287",
"0.5777104",
"0.5773757",
"0.5713782",
"0.569... | 0.7520346 | 0 |
Tests basic isbn request for notfound item. | def test_request_item_not_found(self):
r = Requester( self.logger )
( search_key, search_value ) = ( 'ISBN', self.isbn_not_found )
result_dct = r.request_item(
self.patron_barcode, search_key, search_value, self.pickup_location, self.api_url_root, self.api_key, self.partnership_id, s... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_run_request_item__not_found(self):\n basics = {\n 'API_URL_ROOT': self.api_url_root,\n 'API_KEY': self.api_key,\n 'PARTNERSHIP_ID': self.partnership_id,\n 'UNIVERSITY_CODE': self.university_code,\n 'PICKUP_LOCATION': self.pickup_location,\n ... | [
"0.809304",
"0.7167015",
"0.6983698",
"0.6961759",
"0.68072677",
"0.6759586",
"0.6579298",
"0.65318906",
"0.65110666",
"0.6450708",
"0.6399753",
"0.6366054",
"0.63500774",
"0.6340973",
"0.6292489",
"0.62702876",
"0.6234978",
"0.6196849",
"0.61744386",
"0.61652654",
"0.6138202... | 0.8290618 | 0 |
A reimplementation of accessible pk queryset for the "normal" unified JTs. Does not return inventory sources or system JTs, these should be handled inside of get_queryset where it is utilized. | def accessible_pk_qs(cls, accessor, role_field):
# do not use this if in a subclass
if cls != UnifiedJobTemplate:
return super(UnifiedJobTemplate, cls).accessible_pk_qs(accessor, role_field)
return ResourceMixin._accessible_pk_qs(cls, accessor, role_field, content_types=cls._submodel... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _objects(self):\n # Assuming the document ID is called \"id\" lets us depend on fewer\n # Djangoisms than assuming it's the pk; we'd have to get\n # self.type._meta to get the name of the pk.\n return ((o.id, o) for o in self._queryset())",
"def _queryset(self):\n return se... | [
"0.6129872",
"0.5813205",
"0.56689954",
"0.5538362",
"0.55228454",
"0.55075806",
"0.5485429",
"0.54546946",
"0.54523325",
"0.5443754",
"0.5436462",
"0.5400819",
"0.53958815",
"0.53685564",
"0.5366976",
"0.53633326",
"0.53610146",
"0.53562343",
"0.5350868",
"0.53381896",
"0.53... | 0.6442074 | 0 |
This method returns a filelike object ready to be read which contains all stdout for the UnifiedJob. If the size of the file is greater than `settings.STDOUT_MAX_BYTES_DISPLAY`, a StdoutMaxBytesExceeded exception will be raised. | def result_stdout_raw_handle(self, enforce_max_bytes=True):
max_supported = settings.STDOUT_MAX_BYTES_DISPLAY
if enforce_max_bytes:
# If enforce_max_bytes is True, we're not grabbing the whole file,
# just the first <settings.STDOUT_MAX_BYTES_DISPLAY> bytes;
# in thi... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_stdout(self):\n _ = self.get() # force finished wait\n if self._stdout is not None:\n if wait_until_exists(self._stdout):\n with open(self._stdout) as f:\n self._out = f.read()\n return self._out",
"def _stdout_reader(self):\n self.... | [
"0.5871149",
"0.5525514",
"0.5501839",
"0.54867613",
"0.5395682",
"0.53367585",
"0.53367585",
"0.53367585",
"0.53367585",
"0.5307945",
"0.52621764",
"0.51016444",
"0.507231",
"0.50648206",
"0.50240415",
"0.50096893",
"0.498653",
"0.49732062",
"0.49674836",
"0.49123088",
"0.48... | 0.73263097 | 0 |
Returns True if dispatcher running this job acknowledged request and sent SIGTERM | def cancel_dispatcher_process(self):
if not self.celery_task_id:
return
canceled = []
try:
# Use control and reply mechanism to cancel and obtain confirmation
timeout = 5
canceled = ControlDispatcher('dispatcher', self.controller_node).cancel([self... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def should_terminate(self):\n return self._terminate.isSet()",
"def check_termination(self) -> bool:\n return self.terminate",
"def _is_running(self, _):\n if self._shutdown_event.is_set():\n raise RequestProcessingError(\n \"Unable to process message - currently ... | [
"0.67554474",
"0.64415896",
"0.6369764",
"0.6269525",
"0.61635363",
"0.6120694",
"0.61162776",
"0.6061043",
"0.60353684",
"0.60035914",
"0.59770304",
"0.59689724",
"0.593686",
"0.58462846",
"0.5832207",
"0.5817955",
"0.58103335",
"0.57641995",
"0.5748771",
"0.57455665",
"0.57... | 0.0 | -1 |
Tests whether ``Resolved.__repr__`` works as intended. | def test__Resolved__repr():
entity_id = 202211050036
attachment = Attachment.precreate(entity_id)
channel = Channel.precreate(entity_id)
role = Role.precreate(entity_id)
message = Message.precreate(entity_id)
user = User.precreate(entity_id)
resolved = Resolved(
attachment... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_repr(self, r, rep):\n assert repr(r) == rep",
"def test_repr():\n c = Circle(4) \n assert c.__repr__() == 'Circle(4)'",
"def test_repr(self):\n self.assertEqual(repr(self.card), \"A of Spades\")",
"def allow_repr(cls) -> bool:\n raise NotImplementedError",
"def test_repr... | [
"0.76464975",
"0.7243855",
"0.7176626",
"0.7151514",
"0.70843065",
"0.7072185",
"0.7059306",
"0.69031",
"0.6782615",
"0.67780906",
"0.6754082",
"0.67105484",
"0.6694708",
"0.6673053",
"0.65794456",
"0.65352595",
"0.65005285",
"0.6487848",
"0.64836925",
"0.6434913",
"0.6429339... | 0.67346865 | 11 |
Tests whether ``Resolved.__eq__`` works as intended. | def test__Resolved__eq():
entity_id = 202211050038
attachment = Attachment.precreate(entity_id)
channel = Channel.precreate(entity_id)
role = Role.precreate(entity_id)
message = Message.precreate(entity_id)
user = User.precreate(entity_id)
keyword_parameters = {
'attac... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def testEquality(self):\n pass",
"def __eq__(self, other):\n return self is other",
"def __eq__(self, other):\n return self is other",
"def __eq__(self,*args):\r\n pass",
"def __eq__(self,*args):\r\n pass",
"def __eq__(self,*args):\r\n pass",
"def __eq__(self,*args):\r\n pass",... | [
"0.68777514",
"0.6852498",
"0.6852498",
"0.68428284",
"0.68428284",
"0.68428284",
"0.68428284",
"0.68428284",
"0.68428284",
"0.68428284",
"0.68428284",
"0.68428284",
"0.68428284",
"0.68428284",
"0.68428284",
"0.68428284",
"0.68428284",
"0.68428284",
"0.68428284",
"0.68428284",
... | 0.0 | -1 |
Calculate a reduced influence coefficient matrix from a complete influence coefficient matrix. | def beinflumatred(infl_mat):
shape_mat = np.shape(infl_mat)
len_mat = shape_mat[0] * shape_mat[1]
reduced_infl_mat = np.zeros((len_mat, len_mat))
counter = 0
for i in range(0, shape_mat[0]):
for j in range(0, shape_mat[1]):
reduced_infl_mat[counter, :] = \
np.resh... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def cofactorMatrix(self):\n returnvalue = Matrix()\n for i in range(self._height):\n newRow = list()\n for j in range(self._width):\n newRow.append(self.cofactor(i, j))\n returnvalue.addRow(*newRow)\n return returnvalue",
"def recomb_matrix(rec... | [
"0.59304214",
"0.5929222",
"0.5812368",
"0.58077896",
"0.5765094",
"0.5695201",
"0.5688761",
"0.5669813",
"0.5577388",
"0.5560173",
"0.55368185",
"0.55104",
"0.54747885",
"0.5453567",
"0.54345644",
"0.54046273",
"0.5401262",
"0.53838986",
"0.53227013",
"0.53210837",
"0.531964... | 0.4954746 | 56 |
Generate a complete influence coefficient matrix as required for boundary element contact mechanics calculations. | def beinflumat(x_axis, y_axis, e_eff):
len_x = len(x_axis)
len_y = len(y_axis)
influence_matrix_complete = np.zeros((len_x, len_y, len_x, len_y))
# generate coordinate grids
a_factor = (x_axis[-1] - x_axis[0]) / (len_x - 1) / 2
b_factor = (y_axis[-1] - y_axis[0]) / (len_y - 1) / 2
x_grid = ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def cofactorMatrix(self):\n returnvalue = Matrix()\n for i in range(self._height):\n newRow = list()\n for j in range(self._width):\n newRow.append(self.cofactor(i, j))\n returnvalue.addRow(*newRow)\n return returnvalue",
"def _C(self):\n\n ... | [
"0.6481157",
"0.62562436",
"0.62488186",
"0.6240849",
"0.6116911",
"0.6077862",
"0.6050431",
"0.5964872",
"0.58841085",
"0.584239",
"0.57857436",
"0.5780283",
"0.5766078",
"0.57503134",
"0.5738815",
"0.5725279",
"0.571975",
"0.57022685",
"0.57014185",
"0.5694971",
"0.56781244... | 0.539125 | 57 |
Returns value for the environment variable | def get(self):
return self.match.group("value") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get(self):\n self.value = os.getenv(self.name, self.default)\n return self.value",
"def windows_get_env_value(var_name: str) -> str:\n if var_name in os.environ.keys():\n return os.environ[var_name]",
"def environment_value(self, name):\n if not os.environ.has_key(name):\n ... | [
"0.8029504",
"0.79075146",
"0.78773695",
"0.78602374",
"0.7785148",
"0.7772786",
"0.77047604",
"0.7533139",
"0.749595",
"0.7345182",
"0.73212856",
"0.7286622",
"0.72648054",
"0.7253057",
"0.7250981",
"0.7249198",
"0.7216375",
"0.71715677",
"0.7159809",
"0.7140047",
"0.7137754... | 0.0 | -1 |
Allow setting many envs at a time. | def set_many(self, envs: Dict[str, str]):
env_args = []
for name, value in envs.items():
env_args.append(f"{name}={value}")
logger.info("Setting env %s=%s in %s", name, value, self.deployment_name)
self.openshift.do_action("set", ["env", self.resource_type, self.deployme... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def envs(self, envs):\n self._instructions_setter('ENV', envs)",
"def get_environmentals(self):\n for k, v in utils.slurm_envs(default.SBATCH_VARS_FOR_WORKFLOW).items():\n setattr(self, k, v)",
"def SetEnvironmentVars(self):\n for name, value, section in self._marchConfig():\n ... | [
"0.7537119",
"0.6550076",
"0.6537088",
"0.6504986",
"0.6190689",
"0.6136109",
"0.6088526",
"0.6082753",
"0.60640764",
"0.60571617",
"0.6020056",
"0.6014825",
"0.59957194",
"0.5991743",
"0.5965301",
"0.5945593",
"0.59423506",
"0.5932325",
"0.5928465",
"0.5924925",
"0.5896044",... | 0.76120794 | 0 |
The function takes a sentence and count the words, first take out the escape codes and then split the words. | def word_count(phrase):
Wordlist = phrase.replace("\n", ' ') # Creating a list without escape codes
Wordlist = Wordlist.split(" ") # Split the sentence in words
dictionary = {} # Create an empty dictionary to store the results
for i in Wordlist:
if i != '': # unless is a ''
dicti... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def split_sentence(sentence):\n\n words = [] # An array of words and punctuation.\n number_of_words = 0\n length = len(sentence)\n start_index = 0\n\n while (start_index < length):\n\n ch = ' '\n\n # Skip spaces, etc.\n while (start_index < length):\n ch = sentence[s... | [
"0.68360895",
"0.67470264",
"0.6646266",
"0.66386414",
"0.6576101",
"0.65191495",
"0.64899343",
"0.64739996",
"0.6459389",
"0.6425281",
"0.64024675",
"0.63711226",
"0.63393295",
"0.6333911",
"0.63288033",
"0.6313574",
"0.62990534",
"0.62961227",
"0.627172",
"0.6271076",
"0.62... | 0.59350085 | 72 |
Add headers to both force latest IE rendering engine or Chrome Frame, and also to cache the rendered page for 10 minutes. | def add_header(r):
r.headers["Cache-Control"] = "no-cache, no-store, must-revalidate"
r.headers["Pragma"] = "no-cache"
r.headers["Expires"] = "0"
r.headers['X-UA-Compatible'] = 'IE=Edge,chrome=1'
r.headers['Cache-Control'] = 'public, max-age=0'
return r | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_header(response):\n response.headers['X-UA-Compatible'] = 'IE=Edge,chrome=1'\n response.headers['Cache-Control'] = 'public, max-age=60'\n return response",
"def add_header(response):\n response.headers['X-UA-Compatible'] = 'IE=Edge,chrome=1'\n response.headers['Cache-Control'] = 'public, m... | [
"0.82229227",
"0.8222085",
"0.8222085",
"0.8222085",
"0.8222085",
"0.819543",
"0.8162872",
"0.8162872",
"0.8162872",
"0.8162872",
"0.8162872",
"0.8162872",
"0.8162872",
"0.8162872",
"0.8162872",
"0.8162872",
"0.8162872",
"0.8162872",
"0.8162872",
"0.8162872",
"0.8162872",
"... | 0.7661059 | 37 |
Convert a datetime.timedelta object into Days, Hours, Minutes, Seconds. | def readable_timedelta(timedeltaobj):
# stolen from https://stackoverflow.com/a/46928226/8207
if not timedeltaobj:
return '---'
secs = timedeltaobj.total_seconds()
timetot = ""
if secs > 86400: # 60sec * 60min * 24hrs
days = secs // 86400
timetot += "{} days".format(int(days... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def convert_timedelta(item):\r\n if isinstance(item, timedelta):\r\n seconds = int(item.total_seconds())\r\n hours, remainder = divmod(seconds, 3600)\r\n minutes, seconds = divmod(remainder, 60)\r\n formated = '{}h {}m {}s'.format(hours, minutes, seconds)\r\n else:\r\n rais... | [
"0.723899",
"0.71328026",
"0.6774715",
"0.6733618",
"0.66779184",
"0.6622992",
"0.6567872",
"0.65264505",
"0.6513849",
"0.6478437",
"0.6447721",
"0.6446586",
"0.6430813",
"0.64186895",
"0.6371977",
"0.6365604",
"0.6361276",
"0.6341838",
"0.6338272",
"0.63255066",
"0.6325211",... | 0.68995523 | 2 |
Caches the given post in the user's timeline. The post is inserted reverse chronologically. | def add_to_timeline(new_status):
timeline = CacheManager.get_timeline()
index = [timeline.index(status) for status in timeline \
if parse(status['pubdate']) < parse(new_status['pubdate'])]
if len(index) == 0:
timeline.insert(0, new_status)
else:
ti... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_last_post(self, post):\n with open(self.cache_filename,'w') as cache_file:\n json.dump(post['id'], cache_file)",
"def insert_post(post):\n full_path_image = ''\n try:\n # Set image name saved\n image_name_save = post.category_post_image_name + '.' + str(imghdr.what(p... | [
"0.6897148",
"0.56462574",
"0.56285316",
"0.56207824",
"0.54824287",
"0.5409037",
"0.5375541",
"0.5374787",
"0.53701055",
"0.5333687",
"0.5332967",
"0.53082865",
"0.5307745",
"0.52751726",
"0.5271335",
"0.52648944",
"0.5238627",
"0.52123165",
"0.5210372",
"0.5209396",
"0.5156... | 0.48121765 | 58 |
Removes the post with the given status_id from the user's cached timeline. | def remove_from_timeline(status_id):
timeline = [status for status in CacheManager.get_timeline \
if status['guid'] != status_id]
to_cache(CacheManager.cache_file_location, 'timeline', timelinE) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"async def rndactivity_remove(self, ctx: commands.Context, status: int):\n async with self.config.statuses() as statuses:\n if len(statuses) < status:\n return await fmt(ctx, warning(_(\"No status with the ID `{id}` exists\")), id=status)\n removed = statuses.pop(status -... | [
"0.63384604",
"0.6262617",
"0.60500157",
"0.5950372",
"0.58491564",
"0.5804031",
"0.57429415",
"0.5669231",
"0.5555525",
"0.55456287",
"0.5526256",
"0.55195045",
"0.546012",
"0.5433655",
"0.540426",
"0.5381575",
"0.537297",
"0.5371668",
"0.53704596",
"0.53596425",
"0.5359539"... | 0.7689713 | 0 |
Returns the first value of a list or the value itself when given a `request.vars` style key. If the value is a list, its first item will be returned; otherwise, the value will be returned asis. | def getfirst(self, key, default=None):
values = self.getlist(key)
return values[0] if values else default | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getfirst(s):\n return s[0] if isinstance(s, list) else s",
"def value_from_list(key, values, by_first=False):\n i, j = (1, 0,) if not by_first else (0, 1,)\n for elm in values:\n if elm[i] == key:\n return elm[j]\n return None",
"def get_possible_array_value(args, key):\n i... | [
"0.59930444",
"0.5962821",
"0.5950862",
"0.566413",
"0.5629889",
"0.56125337",
"0.55779874",
"0.55760497",
"0.55736816",
"0.5516245",
"0.5492377",
"0.5440507",
"0.5323764",
"0.5237315",
"0.52180666",
"0.5205747",
"0.5200182",
"0.5199856",
"0.51979053",
"0.518327",
"0.51650953... | 0.6196312 | 0 |
select an element randomly from a lis | def selectRandomFromList(ldata):
return ldata[randint(0, len(ldata)-1)] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _random_pick(lst):\n\n choice = random.randint(0, len(lst) - 1)\n return lst[choice]",
"def choice(L):\r\n LEN = len(L) # Get the length\r\n randomindex = int(LEN*random()) # Get a random index\r\n return L[randomindex] # Return that element\r",
"def spinit(list):\n retu... | [
"0.75144416",
"0.74923056",
"0.71464497",
"0.71230614",
"0.71152055",
"0.6928507",
"0.69022536",
"0.6857503",
"0.6849486",
"0.6810723",
"0.678612",
"0.67699593",
"0.6747843",
"0.6747843",
"0.6747843",
"0.6747843",
"0.6721026",
"0.6712398",
"0.6599632",
"0.6583839",
"0.6541563... | 0.7449069 | 2 |
select an element randomly from a list excluding the given one | def selectOtherRandomFromList(ldata, cval):
nval = selectRandomFromList(ldata)
while nval == cval:
nval = selectRandomFromList(ldata)
return nval | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _random_pick(lst):\n\n choice = random.randint(0, len(lst) - 1)\n return lst[choice]",
"def uniform_select(xs):\n n = len(xs) - 1\n i = randint(0, n)\n return xs[i]",
"def random_pick(id_list):\n return random.choice(id_list)",
"def pick_one(_lst):\n if len(_lst) == 2:\n retur... | [
"0.7403675",
"0.7220092",
"0.70141333",
"0.69315976",
"0.68790174",
"0.68679357",
"0.68245864",
"0.6769756",
"0.6721893",
"0.67211175",
"0.6683685",
"0.66006804",
"0.6559623",
"0.65436554",
"0.6533628",
"0.6527482",
"0.6490424",
"0.6468462",
"0.6448325",
"0.6430817",
"0.63958... | 0.6143613 | 40 |
generates random sublist from a list without replacemment | def selectRandomSubListFromList(ldata, num):
assertLesser(num, len(ldata), "size of sublist to be sampled greater than or equal to main list")
i = randint(0, len(ldata)-1)
sel = ldata[i]
selSet = {i}
selList = [sel]
while (len(selSet) < num):
i = randint(0, len(ldata)-1)
if (i not in selSet):
sel = ldata[i... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def selectRandomSubListFromListWithRepl(ldata, num):\n\treturn list(map(lambda i : selectRandomFromList(ldata), range(num)))",
"def spinit(list):\n return (random.choice(list))",
"def random_slice(l: list, size: int) -> list:\n first = randint(0, len(l) - size)\n return l[first:first+size]",
"def ge... | [
"0.76314026",
"0.7582477",
"0.7421406",
"0.6964384",
"0.692715",
"0.6860676",
"0.68375623",
"0.68250865",
"0.67940235",
"0.6744911",
"0.67142886",
"0.6696584",
"0.66773117",
"0.6672385",
"0.6670478",
"0.66464764",
"0.6643001",
"0.6611635",
"0.66012007",
"0.6593617",
"0.658838... | 0.7163945 | 3 |
generates random sublist from a list with replacemment | def selectRandomSubListFromListWithRepl(ldata, num):
return list(map(lambda i : selectRandomFromList(ldata), range(num))) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def spinit(list):\n return (random.choice(list))",
"def random_slice(l: list, size: int) -> list:\n first = randint(0, len(l) - size)\n return l[first:first+size]",
"def partial_shuffle(l, start, end):\n l[start:end] = sorted(l[start:end], key=lambda x: random.random())\n return l",
"def selec... | [
"0.7353521",
"0.68763447",
"0.6822858",
"0.6577555",
"0.65426594",
"0.65049654",
"0.64765465",
"0.6476462",
"0.6459007",
"0.6443692",
"0.6338879",
"0.63366365",
"0.63103604",
"0.6306718",
"0.629345",
"0.6283552",
"0.6275224",
"0.6269632",
"0.6262004",
"0.62601686",
"0.6253910... | 0.74972445 | 0 |
sets some elents in the first list randomly with elements from the second list | def setListRandomFromList(ldata, ldataRepl):
l = len(ldata)
selSet = set()
for d in ldataRepl:
i = randint(0, l-1)
while i in selSet:
i = randint(0, l-1)
ldata[i] = d
selSet.add(i) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def randomize_in_place(list1, list2, init=0):\n np.random.seed(seed=init)\n np.random.shuffle(list1)\n np.random.seed(seed=init)\n np.random.shuffle(list2)",
"def swapBetweenLists(values1, values2):\n\tp1 = randint(0, len(values1)-1)\n\tp2 = randint(0, len(values2)-1)\n\ttmp = values1[p1]\t\n\tvalues... | [
"0.76853144",
"0.71410125",
"0.70643985",
"0.65418375",
"0.6471022",
"0.6459093",
"0.6302327",
"0.6270351",
"0.6222225",
"0.62209797",
"0.6202239",
"0.61605257",
"0.6154705",
"0.60853446",
"0.59724885",
"0.5927701",
"0.58773077",
"0.5862317",
"0.5833291",
"0.5750147",
"0.5738... | 0.66022635 | 3 |
splits a list into sub lists of approximately equal size, with items in sublists randomly chod=sen | def splitList(itms, numGr):
tcount = len(itms)
cItems = list(itms)
sz = int(len(cItems) / numGr)
groups = list()
count = 0
for i in range(numGr):
if (i == numGr - 1):
csz = tcount - count
else:
csz = sz + randint(-2, 2)
count += csz
gr = list()
for j in range(csz):
it = selectRandomFromList(c... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def randsplit(data, sections=2):\n ret = [[] for i in range(sections)]\n for item in data:\n ret[random.randrange(sections)].append(item)\n return ret",
"def partition(lis: list, n: int):\n # prevent destroying the original dataset\n lis_cp = copy.deepcopy(lis)\n random.shuffle(lis_cp)\n... | [
"0.69467145",
"0.68404555",
"0.6809988",
"0.6672847",
"0.6657127",
"0.65283084",
"0.649177",
"0.64286476",
"0.64183015",
"0.6399493",
"0.63903284",
"0.6389243",
"0.6367187",
"0.6364535",
"0.6266029",
"0.6258166",
"0.62371975",
"0.62260824",
"0.61997783",
"0.61996883",
"0.6198... | 0.73824614 | 0 |
extracts list from another list, given indices | def extractList(data, indices):
if areAllFieldsIncluded(data, indices):
exList = data.copy()
#print("all indices")
else:
exList = list()
le = len(data)
for i in indices:
assert i < le , "index {} out of bound {}".format(i, le)
exList.append(data[i])
return exList | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def extract_sub_list(mylist, indices):\n return [mylist[ii] for ii in indices]",
"def get_elements_from_list(target_list, indexes):\n elements = [target_list[i] for i in indexes]\n return elements",
"def getall(l, idx):\n return [l[i] for i in idx]",
"def slice_by_index(lst, indices):\r\n slic... | [
"0.81797177",
"0.74004084",
"0.73235387",
"0.7253971",
"0.7032841",
"0.7029539",
"0.6984813",
"0.6865537",
"0.6836507",
"0.66363055",
"0.6484061",
"0.64742684",
"0.643168",
"0.6422398",
"0.63765717",
"0.6337673",
"0.6288079",
"0.6248093",
"0.62399125",
"0.62146866",
"0.614460... | 0.7322136 | 3 |
int array from delim separated string | def strToIntArray(line, delim=","):
arr = line.split(delim)
return [int(a) for a in arr] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def strListOrRangeToIntArray(line):\n\tvarr = line.split(\",\")\n\tif (len(varr) > 1):\n\t\tiarr = list(map(lambda v: int(v), varr))\n\telse:\n\t\tvrange = line.split(\":\")\n\t\tif (len(vrange) == 2):\n\t\t\tlo = int(vrange[0])\n\t\t\thi = int(vrange[1])\n\t\t\tiarr = list(range(lo, hi+1))\n\t\telse:\n\t\t\tiarr... | [
"0.72379214",
"0.684962",
"0.6728982",
"0.6678012",
"0.6640123",
"0.65883213",
"0.6574866",
"0.6537495",
"0.65371567",
"0.65273845",
"0.65046215",
"0.6417508",
"0.6412186",
"0.6318638",
"0.6318216",
"0.6258499",
"0.62582076",
"0.6251155",
"0.62294185",
"0.61902475",
"0.61872"... | 0.7706036 | 0 |
convert to string list | def toStrList(values, precision=None):
return list(map(lambda va: toStr(va, precision), values)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def listToString(L):\r\n S = ''\r\n for x in L:\r\n S += str(x)\r\n return S",
"def str_transform_list(L):\n return [str(x) for x in L]",
"def _convertListToString(self, list_of_objects):\n return (';').join(list_of_objects)",
"def __str__(self):\n list_string = \... | [
"0.73455364",
"0.7308787",
"0.7063419",
"0.7021181",
"0.69840807",
"0.69787604",
"0.6966291",
"0.6946745",
"0.69167346",
"0.69085383",
"0.6882239",
"0.6857694",
"0.6852867",
"0.684071",
"0.68235236",
"0.68097615",
"0.6791841",
"0.677701",
"0.677701",
"0.676237",
"0.6682535",
... | 0.71633005 | 2 |
get lines from a file | def getFileLines(dirPath, delim=","):
lines = list()
for li in fileRecGen(dirPath, delim):
lines.append(li)
return lines | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def read_lines_from_file(fname):\n return []",
"def read_file_lines(afile):\n with open(afile, 'r') as f:\n lines = f.read()\n return lines.splitlines()",
"def read_lines(filename):\n with open(filename, 'r') as f:\n lines = f.readlines()\n return lines",
"def extract_lines(i... | [
"0.8028985",
"0.79466677",
"0.79000217",
"0.78965145",
"0.77945226",
"0.77141535",
"0.7678618",
"0.7675815",
"0.75970656",
"0.75414336",
"0.74973565",
"0.7492417",
"0.74745077",
"0.74743235",
"0.74719423",
"0.7471733",
"0.73972094",
"0.7342484",
"0.7300058",
"0.72994614",
"0.... | 0.0 | -1 |
Returns True is string is a number | def isNumber(st):
return st.replace('.','',1).isdigit() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_number(string):\r\n try:\r\n float(string)\r\n return True\r\n except ValueError: return False",
"def is_number(string):\n try:\n float(string)\n return True\n except ValueError:\n return False",
"def is_valid_numeric(inString):\r\n return is_int(inStrin... | [
"0.87243295",
"0.86852115",
"0.8595288",
"0.85894513",
"0.85598266",
"0.8549267",
"0.8544011",
"0.8505952",
"0.850492",
"0.8498675",
"0.8498675",
"0.8498675",
"0.8454011",
"0.84477544",
"0.832368",
"0.82826376",
"0.82817423",
"0.82757294",
"0.8234189",
"0.81734663",
"0.816637... | 0.7623907 | 46 |
file record generator with row and column filter applied | def fileFiltSelFieldsRecGen(filePath, filt, columns, delim = ","):
columns = strToIntArray(columns, delim)
with open(filePath, "r") as fp:
for line in fp:
line = line[:-1]
if delim is not None:
line = line.split(delim)
if filt(line):
selected = extractList(line, columns)
yield selected | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def fileFiltRecGen(filePath, filt, delim = \",\"):\n\twith open(filePath, \"r\") as fp:\n\t\tfor line in fp:\t\n\t\t\tline = line[:-1]\n\t\t\tif delim is not None:\n\t\t\t\tline = line.split(delim)\n\t\t\tif filt(line):\n\t\t\t\tyield line",
"def iter_rows_raw(self, *args):\n with open(self.filename) as f... | [
"0.62498385",
"0.62427604",
"0.59685385",
"0.5945742",
"0.5883134",
"0.5867652",
"0.5820567",
"0.5803369",
"0.57455117",
"0.5725123",
"0.5724859",
"0.57240885",
"0.5704861",
"0.5696153",
"0.5664843",
"0.5653511",
"0.5649182",
"0.56270355",
"0.5626881",
"0.55749047",
"0.555627... | 0.6691331 | 0 |
get ALL indexes of list elements | def getAllIndex(ldata, fldata):
return list(map(lambda e : fldata.index(e), ldata)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_indexes(self, items: Iterable[_T]) -> List[int]:\n return [self.get_index(item) for item in items]",
"def list_item_indexes(list_arg: list, item: Any) -> Tuple[int, ...]:\n indexes = [index for index, value in enumerate(list_arg) if value == item]\n return indexes",
"def get_coincidence_in... | [
"0.77868956",
"0.7431119",
"0.73785806",
"0.73624647",
"0.7338215",
"0.72532356",
"0.72036815",
"0.7110967",
"0.7103995",
"0.70737785",
"0.7046307",
"0.7042078",
"0.70124465",
"0.6976393",
"0.6810378",
"0.6806202",
"0.67971027",
"0.67875147",
"0.67573243",
"0.6747437",
"0.673... | 0.7261694 | 5 |
return min, max values of a column | def getColMinMax(table, col):
vmin = None
vmax = None
for rec in table:
value = rec[col]
if vmin is None:
vmin = value
vmax = value
else:
if value < vmin:
vmin = value
elif value > vmax:
vmax = value
return (vmin, vmax, vmax - vmin) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_range(df, col):\n return df[col].min(), df[col].max()",
"def find_max_min(self, col):\n self.max = max(col)\n self.min = min(col)",
"def get_minmax_stats(dataframe, variable):\n\n print(\"Maximum value of \", variable, \"is: \", dataframe[variable].max())\n print(\"Minimum value ... | [
"0.7972702",
"0.7783097",
"0.71817213",
"0.716688",
"0.68736446",
"0.6850248",
"0.6738514",
"0.6724881",
"0.6687197",
"0.6677552",
"0.6671152",
"0.66614187",
"0.66089",
"0.65693426",
"0.6541818",
"0.6541818",
"0.65232164",
"0.6502788",
"0.6479793",
"0.6449615",
"0.64489573",
... | 0.7948461 | 1 |
Given a filename return the original path | def name_to_path(img, origin):
orig_file_parts = img.split('_')[1:]
category = orig_file_parts[-3]
filename = orig_file_parts[-2]+'_'+orig_file_parts[-1]
orig_file = os.path.sep.join([origin, category])
orig_file = os.path.sep.join([orig_file, filename])
return orig_file | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getPath(filename):\n\n if os.path.isabs(filename):\n pathfile = filename\n else:\n filename = filename.lstrip('/\\.')\n filename = filename.replace('/', '\\\\')\n pathfile = os.path.join(os.getcwd(), filename)\n \n return pathfile",
"def file_path(file_name, path):\n ... | [
"0.75641775",
"0.74056464",
"0.72795254",
"0.71217936",
"0.7047483",
"0.69768983",
"0.69525677",
"0.69373",
"0.68968034",
"0.6883796",
"0.68546015",
"0.68392336",
"0.68084586",
"0.6796116",
"0.67903066",
"0.678943",
"0.6759913",
"0.6750788",
"0.67392915",
"0.6733291",
"0.6727... | 0.0 | -1 |
Calculates the maximum value of a function over a discrete space. The function is of the form `f([[state,...,action]]) > [[float]]`. | def max_discrete(func: Callable[[Tuple], np.ndarray], over: Iterable[Tuple],\
state: Tuple[Union[int, float]]) -> Tuple[float, Tuple[Union[int, float]], None]:
vals = [func(np.asarray((*state, *action)).reshape(1, -1))[0, 0] for action in over]
maximum = max(vals)
return (maximum, over[vals.index(maximu... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_highest_value_action(self, state):\n a = self.sess.run(self.network.maxOutputNode, feed_dict={self.network.inputs: [state]})\n return a[0]",
"def create_state_value_function(q):\n state_values = defaultdict(float)\n for state, action_values in q.items():\n state_values[state] =... | [
"0.69241726",
"0.68707573",
"0.6766437",
"0.6695684",
"0.663746",
"0.65546215",
"0.65330714",
"0.6517808",
"0.650299",
"0.6489235",
"0.64075166",
"0.6392414",
"0.6382451",
"0.6341185",
"0.63397753",
"0.6326931",
"0.6326931",
"0.63123477",
"0.62715364",
"0.6264739",
"0.6257919... | 0.7713988 | 0 |
Calculates the maximum value of a function over a continuous space. The function is of the form `f([[state,...,action]]) > [[float]]`. | def max_continuous(func: Callable[[Tuple], np.ndarray], over: Iterable[Tuple],\
state: Tuple[Union[int, float]]) -> Tuple[float, Tuple[Union[int, float]], None]:
statebounds = tuple(zip(state, state))
init = tuple([*state, *np.random.uniform(*zip(*over))])
funcarg = lambda x: -func(np.asarray(x).reshape... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def max_discrete(func: Callable[[Tuple], np.ndarray], over: Iterable[Tuple],\\\n state: Tuple[Union[int, float]]) -> Tuple[float, Tuple[Union[int, float]], None]:\n vals = [func(np.asarray((*state, *action)).reshape(1, -1))[0, 0] for action in over]\n maximum = max(vals)\n return (maximum, over[vals.in... | [
"0.74118465",
"0.6911882",
"0.67653006",
"0.6755675",
"0.6700097",
"0.66732067",
"0.66682297",
"0.66391003",
"0.6638205",
"0.6624884",
"0.6593813",
"0.6561686",
"0.653449",
"0.6528168",
"0.6528168",
"0.6464699",
"0.6464699",
"0.6464699",
"0.6464699",
"0.6464699",
"0.6464699",... | 0.7000933 | 1 |
Calculates the maximum value of a function over a discretecontinuous hybrid space. The function is of the form `f([[state,...,action]]) > [[float]]`. | def max_hybrid(func: Callable[[Tuple], np.ndarray], over: Tuple[Tuple],\
state: Tuple[Union[int, float]], cont: Tuple[bool],\
actions: Iterable[Tuple]) -> Tuple[float, Tuple[Union[int, float]], None]:
best = -np.inf
bestarg = None
funcarg = lambda x: -func(np.asarray(x).reshape(1, -1))[0, 0]
sta... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def max_discrete(func: Callable[[Tuple], np.ndarray], over: Iterable[Tuple],\\\n state: Tuple[Union[int, float]]) -> Tuple[float, Tuple[Union[int, float]], None]:\n vals = [func(np.asarray((*state, *action)).reshape(1, -1))[0, 0] for action in over]\n maximum = max(vals)\n return (maximum, over[vals.in... | [
"0.723416",
"0.66574",
"0.65544426",
"0.6518895",
"0.6501835",
"0.6483888",
"0.6481177",
"0.6454216",
"0.6367743",
"0.63644564",
"0.6269009",
"0.6242306",
"0.6242306",
"0.6208276",
"0.62002057",
"0.61769724",
"0.61769724",
"0.61769724",
"0.61769724",
"0.61769724",
"0.61769724... | 0.6870728 | 1 |
Return Hardware Helper instance. | def helper(self) -> HwHelper:
return self._helper | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def hardware(self):\n return self._hardware",
"def _get_system_hardware(self):\n return self._get_system_status()[\"hardware\"]",
"def _init_hardware(self):\n return",
"def get_device(self):\n raise NotImplementedError()",
"def getHardware(self):\n return (self.vendorId, self... | [
"0.58485013",
"0.57532084",
"0.57418317",
"0.5716966",
"0.5714746",
"0.57100344",
"0.56509393",
"0.56391436",
"0.55760807",
"0.5419607",
"0.5363711",
"0.53604835",
"0.53523004",
"0.53211254",
"0.5297295",
"0.5281962",
"0.5261004",
"0.525017",
"0.5205277",
"0.517679",
"0.51628... | 0.6856541 | 0 |
Test for workday.get_index_of_day with empty daylist | def test_get_index_of_day_empty_list(self):
self._test_giod([], "15.07.2013", 0,
-1, "Empty list without next value.")
self._test_giod([], "15.07.2013", 1,
-1, "Empty list with next=1.")
self._test_giod([], "15.07.2013", -1,
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_get_index_of_day_one_day_list(self):\n days = [\"15.07.2013\"]\n self._test_find_day(days)\n self._test_giod(days, \"16.07.2013\", 0,\n -1, \"Find not existing day in an One-Day-List\")\n self._test_giod(days, \"16.07.2013\", 1,\n 0... | [
"0.6985117",
"0.68697405",
"0.5974712",
"0.5910122",
"0.58396995",
"0.579942",
"0.579942",
"0.56485224",
"0.5625296",
"0.5617682",
"0.5616635",
"0.5519079",
"0.54104215",
"0.5407502",
"0.5365336",
"0.5355601",
"0.52986115",
"0.5282035",
"0.5257318",
"0.5249783",
"0.5244184",
... | 0.78290266 | 0 |
Create tree structure (dict) | def create_tree_structure(prosecutor_offices):
tree_dict = {}
for prosecutor_office in prosecutor_offices:
adder(tree_dict, prosecutor_office, {'departments': {}, 'divisions': []})
for department in prosecutor_office.department_set.all():
adder(tree_dict[prosecutor_office]['departmen... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _tree():\n return collections.defaultdict(_tree)",
"def tree():\n return defaultdict(tree)",
"def to_dict(self):\r\n def node_to_dict(node):\r\n if len(node.children)==0:\r\n return node.info\r\n else:\r\n info_dict = node.info.copy()\r\n ... | [
"0.7705202",
"0.76248664",
"0.7139732",
"0.7070391",
"0.70667595",
"0.70103884",
"0.6973848",
"0.69458",
"0.69284344",
"0.68967056",
"0.6896021",
"0.68392974",
"0.67928666",
"0.67302006",
"0.67150164",
"0.66945535",
"0.668076",
"0.6629802",
"0.6526941",
"0.65033984",
"0.64537... | 0.6436795 | 22 |
Resumes a previous training by passing an explicit ``save_path`` instead of generating a new one | def resume(self, save_path: str, train_data: BaseDataManager,
val_data: BaseDataManager = None,
params: Parameters = None, **kwargs):
return self.run(
train_data=train_data,
val_data=val_data,
params=params,
save_path=save_path,
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def resume_model(self, resume_path):\n if resume_path:\n resume_path = f'{self.model_dir}/{resume_path}.pth.tar'\n if os.path.isfile(resume_path):\n print(f\"=> loading checkpoint '{resume_path}'\")\n checkpoint = torch.load(resume_path, map_location=self.... | [
"0.73369473",
"0.7321174",
"0.7216827",
"0.7208701",
"0.70329",
"0.6985532",
"0.6979012",
"0.69499284",
"0.6924008",
"0.68699634",
"0.6851208",
"0.68294954",
"0.6827136",
"0.6795692",
"0.66544294",
"0.661796",
"0.65858245",
"0.6541243",
"0.6527385",
"0.6489939",
"0.64483947",... | 0.7236645 | 2 |
perspective transform wrapper class | def __init__(self, before, after):
self.M = cv2.getPerspectiveTransform(before, after)
self.inverse_M = cv2.getPerspectiveTransform(after, before) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __set_perspective(self):\n\n src = np.float32([[(.42 * self.img_shape[1],.65 * self.img_shape[0] ),\n (.58 * self.img_shape[1], .65 * self.img_shape[0]),\n (0 * self.img_shape[1],self.img_shape[0]),\n (1 * self.img_shape[1], s... | [
"0.76095355",
"0.75749624",
"0.7421696",
"0.72860265",
"0.6811848",
"0.67915446",
"0.6714098",
"0.66579306",
"0.65663964",
"0.65524143",
"0.648868",
"0.64626616",
"0.6441885",
"0.6436822",
"0.6397949",
"0.6391625",
"0.62671566",
"0.6254645",
"0.6212158",
"0.6204939",
"0.61910... | 0.6580018 | 8 |
Return a sanitized function name string compatible with DOT representation. | def sanitize_dot(func):
return str(func).replace("::", "\\") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def dotted_name(s):\n forbidden = forbidden_chars.intersection(s)\n if forbidden:\n raise ValueError('%(s)s contains forbidden characters'\n ' (%(forbidden)s)'\n % locals())\n if not s:\n return ''\n elif s in reserved_names:\n raise ValueError('The na... | [
"0.6810576",
"0.66400546",
"0.64475447",
"0.64210916",
"0.63648",
"0.6298803",
"0.62474054",
"0.61831445",
"0.6174671",
"0.61154217",
"0.60855067",
"0.6061834",
"0.6032024",
"0.6028092",
"0.60221523",
"0.6001506",
"0.59857047",
"0.59793925",
"0.5967366",
"0.5961315",
"0.59612... | 0.80500704 | 0 |
magic from rllab for computing discounted cumulative sums of vectors. | def discount_cumsum(x, discount):
return scipy.signal.lfilter([1], [1, float(-discount)], x[::-1], axis=0)[::-1] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _discounted_cumsum(self, rewards, rate=None):\n # HINT1: note that each entry of the output should now be unique,\n # because the summation happens over [t, T] instead of [0, T]\n # HINT2: it is possible to write a vectorized solution, but a solution\n # using a for loop is also fin... | [
"0.6540757",
"0.64635974",
"0.6429183",
"0.6427291",
"0.6323769",
"0.63178307",
"0.63175875",
"0.6267737",
"0.6225033",
"0.6221566",
"0.62135977",
"0.62053436",
"0.61727947",
"0.61320513",
"0.6120513",
"0.60986733",
"0.6009351",
"0.59941953",
"0.59521544",
"0.59496266",
"0.59... | 0.6335572 | 8 |
Fillin/deduce missing values in environ. | def _sanitizeEnv(self, environ):
reqUri = None
if environ.has_key('REQUEST_URI'):
reqUri = environ['REQUEST_URI'].split('?', 1)
# Ensure QUERY_STRING exists
if not environ.has_key('QUERY_STRING') or not environ['QUERY_STRING']:
if reqUri is not None and len(reqUr... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _get_os_environ_dict(keys):\n return {k: os.environ.get(k, _UNDEFINED) for k in keys}",
"def _preload_specific_vars(env_keys: Set[str]) -> Store:\n specified = {}\n\n for env_name, env_value in environ.items():\n if env_name not in env_keys:\n # Skip vars that have not been requested... | [
"0.66411483",
"0.66087127",
"0.6534122",
"0.65307343",
"0.6371233",
"0.6371233",
"0.6371233",
"0.6371233",
"0.6371233",
"0.6371233",
"0.63070416",
"0.6285022",
"0.6186171",
"0.6141114",
"0.6135139",
"0.61149204",
"0.6103417",
"0.6088425",
"0.60726273",
"0.60531324",
"0.602398... | 0.6298745 | 11 |
Asks user to specify a city, month, and day to analyze. | def get_filters():
print('\nHello! Let\'s explore some US bikeshare data!\n')
# TO DO: get user input for city (chicago, new york city, washington). HINT: Use a while loop to handle invalid inputs
while 1:
city = input('Would you like to see data for Chicago | CH, New York City | NYC, or Washington ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def Raw_Data(city,month,day):\n print(\"The city you have entered is: \",city)\n print(\"The month you have entered is: \",month)\n print(\"The day you have entered is: \",day)",
"def get_filters():\n city = None\n month = None\n day = None\n while day == None:\n # TO DO: get user input f... | [
"0.66709363",
"0.6536631",
"0.6460791",
"0.6373951",
"0.6349272",
"0.6310802",
"0.6287722",
"0.62607133",
"0.6230896",
"0.6212277",
"0.62065274",
"0.61828023",
"0.6171454",
"0.61700225",
"0.6159926",
"0.6158883",
"0.6154618",
"0.61455905",
"0.6130836",
"0.61063856",
"0.610411... | 0.0 | -1 |
Loads data for the specified city and filters by month and day if applicable. | def load_data(city, month, day):
df = pd.read_csv(city)
df['month'] = pd.to_datetime(df['Start Time']).dt.month
df['day_of_week'] = pd.to_datetime(df['Start Time']).dt.dayofweek
if month != 'all':
df = df[df['month'] == month]
if day != 'all':
df = df[df['day_of_week'] == day]
r... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def load_data(city, month, day):\n df = pd.read_csv(CITY_DATA [city])\n \n # convert the Start Time column to datetime\n df['Start Time'] = pd.to_datetime(df['Start Time'])\n \n # extract month and day of week from Start Time to create new columns\n df['month'] = df['Start Time'].dt.month\n ... | [
"0.8131747",
"0.81087744",
"0.80456793",
"0.80419374",
"0.80089974",
"0.8006586",
"0.7998844",
"0.7997986",
"0.7988014",
"0.797856",
"0.79733896",
"0.7960562",
"0.79556054",
"0.794673",
"0.7945893",
"0.7907837",
"0.7907697",
"0.790398",
"0.79001075",
"0.7892662",
"0.7888655",... | 0.7808538 | 32 |
Displays statistics on the most popular times of travel. | def time_stats(df):
print('\nCalculating The Most Popular Times of Travel...\n')
start_time = time.time()
# TO DO: display the most common month
df['month'] = pd.to_datetime(df['Start Time']).dt.month
popular_month = df['month'].mode()[0]
for num in MONTH_LIST:
if MONTH_LIST[num]==popu... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def time_stats(df):\n\n print(\"\\nDisplaying the most frequent times of travel...\\n\")\n start_time = time.time()\n\n # Ignoring getting the most popular month when the data is already filtered by month\n if len(df[\"month\"].unique()) > 1:\n most_popular_month, month_count = get_most_popular(... | [
"0.77551055",
"0.7629987",
"0.75815743",
"0.7372291",
"0.72286546",
"0.72216403",
"0.7211003",
"0.71911144",
"0.7164325",
"0.7160902",
"0.71318567",
"0.7131502",
"0.7122922",
"0.7122367",
"0.7115236",
"0.7114355",
"0.7113138",
"0.7109965",
"0.7090651",
"0.70847386",
"0.708443... | 0.7255359 | 4 |
Displays statistics on the most popular stations and trip. | def station_stats(df):
print('\nCalculating The Most Popular Stations and Trip...\n')
start_time = time.time()
# TO DO: display most commonly used start station
print('\nMost popular start station: {}'.format(df['Start Station'].mode()[0]))
# TO DO: display most commonly used end station
prin... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def station_stats(df):\n\n print('\\nCalculating The Most Popular Stations and Trip...\\n')\n start_time = time.time()\n\n # display most commonly used start station\n print(popular_start_station(df))\n\n # display most commonly used end station\n print(popular_end_station(df))\n\n # display m... | [
"0.7816157",
"0.7662524",
"0.7492024",
"0.7475423",
"0.74471235",
"0.7430301",
"0.74246186",
"0.741813",
"0.7400704",
"0.7387859",
"0.73857087",
"0.7365416",
"0.73599696",
"0.73571277",
"0.73555714",
"0.73525584",
"0.7351796",
"0.735084",
"0.7342505",
"0.734093",
"0.7337747",... | 0.7554042 | 2 |
Displays statistics on the total and average trip duration. | def trip_duration_stats(df):
print('\nCalculating Trip Duration...\n')
start_time = time.time()
# TO DO: display total travel time
trip_sum = df['Trip Duration'].sum()
minutes, seconds = divmod(trip_sum, 60)
hours, minutes = divmod(minutes, 60)
days, hours = divmod(hours, 24)
years, da... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def trip_duration_stats(data):\n print('\\nCalculating Trip Duration...\\n')\n start_time = time.time()\n # display total travel time\n total_trip_time= data['Trip Duration'].sum()\n print('The Total Travel Time is {} Hours'. format(total_trip_time/3600))\n # display mean travel time\n avg_tri... | [
"0.8143032",
"0.8024939",
"0.8004003",
"0.7949475",
"0.79372776",
"0.79307956",
"0.7926507",
"0.79149866",
"0.7914229",
"0.79077655",
"0.79054105",
"0.7900338",
"0.78913456",
"0.78892654",
"0.78863764",
"0.7884846",
"0.78839767",
"0.7882144",
"0.7873669",
"0.7868308",
"0.7866... | 0.7691605 | 70 |
Sets the Entity's id (Stage's nodeIndex) | def id(self, id=0):
# type: (int) -> Entity
self.type_def['id'] = id
return self | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def entity_id(self, entity_id: str):\n\n self._entity_id = entity_id",
"def entity_id(self, entity_id):\n\n self._entity_id = entity_id",
"def entity_id(self, entity_id):\n if entity_id is None:\n raise ValueError(\"Invalid value for `entity_id`, must not be `None`\")\n\n ... | [
"0.7288651",
"0.7261937",
"0.68000484",
"0.6687752",
"0.65441185",
"0.650544",
"0.6461501",
"0.64213777",
"0.64186966",
"0.63741297",
"0.6347914",
"0.6312209",
"0.630786",
"0.63020474",
"0.62571937",
"0.62302077",
"0.622943",
"0.62199575",
"0.6177491",
"0.6165765",
"0.6158151... | 0.660073 | 4 |
Check if the Entity is of a certain type | def is_type(self, ent_type):
# type: (str) -> bool
# its always an entity ...
if ent_type.lower() in ('entity', self.settings['_type'].lower()):
return True
else:
return False | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _is_valid_entity_type(self, entity_type):\n return entity_type in [\"artist\", \"song\", \"genre\"]",
"def _is_valid(self, value):\n\n # Entities have an istypeof method that can perform more sophisticated\n # type checking.\n if hasattr(self._type, \"istypeof\"):\n ret... | [
"0.7638851",
"0.7033444",
"0.6808084",
"0.6792856",
"0.6679623",
"0.6650414",
"0.6649699",
"0.6564971",
"0.6549901",
"0.6529419",
"0.6526937",
"0.64430064",
"0.6413656",
"0.6358948",
"0.6326068",
"0.629998",
"0.6291419",
"0.6276344",
"0.6261377",
"0.62416005",
"0.6210924",
... | 0.8143101 | 0 |
Move the Rectangle by modifying its corner object. | def move_rectangle(r,dx,dy):
r.corner.x=r.corner.x+dx
r.corner.y=r.corner.y+dy
turtle.setx(r.corner.x)
turtle.sety(r.corner.y)
for i in range(2):
turtle.fd(r.width)
turtle.lt(90)
turtle.fd(r.height)
turtle.lt(90)
return r | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def move(self, dx, dy):\n self.corner.x += dx\n self.corner.y += dy",
"def move(self, dx, dy):\n self.corner.x += dx\n self.corner.y += dy",
"def move(self, dx, dy):\n self.corner.x += dx\n self.corner.y += dy",
"def move(self, dx, dy):\r\n self.corner.x += dx... | [
"0.7000503",
"0.7000503",
"0.7000503",
"0.69938785",
"0.6982471",
"0.67373776",
"0.63404274",
"0.6298832",
"0.62947994",
"0.6282506",
"0.6233576",
"0.6215441",
"0.61811674",
"0.6096873",
"0.60852855",
"0.5990984",
"0.5989975",
"0.5957505",
"0.5948925",
"0.59286416",
"0.592864... | 0.63123775 | 7 |
Returns True if t1 is after t2; false otherwise. | def is_after(t1,t2):
return (t1.hour, t1.minute, t1.second) > (t2.hour, t2.minute, t2.second) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_after(self, other):\n if self.is_before(other) or self == other:\n return False\n else:\n return True",
"def is_after(self, other):\n if self.is_before(other) == False:\n if self != other:\n return True\n return False",
"def isA... | [
"0.75125057",
"0.7429796",
"0.73929745",
"0.72149795",
"0.72039163",
"0.7099517",
"0.66878116",
"0.655956",
"0.65366393",
"0.6506957",
"0.6470305",
"0.64262325",
"0.64262325",
"0.6406126",
"0.6331021",
"0.62891877",
"0.62535655",
"0.6244581",
"0.62373865",
"0.61819375",
"0.61... | 0.70913756 | 6 |
Adds seconds to a Time object. | def increment(time, seconds):
assert valid_time(time)
seconds += time_to_int(time)
return int_to_time(seconds) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def increment_seconds(self, seconds):\n return MyTime(0,0,self.to_seconds()+seconds)",
"def increment(time, seconds):\n assert valid_time(time)\n seconds += time.time_to_int()\n return int_to_time(seconds)",
"def advance_time_seconds(seconds):\r\n advance_time_delta(datetime.timedelta(0, sec... | [
"0.78307766",
"0.69903797",
"0.6803477",
"0.6756962",
"0.6666293",
"0.6649546",
"0.66336894",
"0.6583278",
"0.62150925",
"0.61799365",
"0.615658",
"0.61066055",
"0.60882944",
"0.60400695",
"0.6024801",
"0.6023055",
"0.5999886",
"0.5978862",
"0.59618837",
"0.5956492",
"0.59390... | 0.6927864 | 2 |
Adds seconds to a Time object. | def increment(time, seconds):
assert valid_time(time)
seconds += time.time_to_int()
return int_to_time(seconds) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def increment_seconds(self, seconds):\n return MyTime(0,0,self.to_seconds()+seconds)",
"def increment(time, seconds):\n assert valid_time(time)\n seconds += time_to_int(time)\n return int_to_time(seconds)",
"def advance_time_seconds(seconds):\r\n advance_time_delta(datetime.timedelta(0, seco... | [
"0.78307766",
"0.6927864",
"0.6803477",
"0.6756962",
"0.6666293",
"0.6649546",
"0.66336894",
"0.6583278",
"0.62150925",
"0.61799365",
"0.615658",
"0.61066055",
"0.60882944",
"0.60400695",
"0.6024801",
"0.6023055",
"0.5999886",
"0.5978862",
"0.59618837",
"0.5956492",
"0.593901... | 0.69903797 | 1 |
sets up window and all the widgets | def __init__(self):
EasyFrame.__init__(self, title="""Address Book""")
self.addLabel(text="First Name:", row=0, column=0, sticky="NSEW")
self.inputField1 = self.addTextField(text="", row=0, column=1, width=5, sticky="NSEW") # first name
self.addLabel(text="Last Name:", row=1, column=... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def setupWindow(self):\n\n\t\tself.main_menu_window = MenuFrame.MainMenuFrame(self.uiCoordinator)\n\t\tself.menu_window = self.main_menu_window._mf\n\t\tself.score_window = self.main_menu_window._hf\n\t\tself.instructions_window = self.main_menu_window._if\n\t\tself.menu_window.playButton.focus_set()",
"def init... | [
"0.7787372",
"0.77320147",
"0.76805985",
"0.76545197",
"0.7615445",
"0.75964576",
"0.7558102",
"0.7490224",
"0.74126697",
"0.74049395",
"0.73966575",
"0.7384085",
"0.73416513",
"0.73398507",
"0.7267249",
"0.7218066",
"0.71866405",
"0.7176432",
"0.7110608",
"0.710039",
"0.7099... | 0.0 | -1 |
Build a string representation of the HyperparameterConfig. | def __str__(self) -> str:
return '\n'.join([f'{hp}: {self.hyperparams[hp]}'
for hp in self.hyperparams]) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __str__(self):\n config_str = 'Configurations\\n'\n config_str += pprint.pformat(self.__dict__)\n return config_str",
"def __str__():\n return str(_config)",
"def __repr__(self) -> str:\n return json.dumps(self._config)",
"def str(self):\n\n list_of_entries = ['{0} n... | [
"0.71508455",
"0.6864315",
"0.680465",
"0.67813075",
"0.6348431",
"0.6345511",
"0.63154775",
"0.6312308",
"0.6279822",
"0.6271738",
"0.62691575",
"0.6199463",
"0.6167693",
"0.61509144",
"0.6090665",
"0.60872066",
"0.60872066",
"0.60356134",
"0.59921837",
"0.5974515",
"0.59728... | 0.7095357 | 1 |
Return the default dropdown size. | def size(self):
return dict(width=self.w, height=self.h) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_size():\n opt = ['regular', 'small', 'large']\n inp = option_menu(opt, 'Widget size:')\n OPTIONS['size'] = opt[inp]\n add_to_collected('size', opt[inp])\n return",
"def _get_default_size(self):\n default_width = default_height = ''\n if self.selector_declarations:\n ... | [
"0.73972404",
"0.64381707",
"0.6395496",
"0.6288401",
"0.62859637",
"0.62736166",
"0.6250367",
"0.6247634",
"0.61684835",
"0.61266255",
"0.61266255",
"0.61266255",
"0.6115029",
"0.6099338",
"0.60664904",
"0.59997344",
"0.5957957",
"0.5936947",
"0.59262776",
"0.5925267",
"0.59... | 0.0 | -1 |
Open a browser tab showing single | def _open_browser(self, single_doc_html):
url = os.path.join("file://", DOC_PATH, "build", "html", single_doc_html)
webbrowser.open(url, new=2) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def open_tab(self, url):\n orig_handles = self.driver.window_handles\n\n if mozinfo.os == \"mac\":\n self.driver.find_element_by_tag_name(\n 'body').send_keys(Keys.COMMAND + \"t\")\n else:\n self.driver.find_element_by_tag_name(\n 'body').sen... | [
"0.7756468",
"0.77226114",
"0.7556416",
"0.75134903",
"0.7471569",
"0.74635446",
"0.7443906",
"0.72972023",
"0.7287823",
"0.72756606",
"0.7198614",
"0.7158972",
"0.7094349",
"0.7075039",
"0.7044656",
"0.7039502",
"0.70210725",
"0.69317484",
"0.69229186",
"0.6906482",
"0.68989... | 0.65932244 | 38 |
Initialize remote value of KNX DPT 1 representing a climate operation mode. | def __init__(
self,
xknx: XKNX,
group_address: GroupAddressesType | None = None,
group_address_state: GroupAddressesType | None = None,
sync_state: bool | int | float | str = True,
device_name: str | None = None,
feature_name: str = "Climate mode binary",
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(\n self,\n xknx: XKNX,\n group_address: GroupAddressesType | None = None,\n group_address_state: GroupAddressesType | None = None,\n sync_state: bool | int | float | str = True,\n device_name: str | None = None,\n feature_name: str = \"Climate mode\",\n... | [
"0.5819061",
"0.56439674",
"0.53057885",
"0.53057885",
"0.53057885",
"0.5236872",
"0.5200744",
"0.50949395",
"0.5051989",
"0.504443",
"0.50327706",
"0.50267476",
"0.50209856",
"0.49953154",
"0.48788038",
"0.4843685",
"0.4819835",
"0.4803406",
"0.47888547",
"0.47865847",
"0.47... | 0.50607747 | 8 |
Creates a hidden markov model object with M hidden states. | def __init__(self, M, K):
self.M = M
self.K = K | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def to_markov_model(self):\n moral_graph = self.moralize()\n mm = MarkovModel(moral_graph.edges())\n mm.add_nodes_from(moral_graph.nodes())\n mm.add_factors(*[cpd.to_factor() for cpd in self.cpds])\n\n return mm",
"def init_hidden(self):\n # TODO ========================... | [
"0.63076204",
"0.62111276",
"0.6170079",
"0.60326874",
"0.5970324",
"0.59700006",
"0.58591807",
"0.5822325",
"0.5798316",
"0.577887",
"0.56757784",
"0.56261045",
"0.55624646",
"0.5561263",
"0.5559619",
"0.5559619",
"0.55463094",
"0.553127",
"0.55100214",
"0.55100214",
"0.5502... | 0.0 | -1 |
Convert camelCase string to snake_case. | def _camel_to_snake(name):
s1 = re.sub("(.)([A-Z][a-z]+)", r"\1_\2", name)
return re.sub("([a-z0-9])([A-Z])", r"\1_\2", s1).lower() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def convert_to_snake_case(camel_case_string):\n s1 = re.sub('(.)([A-Z][a-z]+)', r'\\1_\\2', camel_case_string)\n s2 = re.sub('([a-z0-9])([A-Z])', r'\\1_\\2', s1).lower()\n return s2.replace('__', '_')",
"def to_snake_case(str):\n s1 = re.sub('(.)([A-Z][a-z]+)', r'\\1_\\2', str)\n s2 = ... | [
"0.83922935",
"0.8382237",
"0.8352884",
"0.82065755",
"0.8192346",
"0.8134536",
"0.8100583",
"0.79239666",
"0.7897534",
"0.7875393",
"0.78665465",
"0.7827113",
"0.7769993",
"0.7729836",
"0.76905155",
"0.7667429",
"0.7630975",
"0.76263887",
"0.7615211",
"0.7604704",
"0.7592038... | 0.75884104 | 21 |
Force missing values to appear at the beginning of the DataFrame instead of the end. | def _adjust_indices(left_df, right_df):
index_diff = left_df.shape[0] - right_df.shape[0]
if index_diff > 0:
# right_df is shorter
empty_df = pd.DataFrame(
np.full((np.abs(index_diff), right_df.shape[1]), np.nan),
columns=right_df.columns,
)
right_df = pd.... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def DealWithMissingValues(data_set: pd.DataFrame):\n data_set.fillna(method=\"pad\", inplace=True)",
"def fix_data(self, df):\n return df.dropna(axis='columns', how='all').fillna(0.0)",
"def fill_forward(df):\n df = df.fillna(method='ffill')\n df = df.fillna(method='bfill').fillna(0)\n retur... | [
"0.70773196",
"0.69040954",
"0.6807456",
"0.66524595",
"0.658136",
"0.646944",
"0.64566696",
"0.64035106",
"0.64019877",
"0.6401032",
"0.6306065",
"0.6257852",
"0.6256947",
"0.6251326",
"0.6223952",
"0.61246413",
"0.6088262",
"0.6042709",
"0.6035861",
"0.6017882",
"0.59797156... | 0.0 | -1 |
Returns a boolean of whether the raw_password was correct. Handles encryption formats behind the scenes. | def check_password(raw_password, enc_password):
algo, salt, hsh = enc_password.split('$')
return hsh == get_hexdigest(algo, salt, raw_password) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def check_password(self, raw_password):\n return check_password(raw_password, self.password)",
"def password_is_correct(self, password):\n return Bcrypt().check_password_hash(self.password, password)",
"def validate_password(self, password):\n return self._password == encrypt_password(password... | [
"0.7856368",
"0.73722756",
"0.7331199",
"0.72308093",
"0.71682143",
"0.7166637",
"0.709903",
"0.7083616",
"0.7061117",
"0.70148677",
"0.69298446",
"0.69238937",
"0.6904415",
"0.69039166",
"0.6873755",
"0.6868197",
"0.6854907",
"0.6842843",
"0.68418324",
"0.68413496",
"0.68151... | 0.76191616 | 1 |
The ID of the CR Instance. | def instance_id(self) -> pulumi.Input[str]:
return pulumi.get(self, "instance_id") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def instance_id(self) -> str:\n return pulumi.get(self, \"instance_id\")",
"def ID(self):\n return self._id",
"def getID(self):\n return self.__id",
"def get_id(self):\n\n\t\treturn self.__id",
"def id(self):\n\t\treturn self.__id",
"def instance_id(self) -> pulumi.Output[int]:\n ... | [
"0.75583506",
"0.73895645",
"0.7377989",
"0.735136",
"0.7331318",
"0.7329716",
"0.7329716",
"0.7329716",
"0.7316119",
"0.72769076",
"0.72735715",
"0.72735715",
"0.7270205",
"0.7245078",
"0.7245078",
"0.7245078",
"0.7245078",
"0.7245078",
"0.7245078",
"0.7242256",
"0.7241275",... | 0.0 | -1 |
The ID of the CR Instance. | def instance_id(self) -> Optional[pulumi.Input[str]]:
return pulumi.get(self, "instance_id") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def instance_id(self) -> str:\n return pulumi.get(self, \"instance_id\")",
"def ID(self):\n return self._id",
"def getID(self):\n return self.__id",
"def get_id(self):\n\n\t\treturn self.__id",
"def id(self):\n\t\treturn self.__id",
"def instance_id(self) -> pulumi.Output[int]:\n ... | [
"0.75583506",
"0.73895645",
"0.7377989",
"0.735136",
"0.7331318",
"0.7329716",
"0.7329716",
"0.7329716",
"0.7316119",
"0.72769076",
"0.72735715",
"0.72735715",
"0.7270205",
"0.7245078",
"0.7245078",
"0.7245078",
"0.7245078",
"0.7245078",
"0.7245078",
"0.7242256",
"0.7241275",... | 0.0 | -1 |
Get an existing EndpointAclPolicy 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,
description: Optional[pulumi.Input[str]] = None,
endpoint_type: Optional[pulumi.Input[str]] = None,
entry: Optional[pulumi.Input[str]] = None,
instanc... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get(resource_name: str,\n id: pulumi.Input[str],\n opts: Optional[pulumi.ResourceOptions] = None,\n custom_block_response_body: Optional[pulumi.Input[str]] = None,\n custom_block_response_status_code: Optional[pulumi.Input[int]] = None,\n custom_rules: Opt... | [
"0.6320034",
"0.5855849",
"0.581994",
"0.57380086",
"0.5594384",
"0.5574973",
"0.5525668",
"0.5427185",
"0.5421561",
"0.5316694",
"0.5280498",
"0.524068",
"0.51482886",
"0.5139898",
"0.50779575",
"0.506987",
"0.5061437",
"0.5019143",
"0.49754748",
"0.49381846",
"0.4920512",
... | 0.7297297 | 0 |
The ID of the CR Instance. | def instance_id(self) -> pulumi.Output[str]:
return pulumi.get(self, "instance_id") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def instance_id(self) -> str:\n return pulumi.get(self, \"instance_id\")",
"def ID(self):\n return self._id",
"def getID(self):\n return self.__id",
"def get_id(self):\n\n\t\treturn self.__id",
"def id(self):\n\t\treturn self.__id",
"def instance_id(self) -> pulumi.Output[int]:\n ... | [
"0.75583506",
"0.73895645",
"0.7377989",
"0.735136",
"0.7331318",
"0.7329716",
"0.7329716",
"0.7329716",
"0.7316119",
"0.72769076",
"0.72735715",
"0.72735715",
"0.7270205",
"0.7242256",
"0.7241275",
"0.72083396",
"0.71998537",
"0.71692824",
"0.71556026",
"0.7155421",
"0.71479... | 0.7245078 | 18 |
The set of arguments for constructing a CustomRoutingEndpointTrafficPolicy resource. | def __init__(__self__, *,
address: pulumi.Input[str],
endpoint_id: pulumi.Input[str],
port_ranges: Optional[pulumi.Input[Sequence[pulumi.Input['CustomRoutingEndpointTrafficPolicyPortRangeArgs']]]] = None):
pulumi.set(__self__, "address", address)
pulumi... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(__self__,\n resource_name: str,\n args: CustomRoutingEndpointTrafficPolicyArgs,\n opts: Optional[pulumi.ResourceOptions] = None):\n ...",
"def __init__(__self__,\n resource_name: str,\n opts: Optional[pulumi.Resou... | [
"0.782005",
"0.72253287",
"0.6508231",
"0.6418846",
"0.60830736",
"0.60157984",
"0.59518415",
"0.5826727",
"0.5800157",
"0.565689",
"0.5629276",
"0.56056476",
"0.5523971",
"0.5518003",
"0.5461124",
"0.54498684",
"0.5429909",
"0.54204965",
"0.54161054",
"0.5411822",
"0.5406165... | 0.65651757 | 2 |
The ID of the GA instance. | def accelerator_id(self) -> Optional[pulumi.Input[str]]:
return pulumi.get(self, "accelerator_id") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def instance_id(self) -> str:\n return pulumi.get(self, \"instance_id\")",
"def getID(self):\n return self.__id",
"def getid(self):\n return self.__id",
"def get_id(self):\n return self.__id",
"def get_id(self):\n return self.__id",
"def get_google_id (self):\n r... | [
"0.74904877",
"0.7415844",
"0.73839885",
"0.7316879",
"0.7316879",
"0.73164403",
"0.73024017",
"0.729295",
"0.7273794",
"0.7242831",
"0.723836",
"0.72374445",
"0.72374445",
"0.72374445",
"0.72374445",
"0.72258496",
"0.72258496",
"0.72258496",
"0.72258496",
"0.72258496",
"0.72... | 0.0 | -1 |
The ID of the endpoint group. | def endpoint_group_id(self) -> Optional[pulumi.Input[str]]:
return pulumi.get(self, "endpoint_group_id") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def endpoint_group_id(self) -> pulumi.Output[str]:\n return pulumi.get(self, \"endpoint_group_id\")",
"def id(self):\n return self._group",
"def group_id(self):\n return self._id",
"def group_id(self) -> str:\n return pulumi.get(self, \"group_id\")",
"def group_id(self) -> str:\... | [
"0.87171066",
"0.8056731",
"0.8042457",
"0.8007308",
"0.8007308",
"0.7753101",
"0.7753101",
"0.7753101",
"0.7722578",
"0.7675036",
"0.7661746",
"0.7552041",
"0.7439207",
"0.73402745",
"0.73263025",
"0.7250136",
"0.7250136",
"0.7250136",
"0.72194743",
"0.72194743",
"0.72194743... | 0.83692557 | 1 |
The ID of the listener. | def listener_id(self) -> Optional[pulumi.Input[str]]:
return pulumi.get(self, "listener_id") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def listener_id(self) -> str:\n return pulumi.get(self, \"listener_id\")",
"def listener_id(self) -> str:\n return pulumi.get(self, \"listener_id\")",
"def listener_id(self) -> str:\n return pulumi.get(self, \"listener_id\")",
"def listener_id(self) -> pulumi.Output[str]:\n return... | [
"0.9106911",
"0.9106911",
"0.9106911",
"0.879295",
"0.879295",
"0.8778011",
"0.80371755",
"0.7770768",
"0.76732135",
"0.7539775",
"0.73272634",
"0.72096616",
"0.69974947",
"0.6852207",
"0.6827058",
"0.6815371",
"0.68066704",
"0.68060124",
"0.6797553",
"0.6754734",
"0.675169",... | 0.8458395 | 7 |
The status of the Custom Routing Endpoint Traffic Policy. | def status(self) -> Optional[pulumi.Input[str]]:
return pulumi.get(self, "status") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def status(self):\n if \"status\" in self._prop_dict:\n if isinstance(self._prop_dict[\"status\"], OneDriveObjectBase):\n return self._prop_dict[\"status\"]\n else :\n self._prop_dict[\"status\"] = AutomaticRepliesStatus(self._prop_dict[\"status\"])\n ... | [
"0.6547827",
"0.65099645",
"0.6461354",
"0.6461354",
"0.6461354",
"0.63963133",
"0.6373368",
"0.63640386",
"0.6340081",
"0.6331104",
"0.631457",
"0.6312065",
"0.6310273",
"0.6310256",
"0.6305132",
"0.62586564",
"0.62479603",
"0.62479603",
"0.62479603",
"0.62479603",
"0.624796... | 0.0 | -1 |
Get an existing CustomRoutingEndpointTrafficPolicy 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,
accelerator_id: Optional[pulumi.Input[str]] = None,
address: Optional[pulumi.Input[str]] = None,
custom_routing_endpoint_traffic_policy_id: Optional[pulumi.Input[... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get(resource_name: str,\n id: pulumi.Input[str],\n opts: Optional[pulumi.ResourceOptions] = None,\n inter_region_traffic_qos_policy_description: Optional[pulumi.Input[str]] = None,\n inter_region_traffic_qos_policy_name: Optional[pulumi.Input[str]] = None,\n ... | [
"0.60383314",
"0.5898164",
"0.54942995",
"0.5465016",
"0.52798486",
"0.52389556",
"0.51301444",
"0.5001591",
"0.5001516",
"0.4921867",
"0.48477647",
"0.48472804",
"0.48276007",
"0.48225462",
"0.47889128",
"0.47813886",
"0.47464636",
"0.4738759",
"0.47213665",
"0.46819428",
"0... | 0.76101273 | 0 |
The ID of the GA instance. | def accelerator_id(self) -> pulumi.Output[str]:
return pulumi.get(self, "accelerator_id") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def instance_id(self) -> str:\n return pulumi.get(self, \"instance_id\")",
"def getID(self):\n return self.__id",
"def getid(self):\n return self.__id",
"def get_id(self):\n return self.__id",
"def get_id(self):\n return self.__id",
"def get_google_id (self):\n r... | [
"0.74904877",
"0.7415844",
"0.73839885",
"0.7316879",
"0.7316879",
"0.73164403",
"0.73024017",
"0.729295",
"0.7273794",
"0.7242831",
"0.723836",
"0.72374445",
"0.72374445",
"0.72374445",
"0.72374445",
"0.72258496",
"0.72258496",
"0.72258496",
"0.72258496",
"0.72258496",
"0.72... | 0.0 | -1 |
The ID of the endpoint group. | def endpoint_group_id(self) -> pulumi.Output[str]:
return pulumi.get(self, "endpoint_group_id") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def endpoint_group_id(self) -> Optional[pulumi.Input[str]]:\n return pulumi.get(self, \"endpoint_group_id\")",
"def id(self):\n return self._group",
"def group_id(self):\n return self._id",
"def group_id(self) -> str:\n return pulumi.get(self, \"group_id\")",
"def group_id(self)... | [
"0.83692557",
"0.8056731",
"0.8042457",
"0.8007308",
"0.8007308",
"0.7753101",
"0.7753101",
"0.7753101",
"0.7722578",
"0.7675036",
"0.7661746",
"0.7552041",
"0.7439207",
"0.73402745",
"0.73263025",
"0.7250136",
"0.7250136",
"0.7250136",
"0.72194743",
"0.72194743",
"0.72194743... | 0.87171066 | 0 |
The ID of the listener. | def listener_id(self) -> pulumi.Output[str]:
return pulumi.get(self, "listener_id") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def listener_id(self) -> str:\n return pulumi.get(self, \"listener_id\")",
"def listener_id(self) -> str:\n return pulumi.get(self, \"listener_id\")",
"def listener_id(self) -> str:\n return pulumi.get(self, \"listener_id\")",
"def listener_id(self) -> pulumi.Input[str]:\n return ... | [
"0.9106911",
"0.9106911",
"0.9106911",
"0.8778011",
"0.8458395",
"0.8458395",
"0.80371755",
"0.7770768",
"0.76732135",
"0.7539775",
"0.73272634",
"0.72096616",
"0.69974947",
"0.6852207",
"0.6827058",
"0.6815371",
"0.68066704",
"0.68060124",
"0.6797553",
"0.6754734",
"0.675169... | 0.879295 | 4 |
The status of the Custom Routing Endpoint Traffic Policy. | def status(self) -> pulumi.Output[str]:
return pulumi.get(self, "status") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def status(self):\n if \"status\" in self._prop_dict:\n if isinstance(self._prop_dict[\"status\"], OneDriveObjectBase):\n return self._prop_dict[\"status\"]\n else :\n self._prop_dict[\"status\"] = AutomaticRepliesStatus(self._prop_dict[\"status\"])\n ... | [
"0.6547656",
"0.65101266",
"0.64596957",
"0.64596957",
"0.64596957",
"0.63952667",
"0.6371959",
"0.6362727",
"0.633881",
"0.63300335",
"0.63138664",
"0.63115156",
"0.6309228",
"0.6309074",
"0.6304812",
"0.6258032",
"0.62463796",
"0.62463796",
"0.62463796",
"0.62463796",
"0.62... | 0.0 | -1 |
Verify Deleter component behavior when run as a script. Test to make sure running the Deleter as a script does the setup work that we expect and then launches the deleter service. | async def test_script_main(config, mocker, monkeypatch):
for key in config.keys():
monkeypatch.setenv(key, config[key])
mock_event_loop = mocker.patch("asyncio.get_event_loop")
mock_root_logger = mocker.patch("logging.getLogger")
mock_status_loop = mocker.patch("lta.deleter.status_loop")
moc... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"async def test_deleter_run(config, mocker):\n logger_mock = mocker.MagicMock()\n p = Deleter(config, logger_mock)\n p._do_work = AsyncMock()\n await p.run()\n p._do_work.assert_called()",
"def Deletetest(self):\n # Test delete()\n result = self.runner.invoke(\n yoda.cli,\n... | [
"0.6265655",
"0.6236453",
"0.5997123",
"0.59468085",
"0.5899435",
"0.56390345",
"0.56278884",
"0.55946267",
"0.558757",
"0.5585469",
"0.55731493",
"0.5550661",
"0.5549767",
"0.5512597",
"0.5453055",
"0.54352415",
"0.54200995",
"0.53758013",
"0.534663",
"0.5342097",
"0.5317777... | 0.0 | -1 |
Test that _delete_bundle attempts to delete a Bundle. | async def test_deleter_delete_bundle(config, mocker):
logger_mock = mocker.MagicMock()
lta_rc_mock = mocker.patch("rest_tools.client.RestClient", new_callable=AsyncMock)
remove_mock = mocker.patch("os.remove", new_callable=MagicMock)
p = Deleter(config, logger_mock)
await p._delete_bundle(lta_rc_moc... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_delete_software_asset_bundle(self):\n pass",
"async def test_deleter_delete_bundle_raises(config, mocker):\n logger_mock = mocker.MagicMock()\n lta_rc_mock = mocker.patch(\"rest_tools.client.RestClient.request\", new_callable=AsyncMock)\n lta_rc_mock.return_value = {\n \"bundle\":... | [
"0.7735599",
"0.6880295",
"0.6785166",
"0.66929287",
"0.66807514",
"0.6627249",
"0.6568472",
"0.6557792",
"0.65478677",
"0.6508988",
"0.65059435",
"0.63601476",
"0.6313739",
"0.6302595",
"0.62975156",
"0.62945664",
"0.6249865",
"0.6171922",
"0.61523885",
"0.6101641",
"0.61007... | 0.76512027 | 1 |
Round number of repeats based on depth multiplier. | def round_repeats(repeats, depth_coefficient):
return int(math.ceil(depth_coefficient * repeats)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _round_repeats(self, repeats):\n return int(math.ceil(self.depth_coefficient * repeats))",
"def round_repeats(repeats):\n return int(math.ceil(depth_coefficient * repeats))",
"def _round_repeats(self, repeats, depth_coefficient):\n\n if not depth_coefficient:\n return repeats\n\n retur... | [
"0.8876546",
"0.87485105",
"0.86348873",
"0.85847086",
"0.8439529",
"0.83897537",
"0.83897537",
"0.83897537",
"0.8308418",
"0.77939695",
"0.6887175",
"0.6887175",
"0.6861657",
"0.6199542",
"0.6199542",
"0.6029677",
"0.5980465",
"0.59490407",
"0.59474444",
"0.5848384",
"0.5833... | 0.8589512 | 3 |
Get json from local file. | def get_json(file):
with open(file, 'r', encoding='utf8')as f:
ele_json = json.load(f)
return ele_json | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_file(file):\n with open(file) as data_file:\n return json.load(data_file)",
"def get_json(filename) :\n result = json.load(open(filename,'r'))\n return result",
"def openFile(self, path):\n with open(path) as f:\n return json.load(f)",
"def json_from_file(name):\n ... | [
"0.82337254",
"0.8208683",
"0.7920694",
"0.783677",
"0.7824961",
"0.77196395",
"0.7690869",
"0.76279944",
"0.7616185",
"0.76052725",
"0.7528612",
"0.75224805",
"0.75095755",
"0.7508645",
"0.7495749",
"0.74929076",
"0.749044",
"0.745639",
"0.7452924",
"0.74390274",
"0.7410339"... | 0.7351579 | 27 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.