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 |
|---|---|---|---|---|---|---|
Close connection to SUMO | def tearDown(self):
traci.close() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def closeConnection(self):\n print(\"closing connection...\")\n self.s.close()\n quit()",
"def close(self): \n\t\tself.connection = None",
"def close_connection(self):\n\t\tself.session.close()",
"def close(self): \n self.connection.close()",
"def close(self):\n self._connect... | [
"0.7795134",
"0.7469527",
"0.74574894",
"0.74283755",
"0.7342986",
"0.7335586",
"0.7326172",
"0.7304553",
"0.7279674",
"0.7279674",
"0.7235826",
"0.7233592",
"0.72099066",
"0.71759844",
"0.7118848",
"0.7098822",
"0.70972496",
"0.70972496",
"0.70972496",
"0.70972496",
"0.70972... | 0.0 | -1 |
Get a random element from the set. | def getRandom(self) -> int:
randomArray = []
i = 0
for key in self.randomSet:
randomArray.append(key)
return randomArray[random.randint(0,len(randomArray)-1)] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getRandom(self):\n return self.nums[random.randint(0, len(self.nums) - 1)]\n\n # Your RandomizedSet object will be instantiated and called as such:\n # obj = RandomizedSet()\n # param_1 = obj.insert(val)\n # param_2 = obj.remove(val)\n # param_3 = obj.getRandom()",
"... | [
"0.77060276",
"0.738916",
"0.7296881",
"0.72187954",
"0.6871744",
"0.68453854",
"0.68330806",
"0.67740154",
"0.67226046",
"0.6703282",
"0.6665089",
"0.66356236",
"0.66217655",
"0.6612035",
"0.66000897",
"0.6477719",
"0.6462421",
"0.64428514",
"0.64162946",
"0.6400411",
"0.639... | 0.6567767 | 15 |
Distribution parameter for degrees of freedom. | def df(self):
return self._df | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def freedom(L=5):\n\n Y = -1\n return Y",
"def density(self, arg):\n mean = - self.sigma**2 * self.data['maturity']\n std = self.sigma * self.data['maturity']**.5\n return scs.norm(mean, std).pdf(arg)",
"def distribution(self) -> str:\n return pulumi.get(self, \"distribution\"... | [
"0.63810205",
"0.6326664",
"0.6267435",
"0.62618715",
"0.62111354",
"0.610806",
"0.6072273",
"0.60493493",
"0.60234946",
"0.5952181",
"0.5950211",
"0.5950211",
"0.5950211",
"0.5921676",
"0.58585906",
"0.585712",
"0.58375925",
"0.58355093",
"0.5829913",
"0.58082634",
"0.579164... | 0.0 | -1 |
Distribution parameter for the mean. | def loc(self):
return self._loc | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def mean(self):\n return self.mu",
"def mean(self):\n return math.exp(self.mu + (self.sigma ** 2) / 2)",
"def mean(self, mu, sigma):\n return mu",
"def mean(self):\n return self.k * self.theta",
"def prior_mean(self, parameter):\n if parameter not in self:\n ra... | [
"0.71977794",
"0.71391386",
"0.70165426",
"0.68468904",
"0.67401975",
"0.66964173",
"0.66814566",
"0.6604788",
"0.6565105",
"0.65103227",
"0.6506856",
"0.6498152",
"0.6478929",
"0.6478929",
"0.6465593",
"0.6435943",
"0.6424655",
"0.64239794",
"0.64238036",
"0.64148766",
"0.64... | 0.0 | -1 |
Get specified value converted to unicode, or an empty unicode string if value is empty | def to_unicode(value, default=u''):
try:
if isinstance(value, unicode):
return value
return codecs.decode(value or default)
except Exception:
return codecs.decode(value or default, 'latin1') | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _get_unicode_value(value: Union[Text, bytes]) -> Text:\n decoded_value = stats_util.maybe_get_utf8(value)\n # Check if we have a valid utf-8 string. If not, assign a placeholder.\n if decoded_value is None:\n _NON_UTF8_VALUES_COUNTER.inc()\n decoded_value = constants.NON_UTF8_PLACEHOLDER\n return dec... | [
"0.80042136",
"0.7663283",
"0.7566101",
"0.7359141",
"0.7303415",
"0.7152016",
"0.7130961",
"0.70460534",
"0.70231843",
"0.7001165",
"0.699813",
"0.69924796",
"0.6975798",
"0.6888258",
"0.684779",
"0.6768282",
"0.6753386",
"0.67044854",
"0.6696471",
"0.6687402",
"0.66866773",... | 0.7920412 | 1 |
Return the default fallback languages. | def get_default_language():
utility = queryUtility(ILanguageAvailability)
if utility is not None:
return utility.getDefaultLanguage()
return DEFAULT_LANGUAGE | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def browserLanguages(request):\n fallback = []\n accepted = request.http_accept_language\n if accepted:\n # Extract the languages names from the string\n accepted = accepted.split(',')\n accepted = map(lambda x: x.split(';')[0], accepted)\n # Add base language for each sub lang... | [
"0.76859945",
"0.75574553",
"0.7333305",
"0.7115583",
"0.6942656",
"0.6940457",
"0.6920052",
"0.6735964",
"0.67120034",
"0.67000973",
"0.66747755",
"0.66610384",
"0.6605448",
"0.6582957",
"0.65641093",
"0.6546555",
"0.6500374",
"0.6475481",
"0.6472151",
"0.6469842",
"0.646582... | 0.7031646 | 4 |
Updates the solution list's statistics with the value of a solution that is being added to the list. Updated stats include (in)feasible solution counts, best/worst feasible values, least/most infeasible values, and best overall value. | def _update_stats(self, value):
solver = self.solver
is_better = solver.sense.is_better
if isinstance(value, Infeasible):
self.infeas_count += 1
if value < self.least_infeas_value:
self.least_infeas_value = value
solver.channel.emit(solver.... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_stats(self, round, solutions):\r\n for solution in solutions:\r\n solution_score = self.fitting_function.fit_score(solution)\r\n self.stats[round].append(solution_score)",
"def update_scores(self, score):\n self.result_list.append(score)\n\n if self.best_score =... | [
"0.6624786",
"0.6156408",
"0.60401475",
"0.60401475",
"0.60401475",
"0.60382444",
"0.5981996",
"0.597241",
"0.5878719",
"0.5735837",
"0.5704448",
"0.56947446",
"0.55838263",
"0.55130595",
"0.542672",
"0.54244804",
"0.5392285",
"0.5379083",
"0.53789407",
"0.5372176",
"0.536912... | 0.70362824 | 0 |
Determines the finale opacity of a specified grid line. This takes multiples of certain numbers, and increases the opacity of those multiples. | def __finalizeGridLineOpacity(self, grid_number, multiplier=2):
opacity_list = [5, 10, 25, 50, 100, 500]
opacity = self.getGridLineOpacity()
if grid_number == 0.0:
GL.glLineWidth(2)
GL.glColor4f(*self.getGridColor(), 1)
else:
GL.glLineWidth(1)
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __setupGridLineOpacity(self):\n if self.getGridOpacity() is True:\n divisor = int(self.zoom_factor - self.MIN_ZOOM)\n if divisor < 1:\n divisor = 1\n opacity = (1 / divisor) * 10\n\n else:\n opacity = 1\n self.setGridLineOpacity(op... | [
"0.7098987",
"0.61423415",
"0.5578311",
"0.5554532",
"0.5522668",
"0.5396929",
"0.53967553",
"0.53138655",
"0.52789426",
"0.5253761",
"0.5221888",
"0.5212094",
"0.5200629",
"0.51944864",
"0.5163906",
"0.51561683",
"0.511422",
"0.5110882",
"0.51060855",
"0.50997293",
"0.508492... | 0.76920456 | 0 |
The community for this node. Returns None unless self.set_community() has been called. | def community(self):
return self._community | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _community(G, u, community):\n node_u = G.node[u]\n try:\n return node_u[community]\n except KeyError:\n raise nx.NetworkXAlgorithmError('No community information')",
"def _get_extended_community(self):\n return self.__extended_community",
"def _get_send_community(self):\n retu... | [
"0.69938993",
"0.68504274",
"0.6677975",
"0.65576005",
"0.65417063",
"0.62879294",
"0.62873274",
"0.62134475",
"0.6176243",
"0.565854",
"0.5623062",
"0.55694973",
"0.553731",
"0.55226535",
"0.5515123",
"0.55145246",
"0.55023605",
"0.54585785",
"0.54459023",
"0.54385465",
"0.5... | 0.86861527 | 0 |
The WAN address for this node. Will fail unless self.init_socket() has been called. | def wan_address(self):
if self._community.dispersy:
host = self._community.dispersy.wan_address[0]
if host == "0.0.0.0":
host = self._community.dispersy.lan_address[0]
else:
host = "0.0.0.0"
_, port = self._socket.getsockname()
retur... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def wan_address(self):\n return self._wan_address",
"def network_address(self):\n\n return self._network_address",
"def get_self_address(self):\n return self.self_host, self.self_port",
"def lan_address(self):\n _, port = self._socket.getsockname()\n return (\"127.0.0.1\", ... | [
"0.7809986",
"0.65135473",
"0.649863",
"0.63260865",
"0.62937015",
"0.62675446",
"0.62224704",
"0.62057483",
"0.6163477",
"0.6138168",
"0.61111355",
"0.6076574",
"0.6069721",
"0.6065768",
"0.604658",
"0.6001728",
"0.5984032",
"0.5983768",
"0.59490657",
"0.5934639",
"0.5932885... | 0.7482284 | 1 |
Set the community that this node is associated to. | def set_community(self, community):
assert community is None or isinstance(community, Community), type(community)
self._community = community
if community:
self._dispersy = community.dispersy | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def community(self, community):\n\n self._community = community",
"def community_id(self, community_id):\n\n self._community_id = community_id",
"def community_in(self, community_in):\n\n self._community_in = community_in",
"def _set_send_community(self, v, load=False):\n if hasattr(v... | [
"0.8302331",
"0.7426837",
"0.70622313",
"0.6868737",
"0.65124536",
"0.62897307",
"0.6183971",
"0.61546355",
"0.6108091",
"0.6042516",
"0.6023979",
"0.5941196",
"0.5876051",
"0.56637734",
"0.5592018",
"0.552155",
"0.5463198",
"0.5459674",
"0.54509443",
"0.5417424",
"0.5335163"... | 0.78079134 | 1 |
Returns a new RANDOMtext message. | def create_random_order_text(self, text, global_time):
return self._create_text(u"RANDOM-text", text, global_time) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def generateRandomePlainText():\n randomPlainTextArray = [random.choice('0123456789abcdef')\n for n in range(24)]\n randomPlainText = \"\".join(randomPlainTextArray)\n return randomPlainText",
"def create_message_text(self):\n\n if self.text_received in configs.word_dic... | [
"0.678751",
"0.6757682",
"0.65214",
"0.63439924",
"0.6240929",
"0.62069225",
"0.6190879",
"0.61755097",
"0.614523",
"0.6137261",
"0.6065536",
"0.6054831",
"0.6042577",
"0.5987816",
"0.5922294",
"0.58560365",
"0.58558655",
"0.58347714",
"0.5813624",
"0.5813417",
"0.57946783",
... | 0.6928667 | 0 |
Check that two Series are not equal. | def _assert_not_series_equal(a, b, **kwargs):
try:
tm.assert_series_equal(a, b, **kwargs)
msg = "The two Series were equal when they shouldn't have been"
pytest.fail(msg=msg)
except AssertionError:
pass | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _assert_not_series_equal_both(a, b, **kwargs):\n _assert_not_series_equal(a, b, **kwargs)\n _assert_not_series_equal(b, a, **kwargs)",
"def equal(series1, series2):\n # pylint: disable=protected-access\n return bool(\n series1._data is series2._data and\n series1._co... | [
"0.80613273",
"0.7128852",
"0.7008062",
"0.69540554",
"0.6898849",
"0.6897413",
"0.6815841",
"0.6761505",
"0.6760264",
"0.6756509",
"0.67291415",
"0.6701583",
"0.66797614",
"0.66644853",
"0.6601618",
"0.65520895",
"0.65447575",
"0.6537928",
"0.65192264",
"0.65086645",
"0.6502... | 0.82509786 | 0 |
Check that two Series are not equal. This check is performed commutatively. | def _assert_not_series_equal_both(a, b, **kwargs):
_assert_not_series_equal(a, b, **kwargs)
_assert_not_series_equal(b, a, **kwargs) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _assert_not_series_equal(a, b, **kwargs):\n try:\n tm.assert_series_equal(a, b, **kwargs)\n msg = \"The two Series were equal when they shouldn't have been\"\n\n pytest.fail(msg=msg)\n except AssertionError:\n pass",
"def test_not_equal(self):\n utils.compare_tracing_... | [
"0.8101551",
"0.6971119",
"0.6883977",
"0.6856668",
"0.68510216",
"0.6818965",
"0.6797626",
"0.6790186",
"0.67584586",
"0.675331",
"0.6726011",
"0.6708548",
"0.6682717",
"0.6655386",
"0.66398513",
"0.6632102",
"0.6601354",
"0.6591405",
"0.65535927",
"0.6531966",
"0.6475051",
... | 0.8039944 | 1 |
Return all of the possible motifs of size length. | def possible_motifs_by_length(length, base_set="ACGU"):
args = [base_set for i in xrange(length)]
for permutation in itertools.product(*args):
yield "".join(permutation) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def build_kmers(\n sequence, \n ksize):\n\n kmers = list()\n n_kmers = len(sequence) - ksize + 1\n # Loop to store khmers in each sequence\n for i in range(n_kmers):\n kmer = sequence[i:i + ksize]\n kmers.append(kmer)\n \n return kmers, n_kmers\n\n # It is an example that needs to say th... | [
"0.5646241",
"0.5580129",
"0.55215716",
"0.5515646",
"0.5515339",
"0.54750365",
"0.5443068",
"0.5432766",
"0.5387579",
"0.53522474",
"0.53376126",
"0.53182924",
"0.5316148",
"0.52977335",
"0.5293569",
"0.52689373",
"0.5247464",
"0.52261126",
"0.5208818",
"0.51837164",
"0.5178... | 0.7160281 | 0 |
Reset database, start app test client, and log in awdeorio. This function runs once before each member function unit test. | def setUp(self):
# Reset the database and start a test client. Disable error catching
# during request handling so that you get better error reports when
# performing test requests against the application.
try:
insta485db = sh.Command("./bin/insta485db")
insta485... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def setUp(self):\n self.db_fd, app.app.config['DATABASE'] = tempfile.mkstemp()\n app.app.config['TESTING'] = True\n self.app = app.app.test_client()\n app.init_db()",
"def setUp(self):\n self.db_fd, mainPyUnit.app.config['DATABASE'] = tempfile.mkstemp()\n mainPyUnit.app.... | [
"0.7818984",
"0.75943387",
"0.75648177",
"0.7526937",
"0.7481241",
"0.7449584",
"0.74177194",
"0.7412913",
"0.74097806",
"0.7401682",
"0.7359561",
"0.73464066",
"0.7342625",
"0.73402137",
"0.7321675",
"0.729236",
"0.72663987",
"0.72636324",
"0.72483176",
"0.7234191",
"0.72301... | 0.77036494 | 1 |
Reset the database. This function runs once after each member function unit test. | def tearDown(self):
insta485db = sh.Command("./bin/insta485db")
insta485db("reset") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def tearDown(self):\r\n empty_db()",
"def tearDown(self):\r\n empty_db()",
"def tearDown(self):\r\n empty_db()",
"def tearDown(self):\r\n empty_db()",
"def tearDown(self):\r\n empty_db()",
"def tearDown(self):\r\n empty_db()",
"def reset():\n teardown_db()\n... | [
"0.79317486",
"0.79317486",
"0.79317486",
"0.79317486",
"0.79317486",
"0.79317486",
"0.79270506",
"0.7904695",
"0.78010195",
"0.7730929",
"0.7730929",
"0.7730929",
"0.7730929",
"0.7730929",
"0.7730929",
"0.7730929",
"0.7730929",
"0.7730929",
"0.76746047",
"0.7511693",
"0.7482... | 0.0 | -1 |
Returns the document's parsed content. | def hook_include(self, parser, space, title):
from wiki.models import Document
try:
return Document.objects.get(title=title).content_parsed
except Document.DoesNotExist:
return _lazy('The document "%s" does not exist.') % title | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_content(self):\n return self.content",
"def contents(self):\n if not hasattr(self, \"_content\"):\n self._content = self.get_content()\n return self._content",
"def get_content(self):\n return self.__response.content",
"def get_content(self):\n response =... | [
"0.73801214",
"0.731384",
"0.7147361",
"0.71433896",
"0.70942706",
"0.70861536",
"0.70861536",
"0.70861536",
"0.70861536",
"0.6999968",
"0.6998964",
"0.6994689",
"0.69811726",
"0.69654447",
"0.689824",
"0.6875266",
"0.68702036",
"0.6808418",
"0.68015116",
"0.67447937",
"0.671... | 0.0 | -1 |
This method creates a Chebyshev2Filter object. Notes | def Chebyshev2Filter(
self,
name: str,
cutoffFrequency: float,
rippleFactor: float = 0,
order: int = 2,
operation: SymbolicConstant = NONE,
halt: Boolean = OFF,
limit: float = None,
invariant: SymbolicConstant = NONE,
) -> Chebyshev2Filter:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def Chebyshev1Filter(\n self,\n name: str,\n cutoffFrequency: float,\n rippleFactor: float = 0,\n order: int = 2,\n operation: SymbolicConstant = NONE,\n halt: Boolean = OFF,\n limit: float = None,\n invariant: SymbolicConstant = NONE,\n ) -> Chebys... | [
"0.6365684",
"0.5957287",
"0.57758296",
"0.5771376",
"0.57059383",
"0.5664367",
"0.5548452",
"0.5492618",
"0.5483436",
"0.54831165",
"0.5466337",
"0.5450249",
"0.54259014",
"0.53724456",
"0.5372149",
"0.5371258",
"0.53611875",
"0.53558373",
"0.53498495",
"0.5324996",
"0.53216... | 0.78561133 | 0 |
In an object representing a GO term, replace singleelement lists with their only member. Returns the modified object as a dictionary. | def processGOTerm(goTerm):
ret = dict(goTerm) #Input is a defaultdict, might express unexpected behaviour
for key, value in ret.iteritems():
if len(value) == 1:
ret[key] = value[0]
return ret | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _dict_clean(self, obj: list[tuple[str, Any]]) -> dict[str, Any]:\n\n result = {}\n for k, v in obj:\n if v is None and k in ['revenue', 'value', 'tags', 'decisions']:\n continue\n else:\n result[k] = v\n return result",
"def __filter(se... | [
"0.57264405",
"0.5637731",
"0.5390604",
"0.53606224",
"0.5333853",
"0.53163177",
"0.5279076",
"0.526993",
"0.51983625",
"0.51716554",
"0.5167742",
"0.5114032",
"0.50461626",
"0.5011222",
"0.49974743",
"0.49953446",
"0.4961573",
"0.4945264",
"0.4932795",
"0.492444",
"0.4903173... | 0.5580593 | 2 |
Run before every method to create a clean testing setup. | def setup(self):
self.testInst = pysat.Instrument('pysat', 'testing',
clean_level='clean')
self.bounds1 = (dt.datetime(2008, 1, 1), dt.datetime(2008, 1, 3))
self.bounds2 = (dt.datetime(2009, 1, 1), dt.datetime(2009, 1, 2))
self.long_bins = [0., 3... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def setUp(self):\n test_env_setup()",
"def setUp(self):\r\n # nothing to do, all tests use different things\r\n pass",
"def setUp(self):\n pass #because we dont have anything to setup.",
"def setUp(self):\n MainTests.setUp(self)",
"def setUp(self):\n setUp()",
"d... | [
"0.7845074",
"0.7614512",
"0.76056117",
"0.7597303",
"0.7596763",
"0.7583319",
"0.7544004",
"0.7517096",
"0.7517096",
"0.7502748",
"0.7502748",
"0.74867713",
"0.74805045",
"0.74752784",
"0.74752784",
"0.74752784",
"0.74752784",
"0.74752784",
"0.74752784",
"0.74752784",
"0.747... | 0.0 | -1 |
Run before every method to create a clean testing setup. | def setup(self):
self.testInst = pysat.Instrument('pysat', 'testing_xarray',
clean_level='clean')
self.bounds1 = (dt.datetime(2008, 1, 1), dt.datetime(2008, 1, 3))
self.bounds2 = (dt.datetime(2009, 1, 1), dt.datetime(2009, 1, 2))
self.long_bins =... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def setUp(self):\n test_env_setup()",
"def setUp(self):\r\n # nothing to do, all tests use different things\r\n pass",
"def setUp(self):\n pass #because we dont have anything to setup.",
"def setUp(self):\n MainTests.setUp(self)",
"def setUp(self):\n setUp()",
"d... | [
"0.7845074",
"0.7614512",
"0.76056117",
"0.7597303",
"0.7596763",
"0.7583319",
"0.7544004",
"0.7517096",
"0.7517096",
"0.7502748",
"0.7502748",
"0.74867713",
"0.74805045",
"0.74752784",
"0.74752784",
"0.74752784",
"0.74752784",
"0.74752784",
"0.74752784",
"0.74752784",
"0.747... | 0.0 | -1 |
Run before every method to create a clean testing setup. | def setup(self):
self.testInst = pysat.Instrument('pysat', 'testing',
clean_level='clean')
self.bounds1 = (dt.datetime(2008, 1, 1), dt.datetime(2008, 1, 3))
self.bounds2 = (dt.datetime(2009, 1, 1), dt.datetime(2009, 1, 2))
return | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def setUp(self):\n test_env_setup()",
"def setUp(self):\r\n # nothing to do, all tests use different things\r\n pass",
"def setUp(self):\n pass #because we dont have anything to setup.",
"def setUp(self):\n MainTests.setUp(self)",
"def setUp(self):\n setUp()",
"d... | [
"0.7844113",
"0.7612376",
"0.7604032",
"0.75949496",
"0.7594845",
"0.75810975",
"0.7542272",
"0.7514916",
"0.7514916",
"0.7500658",
"0.7500658",
"0.74847126",
"0.7478522",
"0.74731064",
"0.74731064",
"0.74731064",
"0.74731064",
"0.74731064",
"0.74731064",
"0.74731064",
"0.747... | 0.0 | -1 |
Run before every method to create a clean testing setup. | def setup(self):
self.testInst = pysat.Instrument('pysat', 'testing_xarray',
clean_level='clean')
self.bounds1 = (dt.datetime(2008, 1, 1), dt.datetime(2008, 1, 3))
self.bounds2 = (dt.datetime(2009, 1, 1), dt.datetime(2009, 1, 2))
return | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def setUp(self):\n test_env_setup()",
"def setUp(self):\r\n # nothing to do, all tests use different things\r\n pass",
"def setUp(self):\n pass #because we dont have anything to setup.",
"def setUp(self):\n MainTests.setUp(self)",
"def setUp(self):\n setUp()",
"d... | [
"0.7843913",
"0.7613198",
"0.76043516",
"0.7595677",
"0.7595406",
"0.7581997",
"0.75430584",
"0.7515585",
"0.7515585",
"0.7501469",
"0.7501469",
"0.74854517",
"0.7479296",
"0.7473887",
"0.7473887",
"0.7473887",
"0.7473887",
"0.7473887",
"0.7473887",
"0.7473887",
"0.7473887",
... | 0.0 | -1 |
Run before every method to create a clean testing setup. | def setup(self):
self.testInst = pysat.Instrument('pysat', 'testing2D',
clean_level='clean')
self.testInst.bounds = (dt.datetime(2008, 1, 1),
dt.datetime(2008, 1, 3))
self.dname = 'alt_profiles'
self.test_vals = np.... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def setUp(self):\n test_env_setup()",
"def setUp(self):\r\n # nothing to do, all tests use different things\r\n pass",
"def setUp(self):\n pass #because we dont have anything to setup.",
"def setUp(self):\n MainTests.setUp(self)",
"def setUp(self):\n setUp()",
"d... | [
"0.7845074",
"0.7614512",
"0.76056117",
"0.7597303",
"0.7596763",
"0.7583319",
"0.7544004",
"0.7517096",
"0.7517096",
"0.7502748",
"0.7502748",
"0.74867713",
"0.74805045",
"0.74752784",
"0.74752784",
"0.74752784",
"0.74752784",
"0.74752784",
"0.74752784",
"0.74752784",
"0.747... | 0.0 | -1 |
Run before every method to create a clean testing setup. | def setup(self):
self.testInst = pysat.Instrument('pysat', 'testing2D',
clean_level='clean')
self.testInst.bounds = (dt.datetime(2008, 1, 1),
dt.datetime(2008, 2, 1))
self.dname = 'series_profiles'
self.test_vals = ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def setUp(self):\n test_env_setup()",
"def setUp(self):\r\n # nothing to do, all tests use different things\r\n pass",
"def setUp(self):\n pass #because we dont have anything to setup.",
"def setUp(self):\n MainTests.setUp(self)",
"def setUp(self):\n setUp()",
"d... | [
"0.7845074",
"0.7614512",
"0.76056117",
"0.7597303",
"0.7596763",
"0.7583319",
"0.7544004",
"0.7517096",
"0.7517096",
"0.7502748",
"0.7502748",
"0.74867713",
"0.74805045",
"0.74752784",
"0.74752784",
"0.74752784",
"0.74752784",
"0.74752784",
"0.74752784",
"0.74752784",
"0.747... | 0.0 | -1 |
Run before every method to create a clean testing setup. | def setup(self):
self.testInst = pysat.Instrument('pysat', 'testing2D_xarray',
clean_level='clean')
self.testInst.bounds = (dt.datetime(2008, 1, 1),
dt.datetime(2008, 2, 1))
self.dname = 'profiles'
self.test_val_le... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def setUp(self):\n test_env_setup()",
"def setUp(self):\r\n # nothing to do, all tests use different things\r\n pass",
"def setUp(self):\n pass #because we dont have anything to setup.",
"def setUp(self):\n MainTests.setUp(self)",
"def setUp(self):\n setUp()",
"d... | [
"0.7845074",
"0.7614512",
"0.76056117",
"0.7597303",
"0.7596763",
"0.7583319",
"0.7544004",
"0.7517096",
"0.7517096",
"0.7502748",
"0.7502748",
"0.74867713",
"0.74805045",
"0.74752784",
"0.74752784",
"0.74752784",
"0.74752784",
"0.74752784",
"0.74752784",
"0.74752784",
"0.747... | 0.0 | -1 |
Run before every method to create a clean testing setup. | def setup(self):
self.testInst = pysat.Instrument('pysat', 'testing2D_xarray',
clean_level='clean')
self.testInst.bounds = (dt.datetime(2008, 1, 1),
dt.datetime(2008, 2, 1))
self.dname = 'variable_profiles'
self.tes... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def setUp(self):\n test_env_setup()",
"def setUp(self):\r\n # nothing to do, all tests use different things\r\n pass",
"def setUp(self):\n pass #because we dont have anything to setup.",
"def setUp(self):\n MainTests.setUp(self)",
"def setUp(self):\n setUp()",
"d... | [
"0.7845074",
"0.7614512",
"0.76056117",
"0.7597303",
"0.7596763",
"0.7583319",
"0.7544004",
"0.7517096",
"0.7517096",
"0.7502748",
"0.7502748",
"0.74867713",
"0.74805045",
"0.74752784",
"0.74752784",
"0.74752784",
"0.74752784",
"0.74752784",
"0.74752784",
"0.74752784",
"0.747... | 0.0 | -1 |
Run before every method to create a clean testing setup. | def setup(self):
self.testInst = pysat.Instrument('pysat', 'testing2D_xarray',
clean_level='clean')
self.testInst.bounds = (dt.datetime(2008, 1, 1),
dt.datetime(2008, 2, 1))
self.dname = 'images'
self.test_val_lengt... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def setUp(self):\n test_env_setup()",
"def setUp(self):\r\n # nothing to do, all tests use different things\r\n pass",
"def setUp(self):\n pass #because we dont have anything to setup.",
"def setUp(self):\n MainTests.setUp(self)",
"def setUp(self):\n setUp()",
"d... | [
"0.7845074",
"0.7614512",
"0.76056117",
"0.7597303",
"0.7596763",
"0.7583319",
"0.7544004",
"0.7517096",
"0.7517096",
"0.7502748",
"0.7502748",
"0.74867713",
"0.74805045",
"0.74752784",
"0.74752784",
"0.74752784",
"0.74752784",
"0.74752784",
"0.74752784",
"0.74752784",
"0.747... | 0.0 | -1 |
Run before every method to create a clean testing setup. | def setup(self):
insts = []
for i in range(5):
insts.append(pysat.Instrument('pysat', 'testing',
clean_level='clean'))
self.testC = pysat.Constellation(instruments=insts)
self.testI = pysat.Instrument('pysat', 'testing', clean_level='... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def setUp(self):\n test_env_setup()",
"def setUp(self):\r\n # nothing to do, all tests use different things\r\n pass",
"def setUp(self):\n pass #because we dont have anything to setup.",
"def setUp(self):\n MainTests.setUp(self)",
"def setUp(self):\n setUp()",
"d... | [
"0.7843913",
"0.7613198",
"0.76043516",
"0.7595677",
"0.7595406",
"0.7581997",
"0.75430584",
"0.7515585",
"0.7515585",
"0.7501469",
"0.7501469",
"0.74854517",
"0.7479296",
"0.7473887",
"0.7473887",
"0.7473887",
"0.7473887",
"0.7473887",
"0.7473887",
"0.7473887",
"0.7473887",
... | 0.0 | -1 |
Run before every method to create a clean testing setup. | def setup(self):
insts = []
for i in range(2):
r_date = dt.datetime(2009, 1, i + 1)
insts.append(pysat.Instrument('pysat', 'testing',
clean_level='clean',
root_date=r_date))
self.testC = p... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def setUp(self):\n test_env_setup()",
"def setUp(self):\r\n # nothing to do, all tests use different things\r\n pass",
"def setUp(self):\n pass #because we dont have anything to setup.",
"def setUp(self):\n MainTests.setUp(self)",
"def setUp(self):\n setUp()",
"d... | [
"0.7843913",
"0.7613198",
"0.76043516",
"0.7595677",
"0.7595406",
"0.7581997",
"0.75430584",
"0.7515585",
"0.7515585",
"0.7501469",
"0.7501469",
"0.74854517",
"0.7479296",
"0.7473887",
"0.7473887",
"0.7473887",
"0.7473887",
"0.7473887",
"0.7473887",
"0.7473887",
"0.7473887",
... | 0.0 | -1 |
Run before every method to create a clean testing setup. | def setup(self):
self.insts = []
self.testInst = pysat.Instrument('pysat', 'testing2D',
clean_level='clean')
self.testInst.bounds = (dt.datetime(2008, 1, 1),
dt.datetime(2008, 1, 3))
self.insts.append(self.testInst... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def setUp(self):\n test_env_setup()",
"def setUp(self):\r\n # nothing to do, all tests use different things\r\n pass",
"def setUp(self):\n pass #because we dont have anything to setup.",
"def setUp(self):\n MainTests.setUp(self)",
"def setUp(self):\n setUp()",
"d... | [
"0.7845074",
"0.7614512",
"0.76056117",
"0.7597303",
"0.7596763",
"0.7583319",
"0.7544004",
"0.7517096",
"0.7517096",
"0.7502748",
"0.7502748",
"0.74867713",
"0.74805045",
"0.74752784",
"0.74752784",
"0.74752784",
"0.74752784",
"0.74752784",
"0.74752784",
"0.74752784",
"0.747... | 0.0 | -1 |
Run before every method to create a clean testing setup. | def setup(self):
self.testInst = pysat.Instrument('pysat', 'testing',
clean_level='clean')
self.testInst.bounds = (dt.datetime(2008, 1, 1),
dt.datetime(2008, 1, 3))
self.bounds1 = (dt.datetime(2008, 1, 1), dt.datetime(200... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def setUp(self):\n test_env_setup()",
"def setUp(self):\r\n # nothing to do, all tests use different things\r\n pass",
"def setUp(self):\n pass #because we dont have anything to setup.",
"def setUp(self):\n MainTests.setUp(self)",
"def setUp(self):\n setUp()",
"d... | [
"0.7843913",
"0.7613198",
"0.76043516",
"0.7595677",
"0.7595406",
"0.7581997",
"0.75430584",
"0.7515585",
"0.7515585",
"0.7501469",
"0.7501469",
"0.74854517",
"0.7479296",
"0.7473887",
"0.7473887",
"0.7473887",
"0.7473887",
"0.7473887",
"0.7473887",
"0.7473887",
"0.7473887",
... | 0.0 | -1 |
Test failure when an arraylike of length 1 is given to median2D. | def test_bin_data_depth(self):
with pytest.raises(TypeError) as verr:
avg.median2D(self.testInst, 1, 'longitude', 24, 'mlt',
['dummy1', 'dummy2', 'dummy3'], auto_bin=False)
estr = 'len() of unsized object'
assert str(verr).find(estr) >= 0
return | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_median2D_bad_input(self):\n\n with pytest.raises(ValueError) as verr:\n avg.median2D([], [0., 360., 24], 'longitude', [0., 24., 24], 'mlt',\n ['longitude'])\n\n assert str(verr).find('Parameter must be an Instrument') > 0\n\n return",
"def test_med... | [
"0.7508469",
"0.72984016",
"0.68684316",
"0.6712673",
"0.64846325",
"0.6461911",
"0.6255648",
"0.62007266",
"0.613824",
"0.61256766",
"0.6101145",
"0.60712093",
"0.60000265",
"0.59565866",
"0.5916179",
"0.5914662",
"0.58894825",
"0.58884495",
"0.58773583",
"0.5849936",
"0.582... | 0.5787824 | 23 |
Run before every method to create a clean testing setup. | def setup(self):
self.testInst = pysat.Instrument('pysat', 'testing',
clean_level='clean',
update_files=True)
self.testInst.bounds = (dt.datetime(2008, 1, 1),
dt.datetime(2008, 1, 31))
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def setUp(self):\n test_env_setup()",
"def setUp(self):\r\n # nothing to do, all tests use different things\r\n pass",
"def setUp(self):\n pass #because we dont have anything to setup.",
"def setUp(self):\n MainTests.setUp(self)",
"def setUp(self):\n setUp()",
"d... | [
"0.7845074",
"0.7614512",
"0.76056117",
"0.7597303",
"0.7596763",
"0.7583319",
"0.7544004",
"0.7517096",
"0.7517096",
"0.7502748",
"0.7502748",
"0.74867713",
"0.74805045",
"0.74752784",
"0.74752784",
"0.74752784",
"0.74752784",
"0.74752784",
"0.74752784",
"0.74752784",
"0.747... | 0.0 | -1 |
Test median1D failure when provided with a nonmonotonic bins. | def test_nonmonotonic_bins(self):
with pytest.raises(ValueError) as verr:
avg.median1D(self.testInst, [0, 13, 5], self.test_label,
self.test_data, auto_bin=False)
estr = 'bins must be monotonically increasing or decreasing'
assert str(verr).find(estr) >= 0
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_nonmonotonic_bins(self):\n\n with pytest.raises(ValueError) as verr:\n avg.median2D(self.testInst, np.array([0., 300., 100.]), 'longitude',\n np.array([0., 24., 13.]), 'mlt',\n ['dummy1', 'dummy2', 'dummy3'], auto_bin=False)\n\n estr... | [
"0.75375706",
"0.7425227",
"0.7305547",
"0.72789365",
"0.72099555",
"0.7189495",
"0.70267254",
"0.70081466",
"0.6808475",
"0.6694378",
"0.66634285",
"0.6602126",
"0.6530274",
"0.65115786",
"0.64514667",
"0.6406845",
"0.63976115",
"0.6320005",
"0.62935007",
"0.6274843",
"0.622... | 0.7943803 | 0 |
Test API can get a user shopppinglist | def test_if_app_gets_shoppinglists(self):
li = self.client.get('/shoppinglists/?each_page=1&page_number=1',
headers = {
'Content-Type':'application/json',
'x-access-token':self.tok})
self.assertEqual(li.status_co... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_api_user_get(self):\n pass",
"def test_listing_supplies_user(self):\n request = self.factory.get(\n '/api/supplies')\n force_authenticate(request, user=self.testuser1)\n response = SupplyListView.as_view()(request)\n # normal user can browse the data\n ... | [
"0.69973886",
"0.68879277",
"0.68602026",
"0.6824236",
"0.6700213",
"0.66470695",
"0.6644938",
"0.6588357",
"0.6558273",
"0.6558273",
"0.6535568",
"0.6503087",
"0.65000474",
"0.6497708",
"0.64899206",
"0.6440723",
"0.64134187",
"0.63904846",
"0.6357058",
"0.6353979",
"0.63114... | 0.7381882 | 0 |
Test API can search for a list with no products | def test_if_app_can_search_for_existing_list_without_products(self):
add_list=self.client.post('/shoppinglists/',
data=self.shopllist,
headers={
'Content-Type':'application/json',
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_get_empty_product_list(self):\n response = self.client().get('/api/v1/products')\n json_data = json.loads(response.data)\n self.assertTrue(json_data.get('Error'))\n self.assertEqual(json_data.get('Error'), \"There are no books\")\n self.assertEqual(response.status_code, ... | [
"0.79860896",
"0.762958",
"0.74859864",
"0.7322933",
"0.73226535",
"0.72748005",
"0.72409385",
"0.7220713",
"0.71785754",
"0.71070606",
"0.7078745",
"0.70461315",
"0.7024391",
"0.7011722",
"0.7006077",
"0.69657147",
"0.6953056",
"0.6936329",
"0.6912971",
"0.690604",
"0.686887... | 0.79576176 | 1 |
remove stopwords from text | def remove_stopwords(text, is_lower_case=False):
tokens = tokenizer.tokenize(text)
tokens = [token.strip() for token in tokens]
if is_lower_case:
filtered_tokens = [token for token in tokens if token not in stopword_list]
else:
filtered_tokens = [token for token in tokens if token.lower(... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def remove_stopwords(self,text):\n return \" \".join([word for word in str(text).split() if word not in self.STOPWORDS])",
"def remove_stopwords(text):\n return \" \".join([word for word in str(text).split() if word not in STOPWORDS])",
"def remove_stopwords(text):\n text = \" \"+text\n tex... | [
"0.89286715",
"0.88482356",
"0.8793787",
"0.87769353",
"0.87291235",
"0.86553067",
"0.8621385",
"0.85990196",
"0.8581002",
"0.8548902",
"0.8535186",
"0.8486007",
"0.82015955",
"0.8193264",
"0.81688696",
"0.81433773",
"0.8126156",
"0.80897945",
"0.80001014",
"0.79859096",
"0.7... | 0.8117342 | 17 |
r"""Converts a dense adjacency matrix to a sparse adjacency matrix defined by edge indices and edge attributes. | def dense_to_sparse(adj):
assert adj.dim() >= 2 and adj.dim() <= 3
assert adj.size(-1) == adj.size(-2)
index = adj.nonzero(as_tuple=True)
#print(index)
edge_attr = adj[index]
if len(index) == 3:
batch = index[0] * adj.size(-1)
index = (batch + index[1], batch + index[2])
r... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _from_dict_to_sparse(self, adj_dict):\n indices = list(adj_dict.keys())\n values = [1] * len(indices)\n\n edge_index = torch.LongTensor(indices).T.to(self.device)\n edge_attr = torch.FloatTensor(values).to(self.device)\n\n edge_index, edge_attr = utils.to_symmetric(edge_index... | [
"0.73674446",
"0.73380816",
"0.69235134",
"0.6910183",
"0.67323536",
"0.67166203",
"0.66891265",
"0.6563592",
"0.65598524",
"0.65598524",
"0.65598524",
"0.65598524",
"0.65598524",
"0.64673984",
"0.64584976",
"0.64497274",
"0.64242405",
"0.6352266",
"0.6349056",
"0.6345755",
"... | 0.79556376 | 0 |
Return a 'fixed' version of filename. | def get_fixed_filename(filename):
filename = filename.replace(".TXT", ".txt")
new_name = ""
space_preceding = False
bracket_preceding = False
for letter in filename:
if letter.isspace() or letter == "_":
space_preceding = True
new_name = new_name + "_"
elif ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _safe_filename(filename):\n date = datetime.datetime.utcnow().strftime(\"%Y-%m-%d-%H%M%S\")\n basename, extension = filename.rsplit('.', 1)\n return \"{0}-{1}.{2}\".format(basename, date, extension)",
"def _safe_filename(filename):\n filename = secure_filename(filename)\n date = datetime.datet... | [
"0.7250059",
"0.71424264",
"0.7099398",
"0.7067578",
"0.70534736",
"0.6940534",
"0.68074816",
"0.6781198",
"0.67568046",
"0.673747",
"0.6724021",
"0.67217356",
"0.6685823",
"0.6665831",
"0.6630088",
"0.661831",
"0.6595872",
"0.658626",
"0.65764874",
"0.6531638",
"0.6502819",
... | 0.63322127 | 31 |
Returns True if the tracking URI has been set, False otherwise. | def is_tracking_uri_set():
if _tracking_uri or env.get_env(_TRACKING_URI_ENV_VAR):
return True
return False | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def has_url(self):\n return hasattr(self, \"_url\") and self._url is not None",
"def _urlcheck(self):\n if (self['.managerhost'] and self['.settingurl'] and self['.guid']):\n return True\n else:\n return False",
"def set_tracking_uri(uri):\n global _tracking_uri\n ... | [
"0.6479483",
"0.6459205",
"0.6323849",
"0.6238821",
"0.6171583",
"0.61708397",
"0.61642635",
"0.6158794",
"0.6127984",
"0.6090554",
"0.6062558",
"0.6044552",
"0.59880835",
"0.59870595",
"0.5969935",
"0.59455836",
"0.5932854",
"0.59196186",
"0.5909605",
"0.58852804",
"0.582607... | 0.898794 | 0 |
Get the current tracking URI. This may not correspond to the tracking URI of the currently active run, since the tracking URI can be updated via ``set_tracking_uri``. | def get_tracking_uri():
global _tracking_uri
if _tracking_uri is not None:
return _tracking_uri
elif env.get_env(_TRACKING_URI_ENV_VAR) is not None:
return env.get_env(_TRACKING_URI_ENV_VAR)
else:
return os.path.abspath("./mlruns") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_tracker_uri(self):\r\n return self.tracker_uri",
"def tracking_url(self) -> str:\n return pulumi.get(self, \"tracking_url\")",
"def get_uri(self):\n return self.__uri",
"def get_uri(self):\r\n return self.uri",
"def get_url(self):\n return self.base_driver.current... | [
"0.7794888",
"0.7426825",
"0.6945061",
"0.6806299",
"0.6781391",
"0.67510617",
"0.6750797",
"0.6684088",
"0.6684088",
"0.6684088",
"0.6684088",
"0.6684088",
"0.6684088",
"0.6651515",
"0.659315",
"0.65794116",
"0.6577855",
"0.6565985",
"0.6558846",
"0.654117",
"0.65325385",
... | 0.80332476 | 0 |
Return the path git_urisub_directory if the URI passed is a local path that's part of a Git repo, or returns the original URI otherwise. | def _get_git_url_if_present(uri):
if '#' in uri:
# Already a URI in git repo format
return uri
try:
from git import Repo, InvalidGitRepositoryError, GitCommandNotFound, NoSuchPathError
except ImportError as e:
print("Notice: failed to import Git (the git executable is probabl... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getPath(self, uri):\n if os.path.isdir(uri):\n return uri\n else:\n raise RepoException(\"The repo path does not exist: %s\" % uri)",
"def syncPath(cls, type=\"local\", uri=\".\"):\n repo = config.get_plugin(\"repo\", type)\n if not repo:\n raise R... | [
"0.70532715",
"0.6829297",
"0.67061585",
"0.62289095",
"0.6172714",
"0.6092495",
"0.60773754",
"0.6064918",
"0.6039916",
"0.59507537",
"0.59344393",
"0.5920267",
"0.59074557",
"0.5892522",
"0.5867568",
"0.58165574",
"0.5815977",
"0.5809376",
"0.5795269",
"0.5781473",
"0.57795... | 0.7456995 | 0 |
Renders the home page for the website. | def index():
return render_template('pages/index.html', isNav=True) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def render_home():\r\n\treturn render_template(\"index.html\")",
"def home():\n\n return render_template('home_page.html')",
"def homepage():\n return render_template('home/index.html', \n title=\"Bem vindo!\")",
"def homepage():\n\treturn render_template(\"home/a_homepage.ht... | [
"0.8604442",
"0.8500615",
"0.8388268",
"0.8380108",
"0.83712155",
"0.8328059",
"0.8325257",
"0.8319344",
"0.83181703",
"0.8307902",
"0.83016413",
"0.82907146",
"0.82907146",
"0.82763845",
"0.8251702",
"0.82399243",
"0.82399243",
"0.82399243",
"0.82399243",
"0.82399243",
"0.82... | 0.0 | -1 |
Renders an error page with 404 message. | def page_not_found(error):
error_message = str(error)
return render_template('error-pages/404-page.html', error_message=error_message, isFooter=True), 404 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def display_404(error):\n return render_template('/error.html'), 404",
"def page_not_found():\n return render_template(\"errors/404.html\"), 404",
"def page_not_found(_error):\n return render_template('404.html'), 404",
"def page_not_found(er):\n return render_template('errors.html'), 404",
"de... | [
"0.87562716",
"0.8740791",
"0.8694112",
"0.86651933",
"0.86473167",
"0.8609954",
"0.86035633",
"0.85903746",
"0.8584245",
"0.85659873",
"0.85659873",
"0.856508",
"0.85636836",
"0.8561664",
"0.8560108",
"0.85273474",
"0.8453898",
"0.8446212",
"0.843078",
"0.84204453",
"0.83922... | 0.845805 | 16 |
Function to initialize a ElasticNet model. | def _model(self):
model = glmnet.ElasticNet(
alpha=self.alpha,
n_lambda=self.n_lambda,
min_lambda_ratio=self.min_lambda_ratio,
lambda_path=self.lambda_path,
standardize=self.scale,
fit_intercept=self.fit_intercept,
cut_point=se... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self, elastic_ctrl: ElasticityController, nncf_network: NNCFNetwork):\n self._m_handler = elastic_ctrl.multi_elasticity_handler\n self._elasticity_ctrl = elastic_ctrl\n self._model = nncf_network",
"def __init__(self):\n \n self.model = Net()\n\n if torch.cud... | [
"0.6660076",
"0.6600167",
"0.637495",
"0.63703966",
"0.63447905",
"0.6296791",
"0.6293255",
"0.6290172",
"0.6279328",
"0.6255419",
"0.6243293",
"0.6173627",
"0.6172966",
"0.6171316",
"0.6163583",
"0.6151682",
"0.61366194",
"0.61124045",
"0.607899",
"0.606868",
"0.6063831",
... | 0.67390877 | 0 |
Function to return the nonzero coeff for the best lambda as Pandas DataFrame. | def _coeff_to_df(self):
dct = self._coeff_to_dict()
return (
pd.DataFrame(data=dct.items(), columns=["feature", "coeff"])
.sort_values(by="coeff", ascending=False)
.reset_index(drop=True)
) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def trend_filter(rets_data, lambda_value):\r\n #USING CVXPY convex optimiser\r\n n_periods = rets_data.shape[0]\r\n rets = rets_data.to_numpy()\r\n\r\n D_full = np.diag([1]*n_periods) - np.diag([1]*(n_periods-1), 1)\r\n D = D_full[0:n_periods-1,]\r\n beta = cp.Variable(n_periods)\r\n lambd = c... | [
"0.56539845",
"0.5527984",
"0.551429",
"0.54217345",
"0.539939",
"0.5383994",
"0.53775567",
"0.5368512",
"0.5343976",
"0.5338961",
"0.5336363",
"0.5292487",
"0.5213887",
"0.520227",
"0.5194823",
"0.51802653",
"0.5162921",
"0.5153196",
"0.5149863",
"0.5136775",
"0.5084286",
... | 0.4905848 | 44 |
Function to return the nonzero coeff for the best lambda as dict. | def _coeff_to_dict(self):
idx = list(np.nonzero(np.reshape(self.model_.coef_, (1, -1)))[1])
dct = dict(
zip(
[self.X_train_.columns.tolist()[i] for i in idx],
[
self.model_.coef_.reshape(-1, self.model_.coef_.shape[-1])[0][i]
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getLambda(inp):\n\treturn 0.9/(getK1(inp) - getCMean(inp))",
"def getCrowDistDict(self):\n retDict = Distribution.getCrowDistDict(self)\n retDict['lambda'] = self.lambdaVar\n retDict['k'] = self.k\n retDict['low'] = self.low\n return retDict",
"def getCrowDistDict(self):\n retDict = Distr... | [
"0.57542205",
"0.5717544",
"0.564656",
"0.55869895",
"0.546986",
"0.5465802",
"0.5423759",
"0.54199076",
"0.53814495",
"0.5361005",
"0.5308551",
"0.52844375",
"0.5275975",
"0.5218444",
"0.5215131",
"0.52103615",
"0.51935935",
"0.51935935",
"0.51847035",
"0.51734585",
"0.51659... | 0.5796722 | 0 |
Function to return model's results as a Pandas DataFrame. | def _cv_results(self):
df = pd.DataFrame(
(self.model_.coef_path_.reshape(-1, self.model_.coef_path_.shape[-1])).T,
columns=[f"{col}_coeff_path" for col in self.X_train_.columns.tolist()],
)
df["intercept_path"] = (
self.model_.intercept_path_.reshape(
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_pandas(self):\n return pd.DataFrame(self.results)",
"def model_to_df(self, transpose=True):\n X = np.vstack([self.sales(), self.unit_contribution(),\n self.net_revenue(), self.depreciation(),\n self.before_tax_profit(), self.after_tax_profit(), se... | [
"0.80328673",
"0.7158678",
"0.69999963",
"0.6914213",
"0.6910849",
"0.6863081",
"0.68356454",
"0.68356454",
"0.68356454",
"0.68356454",
"0.68356454",
"0.6773959",
"0.67673457",
"0.67664504",
"0.67664504",
"0.67497694",
"0.67483246",
"0.6746302",
"0.674157",
"0.6687641",
"0.66... | 0.0 | -1 |
Takes in a 230x230 shape array and converts it to a flattened 1d array with indices | def convert_to_compact_array(data, label):
indices = np.arange(230 * 230).reshape(230, 230)
t1, t2, pd, dn = label
m = np.ma.masked_equal(pd, 0)
t1_masked, t2_masked, pd_masked, indices_masked, dn_masked = \
np.ma.masked_array(t1, m.mask), np.ma.masked_array(t2, m.mask), \
np.ma.masked_a... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def flatten(X):\n N = X.shape[-1]\n flat = np.zeros((N, 3072))\n for idx, i in enumerate(range(N)):\n # if not idx:\n # print(X[:,:,:,i].reshape(3072))\n flat[i] = X[:,:,:,i].reshape(3072)\n return flat",
"def flatten_idx(idx, axis=-1):\n idx = numpy.asanyarray(idx)\n i... | [
"0.6891298",
"0.68770856",
"0.68503946",
"0.6794959",
"0.6709632",
"0.6599226",
"0.65438265",
"0.6451453",
"0.6418531",
"0.6337268",
"0.633697",
"0.6283048",
"0.6222314",
"0.61826795",
"0.61617184",
"0.6102546",
"0.6070544",
"0.6055939",
"0.6039484",
"0.60324",
"0.6016781",
... | 0.55144936 | 89 |
set the name of the flower | def set_name(self,name):
if not isinstance(name,(str)):
raise TypeError('name must be string')
else:
self._name = name | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_name(self, newname=\"\"):\n self.name = newname",
"def new_name(self,new_name):\n self.name = new_name",
"def set_name(self, name):\n\t\tself.name_ = name",
"def set_name(self, name):\n self.name = name # overwrite the existing name with the input name",
"def set_name(self, na... | [
"0.72778326",
"0.71287006",
"0.7093384",
"0.70216936",
"0.70216936",
"0.7019327",
"0.69539905",
"0.69539905",
"0.69539905",
"0.69539905",
"0.69539297",
"0.69148284",
"0.69148284",
"0.69050854",
"0.69007117",
"0.69007117",
"0.69007117",
"0.69007117",
"0.69007117",
"0.68506086",
... | 0.64021575 | 62 |
Ensures the department list view does not require login. | def test_department_list_view_does_not_require_login(self):
FireDepartment.objects.create(name='Test db', population=0)
c = Client()
response = c.get('/departments')
self.assertEqual(response.status_code, 200) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_department_detail_view_does_not_require_login(self):\n\n fd = FireDepartment.objects.create(name='Test db', population=0)\n c = Client()\n response = c.get(fd.get_absolute_url())\n self.assertEqual(response.status_code, 200)",
"def _checkInputTemplateSecurity(self, input_temp... | [
"0.6651229",
"0.5949095",
"0.58881",
"0.58461714",
"0.58370554",
"0.5791154",
"0.5733321",
"0.5665855",
"0.5647619",
"0.5585024",
"0.55743307",
"0.55293113",
"0.54962397",
"0.5482921",
"0.5480105",
"0.54582936",
"0.5439294",
"0.542393",
"0.5420192",
"0.54112434",
"0.5392665",... | 0.7172031 | 0 |
Computes the embedding from a batched input. | def process_batch(self, data):
[embedding_batch] = self._sess.run([self._embedding_tensor],
feed_dict={self._features_tensor: data})
return embedding_batch | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def call(self, x, *args, **kwargs):\n with tf.name_scope(\"embedding\"):\n # fills out of bound values with padding symbol\n out_bound_mask = tf.cast(x > (self.vocab_size - 1), dtype=tf.int32)\n x *= 1 - out_bound_mask\n x += out_bound_mask * tf.cast(self.pad_sym,... | [
"0.6855878",
"0.67313987",
"0.6704364",
"0.66974163",
"0.662997",
"0.6617429",
"0.6579141",
"0.65286726",
"0.65286726",
"0.6491749",
"0.6483122",
"0.6471915",
"0.64437324",
"0.6402234",
"0.63720846",
"0.6361234",
"0.6329541",
"0.6322668",
"0.63197666",
"0.6310015",
"0.6308307... | 0.694443 | 0 |
Return True if the cell_id points to a temporal cell | def is_temporal_cell(self, cell_id):
assert np.all(self.is_cell_id(cell_id))
return cell_id & self.tmask | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_temporal(self, e):\n if e in self.temporal:\n return True",
"def is_alive(self, cell: Position) -> bool:\n return cell in self._state",
"def has_t(self):\n return any(map(lambda s: s.is_temporal, self))",
"def static_cell_for_cell(self, cell_id):\n\t\tassert np.all(self... | [
"0.6390344",
"0.617976",
"0.606312",
"0.6051273",
"0.59818906",
"0.580023",
"0.5775213",
"0.5721793",
"0.5669479",
"0.56345135",
"0.5559492",
"0.54999256",
"0.54717904",
"0.54613405",
"0.5450685",
"0.544908",
"0.5436226",
"0.54338217",
"0.5419904",
"0.5398779",
"0.53971934",
... | 0.84101105 | 0 |
load trained weights for the model | def load_model():
global obj
obj = NutritionTableDetector()
print("Weights Loaded!") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def load_model_weights(self):\n raise NotImplementedError",
"def load_weights(self):\n try:\n print('loading weights from {}'.format(self.cfg.class_model_dir))\n self.load_state_dict(torch.load(self.cfg.class_model_dir + self.class_model_name + '.pth'))\n except Excepti... | [
"0.851856",
"0.7980184",
"0.79577416",
"0.7873259",
"0.7872814",
"0.78525436",
"0.78167546",
"0.7800688",
"0.7791164",
"0.77594733",
"0.7746501",
"0.77379256",
"0.77241075",
"0.77096915",
"0.76520526",
"0.7620029",
"0.7569135",
"0.7552008",
"0.75440407",
"0.75348926",
"0.7476... | 0.6833859 | 72 |
Returns the matching device class or raises an UnknownDeviceTypeError | def get_device_class(manufacturer_id: int, manufacturer_product_type: int, manufacturer_product_id):
key = str(manufacturer_id) + '-' + str(manufacturer_product_type) + '-' + str(manufacturer_product_id)
if key not in type_map:
raise UnknownDeviceTypeError
return type_map[key] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def device_class(self):\n return SENSOR_TYPES[self.sensor][3].get(\"device_class\")",
"def device_class(self):\n try:\n return DEVICE_CLASS_MAP[self._sensor]\n except KeyError:\n # Sensor must be unknown to us, add as generic\n return None",
"def device_cla... | [
"0.7743256",
"0.77038646",
"0.76273584",
"0.75401074",
"0.75191265",
"0.7514639",
"0.75096905",
"0.748489",
"0.7474209",
"0.7474209",
"0.74352026",
"0.7420845",
"0.7416792",
"0.7416792",
"0.7416792",
"0.7398546",
"0.7355163",
"0.7351351",
"0.7351351",
"0.7351351",
"0.7351351"... | 0.76347595 | 2 |
Rotates this point around the Y axis the given number of degrees. | def rotateY(self, angle):
rad = angle * math.pi / 180
cosa = math.cos(rad)
sina = math.sin(rad)
z = self.z * cosa - self.x * sina
x = self.z * sina + self.x * cosa
return Point3D(x, self.y, z) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def rot_y_deg(self):\n # TODO describe which axis this is\n return math.degrees(self._rot_y_rad)",
"def rot_y_rad(self):\n return self._rot_y_rad",
"def set_ypos(self, deg):\n if deg < -10:\n deg = -10\n elif deg > 10:\n deg = 10\n deg += 10\n ... | [
"0.764156",
"0.7231509",
"0.7092509",
"0.70017207",
"0.69473153",
"0.68552095",
"0.6567456",
"0.6522099",
"0.65098804",
"0.6378582",
"0.63657093",
"0.6340271",
"0.6316594",
"0.6215496",
"0.6177662",
"0.6171272",
"0.6157312",
"0.61190975",
"0.6117733",
"0.60771954",
"0.606246"... | 0.0 | -1 |
Transforms this 3D point to 2D using a perspective projection. | def project(self, win_width, win_height, fov, viewer_distance):
factor = fov / (viewer_distance + self.z)
x = self.x * factor + win_width / 2
y = -self.y * factor + win_height / 2
return Point3D(x, y, self.z) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def project_point(self, point: Point3D) -> Point3D:\n x, y, z = point\n cam_x, cam_y, cam_z = self._pos\n x -= cam_x\n y -= cam_y\n z -= cam_z\n dx = self._cy*(self._sz*y + self._cz*x) - self._sy*z\n dy = self._sx*(self._sy*(self._sz*y + self._cz*x) + self._cy*z) + ... | [
"0.7485963",
"0.7216747",
"0.69505316",
"0.6885933",
"0.68209916",
"0.6656276",
"0.6602913",
"0.65647006",
"0.6494653",
"0.64801013",
"0.64739835",
"0.63769954",
"0.6376144",
"0.63746977",
"0.63733226",
"0.6369274",
"0.63624996",
"0.63611245",
"0.63498086",
"0.6336155",
"0.63... | 0.6210368 | 27 |
wraps hidden states in new Tensors, to detach them from their history. | def repackage_hidden(h):
if isinstance(h, torch.Tensor):
return h.detach()
else:
return tuple(repackage_hidden(v) for v in h) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def detach_hidden(hidden: Any) -> Any:\n return apply_to_tensor(hidden, Tensor.detach)",
"def reset_hidden(self, batch_size):\n\n hidden = {}\n hidden[\"h\"] = torch.Tensor(np.zeros((batch_size, self._hidden_size))).to(self._device)\n hidden[\"c\"] = torch.Tensor(np.zeros((batch_size, sel... | [
"0.67749524",
"0.6434035",
"0.64160454",
"0.6412985",
"0.64076",
"0.6294356",
"0.6077541",
"0.6077541",
"0.6076566",
"0.6071921",
"0.6040047",
"0.6040047",
"0.5989625",
"0.598646",
"0.5950387",
"0.588665",
"0.5885526",
"0.5859657",
"0.5859657",
"0.58478916",
"0.5810157",
"0... | 0.5382091 | 55 |
Test Setter and Getter for 'recommended_num_references'. | def test_recommended_num_references(self):
batch = Batch(Mock())
self.check_instance(batch)
self.assertIsNone(batch.recommended_num_references)
self.check_instance(batch)
batch._recommended_num_references = 10
self.assertEqual(batch.recommended_num_references, 10)
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_recommended_num_objects(self):\n\n batch = Batch(Mock())\n self.check_instance(batch)\n\n self.assertIsNone(batch.recommended_num_objects)\n self.check_instance(batch)\n\n batch._recommended_num_objects = 10\n self.assertEqual(batch.recommended_num_objects, 10)\n ... | [
"0.6679959",
"0.61644685",
"0.5811828",
"0.5577427",
"0.5554049",
"0.5527453",
"0.5479873",
"0.54286367",
"0.5427623",
"0.5426805",
"0.53952336",
"0.53875995",
"0.53875995",
"0.53875995",
"0.53414106",
"0.5335766",
"0.5262863",
"0.52258825",
"0.52043575",
"0.51844543",
"0.518... | 0.7939803 | 0 |
ensure email is in the database | def validate_email(self, data):
user = account_models.User.objects.filter(username__iexact=data, is_active=True)
if user:
return data
raise serializers.ValidationError("Email address not verified for any user account") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def existing_email(cls, email):\n user_db = User.get_by('email', email)\n if not user_db:\n raise ValueError('This email is not in our database.')\n return email",
"def validate_email(self, email):\n if email.data != current_user.email:\n user = User.query.filter... | [
"0.76046383",
"0.7554193",
"0.7469107",
"0.73643005",
"0.7292213",
"0.72549045",
"0.7250293",
"0.72352064",
"0.7176981",
"0.7145582",
"0.71445185",
"0.7115147",
"0.7097604",
"0.7095494",
"0.7044005",
"0.7038727",
"0.7038727",
"0.7032835",
"0.7032809",
"0.70212036",
"0.7002401... | 0.662277 | 48 |
Split a numpy array into two parts of `proportion` and `1 proportion` | def split_data(data, labels, proportion):
size = data.shape[0]
np.random.seed(42)
s = np.random.permutation(size)
split_idx = int(proportion * size)
return (data[s[:split_idx]], data[s[split_idx:]], labels[s[:split_idx]], labels[s[split_idx:]]) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def split_array(array: np.ndarray, parts: int):\n\n if parts == -1:\n parts = array.size\n shape = array.shape\n possible_chunk_sizes = []\n # Generate all possible chunk sizes for the given array shape\n for chunk_size in product(*[range(1, shape[i] + 1) for i in range(len(shape))]):\n ... | [
"0.6124419",
"0.58726543",
"0.5708537",
"0.55723757",
"0.5565012",
"0.55347586",
"0.5534433",
"0.548769",
"0.5468142",
"0.5464712",
"0.5442218",
"0.53981984",
"0.53841823",
"0.53829044",
"0.53586715",
"0.5323732",
"0.5321245",
"0.52906376",
"0.527975",
"0.52775216",
"0.527571... | 0.6388887 | 0 |
Creates an instance of the InceptionV3 model used for image feature extraction. This model is used without the top classification layers, i.e up to the last convolutional layer. See the README for details on the architecture. | def image_features_extracter(cnn_encoder):
if cnn_encoder == 'InceptionV3':
image_model = tf.keras.applications.InceptionV3(include_top=False,
weights='imagenet')
new_input = image_model.input
hidden_layer = image_model.layers[-1].out... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def generate_model_inception_v3():\n base_model = tf.keras.applications.InceptionV3(\n include_top=False,\n input_shape=(IMG_SIZE, IMG_SIZE, IMG_CHANNELS)\n )\n model = tf.keras.models.Sequential([\n base_model,\n tf.keras.layers.GlobalAveragePooling2D(),\n tf.keras.laye... | [
"0.84032947",
"0.7388749",
"0.7339636",
"0.7091948",
"0.67731905",
"0.6672038",
"0.66201055",
"0.66157115",
"0.6568229",
"0.65258545",
"0.64755785",
"0.64727265",
"0.6426069",
"0.6412518",
"0.6366948",
"0.6353184",
"0.63499624",
"0.6332716",
"0.62350047",
"0.6234023",
"0.6228... | 0.5717256 | 78 |
Find an entry in this pool for the given account, if there is one. | def find_entry_for(self, account, key_only=False):
q = self.entry_keys if key_only else self.entries
return q.filter('account =', account).get() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def find_by_account_name(cls, account_name):\n for account in cls.credentials_list:\n if account.account_name == account_name:\n return account",
"def find_credential(cls, account):\n for credential in cls.credential_list:\n if credential.account == account:\n ... | [
"0.7189938",
"0.69635975",
"0.6953793",
"0.66414326",
"0.65893614",
"0.6582859",
"0.6472638",
"0.64721215",
"0.6459356",
"0.64258343",
"0.63912606",
"0.63703537",
"0.62721926",
"0.6254881",
"0.6248897",
"0.62342405",
"0.62254333",
"0.61910635",
"0.6101265",
"0.6038063",
"0.59... | 0.6773786 | 3 |
Save a PipelineConfig to JSON file. Inject rv_config and plugin_versions before saving. | def save_pipeline_config(cfg: 'PipelineConfig', output_uri: str) -> None:
cfg.rv_config = rv_config.get_config_dict(registry.rv_config_schema)
cfg.plugin_versions = registry.plugin_versions
cfg_json = cfg.json()
str_to_file(cfg_json, output_uri) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def save(self, config_file: typing.TextIO):\n json.dump(self.to_dict(), config_file, indent=4)",
"def save_config(self):\n data = json.dumps(self.cfg)\n\n try:\n file = open(self.cfg_file_name, 'w')\n file.write(data)\n except OSError as err:\n print(\... | [
"0.6485044",
"0.64818954",
"0.6441421",
"0.64227265",
"0.642177",
"0.641098",
"0.6357041",
"0.63123995",
"0.62854147",
"0.62806416",
"0.6273614",
"0.6270138",
"0.6214956",
"0.6196016",
"0.61799",
"0.61765444",
"0.6160291",
"0.6122432",
"0.61186635",
"0.6090508",
"0.60590976",... | 0.80649215 | 0 |
Returns EstimatorSpec instance for softmax classification. | def estimator_spec_for_softmax_classification(
logits, labels, mode):
predicted_classes = tf.argmax(logits, 1)
if mode == tf.estimator.ModeKeys.PREDICT:
return tf.estimator.EstimatorSpec(
mode=mode,
predictions={
'class': predicted_classes,
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def estimator_spec_for_softmax_classification(logits, labels, mode):\n predicted_classes = tf.argmax(logits, axis=1)\n predicted_probs = tf.nn.softmax(logits, name='softmax_tensor')\n\n predictions = {\n # Holds the raw logit values\n 'logits': logits,\n\n # Holds the class id (0,1) representing the mo... | [
"0.6668788",
"0.6369035",
"0.6088024",
"0.585658",
"0.5825897",
"0.58146685",
"0.5756775",
"0.5727897",
"0.56512773",
"0.5646046",
"0.5442413",
"0.542282",
"0.5408609",
"0.539449",
"0.5385028",
"0.53844607",
"0.53671706",
"0.53646314",
"0.53413576",
"0.53340393",
"0.53319436"... | 0.6810436 | 0 |
Sets the object_property_name of this TimelineEventTemplateToken. | def object_property_name(self, object_property_name):
self._object_property_name = object_property_name | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_object_name(self, object_name = \"DefaultObject\"):\n self.obj_name = object_name",
"def property_name(self, name: str) -> None:\n name = str(name)\n if len(name) > 100:\n name = name[:100]\n self.prop_name = name",
"def object_def_name(self, object_def_name):\n\n... | [
"0.6895584",
"0.60614604",
"0.58617884",
"0.5766865",
"0.57661223",
"0.56574374",
"0.55981493",
"0.5525939",
"0.5515005",
"0.54376304",
"0.54189056",
"0.5352971",
"0.5352756",
"0.5301691",
"0.52696735",
"0.5257656",
"0.5257656",
"0.52554286",
"0.5253431",
"0.524873",
"0.52487... | 0.75223273 | 0 |
Sets the name of this TimelineEventTemplateToken. | def name(self, name):
if self.local_vars_configuration.client_side_validation and name is None: # noqa: E501
raise ValueError("Invalid value for `name`, must not be `None`") # noqa: E501
self._name = name | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def template_name(self, template_name):\n\n self._template_name = template_name",
"def set_token_name(self, name):\n output = self.copy()\n output.token_name = name\n return output",
"def name(self, name):\n \n self._name = name",
"def name(self, name):\n \n ... | [
"0.69485897",
"0.6855805",
"0.65291727",
"0.65291727",
"0.65291727",
"0.65291727",
"0.65205985",
"0.65205985",
"0.65205985",
"0.65205985",
"0.65205985",
"0.65205985",
"0.65205985",
"0.65205985",
"0.65205985",
"0.65205985",
"0.65205985",
"0.65205985",
"0.6515983",
"0.65060484",
... | 0.0 | -1 |
Sets the type of this TimelineEventTemplateToken. | def type(self, type):
if self.local_vars_configuration.client_side_validation and type is None: # noqa: E501
raise ValueError("Invalid value for `type`, must not be `None`") # noqa: E501
allowed_values = ["date", "enumeration", "number", "string"] # noqa: E501
if self.local_vars_c... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_type(self, type):\n self.type = type",
"def set_type(self, type):\n self.type = type",
"def set_type(self, type):\n self._type = type",
"def type(self, type):\n self._type = type",
"def type(self, type):\n self._type = type",
"def type(self, type):\n\n se... | [
"0.67262554",
"0.67262554",
"0.6704004",
"0.6483246",
"0.6483246",
"0.64331496",
"0.64331496",
"0.64331496",
"0.64331496",
"0.64331496",
"0.64331496",
"0.64331496",
"0.64331496",
"0.64331496",
"0.64331496",
"0.64331496",
"0.64331496",
"0.64331496",
"0.64331496",
"0.64331496",
... | 0.5375727 | 82 |
Sets the created_at of this TimelineEventTemplateToken. | def created_at(self, created_at):
self._created_at = created_at | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def created_at(self, created_at):\n self._created_at = created_at",
"def created_at(self, created_at: \"datetime\"):\n self._attrs[\"createdAt\"] = created_at",
"def created_at(self, created_at: \"datetime\"):\n self._attrs[\"createdAt\"] = created_at",
"def created_at(self, created_at: ... | [
"0.74666506",
"0.7258087",
"0.7258087",
"0.7258087",
"0.720285",
"0.7202447",
"0.7202447",
"0.71323866",
"0.66994673",
"0.63882613",
"0.6341607",
"0.6328011",
"0.63148814",
"0.63114446",
"0.62890184",
"0.5968378",
"0.5867426",
"0.5783182",
"0.5767339",
"0.57574934",
"0.575749... | 0.74397564 | 14 |
Sets the updated_at of this TimelineEventTemplateToken. | def updated_at(self, updated_at):
self._updated_at = updated_at | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def updated_at(self, updated_at: \"datetime\"):\n self._attrs[\"updatedAt\"] = updated_at",
"def updated_at(self, updated_at: \"datetime\"):\n self._attrs[\"updatedAt\"] = updated_at",
"def updated_at(self, updated_at: \"datetime\"):\n self._attrs[\"updatedAt\"] = updated_at",
"def updat... | [
"0.7025218",
"0.7025218",
"0.7025218",
"0.6918352",
"0.57623476",
"0.57623476",
"0.57623476",
"0.5706824",
"0.5676351",
"0.56562376",
"0.5650007",
"0.5650007",
"0.56115884",
"0.56115884",
"0.56115884",
"0.5557712",
"0.5557712",
"0.5556558",
"0.55175215",
"0.55093867",
"0.5509... | 0.69793683 | 10 |
Returns true if both objects are equal | def __eq__(self, other):
if not isinstance(other, TimelineEventTemplateToken):
return False
return self.to_dict() == other.to_dict() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __eq__(self, other):\n return are_equal(self, other)",
"def __eq__(self, other):\n return are_equal(self, other)",
"def __eq__(self,other):\n try: return self.object==other.object and isinstance(self,type(other))\n except: return False",
"def __eq__(self, other):\n if i... | [
"0.80886984",
"0.80886984",
"0.8055307",
"0.7983415",
"0.79673034",
"0.79673034",
"0.79673034",
"0.79673034",
"0.79673034",
"0.79673034",
"0.79673034",
"0.79673034",
"0.79673034",
"0.79673034",
"0.79673034",
"0.79673034",
"0.79673034",
"0.79673034",
"0.79673034",
"0.79673034",
... | 0.0 | -1 |
Returns true if both objects are not equal | def __ne__(self, other):
if not isinstance(other, TimelineEventTemplateToken):
return True
return self.to_dict() != other.to_dict() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __ne__(self, other: object) -> bool:\n if self.__eq__(other):\n return False\n return True",
"def __ne__(self, other: object) -> bool:\n return not self.__eq__(other)",
"def __ne__(self, other) -> bool:\n return not self.__eq__(other)",
"def __eq__(self, other):\n ... | [
"0.845611",
"0.8391477",
"0.8144138",
"0.81410587",
"0.8132492",
"0.8093973",
"0.80920255",
"0.80920255",
"0.80920255",
"0.8085325",
"0.8085325",
"0.8076365",
"0.8076365",
"0.8065748",
"0.8042487",
"0.8042487",
"0.8042487",
"0.8042487",
"0.8042487",
"0.8042487",
"0.8042487",
... | 0.0 | -1 |
Creates a xarray.Dataset to store the results | def make_result_table(self, for_time):
time = [t.AsPython()
for t in cmf.timerange(cmf.AsCMFtime(self.starttime),
cmf.AsCMFtime(self.starttime + for_time),
self.dt)]
depth = self.depth
layer_template = ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def CreateDataset(all_arrays):\n dataset = Dataset()\n\n dataset._addData(all_arrays[0])\n dataset._addData(all_arrays[1])\n dataset._addData(all_arrays[3])\n dataset._addData(all_arrays[5])\n dataset._addData(all_arrays[6])\n dataset._addData(all_arrays[9])\n dataset._addData(all_arrays[8]... | [
"0.7164753",
"0.6751458",
"0.6747983",
"0.6716568",
"0.6710311",
"0.668696",
"0.66866434",
"0.66702366",
"0.6648725",
"0.6568152",
"0.6544536",
"0.6543",
"0.6507623",
"0.64941955",
"0.64941955",
"0.64941955",
"0.63923025",
"0.6376234",
"0.6313142",
"0.6302459",
"0.6289823",
... | 0.0 | -1 |
Close the sqlalchemy session opened by DB | def clean_up(self):
self.session.close() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def close_db_session(self, session):\r\n session.close()",
"def _close(self):\n if self.__session is not None:\n self._rollback()\n self.__session.close()",
"def close_session(self):\n self.session.execute(QUERY_DROP_TABLE_1)\n self.session.execute(QUERY_DROP_T... | [
"0.87992495",
"0.77118737",
"0.7641064",
"0.7379619",
"0.7297088",
"0.7287487",
"0.7246039",
"0.72336274",
"0.72331834",
"0.72331834",
"0.72331834",
"0.72331834",
"0.72331834",
"0.72331834",
"0.72201556",
"0.7164184",
"0.7153349",
"0.7087102",
"0.7061147",
"0.70595396",
"0.70... | 0.0 | -1 |
Creates a `Dataset` whose elements are generated by `generator`. | def FromGenerator(generator, output_types, column_names=None):
output_types = tuple(output_types)
return tf.data.Dataset.from_generator(generator, output_types=output_types) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def make_generator(x=None, y=None, batch_size=None, shuffle=False, test=False, num_workers=None):\n if isinstance(x, DataGenerator):\n return x\n else:\n dg = ArrayDataGenerator(x, y, batch_size=batch_size, test=test, shuffle=shuffle, num_workers=num_workers)\n return dg",
"def get_gen... | [
"0.66292864",
"0.64848524",
"0.6449001",
"0.64477146",
"0.6363773",
"0.6302747",
"0.6298054",
"0.6287639",
"0.62759185",
"0.6229109",
"0.6197006",
"0.6149349",
"0.6143628",
"0.6091507",
"0.6089021",
"0.6085192",
"0.6080453",
"0.6064802",
"0.6064738",
"0.6036252",
"0.60295475"... | 0.7466422 | 0 |
Creates a Datasetloader to trian network. We recommend using this function. | def Dataloader(dataset, batch_size, shuffle=False, drop_last=False, shuffle_buffer_size=10000):
if shuffle:
dataset = Shuffle(dataset, buffer_size=shuffle_buffer_size)
dataset = Batch(dataset, batch_size=batch_size, drop_last=drop_last)
dataset = dataset.prefetch(buffer_size=tf.data.experimental.A... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def train_dataloader(self) -> torch.utils.data.DataLoader: \n return torch.utils.data.DataLoader(self.dataset_train, **self.dl_kwargs)",
"def create_train_dataloader(configs):\n train_lidar_aug = OneOf([\n Random_Rotation(limit_angle=np.pi / 4, p=1.0),\n Random_Scaling(scaling_ran... | [
"0.6979198",
"0.6944243",
"0.6796961",
"0.67632306",
"0.675923",
"0.670563",
"0.6684407",
"0.66537285",
"0.66524976",
"0.653263",
"0.6509448",
"0.65055144",
"0.64861083",
"0.64585483",
"0.6450425",
"0.64472693",
"0.6437459",
"0.6418441",
"0.64089316",
"0.6408665",
"0.63968045... | 0.0 | -1 |
Define parameters necessary for HN(x,s) calculation. | def __init__(
self, substrate_path_map, species_substrate_index_map,
target_habitat_nesting_index_path):
# try to get the source code of __call__ so task graph will recompute
# if the function has changed
try:
self.__name__ = hashlib.sha1(inspect.getsource(
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def H(n,x):\n if(n == 0):\n hn = 1\n elif(n == 1):\n hn = 2*x\n else:\n Hnm1 = 1; Hn = 2*x\n for i in range(1,n):\n H = 2*x*Hn - 2*i*Hnm1\n Hnm1 = Hn\n Hn = H\n hn = H\n return hn",
"def hyperparams():\n H = 6\n return Munc... | [
"0.689373",
"0.6808931",
"0.6642394",
"0.6492595",
"0.62098414",
"0.6177306",
"0.61306596",
"0.60881937",
"0.60543615",
"0.6021265",
"0.5913192",
"0.5847633",
"0.5833502",
"0.5826657",
"0.58167136",
"0.58110625",
"0.5810336",
"0.5805862",
"0.5793413",
"0.57760584",
"0.5775234... | 0.0 | -1 |
Return the max of index_array[n] ns[n]. | def max_op(*substrate_index_arrays):
result = numpy.max(
numpy.stack([x.flatten() for x in substrate_index_arrays]) *
self.species_substrate_suitability_index_array, axis=0)
result = result.reshape(substrate_index_arrays[0].shape)
result[substrate_inde... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_max_index(a):\n return a.argmax()",
"def get_max_index(a):\n return a.argmax()",
"def get_max_index(a):\n return a.argmax()",
"def max(self):\n max = 0\n a = self.array_form\n for i in xrange(len(a)):\n if a[i] != i and a[i] > max:\n max = a[i]\... | [
"0.7536737",
"0.7536737",
"0.7536737",
"0.7222853",
"0.68984747",
"0.6882133",
"0.68491167",
"0.68432766",
"0.67890155",
"0.6690367",
"0.66585493",
"0.6630234",
"0.66094124",
"0.65890014",
"0.65506303",
"0.65227556",
"0.64673805",
"0.6464596",
"0.6440154",
"0.64349324",
"0.64... | 0.69903696 | 4 |
Return max(0,PYT_arraymp_array) accounting for nodata. | def __call__(self, mp_array, PYT_array):
valid_mask = mp_array != _INDEX_NODATA
result = numpy.empty_like(mp_array)
result[:] = _INDEX_NODATA
result[valid_mask] = PYT_array[valid_mask]-mp_array[valid_mask]
max_mask = valid_mask & (result < 0.0)
result[max_mask] = 0.0
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def max(self):\r\n return np.max(self.data_array)",
"def max(self):\n max = 0\n a = self.array_form\n for i in xrange(len(a)):\n if a[i] != i and a[i] > max:\n max = a[i]\n return max",
"def max(self):\n return numpy.ma.max(self.data)",
"def... | [
"0.6849335",
"0.63495964",
"0.6242755",
"0.6096446",
"0.6067045",
"0.5987064",
"0.59810203",
"0.59657395",
"0.59592104",
"0.59182197",
"0.5870758",
"0.5862292",
"0.58564186",
"0.58422303",
"0.58092546",
"0.57721967",
"0.57652277",
"0.5732274",
"0.5703836",
"0.5693491",
"0.568... | 0.6843436 | 1 |
Return the H1DS homepage. | def homepage(request):
return render_to_response('h1ds_core/homepage.html',
context_instance=RequestContext(request)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def homepage():\n\treturn render_template(\"home/a_homepage.html\", title=\"Welcome\")",
"def homepage():\n return render_template('home/index.html', \n title=\"Bem vindo!\")",
"def home_page(self) -> str:\n return self._home_page",
"def homepage():\n return render_tem... | [
"0.75569904",
"0.74664396",
"0.74547637",
"0.7371183",
"0.7328399",
"0.73131645",
"0.72865003",
"0.7273096",
"0.7273096",
"0.7261254",
"0.7233714",
"0.71789074",
"0.7157429",
"0.7149139",
"0.7139731",
"0.7135475",
"0.70633346",
"0.7048321",
"0.7032876",
"0.7028238",
"0.699833... | 0.7144123 | 14 |
Confirm that equality of two objects is correct | def test_deep_equals(obja, objb, isequal):
objatree = wo.typedtree(obja)
objbtree = wo.typedtree(objb)
match = objatree == objbtree
ok = match == isequal
if ok:
s = "pass"
else:
s = "fail"
print(f"{obja} == {objb} is {match} : {s}")
return ok | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def testEquality(self):\n pass",
"def test_eq(self):\n dummy = DummyCryptographicObject()\n self.assertTrue(dummy == dummy)",
"def test_equal_on_equal(self):\n a = objects.OpaqueObject(self.bytes_a, enums.OpaqueDataType.NONE)\n b = objects.OpaqueObject(self.bytes_a, enums.Opa... | [
"0.839556",
"0.7890221",
"0.7800411",
"0.77157",
"0.76026684",
"0.7552945",
"0.7527262",
"0.75270545",
"0.7526524",
"0.7463354",
"0.746216",
"0.7453554",
"0.7450629",
"0.7450629",
"0.7400433",
"0.738295",
"0.738295",
"0.738295",
"0.738295",
"0.738295",
"0.738295",
"0.738295... | 0.7639101 | 4 |
Fetch passsword for MongoDB This is stored in an environmental variable MONGO_PASSWORD. | def mongo_password():
mongo_pwd = os.environ.get('MONGO_PASSWORD')
if mongo_pwd is None:
raise EnvironmentError('Environmental variable MONGO_PASSWORD not set.'
' This is required for communicating with the '
'run database. To fix this probl... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_auth_password():\n password = AUTH_PASSWORD_SCRIPT.get()\n if password:\n return password\n return DEFAULT_AUTH_PASSWORD.get()",
"def get_password(self):\n return self.controller.dbfilter.db.get('passwd/user-password')",
"def password():\n passw = os.environ[\"CREODIAS_PASSWORD\"]\n ... | [
"0.68636054",
"0.67521226",
"0.6697854",
"0.6690642",
"0.6690642",
"0.66415757",
"0.65538234",
"0.6538532",
"0.6530596",
"0.64478207",
"0.6406388",
"0.6391224",
"0.63902235",
"0.63549674",
"0.63389236",
"0.63389236",
"0.63389236",
"0.629616",
"0.62766737",
"0.62465817",
"0.62... | 0.78077453 | 0 |
Serializes the metadata_relations of a metadata element into a list of dict elements Faster version than using ModelSerializers | def serialize_metadata_relation(md: Metadata) -> list:
relations = []
# Exclude harvested relations for a csw. It would be way too much without giving useful information
if md.is_catalogue_metadata:
md_relations = MetadataRelation.objects.filter(from_metadata__pk=md.pk).exclude(**API_EXCLUDE_METADAT... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def to_dict(self):\n return copy.deepcopy(self._metadata)",
"def metadata_as_json(self):\n return json.dumps(self._metadata)",
"def _dict_metadata(metadata):\n new_metadata = copy.deepcopy(metadata)\n tables = new_metadata['tables']\n if isinstance(tables, dict):\n ... | [
"0.5597735",
"0.5514984",
"0.5513945",
"0.5499598",
"0.5476142",
"0.5454592",
"0.5383933",
"0.5369606",
"0.5344086",
"0.53158903",
"0.52631223",
"0.52350616",
"0.52245986",
"0.521663",
"0.5215631",
"0.5205893",
"0.5188529",
"0.5180708",
"0.51447994",
"0.51406103",
"0.51370585... | 0.739467 | 0 |
Serializes the categories of a metadata element into a list of dict elements Faster version than using ModelSerializers | def serialize_categories(md: Metadata) -> list:
categories = []
all_cat = md.categories.all()
for cat in all_cat:
category = OrderedDict()
category["id"] = cat.id
category["type"] = cat.type
category["title_EN"] = cat.title_EN
category["description_EN"] = cat.descrip... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def catelogJSON():\n categories = session.query(Category).all()\n items = session.query(Item).all()\n catelog = []\n for i in categories:\n li = []\n for j in items:\n if j.category_id == i.id:\n temp = j.serialize\n li += [temp]\n temp = i.... | [
"0.61547667",
"0.6093083",
"0.5961428",
"0.57832956",
"0.5778641",
"0.5686849",
"0.5675704",
"0.5671396",
"0.56606966",
"0.5631689",
"0.5615325",
"0.5593196",
"0.5572063",
"0.55644137",
"0.5558667",
"0.55541766",
"0.55368745",
"0.55333644",
"0.5532627",
"0.55303705",
"0.55230... | 0.73835206 | 0 |
Serializes a metadata QuerySet into a list of dict elements Faster version than using ModelSerializers | def serialize_catalogue_metadata(md_queryset: QuerySet) -> list:
# If no queryset but a single metadata is provided, we do not add everything into a
is_single_retrieve = not isinstance(md_queryset, Iterable)
if is_single_retrieve:
ret_val = perform_catalogue_entry_serialization(md_queryset)
els... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def serialize_to_json(self, queryset):\r\n object_data = []\r\n is_queryset = False\r\n query_fields = self.get_fields()\r\n try:\r\n iter(queryset)\r\n is_queryset = True\r\n raw_data = serializers.serialize('python', queryset, fields=query_fields, use_... | [
"0.66306764",
"0.63059056",
"0.61225134",
"0.6053527",
"0.5991345",
"0.59819984",
"0.5969821",
"0.58601785",
"0.583359",
"0.5679089",
"0.56614566",
"0.5644411",
"0.55993074",
"0.5576271",
"0.5570644",
"0.5568526",
"0.55613095",
"0.5559729",
"0.55019426",
"0.5496132",
"0.54752... | 0.6735192 | 0 |
Return hash of whole block instance after converting to JSON | def compute_hash(self) -> str:
#block_dict = self.__dict__.pop('hash', None) # Remove hash field value before calculating hash
block_dict = self.__dict__.copy()
block_dict.pop('hash', None) # Remove hash field value before calculating hash
block_string = json.dumps(block_dict, sort_... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_block_dict(self) -> dict:\n return self.blocks",
"def __dict__(self):\r\n result = {}\r\n result['block_type'] = 'register'\r\n result['prev_hash'] = base64.b64encode(self.prev_hash).decode()\r\n result['timestamp'] = self.time\r\n result['user_id'] = self.user_i... | [
"0.71949506",
"0.71855867",
"0.7048604",
"0.70317364",
"0.7015457",
"0.697036",
"0.6908528",
"0.68199724",
"0.6771626",
"0.6767285",
"0.67160416",
"0.6679413",
"0.6677845",
"0.66648704",
"0.66191244",
"0.66004235",
"0.65690655",
"0.65690655",
"0.6561875",
"0.6561875",
"0.6524... | 0.69374734 | 6 |
Initialize dense layer weights | def initialize_dense(input_size, output_size):
# TODO: replace the initialization constant 0.01 in a more systematic approach
return np.random.randn(output_size, input_size) * 0.01 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def initialize_weights(self):\n weights_initializer.WeightsInitializer.initialize_layer_or_model(\n self._batch)",
"def _initialize_weights(self):\n pass",
"def init_weights(self, num_features):\n for each_label in self.valid_labels:\n self.weights[each_label] = np.zeros(num_... | [
"0.7668738",
"0.7625057",
"0.7620753",
"0.7602376",
"0.7520606",
"0.74931216",
"0.74931216",
"0.74931216",
"0.74772215",
"0.7432522",
"0.74204594",
"0.74027145",
"0.7399769",
"0.73951656",
"0.73568285",
"0.73454875",
"0.7336092",
"0.73276144",
"0.73073596",
"0.7301183",
"0.73... | 0.0 | -1 |
Returns the flask instance (not part of the service interface, since it is specific to flask). | def app(self):
return self._app | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def flask_app(self):\n return self._flask_app",
"def make_server() -> Flask:\n app: Flask = Flask(__name__)\n return app",
"def get_flask_blueprint(self):\n\n return self.__class__.get_bp()",
"def app(request):\n app = flask.Flask(__name__)\n return app",
"def init():\n ... | [
"0.76105446",
"0.6987309",
"0.6985572",
"0.6973799",
"0.68015057",
"0.67185515",
"0.65109295",
"0.6484693",
"0.6451057",
"0.621743",
"0.61990577",
"0.6184926",
"0.61752164",
"0.6164337",
"0.61635953",
"0.6127088",
"0.6113862",
"0.60867745",
"0.6068017",
"0.6052013",
"0.600961... | 0.5759507 | 42 |
Replace the old with the new in the given string count times. This goes from the back to the front! | def rreplace(string, old, new, count):
li = string.rsplit(old, count)
return new.join(li) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def rreplace(string, old, new, count):\n return string[::-1].replace(old[::-1], new[::-1], count)[::-1]",
"def regex_replace(s, old, new, count=0):\n\n return re.sub(old, new, s, count=count)",
"def repeat_string_n_times(string, count):\r\n return string * int(count)",
"def sub(self, replace, stri... | [
"0.74650604",
"0.65457153",
"0.6351178",
"0.62096477",
"0.5940715",
"0.5936419",
"0.59004676",
"0.5879526",
"0.57463443",
"0.5654889",
"0.5650648",
"0.5554184",
"0.5549118",
"0.5547601",
"0.55037034",
"0.5468701",
"0.5455043",
"0.5444446",
"0.54428685",
"0.54398036",
"0.54299... | 0.7175445 | 1 |
Return the fiscal quarter. | def get_fiscal_quarter(fiscal_reporting_period):
if fiscal_reporting_period in [1, 2, 3]:
return 1
elif fiscal_reporting_period in [4, 5, 6]:
return 2
elif fiscal_reporting_period in [7, 8, 9]:
return 3
elif fiscal_reporting_period in [10, 11, 12]:
return 4 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _quarter_number(self, dategiven):\n return RetailDate(dategiven).quarter",
"def get_quarter(self):\n\n self.quarter_nums = cal_data.calc_quarter(self.active_date[2],\n self.active_date[1])\n self.quarter = cal_data.get_quarter(self.active_... | [
"0.78892624",
"0.7741802",
"0.71683687",
"0.7093102",
"0.67626345",
"0.6756915",
"0.66672367",
"0.665667",
"0.665667",
"0.66535443",
"0.63120824",
"0.6058275",
"0.60458523",
"0.59245384",
"0.58669406",
"0.58297664",
"0.5778471",
"0.57734895",
"0.5730383",
"0.56805885",
"0.560... | 0.8191591 | 0 |
Given an array, rotate the array to the right by k steps, where k is nonnegative. | def rotate(self, nums, k):
if not nums:
return nums
if k < 0:
raise Exception("Invalid Input!")
self.swap(nums, 0, len(nums)-1)
self.swap(nums, 0, k-1)
self.swap(nums, k, len(nums)-1)
return nums | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def rotate_array(arr, k):\r\n arr[:] = (arr[len(arr)-k:])+(arr[:len(arr)-k])",
"def rotate_array(arr: list, k: int):\n\n return arr[-k::] + arr[:(len(arr) - k)]",
"def rotate(nums, k):\n nums = nums[(len(nums) - k):] + nums[:(len(nums) - k)]",
"def rotate(self, nums, k):\n n = len(nums)\n ... | [
"0.77078885",
"0.75690603",
"0.73625076",
"0.7225634",
"0.7224306",
"0.71523654",
"0.7125573",
"0.71147627",
"0.71105784",
"0.7099374",
"0.7056327",
"0.7053634",
"0.7025759",
"0.7021514",
"0.6981828",
"0.69235736",
"0.6917008",
"0.69145703",
"0.6897483",
"0.68806446",
"0.6853... | 0.65920734 | 43 |
Sets the begin_time of this FsaResultExtended. | def begin_time(self, begin_time):
if begin_time is None:
raise ValueError("Invalid value for `begin_time`, must not be `None`") # noqa: E501
self._begin_time = begin_time | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_startTime(self, startTime):\n self.startTime = mktime(startTime)",
"def start_time(self, start_time):\n\n self._start_time = start_time",
"def start_time(self, start_time):\n\n self._start_time = start_time",
"def start_time(self, start_time):\n\n self._start_time = start_... | [
"0.6503381",
"0.6263817",
"0.6263817",
"0.6263817",
"0.6263817",
"0.6263817",
"0.6202278",
"0.6202278",
"0.61945164",
"0.6120177",
"0.5983767",
"0.5969884",
"0.59455585",
"0.5798312",
"0.5797696",
"0.57750404",
"0.5767664",
"0.56468934",
"0.56414354",
"0.55777675",
"0.5572187... | 0.74866474 | 0 |
Sets the end_time of this FsaResultExtended. | def end_time(self, end_time):
if end_time is None:
raise ValueError("Invalid value for `end_time`, must not be `None`") # noqa: E501
self._end_time = end_time | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def end_time(self, end_time):\n\n self._end_time = end_time",
"def end_time(self, end_time):\n\n self._end_time = end_time",
"def end_time(self, end_time):\n\n self._end_time = end_time",
"def end_time(self, end_time):\n self._end_time = end_time",
"def end_time(self, end_time):... | [
"0.79024464",
"0.79024464",
"0.79024464",
"0.785805",
"0.785805",
"0.7352294",
"0.7309215",
"0.73061323",
"0.68073964",
"0.65779585",
"0.6552937",
"0.65228623",
"0.6517981",
"0.651364",
"0.651364",
"0.651364",
"0.6488632",
"0.64871913",
"0.6436001",
"0.6436001",
"0.6436001",
... | 0.7359777 | 5 |
Sets the id of this FsaResultExtended. | def id(self, id):
if id is None:
raise ValueError("Invalid value for `id`, must not be `None`") # noqa: E501
self._id = id | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def setID(self, idf):\n self.id = idf",
"def set_id(self, id):\n self.__id = id",
"def set_id(self, id):\n self.data['id'] = id",
"def id(self, id):\n \n self._id = id",
"def id(self, id):\n \n self._id = id",
"def id(self, id):\n \n self._id... | [
"0.67933357",
"0.66477746",
"0.6619874",
"0.66045976",
"0.66045976",
"0.66045976",
"0.66045976",
"0.66045976",
"0.658923",
"0.65842646",
"0.6550672",
"0.6534939",
"0.6534939",
"0.6534939",
"0.6534939",
"0.6534939",
"0.6534939",
"0.6534939",
"0.6534939",
"0.6534939",
"0.653493... | 0.0 | -1 |
Returns true if both objects are equal | def __eq__(self, other):
if not isinstance(other, FsaResultExtended):
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.80885184",
"0.80885184",
"0.805514",
"0.7983044",
"0.7966715",
"0.7966715",
"0.7966715",
"0.7966715",
"0.7966715",
"0.7966715",
"0.7966715",
"0.7966715",
"0.7966715",
"0.7966715",
"0.7966715",
"0.7966715",
"0.7966715",
"0.7966715",
"0.7966715",
"0.7966715",
"0.7966715",
... | 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.84560555",
"0.83913696",
"0.8143685",
"0.81403786",
"0.8131871",
"0.8093231",
"0.80915105",
"0.80915105",
"0.80915105",
"0.8084564",
"0.8084564",
"0.8075547",
"0.8075547",
"0.8065006"
] | 0.0 | -1 |
Test storing data to Amazons S3, both to metadata and data buckets. | def test_amazon_s3_store_data(self):
config = Config()
metadata_bucket = config.config.get("metadata", "bucket")
data_bucket = config.config.get("data", "bucket")
metadata_provider = amazon.S3(config, metadata_bucket).connect()
provider = amazon.S3(config, data_bucket).connect()
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_amazon_s3_store_filename(self):\n config = Config()\n metadata_bucket = config.config.get(\"metadata\", \"bucket\")\n data_bucket = config.config.get(\"data\", \"bucket\")\n metadata_provider = amazon.S3(config, metadata_bucket).connect()\n provider = amazon.S3(config, d... | [
"0.7096907",
"0.70238185",
"0.684018",
"0.6825385",
"0.6774226",
"0.6680321",
"0.6658622",
"0.6583668",
"0.6547225",
"0.6534585",
"0.6495966",
"0.6438647",
"0.6437277",
"0.64360756",
"0.64348114",
"0.6406479",
"0.6402676",
"0.6394501",
"0.63892734",
"0.6388103",
"0.63810086",... | 0.8207995 | 0 |
Test sequences in annotate | def test_sequence_annotate(self):
self.t("1,2 annotate note")
code, out, err = self.t("_get 1.annotations.1.description 2.annotations.1.description")
self.assertEqual("note note\n", out) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def annotate(m, ss_seq): # -> None:\n ...",
"def test_3():\n results = base_tests(long_anno=1)\n assert results[0][\"Consequence\"] == \"To Long Annotation\"",
"def _annotate(self, mfccs):\n if self.slices is None or self.ipa_regions is None:\n raise ValueError(\"No IPA regions. Call... | [
"0.79207575",
"0.6669019",
"0.5986355",
"0.5913893",
"0.58307904",
"0.5828959",
"0.5824974",
"0.57963955",
"0.5736531",
"0.5711248",
"0.57050824",
"0.5681006",
"0.5655896",
"0.56152993",
"0.56016886",
"0.55721396",
"0.5549409",
"0.553553",
"0.55196506",
"0.5447854",
"0.544084... | 0.7919261 | 1 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.