Skip to content
This repository has been archived by the owner on Dec 8, 2022. It is now read-only.

Standard library TODO #33

Open
41 of 42 tasks
inumanag opened this issue Mar 4, 2019 · 12 comments
Open
41 of 42 tasks

Standard library TODO #33

inumanag opened this issue Mar 4, 2019 · 12 comments
Assignees
Labels
Library Issues related to the standard library

Comments

@inumanag
Copy link
Collaborator

inumanag commented Mar 4, 2019

Hi Jordan,

let's start with the string library:
https://docs.python.org/3/library/stdtypes.html#textseq

You can avoid string.format part for now.

Some functions (like str.split) are implemented in multiple places: for example, split on a single character is different than a split that operates on multi-character patterns.

Also, for each stdlib file, add the docs and implement a test suite as follows. For str.seq, add test_str.seq and there test each function, e.g.:

str.seq:

class str:
   def isspace(self: str) -> bool:
      """
      Doc
      """
      ...

test_str.seq:

def test_isspace():
    assert ' '.isspace() == True
    assert 'x'.isspace() == False
    # ... etc

Please check the function once done:

  • str.capitalize()
  • str.casefold()
  • str.center(width[, fillchar])
  • str.count(sub[, start[, end]])
  • str.endswith(suffix[, start[, end]])
  • str.expandtabs(tabsize=8)
  • str.find(sub[, start[, end]])
  • str.format(*args, **kwargs)
  • str.index(sub[, start[, end]])
  • str.isalnum()
  • str.isalpha()
  • str.isascii()
  • str.isdecimal()
  • str.isdigit()
  • str.isidentifier()
  • str.islower()
  • str.isnumeric()
  • str.isprintable()
  • str.isspace()
  • str.istitle()
  • str.isupper()
  • str.join(iterable)
  • str.ljust(width[, fillchar])
  • str.lower()
  • str.lstrip([chars])
  • str.partition(sep)
  • str.replace(old, new[, count])
  • str.rfind(sub[, start[, end]])
  • str.rindex(sub[, start[, end]])
  • str.rjust(width[, fillchar])
  • str.rpartition(sep)
  • str.rsplit(sep=None, maxsplit=-1)
  • str.rstrip([chars])
  • str.split(sep=None, maxsplit=-1)
  • str.splitlines([keepends])
  • str.startswith(prefix[, start[, end]])
  • str.strip([chars])
  • str.swapcase()
  • str.title()
  • str.translate(table)
  • str.upper()
  • str.zfill(width)
@arshajii arshajii added the Library Issues related to the standard library label Sep 5, 2019
@jordanwatson1
Copy link
Contributor

jordanwatson1 commented Sep 25, 2019

Math

  • math.ceil(x)
  • math.copysign(x, y)
  • math.fabs(x)
  • math.factorial(x)
  • math.floor(x)
  • math.fmod(x, y)
  • math.frexp(x)
  • math.fsum(iterable)
  • math.gcd(a, b)
  • math.isclose(a, b, *, rel_tol=1e-09, abs_tol=0.0)
  • math.isfinite(x)
  • math.isinf(x)
  • math.isnan(x)
  • math.ldexp(x, i)
  • math.modf(x)
  • math.remainder(x, y)
  • math.trunc(x)
  • math.exp(x)
  • math.expm1(x)
  • math.log(x[, base])
  • math.log1p(x)
  • math.log2(x)
  • math.log10(x)
  • math.pow(x, y)
  • math.sqrt(x)
  • math.acos(x)
  • math.asin(x)
  • math.atan(x)
  • math.atan2(y, x)
  • math.cos(x)
  • math.hypot(x, y)
  • math.sin(x)
  • math.tan(x)
  • math.degrees(x)
  • math.radians(x)
  • math.acosh(x)
  • math.asinh(x)
  • math.atanh(x)
  • math.cosh(x)
  • math.sinh(x)
  • math.tanh(x)
  • math.erf(x)
  • math.erfc(x)
  • math.gamma(x)
  • math.lgamma(x)
  • math.pi
  • math.e
  • math.tau
  • math.inf
  • math.nan

@jordanwatson1
Copy link
Contributor

jordanwatson1 commented Oct 7, 2019

