query
stringlengths
9
3.4k
document
stringlengths
9
87.4k
metadata
dict
negatives
listlengths
4
101
negative_scores
listlengths
4
101
document_score
stringlengths
3
10
document_rank
stringclasses
102 values
Ensure encoder produces expected encoded output.
def test_encoder(self): from sosbeacon.utils import number_encode number = 123 encoded = number_encode(number) self.assertEqual(encoded, 'b6')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_encode(self):\n pass # TODO(tlarsen)", "def _define_encoder(self):\n raise NotImplementedError", "def test_encoders(encoder):\n assert encoding.decode(None, encoder) is None\n assert encoding.encode(None, encoder) is None\n\n assert b\"\" == encoding.decode(b\"\", encoder)\n\n a...
[ "0.7567242", "0.70699394", "0.69895875", "0.69377136", "0.68090206", "0.6634779", "0.65108114", "0.64991826", "0.64129996", "0.6411713", "0.64028895", "0.63984114", "0.63530314", "0.6349346", "0.6330712", "0.6303407", "0.6277781", "0.6252162", "0.6197097", "0.61829704", "0.61...
0.6834381
4
Ensure decoded correctly decodes a known encoded number.
def test_decoder(self): from sosbeacon.utils import number_decode encoded = 'b6' number = number_decode(encoded) self.assertEqual(number, 123)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def decode(self, number: int) -> typing.Union[int, str]:\n return number", "def test_decode_numbers(self, number, base, expected):\n self.assertEqual(positional.decode(number, base), expected)", "def test_decoding_non_str_fails(self):\n self.assertRaises(DecodingError, base62.to_decimal, s...
[ "0.7170725", "0.70083755", "0.66928744", "0.65111727", "0.646559", "0.6452943", "0.63323385", "0.63235164", "0.62588257", "0.6219759", "0.61692274", "0.61123574", "0.61047447", "0.6043373", "0.6040491", "0.5980549", "0.5975069", "0.59651697", "0.59623265", "0.5945968", "0.591...
0.78923905
0
Ensure decode(encode(number)) == number over a range of numbers.
def test_inverse(self): from sosbeacon.utils import number_decode from sosbeacon.utils import number_encode for number in range(0, 500000, 339): encoded = number_encode(number) decoded = number_decode(encoded) self.assertEqual(number, decoded)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def translate_num(number, lower_bound, upper_bound):\n try:\n value = int(number, 0)\n if value < lower_bound or value > upper_bound:\n raise translate_num_out_of_range(value, lower_bound, upper_bound)\n else:\n return value\n except:\n raise translate_num_er...
[ "0.6504324", "0.6368809", "0.6153909", "0.612515", "0.5986749", "0.5916171", "0.590891", "0.58644295", "0.581968", "0.581036", "0.5799809", "0.57941693", "0.579414", "0.5778868", "0.57601947", "0.57461756", "0.5717209", "0.57090324", "0.5706868", "0.56949294", "0.5694811", ...
0.64608574
1
Ensure taskqueue.Queue.add is called exactly once.
def test_insert_batch(self, queue_mock): from sosbeacon.utils import insert_tasks tasks = [] for i in xrange(1, 10): tasks.append(object()) added = insert_tasks(tasks, 'default') self.assertEqual(added, 9)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_splits_once(self, queue_add_mock):\n from google.appengine.api import taskqueue\n from sosbeacon.utils import insert_tasks\n\n def side_effect(*args):\n if 2 in args[0]:\n raise taskqueue.TombstonedTaskError('uh oh')\n\n queue_add_mock.side_effect = si...
[ "0.6944164", "0.65657383", "0.6554443", "0.62363005", "0.6164665", "0.6146997", "0.608468", "0.6042163", "0.6031211", "0.5978489", "0.59758395", "0.5960709", "0.5934469", "0.5904743", "0.5876805", "0.58512455", "0.5846621", "0.58196574", "0.58075684", "0.58046085", "0.5796316...
0.0
-1
Ensure task batches are split and insertion is retried on TaskAlreadyExistsError.
def test_splits_once(self, queue_add_mock): from google.appengine.api import taskqueue from sosbeacon.utils import insert_tasks def side_effect(*args): if 2 in args[0]: raise taskqueue.TombstonedTaskError('uh oh') queue_add_mock.side_effect = side_effect ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_splits_on_taskexists(self, queue_add_mock):\n from google.appengine.api import taskqueue\n from sosbeacon.utils import insert_tasks\n\n queue_add_mock.side_effect = taskqueue.TaskAlreadyExistsError\n\n tasks = [i for i in xrange(0, 10)]\n added = insert_tasks(tasks, 'def...
[ "0.66691655", "0.62592685", "0.60708004", "0.6027385", "0.6026459", "0.59589094", "0.5712259", "0.5664953", "0.5624898", "0.54451364", "0.53221446", "0.5284538", "0.52741164", "0.52515495", "0.52346677", "0.52338606", "0.5233629", "0.51976675", "0.51887155", "0.5188266", "0.5...
0.62067395
2
Ensure task batches are split and insertion is retried on TombstonedTaskError.
def test_splits_on_tombstoned(self, queue_add_mock): from google.appengine.api import taskqueue from sosbeacon.utils import insert_tasks queue_add_mock.side_effect = taskqueue.TombstonedTaskError tasks = [i for i in xrange(0, 7)] added = insert_tasks(tasks, 'default') ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_no_chunk_size_no_n_splits_provided(self):\n with self.assertRaises(ValueError):\n next(chunk_tasks([]))", "def test_splits_once(self, queue_add_mock):\n from google.appengine.api import taskqueue\n from sosbeacon.utils import insert_tasks\n\n def side_effect(*args)...
[ "0.637449", "0.62774134", "0.60077596", "0.5994124", "0.5918459", "0.57265055", "0.56882507", "0.56343436", "0.558805", "0.55751175", "0.55216396", "0.55209655", "0.54577637", "0.53927845", "0.53148663", "0.53103", "0.5290059", "0.5279151", "0.5238429", "0.5230983", "0.522617...
0.6903556
0
Ensure task batches are split and insertion is retried on TaskAlreadyExistsError.
def test_splits_on_taskexists(self, queue_add_mock): from google.appengine.api import taskqueue from sosbeacon.utils import insert_tasks queue_add_mock.side_effect = taskqueue.TaskAlreadyExistsError tasks = [i for i in xrange(0, 10)] added = insert_tasks(tasks, 'default') ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_splits_on_tombstoned(self, queue_add_mock):\n from google.appengine.api import taskqueue\n from sosbeacon.utils import insert_tasks\n\n queue_add_mock.side_effect = taskqueue.TombstonedTaskError\n\n tasks = [i for i in xrange(0, 7)]\n added = insert_tasks(tasks, 'default...
[ "0.62573755", "0.620488", "0.6070838", "0.6027224", "0.6025703", "0.5959347", "0.571253", "0.5664554", "0.5623779", "0.5445145", "0.53211784", "0.5283602", "0.52729964", "0.52518106", "0.5234075", "0.5233979", "0.52330583", "0.51978356", "0.51888645", "0.518777", "0.51753086"...
0.6667976
0
Ensure a date with no hours / minutes is retuned as a date.
def test_date(self): from sosbeacon.utils import format_datetime date = datetime(year=2012, month=8, day=30) encoded = format_datetime(date) self.assertEqual('08/30/12', encoded)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def insure_date(d):\n if isinstance(d, BeautifulDate):\n return date(year=d.year, month=d.month, day=d.day)\n else:\n return d", "def fake_date_without_day(value):\n return date(year=value[0], month=value[1], day=1)", "def ensure_date(value: Union[Date, Da...
[ "0.70018554", "0.6946764", "0.685827", "0.6737637", "0.6687125", "0.66750145", "0.65934587", "0.64681107", "0.64442796", "0.6383153", "0.6327889", "0.6267114", "0.62509316", "0.6243825", "0.61947256", "0.61693084", "0.6164787", "0.61503243", "0.6149337", "0.6140435", "0.61300...
0.0
-1
Ensure a date with hours and minutes is retuned as a datetime.
def test_date_with_time(self): from sosbeacon.utils import format_datetime date = datetime(year=2012, month=8, day=30, hour=7, minute=13) encoded = format_datetime(date) self.assertEqual('08/30/12 07:13', encoded)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def ensure_datetime(ob: AnyDatetime) -> datetime.datetime:\n if isinstance(ob, datetime.datetime):\n return ob\n date = cast(datetime.date, ob)\n time = cast(datetime.time, ob)\n if isinstance(ob, datetime.date):\n time = datetime.time()\n if isinstance(ob, datetime.time):\n dat...
[ "0.7026758", "0.65030086", "0.64972097", "0.64888424", "0.6435325", "0.64127433", "0.6333002", "0.62801087", "0.6271071", "0.62366825", "0.62104833", "0.6207101", "0.61587965", "0.6086302", "0.6086026", "0.60570335", "0.6036885", "0.60081786", "0.5994509", "0.5992334", "0.598...
0.64528507
4
Ensure a date with minutes but no hours is retuned as a datetime.
def test_date_with_zero_hours(self): from sosbeacon.utils import format_datetime date = datetime(year=2012, month=8, day=30, hour=0, minute=13) encoded = format_datetime(date) self.assertEqual('08/30/12 00:13', encoded)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_date_with_zero_minutes(self):\n from sosbeacon.utils import format_datetime\n\n date = datetime(year=2012, month=8, day=30, hour=19, minute=0)\n encoded = format_datetime(date)\n self.assertEqual('08/30/12 19:00', encoded)", "def ensure_datetime(ob: AnyDatetime) -> datetime.d...
[ "0.694124", "0.6576329", "0.6497878", "0.63341737", "0.6285057", "0.60327333", "0.59235966", "0.5857965", "0.58377993", "0.5830965", "0.57997185", "0.57975805", "0.575214", "0.5735291", "0.5732054", "0.57108104", "0.5695891", "0.5693779", "0.5690543", "0.5684678", "0.56797", ...
0.64184
3
Ensure a date with hours but no minutes is retuned as a datetime.
def test_date_with_zero_minutes(self): from sosbeacon.utils import format_datetime date = datetime(year=2012, month=8, day=30, hour=19, minute=0) encoded = format_datetime(date) self.assertEqual('08/30/12 19:00', encoded)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_date_with_zero_hours(self):\n from sosbeacon.utils import format_datetime\n\n date = datetime(year=2012, month=8, day=30, hour=0, minute=13)\n encoded = format_datetime(date)\n self.assertEqual('08/30/12 00:13', encoded)", "def ensure_datetime(ob: AnyDatetime) -> datetime.dat...
[ "0.68381727", "0.6782348", "0.6598675", "0.6525046", "0.6244653", "0.6082294", "0.6023994", "0.6016812", "0.6003925", "0.59741217", "0.5968216", "0.5952586", "0.59485435", "0.5870531", "0.586283", "0.5861185", "0.58541614", "0.58484566", "0.58302844", "0.5829411", "0.5792652"...
0.6744739
2
Ensure a missing date returns the empty string.
def test_non_input(self): from sosbeacon.utils import format_datetime encoded = format_datetime(None) self.assertEqual('', encoded)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def strip_date(self, arg, line_number=0):\n try:\n dt = datetime.strptime(arg, \"%d %b %Y\")\n return dt\n except ValueError:\n raise ValueError(f\"US42 - Illegitimate date of {arg}. GEDCOM line: {line_number}\")\n else:\n return 'NA'", "def test_b...
[ "0.66881824", "0.6186882", "0.61217904", "0.61152357", "0.60820913", "0.6069122", "0.6046784", "0.60390896", "0.60354966", "0.602315", "0.59958637", "0.59915537", "0.5989876", "0.59784245", "0.5972851", "0.5956638", "0.5951182", "0.5942427", "0.59409153", "0.59297127", "0.591...
0.69573593
0
Ensure a missing lhs returns rhs.
def test_no_lhs(self): from sosbeacon.utils import get_latest_datetime lhs = None rhs = object() result = get_latest_datetime(lhs, rhs) self.assertIs(rhs, result)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_no_rhs(self):\n from sosbeacon.utils import get_latest_datetime\n\n lhs = object()\n rhs = None\n\n result = get_latest_datetime(lhs, rhs)\n\n self.assertIs(lhs, result)", "def not_equal(lhs, rhs):\n return _make.not_equal(lhs, rhs)", "def isnone(cls, lhs, rhs):\n...
[ "0.6356365", "0.56324995", "0.5260674", "0.5232673", "0.51086223", "0.5028781", "0.5027332", "0.49481612", "0.48879817", "0.4887651", "0.48581392", "0.4851787", "0.48394328", "0.48073387", "0.48042664", "0.47770894", "0.47716808", "0.4759484", "0.47486883", "0.47274226", "0.4...
0.6314329
1
Ensure a missing lhs returns rhs.
def test_no_rhs(self): from sosbeacon.utils import get_latest_datetime lhs = object() rhs = None result = get_latest_datetime(lhs, rhs) self.assertIs(lhs, result)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_no_lhs(self):\n from sosbeacon.utils import get_latest_datetime\n\n lhs = None\n rhs = object()\n\n result = get_latest_datetime(lhs, rhs)\n\n self.assertIs(rhs, result)", "def not_equal(lhs, rhs):\n return _make.not_equal(lhs, rhs)", "def isnone(cls, lhs, rhs):\n...
[ "0.6314329", "0.56324995", "0.5260674", "0.5232673", "0.51086223", "0.5028781", "0.5027332", "0.49481612", "0.48879817", "0.4887651", "0.48581392", "0.4851787", "0.48394328", "0.48073387", "0.48042664", "0.47770894", "0.47716808", "0.4759484", "0.47486883", "0.47274226", "0.4...
0.6356365
0
Ensure a missing lhs returns rhs.
def test_larger_lhs(self): from sosbeacon.utils import get_latest_datetime lhs = datetime(2012, 9, 20, 3, 45) rhs = datetime(2012, 9, 20, 2, 45) result = get_latest_datetime(lhs, rhs) self.assertIs(lhs, result)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_no_rhs(self):\n from sosbeacon.utils import get_latest_datetime\n\n lhs = object()\n rhs = None\n\n result = get_latest_datetime(lhs, rhs)\n\n self.assertIs(lhs, result)", "def test_no_lhs(self):\n from sosbeacon.utils import get_latest_datetime\n\n lhs =...
[ "0.6356365", "0.6314329", "0.56324995", "0.5260674", "0.5232673", "0.51086223", "0.5028781", "0.5027332", "0.49481612", "0.48879817", "0.4887651", "0.48581392", "0.4851787", "0.48394328", "0.48073387", "0.48042664", "0.47770894", "0.47716808", "0.4759484", "0.47486883", "0.47...
0.0
-1
Ensure a missing lhs returns rhs.
def test_larger_rhs(self): from sosbeacon.utils import get_latest_datetime lhs = datetime(2012, 9, 20, 2, 59) rhs = datetime(2012, 9, 20, 3, 00) result = get_latest_datetime(lhs, rhs) self.assertIs(rhs, result)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_no_rhs(self):\n from sosbeacon.utils import get_latest_datetime\n\n lhs = object()\n rhs = None\n\n result = get_latest_datetime(lhs, rhs)\n\n self.assertIs(lhs, result)", "def test_no_lhs(self):\n from sosbeacon.utils import get_latest_datetime\n\n lhs =...
[ "0.6356365", "0.6314329", "0.56324995", "0.5260674", "0.5232673", "0.51086223", "0.5028781", "0.5027332", "0.49481612", "0.48879817", "0.4887651", "0.48581392", "0.4851787", "0.48394328", "0.48073387", "0.48042664", "0.47770894", "0.47716808", "0.4759484", "0.47486883", "0.47...
0.0
-1
Ensure a missing lhs returns rhs.
def test_equal_inputs(self): from sosbeacon.utils import get_latest_datetime lhs = rhs = datetime(2012, 9, 20, 2, 59) result = get_latest_datetime(lhs, rhs) self.assertIs(rhs, result) self.assertIs(lhs, result)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_no_rhs(self):\n from sosbeacon.utils import get_latest_datetime\n\n lhs = object()\n rhs = None\n\n result = get_latest_datetime(lhs, rhs)\n\n self.assertIs(lhs, result)", "def test_no_lhs(self):\n from sosbeacon.utils import get_latest_datetime\n\n lhs =...
[ "0.6356365", "0.6314329", "0.56324995", "0.5260674", "0.5232673", "0.51086223", "0.5028781", "0.5027332", "0.49481612", "0.48879817", "0.4887651", "0.48581392", "0.4851787", "0.48394328", "0.48073387", "0.48042664", "0.47770894", "0.47716808", "0.4759484", "0.47486883", "0.47...
0.0
-1
Create a heatmap from a numpy array and two lists of labels.
def heatmap(data, row_labels, col_labels, ax=None, cbar_kw={}, cbarlabel="", **kwargs): if not ax: ax = plt.gca() # Plot the heatmap im = ax.imshow(data, **kwargs) # Create colorbar cbar = ax.figure.colorbar(im, ax=ax, **cbar_kw) cbar.ax.set_ylabel(cbarlabel, rotation=-90, va="bottom"...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def heatmap(data, row_labels, col_labels, ax=None,\r\n cbar_kw={}, cbarlabel=\"\", title = \"Default\", x_title=\" \",y_title=\" \",saveFile = None, **kwargs):", "def heatmap(data, row_labels, col_labels, ax=None, cbar_kw={}, cbarlabel=\"\", **kwargs):\r\n\r\n if not ax:\r\n ax = plt.gca()\r...
[ "0.6765666", "0.6746936", "0.6712045", "0.6677427", "0.6677427", "0.6677427", "0.66198003", "0.66069126", "0.65382963", "0.6534117", "0.6513789", "0.6497601", "0.64536047", "0.6449943", "0.6434751", "0.63585454", "0.63225764", "0.62491506", "0.6228405", "0.6213863", "0.617980...
0.6688963
3
A method to open and parse UniProt according to their keywords. Similar to what was done in Ata et al. 2018.
def parse_records(self): for record in sp.parse(gzip.open( "./human_uniprot_04_07_20.gz", 'rt')): # print(record.taxonomy_id) # if record.organism != "Homo sapiens": # continue # print(record.features[0]) # for comment in record.com...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def uniprot_txt_parser(uniprot_txt_lines):\n uniprot = {}\n entry_line = [i for i,l in enumerate(uniprot_txt_lines) if l[:2]=='ID']\n entry_line.append(len(uniprot_txt_lines))\n begin_end = [(begin,entry_line[i+1]) for i,begin in enumerate(entry_line[:-1])]\n for begin,end in begin_end:\n for...
[ "0.58220077", "0.5802064", "0.57448256", "0.54425025", "0.5314302", "0.52784765", "0.5223711", "0.51647186", "0.51590455", "0.5118437", "0.51034755", "0.5095762", "0.5017907", "0.50099504", "0.49973136", "0.49962452", "0.49901965", "0.4973686", "0.49708888", "0.4963419", "0.4...
0.4876919
33
Input totally data frame then output daily data frame.
def get_increased_data(input_data_frame): desc_data = input_data_frame.iloc[:, ::-1] for index, col in desc_data.iteritems(): desc_data[index] = desc_data[index] - desc_data[index - 1] if index == 2: asc_data = desc_data.iloc[:, ::-1] return asc_data
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def output_daily_files(dataframe, path, filename):\n\n days = dataframe.groupby('date_time_day')\n dataframe.groupby('date_time_day').size().reset_index(name='data points per day')\n\n for day in days.groups:\n print(day.date())\n output_path = path + filename + \"_\" + str(day.date()) + '.c...
[ "0.65267056", "0.62918127", "0.62888753", "0.62433565", "0.6169422", "0.61276734", "0.6091886", "0.609138", "0.60746336", "0.6005586", "0.6000989", "0.59937394", "0.59874874", "0.59397405", "0.59353983", "0.5922037", "0.5900342", "0.589187", "0.5853567", "0.58485276", "0.5825...
0.0
-1
Returns the ROS time in seconds
def get_time(cls): now = rospy.Time.now() return now.secs + now.nsecs*(10**-9) # time in seconds
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def gettime():\n return libruss.russ_gettime()", "def get_time(self):\n return self.get_timed() / 10.0", "def _current_time_seconds(self):\n return int(round(time.time()))", "def currentTimeSecs():\n return time.time()", "def get_time(self) -> float:\n self.rocket.update()\n ...
[ "0.75012565", "0.72696334", "0.704129", "0.704039", "0.70382655", "0.69805497", "0.6978949", "0.6969247", "0.69403255", "0.69107735", "0.6896041", "0.6878848", "0.685984", "0.67993206", "0.67879426", "0.6787236", "0.67727417", "0.6743631", "0.6704049", "0.6703564", "0.6699629...
0.7948383
0
Creates the log directories for the runs and saves initial run info
def instantiate_logs(self): # Log file timestamp = datetime.now().strftime("%Y-%m-%dT%H%M%S") self.log_dir = os.path.join("experiment_logs", timestamp) # Create Log directory if it does not exist try: os.makedirs(self.log_dir) except OSError as exception: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _setup_dir(self):\n if not os.path.exists(self._save_dir):\n logger.info(\"save_dir {} does not exist, \"\n \"creating it\".format(self._save_dir))\n os.makedirs(self._save_dir)\n\n # Log the run parameters.\n logger.info(\"Writing logs to {}\"....
[ "0.7466747", "0.7157217", "0.70655835", "0.69699013", "0.69102144", "0.6875181", "0.6774886", "0.67428565", "0.6716854", "0.6689758", "0.66799164", "0.6649505", "0.6647565", "0.6583148", "0.6562383", "0.6534038", "0.6531846", "0.65123534", "0.6502982", "0.64945877", "0.648349...
0.7053942
3
Sends the goal vehicle pose to the simulator
def pub_goal_vehicle_pose(self): header = Header() header.stamp = rospy.Time.now() position = Point(20.5, -10, -85) # position = Point(20.5, -10, -85) yaw = pi # Converting yaw to quaternion # See https://en.wikipedia.org/wiki/Conversion_between_quaternions_and...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def send_destination(self):\n\n print('send the target to the robot')\n move_base_action_goal=MoveBaseActionGoal()\n move_base_action_goal.goal.target_pose.header.frame_id=\"map\"\n move_base_action_goal.goal.target_pose.pose.orientation.w=1\n move_base_action_goal.goal.target_po...
[ "0.6900186", "0.6846976", "0.6781664", "0.6722921", "0.6500318", "0.647756", "0.641095", "0.63947874", "0.6390289", "0.6380875", "0.6371278", "0.6319203", "0.61569244", "0.6111631", "0.60957015", "0.6094904", "0.6075576", "0.6063163", "0.6058459", "0.60555637", "0.6015337", ...
0.74411386
0
Sends a command to the ros service to update ocean currents based on vehicle position
def update_current(self): velocity, horizontal_angle, vertical_angle = self.current_function() self.set_current_velocity(velocity, horizontal_angle, vertical_angle)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def execute(self):\n self._odom_msg.header.stamp = rospy.Time.now()\n # query base state from robot and store in odom msg\n position, orientation, linear_velocity, angular_velocity = self._robot.get_base_state()\n [self._odom_msg.pose.pose.position.x,\n self._odom_msg.pose.pose....
[ "0.64087474", "0.61778766", "0.60122633", "0.5960585", "0.5868954", "0.58094513", "0.5795152", "0.5743932", "0.56760687", "0.56449115", "0.5635973", "0.5577554", "0.5568342", "0.5534826", "0.5531178", "0.55111843", "0.5509245", "0.5506559", "0.5487788", "0.5474574", "0.546183...
0.0
-1
A simple timevarying current field in the x direction based on a sinusoid.
def sinusoid_current(self): t = self.get_time() # time in seconds offset_time = t - self.start_time - self.delay_time # time offset by start/delay time # Don't start the currents until t > start + 10 if t < self.start_time + self.delay_time: print("Waiting for delay time to...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get(self, x):\r\n f = math.sin(self.phase_offset + self.angular_frequency*x)\r\n return self.amplitude_offset + self.amplitude*f", "def tsx(self):\n\n self.x = self.sp\n self.set_zn(self.x)", "def position(t, x, y):\n return x * exp(-t * y) * sin(2 * pi * t)", "def update(s...
[ "0.6198477", "0.6151556", "0.6098946", "0.5898149", "0.5895894", "0.5881547", "0.5811019", "0.57994246", "0.57935405", "0.5681556", "0.5660104", "0.5616797", "0.5612879", "0.56064534", "0.55949235", "0.5590392", "0.5557532", "0.5556586", "0.55441815", "0.5528075", "0.552043",...
0.627386
0
Generate prime values using sieve of Eratosthenes method.
def create_primes(threshold): if threshold == 2: return [2] elif threshold < 2: return [] numbers = list(range(3, threshold + 1, 2)) root_of_threshold = threshold**0.5 half = int((threshold + 1) / 2 - 1) idx = 0 counter = 3 while counter <= root_of_threshold: if...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def EratosthenesSieve(N):\n numbers = [True] * (N+1)\n max_p = int(math.sqrt(N))\n for p in (i for i in range(2, max_p+1) if numbers[i]):\n for q in range(p*p, N+1, p):\n numbers[q] = False\n return [i for i in range(2, N+1) if numbers[i]]", "def EratosthenesSieve(N):\n numbers =...
[ "0.7907143", "0.7902661", "0.7900705", "0.7870067", "0.786426", "0.7795188", "0.77421093", "0.7724749", "0.76443654", "0.7612922", "0.758561", "0.7580121", "0.75798064", "0.75734884", "0.7526076", "0.74892634", "0.7484998", "0.7456353", "0.74515086", "0.7430674", "0.7415825",...
0.0
-1
Calculate the distance in km between two points given in decimal degrees. Uses Haversine formula, i.e. assuming perfectly spherical earth
def Distance(VCoords, SCoords): #Convert to radians lat1,lon1,lat2,lon2 = map(math.radians, VCoords+SCoords) #Apply Haversine formula dlon = lon2-lon1 dlat = lat2-lat1 a = math.sin(dlat/2)**2 + math.cos(lat1) * math.cos(lat2) * math.sin(dlon/2)**2 c = 2 * math.asin(math.sqrt(a)) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def haversine(lat1, lon1, lat2, lon2):\n\t\t # convert decimal degrees to radians \n\t\t lon1, lat1, lon2, lat2 = map(radians, [lon1, lat1, lon2, lat2])\n\t\t # haversine formula \n\t\t dlon = lon2 - lon1 \n\t\t dlat = lat2 - lat1 \n\t\t a = sin(dlat/2)**2 + cos(lat1) * cos(lat2) * sin(dlon/2)**2...
[ "0.7997606", "0.79383963", "0.7895904", "0.78638697", "0.7796029", "0.77701026", "0.77680063", "0.77678233", "0.77571", "0.7750529", "0.7741123", "0.77320206", "0.7727604", "0.7691649", "0.7687481", "0.76833457", "0.7681609", "0.7681609", "0.7670106", "0.7646074", "0.76412785...
0.0
-1
Sorts a list of tuples based on the first value in each.
def SortTupleList(TupleList): SortedList = [] for i in range(0, len(TupleList)): Pivot = len(SortedList) / 2 while TupleList[i] < SortedList(Pivot): pass
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sort_list_of_tuples(list):\n list.sort(key=lambda x: x[0])\n return list", "def tupleListSort(tupleList):\n tupleList.sort(key=lambda y: y[0].lower())", "def sort_fst(xs):\n return sorted(xs, key=lambda pair: pair[0])", "def sort_prices(list_of_tuples):\n list_of_tuples.sort(key = get_pric...
[ "0.85222363", "0.7436253", "0.7205574", "0.7185881", "0.7109334", "0.70277673", "0.6577772", "0.6568136", "0.6405855", "0.6328426", "0.6323056", "0.63180023", "0.6280642", "0.6245652", "0.6225239", "0.6207625", "0.61590034", "0.6151864", "0.6146145", "0.61375666", "0.60629576...
0.6534301
8
Check if uuid_to_test is a valid UUID.
def is_valid_uuid(uuid_to_test, version=4): try: uuid_obj = UUID(uuid_to_test, version=version) except ValueError: return False return str(uuid_obj) == uuid_to_test
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_valid_uuid(uuid_to_test, version=4):\n\ttry:\n\t\tuuid_obj = UUID(uuid_to_test, version=version)\n\t\treturn True\n\texcept:\n\t\treturn False", "def check_uuid(uuid):\n try:\n converted = UUID(uuid, version=4)\n except ValueError:\n return False\n\n return str(converted) == uuid", ...
[ "0.8684954", "0.8333081", "0.8155957", "0.80367714", "0.8028158", "0.79428333", "0.77374667", "0.7734152", "0.7734152", "0.76239145", "0.7593849", "0.7555792", "0.7149705", "0.71090436", "0.69526494", "0.6922901", "0.66879606", "0.66867393", "0.66619414", "0.6655981", "0.6640...
0.8562131
1
return parsed file info file_name should be a string with full path to file
def file_info(file_name, file_pattern): match = re.compile(file_pattern).match(file_name) if match: basepath = match.group('basepath') sensor = match.group('sensor') ax = match.group('ax') freq = match.group('freq') date = match.group('date') return basepath, sens...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _extract_file_info(directory, root_path, name):\n file_path = join(directory, name)\n rel_path = relpath(file_path, root_path)\n return {\n \"name\": name,\n \"path\": file_path,\n \"dir_name\": dirname(file_path),\n \"is_file\": isfile(file_path),\n \"is_dir\": isdi...
[ "0.70860726", "0.7010818", "0.6978658", "0.69049", "0.68632764", "0.66971594", "0.6577073", "0.64977664", "0.64931035", "0.64348495", "0.6431073", "0.6293928", "0.6288821", "0.6240199", "0.623606", "0.61522275", "0.61236763", "0.6095241", "0.607708", "0.60727507", "0.6071609"...
0.71029544
0
Bug 1660259 Correct nav arialabel and label and description for theme buttons, part {index}.
def migrate(ctx): ctx.add_transforms( "browser/browser/newtab/onboarding.ftl", "browser/browser/newtab/onboarding.ftl", transforms_from(""" onboarding-multistage-theme-tooltip-automatic-2 = .title = { COPY_PATTERN(from_path, "onboarding-multistage-theme-tooltip-automatic.title") } onboar...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _get_button_label(self,index):\r\n self.l_debug(\"_get_button_label\",\"index=%d\" % (index))\r\n # TODO: Make sure it's a valid index?\r\n return self.parent.harmony_config['info']['functions'][index]['label']", "def change_back_alphabet_button(event):\n img_alphabet_button_mouse...
[ "0.59079456", "0.57021827", "0.5611441", "0.5596499", "0.5464772", "0.5462852", "0.54272836", "0.5413362", "0.5381082", "0.53032327", "0.5299294", "0.5295865", "0.52915895", "0.5270703", "0.5253295", "0.5223281", "0.52090263", "0.517131", "0.5170982", "0.5129802", "0.512315",...
0.0
-1
Gets a list of machine proxy objects for machines registered on the server.
def list_services(self): response = self._get() services = [] for s in response["services"]: services.append(_create_service_from_json(s, self._session, self._url_base, s["folderName"])) return services
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _GetMachineList(self):\n machines = self._experiment.remote\n # All Label.remote is a sublist of experiment.remote.\n for l in self._experiment.labels:\n for r in l.remote:\n assert r in machines\n return machines", "def get_machines(self):\n\n return self._machine_manager.get_...
[ "0.6875486", "0.6869549", "0.6537448", "0.6433981", "0.6399903", "0.637255", "0.6364685", "0.6354067", "0.63194156", "0.6291957", "0.62829745", "0.6226571", "0.6222153", "0.6200053", "0.6157794", "0.6109501", "0.6103711", "0.60903883", "0.6048954", "0.60453343", "0.59695596",...
0.0
-1
helper to return all possible splits this function returns all the possible splits on the given attribute on the provided dataframe
def get_possible_splits( df , attribute ): ds = df.loc[:,attribute] # First sort the values ds = ds.sort_values().drop_duplicates() # Compute averages of consecutive values ds = ds.rolling(2).sum().divide(2) splits = ds[1:].tolist() # return the possible splits return s...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def splitBy(data, attribute_id):\n \n col = getColumn(data, attribute_id)\n values = set(col)\n split_data = [] \n for i in values:\n subset = [row for row in data if row[attribute_id] == i]\n split_data.append(subset)\n \n return split_data", "def generate_splits( records, i...
[ "0.6871864", "0.6392091", "0.62676346", "0.60429597", "0.60380805", "0.603773", "0.5964825", "0.5956346", "0.5944079", "0.5930761", "0.58742964", "0.58675", "0.5851564", "0.5841597", "0.5820882", "0.5810458", "0.5741932", "0.573894", "0.57379395", "0.5715522", "0.57015127", ...
0.81955785
0
helper function to evaluate gini value for the split This function gives Gini Value for the split generated by 'split' on 'attribute' in the given dataframe
def evaluate_split( df, attribute, split ): mask = df[attribute] <= split # split the dataset on the split attribute dfl = df[mask] dfr = df[~mask] # calculate weighting factors for child weighting_factor_left = float(dfl.shape[0])/df.shape[0] weighting_factor_right = float(dfr...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def calcGiniSplitBySplitValue(self, data, structure, colIndex, splitValue):\n dataBellow = list(filter(lambda x: float(x[colIndex]) <= splitValue, data))\n dataAbove = list(filter(lambda x: float(x[colIndex]) > splitValue, data))\n giniSplit = (len(dataBellow) / len(data)) * self.calcDataGini(...
[ "0.6597128", "0.6406698", "0.62779886", "0.6191937", "0.567172", "0.5599756", "0.5579262", "0.5560474", "0.53938425", "0.5372687", "0.5327218", "0.5243013", "0.5231648", "0.52305394", "0.50356853", "0.5020019", "0.49910983", "0.49304187", "0.49144533", "0.4894045", "0.4893178...
0.77684784
0
Write a decorator that prints UPPER_SLICE and LOWER_SLICE before and after calling the function (func) that is passed in ( is to preserve the original func's docstring)
def sandwich(func): @functools.wraps(func) def wrapped_decorator(*args, **kwargs): print(UPPER_SLICE) arguments= func(*args, **kwargs) print(LOWER_SLICE) return arguments return wrapped_decorator
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_wraps():\n print('func')", "def trace(func):\n @wraps(func)\n def tracer(*args, **kwargs):\n name = func.__name__\n stack_size = int(len(inspect.stack(0)) / 2) # @wraps(func) is also increasing the size\n indent = stack_size*'\\t'\n print(f'{indent} > Entering \"{nam...
[ "0.59775233", "0.59042966", "0.58600795", "0.58352566", "0.58184", "0.5748021", "0.5739565", "0.5706729", "0.56139064", "0.55796224", "0.5578859", "0.5534652", "0.5532867", "0.5523652", "0.55230683", "0.55105054", "0.54960775", "0.5491101", "0.5476996", "0.54521424", "0.54212...
0.8172087
0
Generates graph of connected peers Change to make this customisable
def generate_graph(self): temp_graph = [[] for i in xrange(Parameters.num_peers)] unconnected = set([i for i in xrange(Parameters.num_peers)]) while len(unconnected) > 1: node1 = random.sample(unconnected, 1)[0] unconnected.remove(node1) node2 = random.sample(unconnected, 1)[0] temp_...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def chain_graph(self) -> nx.DiGraph:\n edg_lst = [\n (f\"p{idx}\", f\"p{idx+1}\", self.d[f\"p{idx+1}\"]) for idx in range(self.n)\n ]\n chain_graph = nx.DiGraph()\n chain_graph.add_weighted_edges_from(edg_lst)\n return chain_graph", "def chain_graph(self) -> nx.DiGra...
[ "0.62271756", "0.61608636", "0.5960585", "0.58688587", "0.5849908", "0.5812597", "0.57896066", "0.57523227", "0.5716475", "0.57021713", "0.56578314", "0.56416863", "0.56310755", "0.56212884", "0.56085145", "0.5589877", "0.5569081", "0.5566458", "0.55554277", "0.5497438", "0.5...
0.6303654
0
Start thread for each peer
def start_peers(self): for i in self.nodes: i.start()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def peer_server(self):\n try:\n listener_thread = threading.Thread(target=self.peer_server_listener)\n listener_thread.setDaemon(True)\n\n operations_thread = threading.Thread(target=self.peer_server_host)\n operations_thread.setDaemon(True)\n\n listene...
[ "0.67120516", "0.65352994", "0.649779", "0.64329314", "0.6382283", "0.62863195", "0.6221034", "0.62145627", "0.6192615", "0.6154389", "0.61105305", "0.60992175", "0.6057519", "0.6056828", "0.60463715", "0.60429364", "0.6019063", "0.5967418", "0.59653294", "0.595958", "0.59562...
0.7830526
0
Get the network delay between pid1 and pid2
def get_delay(self, pid1, pid2, is_block): is_slow = self.node_is_slow[pid1] or self.node_is_slow[pid2] p = random.uniform(Parameters.p_min, Parameters.p_max) c = Parameters.c_low if is_slow else Parameters.c_high m = Parameters.m if is_block else 0 d = random.expovariate(c / Parameters.d) retur...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getTimeDelay(*args):\n return args[0].TimeState.TimeDelay.time_delay", "def get_delay(self, src, dst):\n try:\n fwd_delay = self.awareness.graph[src][dst]['lldpdelay']\n re_delay = self.awareness.graph[dst][src]['lldpdelay']\n src_latency = self.echo_latency[src]\n ...
[ "0.60461235", "0.59016067", "0.586062", "0.56952107", "0.55916893", "0.55790615", "0.55780035", "0.5559182", "0.554915", "0.5509043", "0.5487633", "0.5454966", "0.53850937", "0.53481144", "0.5299796", "0.5299796", "0.52713627", "0.5267619", "0.52288824", "0.52207476", "0.5209...
0.75615823
0
Adds a meta file to database.
def add_meta_f_to_db(meta_f, p, dbi): rism_attributes = sd.Water3DRISM.__dict__.keys() extra_attributes = sd.Water3DRISMExtra.__dict__.keys() with open(os.path.join(p, meta_f), 'rb') as f: txt = f.readlines() inchi_line = txt[0] if inchi_line.startswith('InChI'): print inchi_line ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __appendMetaData(self, filename):\n metadata = {'Model': 'LFM',\n 'Source': filename,\n 'Date processed': datetime.datetime.now(),\n 'Start date': self.startDate\n }\n \n self.data.append(key='meta',\n ...
[ "0.68102056", "0.67017496", "0.6549066", "0.65284264", "0.64970475", "0.6281541", "0.62121874", "0.61612666", "0.61489415", "0.6141335", "0.60017574", "0.5996768", "0.5930677", "0.59127736", "0.5901605", "0.5892127", "0.58494866", "0.5829368", "0.5819864", "0.58169425", "0.57...
0.6100383
10
This is the main function of the program
def main(): global FPSCLOCK, DISPLAYSURF, BASICFONT pygame.init() FPSCLOCK = pygame.time.Clock() # set up the window BASICFONT = pygame.font.Font('freesansbold.ttf', 20) DISPLAYSURF = pygame.display.set_mode((WINDOWWIDTH, WINDOWHEIGHT), 0, 32) pygame.display.set_caption('Othello') DISPLAYSURF.fill(BGCOLOR) #In...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def main():", "def main():", "def main():", "def main():", "def main():", "def main():", "def main():", "def main():", "def main():", "def main():", "def main():", "def main():", "def main():", "def main():", "def main():", "def main():", "def main():", "def main():", "def main(...
[ "0.9220979", "0.9220979", "0.9220979", "0.9220979", "0.9220979", "0.9220979", "0.9220979", "0.9220979", "0.9220979", "0.9220979", "0.9220979", "0.9220979", "0.9220979", "0.9220979", "0.9220979", "0.9220979", "0.9220979", "0.9220979", "0.9220979", "0.9220979", "0.9220979", "...
0.0
-1
This is the method that draws the game board
def drawBoard(): #draw 64 Rectangles from (MARGINH,MARGINV) with CASESIZE sizes for i in range(BOARDSIZE): for j in range(BOARDSIZE): pygame.draw.rect(DISPLAYSURF, BLACK, [MARGINH + (i)*CASESIZE, MARGINV + (j)*CASESIZE, CASESIZE, CASESIZE], 1)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def drawBoard(self):\r\n \r\n for i in range(8):\r\n for j in range(8):\r\n if (i %2 == 0 and j % 2 == 0) or (i % 2 !=0 and j % 2 != 0):\r\n COLOR = COLOR1\r\n else: COLOR = COLOR2\r\n pygame.draw.rect(screen, COLOR, Rect(i*50...
[ "0.83789307", "0.83610886", "0.8352866", "0.82823396", "0.8200601", "0.81451064", "0.8119161", "0.81146264", "0.7879229", "0.7845098", "0.7784387", "0.77669483", "0.7705313", "0.7694651", "0.763012", "0.7628809", "0.7627039", "0.76243454", "0.76111424", "0.75869983", "0.75507...
0.79026276
8
This method draws a piece of the right color at the right position.
def drawPiece(pos,color): if color == 0: color_piece = BGCOLOR elif color == 1: color_piece = BLACK elif color == 2: color_piece = WHITE elif color == 3: color_piece = LIGHTGREEN #draws a circle of the right color on the board pygame.draw.ellipse(DISPLAYSURF, color_piece, [MARGINH + (pos[0]-1)*CASESIZE+4,...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _draw_square(self, left_x, top_y, side, color, fill):\n self.pen.up()\n self.pen.color(color)\n self.pen.goto(left_x, top_y)\n self.pen.down()\n self.pen.begin_fill()\n for _ in range(4):\n self.pen.forward(side)\n self.pen.right(90)\n self...
[ "0.6624936", "0.65994567", "0.65606534", "0.6394199", "0.63757133", "0.6260754", "0.6213263", "0.62062967", "0.6189885", "0.6115182", "0.60815096", "0.60737467", "0.60621893", "0.6014855", "0.6011095", "0.59758043", "0.5940978", "0.5921333", "0.59145665", "0.5895593", "0.5887...
0.62434816
6
This function takes a mouse position and returns the position of the box the click is in or an empty tuple if it is not in the board
def isInBoard(posx, posy): #is pos in the board if posx >= MARGINH and posx <= MARGINH + (BOARDSIZE)*CASESIZE and posy >= MARGINV and posy <= MARGINV + (BOARDSIZE)*CASESIZE: #transform it in case coordinates casex = int((posx - MARGINH)/CASESIZE) + 1 casey = int((posy - MARGINV)/CASESIZE) + 1 return (casex,ca...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def mouse_on_grid(self):\n if self.mousePos[0] < grid_pos[0] or self.mousePos[1] < grid_pos[1]:\n return None\n if self.mousePos[0] > grid_pos[0] + grid_size or self.mousePos[1] > grid_pos[1] + grid_size:\n return None\n temp = (self.mousePos[0] - grid_pos[0]\n ...
[ "0.69800913", "0.69175345", "0.6895727", "0.6853113", "0.6841856", "0.68141514", "0.671112", "0.6637405", "0.66198343", "0.65802467", "0.6531164", "0.64707327", "0.64676", "0.64114225", "0.63978434", "0.6394438", "0.6353023", "0.6344379", "0.6328014", "0.6309418", "0.6291824"...
0.58239156
51
This function makes the move on the state_board
def make(self,state_board): state_board[self.column][self.line] = self.couleur #place the piece drawPiece((self.column,self.line),self.couleur) #draws it on the board for pos in self.flips: #flips all the pieces in flips state_board[pos[0]][pos[1]] = self.couleur drawPiece(pos,self.couleur) #draws it on the...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def move(self, state):\n raise NotImplementedError(\"Need to implement this method\")", "def move(self, board):\n # first, make your turn:\n currentState = board[self.x,self.y]\n turnDir = self.rule[(currentState + 1) % len(self.rule)]\n self.turn( int(turnDir) )\n # nex...
[ "0.7646966", "0.75079894", "0.74252313", "0.72777075", "0.7197312", "0.7128416", "0.71194434", "0.70886326", "0.7026608", "0.70223653", "0.7015145", "0.6997819", "0.69861656", "0.69759107", "0.69399935", "0.693564", "0.6930939", "0.6925819", "0.6908902", "0.68981934", "0.6890...
0.6485864
73
This function defines the inital board of the game
def init_board(): # Generates a table 10*10 of 0s with -1 around and the initial state # of the board with 2 whites and 2 blacks in the middle table = [[0 if i != 0 and i != 9 else -1 for i in range(10)] if j != 0 and j != 9 else [-1 for i in range(10)] for j in range(10)] #leaves a -1 line around the whole table of...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def initBoard(self):\n pass", "def initialize_board(self):\n self.board = np.zeros(shape=(BOARD_SIZE, BOARD_SIZE), dtype=np.int) # another way of defining board: [[for x in range(cm.BOARD_SIZE)] for x in range(cm.BOARD_SIZE)]\n center = int(BOARD_SIZE / 2)\n self.board[center-1][cen...
[ "0.84164816", "0.81662166", "0.7968856", "0.77619267", "0.7733716", "0.77081436", "0.7704614", "0.7676403", "0.75649804", "0.75117373", "0.75034124", "0.7497264", "0.7476524", "0.7459026", "0.74174595", "0.7414584", "0.738848", "0.73879623", "0.73621136", "0.73618233", "0.734...
0.83401465
1
This function finds possibilities for a player on a board
def possible(state_board,turn): legal_moves = [] # list of legal moves as Move objects for i in range(1,9): for j in range(1,9): if state_board[i][j] == 0: if flipper([i,j],turn,state_board) != []: # if there are flipped pieces, it appends this move to # the legal moves and draws it in light greens...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def possibilities(board):\n return board[np.where(board == 0)]", "def _check_winning_combinations(board, player):\n winning_combinations = (\n ((0, 0), (0, 1), (0, 2)),\n ((1, 0), (1, 1), (1, 2)),\n ((2, 0), (2, 1), (2, 2)),\n ((0, 0), (1, 0), (2, 0)),\n ((0, 1), (1, 1), ...
[ "0.70995724", "0.68939847", "0.6879628", "0.6865679", "0.6784905", "0.67557615", "0.6732344", "0.6731795", "0.6702802", "0.6696928", "0.6610854", "0.6586503", "0.6561319", "0.6559989", "0.6543688", "0.6528893", "0.6524956", "0.65147173", "0.6503424", "0.6475118", "0.64386654"...
0.6201891
58
This function finds the flipped pieces and returns them
def flipper(pos, coul, state_board): tflips = [] for i in range(-1,2): # -1 to 1 for j in range(-1,2): #-1 to 1 for k in range(1,9): # 1 to 8 if state_board[pos[0]+i*k][pos[1]+j*k] == 0 or state_board[pos[0]+i*k][pos[1]+j*k] == -1: # if the case is empty or out of bounds break; elif state_board[pos[...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_flip_piece():\n board = Board(640, 640, 8)\n board.start_game()\n board.gm.flip_pieces = [(3, 3)]\n current_color = board.game_pieces[3][3].color\n board.flip_pieces()\n assert board.game_pieces[3][3].color != current_color\n \n board.gm.flip_pieces = [(3, 4)]\n current_color = b...
[ "0.6014114", "0.58825684", "0.56461775", "0.556043", "0.5503755", "0.54604626", "0.5395813", "0.53947204", "0.5389461", "0.53884953", "0.53873485", "0.5317875", "0.52953404", "0.5292987", "0.52406585", "0.52359927", "0.5230201", "0.5228546", "0.52233607", "0.5223231", "0.5212...
0.64342684
0
This function tests a board for a winner and returns a value between 0 and 5
def test_winner(state_board): res = 3 #default value is tie game ptsb = 0 #points for the black ptsw = 0 #points for the white #looks in the board if there is an empty case while # counting the number of points for each player for i in state_board: for j in i: if j == 0: res = 0 elif j == 1: pts...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def evaluate(board):\n winner = 0\n for player in [1, 2]:\n if row_win(board, player) or col_win(board, player) or diag_win(board, player):\n winner = player\n \n if np.all(board != 0) and winner == 0:\n winner = -1\n return winner", "def utility(board):\n win =...
[ "0.8226638", "0.7735134", "0.7697947", "0.7688143", "0.76567584", "0.7635804", "0.7614953", "0.76082647", "0.76045525", "0.7571411", "0.7569988", "0.7560676", "0.7552569", "0.7549131", "0.7542866", "0.75107414", "0.7508619", "0.75054234", "0.7480221", "0.7479761", "0.747914",...
0.76951003
3
This function counts the points and returns
def count_points(p1,p2): if p1 > p2: drawWinner(1) return 1 elif p2 > p1: drawWinner(2) return 2 else: drawWinner(3) return 3
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def Points_Counting(self):\n return len(self.__traectory_list)", "def nr_points(self):\n return len(self.x)", "def count():", "def countPoints(self,sumation):\n if sumation == 21:\n points = 7\n elif sumation == 20:\n points = 5\n elif sumation == 19:\...
[ "0.74205756", "0.71399736", "0.71250033", "0.70320505", "0.6990405", "0.69521356", "0.6948015", "0.6936048", "0.68467045", "0.68396676", "0.66850936", "0.66713077", "0.65779823", "0.6508164", "0.64867896", "0.64867896", "0.64867896", "0.64867896", "0.6444945", "0.64027125", "...
0.7081302
3
This method says who is the winner on top of the board
def drawWinner(result): # determines who is the winner from the result if result == 1: text = "Black player is the winner !" elif result == 2: text = "White player is the winner !" else: text = "Tie Game !" #draws the text as in a surface winner_surf = BASICFONT.render(text, True, BLACK) winner_rect = w...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def winner(board):\n\t#For X\n\tiswinnerX = winnerForPlayer(board, X)\n\tiswinnerO = winnerForPlayer(board, O)\n\n\tif iswinnerX:\n\t\treturn X\n\tif iswinnerO:\n\t\treturn O\n\n\treturn None", "def determine_winner1(self): \r\n sorted_player_rank = self._rank()\r\n print(f\"sorted player rank: ...
[ "0.7595406", "0.7561998", "0.75591666", "0.7541609", "0.7517451", "0.75065154", "0.75041556", "0.74950504", "0.74286133", "0.7426717", "0.7375604", "0.7375604", "0.7337236", "0.72708327", "0.7246243", "0.7231121", "0.72244394", "0.7210622", "0.72083884", "0.71932673", "0.7186...
0.0
-1
Extract ngram feature for single dataStr
def __processSingleInstance(self, dataStr): rsltList = [self.__depdData.GetDependName(d) \ for d in self.__depdData.SplitDenpStr(dataStr)] return rsltList
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def extract(self, document):\n f_num = len(self.feature_list)\n feature_vector = np.zeros((f_num,))\n words = document.split()\n for i in xrange(len(words)):\n for n in self.ns:\n ngram = self.try_get_ngram(words, n, i)\n if ngram and ngram in se...
[ "0.6531941", "0.6494894", "0.63788724", "0.61673313", "0.6166521", "0.6000876", "0.59034157", "0.5884168", "0.58563024", "0.57961416", "0.57676554", "0.57167673", "0.5701004", "0.5696321", "0.56779176", "0.56565773", "0.5656345", "0.5622813", "0.5619041", "0.5607017", "0.5584...
0.0
-1
Extract POS ngram feature from tree dict
def ExtractFeatureOnCorpus(self, dataDict): wd = WritingData.GetInstance() # Step 1. First pass scan to get sorted vocab vocab = {} # POS vocab classSet = set() classColStr = "Nationality" numWrt = 0 for wrtId in dataDict.keys(): # wrtId (int) classVal = wd.GetValueByWid(wrtId, classColStr) # cl...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def filter_tree(tree):\n return find_noun(tree)\n\n # noun_phrase = re.match(\"NP|WHNP\", tree.parent().label())\n # noun = re.match(\"NN.*\", tree.label())\n # return noun_phrase and noun", "def feat_dict(pos_feat,text):\n dict = {}\n bigrams = ngrams(word_tokenize(text),2)\n ...
[ "0.6383279", "0.6254126", "0.61910975", "0.6125874", "0.5859489", "0.576097", "0.5751471", "0.57465875", "0.5686106", "0.5654718", "0.5606234", "0.55766785", "0.5484626", "0.54041994", "0.5392085", "0.53891397", "0.53711605", "0.53593254", "0.53128034", "0.5308846", "0.530849...
0.52241606
29
Context processor to fetch community stats from Django people and Django packages. This caches the resulting dictionary to lower the chance of overwhelming those services.
def community_stats(request): stats = cache.get(STATS_CACHE_KEY, None) if not stats: stats = fetch(PEOPLE_STATS_URL) packages_data = fetch(PACKAGES_STATS_URL) if 'meta' in packages_data: stats.update({'packages': packages_data['meta']['total_count']}) stats = {'comm...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def each_context(self, request):\n script_name = request.META['SCRIPT_NAME']\n site_url = script_name if self.site_url == '/' and script_name else self.site_url\n # 把用户的groupID传给template\n # if Group.objects.filter(id = request.user.id):\n # group_context = Group.objects.get(...
[ "0.55988616", "0.5566804", "0.5502004", "0.54921055", "0.53882295", "0.5386748", "0.53179926", "0.52953476", "0.5235253", "0.52319646", "0.5156149", "0.51293546", "0.5121426", "0.51195425", "0.5102308", "0.50859106", "0.5080095", "0.5077161", "0.5069672", "0.5065913", "0.5061...
0.7520238
0
Returns True if both submodels have same length
def _validate_submodels(self, type_promax, type_ms): return type_promax in self._submodels and \ type_ms in self._submodels and \ len(self._submodels[type_promax]) > 0 and \ len(self._submodels[type_promax]) == len(self._submodels[type_ms])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __len__(self):\n assert len(self.sent1) == len(self.sent2)\n return len(self.sent1)", "def __eq__(self, other):\n return isinstance(other, type(self)) and self.size == other.size", "def equal_size(self, other):\n if not isinstance(other, Matrix):\n raise ValueError(\"...
[ "0.62707317", "0.62434", "0.6213933", "0.6097161", "0.6058098", "0.6052282", "0.6001739", "0.5992692", "0.59679824", "0.5957825", "0.595145", "0.59088415", "0.5906478", "0.5892642", "0.58872175", "0.5876356", "0.58497226", "0.58374107", "0.5794245", "0.57578903", "0.575601", ...
0.71253115
0
Validates type, returning ("normalized_type", submodel_fields)
def _validate_type(self, tp: str, name: str = None): if tp is None: return None, None fields = None if tp.startswith('{'): # Submodel defined in JSON fields = parse_json_model(tp, modelname=name) if not fields: return None, None ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_model_field_types(self):\n self.assertTrue(isinstance(self.UserInfo.have_siblings, str))\n self.assertTrue(isinstance(self.UserInfo.known_env_exposures, str))\n self.assertTrue(isinstance(self.UserInfo.known_genetic_mutations, str))\n self.assertTrue(isinstance(self.UserInfo.ag...
[ "0.6012281", "0.5627871", "0.56062263", "0.5541995", "0.5448626", "0.5435107", "0.5423925", "0.54003364", "0.5392331", "0.53780186", "0.5370685", "0.52956146", "0.5276091", "0.5266467", "0.5264356", "0.52599204", "0.5195668", "0.51644295", "0.51417065", "0.5140979", "0.513462...
0.6659755
0
Yields pairs from an iterable.
def pairs(iterable): previous = None for item in iterable: current = item if previous is not None: yield previous, current previous = current
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def iter_pairs(iterable):\n if isinstance(iterable, Mapping):\n iterable = iterable.items()\n return iter(iterable)", "def pairs(lst):\r\n\tfor i in range(1, len(lst), 2):\r\n\t\tyield lst[i-1], lst[i]", "def pairwise(iterable):\r\n a = iter(iterable)\r\n return izip(a, a)", "def pairs(lst...
[ "0.81223637", "0.7461575", "0.7307938", "0.7271222", "0.714917", "0.7142806", "0.7133279", "0.7094758", "0.70062834", "0.6977689", "0.6964083", "0.6942506", "0.6933127", "0.6882018", "0.6859719", "0.68461996", "0.6843346", "0.6843346", "0.6843346", "0.6824935", "0.6753879", ...
0.77604663
1
Used to visualize the follow poing on purepursuit
def viewFollowPoint(self,follow_point_msg): marker = Marker() marker.header.frame_id = self.veh_name marker.ns = self.veh_name + "/follow_point" marker.id = 0 marker.action = Marker.ADD marker.type = Marker.SPHERE marker.lifetime = rospy.Duration.from_sec(5.0) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def head_hearteyes():\n print (hair_longer())\n print (eye_heart())\n print (nose_rightwards())\n print (mouth_smile())\n print (chin_curvy())", "def bonus_food(self):\n self.penup()\n self.shape(\"turtle\")\n self.color(\"red\")\n self.x_cordinates ...
[ "0.56292534", "0.5618225", "0.5552471", "0.54650366", "0.5445228", "0.54324245", "0.5407945", "0.5407678", "0.5380815", "0.5354937", "0.5342857", "0.5342857", "0.52858186", "0.52716845", "0.52669555", "0.5259555", "0.52410096", "0.52402276", "0.5233314", "0.5229365", "0.52061...
0.4950288
72
Returns the current date. That means every time the project is deployed, the datestamp will update. Returns a formatted date object, ala "Friday Feb. 20"
def last_update(blank): today = date.today() return today.strftime('%A %B %d')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_current_date():\n return datetime.datetime.today().strftime(constants.DATE_FORMAT)", "def get_date_today() -> str:\n return datetime.now().strftime(\"%Y-%m-%d\")", "def get_current_date(fmt=\"%Y-%m-%d\"):\n return datetime.datetime.now().strftime(fmt)", "def get_date():\n now = da...
[ "0.7824893", "0.7507471", "0.7391598", "0.73774505", "0.73269105", "0.7283762", "0.72370684", "0.7218445", "0.7215881", "0.71713823", "0.7162151", "0.7127916", "0.7113581", "0.71124613", "0.71002764", "0.70509845", "0.7046391", "0.702825", "0.6980741", "0.69473976", "0.694374...
0.6653718
41
What's the current date and time?
def timestamp(blank): today = datetime.today() return today.strftime("%A %B %d, %-I:%M %p")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_current_time():\n return datetime.now()", "def get_current_time():\n return datetime.datetime.now()", "def current_time():\n now = datetime.now().strftime(\"%Y/%m/%d %H:%M:%S.%f\")\n return now", "def current_time():\n return time.time()", "def get_current_datetime ( ) :\...
[ "0.82750773", "0.8209311", "0.80392706", "0.8034834", "0.8023809", "0.8011492", "0.7957189", "0.7878803", "0.787236", "0.7862835", "0.78527325", "0.78244144", "0.78027594", "0.7793225", "0.7789877", "0.7701877", "0.7679058", "0.76773113", "0.7676556", "0.7654265", "0.765412",...
0.0
-1
Take a number such as 62 and return 62nd. 63, 63rd etc.
def ordinal_filter(value): digit = value % 10 if 10 < value < 20: o = 'th' elif digit is 1: o = 'st' elif digit is 2: o = 'nd' elif digit is 3: o = 'rd' else: o = 'th' return '%d%s' % (value, o)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def last_digit(n):\n\n return n % 10", "def get_dig_num(num, n = 1):\n digit = num//10**n%10 # this is the n-th digit, 0-indexed\n return digit", "def digit(number: int, n: int) -> int:\n return number // 10 ** n % 10", "def last_n_digits(num, n):\n return num%(10**n)", "def get_nth_digi...
[ "0.7141755", "0.68063426", "0.6753309", "0.6747062", "0.6726129", "0.6608696", "0.6578584", "0.6549075", "0.6525275", "0.6459882", "0.64534855", "0.64322025", "0.64104617", "0.6395445", "0.63594806", "0.63561016", "0.6331798", "0.6282339", "0.62483346", "0.6241493", "0.624059...
0.0
-1
Class constructor receives parameters to connect to the networkAPI.
def __init__(self, networkapi_url, user, password, user_ldap=None): super( RoteiroEquipamento, self).__init__( networkapi_url, user, password, user_ldap)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, address):\r\n self.loop = asyncio.new_event_loop()\r\n self.device_address = address\r\n\r\n self.__api_address = \"http://\" + address if not address.startswith('http://') else address\r\n _LOGGER.debug(\"Api address: %s\", self.__api_address)\r\n self.model_r...
[ "0.6986114", "0.6901052", "0.6891296", "0.6836612", "0.6833463", "0.6784958", "0.67357445", "0.671517", "0.66976726", "0.66885394", "0.66739595", "0.66732055", "0.6663089", "0.6645663", "0.66445404", "0.6629692", "0.66234744", "0.662254", "0.66040313", "0.66040313", "0.657282...
0.0
-1
Sets the initial state of the device.
def _initialize_data(self): self.reset_count = 0 self._idn_no_firmware = "KEPCO,BOP 50-20,E1234," self._firmware = 2.6 self._init_data()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def initial_state(self, initial_state: QuantumCircuit) -> None:\n self._invalidate()\n self._initial_state = initial_state", "def initialize(self):\n self.currState = self.startState", "def resetDeviceStates(self):", "def set_initial_state(self, initial_states, userdata):\n raise ...
[ "0.7504116", "0.690324", "0.6809412", "0.67910904", "0.67115295", "0.6696538", "0.6672575", "0.6632381", "0.6580465", "0.6563067", "0.6559918", "0.64950496", "0.64455366", "0.642056", "0.64086676", "0.6338755", "0.6338366", "0.6336666", "0.63347834", "0.6327715", "0.629293", ...
0.0
-1
Reset the device, reinitialising the data.
def reset(self): self.reset_count += 1 self._init_data()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def device_reset(self):\n\t\tlogger.info('Device Reset')\n\t\tself.spi.writebytes([0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff])\n\t\tprint(DELIMITER*'-')", "def resetDevice(self):\n reset_pkt = [START_BYTE_1, START_BYTE_2, RESET_MTYPE, 0x00, HEADER_SIZE + RESET_DATA_SIZE]\n reset_pkt.extend(RES...
[ "0.758682", "0.75735646", "0.7518953", "0.7389302", "0.73468316", "0.71213037", "0.70714784", "0.69749707", "0.6920218", "0.6890552", "0.68882835", "0.683326", "0.6819545", "0.68126434", "0.6779973", "0.67533934", "0.6750631", "0.67285883", "0.6715532", "0.67061126", "0.67061...
0.75327283
2
Add all run parsers.
def add_subparser( subparsers: SubParsersAction, parents: List[argparse.ArgumentParser] ) -> None: run_parser = subparsers.add_parser( "run", parents=parents, conflict_handler="resolve", formatter_class=argparse.ArgumentDefaultsHelpFormatter, help="Starts a Rasa server wi...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_all_command_parsers(self) -> None:\n for command in self.commands:\n self.get_command_parser(command)", "def run_parse(self):\n # Data set already has source file names from load_inputs\n parsedset = {}\n parsedset['data_set'] = []\n for log in self.input_fil...
[ "0.6505622", "0.641105", "0.62048805", "0.601413", "0.60013145", "0.589798", "0.5883723", "0.585354", "0.5844148", "0.58043873", "0.564003", "0.5558875", "0.55376494", "0.54931134", "0.5423032", "0.53750455", "0.5364569", "0.5346068", "0.53338164", "0.5296625", "0.5261934", ...
0.59972507
5
Entrypoint for `rasa run`.
def run(args: argparse.Namespace) -> None: import rasa args.endpoints = rasa.cli.utils.get_validated_path( args.endpoints, "endpoints", DEFAULT_ENDPOINTS_PATH, True ) args.credentials = rasa.cli.utils.get_validated_path( args.credentials, "credentials", DEFAULT_CREDENTIALS_PATH, True ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def start_rasa_server(run_event):\n print('START RASA SERVER')\n if os.getenv('RASA_ACTIONS_URL') and len(\n os.getenv('RASA_ACTIONS_URL')) > 0:\n # ensure rasa endpoints file matches RASA_ACTIONS_URL env var\n endpoints_file = open(\n os.path.join(\n os.pat...
[ "0.75828344", "0.6596486", "0.6327994", "0.6202171", "0.6101385", "0.6101385", "0.6101385", "0.60364085", "0.6035912", "0.603584", "0.603292", "0.6017248", "0.599784", "0.5949028", "0.5909721", "0.5909721", "0.5909721", "0.5909721", "0.5909721", "0.5909721", "0.5909721", "0...
0.6522449
2
return ngrams as single spaceseparated strings with their occurences
def get(self, n): parts = [' '.join(g) for g in ngrams(self.words, n)] return get_occurences(parts)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _ngrams(self, string_):\n def find_ngrams(input_list, n):\n return zip(*[input_list[i:] for i in range(n)])\n\n ngrams = []\n tokens = string_.split()\n\n for size in range(1, self._ngram_range + 1):\n tuples = find_ngrams(tokens, size)\n concatenate...
[ "0.78278804", "0.76701784", "0.76432234", "0.7412483", "0.7388992", "0.7383285", "0.7343278", "0.7261323", "0.725827", "0.7243522", "0.72036326", "0.7154389", "0.7147983", "0.71211857", "0.71205693", "0.70832944", "0.70656013", "0.70451486", "0.70400804", "0.6991556", "0.6975...
0.64976317
52
return most used noun_phrases
def get_phrases(self, first=10): return get_occurences(self.lemmatized_phrases)[:first]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def most_words(self, n):\n return big_tags", "def frequent_nouns_counts(self, tokens):\n\n unigram_fd = nltk.FreqDist(tokens)\n pos = POS()\n common_unigrams = unigram_fd.most_common(\n int(self.top_pct * len(unigram_fd)))\n\n nouns = [pair for pair in common_unigram...
[ "0.6768063", "0.6764637", "0.6511837", "0.635036", "0.63493806", "0.6346821", "0.6346821", "0.63431996", "0.6316743", "0.63167274", "0.6286206", "0.62472194", "0.62286603", "0.6213437", "0.62020063", "0.6191109", "0.61899865", "0.61860347", "0.6180162", "0.6180162", "0.617625...
0.6017455
35
return most used words
def get_words(self, first=10): return get_occurences(self.lemmatized_words)[:first]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def find_frequent_words(words, most_frequent): \n \n # common_words = Counter(sorted(words))\n # print common_words\n common_words = Counter(sorted(words)).most_common(most_frequent)\n print (common_words )\n most_common_words = [w for w, w_count in common_words]\n return most_common_words"...
[ "0.7717855", "0.7710902", "0.7526036", "0.7515229", "0.7457172", "0.7383764", "0.71464837", "0.71408725", "0.71277374", "0.7127556", "0.7100289", "0.70912224", "0.70876014", "0.7072795", "0.70574975", "0.70387983", "0.6993421", "0.6988404", "0.69723606", "0.6950494", "0.69486...
0.0
-1
lemmatize words in noun_phrases, exclude phrases with `STOPWORDS`
def lemmatized_phrases(self): phrases = [set(lower_words(TextBlob(p).words.lemmatize())) for p in self.blob.noun_phrases] return [' '.join(p) for p in phrases if not STOPWORDS.intersection(p)]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def lemmatize_verbs(self):\n lemmas = []\n # lemmas = \"\"\n for word in self.words:\n lemma = wn.lemmatize(word, pos='v')\n lemmas.append(lemma)\n # lemmas += f\"{lemma} \"\n self.words = lemmas\n return self", "def lemmatize_nouns(self, words):\n\t\tlemmatizer = WordNetLemma...
[ "0.73897773", "0.73393244", "0.72585356", "0.7244815", "0.71327686", "0.69146174", "0.68672264", "0.68209785", "0.6816726", "0.6812039", "0.6789802", "0.6779173", "0.67476636", "0.6746864", "0.6731405", "0.6731262", "0.67183787", "0.6701651", "0.66856176", "0.66856176", "0.66...
0.8088282
0
downloading and renaming columns replace space with '_'
def download_datasets_csv(url): # dataset = pd.read_csv(url, sep='\t') dataset = pd.read_csv(url, sep=",") dataset.columns = dataset.columns.str.replace(" ", "_") return dataset
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def tidy_cols(my_csv):\n return [re.sub(\" \", \"_\", col.lower()) for col in my_csv.columns]", "def _clean_up_table_column_names(loop_dict):\n \n # Make the column names all lowercase\n # and remove any underscores from the beginning\n for key in loop_dict.keys():\n rename_dict = { x:re.su...
[ "0.5891028", "0.582513", "0.5810645", "0.5772185", "0.5601228", "0.558993", "0.55504906", "0.55083317", "0.547578", "0.5473249", "0.54711485", "0.54481345", "0.5434032", "0.54124486", "0.53992754", "0.5395076", "0.5377607", "0.532118", "0.53113216", "0.52825606", "0.5271922",...
0.586284
1
download and save historical + new dataset in complte dataset
def save_today_up_to_date_local_copy(url_hist, url_new): df_historical = download_datasets_csv(url_hist) df_new = download_datasets_csv(url_new) # creating complete dataset complete_dataset = df_historical.append(df_new, ignore_index=True) # saving dataset today = date.today().strftime("%d_%m_%Y...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def download_data_and_save():\n url = 'https://github.com/djay/covidthailand/wiki/combined.csv'\n s=requests.get(url).content\n global df\n global last_updated\n df=pd.read_csv(io.StringIO(s.decode('utf-8')), parse_dates= ['Date'])\n df.to_parquet(file_name, compression='UNCOMPRESSED')\n df.to_csv('jaydata....
[ "0.7490032", "0.70159507", "0.6900648", "0.673739", "0.6722774", "0.66758853", "0.65556735", "0.6517671", "0.6412614", "0.63694435", "0.633438", "0.6323673", "0.63144374", "0.62915635", "0.62536067", "0.6218456", "0.6188079", "0.61649686", "0.61501503", "0.61264765", "0.61185...
0.73869425
1
replacing data in Google Cloud Table
def replace_data_in_gbq_table(project_id, table_id, complete_dataset): complete_dataset.to_gbq( destination_table=table_id, project_id=project_id, credentials=credentials, if_exists="replace", ) return None
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def replace_data(\n table_id: str = typer.Option(..., help=\"The id of the table\"),\n test: bool = typer.Option(False, help=\"Whether is a test or not\")\n) -> None:\n base_path = Path.cwd().parent\n\n tbl = bd.Table(dataset_id=\"br_cgu_servidores_executivo_federal\", table_id=table_id)\n output_pa...
[ "0.6006506", "0.60053116", "0.5916676", "0.58872443", "0.58701134", "0.5751219", "0.5727902", "0.57181513", "0.5715651", "0.56847066", "0.5664049", "0.56344426", "0.5623332", "0.55554026", "0.5548725", "0.54871124", "0.5472866", "0.5461745", "0.54568017", "0.54271203", "0.542...
0.6709368
0
Get output for a finished job with id.
def getOutput(self): self.checkBeforeGet() # Get first job of the list if not self.dontCheckSpaceLeft and not has_freespace(self.outDir, 10*1024): # First check for more than 10 Mb msg = "You have LESS than 10 MB of free space on your working dir\n" msg +="Please make som...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def job_output(self, job_id):\n\n url = self.base_url + \"/ml-service/phoenix-ml/output/findBy?jobId={0}\".format(job_id)\n headers = {\"ApiKey\": self.api_key}\n response = requests.get(url=url, headers=headers)\n return response.json()", "def completed_job_info(self, jobid=None, out...
[ "0.748623", "0.73491913", "0.6980665", "0.6841408", "0.6526476", "0.64631826", "0.63375413", "0.6295551", "0.6289767", "0.62885624", "0.622371", "0.61111414", "0.60730827", "0.59569275", "0.59468514", "0.59456295", "0.5942398", "0.5934416", "0.59119844", "0.5900385", "0.58976...
0.0
-1
Parses the FJR produced by job in order to retrieve the WrapperExitCode and ExeExitCode. Updates the BossDB with these values.
def parseFinalReport(self, input): from ProdCommon.FwkJobRep.ReportParser import readJobReport codeValue = {} jreports = readJobReport(input) if len(jreports) <= 0 : codeValue["applicationReturnCode"] = str(50115) codeValue["wrapperReturnCode"] = str(50...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def wsParseFJR(self):\n txt = '\\n#Written by cms_cmssw::wsParseFJR\\n'\n txt += 'echo \">>> Parse FrameworkJobReport crab_fjr.xml\"\\n'\n txt += 'if [ -s $RUNTIME_AREA/crab_fjr_$NJob.xml ]; then\\n'\n txt += ' if [ -s $RUNTIME_AREA/parseCrabFjr.py ]; then\\n'\n txt += ' ...
[ "0.64432395", "0.5260613", "0.52343196", "0.52212924", "0.519622", "0.5182771", "0.51703864", "0.51282525", "0.5100127", "0.5092974", "0.50409675", "0.503647", "0.5012631", "0.50123405", "0.49673423", "0.49517173", "0.49453866", "0.49341914", "0.49084947", "0.49002942", "0.48...
0.71490014
0
Move output of job already retrieved into the correct backup directory
def moveOutput(self,id, max_id,path,file): Dir_Base=path +'Submission_' for i in range(1, max_id): if not os.path.isdir( Dir_Base + str(i) + '/'): cmd=('mkdir '+ Dir_Base + str(i) + '/ >& /dev/null') cmd_out = runCommand(cmd) commo...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def transfer_job_to_single_archive(wcl, saveinfo, dest, task_label):\n\n if miscutils.fwdebug_check(3, \"PFWRUNJOB_DEBUG\"):\n miscutils.fwdebug_print(\"TRANSFER JOB TO ARCHIVE SECTION\")\n archive_info = wcl['%s_archive_info' % dest.lower()]\n tstats = None\n if 'transfer_stats' in wcl:\n ...
[ "0.63789195", "0.62199014", "0.614267", "0.6113023", "0.60661507", "0.6045541", "0.5890307", "0.5839137", "0.5829081", "0.58237654", "0.57699376", "0.57484376", "0.5743507", "0.57335913", "0.570491", "0.56820357", "0.5673654", "0.5669085", "0.5664019", "0.5630723", "0.5622250...
0.60767967
4
Split out the data set into its inputs and its labels.
def _split_inputs_outputs(self, data): inputs = [] outputs = [] for point in data: inputs.append(point[0]) outputs.append(point[1]) return np.array(inputs), np.array(outputs)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def split_data(self):\n if not self.load_data:\n raise AttributeError('Preprocessor has not loaded any data.')\n \n # 3 - Find example counts for each set\n self.n_examples = self.data[0].shape[0]\n self.n_train = int(self.n_examples * self.train_ratio)\n self.n...
[ "0.68070143", "0.6750992", "0.6724709", "0.6647016", "0.66121227", "0.65744203", "0.65072405", "0.64910185", "0.6469287", "0.6430547", "0.6300627", "0.62866193", "0.62826365", "0.62524253", "0.6250792", "0.6244052", "0.6212815", "0.6197", "0.6156624", "0.6151179", "0.61149824...
0.6575571
5
Method to classify a test data set and return the score in terms of accuracy.
def score(self, test_data): pass
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def score(self, test_data):\n\n\t\tins, outs = self._split_inputs_outputs(test_data)\n\n\t\t# One hot encode the input/labels\n\t\tencoder = LabelEncoder()\n\t\tencoder.fit(outs)\n\t\tenc_labels = encoder.transform(outs)\n\t\tenc_labels = np_utils.to_categorical(enc_labels)\n\n\t\t_, score = self.model.evaluate(in...
[ "0.7827106", "0.7716559", "0.76527333", "0.7484252", "0.7440777", "0.74163395", "0.73581105", "0.73344773", "0.7304312", "0.7296065", "0.7292504", "0.7276412", "0.7261127", "0.7254433", "0.72333145", "0.7222515", "0.7206312", "0.7166098", "0.7164757", "0.71625596", "0.7161631...
0.0
-1
Fit the knn model.
def _fit(self, data): train_in, train_labels = self._split_inputs_outputs(data) clf = KNeighborsClassifier(n_neighbors=self.k) clf.fit(train_in, train_labels) return clf
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def fit(self):\n \n self.knn_model = KNeighborsRegressor(n_neighbors=self.k,\n weights='distance')\n self.knn_model.fit(self.X, self.y)", "def fit(self, Xtrain, ytrain):\n self.Xtrain = Xtrain\n self.ytrain = ytrain\n\n max_nn ...
[ "0.82824767", "0.7297423", "0.7242588", "0.7187846", "0.69953674", "0.69056904", "0.689061", "0.6822247", "0.6819599", "0.67986625", "0.67709565", "0.66812265", "0.66537255", "0.66494197", "0.66305053", "0.66141015", "0.6599681", "0.65994424", "0.6562805", "0.654726", "0.6524...
0.7031433
4
Return the accuracy attained by the knn on the test data set.
def score_one(self, test_data): test_in, test_labels = self._split_inputs_outputs(test_data) correct = 0 total = 0 for i, test_input in enumerate(test_in): prediction = self.model.predict(test_input.reshape(1,-1)) if prediction[0] == test_labels[i]: correct+=1 total+=1 return float(correct)/tot...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getAccuracy(self):\n\t\tcorrect = (self.testing[self.classLabel]==self.bestLabel).sum()\n\t\tself.accuracy = (correct/float(len(self.testing))) * 100.0", "def get_accuracy(self) -> float:\n self.network.load_data()\n self.network.train()\n\n n = len(self.network.y_test)\n correct ...
[ "0.81783843", "0.807551", "0.80026567", "0.8001903", "0.78935206", "0.77839744", "0.7777315", "0.7738132", "0.7703403", "0.76944774", "0.7688138", "0.76269644", "0.7613137", "0.7607058", "0.75859165", "0.757926", "0.7487052", "0.74865884", "0.7449901", "0.7419433", "0.7382690...
0.0
-1
Use 10fold CV to produce an average score
def score(self): splits = 10 score = 0 kf = KFold(n_splits=splits, shuffle=True) kf.get_n_splits(self.data) for train_ind, test_ind in kf.split(self.data): train = [self.data[ind] for ind in train_ind] test = [self.data[ind] for ind in test_ind] self.model = self._fit(train) temp_score = self...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def cv_score(clf, x, y, score_func):\r\n result = 0\r\n nfold = 5\r\n for train, test in KFold(y.size, nfold): # split data into train/test groups, 5 times\r\n clf.fit(x[train], y[train]) # fit\r\n result += score_func(clf, x[test], y[test]) # evaluate score function on held-out data\r\n ...
[ "0.7508548", "0.68642884", "0.686009", "0.6607522", "0.65247214", "0.65219957", "0.65063673", "0.6505322", "0.65024954", "0.6391796", "0.6380426", "0.63793", "0.6310294", "0.6234901", "0.6214619", "0.61726385", "0.6169891", "0.6133121", "0.6118932", "0.6067403", "0.6057782", ...
0.63403803
12
Fit the decision tree model.
def _fit(self, data): train_in, train_labels = self._split_inputs_outputs(data) clf = DecisionTreeClassifier(min_samples_leaf=0.05) clf.fit(train_in, train_labels) return clf
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def fit_decision_tree(model, x_train, y_train):\r\n model.fit(x_train, y_train)\r\n score = model.score(x_train, y_train)\r\n importance = model.feature_importances_\r\n return score, importance", "def fit(self, X, y):\n #Initialize the tree with the given data\n tree = kd(X)\n s...
[ "0.7569848", "0.74153537", "0.72756153", "0.72105074", "0.6821379", "0.67818767", "0.662454", "0.6596738", "0.65849745", "0.65849745", "0.65598154", "0.65543187", "0.6544427", "0.6542975", "0.6537915", "0.65235364", "0.650521", "0.65000254", "0.6415684", "0.64080507", "0.6333...
0.7340412
2
Return the accuracy attained by the knn on the test data set.
def score_one(self, test_data): test_in, test_labels = self._split_inputs_outputs(test_data) correct = 0 total = 0 for i, test_input in enumerate(test_in): prediction = self.model.predict(test_input.reshape(1,-1)) if prediction[0] == test_labels[i]: correct+=1 total+=1 return float(correct)/tot...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getAccuracy(self):\n\t\tcorrect = (self.testing[self.classLabel]==self.bestLabel).sum()\n\t\tself.accuracy = (correct/float(len(self.testing))) * 100.0", "def get_accuracy(self) -> float:\n self.network.load_data()\n self.network.train()\n\n n = len(self.network.y_test)\n correct ...
[ "0.8180346", "0.80784214", "0.8005831", "0.80041337", "0.7895488", "0.77844036", "0.77788", "0.7739961", "0.77059036", "0.7696882", "0.7691345", "0.76276654", "0.76155436", "0.76090294", "0.7584759", "0.75794256", "0.74891686", "0.748881", "0.7452785", "0.7422463", "0.7385018...
0.0
-1
Use 10fold CV to produce a score
def score(self): splits = 10 score = 0 kf = KFold(n_splits=splits, shuffle=True) kf.get_n_splits(self.data) for train_ind, test_ind in kf.split(self.data): train = [self.data[ind] for ind in train_ind] test = [self.data[ind] for ind in test_ind] self.model = self._fit(train) temp_score = self...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def cv_score(clf, x, y, score_func):\r\n result = 0\r\n nfold = 5\r\n for train, test in KFold(y.size, nfold): # split data into train/test groups, 5 times\r\n clf.fit(x[train], y[train]) # fit\r\n result += score_func(clf, x[test], y[test]) # evaluate score function on held-out data\r\n ...
[ "0.7361523", "0.6822073", "0.67983013", "0.67981595", "0.679089", "0.6743333", "0.661887", "0.6546391", "0.6534486", "0.64706314", "0.6468548", "0.6424231", "0.6401285", "0.6376128", "0.6340506", "0.6315139", "0.6280791", "0.6203428", "0.61945695", "0.61933863", "0.6171417", ...
0.6448152
11
Fit the logistic regression model.
def _fit(self): clf = LogisticRegression() clf.fit(inputs, labels) return clf
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def log_reg(x_train, y_train):\n\n log_reg_classifier = LogisticRegression(max_iter=1000, solver='lbfgs')\n log_reg_classifier.fit(x_train, y_train)\n return log_reg_classifier\n\n # log_reg_classifier.fit(x_train, y_train)", "def _fit(self, _X, _y):\n\n self.model = linear_model.LogisticRegre...
[ "0.7822972", "0.7692005", "0.7548392", "0.7395676", "0.7204495", "0.7157888", "0.71509266", "0.70614314", "0.70379573", "0.69379884", "0.69329995", "0.68996924", "0.6820621", "0.68176067", "0.6782893", "0.67820376", "0.6755673", "0.6706559", "0.67048633", "0.6691573", "0.6682...
0.7538954
3
Return the score obtained on the test data set
def score(self, test_data): ins, outs = self._split_inputs_outputs(test_data) return self.model.score(ins, outs)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def score(self, test_data):\n\n\t\tpass", "def score(self, test_data):\n\n\t\tins, outs = self._split_inputs_outputs(test_data)\n\n\t\t# One hot encode the input/labels\n\t\tencoder = LabelEncoder()\n\t\tencoder.fit(outs)\n\t\tenc_labels = encoder.transform(outs)\n\t\tenc_labels = np_utils.to_categorical(enc_lab...
[ "0.86668295", "0.7818388", "0.77717274", "0.77294904", "0.76660264", "0.76660264", "0.76569784", "0.73830205", "0.7382572", "0.7316532", "0.7287335", "0.72611284", "0.7224763", "0.7224763", "0.7218049", "0.7218049", "0.7199401", "0.7164144", "0.71476907", "0.71476907", "0.714...
0.8328699
1
Train the neural network using Adam optimizer
def train(self): input_size = len(self.inputs[0]) output_size = len(set(self.labels)) hidden_size_1 = 15 hidden_size_2 = 15 # One hot encode the labels encoder = LabelEncoder() encoder.fit(self.labels) enc_labels = encoder.transform(self.labels) enc_labels = np_utils.to_categorical(enc_labels) #...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def trainNet():", "def train():\n rng = random.PRNGKey(0)\n\n # Get Zachary's karate club graph dataset.\n node_feats, node_labels, sources, targets = get_karate_club_data()\n\n # Create model and optimizer.\n _, initial_params = GNN.init(\n rng, node_x=node_feats, edge_x=None, sources=sources, targets...
[ "0.71472293", "0.70600724", "0.70026565", "0.69949657", "0.6988527", "0.6967045", "0.6955149", "0.6940348", "0.694033", "0.68917704", "0.6864978", "0.68499064", "0.6846929", "0.6829985", "0.6814839", "0.68050236", "0.68016535", "0.6799331", "0.6787858", "0.67825234", "0.67695...
0.0
-1
Return the accuracy attained by the neural network on the test set
def score(self, test_data): ins, outs = self._split_inputs_outputs(test_data) # One hot encode the input/labels encoder = LabelEncoder() encoder.fit(outs) enc_labels = encoder.transform(outs) enc_labels = np_utils.to_categorical(enc_labels) _, score = self.model.evaluate(ins, enc_labels, verbose=2) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_accuracy(self) -> float:\n self.network.load_data()\n self.network.train()\n\n n = len(self.network.y_test)\n correct = 0\n for i in range(n):\n # Predict by running forward pass through the neural network\n pred = self.network.predict(self.network.x...
[ "0.8605905", "0.815202", "0.8070769", "0.8068605", "0.8035914", "0.80330867", "0.7938776", "0.7906472", "0.7895872", "0.78683805", "0.78303057", "0.77969366", "0.7765335", "0.7745827", "0.7736295", "0.77029103", "0.7656342", "0.76442033", "0.7615893", "0.7611401", "0.76058733...
0.0
-1
Python model creator fro tensor implementation in java Args
def __init__(self, dim=20, nIter=5, lamb=0.05, alph=40, user_features=["user"], item_features=["item"]): self.setParams(dim,nIter, lamb, alph) self.user_features = {} self.item_features = {} self.factors = {} self.user_column_names = user_features self.i...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_model():\r\n parser = argparse.ArgumentParser()\r\n parser.add_argument('--DISC_LR', type=float, default=1e-4)\r\n parser.add_argument('--GEN_LR', type=float, default=1e-3)\r\n parser.add_argument('--GEN_BETA1', type=float, default=0.9)\r\n parser.add_argument('--GEN_BETA2', type=float, default=0.9...
[ "0.67856354", "0.6725397", "0.6558513", "0.65427756", "0.6461063", "0.64487284", "0.63853717", "0.6380155", "0.6334473", "0.63143593", "0.62861764", "0.6284722", "0.6238022", "0.62292343", "0.6205176", "0.6196909", "0.6196012", "0.61855704", "0.6158863", "0.61315936", "0.6114...
0.0
-1
Return parameter details for dim, nIter, lamb and alph
def paramDetails(cls): return { 'dim': (10, 20, 2, 20), 'nIter': (1, 10, 2, 5), 'lamb': (.1, 1., .1, .05), 'alph': (30, 50, 5, 40) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def setParams(self,dim=20, nIter=5, lamb=0.05, alph=40):\n self._dim = dim\n self._nIter = nIter\n self._lamb = lamb\n self._alph = alph", "def show_parameters(self):\n with np.printoptions(precision=3, suppress=True):\n print('number of wind phase = {}'.format(self....
[ "0.66055083", "0.65783185", "0.6249512", "0.60537255", "0.6009132", "0.60000795", "0.599074", "0.5983164", "0.59602505", "0.59599835", "0.59563273", "0.5954735", "0.5952508", "0.59498894", "0.59248936", "0.5918452", "0.5881164", "0.58748", "0.5865431", "0.5844908", "0.5821393...
0.74654466
0
Java Float Matrix is a 1D array writen column after column. Numpy reads row after row, therefore, we need a conversion.
def _float_matrix2numpy(self, java_float_matrix): columns_input = java_float_matrix.toArray() split = lambda lst, sz: [numpy.fromiter(lst[i:i+sz],dtype=numpy.float) for i in range(0, len(lst), sz)] cols = split(columns_input, java_float_matrix.rows) matri...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def matrixToFloatMatrix(matrix):\n\n float_matrix = [matrix(i, j) for i in xrange(4) for j in xrange(4)]\n\n outMatrix = OpenMaya.MFloatMatrix()\n OpenMaya.MScriptUtil.createFloatMatrixFromList(float_matrix , outMatrix)\n\n return outMatrix", "def itemsToFloat(self):\n returnva...
[ "0.7274915", "0.66002345", "0.6478091", "0.62763405", "0.59943956", "0.58819616", "0.58508307", "0.58382297", "0.58107084", "0.5799", "0.57688916", "0.57163143", "0.5654517", "0.56448877", "0.56354064", "0.5616841", "0.5608916", "0.55774224", "0.5566227", "0.5564168", "0.5546...
0.7982614
0
Set the parameters for the TensorCoFi
def setParams(self,dim=20, nIter=5, lamb=0.05, alph=40): self._dim = dim self._nIter = nIter self._lamb = lamb self._alph = alph
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_parameters(self, **kwargs):\n self.__multi_layer_perceptron.set_params(**kwargs)", "def set_parameters(self,params):\n K3Supervisor.set_parameters(self,params)\n self.gtg.set_parameters(self.parameters)\n self.avoidobstacles.set_parameters(self.parameters)\n self.wall.s...
[ "0.7162809", "0.6975917", "0.69572663", "0.69175005", "0.67739886", "0.6729018", "0.67094076", "0.66425633", "0.6621363", "0.65588087", "0.6556437", "0.6530796", "0.6530384", "0.6530384", "0.6520774", "0.65118974", "0.6503824", "0.64620966", "0.6427614", "0.64271015", "0.6417...
0.58768946
71
Instantiate this submodule with the given UI.
def __init__(self, UI): super(COTInjectConfig, self).__init__(UI) self._config_file = None self._secondary_config_file = None
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, ui: UI):\n super().__init__(ui)", "def __init__(self):\r\n super().__init__()\r\n self.init_ui()", "def init_ui(self):\n raise NotImplementedError", "def init_ui(self):\n raise NotImplementedError", "def init_ui(self):\n raise NotImplementedError...
[ "0.71629465", "0.6812497", "0.65096986", "0.65096986", "0.6493672", "0.6486345", "0.63511", "0.63335776", "0.62438047", "0.62001234", "0.6143851", "0.6113456", "0.60962325", "0.60550797", "0.6031183", "0.60106504", "0.5976868", "0.5973087", "0.59472775", "0.59101176", "0.5889...
0.0
-1
Do the actual work of this submodule.
def run(self): super(COTInjectConfig, self).run() vm = self.vm platform = vm.platform # Find the disk drive where the config should be injected # First, look for any previously-injected config disk to overwrite: if platform.BOOTSTRAP_DISK_TYPE == 'cdrom': (...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def main():\n obj = UnityFilesystem()\n obj.perform_module_operation()", "def __gitSubmodulesSync(self):\n self.vcs.gitSubmoduleSync(self.project.getProjectPath())", "def do_workload(self):\n module_manager = self._core.get_module_manager()\n module = module_manager.get_module_by_nam...
[ "0.66442853", "0.62968755", "0.6259206", "0.624318", "0.6181432", "0.61801285", "0.6152305", "0.6148519", "0.61186683", "0.61186683", "0.6116955", "0.6116955", "0.6116955", "0.6116955", "0.6116955", "0.6116955", "0.6116955", "0.6116955", "0.6116955", "0.6116955", "0.6116955",...
0.0
-1
Add subparser for the CLI of this submodule.
def create_subparser(self, parent, storage): p = parent.add_parser( 'inject-config', help="Inject a configuration file into an OVF package", usage=self.UI.fill_usage("inject-config", [ "PACKAGE -c CONFIG_FILE [-o OUTPUT]", "PACKAGE -s SECONDARY...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def extend_cli(self, subparser):", "def add(cls, subparsers):\n subparser = subparsers.add_parser(\n name=cls.__tool_name__(),\n description=cls.__get_description__())\n\n cls.__add_arguments__(subparser)\n subparser.set_defaults(func=cls.from_args)\n return subp...
[ "0.8356323", "0.7613267", "0.7532559", "0.75132465", "0.74843043", "0.7461825", "0.7458073", "0.7289405", "0.71724516", "0.7165431", "0.7135265", "0.7031047", "0.6956534", "0.6943993", "0.69056773", "0.688262", "0.68790203", "0.6860334", "0.6815078", "0.67114484", "0.67108387...
0.5897082
100
Check that all protected branches are a single index unicity of name version must be increased `force` option ignored
def check_pkg_consistency(): pass
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def commit_check(ctx):\n result = ctx.run(f\"{VENV_PREFIX} cz check --rev-range master..\", warn=True)\n if result.exited == 3: # NO_COMMIT_FOUND\n exit(0)\n else:\n exit(result.exited)", "def validate(cfg: defs.Config) -> List[str]: # noqa: C901\n res: List[str] = []\n\n def check...
[ "0.5562095", "0.5386104", "0.5354058", "0.53346205", "0.5217734", "0.5204411", "0.51927465", "0.5189931", "0.5149217", "0.5106516", "0.5092081", "0.5082172", "0.50748366", "0.5031404", "0.49861875", "0.4984854", "0.4967", "0.49571994", "0.49304572", "0.49161586", "0.48917702"...
0.0
-1
Lists all the blobs in the bucket.
def gcs_list_blobs(bucket_name): storage_client = client #storage.client() bucket = storage_client.get_bucket(bucket_name) blobs = bucket.list_blobs() blob_list = [] for blob in blobs: blob_list.append(blob.name) return blob_list
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def list_blobs(bucket_name):\n storage_client = storage.Client()\n\n # Note: Client.list_blobs requires at least package version 1.17.0.\n blobs = storage_client.list_blobs(bucket_name)\n\n return blobs", "def list_blobs(bucket_name):\n # bucket_name = \"your-bucket-name\"\n\n storage_client = ...
[ "0.81295836", "0.80809796", "0.8063129", "0.80104107", "0.79991764", "0.7891442", "0.771796", "0.7614527", "0.757374", "0.7504958", "0.74911094", "0.74169266", "0.73137933", "0.72736335", "0.7269783", "0.72240984", "0.7204592", "0.7182615", "0.7155751", "0.71367675", "0.71151...
0.7789013
6
Downloads a blob from the bucket.
def gcs_download_blob(bucket_name, source_blob_name, destination_file_name): storage_client = client #storage.Client() bucket = storage_client.get_bucket(bucket_name) blob = bucket.blob(source_blob_name) blob.download_to_filename(destination_file_name)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def download_blob(bucket_name, source_blob_name):\n\n storage_client = storage.Client()\n bucket = storage_client.bucket(bucket_name)\n blob = bucket.blob(source_blob_name)\n\n return blob", "def blob_download(blob_url):\n blob = storage.Object.from_url(blob_url)\n blobc = blob.download()\n ...
[ "0.8135551", "0.8126195", "0.7890022", "0.78339165", "0.7721649", "0.77189684", "0.7649907", "0.7573001", "0.7502306", "0.74736196", "0.74572617", "0.7345375", "0.73441243", "0.72784907", "0.7213689", "0.7128273", "0.7065729", "0.6937288", "0.6928252", "0.6894445", "0.6828534...
0.70821893
16
Current user will place order
def post(self, request, format=None): inventory_id = request.data.get('inventory_id', None) user_id = None if hasattr(request, 'user'): user_id = request.user.id if inventory_id is not None and user_id is not None: try: inventory_item = self.nv_m...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def place_order(self):\n\n order_total = self.get_order_total()\n\n if self.person.can_afford(order_total):\n print 'This person is stinkin rich!'\n else:\n print \"No soup for you!\"", "def test_order_by_user(self):\n self.fill_session_cart()\n self.clien...
[ "0.70376885", "0.6521009", "0.6342922", "0.6326408", "0.6183782", "0.6176169", "0.6154756", "0.606741", "0.60295796", "0.60066897", "0.60049874", "0.60049874", "0.60049874", "0.5994649", "0.59906405", "0.59855217", "0.59850776", "0.5975906", "0.5965155", "0.59345704", "0.5929...
0.0
-1
Given a ManagedProcess protobuf instance, create the corresponding ProcessNode and insert it into the graph.
def add_node(self, managed_process_pb): node = ProcessNode(managed_process_pb) if node.name not in self.nodes: self.nodes[node.name] = node self.logger.info('Created node for [{}]'.format(node.name)) else: self.logger.error( 'Detected request ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_node_process(name, properties):\n process = NodeProcess(name)\n DB.session.add(process)\n DB.session.commit()\n for p in properties:\n prop = NodeProcessProperty(process.id, p[0], p[1], p[2])\n DB.session.add(prop)\n DB.session.commit()\n return process", "def add_proce...
[ "0.6773554", "0.64495486", "0.60057384", "0.5933061", "0.5871152", "0.58102006", "0.5744983", "0.57229316", "0.5719331", "0.56770027", "0.5667292", "0.5577523", "0.5570289", "0.55650806", "0.55393213", "0.55308384", "0.5441535", "0.5393277", "0.5389408", "0.5335206", "0.52840...
0.7839599
0
Reset all adjacency information and rebuild it after adding nodes. This implements a collection of sanity checks (making sure every subscribed topic has a publisher, etc.) which, if they all pass, mean we can safely / sanely construct the dependency graph.
def build(self): self.logger.info('Rebuilding adjacency information') self.edges = collections.defaultdict(list) topic_to_publisher = collections.defaultdict(list) topic_to_subscribers = collections.defaultdict(list) node_to_missing_deps = collections.defaultdict(list) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _reset_state(self):\n # Directed graph, (u, v) => v depends on u. u, v are pairs of (rule_name, rule_dir_abs)\n # Used for generating Topological Sort\n self._rule_to_dependency_graph_adjlist = {}\n self._topologically_sorted_build_rule_names = []\n\n # List of (dependency_na...
[ "0.65324295", "0.63045096", "0.6301467", "0.6183333", "0.6102479", "0.6050887", "0.6023047", "0.5987564", "0.5974988", "0.58748007", "0.5874257", "0.58559334", "0.5806248", "0.5778933", "0.5771964", "0.5762822", "0.57474977", "0.57438475", "0.57006", "0.5695009", "0.56947756"...
0.7615647
0