content string |
|---|
from __future__ import print_function
import re
import sys
import getopt
import os
import codecs
from xml.dom.minidom import parse
XML_PATH = "/afs/cern.ch/project/inspire/conf-proceedings/contentratechnologies/CONFERENCE_PROCEEDINGs/"
BUFSIZE = 4096
BOMLEN = len(codecs.BOM_UTF8)
def strip_bom(path):
with open(p... |
from spack import *
class RGridextra(RPackage):
"""Provides a number of user-level functions to work with "grid" graphics,
notably to arrange multiple grid-based plots on a page, and draw tables."""
homepage = "https://cran.r-project.org/package=gridExtra"
url = "https://cran.r-project.org/src/c... |
"""
Utility functions for Image transfer.
"""
import os
from nova import exception
from nova.image import glance
from nova.openstack.common.gettextutils import _
from nova.openstack.common import log as logging
from nova.virt.vmwareapi import io_util
from nova.virt.vmwareapi import read_write_util
LOG = logging.getL... |
import json
class RestAPI:
def __init__(self, database=None):
self.database = database or {'users': []}
def update(self):
for user in self.database['users']:
owed_by = user['owed_by']
owes = user['owes']
for debtor in list(owed_by.keys()):
i... |
from sos.report.plugins import Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin
class Snmp(Plugin):
short_desc = 'Simple network management protocol'
plugin_name = "snmp"
profiles = ('system', 'sysmgmt')
files = ('/etc/snmp/snmpd.conf',)
def setup(self):
self.add_copy_spec("/etc/snmp")
... |
import fill_style
import line_style
import copy
def _draw_zap(can, p1, p2, style, pat):
x = copy.deepcopy(p1)
x.extend(p2)
can.polygon(None, pat, x)
can.lines(style, p1)
can.lines(style, p2)
def zap_horizontally(can, style, pat, x1, y1, x2, y2, xsize, ysize):
"""Draw a horizontal "zapping... |
import sys
if sys.platform.startswith('win32'):
import win32gui
GetForegroundWindow = win32gui.GetForegroundWindow
SetForegroundWindow = win32gui.SetForegroundWindow
def SetTopApp():
# Nothing else is necessary for windows.
pass
elif sys.platform.startswith('darwin'):
from Foundat... |
"""Unit tests for the common.py file."""
import gyp.common
import unittest
import sys
class TestTopologicallySorted(unittest.TestCase):
def test_Valid(self):
"""Test that sorting works on a valid graph with one possible order."""
graph = {
'a': ['b', 'c'],
'b': [],
'c': ['d'],
... |
from qgis.PyQt.QtWidgets import QDialog
from MetaSearch.util import get_ui_class
BASE_CLASS = get_ui_class('xmldialog.ui')
class XMLDialog(QDialog, BASE_CLASS):
"""Raw XML Dialogue"""
def __init__(self):
"""init"""
QDialog.__init__(self)
self.setupUi(self) |
"""An implementation of tabbed pages using only standard Tkinter.
Originally developed for use in IDLE. Based on tabpage.py.
Classes exported:
TabbedPageSet -- A Tkinter implementation of a tabbed-page widget.
TabSet -- A widget containing tabs (buttons) in one or more rows.
"""
from tkinter import *
class InvalidN... |
from ....ggettext import gettext as _
#-------------------------------------------------------------------------
#
# GRAMPS modules
#
#-------------------------------------------------------------------------
from .. import Rule
#-------------------------------------------------------------------------
#
# HasAlterna... |
"""Interprocedural transformation passes"""
from graph import Graph
from core import is_addr
import progdb
from utils import maybesorted
import utils
def build_callgraph():
"Build program callgraph from progdb."
callgraph = Graph()
for addr, props in progdb.FUNC_DB_BY_ADDR.items():
callgraph.ad... |
from parsl.config import Config
from parsl.launchers import SrunLauncher
from parsl.providers import SlurmProvider
from parsl.executors import HighThroughputExecutor
from .user_opts import user_opts
def fresh_config():
return Config(
executors=[
HighThroughputExecutor(
label='C... |
from . import utils
from .path import *
from .pathFinder import *
import copy
class ConnectivityMatrix:
def __init__(self, graph):
self._graph = graph
self._paths = []
self._nodes = []
self._initialMatrix = []
self._matrix = []
self._rowLabels = []
self._... |
#!/usr/bin/env python
# -*- encoding: utf-8 -*-
# vim: set et sw=4 ts=4 sts=4 ff=unix fenc=utf8:
# http://binux.me
# Created on 2014-02-15 22:10:35
import os
import json
import copy
import time
import umsgpack
import subprocess
import unittest2 as unittest
from multiprocessing import Queue
import logging
impo... |
"""DNS name dictionary"""
import dns.name
class NameDict(dict):
"""A dictionary whose keys are dns.name.Name objects.
@ivar max_depth: the maximum depth of the keys that have ever been
added to the dictionary.
@type max_depth: int
"""
def __init__(self, *args, **kwargs):
super(NameDi... |
from __future__ import (absolute_import, division, print_function,
unicode_literals)
import six
import difflib
import os
from matplotlib import rcParams, rcdefaults, use
_multiprocess_can_split_ = True
# Check that the test directories exist
if not os.path.exists(os.path.join(
os.... |
#!/usr/bin/env python
"""Tests for Windows Volume Shadow Copy flow."""
import stat
from grr.lib import aff4
from grr.lib import flags
from grr.lib import test_lib
# needed for ListVolumeShadowCopies pylint: disable=unused-import
from grr.lib.flows.general import windows_vsc
# pylint: enable=unused-import
from grr.lib.... |
import os, subprocess, logging
from i18n.config import BASE_DIR
LOG = logging.getLogger(__name__)
def execute(command, working_directory=BASE_DIR):
"""
Executes shell command in a given working_directory.
Command is a string to pass to the shell.
Output is ignored.
"""
LOG.info("Executing in ... |
""" Cookbook recipe 500261, Raymond Hettinger, planned for inclusion in 2.6 :
http://docs.python.org/dev/library/collections.html#collections.namedtuple """
from operator import itemgetter as _itemgetter
from keyword import iskeyword as _iskeyword
import sys as _sys
__all__ = ['namedtuple']
def namedtuple(typenam... |
"""
Example producer that sends a single message and exits.
You can use `complete_receive.py` to receive the message sent.
"""
from kombu import Connection, Producer, Exchange, Queue
#: By default messages sent to exchanges are persistent (delivery_mode=2),
#: and queues and exchanges are durable.
exchange = Exchan... |
import re
import os
import requests
from urllib.parse import urlparse
from django.core.management.base import BaseCommand
from django.conf import settings
from django.core.files import File
from ...models import Page, Image, page_image_path
class Command(BaseCommand):
""" Fix success story page images """
... |
import theano
from theano import tensor as T
from theano.sandbox.rng_mrg import MRG_RandomStreams as RandomStreams
import numpy as np
from load import mnist
from theano.tensor.nnet.conv import conv2d
from theano.tensor.signal.downsample import max_pool_2d
import matplotlib.pyplot as plt
from mpl_toolkits.axes_grid1 imp... |
"""
Maps Symbol typeface to Unicode, extracted from http://en.wikipedia.org/wiki/Symbol_(typeface)
"""
from __future__ import absolute_import
import codecs
import six
from six.moves import map
decodeTable = {
32: 32,
33: 33, 34: 8704, 35: 35, 36: 8707, 37: 37, 38: 38, 39: 8717, 40: 40, 41: 41, 42: 42, 43: 43... |
import warnings
from unittest import skipIf
from django.test import SimpleTestCase
from ..utils import setup
try:
import numpy
except ImportError:
numpy = False
@skipIf(numpy is False, "Numpy must be installed to run these tests.")
class NumpyTests(SimpleTestCase):
# Ignore numpy deprecation warnings (... |
"""
Support for interactive mode to allow VisPy's event loop to be run alongside
a console terminal, without using threads. This code relies on inputhooks
built-in to the Python interpreter, and supports IPython too. The underlying
inputhook implementation is from IPython 3.x.
Note that IPython notebook integration i... |
from __future__ import unicode_literals
"""docfield utililtes"""
import frappe
def rename(doctype, fieldname, newname):
"""rename docfield"""
df = frappe.db.sql("""select * from tabDocField where parent=%s and fieldname=%s""",
(doctype, fieldname), as_dict=1)
if not df:
return
df = df[0]
if frappe.db.get... |
import math
import m5
from m5.objects import *
from m5.defines import buildEnv
from Ruby import create_topology
from Ruby import send_evicts
#
# Declare caches used by the protocol
#
class L0Cache(RubyCache): pass
class L1Cache(RubyCache): pass
class L2Cache(RubyCache): pass
def define_options(parser):
parser.add... |
"""Word completion for GNU readline.
The completer completes keywords, built-ins and globals in a selectable
namespace (which defaults to __main__); when completing NAME.NAME..., it
evaluates (!) the expression up to the last dot and completes its attributes.
It's very cool to do "import sys" type "sys.", hit the com... |
try:
import boto.ec2
HAS_BOTO=True
except ImportError:
HAS_BOTO=False
import json
def main():
argument_spec = ec2_argument_spec()
argument_spec.update(dict(
region = dict(required=True,
aliases = ['aws_region', 'ec2_region']),
owner = dict(required=False, de... |
import sys
import vcstools
from wstool.config_yaml import get_path_spec_from_yaml
def checkout_rosinstall(rosinstall_data, verbose=False):
"""
:param rosinstall_data: yaml dict in rosinstall format
:raises: rosinstall.common.MultiProjectException for incvalid yaml
"""
for frag in rosinstall_data:
... |
"""
The sax module contains a collection of classes that provide a
(D)ocument (O)bject (M)odel representation of an XML document.
The goal is to provide an easy, intuative interface for managing XML
documents. Although, the term, DOM, is used above, this model is
B{far} better.
XML namespaces in suds are represented ... |
from oslo_config import cfg
from oslo_log import log as logging
from oslo_utils import timeutils
import six
from nova.i18n import _, _LE
from nova.servicegroup import api
from nova.servicegroup.drivers import base
CONF = cfg.CONF
CONF.import_opt('service_down_time', 'nova.service')
LOG = logging.getLogger(__name__)... |
import sys
import os
helpers_dir = os.getenv("PYCHARM_HELPERS_DIR", sys.path[0])
if sys.path[0] != helpers_dir:
sys.path.insert(0, helpers_dir)
from nose_utils import TeamcityPlugin
from pycharm_run_utils import debug, import_system_module
from pycharm_run_utils import adjust_sys_path
adjust_sys_path(False)
sh... |
'''
Demonstrate use of a log color scale in contourf
'''
from matplotlib import pyplot as P
import numpy as np
from numpy import ma
from matplotlib import colors, ticker, cm
from matplotlib.mlab import bivariate_normal
N = 100
x = np.linspace(-3.0, 3.0, N)
y = np.linspace(-2.0, 2.0, N)
X, Y = np.meshgrid(x, y)
# A ... |
#@ignore
#@language python
#@ignore
#@language python
"""
Package: Karrigell_QuickForm-1.0.1-alpha
Requirements: Karrigell HTTP Server - http://karrigell.sourceforge.net
Description: - A simple class that generates html forms with some basic javascript validations.
- It is similar to HTML_QuickForm... |
# -*- coding: utf-8 -*-
"""
***************************************************************************
pyuic-wrapper.py
---------------------
Date : March 2016
Copyright : (C) 2016 by Juergen E. Fischer
Email : jef at norbit dot de
************************... |
from __future__ import (absolute_import, division, print_function,
unicode_literals)
import six
import numpy as np
from matplotlib.testing.decorators import image_comparison, cleanup
import matplotlib.pyplot as plt
import matplotlib.patheffects as path_effects
try:
# mock in python 3.3+
... |
# -*- coding: utf-8 -*-
from __future__ import absolute_import, unicode_literals
from ....unittest import TestCase
import datetime
from oauthlib import common
from oauthlib.oauth2.rfc6749 import utils
from oauthlib.oauth2 import Client
from oauthlib.oauth2 import InsecureTransportError
from oauthlib.oauth2.rfc6749.cli... |
import web
from web import form
import socket
import RPi.GPIO as GPIO
import time
from threading import Thread
from threading import Lock
localhost = "http://" + socket.gethostbyname(socket.gethostname()) + ":8080"
print(localhost)
global infrared, ultrasonic, servomotor, motor_L1, motor_L2, motor_R1, motor_R2... |
"""This module represents the Greek language.
.. seealso:: http://en.wikipedia.org/wiki/Greek_language
"""
import re
from translate.lang import common
class el(common.Common):
"""This class represents Greek."""
# Greek uses ; as question mark and the middot instead
sentenceend = u".!;…"
sentencer... |
from random import randint
from identityprovider.models.account import Account, LPOpenIdIdentifier
from identityprovider.models.const import (
AccountCreationRationale,
AccountStatus,
)
from identityprovider.models.person import Person
from identityprovider.models.team import TeamParticipation
from identitypro... |
# -*- coding: utf-8 -*-
# taken from requests library: https://github.com/kennethreitz/requests
"""
pythoncompat
"""
import sys
# -------
# Pythons
# -------
# Syntax sugar.
_ver = sys.version_info
#: Python 2.x?
is_py2 = (_ver[0] == 2)
#: Python 3.x?
is_py3 = (_ver[0] == 3)
#: Python 3.0.x
is_py30 = (is_py3 and... |
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
import json
from ansible.compat.tests.mock import patch
from ansible.modules.network.nxos import nxos_bgp_af
from .nxos_module import TestNxosModule, load_fixture, set_module_args
class TestNxosBgpAfModule(TestNxosModule):
... |
import logging
import time
import pystache
from flask import request
from authentication import current_org
from flask_login import current_user, login_required
from flask_restful import abort
from redash import models, utils
from redash.handlers import routes
from redash.handlers.base import (get_object_or_404, org_... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
import sys
from django.contrib.auth.models import Group
from django.core import urlresolvers
from django.template import Context, Engine, TemplateSyntaxError
from django.template.base import UNKNOWN_SOURCE
from django.test import SimpleTestCase, override... |
data = (
'Po ', # 0x00
'Feng ', # 0x01
'Zhuan ', # 0x02
'Fu ', # 0x03
'She ', # 0x04
'Ke ', # 0x05
'Jiang ', # 0x06
'Jiang ', # 0x07
'Zhuan ', # 0x08
'Wei ', # 0x09
'Zun ', # 0x0a
'Xun ', # 0x0b
'Shu ', # 0x0c
'Dui ', # 0x0d
'Dao ', # 0x0e
'Xiao ', # 0x0f
'Ji ', # 0x10... |
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
import json
from ansible.compat.tests.mock import patch
from ansible.modules.network.nxos import nxos_ospf
from .nxos_module import TestNxosModule, load_fixture, set_module_args
class TestNxosOspfModule(TestNxosModule):
mod... |
"""
Test the various password reset flows
"""
import json
import re
import unittest
from django.core.cache import cache
from django.conf import settings
from django.test import TestCase
from django.test.client import RequestFactory
from django.contrib.auth.models import User
from django.contrib.auth.hashers import UNU... |
import json
from django.contrib.messages import constants
from django.contrib.messages.tests.base import BaseTest
from django.contrib.messages.storage.cookie import (CookieStorage,
MessageEncoder, MessageDecoder)
from django.contrib.messages.storage.base import Message
from django.test.utils import override_settin... |
import unittest
import numpy
import chainer
from chainer.backends import cuda
from chainer import functions
from chainer import gradient_check
from chainer import links
from chainer import testing
from chainer.testing import attr
class TestHighway(unittest.TestCase):
in_out_size = 3
def setUp(self):
... |
# -*- 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 'Category'
db.create_table(u'sampleapp_category', (
... |
def __boot():
import sys
import os
PYTHONPATH = os.environ.get('PYTHONPATH')
if PYTHONPATH is None or (sys.platform=='win32' and not PYTHONPATH):
PYTHONPATH = []
else:
PYTHONPATH = PYTHONPATH.split(os.pathsep)
pic = getattr(sys,'path_importer_cache',{})
stdpath = sys.path[le... |
import sys
import unittest
from cStringIO import StringIO
import pytest
from .. import parser, serializer
class TokenizerTest(unittest.TestCase):
def setUp(self):
self.serializer = serializer.ManifestSerializer()
self.parser = parser.Parser()
def serialize(self, input_str):
return ... |
import portal
import mail_thread
import mail_mail
import mail_message
import wizard
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: |
from pyoko.db.adapter.db_riak import BlockSave
from ulakbus.models import User, DersEtkinligi, SinavEtkinligi, Donem, Room
from zengine.lib.test_utils import BaseTestCase
import time
class TestCase(BaseTestCase):
def test_ders_programi_yap(self):
usr = User.objects.get(username='ders_programi_koordinato... |
# -*- coding: utf-8 -*-
from aiohttp.web_exceptions import HTTPMethodNotAllowed
from aiohttp.web_exceptions import HTTPNotFound
from aiohttp.web_exceptions import HTTPUnauthorized
from dateutil.tz import tzlocal
from plone.server import app_settings
from plone.server import configure
from plone.server import _
from plo... |
from wtforms.widgets import HTMLString, TextArea
pagedown_pre_html = '<div class="flask-pagedown">'
pagedown_post_html = '</div>'
preview_html = '''
<div class="flask-pagedown-preview" id="flask-pagedown-%(field)s-preview"></div>
<script type="text/javascript">
f = function() {
if (typeof flask_pagedown_converter ... |
import test.support, unittest
class PowTest(unittest.TestCase):
def powtest(self, type):
if type != float:
for i in range(-1000, 1000):
self.assertEqual(pow(type(i), 0), 1)
self.assertEqual(pow(type(i), 1), type(i))
self.assertEqual(pow(type(0), ... |
# -*- coding: utf-8 -*-
"""
jinja2.testsuite.utils
~~~~~~~~~~~~~~~~~~~~~~
Tests utilities jinja uses.
:copyright: (c) 2010 by the Jinja Team.
:license: BSD, see LICENSE for more details.
"""
import gc
import pytest
import pickle
from jinja2.utils import LRUCache, escape, object_type_repr
@pyt... |
"""
Copyright (c) 2015-2020 Raj Patel(<EMAIL>), StopStalk
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, c... |
from gnuradio import gr, gr_unittest
import os
from os.path import getsize
g_in_file = os.path.join (os.getenv ("srcdir"), "test_16bit_1chunk.wav")
class test_wavefile(gr_unittest.TestCase):
def setUp (self):
self.tb = gr.top_block ()
def tearDown (self):
self.tb = None
def test_001_ch... |
import importlib
import json
import os
import gettext as gettext_module
from django import http
from django.apps import apps
from django.conf import settings
from django.template import Context, Template
from django.utils.translation import check_for_language, to_locale, get_language, LANGUAGE_SESSION_KEY
from django.... |
"""
Classes representing uploaded files.
"""
import os
from io import BytesIO
from django.conf import settings
from django.core.files.base import File
from django.core.files import temp as tempfile
from django.utils.encoding import force_str
__all__ = ('UploadedFile', 'TemporaryUploadedFile', 'InMemoryUploadedFile',... |
"""
Preliminary module to handle fortran formats for IO. Does not use this outside
scipy.sparse io for now, until the API is deemed reasonable.
The *Format classes handle conversion between fortran and python format, and
FortranFormatParser can create *Format instances from raw fortran format
strings (e.g. '(3I4)', '(... |
from __future__ import unicode_literals
import frappe
from frappe import _
from frappe.utils import cint, get_link_to_form
from frappe.model.document import Document
class AssetCategory(Document):
def validate(self):
self.validate_finance_books()
self.validate_account_types()
self.validate_account_currency()
... |
from __future__ import unicode_literals
from __future__ import print_function
from __future__ import division
from __future__ import absolute_import
#
# In the current iteration, there is a client object that can be loaded from
# the filesystem into the database and its settings loaded from the database.
# There are no... |
import chainerx
# TODO(sonots): Implement in C++
def square(x):
"""Returns the element-wise square of the input.
Args:
x (~chainerx.ndarray or scalar): Input data
Returns:
~chainerx.ndarray: Returned array: :math:`y = x * x`.
A scalar is returned if ``x`` is a scalar.
Note:
... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from migrate.exceptions import *
from migrate.versioning.version import *
from migrate.tests import fixture
class TestVerNum(fixture.Base):
def test_invalid(self):
"""Disallow invalid version numbers"""
versions = ('-1', -1, 'Thirteen', '')
f... |
import re, sys
#----------------------------------------------------------------
# These are all of the public functions exported from libsndfile.
#
# Its important not to change the order they are listed in or
# the ordinal values in the second column.
ALL_SYMBOLS = (
( "sf_command", 1 ),
( "sf_open", 2 ),
( ... |
from __future__ import absolute_import, division, print_function
__metaclass__ = type
ANSIBLE_METADATA = {'metadata_version': '1.1',
'status': ['preview'],
'supported_by': 'community'}
import traceback
from ansible.module_utils.basic import AnsibleModule
from ansible.module_... |
import IPython, graphviz, re
from io import StringIO
from IPython.display import Image
import numpy as np
import pandas as pd
import math
from sklearn import tree
from sklearn.datasets import load_boston, load_iris
from collections import defaultdict
import string
import re
YELLOW = "#fefecd" # "#fbfbd0" # "#FBFEB0"
B... |
STDOUT = -11
STDERR = -12
try:
from ctypes import windll
from ctypes import wintypes
except ImportError:
windll = None
SetConsoleTextAttribute = lambda *_: None
else:
from ctypes import (
byref, Structure, c_char, c_short, c_uint32, c_ushort, POINTER
)
class CONSOLE_SCREEN_BUFFER_I... |
# -*- coding: utf-8 -*-
from django.utils.encoding import smart_str
class Menu(object):
namespace = None
def __init__(self):
if not self.namespace:
self.namespace = self.__class__.__name__
def get_nodes(self, request):
"""
should return a list of NavigationNode in... |
import PyQt4
from PyQt4.QtCore import Qt, QObject, SIGNAL, QUrl, QTimer
from PyQt4.QtGui import *
from core.crawler.SpiderPageController import SpiderPageController
from core.network.InMemoryCookieJar import InMemoryCookieJar
class CrawlerTab(QObject):
def __init__(self, framework, mainWindow):
QObject._... |
import pecan
from oslo_config import cfg
from tricircle.common.i18n import _
from tricircle.common import restapp
common_opts = [
cfg.IPOpt('bind_host', default='0.0.0.0',
help=_("The host IP to bind to")),
cfg.PortOpt('bind_port', default=19999,
help=_("The port to bind to")),... |
# Parse Stripe payment info via exported payments.csv files
import sys
from datetime import tzinfo, timedelta, datetime
# TODO: use stripe_customers.csv to match payments to our db data
# Stripe file format
# id,Description,Created (UTC),Amount,Amount Refunded,Currency,Converted Amount,Converted Amount Refunded,Fee,... |
import unittest
from mock import patch, PropertyMock
from airflow.operators.hive_to_mysql import HiveToMySqlTransfer
from airflow.utils.operator_helpers import context_to_airflow_vars
class TestHiveToMySqlTransfer(unittest.TestCase):
def setUp(self):
self.kwargs = dict(
sql='sql',
... |
import bpy
import math
import sys
import os
import stat
import bmesh
import time
import random
from bpy_extras.object_utils import world_to_camera_view
##------------------------ SEARCH AND SELECT ------------------------
## SETEO VARIABLE DE ENTORNO
bpy.types.Scene.SearchAndSelectOt = bpy.props.StringProperty(defaul... |
"""CSS Selectors based on XPath.
This module supports selecting XML/HTML tags based on CSS selectors.
See the `CSSSelector` class for details.
This is a thin wrapper around cssselect 0.7 or later.
"""
from __future__ import absolute_import
from . import etree
try:
import cssselect as external_cssselect
except I... |
from __future__ import absolute_import, division, print_function, unicode_literals
from future.builtins import *
import mock
import unittest
from gimp import pdb
import gimpenums
from export_layers import pygimplib as pg
from export_layers import builtin_procedures
from export_layers.pygimplib.tests import stubs_g... |
#!/usr/bin/env python2.7
import argparse
from modules.compute_ownership_graph import COMPUTE_OWNERSHIP
from modules.compute_symbology import TO_SYMBOLOGY
from modules.add_sic_descs import ADD_SIC_DESCRIPTION
from modules.enrich_terminal_nodes import ENRICH_TERMINAL_NODES
from generic.generic_meta_enrich import GENERI... |
from __future__ import absolute_import, division, print_function
__metaclass__ = type
ANSIBLE_METADATA = {'metadata_version': '1.1',
'status': ['preview'],
'supported_by': 'community'}
from distutils.version import StrictVersion
try:
import shade
HAS_SHADE = True
exc... |
import unittest
import GafferDispatch
import GafferDispatchUI
import GafferUITest
class NodeUITest( GafferUITest.TestCase ) :
def testLifetimes( self ) :
self.assertNodeUIsHaveExpectedLifetime( GafferDispatch )
if __name__ == "__main__":
unittest.main() |
from numpy import log, pi as pi_num, exp
import sys
def best_path(probs, pi, T):
"""
Viterbi algorithm with backpointers
"""
n = len(T)
m = len(probs[0])
log_V = [[0. for _ in xrange(m)] for _ in xrange(n)]
backpt = [[0 for _ in xrange(m)] for _ in xrange(n)]
states = [0 fo... |
# -*- coding: utf-8 -*-
"""
***************************************************************************
TextToFloat.py
---------------------
Date : May 2010
Copyright : (C) 2010 by Michael Minn
Email : pyqgis at michaelminn dot com
*************************... |
import re
import logging
import threading
from bs4 import BeautifulSoup
from modules import Module
class TitleModule(Module):
name = "URLTitle"
description = "Automatically gets titles of URLs posted in channels."
def module_init(self, bot):
self.hook_numeric("PRIVMSG", self.on_privmsg)
def... |
from __future__ import print_function
a = '''cdef void glActiveTexture (cgl.GLenum texture)
cdef void glAttachShader (cgl.GLuint program, cgl.GLuint shader)
cdef void glBindAttribLocation (cgl.GLuint program, cgl.GLuint index, cgl.GLchar* name)
cdef void glBindBuffer (cgl.GLenum target, cgl.GLuint buffer)
cde... |
from django.contrib import admin
from django.contrib.contenttypes import generic
from django.db.models import Q
from models import Member, Membership, MemberAltname
from models import CoalitionMembership, Correlation, Party, \
Award, AwardType, Knesset
from links.models import Link
from video.models import Video
f... |
# -*- coding: utf-8 -*-
import 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 'Developer'
db.create_table('frontend_developer', (
('id', self.gf('django.db.mod... |
import os
import inflector
from waflib.ConfigSet import ConfigSet
from waflib import Utils
__all__ = [
"check_pkg_config", "check_cc", "check_statement", "check_libs",
"check_headers", "compose_checks", "check_true", "any_version",
"load_fragment", "check_stub", "check_ctx_vars", "check_program"]
any_vers... |
"""
LTI user management functionality. This module reconciles the two identities
that an individual has in the campus LMS platform and on edX.
"""
import string
import random
import uuid
from django.conf import settings
from django.contrib.auth import authenticate, login
from django.contrib.auth.models import User
fr... |
# coding: utf-8
import os
import leveldb
import logging
class DictLexicon(object):
TERM_FREQ_SEP = chr(255)
LEX_DIR_NAME = "dict.lexicon.ldb"
def __init__(self, root_dir):
self.term_dict = dict()
self.root_dir = root_dir
self.lexicon_root = os.path.join(self.root_dir, self.LEX_DI... |
import math
import bitify.python.utils.i2cutils as I2CUtils
class HMC5883L(object):
'''
Simple HMC5883L implementation
'''
TWO_PI = 2 * math.pi
CONF_REG_A = 0
CONF_REG_B = 1
MODE_REG = 2
DATA_START_BLOCK = 3
DATA_XOUT_H = 0
DATA_XOUT_L = 1
DATA_ZOUT_H = 2
DATA_ZOUT_L =... |
'''A baseclass for simple gatherers based on regular expressions.
'''
import re
from grit.gather import skeleton_gatherer
class RegexpGatherer(skeleton_gatherer.SkeletonGatherer):
'''Common functionality of gatherers based on parsing using a single
regular expression.
'''
DescriptionMapping_ = {
'CAP... |
from __future__ import absolute_import, division, print_function, \
with_statement
import os
import sys
import argparse
if __name__ == '__main__':
parser = argparse.ArgumentParser(description='See README')
parser.add_argument('-c', '--count', default=3, type=int,
help='with how man... |
from test_framework import BitcoinTestFramework
from bitcoinrpc.authproxy import AuthServiceProxy, JSONRPCException
from util import *
import os
import shutil
class ForkNotifyTest(BitcoinTestFramework):
alert_filename = None # Set by setup_network
def setup_network(self):
self.nodes = []
sel... |
#!/usr/bin/env python
#encoding: UTF-8
'''
网易云音乐 Menu
'''
import curses
import locale
import sys
import os
import json
import time
import webbrowser
from .api import NetEase
from .player import Player
from .ui import Ui
home = os.path.expanduser("~")
if os.path.isdir(home + '/netease-musicbox') is False:
os.mkd... |
"""An example functional test
The module-level docstring should include a high-level description of
what the test is doing. It's the first thing people see when they open
the file and should give the reader information about *what* the test
is testing and *how* it's being tested
"""
# Imports should be in PEP8 orderin... |
from tools.docco.rl_doc_utils import *
from reportlab.lib.codecharts import SingleByteEncodingChart
from reportlab.platypus import Image
import reportlab
heading1("Fonts and encodings")
disc("""
This chapter covers fonts, encodings and Asian language capabilities.
If you are purely concerned with generating PDFs for ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.