content
string
#!/usr/bin/env python import sys import os import re import glob import xmltodict import json import yaml import copy import logging from argparse import ArgumentParser from argparse import RawDescriptionHelpFormatter from elasticsearch1 import Elasticsearch from collections import OrderedDict import datetime import d...
""" This script can be used to install easybuild-framework, e.g. using: easy_install --user . or python setup.py --prefix=$HOME/easybuild @author: Kenneth Hoste (Ghent University) """ import os from distutils import log from easybuild.tools.version import VERSION API_VERSION = str(VERSION).split('.')[0] # Util...
# -*- coding: utf-8 -*- class CreatedCounter(object): _count = 0 @staticmethod def count(): count = CreatedCounter._count CreatedCounter._count += 1 return count class DataType(object): def __init__(self, **kwargs): self._created = CreatedCounter.count() for ...
#!/usr/bin/env python2.7 # -*- coding: utf-8 -*- from __future__ import absolute_import, division, print_function from six.moves import range import numpy as np import utool from ibeis.control import SQLDatabaseControl as sqldbc from ibeis.control._sql_helpers import _results_gen from os.path import join print, print_,...
# -*- coding: utf-8 -*- """ Module for code dealing with the classifier. """ import numpy from sklearn import svm from simpleai.machine_learning import Classifier class SVMClassifier(Classifier): """ A Support Vector Machine classifier to classify if a sentence is a translation of another sentence. ...
import datetime import unittest2 from case_parsing.exceptions import CaseParsingException import xml2json from case_parsing import parse_casexml_json, CASEXML_XMLNS, get_case_delta from case_parsing.delta import CaseDelta CASE_XML_1 = """ <case xmlns="http://commcarehq.org/case/transaction/v2" case_id="3F2504E04F89...
import time import unittest from measurements import smooth_gesture_util as sg_util from telemetry import decorators from telemetry.core.platform import tracing_category_filter from telemetry.core.platform import tracing_options from telemetry.page import page as page_module from telemetry.page import page_test from t...
# import core from django.urls import include, path # from tastypie.api import Api from django.contrib import admin from django.conf import settings from rest_framework.routers import DefaultRouter from rest_framework_jwt.views import obtain_jwt_token from graphene_django.views import GraphQLView from django.http impor...
from __future__ import absolute_import from __future__ import print_function import datetime import ujson from django.http import HttpResponse from mock import patch from typing import Any, Dict, List, Text, Union from zerver.lib.actions import ( do_change_is_admin, do_set_realm_property, do_deactivate_r...
#!/usr/bin/python import datetime import os import smtplib import subprocess from ConfigParser import SafeConfigParser # Import the email modules from email.mime.multipart import MIMEMultipart from email.mime.text import MIMEText current_time = datetime.datetime.now() apps = [] out = '' err = '' proc = '' isLongrunn...
from astrometry.util.fits import * from numpy import * import numpy as np import pyfits class PhotometricCalib(object): def __init__(self, tsfieldfn): # definition of exptime, according to web page above. tsfield = fits_table(tsfieldfn)[0] self.exptime = 53.907456 self.aa = tsfield.aa.astype(float) self.kk ...
from bluebottle.payments.services import PaymentService from bluebottle.test.factory_models.payments import OrderPaymentFactory from bluebottle.test.factory_models.orders import OrderFactory from bluebottle.test.utils import FsmTestMixin, BluebottleTestCase from bluebottle.utils.utils import StatusDefinition class Pa...
"""Model various types of date strings as call number parts. This contains Unit implementations for various pieces of dates. """ from __future__ import unicode_literals from __future__ import absolute_import from builtins import str from builtins import range from datetime import datetime from pycallnumber.template...
from django import http from django.conf import settings from common import exception from common import util def debug_only(handler): def _wrapper(request, *args, **kw): if not settings.DEBUG: raise http.Http404() return handler(request, *args, **kw) _wrapper.__name__ = handler.__name__ return _w...
from urllib.parse import urlencode from httplib2 import Http, ServerNotFoundError from .languages import languages from .exceptions import NoCodeError, InvalidExpiryError, CodeUploadError class BPaster: http = Http() default2text = True default2oneday = True languages = languages expiries = ['1wee...
#!/usr/bin/env python import random from datetime import datetime num_lists = [] card_list = [] def print_card(card): print "---------------------------" for i in range(3): for j in range(9): print ("%s" % card[j][i]).rjust(2), print print "---------------------------" for c...
#!/usr/bin/env python2 # -*- coding: utf-8 -*- # autor: Filip Varga from records import records from sys import stderr, exit from datetime import datetime from argparse import ArgumentParser, ArgumentTypeError vendor_id = "2b80a53a-4f08-4f6d-9a38-cfdd43e0c0a8" appbundle = "eu.mobile_alerts.weatherhub" server = "measu...
from collections import Counter import math import numpy from nlp import nlp_utils from utils.constants import Constants __author__ = 'fpena' def get_review_metrics(record): """ Returns a list with the metrics of a review. This list is composed in the following way: [log(num_sentences + 1), log(num_word...
# coding=utf-8 import logging import blueman.bluez as bluez from blueman.Functions import launch from blueman.plugins.AppletPlugin import AppletPlugin import gi gi.require_version('GdkX11', '3.0') gi.require_version('Gdk', '3.0') from gi.repository import Gdk, GdkX11 if not isinstance(Gdk.Screen.get_default(), GdkX1...
# -*- coding: utf-8 -*- import os import json import requests from requests.auth import HTTPDigestAuth from collections import OrderedDict from requests.packages.urllib3.exceptions import InsecureRequestWarning requests.packages.urllib3.disable_warnings(InsecureRequestWarning) def get_solr_json(solr_url, quer...
# -*- coding: utf-8 -*- # -*- Channel TuPeliHD -*- # -*- Created for Alfa-addon -*- # -*- By the Alfa Develop Group -*- from bs4 import BeautifulSoup from channelselector import get_thumb from core import httptools from core import scrapertools from core import servertools from core.item import Item from pl...
# uncompyle6 version 2.9.10 # Python bytecode 2.7 (62211) # Decompiled from: Python 3.6.0b2 (default, Oct 11 2016, 05:27:10) # [GCC 6.2.0 20161005] # Embedded file name: __init__.py import dsz import dsz.cmd import dsz.data import dsz.lp class Aliases(dsz.data.Task): def __init__(self, cmd=None): dsz.dat...
from empty import Empty from doublyLinkedBase import _DoublyLinkedBase import unittest class LinkedDeque(_DoublyLinkedBase): def first(self): if self.is_empty(): raise Empty('Deque is empty') return self._header._next._element def last(self): if self.is_empty(): ...
from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline ...
"""Module to build and run background source recording jobs. For internal use only; no backwards-compatibility guarantees. A background source recording job is a job that records events for all recordable sources of a given pipeline. With Interactive Beam, one such job is started when a pipeline run happens (which pr...
import os from hashlib import md5 from io import BytesIO from django.conf import settings from django.core.files import File from django.core.files.base import ContentFile from django.core.urlresolvers import reverse from django.db import models from django.utils import timezone from django.utils.crypto import get_ran...
from gi.repository import Gtk class NoDevice: pass NotListed = NoDevice() import cups from gi.repository import GObject from timedops import TimedOperation from .base import * class DeviceListed(Question): def __init__ (self, troubleshooter): # Is the device listed? Question.__init__ (self, t...
from _pydevd_bundle import pydevd_constants IS_PY3K = pydevd_constants.IS_PY3K class IORedirector: ''' This class works to wrap a stream (stdout/stderr) with an additional redirect. ''' def __init__(self, original, new_redirect, wrap_buffer=False): ''' :param stream original: ...
import sys, re import logging from urllib2 import Request, urlopen, HTTPError from urlparse import urlparse from email.utils import formatdate import PyV8, w3c import BeautifulSoup class Navigator(PyV8.JSClass): _js_log = logging.getLogger("navigator.base") appCodeName = '' appName = '' appVersion =...
from PyQt4.QtCore import SIGNAL from PyQt4.QtGui import QApplication, QWidget, QSystemTrayIcon, QMenu, QIcon import sys import SimpleMPDVoteMain class SystemTrayIcon(QSystemTrayIcon): def exit(self): return self.app.exit(0) def other(self): print("other") return 0 def __init__(s...
import threading import sublime import sublime_plugin from functools import partial from ..show_error import show_error from ..package_manager import PackageManager from ..thread_progress import ThreadProgress class SatisfyDependenciesCommand(sublime_plugin.WindowCommand): """ A command that finds all depe...
import os from flask import json from apps.io.tests import setup_providers, teardown_providers from superdesk import tests from superdesk.factory.app import get_app from superdesk.tests import setup_auth_user from superdesk.vocabularies.command import VocabulariesPopulateCommand from superdesk.tests.mocks import TestS...
#!/bin/bash # -*- codign:utf-8 -*- # baseTools.sysTools.term_Tools # Coded by Richard Polk #---------------------------------------------------- print ' |' + __name__ + '| ---' class _Pause: # This class is a base class """Gets a single character from standard input. Does not echo to the screen.""" def __init_...
"""Support for getting temperature from TEMPer devices.""" import logging from temperusb.temper import TemperHandler import voluptuous as vol from homeassistant.components.sensor import PLATFORM_SCHEMA from homeassistant.const import ( CONF_NAME, CONF_OFFSET, DEVICE_DEFAULT_NAME, TEMP_FAHRENHEIT, ) fr...
'''A simple wx gui for GNU Radio applications''' import wx import sys from gnuradio import gr class stdapp (wx.App): def __init__ (self, flow_graph_maker, title="GNU Radio", nstatus=2): self.flow_graph_maker = flow_graph_maker self.title = title self._nstatus = nstatus # All our i...
#!/usr/bin/env python ''' 15Oct2015 Extracts taxonomic rankings from SAP (http://ib.berkeley.edu/labs/slatkin/munch/StatisticalAssignmentPackage.html https://github.com/kaspermunch/sap http://kaspermunch.wordpress.com/software/statistical-assignment-package-sap/) Takes the html output from SAP and produces a tab se...
import ast from collections import Mapping, Sequence from typing import Any, Dict, Optional from .eval import SoS_eval, accessed_vars, used_in_func from .parser import SoS_Step from .targets import dynamic, remote, sos_targets, sos_step, named_output from .utils import env from .executor_utils import __null_func__,...
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models, migrations import django.contrib.gis.db.models.fields class Migration(migrations.Migration): dependencies = [ ('let_me_app', '0008_auto_20150809_1341'), ] operations = [ migrations.CreateModel(...
""" Graph modules """ CHARTS_NAMES = [ 'Line', 'StackedLine', 'XY', 'Bar', 'HorizontalBar', 'StackedBar', 'HorizontalStackedBar', 'Pie', 'Radar', 'Funnel', 'Pyramid', 'VerticalPyramid', 'Dot', 'Gauge' ]
'Use for motor control' import time PORT_A = 0x00 PORT_B = 0x01 PORT_C = 0x02 PORT_ALL = 0xFF MODE_IDLE = 0x00 MODE_MOTOR_ON = 0x01 MODE_BRAKE = 0x02 MODE_REGULATED = 0x04 REGULATION_IDLE = 0x00 REGULATION_MOTOR_SPEED = 0x01 REGULATION_MOTOR_SYNC = 0x02 RUN_STATE_IDLE = 0x00 RUN_STATE_RAMP_UP = 0x10 RUN_STATE_RUNN...
# imgray2fits CL0024.png -over -header det.fits # Converts a grayscale image to a FITS file # im2rgbfits CL0024.png -over -header det.fits # WILL HONOR WCS FROM headerfile # im2rgbfits.py # ~/ACS/CL0024/color/production/color.py # ALSO SEE pyfits.pdf (Pyfits manual) #from coetools import * from PIL import Image impo...
#!/usr/bin/python import sys import re import PrimerTMCalculator def reverse_complement( sequence ): rev_comp_list = [] length = len( sequence ) for i in range( length ): cur_char = sequence[length - i -1] #print "at i=%s, char to check is %s"%(i, cur_char) if( cur_char == 'A' ): ...
from __future__ import generators import sys import os.path from itertools import count packagedir = os.path.dirname(__file__) # look for ctypes in the system path, then try looking for a private ctypes # distribution try: import ctypes except ImportError: private_ctypes = os.path.join(packagedir, 'pvt_ctypes...
from typing import Any, TYPE_CHECKING from azure.core.configuration import Configuration from azure.core.pipeline import policies from azure.mgmt.core.policies import ARMHttpLoggingPolicy from .._version import VERSION if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from azure.core.creden...
# -*- coding: utf-8 -*- import os from flask import Flask, request, render_template from flask.ext.babel import Babel from .config import DefaultConfig from .user import User, user from .tag import Tag, tag from .blogpost import BlogPost, blogpost from .settings import settings from .frontend import frontend from .a...
import json import os import tempfile import unittest import uuid import mock from azure.mgmt.authorization.models import RoleDefinition, RoleDefinitionProperties from azure.graphrbac.models import Application, ServicePrincipal from azure.cli.command_modules.role.custom import (create_role_definition, ...
from django.db.models.base import ModelBase, Model from .manager import PartitionManager from .options import ShardInfo, DEFAULT_NAMES class PartitionBase(ModelBase): def __new__(cls, name, bases, attrs): # if 'Meta' not in attrs: # attrs['Meta'] = type('Meta', (object,), {}) # else: ...
from __future__ import unicode_literals import mimetypes import re from flask import render_template from indico.core import signals from indico.core.plugins import IndicoPlugin, url_for_plugin from indico.modules.attachments.preview import Previewer from indico_previewer_jupyter.blueprint import blueprint def re...
from __future__ import absolute_import, division, print_function import os from collections import defaultdict, Counter from qtpy import QtWidgets, QtGui, QtCore from qtpy.QtCore import Qt from glue.core import ComponentID from glue.core.parse import ParsedComponentLink, ParsedCommand from glue.utils.qt import load_...
#===istalismanplugin=== # -*- coding: utf-8 -*- # STORM BOT BY ALI version_pendingg=[] def handler_banos(groupchat, nick, aff, role): if check_file(groupchat,'banver.txt'): jid=groupchat+'/'+nick iq = xmpp.Iq('get') id='vers'+str(random.randrange(1000, 9999)) ...
import re def find_blocks(src, start=0, nesting=0, scope=None): if not scope: scope = [] seek = start; accumulate = '' while seek < (len(src)): chunk = re.match( r'^(.*?)({|}|\n|\Z|//.*?(?:\n|\Z)|/\*.*?(?:\*/|\Z))', src[seek:], re.MULTILINE | re.DOTALL) ...
import morphforge.traces.operators.op_piecewise_scalar import morphforge.traces.operators.op_fixeddt_scalar import morphforge.traces.operators.op_fixeddt_quantity import morphforge.traces.operators.op_fixeddt_fixeddt import morphforge.traces.operators.op_variabledt_scalar
"""Main file for running a NQ long-answer experiment.""" from __future__ import absolute_import from __future__ import division from __future__ import print_function from language.common.utils import experiment_utils from language.question_answering.decatt_docreader.models import nq_long_model import tensorflow.compa...
import urllib2 import threading import json import time from django.utils import timezone from bs4 import BeautifulSoup from tools import safe_request # stock list def getlist(stock): stocks = [] stock_list_query = 'http://shareprices.com/{}' html = urllib2.urlopen(stock_list_query.format(stock)).read() ...
"""An implementation of a dm_env environment using dm_env_rpc.""" import collections from typing import Any, Iterable, Mapping, Optional, Sequence, Tuple import dm_env import immutabledict from dm_env_rpc.v1 import connection as dm_env_rpc_connection from dm_env_rpc.v1 import dm_env_flatten_utils from dm_env_rpc.v1 i...
import unittest from typ import json_results class FakeArtifacts(object): def __init__(self): self.artifacts = {} class TestMakeUploadRequest(unittest.TestCase): maxDiff = 4096 def test_basic_upload(self): results = json_results.ResultSet() full_results = json_results.make_full...
from __future__ import absolute_import, unicode_literals from django.test import TestCase from .utils import anonymize_ip_address, anonymize_user_agent class UtilsTests(TestCase): def test_anonymize_ip(self): self.assertEqual(anonymize_ip_address('127.0.0.1'), '127.0.0.0') self.assertEqual(anony...
from .lib import device_path_to_name, device_name_to_disk_by_path, ParentList from .device import Device from .storage import StorageDevice from .disk import DiskDevice, DiskFile, DMRaidArrayDevice, MultipathDevice, iScsiDiskDevice, FcoeDiskDevice, DASDDevice, ZFCPDiskDevice, NVDIMMNamespaceDevice from .partition impor...
import re _DEFINITION_TYPES = { 'def': 'function', 'class': 'class', 'method': 'method', } _SYMBOL_REGEX = re.compile(r'( )*(def|class) ([\w_]+)') def _get_last_class_name(symbol_list): '''Get last class name defined in the symbol list. Args: symbol_list: List of parsed symbols. Returns: Stri...
#!/usr/bin/env python class SchoolMember: '''Represents any school member.''' def __init__(self, name, age): self.name = name self.age = age print '(Initialized SchoolMember: %s)' % self.name def tell(self): '''Tell my details.''' print 'Name:"%s" Age:"%s"' % (se...
""" Shared utilities for run_model.py and model.py. """ import os import random import numpy as np import pickle import h5py from sklearn_crfsuite.metrics import ( flat_classification_report, flat_f1_score, flat_precision_score, flat_recall_score, flat_accuracy_score, sequence_accuracy_score) __author__ =...
import gtk from gettext import gettext as _ N_ = lambda x: x from debug import * __all__ = [ 'gtk', '_', 'debugprint', 'get_debugging', 'set_debugging', 'Question', 'Multichoice', 'TEXT_start_print_admin_tool' ] TEXT_start_print_admin_tool = N_("To start thi...
from datetime import datetime as dt from mock import patch import numpy as np from pandas.util.testing import assert_frame_equal import pytest from arctic import arctic as m from arctic.date import DateRange, CLOSED_OPEN, mktz from arctic.exceptions import OverlappingDataException, \ NoDataFoundException def tes...
import configparser from zeeguu_core.word_scheduling.arts.arts_rt import ArtsRT from zeeguu_core.word_scheduling.arts.experiments.arts_diff_slow import ArtsDiffSlow from zeeguu_core.word_scheduling.arts.algorithm_wrapper import AlgorithmWrapper class ABTesting: _algorithms = [ ArtsRT(), ...
# -*- encoding: utf-8 ''' Created on: Aug 01, 2013 @author: qwang Global settings for weibonews ''' class AuthType(object): ''' User auth type ''' DEVICE = 'device' WEIBO = 'weibo' # for virtual category user CATEGORY = 'category' # anonymous user ANONYM = 'anonym' class Priority...
import rospy import rospkg from std_msgs.msg import String import uav_state # Enum maps to sound name import soundmap def monitor(): rospy.init_node('monitor', anonymous=True) UAV = uav_state.UAV_State() pubFile = rospy.Publisher('playfile', String, queue_size=10) pubToken = rospy.Publisher('play...
import os from subprocess import Popen, PIPE import logging import re def run_command(cmdlist): p = Popen(cmdlist, stdout=PIPE, stderr=PIPE) exit_code = p.wait() stdout, stderr = p.communicate() if isinstance(stdout, bytes): stdout = stdout.decode() if isinstan...
from django.shortcuts import render from django.views.decorators.csrf import csrf_exempt from django.contrib.auth import authenticate, login, logout from django.contrib.auth.decorators import login_required from django.http import HttpResponse, HttpResponseRedirect def index(request): return render(request, 'base...
import serial, atexit, colorsys class strip: config = { "type": "", "port": "/dev/ttyACM0", "length": "1", "width": "1", "depth": "1", "name": "Arduino strip" } txBuffer = "" txSize = 64 def init(self): self.port = str(self.config["port"]) self.length = int(self.config["length"],0) self....
# -*- coding: utf-8 -*- """Module providing JSON storage for static asset assignments""" from plone.autoform.interfaces import IFormFieldProvider from plone.dexterity.interfaces import IDexterityContent from plone.supermodel import model from zope.component import adapter from zope.interface import implementer from zop...
import Gaffer import GafferUI QtGui = GafferUI._qtImport( "QtGui" ) ## A simple PlugValueWidget which just displays the name of the plug, # with the popup action menu for the plug. class LabelPlugValueWidget( GafferUI.PlugValueWidget ) : def __init__( self, plug, horizontalAlignment=GafferUI.Label.HorizontalAlignme...
from django.contrib import messages from django.core.urlresolvers import reverse from django.http import HttpResponseRedirect from django.utils.translation import ugettext_lazy as _ from django.views.generic import DetailView from shuup.admin.shop_provider import get_shop from shuup.admin.supplier_provider import get_...
#!/usr/bin/python """Test of column header output.""" from macaroon.playback import * import utils sequence = MacroSequence() sequence.append(KeyComboAction("End")) sequence.append(KeyComboAction("<Shift>Right")) sequence.append(KeyComboAction("Down")) sequence.append(KeyComboAction("Down")) sequence.append(KeyComb...
""" RxTerms loading Ben Adida 2010-08-25 """ from django.utils import simplejson from loadutils import create_codingsystem import os.path import csv from codingsystems import models def load(stream, codingsystem, delimiter='|'): """ load data from a file input stream. """ csv_reader = csv.reader(st...
''' Created on Jan 21, 2011 @author: al ''' from schema import SolrSchema, SolrSchemaFields, SolrFieldTypes from model import Field from config import StandardSolrConfig from util import NotGiven def set_if_not_defined(cls, attr, val): if not hasattr(cls, attr) or getattr(cls, attr) == getattr(object, attr): ...
#!/usr/bin/env python from __future__ import print_function import argparse from datetime import datetime import hashlib from io import BytesIO import os import subprocess import sys import tarfile import tempfile import docker from docker import errors build_dir = os.path.abspath(os.path.dirname(__file__)) def pa...
# vim: set ts=4 sw=4 tw=0 et : from __future__ import absolute_import from __future__ import print_function from __future__ import division import networkx as nx from networkx.readwrite import json_graph as nxjson from distutils.dir_util import mkpath import re import os, os.path, sys ### REGEXP STRINGS RE_TIME ...
# -*- coding: utf-8 -*- ''' Yoda Add-on 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 ...
"""Utilities shared by tests.""" import collections import contextlib import io import logging import os import re import socket import socketserver import sys import tempfile import threading import time import unittest import weakref from unittest import mock from http.server import HTTPServer from wsgiref.simple_...
from django.http import HttpResponse, Http404 from django.template import loader from django.contrib.gis.db.backend import SpatialBackend from django.contrib.sites.models import Site from django.core import urlresolvers from django.core.paginator import EmptyPage, PageNotAnInteger from django.db.models import get...
"""Flat network GlusterFS Driver. Manila shares are subdirectories within a GlusterFS volume. The backend, a GlusterFS cluster, uses one of the two NFS servers, Gluster-NFS or NFS-Ganesha, based on a configuration option, to mediate access to the shares. NFS-Ganesha server supports NFSv3 and v4 protocols, while Gluste...
########### # Thanks to baumer1122 for his AdminImageWidget snippet: http://www.djangosnippets.org/snippets/934/ ########### from django.contrib.admin.widgets import AdminFileWidget from django.utils.translation import ugettext as _ from django.utils.safestring import mark_safe from django.conf import settings from ...
from django.db import models from django.db.models import OneToOneField import json from django.core.serializers.json import DjangoJSONEncoder from django.db.models.fields.related import SingleRelatedObjectDescriptor class JSONField(models.TextField): """ JSONField is a generic textfield that neatly serializes...
""" Helpers for clustering and determining "cluster leadership" and other clustering-related helpers. """ import subprocess import os from socket import gethostname as get_unit_hostname import six from charmhelpers.core.hookenv import ( log, relation_ids, related_units as relation_list, relation_get...
from typing import TYPE_CHECKING import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpR...
''' run with: python ten2eleven.py -f agmethods test_dummy_old_MDA_code.py Author: Tyler Reddy ''' from __future__ import absolute_import from lib2to3.fixer_base import BaseFix from lib2to3.fixer_util import Name, Call, LParen, RParen, ArgList, Dot from lib2to3 import pytree class FixAgmethods(BaseFix): PATTER...
from __future__ import with_statement import os import pkg_resources import sys from appenlight_client import client import logging logging.basicConfig() cwd = os.getcwd() class CommandRouter(object): @classmethod def makeini(cls, ini_name): while True: print '\nCurrent directory: %s' % ...
from hashlib import sha256 from typing import Union from os import urandom from btcpy.structs.crypto import PublicKey, PrivateKey from btcpy.structs.transaction import MutableTransaction, TxOut from btcpy.structs.sig import P2pkhSolver from pypeerassets.networks import net_query class Kutil: def __init__(self,...
from oslo_config import cfg from neutron.agent.common import config cisco_opts = [ cfg.StrOpt('vlan_name_prefix', default='q-', help=_("VLAN Name prefix")), cfg.StrOpt('provider_vlan_name_prefix', default='p-', help=_("VLAN Name prefix for provider vlans")), cfg.BoolOpt('pro...
#!/usr/bin/python # This classifier is based on the NaiveBayesClassifier provided in NLTK. It strips out many of # the dependencies in that classifier and replaces them with builtin Python data types. It also # limits features to be boolean in nature allowing for simplification of the training and # classifying proces...
import sys import petsc4py petsc4py.init(sys.argv) import numpy as np from petsc4py import PETSc from src import stokes_flow as sf from src.myio import * from src.support_class import * from src.objComposite import * from matplotlib import pyplot as plt def get_problem_kwargs(**main_kwargs): problem_kwargs = ge...
from qapi import * def gen_event_send_proto(name, arg_type, boxed): return 'void qapi_event_send_%(c_name)s(%(param)s)' % { 'c_name': c_name(name.lower()), 'param': gen_params(arg_type, boxed, 'Error **errp')} def gen_event_send_decl(name, arg_type, boxed): return mcgen(''' %(proto)s; ''', ...
# -*- coding: UTF-8 -*- import re,urllib,urlparse,json,base64 from resources.lib.modules import cleantitle from resources.lib.modules import client from resources.lib.modules import directstream from resources.lib.modules import jsunfuck CODE = '''def retA(): class Infix: def __init__(self, function): ...
from __future__ import print_function from __future__ import division from __future__ import absolute_import from builtins import object import unittest import mock from stacker.actions import destroy from stacker.context import Context, Config from stacker.exceptions import StackDoesNotExist from stacker.status impo...
import base import mock from pulp.server.db.model.event import EventListener from pulp.server.event import notifiers from pulp.server.event import data as event_data from pulp.server.managers import factory as manager_factory class EventFireManagerTests(base.PulpServerTests): def setUp(self): super(Even...
from Components.config import ConfigOnOff, ConfigSelection, ConfigSubsection, ConfigText, config from Components.Keyboard import keyboard from Components.Language import language def InitSetupDevices(): def languageNotifier(configElement): language.activateLanguage(configElement.value) config.osd = ConfigSubsecti...
'''Unit test suite that collects template_writer tests.''' import os import sys import unittest class TestSuiteAll(unittest.TestSuite): def __init__(self): super(TestSuiteAll, self).__init__() # Imports placed here to prevent circular imports. # pylint: disable-msg=C6204 import policy_template_gen...
import os import tempfile import zipfile def _read_env_file(path, except_env=None): """Read the environment variable file. :param path: the path of the file :param except_env: the environment variable to avoid in the output :returns: the content of the original file except the line starting with ...
from __future__ import unicode_literals from __future__ import print_function from __future__ import division from __future__ import absolute_import from builtins import * # noqa import logging import sys import textwrap import pytest import requests import talisker.logs from talisker import testing def test_log_...
import json from kilda.probe.entity.message import create_dump_state def test_validate_message_request_format(): with open('./kilda/probe/test/res/CtrlRequest.json') as f: etalon_request = json.load(f) dump_state_command = create_dump_state(etalon_request['correlation_id'], ...