Random

  • random.seed(a=None, version=2)
  • random.getstate()
  • random.setstate(state)
  • random.getrandbits(k)
  • random.randrange(stop)
  • random.randrange(start, stop[, step])
  • random.randint(a, b)
  • random.choice(seq)
  • random.choices(population, weights=None, *, cum_weights=None, k=1)
  • random.shuffle(x[, random])
  • random.sample(population, k)
  • random.random()
  • random.uniform(a, b)
  • random.triangular(low, high, mode)
  • random.betavariate(alpha, beta)
  • random.expovariate(lambd)
  • random.gammavariate(alpha, beta)
  • random.gauss(mu, sigma)
  • random.lognormvariate(mu, sigma)
  • random.normalvariate(mu, sigma)
  • random.vonmisesvariate(mu, kappa)
  • random.paretovariate(alpha)
  • random.weibullvariate(alpha, beta)
  • class random.Random([seed])
  • class random.SystemRandom([seed])

@jordanwatson1
Copy link
Contributor

jordanwatson1 commented Nov 1, 2019

itertools

  • itertools.accumulate(iterable[, func, *, initial=None])
  • itertools.chain(*iterables)
  • classmethod chain.from_iterable(iterable)
  • itertools.combinations(iterable, r)
  • itertools.combinations_with_replacement(iterable, r)
  • itertools.compress(data, selectors)
  • itertools.count(start=0, step=1)
  • itertools.cycle(iterable)
  • itertools.dropwhile(predicate, iterable)
  • itertools.filterfalse(predicate, iterable)
  • itertools.groupby(iterable, key=None)
  • itertools.islice(iterable, stop)
  • itertools.islice(iterable, start, stop[, step])
  • itertools.permutations(iterable, r=None)
  • itertools.product(*iterables, repeat=1)
  • itertools.repeat(object[, times])
  • itertools.starmap(function, iterable)
  • itertools.takewhile(predicate, iterable)
  • itertools.tee(iterable, n=2)
  • itertools.zip_longest(*iterables, fillvalue=None)

@inumanag
Copy link
Collaborator Author

Next steps:

  • collections --- Counter, ChainMap, deque, defaultdict and OrderedDict
  • bisect -- one part is already there
  • heapq
  • statistics
  • os -- can you prepare the list of all os symbols that I can pick from later on?
  • getopt

@jordanwatson1
Copy link
Contributor

jordanwatson1 commented Nov 15, 2019

bisect

  • bisect.bisect_left(a, x, lo=0, hi=len(a))
  • bisect.bisect_right(a, x, lo=0, hi=len(a))
  • bisect.bisect(a, x, lo=0, hi=len(a))
  • bisect.insort_left(a, x, lo=0, hi=len(a))
  • bisect.insort_right(a, x, lo=0, hi=len(a))
  • bisect.insort(a, x, lo=0, hi=len(a))

@jordanwatson1
Copy link
Contributor

jordanwatson1 commented Nov 18, 2019

collections

class collections.Counter([iterable-or-mapping])

  • Counter.elements()
  • Counter.most_common([n])
  • Counter.subtract([iterable-or-mapping])
  • Counter.fromkeys(iterable)
  • Counter.update([iterable-or-mapping])

class collections.deque([iterable[, maxlen]])

  • deque.append(x)
  • deque.appendleft(x)
  • deque.clear()
  • deque.copy()
  • deque.count(x)
  • deque.extend(iterable)
  • deque.extendleft(iterable)
  • deque.index(x[, start[, stop]])
  • deque.insert(i, x)
  • deque.pop()
  • deque.popleft()
  • deque.remove(value)
  • deque.reverse()
  • deque.rotate(n=1)
  • deque.maxlen

@jordanwatson1
Copy link
Contributor

jordanwatson1 commented Nov 18, 2019

heapq

  • heapq.heappush(heap, item)
  • heapq.heappop(heap)
  • heapq.heappushpop(heap, item)
  • heapq.heapify(x)
  • heapq.heapreplace(heap, item)
  • heapq.merge(*iterables, key=None, reverse=False)
  • heapq.nlargest(n, iterable, key=None)
  • heapq.nsmallest(n, iterable, key=None)

@jordanwatson1
Copy link
Contributor

