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
Get bounding box coordinates mapped to target/mask coordinates.
def _get_mask_coords(self, obj, shrink_factor): # split bounding box into x,y coordinates xmin, ymin, xmax, ymax = np.split(obj.bounding_box, len(obj.bounding_box)) # compute bounding box center coordinate bbox_center = np.array([xmin + (xmax - xmin) / 2, ymin + (ymax - y...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def bounding_box(self):\n latlon00 = self.ij_to_latlon(-1,-1)\n latlon01 = self.ij_to_latlon(-1,self.domain_size[1]+1)\n latlon11 = self.ij_to_latlon(self.domain_size[0]+1,self.domain_size[1]+1)\n latlon10 = self.ij_to_latlon(self.domain_size[0]+1,-1)\n return (latlon00,latlon01,...
[ "0.72255194", "0.7148642", "0.7067591", "0.6957974", "0.68591", "0.68346167", "0.6829538", "0.6804426", "0.6800595", "0.67711234", "0.6754198", "0.6741878", "0.6736427", "0.67342806", "0.67342806", "0.6726432", "0.67016345", "0.6692683", "0.6662506", "0.65757245", "0.6558426"...
0.7551965
0
Returns true if both objects are equal
def __eq__(self, other): if not isinstance(other, SmartDocumentRecognizerKvResult): return False return self.__dict__ == other.__dict__
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __eq__(self, other):\n return are_equal(self, other)", "def __eq__(self, other):\n return are_equal(self, other)", "def __eq__(self,other):\n try: return self.object==other.object and isinstance(self,type(other))\n except: return False", "def __eq__(self, other):\n if i...
[ "0.8088132", "0.8088132", "0.8054589", "0.7982687", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", ...
0.0
-1
Returns true if both objects are not equal
def __ne__(self, other): return not self == other
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __ne__(self, other: object) -> bool:\n if self.__eq__(other):\n return False\n return True", "def __ne__(self, other: object) -> bool:\n return not self.__eq__(other)", "def __ne__(self, other) -> bool:\n return not self.__eq__(other)", "def __eq__(self, other):\n ...
[ "0.845611", "0.8391477", "0.8144138", "0.81410587", "0.8132492", "0.8093973", "0.80920255", "0.80920255", "0.80920255", "0.8085325", "0.8085325", "0.8076365", "0.8076365", "0.8065748" ]
0.0
-1
Generator that iterates over an iterable in size chunks >>> list(chunks('ABCDEFG', size=3)) [('A', 'B', 'C'), ('D', 'E', 'F'), ('G',)] >>> list(chunks([1, 2, 3, 4, 5, 6], size=2)) [(1, 2), (3, 4), (5, 6)]
def chunks(iterable, size=20): stop = object() for chunk in recipes.grouper(size, iterable, fillvalue=stop): if chunk[-1] is stop: is_not_stop = functools.partial(operator.is_not, stop) yield tuple(itertools.takewhile(is_not_stop, chunk)) break yield chunk
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def chunks(iterator, size):\n for index in range(0, len(iterator), size):\n yield iterator[index:index + size]", "def iter_chunks(iterable, size):\n it = iter(iterable)\n while True:\n chunk = tuple(itertools.islice(it, size))\n if len(chunk) == 0:\n break\n yield ...
[ "0.84125316", "0.8280994", "0.8176167", "0.7985401", "0.7982482", "0.7932622", "0.78810847", "0.78195244", "0.78195244", "0.78195244", "0.7808499", "0.7795705", "0.77784157", "0.7770861", "0.7755475", "0.77362293", "0.7682972", "0.7598768", "0.7581873", "0.7565406", "0.755539...
0.0
-1
Initialize a MusicCD item.
def __init__(self, name, isbn, artist, num_discs, tags=None): super().__init__(name, isbn, tags) self.artist = artist self.num_discs = num_discs self.resource_type = "Music CD"
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, **kwargs):\n self.item = Item(**kwargs)\n self._working_dir = None", "def __init__(self):\n # Item Dictionary (key: call number, value: Item object)\n self.item_list = {}\n\n # Add some items manually for testing purposes.\n book1 = Book(\"In praise of...
[ "0.6313415", "0.62220263", "0.5928097", "0.58955693", "0.5831417", "0.5831417", "0.5783373", "0.5757864", "0.5751746", "0.5706846", "0.5677021", "0.5675513", "0.56697357", "0.56654", "0.5658594", "0.56570214", "0.56510967", "0.5628711", "0.5588841", "0.55882436", "0.55713534"...
0.6329616
0
Get Config setting from predefined variables or environment parameters.
def init_config_values(): global HEADER, PROCESS_PROGRAM_NAME, METADATA_HANDLE_EVENT_NAME global APPINSIGHTS_INSTRUMENTATIONKEY global DATABRICKS_OUTPUT_STORAGE_ACCOUNT_URL, DATABRICKS_OUTPUT_STORAGE_SAS_TOKEN global ADX_INGEST_QUEUE_URL_LIST, ADX_INGEST_QUEUE_SAS_TOKEN global CONCURRENT_ENQUEUE_TAS...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_config(setting, config=CONFIG):\n try:\n return config[setting]\n except KeyError:\n raise ImproperlyConfigured(\"Set the {} setting\".format(setting))", "def get_config(config):\n global _config\n return _config", "def get_config():\n return CONFIG", "def get_config_var(...
[ "0.7611529", "0.7403772", "0.73666954", "0.73517406", "0.7271565", "0.7270964", "0.724717", "0.71440154", "0.71114945", "0.7067627", "0.70576876", "0.70354825", "0.70275337", "0.6970136", "0.69563943", "0.6925892", "0.6882713", "0.6837568", "0.68029976", "0.6720337", "0.67193...
0.0
-1
Initialize first name, last name, age, and gender attributes.
def __init__(self, first_name, last_name, age, gender): self.first_name = first_name self.last_name = last_name self.age = age self.gender = gender
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, f_name, l_name, age, gender, m_number):\n self.f_name = f_name\n self.l_name = l_name\n self.age = age\n self.gender = gender\n self.m_number = m_number", "def __init__(self, first_name, last_name, age):\n\n self.first_name = first_name\n self.l...
[ "0.7688818", "0.75608855", "0.7557712", "0.7557712", "0.7557712", "0.7557712", "0.7557712", "0.7557712", "0.7557712", "0.7557712", "0.72796017", "0.71924347", "0.6994145", "0.6983084", "0.69552344", "0.6938817", "0.6919511", "0.6853096", "0.684336", "0.6801357", "0.67757064",...
0.8197995
0
Returns the name of this object.
def getName(self): return self._name
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_name(self):\n\n\t\treturn self.__name", "def get_object_name(self):\n return self.obj_name", "def get_name(self):\n return self.__name", "def get_name(self):\n return self.__name", "def get_name(self):\n return self.__name", "def get_name(self):\n\t\treturn self.__name...
[ "0.89701015", "0.895701", "0.89562804", "0.89562804", "0.89562804", "0.89102674", "0.8910035", "0.8910035", "0.8910035", "0.8910035", "0.8873486", "0.8873486", "0.8873486", "0.8873486", "0.8873486", "0.8873486", "0.8873486", "0.8873486", "0.8873486", "0.8873486", "0.886717", ...
0.0
-1
Returns the initial location of this object.
def getInitialLocation(self): return self._location
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_default_alt_loc(self):\n return self.default_alt_loc", "def get_initial_point(self):\r\n return self._studio.get_initial_point()", "def get_origin(self):\n return self.zero", "def start_loc(self) -> str:\n return self._start_loc", "def get_origin(self):\n return s...
[ "0.7558399", "0.73375237", "0.73054683", "0.7235104", "0.71608335", "0.7137725", "0.7113328", "0.7026934", "0.6992983", "0.6913296", "0.68974197", "0.6893482", "0.6890375", "0.6888621", "0.68663657", "0.68411374", "0.68411374", "0.68146896", "0.6788716", "0.6781255", "0.67809...
0.8698698
0
Returns the DBus signature type for the argument. If the argument is an instance of one of the type wrapper classes, the exact type signature corresponding to the wrapper class will be used. If the object has a variable named 'dbusSignature', the value of that variable will be used. Otherwise, a generic type will be us...
def sigFromPy(pobj): sig = getattr(pobj, 'dbusSignature', None) if sig is not None: return sig elif isinstance(pobj, bool): return 'b' elif isinstance(pobj, int): return 'i' elif isinstance(pobj, int): return 'x' elif isinstance(pobj, float): return 'd' ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_type ( self, object ):\n return self.type", "def get_type ( self, object ):\n return self.type", "def type_signature(self) -> computation_types.Type:\n raise NotImplementedError", "def serialize_to_signature(value):\n serialization_cls = _get_serializer_for_value(value, serializin...
[ "0.5474694", "0.5474694", "0.5409444", "0.5328905", "0.52887535", "0.521691", "0.51724213", "0.5155565", "0.51536465", "0.51384646", "0.50888366", "0.50765437", "0.5045696", "0.49954993", "0.49776474", "0.49498105", "0.49469578", "0.49323153", "0.49192646", "0.4914251", "0.49...
0.629868
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 get_chunks(self, l, n):\r\n for i in range(0, len(l), n):\r\n yield l[i:i+n]", "def chunks(...
[ "0.80379355", "0.79237956", "0.78840584", "0.7876208", "0.78144675", "0.77643776", "0.77544284", "0.7743112", "0.7730491", "0.772761", "0.7723601", "0.7701434", "0.768797", "0.768797", "0.7662925", "0.765581", "0.765473", "0.765473", "0.76447", "0.76447", "0.76447", "0.7635...
0.7922027
2
Add headers to both force latest IE rendering engine or Chrome Frame, and also to cache the rendered page for 10 minutes.
def add_header(r): r.headers["Cache-Control"] = "no-cache, no-store, must-revalidate" r.headers["Pragma"] = "no-cache" r.headers["Expires"] = "0" r.headers['Cache-Control'] = 'public, max-age=0' return r
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_header(response):\n response.headers['X-UA-Compatible'] = 'IE=Edge,chrome=1'\n response.headers['Cache-Control'] = 'public, max-age=60'\n return response", "def add_header(response):\n response.headers['X-UA-Compatible'] = 'IE=Edge,chrome=1'\n response.headers['Cache-Control'] = 'public, m...
[ "0.8221727", "0.8220911", "0.8220911", "0.8220911", "0.8220911", "0.81940746", "0.8161616", "0.8161616", "0.8161616", "0.8161616", "0.8161616", "0.8161616", "0.8161616", "0.8161616", "0.8161616", "0.8161616", "0.8161616", "0.8161616", "0.8161616", "0.8161616", "0.8161616", ...
0.7126684
66
Returns the input stream object for the currently active input stream.
def getSelected(self): return self._streams[self._selectedStream]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_stream(self):\n self.lock.acquire()\n stream=self.stream\n self.lock.release()\n return stream", "def set_input(self, in_stream):\n self._in = self._wrap_stream(in_stream, 'in')\n return self._in", "def stream(self) -> interface.Stream:\n return cast(int...
[ "0.6819047", "0.67934316", "0.6680337", "0.6518098", "0.6492424", "0.6492424", "0.6459986", "0.64151335", "0.63618785", "0.6321766", "0.6298022", "0.62467617", "0.60943204", "0.60503983", "0.6026703", "0.5984099", "0.59127194", "0.5908785", "0.5908785", "0.5908785", "0.590878...
0.5414463
50
Calculate the great circle distance between two points on the earth (specified in decimal degrees)
def haversine(lat1, lon1, lat2, lon2): # convert decimal degrees to radians lon1, lat1, lon2, lat2 = map(radians, [lon1, lat1, lon2, lat2]) # haversine formula dlon = lon2 - lon1 dlat = lat2 - lat1 a = sin(dlat/2)**2 + cos(lat1) * cos(lat2) * sin(dlon/2)**2 c = 2 * asin(sqrt(a)) r ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def great_circle(lat_1, long_1, lat_2, long_2):\n long_1 = m.radians(long_1)\n lat_1 = m.radians(lat_1)\n long_2 = m.radians(long_2)\n lat_2 = m.radians(lat_2)\n\n d = 2 * 6367.45 * m.asin(\n m.sqrt(haversine(lat_2 - lat_1)\n + m.cos(lat_1)*m.cos(lat_2) *\n haversine(long...
[ "0.8146062", "0.78638023", "0.7632202", "0.7604661", "0.7595527", "0.75950956", "0.7592873", "0.757031", "0.7564319", "0.75560796", "0.75300086", "0.7516366", "0.7493803", "0.746558", "0.7450864", "0.7432722", "0.7391925", "0.7355981", "0.7347892", "0.7330029", "0.73271745", ...
0.0
-1
initialize a bullet at the ship position
def __init__(self, ai_settings, screen, ship): super().__init__() self.screen = screen # create a bullet and set its position self.rect = pygame.Rect(0, 0, ai_settings.bullet_width, ai_settings.bullet_height) self.rect.centerx = ship.rect.centerx ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, screen, ship):\n\n super().__init__()\n self.__screen = screen\n self.__ship = ship\n\n # bullet settings | may need to add to settings.py if each bullet makes a new bullet object. This will save memory by making less variables.\n self.__speed = 10.0\n s...
[ "0.77932", "0.77842873", "0.7643124", "0.7577425", "0.738928", "0.7282866", "0.7248737", "0.72338456", "0.713622", "0.7041886", "0.70413834", "0.69640034", "0.69577575", "0.6927438", "0.69020337", "0.6869925", "0.6840654", "0.68373877", "0.6827241", "0.67168593", "0.67021334"...
0.7887299
0
Takes in RGB channels in range 0255 and outputs L or AB channels in range 1 to 1
def rgb_to_lab(img, l=False, ab=False): img = img / 255 l_chan = color.rgb2lab(img)[:, :, 0] l_chan = l_chan / 50 - 1 l_chan = l_chan[..., np.newaxis] ab_chan = color.rgb2lab(img)[:, :, 1:] ab_chan = (ab_chan + 128) / 255 * 2 - 1 if l: return l_chan else: return ab_chan
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def lab_to_rgb(img_l, img_ab):\n lab = np.empty([*img_l.shape[0:2], 3])\n lab[:, :, 0] = np.squeeze(((img_l + 1) * 50))\n lab[:, :, 1:] = img_ab * 127\n return color.lab2rgb(lab)", "def convert_rgb_cmyk(rcol, gcol, bcol):\n if (rcol == 0) and (gcol == 0) and (bcol == 0):\n # black\n ...
[ "0.67191994", "0.67153925", "0.66415703", "0.65657836", "0.6533678", "0.6436578", "0.6332531", "0.63095754", "0.6278812", "0.62779766", "0.6174344", "0.6166381", "0.6164907", "0.6087721", "0.6085063", "0.60826355", "0.60440445", "0.6035109", "0.6034019", "0.6017981", "0.59934...
0.716853
0
Takes in LAB channels in range 1 to 1 and out puts RGB chanels in range 0255
def lab_to_rgb(img): new_img = np.zeros((256, 256, 3)) for i in range(len(img)): for j in range(len(img[i])): pix = img[i, j] new_img[i, j] = [(pix[0] + 1) * 50, (pix[1] + 1) / 2 * 255 - 128, (pix[2] + 1) / 2 * 255 - 128] new_img = color.lab2rgb(new_img) * 255 new_img = n...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def reduceColorRGB(channels,levels):\n data = (levels[2]*levels[1]*reduceColor(channels[0],levels[0])+\n levels[2]*reduceColor(channels[1],levels[1])+\n reduceColor(channels[2],levels[2])).astype(numpy.uint8)\n return data", "def rgb_to_lab(img, l=False, ab=False):\n img = img / 255\n l...
[ "0.68408406", "0.67221797", "0.6714735", "0.6651634", "0.6607305", "0.6541594", "0.6485886", "0.64274514", "0.63758796", "0.6362413", "0.6348317", "0.63105035", "0.62985694", "0.6281686", "0.6277677", "0.6239145", "0.6237213", "0.6224802", "0.6211154", "0.62056774", "0.618310...
0.6652208
3
Compute the effective number density of a CatalogSource.
def compute_effective_nbar(cat): # the total weight total_weight = cat['Weight']*cat['FKPWeight'] # effective nbar nbar = (total_weight*cat['NZ']).sum() / total_weight.sum() return cat.compute(nbar)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def density( self ) :\n return self.__density", "def density( self ) :\n return self.__density", "def density( self ) :\n return self.__density", "def density(self):\n return self._density", "def density(self):\n return self.get_density()", "def _density(self):\n ...
[ "0.63332367", "0.63332367", "0.63332367", "0.63028103", "0.6245276", "0.62077314", "0.6154465", "0.6130706", "0.60398775", "0.6037856", "0.6001697", "0.59691787", "0.5904073", "0.59027845", "0.58638614", "0.5822731", "0.5779815", "0.5759084", "0.5722551", "0.5687284", "0.5682...
0.0
-1
Returns the number of open connections that can return to this pool.
def open_connections(self): return len(self._connections_openned)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _created_connections(self):\n return len(self._available_connections) + len(self._in_use_connections)", "def getconnectioncount(self):\n return self.proxy.getconnectioncount()", "def size(self):\r\n return sum(pool.size() for pool in self.host_to_pool.values())", "def pool_size(self)...
[ "0.8044701", "0.7799287", "0.7330027", "0.73162156", "0.719832", "0.71733403", "0.71316063", "0.70556307", "0.70315176", "0.7030046", "0.6980931", "0.6876273", "0.6845227", "0.680742", "0.670429", "0.66962683", "0.66733575", "0.66601783", "0.66520566", "0.66254", "0.6611033",...
0.85150576
0
Generates a list of separated connection settings for each host. Gets a list of connection settings for each host or router found in the given settings.
def _get_connections_settings(settings): pool_settings = settings.copy() routers = pool_settings.get("routers", []) connections_settings = [] if "routers" in pool_settings: pool_settings.pop("routers") if "host" in pool_settings and "port" in pool_settings: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _get_pools(self, settings):\n available_pools = []\n pool_names = []\n connections_settings = self._get_connections_settings(settings)\n\n # Generate the names of the pools this settings can connect to\n for router_name, _ in connections_settings:\n pool_names.appe...
[ "0.6441771", "0.59143704", "0.549022", "0.5409772", "0.5368586", "0.53313816", "0.5314408", "0.5314408", "0.5308428", "0.5303599", "0.52979267", "0.5296564", "0.5277395", "0.5248984", "0.52361083", "0.516034", "0.5144902", "0.512325", "0.50972766", "0.5079645", "0.5056473", ...
0.7740059
0
Returns `True` if the session is open.
def is_open(self): return self._connection.stream.is_open()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_open(self):\n\t\treturn self._session is not None", "def is_open(self):\n return self._session is not None", "def is_open(self) -> bool:\n return self._connection is not None", "def is_open(self):\n return self.connection.isOpen()", "def is_open(self):\n\t\treturn self.conn.open...
[ "0.9024887", "0.8961831", "0.81315815", "0.81257755", "0.80546355", "0.79255587", "0.7924642", "0.7774636", "0.7760799", "0.7753529", "0.77159536", "0.7703194", "0.7651213", "0.76434505", "0.76299965", "0.76201487", "0.75707895", "0.74527735", "0.73980796", "0.7376171", "0.73...
0.8011751
5
Returns the list of schemas in the current session.
def get_schemas(self): result = self.sql("SHOW DATABASES").execute() return [row[0] for row in result.fetch_all()]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def schemas(self):\n return self.get_schemas()", "def schemas(self):\n if not self._schemas:\n self._schemas = get_schema(self.attributes.workspace.namespace, self.attributes.workspace.name)\n return self._schemas", "def schemas(self):\n return model.Schemas(self)", "de...
[ "0.7940168", "0.7674091", "0.76055425", "0.76007926", "0.74846065", "0.7372321", "0.6949388", "0.6884964", "0.68326396", "0.68226933", "0.6800426", "0.6788221", "0.6720207", "0.6689522", "0.6683078", "0.6618202", "0.66057914", "0.65894604", "0.6363446", "0.63566357", "0.62927...
0.76975685
1
Closes the sessions opened by this client.
def close(self): PoolsManager().close_pool(self.settings) for session in self.sessions: session.close_connections()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async def close_session(self):\n await self._client_session.close()", "def close(self):\n\t\tself._client.close_session()", "async def close(self):\n try:\n self.logger.debug(\"Closing session\")\n if self.key in self._ALL_SESSIONS:\n del self._ALL_SESSIONS[se...
[ "0.8111592", "0.8103941", "0.7726971", "0.7700497", "0.7689983", "0.7650477", "0.76026857", "0.76026857", "0.76026857", "0.76026857", "0.76026857", "0.76026857", "0.7557631", "0.7541065", "0.7507988", "0.7507988", "0.7507988", "0.7449348", "0.74443275", "0.74263626", "0.74213...
0.6882067
41
Validates the settings to be passed to a Session object the port values are converted to int if specified or set to 33060 otherwise. The priority values for each router is converted to int if specified.
def _validate_settings(settings): invalid_opts = set(settings.keys()).difference(_SESS_OPTS) if invalid_opts: invalid_opts_list = "', '".join(invalid_opts) raise InterfaceError(f"Invalid option(s): '{invalid_opts_list}'") if "routers" in settings: for router in settings["routers"]: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _validatePortConfig(self):\n if config.BindHTTPPorts:\n if config.HTTPPort == 0:\n raise UsageError(\n \"HTTPPort required if BindHTTPPorts is not empty\"\n )\n elif config.HTTPPort != 0:\n config.BindHTTPPorts = [config.HTTPP...
[ "0.60197586", "0.5657626", "0.5495007", "0.53471047", "0.5289687", "0.5281556", "0.5281556", "0.5234276", "0.52294874", "0.51977766", "0.5155232", "0.5141573", "0.5139727", "0.51385075", "0.50844365", "0.5050152", "0.5013974", "0.50133044", "0.50025", "0.49238983", "0.4921965...
0.5876934
1
Return whether `other` is equal to `self`.
def equals(self, other: Schema) -> bool: if not isinstance(other, Schema): raise TypeError( f"invalid equality comparison between Schema and {type(other)}" ) return self.__cached_equals__(other)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __eq__(self, other):\n return self is other", "def __eq__(self, other):\n return self is other", "def __eq__(self, other):\n if other != None:\n return self == other\n else:\n return False", "def __eq__(self, other):\n if other != None:\n ...
[ "0.86491597", "0.86491597", "0.854738", "0.854738", "0.8474165", "0.84631306", "0.8452681", "0.8449483", "0.84473795", "0.84290755", "0.84290755", "0.84053004", "0.83532363", "0.8346449", "0.83375067", "0.83325887", "0.8330618", "0.8330618", "0.8329669", "0.8322861", "0.83128...
0.0
-1
Return the name of a schema column at position `i`.
def name_at_position(self, i: int) -> str: return self.names[i]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def table_column(self, i):\n return self.__column_list[i]", "def name_at_position(self, i: int) -> str:\n upper = len(self.names) - 1\n if not 0 <= i <= upper:\n raise ValueError(f'Column index must be between 0 and {upper:d}, inclusive')\n return self.names[i]", "def col...
[ "0.7554233", "0.75307804", "0.6253363", "0.6253363", "0.6171738", "0.61690795", "0.60926527", "0.60854715", "0.60502803", "0.5991299", "0.5967933", "0.596589", "0.5952607", "0.59414124", "0.5929768", "0.5908907", "0.58810186", "0.5862473", "0.5850232", "0.5824398", "0.5803906...
0.6199214
4
Get absolute path to resource, works for dev and for PyInstaller
def widget_path(relative_path): real_path = os.path.abspath(os.path.join(os.path.dirname(os.path.abspath(__file__)),"..")) base_path = getattr(sys, '_MEIPASS', real_path) 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.83695436", "0.8280479", "0.82485795", "0.8139178", "0.8114118", "0.80985415", "0.80940944", "0.80797124", "0.80677074", "0.80673695", "0.8062465", "0.8062465", "0.8062465", "0.8062465", "0.8062465", "0.8062465", "0.8062465", "0.80569947", "0.80545217", "0.80448323", "0.804...
0.67379564
92
Does filename have the right extension?
def allowed_file(filename): return '.' in filename and \ filename.rsplit('.', 1)[1] in ALLOWED_EXTENSIONS
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_good_file(filename):\n for e in extensions:\n if filename.endswith(e):\n return True\n return False", "def check_allowed_extension(filename):\n return '.' in filename and filename.rsplit('.', 1)[1] in ALLOWED_EXTENSIONS", "def isExtensionSupported(filename):\n\tr...
[ "0.8175792", "0.8096151", "0.8093916", "0.8046253", "0.8033267", "0.8031603", "0.8024645", "0.79953194", "0.7994354", "0.7982996", "0.7975772", "0.79300594", "0.79300594", "0.79102004", "0.79071707", "0.79071707", "0.789413", "0.789413", "0.78927565", "0.78927565", "0.7892756...
0.7877349
33
reads a float form a string, even if it has the german format 0,123...
def parse_float(s): return float(s.replace(',', '.'))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __parse_float(str):\n return float(str.strip().replace(',','.'))", "def float_from_string(data):\n return float(maybe_number(data))", "def ffloat(string):\n try:\n return float(string.strip())\n except:\n return 0", "def read_float(v):\n if v.strip() == '':\n return 0....
[ "0.80227596", "0.77828217", "0.7699975", "0.7610833", "0.75872433", "0.7562495", "0.7347126", "0.7338427", "0.7285755", "0.7278729", "0.72324264", "0.7218965", "0.7198287", "0.7153326", "0.7091352", "0.7007192", "0.6976528", "0.69736487", "0.69532895", "0.6889665", "0.688155"...
0.7946037
1
Returns a pathlib.Path for this request string. The implementation for RequestString.path always raises a RuntimeError because it is never absolute. This property only works on absolute requests.
def path(self): if os.path.isabs(self._value): return pathlib.Path(self._value) raise RuntimeError('RequestString.path not supported.')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_path(self, normalize = False):\r\n\r\n split = self.path_s.split(\"?\", 1)\r\n path = split[0]\r\n if not normalize: return path\r\n if not path.startswith((\"http://\", \"https://\")): return path\r\n return netius.legacy.urlparse(path).path", "def get_path(self, path)...
[ "0.7237451", "0.678672", "0.67106724", "0.6682079", "0.66322964", "0.6565029", "0.65359443", "0.65359443", "0.65359443", "0.6533527", "0.65183985", "0.64979887", "0.64979595", "0.64671755", "0.6465075", "0.6459914", "0.6457533", "0.64359605", "0.64359605", "0.64359605", "0.64...
0.88102084
0
Filename for current memory file (the one most recently changed).
def get_current_memory_file(): files = Memory.get_memory_files() if files: files.sort() return files[-1]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def current_filename(self):\n if self.char_limit is not None:\n return '{}/{}.{}.n{}.maf'.format(self.out_dir, self.chrom,\n self.taxon, self.file_num)\n else:\n return '{}/{}.{}.maf'.format(self.out_dir, self.chrom, self.taxon)", "d...
[ "0.73334825", "0.7168673", "0.7136722", "0.7060595", "0.7046298", "0.70014346", "0.6970598", "0.6907836", "0.6907836", "0.6907836", "0.6907836", "0.6907836", "0.68909687", "0.6883916", "0.6880127", "0.6873842", "0.6865343", "0.6865343", "0.68574065", "0.685289", "0.6844556", ...
0.7224698
1
Area of a polygon poly
def area(poly): if len(poly) < 3: # not a plane - no area return 0 total = [0, 0, 0] num = len(poly) for i in range(num): vi1 = poly[i] vi2 = poly[(i+1) % num] prod = np.cross(vi1, vi2) total[0] += prod[0] total[1] += prod[1] total[2] += prod[2] ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def polygon_area_2d(polygon):\r\n return geometry.gmPolygonArea(polygon)", "def area(self):\n if len(self.exterior) < 3:\n raise Exception(\"Cannot compute the polygon's area because it contains less than three points.\")\n poly = self.to_shapely_polygon()\n return poly.area", ...
[ "0.8176059", "0.8084898", "0.79985636", "0.79627657", "0.7924583", "0.77745014", "0.7765651", "0.76911414", "0.7609196", "0.7605955", "0.75849307", "0.75703204", "0.7535243", "0.7532483", "0.74723613", "0.7454908", "0.72762483", "0.72718465", "0.71883357", "0.71582144", "0.71...
0.7998656
2
Transformation matrix from rotation matrix and translation vector.
def transform_from_rot_trans(r, t): r = r.reshape(3, 3) t = t.reshape(3, 1) return np.vstack((np.hstack([r, t]), [0, 0, 0, 1]))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def transformation_matrix(self):\n t = np.array([[0.0], [0.0], [0.0]])\n Rt = np.hstack([self.rotation_matrix, t])\n return np.vstack([Rt, np.array([0.0, 0.0, 0.0, 1.0])])", "def rotation_to_transformation_matrix(R):\n R = Matrix(R)\n T = R.col_insert(3, Matrix([0., 0., 0.]))\n T = ...
[ "0.79309523", "0.75719136", "0.73282856", "0.7112825", "0.7076982", "0.70006925", "0.6996054", "0.6989444", "0.69222313", "0.6920505", "0.6899384", "0.6864149", "0.6864149", "0.6862257", "0.68577725", "0.68504566", "0.683982", "0.68377185", "0.683515", "0.6823503", "0.6820043...
0.64948016
48
Rotation about the yaxis.
def roty(t): c = np.cos(t) s = np.sin(t) return np.array([[c, 0, s], [0, 1, 0], [-s, 0, c]])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def rot_y_deg(self):\n # TODO describe which axis this is\n return math.degrees(self._rot_y_rad)", "def rot_y_rad(self):\n return self._rot_y_rad", "def rotation_center_y(self, *args, **kwargs) -> Any:\n pass", "def rotate_y(self, angle):\n angle *= np.pi / 180\n ret...
[ "0.75396633", "0.7354722", "0.7102622", "0.7064357", "0.7036538", "0.6986756", "0.6895528", "0.6895528", "0.68484044", "0.68028474", "0.6717387", "0.66640604", "0.66279566", "0.6614649", "0.658053", "0.6575346", "0.6554816", "0.6505504", "0.63935125", "0.6393029", "0.63855916...
0.0
-1
represent transitions as table
def transitions_table(transitions, states, alphabet): transitions = sanitize_transitions(transitions) check_transitions(transitions, states, alphabet) table = [] for current in states: for read in alphabet: # DEBUG: print(state, read) next, write, move = transitions(cur...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def transitions(self) -> List[Dict]:\n return []", "def get_transitions(self):\n transitions = []\n for row in self.states:\n t_row = []\n for column in self.states:\n t_row.append([row, column])\n transitions.append(t_row)\n return sort...
[ "0.67255855", "0.6671027", "0.66532004", "0.63881505", "0.6283373", "0.6169781", "0.61309755", "0.61049795", "0.60562634", "0.5987227", "0.5958376", "0.58731186", "0.58591586", "0.5843021", "0.5835255", "0.57839334", "0.57770514", "0.5772655", "0.5761435", "0.57287306", "0.57...
0.71506095
0
Function to get the peak value in an aperture
def get_peak_in_aperture(self,data,mask=None, method='exact',subpixels=5,unit=None): data_cutouts = self.get_data_cutouts(data,mask=None,method='exact',subpixels=5,unit=None) aperture_peaks = [] for data_cutout in data_cutouts: aperture_peaks.append(np.max(data_cutout)) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def peak(self):\n pass", "def peak(self) -> Tuple[MeasureInput, MeasureResult]:\n assert self._data\n return self._data[0][2]", "def peak(self):\n return self.peak", "def peak(self):\n\n return self._data[0]", "def getPeakValue( self ):\n nCurrentMax = max( self.da...
[ "0.75032294", "0.74555135", "0.7303224", "0.73032236", "0.7296107", "0.7195845", "0.70544934", "0.7023032", "0.6945288", "0.6901123", "0.687773", "0.6844767", "0.6735962", "0.66569304", "0.6651869", "0.66357124", "0.6615047", "0.6570366", "0.65643936", "0.6484093", "0.6391976...
0.7094022
6
Add the passed in Pile of Cards to the Hand
def add_pile(self, pile): for c in range(pile.get_size()): card = pile.remove_first() self._hand.add_last(card)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def addCardToHand(self, card):\r\n self.hand.append(card)", "def add_card_to_hand(self, card):\n self.hand.append(card)", "def add_card(self, card):\n #Determines if there are more than one.\n if isinstance(card,list):\n for element in range(len(card)):\n #...
[ "0.7303749", "0.7261806", "0.7231359", "0.71908945", "0.708371", "0.70317644", "0.69786596", "0.69185394", "0.6915161", "0.68766797", "0.68649715", "0.67979866", "0.66192365", "0.6605498", "0.6580519", "0.65088373", "0.6503876", "0.6503876", "0.6503876", "0.6503876", "0.64854...
0.74441516
0
Displays the game over screen
def show_game_over(self): font = pygame.font.SysFont(DisplayConsts.GAME_OVER_FONT_TYPE, DisplayConsts.GAME_OVER_FONT_SIZE) surface = font.render("Game Over", True, DisplayConsts.GAME_OVER_FONT_COLOR) # Display game over rect = surface.get_rect() rect.midtop = (DisplayConsts.SCREEN_WIDTH...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def game_over(self):\r\n win.blit(self.image_of_game_over, (250, 170))", "def show_game_over_screen():\n game_over_font = pygame.font.Font('freesansbold.ttf', 120)\n game_surface = game_over_font.render('Game', True, WHITE)\n over_surface = game_over_font.render('Over', True, WHITE)\n game_rec...
[ "0.828568", "0.81241494", "0.8054334", "0.80165696", "0.8001225", "0.7982136", "0.79339725", "0.76767915", "0.76292074", "0.75744355", "0.75530946", "0.7505249", "0.74886507", "0.74126536", "0.74051535", "0.73711807", "0.7322313", "0.72022474", "0.7196458", "0.7169502", "0.71...
0.83626986
0
Create a new point at the given coordinates.
def __init__(self, initX, initY): self.x = initX self.y = initY
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_new_point(self, coords, **options):\n\n if 'fill' not in options:\n options['fill'] = self.variables.foreground_color\n\n x1, y1 = (coords[0] - self.variables.point_size), (coords[1] - self.variables.point_size)\n x2, y2 = (coords[0] + self.variables.point_size), (coords[...
[ "0.7404491", "0.7181391", "0.71479046", "0.71479046", "0.7141722", "0.6773949", "0.67493427", "0.650266", "0.6469327", "0.64393455", "0.6358204", "0.63443464", "0.6252241", "0.62502253", "0.6229518", "0.62291485", "0.6227966", "0.6197312", "0.61617047", "0.61275893", "0.60861...
0.0
-1
L2 normalize weights of the given tensor along specified dimension(s).
def normalize_weights(w, dims=(0,), bias=1e-5): with tf.name_scope('normalization'): return w / (tf.sqrt(tf.reduce_sum(tf.square(w), dims, keep_dims=True) + bias))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def L2_norm(x, axis=-1):\n return keras.backend.l2_normalize(x, axis=axis)", "def norm2d(w_in):\n return nn.BatchNorm2d(num_features=w_in, eps=cfg.BN.EPS, momentum=cfg.BN.MOM)", "def normalize(w: torch.Tensor):\n\n if w.dim() > 1:\n return _matrix(w)\n\n return _vector(w)", "def l2_normali...
[ "0.6906336", "0.6751098", "0.6747886", "0.67012024", "0.66678435", "0.6618368", "0.659822", "0.65933174", "0.6558486", "0.6515114", "0.6459915", "0.64257294", "0.64257294", "0.6387475", "0.6333754", "0.6331633", "0.63164073", "0.63137084", "0.6294328", "0.625288", "0.62514037...
0.7061722
0
Creates and returns a variable initialized with random_normal_initializer, suitable for use as a weight. In the current variable scope, creates (if necessary) and returns a named variable with `tf.random_normal_initializer`.
def weight_variable(shape, name='weight', mean=0.0, stddev=None, initializer=None, constrain=None, dtype=tf.float32): if stddev is None: raise ValueError('stddev not specified!') if initializer is None: initializer = tf.random_normal_initializer(mean=mean, stddev=stddev) weights = tf.get_var...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_random_normal():\n tf.reset_default_graph()\n tf.random.set_random_seed(0)\n rnormal_class = INITIALIZER_REGISTRY['normal']\n rnormal_obj = rnormal_class({\"mean\":0.5, \"std\":0.1})\n tf_init = rnormal_obj.get_entity_initializer(init_type='tf')\n var1 = tf.get_variable(shape=(1000, 100)...
[ "0.71384406", "0.6798357", "0.6797846", "0.67852306", "0.6762905", "0.66798437", "0.66715586", "0.6670965", "0.66580564", "0.66332424", "0.6632297", "0.6625665", "0.6625665", "0.6625665", "0.66211706", "0.6609821", "0.65978444", "0.6589735", "0.6589735", "0.6588253", "0.65617...
0.62627494
58
Creates and returns a variable initialized with random_normal_initializer, suitable for use as a bias. In the current variable scope, creates (if necessary) and returns a named variable with `tf.random_normal_initializer`.
def bias_variable(shape, name='bias', value=0.0, initializer=None, constrain=None, dtype=tf.float32): if initializer is None: initializer = tf.constant_initializer(value=value) biases = tf.get_variable(name, shape=shape, initializer=initializer, dtype=dtype) if constrain is not None: constra...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_random_normal():\n tf.reset_default_graph()\n tf.random.set_random_seed(0)\n rnormal_class = INITIALIZER_REGISTRY['normal']\n rnormal_obj = rnormal_class({\"mean\":0.5, \"std\":0.1})\n tf_init = rnormal_obj.get_entity_initializer(init_type='tf')\n var1 = tf.get_variable(shape=(1000, 100)...
[ "0.6998297", "0.69813174", "0.6714513", "0.670017", "0.66862786", "0.6548433", "0.65048385", "0.65048385", "0.64924836", "0.6492119", "0.6483953", "0.6455169", "0.6425284", "0.6387288", "0.6375163", "0.63635606", "0.63576484", "0.6350683", "0.63267416", "0.63231707", "0.63061...
0.0
-1
Returns true if both objects are equal
def __eq__(self, other): if not isinstance(other, ContainerSettingsDTO): return False return self.__dict__ == other.__dict__
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __eq__(self, other):\n return are_equal(self, other)", "def __eq__(self, other):\n return are_equal(self, other)", "def __eq__(self,other):\n try: return self.object==other.object and isinstance(self,type(other))\n except: return False", "def __eq__(self, other):\n if i...
[ "0.80886984", "0.80886984", "0.8055307", "0.7983415", "0.79673034", "0.79673034", "0.79673034", "0.79673034", "0.79673034", "0.79673034", "0.79673034", "0.79673034", "0.79673034", "0.79673034", "0.79673034", "0.79673034", "0.79673034", "0.79673034", "0.79673034", "0.79673034", ...
0.0
-1
Returns true if both objects are not equal
def __ne__(self, other): return not self == other
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __ne__(self, other: object) -> bool:\n if self.__eq__(other):\n return False\n return True", "def __ne__(self, other: object) -> bool:\n return not self.__eq__(other)", "def __ne__(self, other) -> bool:\n return not self.__eq__(other)", "def __eq__(self, other):\n ...
[ "0.845611", "0.8391477", "0.8144138", "0.81410587", "0.8132492", "0.8093973", "0.80920255", "0.80920255", "0.80920255", "0.8085325", "0.8085325", "0.8076365", "0.8076365", "0.8065748" ]
0.0
-1
_uniform_order_statistic_cdf(i, n, x) > Pr[U_(i) < x] Let U_1, ..., U_n ~ Uniform[0,1] be n independent random variables and let U_(1) < ... < U_(n) denote the same variables in sorted order. Then U_{(i)} ~ Beta(i, ni+1) This function returns the Cumulative Distribution function of U_(i), i.e. the return value is Pr[U_...
def _uniform_order_statistic_cdf(i, n, x): return betainc(i, n-i+1, x)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def uniform_cdf(x):\n if x <0: return 0 #uniform random is never less than 0\n elif x < 1: return x #e.g. P(x <= 0.4) = 0.4\n else: return 1 #uniform random is always less than 1", "def uniform_cdf(x: float) -> float:\n if x < 0: return 0 # uniform random is never les...
[ "0.6810556", "0.66873217", "0.6532582", "0.61932427", "0.6031655", "0.5951562", "0.58816993", "0.5845623", "0.5833746", "0.5804201", "0.5792395", "0.57640696", "0.571037", "0.5705995", "0.5701245", "0.5682896", "0.56571573", "0.56272", "0.5618689", "0.5618689", "0.55853397", ...
0.82678026
0
Return epidemic curves for region.
def epidemic_curve(self, disease=None, **kwargs) -> pd.DataFrame: disease = get_disease(disease) return disease.epidemic_curve(self.region, **kwargs)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def curves(self):\n return self._curve_reg", "def get_ergodic_region(self):\n return [self.f1(self.rho),self.f0(self.rho)]", "def pcurve(self, edge):\n crv, umin, umax = BRep_Tool().CurveOnSurface(\n edge.topods_shape(), self.topods_shape()\n )\n return crv, Interv...
[ "0.63937724", "0.612072", "0.5898211", "0.5730005", "0.549379", "0.5446748", "0.54353255", "0.53812855", "0.52399015", "0.52078134", "0.5206522", "0.52010757", "0.5192675", "0.51835597", "0.51711965", "0.51685727", "0.516798", "0.51506317", "0.51501995", "0.5141728", "0.51417...
0.66410077
0
Compute K(t) from the epidemic curves. This is function is just a
def estimate_Kt(self, disease=None, **kwargs) -> pd.DataFrame: return self._estimate_K(fit.estimate_Kt, disease, **kwargs)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _k(self, T):\n RT = Rgas * T\n return (self.parameters.A1 / np.exp(self.parameters.E1 / RT),\n self.parameters.A2 / np.exp(self.parameters.E2 / RT))", "def E2K(E):\n return sqrt(E/2.0723)", "def K(p, E):\n R_loss, E_loss = p\n K_ = (8.0/pi**2)*R_loss*E_loss**2 * E / ((...
[ "0.72949606", "0.68840677", "0.66543484", "0.66317314", "0.6623678", "0.65630686", "0.6497177", "0.6467203", "0.64360315", "0.6280468", "0.6248467", "0.6202558", "0.61973745", "0.6180712", "0.61469555", "0.61094", "0.60734826", "0.6054075", "0.6050879", "0.6050879", "0.604047...
0.0
-1
Compute K from the epidemic curves. This is function is just a
def estimate_K(self, disease=None, **kwargs) -> ValueStd: return self._estimate_K(fit.estimate_K, disease, **kwargs)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def E2K(E):\n return sqrt(E/2.0723)", "def energyK(k):\r\n C1 = 9.7846113e-07\r\n C2 = 12.263868e0 \r\n E = (-1.0 + np.sqrt(1.0 + 4.0 * C1 * C2**2 * k**2))/(2.0 * C1)\r\n return E", "def K(p, E):\n R_loss, E_loss = p\n K_ = (8.0/pi**2)*R_loss*E_loss**2 * E / ((2.0*E_loss/pi)**2 + E**2)**2\...
[ "0.73452586", "0.7132003", "0.69813544", "0.693446", "0.6920138", "0.69113845", "0.66754484", "0.6447015", "0.6447015", "0.6443218", "0.6425994", "0.6422214", "0.6419491", "0.63766694", "0.63710374", "0.6330453", "0.63301593", "0.6309316", "0.6291866", "0.6286026", "0.6263551...
0.0
-1
Returns the latest Update entity for a team.
def latest(cls, team): return cls.query( cls.team == team.lower() ).order(-cls.date).get()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_team(self):\n try:\n team_id = self.request.GET.get('team')\n if team_id is not None:\n team_id = int(team_id)\n return self.get_available_teams().get(pk=team_id)\n return self.get_available_teams().latest()\n except (Team.DoesNot...
[ "0.64540523", "0.6395068", "0.6357223", "0.6178414", "0.6149434", "0.584595", "0.58045524", "0.56917953", "0.55864483", "0.5518969", "0.55044276", "0.55032736", "0.5442801", "0.53913397", "0.5334119", "0.525284", "0.5211612", "0.52074313", "0.51889384", "0.5177728", "0.516420...
0.6974967
0
Extrapolation of zero rates beyond fsp.
def extrapolate_zero(known_zero_rates, ufr, llfr, alpha=0.10, fsp=20): # FSP z_fsp = known_zero_rates[fsp - 1] # Extrapolated zero rates extrapolated_zero_rates = known_zero_rates[0:fsp] # Regardless of fsp we want to calculate the extrapolated rates with a maturity of up to 120y up_to = 120 -...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def alternative_extrapolation(input_rates, input_liquid, ufr, fsp=20, alpha=None, va=0.0, volume_traded=np.array([3.3, 1.45, 6, 0.3, 0.4])):\n\n # Assign base variables\n liquid_maturities = np.where(input_liquid == 1)[0] + 1\n liquid_rates_swap = input_rates[np.where(input_liquid == 1)]\n\n # Interpol...
[ "0.69276035", "0.5971338", "0.59490603", "0.58849704", "0.5847047", "0.5700037", "0.567109", "0.56408817", "0.5596573", "0.55785406", "0.5571876", "0.54841083", "0.54795015", "0.54718083", "0.5468277", "0.54417115", "0.5404876", "0.5370664", "0.53702486", "0.53702486", "0.533...
0.7663408
0
test to make sure the unweighted counts result is the same as npairs_3d
def test_unweighted_counts(): npts = 100 random_coords = np.random.random((npts, 3)) random_vectors = np.random.random((npts, 3)) * 2.0 - 1.0 period = np.array([1.0, 1.0, 1.0]) rbins = np.linspace(0.0, 0.3, 5) weights1 = np.ones((npts, 4)) weights1[:, 1] = random_vectors[:, 0] weights...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_3():\n\n # generate two locusts of points\n npts = 100\n epsilon = 0.001\n # #cluster 1\n coords1 = generate_locus_of_3d_points(npts, 0.1, 0.1, 0.1, epsilon=epsilon)\n # cluster 2\n coords2 = generate_locus_of_3d_points(npts, 0.9, 0.9, 0.9, epsilon=epsilon)\n\n # generate orientati...
[ "0.6804071", "0.6675446", "0.6558152", "0.6553596", "0.6355471", "0.59420466", "0.5904359", "0.5867944", "0.5852378", "0.5840163", "0.57754296", "0.5756164", "0.5666417", "0.5629368", "0.56008625", "0.5580319", "0.55392295", "0.55317265", "0.55268514", "0.55140775", "0.550797...
0.8235178
0
Initialize a DecisionSupervisor instance.
def __init__(self): # Define the set of state identifiers self.state = { 0: states.FindWall(), 1: states.FollowWall(), 2: states.TurnToWall(), 3: states.AvoidWall(), 4: states.AvoidObstacles(), 5: states.GoToSample(), 6:...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, estimator, target_language='java',\n target_method='predict', **kwargs):\n super(DecisionTreeClassifier, self).__init__(\n estimator, target_language=target_language,\n target_method=target_method, **kwargs)\n self.estimator = estimator", "de...
[ "0.59564227", "0.5945482", "0.58487767", "0.57880265", "0.5686964", "0.56799275", "0.55700696", "0.5561293", "0.55600226", "0.55399656", "0.5519745", "0.5513815", "0.55039734", "0.55000854", "0.5485623", "0.5476553", "0.547578", "0.54478437", "0.54260653", "0.5421856", "0.540...
0.0
-1
Check if either events have occurred.
def either_events(self, Rover, name1, name2): func1 = self.event.get(name1) func2 = self.event.get(name2) return func1(Rover) or func2(Rover)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check_event_status(self):\n pass", "def both_events(self, Rover, name1, name2):\n func1 = self.event.get(name1)\n func2 = self.event.get(name2)\n return func1(Rover) and func2(Rover)", "def event_check(self):\r\n if len(self.event_queue) > 0:\r\n event = self.e...
[ "0.706401", "0.66520953", "0.65679574", "0.64521164", "0.63444453", "0.63211894", "0.6298124", "0.62498295", "0.6214975", "0.62132365", "0.6204186", "0.60979587", "0.60976624", "0.60758334", "0.6062037", "0.6035241", "0.60278326", "0.602027", "0.6019511", "0.6019247", "0.6019...
0.6606034
2
Check if both events have occurred.
def both_events(self, Rover, name1, name2): func1 = self.event.get(name1) func2 = self.event.get(name2) return func1(Rover) and func2(Rover)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check_event_status(self):\n pass", "def __le__(self, other: Event) -> bool:\n return self.timestamp <= other.timestamp", "def either_events(self, Rover, name1, name2):\n func1 = self.event.get(name1)\n func2 = self.event.get(name2)\n return func1(Rover) or func2(Rover)", ...
[ "0.6898676", "0.6448902", "0.64360255", "0.6405506", "0.64001495", "0.63844377", "0.6315303", "0.6301358", "0.6233651", "0.6232503", "0.6225918", "0.62225395", "0.62174076", "0.6212137", "0.6169394", "0.6145492", "0.60770476", "0.6058647", "0.6055802", "0.6047041", "0.6041531...
0.7315005
0
Returns the canonical representation of this graph edge.
def __repr__(self): return repr((self.head_vertex, self.tail_vertex))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __repr__(self):\n return 'Edge(%s, %s)' % (repr(self[0]), repr(self[1]))", "def canonicalize(self):\n return _libsbml.ASTNode_canonicalize(self)", "def canonical_vertex(self):\n return self.L.zero(), self.K.one()", "def __repr__(self):\n s = f\"GraphViaEdges(name={repr(self.na...
[ "0.6712845", "0.64270645", "0.6277145", "0.62455523", "0.61855644", "0.6159736", "0.61473686", "0.61255693", "0.6048268", "0.6000083", "0.5991154", "0.59588206", "0.5912053", "0.59012926", "0.5886229", "0.58211297", "0.5789143", "0.5769494", "0.5747226", "0.5731961", "0.57145...
0.54360175
36
Returns a string representation of this graph edge.
def __str__(self): class_name_str = str(self.__class__.__name__) + ": (" attributes_str = str(self.head_vertex) + ", " + \ str(self.tail_vertex) + ")" str_rep = class_name_str + attributes_str return str_rep
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __str__(self):\n s = f\"GraphViaEdges '{self.name}',\\nedges :\\n\"\n for edge, edgetype in self.edges.items():\n s += f\" {edge[0]} {edgetype.value} {edge[1]}\\n\"\n\n return s", "def __repr__(self) -> str:\n if self._has_direction:\n return (\n ...
[ "0.829538", "0.8027543", "0.80226904", "0.7803095", "0.77875525", "0.7444098", "0.740537", "0.740537", "0.7379465", "0.7336204", "0.733274", "0.73219347", "0.72903866", "0.7256598", "0.7256598", "0.71568406", "0.71414953", "0.700553", "0.69704586", "0.6965743", "0.6958509", ...
0.6592445
42
Compares two graph edges for inequality. The comparison is done by comparing the vertices constituting the respective edge.
def __ne__(self, other): return not self == other
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __ge__(self, other):\n if self.head_vertex < other.head_vertex:\n return False\n elif self.tail_vertex < other.tail_vertex:\n return False\n elif self.weight < other.weight:\n return False\n return True", "def __ge__(self, other):\n if self....
[ "0.67699313", "0.67699313", "0.6718917", "0.6626745", "0.65958774", "0.65786624", "0.6506578", "0.64915997", "0.6450196", "0.642483", "0.63609326", "0.6352806", "0.63514936", "0.63239413", "0.62910086", "0.6231645", "0.6231645", "0.6223897", "0.6218536", "0.6200331", "0.61680...
0.0
-1
Returns if this edge is directed.
def is_directed(self): return self.directed
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_directed(self):\n return self.graph_properties.directed", "def is_directed(self) -> bool:\n return self._directed", "def is_directed(self):\n return self._directed", "def is_directed(self):\n\n return self._directed", "def is_directed(self):\n return self.G.is_dire...
[ "0.84067917", "0.83739835", "0.83364844", "0.83069426", "0.82440245", "0.8019368", "0.78854835", "0.7802546", "0.74070334", "0.7043718", "0.6455642", "0.6275015", "0.6208662", "0.6207945", "0.61559343", "0.60839826", "0.60836643", "0.60414565", "0.60307395", "0.602906", "0.60...
0.83261657
4
Constructs a directed weighted graph edge connecting the two specified vertices found in the specified graph.
def __init__(self, graph, head_vertex, tail_vertex, weight): super(DirectedWeightedGraphEdge, self).__init__( graph, head_vertex, tail_vertex) self.weighted = True self.weight = weight
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def graph_with_edges():\n from weighted_graph import Weighted\n new_graph = Weighted()\n new_graph.add_node('A')\n new_graph.add_node('B')\n new_graph.add_node('C')\n new_graph.add_node('D')\n new_graph.add_node('E')\n new_graph.add_node('F')\n new_graph.add_edge('A', 'B')\n new_graph...
[ "0.67409766", "0.6545794", "0.64893067", "0.6466647", "0.64448774", "0.63899666", "0.6371012", "0.63194865", "0.6267181", "0.61984056", "0.6165937", "0.6140469", "0.613026", "0.6119577", "0.60430056", "0.60415614", "0.6038654", "0.60329944", "0.602843", "0.6024041", "0.602313...
0.6211411
9
Returns the canonical representation of this directed weighted graph edge.
def __repr__(self): return repr((self.head_vertex, self.tail_vertex, self.weight))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __repr__(self):\n return 'Edge(%s, %s)' % (repr(self[0]), repr(self[1]))", "def to_directed(self):\n return self.copy()", "def edge_attribute(self):\n return self._edge_attribute", "def canonical_vertex(self):\n return self.L.zero(), self.K.one()", "def __repr__(self):\n ...
[ "0.6424335", "0.61460406", "0.6138745", "0.61359054", "0.61086214", "0.6104206", "0.6060279", "0.60108656", "0.59402764", "0.5861147", "0.5855592", "0.5824435", "0.5788696", "0.57834995", "0.5775695", "0.5741126", "0.57334286", "0.5730161", "0.572557", "0.56915885", "0.567717...
0.5819703
13
Returns a string representation of this directed weighted graph edge.
def __str__(self): class_name_str = str(self.__class__.__name__) + ": (" head_str = str(self.head_vertex) + ", " tail_str = str(self.tail_vertex) + ", " weight_str = str(self.weight) + ")" attributes_str = head_str + tail_str + weight_str str_rep = class_name_str + attrib...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __str__(self):\n s = f\"GraphViaEdges '{self.name}',\\nedges :\\n\"\n for edge, edgetype in self.edges.items():\n s += f\" {edge[0]} {edgetype.value} {edge[1]}\\n\"\n\n return s", "def __str__(self):\n # string representation includes values of all inner fields\n ...
[ "0.7739981", "0.7695178", "0.7586101", "0.75069964", "0.7232776", "0.72205067", "0.71528155", "0.7108102", "0.70996356", "0.7042502", "0.69743747", "0.6971483", "0.68795323", "0.68476313", "0.6840448", "0.6840448", "0.67873716", "0.67873716", "0.6765409", "0.6765409", "0.6751...
0.65143275
29
Compares two directed weighted graph edges for equality. The comparison is done by comparing the vertices constituting the respective edges and the weight of the respective edges.
def __eq__(self, other): if isinstance(other, DirectedWeightedGraphEdge): if self.head_vertex != other.head_vertex: return False elif self.tail_vertex != other.tail_vertex: return False elif self.weight != other.weight: return F...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __eq__(self, other):\n return (self.vertices == other.vertices and self.weight == other.weight)", "def __eq__(self, other):\n if isinstance(other, type(self)):\n same_edges = self._edges == other._edges\n same_weights = self._weights == other._weights\n return s...
[ "0.6958796", "0.66861707", "0.6495343", "0.6471634", "0.6320421", "0.62764096", "0.62764096", "0.6267954", "0.6096804", "0.6045613", "0.59932524", "0.5959931", "0.59565455", "0.5941056", "0.592869", "0.5906578", "0.5875933", "0.58749247", "0.58143383", "0.57974845", "0.577917...
0.6716901
1
Compares two directed weighted graph edges for inequality. The comparison is done by comparing the vertices constituting the respective edges and the weight of the respective edges.
def __ne__(self, other): return not self == other
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __ge__(self, other):\n if self.head_vertex < other.head_vertex:\n return False\n elif self.tail_vertex < other.tail_vertex:\n return False\n elif self.weight < other.weight:\n return False\n return True", "def __ge__(self, other):\n if self....
[ "0.6690867", "0.6690867", "0.65242505", "0.6516784", "0.6380098", "0.6228067", "0.61667687", "0.61667687", "0.61625665", "0.6162488", "0.6139756", "0.60557073", "0.60064006", "0.600105", "0.5986747", "0.597607", "0.592648", "0.59132373", "0.5912225", "0.59072435", "0.59072435...
0.0
-1
Returns if this edge is weighted.
def is_weighted(self): return self.weighted
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_weighted(self):\n return self._weighted", "def is_weighted(self):\n return self.properties.weighted", "def is_weighted(G):\n return G.is_weighted()", "def weighted_estimation(self) -> bool:\n\n return self._weighted_estimation", "def is_weight(self):\n return self.id i...
[ "0.85247034", "0.84561473", "0.7810495", "0.7601611", "0.73710126", "0.7284329", "0.7097942", "0.7078276", "0.65169454", "0.64693487", "0.6455727", "0.6354632", "0.63507086", "0.63039726", "0.62808347", "0.6277241", "0.6258785", "0.62173945", "0.6197365", "0.6197365", "0.6197...
0.85533684
2
Returns the weight of the directed weighted graph edge.
def get_weight(self): return self.weight
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def weight(self, edge):\n \n return self._weights[frozenset(edge)]", "def edge_weight(edge):\n return distance(edge.orig, edge.dest)", "def get_edge_weight(self, vertex1, vertex2):\n if not self.is_weighted():\n print(\"WARNING: Graph is NOT weighted!\")\n return N...
[ "0.8129193", "0.8003027", "0.80014724", "0.76997113", "0.7638267", "0.75383854", "0.7373104", "0.7211308", "0.715701", "0.6963197", "0.696162", "0.69156826", "0.66656625", "0.66656625", "0.66656625", "0.6635396", "0.65802395", "0.6562561", "0.6515059", "0.6470114", "0.6467352...
0.6724653
12
Returns if this edge is weighted.
def is_weighted(self): return self.weighted
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_weighted(self):\n return self._weighted", "def is_weighted(self):\n return self.properties.weighted", "def is_weighted(G):\n return G.is_weighted()", "def weighted_estimation(self) -> bool:\n\n return self._weighted_estimation", "def is_weight(self):\n return self.id i...
[ "0.85247034", "0.84561473", "0.7810495", "0.7601611", "0.73710126", "0.7284329", "0.7097942", "0.7078276", "0.65169454", "0.64693487", "0.6455727", "0.6354632", "0.63507086", "0.63039726", "0.62808347", "0.6277241", "0.6258785", "0.62173945", "0.6197365", "0.6197365", "0.6197...
0.85533684
0
Returns if this edge is directed.
def is_directed(self): return self.directed
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_directed(self):\n return self.graph_properties.directed", "def is_directed(self) -> bool:\n return self._directed", "def is_directed(self):\n return self._directed", "def is_directed(self):\n\n return self._directed", "def is_directed(self):\n return self.G.is_dire...
[ "0.84067917", "0.83739835", "0.83364844", "0.83069426", "0.82440245", "0.8019368", "0.78854835", "0.7802546", "0.74070334", "0.7043718", "0.6455642", "0.6275015", "0.6208662", "0.6207945", "0.61559343", "0.60839826", "0.60836643", "0.60414565", "0.60307395", "0.602906", "0.60...
0.83261657
3
Constructs an undirected weighted graph edge connecting the two specified vertices found in the specified graph.
def __init__(self, graph, head_vertex, tail_vertex, weight): super(UnDirectedWeightedGraphEdge, self).__init__( graph, head_vertex, tail_vertex) self.weight = weight
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def graph_with_edges():\n from weighted_graph import Weighted\n new_graph = Weighted()\n new_graph.add_node('A')\n new_graph.add_node('B')\n new_graph.add_node('C')\n new_graph.add_node('D')\n new_graph.add_node('E')\n new_graph.add_node('F')\n new_graph.add_edge('A', 'B')\n new_graph...
[ "0.6535345", "0.6419934", "0.6400952", "0.6257576", "0.62537855", "0.6233085", "0.6230038", "0.6156722", "0.6150063", "0.6117105", "0.6092831", "0.60178375", "0.598439", "0.5979376", "0.59757173", "0.5965193", "0.59521127", "0.5938053", "0.5937702", "0.58988655", "0.58736444"...
0.6103343
10
Returns the canonical representation of this graph edge.
def __repr__(self): return repr((self.head_vertex, self.tail_vertex, self.weight))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __repr__(self):\n return 'Edge(%s, %s)' % (repr(self[0]), repr(self[1]))", "def canonicalize(self):\n return _libsbml.ASTNode_canonicalize(self)", "def canonical_vertex(self):\n return self.L.zero(), self.K.one()", "def __repr__(self):\n s = f\"GraphViaEdges(name={repr(self.na...
[ "0.6712845", "0.64270645", "0.6277145", "0.62455523", "0.61855644", "0.6159736", "0.61473686", "0.61255693", "0.6048268", "0.6000083", "0.5991154", "0.59588206", "0.5912053", "0.59012926", "0.5886229", "0.58211297", "0.5789143", "0.5769494", "0.5747226", "0.5731961", "0.57145...
0.5542506
32
Returns a string representation of this graph edge.
def __str__(self): class_name_str = str(self.__class__.__name__) + ": (" head_str = str(self.head_vertex) + ", " tail_str = str(self.tail_vertex) + ", " weight_str = str(self.weight) + ")" attributes_str = head_str + tail_str + weight_str str_rep = class_name_str + attrib...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __str__(self):\n s = f\"GraphViaEdges '{self.name}',\\nedges :\\n\"\n for edge, edgetype in self.edges.items():\n s += f\" {edge[0]} {edgetype.value} {edge[1]}\\n\"\n\n return s", "def __repr__(self) -> str:\n if self._has_direction:\n return (\n ...
[ "0.829538", "0.8027543", "0.80226904", "0.7803095", "0.77875525", "0.7444098", "0.740537", "0.740537", "0.7379465", "0.7336204", "0.733274", "0.73219347", "0.72903866", "0.7256598", "0.7256598", "0.71568406", "0.71414953", "0.700553", "0.69704586", "0.6965743", "0.6958509", ...
0.6620852
38
Compares two undirected weighted graph edges for equality. The comparison is done by comparing the vertices constituting the respective edges and the weight of the respective edges.
def __eq__(self, other): if isinstance(other, UnDirectedWeightedGraphEdge): if self.head_vertex != other.head_vertex: return False elif self.tail_vertex != other.tail_vertex: return False elif self.weight != other.weight: return...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __eq__(self, other):\n return (self.vertices == other.vertices and self.weight == other.weight)", "def __eq__(self, other):\n if isinstance(other, DirectedWeightedGraphEdge):\n if self.head_vertex != other.head_vertex:\n return False\n elif self.tail_vertex ...
[ "0.70128596", "0.6869596", "0.67607963", "0.6654154", "0.6561618", "0.6561618", "0.6346451", "0.6277991", "0.6276002", "0.6192862", "0.60529923", "0.60419333", "0.60337394", "0.6005246", "0.59807146", "0.59807146", "0.5971091", "0.5962844", "0.5947676", "0.5939486", "0.592814...
0.678387
2
Compares two undirected weighted graph edges for inequality. The comparison is done by comparing the vertices constituting the respective edges and the weight of the respective edges.
def __ne__(self, other): return not self == other
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __ge__(self, other):\n if self.head_vertex < other.head_vertex:\n return False\n elif self.tail_vertex < other.tail_vertex:\n return False\n elif self.weight < other.weight:\n return False\n return True", "def __ge__(self, other):\n if self....
[ "0.68472934", "0.68472934", "0.65563667", "0.65508115", "0.64969313", "0.6274817", "0.6274817", "0.6223155", "0.61916786", "0.61542195", "0.614179", "0.6086487", "0.6039508", "0.60231197", "0.6021971", "0.6021971", "0.6004016", "0.5975145", "0.5955949", "0.59454757", "0.59438...
0.0
-1
Returns the weight of the undirected weighted graph edge.
def get_weight(self): return self.weight
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def weight(self, edge):\n \n return self._weights[frozenset(edge)]", "def edge_weight(edge):\n return distance(edge.orig, edge.dest)", "def get_edge_weight(self, vertex1, vertex2):\n if not self.is_weighted():\n print(\"WARNING: Graph is NOT weighted!\")\n return N...
[ "0.81204045", "0.77929056", "0.77081287", "0.7384713", "0.73840564", "0.72583896", "0.72555566", "0.7238862", "0.6997294", "0.6879325", "0.68051094", "0.6717882", "0.6713216", "0.66891116", "0.66891116", "0.66891116", "0.6632665", "0.660954", "0.6608168", "0.6507241", "0.6507...
0.67143077
13
Returns if this edge is weighted.
def is_weighted(self): return self.weighted
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_weighted(self):\n return self._weighted", "def is_weighted(self):\n return self.properties.weighted", "def is_weighted(G):\n return G.is_weighted()", "def weighted_estimation(self) -> bool:\n\n return self._weighted_estimation", "def is_weight(self):\n return self.id i...
[ "0.85247034", "0.84561473", "0.7810495", "0.7601611", "0.73710126", "0.7284329", "0.7097942", "0.7078276", "0.65169454", "0.64693487", "0.6455727", "0.6354632", "0.63507086", "0.63039726", "0.62808347", "0.6277241", "0.6258785", "0.62173945", "0.6197365", "0.6197365", "0.6197...
0.85533684
1
Set the name of an address. Sets the name of an address in IDA.
def set_name(address, name, anyway=False): success = idaapi.set_name(address, name, idaapi.SN_NOWARN | idaapi.SN_NOCHECK) if success: return if anyway: success = idaapi.do_name_anyway(address, name) if success: return raise exceptions.SarkSetNameFailed("Failed r...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def change_name(self, address, name):\n with self.connect() as c:\n cur = c.cursor()\n cur.execute(\"UPDATE AddressBook SET name = '{}' WHERE address = '{}'\".format(name, address))\n return True", "def setName(self, name):\n self.name = str(name)", "def setName(s...
[ "0.75548315", "0.71784353", "0.71413356", "0.7125585", "0.71055186", "0.71055186", "0.70820135", "0.70820135", "0.70316553", "0.70316553", "0.70316553", "0.70316553", "0.7006621", "0.6948661", "0.6948661", "0.6948661", "0.6948661", "0.6948661", "0.693277", "0.69252336", "0.69...
0.7559003
0
initialize light cnn network with given weights file. if weights file is None, the weights are initialized by default initializer.
def __init__(self, classes=None, extractor_type='29v2', extractor_weights=None, classifier_weights=None, in_size_hw=(128, 128)): self.in_size_hw = in_size_hw self.num_classes = classes self.extractor_weights = extractor_weights self.classifier_weights = classifier_weights ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def init_weights(self, load_weights=None):\n if load_weights:\n # TODO\n pass\n else:\n # x: lower layer nodes n\n # y: current layer nodes n\n x = self.weights_shape[1]\n y = self.weights_shape[0]\n self.weights = np.random.randn(y, x) / np.sqrt(x) # pylint: disable=no-mem...
[ "0.7651809", "0.7207766", "0.714582", "0.71045166", "0.7063997", "0.70586157", "0.7006124", "0.6996825", "0.6922726", "0.6919001", "0.6825991", "0.67974085", "0.6793859", "0.6781146", "0.6740116", "0.6736335", "0.6708144", "0.6689562", "0.66745234", "0.66745234", "0.66745234"...
0.0
-1
return list of splited dataframes
def prepare_stops_to_request(df: pd.DataFrame) -> list: return [split_df(df, i, i + 100) for i in range(0, len(df), 100)]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _split_by_filename(\n df: pd.DataFrame):\n data = namedtuple('data', ['filename', 'object'])\n gb = df.groupby('filename')\n return [data(filename, gb.get_group(x)) for filename, x in zip(gb.groups.keys(), gb.groups)]", "def splitting_df(dataframe):\n dataframe = dataframe.dropna()\n index ...
[ "0.6931345", "0.6758762", "0.6697154", "0.6572435", "0.6540929", "0.640965", "0.6394982", "0.63716984", "0.6367447", "0.63674307", "0.63355523", "0.6308027", "0.62738186", "0.625152", "0.61773694", "0.61694336", "0.61681116", "0.6078391", "0.6028715", "0.6028631", "0.6020443"...
0.66597307
3
Check if this is the 'max context' doc span for the token. Because of the sliding window approach taken to scoring documents, a single token can appear in multiple documents.
def _check_is_max_context(doc_spans, cur_span_index, position): best_span_index = get_best_span_index(doc_spans, position) return cur_span_index == best_span_index
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _check_is_max_context(doc_spans, cur_span_index, position):\n\n # Because of the sliding window approach taken to scoring documents, a single\n # token can appear in multiple documents. E.g.\n # Doc: the man went to the store and bought a gallon of milk\n # Span A: the man went to the\n # Spa...
[ "0.81666505", "0.81666505", "0.80861664", "0.76825464", "0.7549702", "0.7522705", "0.6171613", "0.59147215", "0.56549305", "0.5647985", "0.5500991", "0.5489646", "0.54532236", "0.5427922", "0.5393629", "0.53854585", "0.5348451", "0.5320114", "0.52660835", "0.52506053", "0.525...
0.7938717
3
Filters out doc_spans, which might not be relevant to answering question, which can be helpful when document is extremely long leading to many doc_spans with no answers
def keep_relevant_docspans(doc_spans, tok_start_position, tok_end_position, mode): if mode == 'all': return doc_spans elif mode == 'only_positive': if tok_start_position in [-1, None] or tok_end_position in [-1, None]: return [] else: r...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def filter_invalid_sents(doc):\n def is_valid(sent):\n tag_counts = Counter([pos[0] for pos in sent['pos_tags']])\n num_subjects = tag_counts['NOUN'] + tag_counts['PROPN'] \\\n + tag_counts['PRON']\n num_predicates = tag_counts['VERB'] + tag_counts['AUX']\n comp...
[ "0.62472975", "0.5847748", "0.583575", "0.57769537", "0.57591414", "0.57234687", "0.56612074", "0.5646727", "0.56322473", "0.55924857", "0.55790424", "0.5574625", "0.55640864", "0.5542045", "0.55394304", "0.55327314", "0.5477125", "0.54676485", "0.5460647", "0.54581726", "0.5...
0.71136427
0
Close the underlying client to the HBase instance. This method can be safely called more than once. Note that the client is destroyed after it is closed which will cause errors to occur
def close(self) -> None: if self.client is None: return if logger is not None: # If called from __del__(), module variables may no longer exist. logger.debug(f"Closing Thrift transport to {self.host}:{self.port}") self.client.close() self.client = No...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def closeConnecetion(self):\n client.close()", "def close_ssh_client(self):\n self.ssh_client.close()", "def close(self):\n self.shutdown()\n self._client.close()", "async def close(self) -> None:\n\n if self._client:\n await self._client.__aexit__()", "def close(s...
[ "0.71063393", "0.6860559", "0.6856127", "0.6839546", "0.6762218", "0.6728074", "0.6604954", "0.6489788", "0.6444724", "0.64077437", "0.6398559", "0.63399166", "0.6217777", "0.6193713", "0.6177189", "0.6150679", "0.614646", "0.6129677", "0.61130965", "0.60951537", "0.6062458",...
0.715433
0
Compares received's attributes with expected's kwargs.
def attrs_eq(received, **expected): for k, v in expected.iteritems(): eq_(v, getattr(received, k))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_attrs(self):\n for self_attr, wrapper_attr in [(\"reactor\", \"_reactor\"),\n (\"client\", \"_client\")]:\n self.assertIdentical(getattr(self, self_attr),\n getattr(self.wrapper, wrapper_attr))", "def test_attribute...
[ "0.6576146", "0.6564596", "0.6462569", "0.6408045", "0.6395285", "0.6344218", "0.6291002", "0.6240182", "0.62239105", "0.61092496", "0.607779", "0.6026101", "0.6014606", "0.60038954", "0.5952767", "0.5885488", "0.5867236", "0.58600116", "0.5829513", "0.58288026", "0.5824071",...
0.7866361
0
Return the absolute path to the migration script folder.
def _migrations_path(): return join(dirname(dirname(dirname(sumo.__file__))), 'migrations')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def migration_directory(self) -> str:\n\n with package_resources.path(\n f\"PyFunceble.data.{PyFunceble.cli.storage.ALEMBIC_DIRECTORY_NAME}\",\n \"__init__.py\",\n ) as file_path:\n result = os.path.split(file_path)[0]\n\n if PyFunceble.storage.CONFIGURATION.cl...
[ "0.771517", "0.7598042", "0.73491156", "0.72787374", "0.7230808", "0.6944726", "0.68556404", "0.6811978", "0.6753096", "0.669813", "0.6693428", "0.667507", "0.66400284", "0.66386336", "0.66133446", "0.6611378", "0.6556615", "0.65509653", "0.6544871", "0.6544871", "0.6486247",...
0.8255686
0
Assert that the numeric prefixes of the DB migrations are unique.
def test_unique(self): leading_digits = re.compile(r'^\d+') seen_numbers = set() path = self._migrations_path() for filename in listdir(path): match = leading_digits.match(filename) if match: number = match.group() if number in seen...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_prefix(self):\n self.chck_triple('prefix')", "def test_strip_column_prefix():\n assert strip_column_prefix(\"ts_some_name\") == \"some_name\"\n assert strip_column_prefix(\"some_name\") == \"some_name\"\n # only the prefix may be stripped\n assert strip_column_prefix(\"ts_some_ts_name...
[ "0.6097303", "0.6040116", "0.5913195", "0.58292675", "0.58030826", "0.57863855", "0.56782293", "0.5632286", "0.5627914", "0.55827665", "0.55247986", "0.55160433", "0.55130035", "0.5502277", "0.5491454", "0.5479071", "0.5462152", "0.54441065", "0.5438034", "0.5420087", "0.5418...
0.7371309
0
Constructor. Any message fields that are implicitly/explicitly set to None will be assigned a default value. The recommend use is keyword arguments as this is more robust to future message changes. You cannot mix inorder arguments and keyword arguments.
def __init__(self, *args, **kwds): if args or kwds: super(SetElectromotorsControlRequest, self).__init__(*args, **kwds) #message fields cannot be None, assign default values for those that are if self.ctrl is None: self.ctrl = actuators_canopen.msg.ElectromotorsState() else: self...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, *args, **kwds):\n if args or kwds:\n super(KomodoSpeechRecCommand, self).__init__(*args, **kwds)\n #message fields cannot be None, assign default values for those that are\n if self.header is None:\n self.header = std_msgs.msg.Header()\n if self.cmd is None:\n ...
[ "0.7794351", "0.7719884", "0.7719884", "0.7686347", "0.76253426", "0.7562994", "0.74395365", "0.7416649", "0.73515975", "0.730761", "0.7279932", "0.72373426", "0.72264934", "0.7223775", "0.7223775", "0.72189564", "0.72111243", "0.72111243", "0.72111243", "0.72111243", "0.7211...
0.0
-1
Constructor. Any message fields that are implicitly/explicitly set to None will be assigned a default value. The recommend use is keyword arguments as this is more robust to future message changes. You cannot mix inorder arguments and keyword arguments.
def __init__(self, *args, **kwds): if args or kwds: super(SetElectromotorsControlResponse, self).__init__(*args, **kwds) #message fields cannot be None, assign default values for those that are if self.result is None: self.result = 0 else: self.result = 0
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, *args, **kwds):\n if args or kwds:\n super(KomodoSpeechRecCommand, self).__init__(*args, **kwds)\n #message fields cannot be None, assign default values for those that are\n if self.header is None:\n self.header = std_msgs.msg.Header()\n if self.cmd is None:\n ...
[ "0.77941823", "0.7721771", "0.7721771", "0.76875746", "0.7627467", "0.75655127", "0.7441343", "0.7418733", "0.7351187", "0.73081994", "0.72794753", "0.72372985", "0.7227603", "0.7225375", "0.7225375", "0.72188306", "0.7213351", "0.7213351", "0.7213351", "0.7213351", "0.721335...
0.0
-1
Makes snake grow one block longer Called by map.update() when snake's head is in collision with food
def grow(self): self.starve = 500 # useful to avoid looping AI snakes (they die younger -> bad fitness) self.body.append(self.old_tail) # that's why I keep old_tail
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update(self):\n head = (\n (self.snake[0][0] + self.xv * self.ac),\n (self.snake[0][1] + self.yv * self.ac),\n )\n self.snake.insert(0, head)\n\n if head == self.apple:\n self.score += 10\n self.apple = None\n while not self.app...
[ "0.7277614", "0.66949636", "0.66329545", "0.6514946", "0.65060645", "0.65026385", "0.6497427", "0.6453022", "0.63167936", "0.6293433", "0.6293245", "0.6209517", "0.6101574", "0.6066382", "0.6060743", "0.60461587", "0.604199", "0.60198057", "0.6012406", "0.59504473", "0.592508...
0.6535498
3
Makes the snake direction to the right of the current direction Current direction = [x,y], turn_right gives [y,x]
def turn_right(self): temp = self.direction[0] self.direction[0] = -self.direction[1] self.direction[1] = temp
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def turn_right(self):\n self.facing_direction += self.config\n if self.facing_direction > 7:\n self.facing_direction -= 8\n self.x, self.y = self.compute_positions()", "def turn_ship_right(self):\n self.degrees -= movement", "def turn_right(self):\n pass", "def t...
[ "0.7601584", "0.75017947", "0.74439204", "0.7421596", "0.7255912", "0.7253135", "0.7243722", "0.7217155", "0.71768004", "0.715687", "0.7089985", "0.7026401", "0.69998384", "0.69393873", "0.69342035", "0.6932262", "0.6792831", "0.6776827", "0.6776374", "0.6773701", "0.67681515...
0.8202334
0
Makes the snake direction to the right of the current direction Current direction = [x,y], turn_right gives [y,x]
def turn_left(self): temp = self.direction[0] self.direction[0] = self.direction[1] self.direction[1] = -temp
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def turn_right(self):\n temp = self.direction[0]\n self.direction[0] = -self.direction[1]\n self.direction[1] = temp", "def turn_right(self):\n self.facing_direction += self.config\n if self.facing_direction > 7:\n self.facing_direction -= 8\n self.x, self.y =...
[ "0.82036936", "0.7602102", "0.7502819", "0.74446523", "0.7422422", "0.72565275", "0.7254244", "0.72445714", "0.7218234", "0.7176285", "0.71571696", "0.70907134", "0.7026792", "0.70008147", "0.6939965", "0.69347", "0.6932813", "0.6794251", "0.67778355", "0.6777165", "0.6773733...
0.65929574
28
r"""Computes the VAE loss function. KL(N(\mu, \sigma), N(0, 1)) = \log \frac{1}{\sigma} + \frac{\sigma^2 + \mu^2}{2} \frac{1}{2}
def loss_fn(self, recons, inputs, mu, log_var, **kwargs): # kld_weight = kwargs['M_N'] # Account for the minibatch samples from the dataset recons_loss = F.mse_loss(recons, inputs) # recons_loss = F.binary_cross_entropy(recons, inputs) KLD = torch.mean(-0.5 * torch.sum(1 + log_var - mu**...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def vae_loss(recon_x, x, mu_logvar):\n mu = mu_logvar[:, 0:int(mu_logvar.size()[1]/2)]\n logvar = mu_logvar[:, int(mu_logvar.size()[1]/2):]\n# KLD = -0.5 * torch.sum(1 + 2 * logvar - mu.pow(2) - (2 * logvar).exp())\n KLD = -0.5 * torch.sum(1 + logvar - mu.pow(2) - logvar.exp())\n# BCE = F.binary_c...
[ "0.71050805", "0.6940623", "0.6602319", "0.6597178", "0.6597178", "0.6597178", "0.6597178", "0.6519826", "0.6477681", "0.64758873", "0.64575756", "0.64531076", "0.64357793", "0.63821673", "0.63579816", "0.631307", "0.6311189", "0.6289294", "0.62851536", "0.6265628", "0.625308...
0.6408748
13
assign target_network.weights variables to their respective agent.weights values.
def load_weigths_into_target_network(self): logging.debug("Transfer Weight!") self.network.save_weights(self._save_path) self.target_network.load_weights(self._save_path)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update_target_network(self):\n self.target.set_weights(self.policy.get_weights()) # Update weights of target network with weights of policy network", "def transfer_weights(self):\n W, target_W = self.model.get_weights(), self.target_model.get_weights()\n for i in range(len(W)):\n ...
[ "0.74298966", "0.7240756", "0.7069389", "0.70639586", "0.6890794", "0.6858491", "0.68172055", "0.67953044", "0.66856223", "0.6684053", "0.6666912", "0.66301864", "0.66301864", "0.66301864", "0.6627997", "0.6626138", "0.66244763", "0.6613709", "0.6606935", "0.65739423", "0.657...
0.7086991
2
The selenium remote control instance of currently active browser.
def selenium(self): return self._selenium
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_webdriver_instance():\n return selenium._current_browser()\n # return PageBase.get_selenium2library_instance()._current_browser()", "def remote_control(self) -> interface.RemoteControl:\n return cast(interface.RemoteControl, self._interfaces[interface.RemoteControl])", "def get_ins...
[ "0.71983075", "0.6925138", "0.64066046", "0.6203262", "0.6168742", "0.5982635", "0.5981238", "0.5977537", "0.58916575", "0.5799441", "0.57358706", "0.572651", "0.57153845", "0.5688557", "0.5687891", "0.56801546", "0.56783015", "0.5634735", "0.5615675", "0.5575124", "0.5522626...
0.62758404
3
Logarithm of the hyperbolic cosine of the prediction error. `log(cosh(x))` is approximately equal to `(x 2) / 2` for small `x` and to `abs(x) log(2)` for large `x`. This means that 'logcosh' works mostly like the mean squared error, but will not be so strongly affected by the occasional wildly incorrect prediction.
def logcosh(y_true, y_pred): def _logcosh(x): return x + nn.softplus(-2. * x) - math_ops.log(2.) return K.mean(_logcosh(y_pred - y_true), axis=-1)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def log_cosh(y_true, y_pred):\n y_pred = tensor_conversion.convert_to_tensor_v2_with_dispatch(y_pred)\n y_true = math_ops.cast(y_true, y_pred.dtype)\n\n def _logcosh(x):\n return x + math_ops.softplus(-2. * x) - math_ops.cast(\n math_ops.log(2.), x.dtype)\n\n return backend.mean(_logcosh(y_pred - y_t...
[ "0.76132387", "0.72645205", "0.70176494", "0.6731372", "0.6226951", "0.62121165", "0.6074388", "0.6073056", "0.59627014", "0.5937668", "0.5929191", "0.5901009", "0.58072233", "0.5728377", "0.5656887", "0.5649234", "0.5644657", "0.5626796", "0.56044716", "0.55885035", "0.55826...
0.74146074
1
When called with an instance of L{bytes}, L{bytes_to_str} decodes its input using I{ascii} and returns the resulting str string as an instance of L{str}.
def test_bytes(self): self.assertRaises( UnicodeDecodeError, lambda: bytes_to_str("\N{SNOWMAN}".encode("utf-8")), ) decoded = bytes_to_str(b"hello world") self.assertIsInstance(decoded, str) self.assertEqual(decoded, "hello world")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def convert_to_string(_bytes: bytes)-> str:\n # print('input bytes: ', _bytes)\n # print('string: ', binascii.hexlify(_bytes))\n # print('string2: ', _bytes.hex())\n # print('string3: ', \" \".join([\"{:02x}\".format(x) for x in _bytes]))\n return \" \".join([\"{:02x}\".format(x) for x in _bytes])",...
[ "0.7246639", "0.7208778", "0.7151885", "0.71390045", "0.7111041", "0.7110607", "0.7110607", "0.70306545", "0.70047045", "0.6990467", "0.6975962", "0.6801189", "0.6800496", "0.6777518", "0.6772956", "0.6617866", "0.65932745", "0.65838194", "0.652744", "0.6471219", "0.6455923",...
0.7150879
3
Check if the sample has been generated in a random way.
def check_randomness(self, alpha = 0.05, cutoff='mean'): stat, p = runstest_1samp(self.x, cutoff=cutoff) return self._result(p,alpha)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def confused(self, rand):\n return rand > 0", "def should_sample(self):\n sampling_probability = 1.0 / self._trans_sample_rate\n log.debug(\"should_sample (sampling prob: %f)\", sampling_probability)\n\n return random() <= sampling_probability", "def _sample_using_random(\n s...
[ "0.790469", "0.7621618", "0.72218984", "0.72212857", "0.71029085", "0.71029085", "0.71029085", "0.71029085", "0.70999885", "0.7068966", "0.7065843", "0.7065843", "0.683941", "0.6784703", "0.6736935", "0.672948", "0.6573652", "0.6567017", "0.647614", "0.646925", "0.646925", ...
0.64064646
29
Check that all field is a string with one or more characters.
def _validateField(request, field): val = request.json.get(field, '') if type(val) is not str or len(val) < 1: raise Exception('Invalid {}'.format(field)) elif field == 'password': return _validatePassword(val) else: return val
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_empty_string(self):\n self.assertTrue(all_unique_chars(\"\"))", "def test_empty_string(self):\n self.assertTrue(all_unique_chars_no_set(\"\"))", "def check_input(input_string):\n if len(input_string) > 50: # check if length of name is less than 50 ir not\n return False\n el...
[ "0.6745913", "0.6696813", "0.6637041", "0.66326654", "0.6543104", "0.6416302", "0.63635653", "0.63391274", "0.632886", "0.6321404", "0.62952805", "0.6273974", "0.6257625", "0.623946", "0.6231969", "0.6192615", "0.61773145", "0.61684555", "0.6159218", "0.6149323", "0.61417013"...
0.0
-1
Checks that password is longer than 8 characters and that it contains upper and lowercase letters and at least one number.
def _validatePassword(password): uppercaseChars = re.search('[A-Z]', password) lowercaseChars = re.search('[a-z]', password) if len(password) < 8: raise Exception("Password must be at lest 8 letters") elif re.search('[0-9]', password) is None: raise Exception("Password must contain atl...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def validate_password(password):\n return isinstance(password, str) and len(password) >= 8 and \\\n re.search(r'[A-Z]', password) and re.search(r'[0-9]', password)", "def validate_password(self, password_field):\n if len(password_field.data) < 8:\n raise ValidationError('Y...
[ "0.8766334", "0.81289023", "0.81200564", "0.80847394", "0.8010414", "0.7993104", "0.78297937", "0.7824315", "0.78155774", "0.7803249", "0.7767423", "0.77415377", "0.7721763", "0.76823556", "0.7681701", "0.7652257", "0.76191694", "0.7600995", "0.75715125", "0.7533356", "0.7520...
0.84100276
1
Convenience method for joining parts of a URL Any leading and trailing '/' characters are removed, and the parts joined together with '/' as a separator. If last element of 'parts' is an empty string, the returned URL will have a trailing slash.
def url_join(*parts): parts = parts or [""] clean_parts = [part.strip("/") for part in parts if part] if not parts[-1]: # Empty last element should add a trailing slash clean_parts.append("") return "/".join(clean_parts)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _url_join(self, *parts):\n return \"/\".join(map(lambda fragment: fragment.rstrip('/'), parts))", "def urljoin(*parts):\n def _gen(parts):\n prev = None\n for part in parts:\n if not part:\n continue\n if not prev:\n prev = part\n ...
[ "0.84102356", "0.82989657", "0.81839633", "0.8064334", "0.79943556", "0.7882533", "0.786418", "0.7630931", "0.7371415", "0.6973159", "0.6902921", "0.68932605", "0.68614244", "0.68232083", "0.68219864", "0.67865187", "0.6781647", "0.677915", "0.6769976", "0.66617376", "0.66453...
0.8668859
0
string that repersents the boundary condition imposed to the energy space wavefunctions
def case(self) -> str: return self._case
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _boundary_value(self) -> str:\n ...", "def __str__(self):\n\t\tself.__normalize()\n\t\tmyStr ='# min = %lf\\n'%(float(self._min))\n\t\tmyStr+='# max = %lf\\n'%(float(self._max))\n\t\tmyStr+='# dx = %lf\\n'%(float(self._dx))\n\t\tmyStr+='# av = %lf (sErr = %lf)\\n'%(self.av,self.sErr)\n\t\tmyStr+...
[ "0.6199592", "0.5976905", "0.5922983", "0.5851359", "0.5840542", "0.57978845", "0.565", "0.5632981", "0.56277174", "0.56101704", "0.55923355", "0.5581757", "0.5577677", "0.54971206", "0.54722154", "0.5458786", "0.5429907", "0.54255545", "0.5425042", "0.54207623", "0.5415468",...
0.0
-1
Pad a singlenested list or a sequence of nd array (torch.tensor or np.ndarray) into a (n+1)d array, only allow the first dim has variable lengths.
def pad_sequences_1d(sequences, dtype=torch.long, device=torch.device("cpu"), fixed_length=None): if isinstance(sequences[0], list): if "torch" in str(dtype): sequences = [torch.tensor(s, dtype=dtype, device=device) for s in sequences] else: sequences = [np.asarray(s, dtype=d...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def pad_list(xs: torch.Tensor, pad_value: int):\n n_batch = len(xs)\n max_len = max(x.size(0) for x in xs)\n pad = xs[0].new(n_batch, max_len, *xs[0].size()[1:]).fill_(pad_value)\n\n for i in range(n_batch):\n pad[i, : xs[i].size(0)] = xs[i]\n\n return pad", "def list_to_padded_array(x_list...
[ "0.7142818", "0.6955065", "0.69292176", "0.69206595", "0.67178845", "0.6659169", "0.66363806", "0.66253", "0.66230506", "0.6605494", "0.65888196", "0.6520145", "0.65112054", "0.6511188", "0.65110904", "0.6510516", "0.64411896", "0.63961047", "0.6319004", "0.6310096", "0.63074...
0.638518
18
Pad a doublenested list or a sequence of nd torch tensor into a (n+1)d tensor, only allow the first two dims has variable lengths
def pad_sequences_2d(sequences, dtype=torch.long): bsz = len(sequences) para_lengths = [len(seq) for seq in sequences] max_para_len = max(para_lengths) sen_lengths = [[len(word_seq) for word_seq in seq] for seq in sequences] max_sen_len = max([max(e) for e in sen_lengths]) if isinstance(sequenc...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def pad_lists(lists, pad_int, pad_len=None, dtype=torch.float, device=device):\n\n if pad_len is None:\n pad_len = max([len(lst) for lst in lists])\n new_list = []\n for lst in lists:\n if len(lst) < pad_len:\n new_list.append(lst + [pad_int] * (pad_len - len(lst)))\n else:...
[ "0.7546675", "0.7244427", "0.709511", "0.70657486", "0.696946", "0.6854676", "0.6830674", "0.67936957", "0.6771958", "0.67284626", "0.6721991", "0.6693022", "0.667271", "0.6560058", "0.65521586", "0.64398044", "0.6357635", "0.6346128", "0.6315901", "0.62978333", "0.6295265", ...
0.57962435
82