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
Attempt to guess if this is a probable sys_id
def guess_is_sys_id(value): return re.match(r'^[A-Za-z0-9]{32}$', value) is not None
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def isSystemId(_idtf):\n if _idtf.startswith(\"@@\"): return True\n if _idtf.startswith(\"tmp_\"): return True\n if len(_idtf) == 36 and _idtf[8] == '-' and _idtf[13] == '-' and _idtf[23] == '-': return True\n \n return False", "def get_system_id(self):\n return self.machine_config_fil...
[ "0.6809829", "0.63876426", "0.63230205", "0.6128962", "0.6076054", "0.5996737", "0.58100796", "0.5776813", "0.57288796", "0.5718117", "0.56870204", "0.56667876", "0.56237614", "0.5604002", "0.5498323", "0.5475839", "0.5474763", "0.53589463", "0.53366184", "0.5334097", "0.5327...
0.8252751
0
Instantiates the password reset serializer that can dump and load values.
def get_reset_password_signer(self): return URLSafeTimedSerializer(settings.SECRET_KEY, 'user-reset-password')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def serialize(self, password: str = None) -> bytes:\n pass", "def getSerializer():", "def _serialise(self):\n # TODO (M Foley)\n pass", "def __init__(self, email, password):\n self.email = email\n self.password = Bcrypt().generate_password_hash(password).decode()", "def h...
[ "0.6072137", "0.57560885", "0.57545984", "0.5683793", "0.5659891", "0.56241673", "0.5603667", "0.55892885", "0.558595", "0.5541366", "0.5468749", "0.5431035", "0.5416434", "0.5348446", "0.534437", "0.53392434", "0.5333414", "0.5319973", "0.53048974", "0.5284257", "0.5259864",...
0.5908953
1
Test searching for an instrument number
def test_search_number(monkeypatch, records): instrument_mock = mock.MagicMock() instrument_item = records[0] instrument_mock.scan.return_value = [instrument_item] monkeypatch.setattr("app.search.InstrumentModel", instrument_mock) response = search.number({"body": ujson.dumps({"term": "1-605"})}, {...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_search_number_not_found(monkeypatch, search_number_event):\n instrument_mock = mock.MagicMock()\n instrument_mock.scan.return_value = []\n monkeypatch.setattr(\"app.search.InstrumentModel\", instrument_mock)\n\n response = search.number(search_number_event, {})\n\n instrument_mock.scan.asse...
[ "0.6051789", "0.5922217", "0.56025136", "0.5594112", "0.55818266", "0.5577269", "0.5574143", "0.556309", "0.55554324", "0.5430466", "0.54147345", "0.5380774", "0.537232", "0.53306127", "0.5330162", "0.53048486", "0.52804303", "0.5270478", "0.5265107", "0.5233086", "0.52236956...
0.66214454
0
Test searching for an instrument number
def test_search_number_not_found(monkeypatch, search_number_event): instrument_mock = mock.MagicMock() instrument_mock.scan.return_value = [] monkeypatch.setattr("app.search.InstrumentModel", instrument_mock) response = search.number(search_number_event, {}) instrument_mock.scan.assert_called() ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_search_number(monkeypatch, records):\n instrument_mock = mock.MagicMock()\n instrument_item = records[0]\n instrument_mock.scan.return_value = [instrument_item]\n monkeypatch.setattr(\"app.search.InstrumentModel\", instrument_mock)\n\n response = search.number({\"body\": ujson.dumps({\"term...
[ "0.66214454", "0.5922217", "0.56025136", "0.5594112", "0.55818266", "0.5577269", "0.5574143", "0.556309", "0.55554324", "0.5430466", "0.54147345", "0.5380774", "0.537232", "0.53306127", "0.5330162", "0.53048486", "0.52804303", "0.5270478", "0.5265107", "0.5233086", "0.5223695...
0.6051789
1
Test searching for a name in an instrument's history
def test_search_history(monkeypatch, records): found = [records[1], records[2], records[7]] instrument_mock = mock.MagicMock() instrument_mock.scan.return_value = found monkeypatch.setattr("app.search.InstrumentModel", instrument_mock) response = search.history({"body": ujson.dumps({"term": "Test N...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_search_checkname(self):\n self.assertEquals(self.t['Scrubs'].search('my first')[0]['episodename'], 'My First Day')\n self.assertEquals(self.t['My Name Is Earl'].search('Faked His Own Death')[0]['episodename'], 'Faked His Own Death')", "def test_name(self):\n\n self.check_search(\n ...
[ "0.6526176", "0.5852512", "0.5815232", "0.57717305", "0.5768822", "0.5761918", "0.56945235", "0.5591022", "0.5578038", "0.55362177", "0.5531319", "0.5493703", "0.54901457", "0.5469444", "0.54673326", "0.5452825", "0.5450835", "0.54297566", "0.5427342", "0.5383021", "0.5380466...
0.64635086
1
Make GET request to provided 'url' with provided xapikey in the header and params if provided.
def do_get_le_url(url, x_api_key, params=None): LOGGER.debug("Making get request to the url: %s", url) headers = generate_headers(x_api_key) return requests.get(url, headers=headers, params=params)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def request(host, path, api_key, url_params=None):\n url_params = url_params or {}\n url = '{0}{1}'.format(host, quote(path.encode('utf8')))\n headers = {\n 'Authorization': 'Bearer %s' % api_key,\n }\n\n print(u'Querying {0} ...'.format(url))\n\n response = requests.request('GET', url, he...
[ "0.6929671", "0.6876207", "0.68395406", "0.6760227", "0.67404145", "0.67404145", "0.6728933", "0.6713769", "0.66463655", "0.6552938", "0.65257865", "0.6519191", "0.6507264", "0.6467253", "0.6467253", "0.64518654", "0.6411107", "0.6401828", "0.63951766", "0.6336494", "0.631536...
0.7231131
0
Make POST request to the provided 'url' with provided xapikey in the header and payload.
def do_post_json_to_le(url, payload, x_api_key): LOGGER.debug("Making post request with payload: %s to the url: %s", payload, url) headers = generate_headers(x_api_key) return requests.post(url, headers=headers, json=payload)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __post(self, url, payload=None, headers=None):\n if headers is None:\n headers = {\"Content-Type\": \"application/json\"}\n return self.__req(url, \"POST\", body=payload, headers=headers)", "def post(self, url, payload={}):\n response = self._make_request(\"POST\", url, payloa...
[ "0.7097729", "0.699634", "0.6941708", "0.67859775", "0.66907686", "0.6688064", "0.665207", "0.6354269", "0.6284613", "0.6158473", "0.6156867", "0.6151895", "0.6148283", "0.6143726", "0.61338884", "0.60874456", "0.60844016", "0.6083122", "0.60758775", "0.60546", "0.6051695", ...
0.75403327
0
Prepare payload and post search to Logentries.
def post_le_search(query_config, auth): logs = query_config.get('logs').split(":") to_ts = int(round(time.time() * 1000)) from_ts = to_ts - int(query_config.get('query_range')) * 1000 statement = query_config.get('statement') payload = {"logs": logs, "leql": {"during": {"from": from_...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create(ctx, payload):\n payload = parse_payload(ctx, payload)\n r = SavedSearch(ctx.obj['TOKEN'], ctx.obj['DEBUG']).create(payload)\n click.echo(json_dumps(r, ctx.obj['PRETTY']))", "def handle_request_payload(self, input_args):\n\n if self.resource['operation'] == PyMongoEvent.INSERT_MANY:\n ...
[ "0.5833124", "0.54850173", "0.5458759", "0.54037476", "0.5390068", "0.5270697", "0.520219", "0.5201409", "0.5189415", "0.5160554", "0.51358324", "0.5113572", "0.51089066", "0.5100613", "0.5089843", "0.5089736", "0.50666803", "0.5034634", "0.5022001", "0.50057423", "0.49981034...
0.5912274
0
Get rw_api_key if provided in the configuration, otherwise get ro_api_key
def get_le_api_key(auth): if auth.get('rw_api_key'): return auth.get('rw_api_key') else: return auth.get('ro_api_key')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _get_api_key():\n cfg = read_config()\n cfg = cfg['notifier']['telegram_bot']\n return cfg.get('api_key')", "def _get_api_key():\n api_key_directory = os.getenv(\"KOKORO_GFILE_DIR\")\n api_key_file = os.path.join(api_key_directory, \"resultstore_api_key\")\n assert os.path.isfil...
[ "0.69545305", "0.6857441", "0.6817429", "0.68095845", "0.67815363", "0.6729458", "0.6729458", "0.6723309", "0.6576936", "0.65597695", "0.6557634", "0.6547672", "0.64181113", "0.6394189", "0.63922924", "0.63775486", "0.6364561", "0.6307864", "0.63058734", "0.62862015", "0.6274...
0.77554333
0
Initialize the web interface for this plugin This method is only needed if the plugin is implementing a web interface
def init_webinterface(self): try: self.mod_http = Modules.get_instance().get_module( 'http') # try/except to handle running in a core version that does not support modules except: self.mod_http = None if self.mod_http == None: self.logger.erro...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def init_webinterface(self):\n try:\n self.mod_http = Modules.get_instance().get_module('http') # try/except to handle running in a core version that does not support modules\n except:\n self.mod_http = None\n if self.mod_http == None:\n self.logger.error(\"...
[ "0.7579631", "0.65639925", "0.65639925", "0.64460266", "0.64433324", "0.64254785", "0.6416105", "0.64090526", "0.6361282", "0.6361282", "0.63581735", "0.63085496", "0.6272983", "0.62606746", "0.6259833", "0.62164026", "0.61812305", "0.6179776", "0.6179309", "0.61590815", "0.6...
0.77974313
0
plot the confidence contours obtained from the sherpa fit
def plot_sherpa_contours(): log.info("plotting parameters contours obtained from sherpa") # where to take the results, configurations for the individual butterflies instruments = ["fermi", "magic", "hess", "fact", "veritas", "joint"] labels = ["Fermi-LAT", "MAGIC", "H.E.S.S.", "FACT", "VERITAS", "joint ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def ShowOneContour(index,all_images,all_pointing,thex0,they0,all_titles,object_name,all_expo,dir_top_img,all_filt,figname):\n plt.figure(figsize=(15,6))\n spec_index_min=100 # cut the left border\n spec_index_max=1900 # cut the right border\n star_halfwidth=70\n \n YMIN=-15\n YMAX=15\n \n ...
[ "0.6002791", "0.58162606", "0.58102226", "0.57846534", "0.57464504", "0.5743903", "0.573048", "0.5720918", "0.5720918", "0.5720918", "0.5713716", "0.56997395", "0.5686767", "0.56542474", "0.56542474", "0.56542474", "0.56542474", "0.56505036", "0.56008255", "0.55922145", "0.55...
0.7807665
0
plot an example figure showing how to correctly estimate a butterfly per each dataset We do it by default with the gammapy (iminuit) results
def butterfly_stat(which, tool="gammapy"): # the sampling in energy shall be consistent with the nbins of the spectrum extraction if which == "fermi": num_energy_points = 20 else: num_energy_points = 60 energies, flux_min, flux_max = stat_errorband( which=which, tool=tool, dim_sa...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def xx_plot(epoch, model, features, filters, figname, fgal=0.5):\n # fetch Stripe 82 data\n X, Xcov = fetch_prepped_s82data(epoch, fgal, features, filters)\n Xcoadd, Xcoaddcov = fetch_prepped_s82data(epoch, fgal, features,\n filters, use_single=False)\n N = ...
[ "0.6664884", "0.6484918", "0.6479411", "0.64523244", "0.64004064", "0.63926893", "0.6323202", "0.62402004", "0.6229773", "0.61275136", "0.60954314", "0.6088197", "0.60864246", "0.607957", "0.60642546", "0.60621816", "0.60492086", "0.6039706", "0.60170966", "0.6010168", "0.600...
0.6633322
1
Test case for create_record Creates a new record.
def test_create_record(self): body = [RecordModel()] response = self.client.open( '//records/create', method='POST', data=json.dumps(body), content_type='application/json') self.assert200(response, 'Response body is : ' + res...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_create_record(self):\n pass", "def createRecord(self):\n self.dto.getRecord().append(self.controller.createNewObj())\n print(\"Record added.\")", "def create_new_record(account,userName,password):\n new_record = Records(account,userName,password)\n return new_record", "def...
[ "0.8965108", "0.7537654", "0.7246845", "0.71204275", "0.7078361", "0.6925501", "0.6867391", "0.6865413", "0.68448967", "0.68440795", "0.68380755", "0.6831007", "0.68207604", "0.67752993", "0.6747886", "0.66975874", "0.66329616", "0.65992695", "0.6536182", "0.65263784", "0.652...
0.8313121
1
Creates a Pokemon object from a json dictionary
def from_json(cls, data: dict) -> "Pokemon": moves: list = list(map(Move.from_json, data["move_set"])) return cls(data["id"], data["name"], data["types"], data["weight"], data["height"], data["abilities"], data["move_list"], moves)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def from_response(cls, api_handler: APIHandler, response: requests.models.Response) -> \"Pokemon\":\n\n api_data: dict = json.loads(response.text)\n id: int = api_data[\"id\"]\n name: str = api_data[\"name\"].capitalize()\n types: tuple = tuple([type[\"type\"][\"name\"].capitalize() for...
[ "0.6312325", "0.61387926", "0.58204556", "0.57325155", "0.5695455", "0.5693761", "0.56828916", "0.5662741", "0.5657147", "0.56004125", "0.555932", "0.555932", "0.555932", "0.55343896", "0.5518079", "0.55150104", "0.5508857", "0.55003303", "0.5498654", "0.54966396", "0.5494049...
0.78120804
0
Creates a Pokemon object from a Response object, additional api calls are required to fetch ability effect information
def from_response(cls, api_handler: APIHandler, response: requests.models.Response) -> "Pokemon": api_data: dict = json.loads(response.text) id: int = api_data["id"] name: str = api_data["name"].capitalize() types: tuple = tuple([type["type"]["name"].capitalize() for type in api_data["t...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def instantiate_pokemon(self\n , type:str\n , hp: int = 0\n , attack: int = 0\n , defense: int = 0\n , sp_atk: int = 0\n , sp_def: int = 0\n , speed: int = 0\n , level: int = 0\n ...
[ "0.63585764", "0.6210277", "0.5829425", "0.5588461", "0.54508376", "0.5441782", "0.541509", "0.541509", "0.54005593", "0.5317103", "0.52823764", "0.52514094", "0.5237536", "0.5227025", "0.5205111", "0.51333964", "0.5122701", "0.511656", "0.49995145", "0.49456346", "0.49314314...
0.7725566
0
Displays the Pokemon object's information
def view_pokemon(self, team_name: str, team_choice: str) -> None: print(f"\n\u001b[1m\u001b[4mTeam\u001b[0m: \u001b[7m {team_name} \u001b[0m") print(f"\n\u001b[4mPokémon Slot #{int(team_choice)}\u001b[0m\n\n") print(f"\u001b[1mName\u001b[0m: {self.name}") print(f"\u001b[1mPokédex ID:\u0...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def printPokemon():\n print(\" _ \")\n print(\" _ __ ___ | | _____ _ __ ___ ___ _ __ \")\n print(\" | '_ \\ / _ \\| |/ / _ \\ '_ ` _ \\ / _ \\| '_ \\ \")\n print(\" | |_) | (_) | < __/ | | | | | (_) | | | |\")\n print(\" | .__/ \\___/|_|\\_\\___|_|...
[ "0.74442", "0.6442995", "0.64209133", "0.6280694", "0.6237628", "0.6194147", "0.6179384", "0.61780554", "0.6104097", "0.6103629", "0.6075715", "0.6047812", "0.60163873", "0.5984948", "0.59664613", "0.5940975", "0.5887718", "0.5876151", "0.58740056", "0.58633536", "0.5853701",...
0.7362091
1
Gets the move slot options to use in Pokemon.pokemon_menu()
def get_pokemon_move_slots_options(self, mode: str) -> list: if mode == "online": pokemon_move_slots = [ "Slot 1 - " + (self.move_set[0].name if self.move_set[0].name != "None" else "Empty"), "Slot 2 - " + (self.move_set[1].name if self.move_set[1].name != "None" els...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_pokemon_options(self, mode: str) -> list:\n\n options: list = [\n \"Change Pokémon\",\n None,\n \"Back to team view\"\n ]\n\n if mode == \"online\":\n if self.name == \"None\":\n options[1] = {\"name\": \"Change moves\",\n ...
[ "0.69391555", "0.6693645", "0.5890738", "0.57934654", "0.5690308", "0.5668284", "0.56499684", "0.5602412", "0.5596017", "0.55758274", "0.556127", "0.55125475", "0.5486199", "0.5483611", "0.53988874", "0.5392086", "0.5360867", "0.53548217", "0.530826", "0.5303682", "0.529964",...
0.7540521
0
Displays the menu for the Pokemon screen
def pokemon_menu(self, mode: str) -> str: pokemon_options: list = [ { "type": "list", "name": "pokemon_menu", "message": "What would you like to do with this pokémon slot?", "choices": self.get_pokemon_options(mode) } ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def menu(self):\n from mainmenu import Menu\n gm = Menu(self.screen)\n gm.run()", "def menu():\n ferme_fenetre()\n Menu()", "def display_menu(self):\n # Gets the number of habits that exist in the habits table\n number_of_habits = len(self.analytics.habits_table...
[ "0.7002771", "0.6876476", "0.6718972", "0.6633552", "0.6629023", "0.6622605", "0.657216", "0.65491074", "0.6546678", "0.65427965", "0.6523997", "0.65180916", "0.6511847", "0.6511847", "0.64960563", "0.6486651", "0.6469463", "0.6446301", "0.64245635", "0.63889533", "0.6367936"...
0.6946723
1
Displays the input field for the user to select and view a pokemon list or search for a pokemon
def select_pokemon(api_handler: APIHandler) -> str: print("\nIf you are unsure of what Pokémon you would like to search for, select a Pokémon generation to view the list of Pokémon " "from that generation.\n\nOnce you know what Pokémon you would like to search for, select the Search option and en...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def pokemon():\n # TODO: Add form, nature and habitat to displayed table.\n color = request.form.get(\"pokecolor\")\n pokemon_of_color = []\n pokemon_with_data = []\n if color:\n pokemon_of_color = get_pokemon_of_color(color)\n # This is not a good implementation, because after getting...
[ "0.6330982", "0.61606073", "0.6133567", "0.6119091", "0.5804532", "0.5713087", "0.57030183", "0.56935334", "0.5692286", "0.56493187", "0.5634077", "0.5615761", "0.5554982", "0.5532804", "0.540871", "0.5408613", "0.5401501", "0.5381987", "0.5365774", "0.53362465", "0.53352773"...
0.70962125
0
Get confirmation to add the pokemon to the currently selected pokemon slot
def confirm_pokemon() -> str: confirm_pokemon: list = [ { "type": "list", "name": "confirm_pokemon", "message": "Add this Pokémon to your team?", "choices": [ "Add Pokémon", "Search for another P...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _onConfirmPressed (self):\n self._classSelectionMenu.createCharacter()", "def on_ConfirmWalletOP_clicked(self):\n # TODO: not implemented yet\n raise NotImplementedError", "def pokemon_menu(self, mode: str) -> str:\n\n pokemon_options: list = [\n {\n \"...
[ "0.6338423", "0.61585784", "0.5970589", "0.587909", "0.5834209", "0.5833402", "0.56255454", "0.55905133", "0.55608046", "0.55002594", "0.5499106", "0.5480338", "0.5460167", "0.5456962", "0.5450422", "0.543145", "0.54239833", "0.54021066", "0.53871584", "0.537501", "0.5356845"...
0.75294524
0
Set the card's name, suit, and identification number.
def set_attributes(self, name, suit, id_no=0): self.name = str(name) self.suit = str(suit) self.id = int(id_no)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_card (self, card):\n\t\tif ((card == 1) or (card == 2)):\n\t\t\tself._card = card\n\t\telse:\n\t\t\tsys.stderr.write(\"\\nERROR : %s card number must be 1 or 2 so it can't be %s !\\n\" % (self._target_id, card))\n\t\t\tsys.exit(1)", "def setSuit(self, arg):\n self.suit = arg", "def set_card(self...
[ "0.7173432", "0.68502975", "0.6695155", "0.65101445", "0.64912117", "0.61500406", "0.61423874", "0.6100892", "0.6100892", "0.6070534", "0.5982453", "0.5962046", "0.59164387", "0.5883601", "0.5865561", "0.58543205", "0.5849564", "0.58125895", "0.5774057", "0.5745068", "0.56753...
0.8090841
0
Check if it is time to shuffle the deck by calculating the percentage of the cards remaining in the deck
def _shuffle_time(self): remaining = len(self.deck) # Current count of cards in the deck percentage_left = int((remaining / self.card_total) * 100) if ( percentage_left > 25 ): return False # It isn't time to shuffle else: return True # Or maybe it is
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_sufficient_shuffle(self):\n cards = self.deck.cards[:]\n self.deck.shuffle()\n self.assertNotEqual(cards, self.deck.cards)\n self.assertEqual(self.deck.count(), 52)", "def shuffle(self):\n if len(self.deck_of_cards) == 52:\n random.shuffle(self.deck_of_cards...
[ "0.65140903", "0.6030377", "0.5804475", "0.575236", "0.5751873", "0.5722235", "0.56871593", "0.56774753", "0.5677262", "0.56754047", "0.561516", "0.5579718", "0.55606675", "0.5539041", "0.5470068", "0.5453134", "0.5442694", "0.542924", "0.542184", "0.5416228", "0.53988576", ...
0.8364192
0
Deal out a new hand of cards to the dealer and player.
def deal(self): if self.dealer: # Has cards in hand self.dealer.reset() if self.player: # Has cards in hand self.player.reset() dealer_first = self.deck.draw() dealer_second = self.deck.draw() dealer_second.flip() self.dealer.take_card(dealer_...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def deal(self):\n\t\tplayerList = self.getPlayers()\n\t\tstart = self.curDealerSeatNo + 1\n\t\tfor i in range(len(playerList)*2):\n\t\t\tplayerList[(start + i) % len(playerList)].hand.append(self.deck.pop())\n\t\t\tplayerList[(start + i) % len(playerList)].isHandLive = True", "def deal_cards(self):\r\n\t\tself.p...
[ "0.8039614", "0.799253", "0.7872352", "0.76970196", "0.76756775", "0.76382005", "0.76073706", "0.74646735", "0.74433017", "0.7320351", "0.7294134", "0.72213686", "0.72082293", "0.72032225", "0.71896905", "0.71766204", "0.71680105", "0.7160427", "0.70954007", "0.7071745", "0.7...
0.8084043
0
Set the target protocol, or use 'http' as default if not provided.
def fill_protocol(self, data): self.protocol = get_optional_value(data, self.PROTOCOL, "http") self.protocol = self.protocol or "http"
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def protocol(self):\n return 'https' if self.allow_https and self.is_secure else 'http'", "def get_http_protocol(self):\n if self.cfg.ssl:\n return \"https\"\n else:\n return \"http\"", "def set_target(self, host, port):\r\n pass", "def get_protocol():\n if h...
[ "0.6666126", "0.6581485", "0.6320008", "0.6287347", "0.6240481", "0.62106067", "0.6125219", "0.59284455", "0.59199196", "0.58954155", "0.58326036", "0.5769084", "0.5754185", "0.5746116", "0.5657455", "0.5629036", "0.56018126", "0.55981636", "0.5590507", "0.5573317", "0.557331...
0.68993115
0
Set the option to enable/disable SSL verification.
def fill_disable_ssl_verification(self, data): disable_ssl_verification = get_optional_value(data, self.DISABLE_SSL, False) self.verify_ssl = not bool(disable_ssl_verification)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def enable_ssl_verification(self) -> bool:\n return pulumi.get(self, \"enable_ssl_verification\")", "def use_skip_ssl_verify(self, val=True, force=False):\n if val:\n self.ssl_verify = False\n else:\n self.ssl_verify = True\n\n if force:\n self.force_s...
[ "0.72796327", "0.6935235", "0.6585898", "0.6501708", "0.64170074", "0.6353365", "0.6339298", "0.63162655", "0.6261193", "0.6243311", "0.6179049", "0.61781824", "0.61752486", "0.6135691", "0.60789657", "0.6077635", "0.6066835", "0.5986019", "0.5945604", "0.5882714", "0.5857971...
0.72945106
0
Return the host in URI format.
def get_host(self): return '{}://{}{}'.format(self.protocol, self.host, self.port)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def uri(self) -> str:\n return self._host", "def host(self):\n if self.url.startswith(\"dns:\"):\n return self.url[4:]\n else:\n return urlparse(self.url).hostname", "def getHost(self):\n host = self.url[self.host_head:self.host_tail]\n return host", "...
[ "0.79757637", "0.76057154", "0.74400973", "0.7210545", "0.7121567", "0.7114602", "0.71005315", "0.71005315", "0.70806617", "0.70639163", "0.70214206", "0.700534", "0.6996991", "0.6996991", "0.69849235", "0.6936951", "0.6927335", "0.6917939", "0.6889914", "0.68890804", "0.6883...
0.76300275
1
Adds the prefix and the suffix specified in the challenge and encrypts the data with AES128CBC
def encrypt(self, data): data = data.replace(';', '').replace('=', '') # Remove special characters to avoid injection plaintext = (self._prefix + data + self._suffix).encode() return aes_cbc_encrypt(plaintext, self._key, self._iv)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def encryptor(text: bytes, IV: bytes, key: bytes) -> bytes:\n \n # Given\n prepend_string = \"comment1=cooking%20MCs;userdata=\"\n append_string = \";comment2=%20like%20a%20pound%20of%20bacon\"\n\t\n plaintext = text.replace(b';', b'\";\"').replace(b'=', b'\"=\"')\n ciphertext = AES_CBC_encrypt(P...
[ "0.5842349", "0.5742427", "0.564304", "0.55512965", "0.5550754", "0.5534768", "0.5493715", "0.5479627", "0.54222643", "0.54220825", "0.53676665", "0.535513", "0.5321565", "0.5301029", "0.52769536", "0.52687824", "0.52632165", "0.5243911", "0.5241482", "0.52288765", "0.5219721...
0.5778868
1
Decrypts the string and returns whether the characters ";admin=true;" are in the string
def decrypt_and_check_admin(self, ciphertext): data = aes_cbc_decrypt(ciphertext, self._key, self._iv) return b';admin=true;' in data
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def contains_admin(ct):\n pt = aes.cbc_decrypt(ct, KEY, IV)\n return b\";admin=true;\" in pt", "def has_admin(cipher):\n counter = Crypto.gen_aes_stream_counter_mt19973(3453243);\n text = Crypto.decrypt_aes(cipher, key, AES.MODE_CTR, counter=counter)\n return text.find(';ad...
[ "0.7260012", "0.6920352", "0.59435815", "0.5896175", "0.5859779", "0.5851807", "0.5785826", "0.5777162", "0.57728654", "0.5744381", "0.5718853", "0.5677723", "0.56640404", "0.5638577", "0.5632798", "0.5579329", "0.5536079", "0.5517314", "0.550338", "0.5474909", "0.5463659", ...
0.70640266
1
Returns the length of a block for the block cipher used by the encryption_oracle. To find the length of a block, we encrypt increasingly longer plaintexts until the size of the output ciphertext increases too. When this happens, we can then easily compute the length of a block as the difference between this new length ...
def find_block_length(encryption_oracle): my_text = '' ciphertext = encryption_oracle(my_text) initial_len = len(ciphertext) new_len = initial_len while new_len == initial_len: my_text += 'A' ciphertext = encryption_oracle(my_text) new_len = len(ciphertext) return new_l...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def find_prefix_length(encryption_oracle, block_length):\n\n # Encrypt two different ciphertexts\n ciphertext_a = encryption_oracle('A')\n ciphertext_b = encryption_oracle('B')\n\n # Find their common length\n common_len = 0\n while ciphertext_a[common_len] == ciphertext_b[common_len]:\n c...
[ "0.6904967", "0.6444411", "0.63962007", "0.6197277", "0.6142764", "0.6065962", "0.6057553", "0.57715344", "0.5760121", "0.5725384", "0.56103444", "0.5606483", "0.5579858", "0.5567053", "0.5532941", "0.55215955", "0.5507579", "0.54838127", "0.54716325", "0.54569227", "0.544095...
0.8539241
0
Test init succeeds and GPIO pins are setup.
def test_legacy_gpio_setup(GPIO): from plasma.gpio import PlasmaGPIO plasma = PlasmaGPIO(10, gpio_data=10, gpio_clock=11) plasma.show() GPIO.setmode.assert_called_once_with(GPIO.BCM) GPIO.setup.assert_has_calls([ mock.call(10, GPIO.OUT), mock.call(11, GPIO.OUT) ])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def GPIO_initialization():\n GPIO.setmode(GPIO.BCM)\n\n GPIO.setup(Sensor.IN_1, GPIO.OUT)\n GPIO.setup(Sensor.IN_2, GPIO.OUT)\n GPIO.setup(Sensor.EN, GPIO.OUT)\n\n GPIO.setup(Membrane_Switch.PSEUDO_MEMBRANE_SWITCH['RED_STOP'], GPIO.IN)\n GPIO.setup(Membrane_Switch.PSEUDO_MEMBRANE_SWITCH['YELLOW_C...
[ "0.71983796", "0.6922735", "0.692107", "0.6779296", "0.6775591", "0.6770328", "0.6719149", "0.6667346", "0.659048", "0.65664613", "0.65592617", "0.6521553", "0.6518352", "0.6497999", "0.6444799", "0.6434766", "0.64194673", "0.6378872", "0.6376077", "0.63623905", "0.6359378", ...
0.711882
1
Exports into any format. The method is looking for one method call '_export_' and calls it if found. lang language hook tweaking parameters result_name the name of the result decided by the parent of this node depends on the language
def export(self, lang="json", hook=None, result_name=None): self._reset_cache() name = f"_export_{lang}" if hasattr(self, name): try: return getattr(self, name)(hook=hook, result_name=result_name) except TypeError as e: # pragma: no cover ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def exports():", "def export(self, f, **kwargs):\n from .. import export\n\n return export.utils.package_export(f, self, **kwargs)", "def _CMD_EXPORT(self, file_name):\n self.__switch_command_export(file_name, selection_only=False)", "def _after_export(self, *args, **kwargs):\n re...
[ "0.6370952", "0.59295803", "0.57485396", "0.56908894", "0.56485885", "0.5638435", "0.5635923", "0.5565345", "0.5550854", "0.5521743", "0.547278", "0.546727", "0.54520905", "0.5438685", "0.54272974", "0.5419869", "0.5406379", "0.53929627", "0.5392438", "0.5382133", "0.53401995...
0.68904537
0
Return the time from start to peak for a psp with given parameters.
def _psp_max_time(rise, decay, rise_power): return rise * np.log(1 + (decay * rise_power / rise))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_peak_Vm_time(self, cellname, tstart, tend):\n istart = int(tstart/self.plotdt+0.5)\n iend = int(tend/self.plotdt+0.5)\n try:\n data = self.datafile['/Vm/'+cellname][istart:iend]\n except KeyError:\n print 'get_peak_Vm_time: no Vm entry for', cellname\n ...
[ "0.6261949", "0.6113594", "0.6106056", "0.60740584", "0.6056899", "0.6023579", "0.5914465", "0.5893356", "0.57268703", "0.57060856", "0.5685591", "0.5644412", "0.5629772", "0.56212854", "0.55284125", "0.55136937", "0.55103064", "0.5485026", "0.5467895", "0.5442862", "0.543293...
0.63055134
0
Function approximating a PSP shape with double exponential decay.
def double_psp_func(x, xoffset, yoffset, rise_tau, decay_tau1, decay_tau2, amp1, amp2, rise_power=2.0): x = x-xoffset out = np.zeros(x.shape, x.dtype) mask = x >= 0 x = x[mask] rise_exp = (1.0 - np.exp(-x / rise_tau))**rise_power decay_exp1 = amp1 * np.e...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _semi_relativistic_loss(eps):\n P = Pcoef * np.imag(1./eps) / np.real(Theta**2.+ThetaE**2.)\n return P", "def expm(self, p, d_p):\n ldv = ldot(d_p, d_p, keepdim=True)\n nd_p = ldv.clamp_(min=0).sqrt_()\n t = torch.clamp(nd_p, max=1) # ? max clip\n nd_p.clamp...
[ "0.62019885", "0.61466205", "0.602316", "0.59439826", "0.5921692", "0.58465815", "0.58428156", "0.58369446", "0.58339137", "0.5825675", "0.5732989", "0.5701724", "0.5681052", "0.5666799", "0.56532085", "0.5641436", "0.5631958", "0.5631126", "0.5616071", "0.5599539", "0.558534...
0.63498926
0
Edge detection The Sobel operator is applied for each image layer (RGB)
def edge_detect(im): return np.max(np.array([sobel(im[:,:, 0]), sobel(im[:,:, 1]), sobel(im[:,:, 2]) ]), axis=0)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def edges(image):\n #store image width and height and initialize new image\n image_width = image['width']\n image_height = image['height']\n new_image = {'height': image['height'], 'width': image['width'], 'pixels': len(image['pixels'])*[0]}\n \n #sobel operator kernels\n kernel_x = {'height':...
[ "0.77779794", "0.7460966", "0.7017532", "0.6949745", "0.6754209", "0.67402023", "0.6657029", "0.665246", "0.6558927", "0.645902", "0.6424561", "0.641592", "0.6348763", "0.63449556", "0.6328036", "0.6286554", "0.6253566", "0.6233976", "0.6227424", "0.6190273", "0.6182207", "...
0.74908197
1
Find and remove contours too big for a word
def del_big_areas(img): gray = cv2.cvtColor(img,cv2.COLOR_BGR2GRAY) # ret, gray = cv2.threshold(gray, 0, 255, cv2.THRESH_BINARY_INV + cv2.THRESH_OTSU) gray = cv2.adaptiveThreshold(gray, 255, cv2.ADAPTIVE_THRESH_GAUSSIAN_C, cv2.THRESH_BINARY_INV, 101, 3) implt(gray, 'gray') gray2 = gray.copy...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def text_detect(img, original):\n # Resize image\n small = resize(img, 2000)\n image = resize(original, 2000)\n \n # Finding contours\n mask = np.zeros(small.shape, np.uint8)\n im2, cnt, hierarchy = cv2.findContours(np.copy(small), cv2.RETR_CCOMP, cv2.CHAIN_APPROX_SIMPLE)\n \n implt(img,...
[ "0.68570524", "0.6424008", "0.6318862", "0.6241862", "0.6218625", "0.6197865", "0.6138877", "0.6078731", "0.6074054", "0.60173947", "0.59393525", "0.589946", "0.5782037", "0.5755927", "0.5748007", "0.57328403", "0.57127017", "0.57065344", "0.5647742", "0.56351215", "0.5624939...
0.66624075
1
Text detection using contours
def text_detect(img, original): # Resize image small = resize(img, 2000) image = resize(original, 2000) # Finding contours mask = np.zeros(small.shape, np.uint8) im2, cnt, hierarchy = cv2.findContours(np.copy(small), cv2.RETR_CCOMP, cv2.CHAIN_APPROX_SIMPLE) implt(img, 'gray') ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def detect_text(path):\n from google.cloud import vision\n client = vision.ImageAnnotatorClient()\n\n with io.open(path, 'rb') as image_file:\n content = image_file.read()\n\n #Make an empty dataframe with columns 'character' and 'vertices'\n data = {'character':[],'vertices':[]}\n charact...
[ "0.6994302", "0.676307", "0.6561841", "0.63753945", "0.6242924", "0.6214315", "0.6207203", "0.619637", "0.61759794", "0.6168567", "0.6149506", "0.61450803", "0.6143566", "0.6103987", "0.6084041", "0.60492706", "0.597899", "0.59769195", "0.5941245", "0.5939429", "0.5936336", ...
0.7869744
0
Text detection using watershed algorithm
def textDetectWatershed(thresh, original): # According to: http://docs.opencv.org/trunk/d3/db4/tutorial_py_watershed.html img = resize(original, 3000) thresh = resize(thresh, 3000) # noise removal kernel = np.ones((3,3),np.uint8) opening = cv2.morphologyEx(thresh,cv2.MORPH_OPEN,kernel, iteration...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def watershed(img):\n\ttmp = img.copy()\n\tgray = cv2.cvtColor(tmp, cv2.COLOR_BGR2GRAY)\n\tret, thresh = cv2.threshold(gray, 0, 255, cv2.THRESH_BINARY_INV+cv2.THRESH_OTSU)\n\tkernel = np.ones((3,3), np.uint8)\n\topening = cv2.morphologyEx(thresh, cv2.MORPH_OPEN, kernel, iterations=2)\n\tsure_bg = cv2.dilate(openin...
[ "0.74470377", "0.6840653", "0.6638572", "0.62907404", "0.6255105", "0.6193474", "0.61283785", "0.6099194", "0.603974", "0.603122", "0.60103697", "0.60051155", "0.5995296", "0.5886256", "0.5872086", "0.58502966", "0.57832724", "0.5779826", "0.5741116", "0.5719528", "0.5677378"...
0.8033093
0
authentication protocol returns a auth protocol by default returns ssh for rsync >>> authentication_protocol('') "ssh o 'UserKnownHostsFile=/dev/null' o 'StrictHostKeyChecking no'"
def authentication_protocol(transport_type): return "ssh -o 'UserKnownHostsFile=/dev/null' -o 'StrictHostKeyChecking no'"
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def auth_type(self):\n if self.admin_ssh_key:\n return 'Public key'\n else:\n return 'Password'", "def default_protocol(self):\n return \"sftp://\"", "def protocol(self):\n return self._config[\"security.protocol\"]", "def ip_protocol(self) -> str:\n p...
[ "0.62383765", "0.61931854", "0.6193098", "0.6043744", "0.5827065", "0.57865757", "0.57568246", "0.575431", "0.5644522", "0.5486324", "0.5486324", "0.5480975", "0.5440251", "0.543468", "0.54322326", "0.54238397", "0.54238397", "0.5423153", "0.5375236", "0.5359208", "0.53407764...
0.8429199
0
Prepares a file of unwanted genes, these genes does not have the approved taxi.
def get_unwanted_gene(a, b, c): gene_taxi_file = open(a) gene_taxi_lines = gene_taxi_file.readlines()[1:] wanted_taxi = b unwanted_gene = open(c, 'w+') counter = 0 new_counter = 0 for gene_taxi in gene_taxi_lines: counter += 1 taxi = gene_taxi.split()[1] if taxi not ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def remove_GOs(self):\n\n file = open(self.filename, 'r')\n new_file = open(self.temp_filename, 'w')\n for line in file:\n if \"GO\" not in line and \"go\" not in line:\n new_file.write(line)\n file.close()\n new_file.close()\n self.overwrite_file...
[ "0.5711038", "0.5343892", "0.53379464", "0.52875745", "0.52832824", "0.52623004", "0.5252019", "0.5241591", "0.52069336", "0.51528794", "0.5141498", "0.5124164", "0.5111441", "0.5086066", "0.5062066", "0.50351894", "0.50256884", "0.50061864", "0.49935487", "0.4989264", "0.496...
0.60737306
0
Updates self from merge_from, whose type is dict
def merge_from_dict(self, merge_from: dict): merge_from_hparam = Hparams(merge_from) self.merge_from_hparams(merge_from_hparam)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def merge_from_hparams(self, merge_from):\n for k, v in merge_from.items():\n if isinstance(self.get(k, None), collections.abc.Mapping) and \\\n isinstance(v, collections.abc.Mapping):\n self[k].merge_from_hparams(v)\n else:\n self[k] = ...
[ "0.743715", "0.73443764", "0.73336416", "0.6707611", "0.66192466", "0.65994406", "0.6357256", "0.63486624", "0.62239945", "0.61668175", "0.61255896", "0.61207867", "0.6108192", "0.61080724", "0.60325104", "0.6024715", "0.6014554", "0.6013384", "0.6012497", "0.60091144", "0.59...
0.7469504
0
Test that questions/ url in the site resolves to the correct view function (all_questions)
def test_questions_url_uses_all_questions_view(self): root = resolve('/questions/hex_to_binary/') self.assertEqual(root.func, all_questions)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_faq_view(self):\n response = self.client.get(url_for('main.faq'))\n self.assertEqual(response.status_code, 200)", "def test_can_view_question_and_result(self):\n self.client.login(username='Marry', password='secret')\n self.assertTrue(self.user.is_authenticated)\n ques...
[ "0.71953076", "0.69321454", "0.6885609", "0.68377733", "0.68144286", "0.67739356", "0.6733873", "0.6705194", "0.66541904", "0.6603248", "0.6597794", "0.6566116", "0.6562151", "0.6501487", "0.64821017", "0.64663404", "0.64407516", "0.6424634", "0.6406426", "0.64031273", "0.638...
0.79760945
0
Validates if incoming 'type' dictionary conforms to TypeDescription
def validate_type(in_type: Mapping[str, Any]) -> TypeDescription: # Check if all keys are there missing_keys = {"name", "weights", "access"}.difference(in_type.keys()) if missing_keys: missing_keys = ", ".join(repr(i) for i in sorted(missing_keys)) raise InvalidTypeDescription("Provided type...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_valid_type(type):\n return type in type_to_adapter", "def _validate_type_recursively(\n mapping: Mapping[str, Any], ref: str, types: Set[str],\n depth: int) -> Optional[SchemaError]:\n # pylint: disable=too-many-return-statements\n # pylint: disable=too-many-branches\n\n if depth...
[ "0.67650956", "0.65287703", "0.6488632", "0.64747626", "0.64279264", "0.6340056", "0.6334559", "0.6326759", "0.62640584", "0.62295926", "0.62209404", "0.6210063", "0.6192984", "0.61857104", "0.6173146", "0.6159634", "0.6157457", "0.6145548", "0.614353", "0.6119596", "0.611085...
0.83230186
0
concat input and prediction, remove the last unfinished sentence, remove dialog line
def cleanGpt2Prediction(input_text, prediction): if input_text and input_text[-1] != " ": input_text += " " prediction = input_text + prediction.strip() cutted = "" if prediction[-1] != '.': last_dot_idx = prediction.rfind('. ') if last_dot_idx != -1: cutted = prediction[last...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _postprocess_complete_hypos(hypos):\n if args.remove_eos:\n for hypo in hypos:\n if (hypo.trgt_sentence \n and hypo.trgt_sentence[-1] == utils.EOS_ID):\n hypo.trgt_sentence = hypo.trgt_sentence[:-1]\n if args.nbest > 0:\n hypos = hypos[:args.nbes...
[ "0.5635517", "0.56239355", "0.5614382", "0.55818003", "0.55381703", "0.5526884", "0.5446416", "0.54306656", "0.540793", "0.53546315", "0.53423756", "0.53364795", "0.5336034", "0.5327694", "0.53220046", "0.5313437", "0.5299082", "0.5253136", "0.5233619", "0.52302986", "0.52283...
0.6578883
0
monthly_labor_hours() for a chore that happens three times a week with a 30 minute duration should return the integer 360
def test_monthly_labor_hours_weekly_chores(self): weekly_chore = Chore(occurance='2', duration_minutes=30, days_weekly="0|1|4") answer = int(360) question = weekly_chore.monthly_labor_hours() self.assertEqual(question, answer)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def monthly_labor_hours(self):\n if self.occurance == '1':\n monthly_hours = self.duration_minutes * int(30)\n elif self.occurance == '2':\n monthly_hours = len(self.days_weekly.split(\"|\")) * 4 * self.duration_minutes\n elif self.occurance == '3':\n monthly_h...
[ "0.7727912", "0.69492304", "0.68332464", "0.58278596", "0.5827851", "0.5819852", "0.5668013", "0.55691105", "0.5537267", "0.5536322", "0.5513675", "0.5484429", "0.54285187", "0.5417959", "0.5397738", "0.53930557", "0.5374937", "0.5366393", "0.5358065", "0.53534234", "0.534333...
0.7040624
1
monthly_labor_hours() for a monthly chore with a 30 minute duration should return the integer 30
def test_monthly_labor_hours_monthly_chores(self): monthly_chore = Chore(occurance='3', duration_minutes=30) answer = int(30) question = monthly_chore.monthly_labor_hours() self.assertEqual(question, answer)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def monthly_labor_hours(self):\n if self.occurance == '1':\n monthly_hours = self.duration_minutes * int(30)\n elif self.occurance == '2':\n monthly_hours = len(self.days_weekly.split(\"|\")) * 4 * self.duration_minutes\n elif self.occurance == '3':\n monthly_h...
[ "0.8053651", "0.70165855", "0.69241035", "0.5587693", "0.55803674", "0.5553623", "0.5545402", "0.552477", "0.5512891", "0.5475473", "0.54480314", "0.54146206", "0.52579695", "0.5254562", "0.5198504", "0.5196895", "0.5195216", "0.5186368", "0.5138302", "0.5122571", "0.5115165"...
0.73909503
1
Returns BeautifulSoup object from HTML parsed from parameter url Grabs HTML and headers from parameter url. Opens HTML as a file and parses contents into BeautifulSoup object. Closes file and returns object.
def return_beautiful_soup_object(url: str) -> bs4.BeautifulSoup: html_filename, headers = urllib.request.urlretrieve(url) with open(html_filename) as file: soup = BeautifulSoup(file, 'html.parser') file.close() return soup
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def make_soup(url):\r\n htmlFile = urllib.request.urlopen(url).read()\r\n soup = BeautifulSoup(htmlFile)\r\n return soup", "def get_html_parser(url):\n response = requests.get(url)\n return BeautifulSoup(response.content, 'html.parser')", "def get_soup(url):\n\tresponse = urlopen(url)\n\thtml = ...
[ "0.731567", "0.7108163", "0.694695", "0.68437636", "0.6778365", "0.6753893", "0.6739213", "0.6681862", "0.6659902", "0.65914464", "0.6585137", "0.6540613", "0.6539541", "0.65349334", "0.6514439", "0.65106994", "0.65085334", "0.64972", "0.64885366", "0.64742994", "0.6460556", ...
0.7571493
0
Returns title of top 100 movie list, top 100 movies, corresponding rotten tomato ratings Creates a BeautifulSoup object from parameter url. Creates list of table cells. Grabs list of ratings from span tags in cells. Grabs list of movies from cells. Returns tuple of BeautifulSoup object title, list of top 100 movies, li...
def return_movie_list(url: str) -> (bs4.element.NavigableString, list, list): soup = return_beautiful_soup_object(url) cell_data_list = soup.find('body').find('div', {'class': 'col-left-center'}).find('table').find_all('td') span_rating_list = list([cell.find_all('span', {'class': 'tMeterScore'}) for cell i...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_rating(text):\n movie = text\n page = requests.get('http://www.imdb.com/find?ref_=nv_sr_fn&q=' + movie + '&s=tt')\n soup1 = BeautifulSoup(page.content, 'html.parser')\n movieid = soup1.select(\".findList tr a\")[0].get('href')\n movielink = \"http://www.imdb.com\" + movieid\n mlinkpage = ...
[ "0.6881177", "0.6237204", "0.6187697", "0.6138827", "0.6033955", "0.5890299", "0.5867725", "0.58045876", "0.5800518", "0.5796472", "0.5792307", "0.5767643", "0.5758419", "0.5757541", "0.57461756", "0.57411134", "0.57368845", "0.5724035", "0.5710937", "0.5692533", "0.565877", ...
0.7142094
0
Get SC name from book xml.
def get_sc_name(book): xml_path = os.path.join(book, 'META.XML') xml_content = open(xml_path).read() xml_tree = BeautifulSoup(xml_content) # Try checking if the meta.xml file has scanningcentre tag try: sc_book = xml_tree.find('scanningcentre').text except AttributeError: try: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def book_name(self, path, filemoving, parser):\n root = parser.parsing_xml(path, filemoving)\n root_tag = root.tag[0:(root.tag.find('}')+1)]\n book_title = str()\n for i in root.iter(root_tag+'book-title'):\n book_title = book_title + ' ' + i.text\n return book_title",...
[ "0.7128723", "0.67771816", "0.60914284", "0.6087131", "0.5970353", "0.5864337", "0.5852035", "0.5843556", "0.58374494", "0.5762581", "0.5717933", "0.5697013", "0.5683906", "0.5675634", "0.56563354", "0.56554484", "0.5632446", "0.5629869", "0.5595333", "0.5584433", "0.5583341"...
0.813456
0
Get all center names from all books.
def get_center_names(): center_names = list() book_count = 0 for partition in partitions: for language in languages: search_dir = os.path.join(main_path, partition, language) folder_list = [i for i in os.listdir(search_dir) if not os.path.isfile(search_dir + '/' + i)] ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def demo_get_all_books(self):\n results = []\n self.cursor.execute(\"\"\"SELECT ISBN FROM book\"\"\")\n for book in self.cursor.fetchall():\n results.append(book[0])\n return results", "def get_all_books() -> List[Dict]:\n pass", "def get_center_names():\n q = Queue()...
[ "0.5733664", "0.57029", "0.56515616", "0.5559594", "0.553492", "0.55271447", "0.536371", "0.5311013", "0.52939445", "0.52939445", "0.5261815", "0.5243874", "0.52079064", "0.51975805", "0.51804894", "0.5152847", "0.51428276", "0.5141663", "0.514116", "0.51261574", "0.5125251",...
0.7485725
0
Cluster similar names together.
def cluster_names(center_names): names = np.asarray(center_names) print("Clustering names.") lev_similarity = -1*np.array([[distance.levenshtein(w1, w2) for w1 in names] for w2 in names]) affprop = sklearn.cluster.AffinityPropagation(affinity="precomputed", damping=0.5) affprop.fit(lev_similarity) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _Clustered(self):\n def cluster_func(symbol):\n name = symbol.full_name\n if not name or symbol.IsStringLiteral():\n # min_count=2 will ensure order is maintained while not being grouped.\n # \"&\" to distinguish from real symbol names, id() to ensure uniqueness.\n name = '&' ...
[ "0.6590434", "0.64326185", "0.6394237", "0.6040207", "0.59744763", "0.5955054", "0.5871122", "0.5848188", "0.58220047", "0.5820279", "0.58174014", "0.5788841", "0.57554317", "0.5748046", "0.5747788", "0.57340914", "0.5720693", "0.5698982", "0.56827146", "0.56658274", "0.56204...
0.6661097
0
Given the prepared and ordered csv file filename returns a dict with the frequencies for each (guard, time)
def produce_data2(self, filename): filepath = f'data/{filename}-sorted.csv' time_by_guards = defaultdict(int) guard = None asleep = None with open(filepath) as in_file: line = in_file.readline() while line: line = line.replace('\n', '') ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def analyze(filename):\n\n date_dict = {\"2013\":0,\"2014\":0,\"2015\":0,\"2016\":0,\"2017\":0,\"2018\":0}\n\n start = datetime.datetime.now()\n\n with open(filename) as csvfile:\n for line in csvfile:\n lrow = line.split(',')\n\n if \"ao\" in lrow[6]:\n found +...
[ "0.6700097", "0.6478216", "0.64519036", "0.6297964", "0.6104733", "0.60697645", "0.60577524", "0.5999336", "0.5948449", "0.58889997", "0.5876995", "0.58429873", "0.57529354", "0.5690326", "0.5602536", "0.5578772", "0.5576029", "0.55581313", "0.55518013", "0.5542852", "0.55327...
0.6568651
1
reads a tif file to numpy array and returns
def read_tif(filename): raster = gdal.Open(filename, GA_ReadOnly) imarray = np.array(raster.ReadAsArray()) return imarray
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def tiff_to_ndarray(fn):\n return tifffile.imread(fn)", "def read_tif_to_np(tif_path: str):\n with rasterio.open(tif_path) as f:\n return f.read()", "def tiffread(fname):\n from PIL import Image\n img = Image.open(fname)\n \n res = []\n offsets = []\n frame = 0\n try:\n ...
[ "0.8278162", "0.80133575", "0.73199797", "0.73007286", "0.7097436", "0.70163614", "0.70100963", "0.69725543", "0.6940198", "0.69367915", "0.6913471", "0.68892235", "0.6862037", "0.6856555", "0.68478674", "0.6804855", "0.6803037", "0.67948246", "0.67370015", "0.67361444", "0.6...
0.80847746
1
Takes image label tif file "semantic_label_file" and creates mask rcnn usable labels and save it to output_label_file with .npy extension.
def new_mrcnn(semantic_label_file, output_label_file): img = skimage.io.imread(semantic_label_file) img = img[64:192, 64:192] img_labeled = skimage.measure.label(img, connectivity=1) idx = [np.where(img_labeled == label) for label in np.unique(img_labeled) if label] list_of_all_mask_indices = [] ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def read_mask(filename):\n # single label images\n # source_msk = (cv.imread(mask_filename) > 0).astype(np.float)\n # display_img = blend_in_channel(source_img, source_msk)\n\n # multi-label images\n try:\n source_msk = cv.imread(filename, cv.IMREAD_ANYCOLOR)\n except FileNotFoundError as e:\n logger.w...
[ "0.6593508", "0.6441582", "0.63976413", "0.63069886", "0.6299829", "0.62886554", "0.6267605", "0.62474006", "0.6233766", "0.62310547", "0.6210384", "0.62041223", "0.61480963", "0.6138977", "0.61361057", "0.6098869", "0.6065202", "0.6059109", "0.6055464", "0.6055339", "0.60093...
0.8263257
0
Build a 3D convolutional network, based loosely on C3D.
def conv_3d(self): # Model. model = Sequential() model.add(Conv3D(32, (3,3,3), activation='relu', input_shape=self.input_shape)) model.add(MaxPooling3D(pool_size=(1, 2, 2), strides=(1, 2, 2))) model.add(Conv3D(64, (3,3,3), activation='relu')) model.add(MaxPooling3D(pool_s...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def c3d(self):\n model = Sequential()\n # 1st layer group\n model.add(Conv3D(64, 3, 3, 3, activation='relu',\n border_mode='same', name='conv1',\n subsample=(1, 1, 1),\n input_shape=self.input_shape))\n model.add(Ma...
[ "0.7309145", "0.7183123", "0.716791", "0.70170295", "0.69881535", "0.6914603", "0.6825567", "0.6825567", "0.6825567", "0.6825567", "0.6825567", "0.6825567", "0.6825567", "0.6817752", "0.6817186", "0.6817186", "0.68154675", "0.6814586", "0.6811636", "0.68095183", "0.68095183",...
0.7214952
1
Build a 3D convolutional network, aka C3D.
def c3d(self): model = Sequential() # 1st layer group model.add(Conv3D(64, 3, 3, 3, activation='relu', border_mode='same', name='conv1', subsample=(1, 1, 1), input_shape=self.input_shape)) model.add(MaxPooling3D(p...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def conv_3d(self):\n # Model.\n model = Sequential()\n model.add(Conv3D(32, (3,3,3), activation='relu', input_shape=self.input_shape))\n model.add(MaxPooling3D(pool_size=(1, 2, 2), strides=(1, 2, 2)))\n model.add(Conv3D(64, (3,3,3), activation='relu'))\n model.add(MaxPooli...
[ "0.7281649", "0.71841615", "0.707168", "0.690172", "0.68788487", "0.68189096", "0.67646915", "0.6761545", "0.6761545", "0.67369956", "0.67341983", "0.67341983", "0.67341983", "0.67341983", "0.67341983", "0.67341983", "0.67341983", "0.67245495", "0.6720777", "0.6718091", "0.67...
0.74094737
0
Test that a stored bookmark has correct values.
def test_retrieving_valid_bookmark(self): noteless_bookmark = Bookmark.objects.get(name="Noteless bookmark") self.assertEqual(noteless_bookmark.name, "Noteless bookmark") self.assertEqual(noteless_bookmark.url, "http://www.noteless-in-seattle.com") self.assertEqual(notele...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_retrieving_valid_bookmark(self):\n noteless_bookmark = Bookmark.objects.get(name=\"Noteless bookmark\")\n self.assertEqual(noteless_bookmark.name, \"Noteless bookmark\")\n self.assertEqual(noteless_bookmark.url, \"http://www.bookmarkless-in-seattle.com\")\n self.assertEqual(not...
[ "0.75798833", "0.7154238", "0.70856446", "0.6980885", "0.672384", "0.6618409", "0.6576093", "0.65148264", "0.6471339", "0.64576447", "0.6416907", "0.6366619", "0.6312722", "0.6272852", "0.6258952", "0.62477326", "0.62343085", "0.62253827", "0.61246336", "0.6123822", "0.608364...
0.7592817
0
Ensure database enforces validity/constraints on Bookmarks.
def test_invalid_bookmarks(self): Bookmark.objects.create(name="Bookmark * without* URL") Bookmark.objects.create(name=123, url=456)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def validate(self):\n raise BookInfoNotImplementedError('validate', self.__class__.__name__)", "def __Verify(self):\n if not self.title:\n raise db.Error('Missing title; required.')", "def test_invalid_bookmarks(self):\n Bookmark.objects.create(name=\"Bookmark with invalid url\",\n ...
[ "0.5959627", "0.59323055", "0.5747002", "0.5685666", "0.5601697", "0.55544573", "0.5488286", "0.54179174", "0.5394782", "0.5376617", "0.53581905", "0.52509665", "0.5204145", "0.51694006", "0.5164948", "0.51541424", "0.5151799", "0.5122517", "0.51065385", "0.51044357", "0.5087...
0.60024244
0
Ensrue database enforces unique urls
def test_dupe_urls(self): with self.assertRaises(IntegrityError) as context: Bookmark.objects.create(name="Bookmark 2", url="http://www.example.com") self.assertTrue('UNIQUE constraint failed' in context.exception)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_unique_url(self):\n Route.objects.create(url='/')\n\n with self.assertRaises(IntegrityError):\n Route.objects.create(url='/')", "def _insert_url_to_db(self, url=None):\n if url and len(url) < 4096 and not self.server.hostname.lower() in url.lower():\n\n # Now c...
[ "0.697308", "0.68149126", "0.6784839", "0.67391247", "0.65034", "0.6459036", "0.62296164", "0.6060469", "0.5947457", "0.58886105", "0.581536", "0.5803317", "0.5753691", "0.5687371", "0.56700826", "0.5639896", "0.5627217", "0.5615845", "0.5607132", "0.5603701", "0.5593838", ...
0.70713276
0
Load yaml database and return in a list.
def load_db(dbpath): if not os.path.exists(dbpath): print("Cannot find %s directory, rerun from MacInfoPkg directory!" % dbpath) sys.exit(1) db = [] for root, dirs, files in os.walk(dbpath): for file in fnmatch.filter(files, '*.yaml'): path = os.path.join(root, file) with open(path, 'r'...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def loadblogs(filename):\n\n stream = file(filename, 'r')\n data = yaml.load_all(stream)\n return data", "def load_gas_list(path):\n with open(path, 'r') as f:\n return yaml.load(f)", "def load() -> list:\n peliculas: list = []\n\n with open('./db.json', 'r') as in_file:\n ...
[ "0.66753155", "0.6607099", "0.6551427", "0.65099204", "0.64274246", "0.6128127", "0.61239195", "0.609624", "0.6062478", "0.6054778", "0.60431147", "0.6034601", "0.60065943", "0.59837484", "0.59815836", "0.59759754", "0.59693843", "0.5950521", "0.5918646", "0.5897892", "0.5897...
0.6620518
1
Export yaml database to MacInfoLib format.
def export_db_macinfolib(db, path, year): with open(path, 'w') as fh: print('// DO NOT EDIT! This is an autogenerated file.', file=fh) print('#include "MacInfoInternal.h"', file=fh) print('CONST MAC_INFO_INTERNAL_ENTRY gMacInfoModels[] = {', file=fh) for info in db: if max(info['AppleModelYear...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def export_table():\n\n from yaml import dump\n parser = argparse.ArgumentParser(\n description='export a table to a yaml file')\n parser.add_argument('--table', dest='table',\n help='the table to export')\n args, env = initialize_command(parser)\n\n table = _find_table...
[ "0.68789756", "0.6174892", "0.58907026", "0.57922786", "0.56275105", "0.5553694", "0.5451847", "0.541402", "0.540777", "0.54046905", "0.53963894", "0.53548735", "0.5236938", "0.5218219", "0.5188798", "0.51860785", "0.5147203", "0.51352185", "0.5108384", "0.5070389", "0.506061...
0.63474286
1
Export yaml database to macserial format.
def export_db_macserial(db, path, year): with open(path, 'w') as fh: print('#ifndef GENSERIAL_MODELINFO_AUTOGEN_H', file=fh) print('#define GENSERIAL_MODELINFO_AUTOGEN_H\n', file=fh) print('// DO NOT EDIT! This is an autogenerated file.\n', file=fh) print('#include "macserial.h"\n', file=fh) pri...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def export_table():\n\n from yaml import dump\n parser = argparse.ArgumentParser(\n description='export a table to a yaml file')\n parser.add_argument('--table', dest='table',\n help='the table to export')\n args, env = initialize_command(parser)\n\n table = _find_table...
[ "0.6711777", "0.57771856", "0.5551253", "0.5485655", "0.54499036", "0.542864", "0.54158723", "0.53686345", "0.536351", "0.53019035", "0.5186816", "0.51187485", "0.51108193", "0.5106625", "0.50749713", "0.50749385", "0.50713545", "0.50585586", "0.50352424", "0.5016931", "0.500...
0.6494807
1
Formats forward output into a prediction object
def to_predictions( self, forward_output: torch.Tensor ) -> BatchModelPrediction[torch.Tensor]: return BatchModelPrediction(features=forward_output)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def walk_forward_prediction(self):\r\n for output_name in self.output_names:\r\n print('\\t\\t\\t|--Prediction type: {}'.format(output_name))\r\n predictions_by_model = {}\r\n pred_metadata_by_model = {}\r\n \r\n print('\\t\\t\\t\\t|--SVM Model')\r\n ...
[ "0.72831774", "0.6768164", "0.6714174", "0.66354877", "0.66354877", "0.6513517", "0.6513517", "0.6513517", "0.65103155", "0.6477761", "0.6415214", "0.6411361", "0.6376519", "0.6374914", "0.63666666", "0.6343184", "0.63362277", "0.6334965", "0.632226", "0.6317082", "0.6316294"...
0.7042705
1
do the transform of `data` from `source_format` to `target_format`
def __call__(data, source_format, target_format):
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def ConvertBetweenDataFormats(x, data_format_src, data_format_dst):\n\n valid_data_formats = [\"NHWC\", \"NCHW\", \"HWNC\", \"HWCN\", \"NDHWC\", \"NCDHW\"]\n if len(data_format_src) != len(data_format_dst):\n raise ValueError(\n \"data_format_src and data_format_dst must have the same dimension, got\"\...
[ "0.6712016", "0.6592488", "0.60503983", "0.58437043", "0.58321065", "0.58020824", "0.5783509", "0.5773146", "0.57703835", "0.57351303", "0.5641233", "0.56395006", "0.55445886", "0.54479176", "0.5440565", "0.54361445", "0.53883857", "0.53736275", "0.53361034", "0.53352904", "0...
0.7780138
0
Export `objects' to the target_format. `omit_fields_mapping' is a dictionary with keys for publication_type names and values as lists of fields to omit when rendering those types, where field names or not
def render(objects, output_encoding, title_force_uppercase, msdos_eol_style, omit_fields_mapping={}):
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def dump_to_file_format(queryset, file_format, data_zip):\n # create a temporary output stream (temp file)\n if file_format == 'xls':\n # it seems that an excel file needs to be written on a BytesIo even if on the xlwt they write exactly\n # the opposite (I was about to become ...
[ "0.5458358", "0.5420355", "0.53294164", "0.5324569", "0.52508426", "0.5231871", "0.5227155", "0.519814", "0.51970834", "0.5188796", "0.5166592", "0.51332736", "0.5128146", "0.5111749", "0.50599825", "0.50412554", "0.5008734", "0.4992615", "0.49539253", "0.4941637", "0.4939331...
0.6146033
0
Sets the property_config_info_list of this MetadataGetMetadataPropertyResponse200.
def property_config_info_list(self, property_config_info_list): self._property_config_info_list = property_config_info_list
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def transform_property_info_list(se, prop_list, output_type):\n props = [{\"description\": _prop.get(\"description\"),\n \"domain\": transform_schemaclasses_lst(se,\n _prop.get(\"domain\"),\n outpu...
[ "0.5501452", "0.5466533", "0.51612365", "0.48624235", "0.4836705", "0.48125964", "0.47940364", "0.47940364", "0.46879268", "0.46580964", "0.46144414", "0.4598811", "0.45596695", "0.45569187", "0.45034024", "0.446695", "0.44593295", "0.444063", "0.43988055", "0.43818757", "0.4...
0.838632
0
Sets the object_def_name of this MetadataGetMetadataPropertyResponse200.
def object_def_name(self, object_def_name): self._object_def_name = object_def_name
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_object_name(self, object_name = \"DefaultObject\"):\n self.obj_name = object_name", "def object_name(self, object_name):\n if object_name is not None and len(object_name) > 200:\n raise ValueError(\"Invalid value for `object_name`, length must be less than or equal to `200`\") #...
[ "0.59160304", "0.57503647", "0.5247856", "0.52042925", "0.51060224", "0.509241", "0.49918", "0.49878746", "0.49583986", "0.49532628", "0.4946183", "0.49312964", "0.49130526", "0.49104872", "0.4884779", "0.48781466", "0.48595786", "0.48341766", "0.48061055", "0.48044834", "0.4...
0.6785553
0
Sets the search_boost of this MetadataGetMetadataPropertyResponse200.
def search_boost(self, search_boost): self._search_boost = search_boost
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_boost(self, boost):\r\n self._boost = float(boost)\r\n return self", "def set_search_params(self, **kwargs):\n self._search_params = kwargs", "def new_search(self):\n return {'search_parameters': h.get_search_parameters(self.query_builder)}", "def search_target(self, searc...
[ "0.554147", "0.5340003", "0.5081678", "0.5065886", "0.506571", "0.5064557", "0.49435362", "0.49333316", "0.4912667", "0.48086682", "0.4785269", "0.47842878", "0.47275552", "0.47232223", "0.47215566", "0.47044688", "0.4700351", "0.4689238", "0.4671317", "0.46586776", "0.465738...
0.7252891
0
Sets the owner_type of this MetadataGetMetadataPropertyResponse200.
def owner_type(self, owner_type): self._owner_type = owner_type
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_owner(self, owner: Optional[\"STACObject_Type\"]) -> \"Link\":\n self.owner = owner\n return self", "def set_owner(self, owner):\n self.settings[\"owner\"] = owner", "def owner(self, owner):\n if self.local_vars_configuration.client_side_validation and owner is None: # noqa...
[ "0.62579507", "0.6134702", "0.6111381", "0.6087712", "0.5957848", "0.5856001", "0.5746968", "0.5613835", "0.5586895", "0.5586895", "0.5586895", "0.5586895", "0.55771726", "0.55339324", "0.55339324", "0.55339324", "0.55339324", "0.53568935", "0.5288345", "0.5262895", "0.525636...
0.680235
0
Sets the value_type of this MetadataGetMetadataPropertyResponse200.
def value_type(self, value_type): self._value_type = value_type
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_type(self, value):\n self._set_one_attribute(self.AttributeNames.TYPE, value)\n return self", "def type(self, value):\n return value", "def result_value_type(self, result_value_type):\n if self.local_vars_configuration.client_side_validation and result_value_type is None: #...
[ "0.6398391", "0.6134708", "0.59866637", "0.5881304", "0.58185416", "0.5806914", "0.5793433", "0.5684552", "0.5679571", "0.5597685", "0.55814636", "0.5563223", "0.55189264", "0.5469704", "0.5382332", "0.5381352", "0.5317786", "0.52959704", "0.5242676", "0.5215696", "0.52134925...
0.6884918
0
Sets the enum_values of this MetadataGetMetadataPropertyResponse200.
def enum_values(self, enum_values): self._enum_values = enum_values
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def change_enumeration_status(self) -> 'outputs.CloudEndpointChangeEnumerationStatusResponse':\n return pulumi.get(self, \"change_enumeration_status\")", "def setValues(self):\n pass", "def setValues(self):\n pass", "def setValues(self):\n pass", "def setValues(self):\n p...
[ "0.50959206", "0.50511473", "0.50511473", "0.50511473", "0.50511473", "0.50511473", "0.50511473", "0.50457865", "0.50316226", "0.49813488", "0.4975094", "0.49449402", "0.49442732", "0.48518175", "0.48306996", "0.48155868", "0.47379637", "0.46866778", "0.46049413", "0.4600317", ...
0.64605296
0
Sets the editable_in_version of this MetadataGetMetadataPropertyResponse200.
def editable_in_version(self, editable_in_version): self._editable_in_version = editable_in_version
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def editable_in_microversion(self, editable_in_microversion):\n\n self._editable_in_microversion = editable_in_microversion", "def editable(self, editable):\n\n self._editable = editable", "def version_in(self, version_in):\n\n self._version_in = version_in", "def SetEditable(self, edit)...
[ "0.6069111", "0.49822527", "0.4832756", "0.47424522", "0.4720678", "0.46796626", "0.45623007", "0.45469522", "0.453887", "0.45136267", "0.4510907", "0.45051503", "0.44704744", "0.44704744", "0.4444328", "0.43755925", "0.43618062", "0.43462476", "0.43462476", "0.43414843", "0....
0.71043223
0
Sets the blob_mime_type of this MetadataGetMetadataPropertyResponse200.
def blob_mime_type(self, blob_mime_type): self._blob_mime_type = blob_mime_type
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def mime_type(self, mime_type):\n\n self._mime_type = mime_type", "def mime_type(self, mime_type):\n if self.local_vars_configuration.client_side_validation and mime_type is None: # noqa: E501\n raise ValueError(\"Invalid value for `mime_type`, must not be `None`\") # noqa: E501\n ...
[ "0.6014603", "0.5935878", "0.56384075", "0.5125528", "0.49778873", "0.49353427", "0.48646364", "0.48646364", "0.48557353", "0.48329493", "0.48092017", "0.4803838", "0.47740114", "0.47654217", "0.4703668", "0.46747378", "0.46698987", "0.45462763", "0.45371142", "0.4491244", "0...
0.77707267
0
Sets the safe_name of this MetadataGetMetadataPropertyResponse200.
def safe_name(self, safe_name): self._safe_name = safe_name
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def property_name(self, name: str) -> None:\n name = str(name)\n if len(name) > 100:\n name = name[:100]\n self.prop_name = name", "def set_name(self, name):\n return self.set_meta('name', name)", "def get_name(self, name):\n name.value = self._get_name(name.value....
[ "0.5420325", "0.5361161", "0.5346482", "0.5223214", "0.51978594", "0.5180247", "0.5145387", "0.51444584", "0.511654", "0.50235724", "0.50176543", "0.50036055", "0.4995013", "0.4944977", "0.49249235", "0.49249235", "0.49249235", "0.49249235", "0.49249235", "0.48859897", "0.488...
0.5697767
0
Sets the owner_id of this MetadataGetMetadataPropertyResponse200.
def owner_id(self, owner_id): self._owner_id = owner_id
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def owner_id(self, owner_id):\n self._owner_id = owner_id", "def owner_id(self, owner_id):\n if owner_id is None:\n raise ValueError(\"Invalid value for `owner_id`, must not be `None`\") # noqa: E501\n\n self._owner_id = owner_id", "def set_owner(self, owner):\n self.__o...
[ "0.6760593", "0.6578586", "0.6437985", "0.6345639", "0.62267643", "0.6188845", "0.6138685", "0.5942714", "0.5942714", "0.5942714", "0.5942714", "0.5933741", "0.59291255", "0.59291255", "0.59291255", "0.59291255", "0.5900895", "0.5834471", "0.57057893", "0.56453705", "0.561660...
0.6731123
1
Sets the editable_in_microversion of this MetadataGetMetadataPropertyResponse200.
def editable_in_microversion(self, editable_in_microversion): self._editable_in_microversion = editable_in_microversion
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def microversion(self, microversion):\n\n self._microversion = microversion", "def editable_in_version(self, editable_in_version):\n\n self._editable_in_version = editable_in_version", "def setAllowModifyContents(self,value):\n self.PDFreactorConfiguration.in1[\"allowModifyContents\"] = va...
[ "0.543573", "0.5433663", "0.48766235", "0.468464", "0.4661475", "0.4661475", "0.4636184", "0.45906633", "0.45609468", "0.454827", "0.4535242", "0.4535242", "0.4534315", "0.45303527", "0.44875392", "0.44769934", "0.44624925", "0.44334567", "0.4357386", "0.4321399", "0.43207395...
0.7218114
0
Get callback functions from string evaluation.
def get_callbacks(callbacks: List[str]) -> List: callback_functions = [] for callback in callbacks: try: callback_functions.append(eval(callback)) except (NameError, AttributeError) as err: sys.exit(f'{err}. Accepted callbacks from {tf}, {sm}, {tfa}') return callback_...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_func(self, name_str):\n return self.func.get(name_str)", "def eval_with_pFunc(string):\n return eval(string)", "def get_function_from_text(f):\n return lambda x: eval_expr(f, {'x': x}, numpy_dict)", "def parse_function(self, chars):\n if chars[-1] != \"{\":\n raise Exce...
[ "0.60518956", "0.60066175", "0.5882702", "0.58013254", "0.57624954", "0.57268566", "0.56988794", "0.5690281", "0.5687864", "0.5682162", "0.561976", "0.5561556", "0.5538019", "0.5522747", "0.5481236", "0.5442243", "0.54021466", "0.5381251", "0.53760535", "0.5362905", "0.535941...
0.7146108
0
This function should take a symbol as a string along with the start and end dates as Python dates and return the FRED csv download url.
def build_request_url(symbol, start_date, end_date): pass
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def stock_url(stock_symbol, day=None, month=None, year=None):\r\n\r\n page = \"http://ichart.finance.yahoo.com/table.csv?\"\r\n page = ''.join([page, 's=', stock_symbol])\r\n now = datetime.datetime.now()\r\n if day == None:\r\n day = now.day\r\n if month == None:\r\n month = now.month...
[ "0.65525556", "0.6344935", "0.6305575", "0.61563694", "0.60873574", "0.60091454", "0.58184123", "0.580829", "0.57478684", "0.56262517", "0.5602547", "0.5503044", "0.5500913", "0.5466947", "0.54499257", "0.5442382", "0.5432088", "0.54311657", "0.54198885", "0.5415136", "0.5400...
0.6714157
0
Solves for all wire potentials and element currents
def solve(self): # Assign variables to each quantity being solved. r_lookup, lookup, num = {}, {}, 0 for element in self.elements: if is_wire(element) and element is not self.ground: lookup[num] = element r_lookup[element] = num num +=...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def solve(self):", "def get_sol(self):", "def solve(self):\n pass", "def solve(self):\n pass", "def _solve_explicit(self, initial_conditions):\n coeff = self.a ** 2 * self.tau / self.h ** 2\n current_solution = initial_conditions\n next_solution = np.empty_like(current_so...
[ "0.6748275", "0.6638315", "0.6629635", "0.6629635", "0.6623985", "0.65490043", "0.6414992", "0.6364556", "0.63611555", "0.6342324", "0.63379896", "0.632204", "0.63173217", "0.6315901", "0.62956035", "0.62757885", "0.62757885", "0.6269666", "0.6251939", "0.62093335", "0.617231...
0.7694871
0
Mark another node as ground and shift all other potentials
def move_ground(self, wire): if not self.been_solved: self.solve() if not is_wire(wire): raise CircuitError('Ground node must be a wire!') diff, wire.potential = 0 - wire.potential, 0 self.ground = wire for element in self.elements: if is_wire...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _drop_ground_node(self):\n self.laplace = np.concatenate((\n np.concatenate((\n self.laplace[:self.ground_node,:self.ground_node],\n self.laplace[:self.ground_node,self.ground_node+1:]),1),\n\n np.concatenate((\n self.laplace[self.groun...
[ "0.6589597", "0.6098584", "0.590701", "0.58963704", "0.58367926", "0.5810596", "0.5798955", "0.577683", "0.5670311", "0.5604908", "0.556182", "0.55267394", "0.5505696", "0.5468132", "0.5457431", "0.5431328", "0.54260194", "0.54239774", "0.5398131", "0.5396238", "0.53902805", ...
0.6633579
0
Set circuit's ground to node with lowest potential.
def ground_min(self): def compare(e): if is_wire(e): return e.potential else: return float('inf') self.move_ground(min(self.elements, key=compare))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def move_ground(self, wire):\n if not self.been_solved:\n self.solve()\n if not is_wire(wire):\n raise CircuitError('Ground node must be a wire!')\n diff, wire.potential = 0 - wire.potential, 0\n self.ground = wire\n\n for element in self.elements:\n ...
[ "0.6502095", "0.5623188", "0.5501311", "0.5347633", "0.53336316", "0.5318281", "0.5314707", "0.5281544", "0.5252342", "0.5241506", "0.5092604", "0.5077657", "0.5040392", "0.4986942", "0.49781415", "0.49624437", "0.49273628", "0.48928267", "0.48678857", "0.48678857", "0.486028...
0.7420538
0
Swap resistor terminals to make all associated currents positive.
def align_resistors(self): if not self.been_solved: self.solve() for element in self.elements: if is_resistor(element) and element.current < 0: element.pos, element.neg = element.neg, element.pos element.current = -1 * element.current
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def SwapSides(self):\n for c in self.reactants:\n c.coeff = -c.coeff", "def backward_shimmey(self):\n for x in range(6):\n self.right(primary=-70, counter=-30)\n time.sleep(.5)\n self.left(primary=-70, counter=-30)\n time.sleep(.5)\n sel...
[ "0.6112504", "0.5479623", "0.5479623", "0.54767114", "0.54382795", "0.54289454", "0.5425752", "0.54230195", "0.5415701", "0.53544855", "0.5345064", "0.532094", "0.53203166", "0.5319765", "0.530061", "0.52973", "0.52969086", "0.5269201", "0.5256599", "0.5243992", "0.524036", ...
0.6238543
0
u""" loads all images using a IImageLoadermage implementation and fills up the indexed_tiles dictionary. The image may have per pixel alpha or a colorkey set.
def load(self, image_loader): self._image_loader = image_loader for tile_set in self.tile_sets: # do images first, because tiles could reference it for img in tile_set.images: if img.source: self._load_image_from_source(tile_set, img) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load_image_parts(self, filename, margin, spacing, tile_width, tile_height, colorkey=None): #-> [images]\n raise NotImplementedError(u'This should be implemented in a inherited class')", "def load_image_parts(self, filename, margin, spacing, tile_width, tile_height, colorkey=None): #-> [images]\n ...
[ "0.62286973", "0.62286973", "0.61891747", "0.6164412", "0.6058986", "0.60327", "0.60071886", "0.5982435", "0.5982435", "0.5939838", "0.59366435", "0.5930428", "0.5904649", "0.59029424", "0.589667", "0.5872197", "0.583265", "0.5811293", "0.577914", "0.5711908", "0.5691835", ...
0.7240075
1
u""" Decodes a base64 string and returns it.
def decode_base64(in_str): return base64.decodestring(in_str)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def decode_base64(in_str):\n import base64\n return base64.decodestring(in_str)", "def _b64decode(self, string):\n import base64\n return base64.b64decode(string)", "def _b64decode(self, string):\n import base64\n return base64.b64decode(string)", "def base64_decode_string(s...
[ "0.8679929", "0.8346433", "0.8346433", "0.8262463", "0.81805646", "0.8104695", "0.8017326", "0.80098075", "0.78629017", "0.782042", "0.78044885", "0.7754842", "0.7754188", "0.77081966", "0.763124", "0.75940216", "0.75940216", "0.75852203", "0.75363725", "0.7421869", "0.740926...
0.8689377
0
u""" Uncompresses a gzip string and returns it.
def decompress_gzip(in_str): # gzip can only handle file object therefore using StringIO copmressed_stream = StringIO.StringIO(in_str) gzipper = gzip.GzipFile(fileobj=copmressed_stream) s = gzipper.read() gzipper.close() return s
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def decompress_gzip(in_str):\n import gzip\n # gzip can only handle file object therefore using StringIO\n copmressed_stream = StringIO.StringIO(in_str)\n gzipper = gzip.GzipFile(fileobj=copmressed_stream)\n s = gzipper.read()\n gzipper.close()\n return s", "def de_gzip(data):\n cmps = St...
[ "0.7854372", "0.7446102", "0.7446102", "0.72995234", "0.70665854", "0.7030681", "0.70204985", "0.6955059", "0.69495237", "0.6873772", "0.68612367", "0.6636305", "0.65708786", "0.656411", "0.65477306", "0.64801675", "0.644598", "0.6374301", "0.635607", "0.62824976", "0.6212102...
0.7803461
1
Loads and views a map using pyglet. Holding the arrow keys will scroll along the map. Holding the left shift key will make you scroll faster. Pressing the escape key ends the application.
def demo_pyglet(file_name): import pyglet from pyglet.gl import glTranslatef, glLoadIdentity world_map = TileMapParser().parse_decode(file_name) # delta is the x/y position of the map view. # delta is a list because the scoping is different for immutable types. # This list can be used within t...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def map():\n\n return render_template(\"map.html\")", "def map_viewing_client():\n\n # Read configuration settings\n config = gis.get_config()\n if config.opt_gis_layout == 1:\n window = True\n else:\n window = False\n\n # @ToDo Make Configurable\n toolbar = True\n\n map = d...
[ "0.62152755", "0.6136849", "0.6125635", "0.6097488", "0.60173994", "0.6001883", "0.58387536", "0.5717821", "0.57010967", "0.5659954", "0.55729", "0.5562986", "0.5478422", "0.547622", "0.54472274", "0.5420193", "0.5409713", "0.5408205", "0.53714573", "0.5350543", "0.53290933",...
0.7124441
0
returns the vector v (represented as a list) as a n x 1 matrix
def vector_as_matrix(v): return [[v_i] for v_i in v]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def toMatrix(self,v):\n return Matrix([[v.x],[v.y],[v.z]])", "def creer_matrice(n, p, v):\n return [[v] * p for i in range(n)]", "def smat(v):\n \n k = len(v)\n n = TriLengthToSquare(k)\n \n A = np.zeros([n,n])\n A[np.triu_indices(n)] = v\n A[np.triu_indices(n,1)] *= 2 / np.sqrt(...
[ "0.7460186", "0.7171361", "0.71355784", "0.711085", "0.7050488", "0.6927637", "0.6859887", "0.6822389", "0.6798315", "0.6762203", "0.67293704", "0.67069745", "0.65540206", "0.6540934", "0.650618", "0.6482817", "0.6461044", "0.6446743", "0.6375715", "0.6335767", "0.63268703", ...
0.86835176
0
returns a num_rows x num_cols matrix whose (i,j)th entry is entry_fn(i,j)
def make_matrix(num_rows, num_cols, entry_fn): return [[entry_fn(i,j) # given i, create a list for j in range(num_cols)] # [entry_fn(i,0),....] for i in range(num_rows)] # create one list for each i
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def make_matrix(num_rows, num_cols, entry_fn):\n return [[entry_fn(i, j)\n for j in range(num_cols)]\n for i in range(num_rows)]", "def make_matrix(num_rows, num_cols, entry_fn):\n return [[entry_fn(i, j) for j in list(range(num_cols))]\n for i in list(range(num_rows))]", ...
[ "0.797381", "0.78332067", "0.77501595", "0.7731737", "0.76593083", "0.76112723", "0.5675574", "0.5574869", "0.52691776", "0.52571756", "0.52202064", "0.5088102", "0.505206", "0.50454396", "0.50061226", "0.4977327", "0.49635875", "0.49429196", "0.49209425", "0.49148926", "0.49...
0.7863683
1
Finds the convex hull vertices for a binary image.
def convex_hull(image): corners = find_corners(image) vertices = [corners[0]] for i in range(len(corners)): vertices.extend( _convex_hull_side( image, corners[i], corners[(i + 1) % len(corners)])) return vertices
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _convex_hull_side(image, start, end):\n\n convex_points = [start]\n\n x_start, y_start = start\n x_end, y_end = end\n\n side = (x_start <= x_end, y_start <= y_end)\n\n\n ranges = {\n (True, True): [\n [x_start + 1, x_end + 1],\n [y_start, y_end + 1],\n Fal...
[ "0.66185606", "0.65925556", "0.6404849", "0.63906044", "0.62173593", "0.61729914", "0.6167283", "0.6126101", "0.6119189", "0.6116938", "0.6107539", "0.6077359", "0.6054224", "0.6024921", "0.5970237", "0.5951416", "0.59464514", "0.5876225", "0.5851322", "0.58328754", "0.579945...
0.7807204
0
Convex hull on rectanglar subset of an image from one direction.
def _convex_hull_side(image, start, end): convex_points = [start] x_start, y_start = start x_end, y_end = end side = (x_start <= x_end, y_start <= y_end) ranges = { (True, True): [ [x_start + 1, x_end + 1], [y_start, y_end + 1], False ], ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def convex_hull(image):\n\n corners = find_corners(image)\n\n\n vertices = [corners[0]]\n\n for i in range(len(corners)):\n vertices.extend(\n _convex_hull_side(\n image, corners[i], corners[(i + 1) % len(corners)]))\n\n return vertices", "def convex_hull(l):\n\tpass"...
[ "0.71546024", "0.7066417", "0.68517125", "0.66062605", "0.64507663", "0.64242214", "0.63546187", "0.6305958", "0.622463", "0.6215613", "0.6079025", "0.6067523", "0.6053519", "0.6044224", "0.6040111", "0.6036016", "0.6008054", "0.5993726", "0.59848875", "0.5952869", "0.5922153...
0.71620977
0
Return transection of 2 dicts, value based on the second dict.
def make_transection(dict1, dict2): _res = {} for _key in dict1: if dict2.get(_key, None): _res[_key] = dict2.get(_key) return _res
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def merge_two_dicts(self, x, y):\n z = x.copy()\n z.update(y)\n return z", "def merge_two_dicts(x, y):\n\tz = x.copy()\n\tz.update(y)\n\treturn z", "def merge_two_dicts(x, y):\r\n z = x.copy()\r\n z.update(y)\r\n return z", "def Map(a, b):\n out = {}\n for key, value in a....
[ "0.6411219", "0.6406409", "0.63682616", "0.6355881", "0.62652725", "0.62346476", "0.62346476", "0.62346476", "0.62346476", "0.62346476", "0.62346476", "0.62346476", "0.62346476", "0.62209195", "0.619405", "0.6150861", "0.61296916", "0.6110062", "0.60986817", "0.60906684", "0....
0.78952986
0
Search pattern in value, return re.match object or None
def search_pattern(self, value, pattern): _pattern = re.compile(pattern) _match = _pattern.search(value) return _match
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def upy_re_match(regex,value):\n reg = re.compile(regex)\n return reg.match(value)", "def find_pattern_in_str(pattern, source):\n pattern = re.compile(pattern)\n for match in re.finditer(pattern,source):\n return match.groups()\n return None", "def regexp_predicate(value):\n return re....
[ "0.7351109", "0.7274265", "0.70951056", "0.70883113", "0.6930596", "0.6746053", "0.6690308", "0.6677843", "0.66770726", "0.66378164", "0.6610446", "0.6571676", "0.65109867", "0.6491868", "0.64809334", "0.6462299", "0.6449279", "0.6421592", "0.63843125", "0.6378626", "0.637618...
0.83068943
0
Return True if func(value) in period [lower_bound, upper_bound]
def in_period(self, value, lower_bound, upper_bound, func=lambda _x: _x): if ((lower_bound==None) and (upper_bound==None)): return True if (lower_bound==None): return func(value) <= upper_bound if (upper_bound==None): return func(value) >= lower_bound ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_in_interval(self, low, high, value):\n return low <= value and value <= high", "def _in_interval(value, low, up):\n if low <= value <= up:\n return True\n else:\n return False", "def in_interval(value: float, s: float, e: float) -> bool:\n lower = value >= s\n upper = va...
[ "0.7390917", "0.7315273", "0.7120506", "0.7007164", "0.6810346", "0.6785845", "0.6709115", "0.6685867", "0.6654818", "0.65805626", "0.65646034", "0.65642846", "0.65626836", "0.65625775", "0.6539754", "0.64962965", "0.6487048", "0.6446186", "0.64263463", "0.6382399", "0.637336...
0.9073253
0
Return True if value exists in class_reference.key
def is_exist(self, class_reference, **key_value): return True if service.select_from(class_reference, **key_value).get() else False
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def has(self, key):", "def __contains__(cls, key):\n return cls.classCase(key) in cls._Registry", "def __contains__(self, key):\n try:\n self[key]\n return True\n except:\n return False", "def __contains__(self, key):\n try:\n self._get(key)\n return T...
[ "0.7454946", "0.7216809", "0.7194977", "0.7078876", "0.70783114", "0.70591164", "0.7056134", "0.70522326", "0.70171887", "0.69550234", "0.6934124", "0.69270825", "0.6878974", "0.6861974", "0.68301535", "0.68145126", "0.6813889", "0.6807802", "0.6806281", "0.6797548", "0.67920...
0.811647
0
generate a term frequency matrix using the unique code words and the local histograms/graphlets
def make_term_doc_matrix(self): print "\ngenerating term-frequency matrix:" try: len_of_code_book = self.len_of_code_book except AttributeError as e: print ">>> temp histogram method not run. exit()" sys.exit(1) # change this to serch for the longest histgor...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def countFreq(self,document):\n self.document = document\n vocab=['python','js','android','php','django','javascript','oracle','ruby','rails','java']\n cnt_vector = CountVectorizer(vocabulary=vocab)\n self.freq_term_matrix = cnt_vector.fit_transform(self.document)\n return self.f...
[ "0.6736817", "0.6309775", "0.6265503", "0.6237223", "0.62358695", "0.623433", "0.6218426", "0.62034476", "0.61744404", "0.6155364", "0.61285096", "0.6107603", "0.61013556", "0.6098114", "0.6075656", "0.59813964", "0.5963353", "0.5954939", "0.5936258", "0.5935721", "0.5926272"...
0.71253586
0
learn a topic model using LDA.
def learn_topic_model_activities(self): print "\nLearning a topic model with LDA:" doc_topic, topic_word = tm.run_topic_model(self.accu_path, self.config['lda']) tm.dump_lda_output(self.lda_path, doc_topic, topic_word) print "Topic Modelling - done.\n" return True
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _lda(self):\n self.ldamodel = gensim.models.ldamodel.LdaModel(self.gensim_corpus, \n num_topics=self.n_topics, \n id2word=self.id_map, \n passes=self.n_pas...
[ "0.8083896", "0.73426616", "0.7168022", "0.708867", "0.7062393", "0.7004656", "0.69260204", "0.68954307", "0.6872728", "0.68716276", "0.66881174", "0.6645468", "0.6642676", "0.6640007", "0.6580371", "0.6576643", "0.6558487", "0.6521949", "0.64822036", "0.6460247", "0.6438303"...
0.7933613
1
Forward pass through the network, returns the output logits.
def forward(self, x): for layer in self.hidden_layers: x = F.relu(layer(x)) x = self.dropout(x) x = self.output(x) return F.log_softmax(x, dim=1)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def forward(self, inputs=None, **kwds):\n\n h = inputs\n h = self.feat_drop(h)\n\n for l in range(self.num_layers-1):\n\n h = self.layers[l](h)\n h = self.activation(h)\n \n logits = self.layers[-1](h)\n\n return logits", "def forward(self, input):\...
[ "0.7289967", "0.7157293", "0.7082399", "0.698771", "0.6977196", "0.6936645", "0.688746", "0.68489236", "0.68447304", "0.6842906", "0.6810462", "0.67884016", "0.6780137", "0.67270815", "0.6719104", "0.6684646", "0.6678705", "0.6673365", "0.66459477", "0.6638906", "0.66175795",...
0.71637213
1
Helper to Classifier.__init__() Setup the Classifier's model using checkpoint information or the information to load a new model and classifier for training.
def __setup_model(self, **kwargs): self.model_architecture = kwargs['model_architecture'].upper() self.model = Classifier.IMAGENET_MODELS[self.model_architecture]( pretrained=True ) if 'input_size' in kwargs: # Loading from a checkpoint self.input_size = kwargs[...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, load_model_dir=None):\n \n if load_model_dir:\n raise RuntimeError('Whoops. Not implemented yet')\n \n ## Load pickeled preprocessing function (applied to raw features)\n ## Load pickeled postprocessing function (applied to labels before ...
[ "0.70833486", "0.69595337", "0.68822813", "0.6832291", "0.6807992", "0.6729704", "0.6715636", "0.668124", "0.6675622", "0.66684896", "0.6666818", "0.6651309", "0.6640606", "0.6636988", "0.66196865", "0.6616432", "0.6577389", "0.65523785", "0.65475", "0.65323466", "0.6529573",...
0.7468442
0
Train the classifier using the provided dataloaders. Validation set will be used every 'print_every' batches during training if one is given.
def train_classifier(self, trainloader, validloader=None, num_epochs=3, print_every=40, device='cuda', output_file=None, print_status=False): self.model.to(device) start_epoch = self.model.current_epoch end_epoch = start_epoch + num_epochs - 1 ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def train_with_loader(self, data, validating_data=None, scheduler=None, epochs=1):\n print('Training...')\n for epoch in range(epochs):\n self.train()\n for train_in, train_out in data:\n self.compute_loss(train_in, train_out, is_guess=False, training=True)\n ...
[ "0.7461297", "0.6829481", "0.68080133", "0.6747109", "0.6747109", "0.66684574", "0.65870506", "0.6555802", "0.6523522", "0.6485354", "0.6480185", "0.6471454", "0.6438789", "0.64364475", "0.6431657", "0.6428367", "0.638244", "0.6369284", "0.6365058", "0.6364818", "0.63382334",...
0.7007678
1
set to zero values larger than upper_threshold
def zero_upper_range(x, upper_threshold): x = np.asarray(x, dtype=complex) count = 0 for i in range(0, x.shape[0], 1): if x[i].real > upper_threshold: x[i] = complex(0, 0j) count+=1 print("zeroed samples: ", count) return x;
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def setUpperThreshold(self, upper_threshold):\r\n\t\tself.UpperThreshold = upper_threshold", "def zero_lower_range(x, lower_threshold):\r\n x = np.asarray(x, dtype=complex)\r\n count = 0\r\n for i in range(0, x.shape[0], 1):\r\n if x[i].real < lower_threshold:\r\n x[i] = complex(0, 0j)...
[ "0.72706443", "0.65403014", "0.64137733", "0.6320009", "0.62305266", "0.6165832", "0.61273754", "0.60762894", "0.6067357", "0.60122204", "0.60122204", "0.60122204", "0.5999308", "0.594086", "0.59129816", "0.58861923", "0.58529925", "0.5815436", "0.58067846", "0.57999873", "0....
0.7275719
0
set to zero values lower than lower_threshold
def zero_lower_range(x, lower_threshold): x = np.asarray(x, dtype=complex) count = 0 for i in range(0, x.shape[0], 1): if x[i].real < lower_threshold: x[i] = complex(0, 0j) count+=1 print("zeroed samples: ", count) return x;
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def setLowerThreshold(self, lower_threshold):\r\n\t\tself.LowerThreshold = lower_threshold", "def clamp(self):\n self.threshold.data.clamp_(self.min_threshold)", "def __init__(self, threshold: float = 0.3, initial_val: float = 0.0) -> None:\n self.threshold = threshold\n self.initial_val =...
[ "0.7491968", "0.6990382", "0.6877572", "0.6758044", "0.6712694", "0.6622617", "0.66064614", "0.6440091", "0.6404194", "0.638409", "0.63738304", "0.63738304", "0.63738304", "0.63265413", "0.63265413", "0.63265413", "0.63265413", "0.63265413", "0.62819314", "0.626129", "0.62083...
0.71325177
1