query stringlengths 10 2k | document stringlengths 20 51.2k | metadata dict | negatives listlengths 0 101 | negative_scores listlengths 0 101 | document_score stringlengths 3 10 | document_rank stringclasses 102
values |
|---|---|---|---|---|---|---|
Return only the offdiagnoal terms of a square matrix. | def get_off_diagonal(matrix):
off_diag = scipy.array(matrix, dtype=matrix.dtype)
off_diag[scipy.diag_indices_from(matrix)] = 0
return off_diag | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def diagonalsNeg (matrix, cols, rows):\r\n for diagonal in ([(j, i - cols + j + 1) for j in range(cols)] for i in range(cols + rows - 1)):\r\n yield [matrix[i][j] for i, j in diagonal if i >= 0 and j >= 0 and i < cols and j < rows]",
"def offDiagPairs(self):\n return ... | [
"0.68342894",
"0.6657593",
"0.6418329",
"0.63355845",
"0.62694794",
"0.60908103",
"0.6013232",
"0.59502417",
"0.594822",
"0.5893361",
"0.5886388",
"0.58834463",
"0.5873019",
"0.5820058",
"0.5816305",
"0.5631782",
"0.56309766",
"0.56192636",
"0.55890715",
"0.5568332",
"0.55414... | 0.7656691 | 0 |
Gets the timezone of this V1ClockOffset. Timezone sets the guest clock to the specified timezone. Zone name follows the TZ environment variable format (e.g. 'America/New_York'). | def timezone(self):
return self._timezone | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def time_zone():\n return timezone('Etc/GMT-10')",
"def get_timezone(time_zone=''):\n return pytz.timezone(time_zone)",
"def get_timezone(self) -> str:\n return self.AD.time_zone",
"def time_zone(self) -> str:\n return pulumi.get(self, \"time_zone\")",
"def timezone():\n\n return... | [
"0.740404",
"0.7296048",
"0.7222704",
"0.7164589",
"0.715572",
"0.70749635",
"0.7032722",
"0.69768983",
"0.6967997",
"0.69335383",
"0.68672794",
"0.68628424",
"0.68240917",
"0.6785161",
"0.6780675",
"0.673798",
"0.67235243",
"0.66883945",
"0.66800916",
"0.65951014",
"0.658062... | 0.67033476 | 17 |
Sets the timezone of this V1ClockOffset. Timezone sets the guest clock to the specified timezone. Zone name follows the TZ environment variable format (e.g. 'America/New_York'). | def timezone(self, timezone):
self._timezone = timezone | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"async def set_time_zone(tz_name: str) -> pytz.tzinfo:\n\n try:\n tz = pytz.timezone(tz_name or \"UTC\")\n except pytz.UnknownTimeZoneError:\n raise InvalidTimeZoneError(tz_name)\n\n # await db.update_system_field(conn, tz.zone)\n return tz",
"def set_timezone(tz=None, deploy=False):\n\n... | [
"0.6843808",
"0.6650212",
"0.66233385",
"0.658104",
"0.65464187",
"0.6489877",
"0.6489877",
"0.641799",
"0.6312674",
"0.62637377",
"0.61294913",
"0.60097176",
"0.5961769",
"0.5900062",
"0.58986586",
"0.5896437",
"0.57644314",
"0.5760073",
"0.57184196",
"0.5713031",
"0.5702066... | 0.646365 | 8 |
Gets the utc of this V1ClockOffset. UTC sets the guest clock to UTC on each boot. If an offset is specified, guest changes to the clock will be kept during reboots and are not reset. | def utc(self):
return self._utc | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_utc_offset():\n timedelta = datetime.datetime.now() - datetime.datetime.utcnow()\n # XXX: `return -time.timezone`?\n return timedelta.total_seconds()",
"def shn_user_utc_offset():\n\n if auth.is_logged_in():\n return db(db.auth_user.id == session.auth.user.id).select(db.auth_user.utc_o... | [
"0.67037284",
"0.6307381",
"0.611886",
"0.60691893",
"0.6058912",
"0.5987555",
"0.5977583",
"0.5952001",
"0.59395474",
"0.593822",
"0.5931103",
"0.5904438",
"0.5869817",
"0.5866181",
"0.5826115",
"0.5826115",
"0.5799463",
"0.57848203",
"0.5782215",
"0.57680583",
"0.57666844",... | 0.69332826 | 0 |
Sets the utc of this V1ClockOffset. UTC sets the guest clock to UTC on each boot. If an offset is specified, guest changes to the clock will be kept during reboots and are not reset. | def utc(self, utc):
self._utc = utc | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def time_utc(self, time_utc):\n\n self._time_utc = time_utc",
"def fromutc(self, dt):\n if dt.tzinfo is None:\n return dt.replace(tzinfo=self)\n return super(UTC, self).fromutc(dt)",
"def set_utc(date_time):\n utc = datetime.timezone(datetime.timedelta(0))\n date_time = da... | [
"0.6490818",
"0.6060608",
"0.60435057",
"0.5927388",
"0.58518225",
"0.5831567",
"0.56459993",
"0.56045294",
"0.54893464",
"0.5348984",
"0.5337846",
"0.5263802",
"0.52333325",
"0.5205076",
"0.5083966",
"0.50782126",
"0.50738865",
"0.5067582",
"0.50561005",
"0.5046814",
"0.5019... | 0.7177889 | 0 |
Returns true if both objects are equal | def __eq__(self, other):
if not isinstance(other, V1ClockOffset):
return False
return self.__dict__ == other.__dict__ | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __eq__(self, other):\n return are_equal(self, other)",
"def __eq__(self, other):\n return are_equal(self, other)",
"def __eq__(self,other):\n try: return self.object==other.object and isinstance(self,type(other))\n except: return False",
"def __eq__(self, other):\n if i... | [
"0.8088132",
"0.8088132",
"0.8054589",
"0.7982687",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
... | 0.0 | -1 |
Returns true if both objects are not equal | def __ne__(self, other):
return not self == other | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __ne__(self, other: object) -> bool:\n if self.__eq__(other):\n return False\n return True",
"def __ne__(self, other: object) -> bool:\n return not self.__eq__(other)",
"def __ne__(self, other) -> bool:\n return not self.__eq__(other)",
"def __eq__(self, other):\n ... | [
"0.845611",
"0.8391477",
"0.8144138",
"0.81410587",
"0.8132492",
"0.8093973",
"0.80920255",
"0.80920255",
"0.80920255",
"0.8085325",
"0.8085325",
"0.8076365",
"0.8076365",
"0.8065748"
] | 0.0 | -1 |
Asserts that an invalid schema throws an error in get_schema. | def test_invalid_schema_in_get_schema():
from json import JSONDecodeError
# setup
uid = uuid.uuid4()
schema_dir = f'/tmp/{uid}'
schema_file = f'{schema_dir}/bad_schema.json'
os.makedirs(schema_dir)
text_file = open(schema_file, 'w')
text_file.write('this will fail[];fail()')
text_fi... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def assert_schema_error(*args):\n assert_exception(SchemaError, *args)",
"def test_invalid_schema():\n # setup\n uid = uuid.uuid4()\n schema_dir = f'/tmp/{uid}'\n schema_file = f'{schema_dir}/bad_schema.json'\n os.makedirs(schema_dir)\n text_file = open(schema_file, 'w')\n text_file.write... | [
"0.8405879",
"0.80802876",
"0.7682658",
"0.76545036",
"0.74602467",
"0.70371777",
"0.7024384",
"0.6956246",
"0.6927279",
"0.6886947",
"0.6823394",
"0.68176734",
"0.6770627",
"0.67622244",
"0.674266",
"0.6740813",
"0.6729664",
"0.67028457",
"0.66951025",
"0.6667954",
"0.664948... | 0.764354 | 4 |
This view simply displays the list of all Dies in the database. These can be clicked on to enter data, instructions can be read, or administrators can inspect results. | def homeView(request):
dieList = Die.objects.all()
context = {
'dieList': dieList
}
return render(request, 'home.html', context) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def list_dams(request):\n dams = get_all_dams()\n table_rows = []\n\n for dam in dams:\n table_rows.append(\n (\n dam['name'], dam['owner'],\n dam['river'], dam['date_built']\n )\n )\n\n dams_table = DataTableView(\n column_names=... | [
"0.7086058",
"0.6435957",
"0.6317457",
"0.6089986",
"0.608611",
"0.60201466",
"0.6013524",
"0.6011869",
"0.59593135",
"0.5957152",
"0.5915902",
"0.59144133",
"0.5846529",
"0.5828678",
"0.5824534",
"0.58204406",
"0.5820397",
"0.58167845",
"0.57889545",
"0.57811815",
"0.5742785... | 0.6629509 | 1 |
A simple view that shows the Contact form and sends an email to the administrators when submitted. | def contactView(request):
submitSuccess = False
if request.method == 'GET':
form = ContactForm()
else:
form = ContactForm(request.POST)
if form.is_valid():
fromEmail = form.cleaned_data['fromEmail']
subject = form.cleaned_data['subject']
message = ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def contact(request):\n if request.method == 'POST':\n form = ContactForm(request.POST)\n if form.is_valid():\n subject = form.cleaned_data['subject']\n message = form.cleaned_data['message']\n from_email = form.cleaned_data['email']\n name = form.cleane... | [
"0.7957629",
"0.79170805",
"0.77496547",
"0.76495624",
"0.7614151",
"0.7598475",
"0.7596087",
"0.758736",
"0.7556909",
"0.753842",
"0.75194883",
"0.7448489",
"0.74160945",
"0.7409322",
"0.7407191",
"0.7396816",
"0.73464346",
"0.731385",
"0.72506285",
"0.7248917",
"0.72361845"... | 0.75667995 | 8 |
Compare this instance to `other` for equality. | def __eq__(self, other):
# type: (Options) -> bool
if isinstance(other, Options):
return (dialect_eq(self.dialect, other.dialect) and
self.encoding == other.encoding and
self.columntypes == other.columntypes and
self.rowspec == othe... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __eq__(self, other):\n return equal(self, other)",
"def __eq__(self, other):\n return are_equal(self, other)",
"def __eq__(self, other):\n return are_equal(self, other)",
"def __eq__(self, other):\n pass",
"def __eq__(self, other):\n pass",
"def __eq__(self, other):... | [
"0.82965696",
"0.82599837",
"0.82599837",
"0.8102685",
"0.8102685",
"0.8080884",
"0.8057516",
"0.80441844",
"0.80441844",
"0.8027048",
"0.80038905",
"0.7936033",
"0.79335934",
"0.79335934",
"0.79335934",
"0.79161084",
"0.7896506",
"0.7896506",
"0.7890666",
"0.78814167",
"0.78... | 0.0 | -1 |
Disable/enable buttons in a QDialogButtonBox based on their role. All buttons except the ones with RejectRole or HelpRole are disabled. | def dialog_button_box_set_enabled(buttonbox, enabled):
# type: (QDialogButtonBox, bool) -> None
stashname = "__p_dialog_button_box_set_enabled"
for b in buttonbox.buttons():
role = buttonbox.buttonRole(b)
if not enabled:
if b.property(stashname) is None:
b.setProp... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _createButtonsBox(self):\n\n # Create OK and Cancel buttons\n buttons = QDialogButtonBox(\n QDialogButtonBox.Ok | QDialogButtonBox.Cancel | QDialogButtonBox.Reset,\n Qt.Horizontal)\n buttons.accepted.connect(self._onOk)\n buttons.rejected.connect(self._onCancel... | [
"0.62069076",
"0.61979175",
"0.6042594",
"0.58766544",
"0.5862244",
"0.57175034",
"0.5682869",
"0.5530301",
"0.54449534",
"0.5264103",
"0.5260101",
"0.52502036",
"0.52200073",
"0.52131915",
"0.52010566",
"0.51686716",
"0.51571196",
"0.5134917",
"0.5100389",
"0.5100389",
"0.51... | 0.6178282 | 2 |
Activate the Import Options dialog for the current item. | def _activate_import_dialog(self):
item = self.current_item()
assert item is not None
dlg = CSVImportDialog(
self, windowTitle="Import Options", sizeGripEnabled=True,
)
dlg.setWindowModality(Qt.WindowModal)
dlg.setAttribute(Qt.WA_DeleteOnClose)
setting... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def onOpenMenu(self, item):\n self.dialog = pyui.dialogs.FileDialog(os.getcwd(), self.onOpenChosen, \".*stk\")\n self.dialog.doModal()\n return 1",
"def activate_recent(self, index):\n if 0 <= index < self.import_items_model.rowCount():\n item = self.import_items_model.item... | [
"0.6803234",
"0.6622078",
"0.64279485",
"0.6377598",
"0.63680494",
"0.63680494",
"0.63680494",
"0.616259",
"0.6105116",
"0.60646087",
"0.5969856",
"0.59530026",
"0.5901579",
"0.5860493",
"0.57969075",
"0.5785049",
"0.5772012",
"0.57702106",
"0.57591724",
"0.57407886",
"0.5653... | 0.8364466 | 0 |
Return the (first) index of el in `iterable` where `pred(el)` returns True. If no element matches return `None`. | def index_where(iterable, pred):
# type: (Iterable[T], Callable[[T], bool]) -> Optional[int]
for i, el in enumerate(iterable):
if pred(el):
return i
return None | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def find_index(arr, pred):\n for index, elem in enumerate(arr):\n if pred(elem):\n return index\n return -1",
"def index(predicate,iterable):\n for i,value in enumerate(iterable):\n if value.startswith(predicate):\n return i\n raise ValueError",
"def first_true(i... | [
"0.7641044",
"0.7384051",
"0.6755237",
"0.672226",
"0.66724336",
"0.6610268",
"0.6506169",
"0.63936305",
"0.63762474",
"0.6158011",
"0.6113901",
"0.60977423",
"0.6085697",
"0.60577226",
"0.6047793",
"0.6007021",
"0.5928018",
"0.59038544",
"0.5856879",
"0.57718664",
"0.5766021... | 0.8550002 | 0 |
Return an iterator over unique elements of `iterable`. If `key` is supplied it is used as a substitute for determining 'uniqueness' of elements. | def unique(iterable, key=None):
# type: (Iterable[T], Optional[Callable[[T], Hashable]]) -> Iterable[T]
seen = set()
if key is None:
key = lambda t: t
for el in iterable:
el_k = key(el)
if el_k not in seen:
seen.add(el_k)
yield el | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def unique(iterable, key=None):\n\n\tif key is None:\n\t\tkey = identity\n\n\tseen = set()\n\tseen_add = seen.add\n\tfor v in iterable:\n\t\tk = key(v)\n\t\tif k not in seen:\n\t\t\tyield v\n\t\t\tseen_add(k)",
"def unique_everseen(iterable, key = None):\n seen = set()\n seen_add = seen.add\n if key is ... | [
"0.856504",
"0.82168007",
"0.81563956",
"0.8133949",
"0.78059995",
"0.7449508",
"0.743656",
"0.71602565",
"0.69586724",
"0.68659794",
"0.6815772",
"0.67778206",
"0.66899085",
"0.6583646",
"0.65651435",
"0.6478764",
"0.6452946",
"0.6368022",
"0.6348384",
"0.62260693",
"0.60670... | 0.85349196 | 1 |
Return True if the paths `p1` and `p2` match after case and path normalization. | def samepath(p1, p2):
# type: (str, str) -> bool
return pathnormalize(p1) == pathnormalize(p2) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def areSamePaths(path1, path2):\n\n path1 = os.path.abspath(os.path.normpath(path1))\n path2 = os.path.abspath(os.path.normpath(path2))\n\n if os.path.exists(path1) and os.path.exists(path2):\n path1 = getExternalUsePath(path1)\n path2 = getExternalUsePath(path2)\n\n path1 = os.path.normc... | [
"0.6541151",
"0.61425066",
"0.5902311",
"0.58697903",
"0.58128774",
"0.5761195",
"0.5750704",
"0.57480294",
"0.574531",
"0.5702339",
"0.56958926",
"0.5677456",
"0.56207305",
"0.5602765",
"0.55321133",
"0.549363",
"0.5490234",
"0.54826957",
"0.54727566",
"0.54697216",
"0.54498... | 0.7574443 | 0 |
Return the path with the $HOME prefix shortened to '~/' if applicable. Example >>> prettyfypath("/home/user/file.dat") '~/file.dat' | def prettyfypath(path):
home = os.path.expanduser("~/")
home_n = pathnormalize(home)
path_n = pathnormalize(path)
if path_n.startswith(home_n):
path = os.path.join("~", os.path.relpath(path, home))
return path | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def pretty_path(input_path):\n home_path = os.path.expanduser('~')\n cwd_path = os.getcwd()\n output_path = input_path.replace(home_path, '~').replace(cwd_path, './')\n return output_path",
"def format_path (in_path):\n return os.path.realpath(os.path.expanduser(in_path))",
"def relativeToAbsolu... | [
"0.7308251",
"0.6876916",
"0.6826683",
"0.67868763",
"0.6725374",
"0.66323155",
"0.6550511",
"0.6312072",
"0.6253478",
"0.62527007",
"0.6220887",
"0.62080085",
"0.61900437",
"0.6158889",
"0.6121445",
"0.60808414",
"0.6076972",
"0.60299605",
"0.59762424",
"0.59270614",
"0.5884... | 0.8565791 | 0 |
returns True if x is odd and False otherwise | def is_odd(x):
if (x%2==1):
return True
else:
return False | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_odd(self, x):\n return x%2",
"def is_odd(x):\n return x % 2 != 0",
"def is_odd(x):\n\n return (x & 1) == 1",
"def is_even(self, x):\n return x%2 == 0",
"def is_odd(number):\r\n return number % 2 != 0",
"def is_odd(number):\n return (number%2)==1",
"def is_odd(n):\n i... | [
"0.92330164",
"0.90404826",
"0.868304",
"0.84379256",
"0.83006394",
"0.8186859",
"0.81748587",
"0.8173344",
"0.81620127",
"0.81580466",
"0.8130541",
"0.79242367",
"0.78004944",
"0.77101076",
"0.75649863",
"0.75640064",
"0.7429532",
"0.7419639",
"0.7382397",
"0.7365539",
"0.73... | 0.91242903 | 1 |
Maxooling operation preceded by applying a sigmoid activation function | def pool(self, img, layer):
print("reshape pool", layer)
# Reshape the image
img = self.img_reshape(img)
# Apply the sigmoid activation function
sig = tf.sigmoid(img)
# Maxpooling
max_pool = tf.nn.max_pool(sig, ksize=[1, 3, 3, 1], strides=self.stride, padding=sel... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def activation(x):\n # return np.tanh(x)\n return np.maximum(0,x)",
"def sigmoid_activation(x):\n return 1.0 / (1 + np.exp(-x))",
"def activation_sigmoid(self):\n self.value = 1 / (1 + np.e ** (-self.value))",
"def activation_sigmoid_custom(self):\n self.value = 1 / (1 + np.e ** (-4.9 * se... | [
"0.8208375",
"0.7616596",
"0.7611367",
"0.75473964",
"0.7541801",
"0.7535005",
"0.74537194",
"0.7429054",
"0.741272",
"0.73882735",
"0.7340315",
"0.7340315",
"0.73189396",
"0.7312046",
"0.73081857",
"0.73081857",
"0.73081857",
"0.73081857",
"0.73081857",
"0.73081857",
"0.7287... | 0.0 | -1 |
Return a copy of this Column. | def copy(self) -> "Column":
return replace(self, _cells=[]) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def clone(self):\n return self.__class__(self.column, *self.args, **self.kwargs)",
"def copy(self):\n data_copy = []\n\n # make a copy of the data\n for ii in range(self._nrows):\n data_copy.append(self._data[ii])\n\n # explicitly create a column from the data copy\n... | [
"0.80729014",
"0.79469174",
"0.6945267",
"0.69440436",
"0.6920025",
"0.6920025",
"0.6920025",
"0.6920025",
"0.6911348",
"0.68439215",
"0.6822397",
"0.682151",
"0.68030614",
"0.67778224",
"0.67778224",
"0.67563087",
"0.67563087",
"0.67563087",
"0.6750981",
"0.67289835",
"0.671... | 0.87895495 | 0 |
Get all cells in the column, not including header. | def cells(self) -> Iterable["RenderableType"]:
yield from self._cells | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def cells(self):\n return chain.from_iterable(self.cols)",
"def get_cells(self):\n return [\n cell for column in self.children for cell in column.get_cells()]",
"def get_cells(self):\n cell_list = []\n for cell_row in self.board:\n for current_cell in cell_row:... | [
"0.79657596",
"0.7785647",
"0.7295145",
"0.7284923",
"0.7120553",
"0.70126283",
"0.6939975",
"0.6905218",
"0.689524",
"0.681896",
"0.67958397",
"0.6780226",
"0.6719051",
"0.66107094",
"0.6609196",
"0.6573578",
"0.651782",
"0.6427883",
"0.6422083",
"0.6408693",
"0.6369426",
... | 0.63087976 | 24 |
Get the current number of rows. | def row_count(self) -> int:
return len(self.rows) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getNumRows(self) -> int:\n ...",
"def getNumRows(self):\n return self.__rows",
"def get_rows(self) -> int:\r\n return 1 + self.display.get_rows() + 1",
"def get_num_rows(self):\n return self._num_rows",
"def row_count(self):\n return self.__row_count",
"def row_coun... | [
"0.8484436",
"0.83752537",
"0.8322077",
"0.8287896",
"0.8280835",
"0.8249446",
"0.823849",
"0.8151865",
"0.8143471",
"0.81347686",
"0.81075114",
"0.79783416",
"0.79686904",
"0.7925985",
"0.7912195",
"0.7912195",
"0.7903756",
"0.7901625",
"0.7855576",
"0.7796618",
"0.77542883"... | 0.80204046 | 11 |
Map image values from [0, 255] to [1, 1]. | def image_zero_mean_unit_range(inputs):
return (2.0 / 255.0) * tf.to_float(inputs) - 1.0 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def mapper(value):\n\n out = scalarMap.to_rgba(value)\n\n if isinstance(out, tuple):\n return tuple([255 * out[i] for i in range(3)] + [alpha])\n\n elif isinstance(out, np.ndarray):\n out[:, :-1] *= 255\n out[:, 3] = alpha\n return out",
"def c_map... | [
"0.71373016",
"0.6680453",
"0.663814",
"0.65188766",
"0.64652723",
"0.64106435",
"0.64106435",
"0.64106435",
"0.64106435",
"0.63596404",
"0.63051397",
"0.630263",
"0.6246388",
"0.62335885",
"0.62175965",
"0.6181205",
"0.6148776",
"0.61479914",
"0.613498",
"0.6125498",
"0.6121... | 0.0 | -1 |
Nearest neighbor upsampling implementation. Nearest neighbor upsampling function that maps input tensor with shape [batch_size, height, width, channels] to [batch_size, height scale , width scale, channels]. This implementation only uses reshape and broadcasting to make it TPU compatible. | def nearest_neighbor_upsampling(input_tensor, scale=None, height_scale=None,
width_scale=None,scope=None):
if not scale and (height_scale is None or width_scale is None):
raise ValueError('Provide either `scale` or `height_scale` and'
' `width_scale`.')
with ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def upsampling_nhwc(data, scale):\n\n batch, height, width, channel = data.shape\n out_height = util.simplify(height * scale)\n out_width = util.simplify(width * scale)\n\n return tvm.compute((batch, out_height, out_width, channel), \\\n lambda n, h, w, c: data[n, h/scale, w/scal... | [
"0.7049332",
"0.6754502",
"0.6746988",
"0.6429446",
"0.6395906",
"0.636762",
"0.6354313",
"0.63407546",
"0.63085085",
"0.62727535",
"0.6240551",
"0.6162978",
"0.614411",
"0.6114098",
"0.6100202",
"0.60736763",
"0.6073359",
"0.603986",
"0.6018244",
"0.60058236",
"0.60058236",
... | 0.7713289 | 0 |
Get a beta which minimizes the cost function. | def min_batch_gradient_descent_with_momentum(train_data, val_data_text, batch_size, iterations, step_size, lam, momentum_step_size, vec_lenght, d2v_model, val_data_sentence=None):
beta = numpy.zeros(shape=(vec_lenght,1), dtype=float)
accuracies = []
betas = []
losses = []
sentence_accuracies = ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _beta(self):\n return _handle_ab(self.solution, self.use_const)[1]",
"def get_optimal_beta(self):\n if self.annealing:\n # find the epoch/index that had the highest NDCG@k value\n index_max_ndcg = np.argmax(self.val_ndcg)\n\n # using this index find the value th... | [
"0.7393826",
"0.72061884",
"0.6786605",
"0.6610329",
"0.6610329",
"0.65980184",
"0.65544677",
"0.65248483",
"0.64676404",
"0.64580184",
"0.6449079",
"0.6443347",
"0.6438576",
"0.6430154",
"0.63946587",
"0.6386683",
"0.6370564",
"0.63667625",
"0.633598",
"0.62952286",
"0.62937... | 0.0 | -1 |
Gets the workflow execution state. | def get_workflow_execution_state(self, cntx, **kwargs):
workbook_name = kwargs.get('workbook_name')
execution_id = kwargs.get('execution_id')
execution = db_api.execution_get(execution_id)
if not execution:
raise exc.EngineException("Workflow execution not found "
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_workflow_state(self):\n state = self._gdb_interface.get_workflow_state()\n return state",
"def workflow_state(self):\n return self.getattr('workflow_state')",
"def get_workflow_state(self):\n return self._read_transaction(tx.get_workflow_state)",
"def get_state(self):\n ... | [
"0.870771",
"0.8620069",
"0.8498785",
"0.77159256",
"0.7556355",
"0.74918246",
"0.74557287",
"0.7372245",
"0.73673946",
"0.73673946",
"0.73673946",
"0.73673946",
"0.73673946",
"0.7303761",
"0.7303761",
"0.7250543",
"0.7250543",
"0.7222189",
"0.7177927",
"0.7177927",
"0.717792... | 0.8004073 | 3 |
Gets the workflow execution state. | def get_workflow_execution_state(self, workbook_name, execution_id):
cntx = auth_context.ctx()
kwargs = {'workbook_name': workbook_name,
'execution_id': execution_id}
return self._client.call(
cntx, 'get_workflow_execution_state', **kwargs) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_workflow_state(self):\n state = self._gdb_interface.get_workflow_state()\n return state",
"def workflow_state(self):\n return self.getattr('workflow_state')",
"def get_workflow_state(self):\n return self._read_transaction(tx.get_workflow_state)",
"def get_workflow_executio... | [
"0.870771",
"0.8620069",
"0.8498785",
"0.8004073",
"0.77159256",
"0.7556355",
"0.74918246",
"0.74557287",
"0.73673946",
"0.73673946",
"0.73673946",
"0.73673946",
"0.73673946",
"0.7303761",
"0.7303761",
"0.7250543",
"0.7250543",
"0.7222189",
"0.7177927",
"0.7177927",
"0.717792... | 0.7372245 | 8 |
This function prints and plots the confusion matrix. Normalization can be applied by setting `normalize=True`. | def plot_confusion_matrix(cm, classes, normalize=False, title='Confusion matrix', cmap=plt.cm.Blues):
if normalize:
# 1. find out how many samples per class have received their correct label
# 计算真正类别为k的样本被预测成各个类别的比例
# e.g. 有25个样本的 true label 是 6,其中10个样本被预测为类别7,那么在混淆矩阵中 true label = 6 并且 pred... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def plot_confusion_matrix(cm, classes=[0,1], normalize=False, title='Confusion matrix', print_matrix=False):\n\n if normalize:\n cm = cm.astype('float') / cm.sum(axis=1)[:, np.newaxis]\n print(\"Normalized confusion matrix\")\n else:\n print('Confusion matrix, without normalization')\n\n... | [
"0.8194862",
"0.80949175",
"0.8029915",
"0.8019153",
"0.79941195",
"0.7991258",
"0.7980955",
"0.7976606",
"0.79610753",
"0.79590565",
"0.79378676",
"0.7934962",
"0.7934504",
"0.79313844",
"0.7926313",
"0.7924577",
"0.79241234",
"0.7923211",
"0.7923023",
"0.7921931",
"0.791787... | 0.79083747 | 22 |
This function prints and plots the confusion matrix. Normalization can be applied by setting `normalize=True`. (This function is copied from the scikit docs.) | def plot_confusion_matrix(cm, classes, normalize=False, title='Confusion matrix', cmap=plt.cm.Blues):
plt.figure()
plt.imshow(cm, interpolation='nearest', cmap=cmap)
plt.title(title)
plt.colorbar()
tick_marks = np.arange(len(classes))
plt.xticks(tick_marks, classes, rotation=45)
plt.yticks(t... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def plot_confusion_matrix(cm, classes=[0,1], normalize=False, title='Confusion matrix', print_matrix=False):\n\n if normalize:\n cm = cm.astype('float') / cm.sum(axis=1)[:, np.newaxis]\n print(\"Normalized confusion matrix\")\n else:\n print('Confusion matrix, without normalization')\n\n... | [
"0.8291936",
"0.81914574",
"0.814049",
"0.8123625",
"0.8112262",
"0.81084967",
"0.80970323",
"0.80770284",
"0.8074554",
"0.8046804",
"0.8042406",
"0.80392236",
"0.80290866",
"0.80275506",
"0.80231476",
"0.80230063",
"0.80225205",
"0.80218315",
"0.8017041",
"0.8003113",
"0.800... | 0.0 | -1 |
Check if color is provided in slot values. If provided, then set your favorite color from slot value into session attributes. If not, then it asks user to provide the color. | def my_color_handler(handler_input):
# type: (HandlerInput) -> Response
slots = handler_input.request_envelope.request.intent.slots
if color_slot in slots:
fav_color = slots[color_slot].value
handler_input.attributes_manager.session_attributes[
color_slot_key] = fav_color
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_color_in_session(intent, session):\n\n card_title = intent['name']\n session_attributes = {}\n should_end_session = False\n\n if 'Color' in intent['slots']:\n favorite_color = intent['slots']['Color']['value']\n session_attributes = create_favorite_color_attributes(favorite_color)... | [
"0.7307849",
"0.7307849",
"0.6277934",
"0.58879995",
"0.58129615",
"0.5773254",
"0.54779845",
"0.5462543",
"0.545795",
"0.54213864",
"0.53757894",
"0.5355902",
"0.5342139",
"0.5324282",
"0.5290349",
"0.52795255",
"0.52777785",
"0.5271246",
"0.5258043",
"0.52225536",
"0.517710... | 0.67298156 | 2 |
AMAZON.FallbackIntent is only available in enUS locale. This handler will not be triggered except in that locale, so it is safe to deploy on any locale. | def fallback_handler(handler_input):
# type: (HandlerInput) -> Response
speech = (
"The {} skill can't help you with that. "
"You can tell me your favorite color by saying, "
"my favorite color is red").format(skill_name)
reprompt = ("You can tell me your favorite color by saying, "... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def fall_back_message():\r\n card_title = \"Fallback Message\"\r\n fallback_string = \"Sorry. I couldn't understood it. Please say again.\"\r\n should_end_session = False\r\n session_attributes = { \r\n \"speech_output\": fallback_string,\r\n \r\n ... | [
"0.5874767",
"0.56067747",
"0.5587797",
"0.5461114",
"0.5461114",
"0.5407434",
"0.53535366",
"0.53535366",
"0.5300464",
"0.5268685",
"0.51799047",
"0.51645446",
"0.5152867",
"0.5070427",
"0.5061233",
"0.50287133",
"0.49781984",
"0.49310467",
"0.48656067",
"0.48499578",
"0.483... | 0.517305 | 12 |
Returns string representation of the instance | def __str__(self):
string = "[{}] ({}) {}/{} - {}"
if type(self) == Rectangle:
return "{}/{}".format(string.format(self.__class__.__name__,
self.id, self.__x, self.__y,
self.__width), self.__heigh... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __repr__(self):\n return self.to_str()",
"def __repr__(self):\n return self.to_str()",
"def __repr__(self):\n return self.to_str()",
"def __repr__(self):\n return self.to_str()",
"def __repr__(self):\n return self.to_str()",
"def __repr__(self):\n return self... | [
"0.8419653",
"0.8419653",
"0.8419653",
"0.8419653",
"0.8419653",
"0.8419653",
"0.8419653",
"0.8419653",
"0.8419653",
"0.8419653",
"0.8419653",
"0.8419653",
"0.8419653",
"0.8419653",
"0.8419653",
"0.8419653",
"0.8419653",
"0.8419653",
"0.8419653",
"0.8419653",
"0.8419653",
"... | 0.0 | -1 |
Calculates the area of `Rectangle` instance | def area(self):
return (self.__width * self.__height) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def rectangle_area(base, height):\n return (base * height)",
"def area_rect(w, h):\n return w * h",
"def rectangle_area(width : number, height : number) ->number:\n area = width*height\n #print(\"The area of rectangle is =\", area, \"sq. units\")\n return area",
"def findArea(self):\n\n ... | [
"0.80604005",
"0.7997399",
"0.7929691",
"0.78154814",
"0.7802556",
"0.77706134",
"0.7746906",
"0.77201146",
"0.770842",
"0.7685702",
"0.761078",
"0.75784713",
"0.75550354",
"0.75541335",
"0.7547624",
"0.7530248",
"0.7530248",
"0.7530248",
"0.7519148",
"0.7517379",
"0.7507473"... | 0.7481178 | 30 |
Yield successive nsized batches from l, the last batch is the left indexes. | def batches(l, n):
for i in range(0, l, n):
yield range(i,min(l,i+n)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def batches(l, n):\n for i in xrange(0, len(l), n):\n yield l[i:i+n]",
"def batches(l, n):\n for i in xrange(0, len(l), n):\n yield l[i:i+n]",
"def batches(l, n):\n for i in xrange(0, len(l), n):\n yield l[i:i+n]",
"def batchify(l, n):\n n = min(len(l), n)\n n = max(1, n)\... | [
"0.7244106",
"0.7244106",
"0.7244106",
"0.6902239",
"0.66420907",
"0.66012347",
"0.6592698",
"0.65698195",
"0.65517265",
"0.65515274",
"0.6547801",
"0.6547801",
"0.65453357",
"0.6511756",
"0.64867574",
"0.64727026",
"0.6472414",
"0.6455188",
"0.645363",
"0.6431867",
"0.642822... | 0.72139335 | 3 |
searches for target in int_list[low..high] and returns index if found If target is not found returns None. If list is None, raises ValueError | def bin_search(target, low, high, int_list): # must use recursion
if int_list is None:
raise ValueError
if not int_list:
return None
if len(int_list) == 1:
if int_list[0] == target:
return 0
else:
return None
""" Commenting it out so I can try a... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def bin_search(target, low, high, int_list): # must use recursion\n if int_list == None:\n raise ValueError\n if len(int_list) == 0:\n return None\n middle = (low + high) // 2\n if low > high or low < 0 or high > len(int_list):\n return None\n elif int_list[middle] == target:\n retur... | [
"0.78064954",
"0.7722183",
"0.7628943",
"0.7617595",
"0.7500828",
"0.7129551",
"0.7061968",
"0.7030011",
"0.7007255",
"0.6905519",
"0.68501556",
"0.6822841",
"0.68204737",
"0.678399",
"0.6729827",
"0.66920483",
"0.6690406",
"0.6690003",
"0.6678196",
"0.66231793",
"0.66188633"... | 0.7630715 | 2 |
Gets the IR I/O artifact type msg for the given ComponentSpec I/O type. | def get_artifact_type_schema(
artifact_class_or_type_name: Optional[Union[str,
Type[artifact_types.Artifact]]]
) -> pipeline_spec_pb2.ArtifactTypeSchema:
artifact_class = artifact_types.Artifact
if isinstance(artifact_class_or_type_name, str):
if re.ma... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_msg_type(self):\n return self._msg_type",
"def artifact_types_get_req():\n return {'status': 'success',\n 'message': '',\n 'types': Artifact.types()}",
"def message_type(self) -> pulumi.Output[Optional[str]]:\n return pulumi.get(self, \"message_type\")",
"def ty... | [
"0.57133764",
"0.55682087",
"0.5539773",
"0.5293688",
"0.5293688",
"0.5293688",
"0.5293688",
"0.5293688",
"0.5293688",
"0.5293688",
"0.5293688",
"0.5293688",
"0.5293688",
"0.5293688",
"0.5293688",
"0.5293688",
"0.5293688",
"0.5293688",
"0.5293688",
"0.5293688",
"0.5293688",
... | 0.0 | -1 |
Determines the initial positions of the boids | def initialise_positions(self):
#print("initialise_positions")
for i in range(self.numBoids):
self.boids.append(Boid(random.randint(0, self.width), random.randint(self.height, self.height+5)))
#self.boids.append(Boid(random.randint(0, self.width), random.randint(0, self.heigh... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _init_boids_state(self) -> np.ndarray:\n dims, n_boids, n_attrs = self.dims, self.num_boids, len(Boids.Attr)\n max_vel, max_acc = self.max_vel, self.max_acc\n state = np.zeros([dims, n_boids, n_attrs], dtype=\"float\")\n\n for idx, env_dim in zip(range(dims), self.env_bounds):\n ... | [
"0.64405227",
"0.6385118",
"0.6176484",
"0.6091319",
"0.607311",
"0.5906029",
"0.5873722",
"0.5778968",
"0.5762568",
"0.572325",
"0.5661971",
"0.56612045",
"0.5646269",
"0.56338286",
"0.5630172",
"0.5609703",
"0.55687207",
"0.55306166",
"0.5522187",
"0.55181324",
"0.5511088",... | 0.74529254 | 0 |
The value for the parameter. | def value(self) -> pulumi.Input[str]:
return pulumi.get(self, "value") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getValue(self):\n return _libsbml.Parameter_getValue(self)",
"def param_value(self):\n if self.string:\n return self.string\n if self.token:\n return self.token\n if self.number:\n return self.number\n if self.date:\n return self.... | [
"0.84563196",
"0.8044787",
"0.784022",
"0.7773044",
"0.7763686",
"0.77436674",
"0.771973",
"0.77173394",
"0.77173394",
"0.77173394",
"0.7700097",
"0.7673806",
"0.7673806",
"0.7669605",
"0.7664224",
"0.76612186",
"0.76509374",
"0.76509374",
"0.76079196",
"0.76079196",
"0.76079... | 0.78622633 | 6 |
r""" Add boundary pores to the specified faces of the network Pores are offset from the faces by 1/2 of the given ``spacing``, such that they lie directly on the boundaries. | def add_boundary_pores(self, labels, spacing):
spacing = np.array(spacing)
if spacing.size == 1:
spacing = np.ones(3)*spacing
for item in labels:
Ps = self.pores(item)
coords = np.absolute(self['pore.coords'][Ps])
axis = np.count_nonzero(np.diff(co... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def pad(self):\n if self._mg_problem.boundaries[0] == 'periodic':\n # left side\n self.left[:] = self.mid[-self.borders[0]:]\n # right side\n self.right[:] = self.mid[:self.borders[1]]\n elif self._mg_problem.boundaries[0] == 'dirichlet':\n\n ... | [
"0.5725349",
"0.56848395",
"0.5580455",
"0.5533676",
"0.549242",
"0.52900565",
"0.5250789",
"0.52498525",
"0.519373",
"0.51781493",
"0.5144532",
"0.5118516",
"0.5097925",
"0.5095954",
"0.50916547",
"0.5088582",
"0.49400967",
"0.49191415",
"0.49180368",
"0.4881548",
"0.4874090... | 0.6130713 | 0 |
Plot tSNE embedding based on input data. | def plot_embedding(embedding, cls, cls_labels, filename, vrange=None):
n_labels = np.unique(cls).size
# Different colormap based on input data size
if np.unique(cls).__len__() == 2:
cmap = ListedColormap([
[1.0, 0.6, 0.333], # Orange (src)
[0.267, 0.667, 0.0], # Green (tar... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def plot_t_sne(embedding, labels, info, color='black'):\n mpl.rcParams['text.color'] = color\n mpl.rcParams['axes.labelcolor'] = color\n mpl.rcParams['xtick.color'] = color\n mpl.rcParams['ytick.color'] = color\n\n tsne = TSNE(n_components=2).fit_transform(embedding)\n plt.figure(figsize=(20, 12)... | [
"0.76549387",
"0.7160164",
"0.7020868",
"0.6991237",
"0.6911893",
"0.6861424",
"0.68275064",
"0.6601704",
"0.6589862",
"0.64508086",
"0.638891",
"0.6385376",
"0.63662934",
"0.6336933",
"0.6334468",
"0.6224937",
"0.6114717",
"0.6090837",
"0.60781914",
"0.60522926",
"0.60454005... | 0.0 | -1 |
Decay the learning rate based on schedule | def adjust_learning_rate(optimizer, epoch, args):
lr = args.lr
if args.cos: # cosine lr schedule
lr *= 0.5 * (1. + math.cos(math.pi * epoch / args.epochs))
else: # stepwise lr schedule
for milestone in args.schedule:
lr *= 0.1 if epoch >= milestone else 1.
for param_group i... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def learning_rate_decay(alpha, decay_rate, global_step, decay_step):\n \"\"\"if staircase == True\n decayed_learning_rate = learning_rate /\n (1 + decay_rate * floor(global_step / decay_step)))\"\"\"\n return tf.train.inverse_time_decay(\n alpha, global_step, decay_step, decay_rate, staircase=Tr... | [
"0.7373194",
"0.7292736",
"0.7228895",
"0.7211029",
"0.7203241",
"0.72028047",
"0.71989626",
"0.718389",
"0.7162159",
"0.71439254",
"0.7130453",
"0.7110413",
"0.7034126",
"0.70272094",
"0.7019835",
"0.700661",
"0.6999512",
"0.69994646",
"0.69744974",
"0.6970913",
"0.69616294"... | 0.6780036 | 53 |
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.view(1, -1).expand_as(pred))
res = []
for k in topk:
c... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def topk_accuracy(y, y_pred, k=2):\n pred = []\n for i in range(len(y)):\n if y[i] in y_pred[i][:k]:\n pred.append(1)\n else:\n pred.append(0)\n return sum(pred) / len(pred)",
"def accuracy(y_pred, y_actual, topk=(1, )):\n maxk = max(topk)\n batch_size = y_actua... | [
"0.8331214",
"0.8284662",
"0.82381004",
"0.8229767",
"0.82202226",
"0.81864446",
"0.81847763",
"0.8175173",
"0.8171541",
"0.81699467",
"0.81664646",
"0.81645083",
"0.81637454",
"0.81622064",
"0.81622064",
"0.81622064",
"0.81622064",
"0.81622064",
"0.81622064",
"0.81622064",
"... | 0.7847017 | 89 |
Initialize an instance of EventSynchronizationClimateNetwork. For other applications of event synchronization networks please use the event synchronization class directly. | def __init__(self, data, quantile_threshold, taumax,
eventsynctype="directedES", non_local=False,
node_weight_type="surface", silence_level=0):
etypes = ["directedES", "symmetricES", "antisymmetricES"]
if eventsynctype not in etypes:
raise IOError("wrong eve... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self, data, threshold=None, link_density=None,\n non_local=False, node_weight_type=\"surface\", winter_only=True,\n silence_level=0):\n if silence_level <= 1:\n print(\"Generating a partial correlation climate network...\")\n\n # Call construct... | [
"0.604385",
"0.564202",
"0.56347317",
"0.5559823",
"0.5545838",
"0.55294275",
"0.5492595",
"0.5467865",
"0.54539466",
"0.54407275",
"0.5420411",
"0.54165393",
"0.5409591",
"0.5409591",
"0.54067487",
"0.53965414",
"0.53584236",
"0.53520775",
"0.53408116",
"0.52903414",
"0.5277... | 0.68754226 | 0 |
Generating padding values for missing values in batch for tensorflow datasets. | def get_padding_values():
return (tf.constant(0, tf.float32), tf.constant(0, tf.float32), tf.constant(0, tf.float32)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _padding(inputs, paddings, data_format):\n if data_format == 'channels_first':\n padded_inputs = tf.pad(\n inputs, [[0, 0], [0, 0], paddings, paddings])\n else:\n padded_inputs = tf.pad(\n inputs, [[0, 0], paddings, paddings, [0, 0]])\n return padded_inputs",
"def pad_data(data: List[n... | [
"0.69893",
"0.69005",
"0.6868168",
"0.6868168",
"0.6812341",
"0.6790869",
"0.674317",
"0.6700164",
"0.66832453",
"0.6673711",
"0.66582376",
"0.65898716",
"0.65739256",
"0.6561327",
"0.6518988",
"0.6486013",
"0.6482849",
"0.6479245",
"0.6462387",
"0.6452272",
"0.6438998",
"0... | 0.6584743 | 12 |
Preprocess text produced by tesseract Input text is raw text with line changes and spaces, e.g. 'Imatralla paloi rengasvarasto Puolueiden vastattava Kataiselle' Return value is a list of lists with lowercased and baseformed words, e.g. [['imatra', 'palaa', 'rengasvarasto'], ['puolue', 'vastata', 'katainen']] | def _preprocess_text(text: str) -> List[List[str]]:
# replace all except characters_to_keep with space
characters_to_keep = '[^\n:-äÄöÖåÅA-Za-z0-9]'
text = re.sub(characters_to_keep,' ', text )
# split the whole text to list of strings
sentences = text.splitlines()
# split each string further... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def preprocessing(raw_text):\n words_list = tokenize(raw_text)\n words_list = remove_stop_words(words_list)\n words_list = remove_punctuations(words_list)\n words_list = lemmatization(words_list)\n return words_list",
"def process_text(text):\n words = word_tokenize(text)\n return [w... | [
"0.75429535",
"0.7260118",
"0.7200798",
"0.71897835",
"0.7137474",
"0.69452167",
"0.6892202",
"0.68648344",
"0.6831022",
"0.6823761",
"0.6823411",
"0.6801544",
"0.6778151",
"0.6738121",
"0.6730106",
"0.6720221",
"0.668507",
"0.66600996",
"0.6650853",
"0.6628521",
"0.6618591",... | 0.75888205 | 0 |
Repair broken words caused by malfunctioning OCR Tesseract seems to erroneously cut words containing letter 'j' in the middle. For example, word 'Norja' is recognized as 'Nor' and 'ja'. This function attempts to repair such words by combining words beginning with 'j' with the previous word. | def _repair_broken_j_words(sentence: List[List[str]]) -> List[List[str]]:
if len(sentence) < 2:
return sentence
repaired_sentence = []
skip = False
# loop from last word to first word
for word_index in range((len(sentence)-1), 0, -1):
if skip:
skip = False
c... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def correct_spelling(sample):\n words = nltk.word_tokenize(sample[\"full_text\"])\n for word in words:\n for char, duplicate_char in duplicate_chars.items():\n word = re.sub(duplicate_char, char, word)\n #sample[\"full_text\"] = ' '.join([spell(w)] for w in tweet.split()])\n sample[\"... | [
"0.63382626",
"0.62903666",
"0.6276141",
"0.62026006",
"0.6130335",
"0.60531026",
"0.6040309",
"0.60396665",
"0.6037011",
"0.6035838",
"0.60265374",
"0.5999508",
"0.5939888",
"0.59209734",
"0.5918942",
"0.58805496",
"0.58686876",
"0.5838712",
"0.5837563",
"0.5834187",
"0.5829... | 0.75312597 | 0 |
PathArray is a list of nodes in the path where each node is represented as below list [Node,Parent,f,g,h,Strength of edge from previous node] This function searches for a node in the Array and returns its index. It returns 1 for not found | def search(PathArray,NodeIndex):
pos=-1
for i in range(0,len(PathArray)):
if(PathArray[i][0]==NodeIndex):
pos=i
return pos | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def search(self) -> int:\n # crete node list\n for x in range(self.n):\n for y in range(self.n):\n if not self.grid[y][x] == 0:\n self.all_nodes.append((x, y))\n # recursively create paths\n i = 0\n paths = [[(0, 0)]]\n while i ... | [
"0.6414321",
"0.590437",
"0.576144",
"0.5734343",
"0.5648062",
"0.5441279",
"0.54362667",
"0.5408529",
"0.5403014",
"0.53967386",
"0.5381519",
"0.53665555",
"0.53621787",
"0.5344977",
"0.5339363",
"0.5318687",
"0.5312708",
"0.52959466",
"0.5293645",
"0.5292954",
"0.5284591",
... | 0.7645758 | 0 |
Test SAMBA offset wrong configuration. No chosen code partition. | def test_bossac_create_error_missing_dt_info(cc, req, get_cod_par, sup,
runner_config, tmpdir):
runner_config = adjust_runner_config(runner_config, tmpdir,
DOTCONFIG_COND1)
runner = BossacBinaryRunner(runner_config)
with pytest.raises(RuntimeError) as rinfo... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_validate_input_offset(self):\n final_config = self.dtm2.validate_input('01010101')\n nose.assert_equal(final_config[0], 'q4')\n nose.assert_equal(str(final_config[1]), 'TMTape(\\'yyx1010101\\')')",
"def testGetConfigOffset(self):\n self.ports.getconfig_offset(file_name = 'get... | [
"0.6643436",
"0.64851516",
"0.64280146",
"0.6227951",
"0.61955684",
"0.61297524",
"0.60650164",
"0.6030077",
"0.59920657",
"0.5959444",
"0.5909758",
"0.590427",
"0.5840313",
"0.58320457",
"0.5772515",
"0.5760026",
"0.5749771",
"0.5715485",
"0.5685552",
"0.56339747",
"0.562729... | 0.0 | -1 |
Normalize the flow velocity vector by a reference velocity. | def velocity(avg_slice_df, u_keys, norm_u_keys, u_reference):
dataframe = avg_slice_df.copy()
dataframe[norm_u_keys] = dataframe[u_keys]/u_reference
return dataframe | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def normalize(self):\n self.vector /= np.linalg.norm(self.vector)",
"def normalize(v):\n return v / np.linalg.norm(v)",
"def normalize(self, vec):\n length = math.sqrt( vec[0,0]*vec[0,0] + vec[0,1]*vec[0,1] + vec[0,2]*vec[0,2] )\n vnorm = vec / length\n return vnorm",
"def norm... | [
"0.6740066",
"0.65484005",
"0.63692707",
"0.6368964",
"0.6353171",
"0.6322287",
"0.63012135",
"0.6262109",
"0.6227564",
"0.62230635",
"0.6180135",
"0.61746174",
"0.6152371",
"0.6145424",
"0.6143151",
"0.61190146",
"0.6117943",
"0.6102518",
"0.60979676",
"0.6096037",
"0.608735... | 0.0 | -1 |
Creates a message that may be sent, or used to represent a response. | def __init__(self, destination, packet, source):
self.__destination = destination
self.__packet = packet
self.__source = source | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def message(self, *args, **kwargs) -> Message:\n return Message(self.handle, *args, **kwargs)",
"def createMessage( self, *args, **kw ):\n return MailMessage( *args, **kw )",
"def _wrap(self, value, msg):\n if value is not None:\n answer = Message(msg)\n answer[RESPON... | [
"0.6764723",
"0.65258324",
"0.65101117",
"0.6506589",
"0.64128864",
"0.6388366",
"0.63227016",
"0.62965745",
"0.6271171",
"0.6229197",
"0.6213088",
"0.6197475",
"0.6149552",
"0.61248773",
"0.61225164",
"0.6122353",
"0.60992056",
"0.6089778",
"0.60635424",
"0.60185826",
"0.598... | 0.0 | -1 |
Creates a ResponseList with initial data if available. | def __init__(self, initial_set=None, verbose=False, output=sys.stdout):
if initial_set is None:
initial_set = []
self.__responses = []
self.clear_responses()
self.verbose = verbose
self.output = output
# Round Trip Time
self.__rtt_avg = 0
se... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def build_response(self, data_list):\n raise NotImplementedError(\"build_response method is not implemented.\")",
"def set_response_list(self, r_list):\n self.response_list = r_list",
"def set_response_list(cls,response_list):\n if not isinstance(response_list,list):\n raise ValueError(... | [
"0.6899752",
"0.6276658",
"0.6181979",
"0.613757",
"0.610637",
"0.60595995",
"0.6042481",
"0.5895424",
"0.5852088",
"0.5822241",
"0.568153",
"0.56680024",
"0.5659078",
"0.5654836",
"0.5648496",
"0.5634482",
"0.56290126",
"0.558679",
"0.55768055",
"0.55746734",
"0.5567156",
... | 0.57039773 | 10 |
Sets the name of the active branch. | def topology_write_branch_name(self, argument):
result = ctypes.c_char_p(self.dss_obj.TopologyS(ctypes.c_int32(1), argument.encode('ascii')))
return result.value.decode('ascii') | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def branch(branch_name):\n env.branch = branch_name",
"def branch(branch_name):\n env.branch = branch_name",
"def setName(self, name):\n self.name = str(name)",
"def setName(self, name):\n self._name = name",
"def setName(self, name):\n self._name = name",
"def setName(self, na... | [
"0.7005114",
"0.7005114",
"0.6718768",
"0.66852176",
"0.66852176",
"0.6622431",
"0.6621351",
"0.6621351",
"0.6621351",
"0.6621351",
"0.6613326",
"0.6613326",
"0.6613326",
"0.6613326",
"0.6613326",
"0.6592061",
"0.6579551",
"0.6579551",
"0.6530985",
"0.6489447",
"0.6488221",
... | 0.0 | -1 |
Gets the name of the active Bus. | def topology_read_bus_name(self):
result = ctypes.c_char_p(self.dss_obj.TopologyS(ctypes.c_int32(2), ctypes.c_int32(0)))
return result.value.decode('ascii') | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def event_bus_name(self) -> pulumi.Output[Optional[str]]:\n return pulumi.get(self, \"event_bus_name\")",
"def get_active_name(self):\n return self.get_name()",
"def get_bus(self):\n return self._bus",
"def event_bus_name(self) -> Optional[pulumi.Input[str]]:\n return pulumi.get(s... | [
"0.7231221",
"0.7082972",
"0.69905627",
"0.68641275",
"0.68641275",
"0.6444249",
"0.63252985",
"0.63252985",
"0.63252985",
"0.6319705",
"0.62259126",
"0.61183435",
"0.6088929",
"0.6043617",
"0.59915054",
"0.5975536",
"0.5956913",
"0.5956793",
"0.5952061",
"0.59213465",
"0.591... | 0.69716084 | 3 |
Returns True for strings like '1920x1080+1920+0' | def is_resolution_and_offset_str(x):
if x.count('x') == 1 and x.count('+') == 2:
return True
return False | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def check_if_scaled(a):\r\n if a.split(\" \")[-1] == 's':\r\n return True\r\n else:\r\n return False",
"def _is_shorthand_ip(ip_str):\r\n if ip_str.count('::') == 1:\r\n return True\r\n if filter(lambda x: len(x) < 4, ip_str.split(':')):\r\n return True\r\n return False... | [
"0.583628",
"0.5798036",
"0.5753436",
"0.57368207",
"0.572657",
"0.5663667",
"0.5652605",
"0.5604014",
"0.5595576",
"0.5532367",
"0.5494213",
"0.5475044",
"0.54711914",
"0.54650754",
"0.54568106",
"0.5451744",
"0.54499096",
"0.54105395",
"0.54070693",
"0.53927016",
"0.5392172... | 0.7111419 | 0 |
This method sets up main window with necessary functions | def setup_containers(self):
self.container_widgets["main_frame"].grid(row=0, column=0, sticky='news')
self.container_widgets["panel_frame"].grid(row=0, column=0)
self.container_widgets["order_frame"].grid(row=1, column=0, sticky='nw')
self.container_widgets["order_frame"].grid_rowcon... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def setupWindow(self):\n\n\t\tself.main_menu_window = MenuFrame.MainMenuFrame(self.uiCoordinator)\n\t\tself.menu_window = self.main_menu_window._mf\n\t\tself.score_window = self.main_menu_window._hf\n\t\tself.instructions_window = self.main_menu_window._if\n\t\tself.menu_window.playButton.focus_set()",
"def main... | [
"0.8061371",
"0.7649427",
"0.7551971",
"0.7498142",
"0.74925935",
"0.74616414",
"0.7447475",
"0.7390209",
"0.73782283",
"0.7358198",
"0.7356893",
"0.73355234",
"0.73069155",
"0.7275026",
"0.7266931",
"0.7249033",
"0.72150487",
"0.7203387",
"0.71972376",
"0.7194971",
"0.718267... | 0.0 | -1 |
Create a ddimensional vector of zeros. d Dimension of th vctor space (int) | def __init__(self, d):
self._coords = [0]*d | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_zero_vector(self):\n self.vector = np.zeros(self.dimension, dtype = float)",
"def zero():\n return Vec2d(0, 0)",
"def zeros(cls, n):\n return cls._createVetor([0] * n)",
"def zeros(num):\n if num < 1:\n raise IndexError('num must be >= 1.')\n return Vecto... | [
"0.699331",
"0.69338846",
"0.688042",
"0.6575382",
"0.6523492",
"0.65179443",
"0.6362196",
"0.62957394",
"0.62841344",
"0.6271588",
"0.62710917",
"0.62319684",
"0.6168773",
"0.6160466",
"0.6073426",
"0.60478204",
"0.59583145",
"0.5953673",
"0.5906809",
"0.58981913",
"0.589116... | 0.5937277 | 18 |
Return True if vector has same coords as other. other Another Vector instance. | def __eq__(self, other):
return self._coords == other._coords | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __eq__(self, other):\n\n if hasattr(other, 'vector'):\n return self.vector == other.vector",
"def __eq__(self, other):\n if not isinstance(other, Vector):\n return False\n elif len(self) != len(other):\n return False\n else:\n for i, ele... | [
"0.7867655",
"0.78505296",
"0.75642854",
"0.74431944",
"0.73804855",
"0.7270393",
"0.7263702",
"0.7260006",
"0.71128005",
"0.7071016",
"0.7054285",
"0.70071024",
"0.69716185",
"0.68926316",
"0.6875106",
"0.68488705",
"0.6842881",
"0.68093497",
"0.6808944",
"0.6782543",
"0.677... | 0.6932069 | 13 |
Return True if vector differs from other. Rely on __eq__ method above. other Another Vector instance. | def __ne__(self, other):
return not self == other | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __eq__(self, other):\n\n if hasattr(other, 'vector'):\n return self.vector == other.vector",
"def __eq__(self, other):\n if not isinstance(other, Vector):\n return False\n elif len(self) != len(other):\n return False\n else:\n for i, ele... | [
"0.8416911",
"0.8303531",
"0.83003414",
"0.8110744",
"0.78972036",
"0.7754569",
"0.7317807",
"0.72626585",
"0.72034264",
"0.7156077",
"0.7111875",
"0.7011312",
"0.7006901",
"0.6972406",
"0.6965758",
"0.6957382",
"0.6933496",
"0.6926312",
"0.6890774",
"0.68798864",
"0.68793905... | 0.0 | -1 |
Prepares some parameter for the justification step for an statement. | def preparation_for_justify_statement(history, db_user: User, path, db_issue: Issue, db_statement: Statement,
supportive: bool):
logger('ViewHelper', 'main')
nickname = db_user.nickname
slug = db_issue.slug
disc_ui_locales = db_issue.lang
_ddh = DiscussionDictH... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def prepare_sql(self, sql):\n # Oracle doesn't like trailing semicolons. So remove them.\n # To do this properly we need to strip comments.\n # See issue5.\n sql = sqlparse.format(sql, strip_comments=True)\n sql = sql.strip()\n if sql.endswith(';'):\n sql = sql[... | [
"0.5785823",
"0.5381827",
"0.5259919",
"0.5191174",
"0.51249635",
"0.5118192",
"0.5103413",
"0.50326574",
"0.4952907",
"0.48811838",
"0.4878557",
"0.4842411",
"0.48132613",
"0.48061097",
"0.47886723",
"0.47865456",
"0.4745506",
"0.46985602",
"0.46917823",
"0.4689447",
"0.4676... | 0.4502369 | 37 |
The month of the timestamp as January = 1 December = 12. | def month(self) -> Index:
return Index(self.to_series().dt.month) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def date_month(date):\n return date.month",
"def month(self):\n return self.__month",
"def month(self):\n return self._month",
"def month(self):\n return self._month",
"def month(self):\n return 0",
"def month(self):\n return 0",
"def month(self):\n return g... | [
"0.8104562",
"0.80712986",
"0.80132097",
"0.80132097",
"0.79806757",
"0.79806757",
"0.7969147",
"0.79034203",
"0.7899005",
"0.7883867",
"0.78274465",
"0.7820827",
"0.7765214",
"0.7751461",
"0.7591953",
"0.7581473",
"0.7531232",
"0.7519858",
"0.72935426",
"0.727651",
"0.725828... | 0.7017002 | 29 |
The days of the datetime. | def day(self) -> Index:
warnings.warn(
"`day` will return int32 index instead of int 64 index in 4.0.0.",
FutureWarning,
)
return Index(self.to_series().dt.day) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def days(self):\n return self._days",
"def days(self):\n return int(self.hours / 24)",
"def day(self):\n return self._days",
"def days(self):\n ends_at = created_at = datetime.datetime.now().replace(tzinfo=utc)\n if self.created_at:\n created_at = self.created_at\n ... | [
"0.8520996",
"0.8368037",
"0.80617046",
"0.76972675",
"0.76509273",
"0.76329875",
"0.76185906",
"0.7597425",
"0.7558615",
"0.7415131",
"0.7285971",
"0.7285971",
"0.7115692",
"0.71134806",
"0.7045281",
"0.70404047",
"0.69850135",
"0.6954528",
"0.6937267",
"0.6864052",
"0.68522... | 0.0 | -1 |
The minutes of the datetime. | def minute(self) -> Index:
warnings.warn(
"`minute` will return int32 index instead of int 64 index in 4.0.0.",
FutureWarning,
)
return Index(self.to_series().dt.minute) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_minutes(self, datetime):\n return datetime.hour*60.0+datetime.minute+datetime.second/60",
"def minutes(self):\n return int(int(self) / 60)",
"def TimeMinutes(self):\n return '%2.2d:%2.2d' % (self._hour, self._minute)",
"def getMinute(self):\n return _libsbml.Date_getMinute... | [
"0.85043406",
"0.8283824",
"0.81989807",
"0.80068314",
"0.7992579",
"0.7939394",
"0.7616362",
"0.75610286",
"0.7466347",
"0.73778373",
"0.72971404",
"0.71962",
"0.7172429",
"0.70868325",
"0.70815384",
"0.707532",
"0.707532",
"0.707532",
"0.707532",
"0.7018843",
"0.69089925",
... | 0.60142076 | 64 |
The seconds of the datetime. | def second(self) -> Index:
warnings.warn(
"`second` will return int32 index instead of int 64 index in 4.0.0.",
FutureWarning,
)
return Index(self.to_series().dt.second) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def seconds(self):\n return self._seconds",
"def seconds(self):\n return self._seconds",
"def seconds(self):\n return int(self)",
"def seconds(self):\n end = self.end or timezone.now()\n result = end - self.start\n return result.seconds",
"def current_time_seconds(... | [
"0.84812224",
"0.84812224",
"0.8401128",
"0.82475597",
"0.7866363",
"0.78395224",
"0.7731272",
"0.7712591",
"0.7705016",
"0.7680316",
"0.7633467",
"0.7609202",
"0.7603191",
"0.7596321",
"0.75893754",
"0.75860906",
"0.71765953",
"0.717377",
"0.71459746",
"0.7130207",
"0.712548... | 0.0 | -1 |
The ordinal day of the year. | def dayofyear(self) -> Index:
warnings.warn(
"`dayofyear` will return int32 index instead of int 64 index in 4.0.0.",
FutureWarning,
)
return Index(self.to_series().dt.dayofyear) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def day_of_year(self):\n return int(self.date.strftime('%j'))",
"def dayOfYear(self):\n d = int(self._d + (_tzoffset(self._tz, self._t) / 86400.0))\n return int((d + jd1901) - _julianday(self._year, 1, 0))",
"def day_of_year(date=datetime.datetime.now()):\n return date.strftime(\"Its th... | [
"0.85720265",
"0.7664535",
"0.7581429",
"0.7494984",
"0.7446475",
"0.73827213",
"0.7131372",
"0.7115",
"0.7043509",
"0.70245564",
"0.6969222",
"0.68943423",
"0.6867371",
"0.68427855",
"0.6802083",
"0.67872876",
"0.6761524",
"0.67203796",
"0.67203796",
"0.66952443",
"0.6624813... | 0.76728404 | 1 |
Indicates whether the date is the first day of the month. Returns Index Returns a Index with boolean values See Also | def is_month_start(self) -> Index:
return Index(self.to_series().dt.is_month_start) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_first_day_of_month(timestamps):\n return extract_day_of_month(timestamps) == 1",
"def first_day_of_month(date):\n return date.replace(day=1)",
"def first_day_of_month(date):\n return date.replace(day=1)",
"def is_startmonth(today):\n if isinstance(today, datetime):\n if today.day ==... | [
"0.79160637",
"0.7363046",
"0.7363046",
"0.689173",
"0.6661712",
"0.6635867",
"0.65937966",
"0.6436959",
"0.6315831",
"0.61347914",
"0.60985434",
"0.6052432",
"0.60402095",
"0.59808135",
"0.59640026",
"0.5961839",
"0.5922946",
"0.58370835",
"0.5763265",
"0.56965995",
"0.56920... | 0.80070496 | 0 |
Indicates whether the date is the last day of the month. Returns Index Returns an Index with boolean values. See Also | def is_month_end(self) -> Index:
return Index(self.to_series().dt.is_month_end) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_end_of_month(self):\n return tf.math.equal(self._days,\n _num_days_in_month(self._months, self._years))",
"def test_date_accept_last_month(self):\n spi_search = \"find date last month\"\n inv_search = \"year:\" + datetime.datetime.strftime(datetime.... | [
"0.72319156",
"0.70846444",
"0.67741394",
"0.67741394",
"0.6629216",
"0.65839994",
"0.65768117",
"0.6514633",
"0.64006263",
"0.6383325",
"0.63496023",
"0.61929744",
"0.6097155",
"0.60391474",
"0.599516",
"0.59798646",
"0.5966209",
"0.5926598",
"0.58718055",
"0.58662957",
"0.5... | 0.80559915 | 0 |
Indicator for whether the date is the first day of a quarter. Returns | def is_quarter_start(self) -> Index:
return Index(self.to_series().dt.is_quarter_start) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_quarter_start(x: Optional[Date] = None) -> Date:\n asof = x or get_today()\n return asof.replace(month=(asof.month - 1) // 3 * 3 + 1, day=1)",
"def test_first(self):\n start_date, end_date = get_quarterspan(datetime.date(1980, 1, 1))\n self.assertTrue(start_date < end_date)\n s... | [
"0.73662317",
"0.70583546",
"0.6375467",
"0.6172755",
"0.6068727",
"0.5964025",
"0.59476197",
"0.58196837",
"0.5791682",
"0.5682062",
"0.5667024",
"0.5652155",
"0.5652155",
"0.565214",
"0.5638572",
"0.5582289",
"0.5495158",
"0.5484362",
"0.54509",
"0.5430776",
"0.53727704",
... | 0.75288516 | 0 |
Indicator for whether the date is the last day of a quarter. Returns | def is_quarter_end(self) -> Index:
return Index(self.to_series().dt.is_quarter_end) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_quarter_end(x: Optional[Date] = None) -> Date:\n return get_quarter_start(x or get_today()) + relativedelta(months=+3, days=-1)",
"def last_quarter(today):\n quarter_date = today - relativedelta(months=1)\n while quarter_date.month % 3 != 0:\n quarter_date = quarter_date - relativedelta(m... | [
"0.73602426",
"0.6686088",
"0.65293217",
"0.64584154",
"0.6350703",
"0.63112634",
"0.6140201",
"0.5960761",
"0.5931033",
"0.58867675",
"0.5884977",
"0.58243096",
"0.58099806",
"0.57245183",
"0.56889504",
"0.56889504",
"0.55878305",
"0.5577797",
"0.5570413",
"0.55699295",
"0.5... | 0.7373958 | 0 |
The number of days in the month. | def daysinmonth(self) -> Index:
warnings.warn(
"`daysinmonth` will return int32 index instead of int 64 index in 4.0.0.",
FutureWarning,
)
return Index(self.to_series().dt.daysinmonth) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def days_in_month(self):\n return calendar.monthrange(self.year, self.month)[1]",
"def days_of_month(self) -> Optional[pulumi.Input[str]]:\n return pulumi.get(self, \"days_of_month\")",
"def days_of_month(self) -> Optional[pulumi.Input[Sequence[pulumi.Input['DayArgs']]]]:\n return pulumi.g... | [
"0.85840625",
"0.7925588",
"0.7865094",
"0.76419634",
"0.7638881",
"0.7599129",
"0.7598703",
"0.7569419",
"0.7569419",
"0.7567456",
"0.7539655",
"0.75280553",
"0.7395508",
"0.7311579",
"0.7269016",
"0.7224935",
"0.7224935",
"0.72152674",
"0.7139092",
"0.71106446",
"0.70088404... | 0.57876164 | 88 |
Return the month names of the DatetimeIndex with specified locale. | def month_name(self, locale: Optional[str] = None) -> Index:
return Index(self.to_series().dt.month_name(locale)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def month(index):\n return {\n 1: 'Jan.',\n 2: 'Feb.',\n 3: 'March',\n 4: 'April',\n 5: 'May',\n 6: 'June',\n 7: 'July',\n 8: 'Aug.',\n 9: 'Sept.',\n 10: 'Oct.',\n 11: 'Nov.',\n 12: 'Dec.'\n }.get(index)",
"def months(self)... | [
"0.65934527",
"0.62471324",
"0.6143463",
"0.6111557",
"0.60990685",
"0.60492116",
"0.60301524",
"0.59988254",
"0.5975136",
"0.58173215",
"0.5781694",
"0.5776679",
"0.5776486",
"0.57366884",
"0.56245524",
"0.5619033",
"0.56112397",
"0.5586533",
"0.5586147",
"0.5551261",
"0.545... | 0.8256566 | 0 |
Return the day names of the series with specified locale. | def day_name(self, locale: Optional[str] = None) -> Index:
return Index(self.to_series().dt.day_name(locale)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def translate_series_lang(series):\n dates_series = series.get(\"dates\")\n daily_series = series.get(\"daily\")\n current_series = series.get(\"current\")\n cum_series = series.get(\"cum\")\n if daily_series is not None:\n for s in daily_series:\n s[\"name\"] = gettext(s[\"name\"]... | [
"0.6434018",
"0.5959548",
"0.5939516",
"0.5934404",
"0.56137294",
"0.5449007",
"0.543803",
"0.53645253",
"0.5208705",
"0.5178566",
"0.5177522",
"0.514313",
"0.51393753",
"0.5042248",
"0.50358397",
"0.4947864",
"0.49180242",
"0.48726106",
"0.48532912",
"0.4813584",
"0.4796855"... | 0.7382177 | 0 |
Gets the diagonal of a 2 dimensional NDArray. Examples >>> hl.eval(hl.nd.diagonal(hl.nd.array([[1, 2], [3, 4]]))) array([1, 4], dtype=int32) | def diagonal(nd):
assert nd.ndim == 2, "diagonal requires 2 dimensional ndarray"
shape_min = hl.min(nd.shape[0], nd.shape[1])
return hl.nd.array(hl.range(hl.int32(shape_min)).map(lambda i: nd[i, i])) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def diagonal(a, offset=0, axis1=0, axis2=1):\n # TODO(okuta): check type\n return a.diagonal(offset, axis1, axis2)",
"def get_diagonal(self, array):\n diags = [array[::-1, :].diagonal(i) for i in range(-array.shape[0] + 1, array.shape[1])]\n\n # Now back to the original array to get the upper... | [
"0.7351109",
"0.72717065",
"0.69573474",
"0.6883094",
"0.6865915",
"0.68633974",
"0.6758336",
"0.6754026",
"0.6684924",
"0.6647436",
"0.66098547",
"0.6570449",
"0.6552404",
"0.65218383",
"0.6411206",
"0.6407135",
"0.63546354",
"0.6322659",
"0.63107985",
"0.6302568",
"0.628925... | 0.8402767 | 0 |
Test case for partial_update_metadata | def test_partial_update_metadata(self):
pass | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_partial_update_metadata1(self):\n pass",
"def test_update_metadata1(self):\n pass",
"def test_update_metadata(self):\n pass",
"def test_client_verification_document_partial_update(self):\n pass",
"def test_client_partial_update(self):\n pass",
"def test_update_... | [
"0.9481127",
"0.84014213",
"0.8376899",
"0.77271944",
"0.75618404",
"0.7186558",
"0.7169822",
"0.7089714",
"0.690266",
"0.6900476",
"0.68691975",
"0.6835487",
"0.6829478",
"0.68241304",
"0.6805893",
"0.67656815",
"0.67410386",
"0.67410386",
"0.67410386",
"0.6728016",
"0.66472... | 0.95849305 | 0 |
Test case for partial_update_metadata1 | def test_partial_update_metadata1(self):
pass | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_partial_update_metadata(self):\n pass",
"def test_update_metadata1(self):\n pass",
"def test_update_metadata(self):\n pass",
"def test_client_verification_document_partial_update(self):\n pass",
"def test_update_metadata_by_attribute1(self):\n pass",
"def test_... | [
"0.9478912",
"0.8595725",
"0.83447754",
"0.75883114",
"0.74310076",
"0.7396525",
"0.717086",
"0.7053096",
"0.7001002",
"0.6876471",
"0.68115157",
"0.67823434",
"0.6770305",
"0.67176515",
"0.67087495",
"0.66998804",
"0.66998804",
"0.66998804",
"0.66681165",
"0.664477",
"0.6595... | 0.95748454 | 0 |
Test case for update_metadata_by_attribute | def test_update_metadata_by_attribute(self):
pass | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_update_metadata_by_attribute1(self):\n pass",
"def test_update_metadata(self):\n pass",
"def test_update_metadata1(self):\n pass",
"def test_update_attribute_data(self):\n pass",
"def test_partial_update_metadata(self):\n pass",
"def test_partial_update_metadat... | [
"0.90418386",
"0.79753387",
"0.7897794",
"0.78340775",
"0.73003703",
"0.7293143",
"0.66731876",
"0.6581635",
"0.65387595",
"0.63622606",
"0.635078",
"0.6340103",
"0.63248825",
"0.63137114",
"0.63043094",
"0.62834376",
"0.62834376",
"0.62834376",
"0.6278133",
"0.62753963",
"0.... | 0.9435162 | 0 |
Determines the actual precision of the output | def precision(self):
string = self.ask('od;E;') # get the actual output
i1 = string.find('.')
# find the indices of the dot before the decimal part and the E before
# the exponent
i2 = string.find('E', i1)
# calculate the number of digit in the decimal pa... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_precision(self):\n ...",
"def precision(self):\n tpos, fpos = len(self.__true_positives), len(self.__false_positives)\n return float(tpos) / (tpos + fpos)",
"def precision(self):\n return PRECISION_WHOLE",
"def show_precision(self):\r\n return round(f1_score(self.ac... | [
"0.81539243",
"0.7967239",
"0.77828616",
"0.77487594",
"0.76792365",
"0.76792365",
"0.7662934",
"0.7530647",
"0.7528109",
"0.7462477",
"0.74405825",
"0.74402386",
"0.73826814",
"0.7348343",
"0.73200494",
"0.73200494",
"0.73200494",
"0.73200494",
"0.73200494",
"0.73200494",
"0... | 0.7635766 | 7 |
Load the "nextpostingid" value from disk. If we don't have a saved "nextpostingid" value, we return None. | def load_next_posting_id():
if os.path.exists("next_posting_id.txt"):
f = file("next_posting_id.txt", "r")
s = f.read().strip()
f.close()
try:
return int(s)
except ValueError:
return None
else:
return None | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _determine_next_ott_id(self):\n if self._doc_counter_lock is None:\n self._doc_counter_lock = Lock()\n with self._doc_counter_lock:\n _LOG.debug('Reading \"{}\"'.format(self._id_minting_file))\n noi_contents = self._read_master_branch_resource(self._id_minting_fil... | [
"0.6071913",
"0.6023057",
"0.5751192",
"0.55274177",
"0.5412239",
"0.527681",
"0.5191278",
"0.51817816",
"0.506451",
"0.5013885",
"0.5008873",
"0.49896854",
"0.49819517",
"0.49153185",
"0.49151325",
"0.49124894",
"0.48508844",
"0.48377633",
"0.48377615",
"0.48143694",
"0.4797... | 0.8372179 | 0 |
Convert given timestamp string to number of seconds in unix time. | def _dateToSecs(date_str):
if date_str not in ["", None]:
timestamp = datetime.datetime.strptime(date_str,
"%Y-%m-%dT%H:%M:%SZ")
delta = timestamp - datetime.datetime(1970, 1, 1)
return (delta.days*24*3600) + delta.seconds
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def timestamp2sec(timestamp):\n return (int(timestamp.seconds) + 60 * int(timestamp.minutes) + 3600 * int(timestamp.hours) + float(int(timestamp.hours) / 1000))",
"def to_unix_time(timestamp):\n date = datetime.strptime(timestamp, '%Y-%m-%d %H:%M:%S')\n return int(time.mktime(date.timetuple()))*1000",
... | [
"0.76730967",
"0.7444545",
"0.73632026",
"0.71798295",
"0.71179515",
"0.7061504",
"0.70427364",
"0.7026793",
"0.695164",
"0.6942006",
"0.6879939",
"0.6837563",
"0.66916853",
"0.66430193",
"0.66109747",
"0.6590793",
"0.6577262",
"0.6575695",
"0.6567753",
"0.6563566",
"0.645102... | 0.5706231 | 100 |
Retorna datos almacenados de licencia | def info(self):
cur = self.db.cursor()
cur.execute("select * from lic where idx='USER'")
info = cur.fetchone()
cur.close()
return info | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_license_data() -> List[Mapping[str, str]]:\n output = subprocess.check_output([\"pip-licenses\", \"--format\", \"json\"])\n return json.loads(output)",
"async def get_license(self) -> APIReturn:\n return await self._request(\"GET\", \"/getLicense\")",
"def getLicenseList(self):\n\n ... | [
"0.7060248",
"0.6893447",
"0.68256366",
"0.6746994",
"0.6715887",
"0.66455966",
"0.66445196",
"0.6643373",
"0.65541375",
"0.64165026",
"0.63475496",
"0.63086104",
"0.6306874",
"0.6271344",
"0.6177269",
"0.6125131",
"0.61144626",
"0.60515887",
"0.6030486",
"0.6011871",
"0.5984... | 0.55570644 | 39 |
Returns the first_name plus the last_name, with a space in between. | def get_full_name(self):
full_name = '{} {}'.format(self.first_name, self.last_name)
return full_name.strip() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def full_name(first_name, last_name):\n return first_name + \" \" + last_name",
"def full_name(first_name, last_name):\n\t\n\treturn first_name + \" \" + last_name",
"def get_formated_name(first_name,last_name):\n\tfull_name = first_name + '' + last_name\n\treturn full_name.title()",
"def get_full_name(se... | [
"0.8313299",
"0.8200973",
"0.8049726",
"0.8041197",
"0.80180484",
"0.80002826",
"0.7954863",
"0.79428154",
"0.79428154",
"0.79428154",
"0.7938222",
"0.7928959",
"0.7922475",
"0.7903272",
"0.7892691",
"0.7890287",
"0.7878918",
"0.78618217",
"0.7853222",
"0.78238267",
"0.781397... | 0.7706811 | 61 |
This function seraches a cell with the given column name and i (row) | def get_cell(sheet,name,i,max_col):
for rows in sheet.iter_rows(min_row=i, max_row = i+1, min_col=1,max_col=max_col):
for cell in rows:
if name == cell.value:
return cell | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_cell_by_index(self, column_index, cell):\n while len(self) <= column_index:\n self.append(None)\n self[column_index] = cell",
"def setCell(self, row = None, column = None, value = None, *, cell = None):\n\n\t\t\t\tif (cell is None):\n\t\t\t\t\tcell = self.getCell(row = row, colum... | [
"0.6343314",
"0.6286192",
"0.6273509",
"0.62003744",
"0.6196341",
"0.60355395",
"0.6023072",
"0.5956682",
"0.592968",
"0.58654106",
"0.58556044",
"0.5851605",
"0.583578",
"0.58249736",
"0.581631",
"0.57744044",
"0.57511634",
"0.5744369",
"0.57159054",
"0.5706373",
"0.5692658"... | 0.0 | -1 |
initializer for SyncedDictionary objects | def __init__(self, max_readers=2):
if not isinstance(max_readers, int):
raise TypeError("SyncedDictionary.__init__: expected max_readers to be of type int")
self.__dict = {}
self.max_readers = max_readers
self.semaphore_lock = Semaphore(value=self.max_readers)
self.w... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self, *args, **kwargs):\n dict.__init__(self, *args, **kwargs)",
"def __init__(self):\n self.__dict__ = self._shared_state",
"def __init__(self, dict):\n self.dict = dict",
"def __init__(self, dict):\n self.dict = dict",
"def __init__ (self, d):\n try:\n ... | [
"0.658807",
"0.65481573",
"0.65365607",
"0.65365607",
"0.65222025",
"0.6453208",
"0.6453208",
"0.6417565",
"0.6397783",
"0.6384497",
"0.632608",
"0.63238835",
"0.63238835",
"0.6317738",
"0.6313972",
"0.6313972",
"0.6308698",
"0.6272748",
"0.62610584",
"0.624156",
"0.6234698",... | 0.6814363 | 0 |
returns string version of the SyncedDictionary | def __str__(self):
self.semaphore_lock.acquire()
string_representation = ""
for key, value in self.__dict.items():
string_representation += "{}: {}, ".format(key, value)
string_representation = "{" + string_representation[:-1] + "}"
self.semaphore_lock.release()
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def string(self):\n return str(self._dict)",
"def __str__(self):\n if len(self.keys()):\n return '{' + repr(self.keys()[0]) + ':' + repr(self[self.keys()[0]]) + ', ...'\n else:\n return super(FSDict, self).__str__()",
"def hash_str(self):\n return '___'.join([self.... | [
"0.68854564",
"0.67632437",
"0.64698625",
"0.6443895",
"0.6360851",
"0.63486296",
"0.6307247",
"0.6299546",
"0.62728316",
"0.62565327",
"0.62289697",
"0.61468685",
"0.6101243",
"0.60952723",
"0.6068377",
"0.60405755",
"0.5980121",
"0.59736806",
"0.5964059",
"0.5964059",
"0.59... | 0.72128 | 0 |
Convert the whole ONNX model to a TensorRT C2 op | def convert_onnx_model_to_trt_op(onnx_model,
max_batch_size=50,
max_workspace_size=2*1024*1024,
verbosity=1,
debug_builder=False):
check_gpu_()
trt_str = C.onnx_to_trt_op(onnx_model.SerializeToString(),
_get_output_shapes(onnx_model.graph.output),
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def onnx_extract_operator(node, model, nodes_dict):\n op_type = node.op_type\n input_tensors = []\n output_tensors = []\n\n \"\"\" input_tensors\n each input_tensor has its own soure op, but same dest op\n so both have single string\n \"\"\"\n input_names = []\n # name list\n input_te... | [
"0.6528224",
"0.6053466",
"0.6030164",
"0.59807736",
"0.59561545",
"0.59514445",
"0.5948817",
"0.59320587",
"0.59252495",
"0.5914336",
"0.59115785",
"0.5908198",
"0.5897553",
"0.58932745",
"0.58857656",
"0.5882004",
"0.58811885",
"0.5873467",
"0.5870236",
"0.58397686",
"0.583... | 0.6644522 | 0 |
n guarantees that dot(n, getPerpendicular(n)) is zero, which is the orthogonality condition, while also keeping the magnitude of the vector as high as possible. Note that setting the component with the smallest magnitude to 0 also guarantees that you don't get a 0,0,0 vector as a result, unless that is already your inp... | def get_perpendicular(n: np.ndarray) -> np.ndarray:
# find smallest component
i = np.argmin(n)
# get the other two indices
a = (i + 1) % 3
b = (i + 2) % 3
result = np.zeros(3)
result[i] = 0.0
result[a] = n[b]
result[b] = -n[a]
return result | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def perpendicular_vector(v):\n if v[1] == 0 and v[2] == 0:\n if v[0] == 0:\n raise ValueError(\"zero vector\")\n else:\n return np.cross(v, [0, 1, 0])\n return np.cross(v, [1, 0, 0])",
"def vec_nor(x):\n nVec = np.zeros(len(x));\t\t # Initializate derivate vector\n ... | [
"0.6624316",
"0.64200604",
"0.64053017",
"0.63934726",
"0.6332969",
"0.61918724",
"0.6185171",
"0.61739653",
"0.6155659",
"0.6136574",
"0.60309917",
"0.6006862",
"0.6003085",
"0.5953664",
"0.5940126",
"0.59060854",
"0.59015155",
"0.589374",
"0.5880562",
"0.57456243",
"0.56952... | 0.7441144 | 0 |
return True if other does not represents the same location | def __eq__(self, other):
raise NotImplementedError("must be implemented by subclass") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sameLocation(self, other):\n if not isinstance(other,Point):\n return False\n return self.longitude == other.getLongitude() and self.latitude == other.getLatitude()",
"def __ne__(self, other: 'LocationOutput') -> bool:\n return not self == other",
"def __ne__(self, other: 'L... | [
"0.80977637",
"0.80196834",
"0.7701094",
"0.758878",
"0.75153303",
"0.75153303",
"0.75092626",
"0.7446655",
"0.737848",
"0.7355945",
"0.73462415",
"0.7325887",
"0.7301783",
"0.72535795",
"0.7245158",
"0.7211448",
"0.72034067",
"0.71734095",
"0.71366084",
"0.7127022",
"0.71259... | 0.0 | -1 |
return a position representing p's left child | def left(self, p):
raise NotImplementedError("must be implemented by subclass") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def leftChild(self, pos):\n return 2 * pos",
"def leftChild(self, pos):\n return 2 * pos",
"def left_child(self, pos): \n return 2 * pos",
"def left(self, p):\n node = self._validate_position(p)\n return self._make_position(node.left)",
"def left(self, p):\n no... | [
"0.85885906",
"0.85885906",
"0.8515891",
"0.8459289",
"0.84248376",
"0.83691347",
"0.8320246",
"0.8320246",
"0.7892686",
"0.7882516",
"0.786442",
"0.7831532",
"0.77163994",
"0.7710789",
"0.76697505",
"0.7666819",
"0.7633832",
"0.75826883",
"0.758257",
"0.7496541",
"0.7482331"... | 0.7323782 | 31 |
Returns the current URL for this job. If none is stored, this returns the start URL. Raises ValueError if the job is unknown. Raises RuntimeError if the job is already finished. | def get_current_url(self,
job_name: str) -> str:
self.cur.callproc('job_get_current_url_SP', (job_name, ))
job_state = self.cur.fetchone()
if job_state is None:
raise ValueError('Job is unknown!')
if job_state[0] is not None:
# Field 0 co... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_url(self):\n if not self.__initialized:\n raise NSNitroError(\"Not initialized.\")\n return self.__baseurl",
"def getUrl(self):\n cmdId = self.executeCommand(Command.GET_CURRENT_URL)\n return cmdId",
"def getUrl(self):\n result =... | [
"0.6725627",
"0.65700096",
"0.64633787",
"0.6418857",
"0.63893384",
"0.6380788",
"0.637786",
"0.6296835",
"0.625707",
"0.6250532",
"0.623468",
"0.623468",
"0.6227613",
"0.6227613",
"0.6225922",
"0.6225922",
"0.6188216",
"0.6188216",
"0.61578476",
"0.61533654",
"0.6142117",
... | 0.81949854 | 0 |
return number of edges in this node | def _number_of_edges(self):
if self._edges is None:
return 0
return len(self._edges) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def number_of_edges(self) -> int:\n return self.graph.number_of_edges()",
"def num_edges(self):\n return sum(1 for _ in self.iteredges())",
"def num_edges(self):\r\n return len(self.__generate_edges())",
"def edge_count(self) -> int:\n return self._n_edges",
"def return_num_edge... | [
"0.8875547",
"0.88109297",
"0.87799174",
"0.8772965",
"0.873722",
"0.8617714",
"0.8613437",
"0.860823",
"0.8551462",
"0.8519793",
"0.85082877",
"0.8430306",
"0.8389982",
"0.83322877",
"0.8316527",
"0.8297951",
"0.8209914",
"0.8161601",
"0.8143231",
"0.81132495",
"0.8102175",
... | 0.86961937 | 5 |
return neighbors for this node | def neighbors(self):
return [e.name for e in self.edges()] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def neighbors(self):\n return self.graph.neighbors(self.id)",
"def neighbours(self):\n return [x.node for x in self.edges]",
"def neighbors(self):\n return self._neighbors",
"def get_neighbors(self):\n return self.neighbors",
"def get_neighbors(self):\n return self.neighb... | [
"0.8583522",
"0.8513638",
"0.8501599",
"0.8477847",
"0.8477847",
"0.8477847",
"0.8477847",
"0.8371969",
"0.8326192",
"0.8276889",
"0.8265558",
"0.82449126",
"0.8230196",
"0.82211924",
"0.8200375",
"0.8167339",
"0.81646556",
"0.8031149",
"0.80298305",
"0.8018026",
"0.7956279",... | 0.7970834 | 20 |
adds an edge between this node and another node | def add_edge(self, node):
self._edges.append(node) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_edge(self, v1, v2):\n pass # TODO",
"def add_edge(self, vertex1, vertex2):\n\n vertex1.add_outgoing_node(vertex2)\n vertex2.add_incoming_node(vertex1)",
"def add_edge(self, node1: Node, node2: Node):\n self.__add_edge(node1, node2)\n self.__add_edge(node2, node1)",
... | [
"0.8347624",
"0.8321453",
"0.82104987",
"0.8163514",
"0.8045338",
"0.7992923",
"0.799104",
"0.79073995",
"0.78196186",
"0.7745156",
"0.77089953",
"0.7690683",
"0.76557046",
"0.76492965",
"0.7648389",
"0.7632427",
"0.7629042",
"0.7609067",
"0.7607154",
"0.7604823",
"0.75957024... | 0.7189145 | 65 |
Computes the OpenGL projection matrix. | def compute_projection_matrix(width,
height,
f_x,
f_y,
c_x,
c_y,
near,
far):
# pylint: disable=line-too-lo... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def projection_matrix(self):\n scene = self.figure.scene\n scene_size = tuple(scene.get_size())\n aspect_ratio = float(scene_size[0]) / float(scene_size[1])\n p = scene.camera.get_perspective_transform_matrix(\n aspect_ratio, -1, 1).to_array().astype(np.float32)\n retu... | [
"0.7323285",
"0.68124396",
"0.67890733",
"0.654405",
"0.64907825",
"0.648513",
"0.6471799",
"0.64162487",
"0.63645595",
"0.63516206",
"0.63242316",
"0.62451005",
"0.6175326",
"0.6120327",
"0.6095736",
"0.6084762",
"0.6063044",
"0.5989334",
"0.5976792",
"0.59125787",
"0.585460... | 0.6585194 | 3 |
test opposite signs of zero | def get_test_data_opposite_sign_zero(self):
case_data = [
[
['-0', '-0', '+0', '+0'],
['+0', '0', '-0', '0'],
],
[
['-0', '-0', '-0', '-0'],
['+0', '+0', '+0', '+0'],
]
]
return case_... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sign(a) :\n return (a>0) - (a<0)",
"def sign(n):\n return (n > 0) - (n < 0)",
"def sign(a):\n return (a > 0) - (a < 0)",
"def is_negated(x) -> bool:\n return not (x & 1 == 0)",
"def sign(x):\n if x >= 0:\n return 1\n return -1",
"def invert0(x):\n return 0 if x > 0... | [
"0.79301184",
"0.77775353",
"0.7759672",
"0.75190145",
"0.74361706",
"0.73869556",
"0.738049",
"0.7340041",
"0.73336244",
"0.730399",
"0.72955126",
"0.72356415",
"0.720852",
"0.71708256",
"0.71598303",
"0.7127686",
"0.7120267",
"0.7097775",
"0.70691335",
"0.70020556",
"0.7001... | 0.0 | -1 |
Close a database connection if it is open. | def close() -> None:
func = _capability("close")
if func is None:
if database_proxy.obj is not None:
database_proxy.close()
else:
func() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def close_connection_if_open():\n\ttry:\n\t\tconn = flask.g._database_connection\n\texcept AttributeError:\n\t\tpass\n\telse:\n\t\tconn.close()\n\t\tdel flask.g._database_connection",
"def close_database(self):\n if self._conn is not None:\n self._conn.close()\n self._conn = None",
... | [
"0.86393684",
"0.83921194",
"0.8212934",
"0.81834316",
"0.8160686",
"0.8115675",
"0.8058777",
"0.79089874",
"0.78861505",
"0.7800605",
"0.7800605",
"0.7800605",
"0.77428836",
"0.774222",
"0.77122414",
"0.76920706",
"0.7689929",
"0.7650707",
"0.76427895",
"0.76347196",
"0.7613... | 0.0 | -1 |
Get the sqlalchemy column for the given model and field. | def resolve_member_column(model, field, related_clauses=None):
if model is None or not field:
raise ValueError("Invalid field %s on %s" % (field, model))
# Walk the relations
if '__' in field:
path = field
*related_parts, field = field.split("__")
clause = "__".join(related_... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def column(self, model=None):\n try:\n schema = (self.__model or model).schema()\n except AttributeError:\n return None\n else:\n return schema.column(self.__column)",
"def lookup_sqlacolumn_for_field(cls, fieldid):\n for field in cls.fieldlist:\n ... | [
"0.74391264",
"0.7309553",
"0.7200037",
"0.6932843",
"0.66527474",
"0.66198015",
"0.6581698",
"0.64176434",
"0.62523425",
"0.6192954",
"0.6161003",
"0.6081574",
"0.60385466",
"0.6023261",
"0.5990281",
"0.5990281",
"0.59678006",
"0.5958355",
"0.59470826",
"0.5940104",
"0.59359... | 0.6390119 | 8 |
Return the set of FASTA realted features. | def features(self) -> datasets.Features:
return datasets.Features(
{
"sequence": datasets.Value("string"),
"description": datasets.Value("string"),
"id": datasets.Value("string"),
}
) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def GetFeatures(self):\n try:\n return self._SendRequest(HTTP_GET, \"/%s/features\" % GANETI_RAPI_VERSION,\n None, None)\n except GanetiApiError as err:\n # Older RAPI servers don't support this resource\n if err.code == HTTP_NOT_FOUND:\n return []\n\n ... | [
"0.6201728",
"0.60461676",
"0.6019807",
"0.59823793",
"0.5972903",
"0.596062",
"0.5899705",
"0.58984363",
"0.5811593",
"0.5760611",
"0.57601035",
"0.57588714",
"0.57447094",
"0.5738969",
"0.57355255",
"0.5721811",
"0.56550723",
"0.5649405",
"0.5616963",
"0.5575959",
"0.557583... | 0.54149556 | 26 |
Add a new experience to memory. | def add(self, state_and_prev_recurrent, action, recurrent, reward, next_state, done):
e = self.experience(state_and_prev_recurrent, action, recurrent, reward, next_state, done)
self.memory.append(e) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_new_experience(self, state, action, reward, next_state, done):\n e = self.experience(state, action, reward, next_state, done, self.max_priority)\n self.memory.append(e)",
"def add(self, state, action, reward, next_state, done):\n experience = Experience(state, action, reward, next_st... | [
"0.79568833",
"0.79042006",
"0.78795445",
"0.7577913",
"0.7570969",
"0.74478436",
"0.7361023",
"0.72697705",
"0.721816",
"0.71984994",
"0.71984994",
"0.71984994",
"0.71984994",
"0.71984994",
"0.71984994",
"0.71984994",
"0.71984994",
"0.71984994",
"0.71984994",
"0.71984994",
"... | 0.6677425 | 28 |
Return the current size of internal memory. | def __len__(self):
return len(self.memory) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getSize(self) -> int:\n return len(self.mem)",
"def getSize(self):\n return self.bf.memory()",
"def memsize(self):\n return self.xlist(\"get-memsize\")[1][0] * 1024",
"def size(self):\n size = 0\n size += self.data.size * sys.getsizeof(self.data)\n return size / ... | [
"0.8573752",
"0.82169205",
"0.8200361",
"0.8087402",
"0.8021614",
"0.7890747",
"0.78219426",
"0.78017354",
"0.77905464",
"0.7758844",
"0.77559924",
"0.77559924",
"0.775519",
"0.77544576",
"0.7733221",
"0.7732168",
"0.7720068",
"0.77145016",
"0.77092093",
"0.77077913",
"0.7697... | 0.75127405 | 47 |
Get associated pipe name | def get_pipename(self):
return getattr(self, 'pipename', d6tflow.cache.pipe_default_name) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_pipe(self):\n import d6tflow.pipes\n return d6tflow.pipes.get_pipe(self.get_pipename())",
"def pipe_names(self):\n return self._pipes",
"def pipe_id(self):\n pass",
"def pipeline_name(self) -> typing.Optional[str]:\n return self._values.get(\"pipeline_name\")",
"d... | [
"0.7196656",
"0.68128467",
"0.65507627",
"0.6373155",
"0.63400614",
"0.6200757",
"0.60140014",
"0.5849502",
"0.5832438",
"0.5827381",
"0.5813942",
"0.5803588",
"0.57928526",
"0.5754563",
"0.57053316",
"0.57053316",
"0.57053316",
"0.57053316",
"0.57053316",
"0.57053316",
"0.57... | 0.78989685 | 0 |
Returns whether an argument is an iterable but not a string | def is_iterable(arg):
return (
isinstance(arg, collections.Iterable)
and not isinstance(arg, str)
) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _is_iterable_non_string(arg):\n return (hasattr(arg, \"__iter__\") or hasattr(arg, \"__getattr__\")) and not isinstance(arg, str)",
"def iterable(arg):\n return isinstance(arg, collections.Iterable) and not isinstance(arg, six.string_types)",
"def _is_non_string_iterable(value):\n if isinstance(va... | [
"0.90216446",
"0.8602301",
"0.82425195",
"0.81440353",
"0.7974184",
"0.7755208",
"0.7722728",
"0.77056617",
"0.763735",
"0.755614",
"0.75381607",
"0.7470694",
"0.74677736",
"0.7315792",
"0.73019487",
"0.7229807",
"0.72023916",
"0.71398157",
"0.7135165",
"0.71092004",
"0.70942... | 0.8648029 | 1 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.