src stringlengths 721 1.04M |
|---|
# coding: utf-8
from datetime import datetime, timedelta
from .base import TestCase
from .base import create_server, sqlalchemy_provider, cache_provider
from .base import db, Client, User, Grant
class TestDefaultProvider(TestCase):
def create_server(self):
create_server(self.app)
def prepare_data(se... |
# -*- coding: utf-8 -*-
#
# Copyright 2015-2020 BigML
#
# 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 ... |
"""Support for scanning a network with nmap."""
import logging
import re
import subprocess
from collections import namedtuple
from datetime import timedelta
import voluptuous as vol
import homeassistant.helpers.config_validation as cv
import homeassistant.util.dt as dt_util
from homeassistant.components.device_tracke... |
##############################################################################
#
# OSIS stands for Open Student Information System. It's an application
# designed to manage the core business of higher education institutions,
# such as universities, faculties, institutes and professional schools.
# The core ... |
#!/usr/bin/env python2
# Copyright (C) 2011-2012 by Imperial College London
# Copyright (C) 2013 University of Oxford
# Copyright (C) 2014 University of Edinburgh
#
# 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... |
# ----------------------------------------------------------------------
# Numenta Platform for Intelligent Computing (NuPIC)
# Copyright (C) 2013, Numenta, Inc. Unless you have an agreement
# with Numenta, Inc., for a separate license for this software code, the
# following terms and conditions apply:
#
# This progra... |
#!/usr/bin/env python
"""
@package eWRT.ws.geonames.gazetteer.exception
exceptions related to the gazetteer class
"""
from __future__ import print_function
# (C)opyrights 2009 by Heinz Lang <heinz.lang@wu.ac.at>
# Albert Weichselbraun <albert@weichselbraun.net>
#
# This program is free software... |
from __future__ import absolute_import
import responses
from exam import fixture
from sentry.models import Rule
from sentry.plugins.base import Notification
from sentry.testutils import PluginTestCase
from sentry.utils import json
from sentry_plugins.victorops.plugin import VictorOpsPlugin
SUCCESS = """{
"result"... |
from django.db.models import Count
from rest_framework.exceptions import ParseError
class BaseReport():
# Throws error if mandatory parameters are missing
def check_mandatory_params(self, mandatoryparams):
for params in mandatoryparams:
if not self.request.GET.get(params):
... |
"""Utility functions of the cli."""
import datetime
import json
import os
import re
import random
import string
import sys
import time
import click
import requests
import tabulate
from keep import about
# Directory for Keep files
dir_path = os.path.join(os.path.expanduser('~'), '.keep')
# URL for the API
api_url = 'h... |
# -*- 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):
# Changing field 'User.avatar'
db.alter_column(u'students_user', 'avatar... |
from django.contrib.auth import logout, get_user_model
from django.contrib.auth.models import AnonymousUser
from django.contrib.auth.tokens import default_token_generator
from django.core.exceptions import NON_FIELD_ERRORS
from django.utils.encoding import force_str
from django.utils.translation import gettext_lazy as ... |
import asyncio
import os
from os.path import join, dirname, abspath
import sys
import shutil
import json
from functools import partial
from hashlib import md5
from copy import copy
from collections import OrderedDict
from gi.repository import GLib, GObject
from pychess.compat import create_task
from pychess.System im... |
# Copyright (c) 2014, Salesforce.com, 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... |
# -*- coding: utf-8 -*-
"""
This is part of WebScout software
Docs EN: http://hack4sec.pro/wiki/index.php/WebScout_en
Docs RU: http://hack4sec.pro/wiki/index.php/WebScout
License: MIT
Copyright (c) Anton Kuzmin <http://anton-kuzmin.ru> (ru) <http://anton-kuzmin.pro> (en)
Unit tests for HostsBruterThread
"""
import s... |
# -*- coding: utf-8 -*-
""" Manifest View Mixin Tests
"""
from django.core import mail
from django.core.exceptions import ImproperlyConfigured
from django.urls import reverse
from manifest import messages
from manifest.views import EmailChangeView
from tests import data_dicts
from tests.base import ManifestTestCase
... |
import numpy as np
import matplotlib.pyplot as plt
import os
import sys
import json
import re
import shutil
from PIL import Image
from PIL import ImageFont, ImageDraw
import caffe
from caffe import layers as L
from caffe import params as P
from vqa_data_provider_layer import VQADataProvider
from vqa_data_provider_lay... |
# -*- coding: utf-8 -*-
import math
import unittest
from rainbowrunners.utils import Colors, get_terminal_size
__all__ = (
'NyanCatResult',
)
class BaseRainbowResult(unittest.TestResult):
"""A test result class that can print rainbow and awesome pet to a stream.
"""
separator1 = '\033[{0}m{1:*^70}... |
#!/usr/bin/python
from __future__ import unicode_literals, division, absolute_import
import os
import logging
from flexget import logger
from flexget.options import get_parser
from flexget import plugin
from flexget.manager import Manager
__version__ = '{git}'
log = logging.getLogger('main')
def main(args=None):
... |
# -*- encoding: utf-8 -*-
"""
staticdhcpdlib.web
==================
Defines web-registration methods and structures.
Legal
-----
This file is part of staticDHCPd.
staticDHCPd 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 ... |
import sys
import os
import signal
import argparse
import sqlite3
import random
import time
import re
from datetime import datetime
from math import floor
from lxml import html as etree
from multidict import MultiDict
import requests
import config
def get_tor_session():
session = requests.Session()
# Tor us... |
from glob import glob
import os
from functools import partial
import numpy as np
import h5py
from PIL import Image
from qtpy import QtWidgets, QtCore, QtGui
from pyqtgraph import makeQImage
from ...widgets.UtilityWidgets import open_file_dialog, open_files_dialog, save_file_dialog
# imports for type hinting in PyChar... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright (c) 2016
# Author(s):
# Thomas Leppelt <thomas.leppelt@dwd.de>
# This file is part of sauventory.
# Spatial Autocorrelated Uncertainty of Inventories
# sauventory is free software: you can redistribute it and/or modify
# it under the terms of the GNU Gener... |
# This program is free software; you can redistribute it and/or modify
# it under the terms of the (LGPL) GNU Lesser General Public License as
# published by the Free Software Foundation; either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will b... |
#
from nrutils.core.basics import smart_object, parent
from os.path import getctime
from numpy import array,cross,zeros,dot,abs,sign
from numpy.linalg import inv, norm
from numpy import sum as asum
# Determine whether the folder containing a metadta file is valid: can it be used to reference waveform data?
def valida... |
# coding: utf-8
"""
EVE Swagger Interface
An OpenAPI for EVE Online
OpenAPI spec version: 0.4.6
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
from pprint import pformat
from six import iteritems
import re
class DeleteFleetsFleetIdSquadsSquadIdForbidden(object):
"""... |
''' -- imports from python libraries -- '''
# import os -- Keep such imports here
import datetime
import csv
import time
import ast
import json
import math
import multiprocessing
''' -- imports from installed packages -- '''
from django.http import HttpResponseRedirect
from django.http import HttpResponse
from django... |
from blogdor import utils
from blogdor.models import Post
from django import template
from django.conf import settings
from django.db.models import Count
from django.template.loader import render_to_string
from django.contrib.contenttypes.models import ContentType
from tagging.models import Tag
register = template.Lib... |
#!/usr/bin/python
# -*- coding: UTF-8 -*-
import string
import time
def doitSimple(listWords, textProcessed):
result = 0
for w in textProcessed:
if (w[1]==listWords[0][1]):
if (w[0].lower()==listWords[0][0]):#There is two if because lower function is really expensive
result+... |
# BEGIN_COPYRIGHT
# END_COPYRIGHT
import os, unittest, logging
logging.basicConfig(level=logging.ERROR)
from bl.vl.kb import KnowledgeBase as KB
from kb_object_creator import KBObjectCreator
OME_HOST = os.getenv("OME_HOST", "localhost")
OME_USER = os.getenv("OME_USER", "root")
OME_PASS = os.getenv("OME_PASS", "rome... |
# -*- coding: utf-8 -*-
from django.db import models
from django.test import TestCase
# use immediate_update on tests
from django.conf import settings
settings.SEARCH_BACKEND = 'search.backends.immediate_update'
from search import register
from search.core import startswith
# ExtraData is used for ForeignKey tests... |
"""
Copyright (C) 2013 Stanislav Bobovych
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the h... |
from math import pi
import numpy as np
import pyaudio
import time
from ratchet.scales import *
from functools import lru_cache
memoize = lru_cache()
CHANNELS = 1
RATE = 44100
def make_ramp(time):
return np.linspace(0., time, time * RATE, dtype=np.float32)
def read_sample():
with open('data/test.dat', 'rb'... |
#!/usr/bin/env python3
# Copyright (c) 2014-2016 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 replace by fee code
#
from test_framework.test_framework import BitcoinTestFramework
from test_... |
from __future__ import absolute_import
import logging
from multiprocessing.util import Finalize
from anyjson import loads, dumps
from celery import current_app
from celery import schedules
from celery.beat import Scheduler, ScheduleEntry
from celery.utils.encoding import safe_str, safe_repr
from celery.utils.log imp... |
# -*- coding: UTF-8 -*-
#! python3
"""
Usage from the repo root folder:
.. code-block:: python
# for whole test
python -m unittest tests.test_search
# for specific
python -m unittest tests.test_search.TestSearch.test_search_search_as_application
"""
# #######################... |
import inspect
from class_pattern import ClassPattern
from primitive_musts import SafeObject
class Factory(object):
''' WRITEME '''
def __init__(self, obj_constructor, constructor_args, product_pattern, universe, known_parameters):
self._obj_constructor = obj_constructor
self._constructor_args... |
from unittest.mock import Mock
from tornado_sqlalchemy import MissingDatabaseSettingError, SessionMixin
from ._common import BaseTestCase, User, db
class SessionMixinTestCase(BaseTestCase):
def test_mixin_ok(self):
class GoodHandler(SessionMixin):
def __init__(h_self):
h_self... |
from django.views.decorators.csrf import csrf_exempt
from django.http import HttpResponseRedirect, HttpResponse
from django.shortcuts import get_object_or_404, render_to_response, render
from django.core.urlresolvers import reverse
from django.template import RequestContext
from django.contrib.auth.forms import UserCre... |
import turtle
def moveandgo(x, y, distance):
tina.penup()
tina.goto(x,y)
tina.pendown()
tina.setheading(0)
tina.forward(distance)
def moveandcircle(x, y, radius):
tina.fillcolor("#ffffff")
tina.penup()
tina.goto(x,y)
tina.pendown()
tina.begin_fill()
tina.setheading(90)
... |
import os
import json
import unittest
from app.presenters.service_presenters import (
Service, Attribute, Meta, lowercase_first_character_unless_part_of_acronym
)
from app import content_loader
def _get_fixture_data():
test_root = os.path.abspath(
os.path.join(os.path.dirname(__file__), "..")
)
... |
#! /usr/bin/python
#Distributed under the MIT licesnse.
#Copyright (c) 2014 Dave McCoy (dave.mccoy@cospandesign.com)
#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, includ... |
# Created by Storm Shadow www.techbliss.org
# Created by Storm Shadow www.techbliss.org
print "\n" #getting the box fit
print " ###################################################\n" \
" # Author Storm Shadow # \n" \
" # Hotkeys # \n" \
" ... |
import re
import bs4
from datetime import datetime
from copy import copy
class ParseError(Exception):
pass
class ParseChildIdError(ParseError):
pass
class ParseAvailableDatesError(ParseError):
pass
class Parser:
"""Parser is essentially the web page scraper that returns various
bits of infor... |
# -*- encoding: utf-8 -*-
##############################################################################
#
# Copyright (c) 2013 ZestyBeanz Technologies Pvt. Ltd.
# (http://wwww.zbeanztech.com)
# contact@zbeanztech.com
# prajul@zbeanztech.com
#
# This program is free software: you can redistribute it and/... |
#coding:utf-8
import sys
import nltk.classify.util
from nltk.classify import NaiveBayesClassifier
from nltk.corpus import names
def word_feats(words):
return dict([(word, True) for word in words])
positive_vocab = ['iyi','güzel','Tebrikler','tebrik ederim','tebrik','teşekkür', 'ederiz',':)','m at @LCWaikiki','ino... |
#!/usr/bin/env python
#-------------------------------------------------------------------
# The MIT License
#
# Copyright (c) 2009 Patrick Mueller
#
# 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... |
import time
import logging
import betfairlightweight
from betfairlightweight.filters import streaming_market_filter
from pythonjsonlogger import jsonlogger
from flumine import Flumine, clients, BaseStrategy
from flumine.worker import BackgroundWorker
from workers.inplayservice import poll_in_play_service
logger = log... |
"""
A CUDA ND Array is recognized by checking the __cuda_memory__ attribute
on the object. If it exists and evaluate to True, it must define shape,
strides, dtype and size attributes similar to a NumPy ndarray.
"""
import warnings
import math
import functools
import operator
import copy
from ctypes import c_void_p
i... |
import os
import sys
import json
import StringIO
import io
import pdb
try:
from configparser import ConfigParser
except ImportError:
from ConfigParser import ConfigParser
try:
import mock
except ImportError:
from unittest import mock
from nose.tools import assert_equal
from nose.tools import assert_not_... |
"""tf.sigmoid(x, name = None)
解释:这个函数的作用是计算 x 的 sigmoid 函数。具体计算公式为 y = 1 / (1 + exp(-x))。
函数的返回值位于区间[0.0 , 1.0]中,当输入值较大时,tf.sigmoid将返回一个接近于1.0的值,而当输入值较小时,返回值将接近于0.0.
对于在真实输出位于[0.0,1.0]的样本上训练的神经网络,sigmoid函数可将输出保持在[0.0,1.0]内的能力非常有用.
当输出接近于饱和或者剧烈变化是,对输出返回的这种缩减会带来一些不利影响.
当输入为0时,sigmoid函数的输出为0.5,即sigmoid函数值域的中间点
使用例子:"""
i... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
This file is part of the HUB TOOLBOX available at
https://github.com/OFAI/hub-toolbox-python3/
The HUB TOOLBOX is licensed under the terms of the GNU GPLv3.
(c) 2018, Roman Feldbauer
Austrian Research Institute for Artificial Intelligence (OFAI)
Contact: <roman.feldba... |
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
import base64
import logging
from odoo import _, api, fields, models, tools, Command
from odoo.exceptions import UserError
_logger = logging.getLogger(__name__)
class MailTemplate(models.Model):
"Templates for s... |
# Copyright (C) 2014 Linaro Ltd.
#
# This program 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 Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distribute... |
from theatre_ag.theatre_ag.workflow import treat_as_workflow
from .Constraints import Deadline
from random import random, choice
class CourseworkWorkflow:
def __init__(self):
self.agent = None
self.competence = {'essays_written': 0.95,
'working_programs': 0.95}
def... |
# encoding: utf-8
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# all previous data belongs to Temba Lethu Clinic
from django.contrib.auth.models import Group
gro... |
import Image
import select
import v4l2capture
import numpy
import pylab
import time
# Open the video device.
#~ video = v4l2capture.Video_device("/dev/video0")
video = v4l2capture.Video_device("http://admin:@192.168.1.105/snapshot.cgi?.mjpeg")
# Suggest an image size to the device. The device may choose and
# return ... |
"""
This example shows the trade-off (pareto frontier) of deficit against cost by altering a reservoir control curve.
Two types of control curve are possible. The first is a monthly control curve containing one value for each
month. The second is a harmonic control curve with cosine terms around a mean. Both Parameter... |
"""
Builds sumatra and uploads results to s3 for easy analysis, viewable at:
https://kjkpub.s3.amazonaws.com/sumatrapdf/buildbot/index.html
"""
import sys
import os
# assumes is being run as ./scripts/buildbot.py
efi_scripts_dir = os.path.join("tools", "efi")
sys.path.append(efi_scripts_dir)
import shutil
i... |
'''
Created on 1 Mar 2014
@author: tore
'''
from OpenGL.GL import *
import pygame
class WindowButton(object):
def __init__(self, window, text, x, y, w, h, action):
self.window = window
self.text = text
self.posx = x
self.posy = y
self.width = w
self.height = h
... |
#!/usr/bin/env python3
# Copyright (C) 2013-2016 Florian Festi
#
# 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.... |
"""
.15925 Editor
Copyright 2014 TechInvestLab.ru dot15926@gmail.com
.15925 Editor 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 Software Foundation; either
version 3.0 of the License, or (at your option) any later version.... |
# users.py
# Display user info
# $Id: users.py 13454 2012-11-08 17:54:19Z fine $
#
import re, os
from datetime import datetime, timedelta
import pmConfig.pmConfig as config
import pmUtils.pmUtils as utils
from pmCore.pmModule import pmModule
from pmTaskBuffer.pmTaskBuffer import pmtaskbuffer as pmt
from operator im... |
# -*- coding: utf-8; -*-
#
# oedes - organic electronic device simulator
# Copyright (C) 2017-2018 Marek Zdzislaw Szymanski (marek@marekszymanski.com)
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License, version 3,
# as published by the ... |
#!/usr/bin/env python
#
# common functions for samba-tool python commands
#
# Copyright Andrew Tridgell 2010
# Copyright Giampaolo Lauria 2011 <lauria2@yahoo.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 So... |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2012 Grid Dynamics
# All Rights Reserved.
#
# 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/l... |
# ParanoiDF. A combination of several PDF analysis/manipulation tools to
# produce one of the most technically useful PDF analysis tools.
#
# Idea proposed by Julio Hernandez-Castro, University of Kent, UK.
# By Patrick Wragg
# University of Kent
# 21/07/2014
#
# With thanks to:
# Julio... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright (C) 2014-2015 James Clark <james.clark@ligo.org>
#
# 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
... |
# Generated by Django 2.1.2 on 2018-11-04 20:09
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('crossbot', '0010_fix_time_model'),
]
operations = [
migrations.AlterModelOptions(
name='MiniCrosswordModel',
options... |
# -*- coding: UTF-8 -*-
"""
$Id$
$URL$
Copyright (c) 2010 foption
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, modif... |
# -*- coding: utf-8 -*-
import os
import httplib as http
from flask import request
from flask import send_from_directory
from framework import status
from framework import sentry
from framework.auth import cas
from framework.routing import Rule
from framework.flask import redirect
from framework.routing import WebRen... |
# 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, software
# d... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
@author: Watermarkero, Mario, Ariel
"""
from PIL import Image
import random
import matplotlib.pyplot as plt
import numpy as np
def rgb2gray(rgb):
return np.dot(rgb[...,:3], [0.299, 0.587, 0.114])
def marcarPixel(color, bitporinsertar):
if (color%2)==1:
... |
import requests
import time
from . import article
import base64
import json
from dateutil.parser import parse
import log
import os
identity = "process_%s" % os.getpid()
logger = log.logger("lax_provider.log", 'INFO', identity)
class ErrorCallingLaxException(Exception):
pass
def article_versions(article_id, set... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
import flocsweb.mixins
import datetime
import uuid
class Migration(migrations.Migration):
dependencies = [
('practice', '0010_remove_tasksession_creation_timestamp'),
]
operations = [
... |
from app import app
from flask import url_for
from .models import Player, DoesNotExist
from .helpers import json_file_to_dict
from config import JSON_DIR
import datetime
import arrow
import os
@app.template_filter("game_mode")
def game_mode(mode_id):
return json_file_to_dict(os.path.join(JSON_DIR, "game_mode.json... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright 2004-2009 Zuza Software Foundation
#
# This file is part of Pootle.
#
# 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... |
from ryu.lib.packet import packet
from ryu.lib.packet import ethernet
from ryu.lib.packet import ether_types
from django.db import models
from mike.controller.openflow import MikeOpenflowController
from mike.lib.mike_object import UUIDObject
from mike.services.service import Service
from mike.lib.objects.port import P... |
import os.path
import typing
from mitmproxy import command
from mitmproxy import exceptions
from mitmproxy import flowfilter
from mitmproxy import io
from mitmproxy import ctx
from mitmproxy import flow
import mitmproxy.types
class Save:
def __init__(self):
self.stream = None
self.filt = None
... |
'''
Kodutoo 16
14.11.2014
Andres Liiver
'''
import time
from matplotlib import pyplot as plt
from Tund16gen import *
def timeFunc(func, *args):
start = time.clock()
func(*args)
return time.clock() - start
def linear_search(lst, num):
for item in lst:
if item == num:
return True
... |
# Copyright 2012, Nachi Ueno, NTT MCL, Inc.
# All Rights Reserved.
#
# 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
#
# Unles... |
#
# Project Kimchi
#
# Copyright IBM, Corp. 2013
#
# 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 Software Foundation; either
# version 2.1 of the License, or (at your option) any later version.
#
# This lib... |
#!/usr/bin/env python -tt
#
# Copyright (c) 2011 Intel, 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; version 2 of the License
#
# This program is distributed in the hope that it will b... |
#!/usr/bin/env python
# Fields differentiating between several MAC PDU types
from scapy.packet import Packet, bind_layers
from scapy.fields import BitEnumField, ConditionalField
from .gsmtap import GSMTAP
# Table 321: MAC PDU types for SCH/F, SCH/HD, STCH and BSCH
class MAC_DL(Packet):
name = 'MAC (downlink)'
... |
# -*- coding: utf-8 -*-
"""
A real simple app for using webapp2 with auth and session.
It just covers the basics. Creating a user, login, logout
and a decorator for protecting certain handlers.
Routes are setup in routes.py and added in main.py
"""
# standard library imports
import logging
import jso... |
import sys, os
sys.path.insert(1, os.path.join("..",".."))
import h2o
from tests import pyunit_utils
def deeplearning_mean_residual_deviance():
cars = h2o.import_file(path=pyunit_utils.locate("smalldata/junit/cars_20mpg.csv"))
s = cars.runif()
train = cars[s > 0.2]
valid = cars[s <= 0.2]
predictors = ["dis... |
#!/usr/bin/env python
#Runtime (690, 130, 128, 128): 3 hours 40 minutes
from pylab import *
import numpy
import cPickle
from netCDF4 import Dataset
import sys, os
from thermo import SAM
import model_param as mc
# Load mean cloud field stat
stat_file = Dataset(mc.get_stat())
data = {'z': stat_file.variables['z'][:].a... |
"""
Tests for the `fitness_model` module.
"""
import Bio.Align.AlignInfo
import Bio.Phylo
import Bio.SeqIO
import datetime
import numpy as np
import pytest
import sys
import os
# we assume (and assert) that this script is running from the tests/ directory
sys.path.append(os.path.join(os.path.dirname(__file__), '..', '... |
#!/usr/bin/env python
#
# Copyright (c) 2001 - 2016 The SCons Foundation
#
# 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 us... |
import numpy as np
import pandas as pd
from pyFTS.data import Enrollments, TAIEX
from pyFTS.partitioners import Grid, Simple
from pyFTS.models.multivariate import partitioner as mv_partitioner
from pyFTS.models import hofts
from pyspark import SparkConf
from pyspark import SparkContext
import os
# make sure pyspark ... |
#!/usr/bin/python
# qbox_dos.py: extract electronic DOS from Qbox output
# generate DOS plot in gnuplot format
# use: qbox_dos.py [-last] emin emax width file.r
# emin, emax: bounds of plot in [eV]
# width: gaussian broadening in [eV]
# the DOS is accumulated separately for each spin
# With the -last option, only the l... |
## This file is part of Invenio.
## Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 CERN.
##
## Invenio 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, ... |
#!/usr/bin/env python
import wave
import struct
import glob
import numpy
import scipy.io.wavfile
import scipy.signal
import scipy.fftpack
import pylab
#MAX_SHRT = 32768.0
GAIN = 1.0
PLOT = True
#PLOT = False
#IMPULSES = True
IMPULSES = False
#if not IMPULSES:
# GAIN = 400.0
HEADER_BEGIN = """/* This file was a... |
# -*- 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):
# Changing field 'MessageCost.tag_pool'
db.alter_column(u'billing_messagecost', 'tag_pool_id', self.gf('dja... |
# Copyright 1998-2007 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
import codecs
import errno
import sys
from portage import os
from portage import _encodings
from portage import _unicode_encode
from portage.tests import TestCase
class SpawnTestCase(TestCase):
def testLogfile... |
#
# Copyright (C) 2016, OVH SAS
#
# This file is part of ip-reputation-monitoring.
#
# ip-reputation-monitoring 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 op... |
#!/usr/bin/env python
import codecs
import os
import sys
from setuptools import setup, find_packages
ROOT_DIR = os.path.dirname(__file__)
SOURCE_DIR = os.path.join(ROOT_DIR)
requirements = [
'requests >= 2.5.2, != 2.11.0',
'six >= 1.4.0',
'websocket-client >= 0.32.0',
'docker-pycreds >= 0.2.1'
]
if... |
# 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, software
# distributed under the... |
import gym
import random
import numpy as np
from .utils import rgb2gray, imresize
class Environment(object):
def __init__(self, config):
self.env = gym.make(config.env_name)
screen_width, screen_height, self.action_repeat, self.random_start = \
config.screen_width, config.screen_height, config.acti... |
import matplotlib.pyplot as plt
import numpy as np
from matplotlib.colors import LinearSegmentedColormap
from os import sep
from constants import PARAMS_ID, PARAMS_ID_INV, STATES_ID_INV, OUTPUT_DIR, Z_TO_COLOUR_BISTABLE_WIDE, Z_TO_COLOUR_ORIG
from data_io import write_matrix_data_and_idx_vals, read_matrix_data_and_idx... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.