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 |
|---|---|---|---|---|---|---|
Allows the player to shoot | def shoot(self):
shots = Shooting(self.rect.centerx, self.rect.bottom)
# Adding the shots to sprite lists created
all_sprites_list.add(shots)
shooting_list.add(shots) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def shoot(self):\n if self.direction == 'left':\n self.__temp_bullet = Bullet(self.position, 60)\n elif self.direction == 'forward':\n self.__temp_bullet = Bullet(self.position, 90)\n else:\n self.__temp_bullet = Bullet(self.position, 120)\n global game\... | [
"0.80809397",
"0.8012624",
"0.7971491",
"0.7872927",
"0.7853581",
"0.7793993",
"0.7597245",
"0.7568956",
"0.75139403",
"0.7349142",
"0.73120654",
"0.72405666",
"0.7058246",
"0.7041339",
"0.6946263",
"0.69413495",
"0.67526096",
"0.6670377",
"0.6646319",
"0.6629719",
"0.6578022... | 0.7421705 | 9 |
Gets the group_id of this BasicMediaInfo. The value is a quotedstring which specifies the group to which the Rendition belongs. (required) | def group_id(self):
# type: () -> string_types
return self._group_id | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def group_id(self) -> str:\n return pulumi.get(self, \"group_id\")",
"def group_id(self) -> str:\n return pulumi.get(self, \"group_id\")",
"def group_id(self):\n return self._group_id",
"def group_id(self):\n return self._group_id",
"def group_id(self):\n return self._gro... | [
"0.7744338",
"0.7744338",
"0.7518653",
"0.7518653",
"0.7518653",
"0.7485775",
"0.74613166",
"0.73519087",
"0.7325377",
"0.725024",
"0.725024",
"0.725024",
"0.7178078",
"0.7149421",
"0.70440006",
"0.7010923",
"0.7008884",
"0.6990607",
"0.6932389",
"0.68182284",
"0.6766214",
... | 0.76340955 | 2 |
Sets the group_id of this BasicMediaInfo. The value is a quotedstring which specifies the group to which the Rendition belongs. (required) | def group_id(self, group_id):
# type: (string_types) -> None
if group_id is not None:
if not isinstance(group_id, string_types):
raise TypeError("Invalid type for `group_id`, type has to be `string_types`")
self._group_id = group_id | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def group_id(self, group_id):\n\n self._group_id = group_id",
"def group_id(self, group_id):\n\n self._group_id = group_id",
"def group_id(self, group_id):\n\n self._group_id = group_id",
"def group_id(self, group_id):\n\n self._group_id = group_id",
"def group_id(self, group_id... | [
"0.76041365",
"0.76041365",
"0.76041365",
"0.76041365",
"0.76041365",
"0.76041365",
"0.7352944",
"0.7017769",
"0.7017472",
"0.6856156",
"0.6840743",
"0.67580765",
"0.67364985",
"0.6718156",
"0.6629168",
"0.6584337",
"0.6502826",
"0.6502826",
"0.6502826",
"0.64600736",
"0.6460... | 0.75070316 | 6 |
Gets the language of this BasicMediaInfo. Primary language in the rendition. | def language(self):
# type: () -> string_types
return self._language | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_language(self):\n return self.lang",
"def get_language(self):\r\n return self.language",
"def language(self):\r\n return self._get('language', {})",
"def language(self):\n return self._language",
"def language(self):\n return self._language",
"def language(self)... | [
"0.74727803",
"0.7425446",
"0.73527855",
"0.72427624",
"0.72427624",
"0.72427624",
"0.72427624",
"0.7241287",
"0.7208736",
"0.71746665",
"0.7138882",
"0.70703816",
"0.70245844",
"0.70207906",
"0.7010202",
"0.7010202",
"0.7005744",
"0.6998718",
"0.6918595",
"0.690155",
"0.6894... | 0.69436747 | 19 |
Gets the assoc_language of this BasicMediaInfo. Identifies a language that is associated with the Rendition. | def assoc_language(self):
# type: () -> string_types
return self._assoc_language | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_language(self):\n return self.lang",
"def language(self):\r\n return self._get('language', {})",
"def getLanguage(self):\n return self.getOrDefault(self.language)",
"def get_language(self):\r\n return self.language",
"def get_lang(self):\n return self.langs.lang",... | [
"0.6671905",
"0.66652405",
"0.6527904",
"0.65121096",
"0.6506531",
"0.6502763",
"0.64193994",
"0.64193994",
"0.64193994",
"0.64193994",
"0.63813084",
"0.63741636",
"0.63135594",
"0.6306226",
"0.62920815",
"0.6174085",
"0.61458266",
"0.6144181",
"0.61361057",
"0.6131683",
"0.6... | 0.7522343 | 0 |
Sets the name of this BasicMediaInfo. Human readable description of the rendition. (required) | def name(self, name):
# type: (string_types) -> None
if name is not None:
if not isinstance(name, string_types):
raise TypeError("Invalid type for `name`, type has to be `string_types`")
self._name = name | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def setDisplayName( self, name ):\n self._displayName = name\n self._titleFont = None",
"def set_name(self, name):\n\t\tself.name_ = name",
"def set_name(self, name):\n self.name = name",
"def set_name(self, name):\n self.name = name",
"def set_name(self, name):\n self.na... | [
"0.7006726",
"0.68664527",
"0.6827332",
"0.6827332",
"0.6827332",
"0.6827332",
"0.6827332",
"0.67735875",
"0.67122954",
"0.67068714",
"0.6691246",
"0.6691246",
"0.66699463",
"0.66699463",
"0.66699463",
"0.66699463",
"0.66555834",
"0.66500026",
"0.6634565",
"0.6616306",
"0.661... | 0.0 | -1 |
Gets the is_default of this BasicMediaInfo. If set to true, the client SHOULD play this Rendition of the content in the absence of information from the user. | def is_default(self):
# type: () -> bool
return self._is_default | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def default(self) -> Optional[bool]:\n return pulumi.get(self, \"default\")",
"def default(self) -> Optional[bool]:\n return pulumi.get(self, \"default\")",
"def default(self) -> Optional[bool]:\n return pulumi.get(self, \"default\")",
"def default(self) -> Optional[bool]:\n retur... | [
"0.67414325",
"0.67414325",
"0.67414325",
"0.67414325",
"0.67414325",
"0.67210835",
"0.66778696",
"0.6659168",
"0.6509628",
"0.64745206",
"0.64168185",
"0.6349152",
"0.6340366",
"0.6314838",
"0.61628324",
"0.61373276",
"0.61373276",
"0.61373276",
"0.611449",
"0.6099207",
"0.6... | 0.6306083 | 14 |
Sets the is_default of this BasicMediaInfo. If set to true, the client SHOULD play this Rendition of the content in the absence of information from the user. | def is_default(self, is_default):
# type: (bool) -> None
if is_default is not None:
if not isinstance(is_default, bool):
raise TypeError("Invalid type for `is_default`, type has to be `bool`")
self._is_default = is_default | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_default(self, is_default):\n\n self._is_default = is_default",
"def set_is_default(self):\n self.is_default = True",
"def set_is_default(self):\n self.is_default = True",
"def is_default(self, is_default: bool):\n\n self._is_default = is_default",
"def is_default(self) ->... | [
"0.68981826",
"0.6897294",
"0.6897294",
"0.68842405",
"0.62286484",
"0.6150493",
"0.6095257",
"0.60927474",
"0.6071562",
"0.6048648",
"0.6048648",
"0.6048648",
"0.6048648",
"0.6048648",
"0.6017108",
"0.6007873",
"0.592837",
"0.58907527",
"0.5869578",
"0.58665115",
"0.58665115... | 0.65670514 | 4 |
Returns true if both objects are equal | def __eq__(self, other):
if not isinstance(other, BasicMediaInfo):
return False
return self.__dict__ == other.__dict__ | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __eq__(self, other):\n return are_equal(self, other)",
"def __eq__(self, other):\n return are_equal(self, other)",
"def __eq__(self,other):\n try: return self.object==other.object and isinstance(self,type(other))\n except: return False",
"def __eq__(self, other):\n if i... | [
"0.8088132",
"0.8088132",
"0.8054589",
"0.7982687",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
... | 0.0 | -1 |
Returns true if both objects are not equal | def __ne__(self, other):
return not self == other | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __ne__(self, other: object) -> bool:\n if self.__eq__(other):\n return False\n return True",
"def __ne__(self, other: object) -> bool:\n return not self.__eq__(other)",
"def __ne__(self, other) -> bool:\n return not self.__eq__(other)",
"def __eq__(self, other):\n ... | [
"0.84568954",
"0.83923674",
"0.81447554",
"0.81407183",
"0.81326675",
"0.80941343",
"0.8092415",
"0.8092415",
"0.8092415",
"0.8085536",
"0.8085536",
"0.8076502",
"0.8076502",
"0.8066026"
] | 0.0 | -1 |
haversine Calculate the great circle distance between two points on the earth (specified in decimal degrees) | def haversine(p1, p2):
# Convert decimal degrees to radians
lon1, lat1, lon2, lat2 = map(np.radians, [p1[0], p1[1], p2[0], p2[1]])
# Haversine formula
dlon = lon2 - lon1
dlat = lat2 - lat1
a = np.sin(dlat/2)**2 + np.cos(lat1) * np.cos(lat2) * np.sin(dlon/2)**2
c = 2 * np.arcsin(np.sqrt(a))
r = 6... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def calc_distance_haversine(coord1, coord2):\n lat1, lon1 = coord1\n lat2, lon2 = coord2\n # approximate radius of earth in km\n R = 6373.0\n\n lat1 = radians(lat1)\n lon1 = radians(lon1)\n lat2 = radians(lat2)\n lon2 = radians(lon2)\n\n dlon = lon2 - lon1\n dlat = lat2 - lat1\n\n ... | [
"0.7955087",
"0.79357815",
"0.7848821",
"0.7732465",
"0.76866865",
"0.7675801",
"0.76693815",
"0.76271033",
"0.7601569",
"0.7578512",
"0.7578135",
"0.7569631",
"0.7541055",
"0.75382406",
"0.75330526",
"0.75203836",
"0.7512868",
"0.75111586",
"0.7509065",
"0.7504898",
"0.75013... | 0.7470173 | 28 |
Current number of free connections. | def freesize(self):
return len(self._pool) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _created_connections(self):\n return len(self._available_connections) + len(self._in_use_connections)",
"def getconnectioncount(self):\n return self.proxy.getconnectioncount()",
"def get_current_connection_num():\r\n\treturn (len(_clients), MAX_CONNECTION)",
"def open_connections(self):\n ... | [
"0.76301855",
"0.7480421",
"0.7400815",
"0.72397476",
"0.7081475",
"0.70574844",
"0.6938392",
"0.6894335",
"0.68404806",
"0.683371",
"0.68017334",
"0.67470473",
"0.6687894",
"0.6654184",
"0.6653789",
"0.66129214",
"0.66075736",
"0.6596236",
"0.659529",
"0.6558769",
"0.6552493... | 0.65308154 | 22 |
Executes Redis (p)subscribe/(p)unsubscribe commands. ConnectionsPool picks separate connection for pub/sub and uses it until explicitly closed or disconnected (unsubscribing from all channels/patterns will leave connection locked for pub/sub use). There is no autoreconnect for this PUB/SUB connection. Returns asyncio.g... | def execute_pubsub(self, command, *channels):
conn, address = self.get_connection(command)
if conn is not None:
return conn.execute_pubsub(command, *channels)
else:
return self._wait_execute_pubsub(address, command, channels, {}) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"async def _async_perform_subscriptions(self) -> None:\n # Section 3.3.1.3 in the specification:\n # http://docs.oasis-open.org/mqtt/mqtt/v3.1.1/os/mqtt-v3.1.1-os.html\n # When sending a PUBLISH Packet to a Client the Server MUST\n # set the RETAIN flag to 1 if a message is sent as a res... | [
"0.6156564",
"0.57711416",
"0.5700336",
"0.55934834",
"0.5496273",
"0.54314417",
"0.5308461",
"0.5294725",
"0.52448213",
"0.51908433",
"0.5184536",
"0.51831615",
"0.51070535",
"0.5095644",
"0.5087392",
"0.50775725",
"0.5070159",
"0.50598353",
"0.5056064",
"0.5036141",
"0.5033... | 0.53697276 | 6 |
Creating a flask app instance. | def create_app() -> Flask:
flask_app = Flask('extraction_api', template_folder='./template')
flask_app.secret_key = "super secret key"
# import blueprints
flask_app.register_blueprint(extraction_app)
return flask_app | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_app() -> Flask:\r\n app = Flask(__name__.split('.')[0])\r\n init_config(app)\r\n app.register_blueprint(observer)\r\n app.teardown_appcontext(close_db)\r\n app.cli.add_command(init_db)\r\n\r\n return app",
"def make_app() -> Flask:\n logger.info('creating flask application')\n ... | [
"0.8602246",
"0.8578524",
"0.8499399",
"0.84871274",
"0.84763163",
"0.8446552",
"0.84175724",
"0.8414441",
"0.83809495",
"0.83716947",
"0.8370931",
"0.83636427",
"0.8311942",
"0.8309481",
"0.829842",
"0.8289373",
"0.82830834",
"0.82766515",
"0.82755214",
"0.8196002",
"0.81891... | 0.83270144 | 12 |
Convert Kelvin to Jy. | def k_2_jy(freq: float, theta_major: float,
theta_minor: float, brightness: float) -> float:
conv = (1.222E3 * (freq ** -2) / theta_minor / theta_major) ** -1
return brightness * conv | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def kelvin_to_jansky(self):\n this_unit = self.stokes.unit\n if self.component_type == \"point\":\n if this_unit.is_equivalent(\"Jy\"):\n return\n\n else:\n if this_unit.is_equivalent(\"Jy/sr\"):\n return\n\n if self.spectral_type == \... | [
"0.7875373",
"0.68204033",
"0.665735",
"0.64137787",
"0.641071",
"0.6142055",
"0.6113219",
"0.6043583",
"0.6013736",
"0.5981386",
"0.5945813",
"0.59218603",
"0.588879",
"0.5869442",
"0.5869004",
"0.5774752",
"0.5733964",
"0.57099885",
"0.5606038",
"0.56034815",
"0.5555424",
... | 0.0 | -1 |
Convert Kelvin to Jy. | def jy_2_k(freq: float, theta_major: float,
theta_minor: float, intensity: float) -> float:
conv = 1.222E3 * (freq ** -2) / theta_minor / theta_major
return intensity * conv | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def kelvin_to_jansky(self):\n this_unit = self.stokes.unit\n if self.component_type == \"point\":\n if this_unit.is_equivalent(\"Jy\"):\n return\n\n else:\n if this_unit.is_equivalent(\"Jy/sr\"):\n return\n\n if self.spectral_type == \... | [
"0.7875373",
"0.68204033",
"0.665735",
"0.64137787",
"0.641071",
"0.6142055",
"0.6113219",
"0.6043583",
"0.6013736",
"0.5981386",
"0.5945813",
"0.59218603",
"0.588879",
"0.5869442",
"0.5869004",
"0.5774752",
"0.5733964",
"0.57099885",
"0.5606038",
"0.56034815",
"0.5555424",
... | 0.48723784 | 77 |
Redefinition of queryset for the view | def get_queryset(self):
queryset = []
if 'person_id' in self.request.GET:
if 'abandoned_pet' in self.request.GET:
queryset = (AnimalReport.objects
.filter(pet_name__exact='Sin nombre',
person__id=self.request.GET... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_queryset(self, request, queryset):\n\n return queryset",
"def get_queryset(self):\n return None",
"def get_queryset(self):\n return None",
"def get_queryset(self):\n return \"asdf\"",
"def get_queryset(self):\n return Data.objects.all()",
"def get_queryset(self)... | [
"0.77580863",
"0.74919105",
"0.74919105",
"0.73191786",
"0.6982991",
"0.69799757",
"0.6945096",
"0.68940383",
"0.680753",
"0.6797859",
"0.678566",
"0.67554003",
"0.67505884",
"0.6738525",
"0.6705272",
"0.6696201",
"0.66655976",
"0.66646045",
"0.6662832",
"0.6613625",
"0.65990... | 0.0 | -1 |
Redefinition of queryset for the view | def get_queryset(self):
queryset = []
if 'owner_id' in self.request.GET:
queryset = (AdoptionProposal.objects
.filter(owner__id=self.request.GET['owner_id'],
was_deleted=False))
elif 'all_adoptions' in self.request.GET:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_queryset(self, request, queryset):\n\n return queryset",
"def get_queryset(self):\n return None",
"def get_queryset(self):\n return None",
"def get_queryset(self):\n return \"asdf\"",
"def get_queryset(self):\n return Data.objects.all()",
"def get_queryset(self)... | [
"0.77580863",
"0.74919105",
"0.74919105",
"0.73191786",
"0.6982991",
"0.69799757",
"0.6945096",
"0.68940383",
"0.680753",
"0.6797859",
"0.678566",
"0.67554003",
"0.67505884",
"0.6738525",
"0.6705272",
"0.6696201",
"0.66655976",
"0.66646045",
"0.6662832",
"0.6613625",
"0.65990... | 0.0 | -1 |
Redefinition of queryset for the view | def get_queryset(self):
queryset = []
if 'requester_id' in self.request.GET:
queryset = (AdoptionRequest.objects
.filter(requester__id=self.request.GET['requester_id'],
was_deleted=False))
elif 'all_requests' in self.request.GET... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_queryset(self, request, queryset):\n\n return queryset",
"def get_queryset(self):\n return None",
"def get_queryset(self):\n return None",
"def get_queryset(self):\n return \"asdf\"",
"def get_queryset(self):\n return Data.objects.all()",
"def get_queryset(self)... | [
"0.77580863",
"0.74919105",
"0.74919105",
"0.73191786",
"0.6982991",
"0.69799757",
"0.6945096",
"0.68940383",
"0.680753",
"0.6797859",
"0.678566",
"0.67554003",
"0.67505884",
"0.6738525",
"0.6705272",
"0.6696201",
"0.66655976",
"0.66646045",
"0.6662832",
"0.6613625",
"0.65990... | 0.0 | -1 |
Redefinition of queryset for the view | def get_queryset(self):
if 'person_id' in self.request.GET:
queryset = (PersonDevice.objects
.filter(person__id=self.request.GET['person_id'],
is_active=True))
else:
queryset = PersonDevice.objects.all()
return query... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_queryset(self, request, queryset):\n\n return queryset",
"def get_queryset(self):\n return None",
"def get_queryset(self):\n return None",
"def get_queryset(self):\n return \"asdf\"",
"def get_queryset(self):\n return Data.objects.all()",
"def get_queryset(self)... | [
"0.7758069",
"0.7492047",
"0.7492047",
"0.7318507",
"0.6983895",
"0.69808275",
"0.69449794",
"0.6894011",
"0.6808662",
"0.6799053",
"0.6786407",
"0.67561245",
"0.67526394",
"0.6739662",
"0.67044777",
"0.66977024",
"0.6666523",
"0.6665512",
"0.66617286",
"0.6613299",
"0.659818... | 0.0 | -1 |
The customer's order name as represented by a number. | def name(self):
return '#{}'.format(self.number) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def customer_name(self):\n return self._customer_name",
"def order_id(self) -> str:\n return pulumi.get(self, \"order_id\")",
"def get_order_number(self):\n return self.__order_number",
"def order_num(self):\n return self._order_number",
"def _generate_order_number(self):\n ... | [
"0.6849181",
"0.66962224",
"0.65711325",
"0.65544474",
"0.6367801",
"0.6367801",
"0.6367801",
"0.6316952",
"0.62784624",
"0.6275947",
"0.6109979",
"0.60242456",
"0.5957377",
"0.58893764",
"0.5882132",
"0.5803484",
"0.57973886",
"0.5771144",
"0.57709724",
"0.57508004",
"0.5693... | 0.54115665 | 37 |
List of references to Child Firewall Policies. | def child_policies(self) -> Sequence['outputs.SubResourceResponse']:
return pulumi.get(self, "child_policies") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def policies(self):\n return self._policies",
"def policy_rules(self) -> Sequence[Any]:\n return pulumi.get(self, \"policy_rules\")",
"def policies(self):\n return self._data.get('policies')",
"def list_policies(self):\n client = self.connect(VAULT_TOKEN)\n return client.li... | [
"0.6730302",
"0.65190196",
"0.6350162",
"0.63173944",
"0.61577106",
"0.5981594",
"0.5949985",
"0.5874878",
"0.5726298",
"0.5655631",
"0.55554676",
"0.55089974",
"0.55089974",
"0.5488047",
"0.5471379",
"0.53890055",
"0.5385764",
"0.5375918",
"0.53614295",
"0.53436357",
"0.5296... | 0.7169707 | 0 |
The provisioning state of the firewall policy resource. | def provisioning_state(self) -> str:
return pulumi.get(self, "provisioning_state") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def provisioning_state(self) -> pulumi.Output[str]:\n return pulumi.get(self, \"provisioning_state\")",
"def provisioning_state(self) -> pulumi.Output[str]:\n return pulumi.get(self, \"provisioning_state\")",
"def provisioning_state(self) -> pulumi.Output[str]:\n return pulumi.get(self, \"... | [
"0.7416223",
"0.7416223",
"0.7416223",
"0.7416223",
"0.7416223",
"0.7416223",
"0.7416223",
"0.7416223",
"0.7416223",
"0.7416223",
"0.7416223",
"0.7416223",
"0.7416223",
"0.71560967",
"0.71560967",
"0.71560967",
"0.71560967",
"0.71560967",
"0.71447355",
"0.7060051",
"0.7060051... | 0.7467477 | 10 |
List of references to FirewallPolicyRuleGroups. | def rule_groups(self) -> Sequence['outputs.SubResourceResponse']:
return pulumi.get(self, "rule_groups") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def groups(self):\n return self._groups",
"def groups(self):\n return self._groups",
"def groups(self):\n return self._groups",
"def groups(self) -> list[Group]:\n return self._connection.groups",
"def list_groups(self):\n return self._get(\"cloudConnectorGroups\").list",... | [
"0.6412977",
"0.6412977",
"0.6412977",
"0.64028287",
"0.6275673",
"0.62389123",
"0.61738497",
"0.61678207",
"0.614894",
"0.6051928",
"0.6049074",
"0.6042556",
"0.6041664",
"0.6029369",
"0.598122",
"0.594204",
"0.59264416",
"0.58813184",
"0.5874842",
"0.5855018",
"0.5854471",
... | 0.6982175 | 0 |
Gets the specified Firewall Policy. | def get_firewall_policy(expand: Optional[str] = None,
firewall_policy_name: Optional[str] = None,
resource_group_name: Optional[str] = None,
opts: Optional[pulumi.InvokeOptions] = None) -> AwaitableGetFirewallPolicyResult:
__args__ = dict()
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_policy(client, policy_name):\n response = client.describe_firewall_policy(\n FirewallPolicyName=policy_name,\n )\n return response",
"def show_firewall_policy(self, firewall_policy, **_params):\r\n return self.get(self.firewall_policy_path % (firewall_policy),\r\n para... | [
"0.7600067",
"0.7164614",
"0.6898613",
"0.6873948",
"0.68403596",
"0.666988",
"0.6641741",
"0.6641741",
"0.6637925",
"0.660983",
"0.6607933",
"0.6607933",
"0.6607933",
"0.6574201",
"0.6561904",
"0.6425333",
"0.6425333",
"0.640234",
"0.6377556",
"0.6375393",
"0.6347025",
"0.... | 0.6624797 | 9 |
Gets the specified Firewall Policy. | def get_firewall_policy_output(expand: Optional[pulumi.Input[Optional[str]]] = None,
firewall_policy_name: Optional[pulumi.Input[str]] = None,
resource_group_name: Optional[pulumi.Input[str]] = None,
opts: Optional[pulumi.Invok... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_policy(client, policy_name):\n response = client.describe_firewall_policy(\n FirewallPolicyName=policy_name,\n )\n return response",
"def show_firewall_policy(self, firewall_policy, **_params):\r\n return self.get(self.firewall_policy_path % (firewall_policy),\r\n para... | [
"0.7600067",
"0.7164614",
"0.6898613",
"0.6873948",
"0.68403596",
"0.666988",
"0.6641741",
"0.6641741",
"0.6637925",
"0.6624797",
"0.660983",
"0.6607933",
"0.6607933",
"0.6607933",
"0.6574201",
"0.6561904",
"0.6425333",
"0.6425333",
"0.640234",
"0.6377556",
"0.6375393",
"0.... | 0.62007624 | 28 |
Mangles name to fit within a job or job definition name. Replaces any invalid character with a hyphen ```` Truncates to 128 characters in length | def sanitize_name(name: str) -> str:
return re.sub(r"[^A-Za-z0-9_-]", "-", name)[0:128] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sanitize_name(name):\n # For now just change dashes to underscores. Fix this more in the future\n return name.replace(\"-\", \"_\")",
"def clean_name(name, allowed_chars):\n ok = identifier_chars + allowed_chars\n newname = \"\".join(c if c in ok else \"-\" for c in name)\n newname = newname.l... | [
"0.6996575",
"0.69782454",
"0.6904501",
"0.68922323",
"0.6815889",
"0.67681015",
"0.66564244",
"0.6629587",
"0.65745246",
"0.6522151",
"0.64698684",
"0.63518167",
"0.635148",
"0.629317",
"0.6286371",
"0.6275571",
"0.6269354",
"0.625541",
"0.62528616",
"0.6250484",
"0.62209404... | 0.708637 | 0 |
Implements forward computation of an LSTM Cell. | def forward(self, input, last_hidden):
self._W_i = torch.cat((self._W_x2i, self._W_h2i), 0)
self._W_f = torch.cat((self._W_x2f, self._W_h2f), 0)
self._W_o = torch.cat((self._W_x2o, self._W_h2o), 0)
self._W_c = torch.cat((self._W_x2c, self._W_h2c), 0)
c_input = torch.cat((inpu... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def lstm_cell_forward(self, xt, a_prev, c_prev, parameters):\n\n # Retrieve parameters from \"parameters\"\n Wf = parameters[\"Wf\"]\n bf = parameters[\"bf\"]\n Wi = parameters[\"Wi\"]\n bi = parameters[\"bi\"]\n Wc = parameters[\"Wc\"]\n bc = parameters[\"bc\"]\n ... | [
"0.73502624",
"0.7103203",
"0.7047926",
"0.6995821",
"0.6939329",
"0.6935503",
"0.69174224",
"0.6869691",
"0.6842802",
"0.68338287",
"0.67739844",
"0.676034",
"0.67343676",
"0.670219",
"0.66921806",
"0.6662481",
"0.665855",
"0.6622885",
"0.66205496",
"0.6556064",
"0.6495878",... | 0.0 | -1 |
Add a list of tokens to a dict including Clause Text | def addtoks(indict): # type: ({}) -> {}
if 'Clause Text' not in indict:
return indict
cleantext = helpers.cleantext(indict['Clause Text'])
indict['Tokens'] = helpers.allngrams(cleantext, 1, 3)
return indict | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_to_dict(self, tokens):\n# TODO: ?add normalization of a token?\n for token in tokens:\n if self.embedding_words and (token not in self.embedding_words):\n continue\n self.freq[token] += 1\n if token not in self.tok2ind:\n index = len(sel... | [
"0.5847173",
"0.5839809",
"0.5622625",
"0.55497706",
"0.5452474",
"0.53491336",
"0.5269352",
"0.52266884",
"0.52117395",
"0.5203999",
"0.5167313",
"0.51555663",
"0.5144913",
"0.51415294",
"0.51318014",
"0.5021255",
"0.50116205",
"0.5008188",
"0.499992",
"0.4979002",
"0.496572... | 0.74350375 | 0 |
Builds arguments for the classifier. Must be the same for training and predicting. Duplicated from the dteulaml module. | def buildbertargs(): # type: () -> ClassificationArgs
accargs = ClassificationArgs()
accargs.num_train_epochs = 5
accargs.fp16 = False
accargs.overwrite_output_dir = True
accargs.evaluate_during_training = False
accargs.sliding_window = True
accargs.max_seq_length = 256
accargs.stride = 0.9
accargs.l... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_training_args(self, input_dict, output_dict, exec_properties,\n executor_class_path, training_inputs,\n job_id) -> Dict[Text, Any]:\n pass",
"def get_arguments():\n\n # Creates the ArgumentParser\n parser = argparse.ArgumentParser(usage='Cre... | [
"0.66271406",
"0.6466037",
"0.637475",
"0.63587356",
"0.62261313",
"0.62216264",
"0.6214733",
"0.62035424",
"0.6202853",
"0.6160823",
"0.614936",
"0.6145644",
"0.6119006",
"0.61155653",
"0.6112391",
"0.6110488",
"0.61007434",
"0.60958797",
"0.6086938",
"0.6060722",
"0.6056219... | 0.7031987 | 0 |
We take this list and register all the keywords as corresponding Attrs. Returns dict The constructed Attrs dictionary ready to be passed into Attr registry. | def load_vso_values():
from sunpy.net import attrs as a
here = os.path.dirname(os.path.realpath(__file__))
with open(os.path.join(here, 'data', 'attrs.json')) as attrs_file:
keyword_info = json.load(attrs_file)
# Now to traverse the saved dict and give them attr keys.
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getAttributes(self, keysList=None):\n if isinstance(keysList, list):\n out = {}\n for key in keysList:\n out.update({key: self.attr(key)})\n return out\n return self.attributes",
"def _get_attribute_dic(self, attrs):\n attr_dic = {}\n ... | [
"0.6486973",
"0.63897216",
"0.6075578",
"0.6032674",
"0.60165906",
"0.5952443",
"0.5913239",
"0.58985764",
"0.58731234",
"0.58198225",
"0.5809611",
"0.5798326",
"0.5764707",
"0.5738768",
"0.5722063",
"0.5692315",
"0.5684085",
"0.5670495",
"0.5665545",
"0.5662319",
"0.5652466"... | 0.51015055 | 89 |
For checkboxes, returns True if checked, False otherwise. You may use the 'isChecked' widgetspec attribute to select widgets based on this attribute. | def is_checked(self):
return self._Widget__w['isChecked'] == 'true' | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def checkbox(self):\r\n return self._checkbox",
"def bool_checkbox(init: bool = False, descr: str = '', data_type: type[Data] = Data):\n\n class StdInpWidget_BoolCheckBox(StdInputWidgetBase, QCheckBox):\n def __init__(self, params):\n StdInputWidgetBase.__init__(self, para... | [
"0.69816476",
"0.67282224",
"0.6678438",
"0.6523116",
"0.6515853",
"0.6454397",
"0.6448246",
"0.6307851",
"0.6250418",
"0.61960214",
"0.61960214",
"0.61960214",
"0.6165086",
"0.6156428",
"0.60902536",
"0.59976304",
"0.5962852",
"0.5948357",
"0.5918977",
"0.58737135",
"0.58737... | 0.77636987 | 0 |
Return the name of the sensor. | def name(self) -> str:
return f"{NAME}: {self.location_name}" | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def name(self):\n return self._sensor.name",
"def get_sensor_name(self):\n return self.data[1]",
"def name(self):\n return self.device.device_data[self.device_id]['name'] + \\\n f' {self._sensor_type}'",
"def name(self):\n return f\"{self._name} {SENSOR_TYPES[self.senso... | [
"0.91896784",
"0.9168378",
"0.890185",
"0.8770976",
"0.8511273",
"0.8479953",
"0.844435",
"0.8299758",
"0.8186503",
"0.8105667",
"0.8079737",
"0.8066149",
"0.8049647",
"0.7700968",
"0.7612295",
"0.7611456",
"0.7600605",
"0.7600605",
"0.7600605",
"0.75392073",
"0.75166553",
... | 0.0 | -1 |
Return the state attributes. | def extra_state_attributes(self):
return {
ATTR_RADAR_COVERAGE: self._radar_coverage,
ATTR_HAS_PRECIPITATION: self._has_precipitation,
ATTR_RADAR_ONLINE: self._radar_online,
ATTR_FORECAST_JSON: self._forecast_json,
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def state_attributes(self):\n return self._attributes",
"def state_attributes(self):\n return self._attributes",
"def device_state_attributes(self):\r\n return self.attributes",
"def device_state_attributes(self):\n return self._state_attrs",
"def device_state_attributes(self):\... | [
"0.8953404",
"0.8953404",
"0.85239846",
"0.8366765",
"0.8366765",
"0.8363429",
"0.83362615",
"0.8334551",
"0.8310377",
"0.8292682",
"0.8289349",
"0.8289349",
"0.82871646",
"0.82871646",
"0.82871646",
"0.82871646",
"0.82871646",
"0.82871646",
"0.82871646",
"0.82871646",
"0.828... | 0.7638709 | 54 |
Combine data maps into one dictionary; keys are assumed to be unique | def map_union(*args):
union = {}
for d in args:
union.update(d)
return union | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _combine(mappings):\n return {k: v for d in mappings for k, v in d.items()}",
"def _full_mapping(self, data):\r\n x = self._empty_mapping()\r\n for key, value in data.items():\r\n x[key] = value\r\n return x",
"def dict_collate(data):\n\n # Assuming there's at least on... | [
"0.69060254",
"0.6723745",
"0.6362711",
"0.63546985",
"0.6353146",
"0.63312113",
"0.63154626",
"0.62248784",
"0.6187009",
"0.6135511",
"0.6135078",
"0.61142844",
"0.6079941",
"0.60314393",
"0.6009106",
"0.60024303",
"0.6002002",
"0.5996083",
"0.5984676",
"0.59433144",
"0.5902... | 0.55689275 | 43 |
Format split time strings | def split_format(splits):
fmt_splits = []
for split_idx, (split_label, split_str, dist) in enumerate(splits):
comps = split_str.split(':')
# if some splits are missing data (from original NYC data file)
if len(comps) == 3:
comps = map(int, comps)
split_mins = comp... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _splitTime(self, time): \n if (time):\n x = re.split(\"[-\\/\\s:]\", time)\n else:\n x = []\n # Pad the list to four elements (year,month,day,hour)\n while (len(x) < 4):\n x.append(None)\n return x",
"def sanitize(time_string): # Fix... | [
"0.6851544",
"0.6829646",
"0.6778137",
"0.65805477",
"0.65566266",
"0.6521784",
"0.6515614",
"0.64850885",
"0.647303",
"0.64085853",
"0.6394897",
"0.6389351",
"0.6350368",
"0.6347058",
"0.63266397",
"0.6315438",
"0.62187904",
"0.6214343",
"0.62095064",
"0.6187251",
"0.6162551... | 0.619503 | 19 |
Get Option current price for a stock. | def get_option_current_price(
symbol: str,
source: str = "Nasdaq",
):
source = re.sub(r"\s+", "", source.lower())
output = None
if source == "tradier":
output = tradier_model.get_last_price(symbol)
if source == "nasdaq":
output = nasdaq_model.get_last_price(symbol)
if source... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_stock_price(stock):\n pass",
"def get_current_price(self):\n URL = config.coin['price_hist_url'] + self.ticker.lower()\n try:\n r = requests.get(URL)\n data = json.loads(r.text)\n value = data['last']\n timestamp = data['timestamp']\n ... | [
"0.7457015",
"0.7202132",
"0.706304",
"0.69896203",
"0.69111705",
"0.6885935",
"0.6885935",
"0.6885935",
"0.6758065",
"0.6735321",
"0.66727895",
"0.66275835",
"0.6620624",
"0.65907836",
"0.65588456",
"0.6546673",
"0.6540347",
"0.65284336",
"0.65138215",
"0.6496175",
"0.647554... | 0.72416794 | 1 |
Gets the owner of this ExternalTestCaseVo. | def owner(self):
return self._owner | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getOwner(self):\r\n return self.owner",
"def getOwner(self):\n return self.__owner",
"def getOwner(self):\n return self.__owner",
"def get_owner(self):\n return self.__owner",
"def owner(self):\n answer = self._call('owner')\n return answer.owner",
"def get_o... | [
"0.7401358",
"0.7329532",
"0.7329532",
"0.73249996",
"0.7225218",
"0.71665806",
"0.71665806",
"0.71665806",
"0.71470755",
"0.71303606",
"0.7088521",
"0.69417244",
"0.69020617",
"0.68741006",
"0.67577094",
"0.6710066",
"0.66704595",
"0.6625297",
"0.65329593",
"0.650544",
"0.64... | 0.72395647 | 4 |
Sets the owner of this ExternalTestCaseVo. | def owner(self, owner):
self._owner = owner | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_owner(self, owner):\n self.__owner = owner",
"def owner(self, owner):\n\n self._owner = owner",
"def owner(self, owner):\n\n self._owner = owner",
"def owner(self, owner):\n\n self._owner = owner",
"def owner(self, owner):\n\n self._owner = owner",
"def owner(se... | [
"0.76651764",
"0.7450519",
"0.7450519",
"0.7450519",
"0.7450519",
"0.74109364",
"0.7344807",
"0.7272692",
"0.68501437",
"0.6814103",
"0.66430295",
"0.6607662",
"0.6542696",
"0.6536512",
"0.637345",
"0.6251796",
"0.6223583",
"0.6130928",
"0.6105041",
"0.6012421",
"0.59990907",... | 0.7480407 | 4 |
Gets the status of this ExternalTestCaseVo. | def status(self):
return self._status | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_status(self):\n return self.status",
"def get_status(self):\n return self.status",
"def get_status(self):\n return self.status",
"def get_status(self):\n return self._status",
"def GetStatus(self):\r\n return self.status",
"def getstatus(self):\n return self.... | [
"0.7370351",
"0.7370351",
"0.7370351",
"0.7328053",
"0.731082",
"0.7305869",
"0.72804815",
"0.7273043",
"0.7244956",
"0.715951",
"0.71422327",
"0.71059877",
"0.70900095",
"0.7082422",
"0.7082422",
"0.7063759",
"0.7043452",
"0.7025689",
"0.7025689",
"0.7025689",
"0.7022668",
... | 0.7039949 | 25 |
Sets the status of this ExternalTestCaseVo. | def status(self, status):
self._status = status | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def SetStatus(self, status):\r\n self.status = status",
"def set_status(self, status):\n self.status = status",
"def set_status(self, status):\n self.status = status",
"def set_status(self, status):\n self.status = status",
"def set_status(self, status):\n # TODO log to db\n ... | [
"0.74720204",
"0.74574775",
"0.74574775",
"0.74574775",
"0.7217731",
"0.72034925",
"0.7150217",
"0.7150217",
"0.7150217",
"0.7150217",
"0.7150217",
"0.7150217",
"0.7150217",
"0.7150217",
"0.7150217",
"0.7150217",
"0.7150217",
"0.7150217",
"0.7150217",
"0.7150217",
"0.7150217"... | 0.71993 | 8 |
Sets the execution_type of this ExternalTestCaseVo. | def execution_type(self, execution_type):
self._execution_type = execution_type | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_execution_type(self, type):\n self.execution_type = type",
"def execution_type(self):\n return self._execution_type",
"def test_type(self, test_type):\n self._test_type = test_type",
"def engine_type(self, engine_type):\n\n self._engine_type = engine_type",
"def set_type... | [
"0.8419352",
"0.6344177",
"0.62977034",
"0.61843383",
"0.5987937",
"0.5987937",
"0.5889781",
"0.58677995",
"0.57515615",
"0.57515615",
"0.57515615",
"0.57515615",
"0.5713515",
"0.56679076",
"0.56599903",
"0.56400657",
"0.56306136",
"0.5538529",
"0.5538529",
"0.5529665",
"0.55... | 0.8312533 | 1 |
Gets the test_type of this ExternalTestCaseVo. | def test_type(self):
return self._test_type | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_test_type(self):\n return self.test_type",
"def TestTrafficType(self):\n\t\treturn self._get_attribute('testTrafficType')",
"def type(self) -> Optional[pulumi.Input['TestIssueType']]:\n return pulumi.get(self, \"type\")",
"def get_type(self):\n return self.type",
"def get_type(... | [
"0.8191381",
"0.6356383",
"0.62645733",
"0.6219949",
"0.6219949",
"0.6179255",
"0.6178711",
"0.6178711",
"0.6160917",
"0.61268353",
"0.61233217",
"0.6106273",
"0.60561144",
"0.6031596",
"0.60289514",
"0.60203654",
"0.60183007",
"0.5993892",
"0.59834045",
"0.59405863",
"0.5940... | 0.7571162 | 1 |
Sets the test_type of this ExternalTestCaseVo. | def test_type(self, test_type):
self._test_type = test_type | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_type(self, type):\n self.type = type",
"def set_type(self, type):\n self.type = type",
"def SetType(self, ct_type):\r\n\r\n self._type = ct_type",
"def set_type(self, type):\n self._type = type",
"def set_execution_type(self, type):\n self.execution_type = type",
... | [
"0.65408254",
"0.65408254",
"0.6500347",
"0.64166605",
"0.61817133",
"0.6155414",
"0.6155414",
"0.601633",
"0.59760565",
"0.59760565",
"0.59760565",
"0.59760565",
"0.59760565",
"0.59760565",
"0.59760565",
"0.59760565",
"0.59760565",
"0.59760565",
"0.59760565",
"0.59760565",
"... | 0.79999423 | 0 |
Sets the create_info of this ExternalTestCaseVo. | def create_info(self, create_info):
self._create_info = create_info | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_order_info(self, create_order_info):\n\n self._create_order_info = create_order_info",
"def create_info(self):\n return self._create_info",
"def create_at(self, create_at):\n\n self._create_at = create_at",
"def created(self, created):\n\n self._created = created",
"d... | [
"0.6655952",
"0.62354064",
"0.58967954",
"0.5744094",
"0.5744094",
"0.5744094",
"0.5744094",
"0.5744094",
"0.5744094",
"0.5744094",
"0.5744094",
"0.5744094",
"0.5744094",
"0.5744094",
"0.5744094",
"0.5744094",
"0.5637954",
"0.5637954",
"0.5637954",
"0.5608099",
"0.5567731",
... | 0.7913596 | 0 |
Returns true if both objects are equal | def __eq__(self, other):
if not isinstance(other, ExternalTestCaseVo):
return False
return self.__dict__ == other.__dict__ | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __eq__(self, other):\n return are_equal(self, other)",
"def __eq__(self, other):\n return are_equal(self, other)",
"def __eq__(self,other):\n try: return self.object==other.object and isinstance(self,type(other))\n except: return False",
"def __eq__(self, other):\n if i... | [
"0.8088132",
"0.8088132",
"0.8054589",
"0.7982687",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
... | 0.0 | -1 |
Returns true if both objects are not equal | def __ne__(self, other):
return not self == other | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __ne__(self, other: object) -> bool:\n if self.__eq__(other):\n return False\n return True",
"def __ne__(self, other: object) -> bool:\n return not self.__eq__(other)",
"def __ne__(self, other) -> bool:\n return not self.__eq__(other)",
"def __eq__(self, other):\n ... | [
"0.845611",
"0.8391477",
"0.8144138",
"0.81410587",
"0.8132492",
"0.8093973",
"0.80920255",
"0.80920255",
"0.80920255",
"0.8085325",
"0.8085325",
"0.8076365",
"0.8076365",
"0.8065748"
] | 0.0 | -1 |
Test a synthesized transaction that is BIP69 compliant. | def test_is_bip69_with_properly_sorted_inputs_and_outputs(self):
self.assertTrue(bip69.is_bip69(self.bip69_synth)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_submit_iso20022_payment_instruction(self):\n pass",
"def test_is_bip69_0a6a357e(self):\n self.assertFalse(bip69.is_bip69(self.tx_json_0a6a357e))",
"def test_retrieve_iso20022_payment_instruction(self):\n pass",
"def test_transmission(i07_nexus: I07Nexus, transmission):\n asse... | [
"0.6187629",
"0.59710443",
"0.5950973",
"0.5787972",
"0.57563645",
"0.5676197",
"0.56695527",
"0.5643976",
"0.56119925",
"0.56082743",
"0.55944914",
"0.5578097",
"0.5562362",
"0.55523604",
"0.5530651",
"0.54912794",
"0.5457399",
"0.54545516",
"0.54425377",
"0.5419698",
"0.541... | 0.50848234 | 96 |
Replace discrete curves with bspline or Arc and return the result as a new Path2D object. | def simplify_spline(path, smooth=None, verbose=False):
new_vertices = []
new_entities = []
scale = path.scale
for discrete in path.discrete:
circle = is_circle(
discrete, scale=scale, verbose=verbose)
if circle is not None:
# the points are circular enough for o... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def bspline_curve2d():\n # Create a curve instance\n curve = BSpline.Curve()\n\n # Set curve degree\n curve.degree = 3\n\n # Set control points\n curve.ctrlpts = [[5.0, 5.0], [10.0, 10.0], [20.0, 15.0], [35.0, 15.0], [45.0, 10.0], [50.0, 5.0]]\n\n # Set knot vector\n curve.knotvector = [0.0... | [
"0.65004754",
"0.5892353",
"0.5497421",
"0.5494684",
"0.5483117",
"0.5345405",
"0.5276449",
"0.5270216",
"0.52626777",
"0.5243076",
"0.52338976",
"0.5217894",
"0.5204865",
"0.52013093",
"0.51365924",
"0.5136449",
"0.51345384",
"0.5118991",
"0.51046276",
"0.5098093",
"0.509346... | 0.62413096 | 1 |
Remove the first element from the data structure, and return it. If the data structure is empty, then this will raise a ValueError. | def remove(self):
pass | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _pop_first(self) -> Any:\n if self.is_empty():\n raise IndexError\n return self.pop(0)",
"def delete(self):\n first = self.data[0]\n self.data.pop(0)\n self.size = self.size - 1\n return first",
"def removeFirst(self):\n if self.__nelems == 0:\n ... | [
"0.81372833",
"0.7913723",
"0.77806115",
"0.7623038",
"0.7495042",
"0.7428607",
"0.7400164",
"0.73633635",
"0.7256592",
"0.7199612",
"0.7198341",
"0.7188407",
"0.718763",
"0.71354795",
"0.7089998",
"0.7084029",
"0.7066872",
"0.7042107",
"0.70413125",
"0.70300096",
"0.7021679"... | 0.0 | -1 |
Return True if the tile (m, n) has been cleaned. Assumes that (m, n) represents a valid tile inside the room. | def isTileCleaned(self, m, n):
#check if tile is in array of tilesCleaned
return (m,n) in self.tilesCleaned
#raise NotImplementedError #refer https://docs.python.org/2/library/exceptions.html | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def isTileCleaned(self, m, n):\n if (m, n) in self.clean_tiles:\n return True\n return False",
"def isTileCleaned(self, m, n):\n return self.tiles[n][m] == True",
"def isTileCleaned(self, m, n):\n \n if self.tiles[Position(m, n)] == 'clean':\n return Tru... | [
"0.8859346",
"0.88561255",
"0.8599322",
"0.85316443",
"0.8470071",
"0.84688216",
"0.71478987",
"0.63962406",
"0.6343942",
"0.6321855",
"0.626805",
"0.62539774",
"0.6246379",
"0.6233618",
"0.62213933",
"0.62103283",
"0.61936355",
"0.6128098",
"0.6123568",
"0.6123224",
"0.60974... | 0.8514898 | 4 |
Return the total number of tiles in the room. | def getNumTiles(self):
#raise NotImplementedError #refer https://docs.python.org/2/library/exceptions.html
return self.width * self.height | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getNumTiles(self):\n return self.height * self.width",
"def getNumTiles(self):\n return len(list(product(list(range(self.width+1))[1:], list(range(self.height+1))[1:])))",
"def getNumTiles(self):\n return (self.width) * (self.height)",
"def num_tiles(self):\n return self.num_row_t... | [
"0.8205867",
"0.81903553",
"0.81504375",
"0.8046322",
"0.8039323",
"0.79811716",
"0.78123623",
"0.7472709",
"0.7407938",
"0.7151273",
"0.7067083",
"0.6982381",
"0.69224",
"0.6857802",
"0.6832814",
"0.6813225",
"0.67038375",
"0.66893554",
"0.66816777",
"0.6676057",
"0.66583914... | 0.7871275 | 6 |
Return a random position inside the room. | def getRandomPosition(self):
#random.seed(1)#for repeatable results.
#pos[0] = random.randint(0, self.width-1) # -1 since randint Returns a random integer N such that a <= N <= b.
#pos[1] = random.randint(0, self.height-1)# -1 since randint Returns a random integer N such that a <= N <= b.
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getRandomPosition(self):\n return Position(random.random()*self.w, random.random()*self.h)",
"def getRandomPosition(self):\n x = random.randint(0, self.width - 1)\n y = random.randint(0, self.height - 1)\n return Position(x, y)",
"def getRandomPosition(self):\n return Pos... | [
"0.8410266",
"0.8409263",
"0.83399147",
"0.8332629",
"0.8331053",
"0.8254226",
"0.8129554",
"0.797593",
"0.7963437",
"0.7894027",
"0.7696598",
"0.748067",
"0.7456884",
"0.7377545",
"0.7319988",
"0.73094857",
"0.722083",
"0.7114603",
"0.70972973",
"0.7072915",
"0.70168024",
... | 0.7990292 | 7 |
Return True if pos is inside the room. | def isPositionInRoom(self, pos):
#note to self '&' is bitwise, 'and' is a boolean operation
#NB: python permits the a<b<c syntax used below, doesn't need verbose 'and' tests.
#ie: 0 <= pos.getX() and pos.getX() <= self.width and 0 <= pos.getY() and pos.getY() <= self.height
return 0 <= ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def isPositionInRoom(self, pos):\n posX = pos.getX()\n posY = pos.getY()\n if posX >= 0 and posX < self.width and posY >= 0 and posY < self.height:\n return True\n return False",
"def isPositionInRoom(self, pos):\n if pos.getX() >= 0 and pos.getX() < self.w:\n ... | [
"0.85856265",
"0.85830444",
"0.8501791",
"0.8394953",
"0.8270461",
"0.79472804",
"0.7664707",
"0.75780624",
"0.7245776",
"0.7134537",
"0.70549065",
"0.7034335",
"0.6900973",
"0.6892583",
"0.6865422",
"0.6829012",
"0.6828001",
"0.6822237",
"0.68087435",
"0.68055147",
"0.679743... | 0.81534183 | 5 |
Initializes a Robot with the given speed in the specified room. The robot initially has a random direction and a random position in the room. The robot cleans the tile it is on. | def __init__(self, room, speed):
self.room = room
self.position = room.getRandomPosition()
# clean position the robot is on.
self.room.cleanTileAtPosition(self.position)
#set random value for direction
self.direction = random.random()*360
self.speed = speed
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self, room, speed):\n self.room = room\n self.speed = speed\n self.position = room.getRandomPosition()\n #then clean this first tile!\n self.room.cleanTileAtPosition(self.position)\n self.direction = random.randrange(0,359)\n #raise NotImplementedError"... | [
"0.77287114",
"0.7722448",
"0.75918645",
"0.61847484",
"0.59519863",
"0.5862084",
"0.58486176",
"0.58040684",
"0.5796448",
"0.57881516",
"0.5760611",
"0.5733108",
"0.56587875",
"0.5609989",
"0.5556775",
"0.55566055",
"0.55494237",
"0.54858524",
"0.54460394",
"0.54385936",
"0.... | 0.8125707 | 0 |
Set the direction of the robot to DIRECTION. | def setRobotDirection(self, direction):
self.direction = direction
#raise NotImplementedError | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def setRobotDirection(self, direction):\n self.direction = direction",
"def setRobotDirection(self, direction):\n self.direction = direction",
"def setDirection(self,stepDir = 2):\n pass",
"def set_direction(self, new_dir):\n self.__direction = new_dir",
"def set_direction(self,... | [
"0.74564767",
"0.74564767",
"0.71080387",
"0.7050842",
"0.7025068",
"0.6972867",
"0.6806668",
"0.6626092",
"0.6500536",
"0.6461539",
"0.64010406",
"0.6326288",
"0.63147664",
"0.6281464",
"0.6212341",
"0.6212341",
"0.6146971",
"0.61024934",
"0.60986555",
"0.60986555",
"0.60843... | 0.7256985 | 2 |
Return a Tensor for a batch of image input | def neural_net_image_input(image_shape):
# TODO: Implement Function
n_input_1 = image_shape[0]
n_input_2 = image_shape[1]
n_input_3 = image_shape[2]
return tf.placeholder(tf.float32,[None, n_input_1, n_input_2, n_input_3], name='x') | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def image_batch():\n return np.zeros((2, 1, 4, 4))",
"def process_batch_input_for_RNN(self, batch_input):\n batch_input_ = tf.transpose(batch_input, perm=[2, 0, 1])\n x = tf.transpose(batch_input_)\n return x",
"def preds(self, input_batch):\n raw_output = self._create_network(tf.cast(input_... | [
"0.69819844",
"0.697763",
"0.6969173",
"0.6915324",
"0.67256606",
"0.6700737",
"0.66782105",
"0.66675717",
"0.66660124",
"0.66466165",
"0.6593057",
"0.6587086",
"0.65799147",
"0.65531987",
"0.6539414",
"0.64712876",
"0.6469063",
"0.6452948",
"0.64362",
"0.6432675",
"0.6402015... | 0.6367425 | 27 |
Create a convolutional neural network model | def conv_net(x, keep_prob):
# TODO: Apply 1, 2, or 3 Convolution and Max Pool layers
# Play around with different number of outputs, kernel size and stride
# Function Definition from Above:
# conv2d_maxpool(x_tensor, conv_num_outputs, conv_ksize, conv_strides, pool_ksize, pool_strides)
#layer... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def modelbuilder():\n model = Sequential()\n # Add a convolution layer with with a sigmoid activation function\n model.add(layers.Conv2D(1, (2, 2), strides=(1, 1), activation='sigmoid', padding='same', input_shape=(256, 256, 3)))\n model.compile(optimizer='adam', loss='mse', metrics=['accuracy'])\n ... | [
"0.75759804",
"0.75662863",
"0.75616914",
"0.7515004",
"0.7484576",
"0.73029715",
"0.72210497",
"0.7213281",
"0.7211336",
"0.70952636",
"0.70872176",
"0.70740753",
"0.70739937",
"0.7005373",
"0.69838446",
"0.6977015",
"0.6968334",
"0.696391",
"0.69364005",
"0.6928159",
"0.692... | 0.0 | -1 |
Flatten x_tensor to (Batch Size, Flattened Image Size) | def flatten(x_tensor):
# TODO: Implement Function
b, w, h, d = x_tensor.get_shape().as_list()
img_size = w * h * d
return tf.reshape(x_tensor, [-1, img_size]) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def flatten(self, x_tensor):\n shape = x_tensor.get_shape().as_list()\n assert len(shape) >= 4, 'shape of image is not correct'\n single_image_dimension = shape[1] * shape[2] * shape[3]\n x_tensor = tf.reshape(x_tensor, [-1, single_image_dimension])\n return x_tensor\n # r... | [
"0.81377184",
"0.7993429",
"0.7951448",
"0.7898492",
"0.7682892",
"0.76605624",
"0.76605624",
"0.76206565",
"0.7620161",
"0.7620161",
"0.7607741",
"0.75690585",
"0.7138004",
"0.6950937",
"0.69337726",
"0.69272053",
"0.6926872",
"0.691056",
"0.68757296",
"0.67923105",
"0.66873... | 0.83052784 | 0 |
Apply a output layer to x_tensor using weight and bias | def output(x_tensor, num_outputs):
shape = x_tensor.get_shape().as_list()
weight = tf.Variable(tf.truncated_normal([shape[-1], num_outputs], stddev=0.1))
bias = tf.Variable(tf.zeros(num_outputs))
return tf.add(tf.matmul(x_tensor, weight), bias) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def output_layer_activation(x):\n return x",
"def layer_output(x_tensor, num_outputs):\n weights = tf.Variable(\n tf.random_normal(\n [x_tensor.shape[1].value, num_outputs],\n stddev=0.1\n )\n )\n bias = tf.Variable(tf.zeros([num_outputs]))\n return tf.add(tf.ma... | [
"0.73880553",
"0.73780525",
"0.6867772",
"0.6791421",
"0.67592424",
"0.6727423",
"0.67101616",
"0.6698643",
"0.6686149",
"0.66421616",
"0.66083896",
"0.66023237",
"0.65648735",
"0.6524778",
"0.6484271",
"0.6477665",
"0.64373136",
"0.64364195",
"0.6411001",
"0.6399274",
"0.637... | 0.7379001 | 1 |
Residual block from 'Deep Residual Learning for Image Recognition'. | def res_block(input_tensor, fshape, nchannels, nfilters, strides=[1, 1, 1, 1],
act=tf.nn.relu, dropout=None, batchnorm=True, training=False,
padding=None, name='res_block'):
with tf.variable_scope(name):
x = conv2d_layer_bn(input_tensor, fshape, nchannels, nfilters, strides=strid... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _compute_residuals(self):\n residuls = self.I - self.E\n return residuls",
"def compute_residuals(r):\n global conv_residuals\n conv_residuals.append(r)\n return",
"def _residual(self, x):\n h = x\n h = self.c1(h)\n h = self.activation(h)\n h =... | [
"0.7067259",
"0.6943578",
"0.6909338",
"0.67994386",
"0.67781764",
"0.6696287",
"0.6664916",
"0.6531499",
"0.6519644",
"0.6446382",
"0.637114",
"0.63601184",
"0.63370466",
"0.63330305",
"0.6299669",
"0.62733006",
"0.62534946",
"0.62260926",
"0.622348",
"0.62222046",
"0.620346... | 0.0 | -1 |
Residual block with bottleneck from 'Deep Residual Learning for Image Recognition'. | def res_block_bottleneck(input_tensor, fshape, nchannels, nfilters, nfilters_out,
strides=None, act=tf.nn.relu, dropout=None, padding=None, name='res_block'):
with tf.name_scope(name):
x = conv2d_layer(input_tensor, [1, 1], nchannels, nfilters, act=act, name=name+'_conv1')
x... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def compute_residuals(r):\n global conv_residuals\n conv_residuals.append(r)\n return",
"def _residual(self, x):\n h = x\n h = self.c1(h)\n h = self.activation(h)\n h = self.c2(h)\n h = F.avg_pool2d(h, 2)\n\n return h",
"def residual_block(layer_in... | [
"0.68097806",
"0.6722673",
"0.66460645",
"0.6633791",
"0.6589478",
"0.65724885",
"0.6560283",
"0.6538279",
"0.6503437",
"0.6475338",
"0.64270234",
"0.6329437",
"0.63267595",
"0.6320693",
"0.6301871",
"0.62985426",
"0.62859297",
"0.62787634",
"0.62672925",
"0.62261057",
"0.617... | 0.0 | -1 |
Unload config entry from SmartHab integration. | async def async_unload_entry(opp: OpenPeerPower, entry: ConfigEntry):
unload_ok = await opp.config_entries.async_unload_platforms(entry, PLATFORMS)
if unload_ok:
opp.data[DOMAIN].pop(entry.entry_id)
return unload_ok | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"async def test_unload_config_entry(\n hass: HomeAssistant, aioclient_mock: AiohttpClientMocker\n) -> None:\n entry = await init_integration(hass, aioclient_mock)\n assert hass.data[DOMAIN]\n\n await hass.config_entries.async_unload(entry.entry_id)\n await hass.async_block_till_done()\n assert not... | [
"0.7033973",
"0.6873258",
"0.6770538",
"0.6724959",
"0.6715778",
"0.669766",
"0.66604936",
"0.66388375",
"0.6569977",
"0.6560419",
"0.6546635",
"0.6541846",
"0.6535117",
"0.65330297",
"0.6507791",
"0.6502553",
"0.64862037",
"0.6476972",
"0.64515495",
"0.64515495",
"0.64515495... | 0.6213524 | 66 |
Reduces fire levels of rooms where sprinklers are on. If not enough water is provided, then only some sprinklers will activate. | def sprinkler_tick(self, water_available=-1):
# idk if Python uses pass by reference, so I'm copying this variable just to be safe
available_water = water_available
for room in self.room_list:
if room.sprinkling and room.fire_level > 0 and available_water != 0:
room.f... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update_water_collecting():\n if init.game_state.rain_water_uses > 0 or init.game_state.current_location[\"Key\"] in cs.water_locations:\n sc.sm.get_screen(\"game\").ids.water_collecting.disabled = False\n else:\n sc.sm.get_screen(\"game\").ids.water_collecting.disabled = True",
"def grow(... | [
"0.6035437",
"0.5877466",
"0.5737346",
"0.5709749",
"0.5605034",
"0.54168206",
"0.53946036",
"0.5369385",
"0.53226435",
"0.53125006",
"0.5305887",
"0.52748173",
"0.5223552",
"0.5214977",
"0.52122974",
"0.5177388",
"0.5152095",
"0.51321733",
"0.51172155",
"0.5112487",
"0.50982... | 0.69305295 | 0 |
Set the user's ldap password to something that can never be entered, effectively locking the account. We do not sync these passwords from django, because django_auth_ldap sets all new accounts to these passwords. | def reset_ldap_password(username):
from django_ldap_pixiedust.user import SynchronisingUserAdapter
backend = LDAPBackend()
user = User.objects.get(username=username)
ldap_user = backend.get_user(user.id)
sync = SynchronisingUserAdapter(ldap_user)
sync.reset_ldap_password() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def LdapResetPassword(self, record):\n password = self.login_pwd.generate_password()\n attrs = {}\n attrs['userPassword'] = self.login_pwd.encrypt_password(password)\n logger.debug(\"LDAP LdapResetPassword encrypt_password %s\"\n % (attrs['userPassword']))\n r... | [
"0.70421404",
"0.70380116",
"0.6924995",
"0.6896537",
"0.67661977",
"0.66680586",
"0.663755",
"0.66337526",
"0.6594423",
"0.65561247",
"0.6552179",
"0.6510069",
"0.64663273",
"0.6465778",
"0.6456476",
"0.64328593",
"0.6389454",
"0.63800126",
"0.6360374",
"0.6358428",
"0.63584... | 0.69770885 | 2 |
Add Gaussian noise to pc. For each dimension randomly sample from a Gaussian (N(0, Variance)) and add the result to the dimension dimension. | def add_noise(pc, variance,distribution='gaussian'):
pc_out = []
if distribution=='gaussian':
for pt in pc:
pc_out.append(pt + numpy.random.normal(0, variance, (2, 1)))
elif distribution=='uniform':
for pt in pc:
pc_out.append(pt + numpy.random.uniform(-variance, var... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_gaussian_noise(x, std):\n noise = x.new_zeros(x.size()).normal_(std=std)\n return x + noise",
"def add_gaussian_noise(self, samples):\n\n if 'sigma' in self.gaussian_component:\n sigma = self.gaussian_component['sigma']\n return samples + self.random_state.normal(size=s... | [
"0.6438409",
"0.63797057",
"0.6277075",
"0.6273275",
"0.62281775",
"0.6214178",
"0.6188253",
"0.617724",
"0.6162648",
"0.6103723",
"0.60789293",
"0.6069598",
"0.60636735",
"0.5985609",
"0.5984904",
"0.5972304",
"0.5963081",
"0.5961838",
"0.592772",
"0.5902879",
"0.58722156",
... | 0.7071176 | 0 |
encoding block is 2 convolutions layers each followed by a max pooling layers with a stride of 2 for downsampling for each two layers conv/maxpool, Hout = Hin/2 (k+1) decoding block is upsampling, concatenation and convolutions for each two layers crop and conv, Hout = 2Hin 3k + 1 | def forward(self, x):
# encode
encode_block1 = self.conv_encode1(x)
encode_pool1 = self.conv_maxpool1(encode_block1)
encode_block2 = self.conv_encode2(encode_pool1)
encode_pool2 = self.conv_maxpool2(encode_block2)
encode_block3 = self.conv_encode3(encode_pool2)
en... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self, ):\n super().__init__()\n channels = 3\n\n # Initial convolution block\n out_features = 64\n # encoder\n self.input = nn.Sequential(\n nn.ReflectionPad2d(channels),\n nn.Conv2d(3, out_features, (7, 7)),\n nn.InstanceNorm2... | [
"0.6930743",
"0.6887007",
"0.6846051",
"0.6831567",
"0.6717853",
"0.6688744",
"0.668475",
"0.66718245",
"0.6665284",
"0.6630662",
"0.66299367",
"0.65983886",
"0.65451306",
"0.65041363",
"0.64832705",
"0.6454228",
"0.6419141",
"0.64184225",
"0.6410717",
"0.64085406",
"0.639886... | 0.62264365 | 58 |
Discounted cumulative gain (DCG) at rank k | def dcg_score(y_true, y_score, k=5, gains="exponential"):
order = np.argsort(y_score)[::-1]
y_true = np.take(y_true, order[:k])
if gains == "exponential":
gains = 2 ** y_true - 1
elif gains == "linear":
gains = y_true
else:
raise ValueError("Invalid gains option.")
# hig... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def ndcg(self, gt, pred, k):\n k = min(k, len(pred))\n idcg = self.idcg(k)\n dcg_k = sum([int(pred[i] in gt) / math.log(i + 2, 2) for i in range(k)])\n return dcg_k / idcg",
"def dcg_at_k(cls, r, k):\n assert k >= 1\n r = np.asfarray(r)[:k]\n if r.size:\n ... | [
"0.71883184",
"0.715461",
"0.71520615",
"0.7143712",
"0.70754224",
"0.6779303",
"0.672912",
"0.6712971",
"0.6712971",
"0.66885626",
"0.6669749",
"0.66365427",
"0.65901357",
"0.658225",
"0.653671",
"0.6516333",
"0.6508029",
"0.64808977",
"0.6464389",
"0.6418307",
"0.636935",
... | 0.71481687 | 3 |
Normalized discounted cumulative gain (NDCG) at rank k | def ndcg_score(y_true, y_score, k=5, gains="exponential"):
best = dcg_score(y_true, y_true, k, gains)
actual = dcg_score(y_true, y_score, k, gains)
return actual / best | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def ndcg(self, gt, pred, k):\n k = min(k, len(pred))\n idcg = self.idcg(k)\n dcg_k = sum([int(pred[i] in gt) / math.log(i + 2, 2) for i in range(k)])\n return dcg_k / idcg",
"def dcg_at_k(cls, r, k):\n assert k >= 1\n r = np.asfarray(r)[:k]\n if r.size:\n ... | [
"0.6971885",
"0.6879891",
"0.6851625",
"0.6851625",
"0.6845874",
"0.6835035",
"0.6798163",
"0.67260516",
"0.6546535",
"0.6545265",
"0.64945674",
"0.64512086",
"0.6438302",
"0.6436698",
"0.64166754",
"0.6379897",
"0.6355404",
"0.634081",
"0.6330172",
"0.6316862",
"0.62871355",... | 0.6764756 | 7 |
Provide helpful representation when printed. | def __repr__(self):
return "<Image image_id=%s label=%s>" % (self.id, self.image_label) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __repr__(self):\n return self.pretty_print(self.__dict__)",
"def nice_output(self):\n return self.des",
"def nice_output(self):\n return self.des",
"def __str__(self):\n return self.printable()",
"def _printable(self):\n toPrint = \"Qubit ID: \" + str(self.qubit_id) +... | [
"0.7529561",
"0.7511525",
"0.7511525",
"0.74975544",
"0.7394847",
"0.72965956",
"0.7293301",
"0.7226869",
"0.7225389",
"0.7205555",
"0.71771973",
"0.71743053",
"0.7146052",
"0.7134735",
"0.71325094",
"0.71289283",
"0.7126178",
"0.71148866",
"0.7109676",
"0.7082562",
"0.707800... | 0.0 | -1 |
Provide helpful representation when printed. | def __repr__(self):
return "<Tag tag_id=%s label=%s>" % (self.id, self.name) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __repr__(self):\n return self.pretty_print(self.__dict__)",
"def nice_output(self):\n return self.des",
"def nice_output(self):\n return self.des",
"def __str__(self):\n return self.printable()",
"def _printable(self):\n toPrint = \"Qubit ID: \" + str(self.qubit_id) +... | [
"0.7529561",
"0.7511525",
"0.7511525",
"0.74975544",
"0.7394847",
"0.72965956",
"0.7293301",
"0.7226869",
"0.7225389",
"0.7205555",
"0.71771973",
"0.71743053",
"0.7146052",
"0.7134735",
"0.71325094",
"0.71289283",
"0.7126178",
"0.71148866",
"0.7109676",
"0.7082562",
"0.707800... | 0.0 | -1 |
> list of features for a word | def w2f(sents,i,j,filename,freq):
w = sents[i][j][0] #current word
pos = sents[i][j][1] #POS of current word
f = [
'bias', #non-contextual feature
'w=' + w, #current word
'w.istitle=%s' % w.istitle(), #first letter - capitalized
'pos=' + pos, # POS tag... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_text_features(text, word_features):\n words = word_tokenize(text)\n features = {}\n for w in word_features:\n features[w] = (w in words)\n\n return features",
"def featurize(self, data):\n \n bag_of_words = []\n\n tokens = data.split()\n\n for i in tokens:\n bag_of_wor... | [
"0.7493856",
"0.7332567",
"0.728524",
"0.71250314",
"0.7113752",
"0.7103164",
"0.7001705",
"0.6983873",
"0.6966011",
"0.69306374",
"0.69094884",
"0.68864673",
"0.687496",
"0.6869528",
"0.68693113",
"0.68125266",
"0.6797638",
"0.6784425",
"0.6751374",
"0.6699678",
"0.66486204"... | 0.0 | -1 |
Extract features from a sentence | def s2f(sents,i,f,freq):
return [w2f(sents,i,j,f,freq) for j in range(len(sents[i]))] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _sentence_to_features(self,sentence):\n\n configured_features = self.configFeatures\n sentence_features = []\n\n for word_idx in range(len(sentence)):\n # word before(-1), current word(0), next word(+1)\n feature_span = len(configured_features)\n half_span ... | [
"0.7737927",
"0.77226627",
"0.7312296",
"0.7202348",
"0.71464455",
"0.7040731",
"0.6924871",
"0.690179",
"0.6830664",
"0.6822481",
"0.67851406",
"0.6756431",
"0.6754304",
"0.67489797",
"0.67297107",
"0.6662871",
"0.6595058",
"0.6577315",
"0.6570805",
"0.6532721",
"0.6504786",... | 0.0 | -1 |
Extract words from a sentence | def s2w(sents,i,f,freq):
return [w for w,_,_ in sents[i]] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getWords(speech):\r\n return speech.split()",
"def sentence_to_words(sentence: str) -> List[str]:\n return list(map(clean_word, sentence.split(\" \")))",
"def token_to_words(sentence):\n\n regex_of_word = re.findall(SENTENCE_TO_WORDS_REGEX, sentence)\n\n words = [x.lower() for x in regex_of_wor... | [
"0.75601083",
"0.74497163",
"0.7443296",
"0.7368138",
"0.7270438",
"0.72518116",
"0.72433704",
"0.71730167",
"0.71426696",
"0.7129774",
"0.7125588",
"0.7112363",
"0.71065354",
"0.7095276",
"0.7007721",
"0.6997654",
"0.69874364",
"0.69776434",
"0.6974424",
"0.6974424",
"0.6967... | 0.0 | -1 |
Calculates the distance between two points on earth using the harversine distance (distance between points on a sphere) | def harversine_distance(self, other):
lat1, lon1, lat2, lon2 = (
a/180*pi for a in [self.stop_lat, self.stop_lon, other.stop_lat, other.stop_lon])
dlon = lon2 - lon1
dlat = lat2 - lat1
a = sin(dlat/2) ** 2 + cos(lat1) * cos(lat2) * sin(dlon/2) ** 2
c = 2 * asin(min(1... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def harversine(lon1, lat1, lon2, lat2):\n # convert decimal degrees to radians\n lon1, lat1, lon2, lat2 = map(math.radians, [lon1, lat1, lon2, lat2])\n # harversine formula\n dlon = lon2 - lon1\n dlat = lat2 - lat1\n a = math.sin(dlat/2.)**2. + math.cos(lat1) * math.cos(lat2) * math.sin(dlon/2.)*... | [
"0.7546629",
"0.7194695",
"0.71189857",
"0.7114283",
"0.71015644",
"0.70869535",
"0.70716244",
"0.70539415",
"0.70420593",
"0.70104885",
"0.70032537",
"0.6995175",
"0.6992688",
"0.69707924",
"0.69688547",
"0.6930325",
"0.6912752",
"0.68971145",
"0.6892697",
"0.68915534",
"0.6... | 0.7336704 | 1 |
Called when the user specifies an intent for this skill | def on_intent(intent_request, session):
print("on_intent requestId=" + intent_request['requestId'] +
", sessionId=" + session['sessionId'])
intent = intent_request['intent']
intent_name = intent_request['intent']['name']
# Dispatch to your skill's intent handlers
if intent_name == "Hell... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def on_intent(intent_request, session):\n\n intent = intent_request['intent']\n intent_name = intent_request['intent']['name']\n\n # Dispatch to your skill's intent handlers\n\n if intent_name not in skillmap:\n intent_name = \"NullSkill\"\n\n if intent_name in skillmap:\n try:\n ... | [
"0.7143966",
"0.6956116",
"0.6949057",
"0.6905333",
"0.68928874",
"0.67641324",
"0.6754843",
"0.6722764",
"0.6720773",
"0.6699252",
"0.6691263",
"0.6670276",
"0.6645522",
"0.6642719",
"0.6638686",
"0.6607724",
"0.6594981",
"0.6575682",
"0.6570076",
"0.65620786",
"0.65609014",... | 0.67161995 | 9 |
Pad an input_list to a given size. | def pad(input_list: List[int], padding_size: int, padding_value: int) -> List[int]:
return input_list + [padding_value] * abs((len(input_list) - padding_size)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def pad(lst, pad_size, filler):\n assert(isinstance(lst, list))\n assert(pad_size - len(lst) >= 0)\n lst.extend([filler] * (pad_size - len(lst)))",
"def pad_with_zero(list, max_length, pad_type):\n padded_list = pad_sequences(list, maxlen=max_length, padding=pad_type, truncating='post')\n return p... | [
"0.80134207",
"0.73541915",
"0.71095026",
"0.7105765",
"0.70079905",
"0.68311733",
"0.67492163",
"0.67056865",
"0.6536309",
"0.64701694",
"0.64701694",
"0.64069605",
"0.6383097",
"0.63324386",
"0.63240814",
"0.63073844",
"0.62747306",
"0.627036",
"0.6224149",
"0.62070954",
"0... | 0.8031585 | 0 |
adds words from entrytext to the dictionary of words | def add_search_words(self,
index,
entrytext):
for a_temp in DELETECHARACTERS:
entrytext = entrytext.replace(a_temp, BLANK)
for w in set(entrytext.split()):
w = w.strip()
if self.word_dict_contains(w):
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_text(self, text):\n words = self.clean_text_util.clean_text(text)\n # remove duplicate word\n words = set(words) \n\n # for each word:\n # - if the word already exist in the dictionary we update the occurrence\n # - otherwise we add a new word with his index to the... | [
"0.66446334",
"0.6560113",
"0.6477551",
"0.6353052",
"0.6341547",
"0.63065284",
"0.6275558",
"0.6262819",
"0.6258237",
"0.624562",
"0.62040514",
"0.61889994",
"0.6184892",
"0.61719495",
"0.6129081",
"0.61017746",
"0.60709906",
"0.5995282",
"0.5983031",
"0.5979981",
"0.594666"... | 0.713675 | 0 |
deletes words from entrytext to the dictionary of words | def delete_search_words(self,
index,
entrytext):
for a_temp in DELETECHARACTERS:
entrytext = entrytext.replace(a_temp, BLANK)
for w in set(entrytext.split()):
w = w.strip()
if (self.word_dict_contain... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_search_words(self,\r\n index,\r\n entrytext):\r\n\r\n\r\n for a_temp in DELETECHARACTERS:\r\n entrytext = entrytext.replace(a_temp, BLANK)\r\n\r\n for w in set(entrytext.split()):\r\n\r\n w = w.strip()\r\n if sel... | [
"0.71293265",
"0.7069047",
"0.6604552",
"0.630953",
"0.6130611",
"0.5940467",
"0.59221405",
"0.59002215",
"0.5887573",
"0.5871499",
"0.5847913",
"0.58307225",
"0.58275783",
"0.58225596",
"0.5800375",
"0.57880795",
"0.5787065",
"0.574542",
"0.5738227",
"0.5737566",
"0.573592",... | 0.70259434 | 2 |
Returns true if word in word dictionary | def word_dict_contains (self,
word):
if self.using_database:
aprint('WORDDICT CONTAINS')
value_tuple = (notebookname, word,)
db_cursor.execute("SELECT rowid"
+" FROM word_to_indexes"
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def isWord(word, dictionary):\n return word in dictionary",
"def has_word(self, word):\n return word in self.word_set",
"def check_word(self, word):\n word = word.lower().strip()\n return not word or word in self.dictionary",
"def check_word(words, word):\r\n if word in words:\r\n ... | [
"0.88723046",
"0.80683035",
"0.7879044",
"0.78707814",
"0.77607614",
"0.7704424",
"0.7670343",
"0.7588765",
"0.7529525",
"0.7515861",
"0.7458942",
"0.74194616",
"0.74186224",
"0.7416861",
"0.7401073",
"0.7366746",
"0.73633355",
"0.7355616",
"0.73444486",
"0.7333876",
"0.73207... | 0.80541927 | 2 |
Initialise a neuron with INPUT weights and a specific alpha | def __init__(self, alpha, weights):
self._weights = weights
self._alpha = alpha | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self, weights, alphas):\n self._neurons = [Neuron(a, w) for w, a in zip(weights, alphas)]",
"def __init__(self, weights=[], alphas=[]):\n self._layers = [Layer(w, a) for w, a in zip(weights, alphas)]",
"def new_initial_layer(self, nodes, inputs, alpha=0.1):\n weights = [[1 for... | [
"0.75605696",
"0.7252357",
"0.71553946",
"0.6966387",
"0.68138856",
"0.6720749",
"0.6624151",
"0.65834284",
"0.65724826",
"0.6532506",
"0.6493168",
"0.6468944",
"0.6426526",
"0.6417221",
"0.6415572",
"0.63793474",
"0.637557",
"0.6371724",
"0.6371685",
"0.6367221",
"0.63191503... | 0.79036045 | 0 |
Performs the sigmoid function equation from lectures with the defined alpha value corresponding to this object | def _g(self, x):
e_x = math.exp(-self._alpha * x)
return (1.0 / (1 + e_x)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sigmoid(z):\n \n return 1 / (1 + np.exp(-z))#your code here",
"def sigmoid(self, x):\r\n if 1:\r\n return erf((x)/(self.sigma)) #newly discovered (inspired by a quantum computing research). sigma could be different for every node\r\n else:\r\n return (1-np.exp(-self... | [
"0.73513716",
"0.7171279",
"0.7125027",
"0.7122378",
"0.7100825",
"0.7098492",
"0.7069815",
"0.7069815",
"0.70591235",
"0.70421886",
"0.7039784",
"0.7024136",
"0.70167553",
"0.700913",
"0.7007733",
"0.70009094",
"0.7000605",
"0.69983476",
"0.69962215",
"0.69962215",
"0.699622... | 0.0 | -1 |
Performs the derivative of the sigmoid function for a given x value using the alpha value associated with this neuron | def _g_prime(self, x):
return self._g(x)*(1 - self._g(x)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def derivative_sigmoid(x):\n return x * (1 - x)",
"def derivative_sigmoid(x):\n return x * (1 - x)",
"def sigmoid_derivative(x):\n return x * (1-x)",
"def sigmoid_derivative(x):\n return x * (1.0 - x)",
"def sigmoid_derivative(x):\r\n\r\n ### START CODE HERE ### (≈ 2 lines of code)\r\n s ... | [
"0.7550247",
"0.7550247",
"0.7485603",
"0.7483773",
"0.74483943",
"0.74191606",
"0.729188",
"0.7288346",
"0.7234809",
"0.69031465",
"0.68977183",
"0.68714195",
"0.67656916",
"0.67455494",
"0.67421633",
"0.6705728",
"0.670315",
"0.6702459",
"0.66977584",
"0.66977584",
"0.66927... | 0.0 | -1 |
Outputs the sigmoid function applied to the weighted sum of the inputs, once more using the alpha value associated with this neuron | def output(self, inputs):
self._in_j = self._input(inputs) #Previous weighted inputs
return self._g(self._in_j) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def activation_sigmoid_custom(self):\n self.value = 1 / (1 + np.e ** (-4.9 * self.value))",
"def sigmoid(X,W,b):\n preActivation = np.dot(X, W) + b\n return (1.0)/(1.0 + np.exp(-preActivation))",
"def activates(self, inputs):\n total = self.weights[0] * self.bias\n for i in range(len... | [
"0.69824",
"0.6979226",
"0.69478506",
"0.6908791",
"0.6849738",
"0.6837837",
"0.67917",
"0.67761654",
"0.67759705",
"0.67515254",
"0.674049",
"0.6725706",
"0.67144233",
"0.6714416",
"0.6714416",
"0.66975623",
"0.66975623",
"0.66975623",
"0.6685708",
"0.6670682",
"0.6665767",
... | 0.0 | -1 |
Copy values from self.ca_lines to the patches. One issue is dealing with cases in which there are more or fewer lines than Patch row. | def set_display_from_lines(self):
y = 1
maxlin = CA_World.ca_display_size - 1
limy = len(self.ca_lines) + maxlin
for i in self.ca_lines:
x = 1
if limy >= maxlin:
if SimEngine.gui_get('init') == "Right": # Right
limx = len(i) + ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update_lines(self):\n self._checkfigure()\n for ld in self.lines:\n line = ld['line']\n\n color = ld['color']\n line.set_color(color)\n\n lw = ld['linewidth']\n hlf = ld['highlight factor']\n highlight = hlf if ld['highlighted'] el... | [
"0.5619996",
"0.55221105",
"0.5519902",
"0.54456264",
"0.54433495",
"0.5260978",
"0.52212715",
"0.5142861",
"0.5111474",
"0.5085931",
"0.5052447",
"0.5051747",
"0.5044127",
"0.50294966",
"0.50282323",
"0.5015377",
"0.5007584",
"0.4993679",
"0.49646008",
"0.49638224",
"0.49076... | 0.59117764 | 0 |
parces text of file as json if it is possible | def load_data(text) -> Tuple[Optional['AuxEffects'], str, str]:
new_data, error = IniToJson.get_json(text)
if error or new_data is None:
return None, error, ""
data, warning = data_load(new_data)
return data, "", warning | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def write_file (data):\n\n req_text= data.text\n json_parsed=json.loads(req_text)\n return json_parsed",
"def write_file (data):\n\n req_text= data.text\n json_parsed=json.loads(req_text)\n return json_parsed",
"def parse_json(file_path):\n j_data = open(file_path, 'r')\n s_data = \"\"\... | [
"0.6863095",
"0.6863095",
"0.6825566",
"0.6671325",
"0.6471831",
"0.64579666",
"0.64378333",
"0.64243007",
"0.63880444",
"0.62828547",
"0.6269979",
"0.6189103",
"0.6178795",
"0.61507165",
"0.6138674",
"0.6137497",
"0.6117156",
"0.61053985",
"0.6098463",
"0.6098463",
"0.606622... | 0.0 | -1 |
Compute the softargmax of a heatmap | def spatial_argmax(logit):
weights = F.softmax(logit.view(logit.size(0), -1), dim=-1).view_as(logit)
two = (torch.ones_like(logit)*2).mean(dim=(-2,-1))
true = torch.stack((logit.mean(dim=[-2,-1]),(weights.sum(1) * torch.linspace(-1, 1, logit.size(2)).to(logit.device)[None]).sum(1),(weights.sum(... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def heatmaps_softmax(heatmaps):\n\n ret = np.zeros(heatmaps.shape, heatmaps.dtype)\n\n width, height, _ = heatmaps.shape\n\n for w in range(width):\n for h in range(height):\n x = heatmaps[w,h]\n e = np.exp(x - np.max(x))\n ret[w,h] = e / np.sum(e, axis=0)\n\n re... | [
"0.7798202",
"0.704729",
"0.69543386",
"0.68703943",
"0.68541354",
"0.6837139",
"0.68231887",
"0.6806196",
"0.6806196",
"0.6780331",
"0.67745024",
"0.6767084",
"0.6766824",
"0.6763821",
"0.67543525",
"0.67465276",
"0.67465276",
"0.67465276",
"0.67465276",
"0.67465276",
"0.674... | 0.0 | -1 |
Filter bounding boxes with probability threshold and nms | def filter_prediction(boxes, probs, cls_idx):
if cfg.TOP_N_DETECTION < len(probs) and cfg.TOP_N_DETECTION > 0:
order = probs.argsort()[:-cfg.TOP_N_DETECTION-1:-1]
probs = probs[order]
boxes = boxes[order]
cls_idx = cls_idx[order]
else:
filtered_idx = np.nonzero(probs > c... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _filter_boxes(self, boxes, box_confidences, box_class_probs):\n box_scores = box_confidences * box_class_probs\n box_classes = np.argmax(box_scores, axis=-1)\n box_class_scores = np.max(box_scores, axis=-1)\n pos = np.where(box_class_scores >= self.object_threshold)\n\n boxes... | [
"0.71496654",
"0.7028896",
"0.6967705",
"0.68841755",
"0.688082",
"0.6801467",
"0.6747068",
"0.6693641",
"0.6689984",
"0.66663045",
"0.66344553",
"0.6591495",
"0.6575074",
"0.6545821",
"0.6514069",
"0.6508479",
"0.65060335",
"0.65047544",
"0.6473513",
"0.6471143",
"0.64296365... | 0.63648456 | 29 |
Calculate the great circle distance between two points on the earth (specified in decimal degrees). | def dist_between(lon1, lat1, lon2, lat2):
# convert decimal degrees to radians
lon1, lat1, lon2, lat2 = map(np.radians, [lon1, lat1, lon2, lat2])
# haversine formula
dlon = lon2 - lon1
dlat = lat2 - lat1
a = np.sin(dlat/2)**2 + np.cos(lat1) * np.cos(lat2) * np.sin(dlon/2)**2
c = 2 * np.a... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def great_circle(lat_1, long_1, lat_2, long_2):\n long_1 = m.radians(long_1)\n lat_1 = m.radians(lat_1)\n long_2 = m.radians(long_2)\n lat_2 = m.radians(lat_2)\n\n d = 2 * 6367.45 * m.asin(\n m.sqrt(haversine(lat_2 - lat_1)\n + m.cos(lat_1)*m.cos(lat_2) *\n haversine(long... | [
"0.80906284",
"0.7918696",
"0.766129",
"0.7551185",
"0.75290257",
"0.75054914",
"0.7479542",
"0.74637425",
"0.74544394",
"0.7447201",
"0.7425562",
"0.7423023",
"0.74111784",
"0.7379091",
"0.7347597",
"0.7316894",
"0.7268855",
"0.7260208",
"0.7253617",
"0.72509587",
"0.7198537... | 0.6777772 | 61 |
Get security group name from security group id and return name | def get_sg_name(ec2,s_id):
name = ""
try:
security_group = ec2.SecurityGroup(s_id)
# name = security_group.description
name = security_group.group_name
except:
name = s_id
return name | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_group_name(\n group_id: BSONObjectId,\n tkn: Token = Depends(from_authotization_header_nondyn),\n):\n assert_has_clearance(tkn.owner, \"sni.read_group\")\n return GetGroupOut.from_record(Group.objects(pk=group_id).get())",
"def get_group_name(self, group_id):\n group = self.table.query... | [
"0.7722903",
"0.7715374",
"0.7563393",
"0.7460387",
"0.7450385",
"0.7276178",
"0.7276178",
"0.7274918",
"0.7260685",
"0.72601354",
"0.7255328",
"0.72455055",
"0.7151322",
"0.70098203",
"0.6992808",
"0.6992808",
"0.6972823",
"0.6972823",
"0.6938596",
"0.6878591",
"0.6871013",
... | 0.8057121 | 0 |
Check if the current line ends in brackets { or } | def _check_brackets(line_index, input_line):
global _total_lines_of_code
if input_line.endswith('{') or input_line.endswith('}'):
_code_lines.append(line_index)
_total_lines_of_code += 1 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def whitespace_or_bracket_after():\n d = get_app().current_buffer.document\n return bool(\n d.is_cursor_at_the_end_of_line\n or d.current_char.isspace()\n or d.current_char in \")]}\"\n )",
"def get_end_brace(self):\n # Find the code to run\n\n brack_num, found_first =... | [
"0.7409092",
"0.7008148",
"0.6851754",
"0.65170115",
"0.6368778",
"0.6255657",
"0.6248161",
"0.6240426",
"0.6230672",
"0.62204444",
"0.6100873",
"0.60756296",
"0.60137534",
"0.5998353",
"0.5950617",
"0.5931761",
"0.5927316",
"0.59264666",
"0.5896586",
"0.587116",
"0.58648396"... | 0.73580855 | 1 |
Checks a given multiline string object for codelike structre | def check_message_for_code(in_lines):
global _is_good_code
# Loop through every line, and track its index
for index, line in enumerate(in_lines):
# Remove all tabs and newlines and bad stuff
line = re.sub('\s+', '', line)
# Check if this is formatted code.
if line.find('```')... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def isCode(self, lineData, column):\n return self._getTextType(lineData, column) == ' '",
"def __check_external_code__(self, line, name):\n line, _ = self.find_vars_in_str(line)\n words = line.split()\n self.E_str = f\"check_{name}_command\"\n\n corr_syn = f\"The correct synta... | [
"0.5992135",
"0.59222484",
"0.5815003",
"0.58055866",
"0.5613737",
"0.560402",
"0.5544896",
"0.5519714",
"0.55036557",
"0.5454173",
"0.5452509",
"0.54437083",
"0.5442309",
"0.54354787",
"0.54239494",
"0.5411276",
"0.53984433",
"0.5389135",
"0.537579",
"0.53712165",
"0.536828"... | 0.6403531 | 0 |
Pulls the request method used by the client | def which_method(event):
return event['context']['http_method'] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_requestmethod(self):\n return self.request.method.lower()",
"def Method(self):\n if self._method is None:\n return \"GET\"\n if len(self._method) == 0:\n return \"GET\"\n return self._method",
"def get_method(self):\n default_method = \"POST\" if sel... | [
"0.7670585",
"0.74272305",
"0.73753977",
"0.7356049",
"0.73199254",
"0.71607614",
"0.712283",
"0.7079762",
"0.70777357",
"0.70453614",
"0.6951887",
"0.68570757",
"0.67650867",
"0.66691285",
"0.666533",
"0.66483855",
"0.6606905",
"0.65698713",
"0.6551442",
"0.6458607",
"0.6448... | 0.7416442 | 2 |
Adds x to y. | def add(x, y):
return x + y | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add(self, x, y):\n pass",
"def append(self, x, y):\n\n self.x.append(x)\n self.y.append(y)\n self.len += 1",
"def plus(x, y):\n x[:] += y[:]\n return x",
"def add(self,x,y):\n # assert that independent variable is as long as each of the\n # dependen... | [
"0.8285083",
"0.7995943",
"0.77221847",
"0.73844236",
"0.73253906",
"0.7146114",
"0.69239736",
"0.6873785",
"0.6850775",
"0.684142",
"0.684142",
"0.684142",
"0.6791192",
"0.67851746",
"0.6754628",
"0.6653064",
"0.6653064",
"0.66446924",
"0.6626116",
"0.6619551",
"0.6589353",
... | 0.6643498 | 22 |
Sets the constraint of this AvailableCoupon. | def constraint(self, constraint):
self._constraint = constraint | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _set_constraint(self):\n pass",
"def constraint_xml(self, constraint_xml):\n\n self._constraint_xml = constraint_xml",
"def constraint(self, c):\n self.add_constraint(c)",
"def add_constraint(self, constraint):\n self.constraints.append(constraint)",
"def SetConstraint(self,... | [
"0.7192783",
"0.6295021",
"0.62281007",
"0.5964792",
"0.58912945",
"0.58885527",
"0.58352876",
"0.57794625",
"0.5692673",
"0.56457615",
"0.56372714",
"0.54701275",
"0.54188275",
"0.5356192",
"0.52970225",
"0.52868015",
"0.52291673",
"0.51960206",
"0.51944387",
"0.51804245",
"... | 0.7179655 | 1 |
Sets the discount_type of this AvailableCoupon. | def discount_type(self, discount_type):
self._discount_type = discount_type | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def discount_amount(self, discount_amount):\n\n self._discount_amount = discount_amount",
"def discount_amount(self, discount_amount):\n\n self._discount_amount = discount_amount",
"def discount_amount(self, discount_amount):\n\n self._discount_amount = discount_amount",
"def set_discoun... | [
"0.57388794",
"0.57388794",
"0.57388794",
"0.55320257",
"0.54663056",
"0.544123",
"0.5404184",
"0.53806436",
"0.5331655",
"0.5219096",
"0.5174049",
"0.5163677",
"0.51479423",
"0.51311463",
"0.51193464",
"0.50923735",
"0.5089269",
"0.50699204",
"0.5050888",
"0.50435925",
"0.50... | 0.84983444 | 0 |
Returns true if both objects are equal | def __eq__(self, other):
if not isinstance(other, AvailableCoupon):
return False
return self.__dict__ == other.__dict__ | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __eq__(self, other):\n return are_equal(self, other)",
"def __eq__(self, other):\n return are_equal(self, other)",
"def __eq__(self,other):\n try: return self.object==other.object and isinstance(self,type(other))\n except: return False",
"def __eq__(self, other):\n if i... | [
"0.8088132",
"0.8088132",
"0.8054589",
"0.7982687",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
... | 0.0 | -1 |
Returns true if both objects are not equal | def __ne__(self, other):
return not self == other | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __ne__(self, other: object) -> bool:\n if self.__eq__(other):\n return False\n return True",
"def __ne__(self, other: object) -> bool:\n return not self.__eq__(other)",
"def __ne__(self, other) -> bool:\n return not self.__eq__(other)",
"def __eq__(self, other):\n ... | [
"0.845611",
"0.8391477",
"0.8144138",
"0.81410587",
"0.8132492",
"0.8093973",
"0.80920255",
"0.80920255",
"0.80920255",
"0.8085325",
"0.8085325",
"0.8076365",
"0.8076365",
"0.8065748"
] | 0.0 | -1 |
Forms a CaseSubscription object from the provided JSON object. | def from_json(name, subscription_json):
return CaseSubscription(name, subscriptions=subscription_json) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def from_json(cls, json_str: str) -> SubscriptionResponse:\n return cls.from_dict(json.loads(json_str))",
"def from_dict(cls, obj: dict) -> SubscriptionResponse:\n if obj is None:\n return None\n\n if not isinstance(obj, dict):\n return SubscriptionResponse.parse_obj(ob... | [
"0.6956954",
"0.6281001",
"0.60173184",
"0.59607625",
"0.5950793",
"0.5868419",
"0.5559646",
"0.54994774",
"0.5434398",
"0.53487474",
"0.5256112",
"0.52148587",
"0.51439995",
"0.51314276",
"0.5130195",
"0.5128542",
"0.5128542",
"0.5128542",
"0.5125721",
"0.51067674",
"0.50737... | 0.81980526 | 0 |
Returns the features for given Spotify tracks. | def track_features(tracks, authorizer, verbose=False):
spotify_endpoint = 'https://api.spotify.com/v1/audio-features'
headers = {"Accept":"application/json", "Content-Type":"application/json", "Authorization": "Bearer {bearer}".format(bearer=authorizer.bearer)}
remainder = len(tracks)
offset = 0
st... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_tracklist_features(tracks):\n\n # first we construct a list of all track ids and tracknames\n track_ids = []\n track_names = []\n for collection_type in tracks:\n tid = collection_type['id']\n if tid:\n track_ids.append(collection_type['id'])\n track_name = f... | [
"0.7525381",
"0.69599074",
"0.6831309",
"0.67567325",
"0.6545727",
"0.6495989",
"0.63547695",
"0.63252026",
"0.61398095",
"0.5938811",
"0.59232795",
"0.5814167",
"0.58040434",
"0.57872283",
"0.5752403",
"0.5700863",
"0.5638579",
"0.5606989",
"0.56055737",
"0.55911773",
"0.556... | 0.73745567 | 1 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.