code stringlengths 1 199k |
|---|
try:
import requirements
except ImportError:
pass
import time
import random
import logging
import sys
import os
import inspect
from optparse import OptionParser
import tp.client.threads
from tp.netlib.client import url2bits
from tp.netlib import Connection
from tp.netlib import failed, constants, objects
from tp.clie... |
import numpy as np
__all__ = ['compute_penalties']
def compute_penalty(kk, clusters):
'''Takes kk.clusters (clusters currently assigned)
and computes the penalty'''
if clusters is None:
clusters = kk.clusters
#print(clusters)
num_cluster_membs = np.array(np.bincount(clusters), dt... |
from datetime import datetime
from mongoengine import *
from mongoengine.django.auth import User
from django.core.urlresolvers import reverse
import mongoengine.fields
class Evento(Document):
titulo = StringField(max_length=200, required=True)
descricao = StringField(required=True)
data_modificacao = DateTimeField(d... |
import copy, getpass, logging, pprint, re, urllib, urlparse
import httplib2
from django.utils import datastructures, simplejson
from autotest_lib.frontend.afe import rpc_client_lib
from autotest_lib.client.common_lib import utils
_request_headers = {}
def _get_request_headers(uri):
server = urlparse.urlparse(uri)[0... |
from setuptools import setup, Extension
module1 = Extension('giscup15',
sources = ['giscup15.cpp'],
extra_compile_args=['-std=c++11'],
libraries=['shp'])
setup (name = 'giscup15',
version = '1.0',
description = 'This is a wrapper around the short... |
"""make status give a bit more context
This extension will wrap the status command to make it show more context about
the state of the repo
"""
import math
import os
from edenscm.mercurial import (
commands,
hbisect,
merge as mergemod,
node as nodeutil,
pycompat,
registrar,
scmutil,
)
from e... |
"""Author: Ben Johnstone"""
def Main():
parser = argparse.ArgumentParser(description="")
parser.add_argument("--file", "-f", required=True,
help="Name of the file containing the historical powerball drawings")
parser.add_argument("--jackpot", "-j", help="Optional excel file containin... |
"""VCard file handling.
"""
from .store import File, InvalidFileContents
class VCardFile(File):
content_type = "text/vcard"
def __init__(self, content, content_type):
super(VCardFile, self).__init__(content, content_type)
self._addressbook = None
def validate(self):
c = b"".join(self... |
"""order name not unique
Revision ID: 1139f0b4c9e3
Revises: 220436d6dcdc
Create Date: 2016-05-31 08:59:21.225314
"""
revision = '1139f0b4c9e3'
down_revision = '220436d6dcdc'
from alembic import op
import sqlalchemy as sa
def upgrade():
### commands auto generated by Alembic - please adjust! ###
op.drop_constrai... |
ANSIBLE_METADATA = {'metadata_version': '1.1',
'status': ['preview'],
'supported_by': 'community'}
DOCUMENTATION = '''
---
module: avi_role
author: Gaurav Rastogi (grastogi@avinetworks.com)
short_description: Module for setup of Role Avi RESTful Object
description:
- This mod... |
from django.contrib.auth.models import Group
from django.core import mail
from django.urls import reverse
from django.test import TestCase
from django.conf import settings
from zds.member.factories import ProfileFactory
from zds.mp.models import PrivateTopic
class MpUtilTest(TestCase):
def setUp(self):
self... |
import cv2
import cv2.cv as cv
import numpy as np
from CapraVision.server.filters.parameter import Parameter
from CapraVision.server.filters.dataextract import DataExtractor
class MTI880(DataExtractor):
def __init__(self):
DataExtractor.__init__(self)
self.hue_min = 113
self.hue_max = 255
... |
from random import randint
from yapsy.IPlugin import IPlugin
class PortCheckerPlugin(IPlugin):
"""
Mocked Version: Return random 0 or 1 as exit_code
Takes an ip address and a port as inputs and trys to make
a TCP connection to that port. Output is success 0 or failure > 0
"""
def exe... |
from modulation import Packet, Plugin
import threading
class ControlPacket(Packet):
"""A ControlPacket gives some kind of control signal to a child plugin, such as "STOP", "PLAY", "SEARCH", "VOLUME", etc
If a plugin handles the packet according to its intent (eg stopping playback on a stop packet), then the
... |
from gi.repository import Gtk
from gettext import gettext as _
from GTG.gtk.backends.parameters_ui import ParametersUI
from GTG.backends.backend_signals import BackendSignals
class ConfigurePanel(Gtk.Box):
"""
A vertical Box that lets you configure a backend
"""
def __init__(self, backends):
"""... |
import re
from module.plugins.Hoster import Hoster
from module.plugins.internal.CaptchaService import ReCaptcha
class FreakshareCom(Hoster):
__name__ = "FreakshareCom"
__type__ = "hoster"
__pattern__ = r"http://(?:www\.)?freakshare\.(net|com)/files/\S*?/"
__version__ = "0.38"
__description__ = """Fr... |
class ListNode:
def __init__(self, x):
self.val = x
self.next = None
def display(self):
node = self
while node is not None:
print(node.val, end="->")
node = node.next
print()
"""
class SLinkedList:
def __init__(self):
self.head = None
... |
from GGrule import *
class GraphGrammar:
def __init__(self, GGrules = None):
"Constructor, it receives GGrules, that is a list of GGrule elements"
self.GGrules = [] # We'll insert rules by order of execution
self.rewritingSystem = None # No rewriting system assigned yet
while... |
from test_support import verbose, TestFailed
if verbose:
print "Testing whether compiler catches assignment to __debug__"
try:
compile('__debug__ = 1', '?', 'single')
except SyntaxError:
pass
import __builtin__
prev = __builtin__.__debug__
setattr(__builtin__, '__debug__', 'sure')
setattr(__builtin__, '__de... |
import numpy as np
import unittest2 as unittest
from nupic.frameworks.opf.metrics import getModule, MetricSpec
class OPFMetricsTest(unittest.TestCase):
DELTA = 0.01
VERBOSITY = 0
def testRMSE(self):
rmse = getModule(MetricSpec("rmse", None, None,
{"verbosity" : OPFMetricsTest.VERBOSITY}))
gt = [9, 4, 5, 6... |
from collections import defaultdict
from sys import argv
import numpy as np
try:
import md_outlier_remover as mor
import plotters.general_plotter as gp
import file_parser as fp
from argparser import argument_parser
except ImportError:
import pyRona.md_outlier_remover as mor
import pyRona.plotter... |
import shutil
import os
from distutils.core import setup
import switchscreen
shutil.copyfile("switchscreen.py", "switchscreen")
setup(
name = "switchscreen",
version = switchscreen.__version__,
description = "",
author = u"Régis FLORET",
author_mail = "regisfloret@gmail.com",
url = "http://code.... |
from __future__ import unicode_literals
import os
def wait():
raw_input('\nPress Enter to continue...\n\n')
os.system(['clear', 'cls'][os.name == 'nt'])
class BaseWalletHandler(object):
def __init__(self):
self.items = {
'Driver\'s License': False,
'Credit Card': False,
... |
from PyQt4 import QtGui
class SingletonWidget(QtGui.QWidget):
__instance = None
def __init__(self, *args):
super().__init__(*args)
if self.__class__.__instance is not None:
raise RuntimeError("Singleton check failed.")
else:
self.__class__.__instance = self
class ... |
import sys
import os
import signal
from openpyxl.utils import get_column_letter
from openpyxl import Workbook,load_workbook
ItemList=[]
class switch(object):
def __init__(self, value):
self.value = value
self.fall = False
def __iter__(self):
"""Return the match method once, then stop"""
... |
from math import sqrt
def euclidean_distance(p1, p2):
"""
Compute euclidean distance for two points
:param p1:
:param p2:
:return:
"""
dx, dy = p2[0] - p1[0], p2[1] - p1[1]
# Magnitude. Coulomb law.
return sqrt(dx ** 2 + dy ** 2) |
"""
Copyright (C) 2012 by Victor
victor@caern.de
This file is part of SoulCreator.
SoulCreator 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... |
import copy
from nive.utils.dataPool2.mysql.tests import test_MySql
try:
from nive.utils.dataPool2.mysql.mySqlPool import *
except:
pass
from . import test_db
from nive.utils.dataPool2.sqlite.sqlite3Pool import *
mode = "mysql"
printed = [""]
def print_(*kw):
if type(kw)!=type(""):
v = ""
fo... |
from pyspace.planet import PlanetArray
from pyspace.simulator import BarnesSimulator
import numpy
x = numpy.array([0,100])
y = numpy.array([0,0])
z = numpy.array([0,0])
m = numpy.array([1000,1])
v_y = numpy.array([0,(1000/100)**0.5])
pa = PlanetArray(x, y, z, v_y=v_y, m=m)
sim = BarnesSimulator(pa, 1, 1, 0, sim_name = ... |
import unittest
import upload.injectionContainer as injectionContainer
from upload.strategy.dummys.injectedContainerDummy import ContainerMock
class TestRequestParams(unittest.TestCase):
"""
Class test for request params class
"""
def test_open_file_error(self):
"""
test case secured upl... |
from datetime import timedelta, date
def daterange(start_date, end_date):
for n in range(int ((end_date - start_date).days)):
yield start_date + timedelta(n)
start_date = date(2017, 9, 30)
end_date = date(2017, 10, 23)
for single_date in daterange(start_date, end_date):
print './neg_runner.sh', single_d... |
from nose.tools import assert_raises
from endicia.builders.ChangePassPhraseXmlBuilder import ChangePassPhraseXmlBuilder
from endicia.builders.EndiciaXmlBuilder import ValueToLongError
def test_ChangePassPhraseXmlBuilder_invalid_values():
"""ChangePassPhraseXmlBuilder should raise ValueToLongError when each value is pa... |
import csv
import pickle
import datetime
import os
import urllib.request, urllib.parse, urllib.error
from django.core.cache import cache
from django.urls import reverse
from django.http import HttpResponseRedirect, HttpResponse, Http404
from django.db.models import Q
from django.db.models.aggregates import Max
from dja... |
__problem_title__ = "Comfortable distance"
__problem_url___ = "https://projecteuler.net/problem=364"
__problem_description__ = "There are seats in a row. people come after each other to fill the " \
"seats according to the following rules: We can verify that T(10) = " \
... |
from __future__ import unicode_literals
from django.core.urlresolvers import reverse_lazy
from django.conf import settings
from rest_framework import serializers
from rest_flex_fields import FlexFieldsModelSerializer
from rest_flex_fields.serializers import FlexFieldsSerializerMixin
from easy_thumbnails.templatetags.th... |
from ImportDependence import *
from CustomClass import *
class CIA(AppForm):
useddf=pd.DataFrame()
Lines = []
Tags = []
description = 'Chemical Index of Alteration'
unuseful = ['Name',
'Mineral',
'Author',
'DataType',
'Label',
... |
import os
import email
import tempfile
import re
from email.header import Header
import email.charset as charset
charset.add_charset('utf-8', charset.QP, charset.QP, 'utf-8')
from email.iterators import typed_subpart_iterator
import logging
import mailcap
from cStringIO import StringIO
import alot.crypto as crypto
impo... |
import os #for OS program calls
import sys #For Clean sys.exit command
import time #for sleep/pause
import RPi.GPIO as io #read the GPIO pins
io.setmode(io.BCM)
pir_pin = 17
screen_saver = False
io.setup(pir_pin, io.IN)
while True:
if screen_saver:
if io.input(pir_pin):
os.system("xscreensaver-command -deactivate... |
import functools
import inspect
import sys
import pygame
def key_event(*keys):
def wrap(f):
f.__key_events__ = keys
return f
return wrap
class _KeyHandlerMeta(type):
def __new__(cls, name, bases, dct):
if not '__key_handlers__' in dct:
dct['__key_handlers__'] = {}
... |
"""
Code128 Barcode Detection & Analysis
(c) Charles Shiflett 2011
Finds Code128 barcodes in documents scanned in Grayscale at 300 dpi.
Usage:
Each page of the PDF must be converted to a grayscale PNG image, and should
be ordered as follows:
1001/1001-001.png
1001/1001-002.png
1001/1001-003.pn... |
"""
This file emits the list of reasons why a particular build needs to be clobbered
(or a list of 'landmines').
"""
import sys
def main():
"""
ALL LANDMINES ARE EMITTED FROM HERE.
"""
print 'Need to clobber after ICU52 roll.'
print 'Landmines test.'
print 'Activating MSVS 2013.'
print 'Revert activation ... |
from __future__ import nested_scopes, generators, division, absolute_import, with_statement, print_function, unicode_literals
from .pyqtver import*
if pyqtversion == 4:
from PyQt4 import QtGui, QtCore
from PyQt4.QtGui import QComboBox, QDialog, QDialogButtonBox, QDoubleValidator, QGridLayout, QIntValidator, QLa... |
'''
Copyright (C) 2016 Bastille Networks
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... |
import pygame
sprite = {}
sprite['image'] = pygame.image.load("test/font6x8_normal_w.png")
sprite['width'] = 6
sprite['height'] = 8
def Addr():
return sprite |
from __future__ import division, print_function
import json
from collections import Iterable, OrderedDict, namedtuple
import numpy as np
from six import string_types
def isnamedtuple(obj):
"""Heuristic check if an object is a namedtuple."""
return isinstance(obj, tuple) \
and hasattr(obj, "_fields") ... |
"""Provides compatibility with first-generation host delegation options in ansible-test."""
from __future__ import annotations
import argparse
import dataclasses
import enum
import os
import types
import typing as t
from ..constants import (
CONTROLLER_PYTHON_VERSIONS,
SUPPORTED_PYTHON_VERSIONS,
)
from ..util i... |
# This file is part of PlexPy.
from plexpy import logger, datatables, common, database, helpers
import datetime
class DataFactory(object):
"""
Retrieve and process data from the monitor database
"""
def __init__(self):
pass
def get_datatables_history(self, kwargs=None, custom_where=None, gr... |
from apps.plus_permissions.default_agents import get_admin_user
from apps.plus_permissions.models import GenericReference
def patch():
for ref in GenericReference.objects.filter(creator=None):
ref.creator = get_admin_user()
ref.save()
patch() |
import os
import cv2
import sys
import math
import time
import json
import argparse
import numpy as np
from ownLibraries.pathsandnames import PathsAndNames
debug = False
nuevaLocalizacion = ''
gitBranches = os.popen('git branch').read().replace(' ','').split('\n')
gitVersion = [branch for branch in gitBranches if '*' i... |
n = int(input())
array = [int(i) for i in input().split()]
array.insert(0, 0)
array.sort()
q = int(input())
def binarySearch(low, high, element):
while(low <= high):
mid = (low + high) // 2
if array[mid] == element:
return mid
elif array[mid] < element:
low = mid + 1
else:
high = mid... |
"""
.. module:: data_notes
:platform: Unix
:synopsis: A module containing extended doc strings for the data module.
.. moduleauthor:: Nicola Wadeson <scientificsoftware@diamond.ac.uk>
"""
def _set_preview_note():
"""
Each ``preview_list`` element should be of the form
``start:stop:step:chunk``... |
import os
import inspect
import sys
class BlockStore:
def __init__(self, input_file, block_size, output_dir):
self.input_file = input_file
self.block_size = block_size
file_size = os.stat(input_file).st_size
print 'file_size: %d' % file_size
#Should handle this later on.
... |
"""geonature samples
Revision ID: 3d0bf4ee67d1
Create Date: 2021-09-27 18:00:45.818766
"""
from alembic import op
import sqlalchemy as sa
revision = '3d0bf4ee67d1'
down_revision = None
branch_labels = ('geonature-samples',)
depends_on = (
'geonature',
)
def upgrade():
op.execute("""
INSERT INTO gn_meta.sinp... |
'''
Created on Dec 5, 2016
@author: paveenju
'''
import numpy as np
import matplotlib as mpl
import matplotlib.pyplot as plt
import matplotlib2tikz.save as tikz_save
import utils.functions as fn
if __name__ == '__main__':
pass
def axes():
plt.axhline(0, alpha=.1)
plt.axvline(0, alpha=.1)
dL = np.array([0.4,... |
__doc__ = """
"""
from nive.i18n import _
from nive.definitions import FieldConf, ViewConf, ViewModuleConf, Conf
configuration = ViewModuleConf(
id = "userview",
name = _(u"User signup"),
static = "nive.userdb.userview:static",
containment = "nive.userdb.app.UserDB",
context = "nive.userdb.root.root... |
from gi.repository import GObject, Gio, GLib
from lollypop.define import Lp, Type
class TouchHelper(GObject.GObject):
"""
Allow to launch a function after a long click
Can't get touch gtk support to work with python
"""
def __init__(self, widget, action, shortcut):
"""
In... |
from genesis2.core.core import Plugin, implements
from genesis2.interfaces.gui import IMeter
class BaseMeter (Plugin):
"""
Meters are determinable values (int, float, bool) representing system status
(sysload, memory usage, service status, etc.) which are used and exported
over HTTP by ``health`` builti... |
from GangaCore.GPIDev.Schema import *
from GangaCore.GPIDev.Lib.Tasks.common import *
from GangaCore.GPIDev.Lib.Tasks.ITransform import ITransform
from GangaCore.GPIDev.Lib.Job.Job import JobError
from GangaCore.GPIDev.Lib.Registry.JobRegistry import JobRegistrySlice, JobRegistrySliceProxy
from GangaCore.Core.exception... |
import codecs
import csv
import fnmatch
import inspect
import locale
import os
import openerp.sql_db as sql_db
import re
import logging
import tarfile
import tempfile
import threading
from babel.messages import extract
from collections import defaultdict
from datetime import datetime
from lxml import etree
from os.path... |
"""
@author: Laurent GRÉGOIRE <laurent.gregoire@mecatran.com>
"""
import math
import sys
import unittest
import six
from gtfsplugins.prettycsv import PrettyCsv
class TestPrettyPrinter(unittest.TestCase):
def test_prettyprinter(self):
# Capture standard output
saved_stdout = sys.stdout
try:
... |
from __future__ import unicode_literals
import SocketServer
import logging
import socket
import struct
import setproctitle
import chardet
from pulseaudio_dlna.discover import RendererDiscover
from pulseaudio_dlna.renderers import RendererHolder
logger = logging.getLogger('pulseaudio_dlna.listener')
class SSDPRequestHan... |
from django.test import TestCase as DjangoTestCase
from django.conf import settings
from seeder.models import *
from seeder.posters import TwitterPoster
from random import randint as random
from datetime import datetime
import time
import mox
import re
def generate_random_authorized_account():
u = User(username = "... |
"""
Usage:
main.py <host> <username> <password> [-r] [--port=<port>] [--hub=<hub>] [--pppoe-username=<username>] [--pppoe-password=<password>] [--output=<output>]
Options:
-h --help Show help
-r Change route to make connect to Packetix Server always use default gw... |
from PyQt5.QtCore import Qt
from ouf.filemodel.filemodelitem import FileModelItem, FileItemType
class FileSystemItem(FileModelItem):
def __init__(self, path):
super().__init__(FileItemType.filesystem, path)
def data(self, column, role=Qt.DisplayRole):
if column == 0:
if role == Qt.Di... |
if __name__ == '__main__':
import ctypes
import sys
if sys.platform.startswith('linux'):
try:
x11 = ctypes.cdll.LoadLibrary('libX11.so')
x11.XInitThreads()
except:
print "Warning: failed to XInitThreads()"
from gnuradio import analog
from gnuradio import b... |
import random
from os.path import join, dirname
import numpy as np
from sklearn.base import ClassifierMixin, BaseEstimator
import fasttext as ft
from underthesea.util.file_io import write
import os
from underthesea.util.singleton import Singleton
class FastTextClassifier(ClassifierMixin, BaseEstimator):
def __init_... |
"""
/***************************************************************************
PisteCreatorDockWidget_OptionDock
Option dock for Qgis plugins
Option dock initialize
-------------------
begin : 2017-07-25
last ... |
import argparse
import time
import os
import sys
from copy import deepcopy
from random import random
sys.path.append(os.path.abspath("../.."))
from util.communication.grapevine import Communicator
def main(args):
com = Communicator("movement/physical")
last_packet_time = 0.0
while True:
rx_packet = ... |
"""
无法从上层目录进行导入操作
"""
class UnableTest(object):
pass |
from PyQt5 import QtCore, QtGui, QtWidgets
class Ui_Form(object):
def setupUi(self, Form):
Form.setObjectName("Form")
Form.resize(306, 332)
self.gridLayout = QtWidgets.QGridLayout(Form)
self.gridLayout.setObjectName("gridLayout")
self.label = QtWidgets.QLabel(Form)
se... |
from __future__ import unicode_literals
from zipfile import ZipFile
import decimal
import datetime
from xml.dom.minidom import parseString
from . import ods_components
from .formula import Formula
try:
long
except NameError:
long = int
try:
unicode
except NameError:
unicode = str
class ODSWriter(object)... |
"""
Created on Fri Jun 09 10:36:56 2017
@author: Nzix
"""
import urllib,urllib2,re,datetime,time,random,xlrd,xlwt,os
cookie = ""
def ticketcheck(membercode,serial_code_1,serial_code_2):
timeout = 3
global cookie
if type(membercode) is int:
membercode = str(membercode)
teamcode = membercode[0] + ... |
import sys, os
extensions = ['sphinx.ext.todo', 'sphinx.ext.pngmath', 'sphinx.ext.viewcode']
templates_path = ['_templates']
source_suffix = '.rst'
master_doc = 'index'
project = u'testgdt'
copyright = u'2012, gdt'
version = '0.1'
release = '0.1'
exclude_patterns = []
pygments_style = 'sphinx'
html_theme = 'default'
ht... |
"""PEP 440 verschemes tests"""
import unittest
from verschemes.pep440 import Pep440Version
class Pep440VersionTestCase(unittest.TestCase):
def test_one_segment(self):
version = Pep440Version(release1=4)
self.assertEqual("4", str(version))
self.assertEqual(0, version.epoch)
self.asser... |
import sys
from mercurial import hg, node, ui
def main():
"""print (possibly remote) heads
Prints a series of lines consisting of hashes and branch names.
Specify a local or remote repository, defaulting to the configured remote.
"""
repo = sys.argv[1]
other = hg.peer(ui.ui(), {}, repo)
for ... |
import lorun
import os
import codecs
import random
import subprocess
import config
import sys
RESULT_MAP = [
2, 10, 5, 4, 3, 6, 11, 7, 12
]
class Runner:
def __init__(self):
return
def compile(self, judger, srcPath, outPath):
cmd = config.langCompile[judger.lang] % {'root': sys.path[0], 'src... |
import os
import traceback
import json
import requests
from flask import Flask, request
from cities_list import CITIES
from messages import get_message, search_keyword
token = os.environ.get('FB_ACCESS_TOKEN')
api_key = os.environ.get('WEATHER_API_KEY')
app = Flask(__name__)
def location_quick_reply(sender, text=None):... |
"""
This file is part of coffeedatabase.
coffeedatabase 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.
coffeedatabase is... |
"""
BORIS
Behavioral Observation Research Interactive Software
Copyright 2012-2022 Olivier Friard
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 2 of the License, or
(at your o... |
from builtins import str
from builtins import object
import httplib2
import MySQLdb
import json
import os
import sys
import time
import config
from apiclient.discovery import build
from oauth2client.file import Storage
from oauth2client.client import OAuth2WebServerFlow
from oauth2client.tools import run
class Error(Ex... |
from __future__ import division
__author__ = "Jesse Zaneveld"
__copyright__ = "Copyright 2011-2013, The PICRUSt Project"
__credits__ = ["Jesse Zaneveld","Morgan Langille"]
__license__ = "GPL"
__version__ = "1.0.0-dev"
__maintainer__ = "Jesse Zaneveld"
__email__ = "zaneveld@gmail.com"
__status__ = "Development"
from os.... |
import sys, os
import psutil
sys.path.insert(0, os.path.abspath('./../'))
sys.path.insert(0, os.path.abspath('.'))
autodoc_member_order = 'bysource'
autodoc_default_flags = ['members', 'show-inheritance', 'undoc-members', 'show-hidden']
autoclass_content = 'both'
needs_sphinx = '1.1'
extensions = ['sphinx.ext.autodoc',... |
import cv2
import numpy as np
import os
from vilay.core.Descriptor import MediaTime, Shape
from vilay.detectors.IDetector import IDetector
from vilay.core.DescriptionScheme import DescriptionScheme
class FaceDetector(IDetector):
def getName(self):
return "Face Detector"
def initialize(self):
# d... |
import argparse
import os
import sys
import MySQLdb
parser = argparse.ArgumentParser()
parser.add_argument('-i', action='store', dest='InputDir', help='Working Directory')
parser.add_argument('-d', action='store', dest='database', help='Stacks database')
parser.add_argument('-c', action='store', dest='CodeSp', help='ID... |
import commands
import pykolab
from pykolab import utils
from pykolab.translate import _
log = pykolab.getLogger('pykolab.cli')
conf = pykolab.getConf()
def __init__():
commands.register('user_info', execute, description="Display user information.")
def execute(*args, **kw):
from pykolab import wap_client
t... |
import os
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
SECRET_KEY = ')p9u&kcu@_(8u&-%4(m9!&4*82sx97zyl-!i#m9kic2lycj%0)'
DEBUG = True
ALLOWED_HOSTS = []
INSTALLED_APPS = [
'demografia.apps.DemografiaConfig',
'dal',
'dal_select2',
'suit',
'django.contrib.admin',
'django.... |
from __future__ import (unicode_literals, absolute_import, print_function, division)
from copy import deepcopy
from itertools import combinations
class Cell:
def __init__(self):
self.value = 0
self.row = set()
self.col = set()
self.sq = set()
self.rm_values = set()
def is... |
import os
import sys
import glob
import argparse
from datetime import datetime
import platform
if platform.system().lower() == 'darwin':
os.environ['PYTHONPATH'] = '%s/osx_libs:$PYTHONPATH' % os.getcwd()
import wormtable as wt
def parse_args():
"""
Parse the input arguments.
"""
parser = argparse.ArgumentPa... |
"""All things that are specifically related to adinebook website"""
from collections import defaultdict
from logging import getLogger
from typing import Optional
from langid import classify
from regex import compile as regex_compile
from requests import RequestException
from mechanicalsoup import StatefulBrowser
from l... |
import struct
import re
from .core import NamedItemList
from copy import deepcopy
_SINGLE_MEMBER_REGEX = re.compile(r"^[@=<>!]?([0-9]*)([xcbB\?hHiIlLqQnNefdspP])$")
def __isSingleMemberFormatString(format):
return bool(_SINGLE_MEMBER_REGEX.match(format))
def formatStringForMembers(members):
formatString = ""
for mem... |
import rdflib
g=rdflib.Graph()
g.load('http://dbpedia.org/resource/Semantic_Web')
for s,p,o in g:
print(s,p,o) |
"""compares BSR values between two groups in a BSR matrix
Numpy and BioPython need to be installed. Python version must be at
least 2.7 to use collections"""
from optparse import OptionParser
import subprocess
from ls_bsr.util import prune_matrix
from ls_bsr.util import compare_values
from ls_bsr.util import find_uniq... |
from __future__ import absolute_import
from __future__ import unicode_literals
from .email import EmailMatcher
from .email_name import EmailNameMatcher
SORTINGHAT_IDENTITIES_MATCHERS = {
'default' : EmailMatcher,
'email' : EmailMatcher,
... |
"""
dwm package setup
"""
from __future__ import print_function
from setuptools import setup, find_packages
__version__ = '1.1.0'
def readme():
""" open readme for long_description """
try:
with open('README.md') as fle:
return fle.read()
except IOError:
return ''
setup(
... |
from gnuradio import gr, gr_unittest, blocks
import math
def sig_source_f(samp_rate, freq, amp, N):
t = [float(x) / samp_rate for x in range(N)]
y = [amp*math.cos(2.*math.pi*freq*x) for x in t]
return y
def sig_source_c(samp_rate, freq, amp, N):
t = [float(x) / samp_rate for x in range(N)]
y = [math... |
from __future__ import unicode_literals
import datetime
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('MergeServer', '0001_initial'),
]
operations = [
migrations.AlterField(
model_name='results',
name='start_time',
... |
from django.core.urlresolvers import reverse
import django.http
import django.utils.simplejson as json
import functools
def make_url(request, reversible):
return request.build_absolute_uri(reverse(reversible))
def json_output(func):
@functools.wraps(func)
def wrapper(*args, **kwargs):
output = func(... |
import re
import os
import ast
import luigi
import psycopg2
import boto3
import random
import sqlalchemy
import tempfile
import glob
import datetime
import subprocess
import pandas as pn
from luigi import six
from os.path import join, dirname
from luigi import configuration
from luigi.s3 import S3Target, S3Client
from ... |
import numpy as np
from definition import states_by_id
import pyproj as prj
class Route:
"""
A class of Breeding Bird Survey (BBS) route
Each Route includes the following members:
id - id number of the route
name - name of the route
stateID - to which state the route belongs
... |
from . import sqldb
class aminoAcid():
def __init__(self,abbr1,abbr3,name):
self.abbr3 = abbr3
self.abbr1 = abbr1
self.name = name
def __str__(self):
return self.name
def __repr__(self):
return self.name
def getOne(self):
return self.abbr1
def getThree... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.