コード例 #1
0
class struct_group:
    __metaclass__ = _structseq.structseqtype

    gr_name = _structseq.structseqfield(0)
    gr_passwd = _structseq.structseqfield(1)
    gr_gid = _structseq.structseqfield(2)
    gr_mem = _structseq.structseqfield(3)
コード例 #2
0
ファイル: grp.py プロジェクト: Qointum/pypy
class struct_group(metaclass=_structseq.structseqtype):
    name = "grp.struct_group"

    gr_name = _structseq.structseqfield(0)
    gr_passwd = _structseq.structseqfield(1)
    gr_gid = _structseq.structseqfield(2)
    gr_mem = _structseq.structseqfield(3)
コード例 #3
0
class terminal_size(metaclass=structseqtype):

    name = "os.terminal_size"
    __module__ = "os"

    columns = structseqfield(0, "width of the terminal window in characters")
    lines = structseqfield(1, "height of the terminal window in characters")
コード例 #4
0
ファイル: test_structseq.py プロジェクト: Mu-L/pypy
class foo:
    __metaclass__ = structseqtype
    f1 = structseqfield(0, "a")
    f2 = structseqfield(1, "b")
    f3 = structseqfield(2, "c")

    f5 = structseqfield(4, "nonconsecutive")
    f6 = structseqfield(5, "nonconsecutive2", default=lambda self: -15)
コード例 #5
0
class uname_result(metaclass=structseqtype):

    name = osname + ".uname_result"    # and NOT "os.uname_result"

    sysname  = structseqfield(0, "operating system name")
    nodename = structseqfield(1, "name of machine on network "
                              "(implementation-defined")
    release  = structseqfield(2, "operating system release")
    version  = structseqfield(3, "operating system version")
    machine  = structseqfield(4, "hardware identifier")
コード例 #6
0
class times_result(metaclass=structseqtype):

    name = "posix.times_result"
    __module__ = "posix"

    user = structseqfield(0, "user time")
    system = structseqfield(1, "system time")
    children_user = structseqfield(2, "user time of children")
    children_system = structseqfield(3, "system time of children")
    elapsed = structseqfield(4, "elapsed time since an arbitray point in the past")
コード例 #7
0
ファイル: app_posix.py プロジェクト: Qointum/pypy
class statvfs_result(metaclass=structseqtype):

    name = osname + ".statvfs_result"

    f_bsize = structseqfield(0)
    f_frsize = structseqfield(1)
    f_blocks = structseqfield(2)
    f_bfree = structseqfield(3)
    f_bavail = structseqfield(4)
    f_files = structseqfield(5)
    f_ffree = structseqfield(6)
    f_favail = structseqfield(7)
    f_flag = structseqfield(8)
    f_namemax = structseqfield(9)
コード例 #8
0
ファイル: app_time.py プロジェクト: xx312022850/pypy
class struct_time:
    __metaclass__ = structseqtype
    __module__ = 'time'

    tm_year = structseqfield(0)
    tm_mon = structseqfield(1)
    tm_mday = structseqfield(2)
    tm_hour = structseqfield(3)
    tm_min = structseqfield(4)
    tm_sec = structseqfield(5)
    tm_wday = structseqfield(6)
    tm_yday = structseqfield(7)
    tm_isdst = structseqfield(8)
コード例 #9
0
class sched_param(metaclass=structseqtype):
    name = "posix.sched_param"
    __module__ = "posix"

    sched_priority = structseqfield(0, "sched_priority")

    def __new__(cls, sched_priority):
        return structseq_new(cls, sched_priority)
コード例 #10
0
class struct_passwd(metaclass=structseqtype):
    """
    pwd.struct_passwd: Results from getpw*() routines.

    This object may be accessed either as a tuple of
      (pw_name,pw_passwd,pw_uid,pw_gid,pw_gecos,pw_dir,pw_shell)
    or via the object attributes as named in the above tuple.
    """
    name = "pwd.struct_passwd"

    pw_name = structseqfield(0, "user name")
    pw_passwd = structseqfield(1, "password")
    pw_uid = structseqfield(2, "user id")
    pw_gid = structseqfield(3, "group id")
    pw_gecos = structseqfield(4, "real name")
    pw_dir = structseqfield(5, "home directory")
    pw_shell = structseqfield(6, "shell program")
コード例 #11
0
ファイル: pwd.py プロジェクト: Qointum/pypy
class struct_passwd(metaclass=_structseq.structseqtype):
    """
    pwd.struct_passwd: Results from getpw*() routines.

    This object may be accessed either as a tuple of
      (pw_name,pw_passwd,pw_uid,pw_gid,pw_gecos,pw_dir,pw_shell)
    or via the object attributes as named in the above tuple.
    """
    name = "pwd.struct_passwd"

    pw_name = _structseq.structseqfield(0)
    pw_passwd = _structseq.structseqfield(1)
    pw_uid = _structseq.structseqfield(2)
    pw_gid = _structseq.structseqfield(3)
    pw_gecos = _structseq.structseqfield(4)
    pw_dir = _structseq.structseqfield(5)
    pw_shell = _structseq.structseqfield(6)
