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 |
|---|---|---|---|---|---|---|
Renders the about page. | def doctor(request):
assert isinstance(request, HttpRequest)
if request.method == 'POST':
request.session['selected_package'] = request.POST['package_id']
request.session['selected_doctor'] = request.POST['doctor_id']
return redirect('/doctor-detail/')
status, result = api.show_docto... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def about():\n return render_template('about.html', title='About')",
"def about():\n\n return render_template('about_page.html', title='About')",
"def about():\n\n\treturn render_template(\"about.html\")",
"def on_about(self):\n render_about_window()",
"def about():\n return render_temp... | [
"0.85650355",
"0.85034525",
"0.84489655",
"0.84044397",
"0.8394454",
"0.82935613",
"0.82709616",
"0.82709616",
"0.82709616",
"0.82709616",
"0.82709616",
"0.82709616",
"0.82709616",
"0.82709616",
"0.82709616",
"0.82709616",
"0.82709616",
"0.82709616",
"0.82709616",
"0.82680845",... | 0.0 | -1 |
Renders the about page. | def confirm(request):
assert isinstance(request, HttpRequest)
if len(request.user.groups.all()) > 0:
raise PermissionDenied
elif not api.get_patient_id(request.user.username)[0]:
return redirect('/register')
if 'selected_package' not in request.session or 'selected_doctor' not in request... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def about():\n return render_template('about.html', title='About')",
"def about():\n\n return render_template('about_page.html', title='About')",
"def about():\n\n\treturn render_template(\"about.html\")",
"def on_about(self):\n render_about_window()",
"def about():\n return render_temp... | [
"0.85647297",
"0.8503022",
"0.8448552",
"0.8404981",
"0.83938396",
"0.82932264",
"0.8270508",
"0.8270508",
"0.8270508",
"0.8270508",
"0.8270508",
"0.8270508",
"0.8270508",
"0.8270508",
"0.8270508",
"0.8270508",
"0.8270508",
"0.8270508",
"0.8270508",
"0.82675695",
"0.82430005"... | 0.0 | -1 |
Returns an MLWriter instance for this ML instance. | def write(self):
return JavaMLWriter(self) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_writer(self) -> 'SpectrumWriter':\n # Get the writer class\n writer_class = self.get_writer_class()\n\n # Get the common options between ourselves and the writer class\n common_options = self.get_common_options(writer_class)\n\n # Get the options sub-list corresponding to... | [
"0.68583494",
"0.6371153",
"0.6350456",
"0.58435446",
"0.56768924",
"0.56760025",
"0.56751126",
"0.56653947",
"0.5613375",
"0.5522314",
"0.5490886",
"0.5457195",
"0.5382449",
"0.5356257",
"0.5338692",
"0.5296676",
"0.52941763",
"0.52941555",
"0.5291349",
"0.512562",
"0.509649... | 0.7473607 | 0 |
Returns an MLReader instance for our clarrier class. | def read(cls):
return JavaMLReader(PysparkObjId._getCarrierClass()) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_reader(self) -> SpectrumReader:\n # Get the reader class\n reader_class = self.get_reader_class()\n\n # Get the common options between ourselves and the reader class\n common_options = self.get_common_options(reader_class)\n\n # Get the options sub-list corresponding to t... | [
"0.67145205",
"0.63031405",
"0.60826933",
"0.5918452",
"0.5871343",
"0.5871343",
"0.5871343",
"0.5871343",
"0.58587795",
"0.5790805",
"0.578385",
"0.5756405",
"0.5725925",
"0.5680944",
"0.5567093",
"0.5440979",
"0.5423475",
"0.5418237",
"0.53865045",
"0.5371842",
"0.5369173",... | 0.6619721 | 1 |
Convert this instance to a dill dump, then to a list of strings with the unicode integer values of each character. Use this list as a set of dumby stopwords and store in a StopWordsRemover instance | def _to_java(self):
dmp = dill.dumps(self)
dmp = zlib.compress(dmp)
sc = SparkContext._active_spark_context
pylist = [str(i) + ',' for i in bytearray(dmp)]
# convert bytes to string integer list
pylist = [''.join(pylist)]
pylist.append(PysparkObjId._getPyObjId()) ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_words(self):\n return [self.id2word[idx] for idx in range(len(self))]",
"def clean_data(self, data):\r\n data=data.lower()\r\n doc=nlp(data, disable=['parser', 'ner'])\r\n \r\n #Removing stopwords, digits and punctuation from data\r\n tokens = [token.lemma_ for t... | [
"0.60043377",
"0.5608391",
"0.556416",
"0.5543508",
"0.55396116",
"0.5526597",
"0.5515431",
"0.5506938",
"0.5474769",
"0.5450249",
"0.5447673",
"0.5434373",
"0.5406406",
"0.5399833",
"0.53742355",
"0.53567433",
"0.5352834",
"0.5352834",
"0.53350633",
"0.53278655",
"0.5326807"... | 0.0 | -1 |
Return the target price for sell. Returning a None value means no price adjustment in next period. | def target_sell_price(self):
return super(Player, self).target_sell_price | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def target_buy_price(self):\n if self.period_tick == 0:\n return random.randint(1, 10)\n elif self.period_tick % self.perseverance == 0:\n # Player runs out of patience and decides to change target price.\n (avg_price,\n max_price,\n min_price)... | [
"0.81419784",
"0.6844672",
"0.66242075",
"0.6513748",
"0.64971614",
"0.64535356",
"0.6420463",
"0.6391589",
"0.6361705",
"0.6354096",
"0.6354096",
"0.6354096",
"0.6341095",
"0.632262",
"0.6271193",
"0.62572587",
"0.6253424",
"0.62272304",
"0.6215978",
"0.6211557",
"0.6207857"... | 0.7485557 | 1 |
Return the target price for buy. Returning a None value means no price adjustment in next period. | def target_buy_price(self):
if self.period_tick == 0:
return random.randint(1, 10)
elif self.period_tick % self.perseverance == 0:
# Player runs out of patience and decides to change target price.
(avg_price,
max_price,
min_price) = self.mark... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def buy_and_pay(self):\n return self.price",
"def get_target_buy_policy(self):\n global target_buy_policy\n return target_buy_policy",
"def target_sell_price(self):\n return super(Player, self).target_sell_price",
"def buying_price(self):\n buy_price = self.standard_init_pr... | [
"0.7087548",
"0.70154685",
"0.69083875",
"0.68033594",
"0.66515213",
"0.65531516",
"0.6548589",
"0.6430609",
"0.6416498",
"0.64011014",
"0.6275642",
"0.6267764",
"0.62466043",
"0.61733824",
"0.6164931",
"0.61350363",
"0.61279386",
"0.61251664",
"0.611749",
"0.61131585",
"0.60... | 0.8436822 | 0 |
Update enemy when spawned on screen | def update(self, screen: pygame.Surface):
screen.blit(self.game_obj, (self.rect.x, self.rect.y))
# Enemy in the screen boundary
if self.rect.y < S_Height:
self.rect.centery += self.speed
# Enemy out of screen boundary
else:
rand_x = random.randint(0, S_Wid... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _spawn_enemy(self):\n alien = Alien(self)\n alien_width = alien.rect.width\n alien.x = self.screen_width\n self.aliens.add(alien)",
"def enemy_update(self, events):\n for event in events:\n if event.type == pygame.KEYDOWN:\n if event.key == pygame.... | [
"0.7218356",
"0.71670794",
"0.71525747",
"0.7077861",
"0.66883826",
"0.64779687",
"0.64769065",
"0.64690465",
"0.6459043",
"0.63974386",
"0.63718426",
"0.6363147",
"0.6314236",
"0.6303166",
"0.6279154",
"0.62597454",
"0.6242612",
"0.6239759",
"0.62307024",
"0.62129307",
"0.61... | 0.7203382 | 1 |
Initialize explosion sprite object | def __init__(self, x: int, y: int, width: int, height: int):
pygame.sprite.Sprite.__init__(self)
self.x = x
self.y = y
self.width = width
self.height = height
self.curr_frame = 1 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self, BG_WIDTH,BG_HEIGHT):\r\n pygame.sprite.Sprite.__init__(self)\r\n self.image = pygame.image.load(\"image/hero.png\")\r\n self.rect = self.image.get_rect()\r\n self.rect.left, self.rect.top = (\r\n BG_WIDTH - self.rect.width) // 2, (BG_HEIGHT - self.rect.heig... | [
"0.80656964",
"0.7574345",
"0.74488246",
"0.74242085",
"0.72471136",
"0.72109133",
"0.7178741",
"0.71093243",
"0.71093243",
"0.70706517",
"0.7042659",
"0.7034842",
"0.703393",
"0.7002594",
"0.6993242",
"0.696758",
"0.69625944",
"0.6957768",
"0.6939183",
"0.6936095",
"0.691895... | 0.6731061 | 38 |
Home Page / Starting Page | def index(request):
return render(request, 'index.html') | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def start_page():\n if not _home:\n abort(404)\n return redirect(_home)",
"def start_page():\n if not _home:\n abort(404)\n return redirect(_home)",
"def home():\n\n\treturn render_template('index.html', title='Home Page',\n\t\t\t\t\t\t year=datetime.now().year)",
"def home():\n\n... | [
"0.8078616",
"0.8078616",
"0.7965687",
"0.78534234",
"0.7820242",
"0.78082174",
"0.77683127",
"0.776779",
"0.77405614",
"0.7721624",
"0.7712807",
"0.7683539",
"0.76715803",
"0.766572",
"0.766572",
"0.766572",
"0.766572",
"0.766572",
"0.766572",
"0.766572",
"0.766572",
"0.76... | 0.0 | -1 |
Adds the undirected edge e to this edgeweighted graph. | def addEdge(self, e):
v = e.either()
w = e.other(v)
self._validateVertex(v)
self._validateVertex(w)
self._adj[v].add(e)
self._adj[w].add(e)
self._E += 1 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_edge(self, e):\n v, w = e\n self[v][w] = e\n self[w][v] = e",
"def add_edge(self, e):\n x = min(e)\n y = max(e)\n if x not in self._vertices:\n self.add_vertex(x)\n if y not in self._vertices:\n self.add_vertex(y)\n self._edges... | [
"0.7664378",
"0.74235487",
"0.7333858",
"0.7089898",
"0.6960973",
"0.6932024",
"0.67674756",
"0.6720188",
"0.6709351",
"0.6675252",
"0.6548256",
"0.65330565",
"0.6486671",
"0.64824134",
"0.6456003",
"0.644494",
"0.6433653",
"0.64014375",
"0.6391925",
"0.6390308",
"0.6380196",... | 0.8015526 | 0 |
Returns the degree of vertex v. | def degree(self, v):
self._validateVertex(v)
return self._adj[v].size() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def degree(self, v):\n self._validateVertex(v)\n return self._adj[v].size()",
"def degree_v(self):\n return self._degree_v",
"def degree(self,v,outgoing=True):\n adj = self._outgoing if outgoing else self._incoming\n return len(adj[v])",
"def return_outdeg(self, vertex: np.... | [
"0.8654037",
"0.77240205",
"0.7249587",
"0.67295986",
"0.67287475",
"0.65444237",
"0.6420053",
"0.6316466",
"0.62405914",
"0.61732084",
"0.6006609",
"0.5992578",
"0.5976445",
"0.58604306",
"0.58168817",
"0.58168817",
"0.5815217",
"0.57448727",
"0.57133615",
"0.56907606",
"0.5... | 0.8718748 | 0 |
This function will be mounted on "/" and display a link to the hello world page. | def index(environ, start_response):
start_response('200 OK', [('Content-Type', 'text/html')])
return [str.encode('''Hello World Application
This is the Hello World application:
`continue <hello/>`_
''')] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def hello():\n\n return render_template(\"index.html\")",
"def hello():\n return render_template(\"hello.html\")",
"def say_hello():\n\n return render_template(\"hello.html\")",
"def say_hello():\n\n return render_template(\"hello.html\")",
"def say_hello():\n\n return render_template(\"hell... | [
"0.7291471",
"0.6948371",
"0.681084",
"0.681084",
"0.681084",
"0.681084",
"0.681084",
"0.679947",
"0.6770196",
"0.6669932",
"0.6659465",
"0.66351384",
"0.66299856",
"0.66134864",
"0.65835524",
"0.65782815",
"0.6545467",
"0.6542566",
"0.6542106",
"0.65369827",
"0.65193814",
... | 0.0 | -1 |
Return the name of this sensor. | def name(self) -> str:
return self._name | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def name(self):\n return self._sensor.name",
"def get_sensor_name(self):\n return self.data[1]",
"def name(self):\n return self.device.device_data[self.device_id]['name'] + \\\n f' {self._sensor_type}'",
"def name(self):\n return f\"{self._name} {SENSOR_TYPES[self.senso... | [
"0.94373417",
"0.90874785",
"0.9082654",
"0.8935356",
"0.8910483",
"0.8826392",
"0.8737171",
"0.84649163",
"0.84309494",
"0.83938766",
"0.82723033",
"0.8232919",
"0.8222632",
"0.820558",
"0.8143354",
"0.8103642",
"0.8097264",
"0.8097264",
"0.8097264",
"0.8013187",
"0.7928938"... | 0.0 | -1 |
Return the state of this sensor. | def state(self) -> str:
return self._state | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def state(self):\n return self.device.device_data[self.device_id][self._sensor_type]",
"def state(self):\n if self.coordinator.data:\n return self.coordinator.data[self._sensor]",
"def state(self):\n return self.device.value()",
"def state(self):\n return self._device.v... | [
"0.899807",
"0.8458876",
"0.8428019",
"0.8406747",
"0.8316484",
"0.8255243",
"0.8250053",
"0.8179804",
"0.8154293",
"0.80524457",
"0.8020047",
"0.80064696",
"0.785572",
"0.785572",
"0.78027344",
"0.77941775",
"0.77535903",
"0.7744199",
"0.7731679",
"0.7731679",
"0.7731679",
... | 0.0 | -1 |
Return the attributes of this sensor. | def device_state_attributes(self) -> str:
return {
"remo_device_id": self._remo_device.id,
"remo_device_name": self._remo_device.name,
"remo_firmware_version": self._remo_device.firmware_version,
"remo_temperature_offset": self._remo_device.temperature_offset,
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def device_state_attributes(self):\r\n return self.attributes",
"def getAttributes(self):\n return self.attributes",
"def getAttributes(self):\n return self.attributes",
"def get_attributes(self):\n return self.attributes",
"def get_attributes(cls):\n return cls._attribut... | [
"0.7385076",
"0.73819625",
"0.73819625",
"0.7373273",
"0.7310102",
"0.72853273",
"0.72835916",
"0.7242273",
"0.72297716",
"0.72171766",
"0.72053057",
"0.7192198",
"0.7133266",
"0.7133266",
"0.7133266",
"0.7133266",
"0.7133266",
"0.7133266",
"0.7133266",
"0.7133266",
"0.713326... | 0.68466836 | 61 |
return the first index of item in array or None if item is not found | def linear_search(array, item):
# implement linear_search_iterative and linear_search_recursive beleft, then
# change this to call your implementation to verify it passes all tests
# return linear_search_iterative(array, item)
return linear_search_recursive(array, item) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def np_index_of(array, item):\n where = np.where(array == item)\n if len(where) == 0:\n raise ValueError(\"{0} not found in array\".format(item))\n return where[0][0] # where is a 2d array",
"def __find_index(arr, val):\n if val is not None:\n return numpy.searchsorted(arr, val)\n e... | [
"0.7654498",
"0.76485795",
"0.73254657",
"0.7152995",
"0.70068246",
"0.6965024",
"0.6964481",
"0.6916574",
"0.6872765",
"0.6827316",
"0.67693734",
"0.6750015",
"0.66990155",
"0.668622",
"0.66723377",
"0.6657315",
"0.66358805",
"0.66342586",
"0.661365",
"0.6607807",
"0.6569612... | 0.6043014 | 66 |
return the index of item in sorted array or None if item is not found | def binary_search(array, item):
# implement binary_search_iterative and binary_search_recursive beleft, then
# change this to call your implementation to verify it passes all tests
return binary_search_iterative(array, item)
# return binary_search_recursive(array, item) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __find_index(arr, val):\n if val is not None:\n return numpy.searchsorted(arr, val)\n else:\n return val",
"def index_equals_value_search1(arr):\n for key, value in enumerate(arr):\n if value == key:\n return value\n return -1",
"def binary_search(elem: int, arr:... | [
"0.7913142",
"0.7233686",
"0.7095712",
"0.70499206",
"0.7026747",
"0.7015841",
"0.69785255",
"0.6939009",
"0.6912953",
"0.69073117",
"0.688271",
"0.6863251",
"0.68293405",
"0.6824078",
"0.6762747",
"0.6725547",
"0.6689355",
"0.6677653",
"0.6647194",
"0.6569108",
"0.656099",
... | 0.0 | -1 |
Add a new experience to memory | def add_experience(self, state, action, reward, next_state, done):
experience = (state, action, reward, next_state, done)
for i, k in enumerate(self.data_keys):
getattr(self, k).append(experience[i])
self.size += 1 | {
"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, experience):\n self.buffer.append(experience)",
"def add(self, state, action, reward, next_state... | [
"0.7760072",
"0.7590868",
"0.755468",
"0.752751",
"0.7450783",
"0.72245246",
"0.7153905",
"0.70797545",
"0.6969529",
"0.691223",
"0.691223",
"0.691223",
"0.691223",
"0.691223",
"0.691223",
"0.691223",
"0.691223",
"0.691223",
"0.691223",
"0.691223",
"0.6853843",
"0.68222356"... | 0.6956846 | 9 |
Return all experiences currently stored in memory and create an additional list containing all next_actions needed for calculating the Sarsa target | def sample(self):
batch = {k: getattr(self, k) for k in self.data_keys}
batch['next_actions'] = np.zeros_like(batch['actions'])
batch['next_actions'][:-1] = batch['actions'][1:]
# Convert batch to tensors
for k in batch:
batch[k] = np.array(batch[k])
batc... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def collect_experience(env_, agent_, size):\n env_.reset()\n state, reward, done, _ = env_.step(env_.action_space.sample())\n for data in range(size):\n action = env_.action_space.sample()\n next_state, reward, done, _ = env_.step(action)\n # penalize reward based on the position of t... | [
"0.65599126",
"0.64187276",
"0.627804",
"0.62750834",
"0.62167037",
"0.6204232",
"0.6201586",
"0.6178816",
"0.61643094",
"0.6137928",
"0.61209476",
"0.6115777",
"0.60816115",
"0.60333836",
"0.59984523",
"0.5971031",
"0.5963727",
"0.59198016",
"0.5918101",
"0.5852568",
"0.5847... | 0.0 | -1 |
Applies 1 dimentional PassFilter function along the 'x' axis. | def PassFilter2D(xdata, zdata, order=5, btype='high', freq = None, cutoff=None):
fs = (xdata.shape[0]-1)/abs(xdata.max()-xdata.min())
zz = np.zeros_like(zdata)
for u, i in enumerate(zdata):
# print u
zz[u] = PassFilter(xdata, i, fs=fs, order=order, btype=btype, freq = freq, cutoff=cutoff... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def forward_pass(self, x):\n self.x = x\n exp_x = np.exp(x)\n sum_x = np.sum(axis=1)\n return exp_x/sum_x",
"def forward(self,x):\n embeds = self.embedding(x)\n \n x = torch.unsqueeze(embeds,1)\n # print('x',x.shape)\n xs = []\n for conv in se... | [
"0.6332229",
"0.60679555",
"0.6055485",
"0.6055485",
"0.6055485",
"0.6055485",
"0.6055142",
"0.6037685",
"0.6035331",
"0.6029113",
"0.6011019",
"0.6001742",
"0.59940946",
"0.5986207",
"0.59413314",
"0.59226274",
"0.5894207",
"0.58769023",
"0.5873952",
"0.5852246",
"0.5844234"... | 0.57574034 | 24 |
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.7876496 | 63 |
Returns representation of the element in a orgmode format. | def getOutput(self):
text = ""
text += "*"*self.getLevel() + " "
if self.isTODO():
text += "TODO "
if self.isDONE():
text += "DONE "
text += self.getTitle()
return text | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __str__(self):\n return str(self.element)",
"def __repr__(self):\n return (\n f\"<Element: {self.name}, symbol: {self.symbol}, \"\n f\"atomic number: {self.atomic_number}, mass: {self.mass.to('amu')}>\"\n )",
"def __repr__(self) -> str:\n return \"-\".join(... | [
"0.62339616",
"0.6186848",
"0.61250925",
"0.6067119",
"0.60645974",
"0.60282725",
"0.602172",
"0.6014843",
"0.5955164",
"0.594241",
"0.59409225",
"0.5921626",
"0.5900952",
"0.5885882",
"0.5864846",
"0.58377665",
"0.58251494",
"0.5807315",
"0.5805708",
"0.580071",
"0.57953954"... | 0.0 | -1 |
Get the first day of the previous month. | def prev_month_start(dt):
_y, _m, _d = dt.year, dt.month, dt.day
if _m == 1:
_m = 12
_y -= 1
else:
_m -= 1
_d = 1
return date(_y, _m, _d) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def last_month_first_day():\r\n return (datetime.now().replace(day=1) + relativedelta(months=-1) + timedelta(days=-1)).strftime(\r\n '%d-%m-%Y')",
"def first_month_day():\r\n return datetime.now().replace(day=1).strftime('%d-%m-%Y')",
"def get_first_date(in_month=1):\n\n from_date = (today-rela... | [
"0.78284603",
"0.72850215",
"0.713952",
"0.70345163",
"0.70345163",
"0.68359745",
"0.6828617",
"0.6729497",
"0.6648446",
"0.6602412",
"0.6591734",
"0.6583441",
"0.6539718",
"0.6396435",
"0.63960034",
"0.63960034",
"0.63424087",
"0.63333315",
"0.6290044",
"0.62161916",
"0.6173... | 0.75131726 | 1 |
Returns the arguments and options passed to the script. | def parse_args():
parser = argparse.ArgumentParser(description='Downloads all filings contained in the given EDGAR RSS feed from the SEC archive (skips already existing local files).')
parser.add_argument('rss_feeds', metavar='RSS', nargs='+', help='EDGAR RSS feed file')
parser.add_argument('--log', metavar='LOGFILE... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_cli_arguments(self):\n pass",
"def _get_run_script_args(self):\n raise NotImplementedError",
"def _parser_options():\n #We have two options: get some of the details from the config file,\n import argparse\n from pydft import base\n pdescr = \"Numerical DFT code.\"\n parser = ar... | [
"0.7738617",
"0.7472278",
"0.74134374",
"0.723028",
"0.71813923",
"0.71432185",
"0.7111274",
"0.7094404",
"0.70486176",
"0.70251954",
"0.7016088",
"0.70114917",
"0.6982486",
"0.69504076",
"0.6937289",
"0.69269013",
"0.6923406",
"0.6922578",
"0.69217217",
"0.68955815",
"0.6886... | 0.0 | -1 |
This function exports the shelve_variable value within the shelve file stored at path. This network is then converted to a networkx object and exported in GEXF format at filename. | def export_gexf(import_path='.',
shelve_key='hospital_network2',
export_path='hospital_network.gexf',
state_dict=None,
region_dict=None,
is_regional_weight=None):
db = shelve.open(filename=import_path)
hospital_network = db[shelve_k... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def save_network(session, tf_variables, file_path):\n variable_values = session.run(tf_variables)\n with open(file_path, mode='wb') as f:\n pickle.dump(variable_values, f)",
"def save_graph(self, path):\n if path.split('.')[-1]=='gexf':\n nx.write_gexf(self.graph, path)\n el... | [
"0.5712423",
"0.5633751",
"0.5484997",
"0.5479284",
"0.5331205",
"0.5299281",
"0.5290899",
"0.51925623",
"0.51891124",
"0.51826143",
"0.5163183",
"0.51541483",
"0.5134981",
"0.51240766",
"0.51055336",
"0.509559",
"0.5079701",
"0.5074755",
"0.5072387",
"0.50215954",
"0.5000518... | 0.5800383 | 0 |
This function prints and plots the confusion matrix. Normalization can be applied by setting `normalize=True`. | def plot_confusion_matrix(y_true, y_pred, classes,
normalize=False,
title=None,
cmap=plt.cm.Blues,
directory="plots",
session_name=""):
if not title:
if normalize:
ti... | {
"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.0 | -1 |
Remove items which values are set to None/False | def clean_dict(to_clean):
for k in list(to_clean.keys()):
if not to_clean.get(k):
to_clean.pop(k) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _remove_none_values(dictionary):\n return list(map(dictionary.pop,\n [i for i in dictionary if dictionary[i] is None]))",
"def filter_none(elems):\n return [x for x in elems if x is not None]",
"def filter_none(x):\n if isinstance(x, dict):\n return {k: filter_none(v) for... | [
"0.70964295",
"0.6864615",
"0.6724444",
"0.67202586",
"0.67028236",
"0.6670721",
"0.6594698",
"0.65770525",
"0.65501803",
"0.6526514",
"0.6467112",
"0.64417225",
"0.64248604",
"0.64140356",
"0.64122325",
"0.6384041",
"0.6372308",
"0.6319401",
"0.63018274",
"0.62933004",
"0.61... | 0.0 | -1 |
Split a multisentence text string into list of sentences. | def split_sentences(text: str) -> List[str]:
return sent_tokenize(text) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def split_into_sentences(s):\n s = re.sub(r\"\\s+\", \" \", s)\n s = re.sub(r\"[\\\\.\\\\?\\\\!]\", \"\\n\", s)\n return s.split(\"\\n\")",
"def split_into_sentences(s):\n s = re.sub(r\"\\s+\", \" \", s)\n s = re.sub(r\"[\\\\.\\\\?\\\\!]\", \"\\n\", s)\n return s.split(\"\\n\")",
"def split(text):\n ... | [
"0.7635702",
"0.7635702",
"0.7540487",
"0.7496285",
"0.7493634",
"0.7492456",
"0.7425475",
"0.739842",
"0.73629653",
"0.72575045",
"0.7240598",
"0.7196901",
"0.6951527",
"0.69097686",
"0.6899655",
"0.6832241",
"0.68016315",
"0.6789286",
"0.6786462",
"0.6726182",
"0.66542006",... | 0.758255 | 2 |
Create list chunks from a nested list of items using a moving window of a set size n. See Example for further details. | def compute_combinations(items: List[Union[List[Any], Tuple]], n: int) -> List[List[Any]]:
return [chunks[i:i + n] for chunks in items for i in range(len(chunks) - (n - 1))] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def make_chunks(l, n):\n return [l[i:i+n] for i in range(0, len(l), n)]",
"def build_chunks(l, n):\r\n for i in xrange(0, len(l), n):\r\n yield l[i:i+n]",
"def chunks(lst: list, n: int):\n for i in range(0, len(lst), n):\n yield lst[i : i + n]",
"def chunks(lst, n):\n fo... | [
"0.75400966",
"0.75009805",
"0.7482323",
"0.74147797",
"0.74140453",
"0.7404512",
"0.7395237",
"0.7395237",
"0.73797274",
"0.735831",
"0.73520947",
"0.73436993",
"0.73436993",
"0.73436993",
"0.73436993",
"0.73436993",
"0.7320747",
"0.7320747",
"0.7320747",
"0.7320747",
"0.732... | 0.0 | -1 |
take 1D float array of rewards and compute discounted reward | def discount_rewards(r):
discounted_r = np.zeros_like(r)
running_add = 0
for t in reversed(xrange(0, r.size)):
running_add = running_add * gamma + r[t]
discounted_r[t] = running_add
return discounted_r | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def discount_rewards(rewards):\r\n discounted_r = np.zeros_like(rewards)\r\n running_add = 0\r\n for t in reversed(range(0, len(rewards))): \r\n running_add = running_add * reward_discount + rewards[t]\r\n discounted_r[t] = running_add\r\n return discounted_r",
"def discoun... | [
"0.8099422",
"0.7838401",
"0.77921754",
"0.77410257",
"0.7653085",
"0.7597682",
"0.75828874",
"0.758029",
"0.7578166",
"0.7535342",
"0.75183475",
"0.7504073",
"0.74670184",
"0.7456061",
"0.7433833",
"0.74262124",
"0.7393682",
"0.73703516",
"0.7355635",
"0.73281944",
"0.720141... | 0.7405633 | 16 |
return une liste de deplacements et actions . 'deplacement' can be called to return a new taquin that results in sliding the '0' tile in the direction of 'action'. | def actions(self):
def create_move(de, vers):
return lambda: self._move(de, vers)
deplacements = []
#itertools.product = boucle for imbriqué avec en parametre a,b
# ici la longueur et la largeur du tableau
for i, j in itertools.product(range(self.width),
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _get_placement_actions(self, exclude=None):\n if not self._has_blocks_to_place(exclude=exclude):\n return []\n\n dirs = [_Vec3(0, 2, 0)]\n for dir_ in _adj_dirs():\n dirs.extend([dir_, dir_ + _Vec3(0, 1, 0)])\n if self._get_block(self._pos + dir_) in [_AIR,... | [
"0.62141126",
"0.60475904",
"0.5843229",
"0.58258206",
"0.5787421",
"0.575338",
"0.5712959",
"0.56326526",
"0.5626725",
"0.562313",
"0.55794054",
"0.55721587",
"0.55189013",
"0.54927516",
"0.54714584",
"0.5457487",
"0.54550946",
"0.54527247",
"0.5421905",
"0.5417531",
"0.5394... | 0.8028319 | 0 |
Release a job server token. | def _release(self):
os.write(self.job_pipe[1], b'+') | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def release_strong_reference(self, ref_token: int) -> None:\n pass",
"def renew_token(self, wts_server_name: str, server_access_token):\n token = wts_get_token(\n hostname=wts_server_name,\n idp=self.idp,\n access_token=server_access_token,\n )\n token... | [
"0.5992998",
"0.59886146",
"0.58653545",
"0.56642586",
"0.5661181",
"0.56066257",
"0.5496472",
"0.5405208",
"0.5392759",
"0.5392759",
"0.5392759",
"0.53320926",
"0.53293824",
"0.5267446",
"0.5261687",
"0.51501423",
"0.51364803",
"0.50824445",
"0.50253326",
"0.50114554",
"0.49... | 0.48641917 | 30 |
Get block by blockheight. | def getblockhash(self, blockheight):
for block in self.blocks:
if block["height"] == int(blockheight):
return block["hash"] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_blocks_by_height(self, height: int):\n try:\n return self.blocks[height]\n except:\n return None",
"def get_block_at_height(height, headers):\n if height == 0:\n print('retrieving genesis block...')\n return GENESIS_DICTIONARY\n\n el... | [
"0.7910839",
"0.75199866",
"0.7199962",
"0.71526796",
"0.6957179",
"0.69451857",
"0.6825774",
"0.6778368",
"0.6683295",
"0.663941",
"0.6634847",
"0.65858114",
"0.6550846",
"0.65192556",
"0.6489794",
"0.6376854",
"0.63726526",
"0.6347726",
"0.6345037",
"0.63094896",
"0.6278615... | 0.68918943 | 6 |
Return the total number of blocks. When there is only one block in the blockchain, this function will return zero. | def getblockcount(self):
return len(self.blocks) - 1 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def rpc_getblockcount(self) -> int:\n return self._call_command([\"getblockcount\"])",
"def getblockcount(self):\n return self.proxy.getblockcount()",
"def get_block_count(self, ticker: str) -> int:\n result = self.rpc_getblockcount()\n return int(result)",
"def total_height_block... | [
"0.81495243",
"0.7846166",
"0.7289228",
"0.7109182",
"0.7106814",
"0.7081178",
"0.7009169",
"0.6926956",
"0.6910237",
"0.6862077",
"0.6658309",
"0.65508133",
"0.65204716",
"0.65009326",
"0.6494726",
"0.64684755",
"0.64250606",
"0.6421615",
"0.6336308",
"0.63043356",
"0.630433... | 0.71506417 | 3 |
Will turn off specified media player or all. | def turn_off(hass, entity_id=None):
data = {ATTR_ENTITY_ID: entity_id} if entity_id else {}
hass.services.call(DOMAIN, SERVICE_TURN_OFF, data) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def turn_off(self) -> None:\n self._media_title = None\n self._state = self._player.turn_off()",
"def turn_off(self, **kwargs):\n self.smartplug.turn_off()",
"def turn_off(self, **kwargs: Any) -> None:\n with self._wemo_call_wrapper(\"turn off\"):\n self.wemo.off()",
"a... | [
"0.7197437",
"0.66705227",
"0.6556167",
"0.6450495",
"0.64414865",
"0.6318604",
"0.6179437",
"0.6145305",
"0.61380565",
"0.6121687",
"0.61111295",
"0.6099013",
"0.60869426",
"0.59903985",
"0.5958687",
"0.59478444",
"0.591615",
"0.5904606",
"0.59014803",
"0.5888351",
"0.587750... | 0.0 | -1 |
Send the media player the command for prev track. | def media_prev_track(hass, entity_id=None):
data = {ATTR_ENTITY_ID: entity_id} if entity_id else {}
hass.services.call(DOMAIN, SERVICE_MEDIA_PREV_TRACK, data) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def media_previous_track(self):\n self.handleCommand(28)",
"async def async_media_previous_track(self):\n await self.local_meural.send_key_left()",
"async def async_media_previous_track(self):\n if not self._slave_mode:\n if not self._playing_mass:\n value = await... | [
"0.8422303",
"0.8077023",
"0.8065289",
"0.7757686",
"0.76979566",
"0.7632006",
"0.76124644",
"0.75877494",
"0.7529895",
"0.7453965",
"0.7412885",
"0.74040926",
"0.7396807",
"0.71261555",
"0.69101214",
"0.6822161",
"0.678125",
"0.6732375",
"0.66207445",
"0.6550796",
"0.645439"... | 0.70565987 | 14 |
Check if sharded table exists. | def shard_exists(self, table_suffix, db='default'):
meta = getattr(self.model, '_meta')
db_table = '%s_%s_%s' % (
str(meta.app_label),
str(self.model.__name__.lower()), table_suffix)
try:
with connections[db].cursor() as cursor:
cursor.execute(... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def checkIfTableExists(self, table):\n\n self.__open()\n query = \"SHOW TABLES LIKE '{}'\".format(table)\n self.__cursor.execute(query)\n result = self.__cursor.fetchall()\n self.__close()\n if result:\n return True\n else:\n return False",
"... | [
"0.75403416",
"0.7465445",
"0.7445992",
"0.7409866",
"0.7366113",
"0.7322037",
"0.72624993",
"0.7239359",
"0.7191151",
"0.7175744",
"0.7163879",
"0.71594816",
"0.7132092",
"0.7121704",
"0.71188855",
"0.70720303",
"0.7068984",
"0.7033991",
"0.7027258",
"0.6997101",
"0.6990357"... | 0.73350227 | 5 |
Return a list of products for the reaction. | def products(self):
return [k for k, v in iteritems(self._metabolites) if v >= 0] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getListOfProducts(self, *args):\n return _libsbml.Reaction_getListOfProducts(self, *args)",
"def products(self):\r\n return self._products",
"def products(self):\n return self._products",
"def list_products(self):\n return self._make_get_request(self._urls['products'])",
"def pr... | [
"0.7850744",
"0.7386481",
"0.7352541",
"0.72666794",
"0.7262857",
"0.7106698",
"0.70979744",
"0.6962542",
"0.6916809",
"0.6908457",
"0.685404",
"0.6853027",
"0.6771403",
"0.67444324",
"0.67289656",
"0.672097",
"0.67090744",
"0.6664001",
"0.66601497",
"0.66251796",
"0.6606335"... | 0.0 | -1 |
Initialize a count dictionary with words from the vocabulary | def new_counts_dict():
IN_FILES = ["../_semtag_dataset_webanno_tfidf_inimigo.txt","../_semtag_dataset_webanno_tfidf_publico.txt" ]
txt = []
for in_file in IN_FILES:
with codecs.open(in_file,"r","utf-8") as fid:
txt += fid.readlines()
#words
words = [w for m in txt for w in m.split()]
#unique words... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def build_vocab(self, min_count=3):\n word2count = defaultdict(int)\n for sentence in self.tokenized_corpus:\n for word in sentence:\n word2count[word] += 1\n\n word2dict = {}\n word2dict['PAD'] = {'id': 0}\n word2dict['UNK'] = {'id': 1}\n for wor... | [
"0.7601095",
"0.73794025",
"0.7366958",
"0.73403233",
"0.7246775",
"0.72317404",
"0.7195916",
"0.71952516",
"0.7185713",
"0.71781933",
"0.7151542",
"0.71442306",
"0.706082",
"0.7031777",
"0.70280826",
"0.70263475",
"0.6974297",
"0.69604725",
"0.69459844",
"0.6941313",
"0.6934... | 0.69051254 | 26 |
get method for getting the X axis point. | def get_axis_x(self):
return self.__x_axis | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def xaxis ( self ) :\n return self.__xaxis",
"def xaxis ( self ) :\n return self.__xaxis",
"def xaxis ( self ) :\n return self.__xaxis",
"def xaxis(self):\n return self._xaxis",
"def get_x(self):\n return self.coords[0]",
"def Getxcoord(self):\n return self.x_c... | [
"0.8184666",
"0.8184666",
"0.8174522",
"0.7848605",
"0.7667471",
"0.75564843",
"0.75510025",
"0.7472178",
"0.74503064",
"0.7439643",
"0.7432336",
"0.7424268",
"0.74176836",
"0.74152404",
"0.7327405",
"0.7313518",
"0.7263925",
"0.725688",
"0.7240946",
"0.71747917",
"0.7172833"... | 0.80252904 | 3 |
get method for getting the Y axis point. | def get_axis_y(self):
return self.__y_axis | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def yaxis ( self ) :\n return self.__yaxis",
"def yaxis ( self ) :\n return self.__yaxis",
"def get_y(self):\n return self.__y",
"def get_y(self):\n return self.coords[1]",
"def yaxis(self):\n return self._yaxis",
"def getY(self):\n return self.y",
"def getY(... | [
"0.8018359",
"0.8018359",
"0.7782793",
"0.77314866",
"0.76514375",
"0.7642088",
"0.7642088",
"0.7620652",
"0.76143646",
"0.7606231",
"0.75195414",
"0.75004864",
"0.74970174",
"0.74919397",
"0.74416965",
"0.74407864",
"0.7425478",
"0.7416375",
"0.7407005",
"0.7407005",
"0.7399... | 0.8224228 | 0 |
get method for getting the Y speed on axis. | def get_speed_y(self):
return self.__y_speed | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_speed_y(self):\n return self.__speed_y",
"def get_axis_y(self):\r\n return self.__y_axis",
"def get_speed(self):\r\n return self.__x_speed, self.__y_speed",
"def __get_y__(self):\n return self.Direction['y']",
"def getYVelocity(self):\n return self.yvelocity",
"... | [
"0.846187",
"0.73009276",
"0.71485925",
"0.7112363",
"0.71077454",
"0.7096992",
"0.7096992",
"0.7030312",
"0.6988315",
"0.6929665",
"0.6924849",
"0.6924849",
"0.6877729",
"0.6860263",
"0.6856702",
"0.68413603",
"0.6839264",
"0.68323064",
"0.67850566",
"0.6782221",
"0.6755415"... | 0.8630101 | 0 |
set method for updating the Y axis point. | def set_axis_y(self, new_axis_point):
self.__y_axis = new_axis_point | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def setY(self, *args):\n return _libsbml.Point_setY(self, *args)",
"def set_y(self, new_y):\r\n self.y = new_y",
"def setY(self, y):\n self.y = y\n pass",
"def setY(self, y):\r\n\t\tself._y=y",
"def setY(self, value):\n self.components[1] = value",
"def setY(self, value... | [
"0.8262282",
"0.8131621",
"0.7988872",
"0.7881037",
"0.7824714",
"0.7824714",
"0.77847975",
"0.77512825",
"0.7736993",
"0.7734033",
"0.7662968",
"0.76068664",
"0.75417495",
"0.750359",
"0.7495629",
"0.7360112",
"0.73216695",
"0.7209196",
"0.7143445",
"0.7080116",
"0.7080116",... | 0.8447287 | 0 |
Returns starting state of the board. | def initial_state():
return [[EMPTY, EMPTY, EMPTY],
[EMPTY, EMPTY, EMPTY],
[EMPTY, EMPTY, EMPTY]] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def start_state(self):\r\n return np.zeros(self.board_size, dtype=np.int8)",
"def start_state():\n return chess.Board()",
"def startingState(self):\n # Returns starting position and 4 false because no corners are visited yet\n return (self.startingPosition, (False, False, False, False))... | [
"0.8081514",
"0.7890486",
"0.7534929",
"0.72789717",
"0.72789717",
"0.72262055",
"0.72262055",
"0.72262055",
"0.72262055",
"0.72262055",
"0.72262055",
"0.72262055",
"0.72262055",
"0.72262055",
"0.72262055",
"0.72262055",
"0.72262055",
"0.72262055",
"0.72262055",
"0.72262055",
... | 0.0 | -1 |
Gets the bounding box. | def getbbox(self):
pass | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_bounding_box(self):\n return self._domain.get_bounding_box()",
"def boundingBox(self):\n self._updateExtents()\n return self.mBoundingBox",
"def bounding_box(self):\n if self.bbox is None:\n self.bbox = bounding_box(self)\n return self.bbox",
"def boundin... | [
"0.88838214",
"0.87883323",
"0.87609977",
"0.87609977",
"0.86359984",
"0.83344686",
"0.82580936",
"0.81066144",
"0.80679077",
"0.8010906",
"0.7966284",
"0.79299307",
"0.7926205",
"0.78929335",
"0.7884134",
"0.7847089",
"0.78388464",
"0.781127",
"0.7810267",
"0.7750749",
"0.77... | 0.80430377 | 9 |
Converts the path to Python list. flat By default, this function returns a list of 2tuples [(x, y), ...]. If this argument is true, it returns a flat list [x, y, ...] instead. A list of coordinates. | def tolist(self, flat=0):
pass | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_path_coordinates(path) :\r\n\r\n coords = []\r\n\r\n for node in path :\r\n coords.append(node.coords)\r\n\r\n return coords",
"def path2list(thePath):\r\n theItems = thePath.split( os.pathsep )\r\n theResult = '\\n'.join( theItems )\r\n return theResult",
"def to_list(self):\n... | [
"0.6834748",
"0.6364971",
"0.62120545",
"0.60419685",
"0.602828",
"0.5930141",
"0.5919437",
"0.59075147",
"0.58640325",
"0.58632755",
"0.5854564",
"0.5850302",
"0.5837483",
"0.5694189",
"0.56770545",
"0.564585",
"0.56415975",
"0.56283337",
"0.5617978",
"0.5611478",
"0.5605737... | 0.5959347 | 5 |
Should raise value error for missing paramters | def test_should_raise_value_error_for_missing_parameters(self):
assert_raises(ValueError, TCPControlBits) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def check_params(self):\n raise NotImplementedError",
"def _check_params(self):\n pass",
"def _validate_params(self):\n raise NotImplementedError('Must be implemented in subclasses.')",
"def test_validate_params_with_missing_values(mocker, params, raised_message):\n\n with raises(DemistoE... | [
"0.7665842",
"0.7422029",
"0.7388969",
"0.7165575",
"0.71186155",
"0.6958547",
"0.6919545",
"0.6915483",
"0.6876228",
"0.68740815",
"0.6863264",
"0.6822957",
"0.6819474",
"0.6799659",
"0.67493075",
"0.6745627",
"0.6743629",
"0.67200637",
"0.67170924",
"0.6689392",
"0.6677924"... | 0.67942256 | 14 |
Test that mamba is called when set, and that we fail when mamba is not available or is not working. We mock the calls so we do not actually execute mamba (which is not installed in the test environment anyway) | def test_create_env_with_mamba(monkeypatch):
def exec_cmd_mock(cmd, *args, **kwargs): # pylint: disable=unused-argument
if cmd[-1] == "--json":
# We are supposed to list environments in JSON format
return subprocess.CompletedProcess(
cmd, 0, json.dumps({"envs": ["ml... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_load_fails_no_shell(install_mockery, mock_fetch, mock_archive, mock_packages):\n install(\"mpileaks\")\n\n out = load(\"mpileaks\", fail_on_error=False)\n assert \"To set up shell support\" in out",
"def test_set(self):\n mock = MagicMock(\n return_value={\"retcode\": 0, \"std... | [
"0.625824",
"0.624828",
"0.59064263",
"0.5862657",
"0.5823975",
"0.5786053",
"0.5762527",
"0.57063794",
"0.56847775",
"0.5672596",
"0.566921",
"0.56542104",
"0.56403804",
"0.5640097",
"0.56069046",
"0.5606823",
"0.56067246",
"0.5604071",
"0.5587542",
"0.5574236",
"0.55651575"... | 0.7149246 | 0 |
Checks to see if bullets have hit targets. Updates scores and removes dead items. | def check_collisions(self):
# NOTE: This assumes you named your targets list "targets"
for bullet in self.bullets:
for target in self.targets:
# Make sure they are both alive before checking for a collision
if bullet.alive and target.alive:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def check_collisions(self):\r\n\r\n # NOTE: This assumes you named your targets list \"targets\"\r\n\r\n for bullet in self.bullets:\r\n for target in self.targets:\r\n\r\n # Make sure they are both alive before checking for a collision\r\n if bullet.alive and... | [
"0.8087623",
"0.75796044",
"0.7170211",
"0.70926243",
"0.7072155",
"0.7008395",
"0.6980659",
"0.6949243",
"0.69336337",
"0.6897648",
"0.6896673",
"0.6882957",
"0.68572",
"0.68194926",
"0.68054694",
"0.6718617",
"0.66884947",
"0.6674571",
"0.6637598",
"0.6636564",
"0.66161734"... | 0.7868973 | 1 |
Checks to see if bullets, targets, or clouds have left the screen and if so, removes them from their lists. | def check_off_screen(self):
for bullet in self.bullets:
if bullet.is_off_screen(SCREEN_WIDTH, SCREEN_HEIGHT):
self.bullets.remove(bullet)
for target in self.targets:
if target.is_off_screen(SCREEN_WIDTH, SCREEN_HEIGHT):
self.targets.remove(target)... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _update_bullets(self):\n # Remove bullets that have reached top of screen\n self.bullets.update() ## MOVED HERE !!!!!!\n \n for bullet in self.bullets.copy():\n if bullet.rect.bottom <= 0:\n self.bullets.remove(bullet)\n # print(len(self.bulle... | [
"0.7334409",
"0.7168508",
"0.7166979",
"0.69657123",
"0.6924826",
"0.6890432",
"0.67304355",
"0.6716313",
"0.66257566",
"0.6598381",
"0.65911835",
"0.65833485",
"0.64644897",
"0.63929385",
"0.6364882",
"0.6358019",
"0.63353753",
"0.63051176",
"0.6267892",
"0.620167",
"0.61521... | 0.7732627 | 0 |
Generates a WordCloud from text data using the wordcloud module. It will display 'max_words' words from the input text as a WordCloud image, which randomly displays the most frequently occurring words in a horizontal or vertical arrangement, making more frequent words larger in size. It is a useful visualization to qui... | def display_wordcloud(data, title = None, file = None, bg_color = 'black',
stopwords = None, max_words = 200, max_font_size = 40,
scale = 3, random_state = None, prefer_horizontal = 0.9):
from wordcloud import WordCloud
import matplotlib.pyplot as plt
wordcloud = WordCloud(
background... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_wordcloud(self, text):\n text = ' '.join(f\"{word}\" for word in text)\n mask = np.array(Image.open(os.path.join(CURRDIR, \"cloud.png\")))\n wc = WordCloud(background_color=\"white\",\n max_words=200,\n mask=mask)\n wc.generate(text... | [
"0.8311014",
"0.7881627",
"0.7864689",
"0.7824832",
"0.7822245",
"0.74558395",
"0.7449931",
"0.73168725",
"0.72181463",
"0.71403974",
"0.7072831",
"0.70099926",
"0.69715935",
"0.69093853",
"0.6890484",
"0.6880627",
"0.68572515",
"0.68412375",
"0.6635734",
"0.65747505",
"0.645... | 0.7417773 | 7 |
Return a dictionary of sequences. | def parse_transcripts(trans):
s = SeqIO.parse(trans, 'fasta')
seq_dict = SeqIO.to_dict(s)
# Remove the _whatever at the end
seq_dict_nosuff = {}
for seqid in seq_dict:
seq_dict_nosuff[seqid.split('_')[0]] = seq_dict[seqid]
return seq_dict_nosuff | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sequenceDict(self):\n\t\twith open(self.ff) as fastaFile:\n\t\t\tsequences = {}\n\t\t\tfor name, seq in self.readFasta(fastaFile):\n\t\t\t\tsequences[name] = seq\n\t\treturn sequences",
"def get_all_sequences(self):\n seqs_dict = {}\n\n all_seqs = Sequences.objects.all().values('code_id',\n ... | [
"0.8054893",
"0.72187805",
"0.7113814",
"0.6932926",
"0.675327",
"0.6697221",
"0.6585134",
"0.65065116",
"0.64636534",
"0.64041495",
"0.635399",
"0.6334322",
"0.63191307",
"0.6285398",
"0.62833446",
"0.62581813",
"0.6243067",
"0.6215262",
"0.6188618",
"0.6185774",
"0.61823845... | 0.0 | -1 |
Extract the unique elements from a list of lists | def unique_elements_from_2D_list(list_2d):
return list(set(flatten_2D_list(list_2d))) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def unique_elements_lists(list_in):\n return list(dict.fromkeys(list_in))",
"def listops_uniq(list_a):\r\n retlist = []\r\n for item in list_a:\r\n if item not in retlist:\r\n retlist.append(item)\r\n\r\n return retlist",
"def unique_list(inlist):\n return set(inlist)",
"def _unique(li):\n ... | [
"0.7752285",
"0.7622415",
"0.76199424",
"0.75675076",
"0.75641954",
"0.75631917",
"0.7473472",
"0.74457526",
"0.74089354",
"0.7378857",
"0.7292243",
"0.7274385",
"0.71824473",
"0.714957",
"0.7135371",
"0.71213824",
"0.7110844",
"0.7102604",
"0.7084292",
"0.7068677",
"0.701543... | 0.8023848 | 0 |
Computes the optimal global threshold for a grayscale image by maximizing the variance between the two classes of pixels (i.e., light and dark). Operates efficiently by using the image histogram of the input image. | def otsu(gray_im):
hist = gray_im.histogram()
best = None
for t in range(len(hist)):
left = hist[:(t+1)]
right = hist[(t+1):]
if sum(left) * sum(right) == 0: continue # skip degenerate cases
inter_class_variance = sum(left) * sum(right) * (histogram_mean(left) - histogram_m... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def GlobalThresholding(image, kernel_sigma, N_levels, N_classes, step = 1): \n \n if kernel_sigma >= 1:\n image = Denoising(image, kernel_sigma);\n \n pixel_count, pixel_count_normalized = CountPixels(image, N_levels);\n mean_g = image.mean(); # global mean\n\n if N_classes == 2:... | [
"0.6778451",
"0.66713446",
"0.66291255",
"0.65077215",
"0.6492973",
"0.6267796",
"0.6199048",
"0.6120128",
"0.60671455",
"0.60521626",
"0.5945233",
"0.59353375",
"0.59348774",
"0.5884918",
"0.58665776",
"0.5853676",
"0.5838776",
"0.582108",
"0.5816684",
"0.5811029",
"0.580289... | 0.53212446 | 82 |
Get coordinates for vertices based on the rectangles rotation. | def rotated_vertices(self):
rotated_vertices = []
for v in self.non_rotated_vertices():
x, y = v[0], v[1]
x_rotated = self.pos.x + (x-self.pos.x)*math.cos(self.rotation) - (y-self.pos.y)*math.sin(self.rotation)
y_rotated = self.pos.y + (x-self.pos.x)*math.sin(self.rot... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def non_rotated_vertices(self):\n v0 = [self.pos.x - self.width / 2, self.pos.y - self.height / 2]\n v1 = [self.pos.x + self.width / 2, self.pos.y - self.height / 2]\n v2 = [self.pos.x + self.width / 2, self.pos.y + self.height / 2]\n v3 = [self.pos.x - self.width / 2, self.pos.y + self... | [
"0.7354635",
"0.6756148",
"0.6677719",
"0.6611818",
"0.64872533",
"0.6416529",
"0.6327575",
"0.6281346",
"0.6269531",
"0.6269531",
"0.6269531",
"0.621683",
"0.6213612",
"0.617489",
"0.60842246",
"0.6039863",
"0.60148287",
"0.6014572",
"0.59983444",
"0.59813225",
"0.5957984",
... | 0.6830937 | 1 |
Moves all lines to center of window. | def center_lines(self):
window_center = Rectangle.center(self.window_width, self.window_height)
for line in self.lines.values():
line.pos = Vector(*window_center)
line.set_vertices() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def center_window(self):\n\n\t\tframe_geo = self.frameGeometry()\n\t\tcursor_pos = QtWidgets.QApplication.desktop().cursor().pos()\n\t\tscreen = QtWidgets.QApplication.desktop().screenNumber(cursor_pos)\n\t\tcenter_point = QtWidgets.QApplication.desktop().screenGeometry(screen).center()\n\t\tframe_geo.moveCenter(c... | [
"0.68792963",
"0.68393695",
"0.6779639",
"0.67767423",
"0.67747927",
"0.6710224",
"0.6697853",
"0.66565084",
"0.65981454",
"0.65597856",
"0.65552425",
"0.65437317",
"0.65426046",
"0.65303344",
"0.6528591",
"0.64767516",
"0.64730334",
"0.64730334",
"0.6457272",
"0.6419874",
"0... | 0.81741714 | 0 |
Deletes all TextLabel objects. | def clear_all(cls):
del cls.text_labels[:] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def clear_lines(self):\r\n\r\n # iterate through the stored labels\r\n for cur_label in self.list_labels:\r\n # make sure label exists\r\n if cur_label is not None:\r\n # delete the label\r\n cur_label.deleteLater()\r\n\r\n # clear the list\r... | [
"0.7286506",
"0.67453706",
"0.6338942",
"0.6310421",
"0.6281789",
"0.62800646",
"0.625658",
"0.62412405",
"0.61279625",
"0.6112248",
"0.6076884",
"0.6074945",
"0.597047",
"0.5952516",
"0.5944838",
"0.5940013",
"0.59279794",
"0.5896391",
"0.5882896",
"0.5865422",
"0.58512825",... | 0.83194375 | 0 |
Gets the Unicode Script property of any character. Based on Scripts.txt from Unicode Consortium. | def script(char):
global scripts,indexes
if not indexes:
for line in open(scriptfile).readlines():
indexes.append(int(line[:5],16))
scripts.append(line[6:-1])
try:
key = ord(char)
except:
key = ord(unicodedata.normalize("NFC",char))
return scripts[bis... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def random_character(self, script):\n if script in self.script_characters['Script'].values:\n\n script_index = list(self.script_characters['Script'].values).index(script)\n\n character_set = list(self.script_characters['Characters'][script_index].decode(\"utf-8\"))\n\n # sel... | [
"0.6111511",
"0.5640766",
"0.5639877",
"0.5502361",
"0.5497456",
"0.5497258",
"0.5483367",
"0.53710276",
"0.53265375",
"0.52960926",
"0.526431",
"0.52602774",
"0.52389055",
"0.52199024",
"0.520892",
"0.51514155",
"0.5137121",
"0.5132685",
"0.5121968",
"0.51209444",
"0.5089513... | 0.69344753 | 0 |
get unique values in a list | def unique(list1):
# insert the list to the set
list_set = set(list1)
# convert the set to the list
unique_list = (list(list_set))
for x in unique_list:
return(x,) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _unique(li):\n return list(set(li))",
"def unique_list(inlist):\n return set(inlist)",
"def unique(li):\r\n seen = set()\r\n seen_add = seen.add\r\n return [x for x in li if not (x in seen or seen_add(x))]",
"def unique(input_list):\n output = []\n for item in input_list:\n if... | [
"0.8291187",
"0.78947407",
"0.7867298",
"0.78405404",
"0.7671379",
"0.7668306",
"0.7664602",
"0.7614855",
"0.7596702",
"0.75874764",
"0.75768155",
"0.75405586",
"0.74842453",
"0.74721646",
"0.74668306",
"0.74595475",
"0.74502337",
"0.74249834",
"0.7391009",
"0.7389136",
"0.73... | 0.76895905 | 4 |
Get the access control resource type of this resource. | def resource_type(self) -> str:
return 'TABLE' | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def resource_type(self) -> Optional[str]:\n return pulumi.get(self, \"resource_type\")",
"def resource_type(self) -> Optional[str]:\n return pulumi.get(self, \"resource_type\")",
"def request_resource_type(self) -> str:\n return pulumi.get(self, \"request_resource_type\")",
"def resource... | [
"0.7154274",
"0.7154274",
"0.68819296",
"0.68560386",
"0.68560386",
"0.68560386",
"0.68560386",
"0.68560386",
"0.6771251",
"0.67627525",
"0.6702661",
"0.6587663",
"0.6300098",
"0.6292621",
"0.6292621",
"0.6257884",
"0.62372",
"0.62372",
"0.6234189",
"0.6218725",
"0.6209053",
... | 0.0 | -1 |
Returns a random vector around the default mean | def get_random_vec():
return [random.gauss(GENERATING_MEAN, GENERATING_DEVIATION) for _ in range(VECTOR_SIZE)] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def normal(mean, std):\n\n return random.gauss(mean, std)",
"def rand(self, mean, count=1, min=0, max=numpy.inf):\n a = (min-mean)/numpy.sqrt(mean)\n b = (max - mean)/numpy.sqrt(mean)\n return numpy.int64(numpy.round(stats.truncnorm.rvs(a, b, loc=mean, scale=numpy.sqrt(mean), size... | [
"0.709052",
"0.69539094",
"0.6781963",
"0.6727938",
"0.6624372",
"0.65475935",
"0.6544358",
"0.64601034",
"0.63965577",
"0.63930357",
"0.637999",
"0.6368736",
"0.6358028",
"0.63561004",
"0.6350929",
"0.6325413",
"0.63241917",
"0.63169307",
"0.6315985",
"0.63061875",
"0.626604... | 0.6042923 | 44 |
Returns all mirrors from database. | async def get_mirrors(request):
page = request.GET.getone("page", None)
page_size = request.GET.getone("page_size", None)
filter_name = request.GET.getone("q", "")
if page:
try:
page = int(page)
except (ValueError, TypeError):
return web.Response(text="Incorrect ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_databases ():\n return _dbobjects[:]",
"def get_all_boards():\n return [board for board in GRAPH_DB.find(\"board\")]",
"def get_all(self):\n return self.db",
"def _ism_get_mirror_sources(source, receiver, walls, order_threshold, mirrors_threshold):\n logger.info(\"_ism_get_mirror_sour... | [
"0.60189897",
"0.5737089",
"0.5689003",
"0.5664445",
"0.5648987",
"0.5647171",
"0.55707955",
"0.5502979",
"0.54678285",
"0.5449182",
"0.54244107",
"0.539391",
"0.53781986",
"0.5354574",
"0.53465503",
"0.5312634",
"0.52797055",
"0.5229054",
"0.5226839",
"0.52085924",
"0.518863... | 0.63651407 | 0 |
Initialize dataset; store relevant data as attributes. | def initialize_data(self , station = '', datasets = {} ):
self.datasets = datasets
self.datasets_keys = datasets.keys()
self.station = station
data = {} # container for the data of each dataset
source_configuration = {} # container for... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self, dataset):\n self._dataset = dataset",
"def __init__(self):\n self.__dataset = None",
"def __init__(self, dataset: Dataset):\n self.dataset = dataset",
"def _init_data(self, data):\n assert type(data) is dict, \"dict expected: %r\" % type(data)\n assert le... | [
"0.7702452",
"0.75354517",
"0.7373921",
"0.7361813",
"0.7323394",
"0.7168059",
"0.6972844",
"0.6954769",
"0.6882971",
"0.6862791",
"0.68157107",
"0.67726296",
"0.67627436",
"0.6714026",
"0.67115414",
"0.670148",
"0.67003167",
"0.66919523",
"0.6674322",
"0.66650957",
"0.664380... | 0.0 | -1 |
Converting to proper date_time adding the time_delta. Removes minutes rounding to closest integer hour. | def add_time_delta(time_offset_value, date_time, dataset):
if 'minutes' in time_offset:
date_time_delta = [ timedelta(minutes = float(i) ) + time_offset_value for i in date_time ]
elif 'hours' in time_offset:
date_... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _round_time(dt=None, round_to=60):\n if hasattr(dt, 'tzinfo'):\n dt.replace(tzinfo=None)\n diff = dt - dt.replace(hour=0, minute=0, second=0, microsecond=0)\n seconds = diff.seconds\n rounding = (seconds + round_to / 2) // round_to * round_to\n return dt + datetime.timedelta(0, rounding-s... | [
"0.6142199",
"0.608963",
"0.6073281",
"0.59808344",
"0.5857538",
"0.5805205",
"0.58038676",
"0.57710093",
"0.5740354",
"0.57135093",
"0.5662744",
"0.56545866",
"0.56228036",
"0.56104416",
"0.5603499",
"0.5587284",
"0.5581943",
"0.55743235",
"0.5565142",
"0.55090785",
"0.54979... | 0.58411443 | 5 |
Create a list of dictionaries, one for each station to be merged. | def create_station_dics(data_directories):
files_all = {}
for k,v in data_directories.items() :
files = os.listdir(v)
for f in files:
station = f.split('_')[0]
if station not in files_all.keys():
files_... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def station_list() -> List[Dict]:\n return STATIONS",
"def create_station_list(self):\n sorted_station_list = sorted(self.station_dict, key=self.station_dict.get)\n\n return sorted_station_list",
"def stations():\n list_of_stations = session.query(Station.station, Station.name)\n all_sta... | [
"0.7072738",
"0.6419095",
"0.64149207",
"0.63952416",
"0.6348605",
"0.63195777",
"0.63054585",
"0.629061",
"0.62635905",
"0.62019837",
"0.613927",
"0.6128751",
"0.60761607",
"0.6073298",
"0.6069121",
"0.6039403",
"0.5968959",
"0.59462744",
"0.593414",
"0.59236866",
"0.5904651... | 0.50811815 | 81 |
This routine returns the widget ID of a child widget by index. Indexes are 0 based, from 0 to one minus the number of widgets in the parent, inclusive. If the index is invalid, 0 is returned. | def XPGetNthChildWidget(inWidget, inIndex):
pass | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index_to_widget(self, idx):\n nchild = self.mdi_w.get_nth_page(idx)\n return self._native_to_child(nchild)",
"def index_to_widget(self, idx):\n nchild = self.widget.get_nth_page(idx)\n return self._native_to_child(nchild)",
"def _get_parent_index(self, child_index: int) -> int:\... | [
"0.7063816",
"0.70228857",
"0.68753934",
"0.6642251",
"0.65843135",
"0.6494",
"0.640338",
"0.6398749",
"0.6383007",
"0.6326655",
"0.63057804",
"0.6271183",
"0.61896485",
"0.6182927",
"0.6162978",
"0.60978836",
"0.6095024",
"0.60679233",
"0.6052714",
"0.5999034",
"0.59484094",... | 0.745608 | 0 |
This routine returns the parent of a widget, or 0 if the widget has no parent. Root widgets never have parents and therefore always return 0. | def XPGetParentWidget(inWidget):
pass | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_parent(self):\n if self.parent:\n return self.parent()\n else:\n return None",
"def parent(v=None):\n if v is None or isinstance(v, Widget):\n return v\n else:\n raise ValueError('parent must be a widget or None')",
"def _parent(no... | [
"0.7445262",
"0.7267686",
"0.70662576",
"0.703078",
"0.7023011",
"0.6921735",
"0.6909813",
"0.690397",
"0.6888465",
"0.6866056",
"0.6818259",
"0.6818259",
"0.6818259",
"0.6814847",
"0.6753504",
"0.67467874",
"0.67467874",
"0.6732227",
"0.6709426",
"0.668803",
"0.661991",
"0... | 0.76840097 | 0 |
This routine makes the specified widget be in the front most widget hierarchy. If this widget is a root widget, its widget hierarchy comes to front, otherwise the widget's root is brought to the front. If this widget is not in an active widget hiearchy (e.g. there is no root widget at the top of the tree), this routine... | def XPBringRootWidgetToFront(inWidget):
pass | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_top_widget(self, widg):\r\n if widg in self.widgets:\r\n self.widgets.remove(widg)\r\n self.widgets.insert(0, widg)\r\n for i in self.widgets:\r\n if i.get_visible():\r\n if not i == widg:\r\n i.unfocus()",
"def siguiente(self, ... | [
"0.6002634",
"0.5885957",
"0.587441",
"0.58202004",
"0.5596649",
"0.540797",
"0.53865844",
"0.52786",
"0.52619934",
"0.5255655",
"0.5190883",
"0.51295906",
"0.5122694",
"0.5016563",
"0.50136936",
"0.50136936",
"0.49593613",
"0.49176466",
"0.48844266",
"0.48817748",
"0.4830086... | 0.80461305 | 0 |
This routine returns true if this widget's hierarchy is the front most hierarchy. It returns false if the widget's hierarchy is not in front, or if the widget is not in a rooted hierarchy. | def XPIsWidgetInFront(inWidget):
pass | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def always_top(self) -> bool:\n return bool(self.tk_ref.wm_attributes('-topmost'))",
"def isTop(self):\n return self.top",
"def check_for_top(self) -> bool:\n\t\tboolean_expression_has_top = False\n\t\texpression_has_top = False\n\t\tif self.boolean_expression:\n\t\t\tboolean_expression_has_top =... | [
"0.7081847",
"0.67697656",
"0.6670092",
"0.66259086",
"0.65124255",
"0.6458956",
"0.6443464",
"0.6312447",
"0.6308285",
"0.62849045",
"0.6203926",
"0.6195798",
"0.6183352",
"0.61829406",
"0.6163055",
"0.61531126",
"0.6105784",
"0.6102047",
"0.60829717",
"0.60690075",
"0.60681... | 0.0 | -1 |
Change the log level of the underlying nio lib Called every time the user changes the log level or log category configuration option. | def change_log_level(category, level):
if category == "encryption":
category = "crypto"
if category == "all":
nio_logger.setLevel(level)
else:
nio_logger.getChild(category).setLevel(level) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def setLogLevel(self,value):\n self.PDFreactorConfiguration.in1[\"logLevel\"] = value",
"def change_level(level):\n if 'debug' in level: LOG.setLevel(logging.DEBUG)\n elif 'info' in level: LOG.setLevel(logging.INFO)\n elif 'warning' in level: LOG.setLevel(logging.WA... | [
"0.70830905",
"0.679609",
"0.67650396",
"0.6763283",
"0.6749128",
"0.66922617",
"0.6683922",
"0.66680866",
"0.6662998",
"0.6593313",
"0.65644073",
"0.6507537",
"0.6498464",
"0.648326",
"0.64190096",
"0.6407268",
"0.640491",
"0.63788426",
"0.6362697",
"0.63389504",
"0.633415",... | 0.80028075 | 0 |
Determines the peak of this isotopic trace. | def peak(self) -> Point:
return self.most_intense_point() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def peak(self):\n pass",
"def peak(self):\n return self.peak",
"def peak(self):\n\n return self._data[0]",
"def peak(self) -> Tuple[MeasureInput, MeasureResult]:\n assert self._data\n return self._data[0][2]",
"def getPeakValue( self ):\n nCurrentMax = max( self.da... | [
"0.8299433",
"0.8156179",
"0.7843446",
"0.7664795",
"0.71375835",
"0.6886308",
"0.6848139",
"0.66643375",
"0.665419",
"0.6631917",
"0.65613925",
"0.65507126",
"0.65457046",
"0.6545673",
"0.65370995",
"0.64345163",
"0.6401966",
"0.6293412",
"0.6284962",
"0.6264075",
"0.6231685... | 0.7977741 | 2 |
Generator (yield) for the main block of XSAMS for the atoms, with an inner loop for the states. The QuerySet that comes in needs to have a nested QuerySet called States attached to each entry in Atoms. | def XsamsAtoms(Atoms):
if not Atoms: return
yield '<Atoms>'
for Atom in makeiter(Atoms):
cont, ret = checkXML(Atom)
if cont:
yield ret
continue
G = lambda name: GetValue(name, Atom=Atom)
yield """<Atom>
<ChemicalElement>
<NuclearCharge>%s</NuclearCha... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def iter_atoms(self):\n for chain in self.chain_list:\n for frag in chain.fragment_list:\n for atm in frag.atom_list:\n yield atm",
"def iter_atoms(self):\n for frag in self.fragment_list:\n for atm in frag.atom_list:\n yield at... | [
"0.6705081",
"0.65286386",
"0.6414294",
"0.64098495",
"0.6398519",
"0.6389361",
"0.634098",
"0.6316727",
"0.6279771",
"0.6216665",
"0.6214714",
"0.6159597",
"0.6150255",
"0.5910688",
"0.57855797",
"0.57404",
"0.5729179",
"0.571993",
"0.5686551",
"0.56258243",
"0.56053466",
... | 0.6096699 | 13 |
Generator for the XSAMS radiative transitions. | def XsamsRadTrans(RadTrans):
if not isiterable(RadTrans):
return
for RadTran in RadTrans:
cont, ret = checkXML(RadTran)
if cont:
yield ret
continue
G = lambda name: GetValue(name, RadTran=RadTran)
yield '<RadiativeTransition>'
comm = G('R... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _gen(x_t, states, previous_direction=None):\n # Append the DWI ID of each sequence after the 3D coordinates.\n subject_ids = np.array([subject_id] * len(x_t), dtype=floatX)[:, None]\n\n if not self.use_previous_direction:\n x_t = np.c_[x_t, subject_ids]\n ... | [
"0.6354086",
"0.60217786",
"0.59698755",
"0.5910758",
"0.59103173",
"0.5873266",
"0.56603825",
"0.558565",
"0.5538359",
"0.55088437",
"0.549612",
"0.54885244",
"0.5413966",
"0.5388982",
"0.5388166",
"0.53495365",
"0.5310545",
"0.5292158",
"0.52900004",
"0.5254223",
"0.5253228... | 0.6279515 | 1 |
A wrapper class for a world model, adding functionality. This class is a wrapper for world models, taking care of initializing and training a new keras model, having different loss functions at its disposal and being able to save the currently held world model. | def __init__(self):
self.model = None | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def make_world(self):\n raise NotImplementedError()",
"def world(self):\n return World(self)",
"def world(self) -> World:\n return World(self)",
"def set_vanilla_model(self):\n logging.debug(\"Setting vanilla model\")\n # Build model\n\n ## Embedding Layer\n w... | [
"0.66986465",
"0.62097526",
"0.6127516",
"0.6087696",
"0.6049108",
"0.5847272",
"0.5800785",
"0.5653023",
"0.5640337",
"0.5625104",
"0.5605086",
"0.5602619",
"0.5587485",
"0.55251116",
"0.5512752",
"0.5511496",
"0.5490208",
"0.5470876",
"0.5460689",
"0.54506254",
"0.54335976"... | 0.0 | -1 |
Returns currently held model. | def get_model(self) -> tf.keras.Model:
if self.model is None:
self._raise_none_model()
return self.model | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def acquire_model(self):\n return self._model",
"def get_latest_model():\n return get_models()[-1]",
"def _getModel(self):\r\n \r\n return self._model",
"def model(self):\n return MODELS.get(self._model,self._model)",
"def get_model(self):\n return self._model",
"def... | [
"0.75744104",
"0.7324611",
"0.72642297",
"0.7159412",
"0.7104039",
"0.7104039",
"0.70187896",
"0.70026296",
"0.70026296",
"0.70026296",
"0.70026296",
"0.70026296",
"0.70026296",
"0.70026296",
"0.70026296",
"0.70026296",
"0.70026296",
"0.6990008",
"0.69863427",
"0.6973448",
"0... | 0.61784714 | 67 |
Builds a sequential keras model with the given parameters. Using the parameters, this function builds a keras model with at least one fully connected Dense input layer and a Dropout layer before the output layer. | def build_keras_model(self,
neurons: int = 20,
hidden_layers: int = 2,
input_shape: tuple = (4,),
output_shape: tuple = 3,
dropout_rate: float = 0.5
) -> tf.keras.M... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def build_model(nx, layers, activations, lambtha, keep_prob):\n model = K.Sequential()\n for i in range(len(layers)):\n model.add(K.layers.Dense(layers[i],\n activation=activations[i],\n input_shape=(nx,),\n kernel_regularizer=K.regularizers.l2(lambth... | [
"0.77884585",
"0.76663834",
"0.76144964",
"0.74677616",
"0.74079067",
"0.74065465",
"0.74048346",
"0.73590547",
"0.7356875",
"0.72643083",
"0.7247535",
"0.72382766",
"0.72290796",
"0.7195372",
"0.7178062",
"0.7123901",
"0.711823",
"0.71028495",
"0.709271",
"0.7088976",
"0.707... | 0.7644446 | 2 |
Get a list of Spotify featured playlists. | def featured_playlists(
self,
country: str = None,
locale: str = None,
timestamp: str = None,
limit: int = 20,
offset: int = 0
) -> tuple:
json = self._get(
'browse/featured-playlists',
locale=locale,
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def featured_playlists(\n self, locale=None, country=None, timestamp=None, limit=20, offset=0, **kwargs\n ):\n return self._get(\n API.FEATURED_PLAYLISTS.value,\n locale=locale,\n country=country,\n timestamp=timestamp,\n limit=limit,\n ... | [
"0.72855633",
"0.6391307",
"0.6188068",
"0.61724615",
"0.6140784",
"0.60877794",
"0.60118544",
"0.5992542",
"0.59573156",
"0.59223896",
"0.5908522",
"0.57533693",
"0.57139707",
"0.57082343",
"0.5702044",
"0.5697859",
"0.5627029",
"0.5626732",
"0.56253463",
"0.56213564",
"0.56... | 0.6965126 | 1 |
Get a list of Spotify playlists tagged with a particular category. | def category_playlists(
self,
category_id: str = None,
country: str = None,
limit: int = 20,
offset: int = 0
) -> SimplePlaylistPaging:
json = self._get(
f'browse/categories/{category_id}/playlists',
country=country,
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_playlists_from(category_id):\n playlist_uris = []\n for item in spotify.category_playlists(category_id)['playlists']['items']:\n playlist_uris.append(item['uri'])\n\n return playlist_uris",
"def category_playlists(\n self, category_id=None, country=None, limit=20, offset=0, **kwarg... | [
"0.75077975",
"0.70420605",
"0.67834294",
"0.6735561",
"0.61261374",
"0.5938397",
"0.5816827",
"0.5774014",
"0.5679268",
"0.5655356",
"0.5645608",
"0.5614732",
"0.55989313",
"0.55900055",
"0.5434805",
"0.5425665",
"0.54161894",
"0.5330487",
"0.53260225",
"0.53129303",
"0.5307... | 0.66011864 | 4 |
Blocks the thread, and returns the final generator return value. For now, always returns None. | def value(self):
if self._exception:
raise self._exception
else:
return self.future.value() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_generator(self):\n while self._is_running():\n yield self._queue.get()",
"def get_generator(self):\n while self._is_running():\n yield self._queue.get()",
"async def locked_next():\n async with lock:\n try:\n next_value = await anext(... | [
"0.6590165",
"0.6590165",
"0.6345912",
"0.62626296",
"0.62183034",
"0.60619",
"0.6031922",
"0.5923642",
"0.5911255",
"0.5910728",
"0.5864941",
"0.5858307",
"0.5839081",
"0.57928205",
"0.576134",
"0.57186776",
"0.5717848",
"0.57156634",
"0.57009244",
"0.56727815",
"0.5653098",... | 0.5303773 | 64 |
Look up dates in (lower) text and convert it to format YYYYMMDD | def format_date(txt):
pattern1 = r"(?P<day>0?[1-9]|[12][0-9]|3[01])([/.-]|\s|\s/\s|\.\s)" \
r"(?P<month>0[1-9]|1[012])([/.-]|\s?|\s/\s|\.\s)" \
r"(?P<y1>19|20)(?P<y2>[0-9][0-9])"
txt = re.sub(pattern1, r"\g<y1>\g<y2>\g<month>\g<day>", txt)
pattern_month = "(?P<month>janvier|ja... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def convert_date(date):\n\n if len(date) > 10: date = date[:date.rfind(\"-\")]\n return convf(date)",
"def _get_date_in_words(number_date):\n month_list = ['Jan ', 'Feb ', 'Mar ', 'Apr ', 'May ', 'Jun ', 'Jul ', 'Aug ', 'Sep ', 'Oct ', 'Nov ', 'Dec ']\n month = int(number_date[5:7]) -... | [
"0.64162254",
"0.63980806",
"0.6351707",
"0.6349577",
"0.6349557",
"0.62981117",
"0.62629354",
"0.62503743",
"0.6236636",
"0.62227446",
"0.6221019",
"0.6213746",
"0.61752427",
"0.6167384",
"0.61662686",
"0.6152096",
"0.61512935",
"0.61507475",
"0.6108177",
"0.60920626",
"0.60... | 0.6326153 | 5 |
Remove stop words from list of tokenized words | def remove_stopwords(words):
new_words = []
for word in words:
if word not in nltk.corpus.stopwords.words('french'):
new_words.append(word)
return new_words | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def remove_stop_words(stop_list, tokens):\n return [t for t in tokens if len(t) > 2 and not t in stop_list]",
"def remove_stopwords(tokens):\n stop_words = set(stopwords.words('english'))\n\n tokens = [w for w in tokens if w not in stop_words]\n\n return tokens",
"def remove_stop_words(tokenized_wo... | [
"0.86630034",
"0.86183923",
"0.85973936",
"0.8596811",
"0.8580546",
"0.8363658",
"0.8350171",
"0.8328014",
"0.8318595",
"0.8263289",
"0.82468146",
"0.820217",
"0.81783086",
"0.81630206",
"0.8158307",
"0.8138284",
"0.81271654",
"0.8113883",
"0.8099041",
"0.8048383",
"0.8027641... | 0.77397335 | 45 |
Take a string and return a valid filename constructed from the string. | def format_filename(self, s):
valid_chars = "-_ %s%s" % (string.ascii_letters, string.digits)
filename = ''.join(c for c in s if c in valid_chars)
filename = filename.replace(' ', '_') # I don't like spaces in filenames.
return filename | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def format_filename(s: str):\n # from: https://gist.github.com/seanh/93666\n\n valid_chars = \"-_.() %s%s\" % (string.ascii_letters, string.digits)\n filename = ''.join(c for c in s if c in valid_chars)\n filename = filename.replace(' ', '_') # I don't like spaces in filenames.\n return filename",
... | [
"0.80483997",
"0.7990114",
"0.79504967",
"0.78790665",
"0.7862302",
"0.7855451",
"0.7855451",
"0.7855451",
"0.77264357",
"0.7713825",
"0.7674114",
"0.75051665",
"0.74796885",
"0.74357426",
"0.73312765",
"0.7305911",
"0.7069366",
"0.7055742",
"0.68535733",
"0.6846436",
"0.6834... | 0.75294495 | 11 |
vat_return_reader(file_name) It creates a dataframe where key is file name and values are last column(2) of the VAT return table. In dataframe index name is file_name which function used | def vat_return_reader(file_name):
df = wrapper.read_pdf(file_name,pandas_options={'header':None},encoding="cp775")
print("tabula_read executed")
column_data = df.loc[0:45,2]
column_name = df.loc[0:45,1]
#replaces '.' with ',' in order to be treated as nummeric
column_data = column_... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def whole_data(arg_file_names_list):\r\n\r\n whole_data_list = []\r\n # loop which iterates through the directory and executes function vat_return_reader for each file\r\n for file_name in arg_file_names_list:\r\n whole_data_list.append(vat_return_reader(file_name))\r\n # creates data frame from... | [
"0.6553381",
"0.6267433",
"0.61484784",
"0.60837567",
"0.6040107",
"0.6013871",
"0.60014725",
"0.5962569",
"0.5934665",
"0.59078276",
"0.5901774",
"0.585681",
"0.5851989",
"0.5822987",
"0.58062553",
"0.578261",
"0.5773132",
"0.57500386",
"0.5749944",
"0.5743115",
"0.5730495",... | 0.7444267 | 0 |
Restores the weights to its initial state. | def reset_b(self, sess):
sess.run(self._init_ops) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def reset_weights(self):\r\n self._weights = deepcopy(self._tmp_weights)\r\n self._tmp_weights = None",
"def reset(self):\n self._weights.clear()",
"def reset_weights(self):\n self.head.reset_weights()",
"def reset(self):\n for i in range(0, len(self.current_state)):\n ... | [
"0.83292174",
"0.81181496",
"0.8036005",
"0.79819536",
"0.7841501",
"0.77813065",
"0.74129915",
"0.7284286",
"0.7232603",
"0.7145851",
"0.71326935",
"0.7121111",
"0.7108211",
"0.70592415",
"0.70592415",
"0.70592415",
"0.70592415",
"0.70592415",
"0.70592415",
"0.70592415",
"0.... | 0.0 | -1 |
Get the inverse map of a dictionary. | def getInv(wmap):
inv_map = {}
for k, v in wmap.items():
inv_map[v] = inv_map.get(v, [])
inv_map[v].append(k)
return inv_map | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def InvertDict(dict_in):\n return dict(zip(dict_in.values(), dict_in.keys()))",
"def inverse(dict_):\n idict = dict([(value,key) for key,value in dict_.iteritems()])\n if len(idict)!=len(dict_):\n raise ValueError(\"Dictionary has no inverse (values not unique).\")\n return idict",
"def invert... | [
"0.7823355",
"0.78208536",
"0.7660109",
"0.73263896",
"0.71609616",
"0.7050323",
"0.704076",
"0.6869903",
"0.6867391",
"0.684721",
"0.6831286",
"0.6781073",
"0.6750609",
"0.66596115",
"0.66323453",
"0.6607763",
"0.6562681",
"0.63653296",
"0.6356175",
"0.635491",
"0.62886053",... | 0.65597886 | 17 |
Calculates quantiles of the performance measure (EUR, CUM). | def performance_quantiles(data, performance_measure):
quantiles = pd.qcut(x=data[performance_measure], q=4, labels=['q1', 'q2', 'q3', 'q4'])
bins = quantiles.to_frame(name=performance_measure + '_quantiles')
data_quantiles = pd.merge(data, bins, right_index=True, left_index=True)
data_quantiles.dropna(i... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def quantiles(self):\n return self._quantiles",
"def test_profiled_quantiles(self):\n\n # this data has 4 bins, range of 3\n # with equal bin size, each bin has the width of 0.75\n\n data = [\"1.0\", \"2.0\", \"3.0\", \"4.0\"]\n df = pd.Series(data)\n profiler = FloatCol... | [
"0.6870374",
"0.6593091",
"0.6546431",
"0.6466556",
"0.64169776",
"0.6282493",
"0.6277967",
"0.6269792",
"0.6266668",
"0.62217057",
"0.62207866",
"0.61678153",
"0.6154875",
"0.6112417",
"0.6062465",
"0.59961915",
"0.5946187",
"0.59094936",
"0.58980155",
"0.58954215",
"0.58683... | 0.6700071 | 1 |
Formats duration in seconds into hours/minutes/seconds. | def format_duration(seconds: float) -> str:
if seconds < 60:
return f'{seconds:.0f}s'
elif seconds < 3600:
minutes = math.floor(seconds / 60)
seconds -= minutes * 60
return f'{minutes}m{seconds:.0f}s'
else:
hours = math.floor(seconds / 3600)
seconds -= hours * 3600
minutes = math.floor... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def format_seconds(duration):\n\treturn stats_utils.format_seconds(duration)",
"def format_seconds(s):\n return '%dh %dm' % (s//3600, (s//60) % 60)",
"def _format_time(seconds):\n hrs = seconds // 3600\n seconds -= 3600 * hrs\n mins = seconds // 60\n seconds -= 60 * mins\n return '%02dh%0... | [
"0.85217184",
"0.7836833",
"0.7555421",
"0.7504165",
"0.74291956",
"0.73961717",
"0.7374347",
"0.7245979",
"0.7220644",
"0.71687937",
"0.7145608",
"0.7116123",
"0.7102851",
"0.706115",
"0.69954896",
"0.6993543",
"0.6990384",
"0.6982351",
"0.69813305",
"0.6980337",
"0.69369954... | 0.79533637 | 1 |
Returns False if there is no record of this request in the queue. | def request_already_queued(self, request: str):
try:
self.create_request_queue_if_not_exists()
queue = []
db = self.get_db_safely()
cursor = db.cursor()
cursor.execute(
"""SELECT rowid FROM queue WHERE request = ?""",
(r... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __nonzero__(self):\n record = self.db.crawl_queue.find_one(\n {'status': {'$ne': self.COMPLETE}}\n )\n return True if record else False",
"def isEmpty(self):\r\n if (len(self.queue) >= 1):\r\n return False\r\n else:\r\n return True",
"def ... | [
"0.7761254",
"0.7353593",
"0.73497045",
"0.7282266",
"0.72345406",
"0.72313976",
"0.7220145",
"0.7214304",
"0.7213382",
"0.7209384",
"0.72033054",
"0.719638",
"0.71829516",
"0.71829516",
"0.7171092",
"0.7171092",
"0.7138942",
"0.71205044",
"0.7073632",
"0.7073417",
"0.7062273... | 0.7227363 | 6 |
render the shipping index page | def test_basic_render_index_page(self):
url = reverse('shipping.views.index')
response = self.client.get(url)
eq_(response.status_code, 200)
self.assert_all_embeds(response.content) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index(request):\n\n return render(request, 'order/index.html')",
"def index(self):\n\t\treturn render_template('index.html')",
"def index(request):\n return render(request, 'shop/index.html')",
"def index(request):\n return render(request, \"county/index.html\")",
"def index(self):\n re... | [
"0.6734996",
"0.6664564",
"0.6596895",
"0.64984626",
"0.64853853",
"0.6452392",
"0.6431255",
"0.6395023",
"0.63930255",
"0.6363208",
"0.6333068",
"0.6328872",
"0.6289476",
"0.626058",
"0.6256419",
"0.624702",
"0.62385374",
"0.61948824",
"0.61948824",
"0.619028",
"0.6184865",
... | 0.6123476 | 31 |
render the about milestone page and check all static files | def test_about_milestone_static_files(self):
url = reverse('shipping.views.milestone.about',
args=['junk'])
response = self.client.get(url)
eq_(response.status_code, 404)
__, milestone = self._create_appver_milestone()
url = reverse('shipping.views.mileston... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def about():\n return render_template(\"pages/about.html\")",
"def about():\r\n return render_template(\"/home/about.html\")",
"def about():\n\n return render_template('about_page.html', title='About')",
"def about():\n return render_template(\"about.html\")",
"def about():\n return render_t... | [
"0.673524",
"0.66560435",
"0.66424024",
"0.6590649",
"0.6590649",
"0.65828234",
"0.65828234",
"0.65828234",
"0.65828234",
"0.65828234",
"0.65828234",
"0.65828234",
"0.65828234",
"0.65828234",
"0.6553456",
"0.6548892",
"0.65428144",
"0.6536933",
"0.6530543",
"0.65157187",
"0.6... | 0.71152353 | 0 |
Test that l10nchangesets is OK | def test_l10n_changesets(self):
url = reverse('shipping.views.status.l10n_changesets')
url += '?av=fx1.0'
response = self.client.get(url)
eq_(response.status_code, 200)
eq_(response.content, """da l10n da 0003
de l10n de 0002
""") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_l10n_changesets_bad_urls(self):\n url = reverse('shipping.views.status.l10n_changesets')\n # Fail\n response = self.client.get(url, dict(ms=\"\"))\n eq_(response.status_code, 404)\n response = self.client.get(url, dict(av=\"\"))\n eq_(response.status_code, 404)\n\... | [
"0.7990798",
"0.5928953",
"0.5864109",
"0.5853911",
"0.5824027",
"0.5759493",
"0.5725435",
"0.57250375",
"0.5697272",
"0.5695094",
"0.5680913",
"0.56565404",
"0.56111",
"0.56110805",
"0.5611074",
"0.56000656",
"0.5561978",
"0.55356634",
"0.55194396",
"0.5493299",
"0.54834634"... | 0.85174173 | 0 |
Test that the ETag is sent correctly for the signoff() view. | def test_signoff_etag(self):
appver = self.av
locale = Locale.objects.get(code='de')
url = reverse('shipping.views.signoff.signoff',
args=[locale.code, appver.code])
response = self.client.get(url)
eq_(response.status_code, 200)
etag = response.get('... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_request_sign_out_logout_allow_false(self):\n st = ServiceTicketFactory(service='http://example.com')\n with patch('requests.post') as mock:\n mock.return_value.status_code = 500\n st.request_sign_out()\n self.assertEqual(mock.call_count, 0)",
"def test_expi... | [
"0.63734233",
"0.6311133",
"0.6304702",
"0.60959196",
"0.6094256",
"0.6070649",
"0.59782",
"0.59770703",
"0.5951071",
"0.5882903",
"0.5880999",
"0.587797",
"0.58760524",
"0.5840975",
"0.5807254",
"0.58063394",
"0.57902133",
"0.5758098",
"0.57533705",
"0.5744317",
"0.57426274"... | 0.8056692 | 0 |
Define a property to get the current moisture. | def current_moisture(self) -> int:
return int(self.get_state(self.entity_ids['current_moisture'])) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def moisture(self):\n if self.moisture_sensor is None:\n return None\n else:\n return self.moisture_sensor.percent",
"def property_unit(self) -> str:\n if sys.version_info[0] == 2:\n return self.prop_unit\n else:\n return self.prop_unit",
... | [
"0.716615",
"0.6442214",
"0.60769063",
"0.5929878",
"0.591405",
"0.58590025",
"0.58097017",
"0.58088255",
"0.58088255",
"0.57895005",
"0.5760491",
"0.574464",
"0.571247",
"0.5703729",
"0.56826425",
"0.5652912",
"0.5641939",
"0.56413794",
"0.56413794",
"0.56413794",
"0.5641379... | 0.71711445 | 0 |
Return True if the product contains all given attributes | def _does_product_contains_given_attributes(self, product, *attrs):
for attribute in list(attrs[0]):
if not product.get(attribute):
return False
return True | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def has_attributes(self):\n\n pass",
"def _check_attribute_in_list(self, check_attribs, component_attribs):\n getattr = attrgetter('attribute_id')\n for key, group in groupby(component_attribs, getattr):\n if set(check_attribs).intersection([x.id for x in group]):\n ... | [
"0.6555103",
"0.65427995",
"0.6379255",
"0.63788354",
"0.63499427",
"0.63258404",
"0.6317505",
"0.63015825",
"0.6262672",
"0.6135526",
"0.60812986",
"0.607756",
"0.607756",
"0.60741305",
"0.606284",
"0.6059075",
"0.60357183",
"0.6017514",
"0.60081744",
"0.599927",
"0.5997857"... | 0.83780164 | 0 |
Retrieving a nonexistent object results in L{NonexistentObject}. | def test_nonexistentObject(self):
objectId = u'sha256:NOSUCHOBJECT'
d = self.remoteEntropyStore.getObject(objectId)
response = self.agent.responses.pop()
self.assertEqual([], self.agent.responses)
response.code = http.NOT_FOUND
response.respond('Not found')
f = se... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_nonexistentObject(self):\n objectId = u'sha256:NOSUCHOBJECT'\n d = self.contentStore.getObject(objectId)\n return self.assertFailure(d, NonexistentObject\n ).addCallback(lambda e: self.assertEquals(e.objectId, objectId))",
"def _object_get(self, pk):\n try:\n ... | [
"0.7824186",
"0.67373073",
"0.6563881",
"0.65270096",
"0.6480515",
"0.6472633",
"0.64088774",
"0.63989216",
"0.6367677",
"0.6307737",
"0.62628543",
"0.62545633",
"0.62467724",
"0.6230026",
"0.61704266",
"0.6144375",
"0.6132909",
"0.609876",
"0.60891306",
"0.6072646",
"0.60597... | 0.79790324 | 0 |
Retrieving a nonexistent object results in L{NonexistentObject}. | def test_nonexistentObject(self):
objectId = u'sha256:NOSUCHOBJECT'
d = self.contentStore.getObject(objectId)
return self.assertFailure(d, NonexistentObject
).addCallback(lambda e: self.assertEquals(e.objectId, objectId)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_nonexistentObject(self):\n objectId = u'sha256:NOSUCHOBJECT'\n d = self.remoteEntropyStore.getObject(objectId)\n response = self.agent.responses.pop()\n self.assertEqual([], self.agent.responses)\n response.code = http.NOT_FOUND\n response.respond('Not found')\n ... | [
"0.79796344",
"0.6737059",
"0.6564446",
"0.65277773",
"0.648138",
"0.64730996",
"0.6409583",
"0.6399509",
"0.6368211",
"0.6308746",
"0.62631327",
"0.6254307",
"0.6247656",
"0.62296337",
"0.6170459",
"0.61443335",
"0.61339784",
"0.6100137",
"0.60886854",
"0.6072009",
"0.606000... | 0.7825362 | 1 |
L{LocalStoreMigration._nextObject} obtains the next object after the most recently processed object, and flags it for migration. | def test_nextObject(self):
migration = LocalStoreMigration(
store=self.store,
start=0,
current=-1,
end=1000,
source=self.contentStore,
destination=self.contentStore)
obj1 = self._mkObject()
obj2 = self._mkObject()
m1... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_next_object(current_object):\n if current_object.GetDown():\n return current_object.GetDown()\n while not current_object.GetNext() and current_object.GetUp():\n current_object = current_object.GetUp()\n return current_object.GetNext()",
"def next_object(self):\n... | [
"0.6460679",
"0.61260676",
"0.56566924",
"0.56364876",
"0.5634483",
"0.55991524",
"0.5597627",
"0.53920066",
"0.53469473",
"0.5307084",
"0.5303236",
"0.5228546",
"0.5222105",
"0.52044445",
"0.51993746",
"0.51993746",
"0.5168968",
"0.51581377",
"0.5142219",
"0.5108682",
"0.509... | 0.8178091 | 0 |
L{ImmutableObject.getContent} returns the contents of the object. | def test_getContent(self):
self.assertEquals(
self.successResultOf(self.testObject.getContent()), 'somecontent') | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def contents(self):\n if not hasattr(self, \"_content\"):\n self._content = self.get_content()\n return self._content",
"def contents(self):\n return self._contents",
"def get_contents(self):\n return self.contents",
"def getContent(self) -> object:\n ...",
"de... | [
"0.764971",
"0.74619573",
"0.74483526",
"0.7428314",
"0.73426175",
"0.73295903",
"0.73250276",
"0.73224974",
"0.73224974",
"0.73224974",
"0.73224974",
"0.72086394",
"0.71307653",
"0.70915455",
"0.69875276",
"0.69052374",
"0.6876712",
"0.6835042",
"0.6826521",
"0.675867",
"0.6... | 0.5568083 | 94 |
Returns true if both objects are equal | def __eq__(self, other):
if not isinstance(other, MetadataLock):
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.80885184",
"0.80885184",
"0.805514",
"0.7983044",
"0.7966715",
"0.7966715",
"0.7966715",
"0.7966715",
"0.7966715",
"0.7966715",
"0.7966715",
"0.7966715",
"0.7966715",
"0.7966715",
"0.7966715",
"0.7966715",
"0.7966715",
"0.7966715",
"0.7966715",
"0.7966715",
"0.7966715",
... | 0.0 | -1 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.