jordanwatson1 commented Nov 18, 2019

statistics

  • statistics.mean(data)
  • statistics.fmean(data)
  • statistics.geometric_mean(data)
  • statistics.harmonic_mean(data)
  • statistics.median(data)
  • statistics.median_low(data)
  • statistics.median_high(data)
  • statistics.median_grouped(data, interval=1)
  • statistics.mode(data)
  • statistics.multimode(data)
  • statistics.pstdev(data, mu=None)
  • statistics.pvariance(data, mu=None)
  • statistics.stdev(data, xbar=None)
  • statistics.variance(data, xbar=None)
  • statistics.quantiles(data, *, n=4, method='exclusive')
  • class statistics.NormalDist(mu=0.0, sigma=1.0)
    • mean
    • median
    • mode
    • stdev
    • variance
    • classmethod from_samples(data)
    • samples(n, *, seed=None)
    • pdf(x)
    • cdf(x)
    • inv_cdf(p)
    • overlap(other)
    • quantiles(n=4)

@jordanwatson1
Copy link
Contributor

jordanwatson1 commented Nov 19, 2019

os

  • exception os.error
  • os.name

Process Parameters

  • os.ctermid()
  • os.environ
  • os.environb
  • os.chdir(path)
  • os.fchdir(fd)
  • os.getcwd()
  • os.fsencode(filename)
  • os.fsdecode(filename)
  • os.fspath(path)
  • class os.PathLike
    • abstractmethod fspath()
  • os.getenv(key, default=None)
  • os.getenvb(key, default=None)
  • os.get_exec_path(env=None)
  • os.getegid()
  • os.geteuid()
  • os.getgid()
  • os.getgrouplist(user, group)
  • os.getgroups()
  • os.getlogin()
  • os.getpgid(pid)
  • os.getpgrp()
  • os.getpid()
  • os.getppid()
  • os.getpriority(which, who)
  • os.PRIO_PROCESS
  • os.PRIO_PGRP
  • os.PRIO_USER
  • os.getresuid()
  • os.getresgid()
  • os.getuid()
  • os.initgroups(username, gid)
  • os.putenv(key, value)
  • os.setegid(egid)
  • os.seteuid(euid)
  • os.setgid(gid)
  • os.setgroups(groups)
  • os.setpgrp()
  • os.setpgid(pid, pgrp)
  • os.setpriority(which, who, priority)
  • os.setregid(rgid, egid)
  • os.setresgid(rgid, egid, sgid)
  • os.setresuid(ruid, euid, suid)
  • os.setreuid(ruid, euid)
  • os.getsid(pid)
  • os.setsid()
  • os.setuid(uid)
  • os.strerror(code)
  • os.supports_bytes_environ
  • os.umask(mask)
  • os.uname()
  • os.unsetenv(key)

File Object Creation

  • os.fdopen(fd, *args, **kwargs)

