content stringlengths 4 20k |
|---|
from ..engine.default import DefaultDialect
from .. import util
import re
import collections
import contextlib
from .. import event
from sqlalchemy.schema import _DDLCompiles
from sqlalchemy.engine.util import _distill_params
from sqlalchemy.engine import url
class AssertRule(object):
is_consumed = False
err... |
import time
from openerp import SUPERUSER_ID
from openerp import tools
from openerp.osv import fields, osv, expression
from openerp.tools.safe_eval import safe_eval as eval
from openerp.tools.misc import unquote as unquote
class ir_rule(osv.osv):
_name = 'ir.rule'
_order = 'name'
_MODES = ['read', 'write'... |
"""
Django settings for boomer2 project.
For more information on this file, see
https://docs.djangoproject.com/en/1.7/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.7/ref/settings/
"""
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
im... |
# -*- coding: utf-8 -*-
"""
An alphabetical list of provinces for use as `choices` in a formfield.
Reference:
http://en.wikipedia.org/wiki/ISO_3166-2:CN
http://en.wikipedia.org/wiki/Province_%28China%29
http://en.wikipedia.org/wiki/Direct-controlled_municipality
http://en.wikipedia.org/wiki/Autonomous_regions_of_Chin... |
'''
Unit tests for oc project
'''
import copy
import os
import sys
import unittest
import mock
# Removing invalid variable names for tests so that I can
# keep them brief
# pylint: disable=invalid-name,no-name-in-module
# Disable import-error b/c our libraries aren't loaded in jenkins
# pylint: disable=import-error,... |
import gzip
import os
import sys
import shutil
import subprocess
import hashlib
import json
from glob import glob
from pathlib import Path
from mesonbuild.environment import detect_ninja
from mesonbuild.mesonlib import windows_proof_rmtree, MesonException, quiet_git
from mesonbuild.wrap import wrap
from mesonbuild impo... |
from __future__ import absolute_import, division, print_function
__metaclass__ = type
ANSIBLE_METADATA = {'metadata_version': '1.1',
'status': ['stableinterface'],
'supported_by': 'community'}
from ansible.module_utils.basic import AnsibleModule
from ansible.module_utils.mysql... |
# -*- coding: utf-8 -*-
## Aditya Gilra, NCBS, Bangalore, 2012
## Dilawar Singh, NCBS, 2015
import os
os.environ['NUMPTHREADS'] = '1'
import sys
import moose
from moose.utils import *
import moose.utils as mu
from . import count
import numpy as np
from moose.neuroml.NeuroML import NeuroML
import unittest
simdt = 1... |
"""Master daemon program.
Some classes deviates from the standard style guide since the
inheritance from parent classes requires it.
"""
# pylint: disable=C0103
# C0103: Invalid name ganeti-masterd
import logging
from ganeti import config
from ganeti import constants
from ganeti import jqueue
from ganeti import ut... |
# coding=utf-8
"""
Copyright 2013 LinkedIn Corp. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable l... |
from nose.tools import *
import networkx as nx
from networkx.algorithms import bipartite
class TestBipartiteCentrality(object):
def setUp(self):
self.P4 = nx.path_graph(4)
self.K3 = nx.complete_bipartite_graph(3,3)
self.C4 = nx.cycle_graph(4)
self.davis = nx.davis_southern_women_gr... |
import pandas as pd
import six
from toolz import curry
from toolz.curried.operator import add as prepend
COLUMN_NAMES = {
"V39063": '1month',
"V39065": '3month',
"V39066": '6month',
"V39067": '1year',
"V39051": '2year',
"V39052": '3year',
"V39053": '5year',
"V39054": '7year',
"V3905... |
import os.path
import urwid
from mitmproxy.tools.console import common
from mitmproxy.tools.console import pathedit
from mitmproxy.tools.console import signals
import mitmproxy.tools.console.master # noqa
class PromptPath:
def __init__(self, callback, args):
self.callback, self.args = callback, args
... |
from pag import parser
### These should both be Interface subclasses or something
class SilentUI(object):
def __init__(self):
"""
Silent UI for testing.
"""
self._prompts = {}
pass
def set_reply(self, re_prompt, reply):
"""
Hard-code prompts and replies... |
maxtick = 100000000000 |
"""
Test the `ipalib.x509` module.
"""
import os
from os import path
import sys
from ipatests.util import raises, setitem, delitem, ClassChecker
from ipatests.util import getitem, setitem, delitem
from ipatests.util import TempDir, TempHome
from ipalib.constants import TYPE_ERROR, OVERRIDE_ERROR, SET_ERROR, DEL_ERROR
... |
import os
import shutil
import unittest
from trend_graph import TrendGraph
class TestTrendGraph(unittest.TestCase):
def testUpdate(self):
test_graph_file_backup_path = os.path.join('test_data', 'graph.html.bak')
test_graph_file_path = os.path.join('test_data', 'graph.html')
shutil.copyfile(test_graph_... |
"""Creates a TOC file from a Java jar.
The TOC file contains the non-package API of the jar. This includes all
public/protected/package classes/functions/members and the values of static
final variables (members with package access are kept because in some cases we
have multiple libraries with the same package, partic... |
import logging
from oslo_config import cfg
from oslo_context import context
import oslo_messaging
from stevedore import extension
from ceilometer.event import converter as event_converter
from ceilometer import messaging
LOG = logging.getLogger(__name__)
class EventsNotificationEndpoint(object):
def __init__(s... |
"""
Start a L{twisted.manhole} client.
"""
import sys
from twisted.python import usage
def run():
config = MyOptions()
try:
config.parseOptions()
except usage.UsageError, e:
print str(e)
print str(config)
sys.exit(1)
run_gtk2(config)
from twisted.internet import ... |
import BoostBuild
t = BoostBuild.Tester()
t.write("jamroot.jam", "import gcc ;")
t.write("jamfile.jam", "exe a : a.cpp : : debug release ;")
t.write("a.cpp", "int main() {}\n")
t.run_build_system()
t.expect_addition("bin/$toolset/debug/a.exe")
t.expect_addition("bin/$toolset/release/a.exe")
# Check that explictly-s... |
import os
import sys
path = os.path.join(os.path.dirname(os.path.realpath(__file__)), "../")
sys.path.insert(0, path)
import unittest
import numpy as np
from pyspark.context import SparkContext
from pyspark.ml import Pipeline
from pyspark.ml.feature import HashingTF, Tokenizer
from pyspark.sql import SparkSession
fro... |
from django.conf.urls import url
from corehq.apps.export.views import (
CreateCustomFormExportView,
CreateCustomCaseExportView,
CreateNewCustomFormExportView,
CreateNewCustomCaseExportView,
EditCustomFormExportView,
EditCustomCaseExportView,
EditNewCustomFormExportView,
EditNewCustomCase... |
#!/usr/bin/env python
from time import sleep
import bitcodin
bitcodin.api_key = 'INSERT YOUR API KEY HERE'
input_obj = bitcodin.Input(url='http://bitbucketireland.s3.amazonaws.com/Sintel-original-short.mkv')
print("INPUT REQUEST: %s\n\n" % input_obj.to_json())
input_result = bitcodin.create_input(input_obj)
print("I... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Unit tests for running web2py
"""
import sys
import os
if sys.version_info < (2, 7):
import unittest2 as unittest
else:
import unittest
import subprocess
import time
import signal
from fix_path import fix_sys_path
fix_sys_path(__file__)
from contrib.webcl... |
from lettuce.registry import world
from lettuce.registry import CALLBACK_REGISTRY
world._set = True
def absorb(thing, name=None):
if not isinstance(name, basestring):
name = thing.__name__
setattr(world, name, thing)
return thing
world.absorb = absorb
@world.absorb
def spew(name):
if hasat... |
"""
Support for myStrom switches.
For more details about this component, please refer to the documentation at
https://home-assistant.io/components/switch.mystrom/
"""
import logging
import requests
from homeassistant.components.switch import SwitchDevice
DEFAULT_NAME = 'myStrom Switch'
_LOGGER = logging.getLogger(... |
# -*- coding: utf-8 -*-
from __future__ import (unicode_literals, division, absolute_import, print_function)
store_version = 6 # Needed for dynamic plugin loading
__license__ = 'GPL 3'
__copyright__ = '2011-2015, Tomasz Długosz <<EMAIL>>'
__docformat__ = 'restructuredtext en'
import re
import urllib
from base64 impo... |
# -*- coding: utf-8 -*-
"""
pygments.plugin
~~~~~~~~~~~~~~~
Pygments setuptools plugin interface. The methods defined
here also work if setuptools isn't installed but they just
return nothing.
lexer plugins::
[pygments.lexers]
yourlexer = yourmodule:YourLexer
formatter pl... |
from __future__ import unicode_literals
# The *_FORMAT strings use the Django date format syntax,
# see http://docs.djangoproject.com/en/dev/ref/templates/builtins/#date
DATE_FORMAT = 'j M Y' # '25 Oct 2006'
TIME_FORMAT = 'P' # '2:30 p.m.'
DATETIME_FORMAT = 'j M Y, P' ... |
import logging
import os
import sys
from django.conf import settings
from django.core.management.base import BaseCommand
from django.test.utils import get_runner
class Command(BaseCommand):
help = 'Discover and run tests in the specified modules or the current directory.'
requires_system_checks = False
... |
from openerp.tools.translate import _
from openerp.osv import orm, fields
from openerp.addons.account.wizard.account_report_common_journal \
import account_common_journal_report
import logging
_logger = logging.getLogger(__name__)
class account_print_journal_xls(orm.TransientModel):
_inherit = 'account.print.... |
"""SASL authentication implementaion for PyXMPP.
Normative reference:
- `RFC 4422 <http://www.ietf.org/rfc/rfc4422.txt>`__
"""
__docformat__ = "restructuredtext en"
from .core import Reply, Response, Challenge, Success, Failure, PasswordManager
from .core import CLIENT_MECHANISMS, SECURE_CLIENT_MECHANISMS
from .... |
"""
Sensor to indicate whether the current day is a workday.
For more details about this platform, please refer to the documentation at
https://home-assistant.io/components/binary_sensor.workday/
"""
import asyncio
import logging
import datetime
import voluptuous as vol
from homeassistant.components.sensor import PL... |
import math
# PARAMETERS:
# Maximum tolerance for the angle between
# the robot heading direction and
# the closest obstacle detected.
alpha = 7.5 * math.pi / 180
# Maximum tolerance for the proximity reading between
# the robot and the closest obstacle.
# The proximity reading is 0 when nothing is detected
# and gr... |
"""
Test variable expansion of '<!()' syntax commands where they are evaluated
more then once..
"""
import TestGyp
test = TestGyp.TestGyp(format='gypd')
expect = test.read('commands-repeated.gyp.stdout').replace('\r\n', '\n')
test.run_gyp('commands-repeated.gyp',
'--debug', 'variables',
st... |
#
# iso2022_jp_2004.py: Python Unicode Codec for ISO2022_JP_2004
#
# Written by Hye-Shik Chang <<EMAIL>>
#
import _codecs_iso2022, codecs
import _multibytecodec as mbc
codec = _codecs_iso2022.getcodec('iso2022_jp_2004')
class Codec(codecs.Codec):
encode = codec.encode
decode = codec.decode
class Incremental... |
import os
import re
class Disks():
ptypes = {
"0": "Empty" , "24": "NEC DOS" , "81": "Minix / old Lin" , "bf": "Solaris",
"1": "FAT12" , "39": "Plan 9" , "82": "Linux swap / Solaris", "c1": "DRDOS/sec (FAT)",
"2": "XENIX root" , "3c": "PartitionMagic" , "... |
from libcloud.common.cloudstack import CloudStackDriverMixIn
from libcloud.loadbalancer.base import LoadBalancer, Member, Driver, Algorithm
from libcloud.loadbalancer.base import DEFAULT_ALGORITHM
from libcloud.loadbalancer.types import Provider
from libcloud.loadbalancer.types import State
from libcloud.utils.misc imp... |
from LogAnalyzer import Test,TestResult
import DataflashLog
import collections
class TestVCC(Test):
'''test for VCC within recommendations, or abrupt end to log in flight'''
def __init__(self):
Test.__init__(self)
self.name = "VCC"
def run(self, logdata, verbose):
self.result = ... |
from gnuradio import gr
p = gr.prefs()
style = p.get_string('wxgui', 'style', 'auto')
if style == 'auto' or style == 'gl':
try:
import wx.glcanvas
from OpenGL.GL import *
from scopesink_gl import scope_sink_f, scope_sink_c
except ImportError:
if style == 'gl':
raise... |
#some function to plot nonlinear stuff
from pb_corral import LinRes
from ListDict import ListDictKey, ListDictFilt
import numpy as np
import matplotlib.pyplot as plt
from matplotlib import cm
import matplotlib.artist as artist
import matplotlib.ticker as ticker
import matplotlib.pyplot as plt
import matplotlib.patche... |
#!/usr/bin/env python
"""
AES Key Expansion.
Expands 128, 192, or 256 bit key for use with AES
Running this file as __main__ will result in a self-test of the algorithm.
Algorithm per NIST FIPS-197 http://csrc.nist.gov/publications/fips/fips197/fips-197.pdf
Copyright (c) 2010, Adam Newman http://www.caller9.com/
L... |
"""
Exception definitions for L{twisted.web}.
"""
import operator, warnings
from twisted.web import http
class Error(Exception):
"""
A basic HTTP error.
@type status: C{str}
@ivar status: Refers to an HTTP status code, for example L{http.NOT_FOUND}.
@type message: C{str}
@param message: A ... |
"""Reuters newswire topic classification dataset.
"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import json
import numpy as np
from six.moves import zip # pylint: disable=redefined-builtin
from tensorflow.contrib.keras.python.keras.utils.data_utils... |
from . import invoice_print_report_balance_payment |
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
import json
from ansible.compat.tests.mock import patch
from units.modules.utils import set_module_args
from .iosxr_module import TestIosxrModule, load_fixture
from ansible.modules.network.iosxr import iosxr_facts
class TestIosx... |
from . import account_bank_statement_line
from . import account_bank_statement
from . import account_move_line |
from typing import Optional, Tuple
from typing_extensions import Literal
from fsui.common.layout import Layout
from fswidgets.widget import Widget
# from autologging import traced
TOP = 0
RIGHT = 1
BOTTOM = 2
LEFT = 3
# @traced
class FlexLayout(Layout):
def __init__(self, parent=None):
self.children =... |
from datetime import datetime
from itertools import chain
from blinker import Signal
from flask import url_for
from mongoengine.signals import pre_save, post_save
from werkzeug import cached_property
from elasticsearch_dsl import Integer, Object
from udata.core.storages import avatars, default_image_basename
from uda... |
# ----------------------------------------------------------------------
# ctokens.py
#
# Token specifications for symbols in ANSI C and C++. This file is
# meant to be used as a library in other tokenizers.
# ----------------------------------------------------------------------
# Reserved words
tokens = [
# Li... |
from openerp import models, api
class MrpProduction(models.Model):
_inherit = 'mrp.production'
@api.multi
def action_confirm(self):
picking_id = super(MrpProduction, self).action_confirm()
move_obj = self.env['stock.move']
mpwl_obj = self.env['mrp.production.workcenter.line']
... |
#!/usr/bin/env python
#
# This python file contains utility scripts to manage Django translations.
# It has to be run inside the django git root directory.
#
# The following commands are available:
#
# * update_catalogs: check for new strings in core and contrib catalogs, and
# output how much string... |
"""
CodeHilite Extension for Python-Markdown
========================================
Adds code/syntax highlighting to standard Python-Markdown code blocks.
Copyright 2006-2008 [Waylan Limberg](http://achinghead.com/).
Project website: <http://packages.python.org/Markdown/extensions/code_hilite.html>
Contact: <EMAIL... |
"""
Cached, database-backed sessions.
"""
import logging
from django.conf import settings
from django.contrib.sessions.backends.db import SessionStore as DBStore
from django.core.cache import caches
from django.core.exceptions import SuspiciousOperation
from django.utils import timezone
from django.utils.encoding imp... |
from django.conf import settings
from django.core.exceptions import ImproperlyConfigured
from django.utils.importlib import import_module
def get_storage(import_path):
"""
Imports the message storage class described by import_path, where
import_path is the full Python path to the class.
"""
try:
... |
"""User with admin and dev and various macs."""
import users.__config__ as __config__
import users.common as common
normal = __config__.Assignment()
normal.macs = [common.VALID_MAC]
normal.password = "3011966157.3832116431|1152195262.2761726061|160098348.1521412198|2651066.3518708095|955852492.2571409067|2745761716.393... |
import ctypes
from serial import win32
from serial.serialutil import *
def device(portnum):
"""Turn a port number into a device name"""
return 'COM%d' % (portnum+1) # numbers are transformed to a string
class Win32Serial(SerialBase):
"""Serial port implementation for Win32 based on ctypes."""
BAUD... |
class Competition:
def __init__(self, competition):
self.id = competition['id']
self.caption = competition['caption']
self.league = competition['league']
self.year = competition['year']
self.currentMatchday = competition['currentMatchday']
self.currentMatchdays... |
import unittest
from unittest import mock
from unittest.mock import Mock
from parameterized import parameterized
import airflow
from airflow.exceptions import AirflowException
from airflow.models import DAG, DagRun, TaskInstance
from airflow.operators.dummy_operator import DummyOperator
from airflow.operators.subdag_... |
from django.db.models import Q
from django.utils.html import escape
from example.models import Person, Group, Song
from ajax_select import LookupChannel
class PersonLookup(LookupChannel):
model = Person
def get_query(self, q, request):
return Person.objects.filter(Q(name__icontains=q) | Q(email__ist... |
from django.core.urlresolvers import reverse
from sentry.models import Project
from sentry.testutils import APITestCase
class TeamProjectIndexTest(APITestCase):
def test_simple(self):
self.login_as(user=self.user)
team = self.create_team(slug='baz')
project_1 = self.create_project(team=tea... |
#!/usr/bin/python3
"""Configure and/or build a GCC cross compiler.
Utilities for configuring and building a GCC cross compiler.
Assumption here is that "." (the directory we're invoked from)
contains the top-level download of gcc (either from a tar file or from
svn/git). The script will populate this directory with th... |
"""
Starts up the asyncio tasks and handles the websocket io logic
"""
import asyncio
import websockets
import socket
from . import clientData, clock
from .logging import logPrint
import config
async def __sendTask(websocket):
"""
Send messages to the server as they are appended to the outgoing queue
"""... |
from zope.interface import Interface, Attribute, implements
class IProtocolPlugin(Interface):
"""Interface for plugins providing an interface to a Words service
"""
name = Attribute("A single word describing what kind of interface this is (eg, irc or web)")
def getFactory(realm, portal):
... |
"""
KFServing
Python SDK for KFServing # noqa: E501
OpenAPI spec version: v0.1
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
from __future__ import absolute_import
import unittest
import kfserving
from kfserving.models.v1alpha2_py_torch_spec import V1alpha2PyTorchSpec ... |
import datetime
import itertools
import operator
from google.appengine.ext import webapp
from google.appengine.ext.webapp import template
from model.queues import Queue
from model import queuestatus
class ActiveBots(webapp.RequestHandler):
def get(self):
# 2000 is the GAE record fetch limit.
rec... |
"""
lua data parser by Raging_Squirrel
to parse lua file, initialize the class with path to the file
call parse method to extract the data you need
the 1st parameter is a dictionary which represents search and data mapping
keys: 'parent>name:command' - where to search
values: 'destination:alias' - how to map f... |
from __future__ import absolute_import
import logging
from random import choice
import time
try:
import simplejson as json
_ = json # pyflakes
except ImportError:
import json
from pyleus.storm import Spout
log = logging.getLogger('requests_generator')
FIRST = (
"www.ninjacorp.com",
"www.ninja... |
'''
This script helps to generate Java instrumentation tests and/or Unit test
(robolectric) for new feature Other than that, it helps to add your source
file (foo.java) and test files (footest.java) to gn (java_sources.gni)
Also, it will generate OWNER file with your <EMAIL> if it doesn't exit
Where to run?
Anywhere i... |
import autoflake
from coalib.bears.LocalBear import LocalBear
from dependency_management.requirements.PipRequirement import PipRequirement
from coalib.results.Diff import Diff
from coalib.results.Result import Result
from coalib.bearlib.aspects import map_setting_to_aspect
from coalib.bearlib.aspects.Redundancy import... |
import re
import subprocess
import logging
import ffmpeg
logging.basicConfig(level=logging.INFO, format='%(message)s')
logger = logging.getLogger(__file__)
logger.setLevel(logging.INFO)
def _logged_popen(cmd_line, *args, **kwargs):
logger.debug('Running command: {}'.format(subprocess.list2cmdline(cmd_line)))
... |
import HeeksPython as cad
import math
beam_width = 2.0;
beam_height = 2.0;
beam_thickness = .25;
bend_radius = 20.0;
line_length = 40*12.0;
dead_zone_width = 3*12.0;
top_overhang = 1.1;
bottom_overhang = 4.1;
side_overhang = 1.0;
gripper_thickness = .5;
beam_clearance = .1;
rail_height = 1;
bearing_clearance = .25... |
import mock
# To run unittests on python 2.6 please use unittest2 library
try:
import unittest2 as unittest
except ImportError:
import unittest
from jenkinsapi.plugins import Plugins
from jenkinsapi.utils.requester import Requester
from jenkinsapi.jenkins import Jenkins, JenkinsBase, Job
from jenkinsapi.custom... |
import contextlib
import functools
import mock
from neutron import context as neutron_context
from neutron.extensions import portbindings
from neutron import manager
from neutron.openstack.common import jsonutils
from neutron.plugins.bigswitch import servermanager
from neutron.plugins.ml2 import config as ml2_config
... |
'''
MathDoku solver unit tests.
@author: Radian Baskoro
'''
import unittest
from mathdokusolver.Solver import *
class SolverTest(unittest.TestCase):
def setUp(self):
pass
def tearDown(self):
pass
'''
Initialization tests
'''
def testInitialization(self):
i = '3 2... |
from __future__ import print_function, division
__all__ = ['Linearizer']
from sympy import Matrix, eye, zeros, Dummy
from sympy.utilities.iterables import flatten
from sympy.physics.vector import dynamicsymbols
from sympy.physics.mechanics.functions import msubs
import collections
class Linearizer(object):
"""T... |
"""Approximate kernel mapper for RBF kernel based on Random Fourier Features."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import math
import numpy as np
from tensorflow.contrib.kernel_methods.python.mappers import dense_kernel_mapper as dkm
from te... |
"""Fixer that changes 'a ,b' into 'a, b'.
This also changes '{a :b}' into '{a: b}', but does not touch other
uses of colons. It does not touch other uses of whitespace.
"""
from .. import pytree
from ..pgen2 import token
from .. import fixer_base
class FixWsComma(fixer_base.BaseFix):
explicit = True # The use... |
{
'name': 'Payroll',
'version': '1.0',
'category': 'Human Resources',
'sequence': 38,
'description': """
Generic Payroll system.
=======================
* Employee Details
* Employee Contracts
* Passport based Contract
* Allowances/Deductions
* Allow to configure Basic/Gross/Net... |
# !/usr/bin/python
# (c) Shahar Gino, June-2017, <EMAIL>
from sys import exit, argv
from getopt import getopt, GetoptError
from numpy import loadtxt, savetxt, float32, empty
from os import path, mkdir, chdir, system, listdir
from cv2 import imread, imwrite, cvtColor, COLOR_RGB2GRAY
__version__ = "1.0"
# Python struc... |
ANSIBLE_METADATA = {'status': ['preview'],
'supported_by': 'community',
'version': '1.0'}
import json
# COMMON CODE FOR MIGRATION
import re
from ansible.module_utils.basic import get_exception
from ansible.module_utils.netcfg import NetworkConfig, ConfigLine
from ansible.modul... |
import json
from ansible.module_utils._text import to_text
from ansible.module_utils.basic import env_fallback, return_values
from ansible.module_utils.network.common.utils import to_list, ComplexList
from ansible.module_utils.connection import Connection, ConnectionError
_DEVICE_CONFIGS = {}
routeros_provider_spec =... |
from django.conf import settings
from django.contrib.sites.models import RequestSite
from django.contrib.sites.models import Site
from django.contrib.auth import get_user_model
from registration import signals
from registration.forms import RegistrationForm
from registration.models import RegistrationProfile
user_mod... |
import time
from zope.interface import implements
from twisted.python.util import sibpath
from twisted.internet import reactor, defer
from twisted.python.components import registerAdapter
from twisted.application.service import IService, Service
from twisted.cred.portal import Portal
from nevow import athena, tags
... |
from threading import RLock
from pycoin.convention.tx_fee import TX_FEE_PER_THOUSAND_BYTES
from pycoin.tx.tx_utils import create_tx, sign_tx
DUST = 0
class SQLite3Wallet(object):
def __init__(self, keychain, persistence, desired_spendable_count=None):
self.keychain = keychain
self.persistence =... |
# -*- coding: utf-8 -*-
'''
Container Example
==============
This example shows how to add a container to our screen.
A container is simply an empty place on the screen which
could be filled with any other content from a .kv file.
'''
from kivy.app import App
from kivy.lang import Builder
from kivy.uix.boxlayout impor... |
"""setuptools.command.bdist_egg
Build .egg distributions"""
from distutils.errors import DistutilsSetupError
from distutils.dir_util import remove_tree, mkpath
from distutils import log
from types import CodeType
import sys
import os
import textwrap
import marshal
from setuptools.extern import six
from pkg_resource... |
__author__ = 'Abhineet Saxena'
"""
Indian Liver Patient Database: Dataset Normalization Program
"""
def minMax(listvar_recs, list_indices):
#print 'Entered minMax'
len_list = len(list_indices)
max_list = [-999999999.0]*len_list
min_list = [999999999.0]*len_list
for iter_rec in listvar_recs:
... |
"""Python helper for loading IGFS ops and kernels."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from tensorflow.contrib.util import loader
from tensorflow.python.platform import resource_loader
_dataset_ops = loader.load_op_library(
resource_loade... |
"""Volume v1 Type action implementations"""
import logging
import six
from cliff import command
from cliff import lister
from cliff import show
from openstackclient.common import parseractions
from openstackclient.common import utils
class CreateVolumeType(show.ShowOne):
"""Create new volume type"""
log =... |
import numpy as np
class KNearestNeighbor:
""" a kNN classifier with L2 distance """
def __init__(self):
pass
def train(self, X, y):
"""
Train the classifier. For k-nearest neighbors this is just
memorizing the training data.
Input:
X - A num_train x dimension array where each row is ... |
# -*- coding: utf-8 -*-
"""
/***************************************************************************
GeoscopioSearch
A QGIS plugin
desc
-------------------
begin : 2016-07-14
copyright : (C) 2016 by Walter lore... |
# -*- coding: utf-8 -*-
"""
"Safe weakrefs", originally from pyDispatcher.
Provides a way to safely weakref any function, including bound methods (which
aren't handled by the core weakref module).
"""
from __future__ import absolute_import
import weakref
import traceback
def safe_ref(target, on_delete=None):
""... |
'''
From BIFF8 on, strings are always stored using UTF-16LE text encoding. The
character array is a sequence of 16-bit values4. Additionally it is
possible to use a compressed format, which omits the high bytes of all
characters, if they are all zero.
The following tables describe the standard form... |
from itertools import chain
import torch
from fairseq import optim, utils
from .dynamic_loss_scaler import DynamicLossScaler
class _FP16OptimizerMixin(object):
def __init__(self, *args, **kwargs):
# forward __init__ call to the next class in mro(method resolution order)
super().__init__(*args,... |
"""
Tests for L{twisted.names} example scripts.
"""
from __future__ import absolute_import, division
import sys
from twisted.python.filepath import FilePath
from twisted.trial.unittest import SkipTest, TestCase
from twisted.python.compat import NativeStringIO
class ExampleTestBase(object):
"""
This is a mi... |
"""Provides access to services for the various providers.
TODO (jason.stredwick): Return to address the potential for bugs to have
multiple providers when addressing changes to the bug model.
Three main functions:
Crawl(provider)
Index(id)
Push(id)
"""
__author__ = ('<EMAIL> (Alexis O. Torres)',
... |
from spack import *
class LlvmAmdgpu(CMakePackage):
"""Toolkit for the construction of highly optimized compilers,
optimizers, and run-time environments."""
homepage = "https://github.com/RadeonOpenCompute/llvm-project"
url = "https://github.com/RadeonOpenCompute/llvm-project/archive/rocm-3.5... |
"""Tests NODE_COMPACT_FILTERS (BIP 157/158).
Tests that a node configured with -blockfilterindex and -peerblockfilters signals
NODE_COMPACT_FILTERS and can serve cfilters, cfheaders and cfcheckpts.
"""
from test_framework.messages import (
FILTER_TYPE_BASIC,
NODE_COMPACT_FILTERS,
hash256,
msg_getcfche... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.