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 |
|---|---|---|---|---|---|---|
Find the best lambda value. | def tune_lambda(Xtrain, ytrain, Xval, yval):
#####################################################
# TODO 5: Fill in your code here #
#####################################################
bestlambda = None
err = 1
for v in range(-19,20):
if v>=0:
val = float("1e+"+str(v))
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_lambda(model):\n best_lambdas = [1000.0, 0.001, 100.0, 0.001, 100.0, 100.0, 0.001, 100.0]\n lambda_ = best_lambdas[model]\n return lambda_",
"def __bestLambda(self):\n\t\t\n\t\t# Determine starting value for brent-method (to avoid local minimum).\n\t\tself.startValue = self.__findStartValue()\n\... | [
"0.74376184",
"0.71890557",
"0.655791",
"0.6550202",
"0.63085747",
"0.6219973",
"0.6184345",
"0.61574817",
"0.6153785",
"0.61114615",
"0.6099454",
"0.60798913",
"0.6037426",
"0.6037426",
"0.6017245",
"0.5970384",
"0.58916986",
"0.58453995",
"0.5843659",
"0.5816554",
"0.578878... | 0.6234567 | 5 |
Returns a list of the headlines with the corresponding keyword | def get_headlines_with_keyword(self, kw):
key_head = self.keyword_headlines()
headlines = set()
for headlinekw in key_head[kw]:
content = headlinekw.headlineid.content
headlines.add(content)
return list(headlines) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_headlines(self, kw = None):\r\n\t\tif kw:\r\n\t\t\treturn self.get_headlines_with_keyword(kw)\r\n\t\telse:\r\n\t\t\treturn self.get_all_headlines()",
"def keyword_headlines(self):\r\n\t\td = {}\r\n\r\n\t\tfor q in self.keyword_queryset:\r\n\t\t\td[q.content] = self.headlinekeyword_queryset.filter(keyword... | [
"0.8323906",
"0.77197367",
"0.746953",
"0.7303126",
"0.68182117",
"0.6805935",
"0.66141784",
"0.64018786",
"0.6364445",
"0.63333815",
"0.59744793",
"0.59658384",
"0.59578186",
"0.5909768",
"0.5894226",
"0.58745706",
"0.5857797",
"0.5850383",
"0.58470386",
"0.58389264",
"0.581... | 0.8318916 | 1 |
Welcome route Show api info | def get(self, **kwargs):
# groups = kwargs.get('groups')
return {
'app_fullname': main_config.app_name,
'app_name': main_config.package_name,
'app_version': main_config.app_version
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def welcome():\n return(\n f\"Available Routes:<br/>\"\n f\"/api/v1.0/etf_info<br/>\"\n f\"/api/v1.0/mutualfunds_info\"\n )",
"def welcome():\n print(\"Server received request for 'Home' page...\")\n return (\n f\"Available Routes:<br/>\"\n f\"/api/v1.0/names<br/>\"... | [
"0.78570443",
"0.7700679",
"0.76447624",
"0.76302814",
"0.76104695",
"0.75441355",
"0.7513181",
"0.75017893",
"0.748835",
"0.748835",
"0.747807",
"0.7470789",
"0.7469684",
"0.7465586",
"0.7445721",
"0.74422014",
"0.7441175",
"0.7425304",
"0.74079293",
"0.7407577",
"0.74064386... | 0.0 | -1 |
Find unoccupied positions on the board. | def findUnoccupied( board, occupation):
return [ j for j in xrange(len(board.positions))
if not occupation.has_key(j) ] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def free_positions(self):\n positions = []\n for i in range(self.grid_size):\n for j in range(self.grid_size):\n if self.grid[i][j] == 0:\n positions.append((i, j))\n if positions == []:\n raise GameException('Game Over. No free position ... | [
"0.74757147",
"0.73623365",
"0.7305674",
"0.72659814",
"0.7136726",
"0.6983209",
"0.6902076",
"0.69016534",
"0.68626094",
"0.6858928",
"0.67981094",
"0.67022055",
"0.66423976",
"0.65927297",
"0.6580229",
"0.6564762",
"0.65628403",
"0.6559673",
"0.654521",
"0.65293694",
"0.652... | 0.77521825 | 0 |
Returns a QuerySet containing only available instances (i.e. not selected previously) | def available(self, include_qs = None, include_obj = None):
qs = self.all()
available_qs = self.all()
for obj in qs:
if include_qs:
if not obj.available and include_qs.filter(id=obj.id).count() == 0:
available_qs = available_qs.exclude(id=obj.id)
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_queryset(self):\n return NoneToEmptyQuerySet(self.model, using=self._db)",
"def get_queryset(self):\n # the filter says that it only returns those w/ the pub_date\n # less or equal to timezone.now() (earlier or now)\n questions = Question.objects.filter(\n pub_date_... | [
"0.6884471",
"0.68695015",
"0.67739236",
"0.67603797",
"0.671835",
"0.65459937",
"0.6483099",
"0.64685464",
"0.64685464",
"0.6414166",
"0.6411734",
"0.6331146",
"0.6330862",
"0.6273209",
"0.6255611",
"0.6248718",
"0.62450546",
"0.6231552",
"0.6221019",
"0.6218501",
"0.6209835... | 0.6682215 | 5 |
Determines whether the model instance has already been selected in a related field (ManyToManyField, OneToOneField). | def available(self):
fields = self._meta.get_fields()
for field in fields:
if isinstance(field, models.ManyToManyRel):
attr = field.get_accessor_name()
if getattr(self, attr).count() > 0:
return False
elif isinstance(field, m... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def relation_exists(cls, model):\n return bool(cls.get_related_field(model)\n or cls.get_reverse_related_field(model))",
"def isRelated(self):\n return len(self.user_storage.all()) > 0",
"def has_field(self, field):\n return field in self.extra_fields",
"def contains(s... | [
"0.6742698",
"0.6351571",
"0.6249839",
"0.6177484",
"0.594861",
"0.58511186",
"0.58348316",
"0.5823608",
"0.5715787",
"0.56835854",
"0.5671056",
"0.5618836",
"0.5598657",
"0.5598657",
"0.55803764",
"0.55689776",
"0.5560058",
"0.55562407",
"0.551438",
"0.55038196",
"0.54985",
... | 0.66686696 | 1 |
Convert datetime objects to GPS timestamp and nanoseconds | def datetime_to_gpstimestamp_nanoseconds(date):
timestamp = gpstime.utc_to_gps(calendar.timegm(date.utctimetuple()))
nanosecond = date.microsecond * 1000
return timestamp, nanosecond | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def to_gps_time(self):\n ts_type = self.ts_types['gpstime']\n try:\n leapseconds = self.leapseconds\n check_date = duparser.parse(self.timestamp)\n if hasattr(check_date.tzinfo, '_offset'):\n dt_tz = check_date.tzinfo._offset.total_seconds()\n ... | [
"0.64110595",
"0.6309177",
"0.6237445",
"0.61667824",
"0.61475044",
"0.61468357",
"0.6086212",
"0.606989",
"0.6046954",
"0.60396606",
"0.6038311",
"0.60068566",
"0.59911877",
"0.5953865",
"0.59505874",
"0.5947502",
"0.5941145",
"0.5941145",
"0.5921453",
"0.591261",
"0.5876311... | 0.7270666 | 0 |
Frees any resources used by the environment. Implement this method for an environment backed by an external process. This method be used directly ```python env = Env(...) Use env. env.close() ``` or via a context manager ```python | def close(self) -> None:
pass | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def close_env(self):\n self.env.close()",
"def close(self): \n\t\tself.env.close()",
"def terminate(self):\n super(ReacherEnv, self).close()",
"def close(self):\n if self.__env:\n self.__env.close()\n self.__env = None\n super(DiskCache, self).close()",
"de... | [
"0.7741044",
"0.7280734",
"0.71917665",
"0.71788585",
"0.67623675",
"0.6581033",
"0.6527342",
"0.64914477",
"0.6491418",
"0.64707375",
"0.6448349",
"0.6402401",
"0.6377555",
"0.6377555",
"0.63491684",
"0.6225186",
"0.6214336",
"0.6168082",
"0.61409414",
"0.6053957",
"0.605207... | 0.0 | -1 |
Check whether an access token is blacklisted or not. | def check_token_in_blacklist(decrypted_token):
from .models import BlacklistToken
jti = decrypted_token['jti']
if BlacklistToken.check_blacklist(jti):
raise InvalidToken("Token is blacklisted. Please log in again.")
return False | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_blacklisted(token):\n if Revoked.query.filter_by(token=token).first():\n return True\n return False",
"def check_if_token_in_blacklist(decrypted_token):\n return (\n decrypted_token[\"jti\"] in BLACKLIST\n ) # if True, go to revoked_token_callback",
"de... | [
"0.7900954",
"0.74636424",
"0.74054307",
"0.73200846",
"0.7160083",
"0.71336967",
"0.6999018",
"0.697642",
"0.67577994",
"0.6653733",
"0.6649965",
"0.66363907",
"0.66145855",
"0.64979804",
"0.6386341",
"0.636993",
"0.63569194",
"0.6339204",
"0.63004833",
"0.62949896",
"0.6245... | 0.69158584 | 8 |
Checks only authenticated users can see the page | def test_csv_import_auth(self):
path = reverse("import-csv")
request = RequestFactory().get(path)
request.user = mixer.blend(User)
response = csv_import(request)
assert response.status_code == 200 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_authenticated(self, request, **kwargs):\r\n return True",
"def has_permission(self, request, view):\n if request.user.is_authenticated():\n return True\n return False",
"def is_allowed_to_submit(request):\n return not settings.REQUIRE_LOGIN or request.user.is_authentic... | [
"0.75106347",
"0.74165606",
"0.7196165",
"0.7195553",
"0.71893704",
"0.7175715",
"0.71588826",
"0.71588826",
"0.71588826",
"0.71588826",
"0.71588826",
"0.71588826",
"0.71588826",
"0.71113145",
"0.70598507",
"0.7030012",
"0.70088905",
"0.699589",
"0.69223857",
"0.69180375",
"0... | 0.0 | -1 |
Checks only authenticated users can see the page | def test_setting_csv_auth(self):
path = reverse("setting-csv")
request = RequestFactory().get(path)
request.user = mixer.blend(User)
response = csv_setting(request)
assert response.status_code == 200 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_authenticated(self, request, **kwargs):\r\n return True",
"def has_permission(self, request, view):\n if request.user.is_authenticated():\n return True\n return False",
"def is_allowed_to_submit(request):\n return not settings.REQUIRE_LOGIN or request.user.is_authentic... | [
"0.75106347",
"0.74165606",
"0.7196165",
"0.7195553",
"0.71893704",
"0.7175715",
"0.71588826",
"0.71588826",
"0.71588826",
"0.71588826",
"0.71588826",
"0.71588826",
"0.71588826",
"0.71113145",
"0.70598507",
"0.7030012",
"0.70088905",
"0.699589",
"0.69223857",
"0.69180375",
"0... | 0.0 | -1 |
Instantiate a new SchemaType | def __init__(self, raw_type: Dict):
self.kind = raw_type.get("kind")
self.name = raw_type.get("name")
self.description = raw_type.get("description")
self.fields: List[SchemaTypeField] = [SchemaTypeField(f) for f in raw_type.get("fields") or [] if f]
self.input_fields = [SchemaTy... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_schema(self, schema: str):\n return",
"def __init__(self, py_dict=None):\n super(TypeSchema, self).__init__()\n self.set_data_type('xml')\n\n self.typeName = None",
"def _schema_type(self) -> Optional[type]:\n return MovieSchema",
"def __init__(self, schema=None)... | [
"0.7132769",
"0.679428",
"0.6635432",
"0.659345",
"0.6592825",
"0.6465888",
"0.6453353",
"0.63999885",
"0.6380593",
"0.63766026",
"0.636462",
"0.63383156",
"0.6335716",
"0.63211817",
"0.62860376",
"0.6270915",
"0.625923",
"0.6207403",
"0.62045443",
"0.62017065",
"0.6196828",
... | 0.63470966 | 11 |
Parse the query type from the root schema. This can either return a string or None. The latter when the endpoint does not support queries. | def parse_query_type(raw_schema: Dict) -> Union[str, None]:
return Schema.parse_operation_type(raw_schema, "queryType") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def parse_operation_type(raw_schema: Dict, op_type: str) -> Union[str, None]:\n query_type = raw_schema.get(op_type, {})\n if not query_type:\n return None\n return query_type.get(\"name\")",
"def _schema_type(self) -> Optional[type]:\n return SearchMetaSchema",
"def _sch... | [
"0.70593387",
"0.5939255",
"0.5924762",
"0.5911261",
"0.5840816",
"0.57200265",
"0.57065624",
"0.5640995",
"0.5613772",
"0.5587588",
"0.55517954",
"0.54139596",
"0.53744495",
"0.5370533",
"0.53518116",
"0.5295712",
"0.52832526",
"0.5279426",
"0.52663785",
"0.52663785",
"0.526... | 0.8196511 | 0 |
Parse the mutation type from the root schema. This can either return a string or None. The latter when the endpoint does not support mutations. | def parse_mutation_type(raw_schema: Dict) -> Union[str, None]:
return Schema.parse_operation_type(raw_schema, "mutationType") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def parse_operation_type(raw_schema: Dict, op_type: str) -> Union[str, None]:\n query_type = raw_schema.get(op_type, {})\n if not query_type:\n return None\n return query_type.get(\"name\")",
"def set_mutation_type(self, mut_type=''):\n if mut_type:\n # specified... | [
"0.6133898",
"0.5771993",
"0.55856854",
"0.55424494",
"0.55416554",
"0.5471137",
"0.52651036",
"0.52617633",
"0.5190931",
"0.5140541",
"0.50858825",
"0.5052965",
"0.5041517",
"0.5041517",
"0.50238866",
"0.50197643",
"0.49824637",
"0.4972244",
"0.4961925",
"0.49438107",
"0.494... | 0.80457693 | 0 |
Parse an operation type from the root schema. This can either return a string or None. The latter when the endpoint does not support the passed by operation. | def parse_operation_type(raw_schema: Dict, op_type: str) -> Union[str, None]:
query_type = raw_schema.get(op_type, {})
if not query_type:
return None
return query_type.get("name") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def operation_type(self) -> pulumi.Output[Optional[str]]:\n return pulumi.get(self, \"operation_type\")",
"def get_operation_type(self, operation_name):\n # type: (Optional[str]) -> Optional[str]\n operations_map = self.operations_map\n if not operation_name and len(operations_map) ==... | [
"0.67735726",
"0.6728999",
"0.6351823",
"0.63367105",
"0.59829354",
"0.59829354",
"0.59829354",
"0.59829354",
"0.5836189",
"0.5831232",
"0.5829081",
"0.5590442",
"0.5587668",
"0.55367893",
"0.5521317",
"0.55096656",
"0.5479498",
"0.5452105",
"0.5383543",
"0.5341075",
"0.53038... | 0.79709095 | 0 |
Given a Unity Environment and a QNetwork, this method will generate a buffer of Experiences obtained by running the Environment with the Policy derived from the QNetwork. | def generate_trajectories(
env: BaseEnv, q_net: VisualQNetwork, buffer_size: int, epsilon: float
):
# Create an empty Buffer
buffer: Buffer = []
# Reset the environment
env.reset()
# Read and store the Behavior Name of the Environment
behavior_name = list(env.behavior_specs)[0]
# Read... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def collect_experiences(self):\n for i in range(self.num_frames_per_proc):\n # Do one agent-environment interaction\n\n preprocessed_obs0 = self.preprocess_obss(self.obs0, device=self.device)\n \n preprocessed_obs1 = self.preprocess_obss(self.obs1, device=self.dev... | [
"0.5506977",
"0.5496875",
"0.514291",
"0.5113934",
"0.49886903",
"0.4943921",
"0.49165386",
"0.49162146",
"0.48796564",
"0.48758185",
"0.48588508",
"0.48554084",
"0.4835768",
"0.48339865",
"0.4816758",
"0.48112303",
"0.47756678",
"0.47557953",
"0.47492647",
"0.4732167",
"0.47... | 0.63224953 | 0 |
Gets a plane from 3 points | def plane_equation(p1, p2, p3):
a1 = p2[0] - p1[0]
b1 = p2[1] - p1[1]
c1 = p2[2] - p1[2]
a2 = p3[0] - p1[0]
b2 = p3[1] - p1[1]
c2 = p3[2] - p1[2]
a = b1 * c2 - b2 * c1
b = a2 * c1 - a1 * c2
c = a1 * b2 - b1 * a2
# Points are collinear
if (abs(a) < 1e-6) and (abs(b) < 1e-6) an... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def project_3d_points_to_plane(points, p1, p2 ,p3, numpoints):\n p1 = np.asarray(p1)\n p2 = np.asarray(p2)\n p3 = np.asarray(p3)\n\n # get vectors in plane\n v1 = p3 - p1\n v2 = p2 - p1\n\n # compute cross product\n cp = np.cross(v1, v2)\n a, b, c = cp # normal to plane is ax + by + cz\n... | [
"0.75500053",
"0.75069356",
"0.7475429",
"0.7409829",
"0.7394293",
"0.72587293",
"0.70594555",
"0.6911756",
"0.68775445",
"0.6856724",
"0.68564415",
"0.68380785",
"0.68015355",
"0.68015355",
"0.67951053",
"0.67129314",
"0.6660467",
"0.66463685",
"0.6608463",
"0.6591655",
"0.6... | 0.7128078 | 6 |
Returns true if c is a printable character. We do this by checking for ord value above 32 (space), as well as CR (\r), LF (\n) and tab (\t) | def is_printable(c):
return ord(c)>=32 or c in ['\r','\n', '\t'] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_printable(s):\n for c in s:\n if c not in PRINTABLE_CHARACTERS:\n return False\n return True",
"def is_printable(b):\n return b in e(string.printable)",
"def is_p4d_printable(c):\n if ord(c) < 0x20:\n return False\n if ord(c) == 0x7F:\n return False\n re... | [
"0.77798957",
"0.7536381",
"0.7419245",
"0.7221991",
"0.718354",
"0.7084998",
"0.7084998",
"0.70768076",
"0.70703983",
"0.6941782",
"0.6763601",
"0.66158307",
"0.66158307",
"0.6564988",
"0.6561958",
"0.6391701",
"0.6390051",
"0.6385484",
"0.63393587",
"0.63295555",
"0.6323699... | 0.89795405 | 0 |
Create the root node of the BST. | def __init__(self, name):
debug.printMsg("We Initiated a BST with no root node")
self.name = name
self.root = None
self.size = 0 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_root(self):\n try:\n _check_call(_LIB.TreeliteTreeBuilderSetRootNode(\n self.tree.handle,\n ctypes.c_int(self.node_key)))\n except AttributeError:\n raise TreeliteError('This node has never been inserted into a tree; '\\\n + 'a node mu... | [
"0.7032419",
"0.6934794",
"0.68248075",
"0.67966664",
"0.6757742",
"0.6755082",
"0.67382634",
"0.67275465",
"0.67275465",
"0.6668411",
"0.6649478",
"0.66437757",
"0.6606337",
"0.6603094",
"0.6603094",
"0.65813065",
"0.65738034",
"0.6492516",
"0.6490673",
"0.6471958",
"0.64572... | 0.6229294 | 29 |
Initialisation, where df is a pandas DataFrame and var is the name of the column to study and init_pars is a dictionary with initial values | def __init__(self, df, Z, Q, H, T, R, d, c, var='dep_var', secondvar=None, method='iterate'):
self.method = method
# Initialize all the system matrices as attributes of the class
self.Z = Z
self.Q = Q
self.H = H
self.T = T
self.R = R
self.d = d
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self,df, init_pars, var='dep_var', var_name='Volume of Nile'):\n self.df = df\n self.var = var\n self.var_name = var_name\n self.y = np.array(df[var].values.flatten())\n self.times = df.index\n self.pardict = init_pars\n self.options = {'eps':1e-09,\n ... | [
"0.7032874",
"0.5726817",
"0.55134976",
"0.5488105",
"0.5354998",
"0.5293255",
"0.5284768",
"0.5283604",
"0.52450967",
"0.52211875",
"0.5218443",
"0.52158165",
"0.5208098",
"0.5172965",
"0.51615965",
"0.5151945",
"0.513557",
"0.51037365",
"0.5097976",
"0.5087936",
"0.50831324... | 0.5161708 | 14 |
Updates a torch model so that input minibatches are parallelized across the batch dimension to utilise multiple gpus. If model parallel is set to True and execution is in test mode, then model is partitioned to perform full volume inference. This assumes the model has been created, that the optimizer has not yet been c... | def _adjust_for_gpus(cls, model: DeviceAwareModule, config: ModelConfigBase,
model_execution_mode: ModelExecutionMode) -> DeviceAwareModule:
if config.use_gpu:
model = model.cuda()
logging.info("Adjusting the model to use mixed precision training.")
#... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def init_model_parallel(self, global_rank: int, world_size: int) -> None:\n app_state = AppState()\n\n # we initialize megatron-lm model parallel and data parallel groups\n # after initializing DDP with PTL.\n if app_state.model_parallel_size is not None:\n # destroy groups i... | [
"0.5936191",
"0.56602675",
"0.56224686",
"0.5621566",
"0.55595684",
"0.54760945",
"0.54551095",
"0.54427326",
"0.54231954",
"0.54035556",
"0.5396976",
"0.53836715",
"0.5365184",
"0.53514045",
"0.5305904",
"0.5280321",
"0.5267586",
"0.5260385",
"0.525179",
"0.5249681",
"0.5188... | 0.70964164 | 0 |
Loads a checkpoint of an optimizer. | def try_load_checkpoint_for_optimizer(self) -> bool:
if self._optimizer is None:
raise ValueError("Optimizer must be created before optimizer checkpoint can be loaded.")
if not self.checkpoint_path:
logging.warning("No checkpoint path provided.")
return False
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def load_checkpoint(path, model, optimizer=None, reset_optimizer=True):\n print(\"Load checkpoint from: {}\".format(path))\n state_dict, optimizer_state = _load(path)\n\n model.load_dict(state_dict)\n if not reset_optimizer and optimizer is not None:\n if optimizer_state is not None:\n ... | [
"0.83664644",
"0.80974585",
"0.80771816",
"0.80259275",
"0.7999482",
"0.79903316",
"0.7857532",
"0.7640271",
"0.75701135",
"0.748829",
"0.7443241",
"0.74228936",
"0.7389801",
"0.7375046",
"0.7372049",
"0.7315069",
"0.7312009",
"0.72855306",
"0.725681",
"0.7247519",
"0.7220198... | 0.7403394 | 12 |
Saves a checkpoint of the current model and optimizer_type parameters in the specified folder and uploads it to the output blob storage of the current run context. The checkpoint's name for epoch 123 would be 123_checkpoint.pth.tar. | def save_checkpoint(self, epoch: int) -> Path:
logging.getLogger().disabled = True
model_state_dict = self.model.module.state_dict() \
if isinstance(self.model, torch.nn.DataParallel) else self.model.state_dict()
checkpoint_file_path = self.config.get_path_to_checkpoint(epoch)
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _save_checkpoint(checkpoint, model_dir, checkpoint_prefix):\n\n checkpoint_path = os.path.join(model_dir, checkpoint_prefix)\n saved_path = checkpoint.save(checkpoint_path)\n logging.info('Saving model as TF checkpoint: %s', saved_path)\n return",
"def save_checkpoint(checkpoint_dir, epoch, iteration, sa... | [
"0.73279613",
"0.7212068",
"0.7110705",
"0.70985615",
"0.7074814",
"0.7049468",
"0.7041478",
"0.7008442",
"0.7005684",
"0.6975668",
"0.6948612",
"0.6930357",
"0.69280964",
"0.68722343",
"0.6871008",
"0.686374",
"0.6840294",
"0.67784363",
"0.6768815",
"0.6761419",
"0.6749226",... | 0.7023109 | 7 |
Initialize the weights of a Pytorch module. | def init_weights(m: Union[torch.nn.Conv3d, torch.nn.BatchNorm3d]) -> None:
import torch
if isinstance(m, torch.nn.Conv3d):
torch.nn.init.normal_(m.weight, 0, 0.01)
elif isinstance(m, torch.nn.BatchNorm3d):
torch.nn.init.constant_(m.weight, 1)
torch.nn.init.constant_(m.bias, 0) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _init_weights(module: nn.Module, name: str, head_bias: float = 0., flax=False):\n if isinstance(module, nn.Linear):\n if name.startswith('head'):\n nn.init.zeros_(module.weight)\n nn.init.constant_(module.bias, head_bias)\n else:\n if flax:\n # F... | [
"0.77734",
"0.7753587",
"0.76126516",
"0.76039255",
"0.75937414",
"0.7557966",
"0.75483835",
"0.75483835",
"0.75483835",
"0.7541337",
"0.75397253",
"0.7527526",
"0.74981326",
"0.7479258",
"0.7456155",
"0.74487233",
"0.74385613",
"0.74289656",
"0.74223495",
"0.74188006",
"0.73... | 0.0 | -1 |
Build a dictionary through a list of words | def buildDict(self, words: List[str]) -> None:
for word in words:
self.buckets[len(word)].append(word) | {
"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.7771935",
"0.7714796",
"0.76650697",
"0.75896126",
"0.7402118",
"0.7371921",
"0.7257023",
"0.724838",
"0.72190464",
"0.71511894",
"0.7121465",
"0.70906883",
"0.70329714",
"0.69910663",
"0.6939837",
"0.6926235",
"0.69013107",
"0.68620795",
"0.68157786",
"0.6809816",
"0.6763... | 0.75077 | 4 |
Returns if there is any word in the trie that equals to the given word after modifying exactly one character | def search(self, word: str) -> bool:
# # for candidate in self.buckets[len(word)]:
# # for a, b in zip(word, candidate):
# # result = any(sum(a!=b))
return any(sum(a!=b for a, b in zip(word, candidate)) == 1
for candidate in self.buckets[len(word)])
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_word(trie, string: str) -> bool:\n return any(w == string for w in trie)",
"def search(self, word):\n curr = self.trie\n for i, ch in enumerate(word):\n curr = curr.get(ch, {})\n if curr:\n continue\n else:\n break\n \n... | [
"0.7898829",
"0.77123356",
"0.76817137",
"0.7651471",
"0.74973875",
"0.7494274",
"0.7490946",
"0.7471417",
"0.7440383",
"0.7440078",
"0.74153924",
"0.74125475",
"0.73968333",
"0.7382937",
"0.73649126",
"0.7333139",
"0.73310703",
"0.7293905",
"0.729297",
"0.72762936",
"0.72757... | 0.664082 | 86 |
Load data from either a .json file, an open file pointer or a json string. Directly returns any other data. | def _load_json(self, kind, source, **kwargs):
if source is None:
raise exceptions.invalid_json_map[kind](f"Cannot load {kind} - no data source specified.")
# Decode the json string and deserialize to objects.
try:
data = load_json(source, **kwargs)
except FileNot... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _load_data_from_file(self, input_file_path):\n with FileOrBufferHandler(input_file_path, 'r', \n encoding=self.file_encoding) as input_file:\n try:\n data = json.load(input_file)\n except (json.JSONDecodeError, UnicodeDecodeError):\n ... | [
"0.74808633",
"0.7463258",
"0.7429995",
"0.7426092",
"0.73366517",
"0.72446245",
"0.7234326",
"0.7181051",
"0.7129091",
"0.71012217",
"0.7058075",
"0.70502263",
"0.7007759",
"0.6973326",
"0.69674516",
"0.6960993",
"0.69258857",
"0.69136333",
"0.6907644",
"0.6902104",
"0.68784... | 0.7064134 | 10 |
Validate that the installed version is consistent with an optional version specification in the twine file. | def _validate_twine_version(self, twine_file_twined_version):
installed_twined_version = pkg_resources.get_distribution("twined").version
logger.debug(
"Twine versions... %s installed, %s specified in twine", installed_twined_version, twine_file_twined_version
)
if (twine_fil... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_valid_version(self):\n pass",
"def validate_configurator_version():\n if settings.CONFIGURATOR_MODULE == \"bootmachine.contrib.configurators.salt\":\n pkgver = settings.SALT_AUR_PKGVER\n pkgrel = settings.SALT_AUR_PKGREL\n response = urllib2.urlopen(\"https://aur.archlinux.o... | [
"0.6902856",
"0.6780541",
"0.67345285",
"0.6424998",
"0.6407822",
"0.64057225",
"0.6383413",
"0.6376578",
"0.6337082",
"0.6273863",
"0.6264896",
"0.62600714",
"0.6233149",
"0.62270665",
"0.6219592",
"0.61668104",
"0.61236084",
"0.6105264",
"0.60952014",
"0.60824794",
"0.60168... | 0.7964266 | 0 |
custom function to remove the stopwords | def remove_stopwords(self,text):
return " ".join([word for word in str(text).split() if word not in self.STOPWORDS]) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def remove_stopwords_fun(self):\n tokens = str(self.doc).split()\n cleaned_tokens = [token for token in tokens\n if token.lower() not in self.stopword_list]\n self.doc = ' '.join(cleaned_tokens)",
"def remove_stopwords(text):\n stopwords = [\"i\", \"me\", \"my\", ... | [
"0.8823565",
"0.8401623",
"0.8289207",
"0.8228253",
"0.82197374",
"0.8181915",
"0.8181915",
"0.8181915",
"0.8181915",
"0.8164255",
"0.81541234",
"0.81183577",
"0.8115647",
"0.81121063",
"0.8105464",
"0.8080783",
"0.8072988",
"0.806302",
"0.80382043",
"0.80332667",
"0.7997704"... | 0.8248563 | 3 |
Create a nonce with timestamp included | def make_nonce():
time_format = '%Y-%m-%dT%H:%M:%SZ'
time_component = time.strftime(time_format, time.gmtime())
valid_chars = ''
# iterate over all the aschii characters for a list of all alpha-numeric characters
for char_index in range(0, 128):
if chr(char_index).isalpha() or chr(char_inde... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_nonce():\n default_seed = 'ifh2847fhsn\"lqOEYd@#Djh(&'\n hash = sha.new(default_seed)\n hash.update(str(datetime.utcnow()))\n return hash.hexdigest()",
"def generate_nonce():\n return str(int(round(time.time() * 1000)))",
"def _nonce():\n return str(round(100000 * time.time()) ... | [
"0.81308687",
"0.808096",
"0.78753763",
"0.7763684",
"0.7712205",
"0.7655275",
"0.7655275",
"0.7587932",
"0.7550162",
"0.7538623",
"0.7479432",
"0.74498117",
"0.74498117",
"0.7414203",
"0.7234778",
"0.713928",
"0.69921154",
"0.6871529",
"0.6782506",
"0.6731106",
"0.66884166",... | 0.8013038 | 2 |
Returns the default collector settings | def get_default_config(self):
config = super(YammerCollector, self).get_default_config()
config.update({
'path': 'yammer',
'url': 'http://127.0.0.1:8081/metrics',
'username': '',
'password': '',
})
return config | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_default_config(self):\r\n config = super(CMDCollector, self).get_default_config()\r\n config.update({\r\n 'enabled': 'True',\r\n 'fs': ',',\r\n 'timeout': 300,\r\n })\r\n return config",
"def getDefaultSettings():\n return {}",
"def ge... | [
"0.70514023",
"0.7008024",
"0.69490683",
"0.6713433",
"0.65743333",
"0.65309024",
"0.6521635",
"0.6515402",
"0.6466526",
"0.6447688",
"0.641337",
"0.6397818",
"0.6380512",
"0.63683224",
"0.6357208",
"0.6331759",
"0.63120294",
"0.62353724",
"0.6231899",
"0.62074906",
"0.620161... | 0.63517016 | 15 |
Checks that the email is not already in use | def clean_email(self):
# NOTE: all emails are stored in lower case
e = self.cleaned_data['email'].lower()
if User.objects.filter(email=e).count() > 0:
raise forms.ValidationError('An existing account is using that email address.')
return e | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def check_duplicate_email(self, email):\r\n request = self.req_factory.post('unused_url', data={\r\n 'new_email': email,\r\n 'password': 'test',\r\n })\r\n request.user = self.user\r\n self.assertFailedRequest(self.run_request(request), 'An account with this e-mail... | [
"0.7703849",
"0.69526696",
"0.6862401",
"0.6811217",
"0.6774223",
"0.67012995",
"0.6641258",
"0.6557139",
"0.65535825",
"0.6535207",
"0.6535207",
"0.6481211",
"0.64502555",
"0.63732386",
"0.63573235",
"0.63533545",
"0.633444",
"0.63318545",
"0.63180923",
"0.6309124",
"0.63064... | 0.6098911 | 40 |
Determines if a filename is a valid Python module. Assumes if is just the end of a path (i.e. does not contain ``os.path.sep``. | def is_valid_module(filename):
if not filename.endswith('.py'):
return False
if filename == '__init__.py':
return True
for prefix in IGNORED_PREFIXES:
if filename.startswith(prefix):
return False
return True | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_module(path: str) -> bool:\n return os.path.isfile(path) and path.endswith(\".py\")",
"def is_module(path):\n\n fname, ext = os.path.splitext(path)\n if ext == \".py\":\n return True\n elif os.path.exists(os.path.join(path, \"__init__.py\")):\n return True\n else:\n ret... | [
"0.78435075",
"0.7644184",
"0.7453708",
"0.74041945",
"0.72734565",
"0.7177794",
"0.7162914",
"0.6941581",
"0.688582",
"0.68661207",
"0.68447286",
"0.68002564",
"0.66656727",
"0.6652094",
"0.6552671",
"0.6495056",
"0.6463849",
"0.6461724",
"0.63578534",
"0.62999207",
"0.62551... | 0.73747915 | 4 |
Initialise parameters for MARL training | def __init__(
self, state_size, action_size, hidden_dim=128, state_rep_size=64, learning_rate=1e-5, eta=2
):
super(RND, self).__init__(state_size, action_size, eta)
self.hidden_dim = hidden_dim
self.state_rep_size = state_rep_size
self.learning_rate = learning_rate
s... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def initialize_parameters(self):\n for i in range(1, self.L):\n self.W[i - 1] = np.random.randn(self.layer_dims[i], self.layer_dims[i - 1]) * 0.01\n self.b[i - 1] = np.zeros((self.layer_dims[i], 1))",
"def params_init(self) -> None:\n # Initialize weights and biases with uniform d... | [
"0.7397329",
"0.7190591",
"0.7161128",
"0.7092822",
"0.7059068",
"0.6987178",
"0.6977974",
"0.69458026",
"0.6906171",
"0.68707854",
"0.6857603",
"0.6851031",
"0.6840059",
"0.6775705",
"0.6761099",
"0.6754401",
"0.67539597",
"0.6738152",
"0.6727141",
"0.6707005",
"0.6685758",
... | 0.0 | -1 |
Return True if command cmd has a compute/uncompute tag. | def _has_compute_uncompute_tag(cmd):
for tag in cmd.tags:
if tag in [UncomputeTag(), ComputeTag()]:
return True
return False | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _isCmdStandalone(tgen):\n features = getattr(tgen, 'features', [])\n otherFeatures = set(features) - set(('runcmd', ))\n return not otherFeatures and getattr(tgen, 'rule', None) is None",
"def isOp(self):\n return True",
"def is_cmd(self, name):\n \n return name in self.cmds",... | [
"0.581931",
"0.5786073",
"0.57732224",
"0.5759559",
"0.5728099",
"0.5650557",
"0.5638925",
"0.5607169",
"0.56052583",
"0.55509794",
"0.5506383",
"0.55021065",
"0.5499619",
"0.54725796",
"0.54692024",
"0.546461",
"0.5463064",
"0.5448807",
"0.5434303",
"0.5420862",
"0.5408913",... | 0.9016012 | 0 |
Sets "max age" for the starboard messages. If a message is older than the specified days, the message is ignored. Note that existing messages are not affected. Defaults to 7 (one week). | async def maxage(self, ctx, age: int):
if age > 0:
self.bot.db.execute("UPDATE starboards SET age = ? WHERE channel_id = ?", (age,ctx.channel.id))
await ctx.say("star.age", age)
await self.set_topic(ctx.channel.id)
else:
await ctx.say("star.unsigned", age) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def max_age(self, max_age):\n self._max_age = max_age",
"def max_age(self, max_age):\n\n self._max_age = max_age",
"def max_age(self, max_age):\n if (max_age is not None and max_age < -1): # noqa: E501\n raise ValueError(\"Invalid value for `max_age`, must be a value greater th... | [
"0.6970839",
"0.6911315",
"0.61830574",
"0.6088173",
"0.60299325",
"0.58305186",
"0.58305186",
"0.57887924",
"0.56967527",
"0.5692167",
"0.5583454",
"0.5548023",
"0.5548023",
"0.55217004",
"0.54962564",
"0.54864573",
"0.5448077",
"0.5405468",
"0.5401819",
"0.53459024",
"0.530... | 0.6915784 | 1 |
Enables/disables DM when your message was stared. If the parameter is not given, this returns current status. Can be used anywhere including DM. | async def star_dm(self, ctx, enable: bool = None):
if enable is None:
result = self.bot.db.execute("SELECT starboard_dm FROM users WHERE user_id = ?", (ctx.author.id,)).fetchone()
enabled = result["starboard_dm"] if result else 0
status_str = ctx._(f"star.dm{['Disabled', 'Ena... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"async def moderation(self, ctx):\n\n new_value = await self.toggle_dm_setting(ctx.author.id, \"ban_kick_mute\")\n\n if new_value:\n message = \":white_check_mark: You will now receive DMs when you get muted, kicked or banned by me.\"\n else:\n message = \":white_check_mar... | [
"0.64651364",
"0.59721977",
"0.5788894",
"0.5637827",
"0.559156",
"0.55866206",
"0.5582838",
"0.5560499",
"0.5545492",
"0.5535075",
"0.55287397",
"0.5520025",
"0.5509821",
"0.5500232",
"0.5459743",
"0.54503405",
"0.544722",
"0.54312956",
"0.5386221",
"0.5380486",
"0.53682333"... | 0.6530001 | 0 |
Return the minimum and maximum values in the input. | def minmax(seq, *, key=lambda x: x):
iterator1, iterator2 = tee(seq)
return MinMax(min(iterator1, key=key), max(iterator2, key=key)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def min_max(xs):\n return min(xs), max(xs)",
"def get_min_max(ints):\n if len(ints) <= 0:\n return ()\n min_value = ints[0]\n max_value = ints[0]\n for i in range(len(ints)):\n temp = ints[i]\n if temp <= min_value:\n min_value = temp\n if temp >= max_value:\... | [
"0.7975695",
"0.77930915",
"0.7780894",
"0.7709472",
"0.76314646",
"0.7625426",
"0.7577489",
"0.7568",
"0.75583875",
"0.74224806",
"0.7407902",
"0.7383869",
"0.7375017",
"0.73552513",
"0.7351573",
"0.72896475",
"0.72671056",
"0.7245023",
"0.721607",
"0.72126466",
"0.72114575"... | 0.0 | -1 |
StereoGroup atoms are in the reaction, but the reaction doesn't affect the chirality at the stereo centers > preserve stereo group | def test_reaction_preserves_stereo(self):
reaction = '[C@:1]>>[C@:1]'
reactants = ['F[C@H](Cl)Br |o1:1|', 'F[C@@H](Cl)Br |&1:1|', 'FC(Cl)Br']
for reactant in reactants:
products = _reactAndSummarize(reaction, reactant)
self.assertEqual(products, reactant) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_reaction_defines_stereo(self):\n products = _reactAndSummarize('[C:1]>>[C@@:1]', 'F[C@H](Cl)Br |o1:1|')\n self.assertEqual(products, 'F[C@@H](Cl)Br')\n products = _reactAndSummarize('[C:1]>>[C@@:1]', 'F[C@@H](Cl)Br |&1:1|')\n self.assertEqual(products, 'F[C@@H](Cl)Br')\n products = _reactAn... | [
"0.75458586",
"0.7168434",
"0.7091707",
"0.6843433",
"0.6454386",
"0.60892975",
"0.5650636",
"0.55933136",
"0.55537635",
"0.5514306",
"0.54825073",
"0.5466172",
"0.54264325",
"0.5393186",
"0.5328103",
"0.5303823",
"0.5297103",
"0.52903897",
"0.5283487",
"0.5206587",
"0.504461... | 0.5968604 | 6 |
StereoGroup atoms are in the reaction, but the reaction doesn't specify the chirality at the stereo centers > preserve stereo group | def test_reaction_ignores_stereo(self):
reaction = '[C:1]>>[C:1]'
reactants = ['F[C@H](Cl)Br |o1:1|', 'F[C@@H](Cl)Br |&1:1|', 'FC(Cl)Br']
for reactant in reactants:
products = _reactAndSummarize(reaction, reactant)
self.assertEqual(products, reactant) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_reaction_defines_stereo(self):\n products = _reactAndSummarize('[C:1]>>[C@@:1]', 'F[C@H](Cl)Br |o1:1|')\n self.assertEqual(products, 'F[C@@H](Cl)Br')\n products = _reactAndSummarize('[C:1]>>[C@@:1]', 'F[C@@H](Cl)Br |&1:1|')\n self.assertEqual(products, 'F[C@@H](Cl)Br')\n products = _reactAn... | [
"0.7502093",
"0.7083151",
"0.696663",
"0.6748644",
"0.6419238",
"0.5837475",
"0.576132",
"0.5678274",
"0.5618676",
"0.55914426",
"0.5525545",
"0.5486366",
"0.54649514",
"0.54351145",
"0.54303616",
"0.5415109",
"0.5333785",
"0.5333203",
"0.5273259",
"0.5203159",
"0.51855856",
... | 0.6020158 | 5 |
Function to instanciate the instrument. | def connect_instrument(self):
for instrument in self.rm.list_resources():
try:
k2400 = self.init_inst(instrument)
k2400.timeout = 5000
if k2400.query('*IDN?')[:8] == 'KEITHLEY':
return k2400
except AttributeError as f:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new_instrument(self, entry=\"entry\", instrument_name=\"id00\",):\n if not isinstance(entry, h5py.Group):\n entry = self.new_entry(entry)\n return self.new_class(entry, instrument_name, \"NXinstrument\")",
"def new_instrument(self, instrument_type):\r\n return self.instrument_... | [
"0.67939395",
"0.6719433",
"0.6655605",
"0.645817",
"0.6346724",
"0.6167076",
"0.6164952",
"0.5983404",
"0.59604347",
"0.5957381",
"0.58981216",
"0.58949465",
"0.5830187",
"0.58211017",
"0.5807674",
"0.580686",
"0.57869667",
"0.5773858",
"0.57293445",
"0.5729042",
"0.5718009"... | 0.0 | -1 |
Creates a new SnakemakeRule instance from a dict representation | def __init__(
self, rule_id, parent_id, input, output, local=False, template=None, **kwargs
):
self.rule_id = rule_id
self.parent_id = parent_id
self.input = input
self.output = output
self.local = local
self.template = template
self.params = kwargs | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def from_dict(cls, dictionary: Dict[str, Any]):\n return cls(**dictionary)",
"def from_dict(cls, data: Dict[str, any]):\n return cls(**data)",
"def from_dict(self, d):\r\n options = dict(d)\r\n task_id = options['task_id']\r\n del options['task_id']\r\n return SubtaskS... | [
"0.61375326",
"0.60902405",
"0.60286725",
"0.60125345",
"0.597105",
"0.5911886",
"0.5895749",
"0.5895749",
"0.5891623",
"0.5891623",
"0.5891623",
"0.5891623",
"0.5891623",
"0.5891623",
"0.5891623",
"0.5891623",
"0.5891623",
"0.5891623",
"0.5891623",
"0.5891623",
"0.5891623",
... | 0.0 | -1 |
Creates a new SnakemakeRule instance from a dict representation | def __init__(
self,
rule_id,
parent_id,
input,
output,
inline=True,
local=False,
template=None,
**kwargs
):
super().__init__(rule_id, parent_id, input, output, local, template, **kwargs)
self.inline = inline
self.groupp... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def from_dict(cls, dictionary: Dict[str, Any]):\n return cls(**dictionary)",
"def from_dict(cls, data: Dict[str, any]):\n return cls(**data)",
"def from_dict(self, d):\r\n options = dict(d)\r\n task_id = options['task_id']\r\n del options['task_id']\r\n return SubtaskS... | [
"0.61388683",
"0.60924554",
"0.603016",
"0.60145026",
"0.59718156",
"0.5911789",
"0.5897906",
"0.5897906",
"0.5892087",
"0.5892087",
"0.5892087",
"0.5892087",
"0.5892087",
"0.5892087",
"0.5892087",
"0.5892087",
"0.5892087",
"0.5892087",
"0.5892087",
"0.5892087",
"0.5892087",
... | 0.0 | -1 |
Creates a new SnakemakeRule instance from a dict representation | def __init__(self, rule_id, input, output, local=False, template=None, **kwargs):
super().__init__(rule_id, None, input, output, local, template, **kwargs) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def from_dict(cls, dictionary: Dict[str, Any]):\n return cls(**dictionary)",
"def from_dict(cls, data: Dict[str, any]):\n return cls(**data)",
"def from_dict(self, d):\r\n options = dict(d)\r\n task_id = options['task_id']\r\n del options['task_id']\r\n return SubtaskS... | [
"0.61375326",
"0.60902405",
"0.60286725",
"0.60125345",
"0.597105",
"0.5911886",
"0.5895749",
"0.5895749",
"0.5891623",
"0.5891623",
"0.5891623",
"0.5891623",
"0.5891623",
"0.5891623",
"0.5891623",
"0.5891623",
"0.5891623",
"0.5891623",
"0.5891623",
"0.5891623",
"0.5891623",
... | 0.0 | -1 |
Creates a new SnakemakeRule instance from a dict representation | def __init__(self, input, output, options, local=False):
super().__init__(
"create_training_set",
None,
input,
output,
local,
"multi_training_set.snakefile",
)
self.options = options | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def from_dict(cls, dictionary: Dict[str, Any]):\n return cls(**dictionary)",
"def from_dict(cls, data: Dict[str, any]):\n return cls(**data)",
"def from_dict(self, d):\r\n options = dict(d)\r\n task_id = options['task_id']\r\n del options['task_id']\r\n return SubtaskS... | [
"0.61378634",
"0.60913914",
"0.6031257",
"0.6013804",
"0.59718573",
"0.591209",
"0.5898094",
"0.5898094",
"0.5891009",
"0.5891009",
"0.5891009",
"0.5891009",
"0.5891009",
"0.5891009",
"0.5891009",
"0.5891009",
"0.5891009",
"0.5891009",
"0.5891009",
"0.5891009",
"0.5891009",
... | 0.0 | -1 |
Creates a new ReportRule instance from a dict representation | def __init__(self, rule_id, input, output, rmd, title, name, metadata, styles, theme, local=False, **kwargs):
super().__init__(rule_id, None, input, output, local, **kwargs)
self.rmd = rmd
self.title = title
self.name = name
self.metadata = metadata
self.styles = styles
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def from_dictionary(cls,\r\n dictionary):\r\n if dictionary is None:\r\n return None\r\n\r\n # Extract variables from the dictionary\r\n id = dictionary.get('id')\r\n consumer_id = dictionary.get('consumerId')\r\n consumer_ssn = dictionary.get('c... | [
"0.61548984",
"0.6064839",
"0.5945463",
"0.59221816",
"0.591966",
"0.591966",
"0.591966",
"0.591966",
"0.591966",
"0.591966",
"0.591966",
"0.591966",
"0.591966",
"0.591966",
"0.591966",
"0.591966",
"0.591966",
"0.591966",
"0.591966",
"0.591966",
"0.591966",
"0.591966",
"0... | 0.0 | -1 |
Creates a new SnakemakeRuleGroup instance from a dict representation | def __init__(
self, rule_id, parent_id, group_actions, input, output, local=False, **kwargs
):
self.rule_id = rule_id
self.parent_id = parent_id
self.input = input
self.output = output
self.local = local
self.params = kwargs
self.groupped = True
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def from_json(value):\r\n for key in ('id', 'name', 'version'):\r\n if key not in value:\r\n raise TypeError(\"Group dict {0} missing value key '{1}'\".format(\r\n value, key))\r\n\r\n if value[\"version\"] != Group.VERSION:\r\n raise TypeError(... | [
"0.6249006",
"0.60356647",
"0.59878504",
"0.58986735",
"0.5808315",
"0.57978857",
"0.56254345",
"0.55351543",
"0.54451144",
"0.5398016",
"0.53898287",
"0.5336041",
"0.5296309",
"0.5290205",
"0.52836525",
"0.5264334",
"0.52494353",
"0.52434814",
"0.52236265",
"0.5214074",
"0.5... | 0.50452054 | 83 |
Creates a new DataIntegrationRule instance from a dict representation | def __init__(self, rule_id, inputs, output, local=False, template=None, **kwargs):
self.rule_id = rule_id
self.inputs = inputs
self.output = output
self.local = local
self.template = template
self.params = kwargs | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def from_dict(cls, data):\n return cls(**data)",
"def from_dict(cls, data: Dict[str, any]):\n return cls(**data)",
"def _from_dict(cls, d):\n confidence = d.get(\"confidence\", None)\n constant = d.get(\"constant\", False)\n tags = d.get(\"tags\", None)\n return cls(\n... | [
"0.6742197",
"0.65646493",
"0.6552889",
"0.648437",
"0.63919514",
"0.6375292",
"0.6365639",
"0.62918556",
"0.62024546",
"0.62024546",
"0.62024546",
"0.62024546",
"0.62024546",
"0.62024546",
"0.62024546",
"0.62024546",
"0.62024546",
"0.62024546",
"0.62024546",
"0.62024546",
"0... | 0.0 | -1 |
Compute the joint positions which approximately result in a given end effector position. | def inverse_kinematics(self, finger_id, xdes, q0, tol=0.001, max_iter=20):
iter = 0
q = self._project_onto_constraints(q0)
xcurrent = self.forward_kinematics(q)[finger_id]
error = np.linalg.norm(xdes - xcurrent)
dt = 1.0
prev_error = np.inf
while error > tol and (... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_joint_positions(self, joint_angles ): \n\n\n # current angles\n res_joint_angles = joint_angles.copy() \n\n # detect limits\n maskminus= res_joint_angles > self.joint_lims[:,0]\n maskplus = res_joint_angles < self.joint_lims[:,1]\n \n res_joint_angles = res_joi... | [
"0.6462823",
"0.63993484",
"0.5633511",
"0.5578069",
"0.5572044",
"0.55286443",
"0.549767",
"0.54915667",
"0.5486143",
"0.5462283",
"0.5461075",
"0.54595315",
"0.54163367",
"0.5408067",
"0.5399364",
"0.53867376",
"0.53730583",
"0.536113",
"0.533599",
"0.5330091",
"0.5328494",... | 0.0 | -1 |
Unhexlify raw text, return unhexlified text. | def unhexlify(text):
unhexlified = binascii.unhexlify(text)
if six.PY3:
unhexlified = unhexlified.decode('utf-8')
return unhexlified | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def hexlify(text):\n if six.PY3:\n text = text.encode('utf-8')\n\n hexlified = binascii.hexlify(text)\n\n if six.PY3:\n hexlified = hexlified.decode('utf-8')\n\n return hexlified",
"def test_unhexlify_not_python():\n assert '' == uflash.unhexlify(\n ':020000040003F7\\n:10E0... | [
"0.76805043",
"0.724818",
"0.71128637",
"0.6909091",
"0.6862392",
"0.6219935",
"0.6197366",
"0.59515",
"0.5922873",
"0.5843483",
"0.57907474",
"0.5650561",
"0.56349534",
"0.56267136",
"0.55028135",
"0.550243",
"0.5497304",
"0.54252976",
"0.5407516",
"0.53313655",
"0.52876633"... | 0.8604057 | 0 |
thermodynmic estimator of the kinetic energy | def thermodynamic_kinetic(paths,lam,tau):
nslice,nptcl,ndim,nconf = paths.shape
ke = ndim*nptcl/2./tau * np.ones(nconf)
for islice in range(nslice):
r2_arr = (paths[islice]-paths[(islice+1)%nslice])**2. # (nptcl,ndim,nconf)
r2 = r2_arr.sum(axis=0).sum(axis=0) # (nconf,)
ke -= r2/(4.*lam*tau**2.)/nslic... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def price_heston_mc(kappa_,theta_,sigma_,rho_,r_,T_,L_,V0_,S0_,K0_,N_):\r\n esp_ = monte_carlo(kappa_,theta_,sigma_,rho_,r_,T_,L_,V0_,S0_,K0_,N_)\r\n return exp(-r_*T_)*esp_",
"def kineticEnergy(self):\n return self.params['kinetic']",
"def energyK(k):\r\n C1 = 9.7846113e-07\r\n C2 = 12.2638... | [
"0.685864",
"0.6753086",
"0.66774917",
"0.65416646",
"0.64236945",
"0.6406966",
"0.6316658",
"0.6298241",
"0.6277267",
"0.6244753",
"0.62259036",
"0.62029636",
"0.61880386",
"0.61798847",
"0.6175505",
"0.6172549",
"0.6145199",
"0.6102385",
"0.6071389",
"0.6060328",
"0.6001661... | 0.6054048 | 20 |
Get the coarseness of area. Coarseness is calculated by dividing surface area of a surface by number of triangles in that surface. inputs | def get_coarseness(my_core, meshset, entity_ranges, geom_dim):
coarseness = []
for surface in entity_ranges:
surf_area = get_area_triangle(my_core, surface, geom_dim)
coarseness.append(len(surf_area)/sum(surf_area))
return coarseness | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def compute_surface_area(self):\n return np.sum(self._find_triangle_areas())",
"def compute_area(self):\r\n\r\n \"\"\"Косое произведение векторов\r\n A = (x2-x1; y2-y1; z2-z1)\r\n B = (x3-x1; y3-y1; z3-z1)\r\n S = 0.5*sqrt((Ay*Bz - Az*By)^2 + (Az*Bx - Ax*Bz)^2 + (Ax*By - Ay*Bx)... | [
"0.72606695",
"0.69087756",
"0.6878328",
"0.6759182",
"0.66357255",
"0.662495",
"0.6603431",
"0.6533843",
"0.65235794",
"0.6498596",
"0.64894485",
"0.643404",
"0.64310247",
"0.63980806",
"0.63846767",
"0.6348388",
"0.6340205",
"0.63149506",
"0.62920696",
"0.62676907",
"0.6259... | 0.6548548 | 7 |
returns a scikitlearn style model/pipeline | def get_model(name):
try:
from .model_defs import get_model_from_def
model = get_model_from_def(name)
logger.info("Model {n} loaded from model_defs module".format(n=name))
except NameError:
try:
model = get_model_from_yaml(name)
logger.info("Model {n} loa... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def make_pipeline():\n universe = TradableStocksUS('Real Estate') | TradableStocksUS('Utilities') | \\\n TradableStocksUS('Consumer Staples') | TradableStocksUS('Technology') | \\\n TradableStocksUS('Financials') | TradableStocksUS('Energy') | ... | [
"0.62133336",
"0.619528",
"0.6192642",
"0.6129727",
"0.60924697",
"0.60888034",
"0.60504484",
"0.59715533",
"0.59501135",
"0.5866584",
"0.58635634",
"0.5856176",
"0.57757",
"0.5774506",
"0.5752574",
"0.5752574",
"0.5741443",
"0.5726265",
"0.5723943",
"0.5714648",
"0.57145613"... | 0.0 | -1 |
Return a sklearn model pipeline from a model_dict | def get_model_from_dict(model_dict):
pipe_list = []
if 'transforms' in model_dict:
# For basic scikit-learn transforms
transforms = model_dict['transforms'].copy()
if 'scaler' in transforms:
scaler = transforms.pop('scaler')
pipe_list.append(get_scaler(scaler))
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def make_pipeline(model):\n\n steps = [\n (\"imp\", SimpleImputer(strategy=\"most_frequent\")),\n (\"norm\", MinMaxScaler()),\n (\"reg\", model)\n ]\n pipeline = Pipeline(steps=steps)\n\n return pipeline",
"def build_model():\n # Build ML pipeline using random forest classifie... | [
"0.6688918",
"0.64640874",
"0.64640874",
"0.6416069",
"0.6381701",
"0.636211",
"0.6302781",
"0.62598276",
"0.62242967",
"0.6168712",
"0.6149896",
"0.6133813",
"0.6130566",
"0.61174124",
"0.6096542",
"0.6070486",
"0.6065497",
"0.60585046",
"0.6046623",
"0.6042597",
"0.603112",... | 0.771603 | 0 |
Return a markov wrapper for a pipeline. | def get_markov_wrapper(pipe, kwargs):
from .transforms import MarkovWrapper
return MarkovWrapper(pipe, **kwargs) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def build_own_pipeline() -> Pipeline:\n clf = svm.LinearSVC(C=2, loss='hinge')\n vect = TfidfVectorizer(ngram_range=(1, 2))\n\n pipeline = None\n ##### Write code here #######\n pipeline = Pipeline([\n ('vect', vect),\n ('tfidf', TfidfTransformer()),\n ('clf', clf)\n ])\n ... | [
"0.6571192",
"0.6444065",
"0.6408322",
"0.60807306",
"0.6047931",
"0.5914984",
"0.59031147",
"0.58204484",
"0.5804149",
"0.5747107",
"0.5725643",
"0.5704614",
"0.5703797",
"0.56960964",
"0.56624687",
"0.56623226",
"0.5654284",
"0.562496",
"0.5591383",
"0.55484897",
"0.5527152... | 0.83327645 | 0 |
Gated recurrent unit (GRU) with nunits cells. | def call(self, inputs, state):
x, new = inputs
while len(state.get_shape().as_list()) > len(new.get_shape().as_list()):
new = tf.expand_dims(new,len(new.get_shape().as_list()))
h = state * (1.0 - new)
hx = tf.concat([h, x], axis=1)
mr = tf.sigmoid(tf.matmul(hx, self.w... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def build_gru_cell(num_units, dropout):\n cell = tf.nn.rnn_cell.GRUCell(num_units)\n if dropout:\n result = tf.nn.rnn_cell.DropoutWrapper(cell,\n output_keep_prob=1-dropout)\n return result",
"def _initialize_gru_cell(self, num_units):\n return gru_cell.Laye... | [
"0.721755",
"0.66543376",
"0.6298048",
"0.62718433",
"0.5896392",
"0.5840149",
"0.57050383",
"0.5683324",
"0.56716853",
"0.5620621",
"0.56158394",
"0.56078464",
"0.55852866",
"0.5582799",
"0.5549927",
"0.55428386",
"0.5535521",
"0.551115",
"0.5498461",
"0.54404557",
"0.538380... | 0.0 | -1 |
Return true if set s contains value v as an element. >>> s = Link(1, Link(3, Link(2))) >>> contains(s, 2) True >>> contains(s, 4) False | def contains(s, v):
head = s
while not empty(head):
if head.first == v:
return True
head = head.rest
return False | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __contains__(self, v):\n for i in self:\n if v in i:\n return True\n False",
"def contains(s, v):\n if empty(s):\n return False\n elif s.first == v:\n return True\n else:\n return contains(s.rest, v)",
"def has(self, v):\n return ... | [
"0.7584771",
"0.7085561",
"0.6912982",
"0.6782562",
"0.6782562",
"0.6781164",
"0.6648094",
"0.6498835",
"0.647441",
"0.64625543",
"0.6434304",
"0.64121056",
"0.6409181",
"0.64012474",
"0.63954437",
"0.6387302",
"0.63849604",
"0.6380661",
"0.634651",
"0.63379276",
"0.63075536"... | 0.7024014 | 2 |
Returns area of a circle | def area(self):
return math.pi * self._r ** 2 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def circle_area(circle):\n return pi * circle.radius * circle.radius",
"def area_of_circle(radius):\n return radius",
"def circle_area(radius):\n area = radius ** 2 * math.pi\n return area",
"def area(self):\n\t\t#print (self.radius*self.radius*math.pi)\n\t\tcircle_area = (self.radius*self.radius... | [
"0.9091267",
"0.8981688",
"0.87279946",
"0.8713818",
"0.8643989",
"0.8638605",
"0.85790324",
"0.8510922",
"0.84058666",
"0.84058666",
"0.8388797",
"0.8306146",
"0.82901704",
"0.8135795",
"0.8114081",
"0.8105787",
"0.8105787",
"0.8066629",
"0.8049314",
"0.8016954",
"0.80149436... | 0.7715051 | 29 |
Get vertices dividing a 1d grid. | def get_1d_vertices(grid, cut_edges=False):
if len(grid.shape) > 1:
raise ValueError("grid must be 1d array.")
diff = np.diff(grid)
vert = np.zeros(grid.size+1)
# Interior vertices: halfway between points
vert[1:-1] = grid[0:-1] + diff/2
# Edge vertices: tight or reflect
if cut_edge... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def vertices(self):\n try:\n return self._vertices\n except:\n self._vertices = [list(x) for x in self.vertex_generator()]\n return self._vertices",
"def vertices(self):\n\n if self._faces is None:\n if self._vertices is None:\n retu... | [
"0.6591957",
"0.65517676",
"0.6523746",
"0.6520511",
"0.64833",
"0.64833",
"0.64218307",
"0.6383808",
"0.6376488",
"0.63350326",
"0.6328131",
"0.63177186",
"0.6316762",
"0.6278034",
"0.6251261",
"0.6179584",
"0.61629945",
"0.6152223",
"0.61260945",
"0.6122966",
"0.6108887",
... | 0.76482964 | 0 |
Select plane from dataset. Intended for use with e.g. plt.pcolor. | def get_plane(dset, xaxis, yaxis, slices, **kw):
# Build quad meshes from sorted grids
xgrid = dset.dims[xaxis][0][indices[xaxis]]
ygrid = dset.dims[yaxis][0][indices[yaxis]]
xorder = np.argsort(xgrid)
yorder = np.argsort(ygrid)
xmesh, ymesh = quad_mesh(xgrid[xorder], ygrid[yorder], **kw)
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def GetPlane(plane):\r\n pass",
"def plane(self):\n return plane(self.N, self.o)",
"def get_plane(self, scalar, plane, pval):\n\n if plane == 'yz' or plane == 'zy':\n # z along rows, y along columns\n return scalar[:, pval, :]\n elif plane == 'xz' or plane == '... | [
"0.63480055",
"0.62466025",
"0.6210041",
"0.6181447",
"0.60752785",
"0.59501004",
"0.5885949",
"0.5844385",
"0.5806675",
"0.57641417",
"0.5717144",
"0.5657449",
"0.5650415",
"0.5615462",
"0.5605463",
"0.55464685",
"0.55369604",
"0.5516311",
"0.5514092",
"0.5510669",
"0.551001... | 0.5889004 | 6 |
Add headers to both force latest IE rendering engine or Chrome Frame, and also to cache the rendered page for 10 minutes. | def add_header(r):
r.headers["Cache-Control"] = "no-cache, no-store, must-revalidate"
r.headers["Pragma"] = "no-cache"
r.headers["Expires"] = "0"
r.headers['Cache-Control'] = 'public, max-age=0'
return r | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_header(response):\n response.headers['X-UA-Compatible'] = 'IE=Edge,chrome=1'\n response.headers['Cache-Control'] = 'public, max-age=60'\n return response",
"def add_header(response):\n response.headers['X-UA-Compatible'] = 'IE=Edge,chrome=1'\n response.headers['Cache-Control'] = 'public, m... | [
"0.82239413",
"0.8223081",
"0.8223081",
"0.8223081",
"0.8223081",
"0.8196386",
"0.8163827",
"0.8163827",
"0.8163827",
"0.8163827",
"0.8163827",
"0.8163827",
"0.8163827",
"0.8163827",
"0.8163827",
"0.8163827",
"0.8163827",
"0.8163827",
"0.8163827",
"0.8163827",
"0.8163827",
... | 0.71290123 | 63 |
Create a 3D rotation matrix for rotation about xaxis. (1 0 0 ) R(theta) = (0 cos(x) sin(x)) (0 sin(x) cos(x)) | def rotation3Dx(theta):
rmat = np.zeros((3,3))
rmat[0,0], rmat[0,1], rmat[0,2] = 1.0, 0.0, 0.0
rmat[1,0], rmat[1,1], rmat[1,2] = 0.0, np.cos(theta), np.sin(theta)
rmat[2,0], rmat[2,1], rmat[2,2] = 0.0, -np.sin(theta), np.cos(theta)
return rmat | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def matrix_rotate_3d_x(deg: float) -> np.matrix:\n from numpy import cos, sin, pi\n rad_x = -deg * pi/180\n c_x = cos(rad_x)\n s_x = sin(rad_x)\n return np.matrix([[1, 0, 0], [0, c_x, -s_x], [0, s_x, c_x]])",
"def rotation3D_x(angle: float) -> np.array:\n c = np.cos(angle)\n s = np.sin(angle... | [
"0.80429703",
"0.77990216",
"0.77074045",
"0.76701725",
"0.7432882",
"0.7401681",
"0.73251915",
"0.7267913",
"0.71938413",
"0.71556383",
"0.70411855",
"0.7036028",
"0.70312065",
"0.7028589",
"0.7012928",
"0.69417447",
"0.692393",
"0.68872285",
"0.6844814",
"0.6838681",
"0.680... | 0.78315115 | 1 |
Create a 3D rotation matrix for rotation about zaxis. ( cos(x) sin(x) 0) R(theta) = (sin(x) cos(x) 0) ( 0 0 1) | def rotation3Dz(theta):
rmat = np.zeros((3,3))
rmat[0,0] = rmat[1,1] = np.cos(theta)
rmat[0,1] = np.sin(theta)
rmat[1,0] = -rmat[0,1]
rmat[2,2] = 1
return rmat | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def matrix_rotate_3d_z(deg: float) -> np.matrix:\n from numpy import cos, sin, pi\n rad_z = -deg * pi/180\n c_z = cos(rad_z)\n s_z = sin(rad_z)\n return np.matrix([[c_z, -s_z, 0], [s_z, c_z, 0], [0, 0, 1]])",
"def rotation3D_z(angle: float) -> np.array:\n c = np.cos(angle)\n s = np.sin(angle... | [
"0.8186974",
"0.802003",
"0.7951418",
"0.76159006",
"0.75433534",
"0.74739504",
"0.7473712",
"0.7445926",
"0.7439543",
"0.74234265",
"0.736115",
"0.7298137",
"0.7291585",
"0.72050965",
"0.7194949",
"0.7179259",
"0.71736616",
"0.71396255",
"0.71220154",
"0.71090776",
"0.709833... | 0.84704345 | 0 |
Users can specify environment variables in their config file which will be set in the driver and worker environments. Make sure those variables are set during the workflow, but not after. | def test_workflow_environment():
config = {
"workflow-name": "workflow",
"cluster-type": CLUSTER_TYPE,
"environment-variables": {
"FOO": "BAR",
"FOO2": "BAR2"
}
}
template_dir = tempfile.mkdtemp(suffix="test-workflow-environment-template")
with... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def env_config():\n # setup\n env = {'ELB_GCP_PROJECT': 'expected-gcp-project',\n 'ELB_GCP_REGION': 'expected-gcp-region',\n 'ELB_GCP_ZONE': 'expected-gcp-zone',\n 'ELB_BATCH_LEN': '93',\n 'ELB_CLUSTER_NAME': 'expected-cluster-name',\n 'ELB_RESULTS': 'gs://ex... | [
"0.70271873",
"0.7026732",
"0.69392926",
"0.69331855",
"0.68138427",
"0.6760369",
"0.6758569",
"0.6714527",
"0.67041445",
"0.66552407",
"0.65845776",
"0.65845776",
"0.65845776",
"0.65845776",
"0.65845776",
"0.65845776",
"0.6584399",
"0.65421516",
"0.6530069",
"0.6528909",
"0.... | 0.7265635 | 0 |
Get the contact's first name. | def _get_contact_first_name(app):
name = app.get(CONTACT_NAME_KEY)
if name:
return ' {}'.format(name.split(' ')[0]) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_first_name(self):\n return self._first_name",
"def get_first_name(self) -> str:\n return self.first_name",
"def first_name(self):\n return self._first_name",
"def first_name(self):\n return self._first_name",
"def first_name(self):\n return self._first_name",
"d... | [
"0.86260074",
"0.8617128",
"0.8315871",
"0.8315871",
"0.8315871",
"0.8312541",
"0.81962097",
"0.8183392",
"0.8183392",
"0.80284345",
"0.7993891",
"0.7896602",
"0.7896602",
"0.78449786",
"0.7739931",
"0.77090037",
"0.7706754",
"0.7706754",
"0.7706754",
"0.7706754",
"0.7706754"... | 0.8650525 | 0 |
Get the subject to send with the email. | def _get_email_subject(app_name):
return '{} <==> Tote'.format(app_name) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def subject(self):\n return self.mail.get('Subject')",
"def getSubject(self):\r\n return self.msg[\"Subject\"]",
"def subject(self):\n return self.properties.get(\"subject\", None)",
"def get_subject(self):\n return self._subject",
"def subject(self):\n return self.get(\"subj... | [
"0.85039127",
"0.84494317",
"0.79497236",
"0.7938282",
"0.7885958",
"0.7774435",
"0.7774435",
"0.7769633",
"0.77543914",
"0.77393216",
"0.7721028",
"0.76066816",
"0.74656695",
"0.74626553",
"0.7323837",
"0.7316676",
"0.7280974",
"0.7280175",
"0.72613007",
"0.72613007",
"0.712... | 0.6934014 | 21 |
Get the email template name for the first contact email. | def _get_first_contact_email_template_name(app):
return app[FIRST_CONTACT_EMAIL_TEMPLATE_NAME_KEY] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_template_name(self):\n template = None\n if self.template:\n template = self.template\n if not template:\n for p in self.get_ancestors(ascending=True):\n if p.template:\n template = p.template\n break\n ... | [
"0.68836665",
"0.6812669",
"0.66186845",
"0.66120255",
"0.6575655",
"0.6516548",
"0.64882386",
"0.64112824",
"0.63238996",
"0.6301571",
"0.6288311",
"0.6213783",
"0.6116907",
"0.60900533",
"0.6080471",
"0.6079054",
"0.60654145",
"0.6055386",
"0.60473263",
"0.60457283",
"0.603... | 0.87440306 | 0 |
Gets the tote store url for this app. | def _get_app_tote_store_url(app):
return app[APP_TOTE_STORE_URL] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getNoteStoreUrl(self, authenticationToken):\r\n pass",
"def getNoteStoreUrl(self, authenticationToken):\r\n self.send_getNoteStoreUrl(authenticationToken)\r\n return self.recv_getNoteStoreUrl()",
"def get_store_path(cls):\n user_data_dir = cls.user_data_dir()\n store_path = os.path.j... | [
"0.6696655",
"0.64120066",
"0.6146364",
"0.5828228",
"0.57313335",
"0.5705295",
"0.56562585",
"0.5626252",
"0.5613728",
"0.5612579",
"0.5582851",
"0.555923",
"0.555923",
"0.5541939",
"0.5541939",
"0.5510885",
"0.55108297",
"0.5492612",
"0.5492612",
"0.5468174",
"0.54611695",
... | 0.84141535 | 0 |
Sets the name of this ClairpbVulnerability. | def name(self, name):
self._name = name | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_name(self, name):\n self.name = name # overwrite the existing name with the input name",
"def set_name(self, name):\n self.name = name # overwrite the existing name with the input name",
"def set_name(self, name):\n self.name = name",
"def set_name(self, name):\n self.na... | [
"0.7476369",
"0.7476369",
"0.74305564",
"0.74305564",
"0.74305564",
"0.74305564",
"0.74305564",
"0.7423173",
"0.73924625",
"0.73535186",
"0.73535186",
"0.73509634",
"0.7336383",
"0.7328558",
"0.7323258",
"0.73170054",
"0.71923685",
"0.71672845",
"0.71672845",
"0.71484566",
"0... | 0.0 | -1 |
Sets the namespace_name of this ClairpbVulnerability. | def namespace_name(self, namespace_name):
self._namespace_name = namespace_name | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_namespace(self, namespace: str) -> None:\n self._namespace = namespace",
"def namespace(self, namespace: str):\n\n self._namespace = namespace",
"def namespace(self, namespace):\n\n self._namespace = namespace",
"def namespace(self, namespace):\n\n self._namespace = namesp... | [
"0.7218368",
"0.6848428",
"0.6652187",
"0.6652187",
"0.6394273",
"0.61235774",
"0.60623956",
"0.59424466",
"0.5783313",
"0.57451713",
"0.57072073",
"0.56936276",
"0.56725025",
"0.5653841",
"0.5579495",
"0.55766636",
"0.55388397",
"0.5538237",
"0.5520687",
"0.55004734",
"0.539... | 0.7917395 | 0 |
Sets the description of this ClairpbVulnerability. | def description(self, description):
self._description = description | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_description(self, description):\r\n self.__description = description",
"def set_description(self, description):\n self.description = description",
"def set_description(self, description):\n self.__description = description",
"def description(self, description):\n self._des... | [
"0.72097325",
"0.7180765",
"0.7136288",
"0.7065354",
"0.7065354",
"0.7065354",
"0.7065354",
"0.7059732",
"0.70556676",
"0.7041413",
"0.6891786",
"0.6891786",
"0.6891786",
"0.6891786",
"0.68883944",
"0.68043464",
"0.670095",
"0.66983426",
"0.6676779",
"0.6659177",
"0.6595515",... | 0.69659215 | 38 |
Sets the fixed_by of this ClairpbVulnerability. | def fixed_by(self, fixed_by):
self._fixed_by = fixed_by | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def fixed_amount(self, fixed_amount):\n\n self._fixed_amount = fixed_amount",
"def fixed_amount(self, fixed_amount):\n\n self._fixed_amount = fixed_amount",
"def issued_by(self, issued_by):\n\n self._issued_by = issued_by",
"def mitigated_by(self, mitigated_by):\n\n self._mitigate... | [
"0.6088768",
"0.6088768",
"0.60354835",
"0.594974",
"0.56890184",
"0.5542011",
"0.5290293",
"0.5184325",
"0.5179588",
"0.51558876",
"0.51558876",
"0.51558876",
"0.51558876",
"0.51558876",
"0.51558876",
"0.5038125",
"0.4941069",
"0.49050403",
"0.479892",
"0.47826055",
"0.47764... | 0.8097117 | 0 |
Sets the affected_versions of this ClairpbVulnerability. | def affected_versions(self, affected_versions):
self._affected_versions = affected_versions | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def vulnerabilities(self, vulnerabilities):\n\n self._vulnerabilities = vulnerabilities",
"def vulnerabilities(self, vulnerabilities):\n\n self._vulnerabilities = vulnerabilities",
"def versions(self, versions):\n\n self._versions = versions",
"def set_versions(self, consumer, versions):... | [
"0.609255",
"0.609255",
"0.59750617",
"0.5626721",
"0.54159355",
"0.51944435",
"0.51533484",
"0.5120908",
"0.50574327",
"0.50420326",
"0.50411284",
"0.50248915",
"0.48979875",
"0.4828377",
"0.48191965",
"0.4787847",
"0.46811602",
"0.4634885",
"0.46162087",
"0.4607605",
"0.460... | 0.8137943 | 0 |
Returns true if both objects are equal | def __eq__(self, other):
if not isinstance(other, ClairpbVulnerability):
return False
return self.__dict__ == other.__dict__ | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __eq__(self, other):\n return are_equal(self, other)",
"def __eq__(self, other):\n return are_equal(self, other)",
"def __eq__(self,other):\n try: return self.object==other.object and isinstance(self,type(other))\n except: return False",
"def __eq__(self, other):\n if i... | [
"0.8088132",
"0.8088132",
"0.8054589",
"0.7982687",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
... | 0.0 | -1 |
Returns true if both objects are not equal | def __ne__(self, other):
return not self == other | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __ne__(self, other: object) -> bool:\n if self.__eq__(other):\n return False\n return True",
"def __ne__(self, other: object) -> bool:\n return not self.__eq__(other)",
"def __ne__(self, other) -> bool:\n return not self.__eq__(other)",
"def __eq__(self, other):\n ... | [
"0.845611",
"0.8391477",
"0.8144138",
"0.81410587",
"0.8132492",
"0.8093973",
"0.80920255",
"0.80920255",
"0.80920255",
"0.8085325",
"0.8085325",
"0.8076365",
"0.8076365",
"0.8065748"
] | 0.0 | -1 |
Forward pass through network. Calculates the action logits and the value. | def forward(self, x) -> Tuple[Tensor, Tensor]:
x = F.relu(self.fc1(x.float()))
a = F.log_softmax(self.actor_head(x), dim=-1)
c = self.critic_head(x)
return a, c | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def forward(self, x):\n # action\n act = self.act_fc1(x)\n act = torch.tanh(act)\n act = self.act_fc2(act)\n act = torch.tanh(act)\n mean = self.mu(act) # N, num_actions\n logstd = self.logstd.expand_as(mean)\n std = torch.exp(logstd)\n action = torch... | [
"0.7648056",
"0.7441679",
"0.7235342",
"0.7074458",
"0.7050156",
"0.69769365",
"0.6912717",
"0.6907993",
"0.69072765",
"0.6904189",
"0.6899755",
"0.6880525",
"0.6867396",
"0.6824801",
"0.6819598",
"0.67802507",
"0.67745304",
"0.6761813",
"0.6747654",
"0.6747654",
"0.67306876"... | 0.6286952 | 67 |
Returns the database of this snowflake source. | def database(self):
return self.snowflake_options.database | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_database(self):\n return self.database",
"def database(self) -> Optional[pulumi.Input[str]]:\n return pulumi.get(self, \"database\")",
"def database(self) -> Optional[pulumi.Input[str]]:\n return pulumi.get(self, \"database\")",
"def database(self) -> pulumi.Input[str]:\n ... | [
"0.7446689",
"0.7409722",
"0.7409722",
"0.7361835",
"0.73268086",
"0.70755297",
"0.70755297",
"0.70755297",
"0.70755297",
"0.7035698",
"0.70008326",
"0.70008326",
"0.6984017",
"0.69791114",
"0.6932914",
"0.69217163",
"0.6915366",
"0.6904952",
"0.6886391",
"0.68326914",
"0.683... | 0.85056674 | 0 |
Returns a string that can directly be used to reference this table in SQL. | def get_table_query_string(self) -> str:
if self.database and self.table:
return f'"{self.database}"."{self.schema}"."{self.table}"'
elif self.table:
return f'"{self.table}"'
else:
return f"({self.query})" | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def table_name() -> str:\n pass",
"def __repr__(self):\n cls_name = self.__class__.__name__\n conn_name = str(self._connection)\n tbl_name = self._table\n return '{0}({1}, table={2!r})'.format(cls_name, conn_name, tbl_name)",
"def __repr__(self):\n cls_name = self.__cl... | [
"0.72242546",
"0.7145293",
"0.7145293",
"0.71200347",
"0.70594376",
"0.70300525",
"0.6961341",
"0.6907269",
"0.6881874",
"0.6875941",
"0.68361664",
"0.68174165",
"0.68159",
"0.6803258",
"0.67897487",
"0.67895746",
"0.67832047",
"0.6771481",
"0.6731299",
"0.67075336",
"0.66725... | 0.76032066 | 0 |
Returns the snowflake SQL query referenced by this source. | def query(self):
return self._query | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def query(self):\n return self.snowflake_options.query",
"def sql_query(self):\n return self._project.sql_query",
"def get_sql_connection(self):\n return self.sql",
"def sql(self):\n return ';\\n'.join([x.sql() for x in self._statements]) + ';'",
"def get_query(self):\n c... | [
"0.7604513",
"0.7548185",
"0.644608",
"0.636173",
"0.62809396",
"0.6275104",
"0.6264084",
"0.62564576",
"0.6220409",
"0.60543776",
"0.59246194",
"0.5899583",
"0.58373946",
"0.57994354",
"0.57862854",
"0.5758391",
"0.57509285",
"0.5746539",
"0.5732655",
"0.56832737",
"0.567286... | 0.57847404 | 17 |
Returns the database name of this snowflake table. | def database(self):
return self._database | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def database_name(self) -> str:\n return pulumi.get(self, \"database_name\")",
"def database_name(self) -> pulumi.Output[str]:\n return pulumi.get(self, \"database_name\")",
"def getDatabaseName(self):\n return self._base.getDatabaseName()",
"def getDatabaseName(self):\n raise Not... | [
"0.8153906",
"0.79219604",
"0.7853548",
"0.77648026",
"0.7695105",
"0.76031363",
"0.7507584",
"0.74824643",
"0.74470735",
"0.7436588",
"0.7392899",
"0.73886544",
"0.7282045",
"0.7271273",
"0.7229642",
"0.72007596",
"0.7197087",
"0.7124021",
"0.7117816",
"0.7098378",
"0.700156... | 0.5763545 | 71 |
Returns the table name of this snowflake table. | def table(self):
return self._table | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_table_name(self):\n return self._table",
"def table_name(self) -> pulumi.Output[str]:\n return pulumi.get(self, \"table_name\")",
"def table_name() -> str:\n pass",
"def table_name(self) -> pulumi.Input[str]:\n return pulumi.get(self, \"table_name\")",
"def table_name(se... | [
"0.872357",
"0.8587216",
"0.8301262",
"0.82909656",
"0.82909656",
"0.82909656",
"0.82124346",
"0.8067328",
"0.80299294",
"0.8022681",
"0.79793465",
"0.758069",
"0.74290794",
"0.7428557",
"0.7422888",
"0.7326025",
"0.723662",
"0.71609664",
"0.71264887",
"0.7048128",
"0.7046885... | 0.64299667 | 48 |
Sets the table ref of this snowflake table. | def table(self, table):
self._table = table | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def table_ref(self, table_ref):\n self._table_ref = table_ref",
"def setTable(self, tabledef):\n if isinstance(tabledef, str):\n self._table = Table.Get ( tabledef )\n elif isinstance(tabledef, Table):\n self._table = tabledef\n else:\n raise ValueErro... | [
"0.840069",
"0.7259923",
"0.68128806",
"0.6655275",
"0.6641437",
"0.62347263",
"0.61731863",
"0.6130862",
"0.60809314",
"0.6049684",
"0.60375315",
"0.5879953",
"0.58563435",
"0.5758894",
"0.5728879",
"0.5722117",
"0.5694347",
"0.5653783",
"0.5653783",
"0.5530361",
"0.5422365"... | 0.6948597 | 3 |
Converts an SnowflakeOptionsProto object to its protobuf representation. | def to_proto(self) -> DataSourceProto.SnowflakeOptions:
snowflake_options_proto = DataSourceProto.SnowflakeOptions(
database=self.database,
schema=self.schema,
table=self.table,
query=self.query,
)
return snowflake_options_proto | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def from_proto(cls, snowflake_options_proto: DataSourceProto.SnowflakeOptions):\n snowflake_options = cls(\n database=snowflake_options_proto.database,\n schema=snowflake_options_proto.schema,\n table=snowflake_options_proto.table,\n query=snowflake_options_proto.... | [
"0.7185293",
"0.6591346",
"0.63469636",
"0.6190279",
"0.609588",
"0.6037695",
"0.59587693",
"0.57750213",
"0.574301",
"0.5736975",
"0.5731854",
"0.5646835",
"0.5621101",
"0.55236673",
"0.5520179",
"0.54465526",
"0.53726715",
"0.53726715",
"0.53726715",
"0.53726715",
"0.537267... | 0.7964391 | 0 |
r"""Return the standard path to the shared area on the current platform. | def shared_area_path() -> str:
try:
return os.environ["OITG_SHARED_AREA"]
except KeyError:
pass
if os.name == "nt": # Windows
return "Z:\\"
if os.name == "unix" or os.name == "posix": # Linux / OSX / ...
return os.path.expanduser("~/steaneShared/")
raise Exception... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_share_path():\n cwd = os.path.dirname(__file__)\n share = os.path.join(cwd, '../share')\n return os.path.abspath(share)",
"def path_share(self) -> Path:\n return self.path_supervisor / SHARE_DATA",
"def get_path(self):\n\t\treturn call_sdk_function('PrlShare_GetPath', self.handle)",
"... | [
"0.75354296",
"0.6952207",
"0.67871875",
"0.67391086",
"0.67256176",
"0.6657467",
"0.6635167",
"0.661767",
"0.66105354",
"0.6436675",
"0.6340287",
"0.6331047",
"0.63205075",
"0.6297639",
"0.62504154",
"0.6217222",
"0.6186836",
"0.6157988",
"0.61453235",
"0.6119978",
"0.611485... | 0.85109854 | 0 |
Get authorization header for GoDaddy Developer API. | def _get_headers() -> dict:
api_key = API_KEY_CRED_LOADER.load_credentials()
api_secret = API_SECRET_CRED_LOADER.load_credentials()
return {"Authorization": "sso-key {}:{}".format(api_key, api_secret)} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def api_client_authz_header():\n return assemble_authorization_header(API_TOKEN)",
"def api_client_authz_header():\n return assemble_authorization_header(API_TOKEN)",
"def get_authorization_header(self):\n return {\"Authorization\": \"Bearer {}\".format(self.get_jwt())}",
"def get_authorization_... | [
"0.77325",
"0.77325",
"0.7386359",
"0.73046136",
"0.71326786",
"0.70995873",
"0.7064967",
"0.69181406",
"0.67679745",
"0.6723393",
"0.67186785",
"0.66517",
"0.66500354",
"0.66368353",
"0.6635809",
"0.6585172",
"0.6572229",
"0.6569699",
"0.65522623",
"0.65466243",
"0.65304196"... | 0.6833908 | 8 |
Vectorized function to calculate the greatcircle distance between two points or between vectors of points. Please note that this method is copied from OSMnx method of the same name, | def great_circle_vec(lat1: float,
lng1: float,
lat2: float,
lng2: float,
earth_radius: float=6371009.0) -> float:
phi1 = np.deg2rad(90 - lat1)
phi2 = np.deg2rad(90 - lat2)
theta1 = np.deg2rad(lng1)
theta2 = np.deg2rad(... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def great_circle_distance(A, B):\n AdotB = numpy.einsum('...i,...i', A, B)\n AcrossB = numpy.cross(A, B)\n last_axis = len(AcrossB.shape) - 1\n return arctan2(linalg.norm(AcrossB, axis=last_axis), AdotB)",
"def great_circle_distance(theta1,phi1,theta2,phi2):\n alt1 = np.pi/2.-theta1\n alt2 = np... | [
"0.7289671",
"0.70696187",
"0.70524025",
"0.69750804",
"0.69441026",
"0.69271106",
"0.6895158",
"0.6836602",
"0.6820166",
"0.6789631",
"0.67889583",
"0.6785679",
"0.67835736",
"0.67750597",
"0.6772455",
"0.67694485",
"0.6763788",
"0.6762551",
"0.6762438",
"0.6759875",
"0.6751... | 0.67869925 | 11 |
Returns the projection matrix for perspective Multiply the position of the camera by the matrix that this function returns | def get_perspective_matrix(fov_degrees, aspect, near, far):
radians = math.radians(fov_degrees)
zoom = 1 / math.tan(radians / 2)
y_zoom = zoom
x_zoom = y_zoom / aspect
z_clip_a = (far + near) / (far - near)
z_clip_b = (-2 * near * far) / (far - near)
return np.matrix([[x_zoom, 0, 0, 0],
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def projection_matrix(self):\n scene = self.figure.scene\n scene_size = tuple(scene.get_size())\n aspect_ratio = float(scene_size[0]) / float(scene_size[1])\n p = scene.camera.get_perspective_transform_matrix(\n aspect_ratio, -1, 1).to_array().astype(np.float32)\n retu... | [
"0.82109255",
"0.76279783",
"0.7519905",
"0.7222865",
"0.72145",
"0.7192118",
"0.71746266",
"0.71618414",
"0.71552086",
"0.7016673",
"0.7000344",
"0.69891137",
"0.68717843",
"0.6742718",
"0.6740875",
"0.6684819",
"0.66156596",
"0.66130567",
"0.6575204",
"0.6541649",
"0.652216... | 0.6639653 | 16 |
Return list of choices for combo box, each a tuple of edit text and any annotation text | def getEditChoices(self, currentText=''):
return [(text, '') for text in self.formatList] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_choices(self):\n raise NotImplementedError()",
"def get_choices(self):\n raise NotImplementedError()",
"def choices(cls):\n # return list(map(tuple, cls.__members__.items()))\n return [(int(code), name) for name, code in cls.__members__.items()]",
"def getEditChoices(self,... | [
"0.64435107",
"0.64435107",
"0.6406375",
"0.6369448",
"0.6282898",
"0.61602914",
"0.61550856",
"0.6096663",
"0.6079173",
"0.6074226",
"0.599768",
"0.5979722",
"0.5946701",
"0.59085536",
"0.58665997",
"0.5852769",
"0.5851758",
"0.5840527",
"0.58387506",
"0.5816007",
"0.5803215... | 0.6981332 | 0 |
Split textStr using editSep, double sep's become char | def splitText(self, textStr):
return [text.strip().replace('\0', self.editSep) for text in
textStr.replace(self.editSep * 2, '\0').
split(self.editSep)] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def split(string, sep='\\t'):\n return text_type.split(string, sep)",
"def extended(self, new_char, new_char_index, sep=' '):\n if new_char == sep:\n return TextState(self.text + new_char, '', new_char_index), self.last_word\n if sep == '':\n return TextState(self.text + new_... | [
"0.61333054",
"0.5867214",
"0.5828028",
"0.58185434",
"0.5792178",
"0.5787775",
"0.573595",
"0.5613339",
"0.5568093",
"0.5554935",
"0.55341613",
"0.5515633",
"0.5514492",
"0.55078864",
"0.5440001",
"0.5372514",
"0.5367604",
"0.53267324",
"0.5326295",
"0.52897936",
"0.52483726... | 0.7283009 | 0 |
Return list of choices for combo box, each a tuple of edit text and any annotation text | def getEditChoices(self, currentText=''):
currentChoices, valid = self.sortedChoices(currentText)
nonChoices = [text for text in self.formatList
if text not in currentChoices]
results = []
for choice in nonChoices: # menu entries to add a choice
all... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getEditChoices(self, currentText=''):\n return [(text, '') for text in self.formatList]",
"def get_choices(self):\n raise NotImplementedError()",
"def get_choices(self):\n raise NotImplementedError()",
"def choices(cls):\n # return list(map(tuple, cls.__members__.items()))\n ... | [
"0.6981332",
"0.64435107",
"0.64435107",
"0.6406375",
"0.6282898",
"0.61602914",
"0.61550856",
"0.6096663",
"0.6079173",
"0.6074226",
"0.599768",
"0.5979722",
"0.5946701",
"0.59085536",
"0.58665997",
"0.5852769",
"0.5851758",
"0.5840527",
"0.58387506",
"0.5816007",
"0.5803215... | 0.6369448 | 4 |
Return list of choices for combo box, each a tuple of edit text and any annotation text | def getEditChoices(self, currentText=''):
format = globalref.options.strData('EditDateFormat', True)
today = GenDate().dateStr(format)
yesterday = (GenDate() - 1).dateStr(format)
tomorrow = (GenDate() + 1).dateStr(format)
return [(today, '(%s)' % _('today')),
(ye... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getEditChoices(self, currentText=''):\n return [(text, '') for text in self.formatList]",
"def get_choices(self):\n raise NotImplementedError()",
"def get_choices(self):\n raise NotImplementedError()",
"def choices(cls):\n # return list(map(tuple, cls.__members__.items()))\n ... | [
"0.6981832",
"0.64423245",
"0.64423245",
"0.6404376",
"0.63695693",
"0.62808853",
"0.615837",
"0.61527145",
"0.60969144",
"0.60806596",
"0.6074747",
"0.59950155",
"0.59769976",
"0.59458613",
"0.59082",
"0.5853147",
"0.5850785",
"0.58412063",
"0.58367765",
"0.58151263",
"0.580... | 0.5867416 | 15 |
Return list of choices for combo box, each a tuple of edit text and annotated text | def getEditChoices(self, currentText=''):
format = globalref.options.strData('EditTimeFormat', True)
now = GenTime().timeStr(format)
choices = [(now, '(%s)' % _('now'))]
for hr in (6, 9, 12, 15, 18, 21, 0):
time = GenTime((hr, 0)).timeStr(format)
choices.append((t... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getEditChoices(self, currentText=''):\n return [(text, '') for text in self.formatList]",
"def getEditChoices(self, currentText=''):\n currentChoices, valid = self.sortedChoices(currentText)\n nonChoices = [text for text in self.formatList\n if text not in currentCho... | [
"0.7317573",
"0.67196256",
"0.64775187",
"0.64775187",
"0.6326026",
"0.6246536",
"0.62373483",
"0.621034",
"0.6183985",
"0.6159754",
"0.60702986",
"0.60540736",
"0.6048126",
"0.6031349",
"0.59674495",
"0.59313804",
"0.59044296",
"0.589701",
"0.58720684",
"0.5854758",
"0.58472... | 0.6083853 | 10 |
Extract the session token from the secret_key field. | def extract_session_from_secret(secret_key, session_token):
if secret_key and '@@@' in secret_key and not session_token:
return secret_key.split('@@@')[0], secret_key.split('@@@')[1]
else:
return secret_key, session_token | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_token(self):\n token = self._session.token\n return token",
"def _shib_get_token(self): # pragma: no cover\n\n shibCookie = None\n for cookie in self._session.cookies:\n if \"shibsession\" in cookie.name:\n shibCookie = cookie\n break\... | [
"0.6786535",
"0.6588912",
"0.6564999",
"0.6549351",
"0.65473354",
"0.6426423",
"0.64007133",
"0.6390965",
"0.6321878",
"0.63127387",
"0.6308861",
"0.63074374",
"0.62886924",
"0.62571794",
"0.6218154",
"0.6218154",
"0.61798644",
"0.61466336",
"0.61005646",
"0.6099376",
"0.6099... | 0.7777419 | 0 |
Return the path of the ocamlmerlin binary." | def merlin_bin():
user_settings = sublime.load_settings("Merlin.sublime-settings")
merlin_path = user_settings.get('ocamlmerlin_path')
if merlin_path:
return merlin_path
# For Mac OS X, add the path for homebrew
if "/usr/local/bin" not in os.environ['PATH'].split(os.pathsep):
os.en... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_bin_dir():\n return os.path.abspath(os.path.join(get_root_dir(), 'bin/'))",
"def dir_bin():\n return abspath('bin')",
"def binary_location(cmd, USE_PATH=False):\n return os.path.join(BIN_PREFIX, cmd)",
"def get_golem_path():\r\n return os.path.abspath(os.path.join(os.path.dirname(__file__... | [
"0.682036",
"0.6652295",
"0.65895194",
"0.6584268",
"0.6460019",
"0.64083457",
"0.63974833",
"0.6339136",
"0.6329058",
"0.63127565",
"0.6281566",
"0.6236012",
"0.6232723",
"0.62326777",
"0.6230347",
"0.61885166",
"0.6138241",
"0.61246544",
"0.6089618",
"0.6089618",
"0.6089160... | 0.7753057 | 0 |
Check if the current view is an OCaml source code. | def is_ocaml(view):
ocaml = 'source.ocaml'
mlfi = 'source.mlfi'
location = view.sel()[0].begin()
return view.match_selector(location, ocaml) or view.match_selector(location, mlfi) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_non_js_source(self):\n self.view.set_syntax_file(\"Packages/Python/Python.tmLanguage\")\n\n actual = is_js_source(self.view)\n\n self.assertFalse(actual)",
"def test_js_source(self):\n actual = is_js_source(self.view)\n\n self.assertTrue(actual)",
"def is_authoring_s... | [
"0.67141247",
"0.61287296",
"0.59936684",
"0.59469485",
"0.59078604",
"0.5851658",
"0.5787282",
"0.5709476",
"0.5676872",
"0.5662873",
"0.56603956",
"0.55736876",
"0.5511895",
"0.5484196",
"0.5424797",
"0.54031396",
"0.53450185",
"0.53424245",
"0.52996314",
"0.5279858",
"0.52... | 0.69519085 | 0 |
Replace sequence of whitespaces by a single space | def clean_whitespace(text):
return text
#return re.sub(r'\r\n|\n', "\t", text) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def removeMultipleSpaces(self) -> None:\n self.text = re.sub('\\s+', ' ', self.text)",
"def normalize_whitespace(text):\n return NORMALIZE_WHITESPACE_REGEX.sub(' ', text)",
"def replace_whitespace(s, rep=' '):\n s = re.sub(r'\\s+', rep, s)\n return s",
"def normalize_space (text):\n return... | [
"0.7690094",
"0.7357652",
"0.73225224",
"0.72260857",
"0.7153848",
"0.7132321",
"0.70644516",
"0.7048768",
"0.70468843",
"0.7003004",
"0.6987875",
"0.69768345",
"0.6918292",
"0.6918292",
"0.68797535",
"0.6837561",
"0.6772368",
"0.676568",
"0.676431",
"0.6750295",
"0.67097074"... | 0.62447345 | 44 |
.first_name will return the correct first name | def test_first_name(self):
john_starks = Athlete(first_name="John", last_name="Starks", sport="NBA", recommendation="a")
self.assertEqual(john_starks.first_name, "John") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_first_name(self) -> str:\n return self.first_name",
"def first_name(self, instance):\r\n return instance.user.first_name",
"def get_first_name(self):\n return self._first_name",
"def firstname(self):\n return self._firstname",
"def firstname(self):\n return self._... | [
"0.861615",
"0.84696996",
"0.8462464",
"0.8350101",
"0.8350101",
"0.83253694",
"0.83253694",
"0.83253694",
"0.83061045",
"0.8267587",
"0.8145835",
"0.8013964",
"0.7967768",
"0.7967768",
"0.7913839",
"0.7835207",
"0.77401644",
"0.77401644",
"0.77401644",
"0.77401644",
"0.77401... | 0.0 | -1 |
.last_name will return the correct last name | def test_last_name(self):
john_starks = Athlete(first_name="John", last_name="Starks", sport="NBA", recommendation="a")
self.assertEqual(john_starks.last_name, "Starks") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_last_name(self) -> str:\n return self.last_name",
"def last_name(self, instance):\r\n return instance.user.last_name",
"def get_last_name(self):\n return self._last_name",
"def getLastname(self):\n return self.lastname",
"def lastname(self):\n return self._lastnam... | [
"0.86927557",
"0.86003095",
"0.85996276",
"0.8470737",
"0.8462683",
"0.84567153",
"0.84567153",
"0.84567153",
"0.84567153",
"0.84528154",
"0.8397316",
"0.8331911",
"0.8289265",
"0.8289265",
"0.8289265",
"0.8289265",
"0.8289265",
"0.8217353",
"0.82091343",
"0.82091343",
"0.811... | 0.0 | -1 |
Initialize the linked list. | def __init__(self):
self.head = None | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self, lst=[]):\n self.__length = 0 # current length of the linked list\n self.__head = None # pointer to the first node in the list\n for e in lst: # initialize the list,\n self.add(e) # by adding elements one by one",
"def __init__(self):\n node = ListNode... | [
"0.793523",
"0.7746552",
"0.7618733",
"0.76008236",
"0.7564557",
"0.7530009",
"0.74541533",
"0.74384236",
"0.7436091",
"0.74262166",
"0.74253154",
"0.74253154",
"0.73937964",
"0.7374561",
"0.7347711",
"0.7333443",
"0.7332118",
"0.7326369",
"0.7326369",
"0.7326369",
"0.731081"... | 0.7175879 | 63 |
Check whether a given seed is still unexplored. | def check_seed(self, seed):
out = self.complement(seed)
return self.solver.solve([(i + 1) for i in seed] + [-(i + 1) for i in out]) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_seed_valid(seed):\n for ch in seed:\n if not ch in all_chars_set:\n return False\n return True",
"def is_seed_valid(seed):\n for ch in seed:\n if not ch in all_chars_set:\n return False\n return True",
"def is_seed_valid(seed):\n if seed == \"0\":\n ... | [
"0.6756834",
"0.6756834",
"0.6691525",
"0.6599388",
"0.61974424",
"0.6161359",
"0.5891919",
"0.5860734",
"0.58116674",
"0.5756278",
"0.572533",
"0.5714277",
"0.57110393",
"0.5691943",
"0.5688913",
"0.56780785",
"0.5637771",
"0.559989",
"0.556628",
"0.5554336",
"0.55459327",
... | 0.62459785 | 4 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.