File Descriptor Operations

  • os.close(fd)
  • os.closerange(fd_low, fd_high)
  • os.copy_file_range(src, dst, count, offset_src=None, offset_dst=None)
  • os.device_encoding(fd)
  • os.dup(fd)
  • os.dup2(fd, fd2, inheritable=True)
  • os.fchmod(fd, mode)
  • os.fchown(fd, uid, gid)
  • os.fdatasync(fd)
  • os.fpathconf(fd, name)
  • os.fstat(fd)
  • os.fstatvfs(fd)
  • os.fsync(fd)
  • os.ftruncate(fd, length)
  • os.get_blocking(fd)
  • os.isatty(fd)
  • os.lockf(fd, cmd, len)
  • os.F_LOCK
  • os.F_TLOCK
  • os.F_ULOCK
  • os.F_TEST
  • os.lseek(fd, pos, how)
  • os.SEEK_SET
  • os.SEEK_CUR
  • os.SEEK_END
  • os.open(path, flags, mode=0o777, *, dir_fd=None)
  • os.O_RDONLY
  • os.O_WRONLY
  • os.O_RDWR
  • os.O_APPEND
  • os.O_CREAT
  • os.O_EXCL
  • os.O_TRUNC
  • os.O_DSYNC
  • os.O_RSYNC
  • os.O_SYNC
  • os.O_NDELAY
  • os.O_NONBLOCK
  • os.O_NOCTTY
  • os.O_CLOEXEC
  • os.O_BINARY
  • os.O_NOINHERIT
  • os.O_SHORT_LIVED
  • os.O_TEMPORARY
  • os.O_RANDOM
  • os.O_SEQUENTIAL
  • os.O_TEXT
  • os.O_ASYNC
  • os.O_DIRECT
  • os.O_DIRECTORY
  • os.O_NOFOLLOW
  • os.O_NOATIME
  • os.O_PATH
  • os.O_TMPFILE
  • os.O_SHLOCK
  • os.O_EXLOCK
  • os.openpty()
  • os.pipe()
  • os.pipe2(flags)
  • os.posix_fallocate(fd, offset, len)
  • os.posix_fadvise(fd, offset, len, advice)
  • os.POSIX_FADV_NORMAL
  • os.POSIX_FADV_SEQUENTIAL
  • os.POSIX_FADV_RANDOM
  • os.POSIX_FADV_NOREUSE
  • os.POSIX_FADV_WILLNEED
  • os.POSIX_FADV_DONTNEED
  • os.pread(fd, n, offset)
  • os.preadv(fd, buffers, offset, flags=0)
  • os.RWF_NOWAIT
  • os.RWF_HIPRI
  • os.pwrite(fd, str, offset)
  • os.pwritev(fd, buffers, offset, flags=0)
  • os.RWF_DSYNC
  • os.RWF_SYNC
  • os.read(fd, n)
  • os.sendfile(out, in, offset, count)
  • os.sendfile(out, in, offset, count, [headers, ][trailers, ]flags=0)
  • os.set_blocking(fd, blocking)
  • os.SF_NODISKIO
  • os.SF_MNOWAIT
  • os.SF_SYNC
  • os.readv(fd, buffers)
  • os.tcgetpgrp(fd)
  • os.tcsetpgrp(fd, pg)
  • os.ttyname(fd)
  • os.write(fd, str)
  • os.writev(fd, buffers)

Querying the size of a terminal

  • os.get_terminal_size(fd=STDOUT_FILENO)
  • class os.terminal_size
    • columns
    • lines

Inheritance of File Descriptors

  • os.get_inheritable(fd)
  • os.set_inheritable(fd, inheritable)
  • os.get_handle_inheritable(handle)
  • os.set_handle_inheritable(handle, inheritable)

