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 |
|---|---|---|---|---|---|---|
Return the user with that ID, or `None` if not found. Include avatar URL if requested. | def find_user(
user_id: UserID,
*,
include_avatar: bool = False,
include_orga_flag_for_party_id: Optional[PartyID] = None,
) -> Optional[User]:
row = _get_user_query(include_avatar, include_orga_flag_for_party_id) \
.filter(DbUser.id == user_id) \
.one_or_none()
if row is None:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_user(id=None, name=None):\n found_id = get_user_id(id, name)\n if not found_id:\n return\n response = utils.checked_api_call(users_api, 'get_specific', id=found_id)\n if response:\n return response.content",
"def get_user_or_None(id):\n try:\n u = UserProfile.objects.g... | [
"0.7799512",
"0.7648279",
"0.75770277",
"0.7541365",
"0.7477213",
"0.74497026",
"0.7422845",
"0.7361686",
"0.731448",
"0.7289402",
"0.7284911",
"0.7274215",
"0.726804",
"0.72654545",
"0.7261413",
"0.72446686",
"0.72400135",
"0.7222873",
"0.72052413",
"0.71940845",
"0.7190881"... | 0.6536671 | 98 |
Return the user with that ID, or raise an exception. Include avatar URL if requested. | def get_user(
user_id: UserID,
*,
include_avatar: bool = False,
include_orga_flag_for_party_id: Optional[PartyID] = None,
) -> User:
user = find_user(
user_id,
include_avatar=include_avatar,
include_orga_flag_for_party_id=include_orga_flag_for_party_id,
)
if user is ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get(self, id):\n\t\ttry:\n\t\t\tflask_app.logger.debug('We are getting the user: %d', id)\n\t\t\treturn user_service.get(id)\n\t\texcept AssertionError as e:\n\t\t\tuser_space.abort(400, e.args[0], status = \"Could not get user\", statusCode = \"400\")\n\t\texcept Exception as e:\n\t\t\tuser_space.abort(500, e... | [
"0.7649698",
"0.7637177",
"0.7629321",
"0.74042994",
"0.73957103",
"0.73920524",
"0.73900175",
"0.7366061",
"0.73326474",
"0.7317",
"0.7316907",
"0.73126906",
"0.72443336",
"0.7235629",
"0.72247386",
"0.72189647",
"0.72084165",
"0.7188751",
"0.7173942",
"0.7166385",
"0.715525... | 0.68730485 | 47 |
Return the user with that ID, or raise an exception. | def get_db_user(user_id: UserID) -> Optional[DbUser]:
user = DbUser.query.get(user_id)
if user is None:
raise ValueError(f"Unknown user ID '{user_id}'")
return user | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_user_by_id(self, id):\n\t\treturn self.users.get(id)",
"def find_user_by_id(id: str) -> User:\n\n # Find the id user in the database, else return None\n return User.query.get(int(id))",
"def _get_user_by_id(self, _id):\n user_resp = self._db.Users(database_pb2.UsersRequest(\n ... | [
"0.84535867",
"0.81622756",
"0.8131504",
"0.81238586",
"0.80891263",
"0.80835104",
"0.8069285",
"0.8063601",
"0.803385",
"0.798673",
"0.79859906",
"0.795831",
"0.79239744",
"0.7908096",
"0.78933626",
"0.7867427",
"0.78573",
"0.7826341",
"0.7810261",
"0.7808436",
"0.78061444",... | 0.0 | -1 |
Return the user's email address. | def get_email_address(user_id: UserID) -> str:
email_address = db.session \
.query(DbUser.email_address) \
.filter_by(id=user_id) \
.scalar()
if email_address is None:
raise ValueError(
f"Unknown user ID '{user_id}' or user has no email address"
)
return... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_user_email(self):\n member = self.get_user()\n if member:\n return member.getProperty('email')",
"def user_email(self) -> pulumi.Output[str]:\n return pulumi.get(self, \"user_email\")",
"def _get_user_email_address(self, request):\n return request.session.get(SESS... | [
"0.85894924",
"0.8424628",
"0.83676165",
"0.82079905",
"0.8151962",
"0.80923784",
"0.80713016",
"0.80657643",
"0.8059166",
"0.7992739",
"0.7969534",
"0.7969534",
"0.7969534",
"0.79481673",
"0.78864706",
"0.78141636",
"0.7806867",
"0.77864665",
"0.77750653",
"0.77558327",
"0.7... | 0.72668135 | 53 |
Normalize each column of x to have mean 0 and variance 1. Note that a better way to normalize the data is to whiten the data (decorrelate dimensions). This can be done using PCA. | def normalize_data(x):
mvec = x.mean(0)
stdvec = x.std(axis=0)
return (x - mvec)/stdvec | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def normalize_features(X):\n std = X.std(axis=0)\n std = np.where(std == 0, 1, std) # to avoid division by zero\n x_normed = (X - X.mean(axis=0)) / std\n return x_normed",
"def normalise(x):\n x = np.copy(x)\n n_cols = x.shape[1]\n for col_index in range(n_cols):\n col = x[:, col_ind... | [
"0.75268704",
"0.74909145",
"0.7486053",
"0.7444858",
"0.72306186",
"0.7214432",
"0.7101024",
"0.7077574",
"0.7069093",
"0.7014842",
"0.6987489",
"0.6890953",
"0.68350863",
"0.6826598",
"0.679",
"0.678056",
"0.6778833",
"0.67287344",
"0.6728025",
"0.67234445",
"0.6721256",
... | 0.7678143 | 1 |
Init the weights in the last layer. The rest is initialized in the residual block. From the DeepGLO paper. | def init_weights(self, leveledinit: bool, kernel_size: int, bias: bool) -> None:
if leveledinit:
nn.init.normal_(self.conv1d.weight, std=1e-3)
nn.init.normal_(self.conv1d.bias, std=1e-6)
with torch.no_grad():
self.conv1d.weight[:, 0, :] += 1.0 / kernel_size
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def init_weights(self, init_w=3e-3):\n self.l3.weight.data.uniform_(-init_w, init_w)\n self.l3.bias.data.uniform_(-init_w, init_w)",
"def init_weights(self, init_w=3e-3):\n self.l3.weight.data.uniform_(-init_w, init_w)\n self.l3.bias.data.uniform_(-init_w, init_w)",
"def init_weight... | [
"0.7390074",
"0.7390074",
"0.73366755",
"0.71077305",
"0.7067749",
"0.70544165",
"0.70408887",
"0.6994967",
"0.6943271",
"0.69279855",
"0.6927209",
"0.69217557",
"0.691138",
"0.691138",
"0.691138",
"0.68567216",
"0.685281",
"0.68339044",
"0.6831208",
"0.6824295",
"0.68131536"... | 0.63405514 | 64 |
Extract and return the value of the GET URI from a request header. If the request is not a GET, or if the URI is incomplete, or detectably bogus, return None. | def get_request_uri(header):
match = re.match('^GET /([^\s]*) HTTP/1.[10]\s*$', header, re.MULTILINE)
if match:
return match.group(1)
else:
return None | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_request_param(request: web.Request, name: str, error_if_missing: bool = True) -> Optional[str]:\n if name not in request.rel_url.query:\n if error_if_missing:\n raise errors.NotFound()\n else:\n return None\n ret = request.rel_url.query[name]\n return ret",
"d... | [
"0.61838496",
"0.614564",
"0.6111135",
"0.60912305",
"0.6037766",
"0.5954106",
"0.57603997",
"0.568407",
"0.54877657",
"0.54823667",
"0.54815346",
"0.5443626",
"0.5406824",
"0.5371707",
"0.53380084",
"0.5323407",
"0.5294941",
"0.52890795",
"0.5249987",
"0.5240791",
"0.5235395... | 0.73445004 | 0 |
Check that `lower <= value <= upper` | def assertWithin(self, value, lower, upper):
if value < lower:
self.fail('%s is below lower bound %s' (value, lower))
if value > upper:
self.fail('%s is above upper bound %s' (value, upper)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_if_between(a, b, test_val):\n if a < b:\n return a <= test_val <= b\n else:\n return b <= test_val <= a",
"def _in_interval(value, low, up):\n if low <= value <= up:\n return True\n else:\n return False",
"def is_in_interval(self, low, high, value):\n ret... | [
"0.7900837",
"0.78698826",
"0.77076286",
"0.74988055",
"0.74937344",
"0.73274624",
"0.7310709",
"0.7294496",
"0.7285649",
"0.72668505",
"0.726534",
"0.7221103",
"0.71750927",
"0.7174974",
"0.71424824",
"0.71322674",
"0.711943",
"0.7093923",
"0.70729893",
"0.7039776",
"0.69578... | 0.79987353 | 0 |
Check that material found at `coords=(x, y)` matchs with `expected_material_id`. `expected_material_id` may be None, if the default material is expected at this coordinate. `altim` parameter should be an instance of `AltimetryMesh`. | def check_material_at(self, altim, coords, expected_material_id=None):
# Compute face handle (or vertex) corresponding to coordinates.
fh, vh_or_i = altim.mesh.locate_point(coords)
if expected_material_id is None:
self.assertIsNotNone(altim.material_by_face[fh])
else:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def validateMaterial(material, adjust=False):\n errors = []\n\n if not material:\n errors.append(ValidateMessage(\"No material defined.\", 'WARNING', material, None, {}))\n return errors, material\n\n if isinstance(material, bpy.types.Object):\n # there are always 18 slots, regardless... | [
"0.5699135",
"0.5100598",
"0.50268036",
"0.48565322",
"0.4845752",
"0.48147833",
"0.48020452",
"0.47647005",
"0.47591463",
"0.4758695",
"0.46806845",
"0.4677427",
"0.46002334",
"0.45815808",
"0.4574506",
"0.45561308",
"0.4538859",
"0.45222208",
"0.45155808",
"0.45046312",
"0.... | 0.8237749 | 0 |
Read an image into the given format. Will apply rotation and flipping if the image has such exif information. | def read_image(filepath, format=None):
image = Image.open(filepath)
# capture and ignore this bug:
# https://github.com/python-pillow/Pillow/issues/3973
try:
image = ImageOps.exif_transpose(image)
except Exception:
pass
if format is not None:
# PIL only supports RGB, so... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def read_image(path, file_format='nii.gz'):\n path = path + '.' + file_format\n if file_format == 'npy':\n image = np.load(path)\n elif file_format == 'npz':\n image = np.load(path)['arr_0']\n elif file_format in ('png', 'jpg'):\n image = np.array(imageio.imread(path))\n elif fi... | [
"0.7002911",
"0.6584774",
"0.6555035",
"0.6539315",
"0.65084904",
"0.64768773",
"0.64551926",
"0.64340216",
"0.6294529",
"0.6198295",
"0.61581403",
"0.6149602",
"0.61405903",
"0.61280406",
"0.6096074",
"0.60592866",
"0.60480714",
"0.60426885",
"0.6033629",
"0.60269403",
"0.60... | 0.75618047 | 0 |
Creating a dataframe used for storing results. | def _make_results_dataframe(self):
LOG.debug("Creating Results Dataframes.")
results_df = tfs.TfsDataFrame(index=self.twiss_df.index)
results_df["S"] = self.twiss_df["S"]
return results_df | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def data_frame_creator(self):\n\n return pd.DataFrame()",
"def dataframe(self):\n if not self.all_records:\n print('No rows cached.')\n return\n dict_list = [row.as_dict() for row in self.all_records]\n columns = self.all_records[0].keys\n dataframe = pd.D... | [
"0.7817429",
"0.765577",
"0.759745",
"0.75717944",
"0.7421327",
"0.7391248",
"0.73737854",
"0.73429817",
"0.7276947",
"0.72484004",
"0.72300065",
"0.7227263",
"0.72072387",
"0.7191447",
"0.7191447",
"0.7191447",
"0.7191447",
"0.7191447",
"0.7179589",
"0.71662956",
"0.716056",... | 0.7931769 | 0 |
Calculates the chromatic term which is common to all chromatic equations | def _calc_chromatic_term(self):
LOG.debug("Calculating Chromatic Term.")
self._check_k_columns(["K1L", "K2L", "K2SL"])
res = self._results_df
tw = self.twiss_df
with timeit(lambda t: LOG.debug(" Time needed: {:f}".format(t))):
mask = (tw['K1L'] != 0) | (tw['K2L'] !=... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def calc_chromatic_coupling(self):\n raise NotImplementedError('Chromatic Coupling is not Implemented yet.')",
"def calc_cogen_const(q_heat_Wh, thermal_eff, electrical_eff):\n q_fuel_Wh = q_heat_Wh / thermal_eff\n p_el_Wh = q_fuel_Wh * electrical_eff\n q_anth_Wh = q_fuel_Wh - (q_heat_Wh + p_el_Wh... | [
"0.6294961",
"0.61048",
"0.5967843",
"0.5951184",
"0.57594943",
"0.5723096",
"0.57160133",
"0.5696184",
"0.56531906",
"0.5638758",
"0.56282836",
"0.55501366",
"0.5540841",
"0.5529746",
"0.5521941",
"0.55205417",
"0.551708",
"0.55074126",
"0.5477936",
"0.5454817",
"0.5434555",... | 0.6790448 | 0 |
Get the path of the author's metadata file. | def metadata_path(self):
return os.path.join(self.path, 'metadata.txt') | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def author(self):\n\n for item in self.metadata:\n if item.tag.localname == \"creator\":\n if 'file-as' in item.tag:\n return item.tag['file-as']\n else:\n return item.tag.text",
"def metadata_path(self) -> Path:\n retur... | [
"0.73128355",
"0.72455275",
"0.6794025",
"0.6758771",
"0.6717227",
"0.63932824",
"0.63390166",
"0.60699147",
"0.60699147",
"0.6048289",
"0.60050577",
"0.5995618",
"0.59810764",
"0.5979964",
"0.5977105",
"0.5970299",
"0.5970299",
"0.59544563",
"0.59544563",
"0.58539826",
"0.58... | 0.7908555 | 0 |
Return whether or not the Authorizer is ready to authorize requests. A ``True`` return value does not guarantee that the access_token is actually valid on the server side. | def is_valid(self):
return self.access_token is not None \
and time.time() < self._expiration_timestamp | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def available(self):\n return self.access_token is not None",
"def is_authorized(self) -> bool:\n\t\tif \"access_token\" in session:\n\t\t\tif session.get(\"access_token\") is not None:\n\t\t\t\tif \"user\" in session:\n\t\t\t\t\treturn True\n\t\treturn False",
"def authorized(self):\n return sel... | [
"0.7565474",
"0.7290119",
"0.7216899",
"0.70792913",
"0.7046123",
"0.6812524",
"0.6777532",
"0.67406493",
"0.6715219",
"0.66797227",
"0.66551286",
"0.65431523",
"0.6517955",
"0.6509741",
"0.64865",
"0.6452529",
"0.63725686",
"0.63299066",
"0.6319074",
"0.6318085",
"0.62887853... | 0.71950513 | 3 |
This opens the file passed as argument for reading using an appropriate function depending on if it is gzipped or not. It returns the file handle. | def openFileRd(in_file):
try:
# First see if this file is gzipped
try:
# Opening the file works even if it is not a gzip file
proto_in = gzip.open(in_file, "rb")
# Force a check of the magic number by seeking in the
# file. If we do not do it here the... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def gzopen(f):\n return gzip.open(f, 'rb') if f.endswith('.gz') else open(f, 'r')",
"def open_gzip(fn):\n magic = b'\\x1f\\x8b\\x08'\n l = len(magic)\n with open(fn, 'rb') as f:\n file_start = f.read(l)\n f.seek(0)\n # check if the file is compressed\n if file_start.startswith(mag... | [
"0.8071083",
"0.78946394",
"0.7838592",
"0.77739245",
"0.77569467",
"0.7722201",
"0.7693046",
"0.7535059",
"0.7355459",
"0.7132079",
"0.7069427",
"0.69987345",
"0.6853951",
"0.6813404",
"0.6808192",
"0.6808192",
"0.67767465",
"0.6726441",
"0.6726441",
"0.6681798",
"0.66736627... | 0.64687103 | 26 |
The encoding of the Varint32 is copied from google.protobuf.internal.encoder and is only repeated here to avoid depending on the internal functions in the library. | def _EncodeVarint32(out_file, value):
bits = value & 0x7F
value >>= 7
while value:
out_file.write(struct.pack("<B", 0x80 | bits))
bits = value & 0x7F
value >>= 7
out_file.write(struct.pack("<B", bits)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _VarintEncoder():\n\n local_int2byte = struct.Struct('>B').pack\n\n def EncodeVarint(write, value, unused_deterministic=None):\n bits = value & 0x7f\n value >>= 7\n while value:\n write(local_int2byte(0x80|bits))\n bits = value & 0x7f\n value >>= 7\n return write(local_int2byte(bit... | [
"0.6915836",
"0.68505895",
"0.6734635",
"0.6506164",
"0.64568883",
"0.6421635",
"0.63753873",
"0.6238258",
"0.6233885",
"0.6210582",
"0.61973387",
"0.6153115",
"0.60730386",
"0.59911567",
"0.59598726",
"0.5906016",
"0.59009635",
"0.58397627",
"0.5838379",
"0.58335567",
"0.581... | 0.71325535 | 0 |
Encoded a message with the length prepended as a 32bit varint. | def encodeMessage(out_file, message):
out = message.SerializeToString()
_EncodeVarint32(out_file, len(out))
out_file.write(out) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def encode_varint(value):\n return \"\".join(encode_varint_stream([value]))",
"def encode_int(n):\n return struct.pack(\">I\", n)",
"def encode_length(value):\n if value == Length.INDEFINITE:\n return bytes([0b10000000])\n\n if value < 127:\n return bytes([value])\n\n output = []\n... | [
"0.6650133",
"0.66325945",
"0.65869796",
"0.650972",
"0.6490925",
"0.6481862",
"0.64705944",
"0.64542246",
"0.64284146",
"0.6391322",
"0.6355603",
"0.6337647",
"0.6332218",
"0.6330965",
"0.62314427",
"0.62310773",
"0.62262505",
"0.6219787",
"0.6211288",
"0.62099457",
"0.62099... | 0.0 | -1 |
Calculates normalized cumulative reward based on all the opponents tokens meaned | def __calc_cum_mean_reward(self, token_to_move, next_states):
min_val = -1
max_val = 99
next_state_sum = np.mean(np.sum(next_states[token_to_move][0]))
# Get the opponent who is most ahead by finding sum of the state
opponents_next_state_sum = np.sum(next_states[... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _reward_consolidation(self, observation):\n num_of_consolidation = self._num_of_consolidated(observation)\n reward = (num_of_consolidation/self.num_of_GT) * self.penalty_consolidated\n return reward",
"def cum_reward(self, reward_list):\n reward = 0.\n for rew in reward_lis... | [
"0.6494498",
"0.63175046",
"0.62217134",
"0.621825",
"0.61946285",
"0.61691076",
"0.614554",
"0.6081066",
"0.6079978",
"0.60792446",
"0.60757464",
"0.60757464",
"0.6073388",
"0.6068802",
"0.6053413",
"0.6026187",
"0.6020163",
"0.5990326",
"0.59899694",
"0.5952083",
"0.5943368... | 0.7370408 | 0 |
Check the value of request_datetime if greater than expiration_date or not. | def _check_date(self, cr, uid, ids, context=None):
for act in self.browse(cr, uid, ids, context):
if act.odometer < 0:
raise osv.except_osv(
_('Error'), _("Odometer should be equal to or more than zero"))
if ((act.request_datetime > act.recieve_dateti... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def clean_expiration_date(self):\n expiration_date = self.cleaned_data['expiration_date']\n if expiration_date.date() <= datetime.date.today():\n v_err('elapsed')\n return expiration_date",
"def over_request_limit(last_request: datetime) -> bool:\n if last_request is None:\n ... | [
"0.6790801",
"0.6688129",
"0.6622493",
"0.62138724",
"0.6187788",
"0.6163621",
"0.6148687",
"0.61217475",
"0.6113272",
"0.61091816",
"0.6035746",
"0.6028487",
"0.59860957",
"0.5974811",
"0.5969014",
"0.5891951",
"0.58843684",
"0.5877713",
"0.5873016",
"0.58458596",
"0.5838769... | 0.6231179 | 3 |
Returns whether this device needs homing. | def needs_home(self):
return not bool(self.__lib.CC_CanMoveWithoutHomingFirst(self.__serno)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_hom_ref(self) -> bool:\n return self.is_hom() and (self.allele1 == 0 or self.allele2 == 0)",
"def is_hom_alt(self) -> bool:\n return self.is_hom() and (self.allele1 > 0 or self.allele2 > 0)",
"def is_homo_alt(self):\n return self.geno_hap1 == 1 and self.geno_hap2 == 1",
"def is_ho... | [
"0.70979846",
"0.7080854",
"0.7041818",
"0.6894544",
"0.677699",
"0.6658787",
"0.6658787",
"0.66403",
"0.65965825",
"0.6550136",
"0.63409626",
"0.5991999",
"0.59822154",
"0.5981846",
"0.5941437",
"0.59211004",
"0.5900656",
"0.5803651",
"0.5791356",
"0.5764877",
"0.5759814",
... | 0.6418671 | 10 |
Converts value into millimeters. | def __convert_to_mm(self, value, in_devunit=True):
if in_devunit:
value /= self.DEVUNIT_RATIO
return value | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def mm_to_m(millimeters):\n return millimeters / 1000.0",
"def m_to_mm(meters):\n return meters * 1000.0",
"def km2m(km):\n return km * 1000",
"def human_m(v):\n if v < 1e-2:\n return (v*1.0e3, 'mm')\n if v < 1:\n return (v*1.0e2, 'cm')\n if v < 1000:\n return (v, 'm')\... | [
"0.7408763",
"0.7158178",
"0.69160694",
"0.6725474",
"0.6611294",
"0.6539347",
"0.65273577",
"0.6474873",
"0.644854",
"0.64437675",
"0.6428844",
"0.64227253",
"0.6418126",
"0.6407816",
"0.63963944",
"0.631555",
"0.63152075",
"0.6289637",
"0.6282381",
"0.6251482",
"0.62293434"... | 0.6321276 | 15 |
Get the modified resource. | def GetExistingResource(api_version, request_message):
return utils.GetClient(api_version).projects_locations_transformers.Get(
request_message) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getResource(self):\n return self.__resource;",
"def getResource(self):\n\n return self.__resource;",
"def resource(self):\n return self._resource",
"def resource(self):\n return self._resource",
"def resource(self):\n return self._resource",
"def resource(self):\n ... | [
"0.69825715",
"0.68286824",
"0.67764276",
"0.67764276",
"0.67764276",
"0.67764276",
"0.67764276",
"0.67764276",
"0.67764276",
"0.6638325",
"0.6595039",
"0.6553115",
"0.6390197",
"0.63073695",
"0.6227551",
"0.61977017",
"0.6173382",
"0.61727625",
"0.6165075",
"0.61495334",
"0.... | 0.0 | -1 |
Split the DB URI | def _db_uri_parts():
return app.config['SQLALCHEMY_DATABASE_URI'].split('/') | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _adjust_connection_URL(self, text):\n dbname = self.options.db\n parts = text.split('/')\n\n # Preserve the quotes if present\n if parts[-1].endswith(\"'\"):\n dbname += \"'\"\n\n parts[-1] = dbname\n return '/'.join(parts)",
"def db_uri_for(db_name):\n ... | [
"0.6601392",
"0.6515267",
"0.6404244",
"0.6362737",
"0.6114133",
"0.6051095",
"0.5997393",
"0.5937496",
"0.59068686",
"0.579193",
"0.5762013",
"0.5759929",
"0.5757615",
"0.5718014",
"0.5676783",
"0.56632817",
"0.5582053",
"0.5532869",
"0.55288446",
"0.5527911",
"0.550572",
... | 0.77010447 | 0 |
testing of error raising if neither password no file are set | def test_raise_exception(self):
with self.assertRaises(Exception):
SshpassBaseCommandBuilder(COMMAND).to_build() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_invalid_password(self):\n pass",
"def test_scenarios_that_should_raise_errors(self, kwargs, auth):\n try:\n auth.load_creds(**kwargs)\n # raises ValueError (zero length field name in format) for python 2.6\n # OSError for the rest\n except (OSError, ValueErr... | [
"0.7282498",
"0.6957252",
"0.686505",
"0.6823727",
"0.68105936",
"0.68054783",
"0.67990977",
"0.66810966",
"0.6676294",
"0.6631746",
"0.6601008",
"0.6584482",
"0.65798736",
"0.657108",
"0.6532733",
"0.65191644",
"0.6501163",
"0.6497821",
"0.6493958",
"0.6488437",
"0.64840037"... | 0.0 | -1 |
Returns number of packet fields in the program. If this returns n, packet field indices are from 0 to n1. | def get_num_pkt_fields(program):
pkt_fields = set()
for x in findall(r'state_and_packet.pkt_(\d+)', program):
pkt_fields.add(int(x))
return len(pkt_fields) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _fields_num(self):\n return len(self.paths)",
"def getPacketCount(self):\n return 1",
"def __len__(self):\n return self.dbms.get_nb_fields(self.table, self.db)",
"def _count_fields(self, ws):\n\n field_number = 1\n while ws.cell(row=1, column=field_number).value:\n ... | [
"0.6527158",
"0.65013415",
"0.64121085",
"0.6397062",
"0.63854605",
"0.62914544",
"0.6190242",
"0.6073473",
"0.5952027",
"0.5944468",
"0.5914171",
"0.59022695",
"0.58855915",
"0.5849342",
"0.5840419",
"0.58344597",
"0.5816301",
"0.5804911",
"0.58000946",
"0.5780248",
"0.57796... | 0.80023503 | 0 |
Check if this object has the same properties as another content object | def __eq__(self, other):
return self.properties == other.properties | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __eq__(self, other):\n if not isinstance(other, PropertyContent):\n return False\n\n return self.__dict__ == other.__dict__",
"def __eq__(self, other):\r\n if not hasattr(other, 'name') or not hasattr(other, 'attrs') or not hasattr(other, 'contents') or self.name != other.name... | [
"0.7620333",
"0.7087096",
"0.6991104",
"0.6949423",
"0.69353974",
"0.68391746",
"0.68306065",
"0.6828125",
"0.67812",
"0.6773773",
"0.6759854",
"0.6754788",
"0.67243445",
"0.67205703",
"0.6673683",
"0.66731006",
"0.6667184",
"0.66520065",
"0.6650602",
"0.6650602",
"0.6650602"... | 0.725355 | 1 |
Check if the properties and bodies of this Message and another Message are the same Received messages may contain a 'delivery_info' attribute, which isn't compared. | def __eq__(self, other):
try:
return super().__eq__(other) and self.body == other.body
except AttributeError:
return False | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _fake_message_compare(m1, m2):\r\n m1 = m1.serialize()\r\n m2 = m2.serialize()\r\n diff = False\r\n for i in range(len(m1)):\r\n if m1[i] is None:\r\n continue\r\n if m1[i] != m2[i]:\r\n diff = True\r\n break\r\n ... | [
"0.63768065",
"0.63395476",
"0.6175935",
"0.6125399",
"0.6061344",
"0.6029411",
"0.5993718",
"0.59379673",
"0.5917669",
"0.590561",
"0.5861058",
"0.5838031",
"0.5782343",
"0.5753896",
"0.5744778",
"0.5744289",
"0.5715757",
"0.5715492",
"0.57138586",
"0.5661612",
"0.56504345",... | 0.53733635 | 61 |
Returns the lti.xml file for the app. | def xml():
try:
return Response(render_template(
'lti.xml.j2'), mimetype='application/xml'
)
except:
app.logger.error("Error with XML.")
return return_error('''Error with XML. Please refresh and try again. If this error persists,
please contact support.'''... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def app(self) -> str:\n return pulumi.get(self, \"app\")",
"def lticonfig(tool):\n if tool not in CONFIG:\n return False\n else:\n tconfig = CONFIG[tool]\n\n if 'title' not in tconfig:\n return False\n else:\n text = tconfig['title']\n\n if 'launch_relative' in t... | [
"0.57430667",
"0.5589577",
"0.54048127",
"0.53595316",
"0.53572404",
"0.529412",
"0.52595884",
"0.5223659",
"0.5192046",
"0.51904696",
"0.51869226",
"0.5151285",
"0.51349854",
"0.5113652",
"0.51116675",
"0.5105866",
"0.5100234",
"0.5088753",
"0.50593585",
"0.5044554",
"0.5041... | 0.5537513 | 2 |
Generate a new episode. Sample a random start and goal location. Compute the distance to goal from all location. | def reset(self, rng):
tp = self.task_params
g = self.task.env.task.graph
env = self.task.env
task = self.task
init_states, goal_states, dists, paths = [], [], [], []
for i in range(tp.batch_size):
s, e, path = g.sample_random_goal(rng, tp.min_dist, tp.max_dist)
# Compute distance to ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __generate_new_goal(self):\n min_dist = self.cfg[\"goal\"][\"min_distance\"]\n max_dist = self.cfg[\"goal\"][\"max_distance\"]\n goal_dist_range = max_dist - min_dist\n dist = min_dist + (random() * goal_dist_range)\n phi = -pi + (random() * 2 * pi)\n x = dist * sin(ph... | [
"0.66790855",
"0.62922364",
"0.6233683",
"0.5886926",
"0.58410674",
"0.57240325",
"0.57222563",
"0.57033604",
"0.57024",
"0.56954414",
"0.56954414",
"0.5632924",
"0.5592391",
"0.55709624",
"0.5559431",
"0.551675",
"0.551675",
"0.5496065",
"0.5480172",
"0.5447398",
"0.54300606... | 0.0 | -1 |
Returns the optimal action at a location. | def get_targets(self, states, j):
a = self.get_optimal_action(states, j)
a = np.expand_dims(a, axis=1)*1
return {'gt_action': a} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_best_action(self):\n if self.bestAction is None:\n self.calculate_best_action()\n return self.bestAction",
"def getAction(self, gameState):\n value = float(\"-inf\")\n \n #self.index = 0 -> pacman \n optimalList = [value, None]\n for action in g... | [
"0.7112069",
"0.7081224",
"0.7081224",
"0.70013523",
"0.694194",
"0.6940557",
"0.6930414",
"0.6849376",
"0.68479484",
"0.68409705",
"0.683067",
"0.68218195",
"0.6820318",
"0.6775499",
"0.67707515",
"0.677062",
"0.67416936",
"0.67359924",
"0.6727381",
"0.672069",
"0.67134374",... | 0.0 | -1 |
Calculate the relative velocity of the star from the observed wavelength. | def doppler(self, lmdas):
lmda_0 = 656.3
velocities = []
for lmda in lmdas:
velocities.append((lmda - lmda_0)*constants.c/lmda_0)
return np.array(velocities) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_velocity(self):\n return self.momentum/self.mass",
"def relative_velocity(self):\n return self.base_platform.relative_velocity",
"def getVelocity(self):\n\t\tif len(self.prevPositions) < 2:\n\t\t\tself.velocity = 0\n\t\telse:\n\t\t\ttime = self.position[2] - self.prevPositions[len(self.pr... | [
"0.69731694",
"0.67825705",
"0.6602282",
"0.65749824",
"0.6551517",
"0.6476082",
"0.6467024",
"0.6464492",
"0.6464492",
"0.6449474",
"0.6447472",
"0.6322132",
"0.63102865",
"0.62962395",
"0.6269152",
"0.6263694",
"0.62502015",
"0.6241513",
"0.6213337",
"0.6191251",
"0.6191033... | 0.0 | -1 |
Return the sum of all squared deviances. | def delta(self, day, F_min, sigma, lmda_center):
lmdas, flux = self.data[day]
dev = flux - self.flux_model(lmdas, F_min, sigma, lmda_center)
return np.sum(np.power(dev, 2)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sumsquares(self):\n return np.dot((self.demeaned ** 2).T, self.weights)",
"def normsq(self):\n return sum(x**2 for x in self.data)",
"def total_sum_of_squares(y: np.ndarray) -> float:\n return np.sum(np.square(y - np.linalg.norm(y)))",
"def sum(self):\n return np.dot(self.data.T, ... | [
"0.7477046",
"0.68443394",
"0.6166274",
"0.5980849",
"0.58918905",
"0.5874377",
"0.5842045",
"0.57953215",
"0.5783091",
"0.5777006",
"0.57505685",
"0.57471955",
"0.57447827",
"0.57358396",
"0.5723778",
"0.5723778",
"0.57211053",
"0.5711935",
"0.5703954",
"0.57003033",
"0.5663... | 0.0 | -1 |
Returns a set containing all lines (stripped of \n) in the file. | def read_gzip_file_lines_into_set(filename):
with gzip.open(filename, 'r') as file:
return set([line.strip() for line in file.readlines()]) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def read_set_from_file(filename):\n collection = set()\n with open(filename, \"r\", encoding=\"utf-8\") as file_:\n for line in file_:\n collection.add(line.rstrip())\n return collection",
"def load_lines(file_path):\n with open(file_path, 'r') as f:\n lines = list(filter(boo... | [
"0.6975465",
"0.6857946",
"0.6730082",
"0.6649527",
"0.65545404",
"0.6518748",
"0.64783365",
"0.64148974",
"0.63263345",
"0.6318981",
"0.6308313",
"0.623559",
"0.62348545",
"0.6233095",
"0.62122214",
"0.6188622",
"0.6187118",
"0.61847377",
"0.61785287",
"0.617579",
"0.6169975... | 0.7180445 | 0 |
Returns the full path to the first existing file in the given root directory and with a name from the given list of filenames. In case no file with one of the given names exist in the root directory, the function returns None. | def _any_file_exists(rootDir: str, filenames: List[str]) -> str:
for file in filenames:
fullFilepath = join(rootDir, file)
if isfile(fullFilepath):
return fullFilepath
return None | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def find_one(path, filenames):\n for _path in find_all(path, filenames):\n return _path\n return ''",
"def get_first_file(cmds):\n for cmd in cmds:\n all_files = glob.glob(cmd)\n if all_files:\n for f in all_files:\n if not os.path.isdir(f):\n ... | [
"0.70321435",
"0.66883504",
"0.663283",
"0.66223633",
"0.65754825",
"0.6552176",
"0.6495363",
"0.6451083",
"0.643227",
"0.62923074",
"0.62586504",
"0.6248365",
"0.6239916",
"0.6239916",
"0.6225447",
"0.61447805",
"0.61443555",
"0.6142072",
"0.6092895",
"0.6049989",
"0.6042824... | 0.8083111 | 0 |
Return the device name. | def name(self):
return self._name | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_device_name(self):\n name = self._device[\"name\"]\n if not name or name == \"--\":\n name = self._mac\n\n return name",
"def device_name(self) -> Optional[str]:\n return pulumi.get(self, \"device_name\")",
"def device_name(self) -> Optional[str]:\n return ... | [
"0.8788066",
"0.87851596",
"0.87851596",
"0.86620736",
"0.86620736",
"0.86360085",
"0.86360085",
"0.86360085",
"0.86346877",
"0.8572782",
"0.8427779",
"0.8426968",
"0.8376641",
"0.830186",
"0.82401216",
"0.8203853",
"0.81880784",
"0.81346387",
"0.8027384",
"0.79859686",
"0.79... | 0.0 | -1 |
Return the unique ID for this thermostat battery. | def unique_id(self) -> str:
return '_'.join(['wavin', self._controller_id, str(self._name), 'battery']) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def unique_id(self) -> str:\n return f\"{self._device.unique_id}_battery\"",
"def unique_id(self):\n return self._device.serial",
"def unique_id(self):\n return self.device_id + '_' + self._sensor_type",
"def unique_id(self) -> str:\n return 'remo_device_' + self._remo_device.id +... | [
"0.86063135",
"0.722536",
"0.6986182",
"0.6913398",
"0.6870867",
"0.6862363",
"0.6835564",
"0.676797",
"0.6753258",
"0.6753258",
"0.674173",
"0.67275584",
"0.67077965",
"0.6696943",
"0.6684985",
"0.66650516",
"0.6626645",
"0.66260934",
"0.6623865",
"0.65948355",
"0.6588355",
... | 0.7849788 | 1 |
Return the unit of measurement of this entity, if any. | def unit_of_measurement(self):
return '%' | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def unit_of_measurement(self):\n return self._metadata[1]",
"def unit_of_measurement(self):\n return self._unit",
"def unit_of_measurement(self):\n return self._unit",
"def unit_of_measurement(self):\n return self._unit",
"def unit_of_measurement(self):\n return self._uni... | [
"0.8565862",
"0.8477338",
"0.8477338",
"0.8477338",
"0.8477338",
"0.8477338",
"0.8477338",
"0.8477338",
"0.8473674",
"0.845385",
"0.845385",
"0.845385",
"0.845385",
"0.845385",
"0.845385",
"0.845385",
"0.845385",
"0.845385",
"0.845385",
"0.845385",
"0.845385",
"0.845385",
... | 0.0 | -1 |
check the movement from s is in States or not. | def is_neighbor(s, move, States):
cord = str2cord(s)
cord_n = [sum(x) for x in zip(cord, move)]
str_n = cord2str(cord_n)
if str_n in States:
return str_n, True
else:
return s, False | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _ismoving(self):\n return self.dp.state()==PyTango.DevState.MOVING",
"def check_state(self):\n if self.dpad:\n x_state, y_state = self.handle_dpad()\n else:\n x_state, y_state = self.handle_abs()\n\n # pylint: disable=no-member\n new_state = set((\n ... | [
"0.67130494",
"0.6594172",
"0.6528222",
"0.6495908",
"0.6487899",
"0.64528805",
"0.64513147",
"0.6413166",
"0.63852215",
"0.6381929",
"0.6356521",
"0.6343934",
"0.6341476",
"0.631811",
"0.6298543",
"0.6295654",
"0.6267911",
"0.6231808",
"0.6230913",
"0.6222808",
"0.620214",
... | 0.6135059 | 27 |
Converts the list in word_dict to dictionary by calling Dictogram on the values. | def dictogram_dictlist(self):
for key, value in self.word_dict.items():
self.word_dict[key] = dictogram.Dictogram(value)
# print("self.word_dict", self.word_dict) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def build_dict(word_list):\r\n\r\n # initialize a dictonary\r\n d = dict()\r\n\r\n # iterate through the word_list, mapping sorted letters to word\r\n for i in word_list:\r\n\r\n # key - sorted letters in the word\r\n # how to sort ? --> convert to list, then sort. Finally join the sorted... | [
"0.6928584",
"0.6709182",
"0.6585728",
"0.6478139",
"0.63843834",
"0.63650656",
"0.6361425",
"0.6332601",
"0.6314687",
"0.6311698",
"0.6293258",
"0.6282225",
"0.6278975",
"0.6240787",
"0.62207025",
"0.6211592",
"0.61624527",
"0.6140395",
"0.6087807",
"0.6050368",
"0.6041014",... | 0.82668906 | 0 |
Randomly partitions the data into n nonoverlapping parts | def partition(data, n):
splits = []
remaining = data.copy(deep=True)
for i in range(n):
split = remaining.sample(frac=1/(n-i), random_state=10)
splits.append(split)
remaining = remaining.drop(split.index)
return splits | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def random_partition(n, n_data):\n all_idxs = np.arange(n_data)\n np.random.shuffle(all_idxs)\n idxs1 = all_idxs[:n]\n idxs2 = all_idxs[n:]\n return idxs1, idxs2",
"def partition(lis: list, n: int):\n # prevent destroying the original dataset\n lis_cp = copy.deepcopy(lis)\n random.shuffle... | [
"0.7815066",
"0.70952547",
"0.70643574",
"0.7033008",
"0.69578886",
"0.69070894",
"0.68777543",
"0.6790234",
"0.6783834",
"0.6749898",
"0.67419916",
"0.6690655",
"0.66623163",
"0.6630153",
"0.65984476",
"0.65899414",
"0.65849966",
"0.6560478",
"0.6538623",
"0.65210646",
"0.64... | 0.8382783 | 0 |
Returns whether 'resp' is an error response. If 'errno' is not None, the value of an errno must match it | def is_error_response(resp: Response, errno=None) -> bool:
if not resp or not is_dict(resp) or resp.get("success") is not False:
return False
# Is an error response
if errno is None:
# No check on errno
return True
# errno specified, check if it match at least an errno
er... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def isError(self, errno):\n return self.__errors[errno]",
"def _has_error_code(res):\n\n if res and 'error_code' in res:\n return res['error_code'] > 0\n\n return False",
"def check_response_errors(self, resp):\n return True",
"def is_error(response: str) -> bool:\n return \... | [
"0.70955825",
"0.6955538",
"0.6719245",
"0.6604157",
"0.65321296",
"0.6493723",
"0.6447784",
"0.6429457",
"0.63950956",
"0.63407487",
"0.6290865",
"0.62147886",
"0.61178714",
"0.60230815",
"0.5987374",
"0.5972681",
"0.5965426",
"0.596267",
"0.5935674",
"0.5883092",
"0.5844395... | 0.82153434 | 0 |
Extracts file name from absolute file path. | def get_name_from_path(self, file_path, replace=False):
if replace:
base_name = os.path.basename(file_path)
ext = os.path.splitext(base_name)[1]
_out = base_name.replace(ext, '')
return _out
head, tail = os.path.split(file_path)
return tail or os... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_basename(absolute_file_path):\r\n return absolute_file_path.split('/')[-1]",
"def extract_file_name(file_path):\n # ファイルパスからファイル名(拡張子含む)を取り出す\n file_name = file_path.split('/')[-1]\n # 拡張子を取り除く\n return file_name.split('.')[0]",
"def get_file_name(path):\n return os.path.basename(path... | [
"0.81091726",
"0.8039037",
"0.789217",
"0.7871236",
"0.78687555",
"0.7779533",
"0.77650815",
"0.77575934",
"0.77300286",
"0.7611142",
"0.7518364",
"0.75119144",
"0.74395984",
"0.7431398",
"0.7425019",
"0.74106914",
"0.74043465",
"0.7358512",
"0.7348673",
"0.7324278",
"0.73073... | 0.6922779 | 48 |
Check whether database table exists. | def check_table(table_name, engine):
sql = ("SELECT "
"* "
"FROM information_schema.tables "
"WHERE table_name = '{}'".format(table_name)
)
result = engine.execute(sql)
if len(result.fetchall()) > 0:
return True
else:
return False | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def db_table_exists(db, table_name):\n query = \"\"\"\n SELECT name FROM sqlite_master\n WHERE type='table' AND name='%s'\"\"\" % table_name\n cursor = db.execute(query)\n results = cursor.fetchmany()\n return len(results) > 0",
"def table_exists(self):\n # Check if table already... | [
"0.84524393",
"0.8368139",
"0.82741797",
"0.8265774",
"0.82348657",
"0.8193223",
"0.81386876",
"0.81218725",
"0.80998933",
"0.80954206",
"0.8072407",
"0.8001963",
"0.79525673",
"0.7911668",
"0.79105747",
"0.7900441",
"0.7893146",
"0.7892238",
"0.7860551",
"0.78035295",
"0.780... | 0.7369683 | 35 |
Given a datetime or date or time object from the ``datetime`` module, always return a datetime using default values. | def ensure_datetime(ob: AnyDatetime) -> datetime.datetime:
if isinstance(ob, datetime.datetime):
return ob
date = cast(datetime.date, ob)
time = cast(datetime.time, ob)
if isinstance(ob, datetime.date):
time = datetime.time()
if isinstance(ob, datetime.time):
date = datetime.... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_datetime_default(self):\r\n default = datetime.now()\r\n prop = DateTime(default=default, required=True)\r\n self.assertEqual(prop.to_database(None), prop.to_database(default))",
"def default(o):\n if isinstance(o, (datetime.date, datetime.datetime)):\n return o.isoformat(... | [
"0.69703287",
"0.66525185",
"0.6632711",
"0.65803874",
"0.6550506",
"0.65359855",
"0.6519421",
"0.6379674",
"0.6280343",
"0.62126595",
"0.6091774",
"0.60405743",
"0.60295177",
"0.59924924",
"0.5980544",
"0.5925718",
"0.5915738",
"0.5911098",
"0.5909182",
"0.59024245",
"0.5864... | 0.66231686 | 3 |
For a given period (e.g. 'month', 'day', or some numeric interval such as 3600 (in secs)), return the format string that can be used with strftime to format that time to specify the times across that interval, but no more detailed. For example, >>> get_date_format_string('month') '%Y%m' >>> get_date_format_string(3600)... | def get_date_format_string(period):
# handle the special case of 'month' which doesn't have
# a static interval in seconds
if isinstance(period, str) and period.lower() == 'month':
return '%Y-%m'
file_period_secs = get_period_seconds(period)
format_pieces = ('%Y', '-%m-%d', ' %H', '-%M', '-... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getFormattedDate(self, dt):\n if DATE_FORMAT_STRING == '':\n return time.strftime('%Y-%m-%d %H:%M:%S', dt.timetuple())\n else:\n return time.strftime(DATE_FORMAT_STRING, dt.timetuple())",
"def strftime(self, dtime, format): # pylint: disable=redefined-builtin\n for... | [
"0.6113763",
"0.6015611",
"0.5953033",
"0.5871318",
"0.58415145",
"0.5798688",
"0.5786244",
"0.5786244",
"0.5786244",
"0.57566214",
"0.5723331",
"0.57213193",
"0.5556376",
"0.55284506",
"0.5510901",
"0.55092865",
"0.5495431",
"0.5446615",
"0.54379565",
"0.54370964",
"0.543644... | 0.7384175 | 0 |
Collection of TagMetas in ProjectMeta. | def tag_metas(self) -> TagMetaCollection:
return self._tag_metas | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_tags(self) -> Set[Text]:\r\n return {tag for tag in self.tags}",
"def tags(self) -> Mapping[str, Any]:\n return pulumi.get(self, \"tags\")",
"def tags(self) -> Mapping[str, Any]:\n return pulumi.get(self, \"tags\")",
"def meta(self):\n return list(self.generator.meta)",
... | [
"0.6368683",
"0.6271851",
"0.6271851",
"0.6257317",
"0.6229046",
"0.6195514",
"0.61816746",
"0.6168695",
"0.6153534",
"0.6151211",
"0.6151211",
"0.6151211",
"0.6151211",
"0.6151211",
"0.6151211",
"0.6151211",
"0.6151211",
"0.6119854",
"0.6119854",
"0.61098456",
"0.61078054",
... | 0.77690303 | 0 |
Get the grid position of this space. | def position(self) -> Tuple[int, int]:
return self.row, self.col | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def position_grid(self):\n return self.currentLevel.toGridCoord(self.position)",
"def get_grid_position(self):\n tile_size_x = constants.WINDOW_WIDTH / constants.GRID_TILE_LENGTH\n tile_size_y = constants.WINDOW_HEIGHT / constants.GRID_TILE_LENGTH\n grid_x = tile_size_x / self.host.x\... | [
"0.86666566",
"0.8592727",
"0.81527334",
"0.79588854",
"0.7914282",
"0.73695713",
"0.7327605",
"0.7288191",
"0.7286615",
"0.72728324",
"0.72522134",
"0.7233567",
"0.7198288",
"0.7180905",
"0.7138105",
"0.7125117",
"0.7025906",
"0.7004493",
"0.69813126",
"0.69813126",
"0.69701... | 0.7085721 | 16 |
r""" Returns a UCI regression dataset in the form of Pytorch dataloaders for train, validation, and test. Also returns the sizes of features and label and the standard deviation of the training labels. | def get_uci_dataloaders(
name,
split_seed=0,
test_fraction=0.1,
batch_size=None,
train_frac=1.0,
combine_val_train=False,
):
train, val, test, in_size, target_size, y_train_scale = get_uci_datasets(
name,
split_seed=split_seed,
test_fraction=test_fraction,
tra... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def load_uci_regression_dataset(name,\n split_seed,\n train_fraction=0.9,\n data_dir=\"uci_datasets\"):\n path = os.path.join(data_dir,\n _UCI_REGRESSION_FILENAMES[UCIRegressionDatasets(name)])\n dat... | [
"0.6582726",
"0.6463743",
"0.6166184",
"0.61140925",
"0.6091776",
"0.6016342",
"0.6008833",
"0.5998591",
"0.5988238",
"0.5982196",
"0.5971527",
"0.5959459",
"0.59431523",
"0.5930261",
"0.5929995",
"0.59244597",
"0.59059155",
"0.5905513",
"0.5886284",
"0.588389",
"0.58838826",... | 0.5910964 | 16 |
Test that middleware is ok when server is none in scope. | def test_behavior_with_scope_server_as_none(self):
def update_expected_server(expected):
expected[3]["attributes"].update(
{
SpanAttributes.HTTP_HOST: "0.0.0.0",
SpanAttributes.NET_HOST_PORT: 80,
SpanAttributes.HTTP_URL: "h... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_behavior_with_scope_server_as_none(self):\n\n def update_expected_server(expected):\n expected[3][\"attributes\"].update(\n {\n \"http.host\": \"0.0.0.0\",\n \"host.port\": 80,\n \"http.url\": \"http://0.0.0.0/\",\n ... | [
"0.68050337",
"0.6421726",
"0.62887543",
"0.627802",
"0.62571293",
"0.609614",
"0.60894525",
"0.6052777",
"0.60396963",
"0.59555256",
"0.58882743",
"0.58479136",
"0.58381426",
"0.58093685",
"0.5792621",
"0.57923585",
"0.57682794",
"0.5765627",
"0.5707247",
"0.56999034",
"0.56... | 0.67881715 | 1 |
Represent boolean as onehot vector | def onehot(isTrue):
if isTrue:
return [1, 0]
else:
return [0, 1] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def one_hot(a, actions, dtype=t.float32):\n assert 1 == a.shape[-1]\n return (a == t.arange(actions, device=a.device)).to(dtype=dtype)",
"def one_hot(x, dtype=np.float32):\n return np.array(x[:, None] == np.arange(x.max()+1), dtype)",
"def one_hot(x, num_classes, dtype=jnp.float32):\n return jax.nn.one... | [
"0.7829915",
"0.7675368",
"0.7645777",
"0.7640877",
"0.76210326",
"0.75751084",
"0.7538824",
"0.7515602",
"0.75130254",
"0.74937785",
"0.74930763",
"0.7483466",
"0.7474857",
"0.7447771",
"0.74050164",
"0.73949194",
"0.73892176",
"0.73881793",
"0.7364026",
"0.7352619",
"0.7351... | 0.8435318 | 0 |
Return the name of the sensor. | def name(self):
return '{} {}'.format(self.client_name, self.variable) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def name(self):\n return self._sensor.name",
"def get_sensor_name(self):\n return self.data[1]",
"def name(self):\n return self.device.device_data[self.device_id]['name'] + \\\n f' {self._sensor_type}'",
"def name(self):\n return f\"{self._name} {SENSOR_TYPES[self.senso... | [
"0.91896784",
"0.9168378",
"0.890185",
"0.8770976",
"0.8511273",
"0.8479953",
"0.844435",
"0.8299758",
"0.8186503",
"0.8105667",
"0.8079737",
"0.8066149",
"0.8049647",
"0.7700968",
"0.7612295",
"0.7611456",
"0.7600605",
"0.7600605",
"0.7600605",
"0.75392073",
"0.75166553",
... | 0.0 | -1 |
Return the unit of measurement of this entity, if any. | def unit_of_measurement(self):
return SENSOR_TYPES[self.variable][1] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def unit_of_measurement(self):\n return self._metadata[1]",
"def unit_of_measurement(self):\n return self._unit",
"def unit_of_measurement(self):\n return self._unit",
"def unit_of_measurement(self):\n return self._unit",
"def unit_of_measurement(self):\n return self._uni... | [
"0.8565862",
"0.8477338",
"0.8477338",
"0.8477338",
"0.8477338",
"0.8477338",
"0.8477338",
"0.8477338",
"0.8473674",
"0.845385",
"0.845385",
"0.845385",
"0.845385",
"0.845385",
"0.845385",
"0.845385",
"0.845385",
"0.845385",
"0.845385",
"0.845385",
"0.845385",
"0.845385",
... | 0.7864599 | 56 |
Return the state attributes. | def state_attributes(self):
return {
ATTR_WEATHER_ATTRIBUTION: ATTRIBUTION,
ATTR_STATION: self.probe.get_data('station_name'),
ATTR_UPDATED: '{} {}'.format(self.probe.get_data('update_date'),
self.probe.get_data('update_time')),
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def state_attributes(self):\n return self._attributes",
"def state_attributes(self):\n return self._attributes",
"def device_state_attributes(self):\r\n return self.attributes",
"def device_state_attributes(self):\n return self._state_attrs",
"def device_state_attributes(self):\... | [
"0.8953404",
"0.8953404",
"0.85239846",
"0.8366765",
"0.8366765",
"0.8363429",
"0.83362615",
"0.8334551",
"0.8310377",
"0.8292682",
"0.8289349",
"0.8289349",
"0.82871646",
"0.82871646",
"0.82871646",
"0.82871646",
"0.82871646",
"0.82871646",
"0.82871646",
"0.82871646",
"0.828... | 0.78548414 | 40 |
Validates that the UID field is unique. | def test_uid_is_unique(self):
field = self.image._meta.get_field("uid")
self.assertTrue(field.unique) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def check_unique(self):\n pass",
"def is_valid(self):\n if len(self) <= 64 and re.match(RE_VALID_UID, self):\n return True\n\n return False",
"def clean_uid_field(self):\n if CONFIG.y(\"passbook.uid_fields\") == [\"email\"]:\n validate_email(self.cleaned_data.g... | [
"0.72057927",
"0.7155465",
"0.6795649",
"0.6734536",
"0.67266667",
"0.66838723",
"0.6674257",
"0.6492492",
"0.62401074",
"0.6108813",
"0.6098118",
"0.6045574",
"0.6033297",
"0.59444034",
"0.5938763",
"0.592612",
"0.5901784",
"0.5893956",
"0.58870333",
"0.58671373",
"0.5833228... | 0.7296241 | 0 |
Standard setUp makes sure the temp dir really exists and is the working dir. | def setUp(self):
tempDir.safe_mkdir(parents=True)
os.chdir(tempDir.as_posix()) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def setUp(self):\n chdir(mkdtemp())",
"def setUp(self):\n chdir(mkdtemp())",
"def setUp(self):\n self.tmpdir = mkdtemp()",
"def setUp(self):\n self.tmp = TemporaryDirectory()",
"def setUp(self):\n if not isdir(tmp_dir_path):\n os.mkdir(tmp_dir_path)\n se... | [
"0.88140184",
"0.88140184",
"0.86479527",
"0.85984117",
"0.84553516",
"0.83448905",
"0.82788295",
"0.82788295",
"0.82788295",
"0.82788295",
"0.82788295",
"0.82788295",
"0.82788295",
"0.82555264",
"0.82344604",
"0.82344604",
"0.8074855",
"0.7972291",
"0.79125786",
"0.7862497",
... | 0.9037572 | 0 |
Returns the last pushed value from the stack without removing it. If no result is available, method should return 0. | def result(self):
# most pythonic way to get last in last is -1
return self.history[-1] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def pop(self) -> int:\n tmp = self.stack[-1]\n for i in range(len(self.stack)-1):\n self.stack.append(self.stack.popleft())\n self.stack.popleft()\n return tmp",
"def pop(self) -> int:\n return self.stack.pop()",
"def pop(self) -> int:\n return self._stack.p... | [
"0.8060876",
"0.795809",
"0.78086567",
"0.7761121",
"0.7629452",
"0.7622969",
"0.7589206",
"0.7499224",
"0.7468523",
"0.7458714",
"0.7433382",
"0.74145293",
"0.73774904",
"0.73629665",
"0.73401767",
"0.7333057",
"0.73311704",
"0.73260605",
"0.7280873",
"0.72776145",
"0.727515... | 0.0 | -1 |
Return if this word is a url or not | def word_is_url(word):
match = URL_REGEX.search(word)
return True if match is not None else False | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _is_url(string):\n return \"http\" in string",
"def __isUrl(self, url):\n if type(url)==str:\n return url.startswith('http://') or url.startswith('https://')\n return False",
"def is_web_url(text):\r\n return re.match(r'(http://|https://|www.)(www\\.)?([a-zA-Z0-9-_.]+)(\\.[a-... | [
"0.83869857",
"0.80103534",
"0.75419086",
"0.74878925",
"0.74810535",
"0.7423119",
"0.73330474",
"0.7310011",
"0.7236806",
"0.71868217",
"0.71441317",
"0.71068496",
"0.7106155",
"0.7098562",
"0.70434797",
"0.7040921",
"0.7040516",
"0.7021434",
"0.6974643",
"0.6967763",
"0.694... | 0.870867 | 0 |
Get platform Work through a list of possible platform types and return the first match. Ordering of items is important as some match more than one type. E.g. Android will match both Android and Linux | def get_platform():
platforms = [
"Android",
"Linux.RaspberryPi",
"Linux",
"XBOX",
"Windows",
"ATV2",
"IOS",
"OSX",
"Darwin",
]
for platform in platforms:
if xbmc.getCondVisibility('System.Platform.%s' % platform):
return platform
return "Unknown" | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_platform(build_rules_list, verbose=False, platform=None):\n\n # Make sure the input is PlatformTypes\n if platform:\n platform = PlatformTypes.lookup(platform)\n\n # If it's not, search the build_rules for it\n if not isinstance(platform, PlatformTypes):\n\n # Check build_rules.py... | [
"0.7639166",
"0.7402239",
"0.6936322",
"0.6927749",
"0.68940246",
"0.68654615",
"0.67371",
"0.65974295",
"0.6578057",
"0.6558834",
"0.6482911",
"0.6442688",
"0.6433192",
"0.6430592",
"0.6430236",
"0.64083505",
"0.6357997",
"0.6337397",
"0.628588",
"0.6243893",
"0.6235154",
... | 0.731835 | 2 |
Softmax that works on ND inputs. | def _softmax(x):
e = K.exp(x - K.max(x, axis=-1, keepdims=True))
s = K.sum(e, axis=-1, keepdims=True)
return e / s | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def softmax(x):\n # (n_samples, n_classes)\n if len(x.shape) == 2:\n row_max = np.max(x, axis=1)\n x -= row_max.reshape((x.shape[0], 1))\n x = np.exp(x)\n row_sum = np.sum(x, axis=1)\n x /= row_sum.reshape((x.shape[0], 1))\n # (n_samples, n_tasks, n_classes)\n elif len(x.shape) == 3:\n row_ma... | [
"0.81348056",
"0.8121902",
"0.7943523",
"0.7881542",
"0.78614813",
"0.7796425",
"0.77870405",
"0.7764297",
"0.7750328",
"0.7727283",
"0.7723887",
"0.77162665",
"0.77100426",
"0.7698294",
"0.76760787",
"0.7650504",
"0.76453817",
"0.7632015",
"0.7623713",
"0.7623713",
"0.761975... | 0.7571038 | 34 |
Given a string, capitalize the first letter. | def capitalize_first_letter(text):
chars = list(text.strip())
chars[0] = chars[0].upper()
return "".join(chars) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def capitalize1(s):\n return s[:1].upper() + s[1:]",
"def capitalizeFirst(word):\n return word[0].upper() + word[1:]",
"def cap_first(word):\n return word[0].upper() + word[1:]",
"def capitalcase(string):\n\n string = str(string)\n if not string:\n return string\n return uppercase(st... | [
"0.8696695",
"0.84763247",
"0.81438386",
"0.7787724",
"0.77650654",
"0.7731529",
"0.7596363",
"0.7530636",
"0.74716735",
"0.7448021",
"0.7431562",
"0.74006575",
"0.7360463",
"0.73500717",
"0.7312091",
"0.7298294",
"0.7290407",
"0.727158",
"0.7268012",
"0.7236377",
"0.7213097"... | 0.8497937 | 1 |
Transform a dict to Entity | def from_dict(cls, dict_object):
return cls(**dict_object) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _to_entity(self):\n obj_dict = copy.deepcopy(vars(self))\n exclude_from_indexes = ()\n try:\n exclude_from_indexes = self._exclude_from_indexes_\n except AttributeError:\n pass\n\n try:\n key = self.key\n except AttributeError:\n ... | [
"0.6926446",
"0.680275",
"0.67635727",
"0.66587436",
"0.66423947",
"0.66130084",
"0.65891904",
"0.6582459",
"0.6572689",
"0.65324074",
"0.61958545",
"0.613829",
"0.6055212",
"0.5999227",
"0.5991606",
"0.598234",
"0.5915451",
"0.58859116",
"0.5882483",
"0.5874256",
"0.5854095"... | 0.0 | -1 |
>>> list(xbatch(2, range(10))) [range(0, 2), range(2, 4), range(4, 6), range(6, 8), range(8, 10)] >>> list(xbatch(3, ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'])) [['Jan', 'Feb', 'Mar'], ['Apr', 'May', 'Jun'], ['Jul', 'Aug', 'Sep'], ['Oct', 'Nov', 'Dec']] >>> list(xbatch(3, ('Ja... | def xbatch(size, iterable):
l = len(iterable)
for i in range(0, l, size):
yield iterable[i:min(i + size, l)] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def batch(size, iterable):\r\n return list(xbatch(size, iterable))",
"def match(\n x: Any,\n table: Iterable,\n nomatch: Any = -1,\n # incomparables ...,\n base0_: bool = None,\n) -> Iterable[int]:\n base = int(not get_option(\"which_base_0\", base0_))\n return Array(\n [\n ... | [
"0.552478",
"0.5353474",
"0.53242344",
"0.5179374",
"0.5100814",
"0.49251515",
"0.48160866",
"0.48089287",
"0.48015463",
"0.47792253",
"0.47774732",
"0.4771237",
"0.4770997",
"0.47337055",
"0.4725335",
"0.46984494",
"0.46672013",
"0.4665043",
"0.46125823",
"0.45996407",
"0.45... | 0.0 | -1 |
Write an 8bit value to the specified register. | def write8(self, register, value):
raise NotImplementedError | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def i2c_write8(self, address, register, value):\n raise NotImplementedError",
"def write(self, register, value): #good\r\n\t\tself.i2c.write8(register, value)",
"def write_uint8(self,value):\n packed = struct.pack('!B',value)\n self.data.extend(packed)",
"def swd_write8(self, output, va... | [
"0.73367023",
"0.7241036",
"0.70908165",
"0.70768845",
"0.70760304",
"0.7026891",
"0.68717796",
"0.6802168",
"0.6751612",
"0.6698085",
"0.6376255",
"0.62360406",
"0.6206534",
"0.61567104",
"0.6106181",
"0.61036146",
"0.6083611",
"0.60794103",
"0.60610807",
"0.59922653",
"0.59... | 0.8486693 | 0 |
Read a signed byte from the specified register. | def read_S8(self, register):
raise NotImplementedError | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _read_byte(self, register):\r\n return self._read_register(register, 1)[0]",
"def read_byte(fd, reg):\n b, = write_read_i2c(fd, bytes([reg]), 1)\n return b",
"def _read_register_1sbyte(self, reg_addr):\n buffer = self.bus.read_i2c_block_data(self.I2C_ADDRESS, reg_addr, 1)\n val =... | [
"0.7505196",
"0.6622785",
"0.65917766",
"0.65917766",
"0.64882493",
"0.64441806",
"0.6240541",
"0.6156688",
"0.6075523",
"0.60709846",
"0.6053438",
"0.60353744",
"0.6024748",
"0.6012853",
"0.59814024",
"0.5969802",
"0.59244406",
"0.5883409",
"0.5853333",
"0.585251",
"0.582775... | 0.60996604 | 8 |
This class method can be used to load the model's weights. | def load_model(self, ):
tf.keras.backend.clear_session()
self.load_weights(os.path.join(self.weights_dir, "countmodel_weights_" + self.name_)).expect_partial() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def load_model_weights(self):\n raise NotImplementedError",
"def load_model_weights(self, filename):\n self.model.load_weights(filename)",
"def load_weights(self):\n try:\n print('loading weights from {}'.format(self.cfg.class_model_dir))\n self.load_state_dict(torch.... | [
"0.9078512",
"0.8283338",
"0.82785213",
"0.8095198",
"0.8091388",
"0.8082241",
"0.8029531",
"0.7942261",
"0.79407674",
"0.79276913",
"0.78988415",
"0.7832109",
"0.78299856",
"0.7808995",
"0.7752713",
"0.7720904",
"0.7683408",
"0.76812685",
"0.7618174",
"0.76142544",
"0.758741... | 0.76980513 | 16 |
Returns array of unspent transaction outputs | def rpc_listunspent(self, min_conf: int = 1, max_conf: int = 99999999, addresses: list = []) -> list:
return self._call_command(["listunspent", min_conf, max_conf, addresses]) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_unspent_outputs(self, crypto, address):\n raise NotImplementedError(\n \"This service does not support getting unspent outputs. \"\n \"Or rather it has no defined 'get_unspent_outputs' method.\"\n )",
"def unspent_outputs(self, filter_options=None):\n return sel... | [
"0.7659773",
"0.76272935",
"0.76096827",
"0.7088254",
"0.70428866",
"0.6965615",
"0.65535426",
"0.645356",
"0.6248517",
"0.62238574",
"0.62087613",
"0.617758",
"0.6165086",
"0.6165086",
"0.6165086",
"0.6165086",
"0.6165086",
"0.6165086",
"0.6165086",
"0.6130624",
"0.6064204",... | 0.62595063 | 8 |
Requests unspent outputs (UTXO) for a set of addresses Based on the 'listunspent' rpc call (has limitations). | def get_utxos(self, ticker: str, addresses: Union[set, list, tuple]) -> List[UTXO]:
# TODO make call as batch
# sanity check: only wallet address are supported
for address in addresses:
info = self.rpc_getaddressinfo(address)
if not (info["ismine"] or info["iswatchonly"]... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_unspent_outputs(self, crypto, address):\n raise NotImplementedError(\n \"This service does not support getting unspent outputs. \"\n \"Or rather it has no defined 'get_unspent_outputs' method.\"\n )",
"def addresses_with_unspent_outputs(self):\n return self._cal... | [
"0.8001498",
"0.7564913",
"0.75254947",
"0.745256",
"0.73614264",
"0.72461474",
"0.71972454",
"0.707683",
"0.7064087",
"0.70174825",
"0.70009345",
"0.6748631",
"0.6512948",
"0.63139063",
"0.6016024",
"0.57142925",
"0.56498444",
"0.5645505",
"0.5632748",
"0.550073",
"0.5472339... | 0.73099667 | 5 |
Returns all unspent outputs for an address (requires addressindex to be enabled) | def rpc_getaddressutxos(self, addresses: list) -> list:
return self._call_command(["getaddressutxos", {"addresses": addresses}]) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_unspent_outputs(self, address):\n\n raise NotImplementedError('coming soon...')\n\n outputs = []\n for uock in self._unspent._list_unspent(address):\n\n # get the transaction for this utxo\n txck = keys.get_uock_txck(uock)\n txn = self._blocks._txns._ge... | [
"0.85164577",
"0.78672063",
"0.78097713",
"0.75626427",
"0.6865804",
"0.6400148",
"0.63395953",
"0.6251812",
"0.61786515",
"0.60809094",
"0.6050277",
"0.5893737",
"0.5873438",
"0.5761506",
"0.57203966",
"0.56547153",
"0.561287",
"0.56077486",
"0.54255164",
"0.54180634",
"0.54... | 0.6168637 | 9 |
Requests unspent outputs (UTXO) for a set of addresses Based on the 'getaddressutxos' rpc call. | def get_utxos(self, ticker: str, addresses: Union[set, list, tuple]) -> List[UTXO]:
result = self.rpc_getaddressutxos(addresses=list(set(addresses)))
log.debug(pprint.pformat(result))
utxos = list()
for entry in result:
utxos.append(UTXO(
txid=entry["txid"],
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def rpc_getaddressutxos(self, addresses: list) -> list:\n return self._call_command([\"getaddressutxos\", {\"addresses\": addresses}])",
"def get_unspent_outputs(self, crypto, address):\n raise NotImplementedError(\n \"This service does not support getting unspent outputs. \"\n ... | [
"0.79069936",
"0.7687189",
"0.7654315",
"0.75124216",
"0.7438682",
"0.74214923",
"0.73310107",
"0.6952239",
"0.67411363",
"0.6736406",
"0.65910035",
"0.6463268",
"0.60463035",
"0.57053804",
"0.56999",
"0.5576543",
"0.55240196",
"0.54659957",
"0.54633754",
"0.54450095",
"0.541... | 0.7451466 | 4 |
Add a new experience to memory. | def add(self, state, action, reward, next_state, done):
e = self.experience(state, action, reward, next_state, done)
self.memory.append(e) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_new_experience(self, state, action, reward, next_state, done):\n e = self.experience(state, action, reward, next_state, done, self.max_priority)\n self.memory.append(e)",
"def add(self, state, action, reward, next_state, done):\n experience = Experience(state, action, reward, next_st... | [
"0.79568833",
"0.79042006",
"0.78795445",
"0.7577913",
"0.7570969",
"0.74478436",
"0.7361023",
"0.72697705",
"0.721816",
"0.71451885",
"0.7106998",
"0.7101183",
"0.69837016",
"0.68905056",
"0.68842727",
"0.6755663",
"0.6712557",
"0.6677425",
"0.64961654",
"0.6488678",
"0.6486... | 0.71984994 | 12 |
Return the current size of internal memory. | def __len__(self):
return len(self.memory) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getSize(self) -> int:\n return len(self.mem)",
"def getSize(self):\n return self.bf.memory()",
"def memsize(self):\n return self.xlist(\"get-memsize\")[1][0] * 1024",
"def size(self):\n size = 0\n size += self.data.size * sys.getsizeof(self.data)\n return size / ... | [
"0.8573752",
"0.82169205",
"0.8200361",
"0.8087402",
"0.8021614",
"0.7890747",
"0.78219426",
"0.78017354",
"0.77905464",
"0.7758844",
"0.77559924",
"0.77559924",
"0.775519",
"0.77544576",
"0.7733221",
"0.7732168",
"0.7720068",
"0.77145016",
"0.77092093",
"0.77077913",
"0.7697... | 0.75127405 | 50 |
Tests that converting with `UILoadVideoToVideoInitialized` returns the expected xAPI statement. | def test_ui_load_video_to_video_initialized(uuid_namespace, event, platform_url):
event.context.course_id = ""
event.context.org_id = ""
event.context.user_id = "1"
event.session = "af45a0e650c4a4fdb0bcde75a1e4b694"
session_uuid = "af45a0e6-50c4-a4fd-b0bc-de75a1e4b694"
event_str = event.json()
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_ui_play_video_to_video_played(uuid_namespace, event, platform_url):\n\n event.context.course_id = \"\"\n event.context.org_id = \"\"\n event.context.user_id = \"1\"\n event.session = \"af45a0e650c4a4fdb0bcde75a1e4b694\"\n session_uuid = \"af45a0e6-50c4-a4fd-b0bc-de75a1e4b694\"\n event_st... | [
"0.7136949",
"0.65553856",
"0.64426696",
"0.63336205",
"0.6321144",
"0.60226214",
"0.6017897",
"0.5971216",
"0.59009147",
"0.5851784",
"0.58342475",
"0.58251995",
"0.57992905",
"0.57567376",
"0.5755801",
"0.5699567",
"0.5672838",
"0.5670111",
"0.5647921",
"0.5635352",
"0.5632... | 0.7902353 | 0 |
Hit the minimax api and make sure the whole thing works as expected. This is pretty much test_minimax but through a request | def test_request(self):
data = {
"board_array": ["E" for x in range(9)],
"agent_marker": "X"
}
response = self.c.post(
'/tic-tac-toe/minimax-api/',
json.dumps(data),
content_type="application/json"
)
self.assert... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_minimax_interface(self):\n h, w = 7, 7 # board size\n test_depth = 1\n starting_location = (5, 3)\n adversary_location = (0, 0) # top left corner\n iterative_search = False\n search_method = \"minimax\"\n heuristic = lambda g, p: 0. # return 0 everywhere... | [
"0.72420496",
"0.72250134",
"0.7063007",
"0.68710995",
"0.6673939",
"0.6616047",
"0.6430818",
"0.64158696",
"0.6402268",
"0.6397125",
"0.62693995",
"0.6253883",
"0.62537843",
"0.6243741",
"0.6233561",
"0.62230015",
"0.62198687",
"0.6214247",
"0.6186745",
"0.6178607",
"0.61646... | 0.72007036 | 2 |
Test serialization of Uri fields. | def test_uri_field_serialization(value):
class Entity:
def __init__(self, field):
self.field = field
schema = fields.Namespace("http://schema.org/")
class OldEntitySchema(JsonLDSchema):
field = Uri(schema.field, allow_none=True)
class Meta:
rdf_type = sche... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_uri_field_deserialization(value):\n\n class Entity:\n def __init__(self, field):\n self.field = field\n\n schema = fields.Namespace(\"http://schema.org/\")\n\n class OldEntitySchema(JsonLDSchema):\n field = Uri(schema.field, allow_none=True)\n\n class Meta:\n ... | [
"0.67277485",
"0.62993133",
"0.6118897",
"0.6088285",
"0.5929194",
"0.57488525",
"0.56958014",
"0.56555915",
"0.56245065",
"0.558239",
"0.55505586",
"0.5513772",
"0.5480315",
"0.5472935",
"0.54406136",
"0.54153544",
"0.540034",
"0.5370809",
"0.53680724",
"0.53647166",
"0.5342... | 0.7145704 | 0 |
The coefficient of voltage across this component from the perspective of a given node. | def nodeVoltageCoefficient(self, node):
return {0: 1, 1: -1, 2: 1}[self.ends.index(node)] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def coeff(self):\n return self._coeff",
"def coefficient(self) -> float:\n ...",
"def voltage(self):\n return self.outputValue()",
"def voltage(self):\n\t\treturn self._voltage",
"def get_voltage(self):\n return self.environment.get_voltage(self.neuron_id)",
"def coef(self):\n... | [
"0.68017226",
"0.6759194",
"0.6743517",
"0.67339766",
"0.65926445",
"0.6570315",
"0.65108913",
"0.6491145",
"0.64841896",
"0.64400625",
"0.6423061",
"0.6381794",
"0.6376691",
"0.63309413",
"0.632409",
"0.62737036",
"0.62075007",
"0.6187601",
"0.61725104",
"0.6091806",
"0.6015... | 0.77380157 | 0 |
Find if user marked at least one colour choice as true in each sort category. If any choice doesn't have True in it, then it means we have an empty category. | def noNullColourChoice(choices):
return all(True in sub for sub in choices) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def unique_categories(categories):\n\t\treturn all(value < 3 for value in list(categories.values()))",
"def is_empty(self):\n return not bool(self.categories)",
"def _find_relevant_categories(value):\n if value is None:\n if KEEP_UNKOWN_PURPOSE:\n return True\n else:\n ... | [
"0.60688496",
"0.56449234",
"0.5273157",
"0.526988",
"0.52048934",
"0.52045304",
"0.5155212",
"0.51538056",
"0.5037671",
"0.5027135",
"0.50074923",
"0.49834988",
"0.4969656",
"0.4961369",
"0.49372298",
"0.49372146",
"0.49364817",
"0.49302593",
"0.49302092",
"0.4922874",
"0.49... | 0.59949565 | 1 |
Make sure that no choice of colours is repeated in any category. If any choice is repeated in the list of choices, return a false | def noIdenticalChoices(choices):
return not(max([choices.count(choice)-1 for choice in choices])) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def noNullColourChoice(choices):\r\n return all(True in sub for sub in choices)",
"def test_check_category_input_2(self):\n choices = [(1, 'choice 1'), (2, 'choice 2')]\n assert validation.check_category_input(3, choices) == False",
"def test_check_category_input_3(self):\n choices = [(... | [
"0.71878386",
"0.66485566",
"0.6344239",
"0.63189656",
"0.6261644",
"0.6097734",
"0.59749067",
"0.5973522",
"0.5908228",
"0.5907543",
"0.5905427",
"0.59052706",
"0.58283883",
"0.5797812",
"0.5785652",
"0.57692885",
"0.5758171",
"0.57319605",
"0.5723894",
"0.5717819",
"0.56699... | 0.6975564 | 1 |
Get dataset by name or id | def get(self, dataset_name=None, dataset_id=None, checkout=False, fetch=None) -> entities.Dataset:
if fetch is None:
fetch = self._client_api.fetch_entities
if dataset_id is None and dataset_name is None:
dataset = self.__get_from_cache()
if dataset is None:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get(id: str) -> DataSet:\n pass",
"def get_dataset(id=None, name=None):\n query = db.session.query(Dataset).\\\n filter(\n or_(\n Dataset.id == id,\n Dataset.name == name\n )\n )[0]\n return query",
"def get_by_name(self, name: str) -> Optional[\"D... | [
"0.8163058",
"0.8154482",
"0.80520254",
"0.78941166",
"0.7810363",
"0.7746639",
"0.7523437",
"0.7422079",
"0.73090285",
"0.7139351",
"0.708662",
"0.6989556",
"0.69832635",
"0.69710064",
"0.6969422",
"0.6950762",
"0.689894",
"0.68481576",
"0.6828719",
"0.68204355",
"0.6812558"... | 0.62252307 | 54 |
Create a new dataset | def create(self, dataset_name, labels=None, driver=None, attributes=None, ontology_ids=None,
checkout=False) -> entities.Dataset:
# labels to list
if labels is not None:
if not all(isinstance(label, entities.Label) for label in labels):
labels = entities.Datase... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def CreateDataset(all_arrays):\n dataset = Dataset()\n\n dataset._addData(all_arrays[0])\n dataset._addData(all_arrays[1])\n dataset._addData(all_arrays[3])\n dataset._addData(all_arrays[5])\n dataset._addData(all_arrays[6])\n dataset._addData(all_arrays[9])\n dataset._addData(all_arrays[8]... | [
"0.7586557",
"0.75450885",
"0.7534269",
"0.7527229",
"0.7470003",
"0.7410547",
"0.73679024",
"0.7241393",
"0.72390395",
"0.72096837",
"0.717928",
"0.7170682",
"0.71639687",
"0.7135883",
"0.70970917",
"0.70929205",
"0.7082619",
"0.7063604",
"0.7014774",
"0.70005345",
"0.696421... | 0.6987963 | 20 |
Generate a short random hex string. | def _random_id():
return binascii.hexlify(os.urandom(4)).decode() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def gen_hex_str(octets=64):\n # Generate random hex string\n return binascii.b2a_hex(os.urandom(octets)).decode()",
"def gen_secret() -> str:\n r = random.randrange(0, 255) # INSECURE, just for demo\n r = hex(r)[2:]\n if len(r) == 1:\n return f'0{r}'\n return r",
"def generate_random_s... | [
"0.7935363",
"0.7853711",
"0.7798172",
"0.7542812",
"0.74963325",
"0.74854076",
"0.7482755",
"0.7428979",
"0.7408786",
"0.73803604",
"0.7333044",
"0.7320625",
"0.7278035",
"0.7264895",
"0.7178932",
"0.7145218",
"0.71346503",
"0.7110505",
"0.7105082",
"0.7101776",
"0.70949435"... | 0.6903769 | 28 |
Make a pretty string representation | def __str__(self):
return pprint.pformat({'collectionname':self.collection_name,'services':self.services}) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def pretty_str(self) -> str:\n ...",
"def pretty_str(self) -> str:\n return _yaml_dump(self.to_ordered_dict())",
"def printpretty(self):\n print(self.string_rep())",
"def pretty_print(self, indent=8):\n formatted_lines = []\n for line in self.coefficients:\n form... | [
"0.8391398",
"0.7229779",
"0.71666753",
"0.70293605",
"0.6967941",
"0.69596434",
"0.6909037",
"0.6851504",
"0.6792156",
"0.67235804",
"0.67026323",
"0.6689618",
"0.6631487",
"0.6555297",
"0.65525144",
"0.6523527",
"0.65062773",
"0.6489752",
"0.6463085",
"0.64485514",
"0.64421... | 0.0 | -1 |
Wrap a slim constructor with a model name and dataset name. | def _make(dataset, model):
def wrapper(args):
return SlimExperiment(dataset, model, args)
return wrapper | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self,\n model: Union[str, io.IOBase, DM, None] = None,\n name: Optional[str] = None,\n database = None,\n **kwargs):\n assert name is None, 'name is not used by this class'\n assert database is None, 'database is not used by... | [
"0.64783305",
"0.64579874",
"0.6455922",
"0.6111086",
"0.5973521",
"0.5972592",
"0.58624375",
"0.58540285",
"0.58445835",
"0.5827617",
"0.58130985",
"0.58130985",
"0.58130985",
"0.58130985",
"0.5806066",
"0.5786905",
"0.57707995",
"0.57707995",
"0.57707995",
"0.57707995",
"0.... | 0.71109957 | 0 |
Return a list of json, which contains diff files report. | def diff_files_to_json(self, diff_files, path_dir_1, path_dir_2):
diff_files_json = []
for fl in diff_files:
file_path_1 = os.path.join(path_dir_1, fl)
file_path_2 = os.path.join(path_dir_2, fl)
path_in = self.make_path_in(file_path_1, file_path_2)
file_s... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_list_of_comitted_files():\n files = []\n output = []\n try:\n output = subprocess.check_output(['git','diff-index', '--name-status', '--cached','HEAD']\n ).decode(\"utf-8\")\n except subprocess.CalledProcessError:\n print(\"Error diff files get: trace %s\" % subprocess.... | [
"0.6416764",
"0.6382993",
"0.63636315",
"0.63622254",
"0.63587785",
"0.6267453",
"0.62280875",
"0.6190561",
"0.6093381",
"0.6056143",
"0.6049178",
"0.59983486",
"0.5958243",
"0.59510213",
"0.5942101",
"0.59384286",
"0.5919101",
"0.5900004",
"0.5861765",
"0.5845193",
"0.578242... | 0.7480561 | 0 |
Return a list of json, which contains diff files report. | def common_dirs_to_json(self, list_common_dirs, path_dir_1, path_dir_2):
common_dirs_json = []
for directory in list_common_dirs:
file_path_1 = os.path.join(path_dir_1, directory)
file_path_2 = os.path.join(path_dir_2, directory)
path_in = self.make_path_in(file_path... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def diff_files_to_json(self, diff_files, path_dir_1, path_dir_2):\n diff_files_json = []\n for fl in diff_files:\n file_path_1 = os.path.join(path_dir_1, fl)\n file_path_2 = os.path.join(path_dir_2, fl)\n path_in = self.make_path_in(file_path_1, file_path_2)\n\n ... | [
"0.7480046",
"0.6416175",
"0.63837564",
"0.6362887",
"0.6362605",
"0.63572854",
"0.62677383",
"0.6226287",
"0.6189796",
"0.60938585",
"0.6055421",
"0.6049172",
"0.5996982",
"0.5958577",
"0.5951141",
"0.59422946",
"0.5937895",
"0.59195423",
"0.5899464",
"0.5862127",
"0.5844810... | 0.5282156 | 88 |
Create a timestamp object out of the two given timestamp parts | def parse_timestamp(row):
ts0 = pd.Timestamp(row['raw_timestamp_part_1'], unit='s')
ts1 = pd.Timedelta(row['raw_timestamp_part_2'], unit='microseconds')
return ts0 + ts1 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def fromtimestamp(cls, *args, **kwargs): # real signature unknown\r\n pass",
"def convertToEST(timestamp):\n newDateTime = datetime.datetime.fromtimestamp(timestamp/1000)\n return newDateTime.date(), newDateTime.time()",
"def get_timestamp():\n now, s=get_date()\n return (now, \"%s%s%s%s\" %... | [
"0.6275812",
"0.6153791",
"0.60738736",
"0.5981361",
"0.59595853",
"0.59070134",
"0.5854076",
"0.5818862",
"0.5816119",
"0.57846975",
"0.5777515",
"0.5740747",
"0.5719796",
"0.56824183",
"0.5681494",
"0.56795484",
"0.56791526",
"0.5667048",
"0.5659801",
"0.5640436",
"0.562996... | 0.5710332 | 13 |
Creates 3D bounding boxes based on carla vehicle list and camera. | def get_bounding_boxes(vehicles, camera):
'''
bounding_boxes = np.array([ClientSideBoundingBoxes.get_bounding_box(vehicle, camera) for vehicle in vehicles])
# filter objects behind camera
inscene_indices = np.array([1 if all(bb[:, 2]) > 0 else 0 for bb in bounding_boxes])
inscene... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_bounding_box(vehicle, camera):\n\n bb_cords = ClientSideBoundingBoxes._create_bb_points(vehicle)\n cords_x_y_z = ClientSideBoundingBoxes._vehicle_to_sensor(bb_cords, vehicle, camera)[:3, :]\n cords_y_minus_z_x = np.concatenate([cords_x_y_z[1, :], -cords_x_y_z[2, :], cords_x_y_z[0, :]])... | [
"0.66892874",
"0.6468072",
"0.6416688",
"0.61983985",
"0.6046202",
"0.6031276",
"0.5943716",
"0.58908063",
"0.5881509",
"0.58711684",
"0.58489984",
"0.58337015",
"0.58192545",
"0.5795869",
"0.57583225",
"0.5746305",
"0.57274044",
"0.5693946",
"0.5678554",
"0.56576824",
"0.564... | 0.68686557 | 0 |
Extract bounding box from GeoJSON feature rectangle. | def feature_to_bbox(feature: dict) -> List[float]:
coords = feature["geometry"]["coordinates"][0]
if len(coords) == 5:
assert coords[-1] == coords[0]
del coords[-1]
p0, p1 = coords[0], coords[1]
w, s, e, n = p0[0], p0[1], p1[0], p1[1]
# unpacking lon, lat, alt in single variable c t... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_bbox_from_geojson(geojson_dictionary):\n geojson_dictionary = json.loads(geojson_dictionary)\n all_lats = []\n all_lngs = []\n\n feature = geojson_dictionary[\"features\"][0]\n coordinates = feature[\"geometry\"][\"coordinates\"][0]\n\n for coord in coordinates:\n\n # [lng, lat]\n ... | [
"0.7448726",
"0.69377494",
"0.68677616",
"0.6867731",
"0.6797734",
"0.6760145",
"0.6760145",
"0.6720627",
"0.66682553",
"0.6660344",
"0.66389096",
"0.6631518",
"0.66283214",
"0.66240025",
"0.66211975",
"0.6589936",
"0.6569954",
"0.65594476",
"0.6495578",
"0.6489644",
"0.64896... | 0.6489033 | 21 |
Read and return the value of the environment variable ``XYZ_TOKEN``. | def get_xyz_token() -> str:
xyz_token = os.environ.get("XYZ_TOKEN")
if xyz_token is None:
warnings.warn("No token found in environment variable XYZ_TOKEN.")
return xyz_token or "" | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getToken():\n token = getenv(TOKEN_NAME)\n if token == None:\n raise SystemExit('No token found. Use env variable %s' % TOKEN_NAME)\n return token",
"def token():\n return os.environ.get('TOKEN', None)",
"def get_token(path = os.getcwd()):\n\n path += \"\\\\.env\"\n load_dotenv(pat... | [
"0.7101758",
"0.69631976",
"0.66801",
"0.66580003",
"0.6139463",
"0.6112413",
"0.60831946",
"0.60439056",
"0.5930869",
"0.5891976",
"0.5883283",
"0.5880585",
"0.5832874",
"0.5819003",
"0.57429886",
"0.5706981",
"0.56654406",
"0.5662538",
"0.56468433",
"0.5604181",
"0.56019104... | 0.7938626 | 0 |
Create groups of `size` each from given iterable. | def grouper(size, iterable, fillvalue=None):
args = [iter(iterable)] * size
return zip_longest(fillvalue=fillvalue, *args) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def itergroup(iterable, size: int):\n group = []\n for item in iterable:\n group.append(item)\n if len(group) == size:\n yield group\n group = []\n if group:\n yield group",
"def group(seq, size):\n if not hasattr(seq, 'next'):\n seq = iter(seq)\n whi... | [
"0.8387454",
"0.79584193",
"0.79568005",
"0.7678869",
"0.76549375",
"0.7520203",
"0.7486291",
"0.74814844",
"0.74814844",
"0.74814844",
"0.7451022",
"0.74307543",
"0.7429479",
"0.7423967",
"0.7417062",
"0.7403742",
"0.7403742",
"0.73923874",
"0.73581386",
"0.735674",
"0.73558... | 0.8086788 | 1 |
Deprecated alias of `score` from when we only considered predictors of peptideMHC binding affinity. Returns float | def elution_score(self):
return self.score | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_score(self):\n return float(self._score)",
"def get_score(self, solution: np.array) -> float:\n pass",
"def NormalizePhenotypeScore(score, max_score):\n return float(score) / float(max_score) * 100",
"def normalize(cls, raw_score):\n return super().normalize(raw_score)",
"de... | [
"0.62351215",
"0.6191059",
"0.59027886",
"0.590262",
"0.590262",
"0.590262",
"0.590262",
"0.5845629",
"0.58347714",
"0.5794434",
"0.5784813",
"0.5784813",
"0.5784813",
"0.57634073",
"0.57259506",
"0.57016826",
"0.57016826",
"0.57016826",
"0.56971025",
"0.5689974",
"0.5687903"... | 0.553829 | 34 |
Gets the ZIA Credentials from the Shell Environmnnet. Must pass True | False for Debug Logging. Default = True | def get_zia_creds_from_env(self, debug):
if debug:
self.debug = debug
else:
self.debug = DEBUG_DEFAULT
# Username should be stored as an environmental variable named "ZIA_USERNAME"
if os.environ.get('ZIA_USERNAME') is not None:
self.zia_username = os.environ.get('ZIA_USERNAME')
else:
logging.debu... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_zia_partner_creds_from_env(self, debug):\n\t\tif debug:\n\t\t\tself.debug = debug\n\t\telse:\n\t\t\tself.debug = DEBUG_DEFAULT\n\n\t\t# Partner username should be stored as an environmental variable named \"PARTNER_USERNAME\"\n\t\tif os.environ.get('ZIA_PARTNER_USERNAME') is not None:\n\t\t\tself.partner_u... | [
"0.6393789",
"0.6207621",
"0.6161015",
"0.61560804",
"0.6002853",
"0.59352505",
"0.5902194",
"0.5788011",
"0.57357305",
"0.5731923",
"0.56492496",
"0.56472033",
"0.56430364",
"0.56430364",
"0.5626685",
"0.5587808",
"0.5583197",
"0.55734354",
"0.5569138",
"0.5544791",
"0.55386... | 0.7688594 | 0 |
Format inputted date into format expected for JQL. | def format_date(self, date):
return date.strftime('%Y-%m-%d') | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def format_date(self, date_val):\n try:\n if type(date_val) is not datetime:\n d = date.fromisoformat(date_val[0:10])\n else:\n d = date_val\n return d.strftime('%Y-%m-%d')\n except Exception as e:\n self.error((str(e)))",
"d... | [
"0.6586816",
"0.64851964",
"0.6475497",
"0.6421067",
"0.634063",
"0.63322836",
"0.63110507",
"0.6267509",
"0.619795",
"0.61742675",
"0.61692107",
"0.61149746",
"0.61090153",
"0.61087716",
"0.6107529",
"0.60977036",
"0.6097544",
"0.60859406",
"0.60568386",
"0.60461825",
"0.602... | 0.65431005 | 1 |
Tests extracting values where no values are present. Result must be empty list ([]). | def test_extracting_no_values(self):
formula = bf.And([bf.Or([bf.Tru(), bf.Tru(), bf.Tru()]), bf.Or([bf.Not(bf.Tru()), bf.Not(bf.Tru())]), bf.Not(bf.Tru())])
self.assertEqual([], au.extract_variables(formula), "Invalid variables extracted, expected [].") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def testValuesWithoutData(self):\n collection = TagValueCollection()\n result = collection.values()\n self.assertIdentical(ResultSet, type(result))\n self.assertEqual([], list(result))",
"def test_parse_results_empty():\n assert [] == parse_results({})",
"def test_no_values(self)... | [
"0.69864726",
"0.6533036",
"0.6471501",
"0.6410061",
"0.6392675",
"0.6241682",
"0.6225955",
"0.6155522",
"0.6110378",
"0.60756403",
"0.6063115",
"0.60518974",
"0.6040351",
"0.60059756",
"0.5945448",
"0.5944246",
"0.59087735",
"0.5886363",
"0.583644",
"0.5829838",
"0.5805089",... | 0.7479227 | 0 |
Rule getter. If rule dict is not have key `ident`, will error occur in validation. | def get(self, ident=None):
return self.rules.get(ident, validators.Failure()) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_rule(self):\n from .osid_errors import IllegalState\n # Someday I'll have a real implementation, but for now I just:\n raise IllegalState()",
"def get(self, ident):\n try:\n ident = int(ident)\n except ValueError:\n raise\n return self.rules... | [
"0.6906101",
"0.68066216",
"0.6308922",
"0.6177239",
"0.61418957",
"0.6140281",
"0.61154366",
"0.6081135",
"0.6081135",
"0.6081135",
"0.60210425",
"0.5985348",
"0.5972836",
"0.5972836",
"0.5972836",
"0.5972836",
"0.5972836",
"0.5972836",
"0.5972836",
"0.5942648",
"0.59169656"... | 0.728467 | 0 |
It accepts a custom cutoff for the price extremes. | def test_price_point_distribution_cutoff(self, basic_factory, garment_factory, affiliate_item_factory):
basic = basic_factory()
garment = garment_factory(basic=basic)
for inc in range(10, 120, 10):
affiliate_item_factory(garment=garment, price=Decimal(inc))
update_basic_pric... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def cutoff(self, *args, **kwargs) -> Any:\n pass",
"def _standardize_cutoff(cutoff):\n cutoff = np.asarray(cutoff)\n cutoff[0] = max(0., cutoff[0])\n cutoff[1] = min(1., cutoff[1])\n cutoff[0] = np.min([cutoff[0], 0.09])\n cutoff[1] = np.max([cutoff[1], 0.91])\n return cutoff",
"def ex... | [
"0.689327",
"0.6303116",
"0.55502135",
"0.5469498",
"0.54576427",
"0.5316298",
"0.5281247",
"0.5189426",
"0.51840425",
"0.51715696",
"0.5167399",
"0.51638234",
"0.5160407",
"0.5127466",
"0.5101908",
"0.50915146",
"0.5085806",
"0.50740063",
"0.50598305",
"0.50148976",
"0.50069... | 0.5035181 | 19 |
Get current INITDEL register value | def initdel(self):
data = self._ftdi.spi_read(self.INITDEL_ADDR, len=1, burst='fixed')
return data[0] & self.INITDEL_MASK | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def initdel(self, val):\n data = val & self.INITDEL_MASK\n self._ftdi.spi_write(self.INITDEL_ADDR, [data], burst='fixed')",
"def reset(self):\n with self.lock:\n curr = self._val\n self._val = 0\n return curr",
"def Get(self):\n value=0\n retu... | [
"0.58958864",
"0.5661602",
"0.5552026",
"0.5509332",
"0.54067093",
"0.53661317",
"0.5350535",
"0.5317704",
"0.53089607",
"0.5276312",
"0.5261998",
"0.5241032",
"0.5166703",
"0.5154041",
"0.51082903",
"0.51064926",
"0.5089337",
"0.50785357",
"0.5075454",
"0.5059328",
"0.505396... | 0.75632274 | 0 |
Get current ACQBUSY register value | def acqbusy(self):
data = self._ftdi.spi_read(self.ACQBUSY_ADDR, len=1, burst='fixed')
return data[0] & self.ACQBUSY_MASK | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def acqdone(self):\n data = self._ftdi.spi_read(self.ACQDONE_ADDR, len=1, burst='fixed')\n return data[0] & self.ACQDONE_MASK",
"def getBusyMessage(self):\n return self.__busyMessage",
"def _busy_wait(self):\n wait_for = GPIO.HIGH\n if self.inky_version == 2:\n wai... | [
"0.6694645",
"0.6613296",
"0.62908596",
"0.6203753",
"0.6183694",
"0.6064316",
"0.596715",
"0.59533",
"0.58963984",
"0.5896013",
"0.58405566",
"0.58106065",
"0.57679963",
"0.5742",
"0.5659958",
"0.5645671",
"0.5637029",
"0.5605463",
"0.5543073",
"0.5485718",
"0.54807395",
"... | 0.8749781 | 0 |
Get current RAMRADDRRST register value | def ramraddrrst(self):
return 0 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def ramraddrrst(self, val):\n data = val & self.RAMRADDRRST_MASK\n self._ftdi.spi_write(self.RAMRADDRRST_ADDR, [data], burst='fixed')",
"def getRst(unit):\n try:\n return unit.rst\n except AttributeError:\n pass\n\n try:\n return unit.rst_n\n except AttributeError:\... | [
"0.6406794",
"0.61410207",
"0.5970413",
"0.58261037",
"0.5645516",
"0.55681825",
"0.5397711",
"0.53903866",
"0.53876114",
"0.5360691",
"0.532447",
"0.5297316",
"0.52950275",
"0.5261172",
"0.52594334",
"0.52460337",
"0.5228314",
"0.52138966",
"0.5181011",
"0.51088345",
"0.5104... | 0.5781951 | 4 |
Convert a raw text to a list of stemmed tokens. | def text2tokens(raw_text):
clean_text = raw_text.lower().translate(translate_tab)
tokens = [token.strip() for token in tokenizer.tokenize(clean_text)]
tokens = [token for token in tokens if token not in eng_stopwords]
stemmed_tokens = [stemmer.stem(token) for token in tokens]
return [token for token... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def process_text(text, stem=True):\n table = string.maketrans(\"\",\"\")\n text = text.translate(table, string.punctuation)\n tokens = word_tokenize(text)\n \n if stem:\n stemmer = PorterStemmer()\n tokens = [stemmer.stem(t) for t in tokens]\n \n return tokens",
"def process_text(tex... | [
"0.75919235",
"0.75559634",
"0.7522596",
"0.7517548",
"0.74981964",
"0.7452741",
"0.7353838",
"0.72394055",
"0.7206812",
"0.72062314",
"0.7192238",
"0.7192238",
"0.71373916",
"0.70523906",
"0.70357114",
"0.6974615",
"0.695852",
"0.6957813",
"0.6954292",
"0.69444793",
"0.69339... | 0.7819089 | 0 |
Test if new user try not validated email | def test_new_user_invalid_email(self):
with self.assertRaises(ValueError):
get_user_model().objects.create_user(
None,
'Password'
) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_private_create_user_without_email(self):\n with pytest.raises(ValueError) as exinfo:\n EmailUser.objects._create_user(None, None, False, False)\n self.assertIn('email must be set', str(exinfo.value))",
"def test_new_user_invalid_email(self):\n with self.assertRaises(Value... | [
"0.75943047",
"0.7576957",
"0.7575948",
"0.75697803",
"0.75518966",
"0.75432473",
"0.7534252",
"0.75330603",
"0.7531751",
"0.75302106",
"0.75302106",
"0.75302106",
"0.75302106",
"0.75302106",
"0.750233",
"0.7459864",
"0.7410228",
"0.740615",
"0.73933",
"0.7379869",
"0.7377094... | 0.74470264 | 16 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.