content stringlengths 4 20k |
|---|
"""
AdamP Optimizer Implementation copied from https://github.com/clovaai/AdamP/blob/master/adamp/adamp.py
Paper: `Slowing Down the Weight Norm Increase in Momentum-based Optimizers` - https://arxiv.org/abs/2006.08217
Code: https://github.com/clovaai/AdamP
Copyright (c) 2020-present NAVER Corp.
MIT license
"""
impor... |
import stomper
import logging
from stomper.stompbuffer import StompBuffer
from twisted.internet.protocol import Protocol
log = logging.getLogger(__name__)
class StompProtocol(Protocol, stomper.Engine):
def __init__(self, client, username='', password=''):
stomper.Engine.__init__(self)
self.usern... |
from simple import rule
def life(birth = [3], survival = [2,3]):
return rule('life', birth=birth, survival=survival)
def brain(birth = [2], survival = [], decay = 1):
return rule('brain', birth=birth, survival=survival, decay=decay)
#in order NESW, like mcell
def banks(birth = [0, 0, 0, 0, 0, 0, 0, 1, 0, 0, ... |
from __future__ import absolute_import, division, print_function
__metaclass__ = type
################################################################################
# Documentation
################################################################################
ANSIBLE_METADATA = {'metadata_version': '1.1', 'statu... |
from __future__ import unicode_literals
import os
import re
from unittest import skipUnless
from django.contrib.gis.gdal import HAS_GDAL
from django.contrib.gis.geos import HAS_GEOS
from django.test import TestCase, ignore_warnings, skipUnlessDBFeature
from django.utils._os import upath
from django.utils.deprecation ... |
from oslo_serialization import jsonutils as json
from six.moves.urllib import parse as urllib
from tempest.api_schema.response.compute.v2_1 import migrations as schema
from tempest.common import service_client
class MigrationsClient(service_client.ServiceClient):
def list_migrations(self, **params):
"""... |
# -*- coding: utf-8 -*-
'''
Poseidon Add-on
Copyright (C) 2016 Poseidon
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) a... |
"""Tests for :mod:`gwsumm.config`
"""
import os.path
import tempfile
from io import StringIO
from collections import OrderedDict
from configparser import (DEFAULTSECT, ConfigParser)
import pytest
from matplotlib import rcParams
from astropy import units
from gwsumm import (state, config, html)
from gwsumm.channels... |
from tastypie import fields
from tastypie.authentication import MultiAuthentication, Authentication
from tastypie.authorization import Authorization
from tastypie.constants import ALL_WITH_RELATIONS, ALL
from tastypie.resources import ModelResource
from tastypie.throttle import CacheThrottle
from taggit.models import T... |
import sys
import os
import unittest
import platform
import subprocess
from test import test_support
class PlatformTest(unittest.TestCase):
def test_architecture(self):
res = platform.architecture()
if hasattr(os, "symlink"):
def test_architecture_via_symlink(self): # issue3762
de... |
# coding=utf-8
"""
Module as a wrapper for QgsComposition.
Contact : <EMAIL>
.. note:: 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 2 of the License, or
(at your opt... |
import abc
import os
import numpy as np
class RegressionTask(object):
__metaclass__ = abc.ABCMeta
def __init__(self, datapath='./'):
self.datapath = datapath
@abc.abstractmethod
def load_data(self):
"""Download the dataset if not exist. Return True if successful"""
ret... |
"""Setuptools file for creating AMICI module
This file is based on setuptools alone and does not require CMake.
All sources are compiled anew.
This file expects to be run from within its directory.
Requires:
- swig3.0
- setuptools
- pkgconfig python+executables
- hdf5 libraries and headers
"""
import os
import subp... |
"""
My own variation on function-specific inspect-like features.
"""
# Copyright (c) 2009 Gael Varoquaux
# License: BSD Style, 3 clauses.
import inspect
import os
import re
import warnings
from itertools import islice
from ._compat import PY3_OR_LATER
from ._compat import _basestring
from ._memory_helpers import ope... |
"""
The MIT License (MIT)
Copyright (c) 2015-present 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 use, copy, modify, merg... |
# -*- test-case-name: automat._test.test_methodical -*-
import collections
from functools import wraps
from itertools import count
try:
# Python 3
from inspect import getfullargspec as getArgsSpec
except ImportError:
# Python 2
from inspect import getargspec as getArgsSpec
import attr
import six
fro... |
""" Python 'base64_codec' Codec - base64 content transfer encoding
Unlike most of the other codecs which target Unicode, this codec
will return Python string objects for both encode and decode.
Written by Marc-Andre Lemburg (<EMAIL>).
"""
import codecs, base64
### Codec APIs
def base64_encode(input,err... |
from magnet_api import *
from magnet_utils import *
def command_users(bot, room, nick, access_level, parameters, message):
aff = {'none': ' ', 'member': 'm', 'admin': 'A', 'owner': 'O'}
role = {'visitor': ' ', 'participant': '+', 'moderator': '@'}
rolen = {'visitor': 0, 'participant': 1, 'moderator': 2}
output... |
"""The Embedding Projector plugin."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import imghdr
import os
import numpy as np
from werkzeug import wrappers
from google.protobuf import json_format
from google.protobuf import text_format
from tensorflow.c... |
"""
===============================
Nearest Centroid Classification
===============================
Sample usage of Nearest Centroid classification.
It will plot the decision boundaries for each class.
"""
print(__doc__)
import numpy as np
import matplotlib.pyplot as plt
from matplotlib.colors import ListedColormap
f... |
"""
=================================================
Concatenating multiple feature extraction methods
=================================================
In many real-world examples, there are many ways to extract features from a
dataset. Often it is beneficial to combine several methods to obtain good
performance. Th... |
from subscription_manager.base_plugin import SubManPlugin
requires_api_version = "1.0"
class SubscribePlugin(SubManPlugin):
"""Plugin triggered when a consumer subscribes to an entitlement"""
name = "subscribe"
def pre_subscribe_hook(self, conduit):
"""`pre_subscribe` hook
Args:
... |
#!/usr/bin/env python
"""
github_buildbot.py is based on git_buildbot.py. Last revised on 2014-02-20.
github_buildbot.py will determine the repository information from the JSON
HTTP POST it receives from github.com and build the appropriate repository.
If your github repository is private, you must add a ssh key to th... |
from openerp.osv import orm, fields
class payment_mode(orm.Model):
_inherit = "payment.mode"
_columns = {
'payment_term_ids': fields.many2many(
'account.payment.term', 'account_payment_order_terms_rel',
'mode_id', 'term_id', 'Payment terms',
help=('Limit selected i... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
__author__ = "Ricardo Ribeiro"
__credits__ = ["Ricardo Ribeiro"]
__license__ = "MIT"
__version__ = "1.0"
__maintainer__ = "Ricardo Ribeiro"
__email__ = "<EMAIL>"
__status__ = "Production"
from pyStateMachine.States.State import State, goto
from p... |
from setuptools import setup, find_packages
requirements = ['cycler==0.10.0',
'future==0.15.2',
'geopy==1.11.0',
'isodate==0.5.4',
'nose==1.3.7',
'numpy==1.14.4',
'pandas==0.20.2',
'patsy==0.4.1',
... |
from coalib.bearlib.aspects import Taste
from coalib.bearlib.aspects.taste import TasteMeta
from coalib.bearlib.languages import Languages
class TasteTest:
def test_class(self):
assert isinstance(Taste, TasteMeta)
def test_class__getitem__(self):
typed = Taste[int]
assert typed.cast_... |
# Caolan McNamara <EMAIL>
# a simple email mailmerge component
# manual installation for hackers, not necessary for users
# cp mailmerge.py /usr/lib/libreoffice/program
# cd /usr/lib/libreoffice/program
# ./unopkg add --shared mailmerge.py
# edit ~/.openoffice.org2/user/registry/data/org/openoffice/Office/Writer.xcu
#... |
import os, string, sys, dia
class UninlineRenderer :
def __init__ (self) :
self.count = 0
def begin_render (self, data, filename) :
imgmap = {}
dirname = os.path.dirname (filename)
ext = filename[string.rfind(filename, ".")+1:]
for layer in data.layers :
for o in layer.objects :
if "inline_data" in ... |
from polycommon.events import event_actions, event_subjects
from polycommon.events.event import ActorEvent, Attribute, Event
from polycommon.events.registry.attributes import (
PROJECT_RESOURCE_ATTRIBUTES,
PROJECT_RESOURCE_OWNER_ATTRIBUTES,
PROJECT_RUN_EXECUTOR_ATTRIBUTES,
PROJECT_RUN_EXECUTOR_OWNER_ATT... |
"""
Utilities for view tests.
"""
import json
from contentstore.tests.utils import CourseTestCase
from contentstore.views.helpers import xblock_studio_url
from xmodule.modulestore.tests.factories import ItemFactory
class StudioPageTestCase(CourseTestCase):
"""
Base class for all tests of Studio pages.
... |
import os
from samba.tests.samba_tool.base import SambaToolCmdTest
class ProcessCmdTestCase(SambaToolCmdTest):
"""Tests for samba-tool process subcommands"""
def test_name(self):
"""Run processes command"""
(result, out, err) = self.runcmd("processes", "--name", "samba")
self.assertCm... |
def main(j, args, params, tags, tasklet):
params.merge(args)
doc = params.doc
tags = params.tags
params.result = ""
args = params.tags.getValues(id="", width="800", height=400, title="", mod=100)
C = """
{{stats: id:$id start:-2h stop:-1h title:'$t1' width:$w height:$h mod:$mod}}
{{stats: i... |
from datetime import datetime
from dateutil.relativedelta import relativedelta
from openerp import netsvc
from openerp import pooler
from openerp.osv import osv
from openerp.osv import fields
from openerp.tools.translate import _
from openerp.tools import DEFAULT_SERVER_DATE_FORMAT, DEFAULT_SERVER_DATETIME_FORMAT
from ... |
""" The elements of this module define typed enums which are used in the SANS reduction framework."""
# pylint: disable=too-few-public-methods, invalid-name
from __future__ import (absolute_import, division, print_function)
from inspect import isclass
from functools import partial
from six import PY3
# ------------... |
#!/usr/bin/python
""" PN CLI cluster-create/cluster-delete """
#
# This file is part of Ansible
#
# Ansible 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 optio... |
from helper import sched
from default import with_context
import json
from mock import patch
class TestSched(sched.Helper):
def setUp(self):
super(TestSched, self).setUp()
self.endpoints = ['app', 'task', 'taskrun']
# Tests
@with_context
@patch('pybossa.api.task_run.request')
def ... |
import os, traceback, json, re
import renaissance_corpus as rc
from renaissance_corpus import Article
try:
from django.http import HttpResponse
except:
print "Couldn't find Django, maybe ok..."
import helper
ANALYSIS_CL_CONTENT = 'Cleaned Content'
ANALYSIS_ORIG_CONTENT = 'Original Content'
ANALYSIS_WORD_CN... |
import psycopg2 as pg
from behave import step, then
from time import sleep, time
@step('I start {name:w}')
def start_patroni(context, name):
return context.pctl.start(name)
@step('I shut down {name:w}')
def stop_patroni(context, name):
return context.pctl.stop(name, timeout=60)
@step('I kill {name:w}')
d... |
import os
import cPickle
import numpy as np
import Image
def makeBatch (load_path):
data = []
filenames = []
save_path = 'data.csv'
line = 'label' + ','
for i in range(0,3072):
line += 'pixel'+str(i) + ','
line += 'pixel3072'
line += '\n'
out_file = open(save_path, 'w')
out... |
# -*- encoding: utf-8 -*-
"""
Interactive demos for the h2o-py library.
:copyright: (c) 2016 H2O.ai
:license: Apache License Version 2.0 (see LICENSE for details)
"""
from __future__ import absolute_import, division, print_function, unicode_literals
import linecache
import os
import sys
import h2o
# noinspection P... |
#!/usr/bin/python
from __future__ import (absolute_import, division, print_function)
# Copyright 2019 Fortinet, Inc.
#
# 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 Lic... |
#!/usr/bin/python
"""
Open telnet session to drone and get sonar readings
usage:
./sonar.py <output file>
"""
import sys
from telnetlib import Telnet
from threading import Thread,Event,Lock
import datetime
#SONAR_EXE = "/data/video/sonar-732-arm"
SONAR_EXE = "/data/video/sonar-130610-2034-arm"
class Sonar... |
from __future__ import unicode_literals
import os
import sickbeard
from indexer_config import initConfig, indexerConfig
from sickrage.helper.encoding import ek
class indexerApi(object):
def __init__(self, indexerID=None):
self.indexerID = int(indexerID) if indexerID else None
def __del__(self):
... |
import base64
from openerp.osv import fields, osv
from openerp.tools.translate import _
class l10n_be_vat_declaration(osv.osv_memory):
""" Vat Declaration """
_name = "l1on_be.vat.declaration"
_description = "Vat Declaration"
def _get_xml_data(self, cr, uid, context=None):
if context.get('fil... |
from openerp.osv import fields, osv
class addsol_hr_attendance_payroll_config_settings(osv.osv_memory):
_inherit = 'hr.config.settings'
_columns = {
'module_hr_addsol_payroll': fields.boolean('Generate Payroll Based on Attendance',
help="This installs the module hr_addsol_payroll."),
... |
"""
Copyright (c) 2014, Guillermo A. Perez, Universite Libre de Bruxelles
This file is part of the AbsSynthe tool.
AbsSynthe 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
(a... |
import sys
import getpass
from urlparse import urljoin
from allura.lib import rest_api
SRC_CRED = dict(
api_key='c03efc6cca1cf78be9e9',
secret_key='575eda2f25f6490d8cfe5d02f2506c010112894d0ea10660e43157a87a7e620c61ac06397b028af1',
http_username=raw_input('LDAP username: '),
http_password=getpass.getpa... |
import abc
class Pipeline(object):
__head = None
__tail = None
__ctxFactory = None
def __init__(self, ctxFactory):
self.__ctxFactory = ctxFactory
def addLast(self, handler):
if handler is None:
raise Exception("handler was None")
else:
print(" ... |
# -*- coding: utf-8 -*-
import pygame
import random
import classes.board
import classes.extras as ex
import classes.game_driver as gd
import classes.level_controller as lc
class Board(gd.BoardGame):
def __init__(self, mainloop, speaker, config, screen_w, screen_h):
self.lvlc = mainloop.xml_conn.get_leve... |
# -*- coding: utf-8 -*-
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding field 'BuildResult.total_size'
db.add_column(u'ide_buildresult', 'total_size',
... |
#!/usr/bin/env python
__version__ = '$Revision: 2068 $'.split()[1]
__date__ = '$Date: 2006-05-02 08:17:59 -0400 (Tue, 02 May 2006) $'.split()[1]
__author__ = 'Kurt Schwehr'
__doc__='''
Handle encoding and decoding AIS strings.
@bug: need some more interesting doctests!
@bug: needs to throw an exception if the charac... |
import os
import time
import datetime
import PID
import Temp
import csv
direc = os.path.dirname(os.path.realpath(__file__)) #"/home/pi/brewing/temps/"
initcond = Temp.read_temp()
setpoint = initcond[1] # gets setpoint from initial condition data
valvset = 0 #initial valv setting will be 0 but will be updated... |
#!/usr/bin/env python
"""Test case."""
import os
import subprocess
import sys
import unittest
ROOT_DIR = os.path.split(os.path.abspath(os.path.dirname(__file__)))[0]
sys.path.append(ROOT_DIR)
class Tests(unittest.TestCase):
def test_system_gradient(self):
'''Test system with a gradient image file.'''
... |
"""
Application Profile.
An Application Profile contains all the information about an application in
Mackup. Name, files, ...
"""
import os
from .mackup import Mackup
from . import utils
class ApplicationProfile(object):
"""Instantiate this class with application specific data."""
def __init__(self, macku... |
from __future__ import absolute_import
import os
import json
import logging
from os.path import join as pjoin
import six
from st2client.commands import resource
from st2client.commands.noop import NoopCommand
from st2client.formatters import table
from st2client.models.keyvalue import KeyValuePair
from st2client.ut... |
# -*- coding: utf-8 -*-
"""
ptime.completion
~~~~~~~~~~~~~~~~
:copyright: (c) 2013 by Marat Ibadinov.
:license: MIT, see LICENSE for more details.
"""
from calendar import monthrange
from datetime import datetime
ATTRIBUTES = ['century', 'year', 'month', 'day', 'ampm', 'hour', 'minute', 'second']
MI... |
import copy
MOVIES = [
{
'movieid': 1,
'imdbnumber': 'tt1392170',
'playcount': 3,
'originaltitle': 'The Hunger Games',
'title': 'The Hunger Games',
'year': 2011,
'lastplayed': '2014-10-10 20:03:31'
}, {
'movieid': 2,
'imdbnumber': 'tt14401... |
""" An AJAX based theme """
import pyflag.conf
config=pyflag.conf.ConfObject()
import pyflag.FlagFramework as FlagFramework
import pyflag.Registry as Registry
import pyflag.Theme as Theme
import pyflag.DB as DB
from plugins.Themes.Menus import Menu
class AJAX(Menu):
header='''<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTM... |
"""
Exercises the frontend endpoints for the system
"""
import json
import logging
from string import ascii_letters, digits
from random import randint, random, choice
from locust import HttpLocust, TaskSet, TaskSequence, task, seq_task, between
MASTER_PASSWORD = "password"
TRANSACTION_ACCT_LIST = [str(randint(1111... |
#This programm is used to convert the .vcard from Nokias N900 to .csv format (for example Thunderbird)
#convert the .db into CSV tith all data in it *.csv
#from there you can transform it in a CSV for osmo called *_osmo.csv
import pexpect
child = pexpect.spawn("ls -1")
inn = open(child.readline(),'r')
out = open('/h... |
import logging
import urllib
import fixtures
import mock
from oslo_utils import timeutils
import routes
import webob
from murano.api.v1 import request_statistics
from murano.api.v1 import router
from murano.common import policy
from murano.common import rpc
from murano.common import wsgi
from murano.tests.unit import... |
"""add conductor_affinity and online
Revision ID: 487deb87cc9d
Revises: 3bea56f25597
Create Date: 2014-09-26 16:16:30.988900
"""
# revision identifiers, used by Alembic.
revision = '487deb87cc9d'
down_revision = '3bea56f25597'
from alembic import op
import sqlalchemy as sa
def upgrade():
op.add_column(
... |
ANSIBLE_METADATA = {'metadata_version': '1.0',
'status': ['stableinterface'],
'supported_by': 'core'}
import errno
import os
import shutil
import time
# import module snippets
from ansible.module_utils.basic import AnsibleModule
from ansible.module_utils.pycompat24 import get_... |
from plot_curve import PlotCurve
from plot_surface import PlotSurface
from sympy import pi, lambdify
from sympy.functions import sin, cos
from math import sin as p_sin
from math import cos as p_cos
def float_vec3(f):
def inner(*args):
v = f(*args)
return float(v[0]), float(v[1]), float(v[2])
... |
import stock_move_report
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: |
"""Resources for managing badges."""
from pyramid.registry import Registry
from adhocracy_core.interfaces import IPool
from adhocracy_core.interfaces import IServicePool
from adhocracy_core.interfaces import ISimple
from adhocracy_core.resources import add_resource_type_to_registry
from adhocracy_core.resources.simpl... |
from __future__ import absolute_import
import atexit
import functools
import numpy
import os
import random
import types
import unittest
from chainer.backends import cuda
_old_python_random_state = None
_old_numpy_random_state = None
def _numpy_do_setup(deterministic=True):
global _old_python_random_state
... |
import unittest
from gi.repository import GObject
from gi.repository import CrankBase
class TestRange(unittest.TestCase):
def test_uint_equal (self):
a = CrankBase.RanUint.init (3, 5)
b = CrankBase.RanUint.init (0, 4)
c = CrankBase.RanUint.init (3, 5)
assert (not a.equal (b))
assert (a.equal (c))
... |
import re
patron = '[0-7]'
palabras = ['1', '15', '7']
for palabra in palabras:
if re.match(patron, palabra):
print("La palabra " + palabra + " cumple.")
else:
print("La palabra " + palabra + " no cumple.")
patron = '\\\[a-z]sa'
palabras = ['casa', 'cesa', 'cosa', 'tasa', '\\asa']
for palabr... |
# -*- encoding:utf-8 -*-
from __future__ import unicode_literals
MESSAGES = {
"%d min remaining to read": "ulteriori %d minuti di lettura",
"(active)": "(attivo)",
"Also available in:": "Disponibile anche in:",
"Archive": "Archivio",
"Categories": "Categorie",
"Comments": "Commenti",
"LANGU... |
{ 'sequence': 500,
"name" : "Austrian VAT declaration"
, "version" : "1.0"
, "author" : "Swing Entwicklung betrieblicher Informationssysteme GmbH"
, "website" : "http://www.swing-system.com"
, "description" :
"""
U30 is a XML-type VAT declaration for the Austrian governement.
This module generates... |
"""
Tests for L{twisted.application.strports}.
"""
from twisted.trial.unittest import TestCase
from twisted.application import strports
from twisted.application import internet
from twisted.internet.test.test_endpoints import ParserTestCase
from twisted.internet.protocol import Factory
from twisted.internet.endpoints ... |
"""
Douban Movie Web Spider powered by parsing HTML
"""
import datetime
import os
import urllib.parse
import pandas as pd
import scrapy
from pymongo import MongoClient
from DataHouse.items import DoubanMovie
douban_movie_list = []
client = MongoClient()
start_time = datetime.datetime
class DoubanMovieSpider(scrap... |
import os.path
import unittest
from fetcher.mojom_file import MojomFile
from fetcher.dependency import Dependency
from fetcher.repository import Repository
from fakes import FakeDependency, FakeMojomFile
class TestMojomFile(unittest.TestCase):
def test_add_dependency(self):
mojom = MojomFile(Repository("/base/... |
from __future__ import division, absolute_import, print_function
import sys
import warnings
import numpy as np
from numpy.testing import *
from numpy.compat import sixu
# Switch between new behaviour when NPY_RELAXED_STRIDES_CHECKING is set.
NPY_RELAXED_STRIDES_CHECKING = np.ones((10, 1), order='C').flags.f_contiguo... |
#!/usr/bin/env python3
# So this was the first script I used to toy with the data.
# Useless and deprecated.
# Docs
# ====
# http://datacrystal.romhacking.net/wiki/Pok%C3%A9mon_3rd_Generation#Maps
# Elitemap's PokeRoms.ini
# Elitemap's source code
# http://www.pokecommunity.com/showthread.php?t=156018
import binasc... |
from test_framework import DoucoinTestFramework
from doucoinrpc.authproxy import AuthServiceProxy, JSONRPCException
from util import *
import os
import shutil
# Create one-input, one-output, no-fee transaction:
class MempoolSpendCoinbaseTest(DoucoinTestFramework):
def setup_network(self):
# Just need one ... |
import re
import json
from uuid import uuid4
# Django Libraries
from django.contrib.auth.models import User
# CloudScape Libraries
from cloudscape.common.utils import valid, invalid
from cloudscape.common.vars import G_ADMIN, U_ADMIN
from cloudscape.engine.api.app.group.models import DBGroupDetails, DBGroupMembers
fr... |
#!/usr/bin/python
""" turtle-example-suite:
tdemo-I_dont_like_tiltdemo.py
Demostrates
(a) use of a tilted ellipse as
turtle shape
(b) stamping that shape
We can remove it, if you don't like it.
Without using reset() ;-)
---------------------------------------
"""
from turtle import *
impo... |
"""Tests for useful utilities for higher level polynomial classes. """
from sympy import S, I, Integer, sqrt, symbols, raises, pi
from sympy.polys.polyutils import (
_sort_gens,
_unify_gens,
_analyze_gens,
_sort_factors,
_analyze_power,
_dict_from_basic_if_gens,
_dict_from_basic_no_gens,
... |
import datetime as dt
import pytz
_OPER_ERR_MSG = """unsupported operand.
datetimestat requires Iterable of datetime objects (all naive or all with tz). You passed:
"""
_LEN_ERR_MSG = """zero-length operand
datetimestat requires Iterable of length greater than zero. You passed an empty iterable.
"""
_VAL_ERR_MSG = """... |
# lol monte carlo for the win :-)
from inputs import TWENTYFIRST
from itertools import combinations
class Character():
def strike(self, enemy):
damage = self.DMG - enemy.ARMOR
damage = 1 if damage < 1 else damage
enemy.HP -= damage
#print "{} strikes {} for {} damage: HP now at {}... |
from os import remove
from os.path import exists
from tempfile import mktemp
from testtools.matchers import Contains, Not
from time import sleep
from autopilot.tests import AutopilotTestCase
from autopilot.emulators.unity import (
start_log_to_file,
reset_logging,
set_log_severity,
log_unity_message,
... |
from __future__ import absolute_import, division, print_function, unicode_literals
import functools
from contextlib import contextmanager
from pants.build_graph.target import Target
from pants.task.mutex_task_mixin import MutexTaskMixin
from pants.util.contextutil import temporary_dir
from pants_test.test_base import... |
from config.api2_0_config import config
from config.amqp import *
from modules.logger import Log
from on_http_api2_0 import ApiApi as Api
from on_http_api2_0 import rest
from on_http_api2_0.rest import ApiException
from proboscis.asserts import assert_equal
from proboscis.asserts import assert_not_equal
from proboscis ... |
import sys
import mock
from oslo.config import cfg
from neutron.db import api as db
from neutron.plugins.embrane.common import config # noqa
from neutron.tests.unit import test_extension_extraroute as extraroute_test
from neutron.tests.unit import test_l3_plugin as router_test
PLUGIN_NAME = ('neutron.plugins.embran... |
import logging
import time
import json
from datetime import datetime
# from django.conf import settings
from kombu.mixins import ConsumerMixin
from geonode.geoserver.signals import geoserver_post_save_local
from geonode.security.views import send_email_consumer # , send_email_owner_on_view
# from geonode.social.signa... |
#!/usr/bin/python3
# Used for my final project in data mining. This produces datasets in .arff
# format to be used by weka.
import sys
import random as rand
# tolerance is the max difference between values of the same attribute that
# all the instances of a cluster can have. so for example, if tolerance is 5
# and... |
import math
import imath
import IECore
import Gaffer
Gaffer.Metadata.registerValue( "as:light:latlong_map_environment_edf", "type", "environment" )
Gaffer.Metadata.registerValue( "as:light:latlong_map_environment_edf", "textureNameParameter", "radiance_map" )
Gaffer.Metadata.registerValue( "as:light:latlong_map_envir... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
AUTHOR = 'Alexis Métaireau'
SITENAME = "Alexis' log"
SITEURL = 'http://blog.notmyidea.org'
TIMEZONE = "Europe/Paris"
# can be useful in development, but set to False when you're ready to publish
RELATIVE_URLS = True
GITHUB_URL = 'http://github.com/ameta... |
from __future__ import (absolute_import, division, generators, nested_scopes, print_function,
unicode_literals, with_statement)
from collections import namedtuple
from pants.option.custom_types import dict_option, list_option
from pants.option.option_util import is_boolean_flag
class OptionH... |
#!/usr/bin/python
from datetime import timedelta, datetime
from ansible.module_utils.basic import AnsibleModule
try:
from kubernetes import client, config, watch
HAS_LIB = True
except ImportError as err:
HAS_LIB = False
ANSIBLE_METADATA = {
'metadata_version': '1.1',
'status': 'preview',
'sup... |
from django import template
from django.template import Node, NodeList
register = template.Library()
#==========================
# -*- coding: utf-8 -*-
'''
A smarter {% if %} tag for django templates.
While retaining current Django functionality, it also handles equality,
greater than and less than operators. Some... |
"""Core visualization operations."""
# Authors: Alexandre Gramfort <<EMAIL>>
# Eric Larson <<EMAIL>>
# Oleh Kozynets <<EMAIL>>
# Guillaume Favelier <<EMAIL>>
#
# License: Simplified BSD
from abc import ABCMeta, abstractclassmethod
class _BaseRenderer(metaclass=ABCMeta):
@abstractclass... |
"""
Django settings for myreel 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/
"""
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
imp... |
#!/usr/bin/env python
import roslib
roslib.load_manifest('yocs_velocity_smoother')
import rospy
import os
import sys
import time
from geometry_msgs.msg import Twist
from nav_msgs.msg import Odometry
'''
Varied translational input for a velocity smoother test.
'''
STATE_RAMP_UP = 0
STATE_RAMP_LEVEL = 1
STATE_RAMP_DO... |
from . import new_conversations
from flask import jsonify, request, abort
from flask import current_app as app
import os
from .. import traceless_crypto
@new_conversations.route('/')
def hello_world():
return "hello world"
@new_conversations.route('/initiate', methods=['POST'])
def initiate():
server_seen_non... |
"""This module provides an implementation of the autodiscovery protocol.
"""
from cStringIO import StringIO
from time import time, strftime, localtime
import traceback
import uuid
from xml.etree.ElementTree import Element, ElementTree, tostring
from pylons import request, response
from pylons import config
from pylo... |
"""
rv_audio.py - play audio playback / record on guest
and detect any pauses in the audio stream.
Requires: rv_connect test
"""
import logging
from autotest.client.shared import error, utils
def verify_recording(recording, params):
"""Tests whether something was actually recorded
Threshold is a number of ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.