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 |
|---|---|---|---|---|---|---|
Prepare a PredefinedMessage to attach to a Note. | def PreparePredefinedMessageForNote(
message_type, message_id=None, lab_name=None, content=None, delta_count=1):
predefined_message_entity = None
if message_id:
predefined_message_entity = ndb.Key(
datastore_entities.PredefinedMessage, message_id).get()
if (not predefined_message_entity
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _construct_message(self):\n self.message[\"text\"] = \"\"\n if self.from_:\n self.message[\"text\"] += \"From: \" + self.from_ + \"\\n\"\n if self.subject:\n self.message[\"text\"] += \"Subject: \" + self.subject + \"\\n\"\n\n self.message[\"text\"] += self.bod... | [
"0.5902068",
"0.54789835",
"0.5411161",
"0.5397969",
"0.53778887",
"0.528457",
"0.51821566",
"0.51811504",
"0.5179907",
"0.5102841",
"0.50877404",
"0.50477374",
"0.5024491",
"0.50166047",
"0.50101256",
"0.49584654",
"0.4940626",
"0.49365306",
"0.49365306",
"0.49202845",
"0.49... | 0.6577584 | 0 |
Create a client for Google Cloud Pub/Sub. | def _CreatePubsubClient():
client = pubsub_client.PubSubClient()
client.CreateTopic(DEVICE_NOTE_PUBSUB_TOPIC)
client.CreateTopic(HOST_NOTE_PUBSUB_TOPIC)
return client | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def GetCloudPubSubService(version):\n credentials = _GetCredentials()\n\n service = build('pubsub', version, credentials=credentials)\n\n return service",
"def from_service_account_json(cls, service_account_path) -> 'PubSubClient':\n client = pubsub.PublisherClient.from_service_account_json(\n filen... | [
"0.68315613",
"0.64384186",
"0.64002514",
"0.6348541",
"0.6153353",
"0.6098759",
"0.6075227",
"0.59679025",
"0.5934572",
"0.58524835",
"0.5823112",
"0.5803386",
"0.57960606",
"0.5783726",
"0.5775977",
"0.5761972",
"0.5746739",
"0.5709166",
"0.5681782",
"0.5663954",
"0.5631636... | 0.7936616 | 0 |
Publish device note event message to pubsub. | def PublishMessage(device_note_message, event_type):
if not env_config.CONFIG.use_google_api:
logging.warning(
"Unabled to send device note message to pubsub: use_google_api=False"
)
return
device_note_message.publish_timestamp = _Now()
encoded_message = protojson.encode_message(device_note_me... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def send_notification (event):\n Publisher.sendMessage (event)",
"def on_publish(client, userdata, mid):\n print(\"Message Published.\")",
"def on_publish(client: mqtt.Client, userdata: Any, mid: int) -> None:\n logging.info(f\"Successfully published a message: mid={mid}\")",
"def on_publish(mqttc... | [
"0.6799724",
"0.6692671",
"0.64363164",
"0.6434882",
"0.62943685",
"0.62485355",
"0.6228177",
"0.6202135",
"0.6180694",
"0.6136206",
"0.61028963",
"0.60171473",
"0.5964869",
"0.59438956",
"0.5941777",
"0.5856877",
"0.5843032",
"0.5783663",
"0.575807",
"0.57394004",
"0.5716468... | 0.79873115 | 0 |
Test if the bedcolumns tool correctly processes BED files. | def test_bedcolumns(self):
for i in self.__bed_files:
sys.argv = ['', 'bedcolumns', i]
bioformats.cli.bioformats() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def validate_bed_format(row):\n assert len(row) >= 3, 'Bed Files must have at least 3 tab separated fields.'\n\n return True",
"def test_bed(self):\n #TODO write bed tests",
"def assert_data_fragments_correct(self) -> bool:\n read_path = Path(os.environ[\"DATA_PATH\"]) / \"fragments\"\n ... | [
"0.67312443",
"0.58833575",
"0.5798883",
"0.5782598",
"0.56335145",
"0.560978",
"0.56003135",
"0.549045",
"0.5471625",
"0.5467173",
"0.54644716",
"0.54492444",
"0.5420592",
"0.5371221",
"0.5365314",
"0.5338379",
"0.532805",
"0.5324707",
"0.5309913",
"0.5302061",
"0.52465785",... | 0.76697 | 0 |
Find the period of a video based on frames correlation. | def find_video_period(clip, fps=None, start_time=0.3):
def frame(t):
return clip.get_frame(t).flatten()
timings = np.arange(start_time, clip.duration, 1 / fps)[1:]
ref = frame(0)
corrs = [np.corrcoef(ref, frame(t))[0, 1] for t in timings]
return timings[np.argmax(corrs)] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_frequency(frame):\n frame = clip_centre(frame)\n frame = auto_correlate(frame)\n threshold: int = SAMPLE_RATE // 500\n lag = frame[threshold:].argmax()\n frequency = SAMPLE_RATE / lag\n return frequency",
"def read_video_info_cv2(vid_fp: str):\n cap = cv2.VideoCapture(vid_fp)\n to... | [
"0.61824566",
"0.5897452",
"0.5842442",
"0.5768807",
"0.57534134",
"0.5732302",
"0.57152915",
"0.57069767",
"0.5660134",
"0.56376827",
"0.5626911",
"0.56249475",
"0.5622147",
"0.5570427",
"0.55688477",
"0.5563371",
"0.5560966",
"0.55574507",
"0.5557329",
"0.5556538",
"0.55458... | 0.7802406 | 0 |
Return a FramesMatches object obtained by filtering out the FramesMatch which do not satistify a condition. | def filter(self, condition):
return FramesMatches(filter(condition, self)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def valid_filtering_frames(self):\n if self.frames is None:\n return np.empty(0, dtype=bool)\n return self.frames.is_unflagged(\n self.flagspace.flags.MODELING_FLAGS) & self.frames.valid",
"def from_clip(clip, distance_threshold, max_duration, fps=None, logger=\"bar\"):\n ... | [
"0.5678847",
"0.53808403",
"0.51070786",
"0.5085065",
"0.5076528",
"0.4953295",
"0.4888995",
"0.48358238",
"0.47881603",
"0.4759034",
"0.47443974",
"0.47438547",
"0.47336772",
"0.47308633",
"0.47205034",
"0.46718502",
"0.46666366",
"0.4642888",
"0.46359956",
"0.46264052",
"0.... | 0.7887986 | 0 |
Load a FramesMatches object from a file. | def load(filename):
arr = np.loadtxt(filename)
mfs = [FramesMatch(*e) for e in arr]
return FramesMatches(mfs) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def load(self, file_path):\n get_base().scene_parser.load(file_path)",
"def load(self, file):\n if isinstance(file, basestring):\n with open(file, \"rb\") as file:\n self.load(file)\n else:\n pack = load(file)\n self.model, self.features, self.... | [
"0.61072993",
"0.59697014",
"0.5955233",
"0.5946721",
"0.5917448",
"0.5870343",
"0.5870343",
"0.5837459",
"0.5810483",
"0.58091295",
"0.57950246",
"0.57478905",
"0.5736843",
"0.5730654",
"0.57078964",
"0.5677754",
"0.5617945",
"0.55828273",
"0.55758727",
"0.55667955",
"0.5549... | 0.7788396 | 0 |
Finds all the frames that look alike in a clip, for instance to make a looping GIF. | def from_clip(clip, distance_threshold, max_duration, fps=None, logger="bar"):
N_pixels = clip.w * clip.h * 3
def dot_product(F1, F2):
return (F1 * F2).sum() / N_pixels
frame_dict = {} # will store the frames and their mutual distances
def distance(t1, t2):
uv... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _extractFrames_(self, wordRulesFlag):\n\t\t#pdb.set_trace()\n\t\tsimplifyTree(self.srcTree)\n\t\tsimplifyTree(self.tgtTree)\n\n\t\tsDic, tDic = {}, {}\n\t\tframeSet = set() \n\t\tfor sSubtr in self.srcTree.subtrees():\n\t\t\tif sSubtr.height() <= 2:\n\t\t\t\tcontinue\n\n\t\t\tsTreePos = sSubtr.treeposition()\n... | [
"0.5630308",
"0.5623094",
"0.55751455",
"0.5440516",
"0.5430885",
"0.5360009",
"0.5331504",
"0.5289159",
"0.524461",
"0.52402794",
"0.5236681",
"0.522636",
"0.5182574",
"0.5164931",
"0.5158739",
"0.51321524",
"0.51314044",
"0.5102913",
"0.5097966",
"0.5077635",
"0.5062365",
... | 0.6358814 | 0 |
Extract the matching frames represented by the instance from a clip and write them as GIFs in a directory, one GIF for each matching frame. | def write_gifs(self, clip, gifs_dir, **kwargs):
for start, end, _, _ in self:
name = "%s/%08d_%08d.gif" % (gifs_dir, 100 * start, 100 * end)
clip.subclip(start, end).write_gif(name, **kwargs) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def save_gif(frames):\n print(\"Saving gif images!\")\n for i in range(len(frames)):\n im_out_path = \"gif/gif_emilie_will_\" + str(i) + \".png\"\n plt.imsave(im_out_path, frames[i])",
"def gif_generation(orig_label_path, bound_data_path):\n for sample in os.listdir(bound_data_path):\n ... | [
"0.6057614",
"0.6047021",
"0.60038644",
"0.5989575",
"0.59443015",
"0.59372747",
"0.589539",
"0.58743435",
"0.5755156",
"0.5740548",
"0.56750983",
"0.56676084",
"0.5655235",
"0.5654523",
"0.56522",
"0.55972075",
"0.55765915",
"0.5575639",
"0.55650955",
"0.5556009",
"0.554901"... | 0.7384294 | 0 |
Detects scenes of a clip based on luminosity changes. Note that for large clip this may take some time. Returns | def detect_scenes(
clip=None, luminosities=None, luminosity_threshold=10, logger="bar", fps=None
):
if luminosities is None:
luminosities = [
f.sum() for f in clip.iter_frames(fps=fps, dtype="uint32", logger=logger)
]
luminosities = np.array(luminosities, dtype=float)
if cli... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def find_scenes(video_path, min_scene_length=1, abs_min=0.75, abs_max=0.98, find_subscenes=True, max_subscenes_per_minute=12):\n \n try:\n file_name = video_path[video_path.rfind('/')+1 : video_path.find('.')]\n directory = os.path.join(os.getcwd(), file_name)\n #if not os.path.exists(di... | [
"0.60611933",
"0.59980005",
"0.5518768",
"0.5502983",
"0.5368828",
"0.5317858",
"0.5316692",
"0.5154504",
"0.5108283",
"0.51016235",
"0.5064553",
"0.50458866",
"0.5032231",
"0.500341",
"0.49765036",
"0.49372497",
"0.4877259",
"0.48716643",
"0.48710057",
"0.4867716",
"0.485362... | 0.80706614 | 0 |
Got this from the 3rd reference. This is just a quick write up to find the inverse kinematics for a 3link arm, using the SciPy optimize package minimization function. Given an (x,y) position of the hand, return a set of joint angles (q) using constraint based minimization, constraint is to match hand (x,y), minimize th... | def inv_kin(self, ee_pos=None):
if ee_pos != None:
self.ee_pos = ee_pos
else:
ee_pos = self.ee_pos
def distance_to_default(q, *args):
"""Objective function to minimize
Calculates the euclidean distance through joint space to the
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def inv_kin(self, xy):\n\n def distance_to_default(q, *args): \n \"\"\"Objective function to minimize\n Calculates the euclidean distance through joint space to the default\n arm configuration. The weight list allows the penalty of each joint \n being away from th... | [
"0.77152705",
"0.59515494",
"0.58560336",
"0.5760818",
"0.5748143",
"0.5680994",
"0.5663166",
"0.56222093",
"0.5615172",
"0.54652256",
"0.53848755",
"0.5365733",
"0.53633255",
"0.5347543",
"0.5346275",
"0.53421795",
"0.5303706",
"0.529007",
"0.5257806",
"0.5214364",
"0.518231... | 0.6474396 | 1 |
Coadd a sequence of `~gammapy.maps.Map` objects. | def coadd_maps(geom, maps, preserve_counts=True):
# FIXME: This functionality should be built into the Map.coadd method
map_out = gammapy.maps.Map.from_geom(geom)
for m in maps:
m_tmp = m
if isinstance(m, gammapy.maps.HpxNDMap):
if m.geom.order < map_out.geom.order:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def install_maps(self, *args):\n\n for ind in args:\n self.add_map(*ind)",
"def intercambiar(mapa, mapa2):\n for e in mapa.bloqueadas:\n mapa2.bloqueadas.append(e)",
"def mapcat(iteratee, *seqs):\n return concat(*map(iteratee, *seqs))",
"def Maps(num_maps, num_cities):\n ret... | [
"0.57775223",
"0.57437",
"0.54085225",
"0.53489214",
"0.53424233",
"0.5225602",
"0.5225602",
"0.5190382",
"0.5163334",
"0.51378405",
"0.51233727",
"0.511296",
"0.5063642",
"0.5034411",
"0.50255305",
"0.49915215",
"0.49867254",
"0.4984002",
"0.49756402",
"0.49744",
"0.49657184... | 0.73423016 | 0 |
Return the ROI center in pixel coordinates. | def pix_center(self):
return self._pix_center | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getCenter(self):\r\n pixels = np.argwhere(self.array)\r\n center = np.mean(pixels.astype(np.float32), axis=0)\r\n return np.round(center).astype(np.int)",
"def find_center(self):\n return(Point(self.corner.x + self.width/2.0, self.corner.y + self.height/2.0))",
"def get_center(s... | [
"0.8074902",
"0.7977473",
"0.797162",
"0.7826406",
"0.7801054",
"0.7678491",
"0.76674324",
"0.7664887",
"0.7648571",
"0.7644082",
"0.7629048",
"0.76160705",
"0.75696534",
"0.7510568",
"0.7447499",
"0.7438532",
"0.74262667",
"0.7414254",
"0.73986065",
"0.737906",
"0.7364483",
... | 0.8222314 | 0 |
Get a list of sky coordinates for the centers of every pixel. | def get_pixel_skydirs(self):
xpix = np.linspace(0, self.npix[0] - 1., self.npix[0])
ypix = np.linspace(0, self.npix[1] - 1., self.npix[1])
xypix = np.meshgrid(xpix, ypix, indexing='ij')
return SkyCoord.from_pixel(np.ravel(xypix[0]),
np.ravel(xypix[1]),... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def centers(self):\n return self.xc, self.yc",
"def coords(self):\n return coord.SkyCoord(ra=self.ra, dec=self.dec,\n distance=self.get_distance(lutz_kelker=lutz_kelker))",
"def gen_center_points(x_res, y_res, dim):\n center_points = []\n\n for x in range(math.f... | [
"0.71886593",
"0.6850522",
"0.6845038",
"0.6731011",
"0.6716892",
"0.6702556",
"0.669374",
"0.66229594",
"0.6616341",
"0.657842",
"0.6525134",
"0.6515429",
"0.6509522",
"0.64974725",
"0.6496247",
"0.64780456",
"0.6472642",
"0.63972753",
"0.635092",
"0.63482547",
"0.6320235",
... | 0.7220047 | 0 |
C'tor, fill with a counts vector and a HPX object | def __init__(self, counts, hpx):
super(HpxMap, self).__init__(counts)
self._hpx = hpx
self._wcs2d = None
self._hpx2wcs = None | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def expanded_counts_map(self):\n if self.hpx._ipix is None:\n return self.counts\n\n output = np.zeros(\n (self.counts.shape[0], self.hpx._maxpix), self.counts.dtype)\n for i in range(self.counts.shape[0]):\n output[i][self.hpx._ipix] = self.counts[i]\n ... | [
"0.6200838",
"0.6113564",
"0.6024091",
"0.6022628",
"0.59518045",
"0.579631",
"0.57916677",
"0.57646346",
"0.57443815",
"0.57148105",
"0.56274426",
"0.56168634",
"0.55955106",
"0.5586944",
"0.5568183",
"0.5556332",
"0.54822797",
"0.5430431",
"0.5404475",
"0.53904355",
"0.5356... | 0.64566445 | 0 |
Creates and returns an HpxMap object from a FITS HDU. | def create_from_hdu(cls, hdu, ebins):
hpx = HPX.create_from_hdu(hdu, ebins)
colnames = hdu.columns.names
cnames = []
if hpx.conv.convname == 'FGST_SRCMAP_SPARSE':
pixs = hdu.data.field('PIX')
chans = hdu.data.field('CHANNEL')
keys = chans * hpx.npix + ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self, counts, hpx):\n super(HpxMap, self).__init__(counts)\n self._hpx = hpx\n self._wcs2d = None\n self._hpx2wcs = None",
"def from_fits(cls, hdu_list, column='true'):\n # Locate an HDU with the right name or raise and error\n hdu = get_hdu_with_valid_name(... | [
"0.56150025",
"0.55050975",
"0.5475225",
"0.52960014",
"0.526715",
"0.5196818",
"0.5168838",
"0.5141716",
"0.5118627",
"0.5063602",
"0.502625",
"0.5017316",
"0.499264",
"0.4965138",
"0.49479094",
"0.49403644",
"0.49320698",
"0.49279484",
"0.4926019",
"0.49124792",
"0.48587012... | 0.6330329 | 0 |
Perform interpolation on a healpix cube. If egy is None then interpolation will be performed on the existing energy planes. | def _interpolate_cube(self, lon, lat, egy=None, interp_log=True):
shape = np.broadcast(lon, lat, egy).shape
lon = lon * np.ones(shape)
lat = lat * np.ones(shape)
theta = np.pi / 2. - np.radians(lat)
phi = np.radians(lon)
vals = []
for i, _ in enumerate(self.hpx.e... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def image_cube(self, i=0, channels=None, cell=1.0, imagesize=4096, pol='i'):\n\n # select integration and reduce pol axis\n if ((pol == 'i') | (pol == 'I')):\n if len(trackdata) == 2:\n print 'Making Stokes I image as mean of two pols...'\n else:\n ... | [
"0.5471919",
"0.54039276",
"0.52542675",
"0.51900196",
"0.5188139",
"0.5155958",
"0.50594825",
"0.49084264",
"0.49062863",
"0.4886611",
"0.4881655",
"0.4848412",
"0.48418128",
"0.47109488",
"0.4675063",
"0.46746743",
"0.4660073",
"0.4656445",
"0.4609003",
"0.46002433",
"0.458... | 0.6682754 | 0 |
return a counts map with sparse index scheme | def sparse_counts_map(self):
if self.hpx._ipix is None:
flatarray = self.data.flattern()
else:
flatarray = self.expanded_counts_map()
nz = flatarray.nonzero()[0]
data_out = flatarray[nz]
return (nz, data_out) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_count_map(self) -> Dict[int, int]:\n res: Dict[int, int] = {}\n for sequence_data in self.model.values():\n sequence_data: NGramsSequence = cast(NGramsSequence, sequence_data)\n for count in sequence_data.next_count.values():\n count: int = cast(int, co... | [
"0.6841851",
"0.67011094",
"0.6609091",
"0.6609091",
"0.6513716",
"0.6469802",
"0.6457373",
"0.62947905",
"0.6243027",
"0.6240269",
"0.6223811",
"0.61610305",
"0.6085046",
"0.60753167",
"0.60748726",
"0.60277265",
"0.60225505",
"0.5991211",
"0.5991063",
"0.5974214",
"0.595231... | 0.8131948 | 0 |
Updates the 'Picture' field of a given user. | def update_picture(self, username, picture):
self.update(('Picture', picture), username) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_user_profile_picture(user_id, file_name):\n\n user = User.query.get(user_id)\n \n user.profile_picture = file_name\n db.session.commit()",
"def save_profile_picture(current_user, url):\n # save profile_pic\n current_user.profile_pic = url\n current_user.save(current_user)",
"def up... | [
"0.7870461",
"0.7403364",
"0.66880757",
"0.666794",
"0.6534599",
"0.64877164",
"0.6454271",
"0.6385909",
"0.6330871",
"0.62840086",
"0.62787443",
"0.6274286",
"0.6245908",
"0.616867",
"0.6156273",
"0.61538935",
"0.6099156",
"0.60472995",
"0.604299",
"0.5993511",
"0.59657353",... | 0.83095396 | 0 |
Check the authorization of a given user. | def authorize(self, username):
user = User(self).get(username)
if not user:
raise DatabaseError("User does not exist.")
return user['Permissions'] == 'MANAGER' | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def authorized(self, user):\n\n return self.admin.id.getUnhashed() == user.id.getUnhashed()",
"def check_user(self):\n try:\n if (self.get_user()[0][0] == self.username) and (self.check_password(self.password)):\n return True\n else:\n return Fals... | [
"0.7288318",
"0.6663476",
"0.66452426",
"0.66100895",
"0.660699",
"0.66026264",
"0.6576983",
"0.6567882",
"0.6562115",
"0.6531863",
"0.65245265",
"0.6489102",
"0.648587",
"0.6446689",
"0.64459175",
"0.6437437",
"0.64319324",
"0.6430352",
"0.6418496",
"0.64097935",
"0.6391119"... | 0.68131644 | 1 |
Validate a user login. | def validate_login(self, username, password):
user = User(self).get(username)
return user and user['Password'] == password | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_logged_in_user_valid(user_name, password):\n if user_name.upper() == \"HELLO\" and password == \"World\":\n return True # User input matches user name and password.\n else:\n return False # User input does not match user name and password.s",
"def validate(self, data):\n user_... | [
"0.73789346",
"0.7331087",
"0.7290975",
"0.7159579",
"0.7054392",
"0.7021695",
"0.69761854",
"0.6938865",
"0.6904344",
"0.68793",
"0.68454343",
"0.6835745",
"0.6796258",
"0.67807746",
"0.6756452",
"0.6736185",
"0.6729308",
"0.6701518",
"0.66969687",
"0.66810375",
"0.6678118",... | 0.74852514 | 0 |
Get rent element by rent id. | async def get_rent_element(
request: Request,
rent_id: int = 0) -> dict:
ret_val = {}
query_str = get_rent_element_query
try:
async with request.app.pg.acquire() as connection:
row = await connection.fetchrow(query_str, rent_id)
if row is not None:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def find_rent(self, id):\n allR=self.__loadFromFile()\n for bk in allR:\n if bk.getId()==id:\n return bk",
"def find_rental_by_id(self, id):\n return super(RentalHistoryText, self).find_rental_by_id(id)",
"def getElementBySId(self, *args):\n return _libsbml... | [
"0.68181044",
"0.62734264",
"0.6245008",
"0.6185619",
"0.6125914",
"0.6101709",
"0.60980946",
"0.60474354",
"0.60402274",
"0.5969874",
"0.5946507",
"0.59364635",
"0.59310967",
"0.591884",
"0.5904526",
"0.5901401",
"0.5870774",
"0.5842038",
"0.5824091",
"0.5815303",
"0.5797034... | 0.728702 | 0 |
Delete rent element by rent id. | async def delete_rent_element(
request: Request,
rent_id: int = 0) -> dict:
ret_val = {}
query_str = delete_rent_element_query
try:
async with request.app.pg.acquire() as connection:
row = await connection.fetchrow(query_str, rent_id)
if row is not None:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def delete_rent(self, id):\n allR=self.__loadFromFile()\n\n poz=-1\n for index in range(len(allR)):\n if allR[index].get_id()==id:\n poz=index\n break\n if poz<0:\n raise RepositoryExceptionRent(\"\\n Id doesn't exist. \\n \".upp... | [
"0.7558387",
"0.6610629",
"0.63685864",
"0.63378865",
"0.6301235",
"0.6219109",
"0.6203671",
"0.6172634",
"0.6170475",
"0.614781",
"0.6146584",
"0.6139207",
"0.61260664",
"0.6119943",
"0.60958445",
"0.60940707",
"0.6092814",
"0.6075667",
"0.60687995",
"0.6040421",
"0.602728",... | 0.7569988 | 0 |
Decorator to format args and responses of redis funcs with namespaces. | def namespace_format(arg_format=True, resp_format=False, multi=False,
arg_start=0, method=None, skip=[], resp_keys=[],
lex=False):
def decorator(f):
def wrapper(self, *args, **kwargs):
if self.namespace:
args = list(args or f.__defaults__... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def format(func: Callable[[bytes], Tuple[bytes, str]]) -> \\\n Callable[[Iterable, Mapping[str, Any]], bytes]:\n @wraps(func)\n def wrapper(*args, **kwargs):\n origin = kwargs.pop('origin', helpers.ConnectionType.CLIENT)\n direction = DIRECTION_FORMAT.get(origin, '???')\n data, me... | [
"0.58229846",
"0.5643287",
"0.5536571",
"0.5360156",
"0.5351521",
"0.5338872",
"0.53238803",
"0.5196378",
"0.51808757",
"0.51781946",
"0.5153813",
"0.51454484",
"0.50992495",
"0.5099195",
"0.5073484",
"0.50725627",
"0.5044272",
"0.5031401",
"0.50285727",
"0.50048465",
"0.5003... | 0.7513867 | 0 |
Removes any namespace from a redis response. | def remove_namespace(namespace, response, resp_keys=[]):
if isinstance(namespace, str):
namespace = str.encode(namespace)
for key in resp_keys:
response[key] = remove_namespace(namespace, response[key])
if isinstance(response, (int, float, bool)):
pass
elif isinstance(response, b... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def remove(self, *args):\n return _libsbml.XMLNamespaces_remove(self, *args)",
"def remove(self, *args):\n return _libsbml.ListWrapperSBMLNamespaces_remove(self, *args)",
"def removeNamespace(self, *args):\n return _libsbml.SBMLNamespaces_removeNamespace(self, *args)",
"def _remove_names... | [
"0.61740625",
"0.60187167",
"0.60048646",
"0.598743",
"0.598743",
"0.5922961",
"0.5880357",
"0.5831969",
"0.5794001",
"0.5789446",
"0.57590544",
"0.55729496",
"0.55661285",
"0.5466578",
"0.543189",
"0.53996074",
"0.53379583",
"0.5331338",
"0.53187877",
"0.5302459",
"0.5291986... | 0.74682134 | 0 |
Flip the bit(s) given. | def flip(self, *bits):
newargs = list(self.qubit_values)
for i in bits:
bit = int(self.dimension - i - 1)
if newargs[bit] == 1:
newargs[bit] = 0
else:
newargs[bit] = 1
return self.__class__(*tuple(newargs)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def flip(self) -> int:\n self.flags = ~(self.flags)\n return self.flags",
"def flip(self):",
"def swap_bits(x, i, j):\n\n # Check if bits are equal\n if (x >> i) & 1 != (x >> j) & 1:\n # Flip both if not\n x ^= (1 << i) | (1 << j)\n\n return x",
"def td_flip(self):\n self.cw_rot... | [
"0.6928678",
"0.6897729",
"0.68511355",
"0.64909995",
"0.6452532",
"0.64442706",
"0.640659",
"0.6381447",
"0.63813",
"0.6377422",
"0.6367496",
"0.6343378",
"0.628388",
"0.627007",
"0.627007",
"0.6264046",
"0.625087",
"0.6237721",
"0.61860305",
"0.6178655",
"0.6177762",
"0.6... | 0.777847 | 0 |
Represent this qubits in the computational basis (ZGate). | def _represent_ZGate(self, basis, **options):
_format = options.get('format', 'sympy')
n = 1
definite_state = 0
for it in reversed(self.qubit_values):
definite_state += n*it
n = n*2
result = [0]*(2**self.dimension)
result[int(definite_state)] = 1
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def Z(self, qubit_expr): \n self.apply_gate_operation('Z', qubit_expr)",
"def __repr__(self) -> str:\n\n return f\"ZqGroup({self.q})\"",
"def __repr__(self):\n return \"{}({},{})\".format(self.variant, self.q, self.t)",
"def _generate_qubits(self):\n return cq.LineQubit.ran... | [
"0.6303702",
"0.61174893",
"0.6104721",
"0.60431933",
"0.6000553",
"0.59966606",
"0.5985823",
"0.5884606",
"0.5867795",
"0.58211184",
"0.5816669",
"0.5745872",
"0.573032",
"0.57001394",
"0.5693679",
"0.5690959",
"0.5688239",
"0.5680765",
"0.56625926",
"0.56573445",
"0.5653345... | 0.7239202 | 0 |
Compute the reduced density matrix by tracing out one qubit. The qubit argument should be of type Python int, since it is used in bit operations | def _reduced_density(self, matrix, qubit, **options):
def find_index_that_is_projected(j, k, qubit):
bit_mask = 2**qubit - 1
return ((j >> qubit) << (1 + qubit)) + (j & bit_mask) + (k << qubit)
old_matrix = represent(matrix, **options)
old_size = old_matrix.cols
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def measure(self, qubit, cbit):\n return self._attach(Measure(qubit, cbit, self))",
"def magma_dasum(n, dx, incx, queue):\n\n return _libmagma.magma_dasum(n, int(dx), incx, queue)",
"def magma_dzasum(n, dx, incx, queue):\n\n return _libmagma.magma_dzasum(n, int(dx), incx, queue)",
"def n_qubits(self... | [
"0.5622176",
"0.55178344",
"0.54875433",
"0.54754275",
"0.54187226",
"0.5403692",
"0.5370625",
"0.53659284",
"0.53536034",
"0.5343536",
"0.5331004",
"0.5326438",
"0.53201437",
"0.53091025",
"0.52968806",
"0.5281822",
"0.5273347",
"0.5269883",
"0.5260662",
"0.5232451",
"0.5198... | 0.7440825 | 0 |
Convert from the matrix repr. to a sum of Qubit objects. | def matrix_to_qubit(matrix):
# Determine the format based on the type of the input matrix
format = 'sympy'
if isinstance(matrix, numpy_ndarray):
format = 'numpy'
if isinstance(matrix, scipy_sparse_matrix):
format = 'scipy.sparse'
# Make sure it is of correct dimensions for a Qubit-m... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def qubit_to_matrix(qubit, format='sympy'):\n return represent(qubit, format=format)",
"def matrixRepresentation(self,decimals=8):\n temp = self.circuit.copy()\n temp.remove_final_measurements()\n \n simulator = Aer.get_backend('unitary_simulator')\n result = execute(temp, backe... | [
"0.649804",
"0.60789996",
"0.60693437",
"0.5915642",
"0.5785042",
"0.57471985",
"0.57400465",
"0.5706625",
"0.5706539",
"0.5633878",
"0.5627039",
"0.55849266",
"0.55590624",
"0.55497813",
"0.55459994",
"0.55032027",
"0.54923236",
"0.54870975",
"0.5457419",
"0.5453026",
"0.539... | 0.6158505 | 1 |
Converts an Add/Mul of Qubit objects into it's matrix representation This function is the inverse of ``matrix_to_qubit`` and is a shorthand for ``represent(qubit)``. | def qubit_to_matrix(qubit, format='sympy'):
return represent(qubit, format=format) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def matrix_to_qubit(matrix):\n # Determine the format based on the type of the input matrix\n format = 'sympy'\n if isinstance(matrix, numpy_ndarray):\n format = 'numpy'\n if isinstance(matrix, scipy_sparse_matrix):\n format = 'scipy.sparse'\n\n # Make sure it is of correct dimensions ... | [
"0.6483495",
"0.60163534",
"0.59696865",
"0.57984316",
"0.5759111",
"0.55080485",
"0.54222375",
"0.54192173",
"0.54000086",
"0.537372",
"0.5337003",
"0.528832",
"0.5282309",
"0.52792215",
"0.5255949",
"0.5243365",
"0.5238595",
"0.523825",
"0.5187285",
"0.51807314",
"0.5141006... | 0.7580626 | 0 |
Perform a partial oneshot measurement on the specified qubits. A oneshot measurement is equivalent to performing a measurement on a quantum system. This type of measurement does not return the probabilities like an ensemble measurement does, but rather returns one of the possible resulting states. The exact state that ... | def measure_partial_oneshot(qubit, bits, format='sympy'):
import random
m = qubit_to_matrix(qubit, format)
if format == 'sympy':
m = m.normalized()
possible_outcomes = _get_possible_outcomes(m, bits)
# Form output from function
random_number = random.random()
total_... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sample_action(self, state):\n sample = random.random()\n eps_threshold = self.eps_min + (self.eps - self.eps_min) * \\\n math.exp(-1. * self.n_steps / self.eps_decay)\n self.n_steps += 1\n state = torch.from_numpy(state).float().view(1,-1)\n self.working_q.eval()\n... | [
"0.5452669",
"0.54362243",
"0.5407334",
"0.5249719",
"0.524465",
"0.52398705",
"0.52331674",
"0.5200194",
"0.51928556",
"0.5186895",
"0.5176014",
"0.51499206",
"0.51491505",
"0.5148369",
"0.51262426",
"0.51244986",
"0.5117755",
"0.5107402",
"0.51014465",
"0.5096708",
"0.50922... | 0.60549426 | 0 |
SqlAlchemy implementation of Django's get_or_create. | def get_or_create(model, **kwargs):
session = db.session()
instance = session.query(model).filter_by(**kwargs).first()
if instance:
return instance
else:
instance = model(**kwargs)
session.add(instance)
session.commit()
return instance | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_or_create(cls, **kwargs):\n item = cls.query.filter_by(**kwargs).first()\n if not item:\n item = cls(**kwargs)\n db.session.add(item)\n db.session.commit()\n return item",
"def get_or_create(session, model, **kwargs):\n instance = session.query(mod... | [
"0.7484044",
"0.73871493",
"0.7251417",
"0.7206752",
"0.71264744",
"0.6967797",
"0.6913218",
"0.6912124",
"0.6897794",
"0.67084354",
"0.6707894",
"0.66655236",
"0.6630333",
"0.6630021",
"0.6619963",
"0.6573703",
"0.6530706",
"0.63525754",
"0.63216853",
"0.63090336",
"0.629937... | 0.74065757 | 1 |
Calculates range vector from the resolution and number of gates. | def _calc_range(self) -> np.ndarray:
if self._is_ct25k():
range_resolution = 30
n_gates = 256
else:
n_gates = int(self.metadata["number_of_gates"])
range_resolution = int(self.metadata["range_resolution"])
return np.arange(n_gates) * range_resoluti... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def yield_spectral_range(self) -> Tuple[float, float, float]:\n return [min(self.x), max(self.x), len(self.x)]",
"def _get_range_squared(self) -> np.ndarray:\n m2km = 0.001\n return (self.range * m2km) ** 2",
"def CalcGroundRange(numRxScanAngles, altitude, slantRanges):\n GR_Arr = [] \n... | [
"0.6278803",
"0.6123883",
"0.6043112",
"0.6000051",
"0.59644383",
"0.5919174",
"0.591714",
"0.5906736",
"0.5901892",
"0.58677465",
"0.57892364",
"0.5788498",
"0.57806045",
"0.57336533",
"0.57171845",
"0.56990045",
"0.5685037",
"0.5669597",
"0.5667583",
"0.5666013",
"0.5664344... | 0.76525646 | 0 |
Converts backscatter profile from 2complement hex to floats. | def _read_backscatter(self, lines: list) -> np.ndarray:
n_chars = self._hex_conversion_params[0]
n_gates = int(len(lines[0]) / n_chars)
profiles = np.zeros((len(lines), n_gates), dtype=int)
ran = range(0, n_gates * n_chars, n_chars)
for ind, line in enumerate(lines):
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def signed_to_float(hex: str) -> float:\n if int(hex, 16) & 0x8000:\n return -(int(hex, 16) & 0x7FFF) / 10\n else:\n return int(hex, 16) / 10",
"def _eight_byte_real_to_float(value):\n short1, short2, long3 = struct.unpack(\">HHL\", value)\n exponent = (short1 & 0x7F00) // 256 - 64\n ... | [
"0.6422274",
"0.5781346",
"0.5753307",
"0.5680839",
"0.5558107",
"0.54892313",
"0.5473417",
"0.54634",
"0.5369738",
"0.5368186",
"0.5339587",
"0.53118193",
"0.5303853",
"0.52858853",
"0.52858853",
"0.5229762",
"0.5222226",
"0.5143012",
"0.5120085",
"0.5102902",
"0.5102486",
... | 0.63369536 | 1 |
Splits string between indices. | def split_string(string: str, indices: list) -> list:
return [string[n:m] for n, m in zip(indices[:-1], indices[1:])] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _split(string: str, n: int):\n return [string[start : start + n] for start in range(0, len(string), n)]",
"def splits(text, start=0, end=20) -> Tuple[str, str]:\n return [(text[:i], text[i:]) \n for i in range(start, min(len(text), end)+1)]",
"def split( self, string ):\n splitt... | [
"0.6520151",
"0.62902826",
"0.62278175",
"0.61409515",
"0.6139964",
"0.6139964",
"0.6099039",
"0.6056504",
"0.5991687",
"0.5948822",
"0.5946777",
"0.5937678",
"0.5905042",
"0.5889982",
"0.5874662",
"0.5834748",
"0.58072734",
"0.5780155",
"0.57750016",
"0.5738912",
"0.5723534"... | 0.79518616 | 0 |
Test User cannot register twice | def test_user_cannot_register_twice(self):
self.client.post(SIGNUP_URL,
data=json.dumps(self.user_data), content_type='application/json')
response2 = self.client.post(SIGNUP_URL,
data=json.dumps(self.user_data), content_type='application/json... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_registration_when_user_already_exists(self):\n # register the user the first time\n self.register_user()\n # register the same user the second time\n result = self.client().post(AuthTestCase.registration, data=self.user)\n response_result = json.loads(result.data.decode(... | [
"0.806279",
"0.78608465",
"0.78532577",
"0.78393793",
"0.78150785",
"0.7743362",
"0.7716059",
"0.76043516",
"0.7558615",
"0.75524026",
"0.7539071",
"0.7486336",
"0.74492407",
"0.7429492",
"0.74030185",
"0.73901784",
"0.73419577",
"0.7294215",
"0.7288345",
"0.72760713",
"0.725... | 0.8089655 | 0 |
Test user can register with username less than 4 charcters | def test_user_cannot_register_with_short_username(self):
response = self.client.post(SIGNUP_URL,
data=json.dumps(
{'username': 'dan', 'email': 'oti@gmail.com', 'password': 'pass12345'}),
content_type=... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_empty_user_name_field(self):\r\n result=self.user.get_user_register(\"Stephen\",\" Ochieng\",\"stephenochieng955@mail.com\",\"stephenochieng\",\"eat\")\r\n self.assertEqual(2,result,\"Fill in the username field please\")",
"def test_userNameTooShort(self, *_):\n # open logou... | [
"0.7393769",
"0.73506206",
"0.7343001",
"0.7182281",
"0.7106639",
"0.7085913",
"0.70802885",
"0.7076217",
"0.7027139",
"0.70007133",
"0.6998678",
"0.6968976",
"0.69650525",
"0.6952553",
"0.69470656",
"0.68942535",
"0.68895274",
"0.68883556",
"0.6876523",
"0.6874294",
"0.68319... | 0.75262684 | 0 |
Checks if the task can be marked as done. | def can_mark_as_done(self):
if (not self.event_store.done) and \
((not self.file_submission_required) or self.event_store.has_file_submission) and \
(not self.contains_questions):
return True
return False | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_task_runnable(self, task: Task) -> bool:\n if any([self._task_status_dict[_] == self.FAIL for _ in task.dependencies]):\n self._task_status_dict[task] = self.FAIL\n return False\n ret = self._task_status_dict[task] == self.TODO and reduce(\n lambda a, b: a and ... | [
"0.7419056",
"0.7237488",
"0.72047526",
"0.71315986",
"0.70427597",
"0.69849545",
"0.69040996",
"0.6871549",
"0.68637466",
"0.68568456",
"0.6836337",
"0.6834666",
"0.6820884",
"0.68160105",
"0.6813934",
"0.6809863",
"0.6789853",
"0.6779797",
"0.6764258",
"0.6737795",
"0.67097... | 0.72639024 | 1 |
Checks if the task can be marked as undone. | def can_mark_as_undone(self):
if (not self.archived) and self.event_store.done:
return True
return False | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def can_unassign(self, user, task):\n # not assigned\n if task.owner_id is None:\n return False\n\n # user not logged in\n if user is None or user.is_anonymous:\n return False\n\n # Assigned to the same user\n if is_owner(task.owner, user):\n ... | [
"0.6532559",
"0.63572115",
"0.61371106",
"0.60293853",
"0.5976325",
"0.5955629",
"0.5890635",
"0.5818684",
"0.58134866",
"0.5811415",
"0.5805382",
"0.57229453",
"0.5695379",
"0.5695334",
"0.56772673",
"0.5663306",
"0.56594217",
"0.5659144",
"0.5648361",
"0.56299144",
"0.56294... | 0.6710844 | 0 |
Marks a task as read. | def mark_as_read(self):
params = {"ffauth_device_id": self._DiscretelyAuthenticatedObject__device_id,
"ffauth_secret": self._DiscretelyAuthenticatedObject__device_token}
data = {"data": str({"recipient": {"guid": self._DiscretelyAuthenticatedObject__guid, "type": "user"}})}
req... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def read(self):\n if self.status == 'read':\n return\n self.status = 'read'\n self.emit('read')\n self.emit('modified')",
"def read(self, read):\n\n self._read = read",
"def register_read(self):\n self._reads_since_check += 1",
"def mark_as_read(entry):\n ... | [
"0.66925806",
"0.656951",
"0.64890313",
"0.6362167",
"0.63124907",
"0.6099884",
"0.6024473",
"0.60049987",
"0.59801733",
"0.59156305",
"0.58996105",
"0.5898545",
"0.574459",
"0.5699632",
"0.56549096",
"0.5638324",
"0.5616749",
"0.55888474",
"0.5537343",
"0.5501016",
"0.549111... | 0.7376024 | 0 |
Returns tha text from profiles for the row in some mysterious format matching user_id in Users. If there is no matching user_id, returns an None. | def getText_byID(self, user_id):
sql = "SELECT profile0, profile1, profile2, profile3, profile4, profile5, profile6, profile7, profile8, profile9 FROM Users WHERE id='%s'"\
% (user_id)
res = self.execute(sql)
reslist = res.fetchall()
if reslist == []:
return Non... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _get_username(user_id):\n username = select(u.username for u in UserInformationData if u.user_id == user_id).first()\n\n return username",
"def getUsernameReprForUserID(self, user_id): \n try:\n loaded_user = user_main.getUserPool().getUserByID(user_id)\n ... | [
"0.6260948",
"0.6014765",
"0.5954372",
"0.59216887",
"0.5892329",
"0.58626616",
"0.58214307",
"0.57923317",
"0.57774144",
"0.56982684",
"0.5641938",
"0.56155974",
"0.55905974",
"0.55801386",
"0.558013",
"0.5571766",
"0.5567552",
"0.556005",
"0.5536655",
"0.5535524",
"0.552014... | 0.8087604 | 0 |
Assign a certain k in a certain zone for a given layer > only work with gridgen objects !! | def assign_k_zones(zone1,k1,k,g,layer):
res = g.intersect(zone1,"polygon",layer)
k[res.nodenumber] = k1 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self, k=1):\n self.k = k\n self.x = None\n self.y = None\n self.classes_ = None",
"def set_tile(self, row, col, value):\n # replace with your code\n self._grid_2048[row][col] = value",
"def set_tile(self, row, col, value):\n # replace with your code... | [
"0.55057",
"0.54912364",
"0.5469144",
"0.5466737",
"0.5438826",
"0.5432304",
"0.5413263",
"0.53967863",
"0.5385457",
"0.5385457",
"0.5356505",
"0.5323457",
"0.53229797",
"0.5317433",
"0.53123",
"0.5294941",
"0.5254568",
"0.5249413",
"0.5226946",
"0.52243006",
"0.51999754",
... | 0.75583947 | 0 |
clean password and cookie for username | def clean_cookies(cls, session, username):
session.execute(update(Cookie).
where(Cookie.username == username).
values(password='', cookie='', updated_at=text('NOW()'))) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def resetCredentials(self, request, response):\n response.expireCookie('.ASPXAUTH', path='/', domain=COOKIE_DOMAIN)\n response.expireCookie('username', path='/', domain=COOKIE_DOMAIN)",
"def clean(self):\n username = self.cleaned_data.get(\"username\", \"\")\n password = self.cleaned_... | [
"0.6443419",
"0.64111793",
"0.62431455",
"0.6168335",
"0.61405796",
"0.6134147",
"0.60863394",
"0.6053892",
"0.6029203",
"0.6008575",
"0.5983412",
"0.597939",
"0.5963227",
"0.5954872",
"0.5923782",
"0.5909692",
"0.5906498",
"0.59022903",
"0.5876646",
"0.58692884",
"0.58278745... | 0.67293453 | 0 |
Parse the mqtt section of knx2mqtt.yaml. | def _parse_mqtt(self, config):
if "mqtt" in config:
self._mqtt = config["mqtt"]
if not "host" in self._mqtt:
raise ValueError("MQTT host not set")
if not "port" in self._mqtt:
raise ValueError("MQTT port not set")
if not "user" in self._mqtt:
raise ValueError("MQTT user not set")
if not "password"... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def parse_topic(bot, trigger, from_topic, topic_reset):",
"def read_mqtt_config():\n with open(join(env.get('XDG_CONFIG_HOME',\n join(expanduser('~'), '.config')),\n 'mosquitto_pub')) as f:\n d = dict(line.replace('-', '').split()\n for line i... | [
"0.6000202",
"0.58886313",
"0.567546",
"0.541378",
"0.52717793",
"0.5258463",
"0.52253795",
"0.52064234",
"0.51630515",
"0.5147235",
"0.51131797",
"0.51085556",
"0.5104154",
"0.50803167",
"0.5059522",
"0.50409377",
"0.5025528",
"0.50179446",
"0.50117755",
"0.49910703",
"0.496... | 0.7173313 | 0 |
Parse the knx section of knx2mqtt.yaml. | def _parse_knx(self, config):
if "knx" in config:
self._knx = config["knx"]
for item in self._knx["sensors"]:
if not "address" in item:
raise ValueError("Missing address for KNX sensor")
for item in self._knx["switches"]:
if not "address" in item:
raise ValueError("Missing address for KNX switch"... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _parse_mqtt(self, config):\n\t\tif \"mqtt\" in config:\n\t\t\tself._mqtt = config[\"mqtt\"]\n\t\tif not \"host\" in self._mqtt:\n\t\t\traise ValueError(\"MQTT host not set\")\n\t\tif not \"port\" in self._mqtt:\n\t\t\traise ValueError(\"MQTT port not set\")\n\t\tif not \"user\" in self._mqtt:\n\t\t\traise Valu... | [
"0.5815175",
"0.56160235",
"0.54238546",
"0.509265",
"0.5049914",
"0.5038219",
"0.4936563",
"0.4833255",
"0.4752986",
"0.4752986",
"0.47472683",
"0.4678649",
"0.46611834",
"0.465117",
"0.46472096",
"0.4646028",
"0.46401766",
"0.45628032",
"0.4556737",
"0.45511946",
"0.4493725... | 0.7421064 | 0 |
Prints the string underlined | def underline(string):
return UNDERLINE + string + END | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def underline(self, s):\n return '\\x1F%s\\x1F' % s",
"def title(string):\n print(\"{}\\n{}\\n\".format(bold(string), underline(string, \"=\")))",
"def subtitle(string):\n print(\"{}\\n{}\\n\".format(bold(string), underline(string, \"-\")))",
"def h1(text):\n print(Fore.GREEN + '\\n%s'%text)\... | [
"0.7553552",
"0.7290469",
"0.70276815",
"0.6914132",
"0.68949014",
"0.687162",
"0.66614974",
"0.66405696",
"0.663695",
"0.65904194",
"0.6576936",
"0.65762454",
"0.65680707",
"0.6568058",
"0.65074867",
"0.65056974",
"0.6499431",
"0.646289",
"0.6453295",
"0.64396906",
"0.643557... | 0.7526718 | 1 |
Prints the string slowly | def slowprint(string):
print(string) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def print_slow(paragraph):\r\n\r\n for letter in paragraph:\r\n sys.stdout.write(letter)\r\n sys.stdout.flush()\r\n time.sleep(0.07)",
"def printf(str):\r\n print(str, flush=True)",
"def cool_print(self, text=str, newline=True, margin=21, rate=.02):\n print(\" \" * margin, end... | [
"0.72331697",
"0.6813497",
"0.6761317",
"0.66696286",
"0.6604262",
"0.6547766",
"0.65370333",
"0.6531881",
"0.650622",
"0.6495709",
"0.6380187",
"0.63610196",
"0.6348631",
"0.63424736",
"0.63334304",
"0.6328832",
"0.63164365",
"0.63071245",
"0.62582505",
"0.6217966",
"0.62174... | 0.8368335 | 0 |
Saves struct (list/dict) as json to filename | def save_to_json(filename, struct):
with open(filename, 'w') as outfile:
json.dump(struct, outfile, sort_keys=True, indent=4) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def save_to_json_file(my_obj, filename):\n with open(filename, \"w\") as myfile:\n return myfile.write(json.dumps(my_obj))",
"def save_to_json_file(my_obj, filename):\n with open(filename, \"w\") as f:\n j = json.dumps(my_obj)\n f.write(j)\n f.close()",
"def save_to_json_file(... | [
"0.7510608",
"0.74962854",
"0.748663",
"0.7478168",
"0.74519455",
"0.7450649",
"0.743686",
"0.74211174",
"0.73991674",
"0.7384421",
"0.7376194",
"0.7367668",
"0.73648477",
"0.73585",
"0.73503584",
"0.7329058",
"0.7312244",
"0.7306294",
"0.730574",
"0.7295411",
"0.72725517",
... | 0.8047655 | 0 |
Handle received data that was put in buffer. | def handle_received(self) -> None:
self.buffer: bytes
while self.buffer:
try:
request, self.buffer = parse_request(self.buffer)
if request is None:
_LOGGER.debug("Not enough data to parse request on event channel")
break... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def handle_received(self) -> None:\n self.buffer: bytes\n while len(self.buffer) >= DataHeader.length:\n header = DataHeader.decode(self.buffer, allow_excessive=True)\n if len(self.buffer) < header.size:\n _LOGGER.debug(\n \"Not enough data on d... | [
"0.8349978",
"0.75775415",
"0.7573979",
"0.7540854",
"0.7528105",
"0.7486974",
"0.74647623",
"0.7418748",
"0.7386211",
"0.72862923",
"0.7111345",
"0.70852184",
"0.7081569",
"0.7079743",
"0.7079743",
"0.70263594",
"0.6986728",
"0.6973696",
"0.691508",
"0.6871705",
"0.6834968",... | 0.7619242 | 1 |
Handle incoming protobuf message. | def handle_protobuf(self, message: protobuf.ProtocolMessage) -> None: | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def handle(self, message):",
"def handle_message(self, message):\n print(f\"Got message {message}\")\n if message >> 7 == 1:\n # String\n self.receive_char_array(message)\n elif message >> 3 == 0b00000:\n # Servo position\n self.receive_servo_posit... | [
"0.70562285",
"0.70291376",
"0.69387174",
"0.6855519",
"0.6819541",
"0.67047095",
"0.6694182",
"0.66725963",
"0.6640341",
"0.6595987",
"0.65830135",
"0.65337276",
"0.6532612",
"0.6523133",
"0.65081227",
"0.6482034",
"0.6475986",
"0.64491177",
"0.64273095",
"0.64148635",
"0.63... | 0.85610217 | 0 |
Handle received data that was put in buffer. | def handle_received(self) -> None:
self.buffer: bytes
while len(self.buffer) >= DataHeader.length:
header = DataHeader.decode(self.buffer, allow_excessive=True)
if len(self.buffer) < header.size:
_LOGGER.debug(
"Not enough data on data channel ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def handle_received(self) -> None:\n self.buffer: bytes\n while self.buffer:\n try:\n request, self.buffer = parse_request(self.buffer)\n if request is None:\n _LOGGER.debug(\"Not enough data to parse request on event channel\")\n ... | [
"0.7619242",
"0.75775415",
"0.7573979",
"0.7540854",
"0.7528105",
"0.7486974",
"0.74647623",
"0.7418748",
"0.7386211",
"0.72862923",
"0.7111345",
"0.70852184",
"0.7081569",
"0.7079743",
"0.7079743",
"0.70263594",
"0.6986728",
"0.6973696",
"0.691508",
"0.6871705",
"0.6834968",... | 0.8349978 | 0 |
Serialize a protobuf message and send it to receiver. | def send_protobuf(self, message: protobuf.ProtocolMessage) -> None:
serialized_message = message.SerializeToString()
serialized_length = write_variant(len(serialized_message))
payload = plistlib.dumps(
{"params": {"data": serialized_length + serialized_message}},
fmt=pli... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _send_serialized(self, socket, msg):\n socket.send(pickle.dumps(msg))",
"def send_message(self, message, serializer):\n bin_data = StringIO()\n message_header = MessageHeader(self.coin)\n message_header_serial = MessageHeaderSerializer()\n\n bin_message = serializer.seriali... | [
"0.7227562",
"0.68114996",
"0.6740369",
"0.66435546",
"0.6496455",
"0.63420975",
"0.6337137",
"0.6262494",
"0.6238451",
"0.6202444",
"0.6132999",
"0.6110722",
"0.6082901",
"0.6018124",
"0.5966351",
"0.59480864",
"0.5946279",
"0.594399",
"0.5938781",
"0.593727",
"0.59131914",
... | 0.71838343 | 1 |
Columns to exclude from the table. | def exclude_cols(self, *_, **__) -> Tuple[str, ...]: | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def exclude_columns():\r\n # Table(..., exclude=...)\r\n table = UnorderedTable([], exclude=(\"i\"))\r\n assert [c.name for c in table.columns] == [\"alpha\", \"beta\"]\r\n\r\n # Table.Meta: exclude=...\r\n class PartialTable(UnorderedTable):\r\n class Meta:\r\n exclude = (\"alpha\... | [
"0.78292936",
"0.7563417",
"0.7456267",
"0.72458315",
"0.7024904",
"0.6971191",
"0.6924894",
"0.6811699",
"0.6759133",
"0.6749008",
"0.6698577",
"0.6692394",
"0.6598524",
"0.6597328",
"0.6555528",
"0.651406",
"0.6508021",
"0.6500357",
"0.6495746",
"0.6439906",
"0.64292413",
... | 0.78930134 | 0 |
Test that filters whose extraction functions return extra (nonpath) metadata. | def test_filters_with_extra_extraction(self) -> None:
# pylint: disable=too-many-locals
import hammer_config
tech_dir, tech_dir_base = HammerToolTestHelpers.create_tech_dir("dummy28")
tech_json_filename = os.path.join(tech_dir, "dummy28.tech.json")
def add_named_library(in_di... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_filter_output_third():\n data = [\n {\n \"name\": \"Bill\",\n \"last_name\": \"Gilbert\",\n \"occupation\": \"was here\",\n \"type\": \"person\",\n },\n {\"is_dead\": True, \"kind\": \"parrot\", \"type\": \"bird\", \"name\": \"polly\"},\n... | [
"0.6327611",
"0.6276759",
"0.6087938",
"0.58490276",
"0.5810096",
"0.57594794",
"0.5758346",
"0.5735752",
"0.5727297",
"0.5673309",
"0.56442404",
"0.56208545",
"0.56206983",
"0.5610747",
"0.5610354",
"0.56025726",
"0.5593683",
"0.5569644",
"0.5561838",
"0.55572915",
"0.555249... | 0.72809374 | 0 |
Test that process_library_filter removes duplicates. | def test_process_library_filter_removes_duplicates(self) -> None:
import hammer_config
tech_dir, tech_dir_base = HammerToolTestHelpers.create_tech_dir("dummy28")
tech_json_filename = os.path.join(tech_dir, "dummy28.tech.json")
def add_duplicates(in_dict: Dict[str, Any]) -> Dict[str, An... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def testUsingFilterTool(self):\n pass",
"def test_filters_with_extra_extraction(self) -> None:\n\n # pylint: disable=too-many-locals\n\n import hammer_config\n\n tech_dir, tech_dir_base = HammerToolTestHelpers.create_tech_dir(\"dummy28\")\n tech_json_filename = os.path.join(tec... | [
"0.6058838",
"0.59039664",
"0.58645946",
"0.5838032",
"0.5707587",
"0.5699533",
"0.547616",
"0.5408327",
"0.5390374",
"0.5369573",
"0.53608394",
"0.53520066",
"0.53239757",
"0.52989715",
"0.5266749",
"0.5254747",
"0.52199674",
"0.5208432",
"0.5204943",
"0.52020884",
"0.520071... | 0.86464715 | 0 |
Test that tarballs that are not preextracted work fine. | def test_tarballs_not_extracted(self) -> None:
import hammer_config
tech_dir, tech_dir_base = HammerToolTestHelpers.create_tech_dir("dummy28")
tech_json_filename = os.path.join(tech_dir, "dummy28.tech.json")
# Add defaults to specify tarball_dir.
with open(os.path.join(tech_dir... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_tarballs_pre_extracted(self) -> None:\n import hammer_config\n\n tech_dir, tech_dir_base = HammerToolTestHelpers.create_tech_dir(\"dummy28\")\n tech_json_filename = os.path.join(tech_dir, \"dummy28.tech.json\")\n\n # Add defaults to specify tarball_dir.\n with open(os.pa... | [
"0.71540743",
"0.7003209",
"0.6872319",
"0.6757499",
"0.6628841",
"0.65744656",
"0.6562806",
"0.6431928",
"0.6374527",
"0.6294266",
"0.62729967",
"0.6272495",
"0.6246946",
"0.6177942",
"0.61639875",
"0.6151263",
"0.61316055",
"0.61061126",
"0.6104851",
"0.6088793",
"0.6061415... | 0.723958 | 0 |
Test that tarballs that are preextracted also work as expected. | def test_tarballs_pre_extracted(self) -> None:
import hammer_config
tech_dir, tech_dir_base = HammerToolTestHelpers.create_tech_dir("dummy28")
tech_json_filename = os.path.join(tech_dir, "dummy28.tech.json")
# Add defaults to specify tarball_dir.
with open(os.path.join(tech_dir... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_unarchive_run(self):\n pass",
"def test_tarballs_not_extracted(self) -> None:\n import hammer_config\n\n tech_dir, tech_dir_base = HammerToolTestHelpers.create_tech_dir(\"dummy28\")\n tech_json_filename = os.path.join(tech_dir, \"dummy28.tech.json\")\n\n # Add defaults... | [
"0.72903717",
"0.71897763",
"0.7045785",
"0.6886454",
"0.667936",
"0.6652154",
"0.635477",
"0.63183635",
"0.6268279",
"0.6247111",
"0.6234248",
"0.62324053",
"0.61850697",
"0.618202",
"0.6180559",
"0.61709464",
"0.61703503",
"0.613123",
"0.61186963",
"0.6113157",
"0.6109602",... | 0.73408127 | 0 |
Test that tarballs that are preextracted and specified using a techspecific setting work. | def test_tarballs_pre_extracted_tech_specific(self) -> None:
import hammer_config
tech_dir, tech_dir_base = HammerToolTestHelpers.create_tech_dir("dummy28")
tech_json_filename = os.path.join(tech_dir, "dummy28.tech.json")
# Add defaults to specify tarball_dir.
with open(os.path... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_tarballs_pre_extracted(self) -> None:\n import hammer_config\n\n tech_dir, tech_dir_base = HammerToolTestHelpers.create_tech_dir(\"dummy28\")\n tech_json_filename = os.path.join(tech_dir, \"dummy28.tech.json\")\n\n # Add defaults to specify tarball_dir.\n with open(os.pa... | [
"0.7026664",
"0.6909008",
"0.6227413",
"0.59389323",
"0.5815611",
"0.5743029",
"0.57291543",
"0.57209736",
"0.5661078",
"0.56349015",
"0.56330776",
"0.5606457",
"0.5596066",
"0.5584482",
"0.55632615",
"0.55498993",
"0.5546915",
"0.553915",
"0.55361706",
"0.5526039",
"0.551853... | 0.7541758 | 0 |
Test that extra_prefixes works properly as a property. | def test_extra_prefixes(self) -> None:
lib = hammer_tech.library_from_json('{"openaccess techfile": "test/oa"}') # type: hammer_tech.Library
prefixes_orig = [hammer_tech.PathPrefix(prefix="test", path="/tmp/test")]
prefixes = [hammer_tech.PathPrefix(prefix="test", path="/tmp/test")]
l... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_prefix(self):\n self.chck_triple('prefix')",
"def test_ipam_prefixes_list(self):\n pass",
"def test_ipam_prefixes_update(self):\n pass",
"def test_ipam_prefixes_available_prefixes_create(self):\n pass",
"def test_ipam_prefixes_create(self):\n pass",
"def test_i... | [
"0.7211293",
"0.70284677",
"0.68328136",
"0.67578906",
"0.6701586",
"0.66839415",
"0.6635539",
"0.6489706",
"0.64229876",
"0.63655794",
"0.6343765",
"0.62912714",
"0.61899525",
"0.60675776",
"0.6006809",
"0.5964736",
"0.5819423",
"0.58191967",
"0.57797784",
"0.57596666",
"0.5... | 0.77714616 | 0 |
Test that the technology library can prepend directories correctly. | def test_prepend_dir_path(self) -> None:
tech_json = {
"name": "My Technology Library",
"installs": [
{
"path": "test",
"base var": "" # means relative to tech dir
}
],
"libraries": []
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_PrependPath(self) -> None:\n p1 = r'C:\\dir\\num\\one;C:\\dir\\num\\two'\n p2 = r'C:\\mydir\\num\\one;C:\\mydir\\num\\two'\n # have to include the pathsep here so that the test will work on UNIX too.\n p1 = PrependPath(p1, r'C:\\dir\\num\\two', sep=';')\n p1 = PrependPat... | [
"0.6895971",
"0.6531946",
"0.6341958",
"0.63056904",
"0.62852603",
"0.6272528",
"0.6258107",
"0.6230237",
"0.6223616",
"0.61395836",
"0.6129674",
"0.6127716",
"0.6077424",
"0.60222787",
"0.60103416",
"0.6008759",
"0.5995564",
"0.59741694",
"0.5955105",
"0.5953179",
"0.5935143... | 0.84887713 | 0 |
Test that we can load a yaml tech plugin | def test_yaml_tech_file(self) -> None:
tech_yaml = """
name: My Technology Library
installs:
- path: test
base var: "" # means relative to tech dir
libraries: []
"""
tech_dir, tech_dir_base = HammerToolTestHelpers.create_tech_dir("dummy28")
tech_yaml_filename = os.path.join(t... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_get_yaml_spec(self):\n pass",
"def test_load_yaml(self):\n sample_file = os.path.join(os.path.dirname(__file__), \"sample-config.yaml\")\n self.assertTrue(os.path.exists(sample_file), \"Did not found {}\".format(sample_file))\n self.configurator.load_yaml_file(sample_file)\n\... | [
"0.74287874",
"0.67121106",
"0.6606011",
"0.65671206",
"0.6526244",
"0.6470282",
"0.6448433",
"0.6442283",
"0.6399541",
"0.63569313",
"0.6304567",
"0.62926954",
"0.62887657",
"0.62726283",
"0.62291235",
"0.62012583",
"0.61976874",
"0.61424625",
"0.6138169",
"0.6118438",
"0.60... | 0.7653699 | 0 |
Test that GDS map file support works as expected. | def test_gds_map_file(self) -> None:
import hammer_config
tech_dir, tech_dir_base = HammerToolTestHelpers.create_tech_dir("dummy28")
tech_json_filename = os.path.join(tech_dir, "dummy28.tech.json")
def add_gds_map(in_dict: Dict[str, Any]) -> Dict[str, Any]:
out_dict = deepd... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_valid_map():\n config = load_json_fixture(\"basic-addon-config.json\")\n\n config[\"map\"] = [\"backup:rw\", \"ssl:ro\", \"config\"]\n vd.SCHEMA_ADDON_CONFIG(config)",
"def test_check_map(self):\r\n\r\n header, mapping_data = check_map(self.valid_mapping_data_golay)\r\n\r\n expect... | [
"0.6605901",
"0.6330498",
"0.63260454",
"0.63170296",
"0.6304642",
"0.62582344",
"0.62582344",
"0.61899036",
"0.6184879",
"0.61555594",
"0.614609",
"0.61402524",
"0.6122969",
"0.60845405",
"0.60789454",
"0.6066711",
"0.60316306",
"0.6022553",
"0.601964",
"0.59942186",
"0.5962... | 0.80800724 | 0 |
Test that physical only cells list support works as expected. | def test_physical_only_cells_list(self) -> None:
import hammer_config
tech_dir, tech_dir_base = HammerToolTestHelpers.create_tech_dir("dummy28")
tech_json_filename = os.path.join(tech_dir, "dummy28.tech.json")
def add_physical_only_cells_list(in_dict: Dict[str, Any]) -> Dict[str, Any]:... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_cell_list_success(self, mock_list):\n self.shell('cell-list -r 1')\n self.assertTrue(mock_list.called)",
"def check_all_cells_used(view):\n with pytest.raises(NoUnusedCellsError):\n view._available_cell()",
"def test_cell_list_detail_success(self, mock_list):\n self.shel... | [
"0.63657534",
"0.62314916",
"0.61160076",
"0.61107343",
"0.61041456",
"0.6047402",
"0.5947189",
"0.58665264",
"0.5833725",
"0.5826765",
"0.58061224",
"0.5797946",
"0.57698953",
"0.5765914",
"0.5703728",
"0.5703728",
"0.5690319",
"0.56554013",
"0.5644095",
"0.5629442",
"0.5626... | 0.7840353 | 0 |
Test that "don't use" list support works as expected. | def test_dont_use_list(self) -> None:
import hammer_config
tech_dir, tech_dir_base = HammerToolTestHelpers.create_tech_dir("dummy28")
tech_json_filename = os.path.join(tech_dir, "dummy28.tech.json")
def add_dont_use_list(in_dict: Dict[str, Any]) -> Dict[str, Any]:
out_dict ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def exclude_list(self):\n pass",
"async def test_denylist(hass: HomeAssistant, mock_client) -> None:\n await _setup(\n hass,\n {\n \"exclude_domains\": [\"fake\"],\n \"exclude_entity_globs\": [\"test.excluded_*\"],\n \"exclude_entities\": [\"not_real.exclu... | [
"0.6889779",
"0.6777363",
"0.65137154",
"0.6409508",
"0.6358162",
"0.62983686",
"0.622249",
"0.6219933",
"0.62136173",
"0.6212451",
"0.6174293",
"0.6174293",
"0.61691093",
"0.61588424",
"0.6157046",
"0.61022264",
"0.60640925",
"0.60509753",
"0.60105914",
"0.60078657",
"0.6006... | 0.7286463 | 0 |
Test that getting macro sizes works as expected. | def test_macro_sizes(self) -> None:
import hammer_config
tech_dir, tech_dir_base = HammerToolTestHelpers.create_tech_dir("dummy28")
tech_json_filename = os.path.join(tech_dir, "dummy28.tech.json")
def add_lib_with_lef(d: Dict[str, Any]) -> Dict[str, Any]:
with open(os.path.... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_batch_size_pack_size():",
"def test_sizegetter(self):\n Rectangle.reset_objects()\n r1 = Square(1, 2, 2, 3)\n self.assertEqual(r1.size, 1)",
"def test_size():\n assert Packet106.size == 12",
"def test_size_layout(testapp):\n response = testapp.get('/size', status=200)\n ... | [
"0.6302502",
"0.6124124",
"0.6080522",
"0.6038623",
"0.6004983",
"0.5961535",
"0.5954128",
"0.5947803",
"0.5931542",
"0.5920129",
"0.5874284",
"0.5793864",
"0.5747983",
"0.57410455",
"0.57115674",
"0.56702703",
"0.5662937",
"0.56358474",
"0.5584453",
"0.5583621",
"0.55691266"... | 0.7367017 | 0 |
Test that getting the DRC & LVS decks works as expected. | def test_drc_lvs_decks(self) -> None:
import hammer_config
tech_dir, tech_dir_base = HammerToolTestHelpers.create_tech_dir("dummy28")
tech_json_filename = os.path.join(tech_dir, "dummy28.tech.json")
def add_drc_lvs_decks(in_dict: Dict[str, Any]) -> Dict[str, Any]:
out_dict ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_ccds(self):\n #TODO write ccds tests",
"def test_get_deck(self):\n my_deck = get_deck(deck_name='Test Deck Name')\n self.assertEqual(genanki.deck.Deck , type(my_deck))",
"def test_cards_get(self):\n pass",
"def testDeckInit(self):\n # Test Deck getter and itializat... | [
"0.6163768",
"0.6145059",
"0.60985714",
"0.6022934",
"0.60103625",
"0.59912306",
"0.5978251",
"0.5909073",
"0.5890353",
"0.58754236",
"0.5861262",
"0.58518136",
"0.58502734",
"0.58270365",
"0.5826245",
"0.582224",
"0.5814403",
"0.5810365",
"0.5801054",
"0.5757148",
"0.5721807... | 0.70537055 | 0 |
Test that getting the stackup works as expected. | def test_stackup(self) -> None:
import hammer_config
tech_dir, tech_dir_base = HammerToolTestHelpers.create_tech_dir("dummy28")
tech_json_filename = os.path.join(tech_dir, "dummy28.tech.json")
test_stackup = StackupTestHelper.create_test_stackup_dict(10)
def add_stackup(in_dic... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_push_on_empty_stack(empty_stack): \n empty_stack.push([1, 'Good Boy'])\n assert empty_stack.top.val == [1, 'Good Boy']",
"def test():\n stack = create_stack()\n stack.push(1)\n stack.push(2)\n stack.push(3)\n print('stack should be |-1-2-3-->, and is', stack)\n print('stack.lengt... | [
"0.6808293",
"0.67473346",
"0.6645546",
"0.66205937",
"0.65544116",
"0.6326066",
"0.6249134",
"0.62405765",
"0.6180248",
"0.6124798",
"0.6084141",
"0.5989547",
"0.5914975",
"0.5709093",
"0.56834763",
"0.5673232",
"0.56406236",
"0.56020004",
"0.5570153",
"0.5528231",
"0.550646... | 0.77620244 | 0 |
Create a width table (power_strap_width_table). | def create_w_tbl(index: int, entries: int) -> List[float]:
min_w = StackupTestHelper.index_to_min_width_fn(index)
return list(map(lambda x: min_w*x, range(1, 4 * entries + 1, 4))) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def start_table(self):\n self.col_widths = []\n self.result = \"\"",
"def Width(self):\n return _table.Table_Width(self)",
"def _create_table(sheet, title, style='TableStyleMedium9'):\n # Code originally from:\n # https://stackoverflow.com/questions/39529662/python-automatically-adju... | [
"0.6517943",
"0.60611206",
"0.60609335",
"0.59926575",
"0.59926575",
"0.59028333",
"0.5840251",
"0.5769275",
"0.57690334",
"0.57453996",
"0.5744324",
"0.5721138",
"0.57125837",
"0.56860137",
"0.5628496",
"0.56156945",
"0.55961174",
"0.557879",
"0.55677086",
"0.5564273",
"0.55... | 0.63585967 | 1 |
Test that wires can be parsed correctly from JSON. | def test_wire_parsing_from_json(self) -> None:
grid_unit = StackupTestHelper.mfr_grid()
metal_dict = StackupTestHelper.create_test_metal(3) # type: Dict[str, Any]
direct_metal = Metal.from_setting(grid_unit, StackupTestHelper.create_test_metal(3)) # type: Metal
json_string = json.dumps... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_get_json_spec(self):\n pass",
"def testfromjson(self):\n dicty = {\"id\": 5, \"class\": \"string\", \"list\": [], \"set\": {}}\n self.assertEqual([dicty], Base.from_json_string(json.dumps([dicty])))",
"def testfromjson(self):\n dicty = {\"id\": 5, \"class\": \"string\", \"l... | [
"0.6915474",
"0.6851825",
"0.67324346",
"0.66244113",
"0.6623567",
"0.6587573",
"0.65488607",
"0.64956224",
"0.6491288",
"0.6483365",
"0.6446446",
"0.633767",
"0.6332856",
"0.6292434",
"0.6281167",
"0.6278382",
"0.6259279",
"0.62448704",
"0.62444687",
"0.62429386",
"0.6236468... | 0.7311737 | 0 |
Test that a T W T wire is correctly sized. This will pass if the wide wire does not have a spacing DRC violation to surrounding minimumsized wires and is within a single unit grid. This method is not allowed to round the wire, so simply adding a manufacturing grid should suffice to "fail" DRC. | def test_twt_wire(self) -> None:
# Generate multiple stackups, but we'll only use the largest for this test
stackup = StackupTestHelper.create_test_stackup_list()[-1]
for m in stackup.metals:
# Try with 1 track (this should return a minimum width wire)
w, s, o = m.get_wid... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_twwt_wire(self) -> None:\n # Generate multiple stackups, but we'll only use the largest for this test\n stackup = StackupTestHelper.create_test_stackup_list()[-1]\n for m in stackup.metals:\n # Try with 1 track (this should return a minimum width wire)\n w, s, o ... | [
"0.73848605",
"0.6360773",
"0.6172995",
"0.6024342",
"0.60031366",
"0.5803615",
"0.5750909",
"0.5727803",
"0.5716277",
"0.56985486",
"0.56931585",
"0.5672851",
"0.5653046",
"0.5635821",
"0.56165045",
"0.56151223",
"0.5613681",
"0.56063056",
"0.56013465",
"0.5599059",
"0.55931... | 0.69994617 | 1 |
Test that a T W W T wire is correctly sized. This will pass if the wide wire does not have a spacing DRC violation to surrounding minimumsized wires and is within a single unit grid. This method is not allowed to round the wire, so simply adding a manufacturing grid should suffice to "fail" DRC. | def test_twwt_wire(self) -> None:
# Generate multiple stackups, but we'll only use the largest for this test
stackup = StackupTestHelper.create_test_stackup_list()[-1]
for m in stackup.metals:
# Try with 1 track (this should return a minimum width wire)
w, s, o = m.get_wi... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_twt_wire(self) -> None:\n # Generate multiple stackups, but we'll only use the largest for this test\n stackup = StackupTestHelper.create_test_stackup_list()[-1]\n for m in stackup.metals:\n # Try with 1 track (this should return a minimum width wire)\n w, s, o =... | [
"0.6983309",
"0.6345559",
"0.61687624",
"0.60207117",
"0.59996074",
"0.5813554",
"0.5785194",
"0.57816035",
"0.5761077",
"0.5745062",
"0.5731156",
"0.57153666",
"0.56882745",
"0.5655639",
"0.5637108",
"0.56356",
"0.5631723",
"0.56226707",
"0.5613477",
"0.5588687",
"0.5576358"... | 0.7346225 | 0 |
Instantiate and fit a tICA model, and return a function that embeds additional datasets | def train_tica(X, num_hidden=10, time_lag=10, random_seed=None):
tica = tICA(n_components = num_hidden, lag_time=time_lag)
tica.fit([np.reshape(X, (X.shape[0], -1))])
embed_func = lambda y : tica.transform([np.reshape(y, (y.shape[0], -1))])[0]
return embed_func | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def train_ica(X, num_hidden=10, random_seed=0):\n #svd = TruncatedSVD(n_components=num_hidden, n_iter=7, random_state=random_seed);\n ica = FastICA(n_components=num_hidden, random_state=random_seed);\n ica.fit(np.reshape(X, (X.shape[0], -1)));\n embed_func = lambda y : ica.transform(np.reshape(y, (y.sh... | [
"0.6383332",
"0.59005594",
"0.57943696",
"0.5734057",
"0.5692736",
"0.5665308",
"0.5624545",
"0.5604722",
"0.5597564",
"0.5590204",
"0.5582957",
"0.55553204",
"0.5551445",
"0.553479",
"0.5484468",
"0.5463534",
"0.5453645",
"0.5436253",
"0.54272324",
"0.5421319",
"0.5418966",
... | 0.6534197 | 0 |
Instantiate and fit an ICA model and return a function that embeds additional datasets. | def train_ica(X, num_hidden=10, random_seed=0):
#svd = TruncatedSVD(n_components=num_hidden, n_iter=7, random_state=random_seed);
ica = FastICA(n_components=num_hidden, random_state=random_seed);
ica.fit(np.reshape(X, (X.shape[0], -1)));
embed_func = lambda y : ica.transform(np.reshape(y, (y.shape[0], -... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _input_fn(input_pipeline_context=None):\n return _create_dataset(options, is_training, input_pipeline_context)",
"def __init__(self, lca, inputs, parameters=None, ParametersModel=None):\n\n self.inputs, self.parameters, self.ParametersModel = inputs, parameters, ParametersModel\n\n # 1 Run l... | [
"0.5554248",
"0.5538639",
"0.55316377",
"0.5448427",
"0.5438511",
"0.54360086",
"0.5398383",
"0.5377487",
"0.5349368",
"0.5305217",
"0.52904916",
"0.5287947",
"0.5287797",
"0.52740484",
"0.52615553",
"0.5256297",
"0.5233589",
"0.5220719",
"0.52196914",
"0.51656306",
"0.515963... | 0.5977818 | 0 |
Find the Hankel matrix separately for each row of a data matrix | def hankel_matrix_rowwise(data, p=-1, q=None):
all_hmats = list()
for row in data:
all_hmats.append(hankel_matrix(row, p, q=q))
return np.dstack(all_hmats).T[..., None] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _hankel_matrix(data, p=-1, q=None):\n if len(data.shape) == 1:\n data = data[:, None]\n \n # Hankel parameters\n if p == -1:\n p = len(data)\n if not q:\n q = p\n all_hmats = list()\n for row in data.T:\n\n first, last = row[-(p+q):-p], row[-p:]\n out = h... | [
"0.78848743",
"0.7175692",
"0.6761145",
"0.6761145",
"0.6471998",
"0.6141107",
"0.58669454",
"0.5800729",
"0.57941836",
"0.5792647",
"0.57723117",
"0.56444323",
"0.56391156",
"0.55770826",
"0.5572951",
"0.55666274",
"0.55505836",
"0.5538273",
"0.5504424",
"0.54850346",
"0.546... | 0.7314224 | 1 |
Standardize a T x D time series along its first dimension For dimensions with zero variance, divide by one instead of zero | def standardize_ts(a, scale=1.0):
stds = np.std(a, axis=0, keepdims=True)
stds[stds==0] = 1
return (a - np.mean(a, axis=0, keepdims=True))/(scale*stds) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def standardize(tX):\n features = tX.T\n features_len = len(features)\n means = np.reshape(np.mean(features, axis=1), [features_len, 1])\n stds = np.reshape(np.std(features, axis=1), [features_len, 1])\n features_std = (features - means) / stds\n new_tX = features_std.T\n return new_tX",
"de... | [
"0.70649874",
"0.6813302",
"0.6772515",
"0.6771375",
"0.6760634",
"0.6736333",
"0.66912407",
"0.66744256",
"0.664757",
"0.664757",
"0.6626826",
"0.65421873",
"0.65001184",
"0.6480435",
"0.6467105",
"0.645713",
"0.6410001",
"0.63597214",
"0.632472",
"0.63240105",
"0.6295455",
... | 0.71407187 | 0 |
Create a three dimensional plot, with projections onto the 2D coordinate planes | def plot3dproj(x, y, z, *args, color=(0,0,0), shadow_dist=1.0, color_proj=None,
elev_azim=(39,-47), show_labels=False, **kwargs):
if not color_proj:
color_proj = lighter(color, .6)
if np.isscalar(shadow_dist) == 1:
sdist_x = shadow_dist
sdist_y = shadow_dist
sdist_z = sha... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def plot_surface(self):\n X, Y = np.meshgrid(self.x, self.y)\n fig = plt.figure()\n ax = fig.add_subplot(111, projection='3d')\n ax.plot_surface(X=X, Y=Y, Z=self.z)\n plt.show()",
"def plot_results_traj_3d(p_x, p_y, p_z, xmin, xmax, ymin, ymax, zmin, zmax):\n fig, ax = plt.s... | [
"0.69468373",
"0.6879417",
"0.6744551",
"0.6732459",
"0.67262805",
"0.67217946",
"0.6628411",
"0.6573356",
"0.65710205",
"0.65511537",
"0.6549178",
"0.6519486",
"0.64198565",
"0.6417593",
"0.63577104",
"0.63352025",
"0.6296385",
"0.62671167",
"0.62609535",
"0.62399024",
"0.62... | 0.7089736 | 0 |
_submitNewTask_ Send a new task to the server to be submitted. | def submitNewTask(self, blTaskName, blXml, rng, TotJob,taskType='fullySpecified'):
if not blXml:
raise CrabException('Error while serializing task object to XML')
return -2
if not blTaskName:
raise CrabException('Error while extracting the Task Unique Name string')... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new_task():\n req = request.json\n if 'cmd' in req:\n id = mongo.db.tasks.insert({\n 'cmd' : req['cmd'],\n 'status' : 'Not started'\n })\n\n response = {'id' : str(id)}\n return response",
"def submit(self):\n self._pre_submit()\n\n payload = self... | [
"0.645232",
"0.63769996",
"0.63496876",
"0.6301193",
"0.625359",
"0.6186816",
"0.61234236",
"0.60992616",
"0.6087744",
"0.6009337",
"0.59537405",
"0.59365916",
"0.588325",
"0.58596265",
"0.57959056",
"0.5756937",
"0.5713989",
"0.57027036",
"0.5697756",
"0.5688209",
"0.5679776... | 0.71763784 | 0 |
_subsequentJobSubmit_ Let the submission of other jobs of a task that has been already sent to a server. This method is used for subsequent submission of ranged sets of jobs. | def subsequentJobSubmit(self, blTaskName, rng):
return self._genericCommand('submit', blTaskName, rng) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _submit_special(self, config, job_id, job_params):\n (module, method) = job_params[\"method\"].split(\".\")\n self.logger.log(\"Submit %s as a %s:%s job\" % (job_id, module, method))\n\n self.sr.run(\n config,\n job_params,\n job_id,\n callback=s... | [
"0.5804424",
"0.5776056",
"0.57413834",
"0.57358444",
"0.57067746",
"0.55819726",
"0.54747206",
"0.5474494",
"0.5470042",
"0.5461749",
"0.54425454",
"0.54162073",
"0.540868",
"0.5408295",
"0.5358895",
"0.53489614",
"0.5332772",
"0.5310536",
"0.52930105",
"0.5287498",
"0.52848... | 0.6836618 | 0 |
_killJobs_ Send a kill command to one or more jobs running on the server. | def killJobs(self, blTaskName, rng):
return self._genericCommand('kill', blTaskName, rng) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def killall(self):\n\n for job_id, job in self.jobs:\n backend.kill( job )",
"def kill(self):\n kill_cmds = [\n \"sudo pkill '(daos_server|daos_io_server)' --signal INT\",\n \"sleep 5\",\n \"pkill '(daos_server|daos_io_server)' --signal KILL\",\n ]... | [
"0.7158503",
"0.6926378",
"0.691993",
"0.6866428",
"0.668814",
"0.6427982",
"0.6368388",
"0.6332842",
"0.62388796",
"0.61950135",
"0.6183744",
"0.6045825",
"0.6043953",
"0.6006989",
"0.5993792",
"0.59777397",
"0.5972184",
"0.5937409",
"0.5931378",
"0.5922778",
"0.59222734",
... | 0.7052739 | 1 |
_cleanTask_ Force the server to clean the jobs on the server. | def cleanTask(self, blTaskName):
return self._genericCommand('clean', blTaskName, 'all') | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def clean(self):\n if not self.parent_node.is_job:\n return\n\n self.winstance.send_event('Cleaning job..')\n result = self.winstance.execute_operation('hpc.interfaces.'\n 'lifecycle.cleanup',\n ... | [
"0.68019694",
"0.6353278",
"0.62025964",
"0.61465037",
"0.6128207",
"0.5941723",
"0.5865604",
"0.58294624",
"0.57658476",
"0.5765477",
"0.5748859",
"0.57168764",
"0.5705514",
"0.5700899",
"0.5641087",
"0.5618832",
"0.5608148",
"0.5605661",
"0.55816317",
"0.55550903",
"0.55313... | 0.6513842 | 1 |
_postMortemInfos_ Retrieve the job postmortem information from the server. | def postMortemInfos(self, blTaskName, rng):
# get the status in
raise NotImplementedError
return None | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def post(self, emulator=None):\n # Another emulator check\n if emulator is not None:\n return emulator.emulatePost(self.step)\n\n logging.info(\"Steps.Executors.%s.post called\", self.__class__.__name__)\n\n for step in self.stepSpace.taskSpace.stepSpaces():\n\n if... | [
"0.55825233",
"0.5235281",
"0.503288",
"0.50155884",
"0.49609324",
"0.49102968",
"0.48247075",
"0.4681745",
"0.46383694",
"0.44909593",
"0.44652188",
"0.44383657",
"0.4400397",
"0.43845594",
"0.43353647",
"0.43294773",
"0.43277094",
"0.4298209",
"0.42952365",
"0.42943835",
"0... | 0.6510216 | 0 |
return JSON of user and cohort visits (if available) | def get_user_profile_visits(self, username):
cohorts = current_user.roles
print 'cohorts'
print cohorts
user_visitors = GoogleAnalyticsVisitors.query.filter_by(username=username).all()
user_visitors_dict_list = [x.as_dict() for x in user_visitors]
user_visits = []
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_cohort_data():\n app = bitool.app.test_client()\n resp = app.get(API_URL + cohort_data + no_chache, follow_redirects=True)\n assert (resp.status_code == 200)\n data = json.loads(resp.data)\n calculated_users = sum([x[1] for x in data['report']['data']])\n sum_users = data['sum']['data'][... | [
"0.60581744",
"0.60157967",
"0.59511656",
"0.5858949",
"0.58112484",
"0.57066697",
"0.56156546",
"0.5606249",
"0.5551452",
"0.5516501",
"0.5459006",
"0.5449181",
"0.5438425",
"0.5419009",
"0.5394424",
"0.5381741",
"0.53546077",
"0.53424084",
"0.5314112",
"0.5308594",
"0.53012... | 0.7832844 | 0 |
connects the client and goes into a loop. Be aware, that this is a blocking command | def connect(self):
self.client.connect(self.host, self.port)
self.client.loop_forever() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def run(self):\n self._connection = self.connect()\n self._connection.ioloop.start()",
"def run(self):\n self._connection = self.connect()\n self._connection.ioloop.start()",
"async def connect(self):\n await self._perform_connect()\n\n self.logger.debug(\"ewelink Conn... | [
"0.724414",
"0.724414",
"0.72037584",
"0.7114618",
"0.7091805",
"0.7044648",
"0.70017076",
"0.6920653",
"0.68934035",
"0.6820213",
"0.6798033",
"0.6781949",
"0.6758574",
"0.66782105",
"0.66705227",
"0.66609883",
"0.6656424",
"0.66194844",
"0.6616063",
"0.66122735",
"0.6603637... | 0.7900702 | 0 |
Enable support for plotting `astropy.time.Time` instances in matplotlib. May be (optionally) used with a ``with`` statement. >>> import matplotlib.pyplot as plt >>> from astropy import units as u >>> from astropy import visualization | def time_support(*, scale=None, format=None, simplify=True):
import matplotlib.units as units
from matplotlib.ticker import MaxNLocator, ScalarFormatter
from astropy.visualization.wcsaxes.utils import select_step_hour, select_step_scalar
class AstropyTimeLocator(MaxNLocator):
# Note: we defaul... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def plot_time_frames(self):\n\n fig = plt.figure()\n plt.grid(True)\n\n plt.ylim([-1.5,1.5])\n plt.xlim([0,1])\n\n for key in self.timeframes.keys():\n if key == 0:\n plt.plot(self.x, self.timeframes[key], label=\"time: \" + str(round(key*self.dt, 3)), l... | [
"0.65905195",
"0.6406406",
"0.63377583",
"0.63201445",
"0.6311706",
"0.63017",
"0.6234232",
"0.61642814",
"0.61574334",
"0.60741615",
"0.60497946",
"0.5935163",
"0.59331214",
"0.58911896",
"0.5871035",
"0.58459115",
"0.5793457",
"0.57911664",
"0.578453",
"0.57788163",
"0.5774... | 0.6459914 | 1 |
Sets the bands of this Mosaic. | def bands(self, bands):
self._bands = bands | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def bands(self):\n if self._bands is None:\n self._bands = self._compute_bands()\n return self._bands",
"def bands(self):\n return self._bands",
"def bands(self):\n\t\treturn self._bands",
"def band_filter(self, bands) -> 'ImageCollection':\n\n process_id = 'filter_band... | [
"0.67575103",
"0.6599279",
"0.6558488",
"0.65093297",
"0.650848",
"0.64482033",
"0.62652946",
"0.6179445",
"0.6165092",
"0.60378176",
"0.58848387",
"0.57794374",
"0.5771166",
"0.5665778",
"0.5649109",
"0.5558973",
"0.55262274",
"0.54974896",
"0.5493422",
"0.5487939",
"0.54575... | 0.82149655 | 0 |
Sets the bbox of this Mosaic. | def bbox(self, bbox):
if bbox is None:
raise ValueError("Invalid value for `bbox`, must not be `None`") # noqa: E501
self._bbox = bbox | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_bbox(self, bbox):\n self.bbox = bbox",
"def setBoundingBox(self, *args):\n return _libsbml.GraphicalObject_setBoundingBox(self, *args)",
"def set_bounding_box(self, top_left_y: int, top_left_x: int, bottom_right_y: int, bottom_right_x: int) -> None:\n self.top_left_y = top_left_y\n... | [
"0.8254409",
"0.6432",
"0.62349147",
"0.610715",
"0.6059332",
"0.58962005",
"0.585053",
"0.57841855",
"0.57841855",
"0.5746802",
"0.5718645",
"0.5709271",
"0.56825316",
"0.56825316",
"0.5667116",
"0.5662998",
"0.56617916",
"0.5658419",
"0.56393504",
"0.563394",
"0.5618366",
... | 0.71150315 | 1 |
Sets the coordinate_system of this Mosaic. | def coordinate_system(self, coordinate_system):
if coordinate_system is None:
raise ValueError("Invalid value for `coordinate_system`, must not be `None`") # noqa: E501
self._coordinate_system = coordinate_system | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def setcoordsys(self, csys):\n return _image.image_setcoordsys(self, csys)",
"def set_coordinates(self, coordinates):\n self.coordinates = coordinates",
"def set_coordinates(self, x, y):\n self.x = x\n self.y = y",
"def setSystemGrid(self):\n fromSystem = self.myGalaxy.syst... | [
"0.6719587",
"0.6278986",
"0.5922667",
"0.59182215",
"0.588959",
"0.5849985",
"0.57665986",
"0.5728551",
"0.5694225",
"0.5694225",
"0.5661748",
"0.55528057",
"0.5483587",
"0.5483587",
"0.54241276",
"0.5413565",
"0.5412525",
"0.53980005",
"0.53919095",
"0.5357522",
"0.53249884... | 0.7218263 | 0 |
Sets the first_acquired of this Mosaic. | def first_acquired(self, first_acquired):
if first_acquired is None:
raise ValueError("Invalid value for `first_acquired`, must not be `None`") # noqa: E501
self._first_acquired = first_acquired | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def last_acquired(self, last_acquired):\n if last_acquired is None:\n raise ValueError(\"Invalid value for `last_acquired`, must not be `None`\") # noqa: E501\n\n self._last_acquired = last_acquired",
"def first_dragon(self, first_dragon):\n\n self._first_dragon = first_dragon",
... | [
"0.6116626",
"0.590535",
"0.58046854",
"0.5578976",
"0.5517017",
"0.53449345",
"0.531893",
"0.5268226",
"0.5236329",
"0.52332455",
"0.5203254",
"0.51414144",
"0.50898993",
"0.50764585",
"0.50615245",
"0.5058732",
"0.5057514",
"0.50030786",
"0.49950543",
"0.49950543",
"0.49950... | 0.81768274 | 0 |
Sets the grid of this Mosaic. | def grid(self, grid):
self._grid = grid | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_grid(self,ug):\n self.grd=ug\n self.set_topology()",
"def initialize_grid(self) -> None:\n for i in range(self.grid_size[0]):\n for j in range(self.grid_size[1]):\n self.set(i, j, self.base_color)",
"def _set_grid(self):\n grid_sizex = self.__di... | [
"0.7409461",
"0.7031498",
"0.6960345",
"0.6579605",
"0.642834",
"0.63738185",
"0.63167626",
"0.63167626",
"0.6307249",
"0.62708753",
"0.62708753",
"0.6266942",
"0.62652135",
"0.62610745",
"0.6228437",
"0.6186871",
"0.61814815",
"0.6163807",
"0.6156794",
"0.6115486",
"0.611385... | 0.7569942 | 0 |
Sets the interval of this Mosaic. | def interval(self, interval):
self._interval = interval | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_looping_interval(self, interval: float) -> None:\n \n self._looping_interval = interval",
"def interval(self, interval: int):\n if interval is None:\n raise ValueError(\"Invalid value for `interval`, must not be `None`\")\n self._interval = interval",
"def _assign... | [
"0.67454135",
"0.67060167",
"0.6583133",
"0.65030754",
"0.65030754",
"0.6030693",
"0.59308594",
"0.59201604",
"0.5808056",
"0.5808056",
"0.5698562",
"0.56982684",
"0.5615518",
"0.5602129",
"0.55985624",
"0.5571867",
"0.5568434",
"0.5537268",
"0.5506214",
"0.55010426",
"0.5495... | 0.72398937 | 0 |
Sets the item_types of this Mosaic. | def item_types(self, item_types):
self._item_types = item_types | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def SetItemType(self, item, ct_type):\r\n\r\n item.SetType(ct_type)\r\n self.CalculatePositions()\r\n self.Refresh()",
"def types(self, types):\n\n self._types = types",
"def set_type(self, type: int):\r\n self.type = type\r\n self.canvas.itemconfig(self.item, image=se... | [
"0.64430946",
"0.61266935",
"0.6021917",
"0.5804361",
"0.5702593",
"0.56864417",
"0.5649476",
"0.5592931",
"0.55613834",
"0.54977494",
"0.5463875",
"0.54497254",
"0.53957295",
"0.53350466",
"0.53102475",
"0.52737993",
"0.52699286",
"0.52487415",
"0.52418196",
"0.52275044",
"0... | 0.7848064 | 0 |
Sets the last_acquired of this Mosaic. | def last_acquired(self, last_acquired):
if last_acquired is None:
raise ValueError("Invalid value for `last_acquired`, must not be `None`") # noqa: E501
self._last_acquired = last_acquired | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _set_last_time(self, cur_time):\n self._last_time = cur_time",
"def _set_last_time(self, cur_time):\n self._last_time = cur_time",
"def last_scanned(self, last_scanned):\n\n self._last_scanned = last_scanned",
"def set_last_used_on(self):\n self.last_used_on = datetime.now()\n... | [
"0.5537518",
"0.5537518",
"0.5495096",
"0.54309356",
"0.54286945",
"0.5416515",
"0.5360082",
"0.534619",
"0.5296914",
"0.5294361",
"0.5278487",
"0.5278487",
"0.5278487",
"0.5278487",
"0.52611077",
"0.5198503",
"0.5184331",
"0.5126703",
"0.5121903",
"0.5093953",
"0.50832653",
... | 0.7459788 | 0 |
Sets the product_type of this Mosaic. | def product_type(self, product_type):
if product_type is None:
raise ValueError("Invalid value for `product_type`, must not be `None`") # noqa: E501
self._product_type = product_type | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _set_product_type(self) -> None:\n # Get MTD XML file\n prod_type = self.split_name[2][:3]\n self.product_type = getattr(Sv1ProductType, prod_type)\n\n # Manage not orthorectified product\n if self.product_type == Sv1ProductType.L1B:\n self.is_ortho = False",
"de... | [
"0.7515961",
"0.6762871",
"0.6676806",
"0.64529717",
"0.6408249",
"0.6408249",
"0.633139",
"0.62992305",
"0.6277641",
"0.6277641",
"0.62468994",
"0.6169103",
"0.61569786",
"0.61013544",
"0.6082403",
"0.60692865",
"0.60156286",
"0.60156286",
"0.60156286",
"0.60156286",
"0.6015... | 0.7525529 | 0 |
Sets the quad_download of this Mosaic. | def quad_download(self, quad_download):
self._quad_download = quad_download | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def download_url(self, download_url):\n self._download_url = download_url",
"def download_url(self, download_url):\n\n self._download_url = download_url",
"def download_id(self, download_id):\n self._download_id = download_id",
"def _update_full_path(self):\n if self.download_dir ... | [
"0.5151914",
"0.5086524",
"0.49486166",
"0.4825277",
"0.4802052",
"0.4767873",
"0.47274825",
"0.4724805",
"0.4641992",
"0.4608283",
"0.45846948",
"0.45546815",
"0.45272735",
"0.4525936",
"0.45259303",
"0.45204368",
"0.45086998",
"0.44880506",
"0.44435787",
"0.44394973",
"0.44... | 0.8270648 | 0 |
Function that return the UserProfile that has the id passed as parameter else returns None | def get_user_or_None(id):
try:
u = UserProfile.objects.get(id=id)
return u
except UserProfile.DoesNotExist:
return None | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_profile(profile_id):\n profile = Profile.objects.get(id=profile_id)\n return profile",
"def get_userid_profile(db, user_id):\n return db['user'].find_one({'_id': user_id})",
"def get_user(id):\n pass",
"def get_profile(request):\n p_obj = Profile.objects.filter(hashid=request.session.get... | [
"0.71644473",
"0.7151547",
"0.7139507",
"0.7127676",
"0.6998526",
"0.6989778",
"0.6873488",
"0.68385935",
"0.68286294",
"0.66760945",
"0.6672411",
"0.6669827",
"0.66519827",
"0.6650544",
"0.6629479",
"0.6629479",
"0.6617395",
"0.66064054",
"0.65657747",
"0.655727",
"0.6483729... | 0.8270546 | 0 |
Function that return the Device that has the mac passed as parameter else returns None | def get_device_by_mac_or_None(mac):
try:
d = Device.objects.get(mac=mac)
return d
except Device.DoesNotExist:
return None | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_device(mac, devices=None):\n print('get_device:', get_device)\n if not mac:\n return None\n if not devices:\n devices = discover_wemo()\n\n normal_mac = normalize_mac_address(mac)\n\n for dev in devices:\n if dev.mac and normalize_mac_address(dev.mac) == normal_mac:\n ... | [
"0.8088979",
"0.72715044",
"0.6988598",
"0.6949703",
"0.69022214",
"0.6846499",
"0.6841874",
"0.67178047",
"0.6698748",
"0.6638292",
"0.66217095",
"0.6618738",
"0.6611258",
"0.6611258",
"0.6585049",
"0.65576535",
"0.6549382",
"0.65298074",
"0.6519512",
"0.6502824",
"0.6500106... | 0.8264785 | 0 |
Function that return the Device that has the id passed as parameter else returns None | def get_device_or_None(id):
try:
d = Device.objects.get(id=id)
return d
except Device.DoesNotExist:
return None | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_device_by_id(self, id):\n if not isinstance(id, int):\n id = int(id)\n for i in self.devices:\n if self.devices[i].id == id:\n return self.devices[i]\n raise RuntimeError, \"Device not found\"",
"def GetDevice(self, arg):\n\n if not arg: retu... | [
"0.8163667",
"0.77664423",
"0.7669663",
"0.75724083",
"0.7341329",
"0.7271172",
"0.7266208",
"0.72102916",
"0.7208874",
"0.71464133",
"0.702734",
"0.7002232",
"0.6947416",
"0.6939858",
"0.69324106",
"0.6919207",
"0.6873451",
"0.68549895",
"0.6853468",
"0.67873335",
"0.6744444... | 0.8175079 | 0 |
Initialize with a given MPI communicator and rank for the other end | def __init__(self, mpi_comm, remote_rank=0):
self.mpi_comm = mpi_comm
self.remote_rank = remote_rank
self.status = MPI.Status()
self._outbox = []
self.recv_buffer = None | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def object_communicator():\n comm = MPI.COMM_WORLD",
"def setup_process(self, rank: int = -1, world_size: int = 1):\n self._rank = rank\n self._world_size = world_size\n\n self.process_group_kwargs[\"rank\"] = rank\n self.process_group_kwargs[\"world_size\"] = world_size\n o... | [
"0.67035013",
"0.6611125",
"0.6479122",
"0.6456536",
"0.6221364",
"0.61706007",
"0.6128373",
"0.6091454",
"0.6013113",
"0.5974646",
"0.59431237",
"0.5936744",
"0.5925536",
"0.58980817",
"0.5885234",
"0.5859765",
"0.5852179",
"0.58303416",
"0.576099",
"0.5729894",
"0.57169765"... | 0.7448284 | 0 |
Make sure pending requests are cancelled if the comm is killed. | def kill_pending(self):
for req in self._outbox:
if not req.Test():
req.Cancel()
self._outbox = [] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def cancel_workers(self):\n pass",
"def __exit__(self, exc_type, exc_val, exc_tb):\n self.queue.channel.rpc(self._basic_cancel)\n self.queue.consuming = False",
"def test_cancel_pending_requests(self):\n lookup = Lookup(FindNode, self.target, self.node, self.event_loop)\n # S... | [
"0.64266425",
"0.6417835",
"0.6390152",
"0.6275291",
"0.61637425",
"0.61538917",
"0.6144892",
"0.6081866",
"0.6054581",
"0.6041314",
"0.60346437",
"0.59874374",
"0.5982021",
"0.5955247",
"0.5953227",
"0.5949722",
"0.5947503",
"0.59342057",
"0.5933164",
"0.59268236",
"0.592551... | 0.6879945 | 0 |
Send the requested message (as a pickle) via an MPI isend | def send(self, *args):
self.clean_outbox()
msg, tag = self.process_outgoing(args)
req = self.mpi_comm.isend(msg, dest=self.remote_rank, tag=tag)
self._outbox.append(req) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def send(self, msg):\n self.house.PLM.send_queue.put( msg )",
"def send(self, msg):\n pass",
"def send(self, msg):\n pass",
"def send(self, msg):\n pass",
"def endMessage(self):",
"def mpi_send(data, dest: int, tag: int) -> None:\n MPI.COMM_WORLD.send(data, dest=dest, tag=t... | [
"0.58791095",
"0.5809656",
"0.5809656",
"0.5809656",
"0.5791962",
"0.57908666",
"0.57904756",
"0.5755457",
"0.5721162",
"0.5719202",
"0.5685824",
"0.56838703",
"0.55698174",
"0.5562722",
"0.55615085",
"0.5554099",
"0.55535734",
"0.5549423",
"0.5534972",
"0.55331117",
"0.55223... | 0.66772693 | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.