src stringlengths 721 1.04M |
|---|
# (c) 2012-2014, Michael DeHaan <michael.dehaan@gmail.com>
#
# 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 option) an... |
__author__ = 'Alexander Weigl'
# From: https://github.com/behnam/python-ply-xml/blob/master/parser.py
#
#
import sys
from UserString import UserString
from ply import lex, yacc
_VERSION = '1.0'
################################
# LEXER
class XmlLexer:
'''The XML lexer'''
# states:
# default: The... |
import unittest
from argparse import Namespace
from pefimproxy.server import WsgiApplication
class ServerConfigurationTestCase(unittest.TestCase):
def setup_class(self):
pass
def test_server_config_files_ok(self):
valid, message = WsgiApplication.validate_server_config(
Namespace(... |
"""
[6/25/2014] Challenge #168 [Intermediate] Block Count, Length & Area
https://www.reddit.com/r/dailyprogrammer/comments/291x9h/6252014_challenge_168_intermediate_block_count/
#Description:
In construction there comes a need to compute the length and area of a jobsite. The areas and lengths computed are used
by est... |
# This file is part of Metaphor.
# Metaphor 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.
# Metaphor is distributed in the hope tha... |
#!/usr/bin/python
## This file is distributed under the terms in the attached LICENSE file.
## If you do not find this file, copies can be found by writing to:
## Intel Research Berkeley, 2150 Shattuck Avenue, Suite 1300,
## Berkeley, CA, 94704. Attention: Intel License Inquiry.
## Or
## UC Berkeley EECS Computer Sci... |
import logging
import traceback
from django.contrib.auth.models import User
from corehq.apps.locations.models import Location
from corehq.apps.sms.mixin import PhoneNumberInUseException, VerifiedNumber
from corehq.apps.users.models import WebUser, CommCareUser, CouchUser, UserRole
from custom.api.utils import apply_upd... |
# Copyright (c) 2011-2014 OpenStack Foundation.
#
# 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 agre... |
# Author: Nic Wolfe <nic@wolfeden.ca>
# URL: http://code.google.com/p/sickbeard/
#
# This file is part of SickRage.
#
# SickRage 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,... |
from __future__ import absolute_import
import re
from copy import copy
import numpy as nm
from sfepy.base.base import (as_float_or_complex, get_default, assert_,
Container, Struct, basestr, goptions)
from sfepy.base.compat import in1d
# Used for imports in term files.
from sfepy.terms.ex... |
# coding=utf-8
# Copyright 2015 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
from __future__ import absolute_import, division, print_function, unicode_literals
import os
import shutil
from collections import defaultdict
from pants.build_graph.addre... |
import binascii
import threading
import psycopg2
from psycopg2.extensions import new_type, register_type
try:
import cPickles as pickle
except ImportError:
import pickle
from . import BaseGarden
def adapt_bytea(obj):
'''Adapt an object to a bytea by pickling.'''
if isinstance(obj, str):
# Co... |
# !/usr/bin/python
# The FiltSort function need an input: the path to a folder,
# and then it will generate an output.txt file that includes
# the "index, file name, address, maintag, subtag, subtag2"
# of every file in that folder.
# It can also return the output file as a list.
import os
def setLabel(pat... |
from pathlib import Path
from setuptools import setup, find_packages
if __name__ == "__main__":
base_dir = Path(__file__).parent
src_dir = base_dir / 'src'
about = {}
with (src_dir / "vivarium" / "__about__.py").open() as f:
exec(f.read(), about)
with (base_dir / "README.rst").open() a... |
from helper import unittest, PillowTestCase, hopper
from PIL import Image
import colorsys
import itertools
class TestFormatHSV(PillowTestCase):
def int_to_float(self, i):
return float(i)/255.0
def str_to_float(self, i):
return float(ord(i))/255.0
def to_int(self, f):
return i... |
from setuptools import setup, find_packages # Always prefer setuptools over distutils
from codecs import open # To use a consistent encoding
from os import path
here = path.abspath(path.dirname(__file__))
# Get the long description from the relevant file
#with open(path.join(here, 'DESCRIPTION.rst'), encoding='utf-... |
from __future__ import unicode_literals
from collections import OrderedDict
from django_tables2 import RequestConfig
from django.conf import settings
from django.contrib import messages
from django.contrib.contenttypes.models import ContentType
from django.core.exceptions import ValidationError
from django.db import ... |
#!/usr/bin/env python3
# Copyright (c) 2015-2019 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""Test bitcoind with different proxy configuration.
Test plan:
- Start vcored's with different proxy con... |
# -*- coding: utf-8; -*-
#
# This file is part of Superdesk.
#
# Copyright 2013, 2014, 2015 Sourcefabric z.u. and contributors.
#
# For the full copyright and license information, please see the
# AUTHORS and LICENSE files distributed with this source code, or
# at https://www.sourcefabric.org/superdesk/license
from d... |
#!/usr/bin/env python3
from test_framework.test_framework import BitcoinTestFramework
from test_framework.util import *
from test_framework.script import *
from test_framework.mininode import *
from test_framework.berycoin import *
from test_framework.address import *
from test_framework.blocktools import *
import tim... |
# -*- coding: utf-8 -*-
from glyph import *
@glyph('A')
class AGlyph(Glyph):
def __init__(self, x, y, capHeight):
super(AGlyph, self).__init__(x, y, capHeight)
def width(self):
return self.em()
def getPolygon(self):
super(AGlyph, self).setupDrawing()
leftLine = Line(self... |
# -*- coding: utf-8 -*-
import random,sys,time
def isBoxBusy(gamePlan,row, col, EMPTY):
if gamePlan[row][col] == EMPTY:
return False
return True
def computerSelectABox(gamePlan,sign,EMPTY):
size = len(gamePlan)
print("\n---Datorns tur ("+str(sign)+")---")
row = random.randrange(0,size)
col = random.r... |
"""Use of ``noarch`` and ``skip``
When to use ``noarch`` and when to use ``skip`` or pin the interpreter
is non-intuitive and idiosynractic due to ``conda`` legacy
behavior. These checks aim at getting the right settings.
"""
import re
from . import LintCheck, ERROR, WARNING, INFO
# Noarch or not checks:
#
# - Py... |
#!/usr/bin/env python3
# Copyright (c) 2017-2020 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""Test various fingerprinting protections.
If a stale block more than a month old or its header are requ... |
"""
Nginx-rtmp-module stat parser.
Need to install nginx-rtmp-module first.
"""
import xml.dom.minidom
import urllib2
if __package__ is None:
from utils import error_exit
else:
from .utils import error_exit
STAT_URL = "http://127.0.0.1:8080/stat"
def pass_for_node_value(root, node_name):
child = root.... |
'''
Syn flood program in python using raw sockets (Linux)
Initial: Silver Moon (m00n.silv3r@gmail.com)
'''
# some imports
import socket, sys, random, time, Queue
from struct import *
class SYNFLOOD():
def __init__(self, Q, TARGET_IP, TARGET_PORT, RATE):
#threading.Thread.__init__(self) # Re... |
import sys
import os.path
sys.path.append(os.path.abspath(__file__ + "\..\.."))
import windows
import windows.native_exec.simple_x86 as x86
import windows.native_exec.simple_x64 as x64
print("Creating a notepad") ## Replaced calc.exe by notepad.exe cause of windows 10.
notepad = windows.utils.create_process(r"C:\wind... |
#!/usr/bin/env python
from setuptools import setup
from PyFileMaker import __version__, __doc__
setup(
name='PyFileMaker',
version=__version__,
description='Python Object Wrapper for FileMaker Server XML Interface',
long_description=__doc__,
classifiers=[
'Development Status :: 4 - Beta',
... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Authors : David Castellanos <dcastellanos@indra.es>
#
# Copyright (c) 2012, Telefonica Móviles España S.A.U.
#
# This program 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... |
from unittest import TestCase
from unittest.mock import MagicMock
import os
from bob.errors import ParseError
from bob.input import Recipe
from bob.languages import ScriptLanguage
from bob.stringparser import Env
class TestDependencies(TestCase):
def cmpEntry(self, entry, name, env={}, fwd=False, use=["result",... |
###START-CONF
##{
##"object_name": "fastainject",
##"object_poi": "qpwo-2345",
##"auto-load": true,
##"remoting" : false,
##"parameters": [
##
## ],
##"return": [
## {
## "name": "fasta",
## "description": "raw fasta",
## "required... |
from collections import defaultdict
from datetime import timedelta
from ichnaea.data.tasks import cleanup_datamap, update_datamap
from ichnaea.models.content import DataMap, encode_datamap_grid
from ichnaea import util
class TestDataMapCleaner(object):
@property
def today(self):
return util.utcnow().... |
#! /usr/bin/env python
"""
print DCommands session environment variables
"""
import DIRAC
from COMDIRAC.Interfaces import critical
from COMDIRAC.Interfaces import DSession
if __name__ == "__main__":
from COMDIRAC.Interfaces import ConfigCache
from DIRAC.Core.Base import Script
Script.setUsageMessage( '\n'.j... |
# Nativity in Bits 0.1.5
# Copyright 2008, 2009 Meadow Hill Software
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License version 3 as
# published by the Free Software Foundation.
#
# This program is distributed in the hope that it will be usefu... |
"""
~~~~~~~~~~~~~~~~~~~~~
Nose-Pyversion-Plugin
~~~~~~~~~~~~~~~~~~~~~
"""
import os
import sys
from setuptools import find_packages, setup
# Required for nose.collector, see http://bugs.python.org/issue15881#msg170215
try:
import multiprocessing
except ImportError:
pass
here = os.path.abspath(os.path.dirnam... |
# coding: utf8
from Autodesk.Revit.DB import (
FilteredElementCollector,
BuiltInCategory,
Transaction,
Document,
BuiltInParameter,
Category,
Connector,
)
from Autodesk.Revit.DB.Mechanical import DuctFlowConfigurationType
import rpw
from pyrevit import script, forms
__title__ = "AirFlowSpac... |
import urllib, shutil
from ConfigParser import SafeConfigParser
import pyGeno.configuration as conf
from pyGeno.SNP import *
from pyGeno.tools.ProgressBar import ProgressBar
from pyGeno.tools.io import printf
from Genomes import _decompressPackage, _getFile
from pyGeno.tools.parsers.CasavaTools import SNPsTxtFile
fro... |
import time
from datetime import datetime
import praw
import prawcore.exceptions
from . import config
# Returns a list of urls posted to the subreddit_name between start_date and end_date.
# The list is in the form: [url, date_string], [url, date_string], [url, date_string], ... ]
def subs_to_download(subreddit_name... |
# This file is part of a program licensed under the terms of the GNU Lesser
# General Public License version 2 (or at your option any later version)
# as published by the Free Software Foundation: http://www.gnu.org/licenses/
from __future__ import division, print_function, unicode_literals
from ctypes import (
... |
from django import forms
from django.contrib import admin
# from django.contrib.contenttypes import generic
from django.utils.text import mark_safe
from yawdadmin.resources import admin_site
from yawdadmin.admin import SortableModelAdmin, PopupModelAdmin, PopupInline, \
OneToOneInline
from yawdadmin.sites import Ya... |
import os
import bz2
import sys
import logging
import traceback
import cStringIO
import tempfile
from django.conf import settings
from django.http import HttpResponse, HttpResponseBadRequest
from django.core.servers.basehttp import FileWrapper
from django.core import serializers
from buildmanager.models ... |
#!/usr/bin/env python
import vtk
def main():
colors = vtk.vtkNamedColors()
# Setup four points
points = vtk.vtkPoints()
points.InsertNextPoint(0.0, 0.0, 0.0)
points.InsertNextPoint(1.0, 0.0, 0.0)
points.InsertNextPoint(1.0, 1.0, 0.0)
points.InsertNextPoint(0.0, 1.0, 0.0)
# Create the... |
"""
There are three types of functions implemented in SymPy:
1) defined functions (in the sense that they can be evaluated) like
exp or sin; they have a name and a body:
f = exp
2) undefined function which have a name but no body. Undefined
functions can be defined using a Function cla... |
#!/usr/bin/env python
# -.- coding: utf-8 -.-
# Author : Deniz Turgut
# Created : 05.11.2011
from PyQt4 import QtGui, QtCore
class SearchModel(QtGui.QSortFilterProxyModel):
def __init__(self, parent=None):
super(SearchModel, self).__init__(parent)
self.setSortCaseSensitivity(QtCore.Qt.CaseInsensi... |
"""
recipy-related regexps.
"""
# Copyright (c) 2016 University of Edinburgh.
def get_usage():
"""
Get regular expressions for usage information printed to console.
:returns: regular expressions
:rtype: list of str or unicode
"""
return [r"Usage:\n"]
def get_version():
"""
Get regu... |
# -*- coding: utf-8 -*-
#
# codimension - graphics python two-way code editor and analyzer
# Copyright (C) 2010-2017 Sergey Satskiy <sergey.satskiy@gmail.com>
#
# 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 Softw... |
""" Lower level layer for slicer.
Mom's spaghetti.
"""
# TODO: Consider boolean array indexing.
from typing import Any, AnyStr, Union, List, Tuple
from abc import abstractmethod
import numbers
class AtomicSlicer:
""" Wrapping object that will unify slicing across data structures.
What we support:
Ba... |
from django.conf.urls import url, include
from rest_framework.urlpatterns import format_suffix_patterns
from . import views
from .views import UserInfoListView, SnippetDetail, ApoderadoInfo, DocenteInfo
urlpatterns = [
url(r'^colegio_api/$', views.ColegioList.as_view()),
url(r'^colegio_api/(?P<pk>\d+)/$', vie... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Create the data for the LSTM.
"""
import os
import sys
import argparse
import numpy as np
import h5py
import itertools
import pdb
import re
from collections import defaultdict
def gen_preds(args, gold=0):
if not gold:
try:
k = args.k
... |
# -*- coding: utf-8 -*-
from south.utils import datetime_utils as datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
from oscar.core.compat import AUTH_USER_MODEL, AUTH_USER_MODEL_NAME
class Migration(SchemaMigration):
def forwards(self, orm):
# Changing ... |
# ...
# ============================================================================ #
class ColorDetails(object):
def __init__(self, data):
self.brightness = data.get('id') # (number) – The brightness.
self.contrast = data.get('id') # (number) – The contrast.
self.hue = data.get('id') # (number) – The hue in... |
#!/usr/bin/env python
# -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*-
### BEGIN LICENSE
# Copyright (C) 2010 <Atreju Tauschinsky> <Atreju.Tauschinsky@gmx.de>
# This program is free software: you can redistribute it and/or modify it
# under the terms of the GNU General Public License version ... |
""" Reads claviger's configuration file. """
import yaml
import logging
import os.path
import textwrap
import itertools
import collections
import six
import tarjan
import jsonschema
import claviger.authorized_keys
class ConfigError(Exception):
pass
ParsedServerKey = collections.namedtuple('ParsedServerKey',
... |
import numpy as np
from numpy.testing import assert_almost_equal
from math import pi
from keras_retinanet.utils.transform import (
colvec,
transform_aabb,
rotation, random_rotation,
translation, random_translation,
scaling, random_scaling,
shear, random_shear,
random_flip,
random_transf... |
# bultin library
from uuid import uuid4
# external libraries
from sanic import Sanic
from sanic.views import HTTPMethodView
from sanic.response import json
from sanic_cors import CORS
app = Sanic()
"""
POST /tasks
GET /tasks
GET /task/<id>
PUT /task/<id>
"""
DATOS = {}
class TaskList(HTTPMethodView):
def po... |
import os
from subprocess import Popen, PIPE, call
class Symgroup:
def __init__(self,
symmetry='c 5',
label=False,
connect=False,
central_atom=0,
custom_atom_list=None):
self._symmetry = symmetry
self._label = la... |
#! /usr/bin/env python
import wx, wx.lib
TimeLineSelectionEvent, EVT_TIMELINE_SELECTED = wx.lib.newevent.NewEvent()
TimeLineActivationEvent, EVT_TIMELINE_ACTIVATED = wx.lib.newevent.NewEvent()
class HotMap(object):
''' Keep track of which node is where. '''
def __init__(self, parent=None):
self... |
#!/usr/bin/env python2
# -*- coding: utf-8 -*-
"""
Created on Fri Sep 8 10:51:21 2017
@author: jlashner
"""
from pylab import *
import tmm
import numpy as np
import matplotlib.pyplot as plt
import scipy.integrate as intg
"""
Constants and System Parameters
"""
#speed of light [m/s]
c =2.99792458 * 10**8
GHz = 10 ... |
"""
Unit tests for mpath dmp
"""
from __future__ import print_function
import errno
import os
import unittest
import mock
import testlib
import util
import mpath_dmp
import SR
from SR import SROSError
from Queue import Queue
import xs_errors
# pylint: disable=W0613; mocks don't need to be accessed
# pylint: disabl... |
#!/usr/bin/python3
# -*- coding: utf-8 -*-
import alu
import flags
import op1processor
import op2processor
import opcodeGetter
import registers
import memory_unit
import result_selector
import constants
from netlist import *
ENABLE_DEBUG = False
def show(pin, name):
if ENABLE_DEBUG:
push_context(name)
o = fresh... |
# -*- coding: utf-8 -*-
import random
from raspysystem.raspycollection import RasPyCollection
from raspysystem.raspysamplelogger import RasPySampleLogger
from raspysystem.raspyenergymeter import RasPyEnergyMeter
from raspysystem.raspytask import RasPySimpleTask
from rcswitch import SwitchTypeB
class Socket(object):
... |
import uuid
import pytest
from pgshovel.interfaces.common_pb2 import Timestamp
from pgshovel.interfaces.streams_pb2 import (
Header,
Message,
)
from pgshovel.streams.sequences import (
InvalidPublisher,
InvalidSequenceStartError,
RepeatedSequenceError,
SequencingError,
validate,
)
timest... |
from scdown.neo import (Neo,
NODE_USER,
NODE_TRACK,
NODE_COMMENT,
NODE_PROFILE,
REL_FOLLOWS,
REL_UPLOADED,
REL_FAVORITED,
REL_HA... |
import os
import argparse as ap
import maker
import warnings
import datetime as dt
import subprocess as sp
#Consts
FADEIN_STRINGS = ["in", "In", "fadein", "Fadein", "fi"]
FADEOUT_STRINGS = ["out", "Out", "fadeout", "Fadeout", "fo"]
class Ven():
def __init__(self):
"""Create new AlphaVEN instance."""
... |
#!/usr/bin/python -tt
# Copyright 2010 Google Inc.
# Licensed under the Apache License, Version 2.0
# http://www.apache.org/licenses/LICENSE-2.0
# Google's Python Class
# http://code.google.com/edu/languages/google-python-class/
# Basic list exercises
# Fill in the code for the functions below. main() is already set ... |
from django.template import Library, Node, Variable
from django.template.base import TemplateSyntaxError, VariableDoesNotExist
from dynamic_validation import models
register = Library()
__all__ = ('violations_for', )
@register.tag
def violations_for(parser, token):
"""
usage:
{% violations_for trigge... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"This is Plugin Manager"
# wxRays (C) 2013 Serhii Lysovenko
#
# 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 (a... |
__author__ = 'victor'
from pybrain.datasets import SupervisedDataSet
from pybrain.supervised.trainers import RPropMinusTrainer
from pybrain import FeedForwardNetwork, FullConnection, IdentityConnection, TanhLayer
from datasource import *
# dataset
timeWidth = 5140 # num of samples to input to the net
mixer = Mix... |
from vsg import parser
class with_keyword(parser.keyword):
'''
unique_id = selected_force_assignment : with_keyword
'''
def __init__(self, sString):
parser.keyword.__init__(self, sString)
class select_keyword(parser.keyword):
'''
unique_id = selected_force_assignment : select_keywo... |
__author__ = 'Erilyth'
import pygame
import os
from person import Person
'''
This class defines all the Monsters present in our game.
Each Monster can only move on the top floor and cannot move vertically.
'''
class MonsterPerson(Person):
def __init__(self, raw_image, position, rng, dir, width=15, height=15):
... |
import os.path
import egnyte
import re
import time
import hashlib
import pickle
import io
from .logger import flogger
from .bytesize import bytes_scaled
from .codex import phash
elog = flogger(label='EGNYTE')
## init
_updates = False
config = egnyte.configuration.load()
if "api_key" not in config:
config["api_k... |
# This file is part of Beneath a Binary Sky.
# Copyright (C) 2016, Aidin Gharibnavaz <aidin@aidinhut.com>
#
# Beneath a Binary Sky 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
# Lice... |
#
# (c) 2017 Red Hat Inc.
#
# 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 option) any later version.
#
# Ansible is d... |
# -*- coding: utf-8 -*-
# Define your item pipelines here
#
# Don't forget to add your pipeline to the ITEM_PIPELINES setting
# See: http://doc.scrapy.org/en/latest/topics/item-pipeline.html
import os
import sys
import codecs
from slugify import slugify
from time import strptime, strftime
from html2text import html2... |
#!/usr/bin/env python
from __future__ import print_function
from sys import stdin
from signal import signal, SIGPIPE, SIG_DFL
def main():
signal(SIGPIPE, SIG_DFL)
char_stats = [float('Inf'), -float('Inf'), 0, 0] # Min, Max, Avg, N
word_stats = [float('Inf'), -float('Inf'), 0, 0] # Min, Max, Avg, N
... |
# ---------------------------------------------------------------------
#
# Copyright (c) 2012 University of Oxford
#
# 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, incl... |
import json
from tastypie.utils.timezone import now
from django.db import models
from django.core.urlresolvers import reverse
from decommentariis.xml_file import TEIDataSource
from decommentariis.signals import *
class TEIEntry(models.Model):
cts_urn = models.CharField(max_length=200, primary_key=True)
creation_dat... |
#Moonlight Madness Mode
import procgame
import locale
import random
import logging
import audits
from procgame import *
from drops import *
from tornado import *
from cellar import *
base_path = config.value_for_key_path('base_path')
game_path = base_path+"games/whirlwind/"
speech_path = game_path +"speech/"
sound_pa... |
import os
import sys
tools = ['qt5','spatialdb','doxygen','prefixoptions']
env = Environment(tools = ['default'] + tools)
# qt modules
qtModules = Split('QtCore QtGui QtSvg')
env.EnableQtModules(qtModules)
def win_qt_setup(env):
# Windows needs an extra include path for Qt modules.
qt5include = env['QT5DIR']... |
from polyphony import module
from polyphony import testbench
from polyphony import is_worker_running
from polyphony.io import Port
from polyphony.typing import int8
from polyphony.timing import clksleep, wait_value
@module
class Submodule:
def __init__(self, param):
self.i = Port(int8, 'in')
self.... |
"""
Tests for paver quality tasks
"""
import os
import shutil
import tempfile
import textwrap
import unittest
import pytest
from ddt import data, ddt, file_data, unpack
from mock import MagicMock, mock_open, patch
from path import Path as path
from paver.easy import BuildFailure
import pavelib.quality
from pavelib.... |
#!/usr/bin/env python
"""
Copyright (c) 2015 @xiaoL (http://xlixli.net/)
"""
import os
import string
from lib.core.enums import PRIORITY
from lib.core.common import singleTimeWarnMessage
__priority__ = PRIORITY.LOWEST
def dependencies():
singleTimeWarnMessage("tamper script '%s' is only meant to be run agains... |
# The version of Review Board.
#
# This is in the format of:
#
# (Major, Minor, Micro, Patch, alpha/beta/rc/final, Release Number, Released)
#
VERSION = (1, 6, 0, 0, 'final', 0, True)
def get_version_string():
version = '%s.%s' % (VERSION[0], VERSION[1])
if VERSION[2]:
version += ".%s" % VERSION[2]... |
import numpy as np
import sys
from os.path import expanduser
HOME = expanduser("~")
if "storage" in HOME:
HOME = "/storage/home/geffroy"
sys.path.append(HOME + "/Code/PG/Source")
from phase_fluctuations import SWaveModel
from MCMC import MCMCDriver
# pylint: disable=E1101
T_CST = 0.25
TARGET_SNAPSHOTS = 6
MC_INTE... |
#!/usr/bin/python
import sys,time
try:
import paho.mqtt.client as mqtt
except ImportError:
# This part is only required to run the example from within the examples
# directory when the module itself is not installed.
#
# If you have the module installed, just use "import paho.mqtt.client"
impor... |
"""
Income mobility measures.
"""
__author__ = "Wei Kang <weikang9009@gmail.com>, Sergio J. Rey <sjsrey@gmail.com>"
__all__ = ["markov_mobility"]
import numpy as np
import numpy.linalg as la
def markov_mobility(p, measure="P",ini=None):
"""
Markov-based mobility index.
Parameters
----------
p ... |
from __future__ import print_function
def test_lores2d(phi):
from sasModeling.pointsmodelpy import pointsmodelpy
from sasModeling.iqPy import iqPy
from sasModeling.geoshapespy import geoshapespy
#lores model is to hold several geometric objects
lm = pointsmodelpy.new_loresmodel(0.1)
#generate single ge... |
"""
Instructions of the 65816 Processor.
"""
from .addressing import get_addressing_mode
@staticmethod
def _execute_c2(state, context):
"""REP: Reset status bits.
When used, it will set the bits specified by the 1 byte immediate
value. This is the only means of setting the M and X status
register bit... |
# coding: utf-8
"""
Kubernetes
No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
OpenAPI spec version: v1.6.1
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
from pprint import pformat
from six import iteritems
import re
... |
'''
performance.py
author: Luke de Oliveira (lukedeo@stanford.edu)
Usage:
>>> weights = np.ones(n_samples)
>>> # -- going to match bkg to signal
>>> weights[signal == True] = get_weights(sig_pt, bkg_pt)
>>> discs = {}
>>> add_curve(r'\tau_{32}', 'red', calculate_roc(signal, tau_32, weights=weights))
>>> fg = ROC_plo... |
# coding=utf-8
# Copyright 2020 The TF-Agents 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable la... |
import json
import logging
import requests_mock
from django.conf import settings
from django.test import TestCase, override_settings
from eventkit_cloud.utils.geocoding.coordinate_converter import CoordinateConverter
logger = logging.getLogger(__name__)
mockURL = "http://test.test"
@override_settings(GEOCODING_AUTH... |
#!/usr/bin/env python
"""
A simple utility to redo the failed/errored tests.
You need to specify the session directory in order for this script to locate the
tests which need to be re-run.
See also dotest.py, the test driver running the test suite.
Type:
./dotest.py -h
for help.
"""
import os, sys, datetime
impo... |
import requests
import re
import os
import sys
from BeautifulSoup import BeautifulSoup
base_url = 'https://robot.your-server.de'
zonefiledir = 'zonefiles'
def log(msg, level = ''):
print '[%s] %s' % (level, msg)
def login(username, password):
login_form_url = base_url + '/login'
login_url =... |
import os
from distutils import version
import numpy as np
import warnings
from exceptions import TableException
import atpy
from helpers import smart_dtype
from decorators import auto_download_to_file, auto_decompress_to_fileobj, auto_fileobj_to_file
vo_minimum_version = version.LooseVersion('0.3')
try:
from ... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# eurobot documentation build configuration file, created by
# sphinx-quickstart on Thu Dec 4 20:22:09 2014.
#
# 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
# au... |
from common.math.modexp import ModularExp
from common.tools.converters import BytesToInt, IntToBytes
class RSAOracleAttack(object):
def __init__(self, oracle):
self.oracle = oracle
self.e, self.n = oracle.get_public_key()
def _encrypt(self, m):
return ModularExp(self.n).v... |
# -*- coding:utf8 -*-
import unittest
from .amortizations import pendingAmortizations
class Amortization_Test(unittest.TestCase):
def setUp(self):
self.maxDiff = None
def test_pendingAmortizations_unpaid(self):
self.assertEqual(
pendingAmortizations(
purchase_da... |
#!/usr/bin/python
# Copyright (c) 2009, Purdue University
# 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 ... |
import sys
def main():
if len(sys.argv)<2:
print "usage :",sys.argv[0],"Eval file, Results Output Directory"
sys.exit(-1)
filename = sys.argv[1]
outputdir = sys.argv[2]
evalfile = open(filename,'r')
line = evalfile.readline() #X Residue line
line = evalfile.readline() ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.