query
stringlengths
9
9.05k
document
stringlengths
10
222k
metadata
dict
negatives
listlengths
30
30
negative_scores
listlengths
30
30
document_score
stringlengths
4
10
document_rank
stringclasses
2 values
Return the first point of a `LINESTRING` geometry as a `POINT`. Return `NULL` if the input parameter is not a `LINESTRING` Returns PointValue Start point
def start_point(self) -> PointValue: return ops.GeoStartPoint(self).to_expr()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_point_from_linestring(geom_row, X=0, behaviour='last'):\n\n lat = None\n lng = None\n try:\n X = round(X)\n except Exception as e:\n raise TypeError(\"Please enter a number for the index of the point within the linestring (X)\")\n\n if behaviour in ['last', 'ignore']:\n ...
[ "0.6900281", "0.6412776", "0.6308229", "0.6055818", "0.6031474", "0.5971331", "0.5921453", "0.5892484", "0.5889433", "0.58782244", "0.5713872", "0.5669867", "0.565784", "0.5622244", "0.56021214", "0.5563299", "0.55588895", "0.5468982", "0.5464776", "0.54572684", "0.5446547", ...
0.66960007
1
Return the last point of a `LINESTRING` geometry as a `POINT`. Return `NULL` if the input parameter is not a `LINESTRING` Returns PointValue End point
def end_point(self) -> PointValue: return ops.GeoEndPoint(self).to_expr()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_point_from_linestring(geom_row, X=0, behaviour='last'):\n\n lat = None\n lng = None\n try:\n X = round(X)\n except Exception as e:\n raise TypeError(\"Please enter a number for the index of the point within the linestring (X)\")\n\n if behaviour in ['last', 'ignore']:\n ...
[ "0.6676908", "0.5809005", "0.5783823", "0.56184757", "0.55974036", "0.55868995", "0.55476713", "0.55083495", "0.54330933", "0.5421323", "0.5405748", "0.5357882", "0.5356936", "0.5310009", "0.53001106", "0.5296828", "0.52810085", "0.5279905", "0.5247025", "0.52342033", "0.5233...
0.6394568
1
Return the number of points in a geometry. Works for all geometries. Returns IntegerValue Number of points
def n_points(self) -> ir.IntegerValue: return ops.GeoNPoints(self).to_expr()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def GetNumberOfPoints(self):\n return self.GetNumberOfElements(ArrayAssociation.POINT)", "def nr_points(self):\n return len(self.x)", "def get_num_points(self):\n dimensions = self.data.shape\n return dimensions[0]", "def Points_Counting(self):\n return len(self.__traectory...
[ "0.7617105", "0.7232622", "0.69771457", "0.6758496", "0.67430544", "0.6689235", "0.6671096", "0.664159", "0.6603003", "0.6600424", "0.6575029", "0.6537295", "0.65371937", "0.65340865", "0.65138453", "0.65028435", "0.6462112", "0.6462112", "0.6436137", "0.64342684", "0.6429228...
0.75139165
1
Return the spatial reference identifier for the ST_Geometry. Returns IntegerValue SRID
def srid(self) -> ir.IntegerValue: return ops.GeoSRID(self).to_expr()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def SRID():\r\n return SurveyPointMixin._SRID", "def srs(self):\n if HAS_GDAL:\n if hasattr(self, '_srs'):\n # Returning a clone of the cached SpatialReference object.\n return self._srs.clone()\n else:\n # Attempting to cache a Spa...
[ "0.686706", "0.65671414", "0.62904024", "0.6243877", "0.6228892", "0.5941888", "0.58783215", "0.5868545", "0.58193594", "0.57678574", "0.57584834", "0.57102376", "0.5627976", "0.55917823", "0.55889064", "0.55837923", "0.5579493", "0.5547355", "0.55289334", "0.55194235", "0.55...
0.7563923
0
Returns the centroid of the geometry. Returns PointValue The centroid
def centroid(self) -> PointValue: return ops.GeoCentroid(self).to_expr()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def centroid(self):\n return _property_geo(arctern.ST_Centroid, self)", "def centroid(self) -> Point[Scalar]:\n return self._context.multipoint_centroid(self)", "def centroid(self): # -> BaseGeometry:\n ...", "def centroid(self) -> Point:\n points = self.normalized_array\n ...
[ "0.825092", "0.81068456", "0.8062672", "0.80389404", "0.7984312", "0.79386777", "0.7813523", "0.77430385", "0.75754064", "0.7557029", "0.7553213", "0.7401819", "0.7374369", "0.7330661", "0.73298866", "0.7308585", "0.7282034", "0.72087103", "0.7091601", "0.70364404", "0.700589...
0.8787785
0
Transform a geometry into a new SRID.
def transform(self, srid: ir.IntegerValue) -> GeoSpatialValue: return ops.GeoTransform(self, srid).to_expr()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def warp_geometry(geom, src_crs, dst_crs):\n return shapely.geometry.shape(rasterio.warp.transform_geom(src_crs, dst_crs, shapely.geometry.mapping(geom)))", "def normalizeGeometry(geom):\n\t# Convert string GEOSGeometry object to python dict\n\tgeom = json.loads(geom)\n\n\t# Normalize longitude to range [...
[ "0.6257238", "0.60261506", "0.5838761", "0.5772709", "0.5628056", "0.55562454", "0.5554736", "0.5516171", "0.5461421", "0.5434449", "0.5407168", "0.5386802", "0.53795725", "0.5365964", "0.53004307", "0.5273985", "0.5265612", "0.52504003", "0.51611197", "0.5148603", "0.5112608...
0.60514665
1
Clip a substring from a LineString. Returns a linestring that is a substring of the input one, starting and ending at the given fractions of the total 2d length. The second and third arguments are floating point values between zero and one. This only works with linestrings.
def line_substring( self, start: ir.FloatingValue, end: ir.FloatingValue ) -> ir.LineStringValue: return ops.GeoLineSubstring(self, start, end).to_expr()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def clip(st,length):\n if len(st) > length:\n return st[:length] + \"...\"\n else:\n return st", "def linestring_segment(linestring: LineString, dist: float, threshold_length: float):\n coord_1 = linestring.interpolate(dist).coords[0]\n coord_2 = linestring.interpolate(dist + threshold_...
[ "0.57219964", "0.55839944", "0.55459213", "0.5359945", "0.5296645", "0.52570975", "0.5250844", "0.51391494", "0.5098545", "0.5098532", "0.50885856", "0.5063027", "0.49769998", "0.49678054", "0.49621388", "0.48748156", "0.4868886", "0.48605305", "0.48212624", "0.4783714", "0.4...
0.5694107
1
Aggregate a set of geometries into a union. This corresponds to the aggregate version of the PostGIS ST_Union. We give it a different name (following the corresponding method in GeoPandas) to avoid name conflicts with the nonaggregate version. Returns GeoSpatialScalar Union of geometries
def unary_union(self) -> ir.GeoSpatialScalar: return ops.GeoUnaryUnion(self).to_expr().name("union")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def unary_union(self):\n return GeoSeries(arctern.ST_Union_Aggr(self))", "def union(self, other):\n return self._geomgen(capi.geom_union, other)", "def union(feature):\n\n mp = MultiPolygon([Polygon([tuple(z) for z in y]) for y in feature.coord])\n union = ops.unary_union(mp)\n ...
[ "0.7116073", "0.680238", "0.6797811", "0.65559477", "0.6409281", "0.63266087", "0.62877876", "0.6236714", "0.60303354", "0.59023213", "0.587915", "0.5870682", "0.57423186", "0.5735903", "0.5733056", "0.57152426", "0.56981426", "0.567216", "0.5625306", "0.5607658", "0.55898374...
0.74620515
0
we use Augmentor lib a pipeline of augment no params input
def augment(): print("augmenting......") path1 = '../trainp1/' path2 = '../trainp2/' # path of pair1 and pair2 similar to img & mask task for segmentation p = Augmentor.Pipeline(path1) # pair1 p.ground_truth(path2) # pair2 p.rotate(probability=0.3, max_left_rotation=3, max_right_rotation=3...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_augmenter():\n\n augmenter = iaa.Sequential([\n iaa.Fliplr(0.5), # horizontal flips\n iaa.Crop(percent=(0, 0.1)), # random crops\n # Small gaussian blur with random sigma between 0 and 0.5.\n # But we only blur about 50% of all images.\n iaa.Sometimes(\n 0.5,\n iaa.GaussianB...
[ "0.7002257", "0.69078076", "0.6759206", "0.6475627", "0.6423094", "0.63598675", "0.6343083", "0.6312717", "0.6299603", "0.6285816", "0.6077885", "0.6050642", "0.6006987", "0.5946956", "0.5934204", "0.59325135", "0.5847552", "0.5737056", "0.57130325", "0.5700653", "0.56733465"...
0.700342
0
Command line interface for the ``rsyncsystembackup`` program.
def main(): # Initialize logging to the terminal and system log. coloredlogs.install(syslog=True) # Parse the command line arguments. context_opts = dict() program_opts = dict() dest_opts = dict() try: options, arguments = getopt.gnu_getopt(sys.argv[1:], 'bsrm:c:t:i:unx:fvqhVQp', [ ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def main():\n # Initialize logging to the terminal and system log.\n coloredlogs.install(syslog=True)\n # Parse the command line arguments.\n context_opts = dict()\n program_opts = dict()\n dest_opts = dict()\n try:\n options, arguments = getopt.gnu_getopt(sys.argv[1:], 'bsrm:c:t:i:unx:...
[ "0.64647496", "0.62548107", "0.6175569", "0.61126995", "0.59780735", "0.5970921", "0.59538436", "0.59538436", "0.59447503", "0.589895", "0.5860152", "0.5860152", "0.5860152", "0.5860152", "0.5860152", "0.5860152", "0.5860152", "0.5860152", "0.5860152", "0.5860152", "0.5860152...
0.6710343
0
Explicitly enable an action and disable other implicit actions.
def enable_explicit_action(options, explicit_action): options[explicit_action] = True for implicit_action in 'backup_enabled', 'snapshot_enabled', 'rotate_enabled': if implicit_action != explicit_action: options.setdefault(implicit_action, False)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async def handle_action(**kwargs):\n name = kwargs[NAME]\n automation = automations[name]\n enabled = kwargs.get(ENABLED, not automation.enabled)\n if enabled:\n automation.enable()\n else:\n automation.disable()", "def _set_action_enabled(self, action, in...
[ "0.68049055", "0.659966", "0.6064936", "0.6064936", "0.6064936", "0.6064936", "0.6064936", "0.6064936", "0.60206616", "0.6017531", "0.59906226", "0.5845024", "0.584325", "0.5837786", "0.58313227", "0.57796824", "0.57416296", "0.5723639", "0.57153755", "0.57153755", "0.5715375...
0.7606623
0
Return the Courses that the given user is an instructor for. Returns a QuerySet.
def faculty_courses_for_user(user): return Course.objects.filter(faculty_group__in=user.groups.all())
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_enrollments_for_courses_in_program(user, program):\n course_keys = [\n CourseKey.from_string(key)\n for key in course_run_keys_for_program(program)\n ]\n return CourseEnrollment.objects.filter(\n user=user,\n course_id__in=course_keys,\n mode__in=[CourseMode.VERI...
[ "0.6672383", "0.64765507", "0.63457346", "0.62248945", "0.5967342", "0.5896697", "0.58316165", "0.5775987", "0.5749575", "0.5679381", "0.5674233", "0.56352746", "0.5620008", "0.56027764", "0.55914146", "0.55296856", "0.5508865", "0.5476848", "0.5475611", "0.53797096", "0.5378...
0.7003235
0
Return True if the given user is a faculty member on any courses.
def is_faculty(user): return Affil.objects.filter(user=user).exists() or \ faculty_courses_for_user(user).exists()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_faculty():\n return _is_member('uw_faculty')", "def is_member(user: User) -> bool:\n if not user:\n raise TypeError('user should not be None')\n return user.name.startswith('L')", "def registered_for_course(course, user):\r\n if user is None:\r\n return False\r\n if user.is_...
[ "0.8120491", "0.68026584", "0.67830014", "0.672673", "0.66688967", "0.6633363", "0.65973413", "0.65743434", "0.65683174", "0.65278286", "0.65211505", "0.65073335", "0.6498223", "0.64772063", "0.6369451", "0.6323724", "0.6298432", "0.6294453", "0.627507", "0.62634844", "0.6256...
0.8662211
0
Handles GET /caps/mba request.
def get(): mba_info = caps.mba_info() res = { 'clos_num': mba_info['clos_num'], 'mba_enabled': mba_info['enabled'], 'mba_bw_enabled': mba_info['ctrl_enabled'] } return res, 200
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get():\n\n mba_ctrl_info = caps.mba_ctrl_info()\n\n res = {\n 'supported': mba_ctrl_info['supported'],\n 'enabled': mba_ctrl_info['enabled']\n }\n return res, 200", "def get_capsules(method=\"\"):\n return _get(\"capsules\", method)", "def get_capsule_pa...
[ "0.6530153", "0.51816005", "0.5091409", "0.5058398", "0.5054771", "0.50249", "0.5006124", "0.50048274", "0.49493545", "0.49234304", "0.48639435", "0.48049432", "0.48024124", "0.4788288", "0.47755444", "0.4756501", "0.47273806", "0.4724545", "0.47114536", "0.47101882", "0.4708...
0.7371121
0
Handles HTTP /caps/mba_ctrl request. Retrieve MBA CTRL capability and current state details
def get(): mba_ctrl_info = caps.mba_ctrl_info() res = { 'supported': mba_ctrl_info['supported'], 'enabled': mba_ctrl_info['enabled'] } return res, 200
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get():\n\n mba_info = caps.mba_info()\n\n res = {\n 'clos_num': mba_info['clos_num'],\n 'mba_enabled': mba_info['enabled'],\n 'mba_bw_enabled': mba_info['ctrl_enabled']\n }\n return res, 200", "def put():\n json_data = request.get_json()\n\n...
[ "0.64376485", "0.62849987", "0.597143", "0.5640618", "0.5495004", "0.5431465", "0.5399061", "0.5399061", "0.538451", "0.53069574", "0.51636267", "0.5137286", "0.5093328", "0.50370055", "0.4995253", "0.49621525", "0.49619934", "0.49399295", "0.49174848", "0.4887582", "0.488758...
0.752214
0
Handles PUT /caps/mba_ctrl request. Raises BadRequest, InternalError
def put(): json_data = request.get_json() # validate request try: schema, resolver = ConfigStore.load_json_schema('modify_mba_ctrl.json') jsonschema.validate(json_data, schema, resolver=resolver) except (jsonschema.ValidationError, OverflowError) as error: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get():\n\n mba_ctrl_info = caps.mba_ctrl_info()\n\n res = {\n 'supported': mba_ctrl_info['supported'],\n 'enabled': mba_ctrl_info['enabled']\n }\n return res, 200", "def put():\n json_data = request.get_json()\n\n # validate request\n try...
[ "0.58559453", "0.5305376", "0.49763685", "0.49655056", "0.48763028", "0.4748014", "0.4734404", "0.4720664", "0.4719354", "0.46167174", "0.46100092", "0.46091127", "0.45844567", "0.4547084", "0.45449957", "0.45313764", "0.45261696", "0.45176327", "0.44819385", "0.44819385", "0...
0.8299291
0
Handles PUT /caps/rdt_iface request. Raises BadRequest, InternalError
def put(): json_data = request.get_json() # validate request try: schema, resolver = ConfigStore.load_json_schema('modify_rdt_iface.json') jsonschema.validate(json_data, schema, resolver=resolver) except (jsonschema.ValidationError, OverflowError) as error: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def put(self, id):\n context = request.environ.get('context')\n net_obj = dbapi.net_interfaces_update(context, id, request.json)\n return jsonutils.to_primitive(net_obj), 200, None", "def post_logical_interface_update(self, resource_id, resource_dict):\n pass", "def put(self, path, ...
[ "0.56267", "0.5597621", "0.5405904", "0.5289383", "0.52798593", "0.5218039", "0.5103825", "0.5088581", "0.50078917", "0.49717864", "0.49103323", "0.48853874", "0.48777813", "0.48709217", "0.4857238", "0.48350698", "0.48349154", "0.48155966", "0.481546", "0.4790912", "0.470445...
0.77151966
0
Handles GET /caps/l3ca request.
def get(): l3ca_info = caps.l3ca_info() res = { 'cache_size': l3ca_info['cache_size'], 'cw_size': l3ca_info['cache_way_size'], 'cw_num': l3ca_info['cache_ways_num'], 'clos_num': l3ca_info['clos_num'], 'cdp_supported': l3ca_info['cdp_supported...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get():\n\n l2ca_info = caps.l2ca_info()\n\n res = {\n 'cache_size': l2ca_info['cache_size'],\n 'cw_size': l2ca_info['cache_way_size'],\n 'cw_num': l2ca_info['cache_ways_num'],\n 'clos_num': l2ca_info['clos_num'],\n 'cdp_supported': l2ca_info[...
[ "0.5966446", "0.5155168", "0.4879287", "0.48043147", "0.47750655", "0.47078097", "0.46504328", "0.46455023", "0.45808417", "0.45062843", "0.448553", "0.44760966", "0.4447042", "0.44376257", "0.44348007", "0.44266585", "0.4421145", "0.44187596", "0.4409453", "0.43902916", "0.4...
0.70944744
0
Handles GET /caps/l2ca request.
def get(): l2ca_info = caps.l2ca_info() res = { 'cache_size': l2ca_info['cache_size'], 'cw_size': l2ca_info['cache_way_size'], 'cw_num': l2ca_info['cache_ways_num'], 'clos_num': l2ca_info['clos_num'], 'cdp_supported': l2ca_info['cdp_supported...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get():\n\n l3ca_info = caps.l3ca_info()\n\n res = {\n 'cache_size': l3ca_info['cache_size'],\n 'cw_size': l3ca_info['cache_way_size'],\n 'cw_num': l3ca_info['cache_ways_num'],\n 'clos_num': l3ca_info['clos_num'],\n 'cdp_supported': l3ca_info[...
[ "0.602012", "0.5277708", "0.516976", "0.5158889", "0.5059789", "0.48698944", "0.4850678", "0.4820371", "0.4746068", "0.47289932", "0.47201055", "0.46725905", "0.46474597", "0.46150905", "0.46101293", "0.45349264", "0.4530791", "0.45228612", "0.4502531", "0.44954225", "0.44949...
0.706472
0
Makes call to regulations.gov and retrieves the docket data
def get_docket_data(api_key, docket_id): LOGGER.info('Requesting docket from regulations.gov') response = requests.get("https://api.data.gov:443/" + "regulations/v3/docket.json?api_key=" + api_key + "&docketId=" + ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def fetch_fuel_data():\n\treturn requests.get('http://www.fueleconomy.gov/ws/rest/fuelprices').text", "def get_drought_data():\n\n # Base URL for the DM homepage & AJAX URL for simulated request\n url = 'http://droughtmonitor.unl.edu/MapsAndData/GISData.aspx'\n ajax_url = 'http://droughtmonitor.unl.edu/...
[ "0.57028055", "0.55154437", "0.5410844", "0.53428996", "0.52849644", "0.5160819", "0.5140988", "0.5138486", "0.51381844", "0.51164", "0.5108496", "0.50709546", "0.50521857", "0.50167906", "0.50145507", "0.5009793", "0.49903554", "0.498991", "0.49887833", "0.49823773", "0.4975...
0.6692245
0
Delete a page in a wiki
def delete(self, request, slug, page_name): try: wiki = Wiki.objects.get(slug=slug) except Wiki.DoesNotExist: error_msg = "Wiki not found." return api_error(status.HTTP_404_NOT_FOUND, error_msg) username = request.user.username if wiki.username != use...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def wiki_page_deleted(self, page):\n if 'wiki' not in self.sources:\n return\n gnp = GrowlNotificationPacket(notification='wiki',\n title='Page deleted',\n description=self._wiki_repr(page))\n gs = GrowlSender...
[ "0.73903525", "0.7082593", "0.6932861", "0.6923126", "0.68809664", "0.68542206", "0.6704106", "0.6495157", "0.6459959", "0.6402674", "0.6377859", "0.6369086", "0.61840576", "0.6173155", "0.6167322", "0.61456627", "0.6114908", "0.60865897", "0.6069235", "0.60479736", "0.602948...
0.7459889
0
Given a stream to read from, return the parsed representation. Should return parsed data, or a `DataAndFiles` object consisting of the parsed data and files.
def parse(self, stream, media_type=None, parser_context=None): encoding = parser_context.get('encoding', settings.DEFAULT_CHARSET) decoded_stream = codecs.getreader(encoding)(stream) raw_body = decoded_stream.read() request = parser_context.get('request') setattr(request, 'raw_bo...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def read(self, stream):\n ret = json.load(stream)\n self.validate(ret)\n self.stringify(ret)\n return (ret, self.make_order(ret))", "def parse(self, stream, media_type=None, parser_context=None):\n encoding = parser_context.get('encoding', settings.DEFAULT_CHARSET)\n decoded_stream = co...
[ "0.6511268", "0.6476624", "0.621487", "0.6108035", "0.60876954", "0.6072599", "0.6060378", "0.6004329", "0.58978724", "0.5818257", "0.57974905", "0.57835144", "0.5779077", "0.5756727", "0.57229155", "0.57175076", "0.57150435", "0.56804425", "0.56538576", "0.56527823", "0.5649...
0.7039589
0
Creates an email with no attachement.
def generate_withno_attachement(sender, recipient, subject, body): # Basic Email formatting message = email.message.EmailMessage() message["From"] = sender message["To"] = recipient message["Subject"] = subject message.set_content(body) return message
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _create_email(\n to_field=\"to_user@test1.com\",\n from_field=\"from_user@test2.com\",\n subject=\"This is a test email\",\n body=\"Almost empty text message\",\n attachment=None,\n maintype=None,\n subtype=None,\n):\n msg = EmailMessage()\n\n msg['To'] = to_field\n msg['From'] = ...
[ "0.6983128", "0.65120506", "0.62612367", "0.622603", "0.61640054", "0.6127693", "0.59721655", "0.5970866", "0.5969491", "0.5878382", "0.5856451", "0.58348465", "0.5808649", "0.57627016", "0.5760926", "0.5755286", "0.57515126", "0.5740511", "0.5706194", "0.5683221", "0.5677282...
0.8021318
0
Sends the message to the configured SMTP server.
def send(message): mail_server = smtplib.SMTP('localhost') mail_server.send_message(message) mail_server.quit()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def send_message(self, message:str):\n context = ssl.create_default_context()\n with smtplib.SMTP_SSL(self.smtp_server, self.port, context=context) as self.server:\n self.server.login(self.user, password)\n self.server.sendmail(self.user, self.recipient, message)", "def send(s...
[ "0.75489813", "0.752796", "0.75139153", "0.7477795", "0.74659395", "0.7392813", "0.7332846", "0.71724397", "0.71238166", "0.71103996", "0.71020424", "0.70806277", "0.703991", "0.7000265", "0.69934726", "0.6977711", "0.69750607", "0.6926411", "0.6919089", "0.69188124", "0.6908...
0.76511276
0
Write interesting attributes from a ServiceInfo to the log. Information written depends on the log level, basic info is written w/ log level INFO, if the log level is DEBUG more the basic info plus more (all properties) is written w/ log level DEBUG.
def log_serviceinfo(logger, info): try: debugging = logger.isEnabledFor(logging.DEBUG) log_level = logging.INFO log_info = {'name': info.name, 'address': socket.inet_ntoa(info.addresses[0]), 'port': info.port} log_hdr = "\n {address}:{port} ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def log_info(info_dict):\n pass", "def log_info(self, line):\n logging.info(\"Telemetry Logger - %s\" % line)", "def log_info(info):\n log = open(log_path, 'a+')\n log.write(info + '\\n')\n log.close()", "def logInfo(self, timestamp, info):\n self.logs['messages'].write(','.join([st...
[ "0.5978037", "0.55530024", "0.53744555", "0.53507626", "0.5314723", "0.52885777", "0.52751833", "0.5254027", "0.5177724", "0.515748", "0.5137067", "0.51125574", "0.5083731", "0.5079099", "0.50736225", "0.5057875", "0.5031719", "0.50247157", "0.5020744", "0.49925062", "0.49780...
0.7036564
0
Announce our shares via Zeroconf.
def __init__(self, logger): self.share_names = [] self.share_info = [] self.logger = logger self.rz = zeroconf.Zeroconf() self.renamed = {} old_titles = self.scan() address = socket.inet_aton(config.get_ip()) port = int(config.getPort()) logger.inf...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def arp_announce(self):\n pass", "def test_show_nas_share(self):\n pass", "def announceGenerate(self):", "def test_show_nas_share_by_nas(self):\n pass", "def test_update_nas_share(self):\n pass", "def _announceContainers(self):\n pass", "def createPublicNfsShare(self,...
[ "0.63648856", "0.56986153", "0.558674", "0.5581721", "0.55010027", "0.5460141", "0.54527074", "0.5437008", "0.5336524", "0.5284157", "0.52205145", "0.5189006", "0.51136243", "0.50331676", "0.5020038", "0.5010464", "0.49890482", "0.49731845", "0.49262094", "0.4919421", "0.4916...
0.67490685
0
Look for TiVos using Zeroconf.
def scan(self): VIDS = '_tivo-videos._tcp.local.' names = [] self.logger.info('Scanning for TiVos...\n') # Get the names of servers offering TiVo videos browser = zeroconf.ServiceBrowser(self.rz, VIDS, None, ZCListener(names, logger=self.logger)) # Give them a second (...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def tempest_ceph_services_tun(self):\n self.helper_ceph_services('tun')", "def test_get_system(self):\n pass", "def main():\n\n args = GetArgs()\n if args.password:\n password = args.password\n else:\n password = getpass.getpass(prompt='Enter password for host %s and user %...
[ "0.5364275", "0.5249664", "0.5161627", "0.5127778", "0.50975037", "0.50634813", "0.5058263", "0.5044416", "0.4960539", "0.49410504", "0.49074653", "0.48924124", "0.48650116", "0.4830773", "0.48301288", "0.48240846", "0.48059678", "0.48059678", "0.48059678", "0.48059678", "0.4...
0.66688216
0
Exchange beacons, and extract the machine name.
def get_name(self, address): our_beacon = self.format_beacon('connected', False) machine_name = re.compile('machine=(.*)\n').search try: tsock = socket.socket() tsock.connect((address, 2190)) self.send_packet(tsock, our_beacon) tivo_beacon = self....
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async def get_beacons(self):\n try:\n return await self._get_gist_data(comm_type='beacon')\n except Exception:\n self.log.debug('Receiving beacons over c2 (%s) failed!' % self.__class__.__name__)\n return []", "async def handle_beacons(self, beacons):\n for b...
[ "0.53489196", "0.522713", "0.51454145", "0.50426984", "0.46323082", "0.45568532", "0.45388705", "0.4519607", "0.45112652", "0.45094717", "0.45000902", "0.44978198", "0.4472048", "0.4472048", "0.44657722", "0.44152695", "0.44033462", "0.43702632", "0.43686807", "0.43647823", "...
0.5799272
0
Returns the current power in watts on a desired channel
def get_power(self, channel): power = self.device.query(f':POW{channel}:VAL?') return float(power)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_power(self) -> float:\n\n #:READ[n][:CHANnel[m]][:SCALar]: POWer[:DC]?\n return float(self._inst.query(\":READ:POW?\"))", "def get_power(self):\r\n return self._api.get_power()", "def getWatts(self):\n return self.json_state.get(\"charging\").get(\"watt_power\")", "def get...
[ "0.7491432", "0.73327", "0.7195306", "0.71075034", "0.7105397", "0.70822215", "0.7051447", "0.7042748", "0.7009171", "0.70017534", "0.69192004", "0.69192004", "0.6893051", "0.6834603", "0.68033", "0.67342967", "0.6730003", "0.6683369", "0.6609198", "0.6457663", "0.6411739", ...
0.8137549
0
Use configparser to load ini_file into self.config
def __init__(self, ini_file): self.config = configparser.ConfigParser() self.config.read(ini_file) #print(self.config)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, ini_file):\n self.config = configparser.ConfigParser()\n self.config.read(ini_file)", "def parse_ini(self):\r\n cp = SafeConfigParser(defaults=self.DEFAULTS)\r\n if self.filenames['ini'] is not None:\r\n cp.read(self.filenames['ini'])\r\n return cp...
[ "0.83436626", "0.7763483", "0.75989544", "0.752344", "0.7485136", "0.7407618", "0.7354351", "0.7283953", "0.7280698", "0.7256217", "0.72532433", "0.7218413", "0.7164233", "0.71115434", "0.7076736", "0.7010528", "0.70052344", "0.6945134", "0.69198495", "0.68875235", "0.6865842...
0.81050164
1
Return the number of sections in the ini file.
def number_of_sections(self): #print (len(self.config.sections())) return len(self.config.sections())
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def number_of_sections(self):\n sections = self.config.sections()\n return len(sections)", "def sections(self) -> int:\n return len(self.string.split(\".\"))", "def testSectionCount(self):\n\n self.sectionCount(3640)", "def getSectionIndex(self) -> int:\n ...", "def file_...
[ "0.79689074", "0.74084735", "0.6703189", "0.61651725", "0.61540675", "0.6144179", "0.606634", "0.60374355", "0.5971765", "0.59619844", "0.5946345", "0.59424305", "0.5894277", "0.58499515", "0.58399177", "0.58327585", "0.5830617", "0.58236206", "0.5805731", "0.58001965", "0.57...
0.80345184
0
Return a list of environments (= "envlist" attribute of [tox] section)
def environments(self): envs = self.config["tox"]["envlist"] #result = re.split("[^a-zA-Z0-9]", envs) result = re.split(r'\n| ,|,', envs) #print ([string for string in result if string != ""]) result = (([string.strip() for string in result if string != ""])) print(list(d...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def environments(self):\n env_txt = self.config[\"tox\"][\"envlist\"]\n env_lst_raw = env_txt.strip().replace(\"\\n\",\",\").split(\",\")\n env_lst = [x.strip() for x in env_lst_raw if x != \"\"]\n return env_lst", "def get_all_environments():\n return ENVIRONMENTS", "def envs():...
[ "0.8490215", "0.76675767", "0.7466307", "0.74636424", "0.70641226", "0.70295143", "0.69092244", "0.6908665", "0.67778206", "0.6665895", "0.6590437", "0.6576218", "0.65429485", "0.65250677", "0.6523051", "0.65151244", "0.65044487", "0.64991295", "0.64786613", "0.6424447", "0.6...
0.8205622
1
Return a list of all basepython across the ini file
def base_python_versions(self): result = [] #print("HELLO?") #print (len(self.config.sections())) for section in self.config.sections(): #print(self.config.options(section)) for part in self.config[section]: if part == "basepython": ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def base_python_versions(self):\n sections = self.config.sections()\n bp_set = set()\n for section in sections:\n if \"basepython\" in self.config[section]:\n bp = self.config[section][\"basepython\"]\n bp_set.add(bp)\n return list(bp_set)", "d...
[ "0.7340574", "0.6669972", "0.6395513", "0.6079625", "0.5901388", "0.5851641", "0.5810437", "0.5688062", "0.56150764", "0.5586401", "0.5571002", "0.55457985", "0.5521257", "0.54795694", "0.54672885", "0.54662114", "0.5465213", "0.54544663", "0.54446226", "0.54256517", "0.54218...
0.75692475
0
Update and return an object. This is a thin wrapper around the findAndModify_ command. The positional arguments are designed to match the first three arguments
def find_and_modify(self, query={}, update=None, upsert=False, sort=None, **kwargs): if (not update and not kwargs.get('remove', None)): raise ValueError("Must either update or remove") if (update and kwargs.get('remove', None)): raise ValueError("Can't do both update and...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def find_and_modify(self, cls, *args, **kwargs):\n\n decorate = kwargs.pop('decorate', None)\n if self.autoflush:\n self.flush()\n m = mapper(cls)\n obj = self.impl.find_and_modify(m.collection, *args, **kwargs)\n if obj is None: return None\n cursor = ODMCursor...
[ "0.75251395", "0.63186234", "0.62915385", "0.62504715", "0.62350994", "0.61769533", "0.6068322", "0.604922", "0.59849715", "0.595233", "0.5935577", "0.5917528", "0.5917528", "0.5917528", "0.59154737", "0.5905923", "0.5905923", "0.5905923", "0.5905923", "0.5905923", "0.5905923...
0.7273801
1
Get a list of distinct values for `key` among all documents in this collection.
def distinct(self, key): return self.database.command({'distinct': self.name, 'key': key})['values']
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def find_distinct(self, collection, key):\n obj = getattr(self.db, collection)\n result = obj.distinct(key)\n return result", "def getall(self, key):\n return self.values.get(key, [])", "async def get_all(self, key: datastore.Key) -> RV:\n\t\treturn await (await self.get(key)).colle...
[ "0.6683744", "0.6641708", "0.6641306", "0.6383321", "0.62784886", "0.61069864", "0.6057863", "0.60040236", "0.5974263", "0.5915189", "0.58046377", "0.5777479", "0.5773848", "0.5760654", "0.5703736", "0.5653801", "0.56428313", "0.56197447", "0.5613837", "0.5603023", "0.5600389...
0.8222723
0
Insert a document or documents into this collection.
def insert(self, doc_or_docs): return self.database.connection.request.insert_documents( self.database.name, self.name, doc_or_docs)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def insert(self, data):\n return self.collection.insert(data)", "def insert_documents(self, database, collection, doc_or_docs):\n validators.check_documents_to_insert(doc_or_docs)\n r = self.__get_response(settings.INS_DOCS,\n {\"db\": database, \"col\": collection}, data=doc_or_d...
[ "0.742801", "0.73531365", "0.699744", "0.6972718", "0.6788306", "0.6659301", "0.65745", "0.6541688", "0.6511618", "0.6510872", "0.6499058", "0.6496551", "0.6489356", "0.64245105", "0.6365389", "0.6357426", "0.63096535", "0.6292675", "0.62807304", "0.62685513", "0.6178108", ...
0.7562972
0
Update a document or documents into this collection.
def update(self, spec, document, upsert=False, multi=False): return self.database.connection.request.update_documents( self.database.name, self.name, spec, document, upsert, multi)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update_documents(self, database, collection, spec, doc_or_docs, upsert,\n multi):\n validators.check_document_to_update(doc_or_docs)\n r = self.__get_response(settings.UPD_DOCS,\n {\"db\": database, \"col\": collection},\n data=doc_or_docs, q=spec, m=multi, u=upsert)\...
[ "0.7344931", "0.7210694", "0.7126921", "0.69508326", "0.69400084", "0.6855809", "0.685467", "0.683156", "0.6809697", "0.6797412", "0.67653096", "0.6735676", "0.6715537", "0.66198725", "0.66006666", "0.65405786", "0.6447487", "0.64346045", "0.64316946", "0.63662523", "0.635386...
0.7591059
0
Remove a document or documents into this collection.
def remove(self, spec_or_id=None): if isinstance(spec_or_id, ObjectId) or \ isinstance(spec_or_id, basestring): return self.database.connection.request.delete_document( self.database.name, self.name, spec_or_id) if not spec_or_id: spec_or_id = {} ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def remove(self, document):\n return self.db.pop(document['id'], None)", "async def remove_doc(self, *args, **kwargs):\n pass", "def remove(self, query: dict, limit: Optional[int] = 0) -> None:\n\n matches = self.find(query, limit)\n for match in matches:\n self._db[\"doc...
[ "0.7030107", "0.70286924", "0.66033906", "0.64376163", "0.641092", "0.62891567", "0.62752926", "0.62752926", "0.62752926", "0.62752926", "0.62752926", "0.62752926", "0.62752926", "0.62752926", "0.62752926", "0.62752926", "0.62752926", "0.62752926", "0.62752926", "0.62752926", ...
0.7208417
0
Returns a "real" Project object. The returned object is "writable" too that is its state can be changed etc.
def real_obj(self): return RemoteProject(xml_data=etree.tostring(self))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def project(self, project_id):\r\n return p.Project(self, project_id)", "def project(project_no_init: Project) -> Project:\n from pdm.cli.utils import merge_dictionary\n\n data = {\n \"project\": {\n \"name\": \"test-project\",\n \"version\": \"0.0.0\",\n \"de...
[ "0.76120716", "0.7492247", "0.73942703", "0.71796495", "0.7143161", "0.7013733", "0.70007664", "0.6964538", "0.69511306", "0.6901069", "0.68862545", "0.68084615", "0.6767753", "0.6767753", "0.6767753", "0.6767753", "0.6767753", "0.67560315", "0.6730307", "0.67096895", "0.6690...
0.7535224
1
Returns a Collection with objects which match the xpath. path is the remote path which is used for the http request. xp is the xpath which is used for the search (either an Expression object or a string).
def _find(path, xp, tag_class={}, **kwargs): request = Osc.get_osc().get_reqobj() xpath = xp if hasattr(xp, 'tostring'): xpath = xp.tostring() f = request.get(path, match=xpath, **kwargs) return fromstring(f.read(), **tag_class)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def find(self, path, root=None):\n\n root = root if root is not None else self.root\n return root.xpath(path, namespaces=self.nsmap) or []", "def findall(self, path: str, namespaces: Optional[NamespacesType] = None) -> List[E]:\n path = _REGEX_TAG_POSITION.sub('', path.strip()) # Strip tags...
[ "0.57604206", "0.54872465", "0.54560804", "0.5449077", "0.53759116", "0.5275861", "0.5176571", "0.51548195", "0.51258445", "0.50880694", "0.5071189", "0.505888", "0.50456196", "0.50447965", "0.50162345", "0.5004446", "0.5002337", "0.5001135", "0.49842414", "0.49813622", "0.49...
0.61770296
0
Returns a RequestCollection with objects which match the xpath. xp is the xpath which is used for the search (either an Expression object or a string).
def find_request(xp, **kwargs): path = '/search/request' if 'schema' not in kwargs: kwargs['schema'] = RequestCollection.SCHEMA tag_class = {'collection': RequestCollection, 'request': RORequest} return _find(path, xp, tag_class, **kwargs)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def elements(xpath_selection):\n driver = Driver().connect()\n return driver.find_elements_by_xpath(xpath_selection)", "def _find(path, xp, tag_class={}, **kwargs):\n request = Osc.get_osc().get_reqobj()\n xpath = xp\n if hasattr(xp, 'tostring'):\n xpath = xp.tostring()\n f = request.get...
[ "0.5570661", "0.53328407", "0.5145625", "0.51360446", "0.51189804", "0.5032274", "0.49823588", "0.49291036", "0.49249616", "0.48981836", "0.48864037", "0.48758155", "0.4858352", "0.47892767", "0.47724596", "0.470658", "0.4663911", "0.46564332", "0.46533957", "0.4639455", "0.4...
0.5768637
0
Returns a ProjectCollection with objects which match the xpath. xp is the xpath which is used for the search (either an Expression object or a string).
def find_project(xp, **kwargs): path = '/search/project' if 'schema' not in kwargs: kwargs['schema'] = ProjectCollection.SCHEMA tag_class = {'collection': ProjectCollection, 'project': ROProject} return _find(path, xp, tag_class, **kwargs)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def elements(xpath_selection):\n driver = Driver().connect()\n return driver.find_elements_by_xpath(xpath_selection)", "def find_package(xp, **kwargs):\n path = '/search/package'\n if 'schema' not in kwargs:\n kwargs['schema'] = PackageCollection.SCHEMA\n tag_class = {'collection': PackageC...
[ "0.5264987", "0.5037761", "0.5019994", "0.49843824", "0.49831843", "0.49377376", "0.4897356", "0.48519707", "0.4850672", "0.48110655", "0.47897774", "0.4785051", "0.4735383", "0.4722277", "0.47054696", "0.45902702", "0.45883238", "0.4580754", "0.45582223", "0.45063794", "0.44...
0.6296943
0
Returns a PackageCollection with objects which match the xpath. xp is the xpath which is used for the search (either an Expression object or a string).
def find_package(xp, **kwargs): path = '/search/package' if 'schema' not in kwargs: kwargs['schema'] = PackageCollection.SCHEMA tag_class = {'collection': PackageCollection, 'package': ROPackage} return _find(path, xp, tag_class, **kwargs)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_packages(xml, ns):\r\n execs = []\r\n for x in xml.iter():\r\n if x.xpath('./SSIS:PackageMetaData', namespaces = ns):\r\n for x_exec in x:\r\n execs.append(x_exec)\r\n\r\n return execs", "def elements(xpath_selection):\n driver = Driver().connect()\n return...
[ "0.57963234", "0.5450684", "0.5410452", "0.5273573", "0.5228217", "0.5190546", "0.5179356", "0.5171915", "0.51098835", "0.5105376", "0.49959934", "0.49159732", "0.489464", "0.48571792", "0.48402214", "0.48206335", "0.4783399", "0.4775626", "0.47538108", "0.47523183", "0.47381...
0.63874054
0
test al_contacts.view.View.notify() with nonlist data.
def testNotifyWithNonListData(self): self.assertRaises(ViewException, self.view.notify, self.mockViews, 'Invalid Data')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def testNotifyWithValidListDate(self):\r\n self.assertEqual(self.view.notify(self.mockViews, []), None)", "def test_notify_user(self):\n foo = Foo.objects.create(name='foo', description='foo object')\n notify_users([self.user_a], foo, notification_type='foo')\n self.assertEqual(len(ma...
[ "0.77015924", "0.61490875", "0.608443", "0.6079039", "0.60519356", "0.60519356", "0.60217476", "0.60056156", "0.5996854", "0.592306", "0.59182304", "0.5905801", "0.57024175", "0.56915534", "0.56626695", "0.56549096", "0.5612467", "0.5543305", "0.55374557", "0.5504479", "0.549...
0.7656733
1
test al_contacts.view.View.notify() with valid list data.
def testNotifyWithValidListDate(self): self.assertEqual(self.view.notify(self.mockViews, []), None)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def testNotifyWithNonListData(self):\r\n self.assertRaises(ViewException, self.view.notify, self.mockViews, 'Invalid Data')", "def receiveContactList(self, contactList):", "def test_notify_user(self):\n foo = Foo.objects.create(name='foo', description='foo object')\n notify_users([self.use...
[ "0.75171095", "0.655433", "0.6169801", "0.61209685", "0.58530337", "0.5754011", "0.5736475", "0.57315934", "0.57258004", "0.5683047", "0.567312", "0.565161", "0.55990887", "0.55708456", "0.5561683", "0.555424", "0.55427134", "0.55381984", "0.55344033", "0.55282605", "0.549888...
0.8113745
0
test String Representation On Instantiation
def testStringRepresentationOnInstantiation(self): self.assertEqual(str(self.tv), 'table')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_str():\n c = Circle(4) \n assert c.__str__() == 'Circle with radius: 4.000000'", "def test_string_representation(self):\n entry = Meal(name=\"Foo Meal\")\n self.assertEqual(str(entry), 'Foo Meal')", "def test_str(self):\n account = AccountFactory(username=\"bill\")\n ...
[ "0.74348164", "0.73944116", "0.72476286", "0.7242773", "0.7213901", "0.7211895", "0.70888114", "0.70745707", "0.70544636", "0.70401263", "0.69723976", "0.6969948", "0.69382244", "0.69192183", "0.69022226", "0.6894632", "0.6893857", "0.68858206", "0.68720406", "0.6862307", "0....
0.76065
0
Returns information about the dependencies required by this repository. The return value should be an OrderedDict if the repository supports multiple configurations (aka is configurable) or a single Configuration if not.
def GetDependencies(): # To support a single (unnamed) configuration... return Configuration( "Standard Build Environment", [ Dependency( "5C7E1B3369B74BC098141FAD290288DA", # Id for Common_Environment; found in <Common_Environment>/_...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_dependency_configurations(self):\n deps = []\n\n for variant in self.resolve_variants():\n # Note: the variants have already been resolved\n # This for loop simply needs to resolve the dependencies one\n # by one, potentially overwriding earlier ones\n name, value = next(iter(vari...
[ "0.7249918", "0.71176404", "0.6591938", "0.6591409", "0.64736134", "0.62895435", "0.6217748", "0.614492", "0.6107794", "0.59998703", "0.5892432", "0.5852836", "0.58257455", "0.5819717", "0.57458514", "0.57398283", "0.57112324", "0.5689855", "0.56824005", "0.55657053", "0.5564...
0.7559669
0
Returns an action or list of actions that should be invoked as part of the setup process. Actions are generic command line statements defined in /Libraries/Python/CommonEnvironment/v1.0/CommonEnvironment/Shell/Commands/__init__.py that are converted into statements appropriate for the current scripting language (in mos...
def GetCustomActions(debug, verbose, explicit_configurations): return []
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_available_actions() -> tuple:\n return tuple(method for method in dir(cli_commands) if callable(getattr(cli_commands, method)))", "def actions(self):\n from moztrap.view.lists.actions import actions\n return actions", "def _generate_actions(self) -> list:\n pass", "def get_ava...
[ "0.6928276", "0.6423232", "0.64215183", "0.6394122", "0.6382282", "0.63595027", "0.62756604", "0.620738", "0.6174386", "0.6174386", "0.6173213", "0.61705583", "0.6168872", "0.6168872", "0.6168872", "0.6158207", "0.6088489", "0.60616827", "0.60305166", "0.5990831", "0.5982534"...
0.69521284
0
Returns a list of each transaction profiled along with the time spent.
def showTransactions(self): self.scanTransactions() txns = [] # Summarize the stats for x in range(len(self._trans)): stats = self._trans[x] trans_time = 0 remote_calls = 0 for name, stat in stats: trans_time += stat.total_...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_profile_stats():\n return p_stats", "def profiles(self):\n with concurrent.futures.ThreadPoolExecutor(max_workers=10) as executor:\n return list(filter(lambda x: x is not None, executor.map(self.profile_details, self.profiles_names())))", "def test_wallets_get_transaction_list(self...
[ "0.5761275", "0.5728272", "0.56845474", "0.56802225", "0.567081", "0.5665692", "0.5645627", "0.5556072", "0.5549113", "0.54833037", "0.5478709", "0.5462746", "0.54535574", "0.54297113", "0.5412375", "0.54095745", "0.5403506", "0.5382719", "0.537519", "0.53725266", "0.53631335...
0.64055634
0
counts the number of infinities within a 1D matrix or list
def countInfinites(mat): isFinite = np.all(np.isfinite(mat)) if not isFinite: count = 0 indices = [] for i in range(0,len(mat)): if mat[i] in [-np.inf,np.inf]: count+=1 indices.append(i)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def numSpecial(self, mat: list[list[int]]) -> int:\n ans = 0\n col_cache = {}\n for row in mat:\n # print(row)\n ones = []\n for i, n in enumerate(row):\n if n == 1:\n ones.append(i)\n # print(ones)\n if l...
[ "0.6742529", "0.6486157", "0.6432761", "0.63083744", "0.6287594", "0.6236425", "0.6225274", "0.6219248", "0.6169383", "0.61690223", "0.6164067", "0.61547816", "0.6121042", "0.6110688", "0.6110112", "0.60931724", "0.60797334", "0.60647225", "0.6044696", "0.6028637", "0.6010755...
0.7966337
0
removes infinities from a matrix returns a matrix with the infinities replaced with the average of the matrix values
def removeInfinities(mat): isFinite = np.all(np.isfinite(mat)) if not isFinite: nrow, ncol = mat.shape matCopy = mat.copy() matReshaped = matCopy.reshape(-1) minVal = np.nanmin(matReshaped[matReshaped != -np.inf]) maxVal = max(matReshaped) #count inf...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def interpolation_matrix(m):\n return np.nanmean(m,axis=1)", "def matrix_mean(matrix):\n return sum(map(mean,matrix))", "def de_mean_matrix(a_matrix):\n nr, nc = shape(a_matrix)\n column_means, _ = scale(a_matrix)\n return make_matrix(nr, nc, lambda i, j: a_matrix[i][j] - column_means[j])", "d...
[ "0.6844182", "0.64544636", "0.6360755", "0.61718273", "0.6136079", "0.6116416", "0.61018276", "0.6037287", "0.5991986", "0.5922164", "0.58949125", "0.58504534", "0.58174664", "0.5794598", "0.57463723", "0.5705612", "0.56955564", "0.5682768", "0.5673174", "0.5667653", "0.56648...
0.7850853
0
Converts the matrix to the equivalent matrix of the unsigned 8 bit integer datatype Returns the equivalent uint8 matrix
def make8UC(mat): mat_256 = mat[:,:]# *255 mat_256.round() mat_8UC = np.uint8(mat_256) return mat_8UC
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def make8UC3(mat):\n mat_8UC = make8UC(mat)\n mat_8UC3 = np.stack((mat_8UC,)*3, axis = -1)\n \n return mat_8UC3", "def to_uint8(image):\n\tnp.clip(image, 0, 255, out=image)\n\treturn image.astype(np.uint8)", "def float32_to_uint8(inputs):\n return np.uint8(np.clip(np.round(inputs * 255), 0, 255)...
[ "0.7031675", "0.6641266", "0.62361336", "0.6099381", "0.593577", "0.59259516", "0.58690447", "0.5846691", "0.5846227", "0.57782173", "0.5744485", "0.5635741", "0.5600039", "0.5564243", "0.55328864", "0.5520065", "0.5480853", "0.5471177", "0.54408866", "0.54239094", "0.5422680...
0.7921637
0
Converts the matrix to the equivalent matrix of the unsigned 8 bit integer datatype with 3 channels Returns the equivalent uint8 matrix
def make8UC3(mat): mat_8UC = make8UC(mat) mat_8UC3 = np.stack((mat_8UC,)*3, axis = -1) return mat_8UC3
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def make8UC(mat):\n mat_256 = mat[:,:]# *255\n mat_256.round()\n mat_8UC = np.uint8(mat_256)\n \n return mat_8UC", "def float32_to_uint8(inputs):\n return np.uint8(np.clip(np.round(inputs * 255), 0, 255))", "def to_uint8(image):\n\tnp.clip(image, 0, 255, out=image)\n\treturn image.astype(np.u...
[ "0.80124557", "0.6552259", "0.65122837", "0.6258835", "0.60967845", "0.60502964", "0.6043003", "0.59487987", "0.59082747", "0.5775716", "0.5764657", "0.5682428", "0.5681985", "0.56541044", "0.5578906", "0.5575298", "0.5475508", "0.5466485", "0.5463385", "0.5410142", "0.538719...
0.78152
1
Do watershed segmentation on a non noisy binary image Returns the image with the nuclei segmented
def watershed(mask, img, plotImage = False, kernelSize = None): imgCopy = img.copy() maskCopy = np.array(mask.copy(), dtype=np.uint8) if kernelSize is None: kernelSize = 2 # Finding sure foreground area #dist_transform = cv2.distanceTransform(mask, cv2.DIST_L2, 5) #ret, sure_fg = c...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def watershed(img):\n\ttmp = img.copy()\n\tgray = cv2.cvtColor(tmp, cv2.COLOR_BGR2GRAY)\n\tret, thresh = cv2.threshold(gray, 0, 255, cv2.THRESH_BINARY_INV+cv2.THRESH_OTSU)\n\tkernel = np.ones((3,3), np.uint8)\n\topening = cv2.morphologyEx(thresh, cv2.MORPH_OPEN, kernel, iterations=2)\n\tsure_bg = cv2.dilate(openin...
[ "0.73304313", "0.69821537", "0.6795016", "0.67470026", "0.6652876", "0.65473425", "0.65426207", "0.64990574", "0.6482789", "0.647807", "0.6431419", "0.6372488", "0.6349134", "0.62908137", "0.6180611", "0.61678934", "0.61438453", "0.6135391", "0.6117248", "0.60778475", "0.6072...
0.7320055
1
Parse XML File and returns an object containing all the vertices
def parseXML(xmlFile, pattern): tree = ET.parse(xmlFile) # Convert XML file into tree representation root = tree.getroot() regions = root.iter('Region') # Extract all Regions vertices = {pattern: []} # Store all vertices in a dictionary for region in regions: label = region.get('Text...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __parse(self):\n\t\tparser=xml.sax.make_parser()\n\t\tparser.setContentHandler(OSMXMLFileParser(self))\n\t\tparser.parse(self.filename)\n\t\n\t\t# convert them back to lists\n\t\tself.nodes = self.nodes.values()\n\t\tself.ways = self.ways.values()\n\t\tself.relations = self.relations.values()", "def loadVess...
[ "0.65993637", "0.638659", "0.6165882", "0.6143035", "0.61255836", "0.6096457", "0.60697263", "0.59190804", "0.59172356", "0.588213", "0.58239716", "0.58230084", "0.58069694", "0.5771421", "0.5767745", "0.5759676", "0.57542926", "0.57433605", "0.57209617", "0.57055056", "0.569...
0.7063151
0
Calculates the ratio between the highest resolution image and lowest resolution image. Returns the ratio as a tuple (Xratio, Yratio).
def calculateRatio(levelDims): highestReso = np.asarray(levelDims[0]) lowestReso = np.asarray(levelDims[-1]) Xratio, Yratio = highestReso/lowestReso return (Xratio, Yratio)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def determine_real_to_pixel_ratio(\n image_shape: Tuple[int, int],\n min_x: float,\n min_y: float,\n max_x: float,\n max_y: float,\n):\n image_x = image_shape[1]\n image_y = image_shape[0]\n diff_x = max_x - min_x\n diff_y = max_y - min_y\n\n resolution_x = image_x / diff_x\n resol...
[ "0.72195196", "0.71032196", "0.6577099", "0.64753616", "0.6439772", "0.64074016", "0.6393361", "0.6141478", "0.6115658", "0.6099829", "0.6093291", "0.60600996", "0.6044847", "0.5948316", "0.59124255", "0.5852547", "0.57684225", "0.5760546", "0.57544696", "0.5742023", "0.57306...
0.74833775
0
Parses XML File to get mask vertices and returns matrix masks where 1 indicates the pixel is inside the mask, and 0 indicates outside the mask.
def getMask(xmlFile, svsFile, pattern): vertices = parseXML(xmlFile, pattern) # Parse XML to get vertices of mask if not len(vertices[pattern]): slide = 0 mask = 0 return slide, mask slide = open_slide(svsFile) levelDims = slide.level_dimensions mask = createMask(levelD...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def mask(self):\n mask = np.zeros((self.height, self.width))\n pts = [\n np.array(anno).reshape(-1, 2).round().astype(int)\n for anno in self.segmentation\n ]\n mask = cv2.fillPoly(mask, pts, 1)\n return mask", "def _prepare_mask_file(mask):\n result = ...
[ "0.62886024", "0.6162003", "0.60080963", "0.59190094", "0.58852595", "0.58592284", "0.58489436", "0.5744096", "0.5695545", "0.56776625", "0.5628904", "0.56098294", "0.55625856", "0.5558411", "0.55395186", "0.5523523", "0.54945314", "0.5481902", "0.5481397", "0.5474356", "0.54...
0.6738076
0
Returns [x,y] numpy array of random pixel. {numpy matrix} mask from which to choose random pixel.
def chooseRandPixel(mask): array = np.transpose(np.nonzero(mask)) # Get the indices of nonzero elements of mask. index = random.randint(0,len(array)-1) # Select a random index return array[index]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _get_rand_array(self):\n return np.random.random((self.w + 1, self.h + 1, 2))", "def _get_rand_array(self):\n return np.random.random((self.w, self.h))", "def cell_sample(mask, samplingPoints):\n maskedArea = np.array(np.where(mask)).T\n maskedAreaLength = len(maskedArea)\n randomInd...
[ "0.66753733", "0.66301894", "0.657764", "0.64053166", "0.6381481", "0.63747543", "0.6344417", "0.6315105", "0.62708867", "0.6258122", "0.6184198", "0.6177347", "0.6172799", "0.61617583", "0.6153667", "0.6137647", "0.6054718", "0.601941", "0.60083723", "0.5987019", "0.59859353...
0.8018285
0
Generates and saves 'numPatches' patches with dimension 'dims' from image 'slide' contained within 'mask'.
def getPatches(slide, mask, numPatches=0, dims=(0,0), dirPath='', slideNum='', plot=False, plotMask=False): # extractPatchByXMLLabeling w,h = dims levelDims = slide.level_dimensions Xratio, Yratio = calculateRatio(levelDims) i = 0 while i < numPatches: firstLoop = True # Boolean to en...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def collect_patches(tif, mask, lev1, lev2, num_per_img, patch_size, patch_centre, save_folder, num_random_sample):\n table=pd.DataFrame(columns=['slide_name','x','y','label'])\n # init output lists\n patch_images_lev1 = []\n patch_images_lev2 = []\n patch_labels = []\n\n num_cancer = 0\n num_h...
[ "0.62094754", "0.586022", "0.5515826", "0.5515428", "0.54270107", "0.5426682", "0.5372924", "0.5332166", "0.53296727", "0.53201824", "0.5299715", "0.5277059", "0.52504194", "0.51970434", "0.5176687", "0.5150225", "0.51451766", "0.50600135", "0.5047835", "0.504694", "0.5037898...
0.7592444
0
Return a unique name.
def unique_name(): return "unique-{0}".format(uuid.uuid4())
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def uniqueName(self):\n return \"{0}::{1}\".format(self.name(), str(self.uid))", "def unique_id(self):\r\n name_slug = slugify(self._name)\r\n return f\"{name_slug}\"", "def name(self):\n return self._unique_id", "def generate_unique_name():\n return 'titanic-' + str(get_ma...
[ "0.84412026", "0.83484423", "0.80431694", "0.8036474", "0.79056853", "0.78406745", "0.78334075", "0.7792117", "0.77658874", "0.7755335", "0.7641484", "0.7600844", "0.7589731", "0.7563908", "0.7560276", "0.7515592", "0.7508697", "0.75038445", "0.7497832", "0.74735886", "0.7468...
0.9123852
0
Mock the nuke library.
def nuke_mocker(request): m = mock.patch.dict("sys.modules", {"nuke": mock.Mock()}) m.start() request.addfinalizer(m.stop)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_package(self):\n pass", "def mock_remote_unit(monkeypatch):\n monkeypatch.setattr(\"libgitlab.hookenv.remote_unit\", lambda: \"unit-mock/0\")", "def test_stub(self):\n pass", "def mockup(cls):\n pass", "def setUp(self):\n self.dbus_mock = MagicMock()\n self.db...
[ "0.6105179", "0.607087", "0.6026963", "0.5972712", "0.5946644", "0.58715075", "0.58674854", "0.58065623", "0.58065623", "0.58065623", "0.58065623", "0.58065623", "0.58065623", "0.5782152", "0.56846625", "0.5671526", "0.5624159", "0.55935633", "0.55542195", "0.55484384", "0.55...
0.7317321
0
Mock the PySide2 library.
def pyside_mocker(request): m = mock.patch.dict("sys.modules", {"PySide2": mock.Mock()}) m.start() request.addfinalizer(m.stop)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load_PySide_QtGui(finder, module):\n from PySide import QtCore\n # Pyside.__version* is PySide version, PySide.QtCore.__version* is Qt version\n _QtGui(finder, module, QtCore.__version__)", "def load_PySide_QtCore(finder, module):\n finder.IncludeModule(\"atexit\")", "def main():\n\n log.ini...
[ "0.63506424", "0.6021899", "0.5957812", "0.5710402", "0.56602085", "0.55488366", "0.5523198", "0.5519488", "0.5501204", "0.5468531", "0.53808707", "0.5348533", "0.53077203", "0.5290195", "0.5266464", "0.52590716", "0.52429485", "0.5218564", "0.52131027", "0.5189418", "0.51836...
0.8482418
0
Lifts a function into the elevated world
def lift(cls, func): raise NotImplementedError
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update_func_world(mech, world):\n globals().update(world)\n for modkey in dir(funcs):\n mod = getattr(funcs, modkey)\n if not hasattr(mod, 'update_func_world'): continue\n mod.update_func_world(mech, world)", "def wrappedFn(*args, **kw):\n setCurrent(context)\n fn(*args, **kw...
[ "0.55809885", "0.5369843", "0.53542167", "0.53514177", "0.53293675", "0.5246924", "0.52123636", "0.5193386", "0.5180565", "0.5180341", "0.51693743", "0.5167798", "0.51637644", "0.5138282", "0.5133104", "0.50698644", "0.5064343", "0.5046755", "0.5043975", "0.5039459", "0.50215...
0.5964458
0
Get year with links
def get_year_with_links(): response = get_response(MAIN_PAGE) if response.ok: soup = BeautifulSoup(response.text, 'html.parser') years_li = soup.find_all( 'md-card-footer' ) years_dict = {} # Not including the last <a> tag because that is not relevant. ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def scrape_article_links(year: int) -> List[str]:\n # Take into considerations leap years and days when no articles are published\n pass", "def get_year(url):\n year = re.search(\"\\d{4}\", url).group(0)\n return int(year)", "async def All_orgs():\n\n links_13 = []\n links_14 = []\n valid_...
[ "0.70485425", "0.70415264", "0.6887806", "0.68229485", "0.6784531", "0.6646109", "0.6411402", "0.6376097", "0.63456386", "0.6339458", "0.62634367", "0.6259343", "0.62293506", "0.61992395", "0.6168758", "0.6096239", "0.60911524", "0.60729194", "0.6053873", "0.6046361", "0.6040...
0.79827887
0
Calculate x/y projection of RA1/Dec1 in system with center at RAcen, Deccen. Input radians.
def gnomonic_project_toxy(RA1, Dec1, RAcen, Deccen): # also used in Global Telescope Network website cosc = np.sin(Deccen) * np.sin(Dec1) + np.cos(Deccen) * np.cos(Dec1) * np.cos(RA1-RAcen) x = np.cos(Dec1) * np.sin(RA1-RAcen) / cosc y = (np.cos(Deccen)*np.sin(Dec1) - np.sin(Deccen)*np.cos(Dec1)*np.cos(...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def cartesian_coordinates(self):\n # extract RA items\n ra_hours, ra_minutes, ra_seconds = RA_RE.match(str(self.ra)).groups()\n # then cast\n ra_hours = int(ra_hours)\n ra_minutes = int(ra_minutes)\n ra_seconds = float(ra_seconds)\n\n # extract DEC items\n de...
[ "0.6103878", "0.60720265", "0.5966464", "0.5929416", "0.583443", "0.58247656", "0.5805627", "0.5766797", "0.5751981", "0.5746876", "0.56683046", "0.5656354", "0.5649699", "0.5625664", "0.5614997", "0.56088257", "0.5603104", "0.55825555", "0.5581316", "0.55377346", "0.5510478"...
0.7208224
0
Project the stars to x,y plane for a given visit.
def starsProject(stars, visit): names=['x','y','radius'] types=[float,float,float] xtemp,ytemp = gnomonic_project_toxy(np.radians(stars['ra']),np.radians(stars['decl']), visit['ra'], visit['dec']) # Rotate the field using the visit rotSkyPos. Hope I got th...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def project(self):\n def _project(point):\n return (\n point[0]/(point[2]/Window.COP_DISTANCE+1),\n point[1]/(point[2]/Window.COP_DISTANCE+1))\n\n self._points = [list(map(_project, face)) for face in self._points]", "def calcul_point_plan_projection(cls,cx,...
[ "0.5567584", "0.5320066", "0.52733254", "0.5250975", "0.52450126", "0.5238371", "0.52286285", "0.52112776", "0.5208136", "0.5184843", "0.5184538", "0.51708573", "0.51540446", "0.5112105", "0.50959843", "0.5084342", "0.5084342", "0.5084342", "0.50772774", "0.50741136", "0.5027...
0.724595
0
Assign PatchIDs to everything. Assume that stars have already been projected to x,y
def assignPatches(stars, visit, nPatches=16, radiusFoV=1.8): maxx, maxy = gnomonic_project_toxy(0., np.radians(radiusFoV), 0., 0.) nsides = nPatches**0.5 # This should move all coords to 0 < x < nsides-1 px = np.floor((stars['x'] + maxy)/(2.*maxy)*nsides) py = np.floor((stars['y'] + maxy)/(2.*max...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def extract_patch(self, patch_radius, full_x, full_y, full_i, full_j):\n com_ijs = [self.center_of_mass_ij(time) for time in self.times]\n patch_grid = []\n patch_mask = []\n patch_x = []\n patch_y = []\n patch_i = []\n patch_j = []\n for t, time in enumerate...
[ "0.596348", "0.56947297", "0.5616027", "0.557297", "0.5553619", "0.55308986", "0.55085593", "0.5400612", "0.538122", "0.53603476", "0.53538245", "0.5268745", "0.5244884", "0.52312773", "0.5227159", "0.52247417", "0.5194903", "0.5181613", "0.51150405", "0.5111688", "0.51025075...
0.6892715
0
Find the number of jumps before reaching the exit (rule 1)
def puzzle1(offsets): return find_jumps_to_exit(offsets, lambda o: o + 1)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def jumps(self, currFloor, floor):\r\n count = 0\r\n for t in self.targs:\r\n if (t > currFloor and t < floor) or (t < currFloor and t > floor):\r\n count = count + 1\r\n return count", "def puzzle2(offsets):\n return find_jumps_to_exit(offsets, lambda o: o + 1 i...
[ "0.6420323", "0.6123828", "0.60416996", "0.60376054", "0.59392315", "0.5912451", "0.5872377", "0.5807086", "0.57804805", "0.57612854", "0.57415116", "0.57337457", "0.5717321", "0.570134", "0.5666641", "0.5646191", "0.56335825", "0.5621903", "0.5615216", "0.56013274", "0.55957...
0.66415817
0
Get GFS sounding data for the given timeslot.
def get_gfs_sounding(timeslot, lat, lon, interp=None, step=200.): fname = fetch_gfs_data(timeslot, lat, lon) return read_gfs_data(fname, lat, lon, interp=interp, step=200.)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def fetch_gfs_data(timeslot, lat, lon):\n pass", "def get_sound_data(sec, freq_func, amplitude):\n t = np.linspace(0, sec, SAMPLERATE * sec)\n data = np.array(t, dtype=np.int16)\n for i in range(data.size):\n data[i] = amplitude * np.sin(2 * np.pi * quad(freq_func, 0, t[i])[0])\n return dat...
[ "0.58685505", "0.5698143", "0.53198844", "0.5312702", "0.5265088", "0.5250593", "0.5247578", "0.5088149", "0.50585455", "0.50518686", "0.5035242", "0.50214183", "0.50213265", "0.49981782", "0.49438947", "0.49307737", "0.49250743", "0.48810902", "0.4880546", "0.48561516", "0.4...
0.7687082
0
>>> m = PSYCOP() >>> m.encode_proposition("Aac") (A(x_0) > C(x_0)) >>> m.encode_proposition("Iac") (A(a_1) AND C(a_1))
def encode_proposition(self, p, hat=False): i = self.get_fresh_id() if p[0] == "A": # A(x) -> B(x) return self.Prop(self.PT.implies, self.get_atomic_proposition(p[1].upper(), i, False, hat), self.get_atomic_propo...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def prove_and_commutativity() -> Proof:\n all_lines = []\n all_lines.append(Proof.Line(Formula.parse('(p&q)')))\n all_lines.append(Proof.Line(Formula.parse('q'), AE1_RULE, [0]))\n all_lines.append(Proof.Line(Formula.parse('p'), AE2_RULE, [0]))\n all_lines.append(Proof.Line(Formula.parse('(q&p)'), A_...
[ "0.61940044", "0.5337898", "0.52257913", "0.5214563", "0.5168398", "0.516138", "0.5157602", "0.5139996", "0.5095796", "0.5051536", "0.49918026", "0.4982666", "0.49343562", "0.48973984", "0.48611212", "0.48607367", "0.48571798", "0.4817117", "0.48151308", "0.48129684", "0.4794...
0.7646737
0
Encode premises as propositions, possibly adding implicatures
def encode_premises(self, syllogism, ex_implicatures=True, grice_implicatures=False): to = sylutil.term_order(syllogism[2]) premises = [] pr = [] for i in [0, 1]: pr.append(syllogism[i] + to[i]) pr = sylutil.add_implicatures(pr, existential=ex_implicatures, gric...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def encode(self, peptides):\n raise NotImplementedError", "def to_prenex_normal_form(formula: Formula) -> Tuple[Formula, Proof]:\r\n # Task 11.10\r\n\r\n prover = Prover(Prover.AXIOMS.union(ADDITIONAL_QUANTIFICATION_AXIOMS))\r\n\r\n\r\n form, form_proof = uniquely_rename_quantified_variables(form...
[ "0.5838688", "0.5672843", "0.56586784", "0.5371028", "0.5223843", "0.5174113", "0.51273966", "0.50668716", "0.49949104", "0.49896973", "0.49739707", "0.49531832", "0.48929024", "0.4891601", "0.48232752", "0.4822193", "0.48097894", "0.48033124", "0.47871912", "0.47796017", "0....
0.7270002
0
same_nameness = True "notational variant", see p. 197 >>> m = PSYCOP() >>> a0 = m.Prop(m.PT.atomic, m.Atom("A", 0, False, False), None) >>> a1 = m.Prop(m.PT.atomic, m.Atom("A", 1, False, False), None) >>> b = m.Prop(m.PT.atomic, m.Atom("B", 2, False, False), None) >>> p1 = m.Prop(m.PT.implies, a0, b) >>> p2 = m.Prop(m....
def isomorphic(self, p1, p2, same_nameness=False): if p1 is None and p2 is None: return True if p1 is None or p2 is None: return False if type(p1) is self.Atom and type(p2) is self.Atom: if p1.predicate == p2.predicate: if same_namen...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_isomorphic_general(self):\n # check that hill formula fails are caught\n ethanol = create_ethanol()\n acetaldehyde = create_acetaldehyde()\n assert ethanol.is_isomorphic_with(acetaldehyde) is False\n assert acetaldehyde.is_isomorphic_with(ethanol) is False\n # che...
[ "0.62979865", "0.6274842", "0.6224292", "0.6149181", "0.6145336", "0.6130434", "0.5929788", "0.59002215", "0.57942015", "0.57850647", "0.56774276", "0.56770355", "0.5673986", "0.55917203", "0.55060273", "0.5470484", "0.5424346", "0.5401022", "0.5356674", "0.5350009", "0.53413...
0.75391
0
PSYCOP transitivity rule >>> m = PSYCOP() >>> i = m.get_fresh_id() >>> a = m.Prop(m.PT.atomic, m.Atom("A", i, False, False), None) >>> b = m.Prop(m.PT.atomic, m.Atom("B", i, False, False), None) >>> c = m.Prop(m.PT.atomic, m.Atom("C", i, False, False), None) >>> p1 = m.Prop(m.PT.implies, a, b) >>> p2 = m.Prop(m.PT.impl...
def rule_transitivity(self, p1, p2, domain): if p1.type == self.PT.implies and p2.type == self.PT.implies: if p1.v1.type == self.PT.atomic and p1.v2.type == self.PT.atomic and \ p2.v1.type == self.PT.atomic and p2.v2.type == self.PT.atomic: if p1.v1.v1.arg_id ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def rule_exclusivity(self, p1, p2, domain):\r\n\r\n if p1.type == self.PT.implies and p2.type == self.PT.negation:\r\n if p2.v1.type == self.PT.conjunction:\r\n if p1.v1.type == self.PT.atomic and p1.v2.type == self.PT.atomic:\r\n if p2.v1.v1.type == self.PT.atom...
[ "0.61967784", "0.6186182", "0.5359495", "0.5156224", "0.5084931", "0.5043622", "0.49144766", "0.48813945", "0.4814908", "0.48014724", "0.47573727", "0.4749955", "0.4715951", "0.46684822", "0.46408987", "0.4638725", "0.45815122", "0.45572296", "0.45256448", "0.45139882", "0.45...
0.78320956
0
PSYCOP exclusivity rule >>> m = PSYCOP() >>> i = m.get_fresh_id() >>> j = m.get_fresh_id() >>> ai = m.Prop(m.PT.atomic, m.Atom("A", i, False, False), None) >>> bi = m.Prop(m.PT.atomic, m.Atom("B", i, False, False), None) >>> bj = m.Prop(m.PT.atomic, m.Atom("B", j, False, False), None) >>> cj = m.Prop(m.PT.atomic, m.Ato...
def rule_exclusivity(self, p1, p2, domain): if p1.type == self.PT.implies and p2.type == self.PT.negation: if p2.v1.type == self.PT.conjunction: if p1.v1.type == self.PT.atomic and p1.v2.type == self.PT.atomic: if p2.v1.v1.type == self.PT.atomic and p2.v1.v2...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def rule_transitivity(self, p1, p2, domain):\r\n if p1.type == self.PT.implies and p2.type == self.PT.implies:\r\n if p1.v1.type == self.PT.atomic and p1.v2.type == self.PT.atomic and \\\r\n p2.v1.type == self.PT.atomic and p2.v2.type == self.PT.atomic:\r\n if p1...
[ "0.6254757", "0.6071033", "0.54834473", "0.5454009", "0.53239495", "0.5123699", "0.5068382", "0.50099224", "0.5007349", "0.4857696", "0.4847564", "0.48285633", "0.4740116", "0.47349322", "0.47092235", "0.46827868", "0.4668266", "0.46587437", "0.4649622", "0.46377978", "0.4580...
0.8137308
0
PSYCOP conversion rule >>> m = PSYCOP() >>> i = m.get_fresh_id() >>> a = m.Prop(m.PT.atomic, m.Atom("A", i, False, False), None) >>> b = m.Prop(m.PT.atomic, m.Atom("B", i, False, False), None) >>> p = m.Prop(m.PT.negation, m.Prop(m.PT.conjunction, a, b), None) >>> m.rule_conversion(p, set()) [NOT ((B(x_1) AND A(x_1)))]
def rule_conversion(self, p, domain): if p.type == self.PT.negation: if p.v1.type == self.PT.conjunction: if p.v1.v1.type == self.PT.atomic and p.v1.v2.type == self.PT.atomic: i = self.get_fresh_id() p_new = self.Prop(self.PT.negation, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def rule_transitivity(self, p1, p2, domain):\r\n if p1.type == self.PT.implies and p2.type == self.PT.implies:\r\n if p1.v1.type == self.PT.atomic and p1.v2.type == self.PT.atomic and \\\r\n p2.v1.type == self.PT.atomic and p2.v2.type == self.PT.atomic:\r\n if p1...
[ "0.6225471", "0.6093774", "0.6014474", "0.56270057", "0.55422795", "0.549347", "0.5387336", "0.5229568", "0.5196128", "0.5100265", "0.49939024", "0.49359933", "0.490674", "0.49049196", "0.49046978", "0.48515642", "0.48485404", "0.47913727", "0.47747165", "0.47721443", "0.4759...
0.8312214
0
Returns leftmost atom in p.
def get_leftmost_atom(self, p): if p.type == self.PT.atomic: return p.v1 else: return self.get_leftmost_atom(p.v1)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def left(self, p):\n node = self._validate(p)\n return self._make_position(node._left)", "def left(self, p):\n node = self._validate(p)\n return self._make_position(node.left)", "def left(self, p):\n node = self._validate_position(p)\n return self._make_position(node.left)", ...
[ "0.7379185", "0.73784184", "0.73633677", "0.73547095", "0.73547095", "0.7014217", "0.6914837", "0.68129015", "0.68106556", "0.6807587", "0.67974186", "0.67950267", "0.67447543", "0.67447543", "0.6734669", "0.6727005", "0.6716256", "0.6640088", "0.6608549", "0.65990144", "0.65...
0.8858748
0
a = m.Prop(m.PT.atomic, v1='a', v2=None) b = m.Prop(m.PT.atomic, v1='b', v2=None) >>> m = PSYCOP() >>> i = m.get_fresh_id() >>> a = m.Prop(m.PT.atomic, m.Atom("A", i, False, False), None) >>> b = m.Prop(m.PT.atomic, m.Atom("B", i, False, False), None) >>> prop = m.Prop(m.PT.negation, m.Prop(m.PT.conjunction, a, b), Non...
def rule_backward_conjunctive_syllogism(self, p, g): if g.type == self.PT.negation and p.type == self.PT.negation: # g = NOT(A(x)) if p.v1.type == self.PT.conjunction: # p = NOT(A(x) AND B(x)) if self.matching(p.v1.v1, g.v1): re...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_disjunct_hs():\n hs1 = LocalSpace(\"1\")\n hs2 = LocalSpace(\"2\")\n alpha, beta = symbols('alpha, beta')\n A = OperatorSymbol('A', hs=hs1)\n B = OperatorSymbol('B', hs=hs2)\n assert Commutator.create(A, B) == ZeroOperator\n assert Commutator.create(alpha, beta) == ZeroOperator\n a...
[ "0.6137344", "0.60341465", "0.5974888", "0.59086096", "0.589563", "0.57486683", "0.5693098", "0.540354", "0.5260626", "0.5234264", "0.522255", "0.516357", "0.5155492", "0.5135247", "0.5105075", "0.5066817", "0.5008767", "0.50022006", "0.4978444", "0.49776587", "0.49762285", ...
0.7656689
0
>>> m = PSYCOP() >>> i = m.get_fresh_id() >>> a = m.Prop(m.PT.atomic, m.Atom("A", i, False, False), None) >>> b = m.Prop(m.PT.atomic, m.Atom("B", i, False, False), None) >>> m.rule_backward_if_elimination(m.Prop(m.PT.implies, a, b), b) [A(x_0)]
def rule_backward_if_elimination(self, p, g): if p.type == self.PT.implies: # p = IF A(x) THEN B(x) if self.matching(p.v2, g): return [self.atom_prop_replace_properties(p.v1, new_arg_id=g.v1.arg_id, new_is_n...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def rule_backward_conjunctive_syllogism(self, p, g):\r\n\r\n if g.type == self.PT.negation and p.type == self.PT.negation:\r\n # g = NOT(A(x))\r\n if p.v1.type == self.PT.conjunction:\r\n # p = NOT(A(x) AND B(x))\r\n if self.matching(p.v1.v1, g.v1):\r\n ...
[ "0.62638587", "0.5995946", "0.56629103", "0.55696833", "0.5512795", "0.5496695", "0.5350145", "0.5332289", "0.5228541", "0.52102053", "0.52015907", "0.51500666", "0.5129461", "0.5123244", "0.510226", "0.5068586", "0.50645703", "0.50582373", "0.5038378", "0.50190765", "0.49946...
0.76120085
0
Removes isomorphic propositions where both involve variables
def remove_duplicates(self, propositions): propositions_copy = list(propositions) uniques = [] while True: duplicates = [] if len(propositions_copy) == 0: return uniques p1 = propositions_copy[0] for p2 in propositions_copy:...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def unproductive(g):\n nonts = set(nonterminals(g))\n\n useful = {n for n in nonts if endings(g, n)}\n change = True\n\n while change:\n change = False\n\n for n in nonts.difference(useful):\n for prod in g.productions(n):\n if all(child in useful for child in ch...
[ "0.5546809", "0.55113703", "0.5385168", "0.5358705", "0.5351735", "0.5314533", "0.53132886", "0.5306827", "0.5304884", "0.521399", "0.51803505", "0.5164956", "0.51246977", "0.51216865", "0.51209795", "0.5113263", "0.50640446", "0.5055276", "0.50446403", "0.5026258", "0.501576...
0.63047653
0
>>> m = PSYCOP() >>> i = m.get_fresh_id() >>> a = m.Prop(m.PT.atomic, m.Atom("A", i, False, False), None) >>> b = m.Prop(m.PT.atomic, m.Atom("B", i, False, False), None) >>> c = m.Prop(m.PT.atomic, m.Atom("C", i, False, False), None) >>> p1 = m.Prop(m.PT.implies, a, b) >>> p2 = m.Prop(m.PT.implies, b, c) >>> p3 = m.Pro...
def extract_ac_conclusions(self, propositions): prop_ac = [] for p in propositions: s = self.proposition_to_string(p) if s is not None: if {s[1], s[2]} == {"a", "c"}: prop_ac.append(s) return prop_ac
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def rule_exclusivity(self, p1, p2, domain):\r\n\r\n if p1.type == self.PT.implies and p2.type == self.PT.negation:\r\n if p2.v1.type == self.PT.conjunction:\r\n if p1.v1.type == self.PT.atomic and p1.v2.type == self.PT.atomic:\r\n if p2.v1.v1.type == self.PT.atom...
[ "0.5383962", "0.5216982", "0.5187525", "0.5153276", "0.51042193", "0.50277936", "0.4886437", "0.4801194", "0.47278795", "0.47071022", "0.468511", "0.46064875", "0.45927116", "0.45851114", "0.4572136", "0.4562979", "0.4547506", "0.45278445", "0.45021546", "0.44991416", "0.4480...
0.7077263
0
Removes megahit intermediates in place. Renames contigs to contig.fa
def megahit(path_in): shutil.rmtree("{0}/{1}".format(path_in, "intermediate_contigs/")) # os.rename("{0}/final.contigs.fa".format(path_in), "{0}/contig.fa".format(path_in)) os.listdir(path_in) return
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def cleanup_precluster_intermediate_files(batch_index):\n files = [\"seed{0}.S.fasta\".format(batch_index),\n \"seed{0}.orphans.fasta\".format(batch_index),\n \"batch{0}.fasta\".format(batch_index),\n \"batch{0}.remains.fasta\".format(batch_index),\n \"batch{0}.re...
[ "0.6157111", "0.6016867", "0.5937992", "0.5761502", "0.5596034", "0.5555919", "0.5539349", "0.550775", "0.54886466", "0.54612345", "0.54590577", "0.54370695", "0.5422165", "0.5405502", "0.53871214", "0.53869516", "0.5386505", "0.53295577", "0.5305551", "0.52941173", "0.529094...
0.81108123
0
1. Pop last element in the heap 2. If it isn't the only element, then the root is the max. Insert the last element to the root and sift up the max element 3. If it is the last element so just return it
def heap_pop_max(heap): last = heap.pop() if heap: return_item = heap[0] heap[0] = last heapq._siftup_max(heap, 0) else: return_item = last return return_item
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delete_top_from_max_heap(x):\n last = x[-1]\n x = x.at[0].set(last)[:-1]\n return heapify_subtree(x, 0)", "def max_heapify(array, root):\n print(array)\n while True:\n left_child = 2*i\n right_child = 2*i + 1\n print(left_child, right_child)\n n = len(array)\n\n if l...
[ "0.73450583", "0.72503364", "0.7051829", "0.69888616", "0.6927613", "0.69274133", "0.69107723", "0.6852765", "0.68425155", "0.6783528", "0.6773965", "0.66724384", "0.65653837", "0.65010023", "0.64840037", "0.64583856", "0.64395285", "0.6422981", "0.64171094", "0.64117384", "0...
0.76896995
0
Test The probas_to_classes class method
def test_RecurrentNeuralNetwork_probas_to_classes(): arr1 = np.asarray([0.1, 0.2, 0.7], dtype=np.float32) arr2 = np.asarray([0.1], dtype=np.float32) assert RecurrentNeuralNetwork.probas_to_classes(arr1) == 2 assert RecurrentNeuralNetwork.probas_to_classes(arr2) == 0
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __convert_prob_into_class(self, probs):\n probs = T.set_subtensor(probs[probs > 0.5], 1)\n return T.set_subtensor(probs[probs <= 0.5], 0)", "def classProbs(observation, tree, classes):\n res = classify(observation, tree) #res = results\n total = sum(res.values())\n probs = []\n for ...
[ "0.6498094", "0.64421034", "0.6430607", "0.6242911", "0.6197098", "0.6133029", "0.61081195", "0.6107384", "0.6036182", "0.60294396", "0.6015596", "0.6013046", "0.598101", "0.59633774", "0.5955908", "0.5945819", "0.5933108", "0.5814961", "0.58133847", "0.5807453", "0.575121", ...
0.705267
0
Determines whether or not a specific marker with a ship has been sunk when visually representing the board
def is_ship_sunk(self, x, y): marker = self.markers[x][y] total_hits = self.ship_hits[marker] return total_hits == MarkerType.MAX_HITS[marker]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def hit(self):\n\n self.units.pop()\n return (len(self.units) == 0) # Returns True if the ship has been sunk", "def is_board_lost(self):\n\n return bool(self.all_ship_locations) and bool(\n not self.all_ship_locations.difference(self.shot_locations)\n )", "def isScatteringSat...
[ "0.6861421", "0.626912", "0.60083276", "0.60054564", "0.5866003", "0.5835053", "0.57888705", "0.57358277", "0.567922", "0.5657924", "0.56397027", "0.563559", "0.562256", "0.5606837", "0.5604321", "0.5599502", "0.55966866", "0.55774707", "0.55633444", "0.5560819", "0.5549613",...
0.80348986
0
Perform translation on data according to desc and language
def translate(desc, data, language = None): # sanity checks if desc is None or data is None: return data # create a translation configuration prepared = translator.prepare(desc, language) # perform the translation if isinstance(data, types.DictType): # translate single entry ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def translate(self, language=None):", "def translate():\n pass", "def get_translation(self):", "def translate(self):\n pass", "def question_new_translate():", "def translate(self,phrase, **kwargs):\n \n #Load the input and output languages\n if 'output_language' in kwar...
[ "0.7879175", "0.739186", "0.7055538", "0.70379674", "0.6981347", "0.68133277", "0.6648589", "0.6586364", "0.656703", "0.65603155", "0.6507135", "0.6446331", "0.6446331", "0.63955307", "0.63876665", "0.6365477", "0.6363538", "0.635846", "0.6329896", "0.6292852", "0.6292246", ...
0.7615052
1
Get the list of cached code tables
def list(): return cache.codeTableList()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def codelists():\n return CodelistSet()", "def list_cached():\n for json_name in cached_files():\n source_name = get_source_file_name(json_name)\n yield (json_name, source_name)", "def get_tables(self):\n r = self.client.query(\"show tables\")\n if r:\n tables = [tu...
[ "0.65682197", "0.6535312", "0.65018505", "0.642341", "0.6260274", "0.62120306", "0.61924624", "0.61917317", "0.61468893", "0.6070429", "0.6061271", "0.6048635", "0.59974474", "0.59974474", "0.5924543", "0.59052294", "0.5889158", "0.58332527", "0.5788907", "0.578401", "0.57662...
0.8586865
0
Move file(s) to a given destination.
def move_files(file: str, destination: str): try: result = _process_files("mv", "-v", file, destination) except FileNotFoundError: print("ERROR: '{}' does not exist.".format(file)) except FolderNotFoundError: print( "ERROR: '{}' destination does not exist.".format(destin...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def move_file(source, destination):\n shutil.move(source, destination)", "def move_files(src, dst, filenames):\n for filename in filenames:\n os.rename(os.path.join(src, filename), os.path.join(dst, filename))", "def moveFiles(outputDir, files):\n\tfor fn in files:\n\t\tshutil.move(fn, join(output...
[ "0.78872573", "0.7738285", "0.7380401", "0.7375994", "0.7297225", "0.72372043", "0.72019434", "0.7157788", "0.7145809", "0.7066401", "0.7051393", "0.7048595", "0.69972205", "0.69623786", "0.69306546", "0.6854708", "0.6807551", "0.6799462", "0.6773344", "0.6734271", "0.6706912...
0.78143567
1
Draws the restart menu state.
def draw(screen): MY.restart_button.draw(screen) MY.display_text.draw(screen)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def restart_menu(self):\n self.__show_menu = True", "def restart(self):\n self.board.container.destroy()\n # create a new board object and draw board + buttons again\n self.board = TicTacToeBoard(self.parent, 100, \"#ECECEC\")\n self.board.draw_board()\n self.initialize_...
[ "0.69464964", "0.6642332", "0.6490532", "0.6384677", "0.63402164", "0.62999594", "0.62544376", "0.6199466", "0.61894584", "0.6133734", "0.6122533", "0.6107369", "0.60496926", "0.6044342", "0.60208946", "0.59724265", "0.5916732", "0.587158", "0.58492255", "0.5844009", "0.58277...
0.69568
0
Tests that the barracks helper cannot be built without api_key argument
def test_init_barracks_helper_fail_when_no_api_key_given(): try: BarracksHelper(None, _base_url) assert False except ValueError: assert True
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_api_key_error(api):\n\twith pytest.raises(top_stories.APIKeyError):\n\t\tmissingAPI = top_stories.TopStoriesAPI()", "def test_init_barracks_helper_succeed_when_api_key_given():\n helper = BarracksHelper(_api_key)\n assert helper.get_api_key() == _api_key\n assert helper.get_base_url() == _base_...
[ "0.7188455", "0.7150424", "0.6868079", "0.6843092", "0.68007284", "0.6641392", "0.65708363", "0.6499072", "0.64861906", "0.64667827", "0.6463625", "0.6444715", "0.6391974", "0.6325179", "0.6301825", "0.62591594", "0.61920804", "0.6184099", "0.6144185", "0.6124961", "0.6124961...
0.8481922
0
Tests that the barracks helper is correctly built with an api_key and no base_url
def test_init_barracks_helper_succeed_when_api_key_and_base_url_given(): base_url = 'http://some.url' helper = BarracksHelper(_api_key, base_url) assert helper.get_api_key() == _api_key assert helper.get_base_url() == base_url assert helper.update_checker_helper assert helper.update_checker_he...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_init_barracks_helper_fail_when_no_api_key_given():\n try:\n BarracksHelper(None, _base_url)\n assert False\n except ValueError:\n assert True", "def test_init_barracks_helper_succeed_when_api_key_given():\n helper = BarracksHelper(_api_key)\n assert helper.get_api_key() ...
[ "0.8263585", "0.8078991", "0.6654061", "0.6618654", "0.66106915", "0.6487298", "0.6291824", "0.62910557", "0.6287132", "0.62710816", "0.6215637", "0.61554646", "0.60898596", "0.60878843", "0.6084779", "0.60764563", "0.60689425", "0.6059673", "0.6006741", "0.5999861", "0.59782...
0.81723756
1
Tests that the client ''check'' callback is called with UpdateDetail when status code is available
def test_check_update_calls_callback_when_update_available(): with requests_mock.mock() as mocked_server: mocked_server.post(_base_url + _check_update_endpoint, text=_json_update_response, status_code=200) request = UpdateDetailRequest('v1', 'MyDevice', '{"AnyCustomData":"any_value"}') upda...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def updates_check():\n data = wait_for_callback(client, cb_updates_name)\n self.assertTrue(isinstance(data, dict))", "def check_status(self):", "def test_check_update_calls_callback_when_no_update_available():\n with requests_mock.mock() as mocked_server:\n mocked_server.post(_b...
[ "0.7000315", "0.6929515", "0.6763312", "0.6612882", "0.6596048", "0.6583341", "0.6583341", "0.6580416", "0.65675205", "0.655343", "0.65316373", "0.6483704", "0.64354014", "0.64349073", "0.64082783", "0.6399724", "0.63660103", "0.6345494", "0.6345222", "0.6334975", "0.62610376...
0.7042606
0
Tests that the download request is built with appropriate parameters and headers
def test_download_package_helper_properly_build_request_when_valid_url_given(): download_helper = PackageDownloadHelper(_api_key) built_request = download_helper.build_download_request(_update_response_url) headers = built_request.headers assert headers['Authorization'] == _api_key assert headers['...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_download(self, file_list, _):\n url = reverse(\"report_download\")\n response = self.client.get(url)\n body = response.json()\n\n self.assertEqual(response.status_code, 200)\n self.assertIn(\"Download Request Task ID\", body)\n\n url_w_params = url + \"?provider_u...
[ "0.6950403", "0.68646777", "0.67196494", "0.66881627", "0.6502818", "0.6358916", "0.63298976", "0.63289493", "0.6266413", "0.61539286", "0.60930276", "0.6060562", "0.60434884", "0.6040505", "0.59982693", "0.5925682", "0.59115666", "0.5896234", "0.5890364", "0.5867373", "0.586...
0.7400816
0
Tests that downloaded the file is removed when the md5 not match
def test_file_integrity_remove_file_in_case_of_fail(): test_file = open('./testfile.tmp', 'a') test_file.close() test_file_path = os.path.realpath('./testfile.tmp') test_file_md5 = hashlib.md5(open(test_file_path, 'rb').read()).hexdigest() bad_md5 = 'some_noise_%s' % test_file_md5 PackageDownl...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _check_final_md5(self, key, file_name):\r\n fp = open(file_name, 'r')\r\n if key.bucket.connection.debug >= 1:\r\n print 'Checking md5 against etag.'\r\n hex_md5 = key.compute_md5(fp)[0]\r\n if hex_md5 != key.etag.strip('\"\\''):\r\n file_name = fp.name\r\n ...
[ "0.80135876", "0.74356925", "0.72578675", "0.71941775", "0.7100078", "0.6969924", "0.6895048", "0.6885091", "0.68015236", "0.6569086", "0.6435141", "0.638278", "0.63422084", "0.63062805", "0.626479", "0.6257084", "0.62355447", "0.62270766", "0.6220227", "0.6191675", "0.617810...
0.7904508
1
The getter method for the forecast date. If the forecast date is not supplied, it will be set to the current date.
def forecast_date(self): return self._forecast_date
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def forecast_date(self, forecast_date):\n self._forecast_date = forecast_date.strftime(\"%a %b %d\")", "def get_date(self):\n return self.date", "def get_date(self):\n return self.date", "def get_date(self):\n return self.date", "def get_date(self):\n return self.date", ...
[ "0.7395979", "0.6631649", "0.6631649", "0.6631649", "0.6631649", "0.6575731", "0.6429508", "0.63298404", "0.63246965", "0.6283063", "0.6283063", "0.6283063", "0.627989", "0.62717545", "0.62594414", "0.6252879", "0.6240903", "0.6228745", "0.6228745", "0.6228745", "0.61254066",...
0.8569457
0
The setter method for the forecast date. Every time we need to set the date in an instance of Forecast every, we need to make sure that it will be formatted accordingly.
def forecast_date(self, forecast_date): self._forecast_date = forecast_date.strftime("%a %b %d")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_date(self, date):\n self.date = date", "def date(self, date):\n self.value = date.strftime(\"%Y-%m-%d\") if date else \"\"", "def set_date(self, date):\n self.date = date\n return", "def set_date(self, date):\n self.data['date'] = date", "def _date(self, _date):\n...
[ "0.71004164", "0.70625865", "0.69669646", "0.69329244", "0.6891429", "0.6891429", "0.6873222", "0.6835358", "0.6825212", "0.6773724", "0.67453426", "0.6618986", "0.6618986", "0.6618986", "0.6618986", "0.6618986", "0.6599774", "0.6594992", "0.6584389", "0.6485541", "0.63232476...
0.81627464
0
The getter method for the day's current wind levels.
def wind(self): return self._wind
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_wind_values(self):\n return (\n int(self.data[2]), # dir\n float(self.data[3]) / 10, # gust\n float(self.data[4]) / 10, # avg\n float(self.data[5]) / 10, # chill\n )", "def get_current_water_level(self):\n \n url = f'http://water...
[ "0.66269565", "0.6551266", "0.634967", "0.6340421", "0.62732714", "0.6218584", "0.62073404", "0.6126908", "0.6100952", "0.596197", "0.59491724", "0.5942488", "0.5918629", "0.59090155", "0.59058", "0.58645844", "0.5827256", "0.5817197", "0.5807483", "0.58023006", "0.578426", ...
0.7064748
0
implement the calculation W_battery = TOW W_payload W_empty
def compute(self, inputs, outputs): outputs['TOW'] = inputs['W_battery'] + inputs['W_payload'] + inputs['W_empty']
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _battery_cb(self, msg):\n # self.battery_voltages[msg.header.seq %\n # len(self.battery_voltages)] = msg.voltage\n self.battery_voltages[msg.header.seq % len(\n self.battery_voltages)] = msg.percentage * 100.\n # delta = self.INIT_VOLTAGE - self.MINI...
[ "0.6269014", "0.59985936", "0.5943292", "0.5867068", "0.58323497", "0.5787141", "0.5725671", "0.5711988", "0.5711663", "0.56736314", "0.5655628", "0.5649336", "0.56464905", "0.56165636", "0.5588463", "0.5568272", "0.5558334", "0.5558226", "0.5557175", "0.5550101", "0.55433625...
0.7274236
0
Evaluate if two hypercubes cross each other.
def hypercubes_overlap(hypercube1, hypercube2): if not isinstance(hypercube1, Volume) or \ not isinstance(hypercube2, Volume): raise TypeError() lowercorner1, uppercorner1 = hypercube1.get_corners() lowercorner2, uppercorner2 = hypercube2.get_corners() nb_dims = len(uppercorner1) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def cross(self, other):\n return self.scalar(other) == 0", "def crosses(self, other): # -> bool:\n ...", "def cross(series1: Sequence, series2: Sequence) -> bool:\n return crossover(series1, series2) or crossover(series2, series1)", "def test_cross(self):\n self.assertEqual(solution....
[ "0.72744024", "0.65915084", "0.6428907", "0.6256766", "0.6243645", "0.62124735", "0.6199499", "0.6097191", "0.6094316", "0.60560596", "0.6046024", "0.60402244", "0.6022108", "0.59828514", "0.59746", "0.5966605", "0.5957315", "0.5934511", "0.5931654", "0.5926318", "0.59211856"...
0.66413707
1
Return the number of small arrays in big array in all dimensions as a shape.
def get_blocks_shape(big_array, small_array): return tuple([int(b/s) for b, s in zip(big_array, small_array)])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def ndims(x):\n return len(x.get_shape())", "def estimate_size(shape):\n total_bytes = reduce(np.multiply, shape) * 8\n return total_bytes / 1E6", "def size(self):\n return int(misc.intprod(self.shape))", "def dim(self) -> int:", "def find_largest_shape(arrays):\r\n out = np.array([0])\r\n...
[ "0.66448617", "0.66011816", "0.6496022", "0.649422", "0.6473923", "0.6465132", "0.6461578", "0.6414655", "0.64061123", "0.63932633", "0.6376898", "0.6368664", "0.63096297", "0.6296904", "0.6292392", "0.62549186", "0.62271947", "0.62253815", "0.6215773", "0.6177364", "0.614396...
0.70311415
0
Returns list of output files that are crossing buffer at buffer_index.
def get_crossed_outfiles(buffer_index, buffers, outfiles): crossing = list() buffer_of_interest = buffers[buffer_index] for outfile in outfiles.values(): if hypercubes_overlap(buffer_of_interest, outfile): crossing.append(outfile) return crossing
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def output_files(self):\n output_files = []\n for split in self.split_files:\n output_files.extend(split.filepaths)\n return output_files", "def whichBuffers(self, paramIndex):\n return paramIndex % self.inmod.outdim, paramIndex // self.inmod.outdim", "def buffers_with_matches(self):\n ...
[ "0.56127596", "0.55306166", "0.5441968", "0.5265472", "0.5262707", "0.5152076", "0.5129678", "0.51254493", "0.5097565", "0.50565803", "0.5016646", "0.5007455", "0.49993044", "0.4994247", "0.49855304", "0.49773374", "0.49699283", "0.49558246", "0.49224594", "0.4905285", "0.487...
0.7601003
0