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
Test CLI unsupported chars error.
def test_cli_unsupported_chars_error( valid_mock_connection, mocked_config_file_custom_provider, unsupported_chars_error, capsys, ): if int(sys.version.split(".")[1]) < 7: # don't run test on 3.6 pytest.skip("issue with mock_open") testargs = ["yessssms", "-m", "Bilde mir nicht ein was...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_bad_input():\n\n for arg in ['5', 'ch']:\n rv, out = getstatusoutput('{} {}'.format(prg, arg))\n assert rv == 0\n expected = 'I do not know \"{}\".'.format(arg)\n assert out.strip() == expected", "def test_option_unrecognized(self):\n cmd, output = runCmdOutput(['--...
[ "0.7033697", "0.686714", "0.68661636", "0.6718255", "0.67123836", "0.6597327", "0.6578742", "0.64544755", "0.6436221", "0.64358896", "0.63638645", "0.6359426", "0.63567674", "0.63319033", "0.6298423", "0.6282564", "0.6280596", "0.6270704", "0.62639445", "0.6260567", "0.625876...
0.7662073
0
Test CLI empty_message error.
def test_cli_empty_message_error( valid_mock_connection, mocked_config_file_custom_provider, empty_message_error, capsys, ): if int(sys.version.split(".")[1]) < 7: # don't run test on 3.6 pytest.skip("issue with mock_open") testargs = ["yessssms", "-m", "Bilde mir nicht ein was rechts ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_empty_message(config, valid_connection):\n sms = YesssSMS.YesssSMS(LOGIN, YESSS_PASSWD)\n with pytest.raises(ValueError):\n sms.send(YESSS_TO, \"\")\n with pytest.raises(sms.EmptyMessageError):\n sms.send(YESSS_TO, \"\")", "def test_sendMessageNoCommand(self):\n error = sel...
[ "0.7206507", "0.7196859", "0.69371843", "0.6895812", "0.6825424", "0.68194807", "0.67334735", "0.6727264", "0.67084074", "0.6698624", "0.66764116", "0.6645334", "0.6643379", "0.6640245", "0.6630408", "0.66096187", "0.6605231", "0.65973175", "0.65909064", "0.65699583", "0.6562...
0.77690375
0
Test CLI config file.
def test_cli_config_file(valid_connection, config_file): testargs = ["yessssms", "-m", "Blablabla", "-t", "03141512345"] with mock.patch.object(sys, "argv", testargs): cli = CLI() assert cli.message == "Blablabla" assert cli.recipient == "03141512345" assert cli.yessssms._loginda...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_config_from_file(self):\n parser = Parser()\n args = parser.parser.parse_args(['-c'])\n if args.config:\n config = Config()\n config.config_file = \"./config\"\n config.config = test_config\n config.config_from_file()\n self.asser...
[ "0.7290901", "0.71374", "0.70365685", "0.70258343", "0.6981265", "0.6940704", "0.6919984", "0.68878424", "0.678127", "0.6772207", "0.676629", "0.67578846", "0.67169046", "0.67128515", "0.67118347", "0.66542476", "0.6639319", "0.66181594", "0.66128546", "0.66101724", "0.661001...
0.7603308
0
Test login url getter.
def test_login_url_getter( config, ): sms = YesssSMS.YesssSMS(LOGIN, YESSS_PASSWD) login_url = sms.get_login_url() assert login_url == YesssSMS.const.PROVIDER_URLS["yesss"]["LOGIN_URL"]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_login_url(self):\r\n res = self.testapp.get('/login', status=200)\r\n\r\n body_str = u\"Log In\"\r\n form_str = u'name=\"login\"'\r\n\r\n self.assertTrue(\r\n body_str in res.body,\r\n msg=\"Request should contain Log In: \" + res.body)\r\n\r\n # Th...
[ "0.7383065", "0.7272921", "0.7077953", "0.697901", "0.69560724", "0.6885842", "0.68603647", "0.68560284", "0.6805423", "0.67851424", "0.6764727", "0.67147934", "0.66675705", "0.6664469", "0.66365707", "0.6631827", "0.6608853", "0.659809", "0.65724987", "0.65604407", "0.653757...
0.75349885
0
Test error handling for empty message.
def test_empty_message(config, valid_connection): sms = YesssSMS.YesssSMS(LOGIN, YESSS_PASSWD) with pytest.raises(ValueError): sms.send(YESSS_TO, "") with pytest.raises(sms.EmptyMessageError): sms.send(YESSS_TO, "")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_empty_email():\n expect_error(register, InputError, \"a\", \"abdkjjd\", \"a\", \"A\", \"\")", "def simulate_empty_message_error(valid_connection):\n path = \"YesssSMS.api.YesssSMS.send\"\n with mock.patch(path, side_effect=YesssSMS.YesssSMS.EmptyMessageError):\n yield", "def _validate_...
[ "0.7010082", "0.7000605", "0.6988829", "0.6913406", "0.6878563", "0.68449634", "0.681826", "0.677916", "0.6757001", "0.66982967", "0.6640785", "0.65882134", "0.6582734", "0.65410423", "0.6522049", "0.6484483", "0.64118165", "0.638698", "0.6370078", "0.63642627", "0.63500744",...
0.7367151
0
Test error handling of no recipient.
def test_no_recipient_error( config, ): sms = YesssSMS.YesssSMS("0000000000", "2d4faa0ea6f55813") with pytest.raises(sms.NoRecipientError): sms.send("", "test")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def process_error_mail(recipient, sender, journal_id):\n\n if recipient in ['', None]:\n #: Simpley Error Mail!\n #: TODO: error marking...\n return True\n\n try:\n param = return_path_from_address(recipient)\n assert param['message_id'] != \"\"\n assert param['domai...
[ "0.66603416", "0.63928294", "0.63049114", "0.6230597", "0.618594", "0.61749613", "0.60234547", "0.5970546", "0.59641874", "0.5958361", "0.5920763", "0.5877465", "0.58457184", "0.5845083", "0.5776097", "0.57675093", "0.57137966", "0.5700097", "0.56931126", "0.5679962", "0.5643...
0.7460001
0
Test error handling for unsupported chars.
def test_unsupported_chars_error( config, ): with requests_mock.Mocker() as m: sms = YesssSMS.YesssSMS("0000000000", "2d4faa0ea6f55813") m.register_uri( "POST", # pylint: disable=protected-access sms._login_url, status_code=302, # pylin...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def simulate_unsupported_chars_error(valid_connection):\n path = \"YesssSMS.api.YesssSMS.send\"\n with mock.patch(path, side_effect=YesssSMS.YesssSMS.UnsupportedCharsError()):\n yield", "def test_cli_unsupported_chars_error(\n valid_mock_connection,\n mocked_config_file_custom_provider,\n u...
[ "0.6830073", "0.6782516", "0.66570497", "0.66570336", "0.65686643", "0.6551819", "0.65464765", "0.65429693", "0.6526659", "0.6487407", "0.64838547", "0.64773005", "0.6421363", "0.6417565", "0.63562214", "0.63483447", "0.63355166", "0.63173544", "0.6294639", "0.62729204", "0.6...
0.68130517
1
Test error handling for suspended account.
def test_login_suspended_error( config, ): with requests_mock.Mocker() as m: # non existing user and password sms = YesssSMS.YesssSMS(LOGIN, YESSS_PASSWD) m.register_uri( "POST", # pylint: disable=protected-access sms._login_url, status_cod...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def simulate_suspended_error(valid_connection):\n path = \"YesssSMS.api.YesssSMS._login\"\n with mock.patch(path, side_effect=YesssSMS.YesssSMS.AccountSuspendedError()):\n yield", "def test_cli_suspended_error(\n valid_mock_connection, mocked_config_file_custom_provider, suspended_error, capsys\n...
[ "0.7564948", "0.66415226", "0.60580546", "0.6027995", "0.6015095", "0.59923923", "0.59479505", "0.5909619", "0.5904237", "0.5872766", "0.58375084", "0.5810051", "0.5798947", "0.57884955", "0.57469326", "0.5707677", "0.5649374", "0.5622089", "0.56164", "0.5561831", "0.55370384...
0.7437698
1
Test command line arguments with wrong mvno.
def test_cli_with_mvno_arg_error( config, ): from YesssSMS.api import YesssSMS testargs = [ "yessssms", "--test", "-l", "06641234567", "-p", "passw0rd", "-t", "+43676564736", "--mvno", "UNKNOWN_provider", ] with mock.p...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_invalid_arguments(self):\n # More than two arguments should report an error.\n exit_code, output = run_cli('a', 'b', 'c')\n assert exit_code != 0\n assert \"Error\" in output\n # Invalid `ionice' values should report an error.\n exit_code, output = run_cli('--ioni...
[ "0.6620049", "0.62980664", "0.62789434", "0.6199394", "0.61253935", "0.6119297", "0.60765165", "0.6055774", "0.6039967", "0.6037387", "0.60356855", "0.6030007", "0.60184306", "0.6010146", "0.6000674", "0.5990142", "0.59696853", "0.5950941", "0.5948983", "0.59259707", "0.59236...
0.66018814
1
Test default config file paths.
def test_default_config_file_paths( config, ): assert "~/.config/yessssms.conf" in CONFIG_FILE_PATHS assert "/etc/yessssms.conf" in CONFIG_FILE_PATHS
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_get_default_settings_path():\n\n root_path = application_services.get_pyrin_main_package_path()\n default_settings_path = os.path.abspath(os.path.join(root_path, 'settings', 'default'))\n assert application_services.get_default_settings_path() == default_settings_path", "def list_default_paths(...
[ "0.73817647", "0.7176939", "0.7159993", "0.71310896", "0.7041495", "0.7004619", "0.69044274", "0.6887526", "0.6828872", "0.68284243", "0.67880553", "0.6772448", "0.6759647", "0.67325926", "0.67237264", "0.6695618", "0.6694504", "0.6691137", "0.6690136", "0.6688755", "0.668745...
0.87389934
0
Test custom provider setting.
def test_custom_provider_setting( config, ): sms = YesssSMS.YesssSMS( LOGIN, YESSS_PASSWD, custom_provider={ "LOGIN_URL": "https://example.com/login", "LOGOUT_URL": "https://example.com/logout", "KONTOMANAGER_URL": "https://example.com/kontomanager", ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def setup_provider(self):\n pass", "def test_get_mt_settings(self):\n pass", "def test_provider(self):\n msg = 'Wrong number of processing algorithm loaded.'\n self.assertEqual(len(self.provider.alglist), 6, msg)\n\n msg = 'InaSAFE should be activated by default in Processing...
[ "0.6863691", "0.66736615", "0.64551467", "0.6422498", "0.6422498", "0.6276166", "0.61652946", "0.6165234", "0.60792524", "0.6054278", "0.6053515", "0.6039597", "0.60233575", "0.6019504", "0.60069925", "0.5976483", "0.5963917", "0.5934326", "0.5919726", "0.59126186", "0.588072...
0.7439047
0
Test setting of environment variables in YesssSMS class.
def test_env_var_settings_set(config, environment_vars_set_wowww): sms = YesssSMS.YesssSMS() assert sms._logindata["login_rufnummer"] == "03211234567" assert sms._logindata["login_passwort"] == "MySecr3t" assert sms._provider == "wowww" os.environ["YESSSSMS_PROVIDER"] = "goood" sms = YesssSMS.Y...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_read_env_config2(config, environment_vars_set_wowww):\n sms = YesssSMS.YesssSMS()\n assert sms._provider == \"wowww\"", "def test_read_env_config3(config, environment_vars_set):\n os.environ[\"YESSSSMS_PROVIDER\"] = \"goood\"\n sms = YesssSMS.YesssSMS()\n assert sms._provider == \"goood\"...
[ "0.77496845", "0.77284306", "0.7648051", "0.73370665", "0.7055944", "0.6656107", "0.6649881", "0.65630704", "0.6413479", "0.6330575", "0.6321442", "0.62935925", "0.6284717", "0.626308", "0.6223354", "0.6211535", "0.62065107", "0.619205", "0.61239487", "0.6077841", "0.60758364...
0.8123827
0
This function takes in an array and plots a cumulative distribution functionlike plot, showing percentage of number of values in the array across the sorted values in the array, from lowest to highest. It assumes that numpy as np and matplotlib.pyplot as plt have been imported.
def cdf(array, figsize, color, label, xlabel, ylabel, title, textsize, xsize, ysize, loc): fig, ax = plt.subplots(figsize=figsize) x = np.sort(array) y = np.array(range(len(array)))/float(len(array))*100 ax.plot(x, y, color = color, label = label) # plot the CDF ax.set_title(title, weight = 'b...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def plot_cumulative_distribution(data, fig_title, ax_labels=None, resolution=.01, filename=None):\r\n if not isinstance(data, ndarray):\r\n return TypeError('Expected data as numpy array.')\r\n\r\n cumulative_function = estimate_cumulative(data, num_bins=int(1 / resolution * 2))\r\n cumulative_func...
[ "0.69257843", "0.63808984", "0.60779124", "0.6002392", "0.5660718", "0.56582165", "0.56137127", "0.55884504", "0.5568125", "0.55506504", "0.55495423", "0.5546672", "0.5542586", "0.55278105", "0.549008", "0.54879355", "0.5486582", "0.5481899", "0.54584855", "0.54462534", "0.54...
0.6469218
1
Test a simple, successful call where A hangs up.
def test_ab_success_a_hangup(self): fixture_file = 'fixtures/simple/ab_success_a_hangup.json' events = self.run_and_get_events(fixture_file) calling_chan = SimpleChannel( account_code='150010001', caller_id=CallerId(name='Andrew Garza', num='201'), cid_callin...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_ab_success_b_hangup(self):\n fixture_file = 'fixtures/simple/ab_success_b_hangup.json'\n events = self.run_and_get_events(fixture_file)\n\n expected_events = [\n ('on_b_dial', {\n 'caller': 'SIP/150010001-00000013',\n 'targets': ['SIP/150010002...
[ "0.6305385", "0.62282324", "0.60856014", "0.60810024", "0.606441", "0.5996704", "0.5927116", "0.5841717", "0.5841717", "0.5841717", "0.5785676", "0.5753906", "0.57082844", "0.5704426", "0.57030123", "0.56989", "0.5690571", "0.56795734", "0.5676168", "0.56720257", "0.56690586"...
0.68548644
0
Test a simple, successful call where B hangs up.
def test_ab_success_b_hangup(self): fixture_file = 'fixtures/simple/ab_success_b_hangup.json' events = self.run_and_get_events(fixture_file) expected_events = [ ('on_b_dial', { 'caller': 'SIP/150010001-00000013', 'targets': ['SIP/150010002-00000014'],...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_ab_success_a_hangup(self):\n fixture_file = 'fixtures/simple/ab_success_a_hangup.json'\n events = self.run_and_get_events(fixture_file)\n\n calling_chan = SimpleChannel(\n account_code='150010001',\n caller_id=CallerId(name='Andrew Garza', num='201'),\n ...
[ "0.67300797", "0.6294443", "0.6030838", "0.5963129", "0.5961538", "0.59187055", "0.58558136", "0.5781565", "0.5771335", "0.5766326", "0.57564247", "0.5734587", "0.5727136", "0.5724063", "0.57012594", "0.5690042", "0.56897193", "0.56893516", "0.5682794", "0.5680162", "0.567886...
0.6680849
1
Test a simple call where B rejects the call.
def test_ab_reject(self): fixture_file = 'fixtures/simple/ab_reject.json' events = self.run_and_get_events(fixture_file) expected_events = [ ('on_b_dial', { 'caller': 'SIP/150010001-00000008', 'targets': ['SIP/150010002-00000009'], }), ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_case_01(self):\n if True:\n self.fail()", "def test_reject_foo(self):\n self.spawn(\"./binary\").stdin(\"foo\").reject()", "def test_basic_method_call_wrapper():\n my_method = SGMethod(\"test\")\n other_method = SGMethod(\"other\")\n \n my_method.calls(other_method...
[ "0.61423844", "0.5955212", "0.5938737", "0.59316623", "0.58990073", "0.5880463", "0.58794796", "0.58587295", "0.58367586", "0.58105445", "0.57981455", "0.5794692", "0.5743317", "0.5742615", "0.57350373", "0.5720768", "0.567903", "0.5643266", "0.5630022", "0.56125784", "0.5604...
0.6129711
1
Test a simple call to a group where one phone is picked up.
def test_ab_callgroup(self): fixture_file = 'fixtures/simple/ab_callgroup.json' events = self.run_and_get_events(fixture_file) expected_events = [ ('on_b_dial', { 'caller': 'SIP/150010001-0000000d', 'targets': [ 'SIP/150010002-0000...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_good_phone():\n good_phone = \"213-555-1212\"\n m = CannedRe.PHONE.match(good_phone)\n# print getmembers(m)\n assert m is not None, \"Canned RegEx phone test failed for %s\" % good_phone\n assert m.string == good_phone", "def test_get_group(self):\n pass", "def test_one_group(sel...
[ "0.6329631", "0.6258931", "0.61534935", "0.6124594", "0.6096245", "0.6086874", "0.60183585", "0.60092074", "0.60030144", "0.5968717", "0.59634614", "0.5963375", "0.5949747", "0.594702", "0.5930776", "0.5928495", "0.589591", "0.589591", "0.5887004", "0.588418", "0.58793616", ...
0.6691938
0
Test a call to a group where no target picks up.
def test_ab_callgroup_no_answer(self): fixture_file = 'fixtures/simple/ab_callgroup_no_answer.json' events = self.run_and_get_events(fixture_file) expected_events = [ ('on_b_dial', { 'caller': 'SIP/150010001-00000010', 'targets': [ ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_nogroup(self):\n pkg = self.mk_pkg('nogroup', 65533)\n check = self.mk_check((pkg,))\n self.assertNoReport(check, pkg)", "def test_by_group_no_messages_for_another_group(self):\n thread = self.create_thread()\n other_group = mommy.make('groups.Group')\n result =...
[ "0.6976765", "0.6477134", "0.6459893", "0.6446103", "0.6440556", "0.6407229", "0.6372843", "0.6259792", "0.62146485", "0.61836034", "0.6112847", "0.6100074", "0.6081333", "0.6072742", "0.59519124", "0.5945648", "0.59413654", "0.5904741", "0.5878511", "0.5878511", "0.58625764"...
0.6561028
1
Test a simple AB call where the state is changed before the dial.
def test_ab_out_of_order_dial(self): fixture_file = 'fixtures/simple/ab_success_o3.json' events = self.run_and_get_events(fixture_file) calling_chan = SimpleChannel( name='SIP/100060001-0000000e', uniqueid='fc7a1e79d662-1539093894.250', linkedid='fc7a1e79d662...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_dial_to():\n\n # dial_to(state, code)\n # Set up a state with a test serial number.\n state = {\n 'suspicion level': 0,\n 'indicators': {},\n }\n state['serial number'] = 'JQXX7e3652'\n\n # Test code\n code = 'circuit'\n\n # dial_to should return a 'c'\n assert(dia...
[ "0.6813936", "0.6074308", "0.60572135", "0.60437256", "0.6031497", "0.60004526", "0.5947045", "0.59220463", "0.591355", "0.58002394", "0.5790944", "0.57567245", "0.57508457", "0.57206863", "0.5709609", "0.57054126", "0.56953585", "0.5686935", "0.56861526", "0.5684685", "0.568...
0.6399283
1
Create, bind(), and listen() a socket. If addr is None, automatically get a local ip and open port
def listen(self,addr=None,port=None): self.type = 'listen' if addr == None: #addr = gethostbyname(gethostname()) addr = '' # equivalent to INADDR_ANY host_location = (addr,0) else: host_location = (addr,port) s = socket(AF_INET,SOCK_STR...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def bind(self, addr):\n self._close_socket()\n self._open_socket()\n self._socket.bind(addr)", "def start_socket(ip, port):\n sock = socket.socket(\n socket.AF_INET, socket.SOCK_STREAM)\n # the server binds itself to a certain socket\n sock.bind((ip, port))\n ...
[ "0.72703254", "0.7191765", "0.7191765", "0.71514696", "0.71336704", "0.6750737", "0.6629048", "0.65582734", "0.647769", "0.64509755", "0.64278555", "0.6417741", "0.6414814", "0.63884294", "0.63850707", "0.6359403", "0.6357065", "0.6351684", "0.63276255", "0.6327346", "0.62902...
0.72479653
1
Encode data as netstring and queue for sending
def queue(self,data): prefix = '%s:'%(str(len(data))) size = len(prefix) + len(data) + 1 # large pieces of data incur significant overhead to copy # into a netstring if size > 4096: self.outbox.append(prefix) self.outbox.append(data) self.outb...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def send_data(queue, data):\n for obj in data:\n queue.put(dumps(obj, protocol=-1))", "def send_queue(command, data, port=9755):\n qdata = {'type': command, 'data': data}\n qstr = json.dumps(qdata).encode('utf8')\n if len(qstr) > MAX_SIZE:\n raise RuntimeError('Data portion too large')\...
[ "0.7516943", "0.7329532", "0.6920334", "0.6909456", "0.686386", "0.6821721", "0.681275", "0.6793834", "0.67498183", "0.674831", "0.673836", "0.6680031", "0.6657352", "0.662067", "0.65968704", "0.6581969", "0.65378046", "0.6455763", "0.6444767", "0.64415514", "0.64336824", "...
0.7560234
0
Send all messages in self.tcpbox. Assumes all message entries are valid netstring and have been queued by self.queue.
def sendall(self, clear_outbox = True): retries = 4 total_bytes_sent = 0 while len(self.tcpbox) > 0: if retries == 0: break data = self.tcpbox[-1] try: n = self.sock.send(data) total_bytes_sent += n ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _start_send_to_queue(self):\n while True:\n message_to_send = str(self.send_message_queue.get())\n if self.verbose: print \"Sending\", message_to_send\n send_msg(self.TCPSock, message_to_send)\n # self.TCPSock.send(message_to_send)", "def msgsFromSock(self, ...
[ "0.68180895", "0.679739", "0.6673281", "0.649883", "0.61211395", "0.61211395", "0.60923064", "0.6087501", "0.6078783", "0.60687864", "0.5996934", "0.5956928", "0.5930634", "0.59032464", "0.5885493", "0.58807766", "0.58733886", "0.58662486", "0.58581895", "0.5846091", "0.58424...
0.7466095
0
recv() all data available on the socket, check for errors and closed closed connections, and feed any data found into self.inbox for decoding or unframing.
def recvall(self): while True: try: data = self.sock.recv(4096) if data == '': self.status = 'closed' break except error as e: # Not all errors are bad. Most of the time, we're # wa...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _recv(self) -> None:\n if not self.connected or now() < self.next_poll:\n return\n self.next_poll += self.poll_interval\n data = []\n while True:\n try:\n data.append(self.endpoint.recv(BUFFSIZE))\n except BlockingIOError:\n ...
[ "0.7414498", "0.7231708", "0.7224808", "0.6972608", "0.67275125", "0.66483456", "0.6622142", "0.6622142", "0.65640765", "0.6560388", "0.65550005", "0.6553414", "0.653597", "0.65343523", "0.65212095", "0.65013295", "0.649879", "0.647553", "0.6473251", "0.6456153", "0.64211184"...
0.821307
0
The stream equivalent of socket.socket.accept(). If stream type is 'listen', return a new stream object that manages self.sock.accept()
def accept(self): s, addr = self.sock.accept() s.settimeout(0) host,addr = s.getpeername() m = Stream() m.sock = s m.remote_location = (host,addr) m.type = 'accept' m.status = 'accepted' return m
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async def accept(self) -> SocketStream[T_SockAddr]:", "def AcceptSocket(self) -> Socket:", "def listen(self):\r\n # Create socket server\r\n server = socket.socket(socket.AF_INET, socket.SOCK_STREAM)\r\n\r\n if server:\r\n # Configure socket server\r\n try:\r\n ...
[ "0.7049027", "0.6705378", "0.6449613", "0.6419179", "0.6242174", "0.62013495", "0.6181981", "0.6147112", "0.60651547", "0.6032223", "0.6010374", "0.59945226", "0.5979967", "0.5910473", "0.5886219", "0.5878939", "0.5864326", "0.5836368", "0.5772432", "0.5757714", "0.5757714", ...
0.78286463
0
Create new stream and connect() it to address. If connect() fails, queue that new stream to retry on the next serve() call. Always return the stream object created, whether it's connected or not.
def add_connection(self,addr,port): # don't add an existing connection for stream in self.streams: if stream.remote_location == (addr,port): return stream s = Stream(debug=self.debug) s.connect(addr,port) if s.status == 'closed': # will ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def connect():\n\n sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)\n\n try:\n sock.connect((src_addr, src_port))\n except:\n print(\"Error connecting to {}:{}\".format(src_addr, src_port))\n return None\n try:\n print(\"Sending stream info\")\n sock.sendall(s...
[ "0.5991685", "0.5910552", "0.5843841", "0.5771267", "0.5745068", "0.5739187", "0.570221", "0.5679301", "0.5676749", "0.5644617", "0.5637347", "0.563375", "0.56310713", "0.5573728", "0.55708796", "0.5570555", "0.5491837", "0.54799396", "0.54694515", "0.545344", "0.5416034", ...
0.6690274
0
Destroy any streams connected to address, and make sure they aren't queued for reconnect. Does nothing if addr and port are not found.
def remove_connection(self, addr, port): location = (addr,port) remove = [] for stream in self.streams: if stream.remote_location == location: remove.append(stream) for r in remove: self.streams.remove(r) try: r.close()...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def cleanup(self):\n try:\n self.socket.close()\n except:\n pass # ignore errors when attempting to close socket\n self.socket = None\n self.current_host_and_port = None", "def destroy(self):\n del Stream._streams[self.__id]\n self.__network._send(...
[ "0.6574934", "0.6301976", "0.6251122", "0.6231107", "0.6165954", "0.6087851", "0.6078009", "0.6010249", "0.5991994", "0.59914553", "0.5938735", "0.5929387", "0.5882786", "0.58790416", "0.58496654", "0.58390963", "0.58352846", "0.5830677", "0.5827943", "0.5825309", "0.5804727"...
0.6909052
0
Remove any connections not in self.live. Do nothing if self.live is None.
def purge_dead(self): if self.live == None: return remove = [] for s in self.streams: if not s.remote_location in self.live: remove.append(s) while len(remove) > 0: s = remove.pop() del s
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def killconnections(self):\n for conn in self._connections:\n try:conn.close()\n except:pass\n self._connections=[]", "def disconnect(self):\n for attr in self._filter():\n sourceAttr = attr.listConnections(source=True, plugs=True)\n sourceAttr = (...
[ "0.67527646", "0.6738469", "0.6589264", "0.65214133", "0.6479119", "0.6410938", "0.6391069", "0.6353777", "0.62371314", "0.62339526", "0.6207162", "0.620074", "0.61891675", "0.60929704", "0.60551715", "0.593192", "0.5917408", "0.59119946", "0.59067273", "0.59001", "0.5881259"...
0.75553775
0
sends the data msg received as a parameter to all the players
def send_msg_to_players(players, msg=""): for player in players: player.player_socket.send(msg + "\n")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def send(User,data):\n BufferManagement.append_to_buffer(data,User['ID'],User['GameID'],\"OUT\")", "def __send_message(self, data):\n if RemotePlayerProxy.DEBUG:\n print(f'[RPP] [SEND] -> [{self.name}]: {data}')\n\n try:\n self.__socket.sendall(bytes(data, 'ascii'))\n ...
[ "0.72162145", "0.6885952", "0.6864255", "0.6847697", "0.68324864", "0.67739785", "0.6755032", "0.6608164", "0.66015244", "0.656143", "0.6558383", "0.6462909", "0.64381266", "0.63968575", "0.63799614", "0.6358379", "0.634745", "0.63426775", "0.63365966", "0.6308277", "0.625553...
0.6966095
1
creates a long msg from the data received from all the player
def receive_msg_from_players(): msg = [] for i, player in enumerate(players): single_msg = player.player_socket.recv(32768) print "received %s" % single_msg msg.append(single_msg) return msg
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __send_long(self, msg_id, data):\n # Long format packets have the upper bit of DST set.\n data_out = struct.pack(\"<HHBB\", msg_id, len(data),\n self.__dst | 0x80, self.__src)\n data_out += data\n if self.__debug:\n print \">>> %s\" % binascii.hexlify(data_out)\n s...
[ "0.6482227", "0.6068324", "0.6062008", "0.604741", "0.6006978", "0.6005153", "0.59145993", "0.589208", "0.5884328", "0.5869391", "0.5859533", "0.5840152", "0.58136547", "0.58008397", "0.5789734", "0.5769608", "0.57638645", "0.5737184", "0.5693546", "0.5677576", "0.5664849", ...
0.62319994
1
Load database credentials from .pgpass file
def get_credentials(path='~/.pgpass', db=DB): # Load credentials from path with open(os.path.expanduser(path), 'r') as file: host, port, _, user, password = file.read().strip().split(':') return host, port, user, password, db
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load_psql_env(pgpass_path):\n\n with open(pgpass_path,'r') as f:\n psql_info = [line for line in f if 'cochrane' in line][0]\n\n host, port, dbname, user, password = psql_info.replace('\\n','').split(':')\n\n env = {'host':host,'port':port,'dbname':dbname,'user':user,'password':password}\n\n ...
[ "0.7293757", "0.68105257", "0.66552645", "0.6653494", "0.65564626", "0.64902174", "0.6406952", "0.6349682", "0.62705374", "0.6261037", "0.624737", "0.6226963", "0.62036014", "0.6179806", "0.61554253", "0.61449945", "0.61197734", "0.611827", "0.60912347", "0.60308975", "0.5976...
0.7738164
0
Run SQL statement from a string.
def run_sql_from_string(conn, statement): statement = sqlalchemy.text(statement) conn.execute(statement)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def execute(self, parseString, *args):\r\n debug.write('[SourceRPG] Executing SQL String: %s' % parseString, 1, True)\r\n self.cursor.execute(parseString, args)\r\n debug.write('[SourceRPG] SQL String executed successfully', 2, True)", "def execute(self, sql, params=None):\n if params...
[ "0.70140535", "0.66904587", "0.65713227", "0.65534383", "0.64792085", "0.63607424", "0.6258755", "0.6129372", "0.61137223", "0.6044607", "0.60400313", "0.59762216", "0.5945671", "0.5940547", "0.5927623", "0.58926785", "0.5888746", "0.5860933", "0.581864", "0.5793575", "0.5779...
0.8147136
0
Get the names of tables from the specified schema.
def get_table_names(conn, schema, prefix='', suffix=''): query = f"select table_name from information_schema.tables where table_schema = '{schema}'" table_names = pd.read_sql(query, con=get_connection()).to_numpy(copy=True).flatten() table_names = [t for t in table_names if t.startswith(prefix) and t.endswi...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_tables_in_schema(self, conn, schema_name):\n return conn.get_tables(schema_name)['table_name']", "def query_table_names_and_types(\n self, schema_name: str\n ) -> Iterable[TableNameAndType]:\n\n return [\n TableNameAndType(name=table_name)\n for table_name in...
[ "0.826215", "0.7594708", "0.7073577", "0.70499784", "0.68438405", "0.67835516", "0.67707443", "0.6767008", "0.67551637", "0.67333806", "0.66709834", "0.66290164", "0.6614083", "0.64056504", "0.6403164", "0.63663983", "0.63557523", "0.63413453", "0.63345855", "0.630106", "0.62...
0.79296947
1
Remove chain if zero var.
def RemoveZeroVar(chain): return chain[:, np.invert((np.sum(np.var(chain, axis=0), axis=1)<1e-10)), :]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def RemoveZeroVar(chain):\n return chain[:, np.invert((np.sum(np.var(chain, axis=0), axis=1)<1e-10)), :]", "def remove_causal_chain_from_local_Q(self, trial_name, chain_idx):\n for state in range(self.local_Q[trial_name].shape[0]):\n self.local_Q[trial_name][state][chain_idx] = 0", "def re...
[ "0.72741723", "0.65207744", "0.61948866", "0.5943889", "0.5856726", "0.579234", "0.55565387", "0.55563855", "0.5513278", "0.5393509", "0.53831285", "0.5355641", "0.53278524", "0.52536255", "0.52277136", "0.5119385", "0.5117619", "0.50989103", "0.50953203", "0.50734174", "0.50...
0.75237256
0
Preallocates B array and g vector for given dofs concerning constraints
def preallocate_g_and_B(no_of_dofs_unconstrained, dofs_by_object, no_of_constraints_by_object): # Initialize indptr and indices indptr = [0] indices = list() # Generate indptr and indices values for dofs, no_of_constraints in zip(dofs_by_object, no_of_constraints_by_object): ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update(self):\n self._g, self._B = self._constraint_assembler.preallocate_g_and_B(self._no_of_dofs_unconstrained,\n self._dofidxs(),\n self._no_of_constraints...
[ "0.70951444", "0.5825652", "0.55610085", "0.55540824", "0.5525795", "0.54507136", "0.5409555", "0.5373691", "0.5338913", "0.52968353", "0.5200497", "0.5174639", "0.5161303", "0.516078", "0.5152803", "0.51049876", "0.50919414", "0.50337344", "0.5030031", "0.4998761", "0.499751...
0.7729872
0
Test the add_player method
def test_add_player(self): user = User.objects.create_user('Luca', 'luca@bongo.cat', 'bongo_cat') profile = models.Profile.objects.get(user=user) game = models.Game.objects.all()[0] number_of_piles = len(settings.HYDROCARBON_STOCKS_PER_PLAYER) for i_pile in range(number_of_piles)...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_get_player(self):\n pass", "def add_player(self, player):\n\t\tself.players.append(player)", "def test_add_players(self):\n campaign = self.campaign\n\n campaign.players.add(self.player.id)\n campaign.players.add(self.gm.id)\n\n self.assertQuerysetEqual(campaign.play...
[ "0.77869016", "0.73489404", "0.7297618", "0.72768414", "0.71361476", "0.7098962", "0.7073062", "0.6953808", "0.6946707", "0.6749823", "0.668733", "0.66597295", "0.66325486", "0.6630669", "0.6549677", "0.65482265", "0.64777577", "0.6473977", "0.64608", "0.64512825", "0.6445797...
0.77392197
1
Form for uploading manifest files
def manifest_upload(request): form = ManifestForm(request.POST or None, request.FILES or None) if form.is_valid(): manifest = form.save() return HttpResponseRedirect(reverse('file-upload', args=(manifest.id,))) return render(request, 'file_manager/manifest_upload.html', { 'form': f...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def form_File(request):\n schema = schemaish.Structure()\n schema.add('myFile', schemaish.File())\n form = formish.Form(schema, 'form')\n return form", "def upload_preset(self, filename, title, description, version, author, REQUEST=None):\r\n\r\n # TODO presets.py - upload_preset - specify ho...
[ "0.6134126", "0.5962329", "0.5827885", "0.5808959", "0.574403", "0.5703532", "0.5656537", "0.5654012", "0.5635985", "0.5623492", "0.56039625", "0.5585953", "0.5565695", "0.5543973", "0.554294", "0.5503049", "0.5446159", "0.5428467", "0.5395483", "0.5381806", "0.5319179", "0...
0.7822514
0
Form for uploading individual media files associated with a manifest
def media_file_upload(request, manifest_id): manifest = get_object_or_404(Manifest, id=manifest_id) manifest_files = MediaFile.objects.filter(manifest=manifest) total_files_count = manifest_files.count() files_needing_upload = manifest_files.filter(file='') files_needing_upload_count = files_needin...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def manifest_upload(request):\n form = ManifestForm(request.POST or None, request.FILES or None)\n\n if form.is_valid():\n manifest = form.save()\n return HttpResponseRedirect(reverse('file-upload', args=(manifest.id,)))\n\n return render(request, 'file_manager/manifest_upload.html', {\n ...
[ "0.74562025", "0.62007946", "0.6184346", "0.61075324", "0.5951074", "0.5863592", "0.5860996", "0.57484055", "0.57044196", "0.5702054", "0.56941384", "0.56660956", "0.5632021", "0.55640155", "0.55178875", "0.55082595", "0.55066645", "0.55037415", "0.54971135", "0.5496827", "0....
0.73302674
1
URLs for news posts can either be just their slug, or prefixed with a portion of the post's publish date, controlled by the setting ``NEWS_URLS_DATE_FORMAT``, which can contain the value ``year``, ``month``, or ``day``. Each of these maps to the name of the corresponding urlpattern, and if defined, we loop through each...
def get_absolute_url(self): url_name = "news_post_detail" kwargs = {"slug": self.slug} date_parts = ("year", "month", "day") if settings.NEWS_URLS_DATE_FORMAT in date_parts: url_name = "news_post_detail_%s" % settings.NEWS_URLS_DATE_FORMAT for date_part in date_pa...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def build_url_dates(self, pattern, ext, rename=None, date_type=\"Monthly\"):\n\n\n if ext in ('.gdx', '.XML', '.pdf'):\n single_mode = True\n else:\n single_mode = False\n\n if date_type == \"Monthly\":\n self.url_dates = [self.parse_monthly_dates(x['href'], pa...
[ "0.63748574", "0.56988984", "0.55972576", "0.5515209", "0.54642403", "0.52377266", "0.5154409", "0.5113441", "0.5082596", "0.5080232", "0.5046178", "0.50455266", "0.5032189", "0.49706048", "0.49271855", "0.48969468", "0.48560166", "0.48535252", "0.48445505", "0.47985917", "0....
0.6671969
0
Return a list of the methods on this class which begin with `check_prefix`.
def _get_all_checks(self): this_class = self.__class__ check_list = [ getattr(self, func) for func in dir(self.__class__) if callable(getattr(this_class, func)) and func.startswith(self.check_prefix) ] return check_list
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_method_names(cls, prefix):\n names = []\n for name in dir(cls):\n if name.startswith(prefix):\n func = getattr(cls, name)\n names.append(name)\n return names", "def find_prefixed_funcs(obj: Any, prefix: str) -> Sequence[Tuple[str, Callable]]:\...
[ "0.76815903", "0.644743", "0.6289162", "0.6028355", "0.6006466", "0.5901949", "0.5819673", "0.581276", "0.5779923", "0.5779539", "0.5756207", "0.5678113", "0.56735134", "0.56664115", "0.5663628", "0.5628452", "0.5626658", "0.55896276", "0.5582882", "0.5566029", "0.5563347", ...
0.7507222
1
Load the rendered YAML which is passed in to the `check` method.
def _load_rendered_yaml(self, rendered: str) -> dict: return [d for d in yaml.safe_load_all(rendered)]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load_yaml(content):\n from yaml import load, FullLoader\n return load(content, Loader=FullLoader)", "def _load_yaml_file(yaml_file):\n with io.open(yaml_file, 'r', encoding='utf-8') as stream:\n yaml_content = yaml.load(stream)\n FileUtils._check_format(yaml_file, yaml_cont...
[ "0.65524626", "0.6546556", "0.6523975", "0.64938307", "0.6391137", "0.63572615", "0.62872785", "0.6274688", "0.6263665", "0.6245961", "0.6244714", "0.62390745", "0.6223321", "0.6193768", "0.6176689", "0.6162097", "0.61616564", "0.61478096", "0.6135383", "0.6125504", "0.611504...
0.68567806
0
Check ingresses for appropriate annotations
def _check_manifest_ingress_annotations(self, documents: list) -> str: ingress_kind = "Ingress" internal_value = "internal" external_value = "internet-facing" missing_metadata_msg = ( "Ingress resources MUST specify a metadata section including" "name, namespace,...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check_annotation(config):\n # Check whether to set annotation downstream of assembly\n tools = [config[\"annotation\"][key] for key in config[\"annotation\"].keys()]\n assems = [config[\"assembly\"][\"metaspades\"], config[\"assembly\"][\"megahit\"]]\n config[\"run_assembly\"] = False\n if True ...
[ "0.6141674", "0.5828911", "0.58288956", "0.58257085", "0.5744761", "0.56446517", "0.5491724", "0.54288214", "0.5359325", "0.5317875", "0.5292424", "0.5276334", "0.5269074", "0.5251652", "0.5237051", "0.5236513", "0.5226678", "0.5209378", "0.5207861", "0.51960856", "0.5183362"...
0.6391228
0
Check resource types that deploy Pods for resource constraints.
def _check_manifest_resources(self, documents: list) -> str: for doc in documents: kind = doc.get("kind") # If this kind defines a job template, pull it out if kind in JOB_TEMPLATE_RESOURCES: doc = doc.get("spec").get("jobTemplate") if doc is ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def validate_types(self):\n for req in self.requests:\n required_types = req.get_required_types()\n available_types = self.substrate.get_types()\n if not (required_types <= available_types):\n print required_types - available_types, ' missing'\n ...
[ "0.61387056", "0.6110775", "0.5771974", "0.57118213", "0.5673976", "0.56315833", "0.5613451", "0.5563469", "0.55581605", "0.5552827", "0.55484647", "0.5545612", "0.5538459", "0.5488796", "0.5483668", "0.54735327", "0.5471856", "0.5389199", "0.5368333", "0.53647614", "0.529110...
0.6586404
0
Check for resource constraints in Helm answers.
def _check_answers_flat_resources(self, documents: list) -> str: if len(documents) > 1: return "We only support flat Helm answers! Please provide a single document of key:value pairs." answers = documents[0] has_resources = False has_limits = False has_requests = Fal...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _check_manifest_resources(self, documents: list) -> str:\n for doc in documents:\n kind = doc.get(\"kind\")\n\n # If this kind defines a job template, pull it out\n if kind in JOB_TEMPLATE_RESOURCES:\n doc = doc.get(\"spec\").get(\"jobTemplate\")\n ...
[ "0.62684387", "0.6121002", "0.61026686", "0.6039745", "0.59829015", "0.59626555", "0.59355056", "0.5855893", "0.57873", "0.5781169", "0.57464963", "0.57233375", "0.5711139", "0.57013327", "0.56974036", "0.568142", "0.5679696", "0.56477326", "0.5614031", "0.56033945", "0.55839...
0.7192376
0
Send out any scheduled emails that are unsent
def send_unsent_scheduled_emails(cls): # Get the emails that we need to send current_time = datetime.utcnow() email_medium = get_medium() to_send = Email.objects.filter( scheduled__lte=current_time, sent__isnull=True, num_tries__lt=settings.ENTITY_EMA...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def send_unsent_scheduled_emails():\n\n current_time = datetime.utcnow()\n email_medium = get_medium()\n to_send = Email.objects.filter(\n scheduled__lte=current_time,\n sent__isnull=True\n ).select_related(\n 'event'\n ).prefetch_related(\n ...
[ "0.828232", "0.7039819", "0.68336123", "0.6646108", "0.6457091", "0.6442004", "0.6422522", "0.6403426", "0.6355374", "0.6353682", "0.6295445", "0.62800014", "0.62719953", "0.62086594", "0.6186696", "0.6112468", "0.60829973", "0.60734576", "0.6069749", "0.6057212", "0.60526663...
0.7750037
1
Converts unseen events to emails and marks them as seen.
def convert_events_to_emails(): # Get the email medium email_medium = get_medium() # Get the default from email default_from_email = get_from_email_address() # Find any unseen events and create unsent email objects for event, targets in email_medium.events_targets(seen...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def mark_seen(self):\n mark_seen = {\n \"recipient\": {\"id\": self.user_id},\n \"sender_action\": \"mark_seen\"\n }\n return requests.post(self.mark_seen_uri, json=mark_seen).json()", "def bulk_convert_events_to_emails():\n\n # Get the email medium\n ...
[ "0.63499904", "0.6119288", "0.60997695", "0.6056428", "0.57230335", "0.56913465", "0.56855965", "0.55654836", "0.5495275", "0.5478195", "0.5400962", "0.5382073", "0.5372282", "0.5260174", "0.5259044", "0.52208453", "0.52160263", "0.52134854", "0.515636", "0.5153248", "0.51380...
0.6571456
0
Converts unseen events to emails and marks them as seen. Uses the create_emails method to bulk create emails and recipient relationships
def bulk_convert_events_to_emails(): # Get the email medium email_medium = get_medium() # Get the default from email default_from_email = get_from_email_address() email_params_list = [] # Find any unseen events and create unsent email objects for event, target...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def convert_events_to_emails():\n\n # Get the email medium\n email_medium = get_medium()\n\n # Get the default from email\n default_from_email = get_from_email_address()\n\n # Find any unseen events and create unsent email objects\n for event, targets in email_medium.event...
[ "0.7368971", "0.7368971", "0.68335146", "0.6268278", "0.60868365", "0.60783684", "0.6051357", "0.5958291", "0.57433546", "0.5723161", "0.564574", "0.560848", "0.5602732", "0.55946136", "0.5539988", "0.5532738", "0.551163", "0.54876834", "0.5478222", "0.54571533", "0.54446465"...
0.7514869
0
add() raise exception should fail
def test_add_raises(): tasks.add(task='not a Task object')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add(self):\r\n raise AbstractError\r\n return None", "def test_add_raises_catch():\n with pytest.raises(TypeError):\n tasks.add(task='not a Task object')", "def test_add_raises():\n with pytest.raises(TypeError):\n tasks.add(task='not a Task object')", "def test_add(self...
[ "0.74551034", "0.7235016", "0.7210152", "0.68155104", "0.6815159", "0.6744747", "0.66793233", "0.6668165", "0.66440123", "0.66377336", "0.6632039", "0.6616404", "0.65759414", "0.6572604", "0.65527296", "0.6544034", "0.6519244", "0.6517265", "0.6497617", "0.6497617", "0.646505...
0.74329036
1
add() catch raise exception should pass
def test_add_raises_catch(): with pytest.raises(TypeError): tasks.add(task='not a Task object')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add(self):\r\n raise AbstractError\r\n return None", "def test_add_raises():\n tasks.add(task='not a Task object')", "def test_add_raises():\n with pytest.raises(TypeError):\n tasks.add(task='not a Task object')", "def test_item_add_failure():\n sc.menu = sc.default_menu\n ...
[ "0.71761143", "0.71639574", "0.69134355", "0.67360336", "0.65166855", "0.6484056", "0.64692396", "0.64327145", "0.6408461", "0.64049196", "0.6401905", "0.6376195", "0.6320726", "0.6299155", "0.6292007", "0.6291535", "0.62900174", "0.6276487", "0.62320626", "0.6199849", "0.619...
0.7226903
0
generate a maps.tqumap object containing homogeneous white noise which is uncorrelated between pixels. pix = pixelization object defining the map size and scale (of type maps.pix). nlev_t = noise level of the temperature map (in uK.arcmin). nlev_p = noise level of the polarization map (in uK.arcmin).
def tqumap_homog_noise( pix, nlev_t, nlev_p): nx, dx, ny, dy = pix.nx, pix.dx, pix.ny, pix.dy ret = maps.tqumap( nx, dx, ny=ny, dy=dy ) ret.tmap += np.random.standard_normal(ret.tmap.shape) * nlev_t / (180.*60./np.pi*np.sqrt(ret.dx * ret.dy)) ret.qmap += np.random.standard_normal(ret.qmap.shape) * ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def make_tqumap_wt(pix,\n ninv=None,\n mask=None,\n ninv_dcut=None,\n nlev_tp=None,\n maskt=None,\n maskq=None,\n masku=None):\n ret = tqumap_wt(pix.nx, pix.dx, ny=pix.ny, dy=pix.dy)\n\n...
[ "0.65534157", "0.5909698", "0.51822555", "0.5167093", "0.51227415", "0.5089066", "0.50433356", "0.50033706", "0.4979394", "0.49326125", "0.49289998", "0.49174765", "0.49170426", "0.4915378", "0.49102476", "0.48662746", "0.4844231", "0.48353568", "0.48165718", "0.4795148", "0....
0.78679556
0
generate a maps.tebfft object containing a simulated sky map. pix = pixelization object defining the map size and scale (of type maps.pix). tcl = an object with 'lmax' attribute as well as 'cltt', 'clee', 'clte', etc. attributes for all of the nonzero ensembleaveraged auto and crossspectra in the simulation.
def tebfft(pix, tcl): nx, dx, ny, dy = pix.nx, pix.dx, pix.ny, pix.dy tfft = (np.random.standard_normal((ny,nx/2+1)) + 1.j * np.random.standard_normal((ny,nx/2+1))) / np.sqrt(2.) efft = (np.random.standard_normal((ny,nx/2+1)) + 1.j * np.random.standard_normal((ny,nx/2+1))) / np.sqrt(2.) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def tsMap(self):\n mapplt = FermiMap()\n mapplt.savepath = self.workpath\n mapplt.image = self.outtsmap\n mapplt.figname = 'TSMAP.pdf'\n mapplt.cbarlabel = r'TS'\n mapplt.mapSky()\n if showSrc:\n srcs = self.getSrc()\n srcs = s...
[ "0.5945431", "0.5826253", "0.56326824", "0.5600726", "0.55893624", "0.5441476", "0.53347296", "0.5301562", "0.5297887", "0.528112", "0.52743924", "0.5274075", "0.52432054", "0.52294725", "0.5218989", "0.5188679", "0.5170672", "0.5155016", "0.513667", "0.51137984", "0.51133347...
0.64344007
0
generate a maps.rfft object containing a simulated sky map. pix = pixelization object defining the map size and scale (of type maps.pix). tcl = a vector containing the ensembleaverage power spectrum for the simulated map.
def rfft(pix, tcl): nx, dx, ny, dy = pix.nx, pix.dx, pix.ny, pix.dy ret = maps.rfft(nx, dx, ny=ny, dy=dy) ret.fft[:,:] = (np.random.standard_normal((ny,nx/2+1)) + 1.j * np.random.standard_normal((ny,nx/2+1))) / np.sqrt(2.) ret.fft[0,0] = np.sqrt(2.) * np.real(ret.fft[0,0]) ret.fft[ny/2+1:, 0] =...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def plot_map(data, pixlist, nside, runconf, title, unit):\n hpmap = np.repeat(np.nan, hp.pixelfunc.nside2npix(nside))\n hpmap[pixlist] = data\n plot_lon_cen, plot_lat_cen = runconf['ra'], runconf['dec']\n if plot_lon_cen > 180:\n plot_lon_cen -= 360\n plot_bounds = (1.0 + 1.1 * runconf['radiu...
[ "0.55884576", "0.55294585", "0.54952866", "0.5478752", "0.54585534", "0.5457916", "0.5400724", "0.53666246", "0.5278129", "0.5265385", "0.5226118", "0.5143169", "0.51224685", "0.50919163", "0.5074335", "0.5074191", "0.5060052", "0.50374204", "0.50359833", "0.50242496", "0.501...
0.6512488
0
Sleeps for a given number of microseconds. it uses polling to keep track of the time so it's fairly accurate with large numbers (10+ micro seconds). But because it uses polling, it can't be used extensively with threads.
def micro_sleep(micro_sec): start_time = time.time() while (time.time() - start_time) < (micro_sec * 1e-6): pass return 0
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sleep_us(microseconds):\n time.sleep(microseconds / 1000000.0)", "def udelay(us: int, /) -> None:", "def sleep_ms(milliseconds):\n time.sleep(milliseconds / 1000.0)", "def sleep(sleep_time=0.250):\n time.sleep(sleep_time)", "def sleep_for(timeToSleep):\r\n time.sleep(timeToSleep)", "def s...
[ "0.8067867", "0.70814234", "0.7063586", "0.7047902", "0.6981649", "0.6873613", "0.6784554", "0.67838335", "0.6754892", "0.66788435", "0.6657138", "0.6657138", "0.6619943", "0.65957415", "0.656517", "0.65394354", "0.6525621", "0.64528435", "0.64156145", "0.6414528", "0.6347467...
0.73731333
1
Takes a positive integer and returns the next bigger number formed using the same digits by cutting the number at a certain index, creating sorted permutations and compare permutations until next bigger number is found. Checks before if a next bigger number can be formed by a simple swap of last 2 digits. If no bigger ...
def next_bigger(n): if is_biggest(n): return -1 sn = str(n) idx = cut_number(n) slice_at = len(sn) - idx - 1 if idx == 1: out = [sn[-1], sn[-2]] return int(''.join([d for d in islice(sn, slice_at)] + out)) slice = sn[slice_at:] n = int(''.join([d for d in slice])) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def problem_52():\n\n for number in xrange(1, 123456789):\n sorted_num = ''.join(sorted(str(number)))\n if len([value for value in xrange(2, 7)\n if ''.join(sorted(str((value * number)))) == sorted_num]) == 5:\n return number", "def solution():\n i = 1\n\n while T...
[ "0.6613978", "0.6575689", "0.63357174", "0.63086474", "0.6255691", "0.6244988", "0.6207258", "0.6176591", "0.61365944", "0.60795087", "0.6023269", "0.6010167", "0.5975499", "0.5975204", "0.59435886", "0.59297025", "0.5925468", "0.5911902", "0.59070045", "0.5870173", "0.586894...
0.72905743
0
Return True if given n is already the biggest number possible to be formed of n's digits.
def is_biggest(n): return True if int(''.join(sorted([d for d in str(n)], reverse=True))) == n else False
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def has_small_digits(n,maxdigit):\n digits = [int(num) for num in str(n)]\n return all([num <= maxdigit for num in digits])", "def isReversible(n): \n if n % 10 == 0:\n return False\n s = n + reverseNum(n)\n while s > 0:\n digit = s % 10\n if not digit in [1,3,5,7,9]:\n ...
[ "0.71942073", "0.6877328", "0.6774127", "0.65988797", "0.6590628", "0.65312386", "0.6525664", "0.6517685", "0.6496512", "0.64802724", "0.6467701", "0.6457774", "0.6432592", "0.6403123", "0.62918633", "0.6277351", "0.62575203", "0.62530875", "0.6212425", "0.6211562", "0.618213...
0.8055396
0
Initialize first name, last name, email, and password attrbutes
def __init__(self, first_name, last_name, email, password): self.first_name = first_name self.last_name = last_name self.email = email self.password = password
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self,first_name,last_name,password):\n self.first_name = first_name\n self.last_name = last_name\n self.password = password", "def __init__(self, first_name, last_name, email, mobile, user_name):\n self.first_name = first_name\n self.last_name = last_name\n ...
[ "0.7869155", "0.74667937", "0.74283135", "0.7384546", "0.72237825", "0.721337", "0.72039735", "0.71950114", "0.7126161", "0.70333755", "0.7031249", "0.697843", "0.6920546", "0.6902128", "0.6901947", "0.689677", "0.68920135", "0.68731815", "0.6841466", "0.68248737", "0.6765751...
0.8309336
1
Function domain has to be a subdomain of [0,1] It uniformely draws a value in 0, 1 and if x > draw its a success, otherwise its a failure
def draw(function): def f(**kwargs): rand = random.random() x = function(**kwargs) return int(rand < x) return f
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def plot_stability_function(self,bounds=[-20,1]):\n import matplotlib.pyplot as plt\n p,q=self.stability_function()\n xx=np.arange(bounds[0], bounds[1], 0.01)\n yy=p(xx)/q(xx)\n fig, = plt.plot(xx,yy)\n plt.draw()", "def uniform_cdf(x):\n if x <0: return 0 #...
[ "0.62069505", "0.58539474", "0.58238584", "0.5762853", "0.5744785", "0.57316726", "0.57075983", "0.57017034", "0.56120497", "0.5555804", "0.554992", "0.55472755", "0.5547096", "0.5538376", "0.55219877", "0.54943615", "0.5489345", "0.54796255", "0.5478132", "0.5468655", "0.545...
0.6333301
0
Given a sequence of results, it formats them results is a seq of explored_points number_trials number_features datapoints best_point best_score
def format_multiple_results(results, features_to_show=[]): best_score_array = np.array([]) for r in results: print r print r[-1] best_score_array = np.append(best_score_array, r[-1]) print "BEST SCORE ARRAY", best_score_array print "Best Score" print "Mean: ", best_score_arr...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def format_results(explored_points,\n number_trials,\n number_features,\n datapoints,\n best_point,\n best_score,\n features_to_show=[]):\n n = get_number_iterations_to_find_best_point(explored_points, be...
[ "0.7401889", "0.6553822", "0.60679543", "0.6050679", "0.6028564", "0.59847915", "0.5978609", "0.5964921", "0.5957579", "0.59572643", "0.59409523", "0.5897846", "0.5835463", "0.5799116", "0.5757532", "0.57534695", "0.56823665", "0.5655724", "0.56463933", "0.56382924", "0.56345...
0.7131021
1
Given datapoints, it processes them and return a dict
def process_datapoints(datapoints): point_dict = {} ddata = [p for p in datapoints] for point in ddata: point_dict[hash_datapoint(point)] = {'results': [], 'time': [], 'features': point['features']} for p...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def extract_data(self):\n values = {}\n for injkey in self.data_sets.keys():\n values[injkey] = {}\n alldata = self.data_sets[injkey]\n paramkeys = alldata['params'].keys()\n for datakey in alldata.keys():\n if not datakey == 'params':\n ...
[ "0.6150316", "0.60581946", "0.602534", "0.59108746", "0.5816158", "0.57971084", "0.57479393", "0.5723442", "0.5723442", "0.5678968", "0.56233567", "0.561524", "0.5612661", "0.5566198", "0.55516404", "0.5533625", "0.5516452", "0.5494824", "0.5475759", "0.5451967", "0.5450508",...
0.84955275
0
Given a point_dict, it sorts them. Sorts only by mean for now
def sort_point_dict(point_dict): return sorted(list(point_dict.items()), key=lambda (h, d): d['mu'], reverse=True)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def calculate_points_sorted(self):\n self._scrabble_word_point_dict_sorted = dict(sorted(\n self.calculate_points().items(), key=lambda x: x[1], reverse=True))\n return self._scrabble_word_point_dict_sorted", "def sorted_map_objects(self, point, objects):\n # print objects\n ...
[ "0.6469584", "0.62154025", "0.599137", "0.5796763", "0.56539685", "0.54507285", "0.5440906", "0.5375577", "0.53670275", "0.5328364", "0.52521837", "0.5250665", "0.5243527", "0.5220393", "0.5219259", "0.52182055", "0.5191816", "0.516851", "0.51685035", "0.5160942", "0.5140415"...
0.7893127
0
Clips a geo located raster image file
def _clip_raster(src, dest): # Check if we should have been called at all if TIFF_CLIP_TUPLE is None: return False cmd = 'gdal_translate -projwin %s %s %s %s "%s" "%s"' % \ (TIFF_CLIP_TUPLE[2], TIFF_CLIP_TUPLE[1], TIFF_CLIP_TUPLE[3], TIFF_CLIP_TUPLE[0], src, dest) print("Clipping:...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def clip_image(coords_poly, fname):\n with rio.open(\"%s.tif\" % fname) as src:\n out_image, out_transform = mask.mask(src, [to_geojson(coords_poly)],\n crop=True, nodata=-9999)\n masked_image = ma.masked_equal(out_image, -9999)\n return masked_image"...
[ "0.6472985", "0.58712786", "0.5655326", "0.5643404", "0.559887", "0.55851036", "0.55131793", "0.5485759", "0.5466761", "0.5440446", "0.54237384", "0.5408929", "0.5349616", "0.5348655", "0.53443325", "0.53009516", "0.5292252", "0.5279626", "0.5275577", "0.5268772", "0.5265451"...
0.62262547
1
Locates a file in the specified folder that has the matching ending.
def find_file_match(folder, end): if not os.path.exists(folder): return None if not os.path.isdir(folder): return None dir_list = os.listdir(folder) subdirs = [] # First try to find the file. Save any sub folders for later for entry in dir_list: # Skip over hidden files...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def recursively_find_file(folder, file_name):\n # TODO: print a hint when not founding file_name", "def find_file_in_folders(filename, folders):\n for folder in folders:\n folder = os.path.expanduser(folder)\n full_path = os.path.join(folder, filename)\n if os.path.exists(full_path):\n...
[ "0.67515445", "0.6186545", "0.6118093", "0.6118093", "0.59918004", "0.58797514", "0.58780056", "0.58734465", "0.58096653", "0.57396233", "0.5716728", "0.57114655", "0.5689818", "0.56630224", "0.56502265", "0.5642229", "0.56132084", "0.5606557", "0.5592333", "0.5590751", "0.55...
0.70814955
0
Finds subfolders that match the filter
def find_filtered_folders(folder, regex_filter=None): found = [] for name in os.listdir(folder): # Skip over special folders and hidden names name_len = len(name) if name_len >= 1 and name[0] == '.': continue full_name = os.path.join(folder, name) if os.path...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def filter_folders_search(candidates, key):\n output = list()\n for candidate in candidates:\n found = []\n files = os.listdir(candidate)\n if isinstance(key, list):\n for k in key:\n found.append(k in files)\n else:\n found.append(key in files...
[ "0.67522645", "0.6490178", "0.63677526", "0.6283355", "0.62025726", "0.6202449", "0.617264", "0.61695564", "0.61398077", "0.60967046", "0.60329187", "0.59793854", "0.5977609", "0.5976922", "0.59758526", "0.5965404", "0.59538203", "0.59491205", "0.5933064", "0.59089947", "0.58...
0.67873347
0
Two events are considered to be the same class if they are the same except for the day_of_week
def is_same_class(self, other): return isinstance(other, Event) \ and self.title == other.title \ and self.time_start == other.time_start \ and self.time_end == other.time_end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_events_same_date(self):\n user = User.objects.create_user(\n 'foo', 'bar@example.com', 'secret'\n )\n d = make_aware(\n datetime.datetime(2019, 5, 3, 0, 0, 0, 0),\n get_default_timezone()\n )\n event = Event.objects.create(\n s...
[ "0.60280544", "0.5746007", "0.5724599", "0.561905", "0.5603146", "0.5598967", "0.5588052", "0.5582824", "0.55804735", "0.5537794", "0.5531517", "0.55156815", "0.5470036", "0.5467309", "0.54545224", "0.5410062", "0.5397318", "0.5396225", "0.53808075", "0.5380655", "0.5364224",...
0.6703482
0
Return six attributes of each book.
def ATTRIBUTE(): return "author", "title", "publisher", "shelf", "category", "subject"
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_book_details(self):\n\n try:\n # gives response for the request from the API url\n response = requests.get(self.book_url)\n\n \n # using ElementTree to store the response content in a tree\n root = ET.fromstring(response.content)\n bo...
[ "0.59855455", "0.5938322", "0.59131485", "0.59004706", "0.5755123", "0.5739197", "0.5712055", "0.5707001", "0.570237", "0.5690077", "0.5680543", "0.5666145", "0.5653928", "0.5597275", "0.5587452", "0.55622524", "0.55571365", "0.55342346", "0.55334574", "0.5510789", "0.5505841...
0.6384021
0
Return the user input for the main service.
def USER_INPUT_SERVICE(): return "search", "move", "exit"
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_user_input(self):\r\n\r\n defaults = get_settings_from_client(self.client)\r\n timeout = defaults['timeout']\r\n\r\n # Ask for username\r\n while True:\r\n username = self.env.input(\r\n 'Username [%s]: ' % defaults['username']) \\\r\n or...
[ "0.7298578", "0.70113575", "0.6888851", "0.6806782", "0.6786595", "0.67729163", "0.6766338", "0.6647359", "0.65606725", "0.64858645", "0.64399534", "0.6427607", "0.6412201", "0.6374151", "0.63573956", "0.63470465", "0.6333671", "0.63120025", "0.6299704", "0.62972295", "0.6286...
0.726068
1
Check if there is a JSON file called somebooks.json in the same directory. This function opens the json file if it exists, otherwise, it convert the excel file to the json file and open the json file again.
def check_json_file(file_name: str, excel_file: str, sheet_name: str) -> list: try: with open(file_name) as json_file: data = json.load(json_file) return data except FileNotFoundError: period_index = excel_file.index(".") json_file_name = excel_file[:period_index] + "...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_json_data() -> list:\n try:\n with open('somebooks.json', 'r') as file_object:\n content = json.load(file_object)\n except FileNotFoundError:\n excel_data = pandas.read_excel('somebooks.xlsx')\n converted = excel_data.to_json(orient='records')\n with open('someb...
[ "0.75339997", "0.6666991", "0.63506806", "0.6329869", "0.63267577", "0.6194065", "0.6182662", "0.6160969", "0.6097362", "0.60973275", "0.6049916", "0.6043917", "0.5982211", "0.5911872", "0.5862649", "0.5855029", "0.58499557", "0.5797011", "0.5764502", "0.5757783", "0.5736766"...
0.6959809
1
Convert excel file to the regular list in python.
def convert_excel_file(excel_file: str, sheet_name: str) -> list: workbook = xlrd.open_workbook(excel_file) sheet = workbook.sheet_by_name(sheet_name) book_list = [] for row in range(1, sheet.nrows): books = OrderedDict() row_values = sheet.row_values(row) books["author"] = row_...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def as_data(self):\n wb = load_workbook(filename=self.file_path)\n ws = wb.active\n data = []\n\n for i, row in enumerate(ws.rows):\n if len(row) != self.max_columns:\n print(len(row))\n return []\n\n if i == 0:\n # skip...
[ "0.68098074", "0.67064244", "0.6490532", "0.6436667", "0.6356518", "0.6334197", "0.6322425", "0.624131", "0.620288", "0.6183244", "0.61808234", "0.6175971", "0.61544317", "0.6123336", "0.6112346", "0.5990437", "0.59709984", "0.591867", "0.5908782", "0.58885264", "0.58105695",...
0.73590165
0
Replace empty values of the attributes in the list with None.
def replace_empty_value(data: list) -> list: for book in data: for attribute in book: if book[attribute] == "": book[attribute] = "None" return data
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _none(self, attrs):\n\n [self.__setattr__(nm, None) if nm[0] == '_' else\n self._data.pop(nm, None) for nm in attrs]", "def reinitToNull(self):\n for sAttr in self.getDataAttributes():\n setattr(self, sAttr, None);\n return self;", "def _replace_none(lst, repl=\"\"...
[ "0.7511008", "0.7055408", "0.6766012", "0.6439251", "0.6296605", "0.61768496", "0.617182", "0.6146685", "0.6102481", "0.6072514", "0.6032015", "0.5994076", "0.59902567", "0.59897625", "0.5982268", "0.59674823", "0.5960471", "0.5937552", "0.58904326", "0.58870083", "0.5886814"...
0.78777134
0
Print the existed shelves in the data.
def print_shelf(data: list) -> list: shelf_list = [] for book in data: if book["shelf"] not in shelf_list: shelf_list.append(book["shelf"]) for index in range(len(shelf_list)): print(f"{index + 1}. {shelf_list[index]}") return shelf_list
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _list():\n db = shelve.open(\"db\", flag='c', protocol=None, writeback=False)\n names_only = input(\"Names only [Y/n] ->\")\n\n if names_only == \"Y\":\n for name in db.keys():\n print(name)\n elif names_only == \"n\":\n for key in db.items():\n ...
[ "0.6437544", "0.6338005", "0.6318951", "0.6133392", "0.6106604", "0.59813553", "0.59253657", "0.57493514", "0.56373554", "0.5560302", "0.55085963", "0.54855436", "0.5440844", "0.54132223", "0.5375083", "0.5375083", "0.53502935", "0.53194433", "0.53161585", "0.5297883", "0.529...
0.6682515
0
Get user input to move a book to another shelf.
def user_input_move_shelf(data: list) -> list: while True: try: print("Which book do you want to move?") result = user_input_book_search(data) print_book_search(result) user_input = int(input("Enter the number of the book you want to move: ")) book...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def move_book(library: list, found_books: list) -> None:\n book_to_move = get_user_choice(found_books, '\\nWhich book would you like to move?')\n destination_shelf = input('\\nWhat shelf would you like to move this book to?')\n for book in library:\n if book == found_books[int(book_to_move) - 1]:\n...
[ "0.7698029", "0.67812896", "0.668876", "0.6473773", "0.61493", "0.60770595", "0.5907093", "0.5743994", "0.54761446", "0.54619217", "0.54530996", "0.5441062", "0.5439915", "0.54156256", "0.53914243", "0.53367704", "0.52550465", "0.5177554", "0.5093476", "0.50647825", "0.504872...
0.6849717
1
Modify the value of "shelf" attribute of the given book in the data list.
def move_book_shelf(book: dict, shelf_move_to: str, data: list) -> list: book_index = data.index(book) data[book_index]["shelf"] = shelf_move_to.title() print("{title} is now on {shelf} shelf.".format(title=book["title"], shelf=data[book_index]["shelf"])) return data
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def save_shelf(self, shelf_name, data):\r\n shelf_path = os.path.join(self.full_dir, shelf_name)\r\n with shelve.open(shelf_path, 'c') as shelf:\r\n shelf['data'] = data", "def add_shelf(self, shelf):\n self.shelves.setdefault(shelf, {})", "def reset_shelf(self, shelf_name):\r\n...
[ "0.6874109", "0.64561594", "0.61714566", "0.6038482", "0.5694013", "0.56658477", "0.5519538", "0.5515783", "0.5499935", "0.5397137", "0.5273602", "0.5240275", "0.5235969", "0.5216271", "0.51571494", "0.5114026", "0.5104161", "0.5058912", "0.5055481", "0.5014114", "0.5013854",...
0.721833
0
Run the program containing functions to search books and move the books to the other shelf and modify the json file as needed.
def library(): data = check_json_file("somebooks.json", "somebooks.xls", "Books") data = replace_empty_value(data) while True: user_action = get_user_input() if user_action == "exit": # Exit print("Thanks for your visit. Have a nice day!") exit(0) elif user_...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def move_book(library: list, found_books: list) -> None:\n book_to_move = get_user_choice(found_books, '\\nWhich book would you like to move?')\n destination_shelf = input('\\nWhat shelf would you like to move this book to?')\n for book in library:\n if book == found_books[int(book_to_move) - 1]:\n...
[ "0.6328408", "0.6101203", "0.60089076", "0.58400583", "0.5769831", "0.5715876", "0.56407684", "0.55838096", "0.5508825", "0.54887336", "0.5461612", "0.5460796", "0.54583156", "0.5456028", "0.5447048", "0.5425394", "0.53100276", "0.5287743", "0.52609015", "0.52356964", "0.5229...
0.7568932
0
Determines the currently possible cards that player can play, based on his hand and the suit of the first card of the trick
def get_playable_cards(self, first): playable_cards = [] first_colors = [] if len(self.hand) == 0: print("ERROR: Handy Empty") if first is None: return self.hand for card in self.hand: # White cards can ALWAYS be played. if card.col...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def find_playable_cards_in_hand(hand,board):\r\n\r\n possible_plays=[]\r\n accessible_chain_ends = [0,-1]\r\n\r\n for end in accessible_chain_ends:\r\n for card in hand:\r\n for side in card:\r\n\r\n if side.split('_')[0] == board[end][end].split('_')[0]: #check for s...
[ "0.67783904", "0.6727034", "0.66943055", "0.6678513", "0.6620407", "0.6617623", "0.66103923", "0.65848726", "0.65315187", "0.6467546", "0.64247566", "0.6381186", "0.6344629", "0.63192624", "0.6303362", "0.62493557", "0.62479115", "0.6243894", "0.62370473", "0.62184215", "0.62...
0.69344014
0
Randomly chooses trump color from cards of own hand
def get_trump_color(self): return random.choice(Card.colors[1:])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def random_color():\n return random.choice(colors)", "def get_trump_color(self):\n color_counter = collections.Counter()\n for card in self.hand:\n color = card.color\n if color == \"White\":\n continue\n color_counter[color] += 1\n if not c...
[ "0.7180077", "0.692395", "0.6867298", "0.6762564", "0.66311836", "0.6629565", "0.66207784", "0.65926397", "0.6585948", "0.65722585", "0.65379435", "0.65024084", "0.65023965", "0.6496322", "0.64912546", "0.64856356", "0.64598596", "0.6437486", "0.6437164", "0.64346325", "0.641...
0.7728462
0
Determines trump color by choosing the color the agent has the most of in its hand
def get_trump_color(self): color_counter = collections.Counter() for card in self.hand: color = card.color if color == "White": continue color_counter[color] += 1 if not color_counter.most_common(1): return super().get_trump_color()...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_trump_color(self):\n return random.choice(Card.colors[1:])", "def colortopalette(color, palette):\n for a,b in palette:\n if color >= a and color < b:\n return b", "def get_opponent_color(self, self_color):\r\n return abs(self_color - 1)", "def color_differentiator(elevation):\n i...
[ "0.7093409", "0.63777554", "0.6331033", "0.6293792", "0.6290103", "0.623271", "0.61810565", "0.60774094", "0.6067189", "0.60661554", "0.6063848", "0.60171455", "0.59263396", "0.5900971", "0.58864385", "0.58575535", "0.5857297", "0.58364886", "0.5806741", "0.57944185", "0.5790...
0.7337894
0
Display user's list of repositories and the number of commits in each one
def display_repos_and_commits(github_id): repo_list = get_repos(github_id) for repo in repo_list: commits_count = get_commits(github_id, repo) print('Repo: {} Number of commits: {}'.format(repo, commits_count))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def do_list(client, args):\n\trepos = client.repos.list(args.user)\n\tprint '%s has the following repositories:' % args.user\n\tprint 'Name - Description'\n\tfor repo in repos:\n\t\tprint '%s - %s' % (repo.name, repo.description)", "def list_all_repos_info():\n repos = ALL_REPOS\n for repo_name, repo in zi...
[ "0.73600596", "0.6909156", "0.68263644", "0.68210804", "0.673797", "0.673653", "0.66730124", "0.6439157", "0.6397121", "0.6390943", "0.63839346", "0.63758844", "0.6349754", "0.63270366", "0.6308587", "0.6305501", "0.62475765", "0.6201714", "0.6179791", "0.6142561", "0.6138296...
0.76047134
0
Check special dependencies for stitching module
def check_dependencies(cls): missing = [] for name in cls.DEPENDENCIES: try: import_module(name) except ModuleNotFoundError: missing.append(name) if any(missing): msg = ('The sup3r stitching module depends on the following ' ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def dependencies_met():\n # Check Java VM command line runner.\n try:\n Popen(['java'], shell=False, stderr=PIPE).communicate()[1]\n except:\n print 'Dependecy unmet. Java virtual machine command line runner not ' \\\n 'found.'\n return False\n # Check selenium-server.ja...
[ "0.6940826", "0.6913852", "0.687608", "0.68599564", "0.68059677", "0.672418", "0.67076075", "0.65250117", "0.64885616", "0.6470235", "0.6439658", "0.6427566", "0.64241576", "0.64232284", "0.64231914", "0.64095175", "0.6398053", "0.6376329", "0.6365801", "0.6357008", "0.634915...
0.7889856
0
Get input files for all domains to stitch together, and output file name
def get_files(year, month, input_pattern, out_pattern, n_domains=4): in_pattern = [input_pattern.format(year=year, month=str(month).zfill(2), domain=i) for i in range(1, n_domains + 1)] input_files = {i: sorted(glob.glob(in_pattern[i])) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def output_files(self):\n return [self.input_files()[0].replace(\".lhe.gz\", \".stdhep\").replace(\".lhe\", \".stdhep\")]", "def stitch_domains(year, month, time_step, input_files, overlap=50,\n n_domains=4, max_level=15):\n logger.info(f'Getting domain files for year={year}, month={m...
[ "0.6666255", "0.61201626", "0.6051973", "0.5941226", "0.5911258", "0.58427304", "0.5810845", "0.5810845", "0.58078384", "0.5776296", "0.5763059", "0.5714856", "0.5705753", "0.5702285", "0.5687452", "0.5606524", "0.5601291", "0.55979383", "0.5592411", "0.55880284", "0.55819297...
0.62585974
1
Unstagger variables for all handles
def unstagger_vars(handles): dims = ('Time', 'bottom_top', 'south_north', 'west_east') for i, handle in enumerate(handles): handles[i]['U'] = (dims, np.apply_along_axis(forward_avg, 3, handle['U'])) handles[i]['V'] = (dims, np.apply_along_axis...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def unpack_param(self,name):\n f = self.representations[name]['frame']\n w = self.representations[name]['widget']\n l = self.representations[name]['label']\n\n del self.representations[name]\n\n for x in [f,w,l]:\n x.destroy()", "def tidyup():\n global cola1\n ...
[ "0.54354507", "0.5415984", "0.5415984", "0.5185243", "0.5176601", "0.5169327", "0.51318556", "0.51261914", "0.51261914", "0.51261914", "0.5094389", "0.5094218", "0.5061636", "0.5038347", "0.503331", "0.5004733", "0.49959427", "0.49852726", "0.49748418", "0.49746618", "0.49633...
0.67745286
0
Forward average for use in unstaggering
def forward_avg(array_in): return (array_in[:-1] + array_in[1:]) * 0.5
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def average(self):\n return (self.current + self.last) / 2.0", "def moving_average(a, n=3) :\n ret = np.cumsum(a, dtype=float)\n ret[n:] = ret[n:] - ret[:-n]\n return ret[n - 1:] / n", "def _get_average(self):\n norm = 1.0\n for pos, idx in enumerate(self.idx):\n norm *...
[ "0.72430915", "0.6892073", "0.6880777", "0.6774747", "0.676742", "0.6736841", "0.67163", "0.66307765", "0.66242844", "0.66242844", "0.66126573", "0.659557", "0.65907085", "0.656212", "0.64925957", "0.6475502", "0.64701295", "0.6470074", "0.6456754", "0.6446331", "0.64271057",...
0.7916229
0
Impute smaller domain in largest domain
def impute_domain(handles, domain_num, overlap=50): out = get_domain_region(handles, domain_num) (lat_range, lon_range, min_lat, max_lat, min_lon, max_lon, n_lats, n_lons) = out regridder = Regridder(handles[domain_num].XLAT[0], handles[domain_num].XLONG[0], ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def minimum_inplace(a, b):", "def exp_inplace(a):", "def unite(self, interval):\n first, last = self._intersect_continuous(interval)\n if first != last:\n interval.lower = min(interval.lower, self.intervals[first].lower)\n interval.upper = max(interval.upper, self.intervals[...
[ "0.5357976", "0.5332196", "0.52823913", "0.5244389", "0.52292365", "0.5218505", "0.5192066", "0.5179274", "0.5156471", "0.5156471", "0.51499015", "0.5103929", "0.50956696", "0.5079715", "0.50581384", "0.5046246", "0.50388867", "0.5027804", "0.5019727", "0.5019727", "0.4999809...
0.611095
0
Read the response from the output stream.
def read_response(self, read_lines=True): response = None if read_lines: response = self.stdout_stream.readlines() else: response = self.stdout_stream.read() return response
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def Response(self, REQUEST = None):\n stream = REQUEST.stdin\n stream.seek(0)\n response_xml = stream.read()\n self.LOG('INFO', response_xml)\n return", "def readAndRespond(self):\n\n if self.ser.isOpen():\n try:\n #Try to read\n ...
[ "0.64798725", "0.6464779", "0.63228273", "0.62294316", "0.61867225", "0.616199", "0.6152213", "0.6139358", "0.61305726", "0.61253554", "0.61253554", "0.61253554", "0.61253554", "0.61253554", "0.61253554", "0.61253554", "0.61253554", "0.61253554", "0.61253554", "0.61253554", "...
0.7689623
0
method 2 uses map to create iterator, which applies area function to each element of radii it can sometimes be better to use iterator, esp. for large lists
def demo_2(radii): area_iter = map(area, radii) # returns iterator over area applied to each radius for a in area_iter: print a
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def demo_1(radii):\n areas = []\n for r in radii:\n a = area(r) # populate list one-by-one in for loop\n areas.append(a)\n print a", "def demo_one_map():\n radii = [2, 5, 7.1, 0.3, 10]\n demo_1(radii)\n demo_2(radii)", "def area(r):\n return np.pi * (r ** 2)", "def are...
[ "0.76373756", "0.61172456", "0.59385043", "0.58112097", "0.5805867", "0.5619899", "0.5579481", "0.55554813", "0.555353", "0.55474573", "0.55463666", "0.5499069", "0.5474273", "0.54719317", "0.545316", "0.54406846", "0.542573", "0.5404288", "0.53858316", "0.53802425", "0.53782...
0.8657121
0
use filter to keep only data from list that are strictly above average
def demo_one_filter(): data = [1.3, 2.7, 0.8, 4.1, 4.3, -0.1] avg = np.mean(data) print "average value is:", avg # create iterator that filters to keep only above average data above_avg_iter = filter(lambda x: x > avg, data) # returns iterator for data above the avg print "values strictly abo...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def averageAbove(requestContext, seriesList, n):\n return [ series for series in seriesList if safeDiv(safeSum(series),safeLen(series)) >= n ]", "def averageBelow(requestContext, seriesList, n):\n return [ series for series in seriesList if safeDiv(safeSum(series),safeLen(series)) <= n ]", "def check_for_ext...
[ "0.6788018", "0.6599736", "0.65893126", "0.6347704", "0.63396186", "0.6122786", "0.5985234", "0.59347624", "0.59124935", "0.5818945", "0.5782514", "0.57159835", "0.57097226", "0.5708725", "0.5677124", "0.5640992", "0.5623442", "0.5623442", "0.5623442", "0.5618126", "0.5614306...
0.7738846
0
Overrides the lower than operator for the HuffNode class. The lowest node is the one with the lowest frequency.
def __lt__(self, other) -> bool: if not isinstance(other, HuffNode): raise TypeError('not an instance of HuffNode') return self.freq < other.freq
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __gt__(self, other):\n if not isinstance(other, HuffNode):\n raise TypeError('not an instance of HuffNode')\n\n return self.freq > other.freq", "def __lt__(self, other):\n return self.weight() < other.weight()", "def low(self):", "def __lt__(self, other):\n return s...
[ "0.67176753", "0.6515853", "0.6485333", "0.6472491", "0.62008893", "0.61282676", "0.6078565", "0.60574406", "0.59091675", "0.5850642", "0.5848625", "0.5842823", "0.5842823", "0.58327407", "0.58279157", "0.5790842", "0.5790842", "0.5787226", "0.57517016", "0.57517016", "0.5738...
0.7005319
0
Overrides the greater than operator for the HuffNode class. The greater node is the one with the highest frequency.
def __gt__(self, other): if not isinstance(other, HuffNode): raise TypeError('not an instance of HuffNode') return self.freq > other.freq
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __gt__(self, other):\n return self.weight > other.weight", "def greater_than(self) -> global___Expression:", "def __gt__(self, other):\n return self.weight() > other.weight()", "def __gt__(self, other):\n return greater(self, other)", "def __gt__(self, *args):\n return _ida_...
[ "0.6519031", "0.650537", "0.6479559", "0.64129585", "0.618937", "0.6180673", "0.6178741", "0.61576974", "0.61190486", "0.60712063", "0.60510516", "0.6041431", "0.6036013", "0.60049826", "0.600038", "0.59838766", "0.59659743", "0.59659743", "0.5938563", "0.5931549", "0.5900797...
0.7675924
0
Overrides the addition operator for the Huffnode class. An addition operation on this instance consists in creating a new node whose frequency is equal to the addition of the two previous ones. The left node is always the one with the highest frequency.
def __add__(self, other): if not isinstance(other, HuffNode): raise TypeError('not an instance of HuffNode') nodes = sorted([self, other], reverse=True) return HuffNode(label='#', freq=self.freq+other.freq, left=nodes[0], right=nodes[1])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def combine(a, b):\r\n if a.freq < b.freq:\r\n temp = b\r\n elif a.freq == b.freq:\r\n if a.char < b.char:\r\n temp = a\r\n else:\r\n temp = b\r\n else:\r\n temp = a\r\n new_node = HuffmanNode(temp.char , a.freq + b.freq)\r\n return new_node", "def __radd__(self, lef...
[ "0.67677003", "0.6439896", "0.6322387", "0.62799114", "0.62714666", "0.62368745", "0.62368745", "0.62139976", "0.61967933", "0.61947495", "0.61947495", "0.61947495", "0.61947495", "0.61947495", "0.61947495", "0.61947495", "0.6165775", "0.6125683", "0.6095935", "0.6083403", "0...
0.82364583
0
given the input_fname, open and read the file, the return the md5 hash (as a str) of the file contents.
def get_checksum(input_fname): with open(input_fname, "rb") as infile: file_contents = infile.read() checksum = hashlib.md5(file_contents).hexdigest() return checksum
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def hash_file(fname):\n hash_md5 = hashlib.md5()\n with open(fname, \"rb\") as f:\n for chunk in iter(lambda: f.read(4096), b\"\"):\n hash_md5.update(chunk)\n return hash_md5.hexdigest()", "def md5File(fname):\n if not os.path.isfile(fname):\n fatal('file does not exist: %s' ...
[ "0.8008968", "0.7666196", "0.76509374", "0.76370436", "0.7614768", "0.75798297", "0.754367", "0.75365406", "0.75246096", "0.7517816", "0.7504813", "0.74877983", "0.74542344", "0.74085164", "0.7389757", "0.7375907", "0.7368784", "0.73392254", "0.7333227", "0.7327257", "0.72956...
0.8454173
0
1.1 GET mount/labels > Return the full representation of all the labels
def get_labels(): return if_found(dao.get_labels())
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_labels(self):\n return get_labels(self.api_key)", "def get_labels():\n\n logging.info(\"Getting metadata about labels\")\n\n labels = []\n\n if len(args.labels) == 0:\n logging.warning(\"No labels specified, assuming all labels. If you have a lot of labels in your inbox you could h...
[ "0.70209783", "0.6900137", "0.68263996", "0.6825446", "0.67997086", "0.6726106", "0.6713325", "0.667115", "0.667115", "0.667115", "0.667115", "0.667115", "0.667115", "0.667115", "0.667115", "0.6670006", "0.6665497", "0.6640822", "0.6630054", "0.6625985", "0.6613247", "0.661...
0.69041467
1
1.7 PUT mount/labels > Replace all of the labels with a fresh representation
def put_labels(): dao.delete_all_labels() for label in request.json: if 'id' not in label or not label['id']: label['id'] = str(uuid.uuid4()) dao.set_label(id=label['id'], name=label['name'], fields=label['fields']) return if_found(dao....
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def replace(self, labels):\r\n request = http.Request('PUT', self.get_url(), labels)\r\n\r\n return request, parsers.parse_json", "def put(self, id):\n context = request.environ.get('context')\n resp = dbapi.netdevices_labels_update(context, id, request.json)\n response = {\"la...
[ "0.7051037", "0.6904257", "0.6446828", "0.62160695", "0.60783005", "0.5938491", "0.5843615", "0.5775519", "0.57554543", "0.5755334", "0.57135504", "0.56914485", "0.5642309", "0.56397206", "0.55364823", "0.5514417", "0.55140096", "0.54909015", "0.5476221", "0.5457026", "0.5399...
0.7563547
0
1.4 POST mount/labels > Write a representation of a label with a systemprovided uuid
def post_label(): label_id = dao.set_label(id=str(uuid.uuid4()), name=request.json['name'], fields=request.json['fields']) return jsonify(dao.get_label(label_id))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def put_label(id):\n label_id = dao.set_label(id=id,\n name=request.json['name'],\n fields=request.json['fields'])\n\n return jsonify(dao.get_label(label_id))", "def put_labels():\n dao.delete_all_labels()\n for label in request.json:\n i...
[ "0.6376631", "0.6329587", "0.6133197", "0.6059096", "0.60439414", "0.59545565", "0.5900285", "0.57338583", "0.572619", "0.5726019", "0.570133", "0.56741357", "0.5659353", "0.56531096", "0.5623214", "0.5574305", "0.554808", "0.54989237", "0.54892194", "0.5489141", "0.54876506"...
0.6740091
0
1.5 DELETE mount/labels/ > Delete the label with the specified uuid
def delete_label(id): dao.delete_label(id) return jsonify(dao.get_label(id))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delete_manifest_label(label_uuid, tag_manifest):\n\n # Find the label itself.\n label = get_manifest_label(label_uuid, tag_manifest)\n if label is None:\n return None\n\n if not label.source_type.mutable:\n raise DataModelException(\"Cannot delete immutable label\")\n\n # Delete th...
[ "0.73629177", "0.71363217", "0.68534607", "0.6791572", "0.6614757", "0.6543542", "0.6508839", "0.6503761", "0.631163", "0.62055314", "0.6165254", "0.6092195", "0.60233444", "0.6009277", "0.5977981", "0.5973543", "0.5931018", "0.5905483", "0.58950716", "0.58950716", "0.5856335...
0.7481874
0
2.3 POST mount/lampholder/concorde/issues/1234/labels > Submit a list of label ids that will add to the existing list
def post_issue_labels(repo, project, issue_number): issue_path = '%s/%s/issues/%d' % (repo, project, issue_number) new_label_ids = request.json current_label_ids = dao.get_issue_label_ids(issue_path) revised_label_ids = current_label_ids + new_label_ids dao.set_issue_label_ids(issue_path, revise...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def put_labels():\n dao.delete_all_labels()\n for label in request.json:\n if 'id' not in label or not label['id']:\n label['id'] = str(uuid.uuid4())\n dao.set_label(id=label['id'],\n name=label['name'],\n fields=label['fields'])\n return ...
[ "0.75345325", "0.6661264", "0.66239154", "0.659902", "0.6598472", "0.6548062", "0.6356847", "0.63353974", "0.6286665", "0.6274863", "0.6234509", "0.62122804", "0.613269", "0.6089115", "0.60212", "0.59257346", "0.58975476", "0.58813006", "0.57906944", "0.57704425", "0.57658815...
0.75510764
0
2.5 DELETE mount/lampholder/concorde/issues/1234/labels/ > Delete just that one label from the issue's list
def delete_issue_label(repo, project, issue_number, delete_label_id): issue_path = '%s/%s/issues/%d' % (repo, project, issue_number) current_label_ids = dao.get_issue_label_ids(issue_path) revised_label_ids = [label_id for label_id in current_label_ids if label_id != delete_label_...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_issue_delete_label(self):\n pass", "def test_issue_remove_label(self):\n pass", "def remove_labels(number, labels):\n\n cmds = [github_cli, 'pr', 'edit', str(number)]\n for lab in labels:\n cmds += ['--remove-label', lab]\n\n with subprocess.Popen(cmds) as p:\n _, ...
[ "0.79779637", "0.7516995", "0.7179144", "0.6965456", "0.6922724", "0.6781543", "0.6699212", "0.63474685", "0.6303081", "0.62790716", "0.6255312", "0.6172766", "0.6126894", "0.60828096", "0.6023985", "0.5988229", "0.59755516", "0.59745437", "0.5972416", "0.59451735", "0.594200...
0.7582168
1
2.6 PATCH mount/lampholder/concorde/issues/1234/labels > Add all of the labels specified (by id) in addLabelIds, then delete all of the labels specified (by id) in removelabelIds
def patch_issue_labels(repo, project, issue_number): add_label_ids = request.json.get('addLabelIds') or [] remove_label_ids = request.json.get('removeLabelIds') or [] issue_path = '%s/%s/issues/%d' % (repo, project, issue_number) current_label_ids = dao.get_issue_label_ids(issue_path) revised_lab...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def put_labels():\n dao.delete_all_labels()\n for label in request.json:\n if 'id' not in label or not label['id']:\n label['id'] = str(uuid.uuid4())\n dao.set_label(id=label['id'],\n name=label['name'],\n fields=label['fields'])\n return ...
[ "0.75549114", "0.6649774", "0.6637609", "0.6564369", "0.655386", "0.6328028", "0.6266163", "0.62637097", "0.62500215", "0.6166252", "0.6148355", "0.60901845", "0.60246205", "0.6005516", "0.59887844", "0.59770143", "0.59720564", "0.593295", "0.591873", "0.58980316", "0.5887798...
0.70334935
1
Check an IP and port for it to be open, store result in queue.
def check_peer(address, port, queue): # Create a TCP socket s = socket.socket() try: s.connect((address, port)) # print("Connection open to %s on port %s" % (address, port)) queue.put((True, address, port)) except socket.error as e: # print("Connection to %s on port %s fa...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __scan_for_open_ports(self, ip, ports_to_scan):\n ip = str(ip)\n\n def run_scan(_port):\n try:\n sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)\n sock.settimeout(self.__timeout)\n result = sock.connect_ex((ip, _port))\n ...
[ "0.65604156", "0.6474204", "0.6444854", "0.6439749", "0.63516456", "0.62882566", "0.62699854", "0.6245746", "0.62303084", "0.6209454", "0.61688894", "0.6166516", "0.61626995", "0.6138809", "0.6125605", "0.60924655", "0.6081274", "0.6076292", "0.606452", "0.60245854", "0.60160...
0.7048355
0
Rebuild the recommendations table.
def rebuild_table(db_path): with sqlite3.connect(db_path) as conn: conn.execute("drop table if exists recommendations") sql = """ create table recommendations ( group_id integer not null, recommendation_group_id integer not null, recommendation_number inte...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def fill_table(self):\n \n similarities_table_path = self.similarities_table_path\n\n if self.keep_similarities_table and similarities_table_path and os.path.exists(similarities_table_path):\n # raise ValueError(\"self.similarities_table_path is deprecated now. Do not give similarit...
[ "0.62788975", "0.59553796", "0.592766", "0.589186", "0.58300513", "0.572677", "0.5717906", "0.57028073", "0.5697981", "0.5612831", "0.5489738", "0.5440757", "0.5382683", "0.53819287", "0.5359657", "0.5346724", "0.5319766", "0.5315086", "0.5297769", "0.5285551", "0.52766347", ...
0.6133647
1
Convert a sorted iterable into lower/upper values of batches of size n.
def make_batch_limits(iterable, n): l = len(iterable) for ndx in range(0, l, n): chunk = iterable[ndx : min(ndx + n, l)] yield (chunk[0], chunk[-1] + 1)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def split_to_batches(iterable, n=1):\n l = len(iterable)\n for ndx in range(0, l, n):\n yield iterable[ndx:min(ndx + n, l)]", "def batches(l, n):\n for i in range(0, l, n):\n yield range(i,min(l,i+n))", "def chunk(iterable, n):\n iterable = [e for e in iterable]\n avg_length = int(...
[ "0.7196513", "0.7016247", "0.6730679", "0.66578823", "0.66578823", "0.66578823", "0.661883", "0.6568515", "0.6491408", "0.6399317", "0.6300084", "0.629686", "0.62917894", "0.62872493", "0.6286754", "0.625501", "0.625501", "0.625501", "0.625501", "0.625501", "0.6254961", "0....
0.7059446
1
Artist of current playing media (Music track only).
def media_artist(self): return self._state.get("artist", None)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def media_artist(self):\n return self.coordinator.data.nowplaying[self.zone.SourceID].CurrSong.Artists", "def media_artist(self):\n media_status = self._media_status()[0]\n return media_status.artist if media_status else None", "def media_artist(self):\n return self._media_artist", ...
[ "0.85988027", "0.85100645", "0.8364579", "0.8364579", "0.8197227", "0.81845474", "0.7796168", "0.7759904", "0.7709477", "0.7638341", "0.76134145", "0.7604214", "0.7216594", "0.70622", "0.69644237", "0.664528", "0.6623426", "0.6593583", "0.6548443", "0.6520028", "0.6481482", ...
0.86874646
0
Update available Volumio playlists.
async def _async_update_playlists(self, **kwargs): self._playlists = await self._volumio.get_playlists()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async def set_playlists(self):\n _LOGGER.debug(\"[Foobar2k] Getting playlists\")\n if (self._power == POWER_ON):\n playlists = {}\n response = await self.prep_fetch(HTTP_GET, GET_PLAYLISTS, data=None)\n data = json.loads(response)\n _LOGGER.debug(f\"[Foobar...
[ "0.6444172", "0.6045229", "0.5941406", "0.59381115", "0.59330964", "0.5926987", "0.5907806", "0.5808279", "0.5744804", "0.57112455", "0.56959444", "0.5679687", "0.56534135", "0.5595786", "0.55680376", "0.553737", "0.5531464", "0.55194217", "0.55025125", "0.54975694", "0.54948...
0.8349336
0