code stringlengths 1 199k |
|---|
from django.db import models
from django.utils.translation import ugettext_lazy as _
from enum import Enum
class BaseManager(models.Manager):
def get_or_404(self, *args, **kwargs):
"""
Returns instance or raises 404.
"""
try:
instance = super(BaseManager, self).get(*args,... |
""" Module to take a water_level reading."""
try:
import ConfigParser as configparser # Python2
except ImportError:
import configparser # Python3
from hcsr04sensor import sensor
from raspisump import log, alerts, heartbeat
config = configparser.RawConfigParser()
config.read("/home/pi/raspi-sump/raspisump.conf... |
"""Parser classes for Cheetah's Compiler
Classes:
ParseError( Exception )
_LowLevelParser( Cheetah.SourceReader.SourceReader ), basically a lexer
_HighLevelParser( _LowLevelParser )
Parser === _HighLevelParser (an alias)
Meta-Data
================================================================================
... |
import re
import sys
import time
import socket
import urllib2
def is_valid_ip(addr):
"""
Thanks to @Markus Jarderot on Stack Overflow
http://stackoverflow.com/a/319293
"""
return is_valid_ipv4(addr) or is_valid_ipv6(addr)
def is_valid_ipv4(addr):
"""
Thanks to @Markus Jarderot on Stack Overf... |
"""
Python library for the uh.cx link shortener.
http://uh.cx/
"""
import json
import requests
class Manager:
_url = 'http://uh.cx/api/create'
class Link:
url_original = ''
url_redirect = ''
url_preview = ''
qr_redirect = ''
qr_preview = ''
class InvalidResponseExcept... |
from tkinter import *
from tkinter import ttk
from functools import partial
from errors import InputError
class GUI:
def __init__(self, game):
# Initialise needed variables
self.game = game
self.no_dot = True
self.payment_flag = False
# Create window
self.root = Tk()
... |
import sys
table = []
seam = 0
holder = []
def Read_File():
#holder = []
number_of_args = len(sys.argv)
file = open(sys.argv[1], "r")
index = 0
for line in file:
line1 = line.split(", ")
holder.append(line1)
index += 1
print holder
return holder
def Create_Table(holde... |
from distutils.core import setup
from catkin_pkg.python_setup import generate_distutils_setup
d = generate_distutils_setup(
packages=['behavir_tree_visualizer'],
package_dir={'': 'src'}
)
setup(**d) |
import pytest
def test_operator_and(env):
def process(env):
timeout = [env.timeout(delay, value=delay) for delay in range(3)]
results = yield timeout[0] & timeout[1] & timeout[2]
assert results == {
timeout[0]: 0,
timeout[1]: 1,
timeout[2]: 2,
}
... |
import cPickle
import sys, os
import numpy as np
def generate_data(pkl_path, norm, sz, maxlen, step, mm, reverse):
X = cPickle.load(open(pkl_path, 'rb'))[:mm+1]
if reverse:
X.reverse()
X = np.array(X)
mins = []
maxs = []
if norm == 'minmax':
mins = X.min(axis=0, keepdims=True)
... |
"""
Django settings for app project.
Generated by 'django-admin startproject' using Django 1.10.6.
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
import ... |
import datoszs.commands
from spiderpig import run_cli
if __name__ == "__main__":
run_cli(
command_packages=[datoszs.commands],
) |
import codecs
import sys
def tidy(text):
return text.replace(u"\u00A0", " ").replace("$%", "<strong>").replace('%$','</strong>')
if __name__ == '__main__':
filename = sys.argv[1]
with codecs.open(filename, encoding='utf8') as infile:
text = tidy(infile.read())
with codecs.open(filename, 'w', enc... |
"""Integration with insteon devices."""
import json
import logging
import urllib
import time
from google.appengine.ext import ndb
from appengine import account, device, rest
@device.register('insteon_switch')
class InsteonSwitch(device.Switch):
"""Class represents a Insteon switch."""
insteon_device_id = ndb.Intege... |
__author__ = 'adam'
import unittest
from ErrorClasses import *
class TweetErrorTest(unittest.TestCase):
def setUp(self):
self.object = TweetError()
def tearDown(self):
pass
class TweetServiceErrorTest(unittest.TestCase):
def setUp(self):
pass
def tearDown(self):
pass
clas... |
import time
import unittest
import cryptocompare
import datetime
import calendar
import os
class TestCryptoCompare(unittest.TestCase):
def assertCoinAndCurrInPrice(self, coin, curr, price):
if isinstance(coin, list):
for co in coin:
self.assertCoinAndCurrInPrice(co, curr, price)
... |
"""If you run a Python socket server on a specific port and try to rerun it after closing it once, you
won't be able to use the same port.The remedy to this problem is to enable the socket reuse option, SO_REUSEADDR ."""
import socket
def reuse_socket_addr():
sock = socket.socket()
# get the old state of the SO... |
DEBUG = True
DEBUG_TB_INTERCEPT_REDIRECTS = False
SECRET_KEY = "\xdb\xf1\xf6\x14\x88\xd4i\xda\xbc/E'4\x7f`iz\x98r\xb9s\x1c\xca\xcd"
CSRF_ENABLED = True
SQLALCHEMY_DATABASE_URI = 'postgresql+psycopg2://datamart:datamart@localhost/datamart'
MAIL_SERVER = 'localhost'
MAIL_PORT = 25
SECURITY_PASSWORD_HASH = 'plaintext'
UPL... |
"""
Newrelic LVM Plugin
-------------
Plugin to monitor LVM Disk space left on NewRelic
"""
from setuptools import setup
setup(
name='nr_lvm_plugin',
version='0.1.6',
url='https://github.com/WebGeoServices/newrelic_lvm_plugin',
license='MIT',
author='WebGeoServices',
author_email='operation@webg... |
"""
"""
from __future__ import unicode_literals, absolute_import
import tempfile
import unittest
from os.path import join, exists
from autobit import manage, config
from autobit.db import Release
from autobit.tracker import totv
from autobit.classification import MediaType
class TestManage(unittest.TestCase):
def t... |
from django.conf import settings
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
('marks', '0002_auto_20150415_2348'),
]
operations = [
migrations.CreateModel(
name... |
from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union
import warnings
from azure.core.async_paging import AsyncItemPaged, AsyncList
from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error
from azure.core.pip... |
import functools
from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union
import warnings
from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error
from azure.core.paging import ItemPaged
from azure.core.pipeline impo... |
import wx
import pyHook
import pythoncom
import time
import win32api
import win32con
import threading
import pickle
from wx.lib.embeddedimage import PyEmbeddedImage
from wx.lib.wordwrap import wordwrap
figurefree = PyEmbeddedImage(
"iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAIAAAD8GO2jAAAAA3NCSVQICAjb4U/gAAAC0UlE"
"QVRI... |
import sys
import os
import re
import argparse
import fileinput
import copy
import itertools
from argparse import RawDescriptionHelpFormatter
from patterns import main_patterns
BUFFER_SIZE = 30
class Buffer(object):
"""Class for buffering input"""
def __init__(self, output_filename=os.devnull):
self.buf... |
__doc__ = \
"""
Module to spawn modem connectivity
"""
__author__ = "Praneeth Bodduluri <lifeeth[at]gmail.com>"
import sys, os
path = os.path.join(request.folder, "modules")
if not path in sys.path:
sys.path.append(path)
import pygsm
import threading
import time
from pygsm.autogsmmodem import GsmModemNotFou... |
import random
import requests
from flask import Flask, redirect, render_template
app = Flask(__name__, static_url_path='')
API_KEY = 'dc6zaTOxFJmzC'
@app.route('/')
def entry_point():
return render_template('index.html')
@app.route('/query/<path:query>')
def what(query):
# Query Giphy API if there is a query
... |
import os
def _post_generate():
""" convert CRLF to LF line separator
Because cookcutter #405 bug
:param temp_work_dir:
:param output_project:
:return:
"""
post = ["ci/analysis.sh", "ci/deploy.sh", "ci/ut.sh", "ci/at.sh", "ci/it.sh", "ci/build.sh"]
for post_file_path in post:
if ... |
def f(e, p=[]):
p.append(e)
return p
lists = []
for idx in range(5):
lists.append(f(idx))
print lists
print set(id(l) for l in lists) |
from Card import Card
class CardCollection:
# Initialise fields
def __init__(self):
self.cards = []
# Error checks
def __check__(self, card):
if not isinstance(card, Card):
raise ValueError("argument not of type: Card")
return card
# String representation
def __toString__(self, card):
return "%s%s" % (... |
def run(whatweb, pluginname):
whatweb.recog_from_content(pluginname, "OAapp.woa") |
import sys
import os
sys.path.insert(0, os.path.abspath('..'))
import rcquerybuilder |
""""
ProjectName: liv-api
Repo: https://github.com/chrisenytc/liv-api
Copyright (c) 2014 Christopher EnyTC
Licensed under the MIT license.
"""
from api import app
from flask import request
from flask import jsonify as JSON
from api.models.user import User
from cors import cors
from hashlib import sha1
from auth import ... |
"""Registries used in package."""
import uuid
from .store import Store
class StoreRegistry(type):
"""
When added to a class, automatically adds instances of that class to the
central storage database.
"""
def __call__(cls, *args, **kwargs):
# Import in the call function to avoid circular imp... |
from twisted.cred import error
class BadPassword(error.UnauthorizedLogin):
pass
class NoSuchUser(error.UnauthorizedLogin):
pass
class ImaginaryError(Exception):
pass
class NoSuchCommand(ImaginaryError):
"""
There is no command like the one you tried to execute.
"""
class AmbiguousArgument(Imagin... |
from . import IntercomError
from .client import IntercomAPI
class User(object):
endpoint = "users"
attributes = (
"user_id",
"email",
"id",
"signed_up_at",
"name",
"last_seen_ip",
"custom_attributes",
"last_seen_user_agent",
"companies",
... |
from petpvc import petpvc4DCommand
from pvc_template import *
file_format="NIFTI"
separate_labels=True
class pvcCommand(petpvc4DCommand):
_suffix='VC'
def check_options(pvcNode, opts):
if opts.scanner_fwhm != None: pvcNode.inputs.z_fwhm=opts.scanner_fwhm[0]
if opts.scanner_fwhm != None: pvcNode.inputs.y_fwh... |
from cxio.cx_reader import CxReader
fi = open('example_data/example0.cx', 'r')
cx_reader = CxReader(fi)
print('pre meta data: ')
for e in cx_reader.get_pre_meta_data():
print(e)
print()
print()
for e in cx_reader.aspect_elements():
print(e)
print()
print()
print('post meta data:')
for e in cx_reader.get_post_me... |
import logging
from neuro import reshape
import neuro
import numpy
from reikna.algorithms import PureParallel
from reikna.core import Parameter
from reikna.core.signature import Annotation
log = logging.getLogger("classification")
def classification_delta_kernel(ctx, outputs, targets, deltas):
kernel_cache, thread ... |
from urllib.request import urlopen
from xml.etree.ElementTree import parse
u = urlopen('http://planet.python.org/rss20.xml')
doc = parse(u)
for item in doc.iterfind('channel/item'):
title = item.findtext('title')
date = item.findtext('pubDate')
link = item.findtext('link')
print(title)
print(date)
print(link)
pr... |
"""
Django settings for REMBUGDESA project.
Generated by 'django-admin startproject' using Django 1.8.
For more information on this file, see
https://docs.djangoproject.com/en/1.8/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.8/ref/settings/
"""
import os
BASE_... |
import datetime
from south.db import db
from south.v2 import DataMigration
from django.db import models
from socialbeer.posts.models import Post
from socialregistration.models import TwitterProfile
class Migration(DataMigration):
def forwards(self, orm):
"Write your forwards methods here."
for post ... |
from pyembed.core import PyEmbed
from pyembed.jinja2 import Jinja2Renderer
import vcr
@vcr.use_cassette('pyembed/jinja2/test/fixtures/cassettes/embed_template.yml')
def test_should_embed_with_jinja2_template():
renderer = Jinja2Renderer('pyembed/jinja2/test/fixtures')
embedding = PyEmbed(renderer=renderer).embe... |
"""
Elementary Math Library. (For demonstration purpose only)
"""
__version__ = "0.0.8"
__short_description__ = "Elementary Mathematics."
__license__ = "MIT"
__author__ = "Sanhe Hu"
__author_email__ = "husanhe@me.com"
__maintainer__ = "Sanhe Hu"
__maintainer_email__ = "husanhe@me.com"
__github_username__ = "MacHu-GWU" |
from binder.permissions.views import PermissionView
from ..models.city import CityState, City, PermanentCity
class CityView(PermissionView):
model = City
class CityStateView(PermissionView):
model = CityState
class PermanentCityView(PermissionView):
model = PermanentCity |
import re
import urllib2
from pprint import pprint
data_file = open("y15.txt","w")
for i in range(150000, 150999):
link = "http://oa.cc.iitk.ac.in:8181/Oa/Jsp/OAServices/IITk_SrchRes.jsp?typ=stud&numtxt="+str(i)+"&sbm=Y"
data_student = urllib2.urlopen(link).read()
if data_student.find("HALL2") >=0:
name = re.searc... |
import unittest
from cellardoor.storage import Storage
class TestStorage(unittest.TestCase):
def test_abstract_storage(self):
storage = Storage()
with self.assertRaises(NotImplementedError):
storage.get(None)
with self.assertRaises(NotImplementedError):
storage.get_by_ids(None, None)
with self.assertRais... |
import sys, os
from winappdbg import *
'''
ar_buggery_auto.py, sebastian apelt, siberas, 2016
winappdbg script to simpulate the write-0 vulnerability as described in my syscan360 slides
usage: ar_buggery_auto.py <path to acrord32.exe> <pdf> <isPropertySpecified-offset>
how to get the isPropertySpecified-offset:
use the... |
from ..models import Model
class Daq(Model):
def __init__(self):
super().__init__()
pass
def initialize(self):
pass
def finalize(self):
pass
def add_task(self):
pass
def get_task(self):
pass |
from setuptools import setup, find_packages
readme = open('README.md').read()
setup(name='SimpleRender',
version='0.1.2',
author='Nick Otter',
author_email='otternq@gmail.com',
url='https://github.com/otternq/SimpleRender',
license='MIT',
description='Takes a config file and a templa... |
"""This module contains all of the core logic for beets' command-line
interface. To invoke the CLI, just call beets.ui.main(). The actual
CLI commands are implemented in the ui.commands module.
"""
import os
import locale
import optparse
import textwrap
import ConfigParser
import sys
from difflib import SequenceMatcher... |
import sys
from lib.compile import main
if __name__ == "__main__": main() |
import random
class RandomizedSet:
def __init__(self):
"""
Initialize your data structure here.
"""
self.nums = []
self.indexTable = {}
def insert(self, val: int) -> bool:
"""
Inserts a value to the set. Returns true if the set did not already contain the ... |
import uuid
from groundstation.proto.gizmo_pb2 import Gizmo
import groundstation.transfer.request
from groundstation.transfer import notification_handlers
from groundstation import logger
log = logger.getLogger(__name__)
class Notification(object):
VALID_NOTIFICATIONS = {
"NEWOBJECT": notification_handl... |
from django.db import models
from django.core.exceptions import ObjectDoesNotExist
class OrderField(models.PositiveIntegerField):
def __init__(self, for_fields=None, *args, **kwargs):
self.for_fields = for_fields
super(OrderField, self).__init__(*args, **kwargs)
def pre_save(self, model_instance, add):
if getat... |
from os import environ
APP_VERSION = '0.0.1'
APP_NAME = environ.get("APP_NAME", "taofeng139")
if 'sae.kvdb.file' in environ:
debug = True
else:
debug = False
SITE_TITLE = u"涛锋培训"
SITE_TITLE2 = u"绿色便捷的打印新时代"
SITE_SUB_TITLE = u"CloudPrint.Me" # 副标题
KEYWORDS = u"CloudPrint,云,打印,山东财经大学,创业,绿色,环保,省时"
SITE_DECR = u"C... |
import codecs
import warnings
import re
from contextlib import contextmanager
from parso.normalizer import Normalizer, NormalizerConfig, Issue, Rule
from parso.python.tree import search_ancestor
_BLOCK_STMTS = ('if_stmt', 'while_stmt', 'for_stmt', 'try_stmt', 'with_stmt')
_STAR_EXPR_PARENTS = ('testlist_star_expr', 'te... |
N = int(input())
points = [tuple(int(x) for x in input().split()) for _ in range(N)]
if any(abs(x + y) % 2 != abs(sum(points[0])) % 2 for x, y in points):
print(-1)
quit()
if any(not (-10 <= x <= 10 and -10 <= y <= 10) for x, y in points):
assert False
M = 20 + (abs(sum(points[0])) % 2)
print(M)
print(*[1] ... |
"""
Demonstration to modeling accelerator with the lte file.
SXFEL
Author : Tong Zhang
Created : 2016-04-12 10:11:06 AM CST
Last updated : 2016-04-12 21:20:16 PM CST
"""
import beamline
import os
import matplotlib.pyplot as plt
ltefile = os.path.join(os.getcwd(), 'sxfel/sxfel_v14b.lte')
l... |
import matplotlib.pyplot as plt
import numpy as np
import pretty_print as pp
from collections import defaultdict
import zipfile
import percolations as perc
from time import clock
colorvec = ['black', 'red', 'orange', 'gold', 'green', 'blue', 'cyan', 'darkviolet', 'hotpink']
align_prop = 0.05
numsims = 1000 # number of ... |
import sys, os, codecs, unicodedata, json
try:
import amiga
except:
amiga=None
try:
import sl4a
except:
sl4a=None
try:
import posix
except:
posix=None
if posix is not None:
pass
if amiga is not None:
os.chdir('/Projects/Perception-IME/Catalogs')
if sl4a is not None:
os.chdir('/storage/sdcard1/Workspace/Percept... |
from django.utils.decorators import method_decorator
from stronghold.decorators import public
class StrongholdPublicMixin(object):
@method_decorator(public)
def dispatch(self, *args, **kwargs):
return super(StrongholdPublicMixin, self).dispatch(*args, **kwargs) |
class BehaviourControl(object):
def __init__(self, bot):
self.bot = bot
self.behaviours = {}
self.loadedBehaviours = {}
def add(self, behaviourName, behaviour):
behaviour = self.behaviours[behaviourName] = behaviour
return behaviour
def remove(self, behaviourName):
... |
import os
import sys
import djblets
_ = lambda s: s
DEBUG = True
ADMINS = (
('Example Joe', 'admin@example.com')
)
MANAGERS = ADMINS
USE_TZ = True
TIME_ZONE = 'UTC'
LANGUAGE_CODE = 'en-us'
SITE_ID = 1
EMAIL_SUBJECT_PREFIX = "[Review Board] "
USE_I18N = False
LANGUAGES = (
('en', _('English')),
)
TEMPLATE_LO... |
import json
import re
class myobject:
def __init__(self, coins, value):
self.coins = coins
self.value = value
myList = []
total = 0
file = open("devices.txt", "r")
txt = file.readline()
while txt != "":
# Read the rest of the record
txt = file.readline()
re1='.*?' # Non-greedy match on filler
re... |
import numpy as np
import itertools
import copy
r"""
This script implements 1st method and outputs the required transmission rate
"""
class FirstRate(object):
r"""
INPUT:
- ''demands_sender'' -- the [K*J] matrix: which user's requirement can be
fulfilled by which sender
- '' ... |
from setuptools import setup
from codecs import open # Following PyPUG advice; not neccessary in Python 3.x
from os import path
here = path.abspath(path.dirname(__file__))
with open(path.join(here, 'DESCRIPTION.rst'), encoding='utf-8') as f:
long_description = f.read()
setup(
name='dreamhostapi',
version='0... |
import json
from six.moves import urllib_parse as urlparse
from cachebrowser.bootstrap import bootstrapper, BootstrapError
from cachebrowser.common import extract_url_hostname
from cachebrowser.models import Host, DoesNotExist
from cachebrowser.network import HttpConnectionHandler
from cachebrowser import http
from cac... |
import numpy
n, m = map(int, input().split())
items = []
for _ in range(n):
items.append(
list(
map(
int,
input().split()
)
)
)
print(numpy.mean(items, axis=1))
print(numpy.var(items, axis=0))
print(numpy.std(items, axis=None)) |
import os
import unittest
from pip.compat import stdlib_pkgs
from reqpy.main import get_excludes, check_file, parse_args
from reqpy.main import get_inherited_excludes
def collector():
dirname = os.path.dirname
start_dir = dirname(dirname(dirname(os.path.abspath(__file__))))
return unittest.defaultTestLoader... |
print("importing packages")
from keras.models import Sequential
from keras.layers import Dense, Activation
import keras.utils.visualize_util as keras_vis
from mnist import MNIST
import pdb
import numpy as np
from matplotlib import pyplot as plt
print("configuring script")
EXMNISTIMG = './example_mnist.png'
MNISTDATA = ... |
from dataactvalidator.app import createApp
from dataactcore.interfaces.db import GlobalDB
from dataactcore.models import lookups
from dataactcore.models.jobModels import JobStatus, JobType, FileType, PublishStatus
def setupJobTrackerDB():
"""Create job tracker tables from model metadata."""
with createApp().app... |
from django.conf.urls import url
from eguard.views import dealAppoint
urlpatterns = [
url(r'^$', dealAppoint, name='dealAppoint'),
] |
import logging
import argparse
from sqlalchemy import and_, or_
import pandas as pd
from dataactcore.interfaces.db import GlobalDB
from dataactcore.logging import configure_logging
from dataactvalidator.health_check import create_app
from dataactbroker.helpers.generic_helper import batch
from dataactcore.utils.duns imp... |
import os
path = os.path.dirname(os.path.realpath(__file__))
sbmlFilePath = os.path.join(path, 'MODEL1008120003.xml')
with open(sbmlFilePath,'r') as f:
sbmlString = f.read()
def module_exists(module_name):
try:
__import__(module_name)
except ImportError:
return False
else:
return... |
'''
Created on Jul 14, 2014
@author: anroco
How to working the format method of a python str?
¿Como funciona el metodo format de un string en python?
'''
s = 'Today is {}, {}'.format('Jul 14', '2014')
print(s)
s = '{2}, {0} and {1}'.format('first', 'second', 'third')
print(s)
s = 'vowels are: {0}, {1}, {2}, {3} and {4}... |
from Xlib import X, XK, display
from Xlib.ext import record
from Xlib.protocol import rq
class KeyEvents(object):
def __init__(self, key_pressed_callback):
self.local_dpy = display.Display(':0')
self.record_dpy = display.Display(':0')
self.key_pressed_callback = key_pressed_callback
... |
import os
import sys
import time
import glob
import misopy
from misopy.settings import Settings
from misopy.settings import miso_path as miso_settings_path
import misopy.hypothesis_test as ht
import misopy.as_events as as_events
import misopy.cluster_utils as cluster_utils
import misopy.sam_utils as sam_utils
import mi... |
from borrar import *
from web import form
import os.path
from time import time
formulariop = form.Form(
form.Textbox("nombre", description = "Nombre:", value=""),
form.Textarea("sugerencia", description = "Haz una sugerencia para la asignatura de IV:", value=""),
form.Button("Enviar"),
)
class Formulario:
... |
from distutils.core import setup, Command
from distutils.command.build import build
from distutils.command.build_scripts import build_scripts
from distutils.command.clean import clean
from distutils.command.install import install
from distutils.command.install_data import install_data
from distutils.command.install_lib... |
from django.test import TransactionTestCase
from mirrors.models import MirrorRsync, Mirror
TEST_IPV6 = "2a0b:4342:1a31:410::"
TEST_IPV4 = "8.8.8.8"
class MirrorRsyncTest(TransactionTestCase):
def setUp(self):
self.mirror = Mirror.objects.create(name='rmirror',
adm... |
'''
User-defined widget with functionality to deal with labels in
an interactive way
'''
from PyQt5 import QtGui, QtWidgets, QtCore
class LabelWidget(QtWidgets.QWidget):
'''
Widget to visualise and assign labels
'''
def __init__(self, item, father):
'''
Initialises the widget.
pa... |
"""
==============================
``umansysprop.results`` Module
==============================
This module defines the classes used to encapsulate results returned by the
UManSysProp server. Each tool method on the client will return an instance of
the :class:`Result` class which in turn contains one or more :class:`... |
from __future__ import division
__author__ = "Greg Caporaso"
__copyright__ = "Copyright 2011, The QIIME Project"
__credits__ = [
"Greg Caporaso",
"Justin Kuczynski",
"Jose Antonio Navas Molina"]
__license__ = "GPL"
__version__ = "1.8.0-dev"
__maintainer__ = "Greg Caporaso"
__email__ = "gregcaporaso@gmail.co... |
"""
Geography for one person and all his descendant
"""
from gramps.gen.const import GRAMPS_LOCALE as glocale
_ = glocale.translation.gettext
import operator
from gi.repository import Gtk
from gi.repository import Gdk
from gi.repository import GLib
import logging
_LOG = logging.getLogger("GeoGraphy.geomoves")
from gram... |
import pygame, string, time
from gameIo import InputHandler, LoopTimer
from display import TextDisplay
pygame.init()
class ScreenKeyboard:
# initializes the characters for the keyboard
def __init__(self, letters, screen, inputHandler, font, displayFont, fontColor, displayString, gameDisplayer):
self.fon... |
from __future__ import absolute_import, division, unicode_literals
import hashlib
import re
from binascii import unhexlify
from collections import OrderedDict
from .changegroup import (
ParentsTrait,
RawRevChunk,
)
from ..git import NULL_NODE_ID
from ..util import (
check_enabled,
TypedProperty,
)
try:
... |
from __future__ import print_function
from unicorn import *
from unicorn.x86_const import *
X86_CODE32 = b"\xeb\x19\x31\xc0\x31\xdb\x31\xd2\x31\xc9\xb0\x04\xb3\x01\x59\xb2\x05\xcd\x80\x31\xc0\xb0\x01\x31\xdb\xcd\x80\xe8\xe2\xff\xff\xff\x68\x65\x6c\x6c\x6f"
X86_CODE32_SELF = b"\xeb\x1c\x5a\x89\xd6\x8b\x02\x66\x3d\xca\x7... |
from yade import pack,export,geom,timing,bodiesHandling
import time,numpy
radRAD=[23.658, #5000 elements
40.455, #25000 elements
50.97, #50000 elements
64.218, #100000 elements
80.91] #200000 elements
#109.811] #500000 elements
iterN=[12000, #5000 elements
2500, #25000 elements
1400, #5000... |
from django.core.urlresolvers import reverse
from django.http import HttpResponseBadRequest
from django.views.generic import View
from pulp.common import tags
from pulp.server.async.tasks import TaskResult
from pulp.server.auth import authorization
from pulp.server.controllers import consumer as consumer_controller
fro... |
import jmri.jmrit.roster
rosterlist = jmri.jmrit.roster.Roster.instance().matchingList(None, None, None, None, None, None, None)
for entry in rosterlist.toArray() :
print entry.getId(), entry.getDccAddress(), entry.isLongAddress() |
import math
from bisect import insort
class CacheItem(object):
__slots__ = ('oid', 'tid', 'next_tid', 'data',
'counter', 'level', 'expire',
'prev', 'next')
def __repr__(self):
s = ''
for attr in self.__slots__:
try:
value = getattr(se... |
""" netlogon DCE/RPC """
import dcerpc as __dcerpc
import talloc as __talloc
class netr_NETLOGON_INFO_4(__talloc.Object):
# no doc
def __init__(self, *args, **kwargs): # real signature unknown
pass
@staticmethod # known case of __new__
def __new__(S, *more): # real signature unknown; restored fr... |
import subprocess
import shutil
import errno
import sys
import os
import re
import logging
from virtconv import _gettext as _
DISK_FORMAT_NONE = 0
DISK_FORMAT_RAW = 1
DISK_FORMAT_VMDK = 2
DISK_FORMAT_VDISK = 3
DISK_FORMAT_QCOW = 4
DISK_FORMAT_QCOW2 = 5
DISK_FORMAT_COW = 6
DISK_TYPE_DISK = 0
DISK_TYPE_CDROM = 1
DISK_TYP... |
import os
from multiprocessing import Process, Queue
from Queue import Empty
import gettext
_ = gettext.translation('yali', fallback=True).ugettext
from PyQt4.Qt import QWidget, SIGNAL, QPixmap, QObject, QTimer, QMutex, QWaitCondition
import pisi.ui
import yali.util
import yali.pisiiface
import yali.postinstall
import ... |
import re
from urllib.request import urlopen
import znc
class titles(znc.Module):
description = "Read titles"
def OnChanMsg(self, nick, chan, msg):
m = re.search("(https?://([-\w\.]+)+(:\d+)?(/([\w/_\.]*(\?\S+)?)?)?)", msg.s)
if m:
url = str(m.group(1))
page = urlopen(url... |
import sys
import os
import re
if sys.version_info[:2] < (3, 3):
raise SystemExit("Python >=3.3 required")
from distutils.core import setup
text = open(os.path.join(os.path.dirname(sys.argv[0]), "libpcron/__init__.py")).read()
match = re.search(r'^__version__ = "([^"]+)"', text, re.M)
version = match.group(1)
kwarg... |
import itertools, math
from ..ssa import objtypes
from .stringescape import escapeString
class VariableDeclarator(object):
def __init__(self, typename, identifier): self.typename = typename; self.local = identifier
def print_(self, printer, print_):
return '{} {}'.format(print_(self.typename), print_(se... |
from datetime import datetime
from unittest.mock import patch
from dateutil.relativedelta import relativedelta
import listenbrainz_spark.stats
from listenbrainz_spark import utils, stats
from listenbrainz_spark.tests import SparkNewTestCase
from pyspark.sql import Row
class InitTestCase(SparkNewTestCase):
def test_... |
from PyQt4.QtGui import QComboBox
class StringComboBox(QComboBox):
def __init__(self, parent):
QComboBox.__init__(self, parent)
def addPathAndSelect(self, path):
for i in range(0, self.count()):
if self.itemText(i) == path :
self.setCurrentIndex(i)
re... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.