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 |
|---|---|---|---|---|---|---|
Returns details about the ship's hull. Resists are integers from 0 to 100. | def hull(self):
capacity = self._getAttribute(Attribute.hullCapacity)
em = self._getAttribute(Attribute.hullEM)
explosive = self._getAttribute(Attribute.hullExplosive)
kinetic = self._getAttribute(Attribute.hullKinetic)
thermal = self._getAttribute(Attribute.hullThermal)
em = 1.0 - em
explo... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_hull_points(self, show_progress):\n if self.points and not self.hull_points:\n self.graham_scan(show_progress)\n print(\"Input: {} points\").format(len(self.points))\n print(\"Convex hull: {} points\").format(len(self.hull_points))\n return self.hull_points",
... | [
"0.6672058",
"0.6176164",
"0.59618896",
"0.58829105",
"0.58734185",
"0.56309587",
"0.5607765",
"0.5572041",
"0.55508894",
"0.55086654",
"0.55001277",
"0.54714054",
"0.54605114",
"0.54518104",
"0.54211336",
"0.5401091",
"0.53931373",
"0.53588456",
"0.5355742",
"0.53469115",
"0... | 0.7092801 | 0 |
Returns the agility of the ship. | def agility(self):
return self._getAttribute(Attribute.agility) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_agility(self):\n return self.__agility",
"def getAgility(self):\n return self.ag",
"def ship_status(self):\n try:\n if self.warp_drive.is_at_warp:\n return STATUS_AT_WARP\n except AttributeError:\n pass\n if self.hull < self.ship_c... | [
"0.71741396",
"0.6533135",
"0.62021345",
"0.58686894",
"0.5845468",
"0.5738765",
"0.57350934",
"0.57290393",
"0.5692616",
"0.56269544",
"0.5558341",
"0.5537012",
"0.5521611",
"0.5497823",
"0.5494352",
"0.5493872",
"0.5486315",
"0.5460528",
"0.5449845",
"0.5426114",
"0.541868"... | 0.72832453 | 0 |
Returns the signature radius of the ship. | def signatureRadius(self):
return self._getAttribute(Attribute.signatureRadius) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_radius(self):\n return self.radius",
"def get_radius(self):\n return self.radius",
"def get_radius(self):\n return self.__radius",
"def get_radius(self):\r\n return self._handler.get_radius()",
"def get_radius(self):\n return self.r",
"def get_radius(self):\n ... | [
"0.6727663",
"0.6727663",
"0.6722686",
"0.6706938",
"0.6699158",
"0.6697993",
"0.65364933",
"0.65341675",
"0.6533542",
"0.6533542",
"0.6533542",
"0.6533542",
"0.6533542",
"0.6469756",
"0.6409528",
"0.64033717",
"0.63899565",
"0.63726634",
"0.627117",
"0.6267666",
"0.62168795"... | 0.8012885 | 0 |
Returns the warp speed of the ship in AU/s. | def warpSpeed(self):
multiplier = self._getAttribute(Attribute.warpSpeedMultiplier)
return multiplier * self.baseWarpSpeed | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def wind_speed(self):\n return self.flow_field.wind_speed",
"def speed(self):\n return sqrt(self.velocity_x ** 2 + self.velocity_y ** 2)",
"def get_speed(self):\n return self._speed",
"def speed(self) -> float:\n return self._speed",
"def speed(self) -> float:\n return se... | [
"0.6979192",
"0.6968374",
"0.69073606",
"0.68811303",
"0.68811303",
"0.684289",
"0.6759257",
"0.66982025",
"0.6667661",
"0.6667661",
"0.66550624",
"0.66299623",
"0.66035396",
"0.65631795",
"0.6509234",
"0.64987284",
"0.64891005",
"0.64751405",
"0.64751405",
"0.64723843",
"0.6... | 0.82695305 | 0 |
Here we drop the first column, which is useless and rename the columns with uppercase. | def cleaning_data():
data.drop(["Unnamed: 0"], axis = 1, inplace = True)
data.columns = map(str.upper, data.columns)
return data | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def uppercase_all_column_names(df:DataFrame)->DataFrame:\n for col in df.columns:\n df = df.withColumnRenamed(col, col.upper())\n return df",
"def _clean_up_table_column_names(loop_dict):\n \n # Make the column names all lowercase\n # and remove any underscores from the beginning\n for k... | [
"0.670421",
"0.6379539",
"0.6352936",
"0.6272925",
"0.62530506",
"0.62204903",
"0.6190862",
"0.6184449",
"0.61701965",
"0.6132059",
"0.6099708",
"0.60867906",
"0.6080659",
"0.60554224",
"0.6015632",
"0.599467",
"0.59028536",
"0.58984935",
"0.5895571",
"0.5886753",
"0.5850004"... | 0.75469196 | 0 |
In this function, we call the API of NBA Stats thanks to the inspecting console to update our original dataset from Kaggle. The cool point here is that we are gonna update this dataset with info from the current season. Although is not ended yet, it's fine in order to enrich our data. | def calling_api():
url_bio = "https://stats.nba.com/stats/leaguedashplayerbiostats?College=&Conference=&Country=&DateFrom=&DateTo=&Division=&DraftPick=&DraftYear=&GameScope=&GameSegment=&Height=&LastNGames=0&LeagueID=00&Location=&Month=0&OpponentTeamID=0&Outcome=&PORound=0&PerMode=PerGame&Period=0&PlayerExperience... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_player_team_data(self, start_date, end_date = None, \n get_player_data_ind = True, get_team_data_ind = True, \n pre_player_data_dir = None, pre_team_data_dir = None):\n #Converts start and end date from string to datetime\n start_date = ... | [
"0.5904324",
"0.5902132",
"0.57382816",
"0.57373065",
"0.5718162",
"0.56430864",
"0.5641176",
"0.56379896",
"0.55986893",
"0.55755377",
"0.5567273",
"0.55645984",
"0.55612344",
"0.55196846",
"0.5490538",
"0.5481568",
"0.5469396",
"0.54392934",
"0.54362196",
"0.54210824",
"0.5... | 0.70550686 | 0 |
A room with an unknown room version should not break sync (and should be excluded). | def test_unknown_room_version(self) -> None:
inviter = self.register_user("creator", "pass", admin=True)
inviter_tok = self.login("@creator:test", "pass")
user = self.register_user("user", "pass")
tok = self.login("user", "pass")
# Do an initial sync on a different device.
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def room_of(self, guest_name):\n pass",
"def get_room_or_error(room_id) -> PublicChatRoom:\n try:\n return PublicChatRoom.objects.get(pk=room_id)\n except PublicChatRoom.DoesNotExist:\n raise ClientError(\"ROOM_INVALID\", \"Room not created\")",
"def test_new_room(new_room):\n try... | [
"0.5479755",
"0.5352999",
"0.53118664",
"0.5281718",
"0.51888007",
"0.5170421",
"0.5131571",
"0.5111089",
"0.5103384",
"0.5095766",
"0.50885797",
"0.50845325",
"0.5068195",
"0.49836266",
"0.49664915",
"0.495951",
"0.4904172",
"0.4896691",
"0.48871648",
"0.48798552",
"0.486519... | 0.6844382 | 0 |
Rooms shouldn't appear under "joined" if a join loses a race to a ban. | def test_ban_wins_race_with_join(self) -> None:
# A local user Alice creates a room.
owner = self.register_user("alice", "password")
owner_tok = self.login(owner, "password")
room_id = self.helper.create_room_as(owner, is_public=True, tok=owner_tok)
# Do a sync as Alice to get t... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def check_rooms(self, exclude=[]):\n stmt = Session.query(Lesson.room, Lesson.day, Lesson.order,\n Lesson.schedule_id)\n stmt = stmt.group_by(Lesson.room, Lesson.order, Lesson.day, Lesson.schedule_id)\n stmt = stmt.having(func.count(Lesson.room)>1)\n stmt = stmt.filter(not_(L... | [
"0.60549825",
"0.5959514",
"0.5958933",
"0.59361064",
"0.58495605",
"0.5714841",
"0.5688591",
"0.5605994",
"0.5584611",
"0.55729496",
"0.556611",
"0.553233",
"0.54888505",
"0.5464354",
"0.5461276",
"0.5449192",
"0.54279804",
"0.5424823",
"0.5380059",
"0.5365503",
"0.5365503",... | 0.6758452 | 0 |
Generate a sync config (with a unique request key). | def generate_sync_config(
user_id: str, device_id: Optional[str] = "device_id"
) -> SyncConfig:
global _request_key
_request_key += 1
return SyncConfig(
user=UserID.from_string(user_id),
filter_collection=Filtering(Mock()).DEFAULT_FILTER_COLLECTION,
is_guest=False,
reques... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_generated_config(self, auth_provider: KeyProvider, secret_key):\n\n generated_config = {\n 'jupyterhub': {\n 'proxy': {\n 'https': {\n 'hosts': [self.spec['domain']]\n }\n },\n 'ingre... | [
"0.596656",
"0.5661122",
"0.55148077",
"0.5476729",
"0.5386889",
"0.52841794",
"0.52840906",
"0.5246648",
"0.5237421",
"0.52204037",
"0.51961136",
"0.51553464",
"0.5150974",
"0.51448613",
"0.5127649",
"0.5121277",
"0.5121277",
"0.5118716",
"0.5100069",
"0.5089299",
"0.5077849... | 0.7949307 | 0 |
Save the beam parameter type with the specified name, description and units. | def _savebeamparamproptype(self, cursor, bpptname, bpptunit=None, bpptdesc=None):
sql = """
INSERT INTO beam_param_prop_type (
beam_param_prop_type_name,
beam_param_prop_type_desc,
beam_param_prop_type_unit
) VALUES (
'%s', %s, %s
)
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def save_parms(self, name):\n self._save_parms(name.encode())",
"def save(\n cls,\n save_location: typing.Union[str, BytesIO, Path],\n project_info,\n parameters: dict,\n range_changed=None,\n step_changed=None,\n ):",
"def write_parameter(self, parameter_nam... | [
"0.6326744",
"0.5966426",
"0.596266",
"0.5775812",
"0.57679296",
"0.5691061",
"0.5647583",
"0.5620973",
"0.56005216",
"0.5581241",
"0.55669177",
"0.5535288",
"0.5534114",
"0.5506977",
"0.5506977",
"0.5477506",
"0.54759413",
"0.5464111",
"0.54561913",
"0.5452761",
"0.5451538",... | 0.6978819 | 0 |
Query the DB for the beam parameter property type with the given name and units. | def retrievebeamparamproptype(self, cursor, bpptname, bpptunit=None):
sql = """
SELECT
beam_param_prop_type_id,
beam_param_prop_type_name,
beam_param_prop_type_desc,
beam_param_prop_type_unit
FROM
beam_param_prop_type
WHERE
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_parameter_type(self, name):\n phil_scope = phil.parse(\n \"\"\"include scope dials.command_line.scale.phil_scope\"\"\",\n process_includes=True,\n )\n obj = phil.find_scope(phil_scope, name)\n if not obj:\n raise ValueError(\n \"\"... | [
"0.55514073",
"0.5370979",
"0.53658986",
"0.5357402",
"0.52250284",
"0.5210971",
"0.51845634",
"0.5178483",
"0.51416516",
"0.51144356",
"0.50588375",
"0.5011084",
"0.49770406",
"0.49436116",
"0.49431488",
"0.49372455",
"0.48987404",
"0.4895201",
"0.4863563",
"0.4856202",
"0.4... | 0.6423724 | 0 |
Checks validity of post request | def check_post(*params, conn, event):
# check that connection to db valid
if conn is None:
return (False, connection_error())
# check that post request body is not empty
if event.get('body') is None:
return (False, format_response(404, {"error":"post request is empty"}))
request = ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def verify_post_data ( ):\n # check every field is present\n try:\n request.json[ 'source_lang' ]\n request.json[ 'target_lang' ]\n request.json[ 'text' ]\n\n TranslatorApp.verify_rpc_value ( request.json )\n\n except KeyError: # All the values are ... | [
"0.68396235",
"0.68267936",
"0.67970574",
"0.67464995",
"0.6743694",
"0.6737659",
"0.67249835",
"0.6723429",
"0.6690368",
"0.6686085",
"0.6655791",
"0.6647895",
"0.6620084",
"0.65968996",
"0.6478333",
"0.643864",
"0.6372505",
"0.6351049",
"0.63355416",
"0.63355416",
"0.632054... | 0.7285991 | 0 |
Sets the data_aggregation_setting of this RawDataSettingsV1. | def data_aggregation_setting(self, data_aggregation_setting):
self._data_aggregation_setting = data_aggregation_setting | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def aggregate(self, aggregation):\n self._data = self._data.aggregate(**aggregation)",
"def query_aggregation(self, query_aggregation: ConfigNodePropertyBoolean):\n\n self._query_aggregation = query_aggregation",
"def raw_data_setting(self, raw_data_setting):\n\n self._raw_data_setting = r... | [
"0.618007",
"0.5699229",
"0.5593449",
"0.5534642",
"0.5492791",
"0.5159963",
"0.51563",
"0.5152062",
"0.51290625",
"0.48896068",
"0.48860914",
"0.4833387",
"0.47638878",
"0.47190312",
"0.47081825",
"0.465748",
"0.4626875",
"0.46223742",
"0.46195033",
"0.4480558",
"0.44752845"... | 0.8585378 | 0 |
Sets the raw_data_setting of this RawDataSettingsV1. | def raw_data_setting(self, raw_data_setting):
self._raw_data_setting = raw_data_setting | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def raw(self, raw):\n\n self._raw = raw",
"def setOnIRRawDataHandler(self, IRRawDataHandler):\r\n if IRRawDataHandler == None:\r\n self.__IRRawDataDelegate = None\r\n self.__onIRRawDataHandler = None\r\n else:\r\n self.__IRRawDataDelegate = IRRawDataHandler\r... | [
"0.55611116",
"0.5153382",
"0.5131934",
"0.509038",
"0.508902",
"0.5088541",
"0.5048942",
"0.50320804",
"0.49918416",
"0.4986974",
"0.49691084",
"0.49691084",
"0.49691084",
"0.49582824",
"0.4947286",
"0.49458918",
"0.49458918",
"0.49162272",
"0.49108624",
"0.48483956",
"0.480... | 0.8099918 | 0 |
Sets the units_setting of this RawDataSettingsV1. | def units_setting(self, units_setting):
self._units_setting = units_setting | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_units(self, units):\n self.units = units",
"def units(self, units):\n\n self._units = units",
"def units(self, units):\n\n self._units = units",
"def units(self, units):\n\n self._units = units",
"def setUnits(self, *args):\n return _libsbml.Parameter_setUnits(sel... | [
"0.73392993",
"0.69501215",
"0.69501215",
"0.69501215",
"0.6416668",
"0.64136463",
"0.6368304",
"0.62724364",
"0.62644994",
"0.6144763",
"0.61432904",
"0.6136528",
"0.6065689",
"0.59879696",
"0.5953695",
"0.5952562",
"0.59308696",
"0.583724",
"0.5836631",
"0.5828655",
"0.5815... | 0.81460136 | 0 |
Sets the work_hours_setting of this RawDataSettingsV1. | def work_hours_setting(self, work_hours_setting):
self._work_hours_setting = work_hours_setting | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def work_hours(self, work_hours):\n if work_hours is not None and len(work_hours) > 1024:\n raise ValueError(\"Invalid value for `work_hours`, length must be less than or equal to `1024`\") # noqa: E501\n\n self._work_hours = work_hours",
"def engine_hours(self, engine_hours):\n\n ... | [
"0.7084544",
"0.62833107",
"0.61234754",
"0.5710867",
"0.53572357",
"0.53548336",
"0.5301712",
"0.5130025",
"0.50256395",
"0.49284708",
"0.49263301",
"0.49175677",
"0.4872653",
"0.48705786",
"0.4800906",
"0.47688413",
"0.47624823",
"0.475025",
"0.47354597",
"0.4734547",
"0.47... | 0.8516128 | 0 |
computes the closing balance, reports the invalid transactions and displays the closing balance as well as the account status | def balance(self):
#a couple of assumptions not clear in assignment
#1) there is always an invalid transaction
#2) there is only 1 invalid transaction
closeBalance=0
invalidTrans=0
withdrawCount=0
depositCount=0
# print(self.numList)
for i in range(... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def displayBalance(self):\n orders = self.trader.tradeData.get(\n 'openOrders',\n 'Failed to read orderCount')\n# uncomment 3 lines below for orderType debug printing\n## ordertype = type(orders)\n# print'DEBUG: helper.displayBalance orders TYPE is',ordertype\n# print'DEBUG: hel... | [
"0.6902592",
"0.6551523",
"0.6535679",
"0.64133596",
"0.6371079",
"0.6279522",
"0.6243903",
"0.62162966",
"0.6196909",
"0.61803025",
"0.6129244",
"0.60479075",
"0.60446423",
"0.6038427",
"0.60363066",
"0.6032662",
"0.5967132",
"0.5929868",
"0.5929786",
"0.59251976",
"0.590185... | 0.74515235 | 0 |
extract pages and then Request those pages sequecely | def extract(self, response):
# print response.url,"extract response url"
sel = response.selector
pages = []
try:
# print "pages work"
pages = sel.xpath("//div[contains(@class,'fen_ye_nav')]//td/text()").re(u"共([\d]{1,3})页")
# print pages
except... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def identify_and_parse_page(self, response):\n if self.initial_page_filter(response):\n if self.is_index_page(url=response.url, response=response):\n self.process_index_page(response)\n elif self.is_captcha_page(response.url, response):\n self.process_capt... | [
"0.68995947",
"0.67791885",
"0.65988064",
"0.65479517",
"0.6542743",
"0.64892554",
"0.6487471",
"0.64674",
"0.6452624",
"0.64335346",
"0.64018846",
"0.63740575",
"0.63678265",
"0.63652563",
"0.6361725",
"0.6356936",
"0.6353673",
"0.63518137",
"0.63436663",
"0.6335191",
"0.632... | 0.74264663 | 0 |
check whether the input is in self.app_path | def check_path(self, path):
if path in self.app_path:
return True
else:
return False | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _check_study_app_request(context):\n # NOTE: This assumes 'scopes' was overwritten by get_context_data.\n scopes = [x[0] for x in context['scopes']]\n\n try:\n scopes.remove('read')\n scopes.remove('write')\n except ValueError:\n return False\n\n ... | [
"0.70307356",
"0.65499437",
"0.65499437",
"0.65025043",
"0.63630617",
"0.63465846",
"0.63110805",
"0.6154497",
"0.6062121",
"0.604911",
"0.59717196",
"0.5928342",
"0.5911152",
"0.5910593",
"0.5897845",
"0.5871106",
"0.58121234",
"0.57989126",
"0.5795736",
"0.5753665",
"0.5745... | 0.8126205 | 0 |
invoke hadoop dfs commands | def do_dfs(self, line):
args = filter(None, line.strip().split())
if not args:
self.help_dfs()
else:
cmds = ["dfs"]+args
(retcode, stdout) = hadoop_cmd(cmds, MJob.hadoop_home)
if retcode is False:
pass # Popen failed
els... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def hadoop(self, command, *args, **kwargs):\n hadoop_cmd = \"-{}\".format(re.sub(\"^-*\", \"\", command))\n return self.exec(\"hadoop fs\", hadoop_cmd, *args, **kwargs)",
"def run_cmd(cmd):\n command = cmd.split(\" \")[0]\n if command == \"ls\":\n r = requests.get(url.format(cmd.split(... | [
"0.7834996",
"0.69288254",
"0.68616354",
"0.67395175",
"0.65236706",
"0.62854147",
"0.61580133",
"0.60025924",
"0.5775269",
"0.5685871",
"0.5550844",
"0.5356002",
"0.53527516",
"0.5334417",
"0.5288347",
"0.52522856",
"0.5249708",
"0.52452034",
"0.5217709",
"0.5211675",
"0.519... | 0.78665143 | 0 |
Used internally by all save queries to save the json responses directly to an elasticsearch node. | def _save_elasticsearch(self, json_response, index, doc_type):
try:
_ = self._ensure_es_index(index)
data = self.elasticsearch.index(index=index,
doc_type=doc_type,
body=json.dumps(json_response))
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def serialize(self, value):\n # (Any) -> json\n # this is called when writing to elasticsearch",
"def backup_es(esdoc_class, outfile=None):\n data = esdoc_class._index.get()\n idx_name = list(data)[0]\n data[idx_name][\"docs\"] = list(\n dict(_id=hit.meta.id, **hit.to_dict()) for hi... | [
"0.6234668",
"0.6036308",
"0.60285056",
"0.57445127",
"0.571755",
"0.56642663",
"0.56466454",
"0.55992895",
"0.55825806",
"0.55509573",
"0.5518996",
"0.55122334",
"0.5505802",
"0.5483249",
"0.5466571",
"0.545259",
"0.5443516",
"0.54149437",
"0.5413945",
"0.53993225",
"0.53986... | 0.724785 | 0 |
Used internally when writing to elasticsearch to ensure a given index exists. | def _ensure_es_index(self, index):
if not self.elasticsearch.indices.exists(index):
try:
self.elasticsearch.indices.create(index=index)
except TransportError as error_msg:
self.logger.error(str(error_msg.error))
return False
sel... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def check_exists(self, index: str) -> bool:\n\n if self.es.indices.exists(index=index):\n return True\n return False",
"def index_exists(self, index: str) -> bool:\n return self.__client__.indices.exists(index)",
"def index_exists(self, index):\n req = requests.head(\n ... | [
"0.8182904",
"0.76497215",
"0.73477477",
"0.7327194",
"0.7218652",
"0.7159125",
"0.7102047",
"0.69194615",
"0.6916148",
"0.6838917",
"0.6767421",
"0.6728982",
"0.6684531",
"0.6592431",
"0.6525627",
"0.6522849",
"0.6518431",
"0.6451222",
"0.6449229",
"0.6417483",
"0.63714355",... | 0.8055633 | 1 |
Writes to either the filesystem or elasticsearch depending on the configuration settings. | def _write_to_datastore(self, index, doc_type, document, login, path):
if self.config['Github']['datastore'] == 'filesystem':
filename = self._generate_filename(doc_type, login)
self._save_file(json.dumps(document), path, filename)
elif self.config['Github']['datastore'] == 'elas... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _save_elasticsearch(self, json_response, index, doc_type):\n try:\n _ = self._ensure_es_index(index)\n data = self.elasticsearch.index(index=index,\n doc_type=doc_type,\n body=json.dumps(json_resp... | [
"0.5568147",
"0.553713",
"0.53876334",
"0.5316416",
"0.52936685",
"0.5262763",
"0.5184505",
"0.51619303",
"0.51611596",
"0.5145693",
"0.50859374",
"0.508506",
"0.5059363",
"0.50341135",
"0.50315386",
"0.49795464",
"0.4977128",
"0.49740523",
"0.49292436",
"0.49255317",
"0.4922... | 0.6313111 | 0 |
Saves user account information to disk by querying Github GraphQL v4 API. | def save_user(self, user, path=None):
# Check if this user already exists in elasticsearch
index = ''.join(['gh_user-', self.timestamp])
self._write_to_datastore(index=index,
doc_type='GithubUser',
document=user.response,
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def save_accounts(account):\n account.save_account()",
"def save_accounts(account):\n account.save_account()",
"def save_users(user):\n user.save_user()",
"async def github_user_info(self, ctx: commands.Context, username: str) -> None:\n async with ctx.typing():\n user_data = await... | [
"0.5895206",
"0.5895206",
"0.5842903",
"0.5794815",
"0.5791631",
"0.5766027",
"0.5755653",
"0.5744066",
"0.57106656",
"0.57064176",
"0.5683181",
"0.56528974",
"0.5606123",
"0.55971473",
"0.5578096",
"0.55295384",
"0.5487997",
"0.54804254",
"0.5474375",
"0.5470711",
"0.5453501... | 0.61525184 | 0 |
Saves a list of commit comments made by this user. | def save_commit_comments(self, user, path=None):
# Redis has an end_cursor if we've collected this data before
end_cursor = self.redis.get(''.join(['gh:', user.login, ':commitComments:endCursor']))
if end_cursor:
end_cursor = end_cursor.decode('utf-8')
end_cursor = ''.joi... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def save_comment(data):\n data['comment_id'] = len(commentslist) + 1\n data['date_created'] = datetime.datetime.now()\n # save to list\n commentslist.append(data)",
"def save_comment(data):\n data['comment_id'] = len(commentslist) + 1\n data['message'] =\"message\"\n data['author'] = \"autho... | [
"0.63125753",
"0.6055158",
"0.57577026",
"0.55333656",
"0.5506833",
"0.5483902",
"0.5372578",
"0.5357004",
"0.5353247",
"0.5295684",
"0.529495",
"0.5247602",
"0.5233638",
"0.5223587",
"0.5222193",
"0.5211724",
"0.51945955",
"0.5191858",
"0.51756215",
"0.51756215",
"0.51756215... | 0.65404683 | 0 |
Saves a list of gist comments made by this user. | def save_gist_comments(self, user, path=None):
# Redis has an end_cursor if we've collected this data before
end_cursor = self.redis.get(''.join(['gh:', user.login, ':gistComments:endCursor']))
if end_cursor:
end_cursor = end_cursor.decode('utf-8')
end_cursor = ''.join(['... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def save_comment(data):\n data['comment_id'] = len(commentslist) + 1\n data['date_created'] = datetime.datetime.now()\n # save to list\n commentslist.append(data)",
"def save_comment(data):\n data['comment_id'] = len(commentslist) + 1\n data['message'] =\"message\"\n data['author'] = \"autho... | [
"0.6658145",
"0.6442756",
"0.5789015",
"0.5736194",
"0.5645761",
"0.55168533",
"0.5502217",
"0.54077274",
"0.5404561",
"0.5373963",
"0.5331853",
"0.52870333",
"0.5219599",
"0.5178907",
"0.5175677",
"0.5168752",
"0.5137833",
"0.5137833",
"0.5137833",
"0.5137833",
"0.51184213",... | 0.646073 | 1 |
Saves a list of Gists the user has created. | def save_gists(self, user, path=None):
# Redis has an end_cursor if we've collected this data before
end_cursor = self.redis.get(''.join(['gh:', user.login, ':gists:endCursor']))
if end_cursor:
end_cursor = end_cursor.decode('utf-8')
end_cursor = ''.join(['"', end_cursor,... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create(self, gist_data):\n\n _data = json.dumps(Utils.merge_objects(self.__defaults, gist_data))\n\n response = requests.post(\n self.BASE_URL + '/gists',\n data = _data,\n headers = self.__headers\n )\n\n if response.status_code == 201:\n return response.json()\n\n raise Gis... | [
"0.60818684",
"0.57005566",
"0.5474985",
"0.5431386",
"0.53533036",
"0.5352984",
"0.53463316",
"0.5342834",
"0.52751255",
"0.52674055",
"0.5221041",
"0.5169331",
"0.5146974",
"0.50621134",
"0.50617534",
"0.50604665",
"0.5020252",
"0.50186867",
"0.50097346",
"0.50028855",
"0.5... | 0.6503054 | 0 |
Saves a list of issue comments made by this user. | def save_issue_comments(self, user, path=None):
# Redis has an end_cursor if we've collected this data before
end_cursor = self.redis.get(''.join(['gh:', user.login, ':issueComments:endCursor']))
if end_cursor:
end_cursor = end_cursor.decode('utf-8')
end_cursor = ''.join(... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def save_comment(data):\n data['comment_id'] = len(commentslist) + 1\n data['date_created'] = datetime.datetime.now()\n # save to list\n commentslist.append(data)",
"def save_comments():\n potential_deal_id = int(request.form.get(\"id\"))\n action = request.form.get(\"action\")\n if action.l... | [
"0.5847415",
"0.56875473",
"0.55866",
"0.55214906",
"0.5442948",
"0.53258395",
"0.53073525",
"0.5284097",
"0.5237606",
"0.5235629",
"0.522124",
"0.5177813",
"0.5167031",
"0.51373035",
"0.5129606",
"0.5121784",
"0.51109034",
"0.51038647",
"0.51038647",
"0.5060211",
"0.50482506... | 0.6056529 | 0 |
Saves a list of issues associated with this user. | def save_issues(self, user, path=None):
# Redis has an end_cursor if we've collected this data before
last_run = self.redis.get('ghc_last_run').decode('utf-8')
if last_run is None:
last_run = '2004-01-01' # pull everything
end_cursor = self.redis.get(''.join(['gh:', user.log... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def issues(db):\n db.session.query(Issue).delete()\n\n issues = [\n {\n 'label': 'login',\n 'email': 'admin@localhost.com',\n 'question': '42.',\n 'status': 'unread'\n },\n {\n 'label': 'login',\n 'email': 'admin@localhost... | [
"0.58301854",
"0.54856616",
"0.51859164",
"0.5134195",
"0.509845",
"0.50796527",
"0.5029606",
"0.49997592",
"0.49965605",
"0.49530712",
"0.49469295",
"0.49469295",
"0.49100602",
"0.48562244",
"0.48497698",
"0.4818374",
"0.48037708",
"0.47605178",
"0.47588396",
"0.47507063",
"... | 0.58010536 | 1 |
Saves a list of organizations the user belongs to. | def save_organizations(self, user, path=None):
# Redis has an end_cursor if we've collected this data before
end_cursor = self.redis.get(''.join(['gh:', user.login, ':organizations:endCursor']))
if end_cursor:
end_cursor = end_cursor.decode('utf-8')
end_cursor = ''.join([... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_put_list_replace(self):\n for org in Organization.objects.all():\n OrganizationMembership.objects.create(\n user=self.user, organization=org)\n self.user.save()\n self.story.organizations.add(*list(Organization.objects.filter(organizationtranslation__name... | [
"0.59265953",
"0.58648086",
"0.56789476",
"0.56515485",
"0.54156107",
"0.5396966",
"0.53800625",
"0.53793323",
"0.5349588",
"0.53471106",
"0.5318676",
"0.5316024",
"0.5313007",
"0.5301353",
"0.52717745",
"0.52717745",
"0.51998657",
"0.51996726",
"0.5185852",
"0.51782054",
"0.... | 0.60336745 | 0 |
Saves a list of repositories this user has pinned to their profile. | def save_pinned_repositories(self, user, path=None):
# Redis has an end_cursor if we've collected this data before
end_cursor = self.redis.get(''.join(['gh:', user.login, ':pinnedRepositories:endCursor']))
if end_cursor:
end_cursor = end_cursor.decode('utf-8')
end_cursor ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sync():\n _ownered_project = []\n _tmp_project_list = get_user_repo_list(current_user.username)\n if _tmp_project_list:\n for project in _tmp_project_list:\n _ownered_project.append((project, project))\n # Add upperstream_repo\n upperstream_repo = get_upperstrea... | [
"0.5855746",
"0.580509",
"0.5551184",
"0.5105534",
"0.49644792",
"0.4959064",
"0.49568492",
"0.4902213",
"0.48758385",
"0.4837906",
"0.4787995",
"0.47868484",
"0.47789016",
"0.4749357",
"0.47052976",
"0.4705086",
"0.46817786",
"0.46698788",
"0.4640423",
"0.4619886",
"0.460596... | 0.66172725 | 0 |
Saves a list of public keys associated with this user. | def save_public_keys(self, user, path=None):
# Redis has an end_cursor if we've collected this data before
end_cursor = self.redis.get(''.join(['gh:', user.login, ':publicKeys:endCursor']))
if end_cursor:
end_cursor = end_cursor.decode('utf-8')
end_cursor = ''.join(['"', ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def save_keys(self, save_path=DEFAULT_KEY_PATH):\n try:\n with open(f'{save_path}/id_elgamal', 'w') as f:\n f.write(self.keys['private'])\n with open(f'{save_path}/id_elgamal.pub', 'w') as f:\n f.write(self.keys['public']['p'] + '\\n')\n f.w... | [
"0.6537619",
"0.6313641",
"0.5977645",
"0.57419777",
"0.5697117",
"0.56217366",
"0.55947566",
"0.55806047",
"0.55734",
"0.55458343",
"0.5535723",
"0.5477158",
"0.5443913",
"0.5440483",
"0.5410733",
"0.54072666",
"0.5363117",
"0.535979",
"0.535871",
"0.5317353",
"0.52932185",
... | 0.6494126 | 1 |
Saves a list of pull requests associated with this user. | def save_pull_requests(self, user, path=None):
# Redis has an end_cursor if we've collected this data before
end_cursor = self.redis.get(''.join(['gh:', user.login, ':pullRequests:endCursor']))
if end_cursor:
end_cursor = end_cursor.decode('utf-8')
end_cursor = ''.join(['... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create(self):\n resp = yield self.client.request(\n self.repo.base_path + \"/pulls\", params={\n \"title\": self.title,\n \"head\": self.head,\n \"base\": self.base,\n \"body\": self.body,\n \"maintainer_can_modify\": ... | [
"0.550293",
"0.54397523",
"0.5235431",
"0.5223959",
"0.5181559",
"0.512005",
"0.51147157",
"0.50955063",
"0.50473064",
"0.48162797",
"0.48110226",
"0.4776085",
"0.47734773",
"0.47709897",
"0.4756326",
"0.47487405",
"0.47319442",
"0.47248226",
"0.46943775",
"0.46660092",
"0.46... | 0.62108105 | 0 |
Saves a list of repositories that the user owns. | def save_repositories(self, user, path=None):
# Redis has an end_cursor if we've collected this data before
end_cursor = self.redis.get(''.join(['gh:', user.login, ':repositories:endCursor']))
if end_cursor:
end_cursor = end_cursor.decode('utf-8')
end_cursor = ''.join(['"... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sync():\n _ownered_project = []\n _tmp_project_list = get_user_repo_list(current_user.username)\n if _tmp_project_list:\n for project in _tmp_project_list:\n _ownered_project.append((project, project))\n # Add upperstream_repo\n upperstream_repo = get_upperstrea... | [
"0.6054562",
"0.5576589",
"0.5434746",
"0.53765297",
"0.5325816",
"0.5315701",
"0.528101",
"0.5267747",
"0.5260667",
"0.5243365",
"0.52378726",
"0.52375865",
"0.5204801",
"0.51619995",
"0.51211464",
"0.51200926",
"0.510265",
"0.50712204",
"0.50696415",
"0.5054528",
"0.4969991... | 0.6030274 | 1 |
Saves a list of repositories that the user recently contributed to other than their own. | def save_repositories_contributed_to(self, user, path=None):
# Redis has an end_cursor if we've collected this data before
end_cursor = self.redis.get(''.join(['gh:', user.login, ':repositoriesContributedTo:endCursor']))
if end_cursor:
end_cursor = end_cursor.decode('utf-8')
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def save_repositories(self, user, path=None):\n # Redis has an end_cursor if we've collected this data before\n end_cursor = self.redis.get(''.join(['gh:', user.login, ':repositories:endCursor']))\n if end_cursor:\n end_cursor = end_cursor.decode('utf-8')\n end_cursor = '... | [
"0.5901712",
"0.5878179",
"0.5528805",
"0.5410074",
"0.5305616",
"0.5223621",
"0.520857",
"0.51607317",
"0.51521593",
"0.51481813",
"0.5140866",
"0.51395434",
"0.5116052",
"0.5105078",
"0.50949955",
"0.5020492",
"0.5018968",
"0.5012153",
"0.49822968",
"0.49732697",
"0.4966626... | 0.60250443 | 0 |
Saves a list of repositories that the user has starred. | def save_starred_repositories(self, user, path=None):
# Redis has an end_cursor if we've collected this data before
end_cursor = self.redis.get(''.join(['gh:', user.login, ':starredRepositories:endCursor']))
if end_cursor:
end_cursor = end_cursor.decode('utf-8')
end_curso... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def star(request):\n account = models.Account.current_user_account\n account.user_has_selected_nickname() # This will preserve account.fresh.\n if account.stars is None:\n account.stars = []\n keyid = request.issue.key.id()\n if keyid not in account.stars:\n account.stars.append(keyid)\n account.put... | [
"0.6128304",
"0.5736715",
"0.5736715",
"0.5705222",
"0.5658904",
"0.5468062",
"0.5434972",
"0.5356213",
"0.5105929",
"0.50867456",
"0.49527746",
"0.49316972",
"0.49227825",
"0.49065986",
"0.4899718",
"0.48933232",
"0.4852997",
"0.482119",
"0.47673383",
"0.47423387",
"0.473145... | 0.63887346 | 0 |
Find the given endpoint for the given domain. Only scan html element matching all criteria in look_in. optionally the content to be scanned can be given as an argument. | def discoverEndpoint(domain, endpoint, content=None, look_in={'name': 'link'}, test_urls=True, validateCerts=True):
if test_urls:
ronkyuu.URLValidator(message='invalid domain URL')(domain)
if content:
result = {'status': requests.codes.ok,
'headers': None,
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def discoverTokenEndpoints(domain, content=None, look_in={'name': 'link'}, test_urls=True, validateCerts=True):\n return discoverEndpoint(domain, ('token_endpoint',), content, look_in, test_urls, validateCerts)",
"def search(url, domain_list):\n resp = requests.get(url)\n if not resp.json().get('hits', ... | [
"0.568334",
"0.54719615",
"0.54551363",
"0.54303116",
"0.52735686",
"0.50578773",
"0.50293565",
"0.49629194",
"0.49056768",
"0.48959708",
"0.4888849",
"0.48617947",
"0.4861624",
"0.48373106",
"0.4803633",
"0.47973126",
"0.47466186",
"0.46863022",
"0.46846643",
"0.46615353",
"... | 0.6853434 | 0 |
Find the micropub for the given domain. Only scan html element matching all criteria in look_in. optionally the content to be scanned can be given as an argument. | def discoverMicropubEndpoints(domain, content=None, look_in={'name': 'link'}, test_urls=True, validateCerts=True):
return discoverEndpoint(domain, ('micropub',), content, look_in, test_urls, validateCerts) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def search(wiki, pattern):\n wiki.search_tags(pattern)",
"def search(self, phrase, content=False, username=None, ct=10, page=0):\r\n page = int(page) + 1\r\n\r\n with WIX.searcher() as search:\r\n fields = ['description', 'extended', 'tags']\r\n\r\n if content:\r\n ... | [
"0.5157872",
"0.48303917",
"0.47415784",
"0.47138998",
"0.4580432",
"0.45471004",
"0.45214573",
"0.45160756",
"0.44645557",
"0.44120982",
"0.44019017",
"0.43961054",
"0.4391695",
"0.43534493",
"0.43461645",
"0.4341786",
"0.43401173",
"0.4313143",
"0.42990834",
"0.42850435",
"... | 0.6394313 | 0 |
Find the token for the given domain. Only scan html element matching all criteria in look_in. optionally the content to be scanned can be given as an argument. | def discoverTokenEndpoints(domain, content=None, look_in={'name': 'link'}, test_urls=True, validateCerts=True):
return discoverEndpoint(domain, ('token_endpoint',), content, look_in, test_urls, validateCerts) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def search(wiki, pattern):\n wiki.search_tags(pattern)",
"def search(url, domain_list):\n resp = requests.get(url)\n if not resp.json().get('hits', '').get('hits', []):\n return\n for hit in resp.json()[\"hits\"][\"hits\"]:\n domain = hit.get(\"_source\", {}).get(\"domain\", \"\")\n ... | [
"0.521796",
"0.50288016",
"0.49580178",
"0.4880799",
"0.47114867",
"0.4708841",
"0.46950248",
"0.46874154",
"0.46816665",
"0.4663791",
"0.46451175",
"0.46395028",
"0.46025386",
"0.4575456",
"0.45328408",
"0.45127285",
"0.44772387",
"0.44075775",
"0.43700045",
"0.43473896",
"0... | 0.5688619 | 0 |
Create and enqueue future enqueue (args, resolve) > source_id resolve (source, resolve_args) > None | def source_create (self, resolve, cancel, enqueue, args = None):
future, source = FutureSourcePair ()
def resolve_internal (*resolve_args):
self.sources.discard (source)
resolve (source, *resolve_args)
return False # remove from event loop
if cancel:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def async(self, *args, **kwargs):\n uid = str(uuid.uuid4())\n message = {\n 'uid': uid,\n 'name': self.name,\n 'args': self.serializer.serialize(args),\n 'kwargs': self.serializer.serialize(kwargs),\n }\n Model = get_queue_model(self.queue_nam... | [
"0.65122193",
"0.60749143",
"0.5991675",
"0.5934187",
"0.5817398",
"0.5680583",
"0.56742793",
"0.56742793",
"0.5626921",
"0.56141484",
"0.5594981",
"0.5588243",
"0.5585966",
"0.5519959",
"0.5494343",
"0.5458945",
"0.54240227",
"0.53948534",
"0.5388359",
"0.5381443",
"0.532670... | 0.6898187 | 0 |
Reads a .tab file into a 2D array. Separates meta info from data. | def readTab(file_name):
data = []
meta = []
l=0
for line in open(file_name):
if l<3:
meta.append(line.strip("\n").split("\t"))
else:
if len(line.strip("\n").split("\t")) == len(meta[0]):
data.append(line.strip("\n").split("\t"))
l += 1
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def storeTabDelimitedFile(inputFile):\n\n\n list0 = []\n with open(inputFile, 'r') as f:\n newlist = f.readlines()\n #print(newlist)\n for i in range(len(newlist)):\n #newlist[i] = newlist[i].strip('\\t')\n newlist[i] = newlist[i].strip('\\n') # this makes the matri... | [
"0.6211566",
"0.60512006",
"0.5980201",
"0.595952",
"0.59593946",
"0.5899865",
"0.58882284",
"0.58542913",
"0.58366424",
"0.5757578",
"0.5756274",
"0.57214826",
"0.5718835",
"0.5707263",
"0.56501734",
"0.5639782",
"0.5633153",
"0.5614347",
"0.5608434",
"0.5604423",
"0.5581115... | 0.75938237 | 0 |
check if elem is a county name | def isCountyName(elem):
return (elem.attrib['k'] == "tiger:county") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_in_county(p):\n try:\n float(p[0:1])\n return True\n except ValueError:\n return False",
"def identifyCounty(line):\n matches = re.findall('[a-zA-Z]', line)\n if len(matches) > 0 and ''.join(matches) != \"Total\":\n return True",
"def is_cuisine(elem):\n return elem.attrib['k'... | [
"0.6464266",
"0.6227803",
"0.6202538",
"0.61037445",
"0.60834086",
"0.6082506",
"0.59991944",
"0.5927276",
"0.5760006",
"0.5758046",
"0.56099755",
"0.55842495",
"0.55784076",
"0.55266464",
"0.5466257",
"0.54466796",
"0.5416121",
"0.53680265",
"0.53628933",
"0.52790076",
"0.52... | 0.8547739 | 0 |
True if this NestedInteger holds a single integer, rather than a nested list. | def isInteger(self):
return isinstance(self.value, int) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def isInteger(self):\n pass",
"def isInteger(self):\n return self._is_int",
"def isInteger(self):\n return _libsbml.ASTNode_isInteger(self)",
"def isInteger(self):",
"def isInteger(self):",
"def isinteger(self):\n return self.den == 1",
"def is_int(self):\n return sel... | [
"0.68816566",
"0.68761814",
"0.68001324",
"0.6668329",
"0.6668329",
"0.6667199",
"0.65634376",
"0.653184",
"0.63604957",
"0.63311446",
"0.6296856",
"0.61985886",
"0.6147023",
"0.6113862",
"0.6112268",
"0.6085722",
"0.60296875",
"0.5978817",
"0.59638053",
"0.5953098",
"0.59422... | 0.7202063 | 0 |
Set this NestedInteger to hold a nested list and adds a nested integer elem to it. | def add(self, elem: 'NestedInteger'):
if self.value is None:
self.value = [elem]
elif self.isInteger():
self.value = [NestedInteger(self.value), elem]
else:
self.value = [*self.value, elem] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add(self, elem):\n assert self._is_int is False\n self._list.append(elem)",
"def __init__(self, value=None):\n if isinstance(value, Iterable):\n self.value = [NestedInteger(v) for v in value]\n elif isinstance(value, NestedInteger):\n self.value = value.value... | [
"0.63542014",
"0.6237883",
"0.60864973",
"0.60203195",
"0.59469235",
"0.580032",
"0.576964",
"0.5499853",
"0.5478583",
"0.5472345",
"0.53685707",
"0.52807355",
"0.522851",
"0.5194707",
"0.5173737",
"0.512586",
"0.511907",
"0.5111081",
"0.5087188",
"0.5053078",
"0.50245285",
... | 0.7977217 | 0 |
Set this NestedInteger to hold a single integer equal to value. | def setInteger(self, value: int):
self.value = value | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def setInteger(self, value):\n assert self._is_int is True\n self._value = value",
"def setInteger(self, value):",
"def setInteger(self, value):",
"def x(self, value=None):\n if isinstance(value, (int, float)):\n self[0] = value\n else:\n if value is not None... | [
"0.675394",
"0.6561978",
"0.6561978",
"0.63029945",
"0.61325914",
"0.59337676",
"0.59266293",
"0.5895697",
"0.589371",
"0.58535343",
"0.57826245",
"0.5781725",
"0.5777232",
"0.5777232",
"0.5777232",
"0.5777232",
"0.5777232",
"0.5777232",
"0.5767548",
"0.5767548",
"0.57450086"... | 0.6733747 | 1 |
the single integer that this NestedInteger holds, if it holds a single integer Return None if this NestedInteger holds a nested list | def getInteger(self):
return self.value if self.isInteger() else None | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _get(self) -> int:\n while self.stack: \n data, i = self.stack.pop()\n if i+1 < len(data): self.stack.append((data, i+1)) #backtracking point \n if data[i].isInteger(): return data[i].getInteger()\n if not data[i].getList(): continue #empty list \n ... | [
"0.6750461",
"0.58068335",
"0.5793719",
"0.5776481",
"0.5714846",
"0.5592736",
"0.55416214",
"0.5507665",
"0.5507665",
"0.5411828",
"0.538694",
"0.5385691",
"0.53667647",
"0.53541833",
"0.53436327",
"0.53330284",
"0.53313774",
"0.5331091",
"0.53203326",
"0.53196067",
"0.53037... | 0.64898604 | 1 |
the nested list that this NestedInteger holds, if it holds a nested list Return None if this NestedInteger holds a single integer | def getList(self):
return self.value if not self.isInteger() else None | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _get(self) -> int:\n while self.stack: \n data, i = self.stack.pop()\n if i+1 < len(data): self.stack.append((data, i+1)) #backtracking point \n if data[i].isInteger(): return data[i].getInteger()\n if not data[i].getList(): continue #empty list \n ... | [
"0.69028354",
"0.62758094",
"0.58172405",
"0.55986816",
"0.5480824",
"0.5474453",
"0.5436319",
"0.5422447",
"0.5390378",
"0.5235933",
"0.51452607",
"0.5142659",
"0.5120265",
"0.5072609",
"0.50632876",
"0.50073016",
"0.49925464",
"0.49601611",
"0.495557",
"0.49379557",
"0.4937... | 0.63026613 | 1 |
Do activation scale calibration on the given light_graph | def main(light_graph,
calibration_data,
hw_specs,
sw_config,
sim_params,
nodes_to_calibrate):
with graph_collection.GraphCollection() as graph_coll:
# Create calibration graph
hist_coll = graph_coll.histogram_collection()
convert_to_calib_graph = ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _RunCalibration(self, graph_key, gdef, input_data, config):\n return self._RunGraph(graph_key, gdef, input_data, config, 30)",
"def late_gradient_fusion():\n pass",
"def apply_calibration(self, cal):\n\n n_edges = len(self.channels) + 1\n channel_edges = np.linspace(-0.5, self.channels[... | [
"0.5870315",
"0.5327208",
"0.5292108",
"0.5278136",
"0.51503456",
"0.5125558",
"0.5125329",
"0.5116323",
"0.50977707",
"0.5058684",
"0.504306",
"0.5031749",
"0.4979374",
"0.49528605",
"0.49525857",
"0.49299765",
"0.4891175",
"0.48627597",
"0.48579732",
"0.4849806",
"0.4846908... | 0.73384583 | 0 |
Method to send message to asset_index websocket channel. Asset Index (request) Retrieve a list of all available underlyings and the corresponding contract types and duration boundaries. If the user is logged in, only the assets available for that user's landing company will be returned. | def __call__(self, landing_company: Optional[str] = None, passthrough: Optional[Any] = None, req_id: Optional[int] = None):
data = {
"asset_index": int(1)
}
if landing_company:
data['landing_company'] = str(landing_company)
return self.send_websocket_request(se... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def api_asset_list():\n return jsonify(app.bank.to_list()), 200",
"def _asset_index(request, course_key):\r\n course_module = modulestore().get_course(course_key)\r\n\r\n return render_to_response('asset_index.html', {\r\n 'context_course': course_module,\r\n 'asset_callback_url': reverse_... | [
"0.5347752",
"0.5298236",
"0.52792937",
"0.5228874",
"0.52224773",
"0.5209268",
"0.51474935",
"0.5125685",
"0.5113717",
"0.50968444",
"0.5081047",
"0.5077979",
"0.5067293",
"0.50664",
"0.5046824",
"0.50325316",
"0.5027318",
"0.49806237",
"0.49736387",
"0.49670604",
"0.4949830... | 0.6206942 | 0 |
Test ability to create a empty page | def test_create_page(self):
self.assertEqual(self.client.get(reverse('home')).status_code, 404)
page = Page.objects.create(**_page_data)
self.assertEqual(page.title, _page_data['title'])
self.assertEqual(page.page_type, _page_data['page_type'])
response = self.client.get(rever... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_page_list_unauthorised(self):\n user = self.get_superuser()\n title_1 = 'page'\n title_2 = 'inner'\n title_3 = 'page 3'\n page = create_page(title_1, 'page.html', 'en', published=True)\n page_2 = create_page(title_2, 'page.html', 'en', published=True, parent=page)... | [
"0.7020648",
"0.69859916",
"0.6949012",
"0.68393856",
"0.68185186",
"0.6812438",
"0.6794315",
"0.6736821",
"0.67351717",
"0.6716539",
"0.66805714",
"0.6664649",
"0.66362906",
"0.6611464",
"0.6551422",
"0.6523061",
"0.6522048",
"0.65214545",
"0.6510145",
"0.65027374",
"0.64813... | 0.7788985 | 0 |
Test ability to create a page with full header | def test_create_page_with_header(self):
link_1 = PageHeadDropMenu.objects.create\
(internal_link='home', **_head_link_data)
link_2 = PageHeadDropMenu.objects.create(
external_link=_external_link, **_head_link_data)
link_3 = PageHeadDropMenu.objects.create(**_head_link_da... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_header(self):\n sel = self.selenium\n # Load the Create Shelter page\n sel.open(\"/eden/cr/shelter/create\")\n # Check that the location is currently blank\n self.check_blank()",
"def create_page(self):",
"def test_homepage(self):\n\n with self.client as cli... | [
"0.71193373",
"0.69215447",
"0.67508227",
"0.6622254",
"0.65518856",
"0.6475695",
"0.642205",
"0.6361855",
"0.63545746",
"0.63482505",
"0.63463175",
"0.6337883",
"0.63279295",
"0.6293536",
"0.62900555",
"0.62784123",
"0.6273762",
"0.6235984",
"0.6225211",
"0.62113404",
"0.618... | 0.77367085 | 0 |
Test ability to create a page with help box | def test_create_page_with_help_box(self):
button = PageButton.objects.create(**_button_data)
help_block = PageHelpBoxBlock.objects.create(
button=button, **_help_box_data)
page = Page.objects.create(help_box_block=help_block, **_page_data)
response = self.client.get(reverse... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_help_menu(run):\n out, _err = run(dork.cli.help_menu)\n assert 'Help' in out, 'Help wasnt found'",
"def test_createExplicitHelp(self):\n self.assertSuccessStatus(self._makeConfig(None), [\"create\", \"--help\"])\n self.assertSpacelessEqual(self._createHelpText, sys.stdout.getvalue())... | [
"0.6690504",
"0.6667255",
"0.664372",
"0.6599873",
"0.6584894",
"0.65563786",
"0.652604",
"0.6522679",
"0.6467151",
"0.6451444",
"0.64280933",
"0.6410487",
"0.64081675",
"0.63884115",
"0.63809764",
"0.63509667",
"0.63509667",
"0.6337427",
"0.6329947",
"0.6302536",
"0.6284349"... | 0.79399395 | 0 |
Test ability to create a page with main box | def test_create_page_with_main_box(self):
main_block = PageMainBlock.objects.create(**_main_block_data)
Page.objects.create(main_block=main_block, **_page_data)
response = self.client.get(reverse('home'))
self.assertEqual(response.status_code, 200)
self.assertIn('text', respons... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_page(self):",
"def test_create_page_with_help_box(self):\n\n button = PageButton.objects.create(**_button_data)\n help_block = PageHelpBoxBlock.objects.create(\n button=button, **_help_box_data)\n page = Page.objects.create(help_box_block=help_block, **_page_data)\n\n ... | [
"0.6924539",
"0.6889655",
"0.68546546",
"0.67670345",
"0.67154676",
"0.6582398",
"0.6547919",
"0.64649904",
"0.6284628",
"0.62567896",
"0.62402797",
"0.62172043",
"0.62079114",
"0.61982745",
"0.61932427",
"0.61767715",
"0.6131917",
"0.61279565",
"0.61247087",
"0.6123573",
"0.... | 0.78971374 | 0 |
Test ability to create a page with main footer | def test_create_page_with_footer(self):
footer_block = PageFooterBlock.objects.create(**_footer_block_data)
link_1 = PageHeadDropMenu.objects.create\
(internal_link='home', **_head_link_data)
link_2 = PageHeadDropMenu.objects.create(
external_link=_external_link, **_head... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_00_footer(self):\r\n url = '/'\r\n # As Anonymou user\r\n res = self.app.get(url, follow_redirects=True)\r\n dom = BeautifulSoup(res.data)\r\n err_msg = \"Footer links should not be shown to anonymous users\"\r\n assert dom.find(id='footer_links') is None, err_msg... | [
"0.73257196",
"0.72786623",
"0.65961885",
"0.65096605",
"0.6436854",
"0.62778157",
"0.6275215",
"0.6275215",
"0.6235414",
"0.621966",
"0.60667896",
"0.606618",
"0.60153687",
"0.6010727",
"0.6007516",
"0.5964707",
"0.5950918",
"0.59390473",
"0.589547",
"0.58854747",
"0.5876067... | 0.8047665 | 0 |
Test ability to create a page with main what you need block | def test_create_page_with_whatyouneed_block(self):
what_you_need_block = PageWhatYouNeedBlock.objects.create(
**_whatyouneed_block_data)
Page.objects.create(what_you_need_block=what_you_need_block,
**_page_data)
response = self.client.get(reverse('home')... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_create_page_with_main_box(self):\n\n main_block = PageMainBlock.objects.create(**_main_block_data)\n Page.objects.create(main_block=main_block, **_page_data)\n response = self.client.get(reverse('home'))\n self.assertEqual(response.status_code, 200)\n\n self.assertIn('te... | [
"0.7925535",
"0.71040845",
"0.70405143",
"0.6776286",
"0.67402023",
"0.6727634",
"0.6711986",
"0.6697805",
"0.6588746",
"0.65794003",
"0.65505695",
"0.6517028",
"0.6492822",
"0.6410374",
"0.6395514",
"0.6354633",
"0.63398767",
"0.6336393",
"0.630439",
"0.62780046",
"0.6267378... | 0.74322563 | 1 |
Returns search results of the query obtained in request args. It Returns four seperate variables containing results for artists, music, albums and records. | def search():
if not request.vars.search_term:
redirect(URL('index'))
term = request.vars.search_term
origterm = term
term = term.replace(' ','|')
artists = db.executesql("select distinct(m1.id), m1.art_name, m1.artist_type, m1.country, m1.b_year,m1.b_month,m1.b_date,m1.e_year,m1.e_month,m1.e_day,ts_rank(to_tsve... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_artists():\n return query_multiple(request.args, artist_search, \\\n artist_filter, Artist, artists_schema)",
"def get(self):\n mb = MusicbrainzClient()\n query = self.get_argument('q')\n artists, tracks = yield [mb.search_artists(query),\n ... | [
"0.6995513",
"0.6946495",
"0.69276816",
"0.6712662",
"0.66553944",
"0.6650486",
"0.66414595",
"0.66204256",
"0.66038275",
"0.65670973",
"0.65214497",
"0.65137446",
"0.64969873",
"0.6442194",
"0.6438711",
"0.6370827",
"0.6355204",
"0.6339323",
"0.6334207",
"0.63236696",
"0.631... | 0.73612744 | 0 |
This action is reponsible for displaying all the information related to an artist | def artist():
if not request.vars.id:
redirect(URL('index'))
id = request.vars.id
artistname = db.executesql("select m1.name from artist_name as m1, artist as m2 where m1.id = m2.name and m2.id = "+id+";")
urls = db.executesql("select distinct(m2.url) from l_artist_url m1, url m2 where m2.id = m1.entity1 and m1.e... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def artists():\n # TODO: replace with real data returned from querying the database (DONE)\n artists = Artist.query.group_by(Artist.id, Artist.name).all()\n\n data = []\n\n for a in artists :\n data.append({\n 'id' : a.id,\n 'name' : a.name\n })\n\n return render_... | [
"0.7046416",
"0.6953733",
"0.6649395",
"0.66083264",
"0.657852",
"0.65465295",
"0.6491085",
"0.64804745",
"0.64677274",
"0.64607227",
"0.64456445",
"0.6401886",
"0.63846064",
"0.6378521",
"0.6368321",
"0.6331579",
"0.6211678",
"0.62032557",
"0.6153709",
"0.61417043",
"0.61027... | 0.78098094 | 0 |
Extract consecutive ners from the result of CoreNLPNERTagger | def merge_ners(tokens):
ners = list()
merged_tokens = list()
candid_entity = list()
keep = False
prev_tag = 'O'
for i, (token, tag) in enumerate(tokens):
if keep:
if tag not in IGNORE_NER_TAG:
candid_entity.append(token)
keep = True
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def extract_ngrams(self, sequence):\n sequence = self.prefix + sequence + self.suffix\n for i, event in enumerate(sequence[self.n:], self.n):\n yield event, sequence[i-self.n: i]",
"def extract_nps(text, annotation):\n np_starts = [i for i in range(len(annotation)) if annotation[i] ==... | [
"0.5992052",
"0.58803827",
"0.57412916",
"0.57153046",
"0.56501865",
"0.56453776",
"0.55940616",
"0.5551463",
"0.54952145",
"0.5488924",
"0.54851663",
"0.54851663",
"0.54396814",
"0.53640854",
"0.5351113",
"0.5312324",
"0.5291228",
"0.52684474",
"0.52250415",
"0.5201601",
"0.... | 0.59793997 | 1 |
Load freebase entity dictionary from saved dict | def load_freebase_entity(path="../data/freebase/dict.txt"):
logger.info('Loading freebase entity dictionary...')
name2id = dict()
id2name = dict()
with open(path, 'r', buffering=1024 * 1024 * 100) as f:
for line in f:
tokens = line.split('\t')
_name = tokens[0].strip()
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def from_dict(cls, dikt) -> 'GnbrEntity':\n return util.deserialize_model(dikt, cls)",
"def load_dict(self, dct):\n pass",
"def load(self):\n\n args = self.id, self.name\n self.loader.session.logger.debug(\"loading CDR%d (%r)\", *args)\n cursor = self.loader.dicti... | [
"0.64202756",
"0.6255847",
"0.62532294",
"0.61488426",
"0.59458196",
"0.59139955",
"0.58941555",
"0.5862503",
"0.58609146",
"0.5860008",
"0.5859102",
"0.5848029",
"0.5788074",
"0.57809716",
"0.5733735",
"0.5718896",
"0.5706553",
"0.5698764",
"0.5692765",
"0.56742126",
"0.5661... | 0.7637444 | 0 |
Return position of ner in list of tokens | def get_nerpos(tokens, ner):
loc = list()
for i, token in enumerate(tokens):
if token == ner:
loc.append(i)
return loc | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_nerspos(tokens, ners):\n pos_list = list()\n for ner in ners:\n pos = get_nerpos(tokens, ner)\n pos_list.append(pos)\n\n return pos_list",
"def get_head_pos( head, ngram ):\n try:\n tokens = ngram.split( ' ' )\n return str([ i for i, t in enumerate( tokens ) if t.s... | [
"0.68481386",
"0.64260495",
"0.6337191",
"0.6327533",
"0.6311592",
"0.63036317",
"0.62495536",
"0.62290925",
"0.6140072",
"0.6086388",
"0.5966749",
"0.59169406",
"0.59167016",
"0.590555",
"0.5892167",
"0.58879244",
"0.58879244",
"0.58879244",
"0.58823013",
"0.58707553",
"0.58... | 0.81861734 | 0 |
Return positions of ners in list of tokens | def get_nerspos(tokens, ners):
pos_list = list()
for ner in ners:
pos = get_nerpos(tokens, ner)
pos_list.append(pos)
return pos_list | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_nerpos(tokens, ner):\n\n loc = list()\n for i, token in enumerate(tokens):\n if token == ner:\n loc.append(i)\n return loc",
"def get_positions(token, docs):\n\n all_matches = [token]\n for doc in docs:\n matches = []\n if token in doc:\n indexes ... | [
"0.8392064",
"0.69574887",
"0.6598042",
"0.6516395",
"0.6503853",
"0.63557386",
"0.6345",
"0.6334957",
"0.63280684",
"0.62971956",
"0.6194977",
"0.61768335",
"0.61675954",
"0.61302745",
"0.6104622",
"0.60178024",
"0.60013366",
"0.5981349",
"0.5938564",
"0.59180295",
"0.591576... | 0.78989506 | 1 |
Get a appropriate OTP for the current Vault version under test. | def get_generate_root_otp():
if vault_version_ge("1.10.0"):
test_otp = "BMjzW3wAsEzINXCM05Wbas3u9zSl"
elif vault_version_ge("1.0.0"):
test_otp = "ygs0vL8GIxu0AjRVEmJ5jLCVq8"
else:
test_otp = "RSMGkAqBH5WnVLrDTbZ+UQ=="
return test_otp | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def otp_generate(request):\n phone = request.GET.get('phone', None)\n otp = UserAuth(phone).generate_otp()\n return Response(\n {\n 'success': True,\n 'phone': phone,\n 'otp': otp\n }\n )",
"def generate_otp(email):\n\tprint \"generate_otp\"\n\totp_key =... | [
"0.58393794",
"0.5716151",
"0.56288546",
"0.56154954",
"0.55863196",
"0.55287445",
"0.5509557",
"0.542242",
"0.53520805",
"0.5223635",
"0.52086926",
"0.5172018",
"0.5132177",
"0.50504476",
"0.5044505",
"0.50082654",
"0.50049675",
"0.4994672",
"0.49763277",
"0.49655774",
"0.49... | 0.79360807 | 0 |
Load test config file data for use by various test cases. | def load_config_file(filename):
test_data_path = get_config_file_path(filename)
with open(test_data_path) as f:
test_data = f.read()
return test_data | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _load_test_data(self):\n self._save_test_data()",
"def test_load_from_file(self):\n cf = ConfigFile()\n cf.load_from_file(TestConfigFile.TEST_CONFIG)\n\n self.assertEqual(4, len(cf))\n self.assertEqual(cf[\"key1\"], \"val1\")\n self.assertEqual(cf[\"key2\"], \"val2\"... | [
"0.7346483",
"0.7241617",
"0.7041901",
"0.7021762",
"0.69928503",
"0.69685555",
"0.6907617",
"0.68597746",
"0.68017393",
"0.6799866",
"0.67664844",
"0.6723095",
"0.6710996",
"0.6676708",
"0.66698784",
"0.66493666",
"0.6597196",
"0.6592818",
"0.6589089",
"0.65828204",
"0.65756... | 0.7834851 | 0 |
Get the path to a config file under the "tests/config_files" directory. I.e., the directory containing selfsigned certificates, configuration files, etc. that are used for various tests. | def get_config_file_path(filename):
# Use __file__ to derive a path relative to this module's location which points to the tests data directory.
relative_path = os.path.join(
os.path.dirname(os.path.realpath(__file__)), "..", "config_files"
)
return os.path.join(os.path.abspath(relative_path), f... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_config_path():\n\n root = os.path.dirname(os.path.abspath(__file__))[:-5]\n config_path = os.path.join(root, 'config.ini')\n\n return config_path",
"def get_config_path(config):\n section = config.sections()[0]\n return Path(config.get(section, \"path\")).expanduser().absolute()",
"def g... | [
"0.80562377",
"0.8025532",
"0.7936335",
"0.7636513",
"0.759419",
"0.75863504",
"0.7586312",
"0.74758565",
"0.7409882",
"0.7362901",
"0.7351157",
"0.73110783",
"0.725994",
"0.725583",
"0.71291775",
"0.70951337",
"0.7093658",
"0.7087657",
"0.708164",
"0.7075927",
"0.70503074",
... | 0.8256649 | 0 |
Decode a newly generated root token via Vault CLI. | def decode_generated_root_token(encoded_token, otp):
command = ["vault"]
if vault_version_ge("0.9.6"):
# before Vault ~0.9.6, the generate-root command was the first positional argument
# afterwards, it was moved under the "operator" category
command.append("operator")
command.exten... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def meraki_vault_r_secret(mount, path):\n read_secret_result = client.secrets.kv.v1.read_secret(path=meraki_vault_path, mount_point=vault_mount_point)\n api_token = read_secret_result['data']['token']\n return api_token",
"def vault_auth():\n # Check if vault is sealed\n if client.sys.is_sealed() ... | [
"0.59399545",
"0.5710058",
"0.56865376",
"0.5683078",
"0.5500785",
"0.5490273",
"0.5472639",
"0.5260887",
"0.5217738",
"0.521536",
"0.5193939",
"0.5115839",
"0.51024985",
"0.5093198",
"0.50621367",
"0.5052655",
"0.5043405",
"0.5037708",
"0.503704",
"0.49572414",
"0.49545163",... | 0.75455594 | 0 |
Helper method to add `encoding='utf8'` to subprocess.Popen. | def get_popen_kwargs(**popen_kwargs):
popen_kwargs["encoding"] = "utf-8"
return popen_kwargs | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_terminal_encoding(encoding='utf_8'):\n sys.stdin = codecs.getreader(encoding)(sys.stdin)\n sys.stdout = codecs.getwriter(encoding)(sys.stdout)\n sys.stderr = codecs.getwriter(encoding)(sys.stderr)",
"def defaultProcessOutputEncodingDecider(context, executable, **forfutureuse):\n\treturn __DEFAUL... | [
"0.64557153",
"0.6064261",
"0.5924003",
"0.58920264",
"0.5797352",
"0.57451856",
"0.5647091",
"0.5566803",
"0.5552143",
"0.54971397",
"0.5480613",
"0.5451589",
"0.5397502",
"0.53734374",
"0.5352288",
"0.5268057",
"0.5194355",
"0.51533914",
"0.5115416",
"0.5112865",
"0.5074088... | 0.6455326 | 1 |
Input file_path, save model weights into a file of given format. | def save_weights(self, file_path, format=None):
_save_weights(self, file_path, format) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def save(self, weights_file):\r\n \r\n self.model.save_weights(weights_file)",
"def save_weights_file(self, file_path, file_name):\n\n # Join the path with the file name and append the extension (h5)\n path = join(file_path, \"{}.h5\".format(file_name))\n\n # Store the weights\... | [
"0.7974793",
"0.79393816",
"0.7818803",
"0.76390755",
"0.748463",
"0.7457383",
"0.7365727",
"0.7359829",
"0.7352166",
"0.7283044",
"0.7283044",
"0.7068052",
"0.7067362",
"0.70322907",
"0.7007359",
"0.7005004",
"0.7005004",
"0.7005004",
"0.69427085",
"0.6855376",
"0.68439704",... | 0.8305987 | 0 |
Add a LayerNode for this layer given input_tensors, output_tensors. | def _add_node(self, input_tensors, output_tensors):
raise NotImplementedError | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_layer(inputs, in_size, out_size, n_layer, activation_function=None, ):\r\n layer_name = \"layer%s\" % n_layer\r\n with tf.name_scope(layer_name):\r\n with tf.name_scope(\"Weights\"):\r\n Weights = tf.Variable(tf.random_normal([in_size, out_size]), name=\"W\")\r\n tf.summa... | [
"0.6593948",
"0.6312318",
"0.6243013",
"0.62338334",
"0.6224892",
"0.5977068",
"0.592607",
"0.5898218",
"0.58804685",
"0.5858943",
"0.58344376",
"0.57562846",
"0.5721505",
"0.5678528",
"0.56682277",
"0.56655985",
"0.5646037",
"0.56409556",
"0.56349766",
"0.55707383",
"0.55651... | 0.7810959 | 0 |
Returns all trainable weights. Returns a list of all trainable parmeters. | def trainable_weights(self):
self._trainable_weights = list(filter(lambda x: x.requires_grad, self.get_parameters(expand=True)))
return self._trainable_weights | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def weights_lst(self):\n assert self.sess is not None, \"Model has not been fitted yet!\"\n return self.sess.run(self.W_lst)",
"def get_weights(self):\n return [self.W]",
"def get_weights(self):\n return [self.W]",
"def get_weights(self):\n return []",
"def get_weights(se... | [
"0.7333756",
"0.70962805",
"0.70962805",
"0.70862687",
"0.7070256",
"0.6915223",
"0.68708634",
"0.6868791",
"0.6868791",
"0.679045",
"0.679045",
"0.6756826",
"0.6756826",
"0.675156",
"0.673351",
"0.673351",
"0.673351",
"0.6731417",
"0.6691864",
"0.66902167",
"0.668324",
"0.... | 0.76837504 | 0 |
Returns all untrainable weights. Returns a list of all untrainable weights. | def nontrainable_weights(self):
return list(filter(lambda x: not x.requires_grad, self.get_parameters(expand=True))) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_weights(self):\n return []",
"def trainable_weights(self):\n self._trainable_weights = list(filter(lambda x: x.requires_grad, self.get_parameters(expand=True)))\n return self._trainable_weights",
"def get_weights(self):\n return [self.W]",
"def get_weights(self):\n ... | [
"0.7384943",
"0.7170098",
"0.70482403",
"0.70482403",
"0.6928857",
"0.69194895",
"0.69194895",
"0.69194895",
"0.6848169",
"0.6782915",
"0.6730147",
"0.6730147",
"0.6730147",
"0.6663011",
"0.6663011",
"0.6640928",
"0.6623843",
"0.6623843",
"0.6608877",
"0.65747327",
"0.6571032... | 0.7795881 | 0 |
Return the default form class used for user registration. | def get_form_class(self, request):
return RegistrationForm | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_form_class(self, request):\n return RegistrationForm",
"def get_form_class(self):\n return self.form_class",
"def get_form_class(self):\n if self.form_class:\n return self.form_class\n else:\n raise ImproperlyConfigured(\n \"在定义类视图%s的时候,你... | [
"0.7956627",
"0.770102",
"0.74282926",
"0.72233987",
"0.71631217",
"0.7097246",
"0.7082445",
"0.696311",
"0.692484",
"0.6767896",
"0.67418265",
"0.66456175",
"0.66020036",
"0.64767134",
"0.64665145",
"0.64210325",
"0.63494134",
"0.6314577",
"0.62687373",
"0.6240669",
"0.62336... | 0.8111784 | 0 |
Get a historic of locations | def get_historic_location(): # noqa: E501
db = PostgresDB()
historial = db.get_locations()
if "Error" in historial:
return jsonify(msg=historial)
if len(historial) > 0:
data = {"historial" : []}
for row in historial:
data['historial'].append(
{
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"async def historic(self) -> dict:\n return await self._request(\n \"get\", \"https://www.asthmaforecast.com/api/forecast/historic/asthma\"\n )",
"def get_historic_data(self):\n\n historic_market_events = []\n\n return historic_market_events",
"def History(self):\n retu... | [
"0.64075005",
"0.6306349",
"0.61227405",
"0.60741436",
"0.5974619",
"0.5956443",
"0.59440225",
"0.5868649",
"0.58360744",
"0.5833078",
"0.5829477",
"0.5814553",
"0.5808685",
"0.5795159",
"0.5782138",
"0.57627606",
"0.5699749",
"0.568246",
"0.5676575",
"0.5676575",
"0.56725854... | 0.77446115 | 0 |
Convert from keras to tf | def keras_to_tensorflow(
keras_model,
output_dir: Path,
model_name,
out_prefix="output_",
log_tensorboard=True,
):
if not output_dir.exists():
output_dir.mkdir(parents=True, exist_ok=True)
output_dir: str = str(output_dir)
out_nodes = []
for i in range(len(keras_model.outpu... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def convert(self, example):\n tf_example = _convert_to_tf_example(example, self.tokenizer, self.rules,\n self.config, self.max_sizes)\n return tf_example",
"def convert_to_tf_record(_):\n\n mnist = input_data.read_data_sets(\n \"/tmp/tensorflow/mnist/input_d... | [
"0.6639992",
"0.6630255",
"0.6283206",
"0.6280251",
"0.6261455",
"0.61814857",
"0.61665124",
"0.6141866",
"0.6130877",
"0.6106019",
"0.60859215",
"0.60848236",
"0.6076101",
"0.60558754",
"0.60113984",
"0.6006671",
"0.59937596",
"0.59848094",
"0.5983833",
"0.5973008",
"0.59620... | 0.67439127 | 0 |
as the method name suggests this returns the up to date station information. | def get_current_station_info(cls, dbsession):
sub = dbsession.query(UsageData.station_id, func.max(UsageData.id).label('max_update')).group_by(
UsageData.station_id).subquery()
return dbsession.query(
UsageData.last_update,
UsageData.available_bike_stands, UsageData.... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_station_boroughs(self):\\",
"def show_info(self):\n\n print(\"Querying the station...\")\n val = getvalues(self.station, '', fixed_format)\n\n print('Fine Offset station settings:')\n print('%s: %s' % ('local time'.rjust(30),\n time.strftime('%Y.%m.%d ... | [
"0.66889495",
"0.6452908",
"0.62583035",
"0.62394136",
"0.619208",
"0.6112521",
"0.60889035",
"0.6042705",
"0.6017993",
"0.5981389",
"0.59698784",
"0.5953793",
"0.59492654",
"0.591016",
"0.59028894",
"0.589664",
"0.58665407",
"0.5864966",
"0.58616376",
"0.5854664",
"0.5849501... | 0.71660936 | 0 |
returns a list of bikes for a provided weekday and station. averaged per hour so 24 results. | def get_bikes_for_weekday(cls, dbsession, weekday, station_id):
station = [("Time", "Available Bikes", "Available Stands")]
station_data = dbsession.query(func.hour(cls.last_update),
func.avg(cls.available_bikes),
func.avg(... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_bikes_for_week(cls, dbsession, station_id):\n station = [(\"Day\", \"Available Bikes\")]\n station_data = dbsession.query(func.weekday(cls.last_update),\n func.avg(cls.available_bikes)) \\\n .filter(cls.station_id == station_id) \\\n ... | [
"0.77892643",
"0.71780616",
"0.69516826",
"0.67270637",
"0.6636598",
"0.6216508",
"0.59292334",
"0.56938154",
"0.5609472",
"0.554261",
"0.55170375",
"0.5512873",
"0.546571",
"0.53780615",
"0.53184694",
"0.5302574",
"0.52739406",
"0.52701545",
"0.52644885",
"0.5257001",
"0.525... | 0.84364945 | 0 |
finds days where there was wet weather. | def findWetWeatherDays(self, dbsession, today):
wetDays = dbsession.query(self.dt).filter(or_(self.weather_description == "light rain", self.weather_description == "moderate rain")).all()
# if one of those days is today return it.
# else just return a wet day.
for i in range(len(wetDays)... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_typical_days(weather_data, cfg):\n settings = cfg['settings']\n # Flag to determine if any holidays have been found:\n interpolation_freq = pd.Timedelta(settings['intervall'])\n flag_holidays_found = False\n\n # --- Season --------------------------------------------------------------\n #... | [
"0.6345522",
"0.62267625",
"0.620805",
"0.6172952",
"0.6154723",
"0.6078286",
"0.59555215",
"0.5860357",
"0.5847305",
"0.5832294",
"0.5819031",
"0.5799269",
"0.5799269",
"0.57958776",
"0.5793687",
"0.57477695",
"0.57152104",
"0.570199",
"0.57016325",
"0.5699181",
"0.5681354",... | 0.7885582 | 0 |
For two participants, at most one channel can be opened | def test_max_1_channel(
token_network: Contract, get_accounts: Callable, create_channel: Callable
) -> None:
(A, B) = get_accounts(2)
create_channel(A, B)
with pytest.raises(TransactionFailed, match="TN/open: channel exists for participants"):
token_network.functions.openChannel(A, B).call()
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def single_channel():\n return True",
"def have_channel_open(channels, user):\n for x in channels:\n chan = channels[x]\n if 'is_member' in chan:\n continue\n if \"user\" in chan and chan['user'] == user:\n return True\n return False",
"def have_chann... | [
"0.68654567",
"0.6490941",
"0.6464989",
"0.63985145",
"0.6327629",
"0.6311468",
"0.6309975",
"0.6291697",
"0.6276977",
"0.62615794",
"0.6125024",
"0.6120147",
"0.60907483",
"0.6057845",
"0.6023134",
"0.59909755",
"0.5980023",
"0.5967421",
"0.5960192",
"0.5923796",
"0.59115165... | 0.6518068 | 1 |
getParticipantsHash() behaves as get_participants_hash | def test_participants_hash(token_network: Contract, get_accounts: Callable) -> None:
(A, B) = get_accounts(2)
AB_hash = get_participants_hash(A, B)
assert token_network.functions.getParticipantsHash(A, B).call() == AB_hash
assert token_network.functions.getParticipantsHash(B, A).call() == AB_hash | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_hash(self, composition):\n return",
"def __hash__(self):\n return hash((self.member_role, self.member_type, self.member_email))",
"def get_hash(self):\r\n return",
"def get_hash(self):\n return freeze_dict(self.get_hash_params())",
"def get_hash(self):\n return self._... | [
"0.63765395",
"0.63318187",
"0.6321352",
"0.6252258",
"0.6228718",
"0.6136036",
"0.613001",
"0.61032784",
"0.6090188",
"0.60368407",
"0.59734964",
"0.5966896",
"0.5864445",
"0.58352035",
"0.58331984",
"0.5813834",
"0.57882416",
"0.57848483",
"0.57782173",
"0.5753588",
"0.5749... | 0.7115849 | 0 |
getParticipantsHash() behaves as get_participants_hash on equal addresses | def test_participants_hash_equal(token_network: Contract, get_accounts: Callable) -> None:
(A,) = get_accounts(1)
with pytest.raises(ValueError):
get_participants_hash(A, A)
with pytest.raises(TransactionFailed, match="TN: identical addresses"):
token_network.functions.getParticipantsHash(A... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_participants_hash(token_network: Contract, get_accounts: Callable) -> None:\n (A, B) = get_accounts(2)\n\n AB_hash = get_participants_hash(A, B)\n assert token_network.functions.getParticipantsHash(A, B).call() == AB_hash\n assert token_network.functions.getParticipantsHash(B, A).call() == AB_... | [
"0.70927805",
"0.6258063",
"0.6066081",
"0.6022483",
"0.59809077",
"0.5974033",
"0.5940762",
"0.5915285",
"0.5876238",
"0.58748066",
"0.5854341",
"0.5794211",
"0.57636255",
"0.57451165",
"0.57385176",
"0.5730055",
"0.5713905",
"0.5703602",
"0.5702778",
"0.56973827",
"0.569604... | 0.6733924 | 1 |
Adds a vdd rail at the top of the cell | def route_vdd_rail(self):
# adds the rail across the width of the cell
vdd_position = vector(0, self.height - self.m1_width)
self.add_rect(layer="metal1",
offset=vdd_position,
width=self.width,
height=self.m1_width)
pmos_... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _add_border(self):\n top = TopWallCell(self)\n left = SideWallCell(self, False)\n right = SideWallCell(self, True)\n for col in range(self._columns):\n self.cell_at(col, self._rows - 1, top)\n for row in range(self._rows):\n self.cell_at(0, row, left)\n ... | [
"0.5719361",
"0.54055804",
"0.5304635",
"0.53003937",
"0.52842367",
"0.5275856",
"0.5258827",
"0.5232115",
"0.51538235",
"0.51155037",
"0.50955796",
"0.5081745",
"0.506918",
"0.5068402",
"0.50647056",
"0.50580543",
"0.5054077",
"0.50488394",
"0.50478745",
"0.49961856",
"0.494... | 0.6683286 | 0 |
Create both the upper_pmos and lower_pmos to the module | def create_ptx(self):
self.lower_pmos_inst=self.add_inst(name="lower_pmos",
mod=self.pmos)
self.connect_inst(["bl", "en", "br", "vdd"])
self.upper_pmos1_inst=self.add_inst(name="upper_pmos1",
mod=self.pmos)
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_modules(self):\n self.nmos = ptx(width=self.nmos_size,\n mults=self.nmos_mults,\n tx_type=\"nmos\")\n self.add_mod(self.nmos)\n\n self.pmos = ptx(width=self.pmos_size,\n mults=self.pmos_mults,\n ... | [
"0.62417173",
"0.5595662",
"0.5592487",
"0.5253398",
"0.5209395",
"0.5176703",
"0.5076419",
"0.5046861",
"0.50380796",
"0.49966943",
"0.4981465",
"0.49621493",
"0.49106213",
"0.49073905",
"0.49046108",
"0.48944435",
"0.48900783",
"0.48836777",
"0.4832847",
"0.48023075",
"0.47... | 0.626209 | 0 |
Place both the upper_pmos and lower_pmos to the module | def place_ptx(self):
# Compute the other pmos2 location, but determining offset to overlap the
# source and drain pins
self.overlap_offset = self.pmos.get_pin("D").ll() - self.pmos.get_pin("S").ll()
# adds the lower pmos to layout
#base = vector(self.width - 2*self.pmos... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def modules():",
"def create_modules(self):\n self.nmos = ptx(width=self.nmos_size,\n mults=self.nmos_mults,\n tx_type=\"nmos\")\n self.add_mod(self.nmos)\n\n self.pmos = ptx(width=self.pmos_size,\n mults=self.pmos_mults,\n... | [
"0.5711919",
"0.56773573",
"0.5484845",
"0.5373545",
"0.5269169",
"0.5117529",
"0.503132",
"0.5020452",
"0.49931383",
"0.49220088",
"0.49029332",
"0.4861574",
"0.47709423",
"0.4747098",
"0.47383958",
"0.47374594",
"0.47188666",
"0.47152808",
"0.4713286",
"0.4705685",
"0.47054... | 0.58079857 | 0 |
Connects the upper and lower pmos together | def connect_poly(self):
offset = self.lower_pmos_inst.get_pin("G").ll()
# connects the top and bottom pmos' gates together
ylength = self.upper_pmos1_inst.get_pin("G").ll().y - offset.y
self.add_rect(layer="poly",
offset=offset,
width=self.pol... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def connect_poly(self):\n # connect pmos1 poly\n nmos_gate = (self.nmos_position1 \n + self.nmos.poly_positions[0]\n + vector(0.5 * drc[\"minwidth_poly\"], 0))\n for i in range(len(self.pmos.poly_positions)):\n pmos_gate = (self.pmos_position1... | [
"0.5922714",
"0.5896698",
"0.5664321",
"0.5499741",
"0.54175603",
"0.53472805",
"0.5343195",
"0.5323919",
"0.5288541",
"0.5283576",
"0.5264222",
"0.5234746",
"0.5233384",
"0.5213443",
"0.5183542",
"0.5177952",
"0.51564336",
"0.515582",
"0.51377267",
"0.5134331",
"0.50970364",... | 0.6478284 | 0 |
Adds the en input rail, en contact/vias, and connects to the pmos | def route_en(self):
# adds the en contact to connect the gates to the en rail on metal1
offset = self.lower_pmos_inst.get_pin("G").ul() + vector(0,0.5*self.poly_space)
self.add_contact_center(layers=("poly", "contact", "metal1"),
offset=offset,
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def setup_connections(self):\n\t\t# Lorsque l'on choisi une devise dans la cbb\n\t\tself.cbb_devisesFrom.activated.connect(self.compute)\n\t\tself.cbb_devisesTo.activated.connect(self.compute)\n\t\t# Lorsque l'on change le montant dans la spn\n\t\tself.spn_montant.valueChanged.connect(self.compute)\n\t\tself.spn_m... | [
"0.56937957",
"0.5588377",
"0.5364039",
"0.53394985",
"0.53394985",
"0.5271092",
"0.5241046",
"0.5142711",
"0.5137675",
"0.512801",
"0.5114251",
"0.5101308",
"0.5082479",
"0.50810903",
"0.50637263",
"0.5054848",
"0.50368226",
"0.50169",
"0.50132143",
"0.5012345",
"0.49996084"... | 0.5722017 | 0 |
Adds both bitline and bitlinebar to the module | def route_bitlines(self):
# adds the BL on metal 2
offset = vector(self.bitcell.get_pin(self.bitcell_bl).cx(),0) - vector(0.5 * self.m2_width,0)
self.add_layout_pin(text="bl",
layer="metal2",
offset=offset,
width... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def addToolBarButtons(self):",
"def addBarrelBlue(self, event):\n # let user draw second ROI\n ROI = RoiPoly(color='b') #let user draw ROI\n plt.show(block=False)\n mask = ROI.get_mask(self.greyimg)\n self.ROI += mask",
"def add_modules(self):\n # This is the threshold... | [
"0.5931237",
"0.56883824",
"0.5411799",
"0.5363328",
"0.523951",
"0.5219392",
"0.52153605",
"0.52136797",
"0.5135922",
"0.50847983",
"0.5036947",
"0.50350106",
"0.5027019",
"0.5021388",
"0.5010233",
"0.4987663",
"0.49871254",
"0.49766114",
"0.49440458",
"0.49363413",
"0.48943... | 0.61381006 | 0 |
Adds contacts/via from metal1 to metal2 for bitlines | def add_bitline_contacts(self):
stack=("metal1", "via1", "metal2")
pos = self.lower_pmos_inst.get_pin("S").center()
self.add_contact_center(layers=stack,
offset=pos)
pos = self.lower_pmos_inst.get_pin("D").center()
self.add_contact_center(layers=s... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def route_bitlines(self):\n # adds the BL on metal 2\n offset = vector(self.bitcell.get_pin(self.bitcell_bl).cx(),0) - vector(0.5 * self.m2_width,0)\n self.add_layout_pin(text=\"bl\",\n layer=\"metal2\",\n offset=offset,\n ... | [
"0.693796",
"0.67024845",
"0.61300176",
"0.5741309",
"0.5715331",
"0.5709275",
"0.56884384",
"0.55448365",
"0.5517545",
"0.54770654",
"0.54025584",
"0.5344132",
"0.5279721",
"0.52553105",
"0.5248629",
"0.5226081",
"0.5191582",
"0.51813334",
"0.5166011",
"0.5162329",
"0.516208... | 0.73841476 | 0 |
Connect pmos pin to bitline pin | def connect_pmos(self, pmos_pin, bit_pin):
ll_pos = vector(min(pmos_pin.lx(),bit_pin.lx()), pmos_pin.by())
ur_pos = vector(max(pmos_pin.rx(),bit_pin.rx()), pmos_pin.uy())
width = ur_pos.x-ll_pos.x
height = ur_pos.y-ll_pos.y
self.add_rect(layer="metal2",
of... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_pins(self):\n\n for bit in range(self.addr_size):\n self.add_pin(\"addr_{0}\".format(bit),\"INPUT\")\n \n self.add_pin(\"wl_en\", \"INPUT\")\n\n for bit in range(self.num_rows):\n self.add_pin(\"wl_{0}\".format(bit),\"OUTPUT\")\n \n self.add_p... | [
"0.6256124",
"0.6165595",
"0.6141988",
"0.61245584",
"0.612056",
"0.61114496",
"0.60696626",
"0.6058473",
"0.60407984",
"0.60359067",
"0.5940562",
"0.5879642",
"0.5822711",
"0.58177835",
"0.5814207",
"0.57660544",
"0.5757099",
"0.5755097",
"0.5746251",
"0.5702823",
"0.5679750... | 0.74909616 | 0 |
Change first convolution layer input channels. | def patch_first_conv(model, in_channels):
# get first conv
for module in model.modules():
if isinstance(module, nn.Conv2d):
break
# change input channels for first conv
module.in_channels = in_channels
weight = module.weight.detach()
reset = False
if in_channels == 1:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def patch_first_conv(model, in_channels: int = 4) -> None:\n\n # get first conv\n for module in model.modules():\n if isinstance(module, torch.nn.Conv2d):\n break\n\n # change input channels for first conv\n module.in_channels = in_channels\n weight = module.weight.detach()\n # ... | [
"0.75123245",
"0.6696509",
"0.66346097",
"0.64516467",
"0.64232844",
"0.63495713",
"0.6230231",
"0.62070876",
"0.6168099",
"0.61499965",
"0.60493684",
"0.6044107",
"0.60128045",
"0.59726113",
"0.59684473",
"0.5937715",
"0.5925386",
"0.5920553",
"0.59197867",
"0.5918833",
"0.5... | 0.7558337 | 0 |
Returns True if user's answer matches with answer from database. | def is_correct_answer(answer):
db_answer = Answer.objects.get(id=int(list(answer.keys())[0]))
return db_answer.is_correct == bool(list(answer.values())[0]) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def check(self, answer):\n return self.answer == answer",
"def check_if_correct(self, q, ans):\n answer = OnlyAnswer.objects.get(question=q)\n cleaned_guess = (ans.strip()).lower()\n if answer.content == cleaned_guess:\n return True\n else:\n return Fa... | [
"0.7286002",
"0.72846013",
"0.7091092",
"0.6901954",
"0.67433286",
"0.6692698",
"0.6672469",
"0.655168",
"0.6540481",
"0.65291345",
"0.6469405",
"0.64011556",
"0.6371484",
"0.6338362",
"0.6301711",
"0.62966347",
"0.6283468",
"0.62660295",
"0.6132463",
"0.6112869",
"0.60622096... | 0.7438986 | 0 |
If the emission_rest_wavelengths parameter is present, return a nebular emission line spectrum. Currently uses several approximations for the velocity broadening. Currently does not affect photometry. Only provides samples of the nebular spectrum at outwave, so will not be correct for total power unless outwave densley... | def nebular(self, params, outwave):
if 'emission_rest_wavelengths' not in params:
return 0.
mu = vac2air(params['emission_rest_wavelengths'])
# try to get a nebular redshift, otherwise use stellar redshift,
# otherwise use no redshift
a1 = params.get('zred_emission',... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_spectrum(self, outwave=None, filters=None, nebular=True, **params):\n spec, neb, phot, ex = self.get_components(outwave, filters, **params)\n total_spec = (spec * self.params['mass'][:, None]).sum(axis=0)\n if nebular:\n total_spec += neb\n total_phot = (phot * self.p... | [
"0.57497835",
"0.5429985",
"0.53425705",
"0.52842164",
"0.52446645",
"0.5162241",
"0.50572604",
"0.5036854",
"0.5012343",
"0.49678618",
"0.4942516",
"0.49243805",
"0.49133074",
"0.49097195",
"0.4870502",
"0.48516658",
"0.48274308",
"0.48018676",
"0.47904533",
"0.47681382",
"0... | 0.6854461 | 0 |
Update the parameters, recording whether it was new for the ssp or basis parameters. If either of those changed, regenerate the relevant spectral grid(s). | def update(self, newparams):
for k, v in list(newparams.items()):
if k in self.basis_params:
# Make sure parameter is in dict, and check if it changed
if k not in self.params:
self.basis_dirty = True
self.params[k] = v
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update_parameters(self):\n # We update gamma, gamma0, lambda and nu in turn (Bottolo et al, 2011)\n self.update_gamma()\n self.update_gamma0()\n self.update_lambda()\n self.update_nu()\n if self.sample_xi:\n self.update_xi()",
"def update_parameters(self):... | [
"0.73953754",
"0.71710765",
"0.7023726",
"0.69720674",
"0.68460697",
"0.66629374",
"0.6656813",
"0.6526564",
"0.647887",
"0.6461412",
"0.6455409",
"0.638619",
"0.6373815",
"0.6373815",
"0.6373815",
"0.6373815",
"0.6373815",
"0.6373815",
"0.6373815",
"0.6373815",
"0.63724744",... | 0.74350566 | 0 |
Rebuild the component spectra from the SSPs. The component spectra include dust attenuation, redshifting, and spectral regridding. This is basically a proxy for COMPSP from FSPS, with a few small differences. In particular, there is interpolation in metallicity and the redshift and the output wavelength grid are taken ... | def build_basis(self):
if self.debug:
print('sps_basis: rebuilding basis')
# Setup the internal component basis arrays
inwave = self.ssp.wavelengths
nbasis = len(np.atleast_1d(self.params['mass']))
self.nbasis = nbasis
# nbasis = ( len(np.atleast_1d(self.param... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def process_component(self, i, outwave, filters):\n cspec = self.basis_spec[i, :].copy()\n cphot = 0\n inwave = self.ssp.wavelengths\n\n if self.safe:\n cspec = np.interp(self.params['outwave'], vac2air(inwave), cspec/a)\n cphot = 10**(-0.4 * getSED(inwave, cspec/a... | [
"0.5937564",
"0.5780565",
"0.5741519",
"0.56655246",
"0.563537",
"0.5506949",
"0.5402162",
"0.5372675",
"0.5352444",
"0.5346785",
"0.532719",
"0.531849",
"0.5266165",
"0.5228784",
"0.5225048",
"0.51991665",
"0.51623684",
"0.5162299",
"0.51584435",
"0.5140857",
"0.5140395",
... | 0.60962576 | 0 |
r"""align(imgDim, rgbImg, bb=None, landmarks=None, landmarkIndices=INNER_EYES_AND_BOTTOM_LIP) Transform and align a face in an image. | def align(imgDim, rgbImg,
landmarks, landmarkIndices=INNER_EYES_AND_BOTTOM_LIP,
skipMulti=True):
assert imgDim is not None
assert rgbImg is not None
assert landmarks is not None
#if bb is None:
# bb = self.getLargestFaceBoundingBox(rgbImg, skipMult... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def align(self, image, landmark_indices, anchor_points, size=96):\n # Detect face in image and find landmarks\n box = self.detect(image)\n landmarks = self.find_landmarks(image, box)\n\n # Select three points in the landmarks(Eyes and nose)\n points_in_image = landmarks[landmark_... | [
"0.6571622",
"0.65087074",
"0.6424263",
"0.63643926",
"0.62261367",
"0.62224346",
"0.6209903",
"0.60258204",
"0.6018538",
"0.58878434",
"0.5757735",
"0.56468785",
"0.552677",
"0.5469069",
"0.53907555",
"0.5254516",
"0.5184894",
"0.5080917",
"0.50786936",
"0.50399625",
"0.5037... | 0.7130995 | 0 |
Return a bs4 object containing all the tags in doc of the URL | def _grab_tags(self, url):
a = self._api_request(url)
return bs4.BeautifulSoup(a,features="html.parser") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_soup(url):\n return BeautifulSoup(requests.get(url).content, 'lxml')",
"def getSoup(url):\n return BeautifulSoup(getHtml(url), 'lxml')",
"def find_tag_urls(r):\n parser = MyHTMLParser()\n parser.feed(r)\n return parser.url_list",
"def request(self, url):\r\n\r\n req = self.get(u... | [
"0.7076313",
"0.70216066",
"0.69696605",
"0.6889851",
"0.6826193",
"0.68196535",
"0.6767906",
"0.67462474",
"0.67079365",
"0.67003834",
"0.66789085",
"0.66782737",
"0.6670707",
"0.66667145",
"0.66216266",
"0.6597798",
"0.65232784",
"0.64535815",
"0.64357543",
"0.6435498",
"0.... | 0.7892951 | 0 |
Gets the workspace zip for the specific build URL by parsing HTML The API has no way of retrieving the workspace zip AFAIK | def get_workspace_zip(self):
workspace_api = '/ws/'
# print("Checking Workspaces For: {}".format(self.url))
workspace_elements = self._grab_tags(self.url + workspace_api)
workspace_links = []
root_domain = urllib.parse.urlparse(self.url).scheme + '://' + urllib.parse.urlparse(sel... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def prepare_project(path: str):\n zip_path = os.path.join(path, 'Simulation.Machine.V1.zip')\n\n # Download zip file with project\n requested_file = requests.get(URL)\n with open(zip_path, 'wb') as f:\n f.write(requested_file.content)\n\n # Extract contents\n with ZipFile(zip_path, 'r') as... | [
"0.556513",
"0.5522339",
"0.5424023",
"0.5417535",
"0.53908026",
"0.5365669",
"0.5358795",
"0.5332443",
"0.52523816",
"0.5220812",
"0.5178104",
"0.5170915",
"0.5148962",
"0.51238537",
"0.51191694",
"0.5066204",
"0.5062707",
"0.5060167",
"0.5052632",
"0.50380456",
"0.5033808",... | 0.7396624 | 0 |
Recursively search through all jobs and projects to pull out build URLs | def get_all_build_links(url, auth=None, netloc_force=False):
all_build_links = []
if 'api/json' not in url:
# if the api endpoint isnt appended, then append it:
url += '/api/json/'
def recurse_to_build(url):
orig_url = urllib.parse.urlparse(url)
try:
json_reply = ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def process_builds(self):\n for p in self.product_config:\n p_str = p[0]\n\n for l in self.link_list:\n if l.startswith(p[1]):\n if not self.builds_list.has_key(p_str):\n self.builds_list[p_str] = []\n b_str = ... | [
"0.6178584",
"0.612089",
"0.60826075",
"0.59894234",
"0.5935299",
"0.5781459",
"0.5699846",
"0.56969726",
"0.5667781",
"0.560925",
"0.5579634",
"0.5579634",
"0.55440015",
"0.5480648",
"0.5456297",
"0.5444982",
"0.5421424",
"0.54137886",
"0.5393616",
"0.5388915",
"0.5386272",
... | 0.6822186 | 0 |
To load the descriptor settings from the config file,only HOG is supported | def load_descriptor(settings):
return {
'hog': descriptors.HogDescriptor.from_config_file(settings['hog']),
}.get(settings['train']['descriptor'], 'hog') # Default to HOG for invalid input | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def load_config(self):\n pass",
"def config():",
"def config():",
"def read_config(self, config_filename):",
"def loadConfig(self):\r\n self.config.read(self.CONFIG_FILE)\r\n try:\r\n assert \"Settings\" in self.config\r\n except AssertionError:\r\n print(\... | [
"0.64163566",
"0.60806596",
"0.60806596",
"0.5885641",
"0.58768445",
"0.58304346",
"0.58304346",
"0.582294",
"0.57977813",
"0.5787138",
"0.5759142",
"0.57564086",
"0.57534146",
"0.5717577",
"0.5700591",
"0.56643593",
"0.56641626",
"0.563442",
"0.56303775",
"0.5625049",
"0.562... | 0.7915412 | 0 |
Generator which yields all files in the given directories with any of the EXTENSIONS. | def get_files(dirs):
for dir in dirs:
for root, _, files in os.walk(dir):
for file in files:
path = Path(os.path.join(root, file))
if path.suffix in EXTENSIONS:
yield path | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_files_in_dir(dir, ext):\n import os\n\n for root, dirs, files in os.walk(dir):\n for file in files:\n if file.split('.')[1].lower() == ext.lower() or not ext:\n file_full_path = os.path.join(root, file)\n yield file_full_path",
"def search_images(\n ... | [
"0.7361726",
"0.7168468",
"0.70106226",
"0.6978779",
"0.69671875",
"0.6956483",
"0.69562167",
"0.69542754",
"0.6939163",
"0.68995976",
"0.68970984",
"0.683653",
"0.68256193",
"0.6820684",
"0.67836255",
"0.67363906",
"0.67210203",
"0.6719789",
"0.6704543",
"0.67027146",
"0.669... | 0.8138541 | 0 |
Set the hash preprocessors of the state and the action, in order to make them hashable. | def _initialize_hash(self):
# action
if isinstance(self.env.action_space, gym.spaces.Discrete):
self._hash_action = lambda x: x
elif isinstance(self.env.action_space, gym.spaces.Box):
if self.__class__.__name__ == "MCTS":
raise Exception("Cannot run vanil... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def init_hash_state(self) -> None:\n self.hash_states = [hashlib.sha1()]",
"def __setstate__(self, state):\n self.__dict__ = dict(state)\n self._init_compiled()",
"def hash_functions(self):\n pass",
"def _state_actions(self) -> dict:\n return {}",
"def state_encod_arch2(s... | [
"0.57571864",
"0.5435478",
"0.54035085",
"0.52372074",
"0.518619",
"0.5141052",
"0.5130122",
"0.50220853",
"0.5004999",
"0.49558762",
"0.4926324",
"0.49014458",
"0.48990655",
"0.48768932",
"0.48673987",
"0.48605478",
"0.48585635",
"0.4834343",
"0.48277575",
"0.48239538",
"0.4... | 0.5770757 | 0 |
Explores the current tree with the UCB principle until we reach an unvisited node where the reward is obtained with random rollouts. | def grow_tree(self):
decision_node = self.root
internal_env = copy.copy(self.env)
while (not decision_node.is_final) and decision_node.visits > 1:
a = self.select(decision_node)
new_random_node = decision_node.next_random_node(a, self._hash_action)
(new_d... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def UCT(rootstate, itermax, verbose=False):\n\n rootnode = Node(state=rootstate)\n\n for i in range(itermax):\n node = rootnode\n state = rootstate.Clone()\n\n # Select\n while node.untriedMoves == [] and node.childNodes != []: # node is fully expanded and non-terminal\n ... | [
"0.6164046",
"0.61358875",
"0.6106919",
"0.6031748",
"0.60115874",
"0.595056",
"0.59471905",
"0.59269196",
"0.58961433",
"0.58696514",
"0.58533907",
"0.58485657",
"0.5842488",
"0.5821475",
"0.5783845",
"0.5782573",
"0.57748175",
"0.5721878",
"0.57213783",
"0.5706393",
"0.5656... | 0.6590161 | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.