query stringlengths 9 9.05k | document stringlengths 10 222k | metadata dict | negatives listlengths 30 30 | negative_scores listlengths 30 30 | document_score stringlengths 4 10 | document_rank stringclasses 2
values |
|---|---|---|---|---|---|---|
Test for instantiation of the ``Rule`` model. | def test_instantiation(self):
rule = Rule()
self.assertTrue(rule) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_create_rule(self):\n pass",
"def __init__(self, rule):\n Rule.__init__(self)\n self.__rule = rule",
"def __init__(self, rule):\n Rule.__init__(self)\n self.__rule = rule",
"def __init__(self, rule):\n Rule.__init__(self)\n self.__rule = rule",
"def ... | [
"0.7313684",
"0.6469982",
"0.6469982",
"0.6469982",
"0.6469982",
"0.6469982",
"0.63850594",
"0.628997",
"0.6197933",
"0.6029095",
"0.59955287",
"0.5991031",
"0.59792507",
"0.59547937",
"0.5930207",
"0.5925317",
"0.5880562",
"0.5877722",
"0.5866745",
"0.58523893",
"0.58261657"... | 0.84185743 | 0 |
Send the EVT_PAGE_CHANGE to the parent. | def notify(self):
if self.GetParent() is not None:
evt = PageChangeEvent(from_page=self.GetName(),
to_page="page_annot_actions",
fct="")
evt.SetEventObject(self)
wx.PostEvent(self.GetParent(), evt) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def on_page_changed(e):\n\n e.Skip()",
"def increase_page_view(sender, **kwargs):\n pass",
"def page_changed(self):\n if self.current >= 0:\n if self.not_again:\n self.not_again = False\n return\n ok = self.check_oldpage(self.current)\n ... | [
"0.689601",
"0.6461242",
"0.6421442",
"0.6392836",
"0.6322969",
"0.6085892",
"0.6076335",
"0.59358543",
"0.593561",
"0.58878964",
"0.58610463",
"0.56854624",
"0.56325436",
"0.5629117",
"0.5589139",
"0.55850923",
"0.55808693",
"0.55653816",
"0.55362064",
"0.54971236",
"0.54620... | 0.73064005 | 0 |
Kernels used for image processing | def __set_kernels(self):
self.clahe = cv2.createCLAHE(clipLimit=2.0, tileGridSize=(8,8)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __initializeKernels(self):\n # FFT plans:\n self.__initializeDopplerIfftPlan() # for Doppler Ifft\n self.__initializeDemodIfftPlan() # for demod \n self.__initializeSNRFftPlan() # for findSNR\n \n # GPU kernels\n kernel = self.CudaKernels\n ## kernels for... | [
"0.65704846",
"0.63623714",
"0.6350224",
"0.63449",
"0.6283938",
"0.62444794",
"0.62142783",
"0.621017",
"0.6162318",
"0.6158445",
"0.6121947",
"0.610337",
"0.6046993",
"0.60449284",
"0.60079765",
"0.60040545",
"0.5997285",
"0.59854794",
"0.5929281",
"0.5919657",
"0.59162563"... | 0.6666448 | 0 |
Masks a region specified by clockwise vertices. | def __mask_region(self, img, vertices):
mask = np.zeros_like(img)
if len(img.shape) > 2:
channel_count = img.shape[2] # i.e. 3 or 4 depending on your image
ignore_mask_color = (255,) * channel_count
else:
ignore_mask_color = 255
cv2.fillConvexPoly... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_region(img, vertices):\n mask = np.zeros_like(img)\n channel_count = img.shape[2]\n match_mask_color = (255,) * channel_count\n cv2.fillPoly(mask, vertices, match_mask_color)\n\n masked_img = cv2.bitwise_and(img, mask)\n\n new_mask = np.zeros(masked_img.shape[:2], np.uint8)\n\n bg = np... | [
"0.6975762",
"0.6812824",
"0.6569466",
"0.6540162",
"0.6416328",
"0.6416328",
"0.6416328",
"0.6416328",
"0.6416328",
"0.6416328",
"0.6416328",
"0.6408665",
"0.6395541",
"0.635599",
"0.6347455",
"0.6347455",
"0.6347455",
"0.6347455",
"0.6347247",
"0.63158244",
"0.63158244",
... | 0.70814556 | 0 |
Enhances/sharpens the image using a clahe kernel | def __enhance_image(self, img):
blue = self.g.clahe.apply(img[:,:,0])
green = self.g.clahe.apply(img[:,:,1])
red = self.g.clahe.apply(img[:,:,2])
img[:,:,0] = blue
img[:,:,1] = green
img[:,:,2] = red
return img | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def cs4243_filter(image, kernel):\n Hi, Wi = image.shape\n Hk, Wk = kernel.shape\n filtered_image = np.zeros((Hi, Wi))\n\n ###Your code here####\n # pad image to handle border pixels\n pad_height = (int)((Hk - 1)/2)\n pad_width = (int)((Wk - 1)/2)\n image_pad = pad_zeros(image, pad_height, ... | [
"0.675808",
"0.6728044",
"0.649936",
"0.64722973",
"0.64588404",
"0.6331838",
"0.6272194",
"0.626642",
"0.62543523",
"0.624309",
"0.6226054",
"0.61636657",
"0.614136",
"0.6120434",
"0.6119417",
"0.6112195",
"0.61054987",
"0.6097366",
"0.6094714",
"0.6045174",
"0.6037565",
"... | 0.6975744 | 0 |
Tests the pipeline on one image | def test_one_image(self, img):
return self.__image_pipeline(img) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_detector1pipeline1(_bigdata):\n\n step = Detector1Pipeline()\n step.group_scale.skip = True\n step.dq_init.skip = True\n step.saturation.skip = True\n step.ipc.skip = True\n step.superbias.skip = True\n step.refpix.skip = True\n step.rscd.skip = True\n step.firstframe.skip = Tru... | [
"0.70437855",
"0.67594975",
"0.6592326",
"0.6512564",
"0.64907104",
"0.6490202",
"0.6397656",
"0.63727355",
"0.63690376",
"0.63504833",
"0.63420665",
"0.6322763",
"0.6309665",
"0.62550557",
"0.62513506",
"0.6238",
"0.6214038",
"0.61880064",
"0.61385685",
"0.61029905",
"0.6074... | 0.8652898 | 0 |
Split fio reports and analysis after seperate lines is an list contains all fio reports | def split_report(self, lines):
start_line = 0
end_line = 0
fio_reports = []
for index in range(len(lines)):
if self._is_start(lines[index]):
start_line = index
end_line = 0
logging.debug("Found start line %s" % lines[index])
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def parse_reports(self):\n txt = (\n self.unixtext\n if self.unixtext[:2] != \"\\001\\n\"\n else self.unixtext[2:]\n )\n\n lines = txt.split(\"\\n\")\n # There may be an AWIPSID in line 3 or silly aviation control char\n pos = 3 if len(lines[2]) <... | [
"0.5868807",
"0.5664247",
"0.5578677",
"0.55634993",
"0.5524407",
"0.5459011",
"0.5448444",
"0.54429126",
"0.54397994",
"0.54319173",
"0.5394205",
"0.5386384",
"0.53321785",
"0.53271306",
"0.5324833",
"0.5302901",
"0.52472967",
"0.5245073",
"0.524379",
"0.52289546",
"0.522808... | 0.7351396 | 0 |
Return true if report end As we just want to analysis IOPS, Bandwidth and latency to avoid report recieved abnormally our line end at any postion has submit/complete/issued/latency | def _is_end(self, line):
if re.match("\s+submit|complete|issued|latency\s+\:\s+.*", line):
return True | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def has_end_reason(self):\n # Someday I will have real end reasons\n return False",
"def Report(self):\n return True",
"def complete(self):\r\n\tif self.launch_time == INVALID_TIME:\r\n\t print \"Missing probe launch time\"\r\n return False\r\n if self.received_time == INV... | [
"0.6424006",
"0.6412688",
"0.610609",
"0.60565776",
"0.59896314",
"0.5941487",
"0.59304273",
"0.5899628",
"0.58641446",
"0.58333766",
"0.5815926",
"0.57557017",
"0.57488704",
"0.573954",
"0.5682863",
"0.56725603",
"0.5671147",
"0.56233925",
"0.5597181",
"0.5564591",
"0.555923... | 0.71971136 | 0 |
Get iops from result | def _get_iops(self, report):
match = re.search("iops\=(\d+)", report)
if match:
return int(match.group(1)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def iops(self) -> Optional[pulumi.Input[int]]:\n return pulumi.get(self, \"iops\")",
"def iops(self) -> Optional[pulumi.Input[int]]:\n return pulumi.get(self, \"iops\")",
"def iops(self) -> Optional[pulumi.Input[int]]:\n return pulumi.get(self, \"iops\")",
"def iops(self) -> Optional[pul... | [
"0.65652776",
"0.65652776",
"0.65652776",
"0.65652776",
"0.65652776",
"0.6436412",
"0.6404438",
"0.6404438",
"0.61147195",
"0.6032087",
"0.5849049",
"0.5798837",
"0.57841134",
"0.56942934",
"0.5655269",
"0.5576977",
"0.5479881",
"0.54374737",
"0.5435859",
"0.5422325",
"0.5411... | 0.68210137 | 0 |
Get clat average from result | def _get_clat_avg(self, report):
match = re.search(".*clat\s*\((\w+)\).*avg\=\s*(\d+\.{0,1}\d*)",
report)
if match:
unit = match.group(1)
value = float(match.group(2))
if unit.lower() == "usec":
value = value / 1000
return v... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _compute_mean(self, C, mag, rjb, rake):\n mean = (C['a1'] +\n self._compute_linear_magnitude_term(C, mag) +\n self._compute_quadratic_magnitude_term(C, mag) +\n self._compute_logarithmic_distance_term(C, mag, rjb) +\n self._compute_faulting_sty... | [
"0.6921329",
"0.68478394",
"0.6725821",
"0.6676377",
"0.66227436",
"0.64881575",
"0.64851606",
"0.64575696",
"0.64530456",
"0.6430152",
"0.64148897",
"0.640945",
"0.6407608",
"0.6406326",
"0.63872766",
"0.63625735",
"0.63610214",
"0.63600546",
"0.63345057",
"0.6333053",
"0.63... | 0.6976149 | 0 |
Get lat average from result | def _get_lat_avg(self, report):
match = re.search("\s*lat\s*\((\w+)\).*avg\=\s*(\d+\.{0,1}\d*)",
report)
if match:
unit = match.group(1)
value = float(match.group(2))
if unit.lower() == "usec":
value = value / 1000
return va... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def gavg(idata):\n\t\n\twgt1=np.cos(np.deg2rad(idata.lat))*(idata*0+1)\n\tga=(wgt1*idata).sum(dim=['lat','lon'])/wgt1.sum(dim=['lat','lon'])\n\n\treturn ga",
"def geo_average(self, returns):\r\n return (1 + returns).prod() ** (self.day / len(returns)) - 1",
"def get_avg_points(self):\n pass",
"... | [
"0.72542256",
"0.6831026",
"0.66283983",
"0.6622355",
"0.66199833",
"0.61167336",
"0.6102424",
"0.6079479",
"0.6042961",
"0.60394615",
"0.60352874",
"0.60138535",
"0.6007048",
"0.5999756",
"0.5974649",
"0.5971718",
"0.5957929",
"0.5957929",
"0.5945016",
"0.59168303",
"0.58843... | 0.7646274 | 0 |
Simple error reporting wrapper will allow us to plug in different error reporting backend(s) in the future | def init_error_reporting():
global error_reporter
SENTRY_DSN = 'https://e3b3b7139bc64177b9694b836c1c5bd6:fbd8d4def9db41d0abe885a35f034118@sentry.io/230474'
error_reporter = Client(SENTRY_DSN) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def simplecatcher(application):\n def simplecatcher_app(environ, start_response):\n try:\n return application(environ, start_response)\n except:\n out = StringIO()\n traceback.print_exc(file=out)\n start_response('500 Server Error',\n ... | [
"0.6179937",
"0.617588",
"0.6123891",
"0.5902809",
"0.58817416",
"0.58071864",
"0.5757425",
"0.57496774",
"0.5737328",
"0.5737328",
"0.5737328",
"0.5737328",
"0.5737328",
"0.5737328",
"0.5737328",
"0.5737328",
"0.57237893",
"0.56562376",
"0.5646299",
"0.5625194",
"0.5612571",... | 0.6194731 | 0 |
Find the fastest growing tweet. A tweet is the faster growing tweet if its "retweets/time" is bigger than the other's. >Tweet1 is 32.5 hours old and has 64 retweets. >Tweet2 is 3.12 hours old and has 30 retweets. >64/32.5 is smaller than 30/3.12 > tweet2 is the faster growing tweet. | def find_fastest_growing(tweets: list) -> Tweet:
fastest_growing = {}
for tweet in tweets:
fastest_growing[tweet.retweets / tweet.time] = tweet
return fastest_growing[max(fastest_growing)] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def more_popular(twitter_data, a, b):\n\n a_popularity = len(all_followers(twitter_data, a))\n b_popularity = len(all_followers(twitter_data, b))\n if a_popularity > b_popularity:\n return -1\n if a_popularity < b_popularity:\n return 1\n return username_first(twitter_data, a, b)",
"... | [
"0.58020145",
"0.5773253",
"0.5605955",
"0.54207677",
"0.53586316",
"0.5304313",
"0.52775717",
"0.5223772",
"0.5218299",
"0.5202719",
"0.512596",
"0.51223123",
"0.511712",
"0.51043195",
"0.5089324",
"0.5027097",
"0.5020282",
"0.5002689",
"0.49978867",
"0.4997395",
"0.49897912... | 0.7820916 | 0 |
Sort tweets by popularity. Tweets must be sorted in descending order. A tweet is more popular than the other if it has more retweets. If the retweets are even, the newer tweet is the more popular one. >Tweet1 has 10 retweets. >Tweet2 has 30 retweets. >30 is bigger than 10 > tweet2 is the more popular one. | def sort_by_popularity(tweets: list) -> list:
tweets_by_popularity = sorted(tweets, key=lambda x: (x.retweets, -x.time), reverse=True) # Use lambda functions when an anonymous function is required for a short period of time.
return tweets_by_popularity | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sort_hashtags_by_popularity(tweets: list) -> list:\n hashtags_by_popularity = {}\n pattern = r\"#\\w+\"\n for tweet in tweets:\n find_hashtag = re.findall(pattern, tweet.content)\n if not find_hashtag:\n continue\n else:\n for ht in find_hashtag:\n ... | [
"0.72086954",
"0.6634835",
"0.6537147",
"0.6512715",
"0.638781",
"0.61812156",
"0.6161245",
"0.61347455",
"0.60856587",
"0.60808486",
"0.6046317",
"0.6040352",
"0.6021192",
"0.59636885",
"0.5714501",
"0.5635846",
"0.56224364",
"0.55373555",
"0.55107176",
"0.5509282",
"0.54656... | 0.81967425 | 0 |
Filter tweets by hashtag. Return a list of all tweets that contain given hashtag. | def filter_by_hashtag(tweets: list, hashtag: str) -> list:
tweets_with_hashtag = {} # findall(): Kui tekstis on rohkem kui üks regulaaravaldisele vastav alamsõne saab kõikide vastete järjendi moodustada funktsiooniga findall()
pattern = r"#\w+" # \w : tähed, numbrid, alakriips, + : 1 või rohkem
for tweet ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_hashtag_tweets(self, hashtag,\n count=settings.TWITTER_DEFAULT_LIMIT):\n url = urljoin(self.base_url, \"/search/tweets.json\")\n response = self.session.get(\n url,\n params={\n \"q\": hashtag,\n \"count\": count,\n... | [
"0.7160957",
"0.7032792",
"0.69874537",
"0.6941565",
"0.6764387",
"0.6758071",
"0.64080524",
"0.63774925",
"0.6372906",
"0.63649166",
"0.6348488",
"0.6245306",
"0.6225286",
"0.6198763",
"0.6093244",
"0.6081898",
"0.605212",
"0.59758717",
"0.59343845",
"0.5924472",
"0.5913977"... | 0.8566406 | 0 |
Sort hashtags by popularity. Hashtags must be sorted in descending order. A hashtag's popularity is the sum of its tweets' retweets. If two hashtags are equally popular, sort by alphabet from AZ to az (upper case before lower case). >Tweet1 has 21 retweets and has common hashtag. >Tweet2 has 19 retweets and has common ... | def sort_hashtags_by_popularity(tweets: list) -> list:
hashtags_by_popularity = {}
pattern = r"#\w+"
for tweet in tweets:
find_hashtag = re.findall(pattern, tweet.content)
if not find_hashtag:
continue
else:
for ht in find_hashtag:
hashtags_by_... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sort_by_popularity(tweets: list) -> list:\n tweets_by_popularity = sorted(tweets, key=lambda x: (x.retweets, -x.time), reverse=True) # Use lambda functions when an anonymous function is required for a short period of time.\n return tweets_by_popularity",
"def analyze_hashtag(self, hashtag, count=200):... | [
"0.69831985",
"0.6492876",
"0.6273045",
"0.61353415",
"0.6012295",
"0.6011385",
"0.5904181",
"0.58903307",
"0.5886282",
"0.58699507",
"0.57823396",
"0.5743395",
"0.5731384",
"0.5728252",
"0.57232624",
"0.5714294",
"0.5693599",
"0.5683469",
"0.5591436",
"0.5541367",
"0.5535096... | 0.81497365 | 0 |
Imports grammar from path. Must work with relative and full paths. | def import_grammar(path):
grammar_name = os.path.basename(path).replace(".py", "")
grammar_file = f'restler_grammar_{grammar_name}_{os.getpid()}.py'
# import req_collection from given grammar
sys.path.append(os.path.dirname(path))
grammar = importlib.import_module(grammar_name)
req_collection =... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def load_grammar(path):\n return SCFG(iterrules(smart_ropen(path)))",
"def parse_file(self, path):\r\n return self._parse(antlr3.ANTLRFileStream(path))",
"def Load(json_text, start_symbol, ignore='_reserved'):\n g = Grammar(json_text, start_symbol, ignore=ignore)\n g.canonicalize()\n ... | [
"0.7489536",
"0.6639333",
"0.6143521",
"0.5977668",
"0.59666264",
"0.5912767",
"0.58226264",
"0.57861996",
"0.57580453",
"0.56670094",
"0.55921984",
"0.5576274",
"0.55632013",
"0.55579054",
"0.5552467",
"0.5533972",
"0.55271965",
"0.54410595",
"0.54406357",
"0.54275715",
"0.5... | 0.7113181 | 1 |
Initializes all of the checkers, sets the appropriate checkers as enabled/disabled, and returns a list of checker objects | def get_checker_list(req_collection, fuzzing_requests, enable_list, disable_list, set_enable_first, custom_checkers, enable_default_checkers=True):
# Add any custom checkers
for custom_checker_file_path in custom_checkers:
try:
spec = importlib.util.spec_from_file_location('custom_checkers',... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_checkers(config):\n\n checkers = []\n if 'checkers' in config:\n for checker_name, checker_config in config['checkers'].iteritems():\n if checker_name in __checkers:\n configs = None\n if type(checker_config) == list:\n configs = c... | [
"0.6699315",
"0.6395436",
"0.63412344",
"0.60727763",
"0.56841475",
"0.55224925",
"0.55192196",
"0.5488269",
"0.5434302",
"0.54231703",
"0.54006433",
"0.5392882",
"0.5381138",
"0.5368976",
"0.5326031",
"0.5325076",
"0.5321039",
"0.5291186",
"0.52409154",
"0.5226855",
"0.52060... | 0.691162 | 0 |
Returns content of the /etc/pki/tls/openssl.cnf file | def openssl_config():
config = open("/etc/pki/tls/openssl.cnf", "r")
contents = config.read().strip()
config.close()
return contents | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _parse_opensslconf(self):\n# print \"parse_opensslconf\"\n _log.debug(\"__init__::parse_opensslconf\")\n if not self.config.read(self.configfile):\n# print \"could not parse config file\"\n # Empty openssl.conf file or could not successfully parse the file.\n ... | [
"0.6709644",
"0.6587199",
"0.6270508",
"0.6103299",
"0.6099722",
"0.60306615",
"0.59071285",
"0.5779007",
"0.57787883",
"0.5768499",
"0.574396",
"0.5723087",
"0.55978847",
"0.5575509",
"0.55020195",
"0.5498694",
"0.5463668",
"0.5451046",
"0.54283845",
"0.54207194",
"0.540528"... | 0.917327 | 0 |
Gets section from OpenSSL config file | def openssl_config_get_section(section):
result = {}
parses = False
for line in openssl_config_strip(openssl_config()).split("\n"):
if line.lstrip().startswith("[") and line.rstrip().endswith("]") and line[1:-1].strip() == section:
parses = True
continue
if parses:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def openssl_config():\n config = open(\"/etc/pki/tls/openssl.cnf\", \"r\")\n contents = config.read().strip()\n config.close()\n return contents",
"def get(section, key, inifile=\"settings.ini\"):\n config = ConfigParser.RawConfigParser()\n config.readfp(open(inifile))\n value = config.get(s... | [
"0.6962914",
"0.687838",
"0.6710695",
"0.6601774",
"0.6559018",
"0.6483255",
"0.63206744",
"0.63090134",
"0.6287902",
"0.62394434",
"0.62319756",
"0.6230619",
"0.62255305",
"0.62218887",
"0.6209499",
"0.6166368",
"0.61308813",
"0.61027336",
"0.6097764",
"0.6096197",
"0.602986... | 0.72331196 | 0 |
Add audio into video | def add_audio_to_video(audio_path: Union[str, Path],
video_path: Union[str, Path],
out_video_path: [str, Path]) -> Path:
command = 'ffmpeg -loglevel warning -y -i "{}" -i "{}" -c:v copy -c:a copy -shortest {}'.format(
video_path.as_posix(),
audio_path.as... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def merge(video_path, audio_path):\n video_clip = VideoFileClip(video_path)\n audio_clip = AudioFileClip(audio_path)\n final_video = video_clip.set_audio(audio_clip)\n final_video.write_videofile(video_path[:-10] + '.mp4')\n\n os.remove(video_path)\n os.remove(audio_path)\n video_clip.close()\... | [
"0.6910271",
"0.67769235",
"0.6389155",
"0.6350832",
"0.6250503",
"0.6208691",
"0.6035442",
"0.6025434",
"0.59924924",
"0.5967374",
"0.5936128",
"0.58909",
"0.5874258",
"0.5863902",
"0.5850794",
"0.5841139",
"0.58296484",
"0.57920176",
"0.57917464",
"0.57635725",
"0.5748044",... | 0.7074231 | 0 |
Copy another video's audio into current video | def copy_audio_from_another_video(no_audio_video_path: Union[str, Path],
with_audio_video_path: [str, Path],
out_video_path: [str, Path]) -> Path:
no_audio_video_path = Path(no_audio_video_path)
with_audio_video_path = Path(with_audio_video_pat... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def merge(video_path, audio_path):\n video_clip = VideoFileClip(video_path)\n audio_clip = AudioFileClip(audio_path)\n final_video = video_clip.set_audio(audio_clip)\n final_video.write_videofile(video_path[:-10] + '.mp4')\n\n os.remove(video_path)\n os.remove(audio_path)\n video_clip.close()\... | [
"0.72157395",
"0.6633465",
"0.641881",
"0.62713975",
"0.621589",
"0.6071332",
"0.59755015",
"0.58292717",
"0.57728714",
"0.5728441",
"0.55931485",
"0.5579514",
"0.55730623",
"0.5558443",
"0.55379236",
"0.5378375",
"0.53427124",
"0.5326316",
"0.53129834",
"0.52941394",
"0.5272... | 0.78063035 | 0 |
Effettua il calcolo usando metodo postfix. | def postfix(t_input):
# guardo se gli elementi contengono caratteri non validi
if is_valid(t_input) == 1:
# restituisco Invalid se sono stati trovati caratteri invalidi
result = "Invalid"
return result
# scorri di nuovo gli elementi
# NOTA: sarebbe piu' efficiente fare u... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def postfix(self):\n return str(self.data)",
"def toPostfix (self,infix):\n postfix = []\n stack = []\n # Loop over characters in the input string\n for char in infix:\n # If char is a number add it to postfix\n if isFloat(char):\n postfix.a... | [
"0.5826957",
"0.558508",
"0.53713506",
"0.5304741",
"0.5292042",
"0.52748024",
"0.510868",
"0.51042503",
"0.50885606",
"0.5056874",
"0.5052032",
"0.5045483",
"0.50289524",
"0.5021043",
"0.4949896",
"0.48763472",
"0.48689213",
"0.4866513",
"0.48628354",
"0.47693476",
"0.474846... | 0.57679147 | 1 |
Rotate an array k90 degrees in the counterclockwise direction around the given axis | def rot90(m, k=1, axis=2):
m = np.swapaxes(m, 2, axis)
m = np.rot90(m, k)
m = np.swapaxes(m, 2, axis)
return m | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def rot90(a, k=1, axes=(0, 1)):\n a_ndim = a.ndim\n if a_ndim < 2:\n raise ValueError('Input must be >= 2-d')\n\n axes = tuple(axes)\n if len(axes) != 2:\n raise ValueError('len(axes) must be 2')\n if axes[0] == axes[1] or abs(axes[0] - axes[1]) == a_ndim:\n raise ValueError('ax... | [
"0.76798296",
"0.72093284",
"0.69085383",
"0.67484397",
"0.658565",
"0.6559934",
"0.65431476",
"0.6497613",
"0.645518",
"0.64345676",
"0.6427591",
"0.63552946",
"0.6333546",
"0.63313776",
"0.63301253",
"0.6324444",
"0.6322643",
"0.6317463",
"0.6316437",
"0.62849784",
"0.62496... | 0.791317 | 0 |
List the four rotations of the given cube about the given axis. | def rotations4(polycube, axis):
for i in range(4):
yield rot90(polycube, i, axis) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def orient_cube(cube):\n orient_sequence = []\n\n white_face = cube.get_face_with_color(color=Color.WHITE)\n if white_face != Face.UP:\n white_to_up = {\n Face.DOWN: [Move.X2],\n Face.LEFT: [Move.NOT_Y, Move.X],\n Face.RIGHT: [Move.Y, Move.X],\n Face.FRON... | [
"0.6340221",
"0.6095677",
"0.5904801",
"0.58299166",
"0.57457346",
"0.57055646",
"0.56989676",
"0.5680676",
"0.56585646",
"0.5622346",
"0.5616189",
"0.56085396",
"0.5525086",
"0.54719466",
"0.5436336",
"0.5420946",
"0.53754133",
"0.53754133",
"0.5340331",
"0.53401464",
"0.531... | 0.76707184 | 0 |
yields all 96 permutations of a cube | def permutations(cube):
yield from rotations24(cube)
yield from rotations24(np.flip(cube, 0))
yield from rotations24(np.flip(cube, 1))
yield from rotations24(np.flip(cube, 2)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def cube_perms(num_perms=5):\n cubed_counts = collections.defaultdict(Cubes)\n\n result = None\n for i in count(start=1):\n cubed_num = i**3\n perm = ''.join(sorted(str(cubed_num))) # encountered cubed_num sorted into single string\n\n if result is not None and len(perm) > len(str(res... | [
"0.64768004",
"0.64146024",
"0.63794106",
"0.6275348",
"0.61340755",
"0.6058279",
"0.604941",
"0.60257673",
"0.60237736",
"0.600789",
"0.59227496",
"0.59164",
"0.5905994",
"0.59011203",
"0.58969486",
"0.5881034",
"0.5876795",
"0.58699",
"0.5868242",
"0.5863593",
"0.58509123",... | 0.8124517 | 0 |
Read the pointing file and return the content as a list of dictionaries called opsim_visits. The dictionary keys are stored in class variable_opsim_keys. | def readOpsimData(self):
if self.opsim_data:
good, string = self.checkOpsimData()
if good:
self.opsim_visits = self.opsim_data
else:
raise Exception(string)
elif self.opsim_filename:
dataDir = os.getenv('LSST_POINTING_DIR')
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_trackpoints(self, file_path, activities):\n trackpoints = []\n activity_pointer = 0\n current_activity = activities[activity_pointer]\n collecting_trackpoints = False\n\n with open(file_path) as file:\n records = file.readlines()[6:]\n if len(records... | [
"0.56333786",
"0.54608774",
"0.5347159",
"0.53297305",
"0.52621484",
"0.51922065",
"0.5187999",
"0.5142197",
"0.50979763",
"0.50740606",
"0.50634164",
"0.50588024",
"0.5057673",
"0.5022038",
"0.5020236",
"0.5007179",
"0.49933407",
"0.49861312",
"0.4975958",
"0.49718896",
"0.4... | 0.7713892 | 0 |
Generate the atmospheric parameters over time. Returns a list of dictionaries containing the modtran information for each opsim visit (in the same order). | def generateParameters(self, seed=_default_seed, output='atmos_db'):
self.initPointingSequence()
# Instantiate the Atmosphere class
self.atmos = Atmosphere(
self.mjds, self.mjde, self.npoints, seed)
# Generate main atmosphere parameters sequence
self.atmos.init_main_p... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def gen_params(self) -> Dict:\n param_dict: Dict = {}\n\n gX_name: List[str] = ['g_leak', 'g_nav', 'g_kvhh', 'g_kva', 'g_kvsi', \n 'g_cav', 'g_kca', 'g_nap', 'g_kir']\n gX_log: np.ndarray = 4 * np.random.rand(9) - 2 # from -2 to 2\n gX: np.ndarray = (10 * np.one... | [
"0.6144121",
"0.60001683",
"0.5953738",
"0.5910404",
"0.5744431",
"0.56870866",
"0.5681362",
"0.5629395",
"0.56085116",
"0.56012756",
"0.5600153",
"0.55386615",
"0.5489599",
"0.5489157",
"0.54745215",
"0.54657185",
"0.54624456",
"0.54131955",
"0.53923786",
"0.5336438",
"0.533... | 0.6386651 | 0 |
Call the modtranCards class in order to run MODTRAN for selected visits | def runModtran(self, run):
# Call for the MODTRAN card class
modcard = ModtranCards()
modcard.setDefaults()
# Write the cards to the disk
modcard.writeModtranCards(self.modtran_visits[run], self.outfilename)
modcard.runModtran() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def switch3():\n print(f\"Your credit card number is: {id_class.credit_card}\")\n main()",
"def run(self):\n self.membershipFunction()\n self.interpretingMF()\n self.rules()\n self.standardComposition_Min()\n self.standardComposition_Max()\n self.defuzzific... | [
"0.5272706",
"0.5140354",
"0.5089095",
"0.5088494",
"0.506701",
"0.5065637",
"0.5044341",
"0.50236475",
"0.49192584",
"0.48781207",
"0.4845209",
"0.48387665",
"0.4819184",
"0.48100153",
"0.47800806",
"0.47632712",
"0.47620937",
"0.47535703",
"0.47486103",
"0.47320694",
"0.472... | 0.71364576 | 0 |
Load in memory the sorted tabulated wavelengths in nanometers at which MODTRAN outputs data. | def initModtranWavelengths(self):
main_dir = os.getenv('ATMOSPHERE_TRANSMISSION_DIR')
modtranwfile = os.path.join(main_dir, 'data/modtranwl.txt')
self.modtran_wl = numpy.loadtxt(modtranwfile) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def load_times(file_name):\n data = np.loadtxt(file_name)\n data = data[data[:, 0].argsort()]\n times = data[:, 0]\n values = data[:, 1]\n\n # Remove the mean amplitude and shift time origin\n times -= times[0]\n values -= np.mean(values)\n\n return times, values",
"def dataload():\n\t\n\... | [
"0.57003945",
"0.56235033",
"0.5574468",
"0.55440515",
"0.5494894",
"0.5418089",
"0.53614116",
"0.53581464",
"0.53322345",
"0.5319455",
"0.5306834",
"0.52927095",
"0.5288433",
"0.528307",
"0.5282996",
"0.52825177",
"0.5241067",
"0.5218788",
"0.52169764",
"0.52048254",
"0.5197... | 0.5947832 | 0 |
_set_headers is an internal method that sends the proper headers for a given status code | def _set_headers(self, status):
self.send_response(status)
self.send_header('Content-type', 'application/json')
self.send_header('Access-Control-Allow-Origin', '*')
self.end_headers() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _setHeaders(self):\r\n if not self.headers_set:\r\n self.headers_set = 1\r\n for key in self.headers_out.keys():\r\n self._response.setHeader(key, self.headers_out[key])\r\n self._response.setContentType(self.content_type)",
"def _set_headers(self):\n ... | [
"0.71247244",
"0.7033261",
"0.7021581",
"0.67602676",
"0.6745796",
"0.67355084",
"0.67077833",
"0.6690966",
"0.6593012",
"0.6572389",
"0.655721",
"0.6546803",
"0.65450114",
"0.6541186",
"0.65058833",
"0.64979196",
"0.64800775",
"0.64630497",
"0.6458009",
"0.64557",
"0.6420852... | 0.7662015 | 0 |
Returns this project's version number based on the git repo's tags or from the RELEASEVERSION file if this is a packaged release without a .git directory. Calling this will update the RELEASEVERSION file if the calculated version number differs Calculated dev version numbers (nontagged commits) are PEP426, PEP440, and ... | def get_git_version(abbrev=4):
# Read in the version that's currently in RELEASE-VERSION.
release_version = read_release_version()
# First try to get the current version using "git describe".
tag, count, _ = call_git_describe(abbrev)
if count == '0':
if tag:
# Normal tagged rel... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_version():\n git_root = find_git_root(dirname(__file__))\n\n if git_root is not None:\n # Get the version using \"git describe\".\n cmd = \"git describe --tags --match [0-9]*\".split()\n try:\n version = subprocess.check_output(cmd).decode().strip()\n except sub... | [
"0.6804098",
"0.67817104",
"0.66899633",
"0.66764724",
"0.66523874",
"0.6405725",
"0.63731056",
"0.6289745",
"0.6282365",
"0.62717515",
"0.62504673",
"0.6214834",
"0.6191519",
"0.61359835",
"0.6118245",
"0.6109791",
"0.6078192",
"0.6075849",
"0.6074141",
"0.6059414",
"0.60358... | 0.7118222 | 0 |
create a consumer object that listen on the given topic and apply the callable function. | def create_consumer(self, topic_id: str, callback: Callable, gcp_subscription_id:str=None):
backend = None
if self.vendor == 'kafka':
backend = KafkaClient(topic_id, self.configs['kafka_servers'])
Consumer(backend, callback)
else:
project_id = os.getenv("GOOGL... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _listen_on(self, topic, transform=None):\n task = self.topic_task_map.get(topic)\n if task is None:\n task = StreamingRequestTask(self.apiUrl, topic, transform)\n self.topic_task_map[topic] = task\n task.start()\n\n listener = task.create_listener(transform... | [
"0.65080196",
"0.64997387",
"0.6275375",
"0.6162334",
"0.61372834",
"0.6104447",
"0.6081238",
"0.60780287",
"0.5947878",
"0.59478104",
"0.59181863",
"0.58611345",
"0.58313906",
"0.5808576",
"0.5799386",
"0.57568365",
"0.5733584",
"0.57121193",
"0.5673484",
"0.56382453",
"0.56... | 0.7351179 | 0 |
create a producer object that pushes messages on the given topic. | def create_producer(self, topic_id: str) -> Producer:
backend = None
if self.vendor == 'kafka':
backend = KafkaClient(topic_id, self.configs['kafka_servers'])
else:
project_id = os.getenv("GOOGLE_CLOUD_PROJECT")
subscription_id = os.getenv("GOOGLE_PUBSUB_SUB_I... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create(self):\n topic = self.__conn__.create_topic(self.__topic__)\n return topic.get_producer(*self.__args__, **self.__kargs__)",
"def publish_message(producer_instance, topic_name, key, value):\n key_serializer = repr(key).encode()\n value_serializer = repr(value).encode()\n\n produc... | [
"0.7390834",
"0.69191074",
"0.69123924",
"0.6850624",
"0.68028635",
"0.67866987",
"0.66418934",
"0.66286445",
"0.6581202",
"0.6568865",
"0.65668356",
"0.6565068",
"0.6553705",
"0.6521129",
"0.6520709",
"0.6498708",
"0.6396617",
"0.6374288",
"0.63197273",
"0.6306644",
"0.62786... | 0.73078245 | 1 |
Test equality comparison of states. States are equal when their properties are equal and the substances are the same. | def test_eq(self):
st_1 = State(substance="water", T=Q_(400.0, "K"), p=Q_(101325.0, "Pa"))
st_2 = State(substance="water", T=Q_(400.0, "K"), p=Q_(101325.0, "Pa"))
assert st_1 == st_2 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_eq_not_two_states(self):\n assert not State(substance=\"water\") == 3\n assert not 3 == State(substance=\"water\")",
"def __eq__(self, other):\r\n if other:\r\n if self.state == other.state:\r\n return True",
"def is_equal(self, state1, state2):\n ... | [
"0.7411638",
"0.70720935",
"0.70330316",
"0.6841134",
"0.68132865",
"0.67866373",
"0.67845243",
"0.67395973",
"0.6709977",
"0.66601646",
"0.6658926",
"0.6594616",
"0.65500194",
"0.652282",
"0.6417568",
"0.64137423",
"0.63963854",
"0.638358",
"0.63694394",
"0.6356007",
"0.6350... | 0.7857867 | 0 |
Test that comparing a state with something else doesn't work. | def test_eq_not_two_states(self):
assert not State(substance="water") == 3
assert not 3 == State(substance="water") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_not_eq(self):\n st_1 = State(substance=\"water\", T=Q_(400.0, \"K\"), p=Q_(101325.0, \"Pa\"))\n st_2 = State(substance=\"water\", T=Q_(300.0, \"K\"), p=Q_(101325.0, \"Pa\"))\n assert not st_1 == st_2",
"def test_not_eq_sub(self):\n st_1 = State(substance=\"water\", T=Q_(400.0... | [
"0.75921804",
"0.7322212",
"0.71615773",
"0.7139954",
"0.69840777",
"0.69686276",
"0.6800714",
"0.6780393",
"0.67567956",
"0.67079544",
"0.67073613",
"0.67053056",
"0.6667421",
"0.6621463",
"0.6603985",
"0.6589744",
"0.6577951",
"0.6536618",
"0.64967275",
"0.6477861",
"0.6471... | 0.7981563 | 0 |
States are not equal when properties are not equal. | def test_not_eq(self):
st_1 = State(substance="water", T=Q_(400.0, "K"), p=Q_(101325.0, "Pa"))
st_2 = State(substance="water", T=Q_(300.0, "K"), p=Q_(101325.0, "Pa"))
assert not st_1 == st_2 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_eq_not_two_states(self):\n assert not State(substance=\"water\") == 3\n assert not 3 == State(substance=\"water\")",
"def test_not_eq_sub(self):\n st_1 = State(substance=\"water\", T=Q_(400.0, \"K\"), p=Q_(101325.0, \"Pa\"))\n st_2 = State(substance=\"ammonia\", T=Q_(400.0, \... | [
"0.8037951",
"0.7186581",
"0.70225686",
"0.7005218",
"0.69793683",
"0.6876887",
"0.687629",
"0.687566",
"0.67959964",
"0.6752521",
"0.66764975",
"0.6625729",
"0.6625001",
"0.6580639",
"0.6579071",
"0.65779823",
"0.65776634",
"0.6575446",
"0.6564582",
"0.6510655",
"0.6505811",... | 0.75235075 | 1 |
States are not equal when substances are not the same. | def test_not_eq_sub(self):
st_1 = State(substance="water", T=Q_(400.0, "K"), p=Q_(101325.0, "Pa"))
st_2 = State(substance="ammonia", T=Q_(400.0, "K"), p=Q_(101325.0, "Pa"))
assert not st_1 == st_2 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_eq_not_two_states(self):\n assert not State(substance=\"water\") == 3\n assert not 3 == State(substance=\"water\")",
"def test_not_eq(self):\n st_1 = State(substance=\"water\", T=Q_(400.0, \"K\"), p=Q_(101325.0, \"Pa\"))\n st_2 = State(substance=\"water\", T=Q_(300.0, \"K\"),... | [
"0.82808363",
"0.79227084",
"0.69984084",
"0.6873306",
"0.673153",
"0.66939735",
"0.6568405",
"0.6506088",
"0.64778894",
"0.64763105",
"0.6437843",
"0.63877356",
"0.6349658",
"0.6294364",
"0.62919545",
"0.6291824",
"0.62673426",
"0.6244693",
"0.62310535",
"0.6223238",
"0.6215... | 0.843503 | 0 |
Substances should be able to be specified with lowercase letters. | def test_lowercase_input(self):
State(substance="water")
State(substance="r22")
State(substance="r134a")
State(substance="ammonia")
State(substance="propane")
State(substance="air")
State(substance="isobutane")
State(substance="carbondioxide")
Stat... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_casing(self):\n char = Character(type=['Fish', 'Great Ape'])\n assert char.type_key == 'fish'",
"def not_capitalized(): # noqa: D416",
"def lower_case_really():",
"def test_case_insensitive(self):\n self.check_4_way('Container', 'Pod')",
"def lower(self) -> str:",
"def test... | [
"0.6460399",
"0.6228113",
"0.6171696",
"0.61171895",
"0.5934742",
"0.5896801",
"0.5881713",
"0.5856446",
"0.5764214",
"0.5723911",
"0.5716885",
"0.5706581",
"0.5706581",
"0.56599045",
"0.56542",
"0.5651464",
"0.5640322",
"0.56386954",
"0.5628285",
"0.5561082",
"0.5538821",
... | 0.7495314 | 0 |
A substance not in the approved list should raise a ValueError. | def test_bad_substance(self):
with pytest.raises(ValueError):
State(substance="bad substance") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def seal_is_valid(self):\n pass",
"def seal_is_valid(self):\n pass",
"def violated(self) -> bool:\n ...",
"def validate_sub(self):\n self._validate_claim_value('sub')",
"def _check(self):\n assert self._leaves, (\n 'Need to validate AssetAllocation before using... | [
"0.6088329",
"0.6088329",
"0.57910085",
"0.56954694",
"0.5552691",
"0.5474312",
"0.54689556",
"0.5410143",
"0.5407957",
"0.53601915",
"0.5286176",
"0.5280036",
"0.52338827",
"0.52257854",
"0.52235645",
"0.51894116",
"0.5167571",
"0.51666474",
"0.5164248",
"0.51628655",
"0.514... | 0.61239827 | 0 |
Specifying too many properties should raise a ValueError. | def test_too_many_props(self):
with pytest.raises(ValueError):
State(
substance="water",
T=Q_(300, "K"),
p=Q_(101325, "Pa"),
u=Q_(100, "kJ/kg"),
) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_too_few_props(self):\n with pytest.raises(ValueError):\n State(substance=\"water\", T=Q_(300, \"K\"))",
"def test_should_raise_error_if_inconsistent_properties(self):\r\n edge_spec = {\r\n 'type': 'edge',\r\n 'label': 'subscribed_to',\r\n 'primar... | [
"0.6713041",
"0.6603682",
"0.62248707",
"0.6221275",
"0.61699057",
"0.614503",
"0.610601",
"0.60891724",
"0.60261506",
"0.5967855",
"0.58871776",
"0.5837227",
"0.58025193",
"0.57816184",
"0.57575655",
"0.5751086",
"0.57486403",
"0.5737626",
"0.57250184",
"0.5681589",
"0.56664... | 0.71155095 | 0 |
Specifying too few properties should raise a value error. | def test_too_few_props(self):
with pytest.raises(ValueError):
State(substance="water", T=Q_(300, "K")) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_too_many_props(self):\n with pytest.raises(ValueError):\n State(\n substance=\"water\",\n T=Q_(300, \"K\"),\n p=Q_(101325, \"Pa\"),\n u=Q_(100, \"kJ/kg\"),\n )",
"def test_should_raise_error_if_inconsistent_properti... | [
"0.691417",
"0.65681446",
"0.6393225",
"0.6357369",
"0.6268618",
"0.62368995",
"0.62219155",
"0.6212051",
"0.6203742",
"0.6201047",
"0.6150353",
"0.6140446",
"0.6125671",
"0.60866463",
"0.6051994",
"0.6046648",
"0.60387206",
"0.60310185",
"0.5975781",
"0.5974152",
"0.59425783... | 0.68810195 | 1 |
Negative absolute temperatures should raise a StateError. | def test_negative_temperature(self):
with pytest.raises(StateError):
State(substance="water", T=Q_(-100, "K"), p=Q_(101325, "Pa")) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_negative_pressure(self):\n with pytest.raises(StateError):\n State(substance=\"water\", T=Q_(300, \"K\"), p=Q_(-101325, \"Pa\"))",
"def test_negative_volume(self):\n with pytest.raises(StateError):\n State(substance=\"water\", T=Q_(300, \"K\"), v=Q_(-10.13, \"m**3/kg\... | [
"0.7632844",
"0.7123799",
"0.630382",
"0.6141013",
"0.60388935",
"0.60204893",
"0.5997845",
"0.5981775",
"0.59458315",
"0.5941948",
"0.58024895",
"0.5770009",
"0.5757959",
"0.5723522",
"0.564597",
"0.56440747",
"0.5604049",
"0.554921",
"0.5548397",
"0.5545048",
"0.55339277",
... | 0.8473055 | 0 |
Negative absolute pressures should raise a StateError. | def test_negative_pressure(self):
with pytest.raises(StateError):
State(substance="water", T=Q_(300, "K"), p=Q_(-101325, "Pa")) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_negative_volume(self):\n with pytest.raises(StateError):\n State(substance=\"water\", T=Q_(300, \"K\"), v=Q_(-10.13, \"m**3/kg\"))",
"def test_quality_lt_zero(self):\n with pytest.raises(StateError):\n State(substance=\"water\", x=Q_(-1.0, \"dimensionless\"), p=Q_(101... | [
"0.6810716",
"0.6713059",
"0.6393805",
"0.5986361",
"0.5780576",
"0.5770264",
"0.5723537",
"0.5716454",
"0.56924635",
"0.56550866",
"0.5608319",
"0.55696857",
"0.5552951",
"0.55477136",
"0.5508744",
"0.5501384",
"0.549518",
"0.54909736",
"0.54727924",
"0.5471732",
"0.54639775... | 0.72122383 | 0 |
Negative absolute specific volumes should raise a StateError. | def test_negative_volume(self):
with pytest.raises(StateError):
State(substance="water", T=Q_(300, "K"), v=Q_(-10.13, "m**3/kg")) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_negative_pressure(self):\n with pytest.raises(StateError):\n State(substance=\"water\", T=Q_(300, \"K\"), p=Q_(-101325, \"Pa\"))",
"def test_negative_temperature(self):\n with pytest.raises(StateError):\n State(substance=\"water\", T=Q_(-100, \"K\"), p=Q_(101325, \"Pa... | [
"0.67349464",
"0.6399481",
"0.6185388",
"0.5991683",
"0.5866496",
"0.58151484",
"0.5802644",
"0.5569564",
"0.55653226",
"0.55343086",
"0.5516353",
"0.55056494",
"0.5482402",
"0.5463294",
"0.5398822",
"0.5398584",
"0.5390134",
"0.5387504",
"0.53659153",
"0.5365357",
"0.5364312... | 0.7956839 | 0 |
Vapor qualities less than 0.0 should raise a StateError. | def test_quality_lt_zero(self):
with pytest.raises(StateError):
State(substance="water", x=Q_(-1.0, "dimensionless"), p=Q_(101325, "Pa")) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_quality_gt_one(self):\n with pytest.raises(StateError):\n State(substance=\"water\", x=Q_(2.0, \"dimensionless\"), p=Q_(101325, \"Pa\"))",
"def test_negative_pressure(self):\n with pytest.raises(StateError):\n State(substance=\"water\", T=Q_(300, \"K\"), p=Q_(-101325,... | [
"0.6695716",
"0.6093682",
"0.6091125",
"0.60676634",
"0.59195673",
"0.58101606",
"0.57026875",
"0.5672984",
"0.56357425",
"0.5619097",
"0.5575792",
"0.55367625",
"0.5510878",
"0.5482255",
"0.54266983",
"0.54159003",
"0.53686553",
"0.5342649",
"0.53416604",
"0.5320348",
"0.530... | 0.7357096 | 0 |
Vapor qualities greater than 1.0 should raise a StateError. | def test_quality_gt_one(self):
with pytest.raises(StateError):
State(substance="water", x=Q_(2.0, "dimensionless"), p=Q_(101325, "Pa")) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_quality_lt_zero(self):\n with pytest.raises(StateError):\n State(substance=\"water\", x=Q_(-1.0, \"dimensionless\"), p=Q_(101325, \"Pa\"))",
"def test_too_few_props(self):\n with pytest.raises(ValueError):\n State(substance=\"water\", T=Q_(300, \"K\"))",
"def test_b... | [
"0.7009703",
"0.6329197",
"0.59808266",
"0.58498585",
"0.5834338",
"0.5800094",
"0.5767334",
"0.5677771",
"0.5584937",
"0.5569112",
"0.5567202",
"0.55665666",
"0.5564617",
"0.5487662",
"0.54038966",
"0.53723234",
"0.5363842",
"0.5329659",
"0.524983",
"0.5244042",
"0.52412665"... | 0.7063273 | 0 |
Invalid input properties should raise a ValueError. | def test_invalid_input_prop(self):
with pytest.raises(ValueError):
State(
substance="water", x=Q_(0.5, "dimensionless"), bad_prop=Q_(101325, "Pa")
) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_001_validate_with_bad_properties(self):\n m = schematics_flexible.BaseFlexible(\n {'code': '06',\n 'properties': {\"a\": \"this is test\"}},\n store_handler=get_mock())\n try:\n m.validate()\n except schematicsValidationError:\n ... | [
"0.70220983",
"0.6674215",
"0.65589136",
"0.6502546",
"0.6489174",
"0.64887667",
"0.64748037",
"0.6417012",
"0.63581204",
"0.635494",
"0.6311561",
"0.63091063",
"0.6298214",
"0.6290883",
"0.6243078",
"0.6239399",
"0.6239078",
"0.622873",
"0.619624",
"0.61825943",
"0.6177395",... | 0.7729876 | 0 |
Setting bad dimensions for the input property raises a StateError. | def test_bad_dimensions(self, prop: str):
kwargs = {prop: Q_(1.0, "dimensionless")}
if prop == "v":
kwargs["T"] = Q_(300.0, "K")
else:
kwargs["v"] = Q_(1.0, "m**3/kg")
with pytest.raises(StateError):
State(substance="water", **kwargs) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_invalid_input_prop(self):\n with pytest.raises(ValueError):\n State(\n substance=\"water\", x=Q_(0.5, \"dimensionless\"), bad_prop=Q_(101325, \"Pa\")\n )",
"def test_bad_x_dimensions(self):\n with pytest.raises(StateError):\n State(substance=... | [
"0.70860714",
"0.678234",
"0.6377732",
"0.62351644",
"0.6171897",
"0.6063006",
"0.6034769",
"0.6015262",
"0.59894466",
"0.5987992",
"0.59762096",
"0.59451014",
"0.59425527",
"0.59303266",
"0.59287095",
"0.5853424",
"0.58482957",
"0.58220845",
"0.5759549",
"0.57540387",
"0.574... | 0.7068877 | 1 |
Setting bad dimensions for quality raises a StateError. Must be done in a separate test because the "dimensionless" sentinel value used in the other test is actually the correct dimension for quality. | def test_bad_x_dimensions(self):
with pytest.raises(StateError):
State(substance="water", T=Q_(300.0, "K"), x=Q_(1.01325, "K")) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_bad_dimensions(self, prop: str):\n kwargs = {prop: Q_(1.0, \"dimensionless\")}\n if prop == \"v\":\n kwargs[\"T\"] = Q_(300.0, \"K\")\n else:\n kwargs[\"v\"] = Q_(1.0, \"m**3/kg\")\n with pytest.raises(StateError):\n State(substance=\"water\", *... | [
"0.711872",
"0.6767196",
"0.6627679",
"0.6209383",
"0.6091683",
"0.6090364",
"0.6045845",
"0.6036081",
"0.6023392",
"0.6005132",
"0.5998497",
"0.5950686",
"0.5938751",
"0.59303045",
"0.588569",
"0.58840954",
"0.5874641",
"0.58311474",
"0.5811564",
"0.5772429",
"0.5764034",
... | 0.694339 | 1 |
Setting a twophase mixture with T and p should raise a StateError. | def test_TP_twophase(self):
with pytest.raises(StateError):
State(substance="water", T=Q_(373.1242958476844, "K"), p=Q_(101325.0, "Pa")) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_set_pT(self):\n s = State(substance=\"water\")\n s.pT = Q_(101325.0, \"Pa\"), Q_(400.0, \"K\")\n # Pylance does not support NumPy ufuncs\n assert np.isclose(s.T, Q_(400.0, \"K\")) # type: ignore\n assert np.isclose(s.p, Q_(101325.0, \"Pa\")) # type: ignore\n ass... | [
"0.64530444",
"0.63182175",
"0.60898685",
"0.60360014",
"0.6034757",
"0.6007693",
"0.5970929",
"0.5907961",
"0.5841077",
"0.5765423",
"0.57480544",
"0.571334",
"0.5587806",
"0.55703336",
"0.55685085",
"0.553704",
"0.55276626",
"0.5519364",
"0.5384156",
"0.5384156",
"0.5375352... | 0.71775776 | 0 |
Accessing attributes that aren't one of the properties or pairs raises. | def test_bad_get_property(self):
s = State(substance="water", T=Q_(400.0, "K"), p=Q_(101325.0, "Pa"))
with pytest.raises(AttributeError):
s.bad_get | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __getattribute__(self,name):\n try:\n return object.__getattribute__(self,name)\n except AttributeError:\n extraPO = object.__getattribute__(self,'_extraPO')\n\n if hasattr(extraPO,name):\n return getattr(extraPO,name) # HIDDEN!\n\n _attr... | [
"0.65133715",
"0.6202257",
"0.6189909",
"0.60724235",
"0.60174316",
"0.5985178",
"0.59813917",
"0.59092987",
"0.59054035",
"0.5887275",
"0.58833724",
"0.5864438",
"0.585859",
"0.5850074",
"0.58483046",
"0.5827751",
"0.58149964",
"0.58121717",
"0.5804015",
"0.57854235",
"0.578... | 0.6509815 | 1 |
Trying to set a label that can't be converted to a string is a TypeError. | def test_label_cannot_be_converted_to_string(self):
class NoStr:
def __str__(self) -> str:
raise NotImplementedError
with pytest.raises(TypeError, match="The given label"):
State("water", label=NoStr()) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def setLabel(*args):",
"def setLabel(*args):",
"def setLabel(*args):",
"def setLabel(*args):",
"def setLabel(*args):",
"def setLabel(self, label):\r\n\t\tself.label = label",
"def setLabel(self, label):\r\n\t\tself.label = label",
"def setLabel(self, label):\r\n\t\tself.label = label",
"def label(s... | [
"0.71254545",
"0.71254545",
"0.71254545",
"0.71254545",
"0.71254545",
"0.6910992",
"0.6910992",
"0.6910992",
"0.68580556",
"0.68332845",
"0.6798005",
"0.67437905",
"0.67344207",
"0.6643018",
"0.65870064",
"0.6461312",
"0.6461312",
"0.6441315",
"0.63893396",
"0.6389211",
"0.63... | 0.74720335 | 0 |
Set a state with EE units and check the properties. | def test_state_units_EE(self):
s = State("water", T=Q_(100, "degC"), p=Q_(1.0, "atm"), units="EE")
assert s.units == "EE"
assert s.cv.units == "british_thermal_unit / degree_Rankine / pound"
assert s.cp.units == "british_thermal_unit / degree_Rankine / pound"
assert s.s.units == ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_change_units(self):\n s = State(\"water\", T=Q_(100, \"degC\"), p=Q_(1.0, \"atm\"), units=\"EE\")\n assert s.units == \"EE\"\n s.units = \"SI\"\n assert s.units == \"SI\"\n assert s.cv.units == \"kilojoule / kelvin / kilogram\"\n assert s.cp.units == \"kilojoule /... | [
"0.7154464",
"0.6097261",
"0.609101",
"0.6070695",
"0.6017664",
"0.60060954",
"0.5999669",
"0.5972463",
"0.5918263",
"0.5897603",
"0.58531266",
"0.5849938",
"0.5842901",
"0.58336365",
"0.57991266",
"0.5769449",
"0.5749645",
"0.57332903",
"0.5720116",
"0.5672283",
"0.5662434",... | 0.7559458 | 0 |
Set a state with SI units and check the properties. | def test_state_units_SI(self):
s = State("water", T=Q_(100, "degC"), p=Q_(1.0, "atm"), units="SI")
assert s.units == "SI"
assert s.cv.units == "kilojoule / kelvin / kilogram"
assert s.cp.units == "kilojoule / kelvin / kilogram"
assert s.s.units == "kilojoule / kelvin / kilogram"
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_change_units(self):\n s = State(\"water\", T=Q_(100, \"degC\"), p=Q_(1.0, \"atm\"), units=\"EE\")\n assert s.units == \"EE\"\n s.units = \"SI\"\n assert s.units == \"SI\"\n assert s.cv.units == \"kilojoule / kelvin / kilogram\"\n assert s.cp.units == \"kilojoule /... | [
"0.7059346",
"0.6659737",
"0.6573984",
"0.65370494",
"0.6360481",
"0.63547945",
"0.63098294",
"0.6196986",
"0.6170108",
"0.6019139",
"0.5997743",
"0.59829026",
"0.5955532",
"0.5907214",
"0.5871413",
"0.585544",
"0.58090574",
"0.58051246",
"0.57749116",
"0.57735544",
"0.573099... | 0.79970735 | 0 |
Set default units and check for functionality. | def test_default_units(self):
s = State("water", T=Q_(100, "degC"), p=Q_(1.0, "atm"))
assert s.units is None
set_default_units("SI")
s2 = State("water", T=Q_(100, "degC"), p=Q_(1.0, "atm"))
assert s2.units == "SI"
set_default_units("EE")
s3 = State("water", T=Q_(1... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_default_unit(unit):\n self.default_unit = unit",
"def useUnits():",
"def set_units(self, units):\n self.units = units",
"def add_default_units(self, u: dict):\n # TODO: Could look at replacing dict with defined arguments\n # This would be a big API change\n try:\n ... | [
"0.7536076",
"0.7499493",
"0.7235243",
"0.6872336",
"0.6821063",
"0.6794616",
"0.674005",
"0.66790146",
"0.66790146",
"0.66790146",
"0.66580623",
"0.66422087",
"0.6631958",
"0.66055584",
"0.6545003",
"0.6488979",
"0.6486809",
"0.64840007",
"0.64672285",
"0.6431655",
"0.639556... | 0.7852338 | 0 |
Unsupported unit names should raise TypeError. | def test_unsupported_units(self):
with pytest.raises(TypeError):
set_default_units("bad")
with pytest.raises(TypeError):
State("water", T=Q_(100, "degC"), p=Q_(1.0, "atm"), units="bad") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_invalid_units(self):\n with self.assertRaises(ValueError):\n UnitSystem(SYSTEM_NAME, INVALID_UNIT, LENGTH_METERS, VOLUME_LITERS,\n MASS_GRAMS)\n\n with self.assertRaises(ValueError):\n UnitSystem(SYSTEM_NAME, TEMP_CELSIUS, INVALID_UNIT, VOLUME_LITE... | [
"0.7361548",
"0.6988643",
"0.6874565",
"0.6776378",
"0.6719092",
"0.6570757",
"0.6537259",
"0.6466779",
"0.6456328",
"0.64075685",
"0.63499427",
"0.6323315",
"0.6314017",
"0.6269462",
"0.6241628",
"0.62076026",
"0.6206131",
"0.62059516",
"0.6201914",
"0.61443555",
"0.6142578"... | 0.738891 | 0 |
Change state units and check variable units have changed. | def test_change_units(self):
s = State("water", T=Q_(100, "degC"), p=Q_(1.0, "atm"), units="EE")
assert s.units == "EE"
s.units = "SI"
assert s.units == "SI"
assert s.cv.units == "kilojoule / kelvin / kilogram"
assert s.cp.units == "kilojoule / kelvin / kilogram"
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update_units(self):\n unit_var_value = self.view.vars['unit'].get()\n if unit_var_value == 'm3ph':\n self.minran_u_label.config(text='m³/h')\n self.maxran_u_label.config(text='m³/h')\n self.points_tview.heading('vflow', text='Przepływ [m³/h]', anchor=tk.CENTER)\n ... | [
"0.67447084",
"0.66776633",
"0.64128524",
"0.6409828",
"0.63876545",
"0.63423395",
"0.6329747",
"0.6308973",
"0.6269697",
"0.6186396",
"0.6177401",
"0.61650276",
"0.61610276",
"0.611681",
"0.6050164",
"0.6039441",
"0.6000102",
"0.6000102",
"0.6000102",
"0.59765524",
"0.589681... | 0.8081528 | 0 |
Function to create iam, redshift and ec2 clients | def create_clients(KEY, SECRET):
iam = boto3.client('iam',aws_access_key_id=KEY,
aws_secret_access_key=SECRET,
region_name='us-west-2'
)
redshift = boto3.client('redshift',
region_name="us-west-2",
aw... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_clients(aws_key, aws_secret):\n ec2_client = boto3.resource(\n 'ec2', region_name=AWS_REGION, aws_access_key_id=aws_key,\n aws_secret_access_key=aws_secret\n )\n s3_client = boto3.resource(\n 's3', region_name=AWS_REGION, aws_access_key_id=aws_key,\n aws_secret_acces... | [
"0.6877092",
"0.68760455",
"0.66040593",
"0.65677744",
"0.6395562",
"0.63700163",
"0.6255545",
"0.6136053",
"0.60277426",
"0.5985781",
"0.5925186",
"0.5883641",
"0.584067",
"0.5770844",
"0.5747486",
"0.5747091",
"0.5729844",
"0.56581074",
"0.56522125",
"0.5643324",
"0.5642051... | 0.7530635 | 0 |
Function to create an iam policy to allow Redshift read only access to S3 buckets | def create_iam_policy(DWH_IAM_ROLE_NAME):
# Create an iam role that allows Redshift to access S3 buckets with read only access
#1.1 Create the role,
try:
print("1.1 Creating a new IAM Role")
dwhRole = iam.create_role(
Path='/',
RoleName=DWH_IAM_ROLE_NAME,
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def addS3AccessRole():\n # create a new role\n try:\n print(\"Creating a new IAM Role...\")\n iam.create_role(\n Path='/',\n RoleName=DWH_IAM_ROLE_NAME,\n Description=\"Allows Redshift clusters to access AWS services.\",\n AssumeRolePolicyDocument=jso... | [
"0.6890277",
"0.6712345",
"0.65728784",
"0.6473506",
"0.6431258",
"0.6368872",
"0.6238576",
"0.6136007",
"0.6086873",
"0.60524946",
"0.60164857",
"0.59745187",
"0.58903426",
"0.5825662",
"0.5808705",
"0.5801586",
"0.5775913",
"0.5759309",
"0.56751186",
"0.56560713",
"0.560274... | 0.7498754 | 0 |
Function to open a TCP port to access the cluster endpoint | def open_tcp_port():
# Open an incoming tcp port to access the cluster endpoint
try:
vpc = ec2.Vpc(id=myClusterProps['VpcId'])
defaultSg = list(vpc.security_groups.all())[0]
print(defaultSg)
defaultSg.authorize_ingress(
GroupName=defaultSg.group_name,
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def port():",
"def get_open_port():\n s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)\n s.bind((\"\", 0))\n s.listen(1)\n port = s.getsockname()[1]\n s.close()\n return port",
"def new_port():\n s = socket.socket(socket.AF_INET, socket.... | [
"0.6930141",
"0.65656465",
"0.65059924",
"0.64727104",
"0.646967",
"0.63453627",
"0.6302161",
"0.62883884",
"0.6250519",
"0.62487304",
"0.61932945",
"0.6189995",
"0.6118783",
"0.6115527",
"0.6112103",
"0.6101256",
"0.6078648",
"0.6036524",
"0.6036524",
"0.60328287",
"0.601792... | 0.798413 | 0 |
Set the default number of significant figures used to print pint, pandas and numpy values quantities. Defaults to 4. | def set_sig_figs(n):
u.default_format = '.' + str(n) + 'g'
pd.options.display.float_format = ('{:,.' + str(n) + '}').format | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def array_output_precision(no_of_decimals):\n arrayprint.set_precision(no_of_decimals)",
"def array_output_precision(no_of_decimals):\n arrayprint.set_precision(no_of_decimals)",
"def array_output_precision(no_of_decimals):\n sys.float_output_precision = no_of_decimals",
"def print_preci... | [
"0.66449684",
"0.66449684",
"0.65736014",
"0.6497362",
"0.6199155",
"0.61784905",
"0.60122925",
"0.5912692",
"0.5912692",
"0.5901223",
"0.5893993",
"0.588759",
"0.5811197",
"0.5788039",
"0.57873565",
"0.5774284",
"0.57721376",
"0.5763909",
"0.57366526",
"0.56746787",
"0.56545... | 0.73101455 | 0 |
Returns the requests the client will need to make to get router credentials. | def get_credentials_requests(request, router_id):
router = models.Router.objects.get(pk=router_id)
manager = get_manager(router.manufacturer, router.model)
requests = manager.request_manager.get_login_credentials()
serializer = serializers.RouterRequestSerializer(requests, many=True)
return Response... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_all_access():\n\t# Get the email from the user making the request\n\temail = get_jwt_identity()\n\treturn get_all_access_helper(email)",
"def get_all_credentials():\n session = db.get_session()\n return (session.query(network_models_v2.Credential).all())",
"def get_query_credentials():\n try:\... | [
"0.6112788",
"0.6091321",
"0.597801",
"0.5958691",
"0.5956092",
"0.5883233",
"0.58347195",
"0.58022004",
"0.5722619",
"0.5674904",
"0.5668746",
"0.56615174",
"0.5589682",
"0.5529522",
"0.5488289",
"0.547898",
"0.5470647",
"0.546874",
"0.54622424",
"0.5443167",
"0.5414515",
... | 0.7323387 | 0 |
Create a synthetic external home object that maps to the actual remote home. | def _remoteHome(self, txn, uid):
from txdav.caldav.datastore.sql_external import CalendarHomeExternal
recipient = yield txn.store().directoryService().recordWithUID(uid)
resourceID = yield txn.store().conduit.send_home_resource_id(txn, recipient)
home = CalendarHomeExternal.makeSyntheti... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_home(\n home=None, render=False, replace=False, runtime=None, no_runtime=None, **kw\n):\n homePath = get_home_config_path(home)\n if not homePath:\n return None\n exists = os.path.exists(homePath)\n if exists and not replace:\n return None\n\n homedir, filename = os.path.... | [
"0.6218726",
"0.6178184",
"0.60064673",
"0.60064673",
"0.5897659",
"0.5822697",
"0.57711357",
"0.5721925",
"0.5644039",
"0.56275535",
"0.5591503",
"0.55391574",
"0.55178136",
"0.54961747",
"0.5467092",
"0.5428875",
"0.54136264",
"0.5394169",
"0.5378511",
"0.5370477",
"0.53689... | 0.68669605 | 0 |
Test that a remote home L{listChildren} works. | def test_homechild_listobjects(self):
home01 = yield self.homeUnderTest(txn=self.theTransactionUnderTest(0), name="user01", create=True)
self.assertTrue(home01 is not None)
children01 = yield home01.listChildren()
yield self.commitTransaction(0)
home = yield self._remoteHome(se... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_homechild_loadallobjects(self):\n\n home01 = yield self.homeUnderTest(txn=self.theTransactionUnderTest(0), name=\"user01\", create=True)\n self.assertTrue(home01 is not None)\n children01 = yield home01.loadChildren()\n names01 = [child.name() for child in children01]\n ... | [
"0.6887477",
"0.6361103",
"0.6286864",
"0.6162695",
"0.61438346",
"0.6100657",
"0.610026",
"0.6090414",
"0.60880226",
"0.6054864",
"0.60140723",
"0.5981112",
"0.5831471",
"0.5810196",
"0.57924676",
"0.577373",
"0.5741781",
"0.57303345",
"0.5718226",
"0.57080114",
"0.5702253",... | 0.79650044 | 0 |
Test that a remote home L{loadChildren} works. | def test_homechild_loadallobjects(self):
home01 = yield self.homeUnderTest(txn=self.theTransactionUnderTest(0), name="user01", create=True)
self.assertTrue(home01 is not None)
children01 = yield home01.loadChildren()
names01 = [child.name() for child in children01]
ids01 = [chil... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_homechild_listobjects(self):\n\n home01 = yield self.homeUnderTest(txn=self.theTransactionUnderTest(0), name=\"user01\", create=True)\n self.assertTrue(home01 is not None)\n children01 = yield home01.listChildren()\n yield self.commitTransaction(0)\n\n home = yield self.... | [
"0.69731224",
"0.61677164",
"0.6042571",
"0.6015302",
"0.59528166",
"0.58976364",
"0.5875181",
"0.587056",
"0.5750654",
"0.57373816",
"0.57092553",
"0.5671516",
"0.56219393",
"0.5621391",
"0.5576499",
"0.5576499",
"0.55605936",
"0.552817",
"0.55038",
"0.54879546",
"0.5454167"... | 0.75470066 | 0 |
Test that a remote home child L{objectResources} works. | def test_objectresource_loadallobjects(self):
home01 = yield self.homeUnderTest(txn=self.theTransactionUnderTest(0), name="user01", create=True)
self.assertTrue(home01 is not None)
calendar01 = yield home01.childWithName("calendar")
yield calendar01.createCalendarObjectWithName("1.ics",... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_objectresource_objectwith(self):\n\n home01 = yield self.homeUnderTest(txn=self.theTransactionUnderTest(0), name=\"user01\", create=True)\n self.assertTrue(home01 is not None)\n calendar01 = yield home01.childWithName(\"calendar\")\n resource01 = yield calendar01.createCalendar... | [
"0.70583075",
"0.6935367",
"0.6833572",
"0.6674605",
"0.6579611",
"0.6517604",
"0.6510617",
"0.63898045",
"0.62360966",
"0.6142677",
"0.6122073",
"0.6062695",
"0.60247856",
"0.599873",
"0.5981011",
"0.59412444",
"0.5935353",
"0.59324205",
"0.58602184",
"0.5843413",
"0.5840974... | 0.73031974 | 0 |
Test that a remote home child L{objectResourcesWithNames} works. | def test_objectresource_loadallobjectswithnames(self):
home01 = yield self.homeUnderTest(txn=self.theTransactionUnderTest(0), name="user01", create=True)
self.assertTrue(home01 is not None)
calendar01 = yield home01.childWithName("calendar")
yield calendar01.createCalendarObjectWithName... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_objectresource_listobjects(self):\n\n home01 = yield self.homeUnderTest(txn=self.theTransactionUnderTest(0), name=\"user01\", create=True)\n self.assertTrue(home01 is not None)\n calendar01 = yield home01.childWithName(\"calendar\")\n yield calendar01.createCalendarObjectWithNa... | [
"0.705474",
"0.69069314",
"0.68966585",
"0.6733986",
"0.65904653",
"0.65114456",
"0.6244911",
"0.6128825",
"0.6107786",
"0.6043371",
"0.60066354",
"0.5999503",
"0.59857136",
"0.595968",
"0.5895118",
"0.5892152",
"0.5884544",
"0.5873066",
"0.58025277",
"0.5736893",
"0.57143927... | 0.76330733 | 0 |
Test that a remote home child L{listObjectResources} works. | def test_objectresource_listobjects(self):
home01 = yield self.homeUnderTest(txn=self.theTransactionUnderTest(0), name="user01", create=True)
self.assertTrue(home01 is not None)
calendar01 = yield home01.childWithName("calendar")
yield calendar01.createCalendarObjectWithName("1.ics", Co... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_objectresource_loadallobjects(self):\n\n home01 = yield self.homeUnderTest(txn=self.theTransactionUnderTest(0), name=\"user01\", create=True)\n self.assertTrue(home01 is not None)\n calendar01 = yield home01.childWithName(\"calendar\")\n yield calendar01.createCalendarObjectWit... | [
"0.7046405",
"0.668914",
"0.66565275",
"0.6642571",
"0.66254884",
"0.6423419",
"0.63975704",
"0.6259069",
"0.6197896",
"0.6192478",
"0.61430436",
"0.6094401",
"0.6093696",
"0.60834354",
"0.60587126",
"0.60237",
"0.5979306",
"0.5978554",
"0.5960225",
"0.5951512",
"0.5892814",
... | 0.7812933 | 0 |
Test that a remote home child L{countObjectResources} works. | def test_objectresource_countobjects(self):
home01 = yield self.homeUnderTest(txn=self.theTransactionUnderTest(0), name="user01", create=True)
self.assertTrue(home01 is not None)
calendar01 = yield home01.childWithName("calendar")
yield calendar01.createCalendarObjectWithName("1.ics", C... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_count_resources(ops_and_shots, expected_resources):\n ops, shots = ops_and_shots\n computed_resources = _count_resources(QuantumScript(ops=ops, shots=shots))\n assert computed_resources == expected_resources",
"def test_get_resource_license_resource_count_list(self):\n pass",
"def coun... | [
"0.70078087",
"0.6457792",
"0.62566626",
"0.62094545",
"0.6199942",
"0.6191505",
"0.61891234",
"0.6090341",
"0.60880125",
"0.60698396",
"0.60005975",
"0.5991619",
"0.59773016",
"0.5965667",
"0.5951554",
"0.5943198",
"0.59415853",
"0.5933044",
"0.593282",
"0.59051484",
"0.5901... | 0.77090025 | 0 |
Test that a remote home child L{objectResourceWithName} and L{objectResourceWithUID} works. | def test_objectresource_objectwith(self):
home01 = yield self.homeUnderTest(txn=self.theTransactionUnderTest(0), name="user01", create=True)
self.assertTrue(home01 is not None)
calendar01 = yield home01.childWithName("calendar")
resource01 = yield calendar01.createCalendarObjectWithName... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_objectresource_resourcenameforuid(self):\n\n home01 = yield self.homeUnderTest(txn=self.theTransactionUnderTest(0), name=\"user01\", create=True)\n self.assertTrue(home01 is not None)\n calendar01 = yield home01.childWithName(\"calendar\")\n yield calendar01.createCalendarObjec... | [
"0.73600596",
"0.73512524",
"0.731341",
"0.7188478",
"0.6983091",
"0.69190943",
"0.6845357",
"0.6772593",
"0.67384213",
"0.65295666",
"0.64954484",
"0.6377555",
"0.632283",
"0.62918544",
"0.62508637",
"0.6205718",
"0.61246353",
"0.60662955",
"0.60546136",
"0.60129535",
"0.597... | 0.793335 | 0 |
Test that a remote home child L{resourceNameForUID} works. | def test_objectresource_resourcenameforuid(self):
home01 = yield self.homeUnderTest(txn=self.theTransactionUnderTest(0), name="user01", create=True)
self.assertTrue(home01 is not None)
calendar01 = yield home01.childWithName("calendar")
yield calendar01.createCalendarObjectWithName("1.i... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_objectresource_resourceuidforname(self):\n\n home01 = yield self.homeUnderTest(txn=self.theTransactionUnderTest(0), name=\"user01\", create=True)\n self.assertTrue(home01 is not None)\n calendar01 = yield home01.childWithName(\"calendar\")\n yield calendar01.createCalendarObjec... | [
"0.6909464",
"0.57989055",
"0.57415986",
"0.55828977",
"0.5582186",
"0.55636317",
"0.5517734",
"0.547026",
"0.5464159",
"0.54337317",
"0.54221886",
"0.5414037",
"0.53791475",
"0.535938",
"0.5343681",
"0.53214014",
"0.5315982",
"0.530254",
"0.5274803",
"0.525948",
"0.52531123"... | 0.7227953 | 0 |
Test that a remote home child L{resourceUIDForName} works. | def test_objectresource_resourceuidforname(self):
home01 = yield self.homeUnderTest(txn=self.theTransactionUnderTest(0), name="user01", create=True)
self.assertTrue(home01 is not None)
calendar01 = yield home01.childWithName("calendar")
yield calendar01.createCalendarObjectWithName("1.i... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_objectresource_resourcenameforuid(self):\n\n home01 = yield self.homeUnderTest(txn=self.theTransactionUnderTest(0), name=\"user01\", create=True)\n self.assertTrue(home01 is not None)\n calendar01 = yield home01.childWithName(\"calendar\")\n yield calendar01.createCalendarObjec... | [
"0.7193015",
"0.5786069",
"0.57567036",
"0.56903446",
"0.5622053",
"0.5610063",
"0.55946016",
"0.55865234",
"0.5564756",
"0.556104",
"0.5529723",
"0.5520841",
"0.5465814",
"0.54566187",
"0.543082",
"0.5393481",
"0.53536713",
"0.5328205",
"0.5328038",
"0.53262407",
"0.5260151"... | 0.7295356 | 0 |
Test that a remote object resource L{create} works. | def test_objectresource_create(self):
home01 = yield self.homeUnderTest(txn=self.theTransactionUnderTest(0), name="user01", create=True)
self.assertTrue(home01 is not None)
yield home01.childWithName("calendar")
yield self.commitTransaction(0)
home = yield self._remoteHome(self... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_create(client):\n rv = create(client, reponame='Michael', url='https://github.com/Michael')\n assert json.loads(rv.data.decode())['code'] == 0\n assert json.loads(rv.data.decode())['owner'] == 'Michael'\n assert json.loads(rv.data.decode())['url'] == 'https://github.com/Michael'",
"def test_... | [
"0.7321922",
"0.6930746",
"0.6891012",
"0.6816935",
"0.674168",
"0.66365075",
"0.66149426",
"0.65473056",
"0.65216506",
"0.646757",
"0.63765794",
"0.6363915",
"0.6357925",
"0.63317674",
"0.62885016",
"0.6244246",
"0.62326944",
"0.6220836",
"0.62166184",
"0.6209589",
"0.620195... | 0.7235324 | 1 |
Test that a remote object resource L{setComponent} works. | def test_objectresource_setcomponent(self):
home01 = yield self.homeUnderTest(txn=self.theTransactionUnderTest(0), name="user01", create=True)
self.assertTrue(home01 is not None)
calendar01 = yield home01.childWithName("calendar")
yield calendar01.createCalendarObjectWithName("1.ics", C... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_objectresource_component(self):\n\n home01 = yield self.homeUnderTest(txn=self.theTransactionUnderTest(0), name=\"user01\", create=True)\n self.assertTrue(home01 is not None)\n calendar01 = yield home01.childWithName(\"calendar\")\n yield calendar01.createCalendarObjectWithName... | [
"0.6539774",
"0.6298994",
"0.62562716",
"0.61385554",
"0.61363655",
"0.61001855",
"0.603852",
"0.59159076",
"0.5911475",
"0.5862129",
"0.58586216",
"0.58125234",
"0.57813257",
"0.5780207",
"0.57760286",
"0.5762465",
"0.57464576",
"0.57112545",
"0.56989205",
"0.5681898",
"0.56... | 0.72049016 | 0 |
Test that a remote object resource L{component} works. | def test_objectresource_component(self):
home01 = yield self.homeUnderTest(txn=self.theTransactionUnderTest(0), name="user01", create=True)
self.assertTrue(home01 is not None)
calendar01 = yield home01.childWithName("calendar")
yield calendar01.createCalendarObjectWithName("1.ics", Comp... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_objectresource_setcomponent(self):\n\n home01 = yield self.homeUnderTest(txn=self.theTransactionUnderTest(0), name=\"user01\", create=True)\n self.assertTrue(home01 is not None)\n calendar01 = yield home01.childWithName(\"calendar\")\n yield calendar01.createCalendarObjectWithN... | [
"0.6527396",
"0.6506946",
"0.64466125",
"0.63633686",
"0.6105598",
"0.6097481",
"0.59535277",
"0.5931569",
"0.589038",
"0.58795553",
"0.5860959",
"0.58502",
"0.58411425",
"0.5814768",
"0.5791095",
"0.5743769",
"0.5738782",
"0.57125044",
"0.5709829",
"0.57074726",
"0.5698187",... | 0.72112405 | 0 |
BSR = bloody simple renderer | def example_BSR():
pts = [(1,1),(2,2),(3,3)]
lines = [ [ (1,1), (1,2), (2,1)], [ (6,1), (1,6), (5,-1)] ]
bloody_simple_2drender('2d_render.png', pts=pts, vecs=pts, lines=lines ) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def dspyRender(self):\n pass",
"def render(self):",
"def render(self, mode='human'):",
"def createBasicRenderSetup():\n\n pass",
"def render(self, rstate):\n pass",
"def load_obj_render_BSR(objfile):\n #load a 3d model and render it in 2D\n obj = object3d() \n obj.load(objfile)\... | [
"0.65584725",
"0.65009344",
"0.63496226",
"0.63178545",
"0.62775916",
"0.62604785",
"0.62505776",
"0.6189125",
"0.6181403",
"0.6181403",
"0.6181403",
"0.6181403",
"0.6181403",
"0.6181403",
"0.6124801",
"0.60717297",
"0.60717297",
"0.5979639",
"0.59157044",
"0.5911578",
"0.589... | 0.7545255 | 0 |
make an animation of the bresenham algorithm this is not a full implementation of bresenham, but it works | def animate_bresenham( x1, y1, x2, y2):
dy = y2-y1
dx = x2-x1
d = 2*dy - dx
x = x1
y = y1
pixels_per_unit = 50
#print(' distances x %s y %s '%(dx,dy) )
#print(' d %s start x %s y %s '%(d,x,y) )
fb = pixel_op()
fb.create_buffer(800, 800)
fb.graticule(pixels_per_u... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def bresenham(self, x0, y0, x1, y1):\n dx = x1 - x0\n dy = y1 - y0\n\n xsign = 1 if dx > 0 else -1\n ysign = 1 if dy > 0 else -1\n\n dx = abs(dx)\n dy = abs(dy)\n\n if dx > dy:\n xx, xy, yx, yy = xsign, 0, 0, ysign\n else:\n dx, dy = dy,... | [
"0.6453002",
"0.6123346",
"0.59405804",
"0.5871821",
"0.57559246",
"0.5752379",
"0.5645527",
"0.56383187",
"0.5603611",
"0.56017333",
"0.55571645",
"0.5535166",
"0.5534522",
"0.5501314",
"0.5490166",
"0.54793966",
"0.5477652",
"0.54669785",
"0.5462504",
"0.54457647",
"0.54045... | 0.7698473 | 0 |
yes_no_choice and yes_no_answer are both of shape (batch, 2) | def predict(self, answer, start_logits, end_logits, mask, yes_no_choice_logits, yes_no_answer_logits,
sentence_logits=None, sentence_mask=None):
if len(answer) not in {5, 6}:
raise NotImplementedError()
if len(answer) == 6 and (sentence_logits is None or sentence_mask is None... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def testQuestionTwo(self):\n self.assertEqual(AnswerQuestionTwo().shape, (5,5), \"Question two's output is not one dimension.\")",
"def check_inputs(x_unlabeled, x_labeled, y_labeled, y_true):\n if x_unlabeled is None:\n if x_labeled is None:\n raise Exception(\"No data, labeled or un... | [
"0.5885943",
"0.56663436",
"0.5588203",
"0.5562511",
"0.55596244",
"0.553949",
"0.55216235",
"0.551788",
"0.5503365",
"0.54991543",
"0.5463042",
"0.5449898",
"0.544924",
"0.54396665",
"0.53937733",
"0.539137",
"0.53331953",
"0.5329368",
"0.5289066",
"0.52698684",
"0.5257796",... | 0.59656316 | 0 |
Initializes and binds a socket for the server on the host and port specified in the configuration file. | def initialize_socket(self):
try:
self.sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
self.sock.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
self.sock.bind((self._host, self._port))
self.sock.listen(10)
except socket.error, (value, messa... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def init_server_socket(self):\r\n server_log.info('Initializing server on {}:{}'.format(self.host, self.port))\r\n self.create_socket(socket.AF_INET, socket.SOCK_STREAM)\r\n self.set_reuse_addr()\r\n self.bind((self.host, self.port))\r\n self.listen(5)\r\n server_log.info(... | [
"0.77743965",
"0.76957494",
"0.76864386",
"0.7536144",
"0.7454617",
"0.726955",
"0.70974326",
"0.7089099",
"0.70806175",
"0.6974333",
"0.69586694",
"0.6943675",
"0.6927393",
"0.69179153",
"0.69146645",
"0.68457586",
"0.6830196",
"0.68201053",
"0.6808112",
"0.6779353",
"0.6775... | 0.77003115 | 1 |
When a family reservation has more than 5 reservation childs, its fails | def test_family_reservation_max_amount_of_childs(self):
start_date = datetime.now()
reservation_list = [
BikeReservationPerHour(start_date)
,BikeReservationPerDay(start_date)
,BikeReservationPerDay(start_date)
,BikeReservationPerWeek(start_date)
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_family_reservation_min_amount_of_childs(self):\n start_date = datetime.now()\n\n reservation_list = [\n BikeReservationPerHour(start_date) \n ,BikeReservationPerDay(start_date)\n ]\n\n with self.assertRaises(InvalidAmountOfBikeReservationsOnFamiliyError):\... | [
"0.77346814",
"0.6190114",
"0.5794727",
"0.55378866",
"0.5503339",
"0.5445569",
"0.54437196",
"0.5401549",
"0.5323681",
"0.52492476",
"0.5230014",
"0.5213248",
"0.52043426",
"0.51897967",
"0.5122295",
"0.51035124",
"0.5077083",
"0.50533175",
"0.5039453",
"0.50383145",
"0.5028... | 0.8038366 | 0 |
When a family reservation has less than 3 reservation childs, its fails | def test_family_reservation_min_amount_of_childs(self):
start_date = datetime.now()
reservation_list = [
BikeReservationPerHour(start_date)
,BikeReservationPerDay(start_date)
]
with self.assertRaises(InvalidAmountOfBikeReservationsOnFamiliyError):
f... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_family_reservation_max_amount_of_childs(self):\n start_date = datetime.now()\n\n reservation_list = [\n BikeReservationPerHour(start_date) \n ,BikeReservationPerDay(start_date)\n ,BikeReservationPerDay(start_date)\n ,BikeReservationPerWeek(start_da... | [
"0.7844922",
"0.60261804",
"0.5891797",
"0.5341298",
"0.52887064",
"0.52673644",
"0.5215869",
"0.5208997",
"0.5205492",
"0.52012867",
"0.51898974",
"0.51862574",
"0.5173381",
"0.51609534",
"0.5118149",
"0.51171005",
"0.5096578",
"0.50721115",
"0.50440776",
"0.50022906",
"0.50... | 0.7672664 | 1 |
Locates the significant cells in a line of sight. Remove cells in order of increasing column density as determined by los7 until the ew changes by ewcut. These spectra are generated with specsynth with no noise. Results are reported in a file called ...iabs_cells.dat | def locateSigCells(run,ion,codeLoc,testing=0):
singleCount = 0
# Read in the galaxy's box
boxfile = '{0:s}_GZa{1:s}.{2:s}.h5'.format(run.galID,run.expn,ion.name)
box = pd.read_hdf(boxfile, 'data')
if testing==1:
print('Box read in')
# Read in the LOS info from lines.info
los_info ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def QDot_detection(self):\r\n\r\n # Creates a list with the total intensities from the lines as to analyze which lines contain quantum dots\r\n total_intensity_list = []\r\n for (columnName, columnData) in self.df4.iteritems():\r\n total_intensity = 0\r\n for i in columnD... | [
"0.5692017",
"0.5332873",
"0.53023607",
"0.5171772",
"0.514693",
"0.5083455",
"0.5027111",
"0.5014268",
"0.5008806",
"0.49852985",
"0.49547678",
"0.49419808",
"0.49326584",
"0.49143994",
"0.4900968",
"0.4898197",
"0.48900622",
"0.48899382",
"0.48678485",
"0.48586193",
"0.4850... | 0.63365793 | 0 |
Heuristic bone name matching algorithm. | def bonenamematch(name1, name2):
if name1 == name2:
return True
if name1.startswith("Bip01 L "):
name1 = "Bip01 " + name1[8:] + ".L"
elif name1.startswith("Bip01 R "):
name1 = "Bip01 " + name1[8:] + ".R"
if name2.startswith("Bip01 L "):
name2 = "Bip01 " + name2[8:] + ".L"... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def fuzz_by_name(self, name):\n self.fuzz_single_node_by_path(re.split('->', name))",
"def _weight_boosting_algorithm(name: str):\n return hp.choice(name, [\"SAMME\", \"SAMME.R\"])",
"def baby_search_engine(name):\r\n \r\n name_ranking = []\r\n \r\n for publication_name, name_list in baby... | [
"0.6086364",
"0.6044579",
"0.5577816",
"0.5363801",
"0.5353174",
"0.53131986",
"0.52843916",
"0.5260653",
"0.52560556",
"0.52094775",
"0.5170339",
"0.51452047",
"0.513423",
"0.50966215",
"0.5092656",
"0.5083263",
"0.50771403",
"0.5076224",
"0.50634646",
"0.503626",
"0.501736"... | 0.60518 | 1 |
Register services with the same address. | def register(self, service_name, service_addr, service_ttl):
raise NotImplementedError | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def register_service(service, iface, name):",
"def _register_services(self, pipeline):\n\n pipeline.register_service(self._aprs_service)",
"def register(self):\n mDNSServices = {}\n for srv in ServiceType:\n mDNSServices.update({srv.name: {}})\n self.service = srv.name\n ... | [
"0.68482167",
"0.66303617",
"0.6445053",
"0.63956916",
"0.6343129",
"0.634234",
"0.63385403",
"0.6250148",
"0.5985422",
"0.5974333",
"0.5974333",
"0.593037",
"0.59139246",
"0.5898792",
"0.58814716",
"0.5767795",
"0.57489437",
"0.57352465",
"0.57320577",
"0.5721772",
"0.571635... | 0.69127417 | 0 |
Unregister services with the same address. | def unregister(self, service_name, service_addr):
raise NotImplementedError | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def unregister_service(self, name):\n self._services.remove(name)",
"def unregister(self, service_name, service_addr, addr_cls=None):\n addr_cls = addr_cls or PlainAddress\n etcd_delete = True\n if addr_cls != PlainAddress:\n etcd_delete = False\n\n for service_name ... | [
"0.7399374",
"0.7348593",
"0.65754735",
"0.6544763",
"0.6515384",
"0.64652634",
"0.6301418",
"0.6275027",
"0.6262423",
"0.6242529",
"0.624204",
"0.6205199",
"0.61922765",
"0.61804545",
"0.6170855",
"0.6166073",
"0.6152947",
"0.6119752",
"0.6116038",
"0.6095147",
"0.602618",
... | 0.80282295 | 0 |
Initialize etcd service registry. | def __init__(self, etcd_host=None, etcd_port=None, etcd_client=None):
self._client = etcd_client if etcd_client else EtcdClient(
etcd_host, etcd_port)
self._leases = {}
self._services = {} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def initService(self):",
"def init_services(self):\n service_prefix = rospy.get_name() + \"/\"\n\n self._request_components_serv = rospy.Service(service_prefix +\n 'list_components',\n ListComponents,\n ... | [
"0.66545385",
"0.6193178",
"0.61256576",
"0.60491484",
"0.60226494",
"0.59913605",
"0.59118575",
"0.58614945",
"0.58411145",
"0.5730066",
"0.5725113",
"0.56855446",
"0.5646716",
"0.5646369",
"0.56286705",
"0.5591608",
"0.5581307",
"0.5547223",
"0.55457485",
"0.55335695",
"0.5... | 0.6800855 | 0 |
Get a gRPC service lease from etcd. | def get_lease(self, service_addr, service_ttl):
lease = self._leases.get(service_addr)
if lease and lease.remaining_ttl > 0:
return lease
lease_id = hash(service_addr)
lease = self._client.lease(service_ttl, lease_id)
self._leases[service_addr] = lease
return... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_service(\n service_name: str,\n version: str = \"v1\",\n configuration: Configuration = None,\n secrets: Secrets = None,\n) -> Resource:\n return client(service_name, version=version, secrets=secrets)",
"def __init__(self, etcd_host=None, etcd_port=None, etcd_client=None):\n self._c... | [
"0.55117226",
"0.5449836",
"0.5421466",
"0.53493935",
"0.53378856",
"0.5304621",
"0.528693",
"0.517074",
"0.5137408",
"0.5093881",
"0.50828904",
"0.50699323",
"0.5067711",
"0.50021654",
"0.49896866",
"0.498775",
"0.49824357",
"0.49687847",
"0.49513283",
"0.49443844",
"0.49443... | 0.68659896 | 0 |
Unregister gRPC services with the same address. | def unregister(self, service_name, service_addr, addr_cls=None):
addr_cls = addr_cls or PlainAddress
etcd_delete = True
if addr_cls != PlainAddress:
etcd_delete = False
for service_name in service_name:
key = self._form_service_key(service_name, service_addr)
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def unregister(self, service_name, service_addr):\n raise NotImplementedError",
"def unregister_service(self, name):\n self._services.remove(name)",
"def unregister_service(self, request, context):\n context.set_code(grpc.StatusCode.UNIMPLEMENTED)\n context.set_details(\"Method not ... | [
"0.74217427",
"0.68777764",
"0.65862525",
"0.61804265",
"0.609942",
"0.60740125",
"0.6039262",
"0.6018743",
"0.6013912",
"0.5976584",
"0.59711635",
"0.5934159",
"0.592958",
"0.5918929",
"0.58726925",
"0.5864621",
"0.584934",
"0.58155584",
"0.5802915",
"0.57488793",
"0.5734429... | 0.6977317 | 1 |
remove accents, upper and punctuation and split into list compare to stop_words reference and remove found items | def clean_string(self):
cleaned = unidecode(self.user_query).lower()
cleaned = re.compile("\w+").findall(cleaned)
return [item for item in cleaned if item not in stop_words] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def stopword_filter(words):\n new_words = []\n for w in words:\n if w in stopwords.words(\"german\"): continue\n else: new_words += [w]\n return new_words",
"def remove_stopwords_fun(self):\n tokens = str(self.doc).split()\n cleaned_tokens = [token for token in tokens\n ... | [
"0.72972363",
"0.7257799",
"0.71417207",
"0.71125436",
"0.71042067",
"0.71001965",
"0.70983416",
"0.7079376",
"0.7072959",
"0.70722336",
"0.7063972",
"0.7055573",
"0.7053656",
"0.70390105",
"0.7018361",
"0.7013695",
"0.7000867",
"0.7000867",
"0.7000867",
"0.7000867",
"0.70000... | 0.72592735 | 1 |
Builds a slim convolutional capsule layer. This layer performs 2D convolution given 5D input tensor of shape `[batch, input_dim, input_atoms, input_height, input_width]`. Then refines the votes with routing and applies Squash non linearity for each capsule. Each capsule in this layer is a convolutional unit and shares ... | def conv_slim_capsule(input_tensor,
input_dim,
output_dim,
layer_name,
input_atoms=8,
output_atoms=8,
stride=2,
kernel_size=5,
padding='SAME',
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def capsule(input_tensor,\n input_dim,\n output_dim,\n layer_name,\n input_atoms=8,\n output_atoms=8,\n **routing_args):\n with tf.variable_scope(layer_name):\n # weights variable will hold the state of the weights for the layer\n w... | [
"0.6237705",
"0.6156805",
"0.615183",
"0.61351883",
"0.5954911",
"0.55484647",
"0.55166894",
"0.5511375",
"0.54273313",
"0.5418236",
"0.5379633",
"0.5347372",
"0.5297061",
"0.5290562",
"0.5248894",
"0.5192532",
"0.5164284",
"0.5164086",
"0.5131476",
"0.5129855",
"0.51218724",... | 0.6761316 | 0 |
Performs 2D convolution given a 5D input tensor. This layer given an input tensor of shape `[batch, input_dim, input_atoms, input_height, input_width]` squeezes the first two dimmensions to get a 4D tensor as the input of tf.nn.conv2d. Then splits the first dimmension and the last dimmension and returns the 6D convolut... | def _depthwise_conv3d(input_tensor,
kernel,
input_dim,
output_dim,
input_atoms=8,
output_atoms=8,
stride=2,
padding='SAME'):
with tf.name_scope('conv'):
i... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def conv2d(args):\n inp_ = args[0]\n kernel = args[1]\n stride = args[2]\n padding = args[3]\n (batch_size, in_channels, H, W) = inp_.shape\n (out_channels, in_channels_t, Hk, Wk) = kernel.shape\n Hc = int((H - Hk)/stride)+1\n Wc = int((W - Wk)/stride)+1\n conv_layer = np.zeros((batch_s... | [
"0.6887719",
"0.67405236",
"0.6705577",
"0.6693739",
"0.66545385",
"0.66511095",
"0.663591",
"0.6633452",
"0.66262656",
"0.66240335",
"0.6623151",
"0.6588454",
"0.6582534",
"0.656623",
"0.65652126",
"0.6564943",
"0.65597445",
"0.65597445",
"0.655458",
"0.65492636",
"0.6545723... | 0.7069529 | 0 |
Builds a fully connected capsule layer. Given an input tensor of shape `[batch, input_dim, input_atoms]`, this op | def capsule(input_tensor,
input_dim,
output_dim,
layer_name,
input_atoms=8,
output_atoms=8,
**routing_args):
with tf.variable_scope(layer_name):
# weights variable will hold the state of the weights for the layer
weights = varia... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def conv_slim_capsule(input_tensor,\n input_dim,\n output_dim,\n layer_name,\n input_atoms=8,\n output_atoms=8,\n stride=2,\n kernel_size=5,\n padd... | [
"0.6867665",
"0.6325789",
"0.5803091",
"0.575039",
"0.5691336",
"0.56583816",
"0.56410503",
"0.56189513",
"0.5585061",
"0.558173",
"0.5563669",
"0.5554573",
"0.55281734",
"0.5507673",
"0.5485954",
"0.54833984",
"0.54604906",
"0.54243445",
"0.5423439",
"0.54152966",
"0.5413802... | 0.7286712 | 0 |
This function returns a list of calendar events results from the calendar service. | def get_events_results(calendar_id=None):
service = get_service()
start, end = get_time_constraints()
if calendar_id != None:
events_results = service.events().list(calendarId=calendar_id,
timeMin=start,
timeMax=end,
singleEvents=True,
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_events():\n\n all_calendar_events = {}\n\n # Suppress warning in logs\n # https://github.com/googleapis/google-api-python-client/issues/299\n service = build('calendar', 'v3', credentials=google_auth.creds, cache_discovery=False)\n\n now = datetime.datetime.utcnow().today().isoformat() + 'Z'... | [
"0.7898893",
"0.7551714",
"0.7526937",
"0.7442396",
"0.72736114",
"0.72320884",
"0.72185147",
"0.71911347",
"0.7124537",
"0.71155274",
"0.7112195",
"0.710049",
"0.707549",
"0.7061256",
"0.70018137",
"0.6983405",
"0.68952",
"0.68224555",
"0.68166924",
"0.68132716",
"0.68114716... | 0.8038324 | 0 |
Verifies the JWT from the HTTP header of the request. | def verify_jwt(*args, **kwargs):
auth = request.headers.get('Authorization', None)
if auth is None:
raise ProcessingException('Authorization header was missing', 401)
parts = auth.split()
if parts[0].lower() != 'Bearer'.lower():
raise ProcessingException('Unsupported authorization typ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def jwt_token_verify(auth_header):\n # Hug do not extract Bearer prefix\n auth_token, payload = parse_header(auth_header)\n return payload",
"def _validate_jwt_token(self):\n # force https so that we don't send around tokens unsecurely\n url = 'https://{}/api/token/verify'.format(urlparse(... | [
"0.765126",
"0.6782319",
"0.6754645",
"0.6746781",
"0.6742103",
"0.6631485",
"0.6536714",
"0.65361",
"0.6428251",
"0.63886696",
"0.63582134",
"0.6264071",
"0.62163144",
"0.6213405",
"0.62002456",
"0.6195042",
"0.61629355",
"0.6144762",
"0.6118049",
"0.6031876",
"0.6009832",
... | 0.7053201 | 1 |
Get a random cover from API | def get_random_cover(request):
logger.debug("get_random_cover called")
response_data = {}
validation = init_validation(request)
if 'error' in validation:
return JsonResponse(validation['data'], status=validation['error'])
headers = {'Content-Type': 'application/json'}
response = reques... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_random_doggo() -> str:\n\n try:\n url = 'https://dog.ceo/api/breeds/image/random'\n response = requests.get(url)\n response.raise_for_status()\n\n return (response.json())['message']\n\n except requests.exceptions.RequestException as e:\n raise SystemExit(e) from No... | [
"0.6326456",
"0.62826574",
"0.6191028",
"0.6157018",
"0.6134517",
"0.59195095",
"0.5835075",
"0.5824782",
"0.58118314",
"0.57838905",
"0.5783723",
"0.5778534",
"0.5777576",
"0.5769638",
"0.5734028",
"0.57287604",
"0.57026213",
"0.56782305",
"0.56750435",
"0.56597",
"0.5599025... | 0.7405508 | 0 |
Get covers statistics from API | def get_covers_stats(request):
logger.debug("get_covers_stats called")
response_data = {}
validation = init_validation(request)
if 'error' in validation:
return JsonResponse(validation['data'], status=validation['error'])
headers = {'Content-Type': 'application/json'}
response = reques... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_covers_ng(request):\n response_data = {}\n\n validation = init_validation(request)\n\n if 'error' in validation:\n return JsonResponse(validation['data'], status=validation['error'])\n\n headers = {'Content-Type': 'application/json'}\n response = requests.get(validation['mongo_url'] +... | [
"0.6301639",
"0.6102803",
"0.6058513",
"0.5936925",
"0.58726734",
"0.5844902",
"0.5796394",
"0.57716745",
"0.57608676",
"0.5736603",
"0.57213414",
"0.5709156",
"0.5709156",
"0.5709156",
"0.5690872",
"0.5686112",
"0.56689596",
"0.5655572",
"0.5654297",
"0.565123",
"0.5594643",... | 0.6970949 | 0 |
Search covers from API | def get_covers_by_search_ng(request):
logger.debug("Entering search covers by query")
response_data = {}
validation = init_validation(request)
if 'error' in validation:
return JsonResponse(validation['data'], status=validation['error'])
headers = {'Content-Type': 'application/json'}
pa... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def search(self,limit,start_date=None,end_date=None,clipper=None):\n\n search_string = self._query_builder(start_date,\n end_date,\n clipper\n )\n\n # Have to manually buil... | [
"0.66080564",
"0.617424",
"0.6091042",
"0.5945272",
"0.5915452",
"0.5789396",
"0.5785066",
"0.5679146",
"0.567254",
"0.5665189",
"0.5660299",
"0.5642634",
"0.56415194",
"0.56408197",
"0.5637181",
"0.5630394",
"0.56243545",
"0.5620951",
"0.5603549",
"0.560314",
"0.5574418",
... | 0.7202266 | 0 |
Returns True if command for .hs can be invoked | def is_enabled_haskell_command(view = None, must_be_project=True, must_be_main=False, must_be_file = False):
window, view, file_shown_in_view = get_haskell_command_window_view_file_project(view)
if not window or not view:
return False
if must_be_file and not file_shown_in_view:
return Fals... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def hasCommand():\n args = sys.argv[1:]\n if '--help' in args:\n return False\n if '-h' in args:\n return False\n for arg in args:\n if arg and not arg.startswith('-'):\n return True\n return False",
"def is_executable(self):\n raise NotImplementedError()",
... | [
"0.6825338",
"0.63825595",
"0.63114893",
"0.6306956",
"0.6228417",
"0.6183935",
"0.61634946",
"0.6161326",
"0.6152913",
"0.6150453",
"0.6085483",
"0.60518086",
"0.60512227",
"0.60250264",
"0.6011512",
"0.5987021",
"0.59834313",
"0.59825546",
"0.5971442",
"0.5968849",
"0.59186... | 0.64808047 | 1 |
Returns window, view and file | def get_haskell_command_window_view_file_project(view = None):
if view:
return view.window(), view, view.file_name()
window = sublime.active_window()
view = None
if window:
view = window.active_view()
file_name = None
if view:
file_name = view.file_name()
return wind... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_window_info (self):\n \n # g.trace(self.w,self.h,self.x,self.y)\n \n return self.w,self.h,self.x,self.y",
"def get_window(self): # real signature unknown; restored from __doc__\n pass",
"def current_window(self):\n pass",
"def view_file(self):\n\n index_li... | [
"0.6693078",
"0.6084513",
"0.58393335",
"0.5751336",
"0.5728551",
"0.5718759",
"0.5637728",
"0.5637728",
"0.5496786",
"0.54849666",
"0.54757553",
"0.547002",
"0.5439881",
"0.54382336",
"0.54201704",
"0.54133946",
"0.53990227",
"0.5393947",
"0.53894895",
"0.5376568",
"0.537142... | 0.69925255 | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.