content string |
|---|
# -*- coding: utf-8 -*-
"""
continuity.cli.pt
~~~~~~~~~~~~~~~~~
Continuity Pivotal Tracker CLI commands.
:copyright: 2015 by Jonathan Zempel.
:license: BSD, see LICENSE for more details.
"""
from .commons import (FinishCommand as BaseFinishCommand, GitCommand,
ReviewCommand as BaseReviewC... |
#!/usr/bin/env python
#test on http://www.youtube.com/watch?v=Or5R_uPvPao
from sys import stdin, stdout
from time import time, sleep
from struct import unpack
from os.path import isfile, isdir
from os import mkdir, system
from Queue import Queue
from cStringIO import StringIO
from threading import Thread
from subpro... |
# GWR Bandwidth selection class
#x_glob parameter does not yet do anything; it is for semiparametric
__author__ = "Taylor Oshan <EMAIL>"
from pysal.model.spreg import user_output as USER
import numpy as np
from scipy.spatial.distance import pdist,squareform
from scipy.optimize import minimize_scalar
from pysal.mode... |
import media
import fresh_tomatoes
# create movie objects of favorite movies
in_bruges = media.Movie("In Bruges",
"Guilt-stricken after a job gone wrong, hitman Ray and his partner await orders from their ruthless boss in Bruges, Belgium, the last place in the world Ray wants to be.",
... |
def test_chrono_system_clock():
from pybind11_tests import test_chrono1
import datetime
# Get the time from both c++ and datetime
date1 = test_chrono1()
date2 = datetime.datetime.today()
# The returned value should be a datetime
assert isinstance(date1, datetime.datetime)
# The number... |
# This is an extremely important file for creating your own bot microservices.
#
# It dynamically connects microservices (your new application-layer features and services) with the representative
# models (locations and devices) provided by com.ppc.Bot.
#
# Your microservices extend and implement the event-driven inter... |
"""Local Attention Transformer models."""
from flax import nn
import jax.numpy as jnp
from lra_benchmarks.models.layers import common_layers
from lra_benchmarks.models.local import local_attention
class LocalTransformerBlock(nn.Module):
"""Transformer layer (https://openreview.net/forum?id=H1e5GJBtDr)."""
def ap... |
import os
import tensorflow as tf
from tensorflow.python.framework import ops
from tensorflow.python.framework import dtypes
import random
import numpy as np
import collections
from sklearn.cross_validation import KFold
class DataSet(object):
pass
def read_image_batches_without_labels_from_file_list(image... |
import urllib2
import xml.etree.ElementTree as ET
class OIMProjects(object):
oim_url = "https://my.opensciencegrid.org/miscproject/xml?count_sg_1&count_active=on&count_enabled=on"
wanted_attributes = ['Name', 'PIName', 'Organization', 'Department', 'FieldOfScience']
def __init__(self, url=No... |
# -*- coding: utf-8 -*-
from __future__ import absolute_import, print_function, division
import locale
from petl.util.base import Table
def fromxlsx(filename, sheet=None, range_string=None, row_offset=0,
column_offset=0, **kwargs):
"""
Extract a table from a sheet in an Excel .xlsx file.
... |
#!/usr/bin/python
# -*-coding:Utf-8 -*
import tweepy
import time
import MySQLdb as mdb
import datetime
import smtplib
import random
import numpy as np
import argparse
import json
def sendDirectMessage(api, follower, json_data):
print u'[' + time.strftime("%Y-%m-%d %H:%M") + u'] ' + u"Sending direct message to " + u... |
import os
import os.path as osp
import numpy as np
# `pip install easydict` if you don't have it
from easydict import EasyDict as edict
__C = edict()
cfg = __C
#
# CNTK parameters
#
__C.CNTK = edict()
# directories for web service:
__C.CNTK.TEMP_PATH = "./Temp" # temp folder for image processing - do not change
__C... |
# -*- coding: utf-8 -*-
# ckan -c /etc/ckan/default/ckan_cloud.ini envidattheme migrate-local
import click
import os
from pathlib import Path
import ckan.plugins.toolkit as toolkit
import ckan.model as model
import ckan.plugins as p
from ckanapi import LocalCKAN
from ckan.logic import NotFound
import hashlib
from c... |
import copy
from django.db import router
from django.db.models.query import QuerySet, insert_query, RawQuerySet
from django.db.models import signals
from django.db.models.fields import FieldDoesNotExist
from django.utils import six
from django.utils.deprecation import RenameMethodsBase
def ensure_default_manager(sende... |
from __future__ import absolute_import, division, print_function
import json
from csv import DictReader
from io import StringIO
from base64 import b64decode
from operator import itemgetter
from os.path import join, dirname, splitext, relpath
from dateutil.parser import parse as parse_datetime
from urllib.parse import ... |
from django.db import models
from edc_base.audit_trail import AuditTrail
from edc_base.model.fields import OtherCharField
from edc_base.model.models import BaseUuidModel
from edc_consent.models.base_consent import BaseConsent
from edc_consent.models.fields import (
PersonalFieldsMixin, CitizenFieldsMixin, ReviewFi... |
# -*- coding: utf-8 -*-
from south.utils import datetime_utils as datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding field 'ChecklistStep.order'
db.add_column(u'core_checkliststep',... |
from django.core.management.base import BaseCommand
from pay.models import Subscription, PayCard, CVV
from pay.realex import auth_payment
from pay.views import get_amount
from pay import app_settings
from datetime import datetime, date, timedelta
import time
def charge(s):
last_payment = s.user.payment_set.filter... |
from seal.lib.event_monitor import EventMonitor
from seal.lib import TIME_TICK
import time
import logging
logging.basicConfig(level=logging.DEBUG)
class HadoopEventMonitor(EventMonitor):
"""
Event monitor implementation to log information through the
Hadoop context.
"""
def __init__(self, event_cl... |
from nssdb import NssDb
class NssGroupDb(NssDb):
def __init__(self,options):
options['format'] = "%s:%s:%d:%s"
options['db-keys'] = { 0:".%s", 2:"=%d" }
NssDb.__init__(self,options) |
"""Kraken - objects.components.component_output_port module.
Classes:
ComponentOutputPort -- Component output port representation.
"""
from kraken.core.objects.scene_item import SceneItem
class ComponentOutputPort(SceneItem):
"""Component Output Object."""
def __init__(self, name, parent, dataType):
... |
import os
import shutil
import tempfile
import unittest
import yaml
from solar.core.resource import virtual_resource as vr
from solar.interfaces.db import get_db
db = get_db()
class BaseResourceTest(unittest.TestCase):
def setUp(self):
self.storage_dir = tempfile.mkdtemp()
def tearDown(self):
... |
import logging
import socket
from decouple import config as CONFIG
LOGGING_LEVEL = CONFIG('LOGGING_LEVEL', 'INFO')
LOCAL_DEV_ENV = CONFIG('LOCAL_DEV_ENV', False, cast=bool)
HOST_ID = socket.gethostname()
class AddHostID(logging.Filter):
def filter(self, record):
record.host_id = HOST_ID
return... |
"""Import related views."""
import csv
from django.contrib.auth.decorators import (
login_required, permission_required, user_passes_test
)
from django.core.urlresolvers import reverse
from django.db import transaction
from django.shortcuts import render
from django.utils.translation import ugettext as _
import ... |
from __future__ import absolute_import, print_function
import os
import sys
import pytest
from ..pyautoupdate.launcher import Launcher
@pytest.fixture(scope='function')
def create_update_dir(request):
"""Fixture that populates a downloads folder with a bunch of files,
including the project.zip file
""... |
"""VCTK speech synthesis dataset."""
import os
from absl import logging
import tensorflow.compat.v2 as tf
import tensorflow_datasets.public_api as tfds
_CITATION = """\
@misc{yamagishi2019vctk,
author={Yamagishi, Junichi and Veaux, Christophe and MacDonald, Kirsten},
title={{CSTR VCTK Corpus}: English Multi-speak... |
"""
Tests for granularity functions
"""
from datetime import datetime
import pytz
from nose.tools import eq_
from redis_gadgets import granularity as gr
class TestFiveMinute(object):
def test_arbitrary_time(self):
"""Can truncate a datetime to the nearest 5 miutes
"""
initial = datetime(2... |
#!/usr/bin/env python
#
# self-test: socat -x pty,link=/tmp/com1,raw,echo=0 pty,link=/tmp/com2,raw,echo=0
from math import ceil
from time import sleep
import socket
import sys
import os
import mimetypes
import queue
import logging
logging.basicConfig(level=logging.INFO, format="%(message)s")
logger = logging.getLogger... |
import logging
import re
import unittest
import unittest.mock
from test_muniments import test_helpers
logger = logging.getLogger(__name__)
@property
def real_module(self):
return re.sub(r'\.[^.]+', '', self.__module__.replace('test_', ''), 1)
class MetaTest(type):
real_module = real_module
def __init... |
import simplejson as json
import os
import pickle
import jsonpickle
import numpy
import pandas
from keras import datasets
from keras.models import model_from_json
from pandas import read_csv
from sklearn.model_selection import cross_validate, train_test_split, cross_val_predict
from sklearn.preprocessing import Imputer... |
"""
This module is essentially a broker to xmodule/tabs.py -- it was originally introduced to
perform some LMS-specific tab display gymnastics for the Entrance Exams feature
"""
from django.conf import settings
from django.utils.translation import ugettext as _
from django.utils.translation import ugettext_noop
from... |
import numpy as np
from scipy.special import factorial2 as fact2
from scipy.special import hyp1f1
def E(i,j,t,Qx,a,b):
''' Recursive definition of Hermite Gaussian coefficients.
Returns a float.
a: orbital exponent on Gaussian 'a' (e.g. alpha in the text)
b: orbital exponent on Gaussian 'b... |
# encoding: utf-8
'''Reserved tokens.'''
RESERVED = (
'abstract',
'alias',
'and',
'as',
'begin',
'break',
'byte',
'case',
'catch',
'class',
'clone',
'const',
'continue',
'declare',
'def',
'default',
'defined',
'descriptor',
'descriptors',
... |
"""
=======================================
Fit Hawkes kernel norms using cumulants
=======================================
This non parametric Hawkes cumulants matching
(`tick.hawkes.HawkesCumulantMatching`) algorithm estimates directly
kernels norms without making any assumption on kernel shapes.
It has been origin... |
from Config import JConfig
from Config import JConfigEnum
from Config import JConfigInt
from Config import JConfigString
from Config import JConfigHex
from Config import JConfigBool
from Config import JConfigTristate
from Item import JConfigItem
class Dialog:
def __init__(self):
pass
@staticmethod
... |
from window import aMSNWindow
class aMSNChatWindow(aMSNWindow):
""" This interface will represent a chat window of the UI
It can have many aMSNChatWidgets"""
def __init__(self, amsn_core):
"""
@type amsn_core: L{amsn2.core.amsn.aMSNCore}
"""
raise NotImplementedError
... |
from __future__ import absolute_import
try:
import pam
except ImportError:
pam = None
import PAM
from keystone import identity
def PAM_authenticate(username, password):
def _pam_conv(auth, query_list):
resp = []
for query, q_type in query_list:
if q_type in [PAM.PAM_PROM... |
from gourmet.i18n import _
from gourmet.plugin import ExporterPlugin
from . import pdf_exporter
PDF = _('PDF (Portable Document Format)')
class PdfExporterPlugin (ExporterPlugin):
label = _('PDF Export')
sublabel = _('Exporting recipes to PDF %(file)s.')
single_completed_string = _('Recipe saved as PDF ... |
import unittest
from katas.beta.how_much_hex_is_the_fish import fisHex
class FisHexTestCase(unittest.TestCase):
def test_equal_1(self):
self.assertEqual(fisHex('redlionfish'), 12)
def test_equal_2(self):
self.assertEqual(fisHex('pufferfish'), 1)
def test_equal_3(self):
self.asse... |
#!/usr/bin/env python
# -*- coding: utf-8 -*- #
from __future__ import unicode_literals
AUTHOR = 'Bg9'
SITENAME = 'CDW11 網頁 (虎尾科大MDE)'
SITEURL = 'http://cdw11-40323250.rhcloud.com/static/'
# 不要用文章所在目錄作為類別
USE_FOLDER_AS_CATEGORY = False
#PATH = 'content'
#OUTPUT_PATH = 'output'
TIMEZONE = 'Asia/Taipei'
DEFAULT_LAN... |
from .. utils import TranspileTestCase, BuiltinFunctionTestCase, BuiltinTwoargFunctionTestCase
class DivmodTests(TranspileTestCase):
pass
class BuiltinDivmodFunctionTests(BuiltinFunctionTestCase, TranspileTestCase):
functions = ["divmod"]
not_implemented = [
'test_bool',
'test_bytearray... |
import time
import threading
import shared
import Queue
from struct import unpack, pack
import hashlib
import random
import sys
import socket
from helper_generic import addDataPadding
from class_objectHashHolder import *
from addresses import *
# Every connection to a peer has a sendDataThread (and also a
# receiveDa... |
#!/usr/bin/env python2
# vim:fileencoding=UTF-8:ts=4:sw=4:sta:et:sts=4:ai
from __future__ import (unicode_literals, division, absolute_import,
print_function)
__license__ = 'GPL v3'
__copyright__ = '2009, Kovid Goyal <<EMAIL>>'
__docformat__ = 'restructuredtext en'
import re, codecs
ENCODIN... |
import os
import time
from django.utils import timezone
from paramiko import SSHClient
from watchdog.observers import Observer
class ServerError(Exception):
pass
def touch(fname, mode=0o666, dir_fd=None, **kwargs):
flags = os.O_CREAT | os.O_APPEND
with os.fdopen(os.open(fname, flags=flags, mode=mode, d... |
"""Test Improved User against Django's default backend"""
# pylint: disable=protected-access
from unittest.mock import patch
from django import VERSION as DjangoVersion
from django.contrib.auth import authenticate
from django.contrib.auth.backends import ModelBackend
from django.contrib.auth.hashers import MD5Password... |
import bs
import bsInternal
import bsTeamGame
from bsUI import PlayWindow, AddGameWindow, gSmallUI, gMedUI, gTitleColor, uiGlobals, gWindowStates
import bsUtils
_supports_auto_reloading = True
_auto_reloader_type = "patching"
PlayWindow__init__ = PlayWindow.__init__
PlayWindow_save_state = PlayWindow._save_state
PlayW... |
import os
import sys
import numpy as np
from giss.ncutil import copy_nc
import netCDF4
import argparse
from modele.constants import SHI,LHM,RHOI,RHOS,UI_ICEBIN,UI_NOTHING
parser = argparse.ArgumentParser(description='Convert GIC file for old snow/firn model to one for Stieglitz.')
parser.add_argument('igic',
help... |
from copy import deepcopy
import logging
from twobit.gitutil import GitHubOrg, IPoll
class GitHubOrgRepoPoller(IPoll):
""" A class to poll a GitHub Organization for repositories.
This class exposes a single method 'poll' that takes a callback
as a parameter. Each time poll is called the GitHubOrg object i... |
__author__ = 'Bohdan Mushkevych'
from subprocess import PIPE
import sys
import psutil
from psutil import TimeoutExpired
from launch import get_python, PROJECT_ROOT, PROCESS_STARTER
from synergy.system.utils import remove_pid_file, get_pid_filename
from synergy.conf import settings
def get_process_pid(process_name)... |
#!/usr/bin/python
import collections
import json
import re
import sys
def loadapi(fn):
with open(fn) as f:
return json.load(f, object_pairs_hook=collections.OrderedDict)
def resolvetype(p):
if "type" in p:
typ = p["type"]
if typ == "array":
typ = "[]" + resolvetype(p["i... |
import pytest
@pytest.fixture
def pypropep():
import pypropep
pypropep.init()
return pypropep
def test_simp_equilibrium(pypropep):
e = pypropep.Equilibrium()
return e.__str__()
def test_add_propellant(pypropep):
e = pypropep.Equilibrium()
o2 = pypropep.PROPELLANTS['OXYGEN (GAS)']
c... |
from __future__ import absolute_import
import distutils
import virtualenv as _virtualenv
from . import virtualenv_lib_path
from .path import Path
class VirtualEnvironment(object):
"""
An abstraction around virtual environments, currently it only uses
virtualenv but in the future it could use pyvenv.
... |
"""Support for Notion binary sensors."""
from typing import Callable
from homeassistant.components.binary_sensor import (
DEVICE_CLASS_CONNECTIVITY,
DEVICE_CLASS_DOOR,
DEVICE_CLASS_MOISTURE,
DEVICE_CLASS_SMOKE,
DEVICE_CLASS_WINDOW,
BinarySensorEntity,
)
from homeassistant.config_entries import ... |
from sklearn.cross_validation import cross_val_score
from sklearn.neighbors import KNeighborsClassifier
from sklearn.datasets import load_iris
import matplotlib.pyplot as plt
import numpy as np
from sklearn.pipeline import Pipeline
from sklearn.feature_extraction.text import CountVectorizer
from sklearn.svm import Lin... |
import requests
from lib.base import API_HOST
def GetScanList(config, customer_id=None, active_only=False):
"""
The template class for
Returns: An blank Dict.
Raises:
ValueError: On lack of key in config.
"""
results = {}
url = "https://{}/api/scan/v1/scans".format(API_HOST)
pa... |
#!/usr/bin/env python
try:
import simplejson as json
except ImportError:
import json
from urllib import urlencode, quote
from urlparse import urlsplit, urljoin
from time import time
import httplib
import logging
import os
handler = logging.StreamHandler()
handler.setFormatter(logging.Formatter('%(levelname)s... |
# -*- coding: utf-8 -*-
# flake8: noqa
RESOURCE_MAPPING = {
'gists_user': {
'resource': 'users/{username}/gists',
'doc': 'https://developer.github.com/v3/gists/#list-gists'
},
'gists': {
'resource': 'gists',
'doc': 'https://developer.github.com/v3/gists/#list-gists'
},
... |
__revision__ = "test/TEX/PDFLATEX.py rel_2.5.1:3735:9dc6cee5c168 2016/11/03 14:02:02 bdbaddog"
"""
Validate that we can set the PDFLATEX string to our own utility, that
the produced .dvi, .aux and .log files get removed by the -c option,
and that we can use this to wrap calls to the real latex utility.
"""
import Tes... |
"""
Gerrit Webhook
"""
__author__ = "JT Olds"
__author_email__ = "<EMAIL>"
GERRIT_URL = "http://gerrit.example.com/"
GERRIT_NAME = "Gerrit Code Review"
GERRIT_DESCRIPTION = ""
GERRIT_OWNER_NAME = "Admin"
GERRIT_OWNER_EMAIL = "<EMAIL>"
GERRIT_PORT = 29418
GERRIT_SERVER = "localhost"
WEBHOOK_URL = "http://webhook.e... |
from PyQt5.QtCore import QObject
from sakia.data.processors import CertificationsProcessor, BlockchainProcessor
class UserInformationModel(QObject):
"""
The model of HomeScreen component
"""
def __init__(self, parent, app, identity):
"""
:param sakia.gui.user_information.controller.U... |
"""
Copyright (c) 2013 Rodrigo Baravalle
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following... |
import datetime
from django_comments import CommentForm, get_model
from django.core.exceptions import ImproperlyConfigured
from django.contrib.contenttypes.models import ContentType
from django.conf import settings
from django.utils.encoding import force_text
from django.utils import timezone
from django import forms
... |
import platform
if platform.python_version_tuple() < ('2', '7'):
import ordereddict
OrderedDict = ordereddict.OrderedDict
else:
import collections
OrderedDict = collections.OrderedDict
if platform.python_version_tuple() < ('3', '0'):
from HTMLParser import HTMLParser
class MLStripper(HTMLParse... |
import collections
import sys
import urllib.parse
from wordpress_xmlrpc.compat import xmlrpc_client, dict_type
from wordpress_xmlrpc.exceptions import ServerConnectionError, UnsupportedXmlrpcMethodError, InvalidCredentialsError, XmlrpcDisabledError
class Client(object):
"""
Connection to a WordPr... |
"""Merge sort algorithm implementation
Basic idea is that input array is split into halves until base case is hit (array length equals 1) for all branches.
Then all branches from bottom to top are merged to form sorted sub-arrays
Expected performance: O(nlog(n)),
~ log(n) levels of recursion and ~ n operations done at ... |
# -*- coding: utf-8 -*-
'''
zen Add-on
Copyright (C) 2016 zen
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 v... |
"""Exposes the Python wrapper conversion to trt_graph."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import six as _six
# pylint: disable=unused-import,line-too-long
from tensorflow.contrib.tensorrt.wrap_conversion import add_test_value
from tensorflow... |
from __future__ import unicode_literals
# -*- coding: utf-8 -*-
from django.conf.urls import url
from django.core.urlresolvers import reverse_lazy
from django.utils.translation import ugettext as _
from wiki.core.plugins import registry
from wiki.core.plugins.base import BasePlugin
from wiki.plugins.links import setti... |
from flask.ext.testing import TestCase
from app import create_app
# from entry import app
import os
from database import db
from models.invengine import User, Invite
from testingdata import data
test_data = data()
TEST_SQLALCHEMY_DATABASE_URI = os.environ['DATABASE_URL']
print TEST_SQLALCHEMY_DATABASE_URI
class MyT... |
"""
Created on Jan 1, 2016
@author: Patrik Dufresne <<EMAIL>>
"""
import logging
import unittest
from rdiffweb.core.store import USER_ROLE
from rdiffweb.test import WebCase
class SettingsTest(WebCase):
login = True
def test_activities(self):
self.getPage("/graphs/activities/" + self.USERNAME + "/... |
""" Converts some lyx files to the latex format.
Note: everything in the file is thrown away until a section or the workd "stopskip" is found.
This way, all the preamble added by lyx is removed.
"""
from waflib import Logs
from waflib import TaskGen,Task
from waflib import Utils
from waflib.Configure import conf
def ... |
from django.db import models
class Event(models.Model):
title = models.CharField(max_length=255)
slug = models.SlugField(unique=True, db_index=True)
description = models.TextField(null=True, blank=True)
creation_date = models.DateTimeField(auto_now_add=True)
last_modification_date = models.DateTi... |
import socket
import sys
sys.path.append('./tls')
from tls0_cert import *
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
server_address = ('localhost', 11111)
sock.bind(server_address)
sock.listen(1)
svCert = Cert0()
f = open("./certs/svCert.json")
svCert.load(f)
f = open("./certs/svKey.json")
svKey = RsaPr... |
# -*- coding: utf-8 -*-
from tools.factories import generator_factory
import ctypes
basic_cases = [
[b'%s\n', None],
[b'% s\n', None],
[b'%0s\n', None],
[b'%+s\n', None],
[b'%-s\n', None],
[b'%#s\n', None],
[b'%10s\n', None],
[b'%.5s\n', None],
[b'%hhs\n', None],
[b'%lls\n', No... |
import pytest
import numpy as np
import pybinding as pb
from pybinding.repository import graphene
from pybinding.support.deprecated import LoudDeprecationWarning
lattices = {
"graphene-monolayer": graphene.monolayer(),
"graphene-monolayer-nn": graphene.monolayer(2),
"graphene-monolayer-4atom": graphene.mo... |
import re
import unicodedata
import operator
import mammoth
import html
import csv
import os
from .review import Review
from .reviewtrack import ReviewTrack
class ReviewParser:
reTrackSplit = re.compile(r",|&")
reReviewer = re.compile(r"[-]+([\w\s]+)")
def __init__(self, filename, rotation):
... |
import logging
from datetime import datetime, timedelta
import iso8601
import requests
from django.core.exceptions import ObjectDoesNotExist
from django.utils.html import strip_tags
from django.utils.text import slugify
from huey import crontab
from huey.contrib.djhuey import db_periodic_task
from .models import Reco... |
"""
Holds the plugin loader.
"""
__author__ = 'Jonny Lamb'
__copyright__ = 'Copyright © 2008 Jonny Lamb, Copyright © 2010 Jan Dittberner'
__license__ = 'MIT'
import logging
import os
import shutil
import sys
import tempfile
import traceback
from debian import deb822
import pylons
log = logging.getLogger(__name__)
... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.core.exceptions import ValidationError
from django.db import models
from django_fsm import FSMField, transition
BLACKLIST = ["Abusive Returner"]
class Order(models.Model):
customer = models.CharField(max_length=255)
address = models... |
import tempfile
import shutil
from twisted.trial import unittest
from twisted.internet import defer
from lbrynet.lbry_file.EncryptedFileMetadataManager import DBEncryptedFileMetadataManager
from lbrynet.core import utils
from lbrynet.cryptstream.CryptBlob import CryptBlobInfo
from lbrynet.core.Error import NoSuchStream... |
from __future__ import absolute_import, division, print_function, unicode_literals
import struct
import math
from bitcoinpy.lib.serialize import *
from bitcoinpy.lib.coredefs import *
from bitcoinpy.lib.core import *
from bitcoinpy.lib.hash import MurmurHash3
class CBloomFilter(object):
# 20,000 items with fp rat... |
import unittest
import builtins
import warnings
from test.support import run_unittest
import os
from platform import system as platform_system
class ExceptionClassTests(unittest.TestCase):
"""Tests for anything relating to exception objects themselves (e.g.,
inheritance hierarchy)"""
def test_builtins_n... |
"""This module provides web browser support, realized with QtWebKit Module based on WebKit engine.
You can find documentation on WebKit at http://webkit.org/ .
The class is "webWidget", which is used to create an interface to web pages navigation. It imports an interface gui for manage URL page changes, has trace of ... |
# -*- coding: utf-8 -*-
"""
Tests for file.py
"""
import os
from datetime import datetime
from io import StringIO
import ddt
from django.core import exceptions
from django.core.files.uploadedfile import SimpleUploadedFile
from django.http import HttpRequest
from django.test import TestCase
from django.utils.timezone i... |
import bpy
class BooleanMethods:
def boolean_adaptive(self):
ob1 = bpy.context.object
ob1.select_set(False)
obs = list(bpy.context.selected_objects)
ob2 = obs.pop()
if obs:
if self.is_overlap:
self.mesh_prepare(ob2, select=True)
... |
from telemetry.core import exceptions
class InspectorRuntime(object):
def __init__(self, inspector_websocket):
self._inspector_websocket = inspector_websocket
self._inspector_websocket.RegisterDomain('Runtime', self._OnNotification)
self._contexts_enabled = False
self._max_context_id = None
def _... |
# coding=utf-8
from __future__ import unicode_literals
from ..address import Provider as AddressProvider
class Provider(AddressProvider):
city_formats = ('{{city_name}}', )
street_name_formats = ('{{street_name}}', )
street_address_formats = ('{{street_name}} {{building_number}}', )
address_formats ... |
# nhdplusexample02.py
#
# David J. Lampert (<EMAIL>)
#
# Shows how to use the NHDPlusDelineator to delineate the watershed for a point
# within a HUC8. Assumes the NHDPlus Hydrography data exist already. This
# example delineates the watershed for the location of the discontinued flow
# gage at Hunting Creek, MD.
imp... |
"""
This file takes a CoQA data file as input and generates the input files for training the pipeline model.
"""
import argparse
import json
import re
import time
import string
from pycorenlp import StanfordCoreNLP
nlp = StanfordCoreNLP('http://localhost:9000')
UNK = 'unknown'
def _str(s):
""" Convert PTB ... |
import json
from functools import wraps
from pkg_resources import resource_stream
from twisted.internet import reactor
from twisted.internet.defer import inlineCallbacks
from twisted.internet.protocol import Protocol, Factory
from twisted.trial.unittest import TestCase
from vumi.tests.helpers import VumiTestCase
from ... |
import numpy as np
import matplotlib.pyplot as plt
from scipy import stats
import sys
from astropy.io import ascii
from sklearn.metrics import median_absolute_error, mean_squared_error
def main(tilename, filter=None):
filters = ['g', 'r', 'i', 'z']
if filter:
cat = ascii.read('{}{}_cal.cat'.format(ti... |
import concurrent
import os
import re
from typing import IO, Dict, Iterable, List, Optional, Tuple, Union, cast
from pygments import highlight # type: ignore
from pygments.formatter import Formatter # type: ignore
from pygments.lexers import get_lexer_for_filename # type: ignore
from pygments.util import ClassNotFo... |
# coding: utf-8
#!/usr/bin/env python
__author__ = 'Viktor Dmitriyev'
__copyright__ = 'Copyright 2015, Viktor Dmitriyev'
__credits__ = ['Viktor Dmitriyev']
__license__ = 'MIT'
__version__ = '1.0.0'
__maintainer__ = '-'
__email__ = ''
__status__ = 'dev'
__date__ = '26.01.2015'
__description__ = 'Helper for the crawler ... |
"""
Utility functions for parsing and manipulating JavaStackTrace field
contents.
"""
from more_itertools import peekable
class JavaException(object):
def __init__(self, exception_class, exception_message, stack, additional):
self.exception_class = exception_class
self.exception_message = excepti... |
import re
import sys
import json
import time
import ConfigParser
from intelmq.lib.message import Event
from intelmq.lib.pipeline import Pipeline
from intelmq.lib.utils import decode, log
SYSTEM_CONF_FILE = "/opt/intelmq/etc/system.conf"
PIPELINE_CONF_FILE = "/opt/intelmq/etc/pipeline.conf"
RUNTIME_CONF_FI... |
"""Define and create directories with appropriate permissions on OneFS."""
from __future__ import absolute_import
from __future__ import unicode_literals
import logging
import posixpath
import isilon_hadoop_tools.onefs
from isilon_hadoop_tools import IsilonHadoopToolError
__all__ = [
# Exceptions
'Directori... |
#! /usr/bin/env python
import os
import cmd
import readline
import datetime
from csv import *
from tqdm import tqdm
from tabulate import tabulate
from pyfiglet import Figlet
from isbntools.app import meta
from tinydb import TinyDB, Query
from fuzzywuzzy import fuzz, process
from tinydb.operations import delete
from col... |
# -----------------------------------------------------------------------------
# Imports:
# -----------------------------------------------------------------------------
from dpa.action import Action
from dpa.ptask.area import PTaskArea, PTaskAreaError
from dpa.ptask.spec import PTaskSpec
# ------------------------... |
""" The table model contains all the reduction information which is provided via the data table
The main information in the table model are the run numbers and the selected periods. However it also contains
information regarding the custom output name and the information in the options tab.
"""
from __future__ impor... |
#
# test cases for new-style fields
#
from datetime import date, datetime
from collections import defaultdict
from openerp.exceptions import AccessError, except_orm
from openerp.tests import common
from openerp.tools import mute_logger
class TestNewFields(common.TransactionCase):
def test_00_basics(self):
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.