content stringlengths 4 20k |
|---|
#!/usr/bin/env python
from distutils.core import setup
import glob
import os
import subprocess
base_path = os.path.abspath(os.path.join(os.path.dirname(__file__), 'haus_start'))
data_files = []
for dirpath, dirnames, filenames in os.walk(os.path.join(base_path, 'templates')):
# Ignore dirnames that start with '.... |
from test_framework.mininode import *
from test_framework.test_framework import BitcoinTestFramework
from test_framework.util import *
import time
'''
Test behavior of -maxuploadtarget.
* Verify that getdata requests for old blocks (>1week) are dropped
if uploadtarget has been reached.
* Verify that getdata requests ... |
"""
Utility methods related to file handling.
"""
from datetime import datetime
import os
from pytz import UTC
from django.core.exceptions import PermissionDenied
from django.core.files.storage import DefaultStorage, get_valid_filename
from django.utils.translation import ugettext as _
from django.utils.translation i... |
# Sources (c) 2002, 2003, 2004, 2006, 2007, 2008, 2009
# David Turner <<EMAIL>>
#
#
# this file contains definitions of classes needed to decompose
# C sources files into a series of multi-line "blocks". There are
# two kinds of blocks:
#
# - normal blocks, which contain source code or ordinary comments
#
# - d... |
"""Implements ProcessPoolExecutor.
The follow diagram and text describe the data-flow through the system:
|======================= In-process =====================|== Out-of-process ==|
+----------+ +----------+ +--------+ +-----------+ +---------+
| | => | Work Ids | => | | => ... |
"""Modified Olivetti faces dataset.
The original database was available from (now defunct)
http://www.uk.research.att.com/facedatabase.html
The version retrieved here comes in MATLAB format from the personal
web page of Sam Roweis:
http://www.cs.nyu.edu/~roweis/
There are ten different images of each of 40... |
from oslo_utils import strutils
import six
import six.moves.urllib.parse as urlparse
import webob
from nova.api.openstack.compute.schemas.v3 import quota_sets
from nova.api.openstack import extensions
from nova.api.openstack import wsgi
from nova.api import validation
from nova import exception
from nova.i18n import _... |
import os
import random
class CPU(object):
"""
The Chip-8 has 4KB of RAM from 0x000 to 0xFFF. The original interpreter is stored in memory
from 0x000 to 0x1FF so most programs will start at 0x200. The Chip-8 has 16 8-bit registers
and a 16-bit register that stores memory addresses. There are also 2 8-... |
"""Fixes bug 933963 Split up Signature Summary jobs
Revision ID: 477e1c6e6df3
Revises: 317e15fbf13a
Create Date: 2013-11-01 15:45:34.884331
"""
# revision identifiers, used by Alembic.
revision = '477e1c6e6df3'
down_revision = '18b22de09433'
from alembic import op
from socorro.lib import citexttype, jsontype
from s... |
from __future__ import absolute_import, division, print_function
__metaclass__ = type
ANSIBLE_METADATA = {'metadata_version': '1.1',
'status': ['preview'],
'supported_by': 'community'}
DOCUMENTATION = r'''
---
module: ipify_facts
short_description: Retrieve the public IP of y... |
from yowsup.layers.interface import YowInterfaceLayer, ProtocolEntityCallback
from yowsup.layers.protocol_messages.protocolentities import TextMessageProtocolEntity
from yowsup.common.tools import Jid
import threading
import logging
logger = logging.getLogger(__name__)
class SendLayer(YowInt... |
import functools
from pluss.app import app
from pluss.util.cache import Cache
RATE_LIMIT_CACHE_KEY_TEMPLATE = 'pluss--remoteip--ratelimit--1--%s'
def ratelimited(func):
"""Includes the wrapped handler in the global rate limiter (60 calls/min)."""
@functools.wraps(func)
def wrapper(*args, **kwargs):
... |
# Yeh exercise hai
# Har line of code se pehle aapko ek line mei comment mei daal kar likhna hai, ki uss line of code ka matlab kya hai
# Aap jyada comments bhi likh sakte hai, jitne jyada comments likhenge, utna aapkya fayda hoga
# Question 1
# Palindromes woh shabd hote hain jo aage se likho ya piche se likho same... |
from mechanize import Browser
from threading import Thread
from ConfigParser import Error
import time
from BeautifulSoup import BeautifulSoup
from sqlalchemy import desc
import gzip
import pygraphviz as pg
import networkx as nx
import collections
import logging
import os
from plugin import plugin
from dbmanager impor... |
"""This module looks after initialising the appengine api stubs."""
import logging
import os
from appengine_django import appid
from appengine_django import have_appserver
from appengine_django.db.creation import DatabaseCreation
from django.db.backends import BaseDatabaseWrapper
from django.db.backends import Base... |
import re
from ansible.module_utils.six import iteritems
from ansible.module_utils.network.common.utils import to_list
from ansible.module_utils.network.eos.providers.providers import register_provider
from ansible.module_utils.network.eos.providers.providers import CliProvider
from ansible.module_utils.network.eos.pr... |
# -*- coding: utf-8 -*-
"""
Several methods to simplify expressions involving unit objects.
"""
from __future__ import division
from sympy import Add, Mul, Pow
from sympy.core.compatibility import reduce
from sympy.physics.unitsystems import Dimension, Unit, Quantity
def dim_simplify(expr):
"""
Simplify ex... |
"""Unit tests for the ValueProvider class."""
import unittest
from apache_beam.utils.pipeline_options import PipelineOptions
from apache_beam.utils.value_provider import RuntimeValueProvider
from apache_beam.utils.value_provider import StaticValueProvider
class ValueProviderTests(unittest.TestCase):
def test_stat... |
import dbus
import dbus.service
from gi.repository import GObject
import logging
import sys
import gettext
from gettext import gettext as _
LOG = logging.getLogger(__name__)
from oneconf.enums import ONECONF_SERVICE_NAME
HOSTS_OBJECT_NAME = "/com/ubuntu/oneconf/HostsHandler"
PACKAGE_SET_INTERFACE = "com.ubuntu.OneC... |
from msrest.pipeline import ClientRawResponse
from .. import models
class Datetimerfc1123Operations(object):
"""Datetimerfc1123Operations operations.
:param client: Client for service requests.
:param config: Configuration of service client.
:param serializer: An object model serializer.
:param ... |
from jsonrpc import ServiceProxy
import sys
import string
# ===== BEGIN USER SETTINGS =====
# if you do not set these you will be prompted for a password for every command
rpcuser = ""
rpcpass = ""
# ====== END USER SETTINGS ======
if rpcpass == "":
access = ServiceProxy("http://127.0.0.1:9335")
else:
access = Ser... |
from _emerge.SubProcess import SubProcess
import sys
from portage.cache.mappings import slot_dict_class
import portage
portage.proxy.lazyimport.lazyimport(globals(),
'portage.package.ebuild._metadata_invalid:eapi_invalid',
)
from portage import os
from portage import _encodings
from portage import _unicode_decode
from... |
"""
SQLite3 backend for django.
Works with either the pysqlite2 module or the sqlite3 module in the
standard library.
"""
from __future__ import unicode_literals
import datetime
import decimal
import re
import warnings
import pytz
from django.conf import settings
from django.db import utils
from django.db.backends ... |
import httplib as http
from nose.tools import * # noqa
import mock
from framework.exceptions import HTTPError
from website.addons.dataverse.tests.utils import (
create_mock_connection, DataverseAddonTestCase, create_external_account,
)
from website.addons.dataverse.provider import DataverseProvider
class TestD... |
"""An estimator is a rule for calculating an estimate of a given quantity.
# Estimators
* **Estimators** are used to train and evaluate TensorFlow models.
They support regression and classification problems.
* **Classifiers** are functions that have discrete outcomes.
* **Regressors** are functions that predict conti... |
"""
Fields to support various HTML5 input types.
"""
from ..widgets import html5 as widgets
from . import core
__all__ = (
'DateField', 'DateTimeField', 'DateTimeLocalField', 'DecimalField',
'DecimalRangeField', 'EmailField', 'IntegerField', 'IntegerRangeField',
'SearchField', 'TelField', 'URLField',
)
c... |
#!/usr/bin/env python
"""
Example Azure Handler script for Linux IaaS
Install example
Reads port from Public Config if present.
Creates service_port.txt in resources dir.
"""
import os
import imp
import time
waagent=imp.load_source('waagent','/usr/sbin/waagent')
from waagent import LoggerInit
hutil=imp.load_source('... |
from virttest import storage
from virttest import qemu_storage
from virttest import data_dir
from autotest.client.shared import error
import re
import logging
import time
@error.context_aware
def run(test, params, env):
"""
live_snapshot chain test:
Will test snapshot as following steps:
1. Boot up g... |
import gym
import numpy as np
import random
import tensorflow as tf
import matplotlib.pyplot as plt
# Create model
def multilayer_perceptron(x, weights, biases):
#somehow drl performs worse with complex layers
# Hidden layer with RELU activation
layer_1 = tf.matmul(x, weights['h1'])
layer_1 = tf.nn.rel... |
"""
This file was automatically generated.
"""
class script(object):
def __init__(self, zap):
self.zap = zap
@property
def list_engines(self):
return next(self.zap._request(self.zap.base + 'script/view/listEngines/').itervalues())
@property
def list_scripts(self):
return ... |
# -*- coding: utf-8 -*-
"""
***************************************************************************
SumLines.py
---------------------
Date : August 2012
Copyright : (C) 2012 by Victor Olaya
Email : volayaf at gmail dot com
******************************... |
import os
from setuptools import find_packages, setup
with open(os.path.join(os.path.dirname(__file__), "README.rst")) as readme:
long_description = readme.read()
classifiers = [
"Development Status :: 3 - Alpha",
"License :: OSI Approved :: MIT License",
"Operating System :: OS Independent",
"P... |
import traceback
try:
import ovirtsdk4.types as otypes
except ImportError:
pass
from ansible.module_utils.basic import AnsibleModule
from ansible.module_utils.ovirt import (
BaseModule,
check_sdk,
check_params,
create_connection,
ovirt_full_argument_spec,
)
ANSIBLE_METADATA = {'status': ... |
import macpath
from test import test_support
import unittest
class MacPathTestCase(unittest.TestCase):
def test_abspath(self):
self.assert_(macpath.abspath("xx:yy") == "xx:yy")
def test_isabs(self):
isabs = macpath.isabs
self.assert_(isabs("xx:yy"))
self.assert_(isabs("xx:yy:... |
from django.utils.translation import ugettext_lazy as _
from horizon import exceptions
from horizon import forms
from horizon import workflows
from openstack_dashboard import api
from openstack_dashboard.utils import filters
INDEX_URL = "horizon:projects:instances:index"
ADD_USER_URL = "horizon:projects:instances:cr... |
"""
Wikifier is a script to add spaces to the pydoc files and move them to the documentation folder.
"""
from __future__ import absolute_import
#Init has to be imported first because it has code to workaround the python bug where relative imports don't work if the module is imported as a main module.
import __init__
... |
from __future__ import absolute_import
from setuptools import setup, find_packages
from codecs import open
with open('README.rst', encoding='utf-8') as f:
long_description = f.read()
setup(
name='pypsa',
version='0.17.1',
author='Tom Brown (FIAS, KIT), Jonas Hoersch (FIAS, KIT), Fabian Hofmann (FI... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
import app_data.fields
import aldryn_apphooks_config.fields
class Migration(migrations.Migration):
dependencies = [
]
operations = [
migrations.CreateModel(
name='Entry',
... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from unittest import skipUnless
from django.conf.global_settings import PASSWORD_HASHERS
from django.contrib.auth.hashers import (
UNUSABLE_PASSWORD_PREFIX, UNUSABLE_PASSWORD_SUFFIX_LENGTH,
BasePasswordHasher, PBKDF2PasswordHasher, PBKDF2SHA1Pass... |
import os
from django.conf import settings
from django.contrib.auth.models import User
from django.contrib.flatpages.models import FlatPage
from django.test import TestCase
from django.test.utils import override_settings
@override_settings(
LOGIN_URL='/accounts/login/',
MIDDLEWARE_CLASSES=(
'django.mi... |
"""
Some unit tests for the S3 MultiPartUpload
"""
# Note:
# Multipart uploads require at least one part. If you upload
# multiple parts then all parts except the last part has to be
# bigger than 5M. Hence we just use 1 part so we can keep
# things small and still test logic.
import os
import unittest
import time
fr... |
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
import os
import shutil
import traceback
import select
import fcntl
import errno
HAS_LIBLXC = False
try:
import lxc as _lxc
HAS_LIBLXC = True
except ImportError:
pass
from ansible import constants as C
from ansible im... |
from __future__ import division
import argparse
import matplotlib
matplotlib.use('Qt4Agg')
from matplotlib import pyplot as plt
plt.style.use('fivethirtyeight')
import numpy as np
from funzo.domains.gridworld import GridWorld, GridWorldMDP
from funzo.domains.gridworld import GReward, GRewardLFA, GTransition
from f... |
__version__=''' $Id: cidfonts.py 3710 2010-05-14 16:00:58Z rgbecker $ '''
__doc__="""CID (Asian multi-byte) font support.
This defines classes to represent CID fonts. They know how to calculate
their own width and how to write themselves into PDF files."""
import os
from types import ListType, TupleType, DictType
fr... |
import struct
import dns.rdata
import dns.rdatatype
class DSBase(dns.rdata.Rdata):
"""Base class for rdata that is like a DS record
@ivar key_tag: the key tag
@type key_tag: int
@ivar algorithm: the algorithm
@type algorithm: int
@ivar digest_type: the digest type
@type digest_type: int
... |
import copy
import io
import logging
import sys
from typ.host import _TeedStream
is_python3 = bool(sys.version_info.major == 3)
if is_python3: # pragma: python3
# redefining built-in 'unicode' pylint: disable=W0622
unicode = str
class FakeHost(object):
# "too many instance attributes" pylint: disable... |
from OpenGL.GL import *
from .GLMeshItem import GLMeshItem
from .. MeshData import MeshData
from ...Qt import QtGui
import numpy as np
__all__ = ['GLSurfacePlotItem']
class GLSurfacePlotItem(GLMeshItem):
"""
**Bases:** :class:`GLMeshItem <pyqtgraph.opengl.GLMeshItem>`
Displays a surface plot on a r... |
from django.conf import settings
from django.contrib import auth
from django.contrib.auth.models import User
from django.http import HttpResponseRedirect
from django.shortcuts import render_to_response
from django.template import RequestContext
from registration.forms import RegistrationForm
def register(request, nex... |
# -*-coding:utf-8 -*
from django.shortcuts import render_to_response
from django.template import RequestContext
from django.http import HttpResponse
from django.http import HttpResponseRedirect
from django import forms
from django.contrib import auth
from django.contrib.auth.decorators import login_required
from django... |
from datetime import datetime
from openerp.tools import DEFAULT_SERVER_DATE_FORMAT as OE_DATEFORMAT
from report import report_sxw
class Parser(report_sxw.rml_parse):
def __init__(self, cr, uid, name, context):
super(Parser, self).__init__(cr, uid, name, context)
self.localcontext.update({
... |
"""
Constants for the FAT file system.
.. moduleauthor:: Michael Murr (<EMAIL>)
"""
__docformat__ = "restructuredtext en"
__all__ = [
"MAX_CLUST_COUNT_FAT12", "MAX_CLUST_COUNT_FAT16", "UNALLOC_FAT",
"EOC_FAT12", "EOC_FAT16", "EOC_FAT32", "BAD_FAT12", "BAD_FAT16",
"BAD_FAT32", "ATTR_READ_ONLY", "ATTR_HIDD... |
from __future__ import absolute_import, division, print_function
from fnmatch import fnmatch
def filenames(hdfs, path):
"""
Filenames in Hadoop File System under specific path
Parameters
----------
hdfs: pywebhdfs.webhdfs.PyWebHdfsClient instance
path: string
Directory on HDFS
... |
from __future__ import unicode_literals
import webnotes
from webnotes import msgprint, _
from webnotes.utils import cint,cstr
class DocType:
def __init__(self, d, dl):
self.doc, self.doclist = d, dl
def autoname(self):
if self.doc.account_id and self.doc.group_id:
self.doc.name = self.do... |
#!/usr/bin/env python
from nose.tools import *
import networkx as nx
from test_graph import TestGraph
from test_digraph import TestDiGraph
from test_multigraph import TestMultiGraph
from test_multidigraph import TestMultiDiGraph
try: # python 2.7+
from collections import OrderedDict
except ImportError: # python 2... |
#!/usr/bin/env python3
"""
Remote python server.
Execute Python commands remotely and send output back.
WARNING: This version has a gaping security hole -- it accepts requests
from any host on the Internet!
"""
import sys
from socket import socket, AF_INET, SOCK_STREAM
import io
import traceback
PORT = 4127
BUFSIZE... |
from __future__ import absolute_import, division, print_function
__metaclass__ = type
from ansible.module_utils.facts.network import iscsi
from units.compat.mock import Mock
# AIX # lsattr -E -l iscsi0
LSATTR_OUTPUT = """
disc_filename /etc/iscsi/targets Configuration file Fals... |
import logging
import globals
from openzwave.option import ZWaveOption
from utilities.FilesManager import FilesManager
def init_manager():
globals.options = ZWaveOption(globals.device, config_path=globals.config_folder, user_path=globals.data_folder, cmd_line="")
globals.options.set_log_file("../../../log/openzwaved... |
from bitarray import bitarray
from gettext import gettext as _
from lxml import etree
from netzob.Common.MMSTD.Dictionary._Variable import Variable
from netzob.Common.Type.TypeConvertor import TypeConvertor
import logging
import random
#+---------------------------------------------------------------------------+
#| Re... |
# -*- coding:utf-8 -*-
'''
Created on 2015/3/14
@author: Jimmy Liu
'''
import unittest
from tushare.stock import reference as fd
class Test(unittest.TestCase):
def set_data(self):
self.code = '600848'
self.start = '2015-01-03'
self.end = '2015-04-07'
self.year = 2014... |
import numpy as np
import tvm
from tvm import te
from tvm.contrib import graph_runtime
from tvm import relay
from model_zoo import c2_squeezenet, c2_resnet50, c2_vgg19
from caffe2.python import workspace, core
from caffe2.proto import caffe2_pb2
from collections import namedtuple
import tvm.testing
def get_tvm_output... |
def post_annotation(module):
user = module.params['user']
api_key = module.params['api_key']
name = module.params['name']
title = module.params['title']
url = 'https://metrics-api.librato.com/v1/annotations/%s' % name
params = {}
params['title'] = title
if module.params['source'] != No... |
from flask_bcrypt import generate_password_hash, check_password_hash
from app import db, token_signer
class User(db.Model):
"""
Defines attributes for a user
"""
__tablename__ = 'Users'
id = db.Column(db.Integer, primary_key=True, autoincrement=True)
username = db.Column(db.String(20), unique... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
import urllib
import urllib2
import socket
import re
import sys
import xbmcplugin
import xbmcaddon
import xbmcgui
import subprocess
socket.setdefaulttimeout(30)
pluginhandle = int(sys.argv[1])
addonId = 'plugin.video.lovefilm_com'
addon = xbmcaddon.Addon(id=addonId)
translatio... |
from datetime import datetime
from mock import Mock
from timeseries.timeseries import TimeSeries
class MockTimeSeriesReader(object):
def __init__(self, *args):
self.get = Mock(return_value=create_time_series(*args))
class MockTimeSeries(object):
def __init__(self, *args):
self.input = {}
... |
# coding=utf-8
'''
This module handles the comments page
'''
#Import the app
from app import app
#Import needed flask functions
from flask import g, render_template, redirect, url_for, flash, jsonify, abort
from flask import request, after_this_request, send_file
from flask.ext.login import current_user, login_requi... |
# -*- coding: utf-8 -*-
"""
Overlay.py - overlay file for geohub maps
======================================================================
AUTHOR: Wei Wan, Purdue University
EMAIL: <EMAIL>
Copyright (c) 2016 Purdue University
See the file "license.terms" for information on usage and
redistribution of this ... |
"""A helper library to expose Unix system information."""
import os
import pwd
import re
import socket
import sys
import time
def GetCWD():
"""Returns the current working directory."""
return os.getcwd()
def GetEnv(variable):
"""Returns the environment variable value as a string."""
return os.getenv(variab... |
import pickle
from cStringIO import StringIO
from test import test_support
from test.pickletester import AbstractPickleTests
from test.pickletester import AbstractPickleModuleTests
from test.pickletester import AbstractPersistentPicklerTests
class PickleTests(AbstractPickleTests, AbstractPickleModuleTests):
def... |
import logging
import random
import numpy
import cPickle
from picklable_itertools import iter_
from fuel.datasets import Dataset
from fuel.streams import DataStream
from fuel.schemes import IterationScheme, ConstantScheme
from fuel.transformers import Batch, Mapping, SortMapping, Unpack, Padding, Transformer
import... |
import time
import sqlite3
import json
# import cStringIO
import io
def pretty_json(x):
return (u"\n"+json.dumps(x, sort_keys=True, indent=4, separators=(',', ': '))+"\n").replace(u"\n", "\n ")
def string_report(cursor):
# c = cStringIO.StringIO()
# c = io.BytesIO()
c = io.StringIO()
mak... |
import json
import os
import socket
import zlib
import six
from six.moves import http_client
from swiftclient import client as swift
class FakeSwiftClient(object):
"""Logs calls instead of executing."""
def __init__(self, *args, **kwargs):
pass
@classmethod
def Connection(self, *args, **kar... |
"""
.. Copyright (c) 2014, 2015 Marshall Farrier
license http://opensource.org/licenses/MIT
Options - price (:mod:`pynance.opt.price`)
==================================================
.. currentmodule:: pynance.opt.price
"""
from __future__ import absolute_import
import pandas as pd
from ._common import _getp... |
# coding: utf8
{
'"update" is an optional expression like "field1=\'newvalue\'". You cannot update or delete the results of a JOIN': '"update" is an optional expression like "field1=\'newvalue\'". You cannot update or delete the results of a JOIN',
'%Y-%m-%d': '%Y-%m-%d',
'%Y-%m-%d %H:%M:%S': '%Y-%m-%d %H:%M:%S',
'%s r... |
import pytest
from django.core.urlresolvers import reverse
from .. import factories as f
pytestmark = pytest.mark.django_db
def test_upvote_user_story(client):
user = f.UserFactory.create()
user_story = f.create_userstory(owner=user)
f.MembershipFactory.create(project=user_story.project, user=user, is_o... |
import netCDF4 as nc
import matplotlib.pyplot as plt
import matplotlib.tri as Tri
import matplotlib.ticker as ticker
#from mpl_toolkits.basemap import Basemap
import numpy as np
import cPickle as pickle
import seaborn
import time
filename = '/home/wesley/github/aidan-projects/grid/dngrid_0001.nc'
data = nc.Dataset(fil... |
"""Model loss construction."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
# Dependency imports
import numpy as np
from six.moves import xrange
import tensorflow as tf
# Useful for REINFORCE baseline.
from losses import losses
FLAGS = tf.app.flags.FLA... |
"""Dataset generator."""
__all__ = ['DataLoader']
import multiprocessing
import multiprocessing.queues
from multiprocessing.reduction import ForkingPickler
import pickle
import io
import sys
import numpy as np
from . import sampler as _sampler
from ... import nd, context
def rebuild_ndarray(*args):
"""Rebuild n... |
import copy
import logging
import sys
import traceback
from quantum.openstack.common import cfg
from quantum.openstack.common.gettextutils import _
from quantum.openstack.common import importutils
from quantum.openstack.common import jsonutils
from quantum.openstack.common import local
LOG = logging.getLogger(__name... |
from django.contrib.contenttypes.fields import (
GenericForeignKey, GenericRelation,
)
from django.contrib.contenttypes.models import ContentType
from django.db import models
from django.db.models.deletion import ProtectedError
from django.utils.encoding import python_2_unicode_compatible
__all__ = ('Link', 'Place... |
# -*- coding: utf-8 -*-
"""
Created on Feb 20, 2014
@author: Aaron Ponti
"""
from ch.systemsx.cisd.openbis.dss.etl.dto.api import SimpleImageContainerDataConfig
class MicroscopyCompositeDatasetConfig(SimpleImageContainerDataConfig):
"""Image data configuration class for composite image files."""
def creat... |
from __future__ import absolute_import, division, print_function
from cryptography import utils
from cryptography.exceptions import InvalidSignature
from cryptography.hazmat.backends.openssl.utils import _truncate_digest
from cryptography.hazmat.primitives import hashes, serialization
from cryptography.hazmat.primitiv... |
import copy
from django.db import router
from django.db.models.query import QuerySet, EmptyQuerySet, insert_query, RawQuerySet
from django.db.models import signals
from django.db.models.fields import FieldDoesNotExist
def ensure_default_manager(sender, **kwargs):
"""
Ensures that a Model subclass contains a d... |
"""
Simple Training CLI.
"""
import argparse
import os
from contextlib import ExitStack
from typing import Optional, List, Tuple
from . import arguments
from . import constants as C
from . import data_io
from . import inference
from . import model
from . import scoring
from . import utils
from . import vocab
from .log... |
# -*- coding: UTF-8 -*-
# Задача 7. Вариант 15.
#
# Разработайте систему начисления очков для задачи 6, в соответствии с которой игрок получал бы большее количество баллов за меньшее количество попыток.
# Mochalov V. V.
# 04.04.2016
import random
k=12
x=random.randint(1, 12)
while True:
y=input("Введ... |
from oslo_log import log as logging
import testscenarios
from nova import test
from nova.tests import fixtures as nova_fixtures
from nova.tests.functional import api_paste_fixture
import nova.tests.unit.image.fake
from nova.tests.unit import policy_fixture
LOG = logging.getLogger(__name__)
class SecgroupsFullstack(... |
"""
Test for POOPS. Basic Parcing practice.
"""
from html.parser import HTMLParser
from urllib import request
def openFile():
"""Simply takes testfile and makes it into one large string
Returns a list that represents all of the source html code of
a webpage.
"""
#with open( "TestPage.html") as myfile:
# data = ... |
# -*- coding: utf-8 -*-
from __future__ import with_statement
import os
import re
import sys
import pytz
import subprocess
_systemconfig_tz = re.compile(r'^Time Zone: (.*)$', re.MULTILINE)
def _tz_from_env(tzenv):
if tzenv[0] == ':':
tzenv = tzenv[1:]
# TZ specifies a file
if os.path.exists(tzen... |
import gdb
def signal_stop_handler (event):
if (isinstance (event, gdb.StopEvent)):
print ("event type: stop")
if (isinstance (event, gdb.SignalEvent)):
print ("stop reason: signal")
print ("stop signal: %s" % (event.stop_signal))
if ( event.inferior_thread is not None) :
... |
import re
import os
from . import viterbi
import jieba
import sys
import marshal
from functools import wraps
default_encoding = sys.getfilesystemencoding()
PROB_START_P = "prob_start.p"
PROB_TRANS_P = "prob_trans.p"
PROB_EMIT_P = "prob_emit.p"
CHAR_STATE_TAB_P = "char_state_tab.p"
def load_model(f_name, isJython=Tru... |
from lib.common import helpers
import re
class Stager:
def __init__(self, mainMenu, params=[]):
self.info = {
'Name': 'AppleScript',
'Author': ['@harmj0y'],
'Description': ('An OSX office macro.'),
'Comments': [
"http://stackoverflow.com/... |
from __future__ import unicode_literals
from unittest import skipIf
from django.db import connection, connections
from django.db.migrations.graph import NodeNotFoundError
from django.db.migrations.loader import AmbiguityError, MigrationLoader
from django.db.migrations.recorder import MigrationRecorder
from django.tes... |
# -*- coding: utf-8 -*-
"""
Serialization
``django.core.serializers`` provides interfaces to converting Django
``QuerySet`` objects to and from "flat" data (i.e. strings).
"""
from __future__ import unicode_literals
from decimal import Decimal
from django.db import models
from django.utils import six
from django.uti... |
from openerp.osv import osv, fields
class res_partner_phone(osv.osv):
_name = "res.partner.phone"
_description = "partner phone numbers"
_rec_name = "phone"
_columns = {
'phone': fields.char('Number', size=64, required=True),
'res_partner_id': fields.many2one('res.partner', 'Partner ID... |
# -*- coding: utf-8 -*-
timezone_dict = {
"ACDT": "Australian Central Daylight Time",
"ACST": "Australian Central Standard Time",
"ACWT": "Australian Central Western Time",
"ADT": "Atlantic Daylight Time",
"ACT": "Acre Time",
... |
from oslo.config import cfg
from tooz import coordination as tooz_coord
from st2common import log as logging
from st2common.util import system_info
LOG = logging.getLogger(__name__)
def coordinator_setup():
"""
Sets up the client for the coordination service.
URL examples for connection:
zake:... |
"""
Register a Python distribution
Created on Tue Aug 21 21:46:30 2012
"""
from __future__ import print_function
import sys
import os
import os.path as osp
import subprocess
# Local imports
from winpython.py3compat import winreg
from winpython import utils
KEY_C = r"Software\Classes\%s"
KEY_C0 = KEY_C % r"Python.... |
from datetime import datetime
import sys
sys.path.append('/home/sulantha/PycharmProjects/Processing_Pipeline')
from Utils.DbUtils import DbUtils
import glob
import itertools
import argparse
parser = argparse.ArgumentParser(description='Match FDG to AV45. ')
parser.add_argument('--csv', nargs=1, required=True,
... |
"""Test for checking stats accumulator related ops."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from tensorflow.contrib.boosted_trees.lib.learner.batch import categorical_split_handler
from tensorflow.contrib.boosted_trees.proto import learner_pb2
fr... |
import numpy as np
import scipy.sparse as sp
from sklearn.utils.testing import assert_less
from sklearn.utils.testing import assert_greater
from sklearn.utils.testing import assert_array_almost_equal, assert_array_equal
from sklearn.utils.testing import assert_almost_equal
from sklearn.utils.testing import assert_rais... |
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. F Y'
TIME_FORMAT = 'H:i'
DATETIME_FORMAT = 'j. F Y H:i'
YEAR_MONTH_FORMAT = 'F Y'
MONTH_DAY_FORMAT = 'j. F'
SHORT_DATE_FORMAT = 'd.... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.