code stringlengths 1 199k |
|---|
import inspect
import os
import sys
import threading
import time
import wx
from CommonMark import commonmark
from ctypes import c_ulonglong, windll
from datetime import datetime as dt, timedelta as td
from docutils.core import publish_parts as ReSTPublishParts
from docutils.writers.html4css1 import Writer
from functool... |
import re
import sys
import os
from datetime import date
class VersionHandler:
def __init__(self, file):
self.file = file
self.major = 0
self.minor = 0
self.revision = 0
self.build = 1
self.touch()
def read(self):
try:
f = open(self.file, 'r')
lines = f.readlines()
f.close()
for line in line... |
"""Template filters and tags for helping with dates and datetimes"""
from django import template
from nav.django.settings import DATETIME_FORMAT, SHORT_TIME_FORMAT
from django.template.defaultfilters import date, time
from datetime import timedelta
register = template.Library()
@register.filter
def default_datetime(val... |
import time
import midipy as midi
midi.open(128, 0, "midipy test", 0)
for (note, t) in [(48,0.5),(48,0.5),(50,1.0),(48,1.0),(53,1.0),(52,1.0),
(48,0.5),(48,0.5),(50,1.0),(48,1.0),(55,1.0),(53,1.0)]:
midi.note_on(note,127)
time.sleep(t/2)
midi.note_off(note,127)
midi.close() |
import os
import os.path
from amuse.units import units
from amuse.datamodel import Particle
from amuse.ext.star_to_sph import pickle_stellar_model
from amuse.community.mesa.interface import MESA as stellar_evolution_code
from xiTau_parameters import triple_parameters
def evolve_giant(giant, stop_radius):
stellar_ev... |
"""
WSGI config for ahaha project.
This module contains the WSGI application used by Django's development server
and any production WSGI deployments. It should expose a module-level variable
named ``application``. Django's ``runserver`` and ``runfcgi`` commands discover
this application via the ``WSGI_APPLICATION`` set... |
from gi.repository import Gtk
import gourmet.gtk_extras.dialog_extras as de
from gourmet.plugin import RecDisplayModule, UIPlugin, MainPlugin, ToolPlugin
from .recipe_emailer import RecipeEmailer
from gettext import gettext as _
class EmailRecipePlugin (MainPlugin, UIPlugin):
ui_string = '''
<menubar name="Recip... |
DEFAULT_STRATEGY = 0
FILTERED = 1
FIXED = 4
HUFFMAN_ONLY = 2
jpeglib_version = '8.0'
PILLOW_VERSION = '2.5.1'
RLE = 3
zlib_version = '1.2.8'
def alpha_composite(*args, **kwargs): # real signature unknown
pass
def bit_decoder(*args, **kwargs): # real signature unknown
pass
def blend(*args, **kwargs): # real sign... |
import sys
import socket
import unittest
from puppetmaster import network
test_method_name = ['testInit', 'testGetValue', 'testUsedMemory',
'testAvailableHost', 'testLaunchCommand']
class NetworkTestCase(unittest.TestCase):
def __init__(self, methodName='runTest', host_file = None,
... |
"""
``climactic.suite``
-------------------
.. autoclass:: ClimacticTestSuite
"""
import logging
import unittest
from pathlib import Path
from climactic.case import ClimacticTestCase
logger = logging.getLogger(__name__)
class ClimacticTestSuite(unittest.TestSuite):
"""
A collection of tests.
"""
@classm... |
import imp
from migrate.versioning import api
from app import db
from config import SQLALCHEMY_DATABASE_URI
from config import SQLALCHEMY_MIGRATE_REPO
migration = SQLALCHEMY_MIGRATE_REPO + \
'/versions/%03d_migration.py' % \
(api.db_version(
SQLALCHEMY_DATABAS... |
from OpenOrange import *
from User import User
from RetroactiveAccounts import RetroactiveAccounts
class HeirFinder(RetroactiveAccounts):
def doReplacements(self, txt):
d = {1:"ONE", 2:"TWO"}
us = User.bring("USER")
txt = txt.replace(":1", us.Name + d[1])
return txt
def run(self)... |
from __future__ import division
from __future__ import print_function
from __future__ import absolute_import
import wx
from .common import update_class
class Separator(wx.StaticLine):
def __init__(self, parent):
wx.StaticLine.__init__(self, parent.get_container(), -1,
wx.DefaultPosition, wx.... |
from util import manhattanDistance
from game import Directions
import random, util
from game import Agent
class ReflexAgent(Agent):
"""
A reflex agent chooses an action at each choice point by examining
its alternatives via a state evaluation function.
The code below is provided as a guide. You a... |
"""Pytest configuration.
Before running any of the tests you must have initialized the assets using
the ``script scripts/setup-assets.sh``.
"""
from __future__ import absolute_import, print_function
import os
import shutil
import tempfile
import uuid
import pkg_resources
import pytest
from cds_dojson.marc21 import marc... |
import wpilib
import hal
from wpilib import RobotDrive
class KwarqsDriveMech(RobotDrive):
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
self.weight_multiplier = 1
def set_multiplier(self, in_multi = None):
if in_multi != None :
self.weight_multiplier ... |
import sys
from gi.repository import GExiv2
phototags = {
'Exif.Photo.ExposureTime': "Belichtung:\t",
'Exif.Photo.FNumber': "Blende:\t\tF",
# 'Exif.Photo.ExposureProgram',
'Exif.Photo.ISOSpeedRatings': "ISO:\t\t",
# 'Exif.Photo.SensitivityType',
# 'Exif.Photo.ExifVersion',
# 'Exif.Photo.Date... |
"""
WSGI config for mongobacked 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.6/howto/deployment/wsgi/
"""
import os
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "mongobacked.settings")
from django.co... |
"""
Install TVB Framework package for developers.
Execute:
python setup.py install/develop
"""
import os
import shutil
import setuptools
VERSION = "1.4"
TVB_TEAM = "Mihai Andrei, Lia Domide, Ionel Ortelecan, Bogdan Neacsa, Calin Pavel, "
TVB_TEAM += "Stuart Knock, Marmaduke Woodman, Paula Sansz Leon, "
TVB_INSTALL_... |
'''# shufflez.py '''
__author__ = ["A'mmer Almadani:Mad_Dev", "sysbase.org"]
__email__ = ["mad_dev@linuxmail.org", "mail@sysbase.org"]
import random
import urllib2
from search import GoogleSearch, SearchError
import time
from multiprocessing import Process
from threading import Timer
class shufflez:
def __init__(self... |
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('codecompetitions', '0006_auto_20140805_2234'),
]
operations = [
migrations.AddField(
model_name='problem',
name='expected_output'... |
"""A paint engine to produce EMF exports.
Requires: PyQt-x11-gpl-4.6-snapshot-20090906.tar.gz
sip-4.9-snapshot-20090906.tar.gz
pyemf
"""
import struct
import pyemf
from .. import qtall as qt
inch_mm = 25.4
scale = 100
def isStockObject(obj):
"""Is this a stock windows object."""
return (obj ... |
__version__ = "1.3.5"
import Image, ImageFile
import array, string, sys
import ImagePalette
II = "II" # little-endian (intel-style)
MM = "MM" # big-endian (motorola-style)
try:
if sys.byteorder == "little":
native_prefix = II
else:
native_prefix = MM
except AttributeError:
if ord(array.array... |
class TestClass(object):
def foo():
doc = "The foo property."
def fget(self):
return self._foo
def fset(self, value):
self._foo = value
def fdel(self):
del self._foo
return locals()
foo = property(**foo())
def bar():
doc = "... |
import sys, os, urllib, argparse, base64, time, threading, re
from gi.repository import Gtk, WebKit, Notify
webView = None
def refresh(widget, event):
global webView
webView.reload()
window_title = ''
def HandleTitleChanged(webview, title):
global window_title
window_title = title
parent = webview
... |
"""
WSGI config for nykampweb 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_SETTINGS... |
"""Manage the Wordfast Translation Memory format
Wordfast TM format is the Translation Memory format used by the
U{Wordfast<http://www.wordfast.net/>} computer aided translation tool.
It is a bilingual base class derived format with L{WordfastTMFile}
and L{WordfastUnit} providing file and unit level access.... |
import logging
import struct
from memory import Memory
from network import Mac, IpAddress
from gbe import Gbe
LOGGER = logging.getLogger(__name__)
OFFSET_CORE_TYPE = 0x0
OFFSET_BUFFER_SIZE = 0x4
OFFSET_WORD_LEN = 0x8
OFFSET_MAC_ADDR = 0xc
OFFSET_IP_ADDR = 0x14
OFFSET_GW_ADDR = 0x18
OFFSET_NETMASK = ... |
"""
Django settings for Outcumbent project.
For more information on this file, see
https://docs.djangoproject.com/en/1.6/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.6/ref/settings/
"""
import os
BASE_DIR = os.path.dirname(os.path.dirname(__file__))
TEMPLATE_D... |
"""
This package supplies tools for working with automated services
connected to a server. It was written with IRC in mind, so it's not
very generic, in that it pretty much assumes a single client connected
to a central server, and it's not easy for a client to add further connections
at runtime (But possible, though y... |
'''
Access Control Lists testing based on newpynfs framework
Aurelien Charbon - Bull SA
'''
from random_gen import *
from optparse import OptionParser
import commands
import os
import threading
import time
import random
alphabet='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ123456789_-() ~'
t_alphabet=len(alph... |
import struct
from kamene.packet import *
from kamene.fields import *
from kamene.ansmachine import *
from kamene.layers.inet import UDP
from kamene.layers.inet import TCP
from kamene.base_classes import Net
def guess_payload(p):
LDPTypes = {
0x0001: LDPNotification,
0x0100: LDPHello,
0x0200... |
from common import *
test = SimpleSyncTest()
gconf = test.get_dataprovider("GConfTwoWay")
gconf.module.whitelist = ['/apps/metacity/general/num_workspaces']
folder = test.get_dataprovider("TestFolderTwoWay")
test.prepare(gconf, folder)
test.set_two_way_policy({"conflict":"ask","deleted":"ask"})
test.set_two_way_sync(Tr... |
from razer.client import DeviceManager
from razer.client import constants as razer_constants
device_manager = DeviceManager()
print("Found {} Razer devices".format(len(device_manager.devices)))
print()
device_manager.sync_effects = False
for device in device_manager.devices:
print("Setting {} to wave".format(device... |
"""Pets now have a description
Revision ID: 0c431867c679
Revises: 5b1bdc1f3125
Create Date: 2016-11-07 18:36:25.912155
"""
from alembic import op
import sqlalchemy as sa
revision = '0c431867c679'
down_revision = '5b1bdc1f3125'
branch_labels = None
depends_on = None
def upgrade():
### commands auto generated by Alem... |
class movie:
"""Stores movie metadata"""
# The constructor takes
# - The Title
# - The youtube trailer
# - The poster image URL
def __init__(self, title, youtube_trailer, poster_url):
self.title = title
self.trailer_youtube_url = youtube_trailer
self.poster_image_url =... |
from __future__ import with_statement
from fabric.api import task
@task
def md5():
"""
Check MD5 sums (unavailable, empty, with content)
"""
import hashlib
from fabric.api import cd, hide, run, settings
import fabtools
with cd('/tmp'):
run('touch f1')
assert fabtools.files.md... |
"""
Emotiv acquisition :
Reverse engineering and original crack code written by
Cody Brocious (http://github.com/daeken)
Kyle Machulis (http://github.com/qdot)
Many thanks for their contribution.
Need python-crypto.
"""
import multiprocessing as mp
import numpy as np
import msgpack
import time
from collections ... |
from django.contrib.auth.models import User
from django.core.exceptions import PermissionDenied
from kobo.django.xmlrpc.decorators import user_passes_test, login_required, log_call
from nitrate.core.utils.xmlrpc import XMLRPCSerializer
__all__ = (
'filter',
'get',
'get_me',
'update',
)
def get_user_dict... |
"""
Toy build unit test
@author: Kenneth Hoste (Ghent University)
"""
import glob
import grp
import os
import re
import shutil
import stat
import sys
import tempfile
from test.framework.utilities import EnhancedTestCase
from unittest import TestLoader
from unittest import main as unittestmain
from vsc.utils.fancylogger... |
from utils import textAppend, textPrepend, textCut, textEditLastChar, error, textCursorPos
class File:
""" Represents a file (A separated class allow to open several files at a time.
The class also holds the whole file content. (The vim buffers only store either the
accepted chunks, or the editing statement) """
de... |
import tradeStrategy as tds
import sendEmail as se
import tradeTime as tt
import tushare as ts
import pdSql_common as pds
from pdSql import StockSQL
import numpy as np
import sys,datetime
from pydoc import describe
from multiprocessing import Pool
import os, time
import file_config as fc
from position_history_update im... |
from __future__ import unicode_literals, print_function
from django.db import models
from django.apps import apps
from empresa.models import Empresa
import json
import os
import tempfile
import datetime
import requests
class Parking(models.Model):
empresa = models.OneToOneField(Empresa)
nombre = models.CharFiel... |
"""
Created on Thu Nov 19 17:38:50 2015
@author: deep
"""
from binaryTree import BTree, generateRandomTree, inorder
def largestBST(root):
if root.left is None and root.right is None:
return True, 1, root.value, root.value
if root.left:
isBSTL, sizeL, minL, maxL = largestBST(root.left)
else:
... |
from collections import OrderedDict
from rest_framework import pagination
from rest_framework.response import Response
__author__ = 'alexandreferreira'
class DetailPagination(pagination.PageNumberPagination):
def get_paginated_response(self, data):
return Response(OrderedDict([
('count', self.pa... |
"""
EasyBuild support for a GCC+CUDA compiler toolchain.
:author: Kenneth Hoste (Ghent University)
"""
from easybuild.toolchains.compiler.cuda import Cuda
from easybuild.toolchains.gcc import GccToolchain
class GccCUDA(GccToolchain, Cuda):
"""Compiler toolchain with GCC and CUDA."""
NAME = 'gcccuda'
COMPILE... |
import unittest
import sys
sys.path.append("/home/hazel/Documents/new_linux_paradise/paradise_office_site/sandbox_v1.0/cygnet_maker/cy_data_validation")
from datetime import time
from time_conv import Time
class TimeTestCase(unittest.TestCase):
''' Tests with numbered degrees of bad or good data, on a scale of 0=badd... |
import argparse
import traceback
import sys
import netaddr
import requests
from flask import Flask, request
from jinja2 import Environment, FileSystemLoader, TemplateNotFound
endpoints = "read/networks read/oplog read/snmp read/switches-management public/distro-tree public/config public/dhcp public/dhcp-summary public/... |
from datetime import datetime
from grazyna.utils import register
@register(cmd='weekend')
def weekend(bot):
"""
Answer to timeless question - are we at .weekend, yet?
"""
current_date = datetime.now()
day = current_date.weekday()
nick = bot.user.nick
if day in (5, 6):
answer = "Oczyw... |
from kvmap.code.projections import *
from urllib2 import urlopen
from httplib import HTTPConnection
from threading import Thread
from kivy.logger import Logger
from kivy.loader import Loader
from os.path import join, dirname
import time, os
import hashlib
try:
from pyproj import Proj
from xml.etree import ElementTr... |
import unittest
from ldotcommons import config
class TestRecord(unittest.TestCase):
def setUp(self):
pass
def test_init_with_args(self):
a = config.Record({'foo': 1, 'bar': 'x'})
self.assertEqual(a.get('foo'), 1)
b = config.Record()
b.set('foo', 1)
b.set('bar', 'x... |
import os
import sys
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "bugman.settings")
from django.core.management import execute_from_command_line
execute_from_command_line(sys.argv) |
import ctypes.wintypes as ctypes
import braille
import brailleInput
import globalPluginHandler
import scriptHandler
import inputCore
import api
INPUT_MOUSE = 0
INPUT_KEYBOARD = 1
INPUT_HARDWARE = 2
MAPVK_VK_TO_VSC = 0
KEYEVENTF_EXTENDEDKEY = 0x0001
KEYEVENTF_KEYUP = 0x0002
KEYEVENT_SCANCODE = 0x0008
KEYEVENTF_UNICODE =... |
from imio.history.config import HISTORY_COMMENT_NOT_VIEWABLE
from imio.history.interfaces import IImioHistory
from imio.history.testing import IntegrationTestCase
from plone import api
from plone.memoize.instance import Memojito
from Products.Five.browser import BrowserView
from zope.component import getAdapter
from zo... |
from django import template
from django.template.loader_tags import BaseIncludeNode
from django.template import Template
from django.conf import settings
from pages.plugins import html_to_template_text, SearchBoxNode
from pages.plugins import LinkNode, EmbedCodeNode
from pages import models
from django.utils.text impor... |
from opencvBuilder import exists,generate |
import os
import sys
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "umiss_project.settings")
try:
from django.core.management import execute_from_command_line
except ImportError:
# The above import may fail for some other reason. Ensure that the
# issue i... |
"""th_logger.py holds logging handler and config for the Regression test"""
import logging
from testProperty import TEST_OUTPUT_PATH
test_logger = logging.getLogger('TEST_HARNESS')
handler = logging.FileHandler(TEST_OUTPUT_PATH + 'runTest.log')
formatter = logging.Formatter('%(asctime)s %(name)-10s %(levelname)-6s %(me... |
'''
*******************************************************************************
* ButtonEvent.py 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 o... |
"""
Distinct powers
Problem 29
Consider all integer combinations of ab for 2 ≤ a ≤ 5 and 2 ≤ b ≤ 5:
2^2=4, 2^3=8, 2^4=16, 2^5=32
3^2=9, 3^3=27, 3^4=81, 3^5=243
4^2=16, 4^3=64, 4^4=256, 4^5=1024
5^2=25, 5^3=125, 5^4=625, 5^5=3125
If they are then placed in numerical order, with any repeats removed, we ge... |
import os
import numpy as np
from copy import deepcopy
import h5py
from .util import Signal
from .util.ImgCorrection import CbnCorrection, ObliqueAngleDetectorAbsorptionCorrection
from .util import Pattern
from .util.calc import convert_units
from . import ImgModel, CalibrationModel, MaskModel, PatternModel, BatchModel... |
import time
import json
import pytz
from datetime import datetime, timedelta
from django.utils import timezone
from django.conf import settings
from rest_framework import status
from rest_framework.decorators import api_view, permission_classes
from rest_framework.response import Response
from rest_framework.permission... |
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('article', '0002_auto_20160810_0134'),
]
operations = [
migrations.RemoveField(
model_name='article',
name='content_1',
),... |
"""IPython v0.11+ Plugin"""
from spyderlib.qt.QtGui import QHBoxLayout
from spyderlib.widgets.ipython import create_widget
from spyderlib.plugins import SpyderPluginWidget
class IPythonPlugin(SpyderPluginWidget):
"""Find in files DockWidget"""
CONF_SECTION = 'ipython'
def __init__(self, parent, args, kernel... |
import numpy as np
STR_NOBOND = """AU
3 1 2 1
1 0.00000000 0.00000000 0.00000000 -0.66387672 0.00000000 -0.00000000 0.34509720 3.78326969 -0.00000000 -0.00000000 3.96610412 0.00000000 3.52668267 0.00000000 -0.00000000 -2.98430053 0.00000000 -0.00000000 ... |
import os
import urllib
import numpy as np
import pickle
from Experiment import Experiment
ROOT_PATH = './full_dataset/article_4_data/grouped_ephys'
ZIPFILE_PATH = './full_dataset/article_4_data'
EXPM_PATH = './results/experiments/'
URL = 'http://microcircuits.epfl.ch/data/released_data/'
if not os.path.exists(EXPM_PAT... |
""" Base classes for AlienFX controller chips. These must be subclassed for
specific controllers.
This module provides the following classes:
AlienFXController: base class for AlienFX controller chips
"""
from builtins import hex
from builtins import object
import logging
import alienfx.core.usbdriver as alienfx_usbdri... |
from django.test import TestCase
from django.utils.timezone import now
from promises.models import Promise, Category
from popolo.models import Person
from taggit.models import Tag
from ..models import TagExtraCss
nownow = now()
class TagsExtraCssTestCase(TestCase):
def setUp(self):
self.person = Person.obje... |
import setuptools
with open("README.md", "r") as fh:
long_description = fh.read()
with open('requirements.txt') as f:
requirements = f.read().splitlines()
with open('cli-requirements.txt') as f:
cli_requirements = f.read().splitlines()
setuptools.setup(
name="uwg",
use_scm_version=True,
setup_re... |
import re
import sys
import whoisSrvDict
import whoispy_sock
import parser_branch
OK = '\033[92m'
FAIL = '\033[91m'
ENDC = '\033[0m'
def query(domainName):
rawMsg = ""
tldName = ""
whoisSrvAddr = ""
regex = re.compile('.+\..+')
match = regex.search(domainName)
if not match:
# Invalid dom... |
from vectores_oo import Vector
x = input('vector U componente X= ')
y = input('vector U componente X= ')
U = Vector(x,y)
m = input('vector V magnitud= ')
a = input('vector V angulo= ')
V = Vector(m=m, a=a)
E = input('Escalar= ')
print "U=%s" % U
print "V=%s" % V
print 'UxE=%s' % U.x_escalar(E)
print 'VxE=%s' % V.x_esca... |
"""
RESTx: Sane, simple and effective data publishing and integration.
Copyright (C) 2010 MuleSoft Inc. http://www.mulesoft.com
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... |
"""Convenience functions for using the SAM."""
import samba
import ldb
import time
import base64
from samba import dsdb
from samba.ndr import ndr_unpack, ndr_pack
from samba.dcerpc import drsblobs, misc
__docformat__ = "restructuredText"
class SamDB(samba.Ldb):
"""The SAM database."""
hash_oid_name = {}
def... |
import ctypes
from type import Type
import myelin.library
_lib = myelin.library.get_library()
_types = []
def add_type (klass):
_types.append (klass)
def get_type (type):
for klass in _types:
if klass._class.get_type().get_atom() == type.get_atom():
return klass
return None
def get_types... |
from chiplotle.geometry.shapes.path import path
from chiplotle.geometry.transforms.perpendicular_displace \
import perpendicular_displace
def line_displaced(start_coord, end_coord, displacements):
'''Returns a Path defined as a line spanning points `start_coord` and
`end_coord`, displaced by scalars `displa... |
import unittest
from bolt.discord.permissions import Permission
class TestPermission(unittest.TestCase):
def test_permission_from_list_to_list(self):
expected = ['MANAGE_WEBHOOKS', 'USE_EXTERNAL_EMOJIS']
permission = Permission(['MANAGE_WEBHOOKS', 'USE_EXTERNAL_EMOJIS'])
actual = permission.... |
import requests
import hashlib
import json
import random
import sys
class ApiItemAmount(object):
def __new__(self, item_type, amount):
return {"type": item_type, "amount": amount}
class SagaAPI(object):
secret = ""
episodeLengths = {}
apiUrl = ""
clientApi = ""
unlockLevelItemId = -1
... |
from matplotlib.backends.backend_agg import FigureCanvasAgg as FigureCanvas
from matplotlib.figure import Figure
from sklearn.cluster import KMeans
from sklearn import datasets
from PIL import Image, ImageChops
from scipy.spatial.distance import cdist
import matplotlib.pyplot as plt
from random import randint
import ti... |
from math import sqrt
from collections import defaultdict, Counter
from fractions import Fraction
def reverse_erathos(n):
d = defaultdict(set)
for i in range(2, n + 1):
if i not in d:
j = 2 * i
while j <= n:
d[j].add(i)
j += i
return d
def toti... |
from sqlalchemy import Column, String, Integer, Boolean, ForeignKey, Table, Float
from sqlalchemy.ext.associationproxy import association_proxy
from sqlalchemy.orm import relation, mapper, synonym, deferred
from sqlalchemy.orm.collections import attribute_mapped_collection
from eos.db import gamedata_meta
from eos.type... |
"""
A pure python ping implementation using raw socket.
Note that ICMP messages can only be sent from processes running as root.
Derived from ping.c distributed in Linux's netkit. That code is
copyright (c) 1989 by The Regents of the University of California.
That code is in turn derived from code w... |
from src.sqllist import GLOBALS
class BasicResolver(object):
"""General resolver class"""
def __init__(self, conn=None):
self.conn = conn
pass
def resolve(self, detections, sources):
"""Template resolve function.
Returns resolution status and an array of xtrsrcid-runcatid of
... |
"""
This module defines a custom widget holding an array of GUI elements. The widget
is used as the default GUI for `setting.ArraySetting` instances.
"""
from __future__ import absolute_import, division, print_function, unicode_literals
from future.builtins import *
import collections
import contextlib
import pygtk
pyg... |
"""
Follow Me activity for Sugar
Copyright (C) 2010 Peter Hewitt
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... |
import time, datetime, calendar
import httplib
import urllib, urllib2
import base64
from bookmarks.models import Bookmark, BookmarkInstance
from bookmarks.forms import BookmarkInstanceForm
try:
import xml.etree.ElementTree as ET
except:
import elementtree.ElementTree as ET
class DeliciousAPI:
"""
Delici... |
"""
Module to handle distortions in diffraction patterns.
"""
import numpy as np
import scipy.optimize
def filter_ring(points, center, rminmax):
"""Filter points to be in a certain radial distance range from center.
Parameters
----------
points : np.ndarray
Candidate points.
cent... |
import flask
from flask import flash
from flask_login import login_required
from rpress.models import SiteSetting
from rpress.database import db
from rpress.runtimes.rpadmin.template import render_template, navbar
from rpress.runtimes.current_session import get_current_site, get_current_site_info
from rpress.forms impo... |
from __future__ import unicode_literals
from __future__ import absolute_import
from django.views.generic.base import TemplateResponseMixin
from wiki.core.plugins import registry
from wiki.conf import settings
class ArticleMixin(TemplateResponseMixin):
"""A mixin that receives an article object as a parameter (usual... |
import game as game
import pytest
import sys
sys.path.insert(0, '..')
def trim_board(ascii_board):
return '\n'.join([i.strip() for i in ascii_board.splitlines()])
t = trim_board
def test_new_board():
game.Board(3,3).ascii() == t("""
...
...
...
""")
game.Board(4,3).ascii() == t("""
....
... |
"""
A mode for working with Circuit Python boards.
Copyright (c) 2015-2017 Nicholas H.Tollervey and others (see the AUTHORS file).
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 t... |
import os
from collections import defaultdict
from django.conf import settings
from django.contrib import messages
from django.core.paginator import Paginator, InvalidPage, EmptyPage
from django.core.urlresolvers import reverse
from django.db.models import Count, Q
from django.http import HttpResponseRedirect, Http404,... |
"""
Module for testing labels
"""
from hamcrest.core.base_matcher import BaseMatcher
from hamcrest.core.helpers.wrap_matcher import wrap_matcher
from .enumerators import all_widgets
class LabelMatcher(BaseMatcher):
"""
Check if Widget has label with given text
"""
def __init__(self, text):
"""
... |
from django.contrib.contenttypes.fields import GenericForeignKey, GenericRelation
from django.contrib.contenttypes.models import ContentType
from django.db import models
from base.models import ModelloSemplice
from base.tratti import ConMarcaTemporale
class Giudizio(ModelloSemplice, ConMarcaTemporale):
"""
Rapp... |
# -*- coding: utf-8 -*-
from base import *
DETVIDEXT = False
currentItemPos = lambda : inte(xbmc.getInfoLabel('Container.CurrentItem'))
itemsCount = lambda : inte(xbmc.getInfoLabel('Container.NumItems'))
getCpath = lambda : xbmc.getInfoLabel('Container.FolderPath')
getCname = lambda : xbmc.getInfoLabel... |
import argparse
from . import core
from . import gui
def main():
parser = argparse.ArgumentParser(
description="Track opponent's mulligan in the game of Hearthstone.")
parser.add_argument('--gui', action='store_true')
args = parser.parse_args()
if args.gui:
gui.main()
else:
c... |
from api.callers.api_caller import ApiCaller
from exceptions import ResponseTextContentTypeError
from colors import Color
import os
from cli.arguments_builders.default_cli_arguments import DefaultCliArguments
import datetime
from cli.cli_file_writer import CliFileWriter
from cli.formatter.cli_json_formatter import CliJ... |
try:
import json
except ImportError:
from django.utils import simplejson as json
from django.core.exceptions import PermissionDenied
from django.http import HttpResponse
from django.views.decorators.http import require_POST
from django.shortcuts import get_object_or_404
from django.conf import settings
from dja... |
from elasticsearch import Elasticsearch
from django.conf import settings
def get_es_client(silent=False):
"""
Returns the elasticsearch client which uses the configuration file
"""
es_client = Elasticsearch([settings.ELASTIC_SEARCH_HOST],
scheme='http',
... |
import arcpy
from datetime import datetime
output = arcpy.GetParameterAsText(0)
arcpy.env.overwriteOutput = "True"
fc3="Incident_Information"
fc2="Lead Agency"
rows = arcpy.SearchCursor(fc3)
row = rows.next()
arcpy.AddMessage("Get Incident Info")
while row:
# you need to insert correct field names in your getvalue ... |
from kivy.lib import osc
from time import sleep
import pocketclient
from kivy.utils import platform as kivy_platform
SERVICE_PORT = 4000
def platform():
p = kivy_platform()
if p.lower() in ('linux', 'waindows', 'osx'):
return 'desktop'
else:
return p
class Service(object):
def __init__(s... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.