Examples:
public int f(Pair<LoggedJob, JobTraceReader> p1,Pair<LoggedJob, JobTraceReader> p2) { LoggedJob j1 = p1.first(); LoggedJob j2 = p2.first(); return(j1.getSubmitTime() < j2.getSubmitTime()) ? -1 : (j1.getSubmitTime() == j2.getSubmitTime()) ? 0 : 1; } public static MNTPROC f(int value) { if(value < 0 || value >= values().length) { return null; } return values()[value]; } private Iterable<ListBlobItem> f( String aPrefix, boolean useFlatBlobListing, EnumSet<BlobListingDetails> listingDetails, BlobRequestOptions options, OperationContext opContext) throws StorageException, URISyntaxException { CloudBlobDirectoryWrapper directory = this.container.getDirectoryReference(aPrefix); return directory.listBlobs(null, useFlatBlobListing, listingDetails, options, opContext); } private static void f( EnumMap<FSEditLogOpCodes, Holder<Integer>> opCounts) { StringBuilder sb = newStringBuilder(); sb.append("Summary of operations loaded from edit log: "); Joiner.on(" ").withKeyValueSeparator("=").appendTo(sb, opCounts); FSImage.LOG.debug(sb.toString()); } static String f(File f, String... cmd) throws IOException { String[] args = new String[cmd.length + 1]; System.arraycopy(cmd, 0, args, 0, cmd.length); args[cmd.length] = f.getCanonicalPath(); String output = Shell.execCommand(args); return output; } protected void f(Class<? extends SubView> cls) { indent(of(ENDTAG)); sb.setLength(0); out.print(sb.append('[').append(cls.getName()).append(']').toString()); out.println(); }
def f(path): dirname = os.path.dirname(path) if not os.path.isdir(dirname): os.makedirs(dirname) def f(self, column_names=None, selection=None, strings=True, virtual=False, index=None): from astropy.table import Table, Column, MaskedColumn meta = dict() meta["name"] = self.name meta["description"] = self.description table = Table(meta=meta) for name, data in self.to_items(column_names=column_names, selection=selection, strings=strings, virtual=virtual): if self.dtype(name) == str_type: data = np.array(data).astype('U') meta = dict() if name in self.ucds: meta["ucd"] = self.ucds[name] if np.ma.isMaskedArray(data): cls = MaskedColumn else: cls = Column table[name] = cls(data, unit=self.unit(name), description=self.descriptions.get(name), meta=meta) return tabledef f(self, user_id, institute_id): submission_obj = { 'status' : 'open', 'created_at' : datetime.now(), 'user_id' : user_id, 'institute_id' : institute_id } LOG.info("Creating a new clinvar submission for user '%s' and institute %s", user_id, institute_id) result = self.clinvar_submission_collection.insert_one(submission_obj) return result.inserted_id def f(text, locations): start = 0 for pos, decision in enumerate(locations): if decision == SHOULD_SPLIT: if start != pos: yield text[start:pos] start = pos if start != len(text): yield text[start:] def f(self, command, as_list=False): action = actions.Action({ 'Command': command, 'Action': 'Command'}, as_list=as_list) return self.send_action(action) def f(s, suffix, strict=False): if s.endswith(suffix): return s[: len(s) - len(suffix)] elif strict: raise WimpyError("string doesn't end with suffix") return s def f(text, encoding='utf-8'): if not text: return text if not isinstance(text, bytes_type): text = text.encode(encoding) return text
function f() { var quotes = new Array(); quotes[0] = "Action is the real measure of intelligence."; quotes[1] = "Baseball has the great advantage over cricket of being sooner ended."; quotes[2] = "Every goal, every action, every thought, every feeling one experiences, whether it be consciously or unconsciously known, is an attempt to increase one's level of peace of mind."; quotes[3] = "A good head and a good heart are always a formidable combination."; var rand = Math.floor(Math.random()*quotes.length); document.write(quotes[rand]); } function f(query) { if (query[0] == "?") query = query.slice(1); var pairs = query.split("&"), obj = {}; for (var i in pairs) { var pair = pairs[i].split("="), key = decodeURIComponent(pair[0]), value = pair[1] ? decodeURIComponent(pair[1]) : ""; obj[key] = value; } return obj; } function f(id) { if (id && id.trim() && /^[a-zA-Z0-9_]+$/.test(id)) { if (agency.isIdInUse(id)) { err.name = 'DuplicateIdError'; err.message = 'duplication (use a different id)'; return err; } else { return id; } } else { err.name = 'ValidateIdError'; err.message = 'failed id validation (please use alphanumeric characters and underscore)'; return err; } } function f(node, token ) { context.report({ node: node, loc: token.loc.start, message: 'A space is required before \'' + token.value + '\'', fix: function( fixer ) { return fixer.insertTextBefore( token, ' ' ); } }); } function f(list, version) { for (let v = 0, vLength = list.length; v < vLength; v += 1) { const candidate = list[v] if (candidate.version === version) { return candidate } } throw new Error(`version ${version} not listed`) }
def f(string) return false unless string.to_s =~ url_pattern return false if string.to_s =~ @@placeholder true end def f(e) name, min, max, type, required, validation = parse_attributes(e) const_field = e.attributes["const"] if(const_field) type = "\"#{const_field}\"" end Field.new(name, type, required, min, max, validation) end def f(node) if node.respond_to?(:to_sym) node = Woodhouse::Layout::Node.new(node.to_sym) end expect_arg :node, Woodhouse::Layout::Node, node @nodes << node node end def f return true unless self.class.options_schema messages_buffer.each_value do |messages_set| messages_set.each do |message_data| result = self.class.options_schema.call(message_data.last) next if result.success? raise Karafka::Errors::InvalidResponderMessageOptionsError, result.errors end end end def f(question_node) if !question_node.class.ancestors.include?(::ActiveRecordSurvey::Node::Question) raise ArgumentError.new "must inherit from ::ActiveRecordSurvey::Node::Question" end question_node_maps = self.node_maps.select { |i| i.node == question_node && !i.marked_for_destruction? } if question_node_maps.length === 0 question_node_maps << self.node_maps.build(:node => question_node, :survey => self) end end
func f(oldPath string, newPath string) error { err := os.Rename(oldPath, newPath) if err == nil { return nil } err = FileCopy(oldPath, newPath) if err != nil { return err } os.Remove(oldPath) return nil } func (pr *Progress) f() bool { switch pr.State { case ProgressStateProbe: return pr.Paused case ProgressStateReplicate: return pr.ins.full() case ProgressStateSnapshot: return true default: panic("unexpected state") } } func f(dir string, gopath []string) (string, error) { for _, v := range gopath { dst := filepath.Join(v, "src", dir) if _, err := os.Stat(dst); err == nil { return dst, nil } } return "", fmt.Errorf("unable to find package %v in gopath %v", dir, gopath) } func (m *Member) f() (bool, error) { cli, err := m.CreateEtcdClient() if err != nil { return false, fmt.Errorf("%v (%q)", err, m.EtcdClientEndpoint) } defer cli.Close() resp, err := cli.Status(context.Background(), m.EtcdClientEndpoint) if err != nil { return false, err } return resp.Header.MemberId == resp.Leader, nil } func f(a, b *semver.Version) int { na := &semver.Version{Major: a.Major, Minor: a.Minor} nb := &semver.Version{Major: b.Major, Minor: b.Minor} switch { case na.LessThan(*nb): return -1 case nb.LessThan(*na): return 1 default: return 0 } } func (c *Cluster) f(name string) error { id, err := c.ContainerBackupID(name) if err != nil { return err } err = exec(c.db, "DELETE FROM containers_backups WHERE id=?", id) if err != nil { return err } return nil } func (t *Transport) f() (cnt int) { t.mu.RLock() defer t.mu.RUnlock() for _, p := range t.peers { if !p.activeSince().IsZero() { cnt++ } } return cnt }
def f(path): dirname = os.path.dirname(path) if not os.path.isdir(dirname): os.makedirs(dirname) def f(s, suffix, strict=False): if s.endswith(suffix): return s[: len(s) - len(suffix)] elif strict: raise WimpyError("string doesn't end with suffix") return s def f(url, file_name, headers=None, show_progress=True): fd, tmp_file = tempfile.mkstemp(prefix=("%s.tmp." % file_name)) os.close(fd) if DISABLE_SSL_CHECK is True: bot.warning('Verify of certificates disabled! ::TESTING USE ONLY::') verify = not DISABLE_SSL_CHECK response = stream(url, headers=headers, stream_to=tmp_file) shutil.move(tmp_file, file_name) return file_name def f(self, dashboard): if 'id' not in dashboard: return [False, "Invalid dashboard format"] res = requests.delete(self.url + self._dashboards_api_endpoint + '/' + str(dashboard['id']), headers=self.hdrs, verify=self.ssl_verify) if not self._checkResponse(res): return [False, self.lasterr] return [True, None] function f() { var quotes = new Array(); quotes[0] = "Action is the real measure of intelligence."; quotes[1] = "Baseball has the great advantage over cricket of being sooner ended."; quotes[2] = "Every goal, every action, every thought, every feeling one experiences, whether it be consciously or unconsciously known, is an attempt to increase one's level of peace of mind."; quotes[3] = "A good head and a good heart are always a formidable combination."; var rand = Math.floor(Math.random()*quotes.length); document.write(quotes[rand]); } function f(list, version) { for (let v = 0, vLength = list.length; v < vLength; v += 1) { const candidate = list[v] if (candidate.version === version) { return candidate } } throw new Error(`version ${version} not listed`) } def f return true unless self.class.options_schema messages_buffer.each_value do |messages_set| messages_set.each do |message_data| result = self.class.options_schema.call(message_data.last) next if result.success? raise Karafka::Errors::InvalidResponderMessageOptionsError, result.errors end end end def f(question_node) if !question_node.class.ancestors.include?(::ActiveRecordSurvey::Node::Question) raise ArgumentError.new "must inherit from ::ActiveRecordSurvey::Node::Question" end question_node_maps = self.node_maps.select { |i| i.node == question_node && !i.marked_for_destruction? } if question_node_maps.length === 0 question_node_maps << self.node_maps.build(:node => question_node, :survey => self) end end func (c *Cluster) f(name string) error { id, err := c.ContainerBackupID(name) if err != nil { return err } err = exec(c.db, "DELETE FROM containers_backups WHERE id=?", id) if err != nil { return err } return nil }
  • Step 1: Enter or select a code snippet containing a single method named "f".
  • Step 2: Select a model that was trained on the respective programming language. The "Multi-Language" model is capable of taking any code snippet written in Python, JavaScript, Ruby or Go.
  • Step 3: Press the button to let the model predict the method name for the specified snippet.