content stringlengths 4 20k |
|---|
import pytest
import io
import json
import aiohttpretty
from waterbutler.core import streams
from waterbutler.core import exceptions
from waterbutler.providers.figshare import metadata
from waterbutler.providers.figshare import provider
@pytest.fixture
def auth():
return {
'name': 'cat',
'emai... |
from __future__ import with_statement
from smugpy import SmugMug, SmugMugException
from . import smugpy
import sys
import unittest
API_KEY = "XXXXXXXXXXXXXXXXXXXXXXXXX"
OAUTH_SECRET = "YYYYYYYYYYYYYYYYYYYYYYYY"
class TestApi(unittest.TestCase):
def setUp(self):
self.smugmug = SmugMug(api_key=... |
"""
Management utility to create superusers.
"""
import getpass
import re
import sys
from optparse import make_option
from django_mongoengine.mongo_auth.models import MongoUser
from django_mongoengine.sessions import DEFAULT_CONNECTION_NAME
from django.core import exceptions
from django.core.management.base import Bas... |
'''
Created on Feb 5, 2014
@author: Tea Kolevska
@contact: <EMAIL>
@organization: ICCLab, Zurich University of Applied Sciences
@summary: Initialize the database.
'''
import sys
import os
sys.path.append(os.path.abspath(os.path.join(os.path.dirname( __file__ ), '..', 'os_api')))
import ceilometer_api
import compute_... |
import sys, pexpect, time, os, re
# default autotest, used to run most tests
# waits for "Test OK"
def default_autotest(child, test_name):
child.sendline(test_name)
result = child.expect(["Test OK", "Test Failed",
"Command not found", pexpect.TIMEOUT], timeout = 900)
if result == 1:
return -1, "Fail"
elif resu... |
import unittest
import pymel.core as pm
from lib import joints
from lib import errors
class TestJoints(unittest.TestCase):
def setUp(self):
pm.newFile(force=True)
self.joints = []
self.joints.append(pm.joint(p=(0, 0, 0)))
self.joints.append(pm.joint(p=(0, 1, 0)))
self.join... |
import os
import re
def timeStepExists(istep, outpath):
for file in os.listdir(outpath):
if file.endswith(".%05d.vtk" % istep):
return True
return False
def listTimeSteps(path):
files = []
tsteps = []
for file in os.listdir(path):
ret = re.search('XDMF\.([0-9]{1,})\.xm... |
"""Custom loader."""
from collections import OrderedDict
import fnmatch
import logging
import os
import sys
from typing import Dict, Iterator, List, TextIO, TypeVar, Union, overload
import yaml
from homeassistant.exceptions import HomeAssistantError
from .const import _SECRET_NAMESPACE, SECRET_YAML
from .objects imp... |
from oslo_config import cfg
from oslo_log import log as logging
from oslo_serialization import jsonutils
from oslo_utils import encodeutils
import six
import webob.exc
from wsme.rest import json
from glance.api import policy
from glance.api.v2 import metadef_namespaces as namespaces
from glance.api.v2.model.metadef_ob... |
import a10_neutron_lbaas
from neutron.db import l3_db
from neutron.openstack.common import log as logging
from neutron.plugins.common import constants
from neutron_lbaas.db.loadbalancer import loadbalancer_db as lb_db
from neutron_lbaas.services.loadbalancer.drivers import abstract_driver
VERSION = "1.0.0"
LOG = logg... |
"""Package info."""
__version__ = (0, 7, 0)
__requires__ = []
__all__ = [
'name', 'version', 'short_description', 'description',
'author', 'author_email', 'copyright', 'license_type',
'website', 'website_label',
]
name = 'worldmap'
version = '.'.join(map(str, __version__)) + '.dev'
short_description = '... |
# -*- coding: utf-8 -*-
import os
import numpy as np # Les outils mathématiques
import CoolProp.CoolProp as CP # Les outils thermodynamiques
import matplotlib.pyplot as plt # Les outils graphiques
def isothermes_d_andrews(fluide, dico={}):
""" Dessines les isothermes d'Andrews pour le fluide dem... |
"""
Number letter counts
Problem 17: https://projecteuler.net/problem=17
If the numbers 1 to 5 are written out in words: one, two, three, four, five,
then there are 3 + 3 + 5 + 4 + 4 = 19 letters used in total.
If all the numbers from 1 to 1000 (one thousand) inclusive were written out in
words, how many letters woul... |
from __future__ import print_function
import os
import os.path as op
import numpy as np
import warnings
from shutil import copyfile
from scipy import sparse
from nose.tools import assert_true, assert_raises
from numpy.testing import assert_array_equal, assert_allclose, assert_equal
from mne.datasets import testing
fro... |
import syslog
import subprocess
import time, os, sys
from struct import *
from knockknock.Profile import Profile
from LogEntry import LogEntry
from MacFailedException import MacFailedException
class KnockWatcher:
def __init__(self, config, logFile, profiles, portOpener):
self.config = config
... |
from logging import getLogger
from datetime import datetime
from sdcm.utils.cloud_monitor.common import InstanceLifecycle, NA
from sdcm.utils.cloud_monitor.resources import CloudInstance, CloudResources
from sdcm.utils.common import aws_tags_to_dict, gce_meta_to_dict, list_instances_aws, list_instances_gce
from sdcm.u... |
import sys
from unittest import TestCase
class TestImports(TestCase):
"""Test Imports - the quickest test to ensure that we haven't
introduced version-incompatible syntax errors."""
def test_toplevel(self):
"""test toplevel import"""
import zmq
def test_core(self):
"""test cor... |
"""
Reading, writing and converting configuration in different representations
"""
from __future__ import print_function, absolute_import # Compatibility with python 2 and 3
import os, numpy, tempfile, copy
try:
import ConfigParser as configparser
except ImportError:
# In Python 3, configparser needs to be ins... |
# -*- 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 model 'AggregatedResults'
db.create_table(u'miner_aggregatedresu... |
#!/usr/bin/env python
"""
port-alldeps package ...
lists all dependencies of Macports packages -- 1st 2nd 3rd level ...
by repeatedly calling "port deps".
Example:
port deps pandoc ->
pandoc has build dependencies on:
ghc
haddock
pandoc has library dependencies on:
... |
import numpy as np
import dipsim.util as util
class Illuminator:
"""An Illuminator is specified by its illumination type (wide, sheet),
optical axis, numerical aperture, index of refraction of the sample, and
polarization.
"""
def __init__(self, illum_type='wide', theta_optical_axis=0, na=0.8,
... |
"""Test utilities for tf.data functionality."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import re
from tensorflow.python.data.util import nest
from tensorflow.python.eager import context
from tensorflow.python.framework import errors
from tensorflow... |
import logging
import sqlite3
from logging import Logger
from sqlite3 import Connection
from typing import Optional
from slack_sdk.oauth.installation_store.async_installation_store import (
AsyncInstallationStore,
)
from slack_sdk.oauth.installation_store.installation_store import InstallationStore
from slack_sdk.... |
import unittest
import os
import sys
sys.path.insert(1, os.path.abspath('..'))
import burnman
from util import BurnManTest
from burnman.nonlinear_fitting import *
class test_fitting(BurnManTest):
def test_linear_fit(self):
# Test from Neri et al. (Meas. Sci. Technol. 1 (1990) 1007-1010.)
i, x, W... |
from conans import ConanFile, CMake, tools
class CapstoneConan(ConanFile):
name = "capstone"
version = "4.0.1"
license = "BSD-3-Clause"
description = "Capstone is a disassembler framework for almost every platform"
topics = ("disassembler", "arm", "x86_64", "x86", "arm64", "bpf", "riscv",
... |
#!/usr/bin/env python
from __future__ import print_function
# Copyright (c) 2015 Intel Corporation.
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the
# "Software"), to deal in the Software without restriction, including
# without ... |
from __future__ import unicode_literals
from datetime import time
from flask import request
from markupsafe import escape
from wtforms.fields import BooleanField, HiddenField, SelectField, StringField, TextAreaField
from wtforms.fields.html5 import IntegerField
from wtforms.validators import DataRequired, NumberRange... |
import os
import sys
import re
import yaml
import uuid
import glob
from lib.tarantool_server import TarantoolServer
## Get cluster uuid
cluster_uuid = ''
try:
cluster_uuid = yaml.load(server.admin("box.space._schema:get('cluster')",
silent = True))[0][1]
uuid.UUID('{' + cluster_uuid + '}')
print 'o... |
import json
import logging
import os
import re
import requests
import sys
import time
import uuid
from cattle import Config
from cattle import type_manager
from cattle import utils
from cattle.agent import Agent
from cattle.lock import FailedToLock
from cattle.plugins.core.publisher import Publisher
from cattle.concur... |
# -*- coding:utf-8 -*-
import json
import logging
import os
from tornado import gen
from tornado.gen import coroutine, Task
from tornado.httpclient import AsyncHTTPClient
from tornado.ioloop import IOLoop
from tornado.web import RequestHandler
from core import settings
import constant
__author__ = 'george'
@corout... |
import os
from trezorlib import coins, tx_api
from ..support.tx_cache import tx_cache
TxApiBitcoin = coins.tx_api["Bitcoin"]
TxApiTestnet = tx_cache("Testnet", allow_fetch=False)
TxApiZencash = coins.tx_api["Zencash"]
TxApiDash = tx_cache("Dash", allow_fetch=False)
tests_dir = os.path.dirname(os.path.abspath(__file... |
"""STC interface for accessing data in hyperspectral cubes
Hyperspectral images are very large and need a special implementation of the
STC interface to prevent the entire cube from being loaded into memory at once.
"""
import os, sys, re, glob
import peppy.vfs as vfs
from peppy.debug import *
from peppy.stcinterfa... |
from __future__ import print_function
import argparse
import logging
import imp
import os
import sys
from . import logger
from . import plugin
from . import nmea # noqa
from .api import BoatdHTTPServer, BoatdRequestHandler
from .behaviour import Behaviour
from .behaviour import BehaviourManager
from .boat import Boa... |
import ast
import unittest
from ..collector import Collector
from .. import node
from . import get_asset_path
class TestCollector(unittest.TestCase):
def setUp(self):
self.example = '''
class OuterClass(object):
def method0(self):
return 0
def method1(self):
if a:
... |
from __future__ import unicode_literals
from __future__ import print_function
from __future__ import division
from __future__ import absolute_import
from future import standard_library
standard_library.install_aliases()
from builtins import *
from builtins import object
import urllib.request, urllib.parse, urllib.error... |
import testenv; testenv.simple_setup()
from sqlalchemy import *
from sqlalchemy.orm import *
from timeit import Timer
import sys
meta = MetaData()
orders = Table('orders', meta,
Column('id', Integer, Sequence('order_id_seq'), primary_key = True),
)
items = Table('items', meta,
Column('id', Integer, Sequence(... |
{
'name': 'Calendar',
'version': '1.0',
'depends': ['base', 'mail', 'base_action_rule', 'web_calendar'],
'summary': 'Personal & Shared Calendar',
'description': """
This is a full-featured calendar system.
========================================
It supports:
------------
- Calendar of events
... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
try:
from setuptools import setup
except ImportError:
from distutils.core import setup
with open('README.rst') as readme_file:
readme = readme_file.read()
with open('requirements.txt') as req_file:
requirements = req_file.read().split('\n')
with open('... |
from . import num_reader
import sys
import math
class Parser(num_reader.NumReader):
def __init__(self, writer):
num_reader.NumReader.__init__(self, writer)
self.x = 0
self.y = 0
self.z = 10000
self.f = 0
self.units_to_mm = 0.01
def ParseV(self):
... |
"""Primitives for dealing with datastore indexes.
Example index.yaml file:
------------------------
indexes:
- kind: Cat
ancestor: no
properties:
- name: name
- name: age
direction: desc
- kind: Cat
properties:
- name: name
direction: ascending
- name: whiskers
direction: descending
- kin... |
"""
Tests that the file header is properly handled or inferred
during parsing for all of the parsers defined in parsers.py
"""
from collections import namedtuple
from io import StringIO
import numpy as np
import pytest
from pandas.errors import ParserError
from pandas import DataFrame, Index, MultiIndex
import pand... |
from django.core.exceptions import ObjectDoesNotExist
from django.core.urlresolvers import reverse
from django.db import models
from django.utils.functional import cached_property
from django.utils.translation import ugettext_lazy as _
from judge.judgeapi import judge_submission, abort_submission
from judge.models.pro... |
from __future__ import unicode_literals
import frappe
from frappe import _, scrub
from frappe.utils import flt
from frappe.model.document import Document
import json
class PaymentTool(Document):
def make_journal_entry(self):
from erpnext.accounts.utils import get_balance_on
total_payment_amount = 0.00
jv = fra... |
__version__=''' $Id: pdfimages.py 3959 2012-09-27 14:39:39Z robin $ '''
__doc__="""
Image functionality sliced out of canvas.py for generalization
"""
import os
import string
import reportlab
from reportlab import rl_config
from reportlab.pdfbase import pdfutils
from reportlab.pdfbase import pdfdoc
from reportlab.lib.... |
"""
from dashie_sampler import DashieSampler
import random
import requests
import collections
import re
import datetime
class ConfluenceReleaseNumberSampler(DashieSampler):
def name(self):
return 'releasenumber'
def sample(self):
wikiHome = requests.get("https://nhss-confluence.bjss.co.uk/d... |
import logging
import math
import weka.plot as plot
if plot.matplotlib_available:
import matplotlib.pyplot as plt
from weka.experiments import ResultMatrix
# logging setup
logger = logging.getLogger(__name__)
def plot_experiment(mat, title="Experiment", axes_swapped=False, measure="Statistic", show_stdev=False,
... |
"""
owtf.api.handlers.auth
~~~~~~~~~~~~~~~~~~~~~~~~
"""
from sqlalchemy.sql.functions import user
from owtf.models.user_login_token import UserLoginToken
from owtf.api.handlers.base import APIRequestHandler
from owtf.lib.exceptions import APIError
from owtf.models.user import User
from datetime import datetime, timede... |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import datetime
import unittest
from airflow import configuration, DAG
from airflow.contrib.operators import mlengine_operator_utils
from airflow.contrib.operators.mlengine_operator_utils import create_evaluat... |
from flask_wtf import FlaskForm
from wtforms import PasswordField, SubmitField, validators, TextField
from wtforms.fields.html5 import EmailField
class RegistrationForm(FlaskForm):
email = EmailField('email', validators = [validators.DataRequired(), validators.Email()])
password = PasswordField('password', val... |
from django import forms
import django
import os
from django.shortcuts import get_object_or_404, render_to_response
import probedb.resultdb2.models as Results
import probedb.probedata2.models as ProbeData
from django.db import connection
from django.db.models import Q
from django.http import HttpResponse
result_summa... |
#!/usr/bin/env python
# -*- coding:utf-8 -*-
#
# E-mail : <EMAIL>
# Desc : 粘贴代码插件
#
from plugins import BasePlugin
class PastePlugin(BasePlugin):
code_typs = ['actionscript', 'ada', 'apache', 'bash', 'c', 'c#', 'cpp',
'css', 'django', 'erlang', 'go', 'html', 'java', 'javascript',
... |
import logging
log = logging.getLogger("subiquity.models.ssh")
class SSHModel:
def __init__(self):
self.install_server = False
self.authorized_keys = None
self.pwauth = True
# Although the generated config just contains the key above,
# we store the imported id so that w... |
import xbmc
import os
import sys
import xbmcaddon
import xbmcgui
import time
import subprocess
import urllib2
addon = xbmcaddon.Addon()
addonname = addon.getAddonInfo('name')
addon_dir = xbmc.translatePath( addon.getAddonInfo('path'))
sys.path.append(os.path.join( addon_dir, 'resources', 'lib' ) )
new_hyperion... |
from weboob.capabilities.dating import ICapDating
from weboob.tools.application.qt import QtApplication
from .main_window import MainWindow
class QHaveDate(QtApplication):
APPNAME = 'qhavedate'
VERSION = '0.h'
COPYRIGHT = 'Copyright(C) 2010-2012 Romain Bignon'
DESCRIPTION = "Qt application allowing t... |
from django.conf import settings
from django.utils.translation import ugettext_lazy as _
import horizon
from openstack_dashboard.dashboards.admin import dashboard
class Routers(horizon.Panel):
name = _("Routers")
slug = 'routers'
img = '/static/dashboard/img/nav/routers1.png'
permissions = ('opensta... |
#!/usr/bin/env python
import json
import logging
import requests
import multiprocessing
import threading
import time
import itertools
from django.conf import settings
from django.db import transaction
from django.utils import timezone
from django.db import connection as db_connection
import pika
from pika.exceptions ... |
from collections import namedtuple
_SongRecord = namedtuple('SongRecord',
['album', 'artist', 'genre', 'year', 'path'])
def SongRecord(album=None, artist=None, genre=None, year=None, path=None):
return _SongRecord(album, artist, genre, year, path) |
from bigdl.nn.layer import *
from bigdl.nn.criterion import *
from bigdl.optim.optimizer import *
from bigdl.util.common import *
from bigdl.nn.initialization_method import *
from bigdl.dataset import movielens
import numpy as np
import unittest
import tempfile
class TestWorkFlow(unittest.TestCase):
def setUp(sel... |
import binascii
import email.charset
import email.message
import email.errors
from email import quoprimime
class ContentManager:
def __init__(self):
self.get_handlers = {}
self.set_handlers = {}
def add_get_handler(self, key, handler):
self.get_handlers[key] = handler
def get_con... |
from openerp.osv import fields, osv
from openerp.tools.translate import _
class account_account(osv.Model):
_inherit = "account.account"
def _get_financial_catalog_selection (self, cr, uid, context=None):
bt_obj = self.pool.get('base.element')
return bt_obj.get_as_selection(cr, uid, 'PE.S... |
'''OpenGL extension NV.fragment_program2
This module customises the behaviour of the
OpenGL.raw.GL.NV.fragment_program2 to provide a more
Python-friendly API
Overview (from the spec)
This extension, like the NV_fragment_program_option extension, provides
additional fragment program functionality to extend the s... |
#!/usr/bin/env python
import subprocess
import os
import glob
from distutils.core import setup
from distutils.command.install import install
from elbepack.version import elbe_version
def abspath(path):
"""A method to determine absolute path
for a relative path inside project's directory."""
return os.path.... |
import copy
from kpm.manifest_chart import ManifestChart
from kpm.formats.kub_base import KubBase
from kpm.platforms.helm import Helm
class Chart(KubBase):
media_type = "helm"
platform = "helm"
@property
def manifest(self):
if self._manifest is None:
self._manifest = ManifestChar... |
"""Subcommand for importing translations."""
import os
import click
from grow.commands import shared
from grow.common import rc_config
from grow.pods import pods
from grow import storage
CFG = rc_config.RC_CONFIG.prefixed('grow.translations.import')
@click.command(name='import')
@shared.pod_path_argument
@click.op... |
from js9 import j
def install(job):
from zeroos.orchestrator.configuration import get_jwt_token
job.context['token'] = get_jwt_token(job.service.aysrepo)
job.service.executeAction('start', context=job.context)
def start(job):
from zeroos.orchestrator.sal.ZeroStor import ZeroStor
from zeroos.orc... |
# This file helps to compute a version number in source trees obtained from
# git-archive tarball (such as those provided by githubs download-from-tag
# feature). Distribution tarballs (built by setup.py sdist) and build
# directories (produced by setup.py build) will contain a much shorter file
# that just contains th... |
__author__ = '<EMAIL> (Takashi MATSUO)'
try:
from xml.etree import cElementTree as ElementTree
except ImportError:
try:
import cElementTree as ElementTree
except ImportError:
try:
from xml.etree import ElementTree
except ImportError:
from elementtree import ElementTree
import urllib
impor... |
"""Helper functions used in many modules
"""
from __future__ import print_function
from matplotlib import pyplot as plt
from numpy.linalg import svd
from numpy import *
def xy2ij(shp, ni):
out = zeros(shp.shape)
out[:, 1] = shp[:, 0]
out[:, 0] = ni - shp[:, 1]
return out
def pca(data, frac=1):
""... |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import numpy as np # type: ignore
import onnx
from ..base import Base
from . import expect
class Mean(Base):
@staticmethod
def export(): # type: () -> None
... |
from django.core.management.base import BaseCommand, CommandError
from main.models import Effect, EffectElement, Space, System, Wormhole
import json
import re
import requests
class Command(BaseCommand):
def handle(self, *args, **kwargs):
# target = 'https://static.eve-apps.com/js/combine.json'
... |
from setuptools import setup
setup(
name='beets-bandcamp',
version='0.1.4',
description='Plugin for beets (http://beets.io) to use bandcamp as an autotagger source.',
long_description=open('README.rst').read(),
author='Ariel George',
author_email='<EMAIL>',
url='https://github.com/unrblt/be... |
"""
The logging options for yagmail. Note that the logger is set on the SMTP class.
The default is to only log errors. If wanted, it is possible to do logging with:
yag = SMTP()
yag.setLog(log_level = logging.DEBUG)
Furthermore, after creating a SMTP object, it is possible to overwrite and use your own logger by:
y... |
"""
Django settings for eatuxchallenge project.
Generated by 'django-admin startproject' using Django 1.9.1.
For more information on this file, see
https://docs.djangoproject.com/en/1.9/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.9/ref/settings/
"""
impor... |
import numpy as np
from astropy import convolution
def muldata(data,mul):
"""
muldata(data,mul)
Multiplies data with a given multiplier, and returns the result.
Parameters
----------
data : numpy.ndarray
The data to multiply
mul : float
The multiplier to multiply the data with
Returns
----... |
from .submaker import Submaker
import logging
import os
import sqlite3
from inception.common.database import Database
logger = logging.getLogger(__name__)
class DatabasesSubmaker(Submaker):
def make(self, workDir):
allSettings = self.getValue(".", {})
for name, dbData in allSettings.items():
... |
#!/usr/bin/env python3
"""
An MQTT service note which provides a persistant counter source.
"""
import sys
import os
import re
import time
import threading
import json
import sqlite3
import paho.mqtt.client as mqtt
import Flask
def topicJoin(*args):
return "/".join(args)
def stripSQLWhitespace(text):
"Attemp... |
import datetime
from django.db import models
from django.contrib.auth.models import User
class ModelOrigin(models.Model):
"""
This is the common part for each models
Used to track the origin of the data
"""
date_created = models.DateTimeField(default=datetime.datetime.now)
last_edit = models.... |
from toee import *
import char_class_utils
###################################################
def GetConditionName(): # used by API
return "Arcane Archer"
def GetSpellCasterConditionName():
return "Arcane Archer Spellcasting"
def GetCategory():
return "Core 3.5 Ed Prestige Classes"
def GetClassDefinitionFlags(... |
from collections import OrderedDict
from typing import Dict, Type
from .base import FeedMappingServiceTransport
from .grpc import FeedMappingServiceGrpcTransport
# Compile a registry of transports.
_transport_registry = (
OrderedDict()
) # type: Dict[str, Type[FeedMappingServiceTransport]]
_transport_registry["... |
"""\
=========
AIM Login
=========
This component logs into to AIM with the given screenname and password. It then
sends its logged-in OSCAR connection out of its "signal" outbox, followed by a
list of any non-login-related messages it has received.
Example Usage
-------------
Login and wire the resulting OSCARClie... |
#!/usr/bin/env python3
"""
Skaff is a Python library for building programming language dependent
scaffolding of software projects, and a command-line tool that uses this
library with built-in (CMake-based) C/C++ support.
"""
# -------------------------------- COPYRIGHT ----------------------------------
# Copyright ©... |
# -*- coding: utf-8 -*-
from __future__ import absolute_import, print_function
import logging
from mock import patch
from django.conf import settings
from sentry.app import tsdb
from sentry.constants import MAX_CULPRIT_LENGTH, DEFAULT_LOGGER_NAME
from sentry.event_manager import (
EventManager, EventUser, get_... |
import numpy as np
import pycuda.driver as drv
from nervanagpu import NervanaGPU
from pycuda.autoinit import context
from scikits.cuda import cublas
print(context.get_device().name())
start, end = (drv.Event(), drv.Event())
handle = cublas.cublasCreate()
def cublas_dot(A, B, C, alpha=1.0, beta=0.0, repeat=1):
... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import sys
import logging
import getpass
from optparse import OptionParser
import sleekxmpp
import subprocess
from commands.system_commands import *
# Python versions before 3.0 do not use UTF-8 encoding
# by default. To ensure that Unicode is handled properly
# through... |
# -*- coding: utf-8 -*-
# Автор: Гусев Илья
# Описание: Словарь.
import pickle
from collections import Counter
from typing import List, Dict
class WordVocabulary:
def __init__(self):
self.words = [] # type: List
self.word_to_index = {} # type: Dict
self.counter = Counter() # type: Coun... |
#!/usr/bin/env python
'''
This file takes Reddy and Sharoff, 2011 tagger's output and split the tags into vert columns
'''
import sys
import re
def tag2letter(tag):
if re.match("NEG", tag):
return "x"
elif re.match("^[JNV]", tag):
return tag[0].lower()
elif re.match("RB", tag):
ret... |
from TestCase import TestCase
import NetworkEventHandler as NEH
import Log
class case214 (TestCase):
def config(self):
self.name = "Case 214"
self.description = "Unknown Content-Type"
self.isClient = True
self.transport = "UDP"
def run(self):
self.neh = NEH.NetworkEventHandler(self.transport)
inv = se... |
#!/usr/bin/python
import os
import os.path
fileDir = "D:\\tmp\\XXXX"
# destDrama = "??"
uselessWord = "a67手机电影a67.com"
uselessWords = ["a67手机电影a67.com", "zuiben手机电影zuiben.com", "[hd480p]"]
curDir = os.getcwd()
# curDirInfo = os.walk(curDir)
# fileDirInfo = os.walk(fileDir)
parseDir = fileDir
parseDirInfo = os.walk(... |
"""
Proposal Target Operator selects foreground and background roi and assigns label, bbox_transform to them.
"""
import mxnet as mx
import numpy as np
from distutils.util import strtobool
class BoxAnnotatorOHEMOperator(mx.operator.CustomOp):
def __init__(self, num_classes, num_reg_classes, roi_per_img):
... |
# -*- coding: utf-8 -*-
"""
Created on Jul 27, 2012
@author: lucien
"""
import os
import re
from ..formats import eaf
# orthographic correspondences
_SPELLING = [ # steps required to prevent transitive ʃ → x → j → y
{"ʒ": "y", # ʒ
"j": "y", # j
"ʲ": "y", # sup j → y
"ʑ": "y",
"ʤ": "dy",
... |
from django.db import models, transaction
from django.db.utils import OperationalError
from django.utils.translation import ugettext as _, ugettext_lazy
from django.utils.safestring import mark_safe
from django.dispatch import receiver
from django.db.models.signals import post_migrate
from translate.lang.data import l... |
# coding: utf-8
import datetime
from django.core.management.base import BaseCommand
from time_logger.mysql_logs_parser_from_file import MysqlSlowQueriesParser
from time_logger import models_mongo
class Command(BaseCommand):
help = 'Improt mysql slow query log from file to mongodb'
def add_arguments(self, pa... |
import json
from base64 import b64decode
from datetime import datetime
from email.utils import mktime_tz, parsedate_tz
from email.mime.base import MIMEBase
from email.encoders import encode_base64
__version__ = '1.1.0'
# Version synonym
VERSION = __version__
class PostmarkInbound(object):
def __init__(self, *... |
"""
The :mod:`songbeamerimport` module provides the functionality for importing
SongBeamer songs into the OpenLP database.
"""
import chardet
import codecs
import logging
import os
import re
from openlp.plugins.songs.lib import VerseType
from openlp.plugins.songs.lib.songimport import SongImport
log = logging.getLog... |
import JobTracker
import logging
import time
class Runner(object):
def __init__(self, Config, MysqlConnector=None, Influx=None):
self.logger = logging.getLogger('influx_sql_connector')
if (MysqlConnector is None or Influx is None):
raise ValueError('Missing connection to database')
... |
"""
The MIT License
Copyright (c) 2008 Gilad Raphaelli <<EMAIL>>
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify,... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('events', '0005_auto_20150607_2005'),
]
operations = [
migrations.AlterField(
model_name='event',
nam... |
import os
from string import Template
from textwrap import dedent
class PackageManagerTemplateAptGet:
"""
apt-get configuration file template
"""
def __init__(self):
self.host_header = dedent('''
# kiwi generated apt-get config file
Dir "/";
Dir::State "${ap... |
from _collections import OrderedDict
import numpy as np
import theano
import theano.tensor as TT
class Filter:
"""Filter an arbitrary theano.shared"""
def __init__(self, pstc, name=None, source=None, shape=None):
"""
:param float pstc:
:param string name:
:param source:
... |
import pytest
import six
from configmanager import NotFound, Item, PlainConfig
@pytest.fixture
def schema():
return {
'uploads': {
'enabled': True,
'threads': 1,
'tmp_dir': None,
'db': {
'user': 'root',
'password': 'secret',
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.