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 |
|---|---|---|---|---|---|---|
`Connection.get_protocol_version_name()` returns a string giving the protocol version of the current connection. | def test_get_protocol_version_name(self):
server, client = loopback()
client_protocol_version_name = client.get_protocol_version_name()
server_protocol_version_name = server.get_protocol_version_name()
assert isinstance(server_protocol_version_name, str)
assert isinstance(client... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getVersionName(self):\r\n if self.version == (3,0):\r\n return \"SSL 3.0\"\r\n elif self.version == (3,1):\r\n return \"TLS 1.0\"\r\n elif self.version == (3,2):\r\n return \"TLS 1.1\"\r\n else:\r\n return None",
"def do_protocol_version... | [
"0.69249684",
"0.6905465",
"0.67746633",
"0.67271906",
"0.66835517",
"0.66835517",
"0.6668029",
"0.6668029",
"0.65396506",
"0.65386856",
"0.64234465",
"0.6420981",
"0.63881195",
"0.6316376",
"0.62877846",
"0.62841535",
"0.62708926",
"0.6264661",
"0.6255879",
"0.6240116",
"0.6... | 0.70465565 | 0 |
The value of `OpenSSL.SSL.SESS_CACHE_OFF` 0x0, the value of `SSL_SESS_CACHE_OFF` defined by `openssl/ssl.h`. | def test_sess_cache_off(self):
assert 0x0 == SESS_CACHE_OFF | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_session_cache_mode(self):\n context = Context(SSLv23_METHOD)\n context.set_session_cache_mode(SESS_CACHE_OFF)\n off = context.set_session_cache_mode(SESS_CACHE_BOTH)\n assert SESS_CACHE_OFF == off\n assert SESS_CACHE_BOTH == context.get_session_cache_mode()",
"def test... | [
"0.7499426",
"0.71012855",
"0.6804131",
"0.6692066",
"0.6689961",
"0.6551193",
"0.64195454",
"0.631275",
"0.54624087",
"0.52540165",
"0.51792145",
"0.5169552",
"0.5106705",
"0.4998889",
"0.4973085",
"0.4918974",
"0.48920426",
"0.4871608",
"0.48202664",
"0.48179385",
"0.481138... | 0.77735823 | 0 |
The value of `OpenSSL.SSL.SESS_CACHE_NO_AUTO_CLEAR` 0x80, the value of `SSL_SESS_CACHE_NO_AUTO_CLEAR` defined by `openssl/ssl.h`. | def test_sess_cache_no_auto_clear(self):
assert 0x80 == SESS_CACHE_NO_AUTO_CLEAR | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_sess_cache_off(self):\n assert 0x0 == SESS_CACHE_OFF",
"def test_sess_cache_no_internal(self):\n assert 0x300 == SESS_CACHE_NO_INTERNAL",
"def test_session_cache_mode(self):\n context = Context(SSLv23_METHOD)\n context.set_session_cache_mode(SESS_CACHE_OFF)\n off = c... | [
"0.6964861",
"0.6691324",
"0.6586534",
"0.6457196",
"0.6200631",
"0.60927",
"0.59909487",
"0.58473164",
"0.5476332",
"0.5455225",
"0.5291513",
"0.52618575",
"0.5254371",
"0.519148",
"0.51230514",
"0.5116436",
"0.5104042",
"0.50906694",
"0.5077365",
"0.5071781",
"0.5066881",
... | 0.8102842 | 0 |
The value of `OpenSSL.SSL.SESS_CACHE_NO_INTERNAL` 0x300, the value of `SSL_SESS_CACHE_NO_INTERNAL` defined by `openssl/ssl.h`. | def test_sess_cache_no_internal(self):
assert 0x300 == SESS_CACHE_NO_INTERNAL | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_sess_cache_no_internal_store(self):\n assert 0x200 == SESS_CACHE_NO_INTERNAL_STORE",
"def test_sess_cache_no_internal_lookup(self):\n assert 0x100 == SESS_CACHE_NO_INTERNAL_LOOKUP",
"def test_sess_cache_off(self):\n assert 0x0 == SESS_CACHE_OFF",
"def test_sess_cache_no_auto_cle... | [
"0.77503365",
"0.7552605",
"0.7283977",
"0.68739724",
"0.6857459",
"0.666815",
"0.66185445",
"0.6603213",
"0.56654906",
"0.55625045",
"0.53912497",
"0.5224425",
"0.52148277",
"0.51249",
"0.50751853",
"0.5067993",
"0.5059957",
"0.50396174",
"0.501297",
"0.5012301",
"0.49426222... | 0.8085043 | 0 |
Verify the return value of the `get_client_ca_list` method for server and client connections. | def _check_client_ca_list(self, func):
server = self._server(None)
client = self._client(None)
assert client.get_client_ca_list() == []
assert server.get_client_ca_list() == []
ctx = server.get_context()
expected = func(ctx)
assert client.get_client_ca_list() == [... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_set_multiple_ca_list(self):\n secert = load_certificate(FILETYPE_PEM, server_cert_pem)\n clcert = load_certificate(FILETYPE_PEM, server_cert_pem)\n\n sedesc = secert.get_subject()\n cldesc = clcert.get_subject()\n\n def multiple_ca(ctx):\n L = [sedesc, cldesc]... | [
"0.75209886",
"0.7383441",
"0.7331994",
"0.72317183",
"0.7164723",
"0.7101902",
"0.6909657",
"0.689864",
"0.66586393",
"0.66366494",
"0.6479683",
"0.6171661",
"0.6130357",
"0.6064408",
"0.5991692",
"0.5943954",
"0.5918158",
"0.59019244",
"0.58541864",
"0.58255714",
"0.5803875... | 0.86328703 | 0 |
`Context.set_client_ca_list` raises a `TypeError` if called with a nonlist or a list that contains objects other than X509Names. | def test_set_client_ca_list_errors(self):
ctx = Context(SSLv23_METHOD)
with pytest.raises(TypeError):
ctx.set_client_ca_list("spam")
with pytest.raises(TypeError):
ctx.set_client_ca_list(["spam"]) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_set_one_ca_list(self):\n cacert = load_certificate(FILETYPE_PEM, root_cert_pem)\n cadesc = cacert.get_subject()\n\n def single_ca(ctx):\n ctx.set_client_ca_list([cadesc])\n return [cadesc]\n\n self._check_client_ca_list(single_ca)",
"def test_set_multipl... | [
"0.76831275",
"0.7542283",
"0.72512615",
"0.7062306",
"0.70470846",
"0.7010845",
"0.6873816",
"0.6851878",
"0.67387486",
"0.6637965",
"0.5963747",
"0.5942379",
"0.57684666",
"0.5693551",
"0.5458187",
"0.5251613",
"0.522959",
"0.515834",
"0.5047851",
"0.49378726",
"0.49022847"... | 0.75388557 | 2 |
`Context.add_client_ca` raises `TypeError` if called with a nonX509 object. | def test_add_client_ca_wrong_args(self):
ctx = Context(SSLv23_METHOD)
with pytest.raises(TypeError):
ctx.add_client_ca("spam") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_one_add_client_ca(self):\n cacert = load_certificate(FILETYPE_PEM, root_cert_pem)\n cadesc = cacert.get_subject()\n\n def single_ca(ctx):\n ctx.add_client_ca(cacert)\n return [cadesc]\n\n self._check_client_ca_list(single_ca)",
"def test_set_and_add_clie... | [
"0.71252185",
"0.6580265",
"0.6443387",
"0.6379151",
"0.62423134",
"0.621938",
"0.6181874",
"0.61189795",
"0.6116015",
"0.60049117",
"0.6002719",
"0.5966139",
"0.58836",
"0.56786215",
"0.56264114",
"0.5523776",
"0.54886156",
"0.5439414",
"0.5435181",
"0.5412802",
"0.53742963"... | 0.7170392 | 0 |
Check if it is a valid parameter type contained in the type table. | def is_valid_para(self, para_type, type_table):
# The values of the table contain all known destination types
if para_type in type_table.values():
return True
return True | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _is_valid_type(_type: Type[Any]) -> bool:\n\n if _type in _TYPE_MAP:\n return True\n\n if not inspect.isclass(_type):\n return False\n\n return issubclass(_type, Table)",
"def type_valid(self):\n return contain_in_list_equal(self._type_or_ref, PARAM_RES_TYPES)",
"def _validate... | [
"0.70339525",
"0.6869172",
"0.6694329",
"0.6677237",
"0.6605273",
"0.65590453",
"0.65575504",
"0.63359666",
"0.62941664",
"0.62621844",
"0.61709994",
"0.61709994",
"0.61191076",
"0.61157066",
"0.61073816",
"0.610615",
"0.61060596",
"0.6095465",
"0.60920835",
"0.606093",
"0.60... | 0.72643995 | 0 |
Parse lists as described by RFC 2068 Section 2. In particular, parse commaseparated lists where the elements of the list may include quotedstrings. A quotedstring could contain a comma. A nonquoted string could have quotes in the middle. Quotes are removed automatically after parsing. | def parse_list_header(value):
result = []
for item in urllib2.parse_http_list(value):
if item[:1] == item[-1:] == '"':
item = unquote_header_value(item[1:-1])
result.append(item)
return result | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def parse_list(slist):\n res = []\n for v in loop_escaped(slist, ','):\n v = v.strip()\n if v:\n res.append(v)\n return res",
"def parse_list(value: str) -> list[str]:\n segments = _QUOTED_SEGMENT_RE.findall(value)\n for segment in segments:\n left, match, right = v... | [
"0.735335",
"0.73246217",
"0.67233765",
"0.66707647",
"0.663667",
"0.6585052",
"0.654835",
"0.6484577",
"0.64748126",
"0.63382596",
"0.6267624",
"0.6238145",
"0.61881304",
"0.61876124",
"0.6186525",
"0.6168105",
"0.616681",
"0.61580324",
"0.614983",
"0.6137316",
"0.60951334",... | 0.6262774 | 11 |
Returns a SkillObject() from the dictionary attribute if it exists skillName the string representation of the SkillObject instance SkillObject | def getSkill(self, skillName):
if self.__contains__(skillName):
return self.skills[skillName]
return None | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __getitem__(self, skillName):\r\n return self.getSkill(skillName)",
"def get_skill_from_id(skill_id):\n return Skill.query.filter_by(id=skill_id).first()",
"def get_skill(skillpath):\n return Skill.query.filter_by(path=skillpath).first()",
"def from_dict(cls, dikt) -> 'SkillPropertyM... | [
"0.6106537",
"0.59838474",
"0.58631325",
"0.5775435",
"0.5709331",
"0.5578683",
"0.55330676",
"0.5372631",
"0.5347722",
"0.52661836",
"0.5220104",
"0.5162612",
"0.5141864",
"0.51402557",
"0.51063347",
"0.5101566",
"0.5061796",
"0.50599813",
"0.50584215",
"0.5017077",
"0.49974... | 0.62502855 | 0 |
A wrapper function to return the skillConfig singleton ConfigurationObeject singleton | def config(self):
return skillConfig | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_config() -> Config:\n return get_or_set('config', build_configuration)",
"def get_config(cls) -> \"__Config\":\n if cls.__instance is None:\n cls.__instance = cls.__Config()\n return cls.__instance",
"def config() -> Config:\n return Config()",
"def _get_config(self):\n... | [
"0.75268734",
"0.7087529",
"0.6945756",
"0.6942633",
"0.6942633",
"0.6942633",
"0.6942633",
"0.6942633",
"0.6942633",
"0.6942633",
"0.6942633",
"0.6942633",
"0.6942633",
"0.6942633",
"0.6942633",
"0.6942633",
"0.6942633",
"0.6942633",
"0.6942633",
"0.6942633",
"0.6942633",
... | 0.76739657 | 0 |
Default constructor, initialize the dictionary to hold the instances | def __init__(self):
self.players = {} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self):\n self._inst = {}",
"def __init__(self):\n self.dic = {}",
"def __init__(self):\n self.dic = {}",
"def __init__(self):\r\n self.dic={}",
"def __init__(self):\n self.dict = {}",
"def __init__(self):\n self.dict = {}",
"def __init__(self):\n ... | [
"0.79112405",
"0.7871865",
"0.7871865",
"0.7836806",
"0.77497584",
"0.77497584",
"0.7736655",
"0.7736655",
"0.7736133",
"0.77353007",
"0.77206856",
"0.77206856",
"0.76997083",
"0.76968986",
"0.7611984",
"0.7578766",
"0.75427485",
"0.74304324",
"0.74304324",
"0.74304324",
"0.7... | 0.0 | -1 |
Removes all of the PlayerObjects from within the container, calls the destructor on each of the PlayerObject instances. | def clearList(self):
self.players.clear() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def clear_game_objects(self):\n self.game_objects = list() # [go for go in self.game_objects if go.dont_destroy]\n self.colliders = list()",
"def destroy(self):\r\n for container in self._containers.copy():\r\n container.destroy()\r\n\r\n assert len(self._containers) == 0",... | [
"0.70627797",
"0.69837606",
"0.69072396",
"0.67411005",
"0.6627919",
"0.6608197",
"0.6590811",
"0.6581919",
"0.6576161",
"0.65540516",
"0.65456957",
"0.6514173",
"0.6510881",
"0.64763755",
"0.64573413",
"0.6297949",
"0.62869704",
"0.62622595",
"0.62232286",
"0.619547",
"0.616... | 0.6467118 | 14 |
Default constructor, store the userid and the player instance userid the id of the user which the commands execute on | def __init__(self, userid):
debug.write("[SourceRPG] CommandsDatabase object constructor for userid %s" % userid, 1)
self.userid = int(userid)
self.player = players[userid]
debug.write("[SourceRPG] CommandsDtabase object created", 1) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self, player_id, player_name, chat_id):\n\n # find player info in a database\n with Player.client as client:\n db = client.game_db\n user = db.players.find_one({\"id\": player_id})\n if user is None:\n # add user to database\n ... | [
"0.68445975",
"0.65537035",
"0.64315706",
"0.6361236",
"0.63602495",
"0.6322272",
"0.6320953",
"0.6290894",
"0.6270972",
"0.6255635",
"0.6250165",
"0.6204935",
"0.61231256",
"0.61046165",
"0.610415",
"0.60974324",
"0.6094932",
"0.6072439",
"0.60525006",
"0.60289615",
"0.60129... | 0.8096869 | 0 |
Executed upon the event "hostage_follows". Add experience to the rescuer. event_var an automatically passed argument as the event instance. | def hostage_follows(event_var):
debug.write("[SourceRPG] Handling hostage_follows", 1)
if isFairForTeam(event_var['es_userteam']) or not int(unfairAdvantage):
if es.isbot(event_var['userid']) and not int(botsGetXpOnEvents):
return
player = players[event_var['userid']]
p... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_experience(self, action, state, reward, terminal):\n self.replay_buffer.add_experience(action, state, reward, terminal)",
"def add_new_experience(self, state, action, reward, next_state, done):\n e = self.experience(state, action, reward, next_state, done, self.max_priority)\n self.m... | [
"0.593074",
"0.58771837",
"0.56908643",
"0.5666346",
"0.5575405",
"0.55622417",
"0.5427135",
"0.54248756",
"0.5417219",
"0.53553927",
"0.5341621",
"0.52575743",
"0.52556723",
"0.52152026",
"0.52048665",
"0.51962274",
"0.5174919",
"0.5151833",
"0.5143459",
"0.51214314",
"0.512... | 0.7527848 | 0 |
Return date object of today | def get_today_date():
return date.today() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_today() -> datetime.date:\n return datetime.date.today()",
"def _today() -> datetime.date:\n return datetime.today().date()",
"def get_today():\n return datetime.today()",
"def today(cls):\n return date()",
"def today(cls, **kwargs: Any) -> Date:\n return cls.from_date(dt.dat... | [
"0.8653934",
"0.8596831",
"0.84236366",
"0.8416876",
"0.8336438",
"0.83197784",
"0.83108026",
"0.8303987",
"0.8222304",
"0.80481076",
"0.8014336",
"0.797015",
"0.79282165",
"0.78905267",
"0.76857233",
"0.7588385",
"0.7567955",
"0.7513336",
"0.7502944",
"0.74747443",
"0.743002... | 0.86230004 | 1 |
Returns string formatted date param date | def date_string(date):
day = date.day
month = date.month
year = date.year
formatted_string = str(month) + "/"
formatted_string += str(day) + "/"
formatted_string += str(year)
return formatted_string | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_template_formatted_date(date):\n return date.strftime(str(month(date.month)) + ' ' + str(date.day) + ', %Y')",
"def format_date(self, date):\n return date.strftime('%Y-%m-%d')",
"def date() -> str:\n\n return datetime.strftime(datetime.today(), _fmt)",
"def pretty_date(self, date):\r... | [
"0.78273416",
"0.7757879",
"0.76697254",
"0.7401167",
"0.7288869",
"0.7276896",
"0.7185441",
"0.71641225",
"0.71202797",
"0.7117997",
"0.7099156",
"0.7085898",
"0.7058775",
"0.70512676",
"0.70457864",
"0.70434535",
"0.69994026",
"0.69991475",
"0.6992349",
"0.69617146",
"0.693... | 0.7879395 | 0 |
x.shape = (m, n) theta.shape = (n,) output.shape = (m,) | def sigmoid(x, theta):
z = x @ theta
h = 1/(1+np.exp(-z))
return h, z | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _hypothesis(self, X):\n # * is element wise multiplication\n # numpy.dot(), or @ operator will work\n result = np.transpose(self.theta)@ X \n #emptyResult = np.zeros((1,X.shape[1]))\n return result",
"def simple_predict(x, theta):\n if len(x) == 0 or len(theta) != 2:\n... | [
"0.64048344",
"0.6291541",
"0.62236285",
"0.62043494",
"0.6199623",
"0.61560196",
"0.6139386",
"0.6065565",
"0.6064471",
"0.60408086",
"0.60015154",
"0.5954312",
"0.5915661",
"0.5904921",
"0.5891453",
"0.58317393",
"0.5820835",
"0.57998234",
"0.57591504",
"0.57530653",
"0.573... | 0.5929836 | 12 |
Convenience function to get full Pandas DataFrame for a table. | def get_table(self, tid_or_md5):
str_len = len(tid_or_md5)
if str_len not in {24, 32}:
raise ValueError(f"'{tid_or_md5}' is not a valid table id or md5 hash digest!")
if str_len == 32:
tables = self.tables.get_entries(md5=tid_or_md5, _fields=["id"]).result()
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def as_DataFrame (self):\n return DataFrame(self.table)",
"def select_from_table(self, table_name):\n sql_str = \"SELECT * FROM {tb}\".format(tb=table_name)\n cur = self.conn.cursor()\n cur.execute(sql_str)\n names = [description[0] for description in cur.description]\n\n ... | [
"0.7858079",
"0.75121844",
"0.73683894",
"0.7312127",
"0.7245212",
"0.7197946",
"0.7033599",
"0.70211816",
"0.7018553",
"0.7014984",
"0.7008965",
"0.6989481",
"0.6913623",
"0.689795",
"0.687254",
"0.6859025",
"0.68575835",
"0.6818615",
"0.68182105",
"0.6809308",
"0.680649",
... | 0.59951264 | 79 |
load requirements from a pip requirements file | def parse_requirements_from_pipfile():
lineiter = (line.strip() for line in open('Pipfile'))
requirements_pipfile_style = [line for line in lineiter]
start_index = requirements_pipfile_style.index('[packages]') + 1
end_index = requirements_pipfile_style.index('[requires]') - 1
requirements = list(ma... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def read_requirements():\n reqs_path = path.join('.', 'requirements.txt')\n with open(reqs_path, 'r') as f:\n requirements = [line.rstrip() for line in f]\n return requirements",
"def read_requirements():\r\n reqs_path = os.path.join('.', 'requirements.txt')\r\n with open(reqs_path, 'r') as... | [
"0.7206639",
"0.7187297",
"0.7138445",
"0.7138277",
"0.70911366",
"0.70401156",
"0.70233893",
"0.70084476",
"0.69288045",
"0.6917543",
"0.69035953",
"0.69035953",
"0.6900558",
"0.6823832",
"0.6820074",
"0.6802556",
"0.67198455",
"0.6716624",
"0.6715886",
"0.6673671",
"0.66272... | 0.7191491 | 1 |
override the backward function. It receives a Tensor containing the gradient of the loss with respect to the output of the custom forward pass, and calculates the gradients of the loss with respect to each of the inputs of the custom forward pass. | def backward(ctx, grad_from_upstream):
grad_inputX = grad_weight = grad_bias = None
print('Performing custom backward of MyConv2d')
nOutCh, nInCh, nKnRows, nKnCols, padding, stride = ctx.parameters
# inX_nSamp_nL_nB, kn_nB_nOutCh = ctx.saved_tensors
# grad_out = torch.ones(out.... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def backward(self, gradient):\n raise NotImplementedError()",
"def backward(self, inputs, grad_loss_input):\n raise NotImplementedError",
"def backward(self, gradient):\n #TODO\n pass",
"def backward(self, gradient):\n #TODO\n pass",
"def backward(self, lhs: Tensor... | [
"0.81633216",
"0.8097134",
"0.787698",
"0.787698",
"0.7850573",
"0.77789396",
"0.7766766",
"0.77033156",
"0.763549",
"0.7630257",
"0.75965536",
"0.75965536",
"0.7540222",
"0.7495414",
"0.74883366",
"0.74101365",
"0.73976374",
"0.73835903",
"0.738238",
"0.7360423",
"0.73377794... | 0.70672446 | 39 |
String for representing the Model object. | def __str__(self):
return self.usuario | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __str__(self):\n return super().__str__() + self.model.__str__()",
"def __str__(self):\n return \"DataModel(name={},attributes={},description={})\".format(\n self.name, {a.name: str(a) for a in self.attributes}, self.description\n )",
"def __str__(self):\n \n res =... | [
"0.82368803",
"0.79901737",
"0.7849152",
"0.78468513",
"0.77520275",
"0.7625378",
"0.7625378",
"0.76225406",
"0.76225406",
"0.75483394",
"0.7522958",
"0.7470355",
"0.7469358",
"0.7447144",
"0.7447144",
"0.74314755",
"0.7427648",
"0.7389925",
"0.7351721",
"0.73424315",
"0.7322... | 0.0 | -1 |
String for representing the Model object. | def __str__(self):
return self.identificacao | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __str__(self):\n return super().__str__() + self.model.__str__()",
"def __str__(self):\n return \"DataModel(name={},attributes={},description={})\".format(\n self.name, {a.name: str(a) for a in self.attributes}, self.description\n )",
"def __str__(self):\n \n res =... | [
"0.82368803",
"0.79901737",
"0.7849152",
"0.78468513",
"0.77520275",
"0.7625378",
"0.7625378",
"0.76225406",
"0.76225406",
"0.75483394",
"0.7522958",
"0.7470355",
"0.7469358",
"0.7447144",
"0.7447144",
"0.74314755",
"0.7427648",
"0.7389925",
"0.7351721",
"0.73424315",
"0.7322... | 0.0 | -1 |
String for representing the Model object. | def __str__(self):
return self.identificacao | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __str__(self):\n return super().__str__() + self.model.__str__()",
"def __str__(self):\n return \"DataModel(name={},attributes={},description={})\".format(\n self.name, {a.name: str(a) for a in self.attributes}, self.description\n )",
"def __str__(self):\n \n res =... | [
"0.82368803",
"0.79901737",
"0.7849152",
"0.78468513",
"0.77520275",
"0.7625378",
"0.7625378",
"0.76225406",
"0.76225406",
"0.75483394",
"0.7522958",
"0.7470355",
"0.7469358",
"0.7447144",
"0.7447144",
"0.74314755",
"0.7427648",
"0.7389925",
"0.7351721",
"0.73424315",
"0.7322... | 0.0 | -1 |
String for representing the Model object. | def __str__(self):
return self.identificacao | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __str__(self):\n return super().__str__() + self.model.__str__()",
"def __str__(self):\n return \"DataModel(name={},attributes={},description={})\".format(\n self.name, {a.name: str(a) for a in self.attributes}, self.description\n )",
"def __str__(self):\n \n res =... | [
"0.82368803",
"0.79901737",
"0.7849152",
"0.78468513",
"0.77520275",
"0.7625378",
"0.7625378",
"0.76225406",
"0.76225406",
"0.75483394",
"0.7522958",
"0.7470355",
"0.7469358",
"0.7447144",
"0.7447144",
"0.74314755",
"0.7427648",
"0.7389925",
"0.7351721",
"0.73424315",
"0.7322... | 0.0 | -1 |
String for representing the Model object. | def __str__(self):
return self.idContasBancarias | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __str__(self):\n return super().__str__() + self.model.__str__()",
"def __str__(self):\n return \"DataModel(name={},attributes={},description={})\".format(\n self.name, {a.name: str(a) for a in self.attributes}, self.description\n )",
"def __str__(self):\n \n res =... | [
"0.82368803",
"0.79901737",
"0.7849152",
"0.78468513",
"0.77520275",
"0.7625378",
"0.7625378",
"0.76225406",
"0.76225406",
"0.75483394",
"0.7522958",
"0.7470355",
"0.7469358",
"0.7447144",
"0.7447144",
"0.74314755",
"0.7427648",
"0.7389925",
"0.7351721",
"0.73424315",
"0.7322... | 0.0 | -1 |
String for representing the Model object. | def __str__(self):
return self.idPlanodeContas | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __str__(self):\n return super().__str__() + self.model.__str__()",
"def __str__(self):\n return \"DataModel(name={},attributes={},description={})\".format(\n self.name, {a.name: str(a) for a in self.attributes}, self.description\n )",
"def __str__(self):\n \n res =... | [
"0.82368803",
"0.79901737",
"0.7849152",
"0.78468513",
"0.77520275",
"0.7625378",
"0.7625378",
"0.76225406",
"0.76225406",
"0.75483394",
"0.7522958",
"0.7470355",
"0.7469358",
"0.7447144",
"0.7447144",
"0.74314755",
"0.7427648",
"0.7389925",
"0.7351721",
"0.73424315",
"0.7322... | 0.0 | -1 |
String for representing the Model object. | def __str__(self):
return self.idTesouraria | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __str__(self):\n return super().__str__() + self.model.__str__()",
"def __str__(self):\n return \"DataModel(name={},attributes={},description={})\".format(\n self.name, {a.name: str(a) for a in self.attributes}, self.description\n )",
"def __str__(self):\n \n res =... | [
"0.82368803",
"0.79901737",
"0.7849152",
"0.78468513",
"0.77520275",
"0.7625378",
"0.7625378",
"0.76225406",
"0.76225406",
"0.75483394",
"0.7522958",
"0.7470355",
"0.7469358",
"0.7447144",
"0.7447144",
"0.74314755",
"0.7427648",
"0.7389925",
"0.7351721",
"0.73424315",
"0.7322... | 0.0 | -1 |
String for representing the Model object. | def __str__(self):
return self.idLancamentosReceber | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __str__(self):\n return super().__str__() + self.model.__str__()",
"def __str__(self):\n return \"DataModel(name={},attributes={},description={})\".format(\n self.name, {a.name: str(a) for a in self.attributes}, self.description\n )",
"def __str__(self):\n \n res =... | [
"0.82368803",
"0.79901737",
"0.7849152",
"0.78468513",
"0.77520275",
"0.7625378",
"0.7625378",
"0.76225406",
"0.76225406",
"0.75483394",
"0.7522958",
"0.7470355",
"0.7469358",
"0.7447144",
"0.7447144",
"0.74314755",
"0.7427648",
"0.7389925",
"0.7351721",
"0.73424315",
"0.7322... | 0.0 | -1 |
String for representing the Model object. | def __str__(self):
return self.idLancamentosPagar | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __str__(self):\n return super().__str__() + self.model.__str__()",
"def __str__(self):\n return \"DataModel(name={},attributes={},description={})\".format(\n self.name, {a.name: str(a) for a in self.attributes}, self.description\n )",
"def __str__(self):\n \n res =... | [
"0.82368803",
"0.79901737",
"0.7849152",
"0.78468513",
"0.77520275",
"0.7625378",
"0.7625378",
"0.76225406",
"0.76225406",
"0.75483394",
"0.7522958",
"0.7470355",
"0.7469358",
"0.7447144",
"0.7447144",
"0.74314755",
"0.7427648",
"0.7389925",
"0.7351721",
"0.73424315",
"0.7322... | 0.0 | -1 |
String for representing the Model object. | def __str__(self):
return self.idBaixasPagar | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __str__(self):\n return super().__str__() + self.model.__str__()",
"def __str__(self):\n return \"DataModel(name={},attributes={},description={})\".format(\n self.name, {a.name: str(a) for a in self.attributes}, self.description\n )",
"def __str__(self):\n \n res =... | [
"0.82368803",
"0.79901737",
"0.7849152",
"0.78468513",
"0.77520275",
"0.7625378",
"0.7625378",
"0.76225406",
"0.76225406",
"0.75483394",
"0.7522958",
"0.7470355",
"0.7469358",
"0.7447144",
"0.7447144",
"0.74314755",
"0.7427648",
"0.7389925",
"0.7351721",
"0.73424315",
"0.7322... | 0.0 | -1 |
String for representing the Model object. | def __str__(self):
return self.idBaixasReceber | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __str__(self):\n return super().__str__() + self.model.__str__()",
"def __str__(self):\n return \"DataModel(name={},attributes={},description={})\".format(\n self.name, {a.name: str(a) for a in self.attributes}, self.description\n )",
"def __str__(self):\n \n res =... | [
"0.82368803",
"0.79901737",
"0.7849152",
"0.78468513",
"0.77520275",
"0.7625378",
"0.7625378",
"0.76225406",
"0.76225406",
"0.75483394",
"0.7522958",
"0.7470355",
"0.7469358",
"0.7447144",
"0.7447144",
"0.74314755",
"0.7427648",
"0.7389925",
"0.7351721",
"0.73424315",
"0.7322... | 0.0 | -1 |
Create Flask application from configuration | def create_app(conf: Type[Config]):
app = Flask(__name__)
app.config.from_object(conf)
configure_logger(conf)
register_pc_blueprints(app)
register_extensions(app)
return app | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_app(config: dict) -> Flask:\n for key, value in config.items():\n app.config[key] = value\n db.init_app(app)\n ma.init_app(app)\n app.app_context().push()\n return app",
"def create_app(config_name):\n app = Flask(__name__)\n # create app instance\n app.config.from_objec... | [
"0.8427379",
"0.83344364",
"0.8326829",
"0.8261388",
"0.82590467",
"0.82351655",
"0.8195056",
"0.81828797",
"0.8167928",
"0.8148545",
"0.8133118",
"0.8101586",
"0.8094889",
"0.8088425",
"0.80669814",
"0.8065195",
"0.804827",
"0.8043926",
"0.80278754",
"0.80248946",
"0.8023971... | 0.79825467 | 25 |
pad_sequence(batch) Pad a sequence of data sequences to be same length. Assume batch = [data_1, data2, ...], where data_1 has shape (len, dim, ...) This function is based on pytorch.org/docs/stable/_modules/torch/nn/utils/rnn.htmlpad_sequence | def pad_sequence(batch, padding_value=0.0):
max_size = batch[0].size()
trailing_dims = max_size[1:]
max_len = max([s.size(0) for s in batch])
if all(x.shape[0] == max_len for x in batch):
# if all data sequences in batch have the same length, no need to pad
return batch
else:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def pad(batch):\n batch_split = list(zip(*batch))\n seqs, num, targs, lengths, visits = batch_split[0], batch_split[1], batch_split[2], batch_split[3], batch_split[4]\n num = torch.vstack([torch.as_tensor(sample, dtype=torch.float32) for sample in zip(*num)]).T\n visits = [torch.as_tensor(s, dtype=torc... | [
"0.7181359",
"0.716605",
"0.7004993",
"0.70014405",
"0.69207954",
"0.6915517",
"0.6883656",
"0.68583316",
"0.6856418",
"0.6845394",
"0.6819812",
"0.6809443",
"0.67733485",
"0.6770608",
"0.6746975",
"0.6739718",
"0.6706203",
"0.6705902",
"0.66870517",
"0.6654135",
"0.66433656"... | 0.791605 | 0 |
customize_collate(batch) Collate a list of data into batch. Modified from default_collate. | def customize_collate(batch):
elem = batch[0]
elem_type = type(elem)
if isinstance(elem, torch.Tensor):
# this is the main part to handle varied length data in a batch
# batch = [data_tensor_1, data_tensor_2, data_tensor_3 ... ]
#
batch_new = pad_sequence(batch)
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def list_data_collate(batch):\n elem = batch[0]\n data = [i for k in batch for i in k] if isinstance(elem, list) else batch\n return default_collate(data)",
"def list_data_collate(batch: Sequence):\n elem = batch[0]\n data = [i for k in batch for i in k] if isinstance(elem, list) else batch\n k... | [
"0.7353768",
"0.7349397",
"0.7225524",
"0.7225524",
"0.7109456",
"0.7098255",
"0.703429",
"0.6827933",
"0.68194336",
"0.675708",
"0.67567116",
"0.6747518",
"0.6726074",
"0.6701571",
"0.6658887",
"0.6616413",
"0.66116816",
"0.6599393",
"0.6583497",
"0.65364635",
"0.6514098",
... | 0.71990985 | 4 |
customize_collate_existing_batch Similar to customize_collate, but input is a list of batch data that have been collated through customize_collate. The difference is use torch.cat rather than torch.stack to merge tensors. Also, list of data is directly concatenated This is used in customize_dataset when merging data fr... | def customize_collate_from_batch(batch):
elem = batch[0]
elem_type = type(elem)
if isinstance(elem, torch.Tensor):
batch_new = pad_sequence(batch)
out = None
if torch.utils.data.get_worker_info() is not None:
numel = max([x.numel() for x in batch_new]) * len(batc... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def customize_collate(batch):\n\n elem = batch[0]\n elem_type = type(elem)\n if isinstance(elem, torch.Tensor):\n # this is the main part to handle varied length data in a batch\n # batch = [data_tensor_1, data_tensor_2, data_tensor_3 ... ]\n # \n batch_new = pad_sequence(batch... | [
"0.7413131",
"0.7058218",
"0.68828297",
"0.6859043",
"0.680408",
"0.67939305",
"0.67877483",
"0.6763605",
"0.675337",
"0.6702357",
"0.6700112",
"0.6637627",
"0.6594895",
"0.6586544",
"0.6514319",
"0.6512587",
"0.6451992",
"0.64502823",
"0.64323694",
"0.64224505",
"0.6394607",... | 0.72789025 | 1 |
Checks out a book that's selected on the table. | def checkoutBook():
import bookcheckout as bc
try:
# Gets book info from table selection
selection = table.focus()
book = table.item(selection)
bookID = book["text"]
booktitle = book["values"][0]
# Checks if the user actually selects something fr... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def checkinBook():\n import bookreturn as br\n\n try:\n # Gets book info from table selection\n selection = table.focus()\n book = table.item(selection)\n bookID = book[\"text\"]\n booktitle = book[\"values\"][0]\n\n msg = \"Are you sure you want to c... | [
"0.74588484",
"0.6683966",
"0.6335782",
"0.61959136",
"0.60166854",
"0.598962",
"0.59741604",
"0.5908561",
"0.5705664",
"0.5677665",
"0.56390065",
"0.5635061",
"0.5624559",
"0.54584104",
"0.5455421",
"0.545462",
"0.5445411",
"0.5436989",
"0.5422137",
"0.5418979",
"0.54153144"... | 0.6246235 | 3 |
Open dialogbox, chose multiple files and load them | def add_songs(self):
settings = dict(initialdir=pathlib.Path().absolute(), title="Choose songs", filetypes=(
("flac files", "*.flac"),
("mp3 files", "*.mp3"),
("all files", "*")))
songs = filedialog.askopenfilenames(**settings)
for song in songs:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def callDialog(self):\n self.pathTuple = filedialog.askopenfilenames(filetypes=[(\"Excel files\", \".xlsx .xls .xlsm .xlsb\")])\n self.fileNames = [basename(path.abspath(name)) for name in self.pathTuple]",
"def OnOpenFile( self, event ):\n dialog = wx.FileDialog( self, style=wx.OPEN|wx.FD_M... | [
"0.76915604",
"0.7498169",
"0.7486172",
"0.7305984",
"0.7185487",
"0.70953095",
"0.6880825",
"0.6874997",
"0.68563735",
"0.6837212",
"0.6833007",
"0.67859036",
"0.6732435",
"0.6722106",
"0.6695518",
"0.6693238",
"0.66891414",
"0.6633548",
"0.6633372",
"0.66301554",
"0.6621235... | 0.0 | -1 |
Deactivate the LaserPowerUp by turning the paddle back to a normal paddle. | def deactivate(self):
self.game.paddle.transition(NormalState(self.game.paddle))
for ball in self.game.balls:
ball.base_speed -= 1 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def turn_off(self, **kwargs) -> None:\n self.wink.set_state(False)",
"def lightning_turnoff(self):\n self.turnOff()",
"def turn_off(self) -> None:\n self._monoprice.set_power(self._zone_id, False)",
"def turn_off(self, **kwargs: Any) -> None:\n self._light.turn_off()",
"def deac... | [
"0.7058652",
"0.6920515",
"0.6852542",
"0.6797513",
"0.6796544",
"0.6776762",
"0.6771071",
"0.67622006",
"0.67500037",
"0.6711543",
"0.6704139",
"0.6683218",
"0.6662738",
"0.6662738",
"0.6650904",
"0.6633985",
"0.662553",
"0.66224134",
"0.66155356",
"0.6589445",
"0.65587646",... | 0.77880657 | 0 |
Deactivate the CatchPowerUp from preventing the paddle from catching the ball. | def deactivate(self):
self.game.paddle.ball_collide_callbacks.remove(self._catch)
receiver.unregister_handler(self._release_ball)
for ball in self.game.balls:
ball.release() # Release a currently caught ball. | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def deactivate(self):\n self.game.paddle.transition(NormalState(self.game.paddle))\n for ball in self.game.balls:\n ball.base_speed -= 1",
"def deactivate(self):\n self.game.paddle.transition(NormalState(self.game.paddle))\n for ball in self.game.balls:\n ball.ba... | [
"0.75264597",
"0.75264597",
"0.68926805",
"0.68559355",
"0.68194497",
"0.6793215",
"0.6762291",
"0.67272264",
"0.67272264",
"0.66612196",
"0.6643644",
"0.6609496",
"0.65968233",
"0.6589458",
"0.6571194",
"0.65582097",
"0.6506576",
"0.64652926",
"0.64581794",
"0.64403796",
"0.... | 0.72599006 | 2 |
Preprocess a single variant for the detailed variant view. Adds information from case and institute that is not present on the variant object | def variant(store, institute_obj, case_obj, variant_id=None, variant_obj=None, add_case=True,
add_other=True, get_overlapping=True):
# If the variant is already collected we skip this part
if not variant_obj:
default_panels = []
# Add default panel information to variant
for ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def parse_variant(store, institute_obj, case_obj, variant_obj, update=False, genome_build='37',\n get_compounds = True):\n has_changed = False\n compounds = variant_obj.get('compounds', [])\n if compounds and get_compounds:\n # Check if we need to add compound information\n ... | [
"0.608851",
"0.6021321",
"0.58918136",
"0.5795677",
"0.5597111",
"0.55460155",
"0.5525129",
"0.5479657",
"0.54382885",
"0.54382885",
"0.53309256",
"0.53179866",
"0.52411747",
"0.519342",
"0.5181355",
"0.51217365",
"0.51134086",
"0.5065134",
"0.5040361",
"0.50294924",
"0.50163... | 0.5939887 | 2 |
Returns a handler for logging streams | def get_console_handler(formatter: logging.Formatter = None) -> logging.Handler:
if formatter is None:
formatter = get_console_formatter()
handler = logging.StreamHandler(sys.stdout)
handler.setLevel(logging.DEBUG)
handler.setFormatter(formatter)
return handler | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_logging_handler(filename):\n\n return ( logging.StreamHandler(sys.stdout) if filename == '-' else\n logging.FileHandler(filename) )",
"def log_handler(self):\n return self._log_handler",
"def gen_handler(filename=None, stream=None):\n if filename:\n hdlr = logging.FileHa... | [
"0.7423742",
"0.7332335",
"0.722834",
"0.7175351",
"0.6861065",
"0.6744514",
"0.6677573",
"0.65909296",
"0.658112",
"0.64627683",
"0.63689435",
"0.63595396",
"0.63117766",
"0.6299819",
"0.62830913",
"0.62595457",
"0.62476605",
"0.62468004",
"0.6216274",
"0.62071574",
"0.61775... | 0.59336853 | 34 |
Wrapper for int lookupVal(Tree , int). | def lookupVal(self, val):
pybtlib.lookupVal.restype = ctypes.c_int
pybtlib.lookupVal.argtypes = [ctypes.POINTER(Tree), ctypes.c_int]
return pybtlib.lookupVal(ctypes.byref(self), val) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def lookup(self, val):\n if val < self.val:\n if self.left is None:\n return None, None\n return self.left.lookup(val)\n elif val > self.val:\n if self.right is None:\n return None, None\n return self.right.lookup(val)\n ... | [
"0.6927922",
"0.6834086",
"0.66056705",
"0.6355823",
"0.6350872",
"0.6265402",
"0.61644393",
"0.61089545",
"0.6104344",
"0.604303",
"0.6039789",
"0.60196805",
"0.6002736",
"0.5967103",
"0.595608",
"0.59339106",
"0.59268373",
"0.58994985",
"0.58800536",
"0.584118",
"0.58069015... | 0.8050536 | 0 |
Strip know prefixes and suffixes | def format_host(host):
host = strip_suffix(host, ".lan.urlab.be")
host = strip_suffix(host, ".lan")
host = strip_suffix(host, ".local")
host = strip_suffix(host, "iPodtouch")
host = strip_suffix(host, "-PC")
host = strip_suffix(host, "-pc")
host = strip_prefix(host, "pc-")
host = strip... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def strip_suffix(s, suffixes):\n for suffix in suffixes:\n if s.endswith(suffix):\n return s.rstrip(suffix)\n return s",
"def strip_any_ends(s: str, prefixes: Union[str, Sequence[str]], suffixes: Union[str, Sequence[str]]) -> str:\n\t\tprefixes = [str(z) for z in prefixes] if StringTools.... | [
"0.71685594",
"0.7031702",
"0.6702066",
"0.6652825",
"0.63690686",
"0.6362477",
"0.6301411",
"0.62832355",
"0.62511486",
"0.62463945",
"0.62463945",
"0.62463945",
"0.62453246",
"0.61820644",
"0.613278",
"0.6077133",
"0.60370183",
"0.60113984",
"0.59852266",
"0.5958948",
"0.59... | 0.0 | -1 |
Load fashion_MNIST data from `path` | def load_fashion_mnist(path, kind='train'):
labels_path = os.path.join(path, '%s-labels-idx1-ubyte.gz' % kind)
images_path = os.path.join(path, '%s-images-idx3-ubyte.gz' % kind)
with gzip.open(labels_path, 'rb') as lbpath:
labels = np.frombuffer(lbpath.read(), dtype=np.uint8, offset=8)
with gzip... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def load_data(path='mnist.npz'):\n origin_folder = 'https://storage.googleapis.com/tensorflow/tf-keras-datasets/'\n path = get_file(\n path,\n origin=origin_folder + 'mnist.npz',\n file_hash=\n '731c5ac602752760c8e48fbffcf8c3b850d9dc2a2aedcf2cc48468fc17b673d1')\n print('#####################... | [
"0.76274836",
"0.7411226",
"0.7199152",
"0.7120821",
"0.71085835",
"0.7072709",
"0.70594734",
"0.7059057",
"0.7016189",
"0.70027125",
"0.6966507",
"0.6943894",
"0.6919206",
"0.6892158",
"0.6829008",
"0.6810349",
"0.67828906",
"0.674293",
"0.66623396",
"0.6651125",
"0.6636103"... | 0.70983523 | 5 |
Moves the balls diagonally | def move_diagonal(self):
if self.movement == "diagonal" and self.flag_move:
self.move_ball()
self.canvas.after(50, self.move_diagonal) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def move(self):\r\n segments = len(self.all_turtles) - 1\r\n for i in range(len(self.all_turtles)):\r\n if segments == 0:\r\n self.all_turtles[segments].forward(MOVE_DISTANCE)\r\n else:\r\n new_x = self.all_turtles[segments - 1].xcor()\r\n ... | [
"0.66651475",
"0.6550679",
"0.6395154",
"0.63797206",
"0.6299558",
"0.62587523",
"0.62128484",
"0.6206596",
"0.61807424",
"0.6166133",
"0.61547524",
"0.61271274",
"0.6089688",
"0.6037283",
"0.6030345",
"0.60205376",
"0.60084575",
"0.6004963",
"0.60009104",
"0.59675854",
"0.59... | 0.74145764 | 0 |
Moves the balls horizontally | def move_horizontal(self):
if self.movement == "horizontal" and self.flag_move:
self.move_ball()
self.canvas.after(50, self.move_horizontal) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __move_ball(self):\n while not self.__game_is_over():\n self.__ball.move(self.__dx, self.__dy)\n self.__handle_wall_collision()\n if self.__num_lives == 0:\n self.__game_over_picture()\n break\n elif self.__bricks_total == 0:\n ... | [
"0.7243833",
"0.7068807",
"0.69898486",
"0.6867416",
"0.6714377",
"0.6633797",
"0.6631648",
"0.6624804",
"0.65527695",
"0.6443604",
"0.64345825",
"0.64218265",
"0.6397861",
"0.6392384",
"0.6389125",
"0.63599265",
"0.6359351",
"0.6324332",
"0.62822974",
"0.62703186",
"0.620782... | 0.7405119 | 0 |
Moves the balls vertically | def move_vertical(self):
if self.movement == "vertical" and self.flag_move:
self.move_ball()
self.canvas.after(50, self.move_vertical) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def bounce_vertical(self):\n self.velocity.dy = -self.velocity.dy\n return",
"def move_ball(self):\r\n self.canvas.move(self.ball, (self.x_speed * self.speed), (self.y_speed * self.speed))\r\n (leftPos, topPos, rightPos, bottomPos) = self.canvas.coords(self.ball)\r\n if leftPos... | [
"0.6977477",
"0.6945297",
"0.6887037",
"0.6833156",
"0.67889786",
"0.67722464",
"0.6723922",
"0.6694666",
"0.6661022",
"0.6658336",
"0.6623837",
"0.66024196",
"0.65730596",
"0.657034",
"0.6557201",
"0.649515",
"0.64945257",
"0.6468256",
"0.64178634",
"0.6403378",
"0.6374564",... | 0.78217965 | 0 |
Delete the ball from the canvas | def delete_ball(self):
self.movement = ""
self.canvas.delete(self.ball) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def deleteBall(self):\n self._ball = None",
"def remove_ball(ball_list, canvas):\r\n if len(ball_list) > 1:\r\n ball_list[len(ball_list) - 1].delete_ball()\r\n ball_list.pop()",
"def undraw(self):\n \n if not self.canvas: return\n if not self.canvas.isClosed():\n ... | [
"0.83360744",
"0.7770917",
"0.7034464",
"0.69925016",
"0.67970556",
"0.6789905",
"0.672613",
"0.6711143",
"0.6594619",
"0.658911",
"0.64779085",
"0.6409849",
"0.6407961",
"0.6395292",
"0.63238114",
"0.62632704",
"0.6258375",
"0.6257567",
"0.62449646",
"0.6192465",
"0.6185397"... | 0.87093425 | 0 |
Sets the learning rate to the initial LR decayed by 10 every 30 epochs | def adjust_learning_rate(self, optimizer, epoch):
if self.args.lr_mode == 'step':
lr = self.args.lr * (0.1 ** (epoch // self.args.lr_step))
elif self.args.lr_mode == 'poly':
lr = self.args.lr * (1 - epoch / self.args.train_epochs) ** 0.9
else:
raise ValueError... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def adjust_learning_rate(init_lr, optimizer, epoch, n=100):\n init_lr = init_lr * (0.1 ** (epoch // n))\n print('learning rate : ', init_lr)\n for param_group in optimizer.param_groups:\n param_group['lr'] = init_lr",
"def adjust_learning_rate(start_lr, optimizer, epoch, total_epoch_num):\n #l... | [
"0.7913536",
"0.7906521",
"0.7849834",
"0.777524",
"0.77338326",
"0.77306354",
"0.7722718",
"0.77224237",
"0.771982",
"0.77092624",
"0.7693604",
"0.76742035",
"0.7665748",
"0.7665748",
"0.7665748",
"0.7655329",
"0.76419765",
"0.76399755",
"0.7637868",
"0.7626077",
"0.76247585... | 0.0 | -1 |
A divide operator complying to normal practice in C++ and Java, i.e., 5 / 4 == 1, while the result is 2 in Python. | def divide(self, dividend, divisor):
if divisor == 0:
raise ValueError('Divisor cannot be 0.')
if abs(dividend) < abs(divisor):
# including dividend == 0
return 0
i = 1
# note: use <= instead of < to reduce loops
while abs... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def divide(a, b):\n return a / b",
"def division(a, b):\n if b != 0:\n return a//b",
"def div(a,b):\r\n return a/b",
"def divide(num1, num2):\n return num1 / num2",
"def divide(self, a, b):\n return a / b",
"def division(x, y):\n return x / y",
"def divide(numerator, denominator)... | [
"0.7931238",
"0.7926792",
"0.78602046",
"0.77616876",
"0.7731375",
"0.7715093",
"0.7672755",
"0.76726896",
"0.7615924",
"0.7615924",
"0.757699",
"0.757699",
"0.757699",
"0.7571294",
"0.7556999",
"0.7494714",
"0.7480846",
"0.74476486",
"0.74335873",
"0.74060017",
"0.7375388",
... | 0.0 | -1 |
Check if start and end dates can be randomly generated. | def test_generate_random_dates():
random_start_date, random_end_date = sga.generate_random_dates()
print(f'Starting forecast on {random_start_date}')
print(f'Ending forecast on {random_end_date}')
r_start_date, r_end_date = sga.generate_random_dates(input_start_date=start_date)
print(f'Starting fore... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def valid_dates(self):\n return random.choice(VALID_DATES)",
"def test_list_dates(date_generated: list, end: datetime, start: datetime):\n assert min(date_generated) == start, 'test fail, the first day should be ' \\\n + str(start) +'but now is '+ str(min(date_generated))\n assert max(date_genera... | [
"0.73247933",
"0.7044709",
"0.6732887",
"0.665889",
"0.6492406",
"0.64824843",
"0.6471607",
"0.6437531",
"0.6419879",
"0.6419879",
"0.6419879",
"0.6419879",
"0.6419879",
"0.63739127",
"0.6351772",
"0.6338801",
"0.6303549",
"0.62990105",
"0.61863667",
"0.61442775",
"0.61258775... | 0.7555373 | 0 |
Get the unique angle types for a structure and return a dictionary | def _get_unique_angle_types(
structure, sigma_conversion_factor, epsilon_conversion_factor
):
unique_angle_set = set()
for angle in structure.angles:
unique_angle_set.add(
_get_angle_type_key(
angle, sigma_conversion_factor, epsilon_conversion_factor
)
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _get_angle_types(\n structure,\n sigma_conversion_factor,\n epsilon_conversion_factor,\n use_urey_bradleys=False,\n):\n\n if use_urey_bradleys:\n print_warn_text = (\n \"WARNING: Urey-Bradleys are not available in the current \"\n \"version of this psf, pdb, and GOMC... | [
"0.7377366",
"0.68859917",
"0.64195013",
"0.6342553",
"0.6278085",
"0.6178407",
"0.5788178",
"0.57732904",
"0.56885266",
"0.56549114",
"0.55812967",
"0.55375785",
"0.5524143",
"0.5508099",
"0.5470323",
"0.5466246",
"0.54648465",
"0.54485077",
"0.5421309",
"0.52955174",
"0.527... | 0.799738 | 0 |
Get the tenant field from the model object or class | def get_tenant_column(model_class_or_instance):
if inspect.isclass(model_class_or_instance):
model_class_or_instance = model_class_or_instance()
try:
return model_class_or_instance.tenant_field
except Exception as not_a_tenant_model:
raise ValueError(
f"{model_class_or_i... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_tenant_field(model_class_or_instance):\n tenant_column = get_tenant_column(model_class_or_instance)\n all_fields = model_class_or_instance._meta.fields\n try:\n return next(field for field in all_fields if field.column == tenant_column)\n except StopIteration as no_field_found:\n ... | [
"0.80482733",
"0.75131196",
"0.71290123",
"0.68185806",
"0.63347614",
"0.6281159",
"0.6156468",
"0.61305684",
"0.610401",
"0.610401",
"0.610401",
"0.610401",
"0.610401",
"0.610401",
"0.610401",
"0.610401",
"0.610401",
"0.610401",
"0.6098734",
"0.60276335",
"0.59972024",
"0.... | 0.80951077 | 0 |
Gets the tenant field object from the model | def get_tenant_field(model_class_or_instance):
tenant_column = get_tenant_column(model_class_or_instance)
all_fields = model_class_or_instance._meta.fields
try:
return next(field for field in all_fields if field.column == tenant_column)
except StopIteration as no_field_found:
raise Value... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_object_tenant(instance):\n field = get_tenant_field(instance)\n\n if field.primary_key:\n return instance\n\n return getattr(instance, field.name, None)",
"def get_tenant_column(model_class_or_instance):\n if inspect.isclass(model_class_or_instance):\n model_class_or_instance = ... | [
"0.7409334",
"0.7245444",
"0.6262144",
"0.6092733",
"0.6055952",
"0.5878847",
"0.5834591",
"0.57810694",
"0.57445353",
"0.56795067",
"0.5632898",
"0.5594328",
"0.55784714",
"0.5570973",
"0.5515345",
"0.54866445",
"0.5443312",
"0.5443312",
"0.5443312",
"0.5443312",
"0.54277986... | 0.75571513 | 0 |
If model has tenant_field, it is distributed model and returns True | def is_distributed_model(model):
try:
get_tenant_field(model)
return True
except ValueError:
return False | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def public_tenant(db) -> TenantModel:\n return TenantModel.objects.get(schema_name='public')",
"def tenant_exists(self, keystone, tenant):\n return tenant in [t.name for t in keystone.tenants.list()]",
"def get_tenant_column(model_class_or_instance):\n if inspect.isclass(model_class_or_instance):\... | [
"0.6298046",
"0.61161894",
"0.5999763",
"0.5972134",
"0.58867013",
"0.5790883",
"0.5720545",
"0.567395",
"0.55599165",
"0.5521218",
"0.5491976",
"0.5452934",
"0.5328807",
"0.53256154",
"0.53072023",
"0.5299725",
"0.52874327",
"0.5242823",
"0.52289766",
"0.51977915",
"0.514755... | 0.8454409 | 0 |
Opens a text file and returns a list of lines. | def load_file(file):
try:
with open(Path(file), "r", encoding="utf-8", newline="") as f:
txt_file = f.read()
except:
sys.exit("IO_Tools: ERROR: "+str(file)+" not found!")
lines = txt_file.split("\n")
return lines | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _get_lines_from_file(path: str) -> List[str]:\n if os.path.isfile(path):\n with open(path, 'r') as f:\n lines = f.readlines()\n else:\n raise InputError(f'Could not find file {path}')\n return lines",
"def read_text_file(file_name):\n target_file = open(file_name)\n li... | [
"0.78456855",
"0.7675798",
"0.76339895",
"0.76097065",
"0.7564956",
"0.75410044",
"0.75408643",
"0.7534968",
"0.7485523",
"0.7463525",
"0.7448016",
"0.7440336",
"0.7424654",
"0.7424654",
"0.73861015",
"0.73419446",
"0.73094815",
"0.7295988",
"0.7291562",
"0.7284069",
"0.72741... | 0.72671646 | 22 |
Pad framewise_output to the same length as input frames. The pad value is the same as the value of the last frame. | def pad_framewise_output(framewise_output: torch.Tensor, frames_num: int):
output = F.interpolate(
framewise_output.unsqueeze(1),
size=(frames_num, framewise_output.size(2)),
align_corners=True,
mode="bilinear").squeeze(1)
return output | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def pad_framewise_output(framewise_output, frames_num):\n pad = framewise_output[:, -1:, :].repeat(1, frames_num - framewise_output.shape[1], 1)\n \"\"\"tensor for padding\"\"\"\n\n output = torch.cat((framewise_output, pad), dim=1)\n \"\"\"(batch_size, frames_num, classes_num)\"\"\"\n\n return outp... | [
"0.8230525",
"0.82135236",
"0.67780495",
"0.67009693",
"0.6574371",
"0.642794",
"0.6362434",
"0.6183593",
"0.60449564",
"0.5976816",
"0.597147",
"0.5955774",
"0.59088176",
"0.59041893",
"0.5786622",
"0.5726494",
"0.5724364",
"0.5715806",
"0.5688636",
"0.5676946",
"0.5653165",... | 0.79476565 | 2 |
takes a time delta and renders it as duration | def duration(value, arg=False):
if value in (None, ""):
return "n/a"
out = []
try:
if value.days > 1:
out.append(_("%i days") % value.days)
elif value.days == 1:
out.append(_("1 day"))
hours = value.seconds // 3600
if hours > 1:
out... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_formatted_duration(self, prev_time):\n duration = time() - prev_time\n if duration < 60:\n unit = 's'\n elif duration < 3600:\n duration /= 60\n unit = 'm'\n else:\n duration /= 3600\n unit = 'h'\n return self.format_... | [
"0.67778593",
"0.66511095",
"0.66511095",
"0.6614153",
"0.6538241",
"0.6485308",
"0.6431969",
"0.6266483",
"0.62496126",
"0.6182504",
"0.6182504",
"0.6181178",
"0.6174052",
"0.60934657",
"0.6088927",
"0.6073427",
"0.6051218",
"0.6035535",
"0.6019201",
"0.60070443",
"0.6006284... | 0.5507477 | 87 |
Sets Learning Rate, by default 0.005 | def setLr(self, v):
self._set(lr=v)
return self | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_learning_rate(self, rate):\n self.SGD.set_learning_rate(rate)",
"def learning_rate(epoch):\n self.lr = self.lr / 1.00000001\n return self.lr",
"def get_learning_rate():\n return 0.00001",
"def adjust_lr(self):\n learning_rate = self.params.base_lr * (1 - float(s... | [
"0.7886247",
"0.7745351",
"0.772201",
"0.7547677",
"0.74695325",
"0.7341996",
"0.72804904",
"0.7257586",
"0.72054935",
"0.7197993",
"0.7197993",
"0.7168854",
"0.7168075",
"0.7165448",
"0.71572345",
"0.7146253",
"0.7144686",
"0.712755",
"0.712755",
"0.7124229",
"0.7103722",
... | 0.0 | -1 |
Sets configProto from tensorflow, serialized into byte array. | def setConfigProtoBytes(self, b):
return self._set(configProtoBytes=b) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def setConfigProtoBytes(self, v):\n return self._set(configProtoBytes=v)",
"def make_config_proto(c):\n # tensorflow config\n use_gpu = os.environ.get('use_gpu', c.get('tf.config.use_gpu', c.get('use_gpu', 1)))\n cfg = tf.ConfigProto(device_count={'GPU': use_gpu})\n\n # scan config for tf conf... | [
"0.7560355",
"0.62152916",
"0.6164584",
"0.5977578",
"0.59044033",
"0.58424354",
"0.5599705",
"0.5587182",
"0.5409192",
"0.532023",
"0.5215159",
"0.52109444",
"0.51659745",
"0.51495427",
"0.5090641",
"0.5055646",
"0.5016743",
"0.49855116",
"0.4972061",
"0.49627805",
"0.490428... | 0.75176936 | 1 |
Returns a string made by inserting the separator between each element and concatenating all the elements into a single string | def join(sep, xs):
return str(sep).join(xs) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def join(self, delimiter: str) -> str:\n return delimiter.join((str(x) for x in self.array))",
"def join_list(items: Iterable[str]) -> str:\n\n return ITEM_SEPARATOR.join(items)",
"def implode(delim, items):\n return delim.join(items)",
"def multilinify(sequence, sep=\",\"):\n sep += \"\\n\"\n ... | [
"0.72189754",
"0.71628153",
"0.7035094",
"0.69862586",
"0.69632185",
"0.69478136",
"0.68571323",
"0.6735418",
"0.67223924",
"0.66875136",
"0.6664757",
"0.6609444",
"0.6593416",
"0.65912044",
"0.65875036",
"0.6561406",
"0.65593415",
"0.6549221",
"0.6531431",
"0.65275705",
"0.6... | 0.6976438 | 4 |
Get the S3 url. | def get_s3_url(iid):
return "http://%s.s3-website.%s.amazonaws.com/%s" % (
BUCKET_NAME,
AWS_CLIENT_CONFIG['region_name'],
iid
) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_s3_url(self, bucket=None, region=None):\n \n if bucket is None:\n bucket = self.AWS_S3_BUCKET\n \n if region is None:\n region = self.AWS_S3_REGION\n \n return \"https://{}.s3.{}.amazonaws.com/\".format(bucket, region)",
"def url(cls, bu... | [
"0.8289473",
"0.7931248",
"0.75116867",
"0.7491246",
"0.7465214",
"0.73777646",
"0.7259455",
"0.7257445",
"0.7243904",
"0.7159253",
"0.7088656",
"0.7044132",
"0.70176286",
"0.70146",
"0.6969221",
"0.6969221",
"0.69657195",
"0.6955842",
"0.6936773",
"0.6895221",
"0.67988515",
... | 0.83046556 | 0 |
Sets the log_age_limit of this SupportBundleRequest. | def log_age_limit(self, log_age_limit):
if log_age_limit is not None and log_age_limit < 1: # noqa: E501
raise ValueError("Invalid value for `log_age_limit`, must be a value greater than or equal to `1`") # noqa: E501
self._log_age_limit = log_age_limit | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def max_age(self, max_age):\n self._max_age = max_age",
"def max_age(self, max_age):\n\n self._max_age = max_age",
"def set_max_record_limit(self, limit):\n self.max_record_limit = limit",
"def reg_limit(self, reg_limit):\n\n self._reg_limit = reg_limit",
"def limit(self, limit)... | [
"0.67914575",
"0.6746131",
"0.6175816",
"0.58389044",
"0.580185",
"0.57821816",
"0.57821816",
"0.57821816",
"0.57633424",
"0.5667575",
"0.5663853",
"0.5600508",
"0.5544962",
"0.554482",
"0.5511974",
"0.5494802",
"0.5457736",
"0.5457736",
"0.5435164",
"0.54224366",
"0.54214627... | 0.7821875 | 0 |
Returns true if both objects are equal | def __eq__(self, other):
if not isinstance(other, SupportBundleRequest):
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 |
Create an adapter for Mongodb | def __init__(self, uri, dbname, collection="casbin_rule"):
client = MongoClient(uri)
db = client[dbname]
self._collection = db[collection] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def mongo_client():\n return MongoClient(STRING_CONNECTION)",
"def create_mongodb(config):\n\n \n mongo_url = \"mongodb://\"\n mongo_url += \",\".join(map(lambda srv: srv['host'] + \":\" + str(srv['port']), config['data']['mongoServers']))\n \n if 'replica' in config['data']:\n mongo_... | [
"0.7007138",
"0.6834357",
"0.6779917",
"0.67582184",
"0.6709291",
"0.67032146",
"0.6657312",
"0.6645258",
"0.6608664",
"0.6433407",
"0.64238524",
"0.6422316",
"0.63949144",
"0.6389859",
"0.6380381",
"0.63720673",
"0.63629264",
"0.6337435",
"0.6328464",
"0.63067514",
"0.630234... | 0.59778434 | 44 |
Checks the internal self.str_sleepLength value that is used to trigger tests. The CLI `test` flag might be set by a descendent or sibling module and hence cause issues if interpreted by this class. This method attempts some very rudimentary checks on the `test` flag (and hence the self.str_sleepLength). | def checkFor_tests(self) -> bool:
b_status : bool = False
if isinstance(self.str_sleepLength, str):
if len(self.str_sleepLength):
b_status = True
l_test = self.str_sleepLength.split(':')
self.str_sleepLength = l_test[0]
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_sleep_invalid_mode(mocker):\n runner = CliRunner()\n result = runner.invoke(main, ['sleep', '2'])\n\n assert result.exit_code == 2\n assert 'Usage:' in result.output\n assert 'invalid choice: 2' in result.output",
"def test_checkFlags(self):\n self.failUnlessEqual(self.nice.opts['a... | [
"0.55771667",
"0.5507204",
"0.54705614",
"0.54705614",
"0.5470502",
"0.5470502",
"0.5467711",
"0.54496896",
"0.53961444",
"0.5384182",
"0.5378267",
"0.53602403",
"0.53410244",
"0.53115696",
"0.52877504",
"0.52573293",
"0.5248195",
"0.5247275",
"0.5229112",
"0.5172623",
"0.516... | 0.78081095 | 0 |
Fire up a set of threads and wait for them to join the main execution flow | def thread_batch(l_threadFunc, outerLoop, innerLoop, offset):
start = 0
join = 0
il = lambda f, i, o, l : f + i + o * l
for t_o in range(0, outerLoop):
for t_i in range(0, innerLoop):
idx = il(offset, t_i, t_o, innerLoop)
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def invoke_all_and_wait(self):\n list_promise = []\n for thread in self.__list_thread:\n thread.start()\n list_promise.append(thread)\n for process in list_promise: process.join()",
"def wait_threads(self):\n\n self.queue.join()",
"def joiner():\n for th... | [
"0.78885126",
"0.740439",
"0.72701514",
"0.71893257",
"0.7126251",
"0.6967335",
"0.69307554",
"0.67873883",
"0.6730191",
"0.6698169",
"0.6689888",
"0.6545332",
"0.6506571",
"0.6445436",
"0.6405833",
"0.6401336",
"0.6324102",
"0.628688",
"0.6281959",
"0.6248197",
"0.62464124",... | 0.0 | -1 |
Set the 'rootDir' for the tree structure. This is either a '.' indicating a relative tree, or the inputDir | def tree_resolveRoot():
nonlocal str_rootDir
if self.b_relativeDir:
os.chdir(self.str_inputDir)
str_rootDir = '.'
else:
str_rootDir = self.str_inputDir
return str_rootDir | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_root(self, root):\n self.root_path = root",
"def set_relative_root(self, root):\r\n self.root = root",
"def set_relative_root(self, root):\r\n self.root = root",
"def set_relative_root(self, root):\n self.root = root",
"def path(self, root_dir):\r\n path = os.path.realpath(root_d... | [
"0.7119716",
"0.686844",
"0.686844",
"0.6804279",
"0.67613715",
"0.67233735",
"0.657387",
"0.63898146",
"0.6006341",
"0.60000134",
"0.5998079",
"0.59577316",
"0.5894744",
"0.5877747",
"0.58646923",
"0.5840676",
"0.5828456",
"0.5781375",
"0.57619816",
"0.5718934",
"0.5683242",... | 0.70863307 | 1 |
Returns `to_send_at` timestamp (float). | def to_send_at(self):
return self._to_send_at / 10000000 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sent_at(self):\n return self.getattr('sent_at')",
"def get_datetime(self):\n timestamp = self.SendTime + self.SendTimeNS / 1000000000.0\n return datetime.datetime.utcfromtimestamp(timestamp)",
"def get_user_time_to_send(self):\n return self.user_id_to_next_image_send_time",
"d... | [
"0.6755325",
"0.6162124",
"0.5948823",
"0.57770556",
"0.5737487",
"0.57052445",
"0.5669637",
"0.55361",
"0.5489749",
"0.5442646",
"0.5436916",
"0.543466",
"0.54241914",
"0.54084533",
"0.5394316",
"0.5386027",
"0.53149",
"0.53076315",
"0.5296575",
"0.52891976",
"0.52854246",
... | 0.80320334 | 0 |
Parses a corpus file and initialize the object. | def parse_file(self, filepath):
xml_file = open(filepath, "r")
xml = xml_file.read()
content = ""
xml_file.close()
for line in xml.replace("&", "&").split("\n"):
if content != "":
content += " "
content += re.sub("(<(P|F).*?>)|(<\\/P>)", "", line).strip()
# XML cleanni... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self, corpus):\n if isinstance(corpus, str):\n # Convert directory to Plaintext Corpus.\n corpus = PlaintextCorpusReader(corpus, r\".*\\.txt\")\n self.corpus = corpus\n self._bigrams = FreqDist()\n self._count()",
"def __init__(self, root, fileids=DO... | [
"0.7503191",
"0.7118818",
"0.70117855",
"0.6934144",
"0.6868313",
"0.6857307",
"0.6857307",
"0.68565124",
"0.66740966",
"0.66146624",
"0.6609699",
"0.6571402",
"0.6543763",
"0.6475431",
"0.6426878",
"0.6390277",
"0.63347775",
"0.63323456",
"0.6282479",
"0.6246842",
"0.6245115... | 0.0 | -1 |
Log message to stderr. | def Log(msg):
# Since Visual Studio basically seems to completely ignore the stdout
# of the compiler and only echo stderr we print everythign to stderr.
sys.stderr.write(str(msg) + '\n')
sys.stderr.flush() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def error(self, msg, stderr=True):\n self.log(msg, level=self.ERROR, stderr=stderr)",
"def log_error(message):\n sys.stderr.write(message)\n sys.stderr.flush()",
"def log_err(msg):\n msg = 'ERROR: {0}\\n'.format(msg)\n sys.stderr.write(msg)",
"def to_stderr(message):\n print >> sys.... | [
"0.81584364",
"0.80641294",
"0.8011311",
"0.79322374",
"0.78833973",
"0.7809301",
"0.7784353",
"0.76203424",
"0.7572467",
"0.7564524",
"0.7551276",
"0.7547216",
"0.7459641",
"0.7416353",
"0.7406936",
"0.7399787",
"0.73442113",
"0.7294563",
"0.72878593",
"0.7245554",
"0.718374... | 0.0 | -1 |
Find the max and mins of a signal s. | def find_extrema(s):
max_env = np.logical_and(
np.r_[True, s[1:] > s[:-1]],
np.r_[s[:-1] > s[1:], True])
min_env = np.logical_and(
np.r_[True, s[1:] < s[:-1]],
np.r_[s[:-1] < s[1:], True])
max_env[0] = max_env[-1... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def min_max_range(s):\n # note np.argmax, np.argmin returns the position of first occurence of global max, min\n sign = np.sign(np.argmax(s) - np.argmin(s))\n if sign == 0:\n return 0.0\n else:\n return sign*(np.max(s) - np.min(s))",
"def min_max(xs):\n return min(xs), max(xs)",
"d... | [
"0.7393932",
"0.6458173",
"0.64151615",
"0.6411423",
"0.6399748",
"0.6348833",
"0.6329962",
"0.6310306",
"0.61543256",
"0.61472404",
"0.61471397",
"0.61429536",
"0.612469",
"0.61220443",
"0.6111237",
"0.6101969",
"0.60959226",
"0.60872024",
"0.60401523",
"0.6031333",
"0.60154... | 0.6096241 | 16 |
Compute the coherency between two signals s1 and s2. | def coherency(s1, s2, lags, plot=False, window_fraction=None, noise_floor_db=None):
# test for symmetry
i = len(lags) // 2
assert lags[i] == 0, "Midpoint of lags must be zero for coherency!"
assert np.sum(-lags[:i] != lags[-i:][::-1]) == 0, "lags must be symmetric for coherency!"
window = np.ones(... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getCosRateBetweenSegments(seg1, seg2):\n return 1-(np.cos(np.deg2rad(get_north_azimut(seg1)-get_north_azimut(seg2)))/2+0.5)",
"def calculate_convergence(v1, v2):\r\n\r\n return norm(v2 - v1, ord=1)",
"def cosinesimilarity_cal(CTRDM1, CTRDM2):\n\n # get number of conditions\n n_cons = np.shape(C... | [
"0.67272806",
"0.6601713",
"0.64073247",
"0.638199",
"0.63473606",
"0.63197666",
"0.6318116",
"0.62095404",
"0.6194498",
"0.6184094",
"0.6156656",
"0.61453253",
"0.61429244",
"0.61428803",
"0.6127321",
"0.60759073",
"0.60638344",
"0.60598",
"0.60469776",
"0.6046675",
"0.60368... | 0.62284184 | 7 |
Quantify properties of an auto or cross correlation function. | def quantify_cf(lags, cf, plot=False):
# identify the peak magnitude
abs_cf = np.abs(cf)
peak_magnitude = abs_cf.max()
# identify the peak delay
imax = abs_cf.argmax()
peak_delay = lags[imax]
# compute the area under the curve
dt = np.diff(lags).max()
cf_width = abs_cf.sum()*dt
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def acqproperty(func):\n return ComputedAttribute(func, 1)",
"def calc_qcorr(self) -> Dict[int, float]:\n return self._calc_qcorr",
"def autocorr(x, **kwargs):\n\t# do same computation as autocovariance,\n\t# but without subtracting the mean\n\tkwargs[ 'debias' ] = False\n\treturn autocov(x, **kwargs... | [
"0.5836592",
"0.5648421",
"0.54500395",
"0.54016477",
"0.53824514",
"0.5223534",
"0.5208432",
"0.5134926",
"0.5031681",
"0.49532014",
"0.49289793",
"0.49250612",
"0.49188575",
"0.48958242",
"0.48909575",
"0.4869738",
"0.48549774",
"0.4848714",
"0.48383734",
"0.48093164",
"0.4... | 0.0 | -1 |
Check OneQubitEulerDecomposer works for the given unitary | def check_one_qubit_euler_angles(self, operator, basis="U3", tolerance=1e-14, simplify=False):
target_unitary = operator.data
if basis is None:
angles = OneQubitEulerDecomposer().angles(target_unitary)
decomp_unitary = U3Gate(*angles).to_matrix()
else:
decompo... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_seed_289(self):\n unitary = random_unitary(4, seed=289)\n self.check_exact_decomposition(unitary.data, two_qubit_cnot_decompose)",
"def test_ForwardEuler_against_hand_calculations():\n def f(u, t):\n return u\n u, t = ForwardEuler(f, U0=1, T=0.2, n=2)\n exact = np.array([1... | [
"0.635206",
"0.6242375",
"0.623393",
"0.6207995",
"0.61989033",
"0.616764",
"0.6109237",
"0.6102379",
"0.59810317",
"0.5960411",
"0.5918288",
"0.5910187",
"0.5863948",
"0.5763186",
"0.5743874",
"0.5712833",
"0.5712339",
"0.563815",
"0.5629617",
"0.5628385",
"0.56278443",
"0... | 0.5709113 | 17 |
Fail if loads(dumps(weyl1)) not equal to weyl1 | def assertRoundTripPickle(self, weyl1: TwoQubitWeylDecomposition):
pkl = pickle.dumps(weyl1, protocol=max(4, pickle.DEFAULT_PROTOCOL))
weyl2 = pickle.loads(pkl)
msg_base = f"weyl1:\n{weyl1}\nweyl2:\n{repr(weyl2)}"
self.assertEqual(type(weyl1), type(weyl2), msg_base)
maxdiff = np... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def assertRoundTrip(self, weyl1: TwoQubitWeylDecomposition):\n repr1 = repr(weyl1)\n with self.assertDebugOnly():\n weyl2: TwoQubitWeylDecomposition = eval(repr1) # pylint: disable=eval-used\n msg_base = f\"weyl1:\\n{repr1}\\nweyl2:\\n{repr(weyl2)}\"\n self.assertEqual(type(... | [
"0.6489255",
"0.64080477",
"0.6245087",
"0.61907804",
"0.5991645",
"0.5963846",
"0.5920854",
"0.59129435",
"0.5874306",
"0.58386743",
"0.5816841",
"0.58038586",
"0.5771781",
"0.571645",
"0.57052916",
"0.5692153",
"0.56772476",
"0.5666108",
"0.5659291",
"0.5659139",
"0.5604031... | 0.68342125 | 0 |
Check that eval(__repr__) is exact round trip | def test_TwoQubitWeylDecomposition_repr(self, seed=42):
target = random_unitary(4, seed=seed)
weyl1 = TwoQubitWeylDecomposition(target, fidelity=0.99)
self.assertRoundTrip(weyl1) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_repr_ef(self):\n self.assertEqual(self.ns, eval(f\"{self.ns!r}\"))",
"def test_repr(self, r, rep):\n assert repr(r) == rep",
"def test_repr(clf_eval):\n assert str(clf_eval) == 'ClassificationEvaluation(model_name=foo, class_names=[a, b])'\n assert repr(clf_eval) == 'Classification... | [
"0.761102",
"0.7402188",
"0.7093974",
"0.699513",
"0.6966543",
"0.69387496",
"0.6671503",
"0.6591",
"0.6542531",
"0.6453704",
"0.6394684",
"0.63918924",
"0.63888896",
"0.6303576",
"0.63013715",
"0.62460876",
"0.62443495",
"0.62406266",
"0.61887485",
"0.61872786",
"0.6104564",... | 0.0 | -1 |
Verify Weyl KAK decomposition for U~Ud(a,b,0) | def test_two_qubit_weyl_decomposition_ab0(self, smallest=1e-18, factor=9.8, steps=11):
for aaa in (
[smallest * factor**i for i in range(steps)]
+ [np.pi / 4 - smallest * factor**i for i in range(steps)]
+ [np.pi / 8, 0.113 * np.pi, 0.1972 * np.pi]
):
for ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_two_qubit_weyl_decomposition_bgate(self):\n for k1l, k1r, k2l, k2r in K1K2S:\n k1 = np.kron(k1l.data, k1r.data)\n k2 = np.kron(k2l.data, k2r.data)\n a = Ud(np.pi / 4, np.pi / 8, 0)\n self.check_two_qubit_weyl_decomposition(k1 @ a @ k2)",
"def test_two_q... | [
"0.6569359",
"0.65235776",
"0.64418185",
"0.61128324",
"0.6074476",
"0.60369396",
"0.60351646",
"0.6025205",
"0.5817086",
"0.5758995",
"0.5740213",
"0.5716722",
"0.5715103",
"0.5701494",
"0.5695256",
"0.5694123",
"0.5693865",
"0.56877327",
"0.56877327",
"0.5672116",
"0.564906... | 0.5753101 | 10 |
Returns an empty response body so it can raise JSON parse exception | def emptyresponse():
return get_response("") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"async def get_empty(self, **kwargs: Any) -> JSON:\n error_map = {\n 401: ClientAuthenticationError,\n 404: ResourceNotFoundError,\n 409: ResourceExistsError,\n 304: ResourceNotModifiedError,\n }\n error_map.update(kwargs.pop(\"error_map\", {}) or {})... | [
"0.6872124",
"0.6869427",
"0.6783328",
"0.6294161",
"0.62910986",
"0.62839025",
"0.6272725",
"0.6251374",
"0.62506795",
"0.616869",
"0.61671627",
"0.6150898",
"0.6092289",
"0.608731",
"0.6079515",
"0.6028693",
"0.5984093",
"0.59733975",
"0.59655714",
"0.59473944",
"0.59340346... | 0.7197964 | 0 |
Return the set of instance traits for the item. | def traits(self):
return instance_traits.get(self.inst) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def traits(self):\n members = [member for member in getmembers(self.__class__) if isinstance(member[1], TraitType)]\n traits = dict(members)\n return traits",
"def trait_view_elements ( self ):\n return self.__class__.class_trait_view_elements()",
"def class_editable_traits ( cls ):... | [
"0.6705838",
"0.65049565",
"0.62103933",
"0.6127641",
"0.61195934",
"0.609239",
"0.6070011",
"0.6055028",
"0.59546596",
"0.58535403",
"0.5802307",
"0.5798675",
"0.5741456",
"0.5680459",
"0.5680459",
"0.5641982",
"0.56199336",
"0.56148016",
"0.55936193",
"0.5564522",
"0.54985"... | 0.7651051 | 0 |
Set the targetname of the item. | def name(self, name: str):
self.inst['targetname'] = name | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def target_name(self, target_name):\n\n self._target_name = target_name",
"def target_name(self, target_name):\n\n self._target_name = target_name",
"def set_name(self, item_name):\r\n self.name = item_name",
"def setText(self,newName):\n self.name = newName\n self.data['item-t... | [
"0.80546767",
"0.80546767",
"0.71183974",
"0.6769276",
"0.6630437",
"0.6504529",
"0.6495315",
"0.6471601",
"0.6450764",
"0.6450764",
"0.6450764",
"0.6450764",
"0.64504284",
"0.64504284",
"0.64453214",
"0.64453214",
"0.64138114",
"0.64111996",
"0.64101297",
"0.6383144",
"0.636... | 0.7720064 | 2 |
Turns the lights off | def turn_off(self):
print("Turning the lights off")
self.led.all_off()
self.client.publish(STATE_TOPIC, OFF) #publish | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def turn_off(self):\n GPIO.output(self.gpio, False) # turn off light",
"def turn_off(self, **kwargs):\n self._light.set_color(0, 0, 0, 0)",
"def off(self):\n for light in self.all:\n GPIO.output(light, 0)",
"def lightning_turnoff(self):\n self.turnOff()",
"def set_li... | [
"0.87826437",
"0.86162305",
"0.8577208",
"0.84714425",
"0.8454087",
"0.84525084",
"0.8447579",
"0.8372806",
"0.8298181",
"0.8272779",
"0.8208686",
"0.810937",
"0.79730284",
"0.793208",
"0.79252344",
"0.7915989",
"0.7899226",
"0.7899191",
"0.78976715",
"0.77762747",
"0.7763483... | 0.86739814 | 1 |
Get a cached item by key. | def get(self, key):
#if any(map(lambda v : v in key.lower(), [ "go:", "mondo:", "hp:" ])):
# return None
key = self.prefix + key
result = None
if self.enabled:
if key in self.cache:
result = self.cache[key]
elif self.redis:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get(self, key):\n # Initialize key variables\n result = self.cache.get(key)\n\n # Return\n return result",
"def get(key):\n return Cache.cache_connector.get(key)",
"def get_cache(self, key):\n return self.r.get(key)",
"def get(self, key):\n return self._ca... | [
"0.8508871",
"0.83257014",
"0.8308625",
"0.8308017",
"0.82451683",
"0.82035506",
"0.81413406",
"0.80471015",
"0.80239373",
"0.8004133",
"0.7964963",
"0.7882319",
"0.7882319",
"0.7742595",
"0.7723096",
"0.76680785",
"0.7548808",
"0.751996",
"0.7495443",
"0.74512774",
"0.741110... | 0.7104998 | 33 |
Get full list of stations from the NDB. | def get_all_stations(engine):
# Query db
sql = ("SELECT DISTINCT a.station_id, "
" a.station_code, "
" a.station_name, "
" c.station_type, "
" d.latitude, "
" d.longitude "
"FROM nivadatabase.projects_stations a, "
" nivadatab... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def stations():\n\n return station_list",
"def get_stations(self):\n return self.__request('stations')['stations']",
"def stations():\n # Create a link to the session\n session = Session(engine)\n \n # Query all station records\n results = session.query(Stations.station, Stations.name)... | [
"0.8195197",
"0.76689214",
"0.7607176",
"0.75947773",
"0.74897873",
"0.748847",
"0.74785024",
"0.74783444",
"0.74768895",
"0.74725205",
"0.7462281",
"0.7437112",
"0.74318635",
"0.7426388",
"0.74216545",
"0.7392977",
"0.73617816",
"0.7356947",
"0.73145336",
"0.7284468",
"0.727... | 0.7173854 | 26 |
Get stations asscoiated with selected projects. | def get_project_stations(proj_df, engine, drop_dups=False):
# Get proj IDs
assert len(proj_df) > 0, 'ERROR: Please select at least one project.'
proj_df['project_id'].drop_duplicates(inplace=True)
proj_ids = proj_df['project_id'].values.astype(int).tolist()
# Query db
bind_pars = ','.joi... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def stations():\n\n return station_list",
"def get_stations(self):\n return self.__request('stations')['stations']",
"def getStations(self) :\n return self._stations",
"def get_stations(self, limit=250):\n\n endpoint = \"/station/getStations\"\n response = self._send(endpoint, ... | [
"0.6865794",
"0.68058854",
"0.6566676",
"0.6355169",
"0.6309349",
"0.6276087",
"0.6150018",
"0.61209446",
"0.61078864",
"0.6102468",
"0.60994637",
"0.6098597",
"0.60900277",
"0.60843545",
"0.60201085",
"0.60141474",
"0.60090524",
"0.5987977",
"0.59572136",
"0.59126097",
"0.58... | 0.7128417 | 0 |
Get projects asscoiated with selected stations. | def get_station_projects(stn_df, proj_df, engine):
# Get stn IDs
assert len(stn_df) > 0, 'ERROR: Please select at least one station.'
stn_df['station_id'].drop_duplicates(inplace=True)
stn_ids = stn_df['station_id'].values.astype(int).tolist()
# Get proj IDs
assert len(proj_df) > 0, 'ERR... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_project_stations(proj_df, engine, drop_dups=False): \n # Get proj IDs\n assert len(proj_df) > 0, 'ERROR: Please select at least one project.'\n proj_df['project_id'].drop_duplicates(inplace=True)\n proj_ids = proj_df['project_id'].values.astype(int).tolist()\n\n # Query db\n bind_pa... | [
"0.69442415",
"0.6861621",
"0.64515764",
"0.6446861",
"0.64077276",
"0.6366921",
"0.63608074",
"0.628571",
"0.62595546",
"0.62416863",
"0.6226411",
"0.6176152",
"0.61526316",
"0.6118353",
"0.61124414",
"0.610506",
"0.6095936",
"0.609046",
"0.6075073",
"0.60674524",
"0.6064715... | 0.6362855 | 6 |
Returns whether an InstallRequirement is a "pinned" requirement. | def is_pinned_requirement(ireq):
if ireq.editable:
return False
if ireq.req is None or len(ireq.specifier._specs) != 1:
return False
op, version = next(iter(ireq.specifier._specs))._spec
return (op == "==" or op == "===") and not version.endswith(".*") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_pinned_requirement(req):\n\n return any(\n (spec.operator == \"==\" or spec.operator == \"===\")\n and not spec.version.endswith(\".*\")\n for spec in req.specifier\n )",
"def has_pinned_content(self):\n if \"query\" in self.query:\n q = self.query[\"query\"]\n... | [
"0.7603057",
"0.6221948",
"0.61543465",
"0.59718335",
"0.5738728",
"0.55894077",
"0.5526659",
"0.5500593",
"0.54816294",
"0.54134643",
"0.5396353",
"0.5388297",
"0.5385473",
"0.53800637",
"0.53094846",
"0.52666765",
"0.5259115",
"0.5237259",
"0.52346283",
"0.5222276",
"0.5221... | 0.75144005 | 1 |
Deduplicate an iterable object like iter(set(iterable)) but orderreserved. | def dedup(iterable):
return iter(OrderedDict.fromkeys(iterable)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def deleteduplicates(iterable):\n seen = []\n for x in iterable:\n if x not in seen:\n yield x\n seen.append(x)",
"def unique(iterable):\n seen_items = set()\n for item in iterable:\n if item not in seen_items:\n yield item\n seen_items.add(it... | [
"0.73477143",
"0.7233455",
"0.72212934",
"0.7179633",
"0.71401757",
"0.7105486",
"0.6996061",
"0.699401",
"0.69802684",
"0.6967737",
"0.69332343",
"0.69121355",
"0.6908213",
"0.685423",
"0.68258566",
"0.6717284",
"0.6655511",
"0.6627973",
"0.65988344",
"0.65910864",
"0.655970... | 0.782314 | 0 |
Convert given string to a correctly encoded filesystem string. On Python 2, if the input string is unicode, converts it to bytes encoded with the filesystem encoding. On Python 3 returns the string as is, since Python 3 uses unicode paths and the input string shouldn't be bytes. | def fs_str(string):
if isinstance(string, str):
return string
if isinstance(string, bytes):
raise AssertionError
return string.encode(_fs_encoding) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def to_unicode_from_fs(string):\n if isinstance(string, bytes):\n try:\n unic = string.decode(FS_ENCODING)\n except (UnicodeError, TypeError):\n pass\n else:\n return unic\n return string",
"def fsencode(filename):\n if isinstance(filename, bytes... | [
"0.744683",
"0.68952113",
"0.67681944",
"0.6666541",
"0.6467933",
"0.64673334",
"0.64640504",
"0.64519995",
"0.64519346",
"0.64115393",
"0.64009833",
"0.63954335",
"0.63509405",
"0.6329738",
"0.62974995",
"0.62770116",
"0.6270753",
"0.627071",
"0.6254831",
"0.6242428",
"0.623... | 0.76792556 | 0 |
Create and return a test action_plan object. Create a action plan in the DB and return a ActionPlan object with appropriate attributes. | def create_test_action_plan(context, **kw):
action_plan = get_test_action_plan(context, **kw)
action_plan.create()
return action_plan | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_test_action_plan(context, **kw):\n obj_cls = objects.ActionPlan\n db_data = db_utils.get_test_action_plan(**kw)\n obj_data = _load_related_objects(context, obj_cls, db_data)\n\n return _load_test_obj(context, obj_cls, obj_data, **kw)",
"def create(cls, **kwargs):\n return cls().request... | [
"0.7494858",
"0.6493962",
"0.6335922",
"0.61363274",
"0.6027324",
"0.60240984",
"0.6022311",
"0.5776914",
"0.57359874",
"0.5670439",
"0.55385864",
"0.55241394",
"0.5521208",
"0.5485958",
"0.54715914",
"0.54500276",
"0.54104143",
"0.53921807",
"0.5380818",
"0.5344196",
"0.5326... | 0.85795844 | 0 |
Create and return a test scoring engine object. Create a scoring engine in the DB and return a ScoringEngine object with appropriate attributes. | def create_test_scoring_engine(context, **kw):
scoring_engine = get_test_scoring_engine(context, **kw)
scoring_engine.create()
return scoring_engine | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_test_scoring_engine(context, **kw):\n obj_cls = objects.ScoringEngine\n db_data = db_utils.get_test_scoring_engine(**kw)\n obj_data = _load_related_objects(context, obj_cls, db_data)\n\n return _load_test_obj(context, obj_cls, obj_data, **kw)",
"def test_engine(self):\n config = {\n ... | [
"0.74780846",
"0.58382875",
"0.58358204",
"0.5827273",
"0.58013815",
"0.5598609",
"0.55371463",
"0.5535088",
"0.54873306",
"0.54844016",
"0.5482276",
"0.54808664",
"0.54018056",
"0.5363102",
"0.5351135",
"0.52693534",
"0.5266416",
"0.52557653",
"0.52266526",
"0.52033776",
"0.... | 0.83391786 | 0 |
Create and return a test efficacy indicator object. Create a efficacy indicator in the DB and return a EfficacyIndicator object with appropriate attributes. | def create_test_efficacy_indicator(context, **kw):
efficacy_indicator = get_test_efficacy_indicator(context, **kw)
efficacy_indicator.create()
return efficacy_indicator | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_test_efficacy_indicator(context, **kw):\n obj_cls = objects.EfficacyIndicator\n db_data = db_utils.get_test_efficacy_indicator(**kw)\n obj_data = _load_related_objects(context, obj_cls, db_data)\n\n return _load_test_obj(context, obj_cls, obj_data, **kw)",
"def InstEfficiency(trader):\r\n ... | [
"0.72601974",
"0.6655748",
"0.5622591",
"0.5361265",
"0.53222585",
"0.51173437",
"0.51140064",
"0.51001567",
"0.5076308",
"0.50470954",
"0.4929732",
"0.49190474",
"0.4884472",
"0.4878627",
"0.48779714",
"0.4850927",
"0.48486608",
"0.48438165",
"0.48401168",
"0.48341992",
"0.4... | 0.84799707 | 0 |
Initialize your data structure here. Set the size of the queue to be k. | def __init__(self, k):
self.maxlen = k
self.queue = [] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self, k):\n self.queue = []\n self.size = k",
"def __init__(self, k):\n self.queue = [0]*k\n self.headIndex = 0\n self.count = 0\n self.capacity = k",
"def __init__(self, k: int):\n self.queue = [0]*k\n self.headIndex = 0\n self.count ... | [
"0.85155606",
"0.8471658",
"0.8441451",
"0.8408407",
"0.8363247",
"0.8300094",
"0.80658275",
"0.7868953",
"0.7860204",
"0.7748154",
"0.768231",
"0.7668362",
"0.76038784",
"0.7504321",
"0.73879427",
"0.71936107",
"0.712905",
"0.6974544",
"0.6911939",
"0.690878",
"0.6888063",
... | 0.8065754 | 7 |
Get the front item from the queue. | def Front(self):
if (len(self.queue) >= 1):
return self.queue[0]
else:
return -1 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getFront(self):\n\t\tfront = self.queue[self.front]\n\t\treturn front\n\t\tpass",
"def front(self):\n return self.queue[0] if not self.empty() else None",
"def front(queue):\n if empty_queue(queue):\n raise IndexError(\"Queue is empty!\")\n else:\n return queue.front.value",
"d... | [
"0.90385115",
"0.89434814",
"0.8426328",
"0.8357853",
"0.83309764",
"0.83309764",
"0.83211964",
"0.83211964",
"0.82988536",
"0.8279939",
"0.8216258",
"0.8213497",
"0.8213348",
"0.8209029",
"0.8205413",
"0.81683636",
"0.812805",
"0.81277895",
"0.8076473",
"0.7995084",
"0.79901... | 0.846308 | 2 |
Get the last item from the queue. | def Rear(self):
if (len(self.queue) >= 1):
return self.queue[-1]
else:
return -1 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def last(self):\n if self.is_empty():\n raise ValueError('Queue is empty!')\n return self.last_node().element().value()",
"def last(self):\n return self.deque[-1]",
"def last_item(self):\n return self.container[self.length-1]",
"def peek(self):\n if not self.empt... | [
"0.82451856",
"0.80613",
"0.8023248",
"0.7629952",
"0.7628782",
"0.76055205",
"0.75932163",
"0.7584632",
"0.75637347",
"0.7543559",
"0.75429386",
"0.7518005",
"0.7494505",
"0.746898",
"0.7461607",
"0.74455327",
"0.73941535",
"0.73889613",
"0.73865324",
"0.7373363",
"0.7349888... | 0.77849776 | 3 |
Checks whether the circular queue is empty or not. | def isEmpty(self):
if (len(self.queue) >= 1):
return False
else:
return True | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_empty(self):\n return self.queue == []",
"def is_empty(self):\n return len(self.the_queue) == 0",
"def is_empty(self):\n return len(self.queue) == 0",
"def is_empty(self):\n return len(self.queue) == 0",
"def is_empty(self):\n return len(self.__queue) > 0",
"def ... | [
"0.84918785",
"0.84607804",
"0.8429387",
"0.8429387",
"0.83951026",
"0.82831895",
"0.8246613",
"0.8193397",
"0.8184179",
"0.81770307",
"0.8163974",
"0.81180215",
"0.8102001",
"0.80947953",
"0.8042463",
"0.79564434",
"0.7913296",
"0.7909012",
"0.7909012",
"0.79010254",
"0.7897... | 0.82329935 | 7 |
Checks whether the circular queue is full or not. | def isFull(self):
if (len(self.queue) == self.maxlen):
return True
else:
return False | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def isFull(self):\n return len(self.queue) == self.size",
"def is_empty(self):\n return len(self.__queue) > 0",
"def is_empty(self):\n return len(self.the_queue) == 0",
"def is_empty(self):\n return self.queue == []",
"def is_empty(self):\n return len(self.queue) == 0",
... | [
"0.84765345",
"0.7884191",
"0.7837154",
"0.78264606",
"0.7825594",
"0.7825594",
"0.7630818",
"0.7612426",
"0.76122725",
"0.75865316",
"0.7579291",
"0.75325227",
"0.7527671",
"0.74913216",
"0.7481055",
"0.7475364",
"0.74505913",
"0.7449566",
"0.74360824",
"0.74226433",
"0.7394... | 0.83012766 | 1 |
Returns `True` if the current node is of the given type. The argument `t` must be a Python class such as, | def isNodeType(self, t):
return isinstance(self, t) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_type(self, typ):\n return typ == self.__class__.__name__",
"def is_a(self, t):\n return isinstance(self._, t)",
"def is_type(obj):\n return type(obj) is type or type(obj) is types.ClassType",
"def check_tree_type(tree):\n return tree.type in ref",
"def _isinstancetype(an_obj)... | [
"0.71821404",
"0.70782214",
"0.68629926",
"0.68444777",
"0.67963463",
"0.67936134",
"0.6686757",
"0.6681784",
"0.6663018",
"0.66616756",
"0.6633372",
"0.661153",
"0.6610282",
"0.65825814",
"0.65434486",
"0.65434486",
"0.6524159",
"0.6514691",
"0.65141475",
"0.65119284",
"0.64... | 0.81845295 | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.