content stringlengths 4 20k |
|---|
import numpy as np
import matplotlib.pyplot as plt
import dateutil.parser as dp
import ticks
import mpl_toolkits.basemap as bm
import sys
def drawmap(lat = None, lon = None, margin = 0.05, width = 1e6, height = None, boundarylat = 40,
projection = 'cyl', drawcoastline = 1, drawcountries = 0, drawgrid = 1, dra... |
import rtorrent.rpc
Method = rtorrent.rpc.Method
class Group:
__name__ = 'Group'
def __init__(self, _rt_obj, name):
self._rt_obj = _rt_obj
self.name = name
self.methods = [
# RETRIEVERS
Method(Group, 'get_max', 'group.' + self.name + '.ratio.max', varname='ma... |
#!/usr/bin/env python
import unittest
from BaseTest import parse_commandline, BasicTestSetup
from afs.lla import UbikPeerLLA
import afs
class TestUbikLLAMethods(unittest.TestCase, BasicTestSetup):
"""
Tests UbikPeerLLA Methods
"""
def setUp(self):
"""
setup
"""
... |
import numpy as np
import matplotlib
import matplotlib.pyplot as plt
import random
import time
def bubble_sort(items):
for i in range(len(items)):
for j in range(len(items)-1-i):
if items[j] > items[j+1]:
items[j], items[j+1] = items[j+1], items[j]
def selection_sort(items):
... |
import urllib
import json
class RequestHandler(object):
"""RequestHandler takes care of encoding the request body into format given by options"""
@staticmethod
def render_key(parents):
depth, new = 0, ''
for x in parents:
old = '[%s]' if depth > 0 else '%s'
new +... |
# -*- coding: utf-8 -*-
from django import template
from django.db.models import Count
from ..models import Project
from .common import is_string_type, natural_sort
register = template.Library()
@register.filter
def get_stack(stacks, pos):
""" Returns an image stack out of stacks. Which one is
determined by ... |
#!/usr/bin/env python
"""
Automatically creates python-wrapper subroutines from the interface file
SHTOOLS.f95. Unfortunately all assumed array shapes have to be changed because
their structure is only known by the Fortran compiler and can not be directly
exposed to C. It is possible that newer f2py versions can handle... |
#! /usr/bin/env python
"""
Logfile tailer for rotated log files.
Supports 2 operating modes: classic, rotated.
Assumes that:
. All log files reside in the same directory.
. We can find last log file by sorting the file list alphabetically.
In classic mode:
. When log is switched, the tailer continues tailing from th... |
from .multiheaded_sparse_mlp import MultiHeadedSparseMLP
from .multiheaded_dendrite_mlp import MultiHeadedDendriticMLP
from .dendrite_mlp import DendriticMLP
from .sparse_mlp import SparseMLP |
from typing import Dict, List, Optional, Type, Union, TYPE_CHECKING
from rebasehelper.plugins.plugin_loader import PluginLoader
from rebasehelper.plugins.plugin import Plugin
from rebasehelper.types import Options
if TYPE_CHECKING:
# avoid cyclic import at runtime
from rebasehelper.plugins.plugin_manager impo... |
import os
import tempfile
import shutil
import configparser
from avocado import Test
from avocado.utils import build, distro, process
from avocado.utils.software_manager import SoftwareManager
class PerfProbe(Test):
def setUp(self):
'''
Install the basic packages to support PerfProbe test
... |
import os
from numpy.testing import assert_array_equal, assert_array_almost_equal
import pytest
import oddt
from oddt.interactions import (close_contacts,
hbonds,
distance,
halogenbonds,
pi_stac... |
from sklearn.utils.testing import assert_array_equal
from sklearn.utils.testing import assert_less
import pytest
from skopt import gp_minimize
from skopt.benchmarks import bench1
from skopt.benchmarks import bench2
from skopt.benchmarks import bench3
from skopt.benchmarks import bench4
from skopt.benchmarks import bra... |
"""Tests for mocker extensions (mockerext module)
Note: some of these tests depend on PyObjC since they are geared toward making
testing of PyObjC applications more convenient.
"""
import logging
import mocker
import objc
from editxt.test.mockerext import install, MockerExt
from editxt.test.util import assert_raises, ... |
#!/usr/bin/env python2
# vim:fileencoding=UTF-8:ts=4:sw=4:sta:et:sts=4:fdm=marker:ai
from __future__ import (unicode_literals, division, absolute_import,
print_function)
__license__ = 'GPL v3'
__copyright__ = '2012, Kovid Goyal <kovid at kovidgoyal.net>'
__docformat__ = 'restructuredtext en'
... |
import unittest
from main import parse_data
from models import Marker
class TestParseData(unittest.TestCase):
def setUp(self):
self.marker_dummy = dict(type=1, title="test title", description="test description", latitude=1, longitude=1)
self.bad_marker_dummy = dict(type=1, title="No properties")
... |
# -*- coding: utf-8 -*-
# @date 160831 - Added some functions
"""
Business logic for User management.
"""
from auth_sys.models import MyUser
from utils.auth_permission import pwd_validation
def get_profile(user):
"""Get user list by system."""
my_user = MyUser.objects.filter(username=user.username).first(... |
#! /usr/bin/env python
#coding=utf-8
import sys, os, thread
from pymongo import Connection
from pymongo.errors import ConnectionFailure
from import_parameters import ImportParameters
from generate_stream_input import GenerateReachTable
from find_sites import FindSites
from weights_mongo import GenerateWeightInfo
impor... |
#!/usr/bin/env python
import sys
import cPickle as pickle
## CMapConverter
##
class CMapConverter(object):
def __init__(self, enc2codec={}):
self.enc2codec = enc2codec
self.code2cid = {} # {'cmapname': ...}
self.is_vertical = {}
self.cid2unichr_h = {} # {cid: unichr}
self... |
import abc
from .errors import ConversionError, UnknownConversion
class Converter(abc.ABC):
@abc.abstractmethod
def convert(self, data): ...
_TYPE_MAP = {}
def register_type(_type, converter):
_TYPE_MAP[_type] = converter
def handle_conversion(data, annotation):
if issubclass(annotation, Conve... |
"""
Test module for menus.
"""
from django.http import HttpRequest
from django.test import TestCase
from django.urls import reverse
import random
from plinth import menu as menu_module
from plinth.menu import Menu
URL_TEMPLATE = '/a{}/b{}/c{}/'
# Test helper methods
def build_menu(size=5):
"""Build a menu wi... |
#!/usr/bin/env python
#
# Looks for registration routines in the taps,
# and assembles C code to call all the routines.
#
# This is a Python version of the make-reg-dotc shell script.
# Running the shell script on Win32 is very very slow because of
# all the process-launching that goes on --- multiple greps and
# seds ... |
"""Box predictor for object detectors.
Box predictors are classes that take a high level
image feature map as input and produce two predictions,
(1) a tensor encoding box locations, and
(2) a tensor encoding classes for each box.
These components are passed directly to loss functions
in our detection models.
These m... |
''' This module contains TextFrame class that is responsible for
displaying solution tabs in text widget.
'''
from tkinter import Text, NONE, N, W, E, S, HORIZONTAL, END, SEL, INSERT
from tkinter import NUMERIC
from tkinter.ttk import Frame, Scrollbar
from pyDEA.core.data_processing.solution_text_writer import So... |
from oslo.config import cfg
from rainicorn.openstack.common import context as req_context
from rainicorn.openstack.common.gettextutils import _
from rainicorn.openstack.common import log as logging
from rainicorn.openstack.common import rpc
LOG = logging.getLogger(__name__)
notification_topic_opt = cfg.ListOpt(
... |
# machine.py
# ==========
import wmi
import win32net
import win32com.client
from BeautifulSoup import BeautifulSoup
from string import replace, digits, ascii_letters
import urllib, urllib2
DELL_SVCTAG_URI = 'http://support.dell.com/support/topics/global.aspx/support/my_systems_info/en/details?c=us'
DELL_SVCTAG_PARTS_... |
'''
Created on Apr 12, 2010
@author: bzfwadem
'''
from PySide.QtCore import QObject
from sbml_model.sbml_mainmodel import SBMLMainModel
from sbml_networkview.networkview import NetworkView
import networkx
import logging
from sbml_networkview.hyperedgenode import HyperEdgeNode
from sbml_networkview import networkview
f... |
from ibis.tests.util import assert_equal
import ibis
import ibis.expr.types as ir
import pandas as pd
import pytest
pytestmark = pytest.mark.mapd
pytest.importorskip('pymapd')
def test_table(alltypes):
assert isinstance(alltypes, ir.TableExpr)
def test_array_execute(alltypes):
d = alltypes.limit(10).doub... |
from . import AWSObject, AWSProperty, Tags
from .validators import boolean, integer
VALID_TRANSFORMATION_TYPES = (
'CMD_LINE', 'COMPRESS_WHITE_SPACE', 'HTML_ENTITY_DECODE',
'LOWERCASE', 'NONE', 'URL_DECODE')
VALID_COMPARISON_OPERATORS = ('EQ', 'GE', 'GT', 'LE', 'LT', 'NE')
VALID_IP_VERSION = ('IPV4', 'IPV6')
... |
"""Tests for trace library"""
from cStringIO import StringIO
import errno
import logging
import os
import re
import sys
import tempfile
from bzrlib import (
debug,
errors,
trace,
)
from bzrlib.tests import features, TestCaseInTempDir, TestCase
from bzrlib.trace import (
mutter, mutter_callsite, re... |
import logging
from neutronclient.neutron import v2_0 as neutronV20
from neutronclient.neutron.v2_0 import parse_args_to_dict
from neutronclient.openstack.common.gettextutils import _
RESOURCE = 'network_profile'
SEGMENT_TYPE_CHOICES = ['vlan', 'overlay', 'multi-segment', 'trunk']
class ListNetworkProfile(neutronV2... |
#!/usr/bin/env python3
"""
There are four relevant customizations to the standard distutils installation
process: (1) allowing separate installations of aeidon and gaupol, (2) writing
the aeidon.paths module, (3) handling translations and (4) extensions.
(1) Allowing separate installations of aeidon and gaupol are ha... |
import numpy as np
from astropy.units import UnitsError, UnitConversionError, Unit
from astropy import log
from .nddata import NDData
from .nduncertainty import NDUncertainty
from .mixins.ndslicing import NDSlicingMixin
from .mixins.ndarithmetic import NDArithmeticMixin
from .mixins.ndio import NDIOMixin
from .flag... |
import sys
import os.path
import cProfile
import warnings
from pylons import tmpl_context as c
import pylons
import webob
from ming.orm import session
from allura.lib import helpers as h
from allura.lib import utils
from . import base
class ScriptCommand(base.Command):
min_args = 2
max_args = None
usage... |
"""
Base settings for {{ project_name|title }} 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/
"""
import os
import sys
DJANGO_ROOT = os.path.dirname(os.path.... |
"""This script is used to synthesize generated parts of this library."""
import synthtool as s
import synthtool.gcp as gcp
import synthtool.languages.ruby as ruby
import logging
logging.basicConfig(level=logging.DEBUG)
gapic = gcp.GAPICMicrogenerator()
library = gapic.ruby_library(
"vpcaccess", "v1",
proto_p... |
#!/usr/bin/env python
# thanks to https://github.com/carljm/django-model-utils
import os
import sys
from django.conf import settings
import django
DEFAULT_SETTINGS = dict(
INSTALLED_APPS=(
'django_autocomplete',
),
DATABASES={
"default": {
"ENGINE": "django.db.backends.sql... |
#!/usr/bin/env python
"""
Weighted graph of precessed corpora via GraphViz.
Can be called on a text file containing output, or can accept piped input, from markovMusic.py.
"""
from subprocess import Popen, PIPE
import subprocess
import sys
import platform
import re
HEADER = "digraph { "
FOOTER = "}"
color = 'grey'
p... |
import tornado.httpserver
import tornado.websocket
import tornado.ioloop
import tornado.web
from tornado.wsgi import WSGIContainer
import json
import numpy as np
import pandas as pd
import datetime
from cStringIO import StringIO
from collections import namedtuple
from flapibrew import app
import matplotlib
import mat... |
from util import get_modules_objects
SETUP_DIR = "setup"
def setup():
"""Call all setup modules"""
setup_objects = get_modules_objects(SETUP_DIR)
for setup in setup_objects:
print("Setting up {0}...".format(setup.__class__.__name__))
setup.setup()
print("Setup complete!")
if __name__... |
""":mod:`wooglecalendar.orm` --- Object-relational mapping
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
WoogleCalendar uses the relational database and data on the database
are mapped to objects. It widely uses SQLAlchemy_ as its
ORM (object-relational mapping) framework.
In order to define a persist m... |
# -*- coding: utf-8 -*-
import openpyxl
import openpyxl_extend
import xlsconfig
from openpyxl.styles import PatternFill
from tps.convention import function2type
header_fill = PatternFill(patternType="solid", fgColor="FABF8F")
type_fill = PatternFill(patternType="solid", fgColor="82C3D4")
field_fill = PatternFill(patte... |
from .mininode import *
from .blockstore import BlockStore, TxStore
from .util import p2p_port
'''
This is a tool for comparing two or more adnds to each other
using a script provided.
To use, create a class that implements get_tests(), and pass it in
as the test generator to TestManager. get_tests() should be a pyt... |
#### Import section ####
from flask import render_template, request, redirect, send_from_directory, Flask, jsonify
from app import *
#from app import db
from sqlalchemy import desc, asc, cast, Date
from sqlalchemy.sql import and_, or_, not_, select, func
import os
from datetime import time, datetime, date, timedelta
fr... |
import math
from ctypes import c_void_p
import random
import numpy as np
from OpenGL.GL import *
from PyEngine3D.Common import logger
from PyEngine3D.Common.Constants import *
from PyEngine3D.Utilities import compute_tangent
from .OpenGLContext import OpenGLContext
def CreateVertexArrayBuffer(geometry_data):
ge... |
from fabric.api import *
from fabric.contrib.files import *
import os
import sys
import random
import string
import ConfigParser
# Custom Code Enigma modules
import common.ConfigFile
import common.Services
import common.Utils
import AdjustConfiguration
import Matomo
import Revert
# Override the shell env variable in F... |
from __future__ import unicode_literals
from flask import session
from werkzeug.exceptions import Forbidden
from indico.modules.attachments.controllers.management.base import (ManageAttachmentsMixin, AddAttachmentFilesMixin,
AddAttachmentLinkMixin, E... |
# -*- coding: utf-8 -*-
"""Class to represent binary data as hexadecimal."""
class Hexdump(object):
"""Class that defines a hexadecimal representation formatter (hexdump)."""
@classmethod
def _FormatDataLine(cls, data, data_offset, data_size):
"""Formats binary data in a single line of hexadecimal represen... |
#!/usr/bin/env python3
from setuptools import setup, find_packages
with open('README.md') as file:
long_description = file.read()
setup(
name='mammon',
version='0.0.0',
description='Legacy-free IRCv3.2 server built ontop of ircreactor.',
long_description=long_description,
author='William Pitco... |
# -*- coding: utf-8 -*-
"""
This program 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.
This program is distributed in... |
#! /usr/bin/env python
def score(string):
freq = dict()
freq['a']=834
freq['b']=154
freq['c']=273
freq['d']=414
freq['e']=1260
freq['f']=203
freq['g']=192
freq['h']=611
freq['i']=671
freq['j']=23
freq['k']=87
freq['l']=424
freq['m']=253
freq['n']=680
freq['o']=770
freq['p']=166
freq... |
# coding: utf-8
import os
from sqlalchemy import create_engine, MetaData, Column, Integer, String, Float
from sqlalchemy.orm import sessionmaker
from sqlalchemy.ext.declarative import declarative_base
import geoalchemy
DB_URL = os.environ['MAPYTHON_DB_URL']
DB_PREFIX = os.environ.get('MAPYTHON_DB_PREFIX', 'planet_osm... |
class Solution(object):
def suggestedProducts(self, products, searchWord):
"""
:type products: List[str]
:type searchWord: str
:rtype: List[List[str]]
"""
class TreeNode():
def __init__(self, ch):
self.ch = ch
self.child_di... |
import logging
from openerp.openupgrade import openupgrade
from openerp import pooler, SUPERUSER_ID
logger = logging.getLogger('OpenUpgrade.account_product_fiscal_classification')
column_renames = {
'account_product_fiscal_classification': [
('name', 'code'),
('description', 'name'),
],
'... |
import numpy as np
import pytest
import pytoolkit as tk
@pytest.mark.parametrize("output_count", [1, 2])
def test_predict(output_count, tmpdir):
# pylint: disable=abstract-method
dataset = tk.data.Dataset(data=np.random.randint(0, 256, size=(3, 2, 1)))
folds = [
([0, 1], [2]),
([1, 2], [0... |
import requests
import threading
import os
class Dump:
def __init__(self):
self.urls = {
0: "http://anidb.net/api/anime-titles.dat.gz",
1: "http://anidb.net/api/anime-titles.xml.gz"
}
def download(which, destination=None):
"""
I realize that the downloa... |
#!/usr/bin/env python
import os
import pandas as pd
from wmf import wmf
import numpy as np
import glob
########################################################################
# VARIABLES GLOBALES
ruta_store = None
ruta_store_bck = None
########################################################################
# ... |
"""Test fixtures."""
# Python3 support
from __future__ import print_function
from __future__ import unicode_literals
import ast
import json
import os
NAPALM_TEST_MOCK = ast.literal_eval(os.getenv('NAPALM_TEST_MOCK', default="1"))
NAPALM_HOSTNAME = os.getenv('NAPALM_HOSTNAME', default='127.0.0.1')
NAPALM_USERNAME = ... |
"""
Provides Ops for FFT and DCT.
"""
import numpy
import numpy.fft
from six.moves import xrange
from theano import tensor
from theano.gof import Op, Apply, generic
class GradTodo(Op):
# TODO : need description for class
__props__ = ()
def make_node(self, x):
return Apply(self, [x], [x.type()]... |
BERLIN_POLYGON = {
"features":[
{
"geometry":{
"coordinates":[
[
[ 13.47551254985644, 52.66878186412850 ],
[ 13.4756476943205, 52.6662806556946 ],
[ 13.48821932203047, 52.6705511650083 ],
[ 13.4852948383627, 52.6591313184541 ],
[ ... |
'''
Implementation of Bitcoin's p2p protocol
'''
import random
import sys
import time
from twisted.internet import protocol
import p2pool
from . import data as bitcoin_data
from p2pool.util import deferral, p2protocol, pack, variable
class Protocol(p2protocol.Protocol):
def __init__(self, net):
p2protoc... |
from __future__ import (absolute_import, division, generators, nested_scopes, print_function,
unicode_literals, with_statement)
import os
import textwrap
import unittest
from contextlib import contextmanager
from twitter.common.collections import maybe_list
from pants.base.revision import Rev... |
#!/usr/bin/env python3
from json import load, dump
from os import listdir
from os.path import dirname, join, isfile
def build_file_list(data_dir):
return [file for file in listdir(data_dir) if isfile(join(data_dir, file))]
def iterate_add_quotes(data_dir, file_list):
all_quotes = []
for single_file in f... |
from __future__ import unicode_literals
import frappe
from frappe import _, msgprint
from frappe.utils import date_diff, flt
def execute(filters=None):
if not filters: filters = {}
communication_list = get_communication_details(filters)
columns = get_columns()
if not communication_list:
msgprint(_("No record f... |
#!/usr/bin/env python
# -*- coding:utf-8 -*-
#
# written by Shotaro Fujimoto
# 2016-08-15
from growing_string import Main
from optimize import Optimize_powerlaw
import matplotlib.pyplot as plt
import numpy as np
from tqdm import tqdm
class Count_in_r(Main):
def __init__(self):
L = 1000
Main.__ini... |
# encoding: 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 field 'MessageBox.slug'
db.add_column('lizard_levee_messagebox', 'slug', self.gf('django.db.model... |
"""Posix implementations of platform-specific functionality."""
from __future__ import absolute_import, division, print_function, with_statement
import fcntl
import os
from tornado.platform import common, interface
def set_close_exec(fd):
flags = fcntl.fcntl(fd, fcntl.F_GETFD)
fcntl.fcntl(fd, fcntl.F_SETFD... |
import sys
import libxml2
import time
from songparser import BaseSong, BaseLibraryParser
class iTunesSong(BaseSong):
def __init__(self, songNode):
self.xmlNode = songNode
self.artist = self.xmlNode.xpathEval("string[preceding-sibling::* = 'Artist']")
self.album = self.xmlNode.xpathEval("string[preceding-sibling... |
# -*- coding: utf-8 -*-
"""
Highstock Demos
Two panes, candlestick and volume: http://www.highcharts.com/stock/demo/candlestick-and-volume
"""
from highcharts import Highstock
from highcharts.highstock.highstock_helper import jsonp_loader
H = Highstock()
data_url = 'http://www.highcharts.com/samples/data/jsonp.php?fil... |
from pprint import pprint
from config_loader import try_load_from_file
from hpOneView.oneview_client import OneViewClient
# To run this example fill the ip and the credentials bellow or use a configuration file
config = {
"ip": "<oneview_ip>",
"credentials": {
"userName": "<oneview_administrator_name>... |
"""
Wraps the Lazarus *.lps file that defines the project session.
Holds project_name, unit names, etc.
"""
import sys
from copy import deepcopy
import xml.etree.ElementTree as ET
class LPS_File( object ):
def __init__(self, project_name='project1', form1_name='Form1'):
self.project_name = st... |
from __future__ import unicode_literals
from .common import InfoExtractor
from ..compat import (
compat_urllib_parse_urlencode,
compat_urlparse,
)
from ..utils import (
float_or_none,
int_or_none,
sanitized_Request,
)
class ViddlerIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?viddler\.com/(?:v|embed|pla... |
# -*- coding: utf-8 -*-
import pygtk
pygtk.require('2.0')
import gtk
class GetSelectionExample(object):
def __init__(self):
window = gtk.Window(gtk.WINDOW_TOPLEVEL)
window.set_title("Get Selection")
window.set_border_width(10)
window.connect("destroy", gtk.main_quit)
vbox = gtk.VBox(False, 0)
window.add(vb... |
"""CMS signals tests"""
import pytest
from cms.factories import (
ResourcePageFactory,
HomePageFactory,
BootcampIndexPageFactory,
BootcampRunPageFactory,
ResourcePagesSettingsFactory,
)
pytestmark = pytest.mark.django_db
@pytest.mark.parametrize(
"page_factory",
[
HomePageFactory... |
import re
import zmq
from constants import *
# ZeroMQ Client connection (Producer)
btn_port = ZMQ_PORT
context = zmq.Context()
socket = context.socket(zmq.REQ)
socket.connect('tcp://localhost:%s' % btn_port)
def handle_signal(signal_name):
try:
socket.send(signal_name)
print 'Sent req=%s' % si... |
#!/usr/bin/python3
"""
This script test the ode_solvers defined in the same directory with two
simple examples.
Just call this using python3 ingerators_test.py in shell.
"""
import numpy as np
import solvers_pcb
import imp
imp.reload(solvers_pcb)
from matplotlib import pyplot as plt
class test_solver:
def __i... |
"""
A common module for postgres like databases, such as postgres or redshift
"""
import abc
import logging
import luigi
import luigi.task
logger = logging.getLogger('luigi-interface')
class CopyToTable(luigi.task.MixinNaiveBulkComplete, luigi.Task):
"""
An abstract task for inserting a data set into RDBMS... |
import os
import unittest
import uuid
import six
import pytest
from conans.client.store.localdb import LocalDB
from conans.test.utils.test_files import temp_folder
class LocalStoreTest(unittest.TestCase):
def test_localdb(self):
tmp_dir = temp_folder()
db_file = os.path.join(tmp_dir, "dbfile")
... |
from flask import request
from superdesk.resource import Resource, build_custom_hateoas
from superdesk.metadata.utils import item_url
from .common import get_user, get_auth, CUSTOM_HATEOAS
from superdesk.services import BaseService
from apps.common.components.utils import get_component
from apps.item_lock.components.it... |
from messengerbot.api.event_type import EventType
from messengerbot.api.messenger_requests.messenger_request import MessengerRequest
class MessengerFileRequest(MessengerRequest):
def __init__(self):
super(MessengerFileRequest, self).__init__(EventType.FILE)
self._mid = None
self._url = Non... |
"""
SALTS XBMC Addon
Copyright (C) 2014 tknorris
This program 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.
T... |
"""
This package adds support for CUDA tensor types, that implement the same
function as CPU tensors, but they utilize GPUs for computation.
It is lazily initialized, so you can always import it, and use
:func:`is_available()` to determine if your system supports CUDA.
:ref:`cuda-semantics` has more details about wor... |
#!/usr/bin/python
''' Script that generates a cubic box full of spheres in a cubic lattice with a
centered sphere of radius R_NP '''
import math
import numpy as np
import string
import random
import argparse
''' FileName '''
fileName = 'config/init.dat'
parser = argparse.ArgumentParser()
''' General parameters, t... |
# -*- coding: utf-8 -*-
import pandas as pd
import pandas.core.dtypes.concat as _concat
class TestConcatCompat(object):
def check_concat(self, to_concat, exp):
for klass in [pd.Index, pd.Series]:
to_concat_klass = [klass(c) for c in to_concat]
res = _concat.get_dtype_kinds(to_con... |
# -*- coding: utf-8 -*-
"""
Created on Mon Feb 14, 2011
@author:Isabel Restrepo
Compuets PCA reconstruction error. Each block is processed in a separate thread.
This script assumes that the pca basis has been computed as gone by extract_pca_kernels.py
"""
import os;
import bvpl_octree_batch
import multiprocessing
imp... |
"""Tests for acme.challenges."""
import unittest
import mock
import OpenSSL
import requests
from six.moves.urllib import parse as urllib_parse # pylint: disable=import-error
from acme import errors
from acme import jose
from acme import test_util
CERT = test_util.load_comparable_cert('cert.pem')
KEY = jose.JWKRSA... |
from __future__ import unicode_literals, division, absolute_import
from tests import FlexGetBase
class TestSeriesPremiere(FlexGetBase):
__yaml__ = """
templates:
global: # just cleans log a bit ..
disable_builtins:
- seen
tasks:
test_only_one:
... |
from django.shortcuts import render
from django.contrib.auth.decorators import login_required
from django.contrib.auth import authenticate, login, logout
from phonebook.forms import LoginForm, ContactForm, SearchForm
from django.shortcuts import redirect
from django.core.urlresolvers import reverse
from phonebook.model... |
"""
.h1 Welcome to YAML!
YAML is "Yet Another Markup Language" - a markup language
which is easier to type in than XML, yet gives us a
reasonable selection of formats.
The general rule is that if a line begins with a '.',
it requires special processing. Otherwise lines
are concatenated to paragraphs, and blank lines
s... |
"""
Some utility classes for exception handling of exceptions raised
within listeners:
- TracebackInfo: convenient way of getting stack trace of latest
exception raised. The handler can create the instance to retrieve
the stack trace and then log it, present it to user, etc.
- ExcPublisher: example handler ... |
# -*- coding: utf-8 -*-
"""
/***************************************************************************
DigitizingTools
A QGIS plugin
Subsumes different tools useful during digitizing sessions
-------------------
begin : 2013-02-25
copyright : (C)... |
# 2012-09-01, Chris Johnson <<EMAIL>>:
# version 0.5: don't log the reprinted messages
# 2012-08-31, Chris Johnson <<EMAIL>>:
# version 0.4: use same timestamp as buffer when reprinting, instead
# of epoch
# 2012-08-31, Chris Johnson <<EMAIL>>:
# version 0.3: switch to [var] style variables... |
'''
Created on Nov 1, 2013
@author: holtjma
'''
import argparse as ap
import logging
import os
import sys
import MSBWTGen
import util
from MUSCython import CompressToRLE
from MUSCython import GenericMerge
from MUSCython import MSBWTCompGenCython
from MUSCython import MSBWTGenCython
from MUSCython import MultimergeC... |
import datetime
import time
import re
from .normalizing import normalize
from .misc import plural_or_not, roundup
from .robottypes import is_number, is_string
_timer_re = re.compile('([+-])?(\d+:)?(\d+):(\d+)(.\d+)?')
def _get_timetuple(epoch_secs=None):
if epoch_secs is None: # can also be 0 (at least in uni... |
import GemRB
from GUIDefines import *
import CommonTables
RaceWindow = 0
TextAreaControl = 0
DoneButton = 0
SubRacesTable = 0
def OnLoad():
global RaceWindow, TextAreaControl, DoneButton
global SubRacesTable
GemRB.LoadWindowPack("GUICG", 800, 600)
RaceWindow = GemRB.LoadWindow(54)
RaceCount = CommonTables.Rac... |
from __future__ import print_function, unicode_literals
import os
import platform
import subprocess
import sys
from distutils.spawn import find_executable
from pipes import quote
SEARCH_PATHS = [
os.path.join("python", "mach"),
os.path.join("tests", "wpt"),
os.path.join("tests", "wpt", "harness"),
]
# In... |
# -*- coding: utf-8 -*-
import pytest
from django.test import TestCase
from django.core import exceptions
from oscar.apps.order.models import ShippingAddress
from oscar.core.compat import get_user_model
from oscar.apps.address import models
from oscar.test import factories
User = get_user_model()
class TestUserAdd... |
"""Tests for clu.internal.asynclib."""
from unittest import mock
from clu.internal import asynclib
import tensorflow as tf
class AsyncWriterTest(tf.test.TestCase):
def test_async_execution(self):
pool = asynclib.Pool()
counter = 0
@pool
def fn(counter_increment, return_value):
nonlocal cou... |
"""The manager for defining and managing scores."""
import datetime
from django.db.models import Q
from django.core.exceptions import ObjectDoesNotExist
from django.db.models.aggregates import Sum, Max
from apps.managers.challenge_mgr import challenge_mgr
from apps.managers.score_mgr.models import ScoreboardEntry, Poi... |
"""
Backwards compatibility with previous versions of Python.
This module provides backwards compatibility by defining
functions and classes that were not available in earlier versions of
Python. Intented usage:
>>> from nltk.compat import *
Currently, NLTK requires Python 2.4 or later.
"""
###################... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.