Files and Directories

  • os.access(path, mode, *, dir_fd=None, effective_ids=False, follow_symlinks=True)
  • os.F_OK
  • os.R_OK
  • os.W_OK
  • os.X_OK
  • os.chdir(path)
  • os.chflags(path, flags, *, follow_symlinks=True)
  • os.chmod(path, mode, *, dir_fd=None, follow_symlinks=True)
  • os.chown(path, uid, gid, *, dir_fd=None, follow_symlinks=True)
  • os.chroot(path)
  • os.fchdir(fd)
  • os.getcwd()
  • os.getcwdb()
  • os.lchflags(path, flags)
  • os.lchmod(path, mode)
  • os.lchown(path, uid, gid)
  • os.link(src, dst, *, src_dir_fd=None, dst_dir_fd=None, follow_symlinks=True)
  • os.listdir(path='.')
  • os.lstat(path, *, dir_fd=None)
  • os.mkdir(path, mode=0o777, *, dir_fd=None)
  • os.makedirs(name, mode=0o777, exist_ok=False)
  • os.mkfifo(path, mode=0o666, *, dir_fd=None)
  • os.mknod(path, mode=0o600, device=0, *, dir_fd=None)
  • os.major(device)
  • os.minor(device)
  • os.makedev(major, minor)
  • os.pathconf(path, name)
  • os.pathconf_names
  • os.readlink(path, *, dir_fd=None)
  • os.remove(path, *, dir_fd=None)
  • os.removedirs(name)
  • os.rename(src, dst, *, src_dir_fd=None, dst_dir_fd=None)
  • os.renames(old, new)
  • os.replace(src, dst, *, src_dir_fd=None, dst_dir_fd=None)
  • os.rmdir(path, *, dir_fd=None)
  • os.scandir(path='.')
  • class os.DirEntry
    • name
    • path
    • inode()
    • is_dir(*, follow_symlinks=True)
    • is_file(*, follow_symlinks=True)
    • is_symlink()
    • stat(*, follow_symlinks=True)
  • os.stat(path, *, dir_fd=None, follow_symlinks=True)
  • class os.stat_result
    • st_mode
    • st_ino
    • st_dev
    • st_nlink
    • st_uid
    • st_gid
    • st_size
    • st_atime
    • st_mtime
    • st_ctime
    • st_atime_ns
    • st_mtime_ns
    • st_ctime_ns
    • st_blocks
    • st_blksize
    • st_rdev
    • st_flags
    • st_gen
    • st_birthtime
    • st_fstype
    • st_rsize
    • st_creator
    • st_type
    • st_file_attributes
    • st_reparse_tag
  • os.statvfs(path)
  • os.supports_dir_fd
  • os.supports_effective_ids
  • os.supports_fd
  • os.supports_follow_symlinks
  • os.symlink(src, dst, target_is_directory=False, *, dir_fd=None)
  • os.sync()
  • os.truncate(path, length)
  • os.unlink(path, *, dir_fd=None)
  • os.utime(path, times=None, *, [ns, ]dir_fd=None, follow_symlinks=True)
  • os.walk(top, topdown=True, onerror=None, followlinks=False)
  • os.fwalk(top='.', topdown=True, onerror=None, *, follow_symlinks=False, dir_fd=None)
  • os.memfd_create(name[, flags=os.MFD_CLOEXEC])
  • os.MFD_CLOEXEC
  • os.MFD_ALLOW_SEALING
  • os.MFD_HUGETLB
  • os.MFD_HUGE_SHIFT
  • os.MFD_HUGE_MASK
  • os.MFD_HUGE_64KB
  • os.MFD_HUGE_512KB
  • os.MFD_HUGE_1MB
  • os.MFD_HUGE_2MB
  • os.MFD_HUGE_8MB
  • os.MFD_HUGE_16MB
  • os.MFD_HUGE_32MB
  • os.MFD_HUGE_256MB
  • os.MFD_HUGE_512MB
  • os.MFD_HUGE_1GB
  • os.MFD_HUGE_2GB
  • os.MFD_HUGE_16GB

Linux extended attributes

  • os.getxattr(path, attribute, *, follow_symlinks=True)
  • os.listxattr(path=None, *, follow_symlinks=True)
  • os.removexattr(path, attribute, *, follow_symlinks=True)
  • os.setxattr(path, attribute, value, flags=0, *, follow_symlinks=True)
  • os.XATTR_SIZE_MAX
  • os.XATTR_CREATE
  • os.XATTR_REPLACE

