src stringlengths 721 1.04M |
|---|
import re
import os
from setuptools import setup
m = re.search("^__version__ = [\"](.*?)[\"]", open("blogtool/__version__.py").read())
if m:
version_str = m.group(1)
else:
raise RuntimeError("Unable to find version string in blogtool/__version__.py")
long_description = \
'''
This is an XMLRPC client for Word... |
from yowsup.demos import sendclient
#import logging #tampilan log khusus centos os
import MySQLdb
import MySQLdb.cursors
db = MySQLdb.connect(host="localhost", # your host, usually localhost
user="root", # your username
passwd="root", # your password
db="push",
cursorclass=MySQLdb.cursors.DictCursor) # name of the data... |
# -*- coding: utf-8 -*-
# messages.py
# Copyright (C) 2013 LEAP
#
# 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.
#
# Th... |
#
# Copyright (C) 2019 Kevin Thornton <krthornt@uci.edu>
#
# This file is part of fwdpy11.
#
# fwdpy11 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... |
# Copyright 2020 Google LLC
#
# 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 law or agreed to in writing, ... |
# cloudscope.console.commands.modify
# Modifies topologies in place for deploying to alternative sites.
#
# Author: Benjamin Bengfort <bengfort@cs.umd.edu>
# Created: Fri Aug 12 11:36:41 2016 -0400
#
# Copyright (C) 2016 University of Maryland
# For license information, see LICENSE.txt
#
# ID: modify.py [] benjamin@... |
#!/usr/bin/env python
# Copyright 2019 Google Inc.
#
# 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 law or... |
""" Enemy.py
by Ibrahim Sardar
"""
#general housekeeping
import pygame, math, Block
from Block import Block
pygame.init()
#window
WINDOWWIDTH = 720
WINDOWHEIGHT = 380
#Player
class Enemy(Block):
#initializer
def __init__(self, color, w, h):
#attributes
pygame.sprite.Sprite.__init__(self)
... |
from rest_framework.generics import ListAPIView
from django.core.urlresolvers import reverse
from django.contrib.gis.geos import Point
from django.forms import Form, CharField, FloatField
from django.http import HttpResponseRedirect
from django.views.generic.edit import FormView
from .models import Ponto
from .serial... |
"""
Custom Authenticator to use Globus OAuth2 with JupyterHub
"""
import os
import pickle
import base64
from tornado import web
from tornado.auth import OAuth2Mixin
from tornado.web import HTTPError
from traitlets import List, Unicode, Bool
from jupyterhub.handlers import LogoutHandler
from jupyterhub.auth import Loc... |
from django.shortcuts import render
from django.views.decorators.csrf import csrf_exempt
from django.template.loader import get_template
from django.template import Context
from django.http import StreamingHttpResponse
from django.http import HttpResponseRedirect
import datetime
from django.db.models import Q
import o... |
from zope.interface import implements, Interface
from Acquisition import aq_inner
from Products.Five import BrowserView
from Products.CMFCore.utils import getToolByName
from Products.Five.browser.pagetemplatefile import ViewPageTemplateFile
from vwcollective.simplecontact.interfaces import IContactFolder
from vwcolle... |
from django.contrib.auth import login as django_login
from django.shortcuts import resolve_url
from django.core.urlresolvers import reverse
from django.conf import settings
from stormpath.error import Error as StormpathError
from stormpath.resources.provider import Provider
from requests_oauthlib import OAuth2Session... |
#!/usr/bin/env python
# Copyright (c) 2017 Cable Television Laboratories, Inc. and others.
#
# This program and the accompanying materials
# are made available under the terms of the Apache License, Version 2.0
# which accompanies this distribution, and is available at
#
# http://www.apache.org/licenses/LICENSE-2.0
"... |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.10 on 2018-04-24 08:25
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
def populate_status(apps, schema_editor):
Status = apps.get_model("emgapi", "Status")
st = (
(1, "draft"),
... |
from symfit import parameters, variables, Fit, Piecewise, exp, Eq, Model
import numpy as np
import matplotlib.pyplot as plt
t, y = variables('t, y')
a, b, d, k, t0 = parameters('a, b, d, k, t0')
# Make a piecewise model
y1 = a * t + b
y2 = d * exp(- k * t)
model = Model({y: Piecewise((y1, t <= t0), (y2, t > t0))})
#... |
# -*- coding: utf-8 -*-
"""
Created on Fri Mar 24 12:57:27 2017
@author: nblago
"""
import numpy as np
from matplotlib import pylab as plt
from astropy.coordinates import SkyCoord
import astropy.units as u
def get_lag(f):
'''
Input file obtained by running:
gethead JD EXPTIME OBJECT EXPTIME RA DEC IMGTYP... |
# -*- coding: utf-8 -*-
# Copyright (c) 2015 The Pycroft Authors. See the AUTHORS file.
# This file is part of the Pycroft project and licensed under the terms of
# the Apache License, Version 2.0. See the LICENSE file for details.
from typing import List
from sqlalchemy import Column, String, UniqueConstraint
from p... |
from __future__ import print_function
import os
import sys
import time
from collections import defaultdict
import pytest
from process_tests import dump_on_error
from process_tests import TestProcess
from process_tests import wait_for_strings
from redis import StrictRedis
from redis_lock import Lock, AlreadyAcquired,... |
###
# This file is part of Soap.
#
# Soap 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, version 2.
#
# Soap is distributed in the hope that it will be useful, but WITHOUT ANY
# WARRANTY; without ev... |
import pytest
from jose import jwk
from jose.backends import AESKey, ECKey, HMACKey, RSAKey
from jose.backends.base import Key
from jose.exceptions import JWKError
hmac_key = {
"kty": "oct",
"kid": "018c0ae5-4d9b-471b-bfd6-eef314bc7037",
"use": "sig",
"alg": "HS256",
"k": "hJtXIZ2uSN5kbQfbtTNWbpdm... |
import os
import os.path
import string
from optparse import OptionParser
from buchner import __version__
USAGE = '%prog [options] [command] [command-options]'
VERSION = '%prog ' + __version__
def build_parser(usage):
parser = OptionParser(usage=usage, version=VERSION)
return parser
DIGIT_TO_WORD = {
... |
# Working with Bag of Words
#---------------------------------------
#
# In this example, we will download and preprocess the ham/spam
# text data. We will then use a one-hot-encoding to make a
# bag of words set of features to use in logistic regression.
#
# We will use these one-hot-vectors for logistic regression... |
#!/usr/bin/env python3
"""
Registers domains, workflows and activities
"""
from botocore.exceptions import ClientError
from aws.swf.creds import init_aws_session, DOMAIN, WORKFLOW
import boto3
def register_domain(session):
try:
response = session.register_domain(
name=DOMAIN,
descri... |
from InterfaceGenerator import InterfaceGenerator
from SDLInterface import SDLInterface
from .PythonClass import PythonClass
from .PythonMethod import PythonMethod
from . import pysdl_base
import copy
import inspect
from string import capwords
import datetime
class PythonGenerator(InterfaceGenerator):
def __init__... |
"""The base implementation for fs plugins."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import abc
import logging
import six
from treadmill import appcfg
from treadmill import plugin_manager
_LOGGER = loggin... |
import os
SETTINGS_DIR = os.path.dirname(__file__)
PROJECT_PATH = os.path.join(SETTINGS_DIR, os.pardir)
PROJECT_ROOT = os.path.abspath(PROJECT_PATH)
TEMPLATE_DIRS = (
os.path.join(PROJECT_ROOT, 'templates'),
)
BASE_DIR = os.path.dirname(os.path.dirname(__file__))
LOGIN_URL = '/login/'
LOGOUT_URL = '/logout/'
S... |
from unittest import TestCase
import datetime
from ExpenseList import ExpenseList
class TestExpenseList(TestCase):
def setUp(self):
self.el = ExpenseList()
# passing amount as a float is valid
self.el.add_expense([2.11, "Food", "Candy Bar", "12/01/2013"])
# so is a string
... |
#
# band class for Gig-o-Matic 2
#
# Aaron Oppenheimer
# 24 August 2013
#
from google.appengine.ext import ndb
import debug
import assoc
import gig
import plan
import stats
def band_key(band_name='band_key'):
"""Constructs a Datastore key for a Guestbook entity with guestbook_name."""
return ndb.Key('Band'... |
# -*- coding: utf-8 -*-
#---------- Државна комисија за спречување корупција ----------
import requests as rq
from StringIO import StringIO
import csv
from datetime import datetime
from time import sleep
from random import random
import locale
from lxml.html import fromstring
from mkopen.db.models import Data, Vers... |
#!/usr/bin/env python
# ===============================================================================
# Copyright (c) 2014 Geoscience Australia
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions ar... |
# coding=utf-8
from django.db import models
from feedback.models import Fragebogen, Ergebnis
class Fragebogen2016(Fragebogen):
fach = models.CharField(max_length=5, choices=Fragebogen.FACH_CHOICES, blank=True)
abschluss = models.CharField(max_length=5, choices=Fragebogen.ABSCHLUSS_CHOICES, blank=True)
sem... |
# -*- coding: utf-8 -*-
# Copyright (c) Vispy Development Team. All Rights Reserved.
# Distributed under the (new) BSD License. See LICENSE.txt for more info.
"""Miscellaneous functions
"""
import numpy as np
###############################################################################
# These fast normal calcula... |
# Copyright 2019 The Kubeflow Authors
#
# 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 law or agreed to in... |
import numpy as np
import time
import region_growing_python as rgp
import region_growing as rgc
from mayavi import mlab
nx = 61; ny = 51; nz = 71;
tx = np.linspace(-3,3,nx)
ty = np.linspace(-3,3,ny)
tz = np.linspace(-3,3,nz)
x,y,z = np.meshgrid(tx,ty,tz)
w = x**4 - 5*x**2 + y**4 - 5*y**2 + z**4 - 5*z**2
vol = -np.... |
from benchmark_functions import *
from pso import *
import matplotlib.pyplot as plt
iterations = 100
particles = 500
dimensions = 2
search_space = [[-5.12] * dimensions, [5.12] * dimensions]
# print init_pso(iterations, particles, search_space)
velocity, fitness, local_best, local_position, global_best, global_positi... |
import pytest
import sys
from mitmproxy.test import tutils
from mitmproxy.net.http import url
def test_parse():
with tutils.raises(ValueError):
url.parse("")
s, h, po, pa = url.parse(b"http://foo.com:8888/test")
assert s == b"http"
assert h == b"foo.com"
assert po == 8888
assert pa =... |
#! /usr/bin/env python
# -*- coding: utf-8 -*-
# -----------------------------------------------------------------------------
# Copyright (c) 2014, Nicolas P. Rougier. All rights reserved.
# Distributed under the terms of the new BSD License.
# --------------------------------------------------------------------------... |
import copy
import json
import logging
import pprint
import requests
import utils
from urlparse import urljoin
class Datapoint(dict):
"""
Models a datapoint to be ingested into blueflood.
"""
logger = logging.getLogger('blueflood.client.Datapoint')
def __init__(self, name, value, collection_time... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from django import forms
from django.core import urlresolvers
from django.utils.safestring import mark_safe
from django.template.loader import render_to_string
from markitup.widgets import AdminMarkItUpWidget, MarkItUpWidget
from django.conf import settings as site_setting... |
import os
import pytest
import subprocess
from merfi.iso import Iso
from merfi.util import which
class TestIso(object):
def create_fake_iso(self, output_dir):
""" Create a fake ISO file, without genisoimage """
iso = Iso([])
f = output_dir.join('test.iso')
f.write('ISOCONTENTS')
... |
import socket
import time
import sys
# support Python 2 and Python 3 without conversion
try:
from urllib.request import URLError
except ImportError:
from urllib2 import URLError
from amazonproduct.api import API
class RetryAPI (API):
"""
API which will try up to ``TRIES`` times to fetch a result fr... |
from enum import IntEnum, Enum, unique
from collections import namedtuple
from gi.repository import Gio
from nbxmpp.namespaces import Namespace
from gajim.common.i18n import _
from gajim.common.i18n import Q_
EncryptionData = namedtuple('EncryptionData', 'additional_data')
EncryptionData.__new__.__defaults__ = (Non... |
#
# Copyright (c) 2014 NORDUnet A/S
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or
# without modification, are permitted provided that the following
# conditions are met:
#
# 1. Redistributions of source code must retain the above copyright
# notice, this list of ... |
import os
import json
import constants
import shutil
import db
from s3 import setup_module, teardown_module
from datetime import datetime
from urlparse import urlsplit
from rigor.config import RigorDefaultConfiguration
from rigor.database import Database
from rigor.utils import RigorJSONEncoder
from rigor.interop impor... |
from tree.gardening import TreeCloner
import optparse
import sys
import ROOT
import numpy
import re
import os.path
import math
from math import *
from array import array;
#
#
# \ | | | | | _)
# |\/ | _` | __ \ | | | _ \ __| | | | _` | ... |
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not u... |
# Copyright (c) 2008-2010, Regents of the University of Colorado.
# This work was supported by NASA contracts NNJ05HE10G, NNC06CB40C, and
# NNC07CB47C.
# This library is free software. You can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as
# published by the Free Softwa... |
# Train a naiev dropout LSTM on a sentiment classification task.
# GPU command:
# THEANO_FLAGS=mode=FAST_RUN,device=gpu,floatX=float32 python script.py
# In[4]:
from __future__ import absolute_import
from __future__ import print_function
import sys
sys.path.insert(0, "/usr/local/cuda-7.0/bin")
sys.path.insert(0,... |
#!/usr/bin/env python
"""
Some example UGRIDs to test, etc with
"""
from __future__ import (absolute_import, division, print_function)
from pyugrid import ugrid
def two_triangles():
"""
returns about the simplest triangle grid possible
4 nodes, two triangles, five edges
"""
nodes = [(0.1, 0.1... |
'''
This module sets up a scheme for validating that arbitrary Python
objects are correctly typed. It is totally decoupled from Django,
composable, easily wrapped, and easily extended.
A validator takes two parameters--var_name and val--and returns an
error if val is not the correct type. The var_name parameter is u... |
""" PilotAgentsDB class is a front-end to the Pilot Agent Database.
This database keeps track of all the submitted grid pilot jobs.
It also registers the mapping of the DIRAC jobs to the pilot
agents.
Available methods are:
addPilotTQReference()
setPilotStatus()
deletePilot()
clearPilo... |
"""
Routine to create the light cones shells
L1 L2 L3 u11 u12 u13 u21 u22 u23 u31 u32 u33 (periodicity)
C2 '2.2361', '1.0954', '0.4082', '2', '1', '0', '1', '0', '1', '1', '0', '0', '(1)'
C15 '1.4142', '1.0000', '0.7071', '1', '1', '0', '0', '0', '1', '1', '0', '0', '(12)'
C6 '5.9161', '0.4140', '0.4082', '5... |
"""empty message
Revision ID: 0083_add_perm_types_and_svc_perm
Revises: 0082_add_go_live_template
Create Date: 2017-05-12 11:29:32.664811
"""
# revision identifiers, used by Alembic.
revision = '0083_add_perm_types_and_svc_perm'
down_revision = '0082_add_go_live_template'
from alembic import op
import sqlalchemy as... |
# -*- coding: utf-8 -*-
import logging
from geomsmesh import geompy
# -----------------------------------------------------------------------------
# --- partition du bloc defaut par generatrice, tore et plan fissure
def partitionBlocDefaut(volDefaut, facesDefaut, gener, pipe,
facefis, ellips... |
from pyramid.security import Allow, Everyone, Authenticated
from fanstatic import Library, Resource
from js.lightbox import lightbox
from haberdashery.resources import jqueryui, fc_css, deform_css
#from trumpet.resources import jqueryui
from trumpet.resources import StaticResources as TrumpetResources
library = Li... |
# Copyright 2015-2016, Google Inc.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and ... |
from south.db import db
from django.db import models
from csc.nl.models import *
class Migration:
def forwards(self, orm):
db.rename_table('conceptnet_frequency', 'nl_frequency')
db.rename_table('corpus_autoreplacerule', 'nl_autoreplacerule')
db.rename_table('functionwords', 'nl_funct... |
# -*- coding: utf-8 -*-
"""
urwintranet.ui.widgets.mixins
~~~~~~~~~~~~~~~~~~~~~~~~~~~
"""
import urwid
class IgnoreKeyPressMixin(object):
def keypress(self, size, key):
return key
class KeyPressMixin(object):
signals = ["click"]
def keypress(self, size, key):
"""
Send 'click' ... |
__author__ = 'alexei'
import gensim
from data_processing.mongo import MongoORM
from data_processing.util import Timer
from pprint import pprint as pp
import nltk
from nltk.stem import WordNetLemmatizer as wnl
wnl = wnl()
from pybrain.datasets import SupervisedDataSet
from pybrain.supervised.trainers import BackpropT... |
# -*- coding: utf-8 -*-
class ReaderUrl(object):
READER_BASE_URL = 'https://www.google.com/reader/api'
API_URL = READER_BASE_URL + '/0/'
ACTION_TOKEN_URL = API_URL + 'token'
USER_INFO_URL = API_URL + 'user-info'
SUBSCRIPTION_LIST_URL = API_URL + 'subscription... |
# -*- coding: utf-8 -*-
# Copyright (c) 2005 - 2015 Detlev Offenbach <detlev@die-offenbachs.de>
#
"""
Module implementing the VCS project helper for Subversion.
"""
from __future__ import unicode_literals
import os
from E5Gui.E5Application import e5App
from VCS.ProjectHelper import VcsProjectHelper
from E5Gui.E5... |
"""Functions for reading MNIST data."""
import numpy as np
from load import doubleMnist
from tensorflow.contrib.learn.python.learn.datasets import base
from tensorflow.python.framework import dtypes
class DataSet(object):
def __init__(self,
images,
labels,
dtype=dtypes... |
# sockstat module for ganglia 3.1.x and above
# Copyright (C) Wang Jian <lark@linux.net.cn>, 2009
import os, sys
import time
last_poll_time = 0
sockstats = {
'tcp_total': 0,
'tcp_established': 0,
'tcp_orphan': 0,
'tcp_timewait': 0,
'udp_total': 0 }
def metric_update():
global sockstats
f... |
from django.contrib import admin
from django.contrib.auth import views
from django.contrib.auth.decorators import login_required, permission_required
from django.contrib.auth.forms import AuthenticationForm
from django.contrib.auth.urls import urlpatterns as auth_urlpatterns
from django.contrib.messages.api import info... |
from .requests_retry import requests_retry_session
TEMPORARY_COMPANY = 'https://api.pagar.me/1/companies/temporary'
KEYS = {}
def validate_response(pagarme_response):
if pagarme_response.ok:
return pagarme_response.json()
else:
return error(pagarme_response.json())
def create_temporary_comp... |
import sys
import xgboost as xgb
import pandas as pd
import numpy as np
print("----reading data\n")
train = pd.read_csv("train.csv")
train_feature = train.columns[0:-1]
train_label = train.columns[-1]
print("----training a XGBoost\n")
dtrain = xgb.DMatrix(train[train_feature].values, label=train[train_label].values)
... |
from django.http import HttpResponse
from django.template import Context
from .models import *
from .constants import *
from .classes import *
from xml.etree import ElementTree
import hashlib, json, xmltodict, re, urllib.request, logging
logger = logging.getLogger("django")
def extract_agent_data_from_request(requ... |
#!/usr/bin/python
# -*- coding: iso-8859-1 -*-
def datepaques(an):
"""Calcule la date de Paques d'une annee donnee an (=nombre entier)"""
a = an // 100
b = an % 100
c = (3 * (a + 25)) // 4
d = (3 * (a + 25)) % 4
e = (8 * (a + 11)) // 25
f = (5 * a + b) % 19
g = (19 * f + c - e) % 30
... |
#
# Copyright 2006 Free Software Foundation, Inc.
#
# This file is part of GNU Radio
#
# GNU Radio 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, or (at your option)
# any later version.
#
#... |
from Base import FootLog
def Datestr_to_Int(datestr):
bigStr = ''.join(datestr.split('-'))
return int(bigStr[2:])#'20' is eliminated![We live in 20th century.]
'''
def Time2Float(timestr,state):
if(state == DateHandler.BREAKFAST):
elif(state == DateHandler.LUNCH):
elif(state == DateHandler.DINNER):
return Time... |
# -*- coding: utf-8 -*-
#
# mplstereonet documentation build configuration file, created by
# sphinx-quickstart on Sun Jun 23 13:39:02 2013.
#
# This file is execfile()d with the current directory set to its containing dir.
#
# Note that not all possible configuration values are present in this
# autogenerated file.
#
... |
#!/usr/bin/python
# Copyright 2013, 2014, 2015 Joshua Charles Campbell, Alex Wilson
#
# This file is part of EstimateCharm.
#
# EstimateCharm is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Found... |
"""Tests for rejester._queue
This software is released under an MIT/X11 open source license.
Copyright 2014 Diffeo, Inc.
"""
from __future__ import absolute_import
import logging
import os
import time
import pytest
from rejester.exceptions import ItemInUseError, LostLease
logger = logging.getLogger(__name__)
pyt... |
"""
${NAME}
"""
from __future__ import absolute_import, division, print_function, unicode_literals
import logging
from OpenGL import GL
import numpy
from mcedit2.rendering import renderstates
from mcedit2.rendering.blockmeshes import standardCubeTemplates
from mcedit2.rendering.blockmeshes import ChunkMeshBase
fr... |
class Ttl(object):
"""
The time to live is used for keeping track of how many nodes have relayed this messages.
The number of relayed nodes should be kept low to prevent a flooding of the overlay network.
Two was chosen because it provides the best balance between flooding the network and still
reac... |
#!/usr/bin/env python
# Copyright (c) 2011-2018, wradlib developers.
# Distributed under the MIT License. See LICENSE.txt for more info.
"""
Zonal Statistics
^^^^^^^^^^^^^^^^
This module supports you in computing statistics over spatial zones. A typical
application would be to compute mean areal precipitation for a c... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import pytest
library = 'libraries/Populated Library.lplib'
@pytest.fixture
def library_editor(librepcb, helpers):
"""
Fixture opening the library editor with an empty library
"""
librepcb.add_local_library_to_workspace(path=library)
with librepcb.op... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
"""
Copyright 2014 The LogikSim Authors. All rights reserved.
Use of this source code is governed by the GNU GPL license that can
be found in the LICENSE.txt file.
Nonimplemented virtual methods can lead to event handling Problems.
Run the script as it is and you will observ... |
import torch
from ..modules import Module
from .scatter_gather import scatter_kwargs, gather
from .replicate import replicate
from .parallel_apply import parallel_apply
class DataParallel(Module):
"""Implements data parallelism at the module level.
This container parallelizes the application of the given mo... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# --------------------------------------------------------------------
# The MIT License (MIT)
#
# Copyright (c) 2016 Jonathan Labéjof <jonathan.labejof@gmail.com>
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and assoc... |
class DJset:
def __init__(self, size, start = 0):
"""
Creates a new disjoint set data structure
Args:
start: The starting index for all elements (e.g. 0 or 1)
size: The number of elements to be considered (i.e. last index)
Operations:
find: Finds the representative of the group the element belongs ... |
# Generated file: do not edit, use gen_comps.py instead
import ecs
class MovementTarget(ecs.Component):
def __init__(self, target):
self.target = target
class AttackTarget(ecs.Component):
def __init__(self, target, dt):
self.target = target
self.dt = dt
class Path(ecs.Component):
... |
# -*- coding: utf-8 -*-
"""
The MIT License (MIT)
Copyright (c) 2015-2019 Rapptz
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 u... |
#!/usr/bin/python
#
# Author: Jashua R. Cloutier (contact via sourceforge username:senexcanis)
#
# Copyright (C) 2010, Jashua R. Cloutier
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# * Re... |
"""Admin extension tags."""
from __future__ import unicode_literals
from functools import reduce
from django import template
from django.core.urlresolvers import reverse
from django.template.loader import render_to_string
from django.utils.safestring import mark_safe
from django.utils.translation import ugettext as ... |
import datetime
import json
import logging
import os
import random
from rauth import OAuth2Service
from collections import namedtuple
from google.appengine.ext import db
import cache
class Error(Exception): pass
# Used to indicate which data objects were created in which version of
# the app, in case we need to sp... |
__all__ = ['calculate_couplings_3points', 'calculate_couplings_levine',
'compute_overlaps_for_coupling', 'correct_phases']
from compute_integrals import compute_integrals_couplings
from nac.common import (
Matrix, Tensor3D, retrieve_hdf5_data, tuplesXYZ_to_plams)
from os.path import join
import numpy as... |
"""Support for Eight Sleep binary sensors."""
import logging
from homeassistant.components.binary_sensor import BinarySensorDevice
from . import CONF_BINARY_SENSORS, DATA_EIGHT, NAME_MAP, EightSleepHeatEntity
_LOGGER = logging.getLogger(__name__)
DEPENDENCIES = ['eight_sleep']
async def async_setup_platform(hass,... |
#!/usr/bin/env python
'''
Script to check for the presence of Security headers and rate the site
More info:
https://securityheaders.io/
'''
import optparse
import mechanize
import tkinter
def validateHeaders(header, debug):
if (debug):
print "[+] Validating headers"
print "[~] Headers: " + str(header)
if (... |
#!/usr/bin/env python3
# author: greyshell
# how to run: python -m unittest test_blance_bracket.TestSolution
import unittest
from blance_bracket import solution
class TestSolution(unittest.TestCase):
def test_solution_case_1(self):
self.assertEqual(solution(['(', '(']), False)
def test_solution_cas... |
"""
Copyright 2016, 2017 UFPE - Universidade Federal de Pernambuco
Este arquivo é parte do programa Amadeus Sistema de Gestão de Aprendizagem, ou simplesmente Amadeus LMS
O Amadeus LMS é um software livre; você pode redistribui-lo e/ou modifica-lo dentro dos termos da Licença Pública Geral GNU como publicada pela ... |
#
# This file is part of pySMT.
#
# Copyright 2014 Andrea Micheli and Marco Gario
#
# 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
... |
from __future__ import absolute_import
from __future__ import print_function
import os
import sys
from scripts.lib.zulip_tools import ENDC, WARNING
from argparse import ArgumentParser
from datetime import timedelta
from django.core.management.base import BaseCommand
from django.utils.timezone import now as timezone_... |
import unittest
from katas.kyu_7.every_nth_array_element_basic import every
class EveryNthElementTestCase(unittest.TestCase):
def setUp(self):
self.lst = [0, 1, 2, 3, 4]
self.lst2 = list('test')
self.lst3 = [None, 1, ['two'], 'three', {4: 'IV'}]
def test_equal_1(self):
self.a... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# vim:fenc=utf-8
'''
Packaging
---------
:copyright (c) 2014 Xavier Bruhiere
:license: Apache 2.0, see LICENSE for more details.
'''
import multiprocessing
import setuptools
from pyconsul import __version__, __author__, __licence__, __project__
REQUIREMENTS = [... |
import os
import sys
import shutil
import subprocess
import contextlib
from collections import namedtuple
from bcbio.pipeline import config_utils
from bcbio.distributed.transaction import file_transaction, tx_tmpdir
from bcbio.utils import (safe_makedir, file_exists, is_gzipped)
from bcbio.provenance import do
from bc... |
import os
import sys
import signal
import clipboard
import keyboard
import argparse
from Classes.digikey import digikey
from Classes.globalhotkeys import GlobalHotKeys
# ____ _ _ __ __ ______ __ __
# / __ \(_)___ _(_) //_/__ __ __ / ____/__ / /______/ /_
# / / / /... |
"""
Generates an electrothermal device from a nonlinear device class
One assumption is that the base class defines numTerms directly in the
class definition and it is not changed in process_params().
-------------------------------------------------------------------
Copyright Carlos Christoffersen <c.christoffersen@... |
import tensorflow as tf
import re, ast, sys
import numpy as np
from random import sample
# import matplotlib.pyplot as plt
n_nodes_hl1 = 0
n_nodes_hl2 = 0
n_nodes_hl3 = 0
n_nodes_hl4 = 0
x = tf.placeholder('float', [None, 78])
y = tf.placeholder('float', [None, 1])
X_train = np.array([])
Y_train = np.array([])
X_tes... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.