content
stringlengths
7
1.05M
# Create a file phonebook.det that stores the details in following format: # Name Phone # Jiving 8666000 # Kriti 1010101 # Obtain the details from the user. fileObj = open("phonebook.det","w") fileObj.write("Name \t") fileObj.write("Phone \t") fileObj.write("\n") while True : name = input("Enter Name: ") fileObj.write(name +"\t") phone = input("Enter Phone: ") fileObj.write(phone + "\t") fileObj.write("\n") user = input("Enter 'Q' or 'q' to quit (Q/q) :-") if user == "Q" or user == "q": break fileObj.close() print("Thankyou") # f1.close() # f2.close()
class XacException(Exception): """ Generic exception """ def __init__(self, original_exc, msg=None): msg = 'An exception occurred in the Xac service' if msg is None else msg super(XacException, self).__init__( msg=msg + ': {}'.format(original_exc)) self.original_exc = original_exc class XacPathNotFound(Exception): """ Could not obtain the XACPATH from the environment. """ def __init__(self, msg=None): msg = 'XACPATH environment variable not set' if msg is None else msg super(XacPathNotFound, self).__init__()
def readBinaryDataSet(metaFilePath,binaryFilePath): dfmeta = pd.read_csv(metaFilePath) binaryFile = open(binaryFilePath,'rb') # print binaryFile.seek() FileVars={} for ind in dfmeta.index: binaryFile.seek(dfmeta.loc[ind,'startBytePosition']) typenum = None if dfmeta.loc[ind,'internalVartype'] == 'int': typenum = np.int32 if dfmeta.loc[ind,'internalVartype'] == 'double': typenum = np.float64 if dfmeta.loc[ind,'internalVartype'] == 'float': typenum = np.float S = np.fromfile(binaryFile, dtype=typenum,count = dfmeta.loc[ind,'count']) if dfmeta.loc[ind,'nrows']>0 and dfmeta.loc[ind,'ncols']>0: S = S.reshape((dfmeta.loc[ind,'nrows'],dfmeta.loc[ind,'ncols']),order='F') FileVars[dfmeta.loc[ind,'variable_name']] = S # break return FileVars
def hello_world(event): return f"Hello, World!" def hello_bucket(event, context): return f"A new file was uploaded to the bucket"
# Recently, a chaotic virus Hexadecimal advanced a new theorem which will shake the Universe. She thinks that each # Fibonacci number can be represented as sum of three not necessary different Fibonacci numbers. # Let's remember how Fibonacci numbers can be calculated. F0 = 0, F1 = 1, and all the next numbers are # Fi = Fi - 2 + Fi - 1. # So, Fibonacci numbers make a sequence of numbers: 0, 1, 1, 2, 3, 5, 8, 13, ... # If you haven't run away from the PC in fear, you have to help the virus. Your task is to divide given Fibonacci number # n by three not necessary different Fibonacci numbers or say that it is impossible. # Input # The input contains of a single integer n (0 ≤ n < 109) — the number that should be represented by the rules # described above. It is guaranteed that n is a Fibonacci number. # Output # Output three required numbers: a, b and c. If there is no answer for the test you have to print "I'm too stupid to # solve this problem" without the quotes. # If there are multiple answers, print any of them. # Examples # input # 3 # output # 1 1 1 # input # 13 # output # 2 3 8 n = int(input()) print(0, 0, n)
def solve(): for n in range(1, 1001): for m in range(n + 1, 1001): a, b, c = (m**2 - n**2, 2 * m * n, m**2 + n**2) if a + b + c == 1000: return a * b * c if __name__ == "__main__": print(solve())
def matrixElementsSum(matrix): sum = 0 for i in range(0,len(matrix)-1): for j in range(0,len(matrix[i])): if matrix[i][j] == 0: matrix[i+1][j] = 0 for row in matrix: for element in row: sum = sum + element return sum
"""SECCOMP policy. This policy is based on the default Docker SECCOMP policy profile. It allows several syscalls, which are most commonly used. We make one major change regarding the network-related ``socket`` syscall in that we only allow AF_INET/AF_INET6 SOCK_DGRAM/SOCK_STREAM sockets for TCP and UDP protocols. """ # pylint: disable=too-many-lines SECCOMP_POLICY = { "defaultAction": "SCMP_ACT_ERRNO", "architectures": ["SCMP_ARCH_X86_64", "SCMP_ARCH_X86", "SCMP_ARCH_X32"], "syscalls": [ {"name": "accept", "action": "SCMP_ACT_ALLOW", "args": []}, {"name": "accept4", "action": "SCMP_ACT_ALLOW", "args": []}, {"name": "access", "action": "SCMP_ACT_ALLOW", "args": []}, {"name": "alarm", "action": "SCMP_ACT_ALLOW", "args": []}, {"name": "bind", "action": "SCMP_ACT_ALLOW", "args": []}, {"name": "brk", "action": "SCMP_ACT_ALLOW", "args": []}, {"name": "capget", "action": "SCMP_ACT_ALLOW", "args": []}, {"name": "capset", "action": "SCMP_ACT_ALLOW", "args": []}, {"name": "chdir", "action": "SCMP_ACT_ALLOW", "args": []}, {"name": "chmod", "action": "SCMP_ACT_ALLOW", "args": []}, {"name": "chown", "action": "SCMP_ACT_ALLOW", "args": []}, {"name": "chown32", "action": "SCMP_ACT_ALLOW", "args": []}, {"name": "clock_getres", "action": "SCMP_ACT_ALLOW", "args": []}, {"name": "clock_gettime", "action": "SCMP_ACT_ALLOW", "args": []}, {"name": "clock_nanosleep", "action": "SCMP_ACT_ALLOW", "args": []}, {"name": "close", "action": "SCMP_ACT_ALLOW", "args": []}, {"name": "connect", "action": "SCMP_ACT_ALLOW", "args": []}, {"name": "copy_file_range", "action": "SCMP_ACT_ALLOW", "args": []}, {"name": "creat", "action": "SCMP_ACT_ALLOW", "args": []}, {"name": "dup", "action": "SCMP_ACT_ALLOW", "args": []}, {"name": "dup2", "action": "SCMP_ACT_ALLOW", "args": []}, {"name": "dup3", "action": "SCMP_ACT_ALLOW", "args": []}, {"name": "epoll_create", "action": "SCMP_ACT_ALLOW", "args": []}, {"name": "epoll_create1", "action": "SCMP_ACT_ALLOW", "args": []}, {"name": "epoll_ctl", "action": "SCMP_ACT_ALLOW", "args": []}, {"name": "epoll_ctl_old", "action": "SCMP_ACT_ALLOW", "args": []}, {"name": "epoll_pwait", "action": "SCMP_ACT_ALLOW", "args": []}, {"name": "epoll_wait", "action": "SCMP_ACT_ALLOW", "args": []}, {"name": "epoll_wait_old", "action": "SCMP_ACT_ALLOW", "args": []}, {"name": "eventfd", "action": "SCMP_ACT_ALLOW", "args": []}, {"name": "eventfd2", "action": "SCMP_ACT_ALLOW", "args": []}, {"name": "execve", "action": "SCMP_ACT_ALLOW", "args": []}, {"name": "execveat", "action": "SCMP_ACT_ALLOW", "args": []}, {"name": "exit", "action": "SCMP_ACT_ALLOW", "args": []}, {"name": "exit_group", "action": "SCMP_ACT_ALLOW", "args": []}, {"name": "faccessat", "action": "SCMP_ACT_ALLOW", "args": []}, {"name": "fadvise64", "action": "SCMP_ACT_ALLOW", "args": []}, {"name": "fadvise64_64", "action": "SCMP_ACT_ALLOW", "args": []}, {"name": "fallocate", "action": "SCMP_ACT_ALLOW", "args": []}, {"name": "fanotify_mark", "action": "SCMP_ACT_ALLOW", "args": []}, {"name": "fchdir", "action": "SCMP_ACT_ALLOW", "args": []}, {"name": "fchmod", "action": "SCMP_ACT_ALLOW", "args": []}, {"name": "fchmodat", "action": "SCMP_ACT_ALLOW", "args": []}, {"name": "fchown", "action": "SCMP_ACT_ALLOW", "args": []}, {"name": "fchown32", "action": "SCMP_ACT_ALLOW", "args": []}, {"name": "fchownat", "action": "SCMP_ACT_ALLOW", "args": []}, {"name": "fcntl", "action": "SCMP_ACT_ALLOW", "args": []}, {"name": "fcntl64", "action": "SCMP_ACT_ALLOW", "args": []}, {"name": "fdatasync", "action": "SCMP_ACT_ALLOW", "args": []}, {"name": "fgetxattr", "action": "SCMP_ACT_ALLOW", "args": []}, {"name": "flistxattr", "action": "SCMP_ACT_ALLOW", "args": []}, {"name": "flock", "action": "SCMP_ACT_ALLOW", "args": []}, {"name": "fork", "action": "SCMP_ACT_ALLOW", "args": []}, {"name": "fremovexattr", "action": "SCMP_ACT_ALLOW", "args": []}, {"name": "fsetxattr", "action": "SCMP_ACT_ALLOW", "args": []}, {"name": "fstat", "action": "SCMP_ACT_ALLOW", "args": []}, {"name": "fstat64", "action": "SCMP_ACT_ALLOW", "args": []}, {"name": "fstatat64", "action": "SCMP_ACT_ALLOW", "args": []}, {"name": "fstatfs", "action": "SCMP_ACT_ALLOW", "args": []}, {"name": "fstatfs64", "action": "SCMP_ACT_ALLOW", "args": []}, {"name": "fsync", "action": "SCMP_ACT_ALLOW", "args": []}, {"name": "ftruncate", "action": "SCMP_ACT_ALLOW", "args": []}, {"name": "ftruncate64", "action": "SCMP_ACT_ALLOW", "args": []}, {"name": "futex", "action": "SCMP_ACT_ALLOW", "args": []}, {"name": "futimesat", "action": "SCMP_ACT_ALLOW", "args": []}, {"name": "getcpu", "action": "SCMP_ACT_ALLOW", "args": []}, {"name": "getcwd", "action": "SCMP_ACT_ALLOW", "args": []}, {"name": "getdents", "action": "SCMP_ACT_ALLOW", "args": []}, {"name": "getdents64", "action": "SCMP_ACT_ALLOW", "args": []}, {"name": "getegid", "action": "SCMP_ACT_ALLOW", "args": []}, {"name": "getegid32", "action": "SCMP_ACT_ALLOW", "args": []}, {"name": "geteuid", "action": "SCMP_ACT_ALLOW", "args": []}, {"name": "geteuid32", "action": "SCMP_ACT_ALLOW", "args": []}, {"name": "getgid", "action": "SCMP_ACT_ALLOW", "args": []}, {"name": "getgid32", "action": "SCMP_ACT_ALLOW", "args": []}, {"name": "getgroups", "action": "SCMP_ACT_ALLOW", "args": []}, {"name": "getgroups32", "action": "SCMP_ACT_ALLOW", "args": []}, {"name": "getitimer", "action": "SCMP_ACT_ALLOW", "args": []}, {"name": "getpeername", "action": "SCMP_ACT_ALLOW", "args": []}, {"name": "getpgid", "action": "SCMP_ACT_ALLOW", "args": []}, {"name": "getpgrp", "action": "SCMP_ACT_ALLOW", "args": []}, {"name": "getpid", "action": "SCMP_ACT_ALLOW", "args": []}, {"name": "getppid", "action": "SCMP_ACT_ALLOW", "args": []}, {"name": "getpriority", "action": "SCMP_ACT_ALLOW", "args": []}, {"name": "getrandom", "action": "SCMP_ACT_ALLOW", "args": []}, {"name": "getresgid", "action": "SCMP_ACT_ALLOW", "args": []}, {"name": "getresgid32", "action": "SCMP_ACT_ALLOW", "args": []}, {"name": "getresuid", "action": "SCMP_ACT_ALLOW", "args": []}, {"name": "getresuid32", "action": "SCMP_ACT_ALLOW", "args": []}, {"name": "getrlimit", "action": "SCMP_ACT_ALLOW", "args": []}, {"name": "get_robust_list", "action": "SCMP_ACT_ALLOW", "args": []}, {"name": "getrusage", "action": "SCMP_ACT_ALLOW", "args": []}, {"name": "getsid", "action": "SCMP_ACT_ALLOW", "args": []}, {"name": "getsockname", "action": "SCMP_ACT_ALLOW", "args": []}, {"name": "getsockopt", "action": "SCMP_ACT_ALLOW", "args": []}, {"name": "get_thread_area", "action": "SCMP_ACT_ALLOW", "args": []}, {"name": "gettid", "action": "SCMP_ACT_ALLOW", "args": []}, {"name": "gettimeofday", "action": "SCMP_ACT_ALLOW", "args": []}, {"name": "getuid", "action": "SCMP_ACT_ALLOW", "args": []}, {"name": "getuid32", "action": "SCMP_ACT_ALLOW", "args": []}, {"name": "getxattr", "action": "SCMP_ACT_ALLOW", "args": []}, {"name": "inotify_add_watch", "action": "SCMP_ACT_ALLOW", "args": []}, {"name": "inotify_init", "action": "SCMP_ACT_ALLOW", "args": []}, {"name": "inotify_init1", "action": "SCMP_ACT_ALLOW", "args": []}, {"name": "inotify_rm_watch", "action": "SCMP_ACT_ALLOW", "args": []}, {"name": "io_cancel", "action": "SCMP_ACT_ALLOW", "args": []}, {"name": "ioctl", "action": "SCMP_ACT_ALLOW", "args": []}, {"name": "io_destroy", "action": "SCMP_ACT_ALLOW", "args": []}, {"name": "io_getevents", "action": "SCMP_ACT_ALLOW", "args": []}, {"name": "ioprio_get", "action": "SCMP_ACT_ALLOW", "args": []}, {"name": "ioprio_set", "action": "SCMP_ACT_ALLOW", "args": []}, {"name": "io_setup", "action": "SCMP_ACT_ALLOW", "args": []}, {"name": "io_submit", "action": "SCMP_ACT_ALLOW", "args": []}, {"name": "ipc", "action": "SCMP_ACT_ALLOW", "args": []}, {"name": "kill", "action": "SCMP_ACT_ALLOW", "args": []}, {"name": "lchown", "action": "SCMP_ACT_ALLOW", "args": []}, {"name": "lchown32", "action": "SCMP_ACT_ALLOW", "args": []}, {"name": "lgetxattr", "action": "SCMP_ACT_ALLOW", "args": []}, {"name": "link", "action": "SCMP_ACT_ALLOW", "args": []}, {"name": "linkat", "action": "SCMP_ACT_ALLOW", "args": []}, {"name": "listen", "action": "SCMP_ACT_ALLOW", "args": []}, {"name": "listxattr", "action": "SCMP_ACT_ALLOW", "args": []}, {"name": "llistxattr", "action": "SCMP_ACT_ALLOW", "args": []}, {"name": "_llseek", "action": "SCMP_ACT_ALLOW", "args": []}, {"name": "lremovexattr", "action": "SCMP_ACT_ALLOW", "args": []}, {"name": "lseek", "action": "SCMP_ACT_ALLOW", "args": []}, {"name": "lsetxattr", "action": "SCMP_ACT_ALLOW", "args": []}, {"name": "lstat", "action": "SCMP_ACT_ALLOW", "args": []}, {"name": "lstat64", "action": "SCMP_ACT_ALLOW", "args": []}, {"name": "madvise", "action": "SCMP_ACT_ALLOW", "args": []}, {"name": "memfd_create", "action": "SCMP_ACT_ALLOW", "args": []}, {"name": "mincore", "action": "SCMP_ACT_ALLOW", "args": []}, {"name": "mkdir", "action": "SCMP_ACT_ALLOW", "args": []}, {"name": "mkdirat", "action": "SCMP_ACT_ALLOW", "args": []}, {"name": "mknod", "action": "SCMP_ACT_ALLOW", "args": []}, {"name": "mknodat", "action": "SCMP_ACT_ALLOW", "args": []}, {"name": "mlock", "action": "SCMP_ACT_ALLOW", "args": []}, {"name": "mlock2", "action": "SCMP_ACT_ALLOW", "args": []}, {"name": "mlockall", "action": "SCMP_ACT_ALLOW", "args": []}, {"name": "mmap", "action": "SCMP_ACT_ALLOW", "args": []}, {"name": "mmap2", "action": "SCMP_ACT_ALLOW", "args": []}, {"name": "mprotect", "action": "SCMP_ACT_ALLOW", "args": []}, {"name": "mq_getsetattr", "action": "SCMP_ACT_ALLOW", "args": []}, {"name": "mq_notify", "action": "SCMP_ACT_ALLOW", "args": []}, {"name": "mq_open", "action": "SCMP_ACT_ALLOW", "args": []}, {"name": "mq_timedreceive", "action": "SCMP_ACT_ALLOW", "args": []}, {"name": "mq_timedsend", "action": "SCMP_ACT_ALLOW", "args": []}, {"name": "mq_unlink", "action": "SCMP_ACT_ALLOW", "args": []}, {"name": "mremap", "action": "SCMP_ACT_ALLOW", "args": []}, {"name": "msgctl", "action": "SCMP_ACT_ALLOW", "args": []}, {"name": "msgget", "action": "SCMP_ACT_ALLOW", "args": []}, {"name": "msgrcv", "action": "SCMP_ACT_ALLOW", "args": []}, {"name": "msgsnd", "action": "SCMP_ACT_ALLOW", "args": []}, {"name": "msync", "action": "SCMP_ACT_ALLOW", "args": []}, {"name": "munlock", "action": "SCMP_ACT_ALLOW", "args": []}, {"name": "munlockall", "action": "SCMP_ACT_ALLOW", "args": []}, {"name": "munmap", "action": "SCMP_ACT_ALLOW", "args": []}, {"name": "nanosleep", "action": "SCMP_ACT_ALLOW", "args": []}, {"name": "newfstatat", "action": "SCMP_ACT_ALLOW", "args": []}, {"name": "_newselect", "action": "SCMP_ACT_ALLOW", "args": []}, {"name": "open", "action": "SCMP_ACT_ALLOW", "args": []}, {"name": "openat", "action": "SCMP_ACT_ALLOW", "args": []}, {"name": "pause", "action": "SCMP_ACT_ALLOW", "args": []}, { "name": "personality", "action": "SCMP_ACT_ALLOW", "args": [{"index": 0, "value": 0, "valueTwo": 0, "op": "SCMP_CMP_EQ"}], }, { "name": "personality", "action": "SCMP_ACT_ALLOW", "args": [{"index": 0, "value": 8, "valueTwo": 0, "op": "SCMP_CMP_EQ"}], }, { "name": "personality", "action": "SCMP_ACT_ALLOW", "args": [ {"index": 0, "value": 4294967295, "valueTwo": 0, "op": "SCMP_CMP_EQ"} ], }, {"name": "pipe", "action": "SCMP_ACT_ALLOW", "args": []}, {"name": "pipe2", "action": "SCMP_ACT_ALLOW", "args": []}, {"name": "poll", "action": "SCMP_ACT_ALLOW", "args": []}, {"name": "ppoll", "action": "SCMP_ACT_ALLOW", "args": []}, {"name": "prctl", "action": "SCMP_ACT_ALLOW", "args": []}, {"name": "pread64", "action": "SCMP_ACT_ALLOW", "args": []}, {"name": "preadv", "action": "SCMP_ACT_ALLOW", "args": []}, {"name": "prlimit64", "action": "SCMP_ACT_ALLOW", "args": []}, {"name": "pselect6", "action": "SCMP_ACT_ALLOW", "args": []}, {"name": "pwrite64", "action": "SCMP_ACT_ALLOW", "args": []}, {"name": "pwritev", "action": "SCMP_ACT_ALLOW", "args": []}, {"name": "read", "action": "SCMP_ACT_ALLOW", "args": []}, {"name": "readahead", "action": "SCMP_ACT_ALLOW", "args": []}, {"name": "readlink", "action": "SCMP_ACT_ALLOW", "args": []}, {"name": "readlinkat", "action": "SCMP_ACT_ALLOW", "args": []}, {"name": "readv", "action": "SCMP_ACT_ALLOW", "args": []}, {"name": "recv", "action": "SCMP_ACT_ALLOW", "args": []}, {"name": "recvfrom", "action": "SCMP_ACT_ALLOW", "args": []}, {"name": "recvmmsg", "action": "SCMP_ACT_ALLOW", "args": []}, {"name": "recvmsg", "action": "SCMP_ACT_ALLOW", "args": []}, {"name": "remap_file_pages", "action": "SCMP_ACT_ALLOW", "args": []}, {"name": "removexattr", "action": "SCMP_ACT_ALLOW", "args": []}, {"name": "rename", "action": "SCMP_ACT_ALLOW", "args": []}, {"name": "renameat", "action": "SCMP_ACT_ALLOW", "args": []}, {"name": "renameat2", "action": "SCMP_ACT_ALLOW", "args": []}, {"name": "restart_syscall", "action": "SCMP_ACT_ALLOW", "args": []}, {"name": "rmdir", "action": "SCMP_ACT_ALLOW", "args": []}, {"name": "rt_sigaction", "action": "SCMP_ACT_ALLOW", "args": []}, {"name": "rt_sigpending", "action": "SCMP_ACT_ALLOW", "args": []}, {"name": "rt_sigprocmask", "action": "SCMP_ACT_ALLOW", "args": []}, {"name": "rt_sigqueueinfo", "action": "SCMP_ACT_ALLOW", "args": []}, {"name": "rt_sigreturn", "action": "SCMP_ACT_ALLOW", "args": []}, {"name": "rt_sigsuspend", "action": "SCMP_ACT_ALLOW", "args": []}, {"name": "rt_sigtimedwait", "action": "SCMP_ACT_ALLOW", "args": []}, {"name": "rt_tgsigqueueinfo", "action": "SCMP_ACT_ALLOW", "args": []}, {"name": "sched_getaffinity", "action": "SCMP_ACT_ALLOW", "args": []}, {"name": "sched_getattr", "action": "SCMP_ACT_ALLOW", "args": []}, {"name": "sched_getparam", "action": "SCMP_ACT_ALLOW", "args": []}, {"name": "sched_get_priority_max", "action": "SCMP_ACT_ALLOW", "args": []}, {"name": "sched_get_priority_min", "action": "SCMP_ACT_ALLOW", "args": []}, {"name": "sched_getscheduler", "action": "SCMP_ACT_ALLOW", "args": []}, {"name": "sched_rr_get_interval", "action": "SCMP_ACT_ALLOW", "args": []}, {"name": "sched_setaffinity", "action": "SCMP_ACT_ALLOW", "args": []}, {"name": "sched_setattr", "action": "SCMP_ACT_ALLOW", "args": []}, {"name": "sched_setparam", "action": "SCMP_ACT_ALLOW", "args": []}, {"name": "sched_setscheduler", "action": "SCMP_ACT_ALLOW", "args": []}, {"name": "sched_yield", "action": "SCMP_ACT_ALLOW", "args": []}, {"name": "seccomp", "action": "SCMP_ACT_ALLOW", "args": []}, {"name": "select", "action": "SCMP_ACT_ALLOW", "args": []}, {"name": "semctl", "action": "SCMP_ACT_ALLOW", "args": []}, {"name": "semget", "action": "SCMP_ACT_ALLOW", "args": []}, {"name": "semop", "action": "SCMP_ACT_ALLOW", "args": []}, {"name": "semtimedop", "action": "SCMP_ACT_ALLOW", "args": []}, {"name": "send", "action": "SCMP_ACT_ALLOW", "args": []}, {"name": "sendfile", "action": "SCMP_ACT_ALLOW", "args": []}, {"name": "sendfile64", "action": "SCMP_ACT_ALLOW", "args": []}, {"name": "sendmmsg", "action": "SCMP_ACT_ALLOW", "args": []}, {"name": "sendmsg", "action": "SCMP_ACT_ALLOW", "args": []}, {"name": "sendto", "action": "SCMP_ACT_ALLOW", "args": []}, {"name": "setfsgid", "action": "SCMP_ACT_ALLOW", "args": []}, {"name": "setfsgid32", "action": "SCMP_ACT_ALLOW", "args": []}, {"name": "setfsuid", "action": "SCMP_ACT_ALLOW", "args": []}, {"name": "setfsuid32", "action": "SCMP_ACT_ALLOW", "args": []}, {"name": "setgid", "action": "SCMP_ACT_ALLOW", "args": []}, {"name": "setgid32", "action": "SCMP_ACT_ALLOW", "args": []}, {"name": "setgroups", "action": "SCMP_ACT_ALLOW", "args": []}, {"name": "setgroups32", "action": "SCMP_ACT_ALLOW", "args": []}, {"name": "setitimer", "action": "SCMP_ACT_ALLOW", "args": []}, {"name": "setpgid", "action": "SCMP_ACT_ALLOW", "args": []}, {"name": "setpriority", "action": "SCMP_ACT_ALLOW", "args": []}, {"name": "setregid", "action": "SCMP_ACT_ALLOW", "args": []}, {"name": "setregid32", "action": "SCMP_ACT_ALLOW", "args": []}, {"name": "setresgid", "action": "SCMP_ACT_ALLOW", "args": []}, {"name": "setresgid32", "action": "SCMP_ACT_ALLOW", "args": []}, {"name": "setresuid", "action": "SCMP_ACT_ALLOW", "args": []}, {"name": "setresuid32", "action": "SCMP_ACT_ALLOW", "args": []}, {"name": "setreuid", "action": "SCMP_ACT_ALLOW", "args": []}, {"name": "setreuid32", "action": "SCMP_ACT_ALLOW", "args": []}, {"name": "setrlimit", "action": "SCMP_ACT_ALLOW", "args": []}, {"name": "set_robust_list", "action": "SCMP_ACT_ALLOW", "args": []}, {"name": "setsid", "action": "SCMP_ACT_ALLOW", "args": []}, {"name": "setsockopt", "action": "SCMP_ACT_ALLOW", "args": []}, {"name": "set_thread_area", "action": "SCMP_ACT_ALLOW", "args": []}, {"name": "set_tid_address", "action": "SCMP_ACT_ALLOW", "args": []}, {"name": "setuid", "action": "SCMP_ACT_ALLOW", "args": []}, {"name": "setuid32", "action": "SCMP_ACT_ALLOW", "args": []}, {"name": "setxattr", "action": "SCMP_ACT_ALLOW", "args": []}, {"name": "shmat", "action": "SCMP_ACT_ALLOW", "args": []}, {"name": "shmctl", "action": "SCMP_ACT_ALLOW", "args": []}, {"name": "shmdt", "action": "SCMP_ACT_ALLOW", "args": []}, {"name": "shmget", "action": "SCMP_ACT_ALLOW", "args": []}, {"name": "shutdown", "action": "SCMP_ACT_ALLOW", "args": []}, {"name": "sigaltstack", "action": "SCMP_ACT_ALLOW", "args": []}, {"name": "signalfd", "action": "SCMP_ACT_ALLOW", "args": []}, {"name": "signalfd4", "action": "SCMP_ACT_ALLOW", "args": []}, {"name": "sigreturn", "action": "SCMP_ACT_ALLOW", "args": []}, {"name": "socketpair", "action": "SCMP_ACT_ALLOW", "args": []}, {"name": "socketcall", "action": "SCMP_ACT_ALLOW", "args": []}, {"name": "splice", "action": "SCMP_ACT_ALLOW", "args": []}, {"name": "stat", "action": "SCMP_ACT_ALLOW", "args": []}, {"name": "stat64", "action": "SCMP_ACT_ALLOW", "args": []}, {"name": "statfs", "action": "SCMP_ACT_ALLOW", "args": []}, {"name": "statfs64", "action": "SCMP_ACT_ALLOW", "args": []}, {"name": "symlink", "action": "SCMP_ACT_ALLOW", "args": []}, {"name": "symlinkat", "action": "SCMP_ACT_ALLOW", "args": []}, {"name": "sync", "action": "SCMP_ACT_ALLOW", "args": []}, {"name": "sync_file_range", "action": "SCMP_ACT_ALLOW", "args": []}, {"name": "syncfs", "action": "SCMP_ACT_ALLOW", "args": []}, {"name": "sysinfo", "action": "SCMP_ACT_ALLOW", "args": []}, {"name": "syslog", "action": "SCMP_ACT_ALLOW", "args": []}, {"name": "tee", "action": "SCMP_ACT_ALLOW", "args": []}, {"name": "tgkill", "action": "SCMP_ACT_ALLOW", "args": []}, {"name": "time", "action": "SCMP_ACT_ALLOW", "args": []}, {"name": "timer_create", "action": "SCMP_ACT_ALLOW", "args": []}, {"name": "timer_delete", "action": "SCMP_ACT_ALLOW", "args": []}, {"name": "timerfd_create", "action": "SCMP_ACT_ALLOW", "args": []}, {"name": "timerfd_gettime", "action": "SCMP_ACT_ALLOW", "args": []}, {"name": "timerfd_settime", "action": "SCMP_ACT_ALLOW", "args": []}, {"name": "timer_getoverrun", "action": "SCMP_ACT_ALLOW", "args": []}, {"name": "timer_gettime", "action": "SCMP_ACT_ALLOW", "args": []}, {"name": "timer_settime", "action": "SCMP_ACT_ALLOW", "args": []}, {"name": "times", "action": "SCMP_ACT_ALLOW", "args": []}, {"name": "tkill", "action": "SCMP_ACT_ALLOW", "args": []}, {"name": "truncate", "action": "SCMP_ACT_ALLOW", "args": []}, {"name": "truncate64", "action": "SCMP_ACT_ALLOW", "args": []}, {"name": "ugetrlimit", "action": "SCMP_ACT_ALLOW", "args": []}, {"name": "umask", "action": "SCMP_ACT_ALLOW", "args": []}, {"name": "uname", "action": "SCMP_ACT_ALLOW", "args": []}, {"name": "unlink", "action": "SCMP_ACT_ALLOW", "args": []}, {"name": "unlinkat", "action": "SCMP_ACT_ALLOW", "args": []}, {"name": "utime", "action": "SCMP_ACT_ALLOW", "args": []}, {"name": "utimensat", "action": "SCMP_ACT_ALLOW", "args": []}, {"name": "utimes", "action": "SCMP_ACT_ALLOW", "args": []}, {"name": "vfork", "action": "SCMP_ACT_ALLOW", "args": []}, {"name": "vmsplice", "action": "SCMP_ACT_ALLOW", "args": []}, {"name": "wait4", "action": "SCMP_ACT_ALLOW", "args": []}, {"name": "waitid", "action": "SCMP_ACT_ALLOW", "args": []}, {"name": "waitpid", "action": "SCMP_ACT_ALLOW", "args": []}, {"name": "write", "action": "SCMP_ACT_ALLOW", "args": []}, {"name": "writev", "action": "SCMP_ACT_ALLOW", "args": []}, {"name": "arch_prctl", "action": "SCMP_ACT_ALLOW", "args": []}, {"name": "modify_ldt", "action": "SCMP_ACT_ALLOW", "args": []}, {"name": "chroot", "action": "SCMP_ACT_ALLOW", "args": []}, { "name": "clone", "action": "SCMP_ACT_ALLOW", "args": [ { "index": 0, "value": 2080505856, "valueTwo": 0, "op": "SCMP_CMP_MASKED_EQ", } ], }, { "name": "socket", "action": "SCMP_ACT_ALLOW", "args": [ { "index": 0, "value": 1, # AF_UNIX "valueTwo": 0, "op": "SCMP_CMP_EQ", } ], }, { "name": "socket", "action": "SCMP_ACT_ALLOW", "args": [ { "index": 0, "value": 2, # AF_INET "valueTwo": 0, "op": "SCMP_CMP_EQ", }, { "index": 1, "value": 1, # SOCK_STREAM "valueTwo": 1, # This needs to be masked since python automatically adds # flags when creating socket in Linux. # See https://bugs.python.org/issue32331 for more details. "op": "SCMP_CMP_MASKED_EQ", }, { "index": 2, "value": 6, # IPPROTO_TCP "valueTwo": 0, "op": "SCMP_CMP_EQ", }, ], }, { "name": "socket", "action": "SCMP_ACT_ALLOW", "args": [ {"index": 0, "value": 2, "valueTwo": 0, "op": "SCMP_CMP_EQ"}, # AF_INET { "index": 1, "value": 2, # SOCK_DGRAM "valueTwo": 0, "op": "SCMP_CMP_EQ", }, { "index": 2, "value": 17, # IPPROTO_UDP "valueTwo": 0, "op": "SCMP_CMP_EQ", }, ], }, { "name": "socket", "action": "SCMP_ACT_ALLOW", "args": [ { "index": 0, "value": 10, # AF_INET6 "valueTwo": 0, "op": "SCMP_CMP_EQ", }, { "index": 1, "value": 1, # SOCK_STREAM "valueTwo": 0, "op": "SCMP_CMP_EQ", }, { "index": 2, "value": 6, # IPPROTO_TCP "valueTwo": 0, "op": "SCMP_CMP_EQ", }, ], }, { "name": "socket", "action": "SCMP_ACT_ALLOW", "args": [ { "index": 0, "value": 10, # AF_INET6 "valueTwo": 0, "op": "SCMP_CMP_EQ", }, { "index": 1, "value": 2, # SOCK_DGRAM "valueTwo": 0, "op": "SCMP_CMP_EQ", }, { "index": 2, "value": 17, # IPPROTO_UDP "valueTwo": 0, "op": "SCMP_CMP_EQ", }, ], }, ], }
load("@bazel_tools//tools/build_defs/repo:utils.bzl", "maybe") load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") def opentelemetry_cpp_deps(): """Loads dependencies need to compile the opentelemetry-cpp library.""" # Google Benchmark library. # Only needed for benchmarks, not to build the OpenTelemetry library. maybe( http_archive, name = "com_github_google_benchmark", sha256 = "dccbdab796baa1043f04982147e67bb6e118fe610da2c65f88912d73987e700c", strip_prefix = "benchmark-1.5.2", urls = [ "https://github.com/google/benchmark/archive/v1.5.2.tar.gz", ], ) # GoogleTest framework. # Only needed for tests, not to build the OpenTelemetry library. maybe( http_archive, name = "com_google_googletest", sha256 = "a03a7b24b3a0766dc823c9008dd32c56a1183889c04f084653266af22289ab0c", strip_prefix = "googletest-a6dfd3aca7f2f91f95fc7ab650c95a48420d513d", urls = [ "https://github.com/google/googletest/archive/a6dfd3aca7f2f91f95fc7ab650c95a48420d513d.tar.gz", ], ) # Load gRPC dependency maybe( http_archive, name = "com_github_grpc_grpc_legacy", sha256 = "024118069912358e60722a2b7e507e9c3b51eeaeee06e2dd9d95d9c16f6639ec", strip_prefix = "grpc-1.39.1", urls = [ "https://github.com/grpc/grpc/archive/v1.39.1.tar.gz", ], ) maybe( http_archive, name = "com_github_grpc_grpc", sha256 = "024118069912358e60722a2b7e507e9c3b51eeaeee06e2dd9d95d9c16f6639ec", strip_prefix = "grpc-1.39.1", urls = [ "https://github.com/grpc/grpc/archive/v1.39.1.tar.gz", ], ) # OTLP Protocol definition maybe( http_archive, name = "com_github_opentelemetry_proto", build_file = "@io_opentelemetry_cpp//bazel:opentelemetry_proto.BUILD", sha256 = "985367f8905e91018e636cbf0d83ab3f834b665c4f5899a27d10cae9657710e2", strip_prefix = "opentelemetry-proto-0.11.0", urls = [ "https://github.com/open-telemetry/opentelemetry-proto/archive/v0.11.0.tar.gz", ], ) # JSON library maybe( http_archive, name = "github_nlohmann_json", build_file = "@io_opentelemetry_cpp//bazel:nlohmann_json.BUILD", sha256 = "69cc88207ce91347ea530b227ff0776db82dcb8de6704e1a3d74f4841bc651cf", urls = [ "https://github.com/nlohmann/json/releases/download/v3.6.1/include.zip", ], ) # C++ Prometheus Client library. maybe( http_archive, name = "com_github_jupp0r_prometheus_cpp", sha256 = "aab4ef8342319f631969e01b8c41e355704847cbe76131cb1dd5ea1862000bda", strip_prefix = "prometheus-cpp-0.11.0", urls = [ "https://github.com/jupp0r/prometheus-cpp/archive/v0.11.0.tar.gz", ], ) # libcurl (optional) maybe( http_archive, name = "curl", build_file = "@io_opentelemetry_cpp//bazel:curl.BUILD", sha256 = "ba98332752257b47b9dea6d8c0ad25ec1745c20424f1dd3ff2c99ab59e97cf91", strip_prefix = "curl-7.73.0", urls = ["https://curl.haxx.se/download/curl-7.73.0.tar.gz"], )
"""" Given a linked list, determine if it has a cycle in it. Follow up: Can you solve it without using extra space? """ # Definition for singly-linked list. # class ListNode(object): # def __init__(self, x): # self.val = x # self.next = None class Solution(object): def hasCycle(self, head): """ :type head: ListNode :rtype: bool """ """ Method 1: Using a hash set * As we traverse over each item in a linked list, we add that to a set. * Each time, we check if the item is already present in the set or not. If it is then we can safely say that a loop exists in the Linked List. Your runtime beats 35.51 % of python submissions """ # s = set() # current_ptr = head # while current_ptr: # if current_ptr in s: # return True # else: # s.add(current_ptr) # current_ptr = current_ptr.next # return False """ Method 2: Using a fast and slow pointer If a cycle exists, then the fast and slow pointer will eventually meet Your runtime beats 97.46 % of python submissions. """ slow_ptr = head fast_ptr = head while fast_ptr and fast_ptr.next: slow_ptr = slow_ptr.next fast_ptr = fast_ptr.next.next if slow_ptr == fast_ptr: return True return False
# 28. Write a Python program to print all even numbers from a given numbers list in the same order and stop the printing if any numbers that come after 237 in the sequence. # Question: # Input: """ numbers = [ 386, 462, 47, 418, 907, 344, 236, 375, 823, 566, 597, 978, 328, 615, 953, 345, 399, 162, 758, 219, 918, 237, 412, 566, 826, 248, 866, 950, 626, 949, 687, 217, 815, 67, 104, 58, 512, 24, 892, 894, 767, 553, 81, 379, 843, 831, 445, 742, 717, 958,743, 527 ] """ # Output: # Solution: https://www.w3resource.com/python-exercises/python-basic-exercise-28.php # Ideas: """ 1. """ # Steps: """ """ # Notes: """ """ # Code: numbers = [ 386, 462, 47, 418, 907, 344, 236, 375, 823, 566, 597, 978, 328, 615, 953, 345, 399, 162, 758, 219, 918, 237, 412, 566, 826, 248, 866, 950, 626, 949, 687, 217, 815, 67, 104, 58, 512, 24, 892, 894, 767, 553, 81, 379, 843, 831, 445, 742, 717, 958,743, 527 ] def checkEvens(lst): for item in lst: if item == 237: print(item) break elif item % 2 == 0: print(item) checkEvens(numbers) # Testing: """ """
# Douglas Vieira # @ansattz # 1 - Não delete nem modifique esta linha def abss(x): """ Retornar o valor absoluto de inteiros e de números complexos; int -> float complex -> float """ md=(x**2)**0.5 return md print(abss(complex(-3,-4))) #2 - Não delete nem modifique esta linha def qrreal(a,b,c): """ Função que retorna a quantidade de raízes reais de uma equação polinomial de grau n=2; int, int, int -> str """ disc = b**2-4*a*c if disc>0: return "Duas raízes reais." elif disc<0: return "Nenhuma raíz real." else: return "Uma raíz real." print(qrreal(6,-12,-210)) #3 - Não delete nem modifique esta linha def strrep(strg,x): """ A função retorna uma string com n repetições; str, int -> str """ return strg*x print(strrep('Feliz aniversário!!\n', 5000)) #4 - Não delete nem modifique esta linha def calen(x,y,z): """ A função retorna o dia, mês e o ano em notação padrão de data; Dia,mês e ano como entradas; int, int, int -> str """ dia=str(x)+' / ' dia1=str(0) + str(x)+' / ' mes=str(y)+' / ' mes1=str(0) + str(y)+' / ' ano=str(z) if x<10 and y<10: return dia1 + mes1 + ano elif x<10 and y>10: return dia1 + mes + ano elif x>10 and y<10: return dia + mes1 + ano else: return dia + mes + ano print(calen(2,8,21)) #5 - Não delete nem modifique esta linha #Número mínimo de testes: 5 def funcp(x): """ A função retorna a imagem de um função matemática definida em partes para valores maiores ou iguais a 0; float -> float """ f_id=x f_const1=2 f_const2=3 f_quad=x**2-10*x+28 if x<=0: return 0 elif x>0 and x<=2: return f_id elif x>2 and x<=3.5: return f_const1 elif x>3.5 and x<=5: return f_const2 else: return f_quad print(funcp(2)) #6a - Não delete nem modifique esta linha def desc(sb): """ A função retorna o valor do desconto de INSS dado o salário bruto como entrada; float -> float """ dk=0.06*sb tk=0.08*sb ddk=0.1*sb if sb>0 and sb<=2000: return dk elif sb>2000 and sb<=3000: return tk elif sb>3000: return ddk else: return "Valor incorreto" #6b - Não delete nem modifique esta linha def desc_ir(sb): """ A função retorna o valor do desconto de IR dado o salário bruto como entrada; float -> float """ dmk=0.11*sb ck=0.15*sb cck=0.22*sb if sb>0 and sb<=2500: return dmk elif sb>2500 and sb<=5000: return ck elif sb>5000: return cck else: return "Valor incorreto" #6c - Não delete nem modifique esta linha def sal(sb): """ A função retorna o salário líquido dado o salário bruto como entrada utilizando as funções de desconto de INSS e IR float -> float """ sliquido=sb -(desc(sb) + desc_ir(sb)) return sliquido print(sal(20000))
class MapPiece(object): name = "" tiles = "" symbolic_links = {} spawn_ratios = tuple() spawners = tuple() connectors = {} @classmethod def write_tiles_level(cls, level, left_x, top_y): local_x = 0 local_y = 0 for line in cls.tiles: for char in line: tile_link = cls.symbolic_links.get(char, None) if tile_link: world_coordinates = (left_x + local_x, top_y + local_y) level.add_tile(world_coordinates, tile_link) else: raise Exception("Char {} has no link".format(char)) local_x += 1 local_x = 0 local_y += 1 @classmethod def get_width(cls): return max([len(line) for line in cls.tiles]) @classmethod def get_height(cls): return len(cls.tiles)
# Copyright 2010-2021, Google Inc. # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are # met: # # * Redistributions of source code must retain the above copyright # notice, this list of conditions and the following disclaimer. # * Redistributions in binary form must reproduce the above # copyright notice, this list of conditions and the following disclaimer # in the documentation and/or other materials provided with the # distribution. # * Neither the name of Google Inc. nor the names of its # contributors may be used to endorse or promote products derived from # this software without specific prior written permission. # # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR # A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT # OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. { 'targets': [ { 'target_name': 'ios_engine_main', 'type': 'executable', 'sources': [ 'ios_engine_main.cc', ], 'dependencies': [ 'ios_engine', ], }, { 'target_name': 'ios_engine', 'type': 'static_library', 'sources': [ 'ios_engine.cc', 'ios_engine.h', ], 'dependencies': [ '../base/absl.gyp:absl_synchronization', '../base/base.gyp:base_core', '../composer/composer.gyp:composer', '../config/config.gyp:config_handler', '../data_manager/oss/oss_data_manager.gyp:oss_data_manager', '../engine/engine.gyp:engine_builder', '../engine/engine.gyp:minimal_engine', '../protocol/protocol.gyp:commands_proto', '../protocol/protocol.gyp:config_proto', '../session/session.gyp:session', '../session/session.gyp:session_handler', ], }, { 'target_name': 'libmozc_gboard', 'type': 'none', 'variables': { # libraries to be packed into a single library for Gboard. # This list is generated from the necessary libraries to build # ios_engine_main except for libprotobuf.a. libprotobuf.a is already # included by Gboard. 'src_libs': [ '<(PRODUCT_DIR)/libbase.a', '<(PRODUCT_DIR)/libbase_core.a', '<(PRODUCT_DIR)/libbit_vector_based_array.a', '<(PRODUCT_DIR)/libcalculator.a', '<(PRODUCT_DIR)/libcandidates_proto.a', '<(PRODUCT_DIR)/libcharacter_form_manager.a', '<(PRODUCT_DIR)/libclock.a', '<(PRODUCT_DIR)/libcodec.a', '<(PRODUCT_DIR)/libcodec_factory.a', '<(PRODUCT_DIR)/libcodec_util.a', '<(PRODUCT_DIR)/libcommands_proto.a', '<(PRODUCT_DIR)/libcomposer.a', '<(PRODUCT_DIR)/libconfig_file_stream.a', '<(PRODUCT_DIR)/libconfig_handler.a', '<(PRODUCT_DIR)/libconfig_proto.a', '<(PRODUCT_DIR)/libconnector.a', '<(PRODUCT_DIR)/libconversion_request.a', '<(PRODUCT_DIR)/libconverter.a', '<(PRODUCT_DIR)/libconverter_util.a', '<(PRODUCT_DIR)/libdata_manager.a', '<(PRODUCT_DIR)/libdataset_proto.a', '<(PRODUCT_DIR)/libdataset_reader.a', '<(PRODUCT_DIR)/libdictionary_file.a', '<(PRODUCT_DIR)/libdictionary_impl.a', '<(PRODUCT_DIR)/libencryptor.a', '<(PRODUCT_DIR)/libengine.a', '<(PRODUCT_DIR)/libengine_builder.a', '<(PRODUCT_DIR)/libengine_builder_proto.a', '<(PRODUCT_DIR)/libflags.a', '<(PRODUCT_DIR)/libgoogle_data_manager.a', '<(PRODUCT_DIR)/libhash.a', '<(PRODUCT_DIR)/libimmutable_converter.a', '<(PRODUCT_DIR)/libimmutable_converter_interface.a', '<(PRODUCT_DIR)/libios_engine.a', '<(PRODUCT_DIR)/libkey_event_util.a', '<(PRODUCT_DIR)/libkey_parser.a', '<(PRODUCT_DIR)/libkeymap.a', '<(PRODUCT_DIR)/libkeymap_factory.a', '<(PRODUCT_DIR)/liblattice.a', '<(PRODUCT_DIR)/liblouds.a', '<(PRODUCT_DIR)/liblouds_trie.a', '<(PRODUCT_DIR)/libmultifile.a', '<(PRODUCT_DIR)/libmutex.a', '<(PRODUCT_DIR)/libobfuscator_support.a', '<(PRODUCT_DIR)/libprediction.a', '<(PRODUCT_DIR)/libprediction_protocol.a', # libprotobuf is included in a different place. # '<(PRODUCT_DIR)/libprotobuf.a', '<(PRODUCT_DIR)/librequest_test_util.a', '<(PRODUCT_DIR)/librewriter.a', '<(PRODUCT_DIR)/libsegmenter.a', '<(PRODUCT_DIR)/libsegmenter_data_proto.a', '<(PRODUCT_DIR)/libsegments.a', '<(PRODUCT_DIR)/libserialized_dictionary.a', '<(PRODUCT_DIR)/libserialized_string_array.a', '<(PRODUCT_DIR)/libsession.a', '<(PRODUCT_DIR)/libsession_handler.a', '<(PRODUCT_DIR)/libsession_internal.a', '<(PRODUCT_DIR)/libsession_usage_stats_util.a', '<(PRODUCT_DIR)/libsimple_succinct_bit_vector_index.a', '<(PRODUCT_DIR)/libsingleton.a', '<(PRODUCT_DIR)/libstats_config_util.a', '<(PRODUCT_DIR)/libstorage.a', '<(PRODUCT_DIR)/libsuffix_dictionary.a', '<(PRODUCT_DIR)/libsuggestion_filter.a', '<(PRODUCT_DIR)/libsuppression_dictionary.a', '<(PRODUCT_DIR)/libsystem_dictionary.a', '<(PRODUCT_DIR)/libsystem_dictionary_codec.a', '<(PRODUCT_DIR)/libtext_dictionary_loader.a', '<(PRODUCT_DIR)/libtransliteration.a', '<(PRODUCT_DIR)/libusage_stats.a', '<(PRODUCT_DIR)/libusage_stats_protocol.a', '<(PRODUCT_DIR)/libuser_dictionary.a', '<(PRODUCT_DIR)/libuser_dictionary_storage_proto.a', '<(PRODUCT_DIR)/libuser_pos.a', '<(PRODUCT_DIR)/libvalue_dictionary.a', ] }, 'actions': [ { 'action_name': 'libtool', 'outputs': ['<(PRODUCT_DIR)/libmozc_gboard.a'], 'inputs': ['<@(src_libs)'], 'action': [ 'libtool', '-static', '-o', '<(PRODUCT_DIR)/libmozc_gboard.a', '<@(src_libs)', ], }, ], }, ], }
class Solution: def __init__(self, w: List[int]): self.length = sum(w) self.n = len(w) self.w_pool = [0] for i in range(self.n): self.w_pool.append(self.w_pool[-1] + w[i]) def pickIndex(self) -> int: picked_val = random.uniform(0, self.length) i = 0 left, right = 0, self.n while left < right - 1: mid = (right + left) // 2 if picked_val == self.w_pool[mid]: return mid - 1 elif picked_val > self.w_pool[mid]: left = mid elif picked_val < self.w_pool[mid]: right = mid return left
def montana_getEnhancedLocation(location): """Add Montana to the location if not there already.""" return add_state(location, "Montana") def montana_cleanPrice(price): return price_quantity_us_number(price) def montana_getCurrency(price): return price_currency(price)
class WordDictionary(object): def __init__(self): """ initialize your data structure here. """ self.root = {} def addWord(self, word): """ Adds a word into the data structure. :type word: str :rtype: void """ node = self.root for c in word: if c not in node: node[c] = {} node = node[c] node['#'] = '#' def search(self, word): """ Returns if the word is in the data structure. A word could contain the dot character '.' to represent any one letter. :type word: str :rtype: bool """ def find(word, node): if not word: return '#' in node c, word = word[0], word[1:] if c != '.': return c in node and find(word, node[c]) return any(find(word, d) for d in node.values() if d != '#') return find(word, self.root)
class TrainTaskConfig(object): use_gpu = False # the epoch number to train. pass_num = 2 # the number of sequences contained in a mini-batch. batch_size = 64 # the hyper parameters for Adam optimizer. learning_rate = 0.001 beta1 = 0.9 beta2 = 0.98 eps = 1e-9 # the parameters for learning rate scheduling. warmup_steps = 4000 # the flag indicating to use average loss or sum loss when training. use_avg_cost = False # the directory for saving trained models. model_dir = "trained_models" class InferTaskConfig(object): use_gpu = False # the number of examples in one run for sequence generation. batch_size = 10 # the parameters for beam search. beam_size = 5 max_length = 30 # the number of decoded sentences to output. n_best = 1 # the flags indicating whether to output the special tokens. output_bos = False output_eos = False output_unk = False # the directory for loading the trained model. model_path = "trained_models/pass_1.infer.model" class ModelHyperParams(object): # Dictionary size for source and target language. This model directly uses # paddle.dataset.wmt16 in which <bos>, <eos> and <unk> token has # alreay been added, but the <pad> token is not added. Transformer requires # sequences in a mini-batch are padded to have the same length. A <pad> token is # added into the original dictionary in paddle.dateset.wmt16. # size of source word dictionary. src_vocab_size = 10000 # index for <pad> token in source language. src_pad_idx = src_vocab_size # size of target word dictionay trg_vocab_size = 10000 # index for <pad> token in target language. trg_pad_idx = trg_vocab_size # index for <bos> token bos_idx = 0 # index for <eos> token eos_idx = 1 # index for <unk> token unk_idx = 2 # position value corresponding to the <pad> token. pos_pad_idx = 0 # max length of sequences. It should plus 1 to include position # padding token for position encoding. max_length = 50 # the dimension for word embeddings, which is also the last dimension of # the input and output of multi-head attention, position-wise feed-forward # networks, encoder and decoder. d_model = 512 # size of the hidden layer in position-wise feed-forward networks. d_inner_hid = 1024 # the dimension that keys are projected to for dot-product attention. d_key = 64 # the dimension that values are projected to for dot-product attention. d_value = 64 # number of head used in multi-head attention. n_head = 8 # number of sub-layers to be stacked in the encoder and decoder. n_layer = 6 # dropout rate used by all dropout layers. dropout = 0.1 # Names of position encoding table which will be initialized externally. pos_enc_param_names = ( "src_pos_enc_table", "trg_pos_enc_table", ) # Names of all data layers in encoder listed in order. encoder_input_data_names = ( "src_word", "src_pos", "src_slf_attn_bias", "src_data_shape", "src_slf_attn_pre_softmax_shape", "src_slf_attn_post_softmax_shape", ) # Names of all data layers in decoder listed in order. decoder_input_data_names = ( "trg_word", "trg_pos", "trg_slf_attn_bias", "trg_src_attn_bias", "trg_data_shape", "trg_slf_attn_pre_softmax_shape", "trg_slf_attn_post_softmax_shape", "trg_src_attn_pre_softmax_shape", "trg_src_attn_post_softmax_shape", "enc_output", ) # Names of label related data layers listed in order. label_data_names = ( "lbl_word", "lbl_weight", )
INSTALLED_APPS = [ "django_event_sourcing", "django.contrib.auth", "django.contrib.contenttypes", ] DATABASES = { "default": { "ENGINE": "django.db.backends.sqlite3", "NAME": ":memory:", } } SECRET_KEY = "This is a SECRET_KEY" EVENT_TYPES = [ "tests.event_types.DummyEventType", ]
#! python2.7 ## -*- coding: utf-8 -*- ## kun for Apk View Tracing ## TreeType.py #=============================================================================== # # data structures #=============================================================================== class CRect(object): mLeft = 0 mRight = 0 mTop = 0 mBottom = 0 class CPoint(): x = 0 y = 0 class CTreeNode(object): mClassName = "mClassName" mHashCode = "fffff" mId = "mId" mText = "mText" mAbsoluteRect=CRect() mRect = CRect() mLocation = CPoint() mElement = "element_data" ## just init, it was string data which was dumped from telnet mParentNode = {} ## just init, but it also was CTreeNode object mChildNodes = [] mDepth = 0 mTreeDepth = 0 ## its depth in this view tree mActive = False ## currently, I get this value from (DRAWN, Visiable, Clickable) mVisible = False
grades = { "English": 97, "Math": 93, "Art": 74, "Music": 86 } grades.setdefault("Art", 87) # Art key exists. No change. print("Art grade:", grades["Art"]) grades.setdefault("Gym", 97) # Gym key is new. Added and set. print("Gym grade:", grades["Gym"])
# Utility functions for viterbi-trellis. # # argmin is defined here to avoid dependence on e.g., numpy. def argmin(list_obj): """Returns the index of the min value in the list.""" min = None best_idx = None for idx, val in enumerate(list_obj): if min is None or val < min: min = val best_idx = idx return best_idx
strategy_type = "learning" config = { "strategy_id": "svm", "name": "Support Vector Machine Classifier", "parameters": [ { "parameter_id": "C", "label": "C - Error term weight", "type": "float", "default_value": 2.6, }, { "parameter_id": "kernel", "label": "SVM kernel", "selection_values": [ "linear", "poly", "sigmoid", "rbf", ], "default_value": "rbf", }, { "parameter_id": "degree", "label": "Polynom degree", "type": "int", "visibility_rules": [ { "field": "kernel", "values": [ "poly", ], }, ], }, { "parameter_id": "gamma", "label": "Kernel coefficient", "type": "float", "visibility_rules": [ { "field": "kernel", "values": [ "rbf", "poly", "sigmoid", ], }, ], "default_value": 0.02, }, { "parameter_id": "coef0", "label": "Independent term in kernel function", "type": "float", "visibility_rules": [ { "field": "kernel", "values": [ "poly", "sigmoid", ], }, ], }, ], "grid_search": { "small": [ { "C": 0.1, "kernel": "linear", }, { "C": 0.1, "kernel": "poly", "degree": 2, }, { "C": 0.1, "kernel": "poly", "degree": 3, }, { "C": 2.6, "kernel": "rbf", "gamma": 0.005, }, { "C": 0.1, "kernel": "sigmoid", }, ], "medium": [ { "C": 1.0, "kernel": "linear", }, { "C": 1.0, "kernel": "poly", "degree": 2, }, { "C": 1.0, "kernel": "poly", "degree": 3, }, { "C": 2.6, "kernel": "rbf", "gamma": 0.02, }, { "C": 1.0, "kernel": "sigmoid", }, ], "large": [ { "C": 2.0, "kernel": "linear", }, { "C": 2.0, "kernel": "poly", "degree": 2, }, { "C": 2.0, "kernel": "poly", "degree": 3, }, { "C": 2.6, "kernel": "rbf", "gamma": 0.5, }, { "C": 2.0, "kernel": "sigmoid", }, ], } }
# is_learning = True # while is_learning: # print('Learning...') # ask = input('Are you still learning? ') # is_learning = ask == 'yes' # if not is_learning: # print('You finally mastered it') people = ['Alice', 'Bob', 'Charlie'] for person in people: print(person) indices = [0, 1, 2, 3, 4] for _ in indices: print('I will repeat 5 times') for _ in range(5): print('I will repeat 5 times again') start = 2 stop = 20 step = 3 for index in range(start, stop, step): print(index) students = [ {'name': 'Alice', 'grade': 92}, {'name': 'Bob', 'grade': 90} ] for student in students: name = student['name'] grade = student['grade'] print(f'{name} has a grade of {grade}') people = { 'Alice': 20, 'Bob': 30, 'Charlie': 40 } for name, age in people.items(): print(f'{name} is {age} years old') if name == 'Bob': break else: continue cars = ['ok', 'ok', 'ok', 'ok', 'ko', 'ok', 'ok'] no_faulty_cars = ['ok', 'ok', 'ok', 'ok', 'ok', 'ok', 'ok'] for status in no_faulty_cars: if status == 'ko': print('Stopping the production') break print(f'The car is {status}') else: print('No break was encountered')
# <<BEGIN-copyright>> # Copyright 2021, Lawrence Livermore National Security, LLC. # See the top-level COPYRIGHT file for details. # # SPDX-License-Identifier: BSD-3-Clause # <<END-copyright>> """ This module contains miscellaneous functions used by the modules that convert a GNDS reactionSuite into an ACE file. """ floatFormatOthers = '%20.12E' floatFormatEnergyGrid = '%21.13E' floatFormatEnergyGrid = floatFormatOthers def updateXSSInfo(label, annotates, XSS, data): annotates.append((len(XSS), label)) XSS += data def intArrayToRecords(intArray): stringData = ['%9d' % d for d in intArray] lines = [] while(len(stringData)) : lines.append(''.join(stringData[:8])) stringData = stringData[8:] return lines def XSSToStrings(annotates, XSS, addAnnotation, numberOfEnergiesInGrid): strData, record, i3 = [], [], 0 annotates.append((len(XSS), '')) i2, label = annotates[i3] for i1, datum in enumerate(XSS): if( type( datum ) == int ) : record.append( "%20d" % datum ) else : try : floatFormat = floatFormatOthers if( i1 < numberOfEnergiesInGrid ) : floatFormat = floatFormatEnergyGrid record.append( floatFormat % datum ) except : print( i1, len(XSS), datum, annotates[i3] ) raise if( len( record ) == 4 ) : annotate = '' if( i2 <= i1 ) : annotate = ' !' sep = ' ' while( i2 <= i1 ) : annotate += sep + label + ' (%s)' % ( i2 - i1 + 3 ) sep = ', ' i3 += 1 i2, label = annotates[i3] if( not addAnnotation ) : annotate = '' strData.append( ''.join( record ) + annotate ) record = [] if len(record) > 0: strData.append(''.join(record)) return strData
def height(root): if root is None: return -1 left_height = height(root.left) right_height = height(root.right) return 1 + max(left_height, right_height)
class Solution: """ @param M: a matrix @return: the total number of friend circles among all the students """ def findCircleNum(self, M): # Write your code here res, queue = 0, [] visited = [False for _ in range(len(M))] for i in range(len(M)): if not visited[i]: res += 1 visited[i] = True queue.append(i) while queue: node = queue.pop(0) for j in range(len(M)): if M[node][j] and not visited[j]: visited[j] = True queue.append(j) return res
NumeroEntrada = int(input("Digite um número inteiro: ")) RestoDivisao = NumeroEntrada % 3 if RestoDivisao == 0: print("Fizz") else: print(NumeroEntrada)
# # PySNMP MIB module LIEBERT-GP-REGISTRATION-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/LIEBERT-GP-REGISTRATION-MIB # Produced by pysmi-0.3.4 at Mon Apr 29 19:56:06 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (default, Mar 27 2019, 09:23:15) # ObjectIdentifier, Integer, OctetString = mibBuilder.importSymbols("ASN1", "ObjectIdentifier", "Integer", "OctetString") NamedValues, = mibBuilder.importSymbols("ASN1-ENUMERATION", "NamedValues") ValueRangeConstraint, ValueSizeConstraint, ConstraintsUnion, ConstraintsIntersection, SingleValueConstraint = mibBuilder.importSymbols("ASN1-REFINEMENT", "ValueRangeConstraint", "ValueSizeConstraint", "ConstraintsUnion", "ConstraintsIntersection", "SingleValueConstraint") ModuleCompliance, NotificationGroup = mibBuilder.importSymbols("SNMPv2-CONF", "ModuleCompliance", "NotificationGroup") Unsigned32, enterprises, TimeTicks, MibIdentifier, ModuleIdentity, Gauge32, MibScalar, MibTable, MibTableRow, MibTableColumn, Bits, Counter32, IpAddress, Counter64, NotificationType, ObjectIdentity, Integer32, iso = mibBuilder.importSymbols("SNMPv2-SMI", "Unsigned32", "enterprises", "TimeTicks", "MibIdentifier", "ModuleIdentity", "Gauge32", "MibScalar", "MibTable", "MibTableRow", "MibTableColumn", "Bits", "Counter32", "IpAddress", "Counter64", "NotificationType", "ObjectIdentity", "Integer32", "iso") TextualConvention, DisplayString = mibBuilder.importSymbols("SNMPv2-TC", "TextualConvention", "DisplayString") liebertGlobalProductsRegistrationModule = ModuleIdentity((1, 3, 6, 1, 4, 1, 476, 1, 42, 1, 1, 1)) liebertGlobalProductsRegistrationModule.setRevisions(('2015-02-02 00:00', '2014-09-17 00:00', '2014-06-24 00:00', '2014-03-27 00:00', '2013-07-10 00:00', '2013-05-14 00:00', '2009-04-17 00:00', '2008-07-02 00:00', '2008-01-10 00:00', '2006-02-22 00:00',)) if mibBuilder.loadTexts: liebertGlobalProductsRegistrationModule.setLastUpdated('201403270000Z') if mibBuilder.loadTexts: liebertGlobalProductsRegistrationModule.setOrganization('Liebert Corporation') emerson = ObjectIdentity((1, 3, 6, 1, 4, 1, 476)) if mibBuilder.loadTexts: emerson.setStatus('current') liebertCorp = ObjectIdentity((1, 3, 6, 1, 4, 1, 476, 1)) if mibBuilder.loadTexts: liebertCorp.setStatus('current') liebertGlobalProducts = ObjectIdentity((1, 3, 6, 1, 4, 1, 476, 1, 42)) if mibBuilder.loadTexts: liebertGlobalProducts.setStatus('current') lgpModuleReg = ObjectIdentity((1, 3, 6, 1, 4, 1, 476, 1, 42, 1)) if mibBuilder.loadTexts: lgpModuleReg.setStatus('current') lgpAgent = ObjectIdentity((1, 3, 6, 1, 4, 1, 476, 1, 42, 2)) if mibBuilder.loadTexts: lgpAgent.setStatus('current') lgpFoundation = ObjectIdentity((1, 3, 6, 1, 4, 1, 476, 1, 42, 3)) if mibBuilder.loadTexts: lgpFoundation.setStatus('current') lgpProductSpecific = ObjectIdentity((1, 3, 6, 1, 4, 1, 476, 1, 42, 4)) if mibBuilder.loadTexts: lgpProductSpecific.setStatus('current') liebertModuleReg = ObjectIdentity((1, 3, 6, 1, 4, 1, 476, 1, 42, 1, 1)) if mibBuilder.loadTexts: liebertModuleReg.setStatus('current') liebertAgentModuleReg = ObjectIdentity((1, 3, 6, 1, 4, 1, 476, 1, 42, 1, 2)) if mibBuilder.loadTexts: liebertAgentModuleReg.setStatus('current') liebertConditionsModuleReg = ObjectIdentity((1, 3, 6, 1, 4, 1, 476, 1, 42, 1, 3)) if mibBuilder.loadTexts: liebertConditionsModuleReg.setStatus('current') liebertNotificationsModuleReg = ObjectIdentity((1, 3, 6, 1, 4, 1, 476, 1, 42, 1, 4)) if mibBuilder.loadTexts: liebertNotificationsModuleReg.setStatus('current') liebertEnvironmentalModuleReg = ObjectIdentity((1, 3, 6, 1, 4, 1, 476, 1, 42, 1, 5)) if mibBuilder.loadTexts: liebertEnvironmentalModuleReg.setStatus('current') liebertPowerModuleReg = ObjectIdentity((1, 3, 6, 1, 4, 1, 476, 1, 42, 1, 6)) if mibBuilder.loadTexts: liebertPowerModuleReg.setStatus('current') liebertControllerModuleReg = ObjectIdentity((1, 3, 6, 1, 4, 1, 476, 1, 42, 1, 7)) if mibBuilder.loadTexts: liebertControllerModuleReg.setStatus('current') liebertSystemModuleReg = ObjectIdentity((1, 3, 6, 1, 4, 1, 476, 1, 42, 1, 8)) if mibBuilder.loadTexts: liebertSystemModuleReg.setStatus('current') liebertPduModuleReg = ObjectIdentity((1, 3, 6, 1, 4, 1, 476, 1, 42, 1, 9)) if mibBuilder.loadTexts: liebertPduModuleReg.setStatus('current') liebertFlexibleModuleReg = ObjectIdentity((1, 3, 6, 1, 4, 1, 476, 1, 42, 1, 10)) if mibBuilder.loadTexts: liebertFlexibleModuleReg.setStatus('current') liebertFlexibleConditionsModuleReg = ObjectIdentity((1, 3, 6, 1, 4, 1, 476, 1, 42, 1, 11)) if mibBuilder.loadTexts: liebertFlexibleConditionsModuleReg.setStatus('current') lgpAgentIdent = ObjectIdentity((1, 3, 6, 1, 4, 1, 476, 1, 42, 2, 1)) if mibBuilder.loadTexts: lgpAgentIdent.setStatus('current') lgpAgentNotifications = ObjectIdentity((1, 3, 6, 1, 4, 1, 476, 1, 42, 2, 3)) if mibBuilder.loadTexts: lgpAgentNotifications.setStatus('current') lgpAgentDevice = ObjectIdentity((1, 3, 6, 1, 4, 1, 476, 1, 42, 2, 4)) if mibBuilder.loadTexts: lgpAgentDevice.setStatus('current') lgpAgentControl = ObjectIdentity((1, 3, 6, 1, 4, 1, 476, 1, 42, 2, 5)) if mibBuilder.loadTexts: lgpAgentControl.setStatus('current') lgpConditions = ObjectIdentity((1, 3, 6, 1, 4, 1, 476, 1, 42, 3, 2)) if mibBuilder.loadTexts: lgpConditions.setStatus('current') lgpNotifications = ObjectIdentity((1, 3, 6, 1, 4, 1, 476, 1, 42, 3, 3)) if mibBuilder.loadTexts: lgpNotifications.setStatus('current') lgpEnvironmental = ObjectIdentity((1, 3, 6, 1, 4, 1, 476, 1, 42, 3, 4)) if mibBuilder.loadTexts: lgpEnvironmental.setStatus('current') lgpPower = ObjectIdentity((1, 3, 6, 1, 4, 1, 476, 1, 42, 3, 5)) if mibBuilder.loadTexts: lgpPower.setStatus('current') lgpController = ObjectIdentity((1, 3, 6, 1, 4, 1, 476, 1, 42, 3, 6)) if mibBuilder.loadTexts: lgpController.setStatus('current') lgpSystem = ObjectIdentity((1, 3, 6, 1, 4, 1, 476, 1, 42, 3, 7)) if mibBuilder.loadTexts: lgpSystem.setStatus('current') lgpPdu = ObjectIdentity((1, 3, 6, 1, 4, 1, 476, 1, 42, 3, 8)) if mibBuilder.loadTexts: lgpPdu.setStatus('current') lgpFlexible = ObjectIdentity((1, 3, 6, 1, 4, 1, 476, 1, 42, 3, 9)) if mibBuilder.loadTexts: lgpFlexible.setStatus('current') lgpUpsProducts = ObjectIdentity((1, 3, 6, 1, 4, 1, 476, 1, 42, 4, 2)) if mibBuilder.loadTexts: lgpUpsProducts.setStatus('current') lgpAcProducts = ObjectIdentity((1, 3, 6, 1, 4, 1, 476, 1, 42, 4, 3)) if mibBuilder.loadTexts: lgpAcProducts.setStatus('current') lgpPowerConditioningProducts = ObjectIdentity((1, 3, 6, 1, 4, 1, 476, 1, 42, 4, 4)) if mibBuilder.loadTexts: lgpPowerConditioningProducts.setStatus('current') lgpTransferSwitchProducts = ObjectIdentity((1, 3, 6, 1, 4, 1, 476, 1, 42, 4, 5)) if mibBuilder.loadTexts: lgpTransferSwitchProducts.setStatus('current') lgpMultiLinkProducts = ObjectIdentity((1, 3, 6, 1, 4, 1, 476, 1, 42, 4, 7)) if mibBuilder.loadTexts: lgpMultiLinkProducts.setStatus('current') lgpPowerDistributionProducts = ObjectIdentity((1, 3, 6, 1, 4, 1, 476, 1, 42, 4, 8)) if mibBuilder.loadTexts: lgpPowerDistributionProducts.setStatus('current') lgpCombinedSystemProducts = ObjectIdentity((1, 3, 6, 1, 4, 1, 476, 1, 42, 4, 10)) if mibBuilder.loadTexts: lgpCombinedSystemProducts.setStatus('current') lgpSeries7200 = ObjectIdentity((1, 3, 6, 1, 4, 1, 476, 1, 42, 4, 2, 1)) if mibBuilder.loadTexts: lgpSeries7200.setStatus('current') lgpUPStationGXT = ObjectIdentity((1, 3, 6, 1, 4, 1, 476, 1, 42, 4, 2, 2)) if mibBuilder.loadTexts: lgpUPStationGXT.setStatus('current') lgpPowerSureInteractive = ObjectIdentity((1, 3, 6, 1, 4, 1, 476, 1, 42, 4, 2, 3)) if mibBuilder.loadTexts: lgpPowerSureInteractive.setStatus('current') lgpNfinity = ObjectIdentity((1, 3, 6, 1, 4, 1, 476, 1, 42, 4, 2, 4)) if mibBuilder.loadTexts: lgpNfinity.setStatus('current') lgpNpower = ObjectIdentity((1, 3, 6, 1, 4, 1, 476, 1, 42, 4, 2, 5)) if mibBuilder.loadTexts: lgpNpower.setStatus('current') lgpGXT2Dual = ObjectIdentity((1, 3, 6, 1, 4, 1, 476, 1, 42, 4, 2, 6)) if mibBuilder.loadTexts: lgpGXT2Dual.setStatus('current') lgpPowerSureInteractive2 = ObjectIdentity((1, 3, 6, 1, 4, 1, 476, 1, 42, 4, 2, 7)) if mibBuilder.loadTexts: lgpPowerSureInteractive2.setStatus('current') lgpNX = ObjectIdentity((1, 3, 6, 1, 4, 1, 476, 1, 42, 4, 2, 8)) if mibBuilder.loadTexts: lgpNX.setStatus('current') lgpHiNet = ObjectIdentity((1, 3, 6, 1, 4, 1, 476, 1, 42, 4, 2, 9)) if mibBuilder.loadTexts: lgpHiNet.setStatus('current') lgpNXL = ObjectIdentity((1, 3, 6, 1, 4, 1, 476, 1, 42, 4, 2, 10)) if mibBuilder.loadTexts: lgpNXL.setStatus('current') lgpSuper400 = ObjectIdentity((1, 3, 6, 1, 4, 1, 476, 1, 42, 4, 2, 11)) if mibBuilder.loadTexts: lgpSuper400.setStatus('current') lgpSeries600or610 = ObjectIdentity((1, 3, 6, 1, 4, 1, 476, 1, 42, 4, 2, 12)) if mibBuilder.loadTexts: lgpSeries600or610.setStatus('current') lgpSeries300 = ObjectIdentity((1, 3, 6, 1, 4, 1, 476, 1, 42, 4, 2, 13)) if mibBuilder.loadTexts: lgpSeries300.setStatus('current') lgpSeries610SMS = ObjectIdentity((1, 3, 6, 1, 4, 1, 476, 1, 42, 4, 2, 14)) if mibBuilder.loadTexts: lgpSeries610SMS.setStatus('current') lgpSeries610MMU = ObjectIdentity((1, 3, 6, 1, 4, 1, 476, 1, 42, 4, 2, 15)) if mibBuilder.loadTexts: lgpSeries610MMU.setStatus('current') lgpSeries610SCC = ObjectIdentity((1, 3, 6, 1, 4, 1, 476, 1, 42, 4, 2, 16)) if mibBuilder.loadTexts: lgpSeries610SCC.setStatus('current') lgpGXT3 = ObjectIdentity((1, 3, 6, 1, 4, 1, 476, 1, 42, 4, 2, 17)) if mibBuilder.loadTexts: lgpGXT3.setStatus('current') lgpGXT3Dual = ObjectIdentity((1, 3, 6, 1, 4, 1, 476, 1, 42, 4, 2, 18)) if mibBuilder.loadTexts: lgpGXT3Dual.setStatus('current') lgpNXr = ObjectIdentity((1, 3, 6, 1, 4, 1, 476, 1, 42, 4, 2, 19)) if mibBuilder.loadTexts: lgpNXr.setStatus('current') lgpITA = ObjectIdentity((1, 3, 6, 1, 4, 1, 476, 1, 42, 4, 2, 19, 1)) if mibBuilder.loadTexts: lgpITA.setStatus('current') lgpNXRb = ObjectIdentity((1, 3, 6, 1, 4, 1, 476, 1, 42, 4, 2, 19, 2)) if mibBuilder.loadTexts: lgpNXRb.setStatus('current') lgpNXC = ObjectIdentity((1, 3, 6, 1, 4, 1, 476, 1, 42, 4, 2, 19, 3)) if mibBuilder.loadTexts: lgpNXC.setStatus('current') lgpNXC30to40k = ObjectIdentity((1, 3, 6, 1, 4, 1, 476, 1, 42, 4, 2, 19, 4)) if mibBuilder.loadTexts: lgpNXC30to40k.setStatus('current') lgpITA30to40k = ObjectIdentity((1, 3, 6, 1, 4, 1, 476, 1, 42, 4, 2, 19, 5)) if mibBuilder.loadTexts: lgpITA30to40k.setStatus('current') lgpAPS = ObjectIdentity((1, 3, 6, 1, 4, 1, 476, 1, 42, 4, 2, 20)) if mibBuilder.loadTexts: lgpAPS.setStatus('current') lgpMUNiMx = ObjectIdentity((1, 3, 6, 1, 4, 1, 476, 1, 42, 4, 2, 22)) if mibBuilder.loadTexts: lgpMUNiMx.setStatus('current') lgpGXT4 = ObjectIdentity((1, 3, 6, 1, 4, 1, 476, 1, 42, 4, 2, 23)) if mibBuilder.loadTexts: lgpGXT4.setStatus('current') lgpGXT4Dual = ObjectIdentity((1, 3, 6, 1, 4, 1, 476, 1, 42, 4, 2, 24)) if mibBuilder.loadTexts: lgpGXT4Dual.setStatus('current') lgpEXL = ObjectIdentity((1, 3, 6, 1, 4, 1, 476, 1, 42, 4, 2, 25)) if mibBuilder.loadTexts: lgpEXL.setStatus('current') lgpEXM = ObjectIdentity((1, 3, 6, 1, 4, 1, 476, 1, 42, 4, 2, 26)) if mibBuilder.loadTexts: lgpEXM.setStatus('current') lgpEXM208v = ObjectIdentity((1, 3, 6, 1, 4, 1, 476, 1, 42, 4, 2, 26, 1)) if mibBuilder.loadTexts: lgpEXM208v.setStatus('current') lgpEXM400v = ObjectIdentity((1, 3, 6, 1, 4, 1, 476, 1, 42, 4, 2, 26, 2)) if mibBuilder.loadTexts: lgpEXM400v.setStatus('current') lgpEXM480v = ObjectIdentity((1, 3, 6, 1, 4, 1, 476, 1, 42, 4, 2, 26, 3)) if mibBuilder.loadTexts: lgpEXM480v.setStatus('current') lgpEPM = ObjectIdentity((1, 3, 6, 1, 4, 1, 476, 1, 42, 4, 2, 27)) if mibBuilder.loadTexts: lgpEPM.setStatus('current') lgpEPM300k = ObjectIdentity((1, 3, 6, 1, 4, 1, 476, 1, 42, 4, 2, 27, 1)) if mibBuilder.loadTexts: lgpEPM300k.setStatus('current') lgpEPM400k = ObjectIdentity((1, 3, 6, 1, 4, 1, 476, 1, 42, 4, 2, 27, 2)) if mibBuilder.loadTexts: lgpEPM400k.setStatus('current') lgpEPM500k = ObjectIdentity((1, 3, 6, 1, 4, 1, 476, 1, 42, 4, 2, 27, 3)) if mibBuilder.loadTexts: lgpEPM500k.setStatus('current') lgpEPM600k = ObjectIdentity((1, 3, 6, 1, 4, 1, 476, 1, 42, 4, 2, 27, 4)) if mibBuilder.loadTexts: lgpEPM600k.setStatus('current') lgpEPM800k = ObjectIdentity((1, 3, 6, 1, 4, 1, 476, 1, 42, 4, 2, 27, 5)) if mibBuilder.loadTexts: lgpEPM800k.setStatus('current') lgpEXMMSR = ObjectIdentity((1, 3, 6, 1, 4, 1, 476, 1, 42, 4, 2, 29)) if mibBuilder.loadTexts: lgpEXMMSR.setStatus('current') lgpNXLJD = ObjectIdentity((1, 3, 6, 1, 4, 1, 476, 1, 42, 4, 2, 10, 1)) if mibBuilder.loadTexts: lgpNXLJD.setStatus('current') lgpNX225to600k = ObjectIdentity((1, 3, 6, 1, 4, 1, 476, 1, 42, 4, 2, 22, 1)) if mibBuilder.loadTexts: lgpNX225to600k.setStatus('current') lgpAdvancedMicroprocessor = ObjectIdentity((1, 3, 6, 1, 4, 1, 476, 1, 42, 4, 3, 1)) if mibBuilder.loadTexts: lgpAdvancedMicroprocessor.setStatus('current') lgpStandardMicroprocessor = ObjectIdentity((1, 3, 6, 1, 4, 1, 476, 1, 42, 4, 3, 2)) if mibBuilder.loadTexts: lgpStandardMicroprocessor.setStatus('current') lgpMiniMate2 = ObjectIdentity((1, 3, 6, 1, 4, 1, 476, 1, 42, 4, 3, 3)) if mibBuilder.loadTexts: lgpMiniMate2.setStatus('current') lgpHimod = ObjectIdentity((1, 3, 6, 1, 4, 1, 476, 1, 42, 4, 3, 4)) if mibBuilder.loadTexts: lgpHimod.setStatus('current') lgpCEMS100orLECS15 = ObjectIdentity((1, 3, 6, 1, 4, 1, 476, 1, 42, 4, 3, 5)) if mibBuilder.loadTexts: lgpCEMS100orLECS15.setStatus('current') lgpIcom = ObjectIdentity((1, 3, 6, 1, 4, 1, 476, 1, 42, 4, 3, 6)) if mibBuilder.loadTexts: lgpIcom.setStatus('current') lgpIcomPA = ObjectIdentity((1, 3, 6, 1, 4, 1, 476, 1, 42, 4, 3, 7)) if mibBuilder.loadTexts: lgpIcomPA.setStatus('current') lgpIcomXD = ObjectIdentity((1, 3, 6, 1, 4, 1, 476, 1, 42, 4, 3, 8)) if mibBuilder.loadTexts: lgpIcomXD.setStatus('current') lgpIcomXP = ObjectIdentity((1, 3, 6, 1, 4, 1, 476, 1, 42, 4, 3, 9)) if mibBuilder.loadTexts: lgpIcomXP.setStatus('current') lgpIcomSC = ObjectIdentity((1, 3, 6, 1, 4, 1, 476, 1, 42, 4, 3, 10)) if mibBuilder.loadTexts: lgpIcomSC.setStatus('current') lgpIcomCR = ObjectIdentity((1, 3, 6, 1, 4, 1, 476, 1, 42, 4, 3, 11)) if mibBuilder.loadTexts: lgpIcomCR.setStatus('current') lgpIcomAH = ObjectIdentity((1, 3, 6, 1, 4, 1, 476, 1, 42, 4, 3, 12)) if mibBuilder.loadTexts: lgpIcomAH.setStatus('current') lgpIcomDCL = ObjectIdentity((1, 3, 6, 1, 4, 1, 476, 1, 42, 4, 3, 13)) if mibBuilder.loadTexts: lgpIcomDCL.setStatus('current') lgpIcomEEV = ObjectIdentity((1, 3, 6, 1, 4, 1, 476, 1, 42, 4, 3, 14)) if mibBuilder.loadTexts: lgpIcomEEV.setStatus('current') lgpIcomPAtypeDS = ObjectIdentity((1, 3, 6, 1, 4, 1, 476, 1, 42, 4, 3, 7, 1)) if mibBuilder.loadTexts: lgpIcomPAtypeDS.setStatus('current') lgpIcomPAtypeHPM = ObjectIdentity((1, 3, 6, 1, 4, 1, 476, 1, 42, 4, 3, 7, 2)) if mibBuilder.loadTexts: lgpIcomPAtypeHPM.setStatus('current') lgpIcomPAtypeChallenger = ObjectIdentity((1, 3, 6, 1, 4, 1, 476, 1, 42, 4, 3, 7, 3)) if mibBuilder.loadTexts: lgpIcomPAtypeChallenger.setStatus('current') lgpIcomPAtypePeX = ObjectIdentity((1, 3, 6, 1, 4, 1, 476, 1, 42, 4, 3, 7, 4)) if mibBuilder.loadTexts: lgpIcomPAtypePeX.setStatus('current') lgpIcomPAtypeDeluxeSys3 = ObjectIdentity((1, 3, 6, 1, 4, 1, 476, 1, 42, 4, 3, 7, 5)) if mibBuilder.loadTexts: lgpIcomPAtypeDeluxeSys3.setStatus('current') lgpIcomPAtypeDeluxeSystem3 = ObjectIdentity((1, 3, 6, 1, 4, 1, 476, 1, 42, 4, 3, 7, 5, 1)) if mibBuilder.loadTexts: lgpIcomPAtypeDeluxeSystem3.setStatus('current') lgpIcomPAtypeCW = ObjectIdentity((1, 3, 6, 1, 4, 1, 476, 1, 42, 4, 3, 7, 5, 2)) if mibBuilder.loadTexts: lgpIcomPAtypeCW.setStatus('current') lgpIcomPAtypeJumboCW = ObjectIdentity((1, 3, 6, 1, 4, 1, 476, 1, 42, 4, 3, 7, 6)) if mibBuilder.loadTexts: lgpIcomPAtypeJumboCW.setStatus('current') lgpIcomPAtypeDSE = ObjectIdentity((1, 3, 6, 1, 4, 1, 476, 1, 42, 4, 3, 7, 7)) if mibBuilder.loadTexts: lgpIcomPAtypeDSE.setStatus('current') lgpIcomPAtypePEXS = ObjectIdentity((1, 3, 6, 1, 4, 1, 476, 1, 42, 4, 3, 7, 8)) if mibBuilder.loadTexts: lgpIcomPAtypePEXS.setStatus('current') lgpIcomPAtypePDXsmall = ObjectIdentity((1, 3, 6, 1, 4, 1, 476, 1, 42, 4, 3, 7, 8, 1)) if mibBuilder.loadTexts: lgpIcomPAtypePDXsmall.setStatus('current') lgpIcomPAtypePCWsmall = ObjectIdentity((1, 3, 6, 1, 4, 1, 476, 1, 42, 4, 3, 7, 8, 2)) if mibBuilder.loadTexts: lgpIcomPAtypePCWsmall.setStatus('current') lgpIcomPAtypePDX = ObjectIdentity((1, 3, 6, 1, 4, 1, 476, 1, 42, 4, 3, 7, 9)) if mibBuilder.loadTexts: lgpIcomPAtypePDX.setStatus('current') lgpIcomPAtypePDXlarge = ObjectIdentity((1, 3, 6, 1, 4, 1, 476, 1, 42, 4, 3, 7, 9, 1)) if mibBuilder.loadTexts: lgpIcomPAtypePDXlarge.setStatus('current') lgpIcomPAtypePCWlarge = ObjectIdentity((1, 3, 6, 1, 4, 1, 476, 1, 42, 4, 3, 7, 9, 2)) if mibBuilder.loadTexts: lgpIcomPAtypePCWlarge.setStatus('current') lgpIcomPAtypeHPS = ObjectIdentity((1, 3, 6, 1, 4, 1, 476, 1, 42, 4, 3, 7, 10)) if mibBuilder.loadTexts: lgpIcomPAtypeHPS.setStatus('current') lgpIcomXDtypeXDF = ObjectIdentity((1, 3, 6, 1, 4, 1, 476, 1, 42, 4, 3, 8, 1)) if mibBuilder.loadTexts: lgpIcomXDtypeXDF.setStatus('current') lgpIcomXDtypeXDFN = ObjectIdentity((1, 3, 6, 1, 4, 1, 476, 1, 42, 4, 3, 8, 2)) if mibBuilder.loadTexts: lgpIcomXDtypeXDFN.setStatus('current') lgpIcomXPtypeXDP = ObjectIdentity((1, 3, 6, 1, 4, 1, 476, 1, 42, 4, 3, 9, 1)) if mibBuilder.loadTexts: lgpIcomXPtypeXDP.setStatus('current') lgpIcomXPtypeXDPCray = ObjectIdentity((1, 3, 6, 1, 4, 1, 476, 1, 42, 4, 3, 9, 1, 1)) if mibBuilder.loadTexts: lgpIcomXPtypeXDPCray.setStatus('current') lgpIcomXPtypeXDC = ObjectIdentity((1, 3, 6, 1, 4, 1, 476, 1, 42, 4, 3, 9, 2)) if mibBuilder.loadTexts: lgpIcomXPtypeXDC.setStatus('current') lgpIcomXPtypeXDPW = ObjectIdentity((1, 3, 6, 1, 4, 1, 476, 1, 42, 4, 3, 9, 3)) if mibBuilder.loadTexts: lgpIcomXPtypeXDPW.setStatus('current') lgpIcomSCtypeHPC = ObjectIdentity((1, 3, 6, 1, 4, 1, 476, 1, 42, 4, 3, 10, 1)) if mibBuilder.loadTexts: lgpIcomSCtypeHPC.setStatus('current') lgpIcomSCtypeHPCSSmall = ObjectIdentity((1, 3, 6, 1, 4, 1, 476, 1, 42, 4, 3, 10, 1, 1)) if mibBuilder.loadTexts: lgpIcomSCtypeHPCSSmall.setStatus('current') lgpIcomSCtypeHPCSLarge = ObjectIdentity((1, 3, 6, 1, 4, 1, 476, 1, 42, 4, 3, 10, 1, 2)) if mibBuilder.loadTexts: lgpIcomSCtypeHPCSLarge.setStatus('current') lgpIcomSCtypeHPCR = ObjectIdentity((1, 3, 6, 1, 4, 1, 476, 1, 42, 4, 3, 10, 1, 3)) if mibBuilder.loadTexts: lgpIcomSCtypeHPCR.setStatus('current') lgpIcomSCtypeHPCM = ObjectIdentity((1, 3, 6, 1, 4, 1, 476, 1, 42, 4, 3, 10, 1, 4)) if mibBuilder.loadTexts: lgpIcomSCtypeHPCM.setStatus('current') lgpIcomSCtypeHPCL = ObjectIdentity((1, 3, 6, 1, 4, 1, 476, 1, 42, 4, 3, 10, 1, 5)) if mibBuilder.loadTexts: lgpIcomSCtypeHPCL.setStatus('current') lgpIcomSCtypeHPCW = ObjectIdentity((1, 3, 6, 1, 4, 1, 476, 1, 42, 4, 3, 10, 1, 6)) if mibBuilder.loadTexts: lgpIcomSCtypeHPCW.setStatus('current') lgpIcomCRtypeCRV = ObjectIdentity((1, 3, 6, 1, 4, 1, 476, 1, 42, 4, 3, 11, 1)) if mibBuilder.loadTexts: lgpIcomCRtypeCRV.setStatus('current') lgpIcomAHStandard = ObjectIdentity((1, 3, 6, 1, 4, 1, 476, 1, 42, 4, 3, 12, 1)) if mibBuilder.loadTexts: lgpIcomAHStandard.setStatus('current') lgpPMP = ObjectIdentity((1, 3, 6, 1, 4, 1, 476, 1, 42, 4, 4, 1)) if mibBuilder.loadTexts: lgpPMP.setStatus('current') lgpEPMP = ObjectIdentity((1, 3, 6, 1, 4, 1, 476, 1, 42, 4, 4, 2)) if mibBuilder.loadTexts: lgpEPMP.setStatus('current') lgpStaticTransferSwitchEDS = ObjectIdentity((1, 3, 6, 1, 4, 1, 476, 1, 42, 4, 5, 1)) if mibBuilder.loadTexts: lgpStaticTransferSwitchEDS.setStatus('current') lgpStaticTransferSwitch1 = ObjectIdentity((1, 3, 6, 1, 4, 1, 476, 1, 42, 4, 5, 2)) if mibBuilder.loadTexts: lgpStaticTransferSwitch1.setStatus('current') lgpStaticTransferSwitch2 = ObjectIdentity((1, 3, 6, 1, 4, 1, 476, 1, 42, 4, 5, 3)) if mibBuilder.loadTexts: lgpStaticTransferSwitch2.setStatus('current') lgpStaticTransferSwitch2FourPole = ObjectIdentity((1, 3, 6, 1, 4, 1, 476, 1, 42, 4, 5, 4)) if mibBuilder.loadTexts: lgpStaticTransferSwitch2FourPole.setStatus('current') lgpMultiLinkBasicNotification = ObjectIdentity((1, 3, 6, 1, 4, 1, 476, 1, 42, 4, 7, 1)) if mibBuilder.loadTexts: lgpMultiLinkBasicNotification.setStatus('current') lgpRackPDU = ObjectIdentity((1, 3, 6, 1, 4, 1, 476, 1, 42, 4, 8, 2)) if mibBuilder.loadTexts: lgpRackPDU.setStatus('current') lgpMPX = ObjectIdentity((1, 3, 6, 1, 4, 1, 476, 1, 42, 4, 8, 2, 1)) if mibBuilder.loadTexts: lgpMPX.setStatus('current') lgpMPH = ObjectIdentity((1, 3, 6, 1, 4, 1, 476, 1, 42, 4, 8, 2, 2)) if mibBuilder.loadTexts: lgpMPH.setStatus('current') lgpRackPDU2 = ObjectIdentity((1, 3, 6, 1, 4, 1, 476, 1, 42, 4, 8, 4)) if mibBuilder.loadTexts: lgpRackPDU2.setStatus('current') lgpRPC2kMPX = ObjectIdentity((1, 3, 6, 1, 4, 1, 476, 1, 42, 4, 8, 4, 1)) if mibBuilder.loadTexts: lgpRPC2kMPX.setStatus('current') lgpRPC2kMPH = ObjectIdentity((1, 3, 6, 1, 4, 1, 476, 1, 42, 4, 8, 4, 2)) if mibBuilder.loadTexts: lgpRPC2kMPH.setStatus('current') lgpPMPandLDMF = ObjectIdentity((1, 3, 6, 1, 4, 1, 476, 1, 42, 4, 10, 1)) if mibBuilder.loadTexts: lgpPMPandLDMF.setStatus('current') lgpPMPgeneric = ObjectIdentity((1, 3, 6, 1, 4, 1, 476, 1, 42, 4, 10, 1, 1)) if mibBuilder.loadTexts: lgpPMPgeneric.setStatus('current') lgpPMPonFPC = ObjectIdentity((1, 3, 6, 1, 4, 1, 476, 1, 42, 4, 10, 1, 2)) if mibBuilder.loadTexts: lgpPMPonFPC.setStatus('current') lgpPMPonPPC = ObjectIdentity((1, 3, 6, 1, 4, 1, 476, 1, 42, 4, 10, 1, 3)) if mibBuilder.loadTexts: lgpPMPonPPC.setStatus('current') lgpPMPonFDC = ObjectIdentity((1, 3, 6, 1, 4, 1, 476, 1, 42, 4, 10, 1, 4)) if mibBuilder.loadTexts: lgpPMPonFDC.setStatus('current') lgpPMPonRDC = ObjectIdentity((1, 3, 6, 1, 4, 1, 476, 1, 42, 4, 10, 1, 5)) if mibBuilder.loadTexts: lgpPMPonRDC.setStatus('current') lgpPMPonEXC = ObjectIdentity((1, 3, 6, 1, 4, 1, 476, 1, 42, 4, 10, 1, 6)) if mibBuilder.loadTexts: lgpPMPonEXC.setStatus('current') lgpPMPonSTS2 = ObjectIdentity((1, 3, 6, 1, 4, 1, 476, 1, 42, 4, 10, 1, 7)) if mibBuilder.loadTexts: lgpPMPonSTS2.setStatus('current') lgpPMPonSTS2PDU = ObjectIdentity((1, 3, 6, 1, 4, 1, 476, 1, 42, 4, 10, 1, 8)) if mibBuilder.loadTexts: lgpPMPonSTS2PDU.setStatus('current') mibBuilder.exportSymbols("LIEBERT-GP-REGISTRATION-MIB", emerson=emerson, lgpAgentNotifications=lgpAgentNotifications, lgpIcomXD=lgpIcomXD, lgpEXMMSR=lgpEXMMSR, liebertCorp=liebertCorp, lgpRackPDU=lgpRackPDU, lgpRackPDU2=lgpRackPDU2, lgpStaticTransferSwitch2FourPole=lgpStaticTransferSwitch2FourPole, lgpAgentIdent=lgpAgentIdent, lgpNX=lgpNX, lgpAcProducts=lgpAcProducts, lgpNX225to600k=lgpNX225to600k, lgpPowerDistributionProducts=lgpPowerDistributionProducts, lgpGXT3Dual=lgpGXT3Dual, lgpPMPonSTS2=lgpPMPonSTS2, lgpEPMP=lgpEPMP, lgpIcomXPtypeXDC=lgpIcomXPtypeXDC, lgpNfinity=lgpNfinity, lgpRPC2kMPX=lgpRPC2kMPX, lgpPMP=lgpPMP, lgpPMPonFDC=lgpPMPonFDC, lgpGXT4Dual=lgpGXT4Dual, lgpIcomPAtypeHPS=lgpIcomPAtypeHPS, lgpIcomCRtypeCRV=lgpIcomCRtypeCRV, lgpSystem=lgpSystem, lgpIcomPAtypePDXsmall=lgpIcomPAtypePDXsmall, lgpGXT3=lgpGXT3, lgpEXM480v=lgpEXM480v, lgpEnvironmental=lgpEnvironmental, lgpIcomSCtypeHPC=lgpIcomSCtypeHPC, lgpStaticTransferSwitchEDS=lgpStaticTransferSwitchEDS, lgpCombinedSystemProducts=lgpCombinedSystemProducts, lgpIcomPAtypeDS=lgpIcomPAtypeDS, lgpMUNiMx=lgpMUNiMx, lgpNpower=lgpNpower, lgpPMPonFPC=lgpPMPonFPC, lgpIcomPAtypePeX=lgpIcomPAtypePeX, lgpPowerSureInteractive2=lgpPowerSureInteractive2, lgpStaticTransferSwitch2=lgpStaticTransferSwitch2, lgpUPStationGXT=lgpUPStationGXT, lgpITA=lgpITA, lgpIcomXPtypeXDPCray=lgpIcomXPtypeXDPCray, lgpPdu=lgpPdu, PYSNMP_MODULE_ID=liebertGlobalProductsRegistrationModule, lgpController=lgpController, lgpTransferSwitchProducts=lgpTransferSwitchProducts, lgpIcomSC=lgpIcomSC, lgpEPM600k=lgpEPM600k, lgpCEMS100orLECS15=lgpCEMS100orLECS15, lgpIcomSCtypeHPCSSmall=lgpIcomSCtypeHPCSSmall, lgpNXRb=lgpNXRb, lgpIcomPAtypeDeluxeSystem3=lgpIcomPAtypeDeluxeSystem3, lgpFoundation=lgpFoundation, liebertFlexibleConditionsModuleReg=liebertFlexibleConditionsModuleReg, lgpIcomSCtypeHPCL=lgpIcomSCtypeHPCL, lgpIcomSCtypeHPCM=lgpIcomSCtypeHPCM, lgpIcomSCtypeHPCW=lgpIcomSCtypeHPCW, lgpPMPonSTS2PDU=lgpPMPonSTS2PDU, lgpIcomPAtypeDeluxeSys3=lgpIcomPAtypeDeluxeSys3, lgpIcomPA=lgpIcomPA, liebertFlexibleModuleReg=liebertFlexibleModuleReg, liebertControllerModuleReg=liebertControllerModuleReg, lgpAPS=lgpAPS, lgpIcomAHStandard=lgpIcomAHStandard, lgpIcomPAtypePDXlarge=lgpIcomPAtypePDXlarge, lgpEXM=lgpEXM, lgpMultiLinkBasicNotification=lgpMultiLinkBasicNotification, lgpPMPgeneric=lgpPMPgeneric, lgpPMPonRDC=lgpPMPonRDC, liebertGlobalProductsRegistrationModule=liebertGlobalProductsRegistrationModule, lgpSeries610MMU=lgpSeries610MMU, lgpIcomSCtypeHPCSLarge=lgpIcomSCtypeHPCSLarge, lgpMPX=lgpMPX, lgpIcomCR=lgpIcomCR, lgpNXC=lgpNXC, liebertPowerModuleReg=liebertPowerModuleReg, lgpStandardMicroprocessor=lgpStandardMicroprocessor, lgpEPM300k=lgpEPM300k, lgpNXLJD=lgpNXLJD, lgpIcomXPtypeXDPW=lgpIcomXPtypeXDPW, lgpFlexible=lgpFlexible, lgpGXT4=lgpGXT4, lgpGXT2Dual=lgpGXT2Dual, liebertPduModuleReg=liebertPduModuleReg, lgpEPM400k=lgpEPM400k, lgpIcomPAtypeJumboCW=lgpIcomPAtypeJumboCW, lgpPMPonEXC=lgpPMPonEXC, liebertAgentModuleReg=liebertAgentModuleReg, lgpRPC2kMPH=lgpRPC2kMPH, lgpNXL=lgpNXL, lgpSeries300=lgpSeries300, lgpConditions=lgpConditions, lgpIcomPAtypeDSE=lgpIcomPAtypeDSE, lgpMPH=lgpMPH, liebertNotificationsModuleReg=liebertNotificationsModuleReg, lgpSeries610SCC=lgpSeries610SCC, lgpIcomPAtypePCWlarge=lgpIcomPAtypePCWlarge, lgpIcomPAtypePDX=lgpIcomPAtypePDX, lgpHiNet=lgpHiNet, lgpAgent=lgpAgent, lgpPowerSureInteractive=lgpPowerSureInteractive, lgpSuper400=lgpSuper400, lgpAgentControl=lgpAgentControl, lgpSeries600or610=lgpSeries600or610, lgpIcomXDtypeXDF=lgpIcomXDtypeXDF, lgpModuleReg=lgpModuleReg, lgpSeries610SMS=lgpSeries610SMS, lgpIcomSCtypeHPCR=lgpIcomSCtypeHPCR, lgpEXL=lgpEXL, lgpAdvancedMicroprocessor=lgpAdvancedMicroprocessor, lgpIcomAH=lgpIcomAH, lgpIcomXP=lgpIcomXP, liebertSystemModuleReg=liebertSystemModuleReg, lgpIcomPAtypePEXS=lgpIcomPAtypePEXS, lgpEXM208v=lgpEXM208v, lgpEXM400v=lgpEXM400v, lgpEPM500k=lgpEPM500k, lgpPMPonPPC=lgpPMPonPPC, lgpEPM=lgpEPM, lgpIcomPAtypePCWsmall=lgpIcomPAtypePCWsmall, lgpIcom=lgpIcom, lgpIcomPAtypeHPM=lgpIcomPAtypeHPM, lgpUpsProducts=lgpUpsProducts, lgpStaticTransferSwitch1=lgpStaticTransferSwitch1, lgpMiniMate2=lgpMiniMate2, lgpProductSpecific=lgpProductSpecific, lgpNXC30to40k=lgpNXC30to40k, lgpPower=lgpPower, lgpIcomPAtypeCW=lgpIcomPAtypeCW, lgpSeries7200=lgpSeries7200, lgpIcomEEV=lgpIcomEEV, liebertModuleReg=liebertModuleReg, lgpMultiLinkProducts=lgpMultiLinkProducts, lgpPMPandLDMF=lgpPMPandLDMF, lgpNotifications=lgpNotifications, liebertGlobalProducts=liebertGlobalProducts, lgpNXr=lgpNXr, lgpIcomXDtypeXDFN=lgpIcomXDtypeXDFN, lgpIcomXPtypeXDP=lgpIcomXPtypeXDP, lgpAgentDevice=lgpAgentDevice, lgpIcomDCL=lgpIcomDCL, liebertConditionsModuleReg=liebertConditionsModuleReg, lgpITA30to40k=lgpITA30to40k, lgpIcomPAtypeChallenger=lgpIcomPAtypeChallenger, lgpPowerConditioningProducts=lgpPowerConditioningProducts, lgpHimod=lgpHimod, lgpEPM800k=lgpEPM800k, liebertEnvironmentalModuleReg=liebertEnvironmentalModuleReg)
class BadRequest(Exception): pass class ParamError(BadRequest): pass class Unauthorized(Exception): pass class Forbidden(Exception): pass class NotFound(Exception): pass class IDNotFoundError(NotFound): pass class Conflict(Exception): pass class ParamConflict(Conflict): pass class PreconditionFail(Exception): pass class OauthUnauthorized(Exception): pass class OauthBadRequest(Exception): pass
# Copyright (c) 2017 Mark D. Hill and David A. Wood # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are # met: redistributions of source code must retain the above copyright # notice, this list of conditions and the following disclaimer; # redistributions in binary form must reproduce the above copyright # notice, this list of conditions and the following disclaimer in the # documentation and/or other materials provided with the distribution; # neither the name of the copyright holders nor the names of its # contributors may be used to endorse or promote products derived from # this software without specific prior written permission. # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR # A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT # OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. # # Authors: Sean Wilson class Result: enums = ''' NotRun Skipped Passed Failed Errored '''.split() for idx, enum in enumerate(enums): locals()[enum] = idx @classmethod def name(cls, enum): return cls.enums[enum] def __init__(self, value, reason=None): self.value = value self.reason = reason def __str__(self): return self.name(self.value) class Status: enums = ''' Unscheduled Building Running TearingDown Complete Avoided '''.split() for idx, enum in enumerate(enums): locals()[enum] = idx @classmethod def name(cls, enum): return cls.enums[enum]
a= "goat" def animal(): global a b = "pakka" a = a * 6 print(a) print(b) animal()
def selection_sort(alist): for i in range(0, len(alist) - 1): smallest = i for j in range(i + 1, len(alist)): if alist[j] < alist[smallest]: smallest = j alist[i], alist[smallest] = alist[smallest], alist[i] alist = input('Enter the list of numbers: ').split() alist = [int(x) for x in alist] selection_sort(alist) print('Sorted list: ', end='') print(alist)
# Idenpotant # Closure def outer_function(tag): pass def add(x, y): return x + y def deco(orig_func): def wrapper(*args, **kwargs): print("That is to know that I ran the deco func") return orig_func(*args, **kwargs) return wrapper add = deco(add) print(add(3, 5))
skills = [ { "id" : "0001", "name" : "Liver of Steel", "type" : "Passive", "isPermable" : False, "effects" : { "maximumInebriety" : "+5", }, }, { "id" : "0002", "name" : "Chronic Indigestion", "type" : "Combat", "mpCost" : 5, }, { "id" : "0003", "name" : "The Smile of Mr. A.", "type" : "Buff", "mpCost" : 5, "isPermable" : False, }, { "id" : "0004", "name" : "Arse Shoot", "type" : "Buff", "mpCost" : 5, "isPermable" : False, }, { "id" : "0005", "name" : "Stomach of Steel", "type" : "Passive", "isPermable" : False, "effects" : { "maximumFullness" : "+5", }, }, { "id" : "0006", "name" : "Spleen of Steel", "type" : "Passive", "isPermable" : False, "effects" : { "maximumSpleen" : "+5", }, }, { "id" : "0010", "name" : "Powers of Observatiogn", "type" : "Passive", "effects" : { "itemDrop" : "+10%", }, }, { "id" : "0011", "name" : "Gnefarious Pickpocketing", "type" : "Passive", "effects" : { "meatDrop" : "+10%", }, }, { "id" : "0012", "name" : "Torso Awaregness", "type" : "Passive", }, { "id" : "0013", "name" : "Gnomish Hardigness", "type" : "Passive", "effects" : { "maximumHP" : "+5%", }, }, { "id" : "0014", "name" : "Cosmic Ugnderstanding", "type" : "Passive", "effects" : { "maximumMP" : "+5%", }, }, { "id" : "0015", "name" : "CLEESH", "type" : "Combat", "mpCost" : 10, }, { "id" : "0019", "name" : "Transcendent Olfaction", "type" : "Combat", "mpCost" : 40, "isAutomaticallyPermed" : True, }, { "id" : "0020", "name" : "Really Expensive Jewelrycrafting", "type" : "Passive", "isPermable" : False, }, { "id" : "0021", "name" : "Lust", "type" : "Passive", "isPermable" : False, "effects" : { "combatInitiative" : "+50%", "spellDamage" : "-5", "meleeDamage" : "-5", }, }, { "id" : "0022", "name" : "Gluttony", "type" : "Passive", "isPermable" : False, "effects" : { "strengthensFood" : True, "statsPerFight" : "-2", }, }, { "id" : "0023", "name" : "Greed", "type" : "Passive", "isPermable" : False, "effects" : { "meatDrop" : "+50%", "itemDrop" : "-15%", }, }, { "id" : "0024", "name" : "Sloth", "type" : "Passive", "isPermable" : False, "effects" : { "damageReduction" : "+8", "combatInitiative" : "-25%", }, }, { "id" : "0025", "name" : "Wrath", "type" : "Passive", "isPermable" : False, "effects" : { "spellDamage" : "+10", "meleeDamage" : "+10", "damageReduction" : "-4", }, }, { "id" : "0026", "name" : "Envy", "type" : "Passive", "isPermable" : False, "effects" : { "itemDrop" : "+30%", "meatDrop" : "-25%", }, }, { "id" : "0027", "name" : "Pride", "type" : "Passive", "isPermable" : False, "effects" : { "statsPerFight" : "+4", "weakensFood" : True, }, }, { "id" : "0028", "name" : "Awesome Balls of Fire", "type" : "Combat", "mpCost" : 120, }, { "id" : "0029", "name" : "Conjure Relaxing Campfire", "type" : "Combat", "mpCost" : 30, }, { "id" : "0030", "name" : "Snowclone", "type" : "Combat", "mpCost" : 120, }, { "id" : "0031", "name" : "Maximum Chill", "type" : "Combat", "mpCost" : 30, }, { "id" : "0032", "name" : "Eggsplosion", "type" : "Combat", "mpCost" : 120, }, { "id" : "0033", "name" : "Mudbath", "type" : "Combat", "mpCost" : 30, }, { "id" : "0036", "name" : "Grease Lightning", "type" : "Combat", "mpCost" : 120, }, { "id" : "0037", "name" : "Inappropriate Backrub", "type" : "Combat", "mpCost" : 30, }, { "id" : "0038", "name" : "Natural Born Scrabbler", "type" : "Passive", "effects" : { "itemDrop" : "+5%", }, }, { "id" : "0039", "name" : "Thrift and Grift", "type" : "Passive", "effects" : { "meatDrop" : "+10%", }, }, { "id" : "0040", "name" : "Abs of Tin", "type" : "Passive", "effects" : { "maximumHP" : "+10%", }, }, { "id" : "0041", "name" : "Marginally Insane", "type" : "Passive", "effects" : { "maximumMP" : "+10%", }, }, { "id" : "0042", "name" : "Raise Backup Dancer", "type" : "Combat", "mpCost" : 120, }, { "id" : "0043", "name" : "Creepy Lullaby", "type" : "Combat", "mpCost" : 30, }, { "id" : "0044", "name" : "Rainbow Gravitation", "type" : "Noncombat", "mpCost" : 30, }, { "id" : "1000", "name" : "Seal Clubbing Frenzy", "type" : "Noncombat", "mpCost" : 1, }, { "id" : "1003", "name" : "Thrust-Smack", "type" : "Combat", "mpCost" : 3, }, { "id" : "1004", "name" : "Lunge-Smack", "type" : "Combat", "mpCost" : 5, }, { "id" : "1005", "name" : "Lunging Thrust-Smack", "type" : "Combat", "mpCost" : 8, }, { "id" : "1006", "name" : "Super-Advanced Meatsmithing", "type" : "Passive", }, { "id" : "1007", "name" : "Tongue of the Otter", "type" : "Noncombat", "mpCost" : 7, }, { "id" : "1008", "name" : "Hide of the Otter", "type" : "Passive", }, { "id" : "1009", "name" : "Claws of the Otter", "type" : "Passive", }, { "id" : "1010", "name" : "Tongue of the Walrus", "type" : "Noncombat", "mpCost" : 10, }, { "id" : "1011", "name" : "Hide of the Walrus", "type" : "Passive", }, { "id" : "1012", "name" : "Claws of the Walrus", "type" : "Passive", }, { "id" : "1014", "name" : "Eye of the Stoat", "type" : "Passive", }, { "id" : "1015", "name" : "Rage of the Reindeer", "type" : "Noncombat", "mpCost" : 10, }, { "id" : "1016", "name" : "Pulverize", "type" : "Passive", }, { "id" : "1017", "name" : "Double-Fisted Skull Smashing", "type" : "Passive", }, { "id" : "1018", "name" : "Northern Exposure", "type" : "Passive", }, { "id" : "1019", "name" : "Musk of the Moose", "type" : "Noncombat", "mpCost" : 10, }, { "id" : "1020", "name" : "Snarl of the Timberwolf", "type" : "Noncombat", "mpCost" : 10, }, { "id" : "2000", "name" : "Patience of the Tortoise", "type" : "Noncombat", "mpCost" : 1, }, { "id" : "2003", "name" : "Headbutt", "type" : "Combat", "mpCost" : 3, }, { "id" : "2004", "name" : "Skin of the Leatherback", "type" : "Passive", }, { "id" : "2005", "name" : "Shieldbutt", "type" : "Combat", "mpCost" : 5, }, { "id" : "2006", "name" : "Armorcraftiness", "type" : "Passive", }, { "id" : "2007", "name" : "Ghostly Shell", "type" : "Buff", "mpCost" : 6, }, { "id" : "2008", "name" : "Reptilian Fortitude", "type" : "Buff", "mpCost" : 10, }, { "id" : "2009", "name" : "Empathy of the Newt", "type" : "Buff", "mpCost" : 15, }, { "id" : "2010", "name" : "Tenacity of the Snapper", "type" : "Buff", "mpCost" : 8, }, { "id" : "2011", "name" : "Wisdom of the Elder Tortoises", "type" : "Passive", }, { "id" : "2012", "name" : "Astral Shell", "type" : "Buff", "mpCost" : 10, }, { "id" : "2014", "name" : "Amphibian Sympathy", "type" : "Passive", }, { "id" : "2015", "name" : "Kneebutt", "type" : "Combat", "mpCost" : 4, }, { "id" : "2016", "name" : "Cold-Blooded Fearlessness", "type" : "Passive", }, { "id" : "2020", "name" : "Hero of the Half-Shell", "type" : "Passive", }, { "id" : "2021", "name" : "Tao of the Terrapin", "type" : "Passive", }, { "id" : "2022", "name" : "Spectral Snapper", "type" : "Combat", "mpCost" : 20, }, { "id" : "2103", "name" : "Head + Knee Combo", "type" : "Combat", "mpCost" : 8, }, { "id" : "2105", "name" : "Head + Shield Combo", "type" : "Combat", "mpCost" : 9, }, { "id" : "2106", "name" : "Knee + Shield Combo", "type" : "Combat", "mpCost" : 10, }, { "id" : "2107", "name" : "Head + Knee + Shield Combo", "type" : "Combat", "mpCost" : 13, }, { "id" : "3000", "name" : "Manicotti Meditation", "type" : "Noncombat", "mpCost" : 1, }, { "id" : "3003", "name" : "Ravioli Shurikens", "type" : "Combat", "mpCost" : 4, }, { "id" : "3004", "name" : "Entangling Noodles", "type" : "Combat", "mpCost" : 3, }, { "id" : "3005", "name" : "Cannelloni Cannon", "type" : "Combat", "mpCost" : 7, }, { "id" : "3006", "name" : "Pastamastery", "type" : "Noncombat", "mpCost" : 10, }, { "id" : "3007", "name" : "Stuffed Mortar Shell", "type" : "Combat", "mpCost" : 19, }, { "id" : "3008", "name" : "Weapon of the Pastalord", "type" : "Combat", "mpCost" : 35, }, { "id" : "3009", "name" : "Lasagna Bandages", "type" : "Combat / Noncombat", "mpCost" : 6, }, { "id" : "3010", "name" : "Leash of Linguini", "type" : "Noncombat", "mpCost" : 12, }, { "id" : "3011", "name" : "Spirit of Rigatoni", "type" : "Passive", }, { "id" : "3012", "name" : "Cannelloni Cocoon", "type" : "Noncombat", "mpCost" : 20, }, { "id" : "3014", "name" : "Spirit of Ravioli", "type" : "Passive", }, { "id" : "3015", "name" : "Springy Fusilli", "type" : "Noncombat", "mpCost" : 10, }, { "id" : "3016", "name" : "Tolerance of the Kitchen", "type" : "Passive", }, { "id" : "3017", "name" : "Flavour of Magic", "type" : "Noncombat", "mpCost" : 10, }, { "id" : "3018", "name" : "Transcendental Noodlecraft", "type" : "Passive", }, { "id" : "3019", "name" : "Fearful Fettucini", "type" : "Combat", "mpCost" : 35, }, { "id" : "3020", "name" : "Spaghetti Spear", "type" : "Combat", "mpCost" : 1, }, { "id" : "3101", "name" : "Spirit of Cayenne", "type" : "Noncombat", "mpCost" : 10, }, { "id" : "3102", "name" : "Spirit of Peppermint", "type" : "Noncombat", "mpCost" : 10, }, { "id" : "3103", "name" : "Spirit of Garlic", "type" : "Noncombat", "mpCost" : 10, }, { "id" : "3104", "name" : "Spirit of Wormwood", "type" : "Noncombat", "mpCost" : 10, }, { "id" : "3105", "name" : "Spirit of Bacon Grease", "type" : "Noncombat", "mpCost" : 10, }, { "id" : "4000", "name" : "Sauce Contemplation", "type" : "Noncombat", "mpCost" : 1, }, { "id" : "4003", "name" : "Stream of Sauce", "type" : "Combat", "mpCost" : 3, }, { "id" : "4004", "name" : "Expert Panhandling", "type" : "Passive", }, { "id" : "4005", "name" : "Saucestorm", "type" : "Combat", "mpCost" : 12, }, { "id" : "4006", "name" : "Advanced Saucecrafting", "type" : "Noncombat", "mpCost" : 10, }, { "id" : "4007", "name" : "Elemental Saucesphere", "type" : "Buff", "mpCost" : 10, }, { "id" : "4008", "name" : "Jalapeno Saucesphere", "type" : "Buff", "mpCost" : 5, }, { "id" : "4009", "name" : "Wave of Sauce", "type" : "Combat", "mpCost" : 23, }, { "id" : "4010", "name" : "Intrinsic Spiciness", "type" : "Passive", }, { "id" : "4011", "name" : "Jabanero Saucesphere", "type" : "Buff", "mpCost" : 10, }, { "id" : "4012", "name" : "Saucegeyser", "type" : "Combat", "mpCost" : 40, }, { "id" : "4014", "name" : "Saucy Salve", "type" : "Combat", "mpCost" : 4, }, { "id" : "4015", "name" : "Impetuous Sauciness", "type" : "Passive", }, { "id" : "4016", "name" : "Diminished Gag Reflex", "type" : "Passive", }, { "id" : "4017", "name" : "Immaculate Seasoning", "type" : "Passive", }, { "id" : "4018", "name" : "The Way of Sauce", "type" : "Passive", }, { "id" : "4019", "name" : "Scarysauce", "type" : "Buff", "mpCost" : 10, }, { "id" : "4020", "name" : "Salsaball", "type" : "Combat", "mpCost" : 1, }, { "id" : "5000", "name" : "Disco Aerobics", "type" : "Noncombat", "mpCost" : 1, }, { "id" : "5003", "name" : "Disco Eye-Poke", "type" : "Combat", "mpCost" : 3, }, { "id" : "5004", "name" : "Nimble Fingers", "type" : "Passive", }, { "id" : "5005", "name" : "Disco Dance of Doom", "type" : "Combat", "mpCost" : 5, }, { "id" : "5006", "name" : "Mad Looting Skillz", "type" : "Passive", }, { "id" : "5007", "name" : "Disco Nap", "type" : "Noncombat", "mpCost" : 8, }, { "id" : "5008", "name" : "Disco Dance II: Electric Boogaloo", "type" : "Combat", "mpCost" : 7, }, { "id" : "5009", "name" : "Disco Fever", "type" : "Passive", }, { "id" : "5010", "name" : "Overdeveloped Sense of Self Preservation", "type" : "Passive", }, { "id" : "5011", "name" : "Disco Power Nap", "type" : "Noncombat", "mpCost" : 12, }, { "id" : "5012", "name" : "Disco Face Stab", "type" : "Combat", "mpCost" : 10, }, { "id" : "5014", "name" : "Advanced Cocktailcrafting", "type" : "Noncombat", "mpCost" : 10, }, { "id" : "5015", "name" : "Ambidextrous Funkslinging", "type" : "Passive", }, { "id" : "5016", "name" : "Heart of Polyester", "type" : "Passive", }, { "id" : "5017", "name" : "Smooth Movement", "type" : "Noncombat", "mpCost" : 10, }, { "id" : "5018", "name" : "Superhuman Cocktailcrafting", "type" : "Passive", }, { "id" : "5019", "name" : "Tango of Terror", "type" : "Combat", "mpCost" : 8, }, { "id" : "6000", "name" : "Moxie of the Mariachi", "type" : "Noncombat", "mpCost" : 1, }, { "id" : "6003", "name" : "Aloysius' Antiphon of Aptitude", "type" : "Buff", "mpCost" : 40, }, { "id" : "6004", "name" : "The Moxious Madrigal", "type" : "Buff", "mpCost" : 2, }, { "id" : "6005", "name" : "Cletus's Canticle of Celerity", "type" : "Buff", "mpCost" : 4, }, { "id" : "6006", "name" : "The Polka of Plenty", "type" : "Buff", "mpCost" : 7, }, { "id" : "6007", "name" : "The Magical Mojomuscular Melody", "type" : "Buff", "mpCost" : 3, }, { "id" : "6008", "name" : "The Power Ballad of the Arrowsmith", "type" : "Buff", "mpCost" : 5, }, { "id" : "6009", "name" : "Brawnee's Anthem of Absorption", "type" : "Buff", "mpCost" : 13, }, { "id" : "6010", "name" : "Fat Leon's Phat Loot Lyric", "type" : "Buff", "mpCost" : 11, }, { "id" : "6011", "name" : "The Psalm of Pointiness", "type" : "Buff", "mpCost" : 15, }, { "id" : "6012", "name" : "Jackasses' Symphony of Destruction", "type" : "Buff", "mpCost" : 9, }, { "id" : "6013", "name" : "Stevedave's Shanty of Superiority", "type" : "Buff", "mpCost" : 30, }, { "id" : "6014", "name" : "The Ode to Booze", "type" : "Buff", "mpCost" : 50, }, { "id" : "6015", "name" : "The Sonata of Sneakiness", "type" : "Buff", "mpCost" : 20, }, { "id" : "6016", "name" : "Carlweather's Cantata of Confrontation", "type" : "Buff", "mpCost" : 20, }, { "id" : "6017", "name" : "Ur-Kel's Aria of Annoyance", "type" : "Buff", "mpCost" : 30, }, { "id" : "6018", "name" : "Dirge of Dreadfulness", "type" : "Buff", "mpCost" : 9, }, { "id" : "6020", "name" : "The Ballad of Richie Thingfinder", "type" : "Buff", "mpCost" : 50, }, { "id" : "6021", "name" : "Benetton's Medley of Diversity", "type" : "Buff", "mpCost" : 50, }, { "id" : "6022", "name" : "Elron's Explosive Etude", "type" : "Buff", "mpCost" : 50, }, { "id" : "6023", "name" : "Chorale of Companionship", "type" : "Buff", "mpCost" : 50, }, { "id" : "6024", "name" : "Prelude of Precision", "type" : "Buff", "mpCost" : 50, }, { "id" : "7001", "name" : "Give In To Your Vampiric Urges", "type" : "Combat", "mpCost" : 0, }, { "id" : "7002", "name" : "Shake Hands", "type" : "Combat", "mpCost" : 0, }, { "id" : "7003", "name" : "Hot Breath", "type" : "Combat", "mpCost" : 5, }, { "id" : "7004", "name" : "Cold Breath", "type" : "Combat", "mpCost" : 5, }, { "id" : "7005", "name" : "Spooky Breath", "type" : "Combat", "mpCost" : 5, }, { "id" : "7006", "name" : "Stinky Breath", "type" : "Combat", "mpCost" : 5, }, { "id" : "7007", "name" : "Sleazy Breath", "type" : "Combat", "mpCost" : 5, }, { "id" : "7008", "name" : "Moxious Maneuver", "type" : "Combat", }, { "id" : "7009", "name" : "Magic Missile", "type" : "Combat", "mpCost" : 2, }, { "id" : "7010", "name" : "Fire Red Bottle-Rocket", "type" : "Combat", "mpCost" : 5, }, { "id" : "7011", "name" : "Fire Blue Bottle-Rocket", "type" : "Combat", "mpCost" : 5, }, { "id" : "7012", "name" : "Fire Orange Bottle-Rocket", "type" : "Combat", "mpCost" : 5, }, { "id" : "7013", "name" : "Fire Purple Bottle-Rocket", "type" : "Combat", "mpCost" : 5, }, { "id" : "7014", "name" : "Fire Black Bottle-Rocket", "type" : "Combat", "mpCost" : 5, }, { "id" : "7015", "name" : "Creepy Grin", "type" : "Combat", "mpCost" : 30, }, { "id" : "7016", "name" : "Start Trash Fire", "type" : "Combat", "mpCost" : 100, }, { "id" : "7017", "name" : "Overload Discarded Refrigerator", "type" : "Combat", "mpCost" : 100, }, { "id" : "7018", "name" : "Trashquake", "type" : "Combat", "mpCost" : 100, }, { "id" : "7019", "name" : "Zombo's Visage", "type" : "Combat", "mpCost" : 100, }, { "id" : "7020", "name" : "Hypnotize Hobo", "type" : "Combat", "mpCost" : 100, }, { "id" : "7021", "name" : "Ask Richard for a Bandage", "type" : "Combat", }, { "id" : "7022", "name" : "Ask Richard for a Grenade", "type" : "Combat", }, { "id" : "7023", "name" : "Ask Richard to Rough the Hobo Up a Bit", "type" : "Combat", }, { "id" : "7024", "name" : "Summon Mayfly Swarm", "type" : "Combat", "mpCost" : 0, }, { "id" : "7025", "name" : "Get a You-Eye View", "type" : "Combat", "mpCost" : 30, }, { "id" : "7038", "name" : "Vicious Talon Slash", "type" : "Combat", "mpCost" : 5, }, { "id" : "7039", "name" : "All-You-Can-Beat Wing Buffet", "type" : "Combat", "mpCost" : 10, }, { "id" : "7040", "name" : "Tunnel Upwards", "type" : "Combat", "mpCost" : 0, }, { "id" : "7041", "name" : "Tunnel Downwards", "type" : "Combat", "mpCost" : 0, }, { "id" : "7042", "name" : "Rise From Your Ashes", "type" : "Combat", "mpCost" : 20, }, { "id" : "7043", "name" : "Antarctic Flap", "type" : "Combat", "mpCost" : 10, }, { "id" : "7044", "name" : "The Statue Treatment", "type" : "Combat", "mpCost" : 20, }, { "id" : "7045", "name" : "Feast on Carrion", "type" : "Combat", "mpCost" : 20, }, { "id" : "7046", "name" : "Give Your Opponent \"The Bird\"", "type" : "Combat", "mpCost" : 20, }, { "id" : "7047", "name" : "Ask the hobo for a drink", "type" : "Combat", "mpCost" : 0, }, { "id" : "7048", "name" : "Ask the hobo for something to eat", "type" : "Combat", "mpCost" : 0, }, { "id" : "7049", "name" : "Ask the hobo for some violence", "type" : "Combat", "mpCost" : 0, }, { "id" : "7050", "name" : "Ask the hobo to tell you a joke", "type" : "Combat", "mpCost" : 0, }, { "id" : "7051", "name" : "Ask the hobo to dance for you", "type" : "Combat", "mpCost" : 0, }, { "id" : "7052", "name" : "Summon hobo underling", "type" : "Combat", "mpCost" : 0, }, { "id" : "7053", "name" : "Rouse Sapling", "type" : "Combat", "mpCost" : 15, }, { "id" : "7054", "name" : "Spray Sap", "type" : "Combat", "mpCost" : 15, }, { "id" : "7055", "name" : "Put Down Roots", "type" : "Combat", "mpCost" : 15, }, { "id" : "7056", "name" : "Fire off a Roman Candle", "type" : "Combat", "mpCost" : 10, }, { "id" : "7061", "name" : "Spring Raindrop Attack", "type" : "Combat", "mpCost" : 0, }, { "id" : "7062", "name" : "Summer Siesta", "type" : "Combat", "mpCost" : 10, }, { "id" : "7063", "name" : "Falling Leaf Whirlwind", "type" : "Combat", "mpCost" : 10, }, { "id" : "7064", "name" : "Winter's Bite Technique", "type" : "Combat", "mpCost" : 10, }, { "id" : "7065", "name" : "The 17 Cuts", "type" : "Combat", "mpCost" : 10, }, { "id" : "8000", "name" : "Summon Snowcones", "type" : "Mystical Bookshelf", "mpCost" : 5, }, { "id" : "8100", "name" : "Summon Candy Heart", "type" : "Mystical Bookshelf", }, { "id" : "8101", "name" : "Summon Party Favor", "type" : "Mystical Bookshelf", }, { "id" : "8200", "name" : "Summon Hilarious Objects", "type" : "Mystical Bookshelf", "mpCost" : 5, }, { "id" : "8201", "name" : "Summon \"Tasteful\" Gifts", "type" : "Mystical Bookshelf", "mpCost" : 5, }, ]
for cat1 in range(1, 21): for cat2 in range(1, 21): hypo = (cat1 ** 2 + cat2 ** 2) ** 0.5 if hypo.is_integer(): print(cat1, cat2, hypo)
# Copyright 2021 Canonical Ltd. # See LICENSE file for licensing details. """Module testing the Legend Studio Operator."""
# # Copyright 2018-2019 IBM Corp. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # # Flask settings DEBUG = False # Flask-restplus settings RESTPLUS_MASK_SWAGGER = False # Application settings # API metadata API_TITLE = 'MAX Weather Forecaster' API_DESC = 'An API for serving models' API_VERSION = '1.1.0' # Default model MODEL_NAME = 'lstm_weather_forecaster' DEFAULT_MODEL_PATH = 'assets/models' MODEL_LICENSE = 'Apache 2' MODELS = ['univariate', 'multistep', 'multivariate'] DEFAULT_MODEL = MODELS[0] MODEL_META_DATA = { 'id': '{}'.format(MODEL_NAME.lower()), 'name': 'LSTM Weather Forecaster', 'description': 'LSTM Weather Forecaster Model trained using TensorFlow and Keras on JFK weather time-series data', 'type': 'Time Series Prediction', 'license': '{}'.format(MODEL_LICENSE), 'source': 'https://developer.ibm.com/exchanges/models/all/max-weather-forecaster/' }
# Definition for singly-linked list. # class ListNode: # def __init__(self, x): # self.val = x # self.next = None class Solution: def hasCycle(self, head: ListNode) -> bool: h = set() while head and head not in h: h.add(head) head = head.next return head
class Default(): """Single repository for default values.""" EXEC_DIRECTORY = '' # Unit Test defaults GOOD_CONFIG = 'null.cfg' BAD_CONFIG = 'none.cfg' TEST_DIR = './test_directory' TEST_FILE_NAME = 'test.zip' TEST_FILE_SIZE = 4 * 1024 * 1024 TEST_FILE_NULL_COUNT = 4 * 1024 * 1024 * .25 TEST_NULL_CHAR = '\x00' # Config defaults CONFIG_NAME = 'nfd.cfg' NULL_CHAR = '\x00' RECURSIVE = False VERBOSE = False START_DIRECTORY = '.' CAT_1_NAME = 'GOOD' CAT_2_NAME = 'DAMAGED' CAT_3_NAME = 'BAD' CAT_1 = 5 CAT_2 = 20 CAT_3 = 85
class ServiceModel: @property def short_name(self): return self.__service_short_name @property def count(self): return self.__count_slot @count.setter def count(self, value): self.__count_slot = int(value) def object_factory(name, base_class, argnames): def __init__(self, **kwargs): for key, value in kwargs.items(): if key not in argnames: raise TypeError('Argument {} not valid for {}'.format(key, self.__class__.__name__)) setattr(self, key, value) base_class.__init__(self) newclass = type(name, (base_class,), {'__init__': __init__}) return newclass class ServiceStorage: names = { 'VkCom': 'vk', 'Netflix': 'nf', 'Google': 'go', 'Imo': 'im', 'Telegram': 'tg', 'Instagram': 'ig', 'Facebook': 'fb', 'WhatsApp': 'wa', 'Viber': 'vi', 'AliBaba': 'ab', 'KakaoTalk': 'kt', 'Microsoft': 'mm', 'Naver': 'nv', 'ProtonMail': 'dp' } class SmsService: def __init__(self): for name, short_name in ServiceStorage.names.items(): object = object_factory( name, base_class=ServiceModel, argnames=['__service_short_name', '__count_slot'] )(__service_short_name=short_name, __count_slot=0) setattr(self, '_' + name, object) @property def VkCom(self): """ :rtype: smsvk.ServiceModel """ return self._VkCom @property def Whatsapp(self): """ :rtype: smsvk.ServiceModel """ return self._Whatsapp @property def Viber(self): """ :rtype: smsvk.ServiceModel """ return self._Viber @property def Telegram(self): """ :rtype: smsvk.ServiceModel """ return self._Telegram @property def Google(self): """ :rtype: smsvk.ServiceModel """ return self._Google @property def Imo(self): """ :rtype: smsvk.ServiceModel """ return self._Imo def Instagram(self): """ :rtype: smsvk.ServiceModel """ return self._Instagram @property def KakaoTalk(self): """ :rtype: smsvk.ServiceModel """ return self._KakaoTalk @property def AliBaba(self): """ :rtype: smsvk.ServiceModel """ return self._AliBaba def Netflix(self): """ :rtype: smsvk.ServiceModel """ return self._Netflix def Facebook(self): """ :rtype: smsvk.ServiceModel """ return self._Facebook def Microsoft(self): """ :rtype: smsvk.ServiceModel """ return self._Naver def Naver(self): """ :rtype: smsvk.ServiceModel """ return self._Microsoft def ProtonMail(self): """ :rtype: smsvk.ServiceModel """ return self._ProtonMail
# AUTOGENERATED BY NBDEV! DO NOT EDIT! __all__ = ["index", "modules", "custom_doc_links", "git_url"] index = {"main": "00_beproductive.ipynb", "parse_arguments": "00_beproductive.ipynb", "in_notebook": "00_beproductive.ipynb", "APP_NAME": "01_blocker.ipynb", "REDIRECT": "01_blocker.ipynb", "WIN_PATH": "01_blocker.ipynb", "LINUX_PATH": "01_blocker.ipynb", "NOTIFY_DURATION": "01_blocker.ipynb", "ICON_PATH": "01_blocker.ipynb", "host_fp": "01_blocker.ipynb", "host_fp_copy": "01_blocker.ipynb", "host_fp_blocked": "01_blocker.ipynb", "Blocker": "01_blocker.ipynb", "WORK_TIME": "02_pomodoro.ipynb", "BREAK_TIME": "02_pomodoro.ipynb", "POMODOROS": "02_pomodoro.ipynb", "pomodoro": "02_pomodoro.ipynb", "DEFAULT_URLS": "03_config.ipynb", "save_config": "03_config.ipynb", "load_config": "03_config.ipynb", "add_urls": "03_config.ipynb", "remove_urls": "03_config.ipynb", "show_blocklist": "03_config.ipynb"} modules = ["__main__.py", "blocker.py", "pomodoro.py", "config.py"] doc_url = "https://johannesstutz.github.io/beproductive/" git_url = "https://github.com/johannesstutz/beproductive/tree/master/" def custom_doc_links(name): return None
def sumar(a, b): return a + b def restar(a, b): return a - b def multiplicador(a, b): return a * b def dividir(numerador, denominador): return float(numerador)/denominador
class MockOpenedFile(object): def __init__(self, value='value'): self.seek_values = [] self.buf_values = [] self.value = value def seek(self, offset): self.seek_values.append(offset) def read(self, buf): self.buf_values.append(buf) return self.value def clean(self): self.seek_values = [] self.buf_values = []
"""Write a function that checks whether an element occurs in a list.""" def check_existence_of_element(a,b): if a in b: print ("the item in list") else: print ("the item is not in the list") item = 1 mylist = [1, 4, 5, 100, 2, 1, -1, -7] check_existence_of_element(item,mylist) #index = -1
""" Binary Search Given a sorted array arr[] of n elements, write a function to search a given element x in arr[]. A simple approach is to do linear search.The time complexity of above algorithm is O(n). Another approach to perform the same task is using Binary Search. Binary Search: Search a sorted array by repeatedly dividing the search interval in half. Begin with an interval covering the whole array. If the value of the search key is less than the item in the middle of the interval, narrow the interval to the lower half. Otherwise narrow it to the upper half. Repeatedly check until the value is found or the interval is empty. """ # Python Program for recursive binary search. # Returns index of x in arr if present, else -1 def binarySearch(arr, l, r, x): # Check base case if r >= l: mid = l + (r - l)/2 # If element is present at the middle itself if arr[mid] == x: return mid # If element is smaller than mid, then it can only be present in left # subarray elif arr[mid] > x: return binarySearch(arr, mid-1, x) # Else the element can only be present # in right subarray else: return binarySearch(arr, mid + 1, r, x) else: # Element is not present in the array return -1 # Test array arr = [2, 3, 4, 10, 40] x = 10 # Function call result = binarySearch(arr, 0, len(arr)-1, x) if result != -1: print("Element is present at index % d" % result) else: print("Element is not present in array")
""" extended GCD algorithm return s,t,g such that a s + b t = GCD(a, b) and s and t are coprime """ def extended_gcd(a,b): old_s, s = 1, 0 old_t, t = 0, 1 old_r, r = a, b while r != 0: quotient = old_r / r old_r, r = r, old_r - quotient * r old_s, s = s, old_s - quotient * s old_t, t = t, old_t - quotient * t return old_s, old_t, old_r
# CountFirstCharaters # -------------------------------------- # It counts how many times a character appears at the beginning of a line def CountFirstCharacters (Line, Character): n = 0 for letter in Line: if letter == Character: n = n + 1 else: return n # Remove all the Character characters from the line def RemoveFirstCharacters (Line, Character): n = CountFirstcharacters (Line, Character) return Line[n:]
# Definition for singly-linked list. # class ListNode(object): # def __init__(self, val=0, next=None): # self.val = val # self.next = next class Solution(object): def deleteDuplicates(self, head): """ :type head: ListNode :rtype: ListNode """ # Runtime: 32 ms # Memory: 13.4 MB if head is None: return None cur = head while cur.next is not None: if cur.next.val == cur.val: # Find next node ptr = cur.next.next while ptr is not None: if ptr.val != cur.val: break ptr = ptr.next cur.next = ptr cur = cur.next if cur is None: break return head
# -*- encoding: utf-8 -*- # # [graph.py] # # A clone of @holman's Spark program to allow graphing of simple data in the terminal. # # Copyright (C) 2017, Liam Schumm. Licensed under the MIT License, included in LICENSE.rst. # ticks = ["▁", "▂", "▃", "▄", "▅", "▆ ", "▇ ", "█"] def graph(*numbers_s): """graph: Graph numbers in your terminal. Usage: graph NUMBERS... """ out = [] for numbers in numbers_s: args = [int(x) for x in numbers] low = min(args) high = max(args) step = (high - low) / 8.0 # if graph is constant, use highest character if low == high: return ticks[-1] * len(args) else: # string where completed graph goes s = "" for arg in args: for i in range(8): if low + i * step <= arg <= low + (i+1) * step: s += ticks[i] out.append(s) return out exports = {'graph': graph}
print ("hola mundo/jhon") a=45 b=5 print("Suma:",a+b) print("Resta:",a-b) print("Division:",a/b) print("Multiplicacion:",a*b)
class Interfaces: def __init__(self, interface: dict): self.screen = interface['screen'] self.account_linking = interface['account_linking'] class MetaData: def __init__(self, meta: dict): self.locale = meta['locale'] self.timezone = meta['timezone'] self.interfaces = Interfaces(interface=meta['interfaces']) class User: def __init__(self, user: dict): self.user_id = user['user_id'] self.access_token = user.get('access_token') class Application: def __init__(self, application: dict): self.application_id = application['application_id'] class SessionData: def __init__(self, session: dict): self.session_id = session['session_id'] self.message_id = session['message_id'] self.skill_id = session['skill_id'] self.user = User(user=session['user']) self.application = Application(application=session['application']) self.new = session['new'] class Markup: def __init__(self, markup: dict): self.dangerous_context = markup['dangerous_context'] class Entity: def __init__(self, entity: dict): self.start = entity['tokens']['start'] self.end = entity['tokens']['end'] self.type = entity['type'] self.value = entity['value'] class Entities: def __init__(self, entities: list): self.datetime = None self.fio = None self.geo = None self.number = None for entity in entities: if entity['type'] == 'YANDEX.DATETIME': self.datetime = Entity(entity=entity) elif entity['type'] == 'YANDEX.FIO': self.fio = Entity(entity=entity) elif entity['type'] == 'YANDEX.GEO': self.geo = Entity(entity=entity) elif entity['type'] == 'YANDEX.NUMBER': self.number = Entity(entity=entity) class NLU: def __init__(self, nlu: dict): self.tokens = nlu['tokens'] self.entities = Entities(entities=nlu['entities']) class RequestData: def __init__(self, request_json: dict): self.command = request_json['command'] self.original_utterance = request_json['original_utterance'] self.type = request_json['type'] self.markup = Markup(markup=request_json['markup']) self.payload = request_json.get('payload') self.nlu = NLU(nlu=request_json['nlu']) class StateValue: def __init__(self, session: dict): self.value = session.get('value') if session.get('value') is not None else None class State: def __init__(self, state: dict): self.session = StateValue(session=state.get('session')) self.user = StateValue(session=state.get('user')) class Message: def __init__(self, json: dict): self.meta = MetaData(json['meta']) self.session = SessionData(json['session']) self.version = json['version'] self.request = RequestData(request_json=json['request']) self.state = State(state=json.get('state')) self.original_request = json
#!/usr/bin/env python3 # https://codeforces.com/problemset/problem/4/A n = int(input()) print('YES' if (n>2 and n%2==0) else 'NO')
class Submissions: def __init__(self, client): self.client = client def list(self, groupId, assignmentId): url = self.client.api_url + '/groups/' + groupId + '/assignments/' + assignmentId + '/submissions' method = 'get' return self.client.api_handler(url=url, method=method) def get(self, submissionId): url = self.client.api_url + '/submissions/' + submissionId method = 'get' return self.client.api_handler(url=url, method=method)
class NQ: def __init__(self, size): self.n = size self.board = self.generateBoard() def solve(self): if self.__util(0) == False: print("Solution does not exist") self.printBoard() def __util(self, col): if col >= self.n: return False for row in range(self.n): if self.__isSafe(row, col): self.board[row][col] = 1 if self.__util(col + 1) == True: return True self.board[row][col] = 0 def __isSafe(self, row, col): for i in range(col): if self.board[row][i] == 1: return False for i, j in zip(range(row, -1, -1), range(col, -1, -1)): if self.board[i][j] == 1: return False return True def generateBoard(self): temp_board = [] for i in range(self.n): temp = [] for j in range(self.n): temp.append(0) temp_board.append(temp) return temp_board def printBoard(self): for i in range(self.n): for j in range(self.n): print(self.board[i][j], end=" ") print() def main(): Nqueen = NQ(4) Nqueen.solve() Nqueen.printBoard() if __name__ == "__main__": main()
# %% [139. Word Break](https://leetcode.com/problems/word-break/) class Solution: def wordBreak(self, s: str, wordDict: List[str]) -> bool: @functools.lru_cache(None) def check(s): if not s: return True for word in wordDict: if s.startswith(word) and check(s[len(word) :]): return True return False return check(s)
def wrapper(f): def fun(l): decorated_numbers = [] for number in l: decorated_numbers.append("+91 " + number[-10:-5] + " " + number[-5:]) return f(decorated_numbers) return fun @wrapper def sort_phone(l): print(*sorted(l), sep='\n') if __name__ == '__main__': l = [input() for _ in range(int(input()))] sort_phone(l)
def reverse_text(string): return (x for x in string[::-1]) # for x in string[::-1]: # yield x # idx = len(string) - 1 # while idx >= 0: # yield string[idx] # idx -= 1 for char in reverse_text("step"): print(char, end='')
class Ticket: def __init__(self, payload, yt_api, gh_api, users_dict): self.payload = payload self.action = payload["action"] self.yt_api = yt_api self.gh_api = gh_api self.users_dict = users_dict self.pr = payload["pull_request"] self.url = self.pr["html_url"] self.branch_name = self.pr["head"]["ref"] self.issue_id = yt_api.get_issue_id(self.branch_name) def exists(self): if self.issue_id is None: print("No YouTrack issue associated with branch {}".format( self.branch_name)) return False return True def update(self): if self.action == "review_requested": reviewer = self.pr["requested_reviewers"][0]["login"] return self.__submit(reviewer) if self.action == "closed": return self.__close() if self.action == "submitted": review = self.payload["review"] author = self.pr["user"]["login"] if review["state"] == "approved": url = self.pr["url"] + "/reviews" reviewer = self.payload["review"]["user"]["login"] payload = self.gh_api.get(url) remaining_reviews = \ [p for p in payload if p["state"] != "APPROVED" and not has_approved(payload, p["user"]["login"]) and p["user"]["login"] != reviewer and p["user"]["login"] != author] if len(remaining_reviews) > 0: next_reviewer = remaining_reviews[0]["user"]["login"] return self.__submit(next_reviewer) return '', 200 author = self.pr["user"]["login"] if author == review["user"]["login"]: # ignore author reviewing their own code return '', 200 return self.__reopen(author, review) return '', 200 def __reopen(self, author, review): assignee = self.users_dict[author] review_url = review["html_url"] print("Reopening ticket {} and assigning user {}".format(self.issue_id, assignee)) commands = [self.yt_api.set_state("Reopened"), self.yt_api.assign(assignee)] print(review_url, self.issue_id, commands) success, response = self.yt_api.update_ticket(self.issue_id, commands=commands, comment=review_url) if not success: return response.text, response.status_code return '', 200 def __close(self): if self.pr["merged"] is False: return '', 200 print(("Closing ticket {} and unassigning".format(self.issue_id))) commands = [self.yt_api.set_state("Ready to deploy"), self.yt_api.assign("Unassigned")] success, response = self.yt_api.update_ticket(self.issue_id, commands=commands) if not success: return response.text, response.status_code return '', 200 def __submit(self, reviewer): assignee = self.users_dict[reviewer] print( "Submitting ticket {} and assigning user {}".format(self.issue_id, assignee)) commands = [self.yt_api.set_state("Submitted"), self.yt_api.assign(assignee)] success, response = self.yt_api.update_ticket(self.issue_id, commands=commands, comment=self.url) if not success: return response.text, response.status_code return '', 200 def has_approved(payload, username): return len([p for p in payload if p["state"] == "APPROVED" and p["user"]["login"] == username]) > 0
MULTI_SIGNAL_CSV_DATA = """ symbol,date,signal ibm,1/1/06,1 ibm,2/1/06,0 ibm,3/1/06,0 ibm,4/1/06,0 ibm,5/1/06,1 ibm,6/1/06,1 ibm,7/1/06,1 ibm,8/1/06,1 ibm,9/1/06,0 ibm,10/1/06,1 ibm,11/1/06,1 ibm,12/1/06,5 ibm,1/1/07,1 ibm,2/1/07,0 ibm,3/1/07,1 ibm,4/1/07,0 ibm,5/1/07,1 dell,1/1/06,1 dell,2/1/06,0 dell,3/1/06,0 dell,4/1/06,0 dell,5/1/06,1 dell,6/1/06,1 dell,7/1/06,1 dell,8/1/06,1 dell,9/1/06,0 dell,10/1/06,1 dell,11/1/06,1 dell,12/1/06,5 dell,1/1/07,1 dell,2/1/07,0 dell,3/1/07,1 dell,4/1/07,0 dell,5/1/07,1 """.strip() AAPL_CSV_DATA = """ symbol,date,signal aapl,1/1/06,1 aapl,2/1/06,0 aapl,3/1/06,0 aapl,4/1/06,0 aapl,5/1/06,1 aapl,6/1/06,1 aapl,7/1/06,1 aapl,8/1/06,1 aapl,9/1/06,0 aapl,10/1/06,1 aapl,11/1/06,1 aapl,12/1/06,5 aapl,1/1/07,1 aapl,2/1/07,0 aapl,3/1/07,1 aapl,4/1/07,0 aapl,5/1/07,1 """.strip() # times are expected in UTC AAPL_MINUTE_CSV_DATA = """ symbol,date,signal aapl,1/4/06 5:31AM, 1 aapl,1/4/06 11:30AM, 2 aapl,1/5/06 5:31AM, 1 aapl,1/5/06 11:30AM, 3 aapl,1/9/06 5:31AM, 1 aapl,1/9/06 11:30AM, 4 """.strip() AAPL_IBM_CSV_DATA = """ symbol,date,signal aapl,1/1/06,1 aapl,2/1/06,0 aapl,3/1/06,0 aapl,4/1/06,0 aapl,5/1/06,1 aapl,6/1/06,1 aapl,7/1/06,1 aapl,8/1/06,1 aapl,9/1/06,0 aapl,10/1/06,1 aapl,11/1/06,1 aapl,12/1/06,5 aapl,1/1/07,1 aapl,2/1/07,0 aapl,3/1/07,1 aapl,4/1/07,0 aapl,5/1/07,1 ibm,1/1/06,1 ibm,2/1/06,0 ibm,3/1/06,0 ibm,4/1/06,0 ibm,5/1/06,1 ibm,6/1/06,1 ibm,7/1/06,1 ibm,8/1/06,1 ibm,9/1/06,0 ibm,10/1/06,1 ibm,11/1/06,1 ibm,12/1/06,5 ibm,1/1/07,1 ibm,2/1/07,0 ibm,3/1/07,1 ibm,4/1/07,0 ibm,5/1/07,1 """.strip() CPIAUCSL_DATA = """ Date,Value 2007-12-01,211.445 2007-11-01,210.834 2007-10-01,209.19 2007-09-01,208.547 2007-08-01,207.667 2007-07-01,207.603 2007-06-01,207.234 2007-05-01,206.755 2007-04-01,205.904 2007-03-01,205.288 2007-02-01,204.226 2007-01-01,203.437 2006-12-01,203.1 2006-11-01,202.0 2006-10-01,201.9 2006-09-01,202.8 2006-08-01,203.8 2006-07-01,202.9 2006-06-01,201.8 2006-05-01,201.3 2006-04-01,200.7 2006-03-01,199.7 2006-02-01,199.4 2006-01-01,199.3 """.strip() PALLADIUM_DATA = """ Date,Hong Kong 8:30,Hong Kong 14:00,London 08:00,New York 9:30,New York 15:00 2007-12-31,367.0,367.0,368.0,368.0,368.0 2007-12-28,366.0,366.0,365.0,368.0,368.0 2007-12-27,367.0,367.0,366.0,363.0,367.0 2007-12-26,,,,365.0,365.0 2007-12-24,351.0,357.0,357.0,357.0,365.0 2007-12-21,356.0,356.0,354.0,357.0,357.0 2007-12-20,357.0,356.0,354.0,356.0,356.0 2007-12-19,359.0,359.0,359.0,356.0,358.0 2007-12-18,357.0,356.0,356.0,359.0,359.0 2007-12-17,353.0,353.0,351.0,354.0,360.0 2007-12-14,347.0,347.0,347.0,347.0,355.0 2007-12-13,349.0,349.0,349.0,349.0,347.0 2007-12-12,348.0,349.0,349.0,351.0,349.0 2007-12-11,346.0,346.0,346.0,348.0,350.0 2007-12-10,346.0,346.0,346.0,348.0,348.0 2007-12-07,348.0,348.0,348.0,346.0,346.0 2007-12-06,350.0,350.0,352.0,348.0,348.0 2007-12-05,350.0,350.0,352.0,351.0,351.0 2007-12-04,349.0,349.0,352.0,351.0,351.0 2007-12-03,350.0,350.0,354.0,350.0,350.0 2007-11-30,345.0,345.0,347.0,353.0,350.0 2007-11-29,348.0,348.0,348.0,347.0,345.0 2007-11-28,350.0,347.0,347.0,348.0,348.0 2007-11-27,356.0,356.0,358.0,354.0,350.0 2007-11-26,357.0,357.0,360.0,360.0,360.0 2007-11-23,353.0,354.0,357.0,355.0, 2007-11-22,359.0,359.0,359.0,358.0, 2007-11-21,364.0,364.0,366.0,365.0,359.0 2007-11-20,360.0,359.0,362.0,364.0,364.0 2007-11-19,366.0,365.0,365.0,365.0,361.0 2007-11-16,368.0,366.0,368.0,369.0,366.0 2007-11-15,373.0,372.0,372.0,368.0,368.0 2007-11-14,372.0,372.0,372.0,373.0,373.0 2007-11-13,365.0,365.0,368.0,372.0,372.0 2007-11-12,373.0,370.0,370.0,366.0,366.0 2007-11-09,376.0,375.0,373.0,373.0,373.0 2007-11-08,376.0,376.0,373.0,376.0,376.0 2007-11-07,379.0,379.0,383.0,378.0,378.0 2007-11-06,374.0,374.0,374.0,379.0,379.0 2007-11-05,376.0,376.0,376.0,376.0,374.0 2007-11-02,372.0,371.0,371.0,371.0,376.0 2007-11-01,374.0,374.0,374.0,374.0,374.0 2007-10-31,369.0,369.0,371.0,372.0,372.0 2007-10-30,373.0,372.0,373.0,371.0,371.0 2007-10-29,373.0,375.0,375.0,376.0,373.0 2007-10-26,364.0,368.0,370.0,373.0,373.0 2007-10-25,360.0,360.0,360.0,364.0,368.0 2007-10-24,364.0,364.0,364.0,360.0,360.0 2007-10-23,361.0,361.0,364.0,366.0,366.0 2007-10-22,367.0,362.0,361.0,361.0,361.0 2007-10-19,,,374.0,372.0,370.0 2007-10-18,373.0,373.0,374.0,373.0,373.0 2007-10-17,372.0,372.0,370.0,373.0,373.0 2007-10-16,375.0,375.0,375.0,372.0,372.0 2007-10-15,379.0,379.0,380.0,382.0,375.0 2007-10-12,378.0,378.0,378.0,379.0,379.0 2007-10-11,375.0,375.0,376.0,381.0,384.0 2007-10-10,365.0,365.0,367.0,377.0,377.0 2007-10-09,365.0,363.0,362.0,362.0,365.0 2007-10-08,369.0,369.0,367.0,366.0,365.0 2007-10-05,369.0,369.0,371.0,369.0,369.0 2007-10-04,359.0,359.0,360.0,362.0,369.0 2007-10-03,352.0,350.0,352.0,352.0,359.0 2007-10-02,358.0,357.0,356.0,352.0,352.0 2007-10-01,,,349.0,355.0,360.0 2007-09-28,345.0,345.0,345.0,346.0,348.0 2007-09-27,342.0,342.0,342.0,343.0,345.0 2007-09-26,,,341.0,340.0,343.0 2007-09-25,342.0,341.0,343.0,341.0,341.0 2007-09-24,340.0,340.0,342.0,342.0,342.0 2007-09-21,341.0,341.0,342.0,342.0,340.0 2007-09-20,335.0,335.0,335.0,338.0,341.0 2007-09-19,333.0,333.0,335.0,335.0,335.0 2007-09-18,333.0,333.0,334.0,333.0,333.0 2007-09-17,331.0,331.0,331.0,333.0,333.0 2007-09-14,334.0,333.0,333.0,333.0,331.0 2007-09-13,336.0,336.0,336.0,334.0,334.0 2007-09-12,336.0,336.0,336.0,336.0,336.0 2007-09-11,333.0,335.0,335.0,336.0,336.0 2007-09-10,337.0,337.0,337.0,336.0,333.0 2007-09-07,336.0,336.0,338.0,337.0,337.0 2007-09-06,333.0,333.0,336.0,336.0,336.0 2007-09-05,334.0,334.0,334.0,336.0,333.0 2007-09-04,333.0,333.0,334.0,334.0,334.0 2007-09-03,334.0,334.0,335.0,334.0, 2007-08-31,331.0,333.0,334.0,333.0,333.0 2007-08-30,331.0,331.0,332.0,331.0,331.0 2007-08-29,329.0,327.0,329.0,329.0,331.0 2007-08-28,331.0,331.0,334.0,331.0,331.0 2007-08-27,330.0,331.0,331.0,331.0,331.0 2007-08-24,326.0,326.0,327.0,325.0,330.0 2007-08-23,322.0,322.0,326.0,330.0,326.0 2007-08-22,321.0,319.0,319.0,322.0,322.0 2007-08-21,331.0,331.0,329.0,328.0,325.0 2007-08-20,331.0,331.0,331.0,331.0,331.0 2007-08-17,334.0,334.0,334.0,335.0,331.0 2007-08-16,348.0,346.0,345.0,338.0,329.0 2007-08-15,354.0,354.0,352.0,348.0,348.0 2007-08-14,357.0,357.0,356.0,351.0,354.0 2007-08-13,355.0,355.0,354.0,356.0,358.0 2007-08-10,361.0,357.0,357.0,350.0,358.0 2007-08-09,364.0,364.0,364.0,361.0,361.0 2007-08-08,362.0,362.0,362.0,364.0,364.0 2007-08-07,365.0,365.0,363.0,360.0,363.0 2007-08-06,365.0,365.0,365.0,365.0,365.0 2007-08-03,366.0,366.0,365.0,365.0,367.0 2007-08-02,365.0,365.0,365.0,368.0,366.0 2007-08-01,367.0,366.0,366.0,365.0,367.0 2007-07-31,367.0,367.0,365.0,367.0,367.0 2007-07-30,363.0,362.0,361.0,365.0,367.0 2007-07-27,365.0,365.0,364.0,363.0,363.0 2007-07-26,366.0,366.0,365.0,365.0,365.0 2007-07-25,368.0,368.0,368.0,366.0,366.0 2007-07-24,372.0,372.0,372.0,370.0,368.0 2007-07-23,372.0,372.0,372.0,372.0,372.0 2007-07-20,372.0,372.0,372.0,372.0,372.0 2007-07-19,370.0,369.0,369.0,370.0,372.0 2007-07-18,368.0,368.0,367.0,367.0,370.0 2007-07-17,368.0,368.0,368.0,368.0,365.0 2007-07-16,369.0,369.0,368.0,368.0,368.0 2007-07-13,370.0,370.0,370.0,369.0,369.0 2007-07-12,369.0,369.0,368.0,370.0,370.0 2007-07-11,369.0,369.0,369.0,369.0,369.0 2007-07-10,369.0,369.0,369.0,369.0,367.0 2007-07-09,367.0,367.0,366.0,370.0,369.0 2007-07-06,366.0,366.0,365.0,365.0,367.0 2007-07-05,366.0,366.0,366.0,367.0,366.0 2007-07-04,366.0,368.0,368.0,366.0, 2007-07-03,368.0,370.0,370.0,368.0,366.0 2007-07-02,,,369.0,368.0,368.0 2007-06-29,368.0,368.0,368.0,368.0,368.0 2007-06-28,367.0,367.0,368.0,368.0,368.0 2007-06-27,366.0,366.0,366.0,368.0,364.0 2007-06-26,372.0,372.0,370.0,368.0,366.0 2007-06-25,377.0,377.0,376.0,373.0,372.0 2007-06-22,376.0,376.0,375.0,377.0,377.0 2007-06-21,375.0,375.0,374.0,376.0,376.0 2007-06-20,373.0,373.0,371.0,375.0,377.0 2007-06-19,,,372.0,371.0,371.0 2007-06-18,370.0,371.0,373.0,373.0,373.0 2007-06-15,370.0,369.0,369.0,369.0,372.0 2007-06-14,367.0,367.0,369.0,369.0,369.0 2007-06-13,369.0,369.0,367.0,365.0,369.0 2007-06-12,368.0,368.0,371.0,369.0,369.0 2007-06-11,367.0,367.0,367.0,368.0,368.0 2007-06-08,369.0,368.0,368.0,371.0,369.0 2007-06-07,370.0,370.0,370.0,369.0,371.0 2007-06-06,370.0,370.0,370.0,368.0,368.0 2007-06-05,372.0,372.0,372.0,372.0,368.0 2007-06-04,376.0,374.0,374.0,372.0,372.0 2007-06-01,370.0,370.0,370.0,373.0,373.0 2007-05-31,368.0,368.0,368.0,370.0,370.0 2007-05-30,370.0,369.0,369.0,367.0,367.0 2007-05-29,370.0,369.0,369.0,371.0,368.0 2007-05-28,368.0,368.0,368.0,, 2007-05-25,368.0,368.0,368.0,367.0,367.0 2007-05-24,,,376.0,376.0,368.0 2007-05-23,375.0,375.0,378.0,376.0,376.0 2007-05-22,374.0,374.0,374.0,378.0,378.0 2007-05-21,364.0,364.0,365.0,368.0,374.0 2007-05-18,362.0,361.0,361.0,364.0,364.0 2007-05-17,359.0,359.0,359.0,359.0,362.0 2007-05-16,363.0,363.0,362.0,362.0,359.0 2007-05-15,362.0,362.0,362.0,358.0,362.0 2007-05-14,368.0,368.0,368.0,364.0,362.0 2007-05-11,361.0,363.0,362.0,364.0,367.0 2007-05-10,370.0,370.0,366.0,363.0,363.0 2007-05-09,376.0,376.0,373.0,372.0,370.0 2007-05-08,378.0,378.0,378.0,376.0,376.0 2007-05-07,378.0,378.0,381.0,381.0,381.0 2007-05-04,376.0,374.0,374.0,376.0,376.0 2007-05-03,373.0,373.0,373.0,376.0,376.0 2007-05-02,373.0,373.0,373.0,372.0,375.0 2007-05-01,,,371.0,369.0,374.0 2007-04-30,373.0,373.0,373.0,373.0,373.0 2007-04-27,373.0,372.0,372.0,374.0,374.0 2007-04-26,380.0,380.0,380.0,376.0,373.0 2007-04-25,377.0,377.0,377.0,380.0,380.0 2007-04-24,384.0,384.0,384.0,383.0,379.0 2007-04-23,386.0,386.0,386.0,382.0,386.0 2007-04-20,378.0,378.0,378.0,385.0,387.0 2007-04-19,383.0,382.0,377.0,377.0,377.0 2007-04-18,377.0,377.0,378.0,377.0,382.0 2007-04-17,376.0,376.0,376.0,376.0,379.0 2007-04-16,380.0,381.0,381.0,376.0,376.0 2007-04-13,371.0,371.0,371.0,374.0,380.0 2007-04-12,367.0,367.0,369.0,371.0,371.0 2007-04-11,360.0,360.0,363.0,366.0,369.0 2007-04-10,358.0,358.0,360.0,360.0,360.0 2007-04-09,,,,355.0,355.0 2007-04-05,,,355.0,353.0,355.0 2007-04-04,354.0,354.0,353.0,355.0,355.0 2007-04-03,353.0,353.0,354.0,354.0,354.0 2007-04-02,355.0,355.0,355.0,353.0,355.0 2007-03-30,354.0,354.0,356.0,355.0,355.0 2007-03-29,355.0,356.0,356.0,355.0,355.0 2007-03-28,355.0,356.0,356.0,356.0,356.0 2007-03-27,355.0,355.0,357.0,355.0,355.0 2007-03-26,354.0,354.0,355.0,355.0,357.0 2007-03-23,355.0,355.0,355.0,355.0,358.0 2007-03-22,354.0,354.0,353.0,356.0,356.0 2007-03-21,352.0,352.0,352.0,352.0,350.0 2007-03-20,352.0,352.0,352.0,352.0,352.0 2007-03-19,352.0,352.0,352.0,352.0,352.0 2007-03-16,352.0,352.0,352.0,352.0,352.0 2007-03-15,349.0,349.0,349.0,352.0,352.0 2007-03-14,351.0,349.0,348.0,349.0,349.0 2007-03-13,352.0,352.0,352.0,351.0,351.0 2007-03-12,353.0,353.0,353.0,352.0,352.0 2007-03-09,353.0,351.0,353.0,353.0,353.0 2007-03-08,349.0,349.0,349.0,353.0,355.0 2007-03-07,349.0,348.0,348.0,348.0,348.0 2007-03-06,342.0,343.0,345.0,345.0,350.0 2007-03-05,344.0,342.0,340.0,340.0,345.0 2007-03-02,351.0,351.0,351.0,349.0,349.0 2007-03-01,351.0,354.0,352.0,355.0,351.0 2007-02-28,347.0,348.0,348.0,350.0,350.0 2007-02-27,357.0,356.0,356.0,351.0,356.0 2007-02-26,358.0,359.0,359.0,357.0,357.0 2007-02-23,347.0,348.0,348.0,355.0,360.0 2007-02-22,346.0,346.0,346.0,350.0,350.0 2007-02-21,339.0,339.0,340.0,339.0,346.0 2007-02-20,,,342.0,337.0,337.0 2007-02-19,,,343.0,342.0,342.0 2007-02-16,344.0,343.0,343.0,340.0,343.0 2007-02-15,345.0,343.0,343.0,344.0,344.0 2007-02-14,343.0,343.0,343.0,345.0,347.0 2007-02-13,340.0,339.0,339.0,339.0,343.0 2007-02-12,338.0,338.0,340.0,338.0,340.0 2007-02-09,343.0,343.0,343.0,338.0,342.0 2007-02-08,344.0,344.0,344.0,339.0,342.0 2007-02-07,344.0,346.0,345.0,346.0,346.0 2007-02-06,340.0,340.0,342.0,344.0,344.0 2007-02-05,337.0,336.0,336.0,340.0,343.0 2007-02-02,344.0,344.0,343.0,341.0,341.0 2007-02-01,341.0,341.0,341.0,344.0,344.0 2007-01-31,341.0,340.0,340.0,334.0,341.0 2007-01-30,343.0,341.0,343.0,336.0,342.0 2007-01-29,349.0,349.0,350.0,342.0,346.0 2007-01-26,353.0,352.0,351.0,351.0,351.0 2007-01-25,350.0,350.0,350.0,353.0,353.0 2007-01-24,351.0,350.0,350.0,348.0,348.0 2007-01-23,345.0,345.0,347.0,350.0,350.0 2007-01-22,343.0,343.0,343.0,344.0,347.0 2007-01-19,340.0,340.0,341.0,341.0,344.0 2007-01-18,340.0,342.0,342.0,342.0,342.0 2007-01-17,335.0,335.0,333.0,334.0,343.0 2007-01-16,332.0,332.0,332.0,334.0,337.0 2007-01-15,334.0,336.0,335.0,332.0,332.0 2007-01-12,331.0,331.0,331.0,331.0,335.0 2007-01-11,331.0,331.0,331.0,333.0,333.0 2007-01-10,333.0,333.0,334.0,331.0,331.0 2007-01-09,333.0,333.0,336.0,329.0,329.0 2007-01-08,335.0,335.0,335.0,333.0,333.0 2007-01-05,340.0,340.0,340.0,342.0,336.0 2007-01-04,337.0,337.0,337.0,340.0,343.0 2007-01-03,338.0,336.0,336.0,342.0,342.0 2007-01-02,337.0,337.0,334.0,336.0,336.0 2006-12-29,327.0,327.0,327.0,327.0,337.0 2006-12-28,326.0,326.0,328.0,327.0,326.0 2006-12-27,326.0,328.0,328.0,328.0,326.0 2006-12-26,,,,327.0,327.0 2006-12-22,325.0,325.0,327.0,327.0,327.0 2006-12-21,326.0,326.0,327.0,325.0,325.0 2006-12-20,328.0,328.0,328.0,326.0,326.0 2006-12-19,324.0,324.0,325.0,322.0,326.0 2006-12-18,325.0,325.0,326.0,324.0,324.0 2006-12-15,330.0,329.0,329.0,327.0,325.0 2006-12-14,328.0,328.0,328.0,330.0,330.0 2006-12-13,329.0,329.0,330.0,328.0,328.0 2006-12-12,332.0,332.0,332.0,329.0,329.0 2006-12-11,329.0,329.0,329.0,329.0,329.0 2006-12-08,330.0,329.0,329.0,332.0,336.0 2006-12-07,328.0,326.0,326.0,328.0,328.0 2006-12-06,333.0,331.0,331.0,328.0,328.0 2006-12-05,330.0,330.0,329.0,333.0,333.0 2006-12-04,330.0,330.0,330.0,330.0,330.0 2006-12-01,330.0,330.0,330.0,328.0,328.0 2006-11-30,324.0,323.0,323.0,330.0,330.0 2006-11-29,326.0,326.0,328.0,321.0,321.0 2006-11-28,329.0,328.0,328.0,326.0,326.0 2006-11-27,330.0,329.0,329.0,329.0,329.0 2006-11-24,326.0,326.0,326.0,330.0, 2006-11-23,328.0,328.0,327.0,326.0, 2006-11-22,330.0,330.0,328.0,328.0,328.0 2006-11-21,323.0,327.0,327.0,330.0,330.0 2006-11-20,320.0,320.0,322.0,323.0,323.0 2006-11-17,321.0,321.0,321.0,318.0,320.0 2006-11-16,320.0,320.0,322.0,323.0,323.0 2006-11-15,321.0,321.0,321.0,317.0,320.0 2006-11-14,326.0,325.0,324.0,324.0,321.0 2006-11-13,333.0,333.0,333.0,326.0,326.0 2006-11-10,338.0,338.0,338.0,335.0,333.0 2006-11-09,329.0,329.0,328.0,331.0,338.0 2006-11-08,333.0,333.0,334.0,327.0,327.0 2006-11-07,334.0,332.0,332.0,335.0,335.0 2006-11-06,340.0,340.0,340.0,330.0,335.0 2006-11-03,326.0,326.0,325.0,330.0,333.0 2006-11-02,327.0,326.0,326.0,324.0,326.0 2006-11-01,323.0,323.0,324.0,326.0,326.0 2006-10-31,325.0,325.0,325.0,318.0,323.0 2006-10-30,,,325.0,325.0,325.0 2006-10-27,324.0,324.0,324.0,321.0,323.0 2006-10-26,325.0,324.0,324.0,323.0,326.0 2006-10-25,322.0,322.0,322.0,319.0,319.0 2006-10-24,319.0,318.0,318.0,320.0,323.0 2006-10-23,326.0,326.0,326.0,319.0,319.0 2006-10-20,337.0,337.0,334.0,329.0,329.0 2006-10-19,331.0,331.0,331.0,330.0,337.0 2006-10-18,320.0,320.0,320.0,326.0,334.0 2006-10-17,324.0,326.0,326.0,321.0,321.0 2006-10-16,318.0,321.0,320.0,324.0,324.0 2006-10-13,309.0,309.0,309.0,316.0,316.0 2006-10-12,305.0,308.0,308.0,310.0,310.0 2006-10-11,299.0,299.0,301.0,305.0,309.0 2006-10-10,304.0,308.0,308.0,299.0,299.0 2006-10-09,302.0,302.0,304.0,304.0,304.0 2006-10-06,301.0,301.0,301.0,297.0,297.0 2006-10-05,297.0,299.0,299.0,301.0,301.0 2006-10-04,300.0,298.0,298.0,302.0,297.0 2006-10-03,315.0,315.0,314.0,305.0,305.0 2006-10-02,,,322.0,315.0,315.0 2006-09-29,321.0,323.0,323.0,318.0,318.0 2006-09-28,320.0,323.0,323.0,323.0,323.0 2006-09-27,318.0,318.0,320.0,317.0,320.0 2006-09-26,318.0,318.0,319.0,318.0,318.0 2006-09-25,319.0,318.0,319.0,316.0,316.0 2006-09-22,310.0,310.0,313.0,325.0,322.0 2006-09-21,308.0,308.0,308.0,309.0,309.0 2006-09-20,307.0,307.0,308.0,311.0,311.0 2006-09-19,317.0,316.0,316.0,319.0,310.0 2006-09-18,313.0,313.0,313.0,306.0,312.0 2006-09-15,311.0,311.0,314.0,315.0,315.0 2006-09-14,317.0,317.0,317.0,332.0,326.0 2006-09-13,310.0,310.0,310.0,321.0,318.0 2006-09-12,311.0,323.0,322.0,320.0,314.0 2006-09-11,330.0,322.0,321.0,317.0,317.0 2006-09-08,347.0,345.0,345.0,323.0,330.0 2006-09-07,350.0,350.0,353.0,348.0,348.0 2006-09-06,351.0,351.0,351.0,351.0,356.0 2006-09-05,347.0,347.0,347.0,351.0,351.0 2006-09-04,346.0,346.0,347.0,346.0, 2006-09-01,348.0,345.0,346.0,346.0,346.0 2006-08-31,340.0,340.0,342.0,343.0,343.0 2006-08-30,339.0,341.0,340.0,339.0,340.0 2006-08-29,341.0,343.0,342.0,338.0,340.0 2006-08-28,345.0,345.0,345.0,345.0,345.0 2006-08-25,345.0,345.0,345.0,346.0,346.0 2006-08-24,345.0,345.0,347.0,348.0,348.0 2006-08-23,340.0,340.0,340.0,345.0,345.0 2006-08-22,347.0,347.0,346.0,340.0,340.0 2006-08-21,335.0,338.0,338.0,341.0,347.0 2006-08-18,332.0,334.0,333.0,335.0,335.0 2006-08-17,333.0,337.0,338.0,341.0,337.0 2006-08-16,326.0,325.0,324.0,334.0,337.0 2006-08-15,317.0,320.0,319.0,322.0,327.0 2006-08-14,320.0,320.0,320.0,314.0,319.0 2006-08-11,320.0,320.0,322.0,324.0,324.0 2006-08-10,326.0,326.0,327.0,326.0,324.0 2006-08-09,320.0,320.0,320.0,324.0,327.0 2006-08-08,327.0,325.0,324.0,320.0,320.0 2006-08-07,327.0,327.0,328.0,324.0,324.0 2006-08-04,324.0,324.0,324.0,327.0,327.0 2006-08-03,330.0,326.0,327.0,324.0,324.0 2006-08-02,319.0,319.0,322.0,325.0,330.0 2006-08-01,316.0,316.0,316.0,319.0,319.0 2006-07-31,315.0,315.0,317.0,313.0,316.0 2006-07-28,320.0,318.0,318.0,315.0,315.0 2006-07-27,315.0,315.0,318.0,320.0,320.0 2006-07-26,315.0,315.0,315.0,315.0,315.0 2006-07-25,314.0,314.0,315.0,314.0,317.0 2006-07-24,309.0,309.0,309.0,309.0,314.0 2006-07-21,308.0,311.0,310.0,310.0,310.0 2006-07-20,317.0,315.0,316.0,315.0,315.0 2006-07-19,308.0,308.0,311.0,311.0,318.0 2006-07-18,320.0,320.0,319.0,318.0,316.0 2006-07-17,333.0,333.0,333.0,321.0,321.0 2006-07-14,331.0,331.0,331.0,331.0,331.0 2006-07-13,330.0,328.0,328.0,331.0,331.0 2006-07-12,330.0,330.0,330.0,330.0,330.0 2006-07-11,318.0,320.0,323.0,326.0,330.0 2006-07-10,325.0,323.0,323.0,320.0,320.0 2006-07-07,329.0,329.0,329.0,327.0,327.0 2006-07-06,328.0,324.0,326.0,323.0,329.0 2006-07-05,328.0,328.0,330.0,328.0,328.0 2006-07-04,325.0,328.0,327.0,326.0, 2006-07-03,322.0,326.0,326.0,329.0, 2006-06-30,320.0,320.0,320.0,316.0,322.0 2006-06-29,309.0,309.0,307.0,314.0,314.0 2006-06-28,310.0,310.0,313.0,314.0,314.0 2006-06-27,318.0,320.0,320.0,318.0,318.0 2006-06-26,308.0,305.0,309.0,320.0,320.0 2006-06-23,310.0,304.0,305.0,306.0,310.0 2006-06-22,315.0,318.0,320.0,320.0,316.0 2006-06-21,303.0,306.0,308.0,311.0,315.0 2006-06-20,292.0,297.0,296.0,301.0,305.0 2006-06-19,307.0,304.0,303.0,302.0,297.0 2006-06-16,300.0,306.0,305.0,310.0,307.0 2006-06-15,290.0,290.0,292.0,300.0,300.0 2006-06-14,277.0,274.0,275.0,288.0,293.0 2006-06-13,313.0,308.0,307.0,286.0,277.0 2006-06-12,320.0,320.0,316.0,321.0,316.0 2006-06-09,317.0,313.0,313.0,327.0,327.0 2006-06-08,342.0,336.0,333.0,331.0,320.0 2006-06-07,348.0,346.0,346.0,335.0,343.0 2006-06-06,359.0,359.0,359.0,350.0,350.0 2006-06-05,356.0,356.0,358.0,363.0,363.0 2006-06-02,340.0,343.0,342.0,351.0,356.0 2006-06-01,347.0,345.0,345.0,340.0,340.0 2006-05-31,,,358.0,358.0,345.0 2006-05-30,352.0,350.0,355.0,359.0,358.0 2006-05-29,357.0,352.0,350.0,, 2006-05-26,355.0,353.0,354.0,354.0,354.0 2006-05-25,348.0,348.0,350.0,350.0,350.0 2006-05-24,358.0,362.0,365.0,352.0,352.0 2006-05-23,343.0,342.0,343.0,355.0,362.0 2006-05-22,350.0,345.0,345.0,340.0,340.0 2006-05-19,366.0,369.0,373.0,347.0,352.0 2006-05-18,372.0,375.0,376.0,380.0,375.0 2006-05-17,379.0,379.0,382.0,390.0,380.0 2006-05-16,368.0,370.0,366.0,379.0,379.0 2006-05-15,395.0,395.0,397.0,370.0,375.0 2006-05-12,400.0,396.0,398.0,407.0,399.0 2006-05-11,390.0,397.0,395.0,400.0,400.0 2006-05-10,394.0,397.0,398.0,390.0,390.0 2006-05-09,375.0,375.0,378.0,384.0,394.0 2006-05-08,380.0,380.0,381.0,377.0,375.0 2006-05-05,,,383.0,382.0,382.0 2006-05-04,379.0,379.0,378.0,379.0,379.0 2006-05-03,386.0,386.0,388.0,384.0,379.0 2006-05-02,377.0,377.0,380.0,380.0,384.0 2006-05-01,,,,380.0,380.0 2006-04-28,360.0,363.0,363.0,364.0,377.0 2006-04-27,368.0,365.0,367.0,364.0,364.0 2006-04-26,366.0,366.0,367.0,361.0,368.0 2006-04-25,356.0,355.0,355.0,362.0,362.0 2006-04-24,359.0,359.0,363.0,360.0,360.0 2006-04-21,344.0,348.0,347.0,352.0,359.0 2006-04-20,368.0,372.0,374.0,365.0,349.0 2006-04-19,366.0,364.0,364.0,371.0,374.0 2006-04-18,364.0,360.0,360.0,361.0,361.0 2006-04-17,,,,358.0,358.0 2006-04-13,347.0,342.0,341.0,346.0,349.0 2006-04-12,340.0,344.0,343.0,347.0,347.0 2006-04-11,359.0,359.0,360.0,359.0,345.0 2006-04-10,351.0,354.0,355.0,359.0,359.0 2006-04-07,352.0,352.0,354.0,351.0,351.0 2006-04-06,341.0,341.0,344.0,352.0,352.0 2006-04-05,,,336.0,341.0,341.0 2006-04-04,342.0,339.0,337.0,338.0,342.0 2006-04-03,332.0,337.0,338.0,341.0,345.0 2006-03-31,349.0,349.0,348.0,332.0,332.0 2006-03-30,338.0,341.0,343.0,349.0,349.0 2006-03-29,340.0,337.0,337.0,333.0,338.0 2006-03-28,340.0,344.0,345.0,340.0,340.0 2006-03-27,333.0,333.0,334.0,341.0,341.0 2006-03-24,321.0,321.0,320.0,326.0,333.0 2006-03-23,323.0,321.0,321.0,317.0,322.0 2006-03-22,317.0,318.0,322.0,320.0,324.0 2006-03-21,320.0,318.0,316.0,315.0,318.0 2006-03-20,318.0,318.0,319.0,317.0,317.0 2006-03-17,316.0,316.0,315.0,318.0,318.0 2006-03-16,315.0,314.0,314.0,316.0,316.0 2006-03-15,305.0,305.0,307.0,318.0,318.0 2006-03-14,300.0,300.0,300.0,302.0,306.0 2006-03-13,288.0,291.0,290.0,292.0,300.0 2006-03-10,289.0,289.0,289.0,288.0,288.0 2006-03-09,280.0,282.0,282.0,285.0,285.0 2006-03-08,291.0,289.0,289.0,285.0,282.0 2006-03-07,296.0,296.0,296.0,299.0,292.0 2006-03-06,307.0,304.0,302.0,302.0,297.0 2006-03-03,300.0,300.0,300.0,305.0,305.0 2006-03-02,297.0,297.0,296.0,294.0,300.0 2006-03-01,291.0,291.0,289.0,290.0,297.0 2006-02-28,284.0,284.0,285.0,288.0,291.0 2006-02-27,286.0,290.0,290.0,285.0,284.0 2006-02-24,283.0,285.0,286.0,286.0,286.0 2006-02-23,289.0,286.0,287.0,288.0,286.0 2006-02-22,293.0,293.0,293.0,292.0,289.0 2006-02-21,292.0,290.0,291.0,291.0,293.0 2006-02-20,292.0,292.0,292.0,292.0,292.0 2006-02-17,279.0,279.0,280.0,285.0,290.0 2006-02-16,276.0,276.0,278.0,275.0,279.0 2006-02-15,282.0,285.0,287.0,285.0,279.0 2006-02-14,273.0,270.0,274.0,278.0,282.0 2006-02-13,283.0,278.0,277.0,282.0,276.0 2006-02-10,304.0,298.0,297.0,296.0,285.0 2006-02-09,293.0,297.0,295.0,300.0,300.0 2006-02-08,288.0,288.0,287.0,290.0,290.0 2006-02-07,309.0,309.0,309.0,297.0,290.0 2006-02-06,317.0,317.0,320.0,305.0,312.0 2006-02-03,309.0,310.0,310.0,317.0,317.0 2006-02-02,294.0,296.0,295.0,300.0,305.0 2006-02-01,294.0,293.0,293.0,294.0,294.0 2006-01-31,,,282.0,293.0,295.0 2006-01-30,,,277.0,278.0,278.0 2006-01-27,275.0,275.0,276.0,275.0,275.0 2006-01-26,279.0,279.0,280.0,275.0,275.0 2006-01-25,275.0,275.0,275.0,279.0,279.0 2006-01-24,278.0,278.0,278.0,276.0,276.0 2006-01-23,276.0,278.0,277.0,278.0,278.0 2006-01-20,279.0,278.0,277.0,280.0,277.0 2006-01-19,273.0,275.0,275.0,273.0,277.0 2006-01-18,282.0,276.0,275.0,273.0,273.0 2006-01-17,289.0,286.0,286.0,281.0,283.0 2006-01-16,283.0,285.0,285.0,289.0,289.0 2006-01-13,273.0,273.0,273.0,275.0,281.0 2006-01-12,274.0,274.0,274.0,273.0,273.0 2006-01-11,274.0,274.0,274.0,271.0,274.0 2006-01-10,279.0,278.0,278.0,277.0,274.0 2006-01-09,272.0,272.0,274.0,275.0,278.0 2006-01-06,264.0,265.0,262.0,269.0,272.0 2006-01-05,274.0,274.0,272.0,263.0,263.0 2006-01-04,272.0,272.0,272.0,272.0,274.0 2006-01-03,260.0,262.0,262.0,267.0,267.0 """.strip() FETCHER_UNIVERSE_DATA = """ date,symbol 1/9/2006,aapl 1/9/2006,ibm 1/9/2006,msft 1/11/2006,aapl 1/11/2006,ibm 1/11/2006,msft 1/11/2006,yhoo """.strip() NON_ASSET_FETCHER_UNIVERSE_DATA = """ date,symbol 1/9/2006,foobarbaz 1/9/2006,bazfoobar 1/9/2006,barbazfoo 1/11/2006,foobarbaz 1/11/2006,bazfoobar 1/11/2006,barbazfoo 1/11/2006,foobarbaz """.strip() FETCHER_ALTERNATE_COLUMN_HEADER = "ARGLEBARGLE" FETCHER_UNIVERSE_DATA_TICKER_COLUMN = FETCHER_UNIVERSE_DATA.replace( "symbol", FETCHER_ALTERNATE_COLUMN_HEADER)
dna_seq1 = 'ACCTGATC' gc_count = 0 for nucl in dna_seq1: if nucl == 'G' or nucl == 'C': gc_count += 1 print(gc_count / len(dna_seq1))
class BaseLoadTester(object): def __init__(self, config): self.config = config def before(self): raise NotImplementedError() def on_result(self): raise NotImplementedError()
description = 'POLI monochromator devices' group = 'lowlevel' tango_base = 'tango://phys.poli.frm2:10000/poli/' s7_motor = tango_base + 's7_motor/' devices = dict( chi_m = device('nicos.devices.tango.Motor', description = 'monochromator tilt (chi axis)', tangodevice = s7_motor + 'chi_m', fmtstr = '%.2f', abslimits = (0, 12.7), precision = 0.01, ), theta_m = device('nicos.devices.tango.Motor', description = 'monochromator rotation (theta axis)', tangodevice = s7_motor + 'theta_m', fmtstr = '%.2f', abslimits = (0, 1300), precision = 0.1, ), x_m = device('nicos.devices.tango.Motor', description = 'monochromator translation (x axis)', tangodevice = s7_motor + 'x_m', fmtstr = '%.2f', abslimits = (0, 100), precision = 0.01, ), changer_m = device('nicos.devices.tango.Motor', description = 'monochromator changer axis', tangodevice = s7_motor + 'change_m', fmtstr = '%.2f', abslimits = (0, 4000), precision = 0.1, ), wavelength = device('nicos.devices.tas.Monochromator', description = 'monochromator wavelength', unit = 'A', dvalue = 3.355, theta = 'vmth', twotheta = 'vmtt', focush = None, focusv = None, abslimits = (0.1, 3.0), warnlimits = (0.1, 3.0), crystalside = 1, ), vmth = device('nicos.devices.generic.VirtualMotor', unit = 'deg', abslimits = (-90, 90), precision = 0.05, speed = 0, lowlevel = True, ), vmtt = device('nicos.devices.generic.VirtualMotor', unit = 'deg', abslimits = (-180, 180), precision = 0.05, speed = 0, lowlevel = True, ), #h_m = device('nicos.devices.generic.DeviceAlias', # ), #v_m = device('nicos.devices.generic.DeviceAlias', # ), #h_m_alias = device('nicos.devices.generic.ParamDevice', # lowlevel = True, # device = 'h_m', # parameter = 'alias', # ), #v_m_alias = device('nicos.devices.generic.ParamDevice', # lowlevel = True, # device = 'v_m', # parameter = 'alias', # ), #mono = device('nicos_mlz.poli.devices.mono.MultiSwitcher', # description = 'monochromator wavelength switcher', # # note: precision of chi and theta is so large because they are expected # # to be changed slightly depending on setup # moveables = ['x_m', 'changer_m', 'chi_m', 'theta_m', 'h_m_alias', 'v_m_alias'], # precision = [0.01, 0.01, 5, 10, None, None], # mapping = { # 0.9: [38, 190, 6.3, 236, 'cuh', 'cuv'], # 1.14: [45, 3.79, 8.6, 236, 'sih', 'siv'], # }, # changepos = 0, # ), )
# Advent of code 2021 : Day 1 | Part 1 # Author = Abhinav # Date = 1st of December 2021 # Source = [Advent Of Code](https://adventofcode.com/2021/day/1) # Solution : inputs = open("input.txt", "rt") inputs = list(map(int, inputs.read().splitlines())) print(sum([1 for _ in range(1, len(inputs)) if inputs[_-1] < inputs[_]])) # Answer : 1266
# hello.py """ This is an demo of a python script in the `py` package. """ #import api # cythonized max c api # basic examples a = 10 b = 1.5 c = "HELLO WORLD!!!" d = [1,2,3,4] e = ['a','b', 'c'] f = lambda: "hello func" g = lambda x: x+10 h = '"a"' e = '"double-quoted"' f = "'single-quoted'"
# coding=utf-8 # sum = 0 # i = 1 # while i < 100: # sum += i # i += 1 # print(sum) # while True: # n = int(input('请输入一个数字: ')) # print('你输入的数字是: %d' % n) # edge = 10 # n = int(input('请输入一个大于%d的整数: ' % edge)) # while n < 10: # print('输入错误,%d小于%d' % (n, edge)) # n = int(input('请输入一个大于%d的整数: ' % edge)) # else: # print('输入正确,%d大于%d' % (n, edge)) # while True: print('one line while.') # for i in range(10): # print(i) # l = ['alice', 'ranran', 'emma'] # for i in range(len(l)): # print(i, l[i]) # for letter in 'yueban': # if letter == 'e': # continue # print(letter) # if letter == 'a': # break # edge = 20 # for n in range(2, edge): # for x in range(2, n): # if n % x == 0: # print('%d = %d * %d' % (n, x, n//x)) # break # else: # print('%d 是质数' % (n)) for letter in 'yueban': if letter == 'e': pass print('there is a pass') print('current letter is %s' % letter)
class Charge: def __init__(self, vehicle): self._vehicle = vehicle self._api_client = vehicle._api_client async def get_state(self): return await self._api_client.get( "vehicles/{}/data_request/charge_state".format(self._vehicle.id)) async def start_charging(self): return await self._vehicle._command("charge_start") async def stop_charging(self): return await self._vehicle._command("charge_stop") async def set_charge_limit(self, percentage): percentage = round(percentage) if not (50 <= percentage <= 100): raise ValueError("Percentage should be between 50 and 100") return await self._vehicle._command("set_charge_limit", {"percent": percentage})
test = { 'name': 'q3_1_2', 'points': 1, 'suites': [ { 'cases': [ { 'code': ">>> #It looks like you didn't give anything the name;\n" ">>> # seconds_in_a_decade. Maybe there's a typo, or maybe you ;\n" '>>> # just need to run the cell below Question 3.2 where you defined ;\n' '>>> # seconds_in_a_decade. Click that cell and then click the "run;\n' '>>> # cell" button in the menu bar above.);\n' ">>> 'seconds_in_a_decade' in vars()\n" 'True', 'hidden': False, 'locked': False}, { 'code': ">>> # It looks like you didn't change the cell to define;\n" '>>> # seconds_in_a_decade appropriately. It should be a number,;\n' ">>> # computed using Python's arithmetic. For example, this is;\n" '>>> # almost right:;\n' '>>> # seconds_in_a_decade = 10*365*24*60*60;\n' '>>> seconds_in_a_decade != ...\n' 'True', 'hidden': False, 'locked': False}, { 'code': ">>> # It looks like you didn't account for leap years.;\n" '>>> # There were 2 leap years and 8 non-leap years in this period.;\n' '>>> # Leap years have 366 days instead of 365.;\n' '>>> seconds_in_a_decade != 315360000\n' 'True', 'hidden': False, 'locked': False}], 'scored': True, 'setup': '', 'teardown': '', 'type': 'doctest'}]}
# generated from catkin/cmake/template/pkg.context.pc.in CATKIN_PACKAGE_PREFIX = "" PROJECT_PKG_CONFIG_INCLUDE_DIRS = "/home/ros/lidar_ws/src/geometry/kdl_conversions/include;/opt/ros/kinetic/share/orocos_kdl/../../include;/usr/include/eigen3".split(';') if "/home/ros/lidar_ws/src/geometry/kdl_conversions/include;/opt/ros/kinetic/share/orocos_kdl/../../include;/usr/include/eigen3" != "" else [] PROJECT_CATKIN_DEPENDS = "geometry_msgs".replace(';', ' ') PKG_CONFIG_LIBRARIES_WITH_PREFIX = "-lkdl_conversions;/opt/ros/kinetic/lib/liborocos-kdl.so.1.3.2".split(';') if "-lkdl_conversions;/opt/ros/kinetic/lib/liborocos-kdl.so.1.3.2" != "" else [] PROJECT_NAME = "kdl_conversions" PROJECT_SPACE_DIR = "/home/ros/lidar_ws/devel" PROJECT_VERSION = "1.11.9"
if __name__ == '__main__': n = int(input()) answer = '' for i in range(n): answer += str(i + 1) print(answer)
def reset_io(buff): buff.seek(0) buff.truncate(0) return buff def truncate_io(buff, size): # get the remainder value buff.seek(size) leftover = buff.read() # remove the remainder buff.seek(0) buff.truncate(size) return leftover # def diesattheend(pool): # import atexit # def close(pool): # try: # pool.shutdown(wait=True) # except OSError: # handle is closed # pass # we already closed the pool # atexit.unregister(pool.__del__) # patch(pool, '__del__', close) # atexit.register(pool.__del__) # return pool # # def patch(obj, name, func): # from functools import wraps # oldfunc = getattr(obj, name, None) or (lambda: None) # def replaced(*a, **kw): # if oldfunc: # oldfunc(*a, **kw) # func(obj, *a, **kw) # replaced.__name__ = name # setattr(obj, name, wraps(oldfunc)(replaced) if oldfunc else replaced) class FakePool: def __init__(self, max_workers=None): pass def submit(self, func, *a, **kw): return FakeFuture(func(*a, **kw)) def shutdown(self, wait=None): pass class FakeFuture: def __init__(self, result): self._result = result def result(self): return self._result def add_done_callback(self, func): return func(self)
# This file is part of BenchExec, a framework for reliable benchmarking: # https://github.com/sosy-lab/benchexec # # SPDX-FileCopyrightText: 2007-2020 Dirk Beyer <https://www.sosy-lab.org> # # SPDX-License-Identifier: Apache-2.0 """Main package of BenchExec. The following modules are the public entry points: - benchexec: for executing benchmark suites - runexec: for executing single runs - check_cgroups: for checking the availability of cgroups - test_tool_info: for testing a tool-info module Naming conventions used within BenchExec: TOOL: a (verification) tool that should be executed EXECUTABLE: the executable file that should be called for running a TOOL INPUTFILE: one input file for the TOOL RUN: one execution of a TOOL on one INPUTFILE RUNSET: a set of RUNs of one TOOL with at most one RUN per INPUTFILE RUNDEFINITION: a template for the creation of a RUNSET with RUNS from one or more INPUTFILESETs BENCHMARK: a list of RUNDEFINITIONs and INPUTFILESETs for one TOOL OPTION: a user-specified option to add to the command-line of the TOOL when it its run CONFIG: the configuration of this script consisting of the command-line arguments given by the user EXECUTOR: a module for executing a BENCHMARK "run" always denotes a job to do and is never used as a verb. "execute" is only used as a verb (this is what is done with a run). A benchmark or a run set can also be executed, which means to execute all contained runs. Variables ending with "file" contain filenames. Variables ending with "tag" contain references to XML tag objects created by the XML parser. """ __version__ = "3.9-dev" class BenchExecException(Exception): pass
''' APDT: Ploting -------------------------- Provide useful data visualizaton tools. Check https://github.com/Zhiyuan-Wu/apdt for more information. '''
dead_emcal = [128, 129, 131, 134, 139, 140, 182, 184, 188, 189, 385, 394, 397, 398, 399, 432, 434, 436, 440, 442, 5024, 5025, 5026, 5027, 5028, 5030, 5032, 5033, 5035, 5036, 5037, 5038, 5039, 5121, 5122, 5123, 5124, 5125, 5126, 5128, 5129, 5130, 5132, 5133, 5134, 5135, 5170, 5172, 5173, 5174, 5178, 5181, 6641, 6647, 6654, 6933, 6936, 6941, 6986, 6987, 6990, 8590, 8624, 8626, 8631, 8637, 10580, 10583, 10585, 10586, 10588, 10590, 10591, 10624, 10625, 10626, 10627, 10629, 10630, 10631, 10632, 10636, 10637, 10639, 11232, 11234, 11235, 11236, 11237, 11238, 11239, 11241, 11242, 11244, 11245, 11247, 11280, 11281, 11282, 11283, 11285, 11286, 11287, 11289, 11290, 11292, 11294, 11295] dead_dcal = [12608, 12831, 12860, 13466, 13470, 13981, 14231, 14312, 14404, 14693, 14695, 14729, 15214, 15215, 15281, 15285, 15323, 15327, 15330, 15332, 15334, 15335, 15336, 15872, 15968, 15970, 15971, 16016, 16017, 16018, 16029, 16030, 16535, 16541, 16577, 16579, 16583, 16610, 16613, 16622, 16659, 16663, 16666, 16824, 17644, 17663] bad_emcal = [3, 15, 56, 57, 58, 59, 60, 61, 62, 63, 74, 103, 130, 132, 133, 135, 136, 137, 138, 141, 142, 143, 176, 177, 178, 179, 180, 181, 183, 185, 186, 187, 190, 191, 198, 287, 288, 289, 290, 291, 292, 293, 294, 295, 297, 298, 299, 300, 301, 302, 303, 328, 336, 337, 338, 339, 340, 341, 343, 344, 345, 346, 347, 348, 349, 350, 353, 384, 386, 387, 388, 389, 390, 391, 392, 393, 395, 396, 433, 435, 437, 438, 439, 441, 443, 444, 445, 446, 447, 554, 594, 655, 720, 759, 917, 1002, 1038, 1050, 1061, 1067, 1175, 1204, 1212, 1222, 1276, 1288, 1366, 1376, 1380, 1384, 1386, 1414, 1441, 1519, 1534, 1535, 1704, 1711, 1738, 1825, 1836, 1837, 1838, 1839, 1844, 1860, 1892, 1963, 1967, 1968, 2014, 2020, 2022, 2026, 2047, 2112, 2113, 2114, 2115, 2116, 2117, 2118, 2119, 2120, 2122, 2123, 2124, 2125, 2127, 2161, 2196, 2210, 2245, 2298, 2325, 2389, 2395, 2397, 2399, 2424, 2487, 2505, 2506, 2533, 2534, 2540, 2575, 2581, 2586, 2665, 2688, 2776, 2778, 2787, 2793, 2797, 2805, 2823, 2824, 2825, 2857, 2884, 2888, 2891, 2915, 2921, 2985, 3039, 3051, 3135, 3161, 3196, 3223, 3236, 3244, 3259, 3297, 3339, 3353, 3488, 3503, 3732, 3740, 3748, 3754, 3772, 3776, 3777, 3778, 3779, 3780, 3781, 3782, 3783, 3784, 3785, 3786, 3787, 3788, 3789, 3790, 3791, 3796, 3824, 3825, 3826, 3827, 3828, 3829, 3830, 3831, 3832, 3833, 3834, 3835, 3839, 3840, 3854, 3906, 3908, 3914, 3940, 3962, 3974, 4011, 4026, 4027, 4058, 4129, 4212, 4230, 4282, 4299, 4320, 4372, 4421, 4516, 4530, 4531, 4532, 4538, 4543, 4569, 4571, 4596, 4605, 4613, 4614, 4621, 4627, 4637, 4817, 4835, 4837, 4838, 4839, 4846, 4847, 4967, 5029, 5031, 5034, 5120, 5127, 5131, 5168, 5169, 5171, 5175, 5176, 5177, 5179, 5180, 5182, 5183, 5231, 5328, 5329, 5330, 5331, 5332, 5333, 5334, 5335, 5336, 5337, 5338, 5339, 5340, 5341, 5343, 5448, 5608, 5662, 5663, 5824, 5826, 5831, 5832, 5833, 5850, 6064, 6080, 6081, 6082, 6083, 6084, 6085, 6086, 6087, 6088, 6089, 6090, 6091, 6092, 6093, 6094, 6095, 6104, 6128, 6129, 6130, 6131, 6132, 6133, 6134, 6135, 6136, 6137, 6138, 6139, 6140, 6141, 6142, 6143, 6184, 6275, 6331, 6340, 6481, 6640, 6645, 6646, 6649, 6701, 6735, 6811, 6886, 6928, 6929, 6930, 6931, 6932, 6934, 6935, 6937, 6938, 6939, 6940, 6942, 6943, 6976, 6977, 6978, 6979, 6980, 6981, 6982, 6983, 6984, 6985, 6988, 6989, 6991, 7089, 7150, 7371, 7417, 7425, 7430, 7491, 7572, 7793, 8000, 8001, 8002, 8004, 8005, 8006, 8007, 8008, 8009, 8012, 8013, 8014, 8047, 8051, 8052, 8053, 8054, 8055, 8060, 8061, 8062, 8063, 8244, 8260, 8275, 8340, 8352, 8353, 8356, 8357, 8372, 8420, 8453, 8576, 8577, 8578, 8579, 8580, 8581, 8582, 8583, 8584, 8585, 8586, 8587, 8588, 8589, 8591, 8610, 8625, 8627, 8628, 8629, 8630, 8632, 8633, 8634, 8635, 8636, 8638, 8639, 8724, 8807, 8809, 8813, 8855, 8904, 8906, 8907, 8911, 8916, 8938, 8944, 8976, 9078, 9202, 9217, 9269, 9275, 9282, 9286, 9291, 9338, 9354, 9357, 9361, 9533, 9598, 9703, 9706, 9769, 9798, 9801, 9802, 9807, 9819, 9849, 9872, 9874, 9878, 9927, 9940, 9942, 9943, 9945, 9951, 9960, 9982, 9983, 10091, 10138, 10139, 10142, 10164, 10171, 10203, 10326, 10363, 10451, 10462, 10505, 10558, 10560, 10561, 10562, 10563, 10564, 10565, 10566, 10567, 10568, 10569, 10570, 10571, 10572, 10573, 10574, 10575, 10576, 10577, 10578, 10579, 10581, 10582, 10584, 10587, 10589, 10608, 10609, 10610, 10611, 10612, 10613, 10614, 10615, 10616, 10617, 10618, 10619, 10620, 10621, 10622, 10623, 10628, 10633, 10634, 10635, 10638, 10655, 10666, 10750, 10751, 10759, 10798, 10823, 10829, 10831, 10921, 10981, 10982, 10988, 11034, 11042, 11044, 11048, 11050, 11052, 11091, 11093, 11095, 11097, 11099, 11102, 11141, 11148, 11150, 11197, 11198, 11233, 11240, 11243, 11246, 11284, 11288, 11291, 11293, 11411, 11462, 11534, 11551, 11630, 11647, 11738, 11904, 11905, 12033, 12035, 12046, 12047, 12117, 12127, 12147, 12160, 12161, 12162, 12163, 12164, 12165, 12166, 12167, 12168, 12169, 12170, 12171, 12172, 12173, 12174, 12175, 12271, 12276, 12280, 12282, 12286] bad_dcal = [12320, 12321, 12322, 12323, 12324, 12325, 12326, 12327, 12328, 12329, 12330, 12331, 12332, 12333, 12334, 12335, 12368, 12369, 12370, 12371, 12372, 12373, 12374, 12375, 12376, 12377, 12378, 12379, 12380, 12381, 12382, 12383, 12384, 12385, 12386, 12387, 12388, 12389, 12390, 12391, 12392, 12393, 12394, 12395, 12396, 12397, 12398, 12399, 12432, 12433, 12434, 12435, 12436, 12437, 12438, 12439, 12440, 12441, 12442, 12443, 12444, 12445, 12446, 12447, 12487, 12604, 12607, 12609, 12610, 12613, 12614, 12615, 12616, 12617, 12618, 12620, 12621, 12622, 12623, 12800, 12801, 12802, 12803, 12805, 12806, 12807, 12809, 12810, 12811, 12812, 12813, 12814, 12815, 12818, 12821, 12822, 12823, 12826, 12827, 12828, 12829, 12830, 12848, 12850, 12856, 12857, 12858, 12859, 12862, 12914, 12915, 12918, 12922, 12925, 12927, 12988, 13049, 13053, 13055, 13056, 13058, 13059, 13064, 13068, 13120, 13122, 13123, 13126, 13128, 13130, 13131, 13156, 13248, 13249, 13280, 13282, 13284, 13287, 13288, 13290, 13292, 13294, 13392, 13394, 13395, 13398, 13399, 13400, 13402, 13403, 13405, 13406, 13407, 13433, 13458, 13459, 13460, 13462, 13463, 13464, 13465, 13467, 13469, 13471, 13476, 13477, 13478, 13479, 13481, 13483, 13485, 13486, 13487, 13508, 13510, 13512, 13517, 13524, 13553, 13556, 13558, 13559, 13574, 13578, 13589, 13630, 13780, 13786, 13798, 13828, 13835, 13848, 13903, 13921, 13926, 13933, 13953, 13968, 13969, 13972, 13973, 13975, 13980, 13983, 13988, 14017, 14058, 14060, 14081, 14116, 14117, 14119, 14123, 14125, 14126, 14153, 14157, 14191, 14193, 14207, 14225, 14228, 14229, 14233, 14234, 14236, 14237, 14239, 14247, 14249, 14254, 14255, 14302, 14303, 14304, 14305, 14306, 14307, 14308, 14309, 14311, 14313, 14314, 14315, 14317, 14318, 14319, 14320, 14325, 14326, 14362, 14363, 14373, 14374, 14398, 14400, 14402, 14403, 14406, 14407, 14409, 14410, 14411, 14412, 14413, 14414, 14415, 14432, 14433, 14434, 14435, 14436, 14437, 14438, 14439, 14440, 14441, 14442, 14443, 14444, 14445, 14446, 14447, 14480, 14481, 14482, 14483, 14484, 14485, 14486, 14487, 14488, 14489, 14490, 14491, 14492, 14493, 14494, 14495, 14498, 14501, 14502, 14503, 14505, 14544, 14545, 14546, 14549, 14550, 14553, 14554, 14557, 14558, 14559, 14592, 14593, 14594, 14597, 14598, 14602, 14604, 14605, 14607, 14608, 14609, 14610, 14611, 14613, 14616, 14617, 14618, 14621, 14622, 14623, 14624, 14625, 14626, 14627, 14628, 14629, 14630, 14631, 14632, 14633, 14634, 14635, 14636, 14637, 14638, 14639, 14640, 14647, 14657, 14659, 14660, 14661, 14662, 14663, 14668, 14669, 14671, 14672, 14679, 14688, 14689, 14690, 14691, 14692, 14694, 14697, 14698, 14700, 14701, 14702, 14703, 14704, 14705, 14706, 14707, 14708, 14709, 14711, 14712, 14713, 14716, 14717, 14721, 14722, 14723, 14724, 14725, 14726, 14727, 14728, 14730, 14731, 14732, 14733, 14734, 14735, 14736, 14737, 14738, 14739, 14740, 14741, 14742, 14744, 14745, 14746, 14747, 14748, 14749, 14750, 14752, 14753, 14754, 14755, 14756, 14757, 14758, 14759, 14760, 14761, 14762, 14763, 14764, 14765, 14766, 14767, 14768, 14770, 14772, 14773, 14774, 14775, 14776, 14777, 14779, 14782, 14783, 14839, 14862, 14867, 14872, 14874, 14895, 14977, 14980, 14991, 14993, 15009, 15012, 15015, 15020, 15021, 15027, 15033, 15094, 15096, 15137, 15140, 15143, 15152, 15154, 15155, 15158, 15162, 15164, 15200, 15201, 15202, 15203, 15204, 15205, 15206, 15207, 15208, 15209, 15210, 15211, 15212, 15213, 15217, 15266, 15272, 15276, 15280, 15282, 15284, 15286, 15287, 15288, 15289, 15290, 15291, 15292, 15293, 15294, 15295, 15296, 15298, 15299, 15314, 15315, 15318, 15328, 15331, 15333, 15338, 15339, 15341, 15342, 15343, 15345, 15354, 15359, 15398, 15445, 15460, 15463, 15469, 15470, 15476, 15624, 15670, 15690, 15719, 15754, 15776, 15777, 15785, 15821, 15870, 15877, 15908, 15936, 15947, 15949, 15955, 15958, 15963, 15965, 15967, 15969, 15972, 15979, 15980, 15981, 15982, 15983, 16019, 16026, 16028, 16031, 16082, 16083, 16088, 16089, 16090, 16091, 16094, 16215, 16258, 16268, 16304, 16306, 16307, 16308, 16311, 16317, 16349, 16395, 16422, 16428, 16429, 16431, 16440, 16442, 16443, 16446, 16466, 16467, 16468, 16469, 16472, 16473, 16474, 16475, 16476, 16477, 16478, 16479, 16481, 16482, 16483, 16488, 16489, 16491, 16492, 16493, 16496, 16497, 16498, 16500, 16501, 16502, 16506, 16509, 16510, 16511, 16528, 16529, 16530, 16531, 16532, 16533, 16534, 16536, 16537, 16538, 16539, 16540, 16542, 16543, 16576, 16578, 16580, 16581, 16582, 16584, 16585, 16586, 16587, 16588, 16589, 16590, 16591, 16608, 16609, 16611, 16612, 16614, 16615, 16616, 16617, 16618, 16619, 16620, 16621, 16623, 16634, 16656, 16657, 16658, 16660, 16661, 16662, 16664, 16665, 16667, 16668, 16669, 16670, 16671, 16784, 16785, 16789, 16821, 16826, 16830, 16886, 16907, 16911, 16927, 17046, 17088, 17089, 17090, 17091, 17097, 17107, 17117, 17202, 17203, 17204, 17206, 17232, 17233, 17234, 17236, 17237, 17249, 17265, 17291, 17295, 17296, 17312, 17313, 17314, 17315, 17316, 17317, 17318, 17319, 17320, 17321, 17322, 17323, 17324, 17325, 17326, 17327, 17328, 17329, 17330, 17331, 17332, 17333, 17334, 17335, 17336, 17337, 17338, 17339, 17340, 17341, 17342, 17343, 17352, 17377, 17381, 17396, 17452, 17463, 17537, 17597, 17632, 17633, 17634, 17635, 17636, 17637, 17638, 17639, 17640, 17641, 17642, 17643, 17645, 17646, 17647, 17648, 17649, 17650, 17651, 17652, 17653, 17654, 17655, 17656, 17657, 17658, 17659, 17660, 17661, 17662] warm_emcal = [15, 594, 1276, 1384, 2113, 2127, 2389, 2778, 3135, 4299, 4531, 4569, 4571, 4605, 5608, 5832, 6340, 6640, 6646, 6886, 8000, 8001, 8004, 8005, 8006, 8007, 8009, 8014, 8051, 8052, 8053, 8054, 8055, 8061, 8813, 8855, 8904, 8906, 8907, 8911, 8944, 9202, 9217, 9819, 9849, 9872, 9878, 10091, 10462, 10558, 10655, 10750, 10751, 10798, 11034, 11042, 11044, 11050, 11052, 11093, 11095, 11097, 11099, 11102, 11148, 11150, 11197, 11198, 11411, 11534, 11551, 11647, 11904, 12033, 12035, 12046, 12047, 12117, 12127, 12271, 12276, 12280, 12282, 12286] warm_dcal = [12609, 12610, 12613, 12615, 12616, 12617, 12618, 12620, 12807, 12811, 12812, 12813, 12818, 12823, 12829, 12830, 12850, 12858, 12914, 12922, 12988, 13056, 13058, 13120, 13128, 13130, 13131, 13288, 13395, 13398, 13399, 13405, 13458, 13462, 13463, 13469, 13477, 13479, 13481, 13483, 13486, 13487, 13512, 13517, 13553, 13574, 13630, 13780, 13786, 13798, 13848, 13921, 13973, 13975, 13980, 13983, 14058, 14081, 14116, 14126, 14304, 14320, 14326, 14362, 14363, 14400, 14402, 14407, 14409, 14411, 14412, 14414, 14498, 14501, 14545, 14546, 14593, 14597, 14609, 14613, 14621, 14622, 14623, 14657, 14659, 14661, 14671, 14703, 14705, 14706, 14707, 14708, 14716, 14717, 14721, 14722, 14725, 14728, 14731, 14739, 14740, 14746, 14748, 14749, 14752, 14759, 14762, 14768, 14770, 14774, 14776, 14777, 14782, 14783, 14874, 15027, 15154, 15158, 15162, 15280, 15284, 15287, 15289, 15290, 15292, 15293, 15298, 15314, 15315, 15341, 15342, 15460, 15470, 15476, 15776, 15947, 15967, 16082, 16083, 16090, 16306, 16308, 16431, 16442, 16466, 16469, 16472, 16475, 16483, 16489, 16491, 16497, 16502, 16510, 16907, 16911, 16927, 17088, 17090, 17107, 17296, 17352, 17396, 17452, 17463] bad_all = dead_emcal + dead_dcal + bad_emcal + bad_dcal + warm_emcal + warm_dcal
#!/usr/bin/python3 #---------------------- Begin Serializer Boilerplate for GAPS ------------------------ HHEAD='''#ifndef GMA_HEADER_FILE #define GMA_HEADER_FILE #pragma pack(1) #include <stdio.h> #include <stdint.h> #include <string.h> #include <stdlib.h> #include <unistd.h> #include <inttypes.h> #include <arpa/inet.h> #include <float.h> #include "float754.h" #define id(X) (X) typedef struct _trailer_datatype { uint32_t seq; uint32_t rqr; uint32_t oid; uint16_t mid; uint16_t crc; } trailer_datatype; ''' HTAIL='''#endif ''' FLOATH='''#ifndef _FLOAT_H_ #define _FLOAT_H_ /* Network order for double/float: 0 = Little endian, 1 = Big endian */ /* Currently our DFDL uses littleEndian network order for float and double */ /* This choice was based on the convention used by the shapeFile format */ /* We are preserving bigEndian order for all integer types including uint64_t */ #define FLOAT_BIG_ENDIAN 0 #define big_end_test (1==htonl(1)) #define swap_uint16(x) (((uint16_t) ((x) & 0xFF) << 8) | (((x) & 0xFF00) >> 8)) #define swap_uint32(x) (((uint32_t)swap_uint16((x) & 0xFFFF) << 16) | swap_uint16((x) >> 16)) #define swap_uint64(x) (((uint64_t)swap_uint32((x) & 0xFFFFFFFF) << 32) | swap_uint32((x) >> 32)) #define my_htoxll(x) (big_end_test ? swap_uint64(x) : (x)) #define my_htoxl(x) (big_end_test ? swap_uint32(x) : (x)) #define my_htonll(x) (big_end_test ? (x) : swap_uint64(x)) #define my_htonl(x) (big_end_test ? (x) : swap_uint32(x)) /* Functions / macros called by user */ #define htonll(x) my_htonll(x) #define ntohll(x) my_htonll(x) extern uint32_t htonf(float); extern float ntohf(uint32_t); extern uint64_t htond(long double); extern long double ntohd(uint64_t); #endif /* _FLOAT_H_ */ ''' FLOATC='''/* * FLOAT.C * IEEE-754 uint64_t encoding/decoding, plus conversion macros into/from network (x865) byte order * * 1) Pack (double/float) encoder and decoder using: https://beej.us/guide/bgnet/examples/ieee754.c * a) uint64_t = 1-bit Sign (1=-), 11-bit Biased Exponent (BE), 52-bit Normalised Mantisa (NM) * e.g., 85.125 = 1.010101001 x 2^6 => S=0, BE=(bias=1023)+(6)=10000000101, NM=010101001000000... * n) uint32_t = 1-bit Sign (1=-), 8-bit Biased Exponent (BE), 23-bit Normalised Mantisa (NM) * * 2) Endian converter changes byte order between host encoded (uint_xx_t) and big-endian network format (unless FLOAT_BIG_ENDIAN=0, in which case it converts to a little-endian network format) */ #include <stdio.h> #include <stdint.h> #include <inttypes.h> #include <arpa/inet.h> #include "float754.h" #define pack754_32(f) (pack754((f), 32, 8)) #define pack754_64(f) (pack754((f), 64, 11)) #define unpack754_32(i) (unpack754((i), 32, 8)) #define unpack754_64(i) (unpack754((i), 64, 11)) /* Encoding into IEEE-754 encoded double */ uint64_t pack754(long double f, unsigned bits, unsigned expbits) { long double fnorm; int shift; long long sign, exp, significand; unsigned significandbits = bits - expbits - 1; // -1 for sign bit if (f == 0.0) return 0; // get this special case out of the way // check sign and begin normalization if (f < 0) { sign = 1; fnorm = -f; } else { sign = 0; fnorm = f; } // get the normalized form of f and track the exponent shift = 0; while(fnorm >= 2.0) { fnorm /= 2.0; shift++; } while(fnorm < 1.0) { fnorm *= 2.0; shift--; } fnorm = fnorm - 1.0; // calculate the binary form (non-float) of the significand data significand = fnorm * ((1LL<<significandbits) + 0.5f); // get the biased exponent exp = shift + ((1<<(expbits-1)) - 1); // shift + bias // return the final answer return (sign<<(bits-1)) | (exp<<(bits-expbits-1)) | significand; } /* Decoding from IEEE-754 encoded double */ long double unpack754(uint64_t i, unsigned bits, unsigned expbits) { long double result; long long shift; unsigned bias; unsigned significandbits = bits - expbits - 1; // -1 for sign bit if (i == 0) return 0.0; // pull the significand result = (i&((1LL<<significandbits)-1)); // mask result /= (1LL<<significandbits); // convert back to float result += 1.0f; // add the one back on // deal with the exponent bias = (1<<(expbits-1)) - 1; shift = ((i>>significandbits)&((1LL<<expbits)-1)) - bias; while(shift > 0) { result *= 2.0; shift--; } while(shift < 0) { result /= 2.0; shift++; } // sign it result *= (i>>(bits-1))&1? -1.0: 1.0; return result; } /* Converts host float by encoding into IEEE-754 uint32_t and putting into Network byte order */ uint32_t htonf(float f) { uint32_t h = pack754_32(f); if (FLOAT_BIG_ENDIAN != 0) return ((my_htonl(h))); /* to Network Big-Endian */ else return ((my_htoxl(h))); /* to Network Little-Endian */ } /* Converts IEEE-754 uint32_t in Network byte order into host float */ float ntohf(uint32_t i) { uint32_t h; if (FLOAT_BIG_ENDIAN != 0) h = (my_htonl(i)); /* from Network Big-Endian */ else h = (my_htoxl(i)); /* from Network Little-Endian */ return (unpack754_32(h)); } /* Converts host double by encoding into IEEE-754 uint64_t and putting into Network byte order */ uint64_t htond(long double f) { uint64_t h = pack754_64(f); if (FLOAT_BIG_ENDIAN != 0) return ((my_htonll(h))); /* to Network Big-Endian */ else return ((my_htoxll(h))); /* to Network Little-Endian */ } /* Converts IEEE-754 uint64_t in Network byte order into host double */ long double ntohd(uint64_t i) { uint64_t h; if (FLOAT_BIG_ENDIAN != 0) h = (my_htonll(i)); /* from Network Big-Endian */ else h = (my_htoxll(i)); /* from Network Little-Endian */ return (unpack754_64(h)); } ''' #---------------------- End Serializer Boilerplate for GAPS ------------------------ cintyp = { 'double': 'double', 'ffloat': 'float', 'int8': 'int8_t', 'uint8': 'uint8_t', 'int16': 'int16_t', 'uint16': 'uint16_t', 'int32': 'int32_t', 'uint32': 'uint32_t', 'int64': 'int64_t', 'uint64': 'uint64_t' } coutyp = { 'double': 'uint64_t', 'ffloat': 'uint32_t', 'int8': 'int8_t', 'uint8': 'uint8_t', 'int16': 'int16_t', 'uint16': 'uint16_t', 'int32': 'int32_t', 'uint32': 'uint32_t', 'int64': 'int64_t', 'uint64': 'uint64_t' } fmtstr = { 'double': '%lf', 'ffloat': '%f', 'int8': '%hd', 'uint8': '%hu', 'int16': '%hd', 'uint16': '%hu', 'int32': '%d', 'uint32': '%u', 'int64': '%ld', 'uint64': '%lu' } encfn = { 'double': 'htond', 'ffloat': 'htonf', 'int8': 'id', 'uint8': 'id', 'int16': 'htons', 'uint16': 'htons', 'int32': 'htonl', 'uint32': 'htonl', 'int64': 'htonll', 'uint64': 'htonll' } decfn = { 'double': 'ntohd', 'ffloat': 'ntohf', 'int8': 'id', 'uint8': 'id', 'int16': 'ntohs', 'uint16': 'ntohs', 'int32': 'ntohl', 'uint32': 'ntohl', 'int64': 'ntohll', 'uint64': 'ntohll' } class CodecWriter: def __init__(self,typbase=0): self.typbase=typbase def make_scalar(self,d,f,ser,inp): appstr = '' if ser == 'header': t = cintyp[f[0]] if inp else coutyp[f[0]] appstr += ' ' + t + ' ' + f[1] + ';' + '\n' elif ser == 'printer': appstr += ' ' + 'fprintf(stderr, " ' + fmtstr[f[0]] + ',", ' + d + '->' + f[1] + ');' + '\n' elif ser == 'encoder': appstr += ' ' + 'p2->' + f[1] + ' = ' + encfn[f[0]] + '(p1->' + f[1] + ');' + '\n' elif ser == 'decoder': appstr += ' ' + 'p2->' + f[1] + ' = ' + decfn[f[0]] + '(p1->' + f[1] + ');' + '\n' elif ser == 'sizeof': appstr += 'sizeof(' + cintyp[f[0]] + ') + ' else: raise Exception('Unknown serializarion: ' + ser) return appstr def make_array(self,d,f,ser,inp): appstr = '' if ser == 'header': t = cintyp[f[0]] if inp else coutyp[f[0]] appstr += ' ' + t + ' ' + f[1] + '[' + str(f[2]) + '];' + '\n' elif ser == 'printer': appstr += ' for (int i=0; i<' + str(f[2]) + '; i++) {' + '\n' appstr += ' ' + 'fprintf(stderr, " ' + fmtstr[f[0]] + ',", ' + d + '->' + f[1] + '[i]);' + '\n' appstr += ' }' + '\n' elif ser == 'encoder': appstr += ' for (int i=0; i<' + str(f[2]) + '; i++) {' + '\n' appstr += ' ' + 'p2->' + f[1] + '[i] = ' + encfn[f[0]] + '(p1->' + f[1] + '[i]);' + '\n' appstr += ' }' + '\n' elif ser == 'decoder': appstr += ' for (int i=0; i<' + str(f[2]) + '; i++) {' + '\n' appstr += ' ' + 'p2->' + f[1] + '[i] = ' + decfn[f[0]] + '(p1->' + f[1] + '[i]);' + '\n' appstr += ' }' + '\n' elif ser == 'sizeof': appstr += 'sizeof(' + cintyp[f[0]] + ') * ' + str(f[2]) + ' + ' else: raise Exception('Unknown serialization: ' + ser) return appstr def make_dtyp_enum(self,tree): dtypid = 0 appstr = '' appstr += '#ifndef TYP_BASE' + '\n' appstr += '#define TYP_BASE ' + str(self.typbase) + '\n' appstr += '#endif /* TYP_BASE */' + '\n' for dtypnm in [l[0] for l in tree]: dtypid += 1 appstr += '#define DATA_TYP_' + dtypnm.upper() + ' TYP_BASE + ' + str(dtypid) + '\n' return appstr + '\n' def make_structs(self,dtypnm,flds,inp=True): appstr = '' d = dtypnm.lower() istr = 'datatype' if inp else 'output' appstr += 'typedef struct _' + d + '_' + istr + ' {' + '\n' for f in flds: if len(f) == 2: appstr += self.make_scalar(d,f,'header',inp) elif len(f) == 3: appstr += self.make_array(d,f,'header',inp) else: raise Exception('Unhandled field: ' + f) appstr += ' trailer_datatype trailer;' + '\n' appstr += '} ' + d + '_' + istr + ';' + '\n' return appstr + '\n' def make_dtyp_struct(self,tree): appstr = '' for l in tree: appstr += self.make_structs(l[0], l[1:],True) appstr += self.make_structs(l[0], l[1:], False) return appstr def make_fn_sigs(self,tree): dtypid = 0 appstr = '' for dtypnm in [l[0] for l in tree]: dtypid += 1 d = dtypnm.lower() appstr += 'extern void ' + d + '_print (' + d + '_datatype *' + d + ');' + '\n' appstr += 'extern void ' + d + '_data_encode (void *buff_out, void *buff_in, size_t *len_out);' + '\n' appstr += 'extern void ' + d + '_data_decode (void *buff_out, void *buff_in, size_t *len_in);' + '\n' appstr += '\n' return appstr def make_print_fn(self,l): appstr = '' d = l[0].lower() appstr += 'void ' + d + '_print (' + d + '_datatype *' + d + ') {' + '\n' appstr += ' fprintf(stderr, "' + d + '(len=%ld): ", sizeof(*' + d + '));' + '\n' for f in l[1:]: if len(f) == 2: appstr += self.make_scalar(d,f,'printer',True) elif len(f) == 3: appstr += self.make_array(d,f,'printer',True) else: raise Exception('Unhandled field: ' + f) appstr += ' fprintf(stderr, " %u, %u, %u, %hu, %hu\\n",' + '\n' appstr += ' ' + d + '->trailer.seq,' + '\n' appstr += ' ' + d + '->trailer.rqr,' + '\n' appstr += ' ' + d + '->trailer.oid,' + '\n' appstr += ' ' + d + '->trailer.mid,' + '\n' appstr += ' ' + d + '->trailer.crc);' + '\n' appstr += '}' + '\n\n' return appstr def make_encode_fn(self,l): appstr = '' d = l[0].lower() appstr += 'void ' + d + '_data_encode (void *buff_out, void *buff_in, size_t *len_out) {' + '\n' appstr += ' ' + d + '_datatype *p1 = (' + d + '_datatype *) buff_in;' + '\n' appstr += ' ' + d + '_output *p2 = (' + d + '_output *) buff_out;' + '\n' for f in l[1:]: if len(f) == 2: appstr += self.make_scalar(d,f,'encoder',True) elif len(f) == 3: appstr += self.make_array(d,f,'encoder',True) else: raise Exception('Unhandled field: ' + f) appstr += ' p2->trailer.seq = htonl(p1->trailer.seq);' + '\n' appstr += ' p2->trailer.rqr = htonl(p1->trailer.rqr);' + '\n' appstr += ' p2->trailer.oid = htonl(p1->trailer.oid);' + '\n' appstr += ' p2->trailer.mid = htons(p1->trailer.mid);' + '\n' appstr += ' p2->trailer.crc = htons(p1->trailer.crc);' + '\n' appstr += ' *len_out = ' for f in l[1:]: if len(f) == 2: appstr += self.make_scalar(d,f,'sizeof',True) elif len(f) == 3: appstr += self.make_array(d,f,'sizeof',True) appstr += 'sizeof(trailer_datatype);' + '\n' appstr += '}' + '\n\n' return appstr def make_decode_fn(self,l): appstr = '' d = l[0].lower() appstr += 'void ' + d + '_data_decode (void *buff_out, void *buff_in, size_t *len_in) {' + '\n' appstr += ' ' + d + '_output *p1 = (' + d + '_output *) buff_in;' + '\n' appstr += ' ' + d + '_datatype *p2 = (' + d + '_datatype *) buff_out;' + '\n' for f in l[1:]: if len(f) == 2: appstr += self.make_scalar(d,f,'decoder',True) elif len(f) == 3: appstr += self.make_array(d,f,'decoder',True) else: raise Exception('Unhandled field: ' + f) appstr += ' p2->trailer.seq = ntohl(p1->trailer.seq);' + '\n' appstr += ' p2->trailer.rqr = ntohl(p1->trailer.rqr);' + '\n' appstr += ' p2->trailer.oid = ntohl(p1->trailer.oid);' + '\n' appstr += ' p2->trailer.mid = ntohs(p1->trailer.mid);' + '\n' appstr += ' p2->trailer.crc = ntohs(p1->trailer.crc);' + '\n' appstr += '}' + '\n\n' return appstr def writeheader(self, outfname, tree): try: hstr = HHEAD hstr += self.make_dtyp_enum(tree) hstr += self.make_dtyp_struct(tree) hstr += self.make_fn_sigs(tree) hstr += HTAIL with open(outfname + '.h', 'w') as f: f.write(hstr) except Exception as e: print("Error in header export: ", e) def writecodecc(self, outfname, tree): try: cstr = '#include "' + outfname + '.h"' + '\n\n' for l in tree: cstr += self.make_print_fn(l) cstr += self.make_encode_fn(l) cstr += self.make_decode_fn(l) with open(outfname + '.c', 'w') as f: f.write(cstr) except Exception as e: print("Error in codecc export: ", e) def writextras(self): try: with open('float754.c', 'w') as f: f.write(FLOATC) with open('float754.h', 'w') as f: f.write(FLOATH) except Exception as e: print("Error writing extras: ", e) if __name__ == '__main__': pt = [['Position', ['double', 'x'], ['double', 'y'], ['double', 'z']], ['Distance', ['double', 'dx'], ['double', 'dy'], ['double', 'dz']], ['ArrayTest', ['double', 'doubloons', '3']]] print('Writing test codec to codec.c/.h') CodecWriter().writeheader('codec', pt) CodecWriter().writecodecc('codec', pt) print('Creating float754.c/.h') CodecWriter().writextras()
#!/usr/bin/env python def add_multiply(x, y, z=1): return (x + y) * z add_multiply(1, 2) # x=1, y=2, z=1
print("Bem Vindo ao jogo de Adivinhação") print("################################") print("DICA: Obter, para si, vantagem ilícita, em prejuízo alheio, induzindo ou mantendo alguém em erro, mediante artifício, ardil, ou qualquer outro meio fraudulento:") print("################################") numero_secreto = 71 total_de_tentativas = 3 rodada = 1 while(rodada <= total_de_tentativas): #Enquanto print("Tentativa {} de {}".format (rodada, total_de_tentativas)) chute_str = input("digite o seu numero entre 1 e 100!: ") print("Você digitou" , chute_str) chute = int (chute_str) if(chute <1 or chute > 100): print("Vocë não digitou um numero entre 1 e 100!") continue acertou = chute == numero_secreto maior = chute > numero_secreto menor = chute < numero_secreto if(acertou): print("Acertou Mizeravi") print("VOCÊ GANHOUUU!!!!!!") break else: if(maior): print("Erouuuuuuu!!!!! Seu chute foi maior que o numero secreto") elif(menor): print("Erouuuuuuu!!!!! Seu chute foi menor que o numero secreto") rodada = rodada + 1 print("Game Over")
"""Errand gofers module """ class Gofers(object): """Errand gofers class """ def __init__(self, *sizes): self._norm_sizes(*sizes) def _norm_sizes(self, *sizes): def _n(s): if isinstance(s, int): return ((s,1,1)) elif isinstance(s, (list, tuple)): l = len(s) if l >= 3: return tuple(s[:3]) elif l == 2: return (s[0], s[1], 1) elif l == 1: return (s[0], 1, 1) else: raise Exception("Wrong number of size dimension: %d" % l) else: raise Exception("Unsupported size type: %s" % str(s)) # (members, teams, assignments) if len(sizes) == 3: self.sizes = [_n(sizes[1]), _n(sizes[0]), _n(sizes[2])] # (members, teams) elif len(sizes) == 2: self.sizes = [_n(sizes[1]), _n(sizes[0]), _n(1)] # (members) elif len(sizes) == 1: self.sizes = [_n(1), _n(sizes[0]), _n(1)] else: raise Exception("Wrong # of Gofers initialization: %d" % len(sizes)) def run(self, workshop): return workshop.open(*self.sizes)
''' Write a function called my_func that takes two arguments---a list and a substring---and returns a new list, containing only words that start with the chosen substring. Make sure that your function is not case sensitive: meaning that if you want to filter by words that start with 'a', both 'apple' and 'Apple' would be included. If your function is working properly, this code: my_list = ['apple', 'banana', 'cranberry', 'Apple', 'watermelon', 'avocado'] only_a = my_func(my_list, 'a') only_c = my_func(my_list, 'c') print(only_a) print(only_c) should output: ['apple', 'Apple', 'avocado'] ['cranberry'] ''' def my_func(some_list, sub_string): starting_with = [] for word in some_list: if word.lower().startswith(sub_string): starting_with.append(word) return starting_with
# Copyright (c) 2015 Microsoft Corporation """ >>> from z3 import * >>> x = Int('x') >>> s = MCSatCore() >>> s.add_tactic('solve-eqs') >>> s.freeze(x) >>> s.add(x == 1) >>> s.push() >>> s [x == 1] >>> s = MCSatCore() >>> s.add_tactic('solve-eqs') >>> s.add(x == 1) >>> s.push() >>> s [] >>> y = Int('y') >>> s = MCSatCore() >>> s.add_tactic('solve-eqs') >>> s.freeze(x) >>> s.add(x == y, x > 0) >>> s [x == y, x > 0] >>> s.push() >>> s [Not(x <= 0)] >>> s = MCSatCore() >>> s.add_tactic('solve-eqs') >>> s.freeze(y) >>> s.add(x == y, x > 0) >>> s [x == y, x > 0] >>> s.push() >>> s [Not(y <= 0)] >>> s = MCSatCore() >>> s.add_tactic('solve-eqs') >>> s.freeze(y) >>> s.freeze(x) >>> s.add(x == y, x > 0) >>> s [x == y, x > 0] >>> s.push() >>> s [x == y, x > 0] """ # TODO: must install basic plugins to be able to handle this examples # if __name__ == "__main__": # import doctest # if doctest.testmod().failed: # exit(1)
def transpose_grid(grid): grid_t = [] grid_line = [] for i in range(len(grid[0])): for row in grid: grid_line.append(row[i]) grid_t.append(grid_line) grid_line = [] return grid_t def verify_row(row, necessary_length): if len(row) < necessary_length: return False, None actual_length = 0 pawn_to_verify = row[0] for element in row: # Analyse each row # Count repeated elements in a row if element == pawn_to_verify and element != 0: # Do not consider 0 an element: it's considered an empty space actual_length += 1 # If the length of these repeated elements reaches the necessary length to victory, stop if actual_length == necessary_length: # Return true and the winner element return True, element else: actual_length = 1 pawn_to_verify = element return False, None def verify_grid_rows(grid, necessary_length): row_number = 0 for row in grid: is_winner_row, element = verify_row(row, necessary_length) if is_winner_row: return True, element, row_number row_number += 1 return False, None, -1 def get_backslash_diagonal(grid, uppermost_coordinates): """ Gets the backslash-type diagonal of a grid based on the coordinates of the uppermost element. :param grid: The base matrix :param uppermost_coordinates: Tuple with the coordinates of the uppermost element of the form (row, column) :return: A list of the diagonal elements, starting from the uppermost """ i = uppermost_coordinates[0] j = uppermost_coordinates[1] diagonal_elements = [] while i <= len(grid)-1 and j <= len(grid[0])-1: # Put it in the list diagonal_elements.append(grid[i][j]) # Go to next element: i += 1 j += 1 return diagonal_elements def get_forward_slash_diagonal(grid, uppermost_coordinates): """ Gets the forward slash-type diagonal of a grid based on the coordinates of the uppermost element. :param grid: The base matrix :param uppermost_coordinates: Tuple with the coordinates of the uppermost element of the form (row, column) :return: A list of the diagonal elements, starting from the uppermost """ i = uppermost_coordinates[0] j = uppermost_coordinates[1] diagonal_elements = [] while i <= len(grid)-1 and j >= 0: # Put it in the list diagonal_elements.append(grid[i][j]) # Go to next element: i += 1 j -= 1 return diagonal_elements def tic_tac_toe_victory(grid, necessary_length): # Horizontal verification exists_winner, element, row_number = verify_grid_rows(grid, necessary_length) if exists_winner: print("Row victory") return True, element, row_number # Vertical verification grid_t = transpose_grid(grid) exists_winner, element, column_number = verify_grid_rows(grid_t, necessary_length) if exists_winner: print("Column victory") return True, element, column_number # Diagonal verification: # Back slash type diagonals: (\) # print("Backslash diagonals") # Lower half of the diagonals for i in range(len(grid)-1, -1, -1): diagonal = get_backslash_diagonal(grid, (i, 0)) exists_winner, element = verify_row(diagonal, necessary_length) if exists_winner: print("Diagonal victory") return True, element, 0 # print(diagonal) # Upper half of the diagonals for j in range(1, len(grid[0])): diagonal = get_backslash_diagonal(grid, (0,j)) exists_winner, element = verify_row(diagonal, necessary_length) if exists_winner: print("Diagonal victory") return True, element, 0 # print(diagonal) # Forward slash type diagonals (/) # print("Forward slash diagonals") # Upper half of the diagonals for j in range(len(grid[0])): diagonal = get_forward_slash_diagonal(grid, (0, j)) exists_winner, element = verify_row(diagonal, necessary_length) if exists_winner: print("Diagonal victory") return True, element, 0 # print(diagonal) # Lower half of the diagonals for i in range(1,len(grid)): diagonal = get_forward_slash_diagonal(grid, (i, len(grid[0])-1)) exists_winner, element = verify_row(diagonal, necessary_length) if exists_winner: print("Diagonal victory") return True, element, 0 # print(diagonal) return False, None, -1 #grid = [[' ',' ',' ','B',' '],[' ',' ','X','A',' '],[' ','X',' ','A',' '],['X',' ',' ','A','B']] #print(victory(grid, 4))
font = CurrentFont() for glyph in font.selection: glyph = font[name] glyph.prepareUndo() glyph.rotate(-5) glyph.skew(5) glyph.performUndo()
""" A reimplementation of some useful python utilities missing from RPython """ def zip(list1, list2): """ expects two lists of equal length """ assert len(list1) == len(list2) for i in xrange(len(list1)): yield list1[i], list2[i] raise StopIteration def all(ls): """ expects list of Bool """ result = True for l in ls: if l is not True: result = False return result def permutations(pool): """ based on itertools.permutations """ n = len(pool) indices = range(n) cycles = range(n, 0, -1) yield pool while n: for i in range(n-1, -1, -1): cycles[i] -= 1 if cycles[i] == 0: num = indices[i] for k in range(i, n-1): indices[k] = indices[k+1] indices[n-1] = num cycles[i] = n-i else: j = cycles[i] indices[i], indices[-j] = indices[-j], indices[i] yield [pool[i] for i in indices] break else: return def replace(string, match, replace): """ RPython only supports character replacement reimplements string.replace(match, replace) """ n = len(match) m = len(replace) i = 0 while i <= len(string) - n: if string[i:i+n] == match: string = string[:i] + replace + string[i+n:] i += m-n+1 assert i >= 0 else: i += 1 return string
load("//elm/private:test.bzl", _elm_test = "elm_test") elm_test = _elm_test def _elm_make_impl(ctx): elm_compiler = ctx.toolchains["@rules_elm//elm:toolchain"].elm output_file = ctx.actions.declare_file(ctx.attr.output) env = {} inputs = [elm_compiler, ctx.file.elm_json] + ctx.files.srcs if ctx.file.elm_home != None: env["ELM_HOME_ZIP"] = ctx.file.elm_home.path inputs.append(ctx.file.elm_home) arguments = [ ctx.file.elm_json.dirname, "make", ctx.attr.main, "--output", output_file.path, ] if ctx.attr.optimize: arguments.append("--optimize") ctx.actions.run( executable = ctx.executable._elm_wrapper, arguments = arguments, inputs = inputs, outputs = [output_file], env = env, ) return [DefaultInfo(files = depset([output_file]))] elm_make = rule( _elm_make_impl, attrs = { "srcs": attr.label_list(allow_files = True), "elm_json": attr.label( mandatory = True, allow_single_file = True, ), "main": attr.string( default = "src/Main.elm", ), "output": attr.string( default = "index.html", ), "optimize": attr.bool(), "elm_home": attr.label( allow_single_file = True, ), "_elm_wrapper": attr.label( executable = True, cfg = "host", default = Label("@rules_elm//elm/private:elm_wrapper"), ), }, toolchains = [ "@rules_elm//elm:toolchain", ] ) def _elm_dependencies_impl(ctx): elm_compiler = ctx.toolchains["@rules_elm//elm:toolchain"].elm elm_home = ctx.actions.declare_directory(".elm") output = ctx.actions.declare_file(".elm.zip") ctx.actions.run( executable = ctx.executable._elm_wrapper, arguments = [ctx.file.elm_json.dirname], inputs = [elm_compiler, ctx.file.elm_json], outputs = [output, elm_home], env = {"ELM_HOME": elm_home.path}, ) return [DefaultInfo(files = depset([output]))] elm_dependencies = rule( _elm_dependencies_impl, attrs = { "elm_json": attr.label( mandatory = True, allow_single_file = True, ), "_elm_wrapper": attr.label( executable = True, cfg = "host", default = Label("@rules_elm//elm/private:elm_dependencies"), ), }, toolchains = [ "@rules_elm//elm:toolchain", ] )
x = [2,3,5,6,8] y = [1,6,22,33,61] x_2 = list() x_3 = list() x_4 = list() x_carpi_y = list() x_2_carpi_y = list() for i in x: x_2.append(int(pow(i,2))) x_3.append(int(pow(i,3))) x_4.append(int(pow(i,4))) print("xi : ", x, sum(x)) print("xi^2 : ", x_2, sum(x_2)) print("xi^3 : ", x_3, sum(x_3)) print("xi^4 : ", x_4, sum(x_4)) for i, j, z in zip(x, y, x_2): x_carpi_y.append(i*j) x_2_carpi_y.append(z*j) print() print("yi : ", y, sum(y)) print("xi.yi : ", x_carpi_y, sum(x_carpi_y)) print("xi^2.yi : ", x_2_carpi_y, sum(x_2_carpi_y))
# Escreva um programa que leia um valor em metros e o exiba convertido em centímetros e milímetros medida = float(input('Digite o valor em metros: ')) cent = int(medida * 100) mili = int(medida * 1000) print('{} metros, equivalem a {} centímetros e {} milímetros'.format(medida, cent, mili))
# coding=utf8 # Copyright 2018 JDCLOUD.COM # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # # NOTE: This class is auto generated by the jdcloud code generator program. class InstanceinfoVO(object): def __init__(self, instanceId=None, name=None, subnetId=None, subnetName=None, vpcId=None, vpcName=None, azName=None, pubDomain=None, priDomain=None, instanceStatus=None, progressValue=None, createTime=None, endTime=None, description=None, regionId=None, regionName=None, maxDevices=None, maxMessages=None): """ :param instanceId: (Optional) IoT Hub实例编号 :param name: (Optional) IoT Hub实例名称 :param subnetId: (Optional) IoT Hub实例所属子网编号 :param subnetName: (Optional) IoT Hub实例所属子网名称 :param vpcId: (Optional) IoT Hub实例所属VPC编号 :param vpcName: (Optional) IoT Hub实例所属VPC名称 :param azName: (Optional) IoT Hub实例所属可用区名称[格式为可用区名称1@可用区名称2] :param pubDomain: (Optional) IoT Hub实例提供的公网域名 :param priDomain: (Optional) IoT Hub实例提供的内网域名 :param instanceStatus: (Optional) IoT Hub实例状态 PREPARING-准备资源 | BUILDING-创建中 | RUNNING-运行中 | SUSPENDING-暂停使用 :param progressValue: (Optional) 100以内的进度条数值 :param createTime: (Optional) IoT Hub实例创建时间 :param endTime: (Optional) IoT Hub实例到期时间 :param description: (Optional) IoT Hub实例描述 :param regionId: (Optional) IoT Hub实例所属Region编号 :param regionName: (Optional) IoT Hub实例所属Region名称 :param maxDevices: (Optional) 支持最大在线设备数量 :param maxMessages: (Optional) 最大支持消息数量 """ self.instanceId = instanceId self.name = name self.subnetId = subnetId self.subnetName = subnetName self.vpcId = vpcId self.vpcName = vpcName self.azName = azName self.pubDomain = pubDomain self.priDomain = priDomain self.instanceStatus = instanceStatus self.progressValue = progressValue self.createTime = createTime self.endTime = endTime self.description = description self.regionId = regionId self.regionName = regionName self.maxDevices = maxDevices self.maxMessages = maxMessages
print('=-'*50) print('-----------\033[33mLEITOR DE NÚMEROS INTEIROS:\033[m------------') print('O PROGRAMA VAI SOMAR TODOS OS NÚMEROS DIGITADOS E SÓ VAI PARAR QUANDO O USUÁRIO DIGITAR O VALOR 999.') print('=-'*50) n = 0 soma = 0 cont = -1 while n != 999: soma = soma + n cont = cont + 1 n = int(input('Digite um número inteiro qualquer para somar ou o número 999 para interromper o programa: ')) print('Foram digitados {} números ao total.'.format(cont)) print('A soma total entre os números digitados é igual a {}!'.format(soma))
############################################################################# # Copyright 2016 Mass KonFuzion # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. ############################################################################# class CollisionGeomType: aabb = 0 # TODO add more types? Or otherwise, get rid of this crap? I'm not sure if we'll need it
class Virus(object): '''Properties and attributes of the virus used in Simulation.''' def __init__(self, name, repro_rate, mortality_rate): self.name = name self.repro_rate = repro_rate self.mortality_rate = mortality_rate def test_virus_instantiation(): #TODO: Create your own test that models the virus you are working with '''Check to make sure that the virus instantiator is working.''' virus = Virus("HIV", 0.8, 0.3) assert virus.name == "HIV" assert virus.repro_rate == 0.8 assert virus.mortality_rate == 0.3
def tail(sequence, n): """Returns the last n items of a given sequence.""" if n <= 0: return [] return list(sequence[-n:])
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ @author: Pieter Huycke email: [email protected] GitHub: phuycke """ #%% def message_check(message = str): if len(message) < 160: return message else: return message[:160] longer = message_check("In certain chat programs or messaging applications, there is a limit on the number of characters that you can send in a message. Write a function that takes as input the message (a string) and checks whether the number of characters is less than 160 (or not). If the length of the message is less than 160, the message should be returned. If the length of the message is greater than 160, a string consisting of only the first 160 characters should be returned.") print(longer) shorter = message_check("In certain chat programs, there is a limit on the number of characters that you can send in a message.") print(shorter) #%% def first_20_words(message = str): words = message.split(" ") if len(words) > 20: raise ValueError("\nError\nThe message can only contain 20 words.") else: print("\nMessage passed:\n{}".format(message)) first_20_words("There is a limit on the number of characters that you can send in a message.") first_20_words(longer)
def getInnerBlocks(string, begin, end, sep = [","]): ret_list = [] if not isinstance(string, str): return None # read a name until depth 1. Store until depth 0, and append it along with # the contents. # at depth 0, ignore separators cname = "" depth = 0 last_name = "" cstr = "" clist = [] for char in string: if char == end: depth -= 1 if depth == 0: clist.append(cstr) ret_list.append({ 'name': last_name, 'params': clist }) clist = [] cstr = "" if depth == 0: if char not in sep and char not in [begin, end]: cname += str(char) elif depth == 1: if char in sep: clist.append(cstr) cstr = "" else: cstr += str(char) elif depth == 2: cstr += str(char) if char == begin: depth += 1 if depth == 1: last_name = cname cname = "" ret = [] for item in ret_list: name = item['name'].strip() params = [] for i in item['params']: inner = getInnerBlocks(i.strip(), begin, end, sep) if inner and len(inner) != 0: params.extend(inner) else: params.append(i.strip()) ret.append({ 'name': name, 'params': params }) return ret print(getInnerBlocks('2,3', '(', ')'))
# A lista a seguir possui mais uma lista interna, a lista de preços. # A lista de preços possui 3 sublistas dentro dela com os preços dos produtos. # para exemplificar, o preço do mamão é de 10.00 - alface crespa é de 2.99 e o feijão 9.0 # Será solicitado o preço de alguns produtos. para imprimir deve ser por f-string refrenciando o nome com o preço # da seguinte forma: "O preço do {} é R$ {}" # print('1: imprima o valor do abacaxi') # print('2: imprima o valor da rucula') # print('3: imprima o valor da laranja') # print('4: imprima o valor do repolho') # print('5: imprima o valor do feijão') # print('6: imprima o valor do feijão branco') # print('7: imprima o valor da vergamota') # print('8: imprima o valor da alface lisa') # print('9: imprima o valor do mamão') # print('10: imprima o valor da soja') # print('11: imprima o valor da lentilha') # print('12: imprima o valor da uva') # print('13: imprima o valor da vagem') # print('14: imprima o valor do almeirão') # print('15: imprima o valor da ervilha') # print('16: imprima o valor da maçã') lista = [['frutas','verduras','legumes','preço'], ['mamão','abacaxi','laranja','uva','pera','maçã','vergamota'], ['alface crespa', 'alface lisa','rucula','almerão','repolho','salsinha',], ['feijão', 'erviha', 'lentilha','vagem','feijão branco','gão de bico','soja'], [ [10.00, 2.56, 5.25, 9.5, 10.05, 15, 5.75], [2.99, 2.95, 3.5, 3.25, 5.89, 2.9, 2.5], [9.0, 5.0, 7.5, 1.75, 10.9, 5.99, 3.55] ] ] print(lista[4][1]) print(lista[5][2]) print(lista[4][2]) print(lista[5][4]) print(lista[6][0]) print(lista[6][4]) print(lista[4][-1]) print(lista[5][1]) print(lista[4][0]) print(lista[6][-1]) print(lista[6][2]) print(lista[4][3]) print(lista[6][3]) print(lista[5][3]) print(lista[6][1]) print(lista[4][5])
def solve(n): a = [] for _ in range(n): name, h = input().split() h = float(h) a.append((name, h)) a.sort(key = lambda t: t[1], reverse=True) m = a[0][1] for n, h in a: if h != m: break print(n, end = " ") print() while True: n = int(input()) if n == 0: break solve(n)
#Curso Python #06 - Condições Aninhadas #Primeiro Exemplo #nome = str(input('Qual é seu Nome: ')) #if nome == 'Jefferson': # print('Que Nome Bonito') #else: # print('Seu nome é bem normal.') #print('Tenha um bom dia, {}'.format(nome)) #Segundo Exemplo nome = str(input('Qual é seu Nome: ')) if nome == 'Jefferson': print('Que Nome Bonito') elif nome == 'Pedro' or nome == 'Marcos' or nome == 'Paulo': print('Seu nome é bem popular no Brasil.') elif nome in 'Jennifer Vitoria Mariana Deborah': print('Belo nome você tem em !') else: print('Seu nome é bem normal.') print('Tenha um bom dia, {}'.format(nome))
# IDLE (Python 3.8.0) # module_for_lists_of_terms def termal_generator(lict): length_of_termal_generator = 16 padding = length_of_termal_generator - len(lict) count = padding while count != 0: lict.append(['']) count = count - 1 termal_lict = [] for first_inner in lict[0]: for second_inner in lict[1]: for third_inner in lict[2]: for fourth_inner in lict[3]: for fifth_inner in lict[4]: for sixth_inner in lict[5]: for seventh_inner in lict[6]: for eighth_inner in lict[7]: for ninth_inner in lict[8]: for tenth_inner in lict[9]: for eleventh_inner in lict[10]: for twelfth_inner in lict[11]: for thirteenth_inner in lict[12]: for fourteenth_inner in lict [13]: for fifteenth_inner in lict [14]: for sixteenth_inner in lict[15]: term = ( first_inner + second_inner + third_inner + fourth_inner + fifth_inner + sixth_inner + seventh_inner + eighth_inner + ninth_inner + tenth_inner + eleventh_inner + twelfth_inner + thirteenth_inner + fourteenth_inner + fifteenth_inner + sixteenth_inner ) termal_lict.append(term) return termal_lict def user_input_handling_function_second(dictionary): print() user_input = input('Enter: ') print() good_to_go = 'no' errors = [] lict = [] while good_to_go == 'no': for key in dictionary: lict.append(key) for element in user_input: if element not in lict: print('The form can only contain a combination of the characters that represent the lists of characters.') errors.append('yes') break if len(user_input) < 2: print('The form is too short. It can\'t be less than two-characters long.') errors.append('yes') if len(user_input) > 8: print('The form is too long. It can\'t be more than eight-characters long.') errors.append('yes') if 'yes' in errors: good_to_go = 'no' errors = [] print() user_input = input('Re-enter: ') print() else: good_to_go = 'yes' return user_input def user_input_handling_function_third(): print() user_input = input('Enter: ') print() good_to_go = 'no' errors = [] yes_or_no = ['yes', 'no'] while good_to_go == 'no': if user_input not in yes_or_no: print('You have to answer yes or no.') errors.append('yes') if 'yes' in errors: good_to_go = 'no' errors = [] print() user_input = input('Re-enter: ') print() else: good_to_go = 'yes' return user_input def user_input_handling_function_fourth(dictionary): print() user_input = input('Enter: ') print() good_to_go = 'no' errors = [] while good_to_go == 'no': if user_input not in dictionary: print('The form you entered does not match one of the forms in your termal_dictionary. Each form in your') print('termal_dictionary is a name (key) that has an associated definition (value) that is a list of terms') print('that all have the same form as the name (key).') errors.append('yes') if 'yes' in errors: good_to_go = 'no' errors = [] print() user_input = input('Re-enter: ') print() else: good_to_go = 'yes' return user_input def user_input_handling_function_eighth(): print() user_input = input('Enter: ') print() good_to_go = 'no' errors = [] digits = ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '-'] while good_to_go == 'no': if user_input == 'None': user_input = None return user_input else: for inner in user_input: if inner not in digits: print('The number must be an integer that consists of digits. For example: 1, -2, etc. or the keyword:') print('None.') errors.append('yes') break if 'yes' in errors: good_to_go = 'no' errors = [] print() user_input = input('Re-enter: ') print() else: good_to_go = 'yes' return int(user_input) def user_input_handling_function_ninth(): ''' a parser ''' print() user_input = input('Enter: ') print() term = '' lict = [] for element in user_input: if element != ' ': term = term + element else: lict.append(term) term = '' lict.append(term) # because term might not be empty.... return lict def user_input_handling_function_tenth(dictionary): ''' a dictionary checker ''' user_input = user_input_handling_function_ninth() good_to_go = 'no' errors = [] while good_to_go == 'no': string = '' lict = [] for element in user_input: string = string + element for key in dictionary: for element in dictionary[key]: lict.append(element) for element in string: if element not in lict: print('One of your unwanted characters or combination of characters does not match the characters you') print('entered earlier.') errors.append('yes') break if 'yes' in errors: print() user_input = input('Re-enter: ') print() good_to_go = 'no' errors = [] else: good_to_go = 'yes' return user_input def print_vertical_lict(lict): for element in lict: print(element) def print_horizontal_lict(lict): string = '' for element in lict: string = string + str(element) + ', ' print(string) print() def write_vertical_lict(file_name, lict): # <-- file = open(file_name, 'w') for element in lict: element = str(element) + '\n' file.write(element) file.close() def write_horizontal_lict(file_name, lict): if '.txt' not in file_name: file_name = file_name + '.txt' row = '' for index in range(len(lict)): lict[index] = str(lict[index]) + ', ' if len(row + lict[index]) > 100: lict[index - 1] = lict[index - 1] + '\n' row = lict[index] else: row = row + lict[index] file = open(file_name, 'w') for term in lict: file.write(term) file.close()
"""Implementation for yq rule""" _yq_attrs = { "srcs": attr.label_list( allow_files = [".yaml", ".json", ".xml"], mandatory = True, allow_empty = True, ), "expression": attr.string(mandatory = False), "args": attr.string_list(), "outs": attr.output_list(mandatory = True), } def is_split_operation(args): for arg in args: if arg.startswith("-s") or arg.startswith("--split-exp"): return True return False def _escape_path(path): return "/".join([".." for t in path.split("/")]) + "/" def _yq_impl(ctx): yq_bin = ctx.toolchains["@aspect_bazel_lib//lib:yq_toolchain_type"].yqinfo.bin outs = ctx.outputs.outs args = ctx.attr.args[:] inputs = ctx.files.srcs[:] split_operation = is_split_operation(args) if "eval" in args or "eval-all" in args: fail("Do not pass 'eval' or 'eval-all' into yq; this is already set based on the number of srcs") if not split_operation and len(outs) > 1: fail("Cannot specify multiple outputs when -s or --split-exp is not set") if "-i" in args or "--inplace" in args: fail("Cannot use arg -i or --inplace as it is not bazel-idiomatic to update the input file; consider using write_source_files to write back to the source tree") if len(ctx.attr.srcs) == 0 and "-n" not in args and "--null-input" not in args: args = args + ["--null-input"] # For split operations, yq outputs files in the same directory so we # must cd to the correct output dir before executing it bin_dir = ctx.bin_dir.path + "/" + ctx.label.package escape_bin_dir = _escape_path(bin_dir) cmd = "cd {bin_dir} && {yq} {args} {eval_cmd} {expression} {sources} {maybe_out}".format( bin_dir = ctx.bin_dir.path + "/" + ctx.label.package, yq = escape_bin_dir + yq_bin.path, eval_cmd = "eval" if len(inputs) <= 1 else "eval-all", args = " ".join(args), expression = "'%s'" % ctx.attr.expression if ctx.attr.expression else "", sources = " ".join(["'%s%s'" % (escape_bin_dir, file.path) for file in ctx.files.srcs]), # In the -s/--split-exr case, the out file names are determined by the yq expression maybe_out = (" > %s%s" % (escape_bin_dir, outs[0].path)) if len(outs) == 1 else "", ) ctx.actions.run_shell( tools = [yq_bin], inputs = inputs, outputs = outs, command = cmd, mnemonic = "yq", ) return DefaultInfo(files = depset(outs), runfiles = ctx.runfiles(outs)) yq_lib = struct( attrs = _yq_attrs, implementation = _yq_impl, )
# ------------------------------ # 331. Verify Preorder Serialization of a Binary Tree # # Description: # One way to serialize a binary tree is to use pre-order traversal. When we encounter a non-null node, we record the node's value. If it is a null node, we record using a sentinel value such as #. # # _9_ # / \ # 3 2 # / \ / \ # 4 1 # 6 # / \ / \ / \ # # # # # # # # For example, the above binary tree can be serialized to the string "9,3,4,#,#,1,#,#,2,#,6,#,#", where # represents a null node. # # Given a string of comma separated values, verify whether it is a correct preorder traversal serialization of a binary tree. Find an algorithm without reconstructing the tree. # Each comma separated value in the string must be either an integer or a character '#' representing null pointer. # You may assume that the input format is always valid, for example it could never contain two consecutive commas such as "1,,3". # # Example 1: # Input: "9,3,4,#,#,1,#,#,2,#,6,#,#" # Output: true # # Example 2: # Input: "1,#" # Output: false # # Example 3: # Input: "9,#,#,1" # Output: false # # Version: 1.0 # 09/27/19 by Jianfa # ------------------------------ class Solution: def isValidSerialization(self, preorder: str) -> bool: nodes = preorder.split(",") # diff = outdegree - indegree diff = 1 for n in nodes: diff -= 1 # every node bring 1 indegree if diff < 0: return False if n != "#": # if not null, it brings 2 outdegree diff += 2 return diff == 0 # Used for testing if __name__ == "__main__": test = Solution() # ------------------------------ # Summary: # Math solution idea from: https://leetcode.com/problems/verify-preorder-serialization-of-a-binary-tree/discuss/78551/7-lines-Easy-Java-Solution # Consider null as leaves, then # - all non-null node provides 2 outdegree and 1 indegree (2 children and 1 parent), except root # - all null node provides 0 outdegree and 1 indegree (0 child and 1 parent). # During building, we record the difference between out degree and in degree diff = outdegree - indegree. # When the next node comes, we then decrease diff by 1, because the node provides an in degree. If the node is not null, we increase diff by 2, because it provides two out degrees. # If a serialization is correct, diff should never be negative and diff will be zero when finished. # # Stack solution: https://leetcode.com/problems/verify-preorder-serialization-of-a-binary-tree/discuss/78560/Simple-Python-solution-using-stack.-With-Explanation. # When you see two consecutive "#" characters on stack, pop both of them and replace the topmost element on the stack with "#". For example, # preorder = 1,2,3,#,#,#,# # Pass 1: stack = [1] # Pass 2: stack = [1,2] # Pass 3: stack = [1,2,3] # Pass 4: stack = [1,2,3,#] # Pass 5: stack = [1,2,3,#,#] -> two #s on top so pop them and replace top with #. -> stack = [1,2,#] # Pass 6: stack = [1,2,#,#] -> two #s on top so pop them and replace top with #. -> stack = [1,#] # Pass 7: stack = [1,#,#] -> two #s on top so pop them and replace top with #. -> stack = [#] # # If there is only one # on stack at the end of the string then return True else return False.
class HsvFilter: def __init__(self, hMin=None, sMin=None, vMin=None, hMax=None, sMax=None, vMax=None, sAdd=None, sSub=None, vAdd=None, vSub=None): self.hMin = hMin self.sMin = sMin self.vMin = vMin self.hMax = hMax self.sMax = sMax self.vMax = vMax self.sAdd = sAdd self.sSub = sSub self.vAdd = vAdd self.vSub = vSub