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 |
|---|---|---|---|---|---|---|
Given a base value in CC, return smallest number of coins. | def value_to_coin(value):
if value:
if isinstance(value, int):
pp = value / PP
value %= PP
gp = value / GP
sp = value / SP
cp = value % SP
return dict(CP=cp, SP=sp, GP=gp, PP=pp)
elif isinstance(value, (dict, _SaverDict)):
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_min_num_coins_for_change(cents):\n coins = [100, 50, 25, 10, 5, 1] # american coins\n num_of_coins = 0\n for coin in coins:\n num_of_coins += (cents / coin)\n cents %= coin\n return num_of_coins",
"def least_coins_recursion(total, coins):\r\n\tif total == 0:\r\n\t\treturn 0\r\n\tif total < 0:\r... | [
"0.7098307",
"0.69258076",
"0.6530551",
"0.6354046",
"0.62146837",
"0.6210855",
"0.6031115",
"0.6028546",
"0.5904545",
"0.57984513",
"0.5761464",
"0.57115316",
"0.5679565",
"0.5665657",
"0.5604028",
"0.55672854",
"0.55668634",
"0.55370396",
"0.5510015",
"0.55079156",
"0.54948... | 0.0 | -1 |
Retrieve a value from the server's configuration. | def rpc_config_get(self, option_name):
if isinstance(option_name, (list, tuple)):
option_names = option_name
option_values = {}
for option_name in option_names:
if self.config.has_option(option_name):
option_values[option_name] = self.config.get(option_name)
return option_values
elif self.confi... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_value(key: str) -> str:\n Config.__get()\n assert Config.__config is not None\n return Config.__config.get(\"wsgi\", key)",
"def get(self, key):\n return self.config.get(key)",
"def value(self) -> str:\n return self._config.get('value')",
"def get_value(self, key):\... | [
"0.7686106",
"0.7437408",
"0.72495735",
"0.7239112",
"0.7213484",
"0.71756405",
"0.7124108",
"0.7023",
"0.6946537",
"0.689364",
"0.684209",
"0.6832623",
"0.682096",
"0.68111134",
"0.68055254",
"0.67589515",
"0.6745488",
"0.66956306",
"0.6653868",
"0.6624903",
"0.6622962",
"... | 0.0 | -1 |
Remove a campaign from the database and delete all associated information with it. | def rpc_campaign_delete(self, campaign_id):
session = db_manager.Session()
session.delete(db_manager.get_row_by_id(session, db_models.Campaign, campaign_id))
session.commit()
session.close()
return | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def delete(self, campaign_id):\n campaign = Campaign.query.get(campaign_id)\n if campaign is None:\n return {\"message\": \"Campaign could not be found.\"}, HTTPStatus.NOT_FOUND\n db.session.delete(campaign)\n db.sessioin.commit()\n return {}, HTTPStatus.NO_CONTENT",
... | [
"0.75317335",
"0.73644406",
"0.6866209",
"0.62215805",
"0.60151255",
"0.59096444",
"0.58450454",
"0.5824463",
"0.57142437",
"0.56937283",
"0.5593953",
"0.5564784",
"0.555866",
"0.55484724",
"0.5545144",
"0.5508091",
"0.5498451",
"0.5495502",
"0.5483054",
"0.5483054",
"0.54608... | 0.7772439 | 0 |
Gives the offer type of the application. Returns int The offer type. Only applicable for Google Play. | def offer_type(self):
return self.proto.offer[0].offerType | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def offer_type(self) -> Optional[pulumi.Input[str]]:\n return pulumi.get(self, \"offer_type\")",
"def database_account_offer_type(self) -> Optional[pulumi.Input[str]]:\n return pulumi.get(self, \"database_account_offer_type\")",
"def _app_type(self):\n return self._event['app_type']",
"d... | [
"0.7514057",
"0.6399391",
"0.63935006",
"0.5906249",
"0.58720934",
"0.5802066",
"0.57952327",
"0.56555456",
"0.5592985",
"0.5563496",
"0.5331469",
"0.5290089",
"0.5289609",
"0.5259258",
"0.5235913",
"0.5210611",
"0.52104414",
"0.52089137",
"0.52075654",
"0.5204691",
"0.520181... | 0.7724009 | 0 |
The apps version string. Returns str The version string as specified by the app. | def version(self):
return self.proto.details.appDetails.versionString | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def app_version(self) -> str:\n return pulumi.get(self, \"app_version\")",
"def get_version(self):\n data = self._get('app_version')\n return data['version']",
"def get_application_version(self):\n return self.connector.request('GET', '/app/version')",
"def getApplicationVersion(s... | [
"0.84194106",
"0.7729545",
"0.7685597",
"0.7613749",
"0.7276167",
"0.72415036",
"0.71115285",
"0.7091093",
"0.7089411",
"0.70834225",
"0.70565385",
"0.6973571",
"0.6938908",
"0.6935067",
"0.69168395",
"0.68988556",
"0.6818509",
"0.6807188",
"0.67998147",
"0.6793701",
"0.67747... | 0.77416867 | 1 |
Gives the date of the initial release of the app. Returns str The initial release date. | def release_date(self):
for item in self.proto.releaseInfo.item:
if item.label == 'Released on':
return item.container.value | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getApplicationBuildDate(self) -> unicode:\n ...",
"def build_date(self) -> str:\n data = \"none yet\"\n if self.STARTED:\n data = self.about.get(\"Build Date\", \"UNKNOWN\")\n return data",
"def starting_date(self):\n return datetime.date(2016, 1, 4)",
"def g... | [
"0.66959596",
"0.6686182",
"0.6495918",
"0.64554584",
"0.6352106",
"0.6332339",
"0.6263189",
"0.61033434",
"0.60531586",
"0.60531586",
"0.60525686",
"0.60474503",
"0.6030903",
"0.6025312",
"0.59614086",
"0.5931838",
"0.5931838",
"0.59256864",
"0.5888157",
"0.58409745",
"0.583... | 0.63889426 | 4 |
Returns float The average rating the app received. | def average_rating(self):
return self.proto.aggregateRating.starRating | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def average_rating(self):\n return ( self.rating_1 + self.rating_2 + self.rating_3) / 3",
"def average_rating(self):\n return ( self.rating_1 + self.rating_2 + self.rating_3 + self.rating_4 + self.rating_5 + self.rating_6 + self.rating_7) / 7",
"def average_rating(self):\n ratings = Attrac... | [
"0.8358991",
"0.824482",
"0.80866253",
"0.8029074",
"0.80143076",
"0.7823949",
"0.78073114",
"0.7648994",
"0.7570041",
"0.750162",
"0.74267447",
"0.7391154",
"0.73565596",
"0.73431575",
"0.73099506",
"0.72991014",
"0.7294641",
"0.7275034",
"0.7177551",
"0.7108502",
"0.7076555... | 0.8039683 | 3 |
Returns the category id, necessary for further queries. Returns str The id of this category. | def category(self):
return self.proto.category.id | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def category_id(self, category_id):\n\t\treturn CategoryId(self.connection, self.base_uri, category_id)",
"def get_knowledge_category_id(self):\n if not self.has_knowledge_category():\n raise IllegalState()\n else:\n return Id(self._my_map['knowledgeCategoryId'])",
"def get_... | [
"0.7957024",
"0.7739894",
"0.7572851",
"0.7135548",
"0.709893",
"0.7033919",
"0.70300376",
"0.6979551",
"0.6885765",
"0.68304116",
"0.68304116",
"0.667923",
"0.66686004",
"0.6553717",
"0.65489626",
"0.65444744",
"0.6535497",
"0.64884275",
"0.64548695",
"0.64548695",
"0.645486... | 0.7576843 | 2 |
Returns bool True if the app contains ads | def contains_ads(self):
return self.proto.details.appDetails.containsAds | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_ads(val):\n return ads_regexp.match(val)",
"def has_add_on(self) -> bool:\n return self.add_on_tag != 0",
"def is_adb_available(self):\n return self._adb_available",
"def has_upnp_devices(self) -> bool:\n return self._has_upnp_devices",
"def _use_portal_pad(self):\n se... | [
"0.62921673",
"0.6262078",
"0.61418194",
"0.6064024",
"0.58653116",
"0.584695",
"0.57384425",
"0.5711226",
"0.5705955",
"0.5705955",
"0.5686416",
"0.5637267",
"0.56007254",
"0.5583708",
"0.55797976",
"0.55773246",
"0.5568501",
"0.5566554",
"0.5531575",
"0.5507112",
"0.5490636... | 0.8963227 | 0 |
Returns the category id, necessary for further queries. Returns str The id of this category. | def id(self):
return self.proto.id | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def category_id(self, category_id):\n\t\treturn CategoryId(self.connection, self.base_uri, category_id)",
"def get_knowledge_category_id(self):\n if not self.has_knowledge_category():\n raise IllegalState()\n else:\n return Id(self._my_map['knowledgeCategoryId'])",
"def cate... | [
"0.7957024",
"0.7739894",
"0.7576843",
"0.7572851",
"0.7135548",
"0.709893",
"0.7033919",
"0.70300376",
"0.6979551",
"0.6885765",
"0.68304116",
"0.68304116",
"0.667923",
"0.66686004",
"0.6553717",
"0.65489626",
"0.65444744",
"0.6535497",
"0.64884275",
"0.64548695",
"0.6454869... | 0.0 | -1 |
The human readable name of the category. Returns str A human readable form of the category name. | def name(self):
return self.proto.name | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def category_name(self):\n return self.category.name",
"def get_name(self):\n return self.category_name",
"def name(self) -> str:\n return str(self.category.value)",
"def get_category_name(self):\n return self._ctx.get(\"name\", self._ctx[\"id\"])",
"def category_name(self):\n ... | [
"0.8804105",
"0.86733156",
"0.85568994",
"0.85152245",
"0.83472496",
"0.78084576",
"0.77386546",
"0.77072895",
"0.76871514",
"0.7673673",
"0.7582733",
"0.7577334",
"0.7577334",
"0.7569275",
"0.73721707",
"0.73616827",
"0.73448443",
"0.7306008",
"0.7280167",
"0.7057782",
"0.69... | 0.0 | -1 |
Sets the text of this WhatsApp. | def text(self, text):
self._text = text | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_text(self, text):\n\n self.text = text",
"def set_text(self, text):\n self.set_text_f(\"%s\", text)",
"def set_text(self, texto):\n self.entry.set_text(texto)",
"def SetText(self, text):\r\n\r\n self._text = text",
"def set_text(self):\n pass",
"def set_text(sel... | [
"0.7207153",
"0.7173092",
"0.7096333",
"0.69386905",
"0.69361186",
"0.68019867",
"0.6734218",
"0.6646008",
"0.6607725",
"0.659743",
"0.65797764",
"0.6573116",
"0.6572871",
"0.6492036",
"0.64742893",
"0.6439881",
"0.6406108",
"0.63823074",
"0.636822",
"0.6367489",
"0.63507855"... | 0.6562481 | 16 |
Returns true if both objects are equal | def __eq__(self, other):
if not isinstance(other, WhatsApp):
return False
return self.to_dict() == other.to_dict() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __eq__(self, other):\n return are_equal(self, other)",
"def __eq__(self, other):\n return are_equal(self, other)",
"def __eq__(self,other):\n try: return self.object==other.object and isinstance(self,type(other))\n except: return False",
"def __eq__(self, other):\n if i... | [
"0.808826",
"0.808826",
"0.8054592",
"0.79827315",
"0.79666996",
"0.79666996",
"0.79666996",
"0.79666996",
"0.79666996",
"0.79666996",
"0.79666996",
"0.79666996",
"0.79666996",
"0.79666996",
"0.79666996",
"0.79666996",
"0.79666996",
"0.79666996",
"0.79666996",
"0.79666996",
"... | 0.0 | -1 |
Returns true if both objects are not equal | def __ne__(self, other):
if not isinstance(other, WhatsApp):
return True
return self.to_dict() != other.to_dict() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __ne__(self, other: object) -> bool:\n if self.__eq__(other):\n return False\n return True",
"def __ne__(self, other: object) -> bool:\n return not self.__eq__(other)",
"def __ne__(self, other) -> bool:\n return not self.__eq__(other)",
"def __eq__(self, other):\n ... | [
"0.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.8042487",
"0.8042487",
"0.8042487",
"0.8042487",
"0.8042487",
"0.8042487",
"0.8042487",
... | 0.0 | -1 |
Get player's opponent piece. | def opponent(player):
return BLACK if player is WHITE else WHITE | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getOpponent(self):\n return self.__opponent",
"def get_opponent(self):\n for cell in self.__state.board.find_workers():\n player = self.__state.board.get_player_id(cell[0], cell[1])\n if not player == self.__pid:\n return player",
"def opponent(self, playe... | [
"0.74934787",
"0.726481",
"0.70941144",
"0.705222",
"0.6878318",
"0.6792261",
"0.6679694",
"0.6642816",
"0.6615735",
"0.65494627",
"0.65365016",
"0.63923645",
"0.6374027",
"0.6374027",
"0.6351002",
"0.63192064",
"0.6318036",
"0.6273041",
"0.6266804",
"0.6251529",
"0.6209029",... | 0.70421046 | 4 |
Compute player's score (number of player's pieces minus opponent's). | def score(player, board):
mine, theirs = 0, 0
opp = Othello.opponent(player)
for sq in Othello.squares():
piece = board[sq]
if piece == player: mine += 1
elif piece == opp: theirs += 1
return mine - theirs | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def score(self,player, board):\r\n numPlayer = 0\r\n numOpp = 0\r\n for i in self.squares():\r\n if board[i] == player:\r\n numPlayer+= SQUARE_WEIGHTS[i]\r\n else:\r\n numOpp+=SQUARE_WEIGHTS[i]\r\n return numPlayer-numOpp",
"def scor... | [
"0.784625",
"0.7710007",
"0.75956506",
"0.7558946",
"0.7464693",
"0.72692615",
"0.72642595",
"0.71922314",
"0.7175388",
"0.70766324",
"0.70610696",
"0.70195866",
"0.6969006",
"0.69263244",
"0.691399",
"0.68988675",
"0.6897329",
"0.6882737",
"0.68766284",
"0.6858876",
"0.68509... | 0.7666332 | 2 |
Compute player's score (number of player's pieces minus opponent's). | def value(self):
black, white = 0, 0
for sq in Othello.squares():
piece = self.__board[sq]
if piece == BLACK: black += 1
elif piece == WHITE: white += 1
if black == white:
return 0.5
elif black > white:
return 1
else:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def score(self,player, board):\r\n numPlayer = 0\r\n numOpp = 0\r\n for i in self.squares():\r\n if board[i] == player:\r\n numPlayer+= SQUARE_WEIGHTS[i]\r\n else:\r\n numOpp+=SQUARE_WEIGHTS[i]\r\n return numPlayer-numOpp",
"def scor... | [
"0.7846523",
"0.7710931",
"0.7666829",
"0.7595588",
"0.7559227",
"0.7464418",
"0.72697014",
"0.72657835",
"0.71916205",
"0.71763116",
"0.7075533",
"0.70615876",
"0.7019504",
"0.6969979",
"0.69268054",
"0.69131845",
"0.6898099",
"0.68971574",
"0.68836087",
"0.6877589",
"0.6859... | 0.0 | -1 |
Create and return the application object. | def create():
return App() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def app():\n app = create_app()\n return app",
"def get_app(self):\n return Application()",
"def app():\n return create_app()",
"def create_app(self):\n raise NotImplementedError",
"def app(self):\n if self._application is None:\n self._application = Application(cli... | [
"0.833403",
"0.83266336",
"0.81034535",
"0.8033304",
"0.78460824",
"0.78368175",
"0.77894855",
"0.76857483",
"0.758966",
"0.75700176",
"0.74389625",
"0.74244946",
"0.7359503",
"0.7355711",
"0.7342689",
"0.7329273",
"0.7323484",
"0.7309822",
"0.73031765",
"0.72874147",
"0.7285... | 0.8040159 | 3 |
Create and return the inner flask app for debug. | def create_for_debug():
app = App()
return app.flask_app | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def app():\n return create_app()",
"def app():\n app = create_app()\n return app",
"def create_app():\n\n config = config_by_name[os.getenv('APP_SETTINGS', 'dev')]\n flask_app = Flask(__name__, static_folder=None, instance_relative_config=True)\n flask_app.config.from_object(config)\n with... | [
"0.7934648",
"0.7905424",
"0.7794434",
"0.77692395",
"0.7676983",
"0.7617568",
"0.76171577",
"0.7600114",
"0.7595872",
"0.7592759",
"0.75790256",
"0.7564375",
"0.7560357",
"0.75455666",
"0.7485307",
"0.74738944",
"0.746802",
"0.74493796",
"0.7444408",
"0.74278665",
"0.7426678... | 0.8629217 | 0 |
Perform actions that setup the necessary resources for testing. The following resources are created/defined during the setup Uses server behaviors to create active server. Adds server id to resources with the function to delete_server. | def setUpClass(cls):
super(ServerMetadataTest, cls).setUpClass()
server_response = cls.server_behaviors.create_active_server()
cls.server = server_response.entity
cls.resources.add(cls.server.id, cls.servers_client.delete_server) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def setUp(self):\n server.Inventory.remove_all()\n server.Inventory(0, \"shampoo\", 2, 'new').save()\n server.Inventory(0, \"conditioner\", 5, 'new').save()\n self.app = server.app.test_client()",
"def setUp(self):\n self.test_resource = Resource(name='Test', slug='test', descr... | [
"0.65351105",
"0.65286815",
"0.6386545",
"0.6316922",
"0.6080039",
"0.6072419",
"0.60629815",
"0.6031055",
"0.6023276",
"0.60172415",
"0.60131717",
"0.59567046",
"0.5906588",
"0.59025794",
"0.5891258",
"0.5872336",
"0.5867079",
"0.5856256",
"0.5848851",
"0.5839366",
"0.580956... | 0.73198396 | 0 |
Create a dictionary of metadata and sets it to the server. The following calls the BaseTestFixture setUp and then using cloudcafe's server_client, sets the server that was created in the setUpClass with the metadata keys meta_key_1 and meta_key_2 with values meta_value_1 and meta_value_2 respectively. | def setUp(self):
super(ServerMetadataTest, self).setUp()
self.meta = {'meta_key_1': 'meta_value_1',
'meta_key_2': 'meta_value_2'}
self.servers_client.set_server_metadata(self.server.id, self.meta) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_set_server_metadata(self):\n meta = {'meta1': 'data1'}\n server_response = self.server_behaviors.create_active_server(\n metadata=meta)\n server = server_response.entity\n self.resources.add(server.id, self.servers_client.delete_server)\n\n new_meta = {'meta2'... | [
"0.7079258",
"0.681381",
"0.6511857",
"0.6377739",
"0.5980337",
"0.5856424",
"0.5846849",
"0.57888466",
"0.577384",
"0.5653016",
"0.5651883",
"0.5615507",
"0.55337495",
"0.5517563",
"0.5509677",
"0.54771173",
"0.5438862",
"0.5434017",
"0.5411187",
"0.54079676",
"0.5401769",
... | 0.8143902 | 0 |
Set server metadata item using meta_key_3 to set value meta_value_3. Will call the set_server_metadata_item from cloudcafe's server client passing in the server's id created in setup with meta_key_3 as the meta data key and meta_value_3 as the metadata value. | def test_add_new_server_metadata_item(self):
metadata_response = self.servers_client.set_server_metadata_item(
self.server.id, 'meta_key_3', 'meta_value_3')
metadata = metadata_response.entity
self.assertEqual(200, metadata_response.status_code)
self.assertEqual(metadata.get(... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_set_server_metadata_item(self):\n metadata_response = self.servers_client.set_server_metadata_item(\n self.server.id, 'meta_key_2', 'nova')\n metadata = metadata_response.entity\n self.assertEqual(200, metadata_response.status_code)\n self.assertEqual(metadata.get('m... | [
"0.75276375",
"0.69451624",
"0.69307154",
"0.64831096",
"0.64511716",
"0.64271784",
"0.6112588",
"0.59101856",
"0.59090704",
"0.58051574",
"0.57365304",
"0.57140785",
"0.57140785",
"0.56822145",
"0.5658578",
"0.56428045",
"0.5623683",
"0.5559285",
"0.55583364",
"0.55481404",
... | 0.7147524 | 1 |
Updates the internal state and returns the GRU outputs. | def __call__(self, h, x):
h_list = []
h = split_axis.split_axis(h, self.num_layers, 1, True)
h_curr = x
for layer, h in six.moves.zip(self, h):
h_curr = layer(h, h_curr)
h_list.append(h_curr)
return concat.concat(h_list, 1) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def GRU(previous_hidden_state, x):\n # R Gate\n r = tf.sigmoid(tf.matmul(x, Wr) + \\\n tf.matmul(previous_hidden_state, Ur) + br)\n # U Gate\n u = tf.sigmoid(tf.matmul(x, Wu) + \\\n tf.matmul(previous_hidden_state, Uu) + bu)\n # Final Memory cell\n ... | [
"0.6834887",
"0.6223236",
"0.5793222",
"0.579012",
"0.57654935",
"0.57362205",
"0.5733896",
"0.5699114",
"0.5679325",
"0.56345767",
"0.56256294",
"0.5616174",
"0.55828387",
"0.5550025",
"0.5486144",
"0.54782",
"0.54219085",
"0.5415491",
"0.54035795",
"0.5349474",
"0.5346676",... | 0.0 | -1 |
Updates the internal state and returns the GRU outputs. | def __call__(self, x, top_n=None):
if top_n is None:
top_n = self.num_layers
h_list = []
h_curr = x
for layer in self:
h_curr = layer(h_curr)
h_list.append(h_curr)
return concat.concat(h_list[-top_n:], 1) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def GRU(previous_hidden_state, x):\n # R Gate\n r = tf.sigmoid(tf.matmul(x, Wr) + \\\n tf.matmul(previous_hidden_state, Ur) + br)\n # U Gate\n u = tf.sigmoid(tf.matmul(x, Wu) + \\\n tf.matmul(previous_hidden_state, Uu) + bu)\n # Final Memory cell\n ... | [
"0.68354136",
"0.6223677",
"0.57916784",
"0.5789298",
"0.5766589",
"0.57344496",
"0.5732309",
"0.5699052",
"0.5677744",
"0.5633887",
"0.5625017",
"0.5617381",
"0.55842775",
"0.5551164",
"0.54873455",
"0.5477848",
"0.5420695",
"0.5416871",
"0.5402832",
"0.5351497",
"0.53448343... | 0.0 | -1 |
Extracts Wlength subsequences from list of onehot coded numpy sequences. Filters away subsequences overlapping invalid letters. | def get_onehot_subsequences(seqs, W):
subseqs = [[seq[:, i:i+W] for i in range(seq.shape[1]-W+1)]
for seq in seqs]
subseqs = list(chain(*subseqs))
subseqs = np.array(subseqs, dtype=np.uint8)
# filter away subsequences containing invalid letters
subseqs = subseqs[subseqs.sum(axis=(-1,... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def convert_one_hot(sequence, max_length=None):\n\n one_hot_seq = []\n for seq in sequence:\n seq = seq.upper()\n seq_length = len(seq)\n one_hot = np.zeros((4,seq_length))\n index = [j for j in range(seq_length) if seq[j] == 'A']\n one_hot[0,index] = 1\n index = [j ... | [
"0.58044124",
"0.5790274",
"0.57828844",
"0.57602966",
"0.5753247",
"0.5577173",
"0.55446005",
"0.55141574",
"0.5495642",
"0.54537237",
"0.5429283",
"0.53880274",
"0.5365945",
"0.5361754",
"0.53434074",
"0.534188",
"0.5330425",
"0.530101",
"0.524592",
"0.522985",
"0.522985",
... | 0.7818618 | 0 |
Set a value to the default value field. | async def save(self, category: str, key: str, value: any = None) -> None:
async with self.lock:
await self.storage.save(category, key, value)
try:
await self.cache.save(category, key, value)
except KeyError:
await self.set_category_cache(categ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def default(self, default):\n\n self._set_field(\"value\", default)",
"def set_value_to_default(self):\n self.setValue(self.default_value)",
"def default_value(self, default_value):\n\n self._default_value = default_value",
"def default_value(self, default_value):\n\n self._defaul... | [
"0.8779659",
"0.85444957",
"0.84207463",
"0.84207463",
"0.84207463",
"0.8336261",
"0.82971627",
"0.8248145",
"0.8235928",
"0.78229636",
"0.76896775",
"0.7598059",
"0.7531874",
"0.75219864",
"0.7491882",
"0.7438307",
"0.73879236",
"0.73678184",
"0.73588204",
"0.7180897",
"0.71... | 0.0 | -1 |
Return a config object with good defaults for testing. | def default_config():
config = Config()
config.TerminalInteractiveShell.colors = 'NoColor'
config.TerminalTerminalInteractiveShell.term_title = False,
config.TerminalInteractiveShell.autocall = 0
f = tempfile.NamedTemporaryFile(suffix=u'test_hist.sqlite', delete=False)
config.HistoryManager.hist... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def config() -> Config:\n return Config()",
"def config():\n return Config()",
"def config():\n return Config()",
"def _default_config(cls):\n return dict()",
"def get_config_defaults(self): # pylint: disable=R0201\n return {}",
"def get_config():\n config = dict(\n name=\"defau... | [
"0.7767758",
"0.7641374",
"0.7641374",
"0.74754703",
"0.741105",
"0.73707324",
"0.73380303",
"0.72893995",
"0.72521824",
"0.7229726",
"0.7229726",
"0.72162116",
"0.72087854",
"0.72087854",
"0.7176298",
"0.71517456",
"0.713175",
"0.712384",
"0.70697457",
"0.7063332",
"0.704718... | 0.0 | -1 |
Return appropriate IPython command line name. By default, this will return a list that can be used with subprocess.Popen, for example, but passing `as_string=True` allows for returning the IPython command as a string. | def get_ipython_cmd(as_string=False):
ipython_cmd = [sys.executable, "-m", "IPython"]
if as_string:
ipython_cmd = " ".join(ipython_cmd)
return ipython_cmd | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_cli_string():\n return os.path.basename(sys.argv[0]) + \" \" + \" \".join(sys.argv[1:])",
"def cli_get_process_title():\n raise NotImplementedError()",
"def name(self):\n module_filepath = inspect.getfile(type(self))\n module_filename = os.path.basename(module_filepath)\n com... | [
"0.5910438",
"0.55176014",
"0.5498984",
"0.5423844",
"0.5423365",
"0.5213965",
"0.5163156",
"0.5121577",
"0.51157314",
"0.50861466",
"0.50668955",
"0.50530684",
"0.504859",
"0.50320584",
"0.50269556",
"0.49911642",
"0.49908638",
"0.49802488",
"0.49360868",
"0.49300075",
"0.49... | 0.7596549 | 0 |
Initialize the filesystem for the root path. | def __init__(self, root, mount, format='wav', use_tempfile=False, cache_cue=True, verbose=False):
self.root = os.path.realpath(root)
self.mount = os.path.realpath(mount)
self.rwlock = threading.RLock()
self._open_subtracks = {}
self._format = format
self._verbose = verbos... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self, rootPath=None):\n self.rootPath = rootPath or '.'",
"def __init__(self, root_path):\r\n self.root_path = root_path\r\n if not os.path.exists(root_path):\r\n os.makedirs(root_path)",
"def __init__(self, root_path):\n self._root = root_path\n if not os.pat... | [
"0.72353077",
"0.6930624",
"0.6848598",
"0.6631195",
"0.65945923",
"0.6564515",
"0.6546062",
"0.64292413",
"0.64292413",
"0.64099646",
"0.6320109",
"0.6301201",
"0.6281154",
"0.62626517",
"0.6246272",
"0.6246272",
"0.62378716",
"0.6234741",
"0.6223345",
"0.6211624",
"0.620334... | 0.5766607 | 42 |
Testing the subtract method of the calculator | def test_answer_subtract():
calc = Calculator()
calc.subtract_number(5)
assert calc.get_result() == -5 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_subtraction():\n assert calculator.subtract(7, 3) == 4\n assert calculator.subtract(7.0, 3.0) == 4.0\n assert calculator.subtract(7, -3) == 10\n assert calculator.subtract(7.0, -3.0) == 10.0",
"def test_calculator_subtract():\n calc = Calculator()\n calc.subtract(1)\n assert calc.ge... | [
"0.8693571",
"0.8651895",
"0.8305262",
"0.82759595",
"0.8261573",
"0.82330716",
"0.82330716",
"0.821264",
"0.8192774",
"0.8152954",
"0.8083025",
"0.80597436",
"0.7985497",
"0.7983098",
"0.77423507",
"0.7734247",
"0.7657529",
"0.75747967",
"0.7517118",
"0.7416459",
"0.7376896"... | 0.85075855 | 2 |
Testing the subtract method of the calculator | def test_spam_subtract():
calc = Calculator()
calc.subtract_number(5)
assert calc.get_result() == -5 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_subtraction():\n assert calculator.subtract(7, 3) == 4\n assert calculator.subtract(7.0, 3.0) == 4.0\n assert calculator.subtract(7, -3) == 10\n assert calculator.subtract(7.0, -3.0) == 10.0",
"def test_calculator_subtract():\n calc = Calculator()\n calc.subtract(1)\n assert calc.ge... | [
"0.8694137",
"0.8652152",
"0.85081834",
"0.83050925",
"0.82767653",
"0.82625127",
"0.8233758",
"0.8233758",
"0.8193318",
"0.81525505",
"0.8082341",
"0.80599314",
"0.79866475",
"0.7983902",
"0.7744004",
"0.77339315",
"0.7656863",
"0.7575785",
"0.7517628",
"0.74160206",
"0.7377... | 0.82130766 | 8 |
load pretraining weights except the layers in self.skip_layers into memary the input weights is a dicttype data, each key is the name of a layer, such as "conv1", "fc1"m etc | def load_initial_weights(self, session, SKIP_LAYER=[]):
if SKIP_LAYER:
self.SKIP_LAYER = SKIP_LAYER
layer_params = np.load(self.WEIGHTS_PATH, encoding = "latin1").item()
# Loop over all layer names stored in the weights dict
for op_name in layer_params:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def init_weights(self, pretrained=None):\n # Do not initialize the conv layers\n # to follow the original implementation\n if isinstance(pretrained, str):\n from mmdet3d.utils import get_root_logger\n logger = get_root_logger()\n load_checkpoint(self, pretraine... | [
"0.72316885",
"0.7037991",
"0.69763565",
"0.69054043",
"0.67907304",
"0.67870134",
"0.6782275",
"0.6771557",
"0.6718321",
"0.67010576",
"0.66778404",
"0.66609836",
"0.6642679",
"0.66256386",
"0.6612871",
"0.65368205",
"0.6526203",
"0.652577",
"0.65116435",
"0.65115124",
"0.65... | 0.72738856 | 0 |
Convert time object into a humanreadable format | def get_readable_time(delta):
_m, _s = divmod(delta.seconds, 60)
_h, _m = divmod(_m, 60)
_d = delta.days
if _d > 0:
run_time = "{}d {}h".format(_d, _h)
elif _h > 0:
run_time = "{}h {}m".format(_h, _m)
elif _m > 0:
run_time = "{}m {}s".f... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_time_human_readable():\n return time.strftime(\"%A, %H:%M\")",
"def _time_to_pretty_string(time_object: time) -> str:\n if time_object.second != 0:\n pretty_format = \"%I:%M:%S %p\"\n elif time_object.minute != 0:\n pretty_format = \"%I:%M %p\"\n elif time_object.minute is not N... | [
"0.78759503",
"0.7685939",
"0.74415135",
"0.73832643",
"0.73051375",
"0.7155977",
"0.712031",
"0.70490885",
"0.69938296",
"0.69846195",
"0.6969937",
"0.69694453",
"0.6959201",
"0.6959201",
"0.6955133",
"0.6950612",
"0.69099796",
"0.6878059",
"0.6874713",
"0.6866273",
"0.68247... | 0.0 | -1 |
Convert class labels from scalars to onehot vectors. | def DenseToOneHot(labels_dense, num_classes):
num_labels = labels_dense.shape[0]
index_offset = np.arange(num_labels) * num_classes
labels_one_hot = np.zeros((num_labels, num_classes))
labels_one_hot.flat[index_offset + labels_dense.ravel()] = 1
return labels_one_hot | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def one_hot(labels, classes=None):\n return K.utils.to_categorical(labels, classes)",
"def one_hot(labels, classes=None):\n\n one_hot_ = K.utils.to_categorical(labels, classes)\n return(one_hot_)",
"def to_onehot(labels: torch.Tensor, num_classes: int) -> torch.Tensor:\n if len(labels.size()) == 1:... | [
"0.8250402",
"0.807683",
"0.80523187",
"0.7977843",
"0.7908335",
"0.7900327",
"0.7892233",
"0.7869711",
"0.7849721",
"0.7849721",
"0.7826951",
"0.7826122",
"0.77677035",
"0.7765413",
"0.77540547",
"0.77540547",
"0.77540547",
"0.77489346",
"0.7742955",
"0.7737176",
"0.77226317... | 0.7469378 | 49 |
Get the label for the "this_month" option. Defaults to ``This month`` (translatable). | def get_this_month_label(self):
return gettext_lazy('This month') | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_this_year_label(self):\n return gettext_lazy('This year')",
"def monthname(self):\n return self.strftime(\"%B\")",
"def get_this_week_label(self):\n return gettext_lazy('This week')",
"def this_month(self):\n if self.time.month != datetime.datetime.now().month or self._thi... | [
"0.67461526",
"0.6745327",
"0.65667117",
"0.64267904",
"0.639726",
"0.6371888",
"0.61094856",
"0.60647357",
"0.60584813",
"0.6057885",
"0.6057885",
"0.6057885",
"0.6057885",
"0.6057885",
"0.6057885",
"0.6057885",
"0.60568404",
"0.6048678",
"0.5997982",
"0.5997982",
"0.599093"... | 0.8710035 | 0 |
Get the label for the ``null`` option. | def get_is_null_label(self):
return pgettext_lazy('listfilter AbstractDateTime', 'Has no value') | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_label():\n inp = option_text('Input label name (leave blank for no label):')\n add_to_collected('label', inp)\n OPTIONS['label'] = inp\n return",
"def label(self) -> Optional[pulumi.Input[str]]:\n return pulumi.get(self, \"label\")",
"def label(self) -> Optional[pulumi.Input[str]]:\n... | [
"0.6987267",
"0.6929007",
"0.6929007",
"0.6929007",
"0.6929007",
"0.6929007",
"0.6929007",
"0.6929007",
"0.6811257",
"0.6725421",
"0.6725421",
"0.669977",
"0.66710705",
"0.6656181",
"0.6654675",
"0.6559638",
"0.6539041",
"0.6533459",
"0.64990604",
"0.64774597",
"0.6459351",
... | 0.6747196 | 9 |
Get the label for the ``not null`` option. | def get_is_not_null_label(self):
return pgettext_lazy('listfilter AbstractDateTime', 'Has value') | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def label(self) -> Optional[pulumi.Input[str]]:\n return pulumi.get(self, \"label\")",
"def label(self) -> Optional[pulumi.Input[str]]:\n return pulumi.get(self, \"label\")",
"def label(self) -> Optional[pulumi.Input[str]]:\n return pulumi.get(self, \"label\")",
"def label(self) -> Optio... | [
"0.7148072",
"0.7148072",
"0.7148072",
"0.7148072",
"0.7148072",
"0.7148072",
"0.7148072",
"0.69325954",
"0.69324076",
"0.6797324",
"0.671225",
"0.671225",
"0.6674225",
"0.6579059",
"0.6552098",
"0.65453774",
"0.65453774",
"0.65453774",
"0.65453774",
"0.6494784",
"0.6455107",... | 0.6964981 | 7 |
Filter so that only values that are NULL is included. Must be overridden in subclasses. | def filter_is_null(self, queryobject):
raise NotImplementedError() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def filter_is_not_null(self, queryobject):\n raise NotImplementedError()",
"def filter_null(item, keep_null=False, null_vals=None):\n\n if item[0] == 0:\n keep = True\n else:\n keep = bool(item[0])\n\n if null_vals and str(item[0]) in null_vals and keep:\n keep = False\n keep ^= keep_null\n\n... | [
"0.7157909",
"0.70512384",
"0.6998318",
"0.6880553",
"0.6783669",
"0.66334957",
"0.64363253",
"0.6347701",
"0.6273366",
"0.6253232",
"0.6229983",
"0.620238",
"0.6162813",
"0.61055386",
"0.60992247",
"0.60986084",
"0.60942054",
"0.6070224",
"0.6057943",
"0.604139",
"0.60404724... | 0.73535377 | 0 |
Get the ordering options must be overridden in subclasses. You must override this instead of ``get_choices()``. Should return a list of ``(value, options)`` pairs where | def get_ordering_options(self):
raise NotImplementedError() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sorted_options(sort_options):\n return [\n {\n \"title\": v[\"title\"],\n \"value\": (\n \"-{0}\".format(k)\n if v.get(\"default_order\", \"asc\") == \"desc\"\n else k\n ),\n }\n for k, v in sorted(\n ... | [
"0.696246",
"0.68591285",
"0.6651788",
"0.66371727",
"0.6512867",
"0.6468735",
"0.63886184",
"0.6329252",
"0.6320827",
"0.6293886",
"0.6263882",
"0.6263725",
"0.6226764",
"0.62134695",
"0.6211805",
"0.61705923",
"0.61619234",
"0.6156261",
"0.6153663",
"0.6093353",
"0.6075026"... | 0.7942253 | 0 |
Return the `Group` with the given id. | def get_group(self, group_id):
return Group(group_id, self.user_id, self.site_id) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getGroupById(self, id):\n for group in self.groups:\n if group.id == id:\n return group\n\n return None",
"def get_group(self, id: utils.Intable) -> Group | None:\n steam_id = SteamID(id=id, type=Type.Chat)\n return self._connection.get_group(steam_id.id)... | [
"0.86751443",
"0.8147111",
"0.8042772",
"0.779743",
"0.77354",
"0.76379037",
"0.76210207",
"0.75323737",
"0.74977857",
"0.74653757",
"0.73682606",
"0.7232795",
"0.71228415",
"0.7024688",
"0.69462293",
"0.6924493",
"0.69070995",
"0.68198544",
"0.6809479",
"0.6793301",
"0.67741... | 0.803362 | 3 |
Returns a copy of an image where the contrast between pixels is maximized. By Maitreyi Patel 101120534 | def extreme_contrast(picture: Image) -> Image:
contrast_pic = copy(picture)
for x, y, (r, g, b) in contrast_pic:
if r <= 127:
r = 0
if r >= 128 and r <= 255:
r = 255
if g <= 127:
g = 0
if g >= 128 and g <= 255:
g = 2... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def max_contrast(image):\n\tsize = cvGetSize(image)\n\tbh = cvCreateImage(size, IPL_DEPTH_8U, 1)\n\tth = cvCreateImage(size, IPL_DEPTH_8U, 1)\n\ts1 = cvCreateImage(size, IPL_DEPTH_8U, 1)\n\ts2 = cvCreateImage(size, IPL_DEPTH_8U, 1)\n\tel = cvCreateStructuringElementEx(3, 3, 2, 2, CV_SHAPE_ELLIPSE)\n\tcvMorphologyE... | [
"0.80790627",
"0.7858857",
"0.6891162",
"0.68127465",
"0.6806602",
"0.6806602",
"0.6727553",
"0.66561",
"0.6637035",
"0.6597249",
"0.6275586",
"0.62391853",
"0.6220622",
"0.6185442",
"0.61759365",
"0.61489713",
"0.6147531",
"0.61431724",
"0.6140448",
"0.6139611",
"0.6127658",... | 0.7253687 | 2 |
Returns a copy of an image, in which the copy has been modified using the edge detection technique. For every pixel that has a pixel below it, if the contrast is high, change the top pixel's to black, if low, change it to white. The most bottom row is fixed to white. >>> original = Image(choose_file()) >>> final_image ... | def detect_edges(original_image: Image, threshold: int) -> Image :
new_image = copy(original_image)
final_image = copy(new_image)
# Only two colours to be used
black = create_color(0, 0, 0)
white = create_color(255, 255, 255)
# determine the width and height of the image
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def detect_edges_better(original_image: Image, threshold: int) -> Image :\r\n \r\n new_image = copy(original_image)\r\n final_image = copy(new_image)\r\n \r\n # Only two colours to be used\r\n black = create_color(0, 0, 0)\r\n white = create_color(255, 255, 255)\r\n \r\n # determine the ... | [
"0.76122564",
"0.6973558",
"0.69206375",
"0.66890055",
"0.6602471",
"0.6599005",
"0.6549579",
"0.64197993",
"0.63512367",
"0.6342616",
"0.63286704",
"0.6322933",
"0.6269395",
"0.62537557",
"0.62052596",
"0.61945796",
"0.60327667",
"0.6028337",
"0.6019783",
"0.5936171",
"0.590... | 0.7867846 | 0 |
Returns a copy of an image, in which the copy has been modified using the edge detection technique. For every pixel that has a pixel below or next to right of it, if the contrast is high, change the top pixel's to black, if low, change it to white. The most bottom row is fixed to white. >>> original = Image(choose_file... | def detect_edges_better(original_image: Image, threshold: int) -> Image :
new_image = copy(original_image)
final_image = copy(new_image)
# Only two colours to be used
black = create_color(0, 0, 0)
white = create_color(255, 255, 255)
# determine the width and height of the... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def detect_edges(original_image: Image, threshold: int) -> Image :\r\n \r\n new_image = copy(original_image)\r\n final_image = copy(new_image)\r\n \r\n # Only two colours to be used\r\n black = create_color(0, 0, 0)\r\n white = create_color(255, 255, 255)\r\n \r\n # determine the width a... | [
"0.7853329",
"0.69349927",
"0.69269216",
"0.67027277",
"0.66060257",
"0.65929544",
"0.65890247",
"0.6415963",
"0.6397277",
"0.63110507",
"0.62923175",
"0.6289549",
"0.6279254",
"0.62434155",
"0.6218395",
"0.6175579",
"0.60644835",
"0.6062814",
"0.60376847",
"0.59238756",
"0.5... | 0.76028234 | 1 |
Returns the righthandside of the differential equation du/dt = f(u,t) for the rocket equations of motion | def rhs(u,t):
h = u[0] # This is more verboes, but I think it's clearer.
v = u[1]
mp = u[2]
hprime = v # dh/dt
vprime = (-(ms+mp)*g + burn_rate(t)*ve - 0.5*rho*v*abs(v)*A*CD)/(ms+mp)
mpprime = -burn_rate(t)
return numpy.array([hprime,vprime,mpprime]) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def driftRHS(field,drift_velocity,t,x):\n f = field.getValue(x)\n fs = np.linalg.norm(f)\n f = f/fs\n return -f*drift_velocity(fs)",
"def do_dr(r, t):\n return 1/t**0.5",
"def do_dt(r, t):\n return -o(r,t)/(2*t)",
"def driftRHS_3D(field,drift_velocity,t,x):\n f = field.getValue(x)\n f... | [
"0.6324619",
"0.60520506",
"0.5992487",
"0.59819275",
"0.59414446",
"0.5770738",
"0.5768748",
"0.57508725",
"0.5738172",
"0.5599669",
"0.5599669",
"0.55978096",
"0.559505",
"0.55774236",
"0.5556045",
"0.5515281",
"0.55115485",
"0.55089164",
"0.54946136",
"0.54898113",
"0.5478... | 0.0 | -1 |
Get all rawlogs that have the given tags. Returns a dictionary string > RawLog. | def get_rawlogs_by_tag(tags):
return dict(get_rawlogs_by_tag_it(tags)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getRecordsByTags(tags):\n\n log.debug('looking for tags ' + str(tags))\n\n try:\n url = GEONETWORK.csw_url\n tpl = tplEnv.get_template('geonetwork/post_records_by_tags.xml')\n tags = tags.split(',')\n postbody = tpl.render(tags=tags).replace('\\n', '')\n headers = {'con... | [
"0.5830005",
"0.5760281",
"0.571326",
"0.5696717",
"0.5599825",
"0.54074347",
"0.54041946",
"0.536355",
"0.53412014",
"0.5318143",
"0.531276",
"0.531276",
"0.531276",
"0.531276",
"0.531276",
"0.531276",
"0.531276",
"0.531276",
"0.531276",
"0.531276",
"0.531276",
"0.531276",... | 0.85903096 | 0 |
Return SpooledTemporaryFile with given data as content, ready to read eg. as a subprocess input. | def wrap_in_tempfile(data):
wrapped = tempfile.SpooledTemporaryFile()
wrapped.write(data)
wrapped.flush()
wrapped.seek(0)
return wrapped | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _tempfile(self):\n fd, path = tempfile.mkstemp(dir = os.path.join(self.root, \"temporary\"))\n try:\n return os.fdopen(fd, \"wb\"), path\n except:\n os.unlink(path)\n os.close(fd)\n raise",
"def tempfile_factory(total_length, content_type, file... | [
"0.660149",
"0.6378337",
"0.6295358",
"0.62936836",
"0.62359864",
"0.62012386",
"0.61454606",
"0.61445516",
"0.60877544",
"0.6073709",
"0.6064633",
"0.60523564",
"0.6044257",
"0.60378873",
"0.6034862",
"0.60276604",
"0.60190946",
"0.60038245",
"0.5993146",
"0.59453654",
"0.59... | 0.7994913 | 0 |
Retrieve references to all reactions with the observable specified. For now, the observable should be an attribute of the reaction. | def getPlottableReactions(reactionSuite, observable='crossSection'):
result = []
for reactionList in reactionSuite.reactions, reactionSuite.sums.crossSectionSums, \
reactionSuite.sums.multiplicitySums, \
reactionSuite.fissionComponents, reactionSuite.productions:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getListOfReactions(self, *args):\n return _libsbml.Model_getListOfReactions(self, *args)",
"def get(self, *args):\n return _libsbml.ListOfReactions_get(self, *args)",
"def getListOfReactions(self):\n return self.model.getListOfReactions()",
"def get_all_refobjs(self, ):\n retu... | [
"0.6450636",
"0.64053",
"0.63046664",
"0.60382473",
"0.5912706",
"0.5876995",
"0.5610094",
"0.55434895",
"0.5535997",
"0.5524421",
"0.55221003",
"0.5499689",
"0.54352355",
"0.5425468",
"0.53978395",
"0.53955734",
"0.53830254",
"0.5345424",
"0.53050965",
"0.52900225",
"0.52787... | 0.6451472 | 0 |
Returns the "L1" risk as per Konno & Yamazaki; aka the meanabsolute deviation. | def L1_risk(wgts, returns):
rets = returns.fillna(0.0).as_matrix()
return np.mean(np.abs(rets.dot(wgts))) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def LN2N_Mean(LN_Mean, LN_SD):\n \n return np.log( LN_Mean**2 / np.sqrt( LN_SD**2 + LN_Mean**2 ) )",
"def averaged_risk(self):\n return self._averaged_risk",
"def averaged_risk(self):\n return self._averaged_risk",
"def normal_kl(mean1, logvar1, mean2, logvar2):\n return 0.5 * (-1... | [
"0.60099393",
"0.5966085",
"0.5966085",
"0.5825609",
"0.5802337",
"0.57771564",
"0.57528514",
"0.5704603",
"0.56956136",
"0.568198",
"0.5625435",
"0.5613574",
"0.55717033",
"0.5561024",
"0.5550528",
"0.5550123",
"0.5542965",
"0.55239016",
"0.55238724",
"0.55234104",
"0.551403... | 0.65333205 | 0 |
Get snat rule information | def get_snat_rule(self, snatrule):
return self._get(_snat.Rule, snatrule) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def snat_rules(self, nat_gateway, **query):\n parent_natgw = self._get_resource(_gw.Service, nat_gateway)\n return self._list(_snat.Rule, nat_gateway_id=parent_natgw.id ,**query)",
"def test_get_rule_details(self):\n pass",
"def get_rule(self):\n return self.rule.state_dict()",
"d... | [
"0.67273194",
"0.6339265",
"0.6302662",
"0.61818534",
"0.6177145",
"0.61541337",
"0.6148086",
"0.6128165",
"0.61029214",
"0.61029214",
"0.61029214",
"0.60022295",
"0.60022295",
"0.60022295",
"0.59303766",
"0.5889412",
"0.5825517",
"0.5825517",
"0.5825517",
"0.5825517",
"0.582... | 0.79090667 | 0 |
Function that creates a batch normalization layer for a neural network in tensorflow | def create_batch_norm_layer(prev, n, activation):
init = tf.keras.initializers.VarianceScaling(mode='fan_avg')
layer = tf.keras.layers.Dense(
units=n, kernel_initializer=init, name='layer')
epsilon = 1e-8
base = layer(prev)
gamma = tf.Variable(tf.constant(1.0, shape=[n]), trainable=True)
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def norm_layer( x, training, name):\n top = tf.layers.batch_normalization( x, \n axis=3, # channels last \n training=training,\n name=name )\n return... | [
"0.78523886",
"0.7793938",
"0.77819747",
"0.76815754",
"0.7560385",
"0.7553916",
"0.750958",
"0.7474621",
"0.7410609",
"0.7398976",
"0.7391721",
"0.7353756",
"0.7227028",
"0.71957946",
"0.7184113",
"0.7172341",
"0.71529764",
"0.7115725",
"0.71137094",
"0.7106746",
"0.71048486... | 0.7967536 | 0 |
Returns true if both objects are equal | def __eq__(self, other):
if not isinstance(other, UserPaymentPermissions):
return False
return self.to_dict() == other.to_dict() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __eq__(self, other):\n return are_equal(self, other)",
"def __eq__(self, other):\n return are_equal(self, other)",
"def __eq__(self,other):\n try: return self.object==other.object and isinstance(self,type(other))\n except: return False",
"def __eq__(self, other):\n if i... | [
"0.8088132",
"0.8088132",
"0.8054589",
"0.7982687",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
... | 0.0 | -1 |
Returns true if both objects are not equal | def __ne__(self, other):
if not isinstance(other, UserPaymentPermissions):
return True
return self.to_dict() != other.to_dict() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __ne__(self, other: object) -> bool:\n if self.__eq__(other):\n return False\n return True",
"def __ne__(self, other: object) -> bool:\n return not self.__eq__(other)",
"def __ne__(self, other) -> bool:\n return not self.__eq__(other)",
"def __eq__(self, other):\n ... | [
"0.84564555",
"0.8391999",
"0.8144653",
"0.81410354",
"0.81326365",
"0.8094085",
"0.80921024",
"0.80921024",
"0.80921024",
"0.8085453",
"0.8085453",
"0.807646",
"0.807646",
"0.806588",
"0.8042693",
"0.8042693",
"0.8042693",
"0.8042693",
"0.8042693",
"0.8042693",
"0.8042693",
... | 0.0 | -1 |
Opens a new database connection if there is none yet for the current application context. | def db_open():
if not hasattr(g, 'sqlite_db'):
g.sqlite_db = db_connect()
return g.sqlite_db | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def open_database(self):\n if self._conn is None:\n self._conn = sqlite3.connect(self._db_path)",
"def open_db(db_name: str = DB_NAME) -> DBConnection:\n return sqlite3.connect(db_name, cached_statements=STATEMENT_CACHE)",
"def obtainDatabaseConnection(self):\n\t\tself.databaseConnector = ... | [
"0.75821716",
"0.7317949",
"0.7168726",
"0.7023119",
"0.6966575",
"0.6955527",
"0.69501823",
"0.6898128",
"0.684287",
"0.68288016",
"0.6818829",
"0.68058383",
"0.67962265",
"0.67700136",
"0.6762472",
"0.6752249",
"0.6747864",
"0.67321193",
"0.67017424",
"0.6688114",
"0.668502... | 0.77378136 | 0 |
The current effective load. | def effectiveLoad(self):
return self.acknowledged + self.unacknowledged | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getLoad(self) -> float:\n return self.load",
"def totalEffectiveLoad(self):\n return sum(s.effectiveLoad() for s in self.dispatcher.statuses)",
"def current_load(self):\n nn = [p.n for p in self._procs]\n return sum(nn), min(nn)",
"def get_load_factor(self):\n # Your co... | [
"0.77264035",
"0.75926745",
"0.699942",
"0.6726659",
"0.66630834",
"0.66050327",
"0.6598041",
"0.6476843",
"0.6434268",
"0.6415216",
"0.64062136",
"0.63834155",
"0.6303679",
"0.62846714",
"0.62257314",
"0.6176532",
"0.6167612",
"0.6145186",
"0.6113911",
"0.61096466",
"0.60987... | 0.6799089 | 3 |
Pytest fixture to set BASE_URL for all tests | def BASE_URL():
BASE_URL = "http://api.zippopotam.us/"
return BASE_URL | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_url():\n return TEST_DATABASE_URL",
"def setup(base_dir, fixture_prefixes=None):\n global test_dir\n test_dir = base_dir",
"def test_base_url(self):\n\n # Each of these URLs should be invalid\n for url in [\n \"test.com/123\",\n \"http://:80/123\",\n ... | [
"0.67375654",
"0.65970814",
"0.65514576",
"0.6524714",
"0.6482464",
"0.6472702",
"0.6407684",
"0.6375667",
"0.63571084",
"0.62757254",
"0.6258634",
"0.6251629",
"0.6239677",
"0.6214521",
"0.6204452",
"0.619246",
"0.6181787",
"0.6178682",
"0.6167146",
"0.6151436",
"0.6121323",... | 0.0 | -1 |
test that response body encoding from BASE_URL/COUNTRY_CODE is not set | def test_response_body_encoding(BASE_URL, COUNTRY_CODE):
# make request
result = requests.get(f'{BASE_URL}{COUNTRY_CODE}')
assert result.encoding is None | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_response_header(BASE_URL, COUNTRY_CODE):\n # make request\n result = requests.get(f'{BASE_URL}{COUNTRY_CODE}')\n assert result.headers['Content-Type'] == 'application/json'",
"def test_response_no_charset_with_iso_8859_1_content():\n content = \"Accented: Österreich abcdefghijklmnopqrstuzwxy... | [
"0.6956398",
"0.6909217",
"0.6896154",
"0.6833571",
"0.6711672",
"0.6639738",
"0.6586152",
"0.6492026",
"0.64387745",
"0.63929254",
"0.63825417",
"0.6228057",
"0.6200705",
"0.6175834",
"0.6164469",
"0.6121878",
"0.6118029",
"0.6112569",
"0.609245",
"0.6075537",
"0.59984934",
... | 0.90111285 | 0 |
Accesses and returns the attribute age of the class Subscriber | def get_age(self) -> int:
return self.age | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _get_age(self):\n return self.__age",
"def getAge(self):\r\n return self.age",
"def age(self):\n return self.__age",
"def age(self):\r\n return self._age",
"def get_age(self):\r\n return self.age",
"def getAge(self):\n return self.age",
"def get_age(self):\n\t... | [
"0.77284235",
"0.75666416",
"0.7518391",
"0.7474255",
"0.7454447",
"0.7414411",
"0.7402184",
"0.7347491",
"0.7230521",
"0.7230521",
"0.7230521",
"0.69440943",
"0.6660789",
"0.6656789",
"0.65856695",
"0.6570931",
"0.65101147",
"0.6462992",
"0.6372103",
"0.63414",
"0.63414",
... | 0.7199298 | 11 |
Mutator method to set the attribute id_number of the class Subscriber | def set_id_number(self, id_number):
self.id_number = id_number | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _set_id(self):\n raise NotImplementedError()",
"def _set_id(self, value):\n pass",
"def id(self, _id):\n self._id = _id",
"def setID(self, id):\r\n raise NotImplementedError(\"must be implemented in subclass\")",
"def setID(self, idNb):\n self._id = idNb",
"def set_... | [
"0.6732539",
"0.65444344",
"0.6457275",
"0.6361913",
"0.62674856",
"0.6249849",
"0.6076807",
"0.6076807",
"0.6076807",
"0.6076807",
"0.6076807",
"0.6076807",
"0.6076807",
"0.6076807",
"0.6076807",
"0.6076807",
"0.6076807",
"0.6076807",
"0.60501117",
"0.5991542",
"0.5991542",
... | 0.6316665 | 4 |
Mutator method to set the attribute first_name of the class Subscriber | def set_first_name(self, first_name):
self.first_name = first_name | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def setFirstName(self, firstName):\r\n self.firstName = firstName",
"def firstname(self, firstname):\n\n self._firstname = firstname",
"def firstname(self, firstname):\n\n self._firstname = firstname",
"def first_name(self, first_name):\n\n self._first_name = first_name",
"def ... | [
"0.7392514",
"0.72629136",
"0.72629136",
"0.70686436",
"0.70686436",
"0.70686436",
"0.70686436",
"0.70686436",
"0.70686436",
"0.70686436",
"0.70686436",
"0.70686436",
"0.70483124",
"0.66207254",
"0.63646543",
"0.63099086",
"0.62442094",
"0.6231746",
"0.61960936",
"0.61960936",
... | 0.71234727 | 3 |
Return either integer or float conversion of specified string. | def string_to_number(string):
if not string:
return 0
try:
return int(string)
except ValueError:
return float(string) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def convertFloat(s):\n try:\n float(s)\n return \"FLOAT\"\n except:\n return s",
"def _convert_to_float(s):\n try:\n return float(s)\n except:\n return s",
"def convert_string(string):\n if is_int(string):\n return int(string)\n elif is_float(string):... | [
"0.7885425",
"0.7848426",
"0.74684256",
"0.7457367",
"0.74012643",
"0.73964065",
"0.7389735",
"0.7379219",
"0.7353564",
"0.7302052",
"0.73001075",
"0.72640085",
"0.72066015",
"0.72018564",
"0.7194066",
"0.71903944",
"0.71281147",
"0.71276754",
"0.7105063",
"0.7092172",
"0.706... | 0.6993196 | 24 |
Spawns 1 process per GPU | def multi_card_run(self):
init_logger()
nb_gpu = self.args.world_size
mp = torch.multiprocessing.get_context('spawn')
# Create a thread to listen for errors in the child processes.
error_queue = mp.SimpleQueue()
error_handler = ErrorHandler(error_queue)
# Train... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _spawn_gpu_client_wrapper(server_ip, port, authkey, \n processes_per_gpu, gpu_id, shared_arr):\n logging.debug('Spawning GPU client')\n os.environ['CUDA_VISIBLE_DEVICES'] = str(gpu_id) #Only this GPU visible\n\n manager_creds = (server_ip, port, authkey)\n for i in range(processes_per_gpu):\n ... | [
"0.6955488",
"0.6570167",
"0.6506753",
"0.6414029",
"0.6414029",
"0.6414029",
"0.63532364",
"0.6291745",
"0.6291745",
"0.6291745",
"0.62042475",
"0.613143",
"0.613143",
"0.613143",
"0.61242867",
"0.6122399",
"0.6121954",
"0.6121314",
"0.6070611",
"0.6056371",
"0.6054985",
"... | 0.6492785 | 3 |
Test that the matlab file is executable | def test_matlab_executable(self):
matlab_executable_path = self.host.check_output(
"which matlab | xargs readlink -f"
).rstrip("\n")
self.assertRegex(
stat.filemode(stat.S_IMODE(self.host.file(matlab_executable_path).mode)),
"r.xr-xr-x",
) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_matlab_is_on_path(self):\n self.assertTrue(self.host.run(\"which matlab\").succeeded)",
"def test_entrypoint_called_mocked_matlab(self):\n self.assertEqual(\n self.host.file(\"matlab.log\").content_string.rstrip(), f\"MATLAB {CUSTOM_CMD}\"\n )",
"def test_executable_fil... | [
"0.7647192",
"0.678665",
"0.66786695",
"0.6411146",
"0.6374106",
"0.63328123",
"0.62889737",
"0.6270855",
"0.62674505",
"0.61999285",
"0.6116393",
"0.60501355",
"0.6029124",
"0.60080034",
"0.6005714",
"0.5996877",
"0.59735256",
"0.5969147",
"0.5961863",
"0.5946441",
"0.593180... | 0.8173911 | 0 |
return a double quoted string | def quote(value):
return DoubleQuotedScalarString(value) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def wrap_with_in_single_quote(s):\n return \"'{}'\".format(s)",
"def wrap_with_in_single_quote(s):\n return \"'{}'\".format(s)",
"def str_wrap_double(s):\n s = str(s)\n return '\"' + s + '\"'",
"def embeded_triple_quotes():\n pass",
"def QuotedEscaped (s):\n return repr(s)",
"def esc_qu... | [
"0.7326465",
"0.7326465",
"0.73118585",
"0.72337395",
"0.706227",
"0.70223355",
"0.6962079",
"0.68827236",
"0.6876345",
"0.68393797",
"0.6771374",
"0.6729521",
"0.667199",
"0.66369194",
"0.66338056",
"0.6588877",
"0.6582053",
"0.65683013",
"0.6544022",
"0.6469517",
"0.6453002... | 0.7039518 | 5 |
Sends a 401 response that enables basic auth | def authenticate():
return Response(
'Could not verify your access level for that URL.\n'
'You have to login with proper credentials', 401,
{'WWW-Authenticate': 'Basic realm="Login Required"'}) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def authenticate():\n return Response('Not Authorized', 401, {'WWW-Authenticate': 'Basic realm=\"api\"'})",
"def authenticate():\n return Response(\n '', 401, {'WWW-Authenticate': 'Basic realm=\"Login Required\"'}\n )",
"def authenticate():\n return Response(\n 'You have to login with pro... | [
"0.8093736",
"0.80926424",
"0.7958403",
"0.7852648",
"0.7843114",
"0.7824419",
"0.776624",
"0.7754693",
"0.774767",
"0.774767",
"0.774767",
"0.774767",
"0.774767",
"0.774767",
"0.774767",
"0.774767",
"0.771945",
"0.7667712",
"0.7664151",
"0.76493174",
"0.76140213",
"0.76131... | 0.7810746 | 19 |
Return true/false on whether the queue is empty | def isEmpty(self):
return self.qSize == 0 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_empty(self):\n return self.queue == []",
"def is_empty(self):\n return len(self.queue) == 0",
"def is_empty(self):\n return len(self.queue) == 0",
"def is_empty(self):\n return len(self.__queue) > 0",
"def empty(self) -> bool:\n if self.queue.empty():\n ... | [
"0.9107126",
"0.90377414",
"0.90377414",
"0.9033908",
"0.9032376",
"0.90117496",
"0.90018916",
"0.8950022",
"0.89130694",
"0.8884582",
"0.8857003",
"0.88566595",
"0.87847096",
"0.8760816",
"0.87482595",
"0.87185925",
"0.87185925",
"0.87091553",
"0.86245954",
"0.85803574",
"0.... | 0.81086004 | 38 |
Setup slices and ipa_regions. Deprecated. | def region_setup(self, slices, ipa_regions):
self.ipa_regions = ipa_regions
self.slices = slices | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def rsetup(self, pattern):\n slices = []\n ipa_regions = []\n for i, p in enumerate(pattern):\n if i % 2 == 0:\n slices.append(p)\n else:\n ipa_regions.append(p)\n self.region_setup(slices, ipa_regions)",
"def setup(self, project_fac... | [
"0.592549",
"0.53064114",
"0.5278262",
"0.5147462",
"0.5060558",
"0.5060536",
"0.5030198",
"0.5000901",
"0.4995736",
"0.49844086",
"0.49457607",
"0.49449494",
"0.49284875",
"0.49272278",
"0.4915548",
"0.49075764",
"0.49055642",
"0.48806345",
"0.4873827",
"0.48728085",
"0.4864... | 0.8085767 | 0 |
This function creates and returns a SQLAlchemy engine | def _get_engine(**kwargs):
engine_name = 'MySQL'
return engine_name | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_engine(db_params: Dict[str, str]) -> sa.engine:\r\n db_uri = get_uri(db_params)\r\n return sa.create_engine(db_uri)",
"def get_db_engine():\n # get database connection url\n connection_url = get_db_connection_url()\n\n # Create engine from connection url\n engine = create_engine(connect... | [
"0.83067185",
"0.8296472",
"0.8168199",
"0.81632954",
"0.7979148",
"0.7856069",
"0.7809878",
"0.776091",
"0.7753024",
"0.7717434",
"0.7663689",
"0.7659336",
"0.76496416",
"0.7640579",
"0.7607533",
"0.74650085",
"0.7432243",
"0.73573345",
"0.73550826",
"0.73530173",
"0.7353017... | 0.0 | -1 |
Test 'jwt' with no data | def test_jwt_nodata(self):
self.assertEqual(jc.parsers.jwt.parse('', quiet=True), {}) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_user_no_jwt(client):\n response = client.get(\"/user\")\n assert response.status_code == 401",
"def test_decoded_jwt_no_jwt_provided(\n self,\n mixin,\n mrequest,\n mdecode_jwt,\n ):\n with raises(HTTPUnauthorized):\n mixin.decoded_j... | [
"0.764417",
"0.7272284",
"0.7252237",
"0.72384",
"0.7082292",
"0.70775044",
"0.7034194",
"0.7016667",
"0.70094097",
"0.70037216",
"0.69933385",
"0.69865566",
"0.6978783",
"0.6965913",
"0.6954725",
"0.6923681",
"0.69185",
"0.6914549",
"0.6896478",
"0.68753046",
"0.6857662",
... | 0.7752674 | 0 |
Function returns a dictionary with definitions of output data produced the component. | def output_data_definitions(self):
return {
self.key_outputs: DataDefinition(
[-1]*(self.num_inputs_dims-1) + [self.input_size],
[torch.Tensor],
"Batch of outputs [DIM 1 x DIM 2 x ... x INPUT_SIZE]")
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def output_data_definitions(self):\n return {}",
"def output_data_definitions(self):\n return {\n self.key_outputs: DataDefinition([-1, self.output_size], [torch.Tensor], \"Batch of outputs [BATCH_SIZE x OUTPUT_SIZE]\")\n }",
"def _get_output_dictionary(self):\n\n ret... | [
"0.7913661",
"0.7503195",
"0.7397077",
"0.7144201",
"0.6894268",
"0.6771832",
"0.6712732",
"0.66553247",
"0.65952355",
"0.65835136",
"0.65544933",
"0.6544944",
"0.6533759",
"0.6518811",
"0.6509036",
"0.64230347",
"0.63829935",
"0.6379817",
"0.6365335",
"0.6364648",
"0.6355275... | 0.7291798 | 3 |
Set the Engines id. | def setID(self, id):
self._id = id
return self.callRemote('setID', id) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_id(self, player_id):\n pass",
"def _set_id(self, value):\n pass",
"def _set_id(self):\n raise NotImplementedError()",
"def setCompartmentId(self, *args):\n return _libsbml.CompartmentGlyph_setCompartmentId(self, *args)",
"def setId(self, *args):\n return _libsbml.... | [
"0.6346012",
"0.6320062",
"0.62935054",
"0.6074043",
"0.60688555",
"0.59417945",
"0.5920414",
"0.5898072",
"0.58787954",
"0.58537996",
"0.5839107",
"0.5829861",
"0.580129",
"0.5775514",
"0.576699",
"0.57448155",
"0.5723956",
"0.56919867",
"0.56765926",
"0.56695443",
"0.563689... | 0.55481255 | 37 |
Returns a function to calculate the asymptote y for given x. | def asympFunc(m, b):
def f(x):
return m * x + b
return f | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def fn(self, x):\n\n return math.exp(x*2) - math.exp(x) - 2",
"def fn(self, x):\n\n return math.exp(x*2) - math.exp(x) - 2",
"def y(x):\n x1, x2, x3, x4 = x[:, 0], x[:, 1], x[:, 2], x[:, 3]\n return 1 + 0.3 * x1 - 0.6 * x2 ** 2 - 0.2 * x3 ** 3 + 0.5 * x4 ** 4",
"def y(x,xi):\n ... | [
"0.7294885",
"0.7294885",
"0.71997863",
"0.7070093",
"0.68911576",
"0.6871796",
"0.6634693",
"0.6563065",
"0.64267766",
"0.6327821",
"0.6305303",
"0.6290849",
"0.6290764",
"0.62749696",
"0.6269853",
"0.62684464",
"0.6263944",
"0.62497854",
"0.6249392",
"0.624133",
"0.6240976"... | 0.0 | -1 |
Get the mode of a PSCU temperature sensor. This method returns the descriptive mode for the specified PSCU temperature sensor, i.e. whether the sensor channel has an over or undertemperature trip condition. | def get_temperature_mode(self, sensor):
if sensor >= self.num_temperatures or sensor < 0:
raise I2CException('Illegal sensor index {} specified'.format(sensor))
return self.__temperature_mode[sensor] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_mode(self):\r\n _debug('simq03b_api.get_mode')\r\n \r\n s = self.query('FREQ:MODE?')\r\n if s == None: return None\r\n \r\n s = s.strip()\r\n if s == 'CW': return 'Fixed'\r\n elif s == 'LIST': return 'List'\r\n else:\r\n print('ER... | [
"0.6198472",
"0.6106526",
"0.6106526",
"0.59787726",
"0.5820048",
"0.5762024",
"0.5647248",
"0.5641971",
"0.5621944",
"0.56131953",
"0.5580859",
"0.5580859",
"0.5578239",
"0.5543754",
"0.55431765",
"0.5539702",
"0.55377156",
"0.55315554",
"0.5498363",
"0.5460879",
"0.5435335"... | 0.692595 | 0 |
Get the name of a PSCU humidity sensor. This method returns the descriptive name for the specified PSCU humidity sensor. | def get_humidity_name(self, sensor):
if sensor >= self.num_humidities or sensor < 0:
raise I2CException('Illegal sensor index {} specified'.format(sensor))
return PSCU.HUMIDITY_SENSOR_NAMES[sensor] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_temperature_name(self, sensor):\n if sensor >= self.num_temperatures or sensor < 0:\n raise I2CException('Illegal sensor index {} specified'.format(sensor))\n\n return PSCU.TEMP_SENSOR_NAMES[sensor]",
"def get_sensor_name(self):\n return self.data[1]",
"def friendly_name... | [
"0.6818292",
"0.64837825",
"0.6255804",
"0.61317384",
"0.6119389",
"0.6088273",
"0.6059589",
"0.6051599",
"0.60390633",
"0.6008977",
"0.58230865",
"0.58230865",
"0.58230865",
"0.5811364",
"0.5760146",
"0.57595795",
"0.57289016",
"0.57184887",
"0.57145315",
"0.57139033",
"0.56... | 0.6953584 | 0 |
Get the value of the PSCU pump flow sensor. This method returns the current pump flow sensor value. | def get_pump_flow(self):
return self.__pump_flow | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_value(self):\n return self.sensor.get_value()",
"def _value(self):\n return self.device.value(*self._id[1:])",
"def get_pump_state(self):\n return self.__sensor_states[2]",
"def get_pump_flow_volts(self):\n return self.__pump_flow_raw * PSCU.PUMP_VREF",
"def value(self) ... | [
"0.69894",
"0.6496897",
"0.63225985",
"0.6265872",
"0.6198226",
"0.6198226",
"0.6192441",
"0.6177503",
"0.6172962",
"0.6131678",
"0.6104206",
"0.6096056",
"0.6058464",
"0.6058464",
"0.6058464",
"0.6057702",
"0.603963",
"0.60244685",
"0.6011187",
"0.60058516",
"0.6001493",
"... | 0.5966526 | 26 |
Get the raw value of the PSCU pump flow sensor. This method returns the current raw pump flow sensor value. | def get_pump_flow_volts(self):
return self.__pump_flow_raw * PSCU.PUMP_VREF | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def readRaw(self):\n self.value = self.analogInput.value # new value is read and stored\n return self.value",
"def __getRawPressure(self):\n p1 = self.read_byte_data(self.address, 0x00)\n p2 = self.read_byte_data(self.address, 0x01)\n p3 = self.read_byte_data(self.address, 0... | [
"0.68582135",
"0.6745122",
"0.6697227",
"0.6641662",
"0.6574043",
"0.6490671",
"0.6463854",
"0.64160466",
"0.64160466",
"0.64082825",
"0.62273556",
"0.62179893",
"0.61835974",
"0.60633504",
"0.60186684",
"0.5989791",
"0.5968575",
"0.59401405",
"0.59180194",
"0.59068346",
"0.5... | 0.6115177 | 13 |
Get the trip status of the LPD fan. This method returns the current trip status for the fan. | def get_fan_tripped(self):
return self.__fan_trip | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def status(self):\n return self._call_txtrader_api('status', {})",
"def rtt_get_status(self):\n status = structs.JLinkRTTerminalStatus()\n res = self.rtt_control(enums.JLinkRTTCommand.GETSTAT, status)\n return status",
"def tower_status_radiant(self):\n return self._get(\"tow... | [
"0.6106526",
"0.5904394",
"0.58148515",
"0.57734865",
"0.5763699",
"0.5744903",
"0.5744903",
"0.5744903",
"0.5668974",
"0.56448084",
"0.56333447",
"0.5580424",
"0.5571215",
"0.5542159",
"0.5517895",
"0.55157804",
"0.5507095",
"0.5469302",
"0.54673374",
"0.5454011",
"0.5439461... | 0.6499379 | 0 |
Get the mode of the PSCU fan sensor. This method returns the descriptive mode for the PSCU fan sensor, i.e. whether the sensor channel has an over or underspeed trip condition. | def get_fan_mode(self):
return self.__fan_mode | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def fan_mode(self):\n if self.ac.status is None:\n _LOGGER.debug(f\"fan_mode: status is None, returning None\")\n return None\n if self.ac.status.is_on:\n fan_speed = self.ac.status.fan_speed\n value = self.FAN_MODE_MAPPING[fan_speed]\n _LOGGER.d... | [
"0.66779983",
"0.6605676",
"0.6571489",
"0.6451561",
"0.64052165",
"0.64052165",
"0.6262405",
"0.6248662",
"0.62308246",
"0.622066",
"0.62123716",
"0.6159187",
"0.6139501",
"0.61391354",
"0.6051699",
"0.60289264",
"0.602132",
"0.60198283",
"0.60198283",
"0.6008048",
"0.599433... | 0.59711814 | 23 |
Get the value of the detector position sensor. This method returns the value of the the potentiometer reading the position of the quadrant motion system. The value is returned as the transverse opening of the quadrant assembly (i.e. width of the beam pipe hole) in mm, and is signed according the which direction the qua... | def get_position(self):
return self.__position | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_position(self):\n return self.gripper_io.get_signal_value(\"position_response_m\")",
"def get_value(self) -> float:\n return self.points[0, 0]",
"def pos(self):\n return self.info['value']",
"def get_position(self, axis):\n if not self.enabled:\n return\n\n ... | [
"0.6499765",
"0.6244995",
"0.62182236",
"0.6211893",
"0.6199194",
"0.6156853",
"0.61390984",
"0.6059281",
"0.6050055",
"0.60232127",
"0.60202426",
"0.59987414",
"0.5997968",
"0.59887207",
"0.5987107",
"0.5965882",
"0.5933028",
"0.59176725",
"0.5907492",
"0.59013975",
"0.58945... | 0.58293843 | 24 |
Get the value of the detector position sensor. This method returns the raw value of the the potentiometer reading the position of the quadrant motion system in volts. | def get_position_volts(self):
return self.__position_raw * PSCU.POSITION_VREF | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_position(self):\n return self.gripper_io.get_signal_value(\"position_response_m\")",
"def get_value(self) -> float:\n return self.points[0, 0]",
"def raw_value(self):\n if self.__trigger == gyro_trigger_mode.GET_RAW_VALUE_TRIGGER_READ:\n self.read_and_update_angle()\n ... | [
"0.66917604",
"0.66353357",
"0.6573353",
"0.65510505",
"0.64852536",
"0.6431689",
"0.64191043",
"0.6405085",
"0.6327795",
"0.6326155",
"0.6279467",
"0.6244024",
"0.6231811",
"0.6214315",
"0.61941326",
"0.6164615",
"0.6162203",
"0.6154358",
"0.61541116",
"0.6141101",
"0.609765... | 0.7113796 | 0 |
Get the status indicating all outputs are enabled. This method returns a status indicating if all PSCU quad outputs are enabled, which is primarily beneficial to clients determining the next action for an enable/disable all command. | def get_all_enabled(self):
return self.__all_enabled | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def output_status(self, on=False):\n if on:\n enabled = str(1)\n else:\n enabled = str(0)\n function_string = 'OP' + self.output + ' ' + enabled\n return self.scpi_comm(function_string)",
"def enable_output_timers(self):\n return self._enable_output_timers... | [
"0.63318473",
"0.6062037",
"0.59167504",
"0.57470953",
"0.5690202",
"0.56397676",
"0.56291544",
"0.56291544",
"0.56291544",
"0.56291544",
"0.562445",
"0.56214845",
"0.55915815",
"0.5533944",
"0.5523949",
"0.55163527",
"0.5492622",
"0.5450991",
"0.5423981",
"0.5394696",
"0.536... | 0.66012895 | 0 |
Get the status of the PSCU trace interlock. This method returns the global status of the the trace interlock, i.e. if all trace channels are connected. | def get_trace_state(self):
return self.__sensor_states[4] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _getCurrentComponentStatus(self):\n resOverall = self.sysAdminClient.getOverallStatus()\n if not resOverall['OK']:\n return resOverall\n currentStatus = {'Down': set(), 'Run': set(), 'All': set()}\n informationDict = resOverall['Value']\n for systemsDict in informationDict.values():\n ... | [
"0.6609643",
"0.6604502",
"0.6590178",
"0.6486877",
"0.6318233",
"0.6191702",
"0.616195",
"0.6100896",
"0.6099413",
"0.6073806",
"0.6047906",
"0.60286677",
"0.59919894",
"0.5988731",
"0.5974578",
"0.5968148",
"0.5943095",
"0.5917911",
"0.59035766",
"0.5876717",
"0.58708936",
... | 0.60929 | 9 |
Get the status of the PSCU pump flow rate interlock. This method returns the global status of the the pump flow rate interlock, i.e. if the pump flow rate is within the setpoint. | def get_pump_state(self):
return self.__sensor_states[2] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_raw_status(self):\n self.__param_lock.acquire()\n status = self.__status\n self.__param_lock.release()\n return status",
"def get_current_status(cls):\n from sauna.plugins.base import Plugin\n from sauna import check_results_lock, check_results\n\n def reduce_status(accum... | [
"0.5893936",
"0.58394295",
"0.5674568",
"0.5626419",
"0.56112814",
"0.548342",
"0.5471858",
"0.5341187",
"0.5337249",
"0.52974886",
"0.5295806",
"0.5290191",
"0.52844673",
"0.5277754",
"0.5258552",
"0.52553296",
"0.52544594",
"0.52519935",
"0.5230953",
"0.52274615",
"0.522746... | 0.5886242 | 1 |
Get the state of all latch conditions. This method returns the state of all PSCU latch conditions as a list, and is provided as a convenience for a client requested all latch states simultaneously. | def get_all_latched(self):
return self.__latched_states | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_all_states(self):\n return self._states",
"def getstate(self):\n return [elem.getstate() for elem in self]",
"def all_states(self):\n return self._states",
"def all_states(self) -> Tuple[State, ...]:\n return self.influence_graph.all_states()",
"def get_list_of_states(se... | [
"0.63532126",
"0.62973446",
"0.6283887",
"0.60700035",
"0.6064103",
"0.5993309",
"0.5902092",
"0.58554345",
"0.57662356",
"0.57638675",
"0.57062113",
"0.57037646",
"0.56953377",
"0.5676021",
"0.5640589",
"0.5631779",
"0.56176436",
"0.559791",
"0.55902696",
"0.5572728",
"0.555... | 0.6419866 | 0 |
Get the quad output enable interval. This method returns the quad output enable interval, which is used to sequence quad outputs on at a fixed rate to avoid inrush. The enable interval is set as an argument at initialisation, i.e. passed in as an option. | def get_enable_interval(self):
return self.quad_enable_interval | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def interval(self) -> Optional[pulumi.Input[int]]:\n return pulumi.get(self, \"interval\")",
"def interval(self) -> Optional[str]:\n return pulumi.get(self, \"interval\")",
"def interval(self):\n return self._base_interval",
"def EnableInterBurstGap(self):\r\n\t\treturn self._get_attribu... | [
"0.5270692",
"0.50980353",
"0.5052618",
"0.4961107",
"0.49222577",
"0.48985997",
"0.48985997",
"0.48381558",
"0.4832875",
"0.47972283",
"0.4790101",
"0.4769833",
"0.47458735",
"0.47101486",
"0.46978402",
"0.46445128",
"0.45978653",
"0.45653793",
"0.45617053",
"0.45617053",
"0... | 0.7715069 | 0 |
Athena Check Table Exists | def test_check_table_exists(self):
query_result = [{'alerts': True}]
self.client.athena_client = MockAthenaClient(results=query_result)
result = self.client.check_table_exists('unit-test')
assert_true(result)
generated_results_key = 'unit-testing/{}'.format(datetime.now().strft... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def does_table_exist(table_name):\n result = call_bq(\n ['show', table_name], project='khan-academy', raise_exception=False)\n\n if \"Not found: Table\" in result:\n return False\n else:\n return True",
"def table_exists( table_name):\n query = \"select * from \" + table_name + \... | [
"0.78950626",
"0.75242233",
"0.7483439",
"0.74502224",
"0.74276584",
"0.7388104",
"0.7325162",
"0.7325008",
"0.731394",
"0.72840965",
"0.7273613",
"0.72478545",
"0.7212236",
"0.72120684",
"0.71738285",
"0.7146885",
"0.71149033",
"0.70920384",
"0.70784867",
"0.7037724",
"0.697... | 0.8144129 | 0 |
Athena Check Table Exists Does Not Exist | def test_check_table_exists_invalid(self, mock_logging):
query_result = None
self.client.athena_client = MockAthenaClient(results=query_result)
result = self.client.check_table_exists('unit-test')
assert_false(result)
assert_true(mock_logging.info.called) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_check_table_exists(self):\n query_result = [{'alerts': True}]\n self.client.athena_client = MockAthenaClient(results=query_result)\n\n result = self.client.check_table_exists('unit-test')\n assert_true(result)\n\n generated_results_key = 'unit-testing/{}'.format(datetime... | [
"0.7831761",
"0.7495995",
"0.7200502",
"0.69937456",
"0.69843477",
"0.6978527",
"0.6977601",
"0.6946335",
"0.6802026",
"0.6790241",
"0.67316025",
"0.6725015",
"0.6707689",
"0.6679975",
"0.6675516",
"0.6648596",
"0.66449493",
"0.6626164",
"0.6625865",
"0.65981233",
"0.65798676... | 0.76431286 | 1 |
Return the iterator itself. | def __iter__(self):
return self | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __iter__(self):\n return self._next()",
"def __iter__(self):\n return self._next()",
"def __iter__(self):\n return self._next()",
"def __iter__(self):\n return self.next()",
"def __next__(self):\n return next(self.iterator)",
"def __next__(self):\n return nex... | [
"0.83180934",
"0.83180934",
"0.83180934",
"0.8292486",
"0.82784235",
"0.8137699",
"0.80929476",
"0.7753991",
"0.75937486",
"0.75595355",
"0.7553744",
"0.75401896",
"0.75303805",
"0.75184304",
"0.7513298",
"0.74911255",
"0.74601203",
"0.7398065",
"0.7390838",
"0.7390838",
"0.7... | 0.7561671 | 25 |
this function converts a 2d numpy representation of a grayscale image to a 3d numpy representation of grayscale image | def grayscale2rgb(gray_image):
assert gray_image.ndim == 2
image = np.stack([gray_image, gray_image, gray_image], axis = -1).astype(np.uint8)
return image | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def convert_to_grayscale(image: np.array) -> np.array:\n\n assert len(image.shape) == 3 and image.shape[2] == 3, \"Image must be m x n x 3 dimensional RGB array\"\n return 0.2989 * image[:,:,0] + 0.5870 * image[:,:,1] + 0.1140 * image[:,:,2]",
"def convert_image_np(inp):\n inp = inp.numpy().transpose((1... | [
"0.6746588",
"0.6721324",
"0.6604058",
"0.6575361",
"0.6502147",
"0.6484711",
"0.64144367",
"0.635522",
"0.633038",
"0.63149244",
"0.6279397",
"0.6265919",
"0.619517",
"0.61936826",
"0.6188253",
"0.6175438",
"0.6173842",
"0.6145597",
"0.6131233",
"0.61045206",
"0.6094718",
... | 0.56813407 | 98 |
This function is to get the color distribution of the image | def get_col_dist(image, hue_angel, saturation_interval_size, value_interval_size):
image = rgb_to_hsv(image / 255.0)
##convert the hue channel into angel degrees
image[:, :, 0] = image[:, :, 0] * 360
##to quantize the hue channel
image[:, :, 0] = np.floor(image[:, :, 0] / hue_angel)
##to quantize the ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __get_color_histogram(self, image, seed, hist_res):\n \n L=[]\n N=len(seed)\n for i in range(N):\n \n L.append(image[seed[i][1],seed[i][0]])\n image_part=np.array(L)\n \n \n hist, bins= np.histogramdd(image_part,bins=hist_res,range=(... | [
"0.77610314",
"0.66893625",
"0.66651684",
"0.6619138",
"0.6619138",
"0.66065186",
"0.65624034",
"0.6525471",
"0.6519547",
"0.6446847",
"0.6403581",
"0.64008254",
"0.6332783",
"0.6327807",
"0.63175243",
"0.6307054",
"0.63022804",
"0.62848115",
"0.6281426",
"0.6280157",
"0.6250... | 0.6640783 | 3 |
Create the CNNbased VGGVox network. | def create_vggvox(embedding_dims, name="vggvox"):
model = tf.keras.Sequential(name=name)
model.add(tf.keras.layers.Conv2D(96, (7,7), strides=(2,2), padding="valid", kernel_regularizer=tf.keras.regularizers.L2(5e-4), name=f"{name}_conv1"))
model.add(tf.keras.layers.BatchNormalization())
model.add(tf.kera... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def build_cnn_vgg16(num_classes):\n\n inputs = tf.keras.layers.Input(\n shape=(IMAGE_WIDTH, IMAGE_HEIGHT, IMAGE_CHANNELS)\n )\n\n x = inputs\n x = tf.keras.applications.vgg16.preprocess_input(x)\n vgg16 = tf.keras.applications.VGG16(\n input_shape=(IMAGE_WIDTH, IMAGE_HEIGHT, IMAGE_CHAN... | [
"0.7322704",
"0.6791889",
"0.65735775",
"0.6552071",
"0.6527432",
"0.65044916",
"0.6386492",
"0.6235916",
"0.61602706",
"0.6134187",
"0.61276627",
"0.6113917",
"0.60892016",
"0.6071353",
"0.6034728",
"0.60309875",
"0.6021277",
"0.60104567",
"0.59990096",
"0.59714264",
"0.5953... | 0.6815435 | 1 |
It returns a random datetime for an action. The date is the same because the feature vectors represent one day. | def actionDate():
year = 2010
month = 1
day = 1
hour=random.randint(0, 23)
minute=random.randint(0, 59)
second=random.randint(0, 59)
action_date = datetime(year, month, day,hour,minute,second)
return action_date | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def random_date():\n random.seed(time.time())\n d = random.randint(1, int(time.time()))\n return f'({str(datetime.date.fromtimestamp(d).strftime(\"%Y-%m-%d\"))}): '",
"def randomAction():\n return np.random.randint(0, POSSIBLE_ACTIONS)",
"def _random_datetime(since):\n epoch = datetime.fromtimes... | [
"0.67627794",
"0.6414378",
"0.63613445",
"0.6243414",
"0.6182269",
"0.6135912",
"0.61177224",
"0.61069715",
"0.6046192",
"0.60307497",
"0.60301226",
"0.6001211",
"0.59846056",
"0.5977574",
"0.5951338",
"0.5926349",
"0.5904979",
"0.59030706",
"0.59013766",
"0.59011006",
"0.590... | 0.7744575 | 0 |
It returns a random dictionary representing an action. The dictionary contains the features used in the feature vector. This function is used for generating the individuals. | def action():
action={}
action["type"]=random.choice(actions)
action["date"]=actionDate()
if action["type"]=="file":
action["to_removable_media"]=random.choice([True,False])
action["from_removable_media"]=random.choice([True,False])
elif action["type"]=="email":
action[... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _make_random_action(action_spec, observation):\n # Sample the random action.\n action = {}\n for name, spec in action_spec.items():\n if name == \"Index\":\n value = np.random.randint(observation[\"n_edge\"])\n elif spec.dtype in (np.int32, np.int64, int):\n value = np.random.randint(spec.mi... | [
"0.7402817",
"0.6642857",
"0.6581579",
"0.6578079",
"0.6541414",
"0.65054214",
"0.6486383",
"0.6444103",
"0.6410835",
"0.6410835",
"0.6379502",
"0.63443136",
"0.6310342",
"0.63013667",
"0.6275897",
"0.6275897",
"0.6275897",
"0.6275897",
"0.6275897",
"0.6270036",
"0.62359077",... | 0.6702051 | 1 |
Returns the minimax action using self.depth and self.evaluationFunction | def getAction(self, gameState):
"*** YOUR CODE HERE ***"
util.raiseNotDefined() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getAction(self, gameState: GameState):\n _max = float(\"-inf\")\n action = None\n for move in gameState.getLegalActions(0):\n util = minimax(self.evaluationFunction, 1, 0,\n gameState.generateSuccessor(0, move), self.depth)\n if util > _max o... | [
"0.7482665",
"0.7383559",
"0.71806973",
"0.7110041",
"0.70884514",
"0.70694935",
"0.70683014",
"0.7048308",
"0.70055133",
"0.69651455",
"0.69642085",
"0.69604385",
"0.6945924",
"0.68998593",
"0.6895832",
"0.688605",
"0.6826282",
"0.6767276",
"0.6758028",
"0.6751636",
"0.67054... | 0.0 | -1 |
Creates single line of points with random scatter | def make_line(x = np.linspace(start = 0, stop = 50, num = 200), slope = 2, intercept = 0, noise = 3):
return np.c_[x, slope * x + intercept + np.random.normal(loc = 0, scale = 3, size = len(x))] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def scatter_and_line():\n\n # Make random data points around straight line\n random_linear = np.zeros((1000,2))\n random_linear[:,0] = np.random.uniform(0,10,1000)\n random_error = np.random.normal(0.0,2.0,1000)\n random_linear[:,1] = random_linear[:,0]*2.0+1.0+random_error\n\n # Make datasets, o... | [
"0.70299983",
"0.7027782",
"0.6738985",
"0.6670886",
"0.6392107",
"0.6252341",
"0.6252147",
"0.62143725",
"0.61755455",
"0.61548096",
"0.61548096",
"0.61168134",
"0.61009663",
"0.60134035",
"0.60028386",
"0.5994055",
"0.5992758",
"0.5928514",
"0.59090966",
"0.59038293",
"0.58... | 0.7032951 | 0 |
Return the current learned max action for this layer. If there's a tie, pick randomly. | def act(self,observation):
maximum_actions = np.argwhere(self.q_table[observation] == np.amax(self.q_table[observation])).flatten()
return(np.random.choice(maximum_actions)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def best_action(self, state):\n return random.choice(self.possible_actions)",
"def _select_action(self):\n if self.eval_mode:\n self._log_values()\n epsilon = self.epsilon_eval\n else:\n epsilon = self.epsilon_fn(\n self.epsilon_decay_period,\n self.training_steps,\n... | [
"0.75688136",
"0.7414877",
"0.7309198",
"0.7180425",
"0.715837",
"0.71217954",
"0.7120357",
"0.71075594",
"0.70072424",
"0.6957295",
"0.6916205",
"0.68773335",
"0.68628496",
"0.6857883",
"0.68274564",
"0.6812019",
"0.6797898",
"0.6796421",
"0.6794801",
"0.6769139",
"0.6757414... | 0.6491383 | 55 |
Adds trajectory data to the replay buffer as an experience tuple. | def add(self, state, action, reward, next_state, done):
self.replay_buffer.append([state, action, reward, next_state, done]) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add(self, experience):\n self.buffer.append(experience)",
"def store_experience(self, s, a, r, t, s2):\n self.replay_buffer.add(s, a, r, t, s2)",
"def add_experience(self, action, state, reward, terminal):\n self.replay_buffer.add_experience(action, state, reward, terminal)",
"def ap... | [
"0.7146182",
"0.6984555",
"0.6958818",
"0.6886315",
"0.68080366",
"0.68048733",
"0.63214",
"0.6320373",
"0.6175384",
"0.61359966",
"0.60723585",
"0.60425645",
"0.6015589",
"0.5782508",
"0.56889117",
"0.56476986",
"0.5636533",
"0.5600057",
"0.55849326",
"0.55462646",
"0.553728... | 0.59499305 | 13 |
Assumes that the binary tree rooted at Left(i) and Right(i) are maxheaps but that A[i] may be smaller than its children. Maxheapify lets A[i] float down in order to satisfy the maxheap property. | def max_heapify(heap, i):
left_child = left(i)
right_child = right(i)
if left_child < len(heap) and heap[left_child] > heap[i]:
largest = left_child
else:
largest = i
if right_child < len(heap) and heap[right_child] > heap[largest]:
largest = right_child
if largest != i:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def max_heapify_unrecursive(heap, i):\n while True:\n left_child = left(i)\n right_child = right(i)\n largest = i\n if left_child < len(heap) and heap[left_child] > heap[i]:\n largest = left_child\n if right_child < len(heap) and heap[right_child] > heap[largest]:\n... | [
"0.7772092",
"0.77652186",
"0.77652186",
"0.7668517",
"0.7623644",
"0.76188666",
"0.7618111",
"0.7618111",
"0.76124156",
"0.748617",
"0.74184746",
"0.739765",
"0.7358091",
"0.7290106",
"0.72340876",
"0.72198653",
"0.7152778",
"0.71482074",
"0.70296985",
"0.7029596",
"0.699684... | 0.7668567 | 3 |
Assumes that the binary tree rooted at Left(i) and Right(i) are maxheaps but that A[i] may be smaller than its children. Maxheapify lets A[i] float down in order to satisfy the maxheap property. | def max_heapify_unrecursive(heap, i):
while True:
left_child = left(i)
right_child = right(i)
largest = i
if left_child < len(heap) and heap[left_child] > heap[i]:
largest = left_child
if right_child < len(heap) and heap[right_child] > heap[largest]:
l... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def max_heapify(self, A, i):\n left = 2*i + 1\n right = 2*i + 2\n largest = i\n if left < len(A) and A[left] > A[largest]:\n largest = left\n if right < len(A) and A[right] > A[largest]:\n largest = right\n if largest != i:\n A[i], A[larges... | [
"0.77652186",
"0.77652186",
"0.7668567",
"0.7668517",
"0.7623644",
"0.76188666",
"0.7618111",
"0.7618111",
"0.76124156",
"0.748617",
"0.74184746",
"0.739765",
"0.7358091",
"0.7290106",
"0.72340876",
"0.72198653",
"0.7152778",
"0.71482074",
"0.70296985",
"0.7029596",
"0.699684... | 0.7772092 | 0 |
Creating a test pandas DataFrame for the unittest suite | def create_test_df():
test_df = pd.DataFrame({'id': [i for i in range(1, 1001)], 'member_id': [
10 * i for i in range(1, 1001)]})
test_df['na_col'] = np.nan
test_df['id_na'] = test_df.id
test_df.loc[1:3, 'id_na'] = np.nan
test_df['constant_col'] = 'constant'
test_df['c... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_create_from_dataframe(self):\n self.insert()\n data = self.tbl.select()\n data.index.name = None\n tbl = Table.create(':memory:', \"Foo_2\", data, verbose=True,\n primary_key='id', autoincrement=True)\n self.check(self.idata, tbl.select())",
"... | [
"0.7318057",
"0.7269529",
"0.706281",
"0.7061761",
"0.69802266",
"0.6833746",
"0.67476183",
"0.6718155",
"0.66113913",
"0.6603952",
"0.6567888",
"0.65306455",
"0.6464041",
"0.6457677",
"0.6276743",
"0.62649304",
"0.62649304",
"0.6251305",
"0.6246706",
"0.6236921",
"0.6235844"... | 0.56997293 | 90 |
Compute W X + b and (W X + b)^2, where X is the input data, W is the coefficient of lr, and b is the interception | def compute_forward(self, data_instances, coef_, intercept_, batch_index=-1):
wx = self.compute_wx(data_instances, coef_, intercept_)
en_wx = self.encrypted_calculator[batch_index].encrypt(wx)
wx_square = wx.mapValues(lambda v: np.square(v))
en_wx_square = self.encrypted_calculator[batc... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def linreg(X, w, b): #@save\n return d2l.matmul(X, w) + b",
"def linreg(X, w, b):\n return torch.matmul(X, w) + b",
"def forward(self, w_value, x1_value, x2_value, b_value):\n self.inputs = [w_value, x1_value, x2_value, b_value]\n\n x_input = np.asarray([x1_value, x2_value]).T\n # r... | [
"0.7373504",
"0.71447337",
"0.6927581",
"0.69215405",
"0.69199157",
"0.687854",
"0.6832769",
"0.68310237",
"0.68173206",
"0.6807544",
"0.6779935",
"0.6755962",
"0.67552346",
"0.6660506",
"0.6654519",
"0.6599179",
"0.65974444",
"0.6589002",
"0.65668917",
"0.6556083",
"0.651290... | 0.0 | -1 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.