query stringlengths 9 9.05k | document stringlengths 10 222k | metadata dict | negatives listlengths 30 30 | negative_scores listlengths 30 30 | document_score stringlengths 4 10 | document_rank stringclasses 2
values |
|---|---|---|---|---|---|---|
Take the weather_df and returns a dataframe with the station name and numeric weather Input parameters | def clean_weather_df(weather_df):
col = weather_df.columns
drop_col = list(col[7::2])
clean_num = weather_df[weather_df['LATITUDE'].str.contains(
"LATITUDE") == False]
num_weather = clean_num.drop(drop_col, axis=1)
just_num = num_weather.drop(['NAME', 'STATION'], axis=1)
all_weatherdf = ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def station_stats(df):",
"def url_to_df(url, station_name, dictionary):\n \n path_to_data = os.path.join(et.data.get_data(url=url))\n \n dataframe = pd.read_csv(path_to_data)\n \n dataframe['Station ID'] = station_name\n \n output_dataframe = dataframe[['Station ID', 'year', 'month', 'day... | [
"0.64943063",
"0.6317849",
"0.6268697",
"0.62601906",
"0.621405",
"0.6126189",
"0.60920346",
"0.6080956",
"0.5973115",
"0.5948292",
"0.5899673",
"0.58927464",
"0.58731025",
"0.58682513",
"0.58575284",
"0.5856938",
"0.5856862",
"0.57481647",
"0.570413",
"0.5686568",
"0.5682798... | 0.63292754 | 1 |
Retrieve weather for written keys,prep two dataframes. Input parameters None. Retreives data internally. Output | def get_weather_data():
keys = ['1364038.csv',
'1364041.csv',
'1364042.csv',
'1364043.csv',
'1364044.csv',
'1364046.csv',
'1364047.csv',
'1364048.csv',
'1364051.csv',
'1364052.csv',
'1364053.csv',... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def import_weather(keys):\n # imports weather and cleans\n df_all_weather = get_weather_as_df(keys)\n return clean_weather_df(df_all_weather)",
"def get_weather(address, update = ''):\n \n def proceed_with_method():\n if update == 'forecast':\n precip_hist_dict = historic_weather... | [
"0.62621945",
"0.625129",
"0.6238696",
"0.6196839",
"0.61660135",
"0.61178386",
"0.6031832",
"0.60268205",
"0.5993915",
"0.59827983",
"0.59796125",
"0.5978958",
"0.59702134",
"0.5938743",
"0.587933",
"0.58601356",
"0.5849098",
"0.5810455",
"0.5792647",
"0.5791266",
"0.5774107... | 0.7046636 | 0 |
Validates an XML document against a schema instance. This function builds an | def validate(xml_document, schema=None, cls=None, path=None, schema_path=None,
use_defaults=True, namespaces=None, locations=None, base_url=None,
defuse='remote', timeout=300, lazy=False):
source, schema = get_context(
xml_document, schema, cls, locations, base_url, defuse, timeout... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def validate(self):\n import os\n\n if self.kind == KDM.INTEROP:\n with open(os.path.join(os.path.dirname(__file__), 'xsd', 'interop.xsd'), 'r') as f:\n schema = f.read()\n elif self.kind == KDM.SMPTE:\n with open(os.path.join(os.path.dirname(__file__), 'xs... | [
"0.72821254",
"0.718917",
"0.71431804",
"0.7091836",
"0.7014281",
"0.6909555",
"0.6883875",
"0.6824659",
"0.68070483",
"0.6800165",
"0.6686416",
"0.6628976",
"0.66033053",
"0.65844876",
"0.65131754",
"0.6499602",
"0.64913964",
"0.64175576",
"0.6344497",
"0.63355154",
"0.62918... | 0.7310048 | 0 |
Creates an iterator for the errors generated by the validation of an XML document. | def iter_errors(xml_document, schema=None, cls=None, path=None, schema_path=None,
use_defaults=True, namespaces=None, locations=None, base_url=None,
defuse='remote', timeout=300, lazy=False):
source, schema = get_context(
xml_document, schema, cls, locations, base_url, defuse... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def iter_errors(self, obj: ST,\n use_defaults: bool = True,\n namespaces: Optional[NamespacesType] = None,\n max_depth: Optional[int] = None,\n extra_validator: Optional[ExtraValidatorType] = None) \\\n -> Iterator[XMLSchemaVali... | [
"0.65945137",
"0.6228645",
"0.62281376",
"0.608026",
"0.60769504",
"0.59669846",
"0.59493446",
"0.59328353",
"0.5893584",
"0.5766017",
"0.57601035",
"0.57579696",
"0.5728756",
"0.5700199",
"0.55876803",
"0.5542821",
"0.5485655",
"0.54817843",
"0.5470813",
"0.54597706",
"0.545... | 0.7550698 | 0 |
Decodes an XML document to a Python's nested dictionary. The decoding is based on an XML Schema class instance. For default the document is validated during | def to_dict(xml_document, schema=None, cls=None, path=None, process_namespaces=True,
locations=None, base_url=None, defuse='remote', timeout=300, lazy=False, **kwargs):
source, schema = get_context(
xml_document, schema, cls, locations, base_url, defuse, timeout, lazy
)
return schema.dec... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def load(self, xml):\n\n # If the argument is a etree Element, use it as the tree root. This allows nesting of schemas\n if isinstance(xml, etree._Element):\n tree = xml\n\n # If the argument is a string, parse it using lxml.etree.fromstring()\n else:\n tree = etre... | [
"0.5854179",
"0.58091354",
"0.56237924",
"0.5511665",
"0.5475656",
"0.54162705",
"0.5331637",
"0.53209865",
"0.52236366",
"0.51572007",
"0.5124347",
"0.50794935",
"0.50342417",
"0.5022833",
"0.49436992",
"0.49308828",
"0.4928609",
"0.49279907",
"0.49251303",
"0.49134055",
"0.... | 0.72029346 | 0 |
Load a PLY file. | def load_plyfile(filename):
plydata = plyfile.PlyData.read(filename)
return plydata | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def load_source(filename):\n with open(filename, 'r') as f:\n lexer.input(f.read())\n lexer.lineno = 1\n lexer.provenance = f'file \"{filename}\"'",
"def load(self, path):\n parameters = paddle.load(path)\n self.set_dict(parameters)",
"def load(path):\n pass",
"de... | [
"0.6621814",
"0.6576751",
"0.6483502",
"0.6446349",
"0.64047724",
"0.62122035",
"0.61944896",
"0.61372703",
"0.61213183",
"0.6107111",
"0.6103134",
"0.60965335",
"0.6090405",
"0.6023209",
"0.60031086",
"0.60031086",
"0.6003008",
"0.59753203",
"0.5966112",
"0.59193975",
"0.587... | 0.74070543 | 0 |
Load vertices from PLY file and return as dict with x, y, z keys. To increase loading speed dramatically, this function creates an HDF5 cache file when loading a PLY file for the first time. When the cache exists (it has the same path as the PLY file, except for the extension, which is replaced by ".cache.ecto"), this ... | def vertex_dict_from_plyfile(filename):
path = pathlib.Path(filename)
cache_path = path.with_suffix('.cache.ecto')
if cache_path.is_file():
with h5py.File(cache_path, "r") as hdf5file:
x = hdf5file["x"]["arr"][:]
y = hdf5file["y"]["arr"][:]
z = hdf5file["z"]["arr"... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def loadallvertices(self):\n if self.filedb is None:\n return\n vertices = dict()\n line_pattern = r\"[A-Z]{3},[A-Z]{3},[\\d]+$\"\n try:\n with open(self.filedb) as f:\n for line in f:\n # Recover origin, destiny and cost\n ... | [
"0.6562875",
"0.65216416",
"0.6379117",
"0.6048109",
"0.5999355",
"0.5958443",
"0.5885186",
"0.5885186",
"0.58593446",
"0.5858746",
"0.56978995",
"0.5648773",
"0.5557919",
"0.5538228",
"0.5536446",
"0.55337846",
"0.5489507",
"0.5448725",
"0.54385227",
"0.5429585",
"0.5416992"... | 0.80517364 | 0 |
Load vertices from plyfile and return as pandas DataFrame. | def pandas_vertices_from_plyfile(filename):
xyz = vertex_dict_from_plyfile(filename)
return pd.DataFrame(xyz) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def vaex_vertices_from_plyfile(filename):\n xyz = vertex_dict_from_plyfile(filename)\n return vx.from_dict(xyz)",
"def read_ply_xyz(filename):\n assert(os.path.isfile(filename))\n with open(filename, 'rb') as f:\n plydata = PlyData.read(f)\n num_verts = plydata['vertex'].count\n ... | [
"0.7197238",
"0.7079626",
"0.6208079",
"0.6169289",
"0.61148095",
"0.6112198",
"0.6111613",
"0.60534364",
"0.5996844",
"0.59725636",
"0.59572744",
"0.58987105",
"0.58955765",
"0.5881835",
"0.583922",
"0.5792205",
"0.5782929",
"0.5780073",
"0.57574993",
"0.57506347",
"0.574752... | 0.8667049 | 0 |
Load vertices from plyfile and return as vaex DataFrame. | def vaex_vertices_from_plyfile(filename):
xyz = vertex_dict_from_plyfile(filename)
return vx.from_dict(xyz) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def pandas_vertices_from_plyfile(filename):\n xyz = vertex_dict_from_plyfile(filename)\n return pd.DataFrame(xyz)",
"def read_ply_xyz(filename):\n assert(os.path.isfile(filename))\n with open(filename, 'rb') as f:\n plydata = PlyData.read(f)\n num_verts = plydata['vertex'].count\n ... | [
"0.84510744",
"0.73632604",
"0.63794583",
"0.6267305",
"0.6175561",
"0.60458577",
"0.60157835",
"0.5988801",
"0.5944366",
"0.588248",
"0.58743864",
"0.5838957",
"0.5784811",
"0.57548094",
"0.5739832",
"0.57038474",
"0.5685003",
"0.5678256",
"0.5669674",
"0.5648989",
"0.563562... | 0.80919033 | 1 |
> (sub1 1) 0 > (sub1 11111111111111111111111111111111112) 11111111111111111111111111111111113 > (sub1 1.4) 0.3999999999999999 > (sub1 1.5) 0.5 > (sub1 1+1i) 0+1i > (sub1 1/2) 1/2 | def test_sub1(doctest):
w_x = W_Fixnum(-sys.maxint-1).arith_sub1()
assert isinstance(w_x, W_Bignum) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sub(n1, n2):\n return n1 - n2",
"def test_sub():\n z = Complex(1, -2)\n w = Complex(1, 1)\n assert (z - w) == Complex(0, -3)\n assert (z - (1+1j)) == Complex(0, -3)\n assert (z - 2) == Complex(-1, -2)\n assert (z - 2.0) == Complex(-1, -2)",
"def SUB(self, n1, n2):",
"def... | [
"0.63164145",
"0.61161476",
"0.60990065",
"0.605321",
"0.58723927",
"0.58723927",
"0.58723927",
"0.5784584",
"0.5782975",
"0.5769095",
"0.5741576",
"0.57034177",
"0.5690713",
"0.56715757",
"0.5641541",
"0.5609032",
"0.56069714",
"0.5571379",
"0.553509",
"0.5533241",
"0.553324... | 0.650106 | 0 |
> (exact>inexact 1) 1.0 > (exact>inexact 1/2) 0.5 > (exact>inexact 0.5) 0.5 > (exact>inexact 1+2i) 1.0+2.0i > (exact>inexact 102222222222222222222222222222222222222222222222123123) 1.0222222222222222e+53 | def test_exact_to_inexact(doctest): | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_inexact_prediace(doctest):",
"def u_exact(t):\n return a * t + b",
"def almost_eq(e1,e2) :\n\treturn round(e1-e2,4) == 0.0",
"def test_inexact_to_exact(doctest):",
"def test_le_1():\n a = FixedPoint(1, 'Q2.8')\n assert a < 1.1",
"def test_lt_1():\n a = FixedPoint(1, 'Q2.8')\n ... | [
"0.6380264",
"0.61588365",
"0.6138461",
"0.61297613",
"0.5908166",
"0.58085465",
"0.57954437",
"0.57187057",
"0.57136405",
"0.5682127",
"0.567197",
"0.566006",
"0.56335366",
"0.5601193",
"0.56009555",
"0.56009555",
"0.5597991",
"0.5588879",
"0.5588747",
"0.5565807",
"0.552967... | 0.63425225 | 1 |
! (require '%flfxnum '%unsafe) > (unsafefl+ 1.0 2.0) 3.0 > (unsafefl 2.0 1.0) 1.0 > (unsafefl 2.0 0.5) 1.0 > (unsafefl/ 2.0 0.5) 4.0 > (unsafeflmin 3.0 5.4) 3.0 > (unsafeflmax 3.0 5.4) 5.4 | def test_flonum_unsafe(doctest): | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_fixnum_unsafe(doctest):",
"def install_N_():\n\n import __builtin__\n\n __builtin__.N_ = lambda s: s",
"def test_fixnum_special(doctest):",
"def test_spidermonkey_warning():\n # The following is attempting to store the octal \"999999999999\" in x, but\n # this is an invalid octal obvious... | [
"0.6193654",
"0.5356504",
"0.5192745",
"0.51889336",
"0.5102665",
"0.4882313",
"0.48294187",
"0.48263472",
"0.48239887",
"0.48138288",
"0.47466013",
"0.47216377",
"0.46795782",
"0.46394727",
"0.46227637",
"0.4621179",
"0.46082172",
"0.4599316",
"0.4594113",
"0.45876083",
"0.4... | 0.61471367 | 1 |
! (require '%flfxnum '%unsafe) > (unsafefx+ 10 20) 30 > (unsafefx 20 10) 10 > (unsafefx 20 5) 100 > (unsafefxmin 10 20) 10 > (unsafefxmin 20 10) 10 > (unsafefxmax 10 20) 20 > (unsafefxmax 20 10) 20 > (unsafefxmodulo 100 30) 20 > (unsafefxmodulo 100 30) 20 > (unsafefx 2 1) 1 > (unsafefx 2 5) 10 > (unsafefxmin 1 2) 1 > (... | def test_fixnum_unsafe(doctest): | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def example_ten():\n x = list(range(10**6))\n i = bisect_left(x, 991234)",
"def pe2(limit=4000000):\n a, b, s = 1, 2, 2\n while b <= limit:\n a, b = b, a + b\n if not b & 1:\n s += b\n return s",
"def _cutoff32(value):\n return value % 0x100000000",
"def solveProble... | [
"0.5710434",
"0.56326926",
"0.5514432",
"0.55042744",
"0.5485843",
"0.5473196",
"0.54713386",
"0.54608226",
"0.545103",
"0.54507494",
"0.5435761",
"0.54058605",
"0.54058605",
"0.53963244",
"0.5376808",
"0.5347544",
"0.5317957",
"0.5304127",
"0.529716",
"0.52925557",
"0.528324... | 0.5653409 | 1 |
! (require racket/flonum) > (flceiling 2.5) 3.0 > (flceiling 2.5) 2.0 | def test_flceiling(doctest): | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_ceiling(doctest):",
"def test_flfloor(doctest):",
"def __floor__(self, ???):",
"def __init__(self):\n BuiltinFunction.__init__(self, \"ceil\",\n conversions=dict(maxima='ceiling',\n sympy='ceiling'))",
"def... | [
"0.6180841",
"0.6116166",
"0.5553814",
"0.54663086",
"0.5450169",
"0.54192716",
"0.5378596",
"0.5373187",
"0.5312131",
"0.528041",
"0.5276072",
"0.5276072",
"0.5276072",
"0.5276072",
"0.5276072",
"0.5276072",
"0.5276072",
"0.5276072",
"0.5276072",
"0.5276072",
"0.5276072",
... | 0.64431214 | 0 |
! (require racket/flonum) > (flfloor 2.5) 2.0 > (flfloor 2.5) 3.0 | def test_flfloor(doctest): | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def ifloor(f: SupportsFloat) -> int:\n\t\t# noinspection PyTypeChecker\n\t\treturn int(np.floor(f))",
"def floor(x):\r\n # see decorator for function body\r",
"def floor(x):\n return 0.0",
"def test_flceiling(doctest):",
"def test_floor(doctest):",
"def def_mpf_constant(fixed):\n def f(prec, rnd... | [
"0.6094957",
"0.6085185",
"0.58095694",
"0.5765076",
"0.5732744",
"0.5660084",
"0.5606469",
"0.5454927",
"0.54418606",
"0.54019386",
"0.53928703",
"0.53492564",
"0.53274024",
"0.53134686",
"0.53130627",
"0.53130627",
"0.53130627",
"0.53130627",
"0.53130627",
"0.53130627",
"0.... | 0.7762754 | 0 |
! (require racket/flonum) > (fltruncate 2.5) 2.0 > (fltruncate 2.5) 2.0 > (fltruncate +inf.0) +inf.0 | def test_fltruncate(doctest): | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def trunc(x):\n return 0",
"def trunc(data):\n return _make.trunc(data)",
"def truncate(s):\n truncate = whenFloating $ \\c e ->\n if dangerouslySmall c e\n then 0\n else fromInteger $ c `quotInteger` magnitude (-e)",
"def __trunc__(self, ???):",
... | [
"0.6891578",
"0.67059904",
"0.65174705",
"0.65155673",
"0.650897",
"0.6454256",
"0.6434144",
"0.64217186",
"0.61807334",
"0.60763943",
"0.60398847",
"0.6005054",
"0.5927545",
"0.5905438",
"0.5862055",
"0.57917064",
"0.5771346",
"0.5762463",
"0.5738256",
"0.5734238",
"0.569669... | 0.74525243 | 0 |
> (rational? 1) t > (rational? +inf.0) f > (rational? "hello") f > (rational? 7/3) t > (rational? 13647861237849612903845789012745781623478613289571907344901263) t | def test_rational_predicate(doctest): | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def rational_frac_tests():\n print('\\n==========================================')\n print('rfrac.py @ rational_frac_tests: //////////\\n')\n print(RationalFrac(-1), RationalFrac(0))\n # __prime_factors()\n frac0 = RationalFrac(4.5)\n frac1 = RationalFrac(-0.125)\n frac2 = RationalFrac(0.9999... | [
"0.6784243",
"0.6648297",
"0.64456624",
"0.6416477",
"0.62569875",
"0.60745555",
"0.60259306",
"0.5970766",
"0.58682173",
"0.58424383",
"0.5784617",
"0.57590175",
"0.5710712",
"0.5709708",
"0.57082677",
"0.57038885",
"0.56855655",
"0.5633985",
"0.5622209",
"0.5607985",
"0.559... | 0.7162609 | 0 |
Find all simple cycles in a graph | def simple_cycles(g: Graph) -> List[List[Branch]]:
# Make copy because the graph gets altered during the algorithm
graph_copy = g.copy()
branch_map = {}
copy_result = list()
# Create map to allow returning original branches
for branch in g.branches:
branch_map[branch.id] = branch
#... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def find_all_cycles(s,graph):\n\n grph = u.edge_to_list_dict(graph)\n node_cnt = len(grph)\n k = z.Int(\"k\")\n syms = [z.Int('node%s'%i) for i in range(node_cnt)]\n\n # s.add(syms[0] == 0) # start node is a 0\n s.add(k < node_cnt)\n s.add(k > 1)\n\n o = z.Optimize()\n\n #... | [
"0.78507674",
"0.74452114",
"0.70848405",
"0.70129675",
"0.69033825",
"0.67549735",
"0.67269826",
"0.67196727",
"0.66163373",
"0.6600396",
"0.6543087",
"0.65245026",
"0.64197814",
"0.6418425",
"0.63913023",
"0.6387601",
"0.63739425",
"0.6307837",
"0.6288959",
"0.62879014",
"0... | 0.7579529 | 1 |
Note that `channel` must be the same pika channel instance via which the message being ACKed was retrieved (AMQP protocol constraint). | def ack_message(channel, delivery_tag):
global logger
if channel.is_open:
channel.basic_ack(delivery_tag)
logger.debug("Channel is acked!")
else:
# Channel is already closed, so we can't ACK this message;
# log and/or do something that makes sense for your app in this case.
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def acknowledge_message(self, channel, delivery_tag):\n logger.info('Acknowledging message %s', delivery_tag)\n channel.basic_ack(delivery_tag)",
"def acknowledgement(self, message: Message[ValueType]):",
"def acknowledge(self, message: Message[ValueType]) -> Message[ValueType]:",
"def get_msg(... | [
"0.64406365",
"0.6272624",
"0.6254079",
"0.59941304",
"0.58116174",
"0.5726528",
"0.56323904",
"0.55881184",
"0.55846435",
"0.5554266",
"0.54920876",
"0.5490809",
"0.542975",
"0.54154646",
"0.54040796",
"0.53981715",
"0.5382634",
"0.5352141",
"0.5350141",
"0.5345407",
"0.5329... | 0.70551664 | 0 |
Test the Interrogate flow. | def testInterrogate(self):
flow_name = "Interrogate"
with test_lib.Stubber(flow.GRRFlow, "SendReply", self.MockSendReply):
# Run the flow in the simulated way
for _ in test_lib.TestFlowHelper(flow_name, InterrogatedClient(),
token=self.token,
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_handle(self):\n with pytest.raises(NotImplementedError):\n self.behaviour.act()",
"def _test(self):\n pass",
"def _test(self):\n pass",
"def _test(self):\n pass",
"def testing(self):\n print('test successful')",
"def test_get_run(self):\n pass... | [
"0.63244754",
"0.62555957",
"0.62555957",
"0.62555957",
"0.6252443",
"0.6157891",
"0.61134434",
"0.6089899",
"0.60834277",
"0.60353076",
"0.60253406",
"0.6024636",
"0.6020408",
"0.6019066",
"0.6013192",
"0.601198",
"0.600709",
"0.6003489",
"0.6001394",
"0.5998351",
"0.597625"... | 0.6306134 | 1 |
opcodes + registers. Checks if the `arg` is a keyword. | def iskeyword(self, arg: str):
if arg.upper() in self._keywords:
return True
return False | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def func(input, keyword=None):\r\n pass",
"def run_keyword(name, *args):\n BuiltIn().run_keyword(name, *args)",
"def this_is_a_keyword(arg1):\r\n print(arg1)\r\n return 'Whatever'",
"def process_arg(arg):\n return False",
"def UsesArgument(func, argnr):\n argname = func.__code__.co_varnam... | [
"0.63227534",
"0.6266325",
"0.61915255",
"0.5615778",
"0.56087416",
"0.54038626",
"0.53846157",
"0.53418374",
"0.52948177",
"0.5270503",
"0.52183044",
"0.51543736",
"0.5144137",
"0.5143743",
"0.5123514",
"0.50824267",
"0.50451785",
"0.50425905",
"0.5031",
"0.5018023",
"0.5009... | 0.6713264 | 0 |
Returns the register from `addr` | def _get_register(self, addr: str):
addr = addr.upper()
_register = self._registers_list.get(addr, None)
if _register:
return _register
raise SyntaxError(msg="next link not found; check the instruction") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _getReg(address):\n return struct.unpack(\"<L\", mem[address:address+4])[0]",
"def readREG_byte( addr):\n\treturn bus.read_byte_data( DEVICE_ADDRESS, addr )",
"def read_register(self, address):\n\n return self.register[address]",
"def _parse_addr(self, addr: str):\n addr = addr.upper()\n... | [
"0.74102914",
"0.71406376",
"0.7103341",
"0.69185746",
"0.67063063",
"0.6661927",
"0.6335207",
"0.6268558",
"0.62317944",
"0.6210637",
"0.6075053",
"0.5962305",
"0.5932137",
"0.59120995",
"0.59016246",
"0.57828265",
"0.5752089",
"0.5752045",
"0.56154996",
"0.5613452",
"0.5609... | 0.7519734 | 0 |
opcode fetch Fetches the hex code of an instruction from `opcode` | def _opcode_fetch(self, opcode: str, *args, **kwargs) -> None:
_args_params = [x for x in args if self.iskeyword(x)]
_args_hexs = [decompose_byte(tohex(x)) for x in args if ishex(x)]
_opcode_search_params = " ".join([opcode, *_args_params]).upper()
_opcode_hex = self._lookup_opcodes_dir.... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_opcode(self, code):\r\n opcode = int(str(code)[-2:])\r\n return opcode",
"def read_byte(self, opcode: int) -> int:\n\n # 0xff = 255\n\n return opcode & 0xFF",
"def fetch_instruction(self) -> dict:\n instruction = self.__ROM.read(self.regs[\"ip\"].read())\n self... | [
"0.6188017",
"0.5964656",
"0.5931929",
"0.5867376",
"0.5842648",
"0.5692336",
"0.56319845",
"0.56124514",
"0.5602991",
"0.55496913",
"0.5336672",
"0.5316029",
"0.5192877",
"0.51912916",
"0.5115001",
"0.5048067",
"0.5041225",
"0.48393863",
"0.48243648",
"0.47319537",
"0.469726... | 0.6904691 | 0 |
Method to prepare the upcoming instruction, i.e. opcode fetch, assembler output etc. | def prepare_operation(self, command: str, opcode: str, *args, **kwargs) -> bool:
_opcode_hex, _args_hex = self._opcode_fetch(opcode, *args)
self.super_memory.PC.write(_opcode_hex)
_assembler = [_opcode_hex]
for x in _args_hex:
for y in x[::-1]:
self.super_memo... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def compileInstruction(self, ins):\n pass",
"def handle_instruction(self, msg):\n assert isinstance(msg, pb.Instruction)\n logging.info(\"NODE: handling instruction - {}\".format(msg).replace('\\n', ','))\n self.config.from_instruction = True\n\n call_later(msg.delay, self.tc_r... | [
"0.5819239",
"0.5730217",
"0.5627368",
"0.562327",
"0.5603512",
"0.55455965",
"0.55300134",
"0.5526716",
"0.55007833",
"0.54850966",
"0.54205954",
"0.5392538",
"0.53790957",
"0.5354042",
"0.53317094",
"0.53161323",
"0.52962804",
"0.52901727",
"0.52779526",
"0.52770406",
"0.52... | 0.6025537 | 0 |
Returns the contents of memory location pointed by `addr`. | def memory_read(self, addr: str) -> Byte:
print(f"memory read {addr}")
_parsed_addr = self._parse_addr(addr)
if _parsed_addr:
return _parsed_addr.read(addr)
data = self.memory.read(addr)
return data | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def read(self, addr, index=None):\n\n addr_idx = self.index_addr(addr, index)\n value = self.mem.read(addr_idx)\n\n return value",
"def get_address_value(cls, addr):\n\t\tprint \" Called get_address_value({})\".format(addr)\n\t\ttype = abs(addr) // 1000 # integer division\n\t\trelative_addr... | [
"0.6570045",
"0.6555623",
"0.6411876",
"0.63828987",
"0.62359416",
"0.61978424",
"0.61914027",
"0.6157194",
"0.6058711",
"0.6058711",
"0.6019673",
"0.59167546",
"0.5831898",
"0.5831898",
"0.57772386",
"0.574528",
"0.57056254",
"0.5657386",
"0.56354696",
"0.56002843",
"0.55125... | 0.68927795 | 0 |
Writes the `data` at the memory location pointed by `addr` | def memory_write(self, addr: str, data) -> bool:
addr = str(addr)
print(f"memory write {addr}|{data}")
_parsed_addr = self._parse_addr(addr)
if _parsed_addr:
return _parsed_addr.write(data, addr)
self.memory.write(addr, data)
return True | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def write_block_data(self, addr, reg, data):\n raise NotImplementedError()",
"def write_byte(self, addr, data):\n raise NotImplementedError()",
"def write(self, addr, data, control):\n if not self._is_u32(addr):\n raise ValueError('The addr parameter must be an unsigned 32-bit v... | [
"0.6937246",
"0.69350517",
"0.69095874",
"0.67334324",
"0.66806304",
"0.6635651",
"0.66282445",
"0.6501015",
"0.6463658",
"0.6463658",
"0.64097583",
"0.6409628",
"0.6295188",
"0.6252589",
"0.61846143",
"0.61398613",
"0.6126138",
"0.6126138",
"0.6095817",
"0.5979808",
"0.59687... | 0.71273893 | 0 |
Method to read and return the data of the register pair pointed by `addr` | def register_pair_read(self, addr) -> Byte:
print(f"register pair read {addr}")
_register = self._get_register(addr)
data = _register.read_pair()
# self._write_opcode(data)
return data | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_data(self, addr):\n\t\tret_val = None\n\t\tif addr < 0:\n\t\t\tprint(\"FAIL - negative address\")\n\t\tif addr >= len(self.data):\n\t\t\ttry:\n\t\t\t\tret_val = self.regs[ addr ]\n\t\t\texcept:\n\t\t\t\tret_val = 0\n\t\telse:\n\t\t\tret_val = self.data[ addr ]\n\n\t\treturn ret_val",
"def read_register(s... | [
"0.7810009",
"0.7275747",
"0.70863676",
"0.6955075",
"0.6929632",
"0.68649",
"0.680708",
"0.6660876",
"0.6565061",
"0.6513682",
"0.6464846",
"0.6462695",
"0.6416825",
"0.62562",
"0.62405956",
"0.6140814",
"0.6089457",
"0.6086728",
"0.60492694",
"0.6043605",
"0.60391027",
"0... | 0.7661122 | 1 |
Handle Items deselection and trigger event `Items Deselected` Call each callback in `items_deselected_listeners` and store a new history stamp | def onItemsDeselected(self, silent: bool = False):
try:
current_selected_items = self.getSelectedItems()
if current_selected_items == self._last_selected_items:
return
# TODO monitor usage of this function, may be call more than once
self.resetLas... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def addItemsDeselectedListener(self, callback: 'callable'):\n self._items_deselected_listeners.append(callback)",
"def onItemSelected(self, silent: bool = False):\n # if silent selection is True, ignore the event\n if self._silent_selection_events:\n return\n\n # Detect cha... | [
"0.715858",
"0.5882167",
"0.5864435",
"0.5815277",
"0.5800642",
"0.5764711",
"0.5699734",
"0.56143653",
"0.55654794",
"0.55569565",
"0.5551007",
"0.55418116",
"0.55223393",
"0.55121684",
"0.55031186",
"0.54963636",
"0.54109526",
"0.53590965",
"0.533903",
"0.5323001",
"0.53142... | 0.784819 | 0 |
Register `callback` to `Has Been Modified` event | def addHasBeenModifiedListener(self, callback: 'callable'):
self._has_been_modified_listeners.append(callback) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_modified_callback(self, modified_callback):\n self.modified_callback = modified_callback",
"def set_modified_callback(self, callback):\n slw = super(CheckBoxListWalker, self)\n urwid.connect_signal(slw, 'modified', callback)\n return",
"def add_change_callback(self, callback... | [
"0.76073563",
"0.6915502",
"0.6815548",
"0.6611758",
"0.64308393",
"0.6395239",
"0.6395239",
"0.6341299",
"0.63348705",
"0.6313795",
"0.6290722",
"0.6210409",
"0.6202026",
"0.62005883",
"0.6170355",
"0.6125656",
"0.6091459",
"0.60561305",
"0.60443324",
"0.6034484",
"0.6003922... | 0.8029991 | 0 |
Register `callback` to `Item Selected` event | def addItemSelectedListener(self, callback: 'callable'):
self._item_selected_listeners.append(callback) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def onSelected(self):\n pass",
"def on_selected_new_item(self, item):\n pass",
"def __init__(self, callback):\r\n self.callback = callback\r\n self.selected = False",
"def addItemsDeselectedListener(self, callback: 'callable'):\n self._items_deselected_listeners.append(call... | [
"0.74830544",
"0.7206682",
"0.65960443",
"0.629474",
"0.6282777",
"0.6229242",
"0.6177195",
"0.6114044",
"0.6001839",
"0.59780097",
"0.59424186",
"0.592199",
"0.5911459",
"0.58842665",
"0.58607274",
"0.58559954",
"0.5835282",
"0.58032197",
"0.5770527",
"0.5763029",
"0.5760007... | 0.783389 | 0 |
Register `callback` to `Items Deselected` event | def addItemsDeselectedListener(self, callback: 'callable'):
self._items_deselected_listeners.append(callback) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def onItemsDeselected(self, silent: bool = False):\n try:\n current_selected_items = self.getSelectedItems()\n if current_selected_items == self._last_selected_items:\n return\n\n # TODO monitor usage of this function, may be call more than once\n s... | [
"0.7072436",
"0.6625081",
"0.6555107",
"0.6555107",
"0.6282118",
"0.5912221",
"0.5908873",
"0.5859858",
"0.5848628",
"0.58395785",
"0.5802043",
"0.57907784",
"0.5779993",
"0.5763108",
"0.5749542",
"0.57416254",
"0.57236415",
"0.5723615",
"0.57224953",
"0.571479",
"0.57145846"... | 0.85139054 | 0 |
Register `callback` to `Drag Enter` event | def addDragEnterListener(self, callback: 'callable'):
self.getView().addDragEnterListener(callback) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def enter_notify_event(self, widget, event):\n enter_focus = self.t_.get('enter_focus', False)\n if enter_focus:\n # set focus on widget\n pass\n return self.make_callback('enter')",
"def dragEnterEvent(self, e):\n # TODO: Do it properly.\n # TODO: Redraw ... | [
"0.7131148",
"0.6930939",
"0.67850393",
"0.6747207",
"0.646453",
"0.63263386",
"0.6168104",
"0.6134008",
"0.6123509",
"0.61054265",
"0.59283495",
"0.58997786",
"0.58778363",
"0.58587426",
"0.5825897",
"0.57303315",
"0.56985587",
"0.56985587",
"0.56480694",
"0.5639754",
"0.563... | 0.75144684 | 0 |
Register `callback` to `Drop` event | def addDropListener(self, callback: 'callable'):
self.getView().addDropListener(callback) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def drop_event(self, widget, event):\n # make a call back with a list of URLs that were dropped\n #self.logger.debug(\"dropped filename(s): %s\" % (str(paths)))\n #self.make_ui_callback('drag-drop', paths)\n raise NotImplementedError",
"def on_drop(self):\n print(\"You have dro... | [
"0.74034536",
"0.6766096",
"0.646628",
"0.6448156",
"0.6177318",
"0.6154016",
"0.60600996",
"0.6026161",
"0.5953534",
"0.5910036",
"0.583305",
"0.5640529",
"0.5630467",
"0.55396706",
"0.5532099",
"0.54424274",
"0.544116",
"0.5429553",
"0.5429553",
"0.5398703",
"0.5338513",
... | 0.8091536 | 0 |
Returns the class representing the Edge. Override if needed Returns Type[Edge] | def getEdgeClass(self) -> Type[Edge]:
return Edge | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __repr__(self):\n return f\"EdgeType.{self.name}\"",
"def edge(cls, edge):\n return cls(Lnk.EDGE, int(edge))",
"def edge_types(self) -> List[EdgeType]:\n return list(self._edge_store_dict.keys())",
"def edge(self) -> EdgeConfig:\n return self._edge",
"def E(self, edge_type, ... | [
"0.69667274",
"0.63873905",
"0.6312679",
"0.6288949",
"0.6173397",
"0.5997334",
"0.5914608",
"0.5758434",
"0.5737543",
"0.56359076",
"0.56304675",
"0.56136644",
"0.5600077",
"0.55952835",
"0.55952835",
"0.5592612",
"0.5577853",
"0.5570068",
"0.55699664",
"0.55614847",
"0.5558... | 0.9205564 | 0 |
When the function self.node_class_selector is set, we can use different Node classes | def setNodeClassSelector(self, class_selecting_function: callable):
self.node_class_selector = class_selecting_function | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def node_selector(self, node_selector: Dict[str, str]):\n\n self._node_selector = node_selector",
"def getNodeClassFromData(self, data: OrderedDict):\n return Node if self.node_class_selector is None else self.node_class_selector(data)",
"def __init__(self, node_class=Node, edge_class=Edge):\n ... | [
"0.67419666",
"0.6661993",
"0.62911785",
"0.6190321",
"0.60168195",
"0.6001381",
"0.59519595",
"0.5862142",
"0.58119506",
"0.5756025",
"0.57396466",
"0.57396466",
"0.57396466",
"0.57396466",
"0.57396466",
"0.57396466",
"0.57396466",
"0.57396466",
"0.57396466",
"0.57396466",
"... | 0.75932586 | 0 |
Return corresponding Node class from data. | def getNodeClassFromData(self, data: OrderedDict):
return Node if self.node_class_selector is None else self.node_class_selector(data) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_node(self):\n split_data = self._data.split(',',1)\n if len(split_data) == 1:\n return self.node_class(split_data[0])\n else:\n return self.node_class(split_data[0], Parser(split_data[1],\n self.node_class))",
"def _to_node(self, data):\n r... | [
"0.7123047",
"0.6497989",
"0.6464411",
"0.6370129",
"0.63173854",
"0.630167",
"0.62856746",
"0.62843543",
"0.6283823",
"0.6280483",
"0.6257206",
"0.61838216",
"0.6130464",
"0.6090139",
"0.6087587",
"0.60795814",
"0.6051329",
"0.6007779",
"0.5979347",
"0.5955102",
"0.59264773"... | 0.87743944 | 0 |
Returns current NodeGraphicsView instance. Returns NodeGraphicsView | def getView(self) -> 'NodeGraphicsView':
return self.grScene.views()[0] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def graphicsItem(self):\n if self._graphicsItem is None:\n self._graphicsItem = LayerNodeGraphicsItem(self)\n return self._graphicsItem",
"def node(self):\n return Node(self)",
"def view(self):\n return self._view_class(self)",
"def View(self):\n return self._vie... | [
"0.65113175",
"0.5761256",
"0.5724514",
"0.5651946",
"0.5542698",
"0.554057",
"0.5528475",
"0.55219746",
"0.55018574",
"0.5440726",
"0.5386133",
"0.5385987",
"0.5375258",
"0.53598917",
"0.53235984",
"0.52993315",
"0.5290957",
"0.5271756",
"0.52637786",
"0.52583975",
"0.525839... | 0.8466191 | 0 |
Returns the QGraphicsItem at position in the current graphics view | def getItemAt(self, pos: Union[QPoint, QPointF]) -> 'QGraphicsItem':
if isinstance(pos, QPointF):
pos = QPoint(pos.x(), pos.y())
return self.getView().itemAt(pos) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getItemAtClick(self, event):\n pos = event.pos()\n obj = self.itemAt(pos)\n return obj",
"def getItemAtClick(self, event):\n pos = event.pos()\n obj = self.itemAt(pos)\n return obj",
"def pos(self):\n return Point(self.currentItem.mapFromScene(self._scenePos... | [
"0.6820099",
"0.6820099",
"0.63604426",
"0.63604426",
"0.63604426",
"0.6219268",
"0.6179353",
"0.60181355",
"0.59481406",
"0.5877858",
"0.5876254",
"0.5874284",
"0.58510846",
"0.5842215",
"0.57888067",
"0.57836163",
"0.57836163",
"0.5732763",
"0.5732763",
"0.5723859",
"0.5714... | 0.7488466 | 0 |
Converts a turkish text from uppercase to lowercase | def tr_upper_to_lower(text):
out = []
for ch in text:
if ch in tr_upper_to_lower_dict:
out.append(tr_upper_to_lower_dict[ch])
else:
out.append(ch.lower())
return "".join(out) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def LCase(text):\n return text.lower()",
"def normalize_case(text):\n text = str(text)\n return text.lower()",
"def toLowerCase(self) -> None:\n self.text = self.text.lower()",
"def LOWER(text):\n return text.lower()",
"def to_lower(self, text):\n return text.lower()",
"def lower(... | [
"0.7528299",
"0.7351002",
"0.73361063",
"0.7315024",
"0.7306285",
"0.72254044",
"0.7197993",
"0.7032057",
"0.69283414",
"0.6910168",
"0.69022477",
"0.68720585",
"0.6856971",
"0.68008673",
"0.6776845",
"0.67689604",
"0.6744032",
"0.6560823",
"0.655094",
"0.6513768",
"0.6511833... | 0.77457714 | 0 |
Import securities transactions from OFX/XML/CSV datafile; persist to DB. | def import_transactions(args: argparse.Namespace) -> Sequence[models.Transaction]:
engine = create_engine()
output: list = []
EXTMAP = {"ofx": ofx.read, "qfx": ofx.read, "xml": flex.read, "csv": CSV.read}
with sessionmanager(bind=engine) as session:
for path in args.file:
# Dispatch... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_from_csv(self, file_path):\n securities = []\n\n with open(file_path, \"r\") as f:\n # skip the first line (=column names)\n next(f)\n\n for line in f:\n security_code, num_shares = line.strip(\"\\n\").split(\",\")\n # omit the... | [
"0.57314825",
"0.56849045",
"0.56194824",
"0.5504415",
"0.55042666",
"0.548409",
"0.5430128",
"0.5427457",
"0.5426252",
"0.54128426",
"0.54050434",
"0.540121",
"0.5381555",
"0.5338282",
"0.5322756",
"0.53020173",
"0.53004",
"0.5272485",
"0.5258901",
"0.52493286",
"0.5227675",... | 0.57197523 | 1 |
Book DB transactions matching CLI args to inventory; write Gains to disk. | def dump_gains(args: argparse.Namespace) -> None:
engine = create_engine()
dump_csv(
engine,
dtstart=args.dtstart,
dtend=args.dtend,
dtstart_gains=args.begin,
consolidate=args.consolidate,
lotloadfile=args.loadcsv,
gaindumpfile=args.file,
) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def main():\n dump(inventory(), fp=stdout, indent=4)",
"def main():\n\n # Local constants\n\n # Local variables\n args = sys.argv\n db = dblayer()\n g = graphutil()\n\n #****** start main() ******#\n \n # Check to see if too many args, or need help\n if len(args) < 2 or args[1] == \... | [
"0.5576415",
"0.55608636",
"0.547326",
"0.54339856",
"0.5421967",
"0.5414153",
"0.5369122",
"0.5327051",
"0.51939166",
"0.5190003",
"0.51846415",
"0.51770884",
"0.5095832",
"0.50882393",
"0.5086753",
"0.5070294",
"0.50603354",
"0.5052992",
"0.5031061",
"0.5026271",
"0.5021792... | 0.5756223 | 0 |
Prints debug message if verbosity is given | def debug(self, msg=""):
if self.verbose:
print("Debug: " + msg) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def debug(message: str) -> None:\n if is_verbose():\n print(message)\n else:\n sys.stdout.write(\".\")\n sys.stdout.flush()",
"def ext_debug(self, message):\n for_verbosity = 4\n if self.verbosity_level >= for_verbosity:\n self.logger.debug(message)",
"def __... | [
"0.7611738",
"0.75555646",
"0.75134826",
"0.7447645",
"0.74443406",
"0.743769",
"0.74119735",
"0.73605067",
"0.7323943",
"0.7283614",
"0.7250042",
"0.7236865",
"0.71943885",
"0.71555024",
"0.7141242",
"0.7112227",
"0.71070856",
"0.708293",
"0.70452696",
"0.7045171",
"0.704372... | 0.78713787 | 0 |
This function is to update the db with listener stats | def update_stats(self, health_message):
session = db_api.get_session()
amphora_id = health_message['id']
listeners = health_message['listeners']
for listener_id, listener in listeners.items():
stats = listener.get('stats')
stats = {'bytes_in': stats['rx'], 'byte... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update_stats():\n list_db = get_list_database()\n\n list_db.group_stats_force_update()\n transaction_commit(None, 'GroupStatsUpdate')\n\n list_db.user_stats_force_update()\n transaction_commit(None, 'UserStatsUpdate')",
"async def update_stats(self):\r\n\r\n\t\twhile True:\r\n\t\t\tlogging.inf... | [
"0.6679615",
"0.64400375",
"0.63026994",
"0.6270449",
"0.62358385",
"0.6199205",
"0.6033849",
"0.6000455",
"0.5929362",
"0.5917533",
"0.59089243",
"0.59089243",
"0.59047884",
"0.58606374",
"0.5841999",
"0.57677644",
"0.5690433",
"0.5681239",
"0.56774247",
"0.5655227",
"0.5647... | 0.69017535 | 0 |
Creation of argument parser for the Seq2VAR experiments | def argument_parser_seq2var():
parser = argparse.ArgumentParser()
parser.add_argument('--encoder-hidden', type=int, default=64, help='Number of hidden units.')
parser.add_argument('--epochs', type=int, default=2000, help='Number of epochs to train.')
parser.add_argument('--lr', action='store_true', def... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def setup_args():\n parser = ParlaiParser()\n parser.add_argument(\n '-n',\n '--num-episodes',\n default=-1,\n type=int,\n help='Total number of episodes to convert, -1 to convert all examples',\n )\n parser.add_argument(\n '-of',\n '--outfile',\n ... | [
"0.6938465",
"0.6919866",
"0.6897542",
"0.68405354",
"0.6777029",
"0.6741335",
"0.6723699",
"0.67178744",
"0.6689901",
"0.66441715",
"0.66422004",
"0.66412914",
"0.6636828",
"0.6636687",
"0.66294044",
"0.66255265",
"0.66222453",
"0.6601116",
"0.65829134",
"0.6547027",
"0.6534... | 0.7822685 | 0 |
Bind input ports to external output ports or source data. Positional arguments map to input ports numbered as '0', '1', etc. Keyword arguments set inputs by name. Argument values can either | def set_input(self, *arg, **kw):
# Convert arguments into keyword arguments
for i, a in enumerate(arg):
kw[str(i)] = a
for name, value in six.iteritems(kw):
if name not in self._inputs:
raise ValueError("Invalid port name '{0}'".format(name))
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def modify_ports(self, ports, **kwargs):\n pass",
"def __init__(self, *arg, **kw):\n #: Input connection mapping\n self._inputs = {}\n for name, port in six.iteritems(self.input_ports):\n self._inputs[name] = port(self, name=name)\n\n #: Output connection mapping\n ... | [
"0.65591216",
"0.62802726",
"0.6155446",
"0.6079365",
"0.60514534",
"0.5908299",
"0.589971",
"0.58949035",
"0.58860606",
"0.58305275",
"0.58104044",
"0.571254",
"0.56847984",
"0.56562734",
"0.5622147",
"0.5540028",
"0.55354255",
"0.5529397",
"0.55176777",
"0.54293704",
"0.540... | 0.7338786 | 0 |
Return the task attached to the given input port. | def get_input_task(self, name='0'):
port = self.get_input(name).other
if port is None:
return None
return port.task | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_output_task(self, name='0'):\n port = self.get_output(name).other\n if port is None:\n return None\n return port.task",
"def task(self) -> Optional[pulumi.Input[int]]:\n return pulumi.get(self, \"task\")",
"def get_task_input(self, task, input_id):\n return... | [
"0.73200965",
"0.679983",
"0.6649884",
"0.6367047",
"0.62009317",
"0.61478215",
"0.61400616",
"0.6135504",
"0.6060349",
"0.6060349",
"0.6060349",
"0.6060349",
"0.6060349",
"0.6053958",
"0.6027328",
"0.59848976",
"0.5978327",
"0.5977943",
"0.59680456",
"0.59365356",
"0.5935393... | 0.82394207 | 0 |
Return the data from the named port. | def get_input_data(self, name='0'):
# get the task connected to the given port
task = self.get_input_task(name)
if task is None:
raise Exception("Port {} is not connected".format(name))
# get the name of the output port on the connected task
port_name = self.get_input... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def out_data(self, port: int) -> Optional[Any]:\n try:\n return copy(self.outputs[port])\n except:\n return None",
"def get_input_data_value(node: Node, port: int):\n return node.in_port(port).data.get_value()",
"def _get_data(self):\n raw_data = self._get_raw_data... | [
"0.6669574",
"0.63913363",
"0.63741755",
"0.6348516",
"0.6304568",
"0.6220529",
"0.61653084",
"0.61174357",
"0.604259",
"0.60177284",
"0.60099936",
"0.5995539",
"0.5963908",
"0.5963786",
"0.5948678",
"0.58976704",
"0.5891747",
"0.5881411",
"0.58772135",
"0.5842859",
"0.583808... | 0.68804854 | 0 |
Return the task attached to the given output port. | def get_output_task(self, name='0'):
port = self.get_output(name).other
if port is None:
return None
return port.task | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def output_node(self, port: int):\n return self._output_nodes_map[port]",
"def get_input_task(self, name='0'):\n port = self.get_input(name).other\n if port is None:\n return None\n return port.task",
"def get_task_output(self, task, output_id):\n return self._gdb_... | [
"0.73431987",
"0.7269821",
"0.67667603",
"0.64185977",
"0.62417954",
"0.6162333",
"0.61589986",
"0.61589986",
"0.61589986",
"0.61589986",
"0.61589986",
"0.6016541",
"0.5976228",
"0.59619164",
"0.5914219",
"0.588327",
"0.58810896",
"0.5880721",
"0.58404255",
"0.58404255",
"0.5... | 0.8278482 | 0 |
Execute the task. This method requires at a minimum that all input ports are connected to valid data sources. Subclasses can customize the execution with keyword arguments. The reference implementation only checks that the input ports are all connected and raises an error if they aren't. | def run(self, *arg, **kw):
self.dirty = False
for port in self.inputs:
self.get_input_data(port) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def execute(self, targets):\r\n raise TaskError('execute() not implemented')",
"def run_dataflow(self, *args, **kwargs):\n raise NotImplementedError",
"def evaluate(self, tick, task, inputs, nosend_ports=None):\n raise NotImplementedError(\"abstract\")",
"def execute(self, inputs={}):\n ... | [
"0.6244398",
"0.6065953",
"0.6056772",
"0.60060936",
"0.5825107",
"0.5775887",
"0.57420397",
"0.56945634",
"0.56765115",
"0.5664168",
"0.5568796",
"0.5538208",
"0.550687",
"0.5504932",
"0.54840845",
"0.547578",
"0.54067135",
"0.534687",
"0.5298878",
"0.5262872",
"0.52575904",... | 0.6523009 | 0 |
Set dirty state on all downstream tasks. | def _reset_downstream(self, _, isdirty, *args):
if isdirty:
for name in self.outputs:
task = self.get_output_task(name=name)
if task:
task.dirty = True | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _update_all_tasks(self) -> None:\n for task in self.tasks:\n task.update()",
"def __update_task(self, tasks, **extra_args):\n for task in tasks:\n assert isinstance(\n task, Task), \"Core.update_job_state: passed an argument\" \\\n \" which is... | [
"0.67158985",
"0.6424232",
"0.6123255",
"0.59694195",
"0.5936196",
"0.56643915",
"0.56304514",
"0.5622691",
"0.5592518",
"0.55850524",
"0.558018",
"0.5550249",
"0.5540967",
"0.5538353",
"0.5495823",
"0.54849344",
"0.54771364",
"0.54654974",
"0.54427445",
"0.5415702",
"0.54025... | 0.71467745 | 0 |
Create an input port that accepts the given data type. An input port can accept one or more data types, but for compatibility with the ``create_output_port`` method, the default 2 argument call signature will generate an input port that accepts only the given data class. The keyword argument ``data_classes`` can be use... | def make_input_port(cls, data_class=None, data_classes=()):
if data_class is not None:
data_classes += (data_class,)
class ReturnedInputPort(InputPort):
"""A subclass of InputPort accepting provided types."""
def accepts(self):
"""Return the classes... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def build_data_input(cls, name='input'):\n return cls(name, PortDirection.INPUT, type=PortType.DATA)",
"def create_source(cls, data):\n class SourceOutput(OutputPort):\n\n \"\"\"A port attached to a source task.\"\"\"\n\n name = '0'\n description = str(data)\n\n ... | [
"0.5783875",
"0.5416487",
"0.5152956",
"0.51069313",
"0.5068329",
"0.48468444",
"0.48388866",
"0.48284078",
"0.47701696",
"0.47511247",
"0.4733464",
"0.47286028",
"0.4718616",
"0.46796426",
"0.4669919",
"0.46485522",
"0.46478075",
"0.46015683",
"0.458119",
"0.45772448",
"0.45... | 0.7779371 | 0 |
Create an output port that emits the given data type. >>> Port = Task.make_output_port(int) >>> int is Port({}).emits() True | def make_output_port(cls, data_class=None):
class ReturnedOutputPort(OutputPort):
"""A subclass of InputPort accepting provided types."""
def emits(self):
"""Return the class emitted by the port."""
return data_class
return ReturnedOutputPort | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def OutputPort(*args, **kw):\n return Port.make_shared(OutputPortInterface(*args, **kw))",
"def CreateOutput(self, name=None, type=None, data=None):\n\n\n out = self._output_registry.Create(name, type, data)\n\n self._outputs.append(out)\n\n return out",
"def port_out(self) -> int:\... | [
"0.67926675",
"0.58766013",
"0.5834365",
"0.57057595",
"0.5663366",
"0.5648713",
"0.5592889",
"0.550751",
"0.54847336",
"0.54847336",
"0.54847336",
"0.54847336",
"0.54847336",
"0.54847336",
"0.54614824",
"0.5394179",
"0.53873235",
"0.53818834",
"0.53586745",
"0.5345994",
"0.5... | 0.7136983 | 0 |
Load collector command file. | def load_collector_command_file(cmd_type, filename):
assert cmd_type in COMMAND_TYPES, 'Invalid command type "%s"' % cmd_type
if cmd_type in CONFIG_TYPES:
cmd_filename = cmd_type + '.yaml'
file_descr = CONFIG_TYPES[cmd_type]
elif cmd_type in VOTING_LIST_TYPES:
cmd_filename = None
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_load(self):\n command = constituencies.Command()\n command.handle('load', silent=True)",
"def _load_command_dict(self, path=None):",
"def do_load(self, line):\n cmd_args = io.parse_cmd_args(line, io.load_cmd_pattern)\n if cmd_args:\n success = self.manager.load(*... | [
"0.6637995",
"0.6602988",
"0.6421098",
"0.5958425",
"0.5942859",
"0.58570313",
"0.5780593",
"0.57392687",
"0.5670419",
"0.5638143",
"0.560007",
"0.5599712",
"0.5581758",
"0.5579189",
"0.55661297",
"0.556542",
"0.5560651",
"0.5529598",
"0.5529598",
"0.5529598",
"0.5529598",
... | 0.71159786 | 0 |
Check collector command file signature. | def check_cmd_signature(cmd_type, filename):
log.debug('Checking command file %s (%s) signature', filename, cmd_type)
# detect trust root file
trust_container_filepath = os.path.join(CONFIG['active_config_files_path'],
'trust.bdoc')
if cmd_type == 'trust' and... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def check_sig(self):\n check_sig(self.path)\n dsc = self.get_dsc()\n if dsc is not None:\n check_sig(dsc)",
"def checksignature(self):\n if(self.name=='ORBIT'): return\n if(self.ctpnum==0): return\n cmd=\"CheckSignature(\"+self.board+\",\"+self.signature+\",\"+self.ctpnum+\")\"... | [
"0.67507535",
"0.66069126",
"0.6045818",
"0.60454977",
"0.60318244",
"0.60318244",
"0.5943962",
"0.59437245",
"0.5939048",
"0.59087485",
"0.5906215",
"0.58670527",
"0.5840456",
"0.58291215",
"0.58183795",
"0.5771363",
"0.5729034",
"0.5722215",
"0.5658076",
"0.5641391",
"0.562... | 0.7288576 | 0 |
Returns the default featurestore. If the user did not specify the featurestore, it defaults to the project's featurestore | def _default_featurestore(self, featurestore):
if featurestore is None:
featurestore = fs_utils._do_get_project_featurestore()
return featurestore | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_default_datastore(self):\n try:\n return self.client.list_datastores()[0]['datastore']\n except VMwareError as e:\n raise VMwareBackendError(e)",
"def get_default_store_name_for_current_request():\r\n store_name = 'default'\r\n\r\n # see what request we are curre... | [
"0.6456016",
"0.62015706",
"0.6144767",
"0.61073357",
"0.59432316",
"0.5925258",
"0.588503",
"0.58394617",
"0.5833727",
"0.5825112",
"0.5804936",
"0.5802867",
"0.5674981",
"0.5647042",
"0.56290233",
"0.5609647",
"0.5603026",
"0.5592466",
"0.55848753",
"0.5467452",
"0.5405066"... | 0.907442 | 0 |
>>> binary2bytes('00000001') b'\\x01' >>> binary2bytes('00000011') b'\\x03' >>> binary2bytes('11110000') b'\\xf0' >>> binary2bytes('1111000010000000') b'\\xf0\\x80' | def binary2bytes(inputBin):
#check if length is divisible by 8
if len(inputBin) % 8 == 0:
byteList = []
for i in range(0, len(inputBin), 8):
#convert each 8 bits in int
byteList += [int(inputBin[i:i+8], 2)]
#convert the list to bytes
return bytes... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_right_binary_to_bytes(self):\n binary_string = '00000101000110100010100011010010'\n byte_string = utils.binary_to_bytes(binary_string, little_endian=False)\n expected_byte_string = b'\\x05\\x1A\\x28\\xD2'\n self.assertEqual(byte_string, expected_byte_string)",
"def bytes2bina... | [
"0.7444598",
"0.71815115",
"0.6991683",
"0.6945767",
"0.6843568",
"0.6810538",
"0.6780177",
"0.67500544",
"0.6743914",
"0.6733812",
"0.6729651",
"0.6696337",
"0.6691725",
"0.66798335",
"0.6650505",
"0.6643075",
"0.66386986",
"0.6614789",
"0.66003025",
"0.6540794",
"0.65194076... | 0.73619443 | 1 |
>>> bin_xor('1011','0000') '1011' >>> bin_xor('1','0000') '0001' >>> bin_xor('1101','1011') '0110' >>> bin_xor('10101010','01010101') '11111111' | def bin_xor(inputBin1, inputBin2):
result = ""
#We set each binary input to the same length by adding zeroes on the left to the smaller one
if len(inputBin1) > len(inputBin2):
inputBin2 = inputBin2.rjust(len(inputBin1), "0")
else:
inputBin1 = inputBin1.rjust(len(inputBin2), "0")
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def xor(a, b):",
"def bitwise_xor(a, b):\n\n result = \"\"\n for i in range(0, len(a)):\n result += str(int(a[i]) ^ int(b[i]))\n return result",
"def test_bit_xor(self):\n value = bytearray([1])\n ops = [bitwise_operations.bit_xor(self.test_bin_ones, 0, 8, 1, value, None)]\n\n ... | [
"0.8044245",
"0.7827002",
"0.7490464",
"0.7386411",
"0.7358006",
"0.7249659",
"0.7243797",
"0.72187597",
"0.7168043",
"0.71600723",
"0.71484417",
"0.7135558",
"0.70728177",
"0.7046469",
"0.7040437",
"0.7027976",
"0.70228106",
"0.70034254",
"0.6998678",
"0.69902486",
"0.698192... | 0.787626 | 1 |
>>> create_DES_subkeys('0001001100110100010101110111100110011011101111001101111111110001') ['000110110000001011101111111111000111000001110010', '011110011010111011011001110110111100100111100101', '010101011111110010001010010000101100111110011001', '011100101010110111010110110110110011010100011101', '0111110011101100000... | def create_DES_subkeys(key):
# permutation with the original key
fullKey = bit_permutation(key, PC1)
#we split the key into right and left part
lprev, rprev = fullKey[:28], fullKey[28:]
nFinalBlock = []
#We now proceed through 16 iterations, for 1<=n<=16
for n in range (16):
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def generate_keys(cls, des_key: str) -> List[list]:\n\n keys = []\n des_key = cls.string_to_bit_array(des_key)\n # Apply the initial Permutation on the key\n des_key = cls.permutation_expand(des_key, Tables.PC_1_TABLE)\n # Split it in to LEFT,RIGHT\n left, right = cls.n_sp... | [
"0.69109523",
"0.6327981",
"0.59114325",
"0.58670264",
"0.5672433",
"0.5617016",
"0.56074584",
"0.5488417",
"0.54729164",
"0.5424147",
"0.54045707",
"0.5400378",
"0.539857",
"0.53741616",
"0.53487986",
"0.5323746",
"0.53177774",
"0.5278533",
"0.52746445",
"0.5209882",
"0.5177... | 0.79006463 | 0 |
Makes sure that for each covariate name (from model) an observable (from dataframe) exists. | def _check_covariate_dict(
self, covariate_dict, covariate_names, observables):
# Check that model needs covariates
if len(covariate_names) == 0:
return None
# If no mapping is provided, construct default mapping
if covariate_dict is None:
# Assume tr... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_createNewObs():\n\n # check type\n assert isinstance(newObs, pd.DataFrame)\n\n # check if there are exactly 5 songs has listen count and 3 columns in the generated df\n assert newObs.query(\"listen_count!=0\").shape == (5,3)\n\n # check if the number of songs in the song_df is the same as t... | [
"0.5495533",
"0.5172023",
"0.5142633",
"0.5087636",
"0.4961099",
"0.49421537",
"0.49322584",
"0.49233723",
"0.4906298",
"0.48916122",
"0.4883766",
"0.48531032",
"0.48529163",
"0.4845847",
"0.48317057",
"0.48283717",
"0.4815817",
"0.48010272",
"0.4800914",
"0.47912633",
"0.475... | 0.57561946 | 0 |
Makes sure that covariates can be reshaped in to an array of shape (n, c). In other words, checks whether for each covariate_name there exists exactly one nonNaN value for each ID. | def _check_covariate_values(self, covariate_names):
# Check that model needs covariates
if len(covariate_names) == 0:
return None
for name in covariate_names:
# Mask covariate values
mask = self._data[self._obs_key] == self._covariate_dict[name]
t... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def check_categories(a: np.ndarray):\n return list(np.unique(a[~np.isnan(a)]))",
"def _extract_covariates(self, covariate_names):\n # Format covariates to array of shape (n, c)\n c = len(covariate_names)\n n = len(self._ids)\n covariates = np.empty(shape=(n, c))\n for idc, n... | [
"0.5669321",
"0.547841",
"0.5444621",
"0.54324275",
"0.5407865",
"0.54041755",
"0.53234154",
"0.5320249",
"0.5316274",
"0.5283278",
"0.52639496",
"0.5132837",
"0.5126093",
"0.5118132",
"0.51035595",
"0.5090211",
"0.5082021",
"0.50425917",
"0.5038308",
"0.5019751",
"0.4994034"... | 0.6623855 | 0 |
Makes sure that the data is formated properly. 1. ids are strings 2. time are numerics or NaN 3. observables are strings 4. values are numerics or NaN 5. observable types are 'Modelled' or 'Covariate' 6. dose are numerics or NaN 7. duration are numerics or NaN | def _clean_data(self, dose_key, dose_duration_key):
# Create container for data
columns = [
self._id_key, self._time_key, self._obs_key, self._value_key]
if dose_key is not None:
columns += [dose_key]
if dose_duration_key is not None:
columns += [dose_... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def parse_missing_fields(data):\n def _get_nan_synonims(k):\n if k == \"extra_security_descriptors\":\n return [pd.NaT, np.nan]\n else:\n return [pd.NaT, '', np.nan]\n\n data = {id_no: {k: (v if v not in _get_nan_synonims(k) and not pd.isna(v) \n else None) ... | [
"0.55926216",
"0.54661906",
"0.5444112",
"0.53816944",
"0.5362483",
"0.5326546",
"0.5323102",
"0.52938086",
"0.52288264",
"0.522744",
"0.5212353",
"0.52054536",
"0.51796585",
"0.5146705",
"0.5109984",
"0.50910634",
"0.5082423",
"0.5068899",
"0.5065601",
"0.50507253",
"0.50463... | 0.558016 | 1 |
Returns an instance of a chi.HierarchicalLoglikelihood based on the provided list of loglikelihoods and the population models. | def _create_hierarchical_log_likelihood(self, log_likelihoods):
# Get covariates from the dataset if any are needed
covariate_names = self.get_covariate_names()
covariates = None
if len(covariate_names) > 0:
covariates = self._extract_covariates(covariate_names)
log_... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _create_log_likelihoods(self, ids):\n # Create a likelihood for each individual\n log_likelihoods = []\n for individual in ids:\n # Set dosing regimen\n if self._dosing_regimens:\n self._mechanistic_model.set_dosing_regimen(\n self._d... | [
"0.57376385",
"0.5609973",
"0.5427306",
"0.537937",
"0.5340062",
"0.5271139",
"0.52402085",
"0.5212378",
"0.5142101",
"0.5134181",
"0.5104734",
"0.5094124",
"0.509232",
"0.5073549",
"0.50627905",
"0.5023009",
"0.5007841",
"0.49988776",
"0.4992658",
"0.4934784",
"0.49270967",
... | 0.73569417 | 0 |
Gets the relevant data for the individual and returns the resulting chi.LogLikelihood. | def _create_log_likelihood(self, individual):
# Get individuals data
times = []
observations = []
mask = self._data[self._id_key] == individual
data = self._data[mask][
[self._time_key, self._obs_key, self._value_key]]
for output in self._mechanistic_model.out... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def log_likelihood_function(self, instance):\r\n\r\n xvalues = np.arange(self.data.shape[0])\r\n model_data = instance.profile_from_xvalues(xvalues=xvalues)\r\n residual_map = self.data - model_data\r\n chi_squared_map = (residual_map / self.noise_map) ** 2.0\r\n log_likelihood =... | [
"0.593657",
"0.5863257",
"0.57026047",
"0.56884336",
"0.5661554",
"0.56269956",
"0.55965257",
"0.5575074",
"0.5520455",
"0.5502658",
"0.5476224",
"0.54435015",
"0.5408902",
"0.540859",
"0.53706634",
"0.53657186",
"0.5365584",
"0.5350838",
"0.5345029",
"0.5338034",
"0.5330534"... | 0.7430913 | 0 |
Extracts covariates from the pandas.DataFrame and formats them as a np.ndarray of shape (n, c). | def _extract_covariates(self, covariate_names):
# Format covariates to array of shape (n, c)
c = len(covariate_names)
n = len(self._ids)
covariates = np.empty(shape=(n, c))
for idc, name in enumerate(covariate_names):
mask = self._data[self._obs_key] == self._covariat... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def X(self) -> np.ndarray:\n cols = [col for col in self._obj.names.covariates if col in self._obj.columns]\n if not cols:\n raise KeyError(\"No known covariates in CausalFrame\")\n return self._obj[cols].to_numpy()",
"def get_codon_arr(chromosome: Chromosome) -> np.ndarray:\n\n ... | [
"0.6590012",
"0.617049",
"0.61693865",
"0.60362846",
"0.5884417",
"0.5769841",
"0.5732126",
"0.570601",
"0.5662892",
"0.5627514",
"0.55737424",
"0.55586195",
"0.5551977",
"0.5550387",
"0.551459",
"0.54919827",
"0.54874426",
"0.54502755",
"0.5422454",
"0.54132974",
"0.5411954"... | 0.64851564 | 1 |
Converts the dosing regimens defined by the pandas.DataFrame into myokit.Protocols, and returns them as a dictionary with individual IDs as keys, and regimens as values. For each dose entry in the dataframe a dose event is added to the myokit.Protocol. If the duration of the dose is not provided a bolus dose of duratio... | def _extract_dosing_regimens(self, dose_key, duration_key):
# Create duration column if it doesn't exist and set it to default
# bolus duration of 0.01
if duration_key is None:
duration_key = 'Duration in base time unit'
self._data[duration_key] = 0.01
# Extract ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _df_to_cellchat_format(self, df_to_convert) -> dict:\n interactions_dataframes = {}\n\n for _, row in df_to_convert.iterrows():\n df = pd.DataFrame(index=self.cell_types, columns=self.cell_types)\n\n for cell_type_i in self.cell_types:\n for cell_type_j in sel... | [
"0.5042048",
"0.4814868",
"0.47347727",
"0.4657895",
"0.46245697",
"0.4503713",
"0.4491382",
"0.4467344",
"0.44467682",
"0.44412938",
"0.44312024",
"0.44292995",
"0.44158575",
"0.4410534",
"0.4407224",
"0.43975756",
"0.43851158",
"0.43694475",
"0.43649432",
"0.43511978",
"0.4... | 0.65537184 | 0 |
Resets the error model parameter names and prepends the output name if more than one output exists. | def _set_error_model_parameter_names(self):
# Reset error model parameter names to defaults
for error_model in self._error_models:
error_model.set_parameter_names(None)
# Rename error model parameters, if more than one output
n_outputs = self._mechanistic_model.n_outputs()
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def fixupProcess(self):\n # Make sure that for each output module the following parameters exist\n # in the PSet returned from the framework:\n # fileName\n # logicalFileName\n # dataset.dataTier\n # dataset.filterName\n if hasattr(self.process, \"outputModu... | [
"0.57665694",
"0.55550444",
"0.5478356",
"0.5472496",
"0.54560643",
"0.54148453",
"0.5400223",
"0.5367741",
"0.53485596",
"0.52957",
"0.5292765",
"0.528896",
"0.5284119",
"0.52635086",
"0.52328205",
"0.5230758",
"0.5223709",
"0.52217895",
"0.52121764",
"0.51781875",
"0.517141... | 0.8067073 | 0 |
Returns the names of the covariates. | def get_covariate_names(self):
if self._population_model is None:
return []
return self._population_model.get_covariate_names() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def covariates(self) -> List[str]:\n return self._obj._names[\"covariates\"]",
"def covariates(self):\n return None",
"def _extract_covariates(self, covariate_names):\n # Format covariates to array of shape (n, c)\n c = len(covariate_names)\n n = len(self._ids)\n covar... | [
"0.9059461",
"0.7653818",
"0.66643596",
"0.6556078",
"0.64953846",
"0.64784676",
"0.632451",
"0.6303127",
"0.6175361",
"0.6151976",
"0.61394966",
"0.6138521",
"0.6114289",
"0.5997235",
"0.5952127",
"0.59334815",
"0.5901747",
"0.58754677",
"0.5871938",
"0.5863617",
"0.5863617"... | 0.85792655 | 1 |
Returns the names of the model parameters, i.e. the combined names of the mechanistic model parameters and the error model parameters when no population model has been set, or the names of population model parameters when a population model has been set. Any parameters that have been fixed to a constant value will not ... | def get_parameter_names(self, exclude_pop_model=False):
if (self._population_model is None) or exclude_pop_model:
names = self._mechanistic_model.parameters()
for error_model in self._error_models:
names += error_model.get_parameter_names()
return names
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_model_parameter_names():\n params = ['mu', 'rho']\n return params",
"def parameter_names_from_model(model):\n variables = model.getVariables()\n itvar = variables.iterator()\n names = []\n for i in xrange(len(variables)):\n currentvar = itvar.Next()\n names.append(... | [
"0.8078527",
"0.6911393",
"0.6861655",
"0.6757447",
"0.6700816",
"0.6638141",
"0.6599225",
"0.6582798",
"0.65355724",
"0.64979255",
"0.6463585",
"0.6457589",
"0.6440606",
"0.6431328",
"0.6382589",
"0.6382589",
"0.63714576",
"0.63475984",
"0.6344106",
"0.63392514",
"0.6319101"... | 0.8200989 | 0 |
Sets the data of the modelling problem. The data contains information about the measurement time points, the measured values of the observables, the observable name, IDs to identify the corresponding individuals, and optionally information on the administered dose amount and duration. | def set_data(
self, data, output_observable_dict=None, covariate_dict=None,
id_key='ID', time_key='Time', obs_key='Observable',
value_key='Value', dose_key='Dose', dose_duration_key='Duration'):
# Check input format
if not isinstance(data, pd.DataFrame):
r... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_data(self, data):\n self.closeContext()\n self.clear()\n self.clear_messages()\n\n self.data = data\n if data is not None:\n n_instances = len(data)\n n_attrs = len(data.domain.attributes)\n self.infoLabel.setText(\"%i instances on input\\... | [
"0.6253465",
"0.5959073",
"0.59506583",
"0.58824116",
"0.58592606",
"0.5852012",
"0.58044004",
"0.5789111",
"0.5774705",
"0.57636905",
"0.57049507",
"0.5695745",
"0.5694147",
"0.566052",
"0.5614362",
"0.56030023",
"0.56024325",
"0.55722237",
"0.5571405",
"0.5559015",
"0.55556... | 0.61870927 | 1 |
Sets the prior distribution of the model parameters. The logprior dimensions are assumed to be ordered according to | def set_log_prior(self, log_prior):
# Check prerequesites
if self._data is None:
raise ValueError('The data has not been set.')
# Check inputs
if not isinstance(log_prior, pints.LogPrior):
raise ValueError(
'The log-prior has to be an instance of ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def log_prior(self):\n raise NotImplementedError(\"the log_prior property should \"\n \"be defined in the Estimator sub-class\")",
"def set_prior(self,field):\n self.observation_thresholds = [i/self.observations for i in range(0,self.observations)]\n self.obs... | [
"0.6979534",
"0.67951566",
"0.6770433",
"0.67217827",
"0.6695372",
"0.6652549",
"0.6615611",
"0.66131043",
"0.65986574",
"0.6573988",
"0.6573988",
"0.6571616",
"0.6439268",
"0.6432067",
"0.64283925",
"0.6425549",
"0.64170766",
"0.6353341",
"0.6342298",
"0.62882614",
"0.624693... | 0.8004486 | 0 |
Sets the population model. A population model specifies how model parameters vary across individuals. The dimension of the population model has to match the number of model parameters. | def set_population_model(self, population_model):
# Check inputs
if not isinstance(population_model, chi.PopulationModel):
raise TypeError(
'The population model has to be an instance of '
'chi.PopulationModel.')
# Make sure that dimension of populati... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def setPop(self, pop: Population):\n self.population = pop\n self.population_size = pop.size()",
"def init_pop(self):\n genes = np.random.randn( self.population_size * self.individual.gene_count )\n self.population = genes.reshape((self.population_size, -1))\n #print(self.popul... | [
"0.62167",
"0.5926654",
"0.5786187",
"0.56787527",
"0.54684395",
"0.5381719",
"0.5370427",
"0.5369406",
"0.53193176",
"0.5302784",
"0.52923334",
"0.52427626",
"0.52427626",
"0.5241639",
"0.5236702",
"0.523217",
"0.52262396",
"0.52212846",
"0.52212846",
"0.52067775",
"0.519047... | 0.78179437 | 0 |
Runs many iterations of the two_player_game_iter, totalling results. | def full_game(iters, n=30):
# Create empty total matrices
total_1 = np.zeros((n, n))
total_2 = np.zeros((n, n))
# Simulate iters
for _ in range(iters):
# Get single iter
mat_1, mat_2 = two_player_game_iter(n=n)
# Add each payoff to totals
total_1 += mat_1
tota... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def playGames(self, num, sonete,secuence,mcts,verbose=False):\n eps_time = AverageMeter()\n bar = Bar('Arena.playGames', max=num)\n end = time.time()\n eps = 0\n maxeps = int(num)\n finalScore1=0\n finalScore2=0\n\n num = int(num/2)\n oneWon = 0\n ... | [
"0.6592306",
"0.637418",
"0.6361511",
"0.62523794",
"0.6164459",
"0.6154878",
"0.6153801",
"0.61084986",
"0.6085923",
"0.60651904",
"0.6061598",
"0.6013569",
"0.59991294",
"0.59905803",
"0.59622914",
"0.59505624",
"0.59090394",
"0.58888763",
"0.5882414",
"0.5851301",
"0.58477... | 0.684276 | 0 |
loads and merges annotation dicts for data_dir | def get_annotations(data_dirs):
anno_filename = glob.glob('{}/*.json'.format(data_dirs[0]))[0]
with open(anno_filename, 'r') as anno_file:
annotations = json.load(anno_file)
for data_dir in data_dirs[1:]:
anno_filename = glob.glob('{}/*.json'.format(data_dir))[0]
with open(anno_filen... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_annotations(data_folder):\n annotations_files = os.listdir('data_annotations')\n\n annotations = {}\n for file_name in annotations_files:\n annotation = json.load(\n open(f'{data_folder}/annotations/{file_name}', 'r')\n )\n key = int(annotation['entity_id'])\n ... | [
"0.68433934",
"0.6776701",
"0.65336627",
"0.64016545",
"0.63647145",
"0.6360142",
"0.6300034",
"0.6286142",
"0.62682825",
"0.62356395",
"0.6151858",
"0.61417496",
"0.60985434",
"0.6070481",
"0.60614765",
"0.5994977",
"0.59927946",
"0.59677225",
"0.59677225",
"0.5963747",
"0.5... | 0.7242496 | 0 |
writes out train and val txt files for caffe | def write_textfiles(train, val, anno):
""" used only for side effect """
# fn creates text file line in form '<filename> <int mapping of grip type>'
# for each train/val file and writes each line in corresponding
# train.txt/val.txt for training
# to_line = lambda fname:'{} {}'.format(fname,labelmap... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def generate_train_txt(name, path):\n with open(path + '/test.txt', 'a') as file:\n file.write('/content/YOLO_metric/data/obj/' + name + '\\n')",
"def write_to_train_file(files: List, train_file_path: str) -> None:\n f = open(train_file_path, \"w\")\n text_to_save = \"\"\n for i, img_path in e... | [
"0.7014946",
"0.67300874",
"0.660001",
"0.6495438",
"0.63600695",
"0.6263932",
"0.62282443",
"0.62009114",
"0.6172849",
"0.614487",
"0.60852087",
"0.6045778",
"0.60068756",
"0.5990579",
"0.5930968",
"0.5901763",
"0.5892108",
"0.5886284",
"0.5884193",
"0.58708364",
"0.5862634"... | 0.7181774 | 0 |
moves train/val files to trainingdata dir after applying optional transformations of resizing and centercropping | def move_and_transform(train, val, size, resize=True, center_crop=False):
load_image = lambda fname: cv2.imread(os.path.join(ALL_IMAGES, fname))
resize_image = lambda img: cv2.resize(img, (size, size))
move_image = lambda (img, fname): cv2.imwrite(fname, img)
train_imgs = map(load_image, train)
val... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def transformation_for_training(train_dir):\n\n train_transforms = transforms.Compose([transforms.RandomRotation(30),\n transforms.RandomResizedCrop(224),\n transforms.RandomHorizontalFlip(),\n ... | [
"0.68580747",
"0.68126184",
"0.6661624",
"0.6622211",
"0.6482098",
"0.6411102",
"0.64000064",
"0.6395083",
"0.6322259",
"0.62958413",
"0.62045133",
"0.61812246",
"0.6141117",
"0.61333716",
"0.6103867",
"0.60934895",
"0.6093341",
"0.60870826",
"0.6078162",
"0.60575724",
"0.604... | 0.7223868 | 0 |
Executes the Daikon binary. Raises ValueError If no filenames are provided as input. FileNotFoundError If a given input file cannot be found. RuntimeError If the image for the tool has not been installed. | def __call__(self, *filenames: str) -> str:
if not self.is_installed():
message = f'image for tool is not installed [{self.IMAGE}]'
raise RuntimeError(message)
logger.debug(f"running Daikon on files: {', '.join(filenames)}")
if not filenames:
raise ValueError... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def main():\n parser = argparse.ArgumentParser()\n parser.add_argument('-d', '--debug', action='store_true',\n help='Start debugging. Image MUST be an ELF file.')\n parser.add_argument('-t', '--toolchain', type=is_valid_path,\n help='Tool chain installation pa... | [
"0.61953026",
"0.6166626",
"0.5958938",
"0.59363645",
"0.5926071",
"0.58944595",
"0.56989646",
"0.5695022",
"0.5689529",
"0.56718326",
"0.5646995",
"0.56252486",
"0.56227446",
"0.5597798",
"0.5588111",
"0.55471885",
"0.5533798",
"0.5513449",
"0.54699075",
"0.54589504",
"0.545... | 0.7537991 | 0 |
Compute the probability of observing at least d disks failure for a special configuration. | def probability_at_least_d_fail(disks, d, chunk_count, reliability):
#print(disks, d, chunk_count, reliability)
return sum([disk_loss_probability(disks, reliability, k) for k in range(d, chunk_count + 1)])
# return sum([disk_loss_probability(k) for k in range(recovery_threshold, chunk_count + 1)]) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def probability_at_least_d_fail_matrix(disks, d, chunk_count, reliability):\n failure_threshold = chunk_count - d + 1\n \n transfer_matrices = [transfer_matrix(reliability[disk], failure_threshold)\n for disk in reversed(disks)]\n \n return np.sum(reduce(np.dot, transfer_matr... | [
"0.72341484",
"0.7218013",
"0.68280166",
"0.6411059",
"0.62288916",
"0.5944703",
"0.5901955",
"0.5817657",
"0.5722958",
"0.5694554",
"0.5596",
"0.55757535",
"0.5557571",
"0.5555904",
"0.5533613",
"0.5527104",
"0.5523611",
"0.5508688",
"0.5491621",
"0.5454803",
"0.5433317",
... | 0.8210371 | 0 |
Construct square transfer matrix with (1 reliability) on the diagonal and reliability on the upper diagonal and 0 otherwise. | def transfer_matrix(reliability, size):
return ((1.0 - reliability) * np.eye(size, k=0, dtype=float) +
reliability * np.eye(size, k=1, dtype=float)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def init_needleman_wunsch_matrix(self):\r\n empty_matrix = self.empty_matrix() # Building on the previous definition, this will give you an empty matrix\r\n for i in range(len(self.s2)+1):\r\n for j in range(len(self.s1)+1):\r\n empty_matrix[0][i] = -i\r\n emp... | [
"0.59489757",
"0.5683399",
"0.5654888",
"0.5520674",
"0.548017",
"0.5421887",
"0.54167813",
"0.53991044",
"0.53987265",
"0.5383925",
"0.53728986",
"0.535879",
"0.5345927",
"0.533925",
"0.533635",
"0.5328171",
"0.532013",
"0.5295986",
"0.5263911",
"0.52635425",
"0.5260293",
... | 0.74330145 | 0 |
Compute the probability of observing at least d disks failure for a special configuration using matrix formulation. | def probability_at_least_d_fail_matrix(disks, d, chunk_count, reliability):
failure_threshold = chunk_count - d + 1
transfer_matrices = [transfer_matrix(reliability[disk], failure_threshold)
for disk in reversed(disks)]
return np.sum(reduce(np.dot, transfer_matrices), axis... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def probability_at_least_d_fail(disks, d, chunk_count, reliability):\n #print(disks, d, chunk_count, reliability)\n \n return sum([disk_loss_probability(disks, reliability, k) for k in range(d, chunk_count + 1)])\n # return sum([disk_loss_probability(k) for k in range(recovery_threshold, chunk_count + ... | [
"0.7060361",
"0.6983528",
"0.6222328",
"0.60808724",
"0.60013914",
"0.5823593",
"0.5813156",
"0.5641228",
"0.55846107",
"0.5578027",
"0.5569787",
"0.5560261",
"0.5547611",
"0.54837257",
"0.54624325",
"0.5458767",
"0.5449614",
"0.5449614",
"0.5401801",
"0.5400344",
"0.5358333"... | 0.76656 | 0 |
Compute the file loss probability for disks reliabilities between mean_reliability 0.5 delta and mean_reliability + 0.5 delta for a number of experiment. | def file_loss_delta(delta, mean_reliability, experiments, disks, chunk_count, spread_factor, d):
for e in experiments:
# First we generate the list of disk reliability between mean_reliability-0.5*delta and mean_reliability-0.5*delta.
lower_bound = mean_reliability - 0.5 * delta
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def deviation(delta, mean_reliability, experiment, disks, chunk_count, spread_factor, threshold_recovery):\n \n # Approximated file loss probability\n reliability_mean_value = probability_at_least_d_fail_equal_reliability(threshold_recovery, chunk_count, mean_reliability)\n \n\n # Exact probability\... | [
"0.7375282",
"0.7129215",
"0.690092",
"0.6808733",
"0.62738377",
"0.62597007",
"0.6112193",
"0.60928214",
"0.60235775",
"0.58532465",
"0.58407056",
"0.5836605",
"0.58347225",
"0.58009577",
"0.5767279",
"0.57511526",
"0.5729234",
"0.57234436",
"0.5690353",
"0.5650997",
"0.5623... | 0.7915163 | 0 |
Compute the file loss probability for disks reliabilities between mean_reliability 0.5 delta and mean_reliability + 0.5 delta for a number of experiment using the matrix formulation. | def file_loss_delta_matrix(delta, mean_reliability, experiments, disks, chunk_count, spread_factor, d):
for e in experiments:
# First we generate the list of disk reliability between mean_reliability-0.5*delta and mean_reliability-0.5*delta.
lower_bound = mean_reliability - 0.5 * delta
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def file_loss_delta(delta, mean_reliability, experiments, disks, chunk_count, spread_factor, d):\n \n for e in experiments:\n # First we generate the list of disk reliability between mean_reliability-0.5*delta and mean_reliability-0.5*delta.\n \n lower_bound = mean_reliability - 0.5 * de... | [
"0.72597986",
"0.6986704",
"0.657611",
"0.6478273",
"0.6222642",
"0.6062159",
"0.6027956",
"0.5801296",
"0.5749402",
"0.5615564",
"0.55568445",
"0.5553681",
"0.554003",
"0.5538803",
"0.5510115",
"0.5508222",
"0.5498864",
"0.5498256",
"0.5492621",
"0.54915667",
"0.5489747",
... | 0.77288026 | 0 |
Compute the deviation between the mean reliability and is approximate value for a special delta. | def deviation(delta, mean_reliability, experiment, disks, chunk_count, spread_factor, threshold_recovery):
# Approximated file loss probability
reliability_mean_value = probability_at_least_d_fail_equal_reliability(threshold_recovery, chunk_count, mean_reliability)
# Exact probability
reliabi... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def mean_deviation(self):\r\n\t\t_mean = sum(self.sample)/len(self.sample)\r\n\t\treturn sum(map(lambda x: abs(x - _mean), self.sample))/len(self.sample)",
"def deviation(values, val):\n\tm = mean(values)\n\tdev = abs(val-m)\n\tsd = standard_deviation(values)\n\treturn float(dev)/sd if sd!=0 else 0.0",
"def st... | [
"0.7300405",
"0.6970873",
"0.6958749",
"0.67380327",
"0.6708342",
"0.66694385",
"0.665761",
"0.665761",
"0.6576224",
"0.65494007",
"0.65315175",
"0.6526695",
"0.6510533",
"0.64498675",
"0.6411879",
"0.63829255",
"0.63778174",
"0.6377376",
"0.6377318",
"0.63548166",
"0.6348803... | 0.7622046 | 0 |
Compute the standard for a special delta. | def std_vs_delta(delta, mean_reliability, experiment, disks, chunk_count, spread_factor, threshold_recovery):
# Exact probability
reliabilities = [element for element in
file_loss_delta_matrix(delta, mean_reliability, experiment, disks, chunk_count, spread_factor,
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _standardize(self):\n deviation = np.std(self.series)\n self.series = (self.series - np.mean(self.series)) / (deviation if deviation != 0 else 1)",
"def _std_trans(self, std_pre):\r\n std = 1e-6 + P.Log()(P.Exp()(std_pre) + 1)\r\n return std",
"def standard_deviation(self):\r\n\... | [
"0.6608726",
"0.651359",
"0.62992597",
"0.6275137",
"0.62542665",
"0.6189788",
"0.610386",
"0.60896164",
"0.6051591",
"0.6049969",
"0.60461015",
"0.60223275",
"0.5992256",
"0.5965548",
"0.5949857",
"0.5942657",
"0.58918095",
"0.58868074",
"0.58791757",
"0.5878977",
"0.5851065... | 0.66994005 | 0 |
Attach to a screen running the component. Returns True on success, False otherwise. | def attachToComponent(self, opts):
screen = self.findScreen(opts.verbose)
if screen == None:
print("Did not find screen named %s for attach" % self._screenName)
return False
else:
print("Found screen %s" % screen)
execCmd("%s -x %s" % (self._scree... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def startComponent(self, opts):\n screen = self.findScreen(opts.verbose)\n\n if screen != None:\n print(\"Screen session %s already started.\" % (screen), file=sys.stderr)\n return False\n\n chdir(self._binaryPath, opts.verbose)\n\n cmd = \"%s %s.exe %s\" % (self._... | [
"0.6491276",
"0.59752214",
"0.59555966",
"0.58369565",
"0.57265574",
"0.5637465",
"0.5335948",
"0.5300422",
"0.5275121",
"0.527509",
"0.5267567",
"0.5206219",
"0.52035046",
"0.51799893",
"0.5155661",
"0.51364326",
"0.5122207",
"0.51052666",
"0.5083114",
"0.50777763",
"0.50653... | 0.8210587 | 0 |
Get the status of the given component. Returns True if active, False if inactive or problem finding. | def getComponentStatus(self, opts):
# We'll check screen even if we found PID so that we can get screen information
screen = self.findScreen(opts.verbose)
if screen == None:
print("Did not find screen named %s" % self._screenName)
else:
print("Found screen %s" %... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _getCurrentComponentStatus(self):\n resOverall = self.sysAdminClient.getOverallStatus()\n if not resOverall['OK']:\n return resOverall\n currentStatus = {'Down': set(), 'Run': set(), 'All': set()}\n informationDict = resOverall['Value']\n for systemsDict in informationDict.values():\n ... | [
"0.680515",
"0.66162956",
"0.66162956",
"0.66134614",
"0.66031027",
"0.65224445",
"0.6489517",
"0.6467912",
"0.64524674",
"0.64501303",
"0.6445949",
"0.6434319",
"0.6432779",
"0.6428746",
"0.6420754",
"0.64173096",
"0.64173096",
"0.64173096",
"0.6391066",
"0.637212",
"0.63609... | 0.6943719 | 0 |
Start the given component. Returns True on success, False otherwise | def startComponent(self, opts):
screen = self.findScreen(opts.verbose)
if screen != None:
print("Screen session %s already started." % (screen), file=sys.stderr)
return False
chdir(self._binaryPath, opts.verbose)
cmd = "%s %s.exe %s" % (self._monoPath, self._co... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def start_behavior(self, behavior_to_start):\n time.sleep(20)\n if not FlexBEHelper.start_flexbe_behavior(behavior_to_start):\n return False\n time.sleep(5)\n return True",
"def start(self) -> \"bool\":\n return _beamforming_swig.beamformer_sptr_start(self)",
"def ... | [
"0.6390702",
"0.6302733",
"0.6256767",
"0.60799384",
"0.6042013",
"0.6040436",
"0.5989707",
"0.59866524",
"0.5907245",
"0.5896782",
"0.58284",
"0.58061373",
"0.5782687",
"0.5770688",
"0.5761375",
"0.5749249",
"0.57472557",
"0.5734151",
"0.57333994",
"0.57286006",
"0.57187134"... | 0.66940063 | 0 |
Restart the given component. Returns True on success, False otherwise. | def restartComponent(self, opts):
self.stopComponent(opts)
return self.startComponent(opts) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def restart(self):\n self.client.post(self.path+'/action', { 'restart': {} })\n return True",
"def restart(name):\n ret = \"restart False\"\n if stop(name) and start(name):\n ret = \"restart True\"\n return ret",
"def attempt_restart(self):\n self.controller.publish(self, '... | [
"0.68808335",
"0.6627833",
"0.65335727",
"0.64911735",
"0.64604986",
"0.64322287",
"0.6412979",
"0.6409854",
"0.6307403",
"0.6287451",
"0.6283321",
"0.62737554",
"0.6273527",
"0.62522614",
"0.62217695",
"0.6185333",
"0.6137894",
"0.610683",
"0.6077489",
"0.60514385",
"0.60236... | 0.7161356 | 0 |
Try to find the screen instance for this component. Returns the screen pid.name on success, None otherwise. | def findScreen(self, verbose = False):
screenList = ""
try:
screenList = self.getScreenList(verbose)
except subprocess.CalledProcessError as cpe:
screenList = cpe.output
#print "screenList: %s" % screenList
# TODO: Need to improve this for screens with (... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getscreen(self):\n return self.screen",
"def getscreen(self):\n return self.screen",
"def getScreen(self):\n \n return self.screen",
"def getScreen(self, screenName):\n return self.screens[self.screenDictionary[screenName]]",
"def getDisplay(self):\n for displa... | [
"0.6689616",
"0.6689616",
"0.6677859",
"0.6607923",
"0.5972942",
"0.59641546",
"0.5794162",
"0.56380713",
"0.5485115",
"0.54674524",
"0.53979915",
"0.53072834",
"0.53005725",
"0.5264977",
"0.5215528",
"0.52096665",
"0.5200662",
"0.5164541",
"0.5151755",
"0.5118128",
"0.511584... | 0.75568944 | 0 |
Get a list of available screens directly from the screen command. | def getScreenList(self, verbose = False):
return execCmd("%s -list" % self._screenPath, verbose) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def list_screens(self):\n\n # Check if the form ws submitted\n form = request.forms.get(\"submit\", False)\n\n # If so...\n if form:\n\n # ...find out what the user wanted to do and to which screen\n action, screen = form.split(\"+\")\n\n # Call the rele... | [
"0.6648239",
"0.64354354",
"0.6357261",
"0.63446474",
"0.632571",
"0.62642527",
"0.62542605",
"0.61480975",
"0.596525",
"0.5948138",
"0.59051406",
"0.59023184",
"0.58955187",
"0.58955187",
"0.58858234",
"0.58700395",
"0.580741",
"0.5784875",
"0.5708334",
"0.57027566",
"0.5640... | 0.84285045 | 0 |
Store previous sorting information for multicolumn sorts. | def on_sort_column_change(self, model):
id, order = self.tv.get_model().get_sort_column_id()
if id is None and order is None:
return False
if self.prev_sort_column_id and self.prev_sort_column_id[0][0] == id:
self.prev_sort_column_id.pop(0)
self.prev_sort_column_i... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_as_sort1(self):\n if self.is_sort1:\n #if self.analysis_code == 1:\n #self.nonlinear_factor = np.nan\n #print(self.data_code)\n #print(self._times, type(self._times))\n #aaa\n return\n #print(f'{self.class_name}... | [
"0.5893826",
"0.5629862",
"0.55866504",
"0.5547809",
"0.55312973",
"0.53235435",
"0.53210545",
"0.5307315",
"0.52941406",
"0.5270745",
"0.5201339",
"0.51783633",
"0.51715374",
"0.5168619",
"0.5166643",
"0.5110402",
"0.51094055",
"0.51090115",
"0.5073252",
"0.50645584",
"0.506... | 0.6001303 | 0 |
Set up the Ruckus Unleashed integration in Open Peer Power. | async def init_integration(opp) -> MockConfigEntry:
entry = mock_config_entry()
with patch(
"openpeerpower.components.ruckus_unleashed.Ruckus.connect",
return_value=None,
), patch(
"openpeerpower.components.ruckus_unleashed.Ruckus.mesh_name",
return_value=DEFAULT_TITLE,
)... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def startup( self ):\n # ---- Setup UPNPC ----\n if self.config.neuron.use_upnpc:\n bittensor.logging.success(prefix = 'Set upnpc', sufix = '<green>ON</green>')\n try:\n self.external_port = net.upnpc_create_port_map( port = self.axon.port )\n except ne... | [
"0.6547017",
"0.5888096",
"0.5840804",
"0.5837989",
"0.5739",
"0.57326514",
"0.57269007",
"0.57230777",
"0.5663273",
"0.56224823",
"0.5589745",
"0.5567595",
"0.55671215",
"0.5561098",
"0.55436313",
"0.5507387",
"0.54814506",
"0.54813504",
"0.5467217",
"0.5465253",
"0.5435919"... | 0.63256496 | 1 |
Translate an OID into a string suitable for printing. | def oid2name(oid):
if not isinstance(oid, (str, unicode)) or not all(o.isdigit() for o in oid.split(".")):
raise ValueError("Parameter does not look like an OID string: " + repr(oid))
return _oid2name.get(oid, oid) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __repr__(self) -> str:\n return \"-\".join(chain((\"OID\",), map(str, self.value)))",
"def show_oid(oid: str=typer.Argument('', help=\"OID name or GUID\",\n autocompletion=oid_completer)) -> None:\n uid: UUID = None\n name: str = None\n node: Node = None\n ... | [
"0.6707145",
"0.6375536",
"0.63288414",
"0.6170568",
"0.6022612",
"0.60083026",
"0.5973114",
"0.5937652",
"0.59257114",
"0.5896126",
"0.58893806",
"0.5858727",
"0.5858727",
"0.58204067",
"0.5775452",
"0.57691926",
"0.5726823",
"0.57196903",
"0.56979704",
"0.56979704",
"0.5697... | 0.6383701 | 1 |
Run analysis pipeline on video existing on local machine | def local_video(**kwargs):
output_dir = run_video_preprocess(
video_file=input_video,
roi_locations=kwargs["roi_locations"],
preprocess_analysis=kwargs["preprocess_analysis"],
database=False
)
run_analysis_pipeline(
preprocess_analysis=kwargs["preprocess_analysis"],
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def main(path):\n logger.info(f'Processing video file {path}')\n # Extract audio\n audio_file = extract_audio(path, pipeline_config.audio_target_dir)\n\n # Generate sound classification results and speech recogniser results\n sound_results = SoundRecogniser().process_file(audio_file)\n sound_resu... | [
"0.7059301",
"0.70090806",
"0.6889676",
"0.6699481",
"0.63987863",
"0.63987863",
"0.63744324",
"0.6357981",
"0.63418233",
"0.6324679",
"0.63238215",
"0.6317075",
"0.6313249",
"0.6285913",
"0.6272834",
"0.6231296",
"0.6174944",
"0.6139632",
"0.61304486",
"0.6111183",
"0.610737... | 0.76880926 | 0 |
test a random image for the correct amount of gray pixels | def test_aperture(self, identifier, image_id, expected_amount_gray, ratio_gray):
assembly = brainio.get_assembly(identifier)
stimulus_set = assembly.stimulus_set
image_path = Path(stimulus_set.get_image(image_id))
assert image_path.is_file()
# count number of gray pixels in image... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def random_img_to_gray(self, img, p = 0.5):\n if self.decision(p):\n gray = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)\n img = np.zeros_like(img)\n img[:, :, 0] = gray\n img[:, :, 1] = gray\n img[:, :, 2] = gray\n return img",
"def randomize_pixels(... | [
"0.6626922",
"0.65953696",
"0.6567646",
"0.65488124",
"0.6406716",
"0.6374079",
"0.63496333",
"0.63314855",
"0.63160866",
"0.63101625",
"0.63101625",
"0.63101625",
"0.6243581",
"0.6231311",
"0.6229561",
"0.62180096",
"0.62058157",
"0.6160729",
"0.61351556",
"0.6100564",
"0.60... | 0.6663026 | 0 |
(dict), (float), (float) > (list) Return a sorted list of the films data by their distance to user location | def get_distance(film_coordinates, latitude, longitude):
film_distance = []
for film in film_coordinates.keys():
user_coordinates = (latitude, longitude)
film_coord = (film[0], film[1])
distance = great_circle(user_coordinates, film_coord).kilometers
film_distance.append((distan... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_nearest_films(films_list, number, input_location):\n output_list = []\n for film_data in films_list:\n film_dist = int(distance.distance(film_data[1], input_location).km)\n film_data.append(film_dist)\n output_list.append(film_data)\n output_list.sort(key=lambda x: x[-1])\... | [
"0.695379",
"0.62231535",
"0.5737258",
"0.5702767",
"0.5697553",
"0.56067765",
"0.5601279",
"0.55895054",
"0.5549139",
"0.55441296",
"0.554395",
"0.55432135",
"0.5508882",
"0.5467602",
"0.5463768",
"0.5454729",
"0.5454257",
"0.54269826",
"0.5369309",
"0.53676164",
"0.53409404... | 0.6938966 | 1 |
(dict) > (dict) Return a dictionary of coordinates of films | def get_film_coordinates(film_dict):
coordinate_dict = dict()
for location in film_dict.keys():
try:
locator = geopy.Nominatim(user_agent="filmGeocoder", timeout=10)
coordinates = locator.geocode(location)
coordinate_dict[coordinates.latitude, coordinates.longitude] ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_data_from_films_locations_file(path):\n film_locations_data = {}\n with open(path, encoding='utf-8', errors='ignore') as f:\n for line in f:\n line = line.strip()\n line_values = line.split(',')\n film, year, location = line_values[0], line_values[1],\\\n ... | [
"0.6048309",
"0.57136226",
"0.57079375",
"0.57055396",
"0.5634014",
"0.54674006",
"0.54155713",
"0.540007",
"0.5340333",
"0.5332164",
"0.52578497",
"0.5231767",
"0.51908624",
"0.5190739",
"0.5182495",
"0.5181372",
"0.5179014",
"0.51677597",
"0.516235",
"0.51522034",
"0.515051... | 0.72613245 | 0 |
(str) > (str) Return a country from a user coordinates | def get_user_country(user_location):
geo_locator = geopy.Nominatim(user_agent="User Location", timeout=10)
location = geo_locator.reverse(user_location, language='en')
location = str(location).split(', ')
country = location[-1]
if country == 'United States of America':
country = 'USA'
e... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_country_from_coordinates(coordinates):\n geolocator = Nominatim(user_agent=\"random_one\")\n location = geolocator.reverse(coordinates, language='en')\n country = location.address.split(',')[-1].strip()\n return country",
"def country() -> str:",
"def country(alpha_2_code: str) -> None:",
... | [
"0.7684879",
"0.7317886",
"0.7093736",
"0.69725704",
"0.69260246",
"0.67910033",
"0.67259896",
"0.67130053",
"0.6685056",
"0.66664284",
"0.65944654",
"0.6548454",
"0.6544576",
"0.65261066",
"0.6513852",
"0.651363",
"0.6501452",
"0.6493296",
"0.64910215",
"0.64739454",
"0.6467... | 0.7679369 | 1 |
(set), (str) > (dict) Return a dictionary of locations of the films | def get_films_in_country(film_set, country):
film_dict = dict()
for film in film_set:
try:
film_locations = film[1].split(', ')
film_country = film_locations[-1]
film_city = film_locations[-2]
if film_country == country:
if film_city in fi... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_popular_locations_dict(film_set):\n popular_locations = dict()\n for film in film_set:\n try:\n location = film[1].split(', ')[-1]\n if location in popular_locations.keys():\n popular_locations[location] += 1\n else:\n popular_loca... | [
"0.67535233",
"0.6218466",
"0.6067971",
"0.5930042",
"0.5639073",
"0.55344766",
"0.5507547",
"0.54807436",
"0.54286456",
"0.53949004",
"0.5374464",
"0.5364959",
"0.53500414",
"0.5269479",
"0.5232069",
"0.52200186",
"0.5092616",
"0.5092264",
"0.5086292",
"0.5074272",
"0.507423... | 0.69884044 | 0 |
(set) > (dict) Return a dictionary of popular film locations | def get_popular_locations_dict(film_set):
popular_locations = dict()
for film in film_set:
try:
location = film[1].split(', ')[-1]
if location in popular_locations.keys():
popular_locations[location] += 1
else:
popular_locations[locatio... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_films_in_country(film_set, country):\n film_dict = dict()\n for film in film_set:\n try:\n film_locations = film[1].split(', ')\n film_country = film_locations[-1]\n film_city = film_locations[-2]\n\n if film_country == country:\n if f... | [
"0.7273116",
"0.66782707",
"0.6225225",
"0.6138734",
"0.6040904",
"0.5757914",
"0.5755134",
"0.57111007",
"0.56822634",
"0.5675025",
"0.55174416",
"0.5513007",
"0.550898",
"0.54912525",
"0.54415333",
"0.541234",
"0.541234",
"0.541234",
"0.53981376",
"0.53799325",
"0.5363322",... | 0.8439863 | 0 |
Iterate through all assignments by ``for i in scope.assignments``. | def __iter__(self) -> Iterator[BaseAssignment]:
for assignments in self._assignments.values():
for assignment in assignments:
yield assignment | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_assignments(self) -> List :\n return self.assignments",
"def referents(self) -> Collection[\"BaseAssignment\"]:\n return self.__assignments",
"def iterassign(node:_AssingT) -> Iterator[Optional[List[str]]]:\n for target in node.targets if isinstance(node, ast.Assign) else [node.target]:\n ... | [
"0.60471636",
"0.5899407",
"0.5572281",
"0.5553273",
"0.5537758",
"0.55002826",
"0.5477298",
"0.5473074",
"0.5432755",
"0.5432755",
"0.539908",
"0.53967327",
"0.53259605",
"0.5308212",
"0.525584",
"0.525584",
"0.51709706",
"0.51604265",
"0.5146417",
"0.51436704",
"0.51351035"... | 0.7552211 | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.