code stringlengths 1 199k |
|---|
from __future__ import unicode_literals
from django.db import models
from django.core.paginator import Paginator, PageNotAnInteger
from wagtail.wagtailcore.models import Page
from wagtail.wagtailcore.fields import RichTextField
from wagtail.wagtailadmin.edit_handlers import FieldPanel
from wagtail.wagtailimages.edit_ha... |
import re
import time
class BaseCounters:
def __init__(self):
self.keyre = re.compile('\A[\w.]+\Z')
def ping(self, key):
self.validate_key(key)
self.do_ping(key, int(time.time()))
def hit(self, key, n=1):
self.validate_key(key)
self.do_hit(key, n)
def validate_key(self, key):
if re.match... |
from django.db import connection
from laboratory.settings import TIME_ZONE
from utils.db import namedtuplefetchall
def get_history_dir(d_s, d_e, card_id, who_create_dir, services, is_serv, iss_pk, is_parent, for_slave_hosp):
with connection.cursor() as cursor:
cursor.execute(
"""WITH
t_i... |
from django import forms
from .models import PassType, Registration
class SignupForm(forms.ModelForm):
pass_type = forms.ModelChoiceField(
queryset=PassType.objects.filter(active=True),
widget=forms.widgets.RadioSelect(),
)
class Meta:
model = Registration
fields = (
... |
import urllib.request as urllib
from bs4 import BeautifulSoup as bs
import unicodedata
import pandas as pd
import os
baseURL='http://snre.ifas.ufl.edu/academics/graduate/courses-syllabi-and-curriculum/'
classListFile='majorClassLists/SNREList.csv'
html_titles = ['Principles of Ecology Courses','Particular Perspectives ... |
"""
The ``config`` module
=====================
Create a named logger and return it so users can log in different log files : one for each module.
"""
__author__ = 'Salas'
__copyright__ = 'Copyright 2014 LTL'
__credits__ = ['Salas']
__license__ = 'MIT'
__version__ = '0.2.0'
__maintainer__ = 'Salas'
__email... |
from __future__ import unicode_literals
import warnings
import datetime
import frappe
import frappe.defaults
import frappe.async
import re
import frappe.model.meta
from frappe.utils import now, get_datetime, cstr, cast_fieldtype
from frappe import _
from frappe.model.utils.link_count import flush_local_link_count
from ... |
import webbrowser
import qmk
class BrowseCommand(qmk.Command):
'''Open the supplied URL in the default web browser.'''
def __init__(self):
self._name = 'browse'
self._help = self.__doc__
@qmk.Command.actionRequiresArgument
def action(self, arg):
webbrowser.open_new_tab(arg)
def c... |
import sys
sys.path.append("../../")
from unittest.mock import patch, MagicMock
MockRPi = MagicMock()
MockSpidev = MagicMock()
modules = {
"RPi": MockRPi,
"RPi.GPIO": MockRPi.GPIO,
"spidev": MockSpidev
}
patcher = patch.dict("sys.modules", modules)
patcher.start()
from gfxlcd.driver.ssd1306.spi import SPI
f... |
from functools import reduce
import numpy as np
class Qubit:
KET = True
BRA = False
# Creates a new qubit |n> or <n| where n is one or zero
def __init__(self, n, state=KET):
if state != Qubit.KET and state != Qubit.BRA:
raise ValueError("State must be either KET or BRA")
self... |
"""
Configuration parameters:
path.internal.ansi2html
"""
import sys
import os
import re
from subprocess import Popen, PIPE
MYDIR = os.path.abspath(os.path.join(__file__, '..', '..'))
sys.path.append("%s/lib/" % MYDIR)
from config import CONFIG
from globals import error
from buttons import TWITTER_BUTTON, GITHUB_BU... |
import sys
import configparser
import os
import shutil
from PyQt5 import QtWidgets
from PyQt5 import QtWebKitWidgets
from PyQt5 import QtCore
home_dir = os.path.expanduser("~")
conf_path = os.path.join(home_dir, ".config/mrps/mrps.conf")
config = configparser.ConfigParser(delimiters=('='))
config.read(conf_path)
def cl... |
import sys
from . import EpsImagePlugin
class PSDraw:
"""
Sets up printing to the given file. If **fp** is omitted,
:py:attr:`sys.stdout` is assumed.
"""
def __init__(self, fp=None):
if not fp:
fp = sys.stdout
self.fp = fp
def _fp_write(self, to_write):
if sel... |
"""Core XML support for Python.
This package contains four sub-packages:
dom -- The W3C Document Object Model. This supports DOM Level 1 +
Namespaces.
parsers -- Python wrappers for XML parsers (currently only supports Expat).
sax -- The Simple API for XML, developed by XML-Dev, led by David
Megginson an... |
import json
from google.appengine.ext import ndb
from models.account import Account
class Suggestion(ndb.Model):
"""
Suggestions are generic containers for user-submitted data corrections to
the site. The generally store a model, a key, and then a json blob of
fields to append or ammend in the model.
... |
import argparse
import structlog
import logging
from pyramid.paster import get_app
from snovault.elasticsearch.create_mapping import run as run_create_mapping
from dcicutils.log_utils import set_logging
from dcicutils.deployment_utils import CreateMappingOnDeployManager
log = structlog.getLogger(__name__)
EPILOG = __do... |
import json
import gspread
from oauth2client.client import SignedJwtAssertionCredentials
import datetime
from participantCollection import ParticipantCollection
participantFileNames = ['../stayclean-2014-november/participants.txt',
'../stayclean-2014-december/participants.txt',
... |
"""
WSGI config for stormtrooper project.
It exposes the WSGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/1.8/howto/deployment/wsgi/
"""
import os
from django.core.wsgi import get_wsgi_application
os.environ.setdefault("DJANGO_SETTI... |
""" Unit tests for ``wheezy.templates.engine.Engine``.
"""
import unittest
class EngineTestCase(unittest.TestCase):
""" Test the ``Engine``.
"""
def setUp(self):
from wheezy.template.engine import Engine
from wheezy.template.loader import DictLoader
self.engine = Engine(
... |
from collections import defaultdict
import re
import json
import os
import Pubnub as PB
PUB_KEY = os.environ["PUB_KEY"]
SUB_KEY = os.environ["SUB_KEY"]
SEC_KEY = os.environ["SEC_KEY"]
CHANNEL_NAME = os.environ["CHANNEL_NAME"]
def frequency_count(text):
"determine count of each letter"
count = defaultdict(int)
... |
import requests
import random
import time
from pyquery import PyQuery as pq
from mongodb import db, conn
from requests.exceptions import ConnectionError
from chem_log import log
base_url = 'http://www.sigmaaldrich.com'
chromatography_db_collection = {
0: db.sigma_chromatography_urls_0,
1: db.sigma_chromatograph... |
import unittest
try:
from unittest.mock import MagicMock
except ImportError:
from mock import MagicMock
from azure.cli.command_modules.resource._validators import (validate_resource_type,
validate_parent,
... |
from grslra import testdata
from grslra.grslra_batch import grslra_batch, slra_by_factorization
from grslra.structures import Hankel
from grslra.scaling import Scaling
import numpy as np
import time
PROFILE = 0
if PROFILE:
import cProfile
N = 80
m = 20
k = 5
sigma=0.05
outlier_rate = 0.05
outlier_amplitude = 1
rate... |
"""segy.py - read and write SEG-Y files
From command line:
python segy.py <path-to-segy-file>
"""
from collections import OrderedDict
from pprint import pprint
import numpy as np
from sacker import Sacker
SAMPLE_FORMATS = {
'f': 5, # 4-byte, IEEE floating-point
'i': 2, # 4-byte, two's complement integer
... |
import pytoolkit as tk
module = tk.applications.darknet53
def test_model():
model = module.create(input_shape=(256, 256, 3), weights=None)
assert tuple(module.get_1_over_1(model).shape[1:3]) == (256, 256)
assert tuple(module.get_1_over_2(model).shape[1:3]) == (128, 128)
assert tuple(module.get_1_over_4(... |
from oauth2_provider.settings import oauth2_settings
from oauthlib.common import generate_token
from django.http import JsonResponse
from oauth2_provider.models import AccessToken, Application, RefreshToken
from django.utils.timezone import now, timedelta
def get_token_json(access_token):
"""
Takes an AccessTok... |
import Queue
import atexit
import logging
import threading
import traceback
class WorkerPool(object):
""" Pool of worker threads; grows as necessary. """
_lock = threading.Lock()
_pool = None # Singleton.
def __init__(self):
self._idle = [] # Queues of idle workers.
self._workers = {} ... |
from jsonrpc import ServiceProxy
import sys
import string
rpcuser = ""
rpcpass = ""
if rpcpass == "":
access = ServiceProxy("http://127.0.0.1:9332")
else:
access = ServiceProxy("http://"+rpcuser+":"+rpcpass+"@127.0.0.1:9332")
cmd = sys.argv[1].lower()
if cmd == "backupwallet":
try:
path = raw_input("Enter destinat... |
from __future__ import generators
"""
This module contains convenience functions for working with files and paths.
"""
__version__ = '0.2.4'
import os
import sys
import time
__all__ = (
'readlines',
'writelines',
'readbinary',
'writebinary',
'readfile',
'writefile',
'tslash',
'relpath',
... |
alpha = "abcdefghijklmnopqrstuvwxyz"
for n in range(0, 26, 1):
print alpha[0:n+1]
for n in range(26, 1, -1):
print alpha[0:n-1]
"""
alpha = "a"
m = ord(alpha)
n = 0
while n < m:
print chr(m + 1) in range(65, 122)
m += 1
for i in range(ord('a'), 123, 1):
print chr(i[0:m+1])
while m < 123:
print chr(m[0:])
""" |
import re # pour re.split()
import sys # pour args
import math # pour sqrt
def float_or_int(value):
try:
int(value)
return int(value)
except ValueError:
return float(value)
def is_float_or_int(value):
try:
float(value)
return True
except ValueError:
return False
def parser_ligne(ligne):
... |
import lms_code.lib.rep2 as rep2
from lms_code.analysis.run_bem import bemify, boundary_conditions,\
assemble, constrain, solve, evaluate_surface_disp
from lms_code.analysis.simplified_bem import create_surface_mesh, \
set_params
from codim1.core import simple_line_mesh, combine_meshes, ray_mesh
def create_faul... |
from django.contrib.auth.models import User
from game.models import Point, Team
def addPoint(blame_username, fixer_username):
blame = User.objects.get(username=blame_username)
fixer = User.objects.get(username=fixer_username)
point = Point()
point.blame = blame
point.fixer = fixer
point.save()
return point
def g... |
from django.utils import translation
from django.conf import settings
from froide.celery import app as celery_app
from froide.foirequest.models import FoiRequest
from .models import FoiRequestFollower
from .utils import run_batch_update
@celery_app.task
def update_followers(request_id, update_message, template=None):
... |
import numpy as np
import matplotlib.pyplot as plt
import inspect # Used for storing the input
class AquiferData:
def __init__(self, model, kaq, z, Haq, Hll, c, Saq, Sll, poraq, porll,
ltype, topboundary, phreatictop, kzoverkh=None, model3d=False):
'''kzoverkh and model3d only need to be sp... |
from django.test import TestCase
from morelia.decorators import tags
from smarttest.decorators import no_db_testcase
from tasks.factories import TaskFactory, UserFactory
@no_db_testcase
@tags(['unit'])
class TaskGetAbsoluteUrlTest(TestCase):
''' :py:meth:`tasks.models.Task.get_absolute_url` '''
def test_should_... |
""" Defines an action for moving the workspace to the user's home directory.
"""
from os.path import expanduser
from enthought.traits.api import Bool, Instance
from enthought.pyface.api import ImageResource
from enthought.pyface.action.api import Action
from enthought.envisage.ui.workbench.workbench_window import Workb... |
"""
Flow's list of built-in types available in 0.44.0 (Apr 13, 2017).
Related to
https://flow.org/en/docs/types/
and
http://www.saltycrane.com/blog/2016/06/flow-type-cheat-sheet/
"""
def print_type_format(trigger, content=None, description=None):
"""Format output for autocompletion for a given trigger text.... |
from ansiblelint.rules import AnsibleLintRule
class GitHasVersionRule(AnsibleLintRule):
id = '401'
shortdesc = 'Git checkouts must contain explicit version'
description = (
'All version control checkouts must point to '
'an explicit commit or tag, not just ``latest``'
)
severity = 'M... |
"""Backport of functools.lru_cache from Python 3.3 as published at ActiveState"""
from __future__ import absolute_import
import functools
from collections import namedtuple
from threading import RLock
_CacheInfo = namedtuple("CacheInfo", ["hits", "misses", "maxsize", "currsize"])
@functools.wraps(functools.update_wrapp... |
'''
Created on Sep 22, 2016
@author: rtorres
'''
import os
from flaskiwsapp.settings.baseConfig import BaseConfig
class DevConfig(BaseConfig):
"""Development configuration"""
ENV = 'dev'
DEBUG = True
DEBUG_TB_ENABLED = True
SQLALCHEMY_DATABASE_URI = 'postgresql://localhost/example'
AUTH0_CALLBAC... |
import socket, threading, thread, os, sys, time
def create(settings):
return IrcBot(settings)
class IrcBot:
_settings = {}
_debug = None
_client = "ArmedGuys IRC Bot"
_version = "0.5"
_env = "Python"
_socket = None
# Channels the bot is in
_channels = []
# Message Loop
_messa... |
from django.conf import settings
from django.contrib.auth import logout
from django.core.urlresolvers import reverse
from django.http import HttpResponseRedirect
from django.utils.translation import ugettext_lazy as _
from django.views.generic.base import View, TemplateView
from socialregistration.clients.oauth import ... |
import configs.module
import wsgiref.simple_server
import select
import json
import bot
from urllib import parse
import irc.fullparse
import irc.splitparse
import os.path
def init(options):
m = configs.module.Module(__name__)
if 'wserver' in options['server'].state:
del options['server'].state['wserver'... |
class ListNode(object):
def __init__(self, x):
self.val = x
self.next = None
class Solution(object):
def deleteNode2(self, node):
"""
:type node: ListNode
:rtype: void Do not return anything, modify node in-place instead.
"""
curt = node
prev = None... |
from django import template
from djangopress.core.util import smart_truncate_chars as _smart_truncate_chars
register = template.Library()
@register.filter(name='smarttruncatechars')
def smart_truncate_chars(value, max_length):
return _smart_truncate_chars(value, max_length) |
from __future__ import absolute_import, print_function
import os
import pwd
import grp
import sys
import subprocess
from .command import Command
class AuthorizedKeysCommand(Command):
"""
Get authorized keys for a user using NSS and SSSD.
"""
@staticmethod
def configure_parser(parser):
"""
... |
"""
Writes Python egg files.
Supports what's needed for saving and loading components/simulations.
"""
import copy
import os.path
import re
import sys
import zipfile
import pkg_resources
from openmdao.util import eggobserver
__all__ = ('egg_filename', 'write')
_EGG_NAME_RE = re.compile('[a-zA-Z][_a-zA-Z0-9]*')
_EGG_VER... |
from .. import Provider as PersonProvider
class Provider(PersonProvider):
formats_female = (
'{{first_name_female}} {{last_name}}',
'{{first_name_female}} {{last_name}}',
'{{first_name_female}} {{last_name}}',
'{{first_name_female}} {{last_name}}',
'{{first_name_female}} {{la... |
from __future__ import absolute_import
import pytest
from openpyxl.xml.functions import fromstring, tostring
from openpyxl.tests.helper import compare_xml
@pytest.fixture
def BubbleChart():
from ..bubble_chart import BubbleChart
return BubbleChart
class TestBubbleChart:
def test_ctor(self, BubbleChart):
... |
"""
This module contains a helper to extract various kinds of primitive data types
from a dictionary of strings.
"""
class StringDictHelper:
"""
Helper class to extract primitive types from a dictionary of strings. This is a port
of Java robotutils class StringmapHelper. The special values 'true' and ... |
from pathlib import Path
import click
from git import Repo
from git.exc import InvalidGitRepositoryError
from logger import logger
from config import config
from utils import PairedObject, PairedProject, get_current_project, PathType
@click.group()
@click.option('-v', '--verbose', is_flag=True, help='Enables verbose me... |
' module description'
import os
__author__ = 'Andrew Wen'
def file_extension(filename):
"""
获取文件后缀名
:param path:
:return:
"""
#return os.path.splitext(path)[1]
return filename.rsplit('.', 1)[1].lower() |
import datetime
from django.views.generic.detail import SingleObjectMixin
from django.views.generic.list import ListView
from django.views.generic.base import View
from django.utils.translation import ugettext as _
from django.http import Http404, HttpResponseRedirect
from django.core.urlresolvers import reverse
from f... |
"""
We have two special characters. The first character can be represented by one bit 0. The second character can be represented by two bits (10 or 11).
Now given a string represented by several bits. Return whether the last character must be a one-bit character or not. The given string will always end with a zero.
Exa... |
"""
XML handler for element id condition
"""
from pyhmsa.spec.condition.elementalid import ElementalID, ElementalIDXray
from pyhmsa.fileformat.xmlhandler.condition.condition import _ConditionXMLHandler
class ElementalIDXMLHandler(_ConditionXMLHandler):
def __init__(self, version):
super().__init__(Elemental... |
from gi.repository import GObject, Gtk, Gtranslator, PeasGtk
from panel import Panel
import sys
from gettext import _
class TrobadorPlugin(GObject.Object, Gtranslator.TabActivatable, PeasGtk.Configurable):
__gtype_name__ = "TrobadorPlugin"
tab = GObject.property(type=Gtranslator.Tab)
handler_id = None
p... |
from helper import greeting
if "__name__" == "__main__":
greeting('hello') |
import datetime
import warnings
import re
from math import ceil
from collections import namedtuple
from contextlib import contextmanager
from distutils.version import LooseVersion
import numpy as np
from pandas.util.decorators import cache_readonly, deprecate_kwarg
import pandas.core.common as com
from pandas.core.gene... |
from django import forms
from django.forms import Form, ModelForm
from django.utils import timezone
from webapp.models import Task, TaskGroup, TaskGroupSet
from webapp.validators import validate_package
from webapp.widgets import CustomSplitDateTimeWidget
class TaskGroupForm(ModelForm):
class Meta:
model = ... |
'''
Pypi cache server
Original author: Victor-mortal
'''
import os
import httplib
import urlparse
import logging
import locale
import json
import hashlib
import webob
import gevent
from gevent import wsgi as wsgi_fast, pywsgi as wsgi, monkey
CACHE_DIR = '.cache'
wsgi = wsgi_fast # comment to use pywsgi
host = '0.0.0.0'... |
""" Example program for JDEV Mercurial tutorial """
from optparse import OptionParser
def calculate_result(white_balls, power_ball):
""" Computation is lauched here """
for ball in white_balls:
if ball < 1 or ball > 59:
return -1
if power_ball < 1 or power_ball > 39:
return -1
... |
"""PySide port of the network/http example from Qt v4.x"""
import sys
from PySide import QtCore, QtGui, QtNetwork
class HttpWindow(QtGui.QDialog):
def __init__(self, parent=None):
QtGui.QDialog.__init__(self, parent)
self.urlLineEdit = QtGui.QLineEdit("http://www.ietf.org/iesg/1rfc_index.txt")
... |
from __future__ import with_statement
import time
import unittest
import STAF
class HandleTests(unittest.TestCase):
def assertSTAFResultError(self, rc, func, *args, **kwargs):
try:
func(*args, **kwargs)
self.fail('STAFResultError not raised')
except STAF.STAFResultError, exc:... |
"""Unit test of the AlignmentScan
@author: Kay Kasemir
"""
from __future__ import print_function
import unittest
from scan.commands import Set, CommandSequence
from scan.alignment import AlignmentScan
class AlignmentTest(unittest.TestCase):
def testBasics(self):
align = AlignmentScan("motor_x", 0, 10, 0.... |
import os, requests, time
import mydropbox
edmunds = mydropbox.get_keys('edmunds')
api_key = edmunds['api_key']
api_secret = edmunds['api_secret']
vin = mydropbox.read_dropbox_file(os.path.join('Records', 'Financials', 'Car', 'VIN')).strip()
r = requests.get("https://api.edmunds.com/api/vehicle/v2/vins/%s?&fmt=json&api... |
from __future__ import absolute_import
from Screens.Screen import Screen
from Components.ConfigList import ConfigListScreen
from Components.config import ConfigSubsection, ConfigSelection, getConfigListEntry
from Components.SystemInfo import SystemInfo
from Components.Task import job_manager
from Screens.InfoBarGeneric... |
import AbstractCheck
from Filter import addDetails, printError, printWarning
class ConfigCheck(AbstractCheck.AbstractCheck):
def __init__(self):
AbstractCheck.AbstractCheck.__init__(self, "ConfigCheck")
def check_binary(self, pkg):
config_files = pkg.configFiles()
noreplace_files = pkg.n... |
import os
import re
import sys
from codecs import BOM_UTF8, BOM_UTF16, BOM_UTF16_BE, BOM_UTF16_LE
from lib.six import six
from _version import __version__
compiler = None
BOMS = {
BOM_UTF8: ('utf_8', None),
BOM_UTF16_BE: ('utf16_be', 'utf_16'),
BOM_UTF16_LE: ('utf16_le', 'utf_16'),
BOM_UTF16: ('utf_16',... |
from ppclass import pp
var1 = pp(\
file="/home/aymeric/Big_Data/DATAPLOT/diagfired.nc",\
var="ps",\
x=None,\
y=10.,\
t=2.)
var1.get()
var2 = pp(\
file="/home/aymeric/Big_Data/DATAPLOT/diagfired.nc",\
var="phisinit",\
x=None,\
y=10.,\
t=2.)
var2.get()
var2 = var2 / 3.72
S = var2.func(var1)
S.p[0].marker = 'o'
S.p[0].lin... |
import time
import net.mapserv as mapserv
import net.charserv as charserv
import commands
import walkto
import logicmanager
import status
import plugins
from collections import deque
from net.inventory import get_item_index, get_storage_index
from utils import extends
from actor import find_nearest_being
from chat impo... |
"""
WSGI config for geodjango_smurfs project.
It exposes the WSGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/1.9/howto/deployment/wsgi/
"""
import os
from django.core.wsgi import get_wsgi_application
os.environ.setdefault("DJANGO_S... |
import json
import os
import random
import re
import shlex
import string
import sys
import time
from twisted.cred import credentials
from twisted.internet import defer
from twisted.internet import protocol
from twisted.internet import reactor
from twisted.internet import task
from twisted.internet import utils
from twi... |
from psychopy import visual, event, core, misc, data, gui, sound
def ready_cont():
stim_win.flip()
user_response=None
while user_response==None:
allKeys=event.waitKeys()
for thisKey in allKeys:
if thisKey=='y':
user_response=1
if thisKey=='q':
core.quit()
music = sound.Sound(90... |
import logging
from collections import defaultdict
from six import text_type
from Cerebrum import Entity
from Cerebrum.modules.no.OrgLDIF import OrgLdifEntitlementsMixin
from Cerebrum.modules.LDIFutils import (
attr_unique,
normalize_string,
)
from Cerebrum.Utils import make_timer
logger = logging.getLogger(__n... |
import sys
sys.path.append('/usr/share/mandriva/')
from mcc2.backends.services.service import Services
if __name__ == '__main__':
Services.main() |
import sys
import gdb
import os
import os.path
pythondir = '/usr/mips64-elf/share/gcc-4.8.4/python'
libdir = '/usr/mips64-elf/mips64-elf/lib/el'
if gdb.current_objfile () is not None:
# Update module path. We want to find the relative path from libdir
# to pythondir, and then we want to apply that relative pat... |
import openwns
import openwns.node
import openwns.geometry.position
import imtaphy.Station
import imtaphy.Logger
import imtaphy.Channel
import imtaphy.Pathloss
import imtaphy.Scanner
import imtaphy.LinkManagement
import imtaphy.SCM
import imtaphy.ScenarioSupport
import imtaphy.Antenna
import imtaphy.Logger
import imtap... |
import sys
import traceback
_debug=False
def debugprint (x):
if _debug:
try:
print x
except:
pass
def get_debugging ():
return _debug
def set_debugging (d):
global _debug
_debug = d
def fatalException (exitcode=1):
nonfatalException (type="fatal", end="Exiting... |
print sum([x for x in xrange(1,1000) if (x % 3 == 0) or (x % 5 == 0)]) |
import logging
import re
import socket
import binascii
import sys
import os
import time
import gevent
import subprocess
import atexit
from Config import config
from Crypt import CryptRsa
from Site import SiteManager
from lib.PySocks import socks
from gevent.coros import RLock
from util import helper
from Debug import D... |
from flask.ext.wtf import Form
from wtforms import StringField, BooleanField, PasswordField, SelectField, DateTimeField, TextAreaField |
import cgi
import hashlib
import http.server
import io
import os
import posixpath
import ssl
import threading
import time
import urllib.parse
import pyftpdlib.authorizers
import pyftpdlib.handlers
import pyftpdlib.servers
class FTPServer:
def __init__(self, port, root, report_size):
class FTPHandlerNoSIZE(p... |
'''
Created on Sep 15, 2010
@author: duncantait
'''
from SimPy.Simulation import *
import numpy as np
import random
import math
class G():
#Settings for HF Stations
num_channels = 18
num_stations = 10
class Network():
stations = []
class Medium():
def __init__(self):
self.channels = []
... |
from PyQt4.QtGui import *
from PyQt4.QtCore import *
from view.changesUi import Ui_changeSummary
import string
class ChangeWin(QDialog):
"""A QDialog that lists changes before they are commited.
:param QDialog: Parent class.
"""
def __init__(self, parent):
"""Initialize ChangeWin.
:param... |
from pyanaconda.errors import ScriptError, errorHandler
from blivet.deviceaction import ActionCreateFormat, ActionDestroyFormat, ActionResizeDevice, ActionResizeFormat
from blivet.devices import LUKSDevice
from blivet.devices.lvm import LVMVolumeGroupDevice, LVMCacheRequest
from blivet.devicelibs.lvm import LVM_PE_SIZE... |
import warnings
from . import pedrpc
from .base_monitor import BaseMonitor
class ProcessMonitor(BaseMonitor, pedrpc.Client):
"""
Proxy class for the process monitor interface.
In Versions < 0.2.0, boofuzz had network and process monitors
that communicated over RPC. The RPC client was directly passed
... |
"""Widget that represents a page in the document."""
import collections
import textwrap
import numpy as N
from .. import qtall as qt
from .. import document
from .. import setting
from .. import utils
from . import widget
from . import controlgraph
def _(text, disambiguation=None, context='Page'):
"""Translate text... |
import time
import numpy
from rga_telnet import *
class RGA:
scan = True # This is used for stop of peak scan - if set to False
status = [0 for col in range(4)] # Status of the device, look in rga_status method
showReadout = True # This one is responsible for the text output from RGA
# Class constructor
def __i... |
from katello.client.api.base import KatelloAPI
class PackageAPI(KatelloAPI):
"""
Connection class to access package calls
"""
def package(self, packageId, repoId):
path = "/api/repositories/%s/packages/%s" % (repoId, packageId)
pack = self.server.GET(path)[1]
return pack
def ... |
import fauxfactory
import pytest
from cfme.services.catalogs.catalog_item import CatalogItem
from cfme.automate.service_dialogs import ServiceDialog
from cfme.services.catalogs.catalog import Catalog
from cfme.services.catalogs.service_catalogs import ServiceCatalogs
from cfme.services.catalogs.catalog_item import Cata... |
import sys
import os
import os.path
try:
import builtins as builtin
except ImportError:
import __builtin__ as builtin
from os.path import getmtime, exists
import time
import types
from Cheetah.Version import MinCompatibleVersion as RequiredCheetahVersion
from Cheetah.Version import MinCompatibleVersionTuple as ... |
from django.contrib.auth import get_user_model
from django.db import transaction
from django.db.models.signals import pre_delete
from django.dispatch import Signal, receiver
from misago.categories.models import Category
from misago.categories.signals import delete_category_content, move_category_content
from misago.cor... |
from model import Model
from helpers.candidate import Candidate
from helpers.decision import Decision
class Osyczka2(Model):
def __init__(self):
Model.__init__(self)
self.initialize_decs()
def initialize_decs(self):
dec = Decision('x1', 0, 10)
self.decs.append(dec)
dec = ... |
'''Descriptions of the fields that can make up gazetteer data files, along
with information on their SQL equivalents'''
import abc
class GazetteerField(metaclass=abc.ABCMeta):
'''An abstract class that defines a field/column in a gazetteer data
table.'''
sql_type_name = 'NONE'
def __init__(self, field_n... |
import time
from PyQt4 import QtGui, QtCore, QtOpenGL
from PyQt4.QtOpenGL import QGLWidget
import OpenGL.GL as gl
import OpenGL.arrays.vbo as glvbo
import numpy as np
import raster
import slider
import draw_texture
import qt_helpers
raster_width = 1024
raster_height = 64
raster_n_neurons = 64
spikes_per_frame = 5
class... |
from ....const import LOCALE as glocale
_ = glocale.translation.gettext
from .._hasnotesubstrbase import HasNoteSubstrBase
class HasNoteMatchingSubstringOf(HasNoteSubstrBase):
"""Media having notes containing <substring>"""
name = _('Media objects having notes containing <substring>')
description = _... |
from flask.ext.wtf import Form
from wtforms import StringField, BooleanField, TextAreaField, SelectField, FileField, IntegerField
from wtforms.validators import DataRequired, regexp, NumberRange
from wtforms.ext.sqlalchemy.fields import QuerySelectField
from picture_hunt.models import Team, Task
class TeamForm(Form):
... |
'''
from https://docs.djangoproject.com/en/1.7/topics/auth/customizing/#specifying-a-custom-user-model
'''
from django import forms
from django.contrib import admin
from django.contrib.auth.admin import UserAdmin
from django.contrib.auth.forms import ReadOnlyPasswordHashField
from django.utils.translation import gettex... |
from PyQRNative import *
from PIL.Image import BILINEAR, BICUBIC, ANTIALIAS, NEAREST
from reportlab.pdfgen import canvas
from reportlab.lib.pagesizes import portrait, A4
from reportlab.lib.units import cm, mm
from StringIO import StringIO
from plant.tag import create_tag
import time
from datetime import datetime
QR_TYP... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.