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
Whether or not roles contains 'admin' role according to policy setting.
def check_is_admin(context): init() #the target is user-self credentials = context.to_dict() target = credentials return policy.check('context_is_admin', target, credentials)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_admin(self):\n return Role.query.get(2) in self.roles", "def is_admin():\n # TODO(felipemonteiro): Make this more robust via a context is admin\n # lookup.\n return CONF.patrole.rbac_test_role == CONF.identity.admin_role", "def is_admin(self) -> bool:\n\n return current_app.config...
[ "0.80555236", "0.7877494", "0.7524281", "0.7276824", "0.72604567", "0.7070065", "0.70537096", "0.7026035", "0.6995541", "0.6951943", "0.693624", "0.6914837", "0.6905311", "0.6902686", "0.68738955", "0.684616", "0.6828732", "0.68230313", "0.6814059", "0.68068737", "0.6804963",...
0.6949152
10
Determine whether is_admin matches the requested value.
def __call__(self, target, creds): return creds['is_admin'] == self.expected
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def user_is_admin(user):\n return user in admins", "def is_admin(self):\n if self.type == 1:\n return True\n else:\n return False", "def check_is_admin(current_user):\n return current_user['isAdmin'] == True", "def is_admin():\n # TODO(felipemonteiro): Make this m...
[ "0.77020353", "0.76728994", "0.7622826", "0.7602146", "0.7581215", "0.7541224", "0.74442357", "0.7439339", "0.7368641", "0.731608", "0.72977567", "0.72729254", "0.7239961", "0.7239961", "0.72172034", "0.72084516", "0.7191977", "0.71701396", "0.7127601", "0.7123462", "0.712044...
0.6433667
65
Returns the coordinates of the brightest, biggest star/object in the image relative to the center of the frame (topleft to bottomright is increasing xy).
def find_brightest_biggest(filename, catname="sources.cat", config="config.sex", minsize=10, minflux=450000): # Get dimensions of the image hdulist = pf.open(filename) (height, width) = hdulist[0].data.shape bloblist = manual_blob_finder(hdulist[0].data) hdulist.close() if bloblist is N...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_pixel_pos(self):\n\n c = self.get_center()\n\n return Tank.three_by_three(c[0],c[1])", "def _get_frame_center(self, src):\n w, h = get_size(src)\n x = w / 2\n y = h / 2\n\n return x, y", "def find_reddest_pixel_fast(img): \n img = np.array(img, dtype = 'i...
[ "0.6490956", "0.6137921", "0.6128758", "0.61109185", "0.6013343", "0.60000134", "0.5974363", "0.5948865", "0.590268", "0.5843609", "0.5836649", "0.58258235", "0.5821618", "0.58176357", "0.5804881", "0.58030057", "0.5793141", "0.577587", "0.5771293", "0.5756394", "0.5746825", ...
0.0
-1
Initialize individual parameters from theta.
def from_theta(self, theta=10.): self.eta = theta
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def with_params(self, theta):\n self.params = theta\n return self", "def __init__(self, theta, prev=None):\n XForm.__init__(self, prev)\n self.theta = theta * -pi", "def theta(self, theta):\n\n self._theta = theta", "def initialconditions(self,theta_nought=np.pi/2,phi_nough...
[ "0.7679473", "0.68574226", "0.68248886", "0.6742867", "0.66485626", "0.66173595", "0.6597554", "0.65942895", "0.65897447", "0.65842307", "0.6582392", "0.64987016", "0.643244", "0.63199514", "0.63180035", "0.6306969", "0.6301488", "0.6260462", "0.625979", "0.625423", "0.625311...
0.7626563
1
Probability density function (PDF).
def pdf(self, data=None): ndim = self.lam.size if data is None: raise ValueError('No data given!') self.data = np.atleast_2d(data) # (T, k) array diff = self.data - self.const_mu() # (k, T) array diff_norm = scl.solve(self.const_sigma(), diff.T) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def pdf(self,x):\n returnPdf = self._distribution.pdf(x)\n return returnPdf", "def probability_density(self, X):\n raise NotImplementedError", "def pdf(self,x):\n coordinate = distribution1D.vectord_cxx(len(x))\n for i in range(len(x)):\n coordinate[i] = x[i]\n pdfValue = self._distr...
[ "0.7927263", "0.7750448", "0.77269137", "0.77269137", "0.7714432", "0.7621208", "0.7558294", "0.75471026", "0.75384897", "0.75207466", "0.75206494", "0.7455932", "0.74443585", "0.7443929", "0.73753786", "0.7373953", "0.7366274", "0.7365444", "0.73451835", "0.734433", "0.73210...
0.0
-1
Create a mock filesystem in a temp directory containing expected structure
def make_mock_fs(self): temp = tempfile.mkdtemp(prefix="fpltest") try: config = fplsync.Config() config.playlist_source = os.path.join(temp, "fb2k_playlists") config.source = os.path.join(temp, "source") config.dest = os.path.join(temp, "dest") config.playlist_dest = os.path.join(temp, "playlists") ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def fs(tmp_path_factory):\n dir_ = tmp_path_factory.mktemp(\"\")\n for key, val in file_dirs.fs1.items():\n d_ = dir_ / key\n d_.mkdir()\n for v in val:\n f = d_ / v\n f.write_text(v)\n\n return dir_", "def test_create_package_dir(self):\n tempdir = temp...
[ "0.70191664", "0.7013604", "0.698688", "0.69665825", "0.69533265", "0.6950264", "0.693869", "0.6925292", "0.6894311", "0.68942744", "0.6829544", "0.68111145", "0.6789586", "0.6720963", "0.66981107", "0.6693346", "0.66496074", "0.66464376", "0.6644095", "0.6634636", "0.6599678...
0.68230975
11
Derivative of creep rate wrt. effective stress
def test_dg_ds(self): dfn = lambda x: self.model.g(x, self.e, self.t, self.T) nderiv = differentiate(dfn, self.s) cderiv = self.model.dg_ds(self.s, self.e, self.t, self.T) self.assertTrue(np.isclose(nderiv, cderiv, rtol = 1.0e-4))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _derivativeTerm(self):\n\n\t\treturn self._Kd * (self._getErrorFunction() - self._previousError) / self._dt", "def spread_dye(self, dt=0.1):\n #advection operator\n #This moves quite well now\n du_dt = -np.add.reduce(self.u*np.array(np.gradient(self.dye)))\n #diffusion \n du_dt += ...
[ "0.6372542", "0.6367452", "0.6367319", "0.61802053", "0.6128586", "0.6094947", "0.59971654", "0.59892225", "0.5988831", "0.596693", "0.5954394", "0.59403634", "0.58852684", "0.5875006", "0.58580124", "0.58512837", "0.5836796", "0.58320224", "0.5810952", "0.58070856", "0.57973...
0.0
-1
read in a file and return a list of stripped lines
def read_lines_from_file(fname): return []
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _fileLinesToList(filename) :\n o = []\n with open(filename, \"r\") as fi :\n for l in fi :\n if l.strip() != \"\" :\n o.append(l.strip())\n return o", "def readFile(filePath):\n with open(filePath, 'r') as f:\n return [l.strip() for l in f.readlines()]", ...
[ "0.7964627", "0.768986", "0.75795406", "0.74847573", "0.7434877", "0.74141115", "0.73847467", "0.7288268", "0.728643", "0.7284989", "0.7227255", "0.72183716", "0.7174758", "0.7172863", "0.7153921", "0.7136361", "0.7121331", "0.70698094", "0.7020399", "0.69598377", "0.69580567...
0.72413737
10
tokenize words in a line. Split off punctuation as their own tokens, do not lowercase
def tokenize_words(line): return
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _tokenize_line(self, line: str, pattern='\\W'):\n # TODO check nltk tokenize\n # TODO check string not to lower\n line = re.sub(\"[.,;:]\", \" \", line)\n return re.split(pattern, line.lower())", "def tokenize(txt):\n Depunc = depunctuate(txt).lower()\n Tokens = word_tokeniz...
[ "0.77605253", "0.77121097", "0.764658", "0.75459456", "0.7538799", "0.7468105", "0.74550766", "0.74317896", "0.72965765", "0.7282443", "0.7263344", "0.7237906", "0.7215812", "0.7205909", "0.7195928", "0.7187725", "0.71873933", "0.7134091", "0.7110255", "0.7108942", "0.7108439...
0.8048953
0
Turn a sequence of text lines into a series of charactertokenized words
def tokenize_wordchars(lines): return
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def tokenize_words(line):\n return", "def wordize(lines):\n parser = Parser()\n tokenizer = Tokenizer()\n word_ctr = WordCounter()\n words = []\n for l in lines :\n if (l.rstrip()) :\n statement = parser.parseSentence(l, int(word_ctr))\n token_lists = toke...
[ "0.7397153", "0.7216316", "0.70691586", "0.7039822", "0.69518965", "0.69235104", "0.68344384", "0.6771861", "0.67537725", "0.6751134", "0.67166775", "0.6694033", "0.6621886", "0.6621103", "0.66096437", "0.66055995", "0.6604272", "0.6597931", "0.6592317", "0.6592143", "0.65881...
0.7595349
0
Pad a sequence of tokens
def pad(seq, n): return
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def pad_tokens(x, max_length, pad_token_id,\n truncate_from=\"left\",\n pad_from=\"left\"):\n assert truncate_from in (\"left\", \"right\")\n assert pad_from in (\"left\", \"right\")\n if len(x) > max_length:\n if truncate_from == \"left\":\n return x[-max_len...
[ "0.7385344", "0.70966196", "0.70363396", "0.6952064", "0.6934453", "0.69025654", "0.68308717", "0.67572653", "0.6725819", "0.6710365", "0.6680553", "0.6674627", "0.6671714", "0.6661034", "0.6654633", "0.6654633", "0.6654633", "0.6634638", "0.6613785", "0.6592731", "0.6564213"...
0.720486
1
Returns a list of ngrams with padding from a sequence
def get_ngrams(seq, n): return
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def extract_ngrams(self, sequence):\n sequence = self.prefix + sequence + self.suffix\n for i, event in enumerate(sequence[self.n:], self.n):\n yield event, sequence[i-self.n: i]", "def ngrams_bursts(len_seq, round=None):\n bursts = get_bursts(len_seq)\n ngrams = np.array(list(map(...
[ "0.7271567", "0.70892024", "0.69835466", "0.6965617", "0.6952515", "0.6923863", "0.69081914", "0.68393636", "0.67482096", "0.67158514", "0.6708789", "0.6705855", "0.66821665", "0.66747797", "0.6673801", "0.66599643", "0.6646314", "0.6633204", "0.66280967", "0.66151416", "0.66...
0.7441442
0
Get a matrix to rotate 2D vector by the angle.
def rotation_matrix(angle) -> np.array: return np.array([ [np.cos(angle), np.sin(angle)], [-np.sin(angle), np.cos(angle)]])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def rotation_matrix_2d(angle):\n psi = Angle(angle).rad\n return np.array([[cos(psi), -sin(psi)],\n [sin(psi), cos(psi)]])", "def rotation_matrix2(angle):\n c, s = cos(angle), sin(angle)\n return np.array([[c, -s], [s, c]])", "def rotate_matrix(angle):\n c = np.cos(angle)\n ...
[ "0.8067858", "0.8040819", "0.80001503", "0.78312284", "0.756407", "0.7544059", "0.75000864", "0.7468775", "0.74164057", "0.7258574", "0.72506195", "0.724604", "0.72397715", "0.7237875", "0.7208129", "0.7200528", "0.7190112", "0.71698904", "0.7112522", "0.70885587", "0.7055151...
0.76735556
4
Excludes any questions that aren't published yet.
def get_queryset(self): return Question.objects.filter(pub_date__lte=timezone.now())
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_queryset(self):\n # the filter says that it only returns those w/ the pub_date\n # less or equal to timezone.now() (earlier or now)\n questions = Question.objects.filter(\n pub_date__lte=timezone.now()\n ).order_by('-pub_date')\n\n excludes = []\n for qu...
[ "0.66057587", "0.6447535", "0.6222388", "0.6170101", "0.6170101", "0.6101224", "0.6100283", "0.6083196", "0.6055842", "0.60525465", "0.5971601", "0.5893893", "0.5893893", "0.5890032", "0.5882812", "0.58696455", "0.58696455", "0.58696455", "0.58696455", "0.58689994", "0.585721...
0.62109476
14
Converts the given "size" into its corresponding bytes representation rounded to two decimal places.
def convert(size: int) -> str: kilo = 1024 sizes = ['bytes', 'kB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB'] index = 0 while int(size / kilo) > 0: size /= kilo index += 1 suffix = sizes[index] if index == 0 and size == 1: suffix = 'byte' return f'{round(size, 2)} {su...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def bytes_to_size(size):\n if not size >> 10 or size < 0:\n return str(size)\n elif not size >> 20:\n return '{:.2f}KB'.format(size / 1024.0)\n elif not size >> 30:\n return '{:.2f}MB'.format(size / (1024.0 ** 2))\n elif not size >> 40:\n return '{:.2f}GB'.format(size / (102...
[ "0.7419334", "0.7239687", "0.71448714", "0.70860016", "0.70038813", "0.6981939", "0.6940342", "0.69403017", "0.69372475", "0.6824189", "0.67693704", "0.6766561", "0.6762347", "0.67495024", "0.6720615", "0.6656718", "0.6612749", "0.65799737", "0.65624624", "0.65548813", "0.655...
0.7080149
4
Paginate a queryset if required, either returning a page object, or `None` if pagination is not configured for this view.
def paginate_queryset(self, queryset, request, view=None): # page_size = self.get_page_size(request) page_size = request.GET.get("page_size") if not page_size: return None paginator = self.django_paginator_class(queryset, page_size) page_number = request.query_params...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def paginate_queryset(self, queryset, request, view=None):\n page_size = self.get_page_size(request)\n if not page_size:\n return None\n\n paginator = self.django_paginator_class(queryset, page_size)\n page_number = self.page_query_param\n if page_number in self.last_p...
[ "0.8201127", "0.8201127", "0.80074996", "0.80074996", "0.7759417", "0.76711303", "0.74348986", "0.73807716", "0.72447085", "0.7224599", "0.71422416", "0.7008466", "0.6944738", "0.68655074", "0.6469646", "0.64126694", "0.6407833", "0.6318334", "0.6310198", "0.62713957", "0.624...
0.80234265
2
Allows the author (bot owner) to send a message as this bot to a channel The author must be a member of the channel
async def impersonate(self, ctx: Context, channel: TextChannel, msg: str): if user_present(ctx, channel): await channel.send(f"```{msg}```")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async def contact(self, ctx, *, message : str):\n # [p]contact\n\n if not User.objects.get(is_owner=True).exists():\n await self.bot.say(\"I have no owner set.\")\n return\n owner = User.objects.get(is_owner=True)[0].id\n author = ctx.message.author\n if ctx...
[ "0.7028661", "0.6846785", "0.6638624", "0.6611962", "0.65773445", "0.654346", "0.65390414", "0.6486731", "0.64749056", "0.64306575", "0.64015067", "0.6382261", "0.63678914", "0.63417226", "0.63326657", "0.63081276", "0.63014096", "0.6297781", "0.6289612", "0.6284865", "0.6264...
0.63301533
15
Check if the article has doi
def search_doi(self, soup): doi_tag = soup.find("link", {"title": "doi"}) if doi_tag: self.log.warning(f"article has doi: {doi_tag['href']}")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def canDo_article(self, artMeta):\n return False", "def citationContainsDOI(citation):\n if citation.startswith(\"doi:\"):\n return True\n elif citation.startswith(\"@doi:\"):\n return True\n elif citation.startswith(\"[@doi\"):\n return True\n else:\n return False"...
[ "0.66598725", "0.6236125", "0.6175385", "0.6133733", "0.6077363", "0.60291886", "0.5789463", "0.5774737", "0.57515675", "0.5724018", "0.5718849", "0.5713791", "0.5712822", "0.56964505", "0.56774914", "0.56744105", "0.56172967", "0.5587204", "0.55768776", "0.5536261", "0.55203...
0.68806785
0
Slice an iterable into chunks of n elements
def split_every(n, iterable): iterator = iter(iterable) return takewhile(bool, (list(islice(iterator, n)) for _ in repeat(None)))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def chunk(iterable, n):\n iterable = [e for e in iterable]\n avg_length = int(math.ceil(len(iterable) / n))\n return [iterable[i * avg_length:(i + 1) * avg_length] for i in range(n)]", "def chunks(l, n):\n for i in range(0, n):\n yield l[i::n]", "def take(n, iterable):\n return li...
[ "0.8605116", "0.8274034", "0.82337856", "0.82337856", "0.8224182", "0.8219808", "0.8185373", "0.8185373", "0.8172492", "0.8172492", "0.8172492", "0.8172492", "0.8172492", "0.81594604", "0.81594604", "0.81477994", "0.8143845", "0.8135955", "0.8135955", "0.8135955", "0.8135955"...
0.0
-1
Save output as CSV
def csvReceiver(request, model=''): from django.conf import settings settings.DATA_UPLOAD_MAX_MEMORY_SIZE = 10485760 # 10MB => 10485760 bytes (IEC units) try: request_data = request.POST.get('run_data') run_data = json.loads(request_data) except Exception as error: logging.warning("CSV ERROR: {}".format(er...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def save_csv(self, filename): # DONE\n self.data.to_csv(filename)", "def csv_output(self):\r\n fh = open(\"output.csv\",'w')\r\n for i in range(len(self.population.columns)):\r\n if i != len(self.population.columns)-1:\r\n fh.write(str(self.population.columns[i]))\r...
[ "0.7832679", "0.7661536", "0.76505005", "0.7645986", "0.75368834", "0.7517784", "0.7439497", "0.7408098", "0.7364059", "0.732227", "0.7297033", "0.7274766", "0.72592133", "0.72273564", "0.72243804", "0.7216282", "0.71935153", "0.7185887", "0.7178194", "0.7171201", "0.71544415...
0.0
-1
Method to set a humanreadable representation of this obj.
def __str__(self): return self.title
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __str__(self):\n assert not hasattr(self, \"value\")\n if self.is_set:\n return \"%s \" % self.names[0]\n else:\n return \"\"", "def __str__(self):\n return str(self.obj)", "def __str__(self):\n if self.__description:\n return self.__descr...
[ "0.67239904", "0.672306", "0.6692129", "0.6673624", "0.6673624", "0.6653927", "0.6640004", "0.6606418", "0.65894645", "0.6554855", "0.6554855", "0.6554855", "0.6554855", "0.6554855", "0.654125", "0.65394354", "0.6531497", "0.65162945", "0.6516014", "0.6515813", "0.65047324", ...
0.0
-1
Constructor of MatchEventResource class.
def __init__(self, play, resource, base_uri, auth): super(MatchEventResource, self).__init__(base_uri,auth) self.endpoint += "/%s/events/%s" % (play, resource)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, play, base_uri, auth):\n self.all = MatchEventResource(play, \"all\", base_uri, auth)\n self.touches = MatchEventResource(play, \"touches\", base_uri, auth)\n self.actions = MatchEventResource(play, \"actions\", base_uri, auth)", "def __init__(self, base_uri, auth):\n ...
[ "0.6920767", "0.6880904", "0.6493034", "0.63187784", "0.6206747", "0.6151082", "0.61232126", "0.60332555", "0.60108036", "0.59568983", "0.5956645", "0.59483933", "0.59275824", "0.58894855", "0.58667576", "0.5839011", "0.5834587", "0.5828129", "0.5790298", "0.57744706", "0.576...
0.773245
0
This is a more general form of batched_index The last dimension of `indices` contains indices for the last dimension of `values`, and the shape of `indices` must have the same trailing dimensions as `values` (excluding the final index `num_values` dimension). `values` will be broadcast to the correct shape to match up ...
def broadcast_index(values, indices): assert_array(indices, shape=(...,) + values.shape[:-1]) indexed_values = jp.take_along_axis( values.reshape((1,) + values.shape), indices.reshape((-1,) + values.shape[:-1] + (1,)), axis=-1, ) flat_result = jp.squeeze(indexed_values, ax...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def batch_index(vectors, indices, name=None):\n with ops.op_scope([vectors, indices], name, \"BatchIndex\"):\n vectors = ops.convert_to_tensor(vectors, name=\"vectors\")\n vectors_shape = array_ops.shape(vectors)\n vectors_rank = array_ops.size(vectors_shape)\n\n indices = ops.convert_to_tensor(indice...
[ "0.68931663", "0.6836271", "0.6658844", "0.6437845", "0.63642806", "0.633006", "0.61302286", "0.59927684", "0.5962183", "0.5946811", "0.5876271", "0.5853925", "0.5835901", "0.58120316", "0.5771986", "0.57357997", "0.5734234", "0.57254654", "0.570254", "0.5672705", "0.5656199"...
0.80796975
0
Determine if symbol is a numeral.
def is_numeral(self, symbol: str) -> bool: return symbol in self.numerals
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _is_number(self, symbol):\n if symbol.type == self.scanner.NUMBER:\n return True\n else:\n return False", "def is_number(symbol):\n return isa(symbol, complex) or is_rational(symbol)", "def isnumeric(self):\n return isnumeric(self)", "def is_numeric (self) :\...
[ "0.803169", "0.7637885", "0.7054013", "0.69927293", "0.6897488", "0.68663126", "0.66618204", "0.6547865", "0.6503085", "0.6478518", "0.64356184", "0.6434759", "0.64101577", "0.6402998", "0.6399946", "0.63990355", "0.63915384", "0.63823473", "0.636919", "0.6355928", "0.6333523...
0.85404074
0
Determine if symbol is an operator.
def is_operator(self, symbol: str) -> bool: return symbol in self.operators
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def isoperator(token):\n\n # Token is an operator\n return token and token.lower() in Token.OPERATORS", "def isOperator(self):\n return _libsbml.ASTNode_isOperator(self)", "def is_operator(operator):\n\t\tlist_of_operators = [\"+\", \"-\", \"*\", \"/\"]\n\t\treturn operator in list_of_oper...
[ "0.7797608", "0.7420731", "0.740328", "0.72664803", "0.718645", "0.7069127", "0.70586026", "0.7015262", "0.6987882", "0.684114", "0.67984575", "0.6589664", "0.6580816", "0.6557067", "0.6475472", "0.6403359", "0.6351468", "0.6244044", "0.6234342", "0.62134767", "0.620602", "...
0.8688217
0
Divide vector by np.linalg(norm(data,p)
def norm(data,p=2): data = data / np.linalg.norm(data,p) return data
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def normalize(v):\n return np.array(v) / np.linalg.norm(v)", "def normalize(v):\n return v / np.linalg.norm(v)", "def normalize(vector):\n return vector / np.linalg.norm(vector)", "def normBySum(vector):\n\treturn np.divide(vector,float(sum(vector)))", "def normalize(self):\n self.vecto...
[ "0.71680033", "0.71559286", "0.68717515", "0.6865527", "0.6817883", "0.67394066", "0.67113805", "0.6676461", "0.66713446", "0.66446674", "0.6631767", "0.6627595", "0.6609371", "0.65961975", "0.6591781", "0.65771824", "0.654406", "0.6531321", "0.6528698", "0.6528349", "0.65185...
0.82715553
0
Returns a list of tokenized sentences, which in turn are a list of token tuples. Use flatify() to get a flat list of tokens.
def span_tokenize_words(self, text): sentences = self.tokenize_sentences(text) tokens_per_sentence = list() sentence_offset = 0 sentence_counter = 0 for sentence in sentences: sentence_tokens = list() for token in self.word_tokenizer.span_tokenize(sentence): # save actual token together with it's...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sentences(self) -> List[str]:\n\t\treturn [self.text[start:end] for start, end in self.tokenizations]", "def sentences(self) -> List[str]:\n\t\treturn [self.text[start:end] for start, end in self.tokenizations]", "def tokenize_sentences(self, sents):\n token_sentence_list = []\n for sentence ...
[ "0.78001237", "0.78001237", "0.7475943", "0.7303873", "0.72187954", "0.72143084", "0.72014064", "0.71956354", "0.71415436", "0.7098754", "0.70789516", "0.6899366", "0.68989587", "0.6894929", "0.68701935", "0.68701935", "0.6853845", "0.67335445", "0.672983", "0.6712718", "0.66...
0.0
-1
Takes as input tokens with position information, and returns a list in the form of [0] token, [1] start position, [2] end position, [4] postag
def pos_tag(self, span_tokens): # nltk.pos_tag() takes as argument a list of tokens, so we need to get rid of positions first, then pos-tag, then reconcile with position information tokens = list() for span_token in span_tokens: tokens.append(span_token[0]) tagged_tokens = nltk.pos_tag(tokens) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def token_positions(separation):\n offsets = (-separation, 0, separation)\n for x_pos in offsets:\n for y_pos in offsets:\n yield x_pos, y_pos", "def append_position_to_token_list(token_list):\r\n return [PositionToken(value.content, value.gd, index, index+1) for (index, value) in enum...
[ "0.7312123", "0.6982316", "0.69612277", "0.6885041", "0.6824587", "0.6763596", "0.6546044", "0.64287496", "0.64170194", "0.64170194", "0.6391342", "0.63810486", "0.6361784", "0.6344948", "0.63403684", "0.63328403", "0.6316926", "0.629012", "0.6273922", "0.6265908", "0.6239559...
0.5474655
87
".txt .html" => [".txt", ".html"]
def filterExtStrToArray(filterExt): if filterExt is None: return [] fe = filterExt.split(" ") for f in fe: assert f[0] == "." return fe
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def handle_filenames(filenames):\n suffixes = [\".mod\", \".dat\", \".run\"]\n if len(filenames) == 1:\n return (filenames[0].with_suffix(suffix) for suffix in suffixes)\n else:\n try:\n return sorted(filenames, key=lambda x: suffixes.index(x.suffix))\n except ValueError:\n...
[ "0.63736695", "0.6172243", "0.6062613", "0.60349804", "0.60289073", "0.6018326", "0.5990784", "0.5881347", "0.58601695", "0.58374596", "0.5818819", "0.58052814", "0.5801825", "0.57877153", "0.573902", "0.57327855", "0.57181674", "0.5700485", "0.5694006", "0.5662008", "0.56606...
0.57633764
14
Add company object to companies in profile.
def set_favorite(request): company_id = request.data.get('id') company = Company.objects.get(id=company_id) request.user.profile.companies.add(company) return Response({'favorite': True})
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def company(self, company):\n self._company = company", "def company(self, company):\n\n self._company = company", "def company(self, company):\n\n self._company = company", "def update_company(cls, **kwargs):\n return cls._do_call(\n 'PUT', cls.api_endpoint + 'companie...
[ "0.6411191", "0.6372567", "0.6372567", "0.5833871", "0.5741843", "0.57113254", "0.55899", "0.5559143", "0.5534828", "0.54571545", "0.5390277", "0.5384228", "0.53826225", "0.5279928", "0.5250841", "0.5248809", "0.5242812", "0.5214951", "0.5209756", "0.51895386", "0.51502573", ...
0.539655
10
Remove company object from the profile companies.
def delete_favorite(request): company_id = request.data.get('id') company = Company.objects.get(id=company_id) request.user.profile.companies.remove(company) return Response({'favorite': False})
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_website_companies_remove_additions(self):\n pass", "def del_co_worker(self, employee):\n self.co_worker_list.remove(employee)", "def delete_company(id):\n\n companyss = Company_list.query.get_or_404(id)\n db.session.delete(companyss)\n db.session.commit()\n flash('You have su...
[ "0.57850075", "0.5781147", "0.5559639", "0.54350436", "0.5422553", "0.54216486", "0.54206294", "0.53598124", "0.5345084", "0.53290075", "0.5302702", "0.5293525", "0.5283402", "0.52183515", "0.52140254", "0.51945", "0.5173765", "0.5170144", "0.51637626", "0.51439434", "0.51413...
0.5477691
3
Create a scalar dataset.
def test_create_scalar(setup_teardown_file): f = setup_teardown_file[3] grp = f.create_group("test") dset = grp.create_dataset('foo', ()) assert dset.shape == () assert dset.data == 0
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_create_scalar_data(setup_teardown_file):\n f = setup_teardown_file[3]\n grp = f.create_group(\"test\")\n\n data = np.ones((), 'f')\n dset = grp.create_dataset('foo', data=data)\n assert dset.shape == data.shape", "def create_scalar_dataset(py_obj, h_group, name, **kwargs):\n\n # If py_...
[ "0.7555948", "0.74053794", "0.71166986", "0.70370466", "0.67874575", "0.67613685", "0.67136246", "0.6624108", "0.6566818", "0.64354485", "0.64062387", "0.63952684", "0.6379713", "0.6377099", "0.63157344", "0.6279742", "0.62675583", "0.62348354", "0.6224659", "0.6196138", "0.6...
0.73437566
2
Create a size1 dataset.
def test_create_simple(setup_teardown_file): f = setup_teardown_file[3] grp = f.create_group("test") dset = grp.create_dataset('foo', (1,)) assert dset.shape == (1,)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_create_scalar_data(setup_teardown_file):\n f = setup_teardown_file[3]\n grp = f.create_group(\"test\")\n\n data = np.ones((), 'f')\n dset = grp.create_dataset('foo', data=data)\n assert dset.shape == data.shape", "def CreateDataset(all_arrays):\n dataset = Dataset()\n\n dataset._add...
[ "0.66776466", "0.63253224", "0.6317676", "0.628649", "0.62560594", "0.62130105", "0.61993486", "0.61714923", "0.61680335", "0.61638147", "0.6123829", "0.60656995", "0.6027564", "0.6025986", "0.59521925", "0.59410626", "0.593032", "0.5920238", "0.588498", "0.5853391", "0.58476...
0.63751405
1
Create an extended dataset.
def test_create_extended(setup_teardown_file): f = setup_teardown_file[3] grp = f.create_group("test") dset = grp.create_dataset('foo', (63,)) assert dset.shape == (63,) assert dset.size == 63 dset = f.create_dataset('bar', (6, 10)) assert dset.shape == (6, 10) assert dset.size == (60)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_create_extended_data(setup_teardown_file):\n f = setup_teardown_file[3]\n grp = f.create_group(\"test\")\n\n data = np.ones((63,), 'f')\n dset = grp.create_dataset('foo', data=data)\n assert dset.shape == data.shape", "def _create_dataset(source=''):\n return ExperimentalDataset()"...
[ "0.7515578", "0.7275026", "0.6902415", "0.6832262", "0.6757662", "0.6732214", "0.66974825", "0.641923", "0.6374098", "0.63700813", "0.63511705", "0.6302297", "0.6257589", "0.62441385", "0.6233382", "0.6224441", "0.62097985", "0.6175838", "0.6173899", "0.6168725", "0.6145437",...
0.72346354
2
Create a scalar dataset from existing array.
def test_create_scalar_data(setup_teardown_file): f = setup_teardown_file[3] grp = f.create_group("test") data = np.ones((), 'f') dset = grp.create_dataset('foo', data=data) assert dset.shape == data.shape
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def CreateDataset(all_arrays):\n dataset = Dataset()\n\n dataset._addData(all_arrays[0])\n dataset._addData(all_arrays[1])\n dataset._addData(all_arrays[3])\n dataset._addData(all_arrays[5])\n dataset._addData(all_arrays[6])\n dataset._addData(all_arrays[9])\n dataset._addData(all_arrays[8]...
[ "0.6821058", "0.64814925", "0.63698435", "0.634394", "0.622554", "0.62189054", "0.6193569", "0.6187135", "0.61802596", "0.61786425", "0.6173265", "0.611728", "0.6106714", "0.6106714", "0.6106714", "0.61033773", "0.60495573", "0.6030901", "0.60239", "0.5997959", "0.59902835", ...
0.60595906
16
Create an extended dataset from existing data.
def test_create_extended_data(setup_teardown_file): f = setup_teardown_file[3] grp = f.create_group("test") data = np.ones((63,), 'f') dset = grp.create_dataset('foo', data=data) assert dset.shape == data.shape
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _create_dataset(source=''):\n return ExperimentalDataset()", "def make_dataset(self, df, **kwargs):\n\t\treturn df", "def create_dataset(opt):\n\tdata_loader = CustomDatasetDataLoader(opt)\n\tdataset = data_loader.load_data()\n\treturn dataset", "def create_dataset(opt):\n data_loader = CustomD...
[ "0.68084186", "0.65937513", "0.6585315", "0.64835083", "0.64626086", "0.64139247", "0.63925743", "0.6161693", "0.61608154", "0.6140333", "0.60813063", "0.60358", "0.60156626", "0.599913", "0.5933923", "0.59277993", "0.58952475", "0.5885706", "0.5884419", "0.58815557", "0.5852...
0.6712002
1
require_dataset yields existing dataset.
def test_create_existing(setup_teardown_file): f = setup_teardown_file[3] grp = f.create_group("test") dset = grp.require_dataset('foo', (10, 3), 'float32') dset2 = grp.require_dataset('foo', (10, 3), 'float32') assert dset == dset2
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def generate_dataset(self):\n if self.training:\n dataset = UnpairedDataset(self.opt, self.training)\n datasetA, datasetB = dataset.generate(cacheA='./dataA.tfcache', cacheB='./dataB.tfcache')\n dataA_iter = datasetA.make_initializable_iterator()\n dataB_iter = da...
[ "0.6402683", "0.6268528", "0.6168111", "0.6107526", "0.6085928", "0.60826516", "0.6064839", "0.60485065", "0.59493387", "0.5933804", "0.5933579", "0.5932863", "0.59160846", "0.59056026", "0.58793336", "0.5864763", "0.58533853", "0.5850854", "0.5827773", "0.5824766", "0.582341...
0.0
-1
Bogus fill value raises TypeError.
def test_exc(setup_teardown_file): f = setup_teardown_file[3] grp = f.create_group("test") with pytest.raises(TypeError): grp.create_dataset('foo', (10,), dtype="float32", fillvalue={"a": 2})
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_fill_missing_value(self):\n try:\n # test_size need to be a positive float number\n fill_missing_value(DATA, NEEDED, INPUTS, OUTPUT, test_size=-1.0)\n raise Exception(\"Illegal input test failed!\")\n except AssertionError:\n pass\n\n try:\n...
[ "0.701032", "0.6978738", "0.65874916", "0.63590294", "0.62183875", "0.62084305", "0.6169664", "0.61600447", "0.6122291", "0.60872906", "0.60665476", "0.6040552", "0.6040142", "0.6038271", "0.600779", "0.5999506", "0.5993623", "0.59836775", "0.5949554", "0.5943041", "0.5926904...
0.0
-1
Slice a dataset with a zero in its shape vector along the zerolength dimension.
def test_slice_zero_length_dimension(setup_teardown_file): f = setup_teardown_file[3] for i, shape in enumerate([(0,), (0, 3), (0, 2, 1)]): dset = f.create_dataset('x%d'%i, shape, dtype=np.int32) assert dset.shape == shape out = dset[...] assert isinstance(out, np.ndarray) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_slice_zero_length_dimension(self):\n for i, shape in enumerate([(0,), (0, 3), (0, 2, 1)]):\n dset = self.f.create_dataset('x%d'%i, shape, dtype=int, maxshape=(None,)*len(shape))\n self.assertEqual(dset.shape, shape)\n out = dset[...]\n self.assertIsInstan...
[ "0.7657459", "0.76154137", "0.7181511", "0.6442179", "0.6023808", "0.60095966", "0.58346575", "0.5813324", "0.5806814", "0.5742333", "0.569967", "0.5655909", "0.561355", "0.5560473", "0.5504851", "0.54995966", "0.5472406", "0.54711974", "0.5464312", "0.53662527", "0.53482723"...
0.72690886
2
Slice a dataset with a zero in its shape vector along a nonzerolength dimension.
def test_slice_other_dimension(setup_teardown_file): f = setup_teardown_file[3] for i, shape in enumerate([(3, 0), (1, 2, 0), (2, 0, 1)]): dset = f.create_dataset('x%d'%i, shape, dtype=np.int32) assert dset.shape == shape out = dset[:1] assert isinstance(out, np.ndarray) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_slice_zero_length_dimension(self):\n for i, shape in enumerate([(0,), (0, 3), (0, 2, 1)]):\n dset = self.f.create_dataset('x%d'%i, shape, dtype=int, maxshape=(None,)*len(shape))\n self.assertEqual(dset.shape, shape)\n out = dset[...]\n self.assertIsInstan...
[ "0.799211", "0.78383815", "0.74135536", "0.7234445", "0.67761785", "0.6249378", "0.61838794", "0.6119611", "0.6116061", "0.602715", "0.6015686", "0.5960593", "0.59413993", "0.5904895", "0.5823409", "0.57993585", "0.57915866", "0.5726016", "0.5709519", "0.57010895", "0.5697270...
0.5978276
11
Get a slice of length zero from a nonempty dataset.
def test_slice_of_length_zero(setup_teardown_file): f = setup_teardown_file[3] for i, shape in enumerate([(3, ), (2, 2, ), (2, 1, 5)]): dset = f.create_dataset('x%d'%i, data=np.zeros(shape, np.int32)) assert dset.shape == shape out = dset[1:1] assert isinstance(out, np.ndarray)...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_slice_of_length_zero(self):\n for i, shape in enumerate([(3,), (2, 2,), (2, 1, 5)]):\n dset = self.f.create_dataset('x%d'%i, data=np.zeros(shape, int), maxshape=(None,)*len(shape))\n self.assertEqual(dset.shape, shape)\n out = dset[1:1]\n self.assertIsIn...
[ "0.74664104", "0.7269895", "0.6901413", "0.663758", "0.64878994", "0.6464174", "0.6324863", "0.6320956", "0.63198364", "0.63188845", "0.6291588", "0.6291588", "0.6271832", "0.6161388", "0.61586934", "0.6108015", "0.60768163", "0.60538584", "0.5999484", "0.5993132", "0.5947251...
0.7161468
2
Asks user to specify a city, month, and day to analyze.
def get_filters(): print('Hello! Let\'s explore some US bikeshare data!') # print multiple choice options for cities print('Choose a city to explore:') for i, city in enumerate(CITY_DATA.keys(), 1): print ('{}) {}'.format(i, city.title())) # get user input for city choice city = 0 ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def Raw_Data(city,month,day):\n print(\"The city you have entered is: \",city)\n print(\"The month you have entered is: \",month)\n print(\"The day you have entered is: \",day)", "def get_filters():\n city = None\n month = None\n day = None\n while day == None:\n # TO DO: get user input f...
[ "0.66714007", "0.65354675", "0.64593667", "0.6374057", "0.6348314", "0.63097656", "0.62868035", "0.6259136", "0.62316", "0.62130964", "0.62050414", "0.6181105", "0.6171822", "0.61686903", "0.6158568", "0.61582303", "0.61532456", "0.61444426", "0.6131269", "0.610484", "0.61025...
0.0
-1
Loads data for the specified city and filters by month and day if applicable.
def load_data(city, month, day): df = pd.read_csv(CITY_DATA[CITIES[city]]) df['Start Time'] = pd.to_datetime(df['Start Time']) df['Month'] = df['Start Time'].dt.month df['Day of Week'] = df['Start Time'].dt.dayofweek # get the subset of data where the month matches the one chosen if month != 0...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load_data(city, month, day):\n df = pd.read_csv(CITY_DATA [city])\n \n # convert the Start Time column to datetime\n df['Start Time'] = pd.to_datetime(df['Start Time'])\n \n # extract month and day of week from Start Time to create new columns\n df['month'] = df['Start Time'].dt.month\n ...
[ "0.81323016", "0.8109424", "0.80464303", "0.8042689", "0.8009603", "0.8007148", "0.7999635", "0.7998743", "0.7979305", "0.7974435", "0.7961534", "0.79565644", "0.79476094", "0.7946865", "0.7908892", "0.7908559", "0.7904986", "0.79014856", "0.7893825", "0.7889581", "0.7882678"...
0.79891264
8
Displays statistics on the most frequent times of travel.
def time_stats(df): print('\nCalculating The Most Frequent Times of Travel...\n') start_time = time.time() count = len(df.index) # generates month-based stats if month is not filtered month_value_counts = dict(df['Month'].value_counts()) if len(month_value_counts.keys()) > 1: # display...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def time_stats(df):\n\n print('\\nDisplaying the statistics on the most frequent times of '\n 'travel...\\n')\n start_time = time.time()\n\n # display the most common month\n most_common_month = df['Month'].mode()[0]\n print('For the selected filter, the month with the most travels is: ' +\...
[ "0.80234534", "0.80220866", "0.7914726", "0.7826028", "0.7821531", "0.7813864", "0.7765123", "0.7739495", "0.7735815", "0.773377", "0.76860726", "0.7667975", "0.7651258", "0.7644125", "0.76395637", "0.763636", "0.7624526", "0.76224995", "0.7612101", "0.7599869", "0.7583085", ...
0.0
-1
Displays statistics on the most popular stations and trip.
def station_stats(df): print('\nCalculating The Most Popular Stations and Trip...\n') start_time = time.time() # display most commonly used start station most_common_start_station = ', '.join(list(df['Start Station'].mode())) print('Most commonly used start station: {}'.format(most_common_start_st...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def station_stats(df):\n\n print('\\nCalculating The Most Popular Stations and Trip...\\n')\n start_time = time.time()\n\n # display most commonly used start station\n print(popular_start_station(df))\n\n # display most commonly used end station\n print(popular_end_station(df))\n\n # display m...
[ "0.78160876", "0.76626086", "0.75538874", "0.7491789", "0.7475186", "0.7446511", "0.74301356", "0.7424136", "0.7417956", "0.7400676", "0.738748", "0.7385726", "0.73651963", "0.7359407", "0.73569685", "0.73552465", "0.73522156", "0.7351514", "0.7350588", "0.73423624", "0.73401...
0.70912826
64
Displays statistics on the total and average trip duration.
def trip_duration_stats(df): print('\nCalculating Trip Duration...\n') start_time = time.time() # display total travel time total_duration = df['Trip Duration'].sum() total_duration_h = get_human_readable_time(total_duration) print('Total travel duration: {}'.format(total_duration_h)) # d...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def trip_duration_stats(data):\n print('\\nCalculating Trip Duration...\\n')\n start_time = time.time()\n # display total travel time\n total_trip_time= data['Trip Duration'].sum()\n print('The Total Travel Time is {} Hours'. format(total_trip_time/3600))\n # display mean travel time\n avg_tri...
[ "0.814274", "0.8025143", "0.80041367", "0.79496753", "0.7937415", "0.79312176", "0.7926815", "0.7915187", "0.79142886", "0.7908032", "0.79055744", "0.7900715", "0.7891682", "0.78894734", "0.7886722", "0.78851086", "0.7884266", "0.7882474", "0.78738385", "0.78686154", "0.78664...
0.7720851
63
Simple implementation to get a vector in 2D perpendicular to any vector.
def get_perpendicular2d(vector): if vector[1] == 0: return np.asarray([0.,1.]) v2_0 = 1.0 v2_1 = -(vector[0]/vector[1]) v2 = np.asarray([v2_0, v2_1]) return v2 / np.linalg.norm(v2)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def perpendicular_vector(v):\n if v[1] == 0 and v[2] == 0:\n if v[0] == 0:\n raise ValueError(\"zero vector\")\n else:\n return np.cross(v, [0, 1, 0])\n return np.cross(v, [1, 0, 0])", "def find_perpendicular_vector(vt):\n x, y = vt\n return np.array([y, -x])", "...
[ "0.8440572", "0.83489484", "0.83253074", "0.8208111", "0.7959264", "0.7835212", "0.77422345", "0.75077933", "0.7490126", "0.72726524", "0.7181764", "0.7017466", "0.68976957", "0.6764215", "0.67396665", "0.67232853", "0.6687472", "0.666389", "0.6661838", "0.6651715", "0.664834...
0.86717033
0
Timeformat for hours the default is the current time
def hour(n=0): now = datetime.datetime.now() h = now + datetime.timedelta(hours=n) return h.strftime('%Y%m%d'), h.strftime('%Y%m%d%H')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def format_time(self, time):\n hours = time // 3600\n time = time - hours*3600\n minutes = time // 60\n seconds = time - minutes*60\n return ('%d:%d:%d' %(hours, minutes, seconds))", "def _hour_to_time(num: int):\n return datetime.datetime.now().replace(hour=num).strftime(\"...
[ "0.7395435", "0.73792773", "0.7370909", "0.73496103", "0.72637945", "0.70698816", "0.6998922", "0.69609916", "0.68986577", "0.68864006", "0.681816", "0.6801484", "0.67640454", "0.6727292", "0.67254925", "0.6706186", "0.66761106", "0.6653804", "0.66378146", "0.6632539", "0.662...
0.6322758
38
Initiate the file explorer buttons
def init_explorer_buttons(self): self.btn_prev_dir = QtWidgets.QPushButton() self.btn_prev_dir.setIcon(QtGui.QIcon(resource_path("resource/previous.png"))) self.btn_prev_dir.clicked.connect(self.previous_directory) self.path_viewer = QtWidgets.QLineEdit() self.path_viewer....
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def on_openFilesButton_clicked(self):\n self.__enableFindButton()", "def init_file_explorer(self):\r\n # initiate both sub layouts\r\n self.init_explorer_buttons()\r\n self.init_file_tree()\r\n\r\n # add them to the file explorer layout\r\n self.layout_file_explorer = Qt...
[ "0.75652385", "0.7353961", "0.68364227", "0.6765863", "0.67552453", "0.6721992", "0.6675374", "0.66087437", "0.65553313", "0.6554096", "0.65508354", "0.65030956", "0.6482314", "0.6464418", "0.6462808", "0.6435497", "0.6399874", "0.6347004", "0.6338508", "0.6337424", "0.632141...
0.74649197
1
Get absolute path to resource, works for dev and for PyInstaller
def resource_path(relative_path): try: # PyInstaller creates a temp folder and stores path in _MEIPASS base_path = sys._MEIPASS except Exception: base_path = os.path.abspath(".") return os.path.join(base_path, relative_path)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_resource_path():\n return os.path.join(os.path.dirname(__file__), \"resources\") + os.path.sep", "def resourcePath(relative):\r\n try:\r\n # PyInstaller creates a temp folder and stores path in _MEIPASS\r\n base_path = sys._MEIPASS\r\n except Exception:\r\n base_path = os.pa...
[ "0.8370207", "0.8280719", "0.8248514", "0.81387657", "0.8113593", "0.8098866", "0.80943495", "0.80799586", "0.8067939", "0.8067573", "0.8056859", "0.80546963", "0.80450433", "0.80450433", "0.80450433", "0.80450433", "0.80450433", "0.80450433", "0.80450433", "0.80450433", "0.8...
0.8062756
12
Estimate of KL divergence D(P||Q) in bits of input sample. This function returns a scalar estimate of the KL divergence D(P||Q) between sampP and samp Q when they are vectors, or returns a row vector consisting of the estimate of each column of the sample when they are matrices.
def est_rel_entro_HJW(sampP, sampQ): sampP = formalize_sample(sampP) sampQ = formalize_sample(sampQ) [m, sizeP] = sampP.shape [n, seq_num] = sampQ.shape n = float(n) m = float(m) if (sizeP != seq_num): raise Exception('Input arguments P and Q must have the same ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def KLDiv(sample_E, sample_T):\n x = np.unique(sample_E.append(sample_T))\n x = x.reshape((x.size, 1))\n \n P = sample_E.to_numpy().reshape((sample_E.size, 1))\n Q = sample_T.to_numpy().reshape((sample_T.size, 1))\n \n model = KernelDensity(bandwidth=2)\n model.fit(P)\n prob_P = np.exp(m...
[ "0.68070227", "0.66686493", "0.65180445", "0.6497283", "0.6372498", "0.6168718", "0.60953796", "0.6090972", "0.60685164", "0.5899999", "0.5896459", "0.5771259", "0.56849676", "0.5683152", "0.56793797", "0.5658389", "0.55707645", "0.5558897", "0.5555757", "0.55191946", "0.5461...
0.48212984
82
A function that can convert query result from pyodbc into pandas dataframe. A pandas dataframe and a list of column name would be returned
def FetchQueryResultToDF(data, col_name: List[str]) -> pd.DataFrame: result = [] for row in data: to_be_append = [] for col in row: to_be_append.append(col) result.append(to_be_append) df = pd.DataFrame(result, columns=col_name) print(df) return df
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def postgresql_to_dataframe(conn, select_query, column_names):\n cursor = conn.cursor()\n try:\n cursor.execute(select_query)\n except (Exception, psycopg2.DatabaseError) as error:\n print(\"Error: %s\" % error)\n cursor.close()\n return 1\n \n # Naturally we get a list o...
[ "0.7475092", "0.73032814", "0.7193511", "0.71156037", "0.7086252", "0.70581037", "0.70031", "0.69601256", "0.69179857", "0.6882428", "0.6850715", "0.68039703", "0.67981046", "0.6769554", "0.6737067", "0.668323", "0.66773254", "0.6673814", "0.6667342", "0.66429675", "0.6623221...
0.723909
2
Initializes class, does initial tests to make sure Population Algorithm code works, and sets continuous testing test level
def __init__(self, source, testing_level=1, verbosity=1, test_functions=False): if test_functions: for i in [self.test_set(), self.test__cross(), self.test_run(), self.random_test(source)]: if i != 1: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, testing_level=1, verbosity=1):\r\n for i in [self.test_set(),\r\n self.test__cross(),\r\n self.test_eval(),\r\n self.test_run(),\r\n self.random_test()]:\r\n if i != 1:\r\n print(\"WARNING: AN ER...
[ "0.71165", "0.7110746", "0.6828451", "0.6797196", "0.6787502", "0.6787122", "0.67850393", "0.6764761", "0.67641073", "0.67410713", "0.67274195", "0.67188424", "0.6714801", "0.6680613", "0.66507477", "0.6646914", "0.6643325", "0.6641138", "0.6632574", "0.6607645", "0.66057485"...
0.678331
7
Tests if inputs given to ParticleSwarmOptimization.set() are valid
def c_test_set_inp(self, param, value): ret = 1 if "__hash__" not in dir(param): # param must be hashable ret = 0 if self.verbosity > 0: print("ERROR: " + param + " is not hashable. It will be unable to be set in a dict.") else: if self...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check_optimization_sanity(self):\n if len(self.parameters) == 0:\n msg = \"No parameters defined. Optimization not possible.\"\n raise ValueError(msg)\n\n if len(self.constraints) == 0:\n msg = \"No constraints defined. Optimization not possible.\"\n ra...
[ "0.65510714", "0.6440568", "0.6307175", "0.6219528", "0.61158663", "0.60367036", "0.6016192", "0.5982753", "0.59670335", "0.59365517", "0.5924858", "0.5906669", "0.5882996", "0.586713", "0.58658785", "0.586452", "0.585988", "0.58465636", "0.5843476", "0.58381635", "0.58232385...
0.57401
31
Test for save json to existed dir
def test_save_json(temp_dir): data = json.dumps({"k": "v", "list": [1, 2, 3]}) save_json(temp_dir, data, step=1) assert os.path.exists(os.path.join(temp_dir, "json", "1.json"))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_save_json_not_existed_dir(temp_dir):\n data = json.dumps({\"k\": \"v\", \"list\": [1, 2, 3]})\n dist = os.path.join(temp_dir, 'not_existed')\n save_json(dist, data, step=1)\n\n assert os.path.exists(os.path.join(dist, \"json\", \"1.json\"))", "def test_save_to_file(self):\n self.asser...
[ "0.7949012", "0.7843431", "0.73325527", "0.6786312", "0.6723777", "0.6570085", "0.64280623", "0.63870406", "0.636994", "0.6355431", "0.63428116", "0.63297987", "0.6314483", "0.6314096", "0.62856627", "0.6274736", "0.62622625", "0.62345415", "0.6231444", "0.6230388", "0.619788...
0.75249356
2
Expand a URI template into a URI using the dictionary of values supplied.
def expand_uri(template, values): if template is None: return None assert isinstance(template, bytes) tokens = uri_template_pattern.split(template) expand = URIExpander(values).expand out = [] while tokens: token = tokens.pop(0) if token == b"{": expression = ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_no_variables_in_uri(self):\n uri = \"https://api.github.com/users\"\n t = URITemplate(uri)\n self.assertEqual(t.expand(), uri)\n self.assertEqual(t.expand(users=\"foo\"), uri)", "def uri_template(app, **kwargs):\n assert len(kwargs) == 1\n\n endpoint = kwargs.keys()[0]\...
[ "0.6267197", "0.62057626", "0.58785635", "0.58138263", "0.56382096", "0.5632291", "0.55077493", "0.5492865", "0.5484242", "0.536961", "0.5225532", "0.5206971", "0.5165729", "0.50229394", "0.497745", "0.49492744", "0.4946917", "0.49298322", "0.49294594", "0.491889", "0.4905553...
0.8206494
0
Initializes model parameters beta_0 and mu_0, for logistic and normal models, respectively.
def initialize_model_params(): beta_0 = np.array([0., 0.]) mu_0 = 0. return beta_0, mu_0
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _init_model_params(self):\n super()._init_model_params()\n\n if 'e' in self.init_params:\n if self.init_type == 'uniform':\n if self.nr_no_train_de == 0:\n self.B = [\n np.full(\n (self.n_states, self.n...
[ "0.702577", "0.6745957", "0.6654342", "0.66288054", "0.6567414", "0.6467959", "0.642232", "0.6406394", "0.6399291", "0.6174661", "0.61396325", "0.61020243", "0.6101475", "0.60800946", "0.607234", "0.60481024", "0.6035902", "0.60175866", "0.6011913", "0.60055894", "0.60027236"...
0.8341111
0
Decode a positive integer as a sequence of nonnegative integers.
def int_to_seq(i): s = [] prime = xprimes() while i != 1: s.append(0) p = next(prime) while i % p == 0: s[-1] += 1 i /= p return s
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def recursive_decode(integers, bits=16):\n\n new = []\n power = 2 ** (bits - 1)\n cutoff = [power - 1, 0 - power]\n index = 0\n while index < len(integers):\n value = 0\n while integers[index] in cutoff:\n value += integers[index]\n index += 1\n if inte...
[ "0.6118692", "0.61080056", "0.6056157", "0.600869", "0.5938369", "0.59167063", "0.5770368", "0.5737435", "0.56741315", "0.5577423", "0.5523909", "0.54827476", "0.54712164", "0.5466883", "0.54113626", "0.5391379", "0.5387555", "0.538191", "0.5377896", "0.537341", "0.53650504",...
0.55601054
10
The string representation for a group's class.
def encode_group_class(group_class): itemized = [[list(key), val] for key, val in group_class.iteritems()] itemized.sort() return json.dumps(itemized)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __repr__(self):\n return str(self.group)", "def __repr__(self) -> str:\n\n return f\"{self.group}({self._value})\"", "def __str__(self):\n\n return 'Group(%s)' % self.id", "def __str__(self):\n class_dictionary = vars(self)\n out = self.__class__.__name__\n for k...
[ "0.75681585", "0.71282715", "0.6867435", "0.6845901", "0.6829679", "0.67704064", "0.6750455", "0.6634704", "0.6625348", "0.65721637", "0.6555124", "0.653027", "0.64868677", "0.6485022", "0.6471573", "0.64574116", "0.641978", "0.6398438", "0.6394787", "0.6365013", "0.63615507"...
0.6372175
19
Function to return whether a piece of a given colour has an available exit action, i.e. is on the correct edge of the board.
def at_exit(piece, colour): return ((colour == 'red' and piece.q == BOARDDIM) or (colour == 'green' and piece.r == BOARDDIM) or (colour == 'blue' and piece.q + piece.r == -BOARDDIM))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def opening_moves(state, colour):\n action = OPENING_BOOK[colour].pop(0)\n return action if action in possible_actions(state, colour) else False", "def is_on_board(self, r, c):\r\n return 0 <= r <= 7 and 0 <= c <= 7", "def in_check(self, colour):\n from pieces import King, Queen, Bishop, Kn...
[ "0.67339516", "0.6704776", "0.670475", "0.6620165", "0.6583944", "0.6580688", "0.6541742", "0.6468736", "0.6462971", "0.64498657", "0.6446134", "0.638285", "0.6352695", "0.6322421", "0.63059396", "0.6277671", "0.6262379", "0.62608415", "0.6254682", "0.62472576", "0.6218526", ...
0.7908926
0
Updates the log window with the latest log messages.
def __updateLog(self): try: while True: self.__logWindow.addRow({"log": self.__logs.pop()}) except IndexError: # All log messages read pass
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def refreshLogs():\n\t#Get the current log being viewed\n\tcurrentLog=logSelectionBar.currentIndex\n\tif currentLog in loadedLogs:\n\t\tdisplayLog(loadedLogs[currentLog])", "def refresh(self):\n self.logging.refresh()", "def displayMessages(window,messages=['']):\n \n # update messages tex...
[ "0.67679644", "0.6577363", "0.6355544", "0.6283196", "0.62071216", "0.6173697", "0.6095105", "0.60809994", "0.6012714", "0.5991859", "0.59518087", "0.5949651", "0.5946881", "0.5930215", "0.593011", "0.59214413", "0.58951837", "0.58803755", "0.58574426", "0.5794698", "0.579299...
0.8311903
0
Set abbr attibutes value. set_abbr(value)
def set_abbr(self, value): self._set_one_attribute(self.AttributeNames.ABBR, value) return self
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def stat_name_abbr(self, stat_name_abbr):\n\n self._stat_name_abbr = stat_name_abbr", "def abbreviation(self, abbreviation):\n self._abbreviation = abbreviation", "def set_abbreviation(self, abbreviation_name_prefix):\n abbreviation_name = abbreviation_name_prefix + self.vendor_unique_id\n...
[ "0.6846997", "0.6793119", "0.64380634", "0.61942774", "0.60880804", "0.6003214", "0.5772546", "0.5755241", "0.5662091", "0.5627433", "0.54784876", "0.54779506", "0.5458218", "0.54349875", "0.54138386", "0.5394865", "0.53869545", "0.5339469", "0.5330272", "0.5324541", "0.53072...
0.8365594
0
Test an error is raised if columns is specified as an empty list.
def test_columns_empty_list_error(self): with pytest.raises(ValueError): BaseTransformer(columns=[])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_columns_list_element_error(self):\n\n with pytest.raises(ValueError):\n\n BaseTransformer(columns=[[], \"a\"])", "def _assert_columns_exist(self, columns):\n if not nonstringiter(columns):\n columns = (columns,)\n self_cols = self.columns()\n is_missing ...
[ "0.77266127", "0.7336881", "0.71414435", "0.7130477", "0.70503837", "0.7016952", "0.69575167", "0.69532156", "0.68788284", "0.68737644", "0.68703175", "0.68674195", "0.6845435", "0.6809604", "0.6802391", "0.6802259", "0.6782605", "0.67797375", "0.67663", "0.6735594", "0.67317...
0.8151597
0
Test an error is raised if columns list contains nonstring elements.
def test_columns_list_element_error(self): with pytest.raises(ValueError): BaseTransformer(columns=[[], "a"])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_columns_non_string_error(self):\n\n with pytest.raises(ValueError):\n\n BaseTransformer(columns=1)", "def test_columns_str_error(self):\n\n df = d.create_df_1()\n\n x = BaseTransformer(columns=None)\n\n x.columns = \"a\"\n\n with pytest.raises(ValueError):\n...
[ "0.7826984", "0.7506602", "0.74055666", "0.72649354", "0.70786345", "0.7054868", "0.70084083", "0.69604445", "0.69123435", "0.69001967", "0.6866422", "0.6843086", "0.6833921", "0.6753544", "0.67314917", "0.66187483", "0.6563816", "0.65530694", "0.65391403", "0.65249187", "0.6...
0.7639787
1
Test an error is raised if columns is not passed as a string.
def test_columns_non_string_error(self): with pytest.raises(ValueError): BaseTransformer(columns=1)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_columns_str_error(self):\n\n df = d.create_df_1()\n\n x = BaseTransformer(columns=None)\n\n x.columns = \"a\"\n\n with pytest.raises(ValueError):\n\n x.columns_check(X=df)", "def _assert_columns_exist(self, columns):\n if not nonstringiter(columns):\n ...
[ "0.77008235", "0.71932304", "0.70527077", "0.7035601", "0.702173", "0.6932102", "0.691994", "0.68705267", "0.6844203", "0.6766314", "0.6755188", "0.67210054", "0.6716176", "0.67088974", "0.66347593", "0.66240877", "0.6610743", "0.6584496", "0.6580769", "0.65797603", "0.657453...
0.82176214
0
Test an error is raised if X is not passed as a pd.DataFrame.
def test_X_non_df_error(self): x = BaseTransformer(columns="a") with pytest.raises(ValueError): x.fit("a")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _validate_X(X):\n if not isinstance(X, pd.DataFrame):\n raise ValueError(\"X should be a dataframe.\")", "def test_non_pd_type_error(self):\n\n df = d.create_df_1()\n\n x = BaseTransformer(columns=\"a\")\n\n with pytest.raises(ValueError):\n\n x.fit(X=df, y=[...
[ "0.8289324", "0.7541683", "0.7507772", "0.74813676", "0.7424849", "0.7422742", "0.73366344", "0.7256355", "0.7100495", "0.70355904", "0.6991032", "0.6904181", "0.67178214", "0.66413856", "0.6636349", "0.65999204", "0.65988266", "0.6555072", "0.65341145", "0.6446536", "0.63863...
0.75545466
1
Test an error is raised if y is not passed as a pd.DataFrame or pd.Series.
def test_non_pd_type_error(self): df = d.create_df_1() x = BaseTransformer(columns="a") with pytest.raises(ValueError): x.fit(X=df, y=[1, 2, 3, 4, 5, 6])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_y_no_rows_error(self, y, error_message):\n\n x = BaseTransformer(columns=\"a\")\n\n df = pandas.DataFrame({\"a\": 1}, index=[0])\n\n with pytest.raises(ValueError, match=re.escape(error_message)):\n\n x.fit(X=df, y=y)", "def test_y_multi_col_df_error(self):\n\n df ...
[ "0.7536582", "0.71128315", "0.7038274", "0.6971168", "0.67741394", "0.66506475", "0.661587", "0.65499485", "0.65405136", "0.6407582", "0.6392577", "0.6391401", "0.6341697", "0.62293917", "0.62096363", "0.6181545", "0.61570376", "0.61205214", "0.60912263", "0.607509", "0.60679...
0.7400218
1
Test that self.columns_check is called during transform.
def test_columns_check_called(self, mocker): df = d.create_df_1() x = BaseTransformer(columns="a") expected_call_args = {0: {"args": (df,), "kwargs": {}}} with h.assert_function_call( mocker, tubular.base.BaseTransformer, "columns_check", expected_call_args ): ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_arguments(self):\n\n h.test_function_arguments(\n func=BaseTransformer.columns_check, expected_arguments=[\"self\", \"X\"]\n )", "def test_columns_none_error(self):\n\n df = d.create_df_1()\n\n x = BaseTransformer(columns=None)\n\n assert x.columns is None, ...
[ "0.74804103", "0.73920876", "0.73786765", "0.72652614", "0.7133422", "0.694284", "0.6872893", "0.6848806", "0.68481106", "0.6832504", "0.6827991", "0.6777657", "0.67613244", "0.67160195", "0.66261446", "0.65535694", "0.6538379", "0.64438605", "0.6411406", "0.64001155", "0.633...
0.7963771
0
Test an error is raised if y is not passed as a pd.DataFrame.
def test_non_pd_type_error(self): x = BaseTransformer(columns="a") with pytest.raises(ValueError): x.transform(X=[1, 2, 3, 4, 5, 6])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_y_no_rows_error(self, y, error_message):\n\n x = BaseTransformer(columns=\"a\")\n\n df = pandas.DataFrame({\"a\": 1}, index=[0])\n\n with pytest.raises(ValueError, match=re.escape(error_message)):\n\n x.fit(X=df, y=y)", "def test_non_pd_type_error(self):\n\n df = d...
[ "0.7674062", "0.7563835", "0.7319852", "0.7011999", "0.6942612", "0.6885173", "0.68471336", "0.6843658", "0.67939496", "0.6758083", "0.66701984", "0.65750825", "0.6476808", "0.64359474", "0.63421327", "0.6269279", "0.62622035", "0.623554", "0.6209939", "0.6193414", "0.6149174...
0.67960876
8
Test that columns_check has expected arguments.
def test_arguments(self): h.test_function_arguments( func=BaseTransformer.columns_check, expected_arguments=["self", "X"] )
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def checkcolumnstest(chosen_columns, chosen_df):\n if not all([item in chosen_columns for item in chosen_df.columns]):\n raise ValueError('Columns do not match')", "def test_arguments(self):\n\n h.test_function_arguments(\n func=BaseTransformer.columns_set_or_check, expected_arguments...
[ "0.7379135", "0.737564", "0.72372264", "0.71427846", "0.7058905", "0.7014829", "0.6927043", "0.6858924", "0.6828924", "0.6808814", "0.67640036", "0.6693733", "0.6687287", "0.6682095", "0.6660339", "0.6643111", "0.66078275", "0.65877765", "0.65817136", "0.6558864", "0.653746",...
0.7734957
0
Test an error is raised if X is not passed as a pd.DataFrame.
def test_non_pd_df_error(self): x = BaseTransformer(columns="a") with pytest.raises(ValueError): x.columns_check(X=[1, 2, 3, 4, 5, 6])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _validate_X(X):\n if not isinstance(X, pd.DataFrame):\n raise ValueError(\"X should be a dataframe.\")", "def test_X_non_df_error(self):\n\n x = BaseTransformer(columns=\"a\")\n\n with pytest.raises(ValueError):\n\n x.fit(\"a\")", "def test_non_pd_type_error(self)...
[ "0.8288903", "0.75548375", "0.75421137", "0.75083524", "0.7424613", "0.74220085", "0.7337293", "0.72562003", "0.7099527", "0.7036036", "0.69918245", "0.690495", "0.67170906", "0.6641976", "0.663742", "0.659955", "0.6599031", "0.655624", "0.65348834", "0.644595", "0.63868016",...
0.74820405
4
Test an error is raised if self.columns is None.
def test_columns_none_error(self): df = d.create_df_1() x = BaseTransformer(columns=None) assert x.columns is None, f"self.columns should be None but got {x.columns}" with pytest.raises(ValueError): x.columns_check(X=df)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def verify(self):\n for col in self.columns:\n if col not in self.table_obj.columns.keys():\n raise Exception('{} column not found in {}'.format(\n col, self.table_obj))", "def test_columns_empty_list_error(self):\n\n with pytest.raises(ValueError):\n\n ...
[ "0.7669649", "0.7490792", "0.74768186", "0.7463551", "0.7221205", "0.7131977", "0.7023728", "0.69275975", "0.6908994", "0.68753564", "0.6863218", "0.68602234", "0.6859264", "0.68304217", "0.67614543", "0.6753216", "0.67305374", "0.6721083", "0.67071587", "0.67053515", "0.6679...
0.79975206
0
Test an error is raised if self.columns is not a list.
def test_columns_str_error(self): df = d.create_df_1() x = BaseTransformer(columns=None) x.columns = "a" with pytest.raises(ValueError): x.columns_check(X=df)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_columns_list_element_error(self):\n\n with pytest.raises(ValueError):\n\n BaseTransformer(columns=[[], \"a\"])", "def test_columns_empty_list_error(self):\n\n with pytest.raises(ValueError):\n\n BaseTransformer(columns=[])", "def test_columns_non_string_error(self):...
[ "0.83196247", "0.82287097", "0.7512098", "0.746281", "0.7460938", "0.73339975", "0.7321564", "0.7280484", "0.70769197", "0.70759016", "0.6924045", "0.68770516", "0.6860594", "0.68426466", "0.6831576", "0.6829065", "0.6819163", "0.68188894", "0.67959845", "0.6785656", "0.67617...
0.7082189
8
Test an error is raised if self.columns contains a value not in X.
def test_columns_not_in_X_error(self): df = d.create_df_1() x = BaseTransformer(columns=["a", "z"]) with pytest.raises(ValueError): x.columns_check(X=df)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _assert_columns_exist(self, columns):\n if not nonstringiter(columns):\n columns = (columns,)\n self_cols = self.columns()\n is_missing = lambda col: col not in self_cols\n missing = [c for c in columns if is_missing(c)]\n if missing:\n missing = ', '.jo...
[ "0.717338", "0.70530134", "0.7029187", "0.6885001", "0.6803026", "0.6796677", "0.67781824", "0.6774601", "0.67094284", "0.658058", "0.6502208", "0.641126", "0.64081997", "0.63857627", "0.6382778", "0.6372558", "0.63564575", "0.63529414", "0.63426137", "0.62612873", "0.6252284...
0.7339379
0
Test an error is raised if X is not passed as a pd.DataFrame.
def test_non_pd_df_error(self): x = BaseTransformer(columns="a") with pytest.raises(ValueError): x.columns_set_or_check(X=[1, 2, 3, 4, 5, 6])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _validate_X(X):\n if not isinstance(X, pd.DataFrame):\n raise ValueError(\"X should be a dataframe.\")", "def test_X_non_df_error(self):\n\n x = BaseTransformer(columns=\"a\")\n\n with pytest.raises(ValueError):\n\n x.fit(\"a\")", "def test_non_pd_type_error(self)...
[ "0.8289324", "0.75545466", "0.7541683", "0.74813676", "0.7424849", "0.7422742", "0.73366344", "0.7256355", "0.7100495", "0.70355904", "0.6991032", "0.6904181", "0.67178214", "0.66413856", "0.6636349", "0.65999204", "0.65988266", "0.6555072", "0.65341145", "0.6446536", "0.6386...
0.7507772
3
Sample n points from a Gaussian variable with center mu, and std deviation sigma
def rand_gauss(n=100, mu=[1, 1], sigma=[0.1, 0.1]): d = len(mu) res = np.random.randn(n, d) return np.array(res * sigma + mu)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def Gaussian_sampling(mu=1,beta=1,size=None,rng=np.random.RandomState(100)):\n \n if (not np.isscalar(mu)):\n size=mu.shape\n if np.isscalar(beta):\n beta=np.repeat(beta,size[0])\n beta.shape=(beta.size,1)\n X=np.copy(mu)\n #for i in range(size[0]):\n ...
[ "0.7175265", "0.71363556", "0.7098612", "0.7083932", "0.7032941", "0.7032074", "0.6955845", "0.69185084", "0.6917078", "0.69093275", "0.68950367", "0.68677926", "0.6824212", "0.67824763", "0.6751002", "0.6698606", "0.6689097", "0.6678778", "0.6655264", "0.6647133", "0.6636914...
0.72295773
0
Sample n1, n2 and n3 points from three Gaussian variables centered in mu1, mu2 and mu3 with std deviation sigma1, sigma2 and sigma3
def rand_tri_gauss(n1=100, n2=100, n3=100, mu1=[1, 1], mu2=[-1, -1], mu3=[1, -1], sigma1=[0.1, 0.1], sigma2=[0.1, 0.1], sigma3=[0.1, 0.1]): ex1 = rand_gauss(n1, mu1, sigma1) ex2 = rand_gauss(n2, mu2, sigma2) ex3 = rand_gauss(n3, mu3, sigma3) res = np.vstack([np.hsta...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def generate_samples(mu1,cov,number_of_samples):\n samples = np.random.multivariate_normal(mu1, cov,number_of_samples)\n return samples", "def mm_gaussian(nsample, means, covars, weights):\n assert len(means) == len(covars), \"Number of means or covariance matrices inconsistant with the number of gaussi...
[ "0.6771052", "0.67657", "0.6745676", "0.67249763", "0.6651304", "0.65470463", "0.6527272", "0.6468585", "0.6445764", "0.6428343", "0.63720614", "0.63534003", "0.62964356", "0.6252449", "0.622488", "0.6213996", "0.61854094", "0.6176769", "0.61480904", "0.6140989", "0.6138093",...
0.6136998
21
w0 is the nondimensional frequency constant. If this is
def __init__(self, w0=6): self.w0 = w0 if w0 == 6: # value of C_d from TC98 self.C_d = 0.776
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def w0(x):\n\treturn np.real(0.5 * np.exp(-x**2) * np.sqrt(np.pi) * s.erf(x*1j) / 1j)", "def w0_var(self) -> Optional[float]:\n\n def _retrieve(fm: VariationalFM) -> float:\n return fm.w0_var\n\n return runtime_error_to_optional(self, _retrieve)", "def frequency(self, w, s=1.0):\n ...
[ "0.68186015", "0.6711548", "0.65217227", "0.6418228", "0.64176005", "0.63501394", "0.6174241", "0.609718", "0.6085051", "0.6079254", "0.6045929", "0.60145223", "0.5928865", "0.59222174", "0.5916749", "0.5899092", "0.58603203", "0.5852197", "0.58222145", "0.577591", "0.5762591...
0.6472575
3
Format timestamp to date string.
def _date_from_timestamp(timestamp, fmt='%Y-%m-%d'): return datetime.fromtimestamp(timestamp).strftime(fmt)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def format_timestamp(timestamp):\n try:\n date = datetime.strptime(timestamp, '%Y-%m-%d %H:%M:%S+00:00')\n return datetime.strftime(date, '%m-%d-%Y')\n except ValueError:\n return ''", "def dateformat(timestamp):\n date = datetime.datetime.fromtimestamp(int(timestamp))\n return d...
[ "0.78648734", "0.78067994", "0.7518684", "0.7483332", "0.7465358", "0.73751014", "0.7185838", "0.7169783", "0.71203476", "0.7074126", "0.70648783", "0.70062184", "0.698485", "0.6960382", "0.6915798", "0.6915798", "0.6915798", "0.6913045", "0.6913045", "0.68508023", "0.6829567...
0.7890127
0
Show user object info.
def __repr__(self): return '<User: {}>'.format(self.id)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show_user_info(self):\n name = self.get_user_name()\n print(f'Name: {name.title()}')\n print(f'Age: {self.age}')\n print(f'Gender: {self.gender.title()}')\n print(f'Mobile: {self.m_number}')", "def display_profile(self):\n print(f\"Id: {self._id}\")\n print(f\...
[ "0.8195525", "0.74962044", "0.7388112", "0.7367509", "0.7340221", "0.73385876", "0.73385876", "0.7335833", "0.7332867", "0.73319536", "0.72977453", "0.7253832", "0.7236687", "0.72015756", "0.72015756", "0.7192925", "0.71864074", "0.7170651", "0.71269816", "0.6977749", "0.6937...
0.0
-1
Redirects the user to the partition magic view
def __call__(self, action, uids): url = "{}/partition_magic?uids={}".format(self.back_url, ",".join(uids)) return self.redirect(redirect_url=url)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def homepage_redirect():\n return redirect('/upload_file')", "def post(self) :\n self.redirect('/admin')", "def get(self):\n self.redirect('/admin')", "def get(self):\n self.redirect('/admin')", "def idx(_request):\n return HttpResponseRedirect('/home')", "def entry_page():\n ...
[ "0.6327008", "0.6295634", "0.6132238", "0.6132238", "0.5983801", "0.59504086", "0.5932687", "0.58651185", "0.58464235", "0.5762288", "0.57429105", "0.5722358", "0.5701992", "0.5701992", "0.5701992", "0.5670832", "0.5642794", "0.5555044", "0.5542834", "0.5542834", "0.5542834",...
0.6723248
0
Do basic configuration for the logging system. Similar to logging.basicConfig but the logger ``name`` is configurable and both a file output and a stream output can be created. Returns a logger object. The default behaviour is to create a logger called ``name`` with a null
def create_logger(name, format='%(levelname)s: %(message)s', datefmt=None, stream=None, level=logging.INFO, filename=None, filemode='w', filelevel=None, propagate=True): # Get a logger for the specified name logger = logging.getLogger(name) logger.setLevel(level) fmt...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def logger_setup(self, logger_name):\n logger = logging.getLogger(logger_name)\n logger_path = \"/tmp/\" + logger.name\n logger_format = '%(asctime)s %(name)s %(levelname)s %(lineno)d %(message)s'\n\n # set up logging to file\n logging.basicConfig(\n level=logging.INFO...
[ "0.71930736", "0.71625483", "0.70849836", "0.7022852", "0.69964486", "0.6985189", "0.6949536", "0.69432163", "0.6937133", "0.68996435", "0.68958616", "0.68635035", "0.68510187", "0.67894506", "0.6788829", "0.67754775", "0.6751777", "0.6749665", "0.6741639", "0.6739103", "0.67...
0.0
-1
Return normalized camera coordinates from pixel coordinates using internal calibration matrix Inputs
def to_camera_coords(K, px_pts): if len(px_pts.shape) == 1: px_pts = np.expand_dims(px_pts, axis=0) num_pts = len(px_pts) px_pts = np.concatenate([ px_pts, np.ones((num_pts, 1)) ], axis=-1) norm_pts = np.matmul(np.linalg.inv(K), px_pts.T)[:-1,:] return norm_pts.T
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def pixel2cam(self, depth, intrinsics_inv):\n b, _, h, w = depth.size()\n i_range = torch.arange(0, h).view(1, h, 1).expand(1,h,w).type_as(depth) # [1, H, W]\n j_range = torch.arange(0, w).view(1, 1, w).expand(1,h,w).type_as(depth) # [1, H, W]\n ones = torch.ones(1,h,w).type_as(depth)...
[ "0.67197996", "0.63409334", "0.6130328", "0.6102263", "0.6061136", "0.5991314", "0.5973927", "0.5956373", "0.59512", "0.59002227", "0.5873838", "0.58594143", "0.58532274", "0.58344996", "0.5823147", "0.58003896", "0.5791827", "0.57809454", "0.57807755", "0.5780084", "0.577005...
0.6325485
2
Test collection_get endpoint with special filters.
def test_collection_get_with_filters(self, app, filter_payload, total): base_path = self.get_base_path_with_query_str(filter_payload) request = app.get(base_path, headers=self.headers, status=200) result = request.json assert 'data' in result assert 'total' in result asse...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_get_collection(self):\n pass", "def test_sqlquery_resource_collection_get(self, login, web_request, context):\n service = SQLQueryService(context, web_request)\n response = service.collection_get()\n assert 'data' in response\n assert 'pagination' in response", "def ...
[ "0.7629295", "0.73878765", "0.72906744", "0.7139359", "0.6986538", "0.6964564", "0.6829079", "0.6558563", "0.65544826", "0.65343225", "0.6530396", "0.6433697", "0.64131606", "0.64111525", "0.6405675", "0.6342218", "0.63361084", "0.6321738", "0.6315424", "0.6286857", "0.627699...
0.76929265
0
Test the email for a new user is normalized
def test_new_user_email_normalized(self): email = 'test@LONDONAPPDEV.com' user = get_user_model().objects.create_user(email, 'test123') self.assertEqual(user.email, email.lower())
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_new_user_email_normalized(self):\n email = 'test@GOOGLE.COM'\n user = get_user_model().objects.create_user(email, '212ds')\n\n self.assertEqual(user.email, email.lower())", "def test_new_email_normalised(self):\n\n email = \"test@RANDOMEMAIL.org\"\n user = get_user_mod...
[ "0.79984254", "0.7997281", "0.79201037", "0.78920823", "0.78920823", "0.78920823", "0.78619236", "0.785927", "0.7858499", "0.7853585", "0.7844939", "0.7773778", "0.7771046", "0.7745209", "0.7744957", "0.7702127", "0.75698525", "0.75344014", "0.74174696", "0.7257744", "0.71476...
0.7871696
6
Test creating user with no email raises error
def test_new_user_invalid_email(self): with self.assertRaises(ValueError): get_user_model().objects.create_user(None, 'test123')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_private_create_user_without_email(self):\n with pytest.raises(ValueError) as exinfo:\n EmailUser.objects._create_user(None, None, False, False)\n self.assertIn('email must be set', str(exinfo.value))", "def test_creating_a_new_user_without_email(self):\n\n with self.asser...
[ "0.90313256", "0.8963383", "0.8736711", "0.8736247", "0.87256855", "0.8717645", "0.87146974", "0.87146974", "0.87146974", "0.87146974", "0.87146974", "0.87053293", "0.87032956", "0.869592", "0.86902976", "0.8681168", "0.86709315", "0.8597593", "0.85930586", "0.85868686", "0.8...
0.8700956
13
Test the tag string representation
def test_tag_str(self): tag = models.Tag.objects.create( user=sample_user(), name='Vegan' ) self.assertEqual(str(tag), tag.name)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_tag_str(self):\n tag = models.Tag.objects.create(\n user=sample_user(),\n name='Internal'\n )\n\n self.assertEqual(str(tag), tag.name)", "def test_tag_str(self):\n tag = models.Tag.objects.create(\n user=sample_user(),\n name='Docke...
[ "0.7170174", "0.70703965", "0.6922232", "0.69209194", "0.6899433", "0.6885665", "0.6861665", "0.66865885", "0.64923304", "0.637821", "0.6311385", "0.63077676", "0.62146807", "0.616337", "0.61539763", "0.60839355", "0.60640544", "0.6059385", "0.5983592", "0.5948616", "0.593113...
0.6938718
2
Declare fundamental placeholder and weights to use for model
def load_inputs(self): self.inputs = tf.placeholder(tf.int32, shape=(None,self.n_input), name='inputs') self.inputs_mask = tf.placeholder(tf.float32, shape=(None, self.n_input), name='inputs_mask') self.targets = tf.placeholder(tf.int32, shape=(None,1), name='targets') self.keep...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def init_weights(model):\n ...", "def __init__(self):\r\n # A dummy layer does nothing\r\n self.weights = np.zeros(shape=(input.shape[1], 10))\r\n bias = np.zeros(shape=(10,))\r\n pass", "def init_parameters(self):\n stdv = 1. / math.sqrt(self.weight.data.size(1))\n ...
[ "0.7024538", "0.69254273", "0.68742996", "0.6802202", "0.6800633", "0.6720314", "0.6604166", "0.6578121", "0.65034044", "0.6493433", "0.64921904", "0.64846224", "0.64784837", "0.64756346", "0.64756346", "0.6473903", "0.6453669", "0.6439322", "0.64382863", "0.6434794", "0.6427...
0.0
-1
Test updating an answer with invalid question ID
def test_update_answer_invalid_question_id(self): user_token, _, _, answer_id = self.add_answer() headers = self.get_request_header(user_token) data = json.dumps(self.update_answer) url = f'/questions/0/answers/{answer_id}' response = self.test_client.put(url, headers=headers, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_update_answer_invalid_answser_id(self):\n user_token, _, question_id, _ = self.add_answer()\n\n headers = self.get_request_header(user_token)\n data = json.dumps(self.update_answer)\n url = f'/questions/{question_id}/answers/0'\n\n response = self.test_client.put(url, he...
[ "0.86568266", "0.77314496", "0.7685586", "0.7682554", "0.76374495", "0.7561294", "0.7485326", "0.7427325", "0.7001053", "0.6993362", "0.6923982", "0.6761166", "0.6736765", "0.66610986", "0.65850025", "0.6577252", "0.6556002", "0.6538008", "0.6529008", "0.65256476", "0.6472911...
0.86525553
1
Test updating an answer with invalid ID
def test_update_answer_invalid_answser_id(self): user_token, _, question_id, _ = self.add_answer() headers = self.get_request_header(user_token) data = json.dumps(self.update_answer) url = f'/questions/{question_id}/answers/0' response = self.test_client.put(url, headers=header...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_update_answer_invalid_question_id(self):\n user_token, _, _, answer_id = self.add_answer()\n\n headers = self.get_request_header(user_token)\n data = json.dumps(self.update_answer)\n url = f'/questions/0/answers/{answer_id}'\n\n response = self.test_client.put(url, heade...
[ "0.82013464", "0.74816704", "0.7416522", "0.7385306", "0.7325633", "0.7319966", "0.7107313", "0.70965993", "0.6971257", "0.6861833", "0.68584454", "0.67681086", "0.6758235", "0.6746474", "0.6678024", "0.6661626", "0.657626", "0.654642", "0.6486383", "0.64677465", "0.64620167"...
0.8403493
0
Test updating an answer with invalid body
def test_update_answer_invalid_body(self): user_token, _, question_id, answer_id = self.add_answer() headers = self.get_request_header(user_token) data = json.dumps(self.invalid_answer) url = f'/questions/{question_id}/answers/{answer_id}' response = self.test_client.put(url, h...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_update_answer(self):\n self.app.post(\"/api/v2/answers/1/answer\", headers=self.headers,\n data=json.dumps(self.answer)) \n response = self.app.patch(\n \"/api/v2/answers/1/answer\", headers=self.headers, data=json.dumps(self.answer))\n result = ...
[ "0.7896492", "0.7594162", "0.7444", "0.7285697", "0.71153295", "0.7081756", "0.6878236", "0.6867768", "0.68575037", "0.6718783", "0.66260225", "0.6562646", "0.6547903", "0.65115666", "0.6465372", "0.641119", "0.6409093", "0.6407118", "0.63917327", "0.63812333", "0.63481766", ...
0.8033525
0
Yield successive nsized chunks from l.
def chunks(l, n): for i in range(0, len(l), n): yield l[i:i + n]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _chunk(self, l, n):\n for i in range(0, len(l) + 1, n):\n yield l[i:i + n]", "def chunks(self, l, n):\n for i in range(0, len(l), n):\n yield l[i:i + n]", "def __chunks(l, n):\n for i in range(0, len(l), n):\n yield l[i:i + n]", "def get_chunks(self, ...
[ "0.8038813", "0.79248375", "0.7923423", "0.7885103", "0.78773195", "0.7815877", "0.77655786", "0.77556044", "0.77441615", "0.7731815", "0.77288336", "0.772473", "0.77028215", "0.76889825", "0.76889825", "0.7664208", "0.76570904", "0.7655856", "0.7655856", "0.76458347", "0.764...
0.7448925
54
Returns the name of the group this algorithm belongs to. This string should be localised.
def group(self): return self.tr(self.groupId())
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def group_name(self) -> str:\n return pulumi.get(self, \"group_name\")", "def group_name(self):\n\n return self._group_name", "def get_group_name(self):\n return self.groupname", "def group_name(self) -> pulumi.Output[Optional[str]]:\n return pulumi.get(self, \"group_name\")", "...
[ "0.854521", "0.83218503", "0.8284557", "0.816647", "0.8104803", "0.7954662", "0.78782564", "0.78782564", "0.78490025", "0.78227955", "0.77971244", "0.7710525", "0.76375073", "0.76375073", "0.7612834", "0.7541541", "0.7541541", "0.7402706", "0.73956424", "0.73863745", "0.73640...
0.7747362
12
Returns the unique ID of the group this algorithm belongs to. This string should be fixed for the algorithm, and must not be localised. The group id should be unique within each provider. Group id should contain lowercase alphanumeric characters only and no spaces or other formatting characters.
def groupId(self): return 'D Dinámicas socio-espaciales'
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def group_id(self) -> str:\n return pulumi.get(self, \"group_id\")", "def group_id(self) -> str:\n return pulumi.get(self, \"group_id\")", "def group_id(self):\n # type: () -> string_types\n return self._group_id", "def group_id(self) -> pulumi.Output[Optional[str]]:\n retu...
[ "0.82728684", "0.82728684", "0.818226", "0.7859453", "0.7763491", "0.7699571", "0.7699571", "0.7699571", "0.7637658", "0.7609123", "0.7609123", "0.7609123", "0.7524472", "0.7391561", "0.72264403", "0.7168432", "0.71298355", "0.71218336", "0.7099653", "0.7099653", "0.7099653",...
0.0
-1
Given a version range, check if a valid version is defined in the range.
def _find_a_ranged_version(instance_name, minv, maxv): all_instance_releases = ReleaseInfo.all_instance_releases() versions = all_instance_releases.get(instance_name, dict()) found = False for v, release_info in versions.items(): found = FlexVersion.in_range(v, minv, maxv) if found: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __version_in_range(self, attr_version_range):\n return VersionUtils.isVersionInRange(self._wls_version, attr_version_range)", "def supported_version(version, minimum, maximum):\n if minimum and StrictVersion(version) < StrictVersion(minimum):\n return False\n\n if maximum and StrictVersio...
[ "0.75832665", "0.6975919", "0.680275", "0.66916645", "0.66852236", "0.6587366", "0.6551071", "0.64872235", "0.6474865", "0.6441488", "0.64201796", "0.63864374", "0.6356206", "0.6296781", "0.6266366", "0.62057114", "0.6195648", "0.6123101", "0.60810274", "0.6041724", "0.603467...
0.7299968
1
set value of widget
def set_value(self, val): try: return self._setter(self._widget, val) except (TypeError, ValueError) as e: logger.error("Error %s setting value %s to %s", e, val, self.name)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_value(self, value):\n if self.notebook:\n self.widget.value = value\n else:\n if hasattr(self.widget, \"setValue\"):\n self.widget.setValue(value)\n elif hasattr(self.widget, \"setCurrentText\"):\n self.widget.setCurrentText(value...
[ "0.7960504", "0.7917525", "0.7749192", "0.7591632", "0.7456478", "0.7415201", "0.7392266", "0.7215549", "0.71523696", "0.71481985", "0.7134828", "0.7117181", "0.70391774", "0.701875", "0.7018546", "0.7012813", "0.69975805", "0.6965857", "0.6950253", "0.6950253", "0.6950253", ...
0.662014
34
This is the constructor of the dataset
def __init__(self, data_dir, mode): data = pd.read_csv(path.join(data_dir, mode+"_data.txt"), delimiter='|') word2idx = np.load(path.join(data_dir, "word2idx.dict")) sentences = [sentence.split(' ') for sentence in data['sentence']] self.data_len = data['sequence_length'].values ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, dataset: Dataset):\n self.dataset = dataset", "def __init__(self, dataset):\n self._dataset = dataset", "def __init__(self):\n self.__dataset = None", "def __init__(self, dat):\n self.data = dat", "def __init__(self,dataset=scripts,group=\"\"):\n self.d...
[ "0.859829", "0.8416393", "0.78770477", "0.73125446", "0.7303675", "0.72204316", "0.7166627", "0.7146136", "0.713331", "0.7125591", "0.7122339", "0.7085938", "0.7083045", "0.70688", "0.7065411", "0.70418733", "0.6966917", "0.6905524", "0.69020224", "0.68926454", "0.68926156", ...
0.0
-1
Compute density using the arithmetic average mass
def compute_density_ari(cur, N): ## arithmetic average cardinality avg_card = 0 for n in range(N): card = get_parameter(cur, par=("card_B%d" % n)) avg_card += card / float(N) ## average mass if avg_card == 0: return (-1, 0) else: return (get_parameter(cur, par="B...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _density(self):\n fraction = np.array([0.]+[m.value for m in self.fraction])\n # TODO: handle invalid fractions using penalty functions\n # S = sum(fraction)\n # scale = S/100 if S > 100 else 1\n # fraction[0] = 100 - S/scale\n # penalty = scale - 1\n fraction[0...
[ "0.7179829", "0.7027996", "0.69404113", "0.6903715", "0.6801848", "0.6653928", "0.66464937", "0.66256225", "0.6586033", "0.64830875", "0.64773476", "0.63432264", "0.63407904", "0.6335357", "0.6328277", "0.6325319", "0.6294417", "0.62802184", "0.6247538", "0.62336814", "0.6232...
0.68349314
4
Compute density using the geometric average mass
def compute_density_geo(cur, N): ## geometric average cardinality avg_card = 1 for n in range(N): card = get_parameter(cur, par=("card_B%d" % n)) avg_card *= card avg_card = math.pow(avg_card, 1.0/N) ## average mass if avg_card == 0: return (-1, 0) else: ret...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _density(self):\n fraction = np.array([0.]+[m.value for m in self.fraction])\n # TODO: handle invalid fractions using penalty functions\n # S = sum(fraction)\n # scale = S/100 if S > 100 else 1\n # fraction[0] = 100 - S/scale\n # penalty = scale - 1\n fraction[0...
[ "0.69823223", "0.69802976", "0.6701687", "0.65660995", "0.65244234", "0.6516973", "0.65093654", "0.65007335", "0.6460094", "0.64228183", "0.63692915", "0.6302297", "0.62918633", "0.6290301", "0.62900615", "0.62781", "0.6268613", "0.6266383", "0.6240621", "0.62323266", "0.6231...
0.6979815
2
Select the next dimension to remove with the largest cardinality.
def select_dim_by_card(cur, N): max_dim, max_card = -1, -1 for n in range(N): ## cardinality of B_n card = get_parameter(cur, par=("card_B%d" % n)) if card > max_card: max_dim, max_card = n, card return max_dim
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delete_max(self):\n retval = self.heap_list[1]\n self.heap_list[1] = self.heap_list[self.size]\n self.size = self.size - 1\n pop_val = self.heap_list.pop()\n self.percolate_down(1)\n return retval", "def take_max(self):\n return self.delete_first()", "def de...
[ "0.6075359", "0.5932192", "0.58758676", "0.5821059", "0.5613806", "0.56024194", "0.5579504", "0.5573026", "0.5544781", "0.5532615", "0.5391342", "0.5375201", "0.5349913", "0.5314387", "0.52850425", "0.524592", "0.5229705", "0.5229013", "0.52027106", "0.51974934", "0.5169075",...
0.6064797
1