src stringlengths 721 1.04M |
|---|
# -*- coding: utf-8 -*-
#
# Copyright (C) 2012 Edgewall Software
# All rights reserved.
#
# This software is licensed as described in the file COPYING, which
# you should have received as part of this distribution. The terms
# are also available at http://trac.edgewall.com/license.html.
#
# This software consi... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from setuptools import setup, find_packages, Extension
import sys
from setuptools.command.test import test as TestCommand
#try:
# import multiprocessing # Workaround for http://bugs.python.org/issue15881
#except ImportError:
# pass
# Pytest
class PyTest(TestComm... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright 2004-2012 Zuza Software Foundation
#
# This file is part of translate.
#
# translate 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... |
#!/usr/local/bin/python3
import os, sys, getopt
import quandl as ql
import pandas as pd
import numpy as np
from pylab import plot, figure, savefig
# read Russell 3000 constituents from a csv
def readRuss():
try:
ticks = []
russ = open('russ3.csv', 'r').read()
split = russ.split('\n')
... |
# -*- coding: utf-8 -*-
import requests
import unittest
import json
class TestRestApi(unittest.TestCase):
def __init__(self, *args, **kwargs):
super(TestRestApi, self).__init__(*args, **kwargs)
self.__api_base_url = "http://localhost:5000"
self.__user_url = "/usuario/"
self.__ruser = "?r_user="
self.__toke... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
"""Tests for the Android WebViewCache plugin."""
import unittest
from plaso.lib import timelib
from plaso.parsers.sqlite_plugins import android_webviewcache
from tests import test_lib as shared_test_lib
from tests.parsers.sqlite_plugins import test_lib
class AndroidWebView... |
from __future__ import absolute_import, division, print_function, unicode_literals
from amaasutils.random_utils import random_string
import datetime
from decimal import Decimal
import random
from amaascore.core.comment import Comment
from amaascore.core.reference import Reference
from amaascore.transactions.cash_tran... |
from __future__ import absolute_import, print_function, division
from theano.gof.graph import Variable, Apply
from theano.gof.type import Type
from theano.gof.op import Op
from theano.gof.fg import FunctionGraph
from theano.gof.toolbox import NodeFinder
def as_variable(x):
assert isinstance(x, Variable)
ret... |
from __future__ import print_function, division, absolute_import
from collections import defaultdict
import logging
import sys
import threading
import time
from timeit import default_timer
import dask
from toolz import valmap, groupby, concat
from tornado.ioloop import PeriodicCallback, IOLoop
from tornado import gen... |
def checkTime(path, whichExercise, userID):
# This function checks the time to ensure the user is not over training
# Import important libraries
import os
import time
import pickle
from mainmenu import menu
oDir = os.getcwd()
os.chdir(path)
cur_time = time.localtime()
cur_epoch ... |
import mock
import unittest
import testutils
from bin.commands import abandon
class TestAbandon(unittest.TestCase):
@mock.patch('bin.commands.utils.execute.check_output')
@mock.patch('bin.commands.utils.execute.call')
@mock.patch('bin.commands.utils.messages.info')
def test_abandon(self, mock_info, ... |
#!/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 ... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
import sys
from concurrent import futures
from concurrent.futures import ProcessPoolExecutor
from concurrent.futures import ThreadPoolExecutor
import click
from future.utils import text_type
from jpgrep.util import get_encoding
from jpgrep.util import filepathe... |
import os
import sys
import datetime
import time
import azure.batch.batch_service_client as batch
import azure.batch.batch_auth as batchauth
import azure.batch.models as batchmodels
from azure.storage.table import TableService, TableBatch
from azure.storage.blob import BlockBlobService
def get_analysis_state(all_task... |
# !/usr/bin/env python
# -*- coding: UTF-8 -*-
# Copyright (c) 2012-2015 Christian Schwarz
#
# 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 limitat... |
from . import setup, account, audits, drinks, config, show_version
from .utils import test_terminal_utf8
import argparse
import logging
log = logging.getLogger(__name__)
def setup_logging(log_level: str) -> None:
numeric_log_level = getattr(logging, log_level.upper(), None)
if not numeric_log_level:
... |
#!/usr/bin/python2
import sys, sqlite3, argparse
class dbmanager:
"""
DataStore Class for Juniper Devices
Stores hosts, thier usernames and passwords, and groups.
Groupes are lists of hosts with names.
Methods:
create_host -- insert a new host
modify_host_name -- modify a hosts host name
modify_host_user --... |
#!/usr/bin/env python
#
# This file is part of PrussianBlue.
# Copyright 2016, William Ewing. All rights reserved.
#
# PrussianBlue 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 t... |
import cgi
import logging
import os
import os.path
import re
from PIL import Image
from lxml import etree
from lxml.etree import XMLSyntaxError
from collections import namedtuple, defaultdict
from zipfile import ZipFile, BadZipfile
from docx2html.exceptions import (
ConversionFailed,
FileNotDocx,
Malforme... |
"""
:mod:`memductor` -- Basic (nonlinear) memductor
-----------------------------------------------
.. module:: memductor
.. moduleauthor:: Carlos Christoffersen
"""
import numpy as np
from cardoon.globalVars import const, glVar
import cardoon.circuit as cir
import cppaddev as ad
class Device(cir.Element):
r"""
... |
import requests
import json
import boto3
import collections
from properties import *
from icinga import *
ec = boto3.client('ec2')
def lambda_handler():
reservations = ec.describe_instances(
Filters=[
{'Name': 'tag-key', 'Values': ['monitor', 'Monitor']},
]
).get(
'Reserva... |
'''
Hard version of the maze game, which only shows the grid immediately around the player
First iteration, moved the logic around after this was first done to support a multiple-difficulties
mazeGame
'''
import maze
import random
import time
verbDict = {'up':['up','u','north','n'],
'down':['down', 'd', '... |
# -*- coding: cp1252 -*-
import Tkinter
class Scrollbar:
"""stellt eine Scrollbar für ein Canvas-Objekt bereit,
Parent muss dieses Canvas-Objekt als Attribut besitzen."""
def __init__(self, Parent, X):
self.Parent = Parent
self.X = X
self.Bar = self.Parent.Canvas.create_rectangle(0, 0,... |
# coding=utf-8
## web 到 内部状态1(Reply)
## tz = web_to_internal(url, pg_count)
##
## 内部状态1 到 编排
## internal_to_bp(tz)
##
## ----------------------------
##
## 编排 到 内部状态2(BPReply)
## lst = bp_to_internal2(infile)
##
## 处理 内部状态2
## lst = process_internal2(lst)
##
## 内部状态2 到 编排
## internal2_to_bp(lst)
##
## ---... |
import yaml
from os import makedirs
from os.path import join,dirname,realpath,isdir
script_dir = dirname(realpath(__file__))
default_yml_filepath = join(script_dir,'defaults.yml')
defaults = {
"output_dir": 'output',
"header_img_dir": 'imgs/headers/',
"scaled_img_dir": 'imgs/scaled/',
"original_img_d... |
# -*- coding: utf-8 -*-
# Copyright (c) 2011, Walter Bender
# Copyright (c) 2012, Ignacio Rodriguez
# 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... |
#########################################################################
#
# Copyright (C) 2012 OpenPlans
#
# 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
#... |
import tensorflow as tf
from FastWeightsRNN import LayerNormFastWeightsBasicRNNCell
from tensorflow.python.ops import seq2seq
import utils
import numpy as np
class FW_model(object):
def __init__(self, config=None, mode=None):
self.config = config
self.mode = mode
self.build_graph()
self.load_validat... |
# 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... |
import logging
from ..parsers import DictParser
from base_scraper import TwittrScrapr
log = logging.getLogger('scrapers.TimelineScrapr')
class TimelineScrapr(TwittrScrapr):
def __init__(self, api_keys, writer):
super(TimelineScrapr, self).__init__(api_keys, writer)
def _fetch_user_timeline(self, us... |
# -*- coding: utf-8 -*-
'''Wrappers for various units of text.'''
from __future__ import unicode_literals
import sys
import json
import string as pystring
from collections import defaultdict
from .packages import nltk
from .decorators import cached_property
from .utils import lowerstrip, PUNCTUATION_REGEX
from .infle... |
# Copyright 2013-2020 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack import *
class Orc(CMakePackage):
"""the smallest, fastest columnar storage for Hadoop
workloads."""
... |
from bottle import *
import random, math
from datetime import datetime
from MapGenerator import *
from Tessellation import *
def buildHTMLMap(seed, width, height):
tstart = datetime.now()
m = MapGenerator(int(width), int(height), str(seed))
#m.makeRandom().smooth().smooth().smooth().removeIslands().findSpawns()
... |
# -*- coding: utf-8 -*-
#
# license: AGPLv3, see LICENSE for details. In addition we strongly encourage
# you to buy us beer if we meet and you like the software.
"""Tests for custom validation rules for groups.
Since this hook will be added for all requests (the after auth hook) and this
is tested for auth.p... |
# -*- coding: utf-8 -*-
__author__ = 'jsz'
__version__ = 0.1
import web
import json
from search_engine import SearchService
from search_engine import FacetEncoder
from models import BookEncoder
# APIs exposed to front end
urls = (
"/keyWordsSearch","KeyWordsSearch",
"/facetSearch","FacetSear... |
#! /usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright (C) 2011 ~ 2012 Deepin, Inc.
# 2011 ~ 2012 Xia Bin
#
# Author: Xia Bin <xiabin@linuxdeepin.com>
# Maintainer: Xia Bin <xiabin@linuxdeepin.com>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of th... |
# -*- coding: utf-8 -*-
from django.conf.urls.defaults import patterns, include, url
from django.contrib.staticfiles.urls import staticfiles_urlpatterns
from django.conf import settings
js_info_dict = {
'packages': ('greenmine',),
}
from greenmine.base.views import api
from greenmine.base.views import config
f... |
#!/usr/bin/env python3
# Copyright (C) 2012-2015 ASTRON (Netherlands Institute for Radio Astronomy)
# P.O. Box 2, 7990 AA Dwingeloo, The Netherlands
#
# This file is part of the LOFAR software suite.
# The LOFAR software suite is free software: you can redistribute it and/or
# modify it under the terms of the GNU Gen... |
'''
A MLP network for MNIST digits classification
Project: https://github.com/roatienza/dl-keras
Usage: python3 <this file>
'''
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
# numpy package
import numpy as np
from keras.models import Sequential
from kera... |
# Design and Analysis of Algorithms II
# Week 5
# Traveling Salesman Problem
# Bottom up approach
import math
import sys
def distance(a,b):
return math.sqrt( (a[0]-b[0])**2 + (a[1]-b[1])**2 )
def constructsets(m, n, i):
if m == 0:
return [0]
r = []
r += map(lambda x : x | i, constructsets(m-1... |
# -*- coding: utf-8 -*-
# Copyright 2017 GIG Technology NV
#
# 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 -*-
from __future__ import unicode_literals
from django.db import models, migrations
import django.utils.timezone
import re
import django.core.validators
import taiga.users.models
class Migration(migrations.Migration):
dependencies = [
("contenttypes", "0001_initial"),
]
ope... |
#---------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
#---------------------------------------------------------------------... |
import unicodedata
from hieroglyph import builder
from hieroglyph import directives
from hieroglyph import html
from hieroglyph import slides
def version():
"""Return the installed package version."""
import pkg_resources
return pkg_resources.get_distribution('hieroglyph').version
def setup(app):
... |
"""Provides useful utility widgets.
Widgets:
MyDoubleSpinBox(QtGui.QDoubleSpinBox)
QNamedPushButton(QtGui.QPushButton)
QMultipleSpinBoxEdit(QtGui.QWidget)
"""
from PyQt4 import QtGui, QtCore
class MyDoubleSpinBox(QtGui.QDoubleSpinBox):
"""Selects all text once it receives a focusInEvent.
Use t... |
#!/usr/bin/env python
# Copyright (C) 2014-2015 Thomas Huang
#
# 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 ... |
# -*- coding: utf-8 -*-
import sys
reload(sys)
sys.setdefaultencoding( "utf-8" )
import string
import urllib2
import re
import json
class HTML_Tool:
# 用 非贪婪模式 匹配 \t 或者\n 或者 空格超链接 和图片
BgnCharToNoneRex = re.compile("(\t|\n|\r| |<a.*?>|<img.*?>)")
#用 非贪婪模式 陪 任意 <>
EndCharToNoneRex = re.compile("<.*?>")
... |
import unittest
from ietfparse.datastructures import ContentType
class ContentTypeCreationTests(unittest.TestCase):
def test_that_primary_type_is_normalized(self):
self.assertEqual('contenttype',
ContentType('COntentType', 'b').content_type)
def test_that_subtype_is_normaliz... |
# -*- coding: utf-8 -*-
"""
***************************************************************************
tri.py
---------------------
Date : October 2013
Copyright : (C) 2013 by Alexander Bruy
Email : alexander dot bruy at gmail dot com
*********************... |
import sys
import os
from os.path import join as opj
import pytest
from datetime import datetime, date
from unittest.mock import patch, Mock
from setuptools_scm import integration, git, NonNormalizedVersion
from setuptools_scm.utils import do, has_command
from setuptools_scm.file_finder_git import git_find_files
pyt... |
# -*- coding: utf-8 -*-
# Generated by Django 1.9.1 on 2016-06-08 20:02
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('THHome', '0001_initial'),
]
operations = [
migrations.CreateModel(
... |
# Copyright Red Hat 2020, Jake Hunsaker <jhunsake@redhat.com>
# This file is part of the sos project: https://github.com/sosreport/sos
#
# This copyrighted material is made available to anyone wishing to use,
# modify, copy, or redistribute it subject to the terms and conditions of
# version 2 of the GNU General Publi... |
#!/usr/bin/env python2
# -*- coding: utf-8 -*-
"""
Created on Wed Sep 20 13:37:16 2017
Author: Peiyong Jiang : jiangpeiyong@impcas.ac.cn
Function:
拉神使得变换。
"""
import matplotlib.pyplot as plt
import tensorflow as tf
import numpy as np
plt.close('all')
emitX=12
alphaX=-10.
betaX=1300.
gammaX=(1.+alphaX**2... |
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
import frappe
from frappe import _
def execute(filters=None):
columns = get_columns()
items = get_items(filters)
sl_entries = get_stock_ledger_entri... |
#
# Copyright (C) 2006-2014 Wyplay, All Rights Reserved.
# This file is part of xov.
#
# xov 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 ve... |
# -*- coding: utf-8 -*-
'''
Created on 2017/12/21
@author: yuyang
'''
import os
from urllib import request
import uuid
import re
import docx_ext
from docx.shared import Pt
from docx.shared import RGBColor
from docx.shared import Inches
JPEG_EXTENSION = '.jpg'
PNG_EXTENSION = '.png'
GIF_EXTENSION = '.gif'
SPLIT_STR... |
################################################################################
# Copyright (C) 2015-2020 by Last Run Contributors.
#
# This file is part of Arena of Titans.
#
# Arena of Titans is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as publ... |
import sys
import numpy as np
from neuralNet import neuralNet
with open('input.txt') as f:
inputs = []
for line in f:
line = line.split()
if line:
line = [float(i) for i in line]
inputs.append(line)
with open('output.txt') as f:
outputs = []
for line in f:
line = line.split()
if line:
line = [int... |
from __future__ import print_function
# (c) 2005 Ian Bicking and contributors; written for Paste (http://pythonpaste.org)
# Licensed under the MIT license: http://www.opensource.org/licenses/mit-license.php
# @@: This should be moved to paste.deploy
# For discussion of daemonizing:
# http://aspn.activestate.com/ASPN/... |
#!/usr/bin/env python
# -*-coding:utf-8-*-
# @Time : 2017/11/1 ~ 2019/9/1
# @Author : Allen Woo
from flask_babel import gettext
import regex as re
class ArgVerify:
def required(self, **kwargs):
for reqarg in kwargs.get("reqargs"):
if not reqarg[1]:
data = {'msg': gettext('The ... |
'''
@author: Hengguo Ge
'''
import zstackwoodpecker.test_util as test_util
import zstackwoodpecker.test_lib as test_lib
import zstackwoodpecker.test_state as test_state
import zstackwoodpecker.operations.vpc_operations as vpc_ops
import os
import time
from itertools import izip
VPC1_VLAN, VPC1_VXLAN = ['l3VlanNetwork... |
#!/usr/bin/env python3
# - coding: utf-8 -
# Copyright (C) 2010 Matías Ribecky <matias at mribecky.com.ar>
# Copyright (C) 2010-2012 Toms Bauģis <toms.baugis@gmail.com>
# Copyright (C) 2012 Ted Smith <tedks at cs.umd.edu>
# This file is part of Project Hamster.
# Project Hamster is free software: you can redistribut... |
#!/usr/bin/env python3
from os import mkdir
from os.path import isfile, isdir, abspath, dirname, basename, join
from shutil import copyfile
from optparse import OptionParser, OptionGroup, OptionValueError
from decimal import Decimal, InvalidOperation
from datetime import datetime
from mccode import McStas, Process
fro... |
"""
Copyright (c) 2014-2015-2015, The University of Texas at Austin.
All rights reserved.
This file is part of BLASpy and is available under the 3-Clause
BSD License, which can be found in the LICENSE file at the top-level
directory or at http://opensource.org/licenses/BSD-3-Clause
"""
from .err... |
# Setup Blender for Juno3D rendering
# Requires JunocamLibrary.blend to be loaded before running this
import bpy
from mathutils import Quaternion
# import Juno3D geometry and textures Wavefront OBJ
bpy.ops.import_scene.obj(filepath="/Users/bswift/Downloads/PJ0EFB/P00_102G.obj",axis_forward='Y', axis_up='Z')
# Replace ... |
#
# Copyright 2017 Import.io
#
# 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, ... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright (C) 2015 Joseph M. Sleiman
# This program is free software; you can redistribute it and/or
# modify it under the terms of the LGPLv2.1 or LGPLv3 License.
import math
import node
class HyperCube(object):
def __init__(self, dimension, nodeValues):
### ... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
r"""
# .---. .-----------
# / \ __ / ------
# / / \( )/ ----- (`-') _ _(`-') <-. (`-')_
# ////// '\/ ` --- ( OO).-/( (OO ).-> .-> \( OO) ) .->
# //// / // : : --- (,------.... |
#!/home/ec2-user/anaconda/bin/python
###########################################################################
##
## Copyright (c) 2015 Adobe Systems Incorporated. All rights reserved.
##
## Licensed under the Apache License, Version 2.0 (the "License");
## you may not use this file except in compliance with the Lic... |
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.conf import settings
from django.conf.urls import include, url
from django.conf.urls.static import static
from django.contrib import admin
from django.views.generic import TemplateView
urlpatterns = [
url(r'^$', TemplateView.as_view(templ... |
import unittest
from datetime import datetime
from StringIO import StringIO
import boto
import gevent
from gevent.pool import Pool
from termcolor import colored
from mock import Mock, patch, call
from awslogs import AWSLogs
from awslogs.exceptions import UnknownDateError, ConnectionError
from awslogs.core import NO_M... |
# -*- coding: utf-8 -*-
import pymssql
class Dao:
def __init__(self):
self.conn = None
self.cur = None
def connect(self):
# 数据库连接信息
self.conn = pymssql.connect(host="localhost:59318", user="eachen", password="123456", database="mydata",
cha... |
import datetime
from django.contrib.auth.models import User
from django.shortcuts import render
from django.utils import timezone
from django.db.models import Sum
from jsonview.decorators import json_view
from airmozilla.main.models import (
Event,
SuggestedEvent,
Picture,
EventRevision,
)
from airmo... |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2011 Cloudscaling Group, 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/LI... |
from operator import add, mul
from functools import partial
import six
from twisted.trial import unittest
from twisted.internet import defer
from txretry.retry import simpleBackoffIterator, RetryingCall
class TestBackoffIterator(unittest.TestCase):
"""Test the back-off iterator."""
def testNowDefault(self)... |
#!/usr/bin/env python3
from argparse import ArgumentParser
from pprint import pprint
from re import match
from vang.pio.shell import run_command
from vang.pio.synchronize_dirs import synchronize_dirs
def apply_patch(patch_repo, apply_repo, ref):
print('Apply patch', ref, patch_repo, apply_repo, ref)
rc, out... |
# -*- coding: utf-8 -*-
'''
Clone a remote SVN repository and use the filesystem as a Pillar source
This external Pillar source can be configured in the master config file like
so:
.. code-block:: yaml
ext_pillar:
- svn: trunk svn://svnserver/repo root=subdirectory
The `root=` parameter is optional and us... |
import busbus
from busbus.provider.ctran import CTranProvider
from .conftest import mock_gtfs_zip
import arrow
import pytest
import responses
@pytest.fixture(scope='module')
@responses.activate
def ctran_provider(engine):
responses.add(responses.GET, CTranProvider.gtfs_url,
body=mock_gtfs_zip('... |
from __future__ import absolute_import
from sentry import tagstore
from sentry.tagstore.models import EventTag
from sentry.models import ScheduledDeletion
from sentry.tasks.deletion import run_deletion
from sentry.testutils import TestCase
class DeleteTagKeyTest(TestCase):
def test_simple(self):
team = s... |
'''
Given a non-empty array of integers, every element appears twice except for one. Find that single one.
Note:
Your algorithm should have a linear runtime complexity. Could you implement it without using extra memory?
Example 1:
Input: [2,2,1]
Output: 1
Example 2:
Input: [4,1,2,1,2]
Output: 4
'''
def singleNumb... |
import copy
import logging
import numpy
import random
from ray.tune import TuneError
from ray.tune.sample import sample_from
logger = logging.getLogger(__name__)
def generate_variants(unresolved_spec):
"""Generates variants from a spec (dict) with unresolved values.
There are two types of unresolved values... |
from dbca_utils.utils import env
import dj_database_url
import os
from pathlib import Path
import sys
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
BASE_DIR = str(Path(__file__).resolve().parents[1])
PROJECT_DIR = str(Path(__file__).resolve().parents[0])
# Add PROJECT_DIR to the system path.
... |
# coding: utf-8
# Copyright (c) Pymatgen Development Team.
# Distributed under the terms of the MIT License.
from __future__ import division, unicode_literals
"""
An interface to the excellent spglib library by Atsushi Togo
(http://spglib.sourceforge.net/) for pymatgen.
v1.0 - Now works with both ordered and disorde... |
import pyfits
import numpy
STAT_HOIM = []
STAT_ANGSENS = []
STAT_XSENS = []
STAT_YSENS = []
STAT_ANGLE_TABLE = []
for derotAngle in numpy.arange(180.0):
IM = numpy.ones(8160)*(-1.0*derotAngle)
STAT_HOIM.append(IM)
ANGSENS = (numpy.ones(8160)*derotAngle+0.1)*(-1.0)
STAT_ANGSENS.append(ANGSENS)
XSENS... |
# -*- test-case-name: buildbot.test.test_transfer -*-
import os.path, tarfile, tempfile
from twisted.internet import reactor
from twisted.spread import pb
from twisted.python import log
from buildbot.process.buildstep import RemoteCommand, BuildStep
from buildbot.process.buildstep import SUCCESS, FAILURE, SKIPPED
from... |
#!/usr/bin/env python
#ryan g coleman ryangc@mail.med.upenn.edu
#kim sharp, brian shoichet, upenn, ucsf own this, whatevers
#reads a pdb file, for each atom, pick the most occupied one.
#useful when the alternate positions and occupancies are meaningful.
#if tie, just pick a consistent set for each residue.
import ... |
# !/usr/bin/env python
# -*- coding: utf-8 -*-
__all__ = ['BaseException', 'ResourceNotFoundWebException', 'DowngradeException']
class BaseException(Exception):
ERROR_CODE = None
STATUS_CODE = 200
def __init__(self, message, data=None, debug_message=None):
if self.ERROR_CODE is None:
... |
# -*- coding: utf-8 -*-
"""
A class for storing a tree graph. Primarily used for filter constructs in the
ORM.
"""
import copy
class Node(object):
"""
A single internal node in the tree graph. A Node should be viewed as a
connection (the root) with the children being either leaf nodes or other
Node ... |
# -*- coding: utf-8 -*-
"""
pyClanSphere.views.core
~~~~~~~~~~~~~~~~~~~~~~~
This module exports the main index page where plugins can hook in to display their widgets
:copyright: (c) 2009 - 2010 by the pyClanSphere Team,
see AUTHORS for more details.
:license: BSD, see LICENSE for... |
from django.conf import settings
from identityprovider.tests.helpers import FunctionalTestCase
class RateLimitTestCase(FunctionalTestCase):
def test(self):
# = Rate limits =
# Rate limiting is enforced only on POST requests to the login screen,
# on a per-username, per-IP basis.
... |
# PyEwsClient - Microsoft Office 365 EWS (Exchange Web Services) Client Library
# Copyright (C) 2013 Paul Greenberg <paul@greenberg.pro>
#
# 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 Foundatio... |
# - * - coding: utf - 8 -*-
from AccessControl.SecurityInfo import allow_module
from datetime import date
from docpool.base.utils import simplevoc_from_dict
from plone.app.vocabularies.terms import safe_simplevocabulary_from_values
from zope.interface import implementer
from zope.schema.interfaces import IVocabularyFac... |
# coding=utf-8
import logging
import os
import pathlib
import tables
import h5py
import daiquiri
import fire
import numpy as np
from typing import Union, Iterable
from ..atoms.numpy_atom import dtype_xyz
from ..atoms import numpy_atom as npa
from ..IO.trajectory_parser import XYZTrajectory
logger = logging.getLogg... |
""" Config module."""
import logging
import os
from configparser import SafeConfigParser
from torrench.utilities.Common import Common
class Config(Common):
r"""
Config class.
This class checks for config file's presence.
Also, this class manages TPB/KAT proxies; That is,
obtains TPB/KAT URL and ... |
# utils.py - additional functions
import re
# Common constants
RE_CJK_NUMERICS = r'〇ㄧ一二三四五六七八九十百零'
RE_CJK_NUMERICS_MIXED = r'〇ㄧ一二三四五六七八九十零壹貳參肆伍陸柒捌玖拾'
RE_CJK_NUMERICS_SINGLE = r'一二三四五六七八九十'
RE_CJK_PATTERN = '[\u3400-\u4DB5\u4E00-\u9FD5]'
RE_CJK_BOUNDARY_PRE = re.compile(r'(?<=' + RE_CJK_PATTERN + r')\s*([\d\-A-Za-z\(]+... |
# Copyright 2018 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: iso-8859-1 -*-
# -----------------------------------------------------------------------------
# event.py - Generic event handling
#
# Events are similar to Signals but use a different approach. They are
# global and always synchronized. An EventHandler can monitor specific
# or all events; it does not ev... |
# -*- coding: utf-8 -*-
"""
***************************************************************************
ExtentSelectionPanel.py
---------------------
Date : August 2012
Copyright : (C) 2012 by Victor Olaya
Email : volayaf at gmail dot com
******************... |
from languages.asp.asp_mapper import ASPMapper
class AnserSet(object):
"""A collection of data representing a generic Answer Set"""
def __init__(self, value, weightMap=dict()):
self.__value = value # Where data of answer set is stored
self.__weight_map = weightMap # Where weights of the ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.