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 a sort key for sorting into reporting order. | def report_sort_key(self):
return (self._start_time, self._end_time) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_sort_key(self) -> str:\n return self.name",
"def sort_key(self):\n ...",
"def sortKey(self):\n return 'filestore:{0}'.format(id(self.stage))",
"def sortKey(self, p_str): # real signature unknown; restored from __doc__\n return QCollatorSortKey",
"def benchmark_sort_key(b... | [
"0.7954099",
"0.731167",
"0.6866372",
"0.67607605",
"0.6626877",
"0.6623084",
"0.6610566",
"0.660581",
"0.65349185",
"0.6480391",
"0.6480391",
"0.6448255",
"0.64422846",
"0.64209723",
"0.62443256",
"0.61810845",
"0.6161318",
"0.61032134",
"0.60931224",
"0.6059043",
"0.6007521... | 0.6100587 | 18 |
If cannon can be fired, fires cannon. Otherwise creates bullet moving from player's center along player's direction as long as options.max_player_bullets won't be exeeded | def shoot(self):
if collide_mask(self.player, self.ion_field):
return
if self.cannon.start_transition(Cannon.FIRING):
return
if len(self.player_bullets) < opt.max_player_bullets:
new_bullet = Bullet(opt.bullet_filename, opt.bullet_sp... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def fire_bullet(settings, screen, ship, bullets):\n if len(bullets) < settings.bullets_allowed: #create a new bullet and add it to the bullets group.bullets\n new_bullet = Bullet(settings, screen, ship.rect.centerx, ship.rect.top)\n bullets.add(new_bullet)# stores the new bullet in the group bulle... | [
"0.67588484",
"0.66876584",
"0.6582911",
"0.6501811",
"0.64699984",
"0.6457912",
"0.6457912",
"0.6457912",
"0.6455321",
"0.640724",
"0.63724893",
"0.6362164",
"0.6347416",
"0.6310384",
"0.6271825",
"0.6161691",
"0.6094615",
"0.60782635",
"0.6077161",
"0.6064756",
"0.604903",
... | 0.7533866 | 0 |
Setup a rectangular grid of triangles with m+1 by n+1 grid points and side lengths len1, len2. If side lengths are omitted the mesh defaults to the unit square. | def rectangular_old(m, n, len1=1.0, len2=1.0, origin = (0.0, 0.0)):
from anuga.config import epsilon
deltax = float(len1)/m
deltay = float(len2)/n
#Dictionary of vertex objects
vertices = {}
points = []
for i in range(m+1):
for j in range(n+1):
vertices[i,j] = len(poi... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_square_triangle_mesh():\n vertices = np.array(\n ((0, 0, 0), (1, 0, 0), (0, 1, 0), (1, 1, 0), (0.5, 0.5, 0)),\n dtype=np.float32)\n faces = np.array(\n ((0, 1, 4), (1, 3, 4), (3, 2, 4), (2, 0, 4)), dtype=np.int32)\n return vertices, faces",
"def rectangular_cross_python(m, n, len1=1.... | [
"0.6293976",
"0.6231517",
"0.61670005",
"0.6151781",
"0.6146776",
"0.60571784",
"0.6047382",
"0.59998834",
"0.5991503",
"0.59885293",
"0.59124744",
"0.5853241",
"0.57895696",
"0.57791865",
"0.5770217",
"0.5744407",
"0.57369494",
"0.5694929",
"0.56761366",
"0.56715983",
"0.566... | 0.56198937 | 23 |
Setup a rectangular grid of triangles with m+1 by n+1 grid points and side lengths len1, len2. If side lengths are omitted the mesh defaults to the unit square. | def rectangular(m, n, len1=1.0, len2=1.0, origin = (0.0, 0.0)):
from anuga.config import epsilon
delta1 = float(len1)/m
delta2 = float(len2)/n
#Calculate number of points
Np = (m+1)*(n+1)
class Index(object):
def __init__(self, n,m):
self.n = n
self.m = m
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_square_triangle_mesh():\n vertices = np.array(\n ((0, 0, 0), (1, 0, 0), (0, 1, 0), (1, 1, 0), (0.5, 0.5, 0)),\n dtype=np.float32)\n faces = np.array(\n ((0, 1, 4), (1, 3, 4), (3, 2, 4), (2, 0, 4)), dtype=np.int32)\n return vertices, faces",
"def rectangular_cross_python(m, n, len1=1.... | [
"0.6293976",
"0.6231517",
"0.61670005",
"0.6151781",
"0.6146776",
"0.60571784",
"0.6047382",
"0.59998834",
"0.5991503",
"0.59885293",
"0.59124744",
"0.5853241",
"0.57895696",
"0.57791865",
"0.5770217",
"0.5744407",
"0.57369494",
"0.5694929",
"0.56761366",
"0.56715983",
"0.566... | 0.55231416 | 29 |
Setup a rectangular grid of triangles with m+1 by n+1 grid points and side lengths len1, len2. If side lengths are omitted the mesh defaults to the unit square. | def rectangular_cross(m, n, len1=1.0, len2=1.0, origin = (0.0, 0.0)):
len1 = float(len1)
len2 = float(len2)
m = int(m)
n = int(n)
params = []
params.append(m)
params.append(n)
params.append(len1)
params.append(len2)
arrParams = num.array(params, dtype=float)
arrOrigin = n... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_square_triangle_mesh():\n vertices = np.array(\n ((0, 0, 0), (1, 0, 0), (0, 1, 0), (1, 1, 0), (0.5, 0.5, 0)),\n dtype=np.float32)\n faces = np.array(\n ((0, 1, 4), (1, 3, 4), (3, 2, 4), (2, 0, 4)), dtype=np.int32)\n return vertices, faces",
"def rectangular_cross_python(m, n, len1=1.... | [
"0.62946093",
"0.62310135",
"0.6168176",
"0.6153207",
"0.6145747",
"0.60583806",
"0.60487187",
"0.6000019",
"0.5993073",
"0.5989245",
"0.59139246",
"0.5854477",
"0.57904863",
"0.5779405",
"0.57709765",
"0.5744476",
"0.57366854",
"0.56954896",
"0.56772363",
"0.5671805",
"0.566... | 0.5446118 | 36 |
Setup a rectangular grid of triangles with m+1 by n+1 grid points and side lengths len1, len2. If side lengths are omitted the mesh defaults to the unit square. | def rectangular_cross_python(m, n, len1=1.0, len2=1.0, origin = (0.0, 0.0)):
from anuga.config import epsilon
delta1 = float(len1)/m
delta2 = float(len2)/n
#Dictionary of vertex objects
vertices = {}
points = []
for i in range(m+1):
for j in range(n+1):
vertices[i,j] ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_square_triangle_mesh():\n vertices = np.array(\n ((0, 0, 0), (1, 0, 0), (0, 1, 0), (1, 1, 0), (0.5, 0.5, 0)),\n dtype=np.float32)\n faces = np.array(\n ((0, 1, 4), (1, 3, 4), (3, 2, 4), (2, 0, 4)), dtype=np.int32)\n return vertices, faces",
"def create_square_grid(self, len_side_a, l... | [
"0.62945706",
"0.6166837",
"0.61511105",
"0.6145661",
"0.60557485",
"0.604681",
"0.5999363",
"0.599083",
"0.5988158",
"0.5911967",
"0.5851558",
"0.57899046",
"0.5777643",
"0.5767047",
"0.57443374",
"0.57347256",
"0.56930614",
"0.56749094",
"0.56707466",
"0.56613016",
"0.56413... | 0.62304926 | 1 |
Setup a rectangular grid of triangles with m+1 by n+1 grid points and side lengths len1, len2. If side lengths are omitted the mesh defaults to the unit square. | def rectangular_cross_slit(m, n, len1=1.0, len2=1.0, origin = (0.0, 0.0)):
from anuga.config import epsilon
delta1 = float(len1)/m
delta2 = float(len2)/n
#Dictionary of vertex objects
vertices = {}
points = []
for i in range(m+1):
for j in range(n+1):
vertices[i,j] = ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_square_triangle_mesh():\n vertices = np.array(\n ((0, 0, 0), (1, 0, 0), (0, 1, 0), (1, 1, 0), (0.5, 0.5, 0)),\n dtype=np.float32)\n faces = np.array(\n ((0, 1, 4), (1, 3, 4), (3, 2, 4), (2, 0, 4)), dtype=np.int32)\n return vertices, faces",
"def rectangular_cross_python(m, n, len1=1.... | [
"0.6293976",
"0.6231517",
"0.61670005",
"0.6151781",
"0.60571784",
"0.6047382",
"0.59998834",
"0.5991503",
"0.59885293",
"0.59124744",
"0.5853241",
"0.57895696",
"0.57791865",
"0.5770217",
"0.5744407",
"0.57369494",
"0.5694929",
"0.56761366",
"0.56715983",
"0.56623024",
"0.56... | 0.6146776 | 4 |
Setup a circular grid of triangles with m concentric circles and with n radial segments. If radius is are omitted the mesh defaults to the unit circle radius. | def circular(m, n, radius=1.0, center = (0.0, 0.0)):
from math import pi, cos, sin
radius = float(radius) #Ensure floating point format
#Dictionary of vertex objects and list of points
vertices = {}
points = [[0.0, 0.0]] #Center point
vertices[0, 0] = 0
for i in range(n):
theta... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_circular_mesh(radius,cellSize):\r\n\r\n mesh = Gmsh2D('''\r\n cellSize = %g;\r\n radius = %g;\r\n Point(1) = {0, 0, 0, cellSize};\r\n Point(2) = {-radius, 0, 0, cellSize};\r\n Point(3) = {0, radius, 0,... | [
"0.73046595",
"0.63456124",
"0.6050895",
"0.60322237",
"0.596944",
"0.5906674",
"0.59004086",
"0.5847635",
"0.5813838",
"0.57870066",
"0.57335985",
"0.57048213",
"0.5696469",
"0.5693582",
"0.5680498",
"0.5646968",
"0.5626081",
"0.5609492",
"0.5597434",
"0.5578989",
"0.557463"... | 0.6982037 | 1 |
Assembles the Liouvillian superoperator from a Hamiltonian and a ``list`` of collapse operators. | def liouvillian(H=None, c_ops=None, data_only=False, chi=None):
# To avoid circular dependencies
from .cy.qobjevo import QobjEvo
if (
data_only
and (isinstance(H, QobjEvo)
or any(isinstance(op, QobjEvo) for op in c_ops))
):
raise ValueError("Cannot return the data ob... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(\n self,\n hamiltonian_operators: Union[Array, List[Operator]],\n drift: Union[Array, Operator],\n dissipator_operators: Optional[Union[Array, List[Operator]]] = None,\n decimals: Optional[int] = 10,\n ):\n\n self._hamiltonian_operators = np.empty(shape=len... | [
"0.6071734",
"0.58032703",
"0.5553819",
"0.5434221",
"0.5399199",
"0.539841",
"0.5316775",
"0.52716637",
"0.5251347",
"0.52191705",
"0.5207429",
"0.5203315",
"0.51588607",
"0.51394594",
"0.51001656",
"0.50653577",
"0.5055763",
"0.50445193",
"0.5024991",
"0.5019187",
"0.500599... | 0.0 | -1 |
Render website's home page. | def home():
return render_template('home.html') | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def render_home():\r\n\treturn render_template(\"index.html\")",
"def home():\n return render_template('homepage.html')",
"def home():\n\n return render_template('home_page.html')",
"def homepage():\n return render_template('home/index.html', \n title=\"Bem vindo!\")",
"... | [
"0.87248576",
"0.85797024",
"0.85035866",
"0.8486288",
"0.84611857",
"0.84365207",
"0.84302676",
"0.841985",
"0.8396901",
"0.8396901",
"0.8375347",
"0.8356703",
"0.83518267",
"0.8341115",
"0.8341115",
"0.83366895",
"0.8330097",
"0.83294135",
"0.832544",
"0.83175427",
"0.82938... | 0.8337803 | 23 |
Whether the user can view and delete files they have uploaded. | def view_files(self):
return 1 << 1 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def can_manage(self, filename):\n return False",
"def can_view_project_files(project, user):\n return can_access_project(project, user) and project.allow_file_downloads",
"def uploads_present(self):\n is_stfadm = get_user_roles(current_user.net_id)[\"STFADM\"]\n\n try:\n if i... | [
"0.76930034",
"0.72186506",
"0.6912479",
"0.69057286",
"0.6818351",
"0.68110603",
"0.67672735",
"0.67313975",
"0.6564983",
"0.6546332",
"0.65135473",
"0.6505405",
"0.6497665",
"0.64370733",
"0.6416917",
"0.6412308",
"0.640112",
"0.63987803",
"0.6368822",
"0.6367135",
"0.63561... | 0.0 | -1 |
Whether the user can edit the server settings. | def edit_settings(self):
return 1 << 3 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def user_can_edit_setting_type(user, model):\n return user.has_perm(\n \"{}.change_{}\".format(model._meta.app_label, model._meta.model_name)\n )",
"def edit_allowed(self):\n account = Account.current_user_account\n if account is None:\n return False\n return self.user_can_edit(account... | [
"0.75922304",
"0.7513314",
"0.7412934",
"0.6929341",
"0.6845957",
"0.67995095",
"0.6794142",
"0.6755225",
"0.67544776",
"0.6658949",
"0.66513485",
"0.66329664",
"0.6569091",
"0.6538015",
"0.6528994",
"0.65261364",
"0.6523022",
"0.6522354",
"0.65003365",
"0.6467348",
"0.646376... | 0.62773293 | 44 |
Whether the user can create or delete invites. | def manage_invites(self):
return 1 << 4 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def has_invites(self):\r\n return self.invite_ct > 0",
"def canInvite(session):\n if session.user[\"userlevel\"] == \"admin\":\n return True\n\n dOrg = session.user[\"defaultOrganisation\"] or \"apache\"\n if session.DB.ES.exists(index=session.DB.dbname, doc_type=\"organisation\", id=dOrg)... | [
"0.7055574",
"0.6981135",
"0.6652787",
"0.6652787",
"0.6594199",
"0.6397786",
"0.6312212",
"0.6267045",
"0.62099004",
"0.6158968",
"0.6141105",
"0.61110026",
"0.61022854",
"0.6087948",
"0.607739",
"0.6062045",
"0.6056719",
"0.6055549",
"0.60434",
"0.6025726",
"0.6023553",
"... | 0.62778336 | 7 |
Return a string representation of the array | def __str__(self):
return f'[{"".join(str(val) + ", " for val in self)[:-2]}]' | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __str__(self):\n return str(self.array)",
"def __str__(self):\n return str(self.arr)",
"def as_str(self):\n return soho.arrayToString('\"%s\" [ ' % self.type_name, self.value, \" ]\")",
"def __str__(self):\n my_str=\"[\"\n for elem in range(self.size):\n x=cA... | [
"0.83565146",
"0.8189157",
"0.7947355",
"0.79253054",
"0.7623469",
"0.7533974",
"0.7464888",
"0.7414454",
"0.72067916",
"0.71454865",
"0.7094483",
"0.7041199",
"0.7009937",
"0.6996636",
"0.6991211",
"0.69823205",
"0.69729775",
"0.6972035",
"0.69665587",
"0.69662106",
"0.69537... | 0.0 | -1 |
Check if array is lexicographically less than seq | def __lt__(self, seq):
if any(self._arr[i] < seq[i] for i in range(min(self._length, len(seq)))):
return True
return self._length < len(seq) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __le__(self, seq):\n if any(self._arr[i] > seq[i] for i in range(min(self._length, len(seq)))):\n return False\n return self._length <= len(seq)",
"def __ge__(self, seq):\n return not self.__lt__(seq)",
"def is_increasing(seq):\n for i in range(1, len(seq)):\n if n... | [
"0.7698355",
"0.7156253",
"0.66970956",
"0.6693454",
"0.6692287",
"0.6613091",
"0.6512991",
"0.6459689",
"0.6091758",
"0.60796225",
"0.60730344",
"0.6037102",
"0.6031444",
"0.59516",
"0.5933734",
"0.59216654",
"0.58289003",
"0.58200043",
"0.5809702",
"0.580949",
"0.5763183",
... | 0.7845613 | 0 |
Check if array is lexicographically greater than seq | def __gt__(self, seq):
return not self.__le__(seq) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __le__(self, seq):\n if any(self._arr[i] > seq[i] for i in range(min(self._length, len(seq)))):\n return False\n return self._length <= len(seq)",
"def __lt__(self, seq):\n if any(self._arr[i] < seq[i] for i in range(min(self._length, len(seq)))):\n return True\n ... | [
"0.79091215",
"0.7358263",
"0.72215754",
"0.70903474",
"0.7018512",
"0.7003908",
"0.6992735",
"0.6791836",
"0.65675527",
"0.6437813",
"0.6426403",
"0.6396692",
"0.6358752",
"0.62146044",
"0.61976534",
"0.6128592",
"0.612769",
"0.6115589",
"0.6107962",
"0.6099435",
"0.6060121"... | 0.7310302 | 2 |
Remove all values from the array | def clear(self):
self._length = 0 # "Erase" values by ignoring them
self._resize_arr(1) # Shrink array to original size | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def clearArray(ls=('AnyPin', [], {PinSpecifires.CONSTRAINT: '1', PinSpecifires.ENABLED_OPTIONS: PinOptions.ArraySupported | PinOptions.AllowAny})):\n return clearList(ls)",
"def delDoublon(values):\n\treturn list(set(values))",
"def clearValue(self):\n self.data = []",
"def Erase(*args):\n for... | [
"0.6933345",
"0.6795308",
"0.66655195",
"0.6610822",
"0.6574434",
"0.65616894",
"0.65445447",
"0.65005034",
"0.64913076",
"0.63954216",
"0.6378091",
"0.63527924",
"0.6339907",
"0.6306403",
"0.6302453",
"0.6295113",
"0.6281652",
"0.6280961",
"0.62701976",
"0.626335",
"0.617886... | 0.6818926 | 1 |
Return index of first item matching element with support for slicing | def index(self, element, start=0, end=None):
if end is None: # Only bound end if value has been provided
end = self._length
if end < 0: # For negative indexing, convert to positive counterpart
end = self._convert_negative_index(end)
start = min(self._length, max(0, sta... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def find_first(item, vec):\n for i in range(len(vec)):\n if item == vec[i]:\n return i\n return -1",
"def findindex(iteratee, seq):\n iteratee = fnc.iteratee(iteratee)\n return next((i for i, value in enumerate(seq) if iteratee(value)), -1)",
"def _get_first_occurrence_for(iterabl... | [
"0.8006663",
"0.73616",
"0.7225469",
"0.7169978",
"0.7150928",
"0.7139265",
"0.70582587",
"0.70050997",
"0.69643265",
"0.6954431",
"0.6931109",
"0.6928044",
"0.6907608",
"0.6885352",
"0.68834305",
"0.6871876",
"0.6870729",
"0.6852699",
"0.6830237",
"0.68228745",
"0.68020266",... | 0.614696 | 76 |
Checks if array should shrink and executes _shrink_arr if True | def _check_shrink(self):
# As an example, if length is 1/4 of capacity and growth factor is 2,
# then the capacity should shrink in half to keep length proportional
# to capacity
if self._length < int(self._capacity / (self._growth_factor ** 2)):
self._shrink_arr() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _shrink_arr(self):\n self._resize_arr(self._capacity // self._growth_factor)",
"def _shrinkCheck(self):\n if self.size > self.INIT_CAPACITY and self.size / self.capacity <= 0.25:\n self._shrink()",
"def _shrink(self):\n raise NotImplementedError(\"Should have implemented thi... | [
"0.78413355",
"0.6967587",
"0.6360402",
"0.6329479",
"0.6110238",
"0.6004154",
"0.5950657",
"0.59483874",
"0.58845663",
"0.5781646",
"0.57553047",
"0.5646905",
"0.5626331",
"0.5578451",
"0.55041206",
"0.55025554",
"0.5418919",
"0.5375548",
"0.53152424",
"0.5307163",
"0.527649... | 0.75789475 | 1 |
Decrease the capacity of the array by current capacity / growth factor | def _grow_arr(self):
self._resize_arr(self._capacity * self._growth_factor) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def shrink(self):\r\n\r\n old = self._data\r\n self._capacity = self._capacity // 2\r\n self._data = [0] * self._capacity\r\n\r\n if len(old) >= 1:\r\n for i in range(self._size):\r\n\r\n self._data[i] = old[i]",
"def _shrink_arr(self):\n self._resize_... | [
"0.7617966",
"0.7593477",
"0.73133594",
"0.71781397",
"0.70635635",
"0.70394707",
"0.6972233",
"0.6912226",
"0.69095814",
"0.6870289",
"0.6790107",
"0.6725717",
"0.67023695",
"0.6466309",
"0.64026636",
"0.63588285",
"0.6306112",
"0.6240471",
"0.62364787",
"0.6235207",
"0.6196... | 0.65782267 | 13 |
Test that the Api will reject invalid credentials | def test_ApiWillAuthenticate_InvalidCredentials_Unsuccessfully(self):
api = Api(self.userId, "")
self.assertFalse(api.connected()) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_ApiConnectionWillAuthenticate_InvalidCredentials_Unsuccessfully(self):\n connection = ApiConnection(self.userId, \"\")\n self.assertFalse(connection.connected())",
"def test_expired_credentials():\n pass",
"def test_validate_credentials(self):\n pass",
"def test_invalid_crede... | [
"0.7763103",
"0.7680865",
"0.7675715",
"0.7660565",
"0.74636495",
"0.74528545",
"0.74130034",
"0.74105227",
"0.738861",
"0.73749244",
"0.7368168",
"0.7318461",
"0.7318279",
"0.72989553",
"0.72965384",
"0.72770566",
"0.7263675",
"0.7253697",
"0.7233765",
"0.7232979",
"0.717681... | 0.81543446 | 0 |
Formats a timedelta into a human readable expanded format with a precusion up to microsecond | def format_timedelta(seconds, lookup=None, sep=', '):
if lookup is None:
loopkup = [
{'divider': 1, 'format': '{0:.0f} {1}', 'unit': 'us', 'units': 'us', 'value': None},
{'divider': 1000, 'format': '{0:.0f} {1}', 'unit': 'ms', 'units': 'ms', 'value': 0},
{'... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def timedelta_nice_repr(timedelta, display='long', sep=', '):\n if not isinstance(timedelta, datetime.timedelta):\n raise TypeError('First argument must be a timedelta.')\n result = []\n weeks = int(timedelta.days / 7)\n days = timedelta.days % 7\n hours = int(timedelta.seconds / 3600)\n m... | [
"0.7388828",
"0.72380495",
"0.7080166",
"0.7069062",
"0.7033232",
"0.6960068",
"0.6954223",
"0.6911086",
"0.68869966",
"0.6883851",
"0.687014",
"0.683021",
"0.6817646",
"0.6816148",
"0.67723095",
"0.6767579",
"0.67573875",
"0.6751066",
"0.6736304",
"0.67343104",
"0.67298454",... | 0.6976576 | 5 |
Returns a color based on a value in a range | def color_level(value, min_value=0.0, max_value=1.0, func=lambda x: x):
global COLOR_SCALE
if not __colored__:
return ""
COLOR_SCALE = [
fg("white"),
fg("pale_green_3b"),
fg("green"),
fg("green_yellow"),
fg("light_yellow"),
fg("orange_1"),
fg... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_color(in_val, min_val=0, max_val=100):\n width = max_val - min_val\n unit = width / len(continuum)\n return continuum[min(int(in_val / unit), 19)]",
"def color_map(val):\n color_code = remap_interval(val, -1, 1, 0, 255)\n return int(color_code)",
"def color_from_value(self, value):\n \n ... | [
"0.78456193",
"0.7226935",
"0.71327716",
"0.7067942",
"0.7044939",
"0.7044939",
"0.7044939",
"0.7044939",
"0.6959555",
"0.6931289",
"0.6928741",
"0.68748444",
"0.6776724",
"0.6757461",
"0.67458194",
"0.67236805",
"0.66928124",
"0.6558395",
"0.6552848",
"0.6540839",
"0.6527932... | 0.6927608 | 11 |
Set random parameters to the channels Returns dictionary parameter dictionary See Also | def set_rand_params(self) -> Dict:
new_params: Dict = self.gen_params()
self.set_params(new_params)
return new_params | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_random(self):\n for key in self.nn_param_choices:\n self.network[key] = random.choice(self.nn_param_choices[key])",
"def generate_params(self, randomize=True):\n pass",
"def gen_params(self) -> Dict:\n param_dict: Dict = {}\n\n gX_name: List[str] = ['g_leak', '... | [
"0.6568275",
"0.65004134",
"0.6429548",
"0.6419856",
"0.6333249",
"0.62100375",
"0.61715186",
"0.6151323",
"0.60678685",
"0.6059373",
"0.5968558",
"0.59635913",
"0.5947814",
"0.5945982",
"0.5940141",
"0.5876858",
"0.5842199",
"0.5830265",
"0.5830265",
"0.58189106",
"0.5805249... | 0.7182606 | 0 |
Convert sparse feature to dense ones. | def sparse_to_dense(example):
for key in list(example.keys()):
val = example[key]
if tf.keras.backend.is_sparse(val):
val = tf.sparse.to_dense(val)
example[key] = val
return example | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def to_dense(sparse, fill_value=None):\n if fill_value is None or fill_value == 0:\n return sparse.to_dense()\n sparse = sparse.coalesce()\n dense = torch.full(sparse.shape, fill_value, dtype=sparse.dtype, device=sparse.device)\n for idx, value in zip(spar... | [
"0.7461045",
"0.69676256",
"0.6735682",
"0.6727126",
"0.6636931",
"0.6583783",
"0.6579733",
"0.6567622",
"0.6521134",
"0.6507437",
"0.6491083",
"0.6447057",
"0.64348716",
"0.6430987",
"0.64055955",
"0.64016414",
"0.6397804",
"0.6376264",
"0.6345166",
"0.6325874",
"0.63160205"... | 0.73949856 | 1 |
Read docs from a file separated by empty lines. | def read_docs(file_path, tokenizer):
# working structure used to store each document
all_docs = []
doc, end_of_doc = [], False
line_cnt = 0
tf.logging.info("Start processing %s", file_path)
for line in tf.io.gfile.GFile(file_path):
if line_cnt % 100000 == 0:
tf.logging.info("Loading line %d", lin... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def read_file(filename):\n\n all_documents = []\n document = []\n with tf.gfile.GFile(filename, \"r\") as reader:\n for line in reader:\n line = line.strip()\n line = tokenization.convert_to_unicode(line)\n line = line.replace(u\"\\u2018\", \"'\").replace(u\"\\u2019\", \"'\")\n sents = sp... | [
"0.63579994",
"0.62270623",
"0.61606634",
"0.5943251",
"0.5919845",
"0.5912583",
"0.5912583",
"0.587618",
"0.58068275",
"0.580384",
"0.5733693",
"0.5728623",
"0.57133937",
"0.57062984",
"0.56601936",
"0.5650727",
"0.564875",
"0.5643185",
"0.5625992",
"0.5572403",
"0.55359626"... | 0.65460086 | 0 |
Assigns a name to this world. | def _get_world_name(self):
dt = datetime.now()
return f'onboarding_world_{dt.strftime("%H-%M-%S")}' | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def change_world_name(file, name):\n with open(file, 'w') as f:\n world_name = name\n f.write(world_name)",
"def set_name(self, name):\n\t\tself.name_ = name",
"def set_name(self, name):\n self.name = name # overwrite the existing name with the input name",
"def set_name(self, name):... | [
"0.715557",
"0.7080421",
"0.70120156",
"0.70120156",
"0.6952279",
"0.6952279",
"0.6952279",
"0.6952279",
"0.6952279",
"0.6952279",
"0.6952279",
"0.6952279",
"0.6952279",
"0.6952279",
"0.6952279",
"0.6952279",
"0.6919617",
"0.6913308",
"0.6913308",
"0.6913308",
"0.6913308",
... | 0.0 | -1 |
Randomly selects a persona selection type (template, curated) and asks agent. | def apprentice_choose_persona(self):
logging.info('Randomly choosing persona selection type.')
choose_from_templates = (
random.random() < constants.PROBABILITY_CHOOSING_TEMPLATE_PERSONA
)
if choose_from_templates:
logging.info('Choosing persona persona from templ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _choose_curated_persona(self):\n persona_opts = self.sample_personas()\n apprentice_agent = self._get_apprentice()\n\n # Removing PERSONA_NEEDS_LOCATION_TOKEN from what agents will see\n persona_opts_views = [\n p.replace(constants.PERSONA_NEEDS_LOCATION_TOKEN, '') for p ... | [
"0.66010153",
"0.63127846",
"0.6287059",
"0.6207602",
"0.6178721",
"0.61776483",
"0.6174786",
"0.6174786",
"0.6129294",
"0.6013106",
"0.5988316",
"0.59788066",
"0.5925654",
"0.59040177",
"0.59028304",
"0.5881223",
"0.5873116",
"0.575682",
"0.5754491",
"0.5736115",
"0.56930023... | 0.7548121 | 0 |
assemble softmax array into original shape | def assemble_softmax_3d(
patches, spacing, orig_shape, n_classes, method="crop", border=(16, 16, 16)
):
initial_array = np.zeros([orig_shape[0], orig_shape[1], orig_shape[2], n_classes])
x_spacing = spacing[0]
y_spacing = spacing[1]
z_spacing = spacing[2]
x_spacing[1:] += 1
y_spacing[1:] +=... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def softmax(x: jnp.DeviceArray, *, axis: int = 0) -> jnp.DeviceArray:\n return jnp.exp(x) / jnp.expand_dims(jnp.sum(jnp.exp(x), axis=axis), axis)",
"def softmax(x):\n # (n_samples, n_classes)\n if len(x.shape) == 2:\n row_max = np.max(x, axis=1)\n x -= row_max.reshape((x.shape[0], 1))\n x = np.exp(... | [
"0.72755903",
"0.7239912",
"0.71537364",
"0.7095283",
"0.70739967",
"0.7044569",
"0.70441043",
"0.69747007",
"0.6948207",
"0.69150424",
"0.69037026",
"0.68975085",
"0.68682456",
"0.68613434",
"0.68603736",
"0.6849979",
"0.67638946",
"0.67601776",
"0.6735098",
"0.6715151",
"0.... | 0.0 | -1 |
Name of the cluster. If omitted, the provider will assign a random, unique name. Conflicts with `name_prefix`. | def name(self) -> Optional[str]:
return pulumi.get(self, "name") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def cluster_name(self) -> str:\n return pulumi.get(self, \"cluster_name\")",
"def cluster_name(self) -> str:\n return pulumi.get(self, \"cluster_name\")",
"def cluster_name(self):\n return self.name",
"def cluster_name(self) -> Optional[pulumi.Input[str]]:\n return pulumi.get(self... | [
"0.7844244",
"0.7844244",
"0.77782476",
"0.75829816",
"0.75829816",
"0.75829816",
"0.75829816",
"0.75829816",
"0.7510894",
"0.7510894",
"0.7471641",
"0.74329823",
"0.69311094",
"0.68274635",
"0.6716325",
"0.6676964",
"0.66615283",
"0.6636887",
"0.6492217",
"0.64182323",
"0.64... | 0.0 | -1 |
Set of nodes in this shard. | def nodes(self) -> Optional[Sequence['outputs.ClusterShardNode']]:
return pulumi.get(self, "nodes") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def nodes(self) -> Sequence['outputs.GetClusterShardNodeResult']:\n return pulumi.get(self, \"nodes\")",
"def nodeset(self):\n return self._nodeset",
"def nodes(self):\n return set(self.values())",
"def get_nodeset(self):\n return set(self.nodeset) # return the nodeset",
"def n... | [
"0.75141084",
"0.7466467",
"0.72812986",
"0.7244977",
"0.72263974",
"0.7172393",
"0.7172393",
"0.7172393",
"0.71226114",
"0.71196574",
"0.71009296",
"0.70923567",
"0.707576",
"0.7060358",
"0.704038",
"0.6987283",
"0.6935893",
"0.69255745",
"0.691763",
"0.6905763",
"0.6884613"... | 0.7393551 | 2 |
Number of individual nodes in this shard. | def num_nodes(self) -> Optional[int]:
return pulumi.get(self, "num_nodes") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def number_of_nodes(self):\n return int(self._data['number_of_nodes'])",
"def node_count(self) -> int:\n return pulumi.get(self, \"node_count\")",
"def get_num_nodes(self):\n\n return sum(self.topology)",
"def num_nodes(self) -> int:\n return pulumi.get(self, \"num_nodes\")",
"d... | [
"0.8465716",
"0.8403322",
"0.8373275",
"0.83351713",
"0.82587624",
"0.81650364",
"0.8147656",
"0.80618536",
"0.80473524",
"0.79992664",
"0.79876775",
"0.79781306",
"0.79781306",
"0.7974288",
"0.796596",
"0.796596",
"0.7958506",
"0.7958506",
"0.79430115",
"0.792859",
"0.786167... | 0.7469994 | 31 |
Name of the cluster. If omitted, the provider will assign a random, unique name. Conflicts with `name_prefix`. | def name(self) -> Optional[str]:
return pulumi.get(self, "name") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def cluster_name(self) -> str:\n return pulumi.get(self, \"cluster_name\")",
"def cluster_name(self) -> str:\n return pulumi.get(self, \"cluster_name\")",
"def cluster_name(self):\n return self.name",
"def cluster_name(self) -> Optional[pulumi.Input[str]]:\n return pulumi.get(self... | [
"0.7844244",
"0.7844244",
"0.77782476",
"0.75829816",
"0.75829816",
"0.75829816",
"0.75829816",
"0.75829816",
"0.7510894",
"0.7510894",
"0.7471641",
"0.74329823",
"0.69311094",
"0.68274635",
"0.6716325",
"0.6676964",
"0.66615283",
"0.6636887",
"0.6492217",
"0.64182323",
"0.64... | 0.0 | -1 |
Version number of the Redis engine used by the cluster. | def engine_version(self) -> Optional[str]:
return pulumi.get(self, "engine_version") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def engine_version(self) -> str:\n return pulumi.get(self, \"engine_version\")",
"def engine_version(self) -> pulumi.Output[str]:\n return pulumi.get(self, \"engine_version\")",
"def engine_version(self) -> pulumi.Output[str]:\n return pulumi.get(self, \"engine_version\")",
"def engine_v... | [
"0.79144454",
"0.7563207",
"0.7563207",
"0.7563207",
"0.7327727",
"0.7065706",
"0.7065706",
"0.7065706",
"0.7065706",
"0.7065706",
"0.69642663",
"0.66802484",
"0.6680131",
"0.6679079",
"0.66346836",
"0.66147625",
"0.66147625",
"0.660556",
"0.6556487",
"0.6555064",
"0.6521547"... | 0.7518153 | 4 |
Number of shards in the cluster. | def num_shards(self) -> Optional[int]:
return pulumi.get(self, "num_shards") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def num_shards(self) -> int:\n return pulumi.get(self, \"num_shards\")",
"def num_shards(self) -> int:\n return self.db_nodes",
"def shards_count(self) -> Optional[int]:\n return pulumi.get(self, \"shards_count\")",
"def num_shards(self) -> pulumi.Output[Optional[int]]:\n return p... | [
"0.88574594",
"0.8603994",
"0.84083533",
"0.82868904",
"0.81525964",
"0.81525964",
"0.7655257",
"0.74661267",
"0.7422167",
"0.7367773",
"0.7367773",
"0.73387873",
"0.73012555",
"0.7224803",
"0.7057138",
"0.7043152",
"0.7016772",
"0.7009831",
"0.6958872",
"0.6910273",
"0.68966... | 0.8238907 | 4 |
Name of the parameter group associated with the cluster. | def parameter_group_name(self) -> Optional[str]:
return pulumi.get(self, "parameter_group_name") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def parameter_group_name(self) -> str:\n return pulumi.get(self, \"parameter_group_name\")",
"def parameter_group_name(self) -> pulumi.Output[str]:\n return pulumi.get(self, \"parameter_group_name\")",
"def parameter_group_name(self) -> pulumi.Output[Optional[str]]:\n return pulumi.get(sel... | [
"0.87944835",
"0.8671678",
"0.8516077",
"0.81265765",
"0.81265765",
"0.81265765",
"0.81265765",
"0.74682605",
"0.73987305",
"0.7292215",
"0.7277872",
"0.71540594",
"0.71540594",
"0.6907012",
"0.6896391",
"0.6896391",
"0.6896391",
"0.6896391",
"0.6896391",
"0.6896391",
"0.6896... | 0.8401351 | 3 |
Name of the subnet group used by the cluster. | def subnet_group_name(self) -> Optional[str]:
return pulumi.get(self, "subnet_group_name") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def subnet_group_name(self) -> str:\n return pulumi.get(self, \"subnet_group_name\")",
"def subnet_group_name(self) -> pulumi.Output[str]:\n return pulumi.get(self, \"subnet_group_name\")",
"def subnet_group_name(self) -> Optional[pulumi.Input[str]]:\n return pulumi.get(self, \"subnet_grou... | [
"0.9015968",
"0.87887996",
"0.8275437",
"0.8275437",
"0.73522305",
"0.72286814",
"0.72148854",
"0.71613175",
"0.71201915",
"0.7113455",
"0.7081155",
"0.7025016",
"0.6955156",
"0.68569124",
"0.68569124",
"0.68569124",
"0.68569124",
"0.68569124",
"0.68569124",
"0.68569124",
"0.... | 0.85436183 | 2 |
ARN of the SNS topic to which cluster notifications are sent. | def topic_arn(self) -> Optional[str]:
return pulumi.get(self, "topic_arn") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sns_topic_arn(self) -> pulumi.Output[Optional[str]]:\n return pulumi.get(self, \"sns_topic_arn\")",
"def topic_arn(self) -> str:\n return self[\"Sns\"][\"TopicArn\"]",
"def sns_topic_arn(self) -> Optional[pulumi.Input[str]]:\n return pulumi.get(self, \"sns_topic_arn\")",
"def sns_top... | [
"0.7905899",
"0.7869811",
"0.7573047",
"0.7573047",
"0.7502416",
"0.68714416",
"0.67257106",
"0.66310424",
"0.6265732",
"0.61104375",
"0.6103825",
"0.5965135",
"0.59641993",
"0.588743",
"0.5881062",
"0.5804969",
"0.5754359",
"0.5752968",
"0.5750413",
"0.56728387",
"0.56683576... | 0.703469 | 5 |
The VPC in which the cluster exists. | def vpc_id(self) -> Optional[str]:
return pulumi.get(self, "vpc_id") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def vpc_id(self) -> pulumi.Output[str]:\n return pulumi.get(self, \"vpc_id\")",
"def vpc_id(self) -> pulumi.Output[str]:\n return pulumi.get(self, \"vpc_id\")",
"def vpc_id(self) -> pulumi.Output[str]:\n return pulumi.get(self, \"vpc_id\")",
"def vpc_id(self) -> pulumi.Output[str]:\n ... | [
"0.64655846",
"0.64655846",
"0.64655846",
"0.64655846",
"0.64655846",
"0.64655846",
"0.64655846",
"0.64655846",
"0.64655846",
"0.64346594",
"0.64346594",
"0.64346594",
"0.64346594",
"0.64346594",
"0.64346594",
"0.64278966",
"0.62723225",
"0.6231177",
"0.6216843",
"0.61833256",
... | 0.6474399 | 0 |
Indicates whether the user requires a password to authenticate. Must be set to `password`. | def type(self) -> str:
return pulumi.get(self, "type") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def check_auth_password(self, username, password):\n return AUTH_FAILED",
"def get_has_password(self, user):\n return True if user.password else False",
"def check_password(self, password):\n return self.password == password",
"def verify_password(self, password):\n return self.PA... | [
"0.7839492",
"0.764386",
"0.7636195",
"0.7576462",
"0.7569861",
"0.75250995",
"0.7481659",
"0.74618554",
"0.7395858",
"0.73133355",
"0.7246577",
"0.7230015",
"0.72074354",
"0.7193097",
"0.7188455",
"0.71809304",
"0.7170378",
"0.7156237",
"0.7154297",
"0.71434057",
"0.71387553... | 0.0 | -1 |
Name of the cluster. | def name(self) -> str:
return pulumi.get(self, "name") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def cluster_name(self) -> str:\n return pulumi.get(self, \"cluster_name\")",
"def cluster_name(self) -> str:\n return pulumi.get(self, \"cluster_name\")",
"def cluster_name(self):\n return self.name",
"def cluster_name(self):\n return self._data['cluster_name']",
"def cluster_na... | [
"0.92348945",
"0.92348945",
"0.9157106",
"0.8943962",
"0.8668253",
"0.83862936",
"0.83862936",
"0.82669044",
"0.82669044",
"0.82669044",
"0.82669044",
"0.82669044",
"0.7820599",
"0.7656794",
"0.74976444",
"0.74976444",
"0.74976444",
"0.74976444",
"0.74976444",
"0.7225583",
"0... | 0.0 | -1 |
Set of nodes in this shard. | def nodes(self) -> Sequence['outputs.GetClusterShardNodeResult']:
return pulumi.get(self, "nodes") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def nodeset(self):\n return self._nodeset",
"def nodes(self) -> Optional[Sequence['outputs.ClusterShardNode']]:\n return pulumi.get(self, \"nodes\")",
"def nodes(self):\n return set(self.values())",
"def get_nodeset(self):\n return set(self.nodeset) # return the nodeset",
"def ... | [
"0.7466467",
"0.7393551",
"0.72812986",
"0.7244977",
"0.72263974",
"0.7172393",
"0.7172393",
"0.7172393",
"0.71226114",
"0.71196574",
"0.71009296",
"0.70923567",
"0.707576",
"0.7060358",
"0.704038",
"0.6987283",
"0.6935893",
"0.69255745",
"0.691763",
"0.6905763",
"0.6884613",... | 0.75141084 | 0 |
Number of individual nodes in this shard. | def num_nodes(self) -> int:
return pulumi.get(self, "num_nodes") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def number_of_nodes(self):\n return int(self._data['number_of_nodes'])",
"def node_count(self) -> int:\n return pulumi.get(self, \"node_count\")",
"def get_num_nodes(self):\n\n return sum(self.topology)",
"def number_of_nodes(self) -> int:\n return self.graph.number_of_nodes()",
... | [
"0.8465716",
"0.8403322",
"0.8373275",
"0.82587624",
"0.81650364",
"0.8147656",
"0.80618536",
"0.80473524",
"0.79992664",
"0.79876775",
"0.79781306",
"0.79781306",
"0.7974288",
"0.796596",
"0.796596",
"0.7958506",
"0.7958506",
"0.79430115",
"0.792859",
"0.78616774",
"0.783306... | 0.83351713 | 3 |
Name of the cluster. | def name(self) -> str:
return pulumi.get(self, "name") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def cluster_name(self) -> str:\n return pulumi.get(self, \"cluster_name\")",
"def cluster_name(self) -> str:\n return pulumi.get(self, \"cluster_name\")",
"def cluster_name(self):\n return self.name",
"def cluster_name(self):\n return self._data['cluster_name']",
"def cluster_na... | [
"0.92348945",
"0.92348945",
"0.9157106",
"0.8943962",
"0.8668253",
"0.83862936",
"0.83862936",
"0.82669044",
"0.82669044",
"0.82669044",
"0.82669044",
"0.82669044",
"0.7820599",
"0.7656794",
"0.74976444",
"0.74976444",
"0.74976444",
"0.74976444",
"0.74976444",
"0.7225583",
"0... | 0.0 | -1 |
Name of the parameter group. | def name(self) -> str:
return pulumi.get(self, "name") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def parameter_group_name(self) -> str:\n return pulumi.get(self, \"parameter_group_name\")",
"def parameter_group_name(self) -> pulumi.Output[str]:\n return pulumi.get(self, \"parameter_group_name\")",
"def parameter_group_name(self) -> pulumi.Output[Optional[str]]:\n return pulumi.get(sel... | [
"0.90646434",
"0.87880343",
"0.8650048",
"0.86179215",
"0.84838283",
"0.84838283",
"0.84838283",
"0.84838283",
"0.75868195",
"0.75868195",
"0.75377834",
"0.74174",
"0.73146474",
"0.7198395",
"0.71673816",
"0.7153632",
"0.7065075",
"0.70424324",
"0.7000195",
"0.7000195",
"0.69... | 0.0 | -1 |
Version number of the Redis engine used by the cluster. | def engine_version(self) -> str:
return pulumi.get(self, "engine_version") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def engine_version(self) -> pulumi.Output[str]:\n return pulumi.get(self, \"engine_version\")",
"def engine_version(self) -> pulumi.Output[str]:\n return pulumi.get(self, \"engine_version\")",
"def engine_version(self) -> pulumi.Output[str]:\n return pulumi.get(self, \"engine_version\")",
... | [
"0.7563207",
"0.7563207",
"0.7563207",
"0.7518153",
"0.7327727",
"0.7065706",
"0.7065706",
"0.7065706",
"0.7065706",
"0.7065706",
"0.69642663",
"0.66802484",
"0.6680131",
"0.6679079",
"0.66346836",
"0.66147625",
"0.66147625",
"0.660556",
"0.6556487",
"0.6555064",
"0.6521547",... | 0.79144454 | 0 |
Name of the snapshot. | def name(self) -> str:
return pulumi.get(self, "name") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def snapshot_name(self) -> pulumi.Output[Optional[str]]:\n return pulumi.get(self, \"snapshot_name\")",
"def name(cls):\n return 'Snapshot'",
"def snapshot_name(self) -> Optional[pulumi.Input[str]]:\n return pulumi.get(self, \"snapshot_name\")",
"def snapshot_name(self) -> Optional[pulum... | [
"0.8491101",
"0.82213914",
"0.81830853",
"0.81830853",
"0.81830853",
"0.7989911",
"0.7960088",
"0.76104397",
"0.74531317",
"0.74531317",
"0.72998226",
"0.695431",
"0.69038695",
"0.6873799",
"0.6873799",
"0.68528575",
"0.6765277",
"0.6760609",
"0.67542017",
"0.67446935",
"0.67... | 0.0 | -1 |
Number of shards in the cluster. | def num_shards(self) -> int:
return pulumi.get(self, "num_shards") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def num_shards(self) -> int:\n return self.db_nodes",
"def shards_count(self) -> Optional[int]:\n return pulumi.get(self, \"shards_count\")",
"def num_shards(self) -> pulumi.Output[Optional[int]]:\n return pulumi.get(self, \"num_shards\")",
"def num_shards(self) -> Optional[int]:\n ... | [
"0.8603994",
"0.84083533",
"0.82868904",
"0.8238907",
"0.81525964",
"0.81525964",
"0.7655257",
"0.74661267",
"0.7422167",
"0.7367773",
"0.7367773",
"0.73387873",
"0.73012555",
"0.7224803",
"0.7057138",
"0.7043152",
"0.7016772",
"0.7009831",
"0.6958872",
"0.6910273",
"0.689668... | 0.88574594 | 0 |
Name of the parameter group associated with the cluster. | def parameter_group_name(self) -> str:
return pulumi.get(self, "parameter_group_name") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def parameter_group_name(self) -> pulumi.Output[str]:\n return pulumi.get(self, \"parameter_group_name\")",
"def parameter_group_name(self) -> pulumi.Output[Optional[str]]:\n return pulumi.get(self, \"parameter_group_name\")",
"def parameter_group_name(self) -> Optional[str]:\n return pulu... | [
"0.8671678",
"0.8516077",
"0.8401351",
"0.81265765",
"0.81265765",
"0.81265765",
"0.81265765",
"0.74682605",
"0.73987305",
"0.7292215",
"0.7277872",
"0.71540594",
"0.71540594",
"0.6907012",
"0.6896391",
"0.6896391",
"0.6896391",
"0.6896391",
"0.6896391",
"0.6896391",
"0.68963... | 0.87944835 | 0 |
Name of the subnet group used by the cluster. | def subnet_group_name(self) -> str:
return pulumi.get(self, "subnet_group_name") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def subnet_group_name(self) -> pulumi.Output[str]:\n return pulumi.get(self, \"subnet_group_name\")",
"def subnet_group_name(self) -> Optional[str]:\n return pulumi.get(self, \"subnet_group_name\")",
"def subnet_group_name(self) -> Optional[pulumi.Input[str]]:\n return pulumi.get(self, \"s... | [
"0.87887996",
"0.85436183",
"0.8275437",
"0.8275437",
"0.73522305",
"0.72286814",
"0.72148854",
"0.71613175",
"0.71201915",
"0.7113455",
"0.7081155",
"0.7025016",
"0.6955156",
"0.68569124",
"0.68569124",
"0.68569124",
"0.68569124",
"0.68569124",
"0.68569124",
"0.68569124",
"0... | 0.9015968 | 0 |
ARN of the SNS topic to which cluster notifications are sent. | def topic_arn(self) -> str:
return pulumi.get(self, "topic_arn") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sns_topic_arn(self) -> pulumi.Output[Optional[str]]:\n return pulumi.get(self, \"sns_topic_arn\")",
"def topic_arn(self) -> str:\n return self[\"Sns\"][\"TopicArn\"]",
"def sns_topic_arn(self) -> Optional[pulumi.Input[str]]:\n return pulumi.get(self, \"sns_topic_arn\")",
"def sns_top... | [
"0.7905899",
"0.7869811",
"0.7573047",
"0.7573047",
"0.703469",
"0.68714416",
"0.67257106",
"0.66310424",
"0.6265732",
"0.61104375",
"0.6103825",
"0.5965135",
"0.59641993",
"0.588743",
"0.5881062",
"0.5804969",
"0.5754359",
"0.5752968",
"0.5750413",
"0.56728387",
"0.56683576"... | 0.7502416 | 4 |
The VPC in which the cluster exists. | def vpc_id(self) -> str:
return pulumi.get(self, "vpc_id") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def vpc_id(self) -> Optional[str]:\n return pulumi.get(self, \"vpc_id\")",
"def vpc_id(self) -> pulumi.Output[str]:\n return pulumi.get(self, \"vpc_id\")",
"def vpc_id(self) -> pulumi.Output[str]:\n return pulumi.get(self, \"vpc_id\")",
"def vpc_id(self) -> pulumi.Output[str]:\n r... | [
"0.6474399",
"0.64655846",
"0.64655846",
"0.64655846",
"0.64655846",
"0.64655846",
"0.64655846",
"0.64655846",
"0.64655846",
"0.64655846",
"0.64278966",
"0.62723225",
"0.6231177",
"0.6216843",
"0.61833256",
"0.6153539",
"0.61369574",
"0.6129676",
"0.6129676",
"0.6129676",
"0.... | 0.64346594 | 13 |
Whether the user requires a password to authenticate. | def type(self) -> str:
return pulumi.get(self, "type") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_has_password(self, user):\n return True if user.password else False",
"def check_password(self, password):\n return self.password == password",
"def verify_password(self, password):\n return self.PASS == password",
"def verify_password(self, password):\n return self.PASSWO... | [
"0.7983362",
"0.77129424",
"0.7703002",
"0.76763266",
"0.7506605",
"0.7502234",
"0.7490725",
"0.7483327",
"0.74660397",
"0.74472684",
"0.74223435",
"0.74122345",
"0.7381427",
"0.73778236",
"0.736039",
"0.73594326",
"0.7351806",
"0.7351107",
"0.7350109",
"0.7348506",
"0.733679... | 0.0 | -1 |
Calculates an estimate of emissivity | def emissivity_calc (pv, ndvi):
ndvi_dest = ndvi.copy()
ndvi_dest[np.where(ndvi < 0)] = 0.991
ndvi_dest[np.where((0 <= ndvi) & (ndvi < 0.2)) ] = 0.966
ndvi_dest[np.where((0.2 <= ndvi) & (ndvi < 0.5)) ] = (0.973 * pv[np.where((0.2 <= ndvi) & (ndvi < 0.5)) ]) + (0.966 * (1 - pv[np.where((0.2 <= ndvi) & (n... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _calc_Em(self):\n return (self.parameters.E0 +\n self.x * sqrt2 * self.parameters.sigma * self.mt)",
"def _emiss_ee(self,Eph):\n if self.weight_ee == 0.0:\n return np.zeros_like(Eph)\n\n gam = np.vstack(self._gam)\n # compute integral with electron distri... | [
"0.73396784",
"0.70681226",
"0.701977",
"0.6705343",
"0.6518762",
"0.6425226",
"0.6391614",
"0.6344747",
"0.633923",
"0.6330779",
"0.6325304",
"0.62861216",
"0.62720865",
"0.6219066",
"0.62181145",
"0.6185366",
"0.61717474",
"0.61706126",
"0.61706126",
"0.61621195",
"0.615229... | 0.6002614 | 29 |
r""" The series' precision. | def precision(self) :
return self.__precision | {
"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 precision(self):\n if self._temp_precision is not None:... | [
"0.81245166",
"0.80044436",
"0.7978113",
"0.775465",
"0.75198495",
"0.75084317",
"0.74624246",
"0.736589",
"0.73360354",
"0.73360354",
"0.7305079",
"0.72775817",
"0.7271454",
"0.72175217",
"0.7069444",
"0.70605683",
"0.7013307",
"0.69745684",
"0.6948589",
"0.694801",
"0.69067... | 0.80037963 | 2 |
r""" Set the series' precision. | def _set_precision(self, precision) :
self.__precision = self.parent().monoid().filter(precision) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _set_precision(self, precision) :\n self.__precision = self.parent().action().filter(precision)",
"def SetPrecision(self, *args):\n return _ShapeUpgrade.ShapeUpgrade_Tool_SetPrecision(self, *args)",
"def change_precision(self, precision):\n if precision <= 0:\n print(\"Preci... | [
"0.77004534",
"0.7368873",
"0.72170144",
"0.711674",
"0.70803005",
"0.7026098",
"0.6980594",
"0.69088227",
"0.686783",
"0.68564606",
"0.6837906",
"0.6773249",
"0.6773249",
"0.676323",
"0.67113924",
"0.6682765",
"0.6665135",
"0.6600072",
"0.6575622",
"0.65689766",
"0.65591514"... | 0.7939025 | 0 |
r""" The coefficients of ``self``. | def coefficients(self) :
raise NotImplementedError | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def coefficients(self) :\n return self.__coefficients",
"def coefficients(self):\n return self._coefficients",
"def coefficients(self):\n return self._coefficients",
"def coefficients(self) -> np.ndarray:\n return self._coefficients",
"def coefficients(self):\r\n return s... | [
"0.8871973",
"0.8639943",
"0.8639943",
"0.85898465",
"0.8515666",
"0.8221824",
"0.8221824",
"0.81595016",
"0.7913658",
"0.7836305",
"0.75207",
"0.7392499",
"0.73840374",
"0.70424825",
"0.7015772",
"0.696558",
"0.6956478",
"0.6762896",
"0.6690637",
"0.6639266",
"0.65921384",
... | 0.9023136 | 0 |
r""" The coefficients of ``self``. | def coefficients(self) :
return self.__coefficients | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def coefficients(self) :\n raise NotImplementedError",
"def coefficients(self):\n return self._coefficients",
"def coefficients(self):\n return self._coefficients",
"def coefficients(self) -> np.ndarray:\n return self._coefficients",
"def coefficients(self):\r\n return se... | [
"0.9023136",
"0.8639943",
"0.8639943",
"0.85898465",
"0.8515666",
"0.8221824",
"0.8221824",
"0.81595016",
"0.7913658",
"0.7836305",
"0.75207",
"0.7392499",
"0.73840374",
"0.70424825",
"0.7015772",
"0.696558",
"0.6956478",
"0.6762896",
"0.6690637",
"0.6639266",
"0.65921384",
... | 0.8871973 | 1 |
r""" The series' precision. | def precision(self) :
return self.__precision | {
"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 precision(self):\n if self._temp_precision is not None:... | [
"0.81245166",
"0.80044436",
"0.7978113",
"0.775465",
"0.75198495",
"0.75084317",
"0.74624246",
"0.736589",
"0.73360354",
"0.73360354",
"0.7305079",
"0.72775817",
"0.7271454",
"0.72175217",
"0.7069444",
"0.70605683",
"0.7013307",
"0.69745684",
"0.6948589",
"0.694801",
"0.69067... | 0.80037963 | 3 |
r""" Set the series' precision. | def _set_precision(self, precision) :
self.__precision = self.parent().action().filter(precision) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _set_precision(self, precision) :\n self.__precision = self.parent().monoid().filter(precision)",
"def SetPrecision(self, *args):\n return _ShapeUpgrade.ShapeUpgrade_Tool_SetPrecision(self, *args)",
"def change_precision(self, precision):\n if precision <= 0:\n print(\"Preci... | [
"0.7939025",
"0.7368873",
"0.72170144",
"0.711674",
"0.70803005",
"0.7026098",
"0.6980594",
"0.69088227",
"0.686783",
"0.68564606",
"0.6837906",
"0.6773249",
"0.6773249",
"0.676323",
"0.67113924",
"0.6682765",
"0.6665135",
"0.6600072",
"0.6575622",
"0.65689766",
"0.65591514",... | 0.77004534 | 1 |
r""" The coefficients of ``self``. | def coefficients(self, force_characters = False) :
raise NotImplementedError | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def coefficients(self) :\n raise NotImplementedError",
"def coefficients(self) :\n return self.__coefficients",
"def coefficients(self):\n return self._coefficients",
"def coefficients(self):\n return self._coefficients",
"def coefficients(self) -> np.ndarray:\n return se... | [
"0.9023136",
"0.8871973",
"0.8639943",
"0.8639943",
"0.85898465",
"0.8515666",
"0.8221824",
"0.8221824",
"0.81595016",
"0.7913658",
"0.7836305",
"0.7392499",
"0.73840374",
"0.70424825",
"0.7015772",
"0.696558",
"0.6956478",
"0.6762896",
"0.6690637",
"0.6639266",
"0.65921384",... | 0.75207 | 11 |
r""" The coefficients of ``self``. | def coefficients(self, force_characters = False) :
if len(self.__coefficients) == 0 :
return dict()
elif not force_characters and len(self.__coefficients) == 1 :
return self.__coefficients.values()[0]
else :
return self.__coefficients | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def coefficients(self) :\n raise NotImplementedError",
"def coefficients(self) :\n return self.__coefficients",
"def coefficients(self):\n return self._coefficients",
"def coefficients(self):\n return self._coefficients",
"def coefficients(self) -> np.ndarray:\n return se... | [
"0.9023136",
"0.8871973",
"0.8639943",
"0.8639943",
"0.85898465",
"0.8515666",
"0.8221824",
"0.8221824",
"0.81595016",
"0.7913658",
"0.7836305",
"0.75207",
"0.7392499",
"0.73840374",
"0.70424825",
"0.7015772",
"0.6956478",
"0.6762896",
"0.6690637",
"0.6639266",
"0.65921384",
... | 0.696558 | 16 |
Asserts that the following fields of segmentTestData are equal to the value computed by numpy. . max . mean . min . shape . size . std | def _assert_fields_equal_to_data(self, segmentTestData, data):
self.assertEqual(segmentTestData.max, np.max(data))
self.assertEqual(segmentTestData.mean, np.mean(data))
self.assertEqual(segmentTestData.min, np.min(data))
self.assertEqual(segmentTestData.shape, np.shape(data))
sel... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_stddev(self):\n self.assertEqual(stddev(list1, sample=False), np.std(list1))\n self.assertEqual(stddev(list1), np.std(list1, ddof=1))",
"def test_sufficient_statistics(self):\n assert (\n len(self.data),\n self.data.var(),\n self.data.mean(),\n ... | [
"0.64239573",
"0.6373529",
"0.6282944",
"0.61856544",
"0.6130011",
"0.5997697",
"0.5971954",
"0.5968743",
"0.5934422",
"0.5882087",
"0.588118",
"0.58590144",
"0.5858433",
"0.58564645",
"0.5851766",
"0.5833389",
"0.58234996",
"0.5822367",
"0.5778518",
"0.5762364",
"0.5750393",... | 0.79603374 | 0 |
Tests that the fields are set correctly in the constructor. | def test_default_constructor_args_multichannel(self):
data = np.random.random((5, 5))
s = SegmentTestData(data)
self._assert_fields_equal_to_data(s, data)
np.testing.assert_array_equal(s.data, data) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_init_valid_field(self):\n fields = {'Conn Note': {'offset': 0,\n 'length': 20}}\n parser = top.Parser(fields=fields)\n received = parser.get_fields()\n expected = fields\n msg = 'Fields initialisation property setter/getter error.'\n ... | [
"0.75746596",
"0.74538714",
"0.7369914",
"0.7363637",
"0.7301198",
"0.72469926",
"0.71646196",
"0.70892674",
"0.70838934",
"0.70467377",
"0.70440054",
"0.7036874",
"0.7031363",
"0.7031281",
"0.7008457",
"0.70008886",
"0.6977785",
"0.6977557",
"0.69603235",
"0.69510937",
"0.69... | 0.0 | -1 |
Returns a new APIRules instance for the current API version and configured rules. | def create(**rules_config) -> 'APIRules':
obj = {
k: v for k, v in rules_config.items() if k in APIRules.__fields__
}
# Validation will fail if required `api_version` is missing
# or if `api_version` is not a semantic version number
return APIRules.parse_obj(obj) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def rules(self):\r\n return Acls(self)",
"def _load_api(self):\n self.app.add_url_rule('/scheduler', 'get_scheduler_info', self._apply_auth(api.get_scheduler_info))\n self.app.add_url_rule('/scheduler/jobs', 'add_job', self._apply_auth(api.add_job), methods=['POST'])\n self.app.add_ur... | [
"0.5955498",
"0.5648376",
"0.5494508",
"0.53649634",
"0.5338248",
"0.5271837",
"0.5229927",
"0.50940627",
"0.5090088",
"0.5062579",
"0.4984754",
"0.4968622",
"0.49645168",
"0.49296302",
"0.4924877",
"0.49121693",
"0.49066514",
"0.48793676",
"0.4840095",
"0.48269096",
"0.48251... | 0.8130044 | 0 |
Return True if user is in the group, False otherwise. | def is_user_in_group(user, group):
sub_user=group.get_users() # Get all the users within the group
if user in sub_user: # If user is within the group, return True
return True
sub_group=group.get_groups() # Get all the sub groups within the group
if l... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_user_in_group(user, group):\n users = group.get_users()\n if user in users:\n return True\n return False",
"def is_in_group(user, group_name):\n return is_in_group_user_id(user.id, group_name)",
"def is_user_in_group(user, group):\n\n if user == group.get_name():\n return Tr... | [
"0.8791304",
"0.84474826",
"0.8253319",
"0.81782854",
"0.8154014",
"0.80775934",
"0.8077066",
"0.7991211",
"0.7917411",
"0.79046553",
"0.78879106",
"0.7874985",
"0.78737533",
"0.7837497",
"0.7784908",
"0.7684502",
"0.76652265",
"0.7655611",
"0.7571193",
"0.7561973",
"0.737242... | 0.7714273 | 15 |
This function opens, reads and closes a text file. The function then returns the whole text file as one string. | def readFile(filename):
file = open(filename,"r")
text = file.read()
file.close()
voteList = []
text=text.split("\n")
for i in range(len(text)-1):
text[i]=text[i].strip()
voteList.append((text[i]).split(" "))
return voteList | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def open_and_read_file(file_path):\n\n # your code goes here\n text_file = open(file_path)\n text_string= text_file.read()\n text_file.close()\n return text_string",
"def read_text_file(str_name_file: str):\n content: str = ''\n with open(str_name_file, mode=\"r\", encoding='utf-8') as file:... | [
"0.821146",
"0.81793684",
"0.8096301",
"0.80843616",
"0.8050027",
"0.80206877",
"0.7927163",
"0.7908435",
"0.7878271",
"0.7835688",
"0.7824517",
"0.77805686",
"0.77757144",
"0.7735",
"0.77269775",
"0.77235335",
"0.7717167",
"0.77148455",
"0.76737124",
"0.7665647",
"0.76407254... | 0.0 | -1 |
This function takes the Iris dataset as loaded by sklearn.datasets.load_iris(), and then splits so that the training set includes 90% of the full dataset, with the test set making up the remaining 10%. Your function should return a tuple (train_data, test_data, train_targets, test_targets) of appropriately split traini... | def read_in_and_split_data(iris_data):
iris_data = datasets.load_iris()
data = iris_data['data']
targets = iris_data['target']
train_data, test_data, train_targets, test_targets = train_test_split(data, targets, test_size=0.1)
return (train_data, test_data, train_targets, test_targets) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def split_dataset(dataset, train_percentage, feature_headers, target_header):\r\n\r\n train_x, test_x, train_y, test_y = train_test_split(dataset[feature_headers], dataset[target_header],\r\n train_size=train_percentage, random_state=42)\r\n return train... | [
"0.7429238",
"0.73596966",
"0.7324942",
"0.73114485",
"0.73114485",
"0.7173067",
"0.70243925",
"0.7001993",
"0.69992864",
"0.698148",
"0.698148",
"0.6971545",
"0.69113606",
"0.6908209",
"0.6907308",
"0.6867146",
"0.686293",
"0.6858725",
"0.6836108",
"0.680628",
"0.67761016",
... | 0.7847423 | 0 |
This function should create and return a tuple (early_stopping, learning_rate_reduction) callbacks. The callbacks should be instantiated according to the above requirements. | def get_callbacks():
early_stopping = EarlyStopping(monitor = 'val_loss',
patience = 30,
min_delta=0.01,
mode='min')
learning_rate_reduction = tf.keras.callbacks.ReduceLROnPlateau(monitor='val_loss',
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_callbacks():\n lr_callback = LearningRateScheduler(learning_rate_policy)\n # lr_callback = ReduceLROnPlateau(monitor='loss', factor=0.7, patience=15, min_lr=1e-8)\n _ckpt_dir = os.path.join(CKPT_DIR, UNIQUE_NAME)\n create_dir(_ckpt_dir)\n write_model_info()\n ckpt_callback = ModelCheck... | [
"0.7272729",
"0.7066468",
"0.69508785",
"0.67919505",
"0.6757455",
"0.6502359",
"0.64947385",
"0.6437092",
"0.6337437",
"0.6215642",
"0.608207",
"0.602084",
"0.5990534",
"0.59795165",
"0.5763469",
"0.5735676",
"0.57082474",
"0.5679279",
"0.56364846",
"0.559038",
"0.5577522",
... | 0.8490703 | 0 |
If abbr is a state abbreviation, return the full name. Else return the abbreviation. | def _getUsState(self, abbr):
return unicode(_all_states.get(abbr, abbr)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_state_abbrev(abbrev):\n return us_state_abbrev.get(abbrev,NOT_FOUND)",
"def get_state_abbrev(abbrev):\n return us_state_abbrev.get(abbrev) or NOT_FOUND",
"def state_to_abbreviation(state: str, df: pd.DataFrame) -> str:\n\n return df.loc[df['State Name'] == state.title(), 'State Abbreviation'].... | [
"0.7403869",
"0.74004453",
"0.73604256",
"0.70342064",
"0.6967185",
"0.6931094",
"0.687996",
"0.67197937",
"0.635354",
"0.6328952",
"0.6271419",
"0.6265075",
"0.6256895",
"0.6208458",
"0.6168484",
"0.6164719",
"0.6163689",
"0.6117899",
"0.60103744",
"0.5999707",
"0.598703",
... | 0.70275784 | 4 |
Split a given DataFrame column (split_column) into multiple rows together with a second index column (index_column). | def split_on_column(df, index_column, split_column, new_index_column, new_split_column, split_char=';'):
# Produce a Series with index from index_column and values from split_column (split by split_char).
# Each series constructor is called with (value, [split1, split2, split3]) which produces [(value, split1),... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def split_dataframe(df, n_split, axis=0):\n\n # TODO: implement axis logic\n\n if df.shape[0] < n_split:\n raise ValueError(\n 'n_split ({}) can\\'t be greater than the number of rows ({}).'.\n format(n_split, df.shape[0]))\n elif n_split <= 0:\n raise ValueError('n... | [
"0.6540174",
"0.6138708",
"0.59899384",
"0.58212227",
"0.5729976",
"0.5724715",
"0.56651795",
"0.56604034",
"0.547992",
"0.53859234",
"0.5373713",
"0.53661054",
"0.5326458",
"0.5320248",
"0.5292662",
"0.51791424",
"0.515281",
"0.5148076",
"0.51402396",
"0.5122835",
"0.5090757... | 0.7921428 | 0 |
Create a minimal Domain DataFrame from the Candidate CSV file using the 'pfam_ids' column | def candidate_domain_csv(cands, index_column):
return split_on_column(cands, index_column, 'pfam_ids', 'contig_id', 'pfam_id') | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def cafa4_mapping() -> pd.DataFrame:\n # List of the paths considered in the function\n paths = [\n \"cafa4.tar.gz\",\n \"CAFA4-export/TargetFiles/sp_species.9606.tfa\"\n ]\n if not any(os.path.exists(path) for path in paths):\n # Downloading the url to the given path\n down... | [
"0.58200276",
"0.56673163",
"0.56568366",
"0.5521276",
"0.5488048",
"0.54873306",
"0.54744714",
"0.54697967",
"0.54571486",
"0.5447125",
"0.54410046",
"0.5439613",
"0.54326373",
"0.53710383",
"0.53422606",
"0.53104824",
"0.53080684",
"0.5306817",
"0.5301441",
"0.52762264",
"0... | 0.65814686 | 0 |
Returns the url to access a detail record for this book. | def get_absolute_url(self):
return reverse('book_details', args=[str(self.id)]) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_absolute_url(self):\n return reverse('book-detail', args=[str(self.id)]) \n # Returns an URL that can be used to access a detail record for this model \n # (for this to work we will have to \n # -- Define a URL mapping that has the name 'book-detail' (name='book-detail')\n ... | [
"0.76990575",
"0.7257499",
"0.7257499",
"0.7257499",
"0.7117704",
"0.6992158",
"0.69547594",
"0.6935497",
"0.684423",
"0.6591669",
"0.6543265",
"0.6541738",
"0.64656514",
"0.6445659",
"0.64323515",
"0.64318234",
"0.6417527",
"0.6407866",
"0.638662",
"0.6367192",
"0.6367192",
... | 0.7611185 | 1 |
Returns the value to which the specified key is mapped, or 1 if this map contains no mapping for the key | def get(self, key):
h = key%self.m
a = self.a
if a[h]:
return a[h].val
else:
return -1 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get(self, key: int) -> int:\n if key not in self.map:\n return -1\n return self.map[key]",
"def get(self, key: int) -> int:\n if key in self.hashmap.keys():return self.hashmap[key]\n else:return -1",
"def get(self, key: int) -> int:\n sh = key % 37\n if ... | [
"0.800388",
"0.79098475",
"0.762993",
"0.75650334",
"0.7529803",
"0.75259614",
"0.7493149",
"0.73738897",
"0.7294419",
"0.72940016",
"0.72216845",
"0.72175443",
"0.7181078",
"0.71774393",
"0.71633786",
"0.6980779",
"0.69289523",
"0.67850846",
"0.6757027",
"0.6734023",
"0.6612... | 0.7556994 | 4 |
r"""Retrieves the projection matrix for this scene. | def projection_matrix(self):
scene = self.figure.scene
scene_size = tuple(scene.get_size())
aspect_ratio = float(scene_size[0]) / float(scene_size[1])
p = scene.camera.get_perspective_transform_matrix(
aspect_ratio, -1, 1).to_array().astype(np.float32)
return p | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def projection_matrix(self) -> TransformationMatrixType:\n if self._projection_matrix is None:\n if self.projection_mode == Projection.TOP_DOWN:\n self._projection_matrix = self.orthographic_matrix\n else:\n self._projection_matrix = self.perspective_matri... | [
"0.78104204",
"0.7666103",
"0.74616575",
"0.74465615",
"0.74224895",
"0.7257091",
"0.72499746",
"0.72499746",
"0.7068451",
"0.704346",
"0.7032178",
"0.6957537",
"0.6880624",
"0.6879542",
"0.6786198",
"0.6656584",
"0.66423136",
"0.6529158",
"0.64911455",
"0.64765614",
"0.64027... | 0.83785504 | 0 |
Check if a role exists with provided name. | async def check_role_name(request):
conn = await create_connection()
response = await roles_query.roles_search_duplicate(conn, request.args.get("name"))
conn.close()
return json({"exists": bool(response)}) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def has_role(self, role_name):\n\n return any(r.name == role_name for r in self.roles)",
"def has_role(role, nodename=None):\n return role in get_list('roles', nodename)",
"def role_exists(role_name, file_name):\n role_processed = sudo('[ -f %s ] && grep \"^%s$\" %s && echo \"yes\" || echo \"no\"'... | [
"0.7704213",
"0.74145705",
"0.73849845",
"0.7315238",
"0.7132745",
"0.70899135",
"0.69661057",
"0.6901529",
"0.6887436",
"0.680472",
"0.6511793",
"0.6492095",
"0.6450325",
"0.640017",
"0.6355747",
"0.6328484",
"0.62988675",
"0.62868804",
"0.62002575",
"0.6100128",
"0.60914797... | 0.8029438 | 0 |
Add a member to a role. | async def add_role_member(request, role_id):
required_fields = ["id"]
utils.validate_fields(required_fields, request.json)
txn_key, txn_user_id = await utils.get_transactor_key(request)
proposal_id = str(uuid4())
batch_list = Role().member.propose.batch_list(
signer_keypair=txn_key,
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_member():\n client = RequestManager()\n client.set_method(\"POST\")\n client.set_endpoint(\"/accounts/{0}/memberships\".format(CONFIG_DATA['account_id']))\n body = {\"person_id\": CONFIG_DATA['member_id']}\n client.set_body(json.dumps(body))\n client.execute_reques... | [
"0.7348769",
"0.7291903",
"0.7068307",
"0.6949378",
"0.6941964",
"0.69165707",
"0.69154483",
"0.6859402",
"0.684402",
"0.6813287",
"0.67874575",
"0.6775485",
"0.6769517",
"0.67252976",
"0.67011875",
"0.6664257",
"0.66319287",
"0.66097236",
"0.6541175",
"0.6485458",
"0.6483773... | 0.71393275 | 2 |
Close database and remove tempfile. | def tearDown(self):
self.db.close()
self.dbfile.close()
os.unlink(self.path) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def tearDown(self):\n os.close(self.db_fd)\n os.unlink(closet.app.config['DATABASE'])",
"def tearDown(self):\n os.close(self.db_fd)\n os.unlink(pegasus.app.config['DATABASE'])",
"def teardown(self):\n try:\n self._close(True)\n except:\n pass\n ... | [
"0.81592",
"0.7996563",
"0.79932266",
"0.7991232",
"0.7943603",
"0.79382694",
"0.77299803",
"0.76762205",
"0.7675102",
"0.7675102",
"0.7675102",
"0.7675102",
"0.7576348",
"0.75221467",
"0.75054365",
"0.74743515",
"0.7416318",
"0.73940825",
"0.73868376",
"0.73823553",
"0.73539... | 0.7854662 | 6 |
Check if a given word is a real number. | def is_num_real_automata(final_word: str) -> list:
if re.match('^(?:0|[1-9][0-9]*)(?:\.[0-9]+)?$', final_word):
token = 'num_real'
return [True, token]
else :
return [False, ""] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_float(word):\n try:\n float(word)\n return True\n except ValueError:\n return False",
"def isNumber(word):\n try:\n int(word)\n return True\n except ValueError:\n return False",
"def _isDecimalNumber(strWord):\n return NumberFormula.DECIMALNUM... | [
"0.762255",
"0.7468598",
"0.74435747",
"0.730183",
"0.7287073",
"0.7281827",
"0.726655",
"0.7262698",
"0.7253065",
"0.7243992",
"0.7238527",
"0.7228147",
"0.7228147",
"0.7228147",
"0.7173918",
"0.71663624",
"0.71576375",
"0.71559525",
"0.7141952",
"0.71411204",
"0.7135744",
... | 0.75782555 | 1 |
Check if a given word is an identifier or a reserved word. | def is_identifier_automata(final_word: str) -> list:
reserved_words = ({'program':'symb_program','begin':'symb_begin','end':'symb_end', 'const': 'symb_const',
'var':'symb_var', 'real':'symb_real', 'integer':'symb_integer', 'procedure':'symb_procedure',
'read':'symb_read', 'e... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def check_word(self, word):\n word = word.lower().strip()\n return not word or word in self.dictionary",
"def is_word(self, word):\r\n\r\n return self.data(word) is not None",
"def _is_reserved_name(content_name: str) -> bool:\n return content_name in RESERVED_NAMES",
"def checkWord(s... | [
"0.6962261",
"0.6754092",
"0.6710042",
"0.6661024",
"0.65768445",
"0.6520431",
"0.65203524",
"0.65101093",
"0.6472301",
"0.6432031",
"0.63866",
"0.6299001",
"0.6291951",
"0.6291467",
"0.62890977",
"0.62844473",
"0.62531626",
"0.6252947",
"0.6248125",
"0.62438023",
"0.6231863"... | 0.65931326 | 4 |
Stores a transition in the buffer to be used later. | def storeTransition(self, transition):
self.buffer.append(transition) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def store_transition(self, s, a, r, s_):\n if not hasattr(self, 'memory_counter'):\n self.memory_counter = 0\n\n a_id = self.actions_list.index(a)\n # print(\"action = %s and id = %s\" % (a, a_id))\n # r = normalize_reward(r)\n transition = np.hstack((s, [a_id, r], s_)... | [
"0.73112977",
"0.7238376",
"0.717752",
"0.7161149",
"0.70977986",
"0.70807385",
"0.6936872",
"0.6908647",
"0.6887271",
"0.65726095",
"0.65604985",
"0.65576756",
"0.64840066",
"0.64533645",
"0.6391457",
"0.6348378",
"0.6330885",
"0.6270931",
"0.6245909",
"0.62016976",
"0.61827... | 0.87435853 | 0 |
Returns the minimax action using self.depth and self.evaluationFunction | def getAction(self, gameState):
maxDepth = self.depth
numAgents = gameState.getNumAgents()
def value(state, depth, alpha, beta):
if depth == maxDepth * numAgents or state.isLose() or state.isWin():
return [self.evaluationFunction(state)]
if depth % numAgen... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getAction(self, gameState: GameState):\n _max = float(\"-inf\")\n action = None\n for move in gameState.getLegalActions(0):\n util = minimax(self.evaluationFunction, 1, 0,\n gameState.generateSuccessor(0, move), self.depth)\n if util > _max o... | [
"0.7482665",
"0.7383559",
"0.71806973",
"0.7110041",
"0.70884514",
"0.70694935",
"0.70683014",
"0.7048308",
"0.70055133",
"0.69651455",
"0.69642085",
"0.69604385",
"0.6945924",
"0.68998593",
"0.6895832",
"0.688605",
"0.6767276",
"0.6758028",
"0.6751636",
"0.6705453",
"0.67045... | 0.6826282 | 16 |
Function takes an image (RGB, HSV, etc.), channel (0,1,2) for 3 channels, threshold and returns binary image of the thresholded channel | def ch_threshold(img, ch=0, thresh=(0,180)):
if img.shape[2]>ch:
CH = img[:,:,ch]
binary = np.zeros_like(CH)
binary [(CH>thresh[0])&(CH<=thresh[1])] = 1
return binary
else:
return None | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def threshold(channel, thresh=(128,255), thresh_type=cv2.THRESH_BINARY):\n # If pixel intensity is greater than thresh[0], make that value\n # white (255), else set it to black (0)\n return cv2.threshold(channel, thresh[0], thresh[1], thresh_type)",
"def threshold_image(img, threshold=THRESHOLD):\n return ... | [
"0.7257197",
"0.72512984",
"0.71635854",
"0.71581554",
"0.7124226",
"0.7013585",
"0.6962464",
"0.6941106",
"0.6888597",
"0.6874667",
"0.6805758",
"0.67218673",
"0.6691793",
"0.6691624",
"0.6686006",
"0.66759545",
"0.6667048",
"0.6620656",
"0.6595911",
"0.6577171",
"0.6503583"... | 0.6973775 | 6 |
Function takes an image, grayscale it, applies Sobel x or y, then takes an absolute value and applies a threshold. | def abs_sobel_thresh(self,orient='x', thresh_min=0, thresh_max=255):
# 1) Convert to grayscale
gray = cv2.cvtColor(self.img, cv2.COLOR_RGB2GRAY)
# 2) Take the derivative in x or y given orient = 'x' or 'y'
if orient!='x':
sobel_x = 0
sobel_y = 1
else:
sobel_x = 1
sobel_y = 0
sobel = ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def threshold_image(self, image, ksize, sobel_thresh, mag_thresh, dir_thresh, s_thresh, l_thresh, b_thresh):\n # Note: Magnitude and direction thresholds were not needed for the project. Probably they are for the challenges\n # For Sobel, the light channel will be used\n hls = cv2.cvtColor(ima... | [
"0.70706564",
"0.700521",
"0.6952588",
"0.6683551",
"0.6672206",
"0.6667592",
"0.66553956",
"0.65481114",
"0.65142244",
"0.64996487",
"0.64885056",
"0.6480764",
"0.6332068",
"0.6284692",
"0.6267679",
"0.6259247",
"0.62581915",
"0.62547356",
"0.62533194",
"0.6205849",
"0.62031... | 0.6357954 | 12 |
Function returns binary thresholded image using gradient feature | def manage_grad(self,test=0):
sx1 = self.abs_sobel_thresh(orient='x', thresh_min=25, thresh_max=55)
sd_less = self.dir_threshold(sobel_kernel=9, thresh=(1.0721,np.pi/2))
sd_less2 = self.dir_threshold(sobel_kernel=9, thresh=(0.0982,0.3927))
sx3 = binary_substr(binary_substr(sx1,sd_less),sd_less2)
hls = cv2.cv... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def direction_threshold(img, kernel=3, thresh=(0, np.pi/2)):\n # Apply the following steps to img\n # 2) Take the gradient in x and y separately\n sobel_x = cv2.Sobel(img, cv2.CV_64F, 1, 0, ksize=kernel)\n sobel_y = cv2.Sobel(img, cv2.CV_64F, 0, 1, ksize=kernel)\n # 3) Take the absolute value of the... | [
"0.7064512",
"0.68673354",
"0.6844981",
"0.67052937",
"0.6630067",
"0.66091895",
"0.6608282",
"0.65964717",
"0.65040433",
"0.6483056",
"0.6482947",
"0.6473928",
"0.6446394",
"0.6445282",
"0.6425684",
"0.64059865",
"0.6395026",
"0.63466567",
"0.63357484",
"0.63302374",
"0.6320... | 0.0 | -1 |
Initialize the model that will be used for prediction. | def _init_model(self, forrest):
rels = self.get_rels(forrest)
self._model = RDPModel(rels) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def initialize(self):\n LOG.info(\"Initializing Model.\")\n self.model = self.convert(df=self.training_df)\n if self.bootstraps is not None:\n LOG.info(\"Bootstrapping Data.\")\n self.bootstrap_data()",
"def initialize_model(self):\n pass",
"def init_model(self... | [
"0.779014",
"0.77078915",
"0.7636239",
"0.75355023",
"0.7403137",
"0.7364823",
"0.7315481",
"0.7277654",
"0.72674614",
"0.7264292",
"0.7215646",
"0.7111046",
"0.7110114",
"0.70896906",
"0.7089447",
"0.70846367",
"0.7068159",
"0.7065056",
"0.7060362",
"0.70405215",
"0.70293534... | 0.6922751 | 36 |
Return an absolute path to the location based on provided strings. Substitute tilde '~' with home directory. | def build_path(*path_elements):
return path.abspath(path.expanduser(path.join(*path_elements))) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def relativeToAbsoluteHomePath(path):\n if \"~\" in path:\n return path.replace(\"~\",expanduser(\"~\"))\n else:\n return path",
"def directory_resolve_home(destination):\n\n if destination[:1] == '~':\n home = expanduser(\"~\")\n return home + destination.strip('~')\n\n r... | [
"0.678737",
"0.6651808",
"0.65477717",
"0.6491881",
"0.6453702",
"0.6356276",
"0.63179314",
"0.6209195",
"0.6119369",
"0.6116454",
"0.61010146",
"0.6088717",
"0.60864735",
"0.60319287",
"0.6016312",
"0.59940815",
"0.5988271",
"0.5941935",
"0.5915677",
"0.5890978",
"0.5873511"... | 0.543807 | 51 |
Take a first and last name and format it to return the title case version of the name | def format_name(f_name, l_name):
#Using an early return if inputs aren't valid
if f_name == "" or l_name == "":
return "You didn't provide valid inputs."
formatted_f_name = f_name.title()
formatted_l_name = l_name.title()
#Returning a formatted string when inputs are valid
return f"{formatted_f_name} ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_formatted_name(first_name, last_name): \r\n full_name = f\"{first_name} {last_name}\"\r\n return full_name.title()",
"def get_formatted_name(first_name, last_name):\n full_name = first_name + ' ' + last_name\n return full_name.title()",
"def get_formatted_name(first_name, last_name):\n f... | [
"0.8663646",
"0.8603068",
"0.8603068",
"0.8603068",
"0.85657644",
"0.8555767",
"0.85525084",
"0.8550996",
"0.8532395",
"0.85100186",
"0.85100186",
"0.85100186",
"0.85062385",
"0.8484088",
"0.84702533",
"0.84416676",
"0.84416676",
"0.84035605",
"0.83981806",
"0.8391093",
"0.83... | 0.72642416 | 47 |
Return a float between 0 (left) and 1 (right) representing the relative position of the ennemy in the player field of view in the basic scenario. | def basic_ennemy_x(state):
# Player horizon
horiz = state.depth_buffer[65].astype(np.int32)
# How is the distance varying along the horizon
line = np.diff(horiz)
line[np.abs(line) > 15] = 0
imin = line.argmin()
line[:imin] = 0
imax = line.argmax()
return (imin + imax) / 2 / len(horiz... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_alien_x(self):\n return self.x",
"def relative_position(self) -> Tuple[int, int]:\n return self.position[0] - self.region.rect.x, self.position[1] - self.region.rect.y",
"def relative_position(self) -> Tuple[int, int]:\n return self.position[0] - self.region.rect.x, self.position[1... | [
"0.6604129",
"0.6594732",
"0.6594732",
"0.6551132",
"0.64372027",
"0.6376991",
"0.6338158",
"0.6338158",
"0.6320881",
"0.6268785",
"0.6268114",
"0.62219703",
"0.61989105",
"0.6171039",
"0.6162807",
"0.60927355",
"0.6078739",
"0.60687274",
"0.6055316",
"0.6051",
"0.6050987",
... | 0.6140672 | 15 |
Helper function to ensure the file type is valid/manageable. | def parse_out_type(self, out_type):
default = 'mid'
out_types = ['mid', 'wav', 'flac', 'mp3', 'ogg', 'flv', 'mp4', 'wma', 'aac']
if type(out_type) == int:
if out_type >= len(out_types):
print('Index out of range. Defaulting to MIDI')
return default
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def check_filekind(self):\n assert self.filekind in self.obs_package.FILEKINDS, \\\n \"Invalid filekind \" + repr(self.filekind) + \" in \" + repr(self.filename)",
"def check_file_type(fname):\n ext = path.splitext(fname)[1]\n return ext in allowed_extensions",
"def secure_filetype(file... | [
"0.74211967",
"0.6822177",
"0.67884934",
"0.6751811",
"0.6669142",
"0.66154075",
"0.66035235",
"0.65627986",
"0.6476442",
"0.6424021",
"0.64192426",
"0.64075345",
"0.6396387",
"0.63031405",
"0.6299122",
"0.62978774",
"0.62762874",
"0.6265574",
"0.6261629",
"0.62504286",
"0.62... | 0.0 | -1 |
Sanitize a string to be used as a filename. | def clean_filename(s):
# strip paren portions which contain trailing time length (...)
s = re.sub("\([^\(]*$", "", s)
s = s.strip().replace(':', '-').replace(' ', '_')
valid_chars = "-_.()%s%s" % (string.ascii_letters, string.digits)
return ''.join(c for c in s if c in valid_chars) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sanitize_filename(filename):\n sanitized_filename = re.sub(r'[/\\\\:*?\"<>|]', '-', filename)\n sanitized_filename = sanitized_filename.replace('&', 'and')\n sanitized_filename = sanitized_filename.replace('\"', '')\n sanitized_filename = sanitized_filename.replace(\"'\", '')\n sanitized_filenam... | [
"0.80123615",
"0.7964389",
"0.7964389",
"0.7878434",
"0.7810296",
"0.7665364",
"0.7573089",
"0.7558329",
"0.7546698",
"0.7541314",
"0.7524779",
"0.75132716",
"0.7482624",
"0.73833954",
"0.7329925",
"0.73262566",
"0.7320113",
"0.7261218",
"0.7230235",
"0.72295463",
"0.7217503"... | 0.7095692 | 25 |
r"""Set up a `VerbatimBlock` | def setup(self, ds: PetscDocStringImpl) -> None:
items = {}
class Inspector:
__slots__ = 'codeblocks', 'startline'
codeblocks: int
startline: int
def __init__(self, startline: int) -> None:
self.codeblocks = 0
self.startline = startline
return
def __cal... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def makeBlock(tag):\n return {\"t\":\"RawBlock\",\"c\":[\"html\",tag]}",
"def __init__(self):\n self.block_stack = []\n\n # TODO do I still need this?\n resource_path = None\n if not resource_path:\n resource_path = os.path.join(\n os.path.split(__file__)[... | [
"0.6427474",
"0.61481726",
"0.5874726",
"0.5868316",
"0.5795336",
"0.5705492",
"0.5658154",
"0.5572977",
"0.55654013",
"0.55625725",
"0.553499",
"0.5477947",
"0.54552984",
"0.54058444",
"0.5397841",
"0.5343472",
"0.53422",
"0.5327245",
"0.532312",
"0.530184",
"0.52898026",
... | 0.49463087 | 67 |
Get the connected YubiKey's version as a string. | def version(self):
pass | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getVersion(cls):\n cVersion = cls.__getLib().voikkoGetVersion()\n return unicode_str(cVersion, \"UTF-8\")",
"def version_bytes(self) -> str:\n return pulumi.get(self, \"version_bytes\")",
"def version(self) -> pulumi.Output[str]:\n return pulumi.get(self, \"version\")",
"def g... | [
"0.7518363",
"0.7468351",
"0.7444643",
"0.7426205",
"0.73935837",
"0.73913455",
"0.73913455",
"0.73913455",
"0.73913455",
"0.7352391",
"0.7306484",
"0.72672594",
"0.72613543",
"0.72493905",
"0.7237862",
"0.7228088",
"0.722017",
"0.721696",
"0.7211483",
"0.7198171",
"0.7171115... | 0.0 | -1 |
Get the response to a challenge from a connected YubiKey. `mode' is either 'HMAC' or 'OTP'. `slot' is 1 or 2. `variable' is only relevant for mode == HMAC. If variable is True, challenge will be padded such that the YubiKey will compute the HMAC as if there were no padding. If variable is False, challenge will always b... | def challenge(self, challenge, mode='HMAC', slot=1, variable=True, may_block=True):
pass | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_dialogflow_slot_value(data, slot=None) -> Union[Any, None]:\n if \"result\" in data:\n # using V1 API\n contexts = data[\"result\"][\"contexts\"][0]\n if contexts:\n parameters = contexts.get(\"parameters\")\n else:\n paramete... | [
"0.49309647",
"0.48515275",
"0.4850242",
"0.47334254",
"0.46932486",
"0.4626481",
"0.46115807",
"0.4549656",
"0.44817528",
"0.4432513",
"0.44097",
"0.4402911",
"0.43896165",
"0.43741786",
"0.43556577",
"0.43437093",
"0.43305743",
"0.43264595",
"0.4316332",
"0.42936394",
"0.42... | 0.65719765 | 0 |
Return a YubiKey configuration object for this type of YubiKey. | def init_config(self):
pass | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def crypto_key_config(self) -> 'outputs.CryptoKeyConfigResponse':\n return pulumi.get(self, \"crypto_key_config\")",
"def detect_yubikey(self):\n try:\n self.yk = yubico.find_yubikey()\n self.version.set(\"Version:%s\" % self.yk.version())\n self.serial.set(\"Serial... | [
"0.5883121",
"0.56813526",
"0.56583446",
"0.5543895",
"0.55395997",
"0.5463443",
"0.54049355",
"0.5388315",
"0.5330292",
"0.5330158",
"0.53090227",
"0.5299784",
"0.52979136",
"0.52680945",
"0.52477074",
"0.5233944",
"0.52136266",
"0.5204096",
"0.51901853",
"0.5179389",
"0.516... | 0.0 | -1 |
Copy self queryset for prevent query caching. | def __init__(self, *args, **kwargs):
super(DynamicMixin, self).__init__(*args, **kwargs)
if not self._meta.queryset is None:
self._meta.queryset = self._meta.queryset.all() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def copy(self):\n return type(self)(*self.__queries, op=self.__op)",
"def copy(self):\n raise NotImplementedError('Query does not support the copy() method.')",
"def _clone(self):\n c = self.__class__(\n model=self.model,\n query=self.query.chain(),\n using=sel... | [
"0.7399769",
"0.71686095",
"0.70631844",
"0.6941556",
"0.6907978",
"0.6821032",
"0.6799747",
"0.67438066",
"0.67438066",
"0.6696478",
"0.6684554",
"0.66646594",
"0.66570437",
"0.66106",
"0.66074324",
"0.65938497",
"0.65938497",
"0.65938497",
"0.65938497",
"0.65895396",
"0.657... | 0.0 | -1 |
Reverse resource by ResourceClass or name. | def reverse(cls, resource, **resources):
if not cls.api:
raise AssertionError("AdrestTestCase must have the api attribute.")
if isinstance(resource, basestring):
url_name = resource
if not cls.api.resources.get(url_name):
raise AssertionError("... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getClassResource(self, className):\n\t\t#To prevent resources from having another type\n\t\tif(className == \"Resource\"):\n\t\t\treturn None\n\t\t#Now check if we have a mapping in here\n\t\tif(className in self._classMapping):\n\t\t\treturn self._classMapping[className]\n\t\telse:\n\t\t\traise Exception(\"Gi... | [
"0.5906841",
"0.58842605",
"0.5743924",
"0.5568378",
"0.5539185",
"0.54789793",
"0.5421403",
"0.54162896",
"0.5376105",
"0.53674114",
"0.53491414",
"0.5330041",
"0.5321578",
"0.5302124",
"0.52929467",
"0.5280923",
"0.524121",
"0.524121",
"0.5214597",
"0.52145886",
"0.5197051"... | 0.7011643 | 0 |
Returns whether or not the user has exceeded their throttle limit. | def should_be_throttled(self, resource):
pass | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def check_rate_limit(self):\n # Already received 429 from server\n if self.rate_limit_sleep:\n msg = f\"请求过于频繁,已被BitMEX限制,请等待{self.rate_limit_sleep}秒后再试\"\n self.gateway.write_log(msg)\n return False\n # Just local request limit is reached\n elif not sel... | [
"0.7139493",
"0.71100205",
"0.6955849",
"0.68879765",
"0.6859896",
"0.6697189",
"0.6591735",
"0.6508721",
"0.6492379",
"0.6472114",
"0.646948",
"0.64641124",
"0.6400263",
"0.63629967",
"0.63472015",
"0.63284254",
"0.6317153",
"0.6254077",
"0.62531424",
"0.6234124",
"0.6229649... | 0.6817646 | 5 |
Replace spaces with '' and hash if length is greater than 250. | def clean_cache_key(key):
cache_key = re.sub(r'\s+', '-', key)
cache_key = smart_str(cache_key)
if len(cache_key) > 200:
cache_key = cache_key[:150] + '-' + hashlib.md5(cache_key).hexdigest()
return cache_key | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def prepare_for_hashing(text):\n if not text:\n return ''\n return text.translate(CHARS_TO_DELETE).lower()",
"def trim_hash(info_hash):\n if len(info_hash) == 40:\n return info_hash.decode(\"hex\")\n if len(info_hash) != 20:\n raise TrackerRequestException(\"Infohash not equal to... | [
"0.61413294",
"0.6119153",
"0.58871484",
"0.58260584",
"0.58260584",
"0.58260584",
"0.58260584",
"0.580712",
"0.5779639",
"0.57760966",
"0.57588935",
"0.57513255",
"0.5709565",
"0.57016",
"0.5674024",
"0.56139565",
"0.5605284",
"0.558613",
"0.55808145",
"0.55195224",
"0.55186... | 0.57001257 | 14 |
Wrapper for dot product operation, in order to be compatible with both Theano and Tensorflow | def dot_product(x, kernel):
if K.backend() == 'tensorflow':
return K.squeeze(K.dot(x, K.expand_dims(kernel)), axis=-1)
else:
return K.dot(x, kernel) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def dot_prod(t1: torch.Tensor, t2: torch.Tensor, verbose: bool = False):\n assert t1.size() == t2.size(), \"Sizes for dot-product must match\"\n return mo.dot_prod(t1, t2, verbose)",
"def _dot(a, b):\n return np.einsum('ijk,ikl->ijl', a, b)",
"def dot(a, b):\r\n a, b = as_tensor_variable(a), as_ten... | [
"0.76538557",
"0.761268",
"0.7590079",
"0.7535919",
"0.75187564",
"0.7498847",
"0.74907756",
"0.74907756",
"0.74907756",
"0.74907756",
"0.74392796",
"0.7429963",
"0.74196726",
"0.7382268",
"0.73776513",
"0.73444533",
"0.7332484",
"0.7311246",
"0.7310674",
"0.7276245",
"0.7272... | 0.7467345 | 10 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.