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 |
|---|---|---|---|---|---|---|
Sets the phone_number_pricing of this Store. | def phone_number_pricing(self, phone_number_pricing):
self._phone_number_pricing = phone_number_pricing | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def service_phone_number_pricing(self, service_phone_number_pricing):\n\n self._service_phone_number_pricing = service_phone_number_pricing",
"def phone(self, new_number):\n self._phone.number = new_number",
"def phone_number(self, phone_number):\n\n self._phone_number = phone_number",
"... | [
"0.79080313",
"0.64964104",
"0.6461968",
"0.6461968",
"0.6461968",
"0.6461968",
"0.62628824",
"0.622854",
"0.6121994",
"0.6088824",
"0.6088824",
"0.6088824",
"0.6088824",
"0.6088824",
"0.5999305",
"0.5826879",
"0.5821042",
"0.5811767",
"0.5808387",
"0.5678309",
"0.5670049",
... | 0.8733235 | 0 |
Sets the service_phone_number of this Store. | def service_phone_number(self, service_phone_number):
self._service_phone_number = service_phone_number | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def service_phone_number_info(self, service_phone_number_info):\n\n self._service_phone_number_info = service_phone_number_info",
"def phone_number(self, phone_number):\n\n self._phone_number = phone_number",
"def phone_number(self, phone_number):\n\n self._phone_number = phone_number",
... | [
"0.7820137",
"0.7071488",
"0.7071488",
"0.7071488",
"0.7071488",
"0.70078856",
"0.6898042",
"0.68619806",
"0.6759033",
"0.67461765",
"0.6647104",
"0.6491894",
"0.64704436",
"0.64704436",
"0.64704436",
"0.64704436",
"0.64704436",
"0.6469103",
"0.63479286",
"0.63307244",
"0.631... | 0.88140893 | 0 |
Sets the service_phone_number_pricing of this Store. | def service_phone_number_pricing(self, service_phone_number_pricing):
self._service_phone_number_pricing = service_phone_number_pricing | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def phone_number_pricing(self, phone_number_pricing):\n\n self._phone_number_pricing = phone_number_pricing",
"def service_phone_number(self, service_phone_number):\n\n self._service_phone_number = service_phone_number",
"def service_phone_number_info(self, service_phone_number_info):\n\n ... | [
"0.79343706",
"0.71878844",
"0.67323524",
"0.5864241",
"0.57315844",
"0.5587445",
"0.5587445",
"0.5587445",
"0.5587445",
"0.5579272",
"0.5556028",
"0.5556028",
"0.5556028",
"0.5556028",
"0.5556028",
"0.5489112",
"0.54566664",
"0.53625447",
"0.53506875",
"0.5248776",
"0.522200... | 0.9037 | 0 |
Sets the prices_available of this Store. | def prices_available(self, prices_available):
self._prices_available = prices_available | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _set_current_prices(self) -> None:\n strategy = cast(Strategy, self.context.strategy)\n eth_price = strategy.contract_status.get(\n \"priceprovider_get_latest_answer\", None\n )\n btc_price = strategy.contract_status.get(\n \"btcpriceprovider_get_latest_answer\... | [
"0.6115864",
"0.5971163",
"0.5955709",
"0.5955709",
"0.58183426",
"0.5795316",
"0.5709332",
"0.56032825",
"0.5595889",
"0.55254847",
"0.55227154",
"0.5509733",
"0.5509733",
"0.5509733",
"0.5509733",
"0.5485871",
"0.5456933",
"0.5430335",
"0.54294103",
"0.5394886",
"0.53327847... | 0.8687549 | 0 |
Sets the branch_code of this Store. | def branch_code(self, branch_code):
if self.local_vars_configuration.client_side_validation and branch_code is None: # noqa: E501
raise ValueError("Invalid value for `branch_code`, must not be `None`") # noqa: E501
self._branch_code = branch_code | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_branch(self, branch):\n if branch in self.valid_branches:\n self.branch = branch\n self.load_settings()\n self.connect()\n else:\n raise Exception('Error BranchConfig: invalid branch')",
"def set_code(self, code):\n self.set_payload(code)",... | [
"0.6565634",
"0.6487027",
"0.6426847",
"0.6409418",
"0.64014286",
"0.63976854",
"0.62861276",
"0.61586654",
"0.610214",
"0.604676",
"0.604676",
"0.604676",
"0.60424787",
"0.6030118",
"0.6030118",
"0.6023767",
"0.6017685",
"0.59746534",
"0.59134763",
"0.5860803",
"0.58199966",... | 0.75153935 | 0 |
Sets the opening_hours of this Store. | def opening_hours(self, opening_hours):
if self.local_vars_configuration.client_side_validation and opening_hours is None: # noqa: E501
raise ValueError("Invalid value for `opening_hours`, must not be `None`") # noqa: E501
self._opening_hours = opening_hours | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def open_hours_detail(self, open_hours_detail):\n\n self._open_hours_detail = open_hours_detail",
"def active_hours(self, active_hours):\n\n self._active_hours = active_hours",
"def engine_hours(self, engine_hours):\n\n self._engine_hours = engine_hours",
"def work_hours_setting(self, wo... | [
"0.69145715",
"0.6860695",
"0.6540604",
"0.6291324",
"0.62881666",
"0.5706674",
"0.55933344",
"0.55737174",
"0.5559406",
"0.526173",
"0.52575135",
"0.5140048",
"0.5135884",
"0.5070859",
"0.5038226",
"0.50103194",
"0.49935085",
"0.49485812",
"0.48191243",
"0.48140562",
"0.4804... | 0.76574177 | 0 |
Sets the service_ids of this Store. | def service_ids(self, service_ids):
self._service_ids = service_ids | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def service_ids(self, service_ids):\n if service_ids is None:\n raise ValueError(\"Invalid value for `service_ids`, must not be `None`\") # noqa: E501\n\n self._service_ids = service_ids",
"def services(self, services):\n\n self._services = services",
"def services(self, servic... | [
"0.7398557",
"0.73052233",
"0.73052233",
"0.64191836",
"0.58573437",
"0.58386797",
"0.5832719",
"0.5779418",
"0.568128",
"0.56212455",
"0.56140524",
"0.5575252",
"0.5566152",
"0.54516506",
"0.54308796",
"0.5335949",
"0.5335846",
"0.5334406",
"0.52696216",
"0.52696216",
"0.526... | 0.86416805 | 0 |
Sets the sort of this Store. | def sort(self, sort):
self._sort = sort | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sort_order(self, sort_order):\n\n self._sort_order = sort_order",
"def sort_order(self, sort_order: int):\n\n self._sort_order = sort_order",
"def set_sort_by(self, sort_by):\n\n\t\tif sort_by is not None and not isinstance(sort_by, str):\n\t\t\traise SDKException(Constants.DATA_TYPE_ERROR, '... | [
"0.69571215",
"0.68901736",
"0.68033177",
"0.6698919",
"0.65493417",
"0.6350672",
"0.62375665",
"0.6142444",
"0.6122563",
"0.6112261",
"0.60965073",
"0.59420824",
"0.5870725",
"0.5870725",
"0.5842678",
"0.5820963",
"0.5820963",
"0.5820963",
"0.5813015",
"0.5766368",
"0.576374... | 0.77771044 | 0 |
Returns true if both objects are equal | def __eq__(self, other):
if not isinstance(other, Store):
return False
return self.to_dict() == other.to_dict() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __eq__(self, other):\n return are_equal(self, other)",
"def __eq__(self, other):\n return are_equal(self, other)",
"def __eq__(self,other):\n try: return self.object==other.object and isinstance(self,type(other))\n except: return False",
"def __eq__(self, other):\n if i... | [
"0.8088132",
"0.8088132",
"0.8054589",
"0.7982687",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
... | 0.0 | -1 |
Returns true if both objects are not equal | def __ne__(self, other):
if not isinstance(other, Store):
return True
return self.to_dict() != other.to_dict() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __ne__(self, other: object) -> bool:\n if self.__eq__(other):\n return False\n return True",
"def __ne__(self, other: object) -> bool:\n return not self.__eq__(other)",
"def __ne__(self, other) -> bool:\n return not self.__eq__(other)",
"def __eq__(self, other):\n ... | [
"0.845611",
"0.8391477",
"0.8144138",
"0.81410587",
"0.8132492",
"0.8093973",
"0.80920255",
"0.80920255",
"0.80920255",
"0.8085325",
"0.8085325",
"0.8076365",
"0.8076365",
"0.8065748",
"0.8042487",
"0.8042487",
"0.8042487",
"0.8042487",
"0.8042487",
"0.8042487",
"0.8042487",
... | 0.0 | -1 |
Set the client to use the given CDB server. | def set_url(self, url):
super(Cabling, self).set_url(url) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set(self, client):\n if not client:\n raise SurvoxAPIMissingParameter('client')\n c = self.get()\n if not c:\n raise SurvoxAPIRuntime('No client available named: {name}'.format(name=self.name))\n return self.api_put(endpoint=self.url, data=client)",
"def set_... | [
"0.6631589",
"0.646762",
"0.6391979",
"0.636166",
"0.63545996",
"0.6334903",
"0.631058",
"0.6278949",
"0.62526304",
"0.6239811",
"0.6113417",
"0.5916698",
"0.59147555",
"0.57825047",
"0.57825047",
"0.57825047",
"0.57825047",
"0.5741593",
"0.57138145",
"0.56967634",
"0.5682859... | 0.0 | -1 |
Get the cabling data of the given device, where the name of the device may be that of a detector, tracker or control. | def get_current_cabling(self, device):
if self._detectors.__contains__(device):
_data = b64decode(self._server.getCurrentDetectorCabling(device))
try:
# check for error or warning tag
parseString(_data, self._status_handler)
except SAXParseExce... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_cabling_for_run(self, device, run_number):\n if self._detectors.__contains__(device):\n _data = b64decode(self._server.getDetectorCablingForRun(device,\n run_number))\n try:\n # check for error or warning tag\n parseString(_d... | [
"0.753622",
"0.66355896",
"0.63484347",
"0.58657396",
"0.5602615",
"0.5570863",
"0.55000764",
"0.54120374",
"0.53885055",
"0.5367642",
"0.53522974",
"0.53098506",
"0.5308231",
"0.5220501",
"0.52190083",
"0.5206942",
"0.5151493",
"0.51508516",
"0.51089805",
"0.50511664",
"0.50... | 0.76995194 | 0 |
Webapp index. Usually there is some sort of frontend, but in this situation it just redirects to the entry point of the api. | def index():
return redirect(api) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index_file():\n return redirect(\"/\")",
"def index():\n return redirect('/client/index.html')",
"def index():\n return render_template('index.html'), 200",
"def index():\n webapp_config = {\n 'cloudmadeApiKey': config.cloudmade_api_key,\n 'peerserverApiKey': config.peerserv... | [
"0.76228476",
"0.7503401",
"0.7473288",
"0.74393874",
"0.73941875",
"0.7315674",
"0.7305279",
"0.7286873",
"0.7253057",
"0.7252178",
"0.72429883",
"0.7229164",
"0.7199329",
"0.71688324",
"0.7162614",
"0.71577847",
"0.7141009",
"0.71409947",
"0.7125979",
"0.7112124",
"0.710505... | 0.7749107 | 0 |
Yield successive nsized chunks from l. | def chunks(l, n):
for i in xrange(0, len(l), n):
yield l[i:i + n] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _chunk(self, l, n):\n for i in range(0, len(l) + 1, n):\n yield l[i:i + n]",
"def chunks(self, l, n):\n for i in range(0, len(l), n):\n yield l[i:i + n]",
"def __chunks(l, n):\n for i in range(0, len(l), n):\n yield l[i:i + n]",
"def get_chunks(self, ... | [
"0.80379355",
"0.79237956",
"0.7922027",
"0.78840584",
"0.7876208",
"0.78144675",
"0.77643776",
"0.77544284",
"0.7743112",
"0.7730491",
"0.772761",
"0.7723601",
"0.7701434",
"0.768797",
"0.768797",
"0.7662925",
"0.765581",
"0.765473",
"0.765473",
"0.76447",
"0.76447",
"0.76... | 0.753264 | 29 |
Given a CSS Selector, returns a list of | def find(self, selector="*", containing=None, clean=False, first=False,
_encoding=None):
# Convert a single containing into a list.
if isinstance(containing, str):
containing = [containing]
if not isinstance(selector, str):
raise TypeError("Expected string, ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def find_css(self, selector):\n return self.page.q(css=self._bounded_selector(selector))",
"def check_and_get_all_elements_by_css_selector(element, selector):\r\n if element is None or not selector:\r\n return [] \r\n try:\r\n return element.find_elements_by_css_selector(selector)\r\n... | [
"0.68455154",
"0.6835461",
"0.6679601",
"0.6401282",
"0.63703287",
"0.6308052",
"0.61474735",
"0.60668296",
"0.59721494",
"0.59596777",
"0.5930772",
"0.5835711",
"0.5799039",
"0.57657826",
"0.5749591",
"0.57232374",
"0.5716415",
"0.5699874",
"0.56996983",
"0.5649377",
"0.5591... | 0.0 | -1 |
Return an instance of the entities_formset to be used in this view. | def get_formset(self, **kwargs):
return self.formsets[kwargs.get('prefix')](
data=self.get_form_kwargs().get('data'),
**kwargs
) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_formset(self):\n result = generic_inlineformset_factory(\n self.inline_model, **self.get_factory_kwargs()\n )\n return result",
"def get_formset(self, formset_class=None):\n if formset_class is None:\n formset_class = self.get_formset_class()\n ret... | [
"0.74026084",
"0.7009821",
"0.68364877",
"0.64746934",
"0.6465371",
"0.6199206",
"0.58847594",
"0.58716524",
"0.58716524",
"0.57619286",
"0.57592374",
"0.57577556",
"0.5747448",
"0.5733139",
"0.568956",
"0.5620146",
"0.5617594",
"0.55587995",
"0.55534655",
"0.5549762",
"0.552... | 0.68768185 | 2 |
Reorder the given output_types to follow a priority list. Outputs not in the priority list should remain in their given order at the end of the list. | def sort_output_by_priority_list(self, output_types):
# construct temporary id_priority_list with extra elements at the end
id_priority_list = self._expand_priority_order(output_types)
output_types = sorted(output_types, key=lambda e: self._priority_order(id_priority_list, e))
return out... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sort_input_by_priority_list(self, input_types):\n # construct temporary id_priority_list with extra elements at the end\n id_priority_list = self._expand_priority_order([x[0] for x in input_types])\n input_types = sorted(input_types, key=lambda e: self._priority_order(id_priority_list, e[0... | [
"0.6734957",
"0.64006",
"0.6323225",
"0.57136774",
"0.5675696",
"0.5578375",
"0.5552074",
"0.53853726",
"0.534626",
"0.53175974",
"0.5188115",
"0.5148496",
"0.51468277",
"0.51179534",
"0.5094872",
"0.5086676",
"0.5062091",
"0.5058068",
"0.5050483",
"0.504642",
"0.50458914",
... | 0.84835756 | 0 |
reset anything that's not picklable (so self can be pickled) return what's been reset as a dict, so self can be restored once pickled | def unprepare(self):
state = {
"logger": self._state["logger"],
}
for k in state:
self._state[k] = None
self.prepared = False
return state | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __getstate__(self) -> dict:\n self_dict = self.__dict__.copy()\n # we remove large objects from `__getstate__` to allow\n # pickling for `multiprocessing.Pool` workers without\n # high memory overhead\n del self_dict['adata']\n del self_dict['vadata']\n return s... | [
"0.75669354",
"0.739425",
"0.7226292",
"0.7182967",
"0.7066286",
"0.70608354",
"0.70602226",
"0.7017465",
"0.6888188",
"0.6854912",
"0.6831917",
"0.6831917",
"0.67894113",
"0.67202336",
"0.6670671",
"0.66563386",
"0.6643736",
"0.6633016",
"0.6632024",
"0.66186714",
"0.6574641... | 0.61522037 | 52 |
Get a list of all crafting recipes for a certain discipline. | def getRecipesOfDiscipline(disciplineId, allPages = False):
return Gw2Spidy._paginatedRequest(allPages, 'recipes', str(disciplineId)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def recipes():\n # pylint: disable=redefined-outer-name\n recipes = list(mongo.db.recipes.find().sort('_id', -1))\n return render_template(\n \"recipes.html\", page_title=\"All Recipes\", recipes=recipes)",
"def GetRecipes(self) -> List[Recipe]:\n return sorted(self._recipes.values(), key=lamb... | [
"0.6487927",
"0.6397761",
"0.63729787",
"0.625598",
"0.6198711",
"0.61692214",
"0.6060824",
"0.5997523",
"0.5990287",
"0.5865964",
"0.5768593",
"0.57569087",
"0.56551194",
"0.56281215",
"0.5564877",
"0.55318457",
"0.5526318",
"0.55114657",
"0.54900837",
"0.54453087",
"0.54224... | 0.7067415 | 0 |
Fully sorts the list of BaseObject using the order. | def full_sort(objects: list or tuple) -> list:
# This is inefficient. It should instead use a key
# in the order sort, but that would be even more complications to that
# already complex algorithm.
object_order_map = {}
orders = []
for obj in objects:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sort(self, *args: Any, **kwargs: Any) -> BaseList:\n super().sort(*args, **kwargs)\n return self",
"def sort(self, objects, reverse=True):\n return sorted(objects,\n key=lambda objlink: objlink[self],\n reverse=reverse)",
"def reorder( self ):\... | [
"0.7014703",
"0.6914333",
"0.6780917",
"0.6779156",
"0.67371154",
"0.6678687",
"0.655817",
"0.6545352",
"0.6515866",
"0.6506865",
"0.6470116",
"0.6451872",
"0.6393008",
"0.6391143",
"0.6315959",
"0.6293385",
"0.62835443",
"0.62188715",
"0.62186736",
"0.6208466",
"0.62011987",... | 0.6814812 | 2 |
Returns the most appropriate SqlString instance, starting with the first platform value. | def get_for_platform(
self, platforms: str or list or tuple) -> None or SqlString:
if isinstance(platforms, str):
platforms = [platforms]
for plat in platforms:
plat = plat.strip().lower()
for sql in self.__sql_set:
assert isinstan... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_sequencing_platform(self):\n platform = self.data[\"platform\"]\n if platform == \"miseq\":\n platform = \"MiSeq\"\n elif platform == \"hiseq4000\":\n platform == \"HiSeq4000\"\n elif platform == \"hiseq2000\":\n platform == \"HiSeq2000\"\n else:\n raise... | [
"0.551231",
"0.5330433",
"0.5330433",
"0.5060567",
"0.50455624",
"0.4967626",
"0.49599984",
"0.49288383",
"0.4928459",
"0.48998073",
"0.4886638",
"0.48826876",
"0.48699632",
"0.48584884",
"0.4857254",
"0.48349535",
"0.48274267",
"0.48193818",
"0.4810762",
"0.48067117",
"0.480... | 0.75149673 | 0 |
Set the network ID and Account ID. | def get_ids(self):
all_networks = []
network_dict = {}
for network, status in self.networks.items():
if status["onboarded"]:
all_networks.append("{}".format(network))
network_dict[status["name"]] = network
self.network_ids = all_networks
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_network_id(self, sNetworkId):\n\t\tcall_sdk_function('PrlVirtNet_SetNetworkId', self.handle, sNetworkId)",
"def network_ids(self, network_ids):\n\n self._network_ids = network_ids",
"def account_id(self, account_id):\n self._account_id = account_id",
"def setAccount(self, account_id):\n... | [
"0.6771072",
"0.64310205",
"0.6238921",
"0.6226129",
"0.6090938",
"0.6090938",
"0.6090938",
"0.6090938",
"0.6090938",
"0.6090938",
"0.5747805",
"0.5705396",
"0.5677051",
"0.56546664",
"0.5598037",
"0.5597561",
"0.55696416",
"0.553996",
"0.5513392",
"0.53865325",
"0.53791785",... | 0.0 | -1 |
Removes the current action noise from the model parameters. | def _remove_noise(self, *, tf_sess=None):
# Make sure we only remove noise iff currently noisy.
assert self.weights_are_currently_noisy is True
# Removes the stored noise from the model's parameters.
if self.framework == "tf":
tf_sess.run(self.tf_remove_noise_op)
eli... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def reset_noise(self):\n self.advantage_hidden_layer.reset_noise()\n self.advantage_layer.reset_noise()\n self.value_hidden_layer.reset_noise()\n self.value_layer.reset_noise()",
"def _tf_remove_noise_op(self):\n remove_noise_ops = list()\n for var, noise in zip(self.mod... | [
"0.63060975",
"0.6300119",
"0.60341734",
"0.6013809",
"0.59907615",
"0.59617525",
"0.59610003",
"0.59363043",
"0.5923741",
"0.58529073",
"0.5825014",
"0.5820904",
"0.5767701",
"0.5767701",
"0.5761218",
"0.5752928",
"0.57315606",
"0.5706779",
"0.56984687",
"0.56791276",
"0.567... | 0.66403574 | 0 |
Return the sum of the first n positive integer numbers. | def integer_sum(n):
sum = 0
k = 0
# INVARIANT
# The sum of far is equal to the sum of the first k integer numbers
# VARIANT: n-k
#
while (k!=n):
k += 1
sum += k
return sum | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sum_of_nth( n ):\n if n > 0:\n return sum( range(n + 1) )\n else:\n return 0",
"def sum_to_n(n):\n total = 0\n for i in range(1,n+1):\n total += i\n return total",
"def sum_to(n):\n the_sum = 0\n for counter in range(n+1):\n the_sum = the_sum + counter\n ... | [
"0.8215",
"0.76410437",
"0.7622653",
"0.76161855",
"0.757394",
"0.75360984",
"0.75360984",
"0.75297254",
"0.74707264",
"0.7282134",
"0.7234292",
"0.7179291",
"0.710554",
"0.70555204",
"0.70266354",
"0.6928122",
"0.6913925",
"0.6838018",
"0.67928416",
"0.675572",
"0.67517275",... | 0.8239469 | 0 |
Pushback by adding `nan_penalty counter` to the loss if NaNs are encountered. The counter indicates how many NaNs occurred in a row. The `nan_tol` is the upper limit, if this is exceeded, the fallback will be used and an error is raised. | def __init__(self):
super().__init__()
self.nan_penalty = nan_penalty
self.nan_tol = nan_tol | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _check_loss(self, loss):\n assert not np.isnan(loss), \"Model diverged with loss = NaN\"",
"def test_nan_error(value, nan_strategy, metric_class):\n metric = metric_class(nan_strategy=nan_strategy)\n if nan_strategy == \"error\":\n with pytest.raises(RuntimeError, match=\"Encounted `nan` valu... | [
"0.53255713",
"0.5226478",
"0.5111115",
"0.5092862",
"0.50347966",
"0.4992838",
"0.4911034",
"0.48967505",
"0.4838115",
"0.4818837",
"0.4810354",
"0.47796974",
"0.47704932",
"0.4752005",
"0.47484547",
"0.47250772",
"0.47181588",
"0.46850392",
"0.468471",
"0.46741626",
"0.4671... | 0.46229216 | 23 |
Call in a loop to create terminal progress bar. | def print_progress(iteration, total, prefix='', suffix='', decimals=1,
bar_length=100):
str_format = "{0:." + str(decimals) + "f}"
percents = str_format.format(100 * (iteration / float(total)))
filled_length = int(round(bar_length * iteration / float(total)))
bar = '█' * filled_length... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def make_progress_bar():\n\n if simple_tregex_mode:\n total_files = len(list(to_iterate_over.keys()))\n else:\n total_files = sum(len(x) for x in list(to_iterate_over.values()))\n\n par_args = {'printstatus': kwargs.get('printstatus', True),\n 'root': r... | [
"0.7299165",
"0.72116065",
"0.7122496",
"0.7044806",
"0.6896543",
"0.68882",
"0.688792",
"0.68711996",
"0.6839908",
"0.68034154",
"0.6790898",
"0.6774684",
"0.6774684",
"0.6774684",
"0.6772978",
"0.6770157",
"0.67698246",
"0.67698246",
"0.6769703",
"0.6759599",
"0.6755461",
... | 0.64412314 | 84 |
Returns the first_name plus the last_name, with a space in between. | def get_full_name(self):
full_name = '%s %s' % (self.first_name, self.last_name)
return full_name.strip() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def full_name(first_name, last_name):\n return first_name + \" \" + last_name",
"def full_name(first_name, last_name):\n\t\n\treturn first_name + \" \" + last_name",
"def get_formated_name(first_name,last_name):\n\tfull_name = first_name + '' + last_name\n\treturn full_name.title()",
"def get_full_name(se... | [
"0.8313066",
"0.82006806",
"0.8049215",
"0.80409706",
"0.8017754",
"0.7999701",
"0.79541886",
"0.7942144",
"0.7942144",
"0.7942144",
"0.7937664",
"0.79287225",
"0.7921711",
"0.790314",
"0.7892264",
"0.7890117",
"0.7878668",
"0.786143",
"0.78528684",
"0.7823523",
"0.7813124",
... | 0.77466476 | 55 |
Returns the short name for the user. | def get_short_name(self):
return self.first_name | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_short_name(self):\n return self.username",
"def get_short_name(self):\n return self.username",
"def get_short_name(self):\n return self.username",
"def get_short_name(self):\n # The user is identified by their email address\n return self.first_name",
"def get_shor... | [
"0.90316343",
"0.90316343",
"0.90316343",
"0.8829965",
"0.88074076",
"0.8665172",
"0.8423785",
"0.8335693",
"0.8307673",
"0.8281205",
"0.8281205",
"0.81919736",
"0.8174178",
"0.8150322",
"0.81289876",
"0.80974096",
"0.80956835",
"0.8077189",
"0.79694206",
"0.79643494",
"0.796... | 0.81823653 | 29 |
Returns all ContentNodes with a given title. If limit_to_children_of is passed in with an id, only look at all the children of the node with that id. | def get_nodes_with_title(cls, title, limit_to_children_of=None):
if limit_to_children_of:
root = cls.objects.get(id=limit_to_children_of)
return root.get_descendants().filter(title=title)
return cls.objects.filter(title=title) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_children(self, cont: typing.Union[str, Type(None)]) -> List[str]:\n s = requests.Session()\n\n url = \"https://en.wikipedia.org/w/api.php\"\n\n if cont is None:\n params = {\n \"action\": \"query\",\n \"format\": \"json\",\n \"tit... | [
"0.55674",
"0.5446906",
"0.535895",
"0.5233405",
"0.51123166",
"0.5035905",
"0.49463487",
"0.48584762",
"0.48395738",
"0.48239738",
"0.48170954",
"0.47682205",
"0.47341162",
"0.4734011",
"0.47298878",
"0.47263026",
"0.47163272",
"0.47061732",
"0.46964613",
"0.46819907",
"0.46... | 0.83708715 | 0 |
Guess the format preset of a filename based on its extension. Return None if format is unknown. | def guess_format_preset(cls, filename):
_, ext = os.path.splitext(filename)
ext = ext.lstrip(".")
f = FormatPreset.objects.filter(
allowed_formats__extension=ext,
display=True
)
return f.first() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def guess_import_format(fname):\n\n if fname is None:\n return None, None, None, None\n\n extension = _get_extension(fname)\n\n content_encoding = _COMPRESSION_EXTENSIONS.get(extension)\n if content_encoding:\n # remove encoding extension\n extension = _get_extension(fname[: -len(e... | [
"0.7008831",
"0.69953173",
"0.69654244",
"0.69263697",
"0.69063085",
"0.6849442",
"0.6782588",
"0.6754293",
"0.6536065",
"0.65108657",
"0.64346766",
"0.6425744",
"0.6373442",
"0.635483",
"0.6319639",
"0.63065046",
"0.62809694",
"0.62068266",
"0.62009776",
"0.6200357",
"0.6179... | 0.8202259 | 0 |
Returns just the filename of the File in storage, without the path e.g. abcd.mp4 | def filename(self):
# TODO(aron): write tests for this
return os.path.basename(self.file_on_disk.name) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_file_name(self):\n return self.upload.name[6:]",
"def get_file_name(self):\n return self.path.name[6:]",
"def get_file_name(self):\n return str(self.get_file())",
"def GetFileName(self):\n return self.file.GetPath()",
"def filename(self):\n filename, ext = os.path... | [
"0.7897664",
"0.78294456",
"0.78021795",
"0.7598705",
"0.759789",
"0.75643426",
"0.75611573",
"0.7555759",
"0.7548238",
"0.7544818",
"0.75343204",
"0.7531525",
"0.7519726",
"0.741577",
"0.73988396",
"0.73988396",
"0.73988396",
"0.73988396",
"0.73988396",
"0.73979855",
"0.7375... | 0.7927493 | 0 |
Softmax function for calculating probs | def softmax(self, vector):
e = np.exp(vector)
return e / e.sum() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def softmax(x):\n shape = x.shape\n probs = np.exp(x - np.max(x, axis=len(shape) - 1, keepdims=True))\n probs /= np.sum(probs, axis=len(shape) - 1, keepdims=True)\n return probs",
"def softmax(x): \n e_x = np.exp(x - np.max(x)) \n return e_x / e_x.sum()",
"def softmax(self, x):\n\n ... | [
"0.7678157",
"0.75637853",
"0.753009",
"0.75030094",
"0.74464166",
"0.7392737",
"0.7392737",
"0.7381216",
"0.7367793",
"0.73659134",
"0.73595214",
"0.7358937",
"0.7357344",
"0.7342529",
"0.73401207",
"0.7334206",
"0.7334206",
"0.7334206",
"0.7334206",
"0.7334206",
"0.7334206"... | 0.0 | -1 |
Test that an invalid path is caught. | async def test_not_valid_path_to_file(
hass: HomeAssistant, mock_config_entry: MockConfigEntry, tmpdir: str
) -> None:
testfile = f"{tmpdir}/file.txt"
create_file(testfile)
mock_config_entry.add_to_hass(hass)
hass.config_entries.async_update_entry(
mock_config_entry, unique_id=testfile, data... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_invalid_path(self):\n self.assertRaises(argparse.ArgumentTypeError, generic.check_path, 'foo')",
"def testInvalidPath(self):\n status, _ = self._http_get(\"invalid_path\")\n self.assertEqual(status, 404)",
"def test_invalid_pathname(self):\n self.assertFalse(Util.is_pathnam... | [
"0.7887697",
"0.787368",
"0.77576834",
"0.7717277",
"0.75813943",
"0.74828064",
"0.73831767",
"0.7146349",
"0.71179664",
"0.7113548",
"0.7057058",
"0.7044721",
"0.70115405",
"0.6999978",
"0.6994406",
"0.6988903",
"0.6984361",
"0.6937069",
"0.6926365",
"0.6916585",
"0.6902701"... | 0.0 | -1 |
Returns a 2D gaussian | def Gauss2D(self, x, center_x, width_x, y, center_y, width_y, height=1.0):
g = math.exp(-0.5*((center_x-x)/width_x)**2)/(width_x*(2.0*math.pi)**0.5)
g *= math.exp(-0.5*((center_y-y)/width_y)**2)/(width_y*(2.0*math.pi)**0.5)
g *= height
return g | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def gaussian2d(x, y, A, sigma, x0):\n Z = A * np.exp(-( (x-x0[0])**2/(2*sigma[0]**2) + (y-x0[1])**2/(2*sigma[1]**2)))\n return Z",
"def gaussian2d(p, x, y):\n #2010-06-08 20:00 IJC: Created\n #2013-04-19 23:49 IJMC: Improved documentation, per BACM's request.\n \n x = array(x, dtype=float).copy... | [
"0.75674754",
"0.7446976",
"0.7155485",
"0.70988643",
"0.7048536",
"0.70217466",
"0.7003431",
"0.69757545",
"0.69757545",
"0.69757545",
"0.6975442",
"0.6952584",
"0.6920643",
"0.6888029",
"0.6846848",
"0.68100595",
"0.680608",
"0.6785135",
"0.6785122",
"0.67649186",
"0.675724... | 0.6720941 | 25 |
Returns the theme named name. Paramters | def theme_named(self, name):
for theme in self.themes:
if theme.get('name', 'Error') == name:
return theme | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_theme(self) -> str:\n return self.theme or self.account.theme",
"def theme_name(context):\n return {'THEME_NAME': settings.THEME_NAME}",
"def _get_theme_selected():\n\n try:\n theme_selected = Configuration.objects.filter(group='theme', key='selected')[0]\n theme_name = theme... | [
"0.7531055",
"0.74231696",
"0.73877615",
"0.7128187",
"0.6642205",
"0.6520001",
"0.63895035",
"0.6328346",
"0.62944263",
"0.62397254",
"0.61943275",
"0.61603075",
"0.61520386",
"0.60468477",
"0.604257",
"0.603625",
"0.5970078",
"0.59646434",
"0.58963805",
"0.58963805",
"0.588... | 0.7830729 | 0 |
Computes the distance between two points on earth's surface. | def distance(lat1, lon1, lat2, lon2):
radius = 6373 * 1000
dlon = lon2 - lon1
dlat = lat2 - lat1
a = (math.sin(dlat/2))**2 + math.cos(lat1) * math.cos(lat2) * (math.sin(dlon/2))**2
c = 2 * math.atan2(math.sqrt(a), math.sqrt(1-a))
return radius * c | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def calculateDistanceBetweenPoints(lat1,lon1,lat2,lon2):\n\treturn Geodesic.WGS84.Inverse(lat1,lon1, lat2, lon2)['s12']",
"def distance(a: Point, b: Point) -> float:\n return math.sqrt(math.pow(b.x - a.x, 2) + math.pow(b.y - a.y, 2))",
"def distance(self, coord1, coord2):\n return (abs(coord1.x - coord2.... | [
"0.7398577",
"0.7237703",
"0.7233497",
"0.7100475",
"0.7095771",
"0.7091933",
"0.70801365",
"0.704452",
"0.7009048",
"0.699421",
"0.6993189",
"0.6991743",
"0.6981052",
"0.69774145",
"0.697303",
"0.6972347",
"0.6969145",
"0.69657177",
"0.6957273",
"0.6936054",
"0.69321656",
... | 0.0 | -1 |
Compute a gradient clipping coefficient based on gradient norm. | def clip_gradient(model, clip):
totalnorm = 0
for p in model.parameters():
modulenorm = p.grad.data.norm()
totalnorm += modulenorm ** 2
totalnorm = math.sqrt(totalnorm)
return min(1, clip / (totalnorm + 1e-6)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def clip_gradient(parameters, clip):\n totalnorm = 0\n for p in parameters:\n modulenorm = p.grad.data.norm()\n totalnorm += modulenorm ** 2\n totalnorm = math.sqrt(totalnorm)\n return min(1, clip / (totalnorm + 1e-6))",
"def clip_gradient(model, clip_norm):\n totalnorm = 0\n for ... | [
"0.8147986",
"0.7765412",
"0.7751863",
"0.76277953",
"0.695568",
"0.69115525",
"0.6853288",
"0.6753333",
"0.65958244",
"0.6575392",
"0.64888096",
"0.64880824",
"0.64880824",
"0.64880824",
"0.64880824",
"0.64880824",
"0.6483369",
"0.64782876",
"0.64637333",
"0.6421132",
"0.641... | 0.77999336 | 1 |
Get the front element. | def peek(self):
if self.output_stack == []:
while self.input_stack != []:
self.output_stack.append(self.input_stack.pop())
return self.output_stack[-1] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getFront(self):\n\t\tfront = self.queue[self.front]\n\t\treturn front\n\t\tpass",
"def getFront(self):\n if not self.isEmpty():\n return self._data[0]\n else:\n return -1",
"def front(self):\n return self.queue[0] if not self.empty() else None",
"def peek_front(... | [
"0.82009244",
"0.79261875",
"0.7852642",
"0.7791182",
"0.77886623",
"0.75723046",
"0.752337",
"0.7510604",
"0.7478953",
"0.7379256",
"0.7379256",
"0.734284",
"0.7323573",
"0.7320296",
"0.7291721",
"0.72772557",
"0.7269801",
"0.72657627",
"0.7253295",
"0.72355044",
"0.72213495... | 0.0 | -1 |
Returns whether the queue is empty. | def empty(self):
return self.input_stack == [] and self.output_stack == [] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_empty(self):\n return len(self.the_queue) == 0",
"def is_empty(self):\n return len(self.__queue) > 0",
"def is_empty(self):\n return len(self.queue) == 0",
"def is_empty(self):\n return len(self.queue) == 0",
"def is_empty(self):\n return self.queue == []",
"def ... | [
"0.9270249",
"0.92506766",
"0.923635",
"0.923635",
"0.9155843",
"0.9098441",
"0.9095006",
"0.90922606",
"0.90731245",
"0.9053733",
"0.89205354",
"0.89137155",
"0.8877591",
"0.88436323",
"0.88436323",
"0.8835949",
"0.88038146",
"0.8758203",
"0.87577534",
"0.87310195",
"0.86462... | 0.0 | -1 |
Get the front element. | def peek(self):
tmp = []
peek = None
for i in range(len(self.stack)):
peek = self.stack.pop()
tmp.append(peek)
while tmp != []:
self.stack.append(tmp.pop())
return peek | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getFront(self):\n\t\tfront = self.queue[self.front]\n\t\treturn front\n\t\tpass",
"def getFront(self):\n if not self.isEmpty():\n return self._data[0]\n else:\n return -1",
"def front(self):\n return self.queue[0] if not self.empty() else None",
"def peek_front(... | [
"0.82009244",
"0.79261875",
"0.7852642",
"0.7791182",
"0.77886623",
"0.75723046",
"0.752337",
"0.7510604",
"0.7478953",
"0.7379256",
"0.7379256",
"0.734284",
"0.7323573",
"0.7320296",
"0.7291721",
"0.72772557",
"0.7269801",
"0.72657627",
"0.7253295",
"0.72355044",
"0.72213495... | 0.0 | -1 |
Returns whether the queue is empty. | def empty(self):
return self.stack == [] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_empty(self):\n return len(self.the_queue) == 0",
"def is_empty(self):\n return len(self.__queue) > 0",
"def is_empty(self):\n return len(self.queue) == 0",
"def is_empty(self):\n return len(self.queue) == 0",
"def is_empty(self):\n return self.queue == []",
"def ... | [
"0.9270249",
"0.92506766",
"0.923635",
"0.923635",
"0.9155843",
"0.9098441",
"0.9095006",
"0.90922606",
"0.90731245",
"0.9053733",
"0.89205354",
"0.89137155",
"0.8877591",
"0.88436323",
"0.88436323",
"0.8835949",
"0.88038146",
"0.8758203",
"0.87577534",
"0.87310195",
"0.86462... | 0.0 | -1 |
Indicates the type of statement that the instance is. Supported types are select, insert, and update. This must be set before using any of the object methods. | def type(self, kind):
self.type = kind | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sql_type(self) -> pulumi.Input[str]:\n return pulumi.get(self, \"sql_type\")",
"def sql_type(self) -> pulumi.Input[str]:\n return pulumi.get(self, \"sql_type\")",
"def Statement(self, default=None):\n return self.data.get('statement', default)",
"def command_type(self):\n ... | [
"0.69687235",
"0.69687235",
"0.57876784",
"0.5693271",
"0.558173",
"0.54941505",
"0.54941505",
"0.54941505",
"0.54867357",
"0.5484348",
"0.54608864",
"0.54608864",
"0.54608864",
"0.54608864",
"0.54608864",
"0.54608864",
"0.54608864",
"0.54608864",
"0.54608864",
"0.54608864",
... | 0.0 | -1 |
Returns the expected area of a worm in pixels^2 | def expectedWormAreaPixels(self):
return (self.expectedWormLengthPixels() *
self.expectedWormWidthPixels()) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def expectedWormLengthPixels(self):\n return self.expectedWormLength * self.pixelSize",
"def expectedWormWidthPixels(self):\n return self.expectedWormWidth * self.pixelSize",
"def area(self):\n return (self.baselength1 + self.baselength2)*self.height/2",
"def calculatearea(self):\r\n ... | [
"0.7789178",
"0.7446952",
"0.7030117",
"0.69242394",
"0.6878883",
"0.6873281",
"0.6855485",
"0.68246317",
"0.68091375",
"0.6784426",
"0.67748386",
"0.6773014",
"0.6773014",
"0.6773014",
"0.6769887",
"0.6769031",
"0.67459565",
"0.6729685",
"0.6729039",
"0.6729039",
"0.67229944... | 0.8538401 | 0 |
Produces the transformation matrix and the new size for perspective correction | def perspective_transform(contour):
ord_rect = np.float32(order_rect(contour))
(tl, tr, br, bl) = ord_rect
dist_top = np.linalg.norm(tl - tr)
dist_btm = np.linalg.norm(bl - br)
width = max(dist_btm, dist_top)
dist_left = np.linalg.norm(tl - tr)
dist_right = np.linalg.norm(tr - br)
heig... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def perspective_transform():\n src = np.float32([(220,720), (1110, 720), (570, 470), (722, 470)]) # Manually get these numbers from plot\n dst = np.float32([[320, 720], [920, 720], [320, 1], [920, 1]])\n M = cv2.getPerspectiveTransform(src, dst)\n Minv = cv2.getPerspectiveTransform(dst, src)\n\n re... | [
"0.66771966",
"0.6413336",
"0.6392161",
"0.6353669",
"0.6295414",
"0.6256901",
"0.6221276",
"0.62170833",
"0.6191965",
"0.61582214",
"0.613678",
"0.6067957",
"0.60373855",
"0.6029961",
"0.6024358",
"0.60105026",
"0.59512514",
"0.59417385",
"0.5923743",
"0.58586514",
"0.581540... | 0.5157981 | 91 |
Test inserting a node to the Linked List giving the previous node | def test_insert_node(self):
myObj = DLinkedList()
myObj.append(120)
myObj.append(100)
self.assertEqual(myObj.insert_node(Node(1000), myObj.head), [120, 1000, 100]) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def insert_before(self, node_to_insert_before, data):\n node = Node(data)\n temp = self.head\n if temp.data == node_to_insert_before:\n node.next = temp\n self.head = node\n return\n while temp.next:\n if temp.next.data == node_to_insert_befor... | [
"0.74702317",
"0.7184721",
"0.7094345",
"0.70133436",
"0.7007992",
"0.6974795",
"0.69396466",
"0.68387306",
"0.68332654",
"0.6786207",
"0.67856693",
"0.6727739",
"0.67205656",
"0.6713528",
"0.6602797",
"0.6596794",
"0.65670156",
"0.6550578",
"0.6544441",
"0.65386456",
"0.6537... | 0.64041084 | 28 |
Method for finding the nearest point on a straight infinite line form by two nodes from a point. This cannot guarantee the output point is on the line created by the two nodes. | def findNearPointOnLine(node1, node2, point):
p=point[0]
q=point[1]
a=node1[0]
b=node1[1]
c=node2[0]
d=node2[1]
x = ((a-p)*(d-b) + (q-b)*(c-a)) / ((d-b)**2+(c-a)**2) * (d-b) + p
y = ((a-p)*(d-b) + (q-b)*(c-a)) / ((d-b)**2+(c-a)**2) * (a-c) + q
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _nearest_point_on_line(begin, end, point):\n b2e = _vec_sub(end, begin)\n b2p = _vec_sub(point, begin)\n nom = _vec_dot(b2p, b2e)\n denom = _vec_dot(b2e, b2e)\n if denom == 0.0:\n return begin\n u = nom / denom\n if u <= 0.0:\n return begin\n elif u >= 1.0:\n return... | [
"0.77361304",
"0.70569193",
"0.7019063",
"0.69980234",
"0.6875616",
"0.6832375",
"0.67795867",
"0.66944176",
"0.66812617",
"0.6653641",
"0.65695083",
"0.6550996",
"0.6511778",
"0.643356",
"0.64276004",
"0.6389354",
"0.6371056",
"0.63599604",
"0.6348785",
"0.6342428",
"0.62946... | 0.75606936 | 1 |
Returns all superclasses of a given class. Omits root 'object' superclass. | def get_all_superclasses(cls):
classes = []
for superclass in cls.__bases__:
for c in get_all_superclasses(superclass):
if c is not object and c not in classes:
classes.append(c)
for superclass in cls.__bases__:
if superclass is not object and superclass not in classes:
classes.append(... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_superclasses(self, t):\n if isinstance(t, pytd.ClassType):\n return sum((self.get_superclasses(c) for c in t.cls.bases), [t])\n elif isinstance(t, pytd.AnythingType):\n # All types, even \"?\", inherit from object.\n return [pytd.NamedType(\"builtins.object\")]\n elif isinstance(t, ... | [
"0.8128446",
"0.7904593",
"0.76706064",
"0.7356925",
"0.7299216",
"0.7298937",
"0.7248306",
"0.7214031",
"0.72014976",
"0.71969557",
"0.71818876",
"0.70861506",
"0.70846164",
"0.70526284",
"0.6906375",
"0.6894315",
"0.6840234",
"0.6840234",
"0.6828879",
"0.68240535",
"0.67702... | 0.83050585 | 0 |
Get absolute path to resource, works for dev and for PyInstaller | def resource_path(relative_path):
try:
# PyInstaller creates a temp folder and stores path in _MEIPASS
base_path = sys._MEIPASS
except Exception:
base_path = os.path.abspath(".")
return os.path.join(base_path, relative_path)
# """ Get absolute path to resource, works for dev and fo... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_resource_path():\n return os.path.join(os.path.dirname(__file__), \"resources\") + os.path.sep",
"def resourcePath(relative):\r\n try:\r\n # PyInstaller creates a temp folder and stores path in _MEIPASS\r\n base_path = sys._MEIPASS\r\n except Exception:\r\n base_path = os.pa... | [
"0.83695436",
"0.8280479",
"0.82485795",
"0.8139178",
"0.80985415",
"0.80940944",
"0.80797124",
"0.80677074",
"0.80673695",
"0.8062465",
"0.8062465",
"0.8062465",
"0.8062465",
"0.8062465",
"0.8062465",
"0.8062465",
"0.80569947",
"0.80545217",
"0.80448323",
"0.80448323",
"0.80... | 0.8114118 | 4 |
Mutating a chromosome in N genes , at index 0 chromosome itself, at index 1 the makespan | def mutate(chromosome:list):
# how_many_to_mutate = randint(0,len(chromosome[0]))
t = [i for i in range(len(chromosome[0]))]
# how_many_to_mutate = randint(1,5)
# 3 this is the maximum indices to mutate
indices_to_mutate = choice(t, 3, replace=False)
# now needs to simulate as if the whole chr... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def chromosome_mutation(chromosome: str, nurses_number: int = 10):\n\n # The number of genes in the chromosome is generated\n genes = 21 * nurses_number\n\n # Random index to mutate\n index = randrange(0, genes)\n\n # New Chromosome to be returned\n new_chromosome = chromosome[:index]\n\n # Co... | [
"0.6779124",
"0.66622233",
"0.6610554",
"0.65017587",
"0.61599565",
"0.6133932",
"0.60566163",
"0.60434973",
"0.60009",
"0.6000775",
"0.5925693",
"0.5876229",
"0.5836937",
"0.58198845",
"0.5807447",
"0.57886285",
"0.5725932",
"0.5703654",
"0.56643486",
"0.5639894",
"0.56093",... | 0.6633287 | 2 |
Sanitizes a string so it could be used as part of a filename. If restricted is set, use a stricter subset of allowed characters. Set is_id if this is not an arbitrary string, but an ID that should be kept if possible. | def sanitize_filename(s, restricted=False, is_id=False):
def replace_insane(char):
if restricted and char in ACCENT_CHARS:
return ACCENT_CHARS[char]
if char == '?' or ord(char) < 32 or ord(char) == 127:
return ''
elif char == '"':
return '' if restricted e... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sanitize(s, strict=True):\n allowed = ''.join(\n [\n 'ABCDEFGHIJKLMNOPQRSTUVWXYZ',\n 'abcdefghijklmnopqrstuvwxyz',\n '0123456789',\n ]\n )\n\n if not strict:\n allowed += '-_.'\n\n s = str(s).replace(' ', '_')\n\n return ''.join([i for i in s... | [
"0.6425492",
"0.6252466",
"0.61610687",
"0.61091113",
"0.60681653",
"0.60572934",
"0.59674186",
"0.59613883",
"0.5878622",
"0.5859218",
"0.5815915",
"0.58132446",
"0.58079904",
"0.5792112",
"0.5777289",
"0.5761631",
"0.5663602",
"0.5633081",
"0.56095046",
"0.5603764",
"0.5588... | 0.8018548 | 1 |
Returns a list of valid words. Words are strings of lowercase ENglish characters. | def loadWords():
print("Loading word list from file...")
# inFile: file
inFile = open(WORDLIST_FILENAME, 'r')
# line: string
line = inFile.readline()
# wordlist: list of strings
wordList = line.split()
print(" ", len(wordList), "words loaded.")
return wordList | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def words(self):\n punctuation = '''!()-[]{};:'\"\\,<>./?@#$%^&*_~'''\n lst = []\n for lines in self.lines:\n words = lines.split(' ')\n for word in words:\n no_punc = ''\n for c in word:\n if c not in punctuation:\n ... | [
"0.7153364",
"0.71504265",
"0.71280795",
"0.7105015",
"0.6916777",
"0.6874299",
"0.68656516",
"0.6861505",
"0.6817898",
"0.6802267",
"0.6802267",
"0.6792035",
"0.6730974",
"0.67154634",
"0.67011964",
"0.66883117",
"0.6679545",
"0.66668385",
"0.6662633",
"0.66534257",
"0.66439... | 0.0 | -1 |
Obtain the index HTML | def index() -> str:
return render_template('index.html', username=getpass.getuser(), hostname=socket.gethostname(),
manager_host=DASHBOARD_MANAGER_HOST.value.decode() or 'localhost',
manager_port_nr=DASHBOARD_MANAGER_PORT.value) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index(self):\n return self.html",
"def get_index():\n return render_template('index.html')",
"def index(self) -> HTMLBody:\n\t\treturn render_template(\"index.jinja2\")",
"def index(self):\n\t\treturn render_template('index.html')",
"def index():\n return render_template('0-index.html')",
... | [
"0.79172456",
"0.7795948",
"0.7622198",
"0.7476992",
"0.7458507",
"0.7403224",
"0.73913115",
"0.7388152",
"0.7388152",
"0.73846173",
"0.73846173",
"0.7361599",
"0.7351011",
"0.7344008",
"0.7344008",
"0.7344008",
"0.7344008",
"0.7344008",
"0.7344008",
"0.7344008",
"0.7344008",... | 0.0 | -1 |
this lets you see whether one privilege is "higher" than another, though it's really meant more for display sorting than determining ability to do something, since possession of a "higher" privilege doesn't necessarily imply the ability to do anything a "lower" privilege can. | def comparator(cls, priv1, priv2):
priv1_idx = cls._ORDERED_PRIV_LIST.index(priv1)
priv2_idx = cls._ORDERED_PRIV_LIST.index(priv2)
if priv1_idx == priv2_idx: return 0
if priv1_idx < priv2_idx: return -1
return 1 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __gt__(self, other):\n return other < self._cmpkey()",
"def __gt__(self, other):\n return self.abs2phy.__gt__(other)",
"def __gt__(self, other):\n return self.abs2phy.__gt__(other)",
"def __gt__(self, other):\n if other.num_of_certified_applications > self.num_of_certified... | [
"0.5892672",
"0.58163613",
"0.58163613",
"0.57768315",
"0.5751311",
"0.57469845",
"0.57055604",
"0.5687826",
"0.56395966",
"0.5633531",
"0.56155765",
"0.5608583",
"0.5601823",
"0.5601157",
"0.559949",
"0.5594099",
"0.5594099",
"0.5586501",
"0.5576287",
"0.556291",
"0.555138",... | 0.6286243 | 0 |
only super users can edit other users | def can_update_user(cls, db_tuple, target, actor):
return target.user_id == actor.user_id | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def user_can_edit(self, user):\n return user == self.owner",
"def allow_to_edit(user):\n return allow_to_edit_well(user)",
"def can_edit(self, user):\n return self.author_id == user.id or user.is_staff",
"def can_be_edited(self, user):\n return (self.is_public or user == self.owner or\n ... | [
"0.771653",
"0.76991606",
"0.76565516",
"0.75638527",
"0.7405994",
"0.7217011",
"0.7101091",
"0.70014864",
"0.6955683",
"0.6939442",
"0.6870975",
"0.6830878",
"0.6822593",
"0.67372197",
"0.6705892",
"0.66733146",
"0.665614",
"0.65813035",
"0.6574445",
"0.64955735",
"0.6488079... | 0.0 | -1 |
f1(x) = (25 (x1 2)^2 + (x22)^2 + (x31)^2(x44)^2 + (x51)^2) | def f1_osyczka2(x1, x2, x3, x4, x5, x6):
return -1 * ((25 * pow(x1 - 2, 2)) +
pow((x2 - 2), 2) +
pow(x3 - 1, 2) * pow(x4 - 4, 2) +
pow(x5 - 1, 2)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def f1(x):\n return x**3 - 2*x + 2",
"def f1(x, a, b):\n #return x**43 - b*x**42 + x**7 - x**6 * a + 84*x - 42 * b - 42 * a\n return (x**42 + 42)/(x-a) + (x**6 + 42)/(x-b)",
"def f(x0: float, x1: float) -> float:\n return 8 - (x0 - 2) ** 2 - (x1 - 2) ** 2",
"def f1(x):\n \n # Sum over data ... | [
"0.80238146",
"0.7812538",
"0.7690267",
"0.7358475",
"0.72731894",
"0.72357255",
"0.7161593",
"0.7145089",
"0.70449936",
"0.70319945",
"0.70186985",
"0.7002549",
"0.69389224",
"0.6932416",
"0.68665487",
"0.68607014",
"0.68581665",
"0.68482184",
"0.6801166",
"0.6745981",
"0.66... | 0.69056976 | 14 |
A string representation of the parameters used to create this algorithm. It will be incorporated at the end of the string returned by | def cache_name(self) -> str:
return self._cache_name | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __parameters_string(self):\n if self._parameters == list():\n return ''\n\n docstring = \"\"\"\n\nParameters:\n\"\"\"\n \n # Compute maximum length of any parameter name\n maxlen = 0\n for param in self._parameters:\n maxlen = max(maxlen, len(param[0]... | [
"0.7353868",
"0.729785",
"0.70484996",
"0.7029147",
"0.6981808",
"0.69213605",
"0.68782747",
"0.686707",
"0.6859016",
"0.6858455",
"0.6854309",
"0.6842913",
"0.6836546",
"0.68241465",
"0.6816255",
"0.68121964",
"0.6810011",
"0.6789935",
"0.6779839",
"0.6731179",
"0.67188954",... | 0.0 | -1 |
Calculates the leftmost adjusted x position of this hit box | def left(self) -> float:
points = self.get_adjusted_points()
x_points = [point[0] for point in points]
return min(x_points) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_x(self):\n\t\treturn self._collision_rect.x + 14",
"def get_x_position(self):\n return self.rect.x",
"def _rect_left(self):\n\treturn min(self.x, self.x + self.w)",
"def pos_left(self, x=1):\n\n self.x -= x\n return self.pos(self.x, self.y)",
"def border_box_x(self):\n r... | [
"0.7605652",
"0.7562004",
"0.7466592",
"0.7344871",
"0.73445636",
"0.7280049",
"0.7280049",
"0.72243625",
"0.7095257",
"0.70596707",
"0.70426035",
"0.6979223",
"0.6963511",
"0.6930742",
"0.68853927",
"0.6883056",
"0.6869194",
"0.6831616",
"0.6820282",
"0.6525763",
"0.65118074... | 0.7183301 | 8 |
Calculates the rightmost adjusted x position of this hit box | def right(self) -> float:
points = self.get_adjusted_points()
x_points = [point[0] for point in points]
return max(x_points) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_x(self):\n\t\treturn self._collision_rect.x + 14",
"def _rect_right(self):\n\treturn max(self.x, self.x + self.w)",
"def _rect_left(self):\n\treturn min(self.x, self.x + self.w)",
"def get_x_position(self):\n return self.rect.x",
"def pos_right(self, x=1):\n\n self.x += x\n ret... | [
"0.7327979",
"0.70541704",
"0.7025631",
"0.6912925",
"0.68352437",
"0.6785634",
"0.665798",
"0.665798",
"0.6647112",
"0.6579544",
"0.6539942",
"0.6440918",
"0.6421393",
"0.6420561",
"0.6420561",
"0.6418955",
"0.64146113",
"0.6396952",
"0.6377699",
"0.63574845",
"0.63383967",
... | 0.62261117 | 25 |
Calculates the topmost adjusted y position of this hit box | def top(self) -> float:
points = self.get_adjusted_points()
y_points = [point[1] for point in points]
return max(y_points) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def top_y(self):\r\n return self.position.y + self.size.y + self.bulk",
"def _rect_top(self):\n\treturn max(self.y, self.y + self.h)",
"def get_y_position(self): \n return self.rect.y",
"def get_y(self):\n\t\treturn self._collision_rect.y + 25",
"def border_box_y(self):\n return s... | [
"0.786082",
"0.7558219",
"0.74815404",
"0.74248594",
"0.7343123",
"0.71959025",
"0.6974631",
"0.6904198",
"0.68585354",
"0.68357044",
"0.6811056",
"0.6740623",
"0.6689451",
"0.6687586",
"0.66079247",
"0.6599081",
"0.6599081",
"0.6530806",
"0.6520209",
"0.6494811",
"0.6490394"... | 0.60721797 | 38 |
Calculates the bottommost adjusted y position of this hit box | def bottom(self) -> float:
points = self.get_adjusted_points()
y_points = [point[1] for point in points]
return min(y_points) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def bottom_y(self):\r\n return self.position.y - self.size.y - self.bulk",
"def _rect_bottom(self):\n\treturn min(self.y, self.y + self.h)",
"def get_y(self):\n\t\treturn self._collision_rect.y + 25",
"def top_y(self):\r\n return self.position.y + self.size.y + self.bulk",
"def get_y_position(sel... | [
"0.79716057",
"0.7688332",
"0.7463521",
"0.74181217",
"0.73802996",
"0.7328168",
"0.7131311",
"0.6903236",
"0.6853397",
"0.6852393",
"0.68495566",
"0.68495566",
"0.68180716",
"0.68067265",
"0.67231315",
"0.6702768",
"0.66856945",
"0.66573095",
"0.66320527",
"0.6620935",
"0.66... | 0.6781623 | 14 |
Create a rotatable instance of this hit box. The internal ``PointList`` is transferred directly instead of deepcopied, so care should be taken if using a mutable internal representation. | def create_rotatable(
self,
angle: float = 0.0,
) -> RotatableHitBox:
return RotatableHitBox(
self._points, position=self._position, scale=self._scale, angle=angle
) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __copy__(self) -> 'Plane':\n return self.__class__(self._normal, self._distance_from_origin)",
"def _rotate(self):\n new_points = list()\n for i in range(len(self._points)):\n x = self._points[i][0]\n y = self._points[i][1]\n new_x = self._center[0] + sel... | [
"0.5573029",
"0.5551235",
"0.53923625",
"0.53923625",
"0.5275601",
"0.5178709",
"0.51570475",
"0.5082338",
"0.50811464",
"0.5065062",
"0.5035872",
"0.5031376",
"0.4983563",
"0.49818492",
"0.49745435",
"0.4967136",
"0.49613687",
"0.49301225",
"0.49218398",
"0.4920458",
"0.4906... | 0.7346769 | 0 |
enum members are equal to their string values | def test_string_equal_comparisions():
for status in ('draft', 'published', 'archived'):
member = BlogPostStatus(status)
yield (tools.assert_equal, status, member)
if unicode is not None:
yield (tools.assert_equal, unicode(status), member) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _assert_enum_types_equal(self, type1, type2):\n self.assertEqual(type1.name, type2.name)\n self.assertEqual(type1.description, type2.description)\n self.assertEqual(type1.func_descriptor, type2.func_descriptor)",
"def test_test_enum_parameters(self):\n pass",
"def test_enum(self... | [
"0.66439307",
"0.6566932",
"0.6452141",
"0.644056",
"0.62484866",
"0.62467456",
"0.618298",
"0.6121253",
"0.6105709",
"0.606691",
"0.6062442",
"0.60566014",
"0.6045054",
"0.6045031",
"0.6025295",
"0.59924686",
"0.5943859",
"0.5922348",
"0.5886979",
"0.5878718",
"0.5809724",
... | 0.6203614 | 6 |
Ordered enum members may be inequalitycompared to other enum members | def test_enum_unequal_comparisons():
for (operand, operators) in (
(BlogPostStatus.draft, [tools.assert_less]),
(BlogPostStatus.published, [tools.assert_less_equal, tools.assert_greater_equal]),
(BlogPostStatus.archived, [tools.assert_greater]),
):
for operator in operators:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_enum_aliases():\n class RedundantStatus(OrderedStrEnum):\n\n draft = 'draft'\n unpublished = 'draft'\n published = 'published'\n archived = 'archived'\n\n __order__ = 'draft, unpublished, published, archived'\n\n yield (tools.eq_, RedundantStatus.draft.ordinal, Red... | [
"0.7274192",
"0.72474146",
"0.67388976",
"0.65765446",
"0.65139794",
"0.6399444",
"0.63178045",
"0.6311401",
"0.61603653",
"0.6113865",
"0.6051778",
"0.60478383",
"0.6042003",
"0.5979132",
"0.5976072",
"0.5973447",
"0.59471273",
"0.5937109",
"0.58287144",
"0.5805283",
"0.5797... | 0.7080131 | 2 |
Sets the total of this WorkflowExecutionStatisticReport. | def total(self, total):
self._total = total | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def total(self, total):\n if self.local_vars_configuration.client_side_validation and total is None: # noqa: E501\n raise ValueError(\"Invalid value for `total`, must not be `None`\") # noqa: E501\n\n self._total = total",
"def total(self, total: float):\n if total is None:\n ... | [
"0.67515725",
"0.6622718",
"0.65249896",
"0.63994133",
"0.6364935",
"0.63348025",
"0.62613404",
"0.6218069",
"0.6074108",
"0.6056513",
"0.60248977",
"0.6000132",
"0.5973204",
"0.5926201",
"0.58709884",
"0.58374655",
"0.5834444",
"0.58298534",
"0.5828621",
"0.58272046",
"0.579... | 0.71200514 | 7 |
Sets the last_executed of this WorkflowExecutionStatisticReport. | def last_executed(self, last_executed):
self._last_executed = last_executed | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def last_updated(self, last_updated):\n\n self._last_updated = last_updated",
"def last_updated(self, last_updated):\n\n self._last_updated = last_updated",
"def last_updated(self, last_updated):\n\n self._last_updated = last_updated",
"def last_updated(self, last_updated):\n\n se... | [
"0.5983626",
"0.5983626",
"0.5983626",
"0.5983626",
"0.59450394",
"0.5855105",
"0.5755604",
"0.56860083",
"0.5578798",
"0.55777425",
"0.5558356",
"0.5523428",
"0.5496051",
"0.5484417",
"0.54533756",
"0.54533756",
"0.54142714",
"0.53915215",
"0.5369135",
"0.5348507",
"0.532085... | 0.8134434 | 0 |
Sets the completed of this WorkflowExecutionStatisticReport. | def completed(self, completed):
self._completed = completed | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_completed(self, result: str = None):\n self._has_run = True\n self.exp_metadata.result = result\n self.exp_metadata.status = ExperimentState.COMPLETED\n\n self._finish_exp_run()",
"def task_completed(self, worker_result):\n self.status = 'completed'\n self.modifi... | [
"0.73184514",
"0.63476485",
"0.6258236",
"0.60944146",
"0.6087708",
"0.60695493",
"0.6068729",
"0.5939304",
"0.59199256",
"0.5898214",
"0.58947057",
"0.58938366",
"0.5875933",
"0.5793653",
"0.576968",
"0.57680684",
"0.5767285",
"0.57632077",
"0.57570904",
"0.5752571",
"0.5741... | 0.7407728 | 2 |
Returns true if both objects are equal | def __eq__(self, other):
if not isinstance(other, WorkflowExecutionStatisticReport):
return False
return self.to_dict() == other.to_dict() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __eq__(self, other):\n return are_equal(self, other)",
"def __eq__(self, other):\n return are_equal(self, other)",
"def __eq__(self,other):\n try: return self.object==other.object and isinstance(self,type(other))\n except: return False",
"def __eq__(self, other):\n if i... | [
"0.8088132",
"0.8088132",
"0.8054589",
"0.7982687",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
... | 0.0 | -1 |
Returns true if both objects are not equal | def __ne__(self, other):
if not isinstance(other, WorkflowExecutionStatisticReport):
return True
return self.to_dict() != other.to_dict() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __ne__(self, other: object) -> bool:\n if self.__eq__(other):\n return False\n return True",
"def __ne__(self, other: object) -> bool:\n return not self.__eq__(other)",
"def __ne__(self, other) -> bool:\n return not self.__eq__(other)",
"def __eq__(self, other):\n ... | [
"0.845611",
"0.8391477",
"0.8144138",
"0.81410587",
"0.8132492",
"0.8093973",
"0.80920255",
"0.80920255",
"0.80920255",
"0.8085325",
"0.8085325",
"0.8076365",
"0.8076365",
"0.8065748",
"0.8042487",
"0.8042487",
"0.8042487",
"0.8042487",
"0.8042487",
"0.8042487",
"0.8042487",
... | 0.0 | -1 |
Get the current value of this ValueTracker. | def get_value(self) -> float:
return self.points[0, 0] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_current_value(self):\n assert(self.is_started())\n return self.currValue",
"def current_value(self):\n return self.current_counter.value",
"def get_value(self):\n return self._value",
"def get_value(self):\n return self._value",
"def get_value(self):\n retu... | [
"0.84498435",
"0.83609134",
"0.8021918",
"0.8021918",
"0.8021918",
"0.8012059",
"0.8011915",
"0.7994619",
"0.79860646",
"0.79844034",
"0.7982696",
"0.7974252",
"0.7974252",
"0.7956663",
"0.7956663",
"0.7956663",
"0.7938293",
"0.79051846",
"0.7893386",
"0.7892001",
"0.7892001"... | 0.0 | -1 |
Set the value of this value tracker to the current value modulo ``d_value``. | def __imod__(self, d_value: float):
self.set_value(self.get_value() % d_value)
return self | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def increment_value(self, d_value: float):\n self.set_value(self.get_value() + d_value)\n return self",
"def update( self, dval ):\n self.val[:] += dval[:]\n return",
"def __itruediv__(self, d_value: float):\n self.set_value(self.get_value() / d_value)\n return self",
... | [
"0.6974386",
"0.6383232",
"0.62796813",
"0.62210476",
"0.61323863",
"0.5939189",
"0.5939189",
"0.5923567",
"0.58471316",
"0.5816539",
"0.5800461",
"0.5800116",
"0.5767023",
"0.57560366",
"0.5723446",
"0.5695607",
"0.56850725",
"0.5669766",
"0.564745",
"0.564745",
"0.5641324",... | 0.82289565 | 0 |
Return True if the NFFG contains no Node. | def is_empty (self):
return len(self.network) == 0 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_empty(self):\n return len(self.__nodes) == 0",
"def is_empty(self):\n if self.root == None:\n return True\n return False",
"def is_empty(self):\n return self.__root == None",
"def is_empty(self):\n return self.root is None",
"def is_empty(self):\n ... | [
"0.8303268",
"0.78261316",
"0.7736217",
"0.7646781",
"0.7646781",
"0.76317334",
"0.76298916",
"0.7497835",
"0.7492709",
"0.7482308",
"0.7482308",
"0.7433599",
"0.73641205",
"0.7349632",
"0.7322528",
"0.7322177",
"0.73121303",
"0.7296272",
"0.7274654",
"0.7273803",
"0.72613555... | 0.7370883 | 12 |
Return True if the NFFG is an infrastructure view with Infrastructure nodes. | def is_infrastructure (self):
return sum([1 for i in self.infras]) != 0 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_w5_infrastructure(self, subj: URIRef) -> bool:\n return subj in w5_infrastructure_categories or \\\n bool(set(self.graph.transitive_objects(subj, RDFS.subClassOf)).intersection(w5_infrastructure_categories))",
"def check_infrastructure(infrastructure, data):\n if infrastructure == 'wa... | [
"0.6539021",
"0.65380067",
"0.61785614",
"0.5650283",
"0.55871004",
"0.5580826",
"0.5513682",
"0.55113745",
"0.5456774",
"0.5449252",
"0.5418488",
"0.53829515",
"0.5347815",
"0.52714795",
"0.5265002",
"0.5257124",
"0.5254371",
"0.5245468",
"0.52417386",
"0.5221561",
"0.521703... | 0.65583783 | 0 |
Return True if the topology does not contain any NF or flowrules need to install or remap. | def is_bare (self):
# If there is no VNF
if len([v for v in self.nfs]) == 0:
fr_sum = sum([sum(1 for fr in i.ports.flowrules) for i in self.infras])
# And there is no flowrule in the ports
if fr_sum == 0:
sg_sum = len([sg for sg in self.sg_hops])
# And there is not SG hop
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def has_remap(self):\n return self.mapping1 is not None or self.mapping2 is not None",
"def check_topology(self, ninputs: \"int\", noutputs: \"int\") -> \"bool\":\n return _beamforming_swig.beamformer_sptr_check_topology(self, ninputs, noutputs)",
"def check_nodes(self) -> bool:\n # check ... | [
"0.60574776",
"0.598162",
"0.5918374",
"0.5905532",
"0.5818316",
"0.58074284",
"0.5774021",
"0.57633144",
"0.5722792",
"0.5719835",
"0.5710215",
"0.5689669",
"0.5687855",
"0.56869996",
"0.56773084",
"0.56760776",
"0.5673487",
"0.5671983",
"0.56698",
"0.5642993",
"0.5639439",
... | 0.631738 | 0 |
Return true if there is a Static outbound or inbound EdgeLink, false if there is a Dynamic outbound or inbound link, throws exception if borth, or warning if multiple of the same type. | def isStaticInfraPort (cls, G, p):
static_link_found = False
dynamic_link_found = False
for edge_func, src_or_dst in ((G.out_edges_iter, 'src'),
(G.in_edges_iter, 'dst')):
for i, j, k, link in edge_func([p.node.id], data=True, keys=True):
src_or_dst_port = get... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_cross_onap_link(self, logical_link):\n for relationship in logical_link[\"relationship-list\"][\"relationship\"]:\n if relationship[\"related-to\"] == \"ext-aai-network\":\n return True\n return False",
"def can_auralise(self):\n\n if not self.sources:\n ... | [
"0.62145",
"0.60337317",
"0.60157526",
"0.5975105",
"0.5946777",
"0.5906914",
"0.5846751",
"0.58444256",
"0.58435833",
"0.5783474",
"0.5763917",
"0.57411116",
"0.57314605",
"0.5711576",
"0.5703112",
"0.56962645",
"0.56906474",
"0.5684504",
"0.5678857",
"0.5668293",
"0.5659386... | 0.63736135 | 0 |
Returns the top of the stack, but without popping it out of the stack. | def top(self):
assert not self.empty()
return self._s[-1] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def top(self):\n if self.stack == []:\n return None\n return self.stack[-1]",
"def top(self):\n if self.stack:\n return self.stack[-1]\n raise ValueError",
"def top(stack):\n if empty_stack(stack):\n raise IndexError(\"Stack is empty!\")\n else:\n ... | [
"0.85154396",
"0.8331587",
"0.8208456",
"0.8152517",
"0.8106501",
"0.7975088",
"0.7898652",
"0.7888846",
"0.7878758",
"0.7875383",
"0.7873644",
"0.7873644",
"0.7840939",
"0.7832265",
"0.7814107",
"0.7774041",
"0.77234983",
"0.7645507",
"0.75738347",
"0.75665087",
"0.7552239",... | 0.686399 | 60 |
Checks to see if the stack is empty or not. | def empty(self):
return self.__len__() == 0 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_empty(self):\n return len(self.the_stack) == 0",
"def is_empty(self):\n return len(self.stack) == 0",
"def empty(self):\r\n return len(self.stack) == 0",
"def empty(self):\n return len(self.stack) == 0",
"def empty(self):\n return len(self.stack) == 0",
"def is_e... | [
"0.9032904",
"0.89708567",
"0.88101727",
"0.87722486",
"0.87722486",
"0.8716798",
"0.8694265",
"0.8669593",
"0.86669445",
"0.8640886",
"0.8634666",
"0.8578355",
"0.8573562",
"0.8558491",
"0.84686714",
"0.84630495",
"0.8459857",
"0.83910096",
"0.83910096",
"0.8331577",
"0.8329... | 0.0 | -1 |
to_json_string Writes a string to a text file (UTF8). | def to_json_string(my_obj):
return (json.dumps(my_obj)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def string2json(self, string):\n kwargs = {\n 'cls': BytesEncoder, # use the IPython bytes encoder\n 'indent': 1,\n 'sort_keys': True,\n 'separators': (',', ': '),\n }\n return cast_unicode(json.dumps(string, **kwargs), 'utf-8')",
"def read_json_t... | [
"0.71411014",
"0.7069346",
"0.7056892",
"0.6832394",
"0.67765903",
"0.66921085",
"0.66912115",
"0.65841866",
"0.6509333",
"0.6468959",
"0.64109415",
"0.63577974",
"0.6278687",
"0.62580717",
"0.62456805",
"0.623683",
"0.6227749",
"0.6217299",
"0.62164503",
"0.61842984",
"0.617... | 0.0 | -1 |
returns true if the string contains all the digits 19 | def is_pandigital_str(s):
tot = 0
zer = ord('0')
for c in [c for c in s if c.isdigit()]:
tot |= (1<<(ord(c) - zer))
return tot == (1<<10)-2 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def string_contains_digits(self, string):\n return bool(self.compiledDigitRegex.search(string))",
"def isAllDigits(self, word):\n return ((re.match('^\\d+$', word)) != None)",
"def _contains_number(text):\n return any((True for n in xrange(10) if str(n) in text))",
"def istele(number):\n... | [
"0.70764965",
"0.67739165",
"0.6587947",
"0.6553335",
"0.646963",
"0.63680243",
"0.63437355",
"0.6293572",
"0.62917197",
"0.6278777",
"0.62578434",
"0.6245347",
"0.61682874",
"0.6148781",
"0.61386025",
"0.61160433",
"0.61004794",
"0.60975385",
"0.60960126",
"0.6069966",
"0.60... | 0.55662423 | 58 |
load a yaml file into the application's configuration dictionary. | def load_config(filename):
AS["config"] = load_yaml_file(filename) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def load_yaml(cls, file=None):\n if file is None: file = f'{rcp.base_path}cfg.yml'\n try:\n with open(file, 'r') as f:\n config = yaml.load(f, Loader=yaml.FullLoader)\n cfg.__dict__ = config\n return cfg\n except FileNotFoundError:\n p... | [
"0.7893102",
"0.7792185",
"0.77210414",
"0.7720834",
"0.7653627",
"0.7557784",
"0.75298995",
"0.75252074",
"0.74886584",
"0.74620175",
"0.7450017",
"0.74446195",
"0.7442429",
"0.74394524",
"0.7407112",
"0.73927665",
"0.7378457",
"0.736378",
"0.73598486",
"0.73528266",
"0.7346... | 0.7764571 | 2 |
Change the logging level. | def log_lvl(lvl):
logs.set_level(logging.getLogger("plysp"), lvl) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def level(self, log_level):\n self.logger.setLevel(log_level)",
"def set_logging_level(self, level):\n if str(level) == '1':\n self.logging_level = logging.DEBUG\n elif str(level) == '2':\n self.logging_level = logging.INFO\n elif str(level) == '3':\n ... | [
"0.7940263",
"0.7911231",
"0.7864149",
"0.78448635",
"0.7839782",
"0.7839544",
"0.782832",
"0.77901715",
"0.7663805",
"0.76436836",
"0.76214963",
"0.75616926",
"0.75098425",
"0.74216264",
"0.7381827",
"0.73232466",
"0.72850716",
"0.7201122",
"0.7179793",
"0.71656823",
"0.7165... | 0.71043026 | 25 |
Return the instance id | def get_instance_id(self):
return self.instance_id | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def instance_id(self) -> str:\n return pulumi.get(self, \"instance_id\")",
"def instance_id(self) -> pulumi.Input[int]:\n return pulumi.get(self, \"instance_id\")",
"def instance_id(self) -> pulumi.Input[int]:\n return pulumi.get(self, \"instance_id\")",
"def instance_id(self) -> pulumi.... | [
"0.9116741",
"0.88717157",
"0.88717157",
"0.88717157",
"0.886873",
"0.88266855",
"0.88266855",
"0.88266855",
"0.88266855",
"0.88266855",
"0.88266855",
"0.8816027",
"0.8816027",
"0.8816027",
"0.8701977",
"0.8701977",
"0.8701977",
"0.8701977",
"0.8701977",
"0.8701977",
"0.85580... | 0.90589434 | 1 |
Add the binary missing indicators. | def transform(self, X: pd.DataFrame) -> pd.DataFrame:
X = self._transform(X)
indicator_names = [f"{feature}_na" for feature in self.variables_]
X[indicator_names] = X[self.variables_].isna().astype(int)
return X | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_missing_balls(self, balls):\n # TODO: add incoming ball only and wait for confirm or timeout\n self.available_balls += balls\n self.balls += balls",
"def __addDummyNuclideBases():\n DummyNuclideBase(name=\"DUMP1\", weight=10.0)\n DummyNuclideBase(name=\"DUMP2\", weight=240.0)",... | [
"0.5409568",
"0.5296511",
"0.5278374",
"0.5277077",
"0.5267183",
"0.51989126",
"0.51102704",
"0.509788",
"0.5016097",
"0.500567",
"0.49672735",
"0.49629593",
"0.496245",
"0.49399298",
"0.4936408",
"0.49318472",
"0.4895782",
"0.48751754",
"0.48488134",
"0.4842613",
"0.48366237... | 0.0 | -1 |
gets the cached value of this item. | def value(self):
return self._get_cached_value(self._value) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _get_cached_value(self, value):\n\n return value",
"def get(self, key):\n return self.cache_data.get(key)",
"def get(self, key):\n if key in self.cache:\n value = self.cache[key].value\n # Re-enqueue to indicate recently used\n self._re_enqueue(self.cac... | [
"0.80452806",
"0.78033125",
"0.77467656",
"0.75549805",
"0.75232244",
"0.75148743",
"0.7514284",
"0.7473147",
"0.7465596",
"0.74205315",
"0.73983943",
"0.73745465",
"0.73745465",
"0.736356",
"0.72755563",
"0.7251704",
"0.7203161",
"0.71617657",
"0.713911",
"0.71266204",
"0.69... | 0.75039876 | 7 |
gets the key of this item. | def key(self):
return self._key | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_key(self, item):\r\n return item[0]",
"def get_key(self):\n return self.key",
"def get_key(self):\n return self.key",
"def get_key(self) -> int:\n return self.key",
"def get_key(self) -> int:\n return self.__key",
"def get_key(self):\n\n return self._key"... | [
"0.84701264",
"0.8398488",
"0.8398488",
"0.82440716",
"0.81917036",
"0.81179094",
"0.80839694",
"0.80385804",
"0.8029655",
"0.80056864",
"0.8002845",
"0.797569",
"0.79645115",
"0.79645115",
"0.79645115",
"0.79645115",
"0.79597783",
"0.79535323",
"0.7883551",
"0.78755856",
"0.... | 0.7776284 | 21 |
gets the expire time value of this item in milliseconds. | def expire(self):
return self._expire | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def expire_time(self) -> str:\n return pulumi.get(self, \"expire_time\")",
"def expire_time(self) -> str:\n return pulumi.get(self, \"expire_time\")",
"def expire_time(self) -> str:\n return pulumi.get(self, \"expire_time\")",
"def expire_time(self) -> pulumi.Output[str]:\n return... | [
"0.82294023",
"0.82294023",
"0.82294023",
"0.79001206",
"0.79001206",
"0.7843518",
"0.77198654",
"0.7698794",
"0.76325047",
"0.76325047",
"0.75609314",
"0.738715",
"0.73569995",
"0.72367406",
"0.7130521",
"0.7073537",
"0.70327306",
"0.7028027",
"0.6950745",
"0.6914583",
"0.69... | 0.7406235 | 11 |
Makes the names of phase measurement and attachments unique. This function will make the names of measurements and attachments unique. It modifies the input all_phases. | def phase_uniquizer(all_phases):
measurement_name_maker = UniqueNameMaker(
itertools.chain.from_iterable(
phase.measurements.keys() for phase in all_phases
if phase.measurements))
attachment_names = list(itertools.chain.from_iterable(
phase.attachments.keys() for phase in all_phases)... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _make_names_unique(animations):\n counts = {}\n for a in animations:\n c = counts.get(a['name'], 0) + 1\n counts[a['name']] = c\n if c > 1:\n a['name'] += '_' + str(c - 1)\n\n dupes = set(k for k, v in counts.items() if v > 1)\n for a in animations:\n if a['na... | [
"0.64196336",
"0.5934985",
"0.554763",
"0.55056745",
"0.53984594",
"0.5367987",
"0.5249584",
"0.52124804",
"0.50584024",
"0.49809545",
"0.49367014",
"0.49135208",
"0.4910912",
"0.4910722",
"0.48929605",
"0.48702845",
"0.48270914",
"0.47974837",
"0.47963843",
"0.47960886",
"0.... | 0.8443444 | 0 |
Get the couch database. | def get_db():
# this is a bit of a hack, since it assumes all the models talk to the same
# db. that said a lot of our code relies on that assumption.
# this import is here because of annoying dependencies
return Database(settings.COUCH_DATABASE) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_db(self):\n self.logger.info('in get_db()')\n try:\n return self.client[self.db_name]\n except Exception as e:\n self.logger.error(f'Error occurred while getting client {e}')",
"def get_database(self):\n return self.database",
"def get_database(self):\n... | [
"0.75996315",
"0.7541116",
"0.7478221",
"0.7469355",
"0.7409623",
"0.74087703",
"0.7375324",
"0.73654824",
"0.7352712",
"0.7329053",
"0.7314676",
"0.73024815",
"0.7302336",
"0.72157574",
"0.72157574",
"0.7205381",
"0.71966976",
"0.71935546",
"0.71464163",
"0.71464163",
"0.714... | 0.7628401 | 0 |
Define python package module root path and absolute package root path. | def root(self, relative_dir):
# load module provider
provider_module = load(self.__module__)
# get relative module path to package root
relative_module_path = modularize(relative_dir)
self.package.module_root = self.__module__[
0 : self.__module__.find(relative_module... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def package_dir(self):\r\n return \".\"",
"def root_path(name, module_set_name):\n defaults = {\n \"lmod\": \"$spack/share/spack/lmod\",\n \"tcl\": \"$spack/share/spack/modules\",\n }\n # Root folders where the various module files should be written\n roots = spack.config.get(\"modul... | [
"0.7345929",
"0.71355265",
"0.68328315",
"0.6809901",
"0.67503464",
"0.6747813",
"0.6747354",
"0.6738957",
"0.67311877",
"0.6711822",
"0.6708144",
"0.6708016",
"0.6695172",
"0.66699547",
"0.6660481",
"0.6640726",
"0.66393757",
"0.65918744",
"0.6585257",
"0.6536816",
"0.649664... | 0.6713428 | 9 |
check that the 6 arrays are the expected shape | def test_return_shape(self):
print("Testing that get_region_data return values are the correct shape")
test = get_region_data(self.wmo_boxes, self.float_name, self.config,
self.index, self.pres)
self.assertTrue(test[0].shape == test[1].shape == test[2].shape,
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def check_shapes(arrs):\r\n shps = [i.shape for i in arrs]\r\n eq = np.all(np.array([shps[0] == i for i in shps[1:]]))\r\n err = \"Arrays arr not of the same shape...\"\r\n if not eq:\r\n raise ValueError(\"{}\\n{}\".format(err, shps))",
"def test_size_check(self):\n [x1, y1, s1, g1] = ... | [
"0.751339",
"0.7260294",
"0.72292393",
"0.7193923",
"0.7160661",
"0.7072554",
"0.70599127",
"0.70169044",
"0.7013178",
"0.69916576",
"0.69439137",
"0.69074905",
"0.68364245",
"0.6777319",
"0.6769668",
"0.6756369",
"0.67492056",
"0.6743319",
"0.6733503",
"0.67289037",
"0.66906... | 0.6370879 | 55 |
Export merged data to CSV format. | def _export(merged_data, export_config, csv_writer):
print('writing merged data to CSV file')
columns = export_config.columns
csv_writer.writerow(column.name for column in columns)
for item in merged_data:
nutrients_by_name = {
nutrient['nutrient']['id']: nutrient['amount']
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _export_data_to_csv(self, source, target):\n self.log.info(f\"Dumping data into {target}\")\n source.to_csv(target, index=False)",
"def _export_csv(x, y, export_to):\r\n\r\n with open(export_to, 'w', newline='') as e:\r\n writer = csv.writer(e, delimiter=',')\r\n ... | [
"0.73520005",
"0.71937376",
"0.69667894",
"0.6924836",
"0.68453074",
"0.6814207",
"0.68059725",
"0.6789022",
"0.67888296",
"0.6773372",
"0.67715263",
"0.67671627",
"0.673209",
"0.6724741",
"0.662498",
"0.6570266",
"0.65510094",
"0.6544339",
"0.6511611",
"0.65081745",
"0.65047... | 0.79536265 | 0 |
Setup editing data using a regular cohort setup Setup a WikiCohort that will span to all users that we have in the project. | def setUp(self):
DatabaseTest.setUp(self)
self.common_cohort_4()
self.create_wiki_cohort()
self.cohort_service = CohortService()
self.wiki_cohort = self.cohort_service.get(
self.session, self.owner_user_id, by_id=self.basic_wiki_cohort.id
)
# This shou... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def setUp(self):\n super().setUp()\n\n # create course with cohorts\n self.manual_cohort_name = \"ManualCohort1\"\n self.auto_cohort_name = \"AutoCohort1\"\n self.course_fixture = CourseFixture(**self.course_info).install()\n self.setup_cohort_config(self.course_fixture, a... | [
"0.6554218",
"0.60419846",
"0.58714294",
"0.5524126",
"0.5519026",
"0.54560786",
"0.5439724",
"0.5432877",
"0.5373439",
"0.5373439",
"0.53181887",
"0.5308331",
"0.5270714",
"0.5266665",
"0.52658254",
"0.5234584",
"0.517833",
"0.5174957",
"0.5163751",
"0.5135936",
"0.51259047"... | 0.7161842 | 0 |
Unmute a user that is already muted. | async def unmute(self, ctx, user: discord.Member = None):
try:
if not user:
return await ctx.send(f"> **<@{ctx.author.id}>, Please specify a user to unmute.**")
if user.id == ctx.author.id:
return await ctx.send(f"> **<@{ctx.author.id}>, You cannot unmute ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"async def unmute(self, ctx, user: Redeemed):\n if member == None or member == ctx.message.author:\n await ctx.send(\"You cannot unmute yourself!\")\n return \n await user.remove_roles(discord.utils.get(ctx.guild.roles, name=\"Muted\"))\n await ctx.send(f\"{user.mention}... | [
"0.8070011",
"0.7602932",
"0.73917466",
"0.70347655",
"0.7000994",
"0.6717318",
"0.65731317",
"0.6399834",
"0.62517285",
"0.6171112",
"0.6139472",
"0.611902",
"0.61041653",
"0.6092649",
"0.6031676",
"0.59940195",
"0.59929574",
"0.5984859",
"0.5939585",
"0.591522",
"0.5912813"... | 0.77826923 | 1 |
Actually does the parsing, converting a refined row to a list of tuples | def parse_row_get_occupation(row):
events_duration = []
def add_15m_free(): # List with (time, ending event name) tuples
nonlocal events_duration
if len(events_duration) == 0:
events_duration.append((15, 'Vuota'))
return
lastduration, lastevent = events_duration[-1]
if lastevent == 'Vuota':
events_du... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def ConvertRow(self, row):\n i = 0\n data = []\n for entry in row['f']:\n data.append(self.Convert(entry['v'], self.schema[i]))\n i += 1\n return tuple(data)",
"def _parse_tuple(self, line):\n elements = line[1:-1].split(\",\\t\")\n if len(elements) == len(self.des... | [
"0.7244563",
"0.7164698",
"0.6565908",
"0.64096016",
"0.6353323",
"0.6277993",
"0.62029463",
"0.6182385",
"0.6124941",
"0.6047554",
"0.6004721",
"0.5999602",
"0.59870124",
"0.59848386",
"0.595571",
"0.5932366",
"0.5898904",
"0.5872047",
"0.5818242",
"0.58170927",
"0.57774055"... | 0.0 | -1 |
Return a heprecord for a Master's thesis (should be None as we don't want them). | def non_thesis():
spider = phenix_spider.PhenixSpider()
body = """
<ul>
<li><b>M.Sc. Author</b>:
"This is an Master's thesis, not a PhD", M.Sc. thesis at Master Science University, 2016,
<br><br>
</ul>
"""
response = fake_response_from_string(body)
node = get_node(sp... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def master_id(self):\r\n return self._arm.master_id",
"def series_master_id(self):\n if \"seriesMasterId\" in self._prop_dict:\n return self._prop_dict[\"seriesMasterId\"]\n else:\n return None",
"def _corresponding_simu(self):\n return SimuHawkes()",
"def ma... | [
"0.5528087",
"0.5513417",
"0.54352945",
"0.5400845",
"0.5305067",
"0.5171653",
"0.5159602",
"0.51450783",
"0.51450783",
"0.5144749",
"0.5140726",
"0.51137555",
"0.5103103",
"0.5009979",
"0.5008616",
"0.5003694",
"0.50006515",
"0.49668756",
"0.49632555",
"0.49581948",
"0.49393... | 0.48076546 | 30 |
Calculate the distance between a point and a rectangle, very general can be used many ways | def dist_recpoint(point, rec):
dx = max(rec[0] - point.x, 0, point.x - rec[1])
dy = max(rec[2] - point.y, 0, point.y - rec[3])
return (dx**2 + dy**2)**0.5 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def rectangle_distance(x1, y1, x1b, y1b, x2, y2, x2b, y2b):\n # From https://stackoverflow.com/questions/4978323/\n left = x2b < x1\n right = x1b < x2\n bottom = y2b < y1\n top = y1b < y2\n if top and left:\n return distance(x1, y1b, x2b, y2)\n elif left and bottom:\n return dist... | [
"0.7808502",
"0.74146366",
"0.6837201",
"0.6827407",
"0.67619324",
"0.67551535",
"0.6719458",
"0.66931796",
"0.6663596",
"0.660348",
"0.65696186",
"0.6544622",
"0.6521946",
"0.6471103",
"0.6463308",
"0.6463308",
"0.6463308",
"0.6463308",
"0.6453824",
"0.64477515",
"0.6419617"... | 0.0 | -1 |
Applies the bridge layer to the final encoder hidden states. The input to the ``forward`` is expected to have already been reshaped for initializing the decoder. | def forward(self, hidden: Union[torch.Tensor, Tuple[torch.Tensor, ...]]) -> Union[torch.Tensor, Tuple[torch.Tensor, ...]]:
# First, map the non-tuple version to a 1-tuple for easier processing.
# We will undo this at the end
if not isinstance(hidden, tuple):
hidden = (hidden,)
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def forward(self, trg_embed, encoder_hidden, encoder_final, \n src_mask, trg_mask, hidden=None, max_len=None):\n \n # the maximum number of steps to unroll the RNN\n #print(\"czw src mask\", src_mask.size())\n #print(\"czw trg embed\", trg... | [
"0.63221574",
"0.6157343",
"0.6141186",
"0.6141186",
"0.6122082",
"0.6069905",
"0.5950378",
"0.5930603",
"0.584369",
"0.58335346",
"0.58134943",
"0.5795488",
"0.57759076",
"0.5774589",
"0.577322",
"0.5769746",
"0.57366055",
"0.5735398",
"0.5673114",
"0.5650568",
"0.5642992",
... | 0.6893193 | 0 |
Cook up a mock for the Response with specific arguments. | def response():
def inner(ret_code, ret_value):
"""Set up response with the given parameters.
:param ret_code: Return code for the response
:param ret_value: Return value for the response
:return: Mocked Responce object with the given parameters
"""
with mo... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def mocked_requests_get():\n\n class MockResponse:\n def __init__(self, _content, _status):\n self.content = _content\n self.status_code = _status\n\n def content(self):\n return self.content\n\n return MockResponse",
"def __call__(self, url, **kwargs):\n ... | [
"0.69786805",
"0.6805909",
"0.66405565",
"0.6631657",
"0.6606776",
"0.6583181",
"0.6576626",
"0.6537886",
"0.6537886",
"0.64663863",
"0.6438763",
"0.6434038",
"0.6428945",
"0.6370893",
"0.63572294",
"0.6318053",
"0.6259043",
"0.62482667",
"0.6245254",
"0.6188998",
"0.6166345"... | 0.7046971 | 0 |
Prepare instance of the RPClient for testing. | def rp_client():
client = RPClient('http://endpoint', 'project', 'api_key')
client.session = mock.Mock()
return client | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def client_setup(self):\n self.client = Client()",
"def setUp(self):\n self.client = api.Client(config.get_config(), api.json_handler)",
"def SetUp(self):\n self.client = mock.Client(\n client_class=apis.GetClientClass('edge', 'v1alpha1'))\n self.client.Mock()\n self.addCleanup(se... | [
"0.7082959",
"0.68216586",
"0.6733405",
"0.67294174",
"0.67294174",
"0.67294174",
"0.67294174",
"0.66008776",
"0.65996695",
"0.6582165",
"0.6566996",
"0.6522097",
"0.6515163",
"0.6515163",
"0.6515163",
"0.6515163",
"0.6515163",
"0.65132797",
"0.65132797",
"0.64890045",
"0.645... | 0.7576592 | 0 |
Initialize the battery's attributes. | def __init__(self, battery_size=75):
self.battery_size = battery_size | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self, battery_size=40):\n self.battery_size = battery_size",
"def __init__(self, battery_size=70):\r\n\t\tself.battery_size = battery_size",
"def __init__(self, battery_size=70):\n self.battery_size = battery_size",
"def __init__(self, battery_size=70):\n self.battery_size =... | [
"0.7382995",
"0.73729676",
"0.73598105",
"0.73598105",
"0.73598105",
"0.7318721",
"0.73161864",
"0.7284151",
"0.72274315",
"0.7206751",
"0.7195436",
"0.69978577",
"0.69625956",
"0.69494915",
"0.6906689",
"0.6906689",
"0.6906689",
"0.6906689",
"0.6906689",
"0.6906689",
"0.6626... | 0.73419243 | 5 |
Initialize attributes of the paren class. Then initialize attributes specific to an electric car | def __init__(self, make, model, year):
super().__init__(make, model, year)
self.battery = Battery() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self, make, model, year):\n super().__init__(make, model, year)\n # Attributes specific to electric cars.\n self.battery = Battery()",
"def __init__(self):\n self.name = '{0} {1}'.format(choice(stars), choice(self.__class__.planets))\n self.casteOrder = (list(self.... | [
"0.6989882",
"0.6597792",
"0.6594358",
"0.6537479",
"0.6483297",
"0.64058214",
"0.6387269",
"0.6387269",
"0.6387269",
"0.6377212",
"0.6270694",
"0.6256299",
"0.6220412",
"0.6218522",
"0.6218522",
"0.6218522",
"0.617318",
"0.6169872",
"0.615041",
"0.61309123",
"0.6105477",
"... | 0.5729241 | 89 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.