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
Returns true if both objects are equal
def __eq__(self, other): if not isinstance(other, RecurrencePatternDto): 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
Returns True if the test object "obj" matches the prototype object "proto". If obj and proto are mappings, obj matches proto if (key in obj) and (obj[key] matches proto[key]) for every key in proto. If obj and proto are sequences, obj matches proto if they are of the same length and (a matches b) for every (a,b) in zip...
def matches(obj, proto): if isinstance(obj, Mapping): if not isinstance(proto, Mapping): return False return all((key in obj and matches(obj[key], val)) for key, val in proto.items()) if isinstance(obj, Sequence) and not isinstance(obj, str): if not (isinstance(proto, Sequ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def equals(self, obj):\n if obj == None:\n return False\n if not (isinstance(obj, (SentenceForm, ))):\n return False\n o = obj\n if self.__name__ != o.__name__:\n return False\n if self.getTupleSize() != o.getTupleSize():\n return False...
[ "0.5698699", "0.5630985", "0.539721", "0.52875316", "0.51983243", "0.5193745", "0.5188951", "0.51687074", "0.5071189", "0.5066488", "0.5043099", "0.5028768", "0.5018447", "0.49935037", "0.49558058", "0.4921788", "0.49159846", "0.4899973", "0.48826578", "0.48544973", "0.484786...
0.82880807
0
Returns the test mapping "obj" after factoring out the items it has in common with the prototype mapping "proto". Consider a recursive merge operation, merge(a, b) on mappings a and b, that returns a mapping, m, whose keys are the union of the keys of a and b, and
def subkeys(obj, proto): if not (isinstance(obj, Mapping) and isinstance(proto, Mapping)): return obj new_obj = {} for key, value in obj.items(): if key not in proto: new_obj[key] = value continue if matches(value, proto[key]) and matches(proto[key], value):...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def matches(obj, proto):\n if isinstance(obj, Mapping):\n if not isinstance(proto, Mapping):\n return False\n\n return all((key in obj and matches(obj[key], val)) for key, val in proto.items())\n\n if isinstance(obj, Sequence) and not isinstance(obj, str):\n\n if not (isinstan...
[ "0.5256622", "0.5186322", "0.49844736", "0.49193838", "0.47653937", "0.4669957", "0.46696606", "0.46444932", "0.4550077", "0.4536834", "0.45043802", "0.450001", "0.44756943", "0.44490245", "0.44445476", "0.4428748", "0.442491", "0.4419134", "0.4414419", "0.4387293", "0.437227...
0.6700285
0
Test fail when trying to signup with an existing email
def test_signup_existing_email(self): url = '/0/chefs' data = { 'email': self.user.email, 'password': 'secret', 'name': 'John', 'surname': 'Doe', 'language': 'es', } resp = self.client.post(url, data=data) self.assertEqu...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_signup_missing_email(self):\n\n invalid_u = User.signup(None, \"testuser\", \"testpass\", \"Test\", \"User\", None)\n \n uid = 99999\n invalid_u.id = uid\n\n with self.assertRaises(exc.IntegrityError) as context:\n db.session.commit()", "def test_register_ex...
[ "0.8121672", "0.8100355", "0.79914504", "0.7966945", "0.79290634", "0.78825", "0.78538597", "0.78521883", "0.7835272", "0.78132766", "0.7812779", "0.77946997", "0.7790612", "0.77850413", "0.7742307", "0.7736527", "0.77243173", "0.7717619", "0.7701845", "0.7695915", "0.7685317...
0.8455592
0
Array of indexes of boxes that are currently visible.
def visible_boxes(self): if not self.variable_vis: raise ValueError('Variable visibility must be enabled via "variable_vis".') return self._visible_boxes
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def activeChildWellIndices(self):\n return self._activeWellIndices", "def get_34index_list(self):\n msk = self.load_mask()\n return [i for (i,v) in enumerate(msk) if v==1]", "def indices(self):\n slice_list = []\n for axis in range(self.ndim):\n if axis in self.dis...
[ "0.667127", "0.66098076", "0.649953", "0.64284825", "0.6357638", "0.634663", "0.6343066", "0.62989444", "0.62894857", "0.62763494", "0.6264251", "0.62637955", "0.625783", "0.62535286", "0.62453705", "0.619242", "0.6191503", "0.6182959", "0.61586684", "0.6135255", "0.6127939",...
0.67173785
0
The vispy.visuals.MeshVisual that used to draw the border.
def border(self): return self._border
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def mesh(self):\n return self._mesh", "def mesh(self):\n return self._mesh", "def mesh(self):\n return self._mesh", "def mesh(self):\n return self._mesh", "def _render_borders(self):\n\n # XXX\n # - read the old glBlendFunc value and restore it if neccessary.\n ...
[ "0.60804784", "0.60804784", "0.60804784", "0.60804784", "0.60778135", "0.60401464", "0.60330665", "0.5962755", "0.58179486", "0.576285", "0.57464737", "0.57280344", "0.5716455", "0.5708957", "0.5698211", "0.5676213", "0.56430167", "0.552942", "0.5439638", "0.5425026", "0.5421...
0.57419616
12
This function will return a random datetime between two datetime objects.
def random_date(start, end): delta = end - start int_delta = (delta.days * 24 * 60 * 60) + delta.seconds random_second = randrange(int_delta) return start + timedelta(seconds=random_second)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def random_date(start, end):\r\n return start + datetime.timedelta(\r\n # Get a random amount of seconds between `start` and `end`\r\n seconds=random.randint(0, int((end - start).total_seconds())),\r\n )", "def random_date(start, end):\r\n delta = end - start\r\n int_delta = (delta.days...
[ "0.77918494", "0.75647223", "0.7562488", "0.754578", "0.75309545", "0.7405053", "0.7334951", "0.7235134", "0.7207752", "0.7169905", "0.6945745", "0.6864313", "0.67521274", "0.66044766", "0.6574501", "0.6525121", "0.6248982", "0.6201766", "0.6185233", "0.6137791", "0.60238856"...
0.7509593
8
Gets general annotation data for a dataset. Basically everything that the annotation Web UI needs, like classes and their colors, which keys to press for each class, and progress.
def annotation_data(dataset_name): try: classnames = get_classnames(dataset_name) except FileNotFoundError: return None else: # Removing R from this would not be sufficient, and would look like a bug all_keys = 'abcdefghijklmnopqrstuvwxyz' colors...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _get_annotations(self) -> List[Dict[int, Dict[str, Any]]]:\n annotations = []\n for item in self.collector:\n data_file_type = os.path.basename(item).split(\".\")[-1]\n annotations.append(\n load_annotation_file(\n os.path.join(\n ...
[ "0.6100371", "0.5930464", "0.58168316", "0.57694376", "0.57194066", "0.56618434", "0.56347775", "0.5609098", "0.55929613", "0.55875194", "0.5569791", "0.55386776", "0.55345094", "0.55141187", "0.55112606", "0.55028033", "0.5489555", "0.54789513", "0.54480016", "0.5446405", "0...
0.7287963
0
Calculate the magnitude of a 3d vector
def vector_3d_magnitude(x, y, z): return math.sqrt((x * x) + (y * y) + (z * z))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def magnitude(v):\n if len(v.arr) != 4 or v[3] != 0.0:\n raise ValueError(\"Only use this function with vectors.\")\n return np.sqrt(np.sum(np.square(v.arr)))", "def vector_magnitude(v):\n\n v = np.atleast_2d(v)\n\n return np.sqrt((v**2).sum(axis=1))", "def magnitude( vectors ):\n vectors...
[ "0.77811116", "0.759065", "0.7551002", "0.7550866", "0.7518799", "0.7386942", "0.7368965", "0.7349469", "0.73449564", "0.7306271", "0.72413987", "0.71244526", "0.7120417", "0.7073096", "0.70674366", "0.7043916", "0.70030254", "0.687828", "0.67796177", "0.67767006", "0.6765149...
0.8485649
0
drop the db after each test
def tearDown(self): db.drop_all()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def tearDown(self):\n app.db.drop_database('local')\n app.db.close()", "def tearDown(self):\n with app.app_context():\n db = app.db.get_db()\n cur = db.cursor()\n with app.open_resource('sql/drop_tests.sql', mode='r') as f:\n cur.execute(f.read...
[ "0.8770249", "0.87615293", "0.8755055", "0.87394303", "0.8652944", "0.8602954", "0.85897136", "0.85897136", "0.85897136", "0.85897136", "0.85897136", "0.85897136", "0.85897136", "0.85897136", "0.85897136", "0.85897136", "0.85897136", "0.85897136", "0.85897136", "0.85897136", ...
0.87856054
0
Get the absolute position of a corner.
def absolute_position(corner: str): screen = ui.main_screen().rect if corner == Corner.TOP_LEFT: return (0, 0) elif corner == Corner.TOP_RIGHT: return (screen.width, 0) elif corner == Corner.BOTTOM_LEFT: return (0, screen.height) elif corner ==...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def relative_position(self) -> Tuple[int, int]:\n return self.position[0] - self.region.rect.x, self.position[1] - self.region.rect.y", "def relative_position(self) -> Tuple[int, int]:\n return self.position[0] - self.region.rect.x, self.position[1] - self.region.rect.y", "def get_absolute_pos(x,...
[ "0.6634786", "0.6634786", "0.6623731", "0.6619794", "0.6616437", "0.6604719", "0.6572081", "0.6554048", "0.65352184", "0.6524717", "0.65233713", "0.6521669", "0.64607877", "0.645872", "0.6423324", "0.6406516", "0.6397813", "0.6383624", "0.63822013", "0.6361139", "0.63440365",...
0.7907764
0
Convenience method to create a user manually.
def create_user(self): User.objects.create_user('test', 'testing@test.com', 'testing')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_user(self):\n return User.objects.create_user(**self.user_data)", "def create_user(self, **kwargs):\n kwargs = self._prepare_create_user_args(**kwargs)\n user = self.user_model(**kwargs)\n # noinspection PyUnresolvedReferences\n return self.save(user)", "def create...
[ "0.84284955", "0.8256174", "0.81976753", "0.8048271", "0.7933476", "0.7924386", "0.79241693", "0.79064405", "0.7898101", "0.78852206", "0.7818084", "0.7807617", "0.77973396", "0.7777655", "0.7771802", "0.77607566", "0.775554", "0.7746862", "0.77113354", "0.7707604", "0.769603...
0.8268673
1
Generate a random authorization code.
def generate_authorization_code(self): return gen_api_key(length=self.token_length)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def generate_code(self):\n code = ''.join(\n random.choices(string.ascii_lowercase + string.digits, k=5))\n self.code = '{}{}'.format(self.user.id, code)", "def create_secret_code():\n characters = string.ascii_uppercase + string.digits\n size = 6\n return ''.join(random.choice(...
[ "0.75588864", "0.74285436", "0.74177575", "0.7316583", "0.7104523", "0.71042585", "0.70178926", "0.69639707", "0.6927824", "0.67356384", "0.6693077", "0.6623431", "0.6611711", "0.65914744", "0.65532476", "0.6545281", "0.6539805", "0.6536347", "0.6520258", "0.6507461", "0.6504...
0.7840646
0
The User object associated with the Message.
def author(self) -> 'User': # stub return self._author
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_user(self) -> User:\n return self.__user", "def user(self):\n u = self.user_info\n return self.user_model.get_by_id(u['user_id']) if u else None", "def get_user(self):\n return self.user", "def get_user(self):\n return self.user", "def user(self):\n if self...
[ "0.81180143", "0.77967113", "0.7780549", "0.7780549", "0.7736923", "0.7668838", "0.7668838", "0.7668838", "0.7668838", "0.74917877", "0.74293023", "0.73992527", "0.73907375", "0.7355705", "0.73159593", "0.7306561", "0.72813743", "0.7246506", "0.72445565", "0.72092044", "0.717...
0.0
-1
The Channel object associated with the Message.
def channel(self) -> 'Channel': # stub return self._channel
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def channel(self) -> Channel:\n return self._channel", "def channel(self):\n return Channel({'id': self.channel_id, 'connection': self.connection})", "def channel(self):\n if not hasattr(self, '_channel'):\n self._channel = self.new_channel()\n return self._channel", "d...
[ "0.83263093", "0.8257726", "0.81421316", "0.79955935", "0.79955935", "0.78739613", "0.77844256", "0.7468138", "0.7245303", "0.71643627", "0.7154064", "0.71420026", "0.71420026", "0.7055766", "0.6878147", "0.6797645", "0.6796876", "0.6750559", "0.6579317", "0.6546563", "0.6541...
0.8154509
2
The raw data received from Twitch for this Message.
def raw_data(self) -> str: return self._raw_data
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def raw_data(self):\n return self._buf[self.data_offset():self.data_offset() + self.size()]", "def raw_data(self):\n return self._raw_data", "def raw_data(self):\n return self._raw_data", "def data(self) -> RawData:\r\n\r\n return self.__data", "def get_raw_data(self):\n ...
[ "0.7280322", "0.72679484", "0.72679484", "0.72263974", "0.7118331", "0.7111228", "0.7034108", "0.6928511", "0.69129807", "0.6881554", "0.68005586", "0.6751314", "0.674784", "0.6744202", "0.6744202", "0.6734652", "0.673346", "0.673346", "0.6688334", "0.65891916", "0.656357", ...
0.68743354
10
The tags associated with the Message. Could be None.
def tags(self) -> Optional[dict]: return self._tags
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def tags(self) -> Optional[Any]:\n return pulumi.get(self, \"tags\")", "def tags(self) -> Optional[Sequence[str]]:\n return pulumi.get(self, \"tags\")", "def tags(self):\n return self.get(\"tags\")", "def tags(self) -> dict:\n\n return self._tags or None # store trivial tags as e...
[ "0.7801532", "0.7703974", "0.7688504", "0.7630333", "0.7615479", "0.7615479", "0.7615479", "0.7615479", "0.7615479", "0.7615479", "0.7615479", "0.7615479", "0.75930405", "0.75923294", "0.75471735", "0.74428624", "0.74302846", "0.7429466", "0.7429466", "0.7425446", "0.7413681"...
0.7742009
1
The Twitch timestamp for this Message. Returns
def timestamp(self) -> datetime.datetime.timestamp: timestamp = datetime.datetime.utcfromtimestamp(int(self._timestamp) / 1000) return timestamp
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_stamp(self):\n return self.timestamp", "def timestamp(self) -> str:\n return self._timestamp", "def timestamp(self) -> str:\n return pulumi.get(self, \"timestamp\")", "def timestamp(self):\n return self._timestamp", "def timestamp(self):\n return self._timestamp",...
[ "0.7599557", "0.7553859", "0.7553516", "0.752067", "0.752067", "0.752067", "0.752067", "0.752067", "0.752067", "0.752067", "0.7501377", "0.7455163", "0.73863286", "0.73297215", "0.7294196", "0.72651196", "0.72509265", "0.72414", "0.7237408", "0.7217636", "0.7154152", "0.705...
0.6769584
36
The channel object associated with the User.
def channel(self) -> Channel: return self._channel
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def channel(self):\n return Channel({'id': self.channel_id, 'connection': self.connection})", "def channel(self):\n if not hasattr(self, '_channel'):\n self._channel = self.new_channel()\n return self._channel", "def channel(self) -> 'Channel': # stub\n return self._chan...
[ "0.7823328", "0.74858785", "0.7391203", "0.73344254", "0.73344254", "0.7309382", "0.720962", "0.71804863", "0.6782343", "0.67373693", "0.6639011", "0.6551901", "0.65171736", "0.64608043", "0.6377815", "0.6369482", "0.63675517", "0.6353321", "0.6353321", "0.6335198", "0.629536...
0.7421104
2
The user's colour. Could be None if no Tags were received.
def colour(self) -> Optional[str]: return self._colour
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def color(self) -> Optional[pulumi.Input[str]]:\n return pulumi.get(self, \"color\")", "def color(self) -> Optional[pulumi.Input[str]]:\n return pulumi.get(self, \"color\")", "def color(self) -> Optional[pulumi.Input[str]]:\n return pulumi.get(self, \"color\")", "def color(self) -> Optio...
[ "0.7140056", "0.7140056", "0.7140056", "0.7140056", "0.7140056", "0.7140056", "0.7140056", "0.7140056", "0.7140056", "0.7140056", "0.7140056", "0.7140056", "0.7140056", "0.7140056", "0.7140056", "0.7140056", "0.7140056", "0.7140056", "0.7140056", "0.7140056", "0.7140056", "...
0.70728153
28
The badges associated with the User. Could be an empty Dict if no Tags were received.
def badges(self) -> dict: return self._badges
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getRobloxBadges(userId):\n url = f\"https://accountinformation.roblox.com/v1/users/{userId}/roblox-badges\"\n r = requests.get(url)\n j = json.loads(r.text)\n return j", "def get(self) -> Iterable[Union[Mapping, int, None]]:\n badges = self.client.get_badges()\n retu...
[ "0.6866523", "0.65146655", "0.63965136", "0.62054354", "0.58355975", "0.58312416", "0.5766076", "0.5588374", "0.5582012", "0.54887116", "0.5471924", "0.54631025", "0.541698", "0.5362237", "0.5343415", "0.5336226", "0.5312547", "0.5305591", "0.5285464", "0.52728367", "0.526344...
0.7892412
0
The Tags received for the User. Could be an empty Dict if no tags were received.
def tags(self) -> dict: return self._tags
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def tags(self):\n return self.get(\"tags\")", "def tags(self):\r\n url = '{0}/tags/'.format(self.get_url())\r\n request = http.Request('GET', url)\r\n\r\n return request, parsers.parse_json", "def tags(self) -> Optional[dict]:\n return self._tags", "def tags(self):\n ...
[ "0.75812435", "0.7488961", "0.7390114", "0.7316173", "0.7299366", "0.7281943", "0.7281943", "0.7268714", "0.72493553", "0.72300494", "0.7169095", "0.7058158", "0.7058158", "0.7058158", "0.7058158", "0.70547444", "0.7025782", "0.7025782", "0.7025782", "0.7025782", "0.70045584"...
0.7255412
8
A boolean indicating whether the User is a moderator of the current channel.
def is_mod(self) -> bool: if self._mod == 1: return True if self.channel.name == self.display_name.lower(): return True else: return False
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_moderator(self):\n return self.user_type == 'M'", "def can_be_moderated_by(user):\n return user.is_active and user.is_staff and (\n user.has_perm('blog.change_membership') or\n user.has_perm('blog.change_blog'))", "def current_user_moderating(self):\n return self...
[ "0.8649722", "0.7638119", "0.75482094", "0.74705786", "0.7286834", "0.7013056", "0.699026", "0.699026", "0.6809722", "0.67592394", "0.6726763", "0.6703034", "0.6703034", "0.66850084", "0.6647362", "0.66276956", "0.6560968", "0.6552491", "0.65246785", "0.6519519", "0.6497481",...
0.70909905
5
wraps a string within single qoute. Mostly needed for insert into database
def wrap_with_in_single_quote(s): return "'{}'".format(s)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def qstring(self, s):\n\n if '\"' in s or ' ' in s or '\\\\' in s:\n return '\"' + s.replace('\\\\', '\\\\\\\\').replace('\"', '\\\\\"') + '\"'\n else:\n return s", "def quote(s):\n if isinstance(s, str):\n if \" \" in s or len(s.split()) > 1:\n start, end...
[ "0.7357636", "0.70734096", "0.6990583", "0.69030076", "0.67781955", "0.66734624", "0.6578122", "0.6562084", "0.65618634", "0.65006495", "0.6492088", "0.6490486", "0.64646506", "0.64400494", "0.64112735", "0.6396136", "0.6389765", "0.638212", "0.6373073", "0.6366212", "0.63542...
0.7279222
1
Returns a task for the given class `name` or type, or None.
def getTask(self, name): for t in self.tasks: if isinstance(name, str): if t.name == name: return t else: if t.__class__ is name: return t return None
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_task(self, name):\n res = Task()\n self.GetTask(name, res)\n return res", "def task_by_type(qs, task_type):\n for task in qs:\n if task.type == task_type:\n return task\n return None", "def get_task(self, u_name):\n rai...
[ "0.7046765", "0.7023009", "0.6943184", "0.6686502", "0.66718686", "0.66415167", "0.6624116", "0.65350837", "0.6532999", "0.6526461", "0.64754677", "0.63859135", "0.6356256", "0.6324332", "0.62372583", "0.62365824", "0.61092407", "0.6106103", "0.61002696", "0.6061775", "0.6025...
0.8375071
0
Starts this service in the background Returns a thread that will join() on graceful shutdown.
def startBG(self): self._createTasks() self._startTasks() t = threading.Thread(target=self._wait) t.start() return t
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def background(self):\n self.thread = threading.Thread(target=self.run)\n self.thread.setDaemon(True)\n self.thread.start()", "def start_background_thread(self):\n self.runner = Runner(queue=queue, app_id=self.app_id)\n self.runner.start()\n # TODO: stop the thread at so...
[ "0.72518885", "0.70656985", "0.6884626", "0.6693459", "0.66344386", "0.6564544", "0.6552758", "0.6452983", "0.64523834", "0.63105285", "0.6274734", "0.62355053", "0.6215287", "0.6196266", "0.61932915", "0.6183784", "0.6117793", "0.6106799", "0.6090693", "0.6088726", "0.605364...
0.68809074
3
Get all of ngram
def get_grams(candidate, n): words = candidate.split(' ') # print(words) grams = list() for i in range(len(words) - n + 1): # print(words[i:i+n]) grams.append(' '.join(words[i:i+n])) return grams
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def ngrams(self):\n return self.__ngrams(())", "def get_ngrams(seq, n):\n return", "def ngrams(self):\n return self.root.ngrams()", "def get_all_ngrams():\n grams = ()\n for i in range(0, 40):\n text_i = read_file(str(i))\n curr_grams = ngramize(text_i, n)\n grams ...
[ "0.8337587", "0.80052924", "0.78762686", "0.7870386", "0.7663963", "0.7575611", "0.7524803", "0.74974436", "0.74677265", "0.7266306", "0.72651994", "0.7223336", "0.7168967", "0.71158063", "0.70929986", "0.7073768", "0.70451427", "0.7038946", "0.7032419", "0.70208275", "0.7011...
0.69890213
22
Runs a command in background. No output is retrieved. Useful for running GUI applications that would block click events.
def execute(command, detach=False): if detach: if not isinstance(command, str): msg = "Detached mode expects a string as command, not {}".format( command) logging.getLogger("i3pystatus.core.command").error(msg) raise AttributeError(msg) command ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def exec_bg(self, cmd, *args, **kwargs):\n return self.exec(cmd, *args, bg=True, **kwargs)", "def background(self):\n self.thread = threading.Thread(target=self.run)\n self.thread.setDaemon(True)\n self.thread.start()", "def run_in_background(self):\n threading.Thread(target=...
[ "0.720585", "0.70323175", "0.6868957", "0.6297476", "0.6182979", "0.61591876", "0.61378676", "0.6125865", "0.6022576", "0.5982148", "0.59293807", "0.5927372", "0.58976394", "0.58790237", "0.5848145", "0.5829282", "0.58067226", "0.5774271", "0.57574177", "0.57424194", "0.57363...
0.0
-1
Given the object geometry generate a 3D plot using Geometry3D library Renderer instance
def plot_3d_object(object_): # Initialize renderer instance r = Renderer() # Add surfaces and goal regions to the renderer instance for surf in object_: r.add((object_[surf][0],'b',1)) if len(object_[surf])>2: r.add((object_[surf][2],'r',1)) r.add((gPoint(-15,-15,-1...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def plot3d(self):\n plot_rupture_wire3d(self)", "def plotTerrain3d(self, gdf: gpd.GeoDataFrame, fig_size: tuple=(12, 10), size: float=0.01):\n fig, ax = plt.subplots(1, 1, figsize=fig_size)\n ax = plt.axes(projection='3d')\n ax.scatter(gdf.geometry.x, gdf.geometry.y, gdf.elevation, s=...
[ "0.699979", "0.6854899", "0.6696654", "0.65606564", "0.65247005", "0.64862555", "0.64855486", "0.64444196", "0.64396155", "0.63991827", "0.6364463", "0.62895536", "0.6284521", "0.62425154", "0.62332267", "0.6223329", "0.6215087", "0.60715675", "0.60688156", "0.60422426", "0.5...
0.79453415
0
Get the critic associated with this actor.
def critic(self) -> CriticType: if not self._critic: raise ValueError("no critic associated with this actor") return self._critic
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_critics(self):\n actors = [ddpg_agent.critic for ddpg_agent in self.maddpg_agent]\n return actors", "def _critic(self, image):\n return torch.mean(self.critic(image))", "def critic(self, critic: CriticType) -> None:\n self._critic = critic", "def ability(self, ability):\n\...
[ "0.6419532", "0.5767918", "0.56854165", "0.5523613", "0.54817516", "0.5477361", "0.541997", "0.5398939", "0.53664863", "0.5311079", "0.5240227", "0.52047384", "0.5190481", "0.5189437", "0.5118587", "0.50764984", "0.5053034", "0.50138736", "0.5009325", "0.49982783", "0.4973842...
0.84475094
0
Set the critic of this actor. You probably do not want to do this manually.
def critic(self, critic: CriticType) -> None: self._critic = critic
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def critic(self) -> CriticType:\n if not self._critic:\n raise ValueError(\"no critic associated with this actor\")\n return self._critic", "def set_CriticsPick(self, value):\n super(SearchByReviewerInputSet, self)._set_input('CriticsPick', value)", "def criticize(self, env: Fak...
[ "0.6765269", "0.55871475", "0.53288627", "0.5272914", "0.5172377", "0.51469475", "0.51087296", "0.5046028", "0.50317234", "0.4984842", "0.4978813", "0.49477944", "0.49282527", "0.49237365", "0.49106264", "0.48933023", "0.48489824", "0.4830805", "0.48293337", "0.4826514", "0.4...
0.8091018
0
Build the heap in array so that largest value is at the root
def down_heap(array, k, n): new_elem = array[k] while k <= n / 2: child = 2 * k if child < n and array[child] < array[child + 1]: child += 1 if new_elem >= array[child]: break array[k] = array[child] k = child ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def build_heap(self):\n n = int((len(self.array) / 2) - 1)\n\n while n >= 0:\n self.heapify_top_down(n)\n n -= 1", "def build_heap(arr):\n for i in range(len(arr)-1, -1, -1):\n down_heapify(arr, len(arr), i)", "def build_heap(arr):\n for i in range((len(arr)//2)...
[ "0.8095088", "0.7962918", "0.7917156", "0.7895223", "0.7788256", "0.77362895", "0.77060807", "0.76463413", "0.7618484", "0.75284415", "0.7524164", "0.7471302", "0.74179846", "0.73783094", "0.73783094", "0.7331774", "0.73256713", "0.7320392", "0.73194724", "0.7265726", "0.7231...
0.6271409
75
Returns empty room with walls of different materials
def empty_diff_walls(): # 4 side walls are absorptive room_materials = [pra.Material(energy_absorption=0.1, scattering=None)] * 4 # floor and ceiling are reflective room_materials.extend([pra.Material(energy_absorption=0.98, scattering=None)] * 2) room_faces = make_polygon( centre=[0,0,2.5], radius=10, hei...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def empty_room():\n\troom_material = pra.Material(energy_absorption=0.6, scattering=None)\n\troom_faces = make_polygon(\n\t\tcentre=[0,0,2.5],\n\t\tradius=10,\n\t\theight=5,\n\t\tN=4,\n\t\trpy=[0,0,np.pi/4]\n\t)\n\n\t# create room\n\twalls = []\n\twalls.extend(create_walls(room_faces, room_material))\n\n\troom = p...
[ "0.8141561", "0.66774863", "0.66051066", "0.65975714", "0.6447375", "0.64353395", "0.6392355", "0.6391305", "0.63583034", "0.6332799", "0.6323636", "0.63046914", "0.62797344", "0.62634623", "0.61977875", "0.6187254", "0.61689997", "0.6131876", "0.61124665", "0.6069279", "0.59...
0.79700404
1
Return a string representation of self.
def __repr__(self): s = self.regular_neighborhood() return 'Train track on the ' + repr(s).lower()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def toString(self) -> str:\n raise NotImplementedError", "def to_string(self):\r\n return self.__str__()", "def __str__ (self) :\n\n return self.as_string()", "def as_string(self):\n return self.__repr__()", "def serialize(self):\n\n\t\treturn str(self)", "def __repr__(self):\...
[ "0.8778861", "0.87629527", "0.8639193", "0.86019945", "0.8544976", "0.8527562", "0.8510531", "0.85032654", "0.846997", "0.846997", "0.846997", "0.846997", "0.846997", "0.846997", "0.846997", "0.846997", "0.846997", "0.846997", "0.846997", "0.846997", "0.846997", "0.84253603...
0.0
-1
Return number of complementary regions of train track.
def num_complementary_regions(self): g = self._get_puncturefinder_graph() # return g.connected_components_number() return nx.number_connected_components(g)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_contours_number(self):\n ncontour = len(self.x)\n logger.info(\"Number of contours: {0}\".format(ncontour))\n return ncontour", "def number_of_new_components(self):\n t_low = self.lower_binary_tree().to_tilting()\n t_up = self.upper_binary_tree().to_tilting()\n r...
[ "0.621802", "0.61952245", "0.61242294", "0.58201116", "0.57810885", "0.5775374", "0.57539856", "0.5722044", "0.5713514", "0.5689252", "0.56840074", "0.56836957", "0.5657429", "0.56544477", "0.5639411", "0.5637723", "0.5621052", "0.560351", "0.56030804", "0.55957466", "0.55931...
0.748708
0
Return the number of cusps for each complementary region.
def num_cusps_of_regions(self): G = self._get_puncturefinder_graph() # return [sum(G.subgraph(vertices=region).edge_labels()) # for region in G.connected_components()] return [sum(edge[2]['weight'] for edge in subgraph.edges(data=True)) for subgrap...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def num_complementary_regions(self):\n g = self._get_puncturefinder_graph()\n # return g.connected_components_number()\n return nx.number_connected_components(g)", "def n_cs(self):\n return np.size(self._cs, 0)", "def ncusps(self):\n n = self.level()\n return sum([arit...
[ "0.76018685", "0.69323325", "0.6927314", "0.6893569", "0.643692", "0.6348874", "0.62144196", "0.61052084", "0.61034214", "0.6092677", "0.6069627", "0.6052347", "0.5982089", "0.597497", "0.59650195", "0.5963505", "0.59482235", "0.5927196", "0.5901739", "0.58945924", "0.5891758...
0.7510573
1
Returns a string representation of the equation in a more human readable form.
def __str__(self): termStrings = [] for term in self.LHS: coefficient = term[0] unknownSet = term[1] termString = str(coefficient) + ' * ' unknownStrings = [] for unknown in unknownSet: unknownString = unknown[0].__class__.__na...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _repr_(self):\n s = 'An equation '\n have_A = not self.A().is_zero()\n if have_A:\n s += repr(self.A()) + ' x '\n if self.b()>=0:\n if have_A:\n s += '+'\n else:\n s += '-'\n if have_A:\n s += ' '\n s +=...
[ "0.77009267", "0.77009267", "0.7477908", "0.7403439", "0.7198123", "0.7147567", "0.698219", "0.69755983", "0.69423485", "0.69423485", "0.68741703", "0.6856115", "0.6800618", "0.67683566", "0.6754597", "0.6743551", "0.67229295", "0.66982067", "0.65467227", "0.65134144", "0.648...
0.6746151
15
Returns a dictionary representation of the equation. Each unknown is a key, and the matching values are their coefficients. RHS (i.e. all constant terms) are tagged with the 'RHS' key.
def get_asDict(self): dictRepresentation = {} for [term_constantFactor, term_unknowns_attributeAddresses] in self.LHS: term_unknowns_attributeAddresses_key = tuple(term_unknowns_attributeAddresses) assert term_unknowns_attributeAddresses_key not in dictRepresentation, 'PrgError: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def linearize(self, params, unknowns, resids):\n\n x = params['x']\n a = self.a\n b = self.b\n J = {}\n\n J['y', 'x'] = 2.0*a*x + b\n return J", "def linearize(self, params, unknowns, resids):\n\n x = hash(params['x'])\n y = params['y']\n J = {}\n\n ...
[ "0.586238", "0.5818951", "0.5657222", "0.56080526", "0.55192053", "0.5433741", "0.54323214", "0.5415554", "0.5337335", "0.5325749", "0.531823", "0.5238016", "0.5237405", "0.5228737", "0.521135", "0.5207039", "0.5191282", "0.5167047", "0.5164668", "0.51615524", "0.51598066", ...
0.75358605
0
Enable CL2 synchronous output at 76.8MHz
def enable_cl2_sync_76p8(self,iskw=0,fskw=31): iskw = iskw & 0x0f iskw = iskw << 4 fskw = fskw & 0x3f self.write_versa5(0x62,0x3b) ## Clock2 CMOS1 output, 3.3V self.write_versa5(0x3d,0x01) ## Set divide by 0x0110 self.write_versa5(0x3e,0x10) self.write_versa5(0x31,0x81) ## Enable divider out...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def disable_cl2(self):\n self.write_versa5(0x31,0x80) ## Disable divider output for clock2\n self.write_versa5(0x63,0x00) ## Disable clock2 output", "def enable_cl2_copy_ad9866(self):\n self.write_versa5(0x62,0x3b) ## Clock2 CMOS1 output, 3.3V\n self.write_versa5(0x2c,0x01) ## Enable aux output on cl...
[ "0.74146825", "0.73921514", "0.72988236", "0.7140919", "0.7073415", "0.6933853", "0.6889324", "0.6867102", "0.6441286", "0.6393696", "0.6255671", "0.61113846", "0.6067008", "0.60661125", "0.5945788", "0.59451103", "0.5923402", "0.58967227", "0.5894524", "0.58458996", "0.58435...
0.7065059
5
Returns a date suffix for a given date
def filter_date_suffix(date_str: str): day = int(date_str[-2:]) if 4 <= day <= 20 or 24 <= day <= 30: suffix = "th" else: suffix = ["st", "nd", "rd"][day % 10 - 1] return date_str + suffix
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __num_suffix(self, check_in_date):\n date_value = str(check_in_date).split(' ')\n day_value = date_value[0][:-2]\n date_value[0] = day_value\n return ' '.join(date_value)", "def _build_tag_suffix() -> str:\n now = datetime.datetime.now(tz=datetime.timezone.utc).astimezone()\n ...
[ "0.7249425", "0.67349887", "0.6392717", "0.6302706", "0.62556237", "0.6224853", "0.6213826", "0.61899906", "0.6069033", "0.59627014", "0.59461755", "0.5929941", "0.59197515", "0.5891935", "0.58643836", "0.585514", "0.5840551", "0.5837133", "0.58069605", "0.58027524", "0.58025...
0.78005004
0
Formats a number according to the user's locale.
def filter_format_number(val, places: Optional[int] = None, grouping: bool = True) -> str: if not isinstance(val, (int, float)): return val if places is not None: format_str = f'%.{places}f' elif isinstance(val, int): format_str = '%d' else: format_str = '%.02f' loca...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def format_number(n):\n # locale.setlocale(locale.LC_ALL, 'en_US') # commented by me\n # return locale.format('%d', n, grouping=True)\n return n", "def format_number(number: float | decimal.Decimal | str, locale: Locale | str | None = LC_NUMERIC) -> str:\n warnings.warn('Use babel.numbers.format_dec...
[ "0.7708875", "0.72223204", "0.67276216", "0.6716781", "0.6651486", "0.65400565", "0.65282077", "0.6475339", "0.6455273", "0.64158565", "0.64149314", "0.6391133", "0.6348135", "0.63243675", "0.6258974", "0.6258527", "0.6156659", "0.61388564", "0.60985017", "0.5956184", "0.5862...
0.6849183
2
Pads a number or string with fillchar to the specified width.
def filter_pad(val: Union[int, str], width: int, fillchar: str = '0') -> str: return str(val).rjust(width, fillchar)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def pad(number, width=0):\n return str(number).zfill(width)", "def pad(text, width, pad_character=\" \"):\n\n length = len(text)\n if width < 0 and length < -width:\n return text + (-width - length) * pad_character\n elif width > 0 and length < width:\n return (width - length) * pad_cha...
[ "0.7816895", "0.7491213", "0.7455374", "0.72899914", "0.7258319", "0.72047716", "0.71930504", "0.7182079", "0.7174301", "0.7163619", "0.7056676", "0.6992811", "0.6971006", "0.6785328", "0.67768764", "0.67735404", "0.67346054", "0.67320627", "0.6665845", "0.6665845", "0.666584...
0.82074344
0
Returns the date from any datetime object
def filter_to_date(date_time_val): if not isinstance(date_time_val, (datetime, date, time)): return date_time_val return date_time_val.date()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def datetime_object(__date):\n if isinstance(__date, datetime.datetime):\n return datetime.datetime(__date.year, __date.month, __date.day, __date.hour, __date.minute, __date.second)\n return None", "def get_date(self, datetime):\n return datetime.date()", "def convert_datetime_to_date(datet...
[ "0.77016056", "0.7657474", "0.76239336", "0.74148065", "0.7198755", "0.7136382", "0.7112282", "0.70942205", "0.7064553", "0.6977849", "0.69114757", "0.6897149", "0.6824943", "0.67450315", "0.67163986", "0.66597766", "0.6655947", "0.6504127", "0.6464905", "0.6451998", "0.64480...
0.6237206
40
Returns a stateaction pair such that all have nonzero probability.
def exploring_starts(self): def random_choice(l): return l[np.random.randint(len(l))] return map(random_choice, (self.env.states, self.env.moves))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def prob(self, state, action):\n if state + action == 100:\n reward = 1\n else:\n reward = 0\n\n return [(state + action, self._p_head, reward), (state - action, 1 - self._p_head, 0)]", "def priorProb(self, state):\n actions = []\n for i in range(0, 10):\n...
[ "0.6925344", "0.6874828", "0.6626757", "0.65579504", "0.6553677", "0.64334875", "0.6333021", "0.6314964", "0.6312907", "0.6280093", "0.6209077", "0.6179659", "0.61782306", "0.61445844", "0.61160684", "0.61140674", "0.6085935", "0.6074689", "0.6061035", "0.60255957", "0.602483...
0.0
-1
Returns the variants from this VCF with duplicate sites filtered out. If any site position appears more than once, throw all variants away. If target_sites_pos is not None, only returns variants from this VCF which are present in the target sampledata file.
def filter_duplicates_target(vcf, target_sites_pos=None): if target_sites_pos is not None: def site_in_target(site): return site in target_sites_pos else: def site_in_target(site): return True row = next(vcf, None) bad_pos = -1 for next_row in vcf: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def find_equivalent_sites(self, site):\n for sites in self.equivalent_sites:\n if site in sites:\n return sites\n\n raise ValueError(\"Site not in structure\")", "def sites(self):\n return self.data.sites.values", "def exclude_duplicates(self, variants):\n ...
[ "0.5047111", "0.48624134", "0.4791929", "0.47910732", "0.47692823", "0.4745043", "0.47057143", "0.469012", "0.469012", "0.46753037", "0.45791847", "0.45689055", "0.4561133", "0.45400792", "0.45036858", "0.4499734", "0.4495113", "0.44825026", "0.44688737", "0.44688693", "0.444...
0.72600794
0
Calculate overlap between bag and kadaster geodataframes in percentages.
def calculate_percentage_overlap(bag_sample, kadaster_sample): # calculate percentage intersection ov_output = gpd.overlay(bag_sample, kadaster_sample, how="intersection") percentage_overlap = ( ov_output.geometry.area / kadaster_sample.geometry.area.values[0] ) percentage_overlap.index = ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def overlapPercent(box1, box2):\n xx2 = min(box1[2], box2[2])\n xx1 = max(box1[0], box2[0])\n yy2 = min(box1[3], box2[3])\n yy1 = max(box1[1], box2[1])\n w = max(0, xx2 - xx1 + 1)\n h = max(0, yy2 - yy1 + 1)\n areaBox1 = boundingBoxArea(box1)\n areaBox2 = boundingBoxArea(box2)\n overlap ...
[ "0.69667053", "0.6415947", "0.62875366", "0.62101567", "0.6209373", "0.6169764", "0.6060111", "0.6049341", "0.604258", "0.5956855", "0.59191436", "0.5853579", "0.5817987", "0.5817337", "0.5816945", "0.57941353", "0.5751341", "0.57163626", "0.56830454", "0.5674475", "0.5645978...
0.7542141
0
Snake Game direction setter, where set the snake moving direction.
def set_direction(self, dir): if dir == 0: self.direction = [0, -1] elif dir == 1: self.direction = [1, 0] elif dir == 2: self.direction = [0, 1] elif dir == 3: self.direction = [-1, 0]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def setDirection(self,stepDir = 2):\n pass", "def set_direction(self, direction: int) -> None: \r\n self.direction = direction\r\n if (direction == Directions.turn_left or\r\n direction == Directions.turn_right):\r\n self.stop_timer = time.time() + self.driving_t...
[ "0.69168955", "0.69109017", "0.6871288", "0.68057656", "0.6718894", "0.66704875", "0.66704875", "0.6626889", "0.65854543", "0.6537999", "0.6521518", "0.65144616", "0.65144616", "0.6441598", "0.64136076", "0.6377561", "0.63321555", "0.6252715", "0.6188561", "0.6182052", "0.617...
0.6849267
3
Identifies if an object is numeric, that is int, float or bool.
def isNumeric(obj): return isinstance(obj, (int, float, bool))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_numeric(obj):\n return isinstance(obj, (int, float, complex))", "def isNumeric(obj):\n # type: (Any) -> bool\n return isinstance(obj, numbers.Number)", "def is_numeric(space, w_obj):\n if w_obj.tp in [space.tp_float, space.tp_int]:\n return space.w_True\n if w_obj.tp == space.t...
[ "0.8730025", "0.8449824", "0.83024406", "0.8183594", "0.80185515", "0.7984723", "0.78311867", "0.77982944", "0.7680896", "0.7653552", "0.75546384", "0.7527674", "0.7505374", "0.74033344", "0.7371881", "0.73513925", "0.7326164", "0.73183155", "0.73108757", "0.7299548", "0.7288...
0.8853641
0
Extract the set of variables used in the expression.
def setOfVariables(self): return set(self.dictOfVariables().keys())
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def variables(self):\n return {u for u in self if u.type == 'var'}", "def variables(s):\n result = set([])\n def walk(s):\n if is_variable(s):\n result.add(s)\n else:\n for arg in s.args:\n walk(arg)\n walk(s)\n return result", "def variable...
[ "0.732395", "0.7177679", "0.7127129", "0.71152806", "0.70917547", "0.7082881", "0.7060633", "0.7013809", "0.70020854", "0.6987668", "0.68900925", "0.68719125", "0.684164", "0.68405646", "0.68211997", "0.67944175", "0.6791887", "0.6791831", "0.6749599", "0.67175937", "0.671635...
0.67013127
22
Obtain the name of the top class of the expression structure
def getClassName(self): n = type(self).__name__ return n
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_top_name(src_file):\r\n top_name = simple_parser(src_file, [re.compile(\"^entity\\s+(\\S+)\", re.I)])\r\n if not top_name:\r\n top_name = simple_parser(src_file, [re.compile(\"^module\\s+(\\S+)\\s*\\(*\", re.I)])\r\n if not top_name:\r\n return\r\n else:\r\n return top_name...
[ "0.6752074", "0.6585589", "0.6552806", "0.64486927", "0.6330987", "0.6217392", "0.6190459", "0.6165048", "0.6146233", "0.61308193", "0.6105699", "0.6000171", "0.5953388", "0.59482145", "0.5904173", "0.5887427", "0.5879653", "0.5875237", "0.5873049", "0.5814375", "0.5787323", ...
0.6279871
5
True if self is inside the circumcircle of the triangle a, b, c
def incircle(self, a, b, c): m11, m12 = a.x - self.x, a.y - self.y m13 = m11 * m11 + m12 * m12 m21, m22 = b.x - self.x, b.y - self.y m23 = m21 * m21 + m22 * m22 m31, m32 = c.x - self.x, c.y - self.y m33 = m31 * m31 + m32 * m32 det1 = m11 * (m22 * m33 - m23 * m32) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_triangle(a, b, c):\n a, b, c = sorted([a, b, c])\n return True if a > abs(b - c) and a < (b + c) else False", "def isInside(x1, y1, x2, y2, x3, y3, x, y):\n # Calculate area of triangle ABC\n A = area (x1, y1, x2, y2, x3, y3)\n \n # Calculate area of triangle PBC\n A1 = area (x, y, x2, ...
[ "0.73922485", "0.7356722", "0.695457", "0.6824137", "0.67203", "0.6709357", "0.66035813", "0.6593374", "0.6554497", "0.6545519", "0.6522001", "0.648764", "0.6479897", "0.6433253", "0.643265", "0.64108306", "0.63878804", "0.63474643", "0.6344589", "0.6325", "0.6320815", "0.6...
0.66134906
6
Get absolute path to resource, works for dev and for Py Installer
def resource_path(relative_path): base_path= getattr(sys,'MEIPASS', os.path.dirname(os.path.abspath(__file__))) 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, dirname=\"data\"):\n # first look in pyinstaller bundle\n if hasattr(sys, \"_MEIPASS\"):\n path = os.path.join(sys._MEIPASS, dirname)\n \n else:\n # th...
[ "0.8265718", "0.8167712", "0.81321955", "0.8101386", "0.80650663", "0.80513847", "0.8046691", "0.80384094", "0.80282605", "0.8021849", "0.8021849", "0.8021849", "0.8021849", "0.8021849", "0.8021849", "0.8021849", "0.80210227", "0.8019758", "0.7997431", "0.7997431", "0.7997431...
0.79244465
43
Map a value v in range [0,1] to discrete ordinal classes
def to_ordinal(v, classes): k = len(classes) # Map position to discrete space n1 = k/(1+exp(-v)) # Add Gaussian noise and round n2 = round(random.gauss(n1, sigma*(k-1))) n3 = min(k-1, max(n2, 0)) return classes[n3]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def to_class(numlist,classlist=string.ascii_lowercase):\n\n return np.vectorize(lambda t: classlist[t])(numlist)", "def to_class(numlist,classlist=string.ascii_lowercase):\n\n return np.vectorize(lambda t: classlist[t])(numlist)", "def convertclasstoemotion(pred):\n \n label_conversion = {'...
[ "0.5957351", "0.5957351", "0.59515435", "0.57738507", "0.57738507", "0.5687176", "0.5631008", "0.5593928", "0.5533812", "0.5503168", "0.5502713", "0.5470743", "0.54443735", "0.5438498", "0.54172623", "0.5414011", "0.53954643", "0.53954643", "0.53868306", "0.5372418", "0.53724...
0.7464597
0
Returns True if parameter is one of the continuous parameters defined in continuous_params
def is_continuous(parameter): return sum([isinstance(parameter, p) for p in continuous_params])>0
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def isActiveFitParam(param):\n return isFitParam(param) and param.isActive()", "def is_bounded_continuous_variable(self):\n for rv in self.unique_variables:\n if not is_bounded_continuous_variable(rv):\n return False\n return True", "def check(self, parameters):\n ...
[ "0.65586585", "0.6500868", "0.63482386", "0.61473125", "0.6105592", "0.60367113", "0.6024447", "0.60074943", "0.5997103", "0.5964175", "0.5911737", "0.5889686", "0.5884454", "0.5884159", "0.57671905", "0.5730443", "0.5730346", "0.57129663", "0.5712339", "0.56427324", "0.56163...
0.8774252
0
Compute softmax values for each sets of scores in x.
def softmax(x): return np.exp(x) / np.sum(np.exp(x), axis=1, keepdims=True)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def softmax(self, scores):\n\n\n # for each sample, for each class ,caclulate\n # np.exp(scores) : still (n_samples, n_classes)\n\n # axis = 1\n # a00, a01, a02 as a sinlge one to perfrom np_sum\n # which is the same sample \n # sum_exp : still (n_samples, 1)\n\n # ...
[ "0.7796294", "0.7760558", "0.7759004", "0.77567077", "0.76577055", "0.76577055", "0.76577055", "0.76577055", "0.7585655", "0.743143", "0.7407772", "0.73941606", "0.7358175", "0.73174125", "0.72689486", "0.72623265", "0.72614294", "0.7256868", "0.723019", "0.7214918", "0.72017...
0.0
-1
This method handles the DELETE requests to remove agents from the Registrar Server. Currently, only agents resources are available for DELETEing, i.e. /agents. All other DELETE uri's will return errors. agents requests require a single agent_id parameter which identifies the agent to be deleted.
def do_DELETE(self): rest_params = common.get_restful_params(self.path) if rest_params is None: common.echo_json_response(self, 405, "Not Implemented: Use /agents/ interface") return if "agents" not in rest_params: common.echo_json_response(self, 400, "uri no...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delete(self):\n rest_params = common.get_restful_params(self.request.uri)\n if rest_params is None:\n common.echo_json_response(self, 405, \"Not Implemented: Use /agents/ interface\")\n return\n\n if \"agents\" not in rest_params:\n common.echo_json_respons...
[ "0.83328235", "0.717082", "0.70636654", "0.6921048", "0.69137836", "0.670038", "0.66952145", "0.6065606", "0.5701796", "0.56838745", "0.5650526", "0.5548786", "0.54742306", "0.5472352", "0.54185456", "0.54131997", "0.54131997", "0.54131997", "0.54131997", "0.54131997", "0.541...
0.8437115
0
This method handles the POST requests to add agents to the Registrar Server. Currently, only agents resources are available for POSTing, i.e. /agents. All other POST uri's will return errors. POST requests require an an agent_id identifying the agent to add, and json
def do_POST(self): rest_params = common.get_restful_params(self.path) if rest_params is None: common.echo_json_response(self, 405, "Not Implemented: Use /agents/ interface") return if "agents" not in rest_params: common.echo_json_response(self, 400, "uri not ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def post(self):\n try:\n rest_params = common.get_restful_params(self.request.uri)\n if rest_params is None:\n common.echo_json_response(self, 405, \"Not Implemented: Use /agents/ interface\")\n return\n\n if \"agents\" not in rest_params:\n ...
[ "0.7403621", "0.65014863", "0.63130796", "0.616501", "0.57305866", "0.56719697", "0.5531976", "0.55056393", "0.5445917", "0.5390362", "0.5374244", "0.5350049", "0.5341212", "0.53108996", "0.5275562", "0.52541816", "0.5252334", "0.52314633", "0.519691", "0.51821196", "0.515735...
0.7357061
1
Constructs the SAM model filename from the rest of the config.
def get_model_filename(config): base = os.path.splitext(config['corpus'])[0] return '%s--%dT.model' % (base, config['T'])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _setupFilename(self):\n try:\n os.mkdir('./.netModel')\n except:\n pass # hope it's already there...\n filenames = os.listdir('./.netModel')\n configNum = 1\n i = 0\n configNumString = '%(c)04d' % {'c':configNum}\n while i < len(filenames):...
[ "0.7139478", "0.6578594", "0.65595764", "0.65387714", "0.6311835", "0.62951124", "0.6235641", "0.6173565", "0.61575484", "0.61424035", "0.6047662", "0.6041903", "0.602598", "0.60108405", "0.6004139", "0.5995963", "0.5995963", "0.5995963", "0.5995401", "0.5993016", "0.5983836"...
0.7508373
0
walk over files in provided directory and return a list of files
def walk_directory(self, path): files = [] for dirpath, dirnames, filenames in os.walk(path): for filename in filenames: files.append(os.path.join(dirpath, filename)) return files
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def list_all_files(in_dir):\n\n for dirname, dirs, files in os.walk(in_dir):\n for filename in files:\n yield op.join(dirname, filename)", "def get_all_files(directory):\r\n for dirpath, _dirnames, filenames in os.walk(directory):\r\n for fil...
[ "0.7925665", "0.78335404", "0.7786359", "0.7776031", "0.7694388", "0.76942396", "0.7658098", "0.7648747", "0.75843465", "0.757489", "0.75511634", "0.7523276", "0.75155026", "0.75122464", "0.7501486", "0.74656945", "0.74481636", "0.74200726", "0.7414121", "0.74086905", "0.7391...
0.7963085
0
removes the last x messages of one or multiple users in this channel (defaults to 10)
async def user_(self, ctx, users: commands.Greedy[SnowflakeUserConverter], number=10): number = number if number <= 100 else 100 if not users: await ctx.send("provide at least one user who's messages will be deleted") return try: history_mes = await ctx.channe...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async def channel_(self, ctx, number=10):\n number = number if number <= 100 else 100\n question = await ctx.send(f\"this will delete the last {number} messages from ALL users. Continue?\")\n await question.add_reaction(self.reactions[0])\n await question.add_reaction(self.reactions[1])...
[ "0.7105398", "0.68632597", "0.6672986", "0.6618884", "0.6551749", "0.6516888", "0.64608115", "0.6348324", "0.634653", "0.6305305", "0.62872237", "0.627683", "0.6265279", "0.6210859", "0.60842794", "0.6058932", "0.60314727", "0.60222024", "0.5947523", "0.5945988", "0.5932941",...
0.6821348
2
removes the voice mute from the user
async def voice_unmute(self, ctx, member: discord.Member, *, reason: typing.Optional[str]): if member.voice and member.voice.mute: await member.edit(mute=False, reason=reason[:512]) await ctx.send(f"User {member.mention} successfully unmuted from voice") return if mem...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def disable_mute(self):\n self.mute = False", "def auto_unmute():\n muted = set(t.mutes.users.ids(screen_name=TWITTER_HANDLE)[\"ids\"])\n\n # put user IDs of people you want to remain muted here\n users_keep_muted = set([])\n \n # mute all \n for user_id in muted:\n ...
[ "0.72997713", "0.7251795", "0.72145253", "0.715578", "0.7043591", "0.704066", "0.6953093", "0.66627467", "0.66627467", "0.65974224", "0.65581214", "0.6521086", "0.650788", "0.6476802", "0.6468581", "0.64371324", "0.6434671", "0.64207184", "0.63918686", "0.6384546", "0.6383815...
0.72480994
2
Initializing the head of the Linked_list
def __init__(self): self.head = None
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, head=None):\n\n self.head = head", "def __init__(self, head: ListNode):\n self.head = head", "def __init__(self, head: ListNode):\n self.head = head", "def __init__(self, head: ListNode):\n self.head = head", "def __init__(self, head: ListNode):\n self....
[ "0.76852554", "0.7625419", "0.7625419", "0.7625419", "0.7625419", "0.7625419", "0.76188356", "0.7614141", "0.7609624", "0.7589807", "0.75867033", "0.75867033", "0.75867033", "0.75867033", "0.7542752", "0.7542752", "0.7542752", "0.7524615", "0.7462615", "0.74574006", "0.745740...
0.75173056
26
Load table from PostgreSQL and return DataFrame
def psql_loader(spark, tbname): print("Loading files from PostgreSQL table: %s" % tbname) filelist = spark.read \ .format('jdbc') \ .option('url', 'jdbc:postgresql://%s' % __credential__.jdbc_accessible_host_psql) \ .option('dbtable', tbname) \ .option('user', __credential__.user...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load_table_as_pd(conn, tablename: str):\n # get table as a pandas dataframe\n statement = f\"\"\"\n SELECT *\n FROM '{tablename}';\n \"\"\"\n df = pd.read_sql_query(statement, conn)\n return df", "def load_sql(df):\n engine = create_engine(f'postgres://{user}:{user}@{host}:{po...
[ "0.79041684", "0.76842356", "0.7556004", "0.75084865", "0.72811633", "0.7240457", "0.724002", "0.7168315", "0.7156168", "0.71058154", "0.6883798", "0.68439525", "0.68343174", "0.6815867", "0.68074024", "0.67803746", "0.6745628", "0.6738434", "0.67353094", "0.66974735", "0.666...
0.6362915
40
Converts a numeric value index into its data value.
def get_value_by_index(self, index): return self['value'][index]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _decode_index_value(self, index, value):\n if index.endswith(\"_int\"):\n return int(value)\n else:\n return value", "def get_d_value(self, key=\"\", index=-1):\n _key = key\n _index = index\n if(_index < 0):\n _index = self.get_index(_key)\...
[ "0.69719934", "0.6834123", "0.62656295", "0.5999941", "0.5958614", "0.59329367", "0.59329367", "0.58683586", "0.58611995", "0.58611995", "0.58290493", "0.5777235", "0.56663704", "0.5637483", "0.5614177", "0.5613284", "0.5594398", "0.5585049", "0.5543975", "0.55404186", "0.554...
0.6531092
2
Tokenize words in rawtext document bodies and remove words that fail to meet word level and document level criteria.
def preprocess_post(self, post): # tokenize, clean, & tag part-of-speech for all words if self.document_level == 'postwise': doc_text = all_comments_from_post(post) # leave early if there's nothing there if doc_text == '': return [] token...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def processes_and_tokenize(raw_document):\n\ttokenizer = RegexpTokenizer(r'\\w+')\n\ttokens = tokenizer.tokenize(raw_document.lower())\t\t# tokens = nltk.word_tokenize(corpus.lower()) # without removing punctiation\n\n\t#remove stop words\n\tstop_words = set(nltk.corpus.stopwords.words('english'))\n\t#stop_words =...
[ "0.7752766", "0.7154092", "0.70913535", "0.7001883", "0.6915707", "0.68179244", "0.6788819", "0.67577565", "0.6710998", "0.66920584", "0.65268683", "0.6518144", "0.651129", "0.64875466", "0.6466916", "0.64421844", "0.64313835", "0.64138615", "0.64039904", "0.6402067", "0.6399...
0.58433676
71
Writes json str representation to file
def save_to_file(cls, list_objs): lis = [] if list_objs is None: js_dic = cls.to_json_string(lis) with open(cls.__name__ + ".json", encoding="utf-8", mode="w") as myFile: myFile.write(js_dic) else: for li in list_objs: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def write(self, _filepath=None):\n _json_txt = json.dumps(self.json_dict, indent=2)\n self._write_json_text(_json_txt, _filepath)", "def write_json(self, json_dict):\n content = json.dumps(json_dict)\n\n if isinstance(content, unicode):\n content = c...
[ "0.77162164", "0.770321", "0.7663152", "0.7663152", "0.7599637", "0.7382872", "0.73679096", "0.7360751", "0.7324941", "0.73094046", "0.730012", "0.729226", "0.72846794", "0.72742337", "0.72680956", "0.7262551", "0.72481966", "0.722942", "0.7221174", "0.7218707", "0.7210926", ...
0.0
-1
Provide an invalid name, to generate an error.
def testinvalidability(self): self.assertRaises(AbilityError, AmuletAbility, 'Invalid') self.assertRaises(AbilityError, AmuletAbility, '')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def name_error(name):\n\n if len(name) > MAX_NAME_LENGHT:\n raise InputError(description=\"Name cannot be more than 20 characters long\")", "def get_name_validation_error(name):\n return '' if name else accounts.REQUIRED_FIELD_NAME_MSG", "def test_nonreserved_name(self):\n try:\n ...
[ "0.83223426", "0.7834983", "0.75138867", "0.71544886", "0.7093176", "0.70450497", "0.6983303", "0.6933802", "0.69196695", "0.68907154", "0.687734", "0.6869101", "0.6778163", "0.6739356", "0.671653", "0.66625154", "0.6623231", "0.6606118", "0.65968317", "0.65895486", "0.657092...
0.0
-1
Ensure random abilities may be generated without error.
def testrandom(self): for i in range(100): AmuletAbility()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def testrandom(self):\n for i in range(100):\n WeaponAbility()", "def random_die():\n return randrange(1, 6)", "def test_insufficient_shuffle(self):\n self.deck._deal(1)\n with self.assertRaises(ValueError):\n self.deck.shuffle()", "def luck_check(chance):\n r...
[ "0.66446924", "0.6261142", "0.6225658", "0.61589783", "0.61494786", "0.61290914", "0.61236346", "0.61155415", "0.6106622", "0.60941434", "0.60484105", "0.6033411", "0.60260797", "0.60189956", "0.59546584", "0.59362406", "0.59291255", "0.59213823", "0.58713335", "0.5846206", "...
0.71204704
0
Provide an invalid ability name, to generate an error.
def testinvalidability(self): self.assertRaises(AbilityError, WeaponAbility, 'Invalid') self.assertRaises(AbilityError, WeaponAbility, '')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def name_error(name):\n\n if len(name) > MAX_NAME_LENGHT:\n raise InputError(description=\"Name cannot be more than 20 characters long\")", "def testinvalidability(self):\n self.assertRaises(AbilityError, AmuletAbility, 'Invalid')\n self.assertRaises(AbilityError, AmuletAbility, '')", "...
[ "0.7130872", "0.7018363", "0.67565966", "0.66510713", "0.6421172", "0.64166695", "0.6368105", "0.6341805", "0.6042316", "0.60069054", "0.599879", "0.598249", "0.59346604", "0.5926574", "0.58753926", "0.5838832", "0.58368623", "0.5808703", "0.5765288", "0.5763411", "0.57572013...
0.6850262
2
True if the types are the same.
def testduplicate(self): self.assertTrue(WeaponAbility('Guided').duplicate( WeaponAbility('Guided'))) self.assertFalse(WeaponAbility('Guided').duplicate( WeaponAbility('Changling'))) self.assertTrue(WeaponAbility('Animated', range=1).duplicate( ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _is_equal_same_type(self, other):\n return True", "def is_same(type1, type2):\n nake_type1 = remove_declarated(type1)\n nake_type2 = remove_declarated(type2)\n return nake_type1 == nake_type2", "def _values_of_same_type(self, val1, val2):\n if self.f_supports(val1) != self.f_supports...
[ "0.8008665", "0.7785032", "0.7587348", "0.74254", "0.73393667", "0.73319304", "0.72403914", "0.72091407", "0.71641517", "0.715613", "0.70784974", "0.70107186", "0.69841015", "0.6957904", "0.68234444", "0.680652", "0.67816615", "0.67545307", "0.6716219", "0.67131335", "0.67031...
0.0
-1
Ensure random abilities may be generated without error.
def testrandom(self): for i in range(100): WeaponAbility()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def testrandom(self):\n for i in range(100):\n AmuletAbility()", "def random_die():\n return randrange(1, 6)", "def test_insufficient_shuffle(self):\n self.deck._deal(1)\n with self.assertRaises(ValueError):\n self.deck.shuffle()", "def luck_check(chance):\n r...
[ "0.71204704", "0.6261142", "0.6225658", "0.61589783", "0.61494786", "0.61290914", "0.61236346", "0.61155415", "0.6106622", "0.60941434", "0.60484105", "0.6033411", "0.60260797", "0.60189956", "0.59546584", "0.59362406", "0.59291255", "0.59213823", "0.58713335", "0.5846206", "...
0.66446924
1
Calculate the volume of a sphere with radius r.
def sphere_volume(r): return 4/3. * math.pi * r ** 3
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sphere_volume(r):\n return (4/3) * 3.14159 * r**3", "def calcul_v_sphere(r):\n volume = 4/3 * math.pi * (r ** 3)\n return volume", "def sphere_volume(radius : number) -> number:\n volume = 4/3*(pi*radius*radius*radius)\n return volume", "def sphereVolume(radius):\n volume = (4 / 3) * ma...
[ "0.89431643", "0.8776244", "0.86990744", "0.8546791", "0.85032845", "0.82493275", "0.8208103", "0.7859043", "0.74497455", "0.7399191", "0.73894525", "0.7307988", "0.7204269", "0.71425915", "0.7116606", "0.6987146", "0.68633825", "0.67712337", "0.67578685", "0.6645747", "0.661...
0.895751
0
Validates the user's email address, given the verification token
def post(self): data = EmailAddressValidationSchema().load(request.json) email_lowercase = data["email"].lower() verification_token = data["verificationToken"] UserRegistrationService.validate_email_address_verification_token(email_lowercase, verification_token)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def verify_email(uid, token):\n return True", "def validate_email(self, token):\n decoded_token = manage_tokens.decode(token)\n if decoded_token is None:\n return {'error': 'Token is invalid'}\n\n self.user_in_db = User.users_db.get(self.email)\n if not self.user_in_db:\...
[ "0.76968575", "0.7643206", "0.7167939", "0.7090168", "0.7051217", "0.7026804", "0.70227796", "0.7012395", "0.7004058", "0.6945708", "0.692403", "0.68979686", "0.6817104", "0.68054706", "0.68007165", "0.6797659", "0.67840916", "0.67610574", "0.6718849", "0.66913974", "0.669088...
0.78256726
0
Authorization header should be Bearer
def post(self): current_user = get_jwt_identity() return { # Mark the token as un-fresh since we used the refresh token to regenerate this "accessToken": create_access_token(identity=current_user, fresh=False), "userId": current_user }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_headers(self):\n token = 'abc123'\n requests.get(self.url, auth=BearerAuth(token))\n self.assertEqual(httpretty.last_request().headers['Authorization'], 'Bearer {}'.format(token))", "def bearer_auth():\n authorization = request.headers.get(\"Authorization\")\n if not (authoriz...
[ "0.7509215", "0.70617145", "0.7015302", "0.69691384", "0.6932079", "0.6910918", "0.68873566", "0.68839264", "0.6850181", "0.6825606", "0.6764524", "0.67524415", "0.67397726", "0.6721312", "0.67162037", "0.67162037", "0.67152894", "0.66627115", "0.6660219", "0.6659196", "0.662...
0.0
-1
Creates an instance of this model from a dictionary
def from_dictionary(cls, dictionary): if dictionary is None: return None # Extract variables from the dictionary is_valid = dictionary.get('IsValid') browse_node_lookup_request = awsecommerceservice.models.browse_node_lookup_request.BrowseNodeLookupRe...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def from_dictionary(cls,\n dictionary):\n if dictionary is None:\n return None\n\n # Extract variables from the dictionary\n id = dictionary.get('id')\n name = dictionary.get('name')\n mtype = dictionary.get('type')\n usage_bytes = diction...
[ "0.83190626", "0.81680465", "0.81680465", "0.81198996", "0.80894077", "0.7979489", "0.79510856", "0.7923969", "0.78998214", "0.7894075", "0.788929", "0.7883757", "0.7883385", "0.7877541", "0.78598565", "0.78387827", "0.7804587", "0.7804587", "0.7804587", "0.7804587", "0.78045...
0.0
-1
Compute action given an observation.
def sample_action(self, obs, explore_prob): raise NotImplementedError
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def calculate_action(self, observation: str) -> str:\r\n pass", "def action(self, observation):\n return self.actor.get_action(observation)", "def get_action(self, obs):\n obs = torch.FloatTensor(obs).to(self.device)\n value_int, value_ext = self.ppo.critic(obs)\n action, pol...
[ "0.8158092", "0.8088064", "0.7352466", "0.71241003", "0.70951456", "0.70650077", "0.70396477", "0.6986538", "0.69285923", "0.6928472", "0.6920893", "0.6910616", "0.69062656", "0.6848041", "0.68418", "0.6838539", "0.6836452", "0.6836452", "0.6795647", "0.6783355", "0.6780099",...
0.0
-1
Compute action given an observation. This policy does not implement its own exploration strategy. Use PerStepSwitchPolicy instead to perform exploration.
def sample_action(self, obs, explore_prob): del explore_prob img = np.expand_dims(obs, 0) def objective_fn(samples): feed_dict = {self._state_ph: img, self._action_ph: samples} if self._include_timestep: feed_dict[self._step_ph] = self._timestep q_values = self._sess.run(self._qs,...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def step(self, obs, explore=False):\n action = self.policy(obs)\n # print('after policy',action)\n if self.discrete_action:\n if explore:\n action = gumbel_softmax(action, hard=True)\n # print('after gumbel',action)\n else:\n a...
[ "0.74876523", "0.72326714", "0.7215706", "0.7215706", "0.71454", "0.7111913", "0.71066445", "0.7051729", "0.7024447", "0.7021003", "0.7017943", "0.6918571", "0.68743795", "0.6756281", "0.6752831", "0.67412543", "0.67247653", "0.6690954", "0.6690225", "0.66877484", "0.6623449"...
0.6496987
29
Compute action given an observation. This policy does not implement its own exploration strategy. Use PerStepSwitchPolicy instead to perform exploration.
def sample_action(self, obs, explore_prob): del explore_prob img = np.expand_dims(obs, 0) feed_dict = {self._state_ph: img} if self._include_timestep: feed_dict[self._step_ph] = self._timestep action, q_values = self._sess.run([self._action, self._qs], f...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def step(self, obs, explore=False):\n action = self.policy(obs)\n # print('after policy',action)\n if self.discrete_action:\n if explore:\n action = gumbel_softmax(action, hard=True)\n # print('after gumbel',action)\n else:\n a...
[ "0.748616", "0.72339165", "0.7215414", "0.7215414", "0.7146144", "0.71135443", "0.7107211", "0.70522404", "0.702432", "0.7022483", "0.70204395", "0.69183385", "0.6874532", "0.6758334", "0.67533565", "0.6741973", "0.67248523", "0.66913277", "0.6691297", "0.6687853", "0.6623108...
0.63361007
38
Set the value of the APIKey input for this Choreo. ((required, string) The API Key provided by Xively.)
def set_APIKey(self, value): super(UpdateTriggerInputSet, self)._set_input('APIKey', value)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def SetAPIKey(self, api_key):\n self._api_key = api_key", "def SetAPIKey(self, api_key):\n self._api_key = api_key", "def SetAPIKey(self, api_key):\n self._analyzer.SetAPIKey(api_key)", "def api_key(self, api_key):\n if api_key is None:\n raise ValueError(\"Invalid value for `api_k...
[ "0.80909926", "0.80909926", "0.7966869", "0.75279796", "0.7426479", "0.74155474", "0.71802586", "0.7138681", "0.68723965", "0.67739195", "0.6772533", "0.6767673", "0.676049", "0.67024636", "0.66270036", "0.6617337", "0.6604224", "0.6527258", "0.64798075", "0.6461629", "0.6454...
0.6973158
8
Set the value of the ThresholdValue input for this Choreo. ((optional, string) Threshold that will cause the trigger to activate. Include input only if changing Threshold Value.)
def set_ThresholdValue(self, value): super(UpdateTriggerInputSet, self)._set_input('ThresholdValue', value)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def setThreshold(self, value):\n return self._set(threshold=value)", "def setThreshold(self, v):\n self._set(threshold=v)\n return self", "def setThreshold(self, v):\n self._set(threshold=v)\n return self", "def setThreshold(self, v):\n self._set(threshold=v)\n ...
[ "0.7035364", "0.5995165", "0.5995165", "0.5995165", "0.5995165", "0.5995165", "0.5991856", "0.586901", "0.5700665", "0.53603107", "0.52978474", "0.5290875", "0.52556384", "0.52308434", "0.5228519", "0.51740694", "0.51740694", "0.51740694", "0.5158728", "0.5143797", "0.5082036...
0.75535905
0
Set the value of the TriggerID input for this Choreo. ((required, integer) TriggerID for the trigger that you wish to update.)
def set_TriggerID(self, value): super(UpdateTriggerInputSet, self)._set_input('TriggerID', value)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def trigger_id(self, trigger_id):\n\n self._trigger_id = trigger_id", "def delete_trigger(self, trigger_id):\n self._delete(path=\"triggers/{}\".format(trigger_id))", "def get_trigger_by_id(self, trigger_id):\n return self.triggers[trigger_id]", "def trigger_id(self) -> pulumi.Input[str]...
[ "0.6884074", "0.5484074", "0.51305044", "0.49737403", "0.4899946", "0.48826936", "0.46575096", "0.44376594", "0.4368194", "0.43429962", "0.42614675", "0.4221972", "0.4156011", "0.415287", "0.4144462", "0.41385454", "0.4132832", "0.41177928", "0.41103038", "0.40706295", "0.405...
0.6217905
1
Test various retrieval utilities on a single list of Artifact.
def testGetFromSingleList(self): artifacts = [standard_artifacts.Examples()] artifacts[0].uri = '/tmp/evaluri' artifacts[0].split_names = '["eval"]' self.assertEqual(artifacts[0], artifact_utils.get_single_instance(artifacts)) self.assertEqual('/tmp/evaluri', artifact_utils.get_...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_read_artifact(self):\n pass", "def get_single_instance(artifact_list: List[Artifact]) -> Artifact:\n if len(artifact_list) != 1:\n raise ValueError('expected list length of one but got {}'.format(\n len(artifact_list)))\n return artifact_list[0]", "def test_get_experiment_artifact(s...
[ "0.662036", "0.62965786", "0.62030226", "0.60663354", "0.593072", "0.5918591", "0.58616775", "0.57673883", "0.5732222", "0.57250345", "0.57193136", "0.57103896", "0.56704307", "0.56461483", "0.5623771", "0.56043285", "0.558357", "0.5563329", "0.55472404", "0.5546737", "0.5538...
0.6868066
0
Tests whether a ship can be hit
def test_hit(self): ship = Ship(self.location) self.assertEqual(self.location, ship.location) self.assertEqual(1, ship.check_hit(self.hit)) self.assertEqual(1, len(ship.location))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_miss(self):\n ship = Ship([self.hit])\n self.assertEqual([self.hit], ship.location)\n self.assertEqual(0, ship.check_hit((1, 1)))\n self.assertEqual(1, len(ship.location))", "def is_ship_sunk(self, x, y):\n marker = self.markers[x][y]\n total_hits = self.ship_hi...
[ "0.7271281", "0.70827186", "0.704767", "0.7041984", "0.7026214", "0.6968032", "0.6933917", "0.68898654", "0.68886876", "0.6832401", "0.6804325", "0.6801222", "0.6788589", "0.67883235", "0.67757285", "0.6768699", "0.66971505", "0.66723", "0.666582", "0.6664523", "0.66624606", ...
0.7323437
0
Tests whether a ship can be sunk
def test_miss(self): ship = Ship([self.hit]) self.assertEqual([self.hit], ship.location) self.assertEqual(0, ship.check_hit((1, 1))) self.assertEqual(1, len(ship.location))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_ship_sunk(self, x, y):\n marker = self.markers[x][y]\n total_hits = self.ship_hits[marker]\n return total_hits == MarkerType.MAX_HITS[marker]", "def hit(self):\n\n self.units.pop()\n return (len(self.units) == 0) # Returns True if the ship has been sunk", "def test_not_uno...
[ "0.77089477", "0.73150784", "0.6462397", "0.64242303", "0.6321817", "0.6198491", "0.61904263", "0.61489", "0.6132915", "0.6125805", "0.6091741", "0.60851425", "0.5997678", "0.5992449", "0.59915113", "0.5986236", "0.59780484", "0.595476", "0.59477776", "0.5928106", "0.5882772"...
0.65631485
2
Tests whether a ship can be sunk
def test_sink(self): ship = Ship([self.hit]) self.assertEqual([self.hit], ship.location) self.assertEqual(2, ship.check_hit(self.hit)) self.assertEqual(0, len(ship.location))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_ship_sunk(self, x, y):\n marker = self.markers[x][y]\n total_hits = self.ship_hits[marker]\n return total_hits == MarkerType.MAX_HITS[marker]", "def hit(self):\n\n self.units.pop()\n return (len(self.units) == 0) # Returns True if the ship has been sunk", "def test_miss(se...
[ "0.7708459", "0.7315066", "0.656464", "0.6461968", "0.6423673", "0.6324279", "0.6198419", "0.61931795", "0.6151394", "0.6130129", "0.6127435", "0.6090667", "0.60864955", "0.59975857", "0.599281", "0.59924567", "0.5986668", "0.59775776", "0.59561455", "0.5949114", "0.59307766"...
0.5884427
21
Initializes the parameters with zeros, given the amount of rows
def init_zeros(cls, interferometers: int = 1) -> "Parameters": out_dict = {} for attrib in fields(cls): name = attrib.name out_dict.update({name: np.zeros((interferometers, 1))}) return cls(**out_dict)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, rows, cols, default_val=0):\n self.num_rows = rows\n self.num_cols = cols\n\n # Initialize the 2-dimensional array\n self.rows = [[default_val] * cols for _ in xrange(rows)]", "def __init__(self, num_rows):\r\n self.num_rows = num_rows\r\n\r\n # Make t...
[ "0.7425106", "0.74074197", "0.7367826", "0.7164664", "0.70657134", "0.7029008", "0.6996812", "0.69817567", "0.6932584", "0.68871754", "0.6770241", "0.6768955", "0.66740686", "0.66418904", "0.66325444", "0.6624293", "0.6614212", "0.66119784", "0.6595905", "0.65837973", "0.6577...
0.60659367
54
The event's start time, as a timezoneaware datetime object
def start(self): if self.start_time is None: time = datetime.time(hour=19, tzinfo=CET) else: time = self.start_time.replace(tzinfo=CET) return datetime.datetime.combine(self.date, time)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_datetime_start(self):\n return self.get_t_sect()['datetime_start']", "def start_time(self):\n # TODO: use pd.Timestamp instead\n return self.time[0].to_pydatetime()", "def get_start_time(self):\n start = datetime.strptime(\n self.get_handler().SOURCE_START_DATE.sp...
[ "0.76968586", "0.76729155", "0.7643306", "0.75934434", "0.7549188", "0.7539281", "0.7499669", "0.74902815", "0.744862", "0.7445907", "0.7349264", "0.7282488", "0.7249556", "0.7249556", "0.7249556", "0.7249556", "0.7249556", "0.7249556", "0.7249556", "0.7249556", "0.7235539", ...
0.78941786
0
Is true if the event only spans one day
def one_day(self): return self.end.date() == self.date
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_in_advent() -> bool:\n # Run the code from the 1st to the 24th\n return datetime.now(EST).day in range(1, 25) and datetime.now(EST).month == 12", "def runs_today(self,s_id,day):\n if self.schedule_keys[s_id][day]==1:\n return True\n else:\n return False", "def g...
[ "0.72662985", "0.6719103", "0.65884805", "0.6551146", "0.6338677", "0.63329256", "0.63131696", "0.6304339", "0.62870234", "0.62826914", "0.6255161", "0.6226396", "0.6218282", "0.6174885", "0.61583", "0.6103819", "0.6099032", "0.6082656", "0.60797435", "0.6077559", "0.6072566"...
0.77704716
0
Yield the next planned occurrences after the date "since" The `since` argument can be either a date or datetime onject. If not given, it defaults to the date of the last event that's already planned. If `n` is given, the result is limited to that many dates; otherwise, infinite results may be generated. Note that less ...
def next_occurrences(self, n=None, since=None): scheme = self.recurrence_scheme if scheme is None: return () db = Session.object_session(self) query = db.query(Event) query = query.filter(Event.series_slug == self.slug) query = query.order_by(desc(Event.date)...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_n_days_ahead(self, startdate, n, fmt=None):\n return startdate + datetime.timedelta(days=n)", "def limit(iterator, n=None):\n for i, v in enumerate(iterator):\n yield v\n if i + 1 == n:\n break", "def next_n(self, n, fast_forward=False):\n return list(it.islice...
[ "0.56236297", "0.55622554", "0.54129523", "0.537688", "0.5366716", "0.5216922", "0.5207121", "0.5206607", "0.51612425", "0.5151308", "0.50954014", "0.5094701", "0.49745113", "0.497114", "0.49553135", "0.4943986", "0.49304563", "0.4926645", "0.48990518", "0.48948643", "0.48934...
0.7174086
0
Compute a Forward problem given a model with geometry and sources.
def forward_problem(m): hm = om.HeadMat(m['geometry']) hm.invert() # invert in place (no copy) dsm = om.DipSourceMat(m['geometry'], m['dipsources']) return hm * dsm
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def forward(self, x):\n sources = list()\n new_sources = list()\n\n # apply lds to the initial image\n x_pool = self.lds(x)\n\n # apply vgg up to conv4_3\n for k in range(22):\n x = self.features[k](x)\n conv4_3_bn = self.ibn1(x)\n x_pool1_skip, x_...
[ "0.63526386", "0.61341417", "0.60225815", "0.59443873", "0.5940945", "0.5875347", "0.5855688", "0.5813345", "0.57249606", "0.5699427", "0.5691829", "0.5668313", "0.5632994", "0.56215024", "0.5613032", "0.55930996", "0.559111", "0.5573722", "0.55649126", "0.55364203", "0.55294...
0.6507115
0
Initialize the rnn with weights
def __init__(self,m,K): self.V = np.random.normal(0, 0.1, (K, m)) self.c = np.zeros((K, 1)) # bias vector, dimension (K,1), K is alphabet size self.W_h = np.random.normal(0, 0.1, (m, K)) self.U_h = np.random.normal(0, 0.1, (m, m)) self.b_h = np.zeros((m, 1)) self.W_z =...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _initialize_weights(self):\n pass", "def init_weights(self):\n # Initialize weights\n self.apply(self._init_weights)", "def init_weights(self):\n # Initialize weights\n self.apply(self._init_weights)\n # Tie weights if needed\n self.tie_weights()", "def in...
[ "0.7949611", "0.78432935", "0.7750923", "0.77438945", "0.76983297", "0.7688158", "0.7633917", "0.762798", "0.7592949", "0.7571514", "0.7499164", "0.74703896", "0.74461675", "0.7444622", "0.74277383", "0.7405834", "0.7402248", "0.73472536", "0.73350894", "0.73268205", "0.73175...
0.0
-1
converts a sequence of chars in a onehot matrix
def seq_to_ohm(alph_size,sequence,chars_with_indices): matrix=np.zeros((alph_size,len(sequence)),dtype=int) for c,char in enumerate(sequence): matrix[index_from_char(chars_with_indices, char ),c]+=1 return matrix
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def string_to_onehot(self, string_seq):\n char_list = list(string_seq)\n int_list = self.char_to_int(char_list)\n one_hot = np.zeros((len(self.unique_chars), len(int_list)))\n for i,int_elem in enumerate(int_list):\n one_hot[int_elem,i] = 1\n return one_hot", "def encode_one_hot(s...
[ "0.8195747", "0.8127224", "0.80316925", "0.7950268", "0.7944218", "0.78797424", "0.7874028", "0.7834406", "0.7828589", "0.78162706", "0.7815272", "0.78011477", "0.75761884", "0.7538689", "0.7519384", "0.75050235", "0.74859756", "0.7436319", "0.7429489", "0.7394532", "0.737658...
0.0
-1
This is a scalar version of torch.nn.functional.softshrink. x + lmb if x lmb
def soft_thresh(x: float, lmb: float) -> float: if x < lmb: return x + lmb elif x > lmb: return x - lmb else: return 0.0
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __call__(self, x):\n return self._pre_scale * tf.matmul(x, self._weight) + self._bias", "def forward(self, x: torch.Tensor) -> torch.Tensor:\r\n median = torch.median(x)\r\n\r\n global_threshold = torch.where(x < median, torch.tensor([0.]), x)\r\n maxpool = nn.MaxPool2d(7, stride=1, p...
[ "0.66817796", "0.64972174", "0.6297195", "0.6286024", "0.61570716", "0.61327577", "0.6095143", "0.608687", "0.6046658", "0.60248023", "0.5977711", "0.5962738", "0.59558153", "0.59422344", "0.5910144", "0.5898789", "0.5879085", "0.5868149", "0.5863746", "0.5849748", "0.5832442...
0.6194483
4
Called to calculate the physics constants that depend on the domain parameters. Override in subclasses.
def _calc_constants(self, *args, **kwargs): pass
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def initializeDomainCondition(self):\n print('Initialize the condition.')\n\n self.fluidPDF = np.zeros([self.typesFluids, self.ny, self.nx, 9])\n self.fluidsDensity = np.zeros([self.typesFluids, self.ny, self.nx])\n self.physicalVX = np.zeros([self.ny, self.nx])\n self.physicalVY...
[ "0.644704", "0.6170235", "0.6015385", "0.5919059", "0.58905286", "0.5856", "0.5823468", "0.57795954", "0.57375485", "0.5731141", "0.57282466", "0.5721401", "0.5719514", "0.57053113", "0.5670887", "0.56188464", "0.5615508", "0.560927", "0.5602172", "0.5582759", "0.55651283", ...
0.58926386
4
Update animation. Called by each render call. Skips certain number of simulation steps per frame to achieve 60 Hz output.
def _update_anim(self): if self._skip_frames > 1: # Do not render while _skip_frames is > 1 self._skip_frames -= 1 else: # Render frame self._visualization.taskMgr.step() # Calculate number of frames that need to be skipped self._sk...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def grid_animation_quick(self, frames, iterations=10, fps=0.02, figsize=(6, 6)):\r\n color_map = matplotlib.colors.ListedColormap(['white', 'black'])\r\n\r\n fig, ax = plt.subplots(figsize=figsize)\r\n\r\n for r in np.arange(0, iterations):\r\n ax.cla()\r\n ax.axes.grid(F...
[ "0.67353886", "0.6680484", "0.66650397", "0.66557145", "0.66444975", "0.6517887", "0.649021", "0.64420825", "0.64265084", "0.6239542", "0.6208433", "0.6200715", "0.6192603", "0.61721265", "0.6136987", "0.6074246", "0.60647804", "0.6064689", "0.60567117", "0.6033081", "0.59899...
0.7681746
0
Remove trailing company labels. Rule
def eliminate_company_labels(coname): company_eliminations = ('llp', 'llc', 'plc', 'limited', 'bv', 'gmbh', 'sa', 'inc') regex = re.compile('\W(' + '|'.join(company_eliminations) + ')\W?$') if len(coname.split(' ')) > 2: coname = regex.sub('', coname) return coname
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def label_rule_for_company(text: str) -> str:\n match = re.search(LABEL_SPECIFICATION[\"RE_COMPANY_PRIMARY\"], text)\n if not match:\n match = re.search(LABEL_SPECIFICATION[\"RE_COMPANY_SECONDARY\"], text)\n if match:\n text = match.group(\"label\").strip()\n if len(text) > 1:\n ...
[ "0.7212325", "0.6618307", "0.6285967", "0.6285967", "0.592417", "0.5615679", "0.55322164", "0.5510219", "0.5489993", "0.5487208", "0.548587", "0.5438026", "0.5347555", "0.53363866", "0.53179765", "0.53119785", "0.52540267", "0.51799643", "0.51637065", "0.5151782", "0.5139857"...
0.791277
0
Returns a cross entropy loss function for dnn to tree distillation.
def create_dnn_to_tree_cross_entropy_loss_fn(n_classes): def _dnn_to_tree_cross_entropy_loss(dnn_logits, tree_logits, example_weights): if n_classes == 2: return head_lib._log_loss_with_two_classes( # pylint: disable=protected-access labels=_logits_to_label_for_tree(dnn_logits, n_classes), ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def cross_entropy_loss():\n return nn.CrossEntropyLoss()", "def loss_fn(outputs, labels):\n return nn.CrossEntropyLoss()(outputs, labels)", "def loss_fn(pred: torch.Tensor, truth: torch.Tensor):\n\n if truth is None or pred is None:\n return None\n\n return CrossEntropyLoss()(pred, truth)", ...
[ "0.72981083", "0.66527283", "0.63461035", "0.6343372", "0.62758875", "0.6175301", "0.61639184", "0.61602235", "0.6094912", "0.60944366", "0.6080397", "0.6054565", "0.60013235", "0.6001276", "0.5999888", "0.59844524", "0.5914654", "0.58692825", "0.58543164", "0.58519185", "0.5...
0.72756386
1
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 = 637...
{ "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.81450045", "0.7863265", "0.76322985", "0.76064754", "0.75978696", "0.75965863", "0.75944835", "0.75720793", "0.75630087", "0.7555095", "0.7528691", "0.7517629", "0.7492963", "0.7467739", "0.7452678", "0.7434477", "0.73914117", "0.7357736", "0.73484355", "0.73318124", "0.73...
0.0
-1
scatterplot of color 'color' for the points of L
def plot_points(L, color): X = list() Y = list() for p in L: X.append(p[0]) Y.append(p[1]) plt.scatter(X, Y, c=color)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def scatterPlot2():\n N = 100\n x = np.random.rand(N)\n y = np.random.rand(N)\n colors = np.random.rand(N)\n\n plt.scatter(x, y, c=colors, alpha=0.5)\n plt.show()", "def plot_colors(rgb_colors):\n nr_dots = len(rgb_colors)\n\n dots = []\n x = []\n y = []\n for i in range(nr_dots)...
[ "0.72418195", "0.704063", "0.66666645", "0.6631968", "0.66311115", "0.66116434", "0.65151936", "0.6427394", "0.6364602", "0.63060814", "0.6267257", "0.62623537", "0.62345916", "0.6197361", "0.61629504", "0.6145779", "0.6065766", "0.604194", "0.6001138", "0.59884024", "0.59615...
0.81629497
0