query stringlengths 9 9.05k | document stringlengths 10 222k | metadata dict | negatives listlengths 30 30 | negative_scores listlengths 30 30 | document_score stringlengths 4 10 | document_rank stringclasses 2
values |
|---|---|---|---|---|---|---|
login the mobile and save into database | def save_login(mobile):
mobile = Mobile(mobile)
ktt = KTT(mobile)
ktt.gen_device_code()
ktt.get_api_start()
time.sleep(4)
ktt.post_login()
time.sleep(4)
ktt.get_user_info()
user_info = (
ktt.user_info["uid"], ktt.user_info["name"], ktt.user_info["mobile"],
ktt.user_in... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def login(self):",
"def login():",
"def login():",
"def login(self):\n self.open(self.urls['login'])\n self.select_form(nr=0)\n\n self.form['custno'] = self.username\n self.form['password'] = self.password\n res = self.submit()\n \n return res",
"def registr... | [
"0.73203313",
"0.7314797",
"0.7314797",
"0.72352594",
"0.69897395",
"0.6938618",
"0.67975694",
"0.67580247",
"0.67386055",
"0.66758156",
"0.65784484",
"0.6563376",
"0.65582424",
"0.64797634",
"0.64654523",
"0.6446827",
"0.644273",
"0.6435037",
"0.64183635",
"0.6416619",
"0.64... | 0.7846504 | 0 |
Make a car using a couple positional parameters and and arbitrary number of arguments as car. | def make_car(manufacturer, model, **car):
car['manufacturer'] = manufacturer
car['model'] = model
return car | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def make_car(manufacturer, model, **car_info):\n car_info['manufacturer'] = manufacturer\n car_info['model_name'] = model\n return car_info",
"def make_car(manufacturer, model, **options):\n car_dict = {\n 'manufacturer': manufacturer.title(),\n 'model': model.title(),\n }\n f... | [
"0.6548273",
"0.59506494",
"0.59237653",
"0.587781",
"0.5830112",
"0.5830112",
"0.5830112",
"0.5619388",
"0.54729205",
"0.5461815",
"0.5371661",
"0.53436637",
"0.5317199",
"0.5304972",
"0.5295139",
"0.5230103",
"0.5230103",
"0.5218944",
"0.5205694",
"0.51732576",
"0.51698184"... | 0.67995536 | 0 |
Do the bandwidth limitations | def limit():
bwc = BandwidthConfigurator()
bwc.limit() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def subbandwidth(self):",
"def limit_bandwidth(self):\n return self._limit_bandwidth",
"def change_bandwidth(self,edge_notice):\n #print(\"==============带宽控制=============\",edge_notice)\n ports_details = edge_notice[\"port_details\"]\n\n total_bd = edge_notice[\"bandwidth\"][\"mobil... | [
"0.6855867",
"0.67106193",
"0.6457166",
"0.6451645",
"0.6249702",
"0.62173337",
"0.62125623",
"0.607979",
"0.6070689",
"0.6053128",
"0.60060686",
"0.59504205",
"0.5887367",
"0.58344334",
"0.5794471",
"0.57896477",
"0.5784693",
"0.5750472",
"0.57457596",
"0.5744627",
"0.572217... | 0.7254434 | 0 |
Update the path to the link info file in the config.json file | def update_link_info_path(path_to_link_info):
if not systeminfo.file_exists(path_to_link_info):
print("File "+str(path_to_link_info)+" does not exist")
exit(1)
else:
try:
with open(Constants.path_to_config_file, "r") as jsonFile:
data = json.load(jsonFile)
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update_link(self):\n try:\n relpath = os.path.relpath(self.path, os.path.dirname(self.link_path))\n os.symlink(relpath, self.link_path)\n except OSError as e:\n if e.errno == errno.EEXIST:\n os.unlink(self.link_path)\n os.symlink(self... | [
"0.6214705",
"0.6182337",
"0.6157358",
"0.6109544",
"0.6018786",
"0.60121834",
"0.60012513",
"0.5976328",
"0.59549415",
"0.58855367",
"0.5767748",
"0.57106924",
"0.5689288",
"0.5680539",
"0.56615174",
"0.564764",
"0.56469256",
"0.562068",
"0.5608297",
"0.56061304",
"0.5551739... | 0.86908674 | 0 |
Update the default bandwidth in the config.json file | def update_default_bw(default_bandwidth):
try:
bw = int(default_bandwidth)
except ValueError:
error_exit()
if bw < 0:
error_exit()
try:
with open(Constants.path_to_config_file, "r") as jsonFile:
data = json.load(jsonFile)
data["DefaultBandwidth"] = b... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_change_default_throttling_settings_http_with_overwrite_throttled_rate_above_50():",
"def test_change_default_throttling_settings_http_with_overwrite_throttled():",
"async def set_bandwidth(self, bandwidth: int):\n return await self.hw_device.bandwidth(bandwidth)",
"def test_change_default_thr... | [
"0.62614644",
"0.62488467",
"0.61906177",
"0.6186651",
"0.6076635",
"0.6073374",
"0.6061155",
"0.58150417",
"0.5783569",
"0.5751298",
"0.5687263",
"0.5652501",
"0.56498796",
"0.5647845",
"0.55307513",
"0.5486703",
"0.5468017",
"0.5463025",
"0.54373705",
"0.54189503",
"0.54039... | 0.8513239 | 0 |
Exit because there were invalid arguments. | def error_exit():
print("Invalid arguments!")
print("Type -h to get help.")
exit(0) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def bad_args(args):\n PARSER.print_help()\n exit(0)",
"def exit_error_invalid_args_count(valid_count: int, supplied_count: Optional[int] = None):\n\n\tmessage = f\"Invalid count of arguments. Program takes: {valid_count}.\"\n\tif (supplied_count != None):\n\t\tmessage = f\"{message} Supplied: {supplied_cou... | [
"0.7527899",
"0.75167155",
"0.72037894",
"0.71742725",
"0.7170266",
"0.71404284",
"0.71091396",
"0.70503825",
"0.6989815",
"0.6938648",
"0.69283587",
"0.69218576",
"0.6921483",
"0.6908596",
"0.68581736",
"0.68278736",
"0.68090254",
"0.6791095",
"0.6788791",
"0.6787726",
"0.67... | 0.80115974 | 0 |
Get the material ID from URL parameter 'mat_id', or return one for testing. | def get_mat_id():
try:
name = curdoc().session_context.request.arguments.get('mat_id')[0]
if isinstance(name, bytes):
mat_id = name.decode()
except (TypeError, KeyError, AttributeError):
mat_id = '05001N2' # equivalent of http://localhost:5006/details?mat_id=05001N2
ret... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def mat_id(self):\n\n return self._mat_id",
"def info_materials_type_id_get(type_id):\n session = info_map.Session()\n q = session.query(info_map.Material).filter(info_map.Material.type == type_id)\n\n mat = q.one_or_none() # return the only result or `None`\n\n if mat is not None:\n ma... | [
"0.64039624",
"0.6291038",
"0.6112697",
"0.60510725",
"0.60218686",
"0.58874625",
"0.58710784",
"0.574224",
"0.5708218",
"0.56405836",
"0.55805826",
"0.5530278",
"0.5498635",
"0.5448638",
"0.5411487",
"0.5380355",
"0.5377292",
"0.5370546",
"0.53529525",
"0.5280024",
"0.527694... | 0.8327905 | 0 |
Make a table of geometric properties, given the Zeopp output. | def get_geom_table(zeopp):
# Usefull: ⁻¹²³⁴⁵⁶⁷⁸⁹⁰Å
decimals = 2
md_str = """
||||
|---|---|---|
| Density | {} g/cm³ | |
| Access. Surface Area | {} m²/g | {} m²/cm³ |
| Non-Access. Surface Area | {} m²/g | {} m²/cm³ |
| Acces... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def table_summary():\n \n t = dict()\n t['name'] = get_names()\n t['Name'] = [get_properties(name)['label'] for name in t['name']]\n N = len(t['name'])\n \n # host\n t['host'] = ['Sagittarius', 'Sagittarius', 'none', 'Gaia-Sausage-Enceladus', 'Sagittarius', 'Sequoia / Arjuna / I\\'itoi', 'S... | [
"0.6173308",
"0.6111791",
"0.601859",
"0.59760773",
"0.59040433",
"0.5816849",
"0.57305855",
"0.5721137",
"0.5706404",
"0.56922364",
"0.5678363",
"0.5658503",
"0.56486636",
"0.5600575",
"0.5589941",
"0.55275947",
"0.5527109",
"0.549133",
"0.5460882",
"0.5458366",
"0.54472744"... | 0.7278768 | 0 |
Return URL to EXPLORE section for given uuid. | def get_provenance_url(uuid):
return '{explore_url}/details/{uuid}'.format(explore_url=EXPLORE_URL, uuid=uuid) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def gen_url(section):\n urls = []\n urls.append('https://ia800500.us.archive.org/22/items/stackexchange/' + section + '.stackexchange.com.7z')\n urls.append('https://ia800500.us.archive.org/22/items/stackexchange/' + section + '.7z')\n return urls",
"def get_url_from_id(doc_id):\n return f\"{BASE_... | [
"0.62891316",
"0.6054225",
"0.5921332",
"0.5549293",
"0.54961294",
"0.5422762",
"0.54221314",
"0.5408781",
"0.5408781",
"0.54043907",
"0.54043907",
"0.5402435",
"0.5392959",
"0.5385904",
"0.5370057",
"0.53482854",
"0.53314745",
"0.5323235",
"0.5321087",
"0.5320027",
"0.531910... | 0.6849974 | 0 |
Return pn.HTML representation of provenance link. | def get_provenance_link(uuid, label=None):
if label is None:
label = "Browse provenance\n" + uuid
html_str = "<a href='{link}' target='_blank'><img src='{logo_url}' title='{label}' class='provenance-logo'></a>"\
.format(link=get_provenance_url(uuid), label=label, logo_url=AIIDA_LOGO_PATH)
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_publish_link(self):\n return self.get_link(PUBLISH_LINK_REL)",
"def link(self):\n return f\"[{self.numbered_title}]({self.html_url})\"",
"def get_provenance_url(uuid):\n return '{explore_url}/details/{uuid}'.format(explore_url=EXPLORE_URL, uuid=uuid)",
"def generate_pr_link(pr_num):\n ... | [
"0.63502437",
"0.6195645",
"0.6166328",
"0.60662866",
"0.60397965",
"0.6030366",
"0.6030366",
"0.60190284",
"0.6009227",
"0.5882543",
"0.58155733",
"0.5793707",
"0.57651055",
"0.57648283",
"0.5741884",
"0.57033646",
"0.56745046",
"0.56480086",
"0.56283015",
"0.55643237",
"0.5... | 0.72545034 | 0 |
Return pn.Row representation of title. Includes provenance link, if uuid is specified. | def get_title(text, uuid=None):
if uuid is not None:
text += get_provenance_link(uuid)
title = pn.Row(pn.pane.HTML('<h2>{}</h2>'.format(text)), align='start')
return title | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def filter_by_title(self):\n\n \"\"\" validate data \"\"\"\n if not self.title or not self.body:\n api.abort(400, \"Incorrect Data Format. Try again\")\n\n con, results = psycopg2.connect(**self.config), None\n cur = con.cursor(cursor_factory=RealDictCursor)\n\n try:\n... | [
"0.56210715",
"0.5602872",
"0.5578521",
"0.5458655",
"0.5442545",
"0.5430922",
"0.5316091",
"0.5304766",
"0.5284281",
"0.5274494",
"0.52685493",
"0.5240331",
"0.5183138",
"0.51739395",
"0.5148913",
"0.51476645",
"0.51366276",
"0.51099735",
"0.5109804",
"0.5104191",
"0.5065213... | 0.7101554 | 0 |
Receives an instance of a BasicDesignParameter object and returns its value in field units (if possible) | def GetValueInFieldUnits(self, designParam):
val = None
try:
val = designParam.GetValue()
if val != None and designParam.GetInfoType() & USESUNIT_INFO:
unitType = designParam.GetType().unitType
if unitType:
unit = S42Glob.unitSy... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_parameter_unit(self, parameter_name):\n parameter_units = {\n 'tsky': units.Unit(\"Kelvin\"),\n 'kelvin': self.data_unit\n }\n return parameter_units.get(parameter_name)",
"def getUnits(self):\n return _libsbml.Parameter_getUnits(self)",
"def parameters... | [
"0.64127743",
"0.63911855",
"0.6076339",
"0.60186285",
"0.5894644",
"0.588024",
"0.5877308",
"0.5869766",
"0.58032084",
"0.577838",
"0.57741314",
"0.5738911",
"0.5726978",
"0.5714309",
"0.57031775",
"0.56954",
"0.562801",
"0.5627106",
"0.56238693",
"0.56113344",
"0.560293",
... | 0.7222495 | 0 |
Receives an instance of a BasicDesignParameter object (designParam) and a value (valueInField). Converts valueInField into sim42 units and sets it into designParam | def SetValueFromFieldUnits(self, designParam, valueInField):
val = valueInField
try:
if val != None and designParam.GetInfoType() & USESUNIT_INFO:
unitType = designParam.GetType().unitType
if unitType:
unit = S42Glob.unitSystem.GetSim42Unit... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def GetValueInFieldUnits(self, designParam):\n val = None\n try:\n val = designParam.GetValue()\n if val != None and designParam.GetInfoType() & USESUNIT_INFO:\n unitType = designParam.GetType().unitType\n if unitType:\n unit = S4... | [
"0.6627251",
"0.610656",
"0.5731375",
"0.5701766",
"0.56780255",
"0.5656285",
"0.5647689",
"0.55935067",
"0.558212",
"0.5552198",
"0.5502799",
"0.54694754",
"0.542716",
"0.542666",
"0.534795",
"0.5276981",
"0.524422",
"0.5240924",
"0.5231522",
"0.52242064",
"0.52177924",
"0... | 0.78861964 | 0 |
Get ids and OrgIds by lpu data list lpu_list contains info from `findOrgStructureByAddress` remote method | def _get_lpu_ids(self, lpu_list):
for key, item in lpu_list:
query = (self.session.query(UnitsParentForId.OrgId, LPU.id)
.filter(UnitsParentForId.LpuId == LPU.id)
.filter(LPU.key == item['serverId'])
.filter(UnitsParentForId.ChildId == i... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def list(self) -> List[Organisation]:\n ...",
"def _find_ids(self,\r\n data_list,\r\n prop,\r\n lookup_index,\r\n lookup_doc_type,\r\n lookup_field):\r\n lg = logging.getLogger(\"%s.%s\" % (self.ln, inspect.stack()... | [
"0.56763923",
"0.56574863",
"0.55944365",
"0.5583922",
"0.54317105",
"0.5403227",
"0.5311864",
"0.5296371",
"0.5220737",
"0.521917",
"0.5201566",
"0.5200253",
"0.5189723",
"0.5180287",
"0.5062584",
"0.5035281",
"0.50001574",
"0.49745685",
"0.49590462",
"0.49432367",
"0.493639... | 0.72324324 | 0 |
Get LPU by id and check if proxy url is available | def get_by_id(self, id):
try:
result = self.session.query(LPU).filter(LPU.id == int(id)).one()
except NoResultFound, e:
print e
logger.error(e, extra=logger_tags)
else:
result.proxy = result.proxy.split(';')[0]
if result.protocol in ('i... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def proxy_check(self, proxy):",
"def get_random_proxy():\n url=requests.get(proxypool_url).text.strip()\n #logger.info(\"now url is\",url)\n return url",
"def proxies_get(self) -> bool:\n return True",
"def get_proxy(self, proxy_name):\n\n proxies = self.proxies()\n if proxy_nam... | [
"0.58044595",
"0.56546026",
"0.5646583",
"0.5592583",
"0.55753404",
"0.5449043",
"0.52401066",
"0.522353",
"0.52212405",
"0.5220424",
"0.51877296",
"0.51839095",
"0.5122964",
"0.50740874",
"0.50686187",
"0.5040502",
"0.5020525",
"0.50133306",
"0.50119096",
"0.49960533",
"0.49... | 0.74442667 | 0 |
Get LPU.uid by code | def get_uid_by_code(self, code):
try:
result = self.session.query(LPU.id).filter(LPU.key == code).one()
except NoResultFound, e:
logger.error(e, extra=logger_tags)
print e
except MultipleResultsFound, e:
logger.error(e, extra=logger_tags)
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getmyuid():\n raise NotImplementedError()",
"def getuid(): # type: ignore\n return 0",
"def _get_uid(name):\n if getpwnam is None or name is None:\n return None\n try:\n result = getpwnam(name)\n except KeyError:\n result = None\n if result is not None:\n ... | [
"0.6999574",
"0.6771316",
"0.65732604",
"0.6560265",
"0.64122957",
"0.6396185",
"0.6317252",
"0.62772626",
"0.6273891",
"0.62618685",
"0.6212783",
"0.6212783",
"0.6212783",
"0.61669314",
"0.61333543",
"0.61271703",
"0.6121378",
"0.61129516",
"0.6110684",
"0.6077178",
"0.60740... | 0.840223 | 0 |
Get LPU_Unit by id | def get_by_id(self, id):
try:
result = self.session.query(LPU_Units).filter(LPU_Units.id == int(id)).one()
except NoResultFound, e:
logger.error(e, extra=logger_tags)
print e
else:
return result
return None | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def load_unit(self, unit_id):",
"def get_unit(self, unit_id: str) -> Mapping[str, Any]:\n return self.__get_one_by_id(\"units\", \"unit_id\", unit_id)",
"def get_unit(self, unit_id: str) -> sqlite3.Row:\n with self.table_access_condition:\n conn = self._get_connection()\n c ... | [
"0.7341819",
"0.72922784",
"0.7282975",
"0.6471355",
"0.6411545",
"0.63823587",
"0.6364646",
"0.6357795",
"0.6324772",
"0.6124591",
"0.6075152",
"0.60170835",
"0.59570605",
"0.5950336",
"0.58926475",
"0.5851613",
"0.5833727",
"0.5788227",
"0.57009166",
"0.5683199",
"0.5657744... | 0.83733374 | 0 |
Return generated pdf for ticket print !NOT USED | def __get_ticket_print(self, **kwargs):
# TODO: выяснить используется ли pdf в принципе. В эл.регестратуре он никак не используется
# TODO: pdf creator based on Flask templates and xhtml2pdf
return "" | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def generate_pdf(self):\n x = 100\n y = 100\n buffer = BytesIO()\n p = canvas.Canvas(buffer, pagesize=\"A4\")\n p.drawString(x, y, \"TO DO\")\n p.showPage()\n p.save()\n pdf = buffer.getvalue()\n buffer.close()\n return pdf",
"def generate_pdf... | [
"0.7099188",
"0.69015145",
"0.6779028",
"0.67413867",
"0.67061603",
"0.6588517",
"0.65860564",
"0.6554792",
"0.65172607",
"0.64431185",
"0.644287",
"0.6427961",
"0.6413824",
"0.63975877",
"0.63970757",
"0.6396787",
"0.6395385",
"0.6388784",
"0.63851047",
"0.6381012",
"0.63748... | 0.8503505 | 0 |
yield successive palindromes starting at n | def palindromes(n: int) -> int:
# 1 -> 2 -> 3 ... 9 -> 11 -> 22 -> 33 -> 44 .. 99 -> 101
# 101 -> 111 -> 121 -> 131 -> ... -> 191 -> 202 -> 212
# 989 -> 999 -> 1001 -> 1111 -> 1221
# 9889 -> 9999 -> 10001 -> 10101 -> 10201
prev = n
s = str(n)
even = len(s) % 2 == 0
s = s[:ceil(len(s) / 2... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def palindromes():\n for n in count(1):\n if str(n) == str(n)[::-1]:\n yield n",
"def is_palindrome(n):\n x, y = n, 0\n f = lambda: 10 * y + x % 10\n while x > 0:\n x, y = x // 10, f()\n return y == n",
"def is_palindrome(n):\n x, y = n, 0\n f = lambda: y * 10 + x ... | [
"0.832305",
"0.708389",
"0.70499134",
"0.68969184",
"0.66951436",
"0.6626519",
"0.66211325",
"0.6550565",
"0.651251",
"0.64693886",
"0.64685863",
"0.6460855",
"0.6456798",
"0.64563006",
"0.6429597",
"0.6386062",
"0.63858664",
"0.63854855",
"0.6350786",
"0.6342665",
"0.6339901... | 0.83856016 | 0 |
return lowest prime palindrome >= N | def primePalindrome(self, N: int) -> int:
for p in palindromes(N):
if isPrime(p):
return p | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def probl4():\n\n largest_palindrome = 0\n for i in xrange(101, 1000):\n for j in xrange(101, 1000):\n output = i * j\n if str(output) == str(output)[::-1] and \\\n output > largest_palindrome:\n largest_palindrome = output\n return largest_pa... | [
"0.7129334",
"0.6534488",
"0.64698434",
"0.640755",
"0.64001536",
"0.6383542",
"0.63438714",
"0.63336974",
"0.6333067",
"0.6293175",
"0.6256248",
"0.62458646",
"0.62437445",
"0.6220448",
"0.6195942",
"0.6187914",
"0.61812913",
"0.6160996",
"0.6159969",
"0.6154383",
"0.6126047... | 0.851721 | 0 |
All JSON files should comply with the respective schemas | def test_json():
schemas = {
'schema-languages': 'bible/languages.json',
'schema-book-metadata': 'bible/book-metadata.json',
'schema-bible': 'bible/bible-*.json'
}
for schema_name, data_path_glob in schemas.items():
schema_path = 'schemas/{}.json'.format(schema_name)
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def load_schemas():\n schemas = {}\n for filename in os.listdir(get_abs_path('schemas')):\n path = get_abs_path('schemas') + '/' + filename\n file_raw = filename.replace('.json', '')\n with open(path) as file:\n schemas[file_raw] = Schema.from_dict(json.load(file))\n return... | [
"0.72212166",
"0.7018795",
"0.69702303",
"0.6862143",
"0.6862143",
"0.66942847",
"0.6672535",
"0.66344213",
"0.6504554",
"0.6377337",
"0.63728327",
"0.6293223",
"0.62395513",
"0.62205386",
"0.62136143",
"0.61410946",
"0.6130035",
"0.6127855",
"0.61156666",
"0.6114164",
"0.610... | 0.80713993 | 0 |
All source file imports should be properly ordered/formatted. | def test_import_order():
file_paths = glob.iglob('*/*.py')
for file_path in file_paths:
with open(file_path, 'r') as file_obj:
file_contents = file_obj.read()
new_file_contents = isort.code(file_contents)
fail_msg = '{} imports are not compliant'.format(
file_path... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_collector_imports(self):\n with open(self.filename, \"r+\") as code_file:\n content = code_file.read()\n if not content.startswith(self.IMPORT_COLLECTOR_LINE):\n logger.debug(\n \"Adding import lines, please do not remove while generating yml.\... | [
"0.65373695",
"0.63282275",
"0.63128215",
"0.6063273",
"0.6027855",
"0.59141105",
"0.5896263",
"0.5818009",
"0.5817466",
"0.5811015",
"0.58054435",
"0.58000606",
"0.57738185",
"0.5755444",
"0.57514095",
"0.5746293",
"0.56858623",
"0.5654388",
"0.56371",
"0.5621634",
"0.561957... | 0.7408749 | 0 |
Language IDs in languages.json should have a corresponding data file | def test_language_id_correspondence():
with open('bible/languages.json', 'r') as languages_file:
languages = json.load(languages_file)
for language in languages:
case.assertTrue(
os.path.exists(os.path.join(
'bible', 'bible-{}.json'.format(language['id']))),
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def initialise_languages():\n is_language_folder = r\"^[^\\\\\\.]*\" # Cannot have backslash or dot.\n language_folder_path = os.path.join(definitions.ROOT_DIR, \"languages\")\n\n for root, dirs, files in os.walk(language_folder_path):\n for name in files:\n if name.startswith(\"_NEW_... | [
"0.6839444",
"0.6304714",
"0.62660795",
"0.6134152",
"0.61108154",
"0.60628814",
"0.6021955",
"0.6021378",
"0.5998357",
"0.59827065",
"0.59392667",
"0.5906591",
"0.5903659",
"0.58858466",
"0.5863011",
"0.5839933",
"0.58230984",
"0.58214355",
"0.5810065",
"0.5799967",
"0.57994... | 0.7577649 | 0 |
Split a string on separator, ignoring ones escaped by backslashes. | def split_escaped(string, separator):
result = []
current = ''
escaped = False
for char in string:
if not escaped:
if char == '\\':
escaped = True
continue
elif char == separator:
result.append(current)
curr... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def safe_split(string, sep=','):\n regex = re.escape(sep) + r'\\s*(?![^\\[\\]]*\\])(?![^()]*\\))'\n return re.split(regex, string)",
"def split_escaped_delim (delimiter, string, count=0):\n assert len(delimiter) == 1\n\n split_expression = re.compile(r\"\"\"(?<!\\\\)%s\"\"\" % (delimiter))\n\n res... | [
"0.7253181",
"0.71445125",
"0.7137215",
"0.7121397",
"0.7037666",
"0.6960564",
"0.68714076",
"0.6836655",
"0.67315274",
"0.6703915",
"0.6701192",
"0.6682179",
"0.66377485",
"0.6558326",
"0.6476721",
"0.6373009",
"0.6294557",
"0.6292038",
"0.6199906",
"0.61823356",
"0.6165287"... | 0.8195037 | 0 |
Whether NetworkManager is available on the system. | def is_available(cls):
try:
proc = subprocess.Popen(
['systemctl', 'status', 'NetworkManager'],
stdout=subprocess.PIPE,
stderr=subprocess.PIPE,
)
proc.communicate()
return proc.returncode == 0
except OSError... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def available(self) -> bool:\n if self._avm_wrapper.devices[self._mac].wan_access is None:\n return False\n return super().available",
"def is_available():",
"def is_workload_management_network_enabled(self) -> pulumi.Output[Optional[str]]:\n return pulumi.get(self, \"is_workloa... | [
"0.69506514",
"0.6918452",
"0.6896654",
"0.6881858",
"0.6783688",
"0.6780506",
"0.6757194",
"0.6729282",
"0.66662574",
"0.6660376",
"0.6645535",
"0.6637809",
"0.6584433",
"0.65828586",
"0.65828115",
"0.65415007",
"0.6512655",
"0.6496493",
"0.64875627",
"0.648293",
"0.64692485... | 0.87451077 | 0 |
The number of the current page (1 indexed) | def current_page(self):
if self.limit > 0 and self.offset > 0:
return int(ceil(self.offset / float(self.limit))) + 1
return 1 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_num_of_pages(self):",
"def next_num(self):\n return self.page + 1",
"def page(self) -> int:\n return self.__page",
"def getPageNumber(self):\n return self.pageNumber",
"def get_page(self, num):\n return num + 10",
"def get_pagination_count(self):\n count_phr... | [
"0.79905534",
"0.78399503",
"0.77722913",
"0.77477807",
"0.75905967",
"0.755179",
"0.7547972",
"0.7451831",
"0.74400914",
"0.73590666",
"0.73473233",
"0.73417383",
"0.7340928",
"0.7305438",
"0.7282693",
"0.72351915",
"0.71834",
"0.71391493",
"0.71288025",
"0.70757586",
"0.707... | 0.8492573 | 0 |
True if a next page exists. | def has_next(self):
return self.current_page < self.pages | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def has_next(self):\n return self.page < self.pages",
"def has_next(self):\n return self.page < self.pages",
"def has_next(self):\n return self.page < self.pages",
"def has_next_page(self):\n if self.page_number == 0:\n return True\n\n return self.next_page_token... | [
"0.86719596",
"0.86719596",
"0.86719596",
"0.8661847",
"0.80350786",
"0.7795365",
"0.77713907",
"0.7578386",
"0.7563336",
"0.74716824",
"0.7424023",
"0.73894376",
"0.73567814",
"0.7348578",
"0.7318991",
"0.73121655",
"0.7292514",
"0.72168624",
"0.71238124",
"0.7098628",
"0.70... | 0.8679172 | 0 |
True if a previous page exists. | def has_previous(self):
return self.current_page > 1 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def has_previous(self):\n return self.page > 1",
"def has_prev(self):\n return self.page > 1",
"def has_prev(self):\n return self.page > 1",
"def previous_page(self):\n\n\t\tif not self.is_paginated:\n\t\t\traise PaginationError(\"The response is not paginated.\")\n\n\t\tif self.current_... | [
"0.8591198",
"0.8424058",
"0.8424058",
"0.7598952",
"0.7492418",
"0.7270502",
"0.7226183",
"0.70806897",
"0.6977456",
"0.6734442",
"0.6527002",
"0.6513688",
"0.64872676",
"0.6478736",
"0.64503586",
"0.64375865",
"0.6419872",
"0.63830024",
"0.63745177",
"0.6333853",
"0.6333853... | 0.8615886 | 0 |
Returns the next url for the current endpoint. | def next_url(self):
if self.has_next:
kwargs = g.request_args.copy()
kwargs.update(request.view_args.copy())
kwargs['offset'] = self.offset + self.limit
kwargs['limit'] = self.limit
return url_for(request.endpoint, **kwargs) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def next_url(request):\n next = request.REQUEST.get(\"next\", \"\")\n host = request.get_host()\n return next if next and is_safe_url(next, host=host) else None",
"def next_api_url(self, value):\n\t\tif self.next(): #checking if there is a next in the first place\n\t\t\treturn self.next().get_api_url\n\... | [
"0.77716595",
"0.7334608",
"0.7310133",
"0.72360367",
"0.718394",
"0.71790445",
"0.70918936",
"0.6972071",
"0.6898512",
"0.686128",
"0.6781885",
"0.66957855",
"0.65467393",
"0.64879286",
"0.64385974",
"0.643196",
"0.63989925",
"0.6316696",
"0.6298682",
"0.6280611",
"0.6279986... | 0.84594345 | 0 |
If the marker is a wall marker. | def is_wall_marker(self):
return self.id in WALL | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_wall(self, x, y):\r\n\r\n return self.get_bool(x, y, 'wall')",
"def __isTileWall(self, point):\n return self.__getElementFromPairs(point) == \"-\"",
"def isWall(mapObj, x, y):\n if x < 0 or x >= len(mapObj) or y < 0 or y >= len(mapObj[x]):\n return False # x and y aren't actually... | [
"0.7144685",
"0.7086806",
"0.6987775",
"0.69617003",
"0.6878386",
"0.679058",
"0.66621244",
"0.65752566",
"0.645592",
"0.6335787",
"0.6205963",
"0.60925746",
"0.60775405",
"0.60061574",
"0.59500945",
"0.5911485",
"0.5906183",
"0.58550185",
"0.5809068",
"0.5783555",
"0.5713151... | 0.84243524 | 0 |
If the marker is a token marker. | def is_token_marker(self):
return self.id in TOKEN | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def ismarker(typename, tree):\n if type(tree) is not With or len(tree.items) != 1:\n return False\n ctxmanager = tree.items[0].context_expr\n return type(ctxmanager) is Name and ctxmanager.id == typename",
"def ProperContainsMarker(self, node):\n if not node.word: return;\n for mark in self... | [
"0.6230821",
"0.61243045",
"0.5873999",
"0.56812537",
"0.5647818",
"0.56252366",
"0.5596206",
"0.5591374",
"0.55774385",
"0.5459934",
"0.53865904",
"0.5360485",
"0.5280426",
"0.5279283",
"0.5263068",
"0.52604574",
"0.52586174",
"0.52565163",
"0.52414393",
"0.5233441",
"0.5228... | 0.8264267 | 0 |
Returns the coordinates of the vertices of a regular polygon with radius r and n sides centered at coordinate c. | def RegularPolygonPoints(n,c):
coord = []
for i in range(n):
x = m.cos(2*m.pi*i/n)+c[0]
y = m.sin(2*m.pi*i/n)+c[1]
coord.append([x,y])
return(coord) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def make_vertices(self, n): # noqa: E501\n r = 1 # The radius of the circle\n theta = np.linspace(0, 2 * np.pi, num=n, endpoint=False)\n pos = np.array([np.cos(theta), np.sin(theta)])\n\n # First normalize to guarantee that the limiting case of an infinite\n # number of vertice... | [
"0.7300178",
"0.66894245",
"0.6544243",
"0.6416491",
"0.63478243",
"0.6273584",
"0.61591357",
"0.6131146",
"0.61221296",
"0.6044638",
"0.6017807",
"0.5921428",
"0.5913541",
"0.59040755",
"0.5869749",
"0.58213294",
"0.580834",
"0.5801307",
"0.5801307",
"0.57912886",
"0.5784465... | 0.7860351 | 0 |
Moves the point a distance of s from the current position to a random vertex of the regular polygon and then does it again. k amounts of steps pos initial position, all the points the marker has been. | def MovePoint(pos,points,s=0.5, k = 1000):
x = [pos[0]]
y = [pos[1]]
rdm.seed(1) # comment out if you want randomness
for i in range(k):
n = len(points)
r = int(rdm.random()*n)
x.append(x[i] + (points[r][0] - x[i]) * s)
y.append(y[i] + (points[r][1] -... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def mutate_point_poly(mutated_genome):\n seed = random.randint(0,7)\n index = random.randint(0,max(0,len(mutated_genome)-1))\n if len(mutated_genome[index][2]) < 3: seed = 0\n if seed == 0:\n insert_point(mutated_genome,index)\n elif seed == 1:\n remove_point(mutated_genome,index)\n elif seed... | [
"0.6094841",
"0.5943091",
"0.589996",
"0.58300537",
"0.58300537",
"0.58169353",
"0.5795009",
"0.5788541",
"0.5787408",
"0.57582945",
"0.5752553",
"0.57317716",
"0.57224274",
"0.57114786",
"0.56774837",
"0.567118",
"0.5627825",
"0.5612761",
"0.5601681",
"0.55952567",
"0.559091... | 0.6621109 | 0 |
Get most recent memento for url. | def _get_closest_memento_url(url, when=None, timegate_uri=None):
if isinstance(memento_client, ImportError):
raise memento_client
if not when:
when = datetime.datetime.now()
mc = memento_client.MementoClient()
if timegate_uri:
mc.timegate_uri = timegate_uri
retry_count = 0... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def popUrl(self):\n url = None\n#self.lock.acquire()\n try:\n url = self.__unvistedUrls.get(timeout=2) #2s\n except:\n url = None\n#self.lock.release()\n return url",
"def getMostRecent(self):\n if len(self.recent):\n return self.recent[0]\n ... | [
"0.62500644",
"0.5840538",
"0.56563145",
"0.5630877",
"0.556768",
"0.55615276",
"0.5553952",
"0.55353034",
"0.5512473",
"0.55117625",
"0.55005336",
"0.54844934",
"0.54307157",
"0.5417811",
"0.5414005",
"0.53995395",
"0.53906995",
"0.53596586",
"0.5352761",
"0.5347131",
"0.534... | 0.6541128 | 0 |
Constructor. redirectChain is a list of redirects which were resolved by resolveRedirect(). This is needed to detect redirect loops. | def __init__(self, url, redirectChain=[], serverEncoding=None,
HTTPignore=[]):
self.url = url
self.serverEncoding = serverEncoding
fake_ua_config = config.fake_user_agent_default.get(
'weblinkchecker', False)
if fake_ua_config and isinstance(fake_ua_config, ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def load_redirects(self) -> None:\n\n self._redirects_file = self._siteroot / \"_redirects\"\n\n if not self._redirects_file.exists():\n return\n\n with open(str(self._redirects_file)) as file:\n for line in file:\n if not line or line.strip() == \"\" or li... | [
"0.612639",
"0.5780888",
"0.5670358",
"0.5669435",
"0.56155586",
"0.5354809",
"0.5348776",
"0.5243428",
"0.517329",
"0.51330614",
"0.5046331",
"0.5042699",
"0.50236386",
"0.49957708",
"0.49219432",
"0.4889712",
"0.48830163",
"0.48789907",
"0.48563993",
"0.48462087",
"0.483064... | 0.63515395 | 0 |
Get encodung used by server. | def getEncodingUsedByServer(self):
if not self.serverEncoding:
try:
pywikibot.output(
u'Contacting server %s to find out its default encoding...'
% self.host)
conn = self.getConnection()
conn.request('HEAD', '/',... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_encoded(self):\n pass",
"def encoding(self):\n return self._enc",
"def get_encoded(self):\n return self.key",
"def get_as_string(self, use_cache_if_available=True):\n obj_bytes = self.get_bytes(use_cache_if_available=use_cache_if_available)\n return obj_bytes.decode... | [
"0.6060062",
"0.5693692",
"0.5637267",
"0.55961704",
"0.55922204",
"0.5500767",
"0.5360144",
"0.5330457",
"0.5298138",
"0.52941173",
"0.5230701",
"0.5210192",
"0.5205215",
"0.51616865",
"0.51551646",
"0.51545745",
"0.51545745",
"0.51545745",
"0.51545745",
"0.51479226",
"0.511... | 0.59094477 | 1 |
Read encoding from response. | def readEncodingFromResponse(self, response):
if not self.serverEncoding:
try:
ct = response.getheader('Content-Type')
charsetR = re.compile('charset=(.+)')
charset = charsetR.search(ct).group(1)
self.serverEncoding = charset
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def decode_response(response):\n return response.read().decode('utf-8')",
"def get_charset(response): # 根据请求返回的响应获取数据()\n _charset = requests.utils.get_encoding_from_headers(response.headers)\n if _charset == 'ISO-8859-1':\n __charset = requests.utils.get_encodings_from_content(response.text... | [
"0.6784641",
"0.6341615",
"0.6224948",
"0.6192478",
"0.6014251",
"0.5998879",
"0.59752285",
"0.5943177",
"0.5925953",
"0.5856424",
"0.5855238",
"0.58397806",
"0.57802236",
"0.5769262",
"0.57470965",
"0.5742914",
"0.5639768",
"0.5625566",
"0.56226486",
"0.56211764",
"0.5577392... | 0.80249894 | 0 |
Return the redirect target URL as a string, if it is a HTTP redirect. If useHEAD is true, uses the HTTP HEAD method, which saves bandwidth by not downloading the body. Otherwise, the HTTP GET method is used. | def resolveRedirect(self, useHEAD=False):
conn = self.getConnection()
try:
if useHEAD:
conn.request('HEAD', '%s%s' % (self.path, self.query), None,
self.header)
else:
conn.request('GET', '%s%s' % (self.path, self.query)... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def check(self, useHEAD=False):\n try:\n wasRedirected = self.resolveRedirect(useHEAD=useHEAD)\n except UnicodeError as error:\n return False, u'Encoding Error: %s (%s)' % (\n error.__class__.__name__, error)\n except httplib.error as error:\n re... | [
"0.5525848",
"0.5510426",
"0.53245753",
"0.53086424",
"0.528137",
"0.5271851",
"0.5184655",
"0.51632845",
"0.5139789",
"0.51365376",
"0.50927347",
"0.50927347",
"0.5057529",
"0.5057529",
"0.5017317",
"0.5000361",
"0.5000361",
"0.49808654",
"0.49793002",
"0.497674",
"0.4949140... | 0.6439963 | 0 |
Add the fact that the link was found dead to the .dat file. | def setLinkDead(self, url, error, page, weblink_dead_days):
#test output
#pywikibot.output('setLinkDead: SEM acquire [%s][%s][%s]' % (url,page.title(),error))
self.semaphore.acquire()
#test output
#pywikibot.output('[%s] setLinkDead: SEM acc DONE [%s][%s][%s]' % (datetime.datetim... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add(self, link):\n # if path.exists(self.cachefile):\n with open(self.cachefile, 'a') as cache:\n cache.write(f\"{link}\\n\")",
"def overwrite_dead_symlinks ( self ):\n return self.value & self.OV_SYM_DEAD",
"def is_broken_link(self):\n if not os.path.exists(self.dst):\... | [
"0.5614878",
"0.55255014",
"0.5495197",
"0.5446293",
"0.5336829",
"0.5320294",
"0.53095144",
"0.52027786",
"0.5197136",
"0.5146284",
"0.51188254",
"0.5114486",
"0.5093819",
"0.5079673",
"0.50739646",
"0.50739646",
"0.5053201",
"0.4998321",
"0.49978983",
"0.49814373",
"0.49665... | 0.5678023 | 0 |
Record that the link is now alive. If link was previously found dead, remove it from the .dat file. | def setLinkAlive(self, url):
if url in self.historyDict:
#test output
#pywikibot.output('[%s] setLinkAlive: SEM acquire [%s]' % (datetime.datetime.now().strftime("%Y-%m-%d %H:%M:%S"),url))
self.semaphore.acquire()
try:
del self.historyDict[url]
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def setLinkDead(self, url, error, page, weblink_dead_days):\n #test output\n #pywikibot.output('setLinkDead: SEM acquire [%s][%s][%s]' % (url,page.title(),error))\n self.semaphore.acquire()\n #test output\n #pywikibot.output('[%s] setLinkDead: SEM acc DONE [%s][%s][%s]' % (dateti... | [
"0.6076417",
"0.5700082",
"0.5542183",
"0.54770446",
"0.5425182",
"0.5317285",
"0.5301118",
"0.52506113",
"0.5229909",
"0.5221787",
"0.517936",
"0.5143919",
"0.5130047",
"0.51031846",
"0.508386",
"0.507037",
"0.50491554",
"0.50066686",
"0.500633",
"0.49896982",
"0.49693623",
... | 0.6045877 | 1 |
Generator for pages in History. | def RepeatPageGenerator():
history = History(None)
pageTitles = set()
for value in history.historyDict.values():
for entry in value:
pageTitles.add(entry[0])
for pageTitle in sorted(pageTitles):
page = pywikibot.Page(pywikibot.Site(), pageTitle)
yield page | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def iter_pages(self):\n for num in range(1, self.pages + 1):\n yield Page(num)",
"def get_pages(self):\n cur_page = Page(\"slide \" + str(self.page_number + 1))\n\n print(self.file)\n sys.exit(1)\n\n for line in self.file:\n line = line.strip()\n\n ... | [
"0.67523533",
"0.66163343",
"0.6292445",
"0.6271408",
"0.624221",
"0.61824954",
"0.6141374",
"0.604482",
"0.6011982",
"0.60026246",
"0.59950286",
"0.5985704",
"0.59062713",
"0.5876",
"0.58711696",
"0.58623135",
"0.5845592",
"0.5815777",
"0.57820886",
"0.57398933",
"0.56897527... | 0.75078386 | 0 |
Test that User has attr email, and it's an empty string | def test_email_attr(self):
user = User()
self.assertTrue(hasattr(user, "email"))
self.assertEqual(user.email, "") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_empty_email_field(self):\r\n result=self.user.get_user_register(\"Stephen\",\" Ochieng\",\"stephenochieng955@mail.com\",\"stephenochieng\",\"eat\")\r\n self.assertEqual(2,result,\"Fill in the email field please\")",
"def test_for_email_attribute_by_name(self):\n name = u\"__... | [
"0.79228526",
"0.7816347",
"0.77210253",
"0.7576199",
"0.74750954",
"0.74606746",
"0.7375442",
"0.73522455",
"0.7351414",
"0.73139924",
"0.72954476",
"0.7273304",
"0.7227998",
"0.7171825",
"0.7118607",
"0.7118607",
"0.71002185",
"0.70887476",
"0.7081357",
"0.7074082",
"0.6998... | 0.8385895 | 0 |
Test that User has attr password, and it's an empty string | def test_password_attr(self):
user = User()
self.assertTrue(hasattr(user, "password"))
self.assertEqual(user.password, "") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_empty_password_field(self):\r\n result=self.user.get_user_register(\"Stephen\",\" Ochieng\",\"stephenochieng955@mail.com\",\"stephenochieng\",\"eat\"\")\r\n self.assertEqual(2,result,\"Fill in the password field please\")",
"def test_blank_password(self):\n rv = self.signup(... | [
"0.7982734",
"0.78397155",
"0.7741311",
"0.7725175",
"0.7686159",
"0.75730765",
"0.75359553",
"0.7514039",
"0.7485255",
"0.74771184",
"0.7461482",
"0.74084705",
"0.7361862",
"0.73473537",
"0.7330011",
"0.7296332",
"0.7272623",
"0.72654235",
"0.7224532",
"0.7200788",
"0.718796... | 0.83514524 | 0 |
Test that User has attr first_name, and it's an empty string | def test_first_name_attr(self):
user = User()
self.assertTrue(hasattr(user, "first_name"))
self.assertEqual(user.first_name, "") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_first_name_is_optional(self):\n self.updated_data['first_name'] = ''\n self.update_user()\n self.assertEqual(self.user.first_name, self.updated_data['first_name'])",
"def test_last_name_attr(self):\n user = User()\n self.assertTrue(hasattr(user, \"last_name\"))\n ... | [
"0.7791351",
"0.77021265",
"0.76935613",
"0.75390244",
"0.7298847",
"0.7283681",
"0.7144283",
"0.71056646",
"0.70899546",
"0.7047616",
"0.70143366",
"0.7010477",
"0.695369",
"0.69226205",
"0.68944967",
"0.68793935",
"0.6868432",
"0.6830701",
"0.67952096",
"0.67564285",
"0.671... | 0.84504926 | 0 |
Test that User has attr last_name, and it's an empty string | def test_last_name_attr(self):
user = User()
self.assertTrue(hasattr(user, "last_name"))
self.assertEqual(user.last_name, "") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_last_name_is_optional(self):\n self.updated_data['last_name'] = ''\n self.update_user()\n self.assertEqual(self.user.last_name, self.updated_data['last_name'])",
"def test_first_name_attr(self):\n user = User()\n self.assertTrue(hasattr(user, \"first_name\"))\n ... | [
"0.7921054",
"0.77939487",
"0.77847546",
"0.76324284",
"0.74921995",
"0.7323442",
"0.7184952",
"0.71725196",
"0.69474804",
"0.69243896",
"0.6886071",
"0.68673146",
"0.6805797",
"0.6798445",
"0.67751837",
"0.6743927",
"0.67163396",
"0.6602774",
"0.65559316",
"0.65541756",
"0.6... | 0.8454773 | 0 |
This function goes through each item in a list of items sorted by decreasing weight, and places it in the box with the most remaining space left. | def RoomyStrategy(I_list,box_list):
SortedItems = quick_sort(I_list)
lemon = []
iso = 0
for element in range(0, len(SortedItems)):
w = SortedItems[element].weight
x = FindMaxCap(box_list)
if w <= x.max_cap - x.curr_cap:
x.curr_cap += w
x.items_list.append(... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def TightStrategy(I_list,box_list):\n iso = 0\n lemon = []\n SortedItems = quick_sort(I_list)\n for element in range(0, len(SortedItems)):\n w = SortedItems[element].weight\n x = FindTightFit(box_list, w)\n if x == None:\n iso+=1\n pass\n else:\n ... | [
"0.6985238",
"0.6785833",
"0.6115677",
"0.59945285",
"0.5988582",
"0.5956128",
"0.5913582",
"0.5899048",
"0.5895812",
"0.5856296",
"0.58470017",
"0.5769195",
"0.5719614",
"0.5706656",
"0.5684817",
"0.5656103",
"0.56557024",
"0.5638558",
"0.56286937",
"0.5603651",
"0.5570313",... | 0.6990329 | 0 |
This function goes through each item in a list of items sorted by decreasing weight, and places it in the box with the least remaining space left that will fit the item. | def TightStrategy(I_list,box_list):
iso = 0
lemon = []
SortedItems = quick_sort(I_list)
for element in range(0, len(SortedItems)):
w = SortedItems[element].weight
x = FindTightFit(box_list, w)
if x == None:
iso+=1
pass
else:
if w <= x.m... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def RoomyStrategy(I_list,box_list):\n SortedItems = quick_sort(I_list)\n lemon = []\n iso = 0\n for element in range(0, len(SortedItems)):\n w = SortedItems[element].weight\n x = FindMaxCap(box_list)\n if w <= x.max_cap - x.curr_cap:\n x.curr_cap += w\n x.item... | [
"0.7067545",
"0.6999484",
"0.62968975",
"0.62678075",
"0.619582",
"0.61677027",
"0.6068201",
"0.60390544",
"0.6023008",
"0.59964025",
"0.5948679",
"0.5944885",
"0.5919078",
"0.5910194",
"0.5891087",
"0.5858532",
"0.58016753",
"0.5751992",
"0.5744714",
"0.5710323",
"0.56927454... | 0.70629853 | 1 |
This is a helper function for RoomyStrategy(), it finds the box in box_list that has the most space left. | def FindMaxCap(box_list):
rem = 0
for i in range(0,len(box_list)):
curr = box_list[i].max_cap - box_list[i].curr_cap
if curr >= rem:
rem = curr
box = box_list[i]
elif curr < rem:
pass
return box | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def FindTightFit(box_list,w):\n mini = w\n x = None\n for i in range(0,len(box_list)):\n curr = box_list[i].max_cap - box_list[i].curr_cap\n if curr >= w:\n x = box_list[i]\n rem = curr - w\n if curr > mini:\n mini = rem\n x = bo... | [
"0.6631335",
"0.6249586",
"0.6137004",
"0.60967714",
"0.60279894",
"0.5981532",
"0.58482575",
"0.58102745",
"0.5743381",
"0.57387006",
"0.5734325",
"0.57135266",
"0.5683856",
"0.56172323",
"0.5607959",
"0.5600104",
"0.55970883",
"0.5581056",
"0.5560845",
"0.5529841",
"0.55282... | 0.64246327 | 1 |
This is a helper function for TightStrategy(), it finds the box in box_list that has the least space left, while still having enough space for the chosen item. | def FindTightFit(box_list,w):
mini = w
x = None
for i in range(0,len(box_list)):
curr = box_list[i].max_cap - box_list[i].curr_cap
if curr >= w:
x = box_list[i]
rem = curr - w
if curr > mini:
mini = rem
x = box_list[i]
r... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def TightStrategy(I_list,box_list):\n iso = 0\n lemon = []\n SortedItems = quick_sort(I_list)\n for element in range(0, len(SortedItems)):\n w = SortedItems[element].weight\n x = FindTightFit(box_list, w)\n if x == None:\n iso+=1\n pass\n else:\n ... | [
"0.6615753",
"0.6372942",
"0.6316566",
"0.599116",
"0.59760207",
"0.58686745",
"0.5839075",
"0.5738444",
"0.5628234",
"0.5628234",
"0.56267154",
"0.5621375",
"0.55962676",
"0.5586753",
"0.5578993",
"0.5577905",
"0.5561294",
"0.54716915",
"0.54600275",
"0.5439795",
"0.5439795"... | 0.7222999 | 0 |
Gets the open of this DayResult. | def open(self) -> float:
return self._open | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def opened(self):\n return getattr(self, '_opened', False)",
"def opened_at(self) -> datetime | None:\n return self._opened_at",
"def is_open(self):\n return self._open",
"def open(self):\n\n return self._state == states['open']",
"def IsOpen(self):\n return self._is_open... | [
"0.6820169",
"0.6604935",
"0.6504138",
"0.6503741",
"0.6449408",
"0.64445347",
"0.64210314",
"0.6386966",
"0.6372385",
"0.63692623",
"0.63499135",
"0.6180994",
"0.61178976",
"0.60585237",
"0.6052216",
"0.60347277",
"0.59489477",
"0.5944215",
"0.59078586",
"0.59052414",
"0.586... | 0.66261387 | 1 |
Sets the open of this DayResult. | def open(self, open: float):
if open is None:
raise ValueError("Invalid value for `open`, must not be `None`") # noqa: E501
self._open = open | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def open(self, open):\n\n self._open = open",
"def open(self):\n self.solenoid.set(self.OPEN)",
"def open(self):\n self._isOpen = True",
"def opened_at(self, datetime: datetime) -> None:\n self._opened_at = datetime",
"def set_open(self, player):\n\t\t#TODO: open and give the pl... | [
"0.6697907",
"0.64759636",
"0.61819",
"0.6016672",
"0.59543073",
"0.5783232",
"0.5756975",
"0.56913245",
"0.56847245",
"0.5654959",
"0.56460625",
"0.56262934",
"0.55715156",
"0.555896",
"0.5535335",
"0.55320936",
"0.5529509",
"0.5507051",
"0.5404206",
"0.5397369",
"0.5388635"... | 0.6883721 | 0 |
Gets the high of this DayResult. | def high(self) -> float:
return self._high | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def highvalue(self):\r\n return resource.HighValue(self)",
"def last_high(self):\n return self.data.last('1D').high.iat[0]",
"def high(self):\n return self.high_array",
"def high(self) -> float:\n return self.current_candle[3]",
"def yhigh(self):\n return self._yhigh",
... | [
"0.75437236",
"0.71592665",
"0.7042064",
"0.6940014",
"0.6876646",
"0.6805828",
"0.66382587",
"0.66189235",
"0.6585509",
"0.6512028",
"0.6431401",
"0.6366317",
"0.62865055",
"0.6269435",
"0.6258955",
"0.6154499",
"0.6150545",
"0.61012536",
"0.6064127",
"0.60480535",
"0.603032... | 0.73740876 | 1 |
Sets the high of this DayResult. | def high(self, high: float):
if high is None:
raise ValueError("Invalid value for `high`, must not be `None`") # noqa: E501
self._high = high | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def high(self, high):\n\n self._high = high",
"def price_high(self, price_high):\n\n self._price_high = price_high",
"def changeHigh(self):\n self.changeLowHigh(self.ui.t_high, t_type=\"high\")",
"def high(self) -> float:\n return self._high",
"def ask_high(self, ask_high):\n\n ... | [
"0.75117135",
"0.6514404",
"0.6510834",
"0.64485717",
"0.6408975",
"0.63574564",
"0.631294",
"0.6212802",
"0.6144407",
"0.61353284",
"0.6114192",
"0.57356375",
"0.5722552",
"0.56726134",
"0.5666909",
"0.55742824",
"0.5574095",
"0.55486786",
"0.55174506",
"0.5514752",
"0.55049... | 0.6836007 | 1 |
Gets the low of this DayResult. | def low(self) -> float:
return self._low | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def low(self) -> float:\n return self.current_candle[4]",
"def low(self):\n return self.low_array",
"def low(self, json, units):\n low = str(json['forecast']['simpleforecast']['forecastday'][0]['low'][units])\n return low",
"def get_lowht(self):\n return self._lowht",
"de... | [
"0.7051661",
"0.69919646",
"0.6812692",
"0.6754663",
"0.67052025",
"0.6671184",
"0.66470623",
"0.6610273",
"0.65725297",
"0.65725297",
"0.6572243",
"0.6559087",
"0.6559087",
"0.6544411",
"0.649082",
"0.6477351",
"0.646769",
"0.6406719",
"0.6327913",
"0.6323262",
"0.62938946",... | 0.7511254 | 0 |
Sets the low of this DayResult. | def low(self, low: float):
if low is None:
raise ValueError("Invalid value for `low`, must not be `None`") # noqa: E501
self._low = low | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def low(self, low):\n\n self._low = low",
"def changeLow(self):\n self.changeLowHigh(self.ui.t_low, t_type=\"low\")",
"def low(self) -> float:\n return self._low",
"def price_low(self, price_low):\n\n self._price_low = price_low",
"def set_lowht(self, lowht):\n self._lowh... | [
"0.77770615",
"0.6924319",
"0.681001",
"0.66079456",
"0.6580842",
"0.6559487",
"0.65105116",
"0.64492613",
"0.6244733",
"0.6223013",
"0.6108506",
"0.6075715",
"0.6062858",
"0.60559726",
"0.6031384",
"0.6031384",
"0.60176855",
"0.6003325",
"0.6003325",
"0.59832215",
"0.5944196... | 0.69362015 | 1 |
Sets the close of this DayResult. | def close(self, close: float):
if close is None:
raise ValueError("Invalid value for `close`, must not be `None`") # noqa: E501
self._close = close | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def close(self, close):\n\n self._close = close",
"def close(self, close):\n\n self._close = close",
"def is_close(self, is_close):\n\n self._is_close = is_close",
"def close(self):\n if self.SE == 6:\n self.evr.polarity.put('VAL', 0)\n else:\n self.S_... | [
"0.66260755",
"0.66260755",
"0.62990326",
"0.6273074",
"0.6264921",
"0.6118089",
"0.60693103",
"0.5953877",
"0.59497905",
"0.5928368",
"0.58690727",
"0.5554002",
"0.5533707",
"0.55300736",
"0.5521101",
"0.549428",
"0.5420924",
"0.5420924",
"0.54153997",
"0.54121125",
"0.53832... | 0.6845012 | 0 |
Gets the adj_close of this DayResult. | def adj_close(self) -> float:
return self._adj_close | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def current_close(self):\n open = self._prices.open[self._offset]\n relativ_close = self._prices.close[self._offset]\n return open * (1.0 + relativ_close)",
"def adj_close(self, adj_close: float):\n if adj_close is None:\n raise ValueError(\"Invalid value for `adj_close`, m... | [
"0.6340642",
"0.62935174",
"0.6182932",
"0.59101707",
"0.5909736",
"0.5682746",
"0.5563457",
"0.55498344",
"0.5544749",
"0.539715",
"0.53605473",
"0.5353819",
"0.5279986",
"0.5250181",
"0.52123237",
"0.5173713",
"0.5106788",
"0.50673956",
"0.505782",
"0.48286125",
"0.48256192... | 0.80912983 | 0 |
Sets the adj_close of this DayResult. | def adj_close(self, adj_close: float):
if adj_close is None:
raise ValueError("Invalid value for `adj_close`, must not be `None`") # noqa: E501
self._adj_close = adj_close | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def adj_close(self) -> float:\n return self._adj_close",
"def trade_close(self, trade_close):\n\n self._trade_close = trade_close",
"def close(self):\n if self.SE == 6:\n self.evr.polarity.put('VAL', 0)\n else:\n self.S_CLOSE = 1",
"def close_ask(self, close_... | [
"0.6383597",
"0.52658755",
"0.52397656",
"0.50797004",
"0.5052527",
"0.50106424",
"0.4840793",
"0.48287636",
"0.47526127",
"0.47332242",
"0.47215325",
"0.46823427",
"0.46566796",
"0.4652321",
"0.46459556",
"0.4643407",
"0.45881745",
"0.4581511",
"0.45676678",
"0.45097283",
"0... | 0.7593991 | 0 |
Gets the volume of this DayResult. | def volume(self) -> float:
return self._volume | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_volume(cls) -> float:\n raise NotImplementedError",
"def getVolume(self):\n return self.__volume",
"def volume(self):\n return self._volume()",
"def volume(self):\n return self._volume()",
"def volume(self):\n return self.structure.volume",
"def volume(self):\n ... | [
"0.73380184",
"0.7334206",
"0.7286971",
"0.7286971",
"0.72858787",
"0.72192264",
"0.72192264",
"0.71941674",
"0.7176926",
"0.71614695",
"0.7156567",
"0.71413517",
"0.7081933",
"0.70750135",
"0.70306474",
"0.70021236",
"0.6996436",
"0.6996436",
"0.6996436",
"0.6986128",
"0.693... | 0.7512438 | 0 |
Gets the sma of this DayResult. | def sma(self) -> float:
return self._sma | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_smma(data):\n if data is None:\n raise EmptyDataError('[!] Invalid data value')\n\n result = TA.SMMA(data)\n if result is None:\n raise IndicatorException\n return result",
"def get_ssma(data):\n if data is None:\n raise EmptyDataError('... | [
"0.6705078",
"0.6702005",
"0.63130915",
"0.604633",
"0.60253215",
"0.5814726",
"0.57309335",
"0.55183524",
"0.5501305",
"0.54923886",
"0.5349451",
"0.53133947",
"0.5306182",
"0.5286874",
"0.52662396",
"0.52632236",
"0.52127385",
"0.519259",
"0.51896226",
"0.51849455",
"0.5179... | 0.68374413 | 0 |
Sets the sma of this DayResult. | def sma(self, sma: float):
self._sma = sma | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def asthma(self, asthma):\n\n self.logger.debug(\"In 'asthma' setter.\")\n\n self._asthma = asthma",
"def get_smma(data):\n if data is None:\n raise EmptyDataError('[!] Invalid data value')\n\n result = TA.SMMA(data)\n if result is None:\n raise IndicatorE... | [
"0.65260935",
"0.5757824",
"0.55244166",
"0.54285645",
"0.5409752",
"0.5250193",
"0.5065987",
"0.48958397",
"0.48645836",
"0.4815387",
"0.4812979",
"0.4811513",
"0.47755918",
"0.47638792",
"0.47203323",
"0.4719288",
"0.47071385",
"0.47002283",
"0.46994027",
"0.46741822",
"0.4... | 0.6982265 | 0 |
Gets the ema of this DayResult. | def ema(self) -> float:
return self._ema | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def calc_ema(self):\n emaFactor = self.settings['emaFactor']\n stepFactor = emaFactor ** self.vars['dt']\n if self.vars['step'] == 0:\n ema = float('NaN')\n elif self.vars['step'] == 1:\n ema = self.vars['speed_trace'][1]\n else:\n ema = stepFacto... | [
"0.6840555",
"0.6328568",
"0.6284632",
"0.627982",
"0.62528276",
"0.61535186",
"0.60896593",
"0.60843945",
"0.60232496",
"0.60146594",
"0.59870666",
"0.59870666",
"0.5979842",
"0.59694964",
"0.5923869",
"0.5825421",
"0.5755103",
"0.5740356",
"0.5740356",
"0.5708852",
"0.57063... | 0.7366966 | 0 |
Sets the ema of this DayResult. | def ema(self, ema: float):
self._ema = ema | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def ema(self) -> float:\n return self._ema",
"def calc_ema(self):\n emaFactor = self.settings['emaFactor']\n stepFactor = emaFactor ** self.vars['dt']\n if self.vars['step'] == 0:\n ema = float('NaN')\n elif self.vars['step'] == 1:\n ema = self.vars['speed... | [
"0.64813274",
"0.61788183",
"0.58671016",
"0.5786192",
"0.5786192",
"0.5639953",
"0.55677414",
"0.5446042",
"0.5423415",
"0.5380842",
"0.5316053",
"0.52911836",
"0.5276803",
"0.5228283",
"0.520868",
"0.5191439",
"0.51221997",
"0.50862294",
"0.50493085",
"0.49909917",
"0.49502... | 0.78668994 | 0 |
Gets the bb_top of this DayResult. | def bb_top(self) -> float:
return self._bb_top | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def top(self):\n return self._top",
"def top(self):\n return self._top",
"def top(self):\n\n return self._top",
"def top(self):\n # type: () -> float\n return self._top",
"def bb_top(self, bb_top: float):\n\n self._bb_top = bb_top",
"def top(self):\n retur... | [
"0.7299385",
"0.7299385",
"0.72449744",
"0.6989375",
"0.696975",
"0.6940521",
"0.69313705",
"0.6898982",
"0.68899566",
"0.68096256",
"0.68096256",
"0.6758738",
"0.6758738",
"0.6747098",
"0.67441416",
"0.6734482",
"0.67222184",
"0.67172086",
"0.66902864",
"0.66577977",
"0.6640... | 0.8007384 | 0 |
Sets the bb_top of this DayResult. | def bb_top(self, bb_top: float):
self._bb_top = bb_top | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def top(self, top):\n\n self._top = top",
"def top(self, top):\n\n self._top = top",
"def top(self, top):\n self.ptr.top(top)",
"def bb_top(self) -> float:\n return self._bb_top",
"def bb_bottom(self, bb_bottom: float):\n\n self._bb_bottom = bb_bottom",
"def set_top(sel... | [
"0.7312749",
"0.7312749",
"0.68154305",
"0.6754822",
"0.64766765",
"0.639463",
"0.62840223",
"0.61660033",
"0.6074473",
"0.60243905",
"0.59724253",
"0.59718174",
"0.59587586",
"0.58948135",
"0.58737767",
"0.5830447",
"0.5812833",
"0.5810868",
"0.57677007",
"0.5714637",
"0.571... | 0.85248613 | 0 |
Gets the bb_bottom of this DayResult. | def bb_bottom(self) -> float:
return self._bb_bottom | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def bottom(self):\n return self.__b",
"def bottom(self):\n return self._bottom",
"def bottom(self):\n\n return self._bottom",
"def bottom(self):\n # type: () -> float\n return self._bottom",
"def bottom(self):\n return self.top + self.height",
"def bottom(self):\... | [
"0.7806876",
"0.76377356",
"0.7617096",
"0.7505211",
"0.7393419",
"0.7244565",
"0.7244565",
"0.715929",
"0.7107881",
"0.68817294",
"0.68652534",
"0.68652534",
"0.68652534",
"0.68274355",
"0.6763851",
"0.6640081",
"0.663842",
"0.6610873",
"0.66095287",
"0.6604838",
"0.6604838"... | 0.84198266 | 0 |
Sets the bb_bottom of this DayResult. | def bb_bottom(self, bb_bottom: float):
self._bb_bottom = bb_bottom | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def bottom(self, bottom):\n\n self._bottom = bottom",
"def bb_bottom(self) -> float:\n return self._bb_bottom",
"def bottom(self, bottom):\n self.ptr.bottom(bottom)",
"def bottom(self, bottom):\n # type: (float) -> None\n\n if bottom is not None:\n if not isinsta... | [
"0.7585223",
"0.74590075",
"0.70887476",
"0.6759823",
"0.6750652",
"0.6706646",
"0.6587637",
"0.6423986",
"0.63807786",
"0.63063794",
"0.62357557",
"0.6167864",
"0.61641407",
"0.61349505",
"0.60663515",
"0.60514396",
"0.60386527",
"0.6002013",
"0.5979229",
"0.592342",
"0.5807... | 0.8726327 | 0 |
Gets the percent_b of this DayResult. | def percent_b(self) -> float:
return self._percent_b | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_percent_b(data):\n if data is None:\n raise EmptyDataError('[!] Invalid data value')\n\n result = TA.PERCENT_B(data)\n if result is None:\n raise IndicatorException\n return result",
"def percent_b(self, percent_b: float):\n\n self._percent_b = per... | [
"0.7333568",
"0.69678783",
"0.6780795",
"0.6777237",
"0.6737852",
"0.66891235",
"0.6633694",
"0.6633694",
"0.6369656",
"0.6328226",
"0.6235195",
"0.6235195",
"0.6229129",
"0.62130946",
"0.62047726",
"0.61435145",
"0.6131289",
"0.6088147",
"0.608755",
"0.60594577",
"0.6057868"... | 0.8523176 | 0 |
Sets the percent_b of this DayResult. | def percent_b(self, percent_b: float):
self._percent_b = percent_b | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def percent_b(self) -> float:\n return self._percent_b",
"def bid_percentage(self, bid_percentage):\n\n self._bid_percentage = bid_percentage",
"def get_percent_b(data):\n if data is None:\n raise EmptyDataError('[!] Invalid data value')\n\n result = TA.PERCENT_B(data)\n ... | [
"0.75793743",
"0.658591",
"0.6396232",
"0.63126993",
"0.61656314",
"0.61638653",
"0.6117204",
"0.6067649",
"0.6067649",
"0.59792274",
"0.59516895",
"0.59516895",
"0.59516895",
"0.59516895",
"0.5796555",
"0.5770728",
"0.5766896",
"0.5703572",
"0.56660765",
"0.56367826",
"0.563... | 0.888002 | 0 |
Gets the rsi of this DayResult. | def rsi(self) -> float:
return self._rsi | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def rsi(date):\n\n # print(float(r_json['Technical Analysis: RSI'][date]['RSI']))\n return float(r_json['Technical Analysis: RSI'][date]['RSI'])",
"def get_rsi(data):\n if data is None:\n raise EmptyDataError('[!] Invalid data value')\n\n result = TA.RSI(data)\n if result is... | [
"0.6533008",
"0.6491186",
"0.64453936",
"0.5878729",
"0.5777096",
"0.57620794",
"0.55363625",
"0.5494498",
"0.54942125",
"0.54648906",
"0.5421359",
"0.5398907",
"0.5377694",
"0.53757167",
"0.5293823",
"0.52934027",
"0.52746415",
"0.52619094",
"0.5248207",
"0.5237654",
"0.5224... | 0.7123576 | 0 |
Sets the rsi of this DayResult. | def rsi(self, rsi: float):
self._rsi = rsi | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def rsi(self) -> float:\n return self._rsi",
"def rsi(date):\n\n # print(float(r_json['Technical Analysis: RSI'][date]['RSI']))\n return float(r_json['Technical Analysis: RSI'][date]['RSI'])",
"def set_Srs(self, x):\n x = float(x)\n if self.Srs != x:\n self.Srs = x",
"de... | [
"0.5706033",
"0.5652691",
"0.5577731",
"0.5465468",
"0.5430579",
"0.5189119",
"0.5133185",
"0.5125083",
"0.50908935",
"0.5048999",
"0.50356597",
"0.5026801",
"0.48972857",
"0.48945373",
"0.48426437",
"0.48386338",
"0.48200288",
"0.4819629",
"0.48180595",
"0.47916242",
"0.4789... | 0.7310634 | 0 |
Gets the cci of this DayResult. | def cci(self) -> float:
return self._cci | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def eci(self):\n return self.__eci",
"def get_cci(data):\n if data is None:\n raise EmptyDataError('[!] Invalid data value')\n\n result = TA.CCI(data)\n if result is None:\n raise IndicatorException\n return result",
"def Crc(self):\n return self.... | [
"0.6295567",
"0.60494006",
"0.6025518",
"0.59071356",
"0.58969074",
"0.5879198",
"0.5815264",
"0.5726353",
"0.57141125",
"0.5699751",
"0.56982195",
"0.56803477",
"0.5542666",
"0.5533924",
"0.5509144",
"0.55022794",
"0.5486937",
"0.54697",
"0.5457986",
"0.5443288",
"0.5432931"... | 0.6942836 | 0 |
Sets the cci of this DayResult. | def cci(self, cci: float):
self._cci = cci | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def iccid(self, iccid):\n\n self._iccid = iccid",
"def setC(self, c):\n\t\tself.c = int(c)",
"def cci(self) -> float:\n return self._cci",
"def set_c(self, c):\n self.c = c",
"def set_cid(self, cid):\n self.__cid = cid",
"def set_cid(self, cid):\n self.__cid = cid",
"... | [
"0.5635116",
"0.53587115",
"0.5329483",
"0.521746",
"0.5174077",
"0.5174077",
"0.51383066",
"0.50831485",
"0.5015402",
"0.50027907",
"0.48343897",
"0.48331785",
"0.47613686",
"0.4701527",
"0.46955618",
"0.46569943",
"0.45811293",
"0.45710185",
"0.44947246",
"0.4472021",
"0.44... | 0.69056714 | 0 |
Gets the trade of this DayResult. | def trade(self) -> float:
return self._trade | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def trade(self) -> Trade:\n if not self._trade:\n self._trade = Trade(self.__key, self.__secret, self._url)\n return self._trade",
"def get_trade(self, id: int) -> TradeOffer | None:\n return self._connection.get_trade(id)",
"def trade_details(self) -> MqexsTradeDetails:\n ... | [
"0.69425714",
"0.6298508",
"0.611507",
"0.60041463",
"0.5989404",
"0.5795843",
"0.57037944",
"0.56003153",
"0.5591818",
"0.5487824",
"0.5443619",
"0.54434353",
"0.54186827",
"0.53465414",
"0.5334172",
"0.52832574",
"0.5282756",
"0.5263525",
"0.5256583",
"0.5247247",
"0.524724... | 0.69753796 | 0 |
Sets the trade of this DayResult. | def trade(self, trade: float):
if trade is None:
raise ValueError("Invalid value for `trade`, must not be `None`") # noqa: E501
self._trade = trade | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def trade_state(self, trade_state):\n\n self._trade_state = trade_state",
"def trade_close(self, trade_close):\n\n self._trade_close = trade_close",
"def set_live_trading(self, live_trading):\n\n self.live_trading = live_trading",
"def save(self, trade: Trade) -> Trade:\n\n pass ... | [
"0.6032495",
"0.58421856",
"0.5819654",
"0.5710147",
"0.5674557",
"0.56100285",
"0.5602686",
"0.55533344",
"0.5468347",
"0.5468347",
"0.5468347",
"0.5468347",
"0.54277503",
"0.5407802",
"0.5402637",
"0.53734607",
"0.5358706",
"0.53463125",
"0.53394735",
"0.53298193",
"0.53266... | 0.65985197 | 0 |
Gets the holding of this DayResult. | def holding(self) -> float:
return self._holding | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def result(self):\n with self._condition:\n self.fetch()\n return self.__get_result()",
"def get(self):\n \n if self._state == self.State.transfering_no_waiters:\n d = defer.Deferred(self._get_canceller)\n self._get_deferreds.append(d)\n ... | [
"0.59126943",
"0.5654075",
"0.5644446",
"0.5616856",
"0.55428815",
"0.554273",
"0.5471422",
"0.5423519",
"0.5423519",
"0.5423519",
"0.54145074",
"0.54128325",
"0.538792",
"0.53766435",
"0.5350002",
"0.53331476",
"0.531737",
"0.53112465",
"0.5305047",
"0.52916396",
"0.52916396... | 0.5863758 | 1 |
Gets the cash of this DayResult. | def cash(self) -> float:
return self._cash | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_cash(self):\r\n return self.cash",
"def getCash(self) -> int:\n return self.state[CASH]",
"def available_cash(self):\n return self._cash",
"def cash_sum(self, room):\n self.cash = room.price\n return self.cash",
"def cash_balance(self):\n cash_transaction =... | [
"0.7749279",
"0.7357067",
"0.67757225",
"0.6665068",
"0.6497363",
"0.61889416",
"0.6069715",
"0.60297805",
"0.5995536",
"0.58673155",
"0.5860459",
"0.5763532",
"0.5738253",
"0.5658459",
"0.5455791",
"0.5452864",
"0.5421678",
"0.5414225",
"0.54129237",
"0.53891695",
"0.5388189... | 0.74906373 | 1 |
Sets the cash of this DayResult. | def cash(self, cash: float):
if cash is None:
raise ValueError("Invalid value for `cash`, must not be `None`") # noqa: E501
self._cash = cash | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_cash(self, cash):\n portfolio = self.get_portfolio_object()\n if portfolio is not None:\n portfolio.cash += cash\n portfolio.initial_cash += cash",
"def cash(self) -> float:\n return self._cash",
"def cash_sum(self, room):\n self.cash = room.price\n ... | [
"0.7091743",
"0.62326807",
"0.61899394",
"0.5963316",
"0.589987",
"0.57699627",
"0.563683",
"0.5482396",
"0.5458104",
"0.54136056",
"0.52196425",
"0.5144976",
"0.514445",
"0.5111715",
"0.5092481",
"0.5036379",
"0.5026525",
"0.5023056",
"0.4954834",
"0.4869902",
"0.48422784",
... | 0.66653264 | 1 |
compose functions where g returns multiple arguments, which are then expanded to fit arguments of f | def compose_expanded_args(f,g):
def composed(*args):
return f(*(g(*args)))
return composed | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def compose(f, g):\n return lambda *args, **kwargs: f(g(*args, **kwargs))",
"def compose1(f, g):\n return lambda x: f(g(x))",
"def compose1(f, g):\n def h(x):\n return f(g(x))\n return h",
"def compose(f,g):\n def composed(x):\n return f(g(x))\n\n return composed",
"def comp... | [
"0.78951406",
"0.7627934",
"0.7606722",
"0.7543101",
"0.75368553",
"0.7470279",
"0.7056717",
"0.68658835",
"0.6806176",
"0.6645327",
"0.6611735",
"0.65992314",
"0.6572522",
"0.65516096",
"0.6549678",
"0.64765924",
"0.63548535",
"0.6351158",
"0.6277168",
"0.6242229",
"0.621224... | 0.8640568 | 0 |
decorator for factory f's __call__ that after __call__, saves object at specified path | def save_at_specified_path_dec(f, full_path):
def decorated_f(*args, **kwargs):
x = f(*args, **kwargs)
f.print_handler_f(x, full_path)
return x
return decorated_f | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def cache_to_disk(func: Callable, path: str, load: Callable, save: Callable) -> Callable:\n signature = inspect.signature(func)\n os.makedirs(path, exist_ok=True)\n\n def get_all_args(args, kwargs):\n bindings = signature.bind(*args, **kwargs)\n bindings.apply_defaults()\n return bind... | [
"0.5960479",
"0.58327734",
"0.5827448",
"0.5728322",
"0.5703856",
"0.5699197",
"0.562827",
"0.5581573",
"0.5558676",
"0.555818",
"0.55193496",
"0.54700714",
"0.54345304",
"0.54345304",
"0.54345304",
"0.5417435",
"0.54065746",
"0.5364356",
"0.5344339",
"0.53420943",
"0.5341675... | 0.59366536 | 1 |
decorator that returns val if an exception is raised by function call | def None_if_exception(f, val):
def decorated_f(*args, **kwargs):
try:
x = f(*args, **kwargs)
except Exception:
return None
else:
return x
return decorated_f | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def return_none_if_error(func):\n def wrapper(*args, **kwargs):\n try:\n value = func(*args, **kwargs)\n except Exception as e:\n value = None\n return value\n\n return wrapper",
"def lazy_value_or_error(value):\n try:\n return value() if callable(value) else ... | [
"0.74297017",
"0.689193",
"0.68623763",
"0.6832917",
"0.6813107",
"0.67883027",
"0.67839384",
"0.6699995",
"0.66252863",
"0.654835",
"0.6546829",
"0.6546829",
"0.654131",
"0.6515671",
"0.65010697",
"0.6440281",
"0.64241904",
"0.64180464",
"0.63813895",
"0.63518703",
"0.631663... | 0.7785486 | 0 |
Finds other tutors who teach similar subjects to "example" as measured by their jaccard similarity. | def subject_similarity(example, df, possible_subjects):
ex_subj = example[possible_subjects][example[possible_subjects]==1].index.values
sim_tuts = df[possible_subjects].apply(\
lambda x: jaccard_similarity( \
x[x[possible_subjects]==1].index... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def subject_similarity(example, df, possible_subjects):\n # Get subjects that example tutor tutors.\n ex_subj = example[possible_subjects][example[possible_subjects]==1].index.values\n\n sim_tuts = df[possible_subjects].apply(\\\n lambda x: jaccard_similarity( \\\n ... | [
"0.779868",
"0.72146696",
"0.5649779",
"0.5629628",
"0.5579155",
"0.5492321",
"0.5471617",
"0.5369658",
"0.5343912",
"0.53290904",
"0.53264844",
"0.52636886",
"0.5240352",
"0.5200031",
"0.51955175",
"0.517958",
"0.5175846",
"0.5164754",
"0.51611644",
"0.51426494",
"0.51182866... | 0.75167185 | 1 |
Find tutors that overlap with the example tutor. Overlap is True if the tutoring radius (in miles) encompasses the center of the zip code of the example tutor. | def location_overlap(example, df):
def haversin(lat1, lon1, lat2, lon2):
"""
Finds haversin distance (distance along great circle) in miles between two points. Points are defined by latitude and longitude. Radius of the Earth is assumed to be the midpoint between radius at the equator and radius at... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def location_overlap(example, df):\n\n def haversin(lat1, lon1, lat2, lon2):\n \"\"\"\n Finds haversin distance (distance along great circle) in miles between two points. Points are defined by latitude and longitude. Radius of the Earth is assumed to be halfway between radius at the equator and ra... | [
"0.70750934",
"0.5257819",
"0.5189427",
"0.5142412",
"0.50800675",
"0.5071146",
"0.5064199",
"0.50060487",
"0.4999887",
"0.4994238",
"0.49820256",
"0.49649552",
"0.49555677",
"0.49455798",
"0.49086496",
"0.4870724",
"0.48700884",
"0.4860169",
"0.4857932",
"0.4852003",
"0.4837... | 0.60865915 | 1 |
Return the maximal timeUUID for the timestamp immediately preceding the timestamp of the timeUUID ``u`` | def uuid_for_prev_dt(u):
t60 = time60_from_uuid(u)
return max_uuid_from_time60(t60 - 1) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def uuid_for_next_dt(u):\n t60 = time60_from_uuid(u)\n return min_uuid_from_time60(t60 + 1)",
"def time(self, u):\n return self._ll_tree.get_time(u)",
"def timeasc(self, u=NULL):\n nodes = self.preorder(u)\n is_virtual_root = u == self.virtual_root\n time = self.tree_sequence.... | [
"0.6875454",
"0.5700998",
"0.5295624",
"0.5286404",
"0.5175484",
"0.51728743",
"0.51459426",
"0.5110911",
"0.5067966",
"0.5053651",
"0.49741986",
"0.49545303",
"0.49466422",
"0.4941383",
"0.4926041",
"0.4910391",
"0.49034923",
"0.49031386",
"0.48703253",
"0.48479232",
"0.4830... | 0.78562325 | 0 |
Return the minimal timeUUID for the timestamp immediately following the timestamp of the timeUUID ``u`` | def uuid_for_next_dt(u):
t60 = time60_from_uuid(u)
return min_uuid_from_time60(t60 + 1) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def uuid_for_prev_dt(u):\n t60 = time60_from_uuid(u)\n return max_uuid_from_time60(t60 - 1)",
"def timeasc(self, u=NULL):\n nodes = self.preorder(u)\n is_virtual_root = u == self.virtual_root\n time = self.tree_sequence.nodes_time\n if is_virtual_root:\n # We could av... | [
"0.7547403",
"0.58727837",
"0.58409745",
"0.5644322",
"0.54293823",
"0.5402342",
"0.5391127",
"0.5323854",
"0.5316839",
"0.53079647",
"0.52431697",
"0.52279526",
"0.51917505",
"0.51709443",
"0.5132628",
"0.5123987",
"0.51236457",
"0.51182973",
"0.5109323",
"0.5106233",
"0.508... | 0.74544674 | 1 |
Produces a list of ipvanish servers based on a list of tuples mapping base link urls with the maximum number of servers at that base link | def build_ipvanish_server_list(base_links):
server_list = []
pattern = '\d{2}'
for base_link in base_links:
for i in range(1, base_link[1]):
repl = str(i) if i > 9 else '0' + str(i)
server_list.append(re.sub(pattern=pattern, repl=repl, string=base_link[0]))
return server_... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def build_lhosts(self , sws , lhost_count):\n host_count = 0\n for sw in sws:\n for i in range(lhost_count):\n host_id = host_count + 1\n host = self.addHost('h%s' % host_id)\n self.addLink(sw, host)\n host_count += 1\n return host_count",
"def generate_urls(min_nb_urls:... | [
"0.61619484",
"0.5859678",
"0.585341",
"0.57343584",
"0.569007",
"0.5689369",
"0.56832546",
"0.56511176",
"0.5628162",
"0.56157327",
"0.561303",
"0.55909497",
"0.55474263",
"0.5531675",
"0.55298847",
"0.5529174",
"0.55070364",
"0.5491178",
"0.54333997",
"0.5426328",
"0.541290... | 0.7553777 | 0 |
plant the plant to run the simulation and evaluation on orderList the list of orders in the given schedule simulator Simulator instance to run a schedule evaluator Evaluator instance to evaluate a schedule | def __init__(self, plant, orderList, simulator, evaluator):
assert plant != None
assert orderList != None
self.plant = plant
self.orderList = orderList
self.simulator = simulator
self.evaluator = evaluator
# used for benchmarking
self.simulatorTime = 0
# enable/disable console output
self.p... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def run(self):\n\t\tfor order in self.orderList.orders:\n\t\t\tif order.currentMachine != \"\":\n\t\t\t\tfor machineIndex, machine in enumerate(self.plant.machines):\n\t\t\t\t\tif machine.name != order.currentMachine:\n\t\t\t\t\t\torder.recipe[machine.name] = 0\n\t\t\t\t\telse:\n\t\t\t\t\t\torder.recipe[machine.na... | [
"0.59432226",
"0.57756287",
"0.57615817",
"0.57009983",
"0.56140465",
"0.5556902",
"0.55444044",
"0.5472092",
"0.53552353",
"0.5321717",
"0.531743",
"0.52960175",
"0.52925825",
"0.5268188",
"0.5248274",
"0.5220692",
"0.51845366",
"0.5179039",
"0.51710725",
"0.5170568",
"0.516... | 0.61185306 | 0 |
Loads the optimizer configuration and parameters from an XML tree. | def fromXml(xmlDoc, plant, orderList, simulator, evaluator):
optimizer = Optimizer(plant, orderList, simulator, evaluator)
element = xmlDoc.getElementsByTagName("optimizer")
# there should only be 1 optimizer node in the XML tree!
assert len(element) == 1
element = element[0]
# load the different attr... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def fromXmlFile(filename, plant, orderList, simulator, evaluator):\n\t\tfile = open(filename, \"r\")\n\t\tdoc = minidom.parse(file)\n\t\toptimizer = Optimizer.fromXml(doc, plant, orderList, simulator, evaluator)\n\t\tfile.close()\n\t\treturn optimizer",
"def load_optimizers(self, epoch):\n for i, optimize... | [
"0.6175428",
"0.56519014",
"0.55918264",
"0.52400386",
"0.52340543",
"0.523264",
"0.51560336",
"0.5096265",
"0.5075031",
"0.5075031",
"0.5051692",
"0.5042199",
"0.50002724",
"0.5000191",
"0.49910793",
"0.49754536",
"0.49645132",
"0.49581805",
"0.49380955",
"0.4926841",
"0.491... | 0.6538787 | 0 |
Loads the optimizer configuration and parameters from an XML tree. | def fromXmlFile(filename, plant, orderList, simulator, evaluator):
file = open(filename, "r")
doc = minidom.parse(file)
optimizer = Optimizer.fromXml(doc, plant, orderList, simulator, evaluator)
file.close()
return optimizer | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def fromXml(xmlDoc, plant, orderList, simulator, evaluator):\n\t\toptimizer = Optimizer(plant, orderList, simulator, evaluator)\n\t\telement = xmlDoc.getElementsByTagName(\"optimizer\")\n\t\t\n\t\t# there should only be 1 optimizer node in the XML tree!\n\t\tassert len(element) == 1\n\t\telement = element[0]\n\t\t... | [
"0.65392506",
"0.56529593",
"0.55924976",
"0.5241462",
"0.52335566",
"0.5231203",
"0.51571965",
"0.5095915",
"0.5076655",
"0.5076655",
"0.50514704",
"0.504248",
"0.4999424",
"0.49989522",
"0.49908182",
"0.4976616",
"0.49651513",
"0.4957215",
"0.49371922",
"0.49262917",
"0.491... | 0.6176162 | 1 |
Sorts the population based on fitness, to have the better individuals at the beginning of the population list. | def sortPopulation(self, population):
population.sort(lambda a, b: cmp(b.fitness, a.fitness)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sort_population(self):\n self.population.sort(key=lambda x: x.fitness, reverse=True)",
"def sortPopulation(self):\n self.population = sorted(self.population, key=attrgetter('fitness'), reverse=True)",
"def sort_population(self, population):\n tmp = [(self.fitness(x), x) for x in popula... | [
"0.8792376",
"0.85877204",
"0.8453918",
"0.8357939",
"0.81025845",
"0.7807377",
"0.7658872",
"0.7562999",
"0.75352323",
"0.7491212",
"0.703288",
"0.6924064",
"0.6879828",
"0.65743184",
"0.6401527",
"0.63301927",
"0.6319435",
"0.6304908",
"0.6303164",
"0.62201196",
"0.6193228"... | 0.8772172 | 1 |
Mutates a population. Selects the best n individuals (based on the selectionRate) to mutate (maybe they'll give us even better individuals!). After mutating an individual, it checks if we have an individual that is similar to the mutated one, if so, then try to mutate again, otherwise, we simply calculate its fitness a... | def mutatePopulation(self, population):
for i in range(int(math.ceil(self.selectionRate * len(population)))):
mutatedIndiv = self.mutateIndividual(population[i])
while self.isIndividualInPopulation(mutatedIndiv, population) == True:
mutatedIndiv = self.mutateIndividual(population[i])
self.calcIndividualF... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def fitness_proportionate_selection(random, population, args):\r\n num_selected = args.setdefault('num_selected', 1)\r\n len_pop = len(population)\r\n psum = [i for i in range(len_pop)]\r\n pop_max_fit = (max(population)).fitness\r\n pop_min_fit = (min(population)).fitness\r\n \r\n # If we're ... | [
"0.69687045",
"0.6867652",
"0.68638057",
"0.6850501",
"0.6847528",
"0.6783619",
"0.6715495",
"0.6658223",
"0.6632159",
"0.6594578",
"0.65939194",
"0.6568971",
"0.6538658",
"0.6468645",
"0.64661646",
"0.6450038",
"0.64373183",
"0.6428205",
"0.64249825",
"0.64058185",
"0.639774... | 0.7991917 | 0 |
Checks if an individual is in a population. | def isIndividualInPopulation(self, individual, population):
for i in population:
if i == individual:
return True
return False | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __eq__(self, population):\n return self.chromosome_list == population.chromosome_list",
"def test_create_population():\n pop = Population()\n assert len(pop.population) == POPULATION_SIZE\n assert isinstance(pop.population[0], Individual)",
"def test_if_households(self, pop_size, cell_numbe... | [
"0.63011485",
"0.5875469",
"0.5873875",
"0.5841512",
"0.5733281",
"0.5730178",
"0.5723089",
"0.5708155",
"0.57066196",
"0.5702802",
"0.567919",
"0.5665297",
"0.56181157",
"0.5569913",
"0.55618745",
"0.55400103",
"0.5518681",
"0.5490887",
"0.5469354",
"0.54638547",
"0.5458895"... | 0.8702243 | 0 |
Gets a value and returns a mutation of it based on the mutation range. | def mutateGene(self, value):
addent = int(random.uniform(0, self.mutationRange))
if (random.uniform(0, 1) < 0.5):
addent = -addent
return max(0, value + addent) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def mutation(self, i: int) -> Character:\n chance = random.uniform(0, 1)\n if chance <= self.mutation_rate:\n return self.mutate_candidate(i)\n else:\n return self.characters[i]",
"def nonuniform_bounds_mutation(random, candidate, args):\n lower_bound = args.get(... | [
"0.58428115",
"0.5832275",
"0.5817219",
"0.5630326",
"0.560835",
"0.55799025",
"0.5576195",
"0.5544933",
"0.552608",
"0.54787016",
"0.5458468",
"0.5421918",
"0.5400586",
"0.53984797",
"0.5384184",
"0.5369752",
"0.53165054",
"0.5312617",
"0.53016484",
"0.52554405",
"0.5254125"... | 0.72127736 | 0 |
Generates an initial individual based on order deadlines minimum processing time. Account whether an order has a current machine and current overtime. | def initialIndividual(self):
indiv = Schedule()
for o in self.orderList.orders:
if o.currentMachine == "":
minProcTime = o.recipe.calcMinProcTime(self.plant)
machineName = o.recipe.recipe[0][0]
else:
machineName = o.currentMachine
minProcTime = o.recipe.calcMinProcTime(self.plant, o.current... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def order_gen(id):\n print(\"order_gen({}): Running\".format(id))\n order_serv = order_service()\n # State: Party arrives and order is placed\n order = generate_customer_order()\n order_id = order_serv.post_order(order)\n # Order sits in queue until picked up by kitchen (0-60 seconds)\n wait_f... | [
"0.5646776",
"0.545152",
"0.5418118",
"0.5372268",
"0.5293245",
"0.5265639",
"0.52388227",
"0.51672685",
"0.5162666",
"0.5142661",
"0.5131359",
"0.50972575",
"0.5094282",
"0.5040369",
"0.50282997",
"0.4998474",
"0.49938425",
"0.4993136",
"0.4987861",
"0.49778897",
"0.4961934"... | 0.7244825 | 0 |
Read the FOX news comments dataset | def read_fox_comments_dataset():
with open("../data/fox-news-comments.json") as f:
df = pd.DataFrame([json.loads(line) for line in f.readlines()])
# Remove irrelevant columns
for col_name in ["title", "succ", "meta", "user", "mentions", "prev"]:
del df[col_name]
return df | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _readComments(self): \n self.NSCOML = nappy.utils.text_parser.readItemFromLine(self.file.readline(), int)\n self._readSpecialComments()\n self.NNCOML = nappy.utils.text_parser.readItemFromLine(self.file.readline(), int)\n self._readNormalComments()",
"def build_newscomment_... | [
"0.6613977",
"0.66035354",
"0.6589387",
"0.6565567",
"0.6328277",
"0.6315353",
"0.62736416",
"0.6235053",
"0.6230559",
"0.62116027",
"0.61937684",
"0.618935",
"0.6171583",
"0.617056",
"0.6168108",
"0.6103563",
"0.60896647",
"0.60525465",
"0.6033793",
"0.6008262",
"0.6007036",... | 0.74015456 | 0 |
Applies a directional scaling to a set of vectors. An example usage for this is to flatten a mesh against a single plane. Direction MUST be normalised prior to this call. | def apply_direction_scale( vectors, direction, scale ):
"""
scaling is defined as:
[p'][1 + (k - 1)n.x^2, (k - 1)n.x n.y^2, (k - 1)n.x n.z ]
S(n,k) = [q'][(k - 1)n.x n.y, 1 + (k - 1)n.y, (k - 1)n.y n.z ]
[r'][(k - 1)n.x n.z, (k - 1)n.y n.z, 1 + (k - 1)n.z^2 ]
where:
v' ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def apply_scale( vectors, scale ):\n # create a scaling matrix\n matrix = numpy.array([\n [ scale[ 0 ], 0.0, 0.0 ],\n [ 0.0, scale[ 1 ], 0.0 ],\n [ 0.0, 0.0, scale[ 2 ] ]\n ])\n return numpy.dot( vectors, matrix )",
"def scale_vectors(vectors, f):\n return [scale_vector(ve... | [
"0.6662197",
"0.6507097",
"0.61409515",
"0.608848",
"0.5960277",
"0.59000295",
"0.5844457",
"0.5774308",
"0.566719",
"0.5564189",
"0.545749",
"0.5408552",
"0.5405568",
"0.5393711",
"0.5342308",
"0.5331461",
"0.53202534",
"0.53033173",
"0.5275942",
"0.52735925",
"0.5238962",
... | 0.72134334 | 0 |
Applies a 3 dimensional scale to a set of vectors. | def apply_scale( vectors, scale ):
# create a scaling matrix
matrix = numpy.array([
[ scale[ 0 ], 0.0, 0.0 ],
[ 0.0, scale[ 1 ], 0.0 ],
[ 0.0, 0.0, scale[ 2 ] ]
])
return numpy.dot( vectors, matrix ) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def scale_vectors(vectors, f):\n return [scale_vector(vector, f) for vector in vectors]",
"def apply_scale( vertices, scale=1.0 ):\n checkVerticesValidity( vertices )\n if type(scale) != float:\n raise ValueError\n \n for i in range(len(vertices)):\n v = vertices[i]\n tmpv = [... | [
"0.71041596",
"0.6487279",
"0.6485424",
"0.64662945",
"0.6345029",
"0.6303627",
"0.6060879",
"0.6046138",
"0.6014817",
"0.59162086",
"0.59115326",
"0.5910346",
"0.58851117",
"0.5880268",
"0.58379424",
"0.58329576",
"0.58122903",
"0.5797459",
"0.57912207",
"0.5773743",
"0.5767... | 0.74894387 | 0 |
Get extras for a gym.envs.toy_text.nchain.NChainEnv | def nchain_extras(env, gamma=0.99):
# How to handle <TimeLimit<______>> and other Wrappers?
# assert isinstance(env, gym.envs.toy_text.nchain.NChainEnv)
# Action constants
A_FORWARD = 0
A_BACKWARD = 1
states = np.arange(env.observation_space.n)
actions = np.arange(env.action_space.n)
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _create_extra_environment(self):\n return {}",
"def extra_options():\n extra_vars = {\n 'PrgEnv': [None, 'PrgEnv module to load, e.g., cray to load PrgEnv-cray, or None for automatic determination', CUSTOM],\n 'PrgEnv_load': [True, 'Load the PrgEnv module (if True) or just... | [
"0.6121834",
"0.59275204",
"0.55134636",
"0.5486935",
"0.5448152",
"0.54007024",
"0.53850096",
"0.5237784",
"0.5176097",
"0.51628774",
"0.51099735",
"0.51046485",
"0.5087031",
"0.49787325",
"0.4952122",
"0.4868638",
"0.48628587",
"0.48443142",
"0.48385563",
"0.47918582",
"0.4... | 0.6883841 | 0 |
Set vacancy probabilities uniformly to 1 / cardinality of vacancy difference values | def set_uniform_probabilities(self, sentence_aligned_corpus):
max_m = longest_target_sentence_length(sentence_aligned_corpus)
# The maximum vacancy difference occurs when a word is placed in
# the last available position m of the target sentence and the
# previous word position has no v... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def generate_probabilities(self):\n k = 1\n v= 10\n for g in self.class_probabilities:\n curr_list = self.class_probabilities[g]\n for l in range(0,28):\n for w in range(0,28):\n total = float(curr_list[l][w][0] + curr_list[l][w][1] + cur... | [
"0.5957107",
"0.569719",
"0.56520617",
"0.5646898",
"0.56298685",
"0.55891985",
"0.5551407",
"0.5541458",
"0.55115247",
"0.54994756",
"0.5426839",
"0.53675914",
"0.5358651",
"0.5353575",
"0.5332675",
"0.5331621",
"0.53201914",
"0.53198093",
"0.53125113",
"0.5294195",
"0.52913... | 0.6676441 | 0 |
Sample the most probable alignments from the entire alignment space according to Model 4 Note that Model 4 scoring is used instead of Model 5 because the latter is too expensive to compute. First, determine the best alignment according to IBM Model 2. With this initial alignment, use hill climbing to determine the best... | def sample(self, sentence_pair):
sampled_alignments, best_alignment = super().sample(sentence_pair)
return self.prune(sampled_alignments), best_alignment | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def hillclimb(self, alignment_info, j_pegged=None):\n alignment = alignment_info # alias with shorter name\n max_probability = IBMModel4.model4_prob_t_a_given_s(alignment, self)\n\n while True:\n old_alignment = alignment\n for neighbor_alignment in self.neighboring(alig... | [
"0.64931434",
"0.58632374",
"0.5576467",
"0.5523818",
"0.54998684",
"0.5340197",
"0.5302737",
"0.52337885",
"0.5228561",
"0.52062106",
"0.51976055",
"0.5142426",
"0.509536",
"0.5090835",
"0.50627726",
"0.5054674",
"0.50210255",
"0.4973705",
"0.4956885",
"0.49396443",
"0.49353... | 0.59935933 | 1 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.