コード例 #12
0
class struct_time(metaclass=structseqtype):
    __module__ = 'time'
    name = 'time.struct_time'

    n_sequence_fields = 9

    tm_year = structseqfield(0, "year, for example, 1993")
    tm_mon = structseqfield(1, "month of year, range [1, 12]")
    tm_mday = structseqfield(2, "day of month, range [1, 31]")
    tm_hour = structseqfield(3, "hours, range [0, 23]")
    tm_min = structseqfield(4, "minutes, range [0, 59]")
    tm_sec = structseqfield(5, "seconds, range [0, 61])")
    tm_wday = structseqfield(6, "day of week, range [0, 6], Monday is 0")
    tm_yday = structseqfield(7, "day of year, range [1, 366]")
    tm_isdst = structseqfield(
        8, "1 if summer time is in effect, 0 if not"
        ", and -1 if unknown")
    tm_zone = structseqfield(9, "abbreviation of timezone name")
    tm_gmtoff = structseqfield(10, "offset from UTC in seconds")
コード例 #13
0
ファイル: app_posix.py プロジェクト: Qointum/pypy
class stat_result(metaclass=structseqtype):

    name = osname + ".stat_result"

    st_mode = structseqfield(0, "protection bits")
    st_ino = structseqfield(1, "inode")
    st_dev = structseqfield(2, "device")
    st_nlink = structseqfield(3, "number of hard links")
    st_uid = structseqfield(4, "user ID of owner")
    st_gid = structseqfield(5, "group ID of owner")
    st_size = structseqfield(6, "total size, in bytes")

    # NOTE: float times are disabled for now, for compatibility with CPython.
    # access to indices 7 to 9 gives the timestamps as integers:
    _integer_atime = structseqfield(7)
    _integer_mtime = structseqfield(8)
    _integer_ctime = structseqfield(9)

    # further fields, not accessible by index (the numbers are still needed
    # but not visible because they are no longer consecutive)

    st_atime = structseqfield(15, "time of last access")
    st_mtime = structseqfield(16, "time of last modification")
    st_ctime = structseqfield(17, "time of last status change")

    if "st_blksize" in posix._statfields:
        st_blksize = structseqfield(20, "blocksize for filesystem I/O")
    if "st_blocks" in posix._statfields:
        st_blocks = structseqfield(21, "number of blocks allocated")
    if "st_rdev" in posix._statfields:
        st_rdev = structseqfield(22, "device ID (if special file)")
    if "st_flags" in posix._statfields:
        st_flags = structseqfield(23, "user defined flags for file")

    def __init__(self, *args, **kw):
        super(stat_result, self).__init__(*args, **kw)

        # If we have been initialized from a tuple,
        # st_?time might be set to None. Initialize it
        # from the int slots.
        if self.st_atime is None:
            self.__dict__['st_atime'] = self[7]
        if self.st_mtime is None:
            self.__dict__['st_mtime'] = self[8]
        if self.st_ctime is None:
            self.__dict__['st_ctime'] = self[9]
コード例 #14
0
class struct_rusage:
    __metaclass__ = _structseq.structseqtype

    ru_utime = _structseq.structseqfield(0)
    ru_stime = _structseq.structseqfield(1)
    ru_maxrss = _structseq.structseqfield(2)
    ru_ixrss = _structseq.structseqfield(3)
    ru_idrss = _structseq.structseqfield(4)
    ru_isrss = _structseq.structseqfield(5)
    ru_minflt = _structseq.structseqfield(6)
    ru_majflt = _structseq.structseqfield(7)
    ru_nswap = _structseq.structseqfield(8)
    ru_inblock = _structseq.structseqfield(9)
    ru_oublock = _structseq.structseqfield(10)
    ru_msgsnd = _structseq.structseqfield(11)
    ru_msgrcv = _structseq.structseqfield(12)
    ru_nsignals = _structseq.structseqfield(13)
    ru_nvcsw = _structseq.structseqfield(14)
    ru_nivcsw = _structseq.structseqfield(15)
コード例 #15
0
ファイル: test_structseq.py プロジェクト: Mu-L/pypy
 class foo:
     __metaclass__ = structseqtype
     f1 = structseqfield(0, "a", default=lambda self: 0)
コード例 #16
0
ファイル: test_structseq.py プロジェクト: pymtl/pypy-pymtl3
class foo(metaclass=structseqtype):
    f1 = structseqfield(0, "a")
    f2 = structseqfield(1, "b")
    f3 = structseqfield(2, "c")
コード例 #17
0
ファイル: app.py プロジェクト: Qointum/pypy
class sysflags(metaclass=structseqtype):

    name = "sys.flags"

    debug = structseqfield(0)
    division_warning = structseqfield(1)
    inspect = structseqfield(2)
    interactive = structseqfield(3)
    optimize = structseqfield(4)
    dont_write_bytecode = structseqfield(5)
    no_user_site = structseqfield(6)
    no_site = structseqfield(7)
    ignore_environment = structseqfield(8)
    verbose = structseqfield(9)
    bytes_warning = structseqfield(10)
    quiet = structseqfield(11)
    hash_randomization = structseqfield(12)
