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
Read the snyk data from S3.
def read_data_from_s3(self, name, loc): try: filename = loc + name + ".json" logger.info('Retrieving the data from the S3 file %s' % filename) return self._retrieve_dict(filename) except Exception as e: logger.error(e) return False
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def s3_read_data(self):\n\n self.k.open()\n self.k.read()", "def readFileFromS3(self, keyname, path):\n try:\n k = Key(self.BUCKET)\n k.key = keyname\n k.get_contents_to_filename(path)\n return True\n except IOError:\n return False", "d...
[ "0.75605124", "0.6819989", "0.680158", "0.67770743", "0.65578115", "0.64123785", "0.64061373", "0.63287807", "0.62678826", "0.62502086", "0.62268054", "0.61661345", "0.6124296", "0.6113738", "0.6108613", "0.6099635", "0.60688573", "0.60436517", "0.6014421", "0.59834504", "0.5...
0.6524208
5
Make an API call to data importer.
def make_api_call(self, payload, mode): try: api_url = "http://" + self.HOST + ":" + self.PORT headers = {'Content-type': 'application/json'} msg = "" response = "" if mode == "PUT": response = requests.put('{}/api/v1/snyk-cves'.format(...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _import_data(self, data, base_url, endpoint, timezone_offset=None, ignore_alias=False, dataset_id=None,\n dataset_version=None, raw_record_import=False):\n assert self.token, \"Project token required for import!\"\n if self.dataset_id or dataset_version:\n if not (d...
[ "0.6344091", "0.6112064", "0.61040187", "0.6085884", "0.6028949", "0.6022003", "0.5936041", "0.5933484", "0.58718467", "0.5770747", "0.5770508", "0.5760065", "0.5755643", "0.5749184", "0.5749184", "0.5749184", "0.5723646", "0.5705216", "0.56993526", "0.5695974", "0.5659546", ...
0.0
-1
Return True if this is a dry run.
def is_dry_run(self): # Set this value to true if you want the entire operation to run, but not the ingestion. return os.environ.get('SNYK_DRY_RUN', 'false').lower() in ('1', 'yes', 'true')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_dry_run(self):\n try:\n v = environment.get(\"Run\")\n return v.lower() == \"dry\"\n except KeyError:\n return False", "def dry_run(self) -> pulumi.Output[Optional[bool]]:\n return pulumi.get(self, \"dry_run\")", "def dry_run(self) -> Optional[pulumi...
[ "0.8660792", "0.82843524", "0.82415134", "0.82415134", "0.8056295", "0.7909113", "0.730728", "0.6988308", "0.6706155", "0.66460574", "0.6559852", "0.6550512", "0.64727366", "0.63530636", "0.5957344", "0.5942371", "0.59420216", "0.59149176", "0.59052384", "0.5902616", "0.58874...
0.85207754
1
Return if ingestion mode is on.
def force_run_ingestion(self): # Set this value when you want to run the ingestion forcefully (ignores runtime). return os.environ.get('SNYK_INGESTION_FORCE_RUN', 'false').lower() in ('1', 'yes', 'true')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def ingestion_mode(self) -> str:\n return pulumi.get(self, \"ingestion_mode\")", "def ingestion_mode(self) -> pulumi.Output[str]:\n return pulumi.get(self, \"ingestion_mode\")", "def ingestion_mode(self) -> pulumi.Input[Union[str, 'IngestionMode']]:\n return pulumi.get(self, \"ingestion_mo...
[ "0.7885129", "0.77932876", "0.7579588", "0.6684772", "0.65818673", "0.64385766", "0.6314662", "0.62913567", "0.6282229", "0.6282229", "0.6282229", "0.6250472", "0.6242138", "0.6233455", "0.6213318", "0.62132466", "0.61894625", "0.61894625", "0.61894625", "0.61894625", "0.6189...
0.6460671
5
Return if the delta feed mode is on.
def is_delta_mode_on(self): # Set this value if you want to run only in the diff mode. return os.environ.get('SNYK_DELTA_FEED_MODE', 'false').lower() in ('1', 'yes', 'true')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _ison(self):\n return self.dp.state()==PyTango.DevState.ON", "def is_on(self) -> bool:\n return self._zone.data[\"mode\"] == \"override\" and self._zone.data[\"setpoint\"]", "def is_on(self) -> bool:\n return FILTER_STATES[self._client.get_filtermode()][self._num - 1]", "def is_on(se...
[ "0.6230149", "0.6208264", "0.6136685", "0.6106795", "0.6106457", "0.6106457", "0.60758084", "0.60681146", "0.60662746", "0.6063778", "0.604218", "0.59849477", "0.5979635", "0.5978799", "0.5973308", "0.5969429", "0.5938515", "0.5930815", "0.5930815", "0.5930815", "0.5930815", ...
0.8524334
0
Return the time when ingestion needs to run.
def ingestion_run_time(self): # Set the time at which you want the ingestion to run. return os.environ.get('SNYK_INGESTION_RUN_TIME', '12')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def ingestion_wait_time_in_hours(self) -> Optional[pulumi.Input[float]]:\n return pulumi.get(self, \"ingestion_wait_time_in_hours\")", "def start_time(self) -> float:\r\n ...", "def service_time(self):\r\n #print self.node_monitor_address, self.completion_time - self.node_monitor_launch_ti...
[ "0.69690937", "0.69186443", "0.6906455", "0.6879325", "0.6821513", "0.6761177", "0.66448617", "0.6634086", "0.6615956", "0.6614802", "0.6607203", "0.65681905", "0.65531886", "0.6520282", "0.6514328", "0.65097094", "0.6507765", "0.6504433", "0.6477959", "0.64634866", "0.645584...
0.8267049
0
Disable the snyk retry mechanism.
def is_snyk_retry_disabled(self): # Set this value to false if you want to disable the snyk retry mechanism. return os.environ.get('DISABLE_SNYK_INGESTION_RETRY', 'false').lower() \ in ('1', 'yes', 'true')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def disable(self):\n self.error_code = 'DISABLED'\n self.running = False", "async def disable_protection(self) -> None:\n await self._request(\n \"dns_config\", method=\"POST\", json_data={\"protection_enabled\": False},\n )", "def DisableSSLVerify():\n\n\t\ttry:\n\t\t\tr...
[ "0.6000706", "0.5844188", "0.5841717", "0.5768392", "0.5736762", "0.572624", "0.5550153", "0.549387", "0.5460173", "0.5440041", "0.54355603", "0.5414453", "0.54084843", "0.5406965", "0.5399749", "0.5397114", "0.53927726", "0.5373983", "0.53697103", "0.53442085", "0.52788645",...
0.7940704
0
Enable or disable the bootstrap mode.
def is_custom_mode_enabled(self): return os.environ.get('SNYK_CUSTOM_MODE', 'false').lower() in ('1', 'yes', 'true')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def bootstrap():\n Bootstrap()", "def set_boot_mode(self, task, mode):\n raise exception.UnsupportedDriverExtension(\n driver=task.node.driver, extension='set_boot_mode')", "def _do_bootstrap(self, configs=None):\n pass", "def enable_secure_boot(self) -> Optional[pulumi.In...
[ "0.6520405", "0.57924205", "0.57558244", "0.5746081", "0.5673286", "0.56636906", "0.5648274", "0.56182504", "0.5575871", "0.55576533", "0.5543683", "0.54971284", "0.5495056", "0.54831505", "0.5452395", "0.5443349", "0.5438436", "0.5438436", "0.54291457", "0.54174775", "0.5416...
0.47983977
96
Enable or disable the bootstrap mode.
def is_complete_vuln_mode(self): return os.environ.get('COMPLETE_VULN_MODE', 'false').lower() in ('1', 'yes', 'true')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def bootstrap():\n Bootstrap()", "def set_boot_mode(self, task, mode):\n raise exception.UnsupportedDriverExtension(\n driver=task.node.driver, extension='set_boot_mode')", "def _do_bootstrap(self, configs=None):\n pass", "def enable_secure_boot(self) -> Optional[pulumi.In...
[ "0.6520261", "0.57920384", "0.57545704", "0.5744717", "0.5672656", "0.5663032", "0.56484455", "0.56193876", "0.5576144", "0.55560863", "0.5543295", "0.5497678", "0.54940295", "0.54825497", "0.5452572", "0.5445329", "0.5438303", "0.5438303", "0.54287493", "0.54178643", "0.5415...
0.0
-1
Return if the vuln mode is on.
def is_vuln_mode_disabled(self): # Set this value if you want the vuln data to be collected in the S3 file. return os.environ.get('DISABLE_VULN_MODE', 'false').lower() in ('1', 'yes', 'true')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_on(self):\n return self._program.get(\"enabled\") is True", "def is_complete_vuln_mode(self):\n return os.environ.get('COMPLETE_VULN_MODE', 'false').lower() in ('1', 'yes', 'true')", "def is_production_mode(self):\n return getattr(self.env, 'mode', None) == 'production'", "def in_...
[ "0.66916114", "0.66532433", "0.6499631", "0.64198023", "0.6398497", "0.6380015", "0.6346437", "0.633201", "0.63165367", "0.63053477", "0.6267307", "0.6243341", "0.6215645", "0.62144536", "0.6212919", "0.61458015", "0.6141528", "0.61412394", "0.6140185", "0.6138267", "0.613293...
0.69225055
0
Version rules for all eco.
def get_version_rules(self, vuln_versions): rules = [] regex_op = "[0-9a-zA-Z\\_\\.\\-]+" regex_vr = "[<>=*]+" """For all the vulnerable versions information that we get, we need to create comparable version object so that we can apply these rules on top of all the available ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _get_version_rules(self, vuln_versions):\n rules = []\n regex_op = \"[0-9a-zA-Z\\\\_\\\\.\\\\-]+\"\n regex_vr = \"[<>=*]+\"\n \"\"\"For all the vulnerable versions information that we get, we need to create\n comparable version object so that we can apply these rules on top o...
[ "0.6523159", "0.58597827", "0.5845769", "0.5686846", "0.56596136", "0.56483513", "0.562279", "0.55700517", "0.54971206", "0.54971206", "0.5484082", "0.5454093", "0.54378396", "0.540083", "0.53580415", "0.53335285", "0.53335285", "0.53335285", "0.53164405", "0.52835464", "0.52...
0.6416711
1
Check if the version satisfies the relation.
def _is_relation_applicable(self, key, version, rule): if key == '<': return ComparableVersion(version) < rule elif key == '>': return ComparableVersion(version) > rule elif key == '=': return ComparableVersion(version) == rule elif key == '<=': ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def satisfies(self, requirement):\r\n requirement = maybe_requirement(requirement)\r\n link_name = safe_name(self.name).lower()\r\n if link_name != requirement.key:\r\n return False\r\n return self.raw_version in requirement", "def compatible_version(self):\n\n cursor = self.disk_connecti...
[ "0.72099537", "0.6913441", "0.67831564", "0.6679291", "0.6523625", "0.64949226", "0.64059025", "0.6344277", "0.62593484", "0.62409097", "0.62362355", "0.6218552", "0.62015235", "0.6181231", "0.61745393", "0.6116509", "0.6087981", "0.6039515", "0.6023715", "0.6007467", "0.6003...
0.6558444
5
Get affected versions for maven, pypi, npm.
def get_affected_versions(self, rules, versions): affected = [] for ver in versions: for rule in rules: # If there is a singular rule Ex >=2.1.1 if len(rule) == 1: if self._is_relation_applicable(rule[0]['key'], ver, rule[0]['val']): ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_versions(self):\n raise NotImplementedError", "def getVersions(self):\n logger.debug(\"Func: getVersions\")\n\n try:\n return self._currentSceneInfo[\"Versions\"]\n except:\n return []", "def software_versions():\n\n quiet = 1\n versions = collect...
[ "0.6931074", "0.66515005", "0.66088706", "0.6571731", "0.65611935", "0.6530157", "0.64825904", "0.64442515", "0.6408348", "0.62140936", "0.6139915", "0.6134542", "0.6104713", "0.6081592", "0.60715604", "0.6059683", "0.6052463", "0.6041272", "0.6024822", "0.602084", "0.6007383...
0.0
-1
Convert to semver version format.
def get_semver_versions(self, versions): semver = [] for ver in versions: semver.append(api.to_semver(ver)) return semver
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def semver():\n return \".\".join([str(v) for v in VERSION])", "def convert_version_from_depsolver(semantic_version):\n return str(semantic_version)", "def semantic_version(self) -> str:\n\n version_core = f\"{self.major_version}.{self.minor_version}.{self.patch_version}\"\n sep = \"-\" if se...
[ "0.75162435", "0.6575736", "0.65030193", "0.6380266", "0.61463034", "0.6050096", "0.59498405", "0.592506", "0.5905958", "0.58888537", "0.5858168", "0.5828272", "0.5791106", "0.5787649", "0.57687694", "0.57430243", "0.57250947", "0.5694636", "0.5683081", "0.5682013", "0.568042...
0.5988603
6
Create and return a GaussianMixturemodel
def create_model() -> sklearn.mixture.GaussianMixture: logger.info("Creating Gaussian Mixture model") logger.debug( f"Model: GaussianMixture, n_components={data.N_CENTERS}, " + f"covariance_type={COVARIANCE_TYPE}, n_init={N_INIT}, " + f"init_params={INIT_PARAMS}" ) return Gaussia...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def train_and_score_model(\n dataset: np.ndarray\n ) -> Tuple[sklearn.mixture.GaussianMixture, float]:\n model = create_model()\n\n ### Fit model ###\n logger.info(\"Fitting GaussianMixture\")\n model.fit(dataset)\n\n ### Score model ###\n score = model.score(dataset)\n logger.info(f...
[ "0.6825591", "0.6740222", "0.63303256", "0.62117445", "0.6143393", "0.61378485", "0.60949916", "0.60790414", "0.6022479", "0.6014023", "0.59476495", "0.5921224", "0.58957887", "0.5848955", "0.58337665", "0.57924956", "0.5770359", "0.57569426", "0.57394385", "0.57371604", "0.5...
0.87502056
0
Train and score the GaussianMixture model on a given dataset
def train_and_score_model( dataset: np.ndarray ) -> Tuple[sklearn.mixture.GaussianMixture, float]: model = create_model() ### Fit model ### logger.info("Fitting GaussianMixture") model.fit(dataset) ### Score model ### score = model.score(dataset) logger.info(f"GaussianMixture t...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def fit(self, data):\n logger.debug(f'Start fitting GaussianMixtureModel to data of shape {data.shape}...')\n self.gm.fit(data)\n logger.debug(f'Finished fitting GMM')\n self.trained = True", "def train_sklearn(self, config, samples):\n samples = samples.numpy()\n tic = ...
[ "0.7335727", "0.72618", "0.6818932", "0.6561809", "0.650553", "0.6473688", "0.64249563", "0.6259185", "0.625536", "0.6238786", "0.62347734", "0.61418164", "0.6138435", "0.60889834", "0.60720587", "0.60679746", "0.59631103", "0.5959821", "0.5957271", "0.5933085", "0.5920184", ...
0.82078743
0
The method that must return a mutation
def mutate(self, info, question_text): question = Question( question_text=question_text, pub_date=now() ) question.save() ok = True return CreateQuestion( question=question, ok=ok )
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def doMutation(self, mut_func, member):\n\t\tif mut_func in self.mutation_external_data:\n\t\t\treturn mut_func(member, *(self.mutation_external_data[mut_func]))\n\t\telse:\n\t\t\treturn mut_func(member)", "def mutator(mutate):\r\n @functools.wraps(mutate)\r\n def ecspy_mutator(random, candidates, args):\r...
[ "0.64045364", "0.62793416", "0.6266269", "0.62289", "0.6004961", "0.58713156", "0.5850961", "0.5792914", "0.5778135", "0.576219", "0.5695767", "0.56712973", "0.56496984", "0.56392956", "0.56350815", "0.5624898", "0.56183213", "0.56103265", "0.5599912", "0.5590711", "0.5589527...
0.0
-1
function reads multifasta files. func concatenates the multifasta by removing "\n" and placing header and sequence as dictionary keyvalue pair. Then returns one .txt file. It requires a directory path and list of files that it is to read.
def read_write_protein_files(dir_path, heme_files): for i in number_of_files: # seqs = {} input_files = (dir_path + heme_files[i]) f = open(input_files) count = 0 # output_file = (dir_path + heme_files[i] + ".txt") # g = open(output_file, "x") with open(input_fil...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def convert_single_to_multi(file_directory):\n all_files = os.listdir(file_directory)\n merged_file = ''\n for file_name in all_files:\n f_single = open(file_directory + '/' + file_name, \"r\")\n data = f_single.read() + '\\n'\n merged_file += data\n date = datetime.datetime.now()\...
[ "0.6466673", "0.6224968", "0.6202852", "0.6003082", "0.5994234", "0.59609765", "0.59053165", "0.5904318", "0.5888675", "0.58625764", "0.58328867", "0.5798885", "0.5784122", "0.5759367", "0.5748032", "0.57226527", "0.57212055", "0.56634516", "0.5660066", "0.56551105", "0.56358...
0.62385464
1
Wrap my own function return as np.array Use it as a decorator.
def wrapImg(func): def wrapFunc(*args, **kwargs): return np.array(func(*args, **kwargs)) return wrapFunc
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def with_numpy(func):\r\n return func", "def numpyfunc(*args, **kwargs):\n def _decorator(func):\n return numpy.frompyfunc(func, *args, **kwargs)\n return _decorator", "def a(*args, **kwargs):\n return np.array(*args, **kwargs)", "def __array_function__(self, func, types, args, kwargs)...
[ "0.79107386", "0.76430506", "0.7330161", "0.7233481", "0.71025044", "0.7088111", "0.65177184", "0.6437608", "0.6408046", "0.638698", "0.6350729", "0.63290614", "0.6300141", "0.6295874", "0.62465364", "0.6222255", "0.61953086", "0.61802673", "0.6171385", "0.6122047", "0.610368...
0.69958663
6
Multiple the image by a constant
def imageMult(img, num): return myimg.imageMult(img.tolist(), num)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def montage(images, w_sub, h_sub, step):\n target = Image.new('RGB', (w_sub*step, h_sub*step))\n left = 0\n right = w_sub\n for i in range(len(images)):\n top=(i//step)*h_sub\n target.paste(images[i], (left, top, right, top+h_sub))\n if(i//step < (i+1)//step):#Check if this row is ...
[ "0.6567527", "0.6170886", "0.6098967", "0.6062209", "0.5806136", "0.57838523", "0.57131743", "0.5670568", "0.56413287", "0.5616585", "0.56058776", "0.56037444", "0.5578985", "0.5545909", "0.55414027", "0.55350053", "0.55265033", "0.5499199", "0.5499199", "0.54860795", "0.5482...
0.7266229
0
Add the image by a constant. Make sure the value in my image is from 0 to 1.
def imageAdd(img, num): return myimg.imageAdd(img.tolist(), num)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def imadd(img):\n\n img = img / 2 + 0.5 # unnormalize\n npimg = img\n plt.imshow(np.transpose(npimg, (1, 2, 0)))", "def iadd_scalar(self, other: float):\n self.set(self.gross + other)", "def add_image(self, image, mode='normal', state='on'):\n raise NotImplementedError", "def setFl...
[ "0.6338049", "0.62775636", "0.61424595", "0.593524", "0.5864383", "0.58004737", "0.57033044", "0.56935203", "0.5672427", "0.5662999", "0.5637787", "0.56332856", "0.5626585", "0.5619824", "0.56094503", "0.56069577", "0.5585251", "0.5574157", "0.55734354", "0.55632955", "0.5532...
0.67746663
0
Make average of two image pixelwisely.
def imageAvg(img1, img2): return myimg.imageAvg(img1.tolist(), img2.tolist())
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def average(rgb1: Tuple[int, int, int], rgb2: Tuple[int, int, int]) \\\n -> Tuple[int, int, int]:\n r = int((rgb1[0] + rgb2[0] + 0.5) / 2)\n g = int((rgb1[1] + rgb2[1] + 0.5) / 2)\n b = int((rgb1[2] + rgb2[2] + 0.5) / 2)\n return r, g, b", "def mse(image1: np.ndarray, image2: np.ndarray) -> np...
[ "0.69791085", "0.66644293", "0.6427036", "0.6408773", "0.636635", "0.63357323", "0.6314909", "0.63091546", "0.6297116", "0.62811303", "0.62430894", "0.62086475", "0.61911947", "0.615902", "0.61560726", "0.6153513", "0.6151613", "0.61290014", "0.6123557", "0.6107312", "0.60888...
0.7687703
0
Special operation to this image
def image_special_func(img): return myimg.image_special_func(img.tolist())
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def op(self, img):\n raise NotImplementedError(\"'op' is an abstract method.\")", "def __call__(self, img, *args, **kwargs):\n raise NotImplementedError", "def __call__(self, img, *args, **kwargs):\n raise NotImplementedError", "def process(self, image):", "def modify(self, *args, **kw...
[ "0.8143458", "0.71806276", "0.71806276", "0.69612294", "0.68178946", "0.6475039", "0.6438333", "0.64338064", "0.6382737", "0.62376153", "0.61577475", "0.61547554", "0.6115176", "0.6074755", "0.6074755", "0.6074755", "0.60700566", "0.6067624", "0.6057169", "0.6029584", "0.6018...
0.63681835
9
If specified, optional label is included after timestamp. Other options are passed to the Logger class initializer.
def __init__(self, category, label=None, manual_reprime=0, nofail=1, immediate=1): self.__label = label self.__manual_reprime = manual_reprime self.__primed = 1 self.__bol = 1 Logger.__init__(self, category, nofail, immediate)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def log_time(label: str) -> None:\n print(label, datetime.now())", "def __init__(\n self,\n filename=None,\n level=logging.WARNING,\n name=None,\n cli=False,\n backup=3,\n when=\"midnight\",\n pattern=None\n ):\n\n super(PHKLogger, self).__init...
[ "0.6854227", "0.5980828", "0.5690214", "0.56455016", "0.5639293", "0.5618366", "0.5462896", "0.5447293", "0.5425256", "0.54225427", "0.540345", "0.53666943", "0.53619534", "0.53619534", "0.53619534", "0.53619534", "0.53619534", "0.53619534", "0.53619534", "0.53619534", "0.536...
0.5822673
2
Reset so timestamp will be included with next write.
def reprime(self): self.__primed = 1
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def reset_sync_time(self):\n self._sync_timestamp = 0", "def reset(self):\n self.reset_count += 1\n self._init_data()", "def reset(self):\n self.cumtime = 0\n self.start_time = self.time()", "def resetWriteCount(self):\n self.writeCount = 0", "def reset_time(self):...
[ "0.7340942", "0.716062", "0.7110097", "0.71059793", "0.6824292", "0.6809827", "0.6753224", "0.6751157", "0.67335635", "0.67228013", "0.6717456", "0.67005444", "0.66985023", "0.66823184", "0.6673016", "0.6651993", "0.66239184", "0.66029054", "0.65821314", "0.6571028", "0.65536...
0.0
-1
Scrapes the price from the page.
def scrape_page(self, url: str) -> str: ctx = ssl.create_default_context() ctx.check_hostname = False ctx.verify_mode = ssl.CERT_NONE headers = { 'User-Agent': 'Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/41.0.2228.0 Safari/537.3', ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getPrice(self):\n headers = {\n \"User-Agent\": \"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/81.0.4044.113 Safari/537.36\"}\n response = requests.get(self.__product_URL, headers=headers)\n #print(response.status_code)\n soup = ...
[ "0.7428018", "0.7198964", "0.70132554", "0.70023704", "0.69858086", "0.6955575", "0.6954375", "0.6914772", "0.68592876", "0.6809998", "0.67522115", "0.67257273", "0.6658951", "0.6640992", "0.662451", "0.65616417", "0.65323895", "0.6494034", "0.6480473", "0.6451651", "0.636770...
0.0
-1
Return the maximum value of the array of `length` after performing all the `queries`.
def manipulate_array(length, queries): # T(n), S(n) # create the array of zeros of length `length + 1` array = [0] * (length + 1) # S(n) for query in queries: # T(n) start_index, end_index, value = query[0] - 1, query[1], query[2] # increment and decrement the `value` at the start and e...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_max_param(self):\r\n\r\n sql_str = \"SELECT jsonb_array_length(parameters) as length FROM alarm_condition\"\r\n\r\n param = self.postgres.query_fetch_all(sql_str)\r\n\r\n if param:\r\n\r\n max_param = max([p['length'] for p in param])\r\n else:\r\n\r\n max_...
[ "0.64757967", "0.6343356", "0.6298442", "0.6294446", "0.6255374", "0.61935925", "0.6157313", "0.61473566", "0.6019953", "0.5932734", "0.5894913", "0.5892807", "0.5889901", "0.5872064", "0.586058", "0.58542395", "0.58352023", "0.58348167", "0.5826967", "0.5784949", "0.57823586...
0.7263292
0
Authenticate a user based on email address as the user name.
def authenticate(self, request, username=None, password=None, **kwargs): try: user = Account.objects.get(email=username) if user.check_password(password): return user except Account.DoesNotExist: try: user = Account.objects.get(username...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _authenticate_and_get_user(self, email, password, user=None):\n # Authenticate the user\n emailBackend = EmailBackend()\n user = emailBackend.authenticate(username=email, password=password, user=user)\n return user", "def authUser(self, email='user@mail.com'):\n user = self...
[ "0.7241122", "0.72308224", "0.7181362", "0.7174445", "0.7135515", "0.71011657", "0.6994781", "0.6983181", "0.6925969", "0.68737483", "0.68301475", "0.67244065", "0.670616", "0.667984", "0.6674109", "0.66469365", "0.66160613", "0.66155964", "0.66080236", "0.65908986", "0.65199...
0.64550054
27
Get a User object from the user_id.
def get_user(self, user_id): try: return Account.objects.get(pk=user_id) except Account.DoesNotExist: return None
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_user_by_id(user_id):\n\n return User.query.get(user_id)", "def get_user_from_id(user_id):\n return Users.query.filter_by(id=user_id).first()", "def get_user_by_id(user_id):\n return User.query.get(user_id)", "def get_user(cls, user_id):\n try:\n return User.objects....
[ "0.89135295", "0.8838515", "0.8776147", "0.8770163", "0.87386477", "0.8667805", "0.8667805", "0.8667805", "0.8667805", "0.86468965", "0.8629112", "0.85356957", "0.8495958", "0.8457728", "0.83978903", "0.8372216", "0.8274367", "0.8245512", "0.82040536", "0.82040536", "0.820405...
0.79216135
71
Change a state for all matching instances in a project.
def change_state(tagkey, tagvalue, action, project): if not (check_if_app_engine_job(tagkey, tagvalue)): compute = Compute(project) sql = Sql(project) gke = Gke(project) logging.info("change_state %s action %s", project, action) compute.change_status(action, tagkey, tagvalue)...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_update_instances_schedule_state(self):\n pass", "def set_state(self, state: int):", "def update_image_all_projects(self):\n projects = Project.objects.all(temporary=False)\n for project in projects:\n project.update_image()", "def set_state( self ):", "def __change_...
[ "0.5854257", "0.57001126", "0.56966645", "0.5679966", "0.5615546", "0.5568851", "0.5527092", "0.5505383", "0.549438", "0.54891896", "0.5479845", "0.54657435", "0.5464507", "0.54290557", "0.54290557", "0.5395603", "0.5380331", "0.53338957", "0.53161764", "0.5287022", "0.526870...
0.5261329
22
Infer by the tag key and value if its an App Engine job
def check_if_app_engine_job(tagkey, tagvalue): if (tagkey == '@app_engine_flex') and (':' in tagvalue): return True else: return False
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_job(self) -> Union[Dict[Text, Text], CustomJob]:\n pass", "def _record_job_tags(self, job: Job) -> None:\n assert job.task\n\n # Record value tags.\n for value_hash, tags in job.value_tags:\n self.backend.record_tags(\n entity_type=TagEntityType.Value, en...
[ "0.5651085", "0.5556177", "0.5173027", "0.5002312", "0.48833883", "0.47348303", "0.47078177", "0.46986645", "0.4690064", "0.46737456", "0.4657522", "0.46543372", "0.46482596", "0.46184155", "0.4590786", "0.4561573", "0.45330656", "0.45177123", "0.45121172", "0.45019776", "0.4...
0.5828052
0
Serve up the single page app for scheduler dashboard.
def get(self): meta_info = utils.get_all_available_jobs() self.render(settings.APP_INDEX_PAGE, jobs_meta_info=json.dumps(meta_info))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index():\n return \"Attendance Flask server\"", "def dashboard():\n return render_template('home/dashboard.html',title='SycliQ Dashboard')", "def index(request):\n\n\treturn render(request, 'index.html', {})\n\n\t# uncomment this line vvv and comment the above ^^^ line once we cut off scheduling\n\t#...
[ "0.68782836", "0.67694134", "0.67537355", "0.6592102", "0.6539373", "0.6523266", "0.6489348", "0.64622945", "0.6430098", "0.64291674", "0.64140856", "0.6377146", "0.6338368", "0.63382673", "0.6316471", "0.63126576", "0.6287285", "0.62550837", "0.62183684", "0.6198881", "0.615...
0.0
-1
Implementation of pigeon hole sort algorithm
def pigeon_sort(array): if len(array) == 0: return array # Manually finds the minimum and maximum of the array. min = array[0] max = array[0] for i in range(len(array)): if array[i] < min: min = array[i] elif array[i] > max: max = array[i] # Com...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def wiggleSort(self, nums):\n nums2=nums.copy()\n nums2.sort()\n n = len(nums)\n if n%2:\n midpoint = n//2\n else:\n midpoint = n//2-1\n j=n-1\n i=midpoint\n point=0\n while j > midpoint:\n nums[point] = nums2[i]\n ...
[ "0.69168335", "0.66820765", "0.66596377", "0.6648649", "0.66138065", "0.659795", "0.65944225", "0.6586554", "0.65688837", "0.65618044", "0.6554407", "0.6545642", "0.6505205", "0.64969915", "0.6456065", "0.6438882", "0.6438063", "0.6437484", "0.6426108", "0.6388984", "0.638215...
0.73136604
0
Generates n_traj trajectories of pi_H in bandit_env, of up to length max_timesteps. No fancy tricks, just rolling them out one at a time.
def gen_human_bandit_trajs(pi_H, bandit_env, max_timesteps=None, n_trajs=10): if max_timesteps==None: max_timesteps = bandit_env.horizon trajs = [] for i in prog_bar(range(n_trajs)): ob = bandit_env.reset() pi_H.reset() best_arm = np.argmax([bandit_env.arms[...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def fixed_steps_trajectories(self, noise=0, nt=1, ll=0.1, limit=None):\n\n print('Generating Trajectories...')\n for i in tqdm.tqdm(range(self.ntraj)):\n\n if self.hop_distribution == 'gaussian' or self.hop_distribution == 'Gaussian':\n z_position = np.cumsum(\n ...
[ "0.679281", "0.60337883", "0.5926588", "0.5920322", "0.5909478", "0.58606356", "0.57011646", "0.56236327", "0.5557102", "0.55529034", "0.5438898", "0.54227173", "0.53958905", "0.53685904", "0.53121597", "0.52904475", "0.52537346", "0.516319", "0.51491904", "0.5131413", "0.512...
0.76549655
0
ChannelReturnResponse a model defined in OpenAPI
def __init__(self, channel_return_no=None, channel_order_no=None, merchant_order_no=None, lines=None, created_at=None, updated_at=None, id=None, reason=None, customer_comment=None, merchant_comment=None, refund_incl_vat=None, refund_excl_vat=None, local_vars_configuration=None): # noqa: E501 # noqa: E501 if l...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _create_response_model(self, data):\n pass", "def getChannelResponse(self):\n \n \n return self.channel_response", "def get_response_for_api(self):\n coll_1 = \"I'm from Telegram\"\n coll_2 = \" Controller Class\"\n result = coll_1 + coll_2\n return {...
[ "0.6196427", "0.61665905", "0.60632867", "0.59789747", "0.5937303", "0.59184545", "0.59123003", "0.5767197", "0.57342714", "0.5692888", "0.5685411", "0.56631535", "0.5635039", "0.5623035", "0.5601489", "0.55989695", "0.5504664", "0.54897803", "0.54886276", "0.5478156", "0.547...
0.0
-1
Sets the channel_return_no of this ChannelReturnResponse.
def channel_return_no(self, channel_return_no): if self.local_vars_configuration.client_side_validation and channel_return_no is None: # noqa: E501 raise ValueError("Invalid value for `channel_return_no`, must not be `None`") # noqa: E501 self._channel_return_no = channel_return_no
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def setChannelResponse(self, channel_response):\n \n \n # Make sure passing a list of CIR for each LightSource\n assert isinstance(channel_response, list)\n \n self.channel_response = channel_response", "def set_channel(self, channel):\n self.response['channel'] =...
[ "0.6294627", "0.6085321", "0.5008838", "0.4983765", "0.49693087", "0.49008304", "0.48862287", "0.48862287", "0.48429367", "0.48349634", "0.48212555", "0.48185545", "0.47737944", "0.47620875", "0.47477123", "0.47156537", "0.46935982", "0.46852058", "0.46425253", "0.4639683", "...
0.8403697
0
Sets the channel_order_no of this ChannelReturnResponse.
def channel_order_no(self, channel_order_no): if self.local_vars_configuration.client_side_validation and channel_order_no is None: # noqa: E501 raise ValueError("Invalid value for `channel_order_no`, must not be `None`") # noqa: E501 self._channel_order_no = channel_order_no
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def channel_return_no(self, channel_return_no):\n if self.local_vars_configuration.client_side_validation and channel_return_no is None: # noqa: E501\n raise ValueError(\"Invalid value for `channel_return_no`, must not be `None`\") # noqa: E501\n\n self._channel_return_no = channel_retur...
[ "0.5976309", "0.556253", "0.5542151", "0.55288607", "0.55288607", "0.54787785", "0.54280263", "0.53573877", "0.5312814", "0.5286618", "0.5286618", "0.5286618", "0.52681977", "0.52556974", "0.5230975", "0.51558375", "0.51558375", "0.51558375", "0.513104", "0.5119577", "0.50451...
0.77330625
0
Sets the merchant_order_no of this ChannelReturnResponse.
def merchant_order_no(self, merchant_order_no): self._merchant_order_no = merchant_order_no
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def merchant_id(self, merchant_id):\n\n self._merchant_id = merchant_id", "def merchant_comment(self, merchant_comment):\n if (self.local_vars_configuration.client_side_validation and\n merchant_comment is not None and len(merchant_comment) > 4001):\n raise ValueError(\"In...
[ "0.58518696", "0.5845745", "0.5749896", "0.5568033", "0.5460311", "0.5277167", "0.52146024", "0.50644284", "0.50608397", "0.50608397", "0.50608397", "0.48972586", "0.47842017", "0.47791475", "0.47566214", "0.47566214", "0.47448388", "0.47202748", "0.47101927", "0.46435368", "...
0.81102973
0
Sets the lines of this ChannelReturnResponse.
def lines(self, lines): if self.local_vars_configuration.client_side_validation and lines is None: # noqa: E501 raise ValueError("Invalid value for `lines`, must not be `None`") # noqa: E501 self._lines = lines
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def setChannelResponse(self, channel_response):\n \n \n # Make sure passing a list of CIR for each LightSource\n assert isinstance(channel_response, list)\n \n self.channel_response = channel_response", "def _response(self, *lines):\n for line in lines:\n ...
[ "0.64100397", "0.59053147", "0.5548535", "0.5532129", "0.55004644", "0.5407306", "0.5403432", "0.53599644", "0.53367496", "0.5335717", "0.5285085", "0.52662486", "0.52557933", "0.5252643", "0.52380645", "0.52292675", "0.5212807", "0.51631373", "0.51555824", "0.5102194", "0.50...
0.5603051
2
Sets the created_at of this ChannelReturnResponse.
def created_at(self, created_at): self._created_at = created_at
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def created_at(self, created_at):\n self._created_at = created_at", "def created_at(self, created_at: \"datetime\"):\n self._attrs[\"createdAt\"] = created_at", "def created_at(self, created_at: \"datetime\"):\n self._attrs[\"createdAt\"] = created_at", "def created_at(self, created_at: ...
[ "0.65770507", "0.6559553", "0.6559553", "0.6559553", "0.6474776", "0.6138583", "0.6138583", "0.6078942", "0.58889717", "0.58354366", "0.57629526", "0.5630299", "0.55852574", "0.5564892", "0.5560603", "0.5560603", "0.5560603", "0.5560603", "0.5516017", "0.54996145", "0.549091"...
0.65525055
20
Sets the updated_at of this ChannelReturnResponse.
def updated_at(self, updated_at): self._updated_at = updated_at
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def updated_at(self, updated_at: \"datetime\"):\n self._attrs[\"updatedAt\"] = updated_at", "def updated_at(self, updated_at: \"datetime\"):\n self._attrs[\"updatedAt\"] = updated_at", "def updated_at(self, updated_at: \"datetime\"):\n self._attrs[\"updatedAt\"] = updated_at", "def updat...
[ "0.68167144", "0.68167144", "0.68167144", "0.6386273", "0.63290477", "0.5913079", "0.5913079", "0.5913079", "0.5907891", "0.5907891", "0.5907891", "0.58465546", "0.58141243", "0.5764128", "0.57118255", "0.5696651", "0.56540555", "0.56540555", "0.5617201", "0.56079227", "0.557...
0.659471
12
Sets the id of this ChannelReturnResponse.
def id(self, id): self._id = id
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def response_id(self, response_id):\n\n self._response_id = response_id", "def set_id(self, id):\n self.data['id'] = id", "def rc_response_sets_id(self, rc_response_sets_id):\n\n self._rc_response_sets_id = rc_response_sets_id", "def setID(self, id):\n self._id = id\n retur...
[ "0.6502312", "0.62223506", "0.60702217", "0.6044452", "0.603114", "0.59509647", "0.587993", "0.5855515", "0.58248156", "0.58248156", "0.58248156", "0.58248156", "0.58248156", "0.58175635", "0.5816122", "0.5767343", "0.57582766", "0.57190806", "0.57190806", "0.57190806", "0.57...
0.0
-1
Sets the reason of this ChannelReturnResponse.
def reason(self, reason): self._reason = reason
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def reason(self, reason: str):\n\n self._reason = reason", "def reason(self, reason):\n allowed_values = [\"CLIENT_ORDER\", \"TRADE_CLOSE\", \"POSITION_CLOSEOUT\", \"MARGIN_CLOSEOUT\", \"DELAYED_TRADE_CLOSE\"] # noqa: E501\n if reason not in allowed_values:\n raise ValueError(\n ...
[ "0.7054716", "0.67173976", "0.6556905", "0.64163667", "0.63738674", "0.63453543", "0.62935936", "0.60364753", "0.5952574", "0.5748696", "0.5732212", "0.5715825", "0.5689847", "0.56836087", "0.56061107", "0.5565012", "0.55112374", "0.5509794", "0.5449831", "0.54487276", "0.543...
0.7186768
0
Sets the customer_comment of this ChannelReturnResponse.
def customer_comment(self, customer_comment): if (self.local_vars_configuration.client_side_validation and customer_comment is not None and len(customer_comment) > 4001): raise ValueError("Invalid value for `customer_comment`, length must be less than or equal to `4001`") # noqa: E5...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def customer(self, customer):\n if customer is None:\n raise ValueError(\"Invalid value for `customer`, must not be `None`\") # noqa: E501\n\n self._customer = customer", "def customer(self, customer):\n\n self._customer = customer", "def customer(self, customer):\n\n se...
[ "0.6495456", "0.6428357", "0.6428357", "0.64145833", "0.6283955", "0.6139833", "0.6139833", "0.6139833", "0.6139833", "0.6139833", "0.6139833", "0.6139833", "0.6139833", "0.6139833", "0.6139833", "0.60955757", "0.60955757", "0.60955757", "0.60955757", "0.60454875", "0.595792"...
0.77025354
0
Sets the merchant_comment of this ChannelReturnResponse.
def merchant_comment(self, merchant_comment): if (self.local_vars_configuration.client_side_validation and merchant_comment is not None and len(merchant_comment) > 4001): raise ValueError("Invalid value for `merchant_comment`, length must be less than or equal to `4001`") # noqa: E5...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def comment(self, comment):\n\n self.logger.debug(\"In 'comment' setter.\")\n\n self._comment = comment", "def set_comment(self, comment):\n\t\tself.comment_ = comment", "def merchant(self, merchant):\n if merchant is None:\n raise ValueError(\"Invalid value for `merchant`, must...
[ "0.65038735", "0.63781184", "0.6325114", "0.6198793", "0.6198793", "0.6198793", "0.6198793", "0.6198793", "0.6198793", "0.6198793", "0.6198793", "0.6198793", "0.6198793", "0.6069528", "0.60674477", "0.5976623", "0.5976623", "0.59603655", "0.5939949", "0.5918144", "0.5874753",...
0.7860767
0
Sets the refund_incl_vat of this ChannelReturnResponse.
def refund_incl_vat(self, refund_incl_vat): if (self.local_vars_configuration.client_side_validation and refund_incl_vat is not None and refund_incl_vat < 0): # noqa: E501 raise ValueError("Invalid value for `refund_incl_vat`, must be a value greater than or equal to `0`") # noqa: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def refund_excl_vat(self, refund_excl_vat):\n if (self.local_vars_configuration.client_side_validation and\n refund_excl_vat is not None and refund_excl_vat < 0): # noqa: E501\n raise ValueError(\"Invalid value for `refund_excl_vat`, must be a value greater than or equal to `0`\")...
[ "0.58407325", "0.542691", "0.4678022", "0.4579212", "0.44836187", "0.44703972", "0.43823436", "0.43767586", "0.43506703", "0.43438226", "0.42796484", "0.42702028", "0.4248939", "0.4225735", "0.4225735", "0.42237067", "0.42219445", "0.41745552", "0.41586012", "0.41383153", "0....
0.81290156
0
Sets the refund_excl_vat of this ChannelReturnResponse.
def refund_excl_vat(self, refund_excl_vat): if (self.local_vars_configuration.client_side_validation and refund_excl_vat is not None and refund_excl_vat < 0): # noqa: E501 raise ValueError("Invalid value for `refund_excl_vat`, must be a value greater than or equal to `0`") # noqa: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def refund_incl_vat(self, refund_incl_vat):\n if (self.local_vars_configuration.client_side_validation and\n refund_incl_vat is not None and refund_incl_vat < 0): # noqa: E501\n raise ValueError(\"Invalid value for `refund_incl_vat`, must be a value greater than or equal to `0`\")...
[ "0.5989941", "0.4850047", "0.46746057", "0.46527916", "0.46527916", "0.46172494", "0.45566002", "0.44703436", "0.4465314", "0.44540542", "0.44144934", "0.4396465", "0.43494147", "0.43349367", "0.43320423", "0.43261135", "0.43095946", "0.42808232", "0.42619446", "0.42608503", ...
0.80779743
0
Returns the model properties as a dict
def to_dict(self): result = {} for attr, _ in six.iteritems(self.openapi_types): value = getattr(self, attr) if isinstance(value, list): result[attr] = list(map( lambda x: x.to_dict() if hasattr(x, "to_dict") else x, value ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def to_dict(self):\n return self.properties", "def to_dict(self):\n return self.properties", "def get_properties(self):\n return self.properties", "def asdict(self):\n return self._prop_dict", "def json(self):\n rv = {\n prop: getattr(self, prop)\n f...
[ "0.7751993", "0.7751993", "0.73391134", "0.7334895", "0.7297356", "0.727818", "0.7159078", "0.71578115", "0.71494967", "0.71494967", "0.71283495", "0.71275014", "0.7122587", "0.71079814", "0.7060394", "0.7043251", "0.7034103", "0.70233124", "0.69635814", "0.69586295", "0.6900...
0.0
-1
Returns the string representation of the model
def to_str(self): return pprint.pformat(self.to_dict())
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __str__(self):\n return super().__str__() + self.model.__str__()", "def __str__(self) -> str:\n # noinspection PyUnresolvedReferences\n opts = self._meta\n if self.name_field:\n result = str(opts.get_field(self.name_field).value_from_object(self))\n else:\n ...
[ "0.8585678", "0.7814723", "0.77902746", "0.7750817", "0.7750817", "0.7713574", "0.7699132", "0.7670784", "0.76510423", "0.7600937", "0.7582941", "0.7570682", "0.75406617", "0.75233835", "0.75168735", "0.75013274", "0.74877244", "0.74877244", "0.74700385", "0.7451798", "0.7446...
0.0
-1
For `print` and `pprint`
def __repr__(self): return self.to_str()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def pprint(*args, **kwargs):\n if PRINTING:\n print(*args, **kwargs)", "def print_out():\n pass", "def custom_print(*objects):\n print(*objects, sep=OFS, end=ORS)", "def _print(self, *args):\n return _ida_hexrays.vd_printer_t__print(self, *args)", "def _printable(self):\n ...
[ "0.75577617", "0.73375154", "0.6986672", "0.698475", "0.6944995", "0.692333", "0.6899106", "0.6898902", "0.68146646", "0.6806209", "0.6753795", "0.67497987", "0.6744008", "0.6700308", "0.6691256", "0.6674591", "0.6658083", "0.66091245", "0.6606931", "0.6601862", "0.6563738", ...
0.0
-1
Returns true if both objects are equal
def __eq__(self, other): if not isinstance(other, ChannelReturnResponse): return False return self.to_dict() == other.to_dict()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __eq__(self, other):\n return are_equal(self, other)", "def __eq__(self, other):\n return are_equal(self, other)", "def __eq__(self,other):\n try: return self.object==other.object and isinstance(self,type(other))\n except: return False", "def __eq__(self, other):\n if i...
[ "0.8088132", "0.8088132", "0.8054589", "0.7982687", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", ...
0.0
-1
Returns true if both objects are not equal
def __ne__(self, other): if not isinstance(other, ChannelReturnResponse): return True return self.to_dict() != other.to_dict()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __ne__(self, other: object) -> bool:\n if self.__eq__(other):\n return False\n return True", "def __ne__(self, other: object) -> bool:\n return not self.__eq__(other)", "def __ne__(self, other) -> bool:\n return not self.__eq__(other)", "def __eq__(self, other):\n ...
[ "0.845611", "0.8391477", "0.8144138", "0.81410587", "0.8132492", "0.8093973", "0.80920255", "0.80920255", "0.80920255", "0.8085325", "0.8085325", "0.8076365", "0.8076365", "0.8065748", "0.8042487", "0.8042487", "0.8042487", "0.8042487", "0.8042487", "0.8042487", "0.8042487", ...
0.0
-1
Construct reader from either a JSON string or a Python dict.
def __init__(self, keydata): if isinstance(keydata, basestring): keydata = json.loads(keydata) assert isinstance(keydata, dict), keydata self.dict = keydata
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def from_json(cls, string):\n dct = json.loads(string)\n return cls.from_dict(dct)", "def from_json_str(cls, json_str):\n return cls.from_json(simplejson.loads(json_str))", "def from_json_string(cls, json_string: Text, check_params=False):\n lparams = json.loads(json_string)\n if...
[ "0.7152539", "0.7100484", "0.7002218", "0.6981892", "0.69188917", "0.6830879", "0.6819372", "0.6798484", "0.6798484", "0.6771984", "0.6745321", "0.6717244", "0.6712423", "0.6673706", "0.66164255", "0.66164255", "0.66164255", "0.6607437", "0.6594622", "0.6594622", "0.6594622",...
0.0
-1
Returns the "meta" attribute.
def GetMetadata(self): return self.dict['meta']
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def meta(self):\n return self._meta", "def meta(self):\n return self._meta", "def meta(self):\n return self._meta", "def meta(self):\n return self.spec.meta", "def get_meta(self):\n if hasattr(self, 'meta'):\n return self.meta\n raise NotImplementedError...
[ "0.7887626", "0.7887626", "0.7887626", "0.7715828", "0.76061034", "0.7389086", "0.7384182", "0.7360078", "0.72282654", "0.71128666", "0.7107659", "0.70811987", "0.7066861", "0.7009333", "0.6959186", "0.69163626", "0.68852746", "0.6870586", "0.6870521", "0.68616384", "0.685250...
0.80889535
0
Returns a key having "version_number" as its name.
def GetKey(self, version_number): return self.dict[str(version_number)]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_version_key(self, version):\n if self._generic_only:\n return GENERIC_VERSION\n else:\n self.check_version_exists(version)\n return version", "def kms_key_version_name(self) -> str:\n return pulumi.get(self, \"kms_key_version_name\")", "def key_vers...
[ "0.79072005", "0.7538215", "0.72869647", "0.6993121", "0.6867462", "0.6741636", "0.6617988", "0.64844215", "0.6324501", "0.63166916", "0.6312392", "0.6282849", "0.62616396", "0.6225029", "0.62159294", "0.61619556", "0.6107714", "0.6094575", "0.609297", "0.6043491", "0.6031558...
0.88732076
0
Does nothing, as there is nothing to close.
def Close(self): pass
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def close(self):\n # This is a NOOP by default", "def close(self):\n # This is a NOOP by default", "def close(self):\n # By default, this is a NOOP", "def close(self) -> None:", "def close(self) -> None:", "def close(self) -> None:", "def close(self) -> None:", "def close(self) -...
[ "0.86730653", "0.86730653", "0.8604363", "0.8367989", "0.8367989", "0.8367989", "0.8367989", "0.8367989", "0.8367989", "0.8367989", "0.8367989", "0.8317376", "0.8316804", "0.8316804", "0.8316804", "0.8292599", "0.8292599", "0.82787806", "0.826964", "0.8265572", "0.8265572", ...
0.0
-1
Construct reader from either a JSON string or a Python dict.
def __init__(self, keydata=None): if isinstance(keydata, basestring): keydata = json.loads(keydata) assert keydata is None or isinstance(keydata, dict), keydata self.dict = keydata if keydata is not None else {}
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def from_json(cls, string):\n dct = json.loads(string)\n return cls.from_dict(dct)", "def from_json_str(cls, json_str):\n return cls.from_json(simplejson.loads(json_str))", "def from_json_string(cls, json_string: Text, check_params=False):\n lparams = json.loads(json_string)\n if...
[ "0.7152539", "0.7100484", "0.7002218", "0.6981892", "0.69188917", "0.6830879", "0.6819372", "0.6798484", "0.6798484", "0.6771984", "0.6745321", "0.6717244", "0.6712423", "0.6673706", "0.66164255", "0.66164255", "0.66164255", "0.6607437", "0.6594622", "0.6594622", "0.6594622",...
0.0
-1
Stores "metadata" in the "meta" attribute.
def WriteMetadata(self, metadata, overwrite=True): if not overwrite and 'meta' in metadata: raise errors.KeyczarError('"meta" attribute already exists') self.dict['meta'] = str(metadata)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def metadata(self, metadata: Mapping[str, str]):\r\n self._metadata = metadata", "def metadata(self, metadata: Mapping[str, str]):\r\n self._metadata = metadata", "def save_meta(self):\n meta = self.serializer.dumps(self.meta)\n self.connection.hset(self.key, 'meta', meta)", "def ...
[ "0.82388836", "0.82388836", "0.80244505", "0.79681325", "0.79681325", "0.79681325", "0.79681325", "0.79681325", "0.79681325", "0.79681325", "0.7949334", "0.7949334", "0.79453015", "0.79420954", "0.7750861", "0.7638735", "0.76367134", "0.7634928", "0.7531547", "0.7531547", "0....
0.77829665
14
Stores "key" in an attribute having "version_number" as its name.
def WriteKey(self, key, version_number, encrypter=None): key = str(key) if encrypter: key = encrypter.Encrypt(key) # encrypt key info before outputting self.dict[str(version_number)] = key
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def key(self, key):\n self._key = key", "def key(self, key):\n self._key = key", "def GetKey(self, version_number):\n return self.dict[str(version_number)]", "def set_key(self, key):\n self.key = key", "def key(self, key: \"str\"):\n if key is None:\n raise ValueEr...
[ "0.6563795", "0.6563795", "0.6526074", "0.6468803", "0.6463895", "0.6432894", "0.6432894", "0.64274055", "0.64094186", "0.6351149", "0.6343363", "0.6325421", "0.6312413", "0.6272638", "0.62259", "0.62234473", "0.6221508", "0.6190918", "0.60981774", "0.6066344", "0.6054407", ...
0.655248
2
Removes the key for the given version.
def Remove(self, version_number): self.dict.pop(str(version_number))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delete_key(stub, key, version):\n try:\n response = stub.Delete(keyval_pb2.DeleteRequest(key=key, current_version=version))\n print(\"Delete result:\")\n print_response(response)\n except grpc.RpcError as exception:\n print_response(exception)", "def delete(self, key, version=None, client=None)...
[ "0.73336995", "0.70064837", "0.6818274", "0.6639974", "0.6605711", "0.65855974", "0.65600413", "0.6526923", "0.6525272", "0.65013343", "0.64504623", "0.64281476", "0.63520795", "0.63413286", "0.62992", "0.62985903", "0.629501", "0.629501", "0.6258015", "0.62471235", "0.623188...
0.75393444
0
Does nothing, as there is nothing to close.
def Close(self): pass
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def close(self):\n # This is a NOOP by default", "def close(self):\n # This is a NOOP by default", "def close(self):\n # By default, this is a NOOP", "def close(self) -> None:", "def close(self) -> None:", "def close(self) -> None:", "def close(self) -> None:", "def close(self) -...
[ "0.86721087", "0.86721087", "0.86031026", "0.83662945", "0.83662945", "0.83662945", "0.83662945", "0.83662945", "0.83662945", "0.83662945", "0.83662945", "0.8316518", "0.8314333", "0.8314333", "0.8314333", "0.82900107", "0.82900107", "0.82761484", "0.8266842", "0.82627857", "...
0.0
-1
Builds function to store for use later.
def julia(c): @nb.vectorize([nb.int32(nb.complex128)]) def f(z): """Function that takes a complex number and iterates it until the condition abs(z) >=2 is reached. Args: z: Complex Number Returns: n: Number of iterations of funct...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _generate_and_save_function(self, filename, expression, parameters):\n\n # check for / create the save folder for this expression\n folder = self.config_folder + '/' + filename\n abr_control.utils.os_utils.makedirs(folder)\n\n if self.use_cython is True:\n # binaries save...
[ "0.6407159", "0.56338996", "0.56034446", "0.5600402", "0.55900824", "0.54788285", "0.5458915", "0.54461914", "0.5430414", "0.5404748", "0.53803146", "0.5339527", "0.5328497", "0.53238577", "0.5319612", "0.5310285", "0.530024", "0.5299122", "0.52976996", "0.52963096", "0.52634...
0.0
-1
Function that takes a complex number and iterates it until the condition abs(z) >=2 is reached.
def f(z): if abs(z) > 2: return 1 else: n = 1 while abs(z) < 2: n += 1 if n > 100: return 0 else: z = z**2 + c return n
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def julia(c):\n @nb.vectorize([nb.int32(nb.complex128)])\n def f(z): \n \"\"\"Function that takes a complex number and iterates \n it until the condition abs(z) >=2 is reached.\n \n Args:\n z: Complex Number\n \n Returns:\n n: Number of i...
[ "0.731801", "0.68749225", "0.6166027", "0.60454065", "0.60033476", "0.5924999", "0.5923193", "0.5899605", "0.58629775", "0.5850724", "0.56272316", "0.55326694", "0.55326694", "0.55326694", "0.5530045", "0.5525653", "0.5487337", "0.54666233", "0.54666233", "0.54666233", "0.546...
0.6286582
2
Regenerate Julia plane. Populate self.plane with new points (x + y1j), using the stored attributes of xmax, xmin, xlen, ymax, ymin, and ylen to set plane dimensions and resolution. Reset the attribute fs to an empty list so that no functions are transforming the fresh plane.
def refresh(self, c): self.fs = [] super(JuliaPlane,self).__init__(self.xmin,self.xmax,self.xlen,self.ymin,self.ymax,self.ylen) self.apply(julia(self.c)) return self.plane
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def refresh(self):\n\n # delete the existing plane first before recreating our plane by resetting the plane to an empty plane\n self.plane = []\n # calling our create_plane() to redraw our plane.\n self.create_plane()", "def create_plane(self):\n\n # First we calculate our poin...
[ "0.6789748", "0.66232467", "0.60331184", "0.5831451", "0.5779728", "0.5649868", "0.54441464", "0.5423179", "0.5351419", "0.5345408", "0.53309864", "0.5285966", "0.5279662", "0.5263773", "0.5260069", "0.5238848", "0.51807237", "0.51702476", "0.5135503", "0.51050764", "0.506115...
0.6678224
1
Add the function f as the last element of self.fs. Apply f to every point of the plane, so that the resulting value of self.plane is the final output of the sequence of transformations collected in the list self.fs.
def apply(self, f): self.f = f self.fs.append(self.f) self.plane = f(self.plane) #Applies the function to the complex numbers return self.plane
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def apply(self, f):\n for v in self.vertices:\n v.x, v.y, v.z = f(v.coords())", "def add(self, next_f):\n next_f = _n.reshape(next_f, (self.n, 1))\n BroydenSolver.add(self, self.next_x - next_f)", "def map(self, f):\n self.append(Mapper(f))\n return self", "def r...
[ "0.61052746", "0.57206935", "0.56834114", "0.56821305", "0.5593881", "0.55881476", "0.55273324", "0.551477", "0.5480861", "0.54241025", "0.54240394", "0.53816116", "0.5310273", "0.53033745", "0.5257685", "0.5226698", "0.52099603", "0.5201503", "0.51970214", "0.51681215", "0.5...
0.80596006
0
Reset self.xmin, self.xmax, and self.xlen. Also reset self.ymin, self.ymax, and self.ylen. Regenerate the plane with the new range of the x and yaxes, then apply all transformations in fs in the correct order to the new points so that the resulting value of self.plane is the final output of the sequence of transformati...
def zoom(self,xmin,xmax,xlen,ymin,ymax,ylen): self.xmin = xmin self.xmax = xmax self.xlen = xlen self.ymin = ymin self.ymax = ymax self.ylen = ylen r = np.linspace(self.xmin, self.xmax,self.xlen) q = np.linspace(self.ymin, self.ymax, self.ylen) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_plane(self):\n\n # First we calculate our point increment for both the x and y values\n inc_x = (self.xmax - self.xmin)/(self.xlen - 1)\n inc_y = (self.ymax - self.ymin)/(self.ylen - 1)\n\n # This for-loop will add every x-value with every y-value, saving the values column wi...
[ "0.66370714", "0.62600905", "0.61423326", "0.61007524", "0.5964302", "0.5934426", "0.57791674", "0.5686457", "0.56633717", "0.5605181", "0.55986106", "0.5590322", "0.55817604", "0.5570547", "0.55616254", "0.55342376", "0.55335647", "0.552915", "0.5509257", "0.549671", "0.5494...
0.69319344
0
Makes a CSV file of parameters of Julia Plane.
def toCSV(self,filename): with open(filename,'w') as csvfile: np.savetxt("plane.csv",self.plane, delimiter = ',', fmt = '%.0f') #File to save plane in serperate file fi = csv.writer(csvfile, quotechar=' ', delimiter = ',', quoting = csv.QUOTE_MINIMAL) param = [[self.c],[self....
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def to_csv(parameters: List['Parameter'], filename: str):\n lines = [parameters[0].keys()]\n for parameter in parameters:\n lines.append(Parameter.to_strs(parameter.values()))\n FileUtiles.csvSave(filename, lines)", "def export_parameters():\n exp_folder = os.path.join(os.getcw...
[ "0.68331075", "0.6388364", "0.6275415", "0.61676794", "0.6147267", "0.602427", "0.60114926", "0.60057014", "0.59806526", "0.5978971", "0.5978356", "0.59731025", "0.5970811", "0.5961754", "0.5958078", "0.5901849", "0.5889835", "0.5877306", "0.58770436", "0.5804098", "0.5803845...
0.71641713
0
Reads a CSV file to initialize parameters of Julia Plane.
def fromCSV(self, filename): with open(filename, newline = '') as csvfile: read = csv.reader(csvfile, delimiter = ',') param = [] for row in read: param.append(row) self.c = complex(param[0][0]) self.xmin = int(param[1][0]) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def loadCSV(input_file):", "def from_csv(filename: str) -> List['Parameter']:\n parameters = []\n lines = FileUtiles.csvLoad(filename)\n keys = lines[0]\n for line_idx in range(1, len(lines)):\n values = lines[line_idx]\n parameters.append(Parameter(*((keys[idx],...
[ "0.7135305", "0.7034509", "0.67540026", "0.665479", "0.6642695", "0.64073724", "0.6382871", "0.63169265", "0.62921333", "0.6277636", "0.6221216", "0.62081826", "0.61492264", "0.60764724", "0.60603154", "0.6043205", "0.604271", "0.60336876", "0.60331684", "0.60092753", "0.5961...
0.7474922
0
Create a common UTM Zone for this facility from the emission locations. All emission sources input to Aermod must have UTM coordinates from a single UTM zone. This function will determine the single UTM zone (and hemisphere) to use. Parameter is the emissions location data frame.
def zone2use(el_df): # First, check for any utm zones provided by the user in the emission location file utmzones_df = el_df["utmzone"].loc[el_df["location_type"] == "U"] if utmzones_df.shape[0] > 0: # there are some; find the smallest one utmzones_...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def UTMZone(x,y):\n\n #take longitudinal coordinate and add 180, then divide by 6 and round up\n lon = int(np.ceil((x + 180)/6))\n \n #determine whether y is in the Northern or Southern Hemisphere\n if y > 0:\n code = 326\n else:\n code = 327\n \n #return epsg of the utm zone\...
[ "0.5641798", "0.561104", "0.5444022", "0.53897405", "0.5191188", "0.5156333", "0.50552934", "0.5047819", "0.49569675", "0.49503422", "0.49464965", "0.48873118", "0.48630908", "0.47566175", "0.47535148", "0.47495285", "0.4746261", "0.47406447", "0.47209072", "0.47020352", "0.4...
0.65852296
0
This method computes the center of a facility from the emission location UTM coordinates. The overall facility UTM zone and hemisphere are needed.
def center(sourcelocs, facutmznum, fachemi): # Fill up lists of x and y coordinates of all source vertices vertx_l = [] verty_l = [] for index, row in sourcelocs.iterrows(): vertx_l.append(row["utme"]) verty_l.append(row["utmn"]) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_center(self,lonlat=False):\n lon, lat = np.asarray(self.rotator.rots[0][0:2])*180/pi\n if lonlat: return lon,lat\n else: return pi/2.-lat*dtor, lon*dtor", "def get_center(self):\n lon, lat = self.coordinates\n\n dimx = lon.shape[0]\n dimy = lon.shape[1]\n \n ...
[ "0.6651469", "0.6581956", "0.6572228", "0.6456673", "0.6403586", "0.6330363", "0.62878096", "0.62631994", "0.62522167", "0.6206155", "0.62024975", "0.61712456", "0.6143188", "0.61355776", "0.6120893", "0.61165667", "0.6114143", "0.60919553", "0.6079423", "0.60287684", "0.6015...
0.5619967
79
Callback for processing the input arguments
def notifyCommand(self, argv, extraData): if len(argv) > 0: # decode the command cmd = argv[0].upper() if cmd == "H" or cmd == "HELP": self.helpCmd(argv) elif cmd == "Q" or cmd == "QUIT": self.quitCmd(argv) elif cmd == "F" or cmd == "FRAME1": self.frame1Cmd(argv...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def handle_arguments(self, args):\n debug(\"BloomGenerator.handle_arguments: got args -> \" + str(args))", "def processInputs(self):", "def parse_arguments(args):", "def process_inputs(self, inputs):", "def _process_inputs(args, kwargs) -> Any:\n if args and kwargs:\n input_values = (*args, kwar...
[ "0.7350858", "0.69940656", "0.6987147", "0.682887", "0.6651407", "0.6624735", "0.658684", "0.65253735", "0.6506362", "0.650612", "0.6489942", "0.6484882", "0.6440939", "0.6361281", "0.6283767", "0.6251718", "0.62034184", "0.6191159", "0.61824304", "0.6152999", "0.61485565", ...
0.0
-1
initialise the system configuration
def initConfiguration(): UTIL.SYS.s_configuration.setDefaults([ ["SYS_COLOR_LOG", "1"], ["HOST", "127.0.0.1"], ["NCTRS_TM_SERVER_PORT", "2502"], ["NCTRS_TM_DU_VERSION", "V0"], ["SPACECRAFT_ID", "758"]])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def init_config(self):\n pass", "def _init_config_(self):\n self._config= {}", "def __init__(self):\n\n self.config = load_config()\n self.set_env_var()", "def _init_config(self):\n self.config = self.config_template.specialize()\n print('MMH CONFIG:\\n' + str(self.c...
[ "0.8094546", "0.77001184", "0.7570952", "0.74955934", "0.74398345", "0.7227195", "0.72174156", "0.7198415", "0.71467584", "0.71281415", "0.7071074", "0.7052519", "0.69809955", "0.69255906", "0.69250774", "0.69187146", "0.6918431", "0.69015133", "0.68940824", "0.6867164", "0.6...
0.7534286
3
create the NCTRS TM sender
def createTMsender(): global s_tmSender nctrsTMfields = GRND.NCTRS.NCTRStmFields() nctrsTMfields.spacecraftId = int(UTIL.SYS.s_configuration.SPACECRAFT_ID) s_tmSender = TMsender( portNr=int(UTIL.SYS.s_configuration.NCTRS_TM_SERVER_PORT), nctrsTMfields=nctrsTMfields) if not s_tmSender.openConnectPort(U...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def send_message(self):\n self.preprocess_text()\n message_text = self.create_message_text()\n \n telnyx.Message.create(\n from_=configs.source_number,\n to=self.destination_number,\n text=message_text,\n )", "def transmit_mqtt(form_obj):\n # Pr...
[ "0.59782004", "0.56882566", "0.56780106", "0.56402", "0.5576617", "0.55521804", "0.54989284", "0.54920447", "0.54320085", "0.5403926", "0.53929114", "0.5387494", "0.5379403", "0.53553426", "0.535297", "0.5349695", "0.5331534", "0.53287935", "0.5304764", "0.52779084", "0.52779...
0.8348514
0
Read the settings stored in settings.ini
def read_settings(args): # Default values state = 48 district = 7 leg_body = 'US-REP' census_year = '2016' election_year = '2018' voting_precincts = None voting_results = None # Set values in settings.ini settings = configparser.ConfigParser() settings.read('...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def read_settings(self):\n self.settings = read_settings(self.settings_path)", "def read_settings():\n settings_path = join(dirname(dirname(__file__)), '.settings')\n filename = settings_path\n settings = configparser.ConfigParser()\n settings.read(filename)\n return settings", "def readS...
[ "0.83010226", "0.78955054", "0.7801969", "0.74450874", "0.73916", "0.739083", "0.7371757", "0.7266216", "0.7176094", "0.7175176", "0.7165704", "0.7018155", "0.6972117", "0.6971375", "0.69203275", "0.6844236", "0.6840039", "0.6834861", "0.6833824", "0.6825702", "0.6812152", ...
0.6972436
12
Define command line arguments using argparse
def get_command_line_args(): _version=VERSION parser = argparse.ArgumentParser(description='Build stats for a given Congressional District') parser.add_argument('-s','--state', help='State of District, e.g., TX') parser.add_argument('-d','--district', help='District No., e.g., 7') parser.add_ar...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parse_arguments():\n\n parser = argparse.ArgumentParser()\n\n parser.add_argument(\"--accessions\", help=\"A json file with old/new family mapppings\")\n parser.add_argument(\"--add-header\", help=\"Print descriptive header\",\n action=\"store_true\", default=False)\n parser....
[ "0.75335366", "0.7484965", "0.7452218", "0.74399346", "0.7421572", "0.7373468", "0.73693675", "0.7324334", "0.72851956", "0.7284837", "0.7281277", "0.72800857", "0.72673094", "0.7242497", "0.7232415", "0.72276735", "0.72204614", "0.720623", "0.7196505", "0.71851146", "0.71733...
0.0
-1
create a directory with mkdir p functionality
def mkdir_p(path): try: os.makedirs(path) except OSError as exc: # Python >2.5 if exc.errno == errno.EEXIST and os.path.isdir(path): pass else: raise
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def mkdir(path):", "def dirmaker(dirp):\n try:\n if not os.path.exists(dirp):\n os.makedirs(dirp)\n except:\n pass", "def mkdir_p(path):\n\n if os.path.exists(path):\n return\n\n par = os.path.split(path)[0]\n if os.path.exists(par):\n os.mkdir(path)\n ...
[ "0.86276454", "0.8200758", "0.8141277", "0.81288034", "0.8013537", "0.8002217", "0.8002217", "0.79736423", "0.7947863", "0.7943297", "0.7871954", "0.78506297", "0.78488886", "0.78294694", "0.7809563", "0.7793493", "0.77872044", "0.77863455", "0.77817667", "0.77720636", "0.774...
0.7412425
93
Download a file given the url and filename
def download_file(url, dl_filename): print( url ) url_object=urlopen(url) dl_file_object=open(dl_filename,'wb') meta = url_object.info() file_size = 0 if int(meta.get("Content-Length", -1)) > 0: file_size = int(meta.get("Content-Length", -1)) if file_size == 0: print...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def download_file(url, fname):\n urllib.request.urlretrieve(url, fname)", "def download_file(self, url, filename):\n r = requests.get(url, stream=True)\n r.raise_for_status()\n\n with open(filename, 'wb') as f:\n for chunk in r.iter_content():\n if chunk:\n ...
[ "0.86815673", "0.85567355", "0.8532376", "0.851278", "0.84818137", "0.84144884", "0.8399811", "0.8363282", "0.834923", "0.8240727", "0.8190914", "0.8178708", "0.81775254", "0.8142411", "0.81401575", "0.8132571", "0.8059495", "0.80476326", "0.79679495", "0.79101944", "0.788931...
0.0
-1
extracts archive to dst
def extract_all(fn,dst="."): if tarfile.is_tarfile(fn): with tarfile.open(fn,'r') as tf: tf.extractall(dst) tf.close() elif zipfile.is_zipfile(fn): with zipfile.ZipFile(fn, 'r') as zf: zf.extractall(dst) zf.close() else: prin...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def extract_file(self):\n# path_destination = os.path.join(\n# self.root, self.resources.replace(\".zip\", \"\"))\n# os.makedirs(path_destination, exist_ok=True)\n shutil.unpack_archive(os.path.join(\n self.root, self.resources), self.root)\n os.remove(os.path.j...
[ "0.72481894", "0.7095523", "0.7076616", "0.6846041", "0.68247837", "0.67138076", "0.66493815", "0.6496728", "0.64050615", "0.63391876", "0.63179517", "0.63128036", "0.6307124", "0.6253789", "0.62210387", "0.61314017", "0.61285067", "0.61166734", "0.61009437", "0.60778505", "0...
0.69542867
3
Return the path and file name for the district file
def get_district_excel_filename(state=48, district=7, leg_body='US-REP'): state = "{0:0>2}".format(state) district = "{0:0>2}".format(district) state_abbr = str(states.mapping('fips', 'abbr')[state]) district_abbr = leg_body + '-' + state_abbr + district data_path = 'static/data/' ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_district_geojson_filename(state=48, district=7, leg_body='US-REP'):\r\n state = \"{0:0>2}\".format(state)\r\n district = \"{0:0>2}\".format(district)\r\n \r\n state_abbr = str(states.mapping('fips', 'abbr')[state])\r\n district_abbr = leg_body + '-' + state_abbr + district\r\n geojson_pat...
[ "0.725018", "0.7071918", "0.6621741", "0.62491006", "0.6232871", "0.623212", "0.61390775", "0.61094725", "0.6040661", "0.5974864", "0.59741986", "0.5962593", "0.5944961", "0.5944084", "0.5917075", "0.5908154", "0.5887308", "0.586962", "0.58482647", "0.5822973", "0.5816471", ...
0.6960386
2
Return the path and file name for the district file
def get_district_geojson_filename(state=48, district=7, leg_body='US-REP'): state = "{0:0>2}".format(state) district = "{0:0>2}".format(district) state_abbr = str(states.mapping('fips', 'abbr')[state]) district_abbr = leg_body + '-' + state_abbr + district geojson_path = 'static/geojson/'...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_district_file(state=48, district=7, leg_body='US-REP'):\r\n\r\n district_file = get_district_geojson_filename(\r\n state=state, district=district, leg_body=leg_body)\r\n geojson_path = 'static/geojson/' \r\n state = \"{0:0>2}\".format(state)\r\n district = \"{0:0>2}\".format(district...
[ "0.7071918", "0.6960386", "0.6621741", "0.62491006", "0.6232871", "0.623212", "0.61390775", "0.61094725", "0.6040661", "0.5974864", "0.59741986", "0.5962593", "0.5944961", "0.5944084", "0.5917075", "0.5908154", "0.5887308", "0.586962", "0.58482647", "0.5822973", "0.5816471", ...
0.725018
0
Return the path and filename for the voting precincts file
def get_voting_precincts_geojson_filename(state=48, district=7, leg_body='US-REP'): state = "{0:0>2}".format(state) district = "{0:0>2}".format(district) state_abbr = str(states.mapping('fips', 'abbr')[state]) vps_abbr = leg_body + '-' + state_abbr + district + '-voting-precincts' geojson...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_upload_to(instance, filename):\n\n if instance.rating_decision:\n return 'issuers/%s/rating_decision/%s/%s'\\\n % (\n instance.issuer.lei,\n instance.rating_decision.id,\n filename)\n else:\n return 'issuers/%s/%s' % (i...
[ "0.6464224", "0.6236453", "0.618616", "0.61004966", "0.610008", "0.60459584", "0.60401314", "0.60294414", "0.5993871", "0.5990572", "0.5941456", "0.5926694", "0.5891428", "0.58843124", "0.5859842", "0.58479047", "0.58403456", "0.582544", "0.5823106", "0.578778", "0.575451", ...
0.54814255
55
Return the path and filename containing all the voting precincts for a state
def get_statewide_voting_precincts_geojson_filename(state=48): state = "{0:0>2}".format(state) state_abbr = str(states.mapping('fips', 'abbr')[state]) vps_abbr = state_abbr + '-voting-precincts' geojson_path = 'static/geojson/' vps_file = geojson_path + vps_abbr + '.geojson' ret...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_statewide_voting_precincts(state=48):\r\n vps_file = get_statewide_voting_precincts_geojson_filename(state)\r\n geojson_path = 'static/geojson/' \r\n state = \"{0:0>2}\".format(state)\r\n \r\n if not os.path.isfile(vps_file):\r\n print( \"Downloading statewide voting precincts file\")...
[ "0.6847489", "0.6322313", "0.5351677", "0.5299917", "0.52940583", "0.5193073", "0.5155988", "0.5153351", "0.5126342", "0.51263374", "0.50306314", "0.5029869", "0.50138694", "0.49693334", "0.4967153", "0.49525315", "0.4944202", "0.49423268", "0.4942085", "0.4919951", "0.491437...
0.6948288
0
Return the path and filename to the block groups for a state
def get_state_blockgroups_geojson_filename(state=48): state = "{0:0>2}".format(state) state_abbr = str(states.mapping('fips', 'abbr')[state]) geojson_path = 'static/geojson/' blockgroups_file = geojson_path + state_abbr + '-blockgroups.geojson' return blockgroups_file
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_state_blockgroups_file(state=48, district=7, leg_body='US-REP', year='2015'):\r\n\r\n blockgroups_file = get_state_blockgroups_geojson_filename(state=state)\r\n \r\n state = \"{0:0>2}\".format(state)\r\n district = \"{0:0>2}\".format(district)\r\n \r\n print( blockgroups_file )\r\...
[ "0.6628989", "0.5945026", "0.5553919", "0.550096", "0.5482267", "0.5376674", "0.5358737", "0.5352847", "0.53303385", "0.531927", "0.5284342", "0.5280088", "0.52258277", "0.52131325", "0.52055347", "0.51740414", "0.5135073", "0.51197493", "0.50902367", "0.507188", "0.5070656",...
0.72727156
0
Return the path and filename of the geojson file containing the blockgroups that overlap with the disctrict
def get_bgs_in_district_geojson_filename(state=48, district=7, leg_body='US-REP'): state = "{0:0>2}".format(state) district = "{0:0>2}".format(district) state_abbr = str(states.mapping('fips', 'abbr')[state]) district_abbr = leg_body + '-' + state_abbr + district geojson_path = 'static/ge...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_state_blockgroups_file(state=48, district=7, leg_body='US-REP', year='2015'):\r\n\r\n blockgroups_file = get_state_blockgroups_geojson_filename(state=state)\r\n \r\n state = \"{0:0>2}\".format(state)\r\n district = \"{0:0>2}\".format(district)\r\n \r\n print( blockgroups_file )\r\...
[ "0.6473774", "0.6321107", "0.6056092", "0.6023398", "0.58103925", "0.5692038", "0.56437486", "0.55551565", "0.5517348", "0.54647803", "0.53630453", "0.52194536", "0.5206102", "0.5192708", "0.51699823", "0.51065356", "0.508553", "0.5063602", "0.5030784", "0.49997425", "0.49962...
0.63579464
1
Return the path and filename of the json file containing the blockgroups that overlap with the disctrict
def get_bgs_in_district_json_filename(state=48, district=7, leg_body='US-REP'): state = "{0:0>2}".format(state) district = "{0:0>2}".format(district) state_abbr = str(states.mapping('fips', 'abbr')[state]) district_abbr = leg_body + '-' + state_abbr + district data_path = 'static/data/' bg...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_state_blockgroups_file(state=48, district=7, leg_body='US-REP', year='2015'):\r\n\r\n blockgroups_file = get_state_blockgroups_geojson_filename(state=state)\r\n \r\n state = \"{0:0>2}\".format(state)\r\n district = \"{0:0>2}\".format(district)\r\n \r\n print( blockgroups_file )\r\...
[ "0.59857607", "0.57628256", "0.57070804", "0.5442805", "0.54146135", "0.5373559", "0.5313305", "0.5201932", "0.519445", "0.51761466", "0.5057297", "0.5030228", "0.501069", "0.49869752", "0.49846873", "0.49711978", "0.49624556", "0.4943216", "0.49394986", "0.4935583", "0.49180...
0.5755218
2
Download the shape file for the disctrict
def get_district_file(state=48, district=7, leg_body='US-REP'): district_file = get_district_geojson_filename( state=state, district=district, leg_body=leg_body) geojson_path = 'static/geojson/' state = "{0:0>2}".format(state) district = "{0:0>2}".format(district) if not o...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def download(self):\n pass", "def download(self):\n pass", "def get_shapefile(self, shpname: str):\r\n self.get_geojson()\r\n self.geojson.to_shp(shpname)", "def download(self, session):\n target_path = self.get_target_full_dir()\n os.chdir(target_path)\n sche...
[ "0.61043525", "0.61043525", "0.6094013", "0.60805243", "0.60047865", "0.59890455", "0.59782773", "0.59318954", "0.58450407", "0.5836857", "0.574183", "0.5709165", "0.5691791", "0.5678586", "0.56708246", "0.56000847", "0.55884016", "0.5575232", "0.55642134", "0.55534035", "0.5...
0.53964114
37
Download the shape file with the statewide voting precincts
def get_statewide_voting_precincts(state=48): vps_file = get_statewide_voting_precincts_geojson_filename(state) geojson_path = 'static/geojson/' state = "{0:0>2}".format(state) if not os.path.isfile(vps_file): print( "Downloading statewide voting precincts file") # TODO down...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_statewide_voting_precincts_geojson_filename(state=48):\r\n state = \"{0:0>2}\".format(state)\r\n \r\n state_abbr = str(states.mapping('fips', 'abbr')[state])\r\n vps_abbr = state_abbr + '-voting-precincts'\r\n geojson_path = 'static/geojson/'\r\n\r\n vps_file = geojson_path + vps_abbr + ...
[ "0.6450894", "0.6127803", "0.57305235", "0.54192525", "0.54037565", "0.5365361", "0.5345263", "0.52702177", "0.5251273", "0.52288437", "0.515574", "0.5103718", "0.5007659", "0.5004499", "0.4989179", "0.49741122", "0.49535117", "0.49394768", "0.4883794", "0.48805475", "0.48643...
0.72121114
0
Download the file, from the Census Bureau, containing the blockgroups for an entire state
def get_state_blockgroups_file(state=48, district=7, leg_body='US-REP', year='2015'): blockgroups_file = get_state_blockgroups_geojson_filename(state=state) state = "{0:0>2}".format(state) district = "{0:0>2}".format(district) print( blockgroups_file ) if not os.path.isf...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_blockgroup_census_data(api, fields, census_data = {}, state=48, district=7, leg_body='US-REP', year='2015'):\r\n blockgroup_key = 'bg'\r\n if year not in census_data.keys():\r\n census_data[year] = { blockgroup_key: {} }\r\n else:\r\n if blockgroup_key not in census_data[year].keys()...
[ "0.6653839", "0.64528793", "0.58640003", "0.5745723", "0.5719516", "0.56700283", "0.56666577", "0.56636924", "0.5656115", "0.5540057", "0.55270064", "0.54836065", "0.5482237", "0.547984", "0.5452949", "0.5435761", "0.5337991", "0.5328596", "0.53206915", "0.53067183", "0.53053...
0.7388399
0
Find the blockgroups that intersect with a legislative district, e.g., US Congressional District.
def find_blockgroups_in_district(state=48, district=7, leg_body='US-REP', year='2015', debug_is_on=False): shapfile_path = None bgs_in_district_GeoJSON = get_bgs_in_district_geojson_filename(state=state, district=district, leg_body=leg_body) bgs_in_district_JSON = get_bgs_in_district_json_filename(state=...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def find_voting_precincts_in_district(state=48, district=7, leg_body='US-REP'):\r\n vps_in_district_GeoJSON = get_voting_precincts_geojson_filename(\r\n state=state, district=district, leg_body=leg_body)\r\n \r\n if not os.path.isfile(vps_in_district_GeoJSON):\r\n voting_precincts_file ...
[ "0.6244344", "0.57804626", "0.5753308", "0.5734239", "0.5366872", "0.53039515", "0.5282073", "0.52118653", "0.5208916", "0.5207756", "0.5122046", "0.5101411", "0.50755763", "0.5074011", "0.50446886", "0.5027455", "0.5015215", "0.49994236", "0.49861485", "0.49796596", "0.49756...
0.7497956
0
Find the voting precincts that are in a district
def find_voting_precincts_in_district(state=48, district=7, leg_body='US-REP'): vps_in_district_GeoJSON = get_voting_precincts_geojson_filename( state=state, district=district, leg_body=leg_body) if not os.path.isfile(vps_in_district_GeoJSON): voting_precincts_file = get_statewide...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_precinct_votes():\n c.execute(\n \"SELECT Contest_Name, County, Precinct, Sum(Total_Votes) as Votes from v group by County, Precinct, Contest_Name order by Votes ASC\")\n return c.fetchall()", "def make_voting_results_data(categories, district_data = {}, state=48, district=7, leg_body='US-RE...
[ "0.6696587", "0.6194907", "0.57451546", "0.5651497", "0.5444455", "0.52334946", "0.5187955", "0.5183999", "0.5177762", "0.5176289", "0.5124718", "0.51247114", "0.5093308", "0.50823563", "0.5078896", "0.5072995", "0.50637305", "0.5031146", "0.5029899", "0.49966052", "0.4977888...
0.7770079
0
Return the centroid of a district
def get_district_centroid(state=48, district=7, leg_body='US-REP', year='2015'): district_file = get_district_geojson_filename( state=state, district=district, leg_body=leg_body) get_district_file(state=state, district=district, leg_body=leg_body) district = gpd.read_file(district_fi...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def centroid(self): # -> BaseGeometry:\n ...", "def centroid(self):\n return _property_geo(arctern.ST_Centroid, self)", "def centroid(self) -> PointValue:\n return ops.GeoCentroid(self).to_expr()", "def getCentroid(self):\r\n return self._centroid", "def getCentroid(self):\n ...
[ "0.74505466", "0.7435831", "0.72509575", "0.7125967", "0.7018645", "0.70144373", "0.69940114", "0.69814104", "0.6971411", "0.69401646", "0.6866047", "0.68502235", "0.683639", "0.6806046", "0.6785718", "0.6762197", "0.6724832", "0.6712664", "0.6709017", "0.6675666", "0.6662785...
0.8199656
0
Retrieve the census data for the block groups in a District
def get_blockgroup_census_data(api, fields, census_data = {}, state=48, district=7, leg_body='US-REP', year='2015'): blockgroup_key = 'bg' if year not in census_data.keys(): census_data[year] = { blockgroup_key: {} } else: if blockgroup_key not in census_data[year].keys(): ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_district_census_data(api, fields, census_data = {}, state=48, district=7, leg_body='US-REP', year='2015'):\r\n district_key = 'district'\r\n if year not in census_data.keys():\r\n census_data[year] = { district_key: {} }\r\n else:\r\n if district_key not in census_data[year].keys():\...
[ "0.704894", "0.69166845", "0.6479016", "0.64342415", "0.60648763", "0.6059544", "0.59281117", "0.5923906", "0.5815242", "0.57750034", "0.5763054", "0.5758142", "0.562634", "0.5584639", "0.5564932", "0.553517", "0.54872394", "0.54436797", "0.5401207", "0.53969693", "0.53774947...
0.79287934
0
Retrieve the census data for the entire district
def get_district_census_data(api, fields, census_data = {}, state=48, district=7, leg_body='US-REP', year='2015'): district_key = 'district' if year not in census_data.keys(): census_data[year] = { district_key: {} } else: if district_key not in census_data[year].keys(): ce...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_data_from_db(district):\n data_frames = get_athena_dataframes()\n df_result = copy.copy(data_frames['new_covid_case_summary'])\n df_result = df_result[df_result['district'] == district.lower()]\n df_result = df_result.loc[:, :'deceased']\n df_result.dropna(axis=0, how='any', inplace=True)\n ...
[ "0.7228065", "0.7227036", "0.7215744", "0.6900608", "0.64591473", "0.63383484", "0.62536275", "0.6246952", "0.6149221", "0.61442184", "0.61019313", "0.6055664", "0.60189295", "0.5955576", "0.59410846", "0.5902425", "0.5897042", "0.5843112", "0.5842985", "0.5830057", "0.581874...
0.7391904
0
Convert data to json
def to_json(data, out_filename='static/data/out.json'): with open(out_filename, 'w') as outfile: json.dump(data, outfile)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def tojson(self, data):\n return json.dumps(data)", "def to_json(self, data):\n return json.dumps(data)", "def convertToJson(self, data):\n return self.__utils.convertToJson(data)", "def toJson(self, data):\n\t\treturn json.dumps(data, default=json_util.default)", "def json(self, data)...
[ "0.85395205", "0.8517355", "0.84530365", "0.84513795", "0.8121784", "0.8002126", "0.79125845", "0.78933734", "0.77771497", "0.7548608", "0.7506669", "0.7486906", "0.74605846", "0.72845453", "0.72683597", "0.71708935", "0.71394587", "0.7124676", "0.7051216", "0.7001155", "0.69...
0.6923498
22
Return the fields in a census table
def get_census_fields_by_table(table, year='2015'): variables_file = 'static/data/variables_' + year + '.json' if not os.path.isfile(variables_file): url = 'https://api.census.gov/data/' + year + '/acs/acs5/variables.json' download_file(url, variables_file) fields = [] labels = {...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_census_params_by_county(columns):\n return {\n 'get': ','.join(columns),\n 'for': 'county:*',\n 'in': 'state:*'\n }", "def _get_fields(self, table):\n fields = list()\n for column in table.columns:\n fields.append({'id': column.name, 'type': str(column.type)})\n ...
[ "0.6081307", "0.5731482", "0.56552404", "0.5635112", "0.5527317", "0.54978526", "0.5469839", "0.5436787", "0.5433822", "0.539986", "0.53911793", "0.5386296", "0.5374896", "0.5369357", "0.53278196", "0.53242815", "0.5323225", "0.5310881", "0.52383465", "0.5238108", "0.5220094"...
0.71227324
0
Store the raw census data in a json file and return the census data
def get_census_data(api, category, fields, district_config_file = 'static/data/district.json', census_data_file='static/data/district-census-data.json', state=48, district=7, leg_body='US-REP', year='2015'): # If district config file exists, only get the census data that's not there ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parse_cluedata(input_path: str):\n\n\twith open(input_path, 'r') as clue_backup:\n\t\tjson_structure = json.loads(clue_backup.read())\n\n\tassert 'data' in json_structure, \".cluedata file does not have the expected structure\"\n\n\treturn json_structure", "def _parse_and_store_geojson(filename):\n ds = D...
[ "0.60936487", "0.6086147", "0.60323715", "0.59826285", "0.59492034", "0.591327", "0.5887552", "0.5865722", "0.5693939", "0.5684255", "0.56838477", "0.56676584", "0.5661993", "0.56538886", "0.56452644", "0.56280714", "0.56234634", "0.5616633", "0.5601072", "0.5584741", "0.5569...
0.63257444
0
Make the census data on age for a district
def make_age_data(api, district_data = {}, categories = {'Age': {} }, state=48, district=7, leg_body='US-REP', year='2015'): category='Age' district_key='district' blockgroup_key='bg' precinct_key='precinct' tract_key='tract' total_census_field = 'B01001_001E' age_tab...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_age_fields():\n under_18_fields = CensusFields.get_under_18_fields()\n\n age_18_to_29_fields = [ \n 'B01001_007E', # Male:!!18 and 19 years\n 'B01001_008E', # Male:!!20 years\n 'B01001_009E', # Male:!!21 years\n 'B010...
[ "0.6409517", "0.622455", "0.60268164", "0.5957785", "0.5914849", "0.5782152", "0.5721964", "0.5643782", "0.5600801", "0.5571286", "0.5469414", "0.54492825", "0.5433194", "0.5431161", "0.5422123", "0.5404909", "0.53833455", "0.53805804", "0.53786755", "0.5366214", "0.53632236"...
0.7490717
0
Make the income data for a district
def make_income_data(api, district_data = {}, categories = {'Income': { }}, state=48, district=7, leg_body='US-REP', year='2015'): category='Income' district_key='district' blockgroup_key='bg' precinct_key='precinct' tract_key='tract' income_table = 'B19001' total_househ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def income(self, fromdt, todt):\r\n return self._buildTransDict(fromdt, todt, Income)", "def make_edu_data( api, district_data = {}, categories = {'Education': { }}, \r\n state=48, district=7, leg_body='US-REP', year='2015' ):\r\n category='Education'\r\n\r\n district_key='district'\r\n block...
[ "0.62920475", "0.6113353", "0.6042079", "0.6008246", "0.60012704", "0.5913185", "0.5710172", "0.56811994", "0.56415194", "0.5636729", "0.55943716", "0.55854857", "0.55605316", "0.5478098", "0.54762095", "0.5367531", "0.534352", "0.5335575", "0.5334637", "0.5333553", "0.532723...
0.7593264
0
Make the race data for a district
def make_race_data( api, district_data = {}, categories = {'Race': { }}, state=48, district=7, leg_body='US-REP', year='2015' ): category='Race' district_key='district' blockgroup_key='bg' precinct_key='precinct' tract_key='tract' race_table = 'B02001' hispanic_table = ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update_race_data():\n try:\n # get data from client request\n client_data = request.get_json()\n print('\\n------- update_race_data route beginning -------')\n print(f\"recived: \\n {client_data}\")\n\n # race is from databse, while client_data is from front end\n r...
[ "0.5701887", "0.5653621", "0.5564876", "0.5531452", "0.54738396", "0.5387711", "0.5374153", "0.53194153", "0.52401155", "0.5143003", "0.5142375", "0.5136191", "0.5128317", "0.5084612", "0.5083692", "0.5064338", "0.50413984", "0.50080615", "0.4993394", "0.49897987", "0.4975774...
0.73013127
0
Make the education data for a district
def make_edu_data( api, district_data = {}, categories = {'Education': { }}, state=48, district=7, leg_body='US-REP', year='2015' ): category='Education' district_key='district' blockgroup_key='bg' precinct_key='precinct' tract_key='tract' edu_table = 'B15002' edu_total...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def make_age_data(api, district_data = {}, categories = {'Age': {} },\r\n state=48, district=7, leg_body='US-REP', year='2015'):\r\n category='Age'\r\n \r\n district_key='district'\r\n blockgroup_key='bg'\r\n precinct_key='precinct'\r\n tract_key='tract'\r\n\r\n total_census_field = 'B0...
[ "0.6528546", "0.64214766", "0.6284206", "0.6146757", "0.6046286", "0.5997275", "0.5915004", "0.5872272", "0.5831816", "0.57958627", "0.57088965", "0.5667612", "0.55951506", "0.5594973", "0.5593508", "0.5552994", "0.55382633", "0.5506498", "0.5488644", "0.54758483", "0.5475848...
0.75078404
0