content
stringlengths
4
20k
from django.conf.urls import include, url from django.contrib import admin from cfp import views urlpatterns = [ url('', include('social.apps.django_app.urls', namespace='social')), url( r'^login/$', views.LoginView.as_view(), name='login'), url( r'^logout/$', 'dja...
import copy import unittest from mixbox.vendor.six import BytesIO from stix.test import EntityTestCase, assert_warnings from stix.test import report_test from stix.test.common import kill_chains_test, related_test from . import stix_header_test from stix import core, report from stix.core import stix_package from s...
# -*- coding: utf-8 -*- from __future__ import with_statement __license__ = 'GPL v3' __copyright__ = '2009, John Schember <<EMAIL>>' __docformat__ = 'restructuredtext en' ''' Split PDF file into multiple PDF documents. ''' import os, sys, re from optparse import OptionGroup, Option from calibre.ebooks.metadata.me...
from epydemic import * import networkx import numpy import unittest class CaptureNetwork(StochasticDynamics): '''Class that captures the network after running, to make tests simpler.''' def __init__(self, p, g): super().__init__(p, g) def tearDown(self): ''' Store the resulting networ...
import re import glob import os.path from lib.output import ColorPrint class InFile: def __init__(self, dir_path): if os.path.isdir(dir_path): self.bulk = self._globbing(dir_path) else: self.bulk = [] def _globbing(self, path): input_set = [] re.sub(...
from __future__ import absolute_import, division, print_function __metaclass__ = type ################################################################################ # Documentation ################################################################################ ANSIBLE_METADATA = {'metadata_version': '1.1', ...
from PySide import QtCore, QtGui, QtSql import connection class TableEditor(QtGui.QDialog): def __init__(self, tableName, parent=None): super(TableEditor, self).__init__(parent) self.model = QtSql.QSqlTableModel(self) self.model.setTable(tableName) self.model.setEditStrategy(QtSq...
from __future__ import unicode_literals from django.db import models from django.contrib.auth.models import User from django.utils.encoding import python_2_unicode_compatible class MyFileField(models.FileField): pass @python_2_unicode_compatible class Member(models.Model): name = models.CharField(max_lengt...
#!/usr/bin/env python2 import logging logging.basicConfig(level=logging.WARNING) import wx from spacq import VERSION from spacq.gui.action.data_capture import DataCapturePanel from spacq.gui.action.smooth_reset import SmoothResetPanel from spacq.gui.config.devices import DeviceConfigFrame from spacq.gui.config.pulse...
#! /usr/bin/env python import time from threading import RLock # import roslib # roslib.load_manifest('ros_homebot') import rospy import std_srvs.srv from ros_homebot_python import constants as c from ros_homebot_python.node import ( subscribe_to_topic, get_service_proxy, say, ) from ros_homebot_python.ut...
import logging as log import os.path from engine.config import CONFIG_DICT environ = os.environ LOG_DIR = 'logs' #LOG_LEVEL = CONFIG_DICT["LOG"]["log_level"] LOG_LEVEL = environ.get("LOG_LEVEL") # LOG FORMATS #FORCE LOG_LEVEL IF EXISTS FILE if os.path.isfile('/isard/LOG_LEVEL_DEBUG'): LOG_LEVEL = 'DEBUG' elif os...
import boto3 from kubernetes import client, config # replace with your hosted zone id hosted_zone_id = '' # replace with your txt-owner-id you are using # inside of your external-dns controller txt_owner_id = '' # change to false if you have external-dns not looking at services external_dns_manages_services = True #...
import sqlalchemy as sql from neutron.db.models_v2 import model_base class PoolPort(model_base.BASEV2): """Represents the connection between pools and ports.""" __tablename__ = 'embrane_pool_port' pool_id = sql.Column(sql.String(36), sql.ForeignKey('pools.id'), primary_key=True)...
from pycp2k.inputsection import InputSection class _each274(InputSection): def __init__(self): InputSection.__init__(self) self.Just_energy = None self.Powell_opt = None self.Qs_scf = None self.Xas_scf = None self.Md = None self.Pint = None self.Meta...
import cPickle as pickle import logging import numpy as np from os.path import join as path_join import sys import keras.backend as K from keras.models import Sequential, Graph from keras.layers.containers import Graph as SubGraph from keras.layers.containers import Sequential as Stack from keras.layers.core import *...
from pylons import tmpl_context as c from adhocracy import config from adhocracy.lib.auth.authorization import has from adhocracy.lib.auth.authorization import NOT_LOGGED_IN def is_not_demo(check, u): if u is not None: demo_users = config.get_list('adhocracy.demo_users') check.other('demo_user', ...
'''dblocker''' import os import pwd import subprocess def checklock(): whoami = os.environ['USER'] stage = os.environ['STAGE'] if os.path.isfile(stage+'/users/.pylock') == True: ownerid = os.stat(stage+'/users/.pylock')[4] if ownerid != os.getuid(): print 'your not the owner' ...
# -*- coding: utf-8 -*- # Form implementation generated from reading ui file 'ui_files\reference_editor.ui' # # by: pyside2-uic running on PySide2 2.0.0~alpha0 # # WARNING! All changes made in this file will be lost! from PySide2 import QtCore, QtGui, QtWidgets class Ui_Dialog(object): def setupUi(self, Di...
""" Models for project-wide vocabularies. """ import re from django.db.models import * from django.contrib.auth.models import User from django.contrib.contenttypes.models import ContentType from django.utils.translation import ugettext_lazy as _ from mptt.models import MPTTModel, TreeForeignKey from apps.backend.util...
""" This script is an example of 'exchangelib' usage. It will give you email and appointment notifications from your Exchange account on your Ubuntu desktop. Usage: notifier.py [notify_interval] You need to install the `libxml2-dev` `libxslt1-dev` packages for 'exchangelib' to work on Ubuntu. Login and password is f...
from __future__ import unicode_literals from django.db import models from django.utils.six.moves.urllib.parse import urlparse from django.utils.translation import ugettext_lazy as _ class Redirect(models.Model): old_path = models.CharField(verbose_name=_("Redirect from"), max_length=255, db_index=True) site ...
""" Module for various configuration management tasks using presto-admin """ import logging import os from StringIO import StringIO from fabric.contrib import files from fabric.decorators import task, serial from fabric.operations import get from fabric.state import env from fabric.utils import abort, warn import prest...
# -*- coding: utf-8 -*- """ =============================================================================== Misc core functions, constants, etc. (:mod:`sknano.core._extras`) =============================================================================== .. currentmodule:: sknano.core._extras """ from __future__ impor...
# -*- coding: utf-8 -*- # ------------------------------------------------------------ # Canal (cinecalidad) por Hernan_Ar_c # ------------------------------------------------------------ import re import sys import urlparse from channels import autoplay from channels import filtertools from core import co...
#! /usr/bin/env python3 # -*- coding: utf-8 -*- # ethernet link monitoring plugin try: from PyQt5.QtCore import QCoreApplication except: from PyQt4.QtCore import QCoreApplication import fcntl, socket, struct def name(): return QCoreApplication.translate("PluginEth", "Ethernet") DEV = "eth0" SYS_PATH = "...
from subprocess import check_output import click def count_locs(file_type, comment_pattern): """ Detect if a program is on the system path. :param file_type: Which file type will be searched? :param file_type: str :param comment_pattern: Escaped characters that are comments :param comment_pa...
# -*- coding: utf-8 -*- # import uuid from inspect import signature from functools import wraps from werkzeug.local import LocalProxy from contextlib import contextmanager from common.local import thread_local from .models import Organization def get_org_from_request(request): oid = request.META.get("HTTP_X_JMS_...
#!/usr/bin/env python #-*- coding:utf-8 -*- ''' Created on 2015年10月24日 @author: Conan ''' from me.coolxll.config.config import SHENMA_USERNAME as USERNAME,SHENMA_PASSWORD as PASSWORD import logging import time from me.coolxll.sms.basesms import BaseSms class Shenma(BaseSms): ''' Shenma for recei...
port_property_data = { 'name': { 'doc': """Calvin-base supported port properties""", 'type': 'name', 'capability_type': "name", 'value': "runtime.base.1", 'user-level': False }, 'routing': { 'doc': """Routing decides how tokens are routed out or in of a port."...
#!/usr/bin/env python import paramiko import sys from time import sleep #from getpass import getpass addr = '9.88.0.6' usern = 'rwuser' #passw = getpass() passw = 'Password2' mydev_pre = paramiko.SSHClient() mydev_pre.load_system_host_keys() #mydev_pre.load_host_keys("/home/bl839s/.ssh/known_hosts") #mydev_pre.set_...
from PyGMO.algorithm import base class py_cmaes(base): """ Covariance Matrix Adaptation Evolutionary Strategy (Python) """ def __init__( self, gen=500, cc=-1, cs=-1, c1=-1, cmu=-1, sigma0=0.5, ftol=1e-6, ...
""" VOMSService class encapsulates connection to the VOMS service for a given VO """ __RCSID__ = "$Id$" import requests import os from DIRAC import gConfig, gLogger, S_OK, S_ERROR from DIRAC.Core.Utilities import DErrno from DIRAC.Core.Utilities.Decorators import deprecated from DIRAC.Core.Security.Locations import ...
import os import sys currPath = "./" fileName = "graph_50_15.txt" fileOutName = "graph_50_15.adm" ######### open file ########## fullFileName = os.path.join(currPath, fileName) fileGraph = open(fullFileName, 'r'); fileContent = fileGraph.readlines(); fileGraph.close(); fullFileName = os.path.join(currPath, fileOutNa...
# -*- coding: utf-8 -*- from __future__ import absolute_import, unicode_literals import oscar.models.fields.autoslugfield from django.conf import settings from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('catalogue', '0001_initial'), migrations.sw...
''' Created on 31 mars 2015 @author: Remi Cattiau ''' import unittest import os import sys import nxdrive from nxdrive.engine.dao.sqlite import EngineDAO from nxdrive.engine.engine import Engine import tempfile class EngineDAOTest(unittest.TestCase): def _get_default_db(self, name='test_engine.db'): nxd...
import logging from odoo import api, models, modules, _ _logger = logging.getLogger(__name__) class Users(models.Model): _name = 'res.users' _inherit = ['res.users'] @api.model def create(self, values): user = super(Users, self).create(values) # for new employee, create his own 5 ba...
"""Module defining ``Eigensolver`` classes.""" from math import pi, sqrt, sin, cos, atan2 import numpy as np from numpy import dot # avoid the dotblas bug! from gpaw.utilities.blas import axpy, rk, r2k, gemm from gpaw.utilities import unpack from gpaw.eigensolvers.eigensolver import Eigensolver class CG(Eigensolv...
import sys, os, textwrap, json import filecmp import argparse # needs Python version 2.7 or higher import hashlib import binascii SCRIPT_VERSION = "0.2" OUT_FILENAME = "CRES.out" OUT_SOURCENAME = 'cres.c' CRES_KEY = 'CRES' CRES_CRESOURCE_TYPE = 'cresource_t' CRES_CPREFIX_TYPE = 'cresource_prefix_t' CRES_CCOLL_TYPE = ...
# coding:utf-8 ''' poc for CVE-2017-12615 ''' import urllib2 import random import string import urlparse def get_plugin_info(): plugin_info = { "name": "Tomcat 任意写文件漏洞", "info": "通过PUT方法上传任意文件,可以达到任意代码执行的效果", "level": "高危", "type": "代码执行", "author": "neargle@YSRC", ...
bl_info = { "name": "Bone Selection Groups", "author": "Antony Riakiotakis", "version": (1, 0, 2), "blender": (2, 75, 0), "location": "Properties > Object Buttons", "description": "Operator and storage for restoration of bone selection state.", "category": "Animation", } import bpy from bpy...
import webapp2 import jinja2 import logging import json import urllib2 import os from google.appengine.api import urlfetch from google.appengine.api import mail from user.models import User from lib import tools, handlers JINJA_ENVIRONMENT = jinja2.Environment( loader=jinja2.FileSystemLoader(os.path.dirname(__fi...
from mock import patch import mock from kiwi.storage.subformat.qcow2 import DiskFormatQcow2 class TestDiskFormatQcow2(object): @patch('platform.machine') def setup(self, mock_machine): mock_machine.return_value = 'x86_64' xml_data = mock.Mock() xml_data.get_name = mock.Mock( ...
""" A module that provides parsers to allow Parcon to parse binary data. Some of the main parsers it provides are: integer: parses four bytes in big-endian order and returns an int. short: parses two bytes in big-endian order and returns an int. byte: parses one byte and returns an int. u_integer, u_short, u_byte: sam...
import re try: from .error import YagInvalidEmailAddress except (ValueError, SystemError): # stupid fix to make it easy to load interactively from error import YagInvalidEmailAddress # All we are really doing is comparing the input string to one # gigantic regular expression. But building that regexp...
from omg.lump import Lump from omg.util import * from omg.wad import TxdefGroup from omg import six TextureDef = make_struct( "TextureDef", """Class for texture definitions""", [["name", '8s', "-"], ["dummy1", 'i', 0 ], ["width", 'h', 0 ], ["height", 'h', 0 ], ["dummy2", 'i',...
"""This example demonstrates how to authenticate using OAuth2. This example is intended for users who wish to use the oauth2client library directly. Using a workflow similar to the example here, you can take advantage of the oauth2client in a broader range of contexts than caching your refresh token using the config.p...
# -*- coding: utf-8 -*- __author__ = 'apsmi' #PLAYERS_COUNT = 1 #SERVER_ADDRESS = '' #SERVER_PORT = 80 #LEVEL_H = 40 #LEVEL_W = 40 BLOCK_SIZE = 32 BLOCK_DEMAGE = 8 FRAME_RATE = 30 import asyncore import argparse import time import pygame #import pygame._view import random import pickle import struct from server_...
""" This is the default portal logic for use with portals we have not automated yet. It creates a task for all actions for a staff member to complete. It is also used as a fall back for automated portals when something goes wrong. """ # Standard Library import string # MuckRock from muckrock.core.utils import genera...
from utils import * class Instance(object): """ Representing an instance of activity in the videos """ def __init__(self, idx, anno, vid_id, vid_info, name_num_mapping): self._starting, self._ending = anno['segment'][0], anno['segment'][1] self._str_label = anno['label'] self....
import pytest from pyDEA.core.models.multiplier_model_base import MultiplierModelBase from pyDEA.core.models.multiplier_model import MultiplierInputOrientedModel from pyDEA.core.models.multiplier_model_decorators import MultiplierModelWithDisposableCategories from pyDEA.core.models.multiplier_model_decorators import M...
""" Visit https://developer.github.com/v3/repos/statistics/ for API tips. This code builds the HISTORY.rst file using the GitHub API """ # I like extra spaces inside parens and sometimes camelCase # pylint: disable=C0326, C0325 # pylint: disable=C0103 import requests import os import datetime import getp...
import unittest from flowp import ftypes class Behavior: pass class expect: pass def when(*args): pass class Ftypes(Behavior): def before_each(self): self.s = 'abc-def-ghi' self.l = ['a', 'b', 'c', 'd', 'e'] self.nl = [1, 2, [3, 4], 5, [1, 2], 3] self.fs = ftypes.S...
# -*- coding:utf-8 -*- import numpy import numpy.random import numpy.linalg from . import svd def svd_init(matrix, dim, seed=None): u, s, v = svd.svd(matrix, dim) ss = numpy.sqrt(numpy.diag(s)) return numpy.maximum(0.001, u.dot(ss)), numpy.maximum(0.001, ss.dot(v)) def random_init(matrix, dim, seed=Non...
from __future__ import absolute_import, division, print_function __metaclass__ = type ANSIBLE_METADATA = {'metadata_version': '1.1', 'status': ['preview'], 'supported_by': 'community'} DOCUMENTATION = r''' --- module: aci_interface_policy_leaf_policy_group short_description: Ad...
#!/usr/bin/env python3 # # Mike Dvorak # Sailor's Energy # <EMAIL> # # Modified: 2016-06-16 # # # Description: Creates a new WinDB2 database with minimal functionality # import os import sys script_dir = os.path.dirname(__file__) sys.path.append(os.path.join(script_dir, '../')) import argparse from windb2 import windb...
#!/usr/bin/python #McDermott #15 Sep 2017 # # Calculations for compressible orifice flow # # Refs: # See my notes from 1996 # Munson, Young, Okishi. Fundamentals of Fluid Mechanics. Wiley, 1990. import math HOC = 50010. # heat of combustion [kJ/kg] psig = 0.0003 T_F = 100. C_d = 0.85 # orifice d...
from __future__ import (absolute_import, division, print_function) __metaclass__ = type import subprocess import os from ansible.plugins.callback import CallbackBase FAILED_VOICE="Zarvox" REGULAR_VOICE="Trinoids" HAPPY_VOICE="Cellos" LASER_VOICE="Princess" SAY_CMD="/usr/bin/say" class CallbackModule(CallbackBase): ...
__version__=''' $Id: usps4s.py 2966 2006-08-31 15:20:29Z rgbecker $ ''' __all__ = ('USPS_4State',) from reportlab.lib.colors import black from common import Barcode class USPS_4State(Barcode): ''' USPS 4-State OneView (TM) barcode. All info from USPS-B-3200A ''' _widthSize = 1 _heightSize = ...
from classytags.arguments import Argument, MultiValueArgument from classytags.values import StringValue from cms.templatetags.cms_tags import Placeholder, PlaceholderOptions from cms.models.placeholdermodel import Placeholder as PlaceholderModel from django import template from django.utils.safestring import mark_saf...
from __future__ import absolute_import import logging from click import echo from django.conf import settings from django.db import connections, transaction from django.db.utils import OperationalError, ProgrammingError from django.db.models.signals import post_syncdb, post_save from functools import wraps from pkg_r...
"""Location helpers for Home Assistant.""" import logging from typing import Optional, Sequence import voluptuous as vol from homeassistant.const import ATTR_LATITUDE, ATTR_LONGITUDE from homeassistant.core import State from homeassistant.helpers.typing import HomeAssistantType from homeassistant.util import locatio...
from dask.rewrite import RewriteRule, RuleSet, head, args, VAR, Traverser from dask.utils_test import inc, add def double(x): return x * 2 def test_head(): assert head((inc, 1)) == inc assert head((add, 1, 2)) == add assert head((add, (inc, 1), (inc, 1))) == add assert head([1, 2, 3]) == list ...
#!/usr/bin/env python # vim: ai ts=4 sts=4 et sw=4 encoding=utf-8 from django.db import models from fields import PickledObjectField from django.utils.dates import MONTHS, WEEKDAYS_ABBR # set timespans (e.g. EventSchedule.hours, EventSchedule.minutes) to # ALL when we want to schedule something for every hour/minute...
''' Created on Jul 26, 2012 @author: Alp Sayin ''' from datetime import datetime class idLogMessage(): """ A simple class to keep log messages members: _id : int _user : string _creationdate : datetime _lastmodified : datetime _category : string ...
from bsPlugins import * from bbcflib.track import track from bbcflib import genrep import rpy2.robjects as robjects from rpy2.robjects.numpy2ri import numpy2ri import numpy, os,shutil, itertools, math ftypes = [(0, 'genes bodies'), (1, 'gene promoters'), (2, 'exons'), (3, 'custom upload')] prom_up_def = 1000 prom_down...
""" Unit tests for datastore module. """ import re import mock from oslo_utils import units from cinder import test from cinder.volume.drivers.vmware import datastore as ds_sel from cinder.volume.drivers.vmware import exceptions as vmdk_exceptions class DatastoreTest(test.TestCase): """Unit tests for Datastore...
import logging # Django from django.urls import reverse # wger from wger.core.tests.base_testcase import WgerTestCase from wger.weight.models import WeightEntry logger = logging.getLogger(__name__) class WeightCsvImportTestCase(WgerTestCase): """ Test case for the CSV import for weight entries """ ...
from __future__ import absolute_import, print_function, division import hashlib from six.moves import urllib from mitmproxy import controller from netlib import wsgi from netlib import version from netlib import strutils from netlib.http import http1 class AppRegistry: def __init__(self): self.apps = {...
#!/usr/bin/env python __author__ = 'Thomas Lennan' from nose.plugins.attrib import attr from pyon.core.exception import BadRequest from pyon.util.int_test import IonIntegrationTestCase from interface.services.coi.idirectory_service import DirectoryServiceClient, DirectoryServiceProcessClient @attr('INT', group='co...
import re import unittest import pickle from tests import skipUnlessCairo import pgi from pgi.foreign import get_foreign from pgi.codegen import ctypes_backend try: from pgi.codegen import cffi_backend cffi_backend = cffi_backend except ImportError: cffi_backend = None from pgi.util import escape_identif...
# coding=utf-8 r""" This code was generated by \ / _ _ _| _ _ | (_)\/(_)(_|\/| |(/_ v1.0.0 / / """ from twilio.base import deserialize from twilio.base import serialize from twilio.base import values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import...
""" Guide for the reaction ensemble. The modeled reaction is :math:`2\\mathrm{A} + 3\\mathrm{B} \\leftrightarrow 4\\mathrm{C} + 1\\mathrm{D} + 3\\mathrm{E}`. """ import pprint import numpy as np import scipy.optimize import espressomd from espressomd import reaction_ensemble # System parameters #####################...
# ocean from django.conf.urls import url from rest_framework.authtoken import views as apiViews from ocean import views urlpatterns = [ url(r'^test/(.+)', views.test), url(r'^getfilter/', views.get_filter), # REST API # Obtain a token given the username and password url(r'^api-token-auth/', api...
import asyncio import sys import threading import unittest from unittest import mock import aiozmq class PolicyTests(unittest.TestCase): def setUp(self): self.policy = aiozmq.ZmqEventLoopPolicy() def tearDown(self): asyncio.set_event_loop_policy(None) def test_get_event_loop(self): ...
import proto # type: ignore __protobuf__ = proto.module( package="google.ads.googleads.v6.enums", marshal="google.ads.googleads.v6", manifest={"CampaignDraftStatusEnum",}, ) class CampaignDraftStatusEnum(proto.Message): r"""Container for enum describing possible statuses of a campaign draft. ...
# -*- coding: utf-8 -*- from docutils import nodes import sphinx.writers.latex as latex import sphinx.writers.html as html def replace_latex_question_mark(t): return t.replace(r"\PYGZsh{}\textless{}?\textgreater{}", u"\\large{【你的程序】}") def replace_html_question_mark(t): return t.replace("#&lt;?&gt;", u...
from collections import defaultdict class GroupDependencies: """represents the dependencies for a group or groups held internally as a dict(string,list) group_drivers - list of groups driving a group dependency block_drivers - list of blocks with answers driving a group dependency To add a depen...
"""Run all system health stories used by system health benchmarks. Only memory benchmarks are used when running these stories to make the total cycle time manageable. Other system health benchmarks should be using the same stories as memory ones, only with fewer actions (no memory dumping). """ import unittest from ...
# apis_v1/documentation_source/save_analytics_action_doc.py # Brought to you by We Vote. Be good. # -*- coding: UTF-8 -*- def save_analytics_action_doc_template_values(url_root): """ Show documentation about saveAnalyticsAction """ required_query_parameter_list = [ { 'name': ...
from StandardDataSets.scripts import JudgeAssistant # Please feed your node list here: tagLstRoot = [['library_joints', 'joint'], ['library_kinematics_models', 'kinematics_model', 'technique_common', 'joint']] attrName = 'id' attrVal = 'prismatic_joint' numericNodeList = ['axis', 'min', 'max'] class Simpl...
# -*- Python -*- __version__ = '$Revision: 1.3 $'[11:-2] from twisted.trial import unittest from twisted.protocols import htb class DummyClock: time = 0 def set(self, when): self.time = when def __call__(self): return self.time class SomeBucket(htb.Bucket): maxburst = 100 rate =...
import importlib import os import re import sys import neutron_classifier _SEPARATOR_REGEX = re.compile(r'[/\\]+') def import_modules_recursively(topdir): '''Import and return all modules below the topdir directory.''' topdir = _SEPARATOR_REGEX.sub('/', topdir) modules = [] for root, dirs, files in ...
"""This example demonstrates how to authenticate using OAuth2. This example is meant to be run from the command line and requires user input. """ __author__ = '<EMAIL> (Joseph DiLallo)' import httplib2 import os import sys sys.path.insert(0, os.path.join('..', '..', '..', '..', '..')) from adspygoogle import DfaCli...
import openerp from openerp import SUPERUSER_ID from openerp import tools from openerp.osv import orm, fields from openerp.modules.registry import RegistryManager class decimal_precision(orm.Model): _name = 'decimal.precision' _columns = { 'name': fields.char('Usage', select=True, required=True), ...
from test_framework.test_framework import InfinitumTestFramework from test_framework.util import * class BIP66Test(InfinitumTestFramework): def __init__(self): super().__init__() self.num_nodes = 3 self.setup_clean_chain = False def setup_network(self): self.nodes = [] ...
import sys import pickle from threading import Thread from Queue import Queue, Empty # point is to make improbable that would ever happen to appear inside a pickled image and be mistaken # Note that because you may be loading image data and random strings will occur... best to have a big # *10 on this message string....
"""Provider code for HoundDawgs.""" from __future__ import unicode_literals import re import traceback from requests.compat import urljoin from requests.utils import dict_from_cookiejar from ..torrent_provider import TorrentProvider from .... import logger, tv_cache from ....bs4_parser import BS4Parser from ....hel...
import cxmate import logging from handlers import GtLayoutHandlers from Adapter import GraphToolAdapter logging.basicConfig(level=logging.DEBUG) # Label for CXmate output OUTPUT_LABEL = 'out_net' # Layout algorithm name LAYOUT_NAME = 'layout-name' class GtLayoutService(cxmate.Service): def __init__(self): ...
#!/usr/bin/env python2 # vim:fileencoding=UTF-8:ts=4:sw=4:sta:et:sts=4:ai __license__ = 'GPL v3' __copyright__ = '2010, Kovid Goyal <<EMAIL>>' __docformat__ = 'restructuredtext en' import re, os import __builtin__ from urllib import quote, urlencode import cherrypy from lxml import html from lxml.html.builder impo...
import example_0060 example_0060.function_with_overloaded_args(1) example_0060.function_with_overloaded_args('One') example_0060.function_with_overloaded_args(2.72) example_0060.function_with_overloaded_args() example_0060.function_with_overloaded_args(2, 'Two', 3.14) try: example_0060.function_with_overloaded_...
# -*- coding: utf-8 -*- # # Configuration file for the Sphinx documentation builder. # # This file does only contain a selection of the most common options. For a # full list see the documentation: # http://www.sphinx-doc.org/en/master/config # -- Path setup ------------------------------------------------------------...
import math import pybinding as pb from .constants import a, a_cc __all__ = ['hexagon_ac'] def hexagon_ac(side_width, lattice_offset=(-a/2, 0)): """A graphene-specific shape which guaranties armchair edges on all sides Parameters ---------- side_width : float Hexagon side width. It may be ad...
import os import time import signal import logging from datetime import datetime from multiprocessing import Pool from flask.ext.script import Command from croniter import croniter from triager import jobs, db, app from models import Project, TrainStatus as TS class RetrainScheduler(Command): DAY = 60*60*24 ...
import requests import random import time from Crawler.PkuCrawler.PkuConfig import Pku_User, Pku_LogIn_Url from tools.encode import UTF8StrToBase64Str, Base64StrToUTF8Str class PkuVJudger(): ''' 1.poj的提交需要对代码进行base64编码 2.每次都要登陆? ''' headers = { 'User-agent': 'Mozilla/5.0 (X11; Linux x86_...
#!/usr/bin/env python from flask import (Flask, render_template, send_from_directory) from flask_socketio import (SocketIO) from duckomatic.platform.platform_controller import PlatformController from resources.camera import Camera # from resources.gps import Gps # from resources.rudder import Rudder ...
import copy import contextlib import parsing import evaluate import debug import builtin import settings class RecursionDecorator(object): """ A decorator to detect recursions in statements. In a recursion a statement at the same place, in the same module may not be executed two times. """ def __...
# Render (all) objects in bvpLibrary import bvp LibDir = '/auto/k6/mark/BlenderFiles/' # Load from settings?? Lib = bvp.bvpLibrary(LibDir) # Optional sub-category to render SubCat = None #'animal' rotList = [0] # List of rotations at which to render each object Render_Pose = True # Whether to render all poses for a...
import random import time import matplotlib.pyplot as plot from Merge.merge_sort import merge_sort from Quicksort.Quicksort import quicksort from BubbleSort.BubbleSort import bubble_sort from PriorityQ.HeapSort import heap_sort def generate_testcase(N): rand_list = random.sample(range(-523000, 14252000), N) re...
import bpy, os, sqlite3, sys, platform, copy from shader_tools_ng.libs import keys, request, misc, configuration, zip #Convert active configuration to default path def ConvertDefaultPaths(default_paths, active_configuration): temp = active_configuration['database_path'].replace('#addon#', default_paths['app']) ...
""" mod_regression Models =================== In this module, we are trying to maintain database regarding various regression tests, categories, storing output of tests. List of models corresponding to mysql tables: ['Category' => 'category', 'RegressionTest' => 'regression_test', 'RegressionTestOutput' => 'regression_...