query stringlengths 9 3.4k | document stringlengths 9 87.4k | metadata dict | negatives listlengths 4 101 | negative_scores listlengths 4 101 | document_score stringlengths 3 10 | document_rank stringclasses 102
values |
|---|---|---|---|---|---|---|
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) -> pulumi.Output['outputs.ServiceNetworkConfiguration']:
return pulumi.get(self, "network_configuration") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def network_settings(self): # type: () -> t.Dict[str, t.Any]\n return self.inspection['NetworkSettings']",
"def network_configuration(self) -> Optional[pulumi.Input['ServiceNetworkConfigurationArgs']]:\n return pulumi.get(self, \"network_configuration\")",
"def network_configuration(self) -> Opt... | [
"0.6014857",
"0.60012364",
"0.60012364",
"0.5869486",
"0.5869486",
"0.5752626",
"0.5752626",
"0.56914485",
"0.56446093",
"0.5628058",
"0.5613196",
"0.5544539",
"0.5525053",
"0.5504097",
"0.55001223",
"0.54938364",
"0.5486738",
"0.5454514",
"0.5370706",
"0.533655",
"0.5307405"... | 0.5944788 | 3 |
The observability configuration of your service. See Observability Configuration below for more details. | def observability_configuration(self) -> pulumi.Output[Optional['outputs.ServiceObservabilityConfiguration']]:
return pulumi.get(self, "observability_configuration") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def observability_configuration(self) -> Optional[pulumi.Input['ServiceObservabilityConfigurationArgs']]:\n return pulumi.get(self, \"observability_configuration\")",
"def observability_configuration(self) -> Optional[pulumi.Input['ServiceObservabilityConfigurationArgs']]:\n return pulumi.get(self,... | [
"0.8173864",
"0.8173864",
"0.56439465",
"0.53201985",
"0.5269377",
"0.521966",
"0.52014226",
"0.518629",
"0.5127047",
"0.5127047",
"0.5122262",
"0.5114975",
"0.5073362",
"0.5050198",
"0.49730882",
"0.49526307",
"0.49493897",
"0.4934082",
"0.49124867",
"0.48943686",
"0.4861345... | 0.79563946 | 2 |
An alphanumeric ID that App Runner generated for this service. Unique within the AWS Region. | def service_id(self) -> pulumi.Output[str]:
return pulumi.get(self, "service_id") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def service_id(self) -> str:\n return pulumi.get(self, \"service_id\")",
"def aws_external_id(self) -> str:\n return pulumi.get(self, \"aws_external_id\")",
"def unique_identifier(self) -> str:\n return pulumi.get(self, \"unique_identifier\")",
"def _app_id(self):\n return '{}-{}'... | [
"0.6950045",
"0.6841081",
"0.68262887",
"0.6759289",
"0.6710759",
"0.66880447",
"0.66621614",
"0.66505545",
"0.664553",
"0.6640219",
"0.6596991",
"0.65516406",
"0.648458",
"0.64773434",
"0.64496845",
"0.6447253",
"0.6441158",
"0.6439886",
"0.64262784",
"0.6423269",
"0.6412897... | 0.6736662 | 4 |
Name of the service. | def service_name(self) -> pulumi.Output[str]:
return pulumi.get(self, "service_name") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def service_name(self) -> str:\n return pulumi.get(self, \"service_name\")",
"def service_name(self) -> str:\n return pulumi.get(self, \"service_name\")",
"def service_name(self):\n return self._service_name",
"def service_name(self) -> pulumi.Input[str]:\n return pulumi.get(self,... | [
"0.90985924",
"0.90985924",
"0.89885104",
"0.8632549",
"0.8632549",
"0.8632549",
"0.832409",
"0.832409",
"0.832409",
"0.82325894",
"0.8127267",
"0.785057",
"0.7743876",
"0.76368743",
"0.7590222",
"0.75873625",
"0.7544445",
"0.73286045",
"0.7316036",
"0.7237534",
"0.7237534",
... | 0.87708855 | 5 |
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") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def base_url(self):\n return \"http://{0}:{1}/app\".format(self.host, self.port)",
"def public_rest_url(path_url: str, domain: str = CONSTANTS.DEFAULT_DOMAIN) -> str:\n return CONSTANTS.FTX_BASE_URL + path_url",
"def get_service_url():\n return get_config_handler().get_service_url()",
"def app_u... | [
"0.6826508",
"0.6681023",
"0.6672236",
"0.6605209",
"0.6551995",
"0.65030795",
"0.6468015",
"0.64567655",
"0.6423532",
"0.63967156",
"0.6384149",
"0.63212645",
"0.6273218",
"0.6251125",
"0.6244899",
"0.6244899",
"0.6230171",
"0.62126696",
"0.6212174",
"0.62013507",
"0.6196434... | 0.68187 | 1 |
The source to deploy to the App Runner service. Can be a code or an image repository. See Source Configuration below for more details. | def source_configuration(self) -> pulumi.Output['outputs.ServiceSourceConfiguration']:
return pulumi.get(self, "source_configuration") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def source_repository(self) -> Optional['outputs.CodeRepositoryResponse']:\n return pulumi.get(self, \"source_repository\")",
"def _create_source_stage(\n self, stage_name: str, output: codepipeline.Artifact):\n secret_token = ''\n repo = ''\n owner = ''\n github_act... | [
"0.66399777",
"0.62668455",
"0.6238873",
"0.6238873",
"0.6238873",
"0.6238873",
"0.6238873",
"0.6238873",
"0.62323636",
"0.62184614",
"0.62184614",
"0.62184614",
"0.62184614",
"0.616811",
"0.6158358",
"0.6127942",
"0.60938025",
"0.60862446",
"0.60485876",
"0.60106725",
"0.599... | 0.5751831 | 30 |
Current state of the App Runner service. | def status(self) -> pulumi.Output[str]:
return pulumi.get(self, "status") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_state(self):\n return self._env.get_state()",
"def running(self):\n info = self.info()\n return info['running']",
"def status(self):\n if self.app_id:\n return self.yarn_api.apps_info(self.app_id)\n else:\n raise KnitException(\"Cannot get status... | [
"0.68262595",
"0.6792812",
"0.67527646",
"0.67260224",
"0.66270804",
"0.6615319",
"0.6562786",
"0.6559686",
"0.6556301",
"0.6546062",
"0.6480879",
"0.64766324",
"0.64340585",
"0.6432745",
"0.6425858",
"0.6401064",
"0.6361489",
"0.63612664",
"0.6340973",
"0.6334077",
"0.632901... | 0.0 | -1 |
Keyvalue map of resource tags. If configured with a provider `default_tags` configuration block present, tags with matching keys will overwrite those defined at the providerlevel. | def tags(self) -> pulumi.Output[Optional[Mapping[str, str]]]:
return pulumi.get(self, "tags") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def tags(self) -> Mapping[str, str]:\n return pulumi.get(self, \"tags\")",
"def tags(self) -> Mapping[str, str]:\n return pulumi.get(self, \"tags\")",
"def tags(self) -> Mapping[str, str]:\n return pulumi.get(self, \"tags\")",
"def tags(self) -> Mapping[str, str]:\n return pulumi.... | [
"0.62642497",
"0.62642497",
"0.62642497",
"0.62642497",
"0.6251339",
"0.6199256",
"0.61984146",
"0.61984146",
"0.6171527",
"0.6025279",
"0.5910227",
"0.58787954",
"0.58628654",
"0.58628654",
"0.58545613",
"0.57720864",
"0.5752244",
"0.574767",
"0.5728635",
"0.5702416",
"0.570... | 0.5696738 | 48 |
Map of tags assigned to the resource, including those inherited from the provider `default_tags` configuration block. | def tags_all(self) -> pulumi.Output[Mapping[str, str]]:
return pulumi.get(self, "tags_all") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def tags(self) -> Mapping[str, Any]:\n return pulumi.get(self, \"tags\")",
"def tags(self) -> Mapping[str, Any]:\n return pulumi.get(self, \"tags\")",
"def tags(self) -> Mapping[str, str]:\n return pulumi.get(self, \"tags\")",
"def tags(self) -> Mapping[str, str]:\n return pulumi.... | [
"0.74800754",
"0.74800754",
"0.7448629",
"0.7448629",
"0.7448629",
"0.7448629",
"0.71848774",
"0.7073276",
"0.70731705",
"0.7040371",
"0.70166034",
"0.6994814",
"0.6991792",
"0.69025075",
"0.6864671",
"0.6808852",
"0.67572224",
"0.67572224",
"0.67572224",
"0.67572224",
"0.675... | 0.6592072 | 63 |
Get the Primitive value from the data | def getValue(self, data):
raise Exception("Exception via Error Parameter") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_value(self, data):\n value = data['value']\n return value",
"def _val(obj):\n if isinstance(obj, ctypes._SimpleCData):\n return obj.value\n else:\n return obj",
"def primitive(expression):\n expression = expression.children[0]\n if... | [
"0.6782263",
"0.6780254",
"0.668268",
"0.6651958",
"0.6607707",
"0.65142834",
"0.65092975",
"0.64796317",
"0.6414398",
"0.64035314",
"0.6379131",
"0.6358039",
"0.6348189",
"0.6295367",
"0.6295367",
"0.62824297",
"0.62044734",
"0.62044734",
"0.61853516",
"0.6182198",
"0.618196... | 0.0 | -1 |
Finds line and circle intersectinos | def get_line_circle_intersections(A, B, C, r):
Lx = B[0] - A[0]
Ly = B[1] - A[1]
Lz = B[2] - A[2]
# stranger things
D = Lx**2 + Ly**2
E = 2 * ( Lx * (A[0] - C[0]) + Ly * (A[1] - C[1]) )
F = (
(A[0] - C[0])**2
+ (A[1] - C[1])**2
- r**2
)
det = E**2... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def find_circle_line_intersection(P0, r0, P1):\n\t\n\tx_offset, y_offset = P0\n\tx0, y0 = 0, 0\n\tx1, y1 = P1\n\n\tx1, y1 = x1 - x_offset, y1 - y_offset\n\n\tdx = x1 - x0\n\tdy = y1 - y0\n\tdr = math.sqrt(dx*dx + dy*dy)\n\n\tD = x0*y1 - x1*y0\n\n\tdelta0 = r0*r0*dr*dr - D*D\n\n\tx2 = (D*dy + sgn(dy)*dx*math.sqrt(d... | [
"0.751181",
"0.74100983",
"0.7280611",
"0.72409403",
"0.7170542",
"0.70794666",
"0.6994927",
"0.6968161",
"0.69083315",
"0.6891008",
"0.6876366",
"0.6850432",
"0.6795846",
"0.675159",
"0.67513275",
"0.674191",
"0.67247736",
"0.67215085",
"0.6670673",
"0.66661286",
"0.6656957"... | 0.7375095 | 2 |
Given a model name, returns a Torchvision model in eval mode as well as an example input. | def load_torchvision(model_name):
# Lazy import as torchvision may not be required.
import torchvision
with torch.no_grad():
if model_name.startswith("inception"):
height = width = 299
mean = [0.5, 0.5, 0.5]
std = [0.5, 0.5, 0.5]
else:
height ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def load_model(model_name):\n if hasattr(torchvision.models, model_name):\n with torch.no_grad():\n if model_name.startswith(\"inception\"):\n height = width = 299\n mean = [0.5, 0.5, 0.5]\n std = [0.5, 0.5, 0.5]\n else:\n ... | [
"0.7430761",
"0.72604704",
"0.7132248",
"0.68675524",
"0.68433666",
"0.68400264",
"0.67486155",
"0.66419154",
"0.6630293",
"0.6629258",
"0.6626982",
"0.6581891",
"0.64554715",
"0.6432485",
"0.6421258",
"0.6364881",
"0.63573295",
"0.633688",
"0.6330896",
"0.6325902",
"0.629075... | 0.7172089 | 2 |
Given a model name, returns a pretrainedmodels.pytorch model in eval mode as well as an example input. | def load_pretrainedmodels(model_name):
# Lazy import as torchvision may not be required.
import pretrainedmodels
model = getattr(pretrainedmodels, model_name)().float().eval()
input_shape = [1, *model.input_size]
input_data = torch.rand(input_shape).float() * 256
for channel in range(3):
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def load_model(model_name):\n if hasattr(torchvision.models, model_name):\n with torch.no_grad():\n if model_name.startswith(\"inception\"):\n height = width = 299\n mean = [0.5, 0.5, 0.5]\n std = [0.5, 0.5, 0.5]\n else:\n ... | [
"0.8106233",
"0.74055463",
"0.73103786",
"0.73092246",
"0.7196308",
"0.7172737",
"0.71333736",
"0.71026266",
"0.70072865",
"0.69900763",
"0.6964566",
"0.67862076",
"0.676909",
"0.668715",
"0.6633233",
"0.6631243",
"0.66252095",
"0.6600286",
"0.65757954",
"0.6562362",
"0.65465... | 0.73235846 | 2 |
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... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_model(name, disable_logging=False):\n return PluginLoader._import(\"train.model\", name, disable_logging)",
"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)... | [
"0.697611",
"0.6974655",
"0.6780623",
"0.6676455",
"0.65731716",
"0.6506318",
"0.6412367",
"0.6401762",
"0.6367586",
"0.6244505",
"0.6217965",
"0.619761",
"0.6148934",
"0.61453503",
"0.61379516",
"0.6132714",
"0.6060599",
"0.6044852",
"0.59870446",
"0.59724617",
"0.5971283",
... | 0.73867327 | 0 |
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... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def model_fn(model_dir):\n print(\"Loading model.\")\n\n # First, load the parameters used to create the model.\n model_info = {}\n model_info_path = os.path.join(model_dir, 'model_info.pth')\n with open(model_info_path, 'rb') as f:\n model_info = torch.load(f)\n\n print(\"model_info: {}\"... | [
"0.6424617",
"0.63462615",
"0.62104595",
"0.615085",
"0.61280006",
"0.61014485",
"0.5989856",
"0.59578437",
"0.5916136",
"0.5891427",
"0.5865856",
"0.58404297",
"0.5829503",
"0.57395333",
"0.5738998",
"0.57333404",
"0.5731952",
"0.5727657",
"0.5726606",
"0.5726429",
"0.570725... | 0.6610076 | 0 |
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] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self,\n input_dim,\n dec_seq_len,\n out_seq_len,\n d_model=512,\n nhead=8,\n num_encoder_layers=6,\n num_decoder_layers=6,\n dim_feedforward=2048,\n dropout=0... | [
"0.6855274",
"0.658197",
"0.6179455",
"0.6175562",
"0.6171663",
"0.61527574",
"0.6151067",
"0.6151067",
"0.6151067",
"0.6151067",
"0.6151067",
"0.6151067",
"0.6151067",
"0.61124516",
"0.61082864",
"0.61082345",
"0.60755324",
"0.6045084",
"0.60307",
"0.6029154",
"0.60272676",
... | 0.7178562 | 0 |
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... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_model(name, disable_logging=False):\n return PluginLoader._import(\"train.model\", name, disable_logging)",
"def get_model(\n model_type: str,\n model_name: str = None,\n num_classes: t.Optional[int] = 1000,\n input_shape: t.Optional[t.Tuple] = (3, 224, 224),\n model: t.Optional[Mod... | [
"0.6649939",
"0.6573367",
"0.6460272",
"0.6365849",
"0.6321241",
"0.62554383",
"0.6205857",
"0.609324",
"0.60782516",
"0.60180837",
"0.6016271",
"0.60053897",
"0.60016245",
"0.5934384",
"0.58993465",
"0.587728",
"0.5876873",
"0.5870805",
"0.58685386",
"0.5868329",
"0.5839506"... | 0.8065929 | 0 |
Checks if a directory exists and creates if missing | def direxists(ipath):
if not ipath.endswith("/"):
ipath = ipath + "/"
if not os.path.exists(ipath):
try:
os.mkdir(ipath)
except os.error:
logging.error("Can't create directory %s!", ipath)
else:
if not os.access(os.path.dirname(ipath), os.W_OK):
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def dirChecking(dir):\n if not os.path.exists(dir):\n os.mkdir(dir)",
"def _ensure_dir_exists(self, directory):\n directory = directory.strip()\n if not Path(directory).exists():\n os.mkdir(directory)",
"def mkdir_if_missing(d):\n if not os.path.exists(d):\n os.make... | [
"0.82617587",
"0.81745356",
"0.81679416",
"0.8122959",
"0.80937266",
"0.80911714",
"0.8090356",
"0.80742896",
"0.80580133",
"0.80044264",
"0.7988134",
"0.7986877",
"0.7977787",
"0.79682803",
"0.79455847",
"0.7932104",
"0.792881",
"0.7923278",
"0.7905312",
"0.79021674",
"0.789... | 0.0 | -1 |
Checks if a file exists and creates if missing | def fileexists(cpath, create=True):
dpath = os.path.dirname(cpath)
if not os.path.isfile(cpath):
if direxists(dpath) and create:
try:
pathlib.Path(cpath).touch()
except os.error:
logging.error("Can't create file %s!", cpath)
return ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def check_file(path):\n if not os.path.exists(path):\n os.makedirs(path)",
"def _file_needs_to_be_created(self, file_path, quiet=False):\n if not self._args.check_for_existing_files:\n return True\n if os.path.exists(file_path):\n if not quiet:\n sys.s... | [
"0.7649164",
"0.73142385",
"0.7309955",
"0.7265119",
"0.72298217",
"0.7218897",
"0.71731156",
"0.7118284",
"0.70821744",
"0.70716095",
"0.6956062",
"0.69522077",
"0.6947126",
"0.69272906",
"0.6917886",
"0.69170785",
"0.6901483",
"0.68857497",
"0.6878484",
"0.6875463",
"0.6871... | 0.69732267 | 10 |
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'
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _icons(self):",
"def icon(self):",
"def om_icons(self):\n icons = ({'path': 'misc_/DataTemplates/ic-xml.gif',\n 'alt': self.meta_type, 'title': self.meta_type},)\n if not self._v_cooked:\n self._cook()\n if self._v_errors:\n icons = icons + ({'pat... | [
"0.70672655",
"0.65587485",
"0.62278324",
"0.6146548",
"0.613125",
"0.61307836",
"0.6071784",
"0.60547864",
"0.59524333",
"0.59221816",
"0.59087664",
"0.5892237",
"0.5814968",
"0.5772996",
"0.5772996",
"0.5770113",
"0.57606995",
"0.5742103",
"0.57360274",
"0.57078516",
"0.570... | 0.68753237 | 1 |
Checks how old the cache is | def newcache(cchepath):
# it's under 30 mins old and not an empty file
now = time.time()
mtime = os.path.getmtime(cchepath)
if now - mtime <= 1800:
return False
return True | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_safe_cache(self):\n if self.get_last_update() > self.timestamp:\n return False\n return True",
"def fresh(self):\n if NO_CACHE:\n return False\n return os.path.getmtime(pagePath(self.pageName))<=self.lastUpdated",
"def needs_update(self, cache_key):\r\n ... | [
"0.7317197",
"0.7219558",
"0.71089613",
"0.7054986",
"0.7006333",
"0.6920688",
"0.6884125",
"0.6741702",
"0.6695032",
"0.6691925",
"0.66710943",
"0.6667953",
"0.6630793",
"0.66304374",
"0.6629897",
"0.65993917",
"0.6586781",
"0.6528703",
"0.64874315",
"0.648113",
"0.6466828",... | 0.7103428 | 3 |
Gets new json cache | def getnewdata():
try:
os.remove(cachepath)
except os.error:
pass
tdelta = int(EPGHOURS)*60*60
now = time.time()
later = now + tdelta
# 2020-03-24%2021%3A00%3A00.000%2B0000
starttime = urllib.parse.quote(datetime.fromtimestamp(now).
strftime... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def cached_json_get(url):\n return requests.get(url).json()",
"def cache(self):\n if self._cache is None:\n with open(self.cache_path, 'r') as cache_file:\n self._cache = json.load(cache_file)\n return self._cache",
"def cache():\n if request.method == 'GET':\n ... | [
"0.7500597",
"0.74776095",
"0.7131102",
"0.7096487",
"0.70682526",
"0.69773877",
"0.689274",
"0.68536794",
"0.6830835",
"0.6771884",
"0.67598957",
"0.6751746",
"0.67508984",
"0.6736612",
"0.6681546",
"0.66794294",
"0.66520405",
"0.6628578",
"0.6607876",
"0.65905625",
"0.65136... | 0.0 | -1 |
changes datetime from utc to computer's local time | def datetime_from_utc_to_local(utc_datetime):
now_timestamp = time.time()
offset = datetime.fromtimestamp(now_timestamp) - datetime.utcfromtimestamp(now_timestamp)
return utc_datetime + offset | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def localtime2utc(date):\n return date + (datetime.utcnow() - datetime.now())",
"def utc_to_local_datetime(dt):\n return dt.astimezone(LOCAL)",
"def set_utc(date_time):\n utc = datetime.timezone(datetime.timedelta(0))\n date_time = date_time.replace(tzinfo=utc)\n return date_time",
"def lo... | [
"0.7467327",
"0.7299433",
"0.7221331",
"0.71206695",
"0.70101184",
"0.7008891",
"0.70071393",
"0.70071393",
"0.70071393",
"0.70002633",
"0.6920775",
"0.691118",
"0.68929344",
"0.6862337",
"0.68511033",
"0.6793887",
"0.6756534",
"0.67129976",
"0.6707399",
"0.6707399",
"0.66897... | 0.7048078 | 4 |
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 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self, value, key_length=1):\r\n super().__init__(self.key, value)\r\n self.key_length = key_length\r\n self.items = OrderedDict()\r\n self.parse()\r\n\r\n self._PlatformTailNumber = None\r\n self._PlatformHeadingAngle = None\r\n self._ImageSourceSensor ... | [
"0.55618083",
"0.54142815",
"0.53817075",
"0.53536946",
"0.53438824",
"0.52844536",
"0.51879114",
"0.51562005",
"0.5135914",
"0.5134475",
"0.51331466",
"0.5132032",
"0.5116857",
"0.51153636",
"0.50826174",
"0.50541294",
"0.50439155",
"0.5021056",
"0.50179166",
"0.50034547",
"... | 0.5463841 | 1 |
The frequency attribute getter. | def frequency(self) -> NumType:
return self._freq | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getFreq(self,):\n\t\treturn self.freq;",
"def frequency(self):\n return self._get('frequency')",
"def get_freq(self):\n return self.freq",
"def get_frequency(self):\r\n return self.f",
"def GetFrequency(self):\n ...",
"def get_frequency(self):\r\n return self._api.g... | [
"0.8607623",
"0.8531045",
"0.84871864",
"0.84773874",
"0.82743865",
"0.8183427",
"0.8041284",
"0.80256695",
"0.79467016",
"0.79348344",
"0.78384334",
"0.78126246",
"0.7594316",
"0.75902605",
"0.7574836",
"0.7516219",
"0.7495854",
"0.7495854",
"0.73988676",
"0.73860407",
"0.73... | 0.80086666 | 8 |
The frequency attribute setter. | def frequency(self, frequency: int):
self._freq = freq | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_frequency(self, newval):\n rest_val = str(int(round(newval * 65536.0, 1)))\n return self._setAttr(\"frequency\", rest_val)",
"def set_Freq(self,freq):\n super(self.__class__, self).setFreq(self, freq)",
"def setFreq(self,newfreq):\n\t\tself.freq = newfreq;",
"def freq(self, freq=None... | [
"0.8306161",
"0.82891417",
"0.80319023",
"0.7854099",
"0.7850988",
"0.782227",
"0.752037",
"0.7485101",
"0.7478357",
"0.7397221",
"0.7369341",
"0.7369144",
"0.726587",
"0.7203276",
"0.7198561",
"0.7187161",
"0.7098913",
"0.70967144",
"0.70895505",
"0.7042987",
"0.7024605",
... | 0.81058174 | 2 |
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}... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"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... | [
"0.74142647",
"0.72871935",
"0.7271407",
"0.7136929",
"0.7131495",
"0.70471036",
"0.7003873",
"0.6998109",
"0.695118",
"0.687143",
"0.68235624",
"0.6776829",
"0.67384326",
"0.67028344",
"0.66680944",
"0.6656349",
"0.6656332",
"0.6616977",
"0.6614763",
"0.6606953",
"0.6599726"... | 0.8909028 | 0 |
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}... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __sub__(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... | [
"0.6897913",
"0.686807",
"0.68031883",
"0.67141724",
"0.6677903",
"0.6609048",
"0.66008663",
"0.6557345",
"0.6422639",
"0.6399935",
"0.6376798",
"0.6290664",
"0.62754256",
"0.62695223",
"0.6264662",
"0.6258906",
"0.6256665",
"0.6246081",
"0.622621",
"0.621305",
"0.61873764",
... | 0.7975307 | 0 |
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}... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __mul__(self, other):\n # print other\n if type(other) == int or type(other) == float:\n return self.scale(other)\n elif type(other) == Vector:\n return self.dot(other)\n else:\n return NotImplemented",
"def __mul__(self, other):\r\n return ... | [
"0.74306023",
"0.7297101",
"0.72146547",
"0.71841425",
"0.71742857",
"0.7134762",
"0.7093439",
"0.70923084",
"0.7059664",
"0.6998358",
"0.6965713",
"0.69609094",
"0.6956492",
"0.69293594",
"0.6906382",
"0.6905946",
"0.68920153",
"0.6883814",
"0.6873146",
"0.68704355",
"0.6852... | 0.83590376 | 0 |
Divide a Volt() object. If dividing by a int or float the self. Divide two Volt() objects together, returning the factor of the two objects. | def __truediv__(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_u... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __div__(self, other):\n if isinstance(other, (int, float)):\n return self * (1 / other)\n else:\n raise TypeError(\"Cannot divide vector by {}\".format(other))",
"def __div__(self, other):\r\n T = type(other)\r\n # vec4/scalar\r\n if T==types.FloatType... | [
"0.74101925",
"0.7220759",
"0.69998926",
"0.69689995",
"0.69554067",
"0.69554067",
"0.682494",
"0.66711",
"0.66471064",
"0.66471064",
"0.6580896",
"0.6579325",
"0.65266305",
"0.65266305",
"0.65266305",
"0.6434918",
"0.6433851",
"0.6409687",
"0.63887036",
"0.63866496",
"0.6385... | 0.6888459 | 6 |
The magnitude attribute getter. | def volts(self) -> NumType:
return self._volt | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_mag(self):\n raise NotImplementedError",
"def magnitude(x):\n return x.magnitude if hasattr(x, 'magnitude') else x",
"def magnitude(self):\n\t\treturn sqrt(self.dot(self))",
"def magnitude(self):\n return math.sqrt(self.x**2 + self.y**2 + self.z**2)",
"def magnitude(self):\n ... | [
"0.78821415",
"0.7744481",
"0.75217575",
"0.75084037",
"0.74528784",
"0.74528784",
"0.73352927",
"0.7293906",
"0.7245636",
"0.7212631",
"0.71533173",
"0.71198696",
"0.7073964",
"0.6905093",
"0.6751131",
"0.6726429",
"0.6629411",
"0.6601528",
"0.6458073",
"0.6432477",
"0.64311... | 0.0 | -1 |
The volt attribute setter. | def volts(self, volt: NumType):
self._volt = volt | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_setVoltage(self):\n self.read(\":VOLT?\")",
"def setvoltages(self):\n pass",
"def set_volt(self,volt):\n self.spi_disable()\n self.spi_enable()\n data1=volt*256//self.vref\n if data1>255:\n data1=255\n if data1<0:\n data1=0\n ... | [
"0.64910316",
"0.6318452",
"0.6313791",
"0.61006796",
"0.60669094",
"0.60529065",
"0.60273206",
"0.5980553",
"0.59714717",
"0.59714717",
"0.5874598",
"0.5865234",
"0.5841621",
"0.5784756",
"0.5784631",
"0.5780349",
"0.57798725",
"0.57798725",
"0.57798725",
"0.57736105",
"0.57... | 0.7285518 | 0 |
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... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"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... | [
"0.7433785",
"0.714936",
"0.710161",
"0.6762452",
"0.67164207",
"0.66605616",
"0.66493183",
"0.65010947",
"0.6368861",
"0.63628244",
"0.6322242",
"0.629921",
"0.62943053",
"0.6284239",
"0.6264756",
"0.62547755",
"0.62463784",
"0.6244722",
"0.62421227",
"0.61927456",
"0.618531... | 0.8724514 | 0 |
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... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __truediv__(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... | [
"0.68999416",
"0.6833628",
"0.676385",
"0.66355044",
"0.6598059",
"0.6590933",
"0.6540221",
"0.6534598",
"0.65079206",
"0.64034814",
"0.6343812",
"0.63341063",
"0.6326702",
"0.63187754",
"0.6307621",
"0.6303723",
"0.62694395",
"0.624874",
"0.6240412",
"0.6204857",
"0.62013614... | 0.84507024 | 0 |
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... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __mul__(self, other):\r\n return self.prod(other)",
"def mul(self, a: 'PFElement', b: 'PFElement') -> 'PFElement':\n return self(self._pf_mul(a.value, b.value, self.multiplicative_group))",
"def mul(self, a, b):\n return a * b",
"def __mul__(self, other, **kwargs):\n kwargs.up... | [
"0.7408632",
"0.7406158",
"0.7264367",
"0.6947231",
"0.6929308",
"0.6916226",
"0.6911664",
"0.6869576",
"0.6840827",
"0.68196017",
"0.6803583",
"0.67914593",
"0.6761148",
"0.67590225",
"0.6757337",
"0.67506737",
"0.6744073",
"0.66633433",
"0.66592115",
"0.6612321",
"0.6610977... | 0.80016875 | 0 |
Divide two Amp() objects together, returning the product of the two objects. | def __truediv__(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... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"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... | [
"0.73934114",
"0.70801663",
"0.69396526",
"0.67649186",
"0.67649186",
"0.6617982",
"0.6546049",
"0.6506521",
"0.6501719",
"0.64471626",
"0.6430499",
"0.6318481",
"0.6312919",
"0.628307",
"0.6243876",
"0.6239077",
"0.6230887",
"0.6229301",
"0.61985976",
"0.61821085",
"0.614407... | 0.6323593 | 11 |
The magnitude attribute getter. | def amps(self) -> NumType:
return self._amp | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_mag(self):\n raise NotImplementedError",
"def magnitude(x):\n return x.magnitude if hasattr(x, 'magnitude') else x",
"def magnitude(self):\n\t\treturn sqrt(self.dot(self))",
"def magnitude(self):\n return math.sqrt(self.x**2 + self.y**2 + self.z**2)",
"def magnitude(self):\n ... | [
"0.78821415",
"0.7744481",
"0.75217575",
"0.75084037",
"0.74528784",
"0.74528784",
"0.73352927",
"0.7293906",
"0.7245636",
"0.7212631",
"0.71533173",
"0.71198696",
"0.7073964",
"0.6905093",
"0.6751131",
"0.6726429",
"0.6629411",
"0.6601528",
"0.6458073",
"0.6432477",
"0.64311... | 0.0 | -1 |
The volt attribute setter. | def amps(self, amp: NumType):
self._amp = amp | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def volts(self, volt: NumType):\n self._volt = volt",
"def get_setVoltage(self):\n self.read(\":VOLT?\")",
"def setvoltages(self):\n pass",
"def set_volt(self,volt):\n self.spi_disable()\n self.spi_enable()\n data1=volt*256//self.vref\n if data1>255:\n ... | [
"0.7285518",
"0.64910316",
"0.6318452",
"0.6313791",
"0.61006796",
"0.60669094",
"0.60529065",
"0.60273206",
"0.5980553",
"0.59714717",
"0.59714717",
"0.5874598",
"0.5865234",
"0.5841621",
"0.5784756",
"0.5784631",
"0.5780349",
"0.57798725",
"0.57798725",
"0.57798725",
"0.577... | 0.0 | -1 |
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... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"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 ... | [
"0.75681996",
"0.74703264",
"0.74501014",
"0.7414552",
"0.7378725",
"0.7324489",
"0.68723",
"0.67236125",
"0.6660199",
"0.6646521",
"0.6638953",
"0.6621129",
"0.65180033",
"0.6511642",
"0.6492798",
"0.64850414",
"0.64789504",
"0.6464822",
"0.64206195",
"0.64200747",
"0.641864... | 0.89833313 | 0 |
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... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __truediv__(self, other):\n if isinstance(other, int) or isinstance(other, float) or 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 {... | [
"0.7698359",
"0.76604456",
"0.74490535",
"0.733054",
"0.68389434",
"0.6429149",
"0.6335388",
"0.62942797",
"0.6225056",
"0.6210105",
"0.6170732",
"0.6101144",
"0.6083943",
"0.6012478",
"0.60102427",
"0.5950072",
"0.5921162",
"0.5875086",
"0.581623",
"0.58135456",
"0.5800836",... | 0.90131366 | 0 |
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}... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __mul__(self, y):\n sum = 0\n x = self\n if len(x) > len(y):\n x, y = y, x\n for key in x:\n if key not in y:\n continue\n sum += x[key] * y[key]\n return sum",
"def __mul__(self, y):\n sum = 0\n x = self\n ... | [
"0.7158825",
"0.7158825",
"0.6799878",
"0.67005163",
"0.6686018",
"0.66069025",
"0.6605818",
"0.6602995",
"0.6474987",
"0.6459986",
"0.64501494",
"0.64255404",
"0.637624",
"0.63341546",
"0.6328572",
"0.6253951",
"0.62519056",
"0.62491167",
"0.6203832",
"0.6196025",
"0.6124351... | 0.77959746 | 0 |
Divide two Ohm() objects together, returning the factor of the two objects. | def __truediv__(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_u... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def divide(self, other: BagOfGoods):\n if not any(other.elements()):\n raise ZeroDivisionError()\n return min((self[g] // other[g] for g in other.keys()))",
"def divide_with_remainder(self, other: BagOfGoods):\n quotient = self.divide(other)\n remainder = BagOfGoods({g: sel... | [
"0.70489526",
"0.6842286",
"0.6819436",
"0.67629784",
"0.67629784",
"0.66515607",
"0.6621761",
"0.6500927",
"0.6465984",
"0.64128804",
"0.6401432",
"0.6391093",
"0.6268111",
"0.62452394",
"0.6237651",
"0.6237001",
"0.62046146",
"0.62046146",
"0.62046146",
"0.61905354",
"0.612... | 0.63122755 | 12 |
Return ohm as a resistance. This will not change the insulation_code of self._ohms. | def r(self) -> float:
return self._ohms.real | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getResistence(self):\n return self.resistence",
"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... | [
"0.58289057",
"0.5756095",
"0.55540806",
"0.5437796",
"0.54163355",
"0.53827655",
"0.5373473",
"0.5333576",
"0.5330446",
"0.5281449",
"0.5253052",
"0.5227909",
"0.5227909",
"0.5215746",
"0.5182154",
"0.5170751",
"0.5131431",
"0.5111294",
"0.5100755",
"0.5100755",
"0.5049968",... | 0.59486413 | 0 |
Set ohm as a resistance. If passed as a complex insulation_code no checking or manipulation of the insulation_code is completed. It is up to the user to ensure that it is the correct form. The existing insulation_code of self._ohms is overwritten. | def r(self, r: ComType):
if isinstance(r, complex):
self._ohms = r
else:
self._ohms = complex(r, 0) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def roof_insulation(self, roof_insulation):\n\n self._roof_insulation = roof_insulation",
"def occupation_code(self, occupation_code):\n\n self._occupation_code = occupation_code",
"def occupation_code(self, occupation_code):\n\n self._occupation_code = occupation_code",
"def study_code(... | [
"0.5550748",
"0.5465898",
"0.5465898",
"0.53447825",
"0.5243531",
"0.512811",
"0.512811",
"0.5075628",
"0.5047284",
"0.50365186",
"0.499787",
"0.49265862",
"0.48442093",
"0.4812334",
"0.48091078",
"0.47898212",
"0.47898212",
"0.4789178",
"0.47598323",
"0.47588435",
"0.4753784... | 0.42576623 | 72 |
Return ohm as a reactance. This will not change the insulation_code of self._ohms. | def x(self) -> float:
return self._ohms.imag | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def Om(self):\n return self._Om",
"def h_o(self):\n return self._h_o",
"def candle(self):\n return self._decorator_wrapper(EventName.candle)",
"def calc_impedance(self) -> (Ohm, None):\n power: ComType = complex(0)\n power_unit: str = ''\n amp: NumType = 0\n a... | [
"0.5490361",
"0.5456703",
"0.53395575",
"0.5336062",
"0.5302987",
"0.52687865",
"0.52315074",
"0.5160247",
"0.51602364",
"0.51602364",
"0.50709",
"0.50288886",
"0.5015687",
"0.50016296",
"0.49258858",
"0.49081108",
"0.49023128",
"0.48966557",
"0.4891811",
"0.4873488",
"0.4873... | 0.0 | -1 |
Set ohm as a reactance. If passed as a complex insulation_code no checking or manipulation of the insulation_code is completed. The existing insulation_code of self._ohms is overwritten. | def x(self, x: ComType):
if isinstance(x, complex):
self._ohms = x
else:
self._ohms = complex(0, x) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def code(self, code):\n\n self._code = code",
"def memo_code(self, memo_code):\n\n self._memo_code = memo_code",
"def set_code(self, code):\n self.set_payload(code)",
"def roof_insulation(self, roof_insulation):\n\n self._roof_insulation = roof_insulation",
"def code(self, code)... | [
"0.49665365",
"0.49065626",
"0.48271862",
"0.4815256",
"0.48065296",
"0.4793647",
"0.47817233",
"0.47817233",
"0.47809148",
"0.47809148",
"0.47222644",
"0.46523058",
"0.46509385",
"0.4619818",
"0.46148682",
"0.46065703",
"0.46027088",
"0.4600057",
"0.45986825",
"0.45986825",
... | 0.0 | -1 |
Return ohm as an impedance. This is returned as the absolute insulation_code for the This will not change the insulation_code of self._ohms | def z(self) -> NumType:
return abs(self._ohms) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def calc_impedance(self) -> (Ohm, None):\n power: ComType = complex(0)\n power_unit: str = ''\n amp: NumType = 0\n amp_unit: str = ''\n volt: NumType = 0\n volt_unit: str = ''\n\n if self._volt_exists and self._volt_exists:\n if hasattr(self._obj1, 'volts... | [
"0.6479323",
"0.54064494",
"0.5367667",
"0.5330968",
"0.53086656",
"0.52193964",
"0.51685053",
"0.5047589",
"0.49772018",
"0.49740693",
"0.496601",
"0.49538025",
"0.49090466",
"0.490588",
"0.4899409",
"0.4898324",
"0.4881354",
"0.48751566",
"0.48690826",
"0.485226",
"0.483707... | 0.4934608 | 12 |
Set ohm as an impedance. If passed as a complex insulation_code no checking or manipulation of the insulation_code is completed. The existing insulation_code of self._ohms is overwritten. | def z(self, z: ComType):
self._ohms = z | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_impedance(self, coord, c_axis, M, K, B, **kwargs):\r\n return self._arm.set_impedance(coord, c_axis, M, K, B, **kwargs)",
"def set_impedance_config(self, coord, c_axis):\r\n return self._arm.set_impedance_config(coord, c_axis)",
"def _initialize_dipole_model(self, model):\n for key... | [
"0.521271",
"0.50573397",
"0.48296985",
"0.48296985",
"0.47990018",
"0.4792651",
"0.47072685",
"0.45067558",
"0.4503179",
"0.44958884",
"0.4486635",
"0.44429332",
"0.43902498",
"0.42726007",
"0.42666242",
"0.4263231",
"0.4245052",
"0.4245052",
"0.42232153",
"0.4209167",
"0.41... | 0.40889707 | 31 |
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."... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"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... | [
"0.8250026",
"0.7914886",
"0.785498",
"0.7705226",
"0.7285699",
"0.7202161",
"0.7138414",
"0.7040537",
"0.70316243",
"0.7004599",
"0.6935744",
"0.6896497",
"0.6888758",
"0.6868086",
"0.6868002",
"0.6853717",
"0.68070215",
"0.6806516",
"0.68060136",
"0.6790358",
"0.67831635",
... | 0.90089023 | 0 |
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."... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"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... | [
"0.7868433",
"0.73533434",
"0.73213",
"0.7271727",
"0.7052522",
"0.6915829",
"0.66105074",
"0.65981007",
"0.65697485",
"0.64671576",
"0.64670223",
"0.6457807",
"0.6430139",
"0.6407553",
"0.64031404",
"0.63710004",
"0.6362891",
"0.6256372",
"0.62556434",
"0.62384874",
"0.62046... | 0.8721685 | 0 |
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... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def product(self, x, y):\n return self( x.lift() * y.lift() )",
"def __mul__(self, other):\r\n return self.prod(other)",
"def mul_power(a,b):\r\n if (base(a)==base(b)):\r\n return make_power(base(a), power(a)+power(b))\r\n else:\r\n return calc_power(a)*calc_power(b)",
"... | [
"0.77632946",
"0.7752715",
"0.7435338",
"0.7435006",
"0.72454077",
"0.71805924",
"0.7164024",
"0.71510655",
"0.7143583",
"0.71129245",
"0.7090096",
"0.7073022",
"0.7042423",
"0.7029677",
"0.7001191",
"0.6972775",
"0.6965795",
"0.695625",
"0.6954136",
"0.6921609",
"0.68991876"... | 0.8015777 | 0 |
Divide two Power() objects together, returning the factor of the two objects. | def __truediv__(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... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def div_power(a,b):\r\n if (base(a)==base(b)):\r\n return make_power(base(a), power(a)-power(b))\r\n else:\r\n return calc_power(a)*calc_power(b)",
"def __div__(self, other):\n return self.__mul__(1 / other)",
"def __div__(self, other):\n return self.__mul__(1 / other)",
"de... | [
"0.714519",
"0.6841237",
"0.6841237",
"0.6712638",
"0.6663034",
"0.6507961",
"0.65037924",
"0.63618296",
"0.6315198",
"0.63125306",
"0.62301177",
"0.62301177",
"0.6211386",
"0.62090075",
"0.62018317",
"0.6180256",
"0.6156989",
"0.6121296",
"0.6091068",
"0.6076972",
"0.6066982... | 0.62140787 | 12 |
Return ohm as a resistance. This will not change the insulation_code of self._ohms. | def p(self) -> float:
return self._pwr.real | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def r(self) -> float:\n return self._ohms.real",
"def getResistence(self):\n return self.resistence",
"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')... | [
"0.59479755",
"0.58266187",
"0.57562566",
"0.5551067",
"0.5433529",
"0.54110503",
"0.53828955",
"0.53684855",
"0.53294766",
"0.53273535",
"0.5281292",
"0.5249423",
"0.522684",
"0.522684",
"0.5214339",
"0.5183197",
"0.51697826",
"0.5128865",
"0.51069456",
"0.5096244",
"0.50962... | 0.0 | -1 |
Set power as watts. If passed as a complex insulation_code no checking or manipulation of the insulation_code is completed. It is up to the user to ensure that it is the correct form. The existing insulation_code of self._pwr is overwritten. | def p(self, p: ComType):
if isinstance(p, complex):
self._pwr = p
else:
self._pwr = complex(p, 0) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_power(self, value):\n self.write(\":POW {}W\".format(value))",
"def set_power(self, power):\n print('Setting santec power to %.4f mW' % power)\n self.santec1.write(\"LP %.2f\" % power)\n self.santec2.write(\"LP %.2f\" % power)\n self.santec3.write(\"LP %.2f\" % power)\n... | [
"0.6473608",
"0.64525354",
"0.61656296",
"0.6101316",
"0.6081148",
"0.6071569",
"0.6064473",
"0.60636723",
"0.5980903",
"0.59721273",
"0.5935948",
"0.59223527",
"0.59223527",
"0.591151",
"0.5815684",
"0.58002955",
"0.5733656",
"0.5700533",
"0.5694013",
"0.5651511",
"0.5630081... | 0.5178296 | 52 |
Return power as voltamp reactive. This will not change the insulation_code of self._pwr. | def q(self) -> float:
return self._pwr.imag | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def power(self):\n return self._power",
"def get_power(self):\r\n return self.p",
"def power(self) -> pulumi.Output[str]:\n return pulumi.get(self, \"power\")",
"def power(self) -> interface.Power:\n return cast(interface.Power, self._interfaces[interface.Power])",
"def get_powe... | [
"0.70718205",
"0.7023571",
"0.6835954",
"0.67020386",
"0.6615375",
"0.6557565",
"0.65471524",
"0.6512947",
"0.6480712",
"0.6456152",
"0.64413744",
"0.63989353",
"0.6391165",
"0.63881713",
"0.63881713",
"0.63881713",
"0.63881713",
"0.635474",
"0.63509804",
"0.62983584",
"0.629... | 0.0 | -1 |
Set ohm as voltamp reactive. If passed as a complex insulation_code no checking or manipulation of the insulation_code is completed. The existing insulation_code of self._pwr is overwritten. | def q(self, q: ComType):
if isinstance(q, complex):
self._pwr = q
else:
self._pwr = complex(0, q) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_volt(self,volt):\n self.spi_disable()\n self.spi_enable()\n data1=volt*256//self.vref\n if data1>255:\n data1=255\n if data1<0:\n data1=0\n data1=int(data1)\n temp0=AD5601_mode[\"normal\"]|((data1>>2)&0x00ff)\n temp1=(data1<<6)&0... | [
"0.6065958",
"0.5603328",
"0.53074527",
"0.5278955",
"0.5263732",
"0.5250442",
"0.5248906",
"0.5201049",
"0.517839",
"0.51621544",
"0.51264507",
"0.5087467",
"0.5080409",
"0.5075387",
"0.5018166",
"0.50092745",
"0.5005212",
"0.5000793",
"0.497514",
"0.49724594",
"0.49502948",... | 0.0 | -1 |
Return ohm as an impedance. This is returned as the absolute insulation_code for the This will not change the insulation_code of self._ohms | def s(self) -> NumType:
return abs(self._pwr) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def calc_impedance(self) -> (Ohm, None):\n power: ComType = complex(0)\n power_unit: str = ''\n amp: NumType = 0\n amp_unit: str = ''\n volt: NumType = 0\n volt_unit: str = ''\n\n if self._volt_exists and self._volt_exists:\n if hasattr(self._obj1, 'volts... | [
"0.64812356",
"0.54077005",
"0.5368085",
"0.5331127",
"0.53075564",
"0.52206373",
"0.5167214",
"0.5048432",
"0.49753687",
"0.4973499",
"0.4965105",
"0.49537203",
"0.49353448",
"0.49072888",
"0.49066025",
"0.48983705",
"0.48978457",
"0.48800385",
"0.48750883",
"0.4869345",
"0.... | 0.0 | -1 |
Set power as voltamps. If passed as a complex insulation_code no checking or manipulation of the insulation_code is completed. The existing insulation_code of self._pwr is overwritten. | def s(self, s: ComType):
self._pwr = s | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _set_power(self, power: any) -> None:\n\n self.set_power(power, inplace=True)",
"def power(self, power):\n\n self._power = power",
"def set_power(self, power):\n print('Setting santec power to %.4f mW' % power)\n self.santec1.write(\"LP %.2f\" % power)\n self.santec2.writ... | [
"0.65914994",
"0.6574793",
"0.6470942",
"0.6395696",
"0.62007743",
"0.6124583",
"0.6028662",
"0.601447",
"0.5973712",
"0.59683955",
"0.593369",
"0.59214747",
"0.59113675",
"0.58994764",
"0.5897193",
"0.5896937",
"0.5862699",
"0.5854751",
"0.58353245",
"0.58289486",
"0.5799254... | 0.63877517 | 4 |
Determine the objects run_type and set the flag that it has been passed. If two objects of the same run_type are passed then the second object will reset the flag to false. | def determine_obj(self, obj):
if type(obj) is Ohm:
self._ohm_exists = self._ohm_exists ^ True
if type(obj) is Amp:
self._amp_exists = self._amp_exists ^ True
if type(obj) is Volt:
self._volt_exists = self._volt_exists ^ True
if type(obj) is Power:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _is_run_type(cls, object_):\n # Do a string comparison instead of using isinstance() to avoid needing\n # to import lyse or other modules with these classes.\n return (type(object_).__name__ in cls._RUN_TYPES)",
"def _is_repeatedshot_type(cls, object_):\n return (type(object_).__n... | [
"0.6838493",
"0.5585665",
"0.54425156",
"0.5163061",
"0.5096585",
"0.5082471",
"0.5039381",
"0.5033097",
"0.5010368",
"0.49963182",
"0.49575686",
"0.49471962",
"0.4944512",
"0.49303716",
"0.49303716",
"0.49303716",
"0.49303716",
"0.49303716",
"0.49086815",
"0.49004683",
"0.48... | 0.47087651 | 36 |
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... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __eq__(self, other):\n return np.array_equal(\n self.np_floats(),\n other.np_floats()) and np.array_equal(\n self.np_ints(),\n other.np_ints()) and np.array_equal(\n self.freqs,\n other.freqs)",
"def __gt__(self, other):\n if not... | [
"0.6924577",
"0.6023659",
"0.60017574",
"0.5967577",
"0.5945457",
"0.5889283",
"0.58852327",
"0.5857143",
"0.5848025",
"0.5846018",
"0.58393663",
"0.5835524",
"0.58251196",
"0.58249813",
"0.58152753",
"0.5802302",
"0.57974994",
"0.57899815",
"0.5783015",
"0.57757765",
"0.5775... | 0.8551229 | 0 |
Calculate power 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_power(self) -> (Power, None):
amp: NumType = 0
amp_unit: str = ''
volt: NumType = 0
volt_unit: str = ''
ohm: ComType = complex(0)
ohm_unit: str = ''
if self._amp_exists and self._volt_exists:
if hasattr(self._obj1, 'amps'):
am... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __pow__(self, other, **kwargs):\n kwargs.update({'operator': 'pow'})\n return self.__add__(other, **kwargs)",
"def __pow__(self, other):\n return self._multiplicative_func(float.__pow__, self, other)",
"def __pow__(self,*args):\r\n pass",
"def __rpow__(self, other):\n\n retur... | [
"0.68820286",
"0.66776603",
"0.6637485",
"0.66045684",
"0.6561825",
"0.6500608",
"0.6492092",
"0.6458051",
"0.6452986",
"0.6445454",
"0.64403147",
"0.64314604",
"0.64074576",
"0.63995004",
"0.63929826",
"0.6365527",
"0.6362704",
"0.6355717",
"0.630971",
"0.6299121",
"0.624434... | 0.63685447 | 15 |
Calculate current 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_current(self) -> (Amp, None):
power: ComType = complex(0)
power_unit: str = ''
volt: NumType = 0
volt_unit: str = ''
ohm: ComType = complex(0)
ohm_unit: str = ''
if self._volt_exists and self._power_exists:
if hasattr(self._obj1, 'power'):
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def calculate(self):\n if all( map( lambda x: isinstance(x, N),self.args) ):\n return self.evaluate()\n else:\n return self.__class__( map(operator.methodcaller('calculate'), self.args))\n #return self.__class__( (self.args[0].calculate(), self.args[1].calculate()) )"... | [
"0.6004684",
"0.59083873",
"0.58126235",
"0.57930243",
"0.57697535",
"0.57697535",
"0.57482684",
"0.5720861",
"0.5720861",
"0.5706407",
"0.5688089",
"0.5688089",
"0.5688089",
"0.56601536",
"0.5650581",
"0.5647912",
"0.5619391",
"0.5606603",
"0.56052214",
"0.5591284",
"0.55820... | 0.5853165 | 2 |
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'):
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def inductive_voltdiv(Vin=None, Vout=None, L1=None, L2=None, find=''):\n if Vin is not None and L1 is not None and L2 is not None:\n Vout = (Vin * L1) / (L1 + L2)\n elif Vout is not None and L1 is not None and L2 is not None:\n Vin = (Vout) * (L1 + L2) / (L1)\n elif Vin is not None and Vout ... | [
"0.6214673",
"0.614571",
"0.6009014",
"0.5904963",
"0.5863507",
"0.5747999",
"0.5747329",
"0.56916034",
"0.567709",
"0.5654466",
"0.55869013",
"0.5584726",
"0.55484796",
"0.5530032",
"0.5502495",
"0.5500371",
"0.54994154",
"0.5498538",
"0.5459045",
"0.54423773",
"0.543532",
... | 0.675314 | 0 |
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'):
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def di(o1, o2):\n return o1/o2",
"def calc(operand_1, operand_2):\n try:\n return operand_1/operand_2\n except ZeroDivisionError:\n return 0",
"def calc(operand_1, operand_2):\n return operand_1/operand_2",
"def calc(operand_1, operand_2):\n return operand... | [
"0.601999",
"0.5506426",
"0.541305",
"0.541305",
"0.541305",
"0.5373895",
"0.53608656",
"0.5356382",
"0.53304803",
"0.52975565",
"0.5249021",
"0.52109116",
"0.5167401",
"0.513542",
"0.50895154",
"0.50706196",
"0.50706196",
"0.5034539",
"0.4954093",
"0.49457806",
"0.49324915",... | 0.6352273 | 0 |
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') | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def date_in_future(date) -> bool:\n is_in_the_future = time_after(date)\n return is_in_the_future",
"def valid(t):\n return float(t) > time.time()",
"def isPast(self):\n return (self._t < time())",
"def is_in_the_future(dt):\n if dt > datetime.now(pytz.utc):\n return True\n retur... | [
"0.742416",
"0.7342394",
"0.72829944",
"0.7265453",
"0.7176794",
"0.7147083",
"0.7041912",
"0.70314723",
"0.6834246",
"0.67728204",
"0.6656451",
"0.66316754",
"0.6564517",
"0.65577716",
"0.65541255",
"0.65340716",
"0.65168554",
"0.64972854",
"0.64915395",
"0.6470125",
"0.6452... | 0.7358469 | 1 |
check for validations in end time by adding min interview duration ie, end time should be a time grater than now() + min duration | def val_future_end_time(value):
today = timezone.now() + timezone.timedelta(minutes=settings.MIN_INTERVIEW_DURATION)
if value < today:
raise ValidationError(f'Datetime should be atleast {settings.MIN_INTERVIEW_DURATION} min after current Date and time') | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def check_time(self,data,data_orginal):\n if data['start_time'] > data['end_time']:\n raise ValidationError('event end time should be greater than start time.')",
"def validateTiming(obj):\n if obj.start_time:\n if obj.end_time:\n return obj.start_time <= timezone.now() and... | [
"0.7216719",
"0.71129835",
"0.68031824",
"0.6738553",
"0.658789",
"0.6553472",
"0.65149224",
"0.64622396",
"0.6392901",
"0.63849175",
"0.635124",
"0.6345768",
"0.6327704",
"0.63002944",
"0.62925655",
"0.6243793",
"0.62406015",
"0.6225465",
"0.6208335",
"0.61959475",
"0.613009... | 0.6642827 | 4 |
''' 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 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"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 _step1c(self, word):\n\n def nltk_condition(stem):\n \"\"\"\n This has been modified from the original Porter algorithm so\n that y->i is o... | [
"0.7266689",
"0.66175455",
"0.63900864",
"0.61191475",
"0.6068698",
"0.60429436",
"0.5993422",
"0.5989975",
"0.5857056",
"0.5811782",
"0.5710952",
"0.57005095",
"0.56973",
"0.56643087",
"0.5558673",
"0.5556823",
"0.55546314",
"0.5542172",
"0.54957694",
"0.54321015",
"0.540186... | 0.80976295 | 0 |
convert points to wavelength in Angstroms via the wavelength solution | def __call__ (self, pts, coeff, function_type='no solution', default_function=True):
ft = function_type
if ft == 'no solution': coeff = [0,1]
pts,coeff,no_solution = self._check_pts_coeff(pts,coeff)
if no_solution: ft = 'no solution'
if ft not in... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def wavelength(energy):\r\n return 2 * np.pi * PLANCK_CONSTANT * SPEED_OF_LIGHT / energy",
"def RiekeLebofsky85(self, wavelength, AKs):\n # If input entry is a single float, turn it into an array\n try:\n len(wavelength)\n except:\n wavelength = [wavelength]\n\n ... | [
"0.6436268",
"0.63244337",
"0.6278681",
"0.62263495",
"0.61686045",
"0.61374885",
"0.611931",
"0.61087716",
"0.6107274",
"0.6071565",
"0.6067975",
"0.6023039",
"0.6003177",
"0.59802645",
"0.59774506",
"0.5959031",
"0.5935209",
"0.5928618",
"0.5907282",
"0.58745164",
"0.586998... | 0.0 | -1 |
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) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"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, coeff in enumerate(coeffs[::-1]):\n char_eq_r += coeff * r ** order\n\n char_eq = Poly(char_eq_... | [
"0.5734576",
"0.56887656",
"0.5681322",
"0.5651976",
"0.56423664",
"0.5576589",
"0.5528677",
"0.5461771",
"0.5373789",
"0.5370976",
"0.5368531",
"0.5363878",
"0.5342567",
"0.5324895",
"0.5313149",
"0.52953506",
"0.5280881",
"0.5260313",
"0.5219243",
"0.52093476",
"0.5208789",... | 0.57912767 | 0 |
convert points to wavelength in Angstroms via the wavelength solution | def pts_2_phys_pixels (pts,bzero=1,bscale=1):
if bzero != 0 or bscale !=1:
print "Whoops, I don't know exactly what to do with bzero!=1 or bscale!=0 :<",bzero,"><",bscale,">"
#pts +=1
pts = bzero + pts*bscale
# should return [1,2,3,......,#pts]
return pts | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def wavelength(energy):\r\n return 2 * np.pi * PLANCK_CONSTANT * SPEED_OF_LIGHT / energy",
"def RiekeLebofsky85(self, wavelength, AKs):\n # If input entry is a single float, turn it into an array\n try:\n len(wavelength)\n except:\n wavelength = [wavelength]\n\n ... | [
"0.6437194",
"0.6324778",
"0.62796795",
"0.62286484",
"0.61690587",
"0.61388284",
"0.6119995",
"0.610914",
"0.6107622",
"0.60730773",
"0.6069142",
"0.6023352",
"0.60046446",
"0.59807193",
"0.59781045",
"0.5960589",
"0.59370005",
"0.5929418",
"0.59082925",
"0.58751845",
"0.587... | 0.0 | -1 |
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)
#========================... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def header(fpath):\n # If you want to change something, instead of overwriting a bug, add a new\n # key with the desired functionallity. This way, prior code doesn't break.\n # One can be very waste full with this function as it is fast anyways.\n\n\n ret = {}\n with open(fpath) as f:\n for l... | [
"0.6472098",
"0.57686627",
"0.57133174",
"0.55999637",
"0.55356216",
"0.5518358",
"0.5444714",
"0.5396722",
"0.5379888",
"0.5344746",
"0.5342612",
"0.534053",
"0.52858293",
"0.5228",
"0.5175586",
"0.5174878",
"0.51518154",
"0.514766",
"0.5131736",
"0.51092917",
"0.51056576",
... | 0.6787802 | 0 |
Read data from a fits or text file and compute the wavelength | def readin (filename, hdu=0, non_std_fits=False,
text_comments='#', text_skiprows=0, get_data=False, verbose=False,
apply_WCS_rv=False):
multi_order_txt = False
use_naxis2='all'
use_naxis3='all'
preferred_wlsoln=None # !! need to fix this
# !! should also be able t... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def wavelength_solution(file_name):\n file_data = read_file(file_name)\n header_data = file_data[0]\n image_data = file_data[1]\n\n range_begin = header_data['CRVAL3']\n pixel_begin = header_data['CRPIX3']\n step_size = header_data['CD3_3']\n steps = len(image_data)\n range_end ... | [
"0.6974682",
"0.64668596",
"0.64668596",
"0.63661563",
"0.6306739",
"0.62846875",
"0.62405396",
"0.6221032",
"0.61585015",
"0.61180687",
"0.60809207",
"0.60528594",
"0.6052588",
"0.6048658",
"0.6037574",
"0.60191053",
"0.60132486",
"0.60083425",
"0.60047394",
"0.59943837",
"0... | 0.58025056 | 38 |
Detects the MSDos symbolic link format from OSX. Format of XSym files taken from section 11.7.3 of Mac OSX Internals | def match(self, buf):
X = 0x58
S = 0x53
Y = 0x79
M = 0x6d
NEWLINE = 0xa
ZERO = 0x30
NINE = 0x39
return len(buf) >= 10 and \
buf[0] == X and \
buf[1] == S and \
buf[2] == Y and \
buf[3] == M and \
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def IsSymlink(info):\n return (info.external_attr >> 16) == 0120777",
"def is_zipinfo_symlink(zip_info):\n return zip_info.external_attr == ZIP_SOFTLINK_ATTRIBUTE_MAGIC",
"def is_symlink(self):\n return self._security_class == \"lnk_file\"",
"def on_mac():\n if \"Darwin\" in platform.system():\... | [
"0.63663405",
"0.57072985",
"0.5519755",
"0.5394745",
"0.5375467",
"0.5374572",
"0.5372186",
"0.5294984",
"0.5277566",
"0.52450746",
"0.52063376",
"0.5189325",
"0.5159125",
"0.5132479",
"0.51143616",
"0.50663024",
"0.5059565",
"0.5050672",
"0.5043874",
"0.50376576",
"0.502835... | 0.0 | -1 |
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 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"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 find_parent(self):\n parent = self._parent\n if parent:\n return parent\n ... | [
"0.78836995",
"0.77781475",
"0.76843834",
"0.7628968",
"0.75214714",
"0.75041956",
"0.74604297",
"0.7354661",
"0.734197",
"0.72440976",
"0.7241017",
"0.7235812",
"0.72275674",
"0.72217995",
"0.72217995",
"0.72217995",
"0.7179848",
"0.7179848",
"0.71753633",
"0.71729606",
"0.7... | 0.81464714 | 0 |
Returns true if a path exists. This includes symlinks even if they are broken. | def exists(self):
return self.islink() or exists(self._path) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def exists(path: str) -> bool:\n pass",
"def path_exists(path):\n return os.path.exists(path)",
"def path_exists(path):\r\n return os.path.exists(path)",
"def path_exists(path):\n if path.startswith('http://') or path.startswith('https://'):\n return True\n\n return isfile(path)",
"def ... | [
"0.8244713",
"0.81465024",
"0.8124195",
"0.8074858",
"0.80171007",
"0.79148716",
"0.78736645",
"0.77577764",
"0.7752121",
"0.7711969",
"0.7706455",
"0.76939666",
"0.7680408",
"0.76372343",
"0.76295453",
"0.74820125",
"0.7481533",
"0.7450876",
"0.7442663",
"0.7422155",
"0.7406... | 0.7640132 | 13 |
Returns the link destination if the Path is a symlink. If the path doesn't exist, raises FileNotFoundError If the path is not a symlink raises OSError Errno InvalidArgument. | def readlink(self, frame=None):
return Path(readlink(self._path), frame) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def symlink(self, src, dst):\n return os.symlink(src, dst)",
"def symlink_p(src, dst):\n try:\n os.symlink(src, dst)\n except OSError as exc: # Python >2.5\n if exc.errno == errno.EEXIST and os.path.islink(dst):\n if os.path.realpath(dst) == os.path.realpath(src):\n ... | [
"0.65930396",
"0.6582099",
"0.62946653",
"0.62402695",
"0.6225369",
"0.61793005",
"0.6155473",
"0.6114894",
"0.6114894",
"0.61143047",
"0.60889924",
"0.6047171",
"0.6045046",
"0.60425717",
"0.60250163",
"0.6003149",
"0.593889",
"0.5922449",
"0.58469564",
"0.5826563",
"0.57797... | 0.5467206 | 35 |
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) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def lnh(src, dst):\n os.link(src, dst)",
"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:\n os.link(abs_src, abs_dst)\n except OSError as e:\n if e.errno == errno.... | [
"0.6689718",
"0.652778",
"0.6506502",
"0.6506502",
"0.62713677",
"0.6266134",
"0.6220446",
"0.6215565",
"0.59210443",
"0.5917583",
"0.58603233",
"0.5844886",
"0.57999426",
"0.5775267",
"0.5713437",
"0.5691181",
"0.56734186",
"0.566668",
"0.5611633",
"0.55994177",
"0.5585695",... | 0.66363525 | 1 |
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... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def send_file(self, src: PathLike, dest: PathLike, force: bool = False):",
"def handle_file(self, source_path, dest_path):\n raise NotImplemented",
"def copyfileobj(fsrc, fdst, length=0):\r\n # Localize variable access to minimize overhead.\r\n if not length:\r\n length = COPY_BUFSIZE\r\n ... | [
"0.5596338",
"0.5459085",
"0.5378296",
"0.52936655",
"0.52718097",
"0.520541",
"0.5150503",
"0.5127887",
"0.5090162",
"0.5075606",
"0.5064022",
"0.50478476",
"0.500685",
"0.5000948",
"0.49774417",
"0.4976913",
"0.49672064",
"0.4959817",
"0.4932902",
"0.49120706",
"0.49093175"... | 0.66701883 | 0 |
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... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def copy(self):\n source = os.path.abspath(self.path)\n destination = os.path.abspath(self.target)\n\n logger.info(\"Running Copy Method - SOURCE=\\\"{src}\\\" DESTINATION=\\\"{dst}\\\" IGNORE=\\\"{ignore}\\\"\".format(src=source, dst=destination, ignore=self.ignore))\n\n if not os.path... | [
"0.6731077",
"0.6349671",
"0.61228085",
"0.6079704",
"0.60696405",
"0.6063155",
"0.6027516",
"0.6027516",
"0.59982765",
"0.5988888",
"0.5988461",
"0.59474134",
"0.5924743",
"0.5887651",
"0.58503205",
"0.5818022",
"0.5792588",
"0.5786693",
"0.57735986",
"0.5770276",
"0.5768486... | 0.6634319 | 1 |
If self path is a file or a symlink to a file, compute a checksum returned as a string. If self points to a missing file or a broken symlink, raises FileDoesNotExist. If self points to a directory or a symlink facing directory, raises IsADirectory. | def checksum(self):
hasher = md5()
with self.open('rb') as fd:
buf = fd.read(_BLOCKSIZE)
while len(buf) > 0:
# TODO Could cancel work here.
hasher.update(buf)
buf = fd.read(_BLOCKSIZE)
digest = safetype(hasher.hexdigest(... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def compute(self):\n self.checksum = self.get_files_hashes_in_path()\n self.real_checksum = self.checksum\n # This appends the filename when checksum was made for a single file.\n # We need to get this when testing the consistency on the moment of\n # restore.\n if self.co... | [
"0.64593005",
"0.6084884",
"0.6045312",
"0.6018715",
"0.59634477",
"0.59411263",
"0.57679176",
"0.5734175",
"0.5731633",
"0.57221824",
"0.57199764",
"0.56928045",
"0.5673481",
"0.5638186",
"0.5609924",
"0.5606032",
"0.5585271",
"0.55693316",
"0.556377",
"0.554221",
"0.554221"... | 0.5889712 | 6 |
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) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def build_path(path: Union[Path, str], path_is_absolute: bool = False) -> Path:\n if not path_is_absolute:\n return Path(os.getcwd()) / path\n if isinstance(path, str):\n return Path(path)\n return path",
"def makePath(path):\n\n compatPath = os.path.abspath(os.path.expanduser(path))\n\... | [
"0.7044446",
"0.6547335",
"0.64296883",
"0.6427195",
"0.6424488",
"0.6364664",
"0.62077975",
"0.61788577",
"0.6155652",
"0.60604566",
"0.6044922",
"0.6038902",
"0.60300344",
"0.6017157",
"0.59847945",
"0.5975106",
"0.593022",
"0.5901871",
"0.5887952",
"0.5885305",
"0.5880734"... | 0.67894834 | 1 |
Creates/Deletes directories. Does whatever is required inorder to make and open a file with the mode previded. | def ensure_file(path, mode):
assert isinstance(path, Path)
parent = path.parent()
assert parent != path, "Path and parent were the same!"
ensure_dir(parent)
fd = path.open(mode)
return fd | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _make_dirs(filepath, mode):\n parent = filepath.parent\n if \"w\" in mode and parent:\n os.makedirs(parent, exist_ok=True)",
"def mkdir(path):",
"def open_and_force_mkdir(path, mode):\n force_mkdir(os.path.dirname(path))\n return open(path, mode)",
"def make_dir(self):\n if not ... | [
"0.7517197",
"0.7166716",
"0.6981881",
"0.69315344",
"0.6812086",
"0.6761786",
"0.6758168",
"0.67568886",
"0.66973007",
"0.65990794",
"0.6596493",
"0.6568651",
"0.65532947",
"0.6511464",
"0.6510864",
"0.6509277",
"0.6497581",
"0.6421402",
"0.64167607",
"0.64009345",
"0.639520... | 0.0 | -1 |
Gets a list of the names of all objects in the collection. | def get_names(self):
# log.debug(str(inspect.stack()[1][3]) + " --> OC.get_names()")
return [x.options['name'] for x in self.get_list()] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def names(self):\n return [da.name for da in self]",
"def names(self):\n return [x for x in self._dict.keys()]",
"def getNames(self) -> List[unicode]:\n ...",
"def names(cls):\n return cls.__by_name.keys()",
"def namelist(self):\n return self._handle.getnames()",
"def n... | [
"0.76098615",
"0.75376326",
"0.7453754",
"0.74532604",
"0.7432721",
"0.7432721",
"0.7416252",
"0.74136025",
"0.7391571",
"0.73824096",
"0.73824096",
"0.7356692",
"0.7319719",
"0.7314792",
"0.73121476",
"0.73121476",
"0.73121476",
"0.72804576",
"0.72739893",
"0.7229875",
"0.72... | 0.7320957 | 12 |
Finds coordinates bounding all objects in the collection. | def get_bounds(self):
log.debug(str(inspect.stack()[1][3]) + "--> OC.get_bounds()")
# TODO: Move the operation out of here.
xmin = Inf
ymin = Inf
xmax = -Inf
ymax = -Inf
# for obj in self.object_list:
for obj in self.get_list():
try:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def find_coordinates(self):\n\n raise NotImplementedError",
"def find_coordinates(self):\n\n raise NotImplementedError",
"def get_boundingbox(self):\n tile_iterator = iter(self)\n (coordinate,tile) = next(tile_iterator)\n assert(tile is not None)\n min_x = coordinate[0... | [
"0.67995274",
"0.67995274",
"0.6568047",
"0.6534726",
"0.645438",
"0.644649",
"0.6344728",
"0.6310343",
"0.62876004",
"0.62675834",
"0.6263535",
"0.6259724",
"0.61993617",
"0.61760396",
"0.61079615",
"0.6083858",
"0.60833603",
"0.6065376",
"0.60647273",
"0.6059303",
"0.603031... | 0.66039854 | 2 |
Fetches the FlatCAMObj with the given `name`. | def get_by_name(self, name, isCaseSensitive=None):
# log.debug(str(inspect.stack()[1][3]) + "--> OC.get_by_name()")
if isCaseSensitive is None or isCaseSensitive is True:
for obj in self.get_list():
if obj.options['name'] == name:
return obj
else:... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def retrieve_object(self, name: str):\n file_path = self.__get_file_path(name)\n return self.__deserialize_object(file_path)",
"def get_obj_by_name(name: str) -> Any:\r\n module, obj_name = Onrolux.get_module_from_obj_name(name)\r\n return get_obj_from_module(module, obj_name)",
"de... | [
"0.6502752",
"0.6092551",
"0.6045815",
"0.5987685",
"0.5981627",
"0.5854717",
"0.5747515",
"0.5671835",
"0.5612608",
"0.55967665",
"0.55967665",
"0.55964154",
"0.5593998",
"0.558821",
"0.5565817",
"0.55546904",
"0.55235106",
"0.54735124",
"0.54470277",
"0.54425544",
"0.543576... | 0.48682088 | 74 |
Returns the active object or None | def get_active(self):
selections = self.view.selectedIndexes()
if len(selections) == 0:
return None
return selections[0].internalPointer().obj | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __current_object__(self):\n return self.__lookup()",
"def get_object(self):\n if getattr(self, 'current_instance', None):\n ret = self.current_instance\n else:\n ret = super().get_object()\n return ret",
"def _get_current_object(self):\n if not hasat... | [
"0.78382856",
"0.7515453",
"0.73561925",
"0.73561925",
"0.71875876",
"0.71875876",
"0.71875876",
"0.71875876",
"0.6992276",
"0.69564193",
"0.6832129",
"0.6806755",
"0.678758",
"0.6778756",
"0.66317946",
"0.6539115",
"0.6519013",
"0.6471338",
"0.6471338",
"0.6471338",
"0.64380... | 0.6841011 | 10 |
Returns list of objects selected in the view. | def get_selected(self):
return [sel.internalPointer().obj for sel in self.view.selectedIndexes()] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def list_selected_objects(remote):\n cmd1 = mmapi.StoredCommands()\n key1 = cmd1.AppendSceneCommand_ListSelectedObjects()\n remote.runCommand(cmd1)\n objects = mmapi.vectori()\n cmd1.GetSceneCommandResult_ListObjects(key1, objects)\n return vectori_to_list(objects)",
"def get_selected_objects (... | [
"0.7132821",
"0.7130354",
"0.69558793",
"0.6842191",
"0.6727035",
"0.6513116",
"0.6473067",
"0.6447992",
"0.6409065",
"0.63738596",
"0.63438207",
"0.6335116",
"0.63065183",
"0.63029337",
"0.6302812",
"0.62765443",
"0.6207948",
"0.620427",
"0.6197445",
"0.61648536",
"0.6141752... | 0.7057358 | 2 |
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 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def non_hidden(self):\n return self.filter(hidden=False)",
"def non_hidden(self):\n return self.filter(hidden=False)",
"def get_selected_items(self):\n\n datas = [i.data(NODEROLE) for i in self.view.get_indices()]\n items = [d for d in datas if d is not None] # filter Nones\n\n ... | [
"0.7010305",
"0.7010305",
"0.67899483",
"0.6676391",
"0.6551073",
"0.6375752",
"0.6311826",
"0.61739516",
"0.61335963",
"0.5950215",
"0.59168136",
"0.59028524",
"0.58810467",
"0.5845068",
"0.58445495",
"0.580032",
"0.5723122",
"0.5704929",
"0.5687304",
"0.5663265",
"0.5649339... | 0.8311188 | 0 |
Selects object by name from the project list. This triggers the list_selection_changed event and call on_list_selection_changed. | def set_active(self, name):
try:
obj = self.get_by_name(name)
item = obj.item
group = self.group_items[obj.kind]
group_index = self.index(group.row(), 0, QtCore.QModelIndex())
item_index = self.index(item.row(), 0, group_index)
self.view.... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _mark_selected(self, project):\n previous_project = get_current_project()\n ### Update project stored in selection, with latest Project entity from DB.\n members = self.user_service.get_users_for_project(\"\", project.id)[1]\n project.members = members\n remove_from_session(K... | [
"0.6303431",
"0.61478776",
"0.61286706",
"0.5754567",
"0.56934744",
"0.5687232",
"0.56833863",
"0.5642827",
"0.563996",
"0.55474466",
"0.5539524",
"0.5528102",
"0.5511356",
"0.55110765",
"0.5449952",
"0.5407263",
"0.5402295",
"0.53576946",
"0.53512937",
"0.5348992",
"0.534032... | 0.55262744 | 12 |
Select all objects from the project list. This triggers the list_selection_changed event and call on_list_selection_changed. | def set_all_active(self):
for name in self.get_names():
self.set_active(name) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _menu_select_all(self, uiinfo, selection):\n print selection, uiinfo\n self.model.selected_rows = self.model.data_list[:]\n print \"selection: {}\".format(len(self.model.selected_rows))",
"def selectAll(self):\r\n self.metricListWidget.selectAll()\r\n self.metricListWidget.... | [
"0.67448115",
"0.662345",
"0.652699",
"0.6377508",
"0.6137666",
"0.6125259",
"0.60407907",
"0.6006135",
"0.5983153",
"0.59783614",
"0.57862514",
"0.57693905",
"0.57348704",
"0.57348704",
"0.57072824",
"0.5679948",
"0.5674773",
"0.5651463",
"0.56026226",
"0.5545154",
"0.546153... | 0.0 | -1 |
Make the object with the name in parameters the only selected object | def set_exclusive_active(self, name):
self.set_all_inactive()
self.set_active(name) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def select_object(obj, objects=[]):\n return __SelectObjects(obj, objects)",
"def replace(name, newobject):",
"def create_object(object_name):\n if object_name == 'deathstar':\n return Deathstar()\n elif object_name == 'mercury':\n return Mercury()\n elif object_na... | [
"0.6540533",
"0.5747929",
"0.56790507",
"0.5607696",
"0.55359596",
"0.54986614",
"0.54854745",
"0.5463232",
"0.5445907",
"0.5375768",
"0.5374871",
"0.5353252",
"0.53500295",
"0.53295225",
"0.53262776",
"0.53253204",
"0.52878845",
"0.52878845",
"0.5282116",
"0.52679276",
"0.52... | 0.0 | -1 |
Unselect object by name from the project list. This triggers the list_selection_changed event and call on_list_selection_changed. | def set_inactive(self, name):
# log.debug("ObjectCollection.set_inactive()")
obj = self.get_by_name(name)
item = obj.item
group = self.group_items[obj.kind]
group_index = self.index(group.row(), 0, QtCore.QModelIndex())
item_index = self.index(item.row(), 0, group_index... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _unselectObject(self, _object):\n sheet = self._logic._getSheet()\n sheet.unselect(_object)",
"def Unselect(self):\r\n\r\n if self._current:\r\n self._current.SetHilight(False)\r\n self.RefreshLine(self._current)\r\n\r\n self._current = None\r\n self._... | [
"0.64883524",
"0.6115148",
"0.5971124",
"0.5897896",
"0.5776674",
"0.57758874",
"0.57745844",
"0.569633",
"0.5624028",
"0.5600785",
"0.55798924",
"0.5530619",
"0.5487814",
"0.54315466",
"0.5373637",
"0.5351298",
"0.53312093",
"0.532737",
"0.53273696",
"0.53245056",
"0.5319270... | 0.5302682 | 22 |
Unselect all objects from the project list. This triggers the list_selection_changed event and call on_list_selection_changed. | def set_all_inactive(self):
for name in self.get_names():
self.set_inactive(name) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def deselectall(self):\n if self.selection:\n for node in self.selection[:]: node.deselect()",
"def deselect_all(self):\n if not self.is_multiple:\n raise NotImplementedError(\"You may only deselect all options of a multi-select\")\n\n for opt in self.browser.execute_script(self.... | [
"0.6883209",
"0.6780428",
"0.6627606",
"0.6568482",
"0.6464081",
"0.64568",
"0.6308889",
"0.63048625",
"0.6223516",
"0.61540705",
"0.6024864",
"0.5971983",
"0.5922816",
"0.5898044",
"0.58868825",
"0.58742046",
"0.57672554",
"0.57382894",
"0.573005",
"0.5714498",
"0.56247914",... | 0.0 | -1 |
Doubleclick or Enter on item. | def on_item_activated(self, index):
a_idx = index.internalPointer().obj
if a_idx is None:
return
else:
try:
a_idx.build_ui()
except Exception as e:
self.app.inform.emit('[ERROR] %s: %s' % (_("Cause of error"), str(e)))
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def on_double_click(self, event):\n del event\n index = self.list.curselection()\n item = self.curlistitems[index[0]]\n print(\"double click\")\n if isinstance(item, ListItem):\n print(\"file\")\n self.on_press_enter(None)\n else:\n print(\... | [
"0.75762427",
"0.6965555",
"0.6773084",
"0.672048",
"0.67154014",
"0.66692597",
"0.65313715",
"0.64509124",
"0.6447289",
"0.64371896",
"0.6383323",
"0.63603944",
"0.63266546",
"0.63259083",
"0.62658364",
"0.62137645",
"0.6188279",
"0.6185331",
"0.616114",
"0.6159384",
"0.6148... | 0.0 | -1 |
Will return a list of all objects currently opened. Except FlatCAMScript and FlatCAMDocuments | def get_list(self):
obj_list = []
for group in self.root_item.child_items:
for item in group.child_items:
obj_list.append(item.obj)
return obj_list | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getActiveObjects(doc):\n lst = list()\n op = doc.GetFirstObject()\n while op:\n if op.GetBit(c4d.BIT_ACTIVE) == True: \n lst.append(op)\n op = Helpers.getHNext(op)\n return lst",
"def objects(self):\n\t\treturn self._objects",
"def get_opened... | [
"0.6879972",
"0.6179955",
"0.6178623",
"0.61082375",
"0.60863787",
"0.6077683",
"0.6004119",
"0.5970705",
"0.5947737",
"0.59423727",
"0.5929836",
"0.5899828",
"0.5898676",
"0.5885919",
"0.58089775",
"0.5793471",
"0.57874626",
"0.57864064",
"0.57710904",
"0.5705928",
"0.567294... | 0.0 | -1 |
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():
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _generateMenuItemCheckedState(self, obj, **args):\n result = []\n if not args.get('mode', None):\n args['mode'] = self._mode\n args['stringType'] = 'checkbox'\n indicators = self._script.formatting.getString(**args)\n if obj.getState().contains(pyatspi.STATE_CHECKE... | [
"0.605545",
"0.60228664",
"0.60228664",
"0.5937537",
"0.5895686",
"0.5885168",
"0.58458877",
"0.57850504",
"0.5775188",
"0.5724976",
"0.5644342",
"0.5637988",
"0.5612422",
"0.5612422",
"0.5608615",
"0.55828875",
"0.55805236",
"0.5510928",
"0.5507137",
"0.5500436",
"0.54773974... | 0.6350823 | 0 |
Create a menu from the object loaded in the collection. | def on_collection_updated(self, obj, state, old_name):
icon_files = {
"gerber": self.app.resource_location + "/flatcam_icon16.png",
"excellon": self.app.resource_location + "/drill16.png",
"cncjob": self.app.resource_location + "/cnc16.png",
"geometry": self.app.r... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_menus( self ):",
"def create_menu():",
"def get_menu ( self, object ):\n return self.menu",
"def get_menu ( self, object, row ):\n return self.menu",
"def create_menu(self: object) -> None:\n menubar = Menu(self)\n menuFile = Menu(menubar, tearoff=0)\n menubar.... | [
"0.7336102",
"0.7264492",
"0.69944865",
"0.66389805",
"0.64179254",
"0.6369334",
"0.63024986",
"0.6251066",
"0.62340313",
"0.6231959",
"0.61181587",
"0.61109996",
"0.611029",
"0.6101911",
"0.60803616",
"0.60430276",
"0.6009283",
"0.5987147",
"0.59852487",
"0.5981046",
"0.5966... | 0.0 | -1 |
Remove 3' adapter for smallRNAseq Uses cutadapt but with different parameters than for other pipelines. | def trim_srna_sample(data):
in_file = data["files"][0]
names = data["rgnames"]['sample']
work_dir = os.path.join(dd.get_work_dir(data), "trimmed")
out_dir = os.path.join(work_dir, names)
utils.safe_makedir(out_dir)
out_file = replace_directory(append_stem(in_file, ".clean"), out_dir)
trim_re... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def trimAdapters(options):\n input_filename=options.input_library\n output_filename=options.adapter_trimmed_filename\n cmd=\"java -jar lib/trimmomatic/trimmomatic-0.38.jar SE -threads \"+str(options.CPU)+\" \"+input_filename\n cmd+=\" \"+output_filename\n cmd+=\" ILLUMINACLIP:Other/adapters.fasta:2:... | [
"0.58522695",
"0.5632488",
"0.56213117",
"0.56008846",
"0.55363095",
"0.55229175",
"0.5416029",
"0.5217579",
"0.52046704",
"0.5115494",
"0.51056516",
"0.5068141",
"0.5064968",
"0.50601995",
"0.5031425",
"0.5028898",
"0.50051093",
"0.49859592",
"0.49804488",
"0.49581483",
"0.4... | 0.51484644 | 9 |
Annotate miRNAs using miRBase database with seqbuster tool | def sample_annotation(data):
names = data["rgnames"]['sample']
tools = dd.get_expression_caller(data)
work_dir = os.path.join(dd.get_work_dir(data), "mirbase")
out_dir = os.path.join(work_dir, names)
utils.safe_makedir(out_dir)
out_file = op.join(out_dir, names)
if dd.get_mirbase_hairpin(dat... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def annotate(m, ss_seq): # -> None:\n ...",
"def _annotate(reads, mirbase_ref, precursors):\n for r in reads:\n for p in reads[r].precursors:\n start = reads[r].precursors[p].start + 1 # convert to 1base\n end = start + len(reads[r].sequence)\n for mature in mirbase... | [
"0.6491785",
"0.6319643",
"0.59953606",
"0.57411677",
"0.5608447",
"0.5486708",
"0.5428013",
"0.53300947",
"0.5325398",
"0.5323809",
"0.531428",
"0.5263035",
"0.5231238",
"0.5206661",
"0.52011746",
"0.51929194",
"0.5090137",
"0.5080646",
"0.5079015",
"0.50683415",
"0.5063529"... | 0.591081 | 3 |
Run cutadapt for smallRNA data that needs some specific values. | def _cmd_atropos():
cmd = "{atropos} {cores} {times} {adapter_cmd} --untrimmed-output={out_noadapter_file} -o {tx_out_file} -m 17 --overlap=8 -se {in_file} --too-short-output {out_short_file} | tee > {log_out}"
return cmd | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _get_fastq_and_run_cutadapt_trim(\n analysis_info,analysis_description,analysis_name,run_id,\n fastq_input_dir_tag,fastq_output_dir_tag,singularity_image,\n use_ephemeral_space=False,r1_length=0,r2_length=0,\n cutadapt_exe='cutadapt',dry_run=False,\n cutadapt_options=('--cores=1',)):\n... | [
"0.6440506",
"0.5381406",
"0.5370268",
"0.5263427",
"0.523105",
"0.5169838",
"0.5157114",
"0.50960225",
"0.5095822",
"0.5087847",
"0.5073464",
"0.5057034",
"0.49883223",
"0.49847424",
"0.49474525",
"0.49471068",
"0.48952168",
"0.48783916",
"0.48743907",
"0.4846881",
"0.484412... | 0.0 | -1 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.