query stringlengths 10 2k | document stringlengths 20 51.2k | metadata dict | negatives listlengths 0 101 | negative_scores listlengths 0 101 | document_score stringlengths 3 10 | document_rank stringclasses 102
values |
|---|---|---|---|---|---|---|
Checks if the list of attendees is already at the max of two or not. if it is 2 or more returns False else Returns True | def fully_booked(slots, attendees, user_name):
if len(attendees) >= 2:
return False
else:
return True | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def multiple_elements(self) -> bool:\n return self.max is None or self.max > 1",
"def avoid_lockouts():\n db = get_db()\n if db.count_admins()[0][0] <= 2:\n session[\"last_error\"] = \"There must always be at least two administrators.\"\n return False\n return True",
"def check_in... | [
"0.61904037",
"0.5865448",
"0.5744452",
"0.5662808",
"0.56513345",
"0.5634911",
"0.55982625",
"0.55590326",
"0.5540548",
"0.54946876",
"0.5481779",
"0.5431433",
"0.54163927",
"0.5405624",
"0.5399968",
"0.5345161",
"0.5299087",
"0.5295267",
"0.5284203",
"0.5272406",
"0.5262089... | 0.6482435 | 0 |
Convert B x T x N spiking array to list of list of SpikeTrains | def array_to_spiketrains(array, bin_size):
stList = []
for trial in range(len(array)):
trialList = []
for channel in range(array.shape[2]):
times = np.nonzero(array[trial, :, channel])[0]
counts = array[trial, times, channel].astype(int)
times = np.repeat(time... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def AllSpikeTimes(self):\n blah = []\n for neur in self.neurons:\n blah.append(np.array(neur.spikes))\n\n return blah",
"def get_spikes(self):\n\t\treturn spiketrain.netconvecs_to_listoflists(self.t_vec, self.id_vec)",
"def get_ser_spktimes(self):\n\n spktimes = []\n ... | [
"0.6635745",
"0.6240275",
"0.61314696",
"0.5790735",
"0.5549863",
"0.551168",
"0.54983836",
"0.52512246",
"0.5198188",
"0.5196475",
"0.51318556",
"0.5117125",
"0.51124334",
"0.51006645",
"0.5091186",
"0.5088815",
"0.5072973",
"0.50598484",
"0.503342",
"0.5033251",
"0.5005926"... | 0.76219606 | 0 |
Return absolute url to CV detail view. | def get_absolute_url(self) -> str:
return reverse("cv_detail", kwargs={"pk": self.pk}) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_absolute_url(self):\n\t\treturn reverse('source-detail', args=[str(self.id)])",
"def get_absolute_url(self):\n return reverse('model-detail-view', args=[str(self.id)])",
"def get_absolute_url(self):\n return reverse('model-detail-view', args=[str(self.id)])",
"def get_absolute_url(self)... | [
"0.74260134",
"0.7191693",
"0.7191693",
"0.71504456",
"0.7139805",
"0.71045774",
"0.7075379",
"0.70593375",
"0.6999544",
"0.69966894",
"0.6995822",
"0.696861",
"0.6964831",
"0.69283813",
"0.69094145",
"0.6905474",
"0.68850994",
"0.68841356",
"0.68610203",
"0.6852058",
"0.6846... | 0.83206993 | 0 |
Test if all values in a list are the same. | def all(a: list[int], b: int) -> bool:
i: int = 0
count: int = 0
if len(a) > 0:
while i < len(a):
if a[i] == b:
i = i + 1
count = count + 1
else:
i = i + 1
return(count == (len(a)))
else:
return False | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def all_same(items):\n \n return all(x == items[0] for x in items)",
"def allsame(xs):\n assert len(xs) > 0\n return all(x == xs[0] for x in xs[1:])",
"def all_equal(list_a, list_b):\n if len(list_a) != len(list_b):\n return False\n a, b = np.array(list_a), np.array(list_b)\n return... | [
"0.79327196",
"0.7759456",
"0.7710539",
"0.7323077",
"0.72757673",
"0.7261334",
"0.7170059",
"0.714798",
"0.7137238",
"0.7080371",
"0.69708246",
"0.6967288",
"0.69312894",
"0.6926607",
"0.6760447",
"0.67331886",
"0.67009443",
"0.669559",
"0.6684499",
"0.6673127",
"0.6672735",... | 0.6872738 | 14 |
Test if two lists are equal. | def is_equal(a: list[int], b: list[int]) -> bool:
if len(a) == len(b):
i: int = 0
num: int = 0
while i < len(a):
if a[i] == b[i]:
i = i + 1
num = num + 1
else:
i = i + 1
return (num == len(a))
else:
r... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def lists_are_identical(list1, list2):\n if len(list1) != len(list2):\n return False\n for elem1, elem2 in zip(list1, list2):\n if elem1 != elem2:\n return False\n return True",
"def check_lists_equal(list_1, list_2):\n if len(list_1) != len(list_2):\n return False\n ... | [
"0.8050148",
"0.795216",
"0.7923716",
"0.7885506",
"0.77554893",
"0.77514726",
"0.77004975",
"0.76759654",
"0.76565933",
"0.76510787",
"0.76285315",
"0.7628446",
"0.7615973",
"0.7446495",
"0.73524445",
"0.7341645",
"0.73083687",
"0.7293934",
"0.72229964",
"0.71626365",
"0.716... | 0.7462133 | 13 |
Integration test for the PollSubmissionsAPI.get_single_poll_submission method. | def test_get_single_poll_submission(self):
poll_id = None # Change me!!
poll_session_id = None # Change me!!
id = None # Change me!!
r = self.client.get_single_poll_submission(id, poll_id, poll_session_id) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_get_submission(self):\n # creating a submission\n sub_register = register_ok_submission(self, self.token)\n response_data = json.loads(sub_register.data.decode())\n self.assertTrue(response_data['status']=='success')\n\n # getting it from the service\n get_respons... | [
"0.7200047",
"0.6835982",
"0.66662246",
"0.6508319",
"0.64926606",
"0.63674957",
"0.6353326",
"0.5981093",
"0.5914841",
"0.5853661",
"0.5835057",
"0.5741421",
"0.57390547",
"0.57278484",
"0.5690941",
"0.5687854",
"0.5685843",
"0.5660396",
"0.5650037",
"0.55963063",
"0.5589121... | 0.90001535 | 0 |
Integration test for the PollSubmissionsAPI.create_single_poll_submission method. | def test_create_single_poll_submission(self):
# This method utilises the POST request method and will make changes to the Canvas instance. This needs consideration.
pass | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_get_single_poll_submission(self):\r\n poll_id = None # Change me!!\r\n poll_session_id = None # Change me!!\r\n id = None # Change me!!\r\n\r\n r = self.client.get_single_poll_submission(id, poll_id, poll_session_id)",
"def test_create_valid_submission(self):\n with... | [
"0.7704236",
"0.7161262",
"0.68526036",
"0.6587159",
"0.65351605",
"0.6478243",
"0.6462667",
"0.64272195",
"0.6307725",
"0.62844896",
"0.61493915",
"0.6143455",
"0.6113325",
"0.6042951",
"0.6042555",
"0.6025604",
"0.60094327",
"0.5977124",
"0.59742105",
"0.5967563",
"0.596290... | 0.7503896 | 1 |
If username is specified filter queryset using specified username. | def get_queryset(self):
username = self.kwargs.get('username', None)
filters = {}
if username:
filters['user__username'] = username
return super(PhotosListView, self).get_queryset().filter(**filters) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_queryset(self):\n return filterUsersByName( self.request.query_params.get('username', None) )",
"def filter_queryset(self, request, queryset, view):\n owner = request.query_params.get(\"owner\")\n\n if owner:\n kwargs = {self.owner_prefix + \"__username__iexact\": owner}\n... | [
"0.7783424",
"0.7676567",
"0.7447783",
"0.7443878",
"0.7069866",
"0.70554495",
"0.693029",
"0.6910741",
"0.6878759",
"0.6873855",
"0.68577194",
"0.68160367",
"0.6727521",
"0.670797",
"0.6652041",
"0.6482708",
"0.6447985",
"0.6446765",
"0.6436126",
"0.64279497",
"0.64088374",
... | 0.7891735 | 0 |
Add an undirected edge. | def _add_edge(src, dst):
module_nodes[src].weights[dst] += 1
module_nodes[dst].weights[src] += 1 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_edge(self, edge):\n assert edge not in self.edges\n self.edges.append(edge)",
"def add_edge(self, edge: e.Edge) -> None:\n if edge not in self.edges:\n self.edges.append(edge)\n self.num_edges = self.num_edges + 1",
"def add_edge(self, edge):\n src = ed... | [
"0.7715589",
"0.753145",
"0.74625325",
"0.74353445",
"0.7414551",
"0.7414247",
"0.7314603",
"0.72848487",
"0.727795",
"0.7135868",
"0.7123811",
"0.7120943",
"0.7081886",
"0.7075987",
"0.7072643",
"0.7048393",
"0.7021698",
"0.70116353",
"0.69893205",
"0.6977829",
"0.6975207",
... | 0.0 | -1 |
Calculates the log normalization constant, log_Z, given unnormalized log probabilities, log_x, using the logsumtrick. | def log_norm(log_x):
c = np.max(log_x)
if np.isinf(c):
return c
sum_exp = 0
for x in log_x:
sum_exp += np.exp(x - c)
log_sum_exp = np.log(sum_exp)
log_Z = log_sum_exp + c
return log_Z | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def log_likelihood_z_lognormal(self, std=1.0):\n #return self.log_det_Jxz - self.dim * tf.log(std) - (0.5 / (std**2)) * tf.reduce_sum(self.output_z**2, axis=1)\n from deep_boltzmann.util import logreg\n logz = logreg(self.output_z, a=0.001, tf=True)\n ll = self.log_det_Jxz \\\n ... | [
"0.6869506",
"0.66421324",
"0.66365963",
"0.6549276",
"0.652961",
"0.6515353",
"0.65",
"0.6478182",
"0.64455944",
"0.6443379",
"0.6424068",
"0.6418798",
"0.64151955",
"0.6387212",
"0.63705176",
"0.63390034",
"0.63333",
"0.62909234",
"0.62897927",
"0.6288345",
"0.6261305",
"... | 0.7537182 | 0 |
Returns true if both objects are equal | def __eq__(self, other):
if not isinstance(other, DataPoint):
return False
return self.to_dict() == other.to_dict() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __eq__(self, other):\n return are_equal(self, other)",
"def __eq__(self, other):\n return are_equal(self, other)",
"def __eq__(self,other):\n try: return self.object==other.object and isinstance(self,type(other))\n except: return False",
"def __eq__(self, other):\n if i... | [
"0.8088132",
"0.8088132",
"0.8054589",
"0.7982687",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
... | 0.0 | -1 |
Returns true if both objects are not equal | def __ne__(self, other):
if not isinstance(other, DataPoint):
return True
return self.to_dict() != other.to_dict() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __ne__(self, other: object) -> bool:\n if self.__eq__(other):\n return False\n return True",
"def __ne__(self, other: object) -> bool:\n return not self.__eq__(other)",
"def __ne__(self, other) -> bool:\n return not self.__eq__(other)",
"def __eq__(self, other):\n ... | [
"0.8456063",
"0.83918154",
"0.8144437",
"0.8140196",
"0.8132038",
"0.8093834",
"0.80918837",
"0.80918837",
"0.80918837",
"0.80852824",
"0.80852824",
"0.807626",
"0.807626",
"0.80657643",
"0.8042481",
"0.8042481",
"0.8042481",
"0.8042481",
"0.8042481",
"0.8042481",
"0.8042481"... | 0.0 | -1 |
return number of atoms left to find | def atoms_left(self):
return self._board.get_atoms() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def atoms_left(self):\n return len(self._atoms)",
"def number_of_their_pieces_to_left(column):\n row = __get_top_of_stack(column)\n return number_pieces_of_type_in_direction(column, row, THEM, 'left')",
"def number_of_my_pieces_to_left(column):\n row = __get_top_of_stack(column)\n return num... | [
"0.7787994",
"0.69193316",
"0.66790706",
"0.65533006",
"0.64611953",
"0.6356172",
"0.621692",
"0.6200984",
"0.6110947",
"0.60992104",
"0.608852",
"0.6038207",
"0.6007008",
"0.5966455",
"0.5941084",
"0.5934859",
"0.59157884",
"0.5909284",
"0.5909284",
"0.5891448",
"0.58572674"... | 0.6536144 | 4 |
Compute absolute power for a given frequency band. | def compute_absolute_power(freqs, powers, band, method='sum'):
_, band_powers = trim_spectrum(freqs, powers, band)
abs_power = get_avg_func(method)(band_powers)
return abs_power | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def bin_power(X,Band,Fs):\n\n\tC = fft(X)\n\tC = abs(C)\n\tPower =np.zeros(len(Band)-1);\n\tfor Freq_Index in range(0,len(Band)-1):\n\t\tFreq = float(Band[Freq_Index])\t\t\t\t\t\t\t\t\t\t## Xin Liu\n\t\tNext_Freq = float(Band[Freq_Index+1])\n\t\tPower[Freq_Index] = sum(C[np.floor(Freq/Fs*len(X)):np.floor(Next_Freq... | [
"0.6972529",
"0.6704565",
"0.6651542",
"0.6516684",
"0.64510083",
"0.6313374",
"0.6248831",
"0.6215547",
"0.6153097",
"0.61198866",
"0.61079794",
"0.60727894",
"0.60619545",
"0.6012779",
"0.6010714",
"0.60053337",
"0.5994459",
"0.5989949",
"0.5985031",
"0.59822726",
"0.595556... | 0.7994748 | 0 |
Compute relative power for a given frequency band. | def compute_relative_power(freqs, powers, band, method='sum', norm_range=None):
band_power = compute_absolute_power(freqs, powers, band, method)
total_band = [freqs.min(), freqs.max()] if not norm_range else norm_range
total_power = compute_absolute_power(freqs, powers, total_band, method)
rel_power ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def compute_absolute_power(freqs, powers, band, method='sum'):\n\n _, band_powers = trim_spectrum(freqs, powers, band)\n abs_power = get_avg_func(method)(band_powers)\n\n return abs_power",
"def bin_power(X,Band,Fs):\n\n\tC = fft(X)\n\tC = abs(C)\n\tPower =np.zeros(len(Band)-1);\n\tfor Freq_Index in ran... | [
"0.7281027",
"0.7188749",
"0.6961119",
"0.66847837",
"0.6677346",
"0.6573089",
"0.6551422",
"0.648248",
"0.646264",
"0.6337227",
"0.633642",
"0.632078",
"0.6212797",
"0.6195697",
"0.61818016",
"0.61373585",
"0.6128465",
"0.61104757",
"0.60874563",
"0.6037102",
"0.60302764",
... | 0.7531407 | 0 |
function to return a correctly formatted string according to time units | def __get_elapsed__(self):
elapsed = (self.__end_time - self.__start_time)
unit = "seconds"
if elapsed >= 3600:
unit = "minutes"
hours = elapsed / 3600
minutes = hours % 60
hours = floor(hours)
print("{} {} took {} hours and {:.2f} {} t... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def time_string(time_f: float) -> str:\n m, s = divmod(time_f, 60)\n h, m = divmod(m, 60)\n\n if h < 1:\n if m < 1 and s < 1:\n msec = int(s * 1000)\n return '{:=03d}msec'.format(msec)\n\n if m < 1:\n return '{:=02.0f}sec'.format(s)\n\n return '{:=02.0... | [
"0.74081993",
"0.730702",
"0.72810227",
"0.72358346",
"0.7206118",
"0.7133586",
"0.7096673",
"0.7057163",
"0.70518696",
"0.70483696",
"0.7008116",
"0.6958601",
"0.6932671",
"0.6912538",
"0.69028205",
"0.68994874",
"0.688804",
"0.6887043",
"0.6843166",
"0.68301183",
"0.6826893... | 0.0 | -1 |
Returns the night/day drawing as a string rappresentation | def draw_day(day):
day_drawing = ""
for i in day:
for j in i:
day_drawing += j
return day_drawing | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def draw(self):\n drawing = \"\"\n \n if self.get_gene().get_choice_at(1) is 'c':\n drawing += 'o'\n else:\n drawing += 'x'\n \n if self.is_tft():\n drawing += \"tft\"\n return drawing\n elif self.is_t2t():\n dr... | [
"0.61843455",
"0.6168191",
"0.58917725",
"0.57956755",
"0.5782799",
"0.5765321",
"0.57340854",
"0.5729059",
"0.57141095",
"0.5670516",
"0.56445515",
"0.560948",
"0.5572078",
"0.55634916",
"0.5502877",
"0.54962784",
"0.5486567",
"0.54843634",
"0.5454676",
"0.5424635",
"0.54207... | 0.73240733 | 0 |
Returns a Loader for Proteinnet data. | def make_sequence_coded_loader(specs, root_dir, folder):
folder = os.path.join(root_dir, folder)
coder = get_sequence_coder(specs)
return loaders.TFRecordsLoader(
folder, coder=coder, input_sequence_key='primary', split_folder=False) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_loader(data, json, batch_size, shuffle, num_workers):\n dataset = FinNumDataset(data, json)\n\n data_loader = torch.utils.data.DataLoader(dataset=dataset,\n batch_size=batch_size,\n shuffle=shuffle,\n ... | [
"0.6332217",
"0.62634724",
"0.61852854",
"0.6086656",
"0.606882",
"0.5989849",
"0.5982804",
"0.5961743",
"0.594634",
"0.5926147",
"0.5925229",
"0.59238285",
"0.5891729",
"0.58881116",
"0.5860682",
"0.5858886",
"0.5829586",
"0.581993",
"0.58071643",
"0.58044994",
"0.58015215",... | 0.0 | -1 |
Creates a dataset for pairs of sequences. | def make_pair_builder(
max_len = 512,
index_keys = ('fam_key', 'ci_100'),
process_negatives = True,
gap_token = '-',
sequence_key = 'sequence',
context_sequence_key = 'full_sequence',
loader_cls=make_pfam_pairs_loader,
pairing_cls = None,
lm_cls = None,
has_context = False,
a... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def construct_dataset(tri2index, num_examples=100, qap_path=\"./dataset/qa_pairs.dump\",\n label_path=\"./dataset/labels.dump\"):\n Xpair = []\n Y = []\n with open(DATA_PATH) as f:\n lines = csv.reader(f, delimiter=\"\\t\")\n i = 0\n for line in lines:\n q_processed = char_tri... | [
"0.6545172",
"0.62197435",
"0.62188095",
"0.61163145",
"0.60914636",
"0.6081252",
"0.60545117",
"0.6018699",
"0.59689784",
"0.588158",
"0.58661664",
"0.5863029",
"0.5823172",
"0.5820048",
"0.5816717",
"0.5795029",
"0.5731551",
"0.5699751",
"0.5699295",
"0.56902593",
"0.568102... | 0.5959768 | 9 |
Creates a DatasetBuilder for TAPE's benchmark. | def make_tape_builder(root_dir,
task,
target,
weights = None,
metadata = (),
max_len = 1024,
input_sequence_key = 'primary',
output_sequence_key = 'sequence'):
supp... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def code_builder(request, tmp_path_factory) -> dataset_builder.DatasetBuilder:\n tmp_path = tmp_path_factory.mktemp('tfds_datasets') # Temporary data_dir\n builder_cls = request.param\n # Generate the dataset (only once for all tests as scope == 'module').\n builder = builder_cls(data_dir=tmp_path)\n builder... | [
"0.6708197",
"0.65447235",
"0.65426975",
"0.6500208",
"0.64467674",
"0.63795686",
"0.6232744",
"0.6185569",
"0.6150874",
"0.6150332",
"0.60758334",
"0.6035816",
"0.6028635",
"0.6024262",
"0.60152584",
"0.5985321",
"0.59364384",
"0.592906",
"0.5925502",
"0.5889862",
"0.5887571... | 0.0 | -1 |
t = Qpara B B = R^2 Qperp^2 O = ray.mOrigin D = ray.direction | def rayIntersection(self, ray):
rotVect = ray.mDirection #math3d.VectorN(math.cos(num), - math.sin(num), 0)
# this give all the lines (red green and blue at the moment)
tankPos = math3d.VectorN(ray.mOrigin[0], ray.mOrigin[1], 0)
linkPos = math3d.VectorN(200,200,0)
v = linkPos ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def Trace(o, d, t, n):\n t = 1e9\n m = 0\n p = -o.z/d.z\n\n if p > .01:\n t = p\n n = vector(0, 0, 1)\n m = 1\n\n for k in range(18, -1, -1): # 19 columns of possible spheres\n for j in range(8, -1, -1): # 9 rows of possible spheres\n if G[j] & 1 << k: # is the... | [
"0.62152076",
"0.60660017",
"0.5985607",
"0.5819461",
"0.57935864",
"0.5766975",
"0.574134",
"0.56880707",
"0.5600058",
"0.55571586",
"0.55486065",
"0.55404353",
"0.5522175",
"0.55202556",
"0.5518844",
"0.5466992",
"0.5435933",
"0.5434197",
"0.5434197",
"0.5416978",
"0.539201... | 0.639814 | 0 |
Sets the velocity to turn left | def leftTurn(self):
#print('leftTurn\r')
self.linearVector = Vector3(x=0.0, y=0.0, z=0.0)
self.angularVector = Vector3(x=0.0, y=0.0, z=1.0) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_left(self, spd):\n self.l_motor.set(-spd)",
"def turn_left(self):\n temp = self.direction[0]\n self.direction[0] = self.direction[1]\n self.direction[1] = -temp",
"def turn_left(self):\n self.facing_direction -= self.config\n if self.facing_direction < 0:\n ... | [
"0.7918996",
"0.7837241",
"0.77819127",
"0.77753913",
"0.7692132",
"0.7628831",
"0.759747",
"0.7563958",
"0.7562101",
"0.7503081",
"0.7468251",
"0.74610406",
"0.7437499",
"0.740001",
"0.73986924",
"0.73849255",
"0.7364883",
"0.73267883",
"0.72989076",
"0.7298588",
"0.72568417... | 0.75085294 | 9 |
Sets the velocity to turn right | def rightTurn(self):
#print('rightTurn\r')
#self.linearVector = Vector3(x=0.0, y=0.0, z=0.0)
#self.angularVector = Vector3(x=0.0, y=0.0, z=-1.0)
self.linearVector = Vector3(x=0.0, y=0.0, z=0.0)
self.angularVector = Vector3(x=0.0, y=0.0, z=-1.0) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_velocity(self):\r\n if self.direction == 'left':\r\n self.x_vel = -2\r\n else:\r\n self.x_vel = 2\r\n\r\n self.y_vel = 0",
"def set_right(self, spd):\n self.r_motor.set(spd)",
"def move_right(self):\n\t\tself.set_x_vector(constants.DONKEY_SPEED)",
"de... | [
"0.78326285",
"0.7739582",
"0.76157516",
"0.7586903",
"0.7522241",
"0.7473256",
"0.74609554",
"0.7428814",
"0.73555315",
"0.731739",
"0.73055464",
"0.7286651",
"0.7267498",
"0.7233877",
"0.7176409",
"0.71329767",
"0.70618576",
"0.6994376",
"0.698244",
"0.69714355",
"0.695394"... | 0.7026157 | 17 |
Returns the information about endpoints associated with this USB device. | def get_endpoints(self):
url = self.urlobject_single.format(self._cb.credentials.org_key, self._model_unique_id) + "/endpoints"
resp = self._cb.get_object(url)
return resp.get("results", []) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def endpoints(self):\n config = self.device.get_active_configuration()\n interface = config.interfaces()[0]\n endpoints = interface.endpoints()\n return [endpoint.bEndpointAddress for endpoint in endpoints]",
"def endpoint_list(self):\n _, body = self.request('/v1.1/endpoints',... | [
"0.74174196",
"0.7105507",
"0.70371133",
"0.702733",
"0.6797197",
"0.6618535",
"0.6580247",
"0.6565772",
"0.65500146",
"0.6488439",
"0.64632916",
"0.6346078",
"0.6344179",
"0.6342904",
"0.6342904",
"0.61728793",
"0.6154563",
"0.6143042",
"0.59707755",
"0.59422445",
"0.5888933... | 0.66074514 | 6 |
Creates the request body for an API call. | def _build_request(self, from_row, max_rows):
request = {"criteria": self._criteria, "query": self._query_builder._collapse(), "rows": 100}
# Fetch 100 rows per page (instead of 10 by default) for better performance
if from_row > 0:
request["start"] = from_row
if max_rows >= ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def build_request(input_id, method, params=None):\n request = {\"method\": method, \"id\": input_id}\n if params is not None:\n request[\"params\"] = params\n return request",
"def _build_payload(self, body: Dict) -> Dict[str, Any]:\n return {'jsonrpc': '2.0',\n ... | [
"0.6778558",
"0.66649634",
"0.65509325",
"0.6462832",
"0.6453199",
"0.63767964",
"0.63277674",
"0.6322554",
"0.6267844",
"0.62510985",
"0.61747557",
"0.6141499",
"0.60786194",
"0.606077",
"0.59978074",
"0.5974254",
"0.5960719",
"0.594257",
"0.5890512",
"0.58642787",
"0.583502... | 0.0 | -1 |
Returns the number of results from the run of this query. | def _count(self):
if self._count_valid:
return self._total_results
url = self._build_url("/_search")
request = self._build_request(0, -1)
resp = self._cb.post_object(url, body=request)
result = resp.json()
self._total_results = result["num_found"]
se... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _get_count(results):\n return len(results)",
"def count(self):\n if self._result_cache is not None:\n return len(self._result_cache)\n\n return self.query.get_count(using=self.db)",
"def _count(self):\n if self._count_valid:\n return self._total_results\n\n... | [
"0.8120749",
"0.80669725",
"0.79499996",
"0.7821195",
"0.7734843",
"0.7722192",
"0.772169",
"0.77055067",
"0.7663306",
"0.7647142",
"0.7633277",
"0.7576346",
"0.7541784",
"0.74820775",
"0.7441771",
"0.7400129",
"0.73268664",
"0.7296856",
"0.72712904",
"0.72490925",
"0.7238945... | 0.7593024 | 12 |
Returns the number of results from the run of this query. | def _count(self):
if self._count_valid:
return self._total_results
result = self._cb.get_object(self._doc_class.urlobject.format(self._cb.credentials.org_key))
results = result.get("results", [])
self._total_results = len(results)
self._count_valid = True
r... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _get_count(results):\n return len(results)",
"def count(self):\n if self._result_cache is not None:\n return len(self._result_cache)\n\n return self.query.get_count(using=self.db)",
"def count(self):\n self._fetch_if_needed()\n return len(self._result_cache.get... | [
"0.8120749",
"0.80669725",
"0.7821195",
"0.7734843",
"0.7722192",
"0.772169",
"0.77055067",
"0.7663306",
"0.7647142",
"0.7633277",
"0.7593024",
"0.7593024",
"0.7576346",
"0.7541784",
"0.74820775",
"0.7441771",
"0.7400129",
"0.73268664",
"0.7296856",
"0.72712904",
"0.72490925"... | 0.79499996 | 2 |
Creates the request body for an API call. | def _build_request(self, from_row, max_rows, add_sort=True):
request = {"criteria": self._criteria, "query": self._query_builder._collapse(), "rows": 100}
# Fetch 100 rows per page (instead of 10 by default) for better performance
if from_row > 0:
request["start"] = from_row
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def build_request(input_id, method, params=None):\n request = {\"method\": method, \"id\": input_id}\n if params is not None:\n request[\"params\"] = params\n return request",
"def _build_payload(self, body: Dict) -> Dict[str, Any]:\n return {'jsonrpc': '2.0',\n ... | [
"0.6778558",
"0.66649634",
"0.65509325",
"0.6462832",
"0.6453199",
"0.63767964",
"0.63277674",
"0.6322554",
"0.6267844",
"0.62510985",
"0.61747557",
"0.6141499",
"0.60786194",
"0.606077",
"0.59978074",
"0.5974254",
"0.5960719",
"0.594257",
"0.5890512",
"0.58642787",
"0.583502... | 0.0 | -1 |
Returns the number of results from the run of this query. | def _count(self):
if self._count_valid:
return self._total_results
url = self._build_url("/_search")
request = self._build_request(0, -1)
resp = self._cb.post_object(url, body=request)
result = resp.json()
self._total_results = result["num_found"]
se... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _get_count(results):\n return len(results)",
"def count(self):\n if self._result_cache is not None:\n return len(self._result_cache)\n\n return self.query.get_count(using=self.db)",
"def _count(self):\n if self._count_valid:\n return self._total_results\n\n... | [
"0.8120749",
"0.80669725",
"0.79499996",
"0.7821195",
"0.7734843",
"0.7722192",
"0.772169",
"0.77055067",
"0.7663306",
"0.7647142",
"0.7633277",
"0.7576346",
"0.7541784",
"0.74820775",
"0.7441771",
"0.7400129",
"0.73268664",
"0.7296856",
"0.72712904",
"0.72490925",
"0.7238945... | 0.7593024 | 11 |
return area of square | def area(self):
return (self.__size * self.__size) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def square_area(side):\n return side**2",
"def area(width, height):\n return width * height",
"def rectangle_area(width : number, height : number) ->number:\n area = width*height\n #print(\"The area of rectangle is =\", area, \"sq. units\")\n return area",
"def findArea(self):\n\n a, b ... | [
"0.848162",
"0.808561",
"0.7996612",
"0.7980673",
"0.794937",
"0.7846778",
"0.78445286",
"0.77925104",
"0.77364826",
"0.7724786",
"0.7721174",
"0.76963574",
"0.7693336",
"0.7686266",
"0.7671087",
"0.7667258",
"0.7663102",
"0.766129",
"0.7659378",
"0.7633858",
"0.7628316",
"... | 0.7382213 | 76 |
get the index in the string like 'a[4]'. should return 4 | def get_index(s):
return int(s[s.find("[")+1:s.find("]")]) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index(self, sub, start=0):\n br = \"([{\"[\")]}\".index(sub)]\n count = 0\n for i in range(start, len(self.string)):\n char = self.string[i]\n if char == br:\n count += 1\n elif char == sub:\n if count > 0:\n ... | [
"0.7562582",
"0.74769616",
"0.74769616",
"0.74769616",
"0.72326404",
"0.7031795",
"0.69796354",
"0.69796354",
"0.6934158",
"0.6891498",
"0.68310076",
"0.6678445",
"0.6615438",
"0.65954286",
"0.65667486",
"0.6527535",
"0.6527535",
"0.6527535",
"0.6527535",
"0.6488057",
"0.6423... | 0.85058874 | 0 |
Read input file and split into individual lines returned as a list. | def read_input():
return Path(__file__).with_name('input.txt').read_text().splitlines() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def read_input():\n splits = []\n with open('solutions/day5/input.txt') as f:\n for line in f:\n splits.append(line.strip('\\n'))\n return splits",
"def readfile(input_file):\n lines = []\n with open(input_file, 'r') as file:\n for line in file:\n lines.append(l... | [
"0.7933755",
"0.76459146",
"0.75303054",
"0.7522867",
"0.74207646",
"0.73894465",
"0.7384803",
"0.7332533",
"0.7320009",
"0.731461",
"0.72621137",
"0.72603494",
"0.7237726",
"0.7231719",
"0.72149503",
"0.71747655",
"0.7168156",
"0.71529174",
"0.7143289",
"0.7119387",
"0.70991... | 0.0 | -1 |
Determine the shortest distance between origin and target. | def __distance(self, origin, target):
marked = {}
for distance, wave in self.__walk(marked, origin):
if target in wave:
return distance | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def distance( self, source, target ):\n return nx.shortest_path_length(self._G, source, target)",
"def min_distance(self, target):\n difference = self.pivot - target\n return max(math.sqrt(np.dot(difference, difference)) - self.radius, 0)",
"def distance(self, source, target):\r\n r... | [
"0.7487452",
"0.72492313",
"0.7227116",
"0.7084744",
"0.69360435",
"0.6666403",
"0.6575045",
"0.6552324",
"0.6544829",
"0.65137935",
"0.64617246",
"0.64568794",
"0.64327425",
"0.64292663",
"0.63877165",
"0.6338233",
"0.6324244",
"0.6322852",
"0.6322852",
"0.6322852",
"0.63228... | 0.68076897 | 5 |
Delete config item from config object. | def delete_config(self, trigger_id: int, message: str, status: bool | str):
try:
# always delete config from configs dict, even when status is False
del self.configs[trigger_id]
# send ack response
self.message_broker.publish(
json.dumps(
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def remove_config(name):\n db = dbm.open(config_file, 'c')\n del db[name]\n db.close()",
"async def websocket_lovelace_delete_config(\n hass: HomeAssistant,\n connection: websocket_api.ActiveConnection,\n msg: dict[str, Any],\n config: LovelaceStorage,\n) -> None:\n await config.async_del... | [
"0.66137403",
"0.6554389",
"0.65453005",
"0.65028435",
"0.64827734",
"0.6475502",
"0.64441335",
"0.6433945",
"0.6428989",
"0.6420533",
"0.6415613",
"0.6363866",
"0.6352929",
"0.624367",
"0.62165505",
"0.6143542",
"0.612744",
"0.6125347",
"0.6119576",
"0.610561",
"0.6063677",
... | 0.60072 | 29 |
Return the current thread trigger id. | def thread_trigger_id(self) -> str | None:
trigger_id = None
if hasattr(threading.current_thread(), 'trigger_id'):
trigger_id = threading.current_thread().trigger_id # type: ignore
return trigger_id | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def trigger_id(self) -> pulumi.Output[str]:\n return pulumi.get(self, \"trigger_id\")",
"def trigger_id(self) -> pulumi.Input[str]:\n return pulumi.get(self, \"trigger_id\")",
"def thread_id(self):\n return self._thread_id",
"def get_callback_trigger(callback_context):\n if not callba... | [
"0.7798",
"0.76527035",
"0.7317515",
"0.712101",
"0.7094805",
"0.7094805",
"0.7082401",
"0.68381244",
"0.65903133",
"0.65830827",
"0.6557263",
"0.65261734",
"0.642849",
"0.6210632",
"0.61608005",
"0.61219513",
"0.61097187",
"0.6040022",
"0.6003038",
"0.5989465",
"0.5985175",
... | 0.9193366 | 0 |
Convert so3 angles to rotation matrix. | def so2mat(angle):
return torch.Tensor(R.from_rotvec(angle).as_dcm()) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def rotation_matrix3(angle_x=0, angle_y=0, angle_z=0):\n if angle_x != 0:\n c, s = cos(angle_x), sin(angle_x)\n r = np.array([[1, 0, 0], [0, c, -s], [0, s, c]])\n else:\n r = np.identity(3)\n\n if angle_y != 0:\n c, s = cos(angle_y), sin(angle_y)\n r = r.dot(np.array([[c... | [
"0.7303343",
"0.7036405",
"0.68276674",
"0.6813411",
"0.68068814",
"0.67891926",
"0.674378",
"0.6732721",
"0.6723318",
"0.666609",
"0.66092",
"0.65829754",
"0.6566218",
"0.6562964",
"0.6532248",
"0.65248007",
"0.65110326",
"0.64993733",
"0.6491088",
"0.64838874",
"0.64398336"... | 0.6769727 | 6 |
Convert quaternion coefficients to rotation matrix. | def quat2mat(quat):
norm_quat = torch.cat([quat[:,:1].detach()*0 + 1, quat], dim=1)
norm_quat = norm_quat/norm_quat.norm(p=2, dim=1, keepdim=True)
w, x, y, z = norm_quat[:,0], norm_quat[:,1], norm_quat[:,2], norm_quat[:,3]
B = quat.size(0)
w2, x2, y2, z2 = w.pow(2), x.pow(2), y.pow(2), z.pow(2)
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def quaternion_to_rotation_matrix(quaternion):\n\n q_w, q_x, q_y, q_z = quaternion\n sqw, sqx, sqy, sqz = np.square(quaternion)\n norm = (sqx + sqy + sqz + sqw)\n rotation_matrix = np.zeros((3, 3))\n\n # division of square length if quaternion is not already normalized\n rotation_matrix[0, 0] = (... | [
"0.7666401",
"0.7480785",
"0.74480975",
"0.7431791",
"0.7220662",
"0.72003317",
"0.7190068",
"0.7073628",
"0.6941468",
"0.6884496",
"0.6882422",
"0.6881994",
"0.685318",
"0.68479955",
"0.68037885",
"0.67919123",
"0.677245",
"0.6759796",
"0.672846",
"0.670579",
"0.66775787",
... | 0.66371685 | 24 |
Function pulls given block by a filled cell. Does not check whether such a cell exists. WARNING! Function will modify provided block_origins. | def pull_single_block_origin(line, hints, block_origins, block_index):
# renamed to make code more clear
i = block_index
# cells between given and following blocks
cells = line[block_origins[i] + hints[i] : block_origins[i + 1]]
# shift stores distance of pulling cell from the next block origin
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def pull_block_origins(line, hints, block_origins):\n sth_changed = False\n i = len(hints) - 1\n\n # Adding virtual block for sake of simplicity of procedure that measures distance\n block_origins += [len(line)]\n\n # backward loop\n while i >= 0:\n # Checking if there is a filled cell to ... | [
"0.6357684",
"0.59497744",
"0.5851155",
"0.5712221",
"0.5639708",
"0.5572917",
"0.55506146",
"0.5548317",
"0.55184174",
"0.55102384",
"0.542985",
"0.53934205",
"0.53837204",
"0.53770876",
"0.5325574",
"0.53086936",
"0.52824384",
"0.52819586",
"0.5263595",
"0.5254023",
"0.5252... | 0.6856388 | 0 |
Fills range of cells in given row with value. | def fill_range_in_row(nonogram, row, cols, value):
sth_changed = False
for col in cols:
change = nonogram.fill_cell(row, col, value)
sth_changed = sth_changed or change
return sth_changed | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def fill_row(row, x):\n row.append(x)\n return row",
"def fill_beggining_of_the_row(nonogram, row):\n origin = nonogram.limits.get_row_origins(row, 0)\n sth_changed = fill_range_in_row(nonogram, row, range(origin), -1)\n return sth_changed",
"def fill_end_of_the_row(nono, row):\n ending = non... | [
"0.6901726",
"0.67603964",
"0.6712883",
"0.6513157",
"0.6376576",
"0.63284796",
"0.62018985",
"0.6132792",
"0.6117405",
"0.60343564",
"0.5969705",
"0.59643215",
"0.59602016",
"0.5958107",
"0.59546375",
"0.5933502",
"0.59217536",
"0.58828306",
"0.585422",
"0.5847416",
"0.58251... | 0.7609713 | 0 |
creates a grid of 3 by 3 buttons | def create_button_block(self):
self.btn_compare = QPushButton(self.centralWidget)
self.btn_display = QPushButton(self.centralWidget)
self.btn_display_hist = QPushButton(self.centralWidget)
self.btn_display_color_hist = QPushButton(self.centralWidget)
self.btn_equalize_hist = QPu... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def place_buttons(self):\n grid_size = 3\n button_index = 0\n for i in range(grid_size):\n for j in range(grid_size):\n self.button_list[button_index].grid(row=i, column=j)\n button_index += 1",
"def create_buttons(self):\r\n # The buttons are ... | [
"0.7928839",
"0.7050406",
"0.6995399",
"0.6971877",
"0.6957596",
"0.684827",
"0.6815491",
"0.68148774",
"0.67573696",
"0.67534786",
"0.66796434",
"0.66698825",
"0.6654223",
"0.6618598",
"0.65823615",
"0.65545857",
"0.65486366",
"0.6516855",
"0.6513423",
"0.6503978",
"0.648822... | 0.6314245 | 26 |
Setup all button properties for the button block | def setup_button_block(self):
self.btn_contrast_invert.setText("Contrast Invert")
self.btn_display.setText("Display")
self.btn_display_hist.setText("Display HIST")
self.btn_display_color_hist.setText("Display Color HIST")
self.btn_compare.setText("Compare")
self.btn_equal... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def setupButtons(self):\n self.addLayerButton.setAccessibleName('editLayer')\n self.addLayerButton.setText('+')\n self.deleteLayerButton.setAccessibleName('editLayer')\n self.deleteLayerButton.setText('-')\n self.downButton.setArrowType(QtCore.Qt.DownArrow)\n self.upButton... | [
"0.7091749",
"0.69423735",
"0.6903317",
"0.68505293",
"0.6784523",
"0.66383207",
"0.66030973",
"0.6561269",
"0.6548172",
"0.6545403",
"0.64649206",
"0.6463134",
"0.6460634",
"0.64436734",
"0.6409633",
"0.6388422",
"0.6386667",
"0.63320285",
"0.6331354",
"0.63073164",
"0.62891... | 0.7249665 | 0 |
Return object representing WeMo device running at host, else None. | def device_from_description(description_url, mac, rediscovery_enabled=True):
xml = requests.get(description_url, timeout=10)
parsed = deviceParser.parseString(
xml.content, silence=True, print_warnings=False
)
uuid = parsed.device.UDN
device_mac = mac or parsed.device.macAddress
if devi... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def device(self):\n hw = self.hw()\n if hw: return hw.device()",
"def host():\n return platform.node()",
"def device(self):\n return self.broker.device(**{\"VirtualNetworkMemberID\": self.VirtualNetworkMemberID})",
"def device(self):\n return self.broker.device(**{\"DeviceRoute... | [
"0.71589",
"0.7055734",
"0.6816907",
"0.67347395",
"0.6731842",
"0.6657487",
"0.65801215",
"0.64711803",
"0.6440972",
"0.6404929",
"0.64025617",
"0.64025617",
"0.64025617",
"0.64025617",
"0.64025617",
"0.638599",
"0.6375779",
"0.6370146",
"0.63296145",
"0.62768793",
"0.625381... | 0.0 | -1 |
Determine device class based on the device uuid. | def device_from_uuid_and_location(
uuid, mac, location, rediscovery_enabled=True
):
if uuid is None:
return None
if uuid.startswith('uuid:Socket'):
return Switch(
url=location, mac=mac, rediscovery_enabled=rediscovery_enabled
)
if uuid.startswith('uuid:Lightswitch'):
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def device_class(self):\n return SENSOR_TYPES[self.sensor][3].get(\"device_class\")",
"def device_class(self):\n try:\n return DEVICE_CLASS_MAP[self._sensor]\n except KeyError:\n # Sensor must be unknown to us, add as generic\n return None",
"def device_cla... | [
"0.7355197",
"0.7295222",
"0.71582663",
"0.7156365",
"0.71196604",
"0.71065533",
"0.70995384",
"0.7069485",
"0.7024665",
"0.7022002",
"0.7022002",
"0.6985237",
"0.696646",
"0.696646",
"0.6959086",
"0.6952265",
"0.69314086",
"0.69314086",
"0.69314086",
"0.69314086",
"0.6931408... | 0.6940616 | 16 |
A helper that returns a `datetime.tzinfo` instance for zonelabel. Returns the global document timezone if zonelabel is None. | def _get_tzinfo(zonelabel):
return moment.tzinfo(zonelabel) if zonelabel else _get_global_tz() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_timezone(timezone: str=None) -> datetime.tzinfo:\n if timezone[0] in ('+', '-'):\n timezone = 'UTC' + timezone\n result = tz.gettz(timezone)\n if result is not None and not hasattr(result, '_timezone_'):\n setattr(result, '_timezone_', timezone[3:] if timezone.startswith('UTC') and l... | [
"0.64441943",
"0.64333373",
"0.64021105",
"0.63768786",
"0.6285716",
"0.62819356",
"0.628071",
"0.618056",
"0.6122018",
"0.612127",
"0.6115363",
"0.6093125",
"0.6044972",
"0.5957528",
"0.59141284",
"0.5908335",
"0.59024966",
"0.5888758",
"0.5872539",
"0.5840317",
"0.5820211",... | 0.8520105 | 0 |
Returns the value converted to a python `datetime` object. The value may be a `string`, `date` (interpreted as midnight on that day), `time` (interpreted as a timeofday today), or an existing `datetime`. The returned `datetime` will have its timezone set to the `tz` argument, or the document's default timezone when `tz... | def DTIME(value, tz=None):
value = _make_datetime(value)
return value if value.tzinfo else value.replace(tzinfo=_get_tzinfo(tz)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def dt(*args, **kwargs):\n \n if 'tz' in kwargs:\n tzinfo = kwargs.pop('tz')\n else:\n tzinfo = kwargs.pop('tzinfo', None)\n \n offset_s = kwargs.pop('offset_s', None) \n trustme = kwargs.pop('trustme', False)\n \n if kwargs:\n raise Exception('Unhandled arg: ... | [
"0.5978732",
"0.596976",
"0.5952798",
"0.5785819",
"0.5731139",
"0.5634379",
"0.5605335",
"0.5604147",
"0.5586838",
"0.5537046",
"0.552282",
"0.54785496",
"0.5458246",
"0.5435604",
"0.5390738",
"0.5371343",
"0.53705364",
"0.53035605",
"0.52917314",
"0.5276213",
"0.5190591",
... | 0.718539 | 0 |
Converts a provided Excel serial number representing a date into a `datetime` object. Value is interpreted as the number of days since December 30, 1899. (This corresponds to Google Sheets interpretation. Excel starts with Dec. 31, 1899 but wrongly considers 1900 to be a leap year. Excel for Mac should be configured to... | def XL_TO_DATE(value, tz=None):
return DTIME(_excel_date_zero, tz) + datetime.timedelta(days=value) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def DATE_TO_XL(date_value):\n # If date_value is `naive` it's ok to pass tz to both DTIME as it won't affect the\n # result.\n return (DTIME(date_value) - DTIME(_excel_date_zero)).total_seconds() / 86400.",
"def _date_to_datetime(value):\r\n assert isinstance(value, datetime.date)\r\n return datetime.da... | [
"0.59352523",
"0.5881753",
"0.5760216",
"0.5667858",
"0.5652631",
"0.5641567",
"0.549765",
"0.5468661",
"0.5413875",
"0.53976446",
"0.53400844",
"0.53026104",
"0.5266793",
"0.52370906",
"0.51998365",
"0.5197076",
"0.5138759",
"0.51282513",
"0.5088089",
"0.506975",
"0.5023636"... | 0.71413636 | 0 |
Returns the `datetime.datetime` object that represents a particular date. The DATE function is most useful in formulas where year, month, and day are formulas, not constants. If year is between 0 and 1899 (inclusive), adds 1900 to calculate the year. >>> DATE(108, 1, 2) datetime.date(2008, 1, 2) >>> DATE(2008, 1, 2) da... | def DATE(year, month, day):
if year < 1900:
year += 1900
norm_month = (month - 1) % 12 + 1
norm_year = year + (month - 1) // 12
return datetime.date(norm_year, norm_month, 1) + datetime.timedelta(days=day - 1) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def Date(year, month, day):\r\n return datetime.datetime(year, month, day, 0, 0)",
"def DATE(\n year: func_xltypes.XlNumber,\n month: func_xltypes.XlNumber,\n day: func_xltypes.XlNumber\n) -> func_xltypes.XlDateTime:\n if not (0 < year < 9999):\n raise xlerrors.NumExcelError(\n ... | [
"0.6480248",
"0.6112243",
"0.6031186",
"0.5973777",
"0.5922934",
"0.58237445",
"0.5612745",
"0.55947435",
"0.55585784",
"0.5503027",
"0.53839946",
"0.5365321",
"0.53421164",
"0.5290297",
"0.5262892",
"0.5215732",
"0.517826",
"0.5163634",
"0.51553595",
"0.5132114",
"0.51218146... | 0.66331196 | 0 |
Returns the day of a date, as an integer ranging from 1 to 31. Same as `date.day`. >>> DAY(DATE(2011, 4, 15)) 15 >>> DAY("5/31/2012") 31 >>> DAY(datetime.datetime(1900, 1, 1)) 1 | def DAY(date):
return _make_datetime(date).day | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def date_day(date):\n return date_day_of_month(date)",
"def get_date_day(date):\n cut_date = date.split('-')\n return cut_date[2]",
"def get_day(dt):\n return datetime(dt.year, dt.month, dt.day)",
"def day(self) -> int:\n return pulumi.get(self, \"day\")",
"def DAY(\n seri... | [
"0.6782707",
"0.66041857",
"0.6559046",
"0.6497287",
"0.6475629",
"0.6458041",
"0.64157504",
"0.62817293",
"0.6148048",
"0.6134222",
"0.60208803",
"0.6002774",
"0.599202",
"0.5956689",
"0.5846521",
"0.5842826",
"0.58177567",
"0.58072394",
"0.5796168",
"0.5793315",
"0.5793315"... | 0.8205814 | 0 |
Returns the number of days between two dates. Same as `(end_date start_date).days`. >>> DAYS("3/15/11","2/1/11") 42 >>> DAYS(DATE(2011, 12, 31), DATE(2011, 1, 1)) 364 >>> DAYS("2/1/11", "3/15/11") 42 | def DAYS(end_date, start_date):
return (_make_datetime(end_date) - _make_datetime(start_date)).days | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def DAYS(\n end_date: func_xltypes.XlDateTime,\n start_date: func_xltypes.XlDateTime\n) -> func_xltypes.XlNumber:\n\n days = end_date - start_date\n return days",
"def get_num_of_days(start, end):\n\n start = clean_date(start)\n end = clean_date(end)\n # print(date(start[0], start[1]... | [
"0.7820396",
"0.7437917",
"0.73839575",
"0.71328914",
"0.6852885",
"0.66350245",
"0.6630107",
"0.654725",
"0.6500401",
"0.6486331",
"0.6427065",
"0.64036584",
"0.6396815",
"0.6379225",
"0.637578",
"0.6350784",
"0.62399256",
"0.62288904",
"0.6123608",
"0.61039495",
"0.6074624"... | 0.82633954 | 0 |
Returns the date that is the given number of months before or after `start_date`. Use EDATE to calculate maturity dates or due dates that fall on the same day of the month as the date of issue. >>> EDATE(DATE(2011, 1, 15), 1) datetime.date(2011, 2, 15) >>> EDATE(DATE(2011, 1, 15), 1) datetime.date(2010, 12, 15) >>> EDA... | def EDATE(start_date, months):
return DATE(start_date.year, start_date.month + months, start_date.day) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def EDATE(\n start_date: func_xltypes.XlDateTime,\n months: func_xltypes.XlNumber\n) -> func_xltypes.XlDateTime:\n delta = relativedelta(months=int(months))\n edate = utils.number_to_datetime(int(start_date)) + delta\n\n if edate <= utils.EXCEL_EPOCH:\n raise xlerrors.NumExcelError(\n... | [
"0.6652276",
"0.66249144",
"0.6584477",
"0.63288194",
"0.59961796",
"0.5921313",
"0.5789182",
"0.5787616",
"0.57874745",
"0.5766367",
"0.5684027",
"0.560437",
"0.5586849",
"0.55648196",
"0.55558467",
"0.5462863",
"0.54055744",
"0.5399718",
"0.5399031",
"0.53775513",
"0.535124... | 0.63633984 | 3 |
Returns the date for the last day of the month that is the indicated number of months before or after start_date. Use EOMONTH to calculate maturity dates or due dates that fall on the last day of the month. >>> EOMONTH(DATE(2011, 1, 1), 1) datetime.date(2011, 2, 28) >>> EOMONTH(DATE(2011, 1, 15), 3) datetime.date(2010,... | def EOMONTH(start_date, months):
return DATE(start_date.year, start_date.month + months + 1, 1) - datetime.timedelta(days=1) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def floor_end_month(date):\n return datetime(date.year, date.month, 1) + timedelta(days=-1)",
"def EOMONTH(\n start_date: func_xltypes.XlDateTime,\n months: func_xltypes.XlNumber\n) -> func_xltypes.XlNumber:\n delta = relativedelta(months=int(months))\n edate = utils.number_to_datetime(int... | [
"0.74331075",
"0.7161353",
"0.71024346",
"0.71024346",
"0.69419914",
"0.68723845",
"0.6739291",
"0.65699154",
"0.6539949",
"0.6533371",
"0.63515025",
"0.62497467",
"0.6220156",
"0.61662126",
"0.61246115",
"0.6108943",
"0.60378706",
"0.6033067",
"0.5898359",
"0.58186233",
"0.5... | 0.75836 | 0 |
Returns the minutes of `datetime`, as an integer from 0 to 59. Same as `time.minute`. >>> MINUTE(XL_TO_DATE(0.75)) 0 | def MINUTE(time):
return _make_datetime(time).minute | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def date_minute(date):\n return date.minute",
"def get_minutes(self, datetime):\n return datetime.hour*60.0+datetime.minute+datetime.second/60",
"def getMinute(self):\n return _libsbml.Date_getMinute(self)",
"def calculate_minutes(time):\n return int(time / 60)",
"def get_minute(time):\... | [
"0.7553343",
"0.7258411",
"0.6775327",
"0.65043545",
"0.6425684",
"0.6377923",
"0.6360696",
"0.6269191",
"0.5930573",
"0.58651865",
"0.5857546",
"0.5801824",
"0.57463276",
"0.5732889",
"0.5708836",
"0.5708836",
"0.5708836",
"0.5708836",
"0.56799865",
"0.5649938",
"0.5616779",... | 0.7378957 | 1 |
Returns the month of a date represented, as an integer from from 1 (January) to 12 (December). Same as `date.month`. >>> MONTH(DATE(2011, 4, 15)) 4 >>> MONTH("5/31/2012") 5 >>> MONTH(datetime.datetime(1900, 1, 1)) 1 | def MONTH(date):
return _make_datetime(date).month | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def date_month(date):\n return date.month",
"def getMonth(self):\n return _libsbml.Date_getMonth(self)",
"def get_month_from_date(raw_format_date):\n date = None\n for pattern in NAMCS_DATASET_MONTH_PATTERNS:\n try:\n date = datetime.strptime(raw_format_date, pattern)\n ... | [
"0.7785277",
"0.68906385",
"0.6764306",
"0.6687568",
"0.6668251",
"0.66625816",
"0.664465",
"0.65658",
"0.64961636",
"0.64381844",
"0.6374335",
"0.6355647",
"0.6355647",
"0.63265693",
"0.62774414",
"0.61870104",
"0.6186461",
"0.6068266",
"0.60463196",
"0.60381514",
"0.6030791... | 0.84682864 | 0 |
Returns the seconds of `datetime`, as an integer from 0 to 59. Same as `time.second`. >>> SECOND(XL_TO_DATE(0.75)) 0 | def SECOND(time):
return _make_datetime(time).second | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def date_second(date):\n return date.second",
"def t_sec(self):\n return self.t/self.parameters['time_conversion']",
"def getSecondsFromStringDateTime(date_time):\n split_date_time = date_time.split(Constants.record_name_sep)\n if len(split_date_time) == 5:\n for value in split_date_time... | [
"0.71172655",
"0.69800633",
"0.6809895",
"0.66731656",
"0.65281624",
"0.648903",
"0.64729464",
"0.6376029",
"0.63417864",
"0.63134426",
"0.62729645",
"0.62546057",
"0.6135953",
"0.6134297",
"0.6122239",
"0.6091404",
"0.6067622",
"0.6044824",
"0.6044824",
"0.6043757",
"0.60228... | 0.7241524 | 0 |
Returns the `date` object for the current date. | def TODAY():
return datetime.date.today() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_today() -> datetime.date:\n return datetime.date.today()",
"def get_current_date():\n return datetime.datetime.today().strftime(constants.DATE_FORMAT)",
"def get_today_date():\n return date.today()",
"def _today() -> datetime.date:\n return datetime.today().date()",
"def today(cls, ... | [
"0.74973476",
"0.7417259",
"0.73899525",
"0.73160225",
"0.7120834",
"0.70914125",
"0.70794374",
"0.70471233",
"0.70375025",
"0.7019758",
"0.6977894",
"0.6969594",
"0.6888759",
"0.6795795",
"0.67842907",
"0.67793673",
"0.67453766",
"0.67191076",
"0.67091715",
"0.6680545",
"0.6... | 0.6429084 | 29 |
Returns JSON file as Python dictionary | def get_file(file):
with open(file) as data_file:
return json.load(data_file) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def read_json_file(self, fname):\n return {}",
"def json_dict(path):\n json_file=open(path)\n json_str = json_file.read()\n json_data = json.loads(json_str)\n return json_data",
"def json_dict(path):\n json_file=open(path)\n json_str = json_file.read()\n json_data = loads(json_str)\... | [
"0.813493",
"0.80458456",
"0.80046976",
"0.7922643",
"0.78812313",
"0.77656406",
"0.77611065",
"0.7749161",
"0.7727524",
"0.7631697",
"0.75862455",
"0.7573287",
"0.755285",
"0.7548609",
"0.7543973",
"0.75366026",
"0.7518686",
"0.7511323",
"0.750766",
"0.750766",
"0.7500895",
... | 0.72869223 | 43 |
Generate slugs for all units | def get_course_all_slugs(self):
unit_lessons_counter = 0
# Unit Page -> Subunit Header + Subunit Block -> Lesson Block -> Lesson Title
for course_unit_url, course_unit_slug in zip(
self.course_unit_urls, self.course_unit_slugs
):
unit_lessons_counter = 0
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_course_unit_slugs(self):\n\n counter = 0\n for title in self.course_unit_titles:\n self.course_unit_slugs.append(\n self.course_title + \"/\" + str(counter) + \"_\" + title.replace(\" \", \"_\")\n )\n counter += 1\n logging.debug(\"course... | [
"0.7868048",
"0.616543",
"0.58146304",
"0.5772727",
"0.5603971",
"0.55967176",
"0.5584233",
"0.55456537",
"0.5497428",
"0.5478782",
"0.5441088",
"0.5424065",
"0.5404104",
"0.5372695",
"0.53694445",
"0.5361874",
"0.53603804",
"0.5316312",
"0.5277648",
"0.52520734",
"0.52420884... | 0.5534605 | 8 |
This is a property which returns a list of all known node by returning the clients we used to interact with them from the object store. | def known_nodes(self) -> List[Client]:
return list(self.in_memory_client_registry.values()) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def list_nodes(self):\n return self.ironic_client.node.list()",
"def clients(self, r):\r\n return r.clients",
"def clients(self):\n return self._clients",
"def get(self):\n return get_clientes()",
"def getNodes(self):\n data = self.connect('get','nodes',None)\n ret... | [
"0.74045146",
"0.7370591",
"0.7266005",
"0.7239399",
"0.7171674",
"0.7155508",
"0.70730644",
"0.70439285",
"0.70436704",
"0.70118076",
"0.6947528",
"0.69106376",
"0.69106376",
"0.6896149",
"0.68932456",
"0.6833818",
"0.68155575",
"0.67705804",
"0.6770403",
"0.67449296",
"0.67... | 0.8241479 | 0 |
Magic | (or) method, return (left) concatenated MultiplexForecaster. Implemented for `other` being a forecaster, otherwise returns `NotImplemented`. | def __ror__(self, other):
return self._dunder_concat(
other=other,
base_class=BaseForecaster,
composite_class=MultiplexForecaster,
attr_name="forecasters",
concat_order="right",
) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __or__(self, other):\n return self._dunder_concat(\n other=other,\n base_class=BaseForecaster,\n composite_class=MultiplexForecaster,\n attr_name=\"forecasters\",\n concat_order=\"left\",\n )",
"def __radd__(self, other):\n if other ... | [
"0.7287244",
"0.6522794",
"0.6360173",
"0.63443685",
"0.6307608",
"0.62857866",
"0.6270223",
"0.61839926",
"0.6183248",
"0.6153588",
"0.6091107",
"0.6067041",
"0.6046793",
"0.6044755",
"0.5979771",
"0.5979771",
"0.59034634",
"0.5899315",
"0.58949363",
"0.584311",
"0.58141637"... | 0.70153093 | 1 |
Tests whether a validation raises an exception due to a malformed schema. | def assert_schema_error(*args):
assert_exception(SchemaError, *args) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_invalid_schema():\n # setup\n uid = uuid.uuid4()\n schema_dir = f'/tmp/{uid}'\n schema_file = f'{schema_dir}/bad_schema.json'\n os.makedirs(schema_dir)\n text_file = open(schema_file, 'w')\n text_file.write('this will fail[];fail()')\n text_file.close()\n\n data = {}\n\n # te... | [
"0.75470537",
"0.72530097",
"0.72113436",
"0.7004857",
"0.6723208",
"0.6706957",
"0.66713876",
"0.6670343",
"0.6594321",
"0.65845484",
"0.6575798",
"0.6571886",
"0.6553624",
"0.6551081",
"0.6486933",
"0.6486015",
"0.6470134",
"0.6454053",
"0.6451445",
"0.6434026",
"0.6431392"... | 0.7352917 | 1 |
Extract the n nodes with the highest rank (highest value) in a given graph metric. | def get_n_highest_ranking_nodes(self, n ,metrics=[], color_cells=True):
def highlight_cells(c, c_dict):
"""
Get node color from supplied c_dict and return a string
specifying cell background color.
"""
colour= c_dict.get(c)
return 'backg... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _rank(self, ranking, n):\n return nlargest(n, ranking, key=ranking.get)",
"def search_highest_k_neighbor(self, k):\n max_score = 0\n target_node = None\n from_idx = None\n to_idx = None\n for i in range(k):\n node = self.graph.nodes[random.randrange(len(self.g... | [
"0.6300742",
"0.618421",
"0.61108667",
"0.6004579",
"0.60007644",
"0.59889424",
"0.59753317",
"0.59753317",
"0.5960389",
"0.5956595",
"0.5934974",
"0.59285325",
"0.58925915",
"0.5817026",
"0.5815864",
"0.581346",
"0.5775823",
"0.5764532",
"0.5760505",
"0.57356995",
"0.5729811... | 0.71202236 | 0 |
In case your device is able to get the clientside timestamp, you can use following format | def upload_telemetry_data():
gen_log.info("upload_telemetry_data")
try:
data=[{attr:random.randint(20,100)} for attr in attributes if attr!='temperature']
# data={"temperature":random.randint(20,100),
# "humidity":random.randint(20,100),
# "other":random.randint(-60,60),
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def timestamp():\n return datetime.now().strftime(\"%Y%m%dT%H%M%S\")",
"def timestamp():\n\tn = datetime.datetime.now()\n\treturn \"%04d-%02d-%02dT%02d:%02d:%02d\" % (\n\t\tn.year, n.month, n.day, n.hour, n.minute, n.second\n\t)",
"def _get_timestamp():\n return str(int(time.time()))",
"def get... | [
"0.8097748",
"0.79025066",
"0.78555346",
"0.7841555",
"0.7790021",
"0.7745269",
"0.7724723",
"0.7679552",
"0.7676941",
"0.76443774",
"0.7642082",
"0.7639866",
"0.7623542",
"0.76173365",
"0.75147444",
"0.75059426",
"0.74720913",
"0.74702615",
"0.7464732",
"0.7464732",
"0.74597... | 0.0 | -1 |
Camel case to snake case, eg. 'OneTwo' returns 'one_two'. Covers strings that have consecutive capital letters as well | def get_snake_case_from_camel_case(name: str) -> str:
new_chars = []
for i, char in enumerate(name):
if i == len(name)-1 or i == 0:
new_chars.append(char)
elif char.isupper() and name[i+1].islower():
new_chars.append('_')
new_chars.append(char)
elif... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def snake_to_camel_case(snake_str: str) -> str:\n\n words = snake_str.strip(\"_\").split(\"_\")\n return words[0] + \"\".join(word[:1].upper() + word[1:] for word in words[1:])",
"def snake_case_to_headless_camel_case(snake_string):\n return ''.join([snake_string.split('_')[0]] +\n list(su... | [
"0.8603097",
"0.8514918",
"0.84273237",
"0.83613306",
"0.8301845",
"0.82911754",
"0.8267409",
"0.82608074",
"0.8256649",
"0.8227356",
"0.8193749",
"0.8176327",
"0.8162197",
"0.81561",
"0.814173",
"0.8136828",
"0.81134266",
"0.8094129",
"0.8091175",
"0.8062875",
"0.80613846",
... | 0.8163985 | 12 |
Reads a .sql file and returns the text as a string. | def get_sql_string_from_file(path: str) -> str:
with open(path, 'r') as r:
sql = r.read()
return sql.replace('\n', '').replace('\t', '') | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_sql_from_file(self, sql_path):\n with open(sql_path, 'r') as f:\n sql = \"\"\n for line in f.readlines():\n line = line.strip()\n if not line.startswith(\"--\"):\n sql += \" \" + line\n return sql",
"def get_file_content... | [
"0.7541884",
"0.7459759",
"0.73923594",
"0.7336617",
"0.70864105",
"0.7026593",
"0.70059496",
"0.6808734",
"0.6805927",
"0.6780658",
"0.6702775",
"0.6563986",
"0.65557104",
"0.65304774",
"0.64951056",
"0.6466611",
"0.6287015",
"0.62826943",
"0.62616056",
"0.60994065",
"0.6059... | 0.79068595 | 0 |
Create a Python instance from the given DOM node. The node tag must correspond to an element declaration in this module. | def CreateFromDOM (node, default_namespace=None):
if default_namespace is None:
default_namespace = Namespace.fallbackNamespace()
return pyxb.binding.basis.element.AnyCreateFromDOM(node, default_namespace) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def CreateFromDOM (node, default_namespace=None):\n if default_namespace is None:\n default_namespace = Namespace.fallbackNamespace()\n return pyxb.binding.basis.element.AnyCreateFromDOM(node, _fallback_namespace=default_namespace)",
"def CreateFromDOM (node, default_namespace=None):\n if default... | [
"0.69492453",
"0.69492453",
"0.69492453",
"0.6946201",
"0.67003196",
"0.67003196",
"0.67003196",
"0.6699141",
"0.6665287",
"0.6652696",
"0.66235024",
"0.65954566",
"0.65870607",
"0.65662956",
"0.6511594",
"0.6490757",
"0.64733577",
"0.6426212",
"0.63252485",
"0.6313551",
"0.6... | 0.70111513 | 1 |
Set total number of players. | async def _total_players(self, ctx: Context, number: int):
await self.config.guild(ctx.guild).total_players.set(number)
await ctx.send(_("Set total players to `{}`.").format(number)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def number_of_players(self) -> int:\n return self.param.number_of_players",
"def set_n_players(self):\n complain = \"\"\n while True:\n clear_output()\n try:\n self.n_players = int(\n input(f\"{complain}Please insert the number of playe... | [
"0.73541087",
"0.7145345",
"0.7015422",
"0.6710594",
"0.6686425",
"0.6667767",
"0.65580845",
"0.6446332",
"0.6188742",
"0.6090426",
"0.6073255",
"0.5978396",
"0.5973386",
"0.595081",
"0.594245",
"0.594245",
"0.59289664",
"0.5928263",
"0.59263474",
"0.5921165",
"0.59047467",
... | 0.83207303 | 0 |
Count votes! The bot can automatically detect voting channels. However, it may not be able to detect the correct channel in some cases. Please specify the vote channel in such cases! | async def _vote_count(
self, ctx: Context, *, channel: discord.TextChannel = None
):
guild: discord.Guild = ctx.guild
if not channel:
channel = await self.get_vote_channel(guild)
if isinstance(channel, str):
return await ctx.send(channel)
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def vote_count(self):\n return QuestionVotes.objects.filter(question=self).count()",
"def votes(self, irc, msg, args, channel, pid):\n if channel and msg.args[0] in irc.state.channels:\n if msg.args[0] != channel:\n if ircdb.checkCapability(msg.prefix, 'admin') or ircdb.ch... | [
"0.6342447",
"0.6338237",
"0.6331609",
"0.62829393",
"0.6255539",
"0.6242935",
"0.6197896",
"0.6174112",
"0.60636854",
"0.6026583",
"0.602512",
"0.5998902",
"0.5990011",
"0.5972712",
"0.58655214",
"0.58635",
"0.581374",
"0.5803814",
"0.5787305",
"0.5738287",
"0.5729406",
"0... | 0.821364 | 0 |
Get TvM Assistant's invite url. | async def _invite(self, ctx: Context):
perm_int = discord.Permissions(268494928)
data = await self.bot.application_info()
invite_url = discord.utils.oauth_url(data.id, permissions=perm_int)
value = (
f"Invite TvM Assistant to your bot by [clicking here]({invite_url})."
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def link(self):\n return f\"https://{DOMAIN}/invite/{self.code}\"",
"def online_meeting_url(self):\n if \"onlineMeetingUrl\" in self._prop_dict:\n return self._prop_dict[\"onlineMeetingUrl\"]\n else:\n return None",
"def get_url(self):\n if not self.get_video_i... | [
"0.68369675",
"0.6237631",
"0.61960936",
"0.6103688",
"0.6091428",
"0.5964521",
"0.59184045",
"0.5895147",
"0.5834681",
"0.5825624",
"0.57837915",
"0.5749339",
"0.5744132",
"0.57216614",
"0.57151663",
"0.57145196",
"0.57083213",
"0.56780493",
"0.5622532",
"0.55393267",
"0.552... | 0.5640213 | 18 |
Check if night action channel exists. If it does, return the channel object. Otherwise, return False. | async def check_na_channel(self, guild: discord.Guild):
ch_id = await self.config.guild(guild).na_channel_id()
if ch_id:
return discord.utils.get(guild.text_channels, id=ch_id)
return False | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_channel(self):\n return True",
"def is_event_channel(channel: discord.TextChannel) -> bool:\n return get_active_feature(channel) == ActivationState.EVENT",
"def single_channel():\n return True",
"async def is_channel_shortcut_name(argument, context, verbose=True):\n return await is... | [
"0.62325096",
"0.58976406",
"0.58325154",
"0.5801557",
"0.57266784",
"0.57085615",
"0.5685303",
"0.5671271",
"0.566063",
"0.56556165",
"0.5638527",
"0.5580464",
"0.5572803",
"0.5547661",
"0.5508922",
"0.5488889",
"0.5483817",
"0.5477505",
"0.54768187",
"0.54718006",
"0.545649... | 0.5955322 | 1 |
Checks whether it is day. Returns True if it is. | def is_day(self, day_channel: discord.TextChannel, player: discord.Role):
if day_channel.overwrites_for(player).send_messages:
return True | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _valid_day(self, date_find):\n try:\n datetime.strptime(date_find, settings.TIME_FORMAT)\n valid = True\n except ValueError:\n valid = False\n return valid",
"def isoweekday(self):\n return 0",
"def isoweekday(self):\n return 0",
"def chec... | [
"0.74320114",
"0.7201511",
"0.7201511",
"0.7161249",
"0.7049336",
"0.69409835",
"0.69124454",
"0.6888769",
"0.68644345",
"0.68451",
"0.6730734",
"0.6719483",
"0.6696396",
"0.6692063",
"0.6665665",
"0.6653749",
"0.6644912",
"0.65803415",
"0.6574981",
"0.65175307",
"0.65155965"... | 0.58665735 | 72 |
Get human representation of time passed since channel was created. Version of `redbot.core.utils.chat_formatting.humanize_timedelta` to only return days, hours and minutes. | def format_time_since(self, timedelta: timedelta):
seconds = timedelta.total_seconds()
periods = [
(_("day"), _("days"), 60 * 60 * 24),
(_("hour"), _("hours"), 60 * 60),
(_("minute"), _("minutes"), 60),
]
strings = []
for period_name, plural... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def seconds2human(self, my_time):\n my_days, my_seconds = divmod(my_time, 86400)\n time_delta = timedelta(seconds=my_seconds)\n reminder = strftime(\"%H:%M:%S\", gmtime(time_delta.seconds))\n if my_days > 1:\n return \"%s days, %s\" % (my_days, reminder)\n elif my_days... | [
"0.70105946",
"0.6793096",
"0.66690266",
"0.6356508",
"0.6345608",
"0.63283753",
"0.6253237",
"0.61939543",
"0.6158782",
"0.6114502",
"0.6113151",
"0.6095137",
"0.60833913",
"0.60776615",
"0.60590076",
"0.60436386",
"0.6037892",
"0.6034694",
"0.6030224",
"0.5982132",
"0.59794... | 0.6604674 | 3 |
Return a copy of the hash object. | def copy(self, *args, **kwargs): # real signature unknown
pass | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def copy(self):\n return self.__class__(dict(self))",
"def copy(self):\n return pdict(dict.copy(self))",
"def copy(self):\r\n new = WeakKeyIdentityDict()\r\n for key, value in self.data.items():\r\n o = key()\r\n if o is not None:\r\n new[o] = value\... | [
"0.7411483",
"0.73204064",
"0.71970606",
"0.71836966",
"0.718199",
"0.7133901",
"0.71179897",
"0.70552796",
"0.7037881",
"0.7037881",
"0.7037881",
"0.7037881",
"0.7024485",
"0.7023935",
"0.700515",
"0.6998012",
"0.69761795",
"0.69761795",
"0.69761795",
"0.6971244",
"0.6969416... | 0.0 | -1 |
Return a copy of the hash object. | def copy(self, *args, **kwargs): # real signature unknown
pass | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def copy(self):\n return self.__class__(dict(self))",
"def copy(self):\n return pdict(dict.copy(self))",
"def copy(self):\r\n new = WeakKeyIdentityDict()\r\n for key, value in self.data.items():\r\n o = key()\r\n if o is not None:\r\n new[o] = value\... | [
"0.74141073",
"0.73228073",
"0.71984804",
"0.7186203",
"0.71846783",
"0.71342057",
"0.71219164",
"0.7057391",
"0.70417416",
"0.70417416",
"0.70417416",
"0.70417416",
"0.70283645",
"0.7027921",
"0.70070606",
"0.69968706",
"0.69802",
"0.69802",
"0.69802",
"0.6974755",
"0.697285... | 0.0 | -1 |
Return a copy of the hash object. | def copy(self, *args, **kwargs): # real signature unknown
pass | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def copy(self):\n return self.__class__(dict(self))",
"def copy(self):\n return pdict(dict.copy(self))",
"def copy(self):\r\n new = WeakKeyIdentityDict()\r\n for key, value in self.data.items():\r\n o = key()\r\n if o is not None:\r\n new[o] = value\... | [
"0.7411483",
"0.73204064",
"0.71970606",
"0.71836966",
"0.718199",
"0.7133901",
"0.71179897",
"0.70552796",
"0.7037881",
"0.7037881",
"0.7037881",
"0.7037881",
"0.7024485",
"0.7023935",
"0.700515",
"0.6998012",
"0.69761795",
"0.69761795",
"0.69761795",
"0.6971244",
"0.6969416... | 0.0 | -1 |
Return a copy of the hash object. | def copy(self, *args, **kwargs): # real signature unknown
pass | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def copy(self):\n return self.__class__(dict(self))",
"def copy(self):\n return pdict(dict.copy(self))",
"def copy(self):\r\n new = WeakKeyIdentityDict()\r\n for key, value in self.data.items():\r\n o = key()\r\n if o is not None:\r\n new[o] = value\... | [
"0.7411483",
"0.73204064",
"0.71970606",
"0.71836966",
"0.718199",
"0.7133901",
"0.71179897",
"0.70552796",
"0.7037881",
"0.7037881",
"0.7037881",
"0.7037881",
"0.7024485",
"0.7023935",
"0.700515",
"0.6998012",
"0.69761795",
"0.69761795",
"0.69761795",
"0.6971244",
"0.6969416... | 0.0 | -1 |
Return a copy of the hash object. | def copy(self, *args, **kwargs): # real signature unknown
pass | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def copy(self):\n return self.__class__(dict(self))",
"def copy(self):\n return pdict(dict.copy(self))",
"def copy(self):\r\n new = WeakKeyIdentityDict()\r\n for key, value in self.data.items():\r\n o = key()\r\n if o is not None:\r\n new[o] = value\... | [
"0.7411483",
"0.73204064",
"0.71970606",
"0.71836966",
"0.718199",
"0.7133901",
"0.71179897",
"0.70552796",
"0.7037881",
"0.7037881",
"0.7037881",
"0.7037881",
"0.7024485",
"0.7023935",
"0.700515",
"0.6998012",
"0.69761795",
"0.69761795",
"0.69761795",
"0.6971244",
"0.6969416... | 0.0 | -1 |
Return a copy of the hash object. | def copy(self, *args, **kwargs): # real signature unknown
pass | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def copy(self):\n return self.__class__(dict(self))",
"def copy(self):\n return pdict(dict.copy(self))",
"def copy(self):\r\n new = WeakKeyIdentityDict()\r\n for key, value in self.data.items():\r\n o = key()\r\n if o is not None:\r\n new[o] = value\... | [
"0.74141073",
"0.73228073",
"0.71984804",
"0.7186203",
"0.71846783",
"0.71342057",
"0.71219164",
"0.7057391",
"0.70417416",
"0.70417416",
"0.70417416",
"0.70417416",
"0.70283645",
"0.7027921",
"0.70070606",
"0.69968706",
"0.69802",
"0.69802",
"0.69802",
"0.6974755",
"0.697285... | 0.0 | -1 |
Override the __str()__ for proper textual representation of an edge | def __str__(self):
return self.label | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __str__(self):\n s = f\"GraphViaEdges '{self.name}',\\nedges :\\n\"\n for edge, edgetype in self.edges.items():\n s += f\" {edge[0]} {edgetype.value} {edge[1]}\\n\"\n\n return s",
"def __repr__(self) -> str:\n if self._has_direction:\n return (\n ... | [
"0.8329063",
"0.8124762",
"0.80993396",
"0.80822384",
"0.79758596",
"0.77604973",
"0.76990575",
"0.7687898",
"0.742906",
"0.742906",
"0.73966515",
"0.7368946",
"0.734255",
"0.7259044",
"0.71650493",
"0.71628517",
"0.7137326",
"0.7125075",
"0.71075547",
"0.7104824",
"0.7008384... | 0.0 | -1 |
Testing LoginRequiredViewMixin.dispatch with anonymous user | def test_dispatch_anonymous_user(self):
class MyView(LoginRequiredViewMixin, View):
def get(view, *args, **kwargs):
self.fail('Should not be reached')
request = RequestFactory().request()
request.user = AnonymousUser()
view = MyView.as_view()
respons... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_login_required(self):\n response = self.client.get('/test/')\n self.assertFalse(response.wsgi_request.user.is_authenticated)\n\n response = response = self.client.get(\n reverse('users:logout'),\n follow=True\n )\n\n self.assertFalse(response.wsgi_r... | [
"0.76674324",
"0.7651715",
"0.732173",
"0.70662427",
"0.7041131",
"0.70188785",
"0.6992274",
"0.6936721",
"0.69293",
"0.6906394",
"0.68932074",
"0.68859065",
"0.68820494",
"0.68629205",
"0.68530625",
"0.68097234",
"0.6808998",
"0.6808998",
"0.6808998",
"0.6808998",
"0.6806864... | 0.84869957 | 0 |
Should return the a single document_type | def test_get_application_document_type(self, test_client, db_session, auth_headers):
code = NOWApplicationDocumentType.get_all()[0].now_application_document_type_code
get_resp = test_client.get(
f'/now-applications/application-document-types/{code}',
headers=auth_headers['full_au... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def document_type(self) -> Optional[pulumi.Input[str]]:\n return pulumi.get(self, \"document_type\")",
"def DocumentType(self, default=[None]):\n return self.data.get('metadata', {}).get('document_type', default)",
"def DocumentType(self, default='article'):\n return self.data.get(... | [
"0.7750131",
"0.7649998",
"0.7501379",
"0.7386",
"0.6838973",
"0.6682579",
"0.66433465",
"0.6594018",
"0.6549499",
"0.6448217",
"0.6428127",
"0.6308773",
"0.630747",
"0.6226716",
"0.6214782",
"0.6211311",
"0.6211311",
"0.62030613",
"0.61821866",
"0.616384",
"0.61519134",
"0... | 0.65373445 | 9 |
Load config .yaml file | def load_config(filepath=None):
if filepath is None:
raise ValueError("The filepath is None, please check the config file is exist")
with open(filepath, "r") as stream:
output = dict()
try:
content = yaml.load(stream)
output.update(content)
return out... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def load_config(filename):\n AS[\"config\"] = load_yaml_file(filename)",
"def load_config():\n proj_dir = os.path.dirname(os.path.abspath(__file__))\n config_path = os.path.join(proj_dir, \"config.yml\")\n conf = yaml.safe_load(open(config_path))\n return conf",
"def load_config(path):\n retu... | [
"0.8150546",
"0.8018937",
"0.80049264",
"0.79465806",
"0.788242",
"0.7853251",
"0.78226453",
"0.7800342",
"0.77957195",
"0.7755849",
"0.7751987",
"0.7728506",
"0.7586097",
"0.75456536",
"0.75405705",
"0.75368017",
"0.7503106",
"0.7496597",
"0.7490345",
"0.74642533",
"0.746406... | 0.7417566 | 22 |
Returns the topleft cell of the board. | def get_tl_cell(self):
return self._tl_cell | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_top_cell(self):\n return self._top_cell",
"def getlefttop(self,xnum,ynum):\n left = self.xmargin + xnum*CELLSIZE\n top = self.ymargin + ynum*CELLSIZE\n return (left,top)",
"def left(self):\n x, y = (self.loc[0] - 1, self.loc[1])\n\n if x < 0:\n retu... | [
"0.780954",
"0.7448227",
"0.7294557",
"0.718883",
"0.714631",
"0.69563574",
"0.6829784",
"0.6704504",
"0.66806746",
"0.66806746",
"0.66239667",
"0.6557945",
"0.6498638",
"0.6467756",
"0.6460172",
"0.6453318",
"0.64520293",
"0.63990957",
"0.63709116",
"0.63329244",
"0.63223344... | 0.6054036 | 39 |
Returns the topright cell of the board. | def get_tr_cell(self):
return self._tr_cell | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def topright(self):\n return (self.right, self.top)",
"def right(self):\n return self.points['topRight'].x",
"def right(self):\n return self.points['topRight'].x",
"def downright(self):\n return Coord([self.x + 1, self.y + 1])",
"def right(self):\n return self.left + self... | [
"0.7599623",
"0.6962583",
"0.6962583",
"0.6883579",
"0.6850517",
"0.6791139",
"0.6746",
"0.67129314",
"0.6710429",
"0.67013484",
"0.66226274",
"0.6612941",
"0.66086954",
"0.6578958",
"0.656989",
"0.656989",
"0.6569307",
"0.6554529",
"0.654406",
"0.65330863",
"0.65126544",
"... | 0.0 | -1 |
Returns the bottomleft cell of the board. | def get_bl_cell(self):
return self._bl_cell | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def bottom_left_tile_value(self):\n\t\treturn self.expected_cols * (self.expected_rows - 1) + 1",
"def bottomleft(self):\n return (self.left, self.bottom)",
"def bottom_left(self, obj):\n return self.phy2abs.bottom_left(obj)",
"def bottom( self , i , j ):\n return self._get_bottom( i , ... | [
"0.736899",
"0.7156597",
"0.70672405",
"0.67557824",
"0.6708568",
"0.67021614",
"0.66069454",
"0.65528834",
"0.65002066",
"0.6487656",
"0.6487656",
"0.63606626",
"0.6343894",
"0.62700516",
"0.6268305",
"0.6257264",
"0.62534773",
"0.62373036",
"0.6187531",
"0.616272",
"0.61465... | 0.64618134 | 11 |
Returns the bottomright cell of the board. | def get_br_cell(self):
return self._br_cell | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def bottom_right(self):\n return Point(self.right, self.bottom)",
"def bottom_right_tile_value(self):\n\t\treturn self.expected_rows * self.expected_cols",
"def bottomright(self):\n return (self.right, self.bottom)",
"def bottom_right(self, obj):\n return self.phy2abs.bottom_right(obj)",... | [
"0.7700415",
"0.73738164",
"0.73420197",
"0.7148683",
"0.70879954",
"0.70879954",
"0.698758",
"0.6952079",
"0.69190615",
"0.6791754",
"0.6782482",
"0.6718444",
"0.66267204",
"0.6579539",
"0.6548551",
"0.6469841",
"0.64657515",
"0.64657515",
"0.64433354",
"0.643053",
"0.641681... | 0.6264554 | 29 |
Returns the number of rows in an Othello board. | def get_num_rows(self):
return self._num_rows | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def rows(self) -> int:\n return self.__squares.__len__()",
"def row_count(self):\n return self.well_count // self.col_count",
"def getNumRows(self) -> int:\n ...",
"def number_of_rows(self):\n if self.number_of_columns():\n return self._number_of_rows\n else:\n ... | [
"0.7535412",
"0.75097764",
"0.7500767",
"0.74693245",
"0.7347401",
"0.7171747",
"0.7139699",
"0.7085409",
"0.70360446",
"0.69865656",
"0.6978821",
"0.6968542",
"0.69680655",
"0.6906243",
"0.6906243",
"0.6904014",
"0.6900112",
"0.68878037",
"0.6868066",
"0.6831493",
"0.6825620... | 0.6331672 | 59 |
Returns the number of columns in an Othello board. | def get_num_cols(self):
return self._num_cols | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def columns(self) -> int:\n return self.__squares[0].__len__()",
"def n_cols(self):\n ch = self.children\n return 1 if not ch else sum([c.n_cols for c in ch])",
"def ncolumns(self):\n return self.__ncols",
"def get_length(board):\n length = 0\n for i in range(n):\n fo... | [
"0.7975332",
"0.7585853",
"0.7509342",
"0.7490839",
"0.7457121",
"0.7443187",
"0.73249793",
"0.7288862",
"0.7232949",
"0.72194904",
"0.72050864",
"0.7114792",
"0.71139514",
"0.7107692",
"0.70879924",
"0.7071158",
"0.7040261",
"0.70170546",
"0.6979723",
"0.6955469",
"0.6927948... | 0.70908207 | 14 |
Returns the object representation. | def __str__(self):
return self.email | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def serialize(self):\n\n\t\treturn str(self)",
"def serialize(self):\n\n return str(self)",
"def dumps(self):\n return dumps(self)",
"def __str__(self):\n return str(self.serialize())",
"def to_representation(self) -> str:\n raise NotImplementedError()",
"def serialize(self, o... | [
"0.79376686",
"0.7899914",
"0.78879577",
"0.77344507",
"0.7680176",
"0.766891",
"0.76486826",
"0.76265216",
"0.75567895",
"0.7518052",
"0.7496489",
"0.747583",
"0.7442509",
"0.74173534",
"0.7414082",
"0.7414082",
"0.7414082",
"0.7414082",
"0.7414082",
"0.7389246",
"0.73678607... | 0.0 | -1 |
Gets a specific column in the table. | def get_column(self, key):
return self._get_column(key) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _get_column(cls, name):\r\n return cls._columns[name]",
"def _get_column(self, name):\r\n return self.column(name)",
"def getCol(self, column_name):\n idx = self.colnames.index(column_name)\n return self.getColByIdx(idx)",
"def get_column(self, col_identifier):\n try:\n... | [
"0.8240756",
"0.81747776",
"0.81337786",
"0.7939698",
"0.7777585",
"0.7743584",
"0.7697058",
"0.7668178",
"0.7644475",
"0.7602118",
"0.7601765",
"0.75940734",
"0.7539389",
"0.7469562",
"0.74610215",
"0.74548584",
"0.74062246",
"0.73730373",
"0.72894394",
"0.7287915",
"0.72847... | 0.7844231 | 4 |
Use a seaborn pairplot to get a feel for the data | def investigate_data(training_data):
return sns.pairplot(training_data.sample(100), hue="status") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def pairplot(self, dataframe):\n colors = {\"color\": self.plot_design.pairplot_color}\n p = sns.pairplot(dataframe, plot_kws=colors, diag_kws=colors)\n return p",
"def pair_scatter(df, **kwargs):\n\n grid = sns.pairplot(df, **kwargs)\n return grid.fig",
"def drawPairPlot(df):\n p... | [
"0.7919723",
"0.7618915",
"0.74084",
"0.6950689",
"0.67546326",
"0.66168994",
"0.6545794",
"0.63243437",
"0.6248507",
"0.6134305",
"0.6124837",
"0.58946884",
"0.58926445",
"0.5887883",
"0.5863616",
"0.58422273",
"0.5796112",
"0.570099",
"0.56894594",
"0.5687582",
"0.56654626"... | 0.6512461 | 7 |
Convert a word from snake_case to CamelCase | def snake_to_camel(word):
return ''.join(x.capitalize() or '_' for x in word.split('_')) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def snake_to_camel_case(snake_str: str) -> str:\n\n words = snake_str.strip(\"_\").split(\"_\")\n return words[0] + \"\".join(word[:1].upper() + word[1:] for word in words[1:])",
"def snake_to_camel_case(value):\n words = value.strip(\"_\").split(\"_\")\n return words[0].lower() + \"\".join([word.cap... | [
"0.82117194",
"0.8184621",
"0.8055713",
"0.7987699",
"0.7959458",
"0.793636",
"0.7929527",
"0.7913796",
"0.79018044",
"0.78817326",
"0.7881123",
"0.7801666",
"0.780064",
"0.7789993",
"0.7783078",
"0.77676845",
"0.77478725",
"0.7743818",
"0.7742133",
"0.7741626",
"0.7685414",
... | 0.8670039 | 0 |
Return the string representation of this entry | def to_string(self, show_password: bool = False, show_hint: bool = False) -> str:
password = self.password if show_password else re.sub('.*', '*' * min(len(self.password), 8), self.password)
hint = self.hint if show_hint else re.sub('.*', '*' * min(len(self.hint), 8), self.hint)
return self._DIS... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def to_str(self):\n return '\\n'.join(str(entry) for entry in self.values())",
"def to_str(self):\n return '\\n'.join(str(entry) for entry in self)",
"def as_string(self):\n return self.__repr__()",
"def to_str(self):\n return pformat(self.to_dict())",
"def to_str(self):\n ... | [
"0.8147624",
"0.7861237",
"0.77272993",
"0.7661215",
"0.7661215",
"0.7661215",
"0.7661215",
"0.7661215",
"0.7661215",
"0.7661215",
"0.7661215",
"0.7661215",
"0.7661215",
"0.7661215",
"0.7661215",
"0.7661215",
"0.7661215",
"0.7661215",
"0.7661215",
"0.7661215",
"0.7661215",
... | 0.0 | -1 |
Plot training data, test data, and prediction results | def plot_results(
train_data: tuple[Tensor, Tensor],
test_data: tuple[Tensor, Tensor],
correct_class: Tensor
):
#fig, (ax1, ax2, ax3) = plt.subplots(1, 3, figsize=(21,7), subplot_kw=dict(box_aspect=1))
fig1, (ax1, ax2) = plt.subplots(1, 2, figsize=(14,7), subplot_kw=dict(box_aspect=1))
fig2, ax3... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def plot_predictions(self):\n\n plt.title(\"Targets vs. Predictions\")\n plt.plot(self.T, label=\"Targets\")\n plt.plot(self.Y, label=\"Predictions\")\n plt.xlabel(\"Sample number\")\n plt.legend()\n plt.show()",
"def plot_predictions(\n train_data, train_labels, test... | [
"0.79365194",
"0.792507",
"0.7802962",
"0.7769191",
"0.767383",
"0.76007193",
"0.75120306",
"0.7472346",
"0.73918355",
"0.73918355",
"0.73886764",
"0.73152566",
"0.730741",
"0.7234731",
"0.722817",
"0.7209859",
"0.7207668",
"0.719095",
"0.71840274",
"0.7131601",
"0.7131409",
... | 0.7830624 | 2 |
Skip n lines based on the given number. If it is negative, it clears the console. | def skip_lines(nb):
if nb == -1:
os.system('cls' if os.name=='nt' else 'clear')
else:
print("\n" * (nb-1)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def skip(self, n=None):\n while n > 0:\n try:\n self.next()\n except StopIteration:\n break\n n -= 1",
"def skip(self, n):\n return self.__class__(itertools.islice(self, n, None))",
"def skip(t, n):\n pu(t)\n fd(t, n)\n pd(t)... | [
"0.71185523",
"0.6804527",
"0.67259675",
"0.67259675",
"0.67115366",
"0.6616916",
"0.6443644",
"0.63362247",
"0.6287184",
"0.6113003",
"0.5805023",
"0.56761414",
"0.5666014",
"0.5645011",
"0.56428736",
"0.5620832",
"0.56058264",
"0.5587099",
"0.55567527",
"0.5551768",
"0.5495... | 0.80175704 | 0 |
Merge two dictionnaries together by adding the values | def merge_2_dictionnaries(dict1, dict2):
result = dict1
for k, v in dict2.items():
result[k] = (result.get(k) or 0) + v
return result | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def merge_into(a, b):\n\tfor k, v in b.items():\n\t\ta[k] = a.get(k, 0) + v",
"def MergeDictionary(self, dict1, dict2):\r\n for key_2, val_2 in dict2.items():\r\n for key_2_2, val_2_2 in val_2.items():\r\n if key_2 in dict1 and key_2_2 in dict1[key_2]:\r\n dict... | [
"0.81781167",
"0.80709493",
"0.7844371",
"0.78365725",
"0.7633839",
"0.7560537",
"0.75177723",
"0.7510088",
"0.7487227",
"0.7487227",
"0.74826866",
"0.7481037",
"0.74622715",
"0.74622715",
"0.74622715",
"0.74622715",
"0.74622715",
"0.74622715",
"0.74622715",
"0.74622715",
"0.... | 0.84820306 | 0 |
Merge n dictionnaries together by adding the values | def merge_n_dictionnaries(dicts):
result = dicts[0]
for i in range(1, len(dicts)):
result = merge_2_dictionnaries(result, dicts[i])
return result | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sum_dicts(*args):\n result = dict()\n for arg in args:\n result.update(arg)\n return result",
"def _sum_over_dicts(total_n_grams: Dict[int, Tensor], n_grams: Dict[int, Tensor]) ->Dict[int, Tensor]:\n for n in n_grams:\n total_n_grams[n] += n_grams[n]\n return total_n_grams",
"d... | [
"0.7397165",
"0.7178184",
"0.71450794",
"0.7023923",
"0.7015411",
"0.694328",
"0.6922243",
"0.688739",
"0.66801",
"0.6663724",
"0.6647383",
"0.6577788",
"0.6577393",
"0.65695167",
"0.6537596",
"0.6509405",
"0.65082556",
"0.64705914",
"0.64705914",
"0.64705914",
"0.64705914",
... | 0.7039093 | 3 |
Convert the object `entity` to a numpy ndarray of numerical dtype. This is needed in the routines for writing content of DataStores and SpectrumData to disk. | def convert_to_ndarray(entity):
if isinstance(entity, np.ndarray) and entity.dtype.kind in set('biufc'):
# entity is numerical ndarray already
return entity
if isinstance(entity, np.ndarray) and isinstance(entity.flat[0], qt.Qobj):
# entity is output from qt.eigenstates
return co... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def to_array(self, normalize: bool = True) -> jnp.ndarray:\n return NotImplemented # pragma: no cover",
"def to_ndarray(self):\n invalidInputError(self.indices is None, \"sparseTensor to ndarray is not supported\")\n return np.array(self.storage, dtype=get_dtype(self.bigdl_type)).reshape(se... | [
"0.6289568",
"0.6229254",
"0.6130103",
"0.6126792",
"0.6049278",
"0.60073435",
"0.59302294",
"0.59269655",
"0.58470064",
"0.58403283",
"0.5836608",
"0.5831",
"0.5815336",
"0.5800675",
"0.5799563",
"0.5793493",
"0.57826525",
"0.5732292",
"0.5709794",
"0.5697472",
"0.5635779",
... | 0.8226408 | 0 |
returns ADUser object of the user who added the computer to the domain. Returns None if user no longer exists. | def get_creator(self):
try:
sid = str(pyadutils.convert_sid(self.get_attribute('mS-DS-CreatorSID', False))).split(':')[1]
dn = adsearch.by_sid(sid)
return ADUser(dn)
except:
return None | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_user(self):\n if not self.is_valid():\n return None\n # error checking done in: clean_email\n # NOTE: all emails are stored in lower-case\n e = self.clean_email().lower()\n return User.objects.get(email=e)",
"def _get_current_user(self):\n\n out, err, ... | [
"0.6055719",
"0.59523654",
"0.589934",
"0.5890296",
"0.57856554",
"0.5730099",
"0.571852",
"0.5667747",
"0.56441885",
"0.5626758",
"0.55842173",
"0.55811834",
"0.5561506",
"0.55582654",
"0.5555832",
"0.55474985",
"0.55430657",
"0.5527319",
"0.5512466",
"0.55045015",
"0.548604... | 0.58584386 | 4 |
Truncate LOS halos at r50 | def LOS_truncation_rN(self, M, z, N):
a_z = self.cosmo.scale_factor(z)
h = self.cosmo.h
r50_physical_Mpc = self.rN_M_nfw_comoving(M * h, N, z) * a_z / h
rN_physical_kpc = r50_physical_Mpc * 1000
return rN_physical_kpc | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def width_l_k(model: SingleRhNeutrinoModel):\n mh = parameters.charged_kaon_mass\n fh = parameters.fk\n ckm = parameters.Vus\n ml = _lepton_masses[model.gen]\n return _width_l_hp(model, ml, mh, fh, ckm)",
"def test_truncate2():\n X = rand(5,5,5)\n T = hosvd(X)\n k = 3\n Tk = T.truncate... | [
"0.5589757",
"0.528526",
"0.5268402",
"0.52681845",
"0.5241871",
"0.5232147",
"0.5231356",
"0.5131493",
"0.51205796",
"0.5087955",
"0.50836563",
"0.5082715",
"0.5064784",
"0.5045138",
"0.5027167",
"0.50235355",
"0.5007519",
"0.4985791",
"0.4984935",
"0.49777487",
"0.49739274"... | 0.45953378 | 85 |
Returns the concentration of an NFW halo (see method in the class Concentration) | def NFW_concentration(self, M, z, model='diemer19', mdef='200c', logmhm=None,
scatter=True, c_scale=60., c_power=-0.17, scatter_amplitude=0.13):
return self._concentration.NFW_concentration(M, z, model, mdef, logmhm,
scatter, c_scal... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def concentration(self):\n return self._gev_bijector.concentration",
"def _get_concentration(self, state):\n return self.fc(state.float_features).exp() + self.EPSILON",
"def concentration(self, num, step, doses=None):\n if doses is None:\n doses = {0: self.c_0}\n else:\n ... | [
"0.71370184",
"0.67675257",
"0.65707177",
"0.6556901",
"0.6552316",
"0.640926",
"0.6362416",
"0.625656",
"0.6254149",
"0.61879855",
"0.6135872",
"0.6093897",
"0.6075499",
"0.605452",
"0.60413134",
"0.6008697",
"0.592774",
"0.5926303",
"0.59100705",
"0.5901804",
"0.58323646",
... | 0.57902026 | 23 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.