Process Management

  • os.abort()
  • os.add_dll_directory(path)
  • os.execl(path, arg0, arg1, ...)
  • os.execle(path, arg0, arg1, ..., env)
  • os.execlp(file, arg0, arg1, ...)
  • os.execlpe(file, arg0, arg1, ..., env)
  • os.execv(path, args)
  • os.execve(path, args, env)
  • os.execvp(file, args)
  • os.execvpe(file, args, env)
  • os.EX_OK
  • os.EX_USAGE
  • os.EX_DATAERR
  • os.EX_NOINPUT
  • os.EX_NOUSER
  • os.EX_NOHOST
  • os.EX_UNAVAILABLE
  • os.EX_SOFTWARE
  • os.EX_OSERR
  • os.EX_OSFILE
  • os.EX_CANTCREAT
  • os.EX_IOERR
  • os.EX_TEMPFAIL
  • os.EX_PROTOCOL
  • os.EX_NOPERM
  • os.EX_CONFIG
  • os.EX_NOTFOUND
  • os.fork()
  • os.forkpty()
  • os.kill(pid, sig)
  • os.killpg(pgid, sig)
  • os.nice(increment)
  • os.plock(op)
  • os.popen(cmd, mode='r', buffering=-1)
  • os.posix_spawn(path, argv, env, *, file_actions=None, setpgroup=None, resetids=False, setsid=False, setsigmask=(), setsigdef=(), scheduler=None)
  • os.posix_spawnp(path, argv, env, *, file_actions=None, setpgroup=None, resetids=False, setsid=False, setsigmask=(), setsigdef=(), scheduler=None)
  • os.register_at_fork(*, before=None, after_in_parent=None, after_in_child=None)
  • os.spawnl(mode, path, ...)
  • os.spawnle(mode, path, ..., env)
  • os.spawnlp(mode, file, ...)
  • os.spawnlpe(mode, file, ..., env)
  • os.spawnv(mode, path, args)
  • os.spawnve(mode, path, args, env)
  • os.spawnvp(mode, file, args)
  • os.spawnvpe(mode, file, args, env)
  • os.P_NOWAIT
  • os.P_NOWAITO
  • os.P_WAIT
  • os.P_DETACH
  • os.P_OVERLAY
  • os.startfile(path[, operation])
  • os.system(command)
  • os.times()
  • os.wait()
  • os.waitid(idtype, id, options)
  • os.P_PID
  • os.P_PGID
  • os.P_ALL
  • os.WEXITED
  • os.WSTOPPED
  • os.WNOWAIT
  • os.CLD_EXITED
  • os.CLD_DUMPED
  • os.CLD_TRAPPED
  • os.CLD_CONTINUED
  • os.waitpid(pid, options)
  • os.wait3(options)
  • os.wait4(pid, options)
  • os.WNOHANG
  • os.WCONTINUED
  • os.WUNTRACED
  • os.WCOREDUMP(status)
  • os.WIFCONTINUED(status)
  • os.WIFSTOPPED(status)
  • os.WIFSIGNALED(status)
  • os.WIFEXITED(status)
  • os.WEXITSTATUS(status)
  • os.WSTOPSIG(status)
  • os.WTERMSIG(status)

Interface to the scheduler

  • os.SCHED_OTHER
  • os.SCHED_BATCH
  • os.SCHED_IDLE
  • os.SCHED_SPORADIC
  • os.SCHED_FIFO
  • os.SCHED_RR
  • os.SCHED_RESET_ON_FORK
  • class os.sched_param(sched_priority)
    • sched_priority
  • os.sched_get_priority_min(policy)
  • os.sched_get_priority_max(policy)
  • os.sched_setscheduler(pid, policy, param)
  • os.sched_getscheduler(pid)
  • os.sched_setparam(pid, param)
  • os.sched_getparam(pid)
  • os.sched_rr_get_interval(pid)
  • os.sched_yield()
  • os.sched_setaffinity(pid, mask)
  • os.sched_getaffinity(pid)

Miscellaneous System Information

  • os.confstr(name)
  • os.confstr_names
  • os.cpu_count()
  • os.getloadavg()
  • os.sysconf(name)
  • os.sysconf_names
  • os.curdir
  • os.pardir
  • os.sep
  • os.altsep
  • os.extsep
  • os.pathsep
  • os.defpath
  • os.linesep
  • os.devnull
  • os.RTLD_LAZY
  • os.RTLD_NOW
  • os.RTLD_GLOBAL
  • os.RTLD_LOCAL
  • os.RTLD_NODELETE
  • os.RTLD_NOLOAD
  • os.RTLD_DEEPBIND

Random numbers

  • os.getrandom(size, flags=0)
  • os.urandom(size)
  • os.GRND_NONBLOCK
  • os.GRND_RANDOM

@jordanwatson1
Copy link
Contributor

getopt

  • getopt.getopt(args, shortopts, longopts=[])
  • getopt.gnu_getopt(args, shortopts, longopts=[])
  • exception getopt.GetoptError
  • exception getopt.error

@inumanag
Copy link
Collaborator Author

inumanag commented Dec 9, 2019

BioPython / pyVCF

Align

  • Bio.Align.MultipleSeqAlignment
  • Bio.Align.PairwiseAligner
  • Bio.Align.PairwiseAlignment
  • Bio.Align.PairwiseAlignments

SeqUtils

SeqRecord

SeqFeature

  • Just a scaffolding

SearchIO

pyVCF

SeqIO

  • All base functions
  • Submodules:
    • QualityIO
    • TabIO

GFF

Bio.kNN

Bio.triefind

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Library Issues related to the standard library
Projects
None yet
Development

No branches or pull requests

3 participants