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 |
|---|---|---|---|---|---|---|
This function is giving temp ratio | def isnt_TR(g, M):
T_R= 1/(1+((g-1)/2)*(M**2))
return T_R #T_R is temp ratio
| {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def temp(h):\n if h < 36000:\n To = 518.69\n a = -3.57*(10**-3)\n ho = 0\n T = To + a*(h-ho)\n T_ratio = T/To\n else:\n T = 389.97\n T_ratio = None\n \n return T, T_ratio",
"def min_temp(self):\n return 4.5",
"def extract_ratio(self):\n ... | [
"0.71460414",
"0.69045466",
"0.67793334",
"0.6755265",
"0.669992",
"0.66212726",
"0.65443397",
"0.65191495",
"0.64845055",
"0.6468329",
"0.6462311",
"0.6424455",
"0.6418546",
"0.6394879",
"0.63110065",
"0.63100624",
"0.6292057",
"0.62812674",
"0.62780654",
"0.62780654",
"0.62... | 0.0 | -1 |
Render website's home page. | def home():
return render_template('home.html') | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def home():\n return render_template('homepage.html')",
"def home():\n\treturn render_template('home.html')",
"def home():\n return render_template(\n 'home.html',\n title='Home Page',\n )",
"def home():\r\n return render_template('home.html')",
"def home():\r\n return render_t... | [
"0.85791856",
"0.85713065",
"0.8499555",
"0.84895504",
"0.84842074",
"0.8465808",
"0.8462945",
"0.8430134",
"0.8396612",
"0.8396612",
"0.8385129",
"0.83715045",
"0.8360931",
"0.8355036",
"0.8355036",
"0.8343941",
"0.8341506",
"0.83411145",
"0.8340763",
"0.8340763",
"0.8340763... | 0.83374727 | 35 |
Render the website's about page. | def about():
return render_template('about.html', name="") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def about():\n return render_template(\"about.html\")",
"def about():\n logger.info(\"About page accessed\")\n return render_template('about.html')",
"def about():\n about_template = templates_lookup.get_template('about.html')\n return about_template.render(active_page='about')",
"def abou... | [
"0.8786594",
"0.864817",
"0.86474884",
"0.860858",
"0.85843325",
"0.85148895",
"0.8490408",
"0.8490408",
"0.8446738",
"0.8446738",
"0.8444085",
"0.844304",
"0.84289914",
"0.84289914",
"0.8424242",
"0.8424242",
"0.8424242",
"0.8424242",
"0.8424242",
"0.8424242",
"0.8424242",
... | 0.8190881 | 54 |
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(response):
response.headers['X-UA-Compatible'] = 'IE=Edge,chrome=1'
response.headers['Cache-Control'] = 'public, max-age=600'
return response | {
"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=0'\n return response",
"def add_header(response):\r\n response.headers['X-UA-Compatible'] = 'IE=Edge,chrome=1'\r\n response.headers['Cache-Control'] = 'public... | [
"0.8219984",
"0.81952584",
"0.816278",
"0.816278",
"0.816278",
"0.816278",
"0.816278",
"0.816278",
"0.816278",
"0.816278",
"0.816278",
"0.816278",
"0.816278",
"0.816278",
"0.816278",
"0.816278",
"0.816278",
"0.816278",
"0.816278",
"0.816278",
"0.816278",
"0.8147241",
"0.8... | 0.8222117 | 5 |
Checks is item is response class (one of Response and Message) {} i {bool} | def isResponseClass(i):
return instanceof(i, [Response, Message]) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _check_response(self, message):\n if message is None:\n return False\n\n for good in protocol.GOOD_RESPONSE:\n if message.startswith(good):\n return True, good\n\n for bad in protocol.BAD_RESPONSE:\n if message.startswith(bad):\n ... | [
"0.6498148",
"0.6473622",
"0.63576984",
"0.6317304",
"0.61769766",
"0.61134577",
"0.6090678",
"0.60511816",
"0.6046953",
"0.59958225",
"0.5944765",
"0.5930301",
"0.5919224",
"0.58627",
"0.5767187",
"0.57632035",
"0.5729424",
"0.5717173",
"0.57138777",
"0.5692447",
"0.565282",... | 0.8086178 | 0 |
Returns the proctoring escalation email for a course, or None if not given. | def get_proctoring_escalation_email(self, course_id):
try:
# Convert course id into course key
course_key = CourseKey.from_string(course_id)
except AttributeError:
# If a course key object is given instead of a string, ensure that it is used
course_key = c... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def piEmail() :\n return email",
"def get_email(self):\n return f\"{self.ucid}@njit.edu\"",
"def get_email(self):\n return f\"{self.ucid}@njit.edu\"",
"def email(self) -> Optional[Any]:\n return pulumi.get(self, \"email\")",
"def _pce_ce(pce):\n enrollment = pce.course_enrollment... | [
"0.59219795",
"0.57929945",
"0.57929945",
"0.57293886",
"0.56906044",
"0.5681355",
"0.56806207",
"0.56806207",
"0.567935",
"0.5667842",
"0.56161034",
"0.55486804",
"0.5517205",
"0.5486905",
"0.54658926",
"0.5375124",
"0.5370871",
"0.53680706",
"0.53476876",
"0.5336569",
"0.53... | 0.79594624 | 0 |
Returns the current platform | def get_platform():
system = platform.system()
if system == "Linux":
return Platform.LINUX
if system == "Darwin":
return Platform.MAC
if system == "Windows":
return Platform.WINDOWS
raise NotImplementedError(f"Platform {system} is not supported yet") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getCurrentPlatform(self) -> Platform:\n if sys.platform == \"darwin\":\n (release, version, machine) = platform.mac_ver()\n return Platform.macOS\n\n if sys.platform == \"linux\":\n (distName, version, id) = platform.linux_distribution()\n if distName =... | [
"0.8893812",
"0.8754664",
"0.8702704",
"0.8667378",
"0.8667378",
"0.85785294",
"0.8569736",
"0.85562927",
"0.8538386",
"0.8517399",
"0.8510531",
"0.8397643",
"0.83549666",
"0.81679106",
"0.81354725",
"0.8122673",
"0.8115486",
"0.8093202",
"0.8009466",
"0.7992418",
"0.793474",... | 0.85436577 | 8 |
This method gets the default browser of the current platform | def default_browser():
plat = get_platform()
# ---- get default from specific platform ----
# Always try to return a lower-cased value for ease of comparison
if plat == Platform.LINUX:
default = _default_browser_linux()
elif plat == Platform.WINDOWS:
default = _default_browser_win(... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def browser(request):\n this_browser = request.config.option.browser\n logger.info('this_browser = %s' % this_browser)\n\n return this_browser",
"def get_browser(request):\n browser_match = _BROWSERS_REGEX.search(request.META['HTTP_USER_AGENT'] if 'HTTP_USER_AGENT' in request.META else '')\n\n if ... | [
"0.7835522",
"0.7818343",
"0.78073627",
"0.7785392",
"0.77813464",
"0.7478911",
"0.7459213",
"0.7459213",
"0.73270994",
"0.7208184",
"0.70779127",
"0.70773345",
"0.7067749",
"0.7042887",
"0.698026",
"0.69124734",
"0.66299284",
"0.65630984",
"0.6542754",
"0.6489329",
"0.632594... | 0.82403797 | 0 |
This method returns the browser class from a browser name. | def get_browser(browser_name):
# gets browser class by name (string).
if browser_name == "default":
return default_browser()
else:
browser_class = None
for browser in get_browsers():
if browser.__name__.lower() == browser_name.lower():
if browser.is_suppor... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_browser(request):\n browser_match = _BROWSERS_REGEX.search(request.META['HTTP_USER_AGENT'] if 'HTTP_USER_AGENT' in request.META else '')\n\n if not browser_match:\n return _BROWSERS['default']\n\n return _BROWSERS[browser_match.group()]",
"def detect_browser(http_user_agent):\n browser... | [
"0.67392886",
"0.66200966",
"0.66072345",
"0.65675575",
"0.63832116",
"0.6380926",
"0.6275185",
"0.62326735",
"0.6150555",
"0.61392164",
"0.6087565",
"0.6074336",
"0.6035296",
"0.5978336",
"0.5953622",
"0.5904873",
"0.58986825",
"0.58986825",
"0.5886026",
"0.58677095",
"0.580... | 0.8256459 | 0 |
Validate Discord authorization token Validates Discord authorization token by debunking it using regex string matching and b64 snowflake to epoch parsing and validation. | def token(token: str) -> bool:
regex = re.match(r'^[\w-]{24}\.[\w-]{6}\.[\w-]{27}|mfa\.[\w-]{84}$', token)
if regex is None:
return False
if token.startswith('mfa') is False:
b64_snowflake = token.split('.')[0]
try:
snowflake = base64.b64dec... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _validateToken(self, token):\n self._ensure_keys()\n return util.verify(token, self.servicePublic,\n self.appConfig.getSecurityID(), None)",
"def _validate_token(self):\n expire = datetime.strptime(self.access.expire, \"%Y-%m-%dT%H:%M:%S.%fZ\")\n if expir... | [
"0.6518234",
"0.642965",
"0.6278837",
"0.62671775",
"0.61908317",
"0.6080678",
"0.6073389",
"0.6040577",
"0.59379566",
"0.59293115",
"0.59286463",
"0.5924457",
"0.58836067",
"0.5872952",
"0.5862309",
"0.58555835",
"0.5848607",
"0.58450747",
"0.5821964",
"0.57637626",
"0.57279... | 0.6102482 | 5 |
Boolean value from an object. Return the boolean value ``True`` if the caselowered value of string input ``s`` is a `truthy string`. If ``s`` is already one of the boolean values ``True`` or ``False``, return it. | def as_bool(s: Any) -> bool:
if s is None:
return False
if isinstance(s, bool):
return s
s = str(s).strip().lower()
if s not in TRUTH_TEXT and s not in FALSE_TEXT:
raise ValueError("Expected a valid True or False expression.")
return s in TRUTH_TEXT | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _str_to_bool(s):\n if s.lower() not in ['true', 'false']:\n raise ValueError('Argument needs to be a '\n 'boolean, got {}'.format(s))\n return {'true': True, 'false': False}[s.lower()]",
"def _str_to_bool(s):\n if s.lower() not in ['true', 'false']:... | [
"0.7640315",
"0.7640315",
"0.7640315",
"0.7640315",
"0.7640315",
"0.7627411",
"0.7537269",
"0.7436161",
"0.7298359",
"0.72695744",
"0.72513896",
"0.72113985",
"0.7198707",
"0.7175553",
"0.7165529",
"0.7091196",
"0.70648223",
"0.7030859",
"0.70187235",
"0.7015182",
"0.70143527... | 0.70441806 | 17 |
Create a Radio object. Arguments | def __init__(self, host=HOST, port=PORT, timeout=TIMEOUT):
self.host = host
self.port = port
self.timeout = timeout | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_default_constructor(self):\n\n radio = Radio()",
"def __init__(self):\n super(PlainRadio, self).__init__()\n self.input_type = 'radio'",
"def __create_viewer_radio(self):\n self.viewer_radio = widgets.RadioButtons(options=['3D structure', 'Bands structure', 'DOS'],\n ... | [
"0.7140403",
"0.6972923",
"0.64124143",
"0.6347788",
"0.6231783",
"0.6225726",
"0.620261",
"0.6192233",
"0.6059197",
"0.6055373",
"0.5988805",
"0.59067833",
"0.5903791",
"0.57933325",
"0.5789268",
"0.574768",
"0.57402384",
"0.56826806",
"0.56805295",
"0.5581775",
"0.55441314"... | 0.0 | -1 |
Increment the message count atomically. | def increment(self):
self.do_atomic(self.increment_non_atomic) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def increment_non_atomic(self):\n self.message_count += 1",
"def increment(self, n=1):\n with self.count.get_lock():\n self.count.value += n",
"def __increase_counter(self):\r\n self.__counter += 1",
"def increase_count(self):\n self.count += 1\n\n self.write_log... | [
"0.866941",
"0.7293359",
"0.71322405",
"0.7097875",
"0.70893455",
"0.6964946",
"0.69589233",
"0.69407266",
"0.6927965",
"0.6854569",
"0.6854366",
"0.68082666",
"0.6799109",
"0.6749925",
"0.67335135",
"0.6687778",
"0.66737044",
"0.66629755",
"0.664127",
"0.6537421",
"0.651752"... | 0.74473625 | 1 |
Increment the message count non atomically. | def increment_non_atomic(self):
self.message_count += 1 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def increment(self):\n self.do_atomic(self.increment_non_atomic)",
"def increment(self, n=1):\n with self.count.get_lock():\n self.count.value += n",
"def decrement_non_atomic(self):\n self.message_count -= 1",
"def increment(self, increment):\r\n self.send_increment(increm... | [
"0.7638302",
"0.7299582",
"0.72873896",
"0.7159362",
"0.71517956",
"0.7026712",
"0.69742215",
"0.6936648",
"0.69235116",
"0.68990344",
"0.68966794",
"0.6889752",
"0.67738783",
"0.6773711",
"0.673571",
"0.6713234",
"0.6693467",
"0.66047794",
"0.6574594",
"0.6532316",
"0.651897... | 0.9133867 | 0 |
Pop the first message from the queue. This operation is threadsafe. | def pop(self, verbose=True):
m = self.queue.get()
while m.is_outdated():
self.users[m.sender].decrement()
m = self.queue.get()
# This has to be done atomically using the semaphore of the message's owner
def todo_atomic():
if m.repeat > 1:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def pop_message(self):\n self.wait_message.acquire()\n self.wait_message.release()\n message = self.messages.pop(0)\n return message",
"def pop_message(self, tag):\n if self.new_messages_number(tag):\n return heapq.heappop(self._message_queue[tag])[-1]\n raise... | [
"0.8258864",
"0.80482125",
"0.78849536",
"0.78095037",
"0.77574533",
"0.7728187",
"0.7595199",
"0.75055546",
"0.7436482",
"0.7435281",
"0.7417732",
"0.73502237",
"0.73231864",
"0.7302217",
"0.7286114",
"0.7249787",
"0.7230554",
"0.72251415",
"0.72120416",
"0.7206611",
"0.7202... | 0.72377235 | 16 |
Put a message at the end of the queue. This operation is threadsafe. | def put(self, message, verbose=True):
if self.user_reached_limit(message.sender):
raise UserException("You have too much messages waiting in the queue.",
exceptions.TOO_MUCH_MESSAGES)
self.queue.put(message)
message.set_added_date_now()
if mess... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def put_message(self, msg):\r\n self.messages.put_nowait(msg)",
"def put_message(self, msg):\n self.outQueue.put(msg)",
"def queue_message(self, m: Message) -> None:\n self.queue.append(m)",
"def put(self, msg) -> None:\n self.request_queue.put(msg)",
"def _add_message(self, msg... | [
"0.7627364",
"0.7616395",
"0.73754144",
"0.7346792",
"0.7310132",
"0.7040457",
"0.69427305",
"0.690212",
"0.68422735",
"0.671875",
"0.6705298",
"0.669923",
"0.66719747",
"0.66453797",
"0.6625514",
"0.6624233",
"0.65464437",
"0.64978766",
"0.6470405",
"0.6462733",
"0.64164436"... | 0.6382253 | 23 |
The current timestep duration. While setting, the supplied value will | def simtime_step(self):
return self._simtime_step | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def current_time_step(self) -> int:\n return self._current_time_step",
"def duration(self):\n pass",
"def step_time(self):\n pass",
"def timestep(self):\r\n return self.getStepSize() #this is already in units of picoseconds\r",
"def timestep(self):\n return str(self._timeunit... | [
"0.748541",
"0.7178266",
"0.71617615",
"0.7140493",
"0.7052172",
"0.69243354",
"0.69243354",
"0.692384",
"0.69097805",
"0.6909243",
"0.6908274",
"0.6870361",
"0.68425506",
"0.6735561",
"0.6717394",
"0.67136115",
"0.67118233",
"0.67036766",
"0.67036766",
"0.67036766",
"0.66959... | 0.66520685 | 27 |
The limits for the timestep duration allowed during evolution. This parameter determines the degree to which the simulation evolution can be speeded up. In phases of the model evolution where the numerical solution is reached within a few sweeps, the clock would run at the max limit, whereas when a large number of swee... | def simtime_lims(self):
return self._simtime_lims | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def max_episode_steps(self):\n pass",
"def max_speed(self):\n raise NotImplementedError",
"def max_runtime_secs(self):\n return self._parms.get(\"max_runtime_secs\")",
"def get_max_steps(self):\n return self.trainer_parameters['max_steps'] * self.trainer_parameters['num_epoch']",
... | [
"0.67714304",
"0.63844705",
"0.62158483",
"0.6159098",
"0.6090458",
"0.60861087",
"0.6080156",
"0.6078337",
"0.6076051",
"0.6035228",
"0.6001058",
"0.60006666",
"0.59896076",
"0.5966983",
"0.5958804",
"0.5937218",
"0.59356713",
"0.5935322",
"0.59262085",
"0.5874437",
"0.58677... | 0.0 | -1 |
r"""Transform all tensors to numpy arrays. | def numpy(self, inplace=True):
scaler = self
if not inplace:
scaler = deepcopy(self)
for name, param in scaler.params().items():
if isinstance(param, Tensor):
param = param.detach().cpu().numpy()
setattr(scaler, name, param)
return scal... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def to_numpy(tensor):\n return x.data.cpu().numpy()",
"def tensor_to_np(tensor: Tensor) -> ndarray:\n if len(tensor.shape) == 4:\n return tensor.permute(0, 2, 3, 1).cpu().detach().numpy()\n else:\n return tensor.permute(1, 2, 0).cpu().detach().numpy()",
"def to_numpy(tensors):\n if ty... | [
"0.6903395",
"0.6881259",
"0.68576163",
"0.6729988",
"0.6653927",
"0.65647507",
"0.65457255",
"0.64849424",
"0.6444647",
"0.6353226",
"0.6345075",
"0.6323421",
"0.624604",
"0.624031",
"0.6214639",
"0.6190288",
"0.6161486",
"0.6155809",
"0.6147907",
"0.61459595",
"0.6098725",
... | 0.0 | -1 |
r"""Recursively apply inverse transformation | def inverse_transform(self, x):
return recursive_apply(x, self.inverse_transform_tensor) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def inverse_transform(self, X):\n ...",
"def inverse_transform(self, W):\n ...",
"def transformInverse(*args):\n return _almathswig.transformInverse(*args)",
"def transformInverse(*args):\n return _almathswig.transformInverse(*args)",
"def inverse(self):\n raise NotImplementedError",... | [
"0.76851344",
"0.76674414",
"0.7376948",
"0.7376948",
"0.6944992",
"0.6944992",
"0.69164544",
"0.68809634",
"0.6862016",
"0.68031096",
"0.674002",
"0.6726627",
"0.66678303",
"0.6631925",
"0.6570287",
"0.6551778",
"0.65506375",
"0.6546814",
"0.65263873",
"0.6491505",
"0.646524... | 0.78730744 | 0 |
returns a copy of the container | def clone(self) -> "Container":
return Container(self, log_undefined_deps=self._undefined_logger) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def copy(self) -> 'VectorContainer':\n copied = self.__class__(span=copy.deepcopy(self.__dict__['span']))\n copied.__dict__.update(\n {k: copy.deepcopy(v)\n for k, v in self.__dict__.items()})\n return copied",
"def copy(self):\n\t\treturn copy.copy(self)",
"def retu... | [
"0.8042747",
"0.7655249",
"0.7627312",
"0.75530463",
"0.7538928",
"0.7538928",
"0.7538928",
"0.7538928",
"0.7538928",
"0.7538928",
"0.7538928",
"0.7538928",
"0.7538928",
"0.7538928",
"0.7538928",
"0.7538928",
"0.7538928",
"0.7522091",
"0.7514919",
"0.74925727",
"0.74925727",
... | 0.6872634 | 65 |
returns a copy of the container | def clone(self):
return ExplicitContainer(self, log_undefined_deps=self._undefined_logger) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def copy(self) -> 'VectorContainer':\n copied = self.__class__(span=copy.deepcopy(self.__dict__['span']))\n copied.__dict__.update(\n {k: copy.deepcopy(v)\n for k, v in self.__dict__.items()})\n return copied",
"def copy(self):\n\t\treturn copy.copy(self)",
"def retu... | [
"0.8042702",
"0.7654954",
"0.7627249",
"0.7552703",
"0.75386626",
"0.75386626",
"0.75386626",
"0.75386626",
"0.75386626",
"0.75386626",
"0.75386626",
"0.75386626",
"0.75386626",
"0.75386626",
"0.75386626",
"0.75386626",
"0.75386626",
"0.7522028",
"0.75147206",
"0.74923676",
"... | 0.6953895 | 63 |
Applies the Grayscale transform This will return an image with only one color channel | def grayscale(img):
return cv2.cvtColor(img, cv2.COLOR_RGB2GRAY) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def to_gray(self):\n # should be applied on undistorted images\n # converting grayscale \n color_change_spec = 'cv2.COLOR_'+self._colorspec+'2GRAY'\n self._gray = np.asarray([cv2.cvtColor(img, eval(color_change_spec)) for img in self._undistorted])",
"def to_grayscale(self):\n ... | [
"0.729808",
"0.7169765",
"0.7139406",
"0.6965313",
"0.6877408",
"0.6863185",
"0.6848495",
"0.68464077",
"0.6718201",
"0.67062396",
"0.6696327",
"0.6674744",
"0.66393566",
"0.6620477",
"0.65757084",
"0.6566556",
"0.65613025",
"0.653742",
"0.65250987",
"0.6516854",
"0.6491776",... | 0.63926804 | 32 |
Return the number of characters currently in the input buffer. | def inWaiting(self):
if not self._port_handle: raise portNotOpenError
return self._port_handle.BytesToRead | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def len(self):\n return len(self._buf)",
"def length(self):\n return len(self.buffer)",
"def char_count(text):\n return len(text)",
"def len (self):\n return len (self._buf)",
"def charCount(self):\n return len(self._translation)",
"def get_count(self, buffer):\n ... | [
"0.6970378",
"0.6936131",
"0.68986726",
"0.6897075",
"0.68182194",
"0.6767527",
"0.67495066",
"0.66773105",
"0.66765666",
"0.667502",
"0.65881765",
"0.65881765",
"0.65705615",
"0.6523645",
"0.6310303",
"0.6310303",
"0.6291393",
"0.62781274",
"0.6266559",
"0.62628025",
"0.6248... | 0.0 | -1 |
Test for set a single salt process environment variable. Returns True on success. | def test_setval():
mock = MagicMock(return_value=None)
with patch.dict(os.environ, {}):
assert environ.setval("key", False, True) is None
mock = MagicMock(side_effect=Exception())
with patch.dict(os.environ, {}):
assert not environ.setval("key", False, True)
mock_environ = {}
w... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_env_set(key):\n return bool(os.environ.get(key, None))",
"def test_env_var_is_set(run_and_terminate_server):\n\n fixture_profile = os.getenv(\"AIIDA_PROFILE\")\n assert fixture_profile is not None\n if fixture_profile == \"test_profile\":\n # This is for local tests only\n fixtur... | [
"0.7189841",
"0.6574753",
"0.651694",
"0.64383703",
"0.6294081",
"0.62317824",
"0.61561346",
"0.61445695",
"0.6122743",
"0.6071025",
"0.60510576",
"0.6034215",
"0.6020444",
"0.59804744",
"0.5904092",
"0.5901066",
"0.5889601",
"0.58724266",
"0.5855792",
"0.58377403",
"0.581960... | 0.54595584 | 60 |
Return the page's slug >>> get_slug('/test/function/') function | def get_slug(path):
if path.endswith('/'):
path = path[:-1]
return path.split("/")[-1] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _get_slug(self, request):\r\n slug = None\r\n if hasattr(request, 'slug'):\r\n # Handle subdomains and CNAMEs.\r\n slug = request.slug\r\n else:\r\n # Handle '/docs/<project>/' URLs\r\n path = request.get_full_path()\r\n path_parts = p... | [
"0.73806685",
"0.72747123",
"0.71769106",
"0.70699567",
"0.70474565",
"0.6793614",
"0.6777007",
"0.67519987",
"0.67250645",
"0.6657811",
"0.6523557",
"0.6490037",
"0.64186406",
"0.63599217",
"0.63576466",
"0.6317629",
"0.6300584",
"0.6281385",
"0.62209624",
"0.62083155",
"0.6... | 0.7475882 | 0 |
Return the most obvious language according the request. | def get_language_from_request(request):
language = request.GET.get('language', None)
if language:
return language
if hasattr(request, 'LANGUAGE_CODE'):
lang = settings.PAGE_LANGUAGE_MAPPING(str(request.LANGUAGE_CODE))
if lang not in LANGUAGE_KEYS:
return settings.PAGE_DE... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_locale():\n # first, check if the user has explicitly specified a language\n if \"language\" in session: \n return session[\"language\"]\n # if not, choose one based on browser preferences\n return request.accept_languages.best_match(LANGUAGES.keys())",
"def get_locale():\n return r... | [
"0.77967095",
"0.7762351",
"0.77086335",
"0.76771617",
"0.766854",
"0.7643449",
"0.7557109",
"0.7419834",
"0.73461413",
"0.73059815",
"0.72633344",
"0.7259413",
"0.71750367",
"0.71426606",
"0.71191233",
"0.71054983",
"0.69885087",
"0.698503",
"0.6909473",
"0.6909473",
"0.6844... | 0.7397352 | 8 |
Get pytorch model weights. | def get_model_ckpt(ckpt_path, new_path=None):
ckpt = CheckpointLoader.load_checkpoint(ckpt_path, map_location="cpu")
if "model" in ckpt:
ckpt = ckpt["model"]
if not new_path:
new_path = ckpt_path[:-3] + "converted.pth"
new_path = append_dist_rank_suffi... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_weights(self):\n return self.mlp.get_weights()",
"def get_weights(self):\n return self.weights",
"def get_weights(self):\n return self.weights",
"def get_model_weights(self) -> tf.keras.Model:\n model_weights, _ = _load_checkpoint(self, \"TensorflowTrainer\")\n retu... | [
"0.7837732",
"0.77791077",
"0.77791077",
"0.7755449",
"0.77549964",
"0.77268",
"0.77268",
"0.77268",
"0.7691422",
"0.7686988",
"0.767688",
"0.7597371",
"0.7597371",
"0.7514118",
"0.75032383",
"0.74963295",
"0.74726707",
"0.7396085",
"0.73956466",
"0.7393836",
"0.7393836",
"... | 0.0 | -1 |
Return a dictonary of the preferences from the current profile key. If no profile is set the plugin will use the 'default' profile key. Multiple profiles to be set in the 'com.clburlison.munki.s3Repo' preference domain. Swithing between the profiles can be done by changing the S3REPO_PROFILE environment variable. | def get_preferences(platform):
# If this is running on a non-mac platform cheat and use environment vars
if platform == 'non-mac':
if os.environ.get('bucket_name') is None:
print("Environment variable 'bucket_name' is not set!")
sys.exit(1)
if os.environ.get('AWS_REGION')... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def profiles(cls, key):\n return cls.config_parser.get('PROFILES', key)",
"def load_profile(self, profile) -> (str, map):\n\n self._read_file()\n try:\n return (profile, self._config[profile])\n except KeyError:\n try:\n return (\n ... | [
"0.7108209",
"0.62268496",
"0.621603",
"0.6075411",
"0.59637463",
"0.5917353",
"0.58967274",
"0.5741746",
"0.5710747",
"0.5701615",
"0.568823",
"0.5617522",
"0.5617093",
"0.55699664",
"0.55598587",
"0.5528303",
"0.5465274",
"0.5453832",
"0.54506534",
"0.54408336",
"0.54316485... | 0.74407095 | 0 |
Initializes weights and bias according to the Xavier initialization | def xavier_init(w, b, init_type, gain=1):
fan_in = w.size(1)
fan_out = w.size(0)
std = math.sqrt(2.0 / (fan_in + fan_out))
if init_type == "normal":
w.normal_(0, gain*std)
b.normal_(0, gain*std)
elif init_type == "uniform":
temp = math.sqrt(3.0)*std*gain
w.uniform_(-t... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def init_weights(self):\n for p in self.parameters():\n if p.dim() > 1:\n xavier_uniform_(p)",
"def init_weights(self):\n if self.n_fc > 1:\n xavier_init_fc(self.fc1)",
"def init_weight_(weight):\n init.xavier_normal_(weight)",
"def init_weights(self):\n ... | [
"0.81894857",
"0.79286414",
"0.7387781",
"0.73263013",
"0.73133856",
"0.73133856",
"0.73133856",
"0.73133856",
"0.72967476",
"0.7295236",
"0.7285359",
"0.7213284",
"0.7199338",
"0.71991426",
"0.7186135",
"0.7137075",
"0.7094733",
"0.70907336",
"0.704265",
"0.70221746",
"0.698... | 0.67971486 | 30 |
Returns the gain value for the given nonlinearity function | def calculate_gain(type):
if type == 'tanh':
return 5.0 / 3
elif type == 'relu':
return math.sqrt(2.0) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def nonlinearity(self):\n m = self.m\n return (1 << (m-1)) - self.maximal_linear_bias_absolute()",
"def f(nu):\n x = h*nu/(kB*Tcmb)\n return x*(np.exp(x)+1.)/(np.exp(x)-1.) -4.",
"def gain(hw,f):\n #add epsilon value to eliminate any NaN.\n f = add(eps,f)\n g = mul(... | [
"0.6241262",
"0.6220749",
"0.62033033",
"0.6121483",
"0.6000874",
"0.59808344",
"0.59713846",
"0.5916572",
"0.5916572",
"0.5916572",
"0.5916572",
"0.5916572",
"0.5916572",
"0.5916572",
"0.5916572",
"0.59029084",
"0.5888175",
"0.58582383",
"0.58464664",
"0.58464664",
"0.580057... | 0.5737977 | 23 |
Creates and saves a User with the given email, date of birth and password. | def create_user(self, username, email, password=None):
if not email:
raise ValueError('Users must have an email address')
if not username:
raise ValueError('Users must have an username')
user = self.model(
username = username,
email=self.normaliz... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _create_user(self, email, password,\n is_staff, is_superuser, **extra_fields):\n now = timezone.now()\n if not email:\n raise ValueError('The given email must be set')\n email = self.normalize_email(email)\n user = self.model(email=email,\n ... | [
"0.81546026",
"0.81305367",
"0.8107395",
"0.8098282",
"0.8083993",
"0.8078478",
"0.8073247",
"0.80615944",
"0.8061434",
"0.8040791",
"0.8031472",
"0.80222136",
"0.80172515",
"0.801283",
"0.80103856",
"0.8008831",
"0.8004529",
"0.7999172",
"0.7992534",
"0.79828453",
"0.7981847... | 0.0 | -1 |
Creates and saves a superuser with the given email, date of birth and password. | def create_superuser(self, username, email, password):
user = self.create_user(username,
email,
password=password,
)
user.is_admin = True
user.save(using=self._db)
return user | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_superuser(self, email, date_of_birth, password):\n user = self.create_user(\n email,\n password=password,\n date_of_birth=date_of_birth,\n\n )\n user.is_admin = True\n user.save(using=self._db)\n return user",
"def create_superuser(se... | [
"0.8193982",
"0.81588477",
"0.8147194",
"0.8047828",
"0.8046815",
"0.80064356",
"0.8006133",
"0.79983854",
"0.79913336",
"0.79751766",
"0.7969442",
"0.7969442",
"0.7969442",
"0.7967593",
"0.7967593",
"0.7967593",
"0.7967593",
"0.7958177",
"0.7944435",
"0.79290116",
"0.7920999... | 0.0 | -1 |
Returns sitespecific profile for this user. Raises SiteProfileNotAvailable if this site does not allow profiles. | def get_profile(self):
warnings.warn("The use of AUTH_PROFILE_MODULE to define user profiles has been deprecated.",
DeprecationWarning, stacklevel=2)
if not hasattr(self, '_profile_cache'):
from django.conf import settings
if not getattr(settings, 'AUTH_PROFILE_MODULE... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_profile(self):\n \n\n if not hasattr(self, '_profile_cache'):\n from django.conf import settings\n if not getattr(settings, 'AUTH_PROFILE_MODULE', False):\n raise SiteProfileNotAvailable(\n 'You need to set AUTH_PROFILE_MODULE in your pr... | [
"0.7475244",
"0.7341141",
"0.73346674",
"0.7081001",
"0.70768017",
"0.70385283",
"0.6806046",
"0.67678374",
"0.67497677",
"0.6734421",
"0.66840285",
"0.66571397",
"0.6619632",
"0.6618377",
"0.6575901",
"0.65568113",
"0.6429194",
"0.64121836",
"0.64121836",
"0.637053",
"0.6314... | 0.70604044 | 5 |
Returns the object the view is displaying. Requires `username`, `photo_slug`, and `photoset_slug` argument in the URLconf. | def get_object(self, queryset=None):
# Use a custom queryset if provided.
if queryset is None:
queryset = self.get_queryset()
# Extract slugs.
username = self.kwargs.get('username')
photoset_slug = self.kwargs.get('photoset_slug')
photo_slug = self.kwargs.get('photo_slug')
# If one of these is missing,... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_object(self, queryset=None):\n\n\t\t# Use a custom queryset if provided.\n\t\tif queryset is None:\n\t\t\tqueryset = self.get_queryset()\n\t\t# Extract slugs.\n\t\tphotoset_slug = self.kwargs.get('photoset_slug')\n\t\tphoto_slug = self.kwargs.get('photo_slug')\n\t\tusername = self.request.user.username\n\t... | [
"0.81201655",
"0.8051777",
"0.7831516",
"0.6921164",
"0.67514825",
"0.6745446",
"0.66748875",
"0.65713155",
"0.6560972",
"0.6553741",
"0.6550589",
"0.6524901",
"0.64607745",
"0.645593",
"0.6453741",
"0.6453741",
"0.6453741",
"0.6453741",
"0.6436473",
"0.6436473",
"0.6433602",... | 0.8330823 | 0 |
Returns the object the view is displaying. Requires a `photoset_slug` argument in the URLconf. Owner is assumed to be the loggedin user. | def get_object(self, queryset=None):
if queryset is None:
queryset = self.get_queryset()
try:
object = queryset.get(owner=self.request.user, slug=self.kwargs['photoset_slug'])
except ObjectDoesNotExist:
raise Http404(u"No Photoset found matching the query")
return object | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_object(self, queryset=None):\n\n\t\t# Use a custom queryset if provided.\n\t\tif queryset is None:\n\t\t\tqueryset = self.get_queryset()\n\t\t# Extract slugs.\n\t\tphotoset_slug = self.kwargs.get('photoset_slug')\n\t\tphoto_slug = self.kwargs.get('photo_slug')\n\t\tusername = self.request.user.username\n\t... | [
"0.814679",
"0.8126624",
"0.808831",
"0.6735991",
"0.6552844",
"0.6537872",
"0.65249944",
"0.64878917",
"0.64617765",
"0.6391772",
"0.63872486",
"0.6355161",
"0.63461757",
"0.6295193",
"0.62874675",
"0.62691766",
"0.62569976",
"0.62488097",
"0.6209744",
"0.61886346",
"0.61848... | 0.8286474 | 0 |
Check if the current user has permission to edit this photoset. If not, return forbidden. | def dispatch(self, request, photoset_slug=None, *args, **kwargs):
# if no photoset is specified, return forbidden
if photoset_slug == None:
return HttpResponseForbidden('No photoset specified.')
# grab the photoset from database
self.photoset = get_object_or_404(PhotoSet, slug=photoset_slug)
# if they do n... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def has_edit_permission(self):\n return True",
"def has_permission(self, request, view):\n if request.user and request.user.is_authenticated and request.user.groups.filter(\n name__in=WELLS_EDIT_ROLES).exists():\n result = super().has_permission(request, view)\n ... | [
"0.7590728",
"0.745489",
"0.7105282",
"0.7091045",
"0.70080477",
"0.6951724",
"0.6946159",
"0.6892187",
"0.68798465",
"0.685996",
"0.68001944",
"0.67789567",
"0.6755542",
"0.6728831",
"0.67009556",
"0.665845",
"0.66549003",
"0.6654291",
"0.66288584",
"0.66288584",
"0.65901333... | 0.64054173 | 36 |
Sets the parent_entity_id of this ChildObjects. | def parent_entity_id(self, parent_entity_id):
self._parent_entity_id = parent_entity_id | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def parent_id(self, parent_id):\n\n self._parent_id = parent_id",
"def parent_id(self, parent_id):\n\n self._parent_id = parent_id",
"def set_parent(self, parent_key):\n\n self.parent_key = parent_key",
"def set_parent(self, parent_model, parent_pk):\n \n self.parent_pk ... | [
"0.77775675",
"0.77775675",
"0.73531187",
"0.72473377",
"0.7173506",
"0.7068507",
"0.7068507",
"0.70529205",
"0.7009822",
"0.69992596",
"0.6993234",
"0.6990558",
"0.6950612",
"0.69188154",
"0.68769157",
"0.6847924",
"0.67954385",
"0.6780417",
"0.6780417",
"0.6780417",
"0.6780... | 0.8565505 | 0 |
Sets the parent_object_type of this ChildObjects. | def parent_object_type(self, parent_object_type):
self._parent_object_type = parent_object_type | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_parent(self, parent):\n if isinstance(parent, CCSMSet) or parent is None:\n self.parent = parent\n else:\n raise TypeError(\"Error setting parent: CCSMSet must\" \n \" have a parent that is a CCSMSet\", \n parent.__cl... | [
"0.674242",
"0.67089313",
"0.667787",
"0.6676681",
"0.6676681",
"0.66513336",
"0.66462624",
"0.66300076",
"0.6625161",
"0.6505624",
"0.6505624",
"0.6505624",
"0.6505624",
"0.6505624",
"0.6505624",
"0.6505624",
"0.6505624",
"0.6505624",
"0.6505624",
"0.6505624",
"0.6505624",
... | 0.8869303 | 0 |
Returns the string representation of the model | def to_str(self):
return pprint.pformat(self.to_dict()) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _repr_model_(self):\n return str(self)",
"def __str__(self):\n\n return str(self.model)",
"def get_model_string(self):\n raise NotImplementedError()",
"def __str__(self):\n return self.model",
"def serialize_model(self):\n return dill.dumps(self.model)",
"def __str_... | [
"0.8603206",
"0.85092425",
"0.82360387",
"0.80498564",
"0.80115753",
"0.79343045",
"0.7878523",
"0.77903897",
"0.7789903",
"0.7746775",
"0.76299804",
"0.76084584",
"0.75825435",
"0.75152516",
"0.75066316",
"0.7504789",
"0.7487798",
"0.7443518",
"0.74352336",
"0.74271595",
"0.... | 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 return not self == other",
"def __ne__(self, other: object) -> bool:\n return not self.__eq__(other)",
"def __ne__(self, other):\n return self.__dict__ != other.__dict__",
"def __eq__(self, other):\n return not self.__ne__(other)",
... | [
"0.8411268",
"0.83923674",
"0.81723326",
"0.81407183",
"0.8092415",
"0.8089446",
"0.8067915"
] | 0.0 | -1 |
Test importing a large number of samples from the file at once (only possible with mopak and rte, since cg_stc_eng is 1 sample per file) | def test_large_import(self):
self.create_sample_data_set_dir('20140120_140004.mopak.log', MO_TEST_DIR)
self.create_sample_data_set_dir('20131115.rte.log', RTE_TEST_DIR)
self.assert_initialize()
# get results for each of the data particle streams
result_rte = self.get_sa... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_multi_load_data():\n data = optoanalysis.multi_load_data(1, [1, 36], [0])\n assert data[0].filename == \"CH1_RUN00000001_REPEAT0000.raw\"\n assert data[1].filename == \"CH1_RUN00000036_REPEAT0000.raw\"\n for dataset in data:\n assert type(dataset) == optoanalysis.optoanalysis.DataObject... | [
"0.65421003",
"0.6536884",
"0.6304403",
"0.6299818",
"0.62772745",
"0.62660146",
"0.61826235",
"0.61612976",
"0.61344004",
"0.6063165",
"0.5938305",
"0.5933025",
"0.59302276",
"0.5912838",
"0.5908687",
"0.5875776",
"0.587283",
"0.5866063",
"0.5841777",
"0.58388567",
"0.583638... | 0.71456593 | 0 |
Update the name associated with this job. | def update_name(self, name: str) -> str:
pass | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update_name(self, name: str) -> str:\n for job in self.jobs():\n if job:\n _, job_index = self._parse_job_name(job)\n try:\n # Use the index found in the job name to update the name in order\n # to preserve the job set order.... | [
"0.80610555",
"0.77737814",
"0.73784035",
"0.7278802",
"0.717204",
"0.71127874",
"0.7065763",
"0.7021963",
"0.6959186",
"0.68893856",
"0.68448",
"0.6844591",
"0.6841817",
"0.6825141",
"0.6769498",
"0.6764153",
"0.6764153",
"0.6764153",
"0.6764153",
"0.6764153",
"0.67620635",
... | 0.80058044 | 1 |
Return the position of the job in the server queue. | def queue_position(self, refresh: bool = False) -> Optional[int]:
pass | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def queue_get_pos(self, content_id):\n for k, v in self.queues.items():\n if content_id in v:\n return self.queues[k].index(content_id)\n return -1",
"def index(self, item):\n return self.queue.index(item)",
"def db_current_job_id(self):\n\t\ttry:\n\t\t\tjob = Job... | [
"0.7263542",
"0.6553896",
"0.6173649",
"0.61056745",
"0.6101393",
"0.60900813",
"0.6067107",
"0.6057293",
"0.6036174",
"0.6027334",
"0.60193634",
"0.6008431",
"0.6007611",
"0.59802604",
"0.5965218",
"0.5943185",
"0.5942333",
"0.5929168",
"0.59200585",
"0.5915298",
"0.59063274... | 0.5832626 | 38 |
Return job creation date, in local time. | def creation_date(self) -> datetime:
pass | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def creation_date(self):\n timestamp = self._prof.get(\"timecreated\")\n if timestamp:\n return time.localtime(timestamp)",
"def creation_date(self) -> str:\n return pulumi.get(self, \"creation_date\")",
"def creation_date(self) -> str:\n return pulumi.get(self, \"creatio... | [
"0.7875188",
"0.76559097",
"0.76559097",
"0.76431805",
"0.7517144",
"0.74217755",
"0.74217755",
"0.74217755",
"0.7263141",
"0.7263141",
"0.7263141",
"0.7263141",
"0.7263141",
"0.7263141",
"0.7258973",
"0.7258973",
"0.72482467",
"0.72482467",
"0.71607846",
"0.71607846",
"0.710... | 0.7239129 | 18 |
Return the user header specified for this job. | def header(self) -> Dict:
pass | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_header(self):\n return self.__header",
"def get_header(self):\n return self._header",
"def header_name(self) -> Optional[str]:\n return pulumi.get(self, \"header_name\")",
"def header_name(self) -> Optional[str]:\n return pulumi.get(self, \"header_name\")",
"def header(s... | [
"0.73143584",
"0.7257083",
"0.71462846",
"0.71462846",
"0.71041954",
"0.71041954",
"0.71041954",
"0.70176333",
"0.69663185",
"0.69523674",
"0.6945877",
"0.69399625",
"0.69258255",
"0.6743346",
"0.6743346",
"0.65728515",
"0.6572708",
"0.6554293",
"0.6472926",
"0.64527005",
"0.... | 0.59097886 | 87 |
Return the name assigned to this job. | def name(self) -> Optional[str]:
return self._name | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def name(self) -> str:\n return self._job['name']",
"def job_name(self) -> str:\n return pulumi.get(self, \"job_name\")",
"def get_job_name(self) -> str:\n return self._job_name",
"def jobname(self):\n try:\n self._jobname = self.inquire('JOBNAME')\n except:\n ... | [
"0.90761536",
"0.8809323",
"0.8605402",
"0.84176433",
"0.81133884",
"0.8002132",
"0.7989731",
"0.79758817",
"0.79758817",
"0.79758817",
"0.79057944",
"0.786758",
"0.786758",
"0.786758",
"0.786758",
"0.786758",
"0.786758",
"0.786758",
"0.786758",
"0.786758",
"0.786758",
"0.7... | 0.0 | -1 |
Return the tags assigned to this job. | def tags(self) -> List[str]:
return self._tags.copy() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def tags(self):\n return self._tags",
"def tags(self):\n return self._tags",
"def tags(self):\n return self._tags",
"def tags(self):\n return self._tags",
"def tags(self):\n return self._tags",
"def tags(self):\n return self._tags",
"def tags(self):\n re... | [
"0.8082964",
"0.8082964",
"0.8082964",
"0.8082964",
"0.8082964",
"0.8082964",
"0.8082964",
"0.8082964",
"0.80266",
"0.8020029",
"0.7845587",
"0.7845587",
"0.78375024",
"0.78375024",
"0.77798915",
"0.77613336",
"0.7751682",
"0.7751682",
"0.7750178",
"0.76736885",
"0.7664817",
... | 0.7691412 | 19 |
Get the window based on the given parameters, which is an window instance of pywinauto | def get_window(uri):
kwargs = parse_uri(uri)
if "handle" in kwargs:
kwargs["handle"] = int(kwargs["handle"])
elif "uuid" in kwargs:
handle = kwargs["uuid"]
kwargs.pop("uuid")
if handle != '':
kwargs["handle"] = int(handle)
kwargs.pop("platform")
handle = k... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getwin(*args, **kwargs): # real signature unknown\n pass",
"def FindWindowByName(*args, **kwargs):\n return _core_.FindWindowByName(*args, **kwargs)",
"def FindWindowById(*args, **kwargs):\n return _core_.FindWindowById(*args, **kwargs)",
"def get_window(cls=Window):\n sleep(0.1)\n process_app... | [
"0.73017216",
"0.7261552",
"0.725564",
"0.7108752",
"0.7057157",
"0.702083",
"0.69936156",
"0.69839954",
"0.6967672",
"0.6942564",
"0.6819703",
"0.67910767",
"0.67613804",
"0.67532426",
"0.6702913",
"0.6679455",
"0.663629",
"0.6602247",
"0.65369445",
"0.65331197",
"0.6509649"... | 0.6859755 | 10 |
Renders the home (index) page of the site | def index(request):
return render(request, 'keshane_site/index.html') | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def home():\r\n return render_template(\r\n 'index.html',\r\n title='Home Page',\r\n year=datetime.now().year,\r\n )",
"def home():\r\n return render_template(\r\n 'index.php',\r\n title='Home Page',\r\n year=datetime.now().year,\r\n )",
"def home():\n r... | [
"0.87187624",
"0.8715991",
"0.8678177",
"0.8673356",
"0.8634458",
"0.8634458",
"0.8634458",
"0.8634458",
"0.8634458",
"0.8634458",
"0.8634458",
"0.8634458",
"0.8634458",
"0.8574348",
"0.85725033",
"0.8565975",
"0.85596895",
"0.8558109",
"0.8552213",
"0.8552213",
"0.85517573",... | 0.0 | -1 |
Renders the contact page | def contact(request):
return render(request, 'keshane_site/contact.html') | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def contact():\n return render_template(\"contact.html\")",
"def contact():\n return render_template(\"home/contact.html\")",
"def contact():\r\n return render_template(\r\n 'contact.html',\r\n title='Contact',\r\n year=datetime.now().year,\r\n message='Your contact page.'\... | [
"0.85860884",
"0.8499524",
"0.8393488",
"0.8393488",
"0.83547914",
"0.83547914",
"0.83536375",
"0.83536375",
"0.83536375",
"0.83536375",
"0.83536375",
"0.83536375",
"0.83536375",
"0.83536375",
"0.83536375",
"0.83536375",
"0.83536375",
"0.83536375",
"0.83536375",
"0.8282543",
... | 0.8096289 | 23 |
Method to determine text length with and without space | def text_length (self,data):
total_alphabet = 0 #Variable to count total alphabet in the string
space = 0 #Variable to count number of spaces in the string
#Determine total number of strings with and without spaces.
for alphabet in (... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def text_length(text: str) -> int:\n return len(text) - text.count(\" \")",
"def getTextLength(self) -> int:\n ...",
"def length(self, txt):\n return self.fontMetrics().width(self.__surrounding.format(txt))",
"def TextCalcWidth(Text) -> int:\n pass",
"def text_width(txt):\n return ca... | [
"0.8139631",
"0.7960749",
"0.7727578",
"0.764317",
"0.7400034",
"0.69516",
"0.6895074",
"0.67752945",
"0.66983634",
"0.66965735",
"0.66778296",
"0.6648159",
"0.6633585",
"0.6605106",
"0.65925896",
"0.64979047",
"0.6475255",
"0.64632875",
"0.64414406",
"0.643767",
"0.63852966"... | 0.7730412 | 2 |
Load data from a database and output an X,Y dataframe as well as labels database_filepath Filepath to the database to be loaded | def load_data(database_filepath):
database_filepath = 'sqlite:///' + database_filepath
engine = create_engine(database_filepath)
df = pd.read_sql(sql="SELECT * FROM MessageData", con=engine)
X = df['message'].values
Y = df.drop(['id','message','original','genre'], axis=1)
category_... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def load_data(database_filepath):\n engine = create_engine('sqlite:///{}'.format(database_filepath))\n df = pd.read_sql(\"SELECT * FROM TrainingData\", con=engine)\n \n labels = [c for c in df.columns if c not in ['id', 'message', 'original', 'genre', 'message_tokn']]\n X = df.message.values\n Y ... | [
"0.78191876",
"0.7781518",
"0.77685916",
"0.7677448",
"0.75788677",
"0.75531113",
"0.7372692",
"0.7356763",
"0.7334934",
"0.7332821",
"0.7328826",
"0.73030335",
"0.7236777",
"0.72282517",
"0.72273785",
"0.7225805",
"0.72207946",
"0.7211788",
"0.7154137",
"0.71422166",
"0.7126... | 0.70306337 | 23 |
Return the owner of ``pathname`` in string representation. | def get_owner_string(pathname):
file_statinfo = os.stat(pathname)
ownerinfo = pwd.getpwuid(file_statinfo.st_uid)
owner_name = ownerinfo.pw_name
return owner_name | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def owner(self) -> pulumi.Output[str]:\n return pulumi.get(self, \"owner\")",
"def owner(self):\n import pwd\n return pwd.getpwuid(self._stat.st_uid).pw_name",
"def owner(self) -> str:\n return pulumi.get(self, \"owner\")",
"def owner(self) -> str:\n return pulumi.get(self,... | [
"0.6722468",
"0.6623281",
"0.65345067",
"0.65345067",
"0.64645046",
"0.6363671",
"0.61283004",
"0.61283004",
"0.6123842",
"0.60270584",
"0.60021657",
"0.59394157",
"0.5885124",
"0.5865499",
"0.58522445",
"0.58522445",
"0.57612634",
"0.57489896",
"0.5744247",
"0.5738313",
"0.5... | 0.8224913 | 0 |
Tests whether ``ClientUserPBase.from_data`` works as intended. | def test__ClientUserPBase__from_data():
data = {}
with vampytest.assert_raises(NotImplementedError):
ClientUserPBase.from_data(data, None, 0) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_check_user_data_connected_to_user_model(self):\n self.assertEqual(\n self.regular_user.user_data.start_date,\n datetime.date(2014, 1, 1))\n self.assertEqual(\n self.regular_user.user_data.end_date,\n datetime.date(2016, 1, 1))\n self.assertE... | [
"0.57346046",
"0.5664238",
"0.5399154",
"0.53520316",
"0.533965",
"0.5326004",
"0.53204286",
"0.5306627",
"0.5292161",
"0.52852666",
"0.5269208",
"0.52682054",
"0.5234763",
"0.5208101",
"0.51922625",
"0.5191916",
"0.5191916",
"0.51763314",
"0.5173228",
"0.5165896",
"0.5155913... | 0.87629366 | 0 |
Tests whether ``ClientUserPBase._update_presence`` works as intended. | def test__ClientUserPBase__update_presence():
activities = [
Activity('orin dance', activity_id = 202302080000, activity_type = ActivityType.game),
Activity('okuu dance', activity_id = 202302080001, activity_type = ActivityType.game),
]
status = Status.online
statuses = {'mobile': Status... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test__ClientUserPBase__difference_update_presence():\n old_activities = [\n Activity('orin dance', activity_id = 202302080002, activity_type = ActivityType.game),\n Activity('okuu dance', activity_id = 202302080003, activity_type = ActivityType.game),\n ]\n old_status = Status.online\n ... | [
"0.67265314",
"0.6229025",
"0.6220108",
"0.6112451",
"0.5955972",
"0.5894406",
"0.5841611",
"0.5818107",
"0.5786675",
"0.5763055",
"0.5691901",
"0.56643045",
"0.5624651",
"0.5549074",
"0.55453956",
"0.5529937",
"0.55287915",
"0.5489981",
"0.54838926",
"0.5470329",
"0.54554343... | 0.8068005 | 0 |
Obtain all key and value pairs. | def get_items(mapping):
for key in mapping:
for sub_key in mapping[key]:
for value in mapping[key][sub_key]:
yield (key, value) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getKeyValuePairs(self):\r\n keyValueList = []\r\n for i in range(len(self.keys)):\r\n if self.keys[i] != None:\r\n for j in range(len(self.keys[i])):\r\n keyValueList.append((self.keys[i][j], self.data[i][j]))\r\n return keyValueList",
"def ge... | [
"0.7160053",
"0.70293146",
"0.69944483",
"0.6938662",
"0.684345",
"0.67546886",
"0.67317736",
"0.6719675",
"0.6715665",
"0.6690396",
"0.6669499",
"0.65674335",
"0.65483665",
"0.649744",
"0.6482832",
"0.6471109",
"0.64697355",
"0.6422651",
"0.642073",
"0.63949794",
"0.6387286"... | 0.0 | -1 |
Get the places for rent in this city | def places(self):
ret = [
state
for state in models.storage.all('State').values()
if state.id == self.state_id
]
return ret | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_all_places(city_id):\n return get_all_cls(parent_cls, city_id, \"places\")",
"def places(self):\n place_values = models.storage.all(\"Place\").values()\n return list(filter(lambda p: p.city_id == self.id,\n place_values))",
"def places(self):\n ... | [
"0.69733167",
"0.694765",
"0.6783943",
"0.6483993",
"0.64546657",
"0.62206084",
"0.62165624",
"0.6208849",
"0.6184169",
"0.6180077",
"0.61266357",
"0.61106604",
"0.60730404",
"0.6068834",
"0.6020037",
"0.60182965",
"0.59980726",
"0.59662676",
"0.59655654",
"0.5938266",
"0.590... | 0.5812367 | 27 |
Set all lines to their initial positions. | def set_all_lines_to_initial_positions(self):
self.lines[1] = [None for _ in range(self.lines[0].__len__())]
for line_no in range(0, self.lines[0].__len__()):
self[line_no].move_to(
self.get_center() + self.lines_initial_positions[line_no]
)
return self | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def reset(self):\n self.__currentLine = 0",
"def reset(self):\n\t\tself.x_pos = 10\n\t\tself.y_pos = 10\n\t\tself.line_height = 15",
"def reset(self):\n self.x_pos = 10\n self.y_pos = 10\n self.line_height = 15",
"def reset(self):\r\n self[:] = (take(self.columns, self.defa... | [
"0.72955924",
"0.72459036",
"0.7186737",
"0.7039846",
"0.7033088",
"0.69173527",
"0.67198384",
"0.6700423",
"0.6534688",
"0.6520979",
"0.650363",
"0.6494043",
"0.6446561",
"0.64331836",
"0.64326245",
"0.6409181",
"0.6389397",
"0.6362117",
"0.6318401",
"0.63148713",
"0.6295109... | 0.8889988 | 0 |
Internally used function. Generates ``sha256`` hash for file name. | def text2hash(self):
settings = (
"PANGO" + self.font + self.slant + self.weight
) # to differentiate Text and CairoText
settings += str(self.t2f) + str(self.t2s) + str(self.t2w)
settings += str(self.line_spacing) + str(self.size)
id_str = self.text + settings
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def generate_file_name(file_name: str) -> str:\n return sha256(file_name.encode(\"utf-8\")).hexdigest()",
"def generate_sha256(fname):\n\n file_hash = hashlib.sha256()\n with open(fname, \"rb\") as in_file:\n for chunk in iter(lambda: in_file.read(4096), b\"\"):\n file_... | [
"0.79867876",
"0.7909075",
"0.78780013",
"0.7858283",
"0.78349584",
"0.77360964",
"0.7690763",
"0.76618755",
"0.7645114",
"0.7556087",
"0.7491237",
"0.74710995",
"0.737223",
"0.7332993",
"0.7317004",
"0.72512907",
"0.71735",
"0.7109304",
"0.7067564",
"0.7054403",
"0.70340806"... | 0.0 | -1 |
returns the smallest power of 2 still greater than or equal to n | def minGtePowerOf2( n ):
p = 1
while p < n:
p *= 2
return p | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_highest_power_of_2(n):\n\t\tres = 0\n\t\tfor i in range(int(n), 0, -1):\n\t\t\t# if i is a power of 2\n\t\t\tif (i & (i - 1)) == 0:\n\t\t\t\tres = i\n\t\t\t\tbreak\n\t\treturn res",
"def nextpow2(n):\r\n\t\t\tif n < 0:\r\n\t\t\t\traise ValueError(\"Input should be >= 0\")\r\n\t\t\telif n == 0:\r\n\t\t\t\... | [
"0.8493263",
"0.822598",
"0.82249606",
"0.8022301",
"0.7668073",
"0.7629887",
"0.7627441",
"0.753588",
"0.7447303",
"0.74094945",
"0.7381157",
"0.73745245",
"0.7368295",
"0.7355379",
"0.7346742",
"0.7311201",
"0.7277888",
"0.7264972",
"0.7238735",
"0.72330713",
"0.7227508",
... | 0.9030415 | 0 |
Convert date from mmddyyyy to yyyymmdd format | def formatDate(date):
date = date.split("-")
formatted_date = []
formatted_date.append(date[2])
formatted_date.append(date[0])
formatted_date.append(date[1])
return '-'.join(formatted_date) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def convert_date(date):\n return datetime.datetime.strptime(str(date), '%Y-%m-%d').strftime('%m%y')",
"def _to_yyyymmdd(timestamp):\r\n s = str(timestamp)\r\n r = s[0:4] + s[5:7] + s[8:10]\r\n return r",
"def convert_date(self):\n self.date = '%s-%s-%s' % (self.date[4:8], self.da... | [
"0.7508918",
"0.746525",
"0.73551136",
"0.73505133",
"0.7335068",
"0.7335068",
"0.73228353",
"0.72163844",
"0.70799553",
"0.6946763",
"0.69254196",
"0.6873946",
"0.68334174",
"0.6806143",
"0.67183095",
"0.66994625",
"0.6690497",
"0.6664089",
"0.66384435",
"0.66124856",
"0.660... | 0.638146 | 40 |
Update the data attribute to hold pricing data | def get_prices(self):
results = {}
for neighb in self.neighbs:
if neighb:
now = datetime.datetime.now().strftime('%Y-%m-%d')
html_content = get_page_content(self.location, neighb)
if html_content:
prices = retrieve_fl... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update_data(self):\n pass",
"def setProductData(self, data):\r\n\t\tself.accessory.setProductData(data)",
"def get_price_data(self):\n return self.price_data",
"def data(self, data):\n self._set_data(data, dtype=DataProduct)",
"def set_data(self, new_data):\n self.data = new... | [
"0.69557005",
"0.6878878",
"0.683245",
"0.675451",
"0.6505536",
"0.64783716",
"0.64034325",
"0.63688326",
"0.63688326",
"0.63688326",
"0.63688326",
"0.63688326",
"0.63408375",
"0.63297266",
"0.62807584",
"0.62807584",
"0.6260338",
"0.6234602",
"0.62281525",
"0.6217693",
"0.61... | 0.0 | -1 |
Randomly rotate the point clouds around y axis to augument the dataset rotation is per shape based along up direction | def rotate_point_cloud_y(batch_data):
rotated_data = np.zeros(batch_data.shape, dtype=np.float32)
for k in xrange(batch_data.shape[0]):
rotation_angle = np.random.uniform() * 2 * np.pi
cosval = np.cos(rotation_angle)
sinval = np.sin(rotation_angle)
rotation_matrix = np.array([[co... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def random_rotate(self, X, y_3d):\n rots = np.random.choice(np.arange(4), X.shape[0])\n for i in range(X.shape[0]):\n if rots[i] == 0:\n pass\n elif rots[i] == 1:\n # Rotate180\n X[i] = self.rot180(X[i])\n y_3d[i] = sel... | [
"0.674861",
"0.67002517",
"0.6595315",
"0.6477756",
"0.640046",
"0.6370132",
"0.63321024",
"0.633021",
"0.6289327",
"0.6289327",
"0.6289327",
"0.62523717",
"0.6234055",
"0.621848",
"0.62161684",
"0.61812294",
"0.6118965",
"0.6061533",
"0.60390854",
"0.6032618",
"0.5998202",
... | 0.6962814 | 0 |
Randomly rotate the point clouds around z axis to augument the dataset rotation is per shape based along up direction | def rotate_point_cloud_z(batch_data):
rotated_data = np.zeros(batch_data.shape, dtype=np.float32)
for k in xrange(batch_data.shape[0]):
rotation_angle = np.random.uniform() * 2 * np.pi
cosval = np.cos(rotation_angle)
sinval = np.sin(rotation_angle)
rotation_matrix = np.array([[co... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def rotate_point_cloud_z(point_cloud):\n rotated_data = np.zeros(point_cloud.shape, dtype=np.float32)\n rotation_angle = np.random.uniform() * 2 * np.pi\n cosval = np.cos(rotation_angle)\n sinval = np.sin(rotation_angle)\n rotation_matrix = np.array([[cosval, sinval, 0],\n ... | [
"0.75678676",
"0.73441774",
"0.7300879",
"0.6839185",
"0.68316466",
"0.6808385",
"0.67802167",
"0.6777989",
"0.6777989",
"0.6777989",
"0.6654007",
"0.66072017",
"0.659709",
"0.65005285",
"0.6454585",
"0.64181554",
"0.64048874",
"0.6398434",
"0.6358571",
"0.6318763",
"0.629787... | 0.73264384 | 2 |
Rotate the point cloud along up direction with certain angle. | def rotate_point_cloud_by_angle(batch_data, rotation_angle):
rotated_data = np.zeros(batch_data.shape, dtype=np.float32)
for k in xrange(batch_data.shape[0]):
#rotation_angle = np.random.uniform() * 2 * np.pi
cosval = np.cos(rotation_angle)
sinval = np.sin(rotation_angle)
rotatio... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def rotateUp(self):\n \n self._handleRotateUpAction()",
"def rotateUp(self):\n \n self._handleRotateUpAction()",
"def rotateUp(self):\n \n self._handleRotateUpAction()",
"def rotateUp(self):\n \n self._handleRotateUpAction()",
"def rotateUp(self):\n ... | [
"0.677592",
"0.677592",
"0.677592",
"0.677592",
"0.677592",
"0.677592",
"0.677592",
"0.677592",
"0.677592",
"0.677592",
"0.677592",
"0.677592",
"0.677592",
"0.677592",
"0.66440964",
"0.6473185",
"0.63040906",
"0.62850046",
"0.62687033",
"0.62095",
"0.61909956",
"0.615081",
... | 0.5718344 | 53 |
Randomly perturb the point clouds by small rotations | def rotate_perturbation_point_cloud(batch_data, angle_sigma=0.06, angle_clip=0.18):
rotated_data = np.zeros(batch_data.shape, dtype=np.float32)
for k in xrange(batch_data.shape[0]):
angles = np.clip(angle_sigma*np.random.randn(3), -angle_clip, angle_clip)
Rx = np.array([[1,0,0],
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def rotate_perturbation_point_cloud(data):\n #angles = np.clip(angle_sigma*np.random.randn(3), -angle_clip, angle_clip)\n angles = np.random.uniform(low=0, high=360, size=[3])\n angles = angles*np.pi/180 \n Rx = np.array([[1,0,0],\n [0,np.cos(angles[0]),-n... | [
"0.6270599",
"0.6142192",
"0.61071825",
"0.60775316",
"0.60685754",
"0.6008523",
"0.5936226",
"0.58819336",
"0.5849265",
"0.5825035",
"0.5812025",
"0.58102906",
"0.5794092",
"0.5776709",
"0.577127",
"0.5761828",
"0.57562536",
"0.57470596",
"0.5739245",
"0.5727147",
"0.5685033... | 0.5658936 | 25 |
Randomly jitter points. jittering is per point. | def jitter_point_cloud(batch_data, sigma=0.01, clip=0.05):
B, N, C = batch_data.shape
assert(clip > 0)
jittered_data = np.clip(sigma * np.random.randn(B, N, C), -1*clip, clip)
jittered_data += batch_data
return jittered_data | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _jitter(self, img, jitter=32):\n s, c, w, h = utils.get_img_indices()\n ox, oy = np.random.randint(-jitter, jitter+1, 2)\n return np.roll(np.roll(img, ox, w), oy, h)",
"def speed_with_jitter(speed, jitter):\n jitter_value = random.random() * jitter\n if random.choice([True, False])... | [
"0.69600457",
"0.68540245",
"0.6670597",
"0.6503929",
"0.6368803",
"0.63274986",
"0.6249768",
"0.61473393",
"0.60815877",
"0.6011957",
"0.59984326",
"0.5995269",
"0.590395",
"0.58662057",
"0.5853474",
"0.58370876",
"0.5803982",
"0.5799392",
"0.57912236",
"0.5791057",
"0.57910... | 0.57846355 | 23 |
point cloud to voxel | def point_cloud_label_to_surface_voxel_label(point_cloud, label, res=0.02):
coordmax = np.max(point_cloud, axis=0)
coordmin = np.min(point_cloud, axis=0)
nvox = np.ceil((coordmax - coordmin) / res)
vidx = np.ceil((point_cloud - coordmin) / res)
vidx = vidx[:,0] + vidx[:,1]*nvox[0] + vidx[:,2]*nvox[0... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def generate(self, points):\n return points_to_voxel(points, self._voxel_size,\n self._point_cloud_range, self._max_num_points,\n True, self._max_voxels)",
"def volume_to_point_cloud(vol):\n vsize = vol.shape[0]\n assert(vol.shape[1] == vsi... | [
"0.68803793",
"0.6611404",
"0.65262264",
"0.650064",
"0.6320687",
"0.6240607",
"0.6228422",
"0.6210675",
"0.61954415",
"0.61439437",
"0.6133733",
"0.6126368",
"0.6113625",
"0.6101572",
"0.60917735",
"0.609025",
"0.60887563",
"0.60493886",
"0.60054404",
"0.5985836",
"0.597185"... | 0.59163076 | 25 |
Initialize a new Sequence with the given DNA sequence and histone modifications. | def __init__(self, identifier, dna_seq, histone_mods):
self.identifier = identifier
self.seq = dna_seq
self.histone_mods = histone_mods | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__ (self, sequence):\n self.sequence = sequence",
"def __init__(self, sequence) -> None:\n super().__init__()\n self.sequence = sequence",
"def __init__(self, seq=None, **kwargs): # known special case of dict.__init__\n\n self._apply_init(seq, **kwargs)",
"def __init__(... | [
"0.72944474",
"0.6990501",
"0.63128006",
"0.6291787",
"0.62026536",
"0.6188699",
"0.61714774",
"0.6134288",
"0.6003176",
"0.58985275",
"0.58985275",
"0.58772427",
"0.5872998",
"0.5865806",
"0.58630836",
"0.58133936",
"0.57992214",
"0.57921684",
"0.5777624",
"0.5775278",
"0.57... | 0.75017256 | 0 |
Initializes a new InteractionMatrix with the given data. | def __init__(self, identifier, data):
self.identifier = identifier
xs = sorted(set(x for x, y, f in data))
self.data = {(x, y): f for x, y, f in data}
# Determine the resolution of the data
self.resolution = xs[1] - xs[0]
#if not all(xs[i] - xs[i - 1] == self.resolution f... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def matrix(self, data):\n num_data = len(data)\n mat = np.zeros((num_data, num_data))\n for i, x in enumerate(data):\n for j, y in enumerate(data):\n if i <= j:\n mat[i, j] = mat[j, i] = self(x, y)\n return mat",
"def __init__(self, data_ma... | [
"0.66076785",
"0.6355486",
"0.6330996",
"0.62693465",
"0.62619287",
"0.62514925",
"0.6225918",
"0.61577064",
"0.6121057",
"0.60839206",
"0.60749584",
"0.6039157",
"0.6031017",
"0.6001839",
"0.5948656",
"0.5921191",
"0.592072",
"0.59057945",
"0.58922124",
"0.58678293",
"0.5861... | 0.0 | -1 |
Helper function that returns two grids of coordinates for which data is available in this interaction matrix, at the given resolution. If resolution is None, the matrix's native resolution is used. | def meshgrid(self, resolution=None, start_val=None, max_dim=None):
if resolution is None:
resolution = self.resolution
r = self.range()
lower_bound = r[0]
if start_val is not None:
lower_bound += start_val
upper_bound = r[1] - self.resolution + 1
i... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def coordinates_grid(self, resolution=None):\n loci_x, loci_y, dim = self.meshgrid(resolution)\n return np.hstack([loci_x.reshape(-1, 1), loci_y.reshape(-1, 1)]), dim",
"def values_grid(self, resolution=None):\n grid, dim = self.coordinates_grid(resolution)\n return self.value_at(grid... | [
"0.734098",
"0.6615581",
"0.6427078",
"0.62799364",
"0.60225534",
"0.59958273",
"0.59407294",
"0.5887702",
"0.5829729",
"0.5712342",
"0.5599768",
"0.5580706",
"0.5566134",
"0.55597174",
"0.55357105",
"0.5515954",
"0.5491157",
"0.548602",
"0.5469758",
"0.54671896",
"0.54642606... | 0.5866104 | 8 |
Returns the raw (uninterpolated) value at the given locus. | def raw_value_at(self, x, y):
near_x = int(x / self.resolution) * self.resolution
near_y = int(y / self.resolution) * self.resolution
if (near_x, near_y) not in self.data:
near_x, near_y = near_y, near_x
if (near_x, near_y) not in self.data:
print("data for {},{} ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_raw_value(self, row):\n raise NotImplementedError()",
"def getRawValue(self, sout = None):\n\n return self.getInternalValue(sout)",
"def getRawValue(self, sout = None):\n\n return self.getInternalValue(sout)",
"def raw_value(self) -> ParamRawDataType:\n return self._source... | [
"0.57013416",
"0.56950897",
"0.56950897",
"0.5651886",
"0.5643681",
"0.5549273",
"0.5434785",
"0.5429674",
"0.53981143",
"0.5364136",
"0.5328593",
"0.5300989",
"0.52855074",
"0.5254797",
"0.52526426",
"0.52526426",
"0.521653",
"0.5181603",
"0.51781034",
"0.5147446",
"0.509554... | 0.0 | -1 |
Today Random Fact of the day | def random_today(self, msg, args):
return self.randomfacts_send(msg, random=False) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def random_date():\n six_months = six_months_ago()\n now = right_now()\n \n s = random.randint(int(six_months), int(now))\n return s",
"def generate_day_temp():\n return random.randint(32, 100)",
"def random_date():\n start = date(2010, 1, 1)\n end = date.today()\n\n chosen = start +... | [
"0.73082983",
"0.7274479",
"0.672461",
"0.63438326",
"0.62678504",
"0.61625475",
"0.6145775",
"0.61398387",
"0.60883343",
"0.6075913",
"0.60650057",
"0.5956536",
"0.58972687",
"0.58871603",
"0.5886538",
"0.58722156",
"0.5844208",
"0.58355397",
"0.5830876",
"0.5826482",
"0.581... | 0.76617455 | 0 |
Check if NRO_ARRAY table is valid | def _check_NRO_ARRAY(self, vis):
table_name = 'NRO_ARRAY'
(mytb,) = gentools(['tb'])
mytb.open(vis)
try:
self.assertTrue(table_name in mytb.keywordnames())
finally:
mytb.close()
table_path = os.path.join(vis, table_name)
self.a... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _check_optional_subtables(self, vis):\n self._check_NRO_ARRAY(vis)",
"def check_table(self,table):\n \n status = True\n required_columns = ['X', 'Y', 'RA', 'DEC', 'FLUX', 'FLUXERR']\n for col in required_columns:\n if col not in table.dtype.fields:\n ... | [
"0.65138966",
"0.6316726",
"0.6258618",
"0.6245827",
"0.62050503",
"0.6135305",
"0.6019257",
"0.60179454",
"0.59809697",
"0.58009076",
"0.57809454",
"0.5778902",
"0.569367",
"0.5636334",
"0.5617942",
"0.56153303",
"0.5608534",
"0.55888903",
"0.55791706",
"0.55734116",
"0.5570... | 0.7749073 | 0 |
Log Errors caused by Updates. | def error(bot, update, error):
logger.warning('Update "%s" caused error "%s"', update, error) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def error(update, context):\n\tlogger.warning('Update \"%s\" caused error \"%s\"', update, context.error)",
"def error(update, context):\n\tlogger.warning('Update \"%s\" caused error \"%s\"', update, context.error)",
"def error(self, update, context):\n self.logger.warning('Update \"%s\" caused error \"... | [
"0.7894918",
"0.7894918",
"0.7824726",
"0.77865386",
"0.77847004",
"0.77847004",
"0.7746143",
"0.7746143",
"0.7746143",
"0.7746143",
"0.7746143",
"0.7746143",
"0.7746143",
"0.7746143",
"0.7746143",
"0.7746143",
"0.7746143",
"0.7746143",
"0.7746143",
"0.7746143",
"0.7746143",
... | 0.7533079 | 66 |
Encodes a tree to a single string. | def serialize(self, root: TreeNode) -> str:
# Cheeky method is commented out
# self.rt.append(root)
# return ""
if not root:
return "N"
left = "L" + self.serialize(root.left)
right = "R" + self.serialize(root.right)
return "{}{}{}".format(root.val, l... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def encodeTree(self, tree, key):\n return self.encode(pickle.dumps(tree), key)",
"def serialize(self, root):\n if not root:\n return \"n\"\n s = \"\"\n stack = [root]\n while (stack):\n root = stack.pop(0)\n if root:\n s += str(ro... | [
"0.78278124",
"0.7515946",
"0.71304095",
"0.7031874",
"0.6999469",
"0.6999095",
"0.69672054",
"0.69332165",
"0.68838483",
"0.68657243",
"0.68548083",
"0.6809354",
"0.6801677",
"0.67984694",
"0.6773517",
"0.6766546",
"0.6754318",
"0.67507386",
"0.6745785",
"0.6664641",
"0.6664... | 0.7053364 | 3 |
Draws loading screen window | def redraw_loading_screen():
window.fill(WHITE)
# Create title text
text_title, text_rect = draw_title("Generating Board...", 40, LIGHT_BLUE)
# Center title rectangle and add to center of display
text_rect.center = (win_width // 2, win_height // 2)
window.blit(text_title, text_rect)
pygame.... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def startLoadingScreen(nbrFrames, tps):\r\n global tpsChargement\r\n try:\r\n #Porte de sortie de la boucle infinie pour aller a la boutique\r\n if tps > finChargement:\r\n tpsChargement = False\r\n ... | [
"0.67784977",
"0.66900164",
"0.6552291",
"0.6513885",
"0.6502395",
"0.6450939",
"0.6436214",
"0.6391298",
"0.63529605",
"0.6350927",
"0.629174",
"0.6288174",
"0.6237947",
"0.6235395",
"0.6149002",
"0.6121947",
"0.61183226",
"0.6113323",
"0.6110341",
"0.61014545",
"0.6059856",... | 0.7967284 | 0 |
Save JSON object to file | def dump(data, filename):
with open(filename, 'w') as f:
data = json.dump(data, f) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def save(self):\n print(\"saving json file:\", self.json_path)\n with open(self.json_path, 'w') as outfile:\n outfile.write( json.dumps(self.json_data, indent=2) )",
"def _save(self):\n json_file = json.dumps(self.data, separators=(',', ':'))\n with open(self.path2save, \"w\") as outfile... | [
"0.8578982",
"0.85218394",
"0.82843703",
"0.8258514",
"0.8243449",
"0.82305014",
"0.8210327",
"0.8200571",
"0.8200159",
"0.81965494",
"0.81899655",
"0.81824225",
"0.81648445",
"0.81575745",
"0.8147425",
"0.8127202",
"0.81221217",
"0.8119151",
"0.81053126",
"0.8081502",
"0.808... | 0.0 | -1 |
Load JSON object from file | def load(filename):
with open(filename, 'r') as f:
data = json.load(f)
return data | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def read_json(self, filename):\n dct = jsonio.read_json(filename)\n self.fromdict(dct)",
"def load_json(filename):\n with open(filename) as file:\n obj = json.load(file)\n return obj",
"def load_json(self, filepath):\n with open(filepath) as jfile:\n loaded = json.l... | [
"0.82742494",
"0.8219643",
"0.8210018",
"0.8198913",
"0.817152",
"0.8131926",
"0.8126468",
"0.80686593",
"0.8063378",
"0.8042609",
"0.8036401",
"0.80359024",
"0.80040795",
"0.7998045",
"0.79560757",
"0.7919275",
"0.79021096",
"0.7891812",
"0.7887062",
"0.7885515",
"0.78769004... | 0.78612787 | 23 |
A simple little template filter to replace underscores with spaces | def space(string):
return mark_safe(string.replace("_", " ")) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def underscore(s, repl=r'[\\s/:@\\,*?]+'):\n return re.sub(repl, '_', s)",
"def texsafe(value):\n return value.replace(\"_\", \"\\\\_\")",
"def markupify(string):\n return string.replace(\"_\",\"\\_\")",
"def space2_(value):\n return value.replace(' ', '_')",
"def escaped(text):\n return re.... | [
"0.74566406",
"0.7180081",
"0.7091199",
"0.7046744",
"0.6953442",
"0.6921416",
"0.686219",
"0.6824134",
"0.66156375",
"0.660981",
"0.65512294",
"0.6513488",
"0.64481837",
"0.6446759",
"0.64249545",
"0.6420048",
"0.64082843",
"0.637345",
"0.6356387",
"0.6355032",
"0.6280204",
... | 0.6934653 | 5 |
Returns the URLencoded querystring for the current page, updating the params with the key/value pairs passed to the tag. | def query_transform(context, include_page=False, **kwargs):
query = context["request"].GET.copy()
for k, v in kwargs.items():
query[k] = v
if query.get("page") and not include_page:
query.pop("page")
return query.urlencode() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_query_string(self, params):\r\n params.update(self.additional_params)\r\n return '?%s' % '&'.join(['%s=%s' % (param, value) \\\r\n for param, value in params.items()])",
"def page_querystring(context, page_num):\n # Originally I created a tag that ... | [
"0.70634747",
"0.6626799",
"0.6564978",
"0.65533113",
"0.64737815",
"0.63526535",
"0.6344365",
"0.6323588",
"0.6220637",
"0.62189823",
"0.6157105",
"0.6033741",
"0.59875107",
"0.5985506",
"0.59407383",
"0.5932449",
"0.5930072",
"0.5929235",
"0.59076804",
"0.5897554",
"0.58172... | 0.6806384 | 1 |
Elementwise sum of `src` GPU tensor across all Platoon worker processes. | def AllReduceSum(src, dest=None, inplace=False, worker=None):
return AllReduce(theano.scalar.add, inplace, worker)(src, dest) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def batch_pi_torch(q_t1_u):\n\n return torch.sum(q_t1_u[:, 0], axis = 0)",
"def relation_sum(objs_batch): \n # TODO: write test for this (maybe where relation is replaced with something simpler)\n # TODO: try making this part parallel too and see if it makes it faster\n def do_g_sum(objs):\n x... | [
"0.5810634",
"0.57118636",
"0.5701448",
"0.563544",
"0.5611205",
"0.5603441",
"0.55997294",
"0.5572158",
"0.55423635",
"0.5528879",
"0.5528879",
"0.5528879",
"0.550863",
"0.5459181",
"0.54506165",
"0.5400506",
"0.5390002",
"0.5380913",
"0.5343055",
"0.53344315",
"0.5332536",
... | 0.63094574 | 0 |
Takes the transformed magnitudes (i.e mapped onto 1,0 etc) and returns | def get_psk_symbol_stream(magnitudes, plot=False):
symbol_stream = []
for i, mags in enumerate(magnitudes):
sin_mag, cos_mag = mags
if sin_mag > cos_mag:
if cos_mag > -sin_mag:
symbol_stream.append('a')
graph_format = 'rx'
else:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def flux_to_mag( self, flux ):\n\n\t\treturn -2.5*np.log10( np.abs( flux ) ) + self.zeropoint",
"def magnitude(self):\n return sum(value**2 for value in self)**0.5",
"def get_transform_matrix(magnitudes):\n a = []\n for sin_mag, cos_mag in magnitudes[:4]:\n a.append([sin_mag, cos_mag])\n ... | [
"0.6481814",
"0.64644784",
"0.640416",
"0.6360796",
"0.63604057",
"0.63030624",
"0.6285453",
"0.62638754",
"0.6219459",
"0.6213407",
"0.6211386",
"0.62049013",
"0.61974955",
"0.6185917",
"0.61713046",
"0.6142339",
"0.6141909",
"0.61407936",
"0.6126048",
"0.61116344",
"0.61031... | 0.0 | -1 |
Computes the accuracy over the k top predictions for the specified values of k | def accuracy(output, target, topk=(1,)):
with torch.no_grad():
maxk = max(topk)
batch_size = target.size(0)
_, pred = output.topk(maxk, 1, True, True)
pred = pred.t()
correct = pred.eq(target[None])
res = []
for k in topk:
correct_k = correct[:k]... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def accuracy(y_pred, y_actual, topk=(1, )):\n maxk = max(topk)\n batch_size = y_actual.size(0)\n\n _, pred = y_pred.topk(maxk, 1, True, True)\n pred = pred.t()\n correct = pred.eq(y_actual.view(1, -1).expand_as(pred))\n\n res = []\n for k in topk:\n correct_k = correct[:k].view(-1).floa... | [
"0.82850444",
"0.82644963",
"0.8210708",
"0.8210097",
"0.8191705",
"0.8179933",
"0.8175849",
"0.8175596",
"0.8170848",
"0.81688446",
"0.8162547",
"0.8162547",
"0.8162547",
"0.8162547",
"0.8162547",
"0.8162547",
"0.8162547",
"0.8162547",
"0.8162547",
"0.8162547",
"0.8162547",
... | 0.0 | -1 |
Given a candidate item, returns a randomly sampled negative item for that candidate. Currently, pos_item is not used as checking whether the sampled negative is a mistake is too costly and does not have much impact when there are very few positive items relative to the negative ones. | def sample_neg(self, item, pos_item):
return self.rng.choice(self.Y[item].dif) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sample_negative(self, outfit_id, item_id, item_type):\n item_out = item_id\n candidate_sets = self.category2ims[item_type].keys()\n attempts = 0\n while item_out == item_id and attempts < 100:\n choice = np.random.choice(list(candidate_sets))\n items = self.cat... | [
"0.7583377",
"0.7110995",
"0.6883538",
"0.65782046",
"0.6347661",
"0.61023587",
"0.610104",
"0.6017167",
"0.5858558",
"0.58006346",
"0.57187116",
"0.5705496",
"0.5623283",
"0.5504323",
"0.5489549",
"0.5404852",
"0.5369514",
"0.53666234",
"0.5324636",
"0.53177625",
"0.5287921"... | 0.85052663 | 0 |
Current timestamp in milliseconds | def now():
return int(round(time.time() * 1000)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def ms_timestamp(self) -> int:\n return int(time.time() * 1000)",
"def timestamp(self) -> float:\n return self.milliseconds / constants.MILLISECS_IN_SECS",
"def timestamp_ms():\n dt = datetime.now()\n return int((mktime(dt.timetuple()) + dt.microsecond / 1e6) * 1000)",
"def timestamp():\n... | [
"0.854103",
"0.85226786",
"0.81814224",
"0.8109079",
"0.810455",
"0.801787",
"0.801787",
"0.7997588",
"0.79973",
"0.7960741",
"0.7933933",
"0.7931164",
"0.7921894",
"0.78827375",
"0.78827375",
"0.78827375",
"0.78827375",
"0.78827375",
"0.78823614",
"0.78782654",
"0.78768176",... | 0.76792264 | 29 |
Parse protocol.ToriiResponse into a tuple | def _parse_tx_status(response):
status_name = endpoint_pb2.TxStatus.Name(response.tx_status)
status_code = response.tx_status
error_code = response.error_code
return status_name, status_code, error_code | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def process_response(self, response):\n # TODO: Extend to responses that are iterables.\n response = utils.unpack(response)\n try:\n return response['torch_type'], response['registration']\n except:\n print(response)\n return response",
"def _process_r... | [
"0.6699951",
"0.6536375",
"0.6445234",
"0.64273757",
"0.63013905",
"0.62441254",
"0.6090287",
"0.6062038",
"0.60196704",
"0.5971303",
"0.5938377",
"0.59201187",
"0.5883814",
"0.58713734",
"0.5759474",
"0.57285684",
"0.5713533",
"0.5710636",
"0.57102925",
"0.5676898",
"0.56613... | 0.5967099 | 10 |
Function to encode output labels from number indexes. | def one_hot(y_):
y_ = y_.reshape(len(y_))
n_values = int(np.max(y_)) + 1
return np.eye(n_values)[np.array(y_, dtype=np.int32)] # Returns FLOATS | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def encode_labels(self,labels,classes_num):\n\t\tlabels_encoded = np.zeros([len(labels),classes_num])\n\n\n\t\tfor i in range(labels_encoded.shape[0]):\n\t\t\tlabels_encoded[i][self.labels_hashed[labels[i]]]=1\n\n\t\treturn labels_encoded",
"def encode_labels(labels, nclass=5):\n Y = np.zeros((len(labels), nc... | [
"0.68857956",
"0.67787105",
"0.6580894",
"0.6562673",
"0.6371993",
"0.63328826",
"0.6296263",
"0.62743276",
"0.6191977",
"0.6142784",
"0.6118967",
"0.6108409",
"0.6098532",
"0.60628694",
"0.604841",
"0.6026686",
"0.59885204",
"0.5975054",
"0.5965692",
"0.59558696",
"0.5915107... | 0.0 | -1 |
Takes a vector containing following subsequences of values, and returns a smaller vector containing the mean a each subsequence | def meanSubseqVector(vector, n):
meanvector = list(zip(*[iter(list(vector))]*n)) # vector of values, regrouped in n sublists of values
meanvector = array([sum(meanvector[t])/n for t in range(len(meanvector))]) # mean for each sublist
# meanvector = array(list(map(lambda x: sum(x)/n,vector))) # do t... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def return_average(seq):\n return sum(seq)/len(seq)",
"def calculateMean(sequence):\n\n return sum(sequence)/len(sequence)",
"def mean(V):\n return sum(V)/len(V)",
"def avg(seq, div=fdiv):\n t = k = 0\n for x in seq:\n t += x\n k += 1\n return div(t, k)",
"def running_mean(numbers):\n ... | [
"0.747031",
"0.7466001",
"0.71401566",
"0.70027226",
"0.69295734",
"0.6926213",
"0.68599564",
"0.6859801",
"0.6859801",
"0.68292797",
"0.6748219",
"0.6745691",
"0.67326",
"0.6728805",
"0.6692659",
"0.66821563",
"0.66796505",
"0.6679465",
"0.66739917",
"0.6659333",
"0.66240424... | 0.7523185 | 0 |
Turn a underscore style string (org_table) into a CamelCase style string (OrgTable) for class names. | def uscore_to_camel(s):
return ''.join(x.capitalize() for x in s.split("_")) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __tablename__(cls) -> str:\n return ''.join(\n '_' + c.lower() if index > 0 and c.isupper() else c.lower()\n for index, c in enumerate(cls.__name__)\n )",
"def _class_name_to_table_name_transformation(self):\n name_array = re.split('([A-Z][a-z0-9]*)', self.__class__... | [
"0.72669667",
"0.70592153",
"0.6866668",
"0.67828",
"0.66329676",
"0.65620816",
"0.64591396",
"0.64274395",
"0.64254045",
"0.6422133",
"0.64195335",
"0.6395061",
"0.6363855",
"0.63460755",
"0.6320587",
"0.63084775",
"0.6235988",
"0.62247944",
"0.62226915",
"0.6195667",
"0.619... | 0.63736975 | 12 |
Return whether a table name exists in the database. Deprecated in Ibis 2.0. Use `name in client.list_tables()` instead. | def exists_table(self, name: str, database: str | None = None) -> bool:
warnings.warn(
"`client.exists_table(name)` is deprecated, and will be "
"removed in a future version of Ibis. Use "
"`name in client.list_tables()` instead.",
FutureWarning,
)
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def table_exists(schema_name: str, table_name: str, engine) -> bool:\n inspector = peer_into_splice_db(engine)\n return table_name.lower() in [value.lower() for value in inspector.get_table_names(schema=schema_name)]",
"def tableExists(self, table_name):\n cursor = db.cursor()\n curso... | [
"0.8154572",
"0.81030774",
"0.8086496",
"0.79620135",
"0.78699136",
"0.7847099",
"0.78228647",
"0.78163433",
"0.78147113",
"0.77619636",
"0.76542217",
"0.7634038",
"0.76113504",
"0.7547797",
"0.74932635",
"0.7484438",
"0.7421678",
"0.73592013",
"0.7357109",
"0.7343069",
"0.73... | 0.8371053 | 0 |
Generates a batch of sets of random variables. | def generate_random_variables(
n_batch: int, size: int, mean_loc: float = 0, mean_scale: float = 1, covariance_scale: float = 1
) -> Tuple[np.ndarray, np.ndarray, np.ndarray, np.ndarray]:
means = np.random.normal(size=(n_batch, size), loc=mean_loc, scale=mean_scale)
covariance = np.stack(
[random_po... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def generateWorld(var_size):\n return [[int(round(random.random())) for x in range(var_size)] for y in range(var_size)]",
"def generate_fake_batch(mu,var):\n temp = []\n for ii in range(batch_size):\n temp.append(np.random.normal(mu[ii], var[ii], fps*1))\n return temp",
"def random_variable_ar... | [
"0.67232734",
"0.66974723",
"0.6569479",
"0.6454174",
"0.6316147",
"0.63001746",
"0.6046567",
"0.6027473",
"0.60159045",
"0.60100836",
"0.6000237",
"0.5942626",
"0.5930146",
"0.5875738",
"0.5870525",
"0.58635175",
"0.5833121",
"0.5784343",
"0.5781184",
"0.57486904",
"0.574842... | 0.6373003 | 4 |
Returns a SingleQubitCliffordGate for the specified transform with a 90 or 180 degree rotation. The arguments are exclusive, only one may be specified. | def from_single_map(pauli_map_to: Optional[Dict[Pauli, Tuple[Pauli, bool]]]
= None,
*,
x_to: Optional[Tuple[Pauli, bool]] = None,
y_to: Optional[Tuple[Pauli, bool]] = None,
z_to: Optiona... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def rotationFromTransformInPlace(*args):\n return _almathswig.rotationFromTransformInPlace(*args)",
"def rotationFromTransformInPlace(*args):\n return _almathswig.rotationFromTransformInPlace(*args)",
"def controlled_by(self, *q):\n if len(q) == 1:\n gate = CNOT(q[0], self.target_qubits[0])... | [
"0.5295585",
"0.5295585",
"0.52273065",
"0.5190611",
"0.51660496",
"0.5155335",
"0.5132823",
"0.5132823",
"0.5099616",
"0.5031454",
"0.49641213",
"0.49076948",
"0.48894733",
"0.48894733",
"0.48774293",
"0.486051",
"0.48435405",
"0.48097202",
"0.48084858",
"0.47831476",
"0.471... | 0.51541835 | 6 |
Returns a SingleQubitCliffordGate for the specified transform with a 90 or 180 degree rotation. Either pauli_map_to or two of (x_to, y_to, z_to) may be specified. | def from_double_map(pauli_map_to: Optional[Dict[Pauli, Tuple[Pauli, bool]]]
= None,
*,
x_to: Optional[Tuple[Pauli, bool]] = None,
y_to: Optional[Tuple[Pauli, bool]] = None,
z_to: Optiona... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def from_single_map(pauli_map_to: Optional[Dict[Pauli, Tuple[Pauli, bool]]]\n = None,\n *,\n x_to: Optional[Tuple[Pauli, bool]] = None,\n y_to: Optional[Tuple[Pauli, bool]] = None,\n z_t... | [
"0.7247706",
"0.6606374",
"0.54287225",
"0.54287225",
"0.52703154",
"0.5159598",
"0.51552683",
"0.51552683",
"0.5001741",
"0.5001741",
"0.4978527",
"0.4976887",
"0.48294577",
"0.48063087",
"0.47998282",
"0.4798107",
"0.4798107",
"0.47958905",
"0.47853994",
"0.4747563",
"0.472... | 0.66579 | 1 |
Returns a SingleQubitCliffordGate such that the circuits output and selfsecond are equivalent up to global phase. | def merged_with(self,
second: 'SingleQubitCliffordGate') \
-> 'SingleQubitCliffordGate':
x_intermediate_pauli, x_flip1 = self.transform(pauli_gates.X)
x_final_pauli, x_flip2 = second.transform(x_intermediate_pauli)
z_intermediate_pauli, z_flip1 = self.tran... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def controlled_by(self, *q):\n if len(q) == 1:\n gate = CNOT(q[0], self.target_qubits[0])\n elif len(q) == 2:\n gate = TOFFOLI(q[0], q[1], self.target_qubits[0])\n else:\n gate = super().controlled_by(*q)\n return gate",
"def simple_circuit_no_measure(... | [
"0.580515",
"0.5750509",
"0.5703094",
"0.5698824",
"0.566458",
"0.56596917",
"0.56325245",
"0.55779314",
"0.5576334",
"0.5515011",
"0.5406316",
"0.5390372",
"0.5375343",
"0.53685963",
"0.5352939",
"0.5350462",
"0.5333707",
"0.5314044",
"0.5311223",
"0.5300577",
"0.529197",
... | 0.64235264 | 0 |
Returns a SingleQubitCliffordGate such that the circuits outputself and selfgate are equivalent up to global phase. | def equivalent_gate_before(self, after: 'SingleQubitCliffordGate') \
-> 'SingleQubitCliffordGate':
return self.merged_with(after).merged_with(self**-1) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def controlled_by(self, *q):\n if len(q) == 1:\n gate = CNOT(q[0], self.target_qubits[0])\n elif len(q) == 2:\n gate = TOFFOLI(q[0], q[1], self.target_qubits[0])\n else:\n gate = super().controlled_by(*q)\n return gate",
"def merged_with(self,\n ... | [
"0.5973802",
"0.5906618",
"0.5808477",
"0.57442796",
"0.56444716",
"0.56341463",
"0.56124514",
"0.5593838",
"0.55635035",
"0.55606216",
"0.55606216",
"0.55585444",
"0.54509735",
"0.5434628",
"0.5376423",
"0.53608304",
"0.5353585",
"0.5350948",
"0.5297377",
"0.5293959",
"0.528... | 0.55557567 | 12 |
compute the Jacobian for each element | def calc_jacobian(this_domain):
L = len(this_domain)
jacob = np.zeros(L - 1)
for i in range(L - 1):
jacob[i] = (this_domain[i + 1] - this_domain[i]) * 0.5
return jacob | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def jacobianF(self):\n\n jacob = np.eye(len(self.x))\n jacob[0][1] = 1\n jacob[2][0] = self.x[4] + self.x[6] * self.x[0] + self.x[8] * (self.x[0] ** 2) / 2\n jacob[2][4] = self.x[0]\n jacob[2][6] = (self.x[0] ** 2) / 2\n jacob[2][8] = (self.x[0] ** 3) / 6\n jacob[3]... | [
"0.8319751",
"0.820911",
"0.80915755",
"0.7815854",
"0.77728134",
"0.77322316",
"0.77053934",
"0.77048486",
"0.7664343",
"0.75791395",
"0.7545016",
"0.74203503",
"0.73870844",
"0.7369173",
"0.7355648",
"0.733906",
"0.7260602",
"0.72443366",
"0.7236202",
"0.7211042",
"0.714603... | 0.6743322 | 43 |
actual computation of loss for all elements compute residual loss of equation for all elements, and loss in continuity across element boundary, and loss in boundary condition of domain | def The_First_Loss_Func(y_true, y_pred):
# ========================== #
# domain boundary condition
BCL_out = first_sub_model(ZL_input_tensor) # shape: (1,1)
T_bc_L = BCL_out - BCL_tensor # shape: (1,1)
BCR_out = last_sub_model(ZR_input_tensor) # shape: (1,1)
T_bc_R =... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def functional_residual(self, hidden_vars):\r\n return self.functional(hidden_vars) - self.observe(self.params)",
"def loss(coefs):\n return 0.5 * np.linalg.norm(coefs)**2",
"def compute_loss(self, image):\n print(colored(\"Nouvel appel à self.compute_loss()\",\"yellow\"))\n scale = 0.09 #The ... | [
"0.6574524",
"0.6566453",
"0.65467656",
"0.6532169",
"0.6472323",
"0.6414993",
"0.6414496",
"0.6332478",
"0.63305",
"0.63048494",
"0.6287557",
"0.6276771",
"0.6245697",
"0.6225084",
"0.6213795",
"0.61777866",
"0.6171896",
"0.61679757",
"0.6148197",
"0.61336344",
"0.6130696",
... | 0.61453384 | 19 |
Plot a heatmap of a pivoted data frame with automatic labeling of axes. | def heatmap(df, imshow=True, zlabel='z', ax=None, cax=None, cbarkwargs=dict(), cbarlabelkwargs=dict(), **kwargs):
if ax is None:
ax = plt.gcf().add_subplot(111)
if imshow:
im = ax.imshow(df, extent=(min(df.columns), max(df.columns), min(df.index), max(df.index)), aspect='auto', **kwargs)
els... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def plot_heatmap(df_to_plot):\n # create figure and axis\n fig, ax = plt.subplots(figsize=(20, 20))\n\n # Generate a custom diverging colormap\n cmap = sns.diverging_palette(50, 10, as_cmap=True)\n\n # Draw the heat map with the mask and correct aspect ratio\n sns.heatmap(df_to_plot,\n ... | [
"0.68276334",
"0.67435443",
"0.6637259",
"0.6593995",
"0.6591494",
"0.64870435",
"0.6473368",
"0.6473368",
"0.646295",
"0.63990676",
"0.63861734",
"0.6374523",
"0.6371632",
"0.63715714",
"0.6358797",
"0.6320729",
"0.6307185",
"0.6299448",
"0.6299448",
"0.6288305",
"0.6276011"... | 0.6618983 | 3 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.