content string |
|---|
class LinkedListString(object):
"""Linked List of Strings
Each element in the list contains a list (in C would be plain array),
the total string is made by concatenating as you follow the list.
This is the first example of one that aims for immutability.
This one will start out performing well bu... |
# encoding: utf-8
"""
:class:`.Point` data structure.
"""
import collections
import re
import warnings
from itertools import islice
from math import fmod
from geopy import units, util
from geopy.compat import isfinite, string_compare
from geopy.format import DEGREE, DOUBLE_PRIME, PRIME, format_degrees, format_distanc... |
import datetime
import pecan
from pecan import rest
import six
import wsme
from wsme import types as wtypes
import wsmeext.pecan as wsme_pecan
from ironic.api.controllers import base
from ironic.api.controllers import link
from ironic.api.controllers.v1 import collection
from ironic.api.controllers.v1 import types
fr... |
# encoding: utf-8
# pylint: disable=invalid-name,unused-argument,too-many-arguments
"""
Application database related tasks for Invoke.
Forked from flask-migrate
"""
import argparse
import logging
import os
from ._utils import app_context_task
log = logging.getLogger(__name__) # pylint: disable=invalid-name
try:
... |
try:
import re2 as re
except:
import re
from lib.cuckoo.common.abstracts import Signature
class Generic_Phish(Signature):
name = "generic_phish"
description = "Network activity contains generic phishing indicators indicative of a website clone."
severity = 2
weight = 2
categories = ["netwo... |
import sys
import os
import atexit
import readline, rlcompleter
from tempfile import mkstemp
from code import InteractiveConsole
### enable history ###
HISTFILE = "%s/.pyhistory" % os.environ["HOME"]
if os.path.exists(HISTFILE):
readline.read_history_file(HISTFILE)
readline.set_history_length(300)
def savehist():
... |
"""Wrapper class for WPWithin Service."""
import os
import time
import sys
import threading
from pkg_resources import resource_filename
import thriftpy
from thriftpy.rpc import make_client
from thriftpy.protocol.binary import TBinaryProtocolFactory
from thriftpy.transport.buffered import TBufferedTransportFactory
fro... |
from scripts.cloud.utility import quarter_dates, LDAP
from scripts.custom.hpc_edward import EdwardDB
line = '=================================================================='
unknown_emails = set()
external_users = set()
def get_from_department(department):
if not department:
return 'Unknown'
map =... |
"""A simple wrapper around the OAuth2 credentials library."""
import base64
import datetime
import six
from six.moves.urllib.parse import urlencode
from oauth2client import client
from gcloud._helpers import UTC
from gcloud._helpers import _NOW
from gcloud._helpers import _microseconds_from_datetime
def get_creden... |
'''
This file is the conductor of everything Hasher.
'''
import argparse
import glob
import imp
import sys
from hashes.common import helpers
import hashes.ops.bcrypt
import hashes.ops.cisco_pix
import hashes.ops.cisco_type7
import hashes.ops.ldap_md5
import hashes.ops.ldap_salted_md5
import hashes.ops.ldap_salted_sha1... |
# -*- coding: utf-8 -*-
"""Timezone information files (TZif)."""
from dtfabric.runtime import data_maps as dtfabric_data_maps
from dtformats import data_format
from dtformats import errors
class TimeZoneInformationFile(data_format.BinaryDataFile):
"""Timezone information file (TZif).
Attributes:
format_ver... |
import csv, json, os, requests
from bson.json_util import dumps
from flask import Blueprint, Response, render_template, flash, request, redirect, url_for, session,jsonify
from flask.ext.login import login_user, logout_user, login_required, current_user
from flask_wtf import Form
from wtforms import TextField, Password... |
# -*- coding: UTF-8 -*-
import sys
sys.path.append("../entity")
from entity import flying_object
import time
class DemoStage():
__PLAYER_LIMIT = 2
__PLAYER_MOVE = 10000
def __init__(self):
self.l = 2
self.ps = {}
self.es = {}
self.d = {}
for i in range(3):
... |
# coding: utf-8
# pylint: skip-file
import os
import subprocess
import tempfile
import unittest
import lightgbm as lgb
import numpy as np
from sklearn.datasets import load_breast_cancer, dump_svmlight_file
from sklearn.model_selection import train_test_split
class TestBasic(unittest.TestCase):
def test(self):
... |
from datetime import datetime
from optparse import make_option
from django.conf import settings
from django.contrib.auth.models import User
from django.core.management.base import BaseCommand, CommandError
from django.core.mail import send_mail
from django.db.models import Max
from moocng.courses.models import Cours... |
# coding: utf-8
from __future__ import absolute_import
from _ruamel_yaml import CParser, CEmitter
try:
from .constructor import * # NOQA
from .serializer import * # NOQA
from .representer import * # NOQA
from .r... |
from . import change_main_phone
from . import change_phone_type |
from time import sleep
import RPi.GPIO as GPIO
GPIO.setmode(GPIO.BCM)
# Verwendete Pins am Rapberry Pi
A=22
B=23
C=24
D=25
time = 0.005
# Pins aus Ausgänge definieren
GPIO.setup(A,GPIO.OUT)
GPIO.setup(B,GPIO.OUT)
GPIO.setup(C,GPIO.OUT)
GPIO.setup(D,GPIO.OUT)
GPIO.output(A, False)
GPIO.output(B, False)
GPIO.output(C,... |
#!/usr/bin/python
# self - represents your object/instance
# __init__ -> special class -> constructor
# class Account(object):
class Account:
def __init__(self): # constructor/Get initiated automatically
self.balance = 0 # instance variable
def deposit(self,amount):
self.amount = amount
self.balance = ... |
import os
import sys
import essentia
import yaml
import numpy
from essentia.extractor.extractor import compute
def clean_key(descriptors):
key_mapping = {}
key_mapping['A'] = 0
key_mapping['A#'] = 1
key_mapping['B'] = 2
key_mapping['C'] = 3
key_mapping['C#'] = 4
key_mapping['D... |
#!/usr/bin/python
# TODO
# * add a 'commit' like thing when an object is fully read. Otherwise it can be partially created. It sucks...
# * add support for comment inside an object definition
# * for the time being, all the "set variable" have to be done at the end, otherwise they are not propagated
# * add the suppor... |
# Make coding more python3-ish
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
import textwrap
from ansible.utils.unicode import to_unicode
def display_output(result, action, display, first, task_failed=False):
msg = ''
result = result._result
wrap_width = 77
f... |
"""Port scan utilities."""
import asyncio
import os
from pwd import getpwall
import re
import sys
import socket
from cylc.cfgspec.glbl_cfg import glbl_cfg
import cylc.flags
from cylc.hostuserutil import is_remote_host, get_host_ip_by_name
from cylc.network.client import (
SuiteRuntimeClient, ClientError, ClientTi... |
certificate = """-----BEGIN CERTIFICATE-----\r\n
MIIFbTCCBFWgAwIBAgICH4cwDQYJKoZIhvcNAQEFBQAwcDELMAkGA1UEBhMCVUsx\r\n
ETAPBgNVBAoTCGVTY2llbmNlMRIwEAYDVQQLEwlBdXRob3JpdHkxCzAJBgNVBAMT\r\n
AkNBMS0wKwYJKoZIhvcNAQkBFh5jYS1vcGVyYXRvckBncmlkLXN1cHBvcnQuYWMu\r\n
dWswHhcNMDYwNzI3MTQxMzI4WhcNMDcwNzI3MTQxMzI4WjBb... |
#!/usr/bin/env python
import sys
from SimpleXMLRPCServer import SimpleXMLRPCServer
from SimpleXMLRPCServer import SimpleXMLRPCRequestHandler
from oslo.config import cfg
from virtman.utils.singleton import singleton
from virtman.compute_new import Virtman
from virtman import imageservice
from virtman.opensta... |
from logdissect.parsers.type import ParseModule as OurModule
class ParseModule(OurModule):
def __init__(self):
"""Initialize the cisco ios parsing module"""
self.name = 'ciscoios'
self.desc = 'cisco ios parsing module'
self.format_regex = \
"^([A-Z][a-z]{2}\s+\d{1,2}... |
from spack import *
class RSp(RPackage):
"""Classes and methods for spatial data; the classes document where the
spatial location information resides, for 2D or 3D data. Utility functions
are provided, e.g. for plotting data as maps, spatial selection, as well as
methods for retrieving coordinates, fo... |
"""PhotoBackup
Usage:
photobackup.py upload <url> <image>
photobackup.py test <url>
photobackup.py (-h | --help)
photobackup.py --version
Options:
-h --help Show this screen.
--version Show version.
"""
# stdlib
import getpass
import hashlib
import os
import sys
import urllib.parse
# pipped
from ... |
import numpy as n
from numpy import *
import numpy
from numpy import matrix
import scipy
from scipy.linalg import inv, det, eig
import scipy.linalg as la
'''
This file containts different hamiltonians and matrices.
'''
def hamilB(B0):
'''
Calculate hamiltonians for all 4 orientations for specific B field of th... |
""" Blob codes for storing binary data semi-efficiently.
This module offers means to store and encode binary blobs in C++ semi
efficiently. The "StreamData" class is used in two places, for constants
and for freezing of bytecode.
"""
class StreamData:
def __init__(self):
self.stream_data = bytes()
de... |
import unittest
from farg.apps.seqsee.anchored import SAnchored, NonAdjacentGroupElementsException
from farg.apps.seqsee.sobject import SObject
from farg.core.exceptions import FargError
class TestSObject(unittest.TestCase):
def test_object_creation(self):
o1 = SObject.Create([3])
self.assertTrue(isinstance(... |
# coding: utf-8
"""Tests for "entry point" functions in django_recommend."""
# pylint: disable=redefined-outer-name
from __future__ import (absolute_import, division, print_function,
unicode_literals)
import mock
import pytest
import testfixtures
from django.contrib.auth.models import User
from... |
from south.db import db
from django.db import models
from adm.confirmation.models import *
class Migration:
def forwards(self, orm):
# Adding model 'AdmissionMajorPreference'
db.create_table('confirmation_admissionmajorpreference', (
('id', orm['confirmation.AdmissionMajor... |
import copy
import six
from chainer.backends import cuda
from chainer.dataset import convert
from chainer import function
from chainer.training.updaters import standard_updater
class ParallelUpdater(standard_updater.StandardUpdater):
"""Implementation of a parallel GPU Updater.
This is an implementation o... |
import time
from django import VERSION
from django.contrib.staticfiles.testing import StaticLiveServerTestCase
from selenium import webdriver
from selenium.webdriver.support.wait import WebDriverWait
from selenium.webdriver.firefox.options import Options
from tests import factories as f
try:
from django.urls imp... |
import os
from autotest.client.shared import git, error
from autotest.client import utils
from virttest import utils_misc
@error.context_aware
def run_qemu_iotests(test, params, env):
"""
Fetch from git and run qemu-iotests using the qemu binaries under test.
1) Fetch qemu-io from git
3) Run test for... |
from .server_properties_for_create import ServerPropertiesForCreate
class ServerPropertiesForDefaultCreate(ServerPropertiesForCreate):
"""The properties used to create a new server.
:param storage_mb: The maximum storage allowed for a server.
:type storage_mb: long
:param version: Server version. Pos... |
from typing import TYPE_CHECKING
import warnings
from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error
from azure.core.paging import ItemPaged
from azure.core.pipeline import PipelineResponse
from azure.core.pipeline.transport import HttpR... |
#! -*- coding: utf-8 -*-
from .base import FunctionalTestCase
from .pages import game
class OperateTests(FunctionalTestCase):
def test_company_can_operate_and_pays_dividends(self):
self.story('Start a game with two players and two companies')
game_uuid = self.create_game()
player1_uuid = se... |
# -*- coding: utf-8 -*-
from south.utils import datetime_utils as datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding field 'Video.comments_count'
db.add_column(u'video_video', u'com... |
from setuptools import setup, find_packages
from codecs import open
from os import path
here = path.abspath(path.dirname(__file__))
# get the version
exec(open('simupy/version.py').read())
# Get the long description from the README file
with open(path.join(here, 'README.rst'), encoding='utf-8') as f:
long_descri... |
import argparse
from datetime import datetime
try:
import ujson as json
except ImportError:
import json
import gzip
import json_lines
from .items import CDRItem
from .utils import format_timestamp, format_id
def main():
parser = argparse.ArgumentParser()
arg = parser.add_argument
arg('input', he... |
from tkinter import *
from tkinter import ttk
from nerdlib.askinfo import *
import shelve
import os
from nerdlib.config import initialize
class SelectServer(Toplevel):
def __init__(self, root):
Toplevel.__init__(self, root)
self.root = root
self.resizable(width=False, height=False)
... |
from PyQt5.QtCore import pyqtProperty, QRectF
from PyQt5.QtGui import QColor, QPainter, QPen
from PyQt5.QtQuick import QQuickPaintedItem
class PieSlice(QQuickPaintedItem):
@pyqtProperty(QColor)
def color(self):
return self._color
@color.setter
def color(self, color):
self._color = QC... |
from django.urls import re_path
from . import views
app_name = 'rh'
urlpatterns = [
re_path(r'^$', views.index, name='index'),
re_path(r'^principal$', views.principal, name='principal'),
re_path(r'^campanhas/(?P<id>.+)?/?$',
views.campanhas, name='campanhas'),
re_path(r'^eventos/(?P<id>.+)... |
from os import path
from dbmanagr.sources.source import Source
from dbmanagr.driver.sqlite.databaseconnection import SQLiteConnection
DIR = path.dirname(__file__)
URI = 'sqlite+pysqlite:///{file}'
class MockSource(Source):
def list(self):
if not self._connections:
self._connections.append(
... |
"""Test cases which cover backlog workflow functionality"""
import mock
from sqlalchemy import and_
from ggrc import db
from ggrc.models import Person
from ggrc_basic_permissions import load_permissions_for
from ggrc_basic_permissions.models import Role
from ggrc_basic_permissions.models import UserRole
from ggrc_wor... |
import os
import shutil
import sys
from cx_Freeze import setup, Executable
ScriptDir = os.path.dirname(os.path.realpath(__file__))
BuildDir = os.path.join(ScriptDir, 'build')
BuildPlatformDir = os.path.join(BuildDir, 'exe.win32-3.6')
OutDir = os.path.join(ScriptDir, '../Bin/Data')
print("Removing previous build direc... |
'''
New Integration Test for VM shutdown with ha mode OnHostFailure
@author: quarkonics
'''
import zstackwoodpecker.test_util as test_util
import zstackwoodpecker.test_lib as test_lib
import test_stub
import zstackwoodpecker.header.vm as vm_header
import zstackwoodpecker.operations.ha_operations as ha_ops... |
import logging
import os
from django.conf import settings
from django.contrib.staticfiles.storage import ManifestFilesMixin
from django.core.files.storage import FileSystemStorage
from pipeline.storage import PipelineMixin
from storages.backends.s3boto3 import S3Boto3Storage
log = logging.getLogger('apps')
class Ov... |
#!/usr/bin/env python
from __future__ import print_function
import os
import sys
import subprocess
import boto3
if sys.version_info[0] == 2:
from StringIO import StringIO
else:
from io import StringIO
build_dir = os.environ.get('BUILD_DIR', 'build')
BUCKET = 'cloudify-release-eu'
THIS_DIR = os.path.dirname(... |
"""x86 batch_matmul operators"""
from __future__ import absolute_import as _abs
import tvm
from tvm.contrib import cblas
from topi.nn import batch_matmul, batch_matmul_default
from .. import generic
from ..util import traverse_inline, get_const_tuple, get_max_power2_factor
@batch_matmul.register(["cpu"])
def batch_mat... |
""" This module defines a decision tree regression predictor. """
from sklearn.tree import DecisionTreeRegressor
import pandas as pd
class DecisionTreePredictor(object):
""" It's a wrapper around the scikit-learn class that keeps
the dates and ticker info."""
def __init__(self):
self.model = Deci... |
import sys
import numpy as np
import loading
PATH_FLAT = '/Users/mj/Documents/NEST/'
sys.path.append(PATH_FLAT+'/GIFFittingToolbox/src')
sys.path.append(PATH_FLAT+'/GIFFittingToolbox/src/HBP')
from Experiment import *
from GIF import *
from AEC_Badel import *
from AEC_Dummy import *
from Filter_Rect_LinSpaced impo... |
from libreoffice.uno.propertyvalue import mkPropertyValues
from uitest.framework import UITestCase
import time
try:
import pyuno
import uno
import unohelper
except ImportError:
print("pyuno not found: try to set PYTHONPATH and URE_BOOTSTRAP variables")
print("PYTHONPATH=/installation/opt/program"... |
#!/usr/bin/env python
"""
_environment_
Utils to get the cirrus environment settings
"""
import os
import sys
import cirrus
import inspect
import posixpath
import subprocess
from cirrus._2to3 import to_str
#
# number of subdirectories from cirrus/__init__.py
# when installed in a venv under CIRRUS_HOME location
N... |
from oslo_serialization import jsonutils as json
from tempest.lib.api_schema.response.compute.v2_1 import aggregates as schema
from tempest.lib.common import rest_client
from tempest.lib import exceptions as lib_exc
from tempest.lib.services.compute import base_compute_client
class AggregatesClient(base_compute_clie... |
import sys
from gccutils import get_src_for_loc, get_global_typedef
from libcpychecker.types import *
from libcpychecker.utils import log
const_correctness = True
def get_char_ptr():
return gcc.Type.char().pointer
def get_const_char_ptr():
return gcc.Type.char().const_equivalent.pointer
def get_const_char... |
from urllib import urlopen,quote_plus
from simplejson import loads
class connection:
def __init__(self,url):
self.baseurl=url
self.sparql_prefix=""
def addnamespace(self,id,ns):
self.sparql_prefix+='PREFIX %s:<%s>\n' % (id,ns)
def __getsparql__(self,method):
#prin... |
''' Provider that returns PostGIS vector tiles in GeoJSON or MVT format.
VecTiles is intended for rendering, and returns tiles with contents simplified,
precision reduced and often clipped. The MVT format in particular is designed
for use in Mapnik with the VecTiles Datasource, which can read binary MVT tiles.
For a ... |
{
'name': 'Product Variant Multi Advanced',
'version': '0.1',
'category': 'Sales Management',
'license': 'AGPL-3',
'complexity': 'expert',
'description': ("This module extend the capacity of product_variant_multi "
"giving the posibility of building automatically the "
... |
import json
import os
from urllib.parse import urlparse
import sys
sys.path.append('/usr/lib/wasp/')
from Utilities import Utilities
from Colors import Colors
class Details:
def __init__(self, details: dict, args):
self.details = details
self.args = args
def generate(self):
if self.... |
import warnings
from typing import Callable, Dict, Optional, Sequence, Tuple
from google.api_core import grpc_helpers # type: ignore
from google.api_core import gapic_v1 # type: ignore
import google.auth # type: ignore
from google.auth import credentials as ga_credentials # type: ignor... |
"""
Custom table type
"""
from qgis.PyQt.QtCore import (
QCoreApplication
)
from qgis.core import (
QgsLayoutItemRegistry,
QgsLayoutItemAttributeTable,
QgsLayoutMultiFrameAbstractMetadata
)
from stdm.ui.gui_utils import GuiUtils
STDM_DATA_TABLE_ITEM_TYPE = QgsLayoutItemRegistry.PluginItem + 2337 + 2
... |
import unittest
import os
import json
import glob
try:
import msgpack
except ImportError:
msgpack = None
from monty.serialization import dumpfn, loadfn
from monty.tempfile import ScratchDir
class SerialTest(unittest.TestCase):
@classmethod
def tearDownClass(cls):
# Cleans up test files if a ... |
import datetime
import posixpath
from django import forms
from django.core import checks
from django.core.files.base import File
from django.core.files.images import ImageFile
from django.core.files.storage import default_storage
from django.db.models import signals
from django.db.models.fields import Field
from djang... |
# -*- coding: utf-8 -*-
'''
Usage:
setuserpass.py [-d] username password
Set a user's username/password, creating it
if it did not already exist.
Specifying -d on the commandline removes the user and in that
case a password is not necessary
'''
import sys
from hashlib import sha1
from werkzeug.security import ge... |
from kafkatest.services.performance.jmx_mixin import JmxMixin
from kafkatest.services.performance import PerformanceService
import itertools
from kafkatest.utils.security_config import SecurityConfig
class ProducerPerformanceService(JmxMixin, PerformanceService):
logs = {
"producer_performance_log": {
... |
# -*- encoding: utf-8 -*-
"""
Usage:
hammer compute-profile [OPTIONS] SUBCOMMAND [ARG] ...
Parameters:
SUBCOMMAND Subcommand
[ARG] ... Subcommand arguments
Subcommands:
create Create a compute profile
delete Delete a compute ... |
import ast
import os
import re
from setuptools import find_packages, setup
LONG_DESCRIPTION = ''
try:
with open('./README.md', 'r') as f:
LONG_DESCRIPTION = f.read()
except FileNotFoundError:
pass
setup(
name='raspapreco',
description='Pesquisador de preços',
long_description=LONG_DESCRIP... |
from marshmallow import pre_dump, fields, Schema
from app.exceptions.base import ValidationException, ApplicationException
class InvalidMinuteException(ValidationException):
class ErrorSchema(ApplicationException.ErrorSchema):
class _InvalidLineSchema(Schema):
line = fields.Integer()
... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# GPL v.3 see master file
import serial
from plot import *
DEBUG = False
class Controller( Plot ) :
"""Create a plot for displaying the pressure measurments.
It provide a method to read the pressure from the serial port
on a MVC-3 pressure controlle... |
import unittest
from canal import (
Tag,
FloatField,
IntegerField,
BooleanField,
StringField
)
class FormatterTestCase(unittest.TestCase):
def test_format_float(self):
self.assertEqual(
FloatField().format(1.2),
'1.2'
)
def test_format_int(self):
... |
"""
This file was automatically generated.
"""
class forcedUser(object):
def __init__(self, zap):
self.zap = zap
@property
def is_forced_user_mode_enabled(self):
"""
Returns 'true' if 'forced user' mode is enabled, 'false' otherwise
"""
return next(self.zap._reques... |
bl_info = {
'name': 'Like A Painter',
'author': 'Florian Dufour & Laurine Dufour',
'version': (0, 0, 1),
'blender': (2, 77, 0),
'location': 'Node Editor > Add > Filter > LAPainter',
'description': 'Node filter to transform an image input to an painting image',
'warning': 'Alpha version',
... |
from node import bin, hex, nullid, nullrev
import encoding
import util, repoview
def _filename(repo):
"""name of a branchcache file for a given repo or repoview"""
filename = "cache/branchheads"
if repo.filtername:
filename = '%s-%s' % (filename, repo.filtername)
return filename
def read(repo)... |
import os
import sys
import time
from owanimo.app.error import ERROR as e
from owanimo.script import allegory_normal
from owanimo.util import define
from owanimo.util.log import LOG as L
class Allegory(allegory_normal.Allegory):
def __init__(self, runner, profile, player):
allegory_normal.Allegory.__init_... |
"""
Contain pivoting routines commonly used in the Simplex Algorithm and
Lemke-Howson Algorithm routines.
"""
import numpy as np
from numba import jit
TOL_PIV = 1e-10
TOL_RATIO_DIFF = 1e-15
@jit(nopython=True, cache=True)
def _pivoting(tableau, pivot_col, pivot_row):
"""
Perform a pivoting step. Modify `ta... |
'''
--------------------------------------------------------------
Before running this Airflow module...
Install StarThinker in cloud composer ( recommended ):
From Release: pip install starthinker
From Open Source: pip install git+https://github.com/google/starthinker
Or push local code to the cloud co... |
import re
import unittest
from gooey.gui.processor import ProcessController
class TestProcessor(unittest.TestCase):
def test_extract_progress(self):
# should pull out a number based on the supplied
# regex and expression
processor = ProcessController("^progress: (\d+)%$", None... |
"""
PyBossa api module for exposing domain objects via an API.
This package adds GET, POST, PUT and DELETE methods for:
* projects,
* categories,
* tasks,
* task_runs,
* users,
* global_stats,
* vmcp
"""
import json
from flask import Blueprint, request, abort, Response, \
current_app,... |
# Django settings for veyepar project.
import os
DEBUG = True
TEMPLATE_DEBUG = DEBUG
TEMPLATE_STRING_IF_INVALID = ''
TEMPLATE_STRING_IF_INVALID = 'template_error'
BASE_DIR = os.path.dirname( os.path.dirname(
os.path.abspath(__file__)))
# this file is down a level, so the base is the parent dir.
# PROJECT_ROO... |
from openerp.osv import fields, osv, orm
from openerp.tools.translate import _
class sale_order(orm.Model):
_inherit = "sale.order"
def check_discount_limit(self, cr, uid, ids, context=None):
model_data_obj = self.pool.get('ir.model.data')
res_groups_obj = self.pool.get('res.groups')
... |
import numpy as np
import gym
from keras.models import Sequential, Model
from keras.layers import Dense, Activation, Flatten, Input, merge
from keras.optimizers import Adam
from rl.agents import DDPGAgent
from rl.memory import SequentialMemory
from rl.random import OrnsteinUhlenbeckProcess
ENV_NAME = 'Pendulum-v0'
... |
"""
Andrew Till
Fall 2012
Handy plotting functions for Python
"""
#stdlib
import math
#TPL: Numpy and Matplotlib
import numpy as np
import matplotlib as mpl
import matplotlib.pyplot as plt
#Return color option
def get_simple_colors(it_cur, it_tot=0):
if it_tot == 0:
it_tot = it_cur
col = ['b', 'r', ... |
RPL_WELCOME = "001"
RPL_YOURHOST = "002"
RPL_CREATED = "003"
RPL_MYINFO = "004"
RPL_LUSERCLIENT = "251"
RPL_LUSEROP = "252"
RPL_LUSERUNKNOWN = "253"
RPL_LUSERCHANNELS = "254"
RPL_LUSERME = "255"
RPL_AWAY = "301"
RPL_UNAWAY = "305"
RPL_NOWAWAY = "306"
RPL_WHOISUSER = "311"
RPL_WHOISSERVER = "312"
RPL_WHOISOPERATOR = "31... |
# -*- 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.level = lc.Level(self, mainloop, ... |
class PlotColors(object):
def __init__(self):
'''
Constructor
'''
self.colors = ["#1f77b4", "#ff7f0e", "#2ca02c", "#d62728", "#9467bd",
"#8c564b", "#e377c2", "#7f7f7f", "#bcbd22", "#17becf"]
self.extendedColors = [
"#1f77b4", "#aec7e8", "#f... |
#!/bin/python
#coding:utf-8
import roomai.games.common
from roomai.games.texasholdem.TexasHoldemUtil import AllPokerCardsDict
from roomai.games.texasholdem.TexasHoldemUtil import PokerCard
class TexasHoldemActionChance(roomai.games.common.AbstractActionChance):
'''
The TexasHoldemActionChance is the action use... |
"""
Identities module URLs
"""
from django.conf.urls.defaults import patterns, url
urlpatterns = patterns('maker.identities.views',
url(r'^(\.(?P<response_format>\w+))?$', 'index', name='identities'),
url(r'^index(\.(?P<response_format>\w+))?$', 'index', name='identities_index'),
u... |
from openerp.osv import fields, orm
from openerp.tools.translate import _
import re
class account_document_template(orm.Model):
_computed_lines = {}
_current_template_id = 0
_cr = None
_uid = None
_name = 'account.document.template'
_columns = {
'name': fields.char('Name', size=64, r... |
"""
Apple Push Notification Service
Documentation is available on the iOS Developer Library:
https://developer.apple.com/library/ios/documentation/NetworkingInternet/Conceptual/RemoteNotificationsPG/Chapters/ApplePushService.html
"""
import json
import ssl
import struct
import socket
import time
from contextlib import... |
#!/usr/bin/env python
##################################################
## DEPENDENCIES
import sys
import os
import os.path
try:
import builtins as builtin
except ImportError:
import __builtin__ as builtin
from os.path import getmtime, exists
import time
import types
from Cheetah.Version import MinCompatib... |
# -*- coding: utf-8 -*-
from django.contrib.auth.models import User
from django.db import models, IntegrityError
class Usuario(models.Model):
""" Clase que extiende funcionalidades de la clase User.
Este modelo pretende agregar funcionalidades al usuario que viene facilitado
por django. Este archivo sobreescrib... |
from __future__ import print_function
import traceback
import sys
import getopt
import re
from itertools import chain
from random import sample
from tlsfuzzer.runner import Runner
from tlsfuzzer.messages import Connect, ClientHelloGenerator, \
ClientKeyExchangeGenerator, ChangeCipherSpecGenerator, \
Fi... |
import unittest
import random
from readtime import ReadTimeParser
TEST_WPM = 123
class TestReadTime(unittest.TestCase):
def setUp(self):
self.READTIME_CONTENT_SUPPORT = ["Article", "Page", "Draft"]
self.READTIME_WPM = {
'default': {
'wpm': TEST_WPM,
... |
from azure_devtools.perfstress_tests import PerfStressTest, get_random_bytes
from azure.eventhub import EventHubClient, EventHubClientAsync, Offset, EventData
class _EventHubTest(PerfStressTest):
eventhub_client = None
async_eventhub_client = None
consumer_group = '$Default'
partition = '0'
offset... |
'''
Copyright 2015
This file is part of Orbach.
Orbach 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.
Orbach is distributed in the hope t... |
"""
Python Interchangeable Virtual Instrument Library
Copyright (c) 2012-2016 Alex Forencich
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... |
#Milton Orlando Sarria Paja
#USC 2017
#solucion parcial 3
import numpy as np
import math
def text2numbers(lines):
x=[]
numID=[]
for line in lines:
#leer el dato de cada linea e ignorar el cambio de linea
data = line[:-1]
#convertir (x[-1:],x[-2:-1]) a flotantes y apilar en la lista x
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.