query
stringlengths
9
9.05k
document
stringlengths
10
222k
negatives
listlengths
19
20
metadata
dict
ExtractLGP(file, dir=None) Extracts the contents of a LGP archive in a folder. Returns the resulting directory.
def ExtractLGP(file, dir=None): if dir is None: p, f = GetFile(file) dir = var.BOOTLEG_TEMP + f subprocess.Popen([var.ULGP_LOCATION, "-x", file, "-C", dir]) return dir
[ "def RepackLGP(dir, file=None):\n\n if file is None:\n p, f = GetFile(dir)\n if f.endswith((\"/\", \"\\\\\")):\n f = f[:-1]\n file = var.BOOTLEG_TEMP + f + \".lgp\"\n subprocess.Popen([var.ULGP_LOCATION, \"-c\", file, \"-C\", dir])\n return file", "def extract_from_dir(dir...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
RepackLGP(dir, file=None) Packs the contents of a folder into a LGP archive. Returns the resulting file.
def RepackLGP(dir, file=None): if file is None: p, f = GetFile(dir) if f.endswith(("/", "\\")): f = f[:-1] file = var.BOOTLEG_TEMP + f + ".lgp" subprocess.Popen([var.ULGP_LOCATION, "-c", file, "-C", dir]) return file
[ "def ExtractLGP(file, dir=None):\n\n if dir is None:\n p, f = GetFile(file)\n dir = var.BOOTLEG_TEMP + f\n subprocess.Popen([var.ULGP_LOCATION, \"-x\", file, \"-C\", dir])\n return dir", "def recursive_unpack(dir_path):\n exten = ['7z', 'zip', 'rar']\n one_more = False\n for r, d, ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
LaunchFile(file, params) Runs a raw executable file. The parameters are to feed to the process. Can be multiple parameters. Returns the process' return code.
def LaunchFile(*params): file = subprocess.Popen(params) file.communicate() return file.returncode
[ "def ExecuteFile(*args): # the docstring lies about parameters\n\n folder, file = FindFile(args[0])\n params = args[1:]\n\n log.logger(\"PARS_EXEC_FILE\", format=[file, folder[:-1], params], display=False)\n process = subprocess.Popen([folder + file] + list(params))\n process.communicate()\n retur...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
CopyFolder(src, dst, overwrite=True) Copies the content of 'src' into 'dst'. The destination may or may not exist. The 'overwrite' parameter will tell the function whether to overwrite files. This supports nested folders. Always returns 0.
def CopyFolder(src, dst, overwrite=True): if not src.endswith(("/", "\\")): src = src + "\\" if not dst.endswith(("/", "\\")): dst = dst + "\\" os.makedirs(dst, exist_ok=True) for file in os.listdir(src): if not overwrite and os.path.isfile(dst + file): continue ...
[ "def updateFolderContents(src, dst):\n return copy_tree(src, dst, update=True, verbose=True, dry_run=False)", "def mergeFolder(src, dst, pattern=None):\r\n # dstdir must exist first\r\n srcnames = os.listdir(src)\r\n for name in srcnames:\r\n srcfname = os.path.join(src, name)\r\n dstfna...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
CopyFile(path, file, new) Creates of copy of 'file' with name 'new' in 'path'. Always returns 0.
def CopyFile(path, file, new): if not path.endswith(("/", "\\")): path = path + "\\" shutil.copy(path + file, path + new) return 0
[ "def file_copy(file_path_source, file_path_destination):\n copyfile(file_path_source, file_path_destination)", "def copy_file(src, dst):\n return shutil.copy2(src, dst)", "def _copy_file ( self, source, dest ):\n return", "def copy_file(infile, newdir):\n cl = CommandLine('cp %s %s'%(infile, new...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
DeleteFile(path) Deletes all files and folders given. Always returns 0.
def DeleteFile(*path): for line in path: if os.path.isdir(line): shutil.rmtree(line) if os.path.isfile(line): os.remove(line) return 0
[ "def delete_file(path):\n return files.delete_file(path)", "def delete_file(path):\n\n os.remove(path)", "def delete_file(file_path):\n pass", "def delete_file(self, path):\n return self.client._perform_empty(\n \"DELETE\", \"/projects/%s/managedfolders/%s/contents/%s\" % (self....
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
RenameFile(path, org, new) Renames item x of 'org' to item x of 'new' in path. Returns 0 if all items could be renamed. Returns more than 0 if there were more items in 'org' than 'new' Returns less than 0 if there were more items in 'new' than 'org'
def RenameFile(path, org, new): cont = zip(org, new) if not path.endswith(("/", "\\")): path = path + "\\" for file in cont: if os.path.isfile(path + file[0]): os.rename(path + file[0], path + file[1]) return len(org) - len(new)
[ "def do_rename(self):\n n_renames = 0\n for i, pair in enumerate(self.rename_pairs):\n seq = i + 1\n filename, new_filename = pair\n if not os.path.isfile(filename):\n print(seq, 'File [%s] does not exist.')\n continue\n if os.path.isfile(new_filename):\n print(seq, 'F...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
AttribFile(file, attr="R S H I", params) Sets Windows file and folders attributes. Default attribute change is to remove all unwanted attributes. Parameters are optional, it's mainly to touch folders as well. Returns 0 if it completed successfully.
def AttribFile(file, attr="-R -S -H -I", *params): params = " ".join(params).split() # handle tuples and multispaced items if isinstance(attr, (tuple, list, set)): attr = " ".join(attr) lines = attr.split() + [file] + params attrib = subprocess.Popen(["C:\\Windows\\System32\\attrib.exe"] + line...
[ "def addAttributes(attrFile, models=None, log=False, raiseAttrDialog=True):\n\n\tfrom OpenSave import osOpen\n\ttry:\n\t\tif isinstance(attrFile, basestring):\n\t\t\tattrFile = osOpen(attrFile)\n\t\t\ttry:\n\t\t\t\treturn _addAttr(attrFile, models, log,\n\t\t\t\t\t\t\t\traiseAttrDialog)\n\t\t\tfinally:\n\t\t\t\tatt...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
StripAttribute(path) Removes all unwanted attributes from files in path.
def StripAttributes(path): if not path.endswith(("/", "\\")): path += "\\" folders = [path] allf = [] while folders: folder = folders.pop(0) allf.append(folder) for lister in os.listdir(folder): if os.path.isdir(folder + lister): folders.appen...
[ "def remove_immutable_attribute(path):\n # Some files have ACLs, let's remove them recursively\n if ((platform.system() == PLATFORM_DARWIN)\n and os.path.isfile('/usr/bin/chflags')):\n subprocess.call(['/usr/bin/chflags', '-R', 'nouchg', path])\n elif (platform.system() == PLATFORM_LINUX\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
StripFolder(path) Brings all files within all subfolders to the root ('path'). Deletes all subfolders of the main path. Returns a tuple of all the subfolders that were copied over.
def StripFolder(path): if not path.endswith(("/", "\\")): path = path + "\\" folders = [path] allf = [] while folders: folder = folders.pop(0) allf.append(folder) for lister in os.listdir(folder): if os.path.isdir(folder + lister): folders.app...
[ "def ExtractFolder(path):\n\n if not path.endswith((\"/\", \"\\\\\")):\n path = path + \"\\\\\"\n folders = []\n files = []\n for file in os.listdir(path):\n files.append(path + file)\n _file, ext = GetName(file)\n folder = ExtractFile(path + file)\n CopyFolder(folder,...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
CallSkipMod(mod) Prints a missing mod warning using 'mod' as the missing file. Always returns 0.
def CallSkipMod(mod): if len(var.MOD_LOCATION) == 1: iner = "ONE_IN" else: iner = "MULT_IN_ONE" file = getattr(fl, mod) if "{0}" in file: file = file.format(1) # make sure it does say *something* log.logger("PARS_SKIP", format=[mod, file, iner, "', '".join(var.MOD_LOCATION)]...
[ "def test_importorskip_module_level(pytester: Pytester) -> None:\n pytester.makepyfile(\n \"\"\"\n import pytest\n foobarbaz = pytest.importorskip(\"foobarbaz\")\n\n def test_foo():\n pass\n \"\"\"\n )\n result = pytester.runpytest()\n result.stdout.fnmatch_line...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
ARN of an App Runner automatic scaling configuration resource that you want to associate with your service. If not provided, App Runner associates the latest revision of a default auto scaling configuration.
def auto_scaling_configuration_arn(self) -> Optional[pulumi.Input[str]]: return pulumi.get(self, "auto_scaling_configuration_arn")
[ "def auto_scaling_configuration_arn(self) -> Optional[str]:\n return pulumi.get(self, \"auto_scaling_configuration_arn\")", "def autoscaling(self) -> Optional[pulumi.Input['NodePoolAutoscalingArgs']]:\n return pulumi.get(self, \"autoscaling\")", "def app_image_config_arn(self) -> Optional[str]:\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Settings of the health check that AWS App Runner performs to monitor the health of your service. See Health Check Configuration below for more details.
def health_check_configuration(self) -> Optional[pulumi.Input['ServiceHealthCheckConfigurationArgs']]: return pulumi.get(self, "health_check_configuration")
[ "def health_check_configuration(self) -> pulumi.Output['outputs.ServiceHealthCheckConfiguration']:\n return pulumi.get(self, \"health_check_configuration\")", "def test_v1_check_health(self):\n pass", "def health_check():\n app.logger.info(\"Health Check!\")\n return Response(\"All Good!\", ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
The runtime configuration of instances (scaling units) of the App Runner service. See Instance Configuration below for more details.
def instance_configuration(self) -> Optional[pulumi.Input['ServiceInstanceConfigurationArgs']]: return pulumi.get(self, "instance_configuration")
[ "def get_runtime_info(self):\n if 'runtime' not in self.kn_config or self.kn_config['runtime'] == 'default':\n self.kn_config['runtime'] = self._get_default_runtime_image_name()\n\n runtime_info = {\n 'runtime_name': self.kn_config['runtime'],\n 'runtime_cpu': self.kn_...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Configuration settings related to network traffic of the web application that the App Runner service runs. See Network Configuration below for more details.
def network_configuration(self) -> Optional[pulumi.Input['ServiceNetworkConfigurationArgs']]: return pulumi.get(self, "network_configuration")
[ "def network_configuration(self) -> pulumi.Input['EnvironmentNetworkConfigurationArgs']:\n return pulumi.get(self, \"network_configuration\")", "def network_configuration(self) -> Optional[pulumi.Input['EnvironmentNetworkConfigurationArgs']]:\n return pulumi.get(self, \"network_configuration\")", ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
The observability configuration of your service. See Observability Configuration below for more details.
def observability_configuration(self) -> Optional[pulumi.Input['ServiceObservabilityConfigurationArgs']]: return pulumi.get(self, "observability_configuration")
[ "def fleetobservability(self) -> Optional['outputs.FeatureSpecFleetobservability']:\n return pulumi.get(self, \"fleetobservability\")", "def global_service_config():\n service_config = ServiceConfig()\n service_config.services = {\n GithubService(token=\"token\"),\n GitlabService(token=...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
The observability configuration of your service. See Observability Configuration below for more details.
def observability_configuration(self) -> Optional[pulumi.Input['ServiceObservabilityConfigurationArgs']]: return pulumi.get(self, "observability_configuration")
[ "def fleetobservability(self) -> Optional['outputs.FeatureSpecFleetobservability']:\n return pulumi.get(self, \"fleetobservability\")", "def global_service_config():\n service_config = ServiceConfig()\n service_config.services = {\n GithubService(token=\"token\"),\n GitlabService(token=...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Get an existing Service resource's state with the given name, id, and optional extra properties used to qualify the lookup.
def get(resource_name: str, id: pulumi.Input[str], opts: Optional[pulumi.ResourceOptions] = None, arn: Optional[pulumi.Input[str]] = None, auto_scaling_configuration_arn: Optional[pulumi.Input[str]] = None, encryption_configuration: Optional[pulumi.Input[pulum...
[ "def get(resource_name: str,\n id: pulumi.Input[str],\n opts: Optional[pulumi.ResourceOptions] = None,\n access_policy_object_ids: Optional[pulumi.Input[Sequence[pulumi.Input[str]]]] = None,\n authentication_configuration: Optional[pulumi.Input[pulumi.InputType['ServiceAu...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Settings of the health check that AWS App Runner performs to monitor the health of your service. See Health Check Configuration below for more details.
def health_check_configuration(self) -> pulumi.Output['outputs.ServiceHealthCheckConfiguration']: return pulumi.get(self, "health_check_configuration")
[ "def health_check_configuration(self) -> Optional[pulumi.Input['ServiceHealthCheckConfigurationArgs']]:\n return pulumi.get(self, \"health_check_configuration\")", "def test_v1_check_health(self):\n pass", "def health_check():\n app.logger.info(\"Health Check!\")\n return Response(\"All Good...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Subdomain URL that App Runner generated for this service. You can use this URL to access your service web application.
def service_url(self) -> pulumi.Output[str]: return pulumi.get(self, "service_url")
[ "def base_url(self):\n return \"http://{0}:{1}/app\".format(self.host, self.port)", "def service_url(self):\n ...", "def webserver_url(self) -> pulumi.Output[str]:\n return pulumi.get(self, \"webserver_url\")", "def full_url(self):\n return self._url + self._api_suffix", "def sub...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Given a model name, returns a pytorch transformers model in eval mode.
def load_torchtransformers(model_name): # There are two versions of huggingface, support both try: import pytorch_transformers except ModuleNotFoundError: import transformers as pytorch_transformers if model_name == "bert": tokenizer = pytorch_transformers.BertTokenizer.from_pr...
[ "def load_simple_transformer(model_name):\n model = torch.nn.Transformer(nhead=2, num_encoder_layers=1, num_decoder_layers=1)\n model = model.eval()\n src = torch.rand((10, 32, 512))\n tgt = torch.rand((20, 32, 512))\n return model, [src, tgt]", "def get_model(model: str) -> Any:\n try:\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Load DeepSpeech LSTM model from GitHub repo. Unfortunately TVM does not currently support LSTM operators in the PyTorch frontend. This is also the case for most other frontends.
def load_deepspeech(model_name): # For reference: # from deepspeech_pytorch.model import DeepSpeech # from torch.utils.model_zoo import load_url # import torch.onnx # pretrained_url = 'https://github.com/SeanNaren/deepspeech.pytorch/releases/download/v2.0/an4_pretrained_v2.pth' # params = load...
[ "def train_lstm_model():\n\ttexts, _ = data.data_util.load_text_with_specific_label(\n\t\tDEFAULT_FILE_NAME,\n\t\tdata.data_util.FbReaction.LIKE_INDEX\n\t)\n\tsequences, num_words, index_to_word, word_to_index = text_tokenizer.get_text_items(texts)\n\tpredictors, labels, max_sequence_len = generate_padded_sequences...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
A simple transformer from pytorch.
def load_simple_transformer(model_name): model = torch.nn.Transformer(nhead=2, num_encoder_layers=1, num_decoder_layers=1) model = model.eval() src = torch.rand((10, 32, 512)) tgt = torch.rand((20, 32, 512)) return model, [src, tgt]
[ "def transformer() -> nn.Module:\n return Transformer()", "def load_transformer(weights_prefix):\n\n # PyTorch transformer model\n transformer = torch.nn.Transformer(\n d_model=embed_dim,\n nhead=num_heads,\n num_encoder_layers=num_encoder_layers,\n num_decoder_layers=num_deco...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Get a PyTorch model by type and name. Returns PyTorch trace and input shape dict.
def get_model(model_name, type): MODEL_MAP = {"torchvision": (["*"], load_torchvision), "torchtransformers": (["bert", "transformer_xl"], load_torchtransformers), "github": (["deepspeech"], load_deepspeech), "custom": (["simple_transfor...
[ "def get_pt_model(model_name):\n import torch\n import torchvision\n\n print('Pull the model from Torch Vision...')\n shape = (1, 3, 224, 224)\n if model_name.find('inception') != -1:\n shape = (1, 3, 299, 299)\n\n model = getattr(torchvision.models, model_name)(pretrained=True)\n loggin...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Function for fetching and manipulating picons
def piconget(pid, mnpicon, picndir, piconslug, hxclr1, hxclr2, mangle=None, colrful=False, brite=False): if direxists(picndir): urlbase = "http://images.pluto.tv/channels/" if mnpicon: urlend = 'solidLogoPNG.png' else: urlend = 'colorLogoPNG.png' ...
[ "def _icons(self):", "def icon():\n icons = set()\n for db in (path.db.star, path.db.nm, path.db.hd, path.db.mx, path.db.ex, path.db.club, path.db.mission):\n for record in ls(db):\n with open(db + record, \"rb\") as f:\n data = json.loads(f.read().decode())\n ico...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
A generic base class for electrical units. The class contains attributes to store the magnitude of the key and also contain the respective frequency associated with the electrical characteristic. Where series of frequency values are required it is expected that these will be achieved by using a list containing objects ...
def __init__(self, frequency: int = None, freq_unit: str = None, **kwargs): self._freq: int = freq self._freq_unit: str = freq_unit
[ "def __getitem__(self, key):\n # Read the data\n data = self.obj[key]\n\n # Return a unyt.Quantity with suitable units\n result = unyt.array.unyt_array(data, self.get_unit(), registry=self.reg)\n\n # Attach a and h info\n result.a_exponent = self.a_exponent\n result....
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
There are two modes. 1. Add a int/float to an Volt() object. Return a new Volt() object with '.volts' that is the sum of the 'self.volts' and the passed int/float. 2. Adding two Volt() objects together, returning a new Volt() object with '.volts' that is the sum of 'self.volts' and 'other.volts'.
def __add__(self, other): if isinstance(other, int) or isinstance(other, float): return Volt(self.volts + other, self.volt_unit, self.freq, self.freq_unit) if self.volt_unit != other.volt_unit: raise ArithmeticError(f"The objects' volt units {self.volt_unit} and {other.volt_unit}...
[ "def __add__(self, other):\n if isinstance(other, int) or isinstance(other, float):\n return Amp(self.amps + other, self.amp_unit, self.freq, self.freq_unit)\n if self.amp_unit != other.amp_unit:\n raise ArithmeticError(f\"The objects' amp units {self.amp_unit} and {other.amp_uni...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
1. Subtract a insulation_code from an Volt() object. Return a new Volt() object with '.volts' that is the difference of the 'self.volts'and the passed int/float. 2. Subtract two Volt() objects, returning a new Volt() object with '.volts' that is the difference of 'self.volts' and 'other.volts'.
def __sub__(self, other): if isinstance(other, int) or isinstance(other, float): return Volt(self.volts - other, self.volt_unit, self.freq, self.freq_unit) if self.volt_unit != other.volt_unit: raise ArithmeticError(f"The objects' volt units {self.volt_unit} and {other.volt_unit}...
[ "def __sub__(self, other):\n if self.unit.name == 'dB' or other.unit.name == 'dB':\n # easy unitless adding\n value = self.value - other.value\n return self.__class__(value, self.unit.name, islog=True)\n elif self.unit.physicalunit is other.unit.physicalunit:\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Multiply a Volt() object. If multiplying by a int or float the self. Multiply two Volt() objects together, returning the product of the two objects.
def __mul__(self, other): if isinstance(other, int) or isinstance(other, float): return Volt(self.volts * other, self.volt_unit, self.freq, self.freq_unit) else: if self.volt_unit != other.volt_unit: raise ArithmeticError(f"The objects' volt units {self.volt_unit}...
[ "def __mul__(self, other):\n if type(other) == type(self):\n return self.dot_product(other)\n if type(other) == type(1) or type(other) == type(1.0):\n return self.scalar_vector_mult(other)", "def __mul__(self, other):\n self_currency = type(self)\n if isinstance(o...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
The volt attribute setter.
def volts(self, volt: NumType): self._volt = volt
[ "def setVoltage(self,voltage):\n pass", "def set_vol_mod(self, id, v):\n self.instances[id].vol_modifier = v\n self.instances[id].vol()", "def setvoltages(self):\n pass", "def set_volt(self,volt):\n self.spi_disable()\n self.spi_enable()\n data1=volt*256//self....
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
There are two modes. 1. Add an int/float to an Amps() object. Return a new Amp() object with '.amps' that is the sum of the 'self.amps' and the passed int/float. 2. Adding two Amp() objects together, returning a new Amp() object with '.amps' that is the sum of 'self.amps' and 'other.amps'.
def __add__(self, other): if isinstance(other, int) or isinstance(other, float): return Amp(self.amps + other, self.amp_unit, self.freq, self.freq_unit) if self.amp_unit != other.amp_unit: raise ArithmeticError(f"The objects' amp units {self.amp_unit} and {other.amp_unit} are not...
[ "def __mul__(self, other):\n if isinstance(other, int) or isinstance(other, float):\n return Amp(self.amps * other, self.amp_unit, self.freq, self.freq_unit)\n if self.amp_unit != other.amp_unit:\n raise ArithmeticError(f\"The objects' amp units {self.amp_unit} and {other.amp_uni...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
1. Subtract a int/float from an Amp() object. Return a new Amp() object with '.amps' that is the difference of the 'self.amps' and the passed int/float. 2. Subtract two Amp() objects, returning a new Amp() object with '.amps' that is the difference of 'self.amps' and 'other.amps'.
def __sub__(self, other): if isinstance(other, int) or isinstance(other, float): return Amp(self.amps - other, self.amp_unit, self.freq, self.freq_unit) if self.amp_unit != other.amp_unit: raise ArithmeticError(f"The objects' amp units {self.amp_unit} and {other.amp_unit} are not...
[ "def __sub__(self, other):\n if isinstance(other, int) or isinstance(other, float):\n return Volt(self.volts - other, self.volt_unit, self.freq, self.freq_unit)\n if self.volt_unit != other.volt_unit:\n raise ArithmeticError(f\"The objects' volt units {self.volt_unit} and {other....
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Multiply two Amp() objects together, returning the product of the two objects.
def __mul__(self, other): if isinstance(other, int) or isinstance(other, float): return Amp(self.amps * other, self.amp_unit, self.freq, self.freq_unit) if self.amp_unit != other.amp_unit: raise ArithmeticError(f"The objects' amp units {self.amp_unit} and {other.amp_unit} are not...
[ "def mul(self, a, b):\n return a * b", "def __mul__(self, other):\n if type(other) == type(self):\n return self.dot_product(other)\n if type(other) == type(1) or type(other) == type(1.0):\n return self.scalar_vector_mult(other)", "def __mul__(self, other):\n if ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
There are two modes. 1. Add a complex to an Ohms() object. Return a new Ohm() object with '.ohm' that is the sum of the 'self.ohm' and the passed complex(). 2. Adding two Ohm() objects together, returning a new Ohm() object with '.ohm' that is the sum of 'self.ohm' and 'other.ohm'.
def __add__(self, other): if isinstance(other, complex): return Ohm(self.ohm + other, self.ohm_unit, self.freq, self.freq_unit) if self.ohm_unit != other.ohm_unit: raise ArithmeticError(f"The objects' ohm units {self.ohm_unit} and {other.ohm_unit} are not the same.") if s...
[ "def __add__(self, other):\n if isinstance(other, complex):\n return Power(self.power + other, self.power_unit, self.freq, self.freq_unit)\n if self.power_unit != other.power_unit:\n raise ArithmeticError(f\"The objects' ohm units {self.power_unit} and {other.power_unit} are not ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
There are two modes. 1. Subtract a complex to an Ohms() object. Return a new Ohm() object with '.ohm' that is the sum of the 'self.ohm' and the passed complex(). 2. Subtract two Ohm() objects, returning a new Ohm() object with '.ohm' that is the difference of 'self.ohm' and 'other.ohm'. a) The frequencies (including th...
def __sub__(self, other): if isinstance(other, complex): return Ohm(self.ohm - other, self.ohm_unit, self.freq, self.freq_unit) if self.ohm_unit != other.ohm_unit: raise ArithmeticError(f"The objects' ohm units {self.ohm_unit} and {other.ohm_unit} are not the same.") if s...
[ "def __add__(self, other):\n if isinstance(other, complex):\n return Ohm(self.ohm + other, self.ohm_unit, self.freq, self.freq_unit)\n if self.ohm_unit != other.ohm_unit:\n raise ArithmeticError(f\"The objects' ohm units {self.ohm_unit} and {other.ohm_unit} are not the same.\")\n...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Multiply two Ohm() objects together, returning the product of the two objects.
def __mul__(self, other): if isinstance(other, int) or isinstance(other, float) or isinstance(other, complex): return Ohm(self.ohm * other, self.ohm_unit, self.freq, self.freq_unit) if self.ohm_unit != other.ohm_unit: raise ArithmeticError(f"The objects' ohm units {self.ohm_unit}...
[ "def __mul__(self, other):\n retval = FloatDict()\n if isinstance(other, dict):\n for k in list(self.keys()):\n if k in list(other.keys()):\n retval[k] = self[k] * other[k]\n else:\n retval[k] = 0.0\n for k in li...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Return ohm as a resistance. This will not change the insulation_code of self._ohms.
def r(self) -> float: return self._ohms.real
[ "def calculate_rh(self):\n # Check for existence of relative humidity and mixing ratio\n if self.data.get('Relative_Humidity') is None:\n if self.data.get('Mixing_Ratio') is None:\n raise KeyError('Calculate mixing ratio first!')\n else:\n # Convert ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
There are two modes. 1. Add a complex to a Power() object. Return a new Power() object with '.power' that is the sum of the 'self.Power' and the passed complex(). 2. Adding two Power() objects together, returning a new Power() object with '.power' that is the sum of 'self.power' and 'other.ohm'.
def __add__(self, other): if isinstance(other, complex): return Power(self.power + other, self.power_unit, self.freq, self.freq_unit) if self.power_unit != other.power_unit: raise ArithmeticError(f"The objects' ohm units {self.power_unit} and {other.power_unit} are not the same."...
[ "def __add__(self, other):\n if isinstance(other, complex):\n return Ohm(self.ohm + other, self.ohm_unit, self.freq, self.freq_unit)\n if self.ohm_unit != other.ohm_unit:\n raise ArithmeticError(f\"The objects' ohm units {self.ohm_unit} and {other.ohm_unit} are not the same.\")\n...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
There are two modes. 1. Subtract a complex to an Power() object. Return a new Power() object with '.power' that is the sum of the 'self.power' and the passed complex(). 2. Subtract two Power() objects, returning a new Power() object with '.ohm' that is the difference of 'self.power' and 'other.power'. a) The frequencie...
def __sub__(self, other): if isinstance(other, complex): return Power(self.power - other, self.power_unit, self.freq, self.freq_unit) if self.power_unit != other.power_unit: raise ArithmeticError(f"The objects' ohm units {self.power_unit} and {other.power_unit} are not the same."...
[ "def __sub__(self, other):\n if isinstance(other, complex):\n return Ohm(self.ohm - other, self.ohm_unit, self.freq, self.freq_unit)\n if self.ohm_unit != other.ohm_unit:\n raise ArithmeticError(f\"The objects' ohm units {self.ohm_unit} and {other.ohm_unit} are not the same.\")\n...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Multiply two Power() objects together, returning the product of the two objects.
def __mul__(self, other): if isinstance(other, int) or isinstance(other, float) or isinstance(other, complex): return Power(self.power * other, self.power_unit, self.freq, self.freq_unit) if self.power_unit != other.power_unit: raise ArithmeticError(f"The objects' power units {se...
[ "def mul(self, a, b):\n return a * b", "def __mul__(self, other):\r\n if isinstance(other, Fraction):\r\n if other == 1:\r\n return self\r\n if other == 0:\r\n return PowerSeries()\r\n if other in self.__Ms:\r\n return sel...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Compare the frequency attributes of the two objects and ensure that they are equal to allow the calculation to take place. Set the 'self._freq_equal' to True if the same.
def compare_freq(self): if self._obj1.frequency != self._obj2.frequency: raise ArithmeticError(f"The objects' frequency {self._obj1.frequency} and {self._obj2.frequency} are not the same.") if self._obj1.freq_unit != self._obj1.freq_unit: raise ArithmeticError(f"The objects' freq...
[ "def __eq__(self, other):\n if super(FrequencySeries, self).__eq__(other):\n return (self._epoch == other.epoch\n and self.basic_df == other.basic_df)\n else:\n return False", "def __gt__(self, other):\n if not isinstance(other, HuffNode):\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Calculate voltage using the two passed objects. Based on the two objects the method will determine the correct equation to use. The method will return None if the objects cannot be used for the called method.
def calc_voltage(self) -> (Volt, None): power: ComType = complex(0) power_unit: str = '' amp: NumType = 0 amp_unit: str = '' ohm: ComType = complex(0) ohm_unit: str = '' if self._amp_exists and self._ohm_exists: if hasattr(self._obj1, 'amps'): ...
[ "def getVoltageResistance(self):\n return self.getTheveninEquiv()", "def vd(v2,v1):\n return v2-v1", "def voltage(self, A, B, M, N, current=1):\n MAx = M[0]-A[0]\n MAy = M[1]-A[1]\n NAx = N[0]-A[0]\n NAy = N[1]-A[1]\n\n MBx = M[0]-B[0]\n MBy = M[1]-B[1]\n N...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Calculate impedance using the two passed objects. Based on the two objects the method will determine the correct equation to use. The method will return None if the objects cannot be used for the called method.
def calc_impedance(self) -> (Ohm, None): power: ComType = complex(0) power_unit: str = '' amp: NumType = 0 amp_unit: str = '' volt: NumType = 0 volt_unit: str = '' if self._volt_exists and self._volt_exists: if hasattr(self._obj1, 'volts'): ...
[ "def calc(operand_1, operand_2):\n return operand_1/operand_2", "def getImpedance(self, *args):\n return _yarp.IImpedanceControl_getImpedance(self, *args)", "def calc(operand_1, operand_2):\n return operand_1 / operand_2", "def rhs(x, y):\n\n # NOTE : y is an array of length 1\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
function to check if the current value is in a future time
def val_future_time(value): today = timezone.now() if value < today: raise ValidationError('Datetime should be a future Date and time')
[ "def is_future(value):\n if not isinstance(value, datetime.datetime):\n raise RuntimeError(\"Invalid type, datetime required\")\n\n if value.tzinfo is None:\n value = value.replace(tzinfo=pytz.utc)\n now = datetime.datetime.utcnow().replace(tzinfo=pytz.utc)\n\n return value > now", "def ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
''' In words ending with 'y', this function replaces 'y' by 'i'. step1c turns terminal y to i when there is another vowel in the stem.""" '''
def step1c(self, word): if word.endswith('y'): result = word.rfind('y') base = word[:result] if self.containsVowel(base): word = base word += 'i' return word
[ "def step1c(self):\n if (self.ends(\"y\") and self.vowelinstem()):\n self.b = self.b[:self.k] + 'i' + self.b[self.k+1:]", "def step1c(self):\n\t\tif (self.ends(\"y\") and self.vowelinstem()):\n\t\t\tself.b = self.b[:self.k] + 'i' + self.b[self.k+1:]", "def step2(self):\n\t\tif self.b[self.k - 1] =...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
equ_type correpsonds to the WavelengthSolutionFunctions coeffs correponds to the function but for a polynomial coeffs = c y = c[0]+c[1]x+c[2]x2+c[3]c3+.... extra extra info from the extraction process
def __init__ (self, equ_type='none' , extra='none'): self.equ_type = self.set_equation_type(equ_type) self.coeffs = [] self.extra = str(extra)
[ "def eval_polynomial(x, coeffs):\n pass", "def coeffs(self):\r\n return self.onefun.coeffs", "def nth_order_const_coeff(*coeffs: List[Symbol], t: Symbol = t) -> Tuple[List[Symbol], Procedure]:\n\n # First, set up characteristic equation.\n char_eq_r, r = sympy.S.Zero, Dummy('r')\n\n for order...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
This uses the header and tries out all possible functions for getting the wavelength solution coefficients returns a dictionary with keywords in ['linear','ctype','crvl','wcs','w0','co_0','wv_0','spectre']
def wlsoln_coeff_from_header (pyfits_header, apply_WCS_rv=False, preferred=None, output='sel'): # coefficient choices cc = {} #========================================================================# # linear dispersion cc['linear'] = coeff_basic_linear(pyfits_header) #========================...
[ "def get_data_structure(infits):\n data_options, data_keywords, \\\n header_kws, header_exts = interface_defaults()\n\n hdr_keys0 = list(infits[0].header.keys())\n exts = len(infits)\n\n # Wavelength:\n # CRVAL is always present if x_option == 1 is to be generated:\n crval_matches = [key fo...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Returns the parent of self. If self is root ('/'), parent returns None. You much check the output of parent before using the value. Notcie that parent of root in the shell is '/', so this is a semantic difference between FarmFS and POSIX.
def parent(self): if self._path == sep: return None elif self._parent is None: self._parent = Path(first(split(self._path))) return self._parent else: return self._parent
[ "def parent(self):\n return self if self.is_root else self.__parent", "def get_parent(self):\n if self.parent:\n return self.parent()\n else:\n return None", "def parent(self):\n if self._parent is not None:\n return self._parent()\n else:\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Creates a hard link to dst. dst DNE Dir F SLF SLD SLB s DNR R R N N R R e Dir R R R R R R l F R R R R ? ? f SL R R R R ? ? R means raises. N means new hardlink created.
def link(self, dst): assert isinstance(dst, Path) link(dst._path, self._path)
[ "def link(self, dst):\r\n raise NotImplementedError()", "def symlink(self, dst):\r\n raise NotImplementedError()", "def link(self, src, dst, label=None):\n self._tag(dst, label)\n self._mkdir_for(dst)\n abs_src = self._rootjoin(src)\n abs_dst = os.path.join(self.chroot, dst)\n try:\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Reads src_fd and puts the contents into a file located at self._path.
def copy_fd(self, src_fd, tmpdir=None): if tmpdir is None: tmpfn = sameDir else: tmpfn = lambda _: tmpdir._path mode = 'w' if 'b' in src_fd.mode: mode += 'b' with safeopen(self._path, mode, useDir=tmpfn) as dst_fd: copyfileobj(src_f...
[ "def send_file(self, src: PathLike, dest: PathLike, force: bool = False):", "def load_file(self):\n with open(self.src_f, 'r') as src:\n self.src_txt = src.readlines()", "def copyfileobj(self, fsrc, fdst, length=(16*1024)):\n fsrcRead = fsrc.read\n fdstWrite = fdst.write\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Copy self to path dst. Does not attempt to ensure dst is a valid destination. Raises IsADirectoryError and FileDoesNotExist on namespace errors. The file will either be fully copied, or will not be created. This is achieved via temp files and atomic swap. This API works for large files, as data is read in chunks and se...
def copy_file(self, dst, tmpdir=None): if tmpdir is None: tmpfn = sameDir else: tmpfn = lambda _: tmpdir._path assert isinstance(dst, Path) with open(self._path, 'rb') as src_fd: with safeopen(dst._path, 'wb', useDir=tmpfn) as dst_fd: c...
[ "def copy(self, dst, copystat=False):\n dst = self.__class__(dst)\n if dst.exists() and dst.stat().isdir:\n dst += self[-1]\n shutil.copyfile(unicode(self), unicode(dst))\n if copystat:\n shutil.copystat(unicode(self), unicode(dst))\n else:\n shuti...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Building paths using conventional POSIX systems will discard CWD if the path is absolute. FarmFS makes passing of CWD explicit so that path APIs are pure functions. Additionally FarmFS path construction doesn't allow for absolute paths to be mixed with frames. This is useful for spotting bugs and making sure that pathi...
def userPath2Path(arg, frame): arg = ingest(arg) if isabs(arg): return Path(arg) else: return Path(arg, frame)
[ "def convert_path(pathname):\n if os.sep == '/':\n return pathname\n if not pathname:\n return pathname\n if pathname[0] == '/':\n raise ValueError(\"path '%s' cannot be absolute\" % pathname)\n if pathname[-1] == '/':\n raise ValueError(\"path '%s' cannot end with '/'\" % pa...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Returns list of objects nonselected in the view.
def get_non_selected(self): obj_list = self.get_list() for sel in self.get_selected(): obj_list.remove(sel) return obj_list
[ "def non_hidden(self):\n return self.filter(hidden=False)", "def get_inititially_selected_queryset(self):\n return self.model.objects.none()", "def no_verificadas(self):\n\n return self.exclude(id__in=self.verificadas())", "def no_recibidas(self):\n\n return self.exclude(id__in=sel...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
This is a special string; when received it will make all Menu > Objects entries unchecked It mean we clicked outside of the items and deselected all
def on_row_selected(self, obj_name): if obj_name == 'none': for act in self.app.ui.menuobjects.actions(): act.setChecked(False) return # get the name of the selected objects and add them to a list name_list = [] for obj in self.get_selected(): ...
[ "def buttonWeaponNone_Clicked(self, event):\n for i in range(self.checkListWeapons.GetCount()):\n self.checkListWeapons.Check(i, False)\n self.SelectedClass.weapon_set = []", "def uncheckBoxes(self):\n for row in range(len(self.pvs)):\n item=self.ui.t...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Run miraligner tool (from seqcluster suit) with default parameters.
def _miraligner(fastq_file, out_file, species, db_folder, config): resources = config_utils.get_resources("miraligner", config) miraligner = config_utils.get_program("miraligner", config) jvm_opts = "-Xms750m -Xmx4g" if resources and resources.get("jvm_opts"): jvm_opts = " ".join(resources.get(...
[ "def align(args) :\n from aligner import align_reads\n align_reads(args)", "def make_align(args, db):\n script_file = \"/{}/{}/Scripts/1_{}_align.sh\".format(\n db[\"out_dir\"], args.name, args.name\n )\n with open(script_file, \"w\") as fout:\n fout.write(\"#!/bin/bash\\n\")\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
use tDRmapper to quantify tRNAs
def _trna_annotation(data): trna_ref = op.join(dd.get_srna_trna_file(data)) name = dd.get_sample_name(data) work_dir = utils.safe_makedir(os.path.join(dd.get_work_dir(data), "trna", name)) in_file = op.basename(data["clean_fastq"]) tdrmapper = os.path.join(os.path.dirname(sys.executable), "TdrMappin...
[ "def make_tRNA_fasta_dict(tRNAdf):\n\n\n\ttRNA_fasta_outdict = OrderedDict()\n\n\tfor i in tRNAdf.index:\n\n\t\tif tRNAdf.loc[i,'feature'] == 'tRNA':\n\t\t\tchrom = tRNAdf.loc[i,'#chrom']\n\t\t\tchrStart = int(tRNAdf.loc[i,'chromStart'])\n\t\t\tchrEnd = int(tRNAdf.loc[i,'chromEnd'])\n\t\t\tstrand = tRNAdf.loc[i,'st...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Perform a bit_resize operation with resize from front flags.
def test_bit_resize_from_front(self): ops = [bitwise_operations.bit_resize(self.test_bin_ones, 10, resize_flags=aerospike.BIT_RESIZE_FROM_FRONT)] self.as_connection.operate(self.test_key, ops) _, _, bins = self.as_connection.get(self.test_key) # We should not have changed the zeroes bi...
[ "def test_bit_resize_update_only_allows_update(self):\n bit_policy = {\"bit_write_flags\": aerospike.BIT_WRITE_UPDATE_ONLY}\n ops = [bitwise_operations.bit_resize(self.test_bin_zeroes, 10, policy=bit_policy)]\n self.as_connection.operate(self.test_key, ops)\n\n _, _, bins = self.as_conne...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
By default we can create a new bin with resize.
def test_bit_resize_default_allows_create(self): ops = [bitwise_operations.bit_resize("new_bin_name", 10)] self.as_connection.operate(self.test_key, ops) _, _, bins = self.as_connection.get(self.test_key) assert bins["new_bin_name"] == bytearray([0] * 10)
[ "def test_bit_resize_create_only_allows_create(self):\n bit_policy = {\"bit_write_flags\": aerospike.BIT_WRITE_CREATE_ONLY}\n ops = [bitwise_operations.bit_resize(\"new_bin_name\", 10, policy=bit_policy)]\n self.as_connection.operate(self.test_key, ops)\n\n _, _, bins = self.as_connectio...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Create a bin with resize using the create only flag.
def test_bit_resize_create_only_allows_create(self): bit_policy = {"bit_write_flags": aerospike.BIT_WRITE_CREATE_ONLY} ops = [bitwise_operations.bit_resize("new_bin_name", 10, policy=bit_policy)] self.as_connection.operate(self.test_key, ops) _, _, bins = self.as_connection.get(self.tes...
[ "def test_bit_resize_create_only_prevents_update(self):\n bit_policy = {\"bit_write_flags\": aerospike.BIT_WRITE_CREATE_ONLY}\n ops = [bitwise_operations.bit_resize(self.test_bin_zeroes, 10, policy=bit_policy)]\n with pytest.raises(e.BinExistsError):\n self.as_connection.operate(self...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Update a bin with resize using the update only flag.
def test_bit_resize_update_only_allows_update(self): bit_policy = {"bit_write_flags": aerospike.BIT_WRITE_UPDATE_ONLY} ops = [bitwise_operations.bit_resize(self.test_bin_zeroes, 10, policy=bit_policy)] self.as_connection.operate(self.test_key, ops) _, _, bins = self.as_connection.get(se...
[ "def test_bit_resize_update_only_prevents_create(self):\n bit_policy = {\"bit_write_flags\": aerospike.BIT_WRITE_UPDATE_ONLY}\n ops = [bitwise_operations.bit_resize(\"new_binname\", 10, policy=bit_policy)]\n with pytest.raises(e.BinNotFound):\n self.as_connection.operate(self.test_ke...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Attempt to update a bin using the create only flag, should fail.
def test_bit_resize_create_only_prevents_update(self): bit_policy = {"bit_write_flags": aerospike.BIT_WRITE_CREATE_ONLY} ops = [bitwise_operations.bit_resize(self.test_bin_zeroes, 10, policy=bit_policy)] with pytest.raises(e.BinExistsError): self.as_connection.operate(self.test_key, ...
[ "def test_bit_resize_update_only_prevents_create(self):\n bit_policy = {\"bit_write_flags\": aerospike.BIT_WRITE_UPDATE_ONLY}\n ops = [bitwise_operations.bit_resize(\"new_binname\", 10, policy=bit_policy)]\n with pytest.raises(e.BinNotFound):\n self.as_connection.operate(self.test_ke...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Attempt to create a bin with the update only flag.
def test_bit_resize_update_only_prevents_create(self): bit_policy = {"bit_write_flags": aerospike.BIT_WRITE_UPDATE_ONLY} ops = [bitwise_operations.bit_resize("new_binname", 10, policy=bit_policy)] with pytest.raises(e.BinNotFound): self.as_connection.operate(self.test_key, ops)
[ "def test_bit_resize_create_only_prevents_update(self):\n bit_policy = {\"bit_write_flags\": aerospike.BIT_WRITE_CREATE_ONLY}\n ops = [bitwise_operations.bit_resize(self.test_bin_zeroes, 10, policy=bit_policy)]\n with pytest.raises(e.BinExistsError):\n self.as_connection.operate(self...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Perform a bit_remove op with random offset and random byte_size.
def test_bit_remove_randnumbytes_randoffset(self): offset = random.randint(0, 4) num_bytes = random.randint(1, (5 - offset)) ops = [bitwise_operations.bit_remove(self.test_bin_zeroes, offset, num_bytes, None)] self.as_connection.operate(self.test_key, ops) _, _, bins = self.as_c...
[ "def test_bit_remove_byte_offset_with_byte_too_large(self):\n ops = [bitwise_operations.bit_remove(self.test_bin_zeroes, 3, 3, None)]\n\n with pytest.raises(e.InvalidRequest):\n self.as_connection.operate(self.test_key, ops)", "def test_bit_remove_byte_size_too_large(self):\n ops =...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Perform a bit_remove op with an offset outside the bit_map being modified.
def test_bit_remove_offset_out_of_range(self): ops = [bitwise_operations.bit_remove(self.test_bin_zeroes, 6, 1, None)] with pytest.raises(e.InvalidRequest): self.as_connection.operate(self.test_key, ops)
[ "def remove(self, key):\n idx = bit_count(self.bitmap & ((1 << key) - 1))\n return BitMapDispatch(\n # Unset the keyth bit.\n self.bitmap & ~(1 << key),\n # Leave out the idxth item.\n self.items[:idx] + self.items[idx+1:]\n )", "def remove_bit(self...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Perform a bit_remove op with byte_size larger than bit_map being modified.
def test_bit_remove_byte_size_too_large(self): ops = [bitwise_operations.bit_remove(self.test_bin_zeroes, 0, 6, None)] with pytest.raises(e.InvalidRequest): self.as_connection.operate(self.test_key, ops)
[ "def test_bit_remove_byte_offset_with_byte_too_large(self):\n ops = [bitwise_operations.bit_remove(self.test_bin_zeroes, 3, 3, None)]\n\n with pytest.raises(e.InvalidRequest):\n self.as_connection.operate(self.test_key, ops)", "def remove(self, key):\n idx = bit_count(self.bitmap &...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Perform a bit_remove op with an offset and byte_size that attempt to modify the bitmap outside of bounds.
def test_bit_remove_byte_offset_with_byte_too_large(self): ops = [bitwise_operations.bit_remove(self.test_bin_zeroes, 3, 3, None)] with pytest.raises(e.InvalidRequest): self.as_connection.operate(self.test_key, ops)
[ "def test_bit_remove_offset_out_of_range(self):\n ops = [bitwise_operations.bit_remove(self.test_bin_zeroes, 6, 1, None)]\n\n with pytest.raises(e.InvalidRequest):\n self.as_connection.operate(self.test_key, ops)", "def test_bit_remove_byte_size_too_large(self):\n ops = [bitwise_op...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Perform a bit_remove op with on a non existent bin.
def test_bit_remove_bad_bin_name(self): ops = [bitwise_operations.bit_remove("bad_name", 3, 3, None)] with pytest.raises(e.BinNotFound): self.as_connection.operate(self.test_key, ops)
[ "def remove_bit(self, index: int) -> None:\r\n\t\tself.bitfield &= ~self.to_bitfield(index)", "def test_bit_remove_byte_offset_with_byte_too_large(self):\n ops = [bitwise_operations.bit_remove(self.test_bin_zeroes, 3, 3, None)]\n\n with pytest.raises(e.InvalidRequest):\n self.as_connectio...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Perform a bit_remove op with an unsupported float type argument.
def test_bit_remove_bad_arg_type(self): ops = [bitwise_operations.bit_remove("bad_name", 3, 3.5, None)] with pytest.raises(e.ParamError): self.as_connection.operate(self.test_key, ops)
[ "def remove(extinction, flux, inplace=False):\n\n trans = 10.**(0.4 * extinction)\n\n if inplace:\n flux *= trans\n return flux\n else:\n return flux * trans", "def test_isub_with_float_argument(self):\n\n a = Vec3(2, 3, 4)\n b = 1.0\n\n a -= b\n\n expecte...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Perform a bit_set op with a random offset and random valued byte.
def test_bit_set_bit_random_byte_random_offset(self): value = bytearray() rand_byte = random.randint(0, 255) value.append(rand_byte) rand_offset = random.randint(0, 4) * 8 ops = [bitwise_operations.bit_set(self.test_bin_zeroes, rand_offset, 8, 1, value, None)] self.as_con...
[ "def test_bit_set_bit_multiple_bytes(self):\n value = bytearray()\n value = bytearray()\n rand_byte = random.randint(0, 255)\n num_bytes = random.randint(1, 5)\n for x in range(0, num_bytes):\n value.append(rand_byte)\n ops = [bitwise_operations.bit_set(self.test...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Perform a bit_set op with a random number of bytes.
def test_bit_set_bit_multiple_bytes(self): value = bytearray() value = bytearray() rand_byte = random.randint(0, 255) num_bytes = random.randint(1, 5) for x in range(0, num_bytes): value.append(rand_byte) ops = [bitwise_operations.bit_set(self.test_bin_zeroes,...
[ "def test_bit_set_bit_random_byte_random_offset(self):\n value = bytearray()\n rand_byte = random.randint(0, 255)\n value.append(rand_byte)\n rand_offset = random.randint(0, 4) * 8\n ops = [bitwise_operations.bit_set(self.test_bin_zeroes, rand_offset, 8, 1, value, None)]\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Perform a bit_set op with an bit size larger than the actual value.
def test_bit_set_bit_bit_size_too_large(self): value = bytearray() value.append(255) ops = [bitwise_operations.bit_set(self.test_bin_zeroes, 0, 16, 1, value, None)] with pytest.raises(e.InvalidRequest): self.as_connection.operate(self.test_key, ops)
[ "def bitSetValue(int_type, offset, value):\r\n if value > 0:\r\n return bitSet(int_type, offset)\r\n else:\r\n return bitClear(int_type, offset)", "def set_bit(src, bit, val):\n if isinstance(src, bytes):\n src = int.from_bytes(src, 'little')\n if val:\n return src | (1 << ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Perform a bit_set op with an unsupported float.
def test_bit_set_bit_invalid_arg_type(self): value = 85323.9 ops = [bitwise_operations.bit_set(self.test_bin_zeroes, 0, 8, 1, value, None)] with pytest.raises(e.ParamError): self.as_connection.operate(self.test_key, ops)
[ "def _setFloatFeature(self, valueToSet):\n\n errorCode = VimbaDLL.featureFloatSet(self._handle,\n self._name,\n valueToSet)\n if errorCode != 0:\n raise VimbaException(errorCode)", "def Set(self, p_flo...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Perform a bit_set op with a non existent bin.
def test_bit_set_bit_bad_bin_name(self): value = bytearray() value.append(255) ops = [bitwise_operations.bit_set("bad_name", 0, 8, 1, value, None)] with pytest.raises(e.BinNotFound): self.as_connection.operate(self.test_key, ops)
[ "def setbit(self, *args):\n if self._cluster:\n return self.execute(u'SETBIT', *args, shard_key=args[0])\n return self.execute(u'SETBIT', *args)", "def set_bit_zero(number, index):\n return number & ~(1 << index)", "def set_bit(src, bit, val):\n if isinstance(src, bytes):\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Perform a bitwise count op.
def test_bit_count_seven(self): ops = [bitwise_operations.bit_count(self.count_bin, 20, 9)] _, _, result = self.as_connection.operate(self.test_key, ops) assert result["count"] == 7
[ "def bitcount(self, *args):\n if self._cluster:\n return self.execute(u'BITCOUNT', *args, shard_key=args[0])\n return self.execute(u'BITCOUNT', *args)", "def test_bit_count_one(self):\n ops = [bitwise_operations.bit_count(self.zero_one_bin, 47, 8)]\n\n _, _, result = self.as...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Perform a bitwise count op.
def test_bit_count_one(self): ops = [bitwise_operations.bit_count(self.zero_one_bin, 47, 8)] _, _, result = self.as_connection.operate(self.test_key, ops) assert result["bitwise01"] == 1
[ "def bitcount(self, *args):\n if self._cluster:\n return self.execute(u'BITCOUNT', *args, shard_key=args[0])\n return self.execute(u'BITCOUNT', *args)", "def test_bit_count_seven(self):\n ops = [bitwise_operations.bit_count(self.count_bin, 20, 9)]\n\n _, _, result = self.as_...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Attempts to perform a bitwise count op with bit_offset outside of the bitmap being counted.
def test_bit_count_bit_offset_out_of_range(self): ops = [bitwise_operations.bit_count(self.zero_one_bin, 81, 1)] with pytest.raises(e.OpNotApplicable): self.as_connection.operate(self.test_key, ops)
[ "def count_set_bits(bitmap):\n bmp = bitmap\n count = 0\n n = 1\n while bmp > 0:\n if bmp & 1:\n count += 1\n bmp = bmp >> 1\n n = n + 1\n return count", "def test_bit_count_bit_size_too_large(self):\n ops = [bitwise_operations.bit_count(self.zero_one_bin, 1, ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Attempts to perform a bitwise count op on more bits than exist.
def test_bit_count_bit_size_too_large(self): ops = [bitwise_operations.bit_count(self.zero_one_bin, 1, 81)] with pytest.raises(e.OpNotApplicable): self.as_connection.operate(self.test_key, ops)
[ "def bitcount(self, *args):\n if self._cluster:\n return self.execute(u'BITCOUNT', *args, shard_key=args[0])\n return self.execute(u'BITCOUNT', *args)", "def count_set_bits(bitmap):\n bmp = bitmap\n count = 0\n n = 1\n while bmp > 0:\n if bmp & 1:\n count += ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Perform a bitwise add op.
def test_bit_add_simple(self): ops = [bitwise_operations.bit_add(self.test_bin_ones, 0, 8, 1, False, aerospike.BIT_OVERFLOW_FAIL, None)] self.as_connection.operate(self.test_key, ops) _, _, bins = self.as_connection.get(self.test_key) expected_result = bytearray([2] * 1 + [1] * 4) ...
[ "def __bitwise_add__(self, word1, word2):\n\n return (word1 + word2) % (1 << self.word_size)", "def add_bites(self, plus_bites):\n self.bites += plus_bites", "def addbin(a, b):\n while b != 0:\n r = a ^ b # add without carry\n c = (a & b) << 1 # carry\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Perform a bitwise add op with an offset that lands inbetween bytes.
def test_bit_add_inbetween_bytes(self): ops = [bitwise_operations.bit_add(self.test_bin_zeroes, 4, 8, 255, False, aerospike.BIT_OVERFLOW_FAIL, None)] self.as_connection.operate(self.test_key, ops) _, _, bins = self.as_connection.get(self.test_key) expected_result = bytearray([15] * 1 +...
[ "def _uint8_add(self, a, b):\n return ((a & 0xFF) + (b & 0xFF)) & 0xFF", "def __bitwise_add__(self, word1, word2):\n\n return (word1 + word2) % (1 << self.word_size)", "def add(self, size, a, b, flags = None):\n\t\treturn self.expr(core.LLIL_ADD, a.index, b.index, size = size, flags = flags)", "...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Perform a bitwise add op with multiple bytes.
def test_bit_add_multiple_bytes(self): ops = [bitwise_operations.bit_add(self.test_bin_zeroes, 8, 16, 65535, False, aerospike.BIT_OVERFLOW_FAIL, None)] self.as_connection.operate(self.test_key, ops) _, _, bins = self.as_connection.get(self.test_key) expected_result = bytearray([0] * 1 ...
[ "def add_bites(self, plus_bites):\n self.bites += plus_bites", "def addbin(a, b):\n while b != 0:\n r = a ^ b # add without carry\n c = (a & b) << 1 # carry\n a = int_overflow(r)\n b = int_overflow(c)\n return a", "def __bitwise_add__(self, word1, wo...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Perform a bitwise add op on a nonexistent bin.
def test_bit_add_bad_bin_name(self): ops = [bitwise_operations.bit_add("bad_name", 8, 16, 65535, False, aerospike.BIT_OVERFLOW_FAIL, None)] with pytest.raises(e.BinNotFound): self.as_connection.operate(self.test_key, ops)
[ "def addbin(a, b):\n while b != 0:\n r = a ^ b # add without carry\n c = (a & b) << 1 # carry\n a = int_overflow(r)\n b = int_overflow(c)\n return a", "def test_bit_insert_nonexistent_bin_name(self):\n value = bytearray([3])\n ops = [bitwise_ope...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Perform a bitwise add op with a bit_offset that is out of range for the bitmap being modified.
def test_bit_add_bit_offset_out_of_range(self): ops = [bitwise_operations.bit_add(self.test_bin_zeroes, 41, 1, 1, False, aerospike.BIT_OVERFLOW_FAIL, None)] with pytest.raises(e.OpNotApplicable): self.as_connection.operate(self.test_key, ops)
[ "def test_bit_add_bit_size_out_of_range(self):\n ops = [bitwise_operations.bit_add(self.test_bin_zeroes, 0, 41, 1, False, aerospike.BIT_OVERFLOW_FAIL, None)]\n\n with pytest.raises(e.OpNotApplicable):\n self.as_connection.operate(self.test_key, ops)", "def test_bit_add_overflow_fail(self)...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Perform a bitwise add op with a bit size too large for the bitmap being modified.
def test_bit_add_bit_size_out_of_range(self): ops = [bitwise_operations.bit_add(self.test_bin_zeroes, 0, 41, 1, False, aerospike.BIT_OVERFLOW_FAIL, None)] with pytest.raises(e.OpNotApplicable): self.as_connection.operate(self.test_key, ops)
[ "def add_bites(self, plus_bites):\n self.bites += plus_bites", "def add(self, size, a, b, flags = None):\n\t\treturn self.expr(core.LLIL_ADD, a.index, b.index, size = size, flags = flags)", "def __bitwise_add__(self, word1, word2):\n\n return (word1 + word2) % (1 << self.word_size)", "def add_ca...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Perform a bitwise add op that overflows with the BIT_OVERFLOW_FAIL action.
def test_bit_add_overflow_fail(self): ops = [bitwise_operations.bit_add(self.five_255_bin, 0, 8, 1, False, aerospike.BIT_OVERFLOW_FAIL, None)] with pytest.raises(e.OpNotApplicable): self.as_connection.operate(self.test_key, ops)
[ "def test_bit_add_bit_offset_out_of_range(self):\n ops = [bitwise_operations.bit_add(self.test_bin_zeroes, 41, 1, 1, False, aerospike.BIT_OVERFLOW_FAIL, None)]\n\n with pytest.raises(e.OpNotApplicable):\n self.as_connection.operate(self.test_key, ops)", "def test_bit_add_bit_size_out_of_r...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Perform a bitwise add op that overflows with the BIT_OVERFLOW_SATURATE action.
def test_bit_add_overflow_saturate(self): ops = [bitwise_operations.bit_add(self.five_255_bin, 0, 8, 1, False, aerospike.BIT_OVERFLOW_SATURATE, None)] self.as_connection.operate(self.test_key, ops) _, _, bins = self.as_connection.get(self.test_key) expected_result = bytearray([255] * 5...
[ "def test_bit_add_overflow_fail(self):\n ops = [bitwise_operations.bit_add(self.five_255_bin, 0, 8, 1, False, aerospike.BIT_OVERFLOW_FAIL, None)]\n\n with pytest.raises(e.OpNotApplicable):\n self.as_connection.operate(self.test_key, ops)", "def test_bit_add_overflow_wrap(self):\n o...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Perform a bitwise add op that overflows with the BIT_OVERFLOW_WRAP action.
def test_bit_add_overflow_wrap(self): ops = [bitwise_operations.bit_add(self.five_255_bin, 0, 8, 1, False, aerospike.BIT_OVERFLOW_WRAP, None)] self.as_connection.operate(self.test_key, ops) _, _, bins = self.as_connection.get(self.test_key) expected_result = bytearray([0] * 1 + [255] *...
[ "def test_bit_add_overflow_fail(self):\n ops = [bitwise_operations.bit_add(self.five_255_bin, 0, 8, 1, False, aerospike.BIT_OVERFLOW_FAIL, None)]\n\n with pytest.raises(e.OpNotApplicable):\n self.as_connection.operate(self.test_key, ops)", "def __bitwise_add__(self, word1, word2):\n\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Perform a bitwise and op with value large enough to span multiple bytes.
def test_bit_and_multiple_bytes(self): value = bytearray() value.append(1) value.append(1) value.append(1) ops = [bitwise_operations.bit_and(self.five_255_bin, 8, 17, 3, value, None)] self.as_connection.operate(self.test_key, ops) _, _, bins = self.as_connection...
[ "def instruction_and(self, register, a, b):\n if Vm.is_register(a):\n a = self.get_register(a)\n\n if Vm.is_register(b):\n b = self.get_register(b)\n\n self.set_register(register, (a & b) % MAX_INT)", "def test_bit_and_offset_bit_size_larger_than_val(self):\n valu...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Perform a bitwise and op with a bit_size > the size of value.
def test_bit_and_offset_bit_size_larger_than_val(self): value = bytearray() value.append(0) ops = [bitwise_operations.bit_and(self.five_255_bin, 0, 16, 1, value, None)] with pytest.raises(e.InvalidRequest): self.as_connection.operate(self.test_key, ops)
[ "def and_expr(self, size, a, b, flags = None):\n\t\treturn self.expr(core.LLIL_AND, a.index, b.index, size = size, flags = flags)", "def test_bit_and_offset_value_byte_size_too_large(self):\n value = bytearray()\n for x in range(0, 5):\n value.append(0)\n ops = [bitwise_operations....
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Perform a bitwise and op with a value_byte_size larger than the bitmap being modified.
def test_bit_and_offset_value_byte_size_too_large(self): value = bytearray() for x in range(0, 5): value.append(0) ops = [bitwise_operations.bit_and(self.five_255_bin, 0, 48, 6, value, None)] with pytest.raises(e.OpNotApplicable): self.as_connection.operate(self....
[ "def test_bit_and_offset_bit_size_larger_than_val(self):\n value = bytearray()\n value.append(0)\n ops = [bitwise_operations.bit_and(self.five_255_bin, 0, 16, 1, value, None)]\n\n with pytest.raises(e.InvalidRequest):\n self.as_connection.operate(self.test_key, ops)", "def t...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Perform a bitwise and op with a non existent bin name.
def test_bit_and_invalid_bin_name(self): value = bytearray() value.append(0) ops = [bitwise_operations.bit_and("bad_name", 0, 8, 1, value, None)] with pytest.raises(e.BinNotFound): self.as_connection.operate(self.test_key, ops)
[ "def test_bit_or_bad_bin_name(self):\n value = bytearray([8])\n ops = [bitwise_operations.bit_or(\"bad_name\", 0, 8, 1, value, None)]\n\n with pytest.raises(e.BinNotFound):\n self.as_connection.operate(self.test_key, ops)", "def str_and_bitwise():\n val = bin(9)\n print(type(...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Perform a bitwise get op.
def test_bit_get(self): ops = [bitwise_operations.bit_get(self.five_255_bin, 0, 8)] _, _, result = self.as_connection.operate(self.test_key, ops) expected_result = bytearray([255] * 1) assert result["255"] == expected_result
[ "def getbit(self, *args):\n if self._cluster:\n return self.execute(u'GETBIT', *args, shard_key=args[0])\n return self.execute(u'GETBIT', *args)", "def test_bit_get_accross_bytes(self):\n ops = [bitwise_operations.bit_get(self.test_bin_ones, 4, 8)]\n\n _, _, result = self.as...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Perform a bitwise get op with a negative offset.
def test_bit_get_negative_offset(self): ops = [bitwise_operations.bit_get(self.count_bin, -2, 2)] _, _, result = self.as_connection.operate(self.test_key, ops) expected_result = bytearray([192] * 1) assert result[self.count_bin] == expected_result
[ "def test_bit_subtract_bit_offset_out_of_range(self):\n ops = [\n bitwise_operations.bit_subtract(self.test_bin_zeroes, 41, 1, 1, False, aerospike.BIT_OVERFLOW_FAIL, None)\n ]\n\n with pytest.raises(e.OpNotApplicable):\n self.as_connection.operate(self.test_key, ops)", "...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Perform a bitwise get op across bytes.
def test_bit_get_accross_bytes(self): ops = [bitwise_operations.bit_get(self.test_bin_ones, 4, 8)] _, _, result = self.as_connection.operate(self.test_key, ops) expected_result = bytearray([16] * 1) assert result["bitwise1"] == expected_result
[ "def test_bit_get_int_accross_bytes(self):\n ops = [bitwise_operations.bit_get_int(self.test_bin_ones, 4, 8, False)]\n\n _, _, result = self.as_connection.operate(self.test_key, ops)\n\n expected_result = 16\n assert result[\"bitwise1\"] == expected_result", "def test_bit_get_multiple_...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Perform a bitwise get op across multiple bytes.
def test_bit_get_multiple_bytes(self): ops = [bitwise_operations.bit_get(self.five_255_bin, 4, 17)] _, _, result = self.as_connection.operate(self.test_key, ops) expected_result = bytearray([255] * 2 + [128] * 1) assert result["255"] == expected_result
[ "def test_bit_get_accross_bytes(self):\n ops = [bitwise_operations.bit_get(self.test_bin_ones, 4, 8)]\n\n _, _, result = self.as_connection.operate(self.test_key, ops)\n\n expected_result = bytearray([16] * 1)\n assert result[\"bitwise1\"] == expected_result", "def test_bit_get_int_acc...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Perform a bitwise get with a bit_size larger than the bitmap being read.
def test_bit_get_bit_size_too_large(self): ops = [bitwise_operations.bit_get(self.test_bin_ones, 0, 41)] with pytest.raises(e.OpNotApplicable): self.as_connection.operate(self.test_key, ops)
[ "def test_bit_get_int_bit_size_too_large(self):\n ops = [bitwise_operations.bit_get_int(self.test_bin_ones, 0, 41, False)]\n\n with pytest.raises(e.OpNotApplicable):\n self.as_connection.operate(self.test_key, ops)", "def test_bit_get(self):\n ops = [bitwise_operations.bit_get(self...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Perform a bitwise get with a non existent bin.
def test_bit_get_bad_bin_name(self): ops = [bitwise_operations.bit_get("bad_name", 0, 1)] _, _, result = self.as_connection.operate(self.test_key, ops) expected_result = None assert result["bad_name"] == expected_result
[ "def getbit(self, *args):\n if self._cluster:\n return self.execute(u'GETBIT', *args, shard_key=args[0])\n return self.execute(u'GETBIT', *args)", "def test_bit_get_negative_offset(self):\n ops = [bitwise_operations.bit_get(self.count_bin, -2, 2)]\n\n _, _, result = self.as_...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Perform a bitwise get int op.
def test_bit_get_int(self): ops = [bitwise_operations.bit_get_int(self.five_255_bin, 0, 8, False)] _, _, result = self.as_connection.operate(self.test_key, ops) expected_result = 255 assert result["255"] == expected_result
[ "def test_bit_get_int_accross_bytes(self):\n ops = [bitwise_operations.bit_get_int(self.test_bin_ones, 4, 8, False)]\n\n _, _, result = self.as_connection.operate(self.test_key, ops)\n\n expected_result = 16\n assert result[\"bitwise1\"] == expected_result", "def get_bit(cls, int_val: ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Perform a bitwise get int op across bytes.
def test_bit_get_int_accross_bytes(self): ops = [bitwise_operations.bit_get_int(self.test_bin_ones, 4, 8, False)] _, _, result = self.as_connection.operate(self.test_key, ops) expected_result = 16 assert result["bitwise1"] == expected_result
[ "def test_bit_get_int_multiple_bytes(self):\n ops = [bitwise_operations.bit_get_int(self.five_255_bin, 4, 17, False)]\n\n _, _, result = self.as_connection.operate(self.test_key, ops)\n\n expected_result = 131071\n assert result[\"255\"] == expected_result", "def getint(data, offset, i...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Perform a bitwise get int op across multiple bytes.
def test_bit_get_int_multiple_bytes(self): ops = [bitwise_operations.bit_get_int(self.five_255_bin, 4, 17, False)] _, _, result = self.as_connection.operate(self.test_key, ops) expected_result = 131071 assert result["255"] == expected_result
[ "def test_bit_get_int_accross_bytes(self):\n ops = [bitwise_operations.bit_get_int(self.test_bin_ones, 4, 8, False)]\n\n _, _, result = self.as_connection.operate(self.test_key, ops)\n\n expected_result = 16\n assert result[\"bitwise1\"] == expected_result", "def getint(data, offset, i...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Perform a bitwise get int with a bit_size larger than the bitmap being read.
def test_bit_get_int_bit_size_too_large(self): ops = [bitwise_operations.bit_get_int(self.test_bin_ones, 0, 41, False)] with pytest.raises(e.OpNotApplicable): self.as_connection.operate(self.test_key, ops)
[ "def test_bit_get_int(self):\n ops = [bitwise_operations.bit_get_int(self.five_255_bin, 0, 8, False)]\n\n _, _, result = self.as_connection.operate(self.test_key, ops)\n\n expected_result = 255\n assert result[\"255\"] == expected_result", "def test_bit_get_int_accross_bytes(self):\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }