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
Release all open devices.
def release_all_devices(cls, devclass: Optional[Type] = None) -> int: cls.Lock.acquire() try: remove_devs = set() for devkey in cls.Devices: if devclass: dev = cls._get_backend_device(cls.Devices[devkey][0]) if dev is None o...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def free(self):\n for device_buffer in self.device_buffers.values():\n device_buffer.free()", "def release(self):\n # type: () -> None\n for k in self.kernels:\n k.release()", "def release(self):\r\n for s in self.streams:\r\n s.release()", "def rele...
[ "0.6977047", "0.6747296", "0.66847193", "0.65975183", "0.6398882", "0.6371426", "0.63608223", "0.63365006", "0.63315076", "0.6270832", "0.62526244", "0.62436575", "0.62317735", "0.61759984", "0.6107009", "0.6082296", "0.594411", "0.5910484", "0.5874789", "0.58305734", "0.5827...
0.7071953
0
List candidates that match the device URL pattern.
def list_devices(cls, urlstr: str, vdict: Dict[str, int], pdict: Dict[int, Dict[str, int]], default_vendor: int) -> \ List[Tuple[UsbDeviceDescriptor, int]]: urlparts = urlsplit(urlstr) if not urlparts.path: raise UsbT...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def urls(self) -> list[str]:\r\n ...", "def getURLs():", "async def find_devices() -> List[DeviceInfo]:\n return await Discovery.search_devices()", "def find_target_urls(url_list):\n candidate_urls = []\n \n #iterate through urls\n for url in get_urls(get_clean_text(message_list)):\...
[ "0.6123401", "0.60209656", "0.58956355", "0.5863828", "0.58489066", "0.5842239", "0.5828112", "0.57580495", "0.5742189", "0.5666016", "0.5652385", "0.56451625", "0.5562471", "0.5548752", "0.55368084", "0.5535375", "0.55179316", "0.5496643", "0.54921937", "0.548251", "0.546871...
0.6654765
0
Parse a device specifier URL.
def parse_url(cls, urlstr: str, scheme: str, vdict: Dict[str, int], pdict: Dict[int, Dict[str, int]], default_vendor: int) -> Tuple[UsbDeviceDescriptor, int]: urlparts = urlsplit(urlstr) if scheme != urlparts.scheme: raise UsbToolsError("...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parse_url(url):\n results = NotifyBase.parse_url(url)\n\n if not results:\n # We're done early as we couldn't load the results\n return results\n\n # Apply our settings now\n devices = NotifyBase.unquote(results['fullpath'])\n\n # Store our devices\n ...
[ "0.5955001", "0.57433736", "0.56266594", "0.5605975", "0.5495419", "0.54808915", "0.5479917", "0.54717404", "0.54569286", "0.53738225", "0.5353081", "0.53467524", "0.53102374", "0.5305932", "0.52968967", "0.5293691", "0.5262653", "0.52357805", "0.5200543", "0.51783264", "0.51...
0.68176013
0
Enumerate USB device URLs that match partial URL and VID/PID criteria.
def enumerate_candidates(cls, urlparts: SplitResult, vdict: Dict[str, int], pdict: Dict[int, Dict[str, int]], default_vendor: int) -> \ Tuple[List[Tuple[UsbDeviceDescriptor, int]], Optional[int]]: specifiers = url...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def list_devices(cls, urlstr: str,\n vdict: Dict[str, int],\n pdict: Dict[int, Dict[str, int]],\n default_vendor: int) -> \\\n List[Tuple[UsbDeviceDescriptor, int]]:\n urlparts = urlsplit(urlstr)\n if not urlparts.path:\n ...
[ "0.7305313", "0.62146264", "0.5593864", "0.5369088", "0.53576976", "0.5335986", "0.53307885", "0.52431333", "0.5220281", "0.51991177", "0.51878214", "0.51549065", "0.5145526", "0.51372343", "0.51184356", "0.51061267", "0.5076512", "0.5073434", "0.50719374", "0.5039166", "0.50...
0.6434855
1
Build URL and device descriptors from UsbDeviceDescriptors.
def build_dev_strings(cls, scheme: str, vdict: Dict[str, int], pdict: Dict[int, Dict[str, int]], devdescs: Sequence[Tuple[UsbDeviceDescriptor, int]]) -> \ List[Tuple[str, str]]: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parse_url(cls, urlstr: str, scheme: str,\n vdict: Dict[str, int],\n pdict: Dict[int, Dict[str, int]],\n default_vendor: int) -> Tuple[UsbDeviceDescriptor, int]:\n urlparts = urlsplit(urlstr)\n if scheme != urlparts.scheme:\n raise UsbT...
[ "0.65785927", "0.6265347", "0.6186015", "0.6007385", "0.5635989", "0.5617807", "0.54494333", "0.53586143", "0.52578527", "0.5192252", "0.51403135", "0.51318246", "0.51189977", "0.50947773", "0.50773734", "0.50195354", "0.5009956", "0.49802485", "0.49542055", "0.48897895", "0....
0.62743443
1
Retrieve a string from the USB device, dealing with PyUSB API breaks
def get_string(cls, device: UsbDevice, stridx: int) -> str: if cls.UsbApi is None: #pylint: disable-msg=import-outside-toplevel import inspect args, _, _, _ = \ inspect.signature(UsbDevice.read).parameters if (len(args) >= 3) and args[1] == 'length...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def describe(device):\n base = os.path.basename(device)\n # USB-Serial devices\n sys_dev_path = '/sys/class/tty/%s/device/driver/%s' % (base, base)\n if os.path.exists(sys_dev_path):\n sys_usb = os.path.dirname(os.path.dirname(os.path.realpath(sys_dev_path)))\n return usb_string(sys_usb)\...
[ "0.6624832", "0.6569247", "0.6472554", "0.64069086", "0.6386069", "0.63275385", "0.63251895", "0.62799686", "0.6246414", "0.62235725", "0.61905366", "0.6111043", "0.6110673", "0.6058284", "0.60238", "0.60010874", "0.5995711", "0.5990885", "0.593111", "0.5896133", "0.5827619",...
0.7897122
0
Return the backend implementation of a device.
def _get_backend_device(cls, device: UsbDevice) -> Any: try: #pylint: disable-msg=protected-access # need to access private member _ctx of PyUSB device # (resource manager) until PyUSB #302 is addressed return device._ctx.dev #pylint: disable-msg=prote...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_device(self):\n raise NotImplementedError()", "def get_storage_backend(self):\n return self.client.info()['Driver']", "def _get_backend(args):\n if args.backend == 'gatttool':\n backend = GatttoolBackend\n elif args.backend == 'bluepy':\n backend = BluepyBackend\n elif args.backe...
[ "0.72897404", "0.72357816", "0.718308", "0.7140336", "0.7140336", "0.70863205", "0.70863205", "0.70500743", "0.70427233", "0.7001514", "0.6999211", "0.69636273", "0.68966055", "0.68470436", "0.6831942", "0.6820902", "0.68185806", "0.6810101", "0.67691904", "0.6763174", "0.675...
0.7659336
0
Update the list of installed tools. This will detect the installed analysis tool plugins and inform Review Board of them.
def update_tools_list(panel, payload): logger.info('Request to refresh installed tools from "%s"', payload['url']) logger.info('Iterating Tools') tools = [] for ep in pkg_resources.iter_entry_points(group='reviewbot.tools'): entry_point = ep.name tool_class = ep.load() ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update_tools_status(self, plot=None):\n if plot is None:\n plot = self.get_plot()\n for tool in self.tools:\n tool.update_status(plot)", "def install_tools(self):\n\t\treturn Job(SDK.PrlVm_InstallTools(self.handle)[0])", "def installTools(self, out):\r\n # Check that ...
[ "0.6638885", "0.63158494", "0.6236855", "0.5890704", "0.58793336", "0.57942563", "0.5683789", "0.5661978", "0.56490993", "0.5617876", "0.5572844", "0.5565619", "0.55018574", "0.5490385", "0.54562634", "0.54142433", "0.54108703", "0.5410848", "0.5392601", "0.53896284", "0.5374...
0.65882957
1
Return the Review Bot extension resource.
def _get_extension_resource(api_root): # TODO: Cache this. We only use this resource as a link to sub-resources. return api_root.get_extension( extension_name='reviewbotext.extension.ReviewBotExtension')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def GetResourceExtension(self):\n\n return self.resource_extension", "def get_review(review_id):\n return get(cls, review_id)", "def get_review(review_id):\n obj = storage.get(Review, review_id)\n if obj is None:\n abort(404)\n return jsonify(obj.to_dict())", "def get_review(review_...
[ "0.5707065", "0.53944933", "0.5294799", "0.5252148", "0.5226599", "0.522346", "0.5210204", "0.51805484", "0.5091686", "0.5071662", "0.49671927", "0.49659368", "0.49607384", "0.49156708", "0.49134925", "0.48811162", "0.4877556", "0.48431104", "0.48347002", "0.47779602", "0.475...
0.7889255
0
Using pyAudioAnalysis package to train parameters for classification of emotion. Sorted chunked data into positive and negative categories,
def nonlearning(): aT.featureAndTrain(['../../AudioData/chunked_data_sorted/pos', '../../AudioData/chunked_data_sorted/neg'], 1.0, 1.0, aT.shortTermWindow, aT.shortTermStep, "svm", "emotion_classifier", True)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test():\r\n le = preprocessing.LabelEncoder()\r\n le.fit([\"Door Knocking\",\"Shower Running\",\"Toilet Flushing\",\"Vacuum Cleaning\",\"Keyboard Typing\", # encode class labels as numeric id values\r\n \"Coughing\",\"Neutral\"])\r\n \r\n if torch.cuda.is_available():\r\n dev...
[ "0.6523714", "0.6119607", "0.6084217", "0.60825354", "0.6022531", "0.6017659", "0.597446", "0.59653544", "0.59632087", "0.5882793", "0.5873618", "0.5863252", "0.58415496", "0.58212274", "0.5759538", "0.57592964", "0.57580644", "0.57561636", "0.5750136", "0.574835", "0.5738622...
0.6362868
1
Tests for the regular expressions used in ReprHighlighter.
def test_highlight_regex(test: str, spans: List[Span]): text = Text(test) highlighter = ReprHighlighter() highlighter.highlight(text) print(text.spans) assert text.spans == spans
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_grammar_rules_regex(self) -> None:\n for rule in self.rules.grammar_regex:\n positions: List[Tuple[int, int]] = self.report.get_regex_postions(\n rule[\"regex\"], ignore_case=True\n )\n for position in positions:\n self.add_error(rule[\...
[ "0.6422873", "0.62258095", "0.60664713", "0.60421884", "0.59508204", "0.59140986", "0.5841004", "0.580531", "0.58048624", "0.5789454", "0.5773917", "0.57669", "0.57590634", "0.57407993", "0.57216334", "0.5709549", "0.56886894", "0.5685655", "0.56391066", "0.56190264", "0.5605...
0.63610345
1
Returns a dog frame.
def _dog(): fh = open("/home/italojs/dev/python/api-flask-noalvo-demo/app/domain/live_stream/static/funny-dogs.jpg", "rb") frame = fh.read() fh.close() return frame
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def genFrame(self):\n # generate frame-specific data\n frameData = self._genFrameData()\n\n # call parent function to create the complete frame (as bytearray)\n frame = self._genDigiMeshFrame(frameData)\n\n # OBS: never escape-sequence local msg\n return frame", "def as_...
[ "0.6081915", "0.56700563", "0.5642934", "0.5457245", "0.5451143", "0.5434148", "0.54301244", "0.53619075", "0.5359643", "0.53493017", "0.5338358", "0.5334", "0.5326257", "0.5304185", "0.52989846", "0.5287807", "0.528613", "0.5284221", "0.526866", "0.5250349", "0.5235144", "...
0.74349314
0
recursively unpack compressed file in dir_path delete compressed file after decompressed
def recursive_unpack(dir_path): exten = ['7z', 'zip', 'rar'] one_more = False for r, d, files in os.walk(dir_path): packed = [] for ext in exten: code_files = fnmatch.filter(files, '*.' + ext) if len(code_files) > 0: tmp_paths = [os.path.join(os.path.a...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def unpack(file_path, extraction_path, remove):\n print(file_path)\n Archive(file_path).extractall(extraction_path, auto_create_dir=True)\n # remove original compressed file???\n if remove is True:\n os.remove(file_path)", "def _uncompress(fname, outdir, msg=msg):\n import os\n assert os...
[ "0.7238741", "0.6962272", "0.6708829", "0.6642044", "0.6547225", "0.6475905", "0.64351845", "0.6425231", "0.6420933", "0.6343786", "0.6328651", "0.6327423", "0.6322118", "0.6318724", "0.6219428", "0.6204216", "0.6196655", "0.6195387", "0.6103305", "0.6084546", "0.6079501", ...
0.7164132
1
Build and return the harvesters
def _build_harvester(self, driver_state): harvesters = [] # list of harvesters to be returned # # Verify that the WFP_ENG_STC_IMODEM harvester has been configured. # If so, build the harvester and add it to the list of harvesters. # if DataTypeKey.WFP_ENG_STC_IMODEM ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _build_harvester(self, driver_state):\n harvesters = []\n harvester_telem = self._build_single_dir_harvester(driver_state, DataSourceKey.DOFST_K_WFP_TELEMETERED)\n if harvester_telem != None:\n harvesters.append(harvester_telem)\n harvester_recov = self._build_single_dir_...
[ "0.7444076", "0.5721587", "0.56941164", "0.55914825", "0.5506487", "0.5437611", "0.5385583", "0.530062", "0.52521396", "0.51882625", "0.51527625", "0.51514226", "0.5145552", "0.5139645", "0.513831", "0.5102349", "0.50820017", "0.50716585", "0.50682163", "0.50624853", "0.50624...
0.7412672
1
Update workflow history with user data.
def update_wf_history(self, state_history: list) -> list: for item in state_history: user = item.get('actor', None) # first call when the actor value still a UUID string if isinstance(user, str): user_id = user new_actor = self.get_data(user_id...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def workflowHistory(self, complete=True):\n context = aq_inner(self.context)\n # Since switching to DCWorkflow's getInfoFor, we rely on its\n # permission checks.\n #if not (_checkPermission('Request review', context) or\n # _checkPermission('Review portal content', context)):...
[ "0.61540836", "0.6125555", "0.591495", "0.58511055", "0.5786381", "0.57115734", "0.56571823", "0.5568863", "0.55354965", "0.55148375", "0.5510111", "0.5493928", "0.5459825", "0.54500985", "0.54432887", "0.544232", "0.5427807", "0.54250336", "0.54075015", "0.53887635", "0.5375...
0.6586897
0
Create a new instance of IUserProfileQuery service.
def factory(): return BaseUserProfileQuery()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def createUserProfile(user):\n MyProfile.objects.get_or_create(user=user)", "def __init__(self, data=None, **kw):\n def _get_class_by_id(profile_id):\n from solariat_bottle.db.user_profiles.social_profile import DELIMITER, TwitterProfile, FacebookProfile\n pos = unicode(profile_id...
[ "0.51021117", "0.49137616", "0.4905571", "0.48837894", "0.4858772", "0.48104918", "0.47793677", "0.47448534", "0.4731313", "0.47094455", "0.46971658", "0.4694588", "0.46914098", "0.46800095", "0.46723658", "0.46636164", "0.4662662", "0.46383607", "0.4628606", "0.46245837", "0...
0.69030565
0
Width of a polygon poly
def width(poly): num = len(poly) - 1 if abs(poly[num][2] - poly[0][2]) < abs(poly[1][2] - poly[0][2]): return dist(poly[num], poly[0]) elif abs(poly[num][2] - poly[0][2]) > abs(poly[1][2] - poly[0][2]): return dist(poly[1], poly[0]) else: return max(dist(poly[num], poly[0]), dist(poly[1]...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __len__(self):\n return self.num_polygons", "def num_polygons(self):\n return len(self)", "def num_polygons(self):\n return len(self.polygons)", "def len_func(polygon):\n ret=[]\n N=len(polygon)\n for i in range(1,N):\n l = ((polygon[i][0]-polygon[i-1][0])**2 + (poly...
[ "0.68147415", "0.6705667", "0.65332896", "0.6351619", "0.63019216", "0.6257846", "0.61552984", "0.6153618", "0.60628796", "0.6051711", "0.603064", "0.60230815", "0.6012505", "0.6008799", "0.59972996", "0.5995753", "0.59954226", "0.59690064", "0.59478503", "0.5926503", "0.5924...
0.7536278
0
Height of a polygon poly
def height(poly): num = len(poly) - 1 if abs(poly[num][2] - poly[0][2]) > abs(poly[1][2] - poly[0][2]): return dist(poly[num], poly[0]) elif abs(poly[num][2] - poly[0][2]) < abs(poly[1][2] - poly[0][2]): return dist(poly[1], poly[0]) else: return min(dist(poly[num], poly[0]), dis...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def Polygon(self, polyline = False):\n\n from geographiclib.polygonarea import PolygonArea\n return PolygonArea(self, polyline)", "def polygon_area_2d(polygon):\r\n return geometry.gmPolygonArea(polygon)", "def poly_area(x, y):\n return 0.5*np.abs(np.dot(x, np.roll(y, 1)) - np.dot(y, np.roll(x, 1))...
[ "0.64510256", "0.6448989", "0.6441176", "0.64108616", "0.6361811", "0.6329238", "0.6241954", "0.6227364", "0.620318", "0.620318", "0.620318", "0.6202425", "0.6144523", "0.6131131", "0.6120363", "0.611363", "0.61113554", "0.6106708", "0.608711", "0.6059044", "0.6043531", "0....
0.7813246
0
Azimuth of a polygon poly
def azimuth(poly): num = len(poly) - 1 vec = unit_normal(poly[0], poly[1], poly[num]) vec_azi = np.array([vec[0], vec[1], 0]) vec_n = np.array([0, 1, 0]) # update by Santosh # angle2vecs gives the smallest angle between the vectors # so for a west wall angle2vecs will give 90 # the follo...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def azimuth(source):\n srcAzEl = subarrayControl.s.azel(source, 0.0);\n return srcAzEl[0];", "def angle(z):", "def azimuth(self, right: GeoSpatialValue) -> ir.FloatingValue:\n return ops.GeoAzimuth(self, right).to_expr()", "def getAzimuthAngle(self):\n return self._azimuth", "def rotate...
[ "0.69212717", "0.67152286", "0.63933504", "0.63435346", "0.6254391", "0.6190008", "0.6166699", "0.6163107", "0.6146497", "0.6090305", "0.6045728", "0.6021643", "0.6016496", "0.60013217", "0.59866697", "0.5938686", "0.5927132", "0.5919588", "0.59076864", "0.588229", "0.5877527...
0.8477191
0
Tilt of a polygon poly
def tilt(poly): num = len(poly) - 1 vec = unit_normal(poly[0], poly[1], poly[num]) vec_alt = np.array([vec[0], vec[1], vec[2]]) vec_z = np.array([0, 0, 1]) # return (90 - angle2vecs(vec_alt, vec_z)) # update by Santosh return angle2vecs(vec_alt, vec_z)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _polytrafo(self, poly):\n screen = self.screen\n p0, p1 = self._position\n e0, e1 = self._orient\n e = TwoDV(e0, e1 * screen.yscale / screen.xscale)\n e0, e1 = (1.0 / abs(e)) * e\n return [(p0+(e1*x+e0*y)/screen.xscale, p1+(-e0*x+e1*y)/screen.yscale)\n ...
[ "0.6105743", "0.6094133", "0.5665677", "0.5616978", "0.5580373", "0.5561968", "0.55513394", "0.55378795", "0.55378795", "0.55133283", "0.55017954", "0.5490799", "0.544814", "0.5424581", "0.5410461", "0.5324208", "0.5308822", "0.52776206", "0.5267671", "0.52197415", "0.5180232...
0.8311091
0
Given a string file name, returns a GEOSGeometry. The file may contain WKB, WKT, or HEX.
def fromfile(file_h): # If given a file name, get a real handle. if isinstance(file_h, str): with open(file_h, "rb") as file_h: buf = file_h.read() else: buf = file_h.read() # If we get WKB need to wrap in memoryview(), so run through regexes. if isinstance(buf, bytes): ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def wkt_from_name(name):\n # pylint: disable=invalid-name\n # dx and dy seems quite sensible here...\n\n extent = extent_from_name(name)\n\n wkt = \"POLYGON((\"\n for dx, dy in ((0, 0), (0, 1), (1, 1), (1, 0)):\n wkt += \"{0:.2f} {1:.2f},\".format(extent[2 * dx], extent[2 * dy + 1])\n wkt ...
[ "0.5880633", "0.58688223", "0.57560325", "0.5682774", "0.5552744", "0.5550235", "0.55321383", "0.5512911", "0.5483073", "0.5470537", "0.54570055", "0.54453206", "0.54344195", "0.5378245", "0.5373517", "0.52962524", "0.5283799", "0.52837443", "0.5276429", "0.5274386", "0.52588...
0.7913839
0
Inverse of a rigid body transformation matrix
def inv(transform_matrix): r = transform_matrix[0:3, 0:3] t = transform_matrix[0:3, 3] t_inv = -1 * r.T.dot(t) transform_inv = np.eye(4) transform_inv[0:3, 0:3] = r.T transform_inv[0:3, 3] = t_inv return transform_inv
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def inverse(self):\n rotation_matrix = self.pose_mat[:3, :3]\n translation_vector = self.pose_mat[:3, 3]\n\n rot = np.transpose(rotation_matrix)\n trans = - np.matmul(np.transpose(rotation_matrix), translation_vector)\n return Transformation(rot, trans)", "def inverse_rigid_tra...
[ "0.79541564", "0.7733541", "0.7508078", "0.74408716", "0.739178", "0.7355747", "0.7313372", "0.7290814", "0.7257892", "0.7251126", "0.722694", "0.72111636", "0.71910274", "0.7151473", "0.71443874", "0.71253616", "0.7078454", "0.7075812", "0.7060877", "0.701706", "0.6999917", ...
0.81014514
0
Normalizes angles to range (pi, pi]
def normalize_angles(angles): return np.where(angles > np.pi, angles - 2 * np.pi, angles)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def normalize(angle):\n while angle > math.pi:\n angle -= 2 * math.pi\n while angle < -math.pi:\n angle += 2 * math.pi\n return angle", "def normalize_angle(angle):\n while angle > np.pi:\n angle -= 2.0 * np.pi\n\n while angle < -np.pi:\n angle += 2.0 * np.pi\n\n ret...
[ "0.82107466", "0.78335065", "0.7761805", "0.7758879", "0.7487792", "0.74496317", "0.7405513", "0.73911864", "0.7165736", "0.7122347", "0.6778681", "0.667193", "0.667193", "0.65800714", "0.65800714", "0.6326302", "0.6308028", "0.6304546", "0.6274721", "0.6235669", "0.62234896"...
0.792359
1
Service for receive all services by query and filter terms
def search_by_services(request: HttpRequest) -> QuerySet: services = ServiceDocument.search() query: str = request.GET.get("query") if (query is not None) and (query != ""): services = services.query( MultiMatch( query=query, fields=[ ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def search_service(self, name_filter):\n rs=search_service(name_filter)\n for el in rs:\n print(el)", "def search_services(query, services, quiet):\n cards = set()\n for svc in services:\n if (svc.uses_feature(query) or svc.uses_database(query) or \n query.upper()...
[ "0.70480216", "0.63333386", "0.6167937", "0.61411226", "0.60310453", "0.5999254", "0.59747785", "0.59572905", "0.5944522", "0.5905627", "0.59010917", "0.58880043", "0.5830411", "0.5817713", "0.5755317", "0.5748787", "0.57427716", "0.5718064", "0.5671999", "0.56606174", "0.564...
0.6380323
1
Service for receive all services by 'company_id'
def get_services_by_company(company_id: int) -> QuerySet: return ServiceDocument.search().filter("term", **{"company.id": company_id}).to_queryset()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_services(request):\n try:\n company = Company.objects.get(pk=int(request.POST['company_id']))\n\n services = []\n for service in company.services.all():\n services.append({'name': service.name, 'id': service.pk})\n\n return format_ajax_response(True, \"Company's se...
[ "0.68197775", "0.6054475", "0.5878516", "0.5709679", "0.5681982", "0.56394225", "0.5625392", "0.5607893", "0.5546622", "0.55426055", "0.55327594", "0.55286586", "0.5522124", "0.5517146", "0.54952776", "0.54513615", "0.5435713", "0.5375413", "0.53753597", "0.5351074", "0.53225...
0.70713174
0
Get the square object of an element with a given index
def get_square(self, index: int): return self.squares[index]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index_to_square(self, this_index: int) -> Square:\n return self.squares[this_index]", "def get_square(self, index):\n square = []\n for cell in self.squares[index]:\n square.append(self.content[cell[0]][cell[1]])\n return square", "def get_piece(self, index):\n ...
[ "0.7783794", "0.7574147", "0.7490045", "0.6879599", "0.68765074", "0.66710305", "0.6571323", "0.6502549", "0.64770836", "0.6469187", "0.64556384", "0.6454425", "0.6431943", "0.6410768", "0.63751596", "0.6372836", "0.6367385", "0.63667256", "0.6324043", "0.6324043", "0.6264738...
0.8120114
0
Uses the Indicate animation on the element with the given index
def indicate_at(self, index: int): yield Indicate(self.squares[index]) yield Indicate(self.elements[index])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def goto(self, index):\n raise NotImplementedError", "def _setindicator(self, index: int, value: bool) -> None:\n bitmask = 1 << (index + 1)\n current = self._get_buffer(0x04)\n if value:\n self._set_buffer(0x04, current | bitmask)\n else:\n self._set_buff...
[ "0.5829001", "0.5646467", "0.55608237", "0.55268955", "0.5514385", "0.53834915", "0.53558207", "0.53181905", "0.5281783", "0.52426845", "0.52378094", "0.52378094", "0.5219193", "0.521198", "0.520505", "0.52014065", "0.52014065", "0.52014065", "0.52014065", "0.52014065", "0.52...
0.6828146
0
Kill all the processes with name procname. This will retry a force kill only 3 times, then raise an error.
def kill_all(self, procname): procs = self.find_processes_by_name(procname) for proc in procs: result = self.kill_process(proc['PID']) if not result['HasExited']: for i in xrange(3): result = self.kill_process(result['PID'], False) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def kill_all(name, sig=signal.SIGKILL):\n sig = int(sig)\n for proc in psutil.process_iter():\n if proc.name() == name:\n kill(proc.pid, sig)", "def kill_proc_exact(proc_name, sleep_sec = 1, max_retry = 60):\n retry = 0\n # cannot write while (pids = get_pids_exact('SomeComp')):\n ...
[ "0.697361", "0.6668535", "0.6649769", "0.6480402", "0.64701116", "0.64429003", "0.6377969", "0.6372999", "0.635451", "0.613779", "0.61359096", "0.61002", "0.6065713", "0.60357076", "0.59754187", "0.5965336", "0.5945242", "0.59307563", "0.5927764", "0.5910593", "0.590144", "...
0.799322
0
Check slick to see if the machine has checked in within the last 5 minutes, or a test is running and hasn't been running longer than 15 minutes.
def check_slick_status(self): retval = [] slick = SlickAsPy(self.environment.slickurl + "/api") status = slick.get_host_status(self.name) if status['currentWork'] is None: seconds_since_last_checkin = (int(time.time() * 1000) - status['lastCheckin']) if seconds_si...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def validity_by_time(self):\n conn = psycopg2.connect(self.conn)\n permissable_maximum_age_secs = 600 # 600s = 10mins\n query = \"SELECT time FROM steve_sense_sensor_logs ORDER BY time DESC LIMIT 1\"\n cur = conn.cursor()\n cur.execute(query)\n queryResult = cur.fetchall(...
[ "0.640579", "0.62193877", "0.61880183", "0.6180127", "0.6169411", "0.6165985", "0.6155081", "0.60744435", "0.6060624", "0.60000306", "0.59496486", "0.5945319", "0.59210914", "0.59103745", "0.5906849", "0.5880232", "0.58610344", "0.5852131", "0.5806795", "0.57876277", "0.57682...
0.67236435
0
Check the number of Java processes on the system, there should be between 1 and 2 processes, no more, no less.
def check_java_processes(self): mm = MicroManager(self.hostname) java_processes = mm.find_processes_by_name("java") if len(java_processes) > 2 or len(java_processes) == 0: return [CheckStatus(self, CheckStatus.CHECK_JAVA_PROCESS_COUNT, CheckStatus.STATUS_FAIL, "There are {} java proc...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def numRunningProcesses():\n try:\n proc = subprocess.run(\"ps -Af|grep -i \\\"online2-wav-nnet3-latgen-faster\\\"\", stdout=subprocess.PIPE, shell=True)\n np = (len(str(proc.stdout).split(\"\\\\n\")) - 3)\n if(np == None):\n np = 0\n return np\n ...
[ "0.7517433", "0.74348897", "0.7338294", "0.6797079", "0.6794298", "0.65937567", "0.6514027", "0.6462502", "0.63693064", "0.6346972", "0.623888", "0.62370515", "0.6220103", "0.62100905", "0.6143908", "0.612437", "0.6122264", "0.61174494", "0.60940665", "0.60611886", "0.6054894...
0.75797725
0
Check the number of firefox processes on the system, there should be no more than 2 processes
def check_firefox_processes(self): mm = MicroManager(self.hostname) ff_procs = mm.find_processes_by_name("firefox") if len(ff_procs) > 2: return [CheckStatus(self, CheckStatus.CHECK_FIREFOX_PROCESS_COUNT, CheckStatus.STATUS_FAIL, "There are {} firefox processes running".format(len(ff...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def num_processes():\n return 1", "def numRunningProcesses():\n try:\n proc = subprocess.run(\"ps -Af|grep -i \\\"online2-wav-nnet3-latgen-faster\\\"\", stdout=subprocess.PIPE, shell=True)\n np = (len(str(proc.stdout).split(\"\\\\n\")) - 3)\n if(np == None):\n ...
[ "0.6860843", "0.6696315", "0.66218126", "0.61195207", "0.5982056", "0.59425974", "0.59278584", "0.5919861", "0.589109", "0.58585715", "0.58466226", "0.58308715", "0.5763", "0.5734881", "0.5694029", "0.5693691", "0.56655437", "0.5631494", "0.5607702", "0.5602766", "0.5593688",...
0.8056204
0
Perform all the checks, and return a list of CheckStatus objects.
def perform_checks(self): retval = [] retval.extend(self.check_slick_status()) retval.extend(self.check_java_processes()) retval.extend(self.check_firefox_processes()) retval.extend(self.check_disk_space()) return retval
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check_all(self):\n # TODO: this should use functions in execute.py to run tests in-sequence so that variable\n # name collisions are accounted for\n self._log_event(EventType.BEGIN_CHECK_ALL)\n\n # TODO: this is a janky way of resolving where the tests are. Formalize a method of \n ...
[ "0.6877594", "0.68167466", "0.68158245", "0.67767256", "0.66387045", "0.656846", "0.6478773", "0.64131", "0.6407496", "0.63992935", "0.6368768", "0.63681614", "0.63422847", "0.6275114", "0.62562287", "0.62423486", "0.62188816", "0.61790764", "0.61763656", "0.6121809", "0.6118...
0.78020614
0
Add a machine to the pool.
def add_machine(args): session = Session() # the following is used to help with code completion env = Environment(name=args.environment) try: env = session.query(Environment).filter_by(name=args.environment).one() except NoResultFound: print "ERROR: couldn't find environment %s" % ar...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add(self, state_machine):\n\n self.branches.append(state_machine)", "def add_node(self, node):\n self._execution_pool[node.name] = node", "def registerMachine(self, machine):\n if machine in self._machines:\n raise InternalError('Tried to register the same machine twice.')\n...
[ "0.6762968", "0.6668793", "0.6626094", "0.6274972", "0.6223476", "0.6197799", "0.60343325", "0.60025644", "0.5978364", "0.59555566", "0.59127223", "0.58675367", "0.57886165", "0.5784845", "0.5773123", "0.5673353", "0.56728184", "0.5591365", "0.5559377", "0.55235225", "0.55198...
0.80690163
0
Delete a machine from the pool.
def delete_machine(args): session = Session() # the following is used to help with code completion """session.query(PoolMachine).filter(PoolMachine.hostname==args.hostname).delete() session.commit()""" machine = session.query(PoolMachine).filter(PoolMachine.hostname==args.hostname).first() if ma...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delete_machine(self, machine: Union[dto.Machine, str]) -> Optional[dto.Machine]:\n raise errors.UnsupportedOperationError(\n \"Operation not supported for provider '{}'\".format(self.provider_name)\n )", "def delete(self):\n self._lbcall('delete_pool', [self._name])", "def d...
[ "0.71741533", "0.7094532", "0.70258623", "0.7022035", "0.6978453", "0.6692837", "0.65674025", "0.642669", "0.6388736", "0.6350895", "0.63419116", "0.6293149", "0.61799306", "0.616029", "0.6100058", "0.60785466", "0.5992967", "0.5984518", "0.5962041", "0.5952203", "0.59218055"...
0.7769189
0
Print a list of matching machines.
def list_machines(args): session = Session() finder = MachineFinder(args.finder) machines = finder.find_machines(session) print "Machines Found: %d" % (len(machines)) if len(machines) > 0: print print PoolMachine.summary_header() print "-" * 80 for machine in machines...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def list_machines(self, kwargs):\n verbose = kwargs.get(\"verbose\", False)\n\n if verbose:\n attributes = self.engine.all_attributes()\n else:\n attributes = [\"sAMAccountName\", \"objectClass\"]\n\n self.display(self.engine.query(self.engine.COMPUTERS_FILTER(), a...
[ "0.6418596", "0.6321741", "0.6265558", "0.6172058", "0.5926297", "0.5901305", "0.5866562", "0.5837731", "0.5819768", "0.5814439", "0.5805708", "0.5780469", "0.57511306", "0.56883985", "0.5610489", "0.5606815", "0.5598891", "0.55752176", "0.55503803", "0.551069", "0.5491412", ...
0.73563796
0
Check all the machines found via the finder argument, and print the check status results
def check_machines(args): session = Session() finder = MachineFinder(args.finder) machines = finder.find_machines(session) print "Machines Found: %d" % (len(machines)) if len(machines) > 0: if len(machines) > 1: print print CheckStatus.summary_header() pri...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def list_machines(args):\n session = Session()\n finder = MachineFinder(args.finder)\n machines = finder.find_machines(session)\n print \"Machines Found: %d\" % (len(machines))\n if len(machines) > 0:\n print\n print PoolMachine.summary_header()\n print \"-\" * 80\n for m...
[ "0.6251463", "0.597676", "0.5934777", "0.5820399", "0.58104575", "0.57164586", "0.5683106", "0.5606381", "0.5509719", "0.54941356", "0.5492307", "0.54877716", "0.5482829", "0.5455843", "0.54474247", "0.54234844", "0.54180443", "0.5410857", "0.5409262", "0.5400827", "0.5394696...
0.75547606
0
Stop the agent on all the found machines.
def stop_machines(args): session = Session() finder = MachineFinder(args.finder) machines = finder.find_machines(session) print "Machines Found: %d" % (len(machines)) if len(machines) > 0: print print "Stopping the Agent on machines:" for machine in machines: sys....
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def stop_all_agents(self):\n for agent in self.agents:\n if agent.available:\n agent.stop_activity()", "def agents_stop(self):\n self._post('agents/stop')", "def stopall(self):\n\n for i in self.bots:\n try:\n i.stop()\n except...
[ "0.7793052", "0.75224996", "0.7430394", "0.727757", "0.7261888", "0.7251453", "0.7108424", "0.6959152", "0.69266915", "0.69007546", "0.68817854", "0.6866277", "0.68658197", "0.68089503", "0.6715153", "0.6711193", "0.6694383", "0.6690689", "0.6668919", "0.6668731", "0.656183",...
0.838057
0
Run the agent reset on all the found machines.
def reset_machines(args): session = Session() finder = MachineFinder(args.finder) machines = finder.find_machines(session) print "Machines Found: %d" % (len(machines)) if len(machines) > 0: print print "Resetting Agent on machines:" for machine in machines: sys.st...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def reset_remotes(self):\n for remote in [self._tester, self._sut]:\n remote.stop_all()\n remote.reset_stats()\n remote.set_pkt_size(self._cores, 64)\n remote.set_speed(self._cores, 100)\n remote.set_count(0, self._cores)", "def reset():\n for cpu_...
[ "0.70612276", "0.66523504", "0.66008383", "0.6591923", "0.65662456", "0.64973056", "0.64358515", "0.64142364", "0.6407646", "0.6366884", "0.63643813", "0.63616556", "0.62964606", "0.6290867", "0.6279031", "0.62712014", "0.6264439", "0.6217738", "0.6197698", "0.614631", "0.612...
0.8454917
0
Save, or rather fix, the machines found by the finder passed in. There is only one thing to do to save machines right now and that is to reset the agent and cancel the work it has in it's queue (if any). If any errors occur, the machine is taken offline.
def save_machines(args): session = Session() finder = MachineFinder(args.finder) machines = finder.find_machines(session) print "Machines Found: %d" % (len(machines)) if len(machines) > 0: print print "Saving (resetting agent and canceling work) on machines:" for machine in m...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def reset_machines(args):\n session = Session()\n finder = MachineFinder(args.finder)\n machines = finder.find_machines(session)\n print \"Machines Found: %d\" % (len(machines))\n if len(machines) > 0:\n print\n print \"Resetting Agent on machines:\"\n for machine in machines:\n...
[ "0.6425454", "0.5859536", "0.5626262", "0.53941256", "0.5224812", "0.518632", "0.5100054", "0.50766957", "0.50559926", "0.5043701", "0.503414", "0.49833614", "0.4979314", "0.49553978", "0.494617", "0.4908639", "0.4884347", "0.48611364", "0.48455393", "0.4842233", "0.4740718",...
0.8177155
0
Turn an email address into an MX hostname
def get_mx_address(email): domain = email.split('@')[1] exchanges = [] try: for x in dns.resolver.resolve(domain, 'MX'): exchanges.append(x.exchange.to_text().rstrip('.')) except dns.resolver.NoAnswer: pass if not exchanges: exchanges.append(domain) random.shu...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_domain(email_address: str) -> str:\n return email_address.lower().split(\"@\")[-1]", "def _get_domain_for_email(email):\n return email.split('@')[1]", "def email_domain(email):\n parts = email.split(\"@\")\n if len(parts) == 2:\n return parts[1]\n else:\n return None", ...
[ "0.66120696", "0.64356273", "0.6360814", "0.6318636", "0.6290948", "0.62340224", "0.6201459", "0.61259705", "0.6000315", "0.5994812", "0.59947735", "0.59929806", "0.59609914", "0.595259", "0.59250575", "0.5924723", "0.5900683", "0.58742744", "0.5874074", "0.5870373", "0.58346...
0.7534975
0
Middleware sets ip from remote_addr header
def test_middleware_sets_ip_from_remote_add(self): request = MockRequest('83.42.13.77') RealIPMiddleware().process_request(request) self.assertEqual(request.user_ip, request.META['REMOTE_ADDR'])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_middleware_sets_ip_from_forwarded_for(self):\n request = MockRequest('127.0.0.1', '83.42.13.77')\n RealIPMiddleware().process_request(request)\n\n self.assertEqual(request.user_ip,\n request.META['HTTP_X_FORWARDED_FOR'])", "def get_remote_ip(request):\n re...
[ "0.69636965", "0.6921711", "0.6907559", "0.6741216", "0.666704", "0.6645019", "0.6558895", "0.65404505", "0.6522399", "0.64468545", "0.6438712", "0.6344952", "0.6330556", "0.6325113", "0.6226531", "0.62213314", "0.6202556", "0.6166295", "0.6161053", "0.6158335", "0.6117237", ...
0.75635874
0
Middleware sets ip from forwarded_for header
def test_middleware_sets_ip_from_forwarded_for(self): request = MockRequest('127.0.0.1', '83.42.13.77') RealIPMiddleware().process_request(request) self.assertEqual(request.user_ip, request.META['HTTP_X_FORWARDED_FOR'])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_middleware_sets_ip_from_remote_add(self):\n request = MockRequest('83.42.13.77')\n RealIPMiddleware().process_request(request)\n\n self.assertEqual(request.user_ip, request.META['REMOTE_ADDR'])", "def index():\n if request.environ.get('HTTP_X_FORWARDED_FOR') is None:\n pri...
[ "0.65832514", "0.65680814", "0.65494907", "0.6519336", "0.64727664", "0.64727664", "0.63747627", "0.6356676", "0.61305314", "0.6048208", "0.60475856", "0.6042625", "0.6041627", "0.60342574", "0.6024563", "0.59888196", "0.59851587", "0.59729916", "0.5950611", "0.59271187", "0....
0.72786903
0
pack and compress an object with pickle and zlib.
def send_zipped_pickle(self, obj, flags=0, protocol=-1): pobj = pickle.dumps(obj, protocol) zobj = zlib.compress(pobj) return self.send(zobj, flags=flags)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def send_zipped_pickle(self, obj, flags=0, protocol=-1):\n pobj = pickle.dumps(obj, protocol)\n zobj = zlib.compress(pobj)\n # print('zipped pickle is %i bytes' % len(zobj))\n return self.send(zobj, flags=flags)", "def compress(value):\n pickled = pickle_util.dump(value)\n ...
[ "0.74478215", "0.7177528", "0.70826787", "0.69263774", "0.6899893", "0.6805793", "0.66760373", "0.66077256", "0.66077256", "0.64762557", "0.6465707", "0.64510703", "0.6413411", "0.6413411", "0.63787735", "0.61597836", "0.6091758", "0.60493743", "0.60256284", "0.600604", "0.59...
0.7545259
0
reconstruct a Python object sent with zipped_pickle
def recv_zipped_pickle(self, flags=0): zobj = self.recv(flags) pobj = zlib.decompress(zobj) return pickle.loads(pobj)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def send_zipped_pickle(self, obj, flags=0, protocol=-1):\n pobj = pickle.dumps(obj, protocol)\n zobj = zlib.compress(pobj)\n # print('zipped pickle is %i bytes' % len(zobj))\n return self.send(zobj, flags=flags)", "def send_zipped_pickle(self, obj, flags=0, protocol=-1):\n pobj...
[ "0.65126723", "0.6504582", "0.63466877", "0.63250786", "0.63180214", "0.61724806", "0.6081468", "0.60560185", "0.60177755", "0.60157835", "0.600609", "0.59901726", "0.5983071", "0.59076273", "0.59074223", "0.5906471", "0.5886152", "0.58664185", "0.58602303", "0.5825473", "0.5...
0.6818104
1
send a numpy array with metadata
def send_array(self, A, flags=0, copy=True, track=False): md = dict( dtype = str(A.dtype), shape = A.shape, ) self.send_json(md, flags|zmq.SNDMORE) return self.send(A, flags, copy=copy, track=track)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def send_ndarray(sock, data):\n with io.BytesIO() as f:\n np.save(f, data)\n byte_data = f.getvalue()\n\n # Pack message length\n msg = struct.pack('>I', len(byte_data)) + byte_data\n sock.sendall(msg)", "def serialize_numpy(self, buff, numpy):\n try:\n length = len(self.pending...
[ "0.6501568", "0.62580985", "0.619946", "0.6193633", "0.6189601", "0.61822146", "0.6154474", "0.6137267", "0.6136131", "0.6128146", "0.61205447", "0.61147827", "0.6091603", "0.60911626", "0.6068108", "0.60643", "0.6058451", "0.60514754", "0.60438716", "0.60382295", "0.6035022"...
0.63785505
1
sanitize transitions for final states
def sanitize_transitions(transitions): def new_transitions(state, read): if state in ('accept', 'reject', 'halt'): return state, read, (1 if read == '|>' else -1) else: return transitions(state, read) return new_transitions
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_validate_self_final_state_transitions(self):\n with nose.assert_raises(exceptions.FinalStateError):\n self.dtm1.transitions['q4'] = {'0': ('q4', '0', 'L')}\n self.dtm1.validate_self()", "def _prepare_transitions_without_proxy_pc(self):\n transitions = {\n U...
[ "0.59608704", "0.5693894", "0.5670876", "0.5642975", "0.55443186", "0.55419594", "0.54977345", "0.54965806", "0.5472268", "0.5449667", "0.53605413", "0.53510976", "0.53409356", "0.5303349", "0.5253285", "0.525235", "0.5219467", "0.5215968", "0.51929104", "0.5188079", "0.51862...
0.7414467
0
represent transitions as table
def transitions_table(transitions, states, alphabet): transitions = sanitize_transitions(transitions) check_transitions(transitions, states, alphabet) table = [] for current in states: for read in alphabet: # DEBUG: print(state, read) next, write, move = transitions(cur...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def transitions(self) -> List[Dict]:\n return []", "def get_transitions(self):\n transitions = []\n for row in self.states:\n t_row = []\n for column in self.states:\n t_row.append([row, column])\n transitions.append(t_row)\n return sort...
[ "0.67255855", "0.6671027", "0.66532004", "0.63881505", "0.6283373", "0.6169781", "0.61309755", "0.61049795", "0.60562634", "0.5987227", "0.5958376", "0.58731186", "0.58591586", "0.5843021", "0.5835255", "0.57839334", "0.57770514", "0.5772655", "0.5761435", "0.57287306", "0.57...
0.71506095
0
Calculate the factorial of `value`
def calculate_factorial( self, value: "int", fail_if_bigger_than: "int" = None ) -> "int": pass
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def calculate_factorial(num: int, factorial_value: int):\n if num <= 1:\n return factorial_value\n\n return calculate_factorial(num - 1, num * factorial_value)", "def logFactorial(value):\n if all([value > 0,abs(round(value) - value) < 0.000001,value <= 34]):\n return float(sum(np.log(rang...
[ "0.77344155", "0.7526556", "0.72905385", "0.72460854", "0.7149332", "0.70673406", "0.70164007", "0.7006233", "0.6936143", "0.6901903", "0.68945795", "0.6854181", "0.6828081", "0.6821668", "0.68132067", "0.68010587", "0.67935383", "0.6788436", "0.6761285", "0.6691058", "0.6680...
0.7685602
1
set all your GPU to add more memory when necessary for TensorFlow
def tf_set_memory_growth(): physical_devices = tf.config.experimental.list_physical_devices('GPU') for physical_device in physical_devices: tf.config.experimental.set_memory_growth(physical_device, True)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def limit_mem():\n config = tf.compat.v1.ConfigProto()\n config.gpu_options.allow_growth = True\n tf.compat.v1.Session(config=config)", "def limit_gpu_memory_usage():\n\n tf_config = tf.ConfigProto()\n tf_config.gpu_options.allow_growth = True\n set_session(tf.Session(config=tf_config))", "de...
[ "0.7906132", "0.78547263", "0.7348334", "0.7297383", "0.71145254", "0.7050099", "0.7034848", "0.6982133", "0.66512537", "0.6641334", "0.65701526", "0.65123516", "0.65083855", "0.635838", "0.63570505", "0.62639046", "0.62056965", "0.6141928", "0.6093227", "0.6091074", "0.60746...
0.7912332
0
Plot the apertures overlayed on the image
def plot_apertures(self,stretch="hist",cmap="gray",alpha=0.5,lw=1.5,**kwargs): #self.fig, self.ax = plt.subplots() #self.ax.imshow(self.data, cmap='gray_r', origin='lower') self.plot(stretch=stretch,cmap=cmap) if type(self.apertures)==list: [ap.plot(color='blue',alpha=alpha,a...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def plot_apertures(image, ext=1):\n\n hdu = fits.open(image)\n apfile = './database/ape' + image.strip('.fits') + '_{:d}'.format(ext)\n\n b = np.array(\n [i.split()[3:] for i in open(apfile).readlines() if 'begin' in i])\n\n apid = b[:, 0]\n x = np.array([float(i) for i in b[:, 2]])\n\n sc...
[ "0.63690543", "0.62471694", "0.6223126", "0.61979526", "0.61384803", "0.60802174", "0.60348827", "0.6015301", "0.59327394", "0.5855474", "0.5854448", "0.58393836", "0.5812253", "0.5809869", "0.5792227", "0.577715", "0.57620543", "0.57507455", "0.57423115", "0.57321507", "0.57...
0.64703363
0
Perform the photometry by window centroiding Currently only supports one aperture radius
def perform_photometry_window_centroid(self,xcen,ycen,r_aper=34.,r_annulus1=60.,r_annulus2=90., box_size=80.,method="howell"): if (r_annulus1 < r_aper) ^ (r_annulus2 < r_aper): raise Exception, '(r_annulus1 < r_aper) ^ (r_annulus2 < r_aper)' ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def find_window_centroids(self, warped):\n window_width = self.window_width\n window_height = self.window_height\n margin = self.margin\n \n window_centroids = [] # store the (left,right) window centroids positions per level\n window = np.ones(window_width) # Create window...
[ "0.64600456", "0.6453353", "0.64277303", "0.63199353", "0.63098097", "0.63059", "0.62005365", "0.610343", "0.60987616", "0.6094712", "0.6092999", "0.6092751", "0.6022957", "0.60049474", "0.5942481", "0.59232664", "0.5907178", "0.58953047", "0.5882762", "0.5861726", "0.5825627...
0.77198577
0
full example using FleurRelaxWorkChain with just a fleurinp data as input. Several fleur runs needed till convergence
def test_fleur_relax_fleurinp_Si_bulk(enable_archive_cache, fleur_local_code, create_fleurinp, clear_database, show_workchain_summary): options = { 'resources': { 'num_machines': 1, 'num_mpiprocs_per_machine': 1 }, 'max_wallclock_...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_fleur_relax_validation_wrong_inputs(fleur_local_code, inpgen_local_code, generate_structure2):\n from aiida.orm import Dict\n\n # prepare input nodes and dicts\n options = {\n 'resources': {\n 'num_machines': 1,\n 'num_mpiprocs_per_machine': 1\n },\n 'ma...
[ "0.6629493", "0.64359736", "0.62659895", "0.6209961", "0.6183638", "0.6004328", "0.59587884", "0.59572893", "0.59045887", "0.5805597", "0.57625765", "0.5746759", "0.57210416", "0.5720385", "0.57198924", "0.5648384", "0.5641449", "0.56273687", "0.56196386", "0.56167144", "0.56...
0.69624954
0
Test the validation behavior of FleurRelaxWorkChain if wrong input is provided it should throw an exitcode and not start a Fleur run or crash
def test_fleur_relax_validation_wrong_inputs(fleur_local_code, inpgen_local_code, generate_structure2): from aiida.orm import Dict # prepare input nodes and dicts options = { 'resources': { 'num_machines': 1, 'num_mpiprocs_per_machine': 1 }, 'max_wallclock_se...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_fleur_relax_continue_converged(self, run_with_cache, mock_code_factory):\n assert False", "def test_xfail_with_run_false_and_with_reason():\n pass", "def test_fleur_create_mag_validation_wrong_inputs(self, fleur_local_code, inpgen_local_code, generate_structure2):\n from aiida.orm imp...
[ "0.6527789", "0.6397676", "0.6376287", "0.62080467", "0.5986831", "0.597977", "0.59309053", "0.59191245", "0.5904268", "0.58760554", "0.5873213", "0.5866766", "0.5860231", "0.5855194", "0.58542204", "0.584257", "0.5834893", "0.58343375", "0.58338165", "0.58320963", "0.5828332...
0.75277627
0
Add the passed in Pile of Cards to the Hand
def add_pile(self, pile): for c in range(pile.get_size()): card = pile.remove_first() self._hand.add_last(card)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def addCardToHand(self, card):\r\n self.hand.append(card)", "def add_card_to_hand(self, card):\n self.hand.append(card)", "def add_card(self, card):\n #Determines if there are more than one.\n if isinstance(card,list):\n for element in range(len(card)):\n #...
[ "0.7303749", "0.7261806", "0.7231359", "0.71908945", "0.708371", "0.70317644", "0.69786596", "0.69185394", "0.6915161", "0.68766797", "0.68649715", "0.67979866", "0.66192365", "0.6605498", "0.6580519", "0.65088373", "0.6503876", "0.6503876", "0.6503876", "0.6503876", "0.64854...
0.74441516
0
Remove the top Card from the Hand And add it to the passed in Pile
def play_card(self, pile): pile.add_card(self._hand.remove_first())
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def hit(hand=bj.player1.hand):\r\n hand.append(bj.deck.remove_card())", "def remove_from_hand(self):\n pass", "def update_hand(self, card_num):\n self.hand.pop(card_num)", "def remove_card(self):\n return self.hand.pop()", "def add_pile(self, pile):\n \n for c in r...
[ "0.7311014", "0.7193814", "0.7091728", "0.7086572", "0.6971293", "0.69486386", "0.6650889", "0.64928824", "0.64928824", "0.6481667", "0.6459279", "0.6450959", "0.64456934", "0.64375573", "0.6436413", "0.6416177", "0.6397232", "0.63931745", "0.6390436", "0.6364901", "0.6309483...
0.7307427
1
Return the number of Cards in the Hand
def get_num_cards(self): return self._hand.get_size()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def count(self):\n return(len(self.cards))", "def num_cards(self):\n length=len(self.cards)\n return length", "def count(self):\n return len(self.deck)", "def get_length(self):\n return len(self.cards)", "def total_cards(self):\n amount = 0\n for palo in sel...
[ "0.8366412", "0.8345038", "0.7758588", "0.7551099", "0.7538208", "0.74666196", "0.74069214", "0.7377227", "0.7310711", "0.7236268", "0.72108585", "0.71130294", "0.7108003", "0.70836735", "0.70836735", "0.7061145", "0.69822764", "0.69253355", "0.69028354", "0.689859", "0.68914...
0.8386889
0
Print the Player's Hand by calling the Hand's __str__ method
def display_hand(self): print (self._hand)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __str__(self):\n return Hand.__str__(self) + '\\nHand Rank: ' + self.get_full_label()", "def player_show_hand(self):\n for card in self.get_hand():\n print(card.get_card())", "def __str__(self):\n string = \"Hand contains \"\n h = self.hand\n \n for i in...
[ "0.8309237", "0.77762437", "0.7773761", "0.7767747", "0.75754976", "0.7568873", "0.74958175", "0.7477312", "0.7414893", "0.7409631", "0.74033546", "0.7283446", "0.721082", "0.7187044", "0.71833795", "0.71511585", "0.7139379", "0.71140784", "0.70902866", "0.7042968", "0.701166...
0.82403374
1
convert string to number
def str2num(s): try: return int(s) except ValueError: return float(s)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def string_to_number(string):\n if not string:\n return 0\n try:\n return int(string)\n except ValueError:\n return float(string)", "def to_number(s):\n ret = s\n try:\n ret = float(s)\n except ValueError:\n ret = ret.strip('\\'').strip()\n return ret\n...
[ "0.81351763", "0.81171566", "0.79739803", "0.78550935", "0.7829166", "0.7786419", "0.7669", "0.75417364", "0.75378966", "0.75176567", "0.75126886", "0.7489924", "0.7440725", "0.7415702", "0.73017126", "0.7141235", "0.7022343", "0.701367", "0.6993899", "0.686807", "0.6818014",...
0.8314441
0
check variable by using regular expressions
def _check_variable(string, varname): prefix = '[(, ]' # Any character with the exception of '(, ' suffix = '[), ]' # Any character with the exception of '), ' pattern = prefix + varname + suffix re.match(pattern, string)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_variable(pattern):\n return (type(pattern) is str\n and pattern[0] == '?'\n and len(pattern) > 1\n and pattern[1] != '*'\n and pattern[1] in string.ascii_letters\n and ' ' not in pattern)", "def is_variable(s):\n return s[0] >= 'u' and s[0] <= '...
[ "0.6769958", "0.67595696", "0.6594304", "0.65283763", "0.6526588", "0.6447878", "0.6447878", "0.6356379", "0.6320342", "0.6285951", "0.6260877", "0.6258617", "0.62445927", "0.62099564", "0.6191854", "0.6167431", "0.61627233", "0.6159792", "0.60734344", "0.6066107", "0.6039188...
0.7724351
0
checks if character is not in the name or parameter string (if it is, throw an error)
def check_character(char, name, parameters): if char in name: raise NameError('Invalid character in the variable name: ' + name) # Make sure people don't include # within the name of parameters for item in parameters.keys(): if char in item: raise NameError('Invalid chara...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def validname(name):\r\n return len(name)>0 and (\r\n Context.__invalid_character.search(name) is None)", "def _check_for_parameter_syntax(self,parameter):\n err_msg = \"Illegal parameter name {}.\".format(parameter)\n if len(parameter) == 0:\n raise ValueError(err_msg ...
[ "0.70610005", "0.6957453", "0.6886487", "0.6811838", "0.6752317", "0.6694575", "0.6686241", "0.66786546", "0.6672879", "0.6533731", "0.6517977", "0.6501903", "0.64413077", "0.6413294", "0.64122677", "0.6394168", "0.6385318", "0.6361", "0.6346873", "0.6334966", "0.63148457", ...
0.84358835
0
Displays the game over screen
def show_game_over(self): font = pygame.font.SysFont(DisplayConsts.GAME_OVER_FONT_TYPE, DisplayConsts.GAME_OVER_FONT_SIZE) surface = font.render("Game Over", True, DisplayConsts.GAME_OVER_FONT_COLOR) # Display game over rect = surface.get_rect() rect.midtop = (DisplayConsts.SCREEN_WIDTH...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def game_over(self):\r\n win.blit(self.image_of_game_over, (250, 170))", "def show_game_over_screen():\n game_over_font = pygame.font.Font('freesansbold.ttf', 120)\n game_surface = game_over_font.render('Game', True, WHITE)\n over_surface = game_over_font.render('Over', True, WHITE)\n game_rec...
[ "0.828568", "0.81241494", "0.8054334", "0.80165696", "0.8001225", "0.7982136", "0.79339725", "0.76767915", "0.76292074", "0.75744355", "0.75530946", "0.7505249", "0.74886507", "0.74126536", "0.74051535", "0.73711807", "0.7322313", "0.72022474", "0.7196458", "0.7169502", "0.71...
0.83626986
0
Only users that are staff are allowed to see this menu.
def is_user_allowed(self, user): return user.is_staff
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_staff(self):\r\n return self.is_admin", "def is_staff(self):\n return self.is_admin", "def is_staff(self):\n return self.is_admin", "def is_staff(self):\n\t\treturn self.is_admin", "def test_is_staff_access(self):\r\n self.check_index_and_outline(self.client)", "def has_s...
[ "0.7719837", "0.74760246", "0.74760246", "0.74752843", "0.73139966", "0.7277097", "0.72541326", "0.7072912", "0.7072912", "0.7072912", "0.7059569", "0.6982773", "0.6843595", "0.6776745", "0.67338896", "0.6733382", "0.67065734", "0.66786593", "0.6646928", "0.6646928", "0.66230...
0.7534058
1
Ability to add a new donor to the neo database or if the donor exists, we can still add a new donation
def add_donor_neo(self, new_first_name, new_last_name, new_email, donation_amount): with self.driver.session() as session: transaction_id = new_email + '_1' if not self.donor_exists_neo(new_email, session): try: full_name = new_first_name + ' ' + new_last_name cyph = "CREATE (n:Donor {email:'%s', ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_donor():\n logger.info('+++ Adding/Updating Donors')\n Main.connect_db()\n database.execute_sql('PRAGMA foreign_keys = ON;')\n name = input(\"Type donor first and last name: \")\n location = input(\"Type donor location (optional): \")\n try:\n don = floa...
[ "0.78216445", "0.7539791", "0.73935664", "0.7205716", "0.7150446", "0.7144435", "0.71018386", "0.7087724", "0.6904157", "0.68812627", "0.68335396", "0.6670825", "0.6639124", "0.6392329", "0.63684034", "0.63230246", "0.63022447", "0.6267651", "0.6165239", "0.6163705", "0.60284...
0.7548321
1
Creates thank you message for donor
def thank_you_message(self, name, donation_amount): thank_you_message = "\nThank you {0:s} for you generous donation of ${1:.2f}.\n".format(name, round(donation_amount,2)) return thank_you_message
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_thankyou_message(donor):\n message = '''Dear {}, \n Thank you so much for your generosity with your most recent donation of ${}. \n It will be put to very good use.\n Sincerely.'''\n return message.format(donor[\"name\"], donor[\"donations\"][-1])", "def createThank...
[ "0.78450173", "0.7814776", "0.7809823", "0.77496356", "0.76782066", "0.7339795", "0.72114575", "0.71790093", "0.7063729", "0.70534915", "0.69376266", "0.6932777", "0.6929319", "0.6914824", "0.68592894", "0.6729701", "0.6714347", "0.66973317", "0.667985", "0.6654785", "0.65866...
0.79461265
0
Writes to a file. The donors name and total donations will be stored in the contents of the file, while the file name will be the donors email address
def write_to_file(self): with self.driver.session() as session: try: file_name = None donor_file_name = None full_file_name = None complete_file_name = None cyph = "MATCH (d:Donor) RETURN d.email" result = session.run(cyph) for donor in result: donor_file_name = donor['email'] ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def thank_donor(filename, donorname, donation):\n\n try:\n with open(filename, 'w') as fhandle:\n fhandle.write(\"Hello {}! On behalf of our staff here at OMGBBQMMX,\"\n \"I want to thank you for your generous gift\"\n \" of ${:.2f}!\".format(d...
[ "0.7609048", "0.69219613", "0.684354", "0.67753285", "0.6684142", "0.66822964", "0.6401604", "0.6285119", "0.61633074", "0.6058355", "0.5994589", "0.59464794", "0.59464794", "0.5921532", "0.59101367", "0.5903182", "0.58954483", "0.5859477", "0.5850165", "0.5848873", "0.583684...
0.78757757
0
return naive score for game state based on of walls and path lengths only. higher score corresponds to better position (diff in of walls) weights[0] + (diff in path lengths) weights[1]
def state_score_naive(self, game_state, player, weights): # walls score other_players = [p for p in game_state.players if p != player] my_walls = player.num_walls their_walls = max([p.num_walls for p in other_players]) walls_diff = (my_walls - their_walls) # path length s...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def heuristic(self):\n game_score = (self.get_game_score(), 0.85)\n road_score = (self.get_longest_road_score(), 0.05)\n steps_score = (self.get_steps_available_score(), 0.05)\n reachable_nodes_score = (self.get_reachable_nodes_score(), 0.05)\n heuristics = [game_score, road_scor...
[ "0.6490086", "0.62768745", "0.62624353", "0.62273395", "0.62246174", "0.6164314", "0.61350363", "0.6130807", "0.61227393", "0.61055684", "0.61046237", "0.61025846", "0.60932904", "0.60541034", "0.6036763", "0.6027954", "0.60177416", "0.5984697", "0.5966657", "0.59622574", "0....
0.8018729
0
Create a PayrollPaymentEmployer with wrong total_amount value, then verify returned total_amount
def test_create_payment_verify_amounts(self): test_shift, _, __ = self._make_shift( shiftkwargs={'status': 'OPEN', 'starting_at': timezone.now(), 'ending_at': timezone.now() + timedelta(hours=8), 'minimum_hourly_rate': 15, 'minimum_allowed_rating': 0...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_give_custom_raise(self):\n self.employee.give_raise(self.raise_amount)\n self.assertEqual(70000, self.employee.salary)", "async def test_fail_neagative_amount(self, conn, user_with_wallet):\n amount = Decimal('-3')\n\n with pytest.raises(ValueError) as exc:\n await...
[ "0.5898568", "0.58648705", "0.5838532", "0.58208466", "0.58103573", "0.5786868", "0.57268757", "0.56974876", "0.5693337", "0.5691926", "0.56397843", "0.5626107", "0.56111336", "0.55956995", "0.55766904", "0.55225456", "0.54991996", "0.548934", "0.54852116", "0.54828364", "0.5...
0.688794
0
Get list of all pcodes
def get_pcode_list(self) -> List[str]: return self.pcodes
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def codes(self):\n return [card.code for card in self.cards]", "def list():\n\n return cache.codeTableList()", "def codelists():\n return CodelistSet()", "def get_codecs_list():\n for codec in CODECS_IN_FILE.iterkeys():\n print codec", "def pin_code(self) -> List[PinCodeSummary]:\n ...
[ "0.7085422", "0.67058885", "0.6575384", "0.64375883", "0.63980293", "0.63528806", "0.63204837", "0.62434506", "0.6118487", "0.60903996", "0.6030338", "0.5979887", "0.5978733", "0.5978733", "0.5930405", "0.5930405", "0.59237957", "0.5913762", "0.5907415", "0.5897931", "0.58778...
0.8819543
0
Get admin level for country
def get_admin_level(self, countryiso3: str) -> int: admin_level = self.admin_level_overrides.get(countryiso3) if admin_level: return admin_level return self.admin_level
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getAdminLevel(self):\n return self.__adminLevel", "def get_info_admin(self):\n return self.get_info(\"HS_ADMIN\")", "def get_level(rol):\n\treturn rol.level", "def getLevels():", "def filter_geolevels(self):\n return self.filter_nodes('/DistrictBuilder/GeoLevels/GeoLevel')", "def...
[ "0.7194143", "0.62322676", "0.6219481", "0.5948711", "0.5923398", "0.5905333", "0.5884878", "0.5834538", "0.5793904", "0.578613", "0.57844114", "0.57259613", "0.5718732", "0.56983316", "0.5696867", "0.5683486", "0.564767", "0.564153", "0.54959315", "0.54895085", "0.5484118", ...
0.8416659
0
Get pcode length for country
def get_pcode_length(self, countryiso3: str) -> Optional[int]: return self.pcode_lengths.get(countryiso3)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def convert_admin1_pcode_length(\n self, countryiso3: str, pcode: str, logname: Optional[str] = None\n ) -> Optional[str]:\n pcode_length = len(pcode)\n country_pcodelength = self.pcode_lengths.get(countryiso3)\n if not country_pcodelength:\n return None\n if (\n ...
[ "0.68004125", "0.6439432", "0.6337102", "0.6254802", "0.6157772", "0.5911685", "0.5899071", "0.589627", "0.5870338", "0.5854779", "0.58445597", "0.581861", "0.57889104", "0.57889104", "0.5745525", "0.56837547", "0.568266", "0.5626178", "0.56086004", "0.5606755", "0.5604039", ...
0.80896854
0
Initialise storage of fuzzy matches, ignored and errors for logging purposes
def init_matches_errors(self) -> None: self.matches = set() self.ignored = set() self.errors = set()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, matches=None):\n super(MatchWarehouse, self).__init__()\n\n if matches is None:\n matches = []\n\n self.matches = matches", "def __init__(self):\n\t\tself.relevances = None", "def __init__ (self, id, finder, matches):\n\t\tself.id = id\n\t\t# self.inCitesName ...
[ "0.6078395", "0.5936211", "0.5737165", "0.57187974", "0.5703025", "0.5700027", "0.56937253", "0.568053", "0.56125456", "0.5599211", "0.55830574", "0.55691487", "0.5546313", "0.551677", "0.5515388", "0.5489945", "0.54630363", "0.5452383", "0.5444116", "0.5426767", "0.5419853",...
0.6887651
0
Standardise pcode length by country and match to an internal pcode. Only works for admin1 pcodes.
def convert_admin1_pcode_length( self, countryiso3: str, pcode: str, logname: Optional[str] = None ) -> Optional[str]: pcode_length = len(pcode) country_pcodelength = self.pcode_lengths.get(countryiso3) if not country_pcodelength: return None if ( pcod...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def country(alpha_2_code: str) -> None:", "def fuzzy_pcode(\n self, countryiso3: str, name: str, logname: Optional[str] = None\n ) -> Optional[str]:\n if (\n self.countries_fuzzy_try is not None\n and countryiso3 not in self.countries_fuzzy_try\n ):\n if l...
[ "0.6864307", "0.6568446", "0.65547794", "0.6446121", "0.62882507", "0.57468176", "0.5739177", "0.56350464", "0.55212307", "0.54924", "0.5483948", "0.5448059", "0.5415295", "0.5406929", "0.53253376", "0.5275046", "0.5250778", "0.5247884", "0.5236473", "0.52082604", "0.51733947...
0.80784714
0
Fuzzy match name to pcode
def fuzzy_pcode( self, countryiso3: str, name: str, logname: Optional[str] = None ) -> Optional[str]: if ( self.countries_fuzzy_try is not None and countryiso3 not in self.countries_fuzzy_try ): if logname: self.ignored.add((logname, countr...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def match_specific_name(name: str, specific_names: list) -> str:\n c = clean_specific_name(name)\n if c == \"\":\n return c\n else:\n y = \"\"\n for x in specific_names:\n matchlist = x.variations.split(\";\")\n if c in matchlist:\n y = x.name\n ...
[ "0.6168389", "0.6139129", "0.6071032", "0.6048621", "0.59267986", "0.58842015", "0.5867975", "0.58635634", "0.5857726", "0.5808192", "0.57797605", "0.5777386", "0.5750848", "0.57491803", "0.5741692", "0.57101977", "0.5661098", "0.56402546", "0.5632278", "0.5581385", "0.557990...
0.7084574
0
Output log of matches
def output_matches(self) -> List[str]: output = list() for match in sorted(self.matches): line = f"{match[0]} - {match[1]}: Matching ({match[4]}) {match[2]} to {match[3]} on map" logger.info(line) output.append(line) return output
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def runTest(self):\n import logging\n lg_name = expector.logger_name\n lg = logging.getLogger(lg_name)\n start_level = logging.getLevelName('DEBUG_9')\n end_level = logging.getLevelName('CRITICAL_0')\n for lvl in range(start_...
[ "0.6703418", "0.6613801", "0.65900517", "0.63869303", "0.6369023", "0.6115638", "0.6093751", "0.59988856", "0.59654194", "0.5937717", "0.59080356", "0.5785938", "0.57386744", "0.5726134", "0.5710062", "0.5642616", "0.5638629", "0.5636376", "0.56320333", "0.5589491", "0.558415...
0.75522673
0
Output log of ignored
def output_ignored(self) -> List[str]: output = list() for ignored in sorted(self.ignored): if len(ignored) == 2: line = f"{ignored[0]} - Ignored {ignored[1]}!" else: line = f"{ignored[0]} - {ignored[1]}: Ignored {ignored[2]}!" logger.i...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def testIgnore(self):\n\n self.logger.accept('c',self.logger.foo)\n self.logger.accept('c',self.logger.bar)\n self.logger.ignore('c',self.logger.foo)\n messager.send('c')\n # Only one method should have been called.\n self.assertEqual(len(self.logger.log),1)\n # bar...
[ "0.66159654", "0.6615568", "0.6563683", "0.6467158", "0.642576", "0.6407278", "0.62708443", "0.6197979", "0.6185305", "0.61736274", "0.6127977", "0.6110092", "0.6082548", "0.60412055", "0.5980595", "0.59517694", "0.5947568", "0.5855487", "0.5855487", "0.5846926", "0.5795751",...
0.74344534
0
Based on the desired input, output and filter shape, figure out the correct 2D convolution configuration to use including the type (normal or full convolution), stride size, padding type/size
def conv2d_config(input_shape, output_shape, filter_shape): input_shape = tf.TensorShape(input_shape).as_list() if len(input_shape) == 4: batch_size = input_shape[0] else: batch_size = None input_shape = np.array(input_shape[-3:]) output_shape = np.array(tf.TensorShape(output_shape)...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def conv2d(input, filters, image_shape=None, filter_shape=None,\r\n border_mode='valid', subsample=(1, 1), **kargs):\r\n\r\n #accept Constant value for image_shape and filter_shape.\r\n if image_shape is not None:\r\n image_shape = list(image_shape)\r\n for i in xrange(len(image_shape...
[ "0.7666712", "0.75563943", "0.7253493", "0.7151335", "0.70599556", "0.7046664", "0.7006856", "0.69941896", "0.6992957", "0.6988655", "0.69146556", "0.69121355", "0.6907195", "0.6892754", "0.6884804", "0.6874693", "0.6851518", "0.6826805", "0.6826221", "0.6782795", "0.67820716...
0.8330773
0
Given the desired shapes of the input, output and filter tensors, returns the shape of the appropriate convolution filter and a correctly configured op function. The returned op function should be called with the input tensor and weight tensor, and returns a result of 2D convolution that matches the desired output_shap...
def get_convolution_op(input_shape, output_shape, kernel_shape): filter_shape, strides, padding, padded_shape, conv_type, padding_type = conv2d_config(input_shape, output_shape, kernel_shape) if conv_type == 'NORMAL': def conv_op(inputs, weight, name='generic_convolution'): with tf.name_scop...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def conv2d_config(input_shape, output_shape, filter_shape):\n input_shape = tf.TensorShape(input_shape).as_list()\n if len(input_shape) == 4:\n batch_size = input_shape[0]\n else:\n batch_size = None\n\n input_shape = np.array(input_shape[-3:])\n output_shape = np.array(tf.TensorShape(...
[ "0.78144246", "0.73072946", "0.7246472", "0.7105872", "0.70898974", "0.6981136", "0.680611", "0.6795094", "0.6774584", "0.66701835", "0.66502523", "0.6645472", "0.64855754", "0.64839745", "0.64172703", "0.64024395", "0.63939494", "0.6378876", "0.63567823", "0.6335626", "0.630...
0.79986364
0
L2 normalize weights of the given tensor along specified dimension(s).
def normalize_weights(w, dims=(0,), bias=1e-5): with tf.name_scope('normalization'): return w / (tf.sqrt(tf.reduce_sum(tf.square(w), dims, keep_dims=True) + bias))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def L2_norm(x, axis=-1):\n return keras.backend.l2_normalize(x, axis=axis)", "def norm2d(w_in):\n return nn.BatchNorm2d(num_features=w_in, eps=cfg.BN.EPS, momentum=cfg.BN.MOM)", "def normalize(w: torch.Tensor):\n\n if w.dim() > 1:\n return _matrix(w)\n\n return _vector(w)", "def l2_normali...
[ "0.6906336", "0.6751098", "0.6747886", "0.67012024", "0.66678435", "0.6618368", "0.659822", "0.65933174", "0.6558486", "0.6515114", "0.6459915", "0.64257294", "0.64257294", "0.6387475", "0.6333754", "0.6331633", "0.63164073", "0.63137084", "0.6294328", "0.625288", "0.62514037...
0.7061722
0
Find docs root, or call pytest.skip
def docs_root(): start, result = get_docs_root() if result is None: pytest.skip(f"No directory '{DOCS_DIR}' found from '{start}'") yield result
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_docs_paths():\n assert os.path.exists('test/examples/docs/paths-root-api.md')\n assert os.path.exists('test/examples/docs/paths-subpath1.md')\n assert os.path.exists('test/examples/docs/paths-subpath1.md')", "def test_docdir(self):\n self.chck_triple('docdir')", "def test_all_doc_tests...
[ "0.7076463", "0.67410463", "0.6464617", "0.6399846", "0.63957447", "0.6295307", "0.62140745", "0.613874", "0.60084933", "0.59414864", "0.5931416", "0.59260744", "0.5925133", "0.58925974", "0.5859824", "0.5841973", "0.58112466", "0.58080333", "0.57987845", "0.57556814", "0.571...
0.7885804
0
See if EDB can be instantiated, or call pytest.skip
def electrolytedb(): if not check_for_mongodb(): pytest.skip("MongoDB is required")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_init(self):\n self.assertIsNotNone(DatabaseIntermediary(), self.ec.db)", "def test_410_000_non_existant_db(self):\n with TDC() as temp_dir:\n file = Path(temp_dir) / 'database.db'\n self.assertFalse(file.exists(),'Database file exists pre test')\n eng = Eng...
[ "0.6687451", "0.65198994", "0.6487531", "0.64061683", "0.63104695", "0.6235148", "0.61678445", "0.6162714", "0.6143305", "0.61321855", "0.6115058", "0.6095546", "0.60929483", "0.6084231", "0.60771376", "0.606847", "0.6052603", "0.60399115", "0.6036643", "0.60104144", "0.58981...
0.7219592
0
Gets the configs of this ContainerSettingsDTO.
def configs(self): return self._configs
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def configs(self):\n\n return self.__configs", "def config(self) -> dict:\n return self._configs", "def configs(self) -> list[Config]:\n return self._configs", "def get_configurations(self, obj):\n configs = obj.configs.all()\n serializer = SimpleExportConfigSerializer(conf...
[ "0.77744806", "0.7518531", "0.7510472", "0.6783861", "0.6663737", "0.66454476", "0.66389966", "0.65157944", "0.6432543", "0.64156866", "0.6349658", "0.6349236", "0.6326783", "0.63180244", "0.63180244", "0.63180244", "0.6313971", "0.6289116", "0.6289116", "0.62610984", "0.6259...
0.7751695
1
Sets the configs of this ContainerSettingsDTO.
def configs(self, configs): self._configs = configs
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_config(self, cfg):\n\n cfg.add_section(self.name)\n for attr, value in self.__dict__.items():\n if value not in [\"false\", \"none\", \"0\"] and attr != \"name\":\n attr = attr.replace(\"_\", \"-\")\n\n # key-mgmt=none is a mandatory assignment for WE...
[ "0.58845645", "0.5880515", "0.57816756", "0.57437843", "0.571305", "0.5670474", "0.56298476", "0.56061596", "0.55737495", "0.55698293", "0.55454767", "0.5534653", "0.5534653", "0.5534653", "0.55141705", "0.5474932", "0.53934497", "0.5365268", "0.5358987", "0.53561044", "0.535...
0.6992886
0
Sets the resources of this ContainerSettingsDTO.
def resources(self, resources): self._resources = resources
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def resources(self, value):\n self._resource_objects = value", "def resources(self, resources):\n\n self._resources = resources", "def resources(self, resources):\n\n self._resources = resources", "def resources(self, resources):\n\n self._resources = resources", "def resources(...
[ "0.6526639", "0.6505281", "0.6505281", "0.6505281", "0.6505281", "0.5930606", "0.5805928", "0.55509865", "0.55400944", "0.5351522", "0.5343026", "0.5336851", "0.5330234", "0.5276501", "0.5266615", "0.5266615", "0.5239786", "0.5237074", "0.52323866", "0.51405156", "0.51136523"...
0.6537196
0
_uniform_order_statistic_cdf(i, n, x) > Pr[U_(i) < x] Let U_1, ..., U_n ~ Uniform[0,1] be n independent random variables and let U_(1) < ... < U_(n) denote the same variables in sorted order. Then U_{(i)} ~ Beta(i, ni+1) This function returns the Cumulative Distribution function of U_(i), i.e. the return value is Pr[U_...
def _uniform_order_statistic_cdf(i, n, x): return betainc(i, n-i+1, x)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def uniform_cdf(x):\n if x <0: return 0 #uniform random is never less than 0\n elif x < 1: return x #e.g. P(x <= 0.4) = 0.4\n else: return 1 #uniform random is always less than 1", "def uniform_cdf(x: float) -> float:\n if x < 0: return 0 # uniform random is never les...
[ "0.6810556", "0.66873217", "0.6532582", "0.61932427", "0.6031655", "0.5951562", "0.58816993", "0.5845623", "0.5833746", "0.5804201", "0.5792395", "0.57640696", "0.571037", "0.5705995", "0.5701245", "0.5682896", "0.56571573", "0.56272", "0.5618689", "0.5618689", "0.55853397", ...
0.82678026
0
Probability of having Mn_plus < x under the null hypothesis that X_1,...X_n ~ U[0,1]
def Mn_plus_distribution(n, x): b_bounds = Mn_plus_bounds(n, x) return 1.0 - crossprob.ecdf1_new_b(b_bounds) #return 1.0 - crossprob.ecdf2(b_bounds, [1]*len(b_bounds), True)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def prob_extinct(Z0, t, n, s, u):\n p = 1\n for k in range(len(Z0)):\n p *= Phi_k(Phit(t - 1, List([0.] * n), s, u), k, s, u) ** Z0[k]\n return p", "def prob1(n):\n#raise NotImplementedError(\"Problem 1 Incomplete\")\n if n == 0 :\n raise ValueError(\"Sampling 0 points is not defined.\"...
[ "0.62147534", "0.62030524", "0.6169988", "0.6028174", "0.60157955", "0.59990734", "0.5986832", "0.5863503", "0.5770678", "0.5767007", "0.5748054", "0.571745", "0.5708238", "0.570814", "0.57026434", "0.5689939", "0.56877863", "0.56754845", "0.5674975", "0.5674324", "0.5639557"...
0.6315941
0
Binary search for x such that Mn_plus_distribution(n,x) = alpha
def inverse_Mn_plus(n, alpha, debug_prints): low = 0.0 high = 1.0 last_range = None for i in range(N_BINARY_SEARCH_STEPS_MAX): if last_range == (low, high): if debug_prints: print('last_range == (low, high)') break last_range = (low, high) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def Mn_plus_distribution(n, x):\n b_bounds = Mn_plus_bounds(n, x)\n return 1.0 - crossprob.ecdf1_new_b(b_bounds)\n #return 1.0 - crossprob.ecdf2(b_bounds, [1]*len(b_bounds), True)", "def uniform_search(fun, a, b, E, n=3, counter=0):\n if b - a < E:\n return (b + a) / 2, counter\n step = (b ...
[ "0.6465277", "0.6061245", "0.5888871", "0.5797817", "0.5765356", "0.5671757", "0.5607599", "0.5555103", "0.55197906", "0.5511107", "0.55038816", "0.54853624", "0.54679406", "0.54563314", "0.5429234", "0.5415453", "0.5410396", "0.540519", "0.5405174", "0.53945506", "0.53716695...
0.68880993
0
Return epidemic curves for region.
def epidemic_curve(self, disease=None, **kwargs) -> pd.DataFrame: disease = get_disease(disease) return disease.epidemic_curve(self.region, **kwargs)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def curves(self):\n return self._curve_reg", "def get_ergodic_region(self):\n return [self.f1(self.rho),self.f0(self.rho)]", "def pcurve(self, edge):\n crv, umin, umax = BRep_Tool().CurveOnSurface(\n edge.topods_shape(), self.topods_shape()\n )\n return crv, Interv...
[ "0.63937724", "0.612072", "0.5898211", "0.5730005", "0.549379", "0.5446748", "0.54353255", "0.53812855", "0.52399015", "0.52078134", "0.5206522", "0.52010757", "0.5192675", "0.51835597", "0.51711965", "0.51685727", "0.516798", "0.51506317", "0.51501995", "0.5141728", "0.51417...
0.66410077
0
Return an object with all disease params associated with region.
def disease_params(self, disease=None, **kwargs) -> DiseaseParams: disease = get_disease(disease) return disease.params(region=self.region, **kwargs)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getInstancesD(region):\n instances = getInstances(region)\n instancesDicts = {\"id\": i.id,\n \"KEEP-tag\": getKeepTag(i),\n \"instance_type\": i.instance_type,\n \"state\": i.state,\n \"launch_time\": i.launch_time,\n ...
[ "0.6466593", "0.5933232", "0.5927578", "0.5650755", "0.5570527", "0.53803927", "0.5303424", "0.5287746", "0.52594393", "0.5248532", "0.5245481", "0.51979876", "0.5142148", "0.5135589", "0.5133899", "0.5121197", "0.51110876", "0.50974685", "0.50969887", "0.5096218", "0.5084624...
0.6674379
0
Init VendingMachine with the following data
def __init__(self): self.initSt = InitState(self) #The init state of vending machine self.acSt = AcceptCoinsState(self) #the state of accepting coins vending machine self.current = self.initSt #set current state as init state self.coins = {10: 0, 5: 0, 2: 0, 1: 0} #the coins the ven...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, machine, vm_name):\n self.machine = machine\n self.vm_name = vm_name", "def setup(self):\n self.machine = Machine(['a', 'b', 'c', '_'])", "def __init__(self, nodeid, sessionID):\r\n \r\n # iv = b\"1234567890123456\" is an aexample\r\n # \r\n s...
[ "0.64964634", "0.6405333", "0.60457885", "0.6045047", "0.60447496", "0.6022202", "0.5988322", "0.5986985", "0.59785813", "0.5976598", "0.5906512", "0.5897219", "0.5891987", "0.588027", "0.588027", "0.58712804", "0.58700997", "0.58614844", "0.5843164", "0.58296406", "0.5817777...
0.6518033
0
Insert coins during one transaction
def insertCoins(self, coin, num): if coin not in self.coins or not isinstance(num, int) or num < 1: return False, 'Coin out of range', {} try: return self.current.insertCoins(coin, num) except: logging.error("Insert coins %d, %d error"%(coin, num)) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_coins(user, amount, transaction=0):\n # below line of code creates table row for user if none exists\n UserCoins.objects.get_or_create(user=user)\n user_row = UserCoins.objects.get(user=user)\n old_coins_value = user_row.coins\n user_row.coins = old_coins_value + amount\n user_row.save()\...
[ "0.698471", "0.6537541", "0.6379954", "0.6226484", "0.62245494", "0.60380703", "0.60310745", "0.59967124", "0.5985816", "0.5949179", "0.592391", "0.58924115", "0.58773446", "0.5870351", "0.5863376", "0.58586454", "0.58495915", "0.58109194", "0.580317", "0.5770436", "0.5767409...
0.67508155
1
Return all subsribers for supplied team.
def subscribed(cls, team): return cls.query( cls.status == 'subscribe', cls.team == team.lower() ).fetch(100)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getAllTeams(self):\n return []", "def get_teams():", "def get_people(team):", "def get_all_teams(self):\n return self._db.Teams.find({})", "def teams(self):\n return self._get_by_class(Team)", "def get_teams(self):\n url = 'teams'\n result = self.get(url)\n r...
[ "0.63358724", "0.6321975", "0.6177048", "0.6088357", "0.604312", "0.5971021", "0.58856934", "0.588073", "0.587088", "0.5865922", "0.5714778", "0.57009053", "0.569305", "0.5687428", "0.5685705", "0.5673648", "0.56649804", "0.5646325", "0.56376255", "0.5625711", "0.55905354", ...
0.65085346
0
Get SubscriberUpdate models for supplied date and team.
def get_updates(cls, date, team): return cls.query( cls.date == date, cls.team == team.lower() ).order(-cls.name).fetch(100)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_updates(self, *args, **kwargs):\n\n updates_data = api.get_updates(\n *args,\n api_key=self.__creds.api_key_v2, \n **kwargs)\n return [en.Update(creds=self.__creds, **update_data) for update_data in updates_data]", "def subscribed(cls, team):\n return...
[ "0.5327516", "0.51273704", "0.5070071", "0.49457774", "0.49449366", "0.4896177", "0.4709884", "0.4666596", "0.4608635", "0.46072033", "0.45786855", "0.45358518", "0.45247075", "0.4524169", "0.44930673", "0.44742814", "0.4457868", "0.44363648", "0.44342363", "0.44187498", "0.4...
0.68186045
0
Returns the latest Update entity for a team.
def latest(cls, team): return cls.query( cls.team == team.lower() ).order(-cls.date).get()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_team(self):\n try:\n team_id = self.request.GET.get('team')\n if team_id is not None:\n team_id = int(team_id)\n return self.get_available_teams().get(pk=team_id)\n return self.get_available_teams().latest()\n except (Team.DoesNot...
[ "0.64540523", "0.6395068", "0.6357223", "0.6178414", "0.6149434", "0.584595", "0.58045524", "0.56917953", "0.55864483", "0.5518969", "0.55044276", "0.55032736", "0.5442801", "0.53913397", "0.5334119", "0.525284", "0.5211612", "0.52074313", "0.51889384", "0.5177728", "0.516420...
0.6974967
0
Convert internal type id to Redis string type
def type_id_to_redis_type(type_id): if type_id == REDIS_TYPE_ID_STRING: return 'string' elif type_id == REDIS_TYPE_ID_HASH: return 'hash' elif type_id == REDIS_TYPE_ID_LIST: return 'list' elif type_id == REDIS_TYPE_ID_SET: return 'set' elif type_id == REDIS_TYPE_ID_ZS...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def redis_type_to_id(key_type):\n if key_type == b'string' or key_type == 'string':\n return REDIS_TYPE_ID_STRING\n elif key_type == b'hash' or key_type == 'hash':\n return REDIS_TYPE_ID_HASH\n elif key_type == b'list' or key_type == 'list':\n return REDIS_TYPE_ID_LIST\n elif key_t...
[ "0.7281548", "0.6359385", "0.6330965", "0.6315196", "0.620949", "0.6206852", "0.6145703", "0.61406946", "0.61188096", "0.6073481", "0.60497135", "0.5980722", "0.59672964", "0.5944503", "0.5940098", "0.5937949", "0.5930817", "0.59159756", "0.5902758", "0.58981353", "0.5855464"...
0.77587336
0
Calculates last liquid forward rate (llfr) as described by EIOPA review 2020.
def compute_llfr(fwd, volume=np.array([3.3, 1.45 , 6, 0.3, 0.4]), va=0.0): weight = volume / volume.sum() fwds_incl_va = fwd.copy() fwds_incl_va[0] = fwds_incl_va[0] + va / 10000.0 llfr = fwds_incl_va * weight return np.array([llfr.sum()])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def rate_last(self):\n diff = (self.time - self.lasts[0][0]).total_seconds()\n try:\n return (self.pos - self.lasts[0][1]) / FAC / diff\n except ZeroDivisionError:\n return 0.0", "def dalf(x):\n # if pitch_start_time - ramp_constant_time <= x <= pitch_end_tim...
[ "0.65461475", "0.6008428", "0.5917937", "0.58921546", "0.58872676", "0.5785662", "0.5776639", "0.5763312", "0.57632715", "0.5741426", "0.5687872", "0.56605965", "0.5606835", "0.56042325", "0.56025577", "0.55816513", "0.5580824", "0.55693424", "0.5567322", "0.5562409", "0.5557...
0.64999485
1
Constructs zero curve from forwards until FPS potentially including VA.
def compute_curve_with_va(forwards_pre_fsp, liquid_maturities, fsp=20, va=0): # Number of liquid maturities smaller than or equal to fsp N = len(liquid_maturities[liquid_maturities <= fsp]) # Input check assert N == len(forwards_pre_fsp) # Add va to all forwards forwards_pre_fsp_incl_va = forw...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def p0(self):\n return self.lerp(0)", "def create_frame_curve(self):\n self.frame_curve = pm.curve(\n d=1,\n p=[(-0.5, 0.5, 0),\n (0.5, 0.5, 0),\n (0.5, -0.5, 0),\n (-0.5, -0.5, 0),\n (-0.5, 0.5, 0)],\n k=[0, 1...
[ "0.589822", "0.572195", "0.5697178", "0.55745435", "0.55424744", "0.55227065", "0.54740256", "0.53965265", "0.5392993", "0.5370394", "0.5370394", "0.53350204", "0.5327178", "0.53230256", "0.53219426", "0.53208303", "0.53037494", "0.52395266", "0.52135026", "0.5201853", "0.518...
0.59569997
0
Extrapolation of zero rates beyond fsp.
def extrapolate_zero(known_zero_rates, ufr, llfr, alpha=0.10, fsp=20): # FSP z_fsp = known_zero_rates[fsp - 1] # Extrapolated zero rates extrapolated_zero_rates = known_zero_rates[0:fsp] # Regardless of fsp we want to calculate the extrapolated rates with a maturity of up to 120y up_to = 120 -...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def alternative_extrapolation(input_rates, input_liquid, ufr, fsp=20, alpha=None, va=0.0, volume_traded=np.array([3.3, 1.45, 6, 0.3, 0.4])):\n\n # Assign base variables\n liquid_maturities = np.where(input_liquid == 1)[0] + 1\n liquid_rates_swap = input_rates[np.where(input_liquid == 1)]\n\n # Interpol...
[ "0.69276035", "0.5971338", "0.59490603", "0.58849704", "0.5847047", "0.5700037", "0.567109", "0.56408817", "0.5596573", "0.55785406", "0.5571876", "0.54841083", "0.54795015", "0.54718083", "0.5468277", "0.54417115", "0.5404876", "0.5370664", "0.53702486", "0.53702486", "0.533...
0.7663408
0
Displays a list of frames as a gif, with controls
def display_frames_as_gif(frames, video_name): Writer = animation.writers['ffmpeg'] writer = Writer(fps=15, metadata=dict(artist='Me'), bitrate=1800) #plt.figure(figsize=(frames[0].shape[1] / 72.0, frames[0].shape[0] / 72.0), dpi = 72) patch = plt.imshow(frames[0]) plt.axis('off') def animate(i...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def display_frames_as_gif(frames):\n fig=e.cube.show_layout(frames[0]) \n print(\"Drawn\")\n def animate(i):\n return e.cube.update_plot(frames[i])\n anim = animation.FuncAnimation(fig, animate, frames = len(frames), interval=50,blit=True)", "def save_gif(frames):\n print(\"Saving gif image...
[ "0.79926205", "0.712358", "0.70423585", "0.68678", "0.67844933", "0.67759246", "0.6595854", "0.6579575", "0.6552716", "0.6483145", "0.6471368", "0.63823175", "0.63685465", "0.63645715", "0.63480055", "0.6285726", "0.627497", "0.626504", "0.625118", "0.62405115", "0.6230932", ...
0.7612498
1
return a set of aligned vectors, all pointing in a random direction
def generate_aligned_vectors(npts, dim=3): vector = normalized_vectors(np.random.random(dim)) vectors = np.tile(vector, npts).reshape((npts, dim)) return vectors
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def random_direction_vector(return_angles=False):\n xi1 = np.random.rand()\n xi2 = np.random.rand()\n\n # theta = np.arccos(np.sqrt(1.0-xi1))\n theta = np.arccos(1.0 - (xi1 * 1))\n phi = xi2 * 2 * np.pi\n\n xs = np.sin(theta) * np.cos(phi)\n ys = np.sin(theta) * np.sin(phi)\n zs = np.cos(th...
[ "0.6540196", "0.62269187", "0.6188842", "0.60956556", "0.6033184", "0.6019711", "0.60028493", "0.5829907", "0.5784078", "0.5723453", "0.57149637", "0.5707661", "0.56773955", "0.5647822", "0.56467783", "0.5645228", "0.5593463", "0.55786777", "0.55786777", "0.5567715", "0.55242...
0.7055325
0
test to make sure the result is the same with and without threading for each weighting function
def test_threading(): npts = 100 random_coords = np.random.random((npts, 3)) random_vectors = np.random.random((npts, 3)) * 2.0 - 1.0 period = np.array([1.0, 1.0, 1.0]) rbins = np.linspace(0.0, 0.3, 5) weights1 = np.ones((npts, 4)) weights1[:, 1] = random_vectors[:, 0] weights1[:, 2] ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def calculate_weighted_results():\n pass", "def worker_train():\n py_work = np.zeros(model.layer1_size, dtype=np.float32)\n\n while True:\n job = jobs.get(block=True)\n if job is None: # data finished, exit\n jobs.task_done()\n ...
[ "0.6262015", "0.6210178", "0.60807836", "0.59742224", "0.59612995", "0.5931349", "0.5925256", "0.58842444", "0.58681244", "0.5854552", "0.5833443", "0.5815058", "0.5808932", "0.57820576", "0.57739794", "0.5763834", "0.57565004", "0.57565004", "0.57518077", "0.5739305", "0.573...
0.6526756
0