src stringlengths 721 1.04M |
|---|
from contrib.rfc3315.constants import *
from contrib.rfc3633.dhcpv6_pd import DHCPv6PDHelper
from scapy.all import *
from veripy.assertions import *
from veripy.models import IPAddress
class BasicMessageExchangeTestCase(DHCPv6PDHelper):
"""
DHCPv6-PD Basic Message Exchange
Verify that a device can proper... |
# -*- coding: utf-8 -*-
#
# BitcoinLib - Python Cryptocurrency Library
#
# Create Multisig 3-of-5 wallet
#
# © 2017 November - 1200 Web Development <http://1200wd.com/>
#
from pprint import pprint
from bitcoinlib.wallets import wallet_exists, Wallet, wallet_delete_if_exists
from bitcoinlib.keys import HDKey
... |
import tp
import mm
def thing_init(t):
return
total_snow_mound = 0
def snow_mound1_init(d1000_roll, tiles=[]):
global total_snow_mound
name = "snow_mound" + str(total_snow_mound + 1)
total_snow_mound = total_snow_mound + 1
x = tp.Tp(name=name,
is_snow_mound=True,
... |
#!/usr/bin/python
#
# Copyright 2018-2021 Polyaxon, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable ... |
# coding=utf-8
"""
This file contains map locations information
"""
from PiMFD.Applications.MFDPage import MFDPage
from PiMFD.UI.Button import MFDButton
from PiMFD.UI.TextBoxes import TextBox
from PiMFD.UI.Widgets.MenuItem import TextMenuItem
__author__ = 'Matt Eland'
class MapLocation(object):
"""
Represe... |
#!/usr/bin/env python
# Copyright 2017 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
from __future__ import print_function
import argparse
import os
import subprocess
import sys
# This function is inspired from the on... |
# -*- coding: utf-8 -*-
from .usagetracker import UsageTracker
from .isodates import isodate
import unittest
class CurveProvider_MockUp(object):
def __init__(self, data):
self._data = data
def usage(self, member, start, end):
return self._data[:]
def updateUsage(self, member, start, da... |
import datetime
from django.db import models
from django.utils import simplejson
from django.utils.translation import ugettext_lazy as _
JSON = 1
XML = 2
FORMAT_CHOICES = (
(JSON, "JSON"),
(XML, "XML"),
)
class ProviderRule(models.Model):
name = models.CharField(_("name"), max_length=128, null=True, blank... |
#
# Gramps - a GTK+/GNOME based genealogy program
#
# Copyright (C) 2001-2006 Donald N. Allingham
# Copyright (C) 2010 Jakim Friant
#
# 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; eithe... |
#!/usr/bin/env python
# Copyright 2008-2015 Nokia Solutions and Networks
#
# 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 r... |
# -*- coding: utf-8 -*-
# Copyright: (c) 2008, Jarek Zgoda <jarek.zgoda@gmail.com>
__revision__ = '$Id: models.py 28 2009-10-22 15:03:02Z jarek.zgoda $'
import re
from django.db import models
from django.core.urlresolvers import reverse
from django.core.mail import send_mail
from django.conf import settings
from dj... |
from __future__ import division
from climlab.process.energy_budget import EnergyBudget
from climlab.utils import constants as const
import numpy as np
class AplusBT(EnergyBudget):
r"""The simplest linear longwave radiation module.
Calculates the Outgoing Longwave Radation (OLR) :math:`R\uparrow` as
.. m... |
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
#
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes ... |
__author__ = 'williewonka'
#this tool checks if the provinces title exists and if this title has an owner
import json
# import random
#dictionary that keeps track of the number of existing members of a dynastie, that way no conflicts will emerge
existing_dynasties = {}
#id numbering: 001 + dynasty id
jsonfile = open... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import time
from pymongo.errors import AutoReconnect, OperationFailure
from utils.database import get_mongodb
from abstract_class import BaseWatcher
from core import OPLOG_WATCHER
import pika
import logging
class OplogWatcher(BaseWatcher):
"""
MongoDB oplog.rs Wa... |
#
# 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
# ... |
"""This module implements the UserMixin class for Flask-User.
This Mixin adds required methods to User data-model.
"""
from flask import current_app
from flask_login import UserMixin as FlaskLoginUserMixin
class UserMixin(FlaskLoginUserMixin):
""" This class adds required methods to the User data-model.
Exam... |
#!/usr/bin/python3
#RUN this program from the directory it is listed in
#with command ./plot_LJ_Potential.py
from scipy import special
import numpy as np
import matplotlib.pyplot as plt
import math
#Plot WCA Potential vs r
#R=1/1.781797436 #for a sigma=1 DOESN'T WORK!! graph wrong shape!
R=1/1.781797436
epsilo... |
'''
Online link spider test
'''
import unittest
from unittest import TestCase
import time
import sys
from os import path
sys.path.append(path.dirname(path.dirname(path.abspath(__file__))))
import scrapy
import redis
from redis.exceptions import ConnectionError
import json
import threading, time
from crawling.spiders.... |
# -*- coding: utf-8 -*-
"""
# Created on
# @author:
# @contact:
"""
import tornado.ioloop
import tornado.web
import os
from dHydra.console import *
# 首页根目录
class IndexHandler(tornado.web.RequestHandler):
def prepare(self):
"""
单入口做URI路由转发,交给对应Handler处理
"""
request = self.request
... |
# F3AT - Flumotion Asynchronous Autonomous Agent Toolkit
# Copyright (C) 2010,2011 Flumotion Services, S.A.
# All rights reserved.
# 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... |
# -*-coding:Utf-8 -*
# Copyright (c) 2015 LE GOFF Vincent
# 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
# lis... |
# -*- coding: UTF-8
#
# validator
# *********
#
# Utilities to validate data recorded in the ORM
import re
from globaleaks import LANGUAGES_SUPPORTED_CODES
from globaleaks.settings import GLSettings
from globaleaks.rest import errors
from globaleaks.utils.utility import log
def natnum_v(self, attr, value):
"""
... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# DjangoRestMultipleModels documentation build configuration file, created by
# sphinx-quickstart on Thu Jun 9 15:00:02 2016.
#
# This file is execfile()d with the current directory set to its
# containing dir.
#
# Note that not all possible configuration values are pre... |
# Standard imports
import json
from random import randrange
from bottle import route, post, get, run, template, static_file, request, app, HTTPError, abort, BaseRequest, JSONPlugin
import bottle as bt
# To support dynamic loading of client-specific libraries
import sys
import os
import logging
logging.basicConfig(forma... |
# -*- coding: utf-8 -*-
from zerver.lib.webhooks.git import COMMITS_LIMIT
from zerver.lib.test_classes import WebhookTestCase
class GitlabHookTests(WebhookTestCase):
STREAM_NAME = 'gitlab'
URL_TEMPLATE = "/api/v1/external/gitlab?&api_key={api_key}"
FIXTURE_DIR_NAME = 'gitlab'
def test_push_event_messa... |
#------------------------------------------------------------------ iq
from Tkinter import *
import Pmw
import g
import w
import time
import tkMessageBox
import pickle
def done():
root.withdraw()
root=Toplevel()
root.withdraw()
root.protocol('WM_DELETE_WINDOW',done)
if g.Win32: root.iconbitmap("wsjt.ico")
root.ti... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('activitydb', '0036_auto_20151028_1519'),
]
operations = [
migrations.AlterField(
model_name='siteprofile',
... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
from __future__ import division
from woo import utils,plot,pack,timing,eudoxos
import time, sys, os, copy
#import matplotlib
#matplotlib.rc('text',usetex=True)
#matplotlib.rc('text.latex',preamble=r'\usepackage{concrete}\usepackage{euler}')
"""
A fairly complex script perf... |
#
# MythBox for XBMC - http://mythbox.googlecode.com
# Copyright (C) 2012 analogue@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 Software Foundation; either version 2
# of the License, or (at yo... |
import discord
from discord.ext import commands
from cogs.utils.dataIO import dataIO
from .utils import checks
from .utils.chat_formatting import escape_mass_mentions, pagify
import os
from random import choice as randchoice
try:
from tabulate import tabulate
except Exception as e:
raise RuntimeError("You mus... |
''' Prediction dashboard for the manager interface
Will allow you to predict ingredient usage between two chosen dates
'''
import urllib, base64
from datetime import datetime, timedelta
import logging
from io import BytesIO
from flask import Blueprint, render_template, abort, request, flash
from jinja2 import Templat... |
from django.utils.datastructures import SortedDict
from questionnaire.models import Answer, AnswerGroup
from questionnaire.services.questionnaire_entry_form_service import QuestionnaireEntryFormService
class UserQuestionnaireService(object):
def __init__(self, country, questionnaire, version=None):
self.... |
#coding:utf-8
from scrapy.dupefilters import RFPDupeFilter
class URLFilter(RFPDupeFilter):
"""根据url过滤"""
def __init__(self, path=None,debug=False):
self.urls_seen = set()
RFPDupeFilter.__init__(self, path)
def request_seen(self, request):
if request.url in self.urls_seen:
... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Read the structured text ODB++ drill tools file
"""
import gzip
from collections import namedtuple, defaultdict
import os.path
from enum import Enum
from .Utils import readFileLines
from .StructuredTextParser import read_structured_text
from .Structures import HolePla... |
# -*- coding: utf-8 -*-
""" Implements the Bayesian Audit. """
from collections import Counter
from itertools import chain
from random import gammavariate
from random import seed as set_seed
from time import time
def get_new_ballot_weights(election, r):
""" Returns new ballot weights for the given election.
... |
import corenlp as cnlp
from sklearn.metrics.pairwise import cosine_similarity
import re
import os
import gzip
import wtmf
from sklearn.externals import joblib
import cuttsum.events
import cuttsum.judgements
import pandas as pd
from collections import defaultdict
matches_df = cuttsum.judgements.get_merged_dataframe()
... |
# pintail - Build static sites from collections of Mallard documents
# Copyright (c) 2015-2020 Shaun McCance <shaunm@gnome.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... |
from collections import defaultdict
from django.core.urlresolvers import reverse
from django.http import HttpResponseForbidden, HttpResponse, HttpResponseBadRequest
from tastypie import fields
from tastypie.bundle import Bundle
from tastypie.authentication import Authentication
from tastypie.exceptions import BadReque... |
""" run with
nosetests -v --nocapture --nologcapture
nosetests -v --nocapture test_inventory.py:Test_Inventory.test_06
nosetests -v
"""
from __future__ import print_function
from datetime import datetime
from cloudmesh_base.util import HEADING
from cloudmesh.inventory import Inventory
from pprint import pprint
cl... |
# bayes.py
# Code for working with Bayes Post-Election Audits
# Ronald L. Rivest and Emily Shen
# 5/31/12
"""
----------------------------------------------------------------------
This code available under "MIT License" (open source).
Copyright (C) 2012 Ronald L. Rivest and Emily Shen.
Permission is hereby granted, f... |
"""Main file that describes all of views."""
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
import datetime
from django.contrib.auth.decorators import permission_required
from django.contrib.auth.mixins import (LoginRequiredMixin,
PermissionRequiredMixin)
from ... |
import json
from flask import Flask
from fittrackee.users.models import User
from fittrackee.workouts.models import Sport, Workout
from ..api_test_case import ApiTestCaseMixin
class TestGetStatsByTime(ApiTestCaseMixin):
def test_it_gets_no_stats_when_user_has_no_workouts(
self, app: Flask, user_1: User... |
import unittest
from construct.lib.binary import int_to_bin, bin_to_int, swap_bytes, encode_bin, decode_bin
from construct.lib.expr import Path
class TestBinary(unittest.TestCase):
def test_int_to_bin(self):
self.assertEqual(int_to_bin(19, 5), b"\x01\x00\x00\x01\x01")
self.assertEqual(int_to_bin(... |
#!/usr/bin/env python
##################################################################
# Copyright (c) 2012, Sergej Srepfler <sergej.srepfler@gmail.com>
# February 2012 - Nov 2012
# Version 0.3.1, Last change on Nov 17, 2012
# This software is distributed under the terms of BSD license.
##########################... |
# Copyright 2013 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""Generates JavaScript source files from a mojom.Module."""
from generate import mojom
from generate import mojom_pack
from generate import mojom_generator... |
import common
def calculate_price_change(conn, entity_id, mysql_interval):
result = conn.execute("""
select
(select price from PriceHistory where entity_id=%s order by timestamp desc limit 1) -
(select price from PriceHistory wher... |
#pylint: disable-all
import pytest
import os
from xatag.config import *
import xatag.constants as constants
from xatag.constants import DEFAULT_TAG_KEY
@pytest.fixture
def confdir(tmpdir):
os.environ[constants.CONFIG_DIR_VAR] = str(tmpdir)
create_config_dir()
fname = tmpdir.join('known_tags')
with fna... |
# -*- coding: utf-8 -*-
# Copyright (C) Joshua Smith (2016-)
#
# This file is part of the hveto python package.
#
# hveto 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
# (... |
from .Parser import Parser
p = Parser()
#Tests to check syntax
print(p.parsesentence("q.")) # Atom, zero arity
print(p.parsesentence("q(x).")) # Atom, one var
print(p.parsesentence("q('3').")) # Atom, string
print(p.parse... |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Nova Billing
# Copyright (C) 2010-2012 Grid Dynamics Consulting Services, Inc
# All Rights Reserved
#
# 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 Software Fo... |
# pylint: disable=C0111,R0902,R0904,R0912,R0913,R0915,E1101
# Smartsheet Python SDK.
#
# Copyright 2018Smartsheet.com, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License"): you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.a... |
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
from sklearn import linear_model
from features import calculateTargets
from simulate import backtest
from pprint import pprint
currency = 'EURUSD'
interval = '60'
factor = 10000
df = pd.read_csv(
r'../data/' + currency.upper() + interval + '.c... |
import re
import sys
from functools import wraps
from inspect import getmembers
from typing import Dict
from unittest import TestCase
from scrapy.http import Request
from scrapy.utils.python import get_spec
from scrapy.utils.spider import iterate_spider_output
class Contract:
""" Abstract class for contracts """... |
#!/usr/bin/env python
# coding: utf-8
import sys, os
sys.path.append(os.pardir) # 親ディレクトリのファイルをインポートするための設定
import pickle
import numpy as np
from common.layers import Convolution, Relu, Pooling, Affine, Dropout, SoftmaxWithLoss
class DeepConvNet:
"""認識率99%以上の高精度なConvNet
ネットワーク構成は下記の通り
conv - relu -... |
#!/usr/bin/env python
#
# Author: Mike McKerns (mmckerns @caltech and @uqfoundation)
# Copyright (c) 1997-2015 California Institute of Technology.
# License: 3-clause BSD. The full license text is available at:
# - http://trac.mystic.cacr.caltech.edu/project/mystic/browser/mystic/LICENSE
"""
Example:
- Minimize R... |
import functools
from datetime import datetime
from functools import partial
from django import http
from django.conf import settings
from django.contrib import auth
from django.contrib.auth.forms import PasswordResetForm
from django.contrib.auth.tokens import default_token_generator
from django.db import IntegrityErr... |
from datapackage_pipelines_knesset.common.base_processors.add_resource import AddResourceBaseProcessor
# only loads members with the following positionId:
SUPPORTED_POSITION_IDS = [43, 61]
class Processor(AddResourceBaseProcessor):
def _get_schema(self, resource_descriptor):
return resource_descriptor.ge... |
from unittest import TestCase
from gitmostwanted.lib.bigquery.result import ResultJob
class LibBigQueryResultTestCase(TestCase):
def setUp(self):
pass
def test_convert_incoming_obj(self):
result = ResultJob(self.response_example())
self.assertEqual(len(result), 2)
self.assert... |
"""
Test unit systems.
"""
# -----------------------------------------------------------------------------
# Copyright (c) 2018, yt Development Team.
#
# Distributed under the terms of the Modified BSD License.
#
# The full license is in the LICENSE file, distributed with this software.
# ----------------------------... |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.4 on 2017-11-20 17:56
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('hc_dpd', '0002_auto_20171120_1055'),
]
operations = [
migrations.CreateMode... |
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not u... |
# "e_base.py" needed (under the same directory)
if 'os' not in dir():
import os
if 'math' not in dir():
import math
print("\n"
"Type 1 to show the first few "
"numbers of the sequence {e_l} "
"(defined in Originality.pdf)"
"\n\n"
"Type 2 to show the relative complement of {e_l} "
... |
"""The backbone of pax - the Processor class
"""
import glob
import logging
import six
import itertools
import os
import time
from prettytable import PrettyTable # Timing report
from tqdm import tqdm # Progress bar
import pax # Needed for pax.__version__
from pax.configuration import load_c... |
import Tkinter as tk
import tkFont as tkFont
import ttk as ttk
from ..exceptions.handling import ExceptionHandler
class GridBox(object):
def __init__(self, master, headers, row, column):
self.master = master
self.headers = headers
self.items_dict = {}
self.tree = None
... |
#!/usr/bin/env python
import numpy as np
import cv2
import os
import sys, getopt
from glob import glob
img_set = 'frame*.jpg'
img_names = glob(img_set)
chessboard_size = (9, 6)
pattern_points = np.zeros( (np.prod(chessboard_size), 3), np.float32 )
pattern_points[:,:2] = np.indices(chessboard_size).T.reshape(-1, 2)
... |
# -*- coding: utf-8 -*-
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding field 'Country.country_code'
db.add_column('foundry_country', 'country_code',
... |
from __future__ import absolute_import
import argparse
import logging
import math
import sys
import tempfile
import time
import ephem
import matplotlib
import requests
from astropy.io.votable import parse
matplotlib.use('Agg')
from matplotlib.pyplot import figure, close
from matplotlib.patches import Rectangle
from ... |
import os, sys
def congrats():
print(" ,jf")
print(" _am, ,_am, ,_g_oam, _am, _g_ag, _am, koewkovg _mm_")
print(" ,gF @._-gF @-' jf @ ,gF @ ^ NX #_,gF @ jf qK '")
print(" 8Y 8Y d j# ... |
import websocket
import json
import logging
import coloredlogs
import sys
import ssl
from getopt import gnu_getopt, GetoptError
from mouserver_ext import grab_window, Window
import random
import string
import time
class Mouserver:
def __init__(self, ws_url, session, window):
self.ws_url = ws_url
... |
from __future__ import absolute_import
import os.path
try:
# let's not use rzipfile for now (it's really really slow in python)
raise Exception
from rpython.rlib.rzipfile import RZipFile
ZipFile = RZipFile
except:
RZipFile = None
from zipfile import ZipFile
from classreader import ClassReader
f... |
# ==============================================================================
# Copyright (C) 2011 Diego Duclos
# Copyright (C) 2011-2018 Anton Vorobyov
#
# This file is part of Eos.
#
# Eos is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as publi... |
# Generated by Django 2.0.2 on 2018-06-17 15:40
import ddcz.models.magic
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
("ddcz", "0017_auto_20180617_1604"),
]
operations = [
migrations.AddField(
model_name="gallerypicture",
... |
import pulsar as psr
def load_ref_system():
""" Returns l-leucine as found in the IQMol fragment library.
All credit to https://github.com/nutjunkie/IQmol
"""
return psr.make_system("""
H 0.3678 -1.3008 0.4056
C 0.5471 -0.3960 -0.2429
N 2.0124 ... |
# -*- coding: utf-8 -*-
# Copyright 2014 Foxdog Studios
#
# 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 l... |
# ##### BEGIN GPL LICENSE BLOCK #####
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed ... |
from cStringIO import StringIO
import boto.exception
import boto.s3.connection
import boto.s3.acl
import bunch
import datetime
import time
import email.utils
import isodate
import nose
import operator
import socket
import ssl
import os
import requests
import base64
import hmac
import sha
import pytz
import json
import ... |
# -*- coding: utf-8 -*-
from Plugins.Extensions.MediaPortal.plugin import _
from Plugins.Extensions.MediaPortal.resources.imports import *
from Plugins.Extensions.MediaPortal.additions.fun.fashionguidetv import GermanyTVPlayer, GermanyTVPlayer2, GermanyTVPlaylist
from Plugins.Extensions.MediaPortal.resources.twagenthe... |
from devito.ir.iet import MapNodes, Section, TimedList, Transformer
from devito.mpi.routines import (HaloUpdateCall, HaloWaitCall, MPICall, MPIList,
HaloUpdateList, HaloWaitList, RemainderCall)
from devito.passes.iet.engine import iet_pass
from devito.passes.iet.orchestration import Bus... |
from textwrap import dedent
from unittest import TestCase
from ColorSchemeUnit.lib.generator import _build_assertions
class TestGenerateAssertions(TestCase):
def test_generate_assertions(self):
self.assertEquals(dedent("""
^ a
""").strip(), _build_assertions(['a'], '', ''))
self... |
# Copyright (C) 2013 Claudio Guarnieri.
# Copyright (C) 2014-2017 Cuckoo Foundation.
# This file is part of Cuckoo Sandbox - http://www.cuckoosandbox.org
# See the file 'docs/LICENSE' for copying permission.
import web.errors
# Maximum upload size (10GB, so there's basically no limit).
MAX_UPLOAD_SIZE = 10*1024*1024*... |
"""
Tests for the thread pool.
Pyro - Python Remote Objects. Copyright by Irmen de Jong (irmen@razorvine.net).
"""
import time
import random
import pytest
from Pyro5 import socketutil, server
from Pyro5.svr_threads import Pool, PoolError, NoFreeWorkersError, SocketServer_Threadpool
from Pyro5 import config
JOB_TIM... |
import os
import urlparse
import json
import vim
import requests
from requests.auth import HTTPDigestAuth
from pygerrit.salting import check_hash, AuthObject
# Until I can get the kerberos auth figured out,
# I made a SSH Tunnel and just do all the things I want to.
XSSI_STRING = ")]}'"
PROJECT_JSON_KEY = 'project'
B... |
from __future__ import generators, print_function
import numpy as np
from random import shuffle
from scipy.io import loadmat
from copy import deepcopy
import functools
import Queue
#from multiprocessing import Process, Queue, Manager, Pool
import threading
import time
from collections import defaultdict
def async_pre... |
from contextlib import contextmanager, suppress
from datetime import datetime
from functools import wraps
from os import _exit, environ, getpid, kill
from os.path import join
from select import select
from shutil import get_terminal_size
from signal import signal, SIG_DFL, SIGINT, SIGQUIT, SIGTERM
from subprocess impor... |
# Copyright 2017 ZTE Corporation.
#
# 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 ... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Examples of using GMM class.
"""
import numpy as np
import pandas as pd
from mygmm import GMM
class Model(object):
"""Model moment restrictions and Jacobian.
"""
def __init__(self, data):
self.data = data
def momcond(self, theta, **kwargs)... |
import numpy as np
import tensorflow as tf
from agent.forward import ActorCriticNet
from params import *
def batch_choice(a, p):
action_list = [np.random.choice(a, p=i) for i in p]
return np.array(action_list)
# local network for advantage actor-critic which are also know as A2C
class Agent(object):
def... |
"""
${NAME}
"""
from __future__ import absolute_import, division, print_function, unicode_literals
import logging
log = logging.getLogger(__name__)
from OpenGL import GL
class Drawable(object):
def __init__(self):
super(Drawable, self).__init__()
self._displayList = None
self.invalidL... |
# pyimg
# create at 2015/5/28
# autor: qianqians
from pyelement import pyelement
from pyhtmlstyle import pyhtmlstyle
class pyimg(pyelement):
onclick = 0
def __init__(self, img, cname, layout, praframe):
# when normal
self.normalimg = img
self.type = "img"
super(pyimg, self).__init__(cname, layout, praframe)... |
# Copyright 2020 The TensorFlow Authors. 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
#
# Unless required by applica... |
# -*- coding: utf-8 -*-
# This file is part of Shuup.
#
# Copyright (c) 2012-2016, Shoop Ltd. All rights reserved.
#
# This source code is licensed under the AGPLv3 license found in the
# LICENSE file in the root directory of this source tree.
from __future__ import unicode_literals
import datetime
from django.utils.... |
# Amara, universalsubtitles.org
#
# Copyright (C) 2013 Participatory Culture Foundation
#
# 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 ... |
import pytest
from django import forms
from django.contrib.auth.models import AnonymousUser
from faker import Faker
from machina.apps.forum_conversation.forms import PostForm, TopicForm
from machina.conf import settings as machina_settings
from machina.core.db.models import get_model
from machina.core.loading import g... |
#coding=utf-8
#全局变量设置
from django.http import HttpResponse,HttpResponseForbidden,HttpResponseServerError
from django.views.decorators.csrf import csrf_exempt
from django.template import loader, RequestContext
from django.conf import settings
#import sys
#import os
import traceback as tb
#import datetime
#im... |
# Author: Jean-Remi King, <jeanremi.king@gmail.com>
#
# License: BSD (3-clause)
import numpy as np
from numpy.testing import assert_array_equal, assert_equal
import pytest
from mne.utils import requires_version
from mne.decoding.search_light import SlidingEstimator, GeneralizingEstimator
from mne.decoding.transformer... |
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
#
# Okinawa Institute of Science and Technology, Japan.
#
# This script runs on STEPS 2.x http://steps.sourceforge.net
#
# H Anwar, I Hepburn, H Nedelescu, W Chen and E De Schutter
# Stochastic calcium mechanisms cause dendritic calcium spike... |
#!/usr/bin/env python3
#
# Copyright (c) Bo Peng and the University of Texas MD Anderson Cancer Center
# Distributed under the terms of the 3-clause BSD License.
import copy
import gzip
import os
import shlex
import shutil
import subprocess
import sys
import tarfile
import time
import tempfile
import textwrap
import u... |
#!flask/bin/python
from flask_bcrypt import Bcrypt
from flask_login import UserMixin
from main import login_manager
from main import mydb
import MySQLdb
@login_manager.user_loader
def load_user(user_id):
user = User()
return user.getUserByID(int(user_id))
class User(UserMixin):
id = None
username = No... |
#!/usr/bin/env python
## \file parallel_computation.py
# \brief Python script for doing the continuous adjoint computation using the SU2 suite.
# \author T. Economon, T. Lukaczyk, F. Palacios
# \version 3.2.9 "eagle"
#
# SU2 Lead Developers: Dr. Francisco Palacios (Francisco.D.Palacios@boeing.com).
# ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.