content stringlengths 4 20k |
|---|
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from gluon.sql import DAL, Field
class BOW_DB():
FILENAME = 'bow.db'
CONNECTION = 'sqlite://{}'.format(FILENAME)
DEFAULT_OPTIONS = {
'max_freq_count' : 4000, # Maximum number of terms to store
'max_co_freq_count' : 100000 # Maximum number of term pair... |
from osv import osv, fields
import tools
import os
# Sale order
class account_invoice(osv.osv):
_inherit = 'account.invoice'
_columns = {
'vehicle_id': fields.many2one('res.partner.vehicle', 'Vehicle', readonly=True, states={'draft': [('readonly', False)]}, required=False),
}
account_invoice() |
# Information about the IUPAC alphabets
protein_letters = "ACDEFGHIKLMNPQRSTVWY"
extended_protein_letters = "ACDEFGHIKLMNPQRSTVWYBXZJUO"
# B = "Asx"; aspartic acid or asparagine (D or N)
# X = "Xxx"; unknown or 'other' amino acid
# Z = "Glx"; glutamic acid or glutamine (E or Q)
# http://www.chem.qmul.ac.uk/... |
import code
import sys
import threading
from kivy.uix.textinput import TextInput
from kivy.uix.scrollview import ScrollView
from kivy.uix.boxlayout import BoxLayout
from kivy.base import runTouchApp
from kivy.clock import Clock
from kivy.base import EventLoop
from kivy.properties import ObjectProperty, ListProperty,\
... |
#!/usr/bin/env python
__license__ = 'GPL v3'
__copyright__ = '2010, Kovid Goyal <kovid at kovidgoyal.net>'
import os, glob, re, functools
from urlparse import urlparse
from urllib import unquote
from collections import Counter
from lxml import etree
from lxml.builder import ElementMaker
from calibre.constants imp... |
"""
This module implements the main Evennia server process, the core of
the game engine.
This module should be started with the 'twistd' executable since it
sets up all the networking features. (this is done automatically
by game/evennia.py).
"""
import sys
import os
if os.name == 'nt':
# For Windows batchfile ... |
import os
import pdb
import numpy as np
import hftools.dataset.helper as helper
from hftools.testing import TestCase, make_load_tests
from hftools.dataset import hfarray
#uncomment to enable doctests
#load_tests = make_load_tests(helper)
basepath = os.path.split(__file__)[0]
from hftools.constants import unit_to_m... |
import re
from operator import attrgetter
from flask import render_template
from markupsafe import Markup, escape
from indico.core import signals
from indico.util.decorators import classproperty
from indico.util.signals import named_objects_from_signal
class Placeholder:
"""Base class for placeholders.
Pla... |
#!/bin/python2
from pyo import *
from sequencer import *
from helpers import *
import sys
import time
pyo_server = Server().boot()
if len(sys.argv) == 2:
code = read(sys.argv[1])
else:
print("NOOOOOOOOOOOO")
exit()
sequence = Sequence()
duration = 0
# Parse brainfuck code
code = cleanup(list(code))... |
from flask_migrate import MigrateCommand as DatabaseManager
from flask_migrate import stamp
from indico.core.db import db
from indico.core.db.sqlalchemy.util.management import get_all_tables
from indico.util.console import colored, cformat
@DatabaseManager.command
def prepare():
"""Initializes an empty database ... |
"""TFX template taxi model.
A DNN keras model which uses features defined in features.py and network
parameters defined in constants.py.
"""
from __future__ import division
from __future__ import print_function
import os
from absl import logging
import tensorflow as tf
import tensorflow_transform as tft
from models... |
from ctypes import pointer, sizeof
# 'time' is needed by 'gl_setup_data_and_color_vbos' below
#from time import time
import numpy as np
from pyglet.gl import *
from pyglet_app_gl_helper_basic import gl_transform_list_to_GLfloat
from pyglet_app_helper2 import replicate_data_for_panel_and_vbo
from pyglet_app_helper impo... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
import shoop.core.fields
def add_identifiers(apps, schema_editor):
for model_name in ("Attribute", "OrderStatus"):
model = apps.get_model("shoop", model_name)
for obj in model.objects.filter(id... |
#!/usr/bin/env python
'''
graph a MAVLink log file
Andrew Tridgell August 2011
'''
import sys, struct, time, os, datetime
import math, re
import pylab, pytz, matplotlib
from math import *
# allow import from the parent directory, where mavlink.py is
sys.path.insert(0, os.path.join(os.path.dirname(os.path.... |
from collections import defaultdict
from hashlib import sha256
from itertools import chain
from pprint import pformat
from twisted.internet import reactor
from twisted.internet.defer import DeferredList
from gtxamqp.factory import AmqpReconnectingFactory, AllChannelsAllocated
class AmqpReconnectingFactoryPool(object... |
from collections import deque
class BSTIterator(object):
def __init__(self, root):
"""
:type root: TreeNode
"""
self.stack = deque()
node = root
while node:
self.stack.append(node)
node = node.left
def hasNext(self):
"""
... |
"""
Django settings for ssh2 project.
Generated by 'django-admin startproject' using Django 1.8.5.
For more information on this file, see
https://docs.djangoproject.com/en/1.8/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.8/ref/settings/
"""
# Build paths i... |
"""
Clone of queso OS fingerprinting
"""
from scapy.data import KnowledgeBase
from scapy.config import conf
from scapy.layers.inet import IP,TCP
from scapy.error import warning
from scapy.volatile import RandInt
from scapy.sendrecv import sr
#from
conf.queso_base ="/etc/queso.conf"
#################
## Queso stuff... |
from django.core.management.base import BaseCommand
from simon_app.models import AS
from simon_app.functions import networkInLACNICResources
from simon_app import caching
import zlib, urllib2
import datetime
from sys import stdout
from simon_app.decorators import timed_command, mem_comsumption
from django.db import tra... |
# -*- coding: utf-8 -*-
"""
***************************************************************************
gridnet_multi.py
---------------------
Date : March 2015
Copyright : (C) 2015 by Alexander Bruy
Email : alexander dot bruy at gmail dot com
*************... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import socket
import select
EOL1 = b'\n\n'
EOL2 = b'\n\r\n'
response = b'HTTP/1.0 200 OK\r\nDate: Mon, 1 Jan 1996 01:01:01 GMT\r\n' \
b'Content-Type: text/plain\r\nContent-Length: 13\r\n\r\n' \
b'Hello, world!'
sock_server = socket.socket(socket.AF_... |
import attr
from wrapanapi.systems import OpenstackSystem
from cfme.cloud.instance.openstack import OpenStackInstance
from cfme.cloud.provider import CloudProvider
from cfme.common.provider import EventsEndpoint
from cfme.common.provider import SSHEndpoint
from cfme.exceptions import ItemNotFound
from cfme.infrastruct... |
import unittest
import numpy as np
from pele.systems import LJCluster
from pele.utils.frozen_atoms import FrozenCoordsConverter, FrozenPotWrapper, makeBLJNeighborListPotFreeze
from pele.potentials.tests import _base_test
from pele.potentials import ljpshiftfast
from pele.optimize import lbfgs_cpp
class TestFrozenCoo... |
"""
Template tasks for running external programs as luigi tasks.
This module is primarily intended for when you need to call a single external
program or shell script, and it's enough to specify program arguments and
environment variables.
If you need to run multiple commands, chain them together or pipe output
from ... |
from spack import *
class PyMultiqc(PythonPackage):
"""MultiQC is a tool to aggregate bioinformatics results across many
samples into a single report. It is written in Python and contains modules
for a large number of common bioinformatics tools."""
homepage = "https://multiqc.info"
url = "h... |
"""
Test function :func:`iris.fileformats._pyke_rules.compiled_krb.\
fc_rules_cf_fc.build_cube_metadata`.
"""
from __future__ import (absolute_import, division, print_function)
from six.moves import (filter, input, map, range, zip) # noqa
# import iris tests first so that some things can be initialised before
# imp... |
"""
scrape_food.py
=====
Open a web page that has a list of restaurants. Print out the list of all of the restaurants on that page. Use the either of the following urls - zagat or yelp...
Thai restaurants in New York City from Zagat:
http://www.zagat.com/search?text=thai&where%5Bname%5D=New+York+City+&where%5Bid%5D... |
'''
Tests for package deployment and first-time configuration
Tests in this module pertain to issues/use cases facing users first installing
and/or upgrading the package. This may include:
- installation
- command line help system
- initial datafs.yml configuration file setup
- issues specific to firs... |
import traceback
import datetime
import requests
import sys
import time
import threading
from database import dataBase
from newsreader import newsReader
from mention_manager import mentionManager
from markdownrenderer import escape, unescape
from logger import getLogger
logger = getLogger(__name__)
class cowBot(thre... |
import os.path
import sys
import djcelery
# Include apps on the path
BASE_DIR = os.path.abspath(os.path.join(os.path.dirname(__file__), '../../'))
PROJECT_ROOT = os.path.abspath(os.path.join(os.path.dirname(__file__), '../'))
if PROJECT_ROOT not in sys.path:
sys.path.insert(0, PROJECT_ROOT)
APPS_ROOT = os.path.... |
#!/usr/bin/env python3
# coding: utf-8
# Made by Louis Etienne
from gi.repository import Gtk
from openplane.core.Plane import *
from openplane.gui.gui_hangar import *
import matplotlib.pyplot as plt
from openplane import config
from openplane import text
import numpy as np
import glob
import os
class WeightWindow:
... |
from enum import Enum
from random import randint
import json
import time
N=10
class ObjectType(Enum):
empty=0
red=1
blue=2
yellow=3
black=4
green=5
# pig=7
# giant_pig=8
rock=9
wood=10
glass=11
rocket=12
bomb=13
laser=14
def __init__(self,number,color=None)... |
from app import app
from flask import jsonify, request
from werkzeug.exceptions import BadRequest
import urllib
from newman_es.es_connection import es, index_client, index_list
from newman_es.config.newman_config import active_dataset, index_creator_prefix
from newman_es.es_search import initialize_email_addr_cache, ... |
"""Misc. utility commands exposed to the user."""
import functools
import types
import traceback
try:
import hunter
except ImportError:
hunter = None
from qutebrowser.browser.network import qutescheme
from qutebrowser.utils import log, objreg, usertypes, message, debug, utils
from qutebrowser.commands import... |
from django.conf import settings
from django.db import models
from django.db.models.fields import FieldDoesNotExist
class HostSiteManager(models.Manager):
"""
A model manager to limit objects to those associated with a site.
:param field_name: the name of the related field pointing at the
... |
# -*- coding: utf-8 -*-
'''
:codeauthor: :email:`Pedro Algarvio (<EMAIL>)`
:copyright: © 2012-2013 by the SaltStack Team, see AUTHORS for more details
:license: Apache 2.0, see LICENSE for more details.
tests.integration.shell.minion
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
'''
# Import python libs
import ... |
"""Tests for serialization."""
import numpy as np
import robustness_metrics as rm
from robustness_metrics.common import types
import tensorflow as tf
class SerializationTest(tf.test.TestCase):
def testSerializer(self):
path = self.create_tempdir().create_file('myfile.tfrecords').full_path
serializer = rm.... |
#!/usr/bin/env python
'''
# D_factor kf_factor seq N
LOGLEVEL=ERROR PYTHONPATH=../.. python -O run.py 1 1 0 10
'''
from egfrd import *
from bd import *
def run(outfilename, D_factor, kf_factor, seq, N):
print outfilename
radius = 2.5e-9
sigma = radius * 2
# D = 1e-12
# D_tot = D * 2
# ta... |
class isolate():
def __init__(self):
self.name="Isolate color view"
self.description="Isolates a color, and displays it as black on white"
self.inputdata="image"
self.parameters = {
'rr': 'Red reference',
'rg':'Green reference',
'rb':'... |
from networkMonitor.PingResult import PingResult
from scapy.all import sr1, IP, ICMP
from apscheduler.schedulers.background import BackgroundScheduler
class Pinger:
QueuedPingResults = []
def __init__(self, destination, ttl, aws_client, timeout=1, size=56):
"""
:type destination: str
... |
"""
NOTE: This is a more difficult version of Problem 114.
A row measuring n units in length has red blocks with a minimum length of m
units placed on it, such that any two red blocks (which are allowed to be
different lengths) are separated by at least one black square.
Let the fill-count function, F(m, n), represen... |
"""NAV snmptrapd handler plugin to handle on battery, battery-time and
off battery traps from APC and Eation UPSes.
It should also handle UPSes that are UPS-MIB (RFC1628) compliant like
Liebert UPSes,- but it looks like UPS-MIB do not have any alarm for
off battery.
"""
import logging
import nav.errors
import re
fro... |
import urlparse
import logging
import requests
import os
from moxie.worker import celery
from moxie.core.kv import kv_store
from tempfile import NamedTemporaryFile
from requests.exceptions import RequestException, ConnectionError
ETAG_KEY_FORMAT = "%s_etag_%s"
LOCATION_KEY_FORMAT = "%s_location_%s"
logger = logging.g... |
#!/usr/bin/env python
# A matplotlib based game of Pong illustrating one way to write interactive
# animation which are easily ported to multiple backends
# pipong.py was written by Paul Ivanov <http://pirsquared.org>
from __future__ import print_function
import numpy as np
import matplotlib.pyplot as plt
from numpy.... |
from ImageScripter import *
from elan import *
if Viewer.shudder.Exists() ==True:
Viewer.shudder.Click()
else:
pass
#Viewer.homeicon9.Click()
#Viewer.homeicon9.Click()
Viewer.mediaicon10.Click()
Viewer.audiogroup.Click()
Viewer.mediazones.Click(xoffset=40,yoffset=100)
##########################################... |
#/usr/bin/python
# -*- coding: utf-8 -*-
#
# parse Gcode
#
import logging
logging.basicConfig(level=logging.DEBUG, format="%(message)s")
import threading
import time
import sys
class GuiConsole(threading.Thread):
"""simple Console based User Interface"""
def __init__(self):
threading.Thread.__init__(... |
from alembic import op
import sqlalchemy as sa
from neutron_lib.db import constants as db_const
from neutron.db import migration
"""fip qos
Revision ID: 594422d373ee
Revises: 7d32f979895f
Create Date: 2016-04-26 17:16:10.323756
"""
# revision identifiers, used by Alembic.
revision = '594422d373ee'
down_revision =... |
import json
from falcon import HTTP_200
from oslo_config import cfg
from oslo_log import log as logging
from armada.handlers.armada import Armada as Handler
LOG = logging.getLogger(__name__)
CONF = cfg.CONF
class Apply(object):
'''
apply armada endpoint service
'''
def on_post(self, req, resp):
... |
"""Callbacks: utilities called at certain points during model training.
"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import os
import numpy as np
from tensorflow.python.eager import context
from tensorflow.python.framework import dtypes
from tensorf... |
from agescx.enums.eEffect import *
class Effect:
"""Trigger Effect
Attributes:
effectType (int): type of effect
check (int): is checked ?
aiGoal (int): ai goal
state (int): diplomacy state
resource (int): player resource like food, wood, gold, stone,
kills... |
# -*- coding: utf-8 -*-
from collections import Sized
import numpy as np
from sklearn.base import clone
from sklearn.externals.joblib import Parallel, delayed
from sklearn.grid_search import GridSearchCV, ParameterGrid, _CVScoreTuple
from sklearn.metrics.scorer import check_scoring
from splearn.base import SparkBase... |
import datetime
from app import db
from app.models import User, Message
db.create_all()
# create a few of users
thope = User(name = 'Tony Hope'
, email = '<EMAIL>'
, is_teergrube = True)
rex = User(name = 'Rex'
, is_teergrube = False)
steve = User(name = 'Steve'
, is_... |
"""
Simple Twitter streaming API access
"""
__version__ = "1.1.1"
__author__ = "Rune Halvorsen <<EMAIL>>"
__homepage__ = "http://bitbucket.org/runeh/tweetstream/"
__docformat__ = "restructuredtext"
"""
.. data:: USER_AGENT
The default user agent string for stream objects
"""
USER_AGENT = "TweetStream %s" % __... |
"""Shared utils for converting datasets."""
import numpy as np
import tensorflow as tf
def generate_sharded_filenames(filename):
name, num_shards = filename.split('@')
return [f'{name}@{num}.tfrecord' for num in range(int(num_shards))]
def bytes_feature(value):
return tf.train.Feature(bytes_list=tf.train.By... |
import unittest
import os.path
import uci
CONFDIR = os.path.join(os.path.dirname(os.path.abspath(__file__)), 'config')
class TestUCI(unittest.TestCase):
def setUp(self):
self.c = uci.UCI(CONFDIR)
def test_bad_confdir(self):
self.assertRaises(ValueError, uci.UCI, 'notadir')
def test_no_... |
"""
Layout can be a Canvas, Dock, Grid, HStackPanel, VStackPanel or WrapPanel
see: https://msdn.microsoft.com/en-us/library/ms745058(v=vs.110).aspx
"""
class Layout( object ):
def __init__(self, Left=0, Height=20, Top=0, Width=20,
TopMargin=6, RightMargin=6, BottomMargin=6, LeftMargin=6)... |
__all__ = [ 'Grid', 'SelectionGrid' ]
# kaa imports
import kaa
# kaa.candy imports
from .. import is_template
from group import AbstractGroup
class Grid(AbstractGroup):
"""
Grid holding several widgets based on the given items. The grid
supports scrolling.
@note: see C{test/flickr.py} for an example
... |
farmer = {
'kb': '''
Farmer(Mac)
Rabbit(Pete)
Mother(MrsMac, Mac)
Mother(MrsRabbit, Pete)
(Rabbit(r) & Farmer(f)) ==> Hates(f, r)
(Mother(m, c)) ==> Loves(m, c)
(Mother(m, r) & Rabbit(r)) ==> Rabbit(m)
(Farmer(f)) ==> Human(f)
(Mother(m, h) & Human(h)) ==> Human(m)
''',
# Note that this order of conjuncts
# would r... |
from __future__ import print_function
import argparse
import subprocess
import datetime
import importlib
import os
import sys
import codecs
from mako.lookup import TemplateLookup
MODULE_PATH = os.getenv(
'MODULE_PATH',
os.path.realpath(os.path.join(os.path.dirname(__file__), '../modules')))
TEMPLATE_PATH = os... |
import os
import codecs
from opsbro.evaluater import export_evaluater_function
from opsbro.misc.lolcat import lolcat
from opsbro.util import PY3
from opsbro.jsonmgr import jsoner
if PY3:
basestring = str
FUNCTION_GROUP = 'system'
@export_evaluater_function(function_group=FUNCTION_GROUP)
def system_get_os():
... |
'''
New Integration Test for migrate resize data volume from ceph to xsky
@author: YeTian
@DATE: 2019-02-19
'''
import zstackwoodpecker.test_util as test_util
import zstackwoodpecker.test_state as test_state
import zstackwoodpecker.test_lib as test_lib
test_obj_dict = test_state.TestStateDict()
test_stub = test_l... |
#!/usr/bin/env python
import argparse
from datetime import datetime, timedelta
import sqlite3
import codecs
from decimal import Decimal
#from FabLabKasse import scriptHelper
def query_yes_no():
"""Ask a yes/no question via raw_input() and return the boolean representation.
The return value is True for "y... |
'''
Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
Created on Mar 9, 2014
@author: dfleck
'''
from twisted.spread import pb
from twisted.python import log
class GmuServerFactory(pb.PBServerFactory):
'''
classdocs
'''
def __init__(self... |
"""
Course navigation page object
"""
import re
from bok_choy.page_object import PageObject
from bok_choy.promise import EmptyPromise
class CourseNavPage(PageObject):
"""
Navigate sections and sequences in the courseware.
"""
url = None
def is_browser_on_page(self):
return self.q(css='d... |
"""
Now with 30% more starch.
"""
from __future__ import generators
import hmac
from zope import interface
from twisted.trial import unittest
from twisted.cred import portal, checkers, credentials, error
from twisted.python import components
from twisted.python import util
from twisted.internet import defer
from twi... |
# -*- coding: utf-8 -*-
import sys, os, urllib.request
import xml.etree.ElementTree as ET
import configparser as cfg
class versionChecker(object):
def __init__(self, timeout=3, proxyUrl="" ):
self.timeout = timeout
self.url = 'http://plugins.qgis.org/plugins/plugins.xml?qgis=3.0'
self.ini =... |
import os
import sys
import unittest
from magic_the_decorating.loaders import CallableLoader, CallableException
class TestLoader(unittest.TestCase):
"""
Tests for loading modules.
"""
def test_incomplete_callable_name(self):
"""
Tests loading of callable where module is unspecified.
... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""Tests for the YARA rules CLI arguments helper."""
import argparse
import unittest
from plaso.cli import tools
from plaso.cli.helpers import yara_rules
from plaso.lib import errors
from tests.cli import test_lib as cli_test_lib
class YaraRulesArgumentsHelperTest(cli... |
from setuptools import setup, find_packages
import os
version = '0.2'
here = os.path.abspath(os.path.dirname(__file__))
README = open(os.path.join(here, 'README.rst')).read()
setup(name='lfs-downloads',
version=version,
description='Sell digital downloads with LFS',
long_description=README,
c... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
from __future__ import unicode_literals
import time
import logging
import re
import os
import gettext
import gzip
import psutil
from io import StringIO
from binascii import hexlify
from werkzeug.local import Local, LocalProxy
from functools import partial, wraps
impor... |
"""
Course Goals Models
"""
from django.contrib.auth.models import User # lint-amnesty, pylint: disable=imported-auth-user
from django.db import models
from django.utils.encoding import python_2_unicode_compatible
from django.utils.translation import ugettext_lazy as _
from model_utils import Choices
from opaque_key... |
import datetime, json
from django.core.urlresolvers import reverse
from django.db import connection
from django.test import TestCase
from django.test.client import Client
from django.utils.timezone import utc
import archive_chan.lib.modifiers as modifiers
import archive_chan.models as models
import archive_chan.lib.s... |
# script to plot the density distributions of covariates at the field sites and for costa rica
import aei
import gdal
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
%matplotlib tk
# set the paths to use
base = '/home/salo/Downloads/costa-rica/'
plots = base + 'plots/'
sp_file = base + 'sp-data... |
# -*- coding: utf-8 -*-
"""
operations for the mp queue
"""
import multiprocessing as mp
from os import cpu_count
from PIL import Image
from tailor.config import pkConfig
def make_image(data):
# mode, size, data = data
return Image.frombytes(*data)
def save_image(image, filename):
kwargs = dict(pkCo... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# Khmer Legacy to Khmer Unicode Conversion and Vice Versa
# Copyright(c) 2006-2008 Khmer Software Initiative
# www.khmeros.info
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as p... |
from unittest import mock
from openstack_dashboard.test import helpers as test
from senlin_dashboard.api.rest import senlin
class SenlinRestTestCase(test.TestCase):
#
# Receiver
#
_receivers = [
{
'id': '1',
'name': 'test-receiver1',
'type': 'webhook',
... |
import proto # type: ignore
__protobuf__ = proto.module(
package='google.ads.googleads.v7.enums',
marshal='google.ads.googleads.v7',
manifest={
'BudgetDeliveryMethodEnum',
},
)
class BudgetDeliveryMethodEnum(proto.Message):
r"""Message describing Budget delivery methods. A delivery meth... |
import cPickle
from sparkle.QtWrapper import QtCore, QtGui
from sparkle.gui.border import QBorder
from sparkle.gui.qconstants import CursorRole
class AbstractDragView(object):
"""Class to keep drag and drop behaviour consistent across UI"""
DragRole = 33
def __init__(self):
super(AbstractDragView... |
"""Test cases for Objectapp's MetaWeblog API"""
from xmlrpclib import Binary
from xmlrpclib import Fault
from xmlrpclib import ServerProxy
from datetime import datetime
from tempfile import TemporaryFile
from django.test import TestCase
from django.contrib.auth.models import User
from django.contrib.sites.models impor... |
import cgi
import logging
import threading
import Queue
from blinkpy.common.path_finder import PathFinder
from blinkpy.web_tests.breakpad.dump_reader import DumpReader
_log = logging.getLogger(__name__)
class DumpReaderMultipart(DumpReader):
"""Base class for Linux and Android breakpad dump reader."""
def... |
from system.core.router import routes
# GET Routes ===========================================================#
# Users
routes['default_controller'] = 'Users'
routes['/'] = "Users#index"
routes['/login'] = "Users#login"
routes['/logout'] = "Users#logout"
routes['/user/<user_id>'] = "Users#show_user"
routes['/user/inb... |
def use_a_dict(env, dep, arg):
func = {
'1111' : dep.func1,
'2222' : dep.func2,
'3333' : dep.func3,
'4444' : dep.func4,
}
t = env.get_type()
return func[t](arg)
def use_if_tests(env, dep, arg):
t = env.get_type()
if t == '1111':
func = dep.func1
elif... |
# -*- coding: utf-8 -*-
"""
sphinx.builders.changes
~~~~~~~~~~~~~~~~~~~~~~~
Changelog builder.
:copyright: Copyright 2007-2011 by the Sphinx team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
import codecs
from os import path
from sphinx import package_dir
from sphinx.util import cop... |
#!/usr/bin/python
import sys, argparse
from SamBasics import SamLocusStream, SAMtoPSLconversionFactory
from GenePredBasics import GenePredEntry
from PSLBasics import PSL
from subprocess import Popen, PIPE
from RangeBasics import Bed
def main():
parser = argparse.ArgumentParser()
parser.add_argument('--min_intron',... |
from typing import Any, AsyncIterable, Awaitable, Callable, Iterable, Sequence, Tuple, Optional
from google.cloud.errorreporting_v1beta1.types import common
from google.cloud.errorreporting_v1beta1.types import error_stats_service
class ListGroupStatsPager:
"""A pager for iterating through ``list_group_stats`` r... |
# You must first run "bokeh serve" to view this example
import numpy as np
from bokeh.client import push_session
from bokeh.models import BoxSelectTool, LassoSelectTool, Paragraph
from bokeh.plotting import curdoc, figure, hplot, vplot
# create three normal population samples with different parameters
x1 = np.random... |
"""
"""
import argparse
import matplotlib.pyplot as plt
import sys
sys.path.append('..')
from analyser import EXPERIMENTS_BASE_DIR, iterate
from graphics.lib.graphicsHelper import get_stylecycler, save_figure
from graphics.common import CSV_ROWS
from graphics.lib.utils import average_data, load_csv, filter_results,... |
$NetBSD$
--- tools/install.py.orig 2016-08-26 15:27:23.000000000 +0000
+++ tools/install.py
@@ -98,6 +98,37 @@ def npm_files(action):
else:
assert(0) # unhandled action type
+def yarn_files(action):
+ target_path = 'lib/node_modules/yarn/'
+
+ # don't install npm if the target path is a symlink, it probabl... |
'''
Auto Audio Source
-----------------
Very basic plugin which allows GStreamer to auto detect
which audio source to use. Not configurable.
@author: Thanh Ha
'''
import pygst
pygst.require("0.10")
import gst
from freeseer.framework.plugin import IAudioInput
class AutoAudioSrc(IAudioInput):
name = "Auto Audio... |
# -*- coding: UTF-8 -*-
import config
import pymmd
''' index parameter is used to skip fragments harvested into the one being processed '''
def render_txt(fragment, index):
html = pymmd.convert(fragment["content"])
return html, index
def render_image(fragment, index):
return "<h1>TODO</h1>", index
def re... |
__author__ = 'Simon Hofmann'
from nltk.corpus import stopwords
from nltk import word_tokenize, pos_tag
from nltk.stem.wordnet import WordNetLemmatizer
from string import punctuation
from math import log
class TextClassifier:
def __init__(self):
pass
# Insert something useful here
class Preprocessor:
... |
user_agent = [
"Mozilla/5.0 (Linux; U; Android 4.0.3; ko-kr; LG-L160L Build/IML74K) AppleWebkit/534.30 (KHTML, \
like Gecko) Version/4.0 Mobile Safari/534.30",
"Mozilla/5.0 (Linux; U; Android 4.0.3; de-ch; HTC Sensation Build/IML74K) AppleWebKit/534.30 (KHTML, \
like Gecko) Version/4.0 Mobile Safari/5... |
import m5
from m5.objects import *
from m5.defines import buildEnv
from m5.util import addToPath
import os, optparse, sys
addToPath('../common')
addToPath('../ruby')
addToPath('../topologies')
import Options
import Ruby
# Get paths we might need. It's expected this file is in m5/configs/example.
config_path = os.pat... |
from diarc.topology import *
class RosSystemGraph(Topology):
def __init__(self):
super(RosSystemGraph,self).__init__()
@property
def nodes(self):
return dict([(v.name,v) for v in self.vertices])
@property
def topics(self):
return dict(filter(lambda x: None not in x, [(topi... |
from unittest import skipIf
from django.test import TestCase
from django.core.exceptions import ValidationError
from django.contrib.gis.geos import LineString
from django.conf import settings
from geotrek.core.fields import SnappedLineStringField, TopologyField
from geotrek.core.factories import PathFactory
@skipIf... |
import os
import sys
import contextlib
import pytest
from qtpy import PYSIDE2, QtWidgets
from qtpy.QtWidgets import QComboBox
from qtpy import uic
from qtpy.uic import loadUi
QCOMBOBOX_SUBCLASS = """
from qtpy.QtWidgets import QComboBox
class _QComboBoxSubclass(QComboBox):
pass
"""
@contextlib.contextmanager
de... |
'''
Author: Tobi and Gundram
'''
from __future__ import print_function
import tensorflow as tf
from tensorflow.python.ops import ctc_ops as ctc
from tensorflow.contrib.layers import batch_norm
from tensorflow.python.ops import rnn_cell
from tensorflow.python.ops import control_flow_ops
from tensorflow.python.ops.rnn ... |
import urllib2
import json
import re
from BeautifulSoup import BeautifulSoup
class CorriereTV:
__USERAGENT = "Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:50.0) Gecko/20100101 Firefox/50.0"
__BaseUrl = "http://video.corriere.it"
__noThumb = "http://images2.corriereobjects.it/methode_image/placeholder/320x24... |
"""The common interface and tools for all Publishers"""
class Publisher(object):
"""Base class for all test result publishers.
Publishers take test results and publish them to another service.
:param name: The name of this publisher.
:param priority_threshold: Will publish validations of this priori... |
from pymongo import MongoClient
class GeoMongoClient:
MULTIGEOMETRY = ("MULTILINESTRING", "MULTIPOLYGON")
def __init__(self, dbName, collectionName, createNew=True):
try:
self._connection = MongoClient()
except Exception, e:
raise e
if dbName not in self._connection.database_names():
raise Except... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.