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 |
|---|---|---|---|---|---|---|
Return All Feed Sources | def get_all_feed_sources(request):
feed_sources = FeedSource.objects.all().order_by('-id')
return get_feed_sources_list(feed_sources) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def listsources():\n\tmain_url = \" https://newsapi.org/v2/sources?apiKey=5f81b593f35d42a8980313250c03d7e7\"\n\n\t# fetching data in json format \n\topen_source = requests.get(main_url).json() \n\n\t# getting all articles in a string sources\n\tsource = open_source[\"sources\"] \n\n\t# empty list which will \n\t# ... | [
"0.71941465",
"0.71610236",
"0.6967968",
"0.6939923",
"0.685093",
"0.6846315",
"0.6794876",
"0.6746038",
"0.67335147",
"0.6717489",
"0.66628605",
"0.6634832",
"0.66216797",
"0.6619418",
"0.6598849",
"0.6596755",
"0.6580428",
"0.6546504",
"0.64944905",
"0.6429307",
"0.6428021"... | 0.84350914 | 0 |
Partial method to extract exception messages to list | def _get_errors(exc):
if hasattr(exc, 'message'):
errors = exc.messages
else:
errors = [str(exc)]
return errors | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_error(self) -> List[str]:\n return []",
"def get_error(self) -> List[str]:\n return []",
"def GetLongLineExceptions(self):\n return []",
"def _render_extended_error_message_list(self, extended_error):\n messages = []\n if isinstance(extended_error, dict):\n i... | [
"0.63805306",
"0.63805306",
"0.6372775",
"0.62631696",
"0.60500824",
"0.60415626",
"0.5934655",
"0.59270895",
"0.59237975",
"0.5885909",
"0.5848883",
"0.577784",
"0.5772229",
"0.57692844",
"0.5768745",
"0.5656789",
"0.56534594",
"0.56390977",
"0.56339467",
"0.5612228",
"0.559... | 0.7112101 | 0 |
Displays the conflicts in a specific schedule given a requirements file. | def check_reqs(reqs_file, sched_file):
ras = scheduler.parse_file(reqs_file)
ras_dict = dict()
for ra in ras:
ras_dict[ra.name] = ra
sched = scheduler.parse_sched_file(sched_file)
count = 0
for curr in sched:
parts = curr.split('-')
curr_date = date(int(parts[0]), int(par... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def conflicts(request):\n\n form = ConflictsForm(request.GET)\n if form.is_valid():\n beg_date = form.cleaned_data['beg_date']\n end_date = form.cleaned_data['end_date']\n else:\n beg_date, end_date = get_week_range_by_date(datetime.datetime.today())\n\n terms = Term.prepare_confli... | [
"0.6083416",
"0.57799804",
"0.5715503",
"0.54279906",
"0.5343068",
"0.52080643",
"0.51846665",
"0.51749927",
"0.51412326",
"0.51344234",
"0.5128275",
"0.50786567",
"0.5051712",
"0.503836",
"0.50313216",
"0.49973714",
"0.49888486",
"0.49711156",
"0.49255145",
"0.49076065",
"0.... | 0.66495013 | 0 |
Rebalance tree after node insertion or deletion. | def _rebalance(self, val=None):
node = self.search(val)
if node is None:
node = self.root
if self.root is None:
return
try:
self._rebalance(node.left.data)
except AttributeError:
pass
try:
self._rebalance... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _rebalance(self):\n prev_height = self._height # Save current height for comparison later\n self._height = self.height() # Update the height of the node\n if self._unbalanced():\n if self.full():\n if self._leftchild._height > self._rightchild._height:\n ... | [
"0.75554925",
"0.7343056",
"0.7040202",
"0.7030208",
"0.6880421",
"0.68144614",
"0.6544322",
"0.6485529",
"0.6476007",
"0.6465227",
"0.6378443",
"0.6367502",
"0.6316389",
"0.6304218",
"0.6246138",
"0.623869",
"0.6230692",
"0.620086",
"0.61667925",
"0.6128051",
"0.6125295",
... | 0.74186516 | 1 |
Helper to replace the connections to node to nxt. | def _replace_node(self, nxt, node):
nxt.left = node.left
nxt.right = node.right
nxt.parent = node.parent
if node is self.root:
self.root = nxt
if nxt.left:
nxt.left.parent = nxt
if nxt.right:
nxt.right.parent = nxt
if nxt.parent... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def connect_nodes(self):\n for src_id, trg_id in itertools.product(self.selected_nodes, repeat=2):\n if src_id != trg_id:\n app.edges[src_id].add(trg_id)\n self.mark_as_unsaved()\n self.update()",
"def switchNeighbors(head):\n if head == None or head.next == None... | [
"0.6306071",
"0.61568826",
"0.61550254",
"0.6123998",
"0.58381",
"0.5836165",
"0.5787948",
"0.5719936",
"0.5719666",
"0.5714374",
"0.55667543",
"0.55650383",
"0.5557494",
"0.55529934",
"0.55362725",
"0.55246353",
"0.5511303",
"0.5506245",
"0.5463353",
"0.5454586",
"0.5420207"... | 0.68727446 | 0 |
Redirect from node1 to node2. | def _redirect(self, node1, node2):
if node1.parent.right is node1:
node1.parent.right = node2
else:
node1.parent.left = node2 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def connect_both(node1, node2, weight):\n connect_one_way(node1, node2, weight)\n connect_one_way(node2, node1, weight)",
"def move_to_node(self,node):\n path=self.get_path(self.current_node,node)\n self.move_to(path)",
"def connect_one_way(node1, node2, weight):\n node1.add_or_update_ne... | [
"0.60445195",
"0.58684015",
"0.58391327",
"0.5750028",
"0.5736963",
"0.57198584",
"0.56048125",
"0.55863553",
"0.5558446",
"0.54873115",
"0.5465547",
"0.54571635",
"0.5416378",
"0.54136115",
"0.54048353",
"0.5389015",
"0.53774303",
"0.5367003",
"0.5347666",
"0.5318217",
"0.52... | 0.7867398 | 0 |
Add newlines to a logger object | def add_newlines(self: logging.Logger, num_newlines=1) -> None:
self.removeHandler(self.base_handler)
self.addHandler(self.newline_handler)
# Main code comes here
for _ in range(num_newlines):
self.info('')
self.removeHandler(self.newline_handler)
self.addHandler(self.base_handler) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_line_in_log():\n logging.info(' ' + '-' * 60 + '\\n')",
"def logprint(self, message):\n print message\n self.log += message+\"\\n\"",
"def log(self, message, *args, newline):\n\n self.current_character.log(message, *args, newline=newline)",
"def log_msg(self, msg):\n se... | [
"0.6630974",
"0.62861097",
"0.6200761",
"0.61713684",
"0.6058086",
"0.60562426",
"0.60483265",
"0.5990074",
"0.5972366",
"0.5953456",
"0.59534085",
"0.5949501",
"0.5920461",
"0.5851288",
"0.5821413",
"0.5816214",
"0.5804447",
"0.57826835",
"0.5742061",
"0.5737293",
"0.5726202... | 0.70678204 | 0 |
Creates the logger for the current application | def create_logger(app_name: str) -> logging.Logger:
if not os.path.exists(os.path.join(os.getcwd(), 'logs')):
os.mkdir(os.path.join(os.getcwd(), 'logs'))
app_logfile = os.path.join(os.getcwd(), 'logs', f'{app_name}.log')
logger = logging.getLogger(f"{app_name}-logger")
logger.setLevel(logging.... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def log_setup(self):\n # Logger initialisation\n logger = logging.getLogger(self.app_name)\n logger.setLevel(logging.DEBUG)\n\n # Creating console handler and set level to debug\n ch = logging.StreamHandler()\n ch.setLevel(logging.DEBUG)\n\n # Creating formatter\n ... | [
"0.75154406",
"0.7406874",
"0.7310582",
"0.73023075",
"0.72598875",
"0.7259758",
"0.7158899",
"0.71581304",
"0.71384096",
"0.7136243",
"0.70920765",
"0.70719284",
"0.7055563",
"0.7045381",
"0.7019379",
"0.69999313",
"0.69985956",
"0.69716984",
"0.6966761",
"0.6965733",
"0.695... | 0.769293 | 0 |
Render the website's oauth page. | def oauth():
code = request.args.get('code')
if code:
params = deepcopy(settings)
url = "{host}/oauth2/access_token/".format(host=params.pop('host'))
params['code'] = code
params['client_id'] = params.pop('clientId')
params['redirect_uri'] = params.pop('redirectUR... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def front_page():\n vars = dict(request.args)\n vars.setdefault('output', vars.get('format'))\n\n key = vars.get('auth_entity')\n if key:\n vars['entity'] = ndb.Key(urlsafe=key).get()\n if vars['entity']:\n vars.setdefault('site', vars['entity'].site_name().lower())\n\n vars.update({\n silo + '_... | [
"0.74304885",
"0.6749856",
"0.65433884",
"0.65398455",
"0.6504993",
"0.64355445",
"0.61797065",
"0.61615616",
"0.6106211",
"0.6069451",
"0.6052601",
"0.6035346",
"0.6025927",
"0.6012938",
"0.5994196",
"0.5946412",
"0.5881522",
"0.5872709",
"0.5847579",
"0.5839746",
"0.5839746... | 0.68202096 | 1 |
Download and read DWD XML Weather Forecast File of Type KML. | def read(self, url: str):
log.info(f"Downloading KMZ file {basename(url)}")
kml = self.fetch(url)
log.info("Parsing KML data")
self.iter_elems = iterparse(BytesIO(kml), events=("start", "end"), resolve_entities=False)
prod_items = {
"issuer": "Issuer",
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_url_and_parse():\n \n # TODO: dynamic site_code\n #global site_code\n #\n #if not site_code:\n # site_code = get_site_code(city_name)\n\n urllib.request.urlretrieve(\n \"https://dd.weather.gc.ca/citypage_weather/xml/AB/s0000661_e.xml\", \"s0000661_e.xml\")\n tree = ET.... | [
"0.56716657",
"0.56129897",
"0.5438432",
"0.5406499",
"0.5384055",
"0.5358337",
"0.5321542",
"0.53106785",
"0.52844894",
"0.52812874",
"0.52606463",
"0.52481145",
"0.52425086",
"0.5232936",
"0.52064013",
"0.520311",
"0.5184435",
"0.51593626",
"0.51527905",
"0.51504207",
"0.51... | 0.72513247 | 0 |
Returns a list of all the physical bumps on the Create 2 | def physical_bumps():
return [Bump.BUMP_L, Bump.BUMP_R] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def pumps(self): \n return self._link_reg.pumps",
"def get_pump_list(self):\n return self.pump_array",
"def get_vendor_bills(self, count: int = 10) -> list:\n return list(\n itertools.islice(self.client.vendor_bills.get_all_generator(), count)\n )",
"def action_c... | [
"0.5822396",
"0.5725565",
"0.5721032",
"0.57186806",
"0.5560406",
"0.55304605",
"0.5493543",
"0.5493474",
"0.53512853",
"0.5330781",
"0.5298371",
"0.52830404",
"0.52013123",
"0.5195306",
"0.5159302",
"0.51538",
"0.51515377",
"0.51443803",
"0.5105714",
"0.50573933",
"0.5050986... | 0.70293695 | 0 |
Returns a list of all the light bumps on the Create 2. | def light_bumps():
return [Bump.LIGHT_BUMP_L, Bump.LIGHT_BUMP_FL, Bump.LIGHT_BUMP_CL,
Bump.LIGHT_BUMP_CR, Bump.LIGHT_BUMP_FR, Bump.LIGHT_BUMP_R] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def lights(self):\n return list(self.GetLights())",
"async def Lights_Description() -> List[Dict[str, Any]]:\n result = []\n for index, light in enumerate(busylightapi.manager.lights):\n result.append(\n {\n \"light_id\": index,\n \"name\": light.name,... | [
"0.66449255",
"0.6407675",
"0.63921744",
"0.6349192",
"0.6301567",
"0.6216425",
"0.5929051",
"0.58499926",
"0.57615566",
"0.5751924",
"0.563449",
"0.562275",
"0.56202555",
"0.56143504",
"0.5554627",
"0.55225164",
"0.54759777",
"0.54197073",
"0.5348882",
"0.5308788",
"0.530634... | 0.73039806 | 0 |
Determines if a message if a IR message from a dock | def is_dock_msg(msg):
return msg & 0xF0 == Dock.BASE | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def check_for_kill(comm, message):\n try:\n comm.messages.get(\"broadcast-kill\") # 12x cheaper than listl\n print(message)\n return True\n except comm.messages.client.exceptions.NoSuchKey:\n return False",
"def decompose(msg):\n rtn = {}\n\n if Dock.is_dock_msg(m... | [
"0.5816875",
"0.5482376",
"0.5379433",
"0.5278253",
"0.52585906",
"0.52375406",
"0.5201998",
"0.51965576",
"0.51545644",
"0.5095728",
"0.50897115",
"0.5078164",
"0.507621",
"0.5074198",
"0.5051895",
"0.50485533",
"0.5042112",
"0.5038949",
"0.50294524",
"0.5026693",
"0.5015654... | 0.6874699 | 0 |
Decomposes a dock IR message into the detected beams and force field. This method will check to see if the provided message is from a dock. | def decompose(msg):
rtn = {}
if Dock.is_dock_msg(msg):
rtn = {
Dock.RED_BUOY: bool(msg & Dock.RED_BUOY),
Dock.GREEN_BUOY: bool(msg & Dock.GREEN_BUOY),
Dock.FORCE_FIELD: bool(msg & Dock.FORCE_FIELD)
}
return rtn | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def decode_message(self, message):\r\n\r\n\t\tprint(\"Decoding message '{}'\".format(message))\r\n\r\n\t\tmessage_split = message[1:-1].split('||')\r\n\r\n\t\tif len(message_split) > 1: # Several messages are queued\r\n\t\t\tfor m in message_split:\r\n\t\t\t\tself.decode_message('|' + m + '|')\r\n\t\t\treturn\r\n... | [
"0.5267118",
"0.49720767",
"0.4961222",
"0.49351683",
"0.49119562",
"0.48676527",
"0.48319846",
"0.48317653",
"0.4825341",
"0.47967404",
"0.4766257",
"0.4739263",
"0.47169322",
"0.46567076",
"0.46360305",
"0.4620986",
"0.46061063",
"0.45974302",
"0.45940566",
"0.45775744",
"0... | 0.6553048 | 0 |
Creates a new instance of PIDController provided with a goal and the individual gains | def __init__(self, goal=0, kP=1, kI=1, kD=1, init_pt=0):
self._pid_lock = threading.Lock()
self.set_goal(goal)
self.reset(init_pt)
self.set_gains({
PIDController.KP_KEY: kP,
PIDController.KI_KEY: kI,
PIDController.KD_KEY: kD
}) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self, kp, ki, kd, tolerance,\n saturation=None, max_integral=None, integral_fade=1.0):\n super().__init__()\n self.tolerance = tolerance\n self.controller = pidController(kp, ki, kd, saturation=saturation,\n max_integral=max_integral, inte... | [
"0.6518662",
"0.54904646",
"0.54119706",
"0.5255919",
"0.5183708",
"0.50222105",
"0.50092596",
"0.49834642",
"0.49521568",
"0.49350682",
"0.49029905",
"0.49026063",
"0.48764795",
"0.48754042",
"0.48738855",
"0.48700404",
"0.48634544",
"0.48603043",
"0.4852328",
"0.4851333",
"... | 0.6670641 | 0 |
Resets the previous error time. | def reset_time(self):
self._prev_error_time = time.time() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def reset_error(self):\n\t\t\n\t\tself.error = None",
"def reset(self):\n\n self.elapsed_time = 0",
"def reset_error_state(self):\n self.error_state = Error.none\n self.error_info = ''",
"def _reset(self) -> ts.TimeStep:",
"def reset(self):\n self._timestep = np.array([0])",
"def ... | [
"0.77852577",
"0.7318812",
"0.72486573",
"0.7211997",
"0.7106713",
"0.70843196",
"0.7006914",
"0.69474334",
"0.6890593",
"0.6766076",
"0.6753054",
"0.66990274",
"0.6608443",
"0.6580561",
"0.6562556",
"0.6502796",
"0.64796436",
"0.64674515",
"0.6453745",
"0.64373565",
"0.64337... | 0.9294501 | 0 |
Sets the goal for the PID controller. | def set_goal(self, goal):
self._pid_lock.acquire() # Acquire Lock
self._goal = goal
self._pid_lock.release() # Release Lock | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_goal(self, **kwargs):\n return self.env.set_goal(**kwargs)",
"def goal(self, goal):\n\n self._goal = goal",
"def set_goal(self, goal: GoalType) -> None:\n self.goal = goal",
"def set_goal(self, x):\n self.controllers[0].set_goal(x)\n self.controllers[1].set_goal(x)"... | [
"0.72353566",
"0.6878171",
"0.6867699",
"0.686121",
"0.6811669",
"0.66538084",
"0.6361599",
"0.6180388",
"0.6142914",
"0.60614246",
"0.60093695",
"0.59347427",
"0.5907836",
"0.5900681",
"0.58977747",
"0.5873667",
"0.5873667",
"0.5847958",
"0.57549393",
"0.5752069",
"0.5594057... | 0.7567917 | 0 |
Retrieves the goal of the PID Controller. | def get_goal(self):
self._pid_lock.acquire() # Acquire Lock
rtn = self._goal
self._pid_lock.release() # Release Lock
return rtn | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_goal(self):\n return self.get_observation(self.env._get_goal())",
"def goal(self):\n return self._build_goal",
"def goal(self) -> Optional[pulumi.Input[str]]:\n return pulumi.get(self, \"goal\")",
"def get_goal_msg(self):\n goal_handle = self._as.current_goal\n \n ... | [
"0.6787776",
"0.6286115",
"0.61180484",
"0.6092645",
"0.58849204",
"0.5828273",
"0.5645308",
"0.5632437",
"0.5594528",
"0.5534305",
"0.54554325",
"0.541853",
"0.54180735",
"0.5350246",
"0.5350246",
"0.53072256",
"0.52519006",
"0.5225484",
"0.522036",
"0.52076226",
"0.51778346... | 0.6917194 | 0 |
Sets the warning song to the specified song number. This should be called before playing the warning song. | def set_warning_song(self, song_number):
self._warning_song_num = int(math.fabs(song_number)) % 5
# Song is in c major scale and is the 5th (G) to the 3rd (E).
cmd = "140 " + str(self._warning_song_num) + " 2 67 16 64 16"
self._serial_conn.send_command(cmd) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def play_warning_song(self):\n if self._warning_song_num is None:\n self.set_warning_song(0)\n\n self._serial_conn.send_command(\"141 \" + str(self._warning_song_num))",
"def set_happy_song(self, song_number):\n self._happy_song_num = int(math.fabs(song_number)) % 5\n\n # S... | [
"0.8164014",
"0.6481732",
"0.6222161",
"0.59834564",
"0.58476883",
"0.58476883",
"0.5832589",
"0.56763095",
"0.55746937",
"0.556166",
"0.54363596",
"0.54155654",
"0.54040843",
"0.53658545",
"0.52933496",
"0.5284162",
"0.52797306",
"0.526646",
"0.52188104",
"0.51960605",
"0.51... | 0.82101125 | 0 |
Plays the warning song | def play_warning_song(self):
if self._warning_song_num is None:
self.set_warning_song(0)
self._serial_conn.send_command("141 " + str(self._warning_song_num)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _play(self):\n # Play unless explicitely ignored in config\n if not self.alarm_builder.config._get_debug_option(\"DO_NOT_PLAY_ALARM\"):\n self.alarm_builder.play(AlarmWorker.audio)",
"def update(self, song: int) -> None:\n if 0 <= song < len(self.sounds):\n self.sou... | [
"0.6465088",
"0.6407871",
"0.63904196",
"0.63702834",
"0.63601696",
"0.6282263",
"0.6277445",
"0.62654936",
"0.62424767",
"0.6151498",
"0.61472845",
"0.6144805",
"0.6138071",
"0.61313224",
"0.6120033",
"0.61154944",
"0.61094755",
"0.6102339",
"0.6099751",
"0.6089556",
"0.6083... | 0.85360086 | 0 |
Sets the happy song to the specified song number. This should be called before playing the happy song. | def set_happy_song(self, song_number):
self._happy_song_num = int(math.fabs(song_number)) % 5
# Song is in c major scale and is the 5th (G) to the 3rd (E).
cmd = "140 " + str(self._happy_song_num) + " 2 64 16 67 16"
self._serial_conn.send_command(cmd) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def play_happy_song(self):\n if self._happy_song_num is None:\n self.set_happy_song(1)\n\n self._serial_conn.send_command(\"141 \" + str(self._happy_song_num))",
"def update(self, song: int) -> None:\n if 0 <= song < len(self.sounds):\n self.sounds[song].play()",
"def... | [
"0.8054545",
"0.664417",
"0.6517853",
"0.6176182",
"0.61182725",
"0.60147935",
"0.5744937",
"0.56604385",
"0.5570946",
"0.5564194",
"0.5535582",
"0.55184954",
"0.55106753",
"0.54808784",
"0.5475834",
"0.5468992",
"0.546218",
"0.5436016",
"0.54331815",
"0.5356054",
"0.53106105... | 0.8327107 | 0 |
Plays the happy song | def play_happy_song(self):
if self._happy_song_num is None:
self.set_happy_song(1)
self._serial_conn.send_command("141 " + str(self._happy_song_num)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def play_sound(self):\n # http://soundbible.com/2103-1-Person-Cheering.html\n my_path = os.path.dirname(__file__)\n sound_path = os.path.join(my_path, 'yay.mp3')\n sound = SoundLoader.load(sound_path)\n sound.play()",
"def play(self):\n pass",
"def play(self):\n\t\tpri... | [
"0.73099303",
"0.7217488",
"0.7202953",
"0.71257263",
"0.7124428",
"0.71038634",
"0.7079971",
"0.7036819",
"0.6993867",
"0.6915133",
"0.6888346",
"0.68812245",
"0.6830361",
"0.6828884",
"0.6825244",
"0.6780092",
"0.6757588",
"0.67484957",
"0.67401594",
"0.6732784",
"0.6730454... | 0.8363741 | 0 |
Reads the provided button's bit from the Buttons packet. This method is available to a robot in the PASSIVE, SAFE, or FULL state. | def read_button(self, button):
data = self._read_packet(Button.PACKET_ID, Button.DATA_BYTES)
# Gets first byte
if len(data) == Button.DATA_BYTES:
byte = struct.unpack("B", data)[0]
return bool(byte & button)
else:
return False | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def read(self, button):\n\n return self.hardware_interfaces[self._gpio].read(self._b_names[button])",
"def ReadOne(self,button):\n return bool(self.Bus.Read_uInt8(self.Address, 0x40+button))",
"def read_buttons(self):\n data = self._read_packet(Button.PACKET_ID, Button.DATA_BYTES)\n\n ... | [
"0.76606005",
"0.74095386",
"0.69239444",
"0.6785385",
"0.67204076",
"0.6530307",
"0.6455176",
"0.63392746",
"0.6320656",
"0.6304804",
"0.6298134",
"0.62084746",
"0.6171187",
"0.6151871",
"0.5996775",
"0.59908384",
"0.5934501",
"0.592418",
"0.59052503",
"0.5823691",
"0.582206... | 0.8228062 | 0 |
Reads the provided bump's bit from the Bump and wheel drop packet. This method is available to a robot in the PASSIVE, SAFE, or FULL state. | def read_bump(self, bump):
data = self._read_packet(Bump.PACKET_ID, Bump.DATA_BYTES)
if len(data) == Bump.DATA_BYTES:
byte = struct.unpack("B", data)[0]
return bool(byte & bump)
else:
return False | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def read_bump_wheel_drop(self):\n\n # Bump and Wheel drop packet information is interchangeable\n # in this case.\n data = self._read_packet(WheelDrop.PACKET_ID, WheelDrop.DATA_BYTES)\n\n if len(data) == WheelDrop.DATA_BYTES:\n byte = struct.unpack(\"B\", data)[0]\n\n ... | [
"0.7068343",
"0.6726274",
"0.64553845",
"0.61745536",
"0.57517564",
"0.57068944",
"0.5390857",
"0.5379472",
"0.5366276",
"0.52374977",
"0.5218928",
"0.51846385",
"0.5162526",
"0.5160921",
"0.5150776",
"0.51350546",
"0.5082591",
"0.5051435",
"0.5050488",
"0.504368",
"0.5042952... | 0.7672072 | 0 |
Reads the specified light bump sensor. This method is available in PASSIVE, SAFE, or FULL state. Only values from the Bump class should be passed in to this method as the specified light bump value. | def read_light_bump(self, light_bump):
data = self._read_packet(light_bump, Bump.LIGHT_DATA_BYTES)
if len(data) == Bump.LIGHT_DATA_BYTES:
return struct.unpack(">h", data)[0]
else:
return 0 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def read_bump(self, bump):\n data = self._read_packet(Bump.PACKET_ID, Bump.DATA_BYTES)\n\n if len(data) == Bump.DATA_BYTES:\n byte = struct.unpack(\"B\", data)[0]\n return bool(byte & bump)\n else:\n return False",
"def read_light_bumps(self):\n rtn = ... | [
"0.67314094",
"0.5991866",
"0.5798978",
"0.5798736",
"0.5619214",
"0.55873466",
"0.5552298",
"0.55446345",
"0.5469533",
"0.54468226",
"0.5320882",
"0.5320139",
"0.53098434",
"0.5296004",
"0.52721196",
"0.52486736",
"0.52097356",
"0.5209081",
"0.5206106",
"0.51948255",
"0.5174... | 0.7984124 | 0 |
Reads all the light bump sensor on the iRobot Create 2. This method is available to a robot in the PASSIVE, SAFE, or FULL state. | def read_light_bumps(self):
rtn = {}
for light_bump in Bump.light_bumps():
rtn[light_bump] = self.read_light_bump(light_bump)
return rtn | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def read_light_bump(self, light_bump):\n data = self._read_packet(light_bump, Bump.LIGHT_DATA_BYTES)\n\n if len(data) == Bump.LIGHT_DATA_BYTES:\n return struct.unpack(\">h\", data)[0]\n else:\n return 0",
"def get_bump_sensors(self):\n x=self.send_packet_check_re... | [
"0.6413741",
"0.6008232",
"0.5942121",
"0.5925277",
"0.58272475",
"0.55617225",
"0.548089",
"0.547599",
"0.54566234",
"0.5400661",
"0.53792256",
"0.5349697",
"0.534868",
"0.52767146",
"0.5245811",
"0.52437663",
"0.523763",
"0.5191179",
"0.5162148",
"0.5152366",
"0.51242745",
... | 0.6591236 | 0 |
Reads the provided wheel drop's bit from the Bump and wheel drop packet. This method is available to a robot in the PASSIVE, SAFE, or FULL state. | def read_wheel_drop(self, wheel_drop):
data = self._read_packet(WheelDrop.PACKET_ID, WheelDrop.DATA_BYTES)
if len(data) == WheelDrop.DATA_BYTES:
byte = struct.unpack("B", data)[0]
return bool(byte & wheel_drop)
else:
return False | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def read_bump_wheel_drop(self):\n\n # Bump and Wheel drop packet information is interchangeable\n # in this case.\n data = self._read_packet(WheelDrop.PACKET_ID, WheelDrop.DATA_BYTES)\n\n if len(data) == WheelDrop.DATA_BYTES:\n byte = struct.unpack(\"B\", data)[0]\n\n ... | [
"0.73851025",
"0.69642377",
"0.5358084",
"0.5344035",
"0.5337506",
"0.5197816",
"0.5173082",
"0.5127063",
"0.51059866",
"0.5095983",
"0.5042041",
"0.5022783",
"0.50138235",
"0.50050724",
"0.49956858",
"0.49634555",
"0.49330726",
"0.49276993",
"0.4920853",
"0.48635933",
"0.486... | 0.78514016 | 0 |
Reads all the wheel drops on the iRobot Create 2. This method is available to a robot in the PASSIVE, SAFE, or FULL state. | def read_wheel_drops(self):
data = self._read_packet(WheelDrop.PACKET_ID, WheelDrop.DATA_BYTES)
if len(data) == WheelDrop.DATA_BYTES:
byte = struct.unpack("B", data)[0]
return {
WheelDrop.WHEEL_DROP_L: bool(byte & WheelDrop.WHEEL_DROP_L),
WheelDr... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def read_wheel_drop(self, wheel_drop):\n data = self._read_packet(WheelDrop.PACKET_ID, WheelDrop.DATA_BYTES)\n\n if len(data) == WheelDrop.DATA_BYTES:\n byte = struct.unpack(\"B\", data)[0]\n return bool(byte & wheel_drop)\n else:\n return False",
"def read_b... | [
"0.56443477",
"0.553086",
"0.5527709",
"0.5387049",
"0.5382978",
"0.5253048",
"0.520016",
"0.5176538",
"0.51617205",
"0.51523834",
"0.5095421",
"0.50654536",
"0.50101584",
"0.49713272",
"0.4913931",
"0.4907659",
"0.49053866",
"0.49001467",
"0.48717758",
"0.48663768",
"0.47951... | 0.6462726 | 0 |
Reads all the wheel drops and bumps on the iRobot Create 2 in the bump and wheel drop packet. This method is available to a robot in the PASSIVE, SAFE, or FULL state. | def read_bump_wheel_drop(self):
# Bump and Wheel drop packet information is interchangeable
# in this case.
data = self._read_packet(WheelDrop.PACKET_ID, WheelDrop.DATA_BYTES)
if len(data) == WheelDrop.DATA_BYTES:
byte = struct.unpack("B", data)[0]
return {
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def read_wheel_drops(self):\n data = self._read_packet(WheelDrop.PACKET_ID, WheelDrop.DATA_BYTES)\n\n if len(data) == WheelDrop.DATA_BYTES:\n byte = struct.unpack(\"B\", data)[0]\n\n return {\n WheelDrop.WHEEL_DROP_L: bool(byte & WheelDrop.WHEEL_DROP_L),\n ... | [
"0.6611901",
"0.5658661",
"0.5465292",
"0.5347873",
"0.53358924",
"0.52502316",
"0.5249884",
"0.52008724",
"0.5177317",
"0.51620775",
"0.51261",
"0.5113082",
"0.5106844",
"0.50573146",
"0.5048263",
"0.50303495",
"0.502867",
"0.5025428",
"0.50118834",
"0.49771735",
"0.4921565"... | 0.65595144 | 1 |
Reads the specified encoder's count. | def read_encoder(self, encoder):
counts = self._read_encoder_raw(encoder)
return counts*math.pi*_WHEEL_DIAMETER / _COUNTS_PER_REV | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def read_delta_encoders_count_state(self):\n pass",
"def encoders_count(self):\r\n return self._get('encoders_count', {})",
"def read_count(buffer, offset, count):\n\n return buffer[offset:offset + count]",
"def get_count(self):\n return unpack(os.read(self.fd, 8))",
"def read(reade... | [
"0.682963",
"0.64673257",
"0.62826335",
"0.6097306",
"0.60596293",
"0.60385656",
"0.60026616",
"0.5991026",
"0.5969984",
"0.5962667",
"0.59440327",
"0.593011",
"0.59193146",
"0.58999217",
"0.5863255",
"0.5799434",
"0.5738165",
"0.5690645",
"0.5682714",
"0.56652296",
"0.559581... | 0.6531314 | 1 |
Read the specified IR character packet. | def read_ir_char(self, dir):
data = self._read_packet(dir, Dock.DATA_BYTES)
if len(data) == Dock.DATA_BYTES:
byte = struct.unpack("B", data)[0]
return byte
else:
return 0 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def read_char(self):\n return self._packers[\"b\"].unpack(self.read(1))[0]",
"def ReadChar(self):\n return self.unpack('c')",
"def _read_char(self):\n if self.read_pos >= len(self.data):\n self.char = \"\"\n else:\n self.char = self.data[self.read_pos]\n\n ... | [
"0.6626781",
"0.6615035",
"0.6597647",
"0.65835327",
"0.6410242",
"0.63561577",
"0.6355298",
"0.6334242",
"0.6323016",
"0.61830074",
"0.6181135",
"0.61219525",
"0.5915346",
"0.5860435",
"0.58445275",
"0.5834801",
"0.5817188",
"0.5785153",
"0.57540584",
"0.57190937",
"0.567923... | 0.6784839 | 0 |
Retrieves the charging state of the robot via the charging state packet. | def read_charging_state(self):
data = self._read_packet(Charging.PACKET_ID, Charging.DATA_BYTES)
if len(data) == Charging.DATA_BYTES:
return struct.unpack("B", data)[0]
else:
return 0 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_device_state(self, charger):\n data = {\n \"device_id\": self.uuid,\n \"cmd\": \"get_state\",\n \"token\": charger.token(),\n \"account_token\": self.api_token\n }\n headers = {\n \"Content-Type\": \"application/json\"\n }\n... | [
"0.7075033",
"0.6326543",
"0.6314042",
"0.631315",
"0.6306474",
"0.6249806",
"0.62402195",
"0.6222469",
"0.61727875",
"0.6145988",
"0.6135337",
"0.6102278",
"0.60604155",
"0.6010413",
"0.5940022",
"0.59325576",
"0.5901887",
"0.5881399",
"0.584315",
"0.583885",
"0.58024025",
... | 0.75002456 | 0 |
Calculates the change in angle between two encoder values. Both angles should be of the same unit (degree or radian). This method only support a differential drive system. | def angle(self, ref_angle, new_angle=None, radians=False, cw=True):
if new_angle is None:
new_angle = self.read_encoders()
diff = {}
# Only add the difference of the keys that match the value of encoder
# left or encoder right.
for dist in ref_angle:
if d... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def angle_difference(ang1,ang2,units):\n ang1r = angle_to_radians(ang1,units)\n ang2r = angle_to_radians(ang2,units)\n y = np.sin(ang2r-ang1r)\n x = np.cos(ang2r-ang1r)\n angdiffr = np.arctan2(y,x)\n return radians_to_angle(angdiffr,units)",
"def calculate_angle(asteroid_1: Asteroid, asteroid_2... | [
"0.72310394",
"0.7070686",
"0.6966585",
"0.6913901",
"0.6875004",
"0.67967904",
"0.67967904",
"0.67649186",
"0.6754971",
"0.6737686",
"0.6717077",
"0.6657913",
"0.6624008",
"0.66195256",
"0.66195256",
"0.6610916",
"0.6595404",
"0.65914005",
"0.659087",
"0.6585312",
"0.6569988... | 0.7255634 | 0 |
This begins by converting the provided value into a 16 bit two's complement integer. Next, it bounds the converted integer between the provided upper and lower bounds. | def _convert_bound(value, lower_bound, upper_bound):
# Converts value to 16 bit two's complement integer via bitwise.
most_sig_bit = 0x8000
# Gets the two least significant bits
convert_val = value & _BYTE << _BYTE_SIZE | value & _BYTE
# Extends the most significant bit if it is... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def map_01_to_16bit(value):\n # result = None\n # result = int(map_bound(value, 0.0, 1.0, 0, 65535))\n # return result\n # return int(map_bound(value, 0.0, 1.0, 0, 65535))\n # result = None\n # if value <= 0:\n # # result = 0\n # return 0\n # else:\n # if value >= 1:\n ... | [
"0.6709142",
"0.6585885",
"0.62387407",
"0.6119893",
"0.6076029",
"0.6074267",
"0.603281",
"0.6030608",
"0.6009207",
"0.5907811",
"0.59070516",
"0.5887754",
"0.584717",
"0.5768137",
"0.5753733",
"0.57271814",
"0.5713832",
"0.5703631",
"0.5701616",
"0.5684892",
"0.56532973",
... | 0.7287549 | 0 |
Sends the sensor command with the provided packet id to the robot and reads the robots response. | def _read_packet(self, packet_id, data_bytes):
self._serial_conn.send_command(_SENSORS_OPCODE+" "+str(packet_id))
return self._serial_conn.read_data(data_bytes) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _command(self, servo_id, instruction, *params):\n length = 3 + len(params)\n #print('length', length)\n \"\"\"\n checksum calculation:\n checksum = ~(ID + length+instruction+parms) if the numbers in the brackets\n are calculated and exceeded 255, then it takes the lowe... | [
"0.58767503",
"0.58414966",
"0.5820011",
"0.58169806",
"0.58055025",
"0.5673132",
"0.5644523",
"0.5616639",
"0.55147266",
"0.54833007",
"0.547546",
"0.54654247",
"0.5423958",
"0.5413912",
"0.54121715",
"0.5402151",
"0.54013747",
"0.53871274",
"0.5371295",
"0.5369249",
"0.5366... | 0.69131565 | 0 |
Calculate the difference between two encoder distances. This will consider the turnover. | def _encoder_diff(ref_count, new_count, forward=True):
if forward and ref_count > new_count:
return (Drive.MAX_DIST - ref_count) - (Drive.MIN_DIST - new_count)
elif not forward and new_count > ref_count:
return (Drive.MIN_DIST - new_count) - (Drive.MAX_DIST - ref_count)
e... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def distance(self, ref_dist, new_dist=None, forward=True):\n if new_dist is None:\n new_dist = self.read_encoders()\n\n enc_count = 0\n enc_sum = 0\n # For each encoder in both dictionaries increment encoder count and\n # add the difference between the encoder's value ... | [
"0.68873227",
"0.6565167",
"0.64041114",
"0.633405",
"0.6329175",
"0.6290871",
"0.625009",
"0.62264484",
"0.62226146",
"0.62065905",
"0.62048024",
"0.61978215",
"0.618405",
"0.61829215",
"0.6159514",
"0.6158887",
"0.6154213",
"0.6135386",
"0.6125355",
"0.6118691",
"0.61173",
... | 0.67269135 | 1 |
Return the time series spec or create one if it doesn't exist. New time series is linked to Instrument instr by FieldName. | def create_time_series(fieldName, instr):
spec = acm.FTimeSeriesSpec[fieldName]
if not spec:
spec = acm.FTimeSeriesSpec()
spec.Description('%s PnL History' % instr)
spec.FieldName(fieldName)
spec.RecType(acm.EnumFromString('B92RecordType', 'Instrument'))
spec.Commit()
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_time_series(for_date, instr, spec):\n return acm.FTimeSeries.Select01(\"day = '%s' and recaddr = %i \"\n \"and timeSeriesSpec = %i and runNo = 1\"\n % (for_date, instr.Oid(), spec.Oid()), '')",
"def create(self, name: str, meta: Dict = {}, type: str = \"timeseries\", **kwargs):\n ... | [
"0.5437413",
"0.53278315",
"0.5132824",
"0.4910915",
"0.48935473",
"0.48539826",
"0.48432764",
"0.48351282",
"0.4805524",
"0.47721493",
"0.47332403",
"0.4718104",
"0.47017023",
"0.4692835",
"0.4662472",
"0.46499807",
"0.4611805",
"0.46080402",
"0.4596876",
"0.4580391",
"0.457... | 0.7088663 | 0 |
Return FTimeSeries object (i.e. an object containing value from a time series) for specified time series spec, date and instrument. | def get_time_series(for_date, instr, spec):
return acm.FTimeSeries.Select01("day = '%s' and recaddr = %i "
"and timeSeriesSpec = %i and runNo = 1"
% (for_date, instr.Oid(), spec.Oid()), '') | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_time_series(fieldName, instr):\n spec = acm.FTimeSeriesSpec[fieldName]\n if not spec:\n spec = acm.FTimeSeriesSpec()\n spec.Description('%s PnL History' % instr)\n spec.FieldName(fieldName)\n spec.RecType(acm.EnumFromString('B92RecordType', 'Instrument'))\n spec.... | [
"0.61378187",
"0.5532435",
"0.53222436",
"0.53155756",
"0.5268903",
"0.5263808",
"0.52208465",
"0.51617223",
"0.51468915",
"0.51186866",
"0.50985974",
"0.505968",
"0.50076693",
"0.5005106",
"0.49813068",
"0.49161428",
"0.49107486",
"0.48923215",
"0.4852867",
"0.48494852",
"0.... | 0.72298265 | 0 |
Return all loan cash flow for specifc date from specified leg. Loan cash flow is identified by PS_DepositType add info being equal to specified type. | def GetCallAccCashFlow(leg, run_date, cf_type):
query = acm.CreateFASQLQuery('FCashFlow', 'AND')
query.AddAttrNode('Leg.Oid', 'EQUAL', leg.Oid())
query.AddAttrNode('PayDate', 'EQUAL', run_date)
query.AddAttrNode('CashFlowType', 'EQUAL', "Fixed Amount")
query.AddAttrNode('AdditionalInfo.PS_DepositTyp... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_cashflows_less_than(leg, run_date, cf_type):\n query = acm.CreateFASQLQuery('FCashFlow', 'AND')\n query.AddAttrNode('Leg.Oid', 'EQUAL', leg.Oid())\n query.AddAttrNode('PayDate', 'LESS', run_date)\n query.AddAttrNode('CashFlowType', 'EQUAL', \"Fixed Amount\")\n query.AddAttrNode('AdditionalIn... | [
"0.58007056",
"0.51954895",
"0.5128794",
"0.5107095",
"0.5090592",
"0.476301",
"0.47382727",
"0.47313467",
"0.4641812",
"0.46323827",
"0.46226966",
"0.46067303",
"0.45926726",
"0.45881712",
"0.45019516",
"0.44865096",
"0.44601813",
"0.4456895",
"0.4439898",
"0.44268337",
"0.4... | 0.6541988 | 0 |
Return all loan cash flows before specifc date from specified leg. Loan cash flow is identified by PS_DepositType add info being equal to specified type. | def get_cashflows_less_than(leg, run_date, cf_type):
query = acm.CreateFASQLQuery('FCashFlow', 'AND')
query.AddAttrNode('Leg.Oid', 'EQUAL', leg.Oid())
query.AddAttrNode('PayDate', 'LESS', run_date)
query.AddAttrNode('CashFlowType', 'EQUAL', "Fixed Amount")
query.AddAttrNode('AdditionalInfo.PS_Deposi... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def GetCallAccCashFlow(leg, run_date, cf_type):\n query = acm.CreateFASQLQuery('FCashFlow', 'AND')\n query.AddAttrNode('Leg.Oid', 'EQUAL', leg.Oid())\n query.AddAttrNode('PayDate', 'EQUAL', run_date)\n query.AddAttrNode('CashFlowType', 'EQUAL', \"Fixed Amount\")\n query.AddAttrNode('AdditionalInfo.P... | [
"0.5900546",
"0.4622312",
"0.4520557",
"0.44921994",
"0.44547892",
"0.44215465",
"0.44210744",
"0.44176406",
"0.44091272",
"0.43490028",
"0.43442965",
"0.43382567",
"0.4313873",
"0.43065736",
"0.43013513",
"0.4298931",
"0.42945644",
"0.42921874",
"0.42917156",
"0.42787942",
"... | 0.706523 | 0 |
Returns True if session creation is allowed (as determined by the super class's is_session_creation_enabled value and no requestspecific override has disabled sessions for this subject, False otherwise. This means session creation is disabled if the super is_session_creation_enabled property is False or if a request at... | def session_creation_enabled(self):
return (self._session_creation_enabled and
self.web_registry.session_creation_enabled) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def allow_new_session(self):\n return self._currSessionDiscardable",
"def private_session(self):\n return bool(\n lib.sp_session_is_private_session(self._session._sp_session))",
"def sessionValid(self):\n return self.request.getSession().isValid()",
"def sessionNew(self):\n ... | [
"0.6674522",
"0.6288012",
"0.611987",
"0.58222526",
"0.5800123",
"0.57902366",
"0.5765897",
"0.56896955",
"0.561705",
"0.56134635",
"0.55813694",
"0.5521292",
"0.5455969",
"0.54093575",
"0.53659534",
"0.53659534",
"0.53562754",
"0.5306992",
"0.52831423",
"0.52757114",
"0.5268... | 0.8258925 | 0 |
Open the first file in the list and create the header from the first line of the first file. | def create_header_from_file(file_list):
with open(file_list[0], 'r') as csvfile:
contents = csv.reader(csvfile)
row_number = 0
for row in contents:
if row_number ==0:
header = row
print("File header: ", header)
row_number += 1
ret... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_header(filepath):\n header = None\n for i, x in enumerate(open(filepath)):\n if i == 0:\n header = x\n return(header)",
"def pp_file_header(self):\n self.separator()\n for item in self.file_header:\n print(item.ljust(27, ' ') + \": {}\".format(self.file... | [
"0.6566252",
"0.63757396",
"0.6336485",
"0.620483",
"0.61852175",
"0.6170607",
"0.6093349",
"0.6035563",
"0.60349864",
"0.6021",
"0.60165304",
"0.5994707",
"0.5994172",
"0.59916407",
"0.5964539",
"0.59252673",
"0.591808",
"0.59101254",
"0.5888349",
"0.5882781",
"0.58517176",
... | 0.7658299 | 0 |
Get data from a csv file. In the processing this is used for getting data from the concatenated csv file but can be used for any. Write it into a pandas dataframe.date_column_list should be [1, 19] or similar, with the index of the columns that should be converted to dates | def get_data_from_csv(filepath, filename, datatypes, date_column_list):
concatenated_file = os.path.join(filepath, filename)
dataframe = get_data_from_csv_full_path(concatenated_file, datatypes, date_column_list)
return dataframe | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_data_from_csv_full_path(filepath, datatypes, date_column_list):\n\n dataframe = pandas.read_csv(filepath, dtype=datatypes, date_parser=pandas.to_datetime, parse_dates=date_column_list)\n\n return dataframe",
"def read_csv(config, input_file_path):\n header = read_csv_header(input_file_path)\n\n ... | [
"0.75140345",
"0.72193193",
"0.68739146",
"0.6817987",
"0.67866164",
"0.6698974",
"0.6677149",
"0.6672171",
"0.66711706",
"0.6670936",
"0.64637154",
"0.6446584",
"0.64413923",
"0.64293706",
"0.6426104",
"0.64083576",
"0.6387908",
"0.6373854",
"0.63398945",
"0.6335341",
"0.633... | 0.7665351 | 0 |
Get data from a csv file. In the processing this is used for getting data from the concatenated csv file but can be used for any. Write it into a pandas dataframe.date_column_list should be [1, 19] or similar, with the index of the columns that should be converted to dates | def get_data_from_csv_full_path(filepath, datatypes, date_column_list):
dataframe = pandas.read_csv(filepath, dtype=datatypes, date_parser=pandas.to_datetime, parse_dates=date_column_list)
return dataframe | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_data_from_csv(filepath, filename, datatypes, date_column_list):\n\n concatenated_file = os.path.join(filepath, filename)\n\n dataframe = get_data_from_csv_full_path(concatenated_file, datatypes, date_column_list)\n\n return dataframe",
"def read_csv(config, input_file_path):\n header = read_c... | [
"0.76642233",
"0.72183436",
"0.6874251",
"0.68164563",
"0.678676",
"0.66988724",
"0.6675445",
"0.66734153",
"0.6670892",
"0.66697973",
"0.64643896",
"0.64462715",
"0.64411694",
"0.6430269",
"0.64287794",
"0.6408976",
"0.638692",
"0.6373324",
"0.6339154",
"0.6334611",
"0.63313... | 0.75128126 | 1 |
Create csv files from the data as it is grouped by day. | def output_daily_files(dataframe, path, filename):
days = dataframe.groupby('date_time_day')
dataframe.groupby('date_time_day').size().reset_index(name='data points per day')
for day in days.groups:
print(day.date())
output_path = path + filename + "_" + str(day.date()) + '.csv'
pr... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def make_csv(idir, dates):\n for path, dirs, files in os.walk(idir):\n for date in dates:\n # first loop over output dir\n if not path.endswith(str(date)):\n continue\n arr = path.split('/')\n oname = '%s-%s.csv' % (arr[-2], arr[-1])\n ... | [
"0.694198",
"0.6872562",
"0.6830753",
"0.6723689",
"0.6640168",
"0.6443004",
"0.6358902",
"0.63040715",
"0.62817705",
"0.62778574",
"0.6272296",
"0.6240539",
"0.62286836",
"0.6219305",
"0.6161711",
"0.61344004",
"0.6130334",
"0.61212337",
"0.61146325",
"0.61035657",
"0.608811... | 0.7845971 | 0 |
Create a tuple of the date_time, latitude and longitude of a location in a dataframe from a given date_time. | def get_location(datetime, position_df):
latitude = position_df[position_df.date_time == datetime].latitude.item()
longitude = position_df[position_df.date_time == datetime].longitude.item()
location = (datetime, latitude, longitude)
return location | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_time_series_at_location(data, lat, lon, feature):\n\n ts = data.sel(lat=lat, lon=lon, method='nearest', drop=True).to_series()\n index = ts.index.get_level_values('time')\n values = ts.values\n\n return pd.DataFrame({'Date': index.values, feature: values})",
"def create_demo_location_history(... | [
"0.667102",
"0.6042708",
"0.6014541",
"0.57075053",
"0.5705346",
"0.5480165",
"0.54587775",
"0.53738266",
"0.5367151",
"0.53136206",
"0.5286916",
"0.52677363",
"0.5256691",
"0.5254006",
"0.5233893",
"0.52287805",
"0.5220375",
"0.51836544",
"0.51567215",
"0.51262206",
"0.51078... | 0.78045213 | 0 |
Convert a date in a string into a python date, where the dataframe and the variable name are known. | def string_to_datetime(dataframe):
print("Which variable would you like to convert from a date string to a python date?")
existing_variable = input()
print("What would you like to call the new date variable?")
new_variable = input()
dataframe[new_variable] = dataframe[existing_variable].dt.strftim... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def string_object_to_datetime(dataframe):\n\n print(\"Which variable would you like to convert from a date string to a python date?\")\n existing_variable = input()\n print(\"What would you like to call the new date variable?\")\n new_variable = input()\n\n dataframe[new_variable] = datetime.strptim... | [
"0.7501158",
"0.6790072",
"0.6781764",
"0.6770597",
"0.672437",
"0.6669885",
"0.66560954",
"0.6652141",
"0.66447526",
"0.6644526",
"0.66266483",
"0.6503308",
"0.64974356",
"0.6488791",
"0.6486182",
"0.6479067",
"0.64767814",
"0.64334184",
"0.6429908",
"0.63495094",
"0.6342947... | 0.74788135 | 1 |
Calculate the haversine or greatcircle distance in metres between two points with latitudes and longitudes, where they are known as the origin and destination. | def calculate_distance(origin, destination):
datetime1, lat1, lon1 = origin
datetime2, lat2, lon2 = destination
radius = 6371 # km
dlat = math.radians(lat2 - lat1)
dlon = math.radians(lon2 - lon1)
a = math.sin(dlat / 2) * math.sin(dlat / 2) + math.cos(math.radians(lat1)) \
* math.cos(... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def distance(origin, destination): ## https://stackoverflow.com/questions/44743075/calculate-the-distance-between-two-coordinates-with-python\n lat1, lon1 = origin\n lat2, lon2 = destination\n radius = 6371*0.62 # miles\n\n dlat = math.radians(lat2 - lat1)\n dlon = math.radians(lon2 - lon1)\n a ... | [
"0.75903994",
"0.7581176",
"0.75455487",
"0.7531257",
"0.7419517",
"0.74132216",
"0.73949015",
"0.7383521",
"0.7311661",
"0.72562194",
"0.7238989",
"0.7202122",
"0.7194691",
"0.71847636",
"0.71827453",
"0.7173336",
"0.71522576",
"0.71509475",
"0.714448",
"0.71255165",
"0.7122... | 0.7787034 | 0 |
Calculate the speed in knots between two locations which are dictionaries containing latitude, longitude and date_time. | def knots_two_points(origin, destination):
distance_m = calculate_distance(origin, destination)
datetime1_timestamp, lat1, lon1 = origin
datetime2_timestamp, lat2, lon2 = destination
datetime1 = datetime1_timestamp.timestamp()
datetime2 = datetime2_timestamp.timestamp()
seconds = abs((dateti... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def car_speed(time_loc, prev_time_loc):\n timestamp, lat, longitude = time_loc\n prev_timestamp, prev_lat, prev_longitude = prev_time_loc\n\n dist = geopy.distance.distance((lat, longitude), (prev_lat, prev_longitude)).miles\n # Time difference in milliseconds\n time_diff = timestamp - prev_timestam... | [
"0.58214194",
"0.579355",
"0.56663066",
"0.56069",
"0.5578686",
"0.55682963",
"0.55682963",
"0.55682963",
"0.55682963",
"0.55682963",
"0.55472785",
"0.5474715",
"0.5464001",
"0.54027903",
"0.5389351",
"0.5357196",
"0.53546923",
"0.5334414",
"0.5303193",
"0.5286532",
"0.527008... | 0.72649795 | 0 |
Set the timezone to be UTC. | def set_utc(date_time):
utc = datetime.timezone(datetime.timedelta(0))
date_time = date_time.replace(tzinfo=utc)
return date_time | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_timezone(self, to_tz):\n self.startdate = to_tz.localize(self.startdate.replace(tzinfo=None))\n self.enddate = to_tz.localize(self.enddate.replace(tzinfo=None))\n self.timezone = to_tz",
"def fromutc(self, dt):\n if dt.tzinfo is None:\n return dt.replace(tzinfo=self... | [
"0.72103435",
"0.71776843",
"0.7111709",
"0.7052505",
"0.68563294",
"0.68358237",
"0.68358237",
"0.68358237",
"0.68358237",
"0.68358237",
"0.66069865",
"0.65402013",
"0.6403162",
"0.6390136",
"0.6363629",
"0.6363629",
"0.63539517",
"0.6352093",
"0.6342055",
"0.63034976",
"0.6... | 0.72553647 | 0 |
Calculate the speed between consectutive points and add this as a variable to the dataframe. | def calculate_speed(position_df):
print("Calculating speed of track")
earliest_date_time = position_df['date_time'].min()
current_date = earliest_date_time
previous_position = get_location(earliest_date_time, position_df)
#print("Previous position: ", previous_position)
#datetime_previous, l... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_speed(self):\n return self.__corrds[self.X_SPEED], self.__corrds[self.Y_SPEED]",
"def _calc_speed_features(self):\n if len(self.ball_pos_stamps) >= NUM_STAMPS_CALC_SPEED:\n vx = 0\n vy = 0\n counter = 0\n for i in range(NUM_STAMPS_CALC_SPEED):\n ... | [
"0.6205459",
"0.61389077",
"0.6073118",
"0.6069948",
"0.6020611",
"0.6010716",
"0.59792453",
"0.59792453",
"0.5810725",
"0.5810725",
"0.5795017",
"0.5666431",
"0.5643413",
"0.55845016",
"0.5575384",
"0.5570548",
"0.5568289",
"0.5568289",
"0.5565899",
"0.5557476",
"0.5556018",... | 0.63845634 | 0 |
Analyse the speed that has been calculated and flag the data points accordingly. | def analyse_speed(position_df):
print("Analysing speed of track")
upper_bound = get_stats(position_df, 'speed')
print("Upper bound:", upper_bound)
# no speed value
position_df.loc[position_df['speed'].apply(math.isnan), 'measureland_qualifier_flag_speed'] = 9 # missing values
print("Rows where... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _calc_speed_features(self):\n if len(self.ball_pos_stamps) >= NUM_STAMPS_CALC_SPEED:\n vx = 0\n vy = 0\n counter = 0\n for i in range(NUM_STAMPS_CALC_SPEED):\n for j in range(i+1, NUM_STAMPS_CALC_SPEED):\n bps_i = self.ball_po... | [
"0.63325125",
"0.60852146",
"0.60852146",
"0.5910877",
"0.5835467",
"0.5824722",
"0.5761051",
"0.5743983",
"0.57370144",
"0.57069635",
"0.5693888",
"0.56703067",
"0.5669882",
"0.5654955",
"0.56399757",
"0.5597239",
"0.5595384",
"0.5584568",
"0.5552577",
"0.555006",
"0.5546797... | 0.65621316 | 0 |
Analyse the distance between the points. Even when the ship is stationary, the lat and long vary slightly. Where there is an error in the lat and long being the same in consecutive points, the distance should be greater than 0 (to 6 dp, which is equivalent to 0.19 cm at the Equator). | def analyse_distance_between_points(position_df):
print("Analysing distance between consecutive points.")
maximum_distance = 0.019 # 1 x 10^-6 of a degree is 0.019 m
# no distance value
position_df.loc[position_df['distance'].apply(math.isnan), 'measureland_qualifier_flag_distance'] = 9 # missing val... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def calculateDistanceBetweenPoints(lat1,lon1,lat2,lon2):\n\treturn Geodesic.WGS84.Inverse(lat1,lon1, lat2, lon2)['s12']",
"def road_distance(lat1, lon1, lat2, lon2):\n point1 = lat1, lon1\n point2 = lat2, lon2\n url = \"https://maps.googleapis.com/maps/api/distancematrix/json?origins={0},{1}&destination... | [
"0.7262544",
"0.66239125",
"0.6588583",
"0.6551321",
"0.6533308",
"0.6515686",
"0.64724946",
"0.64680743",
"0.64418674",
"0.6419749",
"0.63746256",
"0.6371783",
"0.6368408",
"0.6347524",
"0.631554",
"0.6312636",
"0.6309692",
"0.62915975",
"0.62739503",
"0.626852",
"0.62599057... | 0.6638487 | 1 |
Calculate the difference between two bearings, based on bearings between 0 and 360. | def calculate_bearing_difference(current_bearing, previous_bearing):
difference = current_bearing - previous_bearing
while difference < -180:
difference += 360
while difference > 180:
difference -= 360
return difference | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def CalculateCompassDifference(a, b):\n delta = NormalizeAngle(a - b)\n return delta",
"def heading_difference(self, other_heading):\n diff = abs(self.heading - other_heading)\n if diff > 180:\n diff = 360 - diff\n return diff",
"def angle_diff(a1, a2):\n a = a1 - a2\n i... | [
"0.73599833",
"0.6880248",
"0.68224984",
"0.671869",
"0.67171574",
"0.66473395",
"0.66381854",
"0.66117483",
"0.66117483",
"0.6520156",
"0.64502794",
"0.64502794",
"0.64371663",
"0.62577987",
"0.6250261",
"0.6221615",
"0.6191899",
"0.6185481",
"0.61676335",
"0.61280036",
"0.6... | 0.80572766 | 0 |
Analyse the change in the course between two points regarding the bearing and acceleration these features need information from previous points. | def analyse_course(position_df):
print("Analysing course of track")
total_data_points = len(position_df)
earliest_date_time = position_df['date_time'].min()
current_date = earliest_date_time
previous_position = get_location(earliest_date_time, position_df)
datetime_previous, latitude_previous... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _calc_speed_features(self):\n if len(self.ball_pos_stamps) >= NUM_STAMPS_CALC_SPEED:\n vx = 0\n vy = 0\n counter = 0\n for i in range(NUM_STAMPS_CALC_SPEED):\n for j in range(i+1, NUM_STAMPS_CALC_SPEED):\n bps_i = self.ball_po... | [
"0.5762477",
"0.56302744",
"0.5575331",
"0.5492774",
"0.5490755",
"0.54605937",
"0.5433181",
"0.5433181",
"0.53979737",
"0.53446215",
"0.53392273",
"0.5332665",
"0.53279614",
"0.53275424",
"0.53230864",
"0.5313829",
"0.5306313",
"0.5281994",
"0.52609384",
"0.5243571",
"0.5234... | 0.6443012 | 0 |
Calculate the overall data quality flag taking into account the others that have been assigned. | def calculate_measureland_qualifier_flag_overall(row):
mqf_tuple = (row['measureland_qualifier_flag_speed'],
row['measureland_qualifier_flag_distance'],
row['measureland_qualifier_flag_acceleration'],
row['measureland_qualifier_flag_visual'])
if mqf_tuple.cou... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def quality_data(self, s):\n known_symbols = np.mod(range(176),48)>=32\n print('quality_data',np.sum(np.real(s[known_symbols])<0))\n success = np.sum(np.real(s[known_symbols])<0) < 20\n return success,0 ## no doppler estimate for data frames",
"def quality_fis(self,fis):\n if f... | [
"0.6451386",
"0.60514176",
"0.595479",
"0.5936915",
"0.57833517",
"0.5775925",
"0.57434183",
"0.5740497",
"0.56944513",
"0.5693227",
"0.56801933",
"0.56720245",
"0.5591802",
"0.55496436",
"0.55253345",
"0.54495364",
"0.5421906",
"0.54183483",
"0.54179144",
"0.5415607",
"0.538... | 0.6428443 | 1 |
Remove the intermediate step qualifier flag columns that are not required in the final output data set. | def remove_intermediate_columns(dataframe):
combined_dataframe_dropped_cols = dataframe.drop(columns = ['measureland_qualifier_flag_speed',
'measureland_qualifier_flag_distance',
'measure... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def eliminateRedundantInfo(self):\n\n allEliminated = False\n edep = self.energyDependentWidths\n for colId in range(edep.nColumns)[::-1]:\n column = edep.columns[colId]\n columnData = edep.getColumn( column.name, units='eV' )\n if len(set( columnData ) ) == 1:... | [
"0.5762991",
"0.54455286",
"0.54203403",
"0.53003746",
"0.5283763",
"0.5281597",
"0.52428263",
"0.52249265",
"0.52244925",
"0.51974267",
"0.5169289",
"0.51507044",
"0.51137793",
"0.5095008",
"0.50759375",
"0.5040321",
"0.5026872",
"0.5004204",
"0.4998381",
"0.49654576",
"0.49... | 0.6163486 | 0 |
Choose rows from the dataframe according to values in one of the columns. | def choose_rows(rows):
# Ensure that the object is not empty.
assert(len(rows) > 0)
# The following rows preferentially select data where the device_id=64 (i.e the GLONASS over the Trimble).
# Also select by data quality (1 = good value, 2 = probably good value).
# If the data quality is not good,... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def extract_relevant_rows(df, column_name, column_value, not_equal=False):\n\n if not_equal:\n return df.loc[df[column_name] != column_value]\n\n return df.loc[df[column_name] == column_value]",
"def _filter(self, col: str, val: Any) -> pd.DataFrame:\n return self._df[self._df[col] == val]",
... | [
"0.60818195",
"0.5826822",
"0.5779508",
"0.573627",
"0.5658017",
"0.558915",
"0.55783916",
"0.5562325",
"0.5559441",
"0.55420333",
"0.5506508",
"0.55038416",
"0.5499845",
"0.54789746",
"0.54606724",
"0.5433628",
"0.54250365",
"0.53969055",
"0.53790253",
"0.5374446",
"0.534928... | 0.6122471 | 0 |
Create a new dataframe from the prioritised points according to the conditions required. Rows are chosen from small groups which occur at the same time (to seconds). | def prioritise_data_points(dataframe, output_filepath, output_filename):
# Beginning to prioritise data points. Firstly ensure that the data are sorted by date and time.
dataframe = dataframe.sort_values(['date_time'])
last_processed_datetime_secs = None
rows_pending_decision = []
progress_count... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_pre_df(temp_pre_df):\n \n event_time_max = temp_pre_df['event_time'].max()\n cat_dfs = []\n for num in np.arange(0,(1080/2)+1,30)[1:]:\n # making <= null i.e keeping >\n temp_pre_df.loc[temp_pre_df['event_time'] <= int(num), 'event_time'] = np.nan\n for col in ['event_name'... | [
"0.567459",
"0.5266208",
"0.5183847",
"0.51282346",
"0.5121264",
"0.50491226",
"0.50445664",
"0.49976778",
"0.49790773",
"0.4944259",
"0.4943229",
"0.49305478",
"0.48992634",
"0.48914003",
"0.4884616",
"0.48839062",
"0.48819488",
"0.48802802",
"0.48760328",
"0.486246",
"0.486... | 0.6297207 | 0 |
Get number of points from each device in prioritised dataframe | def get_device_summary(dataframe):
print("Total number of points: ", len(dataframe))
print("The number of rows from each device are as follows: ", dataframe.groupby(['device_id']).size()) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_dist_count(df):\n df_dist = df.apply(lambda r: r/sum(r) if sum(r)>0 else r, axis=1)\n df_count = pd.DataFrame()\n df_count['count'] = df.apply(lambda r: sum(r), axis=1)\n # we can't really distinguish class 1/4 and 2/7,\n # maybe this will help to seperate 14/27\n df_count['count_14'] = d... | [
"0.6276028",
"0.6060957",
"0.6040219",
"0.5901118",
"0.58417374",
"0.58276767",
"0.582397",
"0.5809163",
"0.57872033",
"0.57382846",
"0.5704486",
"0.5683693",
"0.56827277",
"0.56554943",
"0.5646682",
"0.56145674",
"0.5590394",
"0.55788803",
"0.55454695",
"0.5504899",
"0.54906... | 0.6771763 | 0 |
Parse the display lines and return as much as we can infer about the state of the amp. Note that the maximum length of sources is 8 characters. Display line 2 is an informational display with multiple purposes so we decode what we can but it's up to the caller to decide what to do when one item disappears when another ... | def parse_display_lines(self):
is_on = None
source_name = None
volume = None
mute_on = None
party_mode_on = None
info = None
rec_source = None
zone2_source = None
zone2_volume = None
zone3_source = None
zone3_volume = None
z... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def read_log(self, info_stream):\n fields={'name': \"nameshort:\\s+(?P<name>\\S[\\s\\S]+)$\",\n \"title\": \"episodeshort:\\s+(?P<title>\\S[\\s\\S]+)$\",\n \"full title\": \"title:\\s+(?P<full_title>\\S[\\s\\S]+)$\",\n \"description\":\"desc:\\s+(?P<description>\... | [
"0.5667453",
"0.5577402",
"0.55093837",
"0.539945",
"0.5389532",
"0.5278722",
"0.52660465",
"0.5256899",
"0.52339995",
"0.513899",
"0.5048906",
"0.5005927",
"0.49827233",
"0.49649656",
"0.4956714",
"0.49489126",
"0.49478963",
"0.49371415",
"0.49156973",
"0.4906018",
"0.488034... | 0.7945108 | 0 |
returns the update info saved in the update_info.json file. | def get_update_info():
update_info_path = os.path.join(_default_basedir("OctoPrint"), "update_info.json")
try:
with open(update_info_path, "r") as f:
update_info = json.load(f)
except IOError:
raise RuntimeError("Could not load update info")
except ValueError as e:
ra... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def last_update(self):\r\n request = http.Request('GET', '/metadata/last_update.json')\r\n return request, parsers.parse_json",
"def updates(self):\n return self._get_page('updates').json()",
"def get_updates(self) -> dict:\n url = self.URL + \"getUpdates\"\n js = self.get_js... | [
"0.6842781",
"0.6825544",
"0.6760401",
"0.6695358",
"0.6490341",
"0.62664664",
"0.61488295",
"0.6123632",
"0.6107774",
"0.60368365",
"0.60149324",
"0.59930795",
"0.5889623",
"0.58664274",
"0.5860153",
"0.58081394",
"0.576707",
"0.575865",
"0.57361627",
"0.57331353",
"0.570364... | 0.87182504 | 0 |
build the wheels of the packages in the queue. | def build_wheels(build_queue):
try:
if not os.path.isdir(PIP_WHEEL_TEMP_FOLDER):
os.mkdir(PIP_WHEEL_TEMP_FOLDER)
except OSError as e:
raise RuntimeError("can't create wheel tmp folder {} - {}".format(PIP_WHEEL_TEMP_FOLDER, e))
for venv, packages in build_queue.items():
t... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def install_wheels(install_queue):\n if not isinstance(install_queue, dict):\n raise RuntimeError(\"install queue is not a dict\")\n\n for venv, packages in install_queue.items():\n tmp_folder = os.path.join(PIP_WHEEL_TEMP_FOLDER, re.search(r\"\\w+((?=\\/venv)|(?=\\/bin))\", venv).group(0))\n ... | [
"0.67037266",
"0.6448939",
"0.63929045",
"0.6327373",
"0.6008243",
"0.59799784",
"0.59722793",
"0.5940384",
"0.5918518",
"0.5817111",
"0.5769088",
"0.5679094",
"0.5668807",
"0.5619912",
"0.5609576",
"0.56073725",
"0.5605971",
"0.5604782",
"0.5592366",
"0.5588438",
"0.5583262"... | 0.7769356 | 0 |
installs the wheels in the given venv of the queue. | def install_wheels(install_queue):
if not isinstance(install_queue, dict):
raise RuntimeError("install queue is not a dict")
for venv, packages in install_queue.items():
tmp_folder = os.path.join(PIP_WHEEL_TEMP_FOLDER, re.search(r"\w+((?=\/venv)|(?=\/bin))", venv).group(0))
pip_args = [... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def build_wheels(build_queue):\n try:\n if not os.path.isdir(PIP_WHEEL_TEMP_FOLDER):\n os.mkdir(PIP_WHEEL_TEMP_FOLDER)\n except OSError as e:\n raise RuntimeError(\"can't create wheel tmp folder {} - {}\".format(PIP_WHEEL_TEMP_FOLDER, e))\n\n for venv, packages in build_queue.item... | [
"0.70450777",
"0.64840436",
"0.6472613",
"0.6374757",
"0.63113153",
"0.62699497",
"0.625346",
"0.6180112",
"0.6106747",
"0.6089126",
"0.60671085",
"0.60669553",
"0.6066162",
"0.6043353",
"0.6011987",
"0.60108835",
"0.60072094",
"0.5946527",
"0.5939804",
"0.5906296",
"0.590227... | 0.7810384 | 0 |
build the queue of packages to install. | def build_queue(update_info, dependencies, plugin_archive):
install_queue = {}
install_queue.setdefault(
update_info.get(UPDATE_CONFIG_NAME).get("pip_command", DEFAULT_OPRINT_VENV), []
).append(
{
"name": PLUGIN_NAME,
"archive": plugin_archive,
"target": ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def detect_install_queue(env, install_queue=[]):\n\n _env = env()\n if _env.done():\n print \"[info]\", env.__name__, \"is already done.\"\n return install_queue\n else:\n if env not in install_queue:\n install_queue.insert(0, env)\n\n requires = _env.requires()\n if ... | [
"0.64300483",
"0.6317907",
"0.60502356",
"0.60038203",
"0.5953069",
"0.5949427",
"0.5947298",
"0.5918809",
"0.5888587",
"0.58734226",
"0.58508694",
"0.5847698",
"0.5825394",
"0.577823",
"0.5763402",
"0.5737082",
"0.5720837",
"0.5693326",
"0.5660723",
"0.5659705",
"0.56068695"... | 0.6485311 | 0 |
download the archive of the Plugin and copy dependencies and update script in the working directory. | def loadPluginTarget(archive, folder):
# download target repo zip
req = retryget(archive)
filename = archive.split("/")[-1]
zip_file_path = os.path.join(folder, filename)
try:
with open(zip_file_path, "wb") as output_file:
output_file.write(req.content)
except IOError:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def download(self):\n opsys, machine = get_platform()\n _platform = f\"{opsys}_{machine}\"\n\n plugin_dir = f\"{self._temp_dir}/terraform-plugins\"\n\n if not os.path.isdir(plugin_dir):\n os.mkdir(plugin_dir)\n for name, details in self._plugins.items():\n u... | [
"0.65189177",
"0.6304876",
"0.6303991",
"0.62665415",
"0.62513655",
"0.62227494",
"0.62170863",
"0.6120098",
"0.61069363",
"0.6081916",
"0.5874516",
"0.5856715",
"0.5817603",
"0.5802318",
"0.5788798",
"0.57426304",
"0.57387817",
"0.566455",
"0.5655254",
"0.5639781",
"0.563580... | 0.7154758 | 0 |
loads the dependencies.txt and the update_script of the given target and executes the new update_script. | def main():
args = _parse_arguments()
if args.call:
if args.archive is None:
raise RuntimeError(
"Could not run update archive is missing"
)
run_update()
else:
folder = args.folder
import os
if not os.access(folder, os.W_OK)... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def run_update():\n\n args = _parse_arguments()\n\n # get dependencies\n dependencies = get_dependencies(args.folder)\n\n # get update config of dependencies\n update_info = get_update_info()\n\n install_queue = build_queue(\n update_info, dependencies, args.archive\n )\n\n print(\"i... | [
"0.6054727",
"0.5840034",
"0.5559024",
"0.546411",
"0.5432003",
"0.5430221",
"0.5367228",
"0.5366944",
"0.53578764",
"0.53544587",
"0.5335627",
"0.5335201",
"0.5312373",
"0.5283287",
"0.52739245",
"0.5267964",
"0.52657044",
"0.5254667",
"0.52486074",
"0.52236706",
"0.52010816... | 0.611467 | 0 |
Check if the content of a cell only has numbers. | def is_number(self, cell):
for token in self._cell_tokenizer.tokenize(cell.get_text()):
if self._get_token_type(token) == 'NAME':
return False
return True | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def must_contain_digit(cell):\n # Check if it's nan first\n if check_empty(cell):\n return True\n return not bool(re.search(\"\\d\", str(cell)))",
"def must_be_numeric(cell):\n # Check if it's nan first\n if check_empty(cell):\n return True\n # If it's not nan, check it's a number... | [
"0.8166208",
"0.7570343",
"0.72052854",
"0.7055605",
"0.6967532",
"0.6934029",
"0.6917894",
"0.6893806",
"0.6839475",
"0.6811044",
"0.6756402",
"0.6728491",
"0.66914386",
"0.66888285",
"0.66629595",
"0.6654778",
"0.6630367",
"0.66051346",
"0.66025007",
"0.65843946",
"0.655187... | 0.76327354 | 1 |
Parses the content of a cell to identify its value and unit. | def process_values_unit(self, cell, units={}, unit_type=None):
result = []
tokens = self._cell_tokenizer.tokenize(cell.get_text(), keep_space=False, keep_skip=False)
if not self.is_valued_cell(cell):
raise TableException('%s does not contain a unit' % cell)
if len(tokens) <... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _parse(val: str):\n\n if not isinstance(val, str):\n raise TypeError(\"Method requires string input\")\n\n value = re.findall(r'^([-+]?\\d*\\.\\d*(?=\\s)|\\d+(?=\\s))', val)\n if not (value and val[:len(value[0])] == value[0]):\n return val, None\n\n # string starts with value\n va... | [
"0.6098518",
"0.58725435",
"0.5795746",
"0.57074785",
"0.56425375",
"0.56314313",
"0.55982673",
"0.5591802",
"0.55434746",
"0.5527511",
"0.5515776",
"0.55069953",
"0.5387614",
"0.53209805",
"0.5315428",
"0.53074974",
"0.530218",
"0.52943623",
"0.5276008",
"0.5254738",
"0.5244... | 0.70920163 | 0 |
Reads the SBB, tallys votes using commitment openings posted by PS, and compares commitment openings to previously posted ComT postings by PS. If all tallys are permutations of the same values and the openings match the previously posted ComT postings then returns the election tally, otherwise raises an exception. | def tally_and_verify_election_outcome(self, outcome_lists: Set[int]) -> typing.Counter[int]:
sbb_contents = self._sbb.get_sbb_contents()
# Keep tally counters for each of the m lists. All m tallies must
# be the same for the outcome to be verified.
raw_vote_tallies: List[typing.Counter[... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def verify_ballot_consistency(self) -> bool:\n sbb_contents = self._sbb.get_sbb_contents()\n \n # First, validate the commitment consistency with the initial vote lists and final vote lists.\n for list_idx, proof in sbb_contents.consistency_proof.items():\n for vote_idx in ra... | [
"0.5839099",
"0.4828558",
"0.47592798",
"0.47367328",
"0.4653196",
"0.4641992",
"0.4624824",
"0.4595079",
"0.45939693",
"0.4589177",
"0.45874888",
"0.45654458",
"0.45465288",
"0.45387793",
"0.4514298",
"0.45136043",
"0.45117742",
"0.45021626",
"0.4501531",
"0.44877023",
"0.44... | 0.60203 | 0 |
Test the file import method Must return a task object | def test_process_file_import(self):
new_file_proc = FileImportForm()
res = new_file_proc.process_file('x')
self.assertTrue(isinstance(res, AsyncResult)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def import_task_files(self, session, task):\n self._fetch_info(task.imported_items(), False, True)",
"def importer():\n pass",
"def file_import(self):\r\n\r\n try:\r\n self.process_file_import()\r\n except InputError as ex:\r\n print(ex)\r\n self.file_im... | [
"0.67191964",
"0.6706263",
"0.65843284",
"0.65285414",
"0.64675957",
"0.6450101",
"0.63975704",
"0.63933843",
"0.63705486",
"0.63664347",
"0.6353522",
"0.6304793",
"0.6303843",
"0.6255984",
"0.6252447",
"0.62489635",
"0.6212668",
"0.6196374",
"0.619023",
"0.61739105",
"0.6154... | 0.7435163 | 0 |
devo collegarmi al link della rosa su fantacalcio.it e trovare il link corrispondente al giocatore da li poi estraggo voto e fantavoto di media | def scraper_voto(self):
#per trovare il link a fantacalcio.it devo prima trovare il link della squadra e trovare il suo nome
soup_rosa = BeautifulSoup(
requests.get(f"{self.LINK_FANTACALCIO_IT}/{self.team}#rosa").text,
"html.parser",
)
print(self.name)
d... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getLink(self):",
"def create_link(self):\n self.filename = App.get_running_app().root.ids.camera_screen.capture()\n self.url = FileSharer(self.filename).share()\n self.ids.label.text = self.url",
"def getVotacion(self, url):",
"def link(self, obj):\n return format_html(\n ... | [
"0.6039677",
"0.5896531",
"0.5796971",
"0.5796728",
"0.57508343",
"0.56164914",
"0.56087923",
"0.55653644",
"0.55441266",
"0.5539439",
"0.5490854",
"0.54835784",
"0.5444002",
"0.54344416",
"0.5407101",
"0.54022837",
"0.5398861",
"0.53877646",
"0.5362035",
"0.5359604",
"0.5342... | 0.62930304 | 0 |
nella categoria "da schierare" vi sono 56 articoli da leggere seleziono quelli degli ultimi 4 giorni o rischio di confondermi con la giornata precedente return > lista di link da aprire e leggere successivamente | def scraper_lista_articoli(LINK_SOS_FANTA: str) -> list:
soup = BeautifulSoup(requests.get(LINK_SOS_FANTA).text, "html.parser")
body = soup.find(class_="widget-content")
titoli = body.find_all("li") # lista di tutti gli articoli
to_scrape = []
for post in titoli:
# parsing della data in it... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def Cel(categorie, pagini, cautare=\"normala\"):\n log = Logger()\n debug = Verificare_Debug()\n if cautare == \"normala\":\n categorie = html_part_link[categorie]\n s = Scrapper(jsonfn, categorie, None)\n elif cautare == \"personalizata\":\n s = Scrapper(jsonfn, categorie, None, c... | [
"0.62583876",
"0.60917413",
"0.59112614",
"0.59014153",
"0.5859251",
"0.584331",
"0.5828725",
"0.5828725",
"0.5779946",
"0.5703309",
"0.56127346",
"0.56018984",
"0.5500179",
"0.5425924",
"0.5413115",
"0.5395252",
"0.5389329",
"0.5371254",
"0.535301",
"0.53344953",
"0.5310416"... | 0.61612517 | 1 |
Create, index and return test data. | def testdata(in_cluster_app):
indexer = RecordIndexer()
filenames = ("records.json", "authors.json")
with mock.patch('invenio_records.api.Record.validate',
return_value=None):
records = load_json_from_datadir('records.json')
for record in records:
record = Re... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_index(self):",
"def test_export_index(self):",
"def getTestData(self):\n raise NotImplementedError",
"def testCreate(self):\n kinds = ('tiny', 'small', 'medium', 'large')\n ft = (False, True)\n in_table = self.in_tables_v1[0]\n for kind, binary, zipped in product(k... | [
"0.6893712",
"0.6738024",
"0.66274077",
"0.6605562",
"0.6405234",
"0.63369054",
"0.63275754",
"0.63179785",
"0.6137767",
"0.61293244",
"0.61232316",
"0.61152595",
"0.6097307",
"0.60847896",
"0.6074008",
"0.607288",
"0.60721374",
"0.6059852",
"0.6054259",
"0.60447365",
"0.6002... | 0.70040137 | 0 |
Get the HillParameter corresponding to RF at eps. This is a bijective map. | def __call__(self,RF,eps):
n_range = [1+1e-1,100]
hill_coefficient_1_slope = RF.Delta/RF.theta
ramp_function_slope = RF.sign*RF.dx(RF.theta,eps)
target_hill_slope = ramp_function_slope + hill_coefficient_1_slope #chosen so that the map is bijective
hill_max_slope = self.get_hill... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_hyperparameter_bounds():\n minf = float(\"-inf\")\n inf = float(\"inf\")\n params = dict(mu=(minf,inf), nu=(0.0 ,inf), r=(0.0, inf), s=(0.0, inf))\n return params",
"def get_hyperparams(self):",
"def get_fe_params(self):\n return self._params[0:self.k_fe]",
"def _pa... | [
"0.5519696",
"0.5459801",
"0.53573745",
"0.5348384",
"0.53123516",
"0.5267668",
"0.52640975",
"0.5259628",
"0.52242345",
"0.5190932",
"0.5172484",
"0.5170918",
"0.51622325",
"0.5160279",
"0.51536065",
"0.51485074",
"0.5137379",
"0.5129",
"0.5086387",
"0.5064715",
"0.50481415"... | 0.7127517 | 0 |
Initialises LogIn page model. It creates the selenium webdriver object and loads the selectors configuration file | def __init__(self):
self.driver = webdriver.Chrome()
self.driver.get('https://qknows-qa.basf.com')
self.wait = WebDriverWait(self.driver, 10)
self.selectors = json.load(open('sut/selectors/login.json')) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self):\n driver = webdriver.Firefox() #working with firefox. see above comment and edit it to change the browser\n\n self.driver.get(\"https://moodle.niituniversity.in\")\n self.tLogin()",
"def login(self):\n self.driver.get(f'{self.base_url}/signin')\n\n # Fill us... | [
"0.63349766",
"0.61009765",
"0.6092834",
"0.6027355",
"0.59561366",
"0.5899323",
"0.58560854",
"0.5831826",
"0.5802246",
"0.57403225",
"0.5735208",
"0.57276696",
"0.57185626",
"0.5715317",
"0.57100016",
"0.5699238",
"0.5687398",
"0.56593454",
"0.559867",
"0.55831605",
"0.5565... | 0.70190394 | 0 |
Closes the selenium webdriver | def close(self):
self.driver.close() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def close_browser():\n driver.close()",
"def i_close_the_browser():\n driver.close()\n driver.quit()",
"def close(self):\n self.driver.quit()",
"def close_driver(driver):\n driver.close()",
"def close_driver(driver):\n driver.close()",
"def closeBrowser(driver):\n driver.quit()",... | [
"0.8613652",
"0.8472183",
"0.8470703",
"0.8204732",
"0.8204732",
"0.8184607",
"0.81776446",
"0.8136131",
"0.8112698",
"0.8029229",
"0.7811337",
"0.7658541",
"0.7657188",
"0.7649241",
"0.7635745",
"0.76175964",
"0.75127256",
"0.74865437",
"0.74256766",
"0.7379712",
"0.73675275... | 0.8557682 | 1 |
The function for bulk retrieving and parsing whois information for a list of IP addresses via HTTP (RDAP). This bulk lookup method uses bulk ASN Whois lookups first to retrieve the ASN for each IP. It then optimizes RDAP queries to achieve the fastest overall time, accounting for ratelimiting RIRs. | def bulk_lookup_rdap(addresses=None, inc_raw=False, retry_count=3, depth=0,
excluded_entities=None, rate_limit_timeout=60,
socket_timeout=10, asn_timeout=240, proxy_openers=None):
if not isinstance(addresses, list):
raise ValueError('addresses must be a list of IP... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def run_rdap(self,ip_address):\n try:\n with warnings.catch_warnings():\n # Hide the 'allow_permutations has been deprecated' warning until ipwhois removes it\n warnings.filterwarnings(\"ignore\",category=UserWarning)\n rdapwho = IPWhois(ip_address)\n ... | [
"0.6281244",
"0.598626",
"0.5980119",
"0.59107023",
"0.5785517",
"0.57334334",
"0.56565577",
"0.5582375",
"0.5444342",
"0.54347205",
"0.5251316",
"0.52312225",
"0.51166403",
"0.50961727",
"0.5094858",
"0.5089813",
"0.5072882",
"0.5051348",
"0.5041338",
"0.50093925",
"0.499293... | 0.69207865 | 0 |
This function takes a filename as input, and returns a dataframe with raw data read from that file in a Pandas DataFrame. The DataFrame index should be the year, month and day of the observation. DataFrame headers should be "agency_cd", "site_no", "Date", "Discharge", "Quality". The "Date" column should be used as the ... | def ReadData( fileName ):
# define column names
colNames = ['agency_cd', 'site_no', 'Date', 'Discharge', 'Quality']
# open and read the file
DataDF = pd.read_csv(fileName, header=1, names=colNames,
delimiter=r"\s+",parse_dates=[2], comment='#',
n... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _data_reader(file):\n # Create a dictionary so that filename matches a site name.\n site_dict = {'D05536000': 'NB Niles', 'D05536101': 'NS Channel-Wilmette',\n 'D05536105': 'NB Albany', 'D05536118': 'NB Grand Avenue',\n 'D05536121': 'CH River-Lock', 'D05536123': 'CH River-... | [
"0.6936041",
"0.6728832",
"0.64776355",
"0.64624935",
"0.6454058",
"0.6410114",
"0.6397511",
"0.6382039",
"0.6367535",
"0.6330921",
"0.6298072",
"0.62846416",
"0.6276603",
"0.62696755",
"0.6258542",
"0.6252047",
"0.62465036",
"0.6205528",
"0.62012005",
"0.61507493",
"0.613114... | 0.7225768 | 0 |
This function takes a filename as input, and returns a dataframe with the metrics from the assignment on descriptive statistics and environmental metrics. Works for both annual and monthly metrics. Date column should be used as the index for the new dataframe. Function returns the completed DataFrame. | def ReadMetrics( fileName ):
DataDF=pd.read_csv(fileName,header=0,delimiter=',',parse_dates=[0])
DataDF = DataDF.set_index('Date')
#print(DataDF.head())
return( DataDF ) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_df_metrics():\n DATA_DIR = 'metrics'\n search_pattern = '*.pkl'\n filename = 'stats'\n\n iteration_results = glob.glob(os.path.join(DATA_DIR, search_pattern))\n aggregated_results = os.path.join(DATA_DIR, filename)\n\n df = load_stats_dataframe(iteration_results, aggregated_results)\n ... | [
"0.5778182",
"0.5766087",
"0.56939036",
"0.5688676",
"0.5508023",
"0.54639703",
"0.5436751",
"0.54275894",
"0.54146",
"0.5389455",
"0.5377225",
"0.5363203",
"0.53372586",
"0.52271646",
"0.5185715",
"0.51650095",
"0.5164302",
"0.5162158",
"0.5151916",
"0.515016",
"0.51409566",... | 0.6417884 | 0 |
This function clips the given time series dataframe to a given range of dates. Function returns the clipped dataframe and and the number of missing values. | def ClipData( DataDF, startDate, endDate ):
## Clip the data to the data range
DataDF=DataDF.loc[startDate:endDate]
## Find the number of missing values
MissingValues=DataDF['Discharge'].isna().sum()
return( DataDF, MissingValues ) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def clip(df, clip_val_low, clip_val_high):\n clipped_df = df.clip(lower=clip_val_low, upper=clip_val_high)\n return clipped_df",
"def clip(df, lower, upper):\n\n # Pandas' clip-function doesn't allow dicts with bounds for only some\n # columns, so we convert them to Pandas Series which is all... | [
"0.61024415",
"0.60082376",
"0.5751473",
"0.5737423",
"0.56192535",
"0.5573656",
"0.5535874",
"0.5529859",
"0.5496289",
"0.54508936",
"0.5437007",
"0.54092693",
"0.5381029",
"0.53656447",
"0.53234494",
"0.5321475",
"0.5319992",
"0.5283118",
"0.527784",
"0.5272275",
"0.5264904... | 0.6901371 | 0 |
r""" from vice.yields.ccsne import LC18 unit test | def test_LC18_import():
def test():
try:
from .. import LC18
except:
return False
return True
return ["vice.yields.ccsne.LC18", test] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_T01():",
"def test(): \n\treturn [\"vice.yields.ccsne.import\", \n\t\t[ \n\t\t\ttest_LC18_import(), \n\t\t\ttest_CL13_import(), \n\t\t\ttest_CL04_import(), \n\t\t\ttest_WW95_import(), \n\t\t\ttest_NKT13_import(), \n\t\t\ttest_S16_import() \n\t\t] \n\t]",
"def test_CL13_import(): \n\tdef test(): \n\t\t... | [
"0.6867367",
"0.6640538",
"0.6618248",
"0.65071297",
"0.65071297",
"0.6488547",
"0.6460742",
"0.6434713",
"0.6434713",
"0.6430316",
"0.63405323",
"0.6285057",
"0.6285057",
"0.6284323",
"0.61783695",
"0.6151322",
"0.61294484",
"0.61237067",
"0.61237067",
"0.61211914",
"0.61036... | 0.7449569 | 0 |
r""" from vice.yields.ccsne import CL13 unit test | def test_CL13_import():
def test():
try:
from .. import CL13
except:
return False
return True
return ["vice.yields.ccsne.CL13", test] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_T01():",
"def test_CL04_import(): \n\tdef test(): \n\t\ttry: \n\t\t\tfrom .. import CL04 \n\t\texcept: \n\t\t\treturn False \n\t\treturn True \n\treturn [\"vice.yields.ccsne.CL04\", test]",
"def test(): \n\treturn [\"vice.yields.ccsne.import\", \n\t\t[ \n\t\t\ttest_LC18_import(), \n\t\t\ttest_CL13_imp... | [
"0.67553806",
"0.66751456",
"0.6578532",
"0.65704656",
"0.6546233",
"0.64854187",
"0.64723396",
"0.64639574",
"0.64518845",
"0.64518845",
"0.64471114",
"0.64222634",
"0.64222634",
"0.64217126",
"0.6415134",
"0.6362012",
"0.63525367",
"0.6301075",
"0.6270255",
"0.624978",
"0.6... | 0.73629624 | 0 |
r""" from vice.yields.ccsne import CL04 unit test | def test_CL04_import():
def test():
try:
from .. import CL04
except:
return False
return True
return ["vice.yields.ccsne.CL04", test] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_CL13_import(): \n\tdef test(): \n\t\ttry: \n\t\t\tfrom .. import CL13 \n\t\texcept: \n\t\t\treturn False \n\t\treturn True \n\treturn [\"vice.yields.ccsne.CL13\", test]",
"def test_T01():",
"def test(): \n\treturn [\"vice.yields.ccsne.import\", \n\t\t[ \n\t\t\ttest_LC18_import(), \n\t\t\ttest_CL13_imp... | [
"0.70824283",
"0.705189",
"0.69436246",
"0.6881322",
"0.67080677",
"0.66985637",
"0.66985637",
"0.66827714",
"0.66267836",
"0.6622007",
"0.65751714",
"0.6500675",
"0.6500675",
"0.64995396",
"0.6381672",
"0.6361119",
"0.6354399",
"0.6348655",
"0.63481206",
"0.6343956",
"0.6342... | 0.7286689 | 0 |
r""" from vice.yields.ccsne import NKT13 unit test | def test_NKT13_import():
def test():
try:
from .. import NKT13
except:
return False
return True
return ["vice.yields.ccsne.NKT13", test] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_T01():",
"def test_T3():",
"def test_T3():",
"def test_T4():",
"def test_T4():",
"def test_generate_nb_testing(self):\n pass",
"def test_T2():",
"def test_T2():",
"def test_arc_smear(self):",
"def testBeliefs1sk(self):",
"def test_manlext(self):\n self.chck_triple('manlex... | [
"0.72610635",
"0.69505996",
"0.69505996",
"0.6844559",
"0.6844559",
"0.6805739",
"0.67778987",
"0.67778987",
"0.67577595",
"0.6706993",
"0.6687833",
"0.6675569",
"0.6638078",
"0.6631696",
"0.6556386",
"0.6556386",
"0.65030587",
"0.6502402",
"0.649179",
"0.649179",
"0.649179",... | 0.6966552 | 1 |
r""" from vice.yields.ccsne import S16 unit test | def test_S16_import():
def test():
try:
from .. import S16
except:
return False
return True
return ["vice.yields.ccsne.S16", test] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_T01():",
"def test_T4():",
"def test_T4():",
"def test_arc_smear(self):",
"def testBeliefs2sk(self):",
"def test(): \n\treturn [\"vice.yields.ccsne.import\", \n\t\t[ \n\t\t\ttest_LC18_import(), \n\t\t\ttest_CL13_import(), \n\t\t\ttest_CL04_import(), \n\t\t\ttest_WW95_import(), \n\t\t\ttest_NKT13... | [
"0.6533643",
"0.6363606",
"0.6363606",
"0.6299078",
"0.6157726",
"0.61465865",
"0.61095303",
"0.6099139",
"0.60783273",
"0.60670435",
"0.6055751",
"0.6050182",
"0.6017768",
"0.6004559",
"0.6004559",
"0.5998885",
"0.5972699",
"0.59519553",
"0.5923025",
"0.5923025",
"0.59117323... | 0.73270357 | 0 |
Compute this metric. This applies the underlying single table metric to all the tables found in the dataset and then returns the average score obtained. | def _compute(self, real_data, synthetic_data, metadata=None):
if set(real_data.keys()) != set(synthetic_data.keys()):
raise ValueError('`real_data` and `synthetic_data` must have the same tables')
if metadata is None:
metadata = {'tables': defaultdict(type(None))}
elif n... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def average(self):\n if self._average is None:\n self._average = sum([df.df for df in self])/len(self)\n return self._average",
"def accuracy(self):\n return (self.table[0, 0] + self.table[1, 1]) / self.N",
"def compute(cls, real_data, synthetic_data, metadata):\n score_b... | [
"0.5845553",
"0.5827169",
"0.58184224",
"0.57921374",
"0.5787292",
"0.5787292",
"0.57844794",
"0.57567334",
"0.57013696",
"0.57012653",
"0.56799257",
"0.5663485",
"0.5659538",
"0.56120795",
"0.5596597",
"0.558179",
"0.5576306",
"0.55562055",
"0.5548604",
"0.55410093",
"0.5537... | 0.68125516 | 0 |
Makes the payment. Responsible for making the request to WorldPay with the gathered session variables and returns to a Studio flow if initiated from there. Currently assumes that all information gathered is correct and payment will be successful | def process_payment():
url = 'https://api.worldpay.com/v1/orders'
headers = {'Authorization': environ.get('WORLDPAY_API_KEY'),
'Content-type': 'application/json'}
body = {
"paymentMethod": {
"type": "Card",
"name": session['caller_name'],
"expiryMo... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def make_payment():\n\n response = VoiceResponse()\n if 'caller_name' not in session:\n session['caller_name'] = request.args.get(\n 'caller_name') or \"Twilio Payment\"\n if 'payment_amount' not in session:\n session['payment_amount'] = request.args.get('amount') or \"5000\"\n ... | [
"0.68730086",
"0.6631193",
"0.6541817",
"0.6321301",
"0.6251407",
"0.6202432",
"0.6148989",
"0.6138219",
"0.5937037",
"0.59216857",
"0.5856434",
"0.57766294",
"0.57601655",
"0.575292",
"0.5669925",
"0.5667298",
"0.56421846",
"0.56279564",
"0.5624298",
"0.56111133",
"0.5601861... | 0.730185 | 0 |
Call function to get long card number | def get_card_number():
return get_or_append_details('card_number', "Please enter your credit card number") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def long(self, amount):",
"def get_card_val(card):\n\n if card == '1':\n return 1\n if card == '2':\n return 2\n if card == '3':\n return 3\n else:\n return 4",
"def get_credit_card_number(self):\n\t\tif len(self.credit_card_number) == 16:\n\t\t\treturn self.credit_card_... | [
"0.60791755",
"0.59657437",
"0.59604347",
"0.5928244",
"0.5922976",
"0.588906",
"0.58676",
"0.57750434",
"0.5765597",
"0.57478154",
"0.5678881",
"0.5672181",
"0.56093985",
"0.55803376",
"0.55625385",
"0.55540127",
"0.55250293",
"0.55170596",
"0.55093944",
"0.5496719",
"0.5479... | 0.6795907 | 0 |
Call function to get expiry month and year | def get_expiry():
return get_or_append_details('expiry', "Please enter your expiry date, two digits for the month and two digits for the year") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def cc_expire_months():\n months = []\n for month in range(1, 13):\n if len(str(month)) == 1:\n numeric = '0' + str(month)\n else:\n numeric = str(month)\n months.append((numeric, datetime.date(2009, month, 1).strftime('%B')))\n return months",
"def expiration(... | [
"0.6451516",
"0.629649",
"0.6171842",
"0.6081973",
"0.6059073",
"0.59521425",
"0.59468853",
"0.59468853",
"0.5846049",
"0.58428335",
"0.5817317",
"0.5718091",
"0.57034725",
"0.56085",
"0.55998755",
"0.5556354",
"0.5548732",
"0.5462002",
"0.5388835",
"0.537513",
"0.5374864",
... | 0.72779393 | 0 |
Call function to get 3 or 4 digit cvv | def get_cvv():
return get_or_append_details('cvv', 'Please enter your CVV. Typically this is the 3 digit number on the back of your card') | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def generate_cvv(\n cvk: bytes,\n pan: str,\n expiry: str,\n service_code: str,\n) -> str:\n\n if len(cvk) != 16:\n raise ValueError(\"CVK must be a double length DES key\")\n\n if len(pan) > 19 or not _tools.ascii_numeric(pan):\n raise ValueError(\"PAN must be less than 19 digits\"... | [
"0.59738284",
"0.5607687",
"0.55734557",
"0.55584395",
"0.5479949",
"0.53915036",
"0.537697",
"0.53422475",
"0.5305803",
"0.52978706",
"0.52827394",
"0.52690667",
"0.52661955",
"0.52412796",
"0.5229631",
"0.521806",
"0.51853895",
"0.5098367",
"0.5095909",
"0.50661993",
"0.505... | 0.80665404 | 0 |
Construct a JSON reference resolver. The resolved specs are in the `specs` member after a call to `resolve_references` has been made. If a URL is given, it is used as a base for calculating the absolute URL of relative file references. | def __init__(self, specs, url = None, **options):
import copy
self.specs = copy.deepcopy(specs)
self.url = url
self.__reclimit = options.get('recursion_limit', 1)
self.__reclimit_handler = options.get('recursion_limit_handler',
default_reclimit_handler)
self.__reference_cache = opti... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def resolve_references(self):\n self.specs = self._resolve_partial(self.parsed_url, self.specs, ())",
"def parse_resolve(cls, url):\n loc = cls.parse(url)\n if loc.path and loc.path != '/':\n # If true ref name contains slash, a prefix of path might be a suffix of\n # ref. Try to resolve it.\n... | [
"0.65303266",
"0.56752896",
"0.5565178",
"0.5432406",
"0.5358694",
"0.5330516",
"0.53255826",
"0.5246696",
"0.5213265",
"0.51325446",
"0.5081862",
"0.50505877",
"0.5048943",
"0.49645126",
"0.4942218",
"0.49079823",
"0.48965055",
"0.4876572",
"0.48686698",
"0.48592854",
"0.484... | 0.6960167 | 0 |
Resolve JSON pointers/references in the spec. | def resolve_references(self):
self.specs = self._resolve_partial(self.parsed_url, self.specs, ()) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def resolve_schema_references(self, definition):\n # type: (Generator, Dict) -> None\n if \"$ref\" in definition:\n schema_reference = definition.pop(\"$ref\")\n section, name = schema_reference.split(\"/\")[-2:]\n referenced_definition = self.parser.specification[sec... | [
"0.63346666",
"0.61350095",
"0.61242133",
"0.60123867",
"0.5895384",
"0.58681685",
"0.5828402",
"0.56767946",
"0.56145304",
"0.5577053",
"0.5550483",
"0.54556185",
"0.54530203",
"0.54383546",
"0.54287094",
"0.5406919",
"0.5402807",
"0.53680676",
"0.53565043",
"0.53061473",
"0... | 0.68938255 | 0 |
Iterate over a partial spec, dereferencing all references within. Yields the resolved path and value of all items that need substituting. | def _dereferencing_iterator(self, base_url, partial, path, recursions):
from .iterators import reference_iterator
for _, refstring, item_path in reference_iterator(partial):
# Split the reference string into parsed URL and object path
ref_url, obj_path = _url.split_url_reference(base_url, refstring)... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _resolve_partial(self, base_url, partial, recursions):\n # Gather changes from the dereferencing iterator - we need to set new\n # values from the outside in, so we have to post-process this a little,\n # sorting paths by path length.\n changes = dict(tuple(self._dereferencing_iterator(base_url, pa... | [
"0.58574283",
"0.56865025",
"0.5679534",
"0.56764805",
"0.5475917",
"0.546941",
"0.54071206",
"0.5371878",
"0.53358024",
"0.53343445",
"0.5330462",
"0.52939177",
"0.52759284",
"0.5187627",
"0.5166277",
"0.51503074",
"0.5030503",
"0.50293756",
"0.4980426",
"0.49454945",
"0.492... | 0.6692858 | 0 |
Dereference the URL and object path. Returns the dereferenced object. | def _dereference(self, ref_url, obj_path, recursions):
# In order to start dereferencing anything in the referenced URL, we have
# to read and parse it, of course.
contents = _url.fetch_url(ref_url, self.__reference_cache, self.__encoding)
# In this inner parser's specification, we can now look for the... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _get_object(self, path):\n if path == \"/\":\n return self.target\n\n parts = path[1:].split(\"/\")\n last = self.target\n for part in parts:\n if type(last) == dict:\n last = last[part]\n else:\n last = getattr(last, \"... | [
"0.6393271",
"0.60683155",
"0.594546",
"0.58757573",
"0.5748134",
"0.57280153",
"0.5727585",
"0.5699852",
"0.561777",
"0.5597113",
"0.55593705",
"0.55497825",
"0.55468255",
"0.5499838",
"0.5483868",
"0.5482506",
"0.5443118",
"0.5417317",
"0.5408477",
"0.5357134",
"0.531767",
... | 0.78929824 | 0 |
Resolve a (partial) spec's references. | def _resolve_partial(self, base_url, partial, recursions):
# Gather changes from the dereferencing iterator - we need to set new
# values from the outside in, so we have to post-process this a little,
# sorting paths by path length.
changes = dict(tuple(self._dereferencing_iterator(base_url, partial, ()... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def resolve_references(self):\n self.specs = self._resolve_partial(self.parsed_url, self.specs, ())",
"def resolve(self, spec: \"ModelSpec\"):",
"def resolve_all_refs(s):\n for ref in list_of_all_unpointed_refs():\n ref.resolve()",
"def resolving(self, ref):\r\n\r\n full_uri = url... | [
"0.8131186",
"0.6489531",
"0.6228663",
"0.6109309",
"0.60549843",
"0.6046081",
"0.59280676",
"0.5861704",
"0.58215785",
"0.58063215",
"0.5793763",
"0.57419795",
"0.5669969",
"0.56401956",
"0.5603574",
"0.5599089",
"0.5540529",
"0.548241",
"0.5451723",
"0.5440825",
"0.5419424"... | 0.66698265 | 1 |
Test result of func count_ways(0). | def test_count_ways_null():
assert f.count_ways(0) == 1 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_count_ways_positive(inputs, outputs):\n assert f.count_ways(inputs) == outputs",
"def count_ways(n):\n if n < 0:\n return 0\n elif n == 0:\n return 1\n else:\n total = 0\n for i in range(1, min(n, 3) + 1):\n total += count_ways(n - i)\n return to... | [
"0.7972175",
"0.686043",
"0.6760794",
"0.61788404",
"0.6081778",
"0.6073252",
"0.6062703",
"0.606255",
"0.6061677",
"0.60572267",
"0.6021797",
"0.6009044",
"0.6005339",
"0.60044366",
"0.5997331",
"0.5973426",
"0.59645575",
"0.5960583",
"0.5955983",
"0.59351563",
"0.59320086",... | 0.8269839 | 0 |
Timestamp is the timestamp of the reading, direction is sent or received, size is the est. sized of the pkt, direction_count provides a total ordering of packets going in self.direction | def __init__(self, timestamp, direction, size, direction_count):
self.timestamp = timestamp
self.direction = direction
self.size = size
self.direction_count = direction_count | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def touch_packet (self, byte_count, now=None):\n if now is None: now = time.time()\n self.byte_count += byte_count\n self.packet_count += 1\n self.last_touched = now",
"def read_packetlen(self):\n packetlen = int(struct.unpack('!I', b\"\".join(self.__input))[0])\n self.__input = []\n s... | [
"0.5552777",
"0.5473483",
"0.5385493",
"0.5235498",
"0.51582557",
"0.51522464",
"0.51505923",
"0.51322556",
"0.51171005",
"0.5098781",
"0.508691",
"0.5086687",
"0.5083064",
"0.5064236",
"0.505681",
"0.504536",
"0.50425094",
"0.5032256",
"0.5010765",
"0.5007731",
"0.50073075",... | 0.6326216 | 0 |
This method decompose the file | def decompose(self, file_name):
print("[+] Decompose started...")
with open(file_name, "rb") as image_file:
# We check if the directory chunks doesn't exist, then, we create it
if not path.exists("./chunks/"):
makedirs("chunks")
to_print ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def decode(self, file):\n raise NotImplementedError()",
"def decompose(self):\r\n contents = [i for i in self.contents]\r\n for i in contents:\r\n if isinstance(i, Tag):\r\n i.decompose()\r\n else:\r\n i.extract()\r\n self.extract()"... | [
"0.61689585",
"0.58359903",
"0.5817161",
"0.5712472",
"0.5661358",
"0.56584007",
"0.56018007",
"0.55656415",
"0.55426884",
"0.5491138",
"0.5484127",
"0.5476499",
"0.54438716",
"0.5438515",
"0.53901505",
"0.5349641",
"0.532227",
"0.5321122",
"0.5308797",
"0.53050524",
"0.52961... | 0.61009246 | 1 |
Load the NER model and evaluate it in the test data. | def evaluate_model():
# Get the processed data (in proper format to evaluate the NER model)
data = get_json_from_file_path(PROCESSED_DATA_PATH)
# Split the dataset for training and test as we did for training
train_data, test_data = train_test_split(data, train_size=0.7,
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def eval(self):\n self.train(mode=False)",
"def main():\n data = load_data()\n analyze_features(data['full_features'])\n model = train(data)\n\n with open('model.pickle', 'wb') as f:\n pickle.dump(model, f)\n evaluate(model, data)",
"def run(self) -> None:\n self.model = sel... | [
"0.65599304",
"0.6550237",
"0.6496291",
"0.6476324",
"0.6436608",
"0.63972366",
"0.6394532",
"0.63934684",
"0.6388684",
"0.6336536",
"0.63256794",
"0.6304074",
"0.62766826",
"0.62613994",
"0.62345725",
"0.6198054",
"0.6170204",
"0.61625904",
"0.6160035",
"0.6158422",
"0.61533... | 0.70876956 | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.