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 |
|---|---|---|---|---|---|---|
Add vertex to DCEL if it doesn't already exists, otherwise return the existing vertex. | def add_vertex(self, vertex):
try:
vertex_idx = self.vertices.index(vertex)
# print "{} already in {}".format(vertex, self.vertices)
return self.vertices[vertex_idx]
except Exception:
self.vertices.append(vertex)
# print "adding {} to {}".forma... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_vertex(self, vertex):\n if vertex.id not in self.vertices.keys():\n self.vertices[vertex.id] = vertex",
"def _add_vertex(self, x, y):\n v = Vertex2(x, y)\n i = bisect(self.vertices, v)\n \n # if vertex at these coordinates exists just return it\n if le... | [
"0.7698422",
"0.75747514",
"0.7562474",
"0.75239784",
"0.7504211",
"0.7403369",
"0.7356343",
"0.7279313",
"0.71772546",
"0.7124853",
"0.70904213",
"0.7066278",
"0.7066278",
"0.7043618",
"0.70346177",
"0.7016917",
"0.69948727",
"0.6946342",
"0.6899464",
"0.6882716",
"0.6859618... | 0.8166046 | 0 |
Add a face to DCEL if it doesn't already exists, otherwise return the existing face. | def add_face(self, face):
try:
face_idx = self.faces.index(face)
return self.faces[face_idx]
except Exception:
self.faces.append(face)
return face | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_face(self, face):\n\n if face.uuid is None:\n face.uuid = self._generate_uuid()\n\n if face.uuid in self._faces:\n error_str = \"Trying to add an already existing face with uuid: \"\\\n + str(face.uuid)\n raise KeyError(error_str)\n\n sel... | [
"0.7516604",
"0.62119764",
"0.61790365",
"0.5979341",
"0.5872748",
"0.5751965",
"0.5587595",
"0.539488",
"0.5394591",
"0.5375931",
"0.53083056",
"0.5234154",
"0.52226603",
"0.5124483",
"0.5124483",
"0.5102945",
"0.50553864",
"0.5042418",
"0.5035193",
"0.502191",
"0.5008115",
... | 0.8184843 | 0 |
Return a list of vertices that form the outer boundary of finite faces of the DCEL. | def get_outer_boundary_of_voronoi(self):
edge = [edge for edge in self.edges if not edge.nxt][0]
# next(obj for obj in objs if obj.val==5)
first_vertex = edge.origin
outer_boundary = []
while (not edge.get_destination() == first_vertex):
if(edge.get_destination().is_i... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def GetInteriorEdgesQuad(self):\n\n if not isinstance(self.all_edges,np.ndarray):\n self.GetEdgesQuad()\n if not isinstance(self.edges,np.ndarray):\n self.GetBoundaryEdgesQuad()\n\n sorted_all_edges = np.sort(self.all_edges,axis=1)\n sorted_boundary_edges = np.sort... | [
"0.6706478",
"0.6694034",
"0.6630309",
"0.6623699",
"0.66021216",
"0.65841985",
"0.6554914",
"0.64516014",
"0.6362444",
"0.63408965",
"0.6277447",
"0.62755173",
"0.61893046",
"0.6162313",
"0.6147987",
"0.6136316",
"0.612656",
"0.611977",
"0.61181563",
"0.610831",
"0.60700697"... | 0.73313373 | 0 |
Return the dual of the current DCEL. | def dual(self):
def set_twins():
for edge_idx in range(0, len(dual_dcel.edges), 2):
dual_dcel.edges[edge_idx].twin = dual_dcel.edges[edge_idx + 1]
dual_dcel.edges[edge_idx + 1].twin = dual_dcel.edges[edge_idx]
def set_next_and_previous():
for face... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def dual(self):\n return dual_array(self)",
"def getdualobj(self,whichsol_):\n dualobj_ = ctypes.c_double()\n res = __library__.MSK_XX_getdualobj(self.__nativep,whichsol_,ctypes.byref(dualobj_))\n if res != 0:\n _,msg = self.__getlasterror(res)\n raise Error(rescode(res),msg)\n dualo... | [
"0.68338317",
"0.6423258",
"0.5941094",
"0.5921593",
"0.57853687",
"0.57633495",
"0.5762203",
"0.57469624",
"0.5682356",
"0.5682002",
"0.5639214",
"0.5613858",
"0.55889916",
"0.55681217",
"0.5535743",
"0.5530557",
"0.55077",
"0.54985017",
"0.5457592",
"0.54481125",
"0.5441906... | 0.6778644 | 1 |
Printfriendly representation of the DCEL object. | def __repr__(self):
return (
'<DCEL ('
'vertices:\n {obj.vertices},\n'
'edges:\n {obj.edges},\n'
'faces:\n {obj.faces}>'.format(obj=self)
) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __repr__(self):\n cls = self.__class__.__name__\n return '%s(%s)' % (cls, repr(self.d))",
"def __str__(self):\n result=\"curv %f d0 %f z0 %f ctheta %f phi %f barcode %d\"%(self.curv,self.d0,self.z0,self.ctheta,self.phi,self.barcode)\n return result",
"def printObj(self):\n ... | [
"0.71572053",
"0.70599174",
"0.70522857",
"0.69488704",
"0.69239604",
"0.6836956",
"0.6819858",
"0.6812137",
"0.6802802",
"0.6789431",
"0.6776764",
"0.6766797",
"0.6753627",
"0.6751448",
"0.6745186",
"0.67189395",
"0.6699513",
"0.6692117",
"0.6681709",
"0.6676318",
"0.6663971... | 0.74030674 | 0 |
Store the camera intrinsics. We need this for the calibration matrices from the Tango | def new_camera_intrinsics_callback(self, new_camera_info):
self.camera_intrinsics = new_camera_info
self.k_mat = np.matrix(
np.array(self.camera_intrinsics.K).reshape((3, 3))
)
self.k_inv = self.k_mat.I | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def save_intrinsics(self, save_dir):\n if not osp.isfile(\n osp.join(save_dir, 'intrinsics', 'intrinsics.npy')):\n np.save(osp.join(\n save_dir, 'intrinsics', 'intrinsics'), self.camera_model.K)",
"def load_extrinsics(self):\n return self.um.read_json(\"extr... | [
"0.6322945",
"0.597689",
"0.58319306",
"0.5828599",
"0.57685983",
"0.5751193",
"0.57245207",
"0.5624981",
"0.55312103",
"0.550769",
"0.55075365",
"0.5502988",
"0.54702735",
"0.54578793",
"0.53877527",
"0.5327595",
"0.53023946",
"0.5278144",
"0.5220536",
"0.5179092",
"0.516386... | 0.6199243 | 1 |
Add padding for unet of given depth | def _pad(x, depth=4):
divisor = np.power(2, depth)
remainder = x.shape[0] % divisor
# no padding because already of even shape
if remainder == 0:
return x
# add zero rows after 1D feature
elif len(x.shape) == 2:
return np.pad(x, [(0, divisor - remainder), (0, 0)], "constant")
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def space_to_depth_fixed_padding(inputs, kernel_size,\n data_format='channels_last', block_size=2):\n pad_total = kernel_size - 1\n pad_beg = (pad_total // 2 + 1) // block_size\n pad_end = (pad_total // 2) // block_size\n return _padding(inputs, (pad_beg, pad_end), data_format)"... | [
"0.66942734",
"0.6406283",
"0.61821586",
"0.6131536",
"0.5901226",
"0.5837195",
"0.57383364",
"0.56973714",
"0.56866306",
"0.56743133",
"0.56252444",
"0.551921",
"0.55042475",
"0.5423706",
"0.5403531",
"0.54034203",
"0.5395218",
"0.53895396",
"0.538164",
"0.5379684",
"0.53743... | 0.69494796 | 0 |
returns a normalized url to path relative from root | def relative_url(path, root):
try:
url = os.path.relpath(path, root)
except:
error('Unable to make a relative url:', url, root)
url = url.replace('\\', '/') if os.sep == '\\' else url
return urllib.parse.quote(url) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def full_url(self, path):\n if path[0] == '/':\n path = path[1:]\n return urljoin(self.absolute_root, path)",
"def getRootURL():",
"def relative_base(base):\n return as_base(base).lstrip('/')",
"def _graceful_relative_url(base_url, url):\n if url == base_url:\n return ''... | [
"0.75811696",
"0.7120959",
"0.7007499",
"0.6957676",
"0.6937742",
"0.6913981",
"0.6850913",
"0.67784756",
"0.6737724",
"0.67350227",
"0.67350227",
"0.6698321",
"0.6689216",
"0.6677582",
"0.6671769",
"0.6658958",
"0.66039646",
"0.6588936",
"0.65848976",
"0.65747464",
"0.656249... | 0.7165835 | 1 |
Generate Post objects from markdown. Date must be present in each post and posts must be ordrered by date. | def parse_markdown(filename):
if not os.path.exists(filename):
error('File not found', filename)
posts = list()
with open(filename, encoding='utf-8') as f:
line = next(f)
if line.startswith('# '):
title = line[2:].strip()
record = []
next(f)
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def markdown_post(post):\n post['entry'] = markdown(post['entry'].replace(\"\\n\",\" \\n\"), output=\"html5\")\n return post",
"def parse_post_text(formatted_content):\n post = {}\n # Parse Mod comments and remove them from the text.\n potential_comments = re.finditer(\"\\[.+?\\]\", formatted_con... | [
"0.6771389",
"0.62583774",
"0.59715056",
"0.59394884",
"0.59075785",
"0.58579963",
"0.5806396",
"0.58032244",
"0.57632285",
"0.5762416",
"0.575449",
"0.5736609",
"0.5716471",
"0.5630635",
"0.56303996",
"0.55910885",
"0.5574774",
"0.55405563",
"0.5535492",
"0.55039394",
"0.549... | 0.7360025 | 0 |
Purge root dir from irrelevant html files | def purge_htmlfiles(args, posts):
htmlist = list_of_htmlfiles(args, posts)
html_to_remove = list()
for fullname in glob.glob(os.path.join(args.root, '*.htm*')):
if fullname not in htmlist:
html_to_remove.append(fullname)
if len(html_to_remove) > args.thumbnails.threshold_htmlfiles:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def clean(ctx):\n ctx.run(\"rm -rf build/html\")",
"def cleanup():\n download_dir = settings.DOWNLOAD_BASE_DIR\n\n for base, dirs, files in os.walk(download_dir):\n for dir in dirs:\n shutil.rmtree(download_dir + dir)",
"def _cleanup_files(self):\n\n for root, dirs, files in os.walk(self.bu... | [
"0.7720015",
"0.6934762",
"0.68778396",
"0.6763646",
"0.66906065",
"0.6680769",
"0.668029",
"0.66643465",
"0.66492623",
"0.6645479",
"0.6635241",
"0.6626942",
"0.6605654",
"0.65854466",
"0.654416",
"0.6536765",
"0.6526797",
"0.64898103",
"0.64494216",
"0.6443703",
"0.6431596"... | 0.72082686 | 1 |
Purge thumbnail dir from irrelevant thumbnails | def purge_thumbnails(args, thumbdir, posts, diary=False):
thumblist = list_of_thumbnails(posts, diary)
thumbs_to_remove = list()
for fullname in glob.glob(os.path.join(thumbdir, '*.jpg')):
if os.path.basename(fullname) not in thumblist:
thumbs_to_remove.append(fullname)
if len(thumb... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def clear_thumbnails(self):",
"def delete_thumbnail(self, thumbnail_name):",
"def tearDown(self):\n for fn in self.tempImages:\n os.remove(os.path.join(self.root, fn))\n os.rmdir(self.root)",
"def clear_tmp_folder(self):\r\n for file in os.listdir(self.temp_dir):\r\n ... | [
"0.7496226",
"0.70975465",
"0.6904142",
"0.6789052",
"0.65433615",
"0.64652795",
"0.64232606",
"0.6410066",
"0.635366",
"0.6340497",
"0.63255644",
"0.63222384",
"0.6308864",
"0.630171",
"0.6284883",
"0.6272671",
"0.6269268",
"0.62621397",
"0.62551665",
"0.6248571",
"0.6245241... | 0.7741738 | 0 |
Return the list of full paths for pictures and movies in source directory plus subdirectories containing media | def list_of_medias_ext(args, sourcedir):
result = list()
listdir = sorted_listdir(os.listdir(sourcedir))
if '.nomedia' not in listdir:
for basename in listdir:
fullname = os.path.join(sourcedir, basename)
if os.path.isdir(fullname) and basename != '$RECYCLE.BIN' and contains_... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def list_of_files(sourcedir, recursive):\n result = list()\n if recursive is False:\n listdir = sorted_listdir(os.listdir(sourcedir))\n if '.nomedia' not in listdir:\n for basename in listdir:\n result.append(os.path.join(sourcedir, basename))\n else:\n for r... | [
"0.6816371",
"0.6584394",
"0.65694135",
"0.6454687",
"0.64294946",
"0.63914907",
"0.63858587",
"0.6369066",
"0.6280144",
"0.62456554",
"0.6161519",
"0.6160253",
"0.61361057",
"0.61112374",
"0.60726917",
"0.60657465",
"0.6015738",
"0.60046023",
"0.59833866",
"0.5970308",
"0.59... | 0.6835324 | 0 |
Compose html with blogger image urls | def compose_blogger_html(args, title, posts, imgdata, online_videos):
for post in posts:
for media in post.medias:
if type(media) is PostImage:
if media.uri not in imgdata:
print('Image missing: ', media.uri)
else:
img_url, ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def replfunc(self, match):\n url = match.group(1)\n imgformat = url.split('.')[-1]\n if url.startswith('http'):\n data = urlopen(url).read()\n elif url.startswith('data'):\n img = '<img src=\"' + url + '\" ' + match.group(2) + ' />'\n return img\n ... | [
"0.65580297",
"0.6551254",
"0.65510756",
"0.6550227",
"0.6437125",
"0.6404325",
"0.6345454",
"0.63356936",
"0.6310244",
"0.6258961",
"0.6221798",
"0.6157185",
"0.6137797",
"0.60765594",
"0.606654",
"0.6046435",
"0.60122216",
"0.6008134",
"0.60027015",
"0.60017127",
"0.5978731... | 0.74483454 | 0 |
Export blogger html to clipboard. If full, export complete html, otherwise export html extract ready to paste into blogger edit mode. | def prepare_for_blogger(args):
title, posts = parse_markdown(os.path.join(args.root, 'index.md'))
online_images, online_videos = online_images_url(args)
if args.check_images and check_images(args, posts, online_images) is False:
pass
html = compose_blogger_html(args, title, posts, online_image... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def make_backup(filename, html):\n\n with open(filename, 'wb') as f:\n f.write(html)",
"def write_to_paste_buffer(txt):\n pyperclip.copy(txt)",
"def clipboard(self, text = None):\n if text == None:\n response = self._fetch_json('/api/clipboard')\n return response['cont... | [
"0.5765858",
"0.56113607",
"0.55505186",
"0.55185163",
"0.54795206",
"0.5450024",
"0.5427715",
"0.54080874",
"0.5321129",
"0.5313652",
"0.52682567",
"0.52502394",
"0.52400166",
"0.5201354",
"0.5193638",
"0.51862955",
"0.51706195",
"0.51384276",
"0.5110709",
"0.51039314",
"0.5... | 0.6119939 | 0 |
Made after reading config file. Check for ffmpeg in path. Create .thumbnails dir if necessary and create .nomedia in it. Copy photobox file to destination dir. Handle priority between command line and config file. | def setup_part2(args):
if args.update:
args.sourcedir = args.source.sourcedir
args.bydir = args.source.bydir
args.bydate = args.source.bydate
args.diary = args.source.diary
args.recursive = args.source.recursive
args.dates = args.source.dates
args.github_pages... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def take_one_shot(path_to_images, name_image, video_source=\"/dev/video0\"):\n subprocess_cmd(\"ffmpeg -f video4linux2 -s 1280x720 -i {} -frames 1 ./{}/{} -loglevel error -nostats\".format(video_source, path_to_images, name_image))",
"def makeVideo():\n os.system(\"cd video && ffmpeg -r 10 -i img%05d.jpg -... | [
"0.5893241",
"0.57616824",
"0.5529838",
"0.55258685",
"0.55187756",
"0.55067265",
"0.5499056",
"0.54705536",
"0.5458571",
"0.5449385",
"0.54415053",
"0.53093326",
"0.5306078",
"0.53042513",
"0.5287746",
"0.5274733",
"0.5265946",
"0.5246467",
"0.52405924",
"0.5228054",
"0.5227... | 0.57895535 | 1 |
Returns the q'th percentile of the distribution given in the argument 'data'. Uses the 'precision' parameter to control the noise level. | def Quantile(data, q, precision=1.0):
N, bins = np.histogram(data, bins=precision*np.sqrt(len(data)))
norm_cumul = 1.0*N.cumsum() / len(data)
for i in range(0, len(norm_cumul)):
if norm_cumul[i] > q:
return bins[i] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def Quartiles(data):\n q = np.percentile(data, [25, 50, 75])\n\n return q[0], q[1], q[2]",
"def test__quantile(self):\r\n # regular cases\r\n sample_data = array(range(25, 42))\r\n assert_almost_equal(_quantile(sample_data, 0.5), median(sample_data))\r\n\r\n # sorted data is ass... | [
"0.72270185",
"0.7012418",
"0.6803648",
"0.67029893",
"0.67029893",
"0.669614",
"0.6685391",
"0.65556973",
"0.65500534",
"0.65500534",
"0.65500534",
"0.64803755",
"0.64564687",
"0.64286137",
"0.64046985",
"0.6381233",
"0.6363074",
"0.636056",
"0.6354891",
"0.63055617",
"0.626... | 0.7864236 | 0 |
Downloads a YouTube video by its unique id. | def youtube_download_by_id(id, title=None, output_dir='.', merge=True, info_only=False):
raw_video_info = get_content('http://www.youtube.com/get_video_info?video_id=%s' % id)
video_info = parse.parse_qs(raw_video_info)
if video_info['status'] == ['ok'] and ('use_cipher_signature' not in video_inf... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def download(idd, path):\n print(f'[{script}]: Downloading YT video \"{idd}\"...') if verbosity >= 1 else None\n\n try:\n yt = pytube.YouTube(\"https://www.youtube.com/watch?v=\" + idd)\n stream = yt.streams.filter(progressive=True).first()\n stream.download(path, filename=idd)\n exce... | [
"0.7745084",
"0.7303579",
"0.7203833",
"0.71133363",
"0.70373094",
"0.7022766",
"0.69767386",
"0.6973098",
"0.69691336",
"0.69578743",
"0.69145817",
"0.6872059",
"0.68037355",
"0.6796082",
"0.6795651",
"0.67516667",
"0.6571322",
"0.6560047",
"0.65302217",
"0.65141547",
"0.651... | 0.7562303 | 1 |
Check that user_data is a dict and that key is in there | def has_user_data(self, key):
return isinstance(self._user_data, dict) and key in self._user_data | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def check_for_dict(check):",
"def is_valid(data):\n return isinstance(data, dict) \\\n and \"u_id\" in data \\\n and \"token\" in data \\\n and isinstance(data[\"u_id\"], int) \\\n and isinstance(data[\"token\"], str)",
"def can_insert(data):\n return isinstanc... | [
"0.719985",
"0.7077056",
"0.6867152",
"0.6618034",
"0.6470574",
"0.63971496",
"0.63777405",
"0.63742024",
"0.63429755",
"0.63425326",
"0.62384546",
"0.6238243",
"0.61970216",
"0.6187313",
"0.6175904",
"0.61512995",
"0.6139445",
"0.6129756",
"0.610137",
"0.6098412",
"0.6043313... | 0.75419945 | 0 |
Return key from user_data if it's a dict | def get_user_data(self, key, default=None):
if not isinstance(self._user_data, dict):
return default
return self._user_data.get(key) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __getitem__(self, key):\n return self._user_data.get(key)",
"def _get_user_data(self):\n return {\"key\": self._key}",
"def get(self, key):\n return self._user_data.get(key)",
"def _get_key(self, object_type, user_key = None):\n\t\tif not user_key and not self.object_type_keys.has_ke... | [
"0.6847286",
"0.65308297",
"0.6454429",
"0.63964266",
"0.6262093",
"0.618459",
"0.61062187",
"0.60399806",
"0.59043604",
"0.5890058",
"0.5878438",
"0.5858267",
"0.5846593",
"0.58453906",
"0.5799683",
"0.57730305",
"0.57642144",
"0.57528245",
"0.5742863",
"0.5742863",
"0.57288... | 0.6621438 | 1 |
Function to test add furniture functionality. | def test_add_furniture(self):
add_furniture('invoice.csv', 'Elisa Miles', 'LR04', 'Leather Sofa', 25)
add_furniture('invoice.csv', 'Edward Data', 'KT78', 'Kitchen Table', 10)
add_furniture('invoice.csv', 'Alex Gonzales', 'BR02', 'Queen Mattress', 17)
# Generate list of rentals
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_add_data():\n add_furniture(\"invoice_file.csv\", \"Elisa Miles\", \"LR04\", \"Leather Sofa\", 25.00)\n add_furniture(\"invoice_file.csv\", \"Edward Data\", \"KT78\", \"Kitchen Table\", 10.00)\n add_furniture(\"invoice_file.csv\", \"Alex Gonzales\", \"BR02\", \"Queen Mattress\", 17.00)",
"def s... | [
"0.80027395",
"0.70377046",
"0.6918816",
"0.68016565",
"0.6707079",
"0.66921055",
"0.66690326",
"0.6534658",
"0.6481919",
"0.6451947",
"0.64004886",
"0.63858724",
"0.63445914",
"0.6246608",
"0.6238948",
"0.62372917",
"0.6225444",
"0.62142056",
"0.6196843",
"0.61662406",
"0.61... | 0.7485811 | 1 |
runs an automatic check to see if any transcriptions need to be started or are already finished and need to be reuploded\n\n Needs dbConnection & an integer representing the max concurrent transcriptons that can be ran at a time\n\n This is a function that you dont want to parse and upload files from the 'transcripts' ... | def runAutoCheck(dbConnection, maxConcurrent):
# checks if any shows are pending.
fileContent = DatabaseInteract.checkPre(dbConnection)
if(len(fileContent) > 0 and Tools.numRunningProcesses() < maxConcurrent):
cursor = dbConnection.cursor()
cursor.execute("UPDATE transcri... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def parseUpload(dbconnection, fileName):\n nhContent = ParseText.nohupTranscriptionContent(fileName)\n count = 0\n while count < len(nhContent[0]):\n try:\n rtf = nhContent[0][count]\n transcription = nhContent[1][count].replace(\"'\", \"''\").replace(\... | [
"0.5762406",
"0.56196094",
"0.5543294",
"0.54251677",
"0.54135394",
"0.53959346",
"0.5356444",
"0.5315741",
"0.5314573",
"0.5207271",
"0.5122057",
"0.510715",
"0.50821364",
"0.50786346",
"0.5072173",
"0.50637865",
"0.50570357",
"0.505323",
"0.50277853",
"0.5014339",
"0.497700... | 0.7170837 | 0 |
Waits for the running transcription processes to end (2 min intervals). \n Then deletes everything in the 'podcasts' folder, parses all transcripts, and updates the databases | def resetScript(dbConnection, maxConcurrent):
while (Tools.numRunningProcesses() != 0): # wait for the transcriptions to end. Pings every 2 mins
time.sleep(120)
emptyPodcastFolder = Tools.cleanupFolder("podcasts")
DatabaseInteract.refreshDatabase(dbConnection) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def task_queue_podcasts():\n data = get_task_arguments()\n user_uid = data[\"user_uid\"]\n\n client = google.cloud.storage.Client()\n bucket = client.get_bucket(settings.PODCAST_STORAGE_BUCKET)\n podcasts = Podcast.get_user_podcasts(user_uid)\n for podcast in podcasts:\n old_entries = [ent... | [
"0.5957652",
"0.5755388",
"0.54659915",
"0.5391661",
"0.5354948",
"0.5351097",
"0.5270798",
"0.5212245",
"0.5207515",
"0.5192871",
"0.5167002",
"0.5137688",
"0.5125688",
"0.51148933",
"0.5111066",
"0.5101877",
"0.5099718",
"0.509771",
"0.50841075",
"0.5051348",
"0.5043869",
... | 0.67138106 | 0 |
This parses the content of nohup. The size of nohup is basically unlimited but each line has to be under 300000 characters(?). This then returns the following...\n\n index 0 a list of all the occurences of realTimeFactor\n index 1 a list of all the occurences of transcriptions\n index 2 a list of all the occurences of ... | def nohupTranscriptionContent(filePath):
try:
continu = True
fileContent = ""
f = open(filePath, 'r')
while (continu):
temp = f.readline(900000)
if(len(temp) == 0):
continu = False
else:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def fileTranscriptionContent(filePath):\n try:\n continu = True\n f = open(filePath, 'r')\n fileContent = \"\"\n while (continu):\n temp = f.readline(300000)\n if(len(temp) == 0):\n continu = False\n ... | [
"0.5664039",
"0.5516081",
"0.520067",
"0.50546473",
"0.5002102",
"0.49736872",
"0.48318633",
"0.47706318",
"0.47663316",
"0.4757304",
"0.47494912",
"0.47263288",
"0.47130182",
"0.47129261",
"0.4693467",
"0.46848562",
"0.46799994",
"0.4672537",
"0.46613166",
"0.4635302",
"0.46... | 0.754473 | 0 |
This parses the content of the transcription file. The size of the file can basically be unlimited but each line has to be under 300000 characters(?). This then returns the following...\n\n index 0 url\n index 1 realTimeFactor\n index 2 transcription\n | def fileTranscriptionContent(filePath):
try:
continu = True
f = open(filePath, 'r')
fileContent = ""
while (continu):
temp = f.readline(300000)
if(len(temp) == 0):
continu = False
else:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def nohupTranscriptionContent(filePath):\n try:\n continu = True\n fileContent = \"\"\n f = open(filePath, 'r')\n while (continu):\n temp = f.readline(900000)\n if(len(temp) == 0):\n continu = False\n ... | [
"0.67881304",
"0.626287",
"0.6229017",
"0.615032",
"0.61068505",
"0.61058336",
"0.60824823",
"0.6019963",
"0.59705794",
"0.5939803",
"0.5923286",
"0.5885868",
"0.5883228",
"0.583081",
"0.5810255",
"0.5807429",
"0.5763637",
"0.5748194",
"0.5746666",
"0.5737573",
"0.5734013",
... | 0.7538108 | 0 |
deletes all contents of the specified folder (but not the folder itself).\n returns true if successful. False if an error was thrown or the number of running processes is not = 0 | def cleanupFolder(folderName):
try:
if(Tools.numRunningProcesses() == 0):
process = subprocess.call('rm -r ./' + folderName + '/*', shell=True)
return True
else:
return False
except Exception as e:
Tools.writeException("... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def delete_folder(path: str):\n try:\n if os.path.exists(path):\n shutil.rmtree(path)\n return True\n except:\n print(\"An error occured.\")",
"def _rm(folder):\n import os\n import shutil\n for the_file in os.listdir(folder):\n file_path = os... | [
"0.65608245",
"0.6207403",
"0.60895413",
"0.6053084",
"0.60113263",
"0.5985281",
"0.5914889",
"0.58811086",
"0.58790207",
"0.5868364",
"0.5852713",
"0.5824594",
"0.5818425",
"0.58163047",
"0.5810179",
"0.57717085",
"0.5769049",
"0.5744798",
"0.5744438",
"0.5740823",
"0.572649... | 0.70612246 | 0 |
gets the number of runnning transcription processes | def numRunningProcesses():
try:
proc = subprocess.run("ps -Af|grep -i \"online2-wav-nnet3-latgen-faster\"", stdout=subprocess.PIPE, shell=True)
np = (len(str(proc.stdout).split("\\n")) - 3)
if(np == None):
np = 0
return np
except Exception ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def num_processes():\n return 1",
"def num_processes(self):\n return 1",
"def num_processes(self, new_value):",
"def n_worker(self):\n return self.redis.pubsub_numsub(MSG)[0][-1]",
"def GetNumberOfResultsProcessed(self) -> int:\n return self.i",
"def numRunning(self):\n #with self.... | [
"0.7056694",
"0.6808125",
"0.6725539",
"0.66032845",
"0.64222586",
"0.6406968",
"0.6369945",
"0.6350684",
"0.6319151",
"0.6316894",
"0.631224",
"0.62300086",
"0.62215966",
"0.6156739",
"0.6135421",
"0.6128718",
"0.61258286",
"0.611203",
"0.6101045",
"0.60927176",
"0.6082708",... | 0.73324955 | 0 |
Does everything you need to transcribe a podcast given the filename\n Download podcast, wait 40 seconds, change podcast to .wav, wait 10 seconds, remove the .mp3 file, run the transcription | def transcribeAll(service, url, fileName):
if(service == "omny.fm"):
url = url.replace(".mp3","") + ".mp3"
subprocess.Popen("wget -c -O ./podcasts/" + fileName + ".mp3 " + url + " && sleep 40 && ffmpeg -i ./podcasts/"
+ fileName + ".mp3 -acodec pcm_s16le -ac 1 -ar 8000 ./podcasts... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def transcribe_audio_file(filename):\n url = 'https://api.nexiwave.com/SpeechIndexing/file/storage/' + USERNAME +'/recording/?authData.passwd=' + PASSWORD + '&auto-redirect=true&response=application/json'\n\n # To receive transcript in plain text, instead of html format, comment this line out (for SMS, for e... | [
"0.66069883",
"0.6560382",
"0.6439472",
"0.626135",
"0.61909765",
"0.6083509",
"0.6073147",
"0.5968924",
"0.5962577",
"0.5942388",
"0.58873165",
"0.58815217",
"0.5879562",
"0.5855016",
"0.5853225",
"0.5847647",
"0.58247757",
"0.5802723",
"0.5779541",
"0.5740425",
"0.57340455"... | 0.7504941 | 0 |
audiourl > url of the transcriptions mp3 is stored here (NOT NULL)\n PodcastName > THe name of the show (references podcast(name))\n Description > The provided summary of that days podcast\n Date > The date that podcast aired (parsed to mmddyyyy\n Title > The title of that specific podcast\n Duration > the running time... | def insertClip(dbConnection, audiourl, podcastName, description, parsedDate, title):
try:
cursor = dbConnection.cursor()
title = title.replace("'", "''")
cursor.execute("INSERT INTO transcriptions(audiourl, realtimefactor, podcastname, transcription, description, date, title,... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def tokenize_podcast_transcript(args):\n DATA_DIR = os.path.join(os.getcwd(), 'data', args.project_id)\n story_file = os.path.join(DATA_DIR, 'podcast-transcription.txt')\n\n # Read all words and tokenize them\n with open(story_file, 'r') as fp:\n data = fp.readlines()\n\n data = [item.spl... | [
"0.5720898",
"0.56445146",
"0.5573998",
"0.55513567",
"0.55373365",
"0.5462284",
"0.5397166",
"0.53909075",
"0.5349029",
"0.53120935",
"0.51405776",
"0.51242185",
"0.51071036",
"0.50734013",
"0.5052101",
"0.50449437",
"0.50282156",
"0.5022951",
"0.49973148",
"0.49737933",
"0.... | 0.5656862 | 1 |
checks the database for empty transcription entries, returns a list with \n\n index 0 audiourl\n index 1 id\n index 2 podcast name\n index 3 service of podcast | def checkPre(dbConnection):
cursor = dbConnection.cursor()
cursor.execute("SELECT audiourl, T.id, podcastName, source FROM transcriptions AS T JOIN podcasts as P ON P.name = T.podcastname WHERE COALESCE(T.transcription, '') = '' AND pending = FALSE LIMIT 1;")
entry = cursor.fetchone()
cu... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def listMissingItems():\n global doc\n texts = doc.getElementsByTagName(\"text\")\n for t in texts:\n xmlid = t.getAttribute(\"id\")\n for table in langtables:\n execute(\"SELECT * FROM %s WHERE xmlid=\\\"%s\\\"\" % (table, xmlid))\n rows = cursor.fetchall()\n ... | [
"0.5676291",
"0.5263004",
"0.5223297",
"0.52066535",
"0.5155342",
"0.51544493",
"0.51198375",
"0.50936806",
"0.50230044",
"0.49982882",
"0.49966055",
"0.49849313",
"0.4925892",
"0.48985046",
"0.48830864",
"0.48502585",
"0.48242763",
"0.48231605",
"0.48141956",
"0.4793201",
"0... | 0.6268205 | 0 |
given title, if the podcast is in the database already return true. False if the podcast does not exist in the database | def checkIfExists(dbconnection, title):
cursor = dbconnection.cursor()
output = ""
title = title.replace("'", "''")
try:
cursor.execute("SELECT * FROM transcriptions WHERE title = '" + title + "';")
dbconnection.commit()
output = cursor.fetchone()
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def check_if_entry_exists(title: str) -> bool:\n conn = sqlite3.connect('rss.db')\n c = conn.cursor()\n try:\n c.execute(\n \"\"\"select * from entries where title = ?\"\"\",\n (title,)\n )\n records = c.fetchall()\n return len(records) > 0\n except... | [
"0.7373473",
"0.63370997",
"0.6241188",
"0.62162536",
"0.6169572",
"0.6139767",
"0.6122975",
"0.5888012",
"0.5878836",
"0.58756447",
"0.58756447",
"0.58615744",
"0.58349437",
"0.583252",
"0.5811973",
"0.5811524",
"0.58094037",
"0.57614815",
"0.57470703",
"0.57385516",
"0.5726... | 0.7353994 | 1 |
generate the CUSPARSE FFI definition | def generate_cffi_cdef(
cuda_include_path=cuda_include_path, cusparse_header=cusparse_header,
cffi_out_file=None):
with open(cusparse_header, 'r') as f:
cusparse_hdr = f.readlines()
# in some version cusparse_v2.h just points to cusparse.h, so read it
# instead
for line in cusp... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def make_c_header(self):\n res = \\\n\"\"\"PyThreadState* ___madz_LANG_python_thread_state; //Holds Thread State for this interpreter\nPyObject *___madz_LANG_python_wrapper_module; //Hold Pointer to the _madz.py file representing this plugin\ntypedef struct{{\n{function_pointers}\n}}___madz_LANG_python_TYPE... | [
"0.6575036",
"0.6416403",
"0.62135506",
"0.61577857",
"0.6081804",
"0.6024244",
"0.58753806",
"0.5823587",
"0.573958",
"0.5726746",
"0.56846005",
"0.56105137",
"0.55705476",
"0.5551445",
"0.5547371",
"0.55256623",
"0.55013",
"0.54184884",
"0.539809",
"0.53861326",
"0.5378367"... | 0.6747278 | 0 |
Set up the Opple light platform. | def setup_platform(
hass: HomeAssistant,
config: ConfigType,
add_entities: AddEntitiesCallback,
discovery_info: DiscoveryInfoType | None = None,
) -> None:
name = config[CONF_NAME]
host = config[CONF_HOST]
entity = OppleLight(name, host)
add_entities([entity])
_LOGGER.debug("Init l... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def configure(self):\n\n self.platform.configure()",
"def platform_start(self):\n self.platform.start()",
"def setUp(self):\n self.hass = get_test_home_assistant()\n controller_mock = mock.MagicMock()\n dev_dict = {\"address\": \"a1\", \"name\": \"fake_light\", \"brightness_l... | [
"0.670556",
"0.669467",
"0.64281476",
"0.6402788",
"0.6392791",
"0.6329436",
"0.6317174",
"0.6247289",
"0.61651385",
"0.6147113",
"0.6105949",
"0.60822815",
"0.6056726",
"0.60057616",
"0.5982987",
"0.5977405",
"0.59728897",
"0.5957383",
"0.59512126",
"0.59488773",
"0.59368527... | 0.73331904 | 0 |
Return the color temperature of this light. | def color_temp(self):
return kelvin_to_mired(self._color_temp) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def color_temp(self):\n return self._color_temp",
"def getTemperature(self):\n return self.temperature",
"def temperature(self):\n return self._temperature",
"def temperature(self):\n return self._temperature",
"def temperature(self):\n return float(self._current_observat... | [
"0.8550451",
"0.75972027",
"0.75929296",
"0.75929296",
"0.7584848",
"0.7554157",
"0.74379694",
"0.7430193",
"0.73825926",
"0.7336957",
"0.73212904",
"0.72820795",
"0.72075",
"0.72032225",
"0.71964854",
"0.71878976",
"0.7180456",
"0.7172465",
"0.7114398",
"0.7094845",
"0.70741... | 0.8436134 | 1 |
This function returns the number of elements in the numbers list that are divisible by divide. | def listDivide(numbers, divide = 2):
divisible_count = 0
for i in numbers:
if i % divide == 0:
divisible_count += 1
return divisible_count | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def listDivide(numbers, divide=2): \n counter = 0\n for num in numbers:\n if num % divide == 0:\n counter+=1\n return counter",
"def listDivide(numbers, divide=2):\n newList = []\n for i in numbers:\n if i % divide == 0:\n newList.append(i)\n return len(newL... | [
"0.82095575",
"0.8028148",
"0.7676638",
"0.724413",
"0.7203808",
"0.6955737",
"0.6939475",
"0.6889885",
"0.6795731",
"0.6774087",
"0.6745991",
"0.6704762",
"0.66760755",
"0.66736186",
"0.6646036",
"0.65987384",
"0.6588523",
"0.6577694",
"0.6576061",
"0.6554679",
"0.64939314",... | 0.8605654 | 0 |
This function tests the listDivide function. | def testListDivide():
assert listDivide([1,2,3,4,5]) == 2
assert listDivide([2,4,6,8,10]) == 5
assert listDivide([30, 54, 63,98, 100], divide = 10) == 2
assert listDivide([]) == 0
assert listDivide([1,2,3,4,5], 1) == 5 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def testListDivide():\n listDivide([1, 2, 3, 4, 5])\n listDivide([2, 4, 6, 8, 10])\n listDivide([30, 54, 63, 98, 100], divide=10)\n listDivide([])\n listDivide([1, 2, 3, 4, 5], 1)",
"def testListDivide():\n #a\n numbers = [1,2,3,4,5]\n expected = 2\n \n try:\n assert listDivi... | [
"0.8978412",
"0.8315685",
"0.72600734",
"0.7163162",
"0.6961623",
"0.69122976",
"0.6898121",
"0.68613684",
"0.68511623",
"0.6756895",
"0.6750342",
"0.66283035",
"0.66096985",
"0.65842646",
"0.6559477",
"0.64508224",
"0.6335196",
"0.6329726",
"0.6322206",
"0.6280527",
"0.62706... | 0.88921094 | 1 |
Drops an Operation, identified by it's Operation Id and it's children recursively Drop deletes the Operations from Database | def drop_operation(cls,operation_id):
db = cls._core.get_db()
stmnt = "SELECT OPE_ID FROM OPERATIONS WHERE OPE_OPE_PARENT = ? AND OPE_STATUS IN (0, 2) ;"
cur = db.query(cls._core,stmnt,(operation_id,))
for row in cur.fetchallmap():
cls.drop_operation(row["OPE_ID"])
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def cancel_operation(cls,operation_id):\n db = cls._core.get_db()\n\n stmnt = \"SELECT OPE_ID FROM OPERATIONS WHERE OPE_OPE_PARENT = ? AND OPE_STATUS = 0 ;\"\n cur = db.query(cls._core,stmnt,(operation_id,))\n for row in cur.fetchallmap():\n cls.cancel_operation(row[\"OPE_ID\... | [
"0.68534726",
"0.59218234",
"0.5495888",
"0.5355895",
"0.5291793",
"0.5289697",
"0.52653944",
"0.52528286",
"0.5250576",
"0.52433366",
"0.5235218",
"0.5228821",
"0.5226976",
"0.522246",
"0.5191076",
"0.5159619",
"0.5126623",
"0.50397605",
"0.50218856",
"0.50218856",
"0.502188... | 0.79740757 | 0 |
Resets the state of an operation and it's children recursively to 0 (PENDING) The operation is identified by a given operationId | def retry_operation(cls,operation_id):
db = cls._core.get_db()
stmnt = "SELECT OPE_ID FROM OPERATIONS WHERE OPE_OPE_PARENT = ? AND OPE_STATUS = 2 ;"
cur = db.query(cls._core,stmnt,(operation_id,))
for row in cur.fetchallmap():
cls.retry_operation(row["OPE_ID"])
stmn... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def cancel_operation(cls,operation_id):\n db = cls._core.get_db()\n\n stmnt = \"SELECT OPE_ID FROM OPERATIONS WHERE OPE_OPE_PARENT = ? AND OPE_STATUS = 0 ;\"\n cur = db.query(cls._core,stmnt,(operation_id,))\n for row in cur.fetchallmap():\n cls.cancel_operation(row[\"OPE_ID\... | [
"0.6283896",
"0.55792785",
"0.5552252",
"0.55377895",
"0.55284655",
"0.53993994",
"0.5203521",
"0.5042159",
"0.50319934",
"0.50242394",
"0.5023247",
"0.5015806",
"0.50039274",
"0.4977529",
"0.4977529",
"0.4977529",
"0.4977529",
"0.48844925",
"0.4862212",
"0.48437867",
"0.4841... | 0.6371056 | 0 |
Cancels an Operation, identified by it's Operation Id and it's children recursively Cancel Deletes the Operation from Database | def cancel_operation(cls,operation_id):
db = cls._core.get_db()
stmnt = "SELECT OPE_ID FROM OPERATIONS WHERE OPE_OPE_PARENT = ? AND OPE_STATUS = 0 ;"
cur = db.query(cls._core,stmnt,(operation_id,))
for row in cur.fetchallmap():
cls.cancel_operation(row["OPE_ID"])
st... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def drop_operation(cls,operation_id):\n db = cls._core.get_db()\n\n stmnt = \"SELECT OPE_ID FROM OPERATIONS WHERE OPE_OPE_PARENT = ? AND OPE_STATUS IN (0, 2) ;\"\n cur = db.query(cls._core,stmnt,(operation_id,))\n for row in cur.fetchallmap():\n cls.drop_operation(row[\"OPE_I... | [
"0.66223377",
"0.63557035",
"0.63557035",
"0.63557035",
"0.62062633",
"0.5849474",
"0.5820822",
"0.57708067",
"0.5647814",
"0.56469494",
"0.55416864",
"0.55382013",
"0.54923594",
"0.54598767",
"0.5451226",
"0.5448454",
"0.54425424",
"0.54425424",
"0.54425424",
"0.5434237",
"0... | 0.8243501 | 0 |
Restore an Operationobject stored in the database by a Dataset consisting of | def restore_operation(cls, operation_record):
classname = operation_record["OPE_TYPE"]
module = "" #TODO Implement modulename from database if Operation belongs to Module
is_operation_of_module = False
exec """
try:
type(%(class)s)
except NameError,e:
is_operation_of_module = Tru... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def restore(self, oid, serial, data, version, prev_txn, transaction):\n assert not version\n self._check_trans(transaction, 'restore')\n self._async('restorea', oid, serial, data, prev_txn, id(transaction))",
"def restore(self, checkpoint):\n raise NotImplementedError",
"def mos_object(... | [
"0.6201652",
"0.6147818",
"0.5943375",
"0.5855127",
"0.5704961",
"0.56648844",
"0.56335723",
"0.55953205",
"0.55918145",
"0.55536777",
"0.55432135",
"0.5536391",
"0.5470216",
"0.54262424",
"0.539617",
"0.5361314",
"0.5206639",
"0.51915765",
"0.5184326",
"0.5164573",
"0.514952... | 0.6955749 | 0 |
Recursively executes the workloads of Operation's Childoperations It hereby catches exceptions in the workloads, sets the OPE_STATUS to 2 (FAILED) if a catch occurs, then passes the exception on to the higher layer. If an Operation succeeds, it's entry in DB gets deleted | def process_children(cls, operation):
db = cls._core.get_db()
stmnt = "SELECT OPE_ID, OPE_TYPE FROM OPERATIONS WHERE OPE_OPE_PARENT = ? ORDER BY OPE_INVOKED ;"
stmnt_lock = "UPDATE OPERATIONS SET OPE_STATUS = 1 WHERE OPE_ID = ? ;"
cur = db.query(cls._core,stmnt,(operation.get_id(),))
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def retry_operation(cls,operation_id):\n db = cls._core.get_db()\n\n stmnt = \"SELECT OPE_ID FROM OPERATIONS WHERE OPE_OPE_PARENT = ? AND OPE_STATUS = 2 ;\"\n cur = db.query(cls._core,stmnt,(operation_id,))\n for row in cur.fetchallmap():\n cls.retry_operation(row[\"OPE_ID\"]... | [
"0.6481785",
"0.6258558",
"0.6212218",
"0.5927201",
"0.5507661",
"0.5277229",
"0.5242107",
"0.5207474",
"0.51513904",
"0.5112994",
"0.5106702",
"0.5086462",
"0.50150937",
"0.4995987",
"0.49878561",
"0.497371",
"0.49726665",
"0.4905259",
"0.49032328",
"0.48811585",
"0.48808104... | 0.766613 | 0 |
Sets the status of the next toplevel operation to 1 (ACTIVE) Fetches the next topleveloperation from the database, applies a FILESYSTEMLOCK! Which is /tmp/scv_operating.lck !!! | def process_next(cls):
db = cls._core.get_db()
configuration = cls._core.get_configuration()
if os.path.exists(configuration.get_entry("core.webpath")+"/scv_operating.lck"):
return False
lockfile = open(configuration.get_entry("core.webpath")+"/scv_operating.lck","w")
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def arm_oplock_future(self):\n self.oplock_future = self.tree.session.client.oplock_break_future(self.file_id)",
"def processLock(self):\r\n self.controller.executionLock()",
"def active(value):\r\n self.context.active = threading.BoundedSemaphore(value=value)",
"def state_wait_enter(cfg, ap... | [
"0.54746443",
"0.5449821",
"0.54388434",
"0.5305737",
"0.52546555",
"0.52230906",
"0.5174595",
"0.5144526",
"0.5143462",
"0.5060711",
"0.5041392",
"0.50204164",
"0.5015011",
"0.5006248",
"0.50048566",
"0.5001075",
"0.49896038",
"0.4973004",
"0.49551147",
"0.49547556",
"0.4952... | 0.7192307 | 0 |
Sets this operations values from module metadata | def set_values(self,module):
if type(module) == dict:
self.set_value("name",module["name"])
self.set_value("hrname",module["hrname"])
self.set_value("version_major",module["version_major"])
self.set_value("version_minor",module["version_minor"])
self.s... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_metadata(self, data):\r\n pass",
"def __init__(self):\n\n self.operations = {}",
"def PopulateModuleMetadata(self, mod, mojom_file):\n mod.name = os.path.basename(mojom_file.file_name)\n mod.path = mojom_file.file_name\n mod.namespace = mojom_file.module_namespace\n if mojom_f... | [
"0.59990793",
"0.58392733",
"0.5662214",
"0.5603085",
"0.55330473",
"0.55237305",
"0.5490515",
"0.5485604",
"0.5479347",
"0.54730034",
"0.54730034",
"0.54730034",
"0.54730034",
"0.54730034",
"0.54730034",
"0.5461847",
"0.54556865",
"0.54516035",
"0.54180896",
"0.54075307",
"0... | 0.6323762 | 0 |
Returns an Array of ModuleOperationObjects that are currently listedin the queue | def get_currently_processed_modules(cls):
db = cls._core.get_db()
stmnt = "SELECT OPE_ID, OPE_OPE_PARENT, OPE_TYPE FROM OPERATIONS \
WHERE OPE_TYPE = 'ModuleInstallOperation' \
or OPE_TYPE = 'ModuleUninstallOperation' ;"
cur = db.query(cls._core,stmnt);
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def operation_list(self):\n return self._operation_list",
"def operation_list(self):\n return self._operation_list",
"def operation_list(self):\n return self._operation_list",
"def operation_list(self):\n return self._operation_list",
"def get_queue_list(self):\n return s... | [
"0.63590986",
"0.63590986",
"0.63590986",
"0.63590986",
"0.6177426",
"0.5978019",
"0.5920926",
"0.5920926",
"0.5920926",
"0.5920926",
"0.5920926",
"0.5920926",
"0.5920926",
"0.5920926",
"0.5920926",
"0.5798638",
"0.57853013",
"0.5771161",
"0.5731278",
"0.5724055",
"0.56982976... | 0.7111473 | 0 |
Compute squarefree decomposition of the monic ``f`` in ``GF(q)[X]``. Notes ===== Uses a modified version of Musser's algorithm for squarefree decomposition of univariate polynomials over finite fields. References ========== | def _gf_sqf_list(self, f):
domain = self.domain
n, factors, p = 1, [], int(domain.characteristic)
m = int(domain.order // p)
while not f.is_ground:
df = [f.diff(x) for x in self.gens]
if any(_ for _ in df):
g = f
for q in df:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_squarefree(self, f):\n if f.is_ground:\n return True\n g = f\n for x in self.gens:\n g = self.gcd(g, f.diff(x))\n if g.is_ground:\n return True\n return False",
"def sqf_part(self, f):\n domain = self.domain\n\n if d... | [
"0.6348645",
"0.6082395",
"0.60524696",
"0.60362184",
"0.5977433",
"0.5936218",
"0.5890577",
"0.58653134",
"0.5856254",
"0.57929945",
"0.5784882",
"0.5635512",
"0.56248885",
"0.554542",
"0.55379504",
"0.5530155",
"0.5527634",
"0.55048215",
"0.54990107",
"0.5371403",
"0.536764... | 0.6371153 | 0 |
Return ``True`` if ``f`` is a squarefree polynomial in ``K[X]``. Examples ======== >>> _, x, y = ring('x y', ZZ) >>> ((x + y)2).is_squarefree False >>> (x2 + y2).is_squarefree True | def is_squarefree(self, f):
if f.is_ground:
return True
g = f
for x in self.gens:
g = self.gcd(g, f.diff(x))
if g.is_ground:
return True
return False | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_squarefree_hilbert_number(n):\n return is_hilbert_number(n) and is_hilbert_squarefree_number(n)",
"def isNodeSheaf(_session, _node):\n return checkIncToSets(_session, _node, [keynodes.info.stype_sheaf], sc.SC_A_CONST | sc.SC_POS)",
"def is_sqf(f):\n return dmp_sqf_p(f.rep, f.lev, f.dom)",
... | [
"0.56360364",
"0.5465797",
"0.5397887",
"0.5356589",
"0.533036",
"0.51120263",
"0.50754285",
"0.5052217",
"0.49830848",
"0.49745223",
"0.49274656",
"0.4885014",
"0.48708126",
"0.484963",
"0.48122284",
"0.47914714",
"0.47727177",
"0.47523925",
"0.47462133",
"0.47416347",
"0.47... | 0.74997777 | 0 |
Squarefree norm of ``f`` in ``K[X]``, useful over algebraic domains. Returns ``s``, ``f``, ``r``, such that ``g(x) = f(xsa)`` and ``r(x) = Norm(g(x))`` is a squarefree polynomial over K, where ``a`` is the algebraic extension of ``K``. Examples ======== >>> _, x, y = ring('x y', QQ.algebraic_field(I)) >>> (xy + y2).sqf... | def sqf_norm(self, f):
domain = self.domain
if not domain.is_AlgebraicField:
raise DomainError(f'ground domain must be algebraic, got {domain}')
new_ring = self.to_ground().inject(*domain.symbols, front=True)
g = domain.mod.set_ring(new_ring)
s = 0
while Tr... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sqf_norm(f):\n s, g, r = dmp_sqf_norm(f.rep, f.lev, f.dom)\n return s, f.per(g), f.per(r, dom=f.dom.dom)",
"def squared_frobenius_norm(x):\n # http://mathworld.wolfram.com/FrobeniusNorm.html\n # The gradient of KL[p,q] is not defined when p==q. The culprit is\n # tf.norm, i.e., we cann... | [
"0.6828397",
"0.6347827",
"0.58674204",
"0.58420646",
"0.57301825",
"0.56841624",
"0.56582105",
"0.56257766",
"0.5603542",
"0.55873054",
"0.5552461",
"0.55447716",
"0.55371946",
"0.5521278",
"0.5477447",
"0.54771346",
"0.5461877",
"0.54501307",
"0.54418135",
"0.53796417",
"0.... | 0.7036989 | 0 |
Start twisted event loop and the fun should begin... brokerTimeout how long to wait for a broker a negative number upon failure. Otherwise, it never returns. | def start(config, brokerTimeout = 60.0):
manager = multiprocessing.Manager()
serverUpEvent = manager.Event()
broker = multiprocessing.Process(target=startSTOMPBroker, args=(config,serverUpEvent))
broker.daemon = True
broker.name = 'STOMP-Broker'
broker.start()
serverUpEvent.wait(brokerTimeout)
if no... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def on_running():\n log.msg('reactor_loop Starting')\n try:\n conn = client.connect(reactor)\n si446x_do = Si446xComponent(conn)\n conn.addCallback(si446x_do.start)\n conn.addErrback(si446x_do.on_error)\n except error.DBusException, e:\n l... | [
"0.6220351",
"0.62159324",
"0.61877704",
"0.6160593",
"0.61132985",
"0.59028834",
"0.58682054",
"0.5843688",
"0.5822215",
"0.5798466",
"0.57124496",
"0.57084095",
"0.566796",
"0.56646776",
"0.56603914",
"0.5605297",
"0.55968124",
"0.55797726",
"0.55603266",
"0.55498093",
"0.5... | 0.6690256 | 0 |
Calculates the solar noon (the time when the sun is at its highest point.) | def solar_noon(self, date=None, local=True):
if self.astral is None:
self.astral = Astral()
if date is None:
date = datetime.date.today()
noon = self.astral.solar_noon_utc(date, self.longitude)
if local:
return noon.astimezone(self.tz) ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def solar_noon_local(LonDegE):\n return 12.",
"def solar_noon_utc(self, date, longitude):\n \n julianday = self._julianday(date.day, date.month, date.year)\n\n newt = self._jday_to_jcentury(julianday + 0.5 + longitude / 360.0)\n\n eqtime = self._eq_of_time(newt)\n timeUTC = ... | [
"0.6816998",
"0.66865885",
"0.6304783",
"0.6012745",
"0.60126984",
"0.59854287",
"0.592383",
"0.585429",
"0.5843106",
"0.5810727",
"0.58008647",
"0.5759068",
"0.5738313",
"0.57033736",
"0.570194",
"0.56586534",
"0.5638657",
"0.5631576",
"0.5618385",
"0.5601817",
"0.55713826",... | 0.6865988 | 0 |
Calculates the solar azimuth angle for a specific date/time. | def solar_azimuth(self, dateandtime=None):
if self.astral is None:
self.astral = Astral()
if dateandtime is None:
dateandtime = datetime.datetime.now(tz=self.tz)
return self.astral.solar_azimuth(dateandtime, self.latitude, self.longitude) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def solar_azimuth(self, dateandtime, latitude, longitude):\n \n if latitude > 89.8:\n latitude = 89.8\n \n if latitude < -89.8:\n latitude = -89.8\n \n zone = -dateandtime.utcoffset().seconds / 3600.0\n utc_datetime = dateandtime.astimezone(pytz.ut... | [
"0.78250027",
"0.67446834",
"0.6695796",
"0.64115757",
"0.6395283",
"0.63717794",
"0.63140875",
"0.62267244",
"0.6145953",
"0.6141899",
"0.6060071",
"0.598316",
"0.5980102",
"0.59746766",
"0.5884954",
"0.58290213",
"0.5812057",
"0.58084035",
"0.57966334",
"0.5779464",
"0.5756... | 0.7764275 | 1 |
Calculates the solar elevation angle for a specific time. | def solar_elevation(self, dateandtime=None):
if self.astral is None:
self.astral = Astral()
if dateandtime is None:
dateandtime = datetime.datetime.now(tz=self.tz)
return self.astral.solar_elevation(dateandtime, self.latitude, self.longitude) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def solar_elevation(self, dateandtime, latitude, longitude):\n \n if latitude > 89.8:\n latitude = 89.8\n \n if latitude < -89.8:\n latitude = -89.8\n\n zone = -dateandtime.utcoffset().seconds / 3600.0\n utc_datetime = dateandtime.astimezone(pytz.utc)... | [
"0.71530664",
"0.67977107",
"0.67431724",
"0.6220381",
"0.61309683",
"0.6082073",
"0.6003304",
"0.5945914",
"0.5920471",
"0.58973986",
"0.5858497",
"0.58510685",
"0.58294576",
"0.579033",
"0.57864755",
"0.57316357",
"0.5688304",
"0.56844896",
"0.56828004",
"0.56804633",
"0.56... | 0.70600396 | 1 |
Initialise the city database and set the default depression. | def __init__(self):
self._citydb = CityDB()
self._depression = 6 # Set default depression in degrees | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def setUp(self):\n self.my_city = City()",
"def initialize():\n sql_db = SQLConnection()\n with SQLCursor(sql_db) as cur:\n cur.execute('SELECT position from govt_info')\n row = cur.fetchone()\n for pos in Government.positions:\n if row is None or len(row) != len(Gove... | [
"0.6182034",
"0.6132606",
"0.60481834",
"0.60060346",
"0.5950479",
"0.5950479",
"0.59373367",
"0.59160274",
"0.5874279",
"0.58517987",
"0.5830317",
"0.58109874",
"0.5791189",
"0.57841307",
"0.5774677",
"0.57559514",
"0.5754031",
"0.57528317",
"0.5746476",
"0.5727893",
"0.5670... | 0.77128774 | 0 |
Returns the City instance specified by ``key``. | def __getitem__(self, key):
city = self._citydb[key]
city.astral = self
return city | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_city(self, name: str):\n key = name.lower()\n try:\n return self._cities[key]\n except KeyError:\n city = City(name=name, state=self)\n self._cities[key] = city\n return city",
"def __getitem__(self, key):\n \n key = str(key).... | [
"0.6803799",
"0.64028823",
"0.61282915",
"0.6064786",
"0.598396",
"0.5972638",
"0.59683293",
"0.59556264",
"0.5922655",
"0.5832542",
"0.5792213",
"0.5784531",
"0.57582283",
"0.573862",
"0.57019925",
"0.5670712",
"0.56591344",
"0.56591344",
"0.56481266",
"0.56079686",
"0.55630... | 0.769488 | 0 |
Calculate dawn time in the UTC timezone. | def dawn_utc(self, date, latitude, longitude):
julianday = self._julianday(date.day, date.month, date.year)
if latitude > 89.8:
latitude = 89.8
if latitude < -89.8:
latitude = -89.8
t = self._jday_to_jcentury(julianday)
eqti... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def dawn(self, date=None, local=True):\n\n if self.astral is None:\n self.astral = Astral()\n\n if date is None:\n date = datetime.date.today()\n\n dawn = self.astral.dawn_utc(date, self.latitude, self.longitude)\n\n if local:\n return dawn.astimezone(se... | [
"0.628965",
"0.59754497",
"0.58763033",
"0.5851417",
"0.5806555",
"0.5735901",
"0.56585526",
"0.56538594",
"0.55857354",
"0.55760634",
"0.5519843",
"0.55160165",
"0.55128175",
"0.55116653",
"0.53910935",
"0.5379949",
"0.536428",
"0.5360612",
"0.53601545",
"0.5338035",
"0.5333... | 0.76470286 | 0 |
Calculate sunrise time in the UTC timezone. | def sunrise_utc(self, date, latitude, longitude):
julianday = self._julianday(date.day, date.month, date.year)
t = self._jday_to_jcentury(julianday)
eqtime = self._eq_of_time(t)
solarDec = self._sun_declination(t)
try:
hourangle = self._hour_angle_sunrise(l... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _get_sun_rise_set_time(self, sun_time):\n if sun_time:\n return datetime.fromtimestamp(sun_time).strftime(self.time_format)\n return sun_time",
"def alt_sunrise(cls, date):\n rise = cls.UJJAIN.dawn(date, angle(0, 47, 0))\n return 1/24 * 1/60 * iround(rise * 24 * 60)",
... | [
"0.74266624",
"0.7356725",
"0.72597265",
"0.7091791",
"0.70251125",
"0.7006317",
"0.6827473",
"0.68216705",
"0.68117666",
"0.66464955",
"0.65655184",
"0.6516135",
"0.6488186",
"0.6406055",
"0.63925016",
"0.6312478",
"0.62507564",
"0.6104449",
"0.60976666",
"0.6094293",
"0.605... | 0.79015124 | 0 |
Calculate solar noon time in the UTC timezone. | def solar_noon_utc(self, date, longitude):
julianday = self._julianday(date.day, date.month, date.year)
newt = self._jday_to_jcentury(julianday + 0.5 + longitude / 360.0)
eqtime = self._eq_of_time(newt)
timeUTC = 720.0 + (longitude * 4.0) - eqtime
timeUTC = timeUTC/60... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def solar_noon(self, date=None, local=True):\n \n if self.astral is None:\n self.astral = Astral()\n\n if date is None:\n date = datetime.date.today()\n\n noon = self.astral.solar_noon_utc(date, self.longitude)\n\n if local:\n return noon.astimezo... | [
"0.6777714",
"0.6724988",
"0.6343755",
"0.626581",
"0.62460506",
"0.59971875",
"0.59616363",
"0.594989",
"0.5928303",
"0.5893481",
"0.5877765",
"0.58015263",
"0.5749765",
"0.5749219",
"0.5719723",
"0.571865",
"0.571865",
"0.56694263",
"0.5617303",
"0.5612241",
"0.56063336",
... | 0.74279106 | 0 |
Calculate sunset time in the UTC timezone. | def sunset_utc(self, date, latitude, longitude):
julianday = self._julianday(date.day, date.month, date.year)
t = self._jday_to_jcentury(julianday)
eqtime = self._eq_of_time(t)
solarDec = self._sun_declination(t)
try:
hourangle = self._hour_angle_sunset(lat... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sunset(self, date=None, local=True):\n \n if self.astral is None:\n self.astral = Astral()\n\n if date is None:\n date = datetime.date.today()\n\n sunset = self.astral.sunset_utc(date, self.latitude, self.longitude)\n\n if local:\n return suns... | [
"0.65699303",
"0.64950114",
"0.63881093",
"0.61808205",
"0.61730003",
"0.6134258",
"0.60923696",
"0.60374415",
"0.60219973",
"0.5875478",
"0.5835468",
"0.5818931",
"0.5818664",
"0.58087045",
"0.5799634",
"0.57659054",
"0.57374483",
"0.5717565",
"0.5715173",
"0.5711675",
"0.57... | 0.74293166 | 0 |
Calculate dusk time in the UTC timezone. | def dusk_utc(self, date, latitude, longitude):
julianday = self._julianday(date.day, date.month, date.year)
if latitude > 89.8:
latitude = 89.8
if latitude < -89.8:
latitude = -89.8
t = self._jday_to_jcentury(julianday)
eqti... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def utcTime():\r\n return calendar.timegm(time.gmtime())",
"def _get_tz():\n return 'UTC'",
"def get_time():\n\teastern = timezone('US/Eastern')\n\tnow = datetime.datetime.now(eastern).time()\n\treturn(now)",
"def timezone():\n \n pass",
"def nowUTC():\n return datetime.datetime.now(pytz.utc)... | [
"0.69508314",
"0.6756243",
"0.646933",
"0.64476836",
"0.64054435",
"0.6378315",
"0.6367498",
"0.6344899",
"0.630024",
"0.6293508",
"0.62492496",
"0.62225604",
"0.6172558",
"0.615256",
"0.6152383",
"0.6115891",
"0.61116207",
"0.610577",
"0.6104182",
"0.6066876",
"0.606603",
... | 0.7123817 | 0 |
Calculate ruhakaalam times in the UTC timezone. | def rahukaalam_utc(self, date, latitude, longitude):
if date is None:
date = datetime.date.today()
try:
sunrise = self.sunrise_utc(date, latitude, longitude)
sunset = self.sunset_utc(date, latitude, longitude)
except:
raise AstralError('S... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def rahukaalam(self, date=None, local=True):\n\n if self.astral is None:\n self.astral = Astral()\n\n if date is None:\n date = datetime.date.today()\n\n rahukaalam = self.astral.rahukaalam_utc(date, self.latitude, self.longitude)\n\n if local:\n for key... | [
"0.6330134",
"0.61681116",
"0.60523003",
"0.59781736",
"0.5969716",
"0.56076247",
"0.55986744",
"0.55825686",
"0.5552908",
"0.5434768",
"0.53342485",
"0.53334755",
"0.53267014",
"0.5321076",
"0.5287703",
"0.5276938",
"0.5276938",
"0.5272016",
"0.52586037",
"0.5246418",
"0.522... | 0.6230036 | 1 |
Calculate the azimuth of the sun in the UTC timezone. | def solar_azimuth(self, dateandtime, latitude, longitude):
if latitude > 89.8:
latitude = 89.8
if latitude < -89.8:
latitude = -89.8
zone = -dateandtime.utcoffset().seconds / 3600.0
utc_datetime = dateandtime.astimezone(pytz.utc)
tim... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def solar_azimuth(self, dateandtime=None):\n\n if self.astral is None:\n self.astral = Astral()\n\n if dateandtime is None:\n dateandtime = datetime.datetime.now(tz=self.tz)\n \n return self.astral.solar_azimuth(dateandtime, self.latitude, self.longitude)",
"... | [
"0.67131555",
"0.6504118",
"0.64523375",
"0.6439935",
"0.6436878",
"0.641925",
"0.6345609",
"0.6120051",
"0.6109093",
"0.6081307",
"0.6055947",
"0.6041341",
"0.6014488",
"0.5996403",
"0.5920246",
"0.5873155",
"0.586566",
"0.5822988",
"0.58073103",
"0.5778373",
"0.573385",
"... | 0.6639568 | 1 |
Calculates the phase of the moon on the specified date. | def moon_phase(self, date):
jd = self._julianday(date.day, date.month, date.year)
DT = pow((jd - 2382148), 2) / (41048480*86400)
T = (jd + DT - 2451545.0) / 36525
T2 = pow(T,2)
T3 = pow(T,3)
D = 297.85 + (445267.1115*T) - (0.0016300*T2) + (T3/545868)
D = ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def moon_phase(self, date=None):\n self._set_site_date(date)\n self.moon.compute(self.site)\n return self.moon.moon_phase",
"def equation_of_time(cls, date):\n offset = cls.sine(cls.mean_position(date, cls.ANOMALISTIC_YEAR))\n equation_sun = (offset * angle(57, 18, 0) * (14/360... | [
"0.7753409",
"0.64832145",
"0.6266615",
"0.6266615",
"0.5898424",
"0.5834775",
"0.5758287",
"0.5736949",
"0.5586432",
"0.5580027",
"0.5443291",
"0.5376677",
"0.53231025",
"0.53126574",
"0.5306432",
"0.5282793",
"0.52764946",
"0.5266146",
"0.5248463",
"0.5236514",
"0.5230845",... | 0.7782467 | 0 |
Reorder 'shape' according to the chosen data layout to optimize data distribution. | def _optimizeshape(shape):
shape.sort()
if ORDER == 'C':
shape[:] = shape[::-1] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def unchanged_shape(input_shape):\n return input_shape",
"def restore_backup_shape(self):\n\n self.shape = self.shape_backup",
"def backup_shape(self):\n\n self.shape_backup = np.copy(self.shape)",
"def set_shape(self, shape):\n self._shape = self._shape.merge_with(shape)",
"def change_... | [
"0.601357",
"0.6012796",
"0.59265906",
"0.59111005",
"0.58404654",
"0.5758127",
"0.57051116",
"0.5653655",
"0.5619018",
"0.5616662",
"0.5612885",
"0.56128573",
"0.561095",
"0.5574861",
"0.5568789",
"0.55197614",
"0.5517362",
"0.551245",
"0.54615873",
"0.54567415",
"0.54471827... | 0.7083111 | 0 |
True if ghost layer length is not zero. | def has_ghosts(self):
return not np.all(self.mesh.discretization.ghosts == 0) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def empty(self):\n return len(self.layers) == 0",
"def is_empty(self):\n return ch.prod(ch.tensor(self.x.shape)).item() == 0",
"def is_ghost(self):\n\t\treturn False",
"def is_trivial(self):\n return self.dims == 0",
"def is_empty(self) -> bool:\n return self.num_grna() == 0",
... | [
"0.7561698",
"0.72112876",
"0.7065583",
"0.7046145",
"0.7030016",
"0.69214237",
"0.6830907",
"0.6792221",
"0.67822015",
"0.67809653",
"0.67568576",
"0.6733361",
"0.6685363",
"0.6656976",
"0.6638194",
"0.6637561",
"0.6615059",
"0.660577",
"0.65900713",
"0.6586594",
"0.658374",... | 0.72264445 | 1 |
True if target and current object are equal and have the same parent. Equal means same mesh, same shape and same domain. | def is_consistent_with(self, target):
same_parent = self.parent() == target.parent()
# Note FP. Is it really required to have the
# same parent? Inclusion of all proc may be enough?
return npw.equal(self.shape, target.shape).all() and same_parent | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __eq__(self, other):\n if self.__class__ != other.__class__:\n return False\n return self.mesh == other.mesh and \\\n npw.equal(self.shape, other.shape).all() and \\\n self.domain == other.domain",
"def __eq__(self, other):\n parent_same = self.parent1.ri... | [
"0.70844996",
"0.66548616",
"0.66513604",
"0.6646044",
"0.64481336",
"0.6433953",
"0.63558435",
"0.63483995",
"0.6299958",
"0.6295003",
"0.62756413",
"0.6267289",
"0.6267289",
"0.6267289",
"0.6267289",
"0.6267289",
"0.626677",
"0.62649465",
"0.62575334",
"0.6204619",
"0.62005... | 0.7603044 | 0 |
True if current topo is complient with target. | def can_communicate_with(self, target):
if self == target:
return True
msg = 'You try to connect topologies belonging to'
msg += ' two different mpi tasks. Set taskids properly or use'
msg += ' InterBridge.'
assert self.task_id() == target.task_id(), msg
# Pa... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def independent(self) -> bool:\n parent = self._parent()\n if parent is None:\n return True\n connections = parent._graph.connections\n path = self._path\n lp = len(path)\n for con in connections:\n if con[\"type\"] == \"connection\":\n ... | [
"0.63338524",
"0.61239785",
"0.6074758",
"0.5993989",
"0.59502983",
"0.5931595",
"0.59294623",
"0.59263664",
"0.5918986",
"0.58928543",
"0.5868036",
"0.5846863",
"0.58454454",
"0.5810941",
"0.5808112",
"0.58062047",
"0.57958764",
"0.5795005",
"0.5779186",
"0.5778966",
"0.5777... | 0.735502 | 0 |
Collect global indices of local meshes on each process of topo | def gather_global_indices(topo, toslice=True, root=None, comm=None):
if comm is None:
comm = topo.parent()
size = comm.size
start = topo.mesh.start()
end = topo.mesh.stop() - 1
# communicator that owns the topology
rank = comm.Get_rank()
dimension = to... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_local_indices(self, part, ctx):\n return self.map_to_global(\n F.arange(0, self.local_size(part), ctx=ctx), part\n )",
"def _exchange_ghosts_local(self):\n for d in xrange(self._dim):\n self._exchange_ghosts_local_d(d)",
"def getGlobalIndices( self, indices: l... | [
"0.6674267",
"0.607246",
"0.59368324",
"0.58657676",
"0.5651199",
"0.56479245",
"0.56453234",
"0.5612734",
"0.5533967",
"0.5532873",
"0.5474459",
"0.5465615",
"0.5442727",
"0.5435518",
"0.54162186",
"0.5397795",
"0.535609",
"0.5344314",
"0.534363",
"0.5338216",
"0.5314248",
... | 0.70098007 | 0 |
This functions does the same thing as gather_global_indices but may also work when topo is None. The function is usefull if you need to collect global indices on a topo define only on a subset of comm, when for the procs not in this subset, topo will be equal to None. In such a case, comm and dom are required. This may... | def gather_global_indices_overlap(topo=None, comm=None, dom=None,
toslice=True, root=None):
if topo is None:
assert comm is not None and dom is not None
size = comm.Get_size()
rank = comm.Get_rank()
dimension = dom.dimension
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def gather_global_indices(topo, toslice=True, root=None, comm=None):\n if comm is None:\n comm = topo.parent()\n size = comm.size\n start = topo.mesh.start()\n end = topo.mesh.stop() - 1\n # communicator that owns the topology\n rank = comm.Get_rank()\n d... | [
"0.78130454",
"0.55268973",
"0.5226445",
"0.51116353",
"0.50954676",
"0.48668343",
"0.4836725",
"0.47469142",
"0.4703786",
"0.4642443",
"0.45836034",
"0.45445976",
"0.45384085",
"0.45181572",
"0.44909367",
"0.4485813",
"0.4471921",
"0.44507834",
"0.4396532",
"0.4384738",
"0.4... | 0.7679277 | 1 |
Return true if all mpi processes of child belong to parent | def is_parent(child, parent):
# Get the list of processes
assert child is not None
assert parent is not None
#child_ranks = [i for i in xrange(child.Get_size())]
child_group = child.Get_group()
parent_group = parent.Get_group()
inter_group = MPI.Group.Intersect(ch... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def has_mpi_peer_processes():\n return mpi4py_available and MPI.COMM_WORLD.Get_size() > 1",
"def contains_parent(self, pid):\n return pid in self._parent_ids",
"def check_parent_processes_alive():\n cur_process = psutil.Process()\n parent = cur_process.parent()\n while True:\n ... | [
"0.6905076",
"0.6545807",
"0.6406559",
"0.63527286",
"0.6351458",
"0.6243226",
"0.62221795",
"0.6163074",
"0.6159543",
"0.615525",
"0.6027681",
"0.5970372",
"0.5956478",
"0.5952117",
"0.5878544",
"0.58695066",
"0.5852495",
"0.579879",
"0.57776415",
"0.5767349",
"0.57645994",
... | 0.82558614 | 0 |
Number of processess common to comm_1 and comm_2 | def intersection_size(comm_1, comm_2):
if comm_1 == MPI.COMM_NULL or comm_2 == MPI.COMM_NULL:
return None
group_1 = comm_1.Get_group()
group_2 = comm_2.Get_group()
inter_group = MPI.Group.Intersect(group_1, group_2)
return inter_group.Get_size() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def common_count(self, node_1, node_2):\n return int(len(set(nx.neighbors(self.graph, node_1)).intersection(set(nx.neighbors(self.graph, node_2)))))",
"def communities_with_protesters(partition, active_nodes):\n return len(set([partition[node] for node in active_nodes]))",
"def _num_of_consolidated(s... | [
"0.71106726",
"0.64436406",
"0.6228776",
"0.6228776",
"0.62096745",
"0.6076676",
"0.60679585",
"0.59844345",
"0.59690386",
"0.5953923",
"0.5925899",
"0.5922579",
"0.59189546",
"0.5907016",
"0.58420223",
"0.5753761",
"0.57528996",
"0.5745631",
"0.574225",
"0.5684263",
"0.56555... | 0.71126 | 0 |
Compare two mpi communicators. Returns true if the two communicators are handles for the same group of proc and for the same communication context. | def compare_comm(comm_1, comm_2):
assert comm_1 != MPI.COMM_NULL
assert comm_2 != MPI.COMM_NULL
result = MPI.Comm.Compare(comm_1, comm_2)
res = [MPI.IDENT, MPI.CONGRUENT, MPI.SIMILAR, MPI.UNEQUAL]
return result == res[0] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def compare_groups(comm_1, comm_2):\n assert comm_1 != MPI.COMM_NULL\n assert comm_2 != MPI.COMM_NULL\n result = MPI.Comm.Compare(comm_1, comm_2)\n res = [MPI.IDENT, MPI.CONGRUENT, MPI.SIMILAR, MPI.UNEQUAL]\n return result in res[:-1]",
"def has_mpi_peer_processes():\n retur... | [
"0.74933475",
"0.61300033",
"0.6039855",
"0.59951395",
"0.5934048",
"0.58377117",
"0.5620288",
"0.55401844",
"0.5411162",
"0.5404919",
"0.53369236",
"0.5305763",
"0.53046554",
"0.52937305",
"0.52503824",
"0.52165604",
"0.52162445",
"0.51967853",
"0.51824045",
"0.5172295",
"0.... | 0.76038 | 0 |
Compare the groups of two mpi communicators. Returns true if each comm handles the same group of mpi processes. | def compare_groups(comm_1, comm_2):
assert comm_1 != MPI.COMM_NULL
assert comm_2 != MPI.COMM_NULL
result = MPI.Comm.Compare(comm_1, comm_2)
res = [MPI.IDENT, MPI.CONGRUENT, MPI.SIMILAR, MPI.UNEQUAL]
return result in res[:-1] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def compare_comm(comm_1, comm_2):\n assert comm_1 != MPI.COMM_NULL\n assert comm_2 != MPI.COMM_NULL\n result = MPI.Comm.Compare(comm_1, comm_2)\n res = [MPI.IDENT, MPI.CONGRUENT, MPI.SIMILAR, MPI.UNEQUAL]\n return result == res[0]",
"def same_group(self,i,j):\n if self.g... | [
"0.7372509",
"0.61725867",
"0.60191995",
"0.597187",
"0.5756517",
"0.56709945",
"0.5612317",
"0.5581606",
"0.5556505",
"0.5444479",
"0.5426828",
"0.541855",
"0.5415436",
"0.54028773",
"0.53394014",
"0.52934015",
"0.52109265",
"0.519534",
"0.5183995",
"0.51758873",
"0.506649",... | 0.8524684 | 0 |
Find the values of ranks in target from ranks in source. | def convert_ranks(source, target):
assert source != MPI.COMM_NULL and target != MPI.COMM_NULL
g_source = source.Get_group()
g_target = target.Get_group()
size_source = g_source.Get_size()
r_source = [i for i in xrange(size_source)]
res = MPI.Group.Translate_ranks(g_source... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def findRanks(toBeRanked, values):\n\treturn list(map(lambda e: findRank(e, values), toBeRanked))",
"def rank_results(result_index, source2target):\n result2rank = defaultdict(lambda: [])\n for term, targets in result_index.items():\n ranked = sorted(targets, key=lambda tup: tup[1], reverse=True)\n ... | [
"0.6195965",
"0.61417454",
"0.57947445",
"0.554299",
"0.5502083",
"0.53975844",
"0.533245",
"0.528168",
"0.5239981",
"0.5233992",
"0.5226889",
"0.5212047",
"0.5168843",
"0.5151811",
"0.5149276",
"0.5147061",
"0.5105847",
"0.5105718",
"0.50940347",
"0.5074896",
"0.505985",
"... | 0.64136374 | 0 |
Compute drift score as the percentage of overlapping probabilities | def compute_drift_score(ref_col_prob, col_prob):
return sum(abs(np.asarray(ref_col_prob) - np.array(col_prob)) * 100) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def calculate(self):\n\n gt = self.ground_truth.flatten().astype(np.int8)\n seg = self.segmentation.flatten().astype(np.int8)\n\n probability_difference = np.absolute(gt - seg).sum()\n probability_joint = (gt * seg).sum()\n\n if probability_joint != 0:\n return probabi... | [
"0.6732613",
"0.6518283",
"0.6426524",
"0.6424136",
"0.6334499",
"0.6254541",
"0.6188233",
"0.61744064",
"0.6095827",
"0.6077343",
"0.6045876",
"0.5990594",
"0.5986692",
"0.59864265",
"0.59614843",
"0.5960128",
"0.5936167",
"0.5935803",
"0.59078395",
"0.590509",
"0.58760846",... | 0.7712985 | 0 |
Combine training and inference datasets as one data frame | def combine_train_infer(train_file, infer_dir):
train_df = pd.read_feather(train_file)
time_range = range(len([f for f in os.listdir(infer_dir) if 'feather' in f]))
infer_df_list = [pd.read_feather(f'{infer_dir}/{t}.feather') for t in time_range]
comb_df_list = []
train_df.index = [-1] * len(trai... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_training_data():\n \n X = pd.read_csv('../data/train_values.csv').set_index('sequence_id')\n y = pd.read_csv('../data/train_labels.csv').set_index('sequence_id')\n return X, y",
"def triples(self):\n return pd.concat((self._load_train(), self._load_valid(), self._load_test()))",
"def... | [
"0.6369666",
"0.63546294",
"0.63196236",
"0.62988764",
"0.6283459",
"0.62768555",
"0.6249582",
"0.6194825",
"0.6187834",
"0.61582404",
"0.6153339",
"0.6152186",
"0.6096578",
"0.6096578",
"0.6080581",
"0.60757023",
"0.6061717",
"0.6044782",
"0.60430914",
"0.6011937",
"0.597610... | 0.66650474 | 0 |
Call the shell script that handles BLAST database formatting. | def format_blast(makeblastdb_path, fname):
# The script is written in shell, so this function just calls it and
# checks the output
# Build the shell command
cmd = ['bash', DBFORMAT_SCRIPT, makeblastdb_path, fname]
# Execute the script
# shell=False to ensure that we aren't executing c... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def command_dbtool(self):\n dbtool.main(*self.args())",
"def makeblastdb(files, db_name, db_type):\n with open(db_name + \".pin\", \"w\") as f:\n f.write(\"\\n\".join(db_name))\n return subprocess.run([\"makeblastdb\", \"-in\", db_name + \".pin\", \"-dbtype\", db_type)",
"def blastn_command... | [
"0.615836",
"0.6075764",
"0.59140235",
"0.58454984",
"0.58075655",
"0.5771629",
"0.5752413",
"0.57355833",
"0.5695151",
"0.5693321",
"0.5688143",
"0.5677002",
"0.5629271",
"0.56139135",
"0.56128824",
"0.55926937",
"0.55580354",
"0.5531508",
"0.55243224",
"0.55176175",
"0.5516... | 0.7314453 | 0 |
Returns tag of the first matched ListofValues. For each element in ``series`` returned is the tag of the listofvalues in the dictionary of LoVs ``taglov`` which first matches the element with one of its values OR value from donor with the same index OR ``na``. | def which_tag(series: pd.Series,
taglov: Union[TagLoV, Any],
na: Any,
donor: pd.Series = None,
method: Optional[Union[Callable, str]] = None,
**kwargs):
if series.empty:
return series
if not isinstance(taglov, TagLoV):
taglov ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def tag_one(self, tokens, index, history):\n tag = None\n for tagger in self._taggers:\n tag = tagger.choose_tag(tokens, index, history)\n if tag is not None:\n break\n return tag",
"def find_usefull_tags(tags, tagmodel, tag_count_vect):\n\n final_tags... | [
"0.61236465",
"0.5222297",
"0.52140766",
"0.49421668",
"0.49218923",
"0.49208298",
"0.47892955",
"0.47874418",
"0.47012714",
"0.46522093",
"0.4625487",
"0.46219954",
"0.45822042",
"0.45629826",
"0.45510745",
"0.45039132",
"0.44938043",
"0.44818074",
"0.44803494",
"0.44793394",
... | 0.7129057 | 0 |
prepro 200x235x3 uint8 frame into 8300 (83x100) 1D float vector | def prepro(I):
# """ prepro 200x235x3 uint8 frame into 10000 (100x100) 1D float vector """
I = I[35:200] # crop - remove 35px from start & 35px from end of image in x, to reduce redundant parts of image (i.e. after ball passes paddle)
I = I[::2,::2,0] # downsample by factor of 2
I[I == 43] = 0 # erase... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def preprocess(self, frame: np.ndarray) -> torch.TensorType:\n tensor = cv.resize(frame, (self.IMGSZ, self.IMGSZ)) \n tensor = tensor.transpose(2, 0, 1)\n tensor = torch.from_numpy(tensor)\n tensor = torch.unsqueeze(tensor, 0)\n tensor = tensor.half() if self.half else tensor.f... | [
"0.6424506",
"0.6271997",
"0.6116359",
"0.6106592",
"0.6086693",
"0.6025813",
"0.6025813",
"0.59201217",
"0.586013",
"0.5815289",
"0.5804463",
"0.564739",
"0.5637826",
"0.56362927",
"0.56270623",
"0.5616849",
"0.5541839",
"0.5488203",
"0.54803914",
"0.54658365",
"0.54447323",... | 0.6721163 | 0 |
Test _arrange_test_result method with only one module. | def test_arrange_test_result_one_module(self):
pass_1 = self._create_test_result(status=test_runner_base.PASSED_STATUS)
pass_2 = self._create_test_result(status=test_runner_base.PASSED_STATUS)
pass_3 = self._create_test_result(status=test_runner_base.PASSED_STATUS)
fail_1 = self._create_... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_arrange_test_result_multi_module(self):\n group_a_pass_1 = self._create_test_result(group_name='grpup_a',\n status=test_runner_base.PASSED_STATUS)\n group_b_pass_1 = self._create_test_result(group_name='grpup_b',\n ... | [
"0.7826515",
"0.6627111",
"0.6378898",
"0.6037766",
"0.58032465",
"0.5796728",
"0.57169634",
"0.5695606",
"0.5693893",
"0.56901085",
"0.5688211",
"0.5681043",
"0.5648296",
"0.56379336",
"0.5626959",
"0.56251144",
"0.56239635",
"0.5623645",
"0.5619237",
"0.5617106",
"0.5615719... | 0.8463349 | 0 |
Test _arrange_test_result method with multi module. | def test_arrange_test_result_multi_module(self):
group_a_pass_1 = self._create_test_result(group_name='grpup_a',
status=test_runner_base.PASSED_STATUS)
group_b_pass_1 = self._create_test_result(group_name='grpup_b',
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_arrange_test_result_one_module(self):\n pass_1 = self._create_test_result(status=test_runner_base.PASSED_STATUS)\n pass_2 = self._create_test_result(status=test_runner_base.PASSED_STATUS)\n pass_3 = self._create_test_result(status=test_runner_base.PASSED_STATUS)\n fail_1 = self... | [
"0.8273559",
"0.71171457",
"0.59634614",
"0.59479153",
"0.58932537",
"0.5843216",
"0.57562256",
"0.57490045",
"0.57445383",
"0.5740733",
"0.57388484",
"0.5723813",
"0.57204384",
"0.5707784",
"0.5704445",
"0.57039195",
"0.56746626",
"0.56736004",
"0.5648056",
"0.56323606",
"0.... | 0.8312768 | 0 |
Test _arrange_test_result method with multi runner. | def test_arrange_test_result_multi_runner(self):
runner_a_pass_1 = self._create_test_result(runner_name='runner_a',
status=test_runner_base.PASSED_STATUS)
runner_a_pass_2 = self._create_test_result(runner_name='runner_a',
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_arrange_test_result_multi_module(self):\n group_a_pass_1 = self._create_test_result(group_name='grpup_a',\n status=test_runner_base.PASSED_STATUS)\n group_b_pass_1 = self._create_test_result(group_name='grpup_b',\n ... | [
"0.8005941",
"0.7942821",
"0.6458603",
"0.6281796",
"0.61934733",
"0.6125403",
"0.61176115",
"0.6106937",
"0.6105472",
"0.6088446",
"0.6071222",
"0.6060519",
"0.60560644",
"0.6031968",
"0.60201895",
"0.60119915",
"0.59998757",
"0.5996369",
"0.5989808",
"0.5985094",
"0.5966215... | 0.84070575 | 0 |
A Helper to create TestResult | def _create_test_result(self, **kwargs):
test_info = test_runner_base.TestResult(**RESULT_TEST_TEMPLATE._asdict())
return test_info._replace(**kwargs) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _makeResult(self):\n\n result = super(CustomTextTestRunner, self)._makeResult()\n result.test_case_count = self.test_case_count\n return result",
"def getTestResults():",
"def create_success(test, time):\n return _TestInfo(test, time)",
"def create_result(main_test):\n ... | [
"0.73380005",
"0.707614",
"0.6962716",
"0.68611425",
"0.67847985",
"0.671325",
"0.67094016",
"0.67094016",
"0.66369814",
"0.64441335",
"0.64401895",
"0.64096403",
"0.62658703",
"0.6241152",
"0.6234344",
"0.6229282",
"0.6228823",
"0.62096107",
"0.61986804",
"0.6181871",
"0.611... | 0.8006094 | 0 |
generate a list of viable coordinates for mines, and randomly choose them. | def generate_mines(self, number):
mine_locations = []
available_places = [[j, i]
for i in xrange(0, self.x) for j in xrange(0, self.y)]
while number > 0:
# the chosen coordinate for a mine is appended into the list and is
# removed from the lis... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def random_coordinates():\n return Coordinates(random.randint(0, 14), random.randint(0, 14))",
"def add_mines(self):\n for x, y in sample(list(itertools.product(range(self.width), range(self.height))), self.num_mines):\n self.grid[y][x] = self.mine",
"def _generate_mines(self):\r\n ... | [
"0.6889577",
"0.68553376",
"0.6830914",
"0.6830659",
"0.66476494",
"0.64785975",
"0.64664406",
"0.646031",
"0.6445049",
"0.6439096",
"0.6436462",
"0.64131314",
"0.6397925",
"0.6376756",
"0.6361325",
"0.6299357",
"0.62326545",
"0.6220271",
"0.6188136",
"0.61843365",
"0.615677"... | 0.7681125 | 0 |
Open neighbours if the flag number matches the count. | def special_open_neighbours(self, y, x):
if self.table_state[y][x] != "-" and self.table_state[y][x] == self.flags_nearby(y, x):
l = [[ye, xe] for xe in range(
x - 1, x + 2) if xe >= 0 for ye in range(y - 1, y + 2) if ye >= 0]
for ye, xe in l:
if xe >= sel... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def check_open(self, n_faces):\r\n count_used = Counter([item for sublist in self.tiles\r\n for item in sublist\r\n if item in self.get_borders()])\r\n if min(count_used.values()) == n_faces:\r\n self.open = False",
"def check... | [
"0.6551041",
"0.6264699",
"0.6198644",
"0.6008779",
"0.59324574",
"0.58290005",
"0.58284974",
"0.58284974",
"0.58235085",
"0.5753008",
"0.57382154",
"0.5685492",
"0.56439877",
"0.5639313",
"0.56212676",
"0.5600274",
"0.55936295",
"0.55705774",
"0.55526507",
"0.5544796",
"0.55... | 0.65664035 | 0 |
Open neighbours if the current coordinates are 0 and neighbours are untouched. Recursively opens if the neighbours are also 0. | def open_neighbours(self, y, x):
if [y, x] in self.mine_locations:
return [y, x]
# generate neighbours with positive indexes
l = [[ye, xe] for xe in range(
x - 1, x + 2) if xe >= 0 for ye in range(y - 1, y + 2) if ye >= 0]
for ye, xe in l:
# if the ind... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def open_neighbour_cells(self, my_board, x, y):\n for _x in range(x-1, x+2):\n for _y in range(y-1, y+2):\n if is_valid(_x, _y):\n if is_new_move(my_board, _x, _y):\n my_board[_x, _y] = self.count_neighbour_mines(_x, _y)\n ... | [
"0.6919871",
"0.6919871",
"0.68459386",
"0.6506167",
"0.64691454",
"0.615098",
"0.61087185",
"0.6104565",
"0.60708123",
"0.60645074",
"0.60544246",
"0.5988625",
"0.592371",
"0.5901404",
"0.5862205",
"0.5847411",
"0.5810795",
"0.5798435",
"0.5754326",
"0.57496643",
"0.5704948"... | 0.75434107 | 0 |
come here when the coordinates do not have a bomb. update the table_state with the selected coordinate. | def tease_user(self, y, x):
self.table_state[y][x] = self.final_table[y][x]
# if there are no neighbouring 0s, open neighbours
if self.table_state[y][x] == '0':
self.open_neighbours(y, x)
self.print_table(self.table_state) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def click_cell(self, event):\n if (self.world_setable):\n x, y = event.x, event.y\n row = y / self.cell_size\n col = x / self.cell_size\n if ((row in range(self.cell_row)) and\n (col in range(self.cell_col))):\n status_now = not self.... | [
"0.61604476",
"0.57963514",
"0.5728119",
"0.5681672",
"0.5650815",
"0.5578061",
"0.55363643",
"0.55130213",
"0.548478",
"0.5473019",
"0.54568815",
"0.54379356",
"0.5364507",
"0.5332647",
"0.53126705",
"0.5300106",
"0.52811605",
"0.5278566",
"0.52776027",
"0.5275714",
"0.52650... | 0.6044062 | 1 |
Method that check if file at provided url exist. | def file_exist(file_url):
try:
response = requests.head(file_url)
if 200 <= response.status_code < 300:
return True
return False
except ConnectionError:
return False | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _url_exists(self, url):\n return url_exists(url)",
"def exists(self, url):\n return (self.base_path / url).exists()",
"def url_exists(url):\n # Check for URLs we can't validate\n if url.startswith(\"https://kiwiirc.com\"):\n return True\n if url.startswith(\"https://www.projec... | [
"0.7852359",
"0.7844551",
"0.77893347",
"0.77855074",
"0.7775254",
"0.7766845",
"0.7766845",
"0.76954746",
"0.76517665",
"0.75399566",
"0.7395437",
"0.7388874",
"0.7315557",
"0.72969633",
"0.72895604",
"0.7279086",
"0.7263453",
"0.7241822",
"0.71523726",
"0.7136986",
"0.70900... | 0.84588355 | 0 |
Method that based on file url return appropriate hash. | def get_hash(file_url):
file_extension = os.path.splitext(file_url)[1]
return str(HASHES.get(file_extension)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_hash(self, filepath):\n if (os.path.isfile(filepath) and not (\n os.path.islink(filepath) and self.ignorelinks)):\n file_hash = self.hashfile(open(filepath, 'rb'))\n else:\n file_hash = self.hashstring(filepath)\n if not self._increment_hash:\n ... | [
"0.7292291",
"0.72585297",
"0.72363",
"0.7177594",
"0.7159621",
"0.70332694",
"0.70052016",
"0.6999285",
"0.69315827",
"0.6879491",
"0.6835787",
"0.6830834",
"0.6828008",
"0.6765713",
"0.67623746",
"0.67612416",
"0.6758131",
"0.6731684",
"0.6731684",
"0.67308",
"0.67212594",
... | 0.8334774 | 0 |
Newton's second law of motion for measuring stoppnig distance Newton's second law of motion is d = (1/2)(v02/(mug)) so the stopping distance of an object in motion, like a car, can be measured. The friction coefficient measures how slick a road is with a default of 0.3. | def stopping_length_function(initial_velocity=120, friction_coefficient=0.3):
g = 9.81
v0 = initial_velocity/3.6
mu = friction_coefficient
return (1/2)*(v0**2/(mu*g)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def calc_force_from_damping(v, damping, masses):\n F = masses*damping*np.diff(v, 0)\n\n return F",
"def duty_cycle_by_force(newton: float, profile: GripForceProfile) -> float:\n if profile.min <= newton <= profile.max:\n return sum(ele[1] * (newton ** ele[0]) for ele in profile.polynomial... | [
"0.6221095",
"0.5993694",
"0.59182566",
"0.5850141",
"0.5800747",
"0.5787989",
"0.56625694",
"0.55726403",
"0.55664736",
"0.555712",
"0.5540242",
"0.5521722",
"0.5505632",
"0.54962945",
"0.5486384",
"0.54847544",
"0.5474211",
"0.5469343",
"0.5457595",
"0.545249",
"0.54498357"... | 0.70825905 | 0 |
Integration function Using scitools.StringFunction to do integration. >>> integration.py 'sin(x)' 0 pi/2 | def integrate_function():
def midpoint_integration(f, a, b, n=100):
h = (b - a)/float(n)
I = 0
for i in range(n):
I += f(a + i*h + 0.5*h)
return h*I
f_formula = sys.argv[1]
a = eval(sys.argv[2])
b = eval(sys.argv[3])
if len (sys.argv) >= 5:
n = i... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def integrate(f, inf_lim, sup_lim):\n function = get_function_from_text(f)\n return sp_integrate.quad(function, inf_lim, sup_lim)[0]",
"def sin(x):\r\n # see decorator for function body\r",
"def f(x):\n return (2.0*math.sin(10.0*x+1.0)+1.0)",
"def a_math_function():\n return np.sin(2*np.pi)",
... | [
"0.63227785",
"0.62122375",
"0.61956286",
"0.60972846",
"0.6085416",
"0.60581106",
"0.60526955",
"0.60383034",
"0.6019527",
"0.5990838",
"0.5950136",
"0.5950136",
"0.5950136",
"0.5950136",
"0.58858174",
"0.588468",
"0.58532083",
"0.58137757",
"0.5803429",
"0.5779814",
"0.5709... | 0.74676055 | 0 |
Calculating the psi operator for the transport and production of the enstrophy | def psi_enstrophy(
Tau, # SGS; (6,64,64,64)
h = False, # spatial step size
flag = True): # spectral flag; default is gradient tool
#---------------------------------------------------------------------#
# Default variables ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _phi2psi(self):\n try:\n locq = self.param_q(self.rhotor)\n except:\n self._readeqdsk(self.shot)\n locq = self.param_q(self.rhotor)\n \n locphi = self.rhotor**2\n psi = integrate.cumtrapz(1/locq,locphi)\n psi = np.concatenate([[... | [
"0.66981435",
"0.6571289",
"0.64863443",
"0.64510655",
"0.6450011",
"0.63740313",
"0.6351212",
"0.6321734",
"0.6310165",
"0.62904805",
"0.62640244",
"0.623965",
"0.61741835",
"0.61319333",
"0.6116678",
"0.60592675",
"0.6031023",
"0.6012221",
"0.600168",
"0.59927183",
"0.59659... | 0.66243196 | 1 |
Gets the coordinates of this atom. Returns | def get_coords(self):
return self.coords | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def coordinates(self):\n return self.xy",
"def get_coordinates(self):\n return self.coordinates",
"def coordinates(self):\n return self._coordinates",
"def coordinates(self):\n return self._coordinates",
"def getCoords(self):\r\n \r\n return self.coords",
"def co... | [
"0.8518098",
"0.8345379",
"0.82986754",
"0.82986754",
"0.82948023",
"0.8146323",
"0.8145044",
"0.8112127",
"0.8061573",
"0.8036323",
"0.8036323",
"0.7918564",
"0.7912341",
"0.7905923",
"0.789621",
"0.7851619",
"0.77691483",
"0.77299666",
"0.76837",
"0.76726896",
"0.766294",
... | 0.8384263 | 1 |
Gets the x coordinate of this atom. Returns | def get_x(self):
return self.coords[0] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def Getxcoord(self):\n return self.x_coord",
"def _get_x(self):\n return self.position.x",
"def getXCoordinate(self) -> float:\n return self.x_coord",
"def get_x_position(self):\n return self.actual_coordinates[0]",
"def x(self):\n return self._coords[0]",
"def get_pos_... | [
"0.8656004",
"0.8442269",
"0.84205234",
"0.83736426",
"0.8353082",
"0.83035123",
"0.82412916",
"0.8212211",
"0.82038295",
"0.81553376",
"0.8097587",
"0.80942667",
"0.7829044",
"0.78141165",
"0.78131527",
"0.7794782",
"0.7767253",
"0.77473986",
"0.773306",
"0.76320076",
"0.762... | 0.8588003 | 1 |
Gets the z coordinate of this atom. Returns | def get_z(self):
return self.coords[2] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getZ(self):\n return self.position.getZ()",
"def getZ(self):\n\t\treturn self.coords.z",
"def z(self):\n return self._coords[2]",
"def z(self):\n return self.coords[2]",
"def get_z(self) -> int:\n return self.__z",
"def z(self):\r\n return self.position.z",
"def getZ(... | [
"0.8616124",
"0.86023843",
"0.8559942",
"0.84333587",
"0.83052397",
"0.82192296",
"0.80853426",
"0.80163383",
"0.80163383",
"0.80163383",
"0.79635745",
"0.79482794",
"0.78137195",
"0.77216375",
"0.7505032",
"0.74130934",
"0.73766494",
"0.7360839",
"0.730008",
"0.729796",
"0.7... | 0.8734822 | 0 |
Gets the mass of this atom. Returns | def get_mass(self):
return self.m | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def mass(self):\n return self._mass",
"def mass(self):\n return self._mass",
"def get_mass(self):\n _pal.lib.geometry_get_mass.restype = c.c_float\n return _pal.lib.geometry_get_mass(self._geometry)",
"def mass(self):\n return self._getAttribute(Attribute.mass)",
"def getMole... | [
"0.8615101",
"0.8615101",
"0.8449791",
"0.827885",
"0.81125116",
"0.7995724",
"0.7925729",
"0.7887645",
"0.78556985",
"0.78556985",
"0.7763608",
"0.76362807",
"0.7610759",
"0.7542108",
"0.735307",
"0.7303788",
"0.7278605",
"0.7205126",
"0.7170194",
"0.7108265",
"0.7056702",
... | 0.8783727 | 0 |
Gets the van Der Waals radius of this atom. Returns | def get_van_Der_Waals_radius(self):
return self.van_Der_Waals_radius | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_radius(self):\n return self.r",
"def get_radius(self):\n return self.R",
"def get_radius(self):\n return self.__radius",
"def radius(self) -> float:\n return get_radius_from_element(self.element)",
"def get_radius(self):\n return self.radius",
"def get_radius(se... | [
"0.79551435",
"0.78757066",
"0.78437364",
"0.7793091",
"0.7788298",
"0.7788298",
"0.7774703",
"0.7747598",
"0.77394575",
"0.77394575",
"0.77394575",
"0.77394575",
"0.77394575",
"0.7731752",
"0.7719796",
"0.7713599",
"0.7675112",
"0.7668061",
"0.7660242",
"0.7640078",
"0.75554... | 0.86208606 | 0 |
Gets the euler tensor of this atom. Returns | def get_euler(self):
return array([ coord * self.coords for coord in self.coords ]) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def imu_get_euler(self):\n return self.imu.get_euler()",
"def euler_integrator(self, t, y, tau):\n\n return self.plant.rhs(t, y, tau)",
"def getTensor(self):\n\t\treturn self.cur_tensor",
"def get_deltaE(self):\n return self.deltaE",
"def e(self):\n return np.matrix([self.y - se... | [
"0.65126354",
"0.6043174",
"0.59547913",
"0.590338",
"0.5897418",
"0.58401287",
"0.58401287",
"0.5825734",
"0.5797117",
"0.5762484",
"0.572737",
"0.5713381",
"0.5662122",
"0.5651244",
"0.5643783",
"0.56348675",
"0.56310534",
"0.56149095",
"0.56149095",
"0.56149095",
"0.559066... | 0.64894354 | 1 |
Gets the symbol of this atom. Returns | def get_symbol(self):
return self.symbol | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def symbol(self):\n return self._symbol",
"def symbol(self): \n return self.__symbol",
"def symbol_id(self) -> str:\n return self._symbol",
"def getSymbol(self):\n return _libsbml.InitialAssignment_getSymbol(self)",
"def getElementSymbol(self):\n dataDict = self.__dict__\n ... | [
"0.85209036",
"0.8121533",
"0.76356006",
"0.75384325",
"0.73964155",
"0.7318919",
"0.73038465",
"0.7173422",
"0.7173422",
"0.70371056",
"0.69875854",
"0.6953391",
"0.6953391",
"0.6947048",
"0.6933806",
"0.6931096",
"0.68797255",
"0.68131906",
"0.6801363",
"0.6762182",
"0.6737... | 0.85047024 | 1 |
Gets the chain sequence number of the amminoacid this atom belongs to. Returns | def get_ammino_chain_seq(self):
return self.ammino_chain_seq | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sequence_number(self):\n return self._sequence_number",
"def sequence_number(self):\n # type: () -> int\n return self._sequence_number",
"def attempt_sequence_number(self):\n return self._attempt_sequence_number",
"def chain_serial(self):\n return self.structure.chain_s... | [
"0.7083817",
"0.6912228",
"0.63440174",
"0.6332537",
"0.62717706",
"0.62422633",
"0.6234725",
"0.6123495",
"0.61229354",
"0.6113672",
"0.6113672",
"0.60696846",
"0.6031649",
"0.6021344",
"0.6019921",
"0.5965752",
"0.59603554",
"0.59326804",
"0.59226",
"0.5900438",
"0.58660275... | 0.80430615 | 0 |
Gets the euclid distance from this atom to the given atom. Returns | def get_euclid_distance_to(self, atom):
return linalg.norm(self.get_coords() - atom.get_coords()) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_distance(self) -> int:\n return self.get_measurement_data().distance",
"def distance(cls, atom_1, atom_2):\n\t\t\n\t\treturn np.linalg.norm((atom_1-atom_2).atom_loc)",
"def __get_distance(self, game_object):\n obj_x, obj_y = game_object.get_coordinates()\n self_x, self_y = self._co... | [
"0.66581625",
"0.6649904",
"0.6637657",
"0.6630217",
"0.6601542",
"0.6598605",
"0.6596507",
"0.63966656",
"0.636073",
"0.63055176",
"0.62724113",
"0.62593937",
"0.6219049",
"0.62136334",
"0.62126756",
"0.6210324",
"0.61876845",
"0.61710095",
"0.616928",
"0.61606264",
"0.61590... | 0.8762926 | 0 |
Create a PLaSM cuboid with a color an put it on this atom coords. | def plasm_cube(self, size=0.1, color=WHITE):
return COLOR(color)(T([1,2,3])(self.coords)(CUBOID([size, size, size]))) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_cube(color=COLOR_WHITE):\n a = Point3(-1.0, -1.0, -1.0)\n b = Point3(1.0, -1.0, -1.0)\n c = Point3(1.0, -1.0, 1.0)\n d = Point3(-1.0, -1.0, 1.0)\n e = Point3(-1.0, 1.0, -1.0)\n f = Point3(1.0, 1.0, -1.0)\n g = Point3(1.0, 1.0, 1.0)\n h = Point3(-1.0, 1.0, 1.0)\n\n obj = glGenL... | [
"0.6723132",
"0.6348297",
"0.60369486",
"0.5786166",
"0.57097834",
"0.5662898",
"0.56111765",
"0.5570667",
"0.5565409",
"0.5560575",
"0.55361265",
"0.5518773",
"0.5501009",
"0.5469816",
"0.54623425",
"0.54447734",
"0.54447734",
"0.5434046",
"0.54167914",
"0.53902054",
"0.5389... | 0.77502567 | 0 |
Checks that the GsmModem in PDU mode accepts outgoing SMS, when the text is within ASCII chars 22 126. | def testSendSmsPduMode(self):
# setup expectation to raise a timeout error with prompt
err = errors.GsmReadTimeoutError(">")
when(self.mockDevice).read_lines().thenRaise(err).thenReturn(self.oklines)
self.gsm.send_sms("1234", "Test Message")
# must see command wi... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_sms_valid(text=''):\n try:\n text.decode('ascii')\n except:\n return False\n if len(text) > 160:\n return False\n\n return True",
"def testSendSmsPduModeError(self):\n\n # setup expectation to raise a non-timeout error with prompt\n when(self.mockDevice).read... | [
"0.7446568",
"0.6175791",
"0.59026414",
"0.5805947",
"0.56742376",
"0.5664919",
"0.55345494",
"0.5473586",
"0.5392989",
"0.5327824",
"0.53224766",
"0.53210604",
"0.5278678",
"0.52711344",
"0.5263743",
"0.52219886",
"0.52177036",
"0.51783454",
"0.5167334",
"0.51671714",
"0.516... | 0.6486989 | 1 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.