query
stringlengths
9
3.4k
document
stringlengths
9
87.4k
metadata
dict
negatives
listlengths
4
101
negative_scores
listlengths
4
101
document_score
stringlengths
3
10
document_rank
stringclasses
102 values
Build and return the parser
def _build_parser(self, parser_state, infile, data_key=None): config = self._parser_config.get(data_key) # # If the key is WFP_ENG_STC_IMODEM, build the WFP parser. # if data_key == DataTypeKey.WFP_ENG_STC_IMODEM: config.update({ DataSetDriverConfigK...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def build_parser(self, parser: ArgumentParser) -> None:", "def create_parser():\n pass", "def build(self):\r\n\r\n parser.Parser.build(self)\r\n\r\n self.connection = self.owner\r\n\r\n self.states = (\r\n self._parse_header,\r\n self._parse_payload\r\n )\r\...
[ "0.72147834", "0.70837766", "0.68055356", "0.67880434", "0.6773191", "0.6767309", "0.6758995", "0.6749904", "0.67395407", "0.6736878", "0.6718287", "0.6712943", "0.6680505", "0.6678948", "0.6677656", "0.66478896", "0.66147393", "0.6591773", "0.6584422", "0.65830135", "0.65797...
0.61204416
56
Build and return the harvesters
def _build_harvester(self, driver_state): harvesters = [] # list of harvesters to be returned # # Verify that the WFP_ENG_STC_IMODEM harvester has been configured. # If so, build the harvester and add it to the list of harvesters. # if DataTypeKey.WFP_ENG_STC_IMODEM ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _build_harvester(self, driver_state):\n harvesters = []\n harvester_telem = self._build_single_dir_harvester(driver_state, DataSourceKey.DOFST_K_WFP_TELEMETERED)\n if harvester_telem != None:\n harvesters.append(harvester_telem)\n harvester_recov = self._build_single_dir_...
[ "0.7444076", "0.5721587", "0.56941164", "0.55914825", "0.5506487", "0.5437611", "0.5385583", "0.530062", "0.52521396", "0.51882625", "0.51527625", "0.51514226", "0.5145552", "0.5139645", "0.513831", "0.5102349", "0.50820017", "0.50716585", "0.50682163", "0.50624853", "0.50624...
0.7412672
1
Get a map with user data.
def get_data(self, user_id: str) -> dict: data = { 'id': str(user_id), 'first_name': '', 'last_name': '', 'fullname': '', 'email': '', 'internal': False, } try: _ = UUID(user_id) # noQA except (ValueErro...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load_user_map_from_db():\n user_map = {}\n\n try:\n users = get_users_from_table()\n for user in users:\n user_dict = {\n \"user_id\" : user[0],\n \"username\" : user[1],\n \"id_last_message_sent\" : user[2],\n \"id_last...
[ "0.69286346", "0.6791849", "0.67246616", "0.6558624", "0.65007263", "0.65007263", "0.6481908", "0.64001936", "0.63643163", "0.6360183", "0.6331215", "0.63043565", "0.62708354", "0.6225074", "0.6222621", "0.6133974", "0.6111276", "0.6100732", "0.6083653", "0.6079973", "0.60788...
0.59283227
32
Update workflow history with user data.
def update_wf_history(self, state_history: list) -> list: for item in state_history: user = item.get('actor', None) # first call when the actor value still a UUID string if isinstance(user, str): user_id = user new_actor = self.get_data(user_id...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def workflowHistory(self, complete=True):\n context = aq_inner(self.context)\n # Since switching to DCWorkflow's getInfoFor, we rely on its\n # permission checks.\n #if not (_checkPermission('Request review', context) or\n # _checkPermission('Review portal content', context)):...
[ "0.61540836", "0.6125555", "0.591495", "0.58511055", "0.5786381", "0.57115734", "0.56571823", "0.5568863", "0.55354965", "0.55148375", "0.5510111", "0.5493928", "0.5459825", "0.54500985", "0.54432887", "0.544232", "0.5427807", "0.54250336", "0.54075015", "0.53887635", "0.5375...
0.6586897
0
Create a new instance of IUserProfileQuery service.
def factory(): return BaseUserProfileQuery()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def createUserProfile(user):\n MyProfile.objects.get_or_create(user=user)", "def __init__(self, data=None, **kw):\n def _get_class_by_id(profile_id):\n from solariat_bottle.db.user_profiles.social_profile import DELIMITER, TwitterProfile, FacebookProfile\n pos = unicode(profile_id...
[ "0.51021117", "0.49137616", "0.4905571", "0.48837894", "0.4858772", "0.48104918", "0.47793677", "0.47448534", "0.4731313", "0.47094455", "0.46971658", "0.4694588", "0.46914098", "0.46800095", "0.46723658", "0.46636164", "0.4662662", "0.46383607", "0.4628606", "0.46245837", "0...
0.69030565
0
Replication of Permutation Invariant MNIST FROM MINE
def __init__(self): super(enc_clf, self).__init__() self.fc1 = nn.Linear(784, 1024) self.fc2 = nn.Linear(1024, 1024) self.fc3 = nn.Linear(1024, 512) self.fc4 = nn.Linear(512, 10)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_mnist(one_hot_enc, normalized, flatten):", "def create_mnistm(X):\r\n X_ = np.zeros([X.shape[0], 28, 28, 3], np.uint8)\r\n for i in range(X.shape[0]):\r\n bg_img = rand.choice(background_data)\r\n d = mnist_to_img(X[i])\r\n d = compose_image(d, bg_img)\r\n X_[i] = d\r\n ...
[ "0.6066758", "0.5567557", "0.54996955", "0.5488691", "0.545105", "0.544305", "0.54020065", "0.53942245", "0.53536475", "0.5336917", "0.5330594", "0.53164667", "0.52718514", "0.5238064", "0.5221159", "0.51521015", "0.5139024", "0.5102541", "0.5089178", "0.5077222", "0.507558",...
0.0
-1
Initializer called when used as a Zope 2 product. This is referenced from configure.zcml. Regstrations as a "Zope 2 product" is necessary for GenericSetup profiles to work, for example. Here, we call the Archetypes machinery to register our content types with Zope and the CMF.
def initialize(context): content_types, constructors, ftis = atapi.process_types( atapi.listTypes(config.PROJECTNAME), config.PROJECTNAME) for atype, constructor in zip(content_types, constructors): utils.ContentInit('%s: %s' % (config.PROJECTNAME, atype.portal_type), conte...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def initialize(context):\n logger.info(\"*** Initializing BHP LIMS Customization Package ***\")\n\n from content.courier import Courier # noqa\n from content.couriers import Couriers # noqa\n\n from bhp.lims.content.barcodeprinter import BarcodePrinter # noqa\n from bhp.lims.controlpanel.barcodepri...
[ "0.71831334", "0.6893425", "0.6861322", "0.6806958", "0.66168046", "0.5942865", "0.58492553", "0.5799926", "0.5795318", "0.5761517", "0.5689129", "0.5671279", "0.56692886", "0.56692886", "0.56692886", "0.56692886", "0.56692886", "0.5637845", "0.5613805", "0.5613805", "0.56138...
0.6455089
5
Area of a polygon poly
def area(poly): if len(poly) < 3: # not a plane - no area return 0 total = [0, 0, 0] num = len(poly) for i in range(num): vi1 = poly[i] vi2 = poly[(i+1) % num] prod = np.cross(vi1, vi2) total[0] += prod[0] total[1] += prod[1] total[2] += prod[2] ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def polygon_area_2d(polygon):\r\n return geometry.gmPolygonArea(polygon)", "def area(self):\n if len(self.exterior) < 3:\n raise Exception(\"Cannot compute the polygon's area because it contains less than three points.\")\n poly = self.to_shapely_polygon()\n return poly.area", ...
[ "0.8176059", "0.8084898", "0.79985636", "0.79627657", "0.7924583", "0.77745014", "0.7765651", "0.76911414", "0.7609196", "0.7605955", "0.75849307", "0.75703204", "0.7535243", "0.7532483", "0.74723613", "0.7454908", "0.72762483", "0.72718465", "0.71883357", "0.71582144", "0.71...
0.7998656
2
Distance between two points
def dist(pnt1, pnt2): return ((pnt2[0] - pnt1[0])**2 + (pnt2[1] - pnt1[1])**2 + (pnt2[2] - pnt1[2])**2)**0.5
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def distance_between_points(p1,p2):\n return math.sqrt((p2.x-p1.x)**2+(p2.y-p1.y)**2)", "def distance(a: Point, b: Point) -> float:\n return math.sqrt(math.pow(b.x - a.x, 2) + math.pow(b.y - a.y, 2))", "def distance_between_points(a: Point, b: Point) -> float:\n return math.sqrt((a.x - b.x)**2 + (a.y ...
[ "0.841957", "0.8382808", "0.83652633", "0.8354172", "0.83238786", "0.83209145", "0.8289851", "0.82782465", "0.8273264", "0.82517046", "0.82215977", "0.8218881", "0.8194025", "0.81917197", "0.818483", "0.8160363", "0.81530356", "0.8152897", "0.8151394", "0.81368905", "0.812522...
0.78334993
60
Width of a polygon poly
def width(poly): num = len(poly) - 1 if abs(poly[num][2] - poly[0][2]) < abs(poly[1][2] - poly[0][2]): return dist(poly[num], poly[0]) elif abs(poly[num][2] - poly[0][2]) > abs(poly[1][2] - poly[0][2]): return dist(poly[1], poly[0]) else: return max(dist(poly[num], poly[0]), dist(poly[1]...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __len__(self):\n return self.num_polygons", "def num_polygons(self):\n return len(self)", "def num_polygons(self):\n return len(self.polygons)", "def len_func(polygon):\n ret=[]\n N=len(polygon)\n for i in range(1,N):\n l = ((polygon[i][0]-polygon[i-1][0])**2 + (poly...
[ "0.68147415", "0.6705667", "0.65332896", "0.6351619", "0.63019216", "0.6257846", "0.61552984", "0.6153618", "0.60628796", "0.6051711", "0.603064", "0.60230815", "0.6012505", "0.6008799", "0.59972996", "0.5995753", "0.59954226", "0.59690064", "0.59478503", "0.5926503", "0.5924...
0.7536278
0
Height of a polygon poly
def height(poly): num = len(poly) - 1 if abs(poly[num][2] - poly[0][2]) > abs(poly[1][2] - poly[0][2]): return dist(poly[num], poly[0]) elif abs(poly[num][2] - poly[0][2]) < abs(poly[1][2] - poly[0][2]): return dist(poly[1], poly[0]) else: return min(dist(poly[num], poly[0]), dis...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def Polygon(self, polyline = False):\n\n from geographiclib.polygonarea import PolygonArea\n return PolygonArea(self, polyline)", "def polygon_area_2d(polygon):\r\n return geometry.gmPolygonArea(polygon)", "def poly_area(x, y):\n return 0.5*np.abs(np.dot(x, np.roll(y, 1)) - np.dot(y, np.roll(x, 1))...
[ "0.64510256", "0.6448989", "0.6441176", "0.64108616", "0.6361811", "0.6329238", "0.6241954", "0.6227364", "0.620318", "0.620318", "0.620318", "0.6202425", "0.6144523", "0.6131131", "0.6120363", "0.611363", "0.61113554", "0.6106708", "0.608711", "0.6059044", "0.6043531", "0....
0.7813246
0
angle between two vectors
def angle2vecs(vec1, vec2): # vector a * vector b = |a|*|b|* cos(angle between vector a and vector b) dot = np.dot(vec1, vec2) vec1_modulus = np.sqrt((vec1*vec1).sum()) vec2_modulus = np.sqrt((vec2*vec2).sum()) if (vec1_modulus * vec2_modulus) == 0: cos_angle = 1 else: cos_angle = dot / ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def angle_between_vectors(vec1, vec2):\n vec = vec1 - vec2\n vec = vec.perpendicular()\n return vec.angle", "def angle_between_vectors(a, b):\n return math.acos(dot_product(a, b) / (length(a) * length(b)))", "def angle(self, v1, v2):\r\n cosang = np.dot(v1, v2)\r\n sinang = np.linalg.norm(np....
[ "0.84592617", "0.84236324", "0.83897805", "0.8326814", "0.8277874", "0.8245459", "0.8241406", "0.820084", "0.81672144", "0.8166044", "0.81622165", "0.81075567", "0.8105445", "0.8104914", "0.80800194", "0.80662596", "0.8058659", "0.80336326", "0.7994595", "0.7901276", "0.78357...
0.70841473
82
Azimuth of a polygon poly
def azimuth(poly): num = len(poly) - 1 vec = unit_normal(poly[0], poly[1], poly[num]) vec_azi = np.array([vec[0], vec[1], 0]) vec_n = np.array([0, 1, 0]) # update by Santosh # angle2vecs gives the smallest angle between the vectors # so for a west wall angle2vecs will give 90 # the follo...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def azimuth(source):\n srcAzEl = subarrayControl.s.azel(source, 0.0);\n return srcAzEl[0];", "def angle(z):", "def azimuth(self, right: GeoSpatialValue) -> ir.FloatingValue:\n return ops.GeoAzimuth(self, right).to_expr()", "def getAzimuthAngle(self):\n return self._azimuth", "def rotate...
[ "0.69212717", "0.67152286", "0.63933504", "0.63435346", "0.6254391", "0.6190008", "0.6166699", "0.6163107", "0.6146497", "0.6090305", "0.6045728", "0.6021643", "0.6016496", "0.60013217", "0.59866697", "0.5938686", "0.5927132", "0.5919588", "0.59076864", "0.588229", "0.5877527...
0.8477191
0
Tilt of a polygon poly
def tilt(poly): num = len(poly) - 1 vec = unit_normal(poly[0], poly[1], poly[num]) vec_alt = np.array([vec[0], vec[1], vec[2]]) vec_z = np.array([0, 0, 1]) # return (90 - angle2vecs(vec_alt, vec_z)) # update by Santosh return angle2vecs(vec_alt, vec_z)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _polytrafo(self, poly):\n screen = self.screen\n p0, p1 = self._position\n e0, e1 = self._orient\n e = TwoDV(e0, e1 * screen.yscale / screen.xscale)\n e0, e1 = (1.0 / abs(e)) * e\n return [(p0+(e1*x+e0*y)/screen.xscale, p1+(-e0*x+e1*y)/screen.yscale)\n ...
[ "0.6105743", "0.6094133", "0.5665677", "0.5616978", "0.5580373", "0.5561968", "0.55513394", "0.55378795", "0.55378795", "0.55133283", "0.55017954", "0.5490799", "0.544814", "0.5424581", "0.5410461", "0.5324208", "0.5308822", "0.52776206", "0.5267671", "0.52197415", "0.5180232...
0.8311091
0
Assigns a gene for a given peak.
def find_nearby_genes(sub, apeak): cutoff = 1e3 genes_for_peak = [] for index, _gene in sub.iterrows(): dist = get_distance_pandas(_gene, apeak) if abs(dist) < cutoff: genes_for_peak.append(_gene) return genes_for_peak
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def foundPeak(self, peak):\n\n self.sequence.append({\"type\": \"foundPeak\", \"coord\": peak})", "def set_peak(self, p):\n self.peak = p", "def gene(self, idx, value):\r\n self.genes[idx] = value", "def enhancer2gene(\n self,\n peak_pr,\n up=100_000,\n down=1...
[ "0.6406406", "0.6169182", "0.613669", "0.58371097", "0.5819503", "0.5577512", "0.5470518", "0.5470518", "0.5387038", "0.53410774", "0.52720046", "0.5209197", "0.5205845", "0.5182566", "0.51800483", "0.51736057", "0.51590776", "0.5146738", "0.51320565", "0.5120706", "0.5091318...
0.51220167
20
Used to assign peaks to a gene.
def get_distance_pandas(_gene, apeak): if _gene['4'] < apeak.left: return apeak.left - _gene['4'] if apeak.right < _gene['3']: return apeak.right - _gene['3'] return 0
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def changePeaks(self):\n # Change the number of peaks\n if self.minpeaks is not None and self.maxpeaks is not None:\n npeaks = len(self.peaks_function)\n u = self.random.random()\n r = self.maxpeaks - self.minpeaks\n if u < 0.5:\n # Remove n ...
[ "0.634735", "0.5884969", "0.57254374", "0.5585625", "0.5579753", "0.5574772", "0.5571308", "0.5567891", "0.55631214", "0.5559916", "0.5523439", "0.5504175", "0.5402741", "0.5395929", "0.53901654", "0.53751945", "0.53663176", "0.5364793", "0.5325325", "0.53220135", "0.5299285"...
0.0
-1
Topdown implementation (recursive) with memoization, O(n^2)
def fibonacci_recursive_memo(n, fib_cache={0: 0, 1: 1}): if n < 0: return -1 if n not in fib_cache: fib_cache[n] = fibonacci_recursive_memo(n-1) + fibonacci_recursive_memo(n-2) return fib_cache[n]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def cutRodTopDownDP(p, n):\n memo = defaultdict(int)\n if memo[n] != 0:\n return memo[n]\n max_val = 0\n for i in range(n):\n max_val = max(max_val, p[i] + cutRodTopDownDP(p, n - i - 1))\n memo[n] = max_val\n return max_val", "def eval_top_down(\n root: Node,\n x: np.ndarray...
[ "0.6389189", "0.6188357", "0.6170089", "0.5925446", "0.5868108", "0.58175796", "0.5803511", "0.57431", "0.5730523", "0.5718951", "0.5704664", "0.56604576", "0.56545967", "0.5652128", "0.5611529", "0.55930775", "0.55716413", "0.55463", "0.55236363", "0.5507094", "0.5484492", ...
0.5515608
19
Topdown implementation (recursive) with tailcall optimization (TCO), O(n)
def fibonacci_recursive_tco(n, next_fib=1, summation=0): if n == 0: return summation else: # summation will be the "next fib" passed in parameter that is the current fib of this call # but the next fib needs to be recalcuated as current_sum + next_fib return fibonacci_recursive...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def eval_top_down(\n root: Node,\n x: np.ndarray,\n lls: np.ndarray,\n leaf_func: Callable[[Leaf, np.ndarray, Any], np.ndarray],\n sum_func: Callable[[Sum, np.ndarray, Any], np.ndarray],\n leaf_func_kwargs: Optional[dict] = None,\n sum_func_kwargs: Optional[dict] = None,\n inplace: bool = F...
[ "0.65728784", "0.5981095", "0.5971745", "0.58997697", "0.57972914", "0.57475346", "0.57302785", "0.5725519", "0.5719084", "0.5686013", "0.5665979", "0.56580096", "0.56020415", "0.56020415", "0.56020415", "0.5577206", "0.557683", "0.5572332", "0.55414414", "0.55342", "0.553138...
0.0
-1
Bottom up implementation (iterative) with memoization, O(n^2)
def fibonacci_iterative_memo(n, fib_cache={0: 0, 1: 1}): for i in range(2, n+1): fib_cache[i] = fib_cache[i-1] + fib_cache[i-2] return fib_cache[n]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def fib_bottom_up(n):\n _memo = [1] * n # init array\n fib = 1\n for arr_inx in range(0, n):\n if arr_inx <= 1:\n fib = 1\n else:\n fib = _memo[arr_inx - 1] + _memo[arr_inx - 2]\n _memo[arr_inx] = fib\n return fib", "def pruned_bottom_up_mem_fib(self, n:int...
[ "0.68724227", "0.6511313", "0.65096575", "0.60984844", "0.5971771", "0.5946645", "0.59345984", "0.5700684", "0.5698619", "0.5680422", "0.5670944", "0.5654734", "0.5629703", "0.5619126", "0.5580586", "0.55740476", "0.55663407", "0.55651325", "0.5557866", "0.55522186", "0.55261...
0.5546657
20
Given a string file name, returns a GEOSGeometry. The file may contain WKB, WKT, or HEX.
def fromfile(file_h): # If given a file name, get a real handle. if isinstance(file_h, str): with open(file_h, "rb") as file_h: buf = file_h.read() else: buf = file_h.read() # If we get WKB need to wrap in memoryview(), so run through regexes. if isinstance(buf, bytes): ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def wkt_from_name(name):\n # pylint: disable=invalid-name\n # dx and dy seems quite sensible here...\n\n extent = extent_from_name(name)\n\n wkt = \"POLYGON((\"\n for dx, dy in ((0, 0), (0, 1), (1, 1), (1, 0)):\n wkt += \"{0:.2f} {1:.2f},\".format(extent[2 * dx], extent[2 * dy + 1])\n wkt ...
[ "0.5880633", "0.58688223", "0.57560325", "0.5682774", "0.5552744", "0.5550235", "0.55321383", "0.5512911", "0.5483073", "0.5470537", "0.54570055", "0.54453206", "0.54344195", "0.5378245", "0.5373517", "0.52962524", "0.5283799", "0.52837443", "0.5276429", "0.5274386", "0.52588...
0.7913839
0
Transformation matrix from rotation matrix and translation vector.
def transform_from_rot_trans(r, t): r = r.reshape(3, 3) t = t.reshape(3, 1) return np.vstack((np.hstack([r, t]), [0, 0, 0, 1]))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def transformation_matrix(self):\n t = np.array([[0.0], [0.0], [0.0]])\n Rt = np.hstack([self.rotation_matrix, t])\n return np.vstack([Rt, np.array([0.0, 0.0, 0.0, 1.0])])", "def rotation_to_transformation_matrix(R):\n R = Matrix(R)\n T = R.col_insert(3, Matrix([0., 0., 0.]))\n T = ...
[ "0.79309523", "0.75719136", "0.73282856", "0.7112825", "0.7076982", "0.70006925", "0.6996054", "0.6989444", "0.69222313", "0.6920505", "0.6899384", "0.6864149", "0.6864149", "0.6862257", "0.68577725", "0.68504566", "0.683982", "0.68377185", "0.683515", "0.6823503", "0.6820043...
0.64948016
48
Inverse of a rigid body transformation matrix
def inv(transform_matrix): r = transform_matrix[0:3, 0:3] t = transform_matrix[0:3, 3] t_inv = -1 * r.T.dot(t) transform_inv = np.eye(4) transform_inv[0:3, 0:3] = r.T transform_inv[0:3, 3] = t_inv return transform_inv
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def inverse(self):\n rotation_matrix = self.pose_mat[:3, :3]\n translation_vector = self.pose_mat[:3, 3]\n\n rot = np.transpose(rotation_matrix)\n trans = - np.matmul(np.transpose(rotation_matrix), translation_vector)\n return Transformation(rot, trans)", "def inverse_rigid_tra...
[ "0.79541564", "0.7733541", "0.7508078", "0.74408716", "0.739178", "0.7355747", "0.7313372", "0.7290814", "0.7257892", "0.7251126", "0.722694", "0.72111636", "0.71910274", "0.7151473", "0.71443874", "0.71253616", "0.7078454", "0.7075812", "0.7060877", "0.701706", "0.6999917", ...
0.81014514
0
Rotation about the xaxis.
def rotx(t): c = np.cos(t) s = np.sin(t) return np.array([[1, 0, 0], [0, c, -s], [0, s, c]])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def rot_x_deg(self):\n # TODO describe which axis this is\n return math.degrees(self._rot_x_rad)", "def rotate_axis(self):\n try:\n self.obj.rotate(angle=self.rotation_speed * self.time_scale / self.refresh_rate, axis=vector(0, 1, 0))\n except ZeroDivisionError:\n ...
[ "0.7218864", "0.68793076", "0.6857295", "0.667418", "0.6583413", "0.6519651", "0.64925677", "0.64793175", "0.64793175", "0.64473987", "0.6429963", "0.640432", "0.6374139", "0.6371993", "0.6352068", "0.6301011", "0.62872976", "0.6242082", "0.6207448", "0.6204033", "0.6160251",...
0.0
-1
Rotation about the yaxis.
def roty(t): c = np.cos(t) s = np.sin(t) return np.array([[c, 0, s], [0, 1, 0], [-s, 0, c]])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def rot_y_deg(self):\n # TODO describe which axis this is\n return math.degrees(self._rot_y_rad)", "def rot_y_rad(self):\n return self._rot_y_rad", "def rotation_center_y(self, *args, **kwargs) -> Any:\n pass", "def rotate_y(self, angle):\n angle *= np.pi / 180\n ret...
[ "0.75396633", "0.7354722", "0.7102622", "0.7064357", "0.7036538", "0.6986756", "0.6895528", "0.6895528", "0.68484044", "0.68028474", "0.6717387", "0.66640604", "0.66279566", "0.6614649", "0.658053", "0.6575346", "0.6554816", "0.6505504", "0.63935125", "0.6393029", "0.63855916...
0.0
-1
Rotation about the zaxis.
def rotz(t): c = np.cos(t) s = np.sin(t) return np.array([[c, -s, 0], [s, c, 0], [0, 0, 1]])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def rotateZ(self, *args, **kwargs):\n ...", "def rotateZ(self, ang):\n if ang != 0.0:\n x = self.getX() * cos(ang) - self.getY() * sin(ang)\n y = self.getX() * sin(ang) + self.getY() * cos(ang)\n z = self.getZ()\n self.setX(x)\n self.setY(y)\n ...
[ "0.7897823", "0.77170277", "0.76023036", "0.74918896", "0.7462402", "0.7455315", "0.7455315", "0.7455315", "0.7455315", "0.7423235", "0.73880225", "0.7143401", "0.71195567", "0.7078475", "0.7062784", "0.7053645", "0.7050453", "0.70113736", "0.6982634", "0.69545245", "0.691616...
0.6847939
26
Normalizes angles to range (pi, pi]
def normalize_angles(angles): return np.where(angles > np.pi, angles - 2 * np.pi, angles)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def normalize(angle):\n while angle > math.pi:\n angle -= 2 * math.pi\n while angle < -math.pi:\n angle += 2 * math.pi\n return angle", "def normalize_angle(angle):\n while angle > np.pi:\n angle -= 2.0 * np.pi\n\n while angle < -np.pi:\n angle += 2.0 * np.pi\n\n ret...
[ "0.82107466", "0.78335065", "0.7761805", "0.7758879", "0.7487792", "0.74496317", "0.7405513", "0.73911864", "0.7165736", "0.7122347", "0.6778681", "0.667193", "0.667193", "0.65800714", "0.65800714", "0.6326302", "0.6308028", "0.6304546", "0.6274721", "0.6235669", "0.62234896"...
0.792359
1
Service for receive all services by query and filter terms
def search_by_services(request: HttpRequest) -> QuerySet: services = ServiceDocument.search() query: str = request.GET.get("query") if (query is not None) and (query != ""): services = services.query( MultiMatch( query=query, fields=[ ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def search_service(self, name_filter):\n rs=search_service(name_filter)\n for el in rs:\n print(el)", "def search_services(query, services, quiet):\n cards = set()\n for svc in services:\n if (svc.uses_feature(query) or svc.uses_database(query) or \n query.upper()...
[ "0.70480216", "0.63333386", "0.6167937", "0.61411226", "0.60310453", "0.5999254", "0.59747785", "0.59572905", "0.5944522", "0.5905627", "0.59010917", "0.58880043", "0.5830411", "0.5817713", "0.5755317", "0.5748787", "0.57427716", "0.5718064", "0.5671999", "0.56606174", "0.564...
0.6380323
1
Service for receive all services by 'company_id'
def get_services_by_company(company_id: int) -> QuerySet: return ServiceDocument.search().filter("term", **{"company.id": company_id}).to_queryset()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_services(request):\n try:\n company = Company.objects.get(pk=int(request.POST['company_id']))\n\n services = []\n for service in company.services.all():\n services.append({'name': service.name, 'id': service.pk})\n\n return format_ajax_response(True, \"Company's se...
[ "0.68197775", "0.6054475", "0.5878516", "0.5709679", "0.5681982", "0.56394225", "0.5625392", "0.5607893", "0.5546622", "0.55426055", "0.55327594", "0.55286586", "0.5522124", "0.5517146", "0.54952776", "0.54513615", "0.5435713", "0.5375413", "0.53753597", "0.5351074", "0.53225...
0.70713174
0
Creates the objects for each element in the array.
def create_array(self, sq_size: int, name_size=1, **kwargs): self.create_array_args = kwargs self.sq_size = sq_size for val in self.array: element = Tex( # None in the val for an empty box "" if val is None else f"{val}", **kwargs.pop(...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def make_objects(self):\n pass", "def create_multiple(cls, count=2, attrs=None):\n objects = []\n for i in range(0, count):\n objects.append(\n cls.create_one(attrs))\n\n return objects", "def __init__(self):\n self.arr = []\n for i in range(8...
[ "0.6336729", "0.62277186", "0.6206452", "0.6183544", "0.6153247", "0.59144723", "0.58659154", "0.5851647", "0.58271873", "0.5779485", "0.5758501", "0.57446486", "0.57109874", "0.5703261", "0.56934536", "0.56899333", "0.5642637", "0.5624687", "0.56237084", "0.55761445", "0.557...
0.0
-1
Draws the name of the array and each element in order.
def draw_array(self): # Here we are just giving the square animation, because the element itself # is inside the square object, so it would be rendered as well. all_anims = [Write(self.array_name)] all_anims.extend(list( DrawBorderThenFill(square) for square in se...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def print_array(self):\n for item in self.items:\n print(item)", "def display(self, colorArray):\n pass", "def draw_current_arr(arr):\n\tfor y, y_value in enumerate(arr):\n\t\tfor x, x_value in enumerate(y_value):\n\t\t\ttry:\n\t\t\t\tstdscr.addstr(y,x,get_char_to_display(x_value))\n\t...
[ "0.6091458", "0.5985962", "0.59669137", "0.59239256", "0.58985287", "0.5889762", "0.58083993", "0.5789004", "0.5784297", "0.57831866", "0.5769953", "0.5761865", "0.5727569", "0.5713339", "0.5692382", "0.5647653", "0.5644566", "0.56420016", "0.5609872", "0.5606037", "0.5578921...
0.56009406
20
Animation when poping an element from the array
def pop(self, index: int): # Fade out the element with the given index yield FadeOut(self.squares[index], shift = DOWN) yield FadeOut(self.elements[index], shift = DOWN) target = self.copy() square = target.squares[index] element = target.elements[index] #...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def pop(self):\n return _osgAnimation.vectorVec3Keyframe_pop(self)", "def pop(self):\n return _osgAnimation.vectorFloatKeyframe_pop(self)", "def pop(self):", "def pop(self):", "def pop(self):\n return _osgAnimation.vectorVec2Keyframe_pop(self)", "def pop(self):\n return _osgAn...
[ "0.6876837", "0.67884195", "0.6777783", "0.6777783", "0.6764361", "0.67498535", "0.6740274", "0.65919226", "0.6571009", "0.64348066", "0.6404489", "0.6344472", "0.62607974", "0.62312394", "0.6215146", "0.6215146", "0.6179458", "0.6164594", "0.60163265", "0.6004232", "0.598943...
0.6652108
7
Get the square object of an element with a given index
def get_square(self, index: int): return self.squares[index]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index_to_square(self, this_index: int) -> Square:\n return self.squares[this_index]", "def get_square(self, index):\n square = []\n for cell in self.squares[index]:\n square.append(self.content[cell[0]][cell[1]])\n return square", "def get_piece(self, index):\n ...
[ "0.7783794", "0.7574147", "0.7490045", "0.6879599", "0.68765074", "0.66710305", "0.6571323", "0.6502549", "0.64770836", "0.6469187", "0.64556384", "0.6454425", "0.6431943", "0.6410768", "0.63751596", "0.6372836", "0.6367385", "0.63667256", "0.6324043", "0.6324043", "0.6264738...
0.8120114
0
Uses the Indicate animation on the element with the given index
def indicate_at(self, index: int): yield Indicate(self.squares[index]) yield Indicate(self.elements[index])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def goto(self, index):\n raise NotImplementedError", "def _setindicator(self, index: int, value: bool) -> None:\n bitmask = 1 << (index + 1)\n current = self._get_buffer(0x04)\n if value:\n self._set_buffer(0x04, current | bitmask)\n else:\n self._set_buff...
[ "0.5829001", "0.5646467", "0.55608237", "0.55268955", "0.5514385", "0.53834915", "0.53558207", "0.53181905", "0.5281783", "0.52426845", "0.52378094", "0.52378094", "0.5219193", "0.521198", "0.520505", "0.52014065", "0.52014065", "0.52014065", "0.52014065", "0.52014065", "0.52...
0.6828146
0
Changest the value at a given index
def at(self, index, value): ### TODO: Fix this function ### Right now, we don't change the square ### Also, the MoveToTarget animation is not smooth element = Tex( # None in the val for an empty box "" if value is None else f"{value}", ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def replace(self, index, value):\n index += self.n\n self.data[index] = value\n index //= 2\n while index > 0:\n self.data[index] = self.func(self.data[2*index], self.data[2*index+1])\n index //= 2", "def _update_value_at(self, index, value):\n node = self...
[ "0.7773264", "0.7487187", "0.73646826", "0.73443377", "0.7125019", "0.7073037", "0.7036191", "0.6986188", "0.69861186", "0.6968446", "0.6960285", "0.69150853", "0.69011384", "0.6896647", "0.6895615", "0.68909293", "0.6880462", "0.68399477", "0.68155974", "0.6810109", "0.67862...
0.0
-1
Kill all the processes with name procname. This will retry a force kill only 3 times, then raise an error.
def kill_all(self, procname): procs = self.find_processes_by_name(procname) for proc in procs: result = self.kill_process(proc['PID']) if not result['HasExited']: for i in xrange(3): result = self.kill_process(result['PID'], False) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def kill_all(name, sig=signal.SIGKILL):\n sig = int(sig)\n for proc in psutil.process_iter():\n if proc.name() == name:\n kill(proc.pid, sig)", "def kill_proc_exact(proc_name, sleep_sec = 1, max_retry = 60):\n retry = 0\n # cannot write while (pids = get_pids_exact('SomeComp')):\n ...
[ "0.697361", "0.6668535", "0.6649769", "0.6480402", "0.64701116", "0.64429003", "0.6377969", "0.6372999", "0.635451", "0.613779", "0.61359096", "0.61002", "0.6065713", "0.60357076", "0.59754187", "0.5965336", "0.5945242", "0.59307563", "0.5927764", "0.5910593", "0.590144", "...
0.799322
0
Check slick to see if the machine has checked in within the last 5 minutes, or a test is running and hasn't been running longer than 15 minutes.
def check_slick_status(self): retval = [] slick = SlickAsPy(self.environment.slickurl + "/api") status = slick.get_host_status(self.name) if status['currentWork'] is None: seconds_since_last_checkin = (int(time.time() * 1000) - status['lastCheckin']) if seconds_si...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def validity_by_time(self):\n conn = psycopg2.connect(self.conn)\n permissable_maximum_age_secs = 600 # 600s = 10mins\n query = \"SELECT time FROM steve_sense_sensor_logs ORDER BY time DESC LIMIT 1\"\n cur = conn.cursor()\n cur.execute(query)\n queryResult = cur.fetchall(...
[ "0.640579", "0.62193877", "0.61880183", "0.6180127", "0.6169411", "0.6165985", "0.6155081", "0.60744435", "0.6060624", "0.60000306", "0.59496486", "0.5945319", "0.59210914", "0.59103745", "0.5906849", "0.5880232", "0.58610344", "0.5852131", "0.5806795", "0.57876277", "0.57682...
0.67236435
0
Check the number of Java processes on the system, there should be between 1 and 2 processes, no more, no less.
def check_java_processes(self): mm = MicroManager(self.hostname) java_processes = mm.find_processes_by_name("java") if len(java_processes) > 2 or len(java_processes) == 0: return [CheckStatus(self, CheckStatus.CHECK_JAVA_PROCESS_COUNT, CheckStatus.STATUS_FAIL, "There are {} java proc...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def numRunningProcesses():\n try:\n proc = subprocess.run(\"ps -Af|grep -i \\\"online2-wav-nnet3-latgen-faster\\\"\", stdout=subprocess.PIPE, shell=True)\n np = (len(str(proc.stdout).split(\"\\\\n\")) - 3)\n if(np == None):\n np = 0\n return np\n ...
[ "0.7517433", "0.74348897", "0.7338294", "0.6797079", "0.6794298", "0.65937567", "0.6514027", "0.6462502", "0.63693064", "0.6346972", "0.623888", "0.62370515", "0.6220103", "0.62100905", "0.6143908", "0.612437", "0.6122264", "0.61174494", "0.60940665", "0.60611886", "0.6054894...
0.75797725
0
Check the number of firefox processes on the system, there should be no more than 2 processes
def check_firefox_processes(self): mm = MicroManager(self.hostname) ff_procs = mm.find_processes_by_name("firefox") if len(ff_procs) > 2: return [CheckStatus(self, CheckStatus.CHECK_FIREFOX_PROCESS_COUNT, CheckStatus.STATUS_FAIL, "There are {} firefox processes running".format(len(ff...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def num_processes():\n return 1", "def numRunningProcesses():\n try:\n proc = subprocess.run(\"ps -Af|grep -i \\\"online2-wav-nnet3-latgen-faster\\\"\", stdout=subprocess.PIPE, shell=True)\n np = (len(str(proc.stdout).split(\"\\\\n\")) - 3)\n if(np == None):\n ...
[ "0.6860843", "0.6696315", "0.66218126", "0.61195207", "0.5982056", "0.59425974", "0.59278584", "0.5919861", "0.589109", "0.58585715", "0.58466226", "0.58308715", "0.5763", "0.5734881", "0.5694029", "0.5693691", "0.56655437", "0.5631494", "0.5607702", "0.5602766", "0.5593688",...
0.8056204
0
Check to be sure that there is at least 350Mb of disk space left, we need room to run our tests.
def check_disk_space(self): mm = MicroManager(self.hostname) drives = mm.get_disks() env = mm.get_env() for drive in drives: if drive['Name'].startswith(env['HOMEDRIVE']): if drive['TotalFreeSpace'] >= 367001600: return [CheckStatus(self, C...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_check_disk_space_sufficient(self):\n self.assertTrue(self.command.check_disk_space(1, self.temp_dir))\n self.assertTrue(self.command.check_disk_space(\n 1, self.temp_dir,\n label=\"Hello\", context=\"Contextual detail\", die=True))", "def check_disk_size(self):\n ...
[ "0.7813345", "0.7468887", "0.730767", "0.7239089", "0.72337455", "0.72001356", "0.71956813", "0.71462756", "0.7059091", "0.7049404", "0.6986833", "0.69084734", "0.689086", "0.6876069", "0.68404686", "0.6832333", "0.6774323", "0.6716277", "0.6632967", "0.65967757", "0.64542645...
0.7459136
2
Perform all the checks, and return a list of CheckStatus objects.
def perform_checks(self): retval = [] retval.extend(self.check_slick_status()) retval.extend(self.check_java_processes()) retval.extend(self.check_firefox_processes()) retval.extend(self.check_disk_space()) return retval
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check_all(self):\n # TODO: this should use functions in execute.py to run tests in-sequence so that variable\n # name collisions are accounted for\n self._log_event(EventType.BEGIN_CHECK_ALL)\n\n # TODO: this is a janky way of resolving where the tests are. Formalize a method of \n ...
[ "0.6877594", "0.68167466", "0.68158245", "0.67767256", "0.66387045", "0.656846", "0.6478773", "0.64131", "0.6407496", "0.63992935", "0.6368768", "0.63681614", "0.63422847", "0.6275114", "0.62562287", "0.62423486", "0.62188816", "0.61790764", "0.61763656", "0.6121809", "0.6118...
0.78020614
0
Cancel any work that the machine currently has.
def cancel_work(self, message="This test was cancelled by lifeguard script because the test was interrupting progress (taking too long)."): slick = SlickAsPy(self.environment.slickurl + "/api") status = slick.get_host_status(self.name) if status['currentWork'] is not None: slick.canc...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def cancel_workers(self):\n pass", "def cancel():", "def cancel(self):\n pass", "def cancel_all():\n\twhile _running:\n\t\t_running[0].cancel(noerror=True)", "def cancel(self):", "def cancel(self):", "def cancel(self):", "def cancel(self):\n import googleapiclient\n\n # pr...
[ "0.78445923", "0.74792403", "0.7339491", "0.72932935", "0.72022593", "0.72022593", "0.72022593", "0.7173652", "0.71374893", "0.7050638", "0.70079833", "0.70079833", "0.6903771", "0.68863714", "0.6874811", "0.6874775", "0.68554676", "0.68274283", "0.68099236", "0.6808236", "0....
0.65988195
33
Take a failed check and turn it into an alert.
def to_alert(self): alert = Alert() alert.issued = datetime.datetime.today() alert.alert_type = self.check alert.machine = self.machine alert.alert_message = self.detail return alert
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def on_fail(utterance):\n\n self.log.info(\"Utterance: {}\".format(utterance))\n\n user_response = self.ask_yesno('try.again')\n\n return 'try.again' if user_response is None else 'okay'", "def alert(self, msg):\n raise DatacheckException(msg)", "def indicate_failure(sel...
[ "0.66949", "0.6577023", "0.6243745", "0.62430185", "0.61010504", "0.6072935", "0.6032492", "0.6010896", "0.58796185", "0.5734031", "0.57223713", "0.5713477", "0.57085025", "0.5695824", "0.5687353", "0.5680258", "0.5673685", "0.56719327", "0.5668308", "0.5649784", "0.56250095"...
0.0
-1
This is used for map like functionality, basically it just uses the objects check method, returning a tuple of the object, then the result.
def check(machine): retval = (machine, ()) try: retval = (machine, machine.perform_checks()) except: pass return retval
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _check_tuple(self) -> PossibleResult[T]:\n if isinstance(self.constructor_origin, type) and issubclass(\n self.constructor_origin, tuple\n ):\n if not isinstance(self.obj, Sequence):\n raise DeserializeError(\n tuple, self.obj, self.new_dept...
[ "0.6146529", "0.6048498", "0.5992099", "0.57903236", "0.56535566", "0.55855703", "0.5577306", "0.5516341", "0.55045426", "0.5489925", "0.5475766", "0.544557", "0.543417", "0.53162634", "0.5304833", "0.5166525", "0.5096952", "0.50907046", "0.5086699", "0.50526094", "0.50500506...
0.55164146
7
Create a new database on a machine. By consequence, if one already exists this method will wipe it out.
def init_new_db(args): Base.metadata.drop_all(engine) Base.metadata.create_all(engine) session = Session() session.add(Environment(name='normal', slickurl='http://slicker.homestead-corp.com/slickij', buildurl='?', filename='hs-tcrunij.tar.gz', tcrunijsubdir='hs-tcrunij/tcrunij')) session.add(Environ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def createDb():\n db.drop_all()\n db.create_all()", "def recreate_db():\n drop_db()\n create_db()", "def create_db():\n from sqlalchemy_utils import database_exists, create_database, drop_database\n if not database_exists(DB_URL):\n print('Creating database.')\n create_database(...
[ "0.75636977", "0.7482831", "0.7456384", "0.7366731", "0.73028386", "0.7273057", "0.7262072", "0.7261244", "0.7261244", "0.7261244", "0.7261244", "0.7261244", "0.7261244", "0.7261244", "0.7261244", "0.7261244", "0.7261244", "0.7261244", "0.72545034", "0.7241369", "0.71953213",...
0.6491098
74
Add a machine to the pool.
def add_machine(args): session = Session() # the following is used to help with code completion env = Environment(name=args.environment) try: env = session.query(Environment).filter_by(name=args.environment).one() except NoResultFound: print "ERROR: couldn't find environment %s" % ar...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add(self, state_machine):\n\n self.branches.append(state_machine)", "def add_node(self, node):\n self._execution_pool[node.name] = node", "def registerMachine(self, machine):\n if machine in self._machines:\n raise InternalError('Tried to register the same machine twice.')\n...
[ "0.6762968", "0.6668793", "0.6626094", "0.6274972", "0.6223476", "0.6197799", "0.60343325", "0.60025644", "0.5978364", "0.59555566", "0.59127223", "0.58675367", "0.57886165", "0.5784845", "0.5773123", "0.5673353", "0.56728184", "0.5591365", "0.5559377", "0.55235225", "0.55198...
0.80690163
0
Delete a machine from the pool.
def delete_machine(args): session = Session() # the following is used to help with code completion """session.query(PoolMachine).filter(PoolMachine.hostname==args.hostname).delete() session.commit()""" machine = session.query(PoolMachine).filter(PoolMachine.hostname==args.hostname).first() if ma...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delete_machine(self, machine: Union[dto.Machine, str]) -> Optional[dto.Machine]:\n raise errors.UnsupportedOperationError(\n \"Operation not supported for provider '{}'\".format(self.provider_name)\n )", "def delete(self):\n self._lbcall('delete_pool', [self._name])", "def d...
[ "0.71741533", "0.7094532", "0.70258623", "0.7022035", "0.6978453", "0.6692837", "0.65674025", "0.642669", "0.6388736", "0.6350895", "0.63419116", "0.6293149", "0.61799306", "0.616029", "0.6100058", "0.60785466", "0.5992967", "0.5984518", "0.5962041", "0.5952203", "0.59218055"...
0.7769189
0
Print a list of matching machines.
def list_machines(args): session = Session() finder = MachineFinder(args.finder) machines = finder.find_machines(session) print "Machines Found: %d" % (len(machines)) if len(machines) > 0: print print PoolMachine.summary_header() print "-" * 80 for machine in machines...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def list_machines(self, kwargs):\n verbose = kwargs.get(\"verbose\", False)\n\n if verbose:\n attributes = self.engine.all_attributes()\n else:\n attributes = [\"sAMAccountName\", \"objectClass\"]\n\n self.display(self.engine.query(self.engine.COMPUTERS_FILTER(), a...
[ "0.6418596", "0.6321741", "0.6265558", "0.6172058", "0.5926297", "0.5901305", "0.5866562", "0.5837731", "0.5819768", "0.5814439", "0.5805708", "0.5780469", "0.57511306", "0.56883985", "0.5610489", "0.5606815", "0.5598891", "0.55752176", "0.55503803", "0.551069", "0.5491412", ...
0.73563796
0
Check all the machines found via the finder argument, and print the check status results
def check_machines(args): session = Session() finder = MachineFinder(args.finder) machines = finder.find_machines(session) print "Machines Found: %d" % (len(machines)) if len(machines) > 0: if len(machines) > 1: print print CheckStatus.summary_header() pri...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def list_machines(args):\n session = Session()\n finder = MachineFinder(args.finder)\n machines = finder.find_machines(session)\n print \"Machines Found: %d\" % (len(machines))\n if len(machines) > 0:\n print\n print PoolMachine.summary_header()\n print \"-\" * 80\n for m...
[ "0.6251463", "0.597676", "0.5934777", "0.5820399", "0.58104575", "0.57164586", "0.5683106", "0.5606381", "0.5509719", "0.54941356", "0.5492307", "0.54877716", "0.5482829", "0.5455843", "0.54474247", "0.54234844", "0.54180443", "0.5410857", "0.5409262", "0.5400827", "0.5394696...
0.75547606
0
Stop the agent on all the found machines.
def stop_machines(args): session = Session() finder = MachineFinder(args.finder) machines = finder.find_machines(session) print "Machines Found: %d" % (len(machines)) if len(machines) > 0: print print "Stopping the Agent on machines:" for machine in machines: sys....
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def stop_all_agents(self):\n for agent in self.agents:\n if agent.available:\n agent.stop_activity()", "def agents_stop(self):\n self._post('agents/stop')", "def stopall(self):\n\n for i in self.bots:\n try:\n i.stop()\n except...
[ "0.7793052", "0.75224996", "0.7430394", "0.727757", "0.7261888", "0.7251453", "0.7108424", "0.6959152", "0.69266915", "0.69007546", "0.68817854", "0.6866277", "0.68658197", "0.68089503", "0.6715153", "0.6711193", "0.6694383", "0.6690689", "0.6668919", "0.6668731", "0.656183",...
0.838057
0
Run the agent reset on all the found machines.
def reset_machines(args): session = Session() finder = MachineFinder(args.finder) machines = finder.find_machines(session) print "Machines Found: %d" % (len(machines)) if len(machines) > 0: print print "Resetting Agent on machines:" for machine in machines: sys.st...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def reset_remotes(self):\n for remote in [self._tester, self._sut]:\n remote.stop_all()\n remote.reset_stats()\n remote.set_pkt_size(self._cores, 64)\n remote.set_speed(self._cores, 100)\n remote.set_count(0, self._cores)", "def reset():\n for cpu_...
[ "0.70612276", "0.66523504", "0.66008383", "0.6591923", "0.65662456", "0.64973056", "0.64358515", "0.64142364", "0.6407646", "0.6366884", "0.63643813", "0.63616556", "0.62964606", "0.6290867", "0.6279031", "0.62712014", "0.6264439", "0.6217738", "0.6197698", "0.614631", "0.612...
0.8454917
0
Save, or rather fix, the machines found by the finder passed in. There is only one thing to do to save machines right now and that is to reset the agent and cancel the work it has in it's queue (if any). If any errors occur, the machine is taken offline.
def save_machines(args): session = Session() finder = MachineFinder(args.finder) machines = finder.find_machines(session) print "Machines Found: %d" % (len(machines)) if len(machines) > 0: print print "Saving (resetting agent and canceling work) on machines:" for machine in m...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def reset_machines(args):\n session = Session()\n finder = MachineFinder(args.finder)\n machines = finder.find_machines(session)\n print \"Machines Found: %d\" % (len(machines))\n if len(machines) > 0:\n print\n print \"Resetting Agent on machines:\"\n for machine in machines:\n...
[ "0.6425454", "0.5859536", "0.5626262", "0.53941256", "0.5224812", "0.518632", "0.5100054", "0.50766957", "0.50559926", "0.5043701", "0.503414", "0.49833614", "0.4979314", "0.49553978", "0.494617", "0.4908639", "0.4884347", "0.48611364", "0.48455393", "0.4842233", "0.4740718",...
0.8177155
0
Turn an email address into an MX hostname
def get_mx_address(email): domain = email.split('@')[1] exchanges = [] try: for x in dns.resolver.resolve(domain, 'MX'): exchanges.append(x.exchange.to_text().rstrip('.')) except dns.resolver.NoAnswer: pass if not exchanges: exchanges.append(domain) random.shu...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_domain(email_address: str) -> str:\n return email_address.lower().split(\"@\")[-1]", "def _get_domain_for_email(email):\n return email.split('@')[1]", "def email_domain(email):\n parts = email.split(\"@\")\n if len(parts) == 2:\n return parts[1]\n else:\n return None", ...
[ "0.66120696", "0.64356273", "0.6360814", "0.6318636", "0.6290948", "0.62340224", "0.6201459", "0.61259705", "0.6000315", "0.5994812", "0.59947735", "0.59929806", "0.59609914", "0.595259", "0.59250575", "0.5924723", "0.5900683", "0.58742744", "0.5874074", "0.5870373", "0.58346...
0.7534975
0
Quick shortcut to ezt with strings
def gen_from_template(template_file: str, data): tmpl = ezt.Template(template_file) fp = ezt.StringIO() tmpl.generate(fp, data) return fp.getvalue()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _(string):\n\t\treturn string", "def test_strings_with_foo(self):\n write this test!", "def t_STR_LITER(t):\n return t", "def test_string():", "def t_STRING(t):\n return t", "def test_shortcut_function(self):\n self.assertEqual(\n strutils.multi_replace(\n ...
[ "0.6211572", "0.6093715", "0.5977744", "0.59242076", "0.58953935", "0.5867142", "0.5861631", "0.5820685", "0.57678175", "0.5713716", "0.5703674", "0.564879", "0.5613308", "0.5613308", "0.55727226", "0.5556192", "0.5555791", "0.5549836", "0.5469472", "0.5466971", "0.54529387",...
0.0
-1
Middleware sets ip from remote_addr header
def test_middleware_sets_ip_from_remote_add(self): request = MockRequest('83.42.13.77') RealIPMiddleware().process_request(request) self.assertEqual(request.user_ip, request.META['REMOTE_ADDR'])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_middleware_sets_ip_from_forwarded_for(self):\n request = MockRequest('127.0.0.1', '83.42.13.77')\n RealIPMiddleware().process_request(request)\n\n self.assertEqual(request.user_ip,\n request.META['HTTP_X_FORWARDED_FOR'])", "def get_remote_ip(request):\n re...
[ "0.69636965", "0.6921711", "0.6907559", "0.6741216", "0.666704", "0.6645019", "0.6558895", "0.65404505", "0.6522399", "0.64468545", "0.6438712", "0.6344952", "0.6330556", "0.6325113", "0.6226531", "0.62213314", "0.6202556", "0.6166295", "0.6161053", "0.6158335", "0.6117237", ...
0.75635874
0
Middleware sets ip from forwarded_for header
def test_middleware_sets_ip_from_forwarded_for(self): request = MockRequest('127.0.0.1', '83.42.13.77') RealIPMiddleware().process_request(request) self.assertEqual(request.user_ip, request.META['HTTP_X_FORWARDED_FOR'])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_middleware_sets_ip_from_remote_add(self):\n request = MockRequest('83.42.13.77')\n RealIPMiddleware().process_request(request)\n\n self.assertEqual(request.user_ip, request.META['REMOTE_ADDR'])", "def index():\n if request.environ.get('HTTP_X_FORWARDED_FOR') is None:\n pri...
[ "0.65832514", "0.65680814", "0.65494907", "0.6519336", "0.64727664", "0.64727664", "0.63747627", "0.6356676", "0.61305314", "0.6048208", "0.60475856", "0.6042625", "0.6041627", "0.60342574", "0.6024563", "0.59888196", "0.59851587", "0.59729916", "0.5950611", "0.59271187", "0....
0.72786903
0
pack and compress an object with pickle and zlib.
def send_zipped_pickle(self, obj, flags=0, protocol=-1): pobj = pickle.dumps(obj, protocol) zobj = zlib.compress(pobj) return self.send(zobj, flags=flags)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def send_zipped_pickle(self, obj, flags=0, protocol=-1):\n pobj = pickle.dumps(obj, protocol)\n zobj = zlib.compress(pobj)\n # print('zipped pickle is %i bytes' % len(zobj))\n return self.send(zobj, flags=flags)", "def compress(value):\n pickled = pickle_util.dump(value)\n ...
[ "0.74478215", "0.7177528", "0.70826787", "0.69263774", "0.6899893", "0.6805793", "0.66760373", "0.66077256", "0.66077256", "0.64762557", "0.6465707", "0.64510703", "0.6413411", "0.6413411", "0.63787735", "0.61597836", "0.6091758", "0.60493743", "0.60256284", "0.600604", "0.59...
0.7545259
0
reconstruct a Python object sent with zipped_pickle
def recv_zipped_pickle(self, flags=0): zobj = self.recv(flags) pobj = zlib.decompress(zobj) return pickle.loads(pobj)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def send_zipped_pickle(self, obj, flags=0, protocol=-1):\n pobj = pickle.dumps(obj, protocol)\n zobj = zlib.compress(pobj)\n # print('zipped pickle is %i bytes' % len(zobj))\n return self.send(zobj, flags=flags)", "def send_zipped_pickle(self, obj, flags=0, protocol=-1):\n pobj...
[ "0.65126723", "0.6504582", "0.63466877", "0.63250786", "0.63180214", "0.61724806", "0.6081468", "0.60560185", "0.60177755", "0.60157835", "0.600609", "0.59901726", "0.5983071", "0.59076273", "0.59074223", "0.5906471", "0.5886152", "0.58664185", "0.58602303", "0.5825473", "0.5...
0.6818104
1
send a numpy array with metadata
def send_array(self, A, flags=0, copy=True, track=False): md = dict( dtype = str(A.dtype), shape = A.shape, ) self.send_json(md, flags|zmq.SNDMORE) return self.send(A, flags, copy=copy, track=track)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def send_ndarray(sock, data):\n with io.BytesIO() as f:\n np.save(f, data)\n byte_data = f.getvalue()\n\n # Pack message length\n msg = struct.pack('>I', len(byte_data)) + byte_data\n sock.sendall(msg)", "def serialize_numpy(self, buff, numpy):\n try:\n length = len(self.pending...
[ "0.6501568", "0.62580985", "0.619946", "0.6193633", "0.6189601", "0.61822146", "0.6154474", "0.6137267", "0.6136131", "0.6128146", "0.61205447", "0.61147827", "0.6091603", "0.60911626", "0.6068108", "0.60643", "0.6058451", "0.60514754", "0.60438716", "0.60382295", "0.6035022"...
0.63785505
1
recv a numpy array
def recv_array(self, flags=0, copy=True, track=False): md = self.recv_json(flags=flags) msg = self.recv(flags=flags, copy=copy, track=track) A = numpy.frombuffer(msg, dtype=md['dtype']) return A.reshape(md['shape'])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _recv(self) -> List[np.ndarray]:", "def recv_ndarray(sock):\n # Extract message length\n N_msg_raw = recv_bytes(sock, 4)\n N_msg = struct.unpack('>I', N_msg_raw)[0]\n\n msg = recv_bytes(sock, N_msg)\n with io.BytesIO(msg) as f:\n data = np.load(f)\n return data", "def recv_array(so...
[ "0.8332988", "0.79175794", "0.7687998", "0.7513383", "0.67114717", "0.6326455", "0.62215215", "0.6184913", "0.6184478", "0.6168363", "0.61634666", "0.61182845", "0.61134046", "0.6038764", "0.6038281", "0.6005507", "0.59929806", "0.5954883", "0.59120417", "0.58909285", "0.5863...
0.76285434
4
distribute tasks from toplevel controler
def distribute(cfgs, stage): port = str(5559 + 2 * stage) context = SerializingContext() socket = context.socket(zmq.REQ) socket.connect ("tcp://localhost:%s" % port) for index in range (len(cfgs)): cfg = cfgs[index] socket.send_zipped_pickle([index, cfg]) # get the reply. ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def tasks():", "def task():", "def task(self):", "def task(self):", "def main(self):\n\n self._setup_task_manager()\n self._setup_source_and_destination()\n self.task_manager.blocking_start(waiting_func=self.waiting_func)\n self._cleanup()", "def task():\n pass", "def tas...
[ "0.72990984", "0.65755194", "0.63279986", "0.63279986", "0.6314131", "0.61551446", "0.61551446", "0.611679", "0.60797715", "0.60679513", "0.60274005", "0.60215", "0.6000388", "0.6000377", "0.5967445", "0.593113", "0.59250104", "0.5912383", "0.59077597", "0.5886568", "0.587357...
0.0
-1
ZeroMQ device pipeline for forwarding tasks
def device(front, end): try: context = SerializingContext(1) # Socket facing clients frontend = context.socket(zmq.XREP) frontend.bind("tcp://*:" + str(front)) # Socket facing services backend = context.socket(zmq.XREQ) backend.bind("tcp://*:" + str(end)) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def invoke(self, msg, req):\n node = Node.create()\n node.acquire_lock()\n\n if msg.name == 'forward':\n try:\n with node.graph.as_default():\n if node.num_devices == 5:\n output, name = Model_5.forward(req['input'], req['next...
[ "0.6149611", "0.579976", "0.5776026", "0.5751378", "0.5704356", "0.5641851", "0.5636927", "0.55760735", "0.5370265", "0.5275626", "0.5241869", "0.52382314", "0.52338463", "0.522867", "0.5217725", "0.52146167", "0.5204394", "0.51787984", "0.5177174", "0.5176616", "0.51706225",...
0.5684926
5
ZeroMQ server process proposal and return qor
def server(stage): port = str(5560 + 2 * stage) context = SerializingContext() socket = context.socket(zmq.REP) socket.connect("tcp://localhost:%s" % port) while True: message = socket.recv_zipped_pickle() socket.send(("World from server %s" % message).encode('ascii')) break...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def controls():\n\n context = zmq.Context()\n\n print(\"Transmitting commands to process.\")\n socket = context.socket(zmq.REQ)\n rc = socket.connect(\"ipc:///tmp/mail_queue_ipc\")\n #print(rc)\n\n\n for request in range(2):\n print(\"Sending request %s\" % request)\n socket.send(b\...
[ "0.63771105", "0.6076438", "0.5856045", "0.5730489", "0.571471", "0.5702376", "0.56857747", "0.5663073", "0.5629481", "0.56114054", "0.56082535", "0.5460518", "0.545688", "0.5434244", "0.5429928", "0.5396045", "0.53841364", "0.5343068", "0.5334609", "0.5334548", "0.5333317", ...
0.0
-1
Generate the requested number of synthetic images.
def load_shapes(self, count, img_floder, mask_floder, imglist, creatnpzfile:bool=True): # Add classes self.add_class("shapes", 1, "grasper") self.add_class("shapes", 2, "grasper2") self.add_class("shapes", 3, "grasper3") self.add_class("shapes", 4, "irrigator") s...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def generate_images(self, count):\n # Generate images from the currently loaded model\n noise = np.random.normal(0, 1, (count, self.dimensions_noise))\n return self.generator.predict(noise)", "def gen_image(self, nimage):\n tmp = [0] * nimage\n for i in np.arange(nimage):\n ...
[ "0.7408084", "0.6854674", "0.6790929", "0.67828166", "0.67828166", "0.6729562", "0.67285556", "0.6515633", "0.64884275", "0.6405145", "0.636177", "0.63502365", "0.6227985", "0.6197315", "0.6168941", "0.6085836", "0.606413", "0.6004956", "0.5965728", "0.593395", "0.5914194", ...
0.0
-1
Generate instance masks for shapes of the given image ID.
def load_mask(self, image_id): info = self.image_info[image_id]['mask_info'] mask_, id_ = info return mask_, id_ #mask.astype(np.bool)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load_mask(self, image_id):\n\n image_info = self.image_info[image_id]\n if image_info[\"source\"] != \"pcb\":\n return super(self.__class__, self).load_mask(image_id)\n\n # convert polygons to a bitmap mask of shape\n # [height, width, instance_count]\n info = self...
[ "0.7636923", "0.7464017", "0.742737", "0.7384672", "0.7339207", "0.72988886", "0.7290323", "0.71908504", "0.713616", "0.713167", "0.7113493", "0.70892924", "0.70513177", "0.7007302", "0.7003303", "0.70003724", "0.69821656", "0.68691427", "0.6793878", "0.6793428", "0.6769815",...
0.6142451
34
Generate instance masks for shapes of the given image ID.
def load_mask_pre(self, image_id, mask_path): img = Image.open(mask_path) colors = img.getcolors() n_dim = np.shape(colors) num_obj = n_dim[0]-1 #not include the background mask = np.zeros([np.shape(img)[0], np.shape(img)[1], num_obj], dtype=np.uint8) mask = self.draw_ma...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load_mask(self, image_id):\n\n image_info = self.image_info[image_id]\n if image_info[\"source\"] != \"pcb\":\n return super(self.__class__, self).load_mask(image_id)\n\n # convert polygons to a bitmap mask of shape\n # [height, width, instance_count]\n info = self...
[ "0.7638348", "0.74643517", "0.7429056", "0.73863584", "0.73416096", "0.7300548", "0.72917783", "0.7192356", "0.7136925", "0.7133605", "0.7116498", "0.7091995", "0.70539427", "0.7009241", "0.70049584", "0.7002854", "0.69841856", "0.6869204", "0.67955583", "0.6795512", "0.67716...
0.60081947
36
sanitize transitions for final states
def sanitize_transitions(transitions): def new_transitions(state, read): if state in ('accept', 'reject', 'halt'): return state, read, (1 if read == '|>' else -1) else: return transitions(state, read) return new_transitions
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_validate_self_final_state_transitions(self):\n with nose.assert_raises(exceptions.FinalStateError):\n self.dtm1.transitions['q4'] = {'0': ('q4', '0', 'L')}\n self.dtm1.validate_self()", "def _prepare_transitions_without_proxy_pc(self):\n transitions = {\n U...
[ "0.59608704", "0.5693894", "0.5670876", "0.5642975", "0.55443186", "0.55419594", "0.54977345", "0.54965806", "0.5472268", "0.5449667", "0.53605413", "0.53510976", "0.53409356", "0.5303349", "0.5253285", "0.525235", "0.5219467", "0.5215968", "0.51929104", "0.5188079", "0.51862...
0.7414467
0
convert input to unary
def unary_wrap(run): def run_unary(transitions, input, steps): return run(transitions, '1' * input, steps) return run_unary
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def visit_UnaryOp(self, node):\n self.generic_visit(node)\n if isinstance(node.operand, ast.Num):\n # Don't transform negations of numeric literals. Just treat them\n # as literals.\n return node\n return to_call(self.op_to_function(node.op), [node.operand])", ...
[ "0.7213158", "0.7133943", "0.69632995", "0.6525444", "0.6413119", "0.6404791", "0.63981265", "0.63736695", "0.6211763", "0.6188194", "0.6183217", "0.6077472", "0.602212", "0.60095865", "0.5909924", "0.5909241", "0.58738357", "0.5833825", "0.5817463", "0.5724994", "0.57067114"...
0.5773733
19
display output of run
def display_wrap(run): def display_run(transitions, input, steps): display(run(transitions, input, steps)) return display_run
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def main():\n cli = Cli()\n res = cli.run()\n if res:\n print(res.strip())", "def run(self, stdout=None, stderr=None):", "def run(self):\n if self.opts[\"chunked\"]:\n ret = self.run_chunked()\n else:\n ret = self.run_oldstyle()\n\n salt.output.display...
[ "0.7465767", "0.7120515", "0.70741016", "0.6924402", "0.68736917", "0.6825538", "0.67861724", "0.6775112", "0.67014307", "0.6641446", "0.65396535", "0.6536937", "0.6522384", "0.6430364", "0.6422982", "0.63896686", "0.6371739", "0.6361555", "0.6338712", "0.6330454", "0.6316037...
0.5935942
100
represent transitions as table
def transitions_table(transitions, states, alphabet): transitions = sanitize_transitions(transitions) check_transitions(transitions, states, alphabet) table = [] for current in states: for read in alphabet: # DEBUG: print(state, read) next, write, move = transitions(cur...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def transitions(self) -> List[Dict]:\n return []", "def get_transitions(self):\n transitions = []\n for row in self.states:\n t_row = []\n for column in self.states:\n t_row.append([row, column])\n transitions.append(t_row)\n return sort...
[ "0.67255855", "0.6671027", "0.66532004", "0.63881505", "0.6283373", "0.6169781", "0.61309755", "0.61049795", "0.60562634", "0.5987227", "0.5958376", "0.58731186", "0.58591586", "0.5843021", "0.5835255", "0.57839334", "0.57770514", "0.5772655", "0.5761435", "0.57287306", "0.57...
0.71506095
0
loads widget to simulate a given TM
def simulate(transitions, input='10101', unary=False, input_unary=12, pause=0.05, step_from=0, step_to=100, step_slack=100): # widgets to specify the range of steps to simulate from_w = widgets.IntText(value=step_from, description="simulate from step") to_w = widgets.IntText(valu...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def init_widget(self):", "def getWidget(self):", "def test_690(self):\r\n test_id = 690\r\n sel = self.selenium\r\n testpage = \"/pagedemo/nytimes_youtube_embed\"\r\n subtextfile = os.path.join(testvars.MSTestVariables[\"DataDirectory\"],\"OctopusGarden.txt\")\r\n sel.open(te...
[ "0.55800986", "0.5434726", "0.5432306", "0.5387828", "0.5359594", "0.53199816", "0.5296861", "0.528935", "0.52524704", "0.5245719", "0.5189013", "0.51586413", "0.51575243", "0.51544136", "0.5154147", "0.51477253", "0.5137714", "0.51361173", "0.510642", "0.5064773", "0.5058490...
0.0
-1
Calculate the factorial of `value`
def calculate_factorial( self, value: "int", fail_if_bigger_than: "int" = None ) -> "int": pass
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def calculate_factorial(num: int, factorial_value: int):\n if num <= 1:\n return factorial_value\n\n return calculate_factorial(num - 1, num * factorial_value)", "def logFactorial(value):\n if all([value > 0,abs(round(value) - value) < 0.000001,value <= 34]):\n return float(sum(np.log(rang...
[ "0.77344155", "0.7526556", "0.72905385", "0.72460854", "0.7149332", "0.70673406", "0.70164007", "0.7006233", "0.6936143", "0.6901903", "0.68945795", "0.6854181", "0.6828081", "0.6821668", "0.68132067", "0.68010587", "0.67935383", "0.6788436", "0.6761285", "0.6691058", "0.6680...
0.7685602
1
set all your GPU to add more memory when necessary for TensorFlow
def tf_set_memory_growth(): physical_devices = tf.config.experimental.list_physical_devices('GPU') for physical_device in physical_devices: tf.config.experimental.set_memory_growth(physical_device, True)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def limit_mem():\n config = tf.compat.v1.ConfigProto()\n config.gpu_options.allow_growth = True\n tf.compat.v1.Session(config=config)", "def limit_gpu_memory_usage():\n\n tf_config = tf.ConfigProto()\n tf_config.gpu_options.allow_growth = True\n set_session(tf.Session(config=tf_config))", "de...
[ "0.7906132", "0.78547263", "0.7348334", "0.7297383", "0.71145254", "0.7050099", "0.7034848", "0.6982133", "0.66512537", "0.6641334", "0.65701526", "0.65123516", "0.65083855", "0.635838", "0.63570505", "0.62639046", "0.62056965", "0.6141928", "0.6093227", "0.6091074", "0.60746...
0.7912332
0
Plot the apertures overlayed on the image
def plot_apertures(self,stretch="hist",cmap="gray",alpha=0.5,lw=1.5,**kwargs): #self.fig, self.ax = plt.subplots() #self.ax.imshow(self.data, cmap='gray_r', origin='lower') self.plot(stretch=stretch,cmap=cmap) if type(self.apertures)==list: [ap.plot(color='blue',alpha=alpha,a...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def plot_apertures(image, ext=1):\n\n hdu = fits.open(image)\n apfile = './database/ape' + image.strip('.fits') + '_{:d}'.format(ext)\n\n b = np.array(\n [i.split()[3:] for i in open(apfile).readlines() if 'begin' in i])\n\n apid = b[:, 0]\n x = np.array([float(i) for i in b[:, 2]])\n\n sc...
[ "0.63690543", "0.62471694", "0.6223126", "0.61979526", "0.61384803", "0.60802174", "0.60348827", "0.6015301", "0.59327394", "0.5855474", "0.5854448", "0.58393836", "0.5812253", "0.5809869", "0.5792227", "0.577715", "0.57620543", "0.57507455", "0.57423115", "0.57321507", "0.57...
0.64703363
0
Howell centroiding, from Howell's Handbook of CCD astronomy
def howell_center(self,postage_stamp): xpixels = np.arange(postage_stamp.shape[1]) ypixels = np.arange(postage_stamp.shape[0]) I = np.sum(postage_stamp, axis=0) J = np.sum(postage_stamp, axis=1) Isub = I-np.sum(I)/I.size Isub[Isub<0] = 0 Jsub = J-np.sum(J)/J.size...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def find_centroid_for_each(self):", "def estimate_centroid(self):\r\n\t\tstrain = self.strain_distribution_compr(self.max_pure_compresive_strain,\\\r\n\t\t\tself.max_pure_compresive_strain)\r\n\t\tself.geometric_centrod = (self.depth/2) \r\n\t\tself.plastic_centroid = (self.depth/2)+\\\r\n\t\t\t(self.sectional_m...
[ "0.7809149", "0.75144196", "0.7275023", "0.7216566", "0.7211616", "0.7109142", "0.7090709", "0.70830643", "0.7005338", "0.6955634", "0.69518745", "0.6943443", "0.6940802", "0.6920208", "0.6913663", "0.68661994", "0.6844987", "0.6788249", "0.67240787", "0.671486", "0.67121994"...
0.61284465
94
Perform centroiding on a cutout window.
def get_centroid_cutout(self,x,y,box_size=30,method="howell",dao_fwhm=10.,dao_SNR=100.,plot=False,plot_full=False,stretch=None): int_x = int(round(x)) int_y = int(round(y)) postage_stamp = photutils.utils.cutouts.cutout_footprint(self.data,(int_x,int_y),box_size) # Only interest...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def perform_photometry_window_centroid(self,xcen,ycen,r_aper=34.,r_annulus1=60.,r_annulus2=90.,\n box_size=80.,method=\"howell\"):\n if (r_annulus1 < r_aper) ^ (r_annulus2 < r_aper):\n raise Exception, '(r_annulus1 < r_aper) ^ (r_annulus2 < r_aper)'\n ...
[ "0.6669482", "0.65246683", "0.6491663", "0.6358105", "0.6284617", "0.6283336", "0.62237006", "0.60856724", "0.6045427", "0.60387117", "0.6020103", "0.6005384", "0.59939706", "0.59827", "0.59525937", "0.59194905", "0.5882253", "0.5872893", "0.5868707", "0.5865238", "0.58520114...
0.6420821
3
Perform the photometry by window centroiding Currently only supports one aperture radius
def perform_photometry_window_centroid(self,xcen,ycen,r_aper=34.,r_annulus1=60.,r_annulus2=90., box_size=80.,method="howell"): if (r_annulus1 < r_aper) ^ (r_annulus2 < r_aper): raise Exception, '(r_annulus1 < r_aper) ^ (r_annulus2 < r_aper)' ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def find_window_centroids(self, warped):\n window_width = self.window_width\n window_height = self.window_height\n margin = self.margin\n \n window_centroids = [] # store the (left,right) window centroids positions per level\n window = np.ones(window_width) # Create window...
[ "0.64600456", "0.6453353", "0.64277303", "0.63199353", "0.63098097", "0.63059", "0.62005365", "0.610343", "0.60987616", "0.6094712", "0.6092999", "0.6092751", "0.6022957", "0.60049474", "0.5942481", "0.59232664", "0.5907178", "0.58953047", "0.5882762", "0.5861726", "0.5825627...
0.77198577
0
Function to get the peak value in an aperture
def get_peak_in_aperture(self,data,mask=None, method='exact',subpixels=5,unit=None): data_cutouts = self.get_data_cutouts(data,mask=None,method='exact',subpixels=5,unit=None) aperture_peaks = [] for data_cutout in data_cutouts: aperture_peaks.append(np.max(data_cutout)) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def peak(self):\n pass", "def peak(self) -> Tuple[MeasureInput, MeasureResult]:\n assert self._data\n return self._data[0][2]", "def peak(self):\n return self.peak", "def peak(self):\n\n return self._data[0]", "def getPeakValue( self ):\n nCurrentMax = max( self.da...
[ "0.75032294", "0.74555135", "0.7303224", "0.73032236", "0.7296107", "0.7195845", "0.70544934", "0.7023032", "0.6945288", "0.6901123", "0.687773", "0.6844767", "0.6735962", "0.66569304", "0.6651869", "0.66357124", "0.6615047", "0.6570366", "0.65643936", "0.6484093", "0.6391976...
0.7094022
6
Execute the goal for the FollowPathActionServer. goal_handle The goal to process goal result
async def execute(self, goal_handle): self.get_logger().info('Executing goal...') super().execute(goal_handle) # Activate markers timer = self.create_rate(self._controller_rate.value) try: # Wait for the lock after prior goal is properly canceled self._is_new_go...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new_goal_callback(self, goal_handle):\n goal_handle = self._as.current_goal\n success = False\n goal = goal_handle.get_goal()\n \n # get the enumeration\n action_type = self._get_action_from_goal(goal)\n if action_type is not None and action_type.value in self._...
[ "0.6491225", "0.63767153", "0.62105227", "0.62046003", "0.6165734", "0.6114846", "0.59247386", "0.5873322", "0.5599956", "0.54965204", "0.5490573", "0.5475759", "0.53539056", "0.5286995", "0.5254973", "0.52461374", "0.5114907", "0.5085113", "0.50719523", "0.5014525", "0.49729...
0.6328866
2
full example using FleurRelaxWorkChain with just a fleurinp data as input. Several fleur runs needed till convergence
def test_fleur_relax_fleurinp_Si_bulk(enable_archive_cache, fleur_local_code, create_fleurinp, clear_database, show_workchain_summary): options = { 'resources': { 'num_machines': 1, 'num_mpiprocs_per_machine': 1 }, 'max_wallclock_...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_fleur_relax_validation_wrong_inputs(fleur_local_code, inpgen_local_code, generate_structure2):\n from aiida.orm import Dict\n\n # prepare input nodes and dicts\n options = {\n 'resources': {\n 'num_machines': 1,\n 'num_mpiprocs_per_machine': 1\n },\n 'ma...
[ "0.6629493", "0.64359736", "0.62659895", "0.6209961", "0.6183638", "0.6004328", "0.59587884", "0.59572893", "0.59045887", "0.5805597", "0.57625765", "0.5746759", "0.57210416", "0.5720385", "0.57198924", "0.5648384", "0.5641449", "0.56273687", "0.56196386", "0.56167144", "0.56...
0.69624954
0
Test the validation behavior of FleurRelaxWorkChain if wrong input is provided it should throw an exitcode and not start a Fleur run or crash
def test_fleur_relax_validation_wrong_inputs(fleur_local_code, inpgen_local_code, generate_structure2): from aiida.orm import Dict # prepare input nodes and dicts options = { 'resources': { 'num_machines': 1, 'num_mpiprocs_per_machine': 1 }, 'max_wallclock_se...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_fleur_relax_continue_converged(self, run_with_cache, mock_code_factory):\n assert False", "def test_xfail_with_run_false_and_with_reason():\n pass", "def test_fleur_create_mag_validation_wrong_inputs(self, fleur_local_code, inpgen_local_code, generate_structure2):\n from aiida.orm imp...
[ "0.6527789", "0.6397676", "0.6376287", "0.62080467", "0.5986831", "0.597977", "0.59309053", "0.59191245", "0.5904268", "0.58760554", "0.5873213", "0.5866766", "0.5860231", "0.5855194", "0.58542204", "0.584257", "0.5834893", "0.58343375", "0.58338165", "0.58320963", "0.5828332...
0.75277627
0
Full regression test of FleurRelaxWorkChain starting with a crystal structure and parameters
def test_fleur_relax_structure_Si(self, run_with_cache, mock_code_factory): assert False
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def experiment_linear_tradeoff_linf(_):\n adv_norm_type = 'linf'\n dual_norm_type = 'l1'\n # Min l1-norm solution found (norm=0.6876)\n attack_eps = 1/0.6876\n attack_step_dir = 'sign_grad'\n module_name = 'train'\n log_dir = 'runs_linear_tradeoff_%s' % adv_norm_type\n exclude = '*'\n\n d_over_n = [32]\n ...
[ "0.63452566", "0.6134101", "0.6071927", "0.60698134", "0.60179615", "0.59703165", "0.5964929", "0.59247416", "0.58787197", "0.5869982", "0.5863784", "0.5843638", "0.58375585", "0.5803102", "0.5754616", "0.57402086", "0.5721344", "0.57190585", "0.5706885", "0.5671887", "0.5652...
0.0
-1
Full regression test of FleurRelaxWorkChain starting with a fleurinp data of a film structure
def test_fleur_relax_structure_Si_film(self, run_with_cache, mock_code_factory): assert False
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def fit_test(self):", "def fitting_lr_and_rf(file, test_yr, fit_lr, fit_rf):\n df = pd.read_csv(file)\n\n mask_test = (df.year == test_yr)\n mask_train = (df.year >= test_yr-6) & (df.year <= test_yr-1)\n\n target = 'wkts'\n\n features_full = ['year1_mtchs_pld', 'year2_mtchs_pld', 'year3_mtchs_pld'...
[ "0.6507529", "0.6251383", "0.62277925", "0.6049266", "0.6026809", "0.6011768", "0.59905267", "0.595187", "0.5906658", "0.58967704", "0.5846648", "0.5828634", "0.5757857", "0.57535845", "0.5743822", "0.5737725", "0.57325935", "0.57261574", "0.57101697", "0.57007295", "0.569805...
0.5335065
79
Full regression test of FleurRelaxWorkChain starting from an already converged relaxed structure
def test_fleur_relax_continue_converged(self, run_with_cache, mock_code_factory): assert False
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_fleur_relax_fleurinp_Si_bulk(enable_archive_cache, fleur_local_code, create_fleurinp, clear_database,\n show_workchain_summary):\n options = {\n 'resources': {\n 'num_machines': 1,\n 'num_mpiprocs_per_machine': 1\n },\n 'ma...
[ "0.6542763", "0.64785564", "0.61622", "0.6161674", "0.6119675", "0.60529333", "0.6012757", "0.59716773", "0.59675354", "0.59479743", "0.59399235", "0.59162384", "0.5904664", "0.5896194", "0.5888535", "0.5858821", "0.58306944", "0.58250594", "0.5785228", "0.57725173", "0.57643...
0.57455266
22
Add the passed in Card to the Hand
def add_card(self, card): self._hand.add_first(card)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_card_to_hand(self, card):\n self.hand.append(card)", "def addCardToHand(self, card):\r\n self.hand.append(card)", "def add_card(self, card):\r\n self.hand.append(card)", "def add_card(self, card):\n self.hand.append(card)", "def add_card(self, card):\n \n s...
[ "0.8959342", "0.8948628", "0.8940561", "0.88605785", "0.8713226", "0.84437263", "0.8378623", "0.8347363", "0.82030964", "0.8169657", "0.8169657", "0.8169657", "0.8169657", "0.816559", "0.8136611", "0.8069582", "0.8054051", "0.80358404", "0.80283415", "0.796219", "0.7945396", ...
0.83781224
7
Add the passed in Pile of Cards to the Hand
def add_pile(self, pile): for c in range(pile.get_size()): card = pile.remove_first() self._hand.add_last(card)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def addCardToHand(self, card):\r\n self.hand.append(card)", "def add_card_to_hand(self, card):\n self.hand.append(card)", "def add_card(self, card):\n #Determines if there are more than one.\n if isinstance(card,list):\n for element in range(len(card)):\n #...
[ "0.7303749", "0.7261806", "0.7231359", "0.71908945", "0.708371", "0.70317644", "0.69786596", "0.69185394", "0.6915161", "0.68766797", "0.68649715", "0.67979866", "0.66192365", "0.6605498", "0.6580519", "0.65088373", "0.6503876", "0.6503876", "0.6503876", "0.6503876", "0.64854...
0.74441516
0
Remove the top Card from the Hand And add it to the passed in Pile
def play_card(self, pile): pile.add_card(self._hand.remove_first())
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def hit(hand=bj.player1.hand):\r\n hand.append(bj.deck.remove_card())", "def remove_from_hand(self):\n pass", "def update_hand(self, card_num):\n self.hand.pop(card_num)", "def remove_card(self):\n return self.hand.pop()", "def add_pile(self, pile):\n \n for c in r...
[ "0.7311014", "0.7193814", "0.7091728", "0.7086572", "0.6971293", "0.69486386", "0.6650889", "0.64928824", "0.64928824", "0.6481667", "0.6459279", "0.6450959", "0.64456934", "0.64375573", "0.6436413", "0.6416177", "0.6397232", "0.63931745", "0.6390436", "0.6364901", "0.6309483...
0.7307427
1
Return the number of Cards in the Hand
def get_num_cards(self): return self._hand.get_size()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def count(self):\n return(len(self.cards))", "def num_cards(self):\n length=len(self.cards)\n return length", "def count(self):\n return len(self.deck)", "def get_length(self):\n return len(self.cards)", "def total_cards(self):\n amount = 0\n for palo in sel...
[ "0.8366412", "0.8345038", "0.7758588", "0.7551099", "0.7538208", "0.74666196", "0.74069214", "0.7377227", "0.7310711", "0.7236268", "0.72108585", "0.71130294", "0.7108003", "0.70836735", "0.70836735", "0.7061145", "0.69822764", "0.69253355", "0.69028354", "0.689859", "0.68914...
0.8386889
0
Print the Player's Hand by calling the Hand's __str__ method
def display_hand(self): print (self._hand)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __str__(self):\n return Hand.__str__(self) + '\\nHand Rank: ' + self.get_full_label()", "def player_show_hand(self):\n for card in self.get_hand():\n print(card.get_card())", "def __str__(self):\n string = \"Hand contains \"\n h = self.hand\n \n for i in...
[ "0.8309237", "0.77762437", "0.7773761", "0.7767747", "0.75754976", "0.7568873", "0.74958175", "0.7477312", "0.7414893", "0.7409631", "0.74033546", "0.7283446", "0.721082", "0.7187044", "0.71833795", "0.71511585", "0.7139379", "0.71140784", "0.70902866", "0.7042968", "0.701166...
0.82403374
1
The number of orthogonal states for each qudit.
def radixes(self) -> tuple[int, ...]: return tuple([2] * self.num_qudits)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __len__(self):\n i = 0\n for S in self.states():\n i += 1\n return i", "def numStates(self):\n return len(self._mdp.S)", "def n_states(self):\n if self._thermodynamic_states is None:\n return 0\n else:\n return len(self._thermodynam...
[ "0.6791897", "0.6708667", "0.64950776", "0.647335", "0.64257866", "0.6411884", "0.6406396", "0.640121", "0.6357603", "0.62475604", "0.62466764", "0.6244983", "0.62338114", "0.6220634", "0.61964524", "0.6188009", "0.61867577", "0.61723953", "0.61720383", "0.61605823", "0.61495...
0.0
-1
Go through the various places where local, potentially sensitive variables are stored. This ranges from environment variables on Heroku, to an environment file on Dotcloud, to a local module on a development server.
def get_local(varname, default=None): # Try the local module first. try: return getattr(local, varname) except AttributeError: pass # Try the os environment. import os try: return os.environ[varname] except KeyError: pass # Heroku DATABASE_URL-based DB c...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def read_environment(self):\n # Setup credentials\n if os.getenv(\"DO_API_TOKEN\"):\n self.api_token = os.getenv(\"DO_API_TOKEN\")\n if os.getenv(\"DO_API_KEY\"):\n self.api_token = os.getenv(\"DO_API_KEY\")", "def find_environ_config_vars():\n # only allow secret ke...
[ "0.62108403", "0.61966354", "0.61664957", "0.61559683", "0.6151431", "0.61412436", "0.6088949", "0.6070321", "0.6065969", "0.6018435", "0.6011139", "0.5959551", "0.5924951", "0.5785612", "0.5782089", "0.5774071", "0.57643723", "0.5749349", "0.5745706", "0.5743557", "0.5739214...
0.0
-1
convert string to number
def str2num(s): try: return int(s) except ValueError: return float(s)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def string_to_number(string):\n if not string:\n return 0\n try:\n return int(string)\n except ValueError:\n return float(string)", "def to_number(s):\n ret = s\n try:\n ret = float(s)\n except ValueError:\n ret = ret.strip('\\'').strip()\n return ret\n...
[ "0.81351763", "0.81171566", "0.79739803", "0.78550935", "0.7829166", "0.7786419", "0.7669", "0.75417364", "0.75378966", "0.75176567", "0.75126886", "0.7489924", "0.7440725", "0.7415702", "0.73017126", "0.7141235", "0.7022343", "0.701367", "0.6993899", "0.686807", "0.6818014",...
0.8314441
0
tokenizes an expression and returns the list
def tokenize_expression(expr): return re.findall(r"(?ms)\W*([\w\.]+)", expr)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def tokenize_expr(self, expr: str) -> str:\n\n # Output Variable\n # For now, this is equivilent to expr\n out = expr\n\n for token in self.tokens.keys():\n # Lets add a backslash between every character\n # Of the token\n token = [f\"\\{tok}\" for tok i...
[ "0.7887446", "0.7743958", "0.7483114", "0.7268486", "0.7190225", "0.6792639", "0.6763161", "0.6740629", "0.6548123", "0.65247387", "0.6503249", "0.6471939", "0.6458219", "0.63956565", "0.6379898", "0.6347347", "0.6335774", "0.6308862", "0.6273699", "0.6259763", "0.6201096", ...
0.7238377
4
check variable by using regular expressions
def _check_variable(string, varname): prefix = '[(, ]' # Any character with the exception of '(, ' suffix = '[), ]' # Any character with the exception of '), ' pattern = prefix + varname + suffix re.match(pattern, string)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_variable(pattern):\n return (type(pattern) is str\n and pattern[0] == '?'\n and len(pattern) > 1\n and pattern[1] != '*'\n and pattern[1] in string.ascii_letters\n and ' ' not in pattern)", "def is_variable(s):\n return s[0] >= 'u' and s[0] <= '...
[ "0.6769958", "0.67595696", "0.6594304", "0.65283763", "0.6526588", "0.6447878", "0.6447878", "0.6356379", "0.6320342", "0.6285951", "0.6260877", "0.6258617", "0.62445927", "0.62099564", "0.6191854", "0.6167431", "0.61627233", "0.6159792", "0.60734344", "0.6066107", "0.6039188...
0.7724351
0
checks if character is not in the name or parameter string (if it is, throw an error)
def check_character(char, name, parameters): if char in name: raise NameError('Invalid character in the variable name: ' + name) # Make sure people don't include # within the name of parameters for item in parameters.keys(): if char in item: raise NameError('Invalid chara...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def validname(name):\r\n return len(name)>0 and (\r\n Context.__invalid_character.search(name) is None)", "def _check_for_parameter_syntax(self,parameter):\n err_msg = \"Illegal parameter name {}.\".format(parameter)\n if len(parameter) == 0:\n raise ValueError(err_msg ...
[ "0.70610005", "0.6957453", "0.6886487", "0.6811838", "0.6752317", "0.6694575", "0.6686241", "0.66786546", "0.6672879", "0.6533731", "0.6517977", "0.6501903", "0.64413077", "0.6413294", "0.64122677", "0.6394168", "0.6385318", "0.6361", "0.6346873", "0.6334966", "0.63148457", ...
0.84358835
0
Constructs all the necessary attributes for the Display object.
def __init__(self): pygame.init() self.screen = pygame.display.set_mode((DisplayConsts.SCREEN_WIDTH, DisplayConsts.SCREEN_HEIGHT))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _init_display(self):\n raise NotImplementedError", "def __init__(self, display):\n self.display = display\n self.labels = dict()", "def _display_setup(self):\r\n display_file = \"{}/display.json\".format(self.settings_dir)\r\n with open(display_file) as json_file:\r\n ...
[ "0.695102", "0.68824357", "0.61532706", "0.5983251", "0.5938432", "0.5864768", "0.5862412", "0.5859935", "0.5842069", "0.583978", "0.5830118", "0.5815854", "0.5770943", "0.57566184", "0.5744141", "0.57247615", "0.5714299", "0.5689721", "0.56596416", "0.56379783", "0.56251395"...
0.0
-1
Displays the game over screen
def show_game_over(self): font = pygame.font.SysFont(DisplayConsts.GAME_OVER_FONT_TYPE, DisplayConsts.GAME_OVER_FONT_SIZE) surface = font.render("Game Over", True, DisplayConsts.GAME_OVER_FONT_COLOR) # Display game over rect = surface.get_rect() rect.midtop = (DisplayConsts.SCREEN_WIDTH...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def game_over(self):\r\n win.blit(self.image_of_game_over, (250, 170))", "def show_game_over_screen():\n game_over_font = pygame.font.Font('freesansbold.ttf', 120)\n game_surface = game_over_font.render('Game', True, WHITE)\n over_surface = game_over_font.render('Over', True, WHITE)\n game_rec...
[ "0.828568", "0.81241494", "0.8054334", "0.80165696", "0.8001225", "0.7982136", "0.79339725", "0.76767915", "0.76292074", "0.75744355", "0.75530946", "0.7505249", "0.74886507", "0.74126536", "0.74051535", "0.73711807", "0.7322313", "0.72022474", "0.7196458", "0.7169502", "0.71...
0.83626986
0
Displays the score over the screen
def show_score(self, bird): font = pygame.font.SysFont(DisplayConsts.FONT_TYPE, DisplayConsts.FONT_SIZE) surface = font.render(str(bird.score), True, DisplayConsts.FONT_COLOR) # show score rect = surface.get_rect() rect.midtop = (DisplayConsts.SCREEN_WIDTH // 2.5, DisplayConsts.SCREEN_H...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show_score(x, y):\n score = font.render(\"Score: \" + str(score_value), True, (255, 255, 255))\n screen.blit(score, (x, y))", "def show_score(self):\n self.screen.blit(self.score_image, self.score_rect)\n self.screen.blit(self.high_score_text_image, self.high_score_text_rect)\n s...
[ "0.8186811", "0.81557006", "0.813015", "0.80905426", "0.80458945", "0.79674417", "0.7932679", "0.7914928", "0.7898904", "0.7836375", "0.77768546", "0.7729492", "0.7708822", "0.7594624", "0.75864816", "0.7535525", "0.7533242", "0.7530186", "0.7526594", "0.75041294", "0.7481162...
0.78010315
10
Implements the game animation on the screen attribute.
def animate_game(self, bird, pipe_pairs, floor): self.screen.blit(DisplayConsts.BACKGROUND_IMAGE, (0, 0)) # draw background self.screen.blit(floor.floor_image[0], (floor.x[0], floor.y)) # draw the first floor self.screen.blit(floor.floor_image[1], (floor.x[1], floor.y)) # draw the second flo...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update_screen(ai_settings, screen, ship):", "def update(self, screen) -> bool:\n # Current animation frame is less than 10\n if self.curr_frame < 10:\n exp = pygame.image.load(\"images/exp\" + str(self.curr_frame) + \".png\").convert_alpha()\n exp = pygame.transform.scale(...
[ "0.65548253", "0.6505364", "0.6421218", "0.641158", "0.6401354", "0.63194084", "0.6260818", "0.6222658", "0.6213672", "0.6211915", "0.62053204", "0.62053204", "0.6203199", "0.6203199", "0.6203199", "0.6203199", "0.6203199", "0.6203199", "0.6203199", "0.6203199", "0.6203199", ...
0.0
-1
Only users that are staff are allowed to see this menu.
def is_user_allowed(self, user): return user.is_staff
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_staff(self):\r\n return self.is_admin", "def is_staff(self):\n return self.is_admin", "def is_staff(self):\n return self.is_admin", "def is_staff(self):\n\t\treturn self.is_admin", "def test_is_staff_access(self):\r\n self.check_index_and_outline(self.client)", "def has_s...
[ "0.7719837", "0.74760246", "0.74760246", "0.74752843", "0.73139966", "0.7277097", "0.72541326", "0.7072912", "0.7072912", "0.7072912", "0.7059569", "0.6982773", "0.6843595", "0.6776745", "0.67338896", "0.6733382", "0.67065734", "0.66786593", "0.6646928", "0.6646928", "0.66230...
0.7534058
1
Create a new point at the given coordinates.
def __init__(self, initX, initY): self.x = initX self.y = initY
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_new_point(self, coords, **options):\n\n if 'fill' not in options:\n options['fill'] = self.variables.foreground_color\n\n x1, y1 = (coords[0] - self.variables.point_size), (coords[1] - self.variables.point_size)\n x2, y2 = (coords[0] + self.variables.point_size), (coords[...
[ "0.7404491", "0.7181391", "0.71479046", "0.71479046", "0.7141722", "0.6773949", "0.67493427", "0.650266", "0.6469327", "0.64393455", "0.6358204", "0.63443464", "0.6252241", "0.62502253", "0.6229518", "0.62291485", "0.6227966", "0.6197312", "0.61617047", "0.61275893", "0.60861...
0.0
-1