content stringlengths 4 20k |
|---|
#! /usr/bin/env python
#
# bindlink.py
#
"""
Example of how to use the pattern matcher.
Based on the following example in the wiki:
http://wiki.opencog.org/w/Pattern_matching#The_Simplified_API
"""
__author__ = 'Cosmo Harrigan'
from opencog.atomspace import AtomSpace
from opencog.scheme_wrapper import load_scm, schem... |
import json
import re
from util import hook, http, text, web
## CONSTANTS
ITEM_URL = "http://www.newegg.com/Product/Product.aspx?Item={}"
API_PRODUCT = "http://www.ows.newegg.com/Products.egg/{}/ProductDetails"
API_SEARCH = "http://www.ows.newegg.com/Search.egg/Advanced"
NEWEGG_RE = (r"(?:(?:www.newegg.com|newegg... |
from __future__ import absolute_import
import unittest
import bokeh.colors as colors
class TestColor(unittest.TestCase):
def test_basic(self):
c = colors.Color()
assert c
def test_abstract(self):
c = colors.Color()
self.assertRaises(NotImplementedError, c.to_css)
sel... |
from default import Test, db, with_context
from factories import AppFactory, TaskFactory, UserFactory
from factories import reset_all_pk_sequences
from mock import patch
def configure_mock_current_user_from(user, mock):
def is_anonymous():
return user is None
mock.is_anonymous.return_value = is_anony... |
from django.shortcuts import render_to_response
from django.http import HttpResponseRedirect
from django.contrib import auth
from django.core.context_processors import csrf
from forms import RegistrationForm, LoginForm, PostForm, SearchForm
from models import User, Post , Photo
from django.views.generic import ListVie... |
maxtick = 10000000000 |
from __future__ import absolute_import
import github.GithubObject
class HookDescription(github.GithubObject.NonCompletableGithubObject):
"""
This class represents HookDescriptions
"""
def __repr__(self):
return self.get__repr__({"name": self._name.value})
@property
def events(self):... |
import tornado.ioloop
import tornado.web
import tornado.gen
from datetime import timedelta
import chu.rpc
@tornado.gen.engine
def simple_rpc():
# Make sure you have rabbitmq running locally, or modify localhost
client = chu.rpc.AsyncTornadoRPCClient(host='localhost')
# The params passed to RPCRequest are ... |
from django.test import TestCase
from django.conf import settings
from django.core.urlresolvers import reverse
from django.contrib.auth import get_user_model
User = get_user_model()
class TestUrls(TestCase):
USERNAME = 'jmcgill'
PASSWORD = 'slippin_jimmy'
PROTECTED_URL_NAME = 'dashboard:index'
def ... |
from __future__ import unicode_literals
class HACStop(object):
"""Stopping criterion for hierarchical agglomerative clustering"""
def __init__(self):
super(HACStop, self).__init__()
def initialize(self, parent=None):
"""(Optionally) initialize stopping criterion
Parameters
... |
"""Config flow for ONVIF."""
from pprint import pformat
from typing import List
from urllib.parse import urlparse
from onvif.exceptions import ONVIFError
import voluptuous as vol
from wsdiscovery.discovery import ThreadedWSDiscovery as WSDiscovery
from wsdiscovery.scope import Scope
from wsdiscovery.service import Ser... |
import random
import unittest
import numpy
from scipy.stats import chi2_contingency
import qiskit.backends.local.projectq_simulator as projectq_simulator
import qiskit.backends.local.qasmsimulator as qasm_simulator
from qiskit import QuantumJob
from qiskit import QuantumProgram
from qiskit import QuantumCircuit
from ... |
# -*- coding: utf-8 -*-
"""
/***************************************************************************
Name : DB Manager
Description : Database manager plugin for QGIS
Date : May 23, 2011
copyright : (C) 2011 by Giuseppe Sucameli
email : <EMAIL>
**... |
from __future__ import division
from random import shuffle
import collect_ncs_files
import cPickle as pickle
from glob import glob
import os
def run():
c = collect_ncs_files.ncs_paper_data_collection()
d = c.collect_all_file_records()
print 'Total number of files in data dir:',len(d)
file_list = glob(os.path.... |
import datetime
import pytest
from databot import this, utcnow, strformat
from databot.expressions.base import ExpressionError
def test_re():
assert this.re('\d+').cast(int)._eval('42 comments') == 42
assert this.re('(\d+)').cast(int)._eval('42 comments') == 42
with pytest.raises(ExpressionError):
... |
#!/usr/bin/env python
"""ksgen generates settings based on the settings directory.
Usage:
ksgen -h | --help
ksgen [options] <command> [<args> ...]
Options:
--log-level=<log-level> Log levels: debug, info, warning
error, critical
... |
"""The share snapshots api."""
from oslo_log import log
import webob
from webob import exc
from manila.api import common
from manila.api.openstack import wsgi
from manila.api.views import share_snapshots as snapshot_views
from manila import db
from manila import exception
from manila.i18n import _, _LI
from manila im... |
import inspect
import invocation
from mock_registry import mock_registry
class Dummy(object): pass
class Mock(object):
def __init__(self, mocked_obj=None, strict=True):
self.invocations = []
self.stubbed_invocations = []
self.original_methods = []
self.stubbing = None
self.verifi... |
from django.contrib.auth import get_user_model
from django.test.client import RequestFactory
import random
import string
def random_user():
return get_user_model().objects.create_user(
''.join(random.choice(string.lowercase) for _ in range(12)))
def create_superuser():
get_user_model().objects.cre... |
# util.py
# -------
# Licensing Information: Please do not distribute or publish solutions to this
# project. You are free to use and extend these projects for educational
# purposes. The Pacman AI projects were developed at UC Berkeley, primarily by
# John DeNero (<EMAIL>) and Dan Klein (<EMAIL>).
# For more info, see... |
from pyspark.ml.feature import Interaction, VectorAssembler
# $example off$
from pyspark.sql import SparkSession
if __name__ == "__main__":
spark = SparkSession\
.builder\
.appName("InteractionExample")\
.getOrCreate()
# $example on$
df = spark.createDataFrame(
[(1, 1, 2, 3... |
import time
import types
# 3p
import bson
from pymongo import (
MongoClient,
ReadPreference,
errors,
uri_parser,
version as py_version,
)
# project
from checks import AgentCheck
DEFAULT_TIMEOUT = 10
class LocalRate:
"""To be used for metrics that should be sent as rates but that we want to ... |
"""Tests for the layout module."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import numpy as np
import tensorflow as tf
from tensorboard.backend.event_processing import plugin_event_multiplexer as event_multiplexer # pylint: disable=line-too-long
fr... |
import BaseHTTPServer
from collections import namedtuple
import mimetypes
import os
import SimpleHTTPServer
import SocketServer
import sys
import zlib
ByteRange = namedtuple('ByteRange', ['from_byte', 'to_byte'])
ResourceAndRange = namedtuple('ResourceAndRange', ['resource', 'byte_range'])
class MemoryCacheHTTPRequ... |
import mysql.connector
import Utility
from DatabaseAdapter import *
class CommentHelper:
def __init__(self,dbAdapter):
self.dbAdapter = dbAdapter
'''get all comments by author id'''
def getCommentsForAuthor(self,aid):
cur = self.dbAdapter.getcursor()
query =("SELECT "
... |
#Script that compares entity-linking with annotated biomedical texts
import os
from pathlib import Path
import json
def is_number(s):
try:
int(s)
return True
except ValueError:
return False
def get_entities(text):
import urllib.request
import urllib.parse
q_dict = {'lang': ... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from itertools import groupby
from django import forms
from django.contrib.auth import get_user_model
from django.contrib.auth.forms import (
AuthenticationForm,
PasswordResetForm as djangoPasswordResetForm,
)
from django.contrib.auth.tokens impor... |
from toee import *
from utilities import *
def OnBeginSpellCast( spell ):
print "Healing Circle OnBeginSpellCast"
print "spell.target_list=", spell.target_list
print "spell.caster=", spell.caster, " caster.level= ", spell.caster_level
game.particles( "sp-conjuration-conjure", spell.caster )
def OnSpellEffect ( ... |
# /usr/bin/python
# To run this test you need python nose tools installed
# Run test just use:
# nosetest test_optional.py
#
import os, sys, pickle
from SimpleCV import *
from nose.tools import with_setup, nottest
SHOW_WARNING_TESTS = False # show that warnings are working - tests will pass but warnings are genera... |
import unittest
import numpy
import chainer
from chainer.backends import cuda
from chainer import functions
from chainer import testing
from chainer.testing import attr
from chainer.utils import force_array
from chainer.utils import type_check
def r2_score(pred, true, sample_weight=None, multioutput='uniform_averag... |
from django.utils.six import StringIO
from django.utils.encoding import iri_to_uri
from django.template.loader import render_to_string
class TimemapLinkListGenerator(object):
"""
Base class for creating a timemap.
"""
mime_type = 'application/link-format; charset=utf-8'
template_name = "memento/ti... |
# -*- coding:utf-8 -*-
__author__ = 'Ulric Qin'
from .bean import Bean
from frame.store import db
from .host import Host
class GroupHost(Bean):
_tbl = 'grp_host'
_cols = 'grp_id, host_id'
def __init__(self, grp_id, host_id):
self.grp_id = grp_id
self.host_id = host_id
@classmethod
... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Date : 2015-06-01 18:54:19
# @Author : Weizhong Tu (<EMAIL>)
# @Link : http://www.tuweizhong.com
import re
from xlrd import open_workbook
class OpenExcel:
'''
#Usage:
import OpenExcel
f = OpenExcel(path) #default sheet(1) you can use `f = OpenEx... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
'''
1457. Heating Main
Time limit: 1.0 second
Memory limit: 64 MB
[Description]
Background
I like my hometown very much. Those dilapidated buildings rising proudly above
the city and streets dug up as far back as the last century inspire me greatly.
Crowds of everlastingly of... |
"""mimerender example for webapp2. Run this server and then try:
$ curl -iH "Accept: application/html" localhost:8080/x
...
Content-Type: text/html
...
<html><body>Hello, x!</body></html>
$ curl -iH "Accept: application/xml" localhost:8080/x
...
Content-Type: application/xml
...
... |
from chowdren.writers.objects import ObjectWriter
from mmfparser.bitdict import BitDict
from chowdren.common import get_animation_name, to_c, make_color
from chowdren.writers.events import (ComparisonWriter, ActionMethodWriter,
ConditionMethodWriter, ExpressionMethodWriter, make_table)
from chowdren.writers.exte... |
"""Various tools used by MIME-reading or MIME-writing programs."""
import os
import rfc822
import tempfile
__all__ = ["Message","choose_boundary","encode","decode","copyliteral",
"copybinary"]
class Message(rfc822.Message):
"""A derived class of rfc822.Message that knows about MIME headers... |
import ConfigParser
import operator
import os
import sys
import wx
import launcher
class MainTable(object):
"""Our main model (MVC), consisting of our list of projects."""
def __init__(self, filename=None):
"""Create a new MainTable."""
# self._projects: an array of Projects in this table
self._proje... |
__author__ = 'yutao'
PROXIES = [
{"ip_port":"218.94.149.114:8080"},
{"ip_port":"202.51.120.58:8080"},
{"ip_port":"180.244.214.180:8080"},
{"ip_port":"186.216.160.147:8080"},
{"ip_port":"61.153.149.205:8080"},
{"ip_port":"221.176.214.246:8080"},
{"ip_port":"59.172.208.186:8080"},
{"ip_port":"61.... |
from qtclasses import *
from PyQt5.QtGui import QFont
from PyQt5.QtCore import Qt
from PyQt5.QtWidgets import QWidget, QLabel
# Draw a line plot using helper classes from qtclasses.py
class LinePlotDrawer(QWidget):
def __init__(self, lineplot, parent=None):
super().__init__(parent)
self.plot = li... |
import six
class ObjDictWrapper(object):
"""ObjDictWrapper is a container that provides both dictionary-like and
object-like attribute access.
"""
def __init__(self, **kwargs):
for key, value in six.iteritems(kwargs):
setattr(self, key, value)
def __getitem__(self, item):
... |
from openerp import fields, models
from openerp.tools.translate import _
class ir_model_fields(models.Model):
"""Addition of text fields to fields."""
_inherit = "ir.model.fields"
notes = fields.Text('Notes to developers.')
helper = fields.Text('Helper')
# TODO: Make column1 and 2 required if a m... |
from eos import ModuleLow
from eos import Ship
from eos import Skill
from eos import State
from eos.const.eos import ModAffecteeFilter
from eos.const.eos import ModDomain
from eos.const.eos import ModOperator
from eos.const.eve import EffectCategoryId
from tests.integration.sim.rah.testcase import RahSimTestCase
clas... |
from enum import Enum
def json_serializable(cls): # Decorator for enums
assert issubclass(cls, Enum)
JsonSerializable._register_enum_type(cls)
return cls
class JsonSerializable(type):
""" The fundamental base of the SANS State"""
_derived_types = {}
__ENUM_TAG = "E#"
__TYPE_TAG = "T#"
... |
{
'name': 'Prices Visible Discounts',
'version': '1.0',
'author': 'OpenERP SA',
'category': 'Sales Management',
'website': 'https://www.odoo.com',
'description': """
This module lets you calculate discounts on Sale Order lines and Invoice lines base on the partner's pricelist.
==================... |
"""Test suite for abdi_processrepo."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import types
import unittest
import phlcon_differential
import phlmail_mocksender
import abdmail_mailer
import abdt_branchmock
import abdt_conduitmock
import abdt_excep... |
from pyramid.view import view_config
from pyramid.httpexceptions import HTTPFound
from pyramid.security import remember
from substanced.util import get_oid
from substanced.event import LoggedIn
from dace.objectofcollaboration.principal.util import get_current
from dace.util import getSite
from dace.processinstance.co... |
import six
from tempest.api.network import base_security_groups as base
from tempest.common.utils import data_utils
from tempest import test
class SecGroupTest(base.BaseSecGroupTest):
_interface = 'json'
@classmethod
def setUpClass(cls):
super(SecGroupTest, cls).setUpClass()
if not test.... |
# coding: utf-8
from __future__ import unicode_literals
import re
from .common import InfoExtractor
class GazetaIE(InfoExtractor):
_VALID_URL = r'(?P<url>https?://(?:www\.)?gazeta\.ru/(?:[^/]+/)?video/(?:main/)*(?:\d{4}/\d{2}/\d{2}/)?(?P<id>[A-Za-z0-9-_.]+)\.s?html)'
_TESTS = [{
'url': 'http://www.g... |
import math
import re
from django.conf import settings
from django.contrib.auth import logout # noqa
from django import http
from django.utils.encoding import force_unicode
from django.utils.functional import lazy # noqa
from django.utils import translation
def _lazy_join(separator, strings):
return separator.... |
import netaddr
from neutronclient.common import exceptions as neutron_exception
from oslo_config import cfg
from oslo_log import log as logging
from ec2api.api import common
from ec2api.api import ec2utils
from ec2api.api import network_interface as network_interface_api
from ec2api.api import route_table as route_tab... |
from jinja2 import Markup
from flask import current_app
class _pagedown(object):
def include_pagedown(self):
return Markup('''
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
<script type="text/javascript" src="https://cdnjs.cloudflare.com/... |
"""
Contains the definitions for the two main functions of this package.
"""
from heat2arm.parser.template import Template
def parse_template(template):
""" parse instantiates a Template object with the provided string contents
of the template and returns a dict of all the resources defined within it.
... |
import bson
import hmac
import struct
try:
# use optimized cbson which has slightly different API
import cbson
decode_document = cbson.decode_next
except ImportError:
from bson import codec
decode_document = codec.decode_document
from net import gorpc
# Field name used for wrapping simple values as bson doc... |
"""Test the wallet."""
from test_framework.test_framework import BitcoinTestFramework
from test_framework.util import *
class WalletTest(BitcoinTestFramework):
def set_test_params(self):
self.num_nodes = 4
self.setup_clean_chain = True
def setup_network(self):
self.add_nodes(4)
... |
"""
GeoDjango introspection rules
"""
import django
from django.conf import settings
from south.modelsinspector import add_introspection_rules
has_gis = "django.contrib.gis" in settings.INSTALLED_APPS
if has_gis:
# Alright,import the field
from django.contrib.gis.db.models.fields import GeometryField
... |
import education_plan
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import unittest
from mock import MagicMock, PropertyMock
from flask.blueprints import Blueprint
from flask_admin.menu import MenuLink, MenuView
from airflow.hooks.base_... |
"""
NIO implementation on the client side (in the form of a pseudo node represented as a cloud).
Asynchronously sends JSON messages to the GNS3 server and receives responses with callbacks.
"""
import re
from gns3.node import Node
from gns3.ports.port import Port
from gns3.nios.nio_generic_ethernet import NIOGenericEt... |
# -*- coding: utf-8 -*-
"""
***************************************************************************
EditScriptAction.py
---------------------
Date : August 2012
Copyright : (C) 2012 by Victor Olaya
Email : volayaf at gmail dot com
**********************... |
#!/bin/python
# -*- coding: utf-8 -*-
"""set_display_to_system_clock.py - Sample script to read the current date and time from the operating system and
set the NEC large-screen display's internal RTC (real-time clock), via the internal serial link from the Raspberry
Pi Compute Module.
This could be used to rely on ... |
# Copyright 2014-2016 The ODL development group
#
# This file is part of ODL.
#
# ODL is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
... |
import pytest
def pytest_addoption(parser):
parser.addoption("--runslow", action="store_true",
default=False, help="run slow tests")
def pytest_collection_modifyitems(config, items):
if config.getoption("--runslow"):
# --runslow given in cli: do not skip slow tests
retur... |
""" Python / GLADE based Virtual Control Panel for EMC
A virtual control panel (VCP) is used to display and control
HAL pins.
Usage: gladevcp -g position -c compname -H halfile -x windowid myfile.glade
compname is the name of the HAL component to be created.
halfile contains hal commands to be exe... |
# -*- coding: utf-8 -*-
"""Generate a random process with panel structure
Created on Sat Dec 17 22:15:27 2011
Author: Josef Perktold
Notes
-----
* written with unbalanced panels in mind, but not flexible enough yet
* need more shortcuts and options for balanced panel
* need to add random intercept or coefficients
*... |
"""Check exceeding negations in boolean expressions trigger warnings"""
# pylint: disable=singleton-comparison,too-many-branches,too-few-public-methods,undefined-variable
# pylint: disable=literal-comparison
def unneeded_not():
"""This is not ok
"""
bool_var = True
someint = 2
if not not bool_var: ... |
"""Sample to delete suspended users whose last login date is 6 months old.
Sample to obtain the suspended users and their last login date from the
Reporting API and delete the user if the last login date is older than
6 months using the Provisioning API.
"""
__author__ = 'Shraddha Gupta <<EMAIL>>'
import datetime
im... |
from .resource import Resource
class ExpressRouteServiceProvider(Resource):
"""A ExpressRouteResourceProvider object.
Variables are only populated by the server, and will be ignored when
sending a request.
:param id: Resource ID.
:type id: str
:ivar name: Resource name.
:vartype name: st... |
import goocanvas
import gcompris
import gcompris.utils
import gcompris.skin
import gtk
import gtk.gdk
import gobject
from gcompris import gcompris_gettext as _
import constants
#import group_edit
# User Management
(
COLUMN_USERID,
COLUMN_LOGIN,
COLUMN_FIRSTNAME,
COLUMN_LASTNAME,
COLUMN_BIRTHDATE,
) = range... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from six.moves import range
from django.db.utils import IntegrityError
from django.db.backends.postgresql_psycopg2.schema import DatabaseSchemaEditor
from django.db.migrations.state import StateApps
from django.db import migrations, models
def set_strin... |
# -*- coding: utf-8 -*-
"""
Tests for IBM Model 4 training methods
"""
import unittest
from collections import defaultdict
from nltk.translate import AlignedSent
from nltk.translate import IBMModel
from nltk.translate import IBMModel4
from nltk.translate.ibm_model import AlignmentInfo
class TestIBMModel4(unittest.T... |
"""This module implements additional tests ala autoconf which can be useful.
"""
import textwrap
# We put them here since they could be easily reused outside numpy.distutils
def check_inline(cmd):
"""Return the inline identifier (may be empty)."""
cmd._check_compiler()
body = textwrap.dedent("""
... |
#!/usr/bin/env python
# -*- Python -*-
# -*- coding: utf-8 -*-
'''RTLogPlayer
Copyright (C) 2011
Geoffrey Biggs
RT-Synthesis Research Group
Intelligent Systems Research Institute,
National Institute of Advanced Industrial Science and Technology (AIST),
Japan
All rights reserved.
Licensed under... |
from flask import (Flask, render_template, request, send_from_directory)
from flask_socketio import SocketIO, emit
import logging as log
import os
from complete_pie import run_belt
DEBUG = True
def get_root_dir():
root_dir = os.path.dirname(__file__)
if __name__ == "__main__":
root_dir = os.getcwd()
... |
#!/usr/bin/python
import optparse
import logging
import struct
import pickle
import socket
import sys
def ParseArgs():
usage = ('usage: %prog [options] '
'[input_path1 table_name1 input_path2 table_name2 ...]')
parser = optparse.OptionParser(usage)
parser.add_option('-s', '--server',
help='Import se... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
__author__ = '3404199'
import numpy as np
import Parser
import itertools
import Tools
from Models import *
from multiprocessing import Pool
def evalSVD(config):
pairs_lt = Tools.folder2pairs(r"../ml-100k/")
m_score = 0.0
for pair in pairs_lt:
svd = SVD(p... |
from ..testutil import CallLogger, eq_
from ..gui.table import Table, GUITable, Row
class TestRow(Row):
def __init__(self, table, index, is_new=False):
Row.__init__(self, table)
self.is_new = is_new
self._index = index
def load(self):
pass
def save(self):
s... |
from __future__ import division,print_function,unicode_literals
import os
import sys
import argparse
import logging
help_text="""Test framework for bitcoin utils.
Runs automatically during `make check`.
Can also be run manually."""
if __name__ == '__main__':
sys.path.append(os.path.dirname(os.path.abspath(__fi... |
import os
import re
try:
import firewall.config
FW_VERSION = firewall.config.VERSION
from firewall.client import Rich_Rule
from firewall.client import FirewallClient
fw = FirewallClient()
if not fw.connected:
HAS_FIREWALLD = False
else:
HAS_FIREWALLD = True
except ImportErr... |
from survox_api.resources.base import SurvoxAPIBase
from survox_api.resources.account.server import SurvoxAPIAccountServer
from survox_api.resources.valid import valid_url_field
from survox_api.resources.exception import SurvoxAPIRuntime
class SurvoxAPIAccountList(SurvoxAPIBase):
"""
Class to manage a list of... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from datetime import datetime, timedelta
from email.mime.text import MIMEText
from email.utils import formatdate, parseaddr
import logging
import smtplib
from dojang.util import set_default_option
from tornado.escape import utf8
from tornado.options import opti... |
# -*- coding: utf-8 -*-
'''
Control a salt cloud system
'''
from __future__ import absolute_import
# Import python libs
import json
# Import salt libs
import salt.utils
HAS_CLOUD = False
try:
import saltcloud # pylint: disable=W0611
HAS_CLOUD = True
except ImportError:
pass
# Define the module's virtual... |
#!/usr/bin/env python
import ROOT
from UserCode.HGCanalysis.PlotUtils import *
from array import array
import os,sys
import optparse
import commands
"""
Loops over the trees and profiles the showers
"""
def prepareQGdiscriminatorTree(opt) :
#prepare output
fOut = ROOT.TFile("QGTree.root","RECREATE")
fOut... |
"""
Build packages using spec files
"""
import optparse
import PyInstaller.build
import PyInstaller.compat
import PyInstaller.log
from PyInstaller.utils import misc
def run():
misc.check_not_running_as_root()
parser = optparse.OptionParser(usage='%prog [options] specfile')
PyInstaller.build.__add_optio... |
import os
import sys
import shutil
import atexit
import tarfile
from grass.script import core as grass
def cleanup():
grass.try_rmdir(tmp)
def main():
infile = options['input']
if options['output']:
outfile = options['output']
else:
outfile = infile + '.pack'
global tmp
t... |
import json
from datetime import date, datetime
from decimal import Decimal
from .exceptions import SerializationError, ImproperlyConfigured
from .compat import string_types
class TextSerializer(object):
mimetype = 'text/plain'
def loads(self, s):
return s
def dumps(self, data):
if isins... |
from __future__ import absolute_import, division, print_function, unicode_literals
import re
from guessit import base_text_type
group_delimiters = ['()', '[]', '{}']
# separator character regexp
sep = r'[][,)(}:{+ /~/\._-]' # regexp art, hehe :D
_dash = '-'
_psep = '[\W_]?'
def build_or_pattern(patterns, escape... |
import math
from QueryDocParser import QueryDocParser
class SmallestWindow():
def __init__(self, training_file, task, idf):
self.training_file = training_file
self.C1 = 0.1
self.C2 = 0.1
self.C3 = 0.8
self.idf = idf
self.B = 1;
def rank(self):
... |
#!/usr/bin/env python
import sys
import os
import time
import atexit
import signal
def log_exception(*args):
"""
Log exception
"""
timestamp = time.time()
c, e, traceback = args
# extract number line, function name and file
lineno = traceback.tb_lineno
frame = traceback.tb_frame
... |
#!/usr/bin/env python
# coding=utf8
"""
Adding content fields
@contact: Debian FTP Master <<EMAIL>>
@copyright: 2010 Mike O'Connor <<EMAIL>>
@license: GNU General Public License version 2 or later
"""
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Publ... |
import numpy as np
from caput import config
import telescope
import cylinder, cylbeam
from util import typeutil
class RandomCylinder(cylinder.UnpolarisedCylinderTelescope):
pos_sigma = 0.5
def feed_positions_cylinder(self, cylinder_index):
pos = super(RandomCylinder, self).feed_positions_cylinde... |
class ClickToCalls:
""" 2600hz Kazoo Click to Call API.
:param rest_request: The request client to use.
(optional, default: pykazoo.RestRequest())
:type rest_request: pykazoo.restrequest.RestRequest
"""
def __init__(self, rest_request):
self.rest_request = rest_request... |
class Read_data:
def __init__(self, index_pyephem, index_predict, index_pyorbital,\
index_orbitron, sat_selected, index_STK, STK_dir, orbitron_dir):
# Orbitron stuff
self.file = '/home/dayvan/Documentos/propagators/results/Orbitron/dmc.txt'
self.index_orbitron = index_orbitron + 1
self.sat_selected = sat_se... |
"""Utilities to work with importable python zip packages."""
import atexit
import collections
import hashlib
import io
import os
import pkgutil
import re
import sys
import tempfile
import threading
import zipfile
import zipimport
# Glob patterns for files to exclude from a package by default.
EXCLUDE_LIST = (
# Ig... |
__author__ = 'Kami'
import itertools as it
from io import StringIO
import numpy as np
nums = """08 02 22 97 38 15 00 40 00 75 04 05 07 78 52 12 50 77 91 08
49 49 99 40 17 81 18 57 60 87 17 40 98 43 69 48 04 56 62 00
81 49 31 73 55 79 14 29 93 71 40 67 53 88 30 03 49 13 36 65
52 70 95 23 04 60 11 42 69 24 68 56 01 32... |
# -*- coding: utf-8 -*-
from __future__ import absolute_import, division, print_function, unicode_literals
import jubatus
import jubatus.embedded
from .base import GenericSchema, BaseDataset, BaseService, GenericConfig
from .compat import *
class Schema(GenericSchema):
"""
Schema for Weight service.
"""
pas... |
# -*- coding: utf-8 -*-
from functools import partial
import random
import itertools
from cached_property import cached_property
from navmazing import NavigateToSibling, NavigateToAttribute
from wrapanapi.containers.volume import Volume as ApiVolume
from cfme.common import SummaryMixin, Taggable
from cfme.containers.... |
# -*- coding: utf-8 -*-
"""
Created on Mon Jul 22 11:07:46 2013
@author: daniel
"""
from __future__ import division
from Bio import SeqIO
import random
ref = "Ref.B.FR.83.HXB2_LAI_IIIB_BRU.K03455"
alphabet = ['A','C','G','T']
subtypes_to_remove = []
# SCUEAL has no reference sequences for those subtypes
subtypes_to_... |
import re
from unittest.mock import patch, Mock
from unittest import TestCase
from django.test.runner import DiscoverRunner
from .indexes import registry
def destroy():
for index in registry.get_indexes():
index.es.indices.delete(index=index._doc_type.index, ignore=[400, 404])
def create():
for inde... |
"""This module makes all WTForms fields available in WebDeposit.
This module makes all WTForms fields available in WebDeposit, and ensure that
they subclass WebDepositField for added functionality
The code is basically identical to importing all the WTForm fields and for each
field make a subclass according to the pa... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.