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
Function to return a new type that restricts an arbitrary base_type with a specified restriction. The restriction_type specified determines the type of restriction placed on the class, and the restriction_arg gives any input data that this function needs.
def RestrictedClassType(*args, **kwargs): base_type = kwargs.pop("base_type", str) restriction_type = kwargs.pop("restriction_type", None) restriction_arg = kwargs.pop("restriction_arg", None) class RestrictedClass(base_type): """ A class that restricts the base_type class with a new function that th...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def restricted_number_type(\n name: Optional[str],\n base_type: type,\n restrictions: Union[Tuple, List[Tuple]],\n join: str = \"and\",\n docstring: Optional[str] = None,\n) -> type:\n if base_type not in {int, float}:\n raise ValueError(\"Expected base_type to be one of {int, float}.\")\n...
[ "0.6024422", "0.53590095", "0.53425735", "0.47918358", "0.4685688", "0.46495104", "0.45904368", "0.45317844", "0.45162886", "0.4429482", "0.44250658", "0.44210738", "0.4403677", "0.44034255", "0.43212348", "0.42754954", "0.4268242", "0.42106864", "0.4206766", "0.42059267", "0...
0.72001845
0
Create a new class instance, and dynamically define the _restriction_test method so that it can be called by other functions.
def __new__(self, *args, **kwargs): def convert_regexp(pattern): if not pattern[0] == "^": pattern = "^%s" % pattern if not pattern[len(pattern)-1] == "$": pattern = "%s$" % pattern return pattern val = False try: val = args[0] except IndexErr...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def RestrictedClassType(*args, **kwargs):\n base_type = kwargs.pop(\"base_type\", str)\n restriction_type = kwargs.pop(\"restriction_type\", None)\n restriction_arg = kwargs.pop(\"restriction_arg\", None)\n\n class RestrictedClass(base_type):\n \"\"\"\n A class that restricts the base_type class with a...
[ "0.7097236", "0.625613", "0.6024101", "0.56311333", "0.5621058", "0.56185126", "0.558693", "0.5571075", "0.5570382", "0.5530888", "0.5495065", "0.5476797", "0.5373801", "0.5370807", "0.52724004", "0.52677774", "0.52677774", "0.52466184", "0.5224703", "0.5217568", "0.5217051",...
0.69244367
1
Run the _restriction_test static method against the argument v, returning an error if the value does not validate.
def __check(self, v): v = base_type(v) if not self._restriction_test(v): raise ValueError, "did not match restricted type" return True
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def validate(cls, v):\n return v", "def _primitive_validity_check(v, valid_v):\n\n if not Settings._is_in_prim(v, valid_v):\n raise InvalidSettingError()", "def __new__(self, *args, **kwargs):\n def convert_regexp(pattern):\n if not pattern[0] == \"^\":\n pattern = \"^%...
[ "0.5902719", "0.5884258", "0.55948395", "0.5335274", "0.5182264", "0.5136032", "0.5119184", "0.5079921", "0.507532", "0.5072013", "0.5036488", "0.5023162", "0.49981853", "0.49603727", "0.49413103", "0.49397123", "0.49352017", "0.49266654", "0.49232343", "0.49088746", "0.49078...
0.67351794
0
Returns the url string for the user update endpoint
def get_update_user_endpoint_url() -> str: return "/users/update"
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_update_url(self, resource_obj=None, **kwargs):\n\n full_url = getattr(resource_obj, 'full_url', None)\n if full_url:\n return full_url\n\n try:\n update_url = self._generate_url(\n url_type='update', resource_obj=resource_obj, **kwargs\n ...
[ "0.6709875", "0.64689994", "0.6239006", "0.61256826", "0.6097079", "0.58940446", "0.5838979", "0.58346057", "0.58342105", "0.5826097", "0.5773382", "0.5772508", "0.5739422", "0.5719169", "0.57053465", "0.56860745", "0.5676519", "0.56664866", "0.5633949", "0.5632793", "0.56319...
0.91229814
0
Generates an arbitrary valid JSON payload dict to be used in the update user call from a user object.
def get_valid_update_request(user_data: user_models.User) -> Dict[str, Any]: fake = Faker() user_id = user_data.get_id() payload_dict = { "identifier": { "user_id": user_id }, "first_name": fake.first_name(), "email": fake.email(), "password": fake.passwor...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_invalid_update_request(user_data: user_models.User) -> Dict[str, Any]:\n fake = Faker()\n invalid_name_field = lambda: fake.first_name() + str(randint(5, 10))\n user_id = user_data.get_id()\n payload_dict = {\n \"identifier\": {\n \"user_id\": user_id\n },\n \"fi...
[ "0.6675129", "0.6549304", "0.63601637", "0.6348303", "0.619043", "0.61247766", "0.6115525", "0.6105933", "0.60976416", "0.6061051", "0.6049667", "0.60383034", "0.59996754", "0.5974568", "0.59692496", "0.5949574", "0.5928177", "0.5908725", "0.59032553", "0.5898175", "0.5893919...
0.7036429
0
Generates an arbitrary invalid JSON payload dict to be used in the update user call from a user object. Current implementation is just to give an invalid first name, containing a numeric digit.
def get_invalid_update_request(user_data: user_models.User) -> Dict[str, Any]: fake = Faker() invalid_name_field = lambda: fake.first_name() + str(randint(5, 10)) user_id = user_data.get_id() payload_dict = { "identifier": { "user_id": user_id }, "first_name": invalid...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_create_account_failed_no_first_name(self):\n data = self.user_data.copy()\n data.pop('first_name')\n response = self.client.post(self.url, data, format='json')\n self.assertEqual(response.status_code, status.HTTP_400_BAD_REQUEST)\n self.assertEqual(response.data.get('mes...
[ "0.59625244", "0.58928806", "0.5877669", "0.5870688", "0.58412963", "0.58350444", "0.57733476", "0.5674835", "0.5664454", "0.5642326", "0.5640764", "0.55821985", "0.5562882", "0.5542463", "0.5519318", "0.55079794", "0.550572", "0.5502429", "0.5501983", "0.54404074", "0.543814...
0.70375663
0
Checks if response code to successful user update is valid
def check_response_valid_update(response: HTTPResponse) -> bool: return response.status_code == 200
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_user_is_really_updated():\n response = api_helper.get_user(user_id=pytest.test_user.id)\n check_user_data_in_response(response.json()[\"data\"][0])", "def update_me(request):\n user = request.user\n password_updated, body_updated = False, False\n if \"password\" in request.DATA and \"pass...
[ "0.6781071", "0.67414415", "0.6695622", "0.6594188", "0.6559789", "0.6547744", "0.6477996", "0.63962084", "0.6396053", "0.6341839", "0.6283969", "0.6247149", "0.6247149", "0.6199465", "0.6176627", "0.61594695", "0.6147732", "0.6139629", "0.6117408", "0.6114103", "0.6102543", ...
0.73599714
0
Checks if response code to user update with incorrect identifier is valid
def check_response_update_nonexistent(response: HTTPResponse) -> bool: # pylint: disable=invalid-name return response.status_code == 404
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check_response_valid_update(response: HTTPResponse) -> bool:\n return response.status_code == 200", "def test_update_not_matching_token(\n self, registered_user: user_models.User,\n valid_header_dict_with_user_id: Dict[str, Any]):\n update_json_payload = get_valid_update_reque...
[ "0.66438895", "0.6321257", "0.6250804", "0.60142976", "0.5984877", "0.5970794", "0.5948435", "0.5937152", "0.58962876", "0.5866562", "0.58310735", "0.58276373", "0.5822027", "0.5799565", "0.5788972", "0.5768229", "0.57632864", "0.5742505", "0.57355565", "0.5727438", "0.570342...
0.6349449
1
Checks fields in Mongo are the same as they are in the provided user data.
def check_fields_not_updated(old_user_data: user_models.User) -> bool: new_user_data = get_user_data_from_user_model(old_user_data) old_user_data_dict = old_user_data.dict() try: for key, val in new_user_data.dict().items(): if key == "password": assert new_user_data.che...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check_fields_updated_correctly(old_user_data: user_models.User,\n updated_data_json: Dict[str, Any]) -> bool:\n\n updated_user_object = get_user_data_from_user_model(old_user_data)\n updated_user_data_dict = updated_user_object.dict()\n\n # basically just getting inte...
[ "0.66093063", "0.6154693", "0.60461205", "0.58244336", "0.5774508", "0.56641674", "0.5622465", "0.5617949", "0.55911267", "0.55890495", "0.55717343", "0.557042", "0.55488867", "0.55384135", "0.55028355", "0.5502394", "0.5494568", "0.5475018", "0.5466237", "0.5464523", "0.5430...
0.67279035
0
Attemps to hit the update user endpoint with the given JSON payload and headers, returning the HTTP response.
def get_response_from_json(update_json_payload: Dict[str, Any], headers_dict: Dict[str, Any]) -> HTTPResponse: endpoint_url = get_update_user_endpoint_url() return client.patch(endpoint_url, json=update_json_payload, headers=headers_dict...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_update_user_endpoint(self, **kwargs):\n print(\"Create a new user\")\n kwargs['return_response_obj'] = True\n response = self.test_create_user_endpoint(**kwargs)\n response = json.loads(response.text)\n\n print(\"Capture Authorization token\")\n token_type = respo...
[ "0.72363925", "0.7197354", "0.7001907", "0.6802706", "0.6792675", "0.6781311", "0.6686426", "0.6615749", "0.6561681", "0.6560122", "0.6547885", "0.65405744", "0.6533139", "0.6493948", "0.6475396", "0.6454404", "0.6448284", "0.6443259", "0.64368844", "0.64324725", "0.6382394",...
0.7222286
1
Tries to pass an empty dict as a json payload to the update endpoint
def test_update_no_data(self, valid_header_dict_with_user_id: Dict[str, Any]): headers = valid_header_dict_with_user_id update_json_payload = get_update_request_no_data() response = get_response_from_json(update_json_payload,...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_update_request_no_data() -> Dict[str, Any]:\n payload_dict = {}\n return payload_dict", "def test_put_no_data(self):\n test_data = {}\n response = self.client.put(self.url, json.dumps(test_data), content_type='application/json')\n self.assertEquals(response.status_code, 400)", ...
[ "0.6747082", "0.67125654", "0.64232665", "0.64232665", "0.63312745", "0.62824017", "0.6187096", "0.61769515", "0.61601835", "0.61174303", "0.6111117", "0.6104211", "0.61029077", "0.61028314", "0.6082278", "0.60773987", "0.60255027", "0.5997935", "0.596207", "0.5958423", "0.58...
0.7013621
0
Notify Plasma that the object is no longer needed. If the plasma client has been shut down, then don't do anything.
def __del__(self): if self.plasma_client.alive: libplasma.release(self.plasma_client.conn, self.plasma_id)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def shutdown(self):\n if self.alive:\n libplasma.disconnect(self.conn)\n self.alive = False", "def __del__(self):\n self.shutdown()", "async def async_will_remove_from_hass(self) -> None:\n self._nobo.deregister_callback(self._after_update)", "def __del__(self):\n\n if self._n...
[ "0.68052214", "0.6546257", "0.6526926", "0.6475679", "0.6408518", "0.63702166", "0.6364244", "0.62641704", "0.6234087", "0.61589026", "0.61589026", "0.61589026", "0.61589026", "0.61358505", "0.6098174", "0.6074358", "0.60552096", "0.6011705", "0.60114527", "0.6008807", "0.600...
0.7492761
0
Create a new buffer in the PlasmaStore for a particular object ID. The returned buffer is mutable until seal is called.
def create(self, object_id, size, metadata=None): # Turn the metadata into the right type. metadata = bytearray("") if metadata is None else metadata buff = libplasma.create(self.conn, object_id, size, metadata) return PlasmaBuffer(buff, object_id, self)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get(self, object_id):\n buff = libplasma.get(self.conn, object_id)[0]\n return PlasmaBuffer(buff, object_id, self)", "def get_metadata(self, object_id):\n buff = libplasma.get(self.conn, object_id)[1]\n return PlasmaBuffer(buff, object_id, self)", "def _tobuffer(self, object_):\n\n raise...
[ "0.77476305", "0.6702498", "0.60528696", "0.58479404", "0.57574", "0.5743441", "0.56913185", "0.56751525", "0.5439388", "0.54353285", "0.53733134", "0.5331875", "0.52799934", "0.5251258", "0.5250606", "0.5245713", "0.5200108", "0.51914716", "0.51869136", "0.51736677", "0.5163...
0.71329486
1
Create a buffer from the PlasmaStore based on object ID. If the object has not been sealed yet, this call will block. The retrieved buffer is immutable.
def get(self, object_id): buff = libplasma.get(self.conn, object_id)[0] return PlasmaBuffer(buff, object_id, self)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_metadata(self, object_id):\n buff = libplasma.get(self.conn, object_id)[1]\n return PlasmaBuffer(buff, object_id, self)", "def create(self, object_id, size, metadata=None):\n # Turn the metadata into the right type.\n metadata = bytearray(\"\") if metadata is None else metadata\n buff = li...
[ "0.6503447", "0.6305131", "0.58890766", "0.53533816", "0.51942104", "0.5188706", "0.5172285", "0.5116445", "0.5087525", "0.5076191", "0.49777576", "0.49773085", "0.49221343", "0.48908314", "0.48501423", "0.48457444", "0.4834366", "0.48286772", "0.4822596", "0.4815697", "0.480...
0.7658481
0
Create a buffer from the PlasmaStore based on object ID. If the object has not been sealed yet, this call will block until the object has been sealed. The retrieved buffer is immutable.
def get_metadata(self, object_id): buff = libplasma.get(self.conn, object_id)[1] return PlasmaBuffer(buff, object_id, self)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get(self, object_id):\n buff = libplasma.get(self.conn, object_id)[0]\n return PlasmaBuffer(buff, object_id, self)", "def create(self, object_id, size, metadata=None):\n # Turn the metadata into the right type.\n metadata = bytearray(\"\") if metadata is None else metadata\n buff = libplasma.c...
[ "0.77416337", "0.6220168", "0.57248855", "0.52815425", "0.52257663", "0.5214614", "0.50291073", "0.49901348", "0.4975241", "0.4969005", "0.4929452", "0.48467326", "0.48226666", "0.48114675", "0.47733587", "0.47696808", "0.4765524", "0.4749654", "0.4745362", "0.47240782", "0.4...
0.6515208
1
Seal the buffer in the PlasmaStore for a particular object ID. Once a buffer has been sealed, the buffer is immutable and can only be accessed through get.
def seal(self, object_id): libplasma.seal(self.conn, object_id)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get(self, object_id):\n buff = libplasma.get(self.conn, object_id)[0]\n return PlasmaBuffer(buff, object_id, self)", "def put(self, obj):\r\n self.staging_buffer.append(obj)\r\n\r\n if self.is_full():\r\n self._flush()", "def free(self, valueid):\n raise NotImplemented...
[ "0.5695429", "0.5202494", "0.5165136", "0.4879925", "0.47917986", "0.47839105", "0.47807124", "0.47087276", "0.47056207", "0.47028056", "0.4646684", "0.46253073", "0.46223173", "0.45638123", "0.4562836", "0.45613143", "0.45498225", "0.4548591", "0.4539347", "0.4528612", "0.44...
0.68422395
0
Delete the buffer in the PlasmaStore for a particular object ID. Once a buffer has been deleted, the buffer is no longer accessible.
def delete(self, object_id): libplasma.delete(self.conn, object_id)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def processDeleteCommand(self, objId):\n editor = self._parent\n obj = editor.findWithUUID(objId)\n if obj:\n print(\"DELETE FOR\",objId)\n # delete from object cache\n if objId in editor._total['objects']:\n del editor._total['objects'][objId]\n...
[ "0.6569875", "0.621701", "0.6163054", "0.6160058", "0.61005646", "0.6098723", "0.60965097", "0.6064773", "0.60396796", "0.6030647", "0.60171854", "0.59428", "0.59391", "0.59361833", "0.5934523", "0.59239215", "0.5897703", "0.58642346", "0.5861386", "0.58479035", "0.58277524",...
0.7522354
0
Evict some objects until to recover some bytes. Recover at least num_bytes bytes if possible.
def evict(self, num_bytes): return libplasma.evict(self.conn, num_bytes)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _evict_bytes(self, bytes, xtime):\n if self.stats.first_eviction_ts == 0:\n self.stats.first_eviction_ts = xtime\n\n size_before = self._max_size - self._used_size\n if bytes > self._max_size:\n raise Exception(\"Cache too small.\")\n\n # if verbose:\n ...
[ "0.6777961", "0.5555218", "0.55190814", "0.52060676", "0.5180509", "0.51343864", "0.50560045", "0.5030924", "0.50300676", "0.5005674", "0.49927643", "0.49924573", "0.49632165", "0.49323976", "0.49104935", "0.49098307", "0.4906209", "0.4851108", "0.48496678", "0.48352075", "0....
0.70211434
0
Transfer local object with id object_id to another plasma instance
def transfer(self, addr, port, object_id): return libplasma.transfer(self.conn, object_id, addr, port)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _sync_gripped_object(self, gripped_object_id):\n if gripped_object_id != -1:\n agent_body_transformation = (\n self._default_agent.scene_node.transformation\n )\n self.set_transformation(\n agent_body_transformation, gripped_object_id\n ...
[ "0.6050167", "0.57410544", "0.5735611", "0.57322747", "0.57188344", "0.5682565", "0.5651926", "0.5615001", "0.5610952", "0.55718994", "0.55663973", "0.5551615", "0.54962844", "0.54812276", "0.5476882", "0.546432", "0.54317933", "0.54213667", "0.5414399", "0.5403259", "0.53842...
0.67952234
0
Wait until num_returns objects in object_ids are ready.
def wait(self, object_ids, timeout=PLASMA_WAIT_TIMEOUT, num_returns=1): ready_ids, waiting_ids = libplasma.wait(self.conn, object_ids, timeout, num_returns) return ready_ids, list(waiting_ids)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def aws_waits ( func, matching_ids ) :\n done = False\n found_ids = []\n while not done :\n found_ids = []\n time.sleep( 1 )\n items = func( )\n for item in items :\n for matching_id in matching_ids :\n if item.id == matching_id :\n found_ids.append( item ...
[ "0.6152261", "0.60710573", "0.59690076", "0.5964435", "0.5964435", "0.5964435", "0.5964435", "0.57575727", "0.5668024", "0.56380326", "0.55965173", "0.5532056", "0.5494682", "0.54886234", "0.54127556", "0.5372697", "0.5328478", "0.5328478", "0.53064275", "0.5302953", "0.52875...
0.76417315
0
Get the next notification from the notification socket.
def get_next_notification(self): if not self.notification_sock: raise Exception("To get notifications, first call subscribe.") # Loop until we've read PLASMA_ID_SIZE bytes from the socket. while True: try: message_data = self.notification_sock.recv(PLASMA_ID_SIZE) except socket.err...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_next_message(self):\n newest_available_offset = self.broker.get_last_offset(self.topic_name)\n if self.offset <= newest_available_offset:\n msg = self.broker.read_message(self.topic_name, self.offset)\n self.offset += 1\n return msg", "def get_notification()...
[ "0.6486376", "0.64776915", "0.6391278", "0.6236521", "0.5980818", "0.5890172", "0.5890172", "0.57808685", "0.576193", "0.56820375", "0.5657384", "0.5584447", "0.552648", "0.55182636", "0.5498541", "0.54886836", "0.54489094", "0.54474187", "0.5442187", "0.5416377", "0.54159766...
0.814166
0
Start a plasma store process.
def start_plasma_store(plasma_store_memory=DEFAULT_PLASMA_STORE_MEMORY, use_valgrind=False, use_profiler=False): if use_valgrind and use_profiler: raise Exception("Cannot use valgrind and profiler at the same time.") plasma_store_executable = os.path.join(os.path.abspath(os.path.dirname(__file__)), "../../build...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def start():\n\tglobal StoreWorkerThread\n\n\tStoreWorkerThreadLock.acquire()\n\t# sanity - make sure thread is not already running\n\tif StoreWorkerThread is not None:\n\t\tStoreWorkerThreadLock.release()\n\t\traise WikStoreQError(\"start() called while StoreWorkerThread active!\")\n\t\t\n\t# start thread\n\tStor...
[ "0.6675533", "0.62068164", "0.5813502", "0.5808442", "0.56716734", "0.5591773", "0.55453074", "0.5540595", "0.55319667", "0.5515658", "0.5511767", "0.55116504", "0.5462975", "0.5456893", "0.544534", "0.54307854", "0.54214805", "0.54126364", "0.5395961", "0.5367203", "0.535113...
0.73803645
0
Start a plasma manager and return the ports it listens on.
def start_plasma_manager(store_name, redis_address, num_retries=20, use_valgrind=False, run_profiler=False): plasma_manager_executable = os.path.join(os.path.abspath(os.path.dirname(__file__)), "../../build/plasma_manager") plasma_manager_name = "/tmp/scheduler{}".format(random_name()) port = None process = Non...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _run(started: Event, manager_host: str, manager_port_nr: int, dashboard_port_nr: Value,\n port_range: Sequence) -> None:\n ignore_keyboard_interrupt() # For Windows compatibility\n\n # Set dashboard connection details. This is needed when spawn is the default start method\n DASHBOARD_MANAGER_...
[ "0.6082334", "0.57976353", "0.57971656", "0.5788138", "0.5759191", "0.5716696", "0.56202954", "0.5606878", "0.5602397", "0.5589833", "0.55613226", "0.5517132", "0.5513785", "0.5472982", "0.5466905", "0.54476595", "0.5428083", "0.5391752", "0.53760594", "0.5375185", "0.5369179...
0.59724724
1
Handle a key typed to this window. Return True if we should keep processing, False if a line has been completed.
def handle_keypress(self,key): if len(key) == 0: return True # Whenever we start typing scroll to the bottom self.scroll_bottom() if self.cursor_visible: if ord(key) == BACKSPACE_KEY: # If backspace and we aren't at start point of buffer, remove...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def onKey(self,event):\n \n ch = event.char.lower()\n \n if ch in (self.text[0].lower(),'\\n','\\r'):\n self.okButton()\n \n return \"break\"", "def onKey(self,event):\n \n ch = event.char.lower()\n \n if ch in ('y','\\n','\\r'):\n self.yesB...
[ "0.7115729", "0.6809439", "0.66434693", "0.6608577", "0.65963215", "0.64782727", "0.6452681", "0.6452375", "0.6433911", "0.6409299", "0.631737", "0.6270623", "0.62660366", "0.6263996", "0.624065", "0.6240579", "0.62144566", "0.61661255", "0.6141081", "0.61301804", "0.6129784"...
0.75325006
0
Flush the text buffer and display it as a series of lines, wrapping where necessary
def flush(self): lines = [] # Append new buffer to last stored line total_buffer = self.lines[-1] + self.buffer width = self.size[COLS] for block in total_buffer.split('\n'): # If the line fits, just add it as is. Otherwise use the textwrap # to...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def display_text(self, text):\n self.update_screen_size()\n self.stdscr.erase()\n for line in text:\n self.stdscr.addstr(f'{PADCHAR}{line}\\n')\n self.stdscr.addstr(PADCHAR)\n self.get_key()", "def lf(self):\n self._write('\\n')", "def _Flush(self):\n sel...
[ "0.6514367", "0.6432542", "0.64169335", "0.6389616", "0.6366774", "0.62807876", "0.626763", "0.62496686", "0.6229831", "0.6022275", "0.6004233", "0.59877497", "0.59794885", "0.5956973", "0.5935539", "0.58815885", "0.58643866", "0.58634055", "0.5859508", "0.5848896", "0.584551...
0.7252636
0
Join the desired Union, first check that the Player does not belong to the desired Union.
def join_union(self, union): if not union.has_member(self): self.union = union if self.on_island is None: self.on_island = union.get_island() self.save() return f'{self.username} has joined {union.name}' else: return f'{self.use...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def leave_union(self):\n if self.union is None:\n return f'{self.username} is not a member of any guild'\n\n if self.union.has_member(self):\n union_name = self.union.name\n self.union = None\n self.save()\n return f'{self.username} has been remo...
[ "0.598452", "0.59662247", "0.58988845", "0.53750443", "0.5343551", "0.5301414", "0.52667767", "0.5230775", "0.5230775", "0.52142656", "0.52015984", "0.5178534", "0.5142843", "0.51291096", "0.5126424", "0.5118859", "0.5085016", "0.5070022", "0.50607526", "0.5053124", "0.502678...
0.7189589
0
Leave the current Union, check if the Player does not have a Union. Otherwise remove them from their current Union.
def leave_union(self): if self.union is None: return f'{self.username} is not a member of any guild' if self.union.has_member(self): union_name = self.union.name self.union = None self.save() return f'{self.username} has been removed from {uni...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def endBattle(self):\n self.map.removeDead()\n self.cancelAttackMode()\n self.deselectUnit()", "def on_leave(self, event):\n self.pre_check(event)\n self.remove_player(event.guild.id)", "def remove(self, user):\n if user != self.head:\n user.group = None\n ...
[ "0.5488708", "0.5461777", "0.5391868", "0.5283922", "0.5251051", "0.5212644", "0.52103233", "0.518837", "0.5162466", "0.5134018", "0.512331", "0.51217455", "0.5103756", "0.50786215", "0.506947", "0.5060232", "0.50336504", "0.5014969", "0.49944872", "0.4978759", "0.49745914", ...
0.7603778
0
Return the constrained line pixel locations for the line going from point_a to point_b in the image.
def line_a_b(img_rows: int, img_cols: int, point_a: Point2D, point_b: Point2D): rr, cc = draw.line(point_a.row, point_a.col, point_b.row, point_b.col) rr_s, rr_e = constrain_interval(rr, img_rows) cc_s, cc_e = constrain_interval(cc, img_cols) start = max(rr_s, cc_s) end = min(rr_e, cc_e) if end ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def make_points(self,image,line):\n print(\"This is line inside make_points: \",line)\n try:\n slope, intercept = line\n y1 = int(image.shape[0]) # bottom of the image\n y2 = int(y1*3/5) # slightly lower than the middle\n x1 = int((y1 - intercept)/slope)\n ...
[ "0.6736225", "0.66644704", "0.66504264", "0.66406703", "0.66060376", "0.6597873", "0.65915024", "0.65700376", "0.6538613", "0.64553785", "0.6418768", "0.6381955", "0.63758624", "0.6324086", "0.6310463", "0.6290331", "0.62805045", "0.6275424", "0.62705195", "0.6268071", "0.625...
0.80817574
0
Add the value of the kernel (of arbitrary size, on the location 'center'), to an array if the value in the array is not larger than the value in the kernel.
def add_kernel(org: np.ndarray, kernel: np.ndarray, center): # place filter at the array, and exclude any locations that are out of bounds c_r, c_c = center.row, center.column k_r, k_c = kernel.shape row_start = max(0, k_r/2 - c_r) pass
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def center(emg_data: np.ndarray, center_value: float = None) -> np.ndarray:\n center_value = center_value if center_value else emg_data.mean(axis=1)\n emg_centered = np.copy(emg_data)\n for i in range(emg_data.shape[0]):\n emg_centered[i, :] = emg_data[i, :] - center_value[i]\n ...
[ "0.60985863", "0.5597028", "0.5423487", "0.5346183", "0.5306569", "0.52676445", "0.5180956", "0.51263344", "0.50966823", "0.5067242", "0.5044662", "0.50417227", "0.49624735", "0.49557123", "0.4937947", "0.4922249", "0.492087", "0.49062863", "0.4842545", "0.47923386", "0.47857...
0.68929315
0
Verify that given path complies to given directory structure.
def verify_dir_structure(path: str, dir_structure: dict): for item, subitem in dir_structure.items(): if isinstance(subitem, str) and subitem == 'file': filename = os.path.join(path, item) if not os.path.isfile(filename): if os.path.exists(filename): ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_verify_path_3(self):\n result = basic.verify_path(str(self.test_directory1), \"dir\")\n self.assertTrue(result)", "def is_dir(self, path: PathLike):", "def test_verify_path_7(self):\n result = basic.verify_path(str(self.test_directory1), \"invalid\")\n self.assertFalse(resu...
[ "0.7324167", "0.7093916", "0.70526135", "0.70069176", "0.69678", "0.6888932", "0.6854033", "0.68493205", "0.6618974", "0.65691286", "0.6564741", "0.65613097", "0.6483537", "0.64606017", "0.64432484", "0.6398071", "0.6395172", "0.6350039", "0.6349698", "0.6339944", "0.6322197"...
0.727781
1
Check if multilevel dict has specific keys
def keys_exists(multi_dict: dict, keys: List[str]) -> bool: _multi_dict = multi_dict for key in keys: try: _multi_dict = _multi_dict[key] except KeyError: return False return True
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def dict_contains(subdict, maindict):\n try:\n for k, v in subdict.items():\n mainv = maindict[k]\n if isinstance(mainv, dict) and isinstance(v, dict):\n if not dict_contains(v, mainv):\n return False\n elif isinstance(mainv, (set, frozen...
[ "0.6786988", "0.6767787", "0.6767341", "0.6550434", "0.65249425", "0.64884263", "0.6487956", "0.64798486", "0.64611477", "0.639836", "0.6351787", "0.6351403", "0.63294774", "0.6314295", "0.63043785", "0.62910247", "0.6267682", "0.62589467", "0.62172693", "0.6214779", "0.62008...
0.7035294
0
Check that the setting filename is defined in DIR_STRUCTURE and if so return a proper os path to the setting file.
def get_setting_filename(repo_root: str, path: List[str]) -> str: if not path or not isinstance(path, list): raise ValueError("Empty path list received") if path[0] == 'devices': if not len(path) >= 3: raise ValueError("Invalid directory structure for devices settings") if no...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _build_config_file_path(cls, filename):\n if os.path.exists(filename):\n return filename\n res = os.path.join(os.path.dirname(__file__), '..', 'config', filename)\n if not os.path.exists(res):\n raise ValueError(\"requested config file %s does not exist!\" % filename)...
[ "0.6540362", "0.6478124", "0.63190323", "0.62830323", "0.61954856", "0.61590254", "0.6155592", "0.611603", "0.6054547", "0.6002346", "0.6000714", "0.599604", "0.5978309", "0.59625304", "0.594584", "0.59440786", "0.59433365", "0.5942814", "0.59398437", "0.59205306", "0.5901109...
0.68832284
0
Verify settings syntax and return a somewhat helpful error message.
def check_settings_syntax(settings_dict: dict, settings_metadata_dict: dict): try: f_root(**settings_dict) except ValidationError as e: msg = '' for error in e.errors(): loc = error['loc'] error_msg = "Validation error for setting {}, bad value: {} (value origin: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def validate_settings(_cfg, _ctx):\n pass", "def validate_settings(self, settings):\n pass", "def validate(settings):\n if not settings.filename.endswith(\".xml\"):\n print_error(\"{} must have a .xml extension to interoperate with build tool\".format(settings.filename))\n exit(1)\n \n failed ...
[ "0.7083691", "0.68610555", "0.6496521", "0.64925987", "0.64568233", "0.6367426", "0.62605274", "0.6129932", "0.6071314", "0.6014091", "0.590492", "0.5882848", "0.57535195", "0.5752029", "0.57339543", "0.5724753", "0.57075673", "0.5703936", "0.56941897", "0.56231225", "0.56083...
0.7244058
0
Function which creates pit node entries.
def create_pit_node_entries(cls, net, node_pit): loads = net[cls.table_name()] helper = loads.in_service.values * loads.scaling.values * cls.sign() mf = np.nan_to_num(loads.mdot_kg_per_s.values) mass_flow_loads = mf * helper juncts, loads_sum = _sum_by_group(get_net_option(net, "...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_nodes(self):", "def create_nodes(self):\n # Create a special dictionary that will raise an error if a key is\n # updated. This avoids the\n nodes = NodeDict()\n\n return create_solph_nodes_from_data(self.input_data, nodes)", "def make_nodes(n):\n return [\n pro...
[ "0.6270441", "0.587929", "0.5798455", "0.5656794", "0.56211495", "0.5441831", "0.5441275", "0.5409739", "0.53748167", "0.5372623", "0.5366772", "0.53410715", "0.53172463", "0.5297975", "0.5237814", "0.52122957", "0.51953965", "0.5184152", "0.5170241", "0.51697445", "0.5165059...
0.6786637
0
Compare subsequences with the same radius and return the most central motif
def naive_get_central_motif(Ts, bsf_radius, bsf_Ts_idx, bsf_subseq_idx, m): bsf_nns_radii, bsf_nns_subseq_idx = naive_across_series_nearest_neighbors( Ts, bsf_Ts_idx, bsf_subseq_idx, m ) bsf_nns_mean_radii = bsf_nns_radii.mean() candidate_nns_Ts_idx = np.flatnonzero(np.isclose(bsf_nns_radii, bs...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def minimum_spanning_arborescence(sol):", "def find_max(centroids):\n \n max_sim = 0.0\n max_i = 0\n max_j = 0\n length = len(centroids)\n\n for i in xrange(0, length):\n for j in xrange(i + 1, length):\n curr_sim = similarity(centroids[i], centroids[j])\n if curr_s...
[ "0.64105767", "0.5744796", "0.5742791", "0.5722771", "0.56037724", "0.56015223", "0.55332977", "0.5533182", "0.5509555", "0.5498331", "0.54112136", "0.538381", "0.53743863", "0.53348666", "0.53173995", "0.5311495", "0.5294465", "0.52626127", "0.52596575", "0.52278507", "0.521...
0.5942215
1
This function tests to see if the S3 functionality of a DataSink works properly
def test_datasink_to_s3(dummy_input, tmpdir): # Init variables ds = nio.DataSink() bucket_name = "test" container = "outputs" attr_folder = "text_file" output_dir = "s3://" + bucket_name # Local temporary filepaths for testing fakes3_dir = tmpdir.strpath input_path = dummy_input ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_firehose_destination_to_s3(sdc_builder, sdc_executor, aws):\n s3_client = aws.s3\n firehose_client = aws.firehose\n\n # setup test static\n s3_bucket = aws.s3_bucket_name\n stream_name = aws.firehose_stream_name\n # json formatted string\n random_raw_str = '{{\"text\":\"{0}\"}}'.forma...
[ "0.6764328", "0.6758939", "0.65220535", "0.6487122", "0.64633214", "0.6395766", "0.6380464", "0.63670933", "0.63086534", "0.62746465", "0.6221178", "0.61893016", "0.61767495", "0.61643225", "0.61304784", "0.61087626", "0.6107698", "0.6086854", "0.6086046", "0.6055028", "0.604...
0.70630765
0
Function to ensure the DataSink can successfully read in AWS credentials from the environment variables
def test_aws_keys_from_env(): # Init variables ds = nio.DataSink() aws_access_key_id = "ABCDACCESS" aws_secret_access_key = "DEFGSECRET" # Set env vars os.environ["AWS_ACCESS_KEY_ID"] = aws_access_key_id os.environ["AWS_SECRET_ACCESS_KEY"] = aws_secret_access_key # Call function to re...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def aws_credentials():\n os.environ['AWS_ACCESS_KEY_ID'] = 'testing'\n os.environ['AWS_SECRET_ACCESS_KEY'] = 'testing'\n os.environ['AWS_SECURITY_TOKEN'] = 'testing'\n os.environ['REGION'] = 'region'", "def aws_credentials() -> None:\n os.environ[\"AWS_ACCESS_KEY_ID\"] = \"testing\"\n os.enviro...
[ "0.68709105", "0.6851469", "0.6814614", "0.6814614", "0.6814614", "0.6785344", "0.6777521", "0.6777521", "0.676909", "0.67652583", "0.6516248", "0.6426473", "0.64142287", "0.6209894", "0.61742395", "0.6133707", "0.60836333", "0.60743165", "0.6038891", "0.59064233", "0.5853351...
0.74702543
0
Function to validate DataSink will make local copy via local_copy attribute
def test_datasink_localcopy(dummy_input, tmpdir): # Init variables local_dir = tmpdir.strpath container = "outputs" attr_folder = "text_file" # Make dummy input file and datasink input_path = dummy_input ds = nio.DataSink() # Set up datasink ds.inputs.container = container ds...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def testCheckSourceCopyOperation_Pass(self):\n payload_checker = checker.PayloadChecker(self.MockPayload())\n self.assertIsNone(\n payload_checker._CheckSourceCopyOperation(None, 134, 134, 'foo'))", "def testCheckSourceCopyOperation_FailContainsData(self):\n payload_checker = checker.PayloadCheck...
[ "0.59691125", "0.59049934", "0.585712", "0.58438843", "0.58119", "0.5792207", "0.5792207", "0.57052356", "0.56422436", "0.561539", "0.557363", "0.55482936", "0.55175114", "0.54542834", "0.53786236", "0.53389156", "0.5317684", "0.529742", "0.52786595", "0.52768356", "0.5235773...
0.6546438
0
Generate temporary analyze file pair.
def _temp_analyze_files(tmpdir): img_dir = tmpdir.mkdir("img") orig_img = img_dir.join("orig.img") orig_hdr = img_dir.join("orig.hdr") orig_img.open("w") orig_hdr.open("w") return orig_img.strpath, orig_hdr.strpath
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _create_temp_files():\n\n fakes = {}\n for i in [\"domain\", \"problem\"]:\n q, fname = tempfile.mkstemp()\n os.close(q)\n fakes[i] = fname\n return fakes", "def found_template(hhblits_result, tmp_file, type):\n # output_file de hhblits: ident_blits.fas\n\n # type 1 : alig...
[ "0.60648304", "0.5552658", "0.5520703", "0.5503555", "0.54874307", "0.54582286", "0.54557335", "0.54538184", "0.5419802", "0.54138374", "0.54013675", "0.5297186", "0.5296834", "0.52736837", "0.52721477", "0.5268268", "0.5258737", "0.5241967", "0.5237958", "0.52143216", "0.520...
0.5891697
1
Test SSHDataGrabber by connecting to localhost and collecting some data.
def test_SSHDataGrabber(tmpdir): old_cwd = tmpdir.chdir() source_dir = tmpdir.mkdir("source") source_hdr = source_dir.join("somedata.hdr") source_dat = source_dir.join("somedata.img") source_hdr.ensure() # create source_dat.ensure() # create # ssh client that connects to localhost, curre...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_scp_callback_return_dataset(self):\n self.scp = DummyVerificationSCP()\n self.scp.status = Dataset()\n self.scp.status.Status = 0x0001\n self.scp.start()\n\n ae = AE()\n ae.add_requested_context(VerificationSOPClass)\n assoc = ae.associate('localhost', 1111...
[ "0.6228421", "0.5979999", "0.5896983", "0.5863515", "0.5666997", "0.56649584", "0.5635521", "0.5626732", "0.5554057", "0.554876", "0.545885", "0.5451229", "0.5444723", "0.5393212", "0.53887343", "0.53826755", "0.53627384", "0.5360374", "0.53567916", "0.5338022", "0.5327786", ...
0.62173295
1
Tests that partition_spline_curve() and its derivative are continuous.
def testSplineCurveIsC1Smooth(self): x1 = jnp.linspace(0., 8., 10000) x2 = x1 + 1e-7 fn = self.variant(distribution.partition_spline_curve) y1 = fn(x1) y2 = fn(x2) grad = jax.grad(lambda z: jnp.sum(fn(z))) dy1 = grad(x1) dy2 = grad(x2) chex.assert_tree_all_close(y1, y2, atol=1e-5, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def testSplineCurveInverseIsCorrect(self):\n x_knot = jnp.arange(0, 16, 0.01)\n alpha = self.variant(distribution.inv_partition_spline_curve)(x_knot)\n x_recon = self.variant(distribution.partition_spline_curve)(alpha)\n chex.assert_tree_all_close(x_recon, x_knot, atol=1e-5, rtol=1e-5)", "def test_cy...
[ "0.7317777", "0.6733385", "0.63416564", "0.63303196", "0.62999004", "0.6266962", "0.6237215", "0.61622876", "0.6028671", "0.60201615", "0.6004575", "0.5942684", "0.59373736", "0.58780545", "0.5859937", "0.58470184", "0.58438915", "0.5815349", "0.57958245", "0.5786006", "0.578...
0.7459131
0
Tests that the partition function is accurate at infinity.
def testLogPartitionInfinityIsAccurate(self): alpha = float('inf') log_z_true = 0.70526025442 # From mathematica. log_z = self.variant(self._distribution.log_base_partition_function)(alpha) chex.assert_tree_all_close(log_z, log_z_true, atol=1e-7, rtol=1e-7)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_finite(self):\n \n Number_of_tests = 1000\n low = -1000\n high = 1000\n for i in range(Number_of_tests):\n x = np.random.rand(100) * (high - low) + low\n y = aux_functions.softmax_base(x)\n\n # This should be True if all are finite\n ...
[ "0.5967574", "0.590187", "0.5899622", "0.58062977", "0.575762", "0.57557195", "0.5693965", "0.5657227", "0.5617837", "0.55962574", "0.5585398", "0.55100226", "0.5506287", "0.5502466", "0.5495632", "0.5426349", "0.5426007", "0.5425509", "0.54223937", "0.539905", "0.539507", ...
0.7257098
0
Tests that the inverse curve is indeed the inverse of the curve.
def testSplineCurveInverseIsCorrect(self): x_knot = jnp.arange(0, 16, 0.01) alpha = self.variant(distribution.inv_partition_spline_curve)(x_knot) x_recon = self.variant(distribution.partition_spline_curve)(alpha) chex.assert_tree_all_close(x_recon, x_knot, atol=1e-5, rtol=1e-5)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_inverse_c(self):\n for q in self.all:\n self.assertTrue((q * q.inverse()).almost_equal(q.inverse()*q))", "def test_inverse_b(self):\n for q in self.all:\n self.assertTrue(\n (q*q.inverse()).almost_equal(Quaternion(1, 0, 0, 0)))", "def test_inverse_a(s...
[ "0.71926945", "0.7190225", "0.71763825", "0.7009596", "0.68667805", "0.66803515", "0.6597588", "0.65650207", "0.6508092", "0.64021194", "0.6368649", "0.6353856", "0.6343556", "0.62756467", "0.6270733", "0.625756", "0.62204117", "0.61901724", "0.6172049", "0.6141965", "0.61219...
0.75969607
0
Tests that samples when alpha=0 match a Cauchy distribution.
def testAlphaZeroSamplesMatchACauchyDistribution(self): num_samples = 16384 scale = 1.7 rng = random.PRNGKey(0) samples = self._distribution.draw_samples(rng, jnp.zeros(num_samples), scale * jnp.ones(num_samples)) # Perform the Kolmogorov-Smirnov test ag...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def testAlphaZeroNllsMatchACauchyDistribution(self):\n x = jnp.linspace(-10, 10, 1000)\n scale = 1.7\n nll = self.variant(self._distribution.nllfun)(x, 0, scale)\n nll_true = -scipy.stats.cauchy(0, scale * jnp.sqrt(2)).logpdf(x)\n chex.assert_tree_all_close(nll, nll_true, atol=1e-5, rtol=1e-5)", "...
[ "0.6680012", "0.6354473", "0.6209682", "0.61972564", "0.6164783", "0.6008982", "0.59806556", "0.5976652", "0.5921101", "0.5910885", "0.5893897", "0.585743", "0.58079076", "0.57962525", "0.5794418", "0.57416725", "0.57225937", "0.5708916", "0.57081527", "0.56212264", "0.561896...
0.80532223
0
Tests that samples when alpha=2 match a normal distribution.
def testAlphaTwoSamplesMatchANormalDistribution(self): num_samples = 16384 scale = 1.7 rng = random.PRNGKey(0) samples = self._distribution.draw_samples(rng, 2 * jnp.ones(num_samples), scale * jnp.ones(num_samples)) # Perform the Kolmogorov-Smirnov test ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check_normality(self,alpha = 0.05):\n\n stat1, p = shapiro(self.x)\n \n if self.y is not None:\n stat2, p2 = shapiro(self.y)\n \n if p < alpha:\n if self.y is not None:\n if p2 < alpha:\n self._verbose('x and y do no...
[ "0.67740643", "0.6754474", "0.67495865", "0.6746429", "0.6506714", "0.64906484", "0.64424354", "0.6193214", "0.61726135", "0.61374503", "0.60869426", "0.6084586", "0.60788214", "0.60788214", "0.60788214", "0.6007249", "0.6007249", "0.6007249", "0.5982806", "0.5967407", "0.596...
0.7823516
0
Tests that NLLs when alpha=0 match a Cauchy distribution.
def testAlphaZeroNllsMatchACauchyDistribution(self): x = jnp.linspace(-10, 10, 1000) scale = 1.7 nll = self.variant(self._distribution.nllfun)(x, 0, scale) nll_true = -scipy.stats.cauchy(0, scale * jnp.sqrt(2)).logpdf(x) chex.assert_tree_all_close(nll, nll_true, atol=1e-5, rtol=1e-5)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def testAlphaZeroSamplesMatchACauchyDistribution(self):\n num_samples = 16384\n scale = 1.7\n rng = random.PRNGKey(0)\n samples = self._distribution.draw_samples(rng, jnp.zeros(num_samples),\n scale * jnp.ones(num_samples))\n # Perform the Kolmogorov-Smir...
[ "0.68777484", "0.64375144", "0.60488963", "0.5915437", "0.5769845", "0.5729598", "0.57096446", "0.56921405", "0.5689852", "0.568917", "0.5663401", "0.56617093", "0.564225", "0.5621442", "0.55985844", "0.55982405", "0.5585737", "0.5570602", "0.5563405", "0.55154085", "0.548741...
0.79121494
0
Tests that NLLs when alpha=2 match a normal distribution.
def testAlphaTwoNllsMatchANormalDistribution(self): x = jnp.linspace(-10, 10, 1000) scale = 1.7 nll = self.variant(self._distribution.nllfun)(x, 2, scale) nll_true = -scipy.stats.norm(0., scale).logpdf(x) chex.assert_tree_all_close(nll, nll_true, atol=1e-5, rtol=1e-5)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def testAlphaTwoSamplesMatchANormalDistribution(self):\n num_samples = 16384\n scale = 1.7\n rng = random.PRNGKey(0)\n samples = self._distribution.draw_samples(rng, 2 * jnp.ones(num_samples),\n scale * jnp.ones(num_samples))\n # Perform the Kolmogorov-Sm...
[ "0.6698185", "0.643845", "0.63134295", "0.61841494", "0.6141653", "0.61414146", "0.60927016", "0.60871667", "0.59520566", "0.59316164", "0.5909754", "0.58123356", "0.57811844", "0.5756457", "0.57549596", "0.5705357", "0.5662673", "0.5652161", "0.5648975", "0.56254596", "0.561...
0.7891815
0
Tests that the PDF integrates to 1 for different alphas.
def testPdfIntegratesToOne(self): alphas = jnp.exp(jnp.linspace(-4., 8., 8)) scale = 1. x = jnp.arange(-128., 128., 1 / 256.) * scale for alpha in alphas: nll = self.variant(self._distribution.nllfun)(x, alpha, scale) pdf_sum = jnp.sum(jnp.exp(-nll)) * (x[1] - x[0]) chex.assert_tree_al...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_integral_of_pdf_equals_one(self):\n grid = np.linspace(1e-10, self.gridmaxval, self.gridsize)\n grid = np.hstack([1e-13, 1e-12, 1e-11, grid])\n pdf = self.pdf(grid)\n\n negC_numeric = np.log(np.trapz(pdf, grid))\n negC_exact = -1 * c_Func(self.nu, as2D(self.B), 1)\n ...
[ "0.6517144", "0.6309804", "0.5976642", "0.5912949", "0.5887346", "0.5713409", "0.5713409", "0.56875443", "0.559121", "0.542784", "0.54032505", "0.5367702", "0.5334689", "0.5305629", "0.53010994", "0.52769005", "0.5256158", "0.52443606", "0.5233721", "0.52304417", "0.52265704"...
0.7594254
0
Returns the actual learn rate for the epoch. This may return the learn rate in function of training epoch Thiago F Pappacena integer epoch The epoch number float The actual learn rate to be used in network training
def getActualLearnRate(self, epoch): raise NotImplementedError('getActualLearnRate')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def learning_rate(epoch):\n self.lr = self.lr / 1.00000001\n return self.lr", "def learning_rate(epoch):\n return alpha / (1 + decay_rate * epoch)", "def learning_rate(epoch):\n return alpha / (1 + decay_rate * epoch)", "def __learning_rate(self, lr0, epoch):\n \n ...
[ "0.8455695", "0.8295935", "0.8295935", "0.7968047", "0.74135214", "0.73614776", "0.734312", "0.7145516", "0.70869344", "0.70463336", "0.7019492", "0.68898183", "0.6862335", "0.6847842", "0.6847842", "0.6847842", "0.6847842", "0.68446463", "0.6823332", "0.6793878", "0.67753375...
0.83435255
1
Test that all rules have at least one corresponding template
def test_rule_with_templates(rules): # Retrieve all serverless rule IDs rule_ids = set([r.id for r in rules if r.id[1] == "S"]) # Retrieve all rule IDs for tests test_rule_ids = set([t[1] for t in templates]) assert rule_ids == test_rule_ids
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_do_some_templates_exist():\n assert len(templates) > 0", "def test_template(filename, rule, mode, rules):\n\n filename = os.path.join(os.path.dirname(__file__), \"templates\", filename)\n\n template = cfnlint.decode.cfn_yaml.load(filename)\n matches = cfnlint.core.run_checks(\n filena...
[ "0.65278465", "0.62252337", "0.61625254", "0.5997611", "0.5937055", "0.59033537", "0.576174", "0.57581514", "0.5748215", "0.5688209", "0.5628044", "0.56172097", "0.5554399", "0.5553339", "0.5519734", "0.5512457", "0.5512457", "0.5496041", "0.5476134", "0.5468586", "0.5436648"...
0.6802842
0
Test case for get_solution
def test_get_solution(self): pass
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_solution(self):\r\n return self.solution", "def get_sol(self):", "def get_solution(self):\n return self._generate_solution()", "def print_solution():\n pass", "def solve(self):", "def test_solve_task(self):\n pass", "def test_initialization_of_homework_result_solution():...
[ "0.7616052", "0.75944847", "0.7438872", "0.74322695", "0.7282072", "0.72636026", "0.7189621", "0.7185826", "0.7178108", "0.70585215", "0.70585215", "0.7056967", "0.68243134", "0.6820739", "0.6647339", "0.66408175", "0.65963113", "0.6531765", "0.6525571", "0.65123546", "0.6475...
0.93453497
0
Test case for get_status
def test_get_status(self): pass
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getStatus():", "def test_get_status(self):\n response = self.client.open(\n '/v1/status',\n method='GET')\n self.assert200(response,\n 'Response body is : ' + response.data.decode('utf-8'))", "def get_status() -> None:\n assert scraper.get_status...
[ "0.82322794", "0.80751175", "0.804237", "0.79979545", "0.79768527", "0.79583126", "0.7845333", "0.78452075", "0.7754469", "0.75887394", "0.7511992", "0.74121016", "0.73661184", "0.73120743", "0.73120743", "0.73000544", "0.73000544", "0.73000544", "0.7283349", "0.72744924", "0...
0.9054239
1
Test case for solve_task
def test_solve_task(self): pass
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_get_solution(self):\n pass", "def solve(self):\n ...", "def solve(self):", "def test(taskID, solve, data):\n print(taskID)\n train_input, train_output, test_input, test_output = data\n print(\"Training grids\")\n for x, y in zip(train_input, train_output):\n yhat = s...
[ "0.7465019", "0.7007505", "0.6953642", "0.6910188", "0.690035", "0.6858969", "0.6858969", "0.6794475", "0.6581754", "0.65657467", "0.64410806", "0.6414092", "0.6321115", "0.62889135", "0.6207019", "0.62006015", "0.6184824", "0.615938", "0.6140654", "0.6140654", "0.6140654", ...
0.9172086
0
Nonexistent keys are semantically the same as keys that have expired.
def test_non_existent_key(self): ttl = self.cache.ttl('does_not_exist') self.assertEqual(ttl, 0)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_expired_nscache():\n now = int(time())\n keys_to_del = []\n for key, odict in nscache.iteritems():\n for dn, ce in odict.iteritems():\n if ce._expiration - now <= 0:\n keys_to_del.append((key, dn))\n return (keys_to_del, nscache)", "def test_evict_expired(self):\n\n ...
[ "0.69088453", "0.66729087", "0.66680294", "0.6529145", "0.6522368", "0.6517707", "0.6435536", "0.63546205", "0.62422794", "0.62310725", "0.6210781", "0.6155294", "0.6130582", "0.61152166", "0.6089946", "0.5942586", "0.59337795", "0.59009564", "0.58868426", "0.5880623", "0.583...
0.6781092
1
Ensures correct output from _polygon_to_vertex_arrays.
def test_polygon_to_vertex_arrays(self): these_vertex_x_coords, these_vertex_y_coords = ( skeleton_lines._polygon_to_vertex_arrays(POLYGON_OBJECT_XY)) self.assertTrue(numpy.allclose( these_vertex_x_coords, VERTEX_X_COORDS, atol=TOLERANCE)) self.assertTrue(numpy.allclose...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_ordering_polygon_vertices(self):\n\n # So far the admissible classes are Point, Line and Polygon\n tmp_filename = unique_filename(suffix='.shp')\n\n # Simple polygon (in clock wise order)\n P = numpy.array([[106.79, -6.23],\n [106.80, -6.24],\n ...
[ "0.6135824", "0.6024172", "0.60008395", "0.59775215", "0.58880115", "0.5839641", "0.5643565", "0.5583523", "0.5579118", "0.5571713", "0.55673265", "0.55583596", "0.5555685", "0.5547863", "0.5531479", "0.5520471", "0.54807967", "0.5469529", "0.5453457", "0.54211664", "0.536373...
0.7961005
0
Ensures correct output from _are_vertices_adjacent. In this case, vertices are adjacent and sorted in ascending order.
def test_are_vertices_adjacent_yes_ascending(self): self.assertTrue(skeleton_lines._are_vertices_adjacent( vertex_indices=VERTEX_INDICES_ADJACENT, num_vertices_in_polygon=NUM_VERTICES_FOR_ADJACENCY_TEST))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_are_vertices_adjacent_no_ascending(self):\n\n self.assertFalse(skeleton_lines._are_vertices_adjacent(\n vertex_indices=VERTEX_INDICES_NON_ADJACENT,\n num_vertices_in_polygon=NUM_VERTICES_FOR_ADJACENCY_TEST))", "def test_are_vertices_adjacent_no_descending(self):\n\n s...
[ "0.83762527", "0.7953237", "0.7905356", "0.7150115", "0.71049994", "0.69834554", "0.6708298", "0.6634236", "0.637123", "0.6363666", "0.63376606", "0.6122247", "0.6006599", "0.5926578", "0.5918742", "0.59014827", "0.5881908", "0.58499616", "0.5785697", "0.57767177", "0.5743012...
0.8188162
1
Ensures correct output from _are_vertices_adjacent. In this case, vertices are nonadjacent and sorted in ascending order.
def test_are_vertices_adjacent_no_ascending(self): self.assertFalse(skeleton_lines._are_vertices_adjacent( vertex_indices=VERTEX_INDICES_NON_ADJACENT, num_vertices_in_polygon=NUM_VERTICES_FOR_ADJACENCY_TEST))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_are_vertices_adjacent_no_descending(self):\n\n self.assertFalse(skeleton_lines._are_vertices_adjacent(\n vertex_indices=VERTEX_INDICES_NON_ADJACENT[::-1],\n num_vertices_in_polygon=NUM_VERTICES_FOR_ADJACENCY_TEST))", "def test_are_vertices_adjacent_yes_ascending(self):\n\n ...
[ "0.8066838", "0.78878635", "0.7780866", "0.69533986", "0.6868408", "0.67476016", "0.6627464", "0.66051596", "0.6398361", "0.6272085", "0.60401076", "0.6037133", "0.601582", "0.5900287", "0.5862683", "0.5825073", "0.5811509", "0.5803519", "0.57663584", "0.5762914", "0.5688592"...
0.84186876
0
Ensures correct output from _are_vertices_adjacent. In this case, vertices are nonadjacent and sorted in descending order.
def test_are_vertices_adjacent_no_descending(self): self.assertFalse(skeleton_lines._are_vertices_adjacent( vertex_indices=VERTEX_INDICES_NON_ADJACENT[::-1], num_vertices_in_polygon=NUM_VERTICES_FOR_ADJACENCY_TEST))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_are_vertices_adjacent_no_ascending(self):\n\n self.assertFalse(skeleton_lines._are_vertices_adjacent(\n vertex_indices=VERTEX_INDICES_NON_ADJACENT,\n num_vertices_in_polygon=NUM_VERTICES_FOR_ADJACENCY_TEST))", "def test_are_vertices_adjacent_yes_descending(self):\n\n ...
[ "0.81976503", "0.79410124", "0.7554856", "0.6583007", "0.65308386", "0.65192354", "0.63989186", "0.63781565", "0.612301", "0.6094289", "0.5992948", "0.59907544", "0.59281236", "0.57557034", "0.5748302", "0.5701084", "0.5674565", "0.5657427", "0.560439", "0.55912185", "0.55310...
0.8248517
0
Ensures correct output from _find_new_edges_from_triangulation.
def test_find_new_edges_from_triangulation(self): this_new_edge_table, this_triangle_to_new_edge_table = ( skeleton_lines._find_new_edges_from_triangulation( polygon_object_xy=POLYGON_OBJECT_XY, triangle_to_vertex_matrix=TRIANGLE_TO_VERTEX_MATRIX)) self.asse...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def clean_edges(self):", "def GetEdgesTri(self):\n\n p = self.InferPolynomialDegree()\n\n # DO NOT COMPUTE IF ALREADY COMPUTED\n if isinstance(self.all_edges,np.ndarray):\n if self.all_edges.shape[0] > 1:\n # IF LINEAR VERSION IS COMPUTED, DO COMPUTE HIGHER VERSION\...
[ "0.6151091", "0.6094902", "0.5827157", "0.5742185", "0.56801856", "0.56593627", "0.5634784", "0.55731595", "0.550472", "0.54645497", "0.5463318", "0.5460659", "0.54587257", "0.5437334", "0.5416579", "0.5405052", "0.5396419", "0.5381823", "0.53273815", "0.52986807", "0.5259653...
0.7615223
0
Ensures correct output from _find_end_nodes_of_triangulation.
def test_find_end_nodes_of_triangulation(self): these_end_node_vertex_indices = ( skeleton_lines._find_end_nodes_of_triangulation( triangle_to_vertex_matrix=TRIANGLE_TO_VERTEX_MATRIX, new_edge_table=NEW_EDGE_TABLE)) self.assertTrue(numpy.array_equal( ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_end_disconnected_graph(self):\n path = Dijkstras().dijkstras(self.g10, 'a', 'b')\n self.assertTrue(\n 'The proclaimed end vertex \\'b\\' was not reached.' in path,\n 'The end was found when it was not supposed to be.\\\n The return was \\'{}\\''.format(pa...
[ "0.61262834", "0.5864891", "0.57952094", "0.5733032", "0.5641278", "0.5575523", "0.5574605", "0.5561832", "0.55526406", "0.5546209", "0.5539092", "0.5515444", "0.54603887", "0.5447977", "0.5429211", "0.5400564", "0.53763264", "0.53487766", "0.53329104", "0.52718884", "0.52636...
0.81086725
0
Ensures correct output from _find_and_classify_nodes.
def test_find_and_classify_nodes(self): this_node_table, this_triangle_to_node_table = ( skeleton_lines._find_and_classify_nodes( polygon_object_xy=POLYGON_OBJECT_XY, new_edge_table=NEW_EDGE_TABLE, triangle_to_new_edge_table=TRIANGLE_TO_NEW_EDGE_TABLE...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def process_tree_nodes(self):\n self.leaves, self.internal = set(), set()\n _is_cladogram = True\n for node in self.nodes:\n if not node._been_processed:\n if not node.name:\n node.name = node.id\n elif self._remove_name_quotes and (n...
[ "0.58612114", "0.5581094", "0.5485729", "0.5348593", "0.5329081", "0.531311", "0.5287489", "0.5283654", "0.5270319", "0.525408", "0.5247802", "0.5207091", "0.518404", "0.51749533", "0.5165523", "0.51501995", "0.5148451", "0.5145574", "0.5141006", "0.5116204", "0.51067376", ...
0.61148983
0
Ensures correct output from _find_and_classify_node_children.
def test_find_and_classify_node_children(self): this_node_table = skeleton_lines._find_and_classify_node_children( node_table=NODE_TABLE_SANS_CHILDREN, triangle_to_new_edge_table=TRIANGLE_TO_NEW_EDGE_TABLE, triangle_to_node_table=TRIANGLE_TO_NODE_TABLE) self.assertT...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def process_tree_nodes(self):\n self.leaves, self.internal = set(), set()\n _is_cladogram = True\n for node in self.nodes:\n if not node._been_processed:\n if not node.name:\n node.name = node.id\n elif self._remove_name_quotes and (n...
[ "0.6098489", "0.60835296", "0.583662", "0.5669055", "0.5599346", "0.5579612", "0.5520875", "0.549088", "0.5479039", "0.5468473", "0.5415852", "0.5399945", "0.53939307", "0.5391779", "0.5332544", "0.52611446", "0.5254428", "0.52488667", "0.52115244", "0.5211146", "0.52100885",...
0.6720648
0
Ensures correct output from _delete_last_node_added.
def test_delete_last_node_added(self): this_node_table = copy.deepcopy(NODE_TABLE_WITH_CHILDREN) (this_node_table, these_used_node_indices, these_used_triangle_indices) = skeleton_lines._delete_last_node_added( node_table=this_node_table, used_node_indices=U...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delete_node_at_end(self):\n\t\tif self.root is None:\n\t\t\traise EmptyRootException(\"ERROR: No node available in list. Please insert node in list.\")\n\t\tcurrent_node = self.root\n\t\twhile current_node.next.next is not None:\n\t\t\tcurrent_node = current_node.next\n\t\tcurrent_node.next = None\n\t\tself.di...
[ "0.5832075", "0.5636868", "0.5612768", "0.5562111", "0.5493852", "0.5413563", "0.5394212", "0.5274221", "0.5265276", "0.52266294", "0.5224394", "0.52157795", "0.5179523", "0.5164693", "0.5143174", "0.5139924", "0.51212", "0.5112504", "0.51074296", "0.5101882", "0.50845146", ...
0.7096866
0
Ensures correct output from _get_skeleton_line.
def test_get_skeleton_line(self): these_x_coords, these_y_coords = skeleton_lines._get_skeleton_line( node_table=NODE_TABLE_WITH_CHILDREN, triangle_to_node_table=TRIANGLE_TO_NODE_TABLE, start_node_index=START_NODE_INDEX_FOR_SKELETON_LINE, end_node_index=END_NODE_...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __processOutputLine(self, line):\n if (\n line.startswith(\"--- \") or\n line.startswith(\"+++ \")\n ):\n self.__processFileLine(line)\n \n self.__output.append(line)", "def __handle_blank_line(\n parser_state,\n input_line,\n ...
[ "0.57005656", "0.55191326", "0.54924417", "0.5490846", "0.5412288", "0.5395291", "0.5336255", "0.529627", "0.52354586", "0.52325803", "0.52232784", "0.5217711", "0.5212314", "0.52073133", "0.5190853", "0.517484", "0.516929", "0.5153681", "0.51381254", "0.5132948", "0.5123556"...
0.6756033
0
Ensures correct output from _remove_node_from_children.
def test_remove_node_from_children(self): this_node_table = copy.deepcopy(NODE_TABLE_WITH_CHILDREN) this_node_table = skeleton_lines._remove_node_from_children( node_table=this_node_table, target_node_index=0) self.assertTrue(_compare_tables( NODE_TABLE_NO_ZERO_CHILDREN...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _internalRemove(self, node):\n\t\tif not node:\n\t\t\treturn None\n\n\t\t#Case 1 - node is a leaf\n\t\tif (not node.lchild() and not node.rchild()):\n\t\t\tprint str(node.value()) + \": 1\"\n\t\t\tif (node is self._root):\n\t\t\t\tself._root = None\n\t\t\t\treturn node.value()\n\t\t\tif node.islchild():\n\t\t\...
[ "0.6752903", "0.66870326", "0.6664385", "0.65643585", "0.64907616", "0.6484258", "0.6415048", "0.63529325", "0.6328951", "0.62924576", "0.6228013", "0.620109", "0.6147523", "0.60639656", "0.605655", "0.60545707", "0.6027855", "0.6017001", "0.6002175", "0.5991268", "0.59828013...
0.7096224
0
Make JWST/NIRISS image header
def niriss_header(ra=53.1592277508136, dec=-27.782056346146, pa_aper=128.589, filter='F150W', grism='GR150R'): naxis = 2048, 2048 crpix = 1024, 1024 cd = np.array([[ -0.0658, 0], [0, 0.0654]])/3600. cd_rot = rotate_CD_matrix(cd, pa_aper) h = pyfits.Header() h[...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def nircam_header(ra=53.1592277508136, dec=-27.782056346146, pa_aper=128.589, \n filter='F444W', grism='DFSR'): \n naxis = 2048, 2048\n crpix = 1024, 1024\n \n cd = np.array([[ -0.0648, 0], [0, 0.0648]])/3600.\n cd_rot = rotate_CD_matrix(cd, pa_aper)\n \n h = pyfits.Header()\...
[ "0.67683154", "0.64114416", "0.63763094", "0.63751584", "0.6259535", "0.62580895", "0.6171944", "0.6159248", "0.6134286", "0.6122044", "0.6084457", "0.59636", "0.5952117", "0.5950554", "0.5898171", "0.5875198", "0.586893", "0.5837934", "0.5824811", "0.5776633", "0.57762784", ...
0.6913829
0
Make JWST/NIRCAM image header
def nircam_header(ra=53.1592277508136, dec=-27.782056346146, pa_aper=128.589, filter='F444W', grism='DFSR'): naxis = 2048, 2048 crpix = 1024, 1024 cd = np.array([[ -0.0648, 0], [0, 0.0648]])/3600. cd_rot = rotate_CD_matrix(cd, pa_aper) h = pyfits.Header() h['C...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def niriss_header(ra=53.1592277508136, dec=-27.782056346146, pa_aper=128.589, \n filter='F150W', grism='GR150R'): \n naxis = 2048, 2048\n crpix = 1024, 1024\n \n cd = np.array([[ -0.0658, 0], [0, 0.0654]])/3600.\n cd_rot = rotate_CD_matrix(cd, pa_aper)\n \n h = pyfits.Header(...
[ "0.6584527", "0.6435467", "0.62919146", "0.6264406", "0.62058514", "0.61719203", "0.6132776", "0.61267465", "0.6122263", "0.60200906", "0.5994363", "0.5978943", "0.5970803", "0.5954325", "0.595168", "0.59130836", "0.5900017", "0.58723724", "0.58588314", "0.57820123", "0.57654...
0.71819055
0
Make HST/WFC3IR image header
def wfc3ir_header(ra=53.1592277508136, dec=-27.782056346146, pa_aper=128.589, flt='ibhj34h6q_flt.fits', filter='G141'): import numpy as np import astropy.io.fits as pyfits import astropy.wcs as pywcs im = pyfits.open(flt) wcs = pywcs.WCS(im[1].header, relax=True) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def nircam_header(ra=53.1592277508136, dec=-27.782056346146, pa_aper=128.589, \n filter='F444W', grism='DFSR'): \n naxis = 2048, 2048\n crpix = 1024, 1024\n \n cd = np.array([[ -0.0648, 0], [0, 0.0648]])/3600.\n cd_rot = rotate_CD_matrix(cd, pa_aper)\n \n h = pyfits.Header()\...
[ "0.6984748", "0.6862432", "0.6772053", "0.676693", "0.6666347", "0.66384405", "0.66245455", "0.65931785", "0.65349954", "0.6492196", "0.645544", "0.63901275", "0.63871235", "0.63627", "0.634455", "0.6277534", "0.62346125", "0.61951274", "0.6166816", "0.6109227", "0.60848826",...
0.7077016
0
Make WFIRST WFI header
def wfirst_header(ra=53.1592277508136, dec=-27.782056346146, pa_aper=128.589, naxis=(4096,4096)): #naxis = 2048, 2048 crpix = naxis[0]/2., naxis[0]/2. cd = np.array([[ -0.11, 0], [0, 0.11]])/3600. cd_rot = rotate_CD_matrix(cd, pa_aper) h = pyfits.Header() h['CRVAL1'] = ra h['...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def initialize_header(fopen, uid):\n fopen.seek(0, 0)\n fopen.write(b'\\x84\\x83\\x82\\x81')\n fopen.write(\n struct.pack('<32s', COMPATIBILITY_VERSION.ljust(32, b'\\x00'))\n )\n fopen.write(struct.pack('<16s', uid.bytes))\n fopen.seek(8, 1)", "def wfc3ir_head...
[ "0.6547282", "0.60421693", "0.58545333", "0.58046263", "0.57765996", "0.5747541", "0.57198375", "0.5666993", "0.5639911", "0.5633409", "0.56057096", "0.5603135", "0.5597764", "0.55915797", "0.5585693", "0.5574571", "0.5554606", "0.5543405", "0.5495355", "0.5429645", "0.542346...
0.6277315
1
Marks given function as private (which'll be not accessible outside of this module)
def private(function): if not getattr(function, "private", False): function.private = True return function
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def private(func):\n func._private_ = True\n return func", "def is_private(function):\n name = function.__name__\n if name.startswith(\"__\"):\n return True\n else:\n return getattr(function, \"private\", False)", "def is_private():", "def test_private_function(self):\n da...
[ "0.88123983", "0.7509396", "0.71408373", "0.6991496", "0.6909424", "0.68332946", "0.67809176", "0.6645922", "0.66305995", "0.6628069", "0.66006637", "0.66006637", "0.6558288", "0.6472313", "0.64425904", "0.6428519", "0.6392696", "0.63418144", "0.6332831", "0.6303308", "0.6283...
0.861034
1
Returns true if given function is a private
def is_private(function): name = function.__name__ if name.startswith("__"): return True else: return getattr(function, "private", False)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_private():", "def is_private(self):\n return self.has_label(PRIVATE_LABEL)", "def is_private(code):\n return 4000 <= code <= 4999", "def private(function):\n if not getattr(function, \"private\", False):\n function.private = True\n return function", "def private(self) -> bool:\n ...
[ "0.8612758", "0.7406791", "0.73249424", "0.7133828", "0.7045683", "0.7043486", "0.70349395", "0.6915705", "0.6863459", "0.6853331", "0.6831701", "0.6792028", "0.6765018", "0.6748457", "0.6747686", "0.66658044", "0.6634988", "0.66116214", "0.6594688", "0.6576853", "0.6502179",...
0.8821868
0
Marks given function as blocking (which'll be executed in another thread)
def blocking(function): if not getattr(function, "blocking", False): function.blocking = True return function
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_blocking(function):\n return getattr(function, \"blocking\", False)", "def thread_method_block(handler, block_event):\n with ConnectionContext(handler):\n block_event.wait()", "def _non_blocking(f):\n def g(*args, **kwargs):\n try:\n return f(*args, **kwargs...
[ "0.7256706", "0.69135725", "0.67599446", "0.626904", "0.6259478", "0.6198116", "0.618366", "0.6150961", "0.6138516", "0.61149895", "0.6001962", "0.59949476", "0.5880291", "0.58185565", "0.5818477", "0.5774927", "0.5749663", "0.5739989", "0.57234704", "0.5664928", "0.5652946",...
0.8400394
0
Returns true if function is marked as blocking
def is_blocking(function): return getattr(function, "blocking", False)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def Blocking(self) -> bool:", "def blocking(function):\n if not getattr(function, \"blocking\", False):\n function.blocking = True\n return function", "def is_async(self) -> bool:", "def is_call_waiting(self) -> bool:", "def blocking_condition(self):\n return self.__blocking_condition",...
[ "0.7852868", "0.7056137", "0.70326173", "0.69850314", "0.6758443", "0.66889256", "0.656143", "0.65410835", "0.64814496", "0.6438864", "0.637442", "0.63391685", "0.617491", "0.61350244", "0.6122082", "0.61149675", "0.60869753", "0.6064766", "0.60078835", "0.5990223", "0.598799...
0.8576496
0
Display the ship to the screen.
def display_ship(self): self.screen.blit(self.ship, self.rect)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show(self, screen):\n x_display = self.xy_position[0] * constants.CELL_SIZE\n y_display = self.xy_position[1] * constants.CELL_SIZE\n screen.blit(self.image, (x_display, y_display))", "def drawShip(self,view):\r\n if not self.getShip() is None:\r\n self.getShip().draw(v...
[ "0.7267101", "0.72439706", "0.6985813", "0.6980602", "0.6920355", "0.68287027", "0.6817196", "0.6792303", "0.6720907", "0.6705511", "0.6682931", "0.6667344", "0.6652452", "0.66473013", "0.65845084", "0.65700275", "0.65639174", "0.6560118", "0.6537909", "0.653351", "0.65296245...
0.8643128
0
Given a valid token, verifies it and logs out the associated user.
def auth_logout(token): if verify_token(token): return { "is_success": True } else: raise AccessError(description="Logout failed. Token is invalid")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sign_out(token):\n session = get_session_by_token(token)\n if not session['success']:\n return {'success': False, 'message': 'You are not signed in.', 'code': 401}\n\n query_db('DELETE FROM ActiveUsers WHERE token_hash = ?', [session['data']['token_hash']])\n return {'success': True, 'messag...
[ "0.69538164", "0.6894779", "0.683627", "0.68155015", "0.6730462", "0.6715241", "0.670511", "0.66728204", "0.6632839", "0.66137385", "0.6612326", "0.65852004", "0.65583223", "0.65396154", "0.6521897", "0.65004545", "0.6446949", "0.6428253", "0.63727564", "0.6333393", "0.631505...
0.7014785
0
Create a version info from a version message.
def from_message(cls, msg: dict) -> "VersionInfo": return cls( driver_version=msg["driverVersion"], server_version=msg["serverVersion"], home_id=msg["homeId"], )
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def from_str(cls, line) -> \"VersionStructure\":\n major, minor, patch = [int(item) for item in line.split(\".\")]\n return cls(major=major, minor=minor, patch=patch)", "def versionMessage(self):\n\n message = MumbleControlProtocol.Version()\n message.release=\"1.2.5\"\n messag...
[ "0.66067624", "0.63901335", "0.6277929", "0.61994225", "0.6122783", "0.6122783", "0.6053716", "0.5957319", "0.5955144", "0.59475", "0.5947293", "0.5902748", "0.58241165", "0.58087677", "0.58087397", "0.579895", "0.5787413", "0.5755676", "0.57363117", "0.5650922", "0.5632971",...
0.74239993
0
A broken NODE creates conflicting messages with the same sequence number that SELF should properly filter.
def incoming_simple_conflict_different_global_time(self): community = DebugCommunity.create_community(self._dispersy, self._my_member) meta = community.get_meta_message(u"sequence-text") node = DebugNode(community) node.init_socket() node.init_my_member() # MSGS[GLOBAL-T...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_missing(self):\n community = DebugCommunity.create_community(self._dispersy, self._my_member)\n node = DebugNode(community)\n node.init_socket()\n node.init_my_member()\n\n messages = [node.create_sequence_text(\"Sequence message #%d\" % sequence, sequence + 10, sequence...
[ "0.61087364", "0.5372324", "0.5360691", "0.5311695", "0.52909184", "0.52787375", "0.52562225", "0.5242976", "0.5213285", "0.51192445", "0.5110035", "0.5095527", "0.5054259", "0.5050923", "0.50362563", "0.5025327", "0.5019302", "0.50040585", "0.50024086", "0.4997482", "0.49690...
0.6009866
1
Get the fig_width_pt by inserting \the\textwidth into LaTeX document. hscale is fraction of text width you want. vscale is fraction of hscale (defaults to golden ratio)
def figsze(hscale, vscale=(np.sqrt(5.0)-1.0)/2.0, fig_width_pt = 504.0): inches_per_pt = 1.0/72.27 # Convert pt to inch fig_width = fig_width_pt*inches_per_pt*hscale # width in inches fig_height = fig_width*vscale # height in inches fig...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def latex_figsize(wf=0.5, hf=(5.**0.5-1.0)/2.0, columnwidth=510):\n \n fig_width_pt = columnwidth*wf \n inches_per_pt = 1.0/72.27 # Convert pt to inch\n fig_width = fig_width_pt*inches_per_pt # width in inches\n fig_height = fig_width*hf # height in inches\n return [fig_width,...
[ "0.6748039", "0.588113", "0.5859097", "0.58276725", "0.58160394", "0.5810135", "0.5707096", "0.56748366", "0.55074775", "0.549453", "0.54910403", "0.54289186", "0.5420147", "0.5414285", "0.5385675", "0.53664553", "0.5325267", "0.52743423", "0.52519363", "0.52403593", "0.52324...
0.687374
0
Returns True if the user has the verified_md5 cookie set to the correct value, False otherwise.
def user_is_verified(): stored_md5 = request.cookies.get(MD5_COOKIE_NAME) if not stored_md5: # no cookie, user can't be verified return False else: # has cookie, now see if it has the right value return stored_md5 == get_correct_pw_md5()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check(self) -> bool:\n return self.check_sum() == self.__md5_sum", "def is_cookie_valid(cookie, cookie_key, ctx):\n user_agent = ctx['user_agent']\n msg = str(cookie['t']) + str(cookie['s']['a']) + str(cookie['s']['b']) + str(cookie['u']) + str(\n cookie['v']) + user_agent\n\n valid_di...
[ "0.6191141", "0.59380144", "0.58516777", "0.5836493", "0.5818221", "0.5802294", "0.57840663", "0.57562923", "0.5727229", "0.56944764", "0.56944764", "0.56924444", "0.5684591", "0.56556064", "0.56176144", "0.56003785", "0.5575091", "0.5511295", "0.5493201", "0.5456393", "0.542...
0.89718354
0
Returns the md5 of the correct password for the blog, taken from PASSWORD_FILE.
def get_correct_pw_md5(): f = open(PASSWORD_FILE, 'r') pw_md5 = f.read().strip() f.close() return pw_md5
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _create_md5(self, password) -> str:\n md5_hash = hashlib.md5(password.encode(\"utf-8\")).hexdigest()\n self.logger.debug(\"created md5 hash: %s\", md5_hash)\n\n return md5_hash", "def getpassword(value):\n hashed = \"%s%s\" % (value, SECRET_KEY)\n hasher = hashlib.md5()\n hasher...
[ "0.66830295", "0.6658947", "0.6490018", "0.635182", "0.63157856", "0.61590135", "0.61137426", "0.60998476", "0.6073256", "0.6072694", "0.606721", "0.6003744", "0.6003744", "0.59756565", "0.5922727", "0.59159356", "0.5902505", "0.58865505", "0.5868897", "0.5868036", "0.5863978...
0.827785
0
display score for each emotion
def display_emotions(scores): emotions = config.EMOTIFY_EMOTIONS_ORDERED_LIST for i in range(len(emotions)): template = "{} : {:1.2f}" print(template.format(emotions[i], scores[0][i]))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def disp_score():", "def score(self):", "def show_scores(self):\n for text in self.score_text:\n text.draw()", "def score_display():\n data = score_reader()\n for index, datum in enumerate(data):\n score_format = \"%s ...... %s/%s\" % (datum[0].capitalize(), datum[1], datum[2])...
[ "0.73740214", "0.68099797", "0.6806443", "0.65692043", "0.6336403", "0.63276374", "0.62958324", "0.6272114", "0.62423056", "0.61519545", "0.6136412", "0.609505", "0.60267824", "0.6016405", "0.5999472", "0.5988537", "0.59712905", "0.5963617", "0.59558356", "0.5951155", "0.5946...
0.72261435
1
Set status of buddy; convert status to something shorter
def set_status(self, status: str) -> None: try: self.status = Buddy.status_map[status.lower()] except KeyError: self.status = status
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def updateStatus(self, status):\n pass", "def change_status(self, status, application_id):", "def UpdateStatus(self, status):\r\n self.status.update(status)", "async def set_status(ctx, *, status: str):\n if len(status) > 128:\n await ctx.send(\"This status is too long! (128 character lim...
[ "0.6882923", "0.68338025", "0.6819278", "0.6753536", "0.6745531", "0.6718684", "0.66733605", "0.6672637", "0.66363275", "0.6610081", "0.6600017", "0.6581495", "0.6581495", "0.6581495", "0.6570732", "0.65499866", "0.6530418", "0.6492773", "0.6489207", "0.6489207", "0.6489207",...
0.7366491
0
Transform a sentence into a list of tokens. Stop words are removed in this phase.
def _tokenize(self, sentence: str) -> List[str]: tokens = word_tokenize(sentence) tokens = [t.lower() for t in tokens if len(t) < 25 and self.pattern.match(t)] if self.include_stopword == True: return tokens stop_words = set(stopwords.words('english')) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def tokenize(sentence):\n lower_s = sentence.lower()\n no_punc_s = lower_s.translate(TRANS, string.punctuation)\n\n word_list = no_punc_s.split()\n\n return word_list", "def tokenize(self, sentence, keep_ids=False):\n EMPTYTOKEN = \"empty_token\"\n # Creating our token object, which is ...
[ "0.7800396", "0.76428616", "0.7402595", "0.740194", "0.73506135", "0.7345999", "0.7301398", "0.72819674", "0.72756857", "0.7252945", "0.7193871", "0.7189867", "0.71663", "0.71228087", "0.71002996", "0.7080296", "0.7056228", "0.70509064", "0.70509064", "0.70087576", "0.7003106...
0.7953735
0
Transform tokens into term ids.
def _tokens_to_terms(self, tokens: Sequence[str]) -> List[int]: ret = [] for t in tokens: term = self.stemmer(t) if term in self.term2id_dict: ret.append(self.term2id_dict[term]) else: self.term2id_dict[term] = self.g_term_max_id ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def convert_tokens_to_ids(self, tokens):\n ids = []\n if isinstance(tokens, str):\n if tokens in self.special_tokens:\n return self.special_tokens[tokens]\n else:\n return self.encoder.get(tokens, self.unk_id)\n for token in tokens:\n ...
[ "0.7282761", "0.7171749", "0.69518995", "0.69146013", "0.68269044", "0.67929333", "0.6728888", "0.6728568", "0.67206275", "0.6719503", "0.671304", "0.6708337", "0.6689399", "0.6654657", "0.65945363", "0.65798926", "0.6579718", "0.657793", "0.6522145", "0.650969", "0.64802974"...
0.8083988
0
DataViewListCtrls aren't dynamic and won't allow new columns to be added once data has been added (even if the table is empty). I have got around this by destroying it and recreating it whenever a new column needs to be added. This is not how I'd prefer to implement it, but it is a limitation of this UI control.
def _recreate_dvl_data(self): if self._dvl_data is not None: #destroy the old control object if it had been created self._dvl_data.Destroy() self._dvl_columns = [] self._dvl_data = wx.dataview.DataViewListCtrl(self, wx.ID_ANY) #make a new control object self._gbs...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def refresh_column_list(self):\n selection = self._ckl_columns.GetSelection() #store the index of the selected column so it can be reselected after the column is refreshed\n checked_items = self._ckl_columns.GetCheckedItems()\n\n self._ckl_columns.Clear() #clear UI ready for the updated column...
[ "0.6000779", "0.5786619", "0.5763775", "0.5552238", "0.5431857", "0.5398553", "0.5386844", "0.5380461", "0.53586483", "0.53159744", "0.52716815", "0.5244526", "0.5156217", "0.5152841", "0.51288325", "0.5117819", "0.5102469", "0.5094552", "0.5076953", "0.5055941", "0.50524247"...
0.72976387
0
Updates the list of variables that can be used as columns from the database
def refresh_column_list(self): selection = self._ckl_columns.GetSelection() #store the index of the selected column so it can be reselected after the column is refreshed checked_items = self._ckl_columns.GetCheckedItems() self._ckl_columns.Clear() #clear UI ready for the updated column list ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def updateVariables(self) -> None:\n ...", "def _add_secure_variables(self):\n actual = []\n for item in self._meta['sets']['data file']['items']:\n key, name = item.split('@')\n if key == 'columns':\n actual.append(name)\n elif key == 'masks':...
[ "0.68733066", "0.6189779", "0.6110078", "0.60107607", "0.5996477", "0.5844384", "0.57736874", "0.5769631", "0.57551044", "0.5727681", "0.5631797", "0.56268907", "0.5619654", "0.5600353", "0.55887645", "0.5548409", "0.55407614", "0.5495117", "0.54575604", "0.54506683", "0.5433...
0.62639153
1
Updates the list of tables from the database
def refresh_table_list(self): selection = self._lb_tables.GetSelection() #preserve table selection self._tables.clear() self._lb_tables.Clear() tables = self._datafile.query(sciplot.database.Query("SELECT TableID, Title FROM `Table`", [], 1))[0] #get all tables from the database ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def migrateTables(self):\n tables = self.client_from.tables.list(['columns'])\n if len(tables) > 0:\n for table in tables:\n self.client_to.tables.update(table['tableId'], json.dumps(table))\n else:\n print(\"No tables to migrate!\")\n return\n ...
[ "0.7042094", "0.70412505", "0.66473824", "0.6644045", "0.6525583", "0.65152323", "0.6501355", "0.6428072", "0.64017713", "0.6352855", "0.6306249", "0.63034457", "0.62759626", "0.6212398", "0.61091125", "0.61069167", "0.61038065", "0.60839117", "0.6083319", "0.60463506", "0.60...
0.71402436
0
Updates the selected columns in the selected table in the database
def _column_selection_change(self): selection_index = self._lb_tables.GetSelection() if selection_index != -1: table_id = self._tables[selection_index][0] selected_columns_indexes = [self._columns[i][0] for i in list(self._ckl_columns.GetCheckedItems())] database_colu...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update(self):\n current = LazyRegister(self.db)\n current.render()\n cur = self.db.cursor()\n for table in self.tables:\n if table in current.tables:\n additions, removals = current.tables[table].migrate(self.tables[table])\n for addition in ...
[ "0.69718266", "0.67112523", "0.64874727", "0.6395369", "0.6188564", "0.6160813", "0.61012954", "0.60626835", "0.6041619", "0.59584314", "0.5927253", "0.59187686", "0.58871555", "0.5879607", "0.58166814", "0.58128196", "0.5794202", "0.57912606", "0.5765165", "0.57496786", "0.5...
0.6917201
1
Updates the selected columns and displayed table from the database to reflect the newly selected table
def _table_selected(self): selection_index = self._lb_tables.GetSelection() if selection_index != -1: table_id = self._tables[selection_index][0] #update table column selection columns_indexes = [tup[0] for tup in self._datafile.query(sciplot.database.Query("SELECT V...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _refresh_table(self):\n self._column_selected()\n self._table_selected()\n self._column_selection_change()\n self.refresh_column_list()\n self.refresh_table_list()\n self.refresh_table()", "def refresh_table(self):\n self._table['bounty_column'] = Driver.insta...
[ "0.6927088", "0.68090445", "0.67614096", "0.6737544", "0.6665742", "0.65566266", "0.6352478", "0.6332461", "0.62973374", "0.6272074", "0.6151308", "0.6091633", "0.6089993", "0.6079459", "0.6072382", "0.5998796", "0.59809136", "0.59433776", "0.59347194", "0.5927668", "0.591250...
0.69291013
0
Confirm invitation for a dashboard.
def confirm(self, id_dashboard): if isinstance(id_dashboard, int): pass elif isinstance(id_dashboard, Dashboard): id_dashboard = id_dashboard.id elif isinstance(id_dashboard, str): try: id_dashboard = int(id_dashboard) except: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def confirm():\n if request.method == 'POST':\n user_type = session.get('type', None)\n if user_type == 'Admin':\n return redirect('/index')\n elif user_type == 'Client':\n return redirect('/clients/' + session.get('name'))\n else:\n return redirect('...
[ "0.6283964", "0.6060141", "0.5984802", "0.59842247", "0.58878136", "0.5794999", "0.5736931", "0.5721489", "0.566952", "0.55866414", "0.5574464", "0.55604404", "0.55412745", "0.553996", "0.55208504", "0.55208504", "0.5457729", "0.5410485", "0.53815573", "0.53802246", "0.537037...
0.61890537
1
Get every dashboard that needs to be upgraded.
def need_upgrade(self): dashboards = self.__api.call('dashboards/need_upgrade_list')['dashboards'] return [Dashboard(self.__api, x['dashboard']) for x in dashboards]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def dashboards(self):\r\n return resources.Dashboards(self)", "def dashboards(self) -> dict:\n return Config.get_dashboards()", "def needs_upgrade(self):\n return self.__api.call('dashboards/needs_upgrade',\n id_dashboard=self.id)", "def getAllUpgrades...
[ "0.6943352", "0.6837895", "0.64634395", "0.6279559", "0.62422967", "0.6194242", "0.6185451", "0.6176873", "0.59609866", "0.5728485", "0.56450826", "0.56295854", "0.561968", "0.56028295", "0.558888", "0.55385417", "0.5533436", "0.5486615", "0.5453573", "0.54449105", "0.5436913...
0.8319119
0
Checks if user inputted phone number matches the following pattern 07
def validate_phone_number(phone_number): check = re.fullmatch(r"^07\d{8}", phone_number) if check: return True else: return False
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_phone_number(self, dst):\n p = re.search('(^(\\+|00)?[0-9]{1,12}$)', dst)\n if not p:\n return False\n\n return True", "def invalid_phone_number(phonenumber):\n if all(digit.isdigit() for digit in phonenumber) \\\n and len(phonenumber) <= 10 and phonen...
[ "0.6738611", "0.67027885", "0.66322523", "0.66141933", "0.65856385", "0.6551074", "0.64079285", "0.63789105", "0.63740146", "0.63512456", "0.6305217", "0.6250922", "0.6240172", "0.61910486", "0.61759573", "0.6102672", "0.60960156", "0.60944414", "0.60868895", "0.6012865", "0....
0.81390226
0
Displays the depth/color image streams on repeat, separately, in one window
def display_in_window(self, clipping=False): for depth_image, color_image in self: grey_color = 153 depth_image_3d = np.dstack((depth_image, depth_image, depth_image)) # Render images depth_colormap = cv2.applyColorMap( cv2.convertScaleAbs(depth_i...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show_rgbd(self):\n while self.depth_data is None:\n pass\n\n while not rospy.is_shutdown():\n rospy.Rate(10).sleep()\n d = self.depth_data * self.cam.DEPTH_UNIT\n d = cv2.applyColorMap(d.astype(np.uint8), cv2.COLORMAP_RAINBOW)\n dc = np.conca...
[ "0.72498906", "0.70781964", "0.6868161", "0.67156386", "0.66948867", "0.6690285", "0.6614877", "0.6322317", "0.62047106", "0.61959904", "0.6069539", "0.604795", "0.60382295", "0.5991848", "0.5968169", "0.5963413", "0.59498173", "0.5934008", "0.5919166", "0.591832", "0.5905900...
0.738005
0
Test authorization API endpoint with invalid inputs
def test_invalid_auth_inputs(login_inputs, expected_result, expected_status_code): with requests.Session() as session: create_next_admin(session) create_test_user(session, USER_INPUT) response = session.post( "http://rbac-server:8000/api/authorization/", json=login_inputs ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_unauthorized(self):\n self._error_test(fitbit_exceptions.HTTPUnauthorized)", "def test_unhappy_path_unauthorized(self):\n\n response = self.client.post(self.url)\n expected_data = {\"detail\": \"Authentication credentials were not provided.\"}\n\n self.assertDictEqual(respons...
[ "0.73336583", "0.72380227", "0.72290325", "0.7183463", "0.71786624", "0.7136279", "0.713596", "0.70732796", "0.7064649", "0.70636886", "0.7045997", "0.69862354", "0.69847786", "0.6981699", "0.69760007", "0.69760007", "0.6970749", "0.6962484", "0.69606966", "0.69135296", "0.68...
0.7289488
1
Test authorization API endpoint when user is attempting to login to LDAP with no username and password. Test is skipped if LDAP server is not set in environment variables.
def test_missing_ldap_login_(): login_inputs = {"id": "", "password": ""} expected = {"message": "Incorrect username or password.", "code": 400} test_invalid_auth_inputs( login_inputs=login_inputs, expected_result=expected["message"], expected_status_code=expected["code"], )
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_auth_test(self):\n backend = LdapBackend()\n backend.authenticate(None, username=\"apple\", password=\"ffffff\")", "def test_list_authz_missing_dn_or_op(self):\n self.app.get(\"/config/authorize?operation=config\", status=200)\n self.app.get(\"/config/authorize?dn=/DN=a.test....
[ "0.76075804", "0.6795439", "0.6699198", "0.6497225", "0.64906955", "0.6424285", "0.6399907", "0.6384673", "0.63669693", "0.6331216", "0.63025236", "0.63025236", "0.63009435", "0.6300657", "0.6298535", "0.6298535", "0.6291472", "0.62875086", "0.62804955", "0.62734735", "0.6191...
0.6966206
1
Standard postprocessing of a CP decomposition. This function will perform standard postprocessing of a CP decomposition. If a reference CP tensor is provided, then the columns of ``cp_tensor``'s factor matrices are aligned with the columns of ``reference_cp_tensor``'s factor matrices. Next, the factor matrices of the C...
def postprocess( cp_tensor, dataset=None, reference_cp_tensor=None, permute=True, resolve_mode=None, unresolved_mode=-1, flip_method="transpose", weight_behaviour="normalise", weight_mode=0, allow_smaller_rank=False, include_metadata=False, ): if not permute and reference...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def resolve_cp_sign_indeterminacy(cp_tensor, dataset, resolve_mode=None, unresolved_mode=-1, method=\"transpose\"):\n if unresolved_mode < 0:\n unresolved_mode = dataset.ndim + unresolved_mode\n if unresolved_mode >= dataset.ndim or unresolved_mode < 0:\n raise ValueError(\"`unresolved_mode` mu...
[ "0.4886793", "0.48646224", "0.46682554", "0.46016532", "0.43322232", "0.43092588", "0.41951483", "0.40398213", "0.4025281", "0.40035564", "0.39646837", "0.39602822", "0.3957968", "0.39505997", "0.3931543", "0.392757", "0.39266986", "0.39157623", "0.391427", "0.3901912", "0.39...
0.81296337
0
Convert a factor matrix into a tidy dataset, for use with Plotly Express. If we convert a factor matrix into a tidy dataset (or long table), then we get a table on the form
def factor_matrix_to_tidy(factor_matrix, var_name="Component", value_name="Signal", id_vars=None): factor_matrix = factor_matrix.reset_index() if id_vars is None: id_vars = set() for column in factor_matrix.columns: if type(column) != int: id_vars.add(column) id_v...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def transform(self, df):\n _df = df.copy()\n categorical = self.find_categorical(df)\n for cat in categorical:\n _df[cat] = pd.Categorical(_df[cat], categories=_test_categories[cat])\n\n return pd.get_dummies(_df[categorical]).as_matrix()", "def matrix_to_df(self, matrix):\...
[ "0.58742857", "0.57825476", "0.5768895", "0.5562386", "0.55238354", "0.54491615", "0.53972524", "0.5329923", "0.5274868", "0.52647036", "0.52502227", "0.52053165", "0.51893824", "0.5181201", "0.5170797", "0.5161874", "0.51594716", "0.51573044", "0.5128847", "0.51116765", "0.5...
0.66510737
0
filter the image and save the result as a csv file
def imgFiltering(inputPath, outputPath): # open the target image pollenImg = IJ.openImage(inputPath) # Create duplicator duplicator = Duplicator() # Duplicate the image with channel 1 pollenImgCopy = duplicator.run(pollenImg, 1, 1, 1, 1, 1, 1); # set auto threshold # IJ.setAutoThreshold(pollenImgCopy, "De...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def on_export_button(self, event):\n wildcard = \"Filtered _iso_res_filt.csv file (*_iso_res_filt.csv)|*_iso_res_filt.csv|\"\\\n \"All files (*.*)|*.*|\"\n defFile = self.datafile[:-4]+'_filt.csv'\n dlg = wx.FileDialog(\n self, message=\"Save file as ...\", \n ...
[ "0.6195798", "0.61254895", "0.5946263", "0.59112185", "0.5837011", "0.5790374", "0.5749113", "0.57250893", "0.5625944", "0.5572009", "0.55635005", "0.5544806", "0.55321425", "0.5524365", "0.55161524", "0.55154794", "0.5462615", "0.5460904", "0.5455873", "0.5453192", "0.543926...
0.6693839
0
Computes euclidian distance between two given poses (Pose2D)
def get_distance(pose1, pose2): return math.sqrt((pose1.x-pose2.x)**2+(pose1.y-pose2.y)**2)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_dist(pose1, pose2):\n return math.sqrt((pose1.position.x - pose2.position.x)**2 + (pose1.position.y - pose2.position.y)**2 + (pose1.position.z - pose2.position.z)**2)", "def dist(pose1, pose2):\n # type: (Pose, Pose) -> float\n dpose = pose2 - pose1\n dpose[2] = min(dpose[2], 2*np...
[ "0.7993743", "0.7844539", "0.77820235", "0.76284885", "0.76284885", "0.7592175", "0.7592175", "0.74816436", "0.74566495", "0.7352974", "0.72799915", "0.7242284", "0.72394544", "0.72288066", "0.7199856", "0.7185241", "0.7141375", "0.7077013", "0.70491886", "0.7040704", "0.7033...
0.79817235
1
Create a pipeline for loading and transforming match data for test estimator.
def create_fake_pipeline(*_args, **_kwargs): return Pipeline( [ node(match.clean_match_data, "fake_match_data", "clean_match_data"), node( common.convert_match_rows_to_teammatch_rows, "clean_match_data", "match_data_b", ), ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_fit(self, pipeline):\n pipeline.fit(X, Y)", "def pipeline(root):\n _ = (\n root | \"Create test files\" >> beam.Create(test_files)\n | \"Read test files\" >> beam.FlatMap(read_file)\n | \"test Shuffle\" >> beam.Reshuffle()\n | \"Preproc test docs\" >> beam.FlatMap(p...
[ "0.6557523", "0.6494715", "0.6476371", "0.6333137", "0.63053614", "0.6302641", "0.6296464", "0.6286704", "0.62591994", "0.62531483", "0.6242583", "0.6208381", "0.62034816", "0.61907303", "0.6186131", "0.61661327", "0.615285", "0.6148847", "0.6147298", "0.61246485", "0.6118522...
0.7160616
0