content stringlengths 4 20k |
|---|
#!/usr/bin/env python
"""Setup script for GDM."""
import setuptools
from gdm import __project__, __version__, CLI, DESCRIPTION
import os
if os.path.exists('README.rst'):
README = open('README.rst').read()
else:
README = "" # a placeholder, readme is generated on release
CHANGES = open('CHANGES.md').read()
... |
import argparse
import collections
import os
import sys
import time
from distutils.version import StrictVersion
try:
import json
except:
import simplejson as json
import os_client_config
import shade
import shade.inventory
CONFIG_FILES = ['/etc/ansible/openstack.yaml', '/etc/ansible/openstack.yml']
def get... |
#!/usr/bin/env python
#
# This is a quantum control example motivated by the experimental need
# to synthesize unitary matrices in SU(2) in optimal time, given an
# explicit and finite control set generating the whole space, and an
# admissible error.
#
# See problem_description.pdf for additional details.
#
# Contribu... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Cluster sequence IDs into groups of IDs whose sequences blast together.
Input file is the result file (outfmt 0) of fasta file blasted against itself.
Usage:
%program <input_file> <output_file>"""
import sys
from collections import defaultdict
from copy import de... |
#!/usr/bin/env python
from __future__ import division
from __future__ import unicode_literals
import sys, math
import argparse
from volk_test_funcs import *
try:
import matplotlib
import matplotlib.pyplot as plt
except ImportError:
sys.stderr.write("Could not import Matplotlib (http://matplotlib.sourcefor... |
"""A simple log mechanism styled after PEP 282."""
# The class here is styled after PEP 282 so that it could later be
# replaced with a standard Python logging implementation.
DEBUG = 1
INFO = 2
WARN = 3
ERROR = 4
FATAL = 5
import sys
class Log:
def __init__(self, threshold=WARN):
self.threshold = thre... |
from decimal import Decimal
from django.apps import apps
from django.core import checks
from django.db import models
from django.test import TestCase, skipIfDBFeature
from django.test.utils import isolate_apps
from .models import Bar, FkToChar, Foo, PrimaryKeyCharModel
class ForeignKeyTests(TestCase):
def test... |
from openerp.osv import fields, osv
class res_company(osv.Model):
_name = "res.company"
_inherit = "res.company"
_columns = {
"gengo_private_key": fields.text("Gengo Private Key", copy=False, groups="base.group_system"),
"gengo_public_key": fields.text("Gengo Public Key", copy=False,... |
#!/usr/bin/env python
import subprocess
import sys
import css_properties
import in_generator
import license
HEADER_TEMPLATE = """
%(license)s
#ifndef %(class_name)s_h
#define %(class_name)s_h
#include "core/css/parser/CSSParserMode.h"
#include "wtf/HashFunctions.h"
#include "wtf/HashTraits.h"
#include <string.h>
... |
from __future__ import division
import random
import unittest
from p2pool.util import math
def generate_alphabet():
if random.randrange(2):
return None
else:
a = map(chr, xrange(256))
random.shuffle(a)
return a[:random.randrange(2, len(a))]
class Test(unittest.TestCase):
... |
#!/usr/bin/env python
"""
=================================================
NXTDrive.py - LEGO Mindstorms NXT Drive Handler
=================================================
Converts a desired global velocity vector into translational and rotational rates for a differential-drive robot,
using feedback linearization.
"... |
from __future__ import (absolute_import, division, generators, nested_scopes, print_function,
unicode_literals, with_statement)
import os
from collections import OrderedDict, namedtuple
from hashlib import sha1
import six
from twitter.common.dirutil import Fileset
from pants.backend.jvm.targe... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""Produces a quick .csv file summarizing number of sentences in each paragraph
in this particular chapter, encoding basic facts about structure that are
relevant to the script 7.py. Makes a lot of assumptions about the structure of
the text file it's processing, including... |
{
'name': 'Webkit Report Engine',
'description': """
This module adds a new Report Engine based on WebKit library (wkhtmltopdf) to support reports designed in HTML + CSS.
=====================================================================================================================
The module structure a... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
import booki.messaging.models
class Migration(migrations.Migration):
dependencies = [
]
operations = [
migrations.CreateModel(
name='Endpoint',
fields=[
... |
from __future__ import absolute_import, division, print_function, \
with_statement
import time
import os
import socket
import struct
import re
import logging
from shadowsocks import common, lru_cache, eventloop
CACHE_SWEEP_INTERVAL = 30
VALID_HOSTNAME = re.compile(br"(?!-)[A-Z\d-]{1,63}(?<!-)$", re.IGNORECASE)... |
import math, util, rotmat, time
import random
from rotmat import Vector3, Matrix3
class Aircraft(object):
'''a basic aircraft class'''
def __init__(self):
self.home_latitude = 0
self.home_longitude = 0
self.home_altitude = 0
self.ground_level = 0
self.frame_height = 0.0
... |
from openerp.osv import fields, orm
class sale_order_line_group(orm.Model):
_name = 'sale.order.line.group'
_columns = {
'name': fields.char('Group', size=64, required=True),
'company_id': fields.many2one(
'res.company', 'Company', required=True, select=1),
}
_defaults = {
... |
from __future__ import (absolute_import, division, generators, nested_scopes, print_function,
unicode_literals, with_statement)
import os
from textwrap import dedent
from pants.backend.python.register import build_file_aliases as register_python
from pants.build_graph.address import Address
fr... |
'''
All forms for admin control panel.
NOT the customers' manager
'''
from flask.ext.wtf import Form
from wtforms import BooleanField, DateTimeField, DecimalField, IntegerField, \
TextField
from wtforms.validators import InputRequired as Required
class AccountForm(Form):
join_timestamp = Date... |
# -*- coding: utf-8 -*-
"""The app module, containing the app factory function."""
from flask import Flask, render_template
from temp_app import commands, public, user
from temp_app.extensions import bcrypt, cache, csrf_protect, db, debug_toolbar, login_manager, migrate, webpack
from temp_app.settings import ProdConfi... |
__all__ = ['Composer', 'ComposerError']
from .error import MarkedYAMLError
from .events import *
from .nodes import *
class ComposerError(MarkedYAMLError):
pass
class Composer:
def __init__(self):
self.anchors = {}
def check_node(self):
# Drop the STREAM-START event.
if self.che... |
import unittest
from string import Template
class Bag:
pass
class Mapping:
def __getitem__(self, name):
obj = self
for part in name.split('.'):
try:
obj = getattr(obj, part)
except AttributeError:
raise KeyError(name)
return obj
... |
import sys
from distutils.core import setup
version = '1.9.3'
kwargs = {
'name' : 'dnspython',
'version' : version,
'description' : 'DNS toolkit',
'long_description' : \
"""dnspython is a DNS toolkit for Python. It supports almost all
record types. It can be used for queries, zone transfers, and d... |
"""ContactsService extends the GDataService for Google Contacts operations.
ContactsService: Provides methods to query feeds and manipulate items.
Extends GDataService.
DictionaryToParamList: Function which converts a dictionary into a list of
URL arguments (represented... |
#!/usr/bin/python
from __future__ import absolute_import, division, print_function
__metaclass__ = type
from ansible.module_utils.basic import AnsibleModule
def main():
module = AnsibleModule(
argument_spec=dict(
test_docs_suboptions=dict(
type='dict',
options... |
import math
import numpy as np
from scipy.optimize import minimize
def array(f, numval, numdh):
"""Создать N-мерный массив.
param: f - функция, которая приминает N аргументов.
param: numval - диапазоны значений параметров функции. Список
param: numdh - шаги для параметров. Список
"""
... |
from openerp.osv import fields, osv
class res_partner(osv.osv):
_name = 'res.partner'
_inherit = 'res.partner'
_columns = {
'property_product_pricelist': fields.property(
type='many2one',
relation='product.pricelist',
domain=[('type','=','sale')],
... |
# -*- coding: utf-8 -*-
'''
lucterios.contacts package
@author: Laurent GAY
@organization: sd-libre.fr
@contact: <EMAIL>
@copyright: 2015 sd-libre.fr
@license: This file is part of Lucterios.
Lucterios is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as publ... |
import time
from openerp.osv import osv
from openerp.report import report_sxw
class account_inverted_analytic_balance(report_sxw.rml_parse):
def __init__(self, cr, uid, name, context):
super(account_inverted_analytic_balance, self).__init__(cr, uid, name, context=context)
self.localcontext.update( ... |
"""Unittest for Graphy and Google Chart API backend."""
import warnings
from graphy import graphy_test
from graphy import pie_chart
from graphy.backends import google_chart_api
from graphy.backends.google_chart_api import base_encoder_test
# Extend BaseChartTest so that we pick up & repeat all the line tests which
... |
"""
Views for managing keypairs.
"""
import logging
from django.core.urlresolvers import reverse # noqa
from django.core.urlresolvers import reverse_lazy # noqa
from django import http
from django.template.defaultfilters import slugify # noqa
from django.utils.translation import ugettext_lazy as _ # noqa
from djan... |
import numpy as np
from astropy import units as u
from astropy.wcs import WCSSUB_CELESTIAL, WCSSUB_SPECTRAL
def get_spatial_scale(wcs, assert_square=True):
# Code adapted from APLpy
wcs = wcs.sub([WCSSUB_CELESTIAL])
cdelt = np.matrix(wcs.wcs.get_cdelt())
pc = np.matrix(wcs.wcs.get_pc())
scale = ... |
"""
Django settings for OpenMDM project.
For more information on this file, see
https://docs.djangoproject.com/en/1.7/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.7/ref/settings/
"""
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
im... |
# -*- coding: utf-8 -*-
"""
requests.api
~~~~~~~~~~~~
This module implements the Requests API.
:copyright: (c) 2012 by Kenneth Reitz.
:license: Apache2, see LICENSE for more details.
"""
from . import sessions
def request(method, url, **kwargs):
"""Constructs and sends a :class:`Request <Request>`.
Retur... |
"""Command Skeleton."""
import argparse
import datetime
import parsedatetime
class BaseCommand(object):
"""Base command."""
NAME = ""
HELP = ""
def add_arguments(self, parser):
"""Add custom arguments.
Args:
parser: argparse.Parser
"""
pass
def run(se... |
from .copy_sink import CopySink
class OracleSink(CopySink):
"""A copy activity Oracle sink.
:param additional_properties: Unmatched properties from the message are
deserialized this collection
:type additional_properties: dict[str, object]
:param write_batch_size: Write batch size. Type: integer... |
"""Functions for summarizing and describing TensorFlow graphs.
This contains functions that generate string descriptions from
TensorFlow graphs, for debugging, testing, and model size
estimation.
"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import re... |
import os
#Functions for manipulating datetime objects
#CCYY-MM-DDThh:mm:ssZ
def parseDateClass(s):
year, month, day = s.split("-")
day, tail = day[:2], day[2:]
hour, minute, second = tail[1:].split(":")
second = second[:2]
year, month, day = int(year), int(month), int(day)
hour, minute, second... |
"""network2.py
~~~~~~~~~~~~~~
An improved version of network.py, implementing the stochastic
gradient descent learning algorithm for a feedforward neural network.
Improvements include the addition of the cross-entropy cost function,
regularization, and better initialization of network weights. Note
that I have... |
#! /usr/bin/python3.3
"""
"PYSTONE" Benchmark Program
Version: Python/1.1 (corresponds to C/1.1 plus 2 Pystone fixes)
Author: Reinhold P. Weicker, CACM Vol 27, No 10, 10/84 pg. 1013.
Translated from ADA to C by Rick Richardson.
Every method to preserve ADA-likeness ha... |
#!/opt/anaconda1anaconda2anaconda3/bin/python
#
# Wrapper script for Java Conda packages that ensures that the java runtime
# is invoked with the right options. Adapted from the bash script (http://stackoverflow.com/questions/59895/can-a-bash-script-tell-what-directory-its-stored-in/246128#246128).
#
# Program Paramet... |
import unittest
import subprocess32 as subprocess
import extraction.utils as utils
import os
class TestUtils(unittest.TestCase):
def setUp(self):
pass
def test_external_process_works(self):
(status, out, err) = utils.external_process(['grep', '3'], input_data='Line 1\nLine 2\nLine 3\n')
self.a... |
# -*- coding: utf-8 -*-
import os, sys, random
import virt
# libvirt XML Template
# General Metadata
# This name should consist only of alpha-numeric characters and is required to be unique within the scope of a single host
# args :
# name : name for virtual machine. ( ex: host112 )
def GENERAL_METADATA(type_,nam... |
from wolis.test_case import WolisTestCase
class SubscribeTopicTestCase(WolisTestCase):
def test_subscribe_topic(self):
self.login('test43', 'test42')
url = '/index.php'
self.get(url)
self.assert_successish()
assert 'Index page' in self.response.body
... |
"""Tests for specs-related summarization functions."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import numpy as np
from tensorflow.contrib.specs.python import specs
from tensorflow.contrib.specs.python import summaries
from tensorflow.python.framewo... |
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
'''
This module contains things that are only needed for compat in the testsuites,
not in ansible itself. If you are not installing the test suite, you can
safely remove this subdirectory.
'''
#
# Compat for python2.7
#
# One un... |
import os
import platform
from twisted.internet import defer
from .. import data, helper
from p2pool.util import pack
P2P_PREFIX = 'fbc0b6db'.decode('hex')
P2P_PORT = 9333
ADDRESS_VERSION = 48
RPC_PORT = 9332
RPC_CHECK = defer.inlineCallbacks(lambda bitcoind: defer.returnValue(
'litecoinaddress' in (yie... |
"""Test Logger"""
# ============================================================================
# Imports
# ============================================================================
# Stdlib imports
import json
import logging
# Third-party imports
from pandas import Timestamp
import pytest
# Local imports
from... |
from __future__ import unicode_literals
import datetime
try:
import pytz
except ImportError:
pytz = None
from django.conf import settings
from django.contrib.humanize.templatetags import humanize
from django.template import Template, Context, defaultfilters
from django.test import TestCase
from django.test.ut... |
"Utility functions used by the btm_matcher module"
from . import pytree
from .pgen2 import grammar, token
from .pygram import pattern_symbols, python_symbols
syms = pattern_symbols
pysyms = python_symbols
tokens = grammar.opmap
token_labels = token
TYPE_ANY = -1
TYPE_ALTERNATIVES = -2
TYPE_GROUP = -3
... |
class ModuleDocFragment(object):
# Standard mysql documentation fragment
DOCUMENTATION = '''
options:
login_user:
description:
- The username used to authenticate with.
required: false
default: null
login_password:
description:
- The password used to authenticate with.
requi... |
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
from units.compat import unittest
from units.compat.mock import patch, MagicMock
from ansible.executor.play_iterator import HostState, PlayIterator
from ansible.playbook import Playbook
from ansible.playbook.play_context import Pl... |
"""Tests that the TensorFlow parts of the multivariate example run."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from tensorflow.contrib.timeseries.examples import multivariate
from tensorflow.python.platform import test
class MultivariateExampleTe... |
__all__ = ['callback']
from interpreter import PipelineInterpreter
import cgi
class ClientCallbackException(Exception):
pass
class BaseClientCbk(object):
def set_ticket(self, ticket):
self.ticket = ticket
def set_options(self, options):
self.options = options
def get_option(self, ... |
from __future__ import absolute_import, division, print_function, \
with_statement
import socket
import struct
import logging
import binascii
def compat_ord(s):
if type(s) == int:
return s
return _ord(s)
def compat_chr(d):
if bytes == str:
return _chr(d)
return bytes([d])
_ord ... |
from __future__ import with_statement
import copy
import itertools
import os
import re
import socket
import stat
import sys
import threading
import time
import types
from StringIO import StringIO
from functools import wraps
from Python26SocketServer import BaseRequestHandler, ThreadingMixIn, TCPServer
from fabric.ope... |
"""--------------------------------------------------------------------
COPYRIGHT 2016 Stanley Innovation Inc.
Software License Agreement:
The software supplied herewith by Stanley Innovation Inc. (the "Company")
for its licensed SI Vector Platform is intended and supplied to you,
the Company's customer, for use so... |
"""Tests for contrib.resampler.python.ops.resampler_ops."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import numpy as np
from six.moves import xrange # pylint: disable=redefined-builtin
from tensorflow.contrib import resampler
from tensorflow.python.... |
"""
Copyright (c) 2016 Red Hat, Inc
All rights reserved.
This software may be modified and distributed under the terms
of the BSD license. See the LICENSE file for details.
"""
from __future__ import print_function, unicode_literals
from atomic_reactor.constants import INSPECT_CONFIG
from atomic_reactor.plugin import... |
import numpy as np
import param
from bokeh.models.mappers import LinearColorMapper
try:
from bokeh.models.mappers import LogColorMapper
except ImportError:
LogColorMapper = None
from ...core.util import cartesian_product
from ...element import Image, Raster, RGB
from ..renderer import SkipRendering
from ..uti... |
"""A model that combines a decision forest embedding with a neural net."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from tensorflow.contrib.tensor_forest.hybrid.python import hybrid_model
from tensorflow.contrib.tensor_forest.hybrid.python.layers impo... |
import contextlib
import socket
import struct
from ryu.controller import handler
from ryu.ofproto import ether
from ryu.ofproto import inet
from ryu.lib import addrconv
from ryu.lib import hub
from ryu.lib.packet import arp
from ryu.lib.packet import vrrp
from ryu.services.protocols.vrrp import monitor
from ryu.servic... |
from django.db.backends.postgresql_psycopg2.introspection import DatabaseIntrospection
from django.contrib.gis.gdal import OGRGeomType
class GeoIntrospectionError(Exception):
pass
class PostGISIntrospection(DatabaseIntrospection):
# Reverse dictionary for PostGIS geometry types not populated until
# intro... |
import numpy as np
import copy
import cPickle as pickle
import decision_tree as dt
from sklearn.cross_validation import train_test_split
# Load train data
# train, load from csv without headers
features_train = np.genfromtxt('../census-dataset/census-train-features-median.csv', delimiter=' ', skip_header=1)
# remove ... |
from django.conf import settings
from django.contrib.sites.models import Site, RequestSite, get_current_site
from django.core.exceptions import ObjectDoesNotExist
from django.http import HttpRequest
from django.test import TestCase
class SitesFrameworkTests(TestCase):
def setUp(self):
Site(id=settings.SI... |
# -*- coding: utf-8 -*-
# pylint: disable=E1101
"""
Tests for import_from_xml using the mongo modulestore.
"""
from django.test.client import Client
from django.test.utils import override_settings
from django.conf import settings
from path import path
import copy
from django.contrib.auth.models import User
from xmod... |
import abc
import six
from neutron.api import extensions
from neutron.api.v2 import attributes as attr
from neutron.api.v2 import base
from neutron import manager
from neutron.openstack.common import log as logging
LOG = logging.getLogger(__name__)
DHCP_HOST = 'dhcp_host'
DHCP_HOSTS = '%ss' % DHCP_HOST
SUBNET = 'm... |
# -*- coding: utf-8 -*-
"""
oauthlib.oauth1.rfc5849.endpoints.request_token
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
This module is an implementation of the request token provider logic of
OAuth 1.0 RFC 5849. It validates the correctness of request token requests,
creates and persists tokens as well as create t... |
# -*- coding: utf-8 -*-
import copy
import csv
import logging
import os
import utility_excel_api as util_xl
from collections import defaultdict
from tables.hdf5extension import VLArray
from util_pretty_print import print_table
#from ExergyUtilities.senegal_process_excel import get_village_row_dict
logging.basicConfig(l... |
"""
/* MD5C.C - RSA Data Security, Inc., MD5 message-digest algorithm
*/
/* Copyright (C) 1991-2, RSA Data Security, Inc. Created 1991. All
rights reserved.
License to copy and use this software is granted provided that it
is identified as the "RSA Data Security, Inc. MD5 Message-Digest
Algorithm" in all material me... |
import socket
import re
import simplejson
import urllib
import urllib2
import urlclean
url = "https://www.virustotal.com/vtapi/v2/url/report"
server = "server"
channel = "#channel"
botnick = "botnick"
ircsock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
ircsock.connect((server, 6667)) #connect to server usin... |
"""Runs RAMCloud system tests. Should be run from the top-level directory
of the RAMCloud source tree.
Notice these tests run on multiple machines throughout the cluster which
has a few implcations. First, you'll need a passwordless ssh logins to
work for your user before you can run these. Second, you'll need ssh
mas... |
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
import datetime
import os
import tarfile
import tempfile
import yaml
from distutils.version import LooseVersion
from shutil import rmtree
import ansible.constants as C
from ansible.errors import AnsibleError
from ansible.module_ut... |
import datetime
from django.conf import settings
from django.contrib.admin.util import lookup_field, display_for_field, label_for_field
from django.contrib.admin.views.main import ALL_VAR, EMPTY_CHANGELIST_VALUE
from django.contrib.admin.views.main import ORDER_VAR, ORDER_TYPE_VAR, PAGE_VAR, SEARCH_VAR
from django.cor... |
""" init database
Revision ID: 1fd68e6d0456
Revises: None
Create Date: 2014-01-10 16:25:30.432738
"""
# revision identifiers, used by Alembic.
revision = '1fd68e6d0456'
down_revision = None
from alembic import op
import sqlalchemy as sa
from sqlalchemy.sql import table, column
def upgrade():
### commands auto... |
from os import path
from django.conf import settings
from django.test import TestCase
from django.contrib.contenttypes.models import ContentType
from regressiontests.views.models import Author, Article, UrlArticle
class DefaultsTests(TestCase):
"""Test django views in django/views/defaults.py"""
fixtures = [... |
from flask import Flask, request, jsonify, render_template, flash, redirect, url_for
from flask_login import LoginManager, login_user, logout_user, current_user, login_required
from ghostwriter.models.modelmanager import ModelManager
app = Flask("ghostwriter");
app.config.from_envvar('GHOSTWRITER_CONFIG')
mm = ModelM... |
import string
# Xlib modules
import X
# Xlib.protocol modules
from Xlib.protocol import rq
class DisplayError(Exception):
def __init__(self, display):
self.display = display
def __str__(self):
return 'Display error "%s"' % self.display
class DisplayNameError(DisplayError):
def __str__(... |
"""
Twisted Python Roots: an abstract hierarchy representation for Twisted.
Maintainer: Glyph Lefkowitz
"""
from __future__ import absolute_import, division
from twisted.python import reflect
from twisted.python._oldstyle import _oldStyle
class NotSupportedError(NotImplementedError):
"""
An exception mean... |
"""This is a sample module that doesn't really test anything all that
interesting.
It simply has a few tests, some of which succeed and some of which fail.
It's important that the numbers remain constant as another test is
testing the running of these tests.
>>> 2+2
4
"""
def foo():
"""
>>> 2+2
5
... |
class Point():
def __init__(self, y_pos=0, x_pos=0, y_velo=0, x_velo=0):
self.x_pos = x_pos
self.y_pos = y_pos
self.x_velo = x_velo
self.y_velo = y_velo
def move(self):
self.x_pos += self.x_velo
self.y_pos += self.y_velo
def bounce(self, grid_size):
... |
"""
raven.transport.threaded
~~~~~~~~~~~~~~~~~~~~~~~~
:copyright: (c) 2010 by the Sentry Team, see AUTHORS for more details.
:license: BSD, see LICENSE for more details.
"""
import atexit
import time
import threading
import os
from Queue import Queue
from raven.transport.base import HTTPTransport
DEFAULT_TIMEOUT = ... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import socket
import struct
import sys
import os
import time
# see com.intellij.idea.SocketLock for the server side of this interface
RUN_PATH = u'$RUN_PATH$'
CONFIG_PATH = u'$CONFIG_PATH$'
SYSTEM_PATH = u'$SYSTEM_PATH$'
def print_usage(cmd):
print(('Usage:\n' +
... |
import re
import lib.config as config
import lib.util as util
from datetime import date
def nick_tracker(log_dict, track_users_on_channels = False):
"""
Tracks all nicks and the identifies nicks which point to same user
Args:
log_dict(dictionary): with key as dateTime.date object and value as... |
# binary to decimal and vice versa
def choice():
ch = input("press 1 : binary to decimal\n"
"press 2 : decimal to binary\n"
": ")
if ch == '1':
print("binary to decimal converion")
number = int(input("enter your number that you want to convert decimal: "))
... |
import mock
from neutron_lib import constants
import testtools
from neutron.common import exceptions
from neutron.privileged.agent.linux import netlink_constants as nl_constants
from neutron.privileged.agent.linux import netlink_lib as nl_lib
from neutron.tests import base
FAKE_ICMP_ENTRY = {'ipversion': 4, 'protocol... |
from django.db import models
from django.utils import timezone
from django.conf import settings
from decimal import Decimal
import time
from django.core.exceptions import ObjectDoesNotExist
class Shift(models.Model):
begin_date = models.DateTimeField(auto_now=True)
finish_date = models.DateTimeField(null=True... |
from __future__ import absolute_import, division, unicode_literals
import re
from xml.sax.saxutils import escape, unescape
from six.moves import urllib_parse as urlparse
from .tokenizer import HTMLTokenizer
from .constants import tokenTypes
content_type_rgx = re.compile(r'''
^
... |
from Algo import KusterToksoz as KT
from numpy import sqrt
def Misat(Vs, Dens):
mis = Vs * Vs * Dens
return mis
def Ksat(Vp, Vs, Dens):
Ks = Dens * (Vp * Vp - 4.0 * Vs * Vs / 3.0)
return Ks
def Dens(Densm, Densf, phi):
dens = (Densm * (1 - phi) + Densf * phi)
return dens
def Kdry(Ksat, K... |
# Utility functions and classes
import configparser
import copy
import datetime
import logging
import os.path
import platform
import queue
import threading
import traceback
#import wxversion
# wxversion.select([x for x in wxversion.getInstalled()
# if x.find('unicode') != -1])
#import wx
import erro... |
from sqlalchemy import Boolean, Column, DateTime, ForeignKey
from sqlalchemy import Integer, MetaData, String, Table
from cinder.openstack.common import log as logging
LOG = logging.getLogger(__name__)
def upgrade(migrate_engine):
meta = MetaData()
meta.bind = migrate_engine
sm_backend_config = Table('... |
import logging
from autotest.client.shared import error
from virttest import utils_test
def run_timedrift_with_migration(test, params, env):
"""
Time drift test with migration:
1) Log into a guest.
2) Take a time reading from the guest and host.
3) Migrate the guest.
4) Take a second time rea... |
from keystone.common import json_home
from keystone.common import wsgi
class Router(wsgi.ComposableRouter):
def __init__(self, controller, collection_key, key,
resource_descriptions=None,
is_entity_implemented=True,
method_template=None):
self.controller ... |
# -*- coding: utf-8 -*-
"""Production settings and globals."""
from __future__ import absolute_import
from os import environ
from .base import *
# Normally you should not import ANYTHING from Django directly
# into your settings, but ImproperlyConfigured is an exception.
from django.core.exceptions import Improperl... |
import sh
import yaml
from claw import tests
class GenerateTest(tests.BaseTestWithInit):
def setUp(self):
super(GenerateTest, self).setUp()
self.inputs = {'some': 'input'}
self.variables = {'a': 'AAA', 'b': 'BBB'}
def test_basic(self):
self._test()
def test_inputs(self)... |
from __future__ import absolute_import, division, print_function
__metaclass__ = type
ANSIBLE_METADATA = {'metadata_version': '1.1',
'status': ['preview'],
'supported_by': 'community'}
try:
import pyrax
HAS_PYRAX = True
except ImportError:
HAS_PYRAX = False
from ... |
import logging
import sys
from os.path import abspath, exists
from string import Template
from tempfile import NamedTemporaryFile
from PyQt4.QtCore import QProcess, QVariant, pyqtSignature
from PyQt4.QtGui import QFileDialog, QFrame, QInputDialog, QMessageBox
from profit.lib import Settings, Signals
from profit.lib.... |
from base64 import urlsafe_b64encode, urlsafe_b64decode
from hashlib import sha256
import json
from Crypto.Cipher import AES
from Crypto import Random
from django.conf import settings
from django.contrib.auth.models import User
from django.core.exceptions import PermissionDenied
from django.http import Http404, HttpRe... |
from django.conf.urls import *
from django.contrib.auth.decorators import login_required, permission_required
from signbank.dictionary.models import *
from signbank.dictionary.forms import *
from signbank.dictionary.adminviews import GlossListView, GlossDetailView
urlpatterns = patterns('',
# index page is jus... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.