query stringlengths 10 2k | document stringlengths 20 51.2k | metadata dict | negatives listlengths 0 101 | negative_scores listlengths 0 101 | document_score stringlengths 3 10 | document_rank stringclasses 102
values |
|---|---|---|---|---|---|---|
computes the optimal transformation for the undistortion toward another or similar size. Wraps cv2.getOptimalNewCameraMatrix | def new_makeOptimal(self,alpha,otherSize=None,centerPrincipalPoint=False):
OK,validROI = cv2.getOptimalNewCameraMatrix(self.K,self.dist,alpha,otherSize,centerPrincipalPoint)
if otherSize is None:
otherSize = self.size
return CameraInfo(otherSize,OK,None),validPixROI | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def calc_transform(src_, dst_):\n M_ = cv2.getPerspectiveTransform(src_, dst_)\n Minv_ = cv2.getPerspectiveTransform(dst_, src_)\n return M_, Minv_",
"def compute_camera_calib_distortion_params():\r\n nx = 9#number of inside corners in x\r\n ny = 6#number of inside corners in y\r\n # prepare ob... | [
"0.6404395",
"0.60454637",
"0.5960749",
"0.58915275",
"0.5875036",
"0.57737654",
"0.57172453",
"0.56888026",
"0.5688326",
"0.5684905",
"0.5589449",
"0.5587895",
"0.5575258",
"0.55513036",
"0.55342984",
"0.5509691",
"0.5499112",
"0.5479626",
"0.5454087",
"0.541782",
"0.5413724... | 0.6066039 | 1 |
To YAML file or as String | def toyaml(self,ymlfile,Kname="rgb_intrinsics",dname="rgb_distortion",sname=("image_width","image_height")):
q = dict()
q[Kname] = self.K
q[dname] = self.dist
if type(sname) is tuple:
q[sname[0]] = self.size[0]
q[sname[1]] = self.size[1]
else:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def conversion_yaml():\r\n data ={\r\n 'name': 'george',\r\n 'age': 16,\r\n 'friends':\r\n [{'name': 'marry', 'age': 16}, {'name': 'jack', 'age': 17}]\r\n }\r\n yaml_data = yaml.dump(data)\r\n dirname = os.path.dirname(os.path.dirname(__file__))\r\n # data_dir = os.path.j... | [
"0.72182703",
"0.71263176",
"0.697046",
"0.6845266",
"0.6816538",
"0.68083835",
"0.67955863",
"0.6732715",
"0.6719518",
"0.6713922",
"0.6697522",
"0.66966087",
"0.66966087",
"0.6680861",
"0.667062",
"0.6651016",
"0.66346306",
"0.6579083",
"0.65785855",
"0.65736747",
"0.656209... | 0.6001589 | 62 |
wrap a reader to apply the parsers to each of its rows | def parse_rows_with(reader, parsers):
for row in reader:
yield parse_row(row, parsers) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def parse_rows_with(reader, parsers):\n for row in reader:\n yield parse_row(row,parsers)",
"def parse_row(input_row, parsers):\n\n return [parser(value) if parser is not None else value\n for value, parser in zip(input_row, parsers)]",
"def fit_reader(self, reader):\n return sel... | [
"0.8287405",
"0.6207315",
"0.6118633",
"0.59529907",
"0.5909166",
"0.5875364",
"0.5849649",
"0.584668",
"0.5829653",
"0.5819698",
"0.57757884",
"0.569907",
"0.5674658",
"0.5655691",
"0.56322485",
"0.562984",
"0.5621524",
"0.56190336",
"0.55955404",
"0.5495519",
"0.54885215",
... | 0.8208408 | 1 |
Return a list of object attributes. This includes key names of any dict entries, filtered to the subset of valid attribute names (e.g. alphanumeric strings beginning with a letter or underscore). Also includes attributes of parent dict class. | def __dir__(self):
dict_keys = []
for k in self.keys():
if isinstance(k, str):
m = self._re_pattern.match(k)
if m:
dict_keys.append(m.string)
obj_attrs = list(dir(Dict))
return dict_keys + obj_attrs | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def object_attributes(obj):\n return obj.__dict__.items()",
"def get_attributes(obj) -> Dict[str, Tuple[Any, str]]:\n if is_dataclass(obj):\n return get_dataclass_attributes(obj)\n elif inspect.isclass(obj):\n return get_class_attributes(obj)\n elif inspect.ismodule(obj):\n retur... | [
"0.7504529",
"0.713707",
"0.7038442",
"0.6836139",
"0.67693436",
"0.6678961",
"0.66396683",
"0.6563956",
"0.6535017",
"0.6526229",
"0.6522707",
"0.6520077",
"0.6489767",
"0.64836437",
"0.64600927",
"0.6396808",
"0.63878614",
"0.6381898",
"0.63756174",
"0.6368514",
"0.6366349"... | 0.7092577 | 2 |
Pandas 0.21.0 changes sum() behavior so that the result of applying sum over an empty DataFrame is NaN. Meant to be set as pd.Series.zsum = zsum. | def zsum(s, *args, **kwargs):
return 0 if s.empty else s.sum(*args, **kwargs) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sum(self):\n # skipna == True\n # only_numerical == True\n # skipna == True\n return self._lift(\"sum\")",
"def row_sums(\n x: DataFrame,\n na_rm: bool = False,\n # dims: int = 1,\n # weights = None,\n # freq = None,\n # n = None\n) -> Ite... | [
"0.6400161",
"0.6269071",
"0.622541",
"0.5976757",
"0.5800932",
"0.57864934",
"0.57507914",
"0.57166976",
"0.5702603",
"0.5651831",
"0.5651831",
"0.5651831",
"0.5651831",
"0.56051767",
"0.5582573",
"0.55817443",
"0.55799365",
"0.54326",
"0.54056394",
"0.5402983",
"0.5398725",... | 0.70001817 | 0 |
Getter function. Get a boolean array with True values for elements of component c which are active at a specific snapshot. If the network is in multi_investment_period mode (given by n._multi_invest), these are calculated from lifetime and the build year. Otherwise all values are set to True. | def get_activity_mask(n, c, sns=None, index=None):
if sns is None:
sns = n.snapshots
if getattr(n, "_multi_invest", False):
_ = {period: get_active_assets(n, c, period) for period in n.investment_periods}
res = pd.concat(_, axis=1).T.reindex(n.snapshots, level=0).loc[sns]
else:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_active_assets(n, c, investment_period):\n periods = np.atleast_1d(investment_period)\n active = {}\n for period in periods:\n if period not in n.investment_periods:\n raise ValueError(\"Investment period not in `network.investment_periods`\")\n active[period] = n.df(c).eva... | [
"0.65424186",
"0.47628143",
"0.4661641",
"0.4639534",
"0.4568647",
"0.4535897",
"0.45355004",
"0.45338643",
"0.45336056",
"0.452387",
"0.45226544",
"0.44983009",
"0.4493752",
"0.4489318",
"0.44724113",
"0.4471887",
"0.4463261",
"0.44590876",
"0.4454553",
"0.4453565",
"0.44474... | 0.48905343 | 1 |
Get rid of the database again after each test | def tearDown(self):
app.db.drop_database('local')
app.db.close() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def tearDown(self):\n get_connection().drop_database('test_monstor_registration')",
"def teardown():\n teardown_db()",
"def tearDown(self):\n os.close(self.db_fd)\n os.unlink(mainPyUnit.app.config['DATABASE'])",
"def tearDown(self):\n os.close(self.db_fd)\n os.unlink(peg... | [
"0.8635427",
"0.85302615",
"0.8512873",
"0.8491214",
"0.84900934",
"0.8465409",
"0.8465409",
"0.8465091",
"0.8465091",
"0.8465091",
"0.8465091",
"0.8465091",
"0.8465091",
"0.8444213",
"0.8435058",
"0.8433075",
"0.8433075",
"0.8433075",
"0.8433075",
"0.8433075",
"0.8433075",
... | 0.8665355 | 0 |
Set up the test environment | def setUp(self):
self.p = Process(target = start_server)
self.p.start()
time.sleep(0.5)
#init_fakeDB()
time.sleep(0.5) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def setUp(self):\n test_env_setup()",
"def setUp(self):\n logging.debug('setting up')",
"def setUp(self):\n logging.debug('setting up')",
"def SetupEnvironment(self):\n pass",
"def test_setup(self):\n engine = Engine(self.config_file, self.api_token)\n engine.setup()",... | [
"0.8462402",
"0.7901027",
"0.7901027",
"0.76430875",
"0.7568887",
"0.75533944",
"0.75533944",
"0.75434506",
"0.7449951",
"0.74463314",
"0.743348",
"0.7422664",
"0.73674387",
"0.73409885",
"0.7299797",
"0.72948956",
"0.72942334",
"0.7288436",
"0.72740364",
"0.7256365",
"0.7251... | 0.0 | -1 |
Set up the test environment | def setUp(self):
self.p = Process(target = start_server)
self.p.start()
time.sleep(0.5)
#init_fakeDB()
time.sleep(0.5) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def setUp(self):\n test_env_setup()",
"def setUp(self):\n logging.debug('setting up')",
"def setUp(self):\n logging.debug('setting up')",
"def SetupEnvironment(self):\n pass",
"def test_setup(self):\n engine = Engine(self.config_file, self.api_token)\n engine.setup()",... | [
"0.8462402",
"0.7901027",
"0.7901027",
"0.76430875",
"0.7568887",
"0.75533944",
"0.75533944",
"0.75434506",
"0.7449951",
"0.74463314",
"0.743348",
"0.7422664",
"0.73674387",
"0.73409885",
"0.7299797",
"0.72948956",
"0.72942334",
"0.7288436",
"0.72740364",
"0.7256365",
"0.7251... | 0.0 | -1 |
Set up the test environment | def setUp(self):
self.p = Process(target = start_server)
self.p.start()
time.sleep(0.5) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def setUp(self):\n test_env_setup()",
"def setUp(self):\n logging.debug('setting up')",
"def setUp(self):\n logging.debug('setting up')",
"def SetupEnvironment(self):\n pass",
"def test_setup(self):\n engine = Engine(self.config_file, self.api_token)\n engine.setup()",... | [
"0.8462402",
"0.7901027",
"0.7901027",
"0.76430875",
"0.7568887",
"0.75533944",
"0.75533944",
"0.75434506",
"0.7449951",
"0.74463314",
"0.743348",
"0.7422664",
"0.73674387",
"0.73409885",
"0.7299797",
"0.72948956",
"0.72942334",
"0.7288436",
"0.72740364",
"0.7256365",
"0.7251... | 0.0 | -1 |
Set up the test environment | def setUp(self):
self.p = Process(target = start_server)
self.p.start()
time.sleep(0.5)
#init_fakeDB()
time.sleep(0.5) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def setUp(self):\n test_env_setup()",
"def setUp(self):\n logging.debug('setting up')",
"def setUp(self):\n logging.debug('setting up')",
"def SetupEnvironment(self):\n pass",
"def test_setup(self):\n engine = Engine(self.config_file, self.api_token)\n engine.setup()",... | [
"0.8462402",
"0.7901027",
"0.7901027",
"0.76430875",
"0.7568887",
"0.75533944",
"0.75533944",
"0.75434506",
"0.7449951",
"0.74463314",
"0.743348",
"0.7422664",
"0.73674387",
"0.73409885",
"0.7299797",
"0.72948956",
"0.72942334",
"0.7288436",
"0.72740364",
"0.7256365",
"0.7251... | 0.0 | -1 |
Retrieve this account's balance | def balance(self):
url = self.base_url + 'account/balance'
self.session.headers.update(self.sign(url))
resp = self.session.get(url)
try:
data = resp.json()
data['amount'] = float(data['amount'])
return pd.Series(data)
except:
return... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_balance(self):\n return self._call_account_method(\n 'getBalance'\n )",
"def get_account_balance(self):\n return int(self.request('get', 'fort/accounts')['balance'])",
"def balance(self):\n return self.selectedAccount.balance",
"def get_balance(self):\n r... | [
"0.9096342",
"0.8644239",
"0.86159056",
"0.8613659",
"0.8613659",
"0.86104614",
"0.85760933",
"0.85659987",
"0.846781",
"0.8460991",
"0.84221363",
"0.8387338",
"0.83867824",
"0.83072317",
"0.8306992",
"0.82655466",
"0.8200228",
"0.8135389",
"0.8132846",
"0.8123071",
"0.799796... | 0.80964684 | 20 |
Convert a serialized tf.SequenceExample to Pythonfriendly objects. | def bytestring_to_record(example):
rec = tf.train.SequenceExample.FromString(example)
start_time = rec.context.feature[START_TIME].float_list.value[0]
vid_id = rec.context.feature[VIDEO_ID].bytes_list.value[0].decode('utf-8')
labels = list(rec.context.feature[LABELS].int64_list.value)
data = rec.fea... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def parse_from_sequence_example(serialized,\n list_size=None,\n context_feature_spec=None,\n example_feature_spec=None,\n size_feature_name=None,\n mask_feature... | [
"0.69860625",
"0.69212353",
"0.6836916",
"0.6811884",
"0.6688687",
"0.65688556",
"0.6488748",
"0.6463299",
"0.646047",
"0.64232635",
"0.6346639",
"0.6328585",
"0.6324548",
"0.6263822",
"0.6250803",
"0.62483793",
"0.62418216",
"0.6224744",
"0.6220646",
"0.621374",
"0.621374",
... | 0.5858557 | 42 |
OMERO ImJoy Home page | def index(request, conn=None, **kwargs):
template = loader.get_template('omero_imjoy/index.html')
html = template.render({}, request)
# update links to static files
static_dir = static.static('omero_imjoy/')
html = html.replace('../../static/omero_imjoy/', static_dir)
return HttpResponse(html) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def home():\n\n\treturn render_template('solai.html')",
"def home():\n return render_template(\n 'index.html',\n title= \"Pi-Lapse\",\n year=datetime.now().year,\n image = Cam.do.GetLastImage(),\n \n )",
"def home():\n\n\treturn render_template('index.html', title='Home... | [
"0.7841213",
"0.7718347",
"0.7703824",
"0.7693142",
"0.7616897",
"0.7603047",
"0.7568917",
"0.7534567",
"0.75194997",
"0.751919",
"0.7517772",
"0.7502078",
"0.7500815",
"0.74822986",
"0.7463305",
"0.7420754",
"0.74199873",
"0.74199873",
"0.74199873",
"0.74199873",
"0.74199873... | 0.0 | -1 |
Centers the piezos specified by ADDR in order to keep track of position. This will run the piezos through their full movement range. Make sure this is only called with no sensitive sample and be destroyed. | def center(self,c, ADDR):
#FIGURE OUT HOW TO DO THIS
#Actually pretty sure this is impossible to do from software
returnValue('Success!') | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def center_on_spawn(self):\n self.center_on(*self.world.metadata['playerStart'])",
"def do_polar_alignment_test(self, *arg):\n if self.ready is False:\n return\n\n start_time = current_time(flatten=True)\n\n base_dir = '{}/images/drift_align/{}'.format(\n os.gete... | [
"0.5961",
"0.57463413",
"0.56795865",
"0.5533931",
"0.54940224",
"0.5443845",
"0.5440208",
"0.543193",
"0.541925",
"0.53592706",
"0.53592706",
"0.53461343",
"0.53208303",
"0.5320681",
"0.5311021",
"0.5308331",
"0.52896976",
"0.52896976",
"0.52896976",
"0.52491367",
"0.5239588... | 0.62783 | 0 |
Convert the underlying to text and load the file as sentences. | def convertToText(self):
documentType = self._getDocumentType()
self.tempFilePath = self.getTempFilePath()
callback = getattr(self, TextRepresentation.KNOWNTYPES[documentType])
#Call function to convert
callback(self.sourceFileName, self.tempFilePath, self.logDir)
retu... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def txt_to_sentences(file_title):\n with open(file_title, \"r\") as text:\n # Preprocessing from text\n text = str(text.read())\n text=textacy.preprocess.normalize_whitespace(text)\n text=textacy.preprocess.fix_bad_unicode(text, normalization=u'NFKC')\n text=textacy.preprocess... | [
"0.67194766",
"0.65194786",
"0.64508986",
"0.6437336",
"0.6379965",
"0.63428223",
"0.6338746",
"0.63151884",
"0.62218976",
"0.6213592",
"0.61749774",
"0.6150482",
"0.6149195",
"0.61092836",
"0.6106842",
"0.6090193",
"0.6055045",
"0.6046375",
"0.6029996",
"0.6010997",
"0.59952... | 0.5529239 | 48 |
Return the type of the underlying document. Raise an exception when unknown. | def _getDocumentType(self):
fileName, fileExtension = os.path.splitext(self.sourceFileName)
documentType = None
for knownType in list(TextRepresentation.KNOWNTYPES.keys()):
if knownType == fileExtension[1:]:
documentType = knownType
if documentType is None:... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_doc_type(self):\n if not self.is_documented():\n return DocType.none\n if self._rawdoc.is_local():\n return DocType.internal\n return self._rawdoc.get_visibility()",
"def document_type(self) -> Optional[pulumi.Input[str]]:\n return pulumi.get(self, \"docu... | [
"0.76666296",
"0.7492897",
"0.7062189",
"0.67980164",
"0.66945153",
"0.66379994",
"0.6350302",
"0.6309663",
"0.6273911",
"0.6244093",
"0.6189533",
"0.6183449",
"0.6183449",
"0.6183449",
"0.6183449",
"0.6183449",
"0.6183449",
"0.6183449",
"0.6183449",
"0.6183449",
"0.6183449",... | 0.7964641 | 0 |
Yield successive nsized chunks from l. | def chunks(item_list, n_items):
for i in range(0, len(item_list), n_items):
yield item_list[i : i + n_items] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _chunk(self, l, n):\n for i in range(0, len(l) + 1, n):\n yield l[i:i + n]",
"def chunks(self, l, n):\n for i in range(0, len(l), n):\n yield l[i:i + n]",
"def __chunks(l, n):\n for i in range(0, len(l), n):\n yield l[i:i + n]",
"def get_chunks(self, ... | [
"0.8038813",
"0.79248375",
"0.7923423",
"0.7885103",
"0.78773195",
"0.7815877",
"0.77655786",
"0.77556044",
"0.77441615",
"0.7731815",
"0.77288336",
"0.772473",
"0.77028215",
"0.76889825",
"0.76889825",
"0.7664208",
"0.76570904",
"0.7655856",
"0.7655856",
"0.76458347",
"0.764... | 0.0 | -1 |
Convert time to nicer format | def format_time(value: float) -> str:
if value <= 0.01:
return f"{value * 1000000:.0f}us"
elif value <= 0.1:
return f"{value * 1000:.1f}ms"
elif value > 172800:
return f"{value / 86400:.2f}days"
elif value > 86400:
return f"{value / 86400:.2f}day"
elif value > 1800:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def format_time(self, time):\n hh = time[0:2]\n mm = time[2:4]\n ss = time[4:]\n return \"%s:%s:%s UTC\" % (hh,mm,ss)",
"def format_time(self, time):\n hours = time // 3600\n time = time - hours*3600\n minutes = time // 60\n seconds = time - minutes*60\n ... | [
"0.80129004",
"0.78988254",
"0.76440233",
"0.7631178",
"0.76169336",
"0.75863564",
"0.7541359",
"0.7437214",
"0.7435386",
"0.73983234",
"0.7341927",
"0.73259",
"0.7288419",
"0.7282904",
"0.7261685",
"0.72370905",
"0.7192689",
"0.7190244",
"0.71569574",
"0.7093082",
"0.7067204... | 0.6815024 | 40 |
Get the action method for an Algorithm. If method_name is None, the primary action method is returned (the one listed first in `Algorithm._action_methods`). Otherwise, the action method belonging to the respective name is returned. | def get_action_method(instance: Algorithm, method_name: Optional[str] = None) -> Callable:
method_names = get_action_methods_names(instance)
if method_name is not None:
if method_name not in method_names:
raise ValueError(
"`method_name` must be one of the specified action me... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_method(self, name=None):\n return self.gateway and self.gateway.method or None",
"def _get_action_from_http_method(self, http_method):\n http_method = http_method.lower()\n if http_method == 'get':\n return 'list' if issubclass(self.callback, ListModelMixin) else 'retrieve... | [
"0.6643434",
"0.65293586",
"0.6413036",
"0.62758154",
"0.61746657",
"0.6106306",
"0.6037263",
"0.6004484",
"0.5983328",
"0.59728557",
"0.5909148",
"0.5905452",
"0.5905452",
"0.5890808",
"0.5871449",
"0.5817096",
"0.58095455",
"0.5774518",
"0.57545245",
"0.5741709",
"0.5719946... | 0.8294379 | 0 |
Get the names of all action methods of a class. This basically returns `instance_or_cls._action_method`, but ensures that the return type is a tuple. | def get_action_methods_names(instance_or_cls: Union[Type[Algorithm], Algorithm]) -> Tuple[str, ...]:
method_names = instance_or_cls._action_methods
if isinstance(method_names, str):
method_names = (method_names,)
if not isinstance(method_names, tuple) and len(method_names) == 0:
if isclass(i... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def actions(cls):\n return [m for m in cls.__dict__ if not \"__\" in m]",
"def _methods_of(cls):\n # The idea of unbound methods exists in Python 2 and was removed in\n # Python 3, so \"inspect.ismethod\" is used here for Python 2 and\n # \"inspect.isfunction\" for Python 3.\n all_methods = in... | [
"0.6725654",
"0.67109776",
"0.665491",
"0.64789116",
"0.6402844",
"0.6323588",
"0.6282057",
"0.62751466",
"0.6228913",
"0.61890525",
"0.61869615",
"0.6094848",
"0.6094848",
"0.6094848",
"0.6071644",
"0.6056207",
"0.59731996",
"0.59709716",
"0.5959929",
"0.59402436",
"0.593623... | 0.78314745 | 0 |
Return True if the user is authenticated. | def is_authenticated(self):
return self.authenticated | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_authenticated(self):\n return self.user is not None and self.state == AuthenticationOptions.authenticated",
"def is_authenticated(self):\n return bool(get_auth_token())",
"def is_authenticated(self):\n return True",
"def is_authenticated(self):\n return True",
"def is_aut... | [
"0.8739372",
"0.87086535",
"0.86574197",
"0.86574197",
"0.86574197",
"0.86574197",
"0.86574197",
"0.86574197",
"0.86574197",
"0.8613915",
"0.8609252",
"0.8578436",
"0.83723366",
"0.83587176",
"0.8258534",
"0.82273275",
"0.8209421",
"0.8200795",
"0.8174884",
"0.81280386",
"0.8... | 0.8580474 | 14 |
False, as anonymous users aren't supported. | def is_anonymous(self):
return False | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_anonymous():\n return False",
"def is_anonymous(self):\r\n return False",
"def is_anonymous(self):\n return False",
"def is_anonymous_access_allowed(self):\n return self._is_anonymous_access_allowed",
"def is_authenticated(self):\n return False",
"def _is_anonymous_u... | [
"0.85624325",
"0.83800477",
"0.82456774",
"0.7815806",
"0.7576082",
"0.72904116",
"0.72619915",
"0.72347337",
"0.72347337",
"0.72347337",
"0.72347337",
"0.72347337",
"0.72347337",
"0.72347337",
"0.72338396",
"0.715833",
"0.7106215",
"0.70944613",
"0.70567185",
"0.70209265",
"... | 0.8360155 | 7 |
Return the first_name plus the last_name, with a space in between. | def get_full_name(self):
full_name = '%s %s' % (self.first_name, self.last_name)
return full_name.strip() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def full_name(first_name, last_name):\n return first_name + \" \" + last_name",
"def full_name(first_name, last_name):\n\t\n\treturn first_name + \" \" + last_name",
"def get_formated_name(first_name,last_name):\n\tfull_name = first_name + '' + last_name\n\treturn full_name.title()",
"def get_full_name(se... | [
"0.83426815",
"0.82277966",
"0.81000036",
"0.80675375",
"0.8052557",
"0.8045089",
"0.7994789",
"0.79938424",
"0.79938424",
"0.79938424",
"0.79789525",
"0.79636246",
"0.79567575",
"0.7940001",
"0.79369414",
"0.7934302",
"0.7915374",
"0.79012656",
"0.789294",
"0.7868843",
"0.78... | 0.7786279 | 44 |
Returns whether this side has more Pokemon | def hasPokemon(self):
return self.trainer.hasPokemon() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def hasMorePokemon(self):\r\n return self.trainer.hasMorePokemon(self.pkmnInPlay)",
"def verify_winner(self):\r\n return self.count_pegs() == 1",
"def game_over(self):\n return self.lives() < 0",
"def is_game_over(self):\n\n if len(self.next_pieces) == 0:\n return True"... | [
"0.86962175",
"0.66944605",
"0.6432077",
"0.6378804",
"0.62600136",
"0.6254641",
"0.6234091",
"0.6170001",
"0.6144419",
"0.6124276",
"0.6100488",
"0.6029803",
"0.60084647",
"0.6006607",
"0.60016185",
"0.599479",
"0.59779173",
"0.5945332",
"0.59220695",
"0.5919824",
"0.5894156... | 0.72014064 | 1 |
Returns whether this side has more Pokemon | def hasMorePokemon(self):
return self.trainer.hasMorePokemon(self.pkmnInPlay) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def hasPokemon(self):\r\n return self.trainer.hasPokemon()",
"def verify_winner(self):\r\n return self.count_pegs() == 1",
"def game_over(self):\n return self.lives() < 0",
"def is_game_over(self):\n\n if len(self.next_pieces) == 0:\n return True",
"def check_win(self... | [
"0.72014064",
"0.66944605",
"0.6432077",
"0.6378804",
"0.62600136",
"0.6254641",
"0.6234091",
"0.6170001",
"0.6144419",
"0.6124276",
"0.6100488",
"0.6029803",
"0.60084647",
"0.6006607",
"0.60016185",
"0.599479",
"0.59779173",
"0.5945332",
"0.59220695",
"0.5919824",
"0.5894156... | 0.86962175 | 0 |
Award experience to current pokemon from the opposing pokemon | def awardExperience(self, pkmnToAwardExperienceFrom):
messages = []
for oppPkmn in pkmnToAwardExperienceFrom:
experienceToAward = oppPkmn.experienceToAward
for pkmn in self.pkmnInPlay:
pkmn.gainExperience(experienceToAward)
messages... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def setExperience(self, damage, enemyShip):\n experience = damage/25.0\n if experience > 0:\n self.myCaptain.addExperience(experience)\n enemyShip.myCaptain.addExperience(experience)",
"def addExperience(self, xp):\n self.xp += xp\n if self.xp >= self.xpNeeded:\n... | [
"0.6609874",
"0.64504623",
"0.6317604",
"0.62868273",
"0.62471527",
"0.6237737",
"0.61907333",
"0.61202997",
"0.6075563",
"0.6054324",
"0.5990237",
"0.5950367",
"0.59494257",
"0.5911901",
"0.5909183",
"0.58791596",
"0.58465916",
"0.58418113",
"0.5833303",
"0.5829724",
"0.5790... | 0.6276367 | 4 |
Test whether a point is inside a shape. | def __contains__(self, point):
raise NotImplementedError(f"The `in` operator is not supported for {self.__class__.__name__}") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def isInside(point_x, point_y, area_left, area_top, area_width, area_height):\n return (area_left <= point_x < area_left + area_width) and (area_top <= point_y < area_top + area_height)",
"def point_in_poly(x_point: float, y_point: float) -> bool:\n\n # Semi-F47 extended states all devices should be able t... | [
"0.7589679",
"0.75138474",
"0.7482443",
"0.7358448",
"0.7358448",
"0.73567194",
"0.73437923",
"0.7289954",
"0.72878605",
"0.7240321",
"0.72296786",
"0.72247016",
"0.72247016",
"0.7200582",
"0.71834034",
"0.7176526",
"0.71589625",
"0.7054414",
"0.70256394",
"0.69937503",
"0.69... | 0.0 | -1 |
Force immediate removal of the shape from video memory. It is recommended to call this whenever you delete a shape, as the Python garbage collector will not necessarily call the finalizer as soon as the sprite falls out of scope. | def delete(self):
self._vertex_list.delete()
self._vertex_list = None | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def delete(self):\n if self.shape is not None:\n self.shape.delete()\n if self in shared.obstacles:\n shared.obstacles.remove(self)",
"def delete_current_shape(self):\n print(\"deleting shape!\")\n self.shapes.remove(self.current_shape)\n self.current_shap... | [
"0.72585934",
"0.7258328",
"0.71927154",
"0.7158528",
"0.708528",
"0.6665389",
"0.6597587",
"0.658123",
"0.6475832",
"0.6466081",
"0.6351755",
"0.63158596",
"0.6315534",
"0.6243186",
"0.6231996",
"0.62149495",
"0.6208842",
"0.61833763",
"0.616358",
"0.61588997",
"0.6153983",
... | 0.0 | -1 |
X coordinate of the shape. | def x(self):
return self._x | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_x(self):\n return self.posX",
"def get_x(self):\n return self.coords[0]",
"def x(self):\n return self.coords[0]",
"def x(self):\n return self._coords[0]",
"def x(self):\n return _libsbml.Point_x(self)",
"def get_x_position(self):\n return self.rect.x",
... | [
"0.8276647",
"0.8035536",
"0.8008866",
"0.7973977",
"0.7972035",
"0.7952239",
"0.78675765",
"0.78432226",
"0.7775628",
"0.7743041",
"0.7709887",
"0.7641317",
"0.7586109",
"0.75201356",
"0.7515991",
"0.75143254",
"0.75143254",
"0.7427609",
"0.7414562",
"0.7409221",
"0.7380255"... | 0.68180233 | 58 |
Y coordinate of the shape. | def y(self):
return self._y | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _get_y(self):\n return self.position.y",
"def get_y(self):\n return self.coords[1]",
"def y(self):\n return self.coords[1]",
"def y_coord(self):\n\n return self.y0 + np.arange(self.ny) * self.dy",
"def get_y_position(self): \n return self.rect.y",
"def getY(s... | [
"0.82007444",
"0.8191291",
"0.8183033",
"0.81729805",
"0.81451285",
"0.8121972",
"0.809738",
"0.809738",
"0.8095042",
"0.80938363",
"0.8086142",
"0.80820066",
"0.8081096",
"0.80772156",
"0.8076291",
"0.80641294",
"0.8045392",
"0.80195576",
"0.80112904",
"0.7995767",
"0.795432... | 0.74738795 | 50 |
The X coordinate of the anchor point | def anchor_x(self):
return self._anchor_x | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_x(self):\n return self.posX",
"def _get_x(self):\n return self.position.x",
"def get_x_position(self):\n return self.rect.x",
"def get_x_position(self):\n return self.actual_coordinates[0]",
"def get_x(self):\n return self.coords[0]",
"def get_pos_x(self):\n ... | [
"0.7760154",
"0.7716742",
"0.7668874",
"0.7646122",
"0.7621986",
"0.7559974",
"0.7516883",
"0.75067914",
"0.74623626",
"0.7436206",
"0.74320745",
"0.73874915",
"0.7360508",
"0.7344753",
"0.7308688",
"0.73033357",
"0.724241",
"0.7212631",
"0.71839815",
"0.7164864",
"0.7118556"... | 0.90373385 | 0 |
The Y coordinate of the anchor point | def anchor_y(self):
return self._anchor_y | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _get_y(self):\n return self.position.y",
"def get_y_position(self):\n return self.actual_coordinates[1]",
"def y(self):\r\n return self.position.y",
"def get_y_position(self): \n return self.rect.y",
"def get_alien_y(self):\n return self.y",
"def get_y(self):\n\t... | [
"0.7840486",
"0.775186",
"0.775122",
"0.77391493",
"0.7671916",
"0.7608013",
"0.7590078",
"0.75695264",
"0.74748814",
"0.7469654",
"0.74505246",
"0.7402634",
"0.74024355",
"0.737545",
"0.73700285",
"0.73483944",
"0.7334472",
"0.7331511",
"0.73242426",
"0.72643715",
"0.7259252... | 0.8872084 | 0 |
Create an ellipse. The ellipse's anchor point (x, y) defaults to the center of the ellipse. | def __init__(self, x, y, a, b, segments=None, color=(255, 255, 255, 255),
batch=None, group=None):
self._x = x
self._y = y
self._a = a
self._b = b
# Break with conventions in other _Shape constructors
# because a & b are used as meaningful variable names... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def ellipse(self, x, y, radiusx, radiusy, rotation=0, startangle=0, endangle=2 * pi, anticlockwise=False):\n self._impl.ellipse(x, y, radiusx, radiusy, rotation, startangle, endangle, anticlockwise)",
"def ellipse(self):\n f = self.img\n x = self.x\n y = self.y\n x2 = self.x2\n ... | [
"0.788297",
"0.7785391",
"0.7592239",
"0.7443439",
"0.74134624",
"0.7309733",
"0.7275988",
"0.7241318",
"0.7196454",
"0.7186401",
"0.71822935",
"0.71572214",
"0.71300465",
"0.71043426",
"0.7092093",
"0.70380354",
"0.69873965",
"0.6932016",
"0.69209635",
"0.6864058",
"0.684167... | 0.0 | -1 |
Create a line. The line's anchor point defaults to the center of the line's width on the X axis, and the Y axis. | def __init__(self, x, y, x2, y2, width=1, color=(255, 255, 255, 255),
batch=None, group=None):
self._x = x
self._y = y
self._x2 = x2
self._y2 = y2
self._width = width
self._rotation = math.degrees(math.atan2(y2 - y, x2 - x))
self._num_verts = 6
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _createline(self):\n return self.cv.create_line(0, 0, 0, 0, fill=\"\", width=2,\n capstyle = TK.ROUND)",
"def create_line(self, x1, y1, x2, y2, style=None, parent=None):\n attrs = {'d': 'M %5f %5f L %5f %5f' % (x1, y1, x2, y2)}\n return self.create_path(... | [
"0.71421856",
"0.7064285",
"0.69956726",
"0.67991763",
"0.6763171",
"0.6747035",
"0.6626148",
"0.6619319",
"0.6615298",
"0.6593268",
"0.65812933",
"0.6554291",
"0.6517954",
"0.6512243",
"0.64982325",
"0.64670354",
"0.64449686",
"0.6437621",
"0.6380794",
"0.63729125",
"0.63551... | 0.0 | -1 |
Second X coordinate of the shape. | def x2(self):
return self._x2 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def x(self):\n return self.coords[0]",
"def x(self):\n return self._coords[0]",
"def get_x(self):\n return self.coords[0]",
"def get_x(self):\n return self.posX",
"def x(self):\n return _libsbml.Point_x(self)",
"def getX(self):\n return self.position[0]",
"def ... | [
"0.7359051",
"0.7187756",
"0.7168489",
"0.69707686",
"0.6942189",
"0.6837507",
"0.68207926",
"0.67582655",
"0.67009187",
"0.6699419",
"0.6689745",
"0.6685878",
"0.6685878",
"0.666976",
"0.6643408",
"0.66317666",
"0.66317666",
"0.66295207",
"0.6622472",
"0.6609148",
"0.6591374... | 0.6775998 | 7 |
Second Y coordinate of the shape. | def y2(self):
return self._y2 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_y(self):\n return self.coords[1]",
"def y(self):\n return self.coords[1]",
"def getY(self):\n return self.position[1]",
"def y2(self):\n return self._y + self._y2",
"def y(self):\n return self._coords[1]",
"def getY(self):\n return self.components[1]",
... | [
"0.7872429",
"0.78693813",
"0.7782915",
"0.7754742",
"0.7720238",
"0.7652385",
"0.7652385",
"0.7464382",
"0.74512565",
"0.7414563",
"0.73579174",
"0.73385435",
"0.7291022",
"0.7268712",
"0.72359437",
"0.72359437",
"0.7235302",
"0.7212652",
"0.71936613",
"0.71906084",
"0.71719... | 0.7813753 | 2 |
The rectangle's border color. This property sets the color of the border of a bordered rectangle. The color is specified as an RGB tuple of integers '(red, green, blue)' or an RGBA tuple of integers '(red, green, blue, alpha)`. Setting the alpha on this property will change the alpha of the entire shape, including both... | def border_color(self):
return self._border_rgba | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def border_color(self):\n if self.has_border:\n return Color(self._border_actor.GetProperty().GetColor())\n return None",
"def border_color(self) -> int:\n return self._border_color",
"def borderColor( self ):\n return self._borderColor",
"def set_border(self, color: tu... | [
"0.70855075",
"0.6881495",
"0.65604347",
"0.6481082",
"0.63925225",
"0.62421936",
"0.5909977",
"0.58470607",
"0.58169484",
"0.58093",
"0.5666582",
"0.5656656",
"0.5656656",
"0.56459826",
"0.5612554",
"0.54604846",
"0.54521537",
"0.54230624",
"0.54169893",
"0.5317806",
"0.5285... | 0.72605103 | 0 |
Second X coordinate of the shape. | def x2(self):
return self._x + self._x2 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def x(self):\n return self.coords[0]",
"def x(self):\n return self._coords[0]",
"def get_x(self):\n return self.coords[0]",
"def get_x(self):\n return self.posX",
"def x(self):\n return _libsbml.Point_x(self)",
"def getX(self):\n return self.position[0]",
"def ... | [
"0.7359051",
"0.7187756",
"0.7168489",
"0.69707686",
"0.6942189",
"0.6837507",
"0.68207926",
"0.6775998",
"0.67582655",
"0.67009187",
"0.6699419",
"0.6689745",
"0.6685878",
"0.6685878",
"0.666976",
"0.6643408",
"0.66317666",
"0.66317666",
"0.66295207",
"0.6622472",
"0.6609148... | 0.6163783 | 57 |
Second Y coordinate of the shape. | def y2(self):
return self._y + self._y2 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_y(self):\n return self.coords[1]",
"def y(self):\n return self.coords[1]",
"def y2(self):\n return self._y2",
"def getY(self):\n return self.position[1]",
"def y(self):\n return self._coords[1]",
"def getY(self):\n return self.components[1]",
"def getY(... | [
"0.7872429",
"0.78693813",
"0.7813753",
"0.7782915",
"0.7720238",
"0.7652385",
"0.7652385",
"0.7464382",
"0.74512565",
"0.7414563",
"0.73579174",
"0.73385435",
"0.7291022",
"0.7268712",
"0.72359437",
"0.72359437",
"0.7235302",
"0.7212652",
"0.71936613",
"0.71906084",
"0.71719... | 0.7754742 | 4 |
Third X coordinate of the shape. | def x3(self):
return self._x + self._x3 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def x(self):\n return self.coords[0]",
"def get_x(self):\n return self.coords[0]",
"def x(self):\n return self._coords[0]",
"def get_x(self):\n return self.posX",
"def _get_x(self):\n return self.position.x",
"def x(self):\n return _libsbml.Point_x(self)",
"def... | [
"0.70563585",
"0.6986707",
"0.6912074",
"0.67736113",
"0.66708046",
"0.6601498",
"0.6595005",
"0.65564144",
"0.654688",
"0.646505",
"0.64605474",
"0.64541453",
"0.6450418",
"0.6446166",
"0.64437145",
"0.64261997",
"0.64108616",
"0.64108616",
"0.6409632",
"0.63983107",
"0.6397... | 0.70080376 | 1 |
Third Y coordinate of the shape. | def y3(self):
return self._y + self._y3 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def y(self):\n return self.coords[1]",
"def get_y(self):\n return self.coords[1]",
"def y(self):\n return self._coords[1]",
"def getY(self):\n return self.position[1]",
"def getY(self):\n return self.components[1]",
"def getY(self):\n return self.components[1]",
... | [
"0.7237422",
"0.7184859",
"0.7050024",
"0.7018006",
"0.69789183",
"0.69789183",
"0.6907676",
"0.68496335",
"0.6797792",
"0.67078674",
"0.6696344",
"0.6619756",
"0.66165763",
"0.6595526",
"0.6586894",
"0.65845793",
"0.6581554",
"0.6558877",
"0.6552422",
"0.65516716",
"0.654140... | 0.80560815 | 0 |
Loads an array of variant configuration from the json file found at file_path. | def load_configuration(file_path):
with open(file_path, 'r') as file:
data = json.load(file)
configurations = []
for configuration_data in data:
configuration : Configuration = _from_json(configuration_data, Configuration)
configurations.append(configurati... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def load_from_file(config_path):\n return load_json_file(config_path)",
"def _load_config(path) -> dict:\n with open(path, \"r\") as F:\n return json.load(F)",
"def load_configuration(self, path):\n with open(path) as conf_file:\n if path.name not in self.configuration:\n... | [
"0.6971127",
"0.69440037",
"0.6884107",
"0.6781495",
"0.67147934",
"0.667997",
"0.667997",
"0.65955895",
"0.6577272",
"0.6541512",
"0.6484831",
"0.64210993",
"0.64185685",
"0.6390585",
"0.63819486",
"0.63698316",
"0.6301179",
"0.62971544",
"0.62971544",
"0.6258191",
"0.624744... | 0.7119346 | 0 |
Overridden generics.ListAPIView filter_queryset method for adding the filters applied to this view. Appends filters applied to ListAPIView instance as applied_filters attribute. It fetches the filter from filter_backends by calling its get_applied_filters method. | def filter_queryset(self,queryset):
filters = {}
for backend in list(self.filter_backends):
backendobj = backend()
queryset = backendobj.filter_queryset(self.request, queryset, self)
if hasattr(backendobj,'get_applied_filters'):
filters.update(backendo... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def filter_queryset(self, request, queryset, view):\n applicable_filters, applicable_exclusions = self.build_filters(view, filters=self.get_request_filters(request))\n return self.apply_filters(\n queryset=queryset,\n applicable_filters=self.process_filters(applicable_filters, q... | [
"0.7385087",
"0.71803296",
"0.7033516",
"0.680737",
"0.63917816",
"0.62786853",
"0.617929",
"0.61093765",
"0.6046454",
"0.60307837",
"0.60229003",
"0.59159136",
"0.5895536",
"0.5845616",
"0.5829923",
"0.57707393",
"0.57670784",
"0.56886804",
"0.56798387",
"0.5673339",
"0.5664... | 0.68301713 | 3 |
Transform a list of pairs to a list of actors. | def pairs_to_actors(pairs):
return [Actor(*pair) for pair in pairs] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def pairs_from_list(lights):\n length = len(lights)\n half = int(length / 2)\n offset = 0\n\n centre = None\n if length % 2 == 1:\n centre = lights[half]\n offset = 1\n\n left = lights[:half]\n\n rh_start = half + offset\n right = reversed(lights[rh_start:])\n\n pairs = lis... | [
"0.5782867",
"0.5387652",
"0.5387652",
"0.5387652",
"0.5387652",
"0.5346582",
"0.5274743",
"0.52624696",
"0.5250782",
"0.5221431",
"0.5221431",
"0.52203953",
"0.51859194",
"0.5179453",
"0.5176561",
"0.51732695",
"0.51001984",
"0.50953776",
"0.50728834",
"0.5027792",
"0.493496... | 0.846847 | 0 |
All the logic to move, and the game logic goes here. Normally, you'll call update() on the sprite lists that need it. | def on_update(self, delta_time):
if self.current_state == GAME_RUNNING_PAGE:
self.player_list.update()
wall_hit = arcade.check_for_collision_with_list(self.player_sprite,self.wall_list)
for x in wall_hit:
x.kill()
self.current_state=GAME_OVER_P... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def run_logic(self):\n if not self.game_over:\n # Move all the sprites\n self.all_sprites_list.update()",
"def update(self):\n self.moving_sprites.update() \n self.static_sprites.update()\n self.camera.update(self.player)",
"def update(self):\r\n if self... | [
"0.8133705",
"0.7565484",
"0.7412667",
"0.73869663",
"0.7198199",
"0.71561986",
"0.7143746",
"0.71152645",
"0.7048713",
"0.70228285",
"0.6958293",
"0.69535416",
"0.6950053",
"0.6881053",
"0.6738072",
"0.67365605",
"0.67318773",
"0.6702654",
"0.66943073",
"0.6693727",
"0.66914... | 0.0 | -1 |
Method for setting up the fullname | def fullname(self):
return '{} {}'.format(self.fname,self.lname) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_fullname(self, value):\n self.fullname = value",
"def set_fullname(self, value):\n raise NotImplementedError('set_fullname')",
"def full_name(self,first_name):\n full_name = self.first_name + ' ' + self.last_name\n return full_name",
"def fullname(self):\n return self.fname... | [
"0.799368",
"0.7541357",
"0.7510396",
"0.74507093",
"0.73845243",
"0.73845243",
"0.73845243",
"0.73819816",
"0.7323252",
"0.7312589",
"0.7297851",
"0.7267998",
"0.7216746",
"0.7216746",
"0.7216746",
"0.7205875",
"0.71811813",
"0.716795",
"0.716795",
"0.7139923",
"0.71317744",... | 0.75518876 | 1 |
>>> Vector(2, 3).cross(Vector(5, 7)) 1 | def cross(self, other):
return self.x * other.y - self.y * other.x | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_cross():\n assert_equal(cross(Vector(1, 0, 0), Vector(0, 1, 0)), Vector(0, 0, 1))\n assert_equal(cross(Vector(1, 3, 2), Vector(-1, 1, 0)), Vector(-2, -2, 4))",
"def vec_cross(a,b):\r\n return [a[1] * b[2] - a[2] * b[1],\r\n a[2] * b[0] - a[0] * b[2],\r\n a[0] * b[1] - a[1] * b[0... | [
"0.7982854",
"0.7951557",
"0.775054",
"0.77373976",
"0.76693463",
"0.76353407",
"0.75237465",
"0.7514274",
"0.7464269",
"0.7378309",
"0.7348205",
"0.73161495",
"0.7256305",
"0.7251404",
"0.72499144",
"0.7245446",
"0.7238087",
"0.71785533",
"0.71624714",
"0.71432185",
"0.71309... | 0.63477343 | 56 |
>>> p1, p2 = Point(0, 0), Point(1, 0) >>> seg = LineSegment(p1, p2) >>> seg.param_to_point(0) == p1 True >>> seg.param_to_point(1) == p2 True >>> seg.param_to_point(0.5) == Point(0.5, 0) True | def param_to_point(self, param):
return self.p1 + param * (self.p2 - self.p1) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def point_to_param(self, pt):\n r = self.p2 - self.p1\n return (pt - self.p1).dot(r) / r.square()",
"def dist_to_point(self, point):\n\t\treturn dist_to_line2d_seg((self.a.to_tuple(),self.b.to_tuple()), point.to_tuple())",
"def line_param(point_a, point_b, t):\n new_point = point_a - point_b\n... | [
"0.6876588",
"0.66193455",
"0.6241705",
"0.6213389",
"0.6163717",
"0.6000711",
"0.5991964",
"0.59617895",
"0.5959313",
"0.5918417",
"0.59099036",
"0.58839566",
"0.5865199",
"0.58155835",
"0.5796937",
"0.57824886",
"0.5776108",
"0.57577264",
"0.5738541",
"0.57312596",
"0.57235... | 0.74114805 | 0 |
>>> seg = LineSegment(Point(0, 0), Point(1, 0)) >>> seg.colinear(LineSegment(Point(2, 0), Point(3, 0))) True >>> seg.colinear(LineSegment(Point(0, 1), Point(1, 1))) False >>> seg.colinear(LineSegment(Point(0, 1), Point(1, 2))) False | def colinear(self, other):
p = other.p1
return self.parallel(other) and p == self.param_to_point(self.point_to_param(p)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_colinear(self, b: PointType, c: PointType) -> bool:\n return self.ccw(b, c) == 0",
"def areColinear(self, other):\n perpVect = np.array([-self.vector[c.Y], self.vector[c.X]])\n vect1 = other.end[:2]-self.start[:2]\n vect2 = other.start[:2]-self.start[:2]\n cosTheda1 = (n... | [
"0.67859703",
"0.656271",
"0.61545503",
"0.6131642",
"0.6033287",
"0.5999768",
"0.5947328",
"0.5935549",
"0.5935549",
"0.58827156",
"0.5879508",
"0.5845525",
"0.5841828",
"0.5790273",
"0.5789335",
"0.577223",
"0.57287616",
"0.57274264",
"0.57274264",
"0.5697967",
"0.5691974",... | 0.58885956 | 9 |
Get a cell's bounding box coordinates | def bounding_box(self, index_or_id):
cell_index = self.grid.insure_index(index_or_id)
left = self.cell_size[0] * cell_index[1] + self.origin[0]
top = self.cell_size[1] * cell_index[0] + self.origin[1]
right = left + self.cell_size[0]
bottom = top + self.cell_size[1]
return (left, top, right, bottom) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def boundingBox(self):\n y_max = np.max(self.points[:,0])\n x_max = np.max(self.points[:,1])\n y_min = np.min(self.points[:,0])\n x_min = np.min(self.points[:,1])\n \n return ((x_max, y_max), (x_min, y_min))",
"def bounding_box(self):\n latlon00 = self.ij_to_latlo... | [
"0.7524594",
"0.73899823",
"0.7318858",
"0.72919244",
"0.72919244",
"0.7288416",
"0.72778505",
"0.7215684",
"0.7214053",
"0.7175839",
"0.7171557",
"0.7171143",
"0.7126568",
"0.71247655",
"0.70768714",
"0.70758456",
"0.70705795",
"0.7025306",
"0.7002235",
"0.69995075",
"0.6991... | 0.77145386 | 0 |
Default environment configuration. Can be overloaded in environment implementations, or by calling configure(). | def default_config(cls):
return {
"observation": {
"type": "TimeToCollision"
},
"policy_frequency": 1, # [Hz]
"other_spacecrafts_type": "space_env.spacecraft.behavior.IDMspacecraft",
"screen_width": 600, # [px]
"screen_hei... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_env_config(self):\n self.env_config = {\n # ===== STANDARD ARGUMENTS ======\n \"n_agents\": 4, # Number of non-planner agents\n \"world_size\": [15, 15], # [Height, Width] of the env world\n \"episode_length\": 1000, # Number of time-steps per episode\n... | [
"0.6803968",
"0.66421986",
"0.6624324",
"0.65069413",
"0.6459974",
"0.6433525",
"0.63726366",
"0.63393134",
"0.62451184",
"0.62039214",
"0.6172243",
"0.616362",
"0.61544317",
"0.6149324",
"0.612601",
"0.60623986",
"0.60326356",
"0.6030245",
"0.6028822",
"0.60270494",
"0.60232... | 0.0 | -1 |
Return the reward associated with performing a given action and ending up in the current state. | def _reward(self, action):
raise NotImplementedError | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def step(self, action):\n res = self.reward_table.get(self.curr_state, action)\n\n self.curr_state = res['result']\n\n return res",
"def _get_reward(self, action):\n HIRE_COST = 1 # TODO 7/29/20 - Determine significance of this value\n\n # Lookup the state representation using the cur_sta... | [
"0.81838316",
"0.810044",
"0.8042165",
"0.8030217",
"0.80297923",
"0.8012718",
"0.79599637",
"0.7952822",
"0.76932406",
"0.7685848",
"0.76539856",
"0.75493425",
"0.7532442",
"0.7453679",
"0.7450053",
"0.7443335",
"0.73995954",
"0.73988664",
"0.73345715",
"0.7295285",
"0.72883... | 0.72817045 | 22 |
Close the environment. Will close the environment viewer if it exists. | def close(self):
self.done = True
if self.viewer is not None:
self.viewer.close()
self.viewer = None | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def close(self):\n self._close_viewer_window()\n self.env.close()",
"def close_env(self):\n self.env.close()",
"def close(self): \n\t\tself.env.close()",
"def _close_viewer_window(self):\n # We need to do some strange things here to fix-up flaws in gym\n # pylint: disable=p... | [
"0.8069682",
"0.78172827",
"0.7409746",
"0.6883576",
"0.6680763",
"0.6582399",
"0.6566549",
"0.656468",
"0.6160622",
"0.6155315",
"0.6136101",
"0.6084761",
"0.60813826",
"0.605827",
"0.6031186",
"0.6014079",
"0.5966416",
"0.5933951",
"0.5933951",
"0.5890952",
"0.5868679",
"... | 0.5931163 | 19 |
Get the list of currently available actions. | def get_available_actions(self):
actions = [self.ACTIONS_INDEXES['IDLE']]
# Shall we also restrict LEFT & RIGHT actions ?
if self.spacecraft.velocity_index < self.spacecraft.SPEED_COUNT - 1:
actions.append(self.ACTIONS_INDEXES['FASTER'])
if self.spacecraft.velocity_index > ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_available_actions(self):\n return self.actions",
"def get_list_of_actions(self):\n return self.actions",
"def actions(self):\n return self._action_list",
"def get_actions(self):\n return []",
"def get_actions(self):\n return self.agent.get_actions()",
"def get_a... | [
"0.89735657",
"0.857146",
"0.8398818",
"0.83022237",
"0.8269291",
"0.81440973",
"0.7980035",
"0.7971132",
"0.79682666",
"0.79582536",
"0.79582536",
"0.7873011",
"0.7873011",
"0.7873011",
"0.7784719",
"0.7685387",
"0.7609627",
"0.74687874",
"0.74554574",
"0.7404174",
"0.736347... | 0.749036 | 17 |
Conditionally compare two signals | def conditional_compare(self, condition, **kwargs):
if self._pivot:
result = {self._pivot: {}}
mask = self._parser.solve(condition)
step = kwargs.get("step", "post")
for pivot_val in self._pivot_vals:
a_piv = self._a_data[pivot_val]
b_piv = self._b... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_allows_signal_notify(self):\n b1 = Block()\n b2 = Block()\n self.configure_block(b1, {})\n self.configure_block(b2, {})\n\n b1.notify_signals([Signal(), Signal()])\n b2.notify_signals([Signal()])\n\n # Assert that 3 total signals were captured\n self... | [
"0.6178669",
"0.61623484",
"0.59806013",
"0.597636",
"0.5897018",
"0.57907236",
"0.57749283",
"0.5768288",
"0.57352835",
"0.56807077",
"0.56540644",
"0.5639106",
"0.5611931",
"0.55671096",
"0.5546268",
"0.5528976",
"0.5502016",
"0.5480934",
"0.5480232",
"0.5473795",
"0.540428... | 0.0 | -1 |
Given an ISBN, find the book in the database and return the price, a boolean indicating whether or not | def valid_book(self, info):
self.cursor.execute("SELECT ISBN, title, price, stock FROM book WHERE ISBN=%s", (info['ISBN'],))
for book in self.cursor.fetchall():
return True, float(book[2]), book[1], book[3]
return False, 0, 0, 0 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_book_by_isbn(isbn):\n return Book.get_book(isbn)",
"def isbn_lookup(isbn):\n base = \"https://www.googleapis.com/books/v1/volumes?q=isbn=\"\n# Unfortunately we can't use the superior \"with spam as eggs\" syntax here...\n search = urlopen(base + isbn + \"&prettyprint=false\")\n lines = search... | [
"0.71685046",
"0.7099933",
"0.70221645",
"0.68731934",
"0.6789182",
"0.6749278",
"0.6529551",
"0.65249896",
"0.6510712",
"0.6385392",
"0.63603634",
"0.6330002",
"0.6277765",
"0.6264197",
"0.6224342",
"0.62236404",
"0.6164584",
"0.6158051",
"0.612079",
"0.60699725",
"0.6049452... | 0.72273356 | 0 |
Utility function to check if an order specified by orderNumber has no books associated with it. This is only ever called internally, so no need for validity checks. | def is_empty_order(self, orderNumber):
self.cursor.execute("""SELECT COUNT(*) FROM productof WHERE orderNumber=%s""", (orderNumber,))
if self.cursor.fetchone()[0]:
return False
return True | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def has_book(self, book):\n return self.books.filter(lists_books.c.book_id == book.id).count() > 0",
"def is_book_available(self, book):\n request_url = \"%s?q=%s\" % (self.API_URL, book)\n json_data = self.make_request(request_url)\n if json_data and len(json_data['docs']) >= 1:\n ... | [
"0.5795934",
"0.5631788",
"0.5619639",
"0.56194794",
"0.5501485",
"0.5421667",
"0.52619696",
"0.52269924",
"0.5222976",
"0.51843566",
"0.5094807",
"0.5090388",
"0.49968106",
"0.49886924",
"0.49697027",
"0.49391702",
"0.49239758",
"0.49178872",
"0.48695588",
"0.48668623",
"0.4... | 0.68257135 | 0 |
Given the ISBN of a book, get n relevant information for all comments about that book. | def get_comments(self, isbn, n):
result = []
self.cursor.execute("""SELECT * FROM comment WHERE ISBN=%s ORDER BY avg_usefulness DESC LIMIT %s""",
(str(isbn), n))
for comment in self.cursor.fetchall():
result.append(comment)
return result | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_comments_by_book(self, book_id):\n # Implemented from template for\n # osid.resource.ResourceBinSession.get_resources_by_bin\n mgr = self._get_provider_manager('COMMENTING', local=True)\n lookup_session = mgr.get_comment_lookup_session_for_book(book_id, proxy=self._proxy)\n ... | [
"0.6394735",
"0.58236885",
"0.57772076",
"0.56973577",
"0.566967",
"0.55916137",
"0.5555044",
"0.5552309",
"0.5548011",
"0.54580206",
"0.54438627",
"0.5385552",
"0.5383615",
"0.5363736",
"0.5341239",
"0.5337437",
"0.5321707",
"0.5316787",
"0.5306555",
"0.5299457",
"0.52939415... | 0.79621714 | 0 |
Given a single login ID, see if that customer exists on the database. Return true if so, false if not. | def search_customers(self, loginID):
self.cursor.execute("""SELECT COUNT(*) FROM customercredentials WHERE loginID = %s""", (loginID,))
if self.cursor.fetchone()[0]:
return True
else:
return False | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_customer_id_exist(customer_id) -> bool:\n with MY_CONNECTION as connection:\n cursor = connection.cursor()\n cursor.execute(\"SELECT exists(SELECT 1 FROM Customers WHERE id_customer=?)\", (customer_id,))\n return cursor.fetchone()[0] == 1",
"def is_customer_exists(login, email):\n ... | [
"0.77798474",
"0.76868355",
"0.7255544",
"0.67962533",
"0.67014456",
"0.6624874",
"0.66193676",
"0.65199184",
"0.64875746",
"0.6345606",
"0.6319818",
"0.6297829",
"0.6292088",
"0.6242173",
"0.61170304",
"0.6070107",
"0.6045518",
"0.6015249",
"0.6007035",
"0.5990626",
"0.59881... | 0.77091205 | 1 |
Given a login ID of a manager, remove the manager from the database. Note that the ID passed in to this function is unchecked and so proper validity checks need to be in place. However, this function will only be called after an authority validation has taken place, so we do not need to ensure that the caller is a supe... | def remove_manager(self, loginID):
try:
self.cursor.execute("""SELECT COUNT(*) FROM managercredentials WHERE loginID=%s""", (loginID,))
if not self.cursor.fetchone()[0]:
return False
self.cursor.execute("""DELETE FROM managercredentials WHERE loginID=%s""", (l... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def manager_remove(self, manager):\n self.request('/v1.1/managers/configs/%s' % manager, 'DELETE')",
"def remove_store_manager(user_name: str, store_manager_name: str, store_name: str):\n\n user_name = auth.get_username_from_hash(user_name)\n permission_handler.is_permmited_to(user_name, Action.REMO... | [
"0.6349377",
"0.6214349",
"0.60781866",
"0.59333056",
"0.57762134",
"0.564966",
"0.54429406",
"0.5420275",
"0.54007703",
"0.54007703",
"0.5385557",
"0.53853744",
"0.53794116",
"0.53059447",
"0.5249178",
"0.5243765",
"0.5243492",
"0.52429736",
"0.5232355",
"0.5206753",
"0.5203... | 0.7577217 | 0 |
Processes the tokenized articles and generates a DataFrame Returns pd.DataFrame | def process_wiki_tokenized() -> pd.DataFrame:
text_ids = []
text_string = []
articles = []
text_ids_intro = []
with open(WIKI_ARTICLES_TOKENIZED_PATH, "r") as json_file:
json_list = list(json_file)
for json_str in tqdm(json_list):
result = json.loads(json_str)
sections ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def tokenization(dataframe):\n nlp = English()\n tokenizer = nlp.Defaults.create_tokenizer(nlp)\n stemmer = SnowballStemmer(\"english\")\n\n dataframe.loc[:, \"tokens\"] = dataframe.loc[:, \"content\"].apply(\n lambda cell: [\n token.lemma_\n for token in tokenizer(cell)\n ... | [
"0.65940297",
"0.65564024",
"0.65153795",
"0.64343864",
"0.6338675",
"0.6319045",
"0.62618953",
"0.6175134",
"0.61724496",
"0.6104356",
"0.60394055",
"0.60166335",
"0.5988761",
"0.59751725",
"0.5969283",
"0.59643435",
"0.5955965",
"0.5925812",
"0.592225",
"0.5913911",
"0.5912... | 0.76601696 | 0 |
sign of x, i.e. +1 or 1; returns 1 for x == 0 | def sign(x):
if x >= 0:
return 1
return -1 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sign(x):\n if x >= 0:\n return 1\n else:\n return -1",
"def signum(x: float) -> float:\n if x < 0:\n return -1.0\n elif x > 0:\n return 1.0\n return 0.0",
"def sign(x):\n return(copysign(1, x))",
"def sign(num: float):\n return 1 if num >= 0 else -1",
"d... | [
"0.923454",
"0.83496517",
"0.8333785",
"0.82949734",
"0.8244531",
"0.8236217",
"0.7956602",
"0.78698367",
"0.7838812",
"0.7807624",
"0.75421077",
"0.742348",
"0.74220794",
"0.7420152",
"0.72951996",
"0.7290333",
"0.7282625",
"0.72503245",
"0.71639484",
"0.71388626",
"0.708815... | 0.92341864 | 1 |
given a sklearn confusion matrix (cm), make a nice plot Arguments | def plot_confusion_matrix(cm,
target_names,
title='Confusion matrix',
cmap=None,
normalize=True):
import matplotlib.pyplot as plt
import numpy as np
import itertools
accuracy = np.trace(cm) / np.sum(... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def plot_confusion_matrix(cm, class_names):\n figure = plt.figure(figsize=(10, 10))\n plt.imshow(cm, interpolation='nearest', cmap=plt.cm.Blues)\n plt.title(\"Confusion matrix\")\n plt.colorbar()\n tick_marks = np.arange(len(class_names))\n plt.xticks(tick_marks, class_names, rotation=45)\n plt.yticks(tick_... | [
"0.79997694",
"0.79955804",
"0.7947871",
"0.79360676",
"0.79129595",
"0.7897813",
"0.7879448",
"0.786082",
"0.786082",
"0.78540397",
"0.78501374",
"0.78499055",
"0.78404397",
"0.7835427",
"0.7828328",
"0.78253037",
"0.78049725",
"0.78017557",
"0.77822274",
"0.77789044",
"0.77... | 0.0 | -1 |
Get the indexes that represents this Distribution from the underlying Components | def get_indexes(self):
indexes = []
for c in self.components:
indexes.extend(c.get_indexes())
return indexes | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def indices(self) -> np.ndarray:\n return self.impl.indices",
"def indices(self):\n return self.index.indices",
"def get_indices(self):\r\n return self._indices",
"def getIndices(self):\r\n return self._indices",
"def index(self):\n return self.data.index.values",
"def ... | [
"0.79678136",
"0.78836995",
"0.77245635",
"0.7669747",
"0.7342353",
"0.73129576",
"0.7257382",
"0.7190922",
"0.69870543",
"0.69729394",
"0.68934375",
"0.6891254",
"0.6873979",
"0.6869683",
"0.6851193",
"0.6825982",
"0.6809999",
"0.6809096",
"0.6807874",
"0.67803395",
"0.67631... | 0.8461544 | 0 |
Return all indexes related to this Component under a Distribution | def get_indexes(self):
resources = []
data = self.get_resource_data(type='sources')
data['url'] = constants.URLS['sources'] % data
resources.append(data)
for arch in self.data['arch']:
data = self.get_resource_data(type='packages', arch=arch)
data['url']... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_indexes(self):\n indexes = []\n for c in self.components:\n indexes.extend(c.get_indexes())\n return indexes",
"def indices(self):\n return self.index.indices",
"def indexes(self) -> list:\n return self._indexes",
"def indexes(self):\n return getat... | [
"0.7743007",
"0.74171984",
"0.7224061",
"0.70513254",
"0.70469403",
"0.70112383",
"0.69440746",
"0.6880799",
"0.6840875",
"0.68258244",
"0.6783602",
"0.67748713",
"0.6699125",
"0.6662033",
"0.65337485",
"0.6485765",
"0.6452534",
"0.6425022",
"0.6411856",
"0.6405966",
"0.64024... | 0.5917788 | 64 |
Get the key representing this package | def key(self):
return constants.DEB_KEY % self.to_dict() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def key(self) -> str:\n return pulumi.get(self, \"key\")",
"def key(self) -> str:\n return pulumi.get(self, \"key\")",
"def key(self) -> str:\n return pulumi.get(self, \"key\")",
"def key(self) -> str:\n return pulumi.get(self, \"key\")",
"def key(self) -> str:\n return p... | [
"0.81345165",
"0.81345165",
"0.81345165",
"0.81345165",
"0.81345165",
"0.81345165",
"0.81345165",
"0.81345165",
"0.81345165",
"0.81345165",
"0.81345165",
"0.81345165",
"0.81345165",
"0.81345165",
"0.81345165",
"0.81345165",
"0.81345165",
"0.81345165",
"0.81345165",
"0.81345165"... | 0.79855454 | 65 |
Returns the unit key for this package that will uniquely identify it in Pulp. This is the unique key for the inventoried package in Pulp. | def unit_key(self):
data = self.to_dict()
return self.generate_unit_key(*[data[key] for key in UNIT_KEYS]) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def key(self) -> str:\n return pulumi.get(self, \"key\")",
"def key(self) -> str:\n return pulumi.get(self, \"key\")",
"def key(self) -> str:\n return pulumi.get(self, \"key\")",
"def key(self) -> str:\n return pulumi.get(self, \"key\")",
"def key(self) -> str:\n return p... | [
"0.6798424",
"0.6798424",
"0.6798424",
"0.6798424",
"0.6798424",
"0.6798424",
"0.6798424",
"0.6798424",
"0.6798424",
"0.6798424",
"0.6798424",
"0.6798424",
"0.6798424",
"0.6798424",
"0.6798424",
"0.6798424",
"0.6798424",
"0.6798424",
"0.6798424",
"0.6798424",
"0.6798424",
"... | 0.789188 | 0 |
Replace invalid characters for an Excel sheet name within the ``sheet_name`` with the ``replacement_text``. | def sanitize_excel_sheet_name(sheet_name: str, replacement_text: str = "") -> str:
try:
unicode_sheet_name = _preprocess(sheet_name)
except AttributeError as e:
raise ValueError(e)
modify_sheet_name = __RE_INVALID_EXCEL_SHEET_NAME.sub(replacement_text, unicode_sheet_name)
return modif... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sheet_name(self, name):\n if self.sheet:\n self._newline\n self._cell('')\n\n self._cell(name)\n self.sheet = name",
"def regional_sheet_name(df_column_name):\n\n sheet_name = df_column_name.title().replace('_', '-').replace('-Km2', '-km^2')\n\n # these region... | [
"0.62368625",
"0.5658766",
"0.55839145",
"0.5342836",
"0.52264005",
"0.5170571",
"0.5117008",
"0.49473116",
"0.4930441",
"0.4916277",
"0.49059415",
"0.48987168",
"0.4875026",
"0.4849753",
"0.4812612",
"0.4810664",
"0.47979686",
"0.47912505",
"0.47768623",
"0.4770285",
"0.4766... | 0.85612595 | 0 |
Returns the feature with the lowest entropy given a target variable. | def get_lowest_entropy_feature(self, df=None):
if df is None:
df = self.df
target = self.target
entropies = []
for feature in self.features:
entropies.append(self.get_entropy_df(df=df) - self.get_entropy_feature(feature=feature, df=df))
# Quit growing i... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_entropy_feature(self, feature, df=None):\n if df is None:\n df = self.df\n target = self.target\n\n target_variables = df[target].unique()\n variables = df[feature].unique()\n entropy = 0\n\n # Aggregate entropy for each unique value in 'feature' feature... | [
"0.63987845",
"0.62906563",
"0.62745535",
"0.62361795",
"0.5970269",
"0.58792543",
"0.5835181",
"0.5813218",
"0.57950956",
"0.5747696",
"0.5695478",
"0.5677797",
"0.56756794",
"0.5600471",
"0.5550534",
"0.5540838",
"0.554071",
"0.5539472",
"0.55303925",
"0.5516388",
"0.549865... | 0.74907 | 0 |
Handles Characters tokens Our overridden tokenizer doesn't do anything with entities. However, that means that the serializer will convert all ``&`` in Characters tokens to ``&``. Since we don't want that, we extract entities here and convert them to Entity tokens so the serializer will let them be. | def sanitize_characters(self, token):
data = token.get('data', '')
if not data:
return token
data = INVISIBLE_CHARACTERS_RE.sub(INVISIBLE_REPLACEMENT_CHAR, data)
token['data'] = data
# If there isn't a & in the data, we can return now
if '&' not in data:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def special_tokens(self, ):\n\n if self.tokenizer.bos_token is None or self.tokenizer.eos_token is None:\n special_tokens = self.tokenizer.build_inputs_with_special_tokens([])\n special_tokens_ids = self.tokenizer.convert_ids_to_tokens(special_tokens)\n self.tokenizer.bo... | [
"0.57361805",
"0.5715559",
"0.5693421",
"0.5683378",
"0.5586623",
"0.5558785",
"0.55293304",
"0.5496346",
"0.54673356",
"0.5376477",
"0.5312388",
"0.5287163",
"0.52551013",
"0.5237161",
"0.52218133",
"0.5212501",
"0.5194779",
"0.515802",
"0.5128146",
"0.5125173",
"0.5115463",... | 0.7078704 | 0 |
Load a binary mask from filename into a numpy array. mask The mask image loaded as a numpy array | def load_mask_from_file(filename):
mask = imread(filename)
return mask | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def load_signal_mask(self, path):\n mask = np.load(path)",
"def load_mask(filename):\n nib_image = nib.load(filename)\n mask_affine = nib_image.affine\n\n return preprocess_nib(nib_image, is_mask=True), mask_affine",
"def load_mask(self):\n mask_file = fetch_one_file(self.ica_dir, self._... | [
"0.8149826",
"0.75025517",
"0.7336277",
"0.72396976",
"0.69996434",
"0.69910765",
"0.69326127",
"0.684793",
"0.6726304",
"0.671339",
"0.6681663",
"0.66645074",
"0.6654374",
"0.66409326",
"0.6637058",
"0.66202277",
"0.66072327",
"0.65920156",
"0.65165544",
"0.6504364",
"0.6496... | 0.78713435 | 1 |
Run computation on node performing `op_fun`. `op_fun` has to accept a node as an argument. | def run_op_node(input_data, op_fun, *args):
runtime = get_runtime()
comp_args = []
op_fun_args = []
comp_inputs = []
for idx, data in enumerate(input_data):
if np.isscalar(data):
op_fun_args.append(ng.constant(data, _get_numpy_dtype(data)))
else:
node = ng.par... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def run_op_numeric_data(input_data, op_fun, *args):\n runtime = get_runtime()\n node = op_fun(input_data, *args)\n computation = runtime.computation(node)\n return computation()",
"def __call__(self, tf_node, input_ops):\n op_name = tf_node.op\n\n # if op not handled, gets -1\n n... | [
"0.68987066",
"0.63727605",
"0.61560744",
"0.60866606",
"0.59173733",
"0.589501",
"0.58199143",
"0.56726414",
"0.5670642",
"0.5646401",
"0.5547242",
"0.5536755",
"0.5459274",
"0.5457556",
"0.54173595",
"0.53511155",
"0.534198",
"0.5328317",
"0.53263",
"0.52942103",
"0.5292017... | 0.7836884 | 0 |
Split a list into several chunks, each chunk with a size in sizes | def split_list(l, sizes):
chunks = []
offset = 0
for size in sizes:
chunks.append(l[offset:offset + size])
offset += size
return chunks | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def split_chunk(list, chunk_size):\n for i in range(0, len(list), chunk_size):\n yield list[i:i + chunk_size]",
"def split_to_chunks(of_list, chunk_size):\n assert of_list is not None\n\n for i in range(0, len(of_list), chunk_size):\n yield of_list[i:i + chunk_size]",
"def chunks... | [
"0.866036",
"0.8597093",
"0.8403464",
"0.8357495",
"0.8310283",
"0.82529694",
"0.8243393",
"0.82310057",
"0.82241917",
"0.8224093",
"0.82144535",
"0.8211196",
"0.80145",
"0.7967695",
"0.7949982",
"0.7914108",
"0.78888667",
"0.7879225",
"0.78417414",
"0.7822841",
"0.7818928",
... | 0.85801554 | 2 |
Overload the == operator. | def __eq__(self, other):
return (self.srcList == other.srcList) and (self.tgtList == other.tgtList) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __eq__(self,*args):\r\n pass",
"def __eq__(self,*args):\r\n pass",
"def __eq__(self,*args):\r\n pass",
"def __eq__(self,*args):\r\n pass",
"def __eq__(self,*args):\r\n pass",
"def __eq__(self,*args):\r\n pass",
"def __eq__(self,*args):\r\n pass",
"def __eq__(self,*args):\r\n pass",
"def... | [
"0.7969783",
"0.7969783",
"0.7969783",
"0.7969783",
"0.7969783",
"0.7969783",
"0.7969783",
"0.7969783",
"0.7969783",
"0.7969783",
"0.7969783",
"0.7969783",
"0.7969783",
"0.7969783",
"0.7969783",
"0.7969783",
"0.7969783",
"0.7969783",
"0.7969783",
"0.7969783",
"0.7935451",
"... | 0.0 | -1 |
Renders the home page. | def interested_act(request):
assert isinstance(request, HttpRequest)
return render(
request,
'app/interested.html',
context_instance=RequestContext(request,
{
'title': 'Which Act are you interested in?',
'year': datetime.now().year,
})
) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def render_home():\r\n\treturn render_template(\"index.html\")",
"def home():\n\n return render_template('home_page.html')",
"def home():\n\n return render_template(\"home.html\")",
"def home():\n return render_template('home.html')",
"def home():\n return render_template('home.html')",
"def ... | [
"0.85574406",
"0.853399",
"0.8351404",
"0.82762724",
"0.82762724",
"0.82762724",
"0.82762724",
"0.82762724",
"0.82762724",
"0.82762724",
"0.82762724",
"0.82762724",
"0.82762724",
"0.82762724",
"0.82762724",
"0.82762724",
"0.82762724",
"0.82762724",
"0.82762724",
"0.827363",
"... | 0.0 | -1 |
Renders the about page. | def about(request):
assert isinstance(request, HttpRequest)
return render(
request,
'app/about.html',
context_instance=RequestContext(request,
{
'title': 'See how you have voted and how the envoys did.',
'message': 'Votes.',
'year': datetim... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def about():\n return render_template('about.html', title='About')",
"def about():\n\n return render_template('about_page.html', title='About')",
"def about():\n\n\treturn render_template(\"about.html\")",
"def on_about(self):\n render_about_window()",
"def about():\n return render_temp... | [
"0.85650355",
"0.85034525",
"0.84489655",
"0.84044397",
"0.8394454",
"0.82935613",
"0.82709616",
"0.82709616",
"0.82709616",
"0.82709616",
"0.82709616",
"0.82709616",
"0.82709616",
"0.82709616",
"0.82709616",
"0.82709616",
"0.82709616",
"0.82709616",
"0.82709616",
"0.82680845",... | 0.74320537 | 90 |
returns the oppistit on not equal | def __ne__(self, other):
return super().__eq__(other) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def ne (self, other):\n return not (self == other) # opposite of eq",
"def __neq__(self, other): \n return not self == other",
"def not_equal(lhs, rhs):\n return _make.not_equal(lhs, rhs)",
"def test_not_equal_on_not_equal_value(self):\n a = objects.OpaqueObject(se... | [
"0.7580366",
"0.73127854",
"0.72625273",
"0.7180961",
"0.71597457",
"0.7159286",
"0.71311957",
"0.7123226",
"0.71168965",
"0.7097498",
"0.7086671",
"0.7083117",
"0.7077567",
"0.7063802",
"0.7044827",
"0.7044827",
"0.70439744",
"0.7024379",
"0.7019813",
"0.70122015",
"0.70056"... | 0.0 | -1 |
If there are no date set for date_to, automatically set one day later than the date_from. Also update the number_of_days. | def _onchange_date_from(self):
date_from = self.date_from
date_to = self.date_to
self.compute_valid_leaves_for_employee(date_from, date_to)
# policy_id = self.env['leaves.policy'].sudo().search(
# [('leave_type', '=', self.holiday_status_id.id), ('company_id', '=', self.env.user.company_id.id)])
# if date... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def date_to(self, date_to):\n\n self._date_to = date_to",
"def _set_days_until_triage(self):\n if self.sla_triaged_at:\n btd = dates.businesstimedelta(self.created_at, self.sla_triaged_at)\n self.days_until_triage = btd.days\n else:\n self.days_until_triage =... | [
"0.6600826",
"0.62123364",
"0.60784036",
"0.6028921",
"0.6023509",
"0.58135504",
"0.5699685",
"0.56320995",
"0.5561258",
"0.55328417",
"0.55286765",
"0.551658",
"0.55129164",
"0.5464243",
"0.5361167",
"0.5355377",
"0.5281642",
"0.5279441",
"0.5274924",
"0.5264698",
"0.5257835... | 0.6646776 | 0 |
Get account balance for address at a given block number | def get_balance_by_block(address, block_num, endpoint=_default_endpoint, timeout=_default_timeout) -> int:
method = 'hmy_getBalanceByBlockNumber'
params = [
address,
str(hex(block_num))
]
balance = rpc_request(method, params=params, endpoint=endpoint, timeout=timeout)['result']
try:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_balance(self, address):\n balance = 0\n for block in self.chain:\n for t in block['transactions']:\n if t['recipient'] == address:\n balance += t['amount']\n elif t['sender'] == address:\n balance -= t['amount']\n ... | [
"0.7753831",
"0.76965743",
"0.75815",
"0.7496749",
"0.7283361",
"0.7160326",
"0.713291",
"0.6988025",
"0.6978337",
"0.6957172",
"0.69118226",
"0.6904677",
"0.68739074",
"0.68685806",
"0.6836331",
"0.6831155",
"0.6781547",
"0.6766959",
"0.67386377",
"0.65896213",
"0.655743",
... | 0.7808565 | 0 |
Get the account nonce | def get_account_nonce(address, true_nonce=False, endpoint=_default_endpoint, timeout=_default_timeout) -> int:
method = 'hmy_getTransactionCount'
params = [
address,
'latest' if true_nonce else 'pending'
]
nonce = rpc_request(method, params=params, endpoint=endpoint, timeout=timeout)['re... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _get_nonce():\n return uuid.uuid4().get_hex()",
"def get_nonce(self, address):\n nonce = self.web3_object.eth.getTransactionCount(address)\n return nonce",
"def _nonce():\n return str(round(100000 * time.time()) * 2)",
"def nonce():\n return random.randint(0, 4294967295)",
... | [
"0.7988176",
"0.74028945",
"0.73631144",
"0.7291806",
"0.7291806",
"0.7222523",
"0.7058768",
"0.6980467",
"0.6877853",
"0.6827993",
"0.68213224",
"0.68107736",
"0.6794774",
"0.675479",
"0.6747388",
"0.6741569",
"0.673513",
"0.673513",
"0.6306039",
"0.6287999",
"0.6246649",
... | 0.7158861 | 6 |
Get total account balance on all shards | def get_total_balance(address, endpoint=_default_endpoint, timeout=_default_timeout) -> int:
try:
balances = get_balance_on_all_shards(address, skip_error=False, endpoint=endpoint, timeout=timeout)
return sum(b['balance'] for b in balances)
except TypeError as e:
raise RuntimeError from ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_balance(self):\n balance = 0\n for transaction in self.ledger:\n balance += transaction[\"amount\"]\n return balance",
"def get_balance(self, acc: Account) -> Decimal:\n return sum_queryset(self.get_entries(acc))",
"def total_balance(self):\n from client.mo... | [
"0.7123995",
"0.6997436",
"0.6989005",
"0.68699634",
"0.6859426",
"0.6833947",
"0.6811372",
"0.678088",
"0.6731106",
"0.66955906",
"0.6694907",
"0.6624982",
"0.6567748",
"0.65517455",
"0.6546426",
"0.6545334",
"0.6532146",
"0.6531124",
"0.6516377",
"0.65080374",
"0.65071356",... | 0.6797264 | 7 |
A stateless hiring environment. | def __init__(self, max_steps_per_episode):
self.__version__ = "0.0.1"
logging.info("StatelessHiring Version {}".format(self.__version__))
self.max_steps_per_episode = max_steps_per_episode
self.cur_episode = -1 # Set to -1 b/c reset() adds 1 to episode
self.action_episode_memo... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def make_env():\n return {\n 'init': init,\n 'step': step,\n 'is_terminal': is_terminal,\n 'state_as_example': state_as_example,\n }",
"def get_spontaneous_environment(cls: t.Type[_env_bound], *args: t.Any) -> _env_bound:\n env = cls(*args)\n env.shared = True\n return env",
"def... | [
"0.6425967",
"0.63813204",
"0.6186425",
"0.6125666",
"0.6007832",
"0.5997419",
"0.59638447",
"0.595465",
"0.59478444",
"0.588814",
"0.5868051",
"0.5868051",
"0.5864738",
"0.5864738",
"0.58233875",
"0.58233875",
"0.5808273",
"0.57851243",
"0.57689375",
"0.5760726",
"0.5742518"... | 0.0 | -1 |
Returns the probability of transitioning into state s1 after taking action a in state s. | def _transition_probability(self, s, a, s1):
unreachable_states = [4, # F with prod_score == 4
5] # M with prod_score == 0
if s1 in unreachable_states:
return 0
else:
return 1 / (self.n_states - len(unreachable_states)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_transition_prob(self, state, action, next_state):\n return self.get_next_states(state, action).get(next_state, 0.0)",
"def _transition_prob(self, s1, a, s2):\n if self._stochsatic:\n return self._dynamics_noise_distribution.pdf(s2 - (s1 + a))\n else:\n return s2... | [
"0.74151826",
"0.74038136",
"0.7240678",
"0.66807497",
"0.6644237",
"0.65863276",
"0.63309807",
"0.63219106",
"0.6308571",
"0.62739587",
"0.62624675",
"0.6239656",
"0.62317383",
"0.62011445",
"0.615554",
"0.6150811",
"0.61338043",
"0.61216384",
"0.61120576",
"0.6089495",
"0.6... | 0.8406897 | 0 |
Returns the reward based on the current state and action. | def _get_reward(self, action):
HIRE_COST = 1 # TODO 7/29/20 - Determine significance of this value
# Lookup the state representation using the cur_state index. Then we
# can get the candidate productivity score.
obs = self.observation_function[self.cur_state]
prod_score = obs[1... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_reward(self, state, action, next_state):\n assert action in self.get_possible_actions(state), \"cannot do action %s from state %s\" % (action, state)\n return self._rewards.get(state, {}).get(action, {}).get(next_state, 0.0)",
"def get_reward(self, state, action, next_state):\n asser... | [
"0.83489394",
"0.8345518",
"0.8345264",
"0.80545115",
"0.7933965",
"0.78576434",
"0.78538",
"0.7821565",
"0.7701735",
"0.7699051",
"0.76736003",
"0.76672596",
"0.7606079",
"0.7555623",
"0.7512842",
"0.7488136",
"0.7451942",
"0.7410796",
"0.7365984",
"0.73589027",
"0.73541266"... | 0.8115215 | 3 |
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 |
Return tzaware datetime in UTC from any datetime. | def ensure_utc_time(ts: datetime) -> datetime:
if ts.tzinfo is None:
return datetime(*ts.timetuple()[:6], tzinfo=UTC_TZ)
elif str(ts.tzinfo) != str(UTC_TZ):
return ts.astimezone(UTC_TZ)
return ts | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def utcnow() -> datetime.datetime:\n return datetime.datetime.utcnow().replace(tzinfo=pytz.UTC)",
"def now_utc() -> datetime:\n return datetime.now(timezone.utc)",
"def datetime_utc_now() -> datetime:\n return datetime.now(timezone.utc)",
"def utcnow():\n return datetime.utcnow().replace(tzinfo=U... | [
"0.7361551",
"0.7338035",
"0.73155636",
"0.7218638",
"0.72161627",
"0.71456766",
"0.71318316",
"0.70710576",
"0.70639324",
"0.70589685",
"0.7055601",
"0.70404977",
"0.70230174",
"0.6988675",
"0.6940133",
"0.69221324",
"0.691774",
"0.6905108",
"0.68469954",
"0.6809875",
"0.679... | 0.69720125 | 14 |
Compute the Cross Entropy | def cross_entropy(predictions, targets):
likelihood = targets * np.log(predictions)
return -np.sum(likelihood) / predictions.shape[0] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getCrossEntropy(visible, PDF):\n\n\tndocs = visible.shape[0]\n\tCrossEnt = numpy.zeros((ndocs,))\n\tfor doc in xrange(ndocs):\n\t\tCrossEnt[doc] = numpy.dot(visible[doc], numpy.log(PDF[doc]))\n\n\treturn CrossEnt.mean()",
"def cEntropy(Y, X):\n return jEntropy(Y, X) - entropy(X)",
"def cross_entropy(sel... | [
"0.6981777",
"0.69141626",
"0.68044263",
"0.6800669",
"0.668617",
"0.6592355",
"0.6508985",
"0.6393592",
"0.63179004",
"0.62691224",
"0.62642854",
"0.6259557",
"0.62214375",
"0.6166848",
"0.61451244",
"0.6130613",
"0.60915697",
"0.6048444",
"0.60356593",
"0.60195506",
"0.6014... | 0.60667014 | 17 |
get number of pending messages | def get_pending_messages():
global logger
try:
connection = pika.BlockingConnection(pika.ConnectionParameters(rabbit_host))
except:
msg = "exception 1 in connecting"
logger.debug(msg)
# print(msg)
time.sleep(3)
try:
connection = pika.BlockingConnec... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def num_pending_messages(self):\n if self.connected:\n return len(self.messenger.num_pending_messages())\n return 0",
"def message_count(self):\n pass",
"def get_message_count(self):\n return self.buffer.count()",
"def message_count(self):\n return len(self.messa... | [
"0.8082381",
"0.78353876",
"0.77027285",
"0.7678372",
"0.7629694",
"0.75577796",
"0.7479228",
"0.7338583",
"0.7331026",
"0.73034626",
"0.71968514",
"0.71498567",
"0.70336264",
"0.69513893",
"0.69513893",
"0.68732166",
"0.68320066",
"0.68020177",
"0.6788629",
"0.67844796",
"0.... | 0.6978193 | 13 |
Get the environment variable or return exception. | def get_env_variable(var_name, default_value=None):
try:
return os.environ[var_name]
except KeyError:
error_msg = 'Set the {} environment variable'.format(var_name)
if default_value is not None:
return default_value
raise ValueError(error_msg) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_env_or_exception(key):\n \n value = os.getenv(key)\n if value is None:\n raise ImproperlyConfigured(f'{key} env variable is not set')\n\n return value",
"def getenv_or_raise_exception(varname) -> str:\n\n env = os.getenv(varname)\n if env is None:\n raise EnvironmentError(... | [
"0.81081504",
"0.8025601",
"0.7931444",
"0.78133",
"0.77460474",
"0.76776326",
"0.75771964",
"0.75024694",
"0.7465118",
"0.74535567",
"0.7443127",
"0.74410784",
"0.74276656",
"0.7413525",
"0.7365034",
"0.7326807",
"0.7306",
"0.728447",
"0.72441816",
"0.7209517",
"0.7198228",
... | 0.69101536 | 31 |
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 |
Append edge to the list of edges | def addEdge(self, edge: Edge):
self.edges.append(edge) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def addEdges(self, edges):\n for edge in edges:\n self.addEdge(edge[0], edge[1], edge[2])",
"def addEdgeList(self, edges):\n for e in edges:\n self.addEdge(e[0], e[1], e[2] if len(e) > 2 else None)",
"def add_edge(self, ed):\n self.edge.append(ed)\n self.update_node2edge... | [
"0.7990142",
"0.7987694",
"0.7961325",
"0.7813982",
"0.7763563",
"0.7705153",
"0.76647305",
"0.7558912",
"0.7541393",
"0.7521278",
"0.74358064",
"0.7356218",
"0.73470163",
"0.73409593",
"0.733222",
"0.7326916",
"0.7294536",
"0.7289014",
"0.72776794",
"0.7230763",
"0.7226753",... | 0.757209 | 7 |
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 type of the provided datum. | def emits(self):
return type(data) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def datatype(self):\n # datatype is type of first dataarg\n return self[self.dataargs()[0]].typename",
"def data_type():\n return DataTypeUtil.getDTypeForName(DataTypeUtil.getDtypeFromContext())",
"def datatype(parameter):\n return type(parameter)",
"def data_type(self) -> int:\n r... | [
"0.7314993",
"0.6980368",
"0.68978256",
"0.6881237",
"0.67947894",
"0.6772925",
"0.6751424",
"0.67486244",
"0.67111844",
"0.67111844",
"0.67111844",
"0.6698637",
"0.66033596",
"0.65446764",
"0.64952815",
"0.64438653",
"0.640069",
"0.6400567",
"0.6377318",
"0.6374944",
"0.6368... | 0.0 | -1 |
Return the datum associated with this source. | def get_input_data(self, name='0'):
return data | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def data(self):\n return self.d",
"def data(self) -> datetime:\n return self._data",
"def getValue(self):\n return self._row[self.name]",
"def source(self) -> DatasetSource:\n return self._source",
"def get_source(self):\n return self.source",
"def value(self):\n ... | [
"0.6734834",
"0.6498062",
"0.6274143",
"0.6259941",
"0.6216677",
"0.61842483",
"0.6183805",
"0.6183805",
"0.6183805",
"0.61810505",
"0.6145862",
"0.6143409",
"0.6141276",
"0.61391455",
"0.61391455",
"0.61391455",
"0.61391455",
"0.613622",
"0.61293685",
"0.6116139",
"0.6092123... | 0.0 | -1 |
Handler for timestamp fields. Returns string field instead of datetime. | def timestamp_constructor(loader, node):
assert loader # unused variable
return node.value | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_evaluated_time_field(self):\n return \"timestamp\"",
"def timestamp_field_name(self) -> Optional[str]:\n return pulumi.get(self, \"timestamp_field_name\")",
"def get_timestamp(self, data):\n timestamp = data['timestamp']\n return timestamp",
"def timestamp_field(self) -> '... | [
"0.683566",
"0.6813921",
"0.6745139",
"0.6656104",
"0.6555243",
"0.65229887",
"0.65121496",
"0.64917535",
"0.64321524",
"0.64279103",
"0.6388809",
"0.63433546",
"0.6342772",
"0.631025",
"0.63029295",
"0.6290966",
"0.62454",
"0.6242625",
"0.62159985",
"0.6197407",
"0.6165866",... | 0.0 | -1 |
Fixes the value of model parameters, and effectively removes them as a parameter from the model. Fixing the value of a parameter to ``None``, sets the parameter free again. | def fix_parameters(self, name_value_dict):
# Check type of dictionanry
try:
name_value_dict = dict(name_value_dict)
except (TypeError, ValueError):
raise ValueError(
'The name-value dictionary has to be convertable to a python '
'dictionary... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def reset_parameter(self, force=None):\n\n # Set self to a new ExoParameter using the original self.template\n # dictionary. This will reset a parameter that has a null value or\n # it can be forced to reset.\n if (is_empty(self.value) or force):\n self = ExoParameter(self.p... | [
"0.69468033",
"0.6632884",
"0.64295924",
"0.63947606",
"0.6353527",
"0.63487816",
"0.63466763",
"0.6263136",
"0.6260546",
"0.6260546",
"0.6231518",
"0.62077385",
"0.6162442",
"0.61502075",
"0.6122209",
"0.60921353",
"0.6089457",
"0.60774493",
"0.607446",
"0.6067261",
"0.60668... | 0.587346 | 42 |
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 |
Stop the given component. Returns True on success, False if the component was already stopped or if there was a problem stopping. | def stopComponent(self, opts):
screen = self.findScreen(opts.verbose)
if screen == None:
print("No screen session named %s to stop" % self._screenName, file=sys.stderr)
return False
print("Stopping screen instance %s" % screen)
(autoRestartPid, comm) = execCmd(... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def stop(self) -> bool:\n return self._sendcommand(STOP_KEY, self._retry_count)",
"def stop(self):\n self._stopped = True\n return self._stopped",
"def stop(self) -> \"bool\":\n return _beamforming_swig.doaesprit_sptr_stop(self)",
"def stop(self) -> \"bool\":\n return _beam... | [
"0.64490205",
"0.6347221",
"0.62039965",
"0.61796135",
"0.6052097",
"0.59939206",
"0.59242445",
"0.58957726",
"0.5869598",
"0.5854005",
"0.5849062",
"0.5830242",
"0.58001673",
"0.57724124",
"0.5770689",
"0.5760964",
"0.57143116",
"0.57120156",
"0.57022357",
"0.5694165",
"0.56... | 0.58870494 | 8 |
Return a Ruckus Unleashed mock config entry. | def mock_config_entry() -> MockConfigEntry:
return MockConfigEntry(
domain=DOMAIN,
title=DEFAULT_TITLE,
unique_id=DEFAULT_UNIQUE_ID,
data=CONFIG,
options=None,
) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def mock_config_entry() -> MockConfigEntry:\n return MockConfigEntry(\n title=\"homeassistant.github\",\n domain=DOMAIN,\n data={CONF_TAILNET: \"homeassistant.github\", CONF_API_KEY: \"tskey-MOCK\"},\n unique_id=\"homeassistant.github\",\n )",
"def mock_config_entry() -> MockCon... | [
"0.7926965",
"0.77140105",
"0.7540763",
"0.68300676",
"0.65489256",
"0.6486702",
"0.63965756",
"0.6303714",
"0.6288768",
"0.6247454",
"0.6247454",
"0.62078905",
"0.6159095",
"0.615114",
"0.61378974",
"0.61092895",
"0.6096062",
"0.60828424",
"0.6070139",
"0.6036209",
"0.603028... | 0.7598959 | 2 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.