code stringlengths 1 199k |
|---|
'''
BitBase/Hive for XBMC Plugin
Copyright (C) 2013-2014 ddurdle
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 ... |
"""Additional PTS-specific template tags."""
from __future__ import unicode_literals
from django import template
register = template.Library()
class RepeatNode(template.Node):
"""
A :class:`Node <django.template.base.Node>` for implementing the :func:`repeat`
template tag.
"""
def __init__(self, nod... |
from __future__ import with_statement
import os
import re
import inspect
from subprocess import Popen, PIPE, STDOUT
import logging
import fnmatch
import errno
import shlex
import glob
from contextlib import closing
import six
from six import StringIO
def tail(filename, number_of_bytes):
"""Returns the last number_o... |
from distutils.core import setup, Extension
module1 = Extension('PicoScope',
#sources = ['PicoScope.c'],
sources = ['PicoScope.c', 'libPicoScope.c', 'libPicoScope-data.c'],
libraries=['usb-1.0'],
include_dirs=['.'],
extr... |
import numpy as np
import cv2
import cv2.cv as cv
def nothing(x):
pass
face_cascade = cv2.CascadeClassifier('haarcascade_frontalface_default.xml')
eye_cascade = cv2.CascadeClassifier('haarcascade_eye.xml')
cap = cv2.VideoCapture(0)
uiImage = np.zeros((200,512,3), np.uint8)
cv2.namedWindow('uiFrame')
cv2.createTrack... |
import pygame
BLACK = ( 0, 0, 0)
WHITE = ( 255, 255, 255)
GREEN = ( 0, 255, 0)
RED = ( 255, 0, 0)
pygame.init()
size = (255, 255)
screen = pygame.display.set_mode(size)
pygame.display.set_caption("My Game")
width = 20
height = 20
margin = 5
grid = [[0 for x in range(10)] for y in range(10)]
... |
import sys, os
extensions = ['sphinx.ext.autodoc', 'sphinx.ext.doctest', 'sphinx.ext.todo', 'sphinx.ext.coverage', 'sphinx.ext.ifconfig', 'sphinx.ext.viewcode']
templates_path = ['_templates']
source_suffix = '.txt'
master_doc = 'index'
project = u'Mandriva Control Center'
copyright = u'2011, Mandriva Team'
version = '... |
import sys, os
extensions = ['sphinx.ext.todo', 'sphinx.ext.pngmath', 'sphinx.ext.viewcode']
templates_path = ['_templates']
source_suffix = '.rst'
master_doc = 'index'
project = u'WidgetIdentifier'
copyright = u'2013, Cédric Christen'
version = '0.1'
release = '0.1'
exclude_patterns = []
pygments_style = 'sphinx'
html... |
"""
Defines the DeviceError, DeviceDeleted and DeviceNotFound exceptions.
Copyright 2017 Red Hat, Inc.
Licensed under the GNU General Public License, version 2 as
published by the Free Software Foundation; see COPYING for details.
"""
__author__ = """
olichtne@redhat.com (Ondrej Lichtner)
"""
from lnst.Common.LnstError... |
print('https://github.com/AlDanial/cloc/issues/312') |
from collective.handleclient.testing import COLLECTIVE_HANDLECLIENT_ACCEPTANCE_TESTING # noqa
from plone.app.testing import ROBOT_TEST_LEVEL
from plone.testing import layered
import os
import robotsuite
import unittest
def test_suite():
suite = unittest.TestSuite()
current_dir = os.path.abspath(os.path.dirname... |
from enigma import eConsoleAppContainer
from Screens.Screen import Screen
from Components.ActionMap import ActionMap
from Components.ScrollLabel import ScrollLabel
class Console(Screen):
#TODO move this to skin.xml
skin = """
<screen position="100,100" size="550,400" title="Command execution..." >
<widget name="... |
from OpenGL.GLU import *
import PIL.Image
from email.utils import formatdate, parsedate_tz
from math import atan, cos, degrees, exp, floor, log, pi, radians, sin
from os import environ, getenv, makedirs, unlink
from os.path import basename, dirname, exists, expanduser, isdir, join
from Queue import Queue
import sys
fro... |
import pygame
class Tileset(object):
def __init__(self, imagen, tilesize_x, tilesize_y):
self.imagen = imagen
self.tilesize_x = tilesize_x
self.tilesize_y = tilesize_y
self.array = []
#self.cortar_tileset()
self.tiles_cortados = []
self.colorkey = (255, 0, 255... |
"""Access database models."""
from cPickle import dumps, loads
from datetime import datetime, timedelta
from random import random
from sqlalchemy import bindparam
from sqlalchemy.orm import validates, column_property, undefer
from invenio.base.wrappers import lazy_import
from invenio.ext.sqlalchemy import db
from inven... |
import os
import shlex
import struct
import platform
import subprocess
def get_terminal_size():
""" getTerminalSize()
- get width and height of console
- works on linux,os x,windows,cygwin(windows)
originally retrieved from:
http://stackoverflow.com/questions/566746/how-to-get-console-window-wid... |
import os, sys
import cPickle
import numpy as np
import scipy.sparse as sp
datapath = './original/'
assert datapath is not None
if 'data' not in os.listdir('./'):
os.mkdir('./data')
def parseline(line):
#lhs, rel, rhs = line.split('\t')
truth = None
tmp = line.split('\t')
lhs = tmp[0].split(' ')
... |
from amoco.system.elf import *
from amoco.system.core import CoreExec
import amoco.arch.arm.cpu_armv8 as cpu
with Consts("r_type"):
R_AARCH64_MOVW_GOTOFF_G0 = 0x12C
R_AARCH64_CONDBR19 = 0x118
R_AARCH64_TLSDESC_CALL = 0x239
R_AARCH64_TLSLD_LDST32_DTPREL_LO12_NC = 0x218
R_AARCH64_JUMP_SLOT = 0x402
... |
import os
import uuid
import logging
import zipfile
import requests
import json
import configparser
from wscbot import config
import time
logger = logging.getLogger("WSCBot")
def main():
"""
Envia uma requisição GET HTTP para o endereço cadastrado fornecendo
como parâmetros da requisição o usuário e senha i... |
import rospy
import tf
import numpy as np
import os
import sys
import subprocess
import time
import struct
import math
from numpy.matlib import *
from std_msgs.msg import *
from geometry_msgs.msg import Pose2D, Twist
from dcsc_consensus.msg import bot_data_msg
class Flocking:
def __init__(self):
if '-h' in sys.argv ... |
"""
Microsoft Document summaries structures.
Documents
---------
- Apache POI (HPSF Internals):
http://poi.apache.org/hpsf/internals.html
"""
from resources.lib.externals.hachoir.hachoir_parser import HachoirParser
from resources.lib.externals.hachoir.hachoir_core.field import (FieldSet, ParserError,
RootSeekab... |
from boxbranding import getImageVersion
from urllib import urlopen
import socket
import os
from glob import glob
from enigma import eTimer
from enigma import eConsoleAppContainer, eDVBDB
from Screens.Screen import Screen
from Components.ActionMap import ActionMap
from Components.PluginComponent import plugins
from Comp... |
import re
from wikibase.dataModel.entity.entity_id import EntityId
class ItemId(EntityId):
def __init__(self, serialization):
if re.match('^q[1-9][0-9]*$', serialization, re.IGNORECASE) is None:
raise ValueError('Invalid id serialization provided')
super().__init__('item', serialization.... |
import xml.parsers.expat
import form
import os
import pobject
class ParserHandler:
def __init__ (self, handler, root, types):
self.handler = handler
self.types = types
self.stack = []
self.push (root)
def push (self, obj):
self.stack.append (obj)
def pop (self):
return self.stack.pop ()
def top (self):
... |
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('rip', '0005_auto_20141218_1306'),
]
operations = [
migrations.AlterField(
model_name='operation',
name='sample_json',
... |
import unittest
import ROOT
class TestHealAlm(unittest.TestCase):
"""
Unit test class for THealAlm.
"""
def setUp(self):
"""
Set up function. libRootHealPix must be loaded.
"""
ROOT.std.complex("double") # hack
ROOT.std.complex("float")
ROOT.gSystem.Load("... |
"""Create Invenio collection cache."""
__revision__ = "$Id$"
import calendar
import copy
import sys
import cgi
import re
import os
import string
import time
import cPickle
from invenio.config import \
CFG_CERN_SITE, \
CFG_WEBSEARCH_INSTANT_BROWSE, \
CFG_WEBSEARCH_NARROW_SEARCH_SHOW_GRANDSONS, \
CFG_... |
from django import template
from django.conf import settings
register = template.Library()
WETO_REQUEST_FORMAT_NAME = getattr(settings, 'WETO_REQUEST_FORMAT_NAME', 'format')
WETO_REQUEST_FORMAT_PDF_VALUE = getattr(settings, 'WETO_REQUEST_FORMAT_PDF_VALUE', 'pdf')
@register.simple_tag(name="pdf_link", takes_context=True... |
'''
Bullseye:
An accelerated targeted facet imager
Category: Radio Astronomy / Widefield synthesis imaging
Authors: Benjamin Hugo, Oleg Smirnov, Cyril Tasse, James Gain
Contact: hgxben001@myuct.ac.za
Copyright (C) 2014-2015 Rhodes Centre for Radio Astronomy Techniques and Technologies
Department of Physics and Electron... |
"""
A driver for devices running ISAM (runs on Alcatel ISAM).
"""
import re
from Exscript.protocols.drivers.driver import Driver
_user_re = [re.compile(r'login: ?', re.I)]
_password_re = [re.compile(r'[\r\n]password: ?', re.I)]
_prompt_re = [re.compile(r'[\r\n][\- +\d+\w+\.]+(?:\([^\)]+\))?[>#] ?')]
_error_re ... |
import sys,xbmc,os,shutil,xbmcaddon
try:
sxUser = 0
sxBackup = 0
saveset = xbmc.translatePath('special://userdata/addon_data/plugin.video.iptvxtra-de/backup.xml')
orgset = xbmc.translatePath('special://userdata/addon_data/plugin.video.iptvxtra-de/settings.xml')
if os.path.isfile(... |
import unittest
import numpy as np
from dnfpy.cellular.hardlib import HardLib
class TestHardLib(unittest.TestCase):
def setUp(self):
self.size = 11
self.lib = HardLib(self.size,self.size,"cellnspike","nspikeconnecter")
def test_set_get_cell_attribute_int(self):
self.lib.setCellAttribute(... |
from enum import Enum
from typing import List, Optional, cast
from fsui import Widget
from fsui.qt.qparent import QParent
from fsui.qt.qt import Qt, QWidget
from fswidgets.overrides import overrides
from fswidgets.parentstack import ParentStack
from fswidgets.qt.core import Qt
from fswidgets.qt.widgets import QSplitter... |
from comment import comment
from random import randint
class chat():
comments = []
i = 0
def __init__(self, font):
self.font = font
print "Chat logging starting"
def addComment(self, msg):
#row = randint(0, 20) * 25
comm = comment(msg, 1184, self.i*25, self.font)
self.i += 1
if self.i >= 20:
self.i ... |
import unittest
from persistence.in_memory.models.task import Task
class TaskReprTest(unittest.TestCase):
def test_generates_repr_string(self):
# given
task = Task(summary='summary')
task.id = 123
#when
r = repr(task)
# then
self.assertEqual('Task(\'summary\',... |
from __future__ import with_statement
import numpy as np
from PIL import Image
from OpenGL.GL import *
from fretwork import log
from fofix.core.Texture import Texture
from fofix.core.constants import *
from fofix.core import cmgl
class SvgContext(object):
def __init__(self, geometry):
self.geometry = geomet... |
from hypothesis import given
import hypothesis.strategies as st
import fireblog.settings.validators as v
@given(st.text(min_size=1, max_size=100))
def test_sitename_validator_success(s):
assert v.sitename_validator(s)
@given(st.one_of(st.text(max_size=0), st.text(min_size=101)))
def test_sitename_validator_fail(s):... |
"""
rpl_admin_gtid_loopbackIPv6 test.
"""
import rpl_admin
from mysql.utilities.exception import MUTLibError
_IPv6_LOOPBACK = "::1"
_DEFAULT_MYSQL_OPTS = ('"--log-bin=mysql-bin --skip-slave-start '
'--log-slave-updates --gtid-mode=on '
'--enforce-gtid-consistency --report-h... |
from subprocess import STDOUT, PIPE
import logging
import subprocess
import sys
"""
Some convenience functions related to processes
"""
LOGGER = logging.getLogger(__name__)
COMMON_POPEN_ARGS = {
"close_fds": True,
"shell": True
}
CalledProcessError = subprocess.CalledProcessError
def popen(*args, **kwargs):
... |
import unittest
import time
import math
import selectBrowser
import Util
from selenium import webdriver
from flaky import flaky
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.common.action_chains import ActionChains
from selenium.webdriver.support import expected_conditions as EC
from selenium.... |
from __future__ import print_function
from enigma import eDVBResourceManager,\
eDVBFrontendParametersSatellite, eDVBFrontendParametersTerrestrial, eDVBFrontendParametersATSC, iDVBFrontend
from Screens.ScanSetup import ScanSetup, buildTerTransponder
from Screens.ServiceScan import ServiceScan
from Screens.MessageBox im... |
from __future__ import division
import random
import os
import sys
from collections import OrderedDict
import cv2
import params
import local_common as cm
img_height = params.img_height
img_width = params.img_width
img_channels = params.img_channels
def preprocess(img):
assert img_channels == 3 # for now we expect a... |
import re
from metadata import *
class Renamer:
release_date_index_start = -1
release_date_index_end = -1
quality_index_start = -1
quality_index_end = -1
def get_metadata(self, filename):
filename = self.clean(filename)
quality = self.find_quality(filename)
release_date = sel... |
"""
WSGI config for firetracker 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... |
import hashlib
import random
from base64 import b16encode
def nonce_str():
m = hashlib.md5()
m.update('%d' % random.getrandbits(128))
return b16encode(m.digest()) |
'''
cloudservice XBMC Plugin
Copyright (C) 2013-2014 ddurdle
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 vers... |
"""BibFormat element - Prints publisher name
"""
__revision__ = "$Id$"
import re
def format_element(bfo):
"""
Prints the publisher name
@see: place.py, date.py, reprints.py, imprint.py, pagination.py
"""
publisher = bfo.field('260__b')
publisher = re.sub(',$', '', publisher)
if publisher != ... |
from time import localtime, time, strftime
from enigma import eListbox, eListboxPythonMultiContent, eServiceReference, gFont, eRect, eSize, RT_HALIGN_LEFT, RT_HALIGN_RIGHT, RT_HALIGN_CENTER, RT_VALIGN_CENTER, RT_VALIGN_TOP, RT_WRAP, BT_SCALE, BT_KEEP_ASPECT_RATIO, BT_ALIGN_CENTER
from skin import parseColor, parseFont,... |
from .basepage import BasePage
from gi.repository import GLib, Gtk
import urllib2
import threading
import re
import pygeoip
IP_CHECK = "https://solus-project.com/geoip.php"
TIMEOUT = 10
class InstallerGeoipPage(BasePage):
""" Geoip lookup. """
info = None
tried_find = False
spinner = None
dlabel = N... |
import subprocess
def getoutput(cmdline):
p = subprocess.Popen(cmdline, stdout=subprocess.PIPE, stdin=subprocess.PIPE)
p.stdin.close()
return p.stdout.read()
def parsedate(s):
return int(getoutput(["date", "-d%s" % s, "+%s"])) |
from kivy.uix.button import Button
from kivy.uix.gridlayout import GridLayout
from Gui.Screens.aViewNotesScreen import AViewNotesScreen
from Gui.Widgets.viewSongWidget import ViewSongWidget
import myglobals
from Game.options import getOptionValue
class EditSongScreen(AViewNotesScreen):
def __init__(self):
s... |
from LicensesPlates import PlateReader
from django.shortcuts import render
from django.template import RequestContext
def home(request):
context = RequestContext(request)
return render(request, 'home.html')
def capturePlate(request):
plate_reader = PlateReader.ReadPlates()
response, errors = plate_reade... |
import os
import sys
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "djangoExample.settings")
from django.core.management import execute_from_command_line
execute_from_command_line(sys.argv) |
import glob
from HTMLParser import HTMLParser
from htmlentitydefs import entitydefs
output = []
class Parser(HTMLParser):
text = ""
current_tag = ""
count = 0 #to handle sub-tags with the same name as the current tag; eg <x cshelp="y">bla <x>bla</x> bla</x>
def handle_starttag(self, tag, attrs):
... |
import sys
import filereader
import tokenizer
import uniquify
import errno
def main(argv = sys.argv):
argv = argv[1:]
uw = uniquify.UniqueWords()
for fname in argv:
data = filereader.read_file(fname)
tokens = tokenizer.tokenize(data)
uw.uniquify(tokens)
uniquify.rank(uw)
if __nam... |
"""Tests for fsdev_disks."""
__author__ = 'gps@google.com (Gregory Smith)'
import unittest
try:
import autotest.common as common
except ImportError:
import common
from autotest_lib.client.bin import fsdev_disks
class fsdev_disks_test(unittest.TestCase):
def test_legacy_str_to_test_flags(self):
obj =... |
def removeElements(self, head, val):
cur = head
pre = None
while cur:
if cur.val == val:
if not pre:
head = cur.next
else:
pre.next = cur.next
cur = cur.next
else:
pre = cur
cur = cur.next
return ... |
from nose import tools
import numpy as np
from mitpci.interferometer.ellipse import FittedEllipse, _ellipse
def test__ellipse():
E = np.arange(0, 2 * np.pi, np.pi / 180)
# Standard unit circle
x, y = _ellipse(1, 1, 0, 0, 0, E=E)
np.testing.assert_array_equal(x, np.cos(E))
np.testing.assert_array_equ... |
"""Command-line entry point for development"""
from boristool.commands import agent
def main(*args, **kwargs):
agent()
if __name__ == '__main__':
main() |
class Logger:
def __init__(self):
self._log_string = ""
def write(self, write_str):
self._log_string += str(write_str)
self._log_string += '\n'
def get_log(self):
return _log_string |
x = int(input())
y = int(input())
z = int(input())
sumVal = int(input())
listVal = [[a,b,c] for a in range(0,x+1) for b in range(0,y+1) for c in range(0,z+1) if a+b+c != sumVal]
print(listVal) |
import calcoo
import sys
class CalculadoraHija(calcoo.Calculadora):
def multi(self, op1, op2):
return op1 * op2
def div(self, op1, op2):
return op1 / op2
if __name__ == "__main__":
calchija = CalculadoraHija()
try:
operando1 = int(sys.argv[1])
operando2 = int(sys.argv[3])... |
__author__ = "Michael Cohen <scudette@google.com>"
from rekall import plugin
from rekall.plugins.darwin import common
class DarwinHandles(common.ProcessFilterMixin, common.AbstractDarwinProducer):
"""Walks open files of each proc and collects the fileproc.
This is the same algorithm as lsof, but aimed at just c... |
import logging
log = logging.getLogger("Thug")
class JSInspector:
def __init__(self, window, ctxt, script):
self.window = window
self.script = script
self.ctxt = ctxt
@property
def dump_url(self):
if log.ThugOpts.local:
return log.ThugLogging.url
url ... |
import os
from gi.repository import Gtk
import quodlibet
from quodlibet import qltk
from quodlibet import _
from quodlibet.qltk.x import Align
from quodlibet.qltk.cbes import ComboBoxEntrySave
from quodlibet.qltk.window import PersistentWindowMixin
CLICK_ACTION_STORE = \
os.path.join(quodlibet.get_user_dir(), "list... |
import copy
import inspect
import math
import cairo
from pycha.color import ColorScheme, hex2rgb, DEFAULT_COLOR
class Chart(object):
def __init__(self, surface, options={}):
# this flag is useful to reuse this chart for drawing different data
# or use different options
self.resetFlag = False... |
import os
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
SECRET_KEY = 'ty4wmd=&yopk#u*q4l)00#2!#e15a^@-z_tv(pc3t^edv)sh&r'
DEBUG = True
ALLOWED_HOSTS = []
INSTALLED_APPS = (
'grappelli',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.cont... |
from gi.repository import Gtk
import logging
import traceback
from virtManager.baseclass import vmmGObject
def _launch_dialog(dialog, primary_text, secondary_text, title,
widget=None, modal=True):
dialog.set_property("text", primary_text)
dialog.format_secondary_text(secondary_text or None)
... |
import sys
import locale
import gettext
__trans = gettext.translation('pisi', fallback=True)
_ = __trans.ugettext
import pisi
import pisi.context as ctx
import pisi.ui
import pisi.util
class Error(pisi.Error):
pass
class Exception(pisi.Exception):
pass
def printu(obj, err = False):
if not isinstance(obj, un... |
from os.path import dirname, realpath, sep, pardir
import sys
sys.path.append(dirname(realpath(__file__)) + sep + "jsondatabase-0.1.1")
from jsondb.db import Database
def main():
# Create tmp db file in /tmp
#db = jsondb.create({})
# Create sqlite database
#db = jsondb.create({}, url='data.db')
# load database
d... |
"""
Custom widgets for Django
"""
from django import forms
from django.utils.dateparse import parse_duration
class SimpleMDE(forms.Textarea):
"""
SimpleMDE widget for Django
"""
file_upload_id = "simplemde-file-upload"
def render(self, name, value, attrs=None, renderer=None):
rendered_string... |
import coreStrip
import coreRGB
import canvasHandler
def init_script():
# LED strip configuration:
LED_COUNT = 300 # Number of LED pixels.
LED_PIN = 18 # GPIO pin connected to the pixels (must support PWM!).
LED_FREQ_HZ = 800000 # LED signal frequency in hertz (... |
from __future__ import absolute_import
from testutil.dott import feature, sh, testtmp # noqa: F401
sh % "configure dummyssh"
sh % "setconfig experimental.allowfilepeer=True"
sh % "enable amend commitcloud infinitepush rebase remotenames share"
(
sh % "cat"
<< r"""
[infinitepush]
branchpattern = re:scratch/.*
[... |
import sys
from scapy.all import *
import getopt
import time
def usage():
print "\nap-scatter 1.0 by xtr4nge"
print "Usage: ap-scatter.py <options>\n"
print "Options:"
print "-i <i>, --interface=<i> set interface (default: mon0)"
print "-t <time>, --time=<time> scan ... |
from django.http import Http404
from authorization.api.mixins import ApiResourceMixin
from course.viewbase import (
CourseInstanceBaseMixin,
CourseModuleBaseMixin,
)
from ..models import (
LearningObject,
Submission,
)
from ..viewbase import (
ExerciseBaseMixin,
SubmissionBaseMixin,
)
class Exer... |
import thread
import traceback
import re
thread.stack_size(1024 * 512) # reduce vm size
class Input(dict):
def __init__(self, conn, raw, prefix, command, params,
nick, user, host, mask, paraml, msg):
chan = paraml[0].lower()
if chan == conn.nick.lower(): # is a PM
c... |
"""
@author: David Samu
"""
import numpy as np
import pandas as pd
from quantities import deg, rad, s
from seal.analysis import tuning, direction
from seal.plot import putil, pplot
def plot_DS(u, no_labels=False, ftempl=None, **kwargs):
"""Plot direction selectivity results."""
if not u.to_plot():
retur... |
'''
@author: jackyNIX
Copyright (C) 2011-2020 jackyNIX
This file is part of KODI MixCloud Plugin.
KODI MixCloud Plugin 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... |
from qutip import *
from pylab import *
def run():
# Define atomic states. Use ordering from paper
ustate = basis(3, 0)
excited = basis(3, 1)
ground = basis(3, 2)
# Set where to truncate Fock state for cavity
N = 2
# Create the atomic operators needed for the Hamiltonian
sigma_ge = tenso... |
class Terminal(object):
def __init__(self):
self.id = None
self.description = ''
self.address = ''
class Company(object):
def __init__(self):
self.id = None
self.name = ''
class Busline(object):
def __init__(self):
self.id = None
self.via = ''
... |
"""Test module for boolean operations."""
import meshio
import numpy as np
import pytest
from helpers import compute_volume
import pygmsh
def square_loop(geom):
"""Construct square using built in geometry."""
points = [
geom.add_point([-0.5, -0.5], 0.05),
geom.add_point([-0.5, 0.5], 0.05),
... |
"""
Woodstock
Copyright (C) 2010 Matteo Dello Ioio
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed i... |
"""
Clase donde se definiran las distintas acciones a realizar
"""
import pandas as pd
from pandas import ExcelWriter
import xlsxwriter
import numpy as np
from pandas import Index
import sqlite3
from pandas.io import sql
import matplotlib.pyplot as plt
import pandas.io
import sqlalchemy
from sqlalchemy import creat... |
""" Sets up helper class for testing """
import os
import unittest
from nyaa import create_app
USE_MYSQL = True
class NyaaTestCase(unittest.TestCase):
@classmethod
def setUpClass(cls):
app = create_app('config')
app.config['TESTING'] = True
cls.app_context = app.app_context()
# U... |
from __future__ import print_function
import logging
import click
from brother_ql.devicedependent import models, label_sizes, label_type_specs, DIE_CUT_LABEL, ENDLESS_LABEL, ROUND_DIE_CUT_LABEL
from brother_ql.backends import available_backends, backend_factory
logger = logging.getLogger('brother_ql')
printer_help = "T... |
import ast
import operator as op
import re
import shlex
import sys
from datetime import datetime
from functools import reduce
from .colorable import Colorable
from .ledgerbilexceptions import ERROR_RETURN_VALUE, LdgReconcilerError
from .settings_getter import get_setting
operators = {
ast.Add: op.add,
ast.Sub: ... |
import os
import sys
from collections import OrderedDict
import pytest
from django.core.urlresolvers import resolve
from pootle_fs.finder import TranslationFileFinder
from pootle_fs.matcher import FSPathMatcher
from pootle_language.models import Language
from pootle_project.models import Project
from pootle_project.lan... |
from __future__ import division
from builtins import object
from math import sqrt, radians, sin, cos
from ..gsf.geometry import Point
from .time_utils import standard_gpstime_to_seconds
WGS84 = {'semi-major axis': 6378137.0,
'first eccentricity squared': 6.69437999014e-3}
def n_phi(phi_rad):
a = WGS84['sem... |
from itertools import combinations
import warnings
import numpy
from scipy.sparse.csr import csr_matrix
def mkneighbors_graph(observations, n_neighbours, metric, mode='connectivity', metric_params = None):
"""
Computes the (weighted) graph of mutual k-Neighbors for observations.
Notes
-----
The dist... |
import serial
import sys
import numpy as N
import struct
from ... import EXP_SCRIPT_DIRECTORY
from .. import Device, DeviceEvent, Computer
from ...errors import print2err, printExceptionDetailsToStdErr
from ...constants import DeviceConstants, EventConstants
getTime = Computer.getTime
PY3 = sys.version_info.major >= 3
... |
from PodSix.Resource import *
from PodSix.GUI.Widget import Widget
from PodSix.GUI.Button import Button
class ToolTip(Widget):
"""
Singleton for tooltip widget help.
"""
def __init__(self, font="default", color=[0, 0, 0]):
Widget.__init__(self)
self.font = font
self.color = color
self.bg = (255, 255, 255)
... |
"""
Config file upgrading module modified from grond
"""
import sys
import os
import copy
import difflib
from pyrocko import guts_agnostic as aguts
from logging import getLogger
from pyrocko import guts
logger = getLogger('upgrade')
def rename_attribute(old, new):
def func(path, obj):
if old in obj:
... |
__author__ = 'aramirez'
import flask
from flask import render_template, request, redirect, session, url_for
from libgral import tabla_usuarios, paginacion
from class_db import eliminar_usuario
direccion = "borrar-usuario"
mensaje = "BorrarCuentas"
class borrarUsuario(flask.views.MethodView):
def post(self):
... |
"""
Fetcher. Whoa.
"""
import os
import re
import shutil
from pybombs import pb_logging
from pybombs.pb_exception import PBException
from pybombs.config_manager import config_manager
class Fetcher(object):
"""
This will attempt to download source from all the recipe's urls using the available fetchers.
"""
... |
'''
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
Version 2, December 2004
Copyright (C) 2004 Sam Hocevar <sam@hocevar.net>
Everyone is permitted to copy and distribute verbatim or modified
copies of this license document, and changing it is allowed as long
as the name is changed.
... |
"""
Django settings for pythonic project.
Generated by 'django-admin startproject' using Django 1.10.3.
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
BA... |
import webbrowser
def format_html_output(file_output, file_output_html):
"""
Converts the BBCode output directly to HTML. This can be useful for rapid testing purposes.
requires bbcode module ( http://bbcode.readthedocs.io/ )
"""
try:
import bbcode
except ImportError:
print('ERROR: Couldn\'t import bbcode mod... |
import os
import fnmatch
def find(pattern, path):
result = None
for root, dirs, files in os.walk(path):
for name in files:
if fnmatch.fnmatch(name, pattern):
result = os.path.join(root, name)
return result
def read_mixture(mixture_dir, output_file):
"""
Go through every sub dir in the mixture dir
:param ... |
"""Local Component Architecture
$Id$
"""
__docformat__ = "reStructuredText"
import zope.component
_marker = object()
def getNextSiteManager(context):
"""Get the next site manager."""
sm = queryNextSiteManager(context, _marker)
if sm is _marker:
raise zope.component.interfaces.ComponentLookupError(
... |
import socket
import numpy as np
class ReliableConnect:
DELIMITER = "<EOF>"
BUFFER_SIZE = 1024
ip_address = None
port = None
socket = None
def __init__(self, ip_address, port, image_dim):
self.ip_address = ip_address
self.port = port
self.socket = None
self.row = ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.