コード例 #18
0
class struct_rusage:
    """struct_rusage: Result from getrusage.

This object may be accessed either as a tuple of
    (utime,stime,maxrss,ixrss,idrss,isrss,minflt,majflt,
    nswap,inblock,oublock,msgsnd,msgrcv,nsignals,nvcsw,nivcsw)
or via the attributes ru_utime, ru_stime, ru_maxrss, and so on."""

    __metaclass__ = _structseq.structseqtype
    name = "resource.struct_rusage"

    ru_utime = _structseq.structseqfield(0, "user time used")
    ru_stime = _structseq.structseqfield(1, "system time used")
    ru_maxrss = _structseq.structseqfield(2, "max. resident set size")
    ru_ixrss = _structseq.structseqfield(3, "shared memory size")
    ru_idrss = _structseq.structseqfield(4, "unshared data size")
    ru_isrss = _structseq.structseqfield(5, "unshared stack size")
    ru_minflt = _structseq.structseqfield(6, "page faults not requiring I/O")
    ru_majflt = _structseq.structseqfield(7, "page faults requiring I/O")
    ru_nswap = _structseq.structseqfield(8, "number of swap outs")
    ru_inblock = _structseq.structseqfield(9, "block input operations")
    ru_oublock = _structseq.structseqfield(10, "block output operations")
    ru_msgsnd = _structseq.structseqfield(11, "IPC messages sent")
    ru_msgrcv = _structseq.structseqfield(12, "IPC messages received")
    ru_nsignals = _structseq.structseqfield(13, "signals received")
    ru_nvcsw = _structseq.structseqfield(14, "voluntary context switches")
    ru_nivcsw = _structseq.structseqfield(15, "involuntary context switches")
コード例 #19
0
ファイル: app_posix.py プロジェクト: chyyuu/pygirl
class stat_result:
    __metaclass__ = structseqtype

    st_mode = structseqfield(0, "protection bits")
    st_ino = structseqfield(1, "inode")
    st_dev = structseqfield(2, "device")
    st_nlink = structseqfield(3, "number of hard links")
    st_uid = structseqfield(4, "user ID of owner")
    st_gid = structseqfield(5, "group ID of owner")
    st_size = structseqfield(6, "total size, in bytes")

    # NOTE: float times are disabled for now, for compatibility with CPython.

    # access to indices 7 to 9 gives the timestamps as integers:
    #_integer_atime = structseqfield(7)
    #_integer_mtime = structseqfield(8)
    #_integer_ctime = structseqfield(9)

    st_atime = structseqfield(7, "time of last access")
    st_mtime = structseqfield(8, "time of last modification")
    st_ctime = structseqfield(9, "time of last status change")

    # further fields, not accessible by index (the numbers are still needed
    # but not visible because they are no longer consecutive)
    if "st_blksize" in posix._statfields:
        st_blksize = structseqfield(20, "blocksize for filesystem I/O")
    if "st_blocks" in posix._statfields:
        st_blocks = structseqfield(21, "number of blocks allocated")
    if "st_rdev" in posix._statfields:
        st_rdev = structseqfield(22, "device ID (if special file)")
    if "st_flags" in posix._statfields:
        st_flags = structseqfield(23, "user defined flags for file")
コード例 #20
0
ファイル: app.py プロジェクト: sota/pypy-old
class sysflags:
    __metaclass__ = structseqtype

    name = "sys.flags"

    debug = structseqfield(0)
    py3k_warning = structseqfield(1)
    division_warning = structseqfield(2)
    division_new = structseqfield(3)
    inspect = structseqfield(4)
    interactive = structseqfield(5)
    optimize = structseqfield(6)
    dont_write_bytecode = structseqfield(7)
    no_user_site = structseqfield(8)
    no_site = structseqfield(9)
    ignore_environment = structseqfield(10)
    tabcheck = structseqfield(11)
    verbose = structseqfield(12)
    unicode = structseqfield(13)
    bytes_warning = structseqfield(14)
    hash_randomization = structseqfield(15)
コード例 #21
0
class sysflags(metaclass=structseqtype):
    name = "sys.flags"

    debug = structseqfield(0)
    inspect = structseqfield(1)
    interactive = structseqfield(2)
    optimize = structseqfield(3)
    dont_write_bytecode = structseqfield(4)
    no_user_site = structseqfield(5)
    no_site = structseqfield(6)
    ignore_environment = structseqfield(7)
    verbose = structseqfield(8)
    bytes_warning = structseqfield(9)
    quiet = structseqfield(10)
    hash_randomization = structseqfield(11)
    isolated = structseqfield(12)
    dev_mode = structseqfield(13)
    utf8_mode = structseqfield(14)