query_id
stringlengths
32
32
query
stringlengths
9
4.01k
positive_passages
listlengths
1
1
negative_passages
listlengths
88
101
90da290424ff6c0b0ec779d425a34e69
Tells if the cover is closed or not.
[ { "docid": "94be06c29ccedfac3b40d3085291a36e", "score": "0.7914196", "text": "def is_closed(self) -> bool | None:\n return self.coordinator.get_cover_state(self._device.endpoint_id).position == 0", "title": "" } ]
[ { "docid": "6bc50b64b9fd4d10972a8ac37d487483", "score": "0.83833516", "text": "def is_closed(self) -> bool:\n return self.current_cover_position == 0", "title": "" }, { "docid": "5b2d57a7fa5eef813ddc71cf7b48801e", "score": "0.8137329", "text": "def is_closing(self) -> bool | N...
71c049b254e653c937237ed6a9da8422
getVocabCount returns the number of unique keys within a master dictionary.
[ { "docid": "f67ac3977e8f08ef4acbe84d187a2d7b", "score": "0.81111103", "text": "def getVocabCount(data):\r\n return len(data.keys())", "title": "" } ]
[ { "docid": "f33fcc86d003bd7cd3980d7071d16b9b", "score": "0.703855", "text": "def vocab_count(corpus):\n\n flatten_sequence=[i for j in corpus for i in j]\n vocab_counter=Counter(flatten_sequence)\n return vocab_counter", "title": "" }, { "docid": "12139c8bea7b2e2b2212431dd452c485", ...
cb2bee471fe9022f5ccc69799cb945ac
Visualizes the board by printing the contents of the cells ++ |B T| < That is a cell; T represents the item on top ++ B represents the item on the bottom
[ { "docid": "9652f13837aa4d3ed343007b1b611e42", "score": "0.77480453", "text": "def draw(self):\n border = \"+---+\"\n item = \"|{} {}|\"\n\n def draw_all_border():\n \"\"\"\n prints '+---+' times the number of cols\n specified in NUM_COLS\n ...
[ { "docid": "83d45ba96060002fd66381146b94dcc9", "score": "0.79420996", "text": "def render_board(self):\n\n # this prints the top and bottom boundaries,\n # an in between renders '*' + row cells + '*'\n # for each row on the board\n print('*'*(self.width+2))\n for row...
74553c2a9c9e131ccdb7c35572865c13
Exit when the Python version is too low.
[ { "docid": "0e40d912964040f4de81dfc0a64f14d6", "score": "0.81366885", "text": "def check_python_version():\n if sys.version_info < MINIMUM_PYTHON_VERSION:\n sys.exit(\"Python {}.{}+ is required.\".format(*MINIMUM_PYTHON_VERSION))", "title": "" } ]
[ { "docid": "be7a125e9493d1fb55458bf7b214668a", "score": "0.8035704", "text": "def verify_python_version(major_version: int, minor_revision: int)-> None:\n if (major_version, minor_revision) > sys.version_info:\n message: str = f\"This program can only be run on Python {major_version}\" \\\n ...
1de74d3420e875c832d2504b4f8f75b4
send request to gateway and see what happens
[ { "docid": "819dd0c5c231a4caec4b1d38d80b0574", "score": "0.5543378", "text": "def _send_request(gateway_port, protocol, request_size=1):\n c = Client(host='localhost', port=gateway_port, protocol=protocol)\n res = c.post('/foo', inputs=DocumentArray.empty(2), request_size=request_size)\n assert...
[ { "docid": "d7599c2466337c11497f121f43b7029e", "score": "0.68202937", "text": "def send(self, request : str):\n pass", "title": "" }, { "docid": "2102a2b11d82925d33626cb88db9f718", "score": "0.66711557", "text": "def _send_in_request(self):\n try:\n req_param...
ce64364992c6bc20f154f3764ce0f11e
prints info about the state
[ { "docid": "9b891587e8aaf264f0bf683b7daea014", "score": "0.0", "text": "def print_info(self, as_str: bool = False, file: TextIO = None) -> str:", "title": "" } ]
[ { "docid": "6b63db4d1dd56ad5a154cab28942a6a9", "score": "0.8899063", "text": "def print_state():\n ...", "title": "" }, { "docid": "a2ad2d1917f408c900da9218030ba604", "score": "0.84972256", "text": "def print_state(self):\n print(self._state)", "title": "" }, { ...
bcc11dc5d3ed124862ba585c4e4fd20e
Should answers if the single point (x, y) is on black.
[ { "docid": "7e9f388570f8d4b23da6bdcf5714d9a2", "score": "0.0", "text": "def onBlack(self, p, path=None):", "title": "" } ]
[ { "docid": "e049a1e2d55a6aa4ff11eeaa97d59aa3", "score": "0.6627004", "text": "def IsByColor(self) -> bool:", "title": "" }, { "docid": "e049a1e2d55a6aa4ff11eeaa97d59aa3", "score": "0.6627004", "text": "def IsByColor(self) -> bool:", "title": "" }, { "docid": "6ba50191159d...
8141ad562afe95aa356d6a6fbfb33095
Return the index of the last occurrence of obj in seq
[ { "docid": "252c38dee4f187c3fdc4cbe11e021502", "score": "0.86840785", "text": "def lastIndexOf(obj, seq):\n try:\n if __version__ < 2.6:\n for index in (i for i in xrange(len(seq) - 1, -1, -1) if seq[i] == obj):\n return index\n else:\n return next((...
[ { "docid": "6d108c14eef57a621782cb5c243aeb17", "score": "0.6792807", "text": "def indexOf(obj, seq):\n try:\n if __version__ < 2.6:\n for index in (i for i in xrange(len(seq)) if seq[i] == obj):\n return index\n else:\n return next((i for i in xrange...
4b94c59b0a2448d4d51330e6a6f17910
Cuts the string at the last dot '.' . The return has a proper ending.
[ { "docid": "ecbea9709a6f94d312c1fe08e166c133", "score": "0.7466881", "text": "def endSentence(string): \n\tind = string.rfind('.')\n\treturn string if ind == -1 else string[0:ind+1]", "title": "" } ]
[ { "docid": "91a5a97e7735f1fa13c411c46141835d", "score": "0.69080025", "text": "def get_suffix(filename, has_dot=False):\n\tpos = filename.rfind('.')\n\tif 0 < pos < len(filename) - 1:\n\t\tindex = pos if has_dot else pos + 1\n\t\treturn filename[index:]\n\telse:\n\t\treturn ''", "title": "" }, {...
768a424a7fbaf8e532540aedfefb3526
Load rules from database
[ { "docid": "df8400c592d652b7f4d401077a1a95a7", "score": "0.6805147", "text": "def load_rules(self):\n self.logger.debug(\"Loading rules\")\n self.rules = {}\n self.back_rules = {}\n nr = 0\n nbr = 0\n for c in EventClass.objects.all():\n if c.disposit...
[ { "docid": "a468dffbce4892037f26c4c154e990e6", "score": "0.6632937", "text": "def load_rules(self, force_reload=False):\n self.enforcer.load_rules(force_reload)", "title": "" }, { "docid": "7042a162636269b04044cde3ba146696", "score": "0.66135895", "text": "def handle_rules():\...
1bf5a427d9751c3d3ea5fc7078d6316d
Initial method for PFEMElementCompressible
[ { "docid": "1c4bd45509485b8c3ba8ce1f0be94cbf", "score": "0.0", "text": "def __init__(self, osi, ele_nodes, rho, mu, b1, b2, thickness, kappa):\n self.osi = osi\n self.ele_node_tags = [x.tag for x in ele_nodes]\n self.ele_nodes = ele_nodes\n self.rho = float(rho)\n self...
[ { "docid": "44a31e94dea9ad3f6f0a37de5a8aeb34", "score": "0.6386662", "text": "def compress(self, *args, **kwargs): # real signature unknown\n pass", "title": "" }, { "docid": "6f4c1934e03e72884567ccec72b36dec", "score": "0.6303826", "text": "def TransformCompress(deck, entity...
36aed014ebb5272053f13d612b4487c6
A header with the contents of headerName must exist. The match takes place whether or not the request's header has a value.
[ { "docid": "290bfb9ada89baa1712c649d5090e93b", "score": "0.0", "text": "def present_match(self) -> Optional[bool]:\n return pulumi.get(self, \"present_match\")", "title": "" } ]
[ { "docid": "a03941438ea712611c36539805b0d33a", "score": "0.7539977", "text": "def verify_header(headers, header_name, header_value):\n matching_headers = list()\n\n for header in headers:\n if header[0] == header_name:\n matching_headers.append(header)\n\n # Hmmm....\n if l...
bad8a2eb03ed3c9eac0d82fdf186d7d7
Passes XML file to get_hosts_details_list(), expects a dictionary. For nodes which sgeexecd isn't running, np_load_avg is '', this function checks for such instances.
[ { "docid": "a5b253859bb36d436f01120784621e21", "score": "0.5170468", "text": "def seek_ooc_nodes(xmlfile):\n\n # Passes XML file get_hosts_details_list() for parsing.\n hosts_lists = get_hosts_details_list(xmlfile)\n\n # Dictionary of out of circulation nodes.\n ooc_nodes = {}\n\n for nod...
[ { "docid": "4df47758b7d2ee9b8c0d07074529331c", "score": "0.62492794", "text": "def get_hosts_details_list(xmlfile):\n\n findall_hosts = []\n\n try:\n dom = ElementTree.parse(xmlfile)\n except Exception, e:\n print(e)\n else:\n # Find all hosts in dom.\n findall_ho...
4260c860a2adc3fb1078bafeeb794104
transfer time_str to seconds
[ { "docid": "b2e90d66a3adcda65cc4efdb98bc1a62", "score": "0.751273", "text": "def to_second(time_str):\n format_time_str = \"%s-%s-%s %s:%s:%s\"%(\n time_str[0:4],\n time_str[4:6],\n time_str[6:8],\n time_str[8...
[ { "docid": "f14a4ed4850f99c6f69590e97d5ffd04", "score": "0.8461396", "text": "def seconds_from_string(time_str):\n h, m, s = time_str.split(\":\")\n return int(h) * 3600 + int(m) * 60 + int(s)", "title": "" }, { "docid": "57a8ff0914734f63ca6a05afa09ad6dc", "score": "0.79744...
bd7aea159980b3602622f3dfae95db5f
Ensure the storage directories has the same tags as specified for the table in src_table_tags. Location for storage is looked up in hive server.
[ { "docid": "2b4e011e0066b1b71fda618179c169c4", "score": "0.61331445", "text": "def sync_table_storage_tags(self, src_table_tags, clear_not_listed=False):\n self.worklog = {}\n run = 0\n while True:\n try:\n run += 1\n self.ensure_tags_in_atla...
[ { "docid": "3c70b31b4047e9d45943652a4e2857e5", "score": "0.7110176", "text": "def _sync_tags_for_one_tables_storage(self, schema, table, expected_tags):\n storage_url = self.hive_client.get_location(schema, table)\n if storage_url is not None:\n guid = self.atlas_client.add_hdfs...
7c446390108b5b78d1dda6462a45bbe7
import_list takes an uploaded file ad inserts it into a previously created list. It requires an account id, list id, fields, data id, delimiter and if using an excel file, the sheetname.
[ { "docid": "fa93b532e1ea93d2c7fab4b532fb56de", "score": "0.81622994", "text": "def import_list(accountId,listId,fields,dataId,delimiter,sheetName='0'):\n\tn = 1\n\tglobal importRequestBody\n\timportRequestBody = '<Parameters><DataId>'+dataId+'</DataId><FieldMappings>'\n\tfor field in fields:\n\t\timport...
[ { "docid": "402435b65c3e242f259e34c97077a19b", "score": "0.706584", "text": "def list_from_file(accountId,fileName,fileFormat):\n\tglobal fields\n\tglobal listId\n\tglobal listName\n\tglobal delimiter\n\tlistName = fileName.split(\"/\")\n\tlistName = listName[1].rstrip('.csvxtl')\n\tif fileFormat == 'cs...
64445d11317cada3dd6527bb5d7d08db
Change the theme of the UI. Settings are saved in settings,prop `Press Ctrl + D`
[ { "docid": "82e3f70bf59b9b6b496daf00c2ccbbb8", "score": "0.75060755", "text": "def changeTheme(self):\n dump(not dark, \"settings.prop\")\n self.__init__()", "title": "" } ]
[ { "docid": "c51fe62d907454b4e0ecd0cc6a0ca4b7", "score": "0.7390407", "text": "def themes_button_pushed():\n theme = self.settings.value(\"theme\", \"dark\")\n if theme == \"dark\":\n theme = \"light\"\n self.settings.setValue(\"theme\", theme)\n ...
e1a9830fb6a965c312254b2ffd48274b
convert v at DH grid points to v in SH
[ { "docid": "a56c130749e423fb5b19c7cbab86ff38", "score": "0.7078962", "text": "def v2vSH(self, v, l_max=None):\n lm = (v.shape[0]-2)//2\n if l_max is not None:\n lm = min(l_max, lm)\n return _sht.shtools.SHExpandDH(v, norm=1, sampling=2, csphase=1)[:,:lm+1,:lm+1]", "ti...
[ { "docid": "363f89814917abaaee26ce35a157690e", "score": "0.69157463", "text": "def vSH2v(self, vSH, l_max=None, Nth=None):\n if Nth is None and l_max is None:\n l_max = self._get_lmax(vSH)\n Nth = l_max * 2 + 2\n lm = l_max\n elif Nth is None:\n ...
6e0f3a9a52edcea73856d83f939359f1
Hit the CKAN REST API for an ISO 19139 XML representation of a package with data uploaded into the datastore.
[ { "docid": "6ecbc6fab3063de593ebbb7655738681", "score": "0.5573738", "text": "def get_record(context, repo, ckan_url, ckan_id, ckan_info):\n query = ckan_url + 'package_iso/object/%s'\n url = query % ckan_info['id']\n response = requests.get(url)\n try:\n xml = etr...
[ { "docid": "983b2cf26fb95740b519f798a2f78874", "score": "0.5985983", "text": "def package(request, name):\n raw_data = api_data.data_cve_circl(name=name)\n fields_names = ['id', 'summary', 'cvss']\n extracted_data = api_data.extract_fields(raw_data, fields_names)\n\n return HttpResponse(json...
7193ad479e923837663da261e3082151
Create and return a new event_book
[ { "docid": "f7d629676eb2c844f672df6e3a2c4758", "score": "0.8405833", "text": "def create_event_book(event, book):\n\n event_book = EventBook(isbn=book.isbn, event_id=event.id)\n\n db.session.add(event_book)\n db.session.commit()\n\n return event_book", "title": "" } ]
[ { "docid": "0d292365bac8582a6c8931c41917df02", "score": "0.6702231", "text": "def create_book(self, title):\n new_thing = Book(NumbID.new_id(), title)\n self.item_list.add_item(new_thing)\n pass", "title": "" }, { "docid": "0d7fc8fb973dd13dfc3a4eff6b4d5358", "score":...
c8fc14f8dd58de6ef45b4f8ce90e979c
Fetches a list of all networks for a tenant
[ { "docid": "f7cd8cb047bcf67a3e404398ccc8b010", "score": "0.7156412", "text": "def list_networks(self):\n return self.do_request(\"GET\", self.networks_path)", "title": "" } ]
[ { "docid": "5484cad849024a381fec2e39ae0ed61d", "score": "0.72490734", "text": "def networks_get(self, max_retries=REST_API_MAX_RETRIES):\n return self.__get(\"%s/networks\" % self.__base_mgmt_url,\n max_retries=max_retries)", "title": "" }, { "docid": "0081c7e4551977b...
b1e368a6bd73daaa5b5b06167e0ebb87
Return the character c asis, unless it is a metacharacter, in which case return it preceded by a backslash
[ { "docid": "1bfd2d0c84b7972ab5a4ab6000d7accc", "score": "0.77703065", "text": "def escape(c):\n return RE.backslash + c if c in RE.metacharacters else c", "title": "" } ]
[ { "docid": "75fbacca7dae2d88620bdcaad170b4ea", "score": "0.6689678", "text": "def parse_escaped_string_char(c):\n if not c:\n fatal_error(\"found EOF while reading a string\")\n if c == \"\\\\\":\n result = \"\\\\\"\n elif c == '\"':\n result = '\"'\n elif c == \"b\":\n r...
59229feb1e25dc424b9d82333814ddb8
Select and operate a set of commands
[ { "docid": "ab9587793bb4325face4533f44adb4f5", "score": "0.6718301", "text": "def send_select_and_operate_command_set(self, command_set, callback=opendnp3.PrintingCommandResultCallback.Get(),\n config=opendnp3.TaskConfig.Default()):\n self.master.SelectA...
[ { "docid": "2df849345075724f9350c6a92d703750", "score": "0.6681098", "text": "def __execute_cmd(self, selection):\n \n if selection == 1: \n self.__cmd_display_vehicle_types()\n elif selection == 2:\n self.__cmd_display_vehicle_costs()\n elif selection ...
f29e15f6b34b7bdcb12e1ab3ecd86024
gets the last pressed state and resets it
[ { "docid": "1e1f3947c6998210f9efe61fc0149b7b", "score": "0.73674", "text": "def getLastPressedState(self):\n theLastPressedState = self.lastPressedState\n self.lastPressedState = self.ButtonPressStates.NOTPRESSED\n return theLastPressedState", "title": "" } ]
[ { "docid": "e1d14403759ef02d19bb64bfa64507ee", "score": "0.69121516", "text": "def checkLastPressedState(self):\n return self.lastPressedState", "title": "" }, { "docid": "e4a783ab340dec881532a8b02984d7cc", "score": "0.6591248", "text": "def _changeInactive(self):\n key...
c9fc8d8d5b393f521beefd7d79414612
Check if this LogicSigAccount has been delegated to another account with a signature.
[ { "docid": "a894643b41f72a73529af925ad7ad05b", "score": "0.6835205", "text": "def is_delegated(self) -> bool:\n return bool(self.lsig.sig or self.lsig.msig)", "title": "" } ]
[ { "docid": "e172a971baae36258682374bfad7d59d", "score": "0.575139", "text": "def is_delegated(self):\n return self.assignee is not None", "title": "" }, { "docid": "b3343719ba5f73dc3fc53a6dc830f486", "score": "0.5476073", "text": "def is_delegate(self, user):\n if not u...
6f7ce6571a86f179bb4246d10c8acc4f
Returns a set of value names that pass the criterion.
[ { "docid": "e03dc704da494c380ed9af2336a1f730", "score": "0.0", "text": "def filter_value_to_type_binding(self, binding):\n named_field_list = [\n (field_value.name, field_value.field)\n for field_value in binding.value_list]\n return self._filter(named_field_list)", ...
[ { "docid": "0954cc11dbfe4d93f4f957957eafcd7f", "score": "0.64739496", "text": "def get_values(self, attr_name):\n ret = set(self._attr_value_cdist[attr_name].keys()\n + self._attr_value_counts[attr_name].keys()\n + self._branches.keys())\n return ret", ...
9ad8828fd1d1d0cab49175a179fc50d1
Return a list of port names.
[ { "docid": "ab5f584700a931b565950f95db72a7b6", "score": "0.7265796", "text": "def keys(self):\n return [port.name for port in self]", "title": "" } ]
[ { "docid": "4477977bfbec33537b48c10c569677ff", "score": "0.83994097", "text": "def get_ports(self):\r\n return self.namelist", "title": "" }, { "docid": "b4ccc8436a78d6a7f02a88b434b05fda", "score": "0.80273235", "text": "def ports(self) -> Sequence[str]:\n return pulumi...
2e3756a1e27c85a27925bd99fe1d47a3
Initialize a new network
[ { "docid": "da32c712e706dee654950e6a6ce22ddd", "score": "0.0", "text": "def __init__(self, feature_sizes, continuous_field_size, embedding_size=4,\n hidden_dims=[128, 128], use_fm1=False, num_classes=10, dropout=[0.5, 0.5],\n use_cuda=True, verbose=False):\n super(...
[ { "docid": "86cca404ef0f66cb8aeddc2e1a86b18d", "score": "0.856658", "text": "def init_network(self):\n self.net = network.Network([784, 30, 10])\n return(\"made a network yo\")", "title": "" }, { "docid": "66a311e8cd13327d8498e7017d8bf118", "score": "0.8541491", "text":...
27df6b814fe3dd43223050a9a8f7231b
Memoize an expensive computation as a property of an object
[ { "docid": "9336f3465d63239701943e1ee62370fc", "score": "0.65158", "text": "def memoized_property(name=None):\n def memoized_decorator(f):\n @property\n @wraps(f)\n def wrapper(self):\n cached_name = name\n if name is None:\n cached_name = \"_...
[ { "docid": "c6d11056d507385cd7ed343e3a13b958", "score": "0.7218838", "text": "def memoize(obj):\n cache = obj._cache = {}\n\n @functools.wraps(obj)\n def memoizer(*args, **kwargs):\n key = str(args) + str(kwargs)\n if key not in cache:\n cache[key] = obj(*args, **kwargs...
934b19fce364275d066951c97d409937
Tests the default credential values, and also the AttributeError mechanism.
[ { "docid": "77e6af9a04b26d3bd156e277a5cd3c28", "score": "0.79476535", "text": "def test_credential_default_values():\n creds = Credentials()\n assert creds.url is None\n assert creds.token is None\n assert creds.org_key is None\n assert creds.ssl_verify\n assert creds.ssl_verify_hostna...
[ { "docid": "922fa2958aad9658ef8a568eeae6abc2", "score": "0.7252466", "text": "def test_attribute_defaults(self):\n creds = NokiaCredentials()\n self.assertEqual(creds.access_token, None)\n self.assertEqual(creds.token_expiry, None)\n self.assertEqual(creds.token_type, None)\n...
ee1068b325a01087d8763130e600b894
Perform data extraction, geocoding, analysis, and rendering.
[ { "docid": "a0905a75696c2d5f05df9afb5332cecb", "score": "0.0", "text": "def aorta(filename, attribute, maxl, minl, v1, v2, v3, lb, sb):\r\n global start\r\n global stop\r\n lb.configure(text='Reading File')\r\n df = pd.read_csv(filename)\r\n df = df.drop(0)\r\n\r\n df['Date'] = pd.to_d...
[ { "docid": "284d7694dea5621aaa51c881c1394f8b", "score": "0.67977667", "text": "def run(self):\n self.prepare()\n self.extract()\n self.transform()\n self.load()\n self.finalize()\n pass", "title": "" }, { "docid": "c476f77c1cdbb522f954f429c6a30600", ...
d9cf02e19c112c1bbb11bbb69e3a7402
GET /reports/new/ must return status code 200
[ { "docid": "63920f5807fbde4b4725d59f0dcc6378", "score": "0.0", "text": "def test_get(self):\n self.assertEqual(200, self.response.status_code)", "title": "" } ]
[ { "docid": "b03f4adc79057fbdaa7d623898943a07", "score": "0.63913965", "text": "def test_create_invalid_report_admin(self):\n request = self.factory.post(\n '/api/inventories/', {})\n force_authenticate(request, user=self.test_admin)\n response = InventoryReportListCreateV...
eb453cae7da383dd193905d275001909
View the reputation points leaderboard.
[ { "docid": "29930feaccab07b2952f3ab60de65a3e", "score": "0.7601583", "text": "async def leaderboard(self, ctx):\n leaderboard = await self.bot.database.get_top_reps()\n embed = discord.Embed(colour=EMBED_ACCENT_COLOUR)\n embed.set_author(\n name=\"Reputation Leaderboard\"...
[ { "docid": "6375733d6284707ba6aaf4b11d8578d3", "score": "0.70809627", "text": "def show_leaderboard():\n leaderboard_data = get_sorted_scores()\n return render_template(\"leaderboard.html\", leaderboard_data=leaderboard_data)", "title": "" }, { "docid": "437d7c5565d4948aa3c19c5e239cc8f...
0f56ae144be87b4aecaf10b5786b8608
Transform ref_point using same transforms as those applied to data.
[ { "docid": "9289eeb4c4a6ca5e01b8cee83ee0a20b", "score": "0.74598885", "text": "def _transform_ref_point(\n self, ref_point: Dict[str, float], padding_obs_data: ObservationData\n ) -> Dict[str, float]:\n metric_names = list(self._metric_names or [])\n objective_metric_names = list...
[ { "docid": "aafeb46b7f285a3e23a27911fa1f244f", "score": "0.7291867", "text": "def TransformPoint(self):\r\n pass", "title": "" }, { "docid": "80496a8057adef353ffb0a6fb1d02cc9", "score": "0.7044938", "text": "def TransformPoints(self):\r\n pass", "title": "" }, {...
eda41d01a55a56d65e9d5b161b5a42cc
Put entry in dct. If already there, check it's the same.
[ { "docid": "aac336579641b8bb8a0b9fd44be61b14", "score": "0.8130835", "text": "def put(dct, entry):\r\n id = int(entry['id'])\r\n if id in dct:\r\n if entry == dct[id]:\r\n pass\r\n else:\r\n print entry\r\n print dct[id]\r\n assert False\r\...
[ { "docid": "74c66a751f436991c28c48de00e0304b", "score": "0.60856813", "text": "def addEntry(self, key, dictVal):\n hashBucket = self.buckets[key%self.numBuckets]\n for i in range(len(hashBucket)):\n if hashBucket[i][0] == key:\n hashBucket[i] = (key, dictVal)\n ...
7637cc26122219aaeb441ef46942a6d2
Easy Train Test Split call.
[ { "docid": "07a292fa1648fecd88b751277960cde6", "score": "0.6491326", "text": "def TrainTestSplit(X, Y, R=0, test_size=0.2):\n return train_test_split(X, Y, test_size=test_size, random_state=R)", "title": "" } ]
[ { "docid": "338cdcf7bb94999d0d6357a807bab52c", "score": "0.7243466", "text": "def patched_train_test_split(*args, **kwargs):\n # pylint: disable=no-method-argument\n original = gorilla.get_original_attribute(model_selection, 'train_test_split')\n\n def execute_inspections(op_id, cal...
1ef65124cda4457e6d1bae66faf6be05
Asserts un usuario no puede ver la lista de comentarios de un album privado
[ { "docid": "f930d48d8b63a1bc7c65f228b0c9fa7f", "score": "0.7511498", "text": "def test_given_existing_user_when_list_comment_of_private_album_then_fail(self):\n # Arrange\n user = UsuarioFixture().create()\n \n album_fixture = AlbumFixture()\n album_fixture.default_acc...
[ { "docid": "1ceeb5fb1d2d91f655dfb3b4bfce0bb5", "score": "0.67601097", "text": "def test_given_existing_user_when_list_comments_of_public_album_then_see_comments_belong_given_album_success(self):\n # Arrange\n user = UsuarioFixture().create()\n \n album_fixture = AlbumFixture(...
334f6cdf19b6c8625c88452985f78908
The Huffman compression algorithm which compresses the symbols "000" to "111" based on their frequencies.
[ { "docid": "0c789003af40ce578fb302bf36ff424f", "score": "0.66966075", "text": "def HuffmanCompression(D: Union[np.ndarray, Dict[str, int]]) -> Tuple[Dict[str, str], DefaultDict[str, int]]:\n compressedDB = defaultdict(int)\n chars = freq = None\n # If the database is a dictionary, process it ap...
[ { "docid": "a28069afcd22e3460f263258dc2433c7", "score": "0.7296862", "text": "def encode(symb2freq):\r\n huffCode = namedtuple('huffCode', ' symbol code')\r\n lista = []\r\n heap = [[wt, [sym, \"\"]] for sym, wt in symb2freq.items()]\r\n heapify(heap)\r\n while len(heap) > 1:\r\n l...
31d033cc82d32e22921df7903354c64b
Method that generates the dataset and performs augmentation in case enabled
[ { "docid": "70c0eb3495fba542eedac61fb1518c1d", "score": "0.0", "text": "def get_dataset(config):\n # dataset statistics: https://discuss.pytorch.org/t/normalization-in-the-mnist-example/457\n data_mean = 0.1307\n data_stddev = 0.3081\n\n transforms = [torchvision.transforms.ToTensor(),\n ...
[ { "docid": "07a991037dd21221b0577b5aaca8428f", "score": "0.6980123", "text": "def test_data_augmentation():\n data = bz2.BZ2File('src/tests/dataprocessing/affectNet_sample.pbz2', 'rb')\n df = cPickle.load(data)\n\n x, y = affect.preprocess_data(df)\n x, y = affect.clean_data_and_normalize(x,...
66ac20af48f8b5e02bd54d9a86c45a5a
active_thread_priority(cfi_gen_sptr self) > int
[ { "docid": "a33e52697845d5ead872ccc46c11c439", "score": "0.85378665", "text": "def active_thread_priority(self):\n return _my_lte_swig.cfi_gen_sptr_active_thread_priority(self)", "title": "" } ]
[ { "docid": "b55d3d743ab2f15b11d8c6a1e248a910", "score": "0.83537924", "text": "def active_thread_priority(self):\n return _my_lte_swig.dci_gen_sptr_active_thread_priority(self)", "title": "" }, { "docid": "c417f577ec9e7dadad8ca80f5405b4de", "score": "0.8266334", "text": "def a...
b1d2b42da53429a0ea3c80e7d9fac1a1
the sum of ratio must equal to 1
[ { "docid": "7d1557dc3a5a1bf229ca9f2e5bc8a903", "score": "0.0", "text": "def split_Train_Test_Data(data_dir, ratio):\r\n dataset = ImageFolder(data_dir) # data_dir精确到分类目录的上一级\r\n character = [[] for i in range(len(dataset.classes))]\r\n for x, y in dataset.samples: # 将数据按类标存放\r\n charac...
[ { "docid": "e540e26756b22115e2f811ea4aad52c7", "score": "0.7472728", "text": "def ratio(self):\n pass", "title": "" }, { "docid": "e540e26756b22115e2f811ea4aad52c7", "score": "0.7472728", "text": "def ratio(self):\n pass", "title": "" }, { "docid": "e540e267...
cb561c571a88b19c636e2904f461b665
Get value of key in metadata file dict.
[ { "docid": "1d06cbe8af841874ef8e3fe11e35fef5", "score": "0.76708704", "text": "def get_from_metadata_file(cls, dirpath, key):\n fullpath = os.path.join(dirpath, cls.metadata_filename)\n if os.path.exists(fullpath):\n with open(fullpath, 'rb') as ifh:\n d = pickle....
[ { "docid": "fdcf88d1de45ebc3a51e78a7326b9fcf", "score": "0.7239693", "text": "def _get_metadata(self, key):\n try:\n val = self.pod['metadata'][key]\n except (KeyError, TypeError):\n _log.debug('No %s found in pod %s', key, self.pod)\n return None\n ...
5c5ed9a97b3694924465816aef676480
Check if all files are available before going deeper
[ { "docid": "e6972172325e0f574f4e7a7133e53c0b", "score": "0.59060025", "text": "def check_before_run(self):\n if not osp.exists(self.dataset_dir):\n raise RuntimeError('\"{}\" is not available'.format(self.dataset_dir))\n if not osp.exists(self.train_dir):\n raise Runt...
[ { "docid": "62ef37979051d2c0dbd9aa09ffc24a8c", "score": "0.72828716", "text": "def dir_ready(path): \n files = get_top_level_files(path)\n return len(files) > 0", "title": "" }, { "docid": "d9a328575ad702a323f7305f026f4507", "score": "0.6978389", "text": "def scan(self):\n ...
ca42f6eef5fe72059e7c74868c838763
Check for known face. Return True and name if a face is recognized after 10 seconds otherwise return False, this method is also able to take images with regular webcams
[ { "docid": "e19a957c878eb2968ea10a72cd00597c", "score": "0.7239366", "text": "def known_face(use_nao=True, timeout=True):\n # this stuff was in the main so I put it here\n # fileDir = os.path.dirname(os.path.realpath(__file__))\n fileDir = os.path.join(os.path.dirname(__file__), '')\n modelD...
[ { "docid": "9653a7cf0dd78e76556db5bbdf2a997d", "score": "0.7215693", "text": "def face_detection(self) -> bool:\n cascade = CascadeClassifier(data.haarcascades + \"haarcascade_frontalface_default.xml\")\n for _ in range(20):\n ignore, image = self.validation_video.read() # read...
7105b31703cb96fb21a04f9bcca0e3b7
Add track to playlist
[ { "docid": "15a26a618a8e29fa4482209cf5c63ceb", "score": "0.7280744", "text": "def _add_track(self, token, playlist_name, playlist_id):\n category_id = db.session.query(Category).filter_by(name=playlist_name).first().id\n playlist_id_db = db.session.query(Playlist).filter_by(name=playlist_n...
[ { "docid": "5a2b9c76e830e3fd25acca6023db3f2e", "score": "0.82097757", "text": "def addToPlaylist(self, track):\n #playlist must already exist - TODO: Write code to generate playlist\n playlist = self.data.find(\"/PLAYLISTS/NODE[@TYPE='FOLDER']/SUBNODES/NODE[@TYPE='PLAYLIST'][@NAME='Auto-Cu...
9fd26661050b991b6f943d1839838ff4
create spark session singleton
[ { "docid": "45cdbd6311a89744c2d5a8886058da2e", "score": "0.75396127", "text": "def create_spark_session():\r\n spark = SparkSession \\\r\n .builder \\\r\n .config(\"spark.jars.packages\", \"org.apache.hadoop:hadoop-aws:2.7.0\") \\\r\n .getOrCreate()\r\n return spark", "tit...
[ { "docid": "554b2f15e15e9ec5beee4734dc8b4df0", "score": "0.8047757", "text": "def get_session():\n return SparkSession.builder.config(conf=SparkConf()).getOrCreate()", "title": "" }, { "docid": "d6ae01809c2fbcd7f876bc0b068dd333", "score": "0.8015288", "text": "def create_spark_ses...
dbe20b962bcf7dac313794a3b2d4e57f
A utility function that tests whether the value of the next token label equals a given token label. This method consumes a token from the lexer if and only if there is a match. Either way, a boolean is returned indicating the match status. If `consume` is false then no tokens will ever be consumed. Otherwise, and by de...
[ { "docid": "51d2ad81eb6f6f9334d17ef83afa5c9e", "score": "0.75924224", "text": "def match_next(self, token_label_to_match, peeklevel=1, consume=True,\n raise_on_fail=False, raise_on_success=False,\n err_msg_tokens=3):\n # TODO: Consider a way for users to define...
[ { "docid": "9605df346bee22f91cce408c8e5a75e9", "score": "0.501809", "text": "def __consume(self, expected: TokenType, err_msg: str):\n if self.__match(expected):\n token = self.__peek()\n self.__advance()\n return token\n else:\n error_handler.parse_error(self.__peek(), err_msg...
06f5b2af157552051cd0dfb4628f5923
Method to run subprocesses. Calling this will capture the `stderr` and `stdout`, please call `subprocess.run` manually in case you would like for them not to be captured.
[ { "docid": "eb107510d71332148c82e42f766e07cc", "score": "0.5504604", "text": "def run_subprocess(\n command: Union[str, List[str]],\n folder: Optional[Union[str, Path]] = None,\n check=True,\n **kwargs,\n) -> subprocess.CompletedProcess:\n if isinstance(command, str):\n command = c...
[ { "docid": "f5688d99c31b258c8534ce6ac571aa0c", "score": "0.7337682", "text": "def captured_run(*args, **kwargs):\n proc = subprocess.run(\n *args, **kwargs, stdout=subprocess.PIPE, stderr=subprocess.PIPE\n )\n return proc.returncode, proc.stdout, proc.stderr", "title": "" }, { ...
1f4d4179cd968853da4e5fb2a6f4fb8d
Returns a logger object so that a given file can log its activity. If two loggers are created with the same name, they will output 2x to the same file.
[ { "docid": "004bc6477ad75f3b157d32bd866799bb", "score": "0.6979247", "text": "def get(name, path='activity.log', is_debug_log=False):\n # SOURCE: http://stackoverflow.com/questions/7621897/python-logging-module-globally\n\n # formatter = IndentFormatter(\"%(asctime)s [%(levelname)8s] %(module)30s:...
[ { "docid": "e56dcc006cd3c4b8ef1ffba27df2b49e", "score": "0.8057711", "text": "def get_logger(file_name:str):\n logger = logging.getLogger(file_name)\n formatter = logging.Formatter(\n \"%(asctime)s - %(name)s - %(levelname)s - %(message)s\",\n datefmt=\"%m/%d/%Y %H:%M:%S\",\n )\n ...
c472743f52030deaf5de990780590f7a
Imports string as if CSV file. This is used in unit tests
[ { "docid": "0b8aa7ad592fff084c01e1e19b36f1ec", "score": "0.6923848", "text": "def import_csv_string(self, csv_string):\n csv.register_dialect('spreadsheet', delimiter=',', quoting=csv.QUOTE_NONE)\n csv_reader = csv.reader(StringIO.StringIO(csv_string), 'spreadsheet')\n for row_key, ...
[ { "docid": "d6070672033524f9ce53baf99a3704c0", "score": "0.662369", "text": "def __importCsv(self, event):\n self.__importFile(\",\", \"csv files (*.csv)|*.csv\", \"Import CSV file\")", "title": "" }, { "docid": "33e993137b4edcc3fbd1690710fd7b72", "score": "0.6558638", "text":...
5ad97563f6b71b5c046bd4bf03b2a5ee
Tests whether the parser is able to remove accents in a sentence.
[ { "docid": "e454df3d7ba40f6d5044264afe1d6097", "score": "0.74372214", "text": "def test_parser_can_remove_accents(self):\n parser = Parser(\n \"bienvenue à lès brignoles\",\n STOPWORDS,\n ACCENTS,\n QUESTIONS\n )\n result = parser.remove_a...
[ { "docid": "89fa645e87c860f8c72a5b0778d44014", "score": "0.7088505", "text": "def test_remove_all_accent_string_with_accent(self):\r\n assert Parser().remove_all_accent(\"clélio favoccià\") \\\r\n == \"clelio favoccia\"", "title": "" }, { "docid": "dd1fa717b226a27361066e...
acc7a63206020ff5d6bb00ecbe4b662b
Returns a static stroke object for testing
[ { "docid": "dbd8f386dcf0a1a9e6e9c93e5f877671", "score": "0.67312616", "text": "def get_test_stroke():\n from freestyle.types import Stroke, Interface0DIterator, StrokeVertexIterator, SVertex, Id, StrokeVertex\n # points for our fake stroke\n points = (Vector((1.0, 5.0, 3.0)), Vector((1.0, 2.0, ...
[ { "docid": "26e01ae5b10c2afe2c53fe297785f838", "score": "0.6220379", "text": "def _get_stroke(self):\n return self._stroke", "title": "" }, { "docid": "09db3748c30cbedf546cd383e9fa9b06", "score": "0.6145492", "text": "def getDrawing1():\n\n D = Drawing(400, 200)\n D.add(...
02dd63739c339d90408253e7a3b72ff9
test user cant register twice
[ { "docid": "671b34155f4e7e9e3f48771f946fc9e0", "score": "0.77129304", "text": "def test_user_only_registers_once(self):\n\n\t\tuser_data = {'username': 'test', 'password': 'test1023'}\n\t\tresult = self.app.post('/api/v1/auth/register', data = json.dumps(user_data), content_type = 'application/json')\n\...
[ { "docid": "6cc28e7b43510fbd583a6120a419a875", "score": "0.79305637", "text": "def test_already_registered_user(self):\n\n res = self.client.post('/auth/register', data=self.user_data)\n self.assertEqual(res.status_code, 201)\n second_res = self.client.post('/auth/register', data=se...
3fb46fe5c6fa1ad110ecaa85dafd6cef
Returns the DulmageMendelsohn partition of the incidence graph of the provided variables and constraints.
[ { "docid": "b73a53526604bd10459f4662f4c284fc", "score": "0.7901976", "text": "def dulmage_mendelsohn(self, variables=None, constraints=None):\n variables, constraints = self._validate_input(variables, constraints)\n matrix = self._extract_submatrix(variables, constraints)\n\n row_pa...
[ { "docid": "657d43145eaa2baf31afc3fd98ae445c", "score": "0.57001877", "text": "def undiGraphToMarkovNetwork(graph,variables=dict(),domainSize=2):\r\n nodes=graph.nodes()\r\n cliques=getAllMaximalCliquesUndiGraph(graph)\r\n definedVariables=variables.keys()\r\n mn=gum.MarkovNet()\r\n for n...
8b6239c4aff78f55d89d8985bbe1f02d
Canonicallize the element to a uniform string
[ { "docid": "ccd7c06bcf8e2c94ec2333f1f448446e", "score": "0.0", "text": "def canon(self, e):\n s = \"\"\n # return strings based on what type the object is\n if isinstance(e, dict):\n return self._wrap_dict(self._process_dict(s, e))\n elif isinstance(e, list):\n ...
[ { "docid": "13a46b4160cfe2ea93dbb236f8134e0b", "score": "0.6361481", "text": "def canonical(self) -> str:\n return self._canonical", "title": "" }, { "docid": "19df0ba24defec0f26bc8ea0963ac6e5", "score": "0.6322695", "text": "def stringify_affiliation_rec(node):\n parts = _...
573e059c748a01c6b64a8b842d0f319b
compute the connection time based on speed and distance
[ { "docid": "74dec35c36ad2ebb90f4a0ec67e53438", "score": "0.7062803", "text": "def _compute_rsu_connection_time(self):\n\n self.contact_time = []\n for s in self.car_speed:\n speed_in_ms = s/3.6\n distance_in_m = 1000*self.rsu_distance\n self.contact_time.ap...
[ { "docid": "6481d0852a6287332ce706d3aaafdd06", "score": "0.68263894", "text": "def _get_distance_time(self):\n try:\n\n ds = my_dist_class.return_distance(self.ozone, self.dzone)\n # ds = np.ceil(\n # # self.DIST_MAT.query(\n # # \"PULocatio...
ca961428184200e1478e260d1fffe2fb
Partial pipeline for preprocessing raw doc 1. tokenize using wordbreak 2. remove punctuation, whitespace 3. lowercase
[ { "docid": "af00f352315e097ec49060a2ad363845", "score": "0.75026083", "text": "def _doc_pre_pipeline(self, doc):\n\n for token in words(doc):\n token = token.translate(self._pw_remove_table)\n token = token.lower()\n if not token:\n continue\n ...
[ { "docid": "acb41e359bfd7490763ec6f40b44b52b", "score": "0.72116965", "text": "def preprocess(self, text):\n # Split by white space\n text = text.lower()\n #words = text.split()\n\n # Do preprocessing by removing replacing tokens with empty strings\n # or changing toke...
62c4d12bee7a750060e0852cacd22721
Creates a convolutional layer for the network
[ { "docid": "12b31323bf75ffe525543ae1f187d4a8", "score": "0.6913519", "text": "def create_conv2d(self, x, w, b, stride = 1, name = None):\n x = tf.nn.conv2d(x, w, strides=[1, stride, stride, 1], padding='VALID', name = name)\n x = tf.nn.bias_add(x, b)\n return tf.nn.relu(x)", "title": "" }...
[ { "docid": "9b18c57393e3ffa0fdd332093dad271f", "score": "0.79682297", "text": "def createConvolutionLayer(inputLayer, kernelHeight, kernelWidth, channelSize, kernelCount, strideX, strideY):\r\n \r\n \r\n weights = tf.Variable(tf.truncated_normal([kernelHeight, kernelWidth, channelSize, kernelCo...
acf117360a21a1bbc9a3c05a5cf6051f
Add new remote server IP address as additional location, can be used for running dhcp server From all added locations all files on clean up will be downloaded to specific local location
[ { "docid": "fbc6e2a3d0c8f6fd90bec7e2fc231b98", "score": "0.5117198", "text": "def check_remote_address(remote_address):\n if remote_address not in world.f_cfg.multiple_tested_servers:\n world.f_cfg.multiple_tested_servers.append(remote_address)", "title": "" } ]
[ { "docid": "8e447d7652e79472a573a51834cef2af", "score": "0.6541148", "text": "def config_add_path():\n # Name of the remote\n # [positional]\n name: Option\n\n # Source path\n # [positional]\n source: Option\n\n # Destination path\n # [positional]\n dest: Option\n\n cfg = g...
11c676fc12f1e4891f99a7e1e073cb55
Calculates needed space for widget content.
[ { "docid": "de4f06c415bdf6dee842b9a400786d81", "score": "0.55907434", "text": "def sizeHint(self):\n #if not self._autosizeFlag:\n # return QSize(self.WIDTH, self.HEIGHT)\n \n self._scaleWidth = 1 # for getDistance()\n self._scaleHeight = 1\n \n ...
[ { "docid": "1155a86a800520373ac0f383fe60deba", "score": "0.6282941", "text": "def compute_size(self):\n # Get current monitor number\n screen = self.window.get_screen()\n monitor_n = screen.get_monitor_at_window(self.window.get_window())\n # and its width\n scr_width =...
0c6921aceb94749aa6b6642aaa0ea885
x = load_data() y = load_data(filename='train2014_targets.npy')
[ { "docid": "1072289ac577dec90c9674646ada4184", "score": "0.7426716", "text": "def load_data(path=data_path,filename='train2014_inputs.npy'):\n return np.load(open(path+filename,'r'))", "title": "" } ]
[ { "docid": "cfa423a7262af569aa74eecca0e47e49", "score": "0.7542153", "text": "def load_train_data():\n X = np.load('../input/X_train.npy')\n y = np.load('../input/y_train.npy')\n\n X = X.astype(np.float32)\n X /= 255\n\n np.random.seed(seed)\n np.random.shuffle(X)\n np.random.seed(s...
c9546f4c5d727301dbd5d933b1aa8c44
Return True if the coordinate zoom is within the textual range. Range might look like "110" or just "5".
[ { "docid": "5dae3fbc0dbe04dd9f431545d1a8e6dd", "score": "0.70948666", "text": "def in_zoom(coord, range):\r\n zooms = search(\"^(\\d+)-(\\d+)$|^(\\d+)$\", range)\r\n \r\n if not zooms:\r\n raise Core.KnownUnknown(\"Bad zoom range in a Sandwich Layer: %s\" % repr(range))\r\n \r\n mi...
[ { "docid": "ee8bba99b5ecbbc0604f016688a089fc", "score": "0.6414671", "text": "def is_latlongzoom(instr):\n return (re.match(r'^\\s*[0-9.+-]+\\s*,\\s*[0-9.+-]+\\s*,\\s*[0-9.+-]+\\s*$', instr) != None)", "title": "" }, { "docid": "22f45d12935bef870772e66811690144", "score": "0.63187474", ...
5c183dd391f4ef6a5586df5028e5cc42
Annotate the plot with spectra line identifications.
[ { "docid": "1eb1271c99282ddc0be6fe229f840681", "score": "0.623306", "text": "def annotate_lines(self, lines):\n # lines is list of tuple (obswlen, name)\n (xlow, xhigh) = self.axplot.get_xlim()\n (_, yhigh) = self.axplot.get_ylim()\n ypos = yhigh * 0.8\n ydelta = yhigh...
[ { "docid": "517a5732970aff8a8cc25ea11fa467ec", "score": "0.64772844", "text": "def plt_spec_lines():\n\n for i in range(0, Molecule.species_count):\n mid_line = (Molecule.right_endpt[i] + Molecule.left_endpt[i]) / 2\n shift1 = Molecule.energy[i] - PlotParameter.energy_vshift\n sh...
3299d307690f88859f4f8c980929956f
Helper that makes ul's of survivors.
[ { "docid": "1221daa2f16253cbc0088a3ef29be390", "score": "0.52719736", "text": "def generation_html(children_list, recursion=False):\n output = '<ul>\\n'\n if children_list == []:\n return \"\"\n for child in children_list:\n...
[ { "docid": "f12da939bd31f73d3f45c0a8db6ef9c1", "score": "0.5558531", "text": "def survivor(names, step):\n\n\tx = step - 1\n\tnext = step - 1\n\n\twhile len(names) > 1:\n\t\tnames.pop(next)\n\t\tnext = (next + x) % len(names)\n\treturn names[0]", "title": "" }, { "docid": "a00d9d1b2b4a136f1c...
7df19a930475e0746a2207f71f3a444d
check that detect zero parameters works
[ { "docid": "5f0d8fb03363c103de54e05bdf38ccf2", "score": "0.0", "text": "def test_detect_special_parameters(self): \n \n expected = set(['I3x32', 'etaWS', 'conjg__CKM3x2', 'CKM1x2', 'WT', 'I1x32', 'I1x33', 'I1x31', 'I2x32', 'CKM3x1', 'I2x13', 'I2x12', 'I3x23', 'I3x22', 'I3x21', 'conj...
[ { "docid": "17b43d7805ad3ca46fd86dec2647d914", "score": "0.75550795", "text": "def _getzero_check(self):\n raise NotImplementedError", "title": "" }, { "docid": "5eb4d97ff5ea5e534d14ab8d79542583", "score": "0.68417084", "text": "def is_zero(self):\n raise NotImplemented...
7758ec47526a6a5d91f6c907195b382e
Decorator to register config source. Configuration source is a callable with one required argument configuration object to populate. It may have other required and optional arguments.
[ { "docid": "61adbc54e1fc95858d9a24d3a7aabc04", "score": "0.72159165", "text": "def config_source(source, config_type='dict', force=False):\n def wrapper(f):\n group = _config_sources[config_type]\n if source in group and not force:\n raise AssertionError('Already registered: ...
[ { "docid": "4a7b79b255267a1c1647426b5c034cae", "score": "0.6829033", "text": "def with_config_source(self, config_source):\n self.add_config_source(config_source)\n return self", "title": "" }, { "docid": "7b897da9424b7612ad6f0a34ce951dc2", "score": "0.62327915", "text"...
2826709e18c7c69a2f13705c2b42a249
Check whether given key exists in the storage.
[ { "docid": "fa29db7f0ddd9ddbcc8d10b0643c2c42", "score": "0.8047286", "text": "def exists(self, key):\n raise NotImplementedError", "title": "" } ]
[ { "docid": "d342848cde6652d44924809003edcf8c", "score": "0.8223379", "text": "def exists(self, key):\n return key in self.store", "title": "" }, { "docid": "f6e7f2c042f51cced36d1e93683ef87a", "score": "0.80804545", "text": "def key_exists(self, key):\n return self.get_c...
5cf519e7b3d733d205b310c40cab2f3b
Builds the ServerSet based on the string passed to the function
[ { "docid": "56892db44aaf227b717a6ba7dee89fd5", "score": "0.5113373", "text": "def from_slurm_list(cls, string:str):\n servers = []\n partition = []\n regex = r\"([a-z]+)(\\[(\\d+,?|\\d+[-]\\d*)+\\]|\\d)\"\n for name, whole, _ in re.findall(regex, string):\n partiti...
[ { "docid": "c698ba992fc665300714d3a85cffef5b", "score": "0.53885657", "text": "def _make_set(var):\n if var is None:\n return set()\n if not isinstance(var, list):\n if isinstance(var, str):\n var = var.split()\n else:\n var = list(var)\n return set(va...
30ac5fa669a8ecd7bc7812f2e763041d
convert angular distance, position angle, and instrument rotator angle to position on the cold plate
[ { "docid": "9091d304b7eb567d5fa388cb8a5d44b2", "score": "0.0", "text": "def _addpad2xy(ang_dist_d, p_ang_d, inr_d):\n t = 90.0-(p_ang_d-inr_d)\n x = np.cos(np.deg2rad(t))\n y = np.sin(np.deg2rad(t))\n return x, y", "title": "" } ]
[ { "docid": "5a178f5d0c1537269618fad5b084c085", "score": "0.6049731", "text": "def translate_and_rotate(detection_coverage,center,index,angle):\n lobe = detection_coverage[index].lobe\n return translate(rotate(lobe,angle),center)", "title": "" }, { "docid": "3a8815282d60d9031b5edccbf093...
0b92ad0a1411b245bfc5ee1adb466918
Sets the orph_acode of this AllClinicalEntityInner.
[ { "docid": "95cd10116ad403c0000388a633f69d17", "score": "0.8471786", "text": "def orph_acode(self, orph_acode: int):\n\n self._orph_acode = orph_acode", "title": "" } ]
[ { "docid": "070880d3e8e73536ab931ec7c6ecbd7b", "score": "0.68790334", "text": "def orph_acode(self) -> int:\n return self._orph_acode", "title": "" }, { "docid": "1e1c422fd06122e03b7e28f3701dd8b8", "score": "0.58737314", "text": "def alcohol_nambca_code(self, alcohol_nambca_co...
270edec675db2162eb577ddf0a3627a6
Processes a PHEME tweet topic
[ { "docid": "efd8bf64eae990a5ff2be51184961626", "score": "0.0", "text": "def processCategory(path):\n return [processTweetFolder(path + '\\\\' + tweetFolder, tweetFolder)\n for tweetFolder in os.listdir(path)]", "title": "" } ]
[ { "docid": "ec2d35081a91dc4331f1f408c47b8ac5", "score": "0.6758134", "text": "def process_tweet(tweet):\n data = {'cmd': None,\n 'player': None,\n 'id': None,\n 'flag': None}\n text = tweet.full_text.lower()\n parts = text.split()\n\n # if the tweet has more ...
687306ade1c3e9045e854107329a2b13
Solves the linear equation system ax = b for x. Inputs
[ { "docid": "3e2a107766d9ac334518820327d3047d", "score": "0.58857983", "text": "def linearsolver(a, b):\n n, k = a.shape \n augmented = np.c_[a, b] # augment coeff matrix with constants\n # ranks\n rank_a = np.linalg.matrix_rank(a)\n rank_augmented = np.linalg.matrix_rank(augmented)\n ...
[ { "docid": "2d9985fbf8b50443a132f1b5e0cef9bb", "score": "0.8001566", "text": "def LinearEquationSolver(A, b):\n return solve(A,b)", "title": "" }, { "docid": "6aa2401580e0cacb84c3e48056587f51", "score": "0.78103673", "text": "def linear_equation_solver(A, b):\n A = np.array(A)\...
4c4319526216d75cad864ec588286e07
Initialize and archive a directory.
[ { "docid": "32f305018df589536570c77793b3707f", "score": "0.7136352", "text": "def _zip_directory():\n # compress directory\n shutil.make_archive(path, ZIP, path)\n\n # delete uncompressed directory\n if remove:\n shutil.rmtree(path)", "title": "" } ]
[ { "docid": "1962984ac69b2fae8fc56421507535c0", "score": "0.66676486", "text": "def _unzip_directory():\n if not os.path.exists(archive_path):\n os.mkdir(archive_path + \"/\")\n shutil.unpack_archive(\"%s.%s\" % (archive_path, ZIP), extract_dir=archive_path)", "title": "" }...
20caadb329100a99690e943e8f6c8a1c
r"""Creates a new ConsumerGroup in a given project and location.
[ { "docid": "83b634c97e7afe7f1c7783396b29643e", "score": "0.0", "text": "def Create(self, request, global_params=None):\n config = self.GetMethodConfig('Create')\n return self._RunMethod(\n config, request, global_params=global_params)", "title": "" } ]
[ { "docid": "26ed96200cd06ef37e551ffd0f266087", "score": "0.66833925", "text": "def create_group(self, name, description=None):", "title": "" }, { "docid": "4dcac98d45f9863597f62c26f4108fc2", "score": "0.632166", "text": "def create_rg(self):\n azure_cli_run(\"group create -l {...
9d4222829eb58cdfc1cf654e4354aac9
Calculate Brightness Temperature Again, you'll have to access appropriate metadata variables by their index number.
[ { "docid": "5846bf56d5212a0821deb9e3554955c7", "score": "0.0", "text": "def bt_calc(rad, var_list):\n bt = (var_list[3] / np.log(var_list[2]/rad) + 1) - 273.15\n return bt\n #plt.imshow(bt, cmap='RdYlGn')\n #plt.colorbar()", "title": "" } ]
[ { "docid": "b6e43d70f458cfb622bd4efcd671dbb0", "score": "0.6685459", "text": "def temperature(self):\n # perform one measurement in high res, forced mode\n self._write_register_byte(_BMP280_REGISTER_CONTROL, 0xFE)\n\n # Wait for conversion to complete\n while (self._read_byte...
cffab3920c4d83557a98391a400c30c3
Returns a queryset of users who joined within a given timeframe
[ { "docid": "b8a9691c85d8128d7a7b7c46ce33ac75", "score": "0.5213686", "text": "def user_ids(self):\n return just_joined(\n minutes=self.minutes_since_signup,\n days=self.days_since_signup\n )", "title": "" } ]
[ { "docid": "2aa2474f62b89a7863b309674faace28", "score": "0.73507196", "text": "def users_registered_within_period(users, window=1):\n threshold = utcnow() - datetime.timedelta(hours=window)\n filtered = users.filter(\n date_joined__gte=threshold\n ).order_by(\n '-date_joined'\n ...
ac3d2581b95010523b87ccb2cb547941
Make message from multiple sensor readings for device key.
[ { "docid": "5ce38a831fc692b171186a567589b81f", "score": "0.6766938", "text": "def make_sensor_readings_message(\n self,\n device_key: str,\n sensor_readings: List[SensorReading],\n timestamp: int = None,\n ) -> Message:\n topic = self.SENSOR_READING + self.DEVICE_PA...
[ { "docid": "b17e67957534721525784ecdcbb173d8", "score": "0.60640067", "text": "def make_sensor_reading_message(\n self, device_key: str, sensor_reading: SensorReading\n ) -> Message:\n topic = (\n self.SENSOR_READING\n + self.DEVICE_PATH_PREFIX\n + devic...
34aba6c22545ff88c6c765471d69fd2a
A shortand to create an original Article and its translation.
[ { "docid": "5d2e225981e4df530ec9820e1b8a9211", "score": "0.6733866", "text": "def multilingual_article(**kwargs):\n langs = set(kwargs.pop(\"langs\", []))\n contents = kwargs.pop(\"contents\", {})\n translations = {}\n\n # Create original object\n original = ArticleFactory(**kwargs)\n ...
[ { "docid": "a13a1997c353eade0d83338d86918ad0", "score": "0.6235401", "text": "def maketrans(self, *args, **kwargs): # real signature unknown\n pass", "title": "" }, { "docid": "d1713bd4c92bd95b2575278cf87f58e5", "score": "0.6148261", "text": "def create_translation_entry(self,...
f5f611dc1fa49edc0903b5086772d214
Combine multiple generators into one
[ { "docid": "cbfb857bc40adbf0cbc3a1fca182edd7", "score": "0.7115147", "text": "def multiplex(sources):\n return it.chain.from_iterable(sources)", "title": "" } ]
[ { "docid": "c7a09ddd2a1ad01359b94e02267b5713", "score": "0.73177344", "text": "def combine_generators_no_random_crop(sharp_generator, blur_generator):\n while True:\n sharp_batch = sharp_generator.next()\n blur_batch = blur_generator.next()\n\n res = [sharp_batch, blur_batch]\n\n...
96dd970d4d2f402366f34f7bc5e38ac1
This function tokenize, remove stop words and apply lower case for every word within the text
[ { "docid": "0e412cf780cdd57714e1ba1ad43bc1c9", "score": "0.0", "text": "def parse_sentence(self, text):\n\n final_list = []\n list_of_words = self.clean_text(text.split())\n i = 0\n plus = 1\n while i < len(list_of_words):\n if len(list_of_words[i]) < 2 and ...
[ { "docid": "a9c24e059ba0d629375783d4818e3a20", "score": "0.77378315", "text": "def tokenize(txt: str):\n return [w.lower() for w in txt.split(' ')]", "title": "" }, { "docid": "c5959a44e97cef37db948692cef781c8", "score": "0.7713063", "text": "def tokenize(self, text):\n wor...
b63d48e3c4fe997cca7ed55c2e825fdf
Converts all schemes in a given object to its proper swagger representation.
[ { "docid": "8f948b5ea876011ccdf22b5f90657f56", "score": "0.5604471", "text": "def _extract_schemas(self, obj):\n definitions = {}\n if isinstance(obj, list):\n for i, o in enumerate(obj):\n obj[i], definitions_ = self._extract_schemas(o)\n definitio...
[ { "docid": "7f31adca643df64f561772f8c5bcdf1d", "score": "0.6359533", "text": "def swaggerish(self):\n\n # Better chosen dinamically from endpoint.py\n schemes = ['http']\n if self._customizer._production:\n schemes = ['https']\n\n # A template base\n output ...
1eeb69bd9b832fc54ecb2ace1e7e5086
Checks if the username and password are correct. Returns True if it is, False otherwise.
[ { "docid": "fc87a52a3502d066792596aed153d276", "score": "0.0", "text": "def authenticate_account(self, username, password):\n\n self.session = validate_session(self.session)\n account = self.session.query(User).filter(User.username == username).first()\n # Check if account/username ...
[ { "docid": "446a6f1c2a454e86e0924b6a75fccf40", "score": "0.835001", "text": "def check_auth(username, password):\n un = username == blp.login_credentials['user']\n pw = password == blp.login_credentials['pass']\n return un and pw", "title": "" }, { "docid": "45aaaa68062e19e8cefcf511...
ddabbd7b41297deab1ffbb5f91311cdb
Destroy all the stores.
[ { "docid": "f9ebd72c0ef3741a5c880058e8813d2e", "score": "0.81792104", "text": "def destroy_stores(self):\n shutil.rmtree(os.path.join(DATA_STORE, self.name))", "title": "" } ]
[ { "docid": "9f429cbeb9566b1fe28e72709e16eb8b", "score": "0.7163623", "text": "def cleanupStore(self):\n if self.store:\n self.store.cleanup()", "title": "" }, { "docid": "ec3f31f5e70bd594f86b9c285dbaf905", "score": "0.64436644", "text": "def clean(self):\n lo...
c41095549bd4ed7e3560b4e62f9c5644
Toogle the feature /autosave
[ { "docid": "3d88796a7e042d014f8f188692779a26", "score": "0.6832002", "text": "def autosave(connection):\r\n if not connection.protocol.autosave:\r\n connection.protocol.autosave = True\r\n return \"Autosave enabled.\"\r\n else:\r\n connection.protocol.autosave = False\r\n ...
[ { "docid": "95232758d83058425927fc755b481bdc", "score": "0.7093163", "text": "def autosave_handler(self):\n self.autosave_timer_waiting = False\n if self.editor.document().isModified():\n self.autosave()", "title": "" }, { "docid": "cbae35afd4db48fd9c88b845cb79de50",...
edd8209b451c7f174cedf83f811e6ded
Builds appropriate phrase for app
[ { "docid": "2ee64393237424f2194cb6e240785cf0", "score": "0.0", "text": "def _is_it_taps_aff(self, main_weather_data: MainWeatherData) -> str:\n self.temp = round(main_weather_data.temp, 1)\n\n if \".0\" in \"{:.1f}\".format(self.temp):\n self.temp = int(self.temp)\n\n if ...
[ { "docid": "5068d9b7315d7647fd277a2378690c05", "score": "0.6656243", "text": "def gen_phrase_string(self):\n return self.post_process(self.gen_phrase())", "title": "" }, { "docid": "f4c38d3360b740fb302558e517c732aa", "score": "0.6161804", "text": "def translate(self, phrase):\...
599789f663255a4386290c952ba2936e
Removes points that are outside the interval determined by [min_percentile, max_percentile]. The percentiles are computed and applied to each axis (x,y,z) individually.
[ { "docid": "4799caa088d6eb0a3b02e5d1a31d3f83", "score": "0.70688254", "text": "def remove_distant_and_close_points(cloud:np.ndarray, min_percentile:int=1, max_percentile:int=99)->np.ndarray:\n cloud = cloud.reshape(-1,3)\n\n min_x = np.percentile(cloud[:,0], min_percentile, interpolation='nearest'...
[ { "docid": "4b77098adb812cbb946d3a783f6e7601", "score": "0.6658416", "text": "def test_exclude_percentile(self):\n data = np.copy(DATA)\n data[0:50, 0:50] = np.nan\n with pytest.warns(AstropyUserWarning,\n match='Input data contains invalid values'):\n ...
8e02496a6c8282245427a4927c688a28
Returns analytical solution for different moments of lognormal size distr
[ { "docid": "b2866e65341a2e864981cd5a55805301", "score": "0.6666449", "text": "def analytic_moms_for_lognormal(mom, n_tot, mean_r, gstdev):\n if mom == 0:\n ret = n_tot\n else:\n ret = n_tot * mean_r**mom * math.exp((mom**2)/2. * math.pow(math.log(gstdev), 2))\n return ret", "t...
[ { "docid": "8d0eeec394c6cdc872ab50fcf4dab135", "score": "0.65942085", "text": "def lognormvariate(self, mu, sigma):\n pass", "title": "" }, { "docid": "3d8a95f64a721e2186597f80c6ebf099", "score": "0.6581352", "text": "def lognormvariate(self, mu, sigma):\n pass", "title": "" ...
8dea5d2418572c602a423cc45cb5061a
Test to start the specified service
[ { "docid": "bea8ebe3b44f298935e6ce5406c87de9", "score": "0.7395312", "text": "def test_start():\n mock_true = MagicMock(return_value=True)\n mock_false = MagicMock(return_value=False)\n mock_info = MagicMock(side_effect=[{\"Status\": \"Running\"}])\n\n with patch.object(win32serviceutil, \"S...
[ { "docid": "06347100c5d25a23c13c075938520e7a", "score": "0.7975998", "text": "def start_service(service):\n subprocess.call([\"service\", service, \"start\"])", "title": "" }, { "docid": "4502c4639ce33b3e8797f182e1151e8d", "score": "0.78600645", "text": "def test_stop_start(self):...
3d4824220e2b76fe41c979db0d89d648
Calculate valuation signals such as P/E and P/Sales ratios.
[ { "docid": "8f6ca49ea6fe4c1d2298b36e8c742fc1", "score": "0.0", "text": "def val_signals(self, variant='daily', func=None,\n shares_index=SHARES_DILUTED):\n\n # Load the required datasets.\n # This is only really necessary if the cache-file needs refreshing,\n # bu...
[ { "docid": "35f81c10fe1b2d0507b135e909721a2d", "score": "0.6021242", "text": "def npv(rate,values):\n \n \n return float()", "title": "" }, { "docid": "51c6470dfd89042b82c41307358c6aea", "score": "0.5861876", "text": "def results( self ):\n A = AA = 0.0\n x = xx = 0.0\...
ac3c81a73e77f650ede7a49991f02b27
Set up all dataset config options.
[ { "docid": "6a018c9b4bf9649f104ecf5b3e637a9e", "score": "0.0", "text": "def configure(self, repo_dir, inner_size, scale_range, do_transforms,\n rgb, shuffle, set_name, subset_pct, macro,\n contrast_range, aspect_ratio):\n assert (subset_pct > 0 and subset_pct <= ...
[ { "docid": "efb231ed2b6b2f1ce3aa15434c6d4fb4", "score": "0.7039832", "text": "def dataset_setup(self):\n settings = self.settings\n if settings.crowd_dataset == CrowdDataset.ucf_qnrf:\n self.dataset_class = UcfQnrfFullImageDataset\n self.train_dataset = UcfQnrfTransfo...
39a9a2507b6189f125ecdcb37d61cb15
create roi of the liver
[ { "docid": "25b582771929b6f1e3b27a9f7c715656", "score": "0.0", "text": "def find_ROI_segmentation(self):\n\n seg = self.__IsolateBody()\n seg_lung = self.__isolate_lung(seg)\n box = self.__built_box_roi(seg_lung)\n return box, seg_lung", "title": "" } ]
[ { "docid": "47a1aeb5cb060a014f8725ac38518d33", "score": "0.7261228", "text": "def get_roi(self):\n start = self.image.roi.pos()\n size = self.image.roi.size()\n angle = self.image.roi.angle()\n self.ROI = [start[0],start[0] + size[0],\n start[1], start[1] ...
10073b23c2a4f916a7b6da4d1f04804b
Test config entries are reloaded when new info is set.
[ { "docid": "8e1f5233977f8257c1946dfb2fbc1ce9", "score": "0.6789433", "text": "async def test_new_info_reload_config_entries(hass, init_integration, mock_dashboard):\n assert init_integration.state == ConfigEntryState.LOADED\n\n with patch(\"homeassistant.components.esphome.async_setup_entry\") as ...
[ { "docid": "cec03cd3d4109cf17a5d260e3e613182", "score": "0.71862674", "text": "def test_update_configuration_file(self):\n pass", "title": "" }, { "docid": "29be3542c9b40c6e9f7ae7e822ab3b52", "score": "0.71835166", "text": "def test_update_default_configuration(self):\n ...
052b79f70712e6d9033814bffb508da3
Use this decorator to mark you ploogin function as a handler to call upon teardown.
[ { "docid": "d19096ed85842fc259165a9fd2f7ad0a", "score": "0.7959539", "text": "def upon_teardown(f: Callable):\n return PlooginEventHandler(event=PlooginEvents.TEARDOWN, f=f)", "title": "" } ]
[ { "docid": "122522864231496b572e2050164568f0", "score": "0.70912457", "text": "def teardown_func():\r\n pass", "title": "" }, { "docid": "b304946a999ba13baed34b64e8f6f7fe", "score": "0.6499198", "text": "def teardown_appcontext(self, f):\r\n self.teardown_appcontext_funcs.app...
ae1c483eb54cca9c8de99dade4522368
load all plugins, warn if a plugin couldn't be loaded.
[ { "docid": "5e96272094c0dc55ffcd58db3de76cb8", "score": "0.6897457", "text": "def load_all(self):\n # get the names of all required plugins\n names = samuraix.config.get('core.plugins', [])\n log.debug('loading %s', names)\n # get all available entrypoints and create a dictio...
[ { "docid": "a0187f0401cfa952954bc543f1edc71f", "score": "0.75690514", "text": "def load_plugins():", "title": "" }, { "docid": "b85d1c938ae197871c603b0950307892", "score": "0.73343587", "text": "def LoadPlugins(self):\n\t\tfor curfile in [f for f in glob.glob(os.path.join('plugins', ...
d2de2d49a99e311fe7785f9523cffc0f
Remove a child handler.
[ { "docid": "85b819a21028347d4916f20c7b44ca3d", "score": "0.7669957", "text": "def removeHandler(handler):", "title": "" } ]
[ { "docid": "63c1c16a7834019e5cad6290cb3e4810", "score": "0.7600718", "text": "def remove_handler(self, handler):\n self.handlers.remove(handler)", "title": "" }, { "docid": "3a2d370956a7b1319092fbc4335fbb48", "score": "0.7523634", "text": "def remove_handler(self, fd):", "...
fe2b6ed15d7c01e5da08eb0482b1fda2
Look for currency code.
[ { "docid": "5fa7adbf3f0a8e6d3acd86e2f51ea3b6", "score": "0.6849101", "text": "def look(query): \n filename = resource_filename(__name__, 'data/currency_code.json')\n with open(filename, 'r') as file:\n currency_code = json.load(file)\n \n def lookname(word):\n import re\n ...
[ { "docid": "ee6e587f59dfd4d74745f86a071eb09a", "score": "0.68294126", "text": "def currency_code(self) -> str:\n return pulumi.get(self, \"currency_code\")", "title": "" }, { "docid": "2ed1c8c097a4e983214ff610ddcc960f", "score": "0.67247885", "text": "def __getitem__(self, val...
1be57fd6b647dff48b37a3519962bba8
Assign groups to the usernames provided in the data
[ { "docid": "8ab869b356ec5f6a72bf0fdc936d85c1", "score": "0.7481766", "text": "def assign_user_groups(self, group_name: str, rows: list[tuple[str, str]]) -> None:\n group = Group.objects.get(name=group_name)\n\n for username, _ in rows:\n user = User.objects.get(username=username...
[ { "docid": "4195b1546c4302f61e324df7124c0277", "score": "0.65661025", "text": "def set_user_groups(self):\n # Notice that we only add or remove groups that we had\n # offered as options on the form, and don't touch any other\n # groups that the user might belong to.\n for val...
98152f6bc8440d2b9e45186f6f94403b
GIVEN a flask application WHEN user makes advanced search with specified search inputs THEN return recipes satisfy search parameters
[ { "docid": "2613a22a3e801f9c6d7ed8349eb75375", "score": "0.67837054", "text": "def test_advanced_search_results_applies_filter_to_recipes(self, test_client, db, search_term, allergies, diet,\n cal_range, time):\n response = advanced_se...
[ { "docid": "d34d8d2e127a11f836cd282e7367d401", "score": "0.7443953", "text": "def search_recipes():\n if request.method == 'POST':\n cuisine = request.form.get(\"cuisine_name_filter\")\n allergen = request.form.get(\"allergen_name_filter\")\n meal = request.form.get(\"meal_type_f...
4e02ba312122b710df2ee54808e84bad
Displays UI for a download error
[ { "docid": "0e70bafff92bfcb6561858673ec8d1cb", "score": "0.80256706", "text": "def show_download_error(self, name, err):\n self.kodiUi.show_error(30952, self.language(30953).format(name, err))", "title": "" } ]
[ { "docid": "0583d83d4d08c67fa3f074b1be0bc052", "score": "0.70555574", "text": "def download_message(self):\n\n print('Failed to find any DR %s files'% self.subset)\n print('')", "title": "" }, { "docid": "9b23a29c0c13ae8fd955349fe1e02077", "score": "0.67040294", "text": "def _u...
0bcbb126ae5223f3d1f5ca2950034367
Validates if the output is not the same as input
[ { "docid": "75fdf2e321d1a07332176bae092a4632", "score": "0.60977846", "text": "def isValidInputOutputData(self, inputVolumeNode, outputVolumeNode):\n\tif not inputVolumeNode:\n\t logging.debug('isValidInputOutputData failed: no input volume node defined')\n\t return False\n\tif not outputVolumeNode:\n...
[ { "docid": "4435bb4b59cd7ac285ad925231272dda", "score": "0.7131176", "text": "def check_output(output, expected_output):\r\n o = copy.deepcopy(output) # so that we don't mutate input\r\n e = copy.deepcopy(expected_output) # so that we don't mutate input\r\n\r\n o.sort()\r\n e.sort()\r\n ...