query stringlengths 9 9.05k | document stringlengths 10 222k | metadata dict | negatives listlengths 30 30 | negative_scores listlengths 30 30 | document_score stringlengths 4 10 | document_rank stringclasses 2
values |
|---|---|---|---|---|---|---|
Test get_bytes_summary_stats_counter(counter_name, runtime_profile) using a dummy runtime profile. | def test_get_bytes_summary_stats_counter():
runtime_profile = "- ExampleCounter: (Avg: 8.00 KB (8192) ; " \
"Min: 6.00 KB (6144) ; " \
"Max: 10.00 KB (10240) ; " \
"Number of samples: 4)"
summary_stats = get_bytes_summary_stats_counter("ExampleCounter",
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_bytes_summary_stats_counter(counter_name, runtime_profile):\n # This requires the Thrift definitions to be generated. We limit the scope of the import\n # to allow tools like the stress test to import this file without building Impala.\n from RuntimeProfile.ttypes import TSummaryStatsCounter\n\n regex_... | [
"0.8210795",
"0.7165258",
"0.6535483",
"0.58183134",
"0.5499708",
"0.54306024",
"0.5401804",
"0.5331239",
"0.53087115",
"0.5295623",
"0.522241",
"0.51653975",
"0.51389116",
"0.5127573",
"0.5090126",
"0.5080734",
"0.5066493",
"0.5042705",
"0.5039879",
"0.5032916",
"0.50271416"... | 0.792103 | 1 |
Test get_time_summary_stats_counter(counter_name, runtime_profile) using a dummy runtime profile. | def test_get_time_summary_stats_counter():
# This is constructed to test the parsing logic for timestamps, so the number don't
# add up.
runtime_profile = "- ExampleTimeStats: (Avg: 161.554ms ; " \
"Min: 101.411us ; " \
"Max: 1h2m3s4ms5us6ns ; " \
"Numbe... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_time_summary_stats_counter(counter_name, runtime_profile):\n # This requires the Thrift definitions to be generated. We limit the scope of the import\n # to allow tools like the stress test to import this file without building Impala.\n from RuntimeProfile.ttypes import TSummaryStatsCounter\n\n regex_s... | [
"0.8242061",
"0.726181",
"0.616038",
"0.59513456",
"0.58171767",
"0.5732866",
"0.57272905",
"0.5642184",
"0.55206454",
"0.5502528",
"0.5498713",
"0.5472903",
"0.53951144",
"0.5391175",
"0.5383824",
"0.53807724",
"0.53292173",
"0.52904975",
"0.52830833",
"0.52780706",
"0.52678... | 0.7753364 | 1 |
Given an array of colors of shape (n, 3) where 3 represents r, g, and b, send the colors to the renderer. This will change the colors of the current set of particles without affecting the values of the particles themself. The first dimension of `colors` must be equivalent to the number of particles in the most recent c... | def send_colors(colors: np.ndarray):
send("colors", json.dumps(np.ravel(colors).tolist())) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def setColors(self, colors, indexes=None):\n colors = np.array(colors, np.float32)\n if indexes is None:\n # Change colors to the whole string\n self.allVertices['rgba'][:] = glm.vec4(colors)\n for item in self.colors:\n item[-1] = colors\n else... | [
"0.610089",
"0.57313025",
"0.56554407",
"0.5505061",
"0.55012584",
"0.54297364",
"0.5370449",
"0.5275823",
"0.52673477",
"0.52605087",
"0.5245665",
"0.5238362",
"0.51785785",
"0.51753986",
"0.5131425",
"0.5126487",
"0.5110525",
"0.5056246",
"0.50373906",
"0.5032436",
"0.50264... | 0.71688694 | 0 |
For every group of three vertices, drawing lines from 1>2, 2>3, and 3>1 will create one of the faces of the convex hull. `simplices` as returned by `scipy.spatial.ConvexHull()` is an array of shape (n, 3, 3) where each index along axis=0 is an array of three vertices. Returns an array of vertices such that drawing a li... | def simplices_to_lines(simplices: np.ndarray):
i = 0
formatted = np.zeros((simplices.shape[0] * 3 * 2, 3))
for vertex_group in simplices:
v1 = vertex_group[0]
v2 = vertex_group[1]
v3 = vertex_group[2]
formatted[i:i + 6] = np.array([v1, v2, v2, v3, v3, v1])
i += 6
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def visualHull(sils, length):\n result = sils.pop(0).cone(length)\n assert result.pnFacesInPoly()\n i = 0\n for s in sils:\n # print(i)\n assert result.pnFacesInPoly()\n result = result.intersection(s.cone(length), True)\n # result.plot()\n ... | [
"0.6314537",
"0.62605107",
"0.61123174",
"0.6005943",
"0.59853345",
"0.5833673",
"0.5814224",
"0.5784276",
"0.5743306",
"0.5710836",
"0.56731635",
"0.56683725",
"0.56662077",
"0.5575294",
"0.54957443",
"0.54861224",
"0.53951085",
"0.5321236",
"0.53148437",
"0.5306452",
"0.528... | 0.6363231 | 0 |
Given an image, encodes it in base64 and sends it to the javascript server. | def send_image(image: PIL.Image.Image):
import base64
import io
image = image.convert("RGB")
buffer = io.BytesIO()
image.save(buffer, format="PNG")
image_b64 = base64.b64encode(buffer.getvalue())
send("image", image_b64.decode("utf-8")) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def send_image(self, device_id, image):\n self.logger.debug(f\"{device_id}: sending processed image!\")\n base64_img = base64.b64encode(\n cv2.imencode('.jpg', image)[1].tostring())\n self.socketio.emit(\n \"image\", {\"message\": base64_img}, room=f\"device-{device_id}\"... | [
"0.7039974",
"0.7001359",
"0.68803823",
"0.6802832",
"0.64818853",
"0.6423561",
"0.63997513",
"0.6301423",
"0.6282975",
"0.6233398",
"0.6224072",
"0.62133366",
"0.61871964",
"0.617421",
"0.6148899",
"0.61434144",
"0.6043165",
"0.603634",
"0.6003331",
"0.6000978",
"0.59890455"... | 0.7681678 | 0 |
Extracts uWSGI package and returns path containing uwsgiconfig.py along with path to extraction root. | def extract_release(self, download_path):
uwsgi_path = None
extract_path = tempfile.mkdtemp("-uwsgi")
setuptools.archive_util.unpack_archive(download_path, extract_path)
for root, dirs, files in os.walk(extract_path):
if 'uwsgiconfig.py' in files:
uwsgi_path =... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def extract_release(self, download_path):\n uwsgi_path = None\n extract_path = tempfile.mkdtemp(\"-uwsgi\")\n setuptools.archive_util.unpack_archive(download_path, extract_path)\n for root, dirs, files in os.walk(extract_path):\n if \"uwsgiconfig.py\" in files:\n ... | [
"0.63566244",
"0.60467535",
"0.57472795",
"0.5672868",
"0.563439",
"0.563439",
"0.5549617",
"0.55307364",
"0.55284595",
"0.5510305",
"0.5504764",
"0.5459217",
"0.5455165",
"0.53408915",
"0.53151673",
"0.52872944",
"0.52597153",
"0.52590865",
"0.52571964",
"0.52554125",
"0.524... | 0.6347976 | 1 |
Build uWSGI and returns path to executable. | def build_release(self, uwsgi_path):
# Change dir to uwsgi_path for compile.
sys_path_changed = False
current_path = os.getcwd()
os.chdir(uwsgi_path)
try:
# Add uwsgi_path to the Python path so we can import uwsgiconfig.
if uwsgi_path not in sys.path:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def build_uwsgi(self, uwsgi_path):\n current_path = os.getcwd()\n profile = self.options.get(\"profile\", MARKER)\n\n if profile is MARKER:\n profile = '%s/buildconf/default.ini' % uwsgi_path\n elif not os.path.isabs(profile):\n # if the specified profile is not an... | [
"0.6920249",
"0.58413464",
"0.56270105",
"0.5603855",
"0.5594912",
"0.5591834",
"0.54541445",
"0.5447737",
"0.54240096",
"0.5361558",
"0.53369856",
"0.5328214",
"0.5285142",
"0.5283001",
"0.52697796",
"0.52461123",
"0.5240942",
"0.52372944",
"0.5229295",
"0.522919",
"0.521965... | 0.6835176 | 1 |
Returns extra paths to include for uWSGI. | def get_extra_paths(self):
# Add libraries found by a site .pth files to our extra-paths.
if 'pth-files' in self.options:
import site
for pth_file in self.options['pth-files'].splitlines():
pth_libs = site.addsitedir(pth_file, set())
if not pth_lib... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def include_dirs(self):",
"def IncludePaths(self):\n return self._g_incpaths",
"def _include_paths_from_environ(env_prefix=''):\n paths = os.environ.get(env_prefix + 'WSGI_AUTH_PATHS')\n if not paths:\n return []\n return paths.split(';')",
"def source_paths(self):\n paths = sel... | [
"0.66344357",
"0.6444185",
"0.6246656",
"0.5919322",
"0.589785",
"0.5879655",
"0.5811333",
"0.57942563",
"0.57616407",
"0.5642619",
"0.5615034",
"0.5599227",
"0.556556",
"0.5559439",
"0.5520674",
"0.5480102",
"0.54637283",
"0.54265034",
"0.54225355",
"0.54163235",
"0.54110277... | 0.7353712 | 0 |
Create xml file file with which to run uwsgi. | def create_conf_xml(self):
path = os.path.join(
self.buildout['buildout']['parts-directory'],
self.name)
if not os.path.isdir(path):
os.makedirs(path)
xml_path = os.path.join(path, 'uwsgi.xml')
conf = ""
for key, value in self.conf.items():
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __createXMLFileForClear():\r\n #description\r\n #Root\r\n clear_root = Element('clear-users-request', {'xmlns':SYMPLECTIC_XMLNS_URI,} )\r\n #Feed\r\n SubElement(clear_root, 'feed-id').text = IMPORT_USERS_FEED_ID\r\n #Convert to ElementTree and write xml version to file\r\n ... | [
"0.6644457",
"0.60856533",
"0.59056526",
"0.5878485",
"0.58541995",
"0.58440775",
"0.5770186",
"0.5738656",
"0.5671198",
"0.5638148",
"0.5616048",
"0.5591157",
"0.5570918",
"0.5567828",
"0.5532723",
"0.5509958",
"0.5500074",
"0.54983217",
"0.54495966",
"0.5434519",
"0.5431843... | 0.7006142 | 0 |
Gaborfiltering based on the median frequency estimation | def medgabor(image: np.array,
orient: np.array,
freq: np.array):
medfreq = np.round(np.median(freq[freq > 0]), 2)
sigma_x = 0.66 / medfreq
sigma_y = 0.66 / medfreq
# Original gabor filter
krnsize = int(np.round(3 * np.max([sigma_x, sigma_y])))
x, y = np.meshgrid(np.lin... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def median_filter(self):\n print \"Median-Filtering...\"\n D = self.D\n x = np.median(np.median(D,axis=1),axis=1)\n for i in xrange(len(x)):\n D[i,:,:] -= x[i]\n self.D = D\n print \"done.\"",
"def gaborFilter(img, ksize=31):\n filters = []\n #k... | [
"0.65968525",
"0.64148796",
"0.6306438",
"0.6250276",
"0.6250276",
"0.62407976",
"0.6211783",
"0.60880464",
"0.6051733",
"0.6051062",
"0.6049755",
"0.60235506",
"0.5989243",
"0.595111",
"0.5942477",
"0.5927537",
"0.59205",
"0.58814645",
"0.58223844",
"0.5818214",
"0.5799856",... | 0.6818058 | 0 |
image_filenames is a list of filename strings Returns a list of dicts formatted as the Vision API needs them to be | def make_image_data_list(image_filenames):
img_requests = []
for imgname in image_filenames:
try:
with open(imgname, 'rb') as f:
ctxt = b64encode(f.read()).decode()
img_requests.append({
'image': {'content': ctxt},
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def make_image_data(image_filenames):\n imgdict = make_image_data_list(image_filenames)\n return json.dumps({\"requests\": imgdict }).encode()",
"def map_csv_images(images: str):\n api_images = []\n images = [x.strip() for x in images.split(\",\")]\n for image in images:\n a... | [
"0.6875057",
"0.68533707",
"0.6716278",
"0.66939324",
"0.6607569",
"0.6566271",
"0.65106505",
"0.6485073",
"0.64711297",
"0.6465211",
"0.6442127",
"0.6441929",
"0.6405606",
"0.6278295",
"0.62763566",
"0.6272817",
"0.6269265",
"0.6245611",
"0.6233325",
"0.6205201",
"0.62023395... | 0.7307656 | 0 |
Initialize this OWSProviderCheck object with a service URL and layer. | def __init__(self, *args, **kwargs):
super(OWS, self).__init__(*args, **kwargs)
self.query = {"VERSION": "1.0.0", "REQUEST": "GetCapabilities"}
# Amended with "SERVICE" parameter by subclasses
# If service or version parameters are left in query string, it can lead to a protocol ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self, iceContext, remoteServiceUrl=None):\n self.iceContext = iceContext\n asServiceOnly = iceContext.settings.get(\"asServiceOnly\", False)\n if asServiceOnly:\n self.__remoteServiceUrl = None\n else:\n if remoteServiceUrl is None:\n se... | [
"0.60432094",
"0.5906125",
"0.5876101",
"0.5872568",
"0.5855452",
"0.58410835",
"0.5781787",
"0.5662102",
"0.56508017",
"0.5622121",
"0.5601001",
"0.5556241",
"0.5540181",
"0.54926586",
"0.54883575",
"0.54346657",
"0.54139084",
"0.53796893",
"0.5377106",
"0.53768516",
"0.5375... | 0.67304105 | 0 |
Postprune your DecisionTreeClassifier given some optional validation dataset. You can ignore x_val and y_val if you do not need a validation dataset for pruning. | def prune(self, x_val, y_val):
# make sure that the classifier has been trained before predicting
if not self.is_trained:
raise Exception("DecisionTreeClassifier has not yet been trained.")
# get the maximum depth
deepest_depth = get_max_depth(self.root)
# explore ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def prune(self, x_val, y_val):\n\n # make sure that the classifier has been trained before predicting\n if not self.is_trained:\n raise Exception(\"DecisionTreeClassifier has not yet been trained.\")\n\n #######################################################################\n ... | [
"0.67056316",
"0.6210951",
"0.59372723",
"0.57215625",
"0.5689699",
"0.5675974",
"0.5657346",
"0.5648987",
"0.5473335",
"0.5438295",
"0.53066444",
"0.52962863",
"0.5293181",
"0.5282219",
"0.5204792",
"0.5195472",
"0.51819074",
"0.5140097",
"0.51028013",
"0.5101232",
"0.508846... | 0.67783576 | 0 |
Return a tuple list of keypoint edges from the eval config. | def get_keypoint_tuples(eval_config):
tuple_list = []
kp_list = eval_config.keypoint_edge
for edge in kp_list:
tuple_list.append((edge.start, edge.end))
return tuple_list | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getEdges(self):\n\n return [(cell, vertice) for cell in self.adjacent.keys() for vertice in self.adjacent[cell]]",
"def edges(self):\n return [(k, val) for k, v in self.dict.iteritems() for val in v]",
"def edges(self):\n edges = []\n for key in self:\n if key:\n ... | [
"0.68928194",
"0.68384445",
"0.670049",
"0.66673106",
"0.6631602",
"0.65935606",
"0.6424271",
"0.63696843",
"0.63400286",
"0.6286395",
"0.6285106",
"0.6280743",
"0.6272359",
"0.6186926",
"0.61651224",
"0.6160234",
"0.6142707",
"0.60533106",
"0.60457075",
"0.6014674",
"0.60060... | 0.81175333 | 0 |
The standard set function for momentum. | def setMomentum(self,p):
if p is None:
self.p = Cartesian3DVector()
else:
if isinstance(p,Cartesian3DVector):
self.p = Cartesian3DVector(p.x,p.y,p.z)
else:
raise CoordinateVector("Initializing a particle with the incorrect momentum vector type.") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def momentum(self, k):\n self._momentum = k\n self._energy = self.dispersion(k)",
"def moments(self):",
"def set_std(self, value, method = 'absolute'):\n for time in self.mdvtc.keys():\n self.mdvtc[time].set_std(value, method)",
"def getMomentum(self):\n return self.p",
"... | [
"0.55939347",
"0.5576529",
"0.5526756",
"0.5514395",
"0.5514103",
"0.54710954",
"0.5466587",
"0.54103637",
"0.5364479",
"0.5360941",
"0.5343097",
"0.5310412",
"0.53063697",
"0.52856123",
"0.5280814",
"0.5280181",
"0.52618605",
"0.5259174",
"0.5257436",
"0.5255526",
"0.5224978... | 0.5689188 | 0 |
The standard get function for momentum. | def getMomentum(self):
return self.p | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get(self) -> float:\n ...",
"def get_velocity(self):\n return self.momentum/self.mass",
"def linear_momentum(self):\r\n return self.mass * self.vel",
"def get_optimizer_momentum(optimizer: Optimizer) -> float:\n beta = safitty.get(optimizer.param_groups, 0, \"betas\", 0)\n mome... | [
"0.67023766",
"0.6214488",
"0.60852337",
"0.5973675",
"0.59189093",
"0.58704513",
"0.5835993",
"0.5827452",
"0.5790282",
"0.57737213",
"0.5724078",
"0.5724078",
"0.5683753",
"0.5682278",
"0.56714666",
"0.5644209",
"0.5619001",
"0.5574041",
"0.5555399",
"0.55517596",
"0.554914... | 0.678706 | 0 |
The standard set function for mass. | def setMass(self,mass):
self.mass = mass | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def mass(self):\n\t\traise NotImplementedError",
"def def_mass(self,mass):\n\n self.mass=float(mass)",
"def set():",
"def set():\n pass",
"def mass(self, mass):\n\n self._mass = mass",
"def mass(self, mass):\n\n self._mass = mass",
"def mass(self, mass):\n\n self._mass = ... | [
"0.6752526",
"0.66426647",
"0.637969",
"0.6281438",
"0.6252349",
"0.6252349",
"0.6252349",
"0.6180745",
"0.61672056",
"0.6156935",
"0.60868347",
"0.60702246",
"0.5941645",
"0.5779273",
"0.57603186",
"0.5687896",
"0.5666062",
"0.56605357",
"0.5622275",
"0.5598658",
"0.557934",... | 0.7166565 | 0 |
The standard get function for mass. | def getMass(self):
return self.mass | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_mass(elem):\n return mass[get_num(elem)]",
"def mass(self):\n return self._getAttribute(Attribute.mass)",
"def get_mass(self):\n return self.m",
"def mass(self):\n\t\traise NotImplementedError",
"def _get(self, path=None, version=None, params=None,\n header=None):\n ... | [
"0.70268255",
"0.6741046",
"0.66936696",
"0.6609461",
"0.61711407",
"0.6132442",
"0.61233735",
"0.60892516",
"0.60583603",
"0.60569847",
"0.60569847",
"0.59789926",
"0.59789926",
"0.59664315",
"0.59531945",
"0.587695",
"0.582972",
"0.5804247",
"0.57772",
"0.57528174",
"0.5725... | 0.73606294 | 0 |
The standard get fucntion for velocity. | def getVelocity(self):
return self.v | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def base_velocity(self):\n raise NotImplementedError('Not yet implemented!')",
"def get_velocity(self):\n return self.momentum/self.mass",
"def get(cls, approach):\n return approach.velocity",
"def velocity(self):\n return self.base_platform.velocity",
"def velocity(self):\n ... | [
"0.7367533",
"0.7357696",
"0.7330207",
"0.7308122",
"0.7238268",
"0.7238268",
"0.720293",
"0.7094455",
"0.70453817",
"0.70100814",
"0.69057566",
"0.6877143",
"0.68519807",
"0.6769721",
"0.67433196",
"0.671901",
"0.6632047",
"0.66285706",
"0.6576065",
"0.6572819",
"0.65203345"... | 0.8406881 | 0 |
Calculates the cartesian 3d vector of velocity from the momentum and mass of the particle. | def calcVelocityFromMomentum(self):
if self.mass is None:
raise CoordinateVector("The particle mass needs to be specified to calculate the particle velocity from momentum.")
values = {}
for direction in self.p.order:
gamma = self.calcLorentzGammaFromMomentum(direction)
values[direction] = ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def calcMomentumFromVelocity(self):\n if self.mass is None:\n raise CoordinateVector(\"The particle mass needs to be specified to calculate the particle momentum from velocity.\")\n values = {}\n for direction in self.v.order:\n gamma = self.calcLorentzGammaFromVelocity(direction)\n values[... | [
"0.765322",
"0.6983609",
"0.6934949",
"0.6848278",
"0.68200105",
"0.6760848",
"0.6575514",
"0.65244144",
"0.6488385",
"0.6468821",
"0.64489025",
"0.64413357",
"0.6396954",
"0.63301325",
"0.6261955",
"0.62590843",
"0.6190308",
"0.6189779",
"0.6171905",
"0.6155788",
"0.6147371"... | 0.8236748 | 0 |
Calculates the cartesian 3d vector of momentum from the velocity and mass of the particle. | def calcMomentumFromVelocity(self):
if self.mass is None:
raise CoordinateVector("The particle mass needs to be specified to calculate the particle momentum from velocity.")
values = {}
for direction in self.v.order:
gamma = self.calcLorentzGammaFromVelocity(direction)
values[direction] = ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def calcVelocityFromMomentum(self):\n if self.mass is None:\n raise CoordinateVector(\"The particle mass needs to be specified to calculate the particle velocity from momentum.\")\n values = {}\n for direction in self.p.order:\n gamma = self.calcLorentzGammaFromMomentum(direction)\n values[... | [
"0.81692654",
"0.690118",
"0.66876614",
"0.6658744",
"0.664881",
"0.66007084",
"0.6550348",
"0.65389264",
"0.65243137",
"0.64355654",
"0.6390826",
"0.63448685",
"0.62424463",
"0.62188",
"0.6202695",
"0.62012756",
"0.61850667",
"0.61785144",
"0.6112835",
"0.60590756",
"0.60277... | 0.80046946 | 1 |
Calculates the lorenzt gamma in the provided direction from the momentum and mass of the particle. | def calcLorentzGammaFromMomentum(self,direction):
if self.mass is None:
raise CoordinateVector("The particle mass needs to be specified to calculate the lorentz gamma.")
if direction not in self.x.order:
raise CoordinateVector("The direction, "+str(direction)+ " needs to be one of " +",".join(sel... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def calcLorentzGammaFromVelocity(self,direction):\n if direction not in self.v.order: \n raise CoordinateVector(\"The direction, \"+str(direction)+ \" needs to be one of \" +\",\".join(self.x.order) + \" to calculated the lorentz gamma.\")\n speed_light = constants.physical_constants[\"speed of light ... | [
"0.78349334",
"0.65505034",
"0.64004475",
"0.6338415",
"0.6330693",
"0.6308937",
"0.62548393",
"0.60297495",
"0.6004534",
"0.6000826",
"0.59738916",
"0.5958439",
"0.5873418",
"0.58617294",
"0.5858218",
"0.58503973",
"0.58492607",
"0.58480644",
"0.58401406",
"0.5808082",
"0.58... | 0.85065 | 0 |
Calculates the lorenzt gamma in the provided direction from the velocity of the particle expressed as a fraction of c. | def calcLorentzGammaFromVelocity(self,direction):
if direction not in self.v.order:
raise CoordinateVector("The direction, "+str(direction)+ " needs to be one of " +",".join(self.x.order) + " to calculated the lorentz gamma.")
speed_light = constants.physical_constants["speed of light in vacuum"][0]#m/... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def calcLorentzGammaFromMomentum(self,direction):\n if self.mass is None:\n raise CoordinateVector(\"The particle mass needs to be specified to calculate the lorentz gamma.\")\n if direction not in self.x.order: \n raise CoordinateVector(\"The direction, \"+str(direction)+ \" needs to be one of \... | [
"0.72941875",
"0.70601326",
"0.66693014",
"0.6547269",
"0.6443332",
"0.6340518",
"0.6231375",
"0.61353683",
"0.61138654",
"0.6101015",
"0.6100813",
"0.6075295",
"0.60656536",
"0.6024523",
"0.6016668",
"0.6012257",
"0.59726006",
"0.59690887",
"0.5963975",
"0.59596616",
"0.5935... | 0.76509017 | 0 |
Assuming no forces, advances the particle's position over the provided time. | def advancePosition(self,time):
velocity = self.getVelocity()
return self.x + time*velocity | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def particle_pos(particle, time):\n return particle.pos + particle.dir * particle.speed * (time - particle.time)",
"def advanceVelocity(self,time,acceleration):\n if not isinstance(acceleration,Cartesian3DVector):\n raise CoordinateException(\"Advancing particle momentum with the incorrect acceleratio... | [
"0.6824029",
"0.66825676",
"0.6370089",
"0.62140477",
"0.61371607",
"0.60471654",
"0.6026196",
"0.60050094",
"0.599552",
"0.58931583",
"0.5852677",
"0.58391166",
"0.58361125",
"0.5828045",
"0.58216155",
"0.575479",
"0.5752554",
"0.5706767",
"0.56617236",
"0.565851",
"0.565650... | 0.75548244 | 0 |
Advances the particle's momentum over the provided time. | def advanceVelocity(self,time,acceleration):
if not isinstance(acceleration,Cartesian3DVector):
raise CoordinateException("Advancing particle momentum with the incorrect acceleration type.")
return self.v + time*acceleration | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def advancePosition(self,time):\n velocity = self.getVelocity()\n return self.x + time*velocity",
"def update(self, delta_time):\n self.total_time += delta_time",
"def advance(self, dt):\n self.workTill(self.currentTime + dt)",
"def advance(self, delta_t: float) -> None:\n pass",
... | [
"0.6614696",
"0.6302206",
"0.6300793",
"0.61861223",
"0.61745685",
"0.59607273",
"0.5883146",
"0.5883146",
"0.5878725",
"0.58402485",
"0.5823741",
"0.5773462",
"0.573509",
"0.572411",
"0.57118416",
"0.5706244",
"0.5687493",
"0.56628245",
"0.56571454",
"0.56478083",
"0.559684"... | 0.70574886 | 0 |
Returns a new particle with the translated position. | def translate(self,translation_vector):
if not isinstance(translation_vector,Cartesian3DVector):
raise CoordinateException("Translating a particle with the incorrect translation vector type.")
new_particle = self.__class__(self.mass,self.x-translation_vector,self.p)
return new_particle | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def translate(self,translation_vector):\n if isinstance(translation_vector,Cartesian3DVector):\n new_particle = self.__class__(self.mass,self.time,x=self.x-translation_vector,p=self.p)\n return new_particle\n raise CoordinateException(\"Translating a particle with the incorrect translation vector t... | [
"0.74334514",
"0.65910095",
"0.64567685",
"0.64567685",
"0.6368302",
"0.63611865",
"0.6228415",
"0.6189238",
"0.6178392",
"0.6114549",
"0.6094537",
"0.59718263",
"0.59179497",
"0.58974504",
"0.58869624",
"0.5816557",
"0.5807383",
"0.58024585",
"0.5740008",
"0.57181776",
"0.57... | 0.74873996 | 0 |
Wraps the calc energy method skipping it if the energy is already stored. | def getEnergy(self):
if not hasattr(self,"energy"):
self.energy = self.calcEnergy()
return self.energy | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _calc_energy( self, V_a, eos_d ):\n pass",
"def make_energy(self):\n def energy_func(m):\n heff = self.field(m)\n return -energy.zeeman(m, self.Ms, heff) \\\n + energy.shape_anisotropy(m, self.Ms,\n self.Nd[0], self... | [
"0.6837439",
"0.6511759",
"0.64954716",
"0.642637",
"0.62684757",
"0.62626266",
"0.6229375",
"0.6222994",
"0.6088667",
"0.6084967",
"0.60212713",
"0.5996792",
"0.5988315",
"0.59431386",
"0.5921085",
"0.59094554",
"0.5892457",
"0.5804362",
"0.5803541",
"0.5778459",
"0.5737978"... | 0.67761016 | 1 |
Adds the time to the object and then passes control back to ParticlePhaseCoordinates() | def __init__(self,mass,time,**kwargs):
self.setTime(time)
ParticlePhaseCoordinates.__init__(self,mass,**kwargs) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add(self, time):\n\n self.elapsed_time = self.elapsed_time + time",
"def time_interval_prop(self, time_step, nsteps):\n world.time = TimeAxis(0.0, int(nsteps), float(time_step))\n print(\"Setting time\")",
"def add_time_point(self,time, mdv_instance):\n\n self.mdvtc[time] = mdv_instance... | [
"0.68493664",
"0.62049025",
"0.6199217",
"0.61531377",
"0.61497086",
"0.61381763",
"0.6101899",
"0.60587454",
"0.60339004",
"0.59949434",
"0.59949434",
"0.5944291",
"0.59424937",
"0.59186304",
"0.5915626",
"0.59136856",
"0.58965176",
"0.589287",
"0.58900005",
"0.5870477",
"0.... | 0.6762631 | 1 |
The standard set function for time. | def setTime(self,time):
self.time = time | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_time(self, set_time):\n\n self._set_time = set_time",
"def set_time(self, value: float):\n raise NotImplementedError()",
"def set_time(self, time):\n self._time = time",
"def setTimepoint(self, tp):\n\t\tpass",
"def time_settime(currenttime):\r\n\r\n time_query_times.append((g... | [
"0.72771186",
"0.7239394",
"0.7080917",
"0.6863868",
"0.6795337",
"0.6750914",
"0.67407006",
"0.67407006",
"0.67407006",
"0.67407006",
"0.67407006",
"0.6686255",
"0.66793233",
"0.6611528",
"0.6575852",
"0.6569751",
"0.65114367",
"0.65096605",
"0.6491704",
"0.6458417",
"0.6457... | 0.73721087 | 0 |
Returns a new particle with the translated position. | def translate(self,translation_vector):
if isinstance(translation_vector,Cartesian3DVector):
new_particle = self.__class__(self.mass,self.time,x=self.x-translation_vector,p=self.p)
return new_particle
raise CoordinateException("Translating a particle with the incorrect translation vector type.") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def translate(self,translation_vector):\n if not isinstance(translation_vector,Cartesian3DVector):\n raise CoordinateException(\"Translating a particle with the incorrect translation vector type.\")\n new_particle = self.__class__(self.mass,self.x-translation_vector,self.p)\n return new_particle",
... | [
"0.74873996",
"0.65910095",
"0.64567685",
"0.64567685",
"0.6368302",
"0.63611865",
"0.6228415",
"0.6189238",
"0.6178392",
"0.6114549",
"0.6094537",
"0.59718263",
"0.59179497",
"0.58974504",
"0.58869624",
"0.5816557",
"0.5807383",
"0.58024585",
"0.5740008",
"0.57181776",
"0.57... | 0.74334514 | 1 |
Adds the time to the string argument from ParticlePhaseCoordinates. | def __str__(self):
return str(self.time)+" " + " ".join(ParticlePhaseCoordinates.__str__(self)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def VMD_string(self, time):\n # First add preamble:\n # N_data\n # Point = time\n # ...\n VMD_output_string = '%i\\nPoint = %i\\n' % (len(self.particles), time)\n # Concatenate labels and positions for each particle\n for p in self.particles:\n VMD_output... | [
"0.6091441",
"0.59376884",
"0.59268194",
"0.57613075",
"0.5650466",
"0.56392205",
"0.56034416",
"0.54801005",
"0.5471908",
"0.54599833",
"0.54572415",
"0.5454964",
"0.543722",
"0.5434744",
"0.540227",
"0.53942305",
"0.5369681",
"0.5352423",
"0.53495055",
"0.53299737",
"0.5325... | 0.69776624 | 0 |
P0, P1, P2, and P3 should be (x,y) point pairs that define the CatmullRom spline. nPoints is the number of points to include in this curve segment. | def CatmullRomSpline(P0, P1, P2, P3, nPoints=100):
# Convert the points to numpy so that we can do array multiplication
P0, P1, P2, P3 = map(np.array, [P0, P1, P2, P3])
# Calculate t0 to t4
alpha = 0.5
def tj(ti, Pi, Pj):
xi, yi = Pi
xj, yj = Pj
return ( ( (xj-xi)**2 + (yj-yi)**2 )**0.5 )**alpha ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def CatmullRomSpline(P0, P1, P2, P3, nPoints=100):\n # Convert the points to numpy so that we can do array multiplication\n P0, P1, P2, P3 = map(np.array, [P0, P1, P2, P3])\n\n # Calculate t0 to t4\n alpha = 0.5\n def tj(ti, Pi, Pj):\n xi, yi = Pi\n xj, yj = Pj\n return ( ( (xj-... | [
"0.81175137",
"0.74436355",
"0.71239656",
"0.6522066",
"0.5923547",
"0.5901146",
"0.58884126",
"0.58801574",
"0.5867297",
"0.5845102",
"0.5778057",
"0.57606685",
"0.5735717",
"0.57247066",
"0.5710397",
"0.57066745",
"0.56942725",
"0.56850153",
"0.5620857",
"0.5610521",
"0.559... | 0.80982167 | 1 |
Calculate Catmull Rom for a chain of points and return the combined curve. | def CatmullRomChain(P, n_points=100):
sz = len(P)
# The curve C will contain an array of (x,y) points.
C = []
for i in range(sz-3):
c = CatmullRomSpline(P[i], P[i+1], P[i+2], P[i+3], nPoints=n_points)
C.extend(c)
return C | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def CatmullRomSpline(P0, P1, P2, P3, nPoints=100):\n # Convert the points to numpy so that we can do array multiplication\n P0, P1, P2, P3 = map(np.array, [P0, P1, P2, P3])\n\n # Calculate t0 to t4\n alpha = 0.5\n def tj(ti, Pi, Pj):\n xi, yi = Pi\n xj, yj = Pj\n return ( ( (xj-xi)**2 + (yj-yi)**2 )*... | [
"0.6513273",
"0.63959587",
"0.6131151",
"0.56448066",
"0.55787563",
"0.5530265",
"0.55292046",
"0.54591346",
"0.54470813",
"0.54388815",
"0.541026",
"0.54079455",
"0.5364625",
"0.535404",
"0.53194815",
"0.5302031",
"0.5286085",
"0.52829015",
"0.5245077",
"0.5238988",
"0.52218... | 0.7399011 | 0 |
Initialization method attempts to open the database and create the connection and cursor objects. Raises an exception if the database does not exist at the path. | def __init__(self, in_db_path, in_db_name):
if not os.path.isfile(in_db_path + in_db_name):
self._connection, self._cursor = None, None
raise Exception('PASSED IN DATABASE PATH IS NOT VALID.')
else:
self._connection = sqlite3.connect(in_db_path + in_db_name)
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self):\r\n assert isfile(DBClass.db_name), \"Database doesn't exists!\"\r\n\r\n self.conn = self.create_connection()\r\n self.cursor = self.conn.cursor()",
"def init() -> sqlite3.Connection:\n try:\n with open(DATABASE_INIT) as reader:\n sql = reader.read()\... | [
"0.76034373",
"0.7407035",
"0.73033893",
"0.7289192",
"0.7286212",
"0.7149162",
"0.71090376",
"0.7088081",
"0.7055408",
"0.7009664",
"0.70082414",
"0.70007664",
"0.6984768",
"0.6920187",
"0.68871737",
"0.6868604",
"0.68681866",
"0.6865411",
"0.6846874",
"0.6839954",
"0.683174... | 0.7721915 | 0 |
Method is used to perform a single row insert into the specified table in the current database. This should be used if only one insert needs to occur as it automatically calls the transactionEnd method and commits the changes; essentially, calling object/class/script does not need to worry about committing the changes. | def singleInsert(self, table_name, fields, field_values, field_types=[]):
if not self.checkTable(table_name):
self.createTable(table_name, fields, field_types)
self.transactionInsert(table_name, fields, field_values)
self.transactionEnd() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def insert(self):\n sql = u'INSERT INTO %s' % self.table()\n keys = []\n values = []\n format_values = []\n for field in self.fields():\n attr = object.__getattribute__(self, field)\n if attr.auto_value:\n continue\n keys.append(fie... | [
"0.7033396",
"0.6928413",
"0.6844764",
"0.6773771",
"0.6669018",
"0.6580847",
"0.65430504",
"0.650909",
"0.647355",
"0.6387648",
"0.62853456",
"0.62780404",
"0.6269313",
"0.62691164",
"0.6252828",
"0.6252828",
"0.6252828",
"0.6220003",
"0.6214437",
"0.6208996",
"0.6199239",
... | 0.698862 | 1 |
Method performs a transaction insert. The purpose of this method is to allow for a large number of inserts to the specified table in the current database efficiently. This is done by not performing a commit statement until the super object/class/script specifically calls the transactionEnd method, which then performs t... | def transactionInsert(self, t_name, fields, field_values):
query = 'INSERT INTO {0} ({1}) VALUES ({2});'
field_list_string = ','.join(fields)
query_parameters = ','.join(['?'] * len(fields))
query = query.format(t_name, field_list_string, query_parameters)
try:
self.... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def insert(self, table, *args, **kwargs):\n\n values = None\n query = \"INSERT INTO %s \" % table\n if kwargs:\n keys = kwargs.keys()\n values = kwargs.values()\n query += \"(\" + \",\".join([\"`%s`\"]*len(keys)) % tuple(keys) + \\\n \") VALUES(\... | [
"0.702414",
"0.6742387",
"0.64886606",
"0.64855015",
"0.6421877",
"0.6408801",
"0.63810885",
"0.6362966",
"0.6359179",
"0.6347449",
"0.6185013",
"0.6149881",
"0.61461437",
"0.6120219",
"0.6080194",
"0.6068329",
"0.60112244",
"0.60086304",
"0.6003881",
"0.5993102",
"0.5988019"... | 0.7167526 | 0 |
Method counts the number of rows in the specified table in the current database. | def countTable(self, in_table_name):
self.cursor.execute('SELECT COUNT(*) FROM {};'.format(in_table_name))
return self.cursor.fetchone()[0] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _num_rows(cursor, table):\n cursor.execute('SELECT COUNT(*) AS rowcount FROM %s' % table)\n return cursor.fetchone()['rowcount']",
"def count(self, table_name=None):\n return self._get_storage().count(table_name=table_name)",
"def count(self, table, field, condition, *parameters, **kwparameter... | [
"0.7681011",
"0.76755697",
"0.7520723",
"0.74752414",
"0.74719673",
"0.7453831",
"0.7410742",
"0.7376854",
"0.7376854",
"0.7365599",
"0.7249371",
"0.7217301",
"0.71082276",
"0.7081187",
"0.6871378",
"0.68421984",
"0.68369794",
"0.6808706",
"0.6781361",
"0.6754997",
"0.6751163... | 0.7786355 | 0 |
Method creates a table in the current database of the passed in table name with the passed in field names and field types. Method first zips together the field names and field types list, | def createTable(self, in_table_name, in_field_names, in_field_types):
zipped_fields = zip(in_field_names, in_field_types)
fields = ['{} {}'.format(fn, ft) for fn,ft in zipped_fields]
query = 'CREATE TABLE {} ({});'
self.cursor.execute(query.format(in_table_name, ','.join(fields)))
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_table(self, name: str, fields: Iterable[Field]) -> DbTable:",
"def create(db, table, name):\n columns = ['{0} {1}'.format(name, ctype) for name, ctype in table.items()]\n create = CREATE_TABLE.format(table=name, fields=\", \".join(columns))\n try:\n db.execute(create)\n except Excep... | [
"0.77771497",
"0.7658235",
"0.75221235",
"0.7504949",
"0.73976874",
"0.72974116",
"0.7003339",
"0.6809533",
"0.67992604",
"0.6794465",
"0.67785597",
"0.6776136",
"0.67619514",
"0.6752746",
"0.67458606",
"0.67157304",
"0.66549766",
"0.66260165",
"0.6620188",
"0.65952903",
"0.6... | 0.80561453 | 0 |
Given two object's attributes, if they are equivalent, return valueEquivalent object, else return None. | def index_equivalent_value(indexer, obj1, attr1, obj2, attr2):
eq_conds = indexer.index_by_type(ValueEquivalence)
for cond in eq_conds:
r = cond.relationship
obj_list = r.obj_list
attr_list = r.attr_list
if obj1 in obj_list and obj2 in obj_list \
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __eq__(self, other):\n return (other is not None and\n self.name == other.name and\n self.type is other.type and\n dict.__eq__(self.attrs, other.attrs))",
"def equivalent(self, other):\n return id(self) == id(other)",
"def __eq__(self, other):\n ... | [
"0.5685698",
"0.5675666",
"0.5655813",
"0.5637368",
"0.56083894",
"0.5590845",
"0.55894345",
"0.55642265",
"0.5532535",
"0.54979646",
"0.54707646",
"0.54639596",
"0.5456215",
"0.54445344",
"0.5434761",
"0.54320115",
"0.54219925",
"0.53839636",
"0.5355038",
"0.5354938",
"0.534... | 0.6405555 | 0 |
Compare 2 .INI format files and ensure that at minimum customfile contains ALL sections and options from defaultfile. If PATCH is True and EXACT is False update customfile without changing any custom option values. If EXACT is True and PATCH is True erase all custom values and duplicate default entirely. IF PATCH is Fa... | def patch_ini_file(defaultfile, customfile, PATCH=True, EXACT=False):
default_options = SafeConfigParser()
result = default_options.read(defaultfile) # returns an empty list if file error
if result == []:
raise IOError
personalized_options = SafeConfigParser()
result = personalized_options.... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_get_spec_config_match(self):\n spec_conf = get_spec_config({\n 'defaults': {\n 'default_foo': 'default_bar',\n 'foo': 'bar'\n },\n 'specific': [\n {'mask': ['filenomatch'], 'foo': 'bar_nomatch'},\n {'mask':... | [
"0.5811735",
"0.5469652",
"0.5331729",
"0.5251292",
"0.5203437",
"0.5147105",
"0.5104648",
"0.50876206",
"0.506625",
"0.5052995",
"0.5003559",
"0.49859038",
"0.49663466",
"0.4935941",
"0.49124125",
"0.48918507",
"0.4861177",
"0.48433837",
"0.4817611",
"0.48163977",
"0.4811440... | 0.78581697 | 0 |
use patch_ini_file function to test a file for correctness as an INI file | def ini_file_can_be_parsed(filename):
from ConfigParser import ParsingError as ParseError
from ConfigParser import InterpolationSyntaxError as InterpError
import sys
result = False
print
print 'testing: ' + filename
try:
result = patch_ini_file(filename, filename)
print "good... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def patch_ini_file(defaultfile, customfile, PATCH=True, EXACT=False):\n default_options = SafeConfigParser()\n result = default_options.read(defaultfile) # returns an empty list if file error\n if result == []:\n raise IOError\n\n personalized_options = SafeConfigParser()\n result = personali... | [
"0.70866334",
"0.69670707",
"0.6842921",
"0.6618552",
"0.65978706",
"0.6467217",
"0.6456151",
"0.6452935",
"0.6440721",
"0.63861364",
"0.63502324",
"0.6263192",
"0.61854887",
"0.61764735",
"0.6159003",
"0.6155468",
"0.61323726",
"0.6120027",
"0.6109794",
"0.6094278",
"0.60480... | 0.741848 | 0 |
Takes a valid INI filename and returns a dictionary of the sections, options and values | def parse_ini_file_into_dict(filename):
output = {}
INIfile = SafeConfigParser()
result = INIfile.read(filename) # returns an empty list if file error
if result == []:
raise IOError
#iterate through INI file and build dictionary
for section_name in INIfile.sections():
section_d... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def parse_ini(text):\n cp = ConfigParser()\n cp.readfp(StringIO(text))\n return dict(cp.items('HyperPage'))",
"def read_ini_file (path):\n # TODO write a code to read data from ini-file to dictionary\n\n\n pass",
"def load_ini(path):\n cp = ConfigParser()\n cp.read(path)\n ... | [
"0.7232278",
"0.7100326",
"0.7098169",
"0.7018576",
"0.6725706",
"0.67110837",
"0.6655729",
"0.66455203",
"0.664008",
"0.6631495",
"0.66053814",
"0.660004",
"0.6581576",
"0.65805924",
"0.6554895",
"0.6494103",
"0.64811283",
"0.64768106",
"0.64715457",
"0.64459014",
"0.6392532... | 0.82888764 | 0 |
inserts a new Node into the correct sorted position in the list | def sorted_insert(self, value):
if self.__head is None:
self.__head = Node(value, None)
elif value < self.__head.data:
self.__head = Node(value, self.__head)
else:
n = self.__head
while n.next_node is not None and n.next_node.data <= value:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sorted_insert(self, value):\n new = Node(value)\n if self.__head is None:\n self.__head = new\n return\n\n cur = self.__head\n if new.data < cur.data:\n new.next_node = self.__head\n self.__head = new\n return\n\n while (... | [
"0.78369576",
"0.7744504",
"0.7545904",
"0.71255237",
"0.70642745",
"0.7023171",
"0.6979266",
"0.6962061",
"0.69382703",
"0.69353247",
"0.6934543",
"0.6922758",
"0.6913487",
"0.6889499",
"0.68763757",
"0.68518615",
"0.68382025",
"0.6819735",
"0.6807978",
"0.6803154",
"0.67937... | 0.7756591 | 1 |
Draw a meter line | def updateMeterLine(self, a):
self.angle = a
x = winw - 190 * cos(a * pi)
y = winw - 190 * sin(a * pi)
self.canvas.coords(self.meter, winw, winw, x, y) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def draw_line(self, x):\n self.PDF.setStrokeColor(black01)\n self.PDF.setLineWidth(1)\n self.PDF.line(75, x, 550, x)\n self.PDF.setStrokeColor(\"black\")",
"def drawSlope(self):\n length = sqrt(1 + self.slope**2) # Length of the line segment over 1 x-unit\n xOffset = (se... | [
"0.6654771",
"0.65058386",
"0.6420809",
"0.6261087",
"0.62442416",
"0.6211496",
"0.6157442",
"0.6157071",
"0.61551005",
"0.6115278",
"0.6086672",
"0.6051733",
"0.6046435",
"0.6046435",
"0.60330486",
"0.6025134",
"0.6001572",
"0.5969645",
"0.5946636",
"0.5874148",
"0.5832894",... | 0.7142266 | 0 |
Downloads subect 100307 of the WuMinn HCP data and prepares it to be used for the dmipy example notebooks. | def download_and_prepare_dmipy_example_dataset(self):
subject_ID = 100307
self.download_subject(subject_ID)
self.prepare_example_slice(subject_ID) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _fetch_large():\n # Large training data:\n resource(\n target=data_path(\"eeg\", \"SMNI_CMI_TRAIN.tar.gz\"),\n url=\"https://kdd.ics.uci.edu/databases/eeg/SMNI_CMI_TRAIN.tar.gz\",\n )\n dependency(\n target=data_path(\"eeg\", \"train\"),\n source=data_path(\"eeg\", \"SMN... | [
"0.6159995",
"0.58167714",
"0.58167714",
"0.57961726",
"0.57393724",
"0.56828964",
"0.5624181",
"0.56203014",
"0.55947495",
"0.5584175",
"0.55818474",
"0.5569496",
"0.55665064",
"0.55507535",
"0.5535328",
"0.5519431",
"0.5491015",
"0.5483432",
"0.54378176",
"0.5380978",
"0.53... | 0.5969613 | 1 |
The Mean Squared Error between the two images is the sum of the squared difference between the two images. The lower the error, the more similar the two images are. | def _mean_squared_error(img1, img2):
err = np.sum((img1.astype("float") - img2.astype("float")) ** 2)
err /= float(img1.shape[0] * img1.shape[1])
return err | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def mse(img1, img2):\n err = (np.square(img1 - img2)).mean(axis=None)\n # return the MSE, the lower the error, the more \"similar\"\n # the two images are\n return err",
"def getRMSE(image1, image2):\n im1 = readImage(image1, grayscale=False)\n im2 = readImage(image2, grayscale=False)\n retu... | [
"0.807762",
"0.8033698",
"0.79625833",
"0.7873468",
"0.7807952",
"0.77446914",
"0.7627569",
"0.7434096",
"0.7284485",
"0.7229693",
"0.72253865",
"0.72121036",
"0.7110406",
"0.6960642",
"0.69518214",
"0.6938482",
"0.69065905",
"0.68825233",
"0.66859573",
"0.6677269",
"0.666919... | 0.8452524 | 0 |
Based on the distances between each positions relative to each other, identifies the ones that lie within the radius threshold, those will be considered loops. | def _compute_loop_matrix(self, positions: torch.Tensor) -> torch.Tensor:
distances = self._location_distances(positions)
loops = distances <= self.loop_radius_threshold
return loops | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def Check(self):\n cleared = False\n while not cleared:\n for i in list(combinations([cell.Check() for cell in self.cells], 2)):\n # for i in list(combinations(zip(self.locations.x,self.locations.y,self.locations.length,self.locations.index),2)):\n x1 = i[0][0... | [
"0.6211229",
"0.61242294",
"0.5963875",
"0.5869129",
"0.5858714",
"0.5851373",
"0.5851373",
"0.58422697",
"0.5822419",
"0.5819404",
"0.58189183",
"0.58075535",
"0.5804282",
"0.58030283",
"0.5779804",
"0.5764508",
"0.57414556",
"0.5654896",
"0.56457704",
"0.56436265",
"0.56434... | 0.64368 | 0 |
Update if not exceeding total, else set indeterminate range. | def increment_with_overflow(self):
if self.n == self.total:
self.total = 0
if self._pbar:
self._pbar.setRange(0, 0)
else:
self.update(1) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update_amount(self, new_amount=None):\n if not new_amount:\n new_amount = self.amount\n if new_amount < self.min:\n new_amount = self.min\n if new_amount > self.max:\n new_amount = self.max\n self.amount = new_amount\n self.build_bar()",
"de... | [
"0.657441",
"0.63474876",
"0.61223245",
"0.6110643",
"0.6027213",
"0.5911852",
"0.5810441",
"0.57010424",
"0.5664929",
"0.564941",
"0.56384265",
"0.56240845",
"0.5619216",
"0.56185526",
"0.5607515",
"0.5593826",
"0.5553889",
"0.55427754",
"0.55313605",
"0.55175096",
"0.549691... | 0.68630666 | 0 |
Shorthand for `progress(range(args), kwargs)`. Adds tqdm based progress bar to napari viewer, if it exists, and returns the wrapped range object. Returns progress wrapped range object | def progrange(*args, **kwargs):
return progress(range(*args), **kwargs) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def trange(*args, **kwargs):\n try:\n f = xrange\n except NameError:\n f = range\n \n return tqdm(f(*args), **kwargs)",
"def tnrange(*args, **kwargs): # pragma: no cover\n from ._tqdm_notebook import tnrange as _tnrange\n return _tnrange(*args, **kwargs)",
"def trange(*args, **... | [
"0.70617276",
"0.6786414",
"0.67511237",
"0.6462382",
"0.6335384",
"0.63032806",
"0.6293557",
"0.6293065",
"0.6283249",
"0.62449145",
"0.6074341",
"0.6021488",
"0.60103077",
"0.6003572",
"0.5994165",
"0.594629",
"0.5935952",
"0.59156233",
"0.59107846",
"0.590704",
"0.5906093"... | 0.7945689 | 0 |
Generate the release notes of a gitlab project from the last release | def generate_release_notes(project_id, endstr = ' <br>', **config):
gl = gitlab.Gitlab(**config)
project = gl.projects.get(project_id)
if not project.mergerequests.list(state='merged'):
raise ValueError(f"There is not merged merge request for project {project_id} {project.name}")
if not proj... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_release_notes(self):\n\n notes = self.output.get_header('RELEASE NOTES')\n notes += 'https://{}/{}/{}/releases'.format(HOST_GITHUB, \\\n self.repo, self.product) + '\\n'\n\n notes += self.output.get_sub_header('COMPARISONS')\n n... | [
"0.7283921",
"0.72684103",
"0.6727544",
"0.6664244",
"0.6021286",
"0.60139555",
"0.5957624",
"0.58695203",
"0.57692635",
"0.5703044",
"0.56437856",
"0.56096214",
"0.5606191",
"0.5572037",
"0.5555967",
"0.5536512",
"0.5521334",
"0.55054754",
"0.55054754",
"0.55054754",
"0.5493... | 0.7753302 | 0 |
Retrieves a xkcd comic, from a number, random, or latest xkcd for that xkcd number xkcd random for a random xkcd xkcd latest for the latest xkcd | async def get_xkcd(self, ctx, number = "random"):
if not self.module_check(ctx): return
if number == "latest":
r = requests.get('https://xkcd.com/info.0.json')
elif number == "random":
r = requests.get('https://xkcd.com/info.0.json')
r = json.loads(r.text)
random_xkcd = random.randin... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"async def xkcd(self, ctx, num:int = -1):\r\n if (num < 0):\r\n webpage = \"https://c.xkcd.com/random/comic/\"\r\n else:\r\n try:\r\n webpage = \"https://xkcd.com/\" + str(num)\r\n\r\n r = requests.get(webpage).text\r\n soup = Beautifu... | [
"0.65004194",
"0.62509537",
"0.6190412",
"0.61833906",
"0.592353",
"0.552017",
"0.55044925",
"0.54781157",
"0.5253077",
"0.5229032",
"0.5170127",
"0.50046223",
"0.4944222",
"0.49343538",
"0.49296495",
"0.4925963",
"0.49172857",
"0.49054068",
"0.48533544",
"0.48440614",
"0.483... | 0.70826685 | 0 |
Handler to be fired up upon comments signal to notify the author of a given article. | def notify_comment(**kwargs): # pragma: no cover
actor = kwargs["request"].user
receiver = kwargs["comment"].content_object.user
obj = kwargs["comment"].content_object
notification_handler(actor, receiver, Notification.COMMENTED, action_object=obj) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def comment_added(self, event):\n pass",
"def notify(self, thing, redditor, link, body, author):\n if self.quiet or util.is_ignored(redditor):\n return\n\n quote = util.quote(body)\n msg = self.NOTIFICATION_BODY % (thing, link, author, quote)\n\n while msg.__len__() ... | [
"0.6736657",
"0.65961444",
"0.62605727",
"0.6199828",
"0.616941",
"0.6025677",
"0.5885872",
"0.579952",
"0.5781155",
"0.5740959",
"0.5737743",
"0.5676996",
"0.5572739",
"0.55592763",
"0.5513496",
"0.55094063",
"0.55016583",
"0.5500486",
"0.5490944",
"0.54627436",
"0.5457897",... | 0.6932298 | 0 |
Returns a list with the ecosystems from the database | def getEcosystems(self):
return self.__getColumnData(Q_ECOSYSTEMS, 'ecosystem') | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_scnlist_all(self):\n logger.debug(\"Creating Database Engine and Session.\")\n db_engine = sqlalchemy.create_engine(self.db_info_obj.dbConn)\n session_sqlalc = sqlalchemy.orm.sessionmaker(bind=db_engine)\n ses = session_sqlalc()\n logger.debug(\"Perform query to find scen... | [
"0.6161419",
"0.6117816",
"0.60961354",
"0.6015331",
"0.6003852",
"0.60002327",
"0.59901166",
"0.5985255",
"0.59535843",
"0.59440553",
"0.5884479",
"0.5863992",
"0.586064",
"0.58507353",
"0.5812304",
"0.5788731",
"0.5784592",
"0.57726556",
"0.57721615",
"0.5762565",
"0.576018... | 0.7493552 | 0 |
Returns a string with the last query that was executed | def getLastQuery(self):
return self.lastQuery | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_last_query(self):\n return self.query_history[-1][0] if self.query_history else None",
"def last_data_received_query(self) -> Optional[str]:\n return pulumi.get(self, \"last_data_received_query\")",
"def last_executed_query(self, cursor, sql, params):\n return super(DatabaseOperati... | [
"0.77467227",
"0.7316501",
"0.7197763",
"0.6623953",
"0.64969534",
"0.6351296",
"0.6207114",
"0.61992794",
"0.61884487",
"0.6114676",
"0.6104891",
"0.60885644",
"0.6088374",
"0.6060568",
"0.6044346",
"0.60384476",
"0.5991473",
"0.59811014",
"0.59659797",
"0.59493",
"0.5946965... | 0.7890688 | 0 |
returns an argument labelled by 'needle' assumes argument immediately follows it's label | def find_arg(needle, haystack):
for i in range(0, len(haystack)):
if haystack[i] == needle:
try:
return haystack[i+1]
except IndexError:
pass
return None | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def builtin(needle, data=SORTED_DATA):\n try:\n return data.index(needle)\n except ValueError:\n return -1",
"def find_arg(self, idx: int, line: Statement,\n cmp: type(lambda: None),\n rule: str, argname: str) -> Statement:\n i = idx\n fantasy = l... | [
"0.63105386",
"0.62212414",
"0.58899486",
"0.57934916",
"0.56564575",
"0.5551307",
"0.5517503",
"0.54154",
"0.54080343",
"0.5391185",
"0.53829604",
"0.5379977",
"0.5358576",
"0.5358576",
"0.5358576",
"0.5350126",
"0.5267262",
"0.5267262",
"0.5258461",
"0.5253122",
"0.5238574"... | 0.761589 | 0 |
Prompt the user to choose an item Returns the selected item, or `None` | def pick_item(items, labels, title="Pick an item", label="Pick an item",
default=None):
if default in items:
current = items.index(default)
else:
current = 0
choice, isok = QtWidgets.QInputDialog.getItem(None, title, label,
la... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def select_item(items, default=None, title='Items', prompt='item'):\n selected_item = None\n print \"\"\"\n*** {} ***\n{}\n\"\"\".format(title, '\\n'.join(number_list(items)))\n if default and default in items:\n default_index = items.index(default)+1\n else:\n default_index = None\n w... | [
"0.7506358",
"0.7180884",
"0.6972557",
"0.6861987",
"0.68235034",
"0.6815139",
"0.6801703",
"0.6766233",
"0.672105",
"0.670741",
"0.6694195",
"0.66929436",
"0.6686468",
"0.66696995",
"0.6658633",
"0.6613983",
"0.6603403",
"0.6571148",
"0.6534761",
"0.6529743",
"0.6508",
"0.... | 0.7236386 | 1 |
Prompt the user to pick from a list of classes using Qt This is the same as `pick_item`, but the labels are automatically determined from the classes using the LABEL attribute, and if not set, then the __name__. Returns the class that was selected, or `None` | def pick_class(classes, sort=False, **kwargs):
def _label(c):
try:
return c.LABEL
except AttributeError:
return c.__name__
if sort:
classes = sorted(classes, key=lambda x: _label(x))
choices = [_label(c) for c in classes]
return pick_item(classes, choices... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def choose_class(self, *args, **kwargs):",
"def pick_item(items, labels, title=\"Pick an item\", label=\"Pick an item\",\n default=None):\n\n if default in items:\n current = items.index(default)\n else:\n current = 0\n\n choice, isok = QtWidgets.QInputDialog.getItem(None, tit... | [
"0.61098415",
"0.60627544",
"0.5479893",
"0.5451506",
"0.54098386",
"0.53462285",
"0.5327789",
"0.52840036",
"0.5254908",
"0.5212027",
"0.517609",
"0.51677483",
"0.51592547",
"0.5159254",
"0.50856733",
"0.5004251",
"0.5001953",
"0.49773067",
"0.497071",
"0.49416664",
"0.49381... | 0.73479587 | 0 |
MTurk itself is the source of truth for most data required to run tasks on MTurk. The datastore holds sessions to connect with MTurk as well as mappings between MTurk ids and Mephisto ids | def initialize_provider_datastore(self, storage_path: str) -> Any:
return MTurkDatastore(datastore_root=storage_path) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def session(self):",
"def getSessionStore(self):\n pass",
"def __init__(self):\n self._datastore = dict()",
"def setup_and_run_job(self):\n step = StreamingStep(name='Titanic Machine Learning',\n mapper='s3n://' + EmrProcessing.bucket_name + '/mapper/mapper.py',\n ... | [
"0.5249119",
"0.5230097",
"0.522364",
"0.49198624",
"0.48768198",
"0.48551553",
"0.4809817",
"0.47782582",
"0.47727057",
"0.47406095",
"0.4738082",
"0.47006306",
"0.46832162",
"0.4681551",
"0.46806917",
"0.46733057",
"0.46370608",
"0.46219772",
"0.45874673",
"0.45781764",
"0.... | 0.54530257 | 0 |
Return the path to the `wrap_crowd_source.js` file for this provider to be deployed to the server | def get_wrapper_js_path(cls):
return os.path.join(os.path.dirname(__file__), "wrap_crowd_source.js") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def path(self):\n return os.path.join(FLOWJS_PATH, self.filename)",
"def path(self) -> str:\n return self.src + \"/\"",
"def generate_js_dir():\n\n return pkg_resources.resource_filename('linkedin.mobster.har.visualization.js', None)",
"def _get_path_to_front_end():\n dpath = os.path.join(o... | [
"0.6506409",
"0.64245355",
"0.6378719",
"0.62935174",
"0.6221082",
"0.62140304",
"0.621297",
"0.62058437",
"0.62000644",
"0.6144617",
"0.61140627",
"0.6102424",
"0.60733247",
"0.6052207",
"0.6030184",
"0.5986458",
"0.5984777",
"0.59069264",
"0.5870313",
"0.5858279",
"0.584577... | 0.8392228 | 0 |
Remove the qualification from the sandbox server, if it exists | def cleanup_qualification(self, qualification_name: str) -> None:
mapping = self.datastore.get_qualification_mapping(qualification_name)
if mapping is None:
return None
requester_id = mapping["requester_id"]
requester = Requester.get(self.db, requester_id)
assert isi... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _remove_sandbox(self):\n if self._sandbox.exists():\n shutil.rmtree(str(self._sandbox), ignore_errors=True)",
"def test_remove_share(self):\n self.app.delete(url=\"/config/shares?share=80&destination=gsiftp://nowhere&vo=dteam\", status=400)\n self.app.delete(url=\"/config/shar... | [
"0.61970025",
"0.60967255",
"0.5922671",
"0.5877807",
"0.57768714",
"0.5737641",
"0.566268",
"0.5645627",
"0.5631649",
"0.56219435",
"0.56062394",
"0.5596313",
"0.5559161",
"0.55466557",
"0.55354536",
"0.5524927",
"0.55084497",
"0.5470582",
"0.54642767",
"0.5451535",
"0.54160... | 0.61339295 | 1 |
Fires on Redshift cluster creation, parses the event, starts and passes event summary to the Step Function state machine that will arrange for the Creator tag to be added. | def redshift_lambda_handler(event, context):
logging.debug('event: %s', event)
detail = event['detail']
event_name = detail['eventName']
creator = get_creator(event)
logger.info('Event type: %s', event_name)
if is_err_detail(logger, detail):
return False
if event_name == 'CreateC... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def main():\n config = get_config(CONFIG_FILENAME)\n print(\"Creating IAM role\")\n role = create_iam_role(config)\n print(\"Creating redshift cluster\")\n create_redshift_cluster(config, role)",
"def runEventCreation():\r\n config = CONFIG['steps']['EventCreation']\r\n ci = config['inputs']... | [
"0.5976075",
"0.585726",
"0.57631063",
"0.57516474",
"0.5702599",
"0.5670211",
"0.5667753",
"0.5656864",
"0.5634871",
"0.5600527",
"0.5558409",
"0.5553356",
"0.5552963",
"0.5537563",
"0.54901147",
"0.54261446",
"0.5393639",
"0.5388734",
"0.5382072",
"0.53685224",
"0.5366248",... | 0.60667706 | 0 |
Return the general orthogonal group. The general orthogonal group `GO(n,R)` consists of all `n\times n` matrices over the ring `R` preserving an `n`ary positive definite quadratic form. In cases where there are muliple nonisomorphic quadratic forms, additional data needs to be specified to disambiguate. In the case of ... | def GO(n, R, e=0, var='a'):
degree, ring = normalize_args_vectorspace(n, R, var=var)
e = normalize_args_e(degree, ring, e)
if e == 0:
name = 'General Orthogonal Group of degree {0} over {1}'.format(degree, ring)
ltx = r'\text{{GO}}_{{{0}}}({1})'.format(degree, latex(ring))
else:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def SO(n, R, e=None, var='a'):\n degree, ring = normalize_args_vectorspace(n, R, var=var)\n e = normalize_args_e(degree, ring, e)\n if e == 0:\n name = 'Special Orthogonal Group of degree {0} over {1}'.format(degree, ring)\n ltx = r'\\text{{SO}}_{{{0}}}({1})'.format(degree, latex(ring))\n ... | [
"0.64191985",
"0.5813485",
"0.5426099",
"0.51514095",
"0.5073193",
"0.5073193",
"0.49048132",
"0.49046865",
"0.49010783",
"0.48452413",
"0.4838718",
"0.47921717",
"0.47873756",
"0.47791067",
"0.473437",
"0.46656948",
"0.46578968",
"0.46426404",
"0.46340567",
"0.46150836",
"0.... | 0.8264089 | 0 |
Return the special orthogonal group. The special orthogonal group `GO(n,R)` consists of all `n\times n` matrices with determinant one over the ring `R` preserving an `n`ary positive definite quadratic form. In cases where there are muliple nonisomorphic quadratic forms, additional data needs to be specified to disambig... | def SO(n, R, e=None, var='a'):
degree, ring = normalize_args_vectorspace(n, R, var=var)
e = normalize_args_e(degree, ring, e)
if e == 0:
name = 'Special Orthogonal Group of degree {0} over {1}'.format(degree, ring)
ltx = r'\text{{SO}}_{{{0}}}({1})'.format(degree, latex(ring))
else:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def GO(n, R, e=0, var='a'):\n degree, ring = normalize_args_vectorspace(n, R, var=var)\n e = normalize_args_e(degree, ring, e)\n if e == 0:\n name = 'General Orthogonal Group of degree {0} over {1}'.format(degree, ring)\n ltx = r'\\text{{GO}}_{{{0}}}({1})'.format(degree, latex(ring))\n e... | [
"0.7597684",
"0.5380911",
"0.5079343",
"0.5065736",
"0.48530337",
"0.48417363",
"0.48132086",
"0.48000914",
"0.47655866",
"0.47655866",
"0.46849912",
"0.46849912",
"0.46369678",
"0.46288002",
"0.46024132",
"0.45943207",
"0.45646042",
"0.45606288",
"0.45538473",
"0.452526",
"0... | 0.6177381 | 1 |
Return the symmetric bilinear form preserved by the orthogonal group. | def invariant_bilinear_form(self):
from sage.matrix.constructor import identity_matrix
m = identity_matrix(self.base_ring(), self.degree())
m.set_immutable()
return m | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _symmetric_image(S_elems):\n image = S_elems[0]\n symmetric_image = cp.zeros(image.shape + (image.ndim, image.ndim))\n for idx, (row, col) in enumerate(\n combinations_with_replacement(range(image.ndim), 2)\n ):\n symmetric_image[..., row, col] = S_elems[idx]\n symmetric_image[... | [
"0.5779959",
"0.55144924",
"0.5376283",
"0.5196091",
"0.5176951",
"0.5126507",
"0.5123933",
"0.5119235",
"0.5098814",
"0.5096143",
"0.50618285",
"0.50447226",
"0.49979708",
"0.49935913",
"0.49287522",
"0.48968348",
"0.48515794",
"0.484998",
"0.48499086",
"0.48263052",
"0.4812... | 0.5848953 | 0 |
Return the quadratic form preserved by the orthogonal group. | def invariant_quadratic_form(self):
from sage.matrix.constructor import identity_matrix
m = identity_matrix(self.base_ring(), self.degree())
m.set_immutable()
return m | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def invariant_quadratic_form(self):\n m = self.gap().InvariantQuadraticForm()['matrix'].matrix()\n m.set_immutable()\n return m",
"def getQuadOp(self):\n return self.basis2grid(np.eye(self.nb), axis = 0)",
"def Q(self):\n self.dualEigenmatrix()",
"def get_Q_c(dim):\n np.... | [
"0.6096417",
"0.56024075",
"0.55070233",
"0.5403502",
"0.5311804",
"0.5298959",
"0.5238195",
"0.5185676",
"0.5149036",
"0.5116379",
"0.51027095",
"0.5101817",
"0.50973207",
"0.50780195",
"0.50576276",
"0.50555134",
"0.505467",
"0.5054126",
"0.50283444",
"0.5016813",
"0.500739... | 0.608305 | 1 |
a Check whether the matrix ``x`` is symplectic. | def _check_matrix(self, x, *args):
if self._special and x.determinant() != 1:
raise TypeError('matrix must have determinant one')
F = self.invariant_bilinear_form()
if x * F * x.transpose() != F:
raise TypeError('matrix must be orthogonal with respect to the invariant for... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_is_symplectic():\n theta = np.pi / 6\n r = np.arcsinh(1.0)\n phi = np.pi / 8\n S = symplectic.rotation(theta)\n assert symplectic.is_symplectic(S)\n S = symplectic.squeezing(r, theta)\n assert symplectic.is_symplectic(S)\n S = symplectic.beam_splitter(theta, phi)\n assert symple... | [
"0.64209604",
"0.61935765",
"0.61601645",
"0.6074943",
"0.6067913",
"0.602872",
"0.5966681",
"0.595731",
"0.5826285",
"0.58157295",
"0.57305026",
"0.564298",
"0.5621283",
"0.5585602",
"0.5551893",
"0.5551576",
"0.5546114",
"0.554139",
"0.550426",
"0.5500017",
"0.5494322",
"... | 0.63018453 | 1 |
Return the quadratic form preserved by the orthogonal group. | def invariant_quadratic_form(self):
m = self.gap().InvariantQuadraticForm()['matrix'].matrix()
m.set_immutable()
return m | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def invariant_quadratic_form(self):\n from sage.matrix.constructor import identity_matrix\n m = identity_matrix(self.base_ring(), self.degree())\n m.set_immutable()\n return m",
"def getQuadOp(self):\n return self.basis2grid(np.eye(self.nb), axis = 0)",
"def Q(self):\n ... | [
"0.6080858",
"0.5600769",
"0.550645",
"0.5401144",
"0.5314119",
"0.53019667",
"0.5246059",
"0.51906383",
"0.51455516",
"0.5117674",
"0.5107267",
"0.51031226",
"0.5094862",
"0.50805855",
"0.50642264",
"0.50582856",
"0.5055545",
"0.5054465",
"0.5027284",
"0.5016461",
"0.5003758... | 0.60962576 | 0 |
Verifies if a date has already been stored in the repo in order to avoid duplications | def alreadyStored(self, date_):
for day in self._repo:
if day.date == date_:
return True
return False | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def program_out_of_date(self, stamp_path):\n if not os.path.exists(stamp_path) or self.clean:\n return True\n with open(stamp_path, 'r') as stamp:\n return self.date != stamp.read()",
"def knowledge_date_valid(record):\n today = datetime.now(timezone.utc).date().strftime(\"... | [
"0.6563999",
"0.626112",
"0.61939573",
"0.6150733",
"0.6097703",
"0.5991136",
"0.59458274",
"0.58932656",
"0.5882866",
"0.5880725",
"0.5875632",
"0.5872008",
"0.5826309",
"0.58106047",
"0.5717451",
"0.5711138",
"0.5700809",
"0.56722677",
"0.5671044",
"0.5652252",
"0.5646112",... | 0.7906975 | 0 |
Stores all the days in descending order by the number of activities that take place during said days | def storeDays(self, actRepo):
for act in actRepo.getAll():
if self.alreadyStored(act.date) == False:
day = Day(act.date, 0)
day.setNumberOfActivities(day.getNumberOfActivities(actRepo))
poz = self.findPoz(day)
self._repo.insert(po... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_day_activities(self, ord):\n da = [a for a in self.activities\n if a.start.date() == self.get_date(ord).date()]\n da.sort(key=lambda x: x.start)\n return da",
"def new_day(self):\n self.previous_days.append(self.energy_debt)\n self.energy_debt = defaultdict... | [
"0.59654236",
"0.5761598",
"0.56677634",
"0.5595232",
"0.5530035",
"0.5464419",
"0.5412132",
"0.53697985",
"0.5332635",
"0.5332635",
"0.530884",
"0.530342",
"0.5294837",
"0.52881485",
"0.52527064",
"0.52463907",
"0.52412796",
"0.5237466",
"0.5223689",
"0.5216484",
"0.5213049"... | 0.63504857 | 0 |
Yield successive nsized chunks from arr. | def chunks(arr, n):
for i in range(0, len(arr), n):
yield arr[i:i + n] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def chunks(arr, n):\n for i in range(0, len(arr), n):\n yield arr[i:i + n]",
"def iterate_array_in_chunks(arr, size: int):\n for i in range(0, len(arr), size):\n yield arr[i:i+size]",
"def chunks(array, size: int):\r\n for i in range(0, len(array), size):\r\n yield array[i:i + size]",
... | [
"0.8175373",
"0.7678264",
"0.7453133",
"0.71820194",
"0.7092048",
"0.708483",
"0.70187324",
"0.6972917",
"0.69657755",
"0.6954322",
"0.694991",
"0.6949137",
"0.6945697",
"0.67928576",
"0.67697114",
"0.6767295",
"0.67591834",
"0.6755951",
"0.6751896",
"0.6748143",
"0.6748143",... | 0.8161355 | 1 |
this function checks if user's account is lock | def check_lock(username):
try:
users = file_manager.read_from_file('users_data.json')
user = users[username]
except KeyError:
return 2
if user["status"]:
return 1
else:
lock_time = datetime.strptime(user["lock_time"], "%Y-%m-%d %H:%M:%S")
if lock_time + ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_locked(self):\r\n pass",
"def is_locked(self, request):\n username = self.get_username(request)\n if not username:\n return False\n\n candidate = self.get_candidate(request, username)\n\n return candidate.is_locked()",
"async def locked(self):\n retur... | [
"0.732503",
"0.72582555",
"0.715152",
"0.7139146",
"0.6772354",
"0.67384094",
"0.66690046",
"0.6667797",
"0.6663149",
"0.6637613",
"0.6637613",
"0.6620142",
"0.6616052",
"0.6612694",
"0.6607117",
"0.66029656",
"0.6593518",
"0.658302",
"0.6540298",
"0.65305287",
"0.6447701",
... | 0.7677541 | 0 |
Specific volume from SA, CT & p (75term equation) Calculates specific volume from Absolute Salinity, Conservative Temperature and pressure, using the computationallyefficient 75term polynomial expression for specific volume (Roquet et al., 2015). | def specvol(SA, CT, p):
SA = np.maximum(SA, 0)
xs = np.sqrt(sfac * SA + soffset)
ys = CT * 0.025
z = p * 1e-4
specific_volume = (v000
+ xs * (v100 + xs * (v200 + xs * (v300 + xs * (v400 + xs * (v500
+ xs * v600)))))
+ ys * (v010
+ xs * (v110 + xs * (v210 + ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def fn_Calc_SearchVolume(az,el):\r\n return az*el/(57.296**2) # steradians\r",
"def alpha(SA, CT, p):\n\n SA = np.maximum(SA, 0)\n\n xs = np.sqrt(sfac * SA + soffset)\n ys = CT * 0.025\n z = p * 1e-4\n\n v_CT_part = (a000\n + xs * (a100 + xs * (a200 + xs * (a300 + xs * (a400 + a500 * xs)... | [
"0.6336845",
"0.62970585",
"0.62953484",
"0.60442877",
"0.5803208",
"0.577634",
"0.57471275",
"0.57351923",
"0.56954753",
"0.55610484",
"0.55380017",
"0.55379266",
"0.55364144",
"0.553413",
"0.55246073",
"0.54857796",
"0.5481879",
"0.54782903",
"0.5457369",
"0.54516226",
"0.5... | 0.72555596 | 0 |
This function will grab the contract addresses from the brownie config if defined, otherwise, it will deploy a mock version of that contract, and return that mock contract. | def get_contract(contract_name):
contract_type = CONTRACT_TO_MOCK[contract_name]
if network.show_active() in LOCAL_BLOCKCHAIN_ENVIRONMENTS:
if len(contract_type) <= 0:
deploy_mocks()
contract = contract_type[-1]
else:
contract_address = config["networks"][network.show_act... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def deploy_tester_contract(\n web3: Web3, contracts_manager: ContractManager, deploy_contract: Callable\n) -> Callable:\n\n def f(contract_name: str, **kwargs: Dict) -> Contract:\n json_contract = contracts_manager.get_contract(contract_name)\n contract = deploy_contract(\n web3, CON... | [
"0.6382182",
"0.58761406",
"0.5620557",
"0.5588936",
"0.5529863",
"0.550409",
"0.5499634",
"0.54485416",
"0.5413113",
"0.5359612",
"0.5311255",
"0.52712035",
"0.5177235",
"0.51277983",
"0.5066179",
"0.50505745",
"0.50270975",
"0.5006101",
"0.49954298",
"0.49932137",
"0.497229... | 0.6960293 | 0 |
Draws the Logo to the window | def drawLogo(self):
logoText, logoSize = self.logo.draw()
self.drawCenteredText(logoText, logoSize, .5, .25) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def drawLogo(self):\n print(\"__________ __________ \")\n print(\"\\______ \\_____ _______ ____\\______ \\ ____ ____ ____ ______\")\n print(\" | | _/\\__ \\\\_ __ \\_/ __ \\| | _// _ \\ / \\_/ __ \\ / ___/\")\n p... | [
"0.8198084",
"0.78252965",
"0.6996111",
"0.6744075",
"0.663204",
"0.6565417",
"0.65108955",
"0.6453138",
"0.64203787",
"0.6416802",
"0.6387564",
"0.6345709",
"0.62990206",
"0.6109719",
"0.60963976",
"0.60401636",
"0.6033548",
"0.598029",
"0.59656924",
"0.5958786",
"0.5950044"... | 0.8449776 | 0 |
Gets the oldest nr num, that is in DRAFT status It then marks the NR as INPROGRESS, and assigns it to the User as found in the JWT It also moves control of the Request from NRO so that NameX fully owns it | def get():
# GET existing or CREATE new user based on the JWT info
try:
user = get_or_create_user_by_jwt(g.jwt_oidc_token_info)
except ServicesError as se:
return jsonify(message='unable to get ot create user, aborting operation'), 500
except Exception as unmanag... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def patch(nr, *args, **kwargs):\n\n # do the cheap check first before the more expensive ones\n # check states\n json_input = request.get_json()\n if not json_input:\n return jsonify({'message': 'No input data provided'}), 400\n\n # find NR\n try:\n u... | [
"0.59759724",
"0.5502482",
"0.50420475",
"0.49918523",
"0.49487495",
"0.49382246",
"0.4874575",
"0.48450384",
"0.4799153",
"0.47851813",
"0.47194552",
"0.4684184",
"0.46788785",
"0.46570268",
"0.46375605",
"0.46284765",
"0.46206832",
"0.4581954",
"0.4566684",
"0.45598346",
"0... | 0.67952913 | 0 |
Patches the NR. Currently only handles STATE (with optional comment) and Previous State. | def patch(nr, *args, **kwargs):
# do the cheap check first before the more expensive ones
# check states
json_input = request.get_json()
if not json_input:
return jsonify({'message': 'No input data provided'}), 400
# find NR
try:
user = get_or_cr... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def handle_nr_patch(self, nr: Request, svc) -> Request:\n return self.patch_nr(nr, svc, self.nr_action, self.request_data)",
"def patch_nr(nr: Request, svc, nr_action, request_data) -> Request:\n return nr",
"def update_nr(self, nr_model: Request, new_state, on_state_changed: Callable) -> Request... | [
"0.6651871",
"0.62266606",
"0.58041054",
"0.55699944",
"0.54291683",
"0.5370416",
"0.5353354",
"0.5139245",
"0.50210714",
"0.4940941",
"0.4908895",
"0.4899121",
"0.48738235",
"0.48672616",
"0.48647994",
"0.48292473",
"0.4816086",
"0.4788906",
"0.47743717",
"0.47575423",
"0.47... | 0.6228558 | 1 |
return a datatables table of Products | def product_datatables(request, country):
template = loader.get_template('products_dt.html')
context = {
'country': country,
}
return HttpResponse(template.render(context, request)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show_all_products():\n\n data = cur.execute(\"\"\"SELECT productid, productname, unitcost, stock FROM catalogue\"\"\").fetchall()\n\n print(tabulate(data, headers=[\"Product ID\", \"Name\", \"Cost\", \"Stock\"]))",
"def show_table():\n\n title_list = ('ID', 'Platform', 'Producer', 'Year', 'Elements'... | [
"0.7014664",
"0.64985615",
"0.6359322",
"0.62472254",
"0.62471366",
"0.61274016",
"0.6074278",
"0.6023835",
"0.5955379",
"0.59196746",
"0.588224",
"0.58655083",
"0.5853103",
"0.5764689",
"0.5728626",
"0.57183135",
"0.57028776",
"0.57023144",
"0.5689794",
"0.56871045",
"0.5638... | 0.66345334 | 1 |
return Prices of a Product in JSON for chart.js | def price_chart_json(request, prod_id):
prices = Product.objects.get(prod_id=prod_id).prices
labels = []
data = []
for price in prices:
labels.append(price.updated_at.strftime('%Y-%m-%d %H:%M'))
data.append(price.price_discounted)
output = {
'labels': labels,
'dataset... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_products(self):\n con = dbcon()\n cur = con.cursor()\n cur.execute(\"SELECT * FROM products;\")\n res = cur.fetchall()\n if res:\n prdcts=[]\n for prodct_item in res:\n picked_prdct = {\n 'product_id':prodct_item[0],\n ... | [
"0.61806893",
"0.6156857",
"0.6114201",
"0.59851384",
"0.59814095",
"0.58938473",
"0.5891675",
"0.5886324",
"0.58732736",
"0.58661497",
"0.5860471",
"0.5856876",
"0.58433104",
"0.5743985",
"0.5729805",
"0.57109624",
"0.57048815",
"0.5701539",
"0.5692167",
"0.5687261",
"0.5672... | 0.7618412 | 0 |
Function to calculate nearest square of any number. | def nearest_square(num):
answer = 0
while (answer+1)**2 < num:
answer += 1
return answer**2 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def nearest_square(limit):\r\n\t#Approach 1\r\n\t# i = 1\r\n\t# bef_limit = 1\r\n\t# aft_limit = 1\r\n\r\n\t# while aft_limit < limit:\r\n\t# \tbef_limit = i * i\r\n\t# \ti += 1\r\n\t# \taft_limit = i * i\r\n\r\n\t# return print(bef_limit)\r\n\r\n\t#Approach 2\r\n\tanswer = 0\r\n\twhile (answer + 1) ** 2 < limit:... | [
"0.7228044",
"0.72103846",
"0.7090561",
"0.6829691",
"0.67724407",
"0.6676651",
"0.6637373",
"0.66144526",
"0.66071945",
"0.65512776",
"0.6550018",
"0.65374154",
"0.65360725",
"0.653117",
"0.6515336",
"0.64857906",
"0.6485642",
"0.64515924",
"0.64435893",
"0.64397997",
"0.642... | 0.8259449 | 0 |
First disables keyboard input then prints out the passed text's characters over time in the console/terminal window. | def type_out(text):
disable_typing.start()
text = text + "\n"
for c in text:
sys.stdout.write(c)
sys.stdout.flush()
time.sleep(0.01)
disable_typing.stop() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def display_text(self, text):\n self.update_screen_size()\n self.stdscr.erase()\n for line in text:\n self.stdscr.addstr(f'{PADCHAR}{line}\\n')\n self.stdscr.addstr(PADCHAR)\n self.get_key()",
"def main():\n x = UserInput()\n x.display_characters()\n x.remov... | [
"0.68861306",
"0.6368338",
"0.62599236",
"0.6093728",
"0.5993454",
"0.5990996",
"0.5946539",
"0.5936349",
"0.592439",
"0.5923846",
"0.590445",
"0.5884914",
"0.5882098",
"0.5879677",
"0.587821",
"0.58692664",
"0.58652073",
"0.5793333",
"0.57729864",
"0.5740989",
"0.5726371",
... | 0.6692625 | 1 |
Connect to serial device | def connect(self):
try:
if not self.serial.isOpen():
self.serial = serial.Serial(
self.port,
self.baudrate,
timeout=self.timeout,
rtscts=self.hardware_flagging,
xonxoff=self.softwa... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def connect(self):\n # open serial port\n try:\n #device = self.get_device_name(self.serial_number)\n device = \"/dev/ttyAMA0\"\n self.serial.port = device\n # Set RTS line to low logic level\n self.serial.rts = False\n self.serial.ope... | [
"0.87454766",
"0.8238209",
"0.8088021",
"0.80798197",
"0.79864776",
"0.7982208",
"0.77810824",
"0.7659955",
"0.76384616",
"0.76312846",
"0.7477031",
"0.7445675",
"0.7402249",
"0.7379431",
"0.7376541",
"0.7373049",
"0.7311741",
"0.7294954",
"0.7272364",
"0.72142607",
"0.721319... | 0.8357295 | 1 |
Disconnect from serial device | def disconnect(self):
try:
if self.serial.isOpen():
self.serial.close()
print("disconnected from %s") % (self.port)
except serial.SerialException as e:
msg = "unable to disconnect from %s" % (self.port)
raise Exception(msg, e) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def disconnect(self):\n self.serial.close()\n self.connected = 0",
"def _disconnect(self):\n try:\n self._writeChar.write(b\"\\x01\\x0D\")\n self._peripheral.disconnect()\n except btle.BTLEException as e:\n logging.getLogger(\"anki.overdrive\").error(e... | [
"0.8158211",
"0.7708659",
"0.76507515",
"0.74285984",
"0.7424607",
"0.73818547",
"0.7354014",
"0.7315363",
"0.7246738",
"0.7245756",
"0.7137724",
"0.7119263",
"0.71056294",
"0.6972021",
"0.691947",
"0.6867491",
"0.6861349",
"0.6861349",
"0.6712015",
"0.6688726",
"0.66070133",... | 0.7718011 | 1 |
Test number of articles | def testArticleCount(self):
self.articleCount(17) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def count_articles(all_articles):\n print(f\"There are {len(all_articles)} articles.\")",
"def num_articles(self):\n\t\treturn len(index)",
"def test_count_publications(self):\n pass",
"def b_count_test(self):\n \t \n\tsel = self.selenium\n test = \"Test B - Count Articles, Titles, Headin... | [
"0.768725",
"0.76078695",
"0.7498599",
"0.7017731",
"0.6964006",
"0.6632575",
"0.6469208",
"0.6447656",
"0.6418311",
"0.6384659",
"0.6350049",
"0.63282365",
"0.6303709",
"0.62909335",
"0.6263611",
"0.6241611",
"0.62140673",
"0.6210647",
"0.6201982",
"0.61818683",
"0.61669",
... | 0.8598627 | 0 |
Test number of sections | def testSectionCount(self):
self.sectionCount(3640) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def number_of_sections(self):\n #print (len(self.config.sections()))\n return len(self.config.sections())",
"def sections(self) -> int:\n return len(self.string.split(\".\"))",
"def _check_nentries(sections, num_def, dat_def):\n print \" * Checking %s\" % num_def\n nentries = int(se... | [
"0.7037329",
"0.69097173",
"0.6744445",
"0.6736006",
"0.6570205",
"0.6538482",
"0.62730205",
"0.6185091",
"0.61379397",
"0.6125324",
"0.61143154",
"0.60816586",
"0.6027998",
"0.59916216",
"0.5968166",
"0.5966164",
"0.5957821",
"0.5925857",
"0.5908895",
"0.59075576",
"0.590755... | 0.8363173 | 0 |
Sigmoid scaled to logarithm of maximum sales scaled by 20%. | def act_sigmoid_scaled(x):
return tf.nn.sigmoid(x) * tf.math.log(max_sales) * 1.2 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def asigmoid(x):\n return -log(1 / x - 1)",
"def sigmoid(x):\r\n return 1 / (1 + np.exp(-x))",
"def sigmoid(x):\n return 1 / (1 + (e**(-x))) #changed the '-' to a '+' because it didnt work otherwise\n #return 1 / (1 + math.exp(-x))",
"def sigmoid(x):\n\treturn 1 / (1 + m.exp(-x))",
"def sigmoid... | [
"0.7279069",
"0.7055931",
"0.70535105",
"0.7038796",
"0.70300955",
"0.702078",
"0.7003955",
"0.6995886",
"0.6995886",
"0.6995886",
"0.6995886",
"0.6995886",
"0.6995886",
"0.69868886",
"0.69819033",
"0.69805765",
"0.6973958",
"0.6969267",
"0.6968753",
"0.6966772",
"0.69632316"... | 0.8239424 | 0 |
Test the surface batch reactor with a dissociative adsorption of H2 Here we choose a kinetic model consisting of the dissociative adsorption reaction H2 + 2X 2 HX We use a SurfaceArrhenius for the rate expression. | def test_solve_h2(self):
h2 = Species(
molecule=[Molecule().from_smiles("[H][H]")],
thermo=ThermoData(Tdata=([300, 400, 500, 600, 800, 1000, 1500], "K"),
Cpdata=([6.955, 6.955, 6.956, 6.961, 7.003, 7.103, 7.502], "cal/(mol*K)"),
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_double_ended_two_matching_sections_and_two_asym_atts():\n from dtscalibration import DataStore\n\n cable_len = 100.0\n nt = 5\n time = np.arange(nt)\n nx_per_sec = 4\n nx = nx_per_sec * 9\n x = np.linspace(0.0, cable_len, nx)\n ts_cold = 4.0 + np.cos(time) * 4\n ts_warm = 20.0 +... | [
"0.5857623",
"0.57328665",
"0.57189196",
"0.5691265",
"0.56663454",
"0.5634635",
"0.56297636",
"0.5572065",
"0.5564398",
"0.5536602",
"0.5481499",
"0.54513687",
"0.5449088",
"0.54226774",
"0.54187816",
"0.53971255",
"0.5386211",
"0.53379816",
"0.53322816",
"0.5320957",
"0.529... | 0.62359434 | 0 |
return token or None Get the user's token | def _get_token(self):
return user.get_token() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_token(self):\n token_model = TokenModel.find_by_user_id(self.id)\n return token_model.token if token_model else None",
"def token(self):\n if self.is_auth_needed():\n self.authorize()\n\n return self.get_from_cache('token')",
"def get_token(id=None, name=None):\n\... | [
"0.84707874",
"0.79051846",
"0.7899013",
"0.78455675",
"0.78374463",
"0.78128433",
"0.78067213",
"0.78067213",
"0.7805395",
"0.7789392",
"0.77531856",
"0.7749181",
"0.769164",
"0.764313",
"0.7602951",
"0.75837934",
"0.7569703",
"0.7560849",
"0.7540031",
"0.7540031",
"0.752856... | 0.8888377 | 0 |
The application needs a list of terms to search, and expects them to be in Redis. If there are no terms in Redis, the function calls to populate them | def check_search_terms(redis_client):
if redis_client.scard('search_terms') == 0:
populate_search_terms(redis_client) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def populate_search_terms(redis_client):\n logging.info('Populating search terms into redis from SQL', extra={'category': 'search_terms'})\n sql_session = get_sql_session()\n search_terms = sql_session.query(SearchTerm.term).all()\n redis_client.sadd('search_terms', *[x.term for x in search_terms])",
... | [
"0.7370275",
"0.6410403",
"0.63601834",
"0.61122674",
"0.6098539",
"0.5958093",
"0.5895517",
"0.5888347",
"0.57425004",
"0.57157993",
"0.5688034",
"0.5672559",
"0.56381",
"0.5621131",
"0.5598111",
"0.5591664",
"0.55525327",
"0.5542",
"0.55205095",
"0.5517854",
"0.5506315",
... | 0.7579261 | 0 |
Pulls a list of search terms from a SQL database and stores them in Redis. If you're forking this application, it may be easier to retrieve the terms from an environment variable. | def populate_search_terms(redis_client):
logging.info('Populating search terms into redis from SQL', extra={'category': 'search_terms'})
sql_session = get_sql_session()
search_terms = sql_session.query(SearchTerm.term).all()
redis_client.sadd('search_terms', *[x.term for x in search_terms]) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def check_search_terms(redis_client):\n if redis_client.scard('search_terms') == 0:\n populate_search_terms(redis_client)",
"async def search(terms):\n\n # Load Settings\n settings = await fetch_settings()\n table = settings[\"table\"]\n\n if \";\" in terms:\n terms.replace(\";\", \"... | [
"0.6460693",
"0.634508",
"0.62994814",
"0.5751638",
"0.5747469",
"0.5716624",
"0.5712331",
"0.5666993",
"0.55520856",
"0.5546508",
"0.55464023",
"0.5528988",
"0.5444579",
"0.5405701",
"0.54004",
"0.5391403",
"0.5354416",
"0.53369135",
"0.53135234",
"0.53067964",
"0.529449",
... | 0.76765627 | 0 |
Checks redis to see whether we have hit the Twitter API query limit Theoretically, the pythontwitter client can do this, but there is currently a bug in it | def check_limit(redis_client):
if redis_client.llen('query_counter') >= API_RATE_LIMIT:
left_val = redis_client.lpop('query_counter')
parsed_left_val = float(left_val.decode('utf-8'))
current_api_window = (datetime.utcnow() - timedelta(minutes=API_WINDOW_PERIOD)).timestamp()
if parse... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def checkRls():\n return api.rate_limit_status()['resources']['search']['/search/tweets']['remaining']",
"def check_rate_limit(session, provided_iocs):\n rate_limit = session.rate_limit_status()[\"resources\"][\"search\"][\"/search/tweets\"]\n\n if rate_limit[\"remaining\"] == 0:\n reset_time ... | [
"0.6641506",
"0.6612894",
"0.6350379",
"0.6217889",
"0.5983697",
"0.5929862",
"0.5895387",
"0.5876525",
"0.5871633",
"0.58624846",
"0.5848092",
"0.58027405",
"0.5798709",
"0.57807744",
"0.57616556",
"0.574481",
"0.57211715",
"0.5687839",
"0.5648984",
"0.5633326",
"0.56123513"... | 0.69056284 | 0 |
Finds and returns the next search term that the application should query. It does this by querying Redis and sorting the search_terms by score Each search_term's score is set after a query, and depends on how many Tweets the application needs to collect | def get_next_query(redis_client):
return redis_client.sort('search_terms', by='*->score')[0].decode('utf-8') | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def collect_tweets(redis_client, twitter_client, search_term):\n search = Search(redis_client, twitter_client, search_term)\n search.get_term_state()\n search.parse_term_state()\n search.set_query_string()\n search.set_execution_time()\n search.execute_query()\n search.incr_query_counters()\n ... | [
"0.620685",
"0.611024",
"0.59592915",
"0.5951669",
"0.585651",
"0.5806869",
"0.5780005",
"0.5740984",
"0.57283866",
"0.5722403",
"0.56850266",
"0.5679476",
"0.5645256",
"0.56446594",
"0.56444156",
"0.5579718",
"0.55482143",
"0.55387723",
"0.5524634",
"0.55190307",
"0.55164003... | 0.6885656 | 0 |
Get months and days until the next birthday. Approximate, as it does not count specific month durations, but approximates to the nearest 30 days | def get_next_birthday(birthday, today):
try:
next_birthday = birthday.replace(year=today.year)
except ValueError:
# not a leapyear, no february 29th; use the day before
next_birthday = birthday.replace(day=28, year=today.year)
if next_birthday < today: # next year
try:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_delta_30_days(self):\n input_ = (datetime.date(1996, 4, 1), datetime.date(1996, 5, 1))\n output = self.expander._get_next_days(*input_)\n expected = 30\n actual = (output[-1] - output[0]).days\n\n self.assertEqual(expected, actual)",
"def nextDay(year, month, day):\n ... | [
"0.6288889",
"0.60788447",
"0.60556895",
"0.5999455",
"0.5990442",
"0.5966739",
"0.59565675",
"0.59494776",
"0.5947355",
"0.5923941",
"0.5923883",
"0.5864053",
"0.58600646",
"0.58422095",
"0.5839163",
"0.5800275",
"0.57847387",
"0.57738745",
"0.5772187",
"0.5763912",
"0.57611... | 0.67215574 | 0 |
Load MeSH terms to local index. | def index_mesh(source):
click.secho(
'Loading MeSH topical headings from {}'.format(source), fg='blue'
)
terms = MeSH.load(source, filter='topics')
# Adapt to indexer
index_name = 'terms-term-v1.0.0'
type_name = 'term-v1.0.0'
indexable_terms = [
mesh_indexable(t, index=inde... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def load(self):\n self.index = nmslib.init(method='hnsw', space='cosinesimil')\n self.index.loadIndex(c.index_path('hnsw.index'))\n self.ys = joblib.load(\"%s.ys\" % self.index_file_prefix)",
"def load(self):\n \n with open(os.path.join(self.output_dir, 'terms.dict'), 'rb') as ... | [
"0.6285702",
"0.5871465",
"0.58276516",
"0.57672435",
"0.5629958",
"0.55910903",
"0.55763984",
"0.5527422",
"0.5505033",
"0.548794",
"0.54684395",
"0.54640126",
"0.5382681",
"0.53757185",
"0.5367873",
"0.53672683",
"0.5348068",
"0.531407",
"0.53001904",
"0.5284486",
"0.526426... | 0.6044638 | 1 |
Load FAST terms to local index. | def index_fast(source):
click.secho(
'Loading FAST topical headings from {}'.format(source), fg='blue'
)
terms = FAST.load(source)
# Adapt to indexer
index_name = 'terms-term-v1.0.0'
type_name = 'term-v1.0.0'
indexable_terms = [
fast_indexable(t, index=index_name, doc_type=... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def preexe():\n from collections import OrderedDict as odict\n term_index = odict()\n term_vec = pickle.loads(open('term_vec.pkl', 'rb').read())\n with open('./dumps.txt', 'r') as f:\n datasets = []\n for fi, line in enumerate(f):\n if fi > 50000: break\n if fi%500 == 0:\n print(\"now it... | [
"0.60653687",
"0.5816298",
"0.5747824",
"0.55676675",
"0.5477192",
"0.5444246",
"0.54344857",
"0.5417376",
"0.53907627",
"0.5380906",
"0.53788966",
"0.53603697",
"0.5317161",
"0.5301147",
"0.5209727",
"0.5206791",
"0.5162666",
"0.5158052",
"0.5149038",
"0.5138048",
"0.5091468... | 0.6611116 | 0 |
test slice op jit | def test_add_op_jit():
x = np.array([1, 2, 3, 4, 5, 6, 7])
paddle_x = paddle.to_tensor(x).astype("float32")
paddle_x.stop_gradient = False
print(paddle_x)
a = 1
b = 5
out = custom_ops.slice_test(paddle_x, a, b)
print("out: ", out)
print("numpy out: ", x[a:b])
assert np.allclose(o... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def simple_slice():\n examples = [\n benchmark.Example(\n inputs=[\n [[12, 34, 56, 78], [-1, -2, -3, -4]],\n -1,\n ],\n output=[[34, 56], [-2, -3]],\n ),\n ]\n constants = []\n description = 'Slice a tensor'\n target_program = 'in1[:, 1:in2]'\n s... | [
"0.69115263",
"0.6721499",
"0.6676797",
"0.6397989",
"0.6385373",
"0.634822",
"0.63363117",
"0.62823397",
"0.6276856",
"0.6274819",
"0.62578684",
"0.6245129",
"0.6230347",
"0.6226482",
"0.6224846",
"0.6191958",
"0.616624",
"0.6162497",
"0.6124059",
"0.6097182",
"0.6080089",
... | 0.6927809 | 0 |
Assume bacteria are <5um and therefore gravitational settling and physical filtration are negligible base condition is that initial concentration in cells/mL is scaled by flow in mL/t, giving flux of cells per timestep. However, this is modified by growth and decay and potentially adsorption at cryoconite layers (and i... | def cell_cnc_tracker(Out, U, V, W, t, cell0, cellG, cellD, SHP, cryoconite_locations):
Cells = np.random.rand(len(t),SHP[0],SHP[1],SHP[2]) * cell0
CellD = np.zeros(shape=(SHP[0],SHP[1],SHP[2])) + cellD
CellG = np.zeros(shape=(SHP[0],SHP[1],SHP[2])) + cellG
for i in np.arange(0,SHP[0],1):
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update_concentrations_batch(self): \n #--- Update the cell concentrations ---\n # dX_i/dt = mu_i*(1-rmp/100)*X_i*(1 - sum(i,(1-rmp/100)X(i))/carrying_capacity) or \n # (X_i(t+dt) - X_i(t))/dt = mu*(1-rmp/100)*X_i(t)*(1 - sum(i,(1-rmp/100)*X_i(t))/carrying_capacity)\n # where rmp is... | [
"0.6495916",
"0.6186542",
"0.60045516",
"0.5924471",
"0.5897217",
"0.5815934",
"0.5814444",
"0.57242084",
"0.5715073",
"0.5624548",
"0.5605489",
"0.55831075",
"0.5557937",
"0.545888",
"0.5437704",
"0.54304695",
"0.5423831",
"0.5422458",
"0.5421425",
"0.542062",
"0.54129565",
... | 0.70816755 | 0 |
Creates a list of all the image files in the image directory; files ONLY | def make_image_list(directory):
only_files = [file for file in listdir(directory) if isfile(join(directory, file))]
return only_files | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def collect_image_files():\n negs = [] # Non image files found\n for filename in os.listdir('.'):\n if filename.lower().endswith('.jpg') or filename.lower().\\\n endswith('.jpeg'):\n jpg_files.append(filename)\n elif filename.lower().endswith('.gif'):\n gif... | [
"0.78000426",
"0.773703",
"0.7648217",
"0.7630792",
"0.76076066",
"0.75916517",
"0.7558272",
"0.75155276",
"0.7501246",
"0.7460021",
"0.74191827",
"0.73886985",
"0.7345344",
"0.73427886",
"0.73354346",
"0.7333872",
"0.7325512",
"0.7314677",
"0.72958463",
"0.7290411",
"0.72839... | 0.81235904 | 0 |
look for the image real path, if name is None, then return all images under path. system encoded path string | def search_image(name=None, path=['.']):
name = strutils.decode(name)
for image_dir in path:
if not os.path.isdir(image_dir):
continue
image_dir = strutils.decode(image_dir)
image_path = os.path.join(image_dir, name)
if os.path.isfile(image_path):
return ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getImageFinder(self, name: str) -> Optional[str]:\n trace = 'themes' in g.app.debug\n exists = g.os_path_exists\n getString = g.app.config.getString\n\n def dump(var: str, val: str) -> None:\n print(f\"{var:20}: {val}\")\n\n join = g.os_path_join\n #\n ... | [
"0.6869608",
"0.66916203",
"0.6667544",
"0.65323496",
"0.6518004",
"0.6496612",
"0.649417",
"0.638726",
"0.6291642",
"0.62474424",
"0.6227159",
"0.6203767",
"0.6148511",
"0.6126196",
"0.61073565",
"0.6105781",
"0.60948",
"0.60747796",
"0.6068512",
"0.6051326",
"0.605123",
"... | 0.81272054 | 0 |
Calculates the hydraulic cost function that reflects the increasing damage from cavitation and greater difficulty of moving up the transpiration stream with decreasing values of the hydraulic conductance. Also calculates the associated plant vulnerability. | def hydraulic_cost(p, P):
# Weibull parameters setting the shape of the vulnerability curve
b, c = Weibull_params(p) # MPa, unitless
# current maximum plant hydraulic conductance (@ saturation)
kmax = p.kmax * f(p.Ps, b, c) # mmol s-1 m-2 MPa-1
# plant vulnerability curve
VC = f(P, b, c, re... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def Hstep_cost_function(H): \n U = Wold - Yold\n #cost = -np.trace(H.T@K@H) + (self.admm_rho/2)*(norm(H.T@D - Wold + self.Y, 'fro')**2) \n cost = -np.trace(H.T@K@H)/nsamples + (rho/2)*np.trace((H.T@D - U)@(H.T@D-U).T) \n ret... | [
"0.65912974",
"0.6244574",
"0.614623",
"0.6077445",
"0.588699",
"0.58844084",
"0.5784284",
"0.57747513",
"0.57590324",
"0.5737427",
"0.57259434",
"0.5711519",
"0.57030696",
"0.5630327",
"0.56112677",
"0.55877674",
"0.55828595",
"0.5579857",
"0.5578856",
"0.5574096",
"0.557390... | 0.723888 | 0 |
Uses a combination of symbols and matrices to find the value of variable (y) for which expr(y) is minimised. Being able to express the solution symbolically can be an interesting feature depending on the user's needs. | def symbolic_solve(expr, x, y, xvals, varsol, bound_expr):
# return function from expression
fun = lambdify((x, y), expr, 'numpy')
max_fun = lambdify((x, y), bound_expr, 'numpy')
# solutions over varsol
match = fun(np.expand_dims(xvals, axis=1), varsol)
# closest match to ~ 0. (i.e. supply ~ ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def equation(self):\n mat = np.zeros((self.nunknowns, self.model.neq))\n rhs = np.zeros(self.nunknowns) # Needs to be initialized to zero\n rhs[0:self.nlayers - 1] = 0.0\n rhs[self.nlayers - 1] = self.Qc\n ieq = 0\n for e in self.model.elementlist:\n if e.nunkn... | [
"0.58609295",
"0.5785145",
"0.5762061",
"0.57380515",
"0.5711677",
"0.56704897",
"0.5644473",
"0.5639892",
"0.56248474",
"0.56210196",
"0.5604313",
"0.5557365",
"0.55066156",
"0.5499545",
"0.54961824",
"0.5474314",
"0.5452221",
"0.5450342",
"0.54251564",
"0.5424691",
"0.54230... | 0.73677987 | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.