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 |
|---|---|---|---|---|---|---|
Returns the subnets that the remote peer should route to this peer | def allowed_ips(self):
return value_list_to_comma('AllowedIPs', self._peer.allowed_ips) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def subnets(self) -> Sequence[str]:\n return pulumi.get(self, \"subnets\")",
"def subnets(self) -> pulumi.Output[Sequence[str]]:\n return pulumi.get(self, \"subnets\")",
"def subnets(self) -> pulumi.Output[Sequence[str]]:\n return pulumi.get(self, \"subnets\")",
"def subnets(self) -> pul... | [
"0.73930836",
"0.7311778",
"0.7311778",
"0.71330506",
"0.70572346",
"0.70293474",
"0.6949283",
"0.6912506",
"0.6805927",
"0.67589325",
"0.66970825",
"0.65697587",
"0.6564543",
"0.6564543",
"0.6379604",
"0.62316245",
"0.61608213",
"0.61302614",
"0.6058368",
"0.6019482",
"0.601... | 0.0 | -1 |
Returns the PostUp settings of the given peer for the config file | def post_up(self):
return value_list_to_multiple('PostUp', self._peer.post_up) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def remote_config(self):\n\n data = ['[Peer]']\n for item in PEER_KEYS:\n value = getattr(self, item, None)\n if value:\n data.append(value)\n\n return '''\n'''.join(data)",
"def _get_settings():\n # store_last_good=True tells config component to update ... | [
"0.5822991",
"0.5461309",
"0.53176457",
"0.51256543",
"0.50912094",
"0.5023897",
"0.5015351",
"0.49724978",
"0.49553242",
"0.49315155",
"0.4930243",
"0.49047458",
"0.48971367",
"0.48672646",
"0.4863753",
"0.4856097",
"0.4846302",
"0.48128012",
"0.47966596",
"0.47933033",
"0.4... | 0.0 | -1 |
Returns the PostDown settings of the given peer for the config file | def post_down(self):
return value_list_to_multiple('PostDown', self._peer.post_down) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def remote_config(self):\n\n data = ['[Peer]']\n for item in PEER_KEYS:\n value = getattr(self, item, None)\n if value:\n data.append(value)\n\n return '''\n'''.join(data)",
"def _get_settings():\n # store_last_good=True tells config component to update ... | [
"0.5796878",
"0.5648285",
"0.5428934",
"0.52536035",
"0.5247753",
"0.5177034",
"0.5162557",
"0.51596415",
"0.51302874",
"0.5104081",
"0.50998104",
"0.5095664",
"0.50832874",
"0.50761133",
"0.5043017",
"0.5023003",
"0.49949503",
"0.49917412",
"0.4942007",
"0.49409255",
"0.4919... | 0.0 | -1 |
Returns the SaveConfig for this peer | def save_config(self):
value = 'true' if self._peer.save_config else 'false'
return f'SaveConfig = {value}' | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def saved_config(self, **kwargs):\n\n return self.api_request(self._get_method_fullname(\"saved_config\"), kwargs)",
"def save(self):\n with open(self._CONFIG_FILE_PATH, 'w') as config_file:\n json.dump(vars(self), config_file)\n return self._CONFIG_FILE_PATH",
"def save_config(... | [
"0.7084808",
"0.67578864",
"0.6601597",
"0.6295522",
"0.6275811",
"0.6173311",
"0.6140448",
"0.60871625",
"0.6083134",
"0.6066799",
"0.606647",
"0.60254496",
"0.6022039",
"0.59883076",
"0.59839165",
"0.5972283",
"0.59318954",
"0.5921023",
"0.59064406",
"0.59064406",
"0.588726... | 0.68601465 | 1 |
Returns the Address for this peer | def address(self):
return f'Address = {self._peer.address}/{self._peer.address.max_prefixlen}' | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_address(self):\n \n return self._addr",
"def get_address(self):\n \n return self._addr",
"def get_address(self):\n \n if self._addr == None:\n return self._socket.getpeername()\n return self._addr",
"def get_address(self):\n if self.a... | [
"0.85601544",
"0.85601544",
"0.8172367",
"0.80737",
"0.80052894",
"0.7927694",
"0.79177886",
"0.78416497",
"0.78416497",
"0.78416497",
"0.78416497",
"0.78416497",
"0.783187",
"0.782944",
"0.7754805",
"0.7667694",
"0.7642996",
"0.7642996",
"0.7598375",
"0.7578284",
"0.757777",... | 0.71210897 | 37 |
Returns the Peer section for use in a remote peer's config file | def remote_config(self):
data = ['[Peer]']
for item in PEER_KEYS:
value = getattr(self, item, None)
if value:
data.append(value)
return '''
'''.join(data) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def peer(peer_ip):\n return flask.jsonify(api_utils.get_peer_conf_and_state(peer_ip))",
"def getPeer(self):\n return \"Peer:PID:\" + str(self.transport.pid)",
"def peers_filename(self):\n return f'{self._peer.interface}-peers.conf'",
"def peer(self) -> str:\n return \"{0.host}:{0.port... | [
"0.6302188",
"0.6148711",
"0.60883296",
"0.59773165",
"0.5938544",
"0.58513695",
"0.5821101",
"0.5688229",
"0.56733257",
"0.56665057",
"0.56661606",
"0.56523305",
"0.56483495",
"0.5587746",
"0.55737203",
"0.5569893",
"0.5556802",
"0.55402845",
"0.5525344",
"0.5453505",
"0.544... | 0.7169396 | 0 |
Returns the full WireGuard config | def local_config(self):
return f'''
{self.interface}
{self.peers}
''' | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_full_config(self):\n return self._read_config()",
"def config():\n return _config",
"def get_config():\n return CONFIG",
"def get_config():\n return _config",
"def config(self):\n return self._config",
"def get_config(self):\n return self.config",
"def _get_config(self... | [
"0.7619931",
"0.7295114",
"0.72525537",
"0.72013766",
"0.7126061",
"0.7118523",
"0.70911914",
"0.70911914",
"0.70911914",
"0.70911914",
"0.70911914",
"0.70911914",
"0.70911914",
"0.70911914",
"0.70911914",
"0.70911914",
"0.70911914",
"0.70911914",
"0.70911914",
"0.70911914",
... | 0.0 | -1 |
Returns a QR Code of this peer's configuration | def qrcode(self):
if not HAS_QRCODE:
raise AttributeError('QR Code functionality is not enabled. Please add the qrcode '
'library to this environment')
return qrcode.make(self.local_config) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def qr(self):\n schema = 'bitcoin:{to_address}?amount={amount}&label={label}'\n parsed = schema.format(\n to_address=self.to_address,\n amount=self.amount_btc,\n label=urllib.parse.urlencode({\n \"label\": \"{site}:{project_code}\".format(\n ... | [
"0.7186193",
"0.64163977",
"0.62395495",
"0.62290925",
"0.596935",
"0.56104034",
"0.5526844",
"0.5444192",
"0.54266",
"0.5419251",
"0.5399148",
"0.5389545",
"0.5374013",
"0.53545994",
"0.52988607",
"0.5249205",
"0.5175898",
"0.51248837",
"0.5104361",
"0.50888526",
"0.50857466... | 0.7279608 | 0 |
Returns the file name of the WireGuard config file | def filename(self):
return f'{self._peer.interface}.conf' | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def config_file_name(self):\n return self._config_file_name",
"def configFilename(self):\n return self.name()+'.py'",
"def getConfigFileName(self):\n return self._configFileName",
"def get_config_file_name(self):\n argv = sys.argv\n config_type = \"dev\" # default configura... | [
"0.7892473",
"0.76238227",
"0.7463568",
"0.7424596",
"0.72816926",
"0.70907086",
"0.6970926",
"0.6929305",
"0.68907595",
"0.68628234",
"0.68490136",
"0.68453705",
"0.6806996",
"0.67837393",
"0.67750645",
"0.6746759",
"0.66901654",
"0.661482",
"0.65863305",
"0.65788066",
"0.65... | 0.71039367 | 5 |
Returns the Address for this Server | def address(self):
return f'Address = {self._peer.address}/{self._peer.subnet.prefixlen}' | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def server_address(self):\n return self._server_address",
"def get_address(self):\n \n if self._addr == None:\n return self._socket.getpeername()\n return self._addr",
"def get_addr(self):\n return Server.t_addresses.get(threading.get_ident())",
"def get_address(... | [
"0.8497895",
"0.8230755",
"0.80186725",
"0.80040604",
"0.80040604",
"0.79717636",
"0.7825209",
"0.7794908",
"0.7702242",
"0.769588",
"0.76614803",
"0.76614803",
"0.7639086",
"0.76330775",
"0.7628873",
"0.7623443",
"0.75694287",
"0.7476213",
"0.7476213",
"0.7470774",
"0.746942... | 0.66979694 | 82 |
Returns the peers config file name | def peers_filename(self):
return f'{self._peer.interface}-peers.conf' | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def filename(self):\n return f'{self._peer.interface}.conf'",
"def config_file_name(self):\n return self._config_file_name",
"def peers_full_path(self, config_path=CONFIG_PATH):\n return os.path.join(config_path, self.peers_filename)",
"def get_config_file_name(self):\n argv = sys... | [
"0.8018299",
"0.7490476",
"0.7397864",
"0.7368654",
"0.72774464",
"0.70400476",
"0.7015221",
"0.68941253",
"0.6880216",
"0.68466586",
"0.67632884",
"0.67443764",
"0.6716723",
"0.66468436",
"0.66277474",
"0.6608395",
"0.6605491",
"0.6567725",
"0.6490509",
"0.6470438",
"0.64042... | 0.8539135 | 0 |
Returns the full path to the peers config file | def peers_full_path(self, config_path=CONFIG_PATH):
return os.path.join(config_path, self.peers_filename) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def peers_filename(self):\n return f'{self._peer.interface}-peers.conf'",
"def config_file_and_path():\n return str(rmfriend_dir() / 'config.cfg')",
"def config_file(self):\n return join_path(self.prefix.etc.bohrium, \"config.ini\")",
"def filename(self):\n return f'{self._peer.interf... | [
"0.81363314",
"0.77814627",
"0.75517416",
"0.75356036",
"0.75192237",
"0.7424745",
"0.7221463",
"0.7169502",
"0.7155727",
"0.71397585",
"0.7127547",
"0.7084243",
"0.70792246",
"0.7075259",
"0.69789076",
"0.6934804",
"0.68481874",
"0.67871034",
"0.6780163",
"0.6766348",
"0.676... | 0.87894446 | 0 |
r"""Constructs a batch object from a python list holding | def from_data_list(data_list, follow_batch=[]):
keys = [set(data.keys) for data in data_list]
keys = list(set.union(*keys))
assert 'batch' not in keys
batch = Batch()
for key in keys:
batch[key] = []
for key in follow_batch:
batch['{}_batch'.format(key)] = []
cumsum = {}... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def from_list(cls, lst):\n return cls(lst[0], lst[1], lst[2])",
"def from_list(cls, rowslist, shape, domain):\n return cls(rowslist, shape, domain)",
"def instantiate_batch(self, inputs):\n return inputs",
"def from_list(cls, param_list):\n return cls( param_list[0],\n ... | [
"0.68111",
"0.67810553",
"0.67757976",
"0.66464084",
"0.637957",
"0.63722867",
"0.6312391",
"0.6275776",
"0.6272473",
"0.6233676",
"0.6167972",
"0.6167972",
"0.6155221",
"0.6126881",
"0.5996756",
"0.594738",
"0.58701897",
"0.5825914",
"0.5824914",
"0.57827526",
"0.5734936",
... | 0.57247245 | 21 |
determines this (self's) thread id | def _get_my_tid(self):
if not self.isAlive():
raise threading.ThreadError("the thread is not active")
# do we have it cached?
if hasattr(self, "_thread_id"):
return self._thread_id
# no, look for it in the _active dict
for tid, tobj in threading._active.... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def thread_id(self):\n return self._thread_id",
"def get_id(self):\n if hasattr(self, \"_thread_id\"):\n return self._thread_id\n for id, thread in threading._active.items():\n if thread is self:\n return id",
"def get_id(self):\n if hasattr(self... | [
"0.87604755",
"0.855684",
"0.855684",
"0.84960526",
"0.8430593",
"0.806207",
"0.7944841",
"0.76469076",
"0.7611317",
"0.7069843",
"0.70444417",
"0.6986155",
"0.6953767",
"0.68797904",
"0.68797904",
"0.68797904",
"0.68797904",
"0.6876224",
"0.6822325",
"0.6800639",
"0.6782105"... | 0.79912037 | 6 |
Returns the current language. If one is set while handling a request, it is returned here. Otherwise, the current site's default language is returned. | def get_language():
try:
from leaves.middleware import request_context
return request_context.language
except:
return get_site().preferences.default_language | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_default_language():\n return getattr(thread_locals, 'DEFAULT_LANGUAGE',\n settings.DEFAULT_LANGUAGE)",
"def requestLanguage(request):\n # Return the user language preferences for registered users\n if request.user.valid and request.user.language:\n return request.user.la... | [
"0.8197471",
"0.8078416",
"0.80783194",
"0.7979381",
"0.79017997",
"0.78293884",
"0.775399",
"0.77518296",
"0.7709042",
"0.76671684",
"0.7612116",
"0.7595514",
"0.7589175",
"0.75573194",
"0.7556522",
"0.75388354",
"0.75303286",
"0.75105506",
"0.7504872",
"0.74683154",
"0.7455... | 0.8838923 | 0 |
Removes all L{Plotter} instances from my weakreference registry. | def removeAll(self):
self.pDict.clear() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def deregister() -> None:\n plot_backend = _get_plot_backend(\"matplotlib\")\n plot_backend.deregister()",
"def __del__(self):\n pyplot.clf()",
"def unregister ():\n dsf_prop_export.unregister ()\n dsf_geom_export.unregister ()\n dsf_wm_import.unregister ()\n dsf_pose_import.unregister ()\n d... | [
"0.6907109",
"0.6722877",
"0.6530602",
"0.6515277",
"0.6441442",
"0.63543564",
"0.63043684",
"0.630275",
"0.6276796",
"0.62598217",
"0.62459624",
"0.61826867",
"0.6103125",
"0.6098435",
"0.60913163",
"0.6083208",
"0.6041342",
"0.60398984",
"0.60212123",
"0.60147285",
"0.59990... | 0.0 | -1 |
Considers the supplied I{figSize} to be in pixels if both its elements are integers and at least one of them exceeds 75. In that case, scales it down by DPI. Returns the figSize in inches. | def _maybePixels(self, figSize):
bigDim = False
newFigSize = []
for dim in figSize:
if not isinstance(dim, int):
# Not both integers, use original
return figSize
if dim > 75: bigDim = True
# Convert from (presumed) pixels to Mat... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_fig_size(fig):\n return fig.get_figwidth() * __dpi__, fig.get_figheight() * __dpi__",
"def set_figsize(figsize=(3.5, 2.5)): #@save\n use_svg_display()\n d2l.plt.rcParams['figure.figsize'] = figsize",
"def set_figsize(figsize=(3.5, 2.5)):\n use_svg_display()\n plt.rcParams['figure.figsiz... | [
"0.7384936",
"0.6708422",
"0.66374177",
"0.66374177",
"0.66374177",
"0.65757877",
"0.6377782",
"0.6377782",
"0.6377782",
"0.6340445",
"0.6340142",
"0.62794906",
"0.6212349",
"0.6184412",
"0.6166496",
"0.60881937",
"0.6067752",
"0.60664904",
"0.6047471",
"0.6030237",
"0.595264... | 0.7573987 | 0 |
Does C{set_XXX} calls on the C{Axes} object for the subplot at index I{k}. | def doSettings(self, k):
def bbAdd(textObj):
dims = self.adj.tsc.dims(textObj)
self.dims.setDims(k, name, dims)
for name in self._settings:
value = self.opts[name]
if not value: continue
fontsize = self.fontsize(name, None)
kw = {'... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set(self, **kwargs):\n for ax in self.axes.flat:\n ax.set(**kwargs)\n return self",
"def __call__(self, i):\n plt.subplot(self.nx, self.ny, i)\n return True",
"def update(self, **kwargs):\n\n for k, v in six.iteritems(kwargs):\n if k in self._AllowedKeys:\n ... | [
"0.64172107",
"0.59971815",
"0.5938759",
"0.578324",
"0.5608929",
"0.5574328",
"0.5537622",
"0.54522127",
"0.541232",
"0.5396249",
"0.5383007",
"0.5360278",
"0.53383696",
"0.53378713",
"0.5320581",
"0.5302075",
"0.52961445",
"0.5238602",
"0.5224489",
"0.5205222",
"0.5172493",... | 0.60636383 | 1 |
Format input date from `mmddyyyy` into `yyyymm`, or `yyyymmdd` This is the ISO 8601 standard for date | def _format_date(input_date, day_flag, sep_char="-"):
date_iso = input_date[6:10] + sep_char + input_date[0:2]
if day_flag:
date_iso = date_iso + sep_char + input_date[3:5]
return date_iso | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def format_date(self, date_val):\n try:\n if type(date_val) is not datetime:\n d = date.fromisoformat(date_val[0:10])\n else:\n d = date_val\n return d.strftime('%Y-%m-%d')\n except Exception as e:\n self.error((str(e)))",
"d... | [
"0.7461933",
"0.7333784",
"0.72909456",
"0.7243725",
"0.718622",
"0.70701265",
"0.6974272",
"0.6970614",
"0.6954968",
"0.69345903",
"0.690487",
"0.68821937",
"0.6823642",
"0.68062407",
"0.6788612",
"0.6709731",
"0.6698478",
"0.6687315",
"0.66655844",
"0.6649614",
"0.65694475"... | 0.7346188 | 1 |
A mutant is a combination of zero or more mutations. | def parse_mutants(self, mutant_names=None, mutation_number=None):
if not mutant_names and not mutation_number:
raise ValueError('Please specify either mutant_names or mutation_number')
elif not mutant_names:
mutant_names = [f"Mutant {elt4}" for elt4 in range(1, 2 ** mutation_numb... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def mutant(self):\n _mutant = []\n _wt = self.wildtype\n for i in range(0, len(self.mutations)):\n site = _wt[i]\n options = self.mutations[i]\n if options is None:\n _mutant.append(_wt[i])\n else:\n for o in options:\n ... | [
"0.73437834",
"0.64540803",
"0.6353896",
"0.62710905",
"0.62389916",
"0.6209846",
"0.61646545",
"0.60755754",
"0.60120595",
"0.5969244",
"0.59552515",
"0.58923703",
"0.585385",
"0.585385",
"0.58175856",
"0.5802377",
"0.57674783",
"0.5735842",
"0.5730208",
"0.566219",
"0.56285... | 0.6130839 | 7 |
load the provided extension into the registry Attempts to load an extension with the provided name value. If an extension which is already loaded in the registry is provided, the request to load the specific extension is ignored. If an extension could not be loaded, a warning is generated and this method will return ``... | def load(self, name, ignore=True):
# ignore if extension is already loaded
if name in self.extension:
return True
loaded = False
debug('attempting to load extension: {}', name)
try:
try:
plugin = import_module(name)
except Rel... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get(self, name):\n ext = self.extensions.get(name)\n\n if not ext:\n ext = self.builtin(name)\n\n if not ext:\n self.discover()\n\n try:\n ext = self.extensions[name]\n except KeyError:\n raise InternalError(\"Unknow... | [
"0.62356734",
"0.60508466",
"0.5953172",
"0.59423023",
"0.5908983",
"0.5813021",
"0.579546",
"0.57695913",
"0.571933",
"0.5689286",
"0.5666611",
"0.55096847",
"0.5508603",
"0.5501862",
"0.53918964",
"0.5381899",
"0.5374113",
"0.5360136",
"0.52903634",
"0.5270261",
"0.5268223"... | 0.6942795 | 0 |
perform a requiredversion check Enables an extension to explicitly check for a required relengtool version before being loaded. Invoking this method with a dottedseparated ``version`` string, the string will be parsed and compared with the running relengtool version. If the required version is met, this method will hav... | def require_version(self, version):
if not require_version(version, quiet=True, critical=False):
raise RelengVersionNotSupportedException(
'requires {}, has {}'.format(version, releng_version)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def check_version(ctx, builder, version_function, *,\n requires_version=None,\n requires_at_least_version=None,\n requires_at_most_version=None):\n if any(v is not None for v in (\n requires_version,\n requires_at_least_version,\n requires_at_most_version)):... | [
"0.6557393",
"0.6341572",
"0.6324455",
"0.6308382",
"0.6229191",
"0.618778",
"0.591033",
"0.58390015",
"0.58109134",
"0.5763661",
"0.56982404",
"0.56725943",
"0.56356657",
"0.5635138",
"0.557643",
"0.5568471",
"0.5558369",
"0.5524614",
"0.5490527",
"0.5462091",
"0.54557526",
... | 0.7866703 | 0 |
Set up the ZiGate sensors. | def setup_platform(hass, config, add_devices, discovery_info=None):
if discovery_info is None:
return
myzigate = hass.data[ZIGATE_DOMAIN]
def sync_attributes():
devs = []
for device in myzigate.devices:
ieee = device.ieee or device.addr # compatibility
acti... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def setUp(self):\n self.ser = Serial()\n self.device_obj = ZBSensor(self.ser)",
"def __init__(self):\n self._read_calibration_data()\n self.configure_sensor(\n TemperatureOversamplings.x08,\n PressureOversamplings.x16,\n HumidityOversamplings.x08,\n ... | [
"0.64342433",
"0.64245933",
"0.6152379",
"0.609182",
"0.6086015",
"0.6019531",
"0.59115714",
"0.57856524",
"0.577893",
"0.57720774",
"0.57567704",
"0.57371056",
"0.5721154",
"0.5712741",
"0.5704245",
"0.56930935",
"0.5692206",
"0.56854016",
"0.5674036",
"0.5671973",
"0.566603... | 0.5649414 | 23 |
Return the name of the device if any. | def name(self):
return '{} {}'.format(self._device,
self._endpoint) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def device_name(self) -> Optional[str]:\n return pulumi.get(self, \"device_name\")",
"def device_name(self) -> Optional[str]:\n return pulumi.get(self, \"device_name\")",
"def name(self):\n return self._device.name",
"def name(self):\n return self._device.name",
"def name(self):... | [
"0.89734465",
"0.89734465",
"0.8584627",
"0.8584627",
"0.8584627",
"0.8502048",
"0.84944665",
"0.84194607",
"0.83955586",
"0.83955586",
"0.8379756",
"0.83165",
"0.8306566",
"0.8161454",
"0.81564134",
"0.8090303",
"0.8087526",
"0.8073198",
"0.8006941",
"0.7999654",
"0.79544145... | 0.7078036 | 45 |
Return the state attributes. | def device_state_attributes(self):
return {
'addr': self._device.addr,
'ieee': self._device.ieee,
'endpoint': '0x{:02x}'.format(self._endpoint),
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def state_attributes(self):\n return self._attributes",
"def state_attributes(self):\n return self._attributes",
"def device_state_attributes(self):\r\n return self.attributes",
"def device_state_attributes(self):\n return self._state_attrs",
"def device_state_attributes(self):\... | [
"0.8953404",
"0.8953404",
"0.85239846",
"0.8366765",
"0.8366765",
"0.8363429",
"0.83362615",
"0.8334551",
"0.8310377",
"0.8292682",
"0.8289349",
"0.8289349",
"0.82871646",
"0.82871646",
"0.82871646",
"0.82871646",
"0.82871646",
"0.82871646",
"0.82871646",
"0.82871646",
"0.828... | 0.7390554 | 93 |
Returns true if the continent code for the given point is Europe. | def is_european(point):
return point['AddressInfo']['Country']['ContinentCode'] == 'EU' | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_point_in(self, point):\n return (self.upperleft[0] <= point[0] <= self.upperright[0] and self.upperleft[1] <= point[1] <= self.bottomleft[1])",
"def is_point_in(self, point):\n return (self.upperleft[0] <= point[0] <= self.upperright[0] and self.upperleft[1] <= point[1] <= self.bottomleft[1]... | [
"0.6291616",
"0.6291616",
"0.62294024",
"0.6181909",
"0.611427",
"0.6105787",
"0.59725326",
"0.5827019",
"0.5797571",
"0.57690436",
"0.5722902",
"0.5701417",
"0.567951",
"0.56774753",
"0.56618935",
"0.5647409",
"0.5641956",
"0.559011",
"0.5575253",
"0.5562662",
"0.55193186",
... | 0.81814027 | 0 |
Checks email or username. | def authenticate(cls, username=None, password=None):
if '@' in username:
kwargs = {'email': username}
else:
kwargs = {'username': username}
try:
user = User.objects.get(**kwargs)
if user.check_password(password):
return user
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _check_username(self, username):\n if self.username_regex.search(username) is not None:\n print(\"Correct username\")\n return True\n else: \n print(\"Wrong username\")\n return False",
"def validate_email(self):\n email = input(\"Email: \").st... | [
"0.7094942",
"0.688366",
"0.68379056",
"0.683547",
"0.6815315",
"0.67826104",
"0.674065",
"0.6721134",
"0.67057014",
"0.66995054",
"0.66995054",
"0.66930014",
"0.6673689",
"0.66664696",
"0.6618187",
"0.6589108",
"0.65881765",
"0.6568775",
"0.65525544",
"0.6551911",
"0.6541260... | 0.0 | -1 |
Get user object by id. | def get_user(cls, user_id):
try:
return User.objects.get(pk=user_id)
except User.DoesNotExist:
return None | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_user_by_id(self, id):\n\t\treturn self.users.get(id)",
"def getUser(self, id : int) -> bbUser.bbUser:\n id = self.validateID(id)\n return self.users[id]",
"def get(id):\n return User.query.filter_by(id=id).first()",
"def find_user_by_id(id: str) -> User:\n\n # Find the id ... | [
"0.9048351",
"0.86650944",
"0.8652398",
"0.8518443",
"0.84733015",
"0.8465976",
"0.84501374",
"0.84480643",
"0.8441743",
"0.8420989",
"0.8330263",
"0.8306258",
"0.83002543",
"0.83002543",
"0.83002543",
"0.83002543",
"0.82904327",
"0.8255332",
"0.82511795",
"0.82416135",
"0.82... | 0.81212944 | 29 |
Get a brush represented by fg and bg color. This brush can be used in further curses calls. Note that the brush is and will be garbage collected if we run out of brushes and it is no longer needed. | def get_brush(self, fg_color=None, bg_color=None):
if not fg_color:
fg_color = self.DEFAULT_FG_COLOR
if not bg_color:
bg_color = self.DEFAULT_BG_COLOR
str_id = '%s:%s' % (fg_color, bg_color)
if not self.brushes.get(str_id):
try:
int_id ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def GetBrush(*args, **kwargs):\n return _gdi_.StockGDI_GetBrush(*args, **kwargs)",
"def GetBrush(*args, **kwargs):\n return _gdi_.DC_GetBrush(*args, **kwargs)",
"def StockGDI_GetBrush(*args, **kwargs):\n return _gdi_.StockGDI_GetBrush(*args, **kwargs)",
"def CreateBrush(*args, **kwargs):\n ... | [
"0.772161",
"0.76486474",
"0.74445593",
"0.69733256",
"0.6955816",
"0.67802745",
"0.6751129",
"0.6462264",
"0.6456485",
"0.6408509",
"0.6285074",
"0.6155125",
"0.60529256",
"0.6052779",
"0.5942583",
"0.5717921",
"0.56367266",
"0.55970836",
"0.55912566",
"0.55894",
"0.55688554... | 0.8269816 | 0 |
Strip comments from line string. | def strip_comment_line_with_symbol(line, start):
parts = line.split(start)
counts = [len(re.findall(r'(?:^|[^"\\]|(?:\\\\|\\")+)(")', part))
for part in parts]
total = 0
for nr, count in enumerate(counts):
total += count
if total % 2 == 0:
return start.join(part... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _StripCommentFromLine(line):\n\n m = re.match(r'(.*)//', line)\n if m:\n return m.group(1).strip() + '\\n'\n else:\n return line",
"def strip_comments(line):\n if \"#\" in line:\n return line[:line.find(\"#\")]\n else:\n return line",
"def clean_comment(line):\n if line.star... | [
"0.83832353",
"0.81881326",
"0.7849576",
"0.78008133",
"0.7795312",
"0.77583575",
"0.772848",
"0.7668799",
"0.7446923",
"0.73321223",
"0.73321223",
"0.73223776",
"0.73150617",
"0.72785574",
"0.7276393",
"0.6891992",
"0.6835089",
"0.6831754",
"0.68139434",
"0.6807712",
"0.6789... | 0.665686 | 26 |
Strip comments from json string. | def strip_comments(string, comment_symbols=frozenset(('#', '//'))):
lines = string.splitlines()
for k in range(len(lines)):
for symbol in comment_symbols:
lines[k] = strip_comment_line_with_symbol(lines[k], start=symbol)
return '\n'.join(lines) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def removeJsonComment(jsonStr):\n pureJsonStr = jsonStr\n\n # whole line with #\n # # International\n pureJsonStr = re.sub(\"^\\s*#.*$\\n+\", \"\", pureJsonStr, flags=re.M)\n\n # whole line with //\n # // \"mode\": \"SINGLE\",\n pureJsonStr = re.sub(\"^\\s*//.*$\\n+\", \"\"... | [
"0.82140887",
"0.66599596",
"0.66247106",
"0.65715",
"0.645063",
"0.63912725",
"0.63465995",
"0.6288423",
"0.6243538",
"0.6228745",
"0.61965793",
"0.61772203",
"0.61554486",
"0.61042005",
"0.6027764",
"0.6013321",
"0.59837884",
"0.5975086",
"0.59750265",
"0.59063786",
"0.5886... | 0.6420987 | 5 |
Converts a given string (ascii or unicode) into a unicodeescaped ASCII string | def _UnicodeToAscii(string):
return unicode(string).encode('utf-8') | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def ascii_convert_str(the_str: str):\n return ANSI_ESCAPE.sub(rb\"\", the_str)",
"def py_encode_basestring_ascii(s):\n if isinstance(s, str) and HAS_UTF8.search(s) is not None:\n s = s.decode('utf-8')\n def replace(match):\n s = match.group(0)\n try:\n return ESCAPE_DCT[s... | [
"0.78824633",
"0.7781982",
"0.77669954",
"0.76670754",
"0.76367337",
"0.7577432",
"0.7420683",
"0.734355",
"0.72955054",
"0.72911716",
"0.7250312",
"0.71640193",
"0.7142922",
"0.71223587",
"0.7097738",
"0.7061557",
"0.7015051",
"0.69440204",
"0.68925923",
"0.68870485",
"0.688... | 0.7846337 | 1 |
Read a file contains lines of strings. A list will be returned. Each element of the list contains a single entry of the input file. Leading and tailing white spaces, tailing carriage return will be stripped. | def read_string_list(fn, prefix=""):
if ( False == os.path.isfile( fn ) ):
raise Exception("%s does not exist." % (fn))
with open(fn, "r") as fp:
lines = fp.read().splitlines()
n = len(lines)
if ( "" == prefix ):
for i in range(n):
lines[i] = l... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def lineReadfile(filename):\n#\t\"input:filename output=readlines() \"\n\tf = open(filename)\n\tlist1 =[]\n\twhile 1:\n\t\ts = f.readline()\n\t\tif s==\"\":\n\t\t\tbreak\n\t\ts=string.replace(s,\"\\n\",\"\")\n\t\tif s==\"\":\n\t\t\tcontinue\n\t\tlist1.append(s)\n\tf.close()\n\treturn list1",
"def _fileLinesToLis... | [
"0.79228884",
"0.7558158",
"0.7465312",
"0.7390533",
"0.73673326",
"0.7342837",
"0.7257524",
"0.72145987",
"0.7137393",
"0.71334463",
"0.71198374",
"0.7116934",
"0.7113233",
"0.7105687",
"0.71036536",
"0.70653236",
"0.7027731",
"0.70054144",
"0.69946516",
"0.6987528",
"0.6962... | 0.6631592 | 48 |
load visualizer for training and sampling result of instance TODO change docstring todo load single visualizer | def load_visualizer(self, visualizer, execute_interval):
visualizer_path = self.instance.instance_visual_result_folder_path
if not os.path.exists(visualizer_path):
os.mkdir(visualizer_path)
self.visualizers += [visualizer(visualizer_path, execute_interval=execute_interval)]
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self, dataset: ds.Dataset, settings):\r\n self.dataset = dataset\r\n self.settings = settings\r\n\r\n self.visualizer = visualizer.Visualizer()",
"def visualize(self):\n # TODO\n #pyLDAvis.enable_notebook()\n #vis = pyLDAvis.gensim.prepare(self.lda_model, self.stemmed_c... | [
"0.6487598",
"0.64258784",
"0.63348716",
"0.6236786",
"0.6225005",
"0.60946614",
"0.60605353",
"0.605287",
"0.6035763",
"0.6025474",
"0.5997334",
"0.59560037",
"0.5940483",
"0.59285975",
"0.59186256",
"0.58954304",
"0.58821225",
"0.58328795",
"0.5829904",
"0.5821044",
"0.5807... | 0.7204138 | 0 |
Removes bullets that exceeds their lifespan | def remove_bullets(self):
bullet_indexes_to_remove = [
i
for i, t in enumerate(self.object_type)
if t == "bullet" and self.object_steps[i] > self.bullet_lifespan
]
self.remove_objects(bullet_indexes_to_remove) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update_bullets(bullets):\r\n\t# Update bullet positions.\r\n\tbullets.update()\r\n\tfor bullet in bullets.copy():\r\n\t\tif bullet.rect.right >= 1000:\r\n\t\t\tbullets.remove(bullet)",
"def _update_bullets(self):\n # Remove bullets that have reached top of screen\n self.bullets.update() ## M... | [
"0.7210859",
"0.70673466",
"0.7059149",
"0.69047016",
"0.6872161",
"0.6833006",
"0.6743738",
"0.6737878",
"0.6737878",
"0.6737878",
"0.6737548",
"0.67239034",
"0.66780895",
"0.6647223",
"0.6558637",
"0.6446411",
"0.64247787",
"0.63859046",
"0.6375681",
"0.6373887",
"0.6357235... | 0.79957265 | 0 |
is server is not set then just return true. Otherwise author must be the server owner | def is_owner(self, author):
return not self.server or author == self.server.owner | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def ownercheck(self, userhost):\n if self.cfg and self.cfg.owner:\n if userhost in self.cfg.owner: return True\n return False",
"def is_channel_owner():\n\n async def check(ctx):\n if ctx.guild:\n owner = ctx.author == ctx.guild.owner\n if not owner:\n ... | [
"0.7127781",
"0.6940829",
"0.6705446",
"0.6652527",
"0.6571998",
"0.653702",
"0.653702",
"0.653702",
"0.6438719",
"0.6426596",
"0.6426596",
"0.6393887",
"0.63650864",
"0.62800187",
"0.62580127",
"0.6236325",
"0.62181014",
"0.6170865",
"0.61419934",
"0.6138636",
"0.6056615",
... | 0.8524671 | 0 |
subtracts two fractions using symbol | def __sub__(self,other):
self.numerator=self.numerator*other.denominator
other.numerator=self.denominator*other.numerator
resultnumerator = self.numerator-other.numerator
resultdenominator = self.denominator*other.denominator
newvalues = (resultnumerator,resultdenominator)
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __sub__ (self,other):\n if (self.debug): print(f'enter fraction.__sub__ with {other}')\n f2 = fraction(-1*other.value[0],other.value[1])\n f3 = self.__add__(f2)\n return f3",
"def __sub__(self, other):\n top = self.num*other.denom - self.denom*other.num\n bott = self.denom*other.den... | [
"0.76252353",
"0.6937218",
"0.66695124",
"0.66191995",
"0.66121876",
"0.65801233",
"0.65778595",
"0.65399396",
"0.6498842",
"0.64359325",
"0.62873983",
"0.62791544",
"0.62668544",
"0.6133654",
"0.610547",
"0.60481054",
"0.6040253",
"0.6029625",
"0.6020455",
"0.6007975",
"0.60... | 0.6064894 | 15 |
takes two fractions and tests if they are equal | def __eq__(self,other):
self.numerator=self.numerator*other.denominator
other.numerator=self.denominator*other.numerator
if(self.numerator==other.numerator):
return True
else:
return False
return | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_equal(self):\n self.assertTrue(Fraction(7,10)==Fraction(7,10))",
"def test_frac_same(self):\n s1 = self.RNA(\"ACGU\")\n s2 = self.RNA(\"AACG\")\n s3 = self.RNA(\"GG\")\n s4 = self.RNA(\"A\")\n e = self.RNA(\"\")\n self.assertEqual(s1.frac_same(e), 0)\n ... | [
"0.80419195",
"0.77012885",
"0.7679929",
"0.7494219",
"0.7471737",
"0.74235195",
"0.7355834",
"0.7289977",
"0.72008574",
"0.71990514",
"0.71963125",
"0.71202624",
"0.7033487",
"0.7029147",
"0.7027079",
"0.7009663",
"0.7003109",
"0.6896187",
"0.68916583",
"0.684235",
"0.683553... | 0.66574043 | 30 |
takes two fractions and tests if first one is less or equal to the second | def __le__(self, other):
self.numerator=self.numerator*other.denominator
other.numerator=self.denominator*other.numerator
if(self.numerator<=other.numerator):
return True
else:
return False | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_ge(self):\n f12: Fraction = Fraction(1, 2)\n f34: Fraction = Fraction(3, 4)\n f93: Fraction = Fraction(9, 3)\n f124: Fraction = Fraction(12, 4)\n self.assertTrue(f12 >= f34)\n self.assertTrue(f93 >= f124)\n self.assertFalse(f93 >= f12)",
"def test_Greater... | [
"0.7636316",
"0.7593758",
"0.7530974",
"0.7473845",
"0.742128",
"0.73165315",
"0.726412",
"0.72592175",
"0.71779144",
"0.7172736",
"0.71135926",
"0.70971984",
"0.7039511",
"0.70102155",
"0.6898937",
"0.6866719",
"0.6819893",
"0.68026817",
"0.67997265",
"0.6753473",
"0.6657666... | 0.69968873 | 14 |
check the not equals function | def test_notequal(self):
self.assertTrue(Fraction(144,2)!=Fraction(8,4)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_not_equal(self):\n utils.compare_tracing_methods(\n SimpleCompareOpsModule(\"notEqual\"),\n torch.randn(3, 4, 5),\n torch.randn(3, 4, 5),\n fusible_ops={\"aten::ne\"},\n )",
"def test_not_equal(self):\n x = Point(\n lat=24.4,\n ... | [
"0.71758014",
"0.71529996",
"0.7140885",
"0.7139959",
"0.70842123",
"0.70277935",
"0.70169586",
"0.698875",
"0.6984704",
"0.6977744",
"0.69619936",
"0.6938454",
"0.6929995",
"0.6919335",
"0.69140023",
"0.69051534",
"0.68928367",
"0.6886373",
"0.6852307",
"0.6811489",
"0.67954... | 0.0 | -1 |
Checks the transaction sender is equal to the witness. If not satisfying, revert the transaction. | def RequireWitness(witness):
Require(CheckWitness(witness))
return True | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def interferes(self, other):\n if not isinstance(other, Transmitter):\n return self == other\n\n return other.flows_to(self.id)",
"def Relay(self, inventory):\n if type(inventory) is MinerTransaction:\n return False\n\n if inventory.Hash.ToBytes() in self.KnownHa... | [
"0.5909952",
"0.5902068",
"0.5728656",
"0.5671665",
"0.54220015",
"0.54105234",
"0.5406699",
"0.54059553",
"0.53625023",
"0.53423387",
"0.53077537",
"0.52907157",
"0.524661",
"0.5227211",
"0.521063",
"0.5191785",
"0.51513636",
"0.5140949",
"0.51371074",
"0.5105399",
"0.510518... | 0.54991364 | 4 |
Substracts two numbers, throws on overflow (i.e. if subtrahend is greater than minuend). | def Sub(a, b):
Require(a>=b)
return a-b | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sub(num1: int, num2: int, verbosity: int = 4) -> int:\n set_level(verbosity, logger)\n if are_int(num1, num2, logger):\n return num1 - num2\n else:\n raise TypeError(TYPE_ERROR_MESSAGE)",
"def sub(a: Decimal, b: Decimal) -> Decimal:\n return a - b",
"def subtract(first, second):\n... | [
"0.74581754",
"0.74521965",
"0.7412187",
"0.73393786",
"0.73393786",
"0.7333316",
"0.72968316",
"0.7293576",
"0.7293576",
"0.7284409",
"0.7251931",
"0.7251931",
"0.7251931",
"0.7219009",
"0.7217698",
"0.72146654",
"0.72086203",
"0.71956944",
"0.71956944",
"0.71956944",
"0.719... | 0.75196457 | 0 |
Return a valid column name. | def _valid_column(column_name):
return str(column_name) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _validate_column_name(col_name : str) -> str:\n\n if col_name[0].isdigit():\n return f'\"{col_name}\"'\n return col_name",
"def col_name(col):\n\n if isinstance(col, str):\n return col\n return col.__name__",
"def column_name(self) -> Optional[str]:\n return pulumi.get(self, ... | [
"0.8286518",
"0.75449574",
"0.7541542",
"0.75122577",
"0.75122577",
"0.7353739",
"0.72153854",
"0.72153854",
"0.70533663",
"0.70075583",
"0.69288105",
"0.69170654",
"0.6905839",
"0.6814767",
"0.6692141",
"0.6493142",
"0.64491165",
"0.632799",
"0.6265116",
"0.6246326",
"0.6245... | 0.8576611 | 0 |
Initialize attributes to describe a car. | def __init__(self, make, model, year): # 定义类的默认方法
self.make = make # 传入变量赋值给可供类中其他方法调用或实例调用的变量
self.model = model
self.year = year | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self, car):\n super(self.__class__, self).__init__(car)\n self.coordinator_name = car.get_faulty_coordinator_name()\n self.second_at_charge_name = car.get_second_at_charge_name()\n self.coordinated_car_name = car.get_corrected_coordinated_car_name()\n self.following_... | [
"0.7500984",
"0.7397504",
"0.6964254",
"0.69572306",
"0.68612015",
"0.671638",
"0.6585787",
"0.6585787",
"0.6585787",
"0.6455301",
"0.6448016",
"0.64400023",
"0.6431852",
"0.63737345",
"0.63079256",
"0.62494457",
"0.6206326",
"0.6174237",
"0.6162698",
"0.61395067",
"0.6102099... | 0.5674429 | 56 |
Calculate the MAE between the prediction and label. | def record(self, prediction, label):
assert isinstance(prediction, t.Tensor)
assert isinstance(label, t.Tensor) or isinstance(label, list)
if isinstance(label, list):
label = label[0]
assert isinstance(label, t.Tensor)
abs = (prediction.float() - label.float()).ab... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def mae(self):\n y_pred, y_true = self._finalize_labels_and_prediction()\n\n return F.l1_loss(y_true, y_pred).data.item()",
"def mae(self):\n y_pred, y_true = self._finalize_labels_and_prediction()\n\n return F.l1_loss(y_true, y_pred).data.item()",
"def mae(y_true, y_pred):\n ret... | [
"0.71441954",
"0.71441954",
"0.7086121",
"0.7039141",
"0.69999117",
"0.69865143",
"0.6933021",
"0.6876621",
"0.66953754",
"0.6627677",
"0.66153073",
"0.65782547",
"0.6570069",
"0.65389407",
"0.6478294",
"0.6475369",
"0.6459545",
"0.6457426",
"0.64407897",
"0.64349693",
"0.642... | 0.0 | -1 |
Tests for _compute_grade_for_non_fa function. This tests that only the existence of a certificate turns in a passed course. | def test_compute_grade_for_non_fa(self):
run3_data = self.user_edx_data.get_run_data(self.run_no_fa.edx_course_key)
run4_data = self.user_edx_data.get_run_data(self.run_no_fa_with_cert.edx_course_key)
grade3_from_cur_grade = api._compute_grade_for_non_fa(run3_data)
grade4_from_cert = ap... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_compute_grade_for_non_fa_enrollment_not_verified(self):\n course_key = self.run_no_fa.edx_course_key\n enrollment = self.enrollments.get(course_key)\n enrollment.data['mode'] = 'audit'\n enrollment.save()\n run3_data = CachedEdxUserData(self.user).get_run_data(course_key... | [
"0.7449123",
"0.7172691",
"0.6934194",
"0.6845325",
"0.6771665",
"0.66394556",
"0.62321645",
"0.62225044",
"0.6219886",
"0.6115952",
"0.6055114",
"0.6008568",
"0.5995308",
"0.5902764",
"0.5860871",
"0.58416694",
"0.5766427",
"0.5741464",
"0.5663525",
"0.5646239",
"0.56410325"... | 0.76838845 | 0 |
Test for freeze_user_final_grade function in case of problems with can_freeze_grades | def test_freeze_user_final_grade_error1(self, raise_on_exception, mock_refr, mock_get_fg):
# case not ready to be frozen because the freeze date is in the future
if not raise_on_exception:
final_grade = api.freeze_user_final_grade(
self.user, self.run_no_fa, raise_on_exceptio... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_freeze_user_final_grade(self, mock_refr):\n final_grade = api.freeze_user_final_grade(self.user, self.run_fa)\n assert final_grade is not None\n mock_refr.assert_called_once_with(self.user, self.run_fa.courseware_backend)\n fg_qset = FinalGrade.objects.filter(user=self.user, co... | [
"0.7737555",
"0.71023345",
"0.6887532",
"0.68358195",
"0.6717333",
"0.66303194",
"0.6513489",
"0.64620644",
"0.6424896",
"0.63506234",
"0.6249073",
"0.62296885",
"0.62096304",
"0.6140181",
"0.6131668",
"0.60596246",
"0.6037631",
"0.59900254",
"0.5823876",
"0.5664098",
"0.5648... | 0.7199838 | 1 |
Test for freeze_user_final_grade function in case of problems with can_freeze_grades | def test_freeze_user_final_grade_error1_improperly_configured(self, raise_on_exception, mock_refr, mock_get_fg):
# case without freeze date
with self.assertRaises(ImproperlyConfigured):
api.freeze_user_final_grade(self.user, self.run_fa_with_cert, raise_on_exception=raise_on_exception)
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_freeze_user_final_grade(self, mock_refr):\n final_grade = api.freeze_user_final_grade(self.user, self.run_fa)\n assert final_grade is not None\n mock_refr.assert_called_once_with(self.user, self.run_fa.courseware_backend)\n fg_qset = FinalGrade.objects.filter(user=self.user, co... | [
"0.7737577",
"0.7199939",
"0.7102701",
"0.68877465",
"0.68361056",
"0.67167324",
"0.6513722",
"0.64618814",
"0.6423161",
"0.6350178",
"0.6248673",
"0.6229237",
"0.62100387",
"0.61390656",
"0.61300266",
"0.6060188",
"0.6037028",
"0.598898",
"0.58233047",
"0.5662636",
"0.564871... | 0.66305953 | 6 |
Test for freeze_user_final_grade function in case of problems with refresh of cache | def test_freeze_user_final_grade_error2(self, raise_on_exception, mock_refr, mock_get_fg):
mock_refr.side_effect = AttributeError
if not raise_on_exception:
final_grade = api.freeze_user_final_grade(self.user, self.run_fa, raise_on_exception=raise_on_exception)
assert final_grade... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_freeze_user_final_grade(self, mock_refr):\n final_grade = api.freeze_user_final_grade(self.user, self.run_fa)\n assert final_grade is not None\n mock_refr.assert_called_once_with(self.user, self.run_fa.courseware_backend)\n fg_qset = FinalGrade.objects.filter(user=self.user, co... | [
"0.7502469",
"0.6959369",
"0.6733671",
"0.657036",
"0.6509941",
"0.615717",
"0.6146293",
"0.60068595",
"0.5829996",
"0.58210623",
"0.5634144",
"0.5602666",
"0.5602666",
"0.5545304",
"0.55379504",
"0.5519758",
"0.5508226",
"0.54770494",
"0.544707",
"0.5442548",
"0.5433099",
... | 0.6677258 | 3 |
Test for freeze_user_final_grade function in case it is called multiple times | def test_freeze_user_final_grade_multiple_calls(self, mock_refr):
fg_qset = FinalGrade.objects.filter(user=self.user, course_run=self.run_fa)
assert fg_qset.count() == 0
# first call
final_grade = api.freeze_user_final_grade(self.user, self.run_fa)
assert final_grade is not None... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_freeze_user_final_grade(self, mock_refr):\n final_grade = api.freeze_user_final_grade(self.user, self.run_fa)\n assert final_grade is not None\n mock_refr.assert_called_once_with(self.user, self.run_fa.courseware_backend)\n fg_qset = FinalGrade.objects.filter(user=self.user, co... | [
"0.75572973",
"0.67121446",
"0.6682229",
"0.64011884",
"0.63792175",
"0.6044655",
"0.6022145",
"0.6013583",
"0.59605396",
"0.5822584",
"0.568876",
"0.56688523",
"0.5658237",
"0.5655895",
"0.56519324",
"0.5609026",
"0.55625224",
"0.5539334",
"0.55308926",
"0.5511957",
"0.54825... | 0.6989801 | 1 |
Path to a SQL file in GCS from which slave | def dump_file_path(self) -> Optional[pulumi.Input[str]]:
return pulumi.get(self, "dump_file_path") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_sql_path(file_path: str) -> str:\n dag_dir = configuration.get('core', 'dags_folder')\n return os.path.join(dag_dir, file_path)",
"def db_file():\n return abspath('vmchecker.db')",
"def get_db_path():\n \n return(db_run.db_abs_path)",
"def cloud_sql_proxy_path() -> Optional[str]:\n return... | [
"0.6570352",
"0.6337562",
"0.61601675",
"0.6019517",
"0.575131",
"0.5750995",
"0.5684781",
"0.56641835",
"0.56469953",
"0.5588826",
"0.5583271",
"0.55711913",
"0.55524445",
"0.54537684",
"0.5451777",
"0.5401942",
"0.53956896",
"0.5386684",
"0.53612745",
"0.5326617",
"0.531675... | 0.0 | -1 |
True if binary logging is enabled. If `settings.backup_configuration.enabled` is false, this must be as well. Cannot be used with Postgres. | def binary_log_enabled(self) -> Optional[pulumi.Input[bool]]:
return pulumi.get(self, "binary_log_enabled") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def binary_log_enabled(self) -> bool:\n return pulumi.get(self, \"binary_log_enabled\")",
"def replication_log_archiving_enabled(self) -> bool:\n return pulumi.get(self, \"replication_log_archiving_enabled\")",
"def rdb_backup_enabled(self) -> bool:\n return pulumi.get(self, \"rdb_backup_e... | [
"0.80881053",
"0.64237684",
"0.62050253",
"0.58953696",
"0.5890366",
"0.58014375",
"0.58014375",
"0.5743403",
"0.56860447",
"0.5669001",
"0.56140566",
"0.556816",
"0.5505974",
"0.54832786",
"0.5447606",
"0.5418352",
"0.5400761",
"0.54005146",
"0.5331315",
"0.5326893",
"0.5325... | 0.73073024 | 1 |
A name for this whitelist entry. | def name(self) -> pulumi.Input[str]:
return pulumi.get(self, "name") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def name(self) -> StringFilter:\n return self.__name",
"def name(self):\n return self[\"name\"]",
"def name_field(self):\r\n return 'name'",
"def name(self):\n\n return self._get_field(\"name\")",
"def name(self) -> str:\n return self.data['name']",
"def name(self) -> \... | [
"0.72328705",
"0.69246775",
"0.6906273",
"0.6827609",
"0.680313",
"0.67992175",
"0.67992175",
"0.67992175",
"0.6784326",
"0.67659515",
"0.67427385",
"0.67403865",
"0.6739837",
"0.67138046",
"0.6710445",
"0.6706388",
"0.6700021",
"0.6665725",
"0.66586107",
"0.6649848",
"0.6639... | 0.0 | -1 |
A name for this whitelist entry. | def name(self) -> Optional[pulumi.Input[str]]:
return pulumi.get(self, "name") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def name(self) -> StringFilter:\n return self.__name",
"def name(self):\n return self[\"name\"]",
"def name_field(self):\r\n return 'name'",
"def name(self):\n\n return self._get_field(\"name\")",
"def name(self) -> str:\n return self.data['name']",
"def name(self) -> \... | [
"0.72328705",
"0.69246775",
"0.6906273",
"0.6827609",
"0.680313",
"0.67992175",
"0.67992175",
"0.67992175",
"0.6784326",
"0.67659515",
"0.67427385",
"0.67403865",
"0.6739837",
"0.67138046",
"0.6710445",
"0.6706388",
"0.6700021",
"0.6665725",
"0.66586107",
"0.6649848",
"0.6639... | 0.0 | -1 |
Get the name of the C{Mediator}. | def getMediatorName(self):
return self.mediatorName | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_name(self) -> str:\n return self.__name",
"def get_name(self):\n return self.__name",
"def _get_name(self):\n return self.__name",
"def _get_name(self):\n return self.__name",
"def _get_name(self):\n return self.__name",
"def _get_name(self):\n return self.__name",
"def _get_n... | [
"0.72800654",
"0.7248535",
"0.7203252",
"0.7203252",
"0.7203252",
"0.7203252",
"0.7203252",
"0.7203252",
"0.7203252",
"0.7203252",
"0.7203252",
"0.7203252",
"0.7203252",
"0.7203252",
"0.7203252",
"0.7203252",
"0.7203252",
"0.7203252",
"0.7203252",
"0.7203252",
"0.7203252",
... | 0.9000559 | 0 |
decrease the learning rate | def adjust_learning_rate(optimizer, epoch):
lr = config.optimizer.lr
schedule = config.lr_schedule if hasattr(config, 'lr_schedule') else 'fixed'
if schedule == 'fixed':
if epoch >= 0.75 * config.epochs:
lr = config.optimizer.lr * 0.1
if epoch >= 0.9 * config.epochs:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def dec_learning_rate(step, opt, dec_rate=0.05):\r\n prev_lrs = [ ]\r\n curr_lrs = [ ]\r\n for param_group in opt.param_groups:\r\n prev_lrs.append(param_group['lr'])\r\n param_group['lr'] *= (1 - dec_rate)\r\n curr_lrs.append(param_group['lr'])\r\n print('Step {}: learning rate de... | [
"0.73365825",
"0.6999569",
"0.69734424",
"0.6962472",
"0.6850783",
"0.6850783",
"0.6736016",
"0.67287916",
"0.6726578",
"0.67016196",
"0.6700515",
"0.6699682",
"0.66969526",
"0.66909665",
"0.66878617",
"0.6660984",
"0.6660523",
"0.66366637",
"0.661834",
"0.66054904",
"0.65952... | 0.0 | -1 |
Maps a screen space point into the "index" space of the plot. Overrides the BaseXYPlot implementation, and always returns an array of (index, value) tuples. | def map_data(self, screen_pt, all_values=True):
x, y = screen_pt
if self.orientation == 'v':
x, y = y, x
return array((self.index_mapper.map_data(x),
self.value_mapper.map_data(y))) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_index(self, x, y):\n i = (y - self.y0) // self.dy\n j = (x - self.x0) // self.dx\n i = min(max(i, 0), self.n-1)\n j = min(max(j, 0), self.m-1)\n return [i, j]",
"def xy_to_index(x, y):\n index = y * columns + x\n return index",
"def map_data(self, screen_pt):\n ... | [
"0.6980833",
"0.68462366",
"0.6649012",
"0.6581632",
"0.64304787",
"0.64304787",
"0.631502",
"0.6189823",
"0.6125921",
"0.61189723",
"0.61037165",
"0.61012393",
"0.60952544",
"0.6077649",
"0.60667634",
"0.60373825",
"0.6021788",
"0.5979914",
"0.59521407",
"0.59498024",
"0.593... | 0.6236935 | 7 |
Creates OperationContract that creates a new Spinnaker Application. | def create_app(self):
contract = jc.Contract()
return st.OperationContract(
self.agent.make_create_app_operation(
bindings=self.bindings,
application=self.TEST_APP,
account_name=self.bindings["SPINNAKER_KUBERNETES_V2_ACCOUNT"],
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_application(name=None, description=None):\n pass",
"def create_app(self):\n raise NotImplementedError",
"def create_application(self, application_name): \n self.__obj = GenericModel({ x:None for x in self.swagger_map.values()}, self.swagger_types, self.swagger_map)\n self.ap... | [
"0.6613759",
"0.65725696",
"0.633897",
"0.6330158",
"0.63220245",
"0.61545676",
"0.61485475",
"0.59482026",
"0.58919764",
"0.5861866",
"0.5850188",
"0.58348453",
"0.5783369",
"0.5757614",
"0.5734933",
"0.57022",
"0.5699147",
"0.5669042",
"0.5607267",
"0.5598983",
"0.5572484",... | 0.81362826 | 0 |
Creates OperationContract for deploying an unversioned configmap To verify the operation, we just check that the configmap was created with the correct 'value'. | def deploy_unversioned_config_map(self, value):
name = self.TEST_APP + "-configmap"
manifest = self.mf.config_map(name, {"value": value})
manifest["metadata"]["annotations"] = {
"strategy.spinnaker.io/versioned": "false"
}
payload = self.agent.make_json_payload_from_... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def deploy_config_map(self, version):\n bindings = self.bindings\n name = self.TEST_APP + \"-configmap\"\n payload = self.agent.make_json_payload_from_kwargs(\n job=[\n {\n \"cloudProvider\": \"kubernetes\",\n \"moniker\": {\"app\... | [
"0.6155861",
"0.6141777",
"0.5264338",
"0.5183196",
"0.5053572",
"0.50522214",
"0.5027589",
"0.5027439",
"0.5019772",
"0.49927342",
"0.49925116",
"0.4974761",
"0.49465528",
"0.48903486",
"0.4855246",
"0.4847247",
"0.47990453",
"0.47681066",
"0.47518644",
"0.47447598",
"0.4737... | 0.6925735 | 0 |
Get the distance as crow flies between two coordinates | def _getDistance(self, source, dest):
lat1 = source[0]
lat2 = dest[0]
lon1 = source[1]
lon2 = dest[1]
# Formula from https://www.movable-type.co.uk/scripts/latlong.html
R = 6370000
phi1 = math.radians(lat1)
phi2 = math.radians(lat2)
deltaPhi = ma... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def distance(self, c1, c2):\r\n x = (c2.x - c1.x) ** 2\r\n y = (c2.y - c1.y) ** 2\r\n d = int(round(math.sqrt(x + y)))\r\n return d",
"def distance(self, coord1, coord2):\n return (abs(coord1.x - coord2.x) + abs(coord1.y - coord2.y) + abs(coord1.z - coord2.z))//2",
"def get_dista... | [
"0.7777233",
"0.7678705",
"0.76623553",
"0.7549913",
"0.75067663",
"0.7465363",
"0.736125",
"0.735324",
"0.7338006",
"0.7332018",
"0.7324709",
"0.7270603",
"0.72402084",
"0.72339714",
"0.7232275",
"0.72285545",
"0.7219897",
"0.72177947",
"0.72145826",
"0.7201719",
"0.7195925"... | 0.0 | -1 |
Similar to MATLAB's unique(A, 'rows'), this returns B, I, J where B is the unique rows of A and I and J satisfy | def _unique_rows(self, A, return_index=False, return_inverse=False):
A = np.require(A, requirements='C')
assert A.ndim == 2, "array must be 2-dim'l"
B = np.unique(A.view([('', A.dtype)]*A.shape[1]),
return_index=return_index,
return_inverse=return_inverse)
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def uniqueRows(a):\n \n order = np.lexsort(a.T)\n a = a[order]\n diff = np.diff(a, axis=0)\n ui = np.ones(len(a), 'bool')\n ui[1:] = (diff != 0).any(axis=1) \n return a[ui]",
"def unique_rows(a):\n\n # Sort array and kep track of where things should go back to\n order = numpy.lexsort(a... | [
"0.7306203",
"0.7206575",
"0.7162544",
"0.71219265",
"0.7078156",
"0.6869779",
"0.6758558",
"0.66595024",
"0.66167706",
"0.65385425",
"0.6434616",
"0.64217526",
"0.635455",
"0.63533914",
"0.6352573",
"0.6288619",
"0.6139441",
"0.6102825",
"0.60934585",
"0.60439044",
"0.604065... | 0.6987091 | 5 |
Get the sorting key for a particular connection. | def connection_sort_key(conn):
conn_rec_state = ConnRecord.State.get(conn["state"])
if conn_rec_state is ConnRecord.State.ABANDONED:
pfx = "2"
elif conn_rec_state is ConnRecord.State.INVITATION:
pfx = "1"
else:
pfx = "0"
return pfx + conn["created_at"] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_sort_key(self) -> str:\n return self.name",
"def sort_key(self):\n ...",
"def _get_field_sort_key(self, field):\n if not field.is_relation:\n return -1\n return 0 if field.many_to_many else 1",
"def _get_sort_key(self, req):\n sort_key = req.params.get('s... | [
"0.7124491",
"0.61719435",
"0.6006381",
"0.59646034",
"0.593306",
"0.59151715",
"0.58708483",
"0.58708483",
"0.574168",
"0.5732659",
"0.57320905",
"0.57227623",
"0.57149255",
"0.571128",
"0.5657148",
"0.56437886",
"0.5617406",
"0.554018",
"0.550515",
"0.5501648",
"0.549187",
... | 0.72920924 | 0 |
Set the observation vector. Set the complete observation vector for the Model object. That is, the independentVariable ('lambda'), the observation ('y') and the observation error ('sigma_y'). These attributes can be accessed directly, but this method also performs a consistency check, and raises a ValueError if there i... | def setObservationVector(self, independentVariable=None,
observation=None, observationError=None):
if independentVariable is not None:
self.independentVariable = independentVariable
if observation is not None:
self.observation = observation
i... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set(self, incoming_vector):\n self.vector = incoming_vector",
"def get_obsvar(self) -> ndarray:\n return self.data.obs_se**(2*self.data.weight)",
"def setMoreVectors(self, nmbrObs, nmbrStates, nmbrObsAtEpoch):\n return",
"def set_obs(self, num_obs):\n curr_obs = self._nobs\n ... | [
"0.5568753",
"0.54498786",
"0.54224336",
"0.5416824",
"0.52469414",
"0.50637823",
"0.5058865",
"0.50526947",
"0.50526947",
"0.5049094",
"0.5030915",
"0.50155795",
"0.49833998",
"0.49803352",
"0.4980099",
"0.49770597",
"0.49372035",
"0.48916665",
"0.48763168",
"0.48652416",
"0... | 0.7341851 | 0 |
Set up the prior error covariance transformation matrices. Use the a priori error covariance matrix to initialize the L{priorSinvh}, L{priorSinv} and L{priorSh} instance variables. These do not change between iterations. | def transformPriorErrorCovariance(self):
U_a, w_a, V_aT = np.linalg.linalg.svd(self.model.priorCovariance,
full_matrices=False)
V_a = V_aT.T
self.priorSinvh = V_a * np.matrix(np.diag(np.sqrt(1.0/w_a))) * U_a.T
self.priorSh = U_a * np.matrix(... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_prior_priorunc_synthetic(self):\n\n lai_coeff_absunc = None\n statevec_absunc = None\n\n #-- \n if self.prior_inifile!=None:\n lai_coeff_absunc, statevec_absunc = self._setprior_from_inifile()\n elif self.use_generic_prior:\n self._setprior_generic_... | [
"0.6002748",
"0.5786807",
"0.5702269",
"0.5545899",
"0.5535561",
"0.551192",
"0.5480139",
"0.54198855",
"0.53890663",
"0.53867537",
"0.53808546",
"0.53593266",
"0.53485334",
"0.5320111",
"0.5243556",
"0.5231042",
"0.5218979",
"0.5210285",
"0.51924026",
"0.5178953",
"0.5174805... | 0.7580126 | 0 |
Returns the number of seconds used for segmenting captions. | def seconds(self):
return self._seconds | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def total_seconds(self):\n return 0",
"def duration_in_seconds(self):\n \"Should not set track length\"\n return self.duration / float(self.samplerate)",
"def duration_in_seconds(self):\n return self.get_data(\"duration_in_seconds\")",
"def seconds(self):\n end = self.end o... | [
"0.7115835",
"0.7081439",
"0.7008578",
"0.6998995",
"0.6798374",
"0.6795163",
"0.676873",
"0.6734322",
"0.67157626",
"0.6711243",
"0.6666995",
"0.66147953",
"0.65985173",
"0.6561468",
"0.65420717",
"0.653661",
"0.65087306",
"0.6479792",
"0.64749396",
"0.6471311",
"0.6456956",... | 0.6955087 | 4 |
This function will return a random datetime between two datetime objects. | def random_date(start, end):
delta = end - start
int_delta = (delta.days * 24 * 60 * 60) + delta.seconds
random_second = randrange(int_delta)
return (start + timedelta(seconds=random_second)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def random_date(start, end):\r\n return start + datetime.timedelta(\r\n # Get a random amount of seconds between `start` and `end`\r\n seconds=random.randint(0, int((end - start).total_seconds())),\r\n )",
"def random_date(start, end):\r\n delta = end - start\r\n int_delta = (delta.days... | [
"0.77918494",
"0.75647223",
"0.754578",
"0.75309545",
"0.7509593",
"0.7509593",
"0.7509593",
"0.7509593",
"0.7509593",
"0.7405053",
"0.7334951",
"0.7235134",
"0.7207752",
"0.7169905",
"0.6945745",
"0.6864313",
"0.67521274",
"0.66044766",
"0.6574501",
"0.6525121",
"0.6248982",... | 0.7562488 | 2 |
Used by the Battlesnake Engine to make sure your snake is still working. | def ping():
return HTTPResponse(status=200) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def check_game_over(self):\n for piece in self.pieces:\n if not piece.destroyed:\n return False\n print(\"Signal.END\")\n return True",
"def check_progress(self):\n if self.check_snake():\n but = tk.Button(root, text=\"Again?\")\n but.pa... | [
"0.65386605",
"0.6491813",
"0.647458",
"0.6407715",
"0.6376059",
"0.63720906",
"0.63428444",
"0.634256",
"0.62999684",
"0.62779033",
"0.6273772",
"0.62673014",
"0.62650895",
"0.62641495",
"0.6253997",
"0.62258834",
"0.621677",
"0.61663955",
"0.60920846",
"0.6077571",
"0.60706... | 0.0 | -1 |
Returns the default collector settings | def get_default_config(self):
config = super(NumaCollector, self).get_default_config()
config.update(
{
"path": "numa",
"bin": self.find_binary("numactl"),
}
)
return config | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_default_config(self):\r\n config = super(CMDCollector, self).get_default_config()\r\n config.update({\r\n 'enabled': 'True',\r\n 'fs': ',',\r\n 'timeout': 300,\r\n })\r\n return config",
"def getDefaultSettings():\n return {}",
"def ge... | [
"0.70514023",
"0.7008024",
"0.69490683",
"0.6713433",
"0.65743333",
"0.65309024",
"0.6521635",
"0.6515402",
"0.6466526",
"0.6447688",
"0.641337",
"0.6397818",
"0.6380512",
"0.63683224",
"0.6357208",
"0.63517016",
"0.6331759",
"0.63120294",
"0.62353724",
"0.6231899",
"0.620749... | 0.6063105 | 26 |
Transform the 1d standard deviation of the quaternions as \sigma = mean[ cos^{1} (q_i \cdot \bar{q}) ] where \bar{q} = average_quaternion(quaternions) | def quaternion_covariance_1d(quaternions, weights=None, avg=None):
if avg is None:
avg = average_quaternion(quaternions, weights)
ang = 2*np.arccos(np.dot(quaternions, avg))
if weights is not None:
ang = ang * weights
return np.sqrt(np.sum(np.square(ang)) / (ang.size - 1)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def quat_mean(quaternions):\n if len(quaternions) <= 0:\n return np.nan\n elif len(quaternions) == 1:\n # Only one quaternion, it is the average of itself\n return quaternions[0]\n elif len(quaternions) == 2:\n # We have weird errors for 2 quaternions using the matrix\n ... | [
"0.6947044",
"0.62568194",
"0.62214327",
"0.6136503",
"0.60777205",
"0.60298884",
"0.60150236",
"0.6013659",
"0.58779263",
"0.5851462",
"0.5850681",
"0.58486146",
"0.58139473",
"0.58139265",
"0.58000535",
"0.5787839",
"0.578402",
"0.57649326",
"0.57586837",
"0.57512265",
"0.5... | 0.59381056 | 8 |
Makes a plot.scatter of group in (). Shows all variables plot to another. | def group_matrix(self, group):
mapped = self.map_vects(datanorm)
mappednp= np.array(mapped)
groups= mappednp[:,0]
data['Group'] = pd.Series(groups, index=data.index)
pd.scatter_matrix(data[data['Group']==group], alpha = 0.3, figsize = (28,28)); | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def scatter_plot(group1, group2):\n plt.scatter(group1, group2)\n plt.show()",
"def show_scatter(self):\n plt.scatter(self.a1[:, 0], self.a1[:, 1], c=\"red\", alpha=0.5, s=10)\n plt.scatter(self.a2[:, 0], self.a2[:, 1], c=\"blue\", alpha=0.5, s=10)\n plt.scatter(0, 0, marker=\"D\", c=\... | [
"0.76862794",
"0.70073617",
"0.6730948",
"0.6724957",
"0.66006815",
"0.65821755",
"0.6516544",
"0.64948267",
"0.64285254",
"0.6393015",
"0.6301456",
"0.62043196",
"0.6193517",
"0.6193517",
"0.617479",
"0.61629415",
"0.61450654",
"0.6121066",
"0.6117277",
"0.61036426",
"0.6088... | 0.5500761 | 89 |
Initialize window from a string of properties. | def __init__(self, window_string):
parts = window_string.split()
parts.sort()
if (len(parts) == 4 and parts[0].startswith('H=') and parts[1].startswith('W=') and
parts[2].startswith('X=') and parts[3].startswith('Y=')):
self.h = int(parts[0][2:])
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def FromString(\r\n title,\r\n msg,\r\n width = 70,\r\n main_keys = \"\",\r\n alt_keys = \"\",\r\n ctrl_keys = \"\",\r\n shift_keys = \"\"):\r\n w = Window()\r\n r = w.Create(\r\n title = title,\r\n lines = (msg.split('\\n') if is... | [
"0.5692427",
"0.5652486",
"0.55053866",
"0.53643733",
"0.5330115",
"0.53089744",
"0.5193356",
"0.51897776",
"0.5177125",
"0.5162342",
"0.51559424",
"0.5151832",
"0.51504785",
"0.5093747",
"0.5093496",
"0.50770414",
"0.5055365",
"0.50533885",
"0.50476974",
"0.50416225",
"0.503... | 0.60821855 | 0 |
Get the node expected value. Returns the expected real value of node, based on the current beliefs for node, and if std_dev is nonNULL, std_dev will be set to the standard deviation. Returns UNDEF_DBL if the expected value couldn't be calculated. | def getnodeexpectedvalue(self, node_p):
node_p = self.getnodenamed(node_p) # Verify pointer.
# (node_bn* node, double* std_dev, double* x3, double* x4)
stdev = c_double(9999) # standard deviation
x3 = c_double_p()
x4 = c_double_p()
# expected value. Also tweaks stdev.... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def em_std(self) -> float:\n if self.__total_pulls == 0:\n raise Exception('Number of pulls is 0. No empirical standard deviation.')\n return math.sqrt(\n (self.__sum_of_square_reward -\n self.__total_rewards**2 / self.__total_pulls) / self.__total_pulls)",
"def expected_value(node, cal... | [
"0.60147876",
"0.58711475",
"0.5704372",
"0.5649904",
"0.5568477",
"0.5474774",
"0.5468214",
"0.5444928",
"0.54414487",
"0.5435085",
"0.5412228",
"0.54116774",
"0.54084724",
"0.54016733",
"0.53982776",
"0.5397043",
"0.5388171",
"0.5373062",
"0.5372943",
"0.5372685",
"0.536912... | 0.8005751 | 0 |
Creates a dictionary of lowercase words as keys and values is a list of each occurence. | def purge_words(self):
word_list = self.transcript_string.encode('utf-8').split()
purged_word_list = {}
for word in word_list:
if word.isalpha():
if word.islower():
purged_word_list.setdefault(word, []).append(word)
else:
lower_word = word.lower()
purged_word_list.setdefault(lower_word,... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def prepareDictionary(words):\n wordsDictionary = {}\n for word in words:\n # Handle subsequent Occurences\n if (wordsDictionary.get(word.lower(), None) != None):\n # Search and add words by checking their lowercase version\n wordsDictionary[word.lower()] = wordsDictionary... | [
"0.73634344",
"0.70690423",
"0.69722104",
"0.6928977",
"0.67160416",
"0.655981",
"0.65255827",
"0.6483182",
"0.64596575",
"0.6402409",
"0.6382471",
"0.6372438",
"0.6369831",
"0.63506305",
"0.63506305",
"0.63506305",
"0.63506305",
"0.63506305",
"0.63506305",
"0.63506305",
"0.6... | 0.0 | -1 |
Creates a dictionary with each word as they keys and weight as values. References sentence_index and word list. In each keyvalue pair, the key is each word, the value is a tuple | def analyze_words(self):
word_analysis = {}
for word in self.word_list:
if word not in word_analysis:
academic = (word in LEMMA_DICT)
length = len(word)
frequency = len(self.word_list[word])
stem = word
word_location_index = len(self.sentence_index)-1 #first set it as the last index
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sentencesToBow(documents):\n bowSentences = []\n dictionary = Dictionary(documents)\n\n numDocs = len(documents);\n avgDocLength = sum(map(len, documents))/numDocs\n for document in documents:\n bowSentence = []\n docLength = len(document)\n bowDoc = dictionary.doc2bow(docum... | [
"0.6585632",
"0.6318375",
"0.6309345",
"0.6251711",
"0.62190956",
"0.62137204",
"0.6154998",
"0.61176366",
"0.60733944",
"0.60337746",
"0.60201806",
"0.60066915",
"0.6000292",
"0.5979205",
"0.597588",
"0.5960629",
"0.59481394",
"0.59470373",
"0.594699",
"0.59320706",
"0.59192... | 0.61493695 | 7 |
Build an actor (policy) network that maps states > actions. | def forward(self, state):#forward pass
x = F.relu(self.fc1(state))
x = F.relu(self.fc2(x))
return torch.tanh(self.fc3(x)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _make_actor_network(states, num_controls, params, scope_name):\n scope_key = scope_name + '/'\n with tf.variable_scope(scope_name):\n hidden_1 = tf.layers.dense(states,\n units=params.actor_hidden_units[0],\n activation=None,\n ... | [
"0.69356495",
"0.636351",
"0.6270465",
"0.62087923",
"0.62009275",
"0.6187312",
"0.61473614",
"0.6146225",
"0.6128509",
"0.60179603",
"0.6002386",
"0.5976266",
"0.5959938",
"0.5952642",
"0.594925",
"0.59280884",
"0.5916518",
"0.5898108",
"0.58937097",
"0.5891148",
"0.5880467"... | 0.0 | -1 |
Map COCO label to the label as used in the network. COCO has some gaps in the order of labels. The highest label is 90, but there are 80 classes. | def coco_label_to_label(self, coco_label):
return self.coco_labels_inverse[coco_label] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def label_to_coco_label(self, label):\n\t\t\treturn self.coco_labels[label]",
"def label_to_coco_label(self, label):\n\t\treturn self.coco_labels[label]",
"def coco_label_to_label(self, coco_label):\n\t\t\treturn self.coco_labels_inverse[coco_label]",
"def encode_label(self, label: str) -> int:\n retu... | [
"0.74929917",
"0.7477815",
"0.70492953",
"0.6624074",
"0.6605137",
"0.6600722",
"0.6494988",
"0.6397484",
"0.63876444",
"0.62863195",
"0.6259228",
"0.62550527",
"0.6247205",
"0.62332237",
"0.618181",
"0.6179895",
"0.6178193",
"0.6177591",
"0.6175026",
"0.61474305",
"0.6121897... | 0.70390165 | 3 |
Map label as used by the network to labels as used by COCO. | def label_to_coco_label(self, label):
return self.coco_labels[label] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def label_to_coco_label(self, label):\n\t\t\treturn self.coco_labels[label]",
"def coco_label_to_label(self, coco_label):\n\t\t\treturn self.coco_labels_inverse[coco_label]",
"def convert_label(self, label, inverse=False):\n temp = label.copy()\n if inverse:\n for v, k in self.label_ma... | [
"0.7404991",
"0.71324396",
"0.7105512",
"0.7097643",
"0.7018557",
"0.67486686",
"0.67026395",
"0.67000383",
"0.664837",
"0.6470152",
"0.6439549",
"0.6426615",
"0.6418375",
"0.64091164",
"0.63283324",
"0.63283324",
"0.63283324",
"0.63283324",
"0.63283324",
"0.63283324",
"0.632... | 0.7354185 | 1 |
calculate backward new Tensor gradient | def backward(self, lhs: Tensor, rhs: Tensor, acc_grad: np.ndarray):
raise NotImplementedError | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def backward(self, gradient: Tensor) -> Tensor:\n self.b_grad = np.sum(gradient, axis=0)\n self.w_grad = self.inputs.T @ gradient\n return gradient @ self.w.T",
"def backward(self):\n gradient = blah\n return gradient",
"def backward(self):\n gradient = blah\n r... | [
"0.84203595",
"0.8299815",
"0.8299815",
"0.8266994",
"0.8236108",
"0.8236108",
"0.7854593",
"0.78337586",
"0.7706464",
"0.7631323",
"0.7559718",
"0.75368637",
"0.75330675",
"0.7532979",
"0.74950665",
"0.7486049",
"0.7468978",
"0.74296844",
"0.7417122",
"0.74073696",
"0.739206... | 0.7512873 | 14 |
cat two tensor with the same dim within given axes | def __init__(self, axes: int):
self.axes = axes | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def cat(ts1: Tensor, ts2: Tensor, axes: int) -> Tensor:\n cat_op = CatOp(axes)\n return cat_op(ts1, ts2)",
"def concatenate(tensors, axis=0):\n raise NotImplementedError",
"def concat(a, b):\n return torch.cat((a, b), 1)",
"def concatenate(tensors, axis=-1):\n if axis < 0:\n rank = ... | [
"0.7827445",
"0.74524367",
"0.7032378",
"0.663686",
"0.6635489",
"0.65540326",
"0.6547592",
"0.65369856",
"0.65329486",
"0.65106857",
"0.6466926",
"0.6466926",
"0.64273536",
"0.6350371",
"0.6345597",
"0.6317253",
"0.6278702",
"0.626415",
"0.6219375",
"0.62162274",
"0.6215634"... | 0.0 | -1 |
Same as np.reshape, shape must be specified | def permute(ts: Tensor, axes) -> Tensor:
permute_op = PermuteOp(axes)
return permute_op(ts, None) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def reshape(self, *shape):\n return F.Reshape.apply(self, shape)",
"def reshape(x, shape):\n return Reshape(shape)(x)",
"def reshape(x, shape):\n if x.shape == shape:\n return chainer.as_variable(x)\n y, = Reshape(shape).apply((x,))\n return y",
"def _reshape(self, arr: np.ndarray) ... | [
"0.808975",
"0.80426913",
"0.7555648",
"0.7548652",
"0.7544351",
"0.7388972",
"0.7381575",
"0.7374622",
"0.7355609",
"0.7296443",
"0.70310396",
"0.69867545",
"0.6939513",
"0.6911108",
"0.6877",
"0.68730307",
"0.6746055",
"0.67414135",
"0.6730201",
"0.67238903",
"0.6723675",
... | 0.0 | -1 |
1hot encodes a tensor | def to_categorical(index_label, num_classes):
return index_label, np.eye(num_classes, dtype='uint8')[index_label] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def one_hot_encode(x):\n # TODO: Implement Function\n output = np.zeros((len(x), 10))\n \n for i, j in enumerate(x):\n output[i,j] = 1\n \n return output",
"def one_hot_encode(self, arr, n_labels):\n one_hot = np.zeros((np.multiply(*arr.shape), n_labels), dtype=np.float32)\... | [
"0.82578593",
"0.8061468",
"0.80140257",
"0.7917851",
"0.7914897",
"0.7883416",
"0.78429884",
"0.78089696",
"0.7765784",
"0.77376443",
"0.77376443",
"0.7733915",
"0.7728651",
"0.77133274",
"0.7686273",
"0.76797515",
"0.75851345",
"0.7560708",
"0.75560004",
"0.75353223",
"0.75... | 0.0 | -1 |
Ensure the number of columns is correct. We could also check other items but for now do not bother. | def check_row(row):
if len(row) != _ncols:
raise ValueError("Row contains {0} columns, expected {1}!\n\n{2}\n".format(len(row), _ncols, row)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_num_columns(self):\n pass",
"def checkLineStandardCompliance(line):\n if len(line) != 5:\n print(line + \" HAS WRONG NUMBER OF COLUMNS: \" + str(len(line)))\n exit(5)",
"def test_too_many_cols1():\n text = dedent(\n \"\"\"\n A B C\n 1 2 3\n 4 5 6\n 7 8 9 1... | [
"0.7230864",
"0.6989272",
"0.6918795",
"0.68983734",
"0.6841887",
"0.6794155",
"0.67335033",
"0.6679962",
"0.66472363",
"0.6631311",
"0.6607692",
"0.65550214",
"0.6505293",
"0.6498067",
"0.64914274",
"0.6461276",
"0.64579046",
"0.6453518",
"0.64478564",
"0.6445254",
"0.643038... | 0.674241 | 6 |
Return the cell for the given column name from the row, which is expected to be the return value of a csv reader object. We assume that check_row() has already been called on this row. | def get_column(row, cname):
try:
return row[_colmap[cname]]
except KeyError:
raise ValueError("Invalid column name: {0}!".format(cname)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_value(self, row, colName):\n\t\treturn self[row][self._columns[colName]]",
"def get(self, column_name, row_index):\n self.check_for_column(column_name)\n return self.data[column_name][row_index]",
"def get_entry_from_row(self, row: [str], column_header: str) -> str:\n column_index ... | [
"0.72102106",
"0.7037878",
"0.70329326",
"0.6848971",
"0.64457536",
"0.6421378",
"0.64083207",
"0.6371583",
"0.635542",
"0.634281",
"0.6336029",
"0.6272615",
"0.61894894",
"0.61894894",
"0.6181252",
"0.6180843",
"0.6179127",
"0.61550033",
"0.6114806",
"0.60768515",
"0.5938038... | 0.6362964 | 8 |
Sets the total_nucleus_clients of this ClientAnalyticsHistory. | def total_nucleus_clients(self, total_nucleus_clients):
self._total_nucleus_clients = total_nucleus_clients | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def total_nucleus_clients_active(self, total_nucleus_clients_active):\n\n self._total_nucleus_clients_active = total_nucleus_clients_active",
"def total_nucleus_clients_inactive(self, total_nucleus_clients_inactive):\n\n self._total_nucleus_clients_inactive = total_nucleus_clients_inactive",
"def... | [
"0.7470305",
"0.6569929",
"0.60935354",
"0.582152",
"0.5813615",
"0.5656197",
"0.5222313",
"0.51853704",
"0.50911915",
"0.49892044",
"0.49373275",
"0.4924496",
"0.49083504",
"0.4883462",
"0.4871158",
"0.48511893",
"0.4834317",
"0.4813732",
"0.4806626",
"0.47913703",
"0.475832... | 0.8933069 | 0 |
Sets the total_nucleus_clients_active of this ClientAnalyticsHistory. | def total_nucleus_clients_active(self, total_nucleus_clients_active):
self._total_nucleus_clients_active = total_nucleus_clients_active | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def total_nucleus_clients(self, total_nucleus_clients):\n\n self._total_nucleus_clients = total_nucleus_clients",
"def total_nucleus_clients_inactive(self, total_nucleus_clients_inactive):\n\n self._total_nucleus_clients_inactive = total_nucleus_clients_inactive",
"def active_users(self, active_u... | [
"0.8216425",
"0.74747777",
"0.5902427",
"0.57624555",
"0.5488547",
"0.5298516",
"0.52672803",
"0.5254817",
"0.52152616",
"0.5174416",
"0.5126269",
"0.50991493",
"0.5071984",
"0.50326395",
"0.48149082",
"0.48139507",
"0.4780745",
"0.47745016",
"0.47604343",
"0.4741089",
"0.471... | 0.88221914 | 0 |
Sets the total_nucleus_clients_inactive of this ClientAnalyticsHistory. | def total_nucleus_clients_inactive(self, total_nucleus_clients_inactive):
self._total_nucleus_clients_inactive = total_nucleus_clients_inactive | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def total_nucleus_clients_active(self, total_nucleus_clients_active):\n\n self._total_nucleus_clients_active = total_nucleus_clients_active",
"def total_nucleus_clients(self, total_nucleus_clients):\n\n self._total_nucleus_clients = total_nucleus_clients",
"def all_inactive(self, now):\n f... | [
"0.70020145",
"0.6538475",
"0.5251399",
"0.5183563",
"0.51755464",
"0.51420754",
"0.510278",
"0.5064587",
"0.49563715",
"0.48837873",
"0.48745427",
"0.48389724",
"0.4765279",
"0.47472858",
"0.46584645",
"0.46230036",
"0.45587987",
"0.45576707",
"0.45302632",
"0.45290178",
"0.... | 0.8986255 | 0 |
Returns true if both objects are equal | def __eq__(self, other):
if not isinstance(other, ClientAnalyticsHistory):
return False
return self.__dict__ == other.__dict__ | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __eq__(self, other):\n return are_equal(self, other)",
"def __eq__(self, other):\n return are_equal(self, other)",
"def __eq__(self,other):\n try: return self.object==other.object and isinstance(self,type(other))\n except: return False",
"def __eq__(self, other):\n if i... | [
"0.8088132",
"0.8088132",
"0.8054589",
"0.7982687",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
... | 0.0 | -1 |
Returns true if both objects are not equal | def __ne__(self, other):
return not self == other | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __ne__(self, other: object) -> bool:\n if self.__eq__(other):\n return False\n return True",
"def __ne__(self, other: object) -> bool:\n return not self.__eq__(other)",
"def __ne__(self, other) -> bool:\n return not self.__eq__(other)",
"def __eq__(self, other):\n ... | [
"0.845611",
"0.8391477",
"0.8144138",
"0.81410587",
"0.8132492",
"0.8093973",
"0.80920255",
"0.80920255",
"0.80920255",
"0.8085325",
"0.8085325",
"0.8076365",
"0.8076365",
"0.8065748"
] | 0.0 | -1 |
Return first item in sequence where f(item) == True. | def find(f, seq):
for item in seq:
if f(item):
return item
"""
Example usage of iterate:
>>> c = []; \
c.append(node(0.5,1,'a')); \
c.append(node(0.25,2,'b')); \
c.append(node(0.125,3,'c')); \
c.append(node(0.125,4,'d')); \
iterate(c) ; repo... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def finditem(func, seq):\n return next((item for item in seq if func(item)))",
"def find(f, seq):\n for item in seq:\n if f(item): \n return item",
"def first_true(iterable, default=False, pred=None):\n return next(filter(pred, iterable), default)",
"def _first(self, \n iterable,... | [
"0.7381083",
"0.7370345",
"0.69793993",
"0.68005335",
"0.67570746",
"0.67258066",
"0.6664692",
"0.66255635",
"0.6597727",
"0.64589864",
"0.64407694",
"0.6315168",
"0.6314598",
"0.63102686",
"0.6286507",
"0.6251015",
"0.6169875",
"0.6169091",
"0.6152609",
"0.6152609",
"0.60645... | 0.5963246 | 23 |
Uses the phonenumbers library to try and parse the phone number and check for it's validity. | def validate_phone_number(value):
try:
z = phonenumbers.parse(value, None)
except phonenumbers.NumberParseException:
raise forms.ValidationError("Enter a valid phone number.")
if not phonenumbers.is_valid_number(z):
raise forms.ValidationError("Enter a valid phone number.") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def validate_phone(form, field):\n if len(field.data) > 16:\n raise ValidationError('Invalid phone number')\n try:\n input_number = phonenumbers.parse(field.data)\n if not (phonenumbers.is_valid_number(input_number)):\n raise ValidationError('Invalid phone number')\n except... | [
"0.7850687",
"0.7783735",
"0.7569741",
"0.73978966",
"0.73794854",
"0.7283335",
"0.7258522",
"0.72356963",
"0.720666",
"0.72043437",
"0.717047",
"0.7170252",
"0.7161817",
"0.71589524",
"0.71436983",
"0.7115741",
"0.7092493",
"0.7064742",
"0.7024102",
"0.69751966",
"0.69108856... | 0.80537504 | 0 |
Returns a list of canonical pathnames to the files in the directory | def get_test_paths(directory):
canonical_test_paths = []
for top, dirs, files in os.walk(directory):
for fname in files:
name = os.path.join(top, fname)
if is_crashing_test(name):
canonical_test_paths.append(os.path.join(directory, name))
# make sure there are some
if not canonical_te... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def list_filenames(self):\n l = []\n for path, dirs, files in os.walk(self.archive_path):\n for file in files:\n l.append(os.path.relpath(os.path.join(path,file),self.archive_path))\n l.sort()\n return l",
"def get_filepaths(directory):\n file_paths = [] ... | [
"0.73341644",
"0.6839347",
"0.6802706",
"0.6710588",
"0.66947037",
"0.66181576",
"0.65735364",
"0.6571562",
"0.65599096",
"0.6546754",
"0.65432763",
"0.6539398",
"0.65289783",
"0.6491256",
"0.6490927",
"0.6486839",
"0.64830285",
"0.6464126",
"0.6464126",
"0.6464126",
"0.64601... | 0.6029069 | 98 |
Gets the path to the asset as it will be seen from the device | def get_device_path(test):
return DEVICE_ASSETS_PATH + os.path.basename(test) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_path(self):\n raise NotImplementedError(\"This asset does not support absolute paths\")",
"def assets_path(self) -> str:\n return self._assets_path",
"def get_asset_path(test):\n return DEVICE_ASSETS_PATH + os.path.basename(test)",
"def get_path(self, asset, force_save=None):\n ... | [
"0.7675552",
"0.7566313",
"0.7532711",
"0.7286676",
"0.7271101",
"0.7098232",
"0.7019955",
"0.7009695",
"0.68907243",
"0.6770987",
"0.676918",
"0.6759464",
"0.6701161",
"0.6627846",
"0.6624014",
"0.6610173",
"0.6566968",
"0.65633434",
"0.6536629",
"0.6526675",
"0.6488551",
... | 0.6737269 | 12 |
Returns the path that the generated test should be stored at | def get_host_test_path(java_name):
return os.path.join(HOST_SOURCE_PATH, java_name + '.java') | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_test_file_path(self):\n xml_file_path_prefix = \"./tests/\"\n return xml_file_path_prefix + self.test_name + \"_data/\"",
"def get_test_path():\n path, name = os.path.split(__file__)\n return os.path.join(path,\"..\", 'test-data')",
"def track_path(self, filename):\n return o... | [
"0.76989424",
"0.74078256",
"0.72164226",
"0.72164226",
"0.72164226",
"0.7096474",
"0.7089423",
"0.7062985",
"0.70561725",
"0.70007735",
"0.69481516",
"0.6925794",
"0.6910047",
"0.6903516",
"0.68890107",
"0.6887528",
"0.6762187",
"0.6762187",
"0.6734991",
"0.6713435",
"0.6704... | 0.61335784 | 91 |
r"""Rate (/s) counter for decomptcptxpackets. | def decomptcptxpacketsrate(self) :
try :
return self._decomptcptxpacketsrate
except Exception as e:
raise e | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def decomptcprxpacketsrate(self) :\n\t\ttry :\n\t\t\treturn self._decomptcprxpacketsrate\n\t\texcept Exception as e:\n\t\t\traise e",
"def comprxpacketsrate(self) :\n\t\ttry :\n\t\t\treturn self._comprxpacketsrate\n\t\texcept Exception as e:\n\t\t\traise e",
"def comptcptxpacketsrate(self) :\n\t\ttry :\n\t\t\t... | [
"0.7567904",
"0.747568",
"0.7345198",
"0.73360974",
"0.730946",
"0.72225785",
"0.7172208",
"0.6669232",
"0.6461923",
"0.6397926",
"0.6354336",
"0.63051105",
"0.6285625",
"0.6271034",
"0.62675667",
"0.6229674",
"0.61389595",
"0.6127572",
"0.61240107",
"0.6103677",
"0.6068955",... | 0.7549379 | 1 |
r"""Rate (/s) counter for delcomptcprxpackets. | def delcomptcprxpacketsrate(self) :
try :
return self._delcomptcprxpacketsrate
except Exception as e:
raise e | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def comptcprxpacketsrate(self) :\n\t\ttry :\n\t\t\treturn self._comptcprxpacketsrate\n\t\texcept Exception as e:\n\t\t\traise e",
"def comprxpacketsrate(self) :\n\t\ttry :\n\t\t\treturn self._comprxpacketsrate\n\t\texcept Exception as e:\n\t\t\traise e",
"def comptcptxpacketsrate(self) :\n\t\ttry :\n\t\t\tretu... | [
"0.77295744",
"0.752629",
"0.73302776",
"0.72378176",
"0.703985",
"0.6703409",
"0.6632302",
"0.6586457",
"0.62852263",
"0.6161554",
"0.61030734",
"0.6030127",
"0.601796",
"0.5971837",
"0.5963117",
"0.5917141",
"0.5911743",
"0.58976233",
"0.58603835",
"0.5823261",
"0.57961375"... | 0.7021776 | 5 |
r"""Rate (/s) counter for decomptcprxpackets. | def decomptcprxpacketsrate(self) :
try :
return self._decomptcprxpacketsrate
except Exception as e:
raise e | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def comprxpacketsrate(self) :\n\t\ttry :\n\t\t\treturn self._comprxpacketsrate\n\t\texcept Exception as e:\n\t\t\traise e",
"def comptcprxpacketsrate(self) :\n\t\ttry :\n\t\t\treturn self._comptcprxpacketsrate\n\t\texcept Exception as e:\n\t\t\traise e",
"def comptxpacketsrate(self) :\n\t\ttry :\n\t\t\treturn ... | [
"0.76917005",
"0.76905316",
"0.7332458",
"0.7208438",
"0.7160638",
"0.7110362",
"0.6793317",
"0.67846423",
"0.66864043",
"0.658811",
"0.641577",
"0.62377995",
"0.6225643",
"0.6213843",
"0.6112242",
"0.60514754",
"0.6018",
"0.6016582",
"0.6000613",
"0.59748477",
"0.5931265",
... | 0.7658599 | 2 |
r"""Rate (/s) counter for comptcptotalrxbytes. | def comptcprxbytesrate(self) :
try :
return self._comptcprxbytesrate
except Exception as e:
raise e | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def comprxbytesrate(self) :\n\t\ttry :\n\t\t\treturn self._comprxbytesrate\n\t\texcept Exception as e:\n\t\t\traise e",
"def comptcptotalrxbytes(self) :\n\t\ttry :\n\t\t\treturn self._comptcptotalrxbytes\n\t\texcept Exception as e:\n\t\t\traise e",
"def comprxpacketsrate(self) :\n\t\ttry :\n\t\t\treturn self._... | [
"0.76036614",
"0.7290995",
"0.7256721",
"0.710676",
"0.6994817",
"0.6987093",
"0.67987996",
"0.66600233",
"0.65353215",
"0.6479359",
"0.64236563",
"0.6422727",
"0.63634956",
"0.6330343",
"0.62826896",
"0.6126954",
"0.6030352",
"0.59696543",
"0.59655774",
"0.5923639",
"0.59182... | 0.75185215 | 1 |
r"""Rate (/s) counter for comptcptotalrxpackets. | def comptcprxpacketsrate(self) :
try :
return self._comptcprxpacketsrate
except Exception as e:
raise e | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def comprxpacketsrate(self) :\n\t\ttry :\n\t\t\treturn self._comprxpacketsrate\n\t\texcept Exception as e:\n\t\t\traise e",
"def comptxpacketsrate(self) :\n\t\ttry :\n\t\t\treturn self._comptxpacketsrate\n\t\texcept Exception as e:\n\t\t\traise e",
"def comptcptxpacketsrate(self) :\n\t\ttry :\n\t\t\treturn sel... | [
"0.79030997",
"0.7441263",
"0.7213977",
"0.70567036",
"0.69343543",
"0.6925776",
"0.6902301",
"0.6872605",
"0.66739345",
"0.6578035",
"0.6384799",
"0.63134843",
"0.6285545",
"0.6270689",
"0.625085",
"0.6225871",
"0.62124896",
"0.61500275",
"0.611135",
"0.61102",
"0.5989334",
... | 0.77937853 | 1 |
r"""Rate (/s) counter for comptcptotaltxpackets. | def comptcptxpacketsrate(self) :
try :
return self._comptcptxpacketsrate
except Exception as e:
raise e | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def comptcprxpacketsrate(self) :\n\t\ttry :\n\t\t\treturn self._comptcprxpacketsrate\n\t\texcept Exception as e:\n\t\t\traise e",
"def comptxpacketsrate(self) :\n\t\ttry :\n\t\t\treturn self._comptxpacketsrate\n\t\texcept Exception as e:\n\t\t\traise e",
"def comprxpacketsrate(self) :\n\t\ttry :\n\t\t\treturn ... | [
"0.77696186",
"0.76417744",
"0.7531782",
"0.6809521",
"0.679222",
"0.6697808",
"0.6646873",
"0.65248984",
"0.6507004",
"0.6495431",
"0.64675474",
"0.6449508",
"0.6415337",
"0.6372109",
"0.6344784",
"0.63167787",
"0.6185898",
"0.61819977",
"0.60377073",
"0.60190195",
"0.594939... | 0.74933076 | 3 |
r"""Rate (/s) counter for comptotaltxpackets. | def comptxpacketsrate(self) :
try :
return self._comptxpacketsrate
except Exception as e:
raise e | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def comprxpacketsrate(self) :\n\t\ttry :\n\t\t\treturn self._comprxpacketsrate\n\t\texcept Exception as e:\n\t\t\traise e",
"def comptcprxpacketsrate(self) :\n\t\ttry :\n\t\t\treturn self._comptcprxpacketsrate\n\t\texcept Exception as e:\n\t\t\traise e",
"def comptcptxpacketsrate(self) :\n\t\ttry :\n\t\t\tretu... | [
"0.77167064",
"0.7558885",
"0.7278112",
"0.6736333",
"0.6720277",
"0.6714035",
"0.66897345",
"0.66111827",
"0.65670824",
"0.6511434",
"0.64510214",
"0.6258393",
"0.62506986",
"0.61847454",
"0.6172374",
"0.6102235",
"0.60876244",
"0.6054647",
"0.6042492",
"0.5981308",
"0.59470... | 0.77467847 | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.