content stringlengths 4 20k |
|---|
""" Functions that operate on sparse matrices
"""
from __future__ import division, print_function, absolute_import
__all__ = ['count_blocks','estimate_blocksize']
from .csr import isspmatrix_csr, csr_matrix
from .csc import isspmatrix_csc
from ._sparsetools import csr_count_blocks
def extract_diagonal(A):
rais... |
from __future__ import absolute_import
import re
try:
from django.urls import get_resolver
except ImportError:
from django.core.urlresolvers import get_resolver
class RouteResolver(object):
_optional_group_matcher = re.compile(r'\(\?\:([^\)]+)\)')
_named_group_matcher = re.compile(r'\(\?P<(\w+)>[^\)... |
"""Volteer configs."""
from __future__ import print_function
from chromite.lib import cros_logging as logging
BUILD_WORKON_PACKAGES = None
BUILD_PACKAGES = ('chromeos-bootimage',)
# TODO: Remove this line once VBoot is working on Volteer.
DEPLOY_SERVO_FORCE_FLASHROM = True
def get_commands(servo):
"""Get speci... |
from setuptools import setup
setup(
name = 'mailplate',
packages = [ 'mailplate' ],
package_data = { 'mailplate': [ 'driver/*.py' ]},
version = '0.601',
description = 'Send Muli-Language Multi-Transport Template-Driven Email',
author = 'Avner Herskovits',
author_email = 'avnr_ at outlook.co... |
#! /usr/bin/env python
from __future__ import print_function
from builtins import str
import sys
import pmagpy.pmag as pmag
def main():
"""
NAME
nrm_specimens_magic.py
DESCRIPTION
converts NRM data in a magic_measurements type file to
geographic and tilt co... |
"""Basic loop for training."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from tensorflow.python.framework import errors
def basic_train_loop(supervisor, train_step_fn, args=None,
kwargs=None, master=""):
"""Basic loop to train ... |
import functools
import json
import logging
import traceback
from flask import g, redirect, Response, flash, abort
from flask_babel import gettext as __
from flask_appbuilder import BaseView
from flask_appbuilder import ModelView
from flask_appbuilder.widgets import ListWidget
from flask_appbuilder.actions import act... |
#import
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
from sklearn.ensemble import RandomForestClassifier
from sklearn.cross_validation import cross_val_score
# load training data
traindata = pd.read_csv('C:/Users/sound/Desktop/Kaggle/Leaf Classfication/data/train.csv')
x_train = traindata.val... |
# -*- coding: utf-8 -*-
"""
pygments.util
~~~~~~~~~~~~~
Utility functions.
:copyright: Copyright 2006-2014 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
import re
import sys
split_path_re = re.compile(r'[/\\ ]')
doctype_lookup_re = re.compile(r'''(?smx)
(<\?... |
from setuptools import setup, find_packages
from setuptools.command.test import test as TestCommand
import sys
class PyTest(TestCommand):
def finalize_options(self):
TestCommand.finalize_options(self)
self.test_args = []
self.test_suite = True
def run_tests(self):
import pyte... |
"""API for using the tf.data service.
This module contains:
1. tf.data server implementations for running the tf.data service.
2. A `distribute` dataset transformation that moves a dataset's preprocessing
to happen in the tf.data service.
The tf.data service offers a way to improve training speed when the host
at... |
from distutils.core import setup
long_description = "The xVector Engine is an open source 2D MMORPG engine "
long_description += "programmed in Python. xVector makes it easy to create "
long_description += "and distribute your own MMORPG with no programming "
long_description += "experience while also providing devel... |
from essence2 import clamp
class ListField(object):
def __init__(self, items, name=''):
self.items = items
self.name = name
self.stamp = 0
def __getitem__(self, key):
return self.items[key]
def __setitem__(self, key, value):
self.items[key] = value
self.sta... |
#!/usr/bin/env python
# textventure.py
#################
## Textventure ##
## ckjbgames ####
## 2017 #########
#################
## Imports
import random # Map randomization
import pickle # For game saving
import sys # Various uses
import socket # Eventually for connections
import MySQLdb # For con... |
#!/usr/bin/env python
import os
import sys
import time
from xapi.storage import log
from xapi.storage.libs import util
from xapi.storage.common import call
import xapi.storage.libs.poolhelper
import mmap
import signal
import pickle
import shelve
import fcntl
import struct
BLK_SIZE = 512
MSG_OK = '\x00'
MSG_FE... |
from django.contrib.auth.models import User
from xtests.base import BaseTest
from xadmin.views import BaseAdminView, BaseAdminPlugin, ModelAdminView, ListAdminView
from models import ModelA, ModelB
from adminx import site, ModelAAdmin, TestBaseView, TestCommView, TestAView, OptionA
class BaseAdminTest(BaseTest):
... |
from webob import exc
from nova.api.openstack import common
from nova.api.openstack import extensions
from nova.api.openstack import wsgi
from nova import compute
from nova.i18n import _
from nova.policies import instance_actions as ia_policies
from nova import utils
ALIAS = "os-instance-actions"
ACTION_KEYS = ['act... |
template_main_cpp = r'''/**
* Print a simple "Hello world!"
*
* @file main.cpp
* @section LICENSE
This code is under MIT License, http://opensource.org/licenses/MIT
*/
#include <iostream>
int main() {
std::cout << "Hello world!\n";
}
'''
template_main_c = r'''/**
* Print a simple "Hello world!"
*
* @f... |
import fnmatch
import os
import subprocess
import itertools
eightySharps = "################################################################################"
def generateLicenseSection(filename):
yield "############################ Copyrights and license ############################"
yield "# ... |
"""Attempt to generate templates for module reference with Sphinx
XXX - we exclude extension modules
To include extension modules, first identify them as valid in the
``_uri2path`` method, then handle them in the ``_parse_module`` script.
We get functions and classes by parsing the text of .py files.
Alternatively w... |
from setuptools import setup
import re
import os
import ConfigParser
def read(fname):
return open(os.path.join(os.path.dirname(__file__), fname)).read()
def get_require_version(name):
if minor_version % 2:
require = '%s >= %s.%s.dev0, < %s.%s'
else:
require = '%s >= %s.%s, < %s.%s'
r... |
"""
Image cache class
Images that are stored in the cache folder will be stored in a folder whose
name is the image ID. In the event that an image is discovered to be no longer
used then a timestamp will be added to the image folder.
The timestamp will be a folder - this is due to the fact that we can use the
VMware A... |
"""Package contenant l'éditeur d'auberge 'aubedit'.
Si des redéfinitions de contexte-éditeur standard doivent être faites, elles
seront placées dans ce package
Note importante : ce package contient la définition d'un éditeur, mais
celui-ci peut très bien être étendu par d'autres modules. Au quel cas,
les extensions n... |
#!/usr/bin/python
import datetime
import Sybase
paydays = {
'2011-01-07' : 1,
'2011-01-21' : 1,
'2011-02-07' : 1,
'2011-02-23' : 1,
'2011-03-07' : 1,
'2011-03-22' : 1,
'2011-04-07' : 1,
'2011-04-22' : 1,
'2011-05-06' : 1,
'2011-05-23' : 1,
'2011-06-07' : 1,
'2011-06-22' : 1,
'2011-07-07' : 1,
'2011-07-2... |
# This code is supporting material for the book
# Building Machine Learning Systems with Python
# by Willi Richert and Luis Pedro Coelho
# published by PACKT Publishing
import numpy as np
import mahotas as mh
from glob import glob
from features import texture, color_histogram
from matplotlib import pyplot as plt
from ... |
from __future__ import print_function
from __future__ import division
from __future__ import unicode_literals
from gnuradio import gr, gru
from . import filter_swig as filter
_plot = None
def design_filter(interpolation, decimation, fractional_bw):
"""
Given the interpolation rate, decimation rate and a fra... |
import atexit
import logging
from devil.android import device_errors
class PerfControl(object):
"""Provides methods for setting the performance mode of a device."""
_CPU_PATH = '/sys/devices/system/cpu'
_KERNEL_MAX = '/sys/devices/system/cpu/kernel_max'
def __init__(self, device):
self._device = device
... |
from test_framework.test_framework import BitcoinTestFramework
from test_framework.util import (
start_nodes,
start_node,
assert_equal,
connect_nodes_bi,
)
class WalletAccountsTest(BitcoinTestFramework):
def __init__(self):
super().__init__()
self.setup_clean_chain = True
... |
from __future__ import print_function, unicode_literals
from os import path, getcwd, listdir
import subprocess
import sys
from mach.decorators import (
CommandArgument,
CommandProvider,
Command,
)
from servo.command_base import CommandBase, cd, call
@CommandProvider
class MachCommands(CommandBase):
... |
from safe.impact_functions.core import FunctionProvider
from safe.impact_functions.core import get_hazard_layer, get_exposure_layer
from safe.storage.vector import Vector
from safe.common.utilities import ugettext as tr
# Largely superseded by flood impact functions, but keep as it
# will be needed to test impact on r... |
import threading
import time
from unittest import mock
from multiple_database.routers import TestRouter
from django.db import (
DatabaseError, connection, connections, router, transaction,
)
from django.test import (
TransactionTestCase, override_settings, skipIfDBFeature,
skipUnlessDBFeature,
)
from djan... |
from modshogun import *
import numpy
numpy.random.seed(40)
N = 2000
tt = numpy.array((numpy.pi)*(3+2*numpy.random.rand(N)))
height = numpy.array(numpy.random.rand(N)-0.5)
X = numpy.array([tt*numpy.cos(tt), 10*height, tt*numpy.sin(tt)])
preprocs = []
lle = LocallyLinearEmbedding()
lle.set_k(9)
preprocs.append((lle, "LL... |
import itertools
import sys
import xml.dom.minidom
def _GetPolicyTemplates(template_path):
# Read list of policies in the template. eval() is used instead of a JSON
# parser because policy_templates.json is not quite JSON, and uses some
# python features such as #-comments and '''strings'''. policy_templates.jso... |
"""Implementation of radix sort algorithm."""
def radix_sort(itr, base=10):
"""Sort iterable using radix sort algorithm."""
divisor = base
digit = 0
try:
maximum = max(itr)
except ValueError:
return itr
while maximum > 1:
buckets = []
tmp = [num for num in itr]
... |
#!/usr/bin/env python
def save_training_data(dep_var, feature_1, feature_2, feature_3, mode):
path = './data/training/'
filename = path + str(mode) + '_train.svm'
with open(filename,'a') as f:
line = str(dep_var)
line += ' 1:' + str(feature_1)
line += ' 2:' + str(feature... |
"""
The :mod:`sklearn.ensemble` module includes ensemble-based methods for
classification and regression.
"""
from .base import BaseEnsemble
from .forest import RandomForestClassifier
from .forest import RandomForestRegressor
from .forest import RandomTreesEmbedding
from .forest import ExtraTreesClassifier
from .fores... |
import os
import platform
import struct
def get_size():
if platform.system() == "Windows":
size = get_terminal_size_win()
else:
size = get_terminal_size_unix()
if not all(size):
size = (1, 1)
return size
def get_terminal_size_win():
#Windows specific imports
from ct... |
from __future__ import division, print_function
print("""
This tutorial explains the usage of trigonometric polynomials and relating
operators for the use in FFT-based homogenization.
The basic classes, which are implemented in module "homogenize.matvec",
are listed here along with their important characteristics:
Gr... |
from base import BaseGraph
from reg import RegressionLine
from ..graphics import Canvas
from ..graphics.shapes import Circle, Line, Rectangle, Sector, Path, Square
from ..graphics.group import Group, Grouping
from ..graphics.utils import ViewBox
from ..graphics.color import white
from ..utils.struct import Vector as ... |
# -*- coding: utf-8 -*-
"""
This script reproduces the results for Figure 7, analyzing 1p microendoscopic
data using the CaImAn implementation of the CNMF-E algorithm. The algorithm
using both a patch-based and a non patch-based approach and compares them with
the results obtained from the MATLAB implementation.
More ... |
import logging
from webkitpy.tool.steps.abstractstep import AbstractStep
from webkitpy.tool.steps.options import Options
_log = logging.getLogger(__name__)
class CloseBug(AbstractStep):
@classmethod
def options(cls):
return AbstractStep.options() + [
Options.close_bug,
]
def... |
# -*- coding: utf-8 -*-
"""
***************************************************************************
doNearBlack.py
---------------------
Date : June 2010
Copyright : (C) 2010 by Giuseppe Sucameli
Email : brush dot tyler at gmail dot com
****************... |
# -*- coding:utf-8 -*-
"""
/***************************************************************************
Plugin Installer module
unzip function
-------------------
Date : May 2013
Copyright : (C) 2013 ... |
"""
This object provides quoting for GEOS geometries into PostgreSQL/PostGIS.
"""
from __future__ import unicode_literals
from psycopg2 import Binary
from psycopg2.extensions import ISQLQuote
class PostGISAdapter(object):
def __init__(self, geom):
"Initializes on the geometry."
# Getting the WKB... |
import json
import urllib
try:
import boto
import boto.iam
import boto.ec2
HAS_BOTO = True
except ImportError:
HAS_BOTO = False
def boto_exception(err):
'''generic error message handler'''
if hasattr(err, 'error_message'):
error = err.error_message
elif hasattr(err, 'message'):
... |
# coding: utf-8
from __future__ import unicode_literals
from .common import InfoExtractor
from ..compat import compat_str
from ..utils import (
int_or_none,
parse_iso8601,
try_get,
determine_ext,
)
class TV4IE(InfoExtractor):
IE_DESC = 'tv4.se and tv4play.se'
_VALID_URL = r'''(?x)https?://(?:... |
from boto.exception import JSONResponseError
from boto.dynamodb2.fields import KeysOnlyIndex
from boto.dynamodb2.fields import GlobalAllIndex
from boto.dynamodb2.fields import HashKey
from boto.dynamodb2.fields import RangeKey
from boto.dynamodb2.layer1 import DynamoDBConnection
from boto.dynamodb2.table ... |
from argparse import ArgumentParser, RawTextHelpFormatter
from typing import Any, Dict, Text
from zerver.lib.actions import set_default_streams
from zerver.lib.management import ZulipBaseCommand
import sys
class Command(ZulipBaseCommand):
help = """Set default streams for a realm
Users created under this realm ... |
import numpy
import skimage
import skimage.filters
import skimage.morphology
from cached_property import cached_property
from .maskset import MaskSet
from .util.event import Event
class SamuROIData(object):
"""
This is the main data structure of SamuROI.
It combines various aspects of rois, overlays and... |
"""
mbed CMSIS-DAP debugger
Copyright (c) 2015-2017 ARM Limited
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable ... |
from __future__ import (absolute_import, division, generators, nested_scopes, print_function,
unicode_literals, with_statement)
import os
import shutil
import time
from textwrap import dedent
from pants.backend.jvm.ivy_utils import IvyUtils
from pants.backend.jvm.targets.jar_dependency import ... |
from __future__ import unicode_literals
import frappe
from frappe import _
active_domains = frappe.get_active_domains()
def get_data():
return [
{
"label": _("Accounting"),
"items": [
{
"type": "doctype",
"name": "Item",
"onboard": 1,
},
{
"type": "doctype",
"name": "Cust... |
from __future__ import absolute_import, division, print_function
__metaclass__ = type
ANSIBLE_METADATA = {'metadata_version': '1.1',
'status': ['preview'],
'supported_by': 'network'}
import re
from copy import deepcopy
from ansible.module_utils.basic import AnsibleModule
from... |
#!/usr/bin/env python
# -*- coding: UTF-8
"""
nodes
*****
This contains all the code related to Nodes
both network and code execution.
:copyright: (c) 2012 by Arturo Filastò, Isis Lovecruft
:license: see LICENSE for more details.
"""
import os
from binascii import hexlify
try:
import pa... |
import sys
from avwx.models import Metar, MetarSet, CloudLayer
from colorama import Fore, Back, Style
class Indicator(object):
color = None
reason = None
def __init__(self, color, reason=None):
if color not in ['red', 'yellow', 'green']:
raise Exception("Invalid color: %s" % color)
... |
import re
from util import hook, http
@hook.command('u')
@hook.command
def urban(inp):
'''.u/.urban <phrase> -- looks up <phrase> on urbandictionary.com'''
url = 'http://www.urbandictionary.com/iphone/search/define'
page = http.get_json(url, term=inp, headers={'Referer': 'http://m.urbandictionary.com'})... |
from pandac.PandaModules import *
from direct.interval.IntervalGlobal import *
from direct.showbase import PythonUtil
from toontown.battle.BattleProps import globalPropPool
from direct.directnotify import DirectNotifyGlobal
SFX = PythonUtil.Enum('poof, magic')
SFXPATHS = {SFX.poof: 'phase_4/audio/sfx/firework_distance_... |
"""A module for the prepare command."""
import cr
class PrepareCommand(cr.Command):
"""The implementation of the prepare command.
The prepare command is used to perform the steps needed to get an output
directory ready to use. These should not be the kind of things that need to
happen every time you build ... |
import base64
try:
import http.client as http_client
except ImportError:
import httplib as http_client
import os
from selenium.webdriver.common.desired_capabilities import DesiredCapabilities
from selenium.webdriver.remote.command import Command
from selenium.webdriver.remote.webdriver import WebDriver as Rem... |
from stat_gatherer import StatGatherer
from datetime import datetime, timedelta
from dateutil import tz
from collections import Counter
import sys
class DailyStatus():
def __init__(self):
self.stat = StatGatherer()
self.stat.connect_to_db()
self.game_list = None
self.bid_list = None... |
import datetime
from django.contrib.sites.models import Site
from django.http import Http404
from django.template import TemplateDoesNotExist
from django.test import RequestFactory, TestCase
from django.test.utils import override_settings
from django.views.defaults import (
bad_request, page_not_found, permission_... |
# -*- coding: utf-8 -*-
"""
***************************************************************************
test_qgssymbollayer_readsld.py
---------------------
Date : January 2017
Copyright : (C) 2017, Jorge Gustavo Rocha
Email : jgr at di dot uminho dot pt
**... |
# -*- coding: utf-8 -*-
import logging
import socket
import threading
from connection import Connection
from i2p.util import receive_line
import shared
class I2PListener(threading.Thread):
def __init__(self, nick, host='127.0.0.1', port=7656):
super().__init__(name='I2P Listener')
self.host = ho... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
import datetime
from django.core.files.uploadedfile import SimpleUploadedFile
from django.db import models
from django.forms import (
CharField, FileField, Form, ModelChoiceField, ModelForm,
)
from django.forms.models import ModelFormMetaclass
from d... |
from positive_test_suite import PositiveTestSuite
from negative_test_suite import NegativeTestSuite
from mozdef_util.query_models import LessThanMatch
class TestLessThanMatchPositiveTestSuite(PositiveTestSuite):
def query_tests(self):
boundry_date = "2016-08-12T21:07:12.316450+00:00"
tests = {
... |
import os
import sys
from argparse import ArgumentParser
from collections import OrderedDict
from coalib.parsing.DefaultArgParser import default_arg_parser
from coalib.parsing.LineParser import LineParser
from coalib.settings.Section import Section, append_to_sections
def parse_cli(arg_list=None,
origi... |
"""
Django settings for qmsg project.
Generated by 'django-admin startproject' using Django 1.11.
For more information on this file, see
https://docs.djangoproject.com/en/1.11/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.11/ref/settings/
"""
import os
# B... |
from setuptools import setup, find_packages
NAME = 'mezzanine-blocks'
VERSION = '0.9.4'
DESCRIPTION = """
A fork of https://github.com/molokov/mezzanine-blocks.git to make it work with Django 1.9
A mezzanine flavored fork of django-flatblocks.
The goal of this project is to be able to easily create custom blocks of
... |
import sys
from oslo.config import cfg
from neutron.agent.common import config
from neutron.agent.linux import interface
from neutron.common import legacy
from neutron.debug.debug_agent import NeutronDebugAgent
from neutron.openstack.common import importutils
from neutronclient.common import exceptions as exc
from ne... |
from .base import GEOSBase
from .error import GEOSException
from .libgeos import geos_version_info
from .prototypes import prepared as capi
class PreparedGeometry(GEOSBase):
"""
A geometry that is prepared for performing certain operations.
At the moment this includes the contains covers, and intersects
... |
from __future__ import with_statement
import datetime
import threading
import sickbeard
from sickbeard import db, scheduler
from sickbeard import search_queue
from sickbeard import logger
from sickbeard import ui
#from sickbeard.common import *
class BacklogSearchScheduler(scheduler.Scheduler):
... |
"""Viewfinder watchdog tests.
"""
__author__ = '<EMAIL> (Matt Tracy)'
import logging
import time
from functools import partial
from viewfinder.backend.base import util, testing
from viewfinder.backend.watchdog import watchdog
from viewfinder.backend.watchdog.scenario import ScenarioDevice, Scenario
from viewfinder.b... |
data = (
'sswals', # 0x00
'sswalt', # 0x01
'sswalp', # 0x02
'sswalh', # 0x03
'sswam', # 0x04
'sswab', # 0x05
'sswabs', # 0x06
'sswas', # 0x07
'sswass', # 0x08
'sswang', # 0x09
'sswaj', # 0x0a
'sswac', # 0x0b
'sswak', # 0x0c
'sswat', # 0x0d
'sswap', # 0x0e
'sswah', # 0x0f
... |
'''This utility cleans up the html files as emitted by doxygen so
that they are suitable for publication on a Google documentation site.
'''
import optparse
import os
import re
import shutil
import string
import sys
try:
from BeautifulSoup import BeautifulSoup, Tag
except (ImportError, NotImplementedError):
print ... |
#!/usr/bin/env python
"""
Sane List Extension for Python-Markdown
=======================================
Modify the behavior of Lists in Python-Markdown t act in a sane manor.
In standard Markdown sytex, the following would constitute a single
ordered list. However, with this extension, the output would include
tw... |
from django.db import models
from markupfield.fields import MarkupField
from django.contrib.auth.models import User
from taxonomy.models import TaxonomyMap
class News(models.Model):
title = models.CharField(max_length = 250)
title_slug = models.SlugField()
date_published = models.DateTimeField(... |
import os
from django.core.management.base import CommandError, AppCommand, _make_writeable
from optparse import make_option
class Command(AppCommand):
option_list = AppCommand.option_list + (
make_option('--name', '-n', action='store', dest='command_name', default='sample',
help='The name to u... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# pylint: disable=no-self-use,pointless-statement,missing-docstring,invalid-name,line-too-long
import time
import pytest
from ..api import guessit
def case1():
return guessit('Fear.and.Loathing.in.Las.Vegas.FRENCH.ENGLISH.720p.HDDVD.DTS.x264-ESiR.mkv')
def case2()... |
__author__ = 'naetech'
import sys
import wx
import wx.html
import wx.html2
import wx.lib.wxpTag
from Compiler import Compiler
class GUI:
def show_error(self, title, message):
app = wx.PySimpleApp()
dlg = ErrorDialog(None, title, message)
dlg.ShowModal()
dlg.Destroy()
app... |
import webnotes
def execute():
doctypes = [
"Announcement",
"Authorization Rules",
"Blog Subscriber",
"Books",
"Call Log",
"Call Log Details",
"Campaign Expense",
"Communication Log",
"Compaint Note",
"Company Control",
"Competitor",
"Complaint Detail",
"Desktop Item",
"DocType Label",
"Employee Traini... |
import copy
import json
from temboo.core.exception import TembooError
from temboo.core.exception import TembooDisallowedInputError
from temboo.core.exception import TembooNotFoundError
class TembooProxy(object):
def __init__(self):
self._choreos = {}
def _get_choreo(self, name):
# Make sure we know about the s... |
# -*- coding: utf-8 -*-
# Scrapy settings for company_service project
#
# For simplicity, this file contains only the most important settings by
# default. All the other settings are documented here:
#
# http://doc.scrapy.org/en/latest/topics/settings.html
#
import os
BOT_NAME = 'company_service'
SPIDER_MODULES ... |
# -*- coding: utf-8 -*-
import mock
from contextlib import contextmanager
from modularodm import storage
from framework.mongo import set_up_storage
from website.addons.base.testing import OAuthAddonTestCaseMixin, AddonTestCase
from website.addons.box import MODELS
from website.addons.box.model import Box
from websi... |
# -*- 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 field 'Banner.title'
db.add_column(u'idea_banner', 'title',
... |
'''Implement a class that sets up threadsafe communication with the Fedora
Account System
.. moduleauthor:: Ricky Zhou <<EMAIL>>
.. moduleauthor:: Toshio Kuratomi <<EMAIL>>
.. versionadded:: 0.3.17
'''
from fedora.client import AuthError, AppError
from fedora.client.proxyclient import ProxyClient
from fedora impo... |
from django.db.backends.mysql.base import DatabaseOperations
from django.contrib.gis.db.backends.adapter import WKTAdapter
from django.contrib.gis.db.backends.base import BaseSpatialOperations
class MySQLOperations(DatabaseOperations, BaseSpatialOperations):
compiler_module = 'django.contrib.gis.db.backends.mysq... |
# pylint: disable=too-few-public-methods
"""State about the actual data which is to be reduced."""
from __future__ import (absolute_import, division, print_function)
import json
import copy
from sans.state.state_base import (StateBase, StringParameter, PositiveIntegerParameter, BoolParameter,
... |
from .command import Command
class Mobile(object):
class ConnectionType(object):
def __init__(self, mask):
self.mask = mask
@property
def airplane_mode(self):
return self.mask % 2 == 1
@property
def wifi(self):
return (self.mask / 2) ... |
#!/usr/bin/python
import serial
import http.client, urllib.request
from time import localtime, strftime
import re
import time
import configparser
config = configparser.ConfigParser()
config.read('config.ini')
port = serial.Serial(config["SERIAL"]["Interface"], baudrate=9600, timeout=3.0)
#port = serial.Serial("ttyAMA... |
__all__ = ['CherryPyException', 'CherryPyAdapter']
import types, os, re
from pyasm.common import TacticException
from web_environment import *
import cherrypy
class CherryPyException(Exception):
pass
def get_app_server():
server_cls = os.environ.get("TACTIC_SERVER_CLS")
if not server_cls:
f... |
"""
MIT License
Copyright (c) 2017 Daniele Linguaglossa
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, p... |
s3gis_tests = load_module("tests.unit_tests.modules.s3.s3gis")
def test_GeoRSSLayer():
# use debug to show up errors
# without debug, errors get to be turned into session warnings
# and the layer skipped altogether. No datastructure.
url = "test://test_GeoRSS"
current.request.utcnow = datetime.date... |
from setuptools import setup, find_packages
import sys, os
PACKAGE = 'display'
VERSION = open(os.path.join(os.path.dirname(os.path.realpath(__file__)),'oldowan', PACKAGE, 'VERSION')).read().strip()
desc_lines = open('README', 'r').readlines()
setup(name='oldowan.%s' % PACKAGE,
version=VERSION,
descripti... |
from bcc import BPF
import os
import sys
from unittest import main, TestCase
class TestKprobeRgx(TestCase):
def setUp(self):
self.b = BPF(text="""
typedef struct { int idx; } Key;
typedef struct { u64 val; } Val;
BPF_TABLE("array", Key, Val, stats, 3);
int hello(void *ctx) {... |
from math import sqrt
from sys import argv,exit
from os import sep, mkdir
import re
from Bio.PopGen.SimCoal import builtin_tpl_dir
def exec_template(template):
executed_template = template
match = re.search('!!!(.*?)!!!', executed_template, re.MULTILINE)
#while len(match.groups())>0:
while match:
... |
"""
Distributed image feature calculation with wnd-charm.
"""
import pydoop.mapreduce.api as api
import pydoop.mapreduce.pipes as pp
from pydoop.avrolib import AvroContext
from pyfeatures.bioimg import BioImgPlane
from pyfeatures.feature_calc import calc_features, to_avro
class Mapper(api.Mapper):
def map(self,... |
import os #@UnusedImport
import sys #@UnusedImport
import sre_compile
from nsiqcppstyle_util import * #@UnusedWildImport
class RuleManager :
def __init__(self, runtimePath) :
self.availRuleNames = []
basePath = os.path.join(runtimePath, "rules")
ruleFiles = os.listdir(basePath)
rule... |
import lit
import os
from setuptools import setup, find_packages
# setuptools expects to be invoked from within the directory of setup.py, but it
# is nice to allow:
# python path/to/setup.py install
# to work (for scripts, etc.)
os.chdir(os.path.dirname(os.path.abspath(__file__)))
setup(
name = "lit",
ver... |
import copy
import sys
import datetime
import glob
import traceback
import re
import shlex
import os
# Dict of options and their defaults
OPTIONS = {'chdir': None,
'creates': None,
'executable': None,
'NO_LOG': None,
'removes': None,
'warn': True,
}
# ... |
from pip.basecommand import Command
from pip.exceptions import DistributionNotFound, BestVersionAlreadyInstalled
from pip.index import PackageFinder
from pip.log import logger
from pip.req import InstallRequirement
from pip.util import get_installed_distributions, dist_is_editable
from pip.cmdoptions import make_option... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.