code stringlengths 1 199k |
|---|
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding model 'Contact'
db.create_table('storybase_user_contact', (
('id', self.gf('django.db.models.fields.AutoField')(pr... |
from setuptools import setup, find_packages
setup(name='monsql',
version='0.1.7',
packages = find_packages(),
author='firstprayer',
author_email='zhangty10@gmail.com',
description='MonSQL - Mongodb-style way for using mysql.',
url='https://github.com/firstprayer/monsql.git',
in... |
u"""
.. module:: organizations
"""
from django.contrib import messages
from django.contrib.auth.decorators import login_required
from django.core.urlresolvers import reverse
from django.shortcuts import get_object_or_404
from django.shortcuts import redirect
from django.shortcuts import render
from django.utils.text im... |
import _plotly_utils.basevalidators
class TicktextsrcValidator(_plotly_utils.basevalidators.SrcValidator):
def __init__(self, plotly_name="ticktextsrc", parent_name="layout.xaxis", **kwargs):
super(TicktextsrcValidator, self).__init__(
plotly_name=plotly_name,
parent_name=parent_name... |
"""
Example to show scheduling messages to and cancelling messages from a Service Bus Queue.
"""
import os
import datetime
from azure.servicebus import ServiceBusClient, ServiceBusMessage
CONNECTION_STR = os.environ["SERVICE_BUS_CONNECTION_STR"]
TOPIC_NAME = os.environ["SERVICE_BUS_TOPIC_NAME"]
def schedule_single_mess... |
import pytest
GRAPHS = [
({},
[],
[]),
({'nodeA': {}},
['nodeA'],
[]),
({'nodeA': {'nodeB': 'weight'},
'nodeB': {}},
['nodeA', 'nodeB'],
[('nodeA', 'nodeB')]),
({'nodeA': {'nodeB': 'weight'},
'nodeB': {'nodeA': 'weight'}},
['nodeA', 'nodeB'],
[('nodeA'... |
'''
Crea un programa que analice el fichero y muestre:
- Los años y sus temperaturas (máxima, mínima y media), ordenados por año
- Los años y su tempertura media, ordenados por temperatura en orden descendente
- Crea un fichero html:
Encabezado: Temperaturas de Zaragoza
Fuente: (la url, como un enlace)
Tabl... |
'''
Scripts for automatically setting clean parameters
'''
import numpy as np
from warnings import warn
import os
from taskinit import tb
from cleanhelper import cleanhelper
def set_imagermode(vis, source):
tb.open(os.path.join(vis, 'FIELD'))
names = tb.getcol('NAME')
tb.close()
moscount = 0
for nam... |
"""
Tests for the Woopra template tags and filters.
"""
import pytest
from django.contrib.auth.models import AnonymousUser, User
from django.http import HttpRequest
from django.template import Context
from django.test.utils import override_settings
from utils import TagTestCase
from analytical.templatetags.woopra impor... |
from .StateBase import StateBase
from neo.Core.Fixed8 import Fixed8
from neo.Core.IO.BinaryReader import BinaryReader
from neo.IO.MemoryStream import StreamManager
from neo.Core.AssetType import AssetType
from neo.Core.UInt160 import UInt160
from neo.Core.Cryptography.Crypto import Crypto
from neo.Core.Cryptography.ECC... |
from Devices.Input import Input
from Devices.Timer import Timer
from Devices.AnalogInput import AnalogInput
from Devices.Output import Output
class DeviceManager:
def __init__(self):
self.inputs = {}
self.outputs = {}
def addSimpleInput(self, name, location, invert = False):
if name in self.inputs:
raise Key... |
try:
x
except NameError:
x = None
if x is None:
some_fallback_operation()
else:
some_operation(x) |
dCellSize = 20
WindowWidth = 400
WindowHeight = 400
class SCell(object):
def __init__(self, xmin, xmax, ymin, ymax):
self._iTicksSpentHere = 0
self._left = xmin
self._right = xmax
self._top = ymin
self.bottom = ymax
def Update(self):
self._iTicksSpentHere += 1
def Reset(self):
s... |
from __future__ import absolute_import, division, print_function, unicode_literals
import numpy as np
import sklearn
from sklearn.discriminant_analysis import LinearDiscriminantAnalysis
from sef_dr.classification import evaluate_svm
from sef_dr.datasets import load_mnist
from sef_dr.linear import LinearSEF
def supervis... |
DEBUG = True
TEMPLATE_DEBUG = DEBUG
ADMINS = (
# ('Your Name', 'your_email@example.com'),
)
MANAGERS = ADMINS
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3', # Add 'postgresql_psycopg2', 'mysql', 'sqlite3' or 'oracle'.
'NAME': 'db', # Or path to database f... |
'''
Yescoin base58 encoding and decoding.
Based on https://yescointalk.org/index.php?topic=1026.0 (public domain)
'''
import hashlib
class SHA256:
new = hashlib.sha256
if str != bytes:
# Python 3.x
def ord(c):
return c
def chr(n):
return bytes( (n,) )
__b58chars = '123456789ABCDEFGHJKLMN... |
from __future__ import unicode_literals
from ..symbols import *
TAG_MAP = {
# Explanation of Unidic tags:
# https://www.gavo.t.u-tokyo.ac.jp/~mine/japanese/nlp+slp/UNIDIC_manual.pdf
# Universal Dependencies Mapping:
# http://universaldependencies.org/ja/overview/morphology.html
# http://universaldep... |
DOWNLOADER_VERSION = "0.0.1"
DOWNLOADER_LOG_FILE = "downloader.log"
DOWNLOADER_LOG_SIZE = 10485760
DOWNLOADER_LOG_COUNT = 10
DOWNLOADER_LOG_FORMAT = "%(asctime)s - %(name)s - %(levelname)s - %(message)s"
DOWNLOADER_REQUIREMENTS_PATH = "requirements.txt" |
class mmpmon(object):
def __init__(self):
self.name = 'mmpmon'
self.nodefields = { '_n_': 'nodeip', '_nn_': 'nodename',
'_rc_': 'status', '_t_': 'seconds', '_tu_': 'microsecs',
'_br_': 'bytes_read', '_bw_': 'bytes_written',
'_oc_': 'opens', '_cc_': 'closes', '_rdc... |
from keras.models import model_from_json
import theano.tensor as T
from utils.readImgFile import readImg
from utils.crop import crop_detection
from utils.ReadPascalVoc2 import prepareBatch
import os
import numpy as np
def Acc(imageList,model,sample_number=5000,thresh=0.3):
correct = 0
object_num = 0
count =... |
from supriya.tools import osctools
from supriya.tools.requesttools.Request import Request
class GroupQueryTreeRequest(Request):
r'''A /g_queryTree request.
::
>>> from supriya.tools import requesttools
>>> request = requesttools.GroupQueryTreeRequest(
... node_id=0,
... i... |
"""
The pyligadb module is a small python wrapper for the OpenLigaDB webservice.
The pyligadb module has been released as open source under the MIT License.
Copyright (c) 2014 Patrick Dehn
Due to suds, the wrapper is very thin, but the docstrings may be helpful.
Most of the methods of pyligadb return a list containing ... |
from django.contrib import admin
from app.models import Home, Room, Thermostat, Door, Light, Refrigerator
"""
Administrator interface customization
This module contains customization classes to the admin interface
rendered by Django. This file is interpreted at run time to serve
the custom administrator actions that co... |
"""
Annotates Old Bird call detections in the BirdVox-70k archive.
The annotations classify clips detected by the Old Bird Tseep and Thrush
detectors according to the archive's ground truth call clips.
This script must be run from the archive directory.
"""
from django.db.models import F
from django.db.utils import Int... |
from django.shortcuts import render
from django.http import HttpResponseRedirect
from django.core.urlresolvers import reverse
import datetime, time, requests, re, os
import bs4
from django.contrib.admin.views.decorators import staff_member_required
from decimal import *
from .models import Gas, Region, Station, Site, S... |
""" 2018 AOC Day 09 """
import argparse
import typing
import unittest
class Node(object):
''' Class representing node in cyclic linked list '''
def __init__(self, prev: 'Node', next: 'Node', value: int):
''' Create a node with explicit parameters '''
self._prev = prev
self._next = next
... |
from django.conf.urls import patterns, include, url
from django.conf.urls.static import static
from django.conf import settings
from django.contrib import admin
admin.autodiscover()
urlpatterns = patterns('',
# Examples:
# url(r'^$', 'app.views.home', name='home'),
# url(r'^blog/', include('blog.urls')),
... |
from __future__ import absolute_import
from __future__ import unicode_literals
import json
from django.test import TestCase
from django.test.client import Client
from webhook.base import WebhookBase
class TestIntegration(TestCase):
def setUp(self):
"""initialize the Django test client"""
self.c = Cl... |
from math import log2 #For converting numbers to log base 2
'''PIPE TO EXTERNAL FILE WITH > filename.txt'''
letters = 'abcdefghijklmnopqrstuvwxyz'
'''File to read in data from, change this name to read from other files'''
file_name = "typos20.data"
test_file = "typos20Test.data"
'''
NOTE: Spaces are uncorrupted. Words ... |
import os
from djangomaster.core import autodiscover
from djangomaster.sites import mastersite
def get_version():
path = os.path.dirname(os.path.abspath(__file__))
path = os.path.join(path, 'version.txt')
return open(path).read().strip()
__version__ = get_version()
def get_urls():
autodiscover()
ret... |
import urllib2
import json
import time
import threading
import Queue
from utils import make_random_id, LOGINFO, LOGDEBUG, LOGERROR
class CommBase(object):
def __init__(self):
self.agents = []
def add_agent(self, agent):
self.agents.append(agent)
class HTTPComm(CommBase):
def __init__(self, c... |
from kivy.core.window import Window
from kivy.uix.textinput import TextInput
__author__ = 'woolly_sammoth'
from kivy.config import Config
Config.set('graphics', 'borderless', '1')
Config.set('graphics', 'resizable', '0')
Config.set('graphics', 'fullscreen', '1')
from kivy.app import App
from kivy.uix.boxlayout import B... |
class _Webhooks:
def __init__(self, client=None):
self.client = client
def create_webhook(self, params=None, **options):
"""Establish a webhook
:param Object params: Parameters for the request
:param **options
- opt_fields {list[str]}: Defines fields to return. Some ... |
import sqlite3
import os
def init():
"""
Creates and initializes settings database.
Doesn't do anything if the file already exists. Remove the local copy to recreate the database.
"""
if not os.path.isfile("settings.sqlite"):
app_db_connection = sqlite3.connect('settings.sqlite')
app... |
from .proxy_only_resource import ProxyOnlyResource
class ReissueCertificateOrderRequest(ProxyOnlyResource):
"""Class representing certificate reissue request.
Variables are only populated by the server, and will be ignored when
sending a request.
:ivar id: Resource Id.
:vartype id: str
:ivar nam... |
"""
LendingClub2 Filter Module
"""
import collections
from abc import abstractmethod
from abc import ABC
from lendingclub2.error import LCError
class BorrowerTrait(ABC):
"""
Abstract base class to define borrowers of interest
"""
@abstractmethod
def matches(self, borrower):
"""
Check... |
import _plotly_utils.basevalidators
class XValidator(_plotly_utils.basevalidators.NumberValidator):
def __init__(self, plotly_name="x", parent_name="splom.marker.colorbar", **kwargs):
super(XValidator, self).__init__(
plotly_name=plotly_name,
parent_name=parent_name,
edit... |
import re
osm = open("stops.txt", 'r', encoding="utf-8")
bugs = open("BAD-STOPS.txt", 'r', encoding="utf-8")
still = open("BUGS-NOT-IN-OSM.txt", 'w')
bugi = []
for line in bugs:
line = line.split(' ')
bugi.append(line[0])
print(len(bugi))
for line in osm:
line = line.split(',')
if line[0].isnumeric():
... |
import tornado.web
from datetime import date
from sqlalchemy.orm.exc import NoResultFound
from pyprint.handler import BaseHandler
from pyprint.models import User, Link, Post
class SignInHandler(BaseHandler):
def get(self):
return self.background_render('login.html')
def post(self):
username = se... |
"""convert the output file in a batch"""
import os
import os.path as op
import sys
import argparse
if os.getenv("PyFR") is None:
raise EnvironmentError("Environmental variable PyFR is not set")
else:
PyFRPath = os.getenv("PyFR")
if PyFRPath not in sys.path:
sys.path.append(PyFRPath)
try:
import ... |
from flask import render_template, request, redirect, session, flash, url_for
from functools import wraps
from user import app
import services2db
import log2db
import users
import json
import time
import sys
import asset
reload(sys)
sys.setdefaultencoding('gb18030')
def login_required(func):
@wraps(func)
def wr... |
BOT_NAME = 'saymedia'
SPIDER_MODULES = ['saymedia.spiders']
NEWSPIDER_MODULE = 'saymedia.spiders'
ROBOTSTXT_OBEY = True
DOWNLOADER_MIDDLEWARES = {
'saymedia.middleware.ErrorConverterMiddleware': 1,
# 'saymedia.middleware.MysqlDownloaderMiddleware': 1,
'saymedia.middleware.OriginHostMiddleware': 2,
'saym... |
""" Contains functions to fetch info from different simple online APIs."""
import util.web
def urbandictionary_search(search):
"""
Searches urbandictionary's API for a given search term.
:param search: The search term str to search for.
:return: defenition str or None on no match or error.
"""
i... |
def main() -> None:
N = int(input())
A = [int(x) for x in input().split()]
rev_A = A[:]
left = [-1] * N
left_cnt = [0] * N
A_left = [A[0]]
for i in range(1, N):
if rev_A[i-1] < rev_A[i]:
cnt = 0
while rev_A[i-1]
pass
elif rev_A[i-1] < rev_A... |
import sys
from itertools import izip
from tacit import tac
ordered_list_path = 'data/ordered.list'
expected_lines = open(ordered_list_path).read().splitlines(True)
expected_lines.reverse()
expected_count = len(expected_lines)
for bsize in range(10):
count = 0
for expected_line, line in izip(
expected_l... |
EXPECTED = {'CAM-PDU-Descriptions': {'extensibility-implied': False,
'imports': {'ITS-Container': ['AccelerationControl',
'CauseCode',
'CenDsrcTollingZone',
... |
import random
print random.uniform(10, 30) |
from daisychain.steps.outputs.file import OutputFile
from daisychain.steps.input import InMemoryInput
import tempfile
import os
TEST_STRING = 'THIS OUTPUT STRING IS COMPLETELY UNIQUE AND WILL NOT EXIST EVER AGAIN'
def test_output_file():
t = tempfile.NamedTemporaryFile(dir=os.path.dirname(__file__), delete=False)
... |
from twistedbot.plugins.base import PluginChatBase
from twistedbot.behavior_tree import InventorySelectActive
class Debug(PluginChatBase):
@property
def command_verb(self):
return "debug"
@property
def help(self):
return "help for debug"
def command(self, sender, command, args):
... |
import math
import numpy
class NEB(object):
""" A Nudged Elastic Band implementation
This NEB implementation is based on http://dx.doi.org/10.1063/1.1323224
by Henkelman et al.
"""
def __init__(self, path, k):
""" Initialize the NEB with a predefined path and force
consta... |
from django.db import models
from django.utils import timezone
from django.contrib import admin
from packages.generic import gmodels
from packages.generic.gmodels import content_file_name,content_file_name_same
from datetime import datetime
from django.core.validators import MaxValueValidator, MinValueValidator
from dj... |
import networkx as nx
import numpy as np
import scipy as sp
import csv
folder = 'data/'
file_names = ['yelp_data.csv', 'trip_advisor_data.csv']
yelp = False
yelp_dataset = list()
file_name = file_names[1]
if yelp == True:
file_name = file_names[0]
with open(folder+file_name, 'r') as f:
reader = csv.reader(f)
for ... |
"""
@file HybridVAControl.py
@author Craig Rafter
@date 19/08/2016
class for fixed time signal control
"""
import signalControl, readJunctionData, traci
from math import atan2, degrees
import numpy as np
from collections import defaultdict
class HybridVAControl(signalControl.signalControl):
def __init__(self... |
"""Module containing character feature extractors."""
import string
from unstyle.features.featregister import register_feat
@register_feat
def characterSpace(text):
"""Return the total number of characters."""
return len(text)
@register_feat
def letterSpace(text):
"""Return the total number of letters (excl... |
from django.db import models
from django.contrib.auth.models import User
from police.models import Stationdata
class general_diary(models.Model):
ref_id = models.CharField(max_length=40,unique=True,default="00000")
firstname = models.CharField(max_length=20)
lastname = models.CharField(max_length=20)
mo... |
"""
pyexcel_xls
~~~~~~~~~~~~~~~~~~~
The lower level xls/xlsm file format handler using xlrd/xlwt
:copyright: (c) 2016-2017 by Onni Software Ltd
:license: New BSD License
"""
import sys
import math
import datetime
import xlrd
from xlwt import Workbook, XFStyle
from pyexcel_io.book import BookReader, ... |
import numpy as np
xdatcar = open('XDATCAR', 'r')
xyz = open('XDATCAR.xyz', 'w')
xyz_fract = open('XDATCAR_fract.xyz', 'w')
system = xdatcar.readline()
scale = float(xdatcar.readline().rstrip('\n'))
print scale
a1 = np.array([ float(s)*scale for s in xdatcar.readline().rstrip('\n').split() ])
a2 = np.array([ float(s)*s... |
from setuptools import setup, find_packages
classifiers = [
"License :: OSI Approved :: MIT License",
"Natural Language :: English",
"Operating System :: OS Independent",
"Programming Language :: Python",
"Programming Language :: Python :: 2",
"Programming Language :: Python :: 2.6",
"Programming Language :: Python :: ... |
from sitemaps import SiteMapRoot, SiteMap
from datetime import datetime
def generate_sitemap():
"""
build the sitemap
"""
sitemap = SiteMap()
sitemap.append("http://www.xxx.com", datetime.now(), "weekly", 0.9)
sitemap.append("http://www.xxx.com/a1", datetime.now(), "monthly", 0.7)
sitemap.sa... |
from PyQt5 import QtCore
qt_resource_data = b"\
\x00\x00\x04\x31\
\x89\
\x50\x4e\x47\x0d\x0a\x1a\x0a\x00\x00\x00\x0d\x49\x48\x44\x52\x00\
\x00\x00\x20\x00\x00\x00\x20\x08\x03\x00\x00\x00\x44\xa4\x8a\xc6\
\x00\x00\x00\x03\x73\x42\x49\x54\x08\x08\x08\xdb\xe1\x4f\xe0\x00\
\x00\x00\x09\x70\x48\x59\x73\x00\x00\x00\xdd\x00\x... |
import os
import sys
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "sim.settings.local")
from django.core.management import execute_from_command_line
execute_from_command_line(sys.argv) |
class NotSupportedDayError(Exception):
def __init__(self, value):
self.value = value
def __str__(self):
return repr(" ".join([" Day ", value, " is not supported "])) |
import numpy as np
import pandas as pd
class CountsTableSparse(pd.SparseDataFrame):
'''Sparse table of gene expression counts
- Rows are features, e.g. genes.
- Columns are samples.
'''
_metadata = [
'name',
'_spikeins',
'_otherfeatures',
'_normalized'... |
"""
Dropbox Authentication for web2py
Developed by Massimo Di Pierro (2011)
Same License as Web2py License
"""
import os
import re
import urllib
from dropbox import client, rest, session
from gluon import *
from gluon.tools import fetch
from gluon.storage import Storage
import gluon.contrib.simplejson as json
... |
import sys
from collections import defaultdict
import itertools
import operator
from operator import itemgetter
counters = defaultdict(int)
trueCounters = defaultdict(int)
fr = open('allworks','r')
wc = 0
for line in fr:
line = line.strip()
words = ''.join(c for c in line if c.isalpha() or c.isspace()).split()
... |
from email.mime.text import MIMEText
from smtplib import SMTP
class Gmail(object):
"""Send an email with Google Mail
Can easily be used with other providers
by editing the server and port in send()
Args:
credentials (tuple): (username, password)
"""
def __init__(self, credentials):
... |
"""
Module which groups all the aggregated precomputed information in order to
save computational power.
"""
import pandas as pd
from FirmsLocations.Preprocess.preprocess_cols import cp2str
def read_agg(filepath):
"Read file of aggregated info."
table = pd.read_csv(filepath, sep=';')
table = cp2str(table)
... |
from ..style import use
use("km3pipe-notebook") |
from django.utils.translation import ugettext_lazy as _ugl
default_app_config = 'django_sendgrid_parse.apps.DjangoSendgridParseAppConfig' |
"""User-friendly exception handler for swood."""
import http.client
import traceback
import sys
import os
__file__ = os.path.abspath(__file__)
class ComplainToUser(Exception):
"""When used with ComplaintFormatter, tells the user what error (of theirs) caused the failure and exits."""
pass
def can_submit():
... |
__author__ = "Andrew Hankinson (andrew.hankinson@mail.mcgill.ca)"
__version__ = "1.5"
__date__ = "2011"
__copyright__ = "Creative Commons Attribution"
__license__ = """The MIT License
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associ... |
"""Basic TCP Server that will listen to port 6633."""
import logging
from socket import error as SocketError
from socketserver import BaseRequestHandler, TCPServer, ThreadingMixIn
from threading import current_thread
from kytos.core.connection import CONNECTION_STATE, Connection
from kytos.core.events import KytosEvent... |
import smtplib
from django.contrib.auth.models import Permission
from django.test import TestCase
from principal.forms import *
from principal.models import *
from principal.services import DepartmentService, CertificationService, UserService, ImpartSubjectService, \
AdministratorService
from gestionalumnos.setting... |
"""
Base class for exporters
"""
import os
from pyhmsa.util.monitorable import _Monitorable, _MonitorableThread
class _ExporterThread(_MonitorableThread):
def __init__(self, datafile, dirpath, *args, **kwargs):
args = (datafile, dirpath,) + args
super().__init__(args=args, kwargs=kwargs)
def _ru... |
from __future__ import absolute_import
from .base import *
from bundle_config import config
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.postgresql_psycopg2',
'NAME': config['postgres']['database'],
'USER': config['postgres']['username'],
'PASSWORD': config['postgres']['p... |
from django.apps import AppConfig
from django.contrib.auth import get_user_model
from django.contrib.auth.models import Permission
from django.contrib.contenttypes.models import ContentType
class AppConfig(AppConfig):
name = '.'.join(__name__.split('.')[:-1])
label = 'icekit_plugins_iiif'
verbose_name = "II... |
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('main', '0021_auto_20161208_1214'),
]
operations = [
migrations.AlterField(
model_name='tournamentteam',
name='name',
... |
from functools import wraps
def retry_task(f):
@wraps(f)
def decorated_function(*args, **kwargs):
retry = kwargs.get('retry', False)
if retry == 0:
return f(*args, **kwargs)
elif retry > 0:
for x in range(0, retry):
result = f(*args, **kwargs)
... |
""" Defines an action for moving the workspace to the parent directory.
"""
from os.path import dirname
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.api import WorkbenchWindow
from puddl... |
from ez_setup import use_setuptools
use_setuptools()
from setuptools import setup, find_packages
from pkg_resources import parse_version
def check_dependencies():
'''
setuptools causes problems for installing packages (especially
statsmodels). Use this function to abort installation instead.
'''
try... |
from __future__ import print_function
import os
import shutil
import time
import subprocess
import numpy as np
from .phonopy_conf_creator import PhonopyConfCreator
from vasp.poscar import Poscar
from autotools import symlink_force
class PhononCalculator(object):
def __init__(self,
directory_data=".... |
from django.conf.urls import patterns, include, url
from django.contrib import admin
from django.conf import settings
admin.autodiscover()
urlpatterns = patterns('',
# Examples:
# url(r'^$', 'CryptoKnocker.views.home', name='home'),
# url(r'^blog/', include('blog.urls')),
url(r'^admin/', include(admin.s... |
"""
annotations_line2d module
Created on Thu Sep 10 21:51:23 2015
@author: James Sorenson
"""
import matplotlib
import matplotlib.pyplot as plt
import threading
attr_name = 'annotations_line2d'
_event= None # Used for debugging
class DraggableAnnotationLine2D(matplotlib.offsetbox.DraggableBase):
"""This class is li... |
import argparse
import base64
import datetime
from decimal import Decimal
import math
import os.path
import sys
parser = argparse.ArgumentParser(description="Combine images of Italic calligraphy practice sheets into a single OpenDocument file. Note that this program does not verify that the specified images will fit a... |
import OOMP
newPart = OOMP.oompItem(9452)
newPart.addTag("oompType", "RESE")
newPart.addTag("oompSize", "0805")
newPart.addTag("oompColor", "X")
newPart.addTag("oompDesc", "O271")
newPart.addTag("oompIndex", "67")
OOMP.parts.append(newPart) |
"""Cascade UserAffiliation deletes
Revision ID: 5de499ab5b62
Revises: 14f51f27a106
Create Date: 2016-12-13 00:21:39.842218
"""
revision = '5de499ab5b62'
down_revision = '14f51f27a106'
branch_labels = None
depends_on = None
from alembic import op
import sqlalchemy as sa
def upgrade(engine_name):
globals()["upgrade_%... |
from __future__ import unicode_literals
from gazetteer.models import GazSource,GazSourceConfig,LocationTypeField,CodeFieldConfig,NameFieldConfig
from skosxl.models import Concept, Scheme, MapRelation
from gazetteer.settings import TARGET_NAMESPACE_FT
def load_base_ft():
(sch,created) = Scheme.objects.get_or_create(... |
from flask import *
from playhouse.flask_utils import *
import string
from app import app
from model import Major, Minor, Store, Transaction, Item
@app.route('/major', methods=['GET', 'POST'])
def major_list():
query = Major \
.select(Major, Minor) \
.join(Minor, on=(Major.id == Minor.major)... |
import gi
gi.require_version('Gtk', '3.0')
from gi.repository import Gtk
window = Gtk.Window()
window.set_default_size(200, 200)
window.connect("destroy", Gtk.main_quit)
overlay = Gtk.Overlay()
window.add(overlay)
textview = Gtk.TextView()
textview.set_wrap_mode(Gtk.WrapMode.WORD_CHAR)
textbuffer = textview.get_buffer(... |
"""Tests to ensure that the html5lib tree builder generates good trees."""
import warnings
try:
from bs4.builder import HTML5TreeBuilder
HTML5LIB_PRESENT = True
except ImportError, e:
HTML5LIB_PRESENT = False
from bs4.element import SoupStrainer
from bs4.testing import (
HTML5TreeBuilderSmokeTest,
S... |
"""
Python environments and packages
================================
This module provides tools for using Python `virtual environments`_
and installing Python packages using the `pip`_ installer.
.. _virtual environments: http://www.virtualenv.org/
.. _pip: http://www.pip-installer.org/
"""
from __future__ import with... |
from setuptools import setup
def readme():
with open('README.rst.example') as f:
return f.read()
setup(name='manifold_gui',
version='0.1',
description='GUI for a manifold technique',
long_description=readme(),
classifiers=[
'Development Status :: 1 - Alpha',
'Environm... |
import csv
import datetime
import os
import copy
class Trip:
dols = []
dists = []
gals = []
octs = []
eths = []
drivers = []
tires = []
miles = 0
gallons = 0
actualGals = 0
days = 0
octane = 0
snowtires = 0
make = 0
model = 0
year = 0
engineIV = 0
enginecyl = 0
engineL = 0
ethanol = 0
driv... |
import itertools
import subprocess
import sys
sys_script = '''
tell application "System Events" to tell process "SecurityAgent"
set value of text field 1 of window 1 to $(PASS)
click button 1 of group 1 of window 1
end tell
'''
keys = ['s','t','a','r','t']
def automate_login():
for l in xrange(0, len(keys)+1):
for... |
'''
Created on 17/2/2015
@author: PC06
Primer cambio en el proyecto
'''
from include import app
if __name__ == '__main__':
app.run("127.0.0.1", 9000, debug=True) |
import socket
import time
import traceback
from oyoyo.parse import *
from oyoyo import helpers
from oyoyo.cmdhandler import CommandError
class IRCClientError(Exception):
pass
class IRCClient:
""" IRC Client class. This handles one connection to a server.
This can be used either with or without IRCApp ( see ... |
from crispy_forms.helper import FormHelper
from crispy_forms.layout import *
from crispy_forms.bootstrap import *
from crispy_forms.layout import Layout, Submit, Reset, Div
from django import forms
from django.contrib.auth.forms import UserChangeForm, UserCreationForm
from silo.models import TolaUser
from django.contri... |
import search_duplicated_task |
import Globals
from Products.ZenModel.ZenPack import ZenPack as ZenPackBase
from Products.ZenUtils.Utils import unused, zenPath
import os
unused(Globals)
_plugins = [
'rig_host_app_transform1.py',
'copy_server_config_file.sh',
]
class ZenPack(ZenPackBase):
def install(self, app):
super(ZenPack, ... |
import piksemel
import os
def updateGConf (filepath, remove=False):
parse = piksemel.parse (filepath)
schemaList = list()
for xmlfile in parse.tags ("File"):
path = xmlfile.getTagData ("Path")
# Only interested in /etc/gconf/schemas
if "etc/gconf/schemas" in path:
schemaL... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.