query
stringlengths
10
2k
document
stringlengths
20
51.2k
metadata
dict
negatives
listlengths
0
101
negative_scores
listlengths
0
101
document_score
stringlengths
3
10
document_rank
stringclasses
102 values
Calculates the feature vector corresponding to the color histogram of the input image. Optionally, you can specify a masked region to focus on.
def describe(self, image, mask=None): histogram = cv2.calcHist([image], [0, 1, 2], mask, self.bins, [0, 256, 0, 256, 0, 256]) cv2.normalize(histogram, histogram) return histogram.flatten()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_color_hist_features(img, p):\n # Compute the histogram of the color channels separately\n channel1_hist = np.histogram(img[:, :, 0], bins=p.hist_bins)\n channel2_hist = np.histogram(img[:, :, 1], bins=p.hist_bins)\n channel3_hist = np.histogram(img[:, :, 2], bins=p.hist_bins)\n # Concatenate...
[ "0.63532484", "0.61453587", "0.61397", "0.6099634", "0.59445685", "0.5775393", "0.57262576", "0.5627488", "0.5626713", "0.56059897", "0.55795723", "0.55732065", "0.55557853", "0.55547327", "0.5506451", "0.5484698", "0.54749954", "0.5433402", "0.5418955", "0.5416462", "0.54003...
0.5417602
19
Returns the 'Add to Cart' button as on Plone 2.5 it is a link but on Plone 3+ it is a control.
def getAddToCartControlOrLink(browser): try: browser.getControl('Add to Cart') return browser.getControl('Add to Cart') except LookupError: return browser.getLink('Add to Cart')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def goto_cart(self):\n self.driver.find_element(*BasePageLocators.GO_CART).click()\n return CartPage(self.driver)", "def checkout_btn(self):\n self._checkout_btn.click()", "def add_create_pl_btn(self):\n self.create_pl = QPushButton(\"Add to playlist\")\n self.create_pl.click...
[ "0.5797779", "0.5744916", "0.57158464", "0.55404997", "0.5528336", "0.54405314", "0.5308705", "0.5291106", "0.5275951", "0.52686775", "0.5261013", "0.5248891", "0.5233275", "0.52236503", "0.5206349", "0.520571", "0.5186595", "0.51761496", "0.51619565", "0.5154222", "0.5139150...
0.7175834
0
visualize all boxes in one image
def vis_all_boxes(im_array, boxes): import matplotlib.pyplot as plt from ..fio.load_ct_img import windowing_rev, windowing im = windowing_rev(im_array+config.PIXEL_MEANS, config.WINDOWING) im = windowing(im, [-175,275]).astype(np.uint8) # soft tissue window plt.imshow(im) color = (0.,1....
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def draw_boxes(self, im, boxes):\n for bbox in boxes:\n l = [int(x) for x in bbox[\"coords\"]]\n l = self.scalebox(l)\n icon = self.classes_to_icons[bbox[\"label\"]]\n overlay_im_to_background(im, icon, l[0], l[1] - icon.shape[0] - 5)\n cv2.rectangle(im...
[ "0.7867931", "0.76596415", "0.756796", "0.74380344", "0.7399842", "0.73794574", "0.71901476", "0.71162546", "0.70859426", "0.7064588", "0.70577294", "0.705543", "0.7016237", "0.6984557", "0.69161266", "0.6911", "0.6865214", "0.6836461", "0.67877877", "0.6779726", "0.6752084",...
0.78662
1
Keep subset of samples. If index is an integer, keep last N=index samples. If index is a list, keep the samples corresponding to the index values in the list.
def samples_keep(self,index): if isinstance(index, (int, long)): index = range(self.samples)[-index:] self.sampled_topics = np.take(self.sampled_topics,index,axis=0) self.tt = np.take(self.tt,index,axis=2) self.dt = np.take(self.dt,index,axis=2) self.samples = len(index)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _index_select_nd(source: torch.Tensor, index: torch.Tensor) -> torch.Tensor:\n index_size = index.size() # (num_atoms/num_bonds, max_num_bonds)\n suffix_dim = source.size()[1:] # (hidden_size,)\n final_size = index_size + suffix_dim # (num_atoms/num_bonds, max_num_bonds, hidden_size)\n\n target ...
[ "0.60203993", "0.59574664", "0.5886324", "0.5867899", "0.5816982", "0.57350016", "0.5727632", "0.5652907", "0.56261337", "0.56184375", "0.56039095", "0.5409709", "0.53960425", "0.5390497", "0.5389218", "0.5389218", "0.5365618", "0.5363418", "0.535475", "0.53461355", "0.533737...
0.7132457
0
This helper function searches the children of the current node until a matching parent node is found and the new child node can be created and added to the parent. The tree is returned.
def add_node(parent_name, child_name, node): if node.name == parent_name: return node.add(Node(child_name)) else: for child in node.children: add_node(parent_name, child_name, child)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _get_next_child_node(self, parent):\n children_keys = list(parent.children)\n sorted_keys = sorted(children_keys)\n for key in sorted_keys:\n node = parent.children[key]\n if node.job_record is None:\n self.timetable.assign_job_record(node)\n ...
[ "0.64843136", "0.6285851", "0.5895083", "0.5884328", "0.58681893", "0.5856776", "0.573341", "0.57237625", "0.5683075", "0.5646689", "0.5581926", "0.55713505", "0.5560289", "0.55426294", "0.55348945", "0.5521475", "0.54992664", "0.54928553", "0.5484332", "0.5477704", "0.545647...
0.58919156
3
Extracts FST symbols that compose complex output label of the rewrite rule. FST symbols of a complex output label is; Epsilon symbol if the complex output label is an epsilon symbol (e.g. [''] for the label ''). All characters of the complex output label if it is not an epsilon symbol (e.g. ['{', 'l', 'p'] for the labe...
def _symbols_of_output(label: str) -> List[str]: if label == common.EPSILON: return [label] # We add a new state transition arc for each character of the output token. return list(label)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _symbols_of_input(label: str) -> List[str]:\n if label == common.EPSILON:\n return [label]\n\n # We add a state transition arc for each digit of a multi-digit number.\n if \"[\" not in label:\n return list(label)\n\n # We add a state transition arc for each inflectional or derivational\n # morpheme,...
[ "0.5881027", "0.53526294", "0.53450996", "0.5294573", "0.50718004", "0.50265986", "0.50232095", "0.5006316", "0.49348602", "0.4923187", "0.4909728", "0.48874924", "0.4883918", "0.48639122", "0.4845914", "0.48448756", "0.4844453", "0.48414075", "0.4839914", "0.4830731", "0.481...
0.6123915
0
Return the canonical path to /etc/rc.local or an equivalent shell script that gets executed during boot up. The last component in the path must not be be a symlink, other components may be.
def _get_rc_local_path( self ): # might be a symlink but prepend_remote_shell_script doesn't work with symlinks return sudo( 'readlink -f /etc/rc.local' )
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def launcher_path() -> Optional[str]:\n return u.resource(LAUNCHER_SCRIPT)", "def executable_path(self):\n prepend = self._active_environment(ActiveEnvironment).prepend\n return prepend.get(\"PATH\", \"\")", "def determine_usr_bin():\n if git_install_requested():\n projects_yaml = conf...
[ "0.6142366", "0.61250097", "0.6099698", "0.6046178", "0.6010571", "0.6000824", "0.59402305", "0.5883539", "0.58717144", "0.58534086", "0.58243835", "0.58120936", "0.57910746", "0.57867146", "0.5785221", "0.5725474", "0.57024145", "0.56905836", "0.5689721", "0.56822443", "0.56...
0.80080163
0
Set the starting RNG offset for current device's local shard before actual op execution. The pre_op_offset value should start from the current RNG offset and increment by the size of local shard until it reaches the size of the whole DTensor. For different ranks that hold the same DTensor shard, their pre_op_offset wil...
def _set_pre_op_offset(self, spec: DTensorSpec) -> None: dtensor_shape = spec.shape mesh = spec.mesh dim_map = spec.dim_map # Compute shard coordinate: # The coordinate on each tensor dim is a tuple (idx, range) # If a DTensor is partitioned on its dim i into n shards, a...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _set_post_op_offset(self, spec: DTensorSpec, old_offset: int) -> None:\n dtensor_shape = spec.shape\n\n from torch.distributed._tensor.ops.utils import prod\n\n numel = prod(dtensor_shape)\n # pytorch: offset must be multiple of 4\n # source: aten/src/ATen/cuda/CUDAGeneratorI...
[ "0.6240967", "0.5669493", "0.5669493", "0.5669493", "0.54019994", "0.53623265", "0.5219316", "0.521635", "0.5167405", "0.50177777", "0.49872008", "0.4977033", "0.49528822", "0.49195656", "0.49027094", "0.48578644", "0.4843479", "0.48360705", "0.48027", "0.47935167", "0.478323...
0.8119143
0
The string representation of an Updater object.
def __str__(self): return self.name
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def to_string(self):\n return \"{name} {status} ({tags}) {mtime}\".format(\n name=self.name, status=self.status, tags=\",\".join(self.tags),\n mtime=self.mtime\n )", "def __str__(self):\n return str(self.serialize())", "def to_str(self):\n return pformat(self.t...
[ "0.6684362", "0.66028064", "0.6448232", "0.6448232", "0.6448232", "0.6448232", "0.6448232", "0.6448232", "0.6448232", "0.6448232", "0.6448232", "0.6448232", "0.6448232", "0.6448232", "0.6448232", "0.6448232", "0.6448232", "0.6448232", "0.6448232", "0.6448232", "0.6448232", ...
0.0
-1
Update the latest copies of the metadata for the toplevel roles. The update request process follows a specific order to ensure the metadata files are securely updated. The client would call refresh() prior to requesting target file information. Calling refresh() ensures target methods, like all_targets() and target(), ...
def refresh(self): # The timestamp role does not have signed metadata about it; otherwise we # would need an infinite regress of metadata. Therefore, we use some # default, sane metadata about it. DEFAULT_TIMESTAMP_FILEINFO = { 'hashes':None, 'length': tuf.conf.DEFAULT_TIMESTAMP_REQUIRED_LE...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _refresh_targets_metadata(self, rolename='targets', include_delegations=False):\n\n roles_to_update = []\n\n # See if this role provides metadata and, if we're including\n # delegations, look for metadata from delegated roles.\n role_prefix = rolename + '/'\n for metadata_path in self.metadata['...
[ "0.70679146", "0.5714709", "0.5503326", "0.54583365", "0.54566574", "0.54549015", "0.5347425", "0.52819204", "0.52689433", "0.5257534", "0.5254578", "0.52315694", "0.52265584", "0.5155415", "0.5107273", "0.5079031", "0.5068169", "0.5066787", "0.5056151", "0.5014376", "0.49083...
0.73300976
0
Get a list of the target information for all the trusted targets on the repository. This list also includes all the targets of delegated roles. The list conforms to 'tuf.formats.TARGETFILES_SCHEMA'
def all_targets(self): # Load the most up-to-date targets of the 'targets' role and all # delegated roles. self._refresh_targets_metadata(include_delegations=True) all_targets = [] # Fetch the targets for the 'targets' role. all_targets = self._targets_of_role('targets', skip_refresh=True...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def Targets(self):\n return self._targets", "def all_targets(self):\n return self._combined_all_versioned_targets.targets", "def ProduceTargets(self):\n\n if self.completion_wanted:\n return self._FindTarget()\n else:\n return []", "def targets(self):\n\n ...
[ "0.6948129", "0.67123234", "0.66501284", "0.66192716", "0.6465113", "0.64457554", "0.6334513", "0.6326923", "0.6301015", "0.6260099", "0.6252691", "0.6228816", "0.62269753", "0.62018263", "0.6183172", "0.6166132", "0.61596525", "0.61502266", "0.6108508", "0.61027354", "0.6072...
0.6962754
0
Gets the task_name of this LoanApplicationTasks.
def task_name(self) -> str: return self._task_name
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getTaskName(self):\n return self._taskName", "def task_name(self):\n pass", "def task(self) -> str:\n return self._task", "def get_task_id(self):\n if self.task_id:\n return self.task_id\n return (f'{self.task_type}_{self.get_source_system().lower()}'\n ...
[ "0.8486359", "0.7913793", "0.75000155", "0.7168119", "0.70443463", "0.69992584", "0.68941015", "0.6861723", "0.68553126", "0.68553126", "0.68553126", "0.68553126", "0.6802803", "0.67627627", "0.67244226", "0.67244226", "0.6719401", "0.6687001", "0.6637115", "0.66048795", "0.6...
0.8500848
0
Gets the stage_name of this LoanApplicationTasks.
def stage_name(self) -> str: return self._stage_name
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def stage_name(self) -> str:\n return pulumi.get(self, \"stage_name\")", "def stage_name(self) -> str:\n return pulumi.get(self, \"stage_name\")", "def stage_name(self) -> str:\n return self._values.get(\"stage_name\")", "def getTaskName(self):\n return self._taskName", "def tas...
[ "0.785884", "0.785884", "0.78139293", "0.718115", "0.70540637", "0.6642022", "0.64218915", "0.63033044", "0.62711096", "0.62711096", "0.62711096", "0.62335616", "0.62320334", "0.6219078", "0.61579126", "0.61254984", "0.6106092", "0.6102382", "0.6053165", "0.6023286", "0.59876...
0.7905333
0
Gets the user_id of this LoanApplicationTasks.
def user_id(self) -> str: return self._user_id
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_user_id(self):\n return self.id_user", "def user_id(self):\n return self._user_id", "def user_id(self):\n return self._user_id", "def user_id(self):\n return self._user_id", "def user_id(self):\n return self._user_id", "def user_id(self):\n return self._u...
[ "0.7086431", "0.70291424", "0.70291424", "0.70291424", "0.70291424", "0.70291424", "0.6958767", "0.67672175", "0.67347693", "0.671793", "0.6684737", "0.6653314", "0.6653314", "0.66438884", "0.6643523", "0.65560263", "0.6537845", "0.6527624", "0.64884424", "0.64740115", "0.647...
0.6766888
9
Return the list of records as a CSV string.
def _format_csv(self, records): # build a unique list of all records keys as CSV headers headers = set() for rec in records: headers.update(rec.keys()) # write the CSV output in memory line = Line() writer = csv.DictWriter(line, fieldnames=sorted(headers)) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_csv_string(self):\n df = None\n for d in self.data:\n if df is None:\n df = d.as_dataframe()\n else:\n df = df.append(d.as_dataframe())\n\n if df is None:\n return \"\"\n else:\n return df.to_csv(index=Fal...
[ "0.7271786", "0.7140292", "0.70011294", "0.6851824", "0.68191326", "0.6764992", "0.6727145", "0.67114055", "0.66873586", "0.6657902", "0.665317", "0.663311", "0.6619071", "0.66161126", "0.6611818", "0.66005844", "0.6586787", "0.65563977", "0.65113693", "0.648396", "0.6463968"...
0.63911295
24
Return the electron density (cm3) from the given line strengths. The ratio vs. density data were lifted from the Osterbrock plot using PlotDigitizer.
def electron_density(I6716, I6731): density_data = np.array([ 9.866987, 19.478735, 36.90968, 72.14769, 122.13107, 226.92259, 376.6114, 612.408, 965.6635, 1538.101, 2687.6423, 4993.7065, 9865.964, 19285.09, 37684.582, 75936.086, 100297.75 ]) ratio_data = np.array([ 1.43274...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def electron_density_per_m3(self):\n return self.electron_density * 1e6", "def Density(material):\n if material == \"mild\":\n return 7850.0\n else:\n if material == \"al\":\n return 2700.0\n else:\n raise ValueError(\"Invalid material `\"+material+\"'\")",...
[ "0.62519455", "0.571582", "0.56194884", "0.55235577", "0.546075", "0.5440967", "0.5409737", "0.5395255", "0.537271", "0.5330324", "0.5321397", "0.53063965", "0.5286988", "0.52837205", "0.5257486", "0.52360797", "0.522596", "0.5218616", "0.5213063", "0.51458985", "0.51415557",...
0.52131957
18
Extract the device name from the broadcast message.
def get_name(self) -> str: return self.message[42:74].decode().rstrip("\x00")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_device_name(self):\n name = self._device[\"name\"]\n if not name or name == \"--\":\n name = self._mac\n\n return name", "def device_name(self) -> pulumi.Input[str]:\n return pulumi.get(self, \"device_name\")", "def device_name(self) -> pulumi.Input[str]:\n ...
[ "0.67338413", "0.6318592", "0.6318592", "0.62614155", "0.6239051", "0.6233916", "0.6233916", "0.61894566", "0.60649115", "0.60500056", "0.6048783", "0.60438234", "0.6007234", "0.60054654", "0.5987213", "0.59741503", "0.59701633", "0.59701633", "0.59701633", "0.59620315", "0.5...
0.58432394
21
Return the current thermostat mode.
def get_thermostat_mode(self) -> ThermostatMode: hex_mode = hexlify(self.message[138:139]).decode() states = dict(map(lambda s: (s.value, s), ThermostatMode)) return ThermostatMode.COOL if hex_mode not in states else states[hex_mode]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_mode(self):\r\n return self._api.get_mode()", "def getmode(self):\n return self.mode", "def mode(self) -> str:\n return pulumi.get(self, \"mode\")", "def mode(self) -> str:\n return pulumi.get(self, \"mode\")", "def get_mode(self):\r\n return self.mode", "def cu...
[ "0.7658945", "0.7552529", "0.7548578", "0.7548578", "0.7477973", "0.73740226", "0.7363553", "0.7352882", "0.7321897", "0.7321897", "0.72539693", "0.7151159", "0.7151159", "0.7151159", "0.7148779", "0.7146024", "0.7146024", "0.7146024", "0.7132851", "0.7081131", "0.70633066", ...
0.7637281
1
Convert the code to a list of positions. E.g. "12" returns [1,2]
def codeToPositions(self, positions_code): # Pull out positions from the code requested_positions = [] for i in range(len(positions_code)): this_position = int(positions_code[i]) requested_positions.append(this_position) return requested_positions
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parse_pos(self, pos):\r\n\r\n column = ord(pos[0]) - 97\r\n if len(pos) == 2:\r\n row = ord(pos[1]) - 49\r\n else:\r\n row = 9\r\n return [row, column]", "def toPosition(self, pos):\n return [ord(pos[0])-ord('a'), int(pos[1])]", "def toPosition(self,...
[ "0.6843231", "0.6796919", "0.6796919", "0.6607168", "0.65984535", "0.6562776", "0.6543961", "0.644775", "0.6356751", "0.6204404", "0.61959976", "0.60942286", "0.6035776", "0.5963504", "0.5939585", "0.59067464", "0.59013224", "0.5897137", "0.58854824", "0.588048", "0.5863592",...
0.76894224
0
Render the welcome web page.
def welcome_callback(): return render_template('welcome.html', title='TheCrew Casting Agency')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def welcome():\n return render_template(\"NFL.html\")", "def welcome(self):\n if self.user:\n return self.render('welcome.html')\n self.redirect('/register')", "def homepage():\n return render_template(\"home/index.html\", title=\"Welcome\")", "def index():\r\n\r\n # initial...
[ "0.81604284", "0.77121913", "0.7602901", "0.7600722", "0.7564354", "0.7564354", "0.75407887", "0.75222844", "0.75171983", "0.747729", "0.7474122", "0.7433239", "0.7431702", "0.74262476", "0.7417094", "0.7406736", "0.7403548", "0.7367974", "0.73373514", "0.7337331", "0.7331297...
0.7644471
2
Return number of days in that year in that month.
def days_in_month(year, month): if not 1 <= month <= 12: return 'Invalid month!' if month == 2 and is_leap(year): return 29 return month_days[month]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def days_in_month(year, month):\n num_days = monthrange(year, month)[1]\n return num_days", "def number_of_days_in_month(year=2019, month=1):\n return monthrange(year, month)[1]", "def days_this_month(year, month):\n ndays = days_per_month(isleap(year))\n return ndays[month - 1]", "def numDays...
[ "0.7997692", "0.7889325", "0.78638434", "0.7840547", "0.783598", "0.7715981", "0.7624352", "0.7588499", "0.7425649", "0.7388009", "0.7358598", "0.7333096", "0.7313871", "0.7271001", "0.7204449", "0.71953046", "0.71922195", "0.71898955", "0.71833366", "0.71833366", "0.71833366...
0.72284496
14
read corpus and return the list of samples
def read_corpus(corpus_path): idx = 0 data = [] with open(corpus_path, encoding='utf-8') as fr: lines = fr.readlines() sent_, tag_, pos_, ner_ = [], [], [], [] for line in lines: idx += 1 if line.find("DOC-ID") < 0 and line != '\n': try: [char, la...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def samples():\n f = open(config['samples'], \"r\")\n samp=[]\n for line in f:\n samp.append(line.strip().split()[0])\n return samp", "def read_corpus(category=\"crude\"):\n files = reuters.fileids(category)\n return [[START_TOKEN] + [w.lower() for w in list(reuters.words(f))] + [END_TOK...
[ "0.7253516", "0.71209", "0.68874484", "0.6785646", "0.6692496", "0.6667914", "0.66610676", "0.66606987", "0.6645692", "0.66435564", "0.66245854", "0.6601106", "0.65994054", "0.6594188", "0.65678537", "0.6542909", "0.651686", "0.6511769", "0.64482135", "0.64112186", "0.6336429...
0.6990145
2
read corpus and return the list of samples
def read_corpus_2(corpus_path): idx = 0 data = [] with open(corpus_path, encoding='utf-8') as fr: lines = fr.readlines() sent_, tag_ = [], [] for line in lines: idx += 1 if line.find("DOC-ID") < 0 and line != '\n': try: [char, label] = line.strip(...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def samples():\n f = open(config['samples'], \"r\")\n samp=[]\n for line in f:\n samp.append(line.strip().split()[0])\n return samp", "def read_corpus(category=\"crude\"):\n files = reuters.fileids(category)\n return [[START_TOKEN] + [w.lower() for w in list(reuters.words(f))] + [END_TOK...
[ "0.7253516", "0.71209", "0.6990145", "0.68874484", "0.6785646", "0.6692496", "0.6667914", "0.66610676", "0.66606987", "0.6645692", "0.66435564", "0.66245854", "0.6601106", "0.65994054", "0.65678537", "0.6542909", "0.651686", "0.6511769", "0.64482135", "0.64112186", "0.6336429...
0.6594188
14
read corpus and return the list of samples
def read_corpus_3(corpus_path): idx = 0 data = [] with open(corpus_path, encoding='utf-8') as fr: lines = fr.readlines() sent_, tag_h_, tag_p_ = [], [], [] for line in lines: idx += 1 if line.find("DOC-ID") < 0 and line != '\n': try: [char, tag_h,...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def samples():\n f = open(config['samples'], \"r\")\n samp=[]\n for line in f:\n samp.append(line.strip().split()[0])\n return samp", "def read_corpus(category=\"crude\"):\n files = reuters.fileids(category)\n return [[START_TOKEN] + [w.lower() for w in list(reuters.words(f))] + [END_TOK...
[ "0.7253516", "0.71209", "0.6990145", "0.68874484", "0.6785646", "0.6692496", "0.6667914", "0.66610676", "0.66606987", "0.6645692", "0.66435564", "0.66245854", "0.6601106", "0.65994054", "0.6594188", "0.6542909", "0.651686", "0.6511769", "0.64482135", "0.64112186", "0.6336429"...
0.65678537
15
read corpus and return the list of samples
def read_tuples_list(corpus_path): idx = 0 data = [] with open(corpus_path, encoding='utf-8') as fr: lines = fr.readlines() sent_, label_h_, pos_, ner_ = [], [], [], [] for line in lines: idx += 1 if line.find("DOC-ID") < 0 and line != '\n': try: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def samples():\n f = open(config['samples'], \"r\")\n samp=[]\n for line in f:\n samp.append(line.strip().split()[0])\n return samp", "def read_corpus(category=\"crude\"):\n files = reuters.fileids(category)\n return [[START_TOKEN] + [w.lower() for w in list(reuters.words(f))] + [END_TOK...
[ "0.7253516", "0.71209", "0.6990145", "0.68874484", "0.6785646", "0.6692496", "0.6667914", "0.66610676", "0.66606987", "0.6645692", "0.66435564", "0.66245854", "0.6601106", "0.65994054", "0.6594188", "0.65678537", "0.6542909", "0.651686", "0.6511769", "0.64482135", "0.64112186...
0.0
-1
find the last '1'(righttoleft) in binary form of num
def get_n_digit(num): cnt = 0 while num & 1 != 1: num >>= 1 cnt += 1 # print(cnt) return cnt
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_bit(num, position):\n\treturn (num >> position) & 0b1", "def _bits(num):\r\n return bin(int(num))[2:]", "def right_extend_lowest_unset_bit(x):\n\n return x & (x + 1)", "def gray_to_binary(self, num):\n mask = num >> 1\n\n while (mask != 0):\n num = num ^ mask\n ...
[ "0.6462073", "0.63376695", "0.6265305", "0.62651724", "0.62086946", "0.6200794", "0.6185784", "0.6185139", "0.6168269", "0.61652124", "0.61032206", "0.60917944", "0.60813725", "0.6069835", "0.60517675", "0.60265416", "0.60141975", "0.6011314", "0.6001939", "0.59928685", "0.59...
0.5617086
75
Randomises all letters position in a input string
def randomise_string(): import random to_rand_str = input("Write a string to randomise. ") randomised_str = "" len_str = len(to_rand_str) while len_str > 0: random_number = random.randint(0, (len_str - 1)) rand_letter = to_rand_str[random_number] randomised_str += rand_lett...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def Fuzz(self, str):\n exploded = [c for c in str]\n for count in range(self.count):\n size = random.randint(self.minimum, self.maximum)\n position = random.randint(0, len(str) - size)\n for iIter in range(size):\n exploded[position + iIter] = self.char...
[ "0.74888813", "0.7318481", "0.72777027", "0.72126967", "0.7211868", "0.7170261", "0.7100922", "0.7078472", "0.70346147", "0.7013867", "0.6986835", "0.69482577", "0.69349843", "0.69003624", "0.68984044", "0.686292", "0.6842817", "0.6841009", "0.68192035", "0.6817344", "0.68061...
0.6967044
11
Returns the Python compiled code object for this file, if it is available, or None if it is not.
def _read_code(self): if self.fileType == FTPythonCompiled: # It's a pyc file; just read it directly. pycVfile = vfs.getFile(self.filename, False) if pycVfile: return self._loadPyc(pycVfile, None) return None elif self.fileType == FTCompi...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def code(self):\r\n if (os.path.exists(self._bytecode_path) and\r\n os.path.getmtime(self.full_path) <= os.path.getmtime(self._bytecode_path)):\r\n with open(self._bytecode_path, 'rb') as bytecode:\r\n return marshal.load(bytecode)\r\n else:\r\n with open(self.full_path, 'rb') as sour...
[ "0.75335735", "0.7469139", "0.7044674", "0.67842853", "0.67842853", "0.6689265", "0.66375077", "0.6616381", "0.6603935", "0.65416414", "0.6507916", "0.65020955", "0.64757884", "0.64366883", "0.6418413", "0.6334043", "0.623301", "0.61632675", "0.6077583", "0.5995937", "0.59553...
0.8227531
0
Return True if 'that' is a GrowPopulation and this GrowPopulation has the same value as that GrowPopulation
def __eq__(self, that): return isinstance(that, GrowPopulation) and self.species_index == that.species_index and \ self.card_trade_index == that.card_trade_index
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __eq__(self, population):\n return self.chromosome_list == population.chromosome_list", "def __eq__(self, other):\n return isinstance(other, Elongation)\\\n and len(self.xs) == len(other.xs)\\\n and all(self.xs == other.xs) and all(self.ys == other.ys)\\\n and s...
[ "0.65205014", "0.60275203", "0.6016418", "0.5955765", "0.59035647", "0.58681065", "0.5847267", "0.5844807", "0.5805479", "0.57989675", "0.5784682", "0.57827413", "0.57796884", "0.57624125", "0.57547325", "0.57336557", "0.5731267", "0.5723152", "0.5716336", "0.5712271", "0.571...
0.80442977
0
Plot some data images of FashionMnistDataset in one line with labels
def show_fashion_mnist(images, labels): use_svg_display() # the '_' here means we don't need that parameter # here init a figure to plot images _, figs = plt.subplots(1, len(images), figsize=(12, 12)) for f, img, lbl in zip(figs, images, labels): # show the image f.imshow(img.view(28...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def plot_labels(lbl: scipy.ndarray, lbl_count: int) -> None:\n color_map = scipy.rand(lbl_count, 3)\n color_map = matplotlib.colors.ListedColormap(color_map)\n plt.imshow(lbl, cmap=color_map)\n plt.show()", "def visualize(**images):\n n_images = len(images)\n plt.figure(figsize=(20,8))\n for...
[ "0.6728893", "0.66888267", "0.6639547", "0.66114897", "0.6588676", "0.65629697", "0.6526726", "0.65079933", "0.63961387", "0.6348753", "0.6331709", "0.6322642", "0.6306844", "0.6306844", "0.6306844", "0.63059264", "0.6299445", "0.6282435", "0.62814975", "0.6277304", "0.626990...
0.73599213
0
Retrieve the total DAG count at a specific path.
def get_last_dag_count(self, file_path) -> int | None: stat = self._file_stats.get(file_path) return stat.num_dags if stat else None
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def countTotalDistance(path):\n current = path[0]\n totalDistance = 0\n\n for node in path[1:]:\n totalDistance += distance_func(current, node)\n current = node\n\n return totalDistance", "def getPathLength(self, path):\r\n path_nodes = path\r\n # print(path_nodes)\r\n ...
[ "0.7386628", "0.6458122", "0.64470994", "0.6376629", "0.6308628", "0.62766296", "0.62018263", "0.60413635", "0.6005236", "0.5995351", "0.59795874", "0.594643", "0.59271145", "0.59261537", "0.59253454", "0.59050786", "0.58911616", "0.58911616", "0.58890563", "0.5885224", "0.58...
0.6231596
6
Retrieve the last start time for processing a specific path.
def get_start_time(self, file_path) -> datetime | None: if file_path in self._processors: return self._processors[file_path].start_time return None
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_starttime(self):\n filetime = datetime.datetime.strptime(self.filenametime,\n \"%Y%m%d_%H%M%S\")\n if self.ldat_type != 'acc':\n starttime = filetime\n else:\n starttime = filetime - datetime.timedelta(seconds=512)\n ...
[ "0.7114907", "0.6834792", "0.67970824", "0.67896086", "0.6649942", "0.658254", "0.65279", "0.650036", "0.6494617", "0.6490718", "0.6469819", "0.64607596", "0.6422892", "0.6396065", "0.6393572", "0.638003", "0.6376569", "0.6376569", "0.63747007", "0.6368677", "0.6352756", "0...
0.71356505
0
To show home address on home_info page
def get_address(saved_home_id): sql = "SELECT address FROM saved_homes WHERE saved_home_id= :saved_home_id" cursor = db.session.execute(sql,{"saved_home_id": saved_home_id}) old_address = cursor.fetchone() address = " ".join(old_address) return address
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show_home(self):\n print(self.home.name)", "def show_home_detail():\r\n\thome_detail = Page.objects.filter(is_home=1)\r\n \r\n\tif home_detail != '':\r\n\t return {'home_detail': home_detail}\r\n\telse:\r\n\t return ''", "def getHomePage(self):\n return self.home_url", "def get_hom...
[ "0.7613753", "0.760187", "0.69635963", "0.68738174", "0.6871794", "0.6871628", "0.6805423", "0.6718558", "0.65399", "0.6522906", "0.6511386", "0.64841217", "0.647899", "0.647795", "0.6444886", "0.63977325", "0.63638", "0.63504744", "0.63504744", "0.6347124", "0.6344191", "0...
0.0
-1
Map values with sigmoid function to range [0,1]. Y(t) = 1/(1 + exp(gain(values shift))
def sigmoid(values, gain, shift): import numpy as np tiny = 0.000000001 # Make sure argument is a numpy array if type(values) != np.ndarray: values = np.array(values) return 1.0 / (1.0 + np.exp(-gain * (values - shift)) + tiny)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sigmoid(value):\n return 1.0 / (1.0 + math.exp(-value))", "def sigmoid(t):\n t[t >= 20] = 20\n t[t <= -20] = -20\n return np.exp(t)/(np.exp(t)+1)", "def sigmoid(x,shift=0,mult=1):\n return 1 / (1 + math.exp(-(x+shift)*mult))", "def sigmoid(x):\r\n return 1 / (1 + np.exp(-x))", ...
[ "0.73663825", "0.71762073", "0.71002215", "0.68752146", "0.6858091", "0.6832065", "0.6828366", "0.6828366", "0.6828366", "0.6828366", "0.6828366", "0.6828366", "0.68040353", "0.6799179", "0.6792524", "0.67914814", "0.6790694", "0.6784127", "0.6758304", "0.67532116", "0.674543...
0.8068838
0
Return semantic version of current PODPAC installation Returns str Semantic version of the current PODPAC installation
def semver(): return ".".join([str(v) for v in VERSION])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def version():\n\n version_full = semver()\n CWD = os.path.dirname(__file__)\n got_git = os.path.exists(os.path.join(os.path.dirname(__file__), \"..\", \".git\"))\n if not got_git:\n return version_full\n try:\n # determine git binary\n git = \"git\"\n try:\n s...
[ "0.7365733", "0.70322514", "0.6790311", "0.6750403", "0.6694661", "0.66637254", "0.6600525", "0.659786", "0.65710485", "0.65667754", "0.65080863", "0.64710176", "0.64678174", "0.6463894", "0.6439941", "0.6439194", "0.6437714", "0.6434811", "0.6434811", "0.6432039", "0.6424445...
0.60696554
79
Return a deepcopy of self NOT just a reference to the same object.
def copy(self): return Insertion_position(self.chromosome, self.strand, position_before=self.position_before, position_after=self.position_after)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def deepcopy(self):\n return self.copy()", "def deepcopy(self):\n return copy.deepcopy(self)", "def copy(self):\r\n return copy.deepcopy(self)", "def copy(self):\n return deepcopy(self)", "def copy(self):\n return deepcopy(self)", "def copy(self):\n return deepco...
[ "0.9030901", "0.8925372", "0.884884", "0.8846612", "0.8846612", "0.8846612", "0.8846612", "0.8846612", "0.8846612", "0.8846612", "0.8846612", "0.8846612", "0.8846612", "0.8846612", "0.8846612", "0.8846612", "0.8846612", "0.8846612", "0.8839397", "0.88350344", "0.8819929", "...
0.0
-1
Raise Error if dataset_name isn't None; give explanation. Many Insertional_mutant methods take a dataset_name argument for consistency with the multidataset subclass, but for nonsubclass objects this shouldn't be provided. The only reason for having them at all is so that you get a more useful error message when you tr...
def _ensure_dataset_None(dataset_name): if dataset_name is not None: raise MutantError("Don't try to provide a dataset_name on a single mutant (rather than the multi-dataset subclass)!") # MAYBE-TODO this could be accomplished with a decorator instead, right?
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _validate_dataset_name(self, dataset_name: Optional[str]) -> str:\n if dataset_name is None:\n if self.num_datasets > 1:\n raise ValueError(\"`dataset_name` is required if there are \"\n \"more than one datasets.\")\n dataset_name = ne...
[ "0.65393716", "0.629011", "0.607913", "0.6057744", "0.60284096", "0.5984428", "0.5735188", "0.571796", "0.5612005", "0.5570402", "0.5567123", "0.55548304", "0.5546228", "0.55137175", "0.5497992", "0.548842", "0.5445214", "0.5429049", "0.54150707", "0.5400183", "0.5380179", ...
0.8115274
0
Set self.position to be the highestcount DEFINED position; check that all positions are within max_allowed_dist of it.
def decide_and_check_position(self, max_allowed_dist=0, ratio_to_ignore=100, OUTPUT=None): if not self.sequences_counts_positions_errors: self.position = SPECIAL_POSITIONS.unknown return def _order(arg): s, (c, p, e) = arg return (p in SPECIAL_POSITIONS.al...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def max_position(self):\n raise NotImplementedError", "def max_positions(self):\n return None", "def set_max_position(self, max_us):\n raise NotImplementedError()", "def __find_max_distance(self):\n return utils.find_max_distance(self.__game)", "def _update_limits(self):\n ...
[ "0.6595603", "0.6491933", "0.6433678", "0.61591154", "0.6157575", "0.6144035", "0.6072857", "0.5985302", "0.5985302", "0.5968435", "0.5918116", "0.58851624", "0.58851624", "0.58576226", "0.57616043", "0.57189703", "0.57189703", "0.57189703", "0.57186514", "0.5714011", "0.5707...
0.6715895
0
Return the number of aligned genomeside READS that DON'T confirm the cassetteside position. ("Confirm" means same chromosome, consistent strand, and at most max_distance away)
def RISCC_N_non_confirming_reads(self, max_distance=MAX_POSITION_DISTANCE): return sum(x[1] for x in self.RISCC_genome_side_aligned_reads.values()) - self.RISCC_N_confirming_reads(max_distance)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def RISCC_N_confirming_reads(self, max_distance=MAX_POSITION_DISTANCE):\n N = 0\n for read_data in self.RISCC_genome_side_aligned_reads.values():\n # skip non-aligned reads; check aligned reads for confirming.\n try: chrom = read_data[0].chromosome\n ...
[ "0.781477", "0.7793685", "0.7674097", "0.64967126", "0.619458", "0.5864441", "0.574625", "0.5703918", "0.56923074", "0.5684121", "0.56391865", "0.561731", "0.5611503", "0.5591194", "0.55641615", "0.545823", "0.540824", "0.540257", "0.53743005", "0.53362334", "0.5294074", "0...
0.76902646
2
Return the distance between the cassetteside read and the furthestaway samearea genomeside read. Return 0 if no samearea genomeside reads, and NaN if there are no uniquely aligned genomeside reads at all.
def RISCC_max_confirmed_distance(self, max_distance=MAX_POSITION_DISTANCE): distances = [] if self.RISCC_N_confirming_seqs(max_distance) + self.RISCC_N_non_confirming_seqs(max_distance) == 0: return float('NaN') for RISCC_read_data in self.RISCC_genome_side_aligned_reads.values(): ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_race_distance(self):\n race_id = self.get_current_race_id(include_horse=False)\n race_id_with_horse = self.get_current_race_id(include_horse=True)\n try:\n distance = self.consolidated_races_db.data.loc[race_id, 'distance']\n return distance\n except KeyErr...
[ "0.5815833", "0.5663634", "0.563486", "0.56179965", "0.5547806", "0.5528521", "0.5451886", "0.54390675", "0.5428044", "0.54127276", "0.53837097", "0.53780013", "0.5372335", "0.5346352", "0.5346352", "0.53249866", "0.5322695", "0.52745056", "0.52734774", "0.5273314", "0.526576...
0.51998264
26
Return readcountrelatedonly object for dataset_name; raise MutantError if None, or if strict=True and not present.
def _check_dataset_name_return_data(self, dataset_name, strict=False): if strict: _check_dataset_presence(self, dataset_name) elif dataset_name is None: raise MutantError("Cannot use None as dataset name!") return self.by_dataset[dataset_name]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def read_info(self, dataset_name=None, strict=False):\n if dataset_name is None: \n raise MutantError(\"This is a multi-dataset mutant - must provide dataset_name arg!\")\n if strict:\n self._check_dataset_presence(dataset_name)\n return self.by_dataset[dataset_name]...
[ "0.69319576", "0.6272699", "0.5400421", "0.531925", "0.5130177", "0.5064544", "0.49735114", "0.49671444", "0.4911462", "0.48912337", "0.48630777", "0.48432705", "0.48193738", "0.47373512", "0.47360268", "0.46914467", "0.46152872", "0.45824707", "0.45510045", "0.45117", "0.449...
0.61236894
2
Add read to given dataset (see docstring for Insertional_mutant version) dataset_name is required.
def add_read(self, HTSeq_alignment, position=SPECIAL_POSITIONS.unknown, read_count=1, dataset_name=None): readcount_data_container = self._check_dataset_name_return_data(dataset_name) Insertional_mutant.add_read(readcount_data_container, HTSeq_alignment, position, read_count)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_to_dataset(self, dataset: Dataset):\n pass", "def add_reference(self, dataset=None):\n if not dataset:\n raise aspecd.exceptions.MissingDatasetError\n dataset_reference = aspecd.dataset.DatasetReference()\n dataset_reference.from_dataset(dataset=dataset)\n se...
[ "0.6095995", "0.59818745", "0.5971621", "0.58394057", "0.57641375", "0.5694613", "0.56901795", "0.5672957", "0.56374884", "0.5603721", "0.5561695", "0.54902554", "0.5469454", "0.5448146", "0.5352664", "0.53225374", "0.5190837", "0.51891935", "0.51786965", "0.5148901", "0.5134...
0.6288449
0
Return total number of reads in given chromosome.
def reads_in_chromosome(self, chromosome): return sum(m.read_info(self.dataset_name).total_read_count for m in self.dataset if m.position not in SPECIAL_POSITIONS.all_undefined and m.position.chromosome==chromosome)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def count(self, chromosome):\n return self.chromosome_list.count(to_chromosome(chromosome))", "def test_count_total_reads(self):\n \n bam = pybedtools.BedTool(clipper.test_file(\"allup_test.bam\"))\n gene_dfn = pybedtools.BedTool(clipper.test_file(\"hg19_genes.bed\"))\n \n ...
[ "0.7780695", "0.66113275", "0.6425552", "0.6353458", "0.631541", "0.6280178", "0.6219694", "0.6006945", "0.59613764", "0.5910651", "0.58733356", "0.5851103", "0.58273345", "0.5808138", "0.57850856", "0.5781013", "0.5725598", "0.5714295", "0.5690985", "0.56745404", "0.5669577"...
0.8146626
0
Initializes empty dataset; saves properties as provided.
def __init__(self, cassette_end='?', relative_read_direction='?', multi_dataset=False): # _mutants_by_IB is the main data structure here, but it's also private: # see "METHODS FOR EMULATING A CONTAINER TYPE" section below for proper ways to interact with mutants. # the single mutants shou...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self):\n self.__dataset = None", "def __init__(self, dataset):\n self._dataset = dataset", "def _init_empty(self):\n self._data = []", "def __init__(self, dataset: Dataset):\n self.dataset = dataset", "def __init__(self):\n self.args = self._prepare_args(loca...
[ "0.7594833", "0.7260724", "0.716007", "0.70915955", "0.70011723", "0.6949563", "0.67328167", "0.67119235", "0.6707864", "0.6665348", "0.66561794", "0.6644198", "0.6633428", "0.6607547", "0.66058487", "0.6540795", "0.65388954", "0.64710194", "0.646978", "0.6457577", "0.6455776...
0.0
-1
Check if dataset contains mutant with given IB. You can only check "IB in dataset" at present, not "mutant in dataset", since the latter would probably also just check by IB, so the syntax would be misleading.
def __contains__(self, IB): return IB in self._mutants_by_IB
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_improper(i0, i1, i2, i3, bond_set):\n if len(set([i0, i1, i2, i3])) == 4:\n if not ((i0, i1) in bond_set and (i1, i2) in bond_set and (i2, i3) in bond_set):\n return True\n return False", "def is_in(batch, data):\n _id = batch[-1]\n for d in data:\n if d[-1] == _id:\n ...
[ "0.59588236", "0.5774592", "0.57421535", "0.56637824", "0.5647611", "0.56438285", "0.55813533", "0.55634737", "0.55409455", "0.5475241", "0.54204434", "0.5393025", "0.5378124", "0.5369297", "0.5363346", "0.5348287", "0.5324083", "0.52803415", "0.5260735", "0.52119124", "0.517...
0.7593823
0
Check that the function returns the right SPECIAL_POSITIONS object when given an unaligned HTSeq aln.
def _check_unaligned_alns(self, aln_parse_function, *extra_args): fake_aln_unaligned_1 = Fake_HTSeq_aln('AAA', 'name', unaligned=True, optional_field_data={'XM':1}) fake_aln_unaligned_2 = Fake_HTSeq_aln('AAA', 'name', unaligned=True, optional_field_data={}) fake_aln_multi_aligned_1 = Fak...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_align_unaligned_seqs(self):\n res = align_unaligned_seqs(self.seqs1_fp, RNA)\n self.assertEqual(res.toFasta(), self.seqs1_aln)", "def test_get_align_coords(self):\n # 01234 5\n # ACGGT--A\n # 012345\n # --GGTTTA\n m1, seq1 = DNA.make_seq(\"ACGGT--A\")....
[ "0.63133895", "0.55383784", "0.5371149", "0.5285918", "0.5271198", "0.51925683", "0.5169525", "0.5145871", "0.5103414", "0.5064759", "0.50444007", "0.4977112", "0.49596253", "0.4956812", "0.49547723", "0.49426582", "0.49426582", "0.49426582", "0.49426582", "0.49426582", "0.49...
0.68770176
0
The last day of the Gregorian year, December. 31st.
def new_years_eve(year): return (year, DEC, 31)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def last_month_day():\r\n return (datetime.now().replace(day=1) + relativedelta(months=1) + timedelta(days=-1)).strftime(\r\n '%d-%m-%Y')", "def last_day(orig_date):\n day_number = calendar.monthrange(orig_date.year, orig_date.month)[1]\n return datetime.date(orig_date.year, orig_date.month, day_...
[ "0.71823746", "0.70941705", "0.6900108", "0.66332793", "0.6582459", "0.6582459", "0.6530405", "0.64617926", "0.6458373", "0.64255553", "0.638717", "0.6365304", "0.6363734", "0.6303382", "0.62421685", "0.62254864", "0.6219994", "0.6197251", "0.6174307", "0.6172735", "0.6149614...
0.0
-1
A pytest fixture that installs a Kerberized kafka service. On teardown, the service is uninstalled.
def kafka_server(kerberos): service_kerberos_options = { "service": { "name": config.SERVICE_NAME, "security": { "kerberos": { "enabled": True, "kdc": { "hostname": kerberos.get_host(), ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_installService(self):\n IService(self.store).startService()\n installOn(self.manager, self.store)\n self.assertTrue(self.manager.running)\n self.manager.deleteFromStore()\n self.assertFalse(self.manager.running)", "def test_services(self):\n self.assertTrue(setu...
[ "0.60170966", "0.59552634", "0.5919339", "0.5837189", "0.5831905", "0.58170533", "0.5686508", "0.5645077", "0.56386113", "0.55976516", "0.54972166", "0.54972166", "0.54955405", "0.54834795", "0.54772455", "0.5468627", "0.54498893", "0.54287946", "0.541711", "0.5416682", "0.53...
0.53261846
26
Dynamically pads the batch_data with pad_id
def _dynamic_padding(self, batch_data, pad_id): pad_p_len = min(self.max_p_len, max(batch_data['passage_length'])) pad_q_len = min(self.max_q_len, max(batch_data['question_length'])) batch_data['passage_token_ids'] = [(ids + [pad_id] * (pad_p_len - len(ids)))[: pad_p_len] ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _dynamic_padding(self, batch_data, pad_id = 0 ):\n #print 'dynamic _padding...'\n #print 'pad_id' + str(pad_id)\n max_p_len = 1000\n max_q_len =1000\n pad_p_len = min(max_p_len, max(batch_data['passage_length']))+1\n #print 'pad_p_len' + str(pad_p_len)\n pad_q_l...
[ "0.82784224", "0.72639644", "0.69665056", "0.6958741", "0.6956212", "0.68224317", "0.6813602", "0.68095857", "0.68010575", "0.6763136", "0.67258495", "0.66987", "0.667535", "0.66577417", "0.6612682", "0.66086715", "0.6608627", "0.6553975", "0.65246", "0.64727557", "0.6432696"...
0.8182605
1
>>> p = Primes(1001) >>> p.is_prime(997) True >>> p.is_prime(1001) False
def is_prime(self, n): if n < self.max_prime: return n in self.prime_set for p in self.primes: if p * p > n: break if not n % p: return False return True
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_prime(self):\n pass", "def isprime(n):\r\n\treturn is_prime(n)", "def isprime(n):\n\treturn is_prime(n)", "def is_prime(n):\n return mr_prime(n)", "def is_prime(p):\n if p == 1:\n return False\n for n in range(2, int(math.sqrt(p))+1):\n if p % n == 0:\n retur...
[ "0.8531202", "0.84002864", "0.8364336", "0.83497155", "0.82136875", "0.81992936", "0.8137174", "0.80896175", "0.8085067", "0.8068134", "0.8063585", "0.80579543", "0.8042331", "0.80412585", "0.8041205", "0.8032606", "0.8024487", "0.80173033", "0.8013622", "0.8013111", "0.80119...
0.0
-1
Get primes below n. >>> sieve(10) [2, 3, 5, 7]
def sieve(n): if n < 2: return [] s = [True] * (n + 1) s[0], s[1] = False, False sq = int(n ** 0.5) for i in range(2, sq + 1): if s[i]: m = n // i - i s[i * i : n + 1 : i] = [False] * (m + 1) return [i for i in range(n + 1) if s[i]]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def primesupto(n):\n # https://stackoverflow.com/questions/2068372/fastest-way-to-list-all-primes-below-n-in-python/3035188#3035188\n sieve = [True] * (n//2)\n for i in range(3,int(n**0.5)+1,2):\n if sieve[i//2]:\n sieve[i*i//2::i] = [False] * ((n-i*i-1)//(2*i)+1)\n return [2] + [2*i+...
[ "0.8195097", "0.810584", "0.8093179", "0.8055696", "0.8040976", "0.802839", "0.8023406", "0.7997397", "0.79744273", "0.7956089", "0.7956089", "0.7953845", "0.79261667", "0.78898954", "0.7879036", "0.7871314", "0.786583", "0.7860378", "0.7845472", "0.77819514", "0.77773607", ...
0.7878645
15
Compare two GatePulsePair object.
def _compareObj(self, other): if not isinstance(other, GatePulsePair): raise Error.ArgumentError(f"GatePulsePair object can not compare with a {type(other)}.") if isinstance(other.cirLine.data, FixedGateOP) and isinstance(self.cirLine.data, RotationGateOP): return False i...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def gateCompare(self,gate1,gate2):\n \n if gate1.getDist()>gate2.getDist():\n return 1\n elif gate1.getDist()==gate2.getDist():\n return 0\n else: #gate1Num<gate2Num\n return -1", "def __eq__(self, other: 'PairwiseInfo') -> bool:\n\n ret...
[ "0.6439984", "0.61721945", "0.60912037", "0.60420144", "0.602644", "0.59933335", "0.5925109", "0.5911374", "0.58882856", "0.5884855", "0.5847428", "0.5843614", "0.58279824", "0.5825291", "0.5825062", "0.5806124", "0.5805809", "0.57896304", "0.57886875", "0.5786566", "0.577911...
0.7468586
0
Create a random direction to estimate the stochastic gradient.
def create_bernouilli(self, m): bernouilli = copy.deepcopy(m) for (name, value) in m.items(): bernouilli[name]['value'] = 1 if random.randint(0, 1) else -1 g = utils.norm2(self.previous_gradient) d = utils.norm2(bernouilli) if g > 0.00001: bernouilli = u...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _rand_direction(dim, rand):\n direction = rand.normal(size=dim)\n return direction / la.norm(direction)", "def __get_new_direction(self):\n return fabs(self.random_generator.normal(self.__direction_mean,\n self.__direction_deviation))", "def setR...
[ "0.71323377", "0.69378144", "0.6739051", "0.6615134", "0.66136473", "0.63115376", "0.62871015", "0.62871015", "0.6219761", "0.6192157", "0.6094219", "0.6062543", "0.6046765", "0.5978258", "0.5854928", "0.57745594", "0.57658273", "0.56828445", "0.56491166", "0.56386614", "0.56...
0.0
-1
View handles the index page of the app
def index(): if 'name' in session: return render_template('home.html') return redirect(url_for('log_in'))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index(self):\n return self.load_view('index.html')", "def index(self):\n\t\treturn render_template('index.html')", "def index(self):\n return render_template('main/index.html')", "def index():\r\n return render_template('index.html')", "def index():\n return render_t...
[ "0.83052963", "0.82342404", "0.82242274", "0.8144953", "0.81312066", "0.81051636", "0.8080778", "0.8073369", "0.8073369", "0.7985023", "0.7972741", "0.79718006", "0.79368055", "0.7933201", "0.79053044", "0.79053044", "0.7864274", "0.78637993", "0.786374", "0.78466785", "0.782...
0.0
-1
Finds the number of people that user_A and user_B have in common.
def count_common_connections(network, user_A, user_B): if user_A not in network or user_B not in network: return False common_connections = 0 for conn in network[user_A]['connections']: if conn in network[user_B]['connections']: common_connections += 1 return common_connectio...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def count_common_connections(network, user_A, user_B):\n count = 0\n if user_A not in network or user_B not in network:\n return False\n for person in network[user_A][0]:\n if person in network[user_B][0]:\n count += 1\n return count", "def common_count(self, node_1, node_2):...
[ "0.81366605", "0.64713997", "0.6242102", "0.6077465", "0.607496", "0.58812374", "0.58194506", "0.5770734", "0.576868", "0.5764771", "0.5734131", "0.5663875", "0.5648639", "0.56372166", "0.56187195", "0.5590245", "0.55224013", "0.5519934", "0.5516126", "0.5513296", "0.55109286...
0.7500884
1
returns euclidean distance p1 is a list of features p2 is alsoa a list of features p1 and p2 should be the same size distance is the squareroot of sum of all squares of differences for each feature
def distance(p1, p2): """ (p1[0] - p2[0]) ** 2 + (p1[1] - p2[1]) ** 2 + """ sum_all = 0 for i, v in enumerate(p1): diff_squared = (v - p2[i]) ** 2 sum_all += diff_squared return(math.sqrt(sum_all))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def compute_feature_distances(features1: np.ndarray, \r\n features2: np.ndarray) -> np.ndarray:\r\n #broadcasting trick\r\n a = features1[:, np.newaxis, :]\r\n b = features2[np.newaxis, :, :]\r\n \r\n return np.linalg.norm( (a-b), axis=-1)", "def GetDist(feature_1, fea...
[ "0.7802887", "0.7571842", "0.7497374", "0.7418175", "0.73836523", "0.73509413", "0.7349909", "0.72473276", "0.7206549", "0.7182788", "0.7123703", "0.7121786", "0.7101655", "0.70998794", "0.70989585", "0.70877427", "0.70846736", "0.7084224", "0.70823973", "0.70755225", "0.7070...
0.76441604
1
Get an existing Bundle resource's state with the given name, id, and optional extra properties used to qualify the lookup.
def get(resource_name: str, id: pulumi.Input[str], opts: Optional[pulumi.ResourceOptions] = None, bundle_name: Optional[pulumi.Input[str]] = None, description: Optional[pulumi.Input[str]] = None, desktop_type: Optional[pulumi.Input[str]] = None, im...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_state_by_id(state_id):\n my_state = storage.get('State', state_id)\n if my_state is None:\n abort(404)\n return jsonify(my_state.to_dict())", "def get_state_by_id(state_id):\n state = storage.get(State, state_id)\n if not state:\n abort(404)\n return jsonify(state.to_dict(...
[ "0.6044276", "0.6008436", "0.59655076", "0.5911224", "0.5793162", "0.57901233", "0.57784617", "0.5725814", "0.5669625", "0.56525624", "0.5647222", "0.5586973", "0.55866736", "0.55588764", "0.55441326", "0.54835856", "0.54622126", "0.5458629", "0.54441386", "0.53769153", "0.53...
0.66141945
0
Return a representation of the class.
def __str__(self): name = self.__class__.__name__ return "[{}] ({}) {}".format(name, self.id, self.__dict__)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __repr__(self):\n outl = 'class :'+self.__class__.__name__\n for attr in self.__dict__:\n outl += '\\n\\t'+attr+' : '+str(getattr(self, attr))\n return outl", "def __repr__(self): # pragma: no cover\r\n class_name = type(self).__name__\r\n attributes = \", \".jo...
[ "0.7749157", "0.76844263", "0.7579117", "0.7566071", "0.74110484", "0.74110484", "0.74110484", "0.74110484", "0.74110484", "0.74105924", "0.73849154", "0.7381766", "0.7376059", "0.73718417", "0.7326836", "0.73002505", "0.7285562", "0.72770023", "0.7275892", "0.7249609", "0.72...
0.0
-1
Updates the public instance attribute ``updated_at`` with the current datetime.
def save(self): self.updated_at = datetime.now() models.storage.save()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def updated_at(self, updated_at: \"datetime\"):\n self._attrs[\"updatedAt\"] = updated_at", "def updated_at(self, updated_at: \"datetime\"):\n self._attrs[\"updatedAt\"] = updated_at", "def updated_at(self, updated_at: \"datetime\"):\n self._attrs[\"updatedAt\"] = updated_at", "def updat...
[ "0.81979823", "0.81979823", "0.81979823", "0.7718596", "0.7718596", "0.7718596", "0.7718596", "0.7718596", "0.7718596", "0.7718596", "0.7718596", "0.7718596", "0.7718596", "0.75866973", "0.74339795", "0.74339795", "0.74339795", "0.7425439", "0.7364339", "0.7349769", "0.732527...
0.6197261
73
Returns a dictionary containing all keys/values of __dict__ of the instance.
def to_dict(self): representation = self.__dict__.copy() representation["updated_at"] = self.updated_at.isoformat() representation["created_at"] = self.created_at.isoformat() representation["__class__"] = self.__class__.__name__ return representation
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def as_dict(self):\n return {k: v for k, v in vars(self).items()}", "def dict(self):\n return self.__dict__", "def dict(self):\n return self.__dict__", "def dict(self):\n return self.__dict__", "def dict(self):\n return self.__dict__", "def dict(self):\n return s...
[ "0.82314974", "0.80360794", "0.80360794", "0.80360794", "0.80360794", "0.80360794", "0.80360794", "0.80360794", "0.8020456", "0.79655004", "0.79408723", "0.7902282", "0.78937936", "0.7879272", "0.7847333", "0.7841208", "0.784089", "0.7838372", "0.78184533", "0.77764755", "0.7...
0.0
-1
Will block access if the resource points to a draft blog post, and the user is different from the author. Any other variation is just passed on to be handled by regular permission checks.
def check_permission(self, action, username, resource, perm): if not resource: return if resource.realm == 'blog' and resource.id: the_post = BlogPost(self.env, resource.id, resource.version) for category in the_post.category_list: if category in self....
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_non_owner_authenticated_user_read_given_blogpost(self):\r\n\r\n with self.flask_app.test_request_context('/'):\r\n app = AppFactory.create()\r\n user = UserFactory.create()\r\n blogpost = BlogpostFactory.create(app=app)\r\n\r\n assert self.mock_authentica...
[ "0.6910113", "0.667111", "0.661465", "0.65971345", "0.65062755", "0.641898", "0.641898", "0.641898", "0.6400173", "0.6387623", "0.63546264", "0.6342159", "0.63315797", "0.6272541", "0.6268477", "0.6256566", "0.622883", "0.62074184", "0.6192771", "0.6173709", "0.6173709", "0...
0.7453113
0
returns the list of A posteriori probabilities P(X/Y) for a received codeword y, compared with all elements in the codebook
def pyx(y,codebook, e0, e1): Pyx_list = tf.TensorArray(tf.float32, size=0, dynamic_size=True) two = tf.cast(2, tf.float32) y=K.round(y) for x in codebook: d11 = K.sum(x * y) d01 = K.sum(tf.math.floormod(x + 1, two) * y) d10 = K.sum(x * tf.math.floormod(y + 1, two)) d00 = K.sum(tf.math.fl...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def allYandPred(self):\n y = []\n pred = []\n if self.use_dic:\n pb = progressbar.ProgressBar(self.n)\n for data in sorted(self.dic):\n for activity in sorted(self.dic[data]):\n for imsize in sorted(self.dic[data][activity]):\n ...
[ "0.6477343", "0.64267325", "0.6422106", "0.6304367", "0.62519485", "0.6223299", "0.60918033", "0.6004236", "0.6003472", "0.5944433", "0.5910038", "0.59020203", "0.58930314", "0.58930314", "0.5884797", "0.58599365", "0.57919717", "0.5788657", "0.57797205", "0.57699245", "0.571...
0.0
-1
Yield successive nsized chunks from l.
def chunks(l, n): for i in range(0, len(l), n): yield l[i:i+n]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _chunk(self, l, n):\n for i in range(0, len(l) + 1, n):\n yield l[i:i + n]", "def chunks(self, l, n):\n for i in range(0, len(l), n):\n yield l[i:i + n]", "def __chunks(l, n):\n for i in range(0, len(l), n):\n yield l[i:i + n]", "def get_chunks(self, ...
[ "0.8038813", "0.79248375", "0.7923423", "0.7885103", "0.78773195", "0.7815877", "0.77655786", "0.77556044", "0.77441615", "0.7731815", "0.77288336", "0.772473", "0.77028215", "0.76889825", "0.76889825", "0.7664208", "0.76570904", "0.7655856", "0.7655856", "0.76458347", "0.764...
0.74379355
94
Provides the command line arguments, suitable for passing to python or python m debugpy, to execute this target. Returns command line arguments as a list, e.g. ["m", "module"]. If any environment variables are needed to properly interpret the command line e.g. PYTHONPATH the implementation should send them in env.
def cli(self, env): raise NotImplementedError
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_cli_arguments(self):\n pass", "def get_python_args(fname, python_args, interact, debug, end_args):\n p_args = []\n if python_args is not None:\n p_args += python_args.split()\n if interact:\n p_args.append('-i')\n if debug:\n p_args.extend(['-m', 'pdb'])\n if fn...
[ "0.687105", "0.6678591", "0.66357404", "0.66155237", "0.6595842", "0.65853894", "0.65821636", "0.653777", "0.6499362", "0.64793676", "0.647323", "0.64673126", "0.64647365", "0.64366806", "0.64262795", "0.6418153", "0.6414664", "0.6410949", "0.6393561", "0.6373703", "0.6365923...
0.0
-1
Calculate mean time to repair
def mttr(self, down_time, failures=1, dec_point=3): self.down_time = down_time self.failures = failures self.dec_point = dec_point mt_tr = round(float(down_time / failures),dec_point) return mt_tr
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def averageTime(self):\n \n pass", "def avg_record_time(self):\n summed_time = 0\n for time_rec in self:\n try:\n summed_time += float(sanitize(time_rec))\n except Exception as err:\n return err\n return summed_time / len(self)", ...
[ "0.7005351", "0.6745492", "0.6721409", "0.6653176", "0.65929484", "0.6568192", "0.65193903", "0.65193903", "0.65193903", "0.6389081", "0.63149", "0.63123274", "0.62758607", "0.6266901", "0.62632585", "0.621137", "0.62012225", "0.6181416", "0.6178095", "0.61768895", "0.6167062...
0.0
-1
Set up the HTU21D sensor.
async def async_setup_platform(hass, config, async_add_entities, discovery_info=None): name = config.get(CONF_NAME) bus_number = config.get(CONF_I2C_BUS) temp_unit = hass.config.units.temperature_unit bus = smbus.SMBus(config.get(CONF_I2C_BUS)) sensor = await hass.async_add_executor_job(partial(HTU...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def setupHw():\n\n pin.setupHw()\n pin.setupOutPins(traffic_lights)\n pin.setDebug(False)", "def _initialize_hardware(self):\n # Import\n try:\n import board\n import busio\n import adafruit_vl6180x\n except Exception as ex:\n logging.erro...
[ "0.6785495", "0.60709953", "0.6040685", "0.6019263", "0.5967158", "0.59412783", "0.5906236", "0.5894144", "0.5891464", "0.58776057", "0.584603", "0.58359516", "0.58337975", "0.58261347", "0.5811149", "0.58005816", "0.5769889", "0.5766768", "0.5764947", "0.5758379", "0.5749928...
0.65923154
1
Return the name of the sensor.
def name(self) -> str: return self._name
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def name(self):\n return self._sensor.name", "def get_sensor_name(self):\n return self.data[1]", "def name(self):\n return self.device.device_data[self.device_id]['name'] + \\\n f' {self._sensor_type}'", "def name(self):\n return f\"{self._name} {SENSOR_TYPES[self.senso...
[ "0.91896784", "0.9168378", "0.890185", "0.8770976", "0.8511273", "0.8479953", "0.844435", "0.8299758", "0.8186503", "0.8105667", "0.8079737", "0.8066149", "0.8049647", "0.7700968", "0.7612295", "0.7611456", "0.7600605", "0.7600605", "0.7600605", "0.75392073", "0.75166553", ...
0.0
-1
Sets the total of this Metadata.
def total(self, total): self._total = total
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_total(self):\n\n self.total = 0\n for item in self.items.all():\n self.total += item.price\n self.save()", "def set_total(self, valeurs):\r\n \r\n self._total = valeurs", "def total_num(self, total_num):\n\n self._total_num = total_num", "def total...
[ "0.7345318", "0.73374975", "0.72063965", "0.71454555", "0.7011428", "0.69185275", "0.69073534", "0.6881462", "0.68273604", "0.67822355", "0.6774405", "0.6726431", "0.6698601", "0.6680655", "0.667271", "0.6666874", "0.66498363", "0.66184264", "0.6577569", "0.65486485", "0.6507...
0.8169622
1
Sets the index of this Metadata.
def index(self, index): self._index = index
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_index(self, index):\n self.index = index", "def index(self, index):\n \"\"\"\n if index is None:\n raise ValueError(\"Invalid value for `index`, must not be `None`\")\n \"\"\"\n\n self.container['index'] = index", "def setIndex(self, index):\n\n self...
[ "0.8639466", "0.8079269", "0.8046353", "0.75118023", "0.73526555", "0.7189295", "0.6799408", "0.6671059", "0.6655663", "0.6651388", "0.6651388", "0.65320814", "0.65255284", "0.6455516", "0.64315563", "0.63905156", "0.6384226", "0.6369748", "0.6339082", "0.63354546", "0.633312...
0.8210771
1
Returns true if both objects are equal
def __eq__(self, other): if not isinstance(other, Metadata): return False return self.__dict__ == other.__dict__
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __eq__(self, other):\n return are_equal(self, other)", "def __eq__(self, other):\n return are_equal(self, other)", "def __eq__(self,other):\n try: return self.object==other.object and isinstance(self,type(other))\n except: return False", "def __eq__(self, other):\n if i...
[ "0.8088132", "0.8088132", "0.8054589", "0.7982687", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", ...
0.0
-1
Returns true if both objects are not equal
def __ne__(self, other): return not self == other
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __ne__(self, other: object) -> bool:\n if self.__eq__(other):\n return False\n return True", "def __ne__(self, other: object) -> bool:\n return not self.__eq__(other)", "def __ne__(self, other) -> bool:\n return not self.__eq__(other)", "def __eq__(self, other):\n ...
[ "0.845611", "0.8391477", "0.8144138", "0.81410587", "0.8132492", "0.8093973", "0.80920255", "0.80920255", "0.80920255", "0.8085325", "0.8085325", "0.8076365", "0.8076365", "0.8065748" ]
0.0
-1
Checks if the sequence provided is valid fasta sequence. Returns True if the sequence is valid, otherwise returns False.
def seq_validator(sequence): # checks for ascii characters that should not appear in a fasta sequence seq_val = re.compile(r"[.-@|\s| -)|z-~|Z-`|EFIJLOPQX|efijlopqx+,]+") if seq_val.search(sequence) is None: return True return False
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def isSequenceValid(sequence):\n if not sequence:\n return False\n allowed_chars = set('GCAU')\n return set(sequence).issubset(allowed_chars)", "def validate_fasta_seq(sequence):\n sequence = sequence.replace(\" \", \"\")\n sequence.upper()\n regex = re.compile('>\\S*\\n[ACTGNRYSWKMBDHVE...
[ "0.76752746", "0.75949574", "0.7480253", "0.72784495", "0.7131281", "0.69375044", "0.6605551", "0.64831626", "0.6424644", "0.63862854", "0.6311217", "0.6299898", "0.62989056", "0.61712056", "0.61065215", "0.6092603", "0.60289305", "0.5995795", "0.5978732", "0.5963744", "0.596...
0.79304975
0
Draws a texture on the internal image. If the texture is smaller than the image it loops.
def __draw_board_texture(self, texture): textureWidth, textureHeight = texture.size for x in range(0, self.width, textureWidth): for y in range(0, self.height, textureHeight): self.baseImage.paste(texture, (x, y))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def draw(self):\n\n glEnable(self.texture.target)\n glBindTexture(self.texture.target, self.texture.id)\n if self.mipmaps:\n glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR)", "def draw(self):\r\n self.screen.blit(self.image, self.image.get_rec...
[ "0.7347973", "0.64104", "0.6329882", "0.6255792", "0.62519455", "0.62173605", "0.6149818", "0.6123493", "0.6123493", "0.6082988", "0.6069757", "0.6025694", "0.59712917", "0.59451574", "0.59443766", "0.59195346", "0.58604574", "0.58564085", "0.58564085", "0.58564085", "0.58564...
0.715414
1
Tests passing parameters to meta.yaml.j2 from the env file.
def test_meta_template_parameters(test_vpc_layer): assert test_vpc_layer.user_params.get('template_parameter') is not None assert test_vpc_layer.meta['parameters']['dummy_parameter']['value'] ==\ test_vpc_layer.user_params['template_parameter']
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_env_params_are_defined_in_template(yaml_file):\n\n bad = []\n template_pair = get_environment_pair(yaml_file)\n\n if not template_pair:\n pytest.skip(\"No yaml/env pair could be determined\")\n\n template = template_pair.get(\"yyml\").get(\"parameters\", {})\n environment = template_...
[ "0.66078675", "0.63288826", "0.59824294", "0.59585816", "0.5934106", "0.5907175", "0.5874221", "0.58330625", "0.5830741", "0.5822122", "0.57508206", "0.57125896", "0.5698372", "0.56952554", "0.5679699", "0.5674827", "0.56495094", "0.5631644", "0.5624198", "0.5590369", "0.5586...
0.54397136
40
Load only the last saved tensor.
def load_last_tensor(path: str, params: Optional[Params]) -> Optional[th.Tensor]: path = get_path_with_hash(path, params) f = get_last_file(path) return th.load(f) if f else None
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load_latest_save(self, device=None):\n return torch.load(str(self.previous_saves()[-1].absolute()), map_location=device)", "def load(self):\n try:\n if self.model.is_cuda:\n self.model.load_state_dict(torch.load(os.path.join(self.save_path, \"save_point.pth\")))\n ...
[ "0.6790029", "0.643399", "0.6366274", "0.62869316", "0.6262909", "0.6245039", "0.6235464", "0.6201017", "0.6193098", "0.61869633", "0.6171663", "0.6100199", "0.60631746", "0.6054893", "0.6017372", "0.6001262", "0.5974573", "0.5973511", "0.5964038", "0.5951946", "0.5906625", ...
0.71581215
0
internal method that returns the name of the app parameter given the solr parameter name. Returns the mapped key if mapping is found else the default value Returned value is a tuple with first value
def __get_app_key_from_solr_key(self, key): keys = self.__config.solr_response_map['map'] if key in keys: return (True, keys[key]) return (False, key)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def mapping_name(self) -> Optional[pulumi.Input[str]]:\n return pulumi.get(self, \"mapping_name\")", "def __get_solr_key_from_app_key(self, key):\n keys = self.__config.get_inverse_map()\n if key in keys:\n return (True, keys[key])\n\n return (False, key)", "def get_param...
[ "0.637135", "0.6053645", "0.60306513", "0.60296565", "0.59799975", "0.5863355", "0.5863355", "0.58111364", "0.5795304", "0.57818747", "0.573486", "0.573421", "0.5727314", "0.5697753", "0.5696839", "0.56940734", "0.5673148", "0.566544", "0.56475675", "0.55933285", "0.55770475"...
0.6488492
0
Takes in at least one other Box instance, and puts them together. The larger box is defined to have the top, bottom, left, and right most extreme points of the other boxes.
def meld(cls, * boxes): startX = min(boxes, key = lambda box : box.startX).startX endX = max(boxes, key = lambda box : box.endX).endX startY= min(boxes, key = lambda box : box.startY).startY endY= max(boxes, key = lambda box : box.endY).endY return Box(startX, startY, endX - startX, endY - startY)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def union(one, other):\n left = min(one.left, other.left)\n right = max(one.right, other.right)\n top = min(one.top, other.top)\n bottom = max(one.bottom, other.bottom)\n return BBox([[left, top], [right, bottom]])", "def union_boxes(boxes: List[\"Box\"]) -> \"Box\":\n left, top, right, bottom ...
[ "0.723586", "0.708304", "0.6461117", "0.6200431", "0.6114625", "0.60403407", "0.59262025", "0.5823309", "0.579138", "0.578995", "0.57894605", "0.5737779", "0.5730122", "0.5690149", "0.5685356", "0.56819886", "0.5671953", "0.5666829", "0.56484586", "0.56234634", "0.5621181", ...
0.61912215
4
Finds the shortest distance between the two boxes. Returns 0 if the boxes are overlapping, or if one box is inside another box.
def dist(self, other): if self.areInside(other): return 0 if self.overlap(other): return 0 # Cases when the tiles are laying parallel to each other # Projection across the x axis if self.startX <= other.startX <= self.endX or\ self.startX <= other.endX <= self.endX or \ other.startX <= self.st...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def minDistBoundingBox(box1, box2):\n\n x1, y1, bw1, bh1 = box1[0], box1[1], box1[2], box1[3]\n x1b, y1b = x1 + bw1, y1 + bh1\n x2, y2, bw2, bh2 = box2[0], box2[1], box2[2], box2[3]\n x2b, y2b = x2 + bw2, y2 + bh2\n left = x2b < x1\n right = x1b < x2\n bottom = y2b < y1\n top = y1b < y2\n ...
[ "0.74275553", "0.68103164", "0.67403597", "0.6711751", "0.67035973", "0.67023194", "0.66537476", "0.65970945", "0.6513673", "0.6502098", "0.6461643", "0.63970274", "0.63797915", "0.63385814", "0.63362014", "0.63344556", "0.6308056", "0.630138", "0.62937796", "0.62810135", "0....
0.6619842
7
Returns true if the boxes are overlapping.
def overlap(self, other): overlap = self.contains(other.startX, other.startY) or \ self.contains(other.startX, other.endY) or \ self.contains(other.endX, other.startY) or \ self.contains(other.endX, other.endY) intersectY1 = self.startY <= other.startY <= self.endY and \ self.startY <= other.endY <= se...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_overlapping(box1, box2):\n if box1[2] <= box2[0]: # If box1 is to the left of box2\n return False\n elif box1[0] >= box2[2]: # If box1 is to the right of box2\n return False\n elif box1[3] <= box2[1]: # If box1 is below box2\n return False\n elif box1[1] >= box2[3]: # If box...
[ "0.82776904", "0.8151015", "0.79514766", "0.7762219", "0.7710359", "0.76590925", "0.7565434", "0.7460858", "0.73995376", "0.73801214", "0.73721325", "0.7369158", "0.72875375", "0.72795033", "0.7265393", "0.7226505", "0.71029097", "0.71029097", "0.7056436", "0.7023035", "0.701...
0.6440349
80
The squared length of the vector.
def sqr_length(self): return self.x * self.x + self.y * self.y
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def length(self):\n return np.sqrt(np.sum(self**2, axis=1)).view(np.ndarray)", "def length(v: Vec2) -> float:\n return sqrt(v.x ** 2 + v.y ** 2)", "def len(self):\n return math.sqrt(self.v[0] * self.v[0] + self.v[1] * self.v[1])", "def length(self):\r\n\r\n return math.sqrt(self*self)...
[ "0.79101974", "0.78495634", "0.7832699", "0.77847624", "0.7722414", "0.76915157", "0.75140554", "0.7508615", "0.75025547", "0.74959695", "0.7479912", "0.74021244", "0.73958635", "0.7385816", "0.73505825", "0.735054", "0.7306931", "0.7299166", "0.7283175", "0.72600776", "0.708...
0.76267433
6
Sets up the test fixture before exercising it.
def setUp(self): # params self.result = None self.wait_for_result = None # publishers self.event_out = rospy.Publisher( '~event_out', std_msgs.msg.String, latch=True ) self.pose_in_pub = rospy.Publisher( '~pose_in', geometry_msgs.msg.PoseS...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _fixture_setup(self):\n pass", "def setUpFixture(self):\n pass", "def setUp(self):\n self.app = load_app(self.application_under_test)\n\n try:\n teardown_db()\n except Exception as e:\n print('-> err ({})'.format(e.__str__()))\n\n setup_app(se...
[ "0.84941816", "0.83272094", "0.7855159", "0.7597948", "0.7563751", "0.7563751", "0.75451756", "0.75261015", "0.75090265", "0.7450294", "0.73686343", "0.7355685", "0.7346011", "0.7333712", "0.7320513", "0.7320445", "0.7318743", "0.73133266", "0.72902155", "0.7288067", "0.72880...
0.0
-1
Return the x coordinate of the rectangle's left edge.
def _rect_left(self): return min(self.x, self.x + self.w)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def left(self):\n return self.points['topLeft'].x", "def left(self):\n return self.points['topLeft'].x", "def pos_left(self, x=1):\n\n self.x -= x\n return self.pos(self.x, self.y)", "def left(self):\n x, y = (self.loc[0] - 1, self.loc[1])\n\n if x < 0:\n ...
[ "0.7934868", "0.7934868", "0.75278914", "0.75106096", "0.74849534", "0.7438955", "0.73301005", "0.72666276", "0.7224344", "0.7210953", "0.7207516", "0.716287", "0.7159352", "0.7111415", "0.7107011", "0.7096342", "0.70923966", "0.7085268", "0.7046702", "0.7046702", "0.70441395...
0.8043434
0
Return the xcoordinate of the rectangle's right edge.
def _rect_right(self): return max(self.x, self.x + self.w)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def right(self):\n return self.points['topRight'].x", "def right(self):\n return self.points['topRight'].x", "def right(self):\n return self.left + self.width", "def get_rightmost_edge(self):\n return self.offset + sum(self.get_screen_widths())", "def getupperleft(self):\n ...
[ "0.78304136", "0.78304136", "0.752309", "0.71365297", "0.71340376", "0.7098199", "0.6944949", "0.6943818", "0.6876187", "0.6863866", "0.6857044", "0.6842752", "0.68269175", "0.68269175", "0.6822077", "0.67144597", "0.6675918", "0.66704386", "0.6663189", "0.6648827", "0.664767...
0.78578556
0
Return the ycoordinate of the rectangle's top edge.
def _rect_top(self): return max(self.y, self.y + self.h)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def top(self):\n return self.points['topRight'].y", "def top(self):\n return self.points['topRight'].y", "def y(self):\n return self.top", "def top_y(self):\r\n return self.position.y + self.size.y + self.bulk", "def get_y_position(self): \n return self.rect.y", "d...
[ "0.8013071", "0.8013071", "0.7716812", "0.7624312", "0.7223911", "0.7139694", "0.7086764", "0.70743144", "0.68563634", "0.6853508", "0.68473446", "0.68470025", "0.6838489", "0.68368363", "0.68299663", "0.6772753", "0.67421156", "0.67209494", "0.6692827", "0.6545961", "0.65459...
0.8257693
0
Return the ycoordinate of the rectangle's bottom edge.
def _rect_bottom(self): return min(self.y, self.y + self.h)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def bottom(self):\n return self.points['bottomRight'].y", "def bottom(self):\n return self.points['bottomRight'].y", "def bottom_y(self):\r\n return self.position.y - self.size.y - self.bulk", "def bottom(self):\n return self.top + self.height", "def _rect_top(self):\n\treturn max...
[ "0.7935119", "0.7935119", "0.7601335", "0.7535251", "0.73022354", "0.7227902", "0.71988606", "0.71584624", "0.7158076", "0.71382874", "0.7126317", "0.70913297", "0.70295787", "0.6968889", "0.69069374", "0.6902811", "0.6878907", "0.6869381", "0.67873216", "0.67635727", "0.6749...
0.8172904
0
Determine whether this rectangle intersects with another rectangle (returns a boolean).
def _rect_intersects(self, rect): b = (self.left() > rect.right() or self.right() < rect.left() or self.top() < rect.bottom() or self.bottom() > rect.top()) return not b
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def intersects(self, other: RectangularRoom) -> bool:\n return (\n self.x1 <= other.x2\n and self.x2 >= other.x1\n and self.y1 <= other.y2\n and self.y2 >= other.y1\n )", "def intersect(self, rectangle):\n return self.contains(recta...
[ "0.79223377", "0.789524", "0.7671105", "0.7589901", "0.7574129", "0.7467193", "0.74514085", "0.7274139", "0.71774423", "0.7162201", "0.714417", "0.7110433", "0.7079117", "0.7049554", "0.6995098", "0.69878197", "0.6979277", "0.69307226", "0.69046235", "0.68844503", "0.6880134"...
0.7656344
3
drop keyspace or view should clear built_views and view_build_status
def test_view_metadata_cleanup(self): session = self.prepare(rf=2, nodes=2) def populate_data(session, rows): logger.debug("populate base data") for v in range(rows): session.execute("INSERT INTO t(k,c,a,b,e,f) VALUES({v},{v},{v},{v},{v},{v})".format(v=v)) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_drop_while_building(self):\n\n session = self.prepare(options={'concurrent_materialized_view_builders': 4}, install_byteman=True)\n session.execute(\"CREATE TABLE t (id int PRIMARY KEY, v int, v2 text, v3 decimal)\")\n\n logger.debug(\"Inserting initial data\")\n for i in range...
[ "0.66753304", "0.659445", "0.642357", "0.6311114", "0.63093346", "0.6288779", "0.62567735", "0.62107736", "0.61885107", "0.61885107", "0.61885107", "0.61885107", "0.61885107", "0.61885107", "0.61885107", "0.61885107", "0.61885107", "0.6145637", "0.6101517", "0.6067494", "0.60...
0.65713894
2
Verify that it's not possible to create or set a too low gc_grace_seconds on MVs
def test_gcgs_validation(self): session = self.prepare(user_table=True) # Shouldn't be able to alter the gc_grace_seconds of the base table to 0 assert_invalid(session, "ALTER TABLE users WITH gc_grace_seconds = 0", "Cannot alter gc_grace_seconds of...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check_gc_min_max(self):\n if not self.allow_open_amount:\n return\n\n if self.gc_min < 0 or self.gc_max < 0:\n self.raise_user_error(\"negative_amount_not_allowed\")\n\n if self.gc_min > self.gc_max:\n self.raise_user_error(\"invalid_amount\")", "def test...
[ "0.5917992", "0.5739292", "0.5642895", "0.56359136", "0.5613127", "0.55982673", "0.55579895", "0.5507703", "0.546689", "0.5466805", "0.54514426", "0.5366381", "0.53661144", "0.52998894", "0.52954394", "0.5257324", "0.52490336", "0.523056", "0.5204648", "0.51972055", "0.518032...
0.6689494
0
Yield all valid states obtainable from this state.
def next(self): pass
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __iter__(self):\n return self.states()", "def iter_states(self):\n return iter(self._states_)", "def variables(self):\n for state in self.states:\n yield self.assert_state(state)\n yield self.deassert_state(state)", "def get_available_transitions(self, user=None...
[ "0.6824499", "0.6628993", "0.64153963", "0.638528", "0.6371522", "0.63396806", "0.61288095", "0.6093622", "0.6024763", "0.60211414", "0.6017735", "0.59842825", "0.59714293", "0.59250975", "0.59245884", "0.5883336", "0.5879027", "0.5853522", "0.5829305", "0.58066624", "0.57571...
0.0
-1
True if model represents an end state; otherwise False.
def end(self): return next((row for row in self.model if 0 in row), None) is None and self.valid
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_endgame_state(self) :\n raise NotImplementedError", "def is_end_state(self):\n return AIError(\"Must be implemented in child class!\")", "def endState(self):\n return not(self.state.winner() == None and len(self.state.get_actions()) > 0)", "def has_end(self):\n return bool(...
[ "0.75420946", "0.71546316", "0.71513486", "0.683799", "0.67092407", "0.6603615", "0.6576153", "0.657172", "0.6544737", "0.64845365", "0.64844114", "0.647074", "0.6467622", "0.64095765", "0.6402182", "0.63991326", "0.6371332", "0.63639414", "0.6363075", "0.63444287", "0.634008...
0.64310986
13
Find the start of the substring or return None.
def _find_or_none(string, substring, start): index = string.find(substring, start) return index if index != -1 else None
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def find_start(self): # -> str | None:\n ...", "def hgvs_start(self):\n try:\n return self.hp.parse(self.term).posedit.pos.start\n except hgvs.exceptions.HGVSParseError:\n # Log me\n # print(self.term)\n return None", "def startswith(self, s):\n ...
[ "0.8028616", "0.67470604", "0.6622218", "0.6622218", "0.66153365", "0.65290195", "0.64821583", "0.64821583", "0.64821583", "0.6412685", "0.61959994", "0.61613446", "0.6096288", "0.6087059", "0.6080864", "0.6071819", "0.60441285", "0.6015387", "0.60138243", "0.6008052", "0.599...
0.7821502
1
Ensure value is always an array.
def _always_array(value: str | list | None) -> list: if value is None: value = [] elif not isinstance(value, list): value = [value] return value
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def as_array(value):\n\tif not isinstance(value, list):\n\t\treturn [value]\n\treturn value", "def is_array(val):\n return (\n isinstance(val, tuple) or \\\n isinstance(val, dict) or \\\n isinstance(val, list)\n )", "def check_array(arr: Arrayable) -> np.ndarray:\n if isinstance(arr, np.ndarray):...
[ "0.7712342", "0.74892855", "0.708963", "0.7066387", "0.7044346", "0.70055664", "0.69729424", "0.66974515", "0.66935796", "0.66363895", "0.6573458", "0.6485523", "0.6449914", "0.64304817", "0.6423054", "0.64192736", "0.6382778", "0.63701683", "0.6363354", "0.634957", "0.631916...
0.7897924
0
Creates a rectangular grid
def _make_rectangular_grid(self, x_range, y_range, step): if not isinstance(x_range, (tuple, list, np.ndarray)): raise TypeError((f"x_range must be a tuple, list or NumPy array, " f"not {type(x_range)}.")) if not isinstance(y_range, (tuple, list, np.ndarray)): ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_grid(self):\n for y_iter in range(self.NUM_GRIDS):\n for x_iter in range(self.NUM_GRIDS):\n x, y = x_iter * self.SQUARE_SIZE, y_iter * self.SQUARE_SIZE\n x_stop, y_stop = x + self.SQUARE_SIZE, y + self.SQUARE_SIZE\n cords = x, y, x_stop, y_s...
[ "0.828961", "0.7997057", "0.79213184", "0.7861609", "0.7762144", "0.7753448", "0.77373004", "0.7708963", "0.7692357", "0.7630404", "0.7602666", "0.7559881", "0.7534277", "0.75159705", "0.7506281", "0.74730766", "0.7376671", "0.73586994", "0.73583066", "0.72931993", "0.7287111...
0.7222293
26
Equality operator for Curcio1990Map. Compares two Curcio1990Map's based attribute equality
def __eq__(self, other): if not isinstance(other, Curcio1990Map): return False if id(self) == id(other): return True return self.__dict__ == other.__dict__
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __eq__(self, other):\n if not isinstance(other, Watson2014Map):\n return False\n if id(self) == id(other):\n return True\n return self.__dict__ == other.__dict__", "def __eq__(self, other):\n eq = True\n for attr in ['geocode',\n 'g...
[ "0.7665283", "0.69506687", "0.686751", "0.6837607", "0.6741164", "0.6676089", "0.66535497", "0.66449416", "0.6511533", "0.64939123", "0.64839643", "0.6445785", "0.6424692", "0.6396489", "0.63746417", "0.6373116", "0.63492835", "0.63492835", "0.63492835", "0.63492835", "0.6349...
0.8193522
0
Equality operator for Watson2014 Object. Compares two Watson2014 Objects based attribute equality
def __eq__(self, other): if not isinstance(other, Watson2014Map): return False if id(self) == id(other): return True return self.__dict__ == other.__dict__
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __eq__(self, other):\n return (self.name == other.name and\n self.attrs == other.attrs and\n self.range_key == other.range_key and\n self.global_indexes == other.global_indexes and\n self.read_throughput == other.read_throughput and\n ...
[ "0.7181928", "0.71442777", "0.71092653", "0.70648277", "0.70119584", "0.7007035", "0.69783443", "0.69105697", "0.6903233", "0.68619734", "0.6858389", "0.6858389", "0.6858389", "0.6858389", "0.6858389", "0.6858389", "0.6858389", "0.6858389", "0.6858389", "0.6858389", "0.685838...
0.68829095
9
Compute value of logistic (sigmoid) function for the given input
def sigmoid(x): return 1 / (1 + math.exp(-x))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sigmoid(x):\n return 1 / (1 + math.exp(-x))", "def sigmoid(x):\r\n return 1 / (1 + np.exp(-x))", "def sigmoid(x):\n return 1 / (1 + exp(-x))", "def sigmoid(x):\n return 1 / (1 + exp(-x))", "def sigmoid(x):\n return 1 / (1 + np.exp(-x))", "def sigmoid(x):\n return 1 / (1 + np.exp(-x))"...
[ "0.8145374", "0.80725497", "0.8067248", "0.8067248", "0.8056968", "0.8056968", "0.8056968", "0.8056968", "0.8056968", "0.8056968", "0.8053879", "0.8041088", "0.80336654", "0.80336654", "0.80285805", "0.8022673", "0.8022673", "0.80175936", "0.80104095", "0.7996945", "0.7990798...
0.806597
4
Returns true if the given number (in two's complement) is negative
def is_neg_ctwo(x): return True if x[0] == '1' else False
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def isnegative(x):\n if x < 0 :\n return True\n return False", "def is_negative(self):\n return (self._num < 0)", "def is_negated(x) -> bool:\n return not (x & 1 == 0)", "def is_negative(self, a):\n return a < 0", "def sign(n):\n return (n > 0) - (n < 0)", "def is_negativ...
[ "0.76025504", "0.74732304", "0.74658763", "0.7110904", "0.70708835", "0.698456", "0.6961201", "0.6877832", "0.68533885", "0.66833127", "0.6630769", "0.65783733", "0.65160453", "0.6507751", "0.64773464", "0.6460165", "0.643779", "0.6390935", "0.6382454", "0.63792914", "0.63601...
0.7135673
3
Given input in two's complement on specified number of bits, find the corresponding sigmoid output
def lut_in_to_out(x, n_bit_in, optimized=False): in_bit = format(x, "0%db" % n_bit_in) in_int = ctwo_to_int(in_bit) in_real = in_int / (1 << N_BIT_IN_DEC) out_real = sigmoid(in_real) if optimized: out_real -= 0.5 out_int = int(math.floor(out_real * (1 << N_BIT_OUT))) # print 'x: ' + ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sigmoid_with_binary_xentropy(z):\n\treturn sigmoid(z)", "def sigmoid2predictions(output: torch.Tensor) -> torch.Tensor:\n return (torch.sign(output - 0.5) + 1) / 2", "def hard_sigmoid(x):\n x = (0.2 * x) + 0.5\n x = F.threshold(-x, -1, -1)\n x = F.threshold(-x, 0, 0)\n return x", "def sigm...
[ "0.71861047", "0.7059318", "0.70457244", "0.7044917", "0.70154613", "0.7014128", "0.7012471", "0.69728523", "0.69397724", "0.6909605", "0.69018644", "0.6876026", "0.6876026", "0.68480873", "0.68480873", "0.6842255", "0.6841323", "0.6820857", "0.6820857", "0.680469", "0.679780...
0.66552776
51
Generate the LUT for the sigmoid
def generate_lut(n_bit_in): fout = open(LUT_FILE_NAME, 'w+') fout.write('Elements: ' + str(1 << n_bit_in) + '\n\n') lut = [lut_in_to_out(i, n_bit_in) for i in range(1 << n_bit_in)] fout.write(', '.join(map(str, lut)))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sigmoid(t):\n return 1 / (1 + np.exp(-t))", "def sigmoid(t):\n\n return 1.0 / (1.0 + np.exp(-t))", "def sigmoid(z):\r\n \r\n return vSigmoid(z);", "def sigmoid(t):\n return np.exp(t)/(1+np.exp(t))", "def der_sigmoid(y):\n return y * (1 - y)", "def sigmoid(z):\n \n return 1 /...
[ "0.67025405", "0.6613045", "0.6607869", "0.6597357", "0.65156054", "0.64840204", "0.6470379", "0.6432771", "0.64291525", "0.64291525", "0.6425862", "0.64239264", "0.64172596", "0.63721055", "0.6365029", "0.6360085", "0.63564515", "0.6356424", "0.63476974", "0.6341359", "0.634...
0.0
-1
Generate an optimized version of the LUT, containing only values for negative inputs. This is possible because of the intrinsic symmetry of sigmoid.
def generate_lut_optimized(n_bit_in): fout = open(LUT_OPT_FILE_NAME, 'w+') fout.write('Elements: ' + str(1 << n_bit_in-1) + '\n\n') # lut_opt = [lut_in_to_out(i, n_bit_in) for i in range(1 << n_bit_in-1, 1 << n_bit_in)] lut_opt = [lut_in_to_out(i, n_bit_in, True) for i in range(1 << n_bit_in-1)] fo...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def hard_sigmoid_derivative(u):\r\n if u > 1:\r\n ro = 0\r\n elif u < 0:\r\n ro = 0\r\n else:\r\n ro = 1\r\n return ro", "def hard_sigmoid(u):\r\n if u > 1:\r\n ro = 1\r\n elif u < 0:\r\n ro = 0\r\n else:\r\n ro = u\r\n return ro", "def relu(sel...
[ "0.6326391", "0.61372834", "0.6107038", "0.6101945", "0.60550976", "0.60455966", "0.59560734", "0.59372574", "0.59219176", "0.5914483", "0.5914417", "0.58377457", "0.58226866", "0.58083564", "0.58062655", "0.58047175", "0.58015156", "0.5776991", "0.57599014", "0.5746622", "0....
0.0
-1